Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions models/process/src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,18 @@ export function defineFunctions (builder: Builder): void {
process.function.RoleContext
)

builder.createDoc(
process.class.ProcessFunction,
core.space.Model,
{
of: core.class.TypeAny,
category: 'attribute',
label: process.string.EmptyValue,
type: 'context'
},
process.function.EmptyValue
)

builder.createDoc(
process.class.ProcessFunction,
core.space.Model,
Expand Down
4 changes: 4 additions & 0 deletions models/server-process/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ export function createModel (builder: Builder): void {
func: serverProcess.transform.RemoveLast
})

builder.mixin(process.function.EmptyValue, process.class.ProcessFunction, serverProcess.mixin.FuncImpl, {
func: serverProcess.transform.EmptyValue
})

builder.mixin(process.function.EmptyArray, process.class.ProcessFunction, serverProcess.mixin.FuncImpl, {
func: serverProcess.transform.EmptyArray
})
Expand Down
33 changes: 18 additions & 15 deletions plugins/card-resources/src/components/CardGridView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
// limitations under the License.
-->
<script lang="ts">
import type { Class, Doc, DocumentQuery, FindOptions, Ref, WithLookup } from '@hcengineering/core'
import { type Card } from '@hcengineering/card'
import type { Class, Doc, DocumentQuery, FindOptions, Ref, WithLookup } from '@hcengineering/core'
import { ActionContext, createQuery, getClient } from '@hcengineering/presentation'
import { Scroller } from '@hcengineering/ui'
import { BuildModelKey, ViewOptions } from '@hcengineering/view'
import { ListSelectionProvider, SelectDirection, buildConfigLookup, focusStore } from '@hcengineering/view-resources'
import CardGridItem from './CardGridItem.svelte'
Expand Down Expand Up @@ -71,20 +72,22 @@

<ActionContext context={{ mode: 'browser' }} />

