Date process funcs (#8441)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2025-04-03 00:22:53 +07:00
committed by GitHub
parent 241d08fd89
commit 073017ae67
48 changed files with 798 additions and 195 deletions
+8 -3
View File
@@ -72,10 +72,11 @@ export interface Method<T extends Doc> extends Doc {
presenter?: AnyComponent
}
// add impl in server
export interface ProcessFunction extends Doc {
of: Ref<Class<Doc>>
category?: AttributeCategory
editor?: AnyComponent
category: AttributeCategory | undefined
allowMany?: boolean
label: IntlString
}
@@ -113,6 +114,10 @@ export default plugin(processId, {
Random: '' as Ref<ProcessFunction>,
UpperCase: '' as Ref<ProcessFunction>,
LowerCase: '' as Ref<ProcessFunction>,
Trim: '' as Ref<ProcessFunction>
Trim: '' as Ref<ProcessFunction>,
Add: '' as Ref<ProcessFunction>,
Subtract: '' as Ref<ProcessFunction>,
Offset: '' as Ref<ProcessFunction>,
FirstWorkingDayAfter: '' as Ref<ProcessFunction>
}
})
+6 -1
View File
@@ -19,6 +19,11 @@ export interface RelatedContext {
attributes: AnyAttribute[]
}
export interface Func {
func: Ref<ProcessFunction>
props: Record<string, any>
}
interface BaseSelectedContext {
type: 'attribute' | 'relation' | 'nested'
// attribute key
@@ -28,7 +33,7 @@ interface BaseSelectedContext {
sourceFunction?: Ref<ProcessFunction>
// process one by one
functions?: Array<Ref<ProcessFunction>>
functions?: Func[]
fallbackValue?: any
}
+1 -1
View File
@@ -5,7 +5,7 @@ export function parseContext (value: any): SelectedContext | undefined {
if (typeof value !== 'string') return
const index = value.indexOf('${')
if (index === -1) return
const endIndex = value.indexOf('}')
const endIndex = value.lastIndexOf('}')
if (endIndex === -1) return
const content = value.substring(index + 1, endIndex + 1)
try {