mirror of
https://github.com/hcengineering/platform.git
synced 2026-10-01 14:05:05 +02:00
Date process funcs (#8441)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -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>
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user