<div class="grid-container">
{#each objects as object, i}
{@const selected = selection === i}
<div class="grid-cell">
<CardGridItem
{object}
{selected}
on:obj-focus={(evt) => {
listProvider.updateFocus(evt.detail)
}}
/>
</div>
{/each}
</div>
<Scroller fade={{ multipler: { top: 3, bottom: 2.5 } }} padding={'0 1rem'} checkForHeaders>
<div class="grid-container">
{#each objects as object, i}
{@const selected = selection === i}
<div class="grid-cell">
<CardGridItem
{object}
{selected}
on:obj-focus={(evt) => {
listProvider.updateFocus(evt.detail)
}}
/>
</div>
{/each}
</div>
</Scroller>

<style lang="scss">
.grid-container {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<span class="flex-presenter">
<span class="mr-1"><Icon {icon} size="small" /></span>
<Label label={communication.string.Unset} />
<span class="lower"><Label label={model.label} /></span>
<span class="lower ml-1"><Label label={model.label} /></span>
</span>
{:else}
<ActivityAttributeValue {model} {icon} values={value}>
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@
"YearFromDate": "Rok z data",
"MonthFromDate": "Měsíc z data",
"DayFromDate": "Den z data",
"DateDifference": "Rozdíl dat"
"DateDifference": "Rozdíl dat",
"EmptyValue": "Prázdná hodnota"
},
"error": {
"MethodNotFound": "Metoda nenalezena: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@
"YearFromDate": "Jahr aus Datum",
"MonthFromDate": "Monat aus Datum",
"DayFromDate": "Tag aus Datum",
"DateDifference": "Datumsdifferenz"
"DateDifference": "Datumsdifferenz",
"EmptyValue": "Leerer Wert"
},
"error": {
"MethodNotFound": "Methode nicht gefunden: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
"YearFromDate": "Year from date",
"MonthFromDate": "Month from date",
"DayFromDate": "Day from date",
"DateDifference": "Date difference"
"DateDifference": "Date difference",
"EmptyValue": "Empty value"
},
"error": {
"MethodNotFound": "Method not found: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
"YearFromDate": "Año desde fecha",
"MonthFromDate": "Mes desde fecha",
"DayFromDate": "Día desde fecha",
"DateDifference": "Diferencia de fechas"
"DateDifference": "Diferencia de fechas",
"EmptyValue": "Valor vacío"
},
"error": {
"MethodNotFound": "Método no encontrado: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
"YearFromDate": "Année depuis date",
"MonthFromDate": "Mois depuis date",
"DayFromDate": "Jour depuis date",
"DateDifference": "Différence de dates"
"DateDifference": "Différence de dates",
"EmptyValue": "Valeur vide"
},
"error": {
"MethodNotFound": "Méthode introuvable : {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
"YearFromDate": "Anno da data",
"MonthFromDate": "Mese da data",
"DayFromDate": "Giorno da data",
"DateDifference": "Differenza di date"
"DateDifference": "Differenza di date",
"EmptyValue": "Valore vuoto"
},
"error": {
"MethodNotFound": "Metodo non trovato: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@
"YearFromDate": "日付から年",
"MonthFromDate": "日付から月",
"DayFromDate": "日付から日",
"DateDifference": "日付の差"
"DateDifference": "日付の差",
"EmptyValue": "空の値"
},
"error": {
"MethodNotFound": "メソッドが見つかりません: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@
"YearFromDate": "Ano de data",
"MonthFromDate": "Mês de data",
"DayFromDate": "Dia de data",
"DateDifference": "Diferença de datas"
"DateDifference": "Diferença de datas",
"EmptyValue": "Valor vazio"
},
"error": {
"MethodNotFound": "Método não encontrado: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
"YearFromDate": "Ano de data",
"MonthFromDate": "Mês de data",
"DayFromDate": "Dia de data",
"DateDifference": "Diferença de datas"
"DateDifference": "Diferença de datas",
"EmptyValue": "Valor vazio"
},
"error": {
"MethodNotFound": "Método não encontrado: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
"YearFromDate": "Год из даты",
"MonthFromDate": "Месяц из даты",
"DayFromDate": "День из даты",
"DateDifference": "Разница дат"
"DateDifference": "Разница дат",
"EmptyValue": "Пустое значение"
},
"error": {
"MethodNotFound": "Метод не найден: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@
"YearFromDate": "Tarihten yıl",
"MonthFromDate": "Tarihten ay",
"DayFromDate": "Tarihten gün",
"DateDifference": "Tarih farkı"
"DateDifference": "Tarih farkı",
"EmptyValue": "Boş değer"
},
"error": {
"MethodNotFound": "Metod bulunamadı: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
"YearFromDate": "日期到年份",
"MonthFromDate": "日期到月份",
"DayFromDate": "日期到天",
"DateDifference": "日期差异"
"DateDifference": "日期差异",
"EmptyValue": "空值"
},
"error": {
"MethodNotFound": "找不到方法:{methodId}",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-resources/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export default mergeIds(processId, process, {
For: '' as IntlString,
Attribute: '' as IntlString,
Context: '' as IntlString,
EmptyValue: '' as IntlString,
EmptyArray: '' as IntlString,
ExecutionInitiator: '' as IntlString,
ExecutionStarted: '' as IntlString,
Expand Down
2 changes: 1 addition & 1 deletion plugins/process-resources/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ function getContextFunctions (
break
}
default: {
if (hierarchy.isDerived(func.of, target)) {
if (hierarchy.isDerived(func.of, target) || func.of === core.class.TypeAny) {
matched.push(func._id)
}
}
Expand Down
1 change: 1 addition & 0 deletions plugins/process/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ export default plugin(processId, {
ExecutionStarted: '' as Ref<ProcessFunction>,
ExecutionEmployeeInitiator: '' as Ref<ProcessFunction>,
ExecutionInitiator: '' as Ref<ProcessFunction>,
EmptyValue: '' as Ref<ProcessFunction>,
EmptyArray: '' as Ref<ProcessFunction>,
CurrentDate: '' as Ref<ProcessFunction>,
StringFromNumber: '' as Ref<ProcessFunction>,
Expand Down
6 changes: 3 additions & 3 deletions plugins/view-resources/src/components/StringPresenter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
import { getEmbeddedLabel } from '@hcengineering/platform'
import { LabelAndProps, LinkWrapper, tooltip } from '@hcengineering/ui'

export let value: string | string[] | undefined
export let value: string | string[] | null | undefined
export let accent: boolean = false
export let oneLine: boolean = false

$: tooltipParams = getTooltip(value)

function getTooltip (value: string | string[] | undefined): LabelAndProps | undefined {
if (value === undefined) return
function getTooltip (value: string | string[] | null | undefined): LabelAndProps | undefined {
if (value == null) return
let str = ''
if (Array.isArray(value)) {
str = value.reduce((acc, curr, i) => (acc += i === 0 ? curr : ` ${curr}`), '')
Expand Down
2 changes: 2 additions & 0 deletions server-plugins/process-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import {
DayFromDate,
Divide,
EmptyArray,
EmptyValue,
ExecutionInitiator,
ExecutionStarted,
Filter,
Expand Down Expand Up @@ -680,6 +681,7 @@ export default async () => ({
RemoveFirst,
RemoveLast,
EmptyArray,
EmptyValue,
ExecutionInitiator,
ExecutionStarted,
FirstMatchValue,
Expand Down
4 changes: 4 additions & 0 deletions server-plugins/process-resources/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ export async function CurrentDate (): Promise<Timestamp> {
return Date.now()
}

export function EmptyValue (): null {
return null
}

export function EmptyArray (): any[] {
return []
}
Expand Down
4 changes: 2 additions & 2 deletions server-plugins/process-resources/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ async function getFunctionValue (
const funcImpl = control.client.getHierarchy().as(transform, serverProcess.mixin.FuncImpl)
const f = await getResource(funcImpl.func)
const val = await f(res, {}, control, execution)
if (val == null) {
if (val == null && context.func !== process.function.EmptyValue) {
throw processError(process.error.EmptyFunctionResult, {}, { func: func.label })
}
return val
}
if (res == null) {
if (res == null && context.func !== process.function.EmptyValue) {
throw processError(process.error.EmptyFunctionResult, {}, { func: func.label })
}
return res
Expand Down
1 change: 1 addition & 0 deletions server-plugins/process/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default plugin(serverProcessId, {
RemoveLast: '' as Resource<TransformFunc>,
CurrentUser: '' as Resource<TransformFunc>,
CurrentDate: '' as Resource<TransformFunc>,
EmptyValue: '' as Resource<TransformFunc>,
EmptyArray: '' as Resource<TransformFunc>,
Filter: '' as Resource<TransformFunc>,
FirstMatchValue: '' as Resource<TransformFunc>,
Expand Down
Loading