@acorex/platform 19.1.3 → 19.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/index.d.ts +1 -0
- package/common/lib/app/application.types.d.ts +2 -2
- package/common/lib/file-storage/file-storage.service.d.ts +13 -0
- package/common/lib/file-storage/file-storage.types.d.ts +143 -0
- package/common/lib/file-storage/index.d.ts +2 -0
- package/common/lib/filters/filters.types.d.ts +2 -1
- package/common/lib/settings/setting-definition.provider.d.ts +12 -5
- package/common/lib/settings/setting.builder.d.ts +4 -3
- package/common/lib/settings/settings.provider.d.ts +2 -7
- package/common/lib/settings/settings.service.d.ts +19 -7
- package/common/lib/settings/settings.types.d.ts +15 -2
- package/core/utils/highlighter.d.ts +1 -1
- package/fesm2022/acorex-platform-common.mjs +194 -74
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-core.mjs +2 -2
- package/fesm2022/acorex-platform-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-builder.mjs +245 -444
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-designer.mjs +13 -13
- package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +59 -54
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-filters.mjs +82 -5
- package/fesm2022/acorex-platform-layout-filters.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-setting.mjs +73 -91
- package/fesm2022/acorex-platform-layout-setting.mjs.map +1 -1
- package/fesm2022/acorex-platform-layouts.mjs +3 -4
- package/fesm2022/acorex-platform-layouts.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-K9B_-q_K.mjs +108 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-K9B_-q_K.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DAmHq1bt.mjs +369 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DAmHq1bt.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Cd2gxLZt.mjs +87 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Cd2gxLZt.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-6sZdw013.mjs +130 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-6sZdw013.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-setting-page.component-BYpCgHZb.mjs +74 -0
- package/fesm2022/acorex-platform-themes-default-setting-page.component-BYpCgHZb.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-setting-view.component-CdmIphX1.mjs +73 -0
- package/fesm2022/acorex-platform-themes-default-setting-view.component-CdmIphX1.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default.mjs +20 -20
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-shared.mjs +288 -81
- package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
- package/fesm2022/{acorex-platform-widgets-checkbox-widget-column.component-05nKV-UV.mjs → acorex-platform-widgets-checkbox-widget-column.component-jeZBOEhl.mjs} +18 -14
- package/fesm2022/acorex-platform-widgets-checkbox-widget-column.component-jeZBOEhl.mjs.map +1 -0
- package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-B_Gec5Qf.mjs → acorex-platform-widgets-checkbox-widget-designer.component-RCi5IJOR.mjs} +4 -4
- package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-B_Gec5Qf.mjs.map → acorex-platform-widgets-checkbox-widget-designer.component-RCi5IJOR.mjs.map} +1 -1
- package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-DU1niJES.mjs +64 -0
- package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-DU1niJES.mjs.map +1 -0
- package/fesm2022/{acorex-platform-widgets-color-box-widget-designer.component-B2g0ct24.mjs → acorex-platform-widgets-color-box-widget-designer.component-CWhbgmDV.mjs} +4 -4
- package/fesm2022/acorex-platform-widgets-color-box-widget-designer.component-CWhbgmDV.mjs.map +1 -0
- package/fesm2022/acorex-platform-widgets.mjs +1309 -334
- package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
- package/fesm2022/acorex-platform-workflow.mjs +9 -3
- package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
- package/layout/builder/lib/builder/builder.module.d.ts +6 -7
- package/layout/builder/lib/builder/builder.service.d.ts +9 -10
- package/layout/builder/lib/builder/context-store.service.d.ts +33 -0
- package/layout/builder/lib/builder/index.d.ts +4 -2
- package/layout/builder/lib/builder/widget-catalog.d.ts +1 -1
- package/layout/builder/lib/builder/widget-container.component.d.ts +34 -9
- package/layout/builder/lib/builder/widget-groups.d.ts +1 -0
- package/layout/builder/lib/builder/widget-map.d.ts +43 -0
- package/layout/builder/lib/builder/{widget-renderer.component.directive.d.ts → widget-renderer.directive.d.ts} +26 -0
- package/layout/builder/lib/builder/widget-status.types.d.ts +14 -0
- package/layout/builder/lib/builder/widget.types.d.ts +41 -55
- package/layout/designer/lib/preview/preview-viewer.component.d.ts +2 -2
- package/layout/designer/lib/property-viewer/widget-property-viewer.component.d.ts +2 -2
- package/layout/entity/lib/entity-master-list.viewmodel.d.ts +7 -2
- package/layout/entity/lib/widgets/lookup-widget/lookup-widget-edit.component.d.ts +0 -1
- package/layout/filters/lib/filters.viewmodel.d.ts +13 -3
- package/layout/setting/lib/convert-setting-data.d.ts +0 -20
- package/layout/setting/lib/setting.viewmodel.d.ts +65 -4
- package/layouts/lib/admin/entity-layout/entity-details-view/entity-details-view.component.d.ts +15 -5
- package/package.json +15 -15
- package/themes/default/lib/layouts/base/simple-page/simple-page.layout.d.ts +15 -5
- package/themes/default/lib/layouts/entity-layouts/entity-detail-list-view/entity-detail-list-view.component.d.ts +15 -5
- package/themes/default/lib/layouts/entity-layouts/entity-master-create-view/entity-master-create-view.component.d.ts +2 -1
- package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +17 -6
- package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/list-view-option-filters/list-view-option-filters.component.d.ts +6 -3
- package/themes/default/lib/layouts/entity-layouts/entity-master-modify-view/entity-master-modify-view.component.d.ts +2 -1
- package/themes/default/lib/layouts/entity-layouts/entity-master-single-view/entity-master-single-view.component.d.ts +15 -5
- package/themes/default/lib/layouts/filters-layout/simple-filter-builder/filters-view.component.d.ts +6 -5
- package/themes/default/lib/layouts/root-layout/components/header/header.component.d.ts +15 -5
- package/themes/default/lib/layouts/root-layout/root-layout.component.d.ts +15 -5
- package/themes/default/lib/layouts/setting-layout/setting-page/setting-page.component.d.ts +0 -47
- package/themes/default/lib/layouts/setting-layout/setting-view/setting-view.component.d.ts +19 -5
- package/themes/shared/index.d.ts +3 -1
- package/themes/shared/lib/components/theme-slot.component.d.ts +23 -13
- package/themes/shared/lib/palette.provider.d.ts +9 -0
- package/themes/shared/lib/setting.keys.d.ts +7 -2
- package/themes/shared/lib/setting.provider.d.ts +1 -0
- package/themes/shared/lib/shared.module.d.ts +2 -1
- package/themes/shared/lib/{services/theme.service.d.ts → theme.service.d.ts} +16 -24
- package/themes/shared/lib/theme.types.d.ts +25 -0
- package/themes/shared/lib/widgets/theme-color-selection/index.d.ts +2 -0
- package/themes/shared/lib/widgets/theme-color-selection/theme-color-selection-widget-edit.component.d.ts +6 -0
- package/themes/shared/lib/widgets/theme-color-selection/theme-color-selection-widget.config.d.ts +7 -0
- package/widgets/lib/properties/layout.props.d.ts +1 -0
- package/widgets/lib/widgets/advance/avatar/avatar-widget-column.component.d.ts +6 -0
- package/widgets/lib/widgets/advance/avatar/avatar-widget-designer.component.d.ts +6 -0
- package/widgets/lib/widgets/advance/avatar/avatar-widget-edit.component.d.ts +18 -0
- package/widgets/lib/widgets/advance/avatar/avatar-widget-print.component.d.ts +6 -0
- package/widgets/lib/widgets/advance/avatar/avatar-widget-view.component.d.ts +6 -0
- package/widgets/lib/widgets/advance/avatar/avatar-widget.config.d.ts +7 -0
- package/widgets/lib/widgets/advance/avatar/index.d.ts +6 -0
- package/widgets/lib/widgets/advance/map/map-box-widget-edit.component.d.ts +9 -5
- package/widgets/lib/widgets/advance/map/map-box-widget-view.component.d.ts +6 -4
- package/widgets/lib/widgets/editors/number/number-box-widget-edit.component.d.ts +1 -7
- package/widgets/lib/widgets/editors/toggle/toggle-widget-edit.component.d.ts +0 -2
- package/widgets/lib/widgets/filters/operations/operations.component.d.ts +9 -0
- package/widgets/lib/widgets/filters/string-filter/index.d.ts +2 -0
- package/widgets/lib/widgets/filters/string-filter/string-filter-widget-edit.component.d.ts +11 -0
- package/widgets/lib/widgets/filters/string-filter/string-filter-widget.config.d.ts +7 -0
- package/widgets/lib/widgets/index.d.ts +5 -1
- package/widgets/lib/widgets/property-editors/border/border-widget-editor.component.d.ts +29 -7
- package/widgets/lib/widgets/property-editors/border/index.d.ts +0 -1
- package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget-editor.component.d.ts +31 -0
- package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget.config.d.ts +7 -0
- package/widgets/lib/widgets/property-editors/flex-options/flex-options-widget.type.d.ts +15 -0
- package/widgets/lib/widgets/property-editors/flex-options/index.d.ts +3 -0
- package/widgets/lib/widgets/property-editors/property-editor-helper.d.ts +72 -0
- package/widgets/lib/widgets/property-editors/property-editor.type.d.ts +35 -0
- package/widgets/lib/widgets/property-editors/spacing/index.d.ts +0 -1
- package/widgets/lib/widgets/property-editors/spacing/spacing-widget-editor.component.d.ts +11 -9
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-CSyR4pYp.mjs +0 -108
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-CSyR4pYp.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-xHWp2Lk-.mjs +0 -368
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-xHWp2Lk-.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-n7mYNduJ.mjs +0 -87
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-n7mYNduJ.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-DjyYU0Gy.mjs +0 -130
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-DjyYU0Gy.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-setting-page.component-6Dd8MGqr.mjs +0 -78
- package/fesm2022/acorex-platform-themes-default-setting-page.component-6Dd8MGqr.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-setting-view.component-BgiMClew.mjs +0 -58
- package/fesm2022/acorex-platform-themes-default-setting-view.component-BgiMClew.mjs.map +0 -1
- package/fesm2022/acorex-platform-widgets-checkbox-widget-column.component-05nKV-UV.mjs.map +0 -1
- package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-BkWcZ4K9.mjs +0 -72
- package/fesm2022/acorex-platform-widgets-checkbox-widget-view.component-BkWcZ4K9.mjs.map +0 -1
- package/fesm2022/acorex-platform-widgets-color-box-widget-designer.component-B2g0ct24.mjs.map +0 -1
- package/layout/builder/lib/builder/widget-renderer.component.d.ts +0 -48
- package/widgets/lib/widgets/property-editors/border/border-widget-type.d.ts +0 -18
- package/widgets/lib/widgets/property-editors/spacing/spacing-widget-type.d.ts +0 -16
|
@@ -147,7 +147,10 @@ class AXPWorkflowService {
|
|
|
147
147
|
if (currentStep.input) {
|
|
148
148
|
let inputs = {};
|
|
149
149
|
await this.processInputs(cloneDeep(currentStep.input), inputs, '', context);
|
|
150
|
-
|
|
150
|
+
await new Promise((resolve) => setTimeout(async () => {
|
|
151
|
+
Object.assign(action, inputs);
|
|
152
|
+
resolve(0);
|
|
153
|
+
}));
|
|
151
154
|
}
|
|
152
155
|
try {
|
|
153
156
|
await new Promise((resolve) => setTimeout(async () => {
|
|
@@ -258,8 +261,9 @@ class AXPWorkflowService {
|
|
|
258
261
|
}
|
|
259
262
|
}
|
|
260
263
|
async processInputs(obj, inputs, pathPrefix = '', context = {}) {
|
|
261
|
-
if (!obj)
|
|
264
|
+
if (!obj) {
|
|
262
265
|
return;
|
|
266
|
+
}
|
|
263
267
|
for await (const i of Object.entries(obj)) {
|
|
264
268
|
const key = i[0];
|
|
265
269
|
const value = i[1];
|
|
@@ -268,7 +272,9 @@ class AXPWorkflowService {
|
|
|
268
272
|
const expValue = await this.evaluateExpression(value, context);
|
|
269
273
|
set(inputs, currentPath, expValue);
|
|
270
274
|
}
|
|
271
|
-
else if (typeof value === 'object' &&
|
|
275
|
+
else if (typeof value === 'object' &&
|
|
276
|
+
value !== null &&
|
|
277
|
+
(value.constructor === Object || Array.isArray(value))) {
|
|
272
278
|
// Recursively handle nested objects
|
|
273
279
|
this.processInputs(value, inputs, currentPath, context);
|
|
274
280
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-workflow.mjs","sources":["../../../../libs/platform/workflow/src/lib/errors.types.ts","../../../../libs/platform/workflow/src/lib/workflow-event-dispatcher.service.ts","../../../../libs/platform/workflow/src/lib/workflow-registery.service.ts","../../../../libs/platform/workflow/src/lib/workflow.types.ts","../../../../libs/platform/workflow/src/lib/workflow.service.ts","../../../../libs/platform/workflow/src/lib/actions/start-workflow.action.ts","../../../../libs/platform/workflow/src/lib/workflow.module.ts","../../../../libs/platform/workflow/src/acorex-platform-workflow.ts"],"sourcesContent":["export class AXPWorkflowError extends Error {\n constructor(message: string, public inner: Error | null = null) {\n super(message);\n this.name = 'AXPWorkflowError';\n }\n}","import { Injectable } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\nimport { AXPWorkflowEvent } from './workflow.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowEventService {\n private eventSubject = new Subject<AXPWorkflowEvent>();\n\n dispatch(event: AXPWorkflowEvent): void {\n this.eventSubject.next(event);\n }\n\n get events$(): Observable<AXPWorkflowEvent> {\n return this.eventSubject.asObservable();\n }\n}\n","import { Injectable, Type } from '@angular/core';\nimport { AXPWorkflow, AXPWorkflowAction, AXPWorkflowFunction } from './workflow.types';\n\n\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AXPWorkflowRegistryService {\n private functionsMap = new Map<string, Type<AXPWorkflowFunction>>();\n private actionsMap = new Map<string, Type<AXPWorkflowAction>>();\n private workflowsMap = new Map<string, AXPWorkflow>();\n\n registerWorkflow(name: string, workflow: AXPWorkflow): void {\n this.workflowsMap.set(name, workflow);\n }\n\n getWorkflow(name: string): AXPWorkflow | undefined {\n return this.workflowsMap.get(name);\n }\n\n registerAction(name: string, action: Type<AXPWorkflowAction>): void {\n this.actionsMap.set(name, action);\n }\n\n getAction(name: string): Type<AXPWorkflowAction> | undefined {\n return this.actionsMap.get(name);\n }\n\n registerFunction(name: string, func: Type<AXPWorkflowFunction>): void {\n this.functionsMap.set(name, func);\n }\n\n getFunction(name: string): Type<AXPWorkflowFunction> | undefined {\n return this.functionsMap.get(name);\n }\n\n getFunctionNames(): string[] {\n return Array.from(this.functionsMap.keys());\n }\n}","import { Injectable, inject } from '@angular/core';\nimport { filter } from 'rxjs';\nimport { AXPWorkflowEventService } from './workflow-event-dispatcher.service';\nimport { cloneDeep, get, set } from 'lodash-es';\n\nexport interface AXPWorkflow {\n steps: { [stepName: string]: AXPWorkflowStep };\n startStepId: string;\n}\n\n\nexport class AXPWorkflowContext {\n\n constructor(initialData: any = {}) {\n this.variables = cloneDeep(initialData);\n }\n\n private variables: any = {};\n private stepOutputs: Map<string, any> = new Map();\n\n setVariable(key: string, value: any): void {\n set(this.variables, key, value);\n }\n\n\n setVariables(context: any = {}) {\n this.variables = { ...this.variables, ...context };\n }\n\n getVariable<T = any>(key: string): T {\n return get(this.variables, key);\n }\n\n setOutput(key: string, output: any): void {\n this.stepOutputs.set(key, output);\n }\n\n setOutputs(values: Map<string, any>): void {\n this.stepOutputs = new Map([...this.stepOutputs, ...values])\n }\n\n getOutput<T = any>(key: string): T {\n return this.stepOutputs.get(key);\n }\n}\n\nexport type AXPWorkflowActionInput = any;\n\nexport type AXPWorkflowConditionType = 'AND' | 'OR' | 'SINGLE';\n\nexport interface AXPWorkflowCondition {\n type: AXPWorkflowConditionType;\n conditions?: AXPWorkflowCondition[]; // Nested conditions\n expression?: string; // Used if type is 'SINGLE'\n}\n\nexport interface AXPWorkflowNextStep {\n conditions: AXPWorkflowCondition[];\n nextStepId: string;\n}\n\nexport interface AXPWorkflowStep {\n id?: string;\n action: AXPWorkflowAction | string;\n input?: AXPWorkflowActionInput;\n nextSteps?: AXPWorkflowNextStep[];\n conditions?: AXPWorkflowCondition[];\n}\n@Injectable()\nexport abstract class AXPWorkflowAction {\n private eventService = inject(AXPWorkflowEventService);\n\n protected dispatch(event: AXPWorkflowEvent): void {\n this.eventService.dispatch(event);\n }\n\n abstract execute(context: AXPWorkflowContext): Promise<void>;\n}\n\n@Injectable()\nexport abstract class AXPWorkflowFunction {\n abstract execute(...args: any[]): Promise<any> | any;\n}\n\nexport interface AXPWorkflowEvent<T = any> {\n type: string;\n payload?: T;\n}\n\n\n\nexport function createWorkFlowEvent<T>(type: string) {\n const eventCreator = (payload: T) => ({ type, payload });\n eventCreator.type = type;\n return eventCreator;\n}\n\nexport function ofType<T extends { type: string }>(...allowedTypes: Array<{ type: string }>) {\n return filter((event: T) => allowedTypes.some((type) => event.type === type.type));\n}\n","import { Injectable, Injector, inject } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AXPWorkflowError } from './errors.types';\nimport { AXPWorkflowEventService } from './workflow-event-dispatcher.service';\nimport { AXPWorkflowRegistryService } from './workflow-registery.service';\nimport {\n AXPWorkflow,\n AXPWorkflowAction,\n AXPWorkflowCondition,\n AXPWorkflowContext,\n AXPWorkflowEvent,\n AXPWorkflowFunction,\n AXPWorkflowNextStep,\n AXPWorkflowStep,\n} from './workflow.types';\nimport { cloneDeep, set } from 'lodash-es';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowService {\n private eventService = inject(AXPWorkflowEventService);\n\n\n get events$(): Observable<AXPWorkflowEvent> {\n return this.eventService.events$;\n }\n\n constructor(private registryService: AXPWorkflowRegistryService, private injector: Injector) { }\n\n async execute(workflow: AXPWorkflow | string, initialContext: AXPWorkflowContext | any | null = null): Promise<AXPWorkflowContext> {\n // Instantiate or retrieve the workflow\n const wk = typeof workflow === 'string' ? this.getWorkflowInstance(workflow) : workflow;\n\n let currentStepId = wk.startStepId;\n const context = initialContext instanceof AXPWorkflowContext ? initialContext : new AXPWorkflowContext(initialContext ?? {});\n // Initialize context with initial variables\n\n while (currentStepId) {\n const currentStep = wk.steps[currentStepId];\n if (!currentStep) {\n throw new AXPWorkflowError(`Step '${currentStepId}' not found in the workflow steps.`);\n }\n\n // Instantiate or retrieve the action\n const action = typeof currentStep.action === 'string' ? this.getActionInstance(currentStep.action) : currentStep.action;\n if (currentStep.input) {\n let inputs: any = {};\n await this.processInputs(cloneDeep(currentStep.input), inputs, '', context);\n Object.assign(action, inputs);\n }\n try {\n await new Promise((resolve) => setTimeout(async () => {\n await action.execute(context);\n resolve(0);\n }, 0));\n } catch (error) {\n console.error(error);\n throw new AXPWorkflowError('Workflow Error', error as Error);\n }\n // Determine the next step based on the conditions\n const nextStepInfo = await this.determineNextStep(currentStep, context);\n if (nextStepInfo) {\n currentStepId = nextStepInfo.nextStepId;\n } else {\n break; // Exit the loop if no next step is determined\n }\n }\n return context;\n }\n\n //TODO : replace with AXDataGenerator\n private uuid(): string {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char) => {\n const random = (Math.random() * 16) | 0;\n const value = char === 'x' ? random : (random & 0x3) | 0x8;\n return value.toString(16);\n });\n }\n\n private getActionInstance(actionName: string): AXPWorkflowAction {\n const actionType = this.registryService.getAction(actionName);\n if (!actionType) {\n throw new AXPWorkflowError(`Action type '${actionName}' not found in the registry.`);\n }\n return this.injector.get(actionType,);\n }\n\n private getWorkflowInstance(workflowName: string): AXPWorkflow {\n const workflowType = this.registryService.getWorkflow(workflowName);\n if (!workflowType) {\n throw new AXPWorkflowError(`Workflow type '${workflowName}' not found in the registry.`);\n }\n return workflowType;\n }\n\n private async determineNextStep(\n currentStep: AXPWorkflowStep,\n context: AXPWorkflowContext\n ): Promise<AXPWorkflowNextStep | null> {\n if (!currentStep.nextSteps) {\n return null;\n }\n for (const nextStep of currentStep.nextSteps) {\n if (await this.evaluateCondition(nextStep.conditions, context)) {\n return nextStep;\n }\n }\n return null;\n }\n\n private async evaluateCondition(conditions: AXPWorkflowCondition[], context: AXPWorkflowContext): Promise<boolean> {\n if (!conditions || conditions.length === 0) {\n return true; // If no conditions, the step proceeds\n }\n\n // Map each condition to a promise using evaluateSingleCondition\n const conditionPromises = conditions.map((condition) => this.evaluateSingleCondition(condition, context));\n\n // Wait for all promises to resolve\n const results = await Promise.all(conditionPromises);\n\n // Check if every condition is true\n return results.every((result) => result);\n }\n\n private async evaluateSingleCondition(\n condition: AXPWorkflowCondition,\n context: AXPWorkflowContext\n ): Promise<boolean> {\n switch (condition.type) {\n case 'SINGLE':\n return (!condition.expression ? true : await this.evaluateExpression(condition.expression, context)) as boolean;\n case 'AND':\n // Evaluate all conditions with 'AND' logic\n const andConditions = condition.conditions ?? [];\n const andResults = await Promise.all(andConditions.map((cond) => this.evaluateSingleCondition(cond, context)));\n return andResults.every((result) => result);\n\n case 'OR':\n // Evaluate all conditions with 'OR' logic\n const orConditions = condition.conditions ?? [];\n const orResults = await Promise.all(orConditions.map((cond) => this.evaluateSingleCondition(cond, context)));\n return orResults.some((result) => result);\n\n default:\n throw new AXPWorkflowError(`Unsupported condition type: ${condition.type}`);\n }\n }\n\n private async evaluateExpression(templateExpression: string, context: AXPWorkflowContext): Promise<Boolean> {\n try {\n let expression = '';\n if (typeof templateExpression === 'string' && templateExpression.trim().includes('{{')) {\n const expressionMatch = templateExpression.match(/\\{\\{\\s*(.*?)\\s*\\}\\}/);\n if (!expressionMatch) {\n throw Error(`No valid expression found in \"${templateExpression}\"`);\n }\n expression = expressionMatch[1];\n }\n else {\n expression = templateExpression;\n }\n // Create a scope that includes context and registered functions\n const scope = { context, ...this.createFunctionScope() };\n // Evaluating the expression within the created scope\n const sandbox = new Function('scope', `return (async function() { with (scope) { return ${expression}; } })();`);\n const result = await sandbox(scope);\n return result;\n } catch (error) {\n console.error('Error evaluating expression:', error);\n return false;\n }\n }\n\n private async processInputs(obj: any, inputs: any, pathPrefix: string = '', context: any = {}): Promise<void> {\n if (!obj)\n return;\n\n for await (const i of Object.entries(obj)) {\n const key = i[0];\n const value = i[1];\n const currentPath = pathPrefix ? `${pathPrefix}.${key}` : key;\n if (typeof value === 'string' && value.trim().includes('{{')) {\n const expValue = await this.evaluateExpression(value, context);\n set(inputs, currentPath, expValue);\n }\n else if (typeof value === 'object' && value !== null && (value.constructor === Object || Array.isArray(value))) {\n // Recursively handle nested objects\n this.processInputs(value, inputs, currentPath, context);\n } else {\n // Apply static values directly\n set(inputs, currentPath, value);\n }\n }\n }\n\n private createFunctionScope(): any {\n const scope: any = {};\n this.registryService.getFunctionNames().forEach((name) => {\n scope[name] = this.getFunctionInstance(name).execute;\n });\n return scope;\n }\n\n private getFunctionInstance(functionName: string): AXPWorkflowFunction {\n const functionType = this.registryService.getFunction(functionName);\n if (!functionType) {\n throw new AXPWorkflowError(`Function type '${functionName}' not found in the registry.`);\n }\n return this.injector.get(functionType);\n }\n}\n","import { inject, Injectable } from \"@angular/core\";\nimport { AXPWorkflowAction, AXPWorkflowContext } from \"../workflow.types\";\nimport { AXPWorkflowService } from \"../workflow.service\";\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPStartWorkflowAction extends AXPWorkflowAction {\n\n private workflowService = inject(AXPWorkflowService)\n private workflow: string;\n private context: any;\n\n async execute(context: AXPWorkflowContext): Promise<void> {\n //console.log(\"start WK current context\", context);\n //console.log(\"start WK input context\", this.context);\n if (this.context)\n context.setVariables(this.context)\n //console.log(\"start WK merged context\", context);\n try {\n await this.workflowService.execute(this.workflow, context);\n }\n catch (e: unknown) {\n throw e;\n }\n\n }\n}","import { Inject, ModuleWithProviders, NgModule, Optional, Type } from \"@angular/core\";\nimport { AXPWorkflowRegistryService } from \"./workflow-registery.service\";\nimport { AXPWorkflow, AXPWorkflowAction, AXPWorkflowFunction } from \"./workflow.types\";\nimport { AXPStartWorkflowAction } from \"./actions/start-workflow.action\";\n\n\nexport interface AXPWorkflowModuleConfigs {\n functions?: {\n [name: string]: Type<AXPWorkflowFunction>\n },\n actions?: {\n [name: string]: Type<AXPWorkflowAction>\n },\n workflows?: {\n [name: string]: AXPWorkflow\n }\n}\n\n@NgModule({\n imports: [],\n exports: [],\n declarations: [],\n})\nexport class AXPWorkflowModule {\n\n static forRoot(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule> {\n return {\n ngModule: AXPWorkflowModule,\n providers: [\n {\n provide: 'AXPWorkflowModuleFactory',\n useFactory: (registry: AXPWorkflowRegistryService) => () => {\n registry.registerAction(\"start-workflow\", AXPStartWorkflowAction);\n //\n if (config?.functions) {\n for (const [key, type] of Object.entries(config.functions)) {\n registry.registerFunction(key, type);\n }\n }\n //\n if (config?.actions) {\n for (const [key, type] of Object.entries(config.actions)) {\n registry.registerAction(key, type);\n }\n }\n //\n if (config?.workflows) {\n for (const [key, type] of Object.entries(config.workflows)) {\n registry.registerWorkflow(key, type);\n }\n }\n },\n deps: [AXPWorkflowRegistryService],\n multi: true\n },\n ...Object.values(config?.actions ?? { AXPStartWorkflowAction }),\n ...Object.values(config?.functions ?? {}),\n ]\n };\n }\n\n static forChild(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule> {\n return {\n ngModule: AXPWorkflowModule,\n providers: [\n {\n provide: 'AXPWorkflowModuleFactory',\n useFactory: (registry: AXPWorkflowRegistryService) => () => {\n registry.registerAction(\"start-workflow\", AXPStartWorkflowAction);\n //\n if (config?.functions) {\n for (const [key, type] of Object.entries(config.functions)) {\n registry.registerFunction(key, type);\n }\n }\n //\n if (config?.actions) {\n for (const [key, type] of Object.entries(config.actions)) {\n registry.registerAction(key, type);\n }\n }\n //\n if (config?.workflows) {\n for (const [key, type] of Object.entries(config.workflows)) {\n registry.registerWorkflow(key, type);\n }\n }\n },\n deps: [AXPWorkflowRegistryService],\n multi: true\n },\n ...Object.values(config?.actions ?? {}),\n ...Object.values(config?.functions ?? {})\n ]\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Optional() @Inject('AXPWorkflowModuleFactory') instances: any[]) {\n instances?.forEach(f => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AXPWorkflowRegistryService"],"mappings":";;;;;AAAM,MAAO,gBAAiB,SAAQ,KAAK,CAAA;IACvC,WAAY,CAAA,OAAe,EAAS,KAAA,GAAsB,IAAI,EAAA;QAC1D,KAAK,CAAC,OAAO,CAAC;QADkB,IAAK,CAAA,KAAA,GAAL,KAAK;AAErC,QAAA,IAAI,CAAC,IAAI,GAAG,kBAAkB;;AAErC;;MCEY,uBAAuB,CAAA;AAHpC,IAAA,WAAA,GAAA;AAIU,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAoB;AASvD;AAPC,IAAA,QAAQ,CAAC,KAAuB,EAAA;AAC9B,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;;AAG/B,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;;8GAR9B,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QA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,CAAA;kBAL7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,YAAY,EAAE,EAAE;AACnB,iBAAA;;0BA8EgB;;0BAAY,MAAM;2BAAC,0BAA0B;;;ACpG9D;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-workflow.mjs","sources":["../../../../libs/platform/workflow/src/lib/errors.types.ts","../../../../libs/platform/workflow/src/lib/workflow-event-dispatcher.service.ts","../../../../libs/platform/workflow/src/lib/workflow-registery.service.ts","../../../../libs/platform/workflow/src/lib/workflow.types.ts","../../../../libs/platform/workflow/src/lib/workflow.service.ts","../../../../libs/platform/workflow/src/lib/actions/start-workflow.action.ts","../../../../libs/platform/workflow/src/lib/workflow.module.ts","../../../../libs/platform/workflow/src/acorex-platform-workflow.ts"],"sourcesContent":["export class AXPWorkflowError extends Error {\n constructor(message: string, public inner: Error | null = null) {\n super(message);\n this.name = 'AXPWorkflowError';\n }\n}","import { Injectable } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\nimport { AXPWorkflowEvent } from './workflow.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowEventService {\n private eventSubject = new Subject<AXPWorkflowEvent>();\n\n dispatch(event: AXPWorkflowEvent): void {\n this.eventSubject.next(event);\n }\n\n get events$(): Observable<AXPWorkflowEvent> {\n return this.eventSubject.asObservable();\n }\n}\n","import { Injectable, Type } from '@angular/core';\nimport { AXPWorkflow, AXPWorkflowAction, AXPWorkflowFunction } from './workflow.types';\n\n\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AXPWorkflowRegistryService {\n private functionsMap = new Map<string, Type<AXPWorkflowFunction>>();\n private actionsMap = new Map<string, Type<AXPWorkflowAction>>();\n private workflowsMap = new Map<string, AXPWorkflow>();\n\n registerWorkflow(name: string, workflow: AXPWorkflow): void {\n this.workflowsMap.set(name, workflow);\n }\n\n getWorkflow(name: string): AXPWorkflow | undefined {\n return this.workflowsMap.get(name);\n }\n\n registerAction(name: string, action: Type<AXPWorkflowAction>): void {\n this.actionsMap.set(name, action);\n }\n\n getAction(name: string): Type<AXPWorkflowAction> | undefined {\n return this.actionsMap.get(name);\n }\n\n registerFunction(name: string, func: Type<AXPWorkflowFunction>): void {\n this.functionsMap.set(name, func);\n }\n\n getFunction(name: string): Type<AXPWorkflowFunction> | undefined {\n return this.functionsMap.get(name);\n }\n\n getFunctionNames(): string[] {\n return Array.from(this.functionsMap.keys());\n }\n}","import { Injectable, inject } from '@angular/core';\nimport { filter } from 'rxjs';\nimport { AXPWorkflowEventService } from './workflow-event-dispatcher.service';\nimport { cloneDeep, get, set } from 'lodash-es';\n\nexport interface AXPWorkflow {\n steps: { [stepName: string]: AXPWorkflowStep };\n startStepId: string;\n}\n\n\nexport class AXPWorkflowContext {\n\n constructor(initialData: any = {}) {\n this.variables = cloneDeep(initialData);\n }\n\n private variables: any = {};\n private stepOutputs: Map<string, any> = new Map();\n\n setVariable(key: string, value: any): void {\n set(this.variables, key, value);\n }\n\n\n setVariables(context: any = {}) {\n this.variables = { ...this.variables, ...context };\n }\n\n getVariable<T = any>(key: string): T {\n return get(this.variables, key);\n }\n\n setOutput(key: string, output: any): void {\n this.stepOutputs.set(key, output);\n }\n\n setOutputs(values: Map<string, any>): void {\n this.stepOutputs = new Map([...this.stepOutputs, ...values])\n }\n\n getOutput<T = any>(key: string): T {\n return this.stepOutputs.get(key);\n }\n}\n\nexport type AXPWorkflowActionInput = any;\n\nexport type AXPWorkflowConditionType = 'AND' | 'OR' | 'SINGLE';\n\nexport interface AXPWorkflowCondition {\n type: AXPWorkflowConditionType;\n conditions?: AXPWorkflowCondition[]; // Nested conditions\n expression?: string; // Used if type is 'SINGLE'\n}\n\nexport interface AXPWorkflowNextStep {\n conditions: AXPWorkflowCondition[];\n nextStepId: string;\n}\n\nexport interface AXPWorkflowStep {\n id?: string;\n action: AXPWorkflowAction | string;\n input?: AXPWorkflowActionInput;\n nextSteps?: AXPWorkflowNextStep[];\n conditions?: AXPWorkflowCondition[];\n}\n@Injectable()\nexport abstract class AXPWorkflowAction {\n private eventService = inject(AXPWorkflowEventService);\n\n protected dispatch(event: AXPWorkflowEvent): void {\n this.eventService.dispatch(event);\n }\n\n abstract execute(context: AXPWorkflowContext): Promise<void>;\n}\n\n@Injectable()\nexport abstract class AXPWorkflowFunction {\n abstract execute(...args: any[]): Promise<any> | any;\n}\n\nexport interface AXPWorkflowEvent<T = any> {\n type: string;\n payload?: T;\n}\n\n\n\nexport function createWorkFlowEvent<T>(type: string) {\n const eventCreator = (payload: T) => ({ type, payload });\n eventCreator.type = type;\n return eventCreator;\n}\n\nexport function ofType<T extends { type: string }>(...allowedTypes: Array<{ type: string }>) {\n return filter((event: T) => allowedTypes.some((type) => event.type === type.type));\n}\n","import { Injectable, Injector, inject } from '@angular/core';\nimport { cloneDeep, set } from 'lodash-es';\nimport { Observable } from 'rxjs';\nimport { AXPWorkflowError } from './errors.types';\nimport { AXPWorkflowEventService } from './workflow-event-dispatcher.service';\nimport { AXPWorkflowRegistryService } from './workflow-registery.service';\nimport {\n AXPWorkflow,\n AXPWorkflowAction,\n AXPWorkflowCondition,\n AXPWorkflowContext,\n AXPWorkflowEvent,\n AXPWorkflowFunction,\n AXPWorkflowNextStep,\n AXPWorkflowStep,\n} from './workflow.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPWorkflowService {\n private eventService = inject(AXPWorkflowEventService);\n\n get events$(): Observable<AXPWorkflowEvent> {\n return this.eventService.events$;\n }\n\n constructor(private registryService: AXPWorkflowRegistryService, private injector: Injector) {}\n\n async execute(\n workflow: AXPWorkflow | string,\n initialContext: AXPWorkflowContext | any | null = null\n ): Promise<AXPWorkflowContext> {\n // Instantiate or retrieve the workflow\n const wk = typeof workflow === 'string' ? this.getWorkflowInstance(workflow) : workflow;\n\n let currentStepId = wk.startStepId;\n const context =\n initialContext instanceof AXPWorkflowContext ? initialContext : new AXPWorkflowContext(initialContext ?? {});\n // Initialize context with initial variables\n\n while (currentStepId) {\n const currentStep = wk.steps[currentStepId];\n if (!currentStep) {\n throw new AXPWorkflowError(`Step '${currentStepId}' not found in the workflow steps.`);\n }\n\n // Instantiate or retrieve the action\n const action =\n typeof currentStep.action === 'string' ? this.getActionInstance(currentStep.action) : currentStep.action;\n if (currentStep.input) {\n let inputs: any = {};\n await this.processInputs(cloneDeep(currentStep.input), inputs, '', context);\n await new Promise((resolve) =>\n setTimeout(async () => {\n Object.assign(action, inputs);\n resolve(0);\n })\n );\n }\n try {\n await new Promise((resolve) =>\n setTimeout(async () => {\n await action.execute(context);\n resolve(0);\n }, 0)\n );\n } catch (error) {\n console.error(error);\n throw new AXPWorkflowError('Workflow Error', error as Error);\n }\n // Determine the next step based on the conditions\n const nextStepInfo = await this.determineNextStep(currentStep, context);\n if (nextStepInfo) {\n currentStepId = nextStepInfo.nextStepId;\n } else {\n break; // Exit the loop if no next step is determined\n }\n }\n return context;\n }\n\n //TODO : replace with AXDataGenerator\n private uuid(): string {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char) => {\n const random = (Math.random() * 16) | 0;\n const value = char === 'x' ? random : (random & 0x3) | 0x8;\n return value.toString(16);\n });\n }\n\n private getActionInstance(actionName: string): AXPWorkflowAction {\n const actionType = this.registryService.getAction(actionName);\n if (!actionType) {\n throw new AXPWorkflowError(`Action type '${actionName}' not found in the registry.`);\n }\n return this.injector.get(actionType);\n }\n\n private getWorkflowInstance(workflowName: string): AXPWorkflow {\n const workflowType = this.registryService.getWorkflow(workflowName);\n if (!workflowType) {\n throw new AXPWorkflowError(`Workflow type '${workflowName}' not found in the registry.`);\n }\n return workflowType;\n }\n\n private async determineNextStep(\n currentStep: AXPWorkflowStep,\n context: AXPWorkflowContext\n ): Promise<AXPWorkflowNextStep | null> {\n if (!currentStep.nextSteps) {\n return null;\n }\n for (const nextStep of currentStep.nextSteps) {\n if (await this.evaluateCondition(nextStep.conditions, context)) {\n return nextStep;\n }\n }\n return null;\n }\n\n private async evaluateCondition(conditions: AXPWorkflowCondition[], context: AXPWorkflowContext): Promise<boolean> {\n if (!conditions || conditions.length === 0) {\n return true; // If no conditions, the step proceeds\n }\n\n // Map each condition to a promise using evaluateSingleCondition\n const conditionPromises = conditions.map((condition) => this.evaluateSingleCondition(condition, context));\n\n // Wait for all promises to resolve\n const results = await Promise.all(conditionPromises);\n\n // Check if every condition is true\n return results.every((result) => result);\n }\n\n private async evaluateSingleCondition(\n condition: AXPWorkflowCondition,\n context: AXPWorkflowContext\n ): Promise<boolean> {\n switch (condition.type) {\n case 'SINGLE':\n return (!condition.expression ? true : await this.evaluateExpression(condition.expression, context)) as boolean;\n case 'AND':\n // Evaluate all conditions with 'AND' logic\n const andConditions = condition.conditions ?? [];\n const andResults = await Promise.all(andConditions.map((cond) => this.evaluateSingleCondition(cond, context)));\n return andResults.every((result) => result);\n\n case 'OR':\n // Evaluate all conditions with 'OR' logic\n const orConditions = condition.conditions ?? [];\n const orResults = await Promise.all(orConditions.map((cond) => this.evaluateSingleCondition(cond, context)));\n return orResults.some((result) => result);\n\n default:\n throw new AXPWorkflowError(`Unsupported condition type: ${condition.type}`);\n }\n }\n\n private async evaluateExpression(templateExpression: string, context: AXPWorkflowContext): Promise<Boolean> {\n try {\n let expression = '';\n if (typeof templateExpression === 'string' && templateExpression.trim().includes('{{')) {\n const expressionMatch = templateExpression.match(/\\{\\{\\s*(.*?)\\s*\\}\\}/);\n if (!expressionMatch) {\n throw Error(`No valid expression found in \"${templateExpression}\"`);\n }\n expression = expressionMatch[1];\n } else {\n expression = templateExpression;\n }\n // Create a scope that includes context and registered functions\n const scope = { context, ...this.createFunctionScope() };\n // Evaluating the expression within the created scope\n const sandbox = new Function('scope', `return (async function() { with (scope) { return ${expression}; } })();`);\n const result = await sandbox(scope);\n return result;\n } catch (error) {\n console.error('Error evaluating expression:', error);\n return false;\n }\n }\n\n private async processInputs(obj: any, inputs: any, pathPrefix: string = '', context: any = {}): Promise<void> {\n if (!obj) {\n return;\n }\n\n for await (const i of Object.entries(obj)) {\n const key = i[0];\n const value = i[1];\n const currentPath = pathPrefix ? `${pathPrefix}.${key}` : key;\n if (typeof value === 'string' && value.trim().includes('{{')) {\n const expValue = await this.evaluateExpression(value, context);\n set(inputs, currentPath, expValue);\n } else if (\n typeof value === 'object' &&\n value !== null &&\n (value.constructor === Object || Array.isArray(value))\n ) {\n // Recursively handle nested objects\n this.processInputs(value, inputs, currentPath, context);\n } else {\n // Apply static values directly\n set(inputs, currentPath, value);\n }\n }\n }\n\n private createFunctionScope(): any {\n const scope: any = {};\n this.registryService.getFunctionNames().forEach((name) => {\n scope[name] = this.getFunctionInstance(name).execute;\n });\n return scope;\n }\n\n private getFunctionInstance(functionName: string): AXPWorkflowFunction {\n const functionType = this.registryService.getFunction(functionName);\n if (!functionType) {\n throw new AXPWorkflowError(`Function type '${functionName}' not found in the registry.`);\n }\n return this.injector.get(functionType);\n }\n}\n","import { inject, Injectable } from \"@angular/core\";\nimport { AXPWorkflowAction, AXPWorkflowContext } from \"../workflow.types\";\nimport { AXPWorkflowService } from \"../workflow.service\";\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPStartWorkflowAction extends AXPWorkflowAction {\n\n private workflowService = inject(AXPWorkflowService)\n private workflow: string;\n private context: any;\n\n async execute(context: AXPWorkflowContext): Promise<void> {\n //console.log(\"start WK current context\", context);\n //console.log(\"start WK input context\", this.context);\n if (this.context)\n context.setVariables(this.context)\n //console.log(\"start WK merged context\", context);\n try {\n await this.workflowService.execute(this.workflow, context);\n }\n catch (e: unknown) {\n throw e;\n }\n\n }\n}","import { Inject, ModuleWithProviders, NgModule, Optional, Type } from \"@angular/core\";\nimport { AXPWorkflowRegistryService } from \"./workflow-registery.service\";\nimport { AXPWorkflow, AXPWorkflowAction, AXPWorkflowFunction } from \"./workflow.types\";\nimport { AXPStartWorkflowAction } from \"./actions/start-workflow.action\";\n\n\nexport interface AXPWorkflowModuleConfigs {\n functions?: {\n [name: string]: Type<AXPWorkflowFunction>\n },\n actions?: {\n [name: string]: Type<AXPWorkflowAction>\n },\n workflows?: {\n [name: string]: AXPWorkflow\n }\n}\n\n@NgModule({\n imports: [],\n exports: [],\n declarations: [],\n})\nexport class AXPWorkflowModule {\n\n static forRoot(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule> {\n return {\n ngModule: AXPWorkflowModule,\n providers: [\n {\n provide: 'AXPWorkflowModuleFactory',\n useFactory: (registry: AXPWorkflowRegistryService) => () => {\n registry.registerAction(\"start-workflow\", AXPStartWorkflowAction);\n //\n if (config?.functions) {\n for (const [key, type] of Object.entries(config.functions)) {\n registry.registerFunction(key, type);\n }\n }\n //\n if (config?.actions) {\n for (const [key, type] of Object.entries(config.actions)) {\n registry.registerAction(key, type);\n }\n }\n //\n if (config?.workflows) {\n for (const [key, type] of Object.entries(config.workflows)) {\n registry.registerWorkflow(key, type);\n }\n }\n },\n deps: [AXPWorkflowRegistryService],\n multi: true\n },\n ...Object.values(config?.actions ?? { AXPStartWorkflowAction }),\n ...Object.values(config?.functions ?? {}),\n ]\n };\n }\n\n static forChild(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule> {\n return {\n ngModule: AXPWorkflowModule,\n providers: [\n {\n provide: 'AXPWorkflowModuleFactory',\n useFactory: (registry: AXPWorkflowRegistryService) => () => {\n registry.registerAction(\"start-workflow\", AXPStartWorkflowAction);\n //\n if (config?.functions) {\n for (const [key, type] of Object.entries(config.functions)) {\n registry.registerFunction(key, type);\n }\n }\n //\n if (config?.actions) {\n for (const [key, type] of Object.entries(config.actions)) {\n registry.registerAction(key, type);\n }\n }\n //\n if (config?.workflows) {\n for (const [key, type] of Object.entries(config.workflows)) {\n registry.registerWorkflow(key, type);\n }\n }\n },\n deps: [AXPWorkflowRegistryService],\n multi: true\n },\n ...Object.values(config?.actions ?? {}),\n ...Object.values(config?.functions ?? {})\n ]\n };\n }\n\n /**\n * @ignore\n */\n constructor(@Optional() @Inject('AXPWorkflowModuleFactory') instances: any[]) {\n instances?.forEach(f => {\n f();\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AXPWorkflowRegistryService"],"mappings":";;;;;AAAM,MAAO,gBAAiB,SAAQ,KAAK,CAAA;IACvC,WAAY,CAAA,OAAe,EAAS,KAAA,GAAsB,IAAI,EAAA;QAC1D,KAAK,CAAC,OAAO,CAAC;QADkB,IAAK,CAAA,KAAA,GAAL,KAAK;AAErC,QAAA,IAAI,CAAC,IAAI,GAAG,kBAAkB;;AAErC;;MCEY,uBAAuB,CAAA;AAHpC,IAAA,WAAA,GAAA;AAIU,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAoB;AASvD;AAPC,IAAA,QAAQ,CAAC,KAAuB,EAAA;AAC9B,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;;AAG/B,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;;8GAR9B,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cAFtB,MAAM,EAAA,CAAA,CAAA;;2FAEP,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAHnC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;MCGY,0BAA0B,CAAA;AAHvC,IAAA,WAAA,GAAA;AAIY,QAAA,IAAA,CAAA,YAAY,GAAG,IA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0BAAY,MAAM;2BAAC,0BAA0B;;;ACpG9D;;AAEG;;;;"}
|
|
@@ -2,12 +2,11 @@ import { ModuleWithProviders } from "@angular/core";
|
|
|
2
2
|
import { AXPWidgetConfig } from "./widget.types";
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
import * as i1 from "./widget-container.component";
|
|
5
|
-
import * as i2 from "./widget-renderer
|
|
6
|
-
import * as i3 from "./widget-
|
|
7
|
-
import * as i4 from "
|
|
8
|
-
import * as i5 from "@angular/
|
|
9
|
-
import * as i6 from "@
|
|
10
|
-
import * as i7 from "@acorex/components/skeleton";
|
|
5
|
+
import * as i2 from "./widget-column-renderer";
|
|
6
|
+
import * as i3 from "./widget-renderer.directive";
|
|
7
|
+
import * as i4 from "@angular/common";
|
|
8
|
+
import * as i5 from "@angular/cdk/portal";
|
|
9
|
+
import * as i6 from "@acorex/components/skeleton";
|
|
11
10
|
export interface AXPLayoutBuilderModuleConfigs {
|
|
12
11
|
widgets: AXPWidgetConfig[];
|
|
13
12
|
}
|
|
@@ -19,6 +18,6 @@ export declare class AXPLayoutBuilderModule {
|
|
|
19
18
|
*/
|
|
20
19
|
constructor(instances: any[]);
|
|
21
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<AXPLayoutBuilderModule, [{ optional: true; }]>;
|
|
22
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<AXPLayoutBuilderModule, [typeof i1.AXPWidgetContainerComponent, typeof i2.
|
|
21
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AXPLayoutBuilderModule, [typeof i1.AXPWidgetContainerComponent, typeof i2.AXPWidgetColumnRendererComponent, typeof i3.AXPWidgetRendererDirective], [typeof i4.CommonModule, typeof i5.PortalModule, typeof i6.AXSkeletonModule, typeof i4.CommonModule], [typeof i1.AXPWidgetContainerComponent, typeof i2.AXPWidgetColumnRendererComponent, typeof i3.AXPWidgetRendererDirective]>;
|
|
23
22
|
static ɵinj: i0.ɵɵInjectorDeclaration<AXPLayoutBuilderModule>;
|
|
24
23
|
}
|
|
@@ -1,38 +1,37 @@
|
|
|
1
|
+
import { Signal } from '@angular/core';
|
|
1
2
|
import { Subject } from 'rxjs';
|
|
2
|
-
import {
|
|
3
|
+
import { AXPPageStatus, AXPWidgetStatus } from './widget-status.types';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export type AXPLayoutElementAPI = {
|
|
5
6
|
[name: string]: Subject<any> | Function;
|
|
6
7
|
};
|
|
7
8
|
export declare abstract class AXPLayoutElement {
|
|
8
9
|
abstract get id(): string | null;
|
|
10
|
+
abstract get status(): Signal<AXPWidgetStatus>;
|
|
9
11
|
api(): AXPLayoutElementAPI;
|
|
10
12
|
}
|
|
11
13
|
export declare class AXPLayoutBuilderService {
|
|
12
|
-
private readonly context$;
|
|
13
14
|
private readonly variables$;
|
|
14
15
|
private readonly functions$;
|
|
15
|
-
readonly onChanged: Subject<AXPLayoutContextEvent>;
|
|
16
16
|
readonly onRefresh: Subject<void>;
|
|
17
|
-
private debouncers;
|
|
18
|
-
private debouncerSubscriptions;
|
|
19
17
|
private widgets;
|
|
20
|
-
|
|
18
|
+
private readonly status$;
|
|
19
|
+
readonly status: Signal<AXPPageStatus>;
|
|
20
|
+
readonly isBusy: Signal<boolean>;
|
|
21
21
|
get variables(): any;
|
|
22
22
|
get functions(): {
|
|
23
23
|
[key: string]: Function;
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
updateStatus(): void;
|
|
26
|
+
private detectStatus;
|
|
26
27
|
refresh(): void;
|
|
28
|
+
setStatus(status: AXPPageStatus.Submitting | AXPPageStatus.Submitted | AXPPageStatus.Processing | AXPPageStatus.Error): void;
|
|
27
29
|
setVariables(keysValues: any): void;
|
|
28
30
|
setVariables(key: string, value: any): void;
|
|
29
31
|
setFunctions(keysValues: any): void;
|
|
30
32
|
setFunctions(key: string, value: any): void;
|
|
31
|
-
setValue(path: string, value: any, init?: boolean): void;
|
|
32
|
-
getValue(path: string): any;
|
|
33
33
|
registerWidget(id: string, widget: AXPLayoutElement): void;
|
|
34
34
|
getWidget(id: string): AXPLayoutElement | undefined;
|
|
35
|
-
private unsubscribeDebouncers;
|
|
36
35
|
ngOnDestroy(): void;
|
|
37
36
|
static ɵfac: i0.ɵɵFactoryDeclaration<AXPLayoutBuilderService, never>;
|
|
38
37
|
static ɵprov: i0.ɵɵInjectableDeclaration<AXPLayoutBuilderService>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type AXPLayoutContextState = 'initiated' | 'restored' | 'changed';
|
|
2
|
+
export declare class AXPLayoutContextChangeEvent {
|
|
3
|
+
oldValue?: any;
|
|
4
|
+
newValue?: any;
|
|
5
|
+
path?: string;
|
|
6
|
+
state: AXPLayoutContextState;
|
|
7
|
+
data: any;
|
|
8
|
+
}
|
|
9
|
+
export declare const AXPLayoutBuilderContextStore: import("@angular/core").Type<{
|
|
10
|
+
data: import("@ngrx/signals").DeepSignal<{}>;
|
|
11
|
+
state: import("@angular/core").Signal<AXPLayoutContextState>;
|
|
12
|
+
initialSnapshot: import("@ngrx/signals").DeepSignal<{}>;
|
|
13
|
+
previousSnapshot: import("@ngrx/signals").DeepSignal<{}>;
|
|
14
|
+
lastChange: import("@ngrx/signals").DeepSignal<AXPLayoutContextChangeEvent>;
|
|
15
|
+
isChanged: import("@angular/core").Signal<boolean>;
|
|
16
|
+
isReset: import("@angular/core").Signal<boolean>;
|
|
17
|
+
isInitiated: import("@angular/core").Signal<boolean>;
|
|
18
|
+
isEmpty: import("@angular/core").Signal<boolean>;
|
|
19
|
+
snapshot: import("@angular/core").Signal<{}>;
|
|
20
|
+
initial: import("@angular/core").Signal<{}>;
|
|
21
|
+
previous: import("@angular/core").Signal<{}>;
|
|
22
|
+
changeEvent: import("@angular/core").Signal<AXPLayoutContextChangeEvent>;
|
|
23
|
+
update: (path: string, value: any) => void;
|
|
24
|
+
reset: () => void;
|
|
25
|
+
set: (initialData: any) => void;
|
|
26
|
+
getValue: (path: string) => any;
|
|
27
|
+
} & import("@ngrx/signals").StateSource<{
|
|
28
|
+
data: {};
|
|
29
|
+
state: AXPLayoutContextState;
|
|
30
|
+
initialSnapshot: {};
|
|
31
|
+
previousSnapshot: {};
|
|
32
|
+
lastChange: AXPLayoutContextChangeEvent;
|
|
33
|
+
}>>;
|
|
@@ -6,6 +6,8 @@ export * from './widget-column-renderer';
|
|
|
6
6
|
export * from './widget-container.component';
|
|
7
7
|
export * from './widget-groups';
|
|
8
8
|
export * from './widget-registery.service';
|
|
9
|
-
export * from './widget-renderer.
|
|
10
|
-
export * from './
|
|
9
|
+
export * from './widget-renderer.directive';
|
|
10
|
+
export * from './context-store.service';
|
|
11
|
+
export * from './widget-status.types';
|
|
11
12
|
export * from './widget.types';
|
|
13
|
+
export * from './widget-map';
|
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { AXPLayoutBuilderService } from './builder.service';
|
|
3
|
+
import { AXPLayoutContextChangeEvent } from './context-store.service';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class AXPWidgetContainerComponent {
|
|
5
|
-
readonly
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
readonly contextService: {
|
|
7
|
+
data: import("@ngrx/signals").DeepSignal<{}>;
|
|
8
|
+
state: import("@angular/core").Signal<import("./context-store.service").AXPLayoutContextState>;
|
|
9
|
+
initialSnapshot: import("@ngrx/signals").DeepSignal<{}>;
|
|
10
|
+
previousSnapshot: import("@ngrx/signals").DeepSignal<{}>;
|
|
11
|
+
lastChange: import("@ngrx/signals").DeepSignal<AXPLayoutContextChangeEvent>;
|
|
12
|
+
isChanged: import("@angular/core").Signal<boolean>;
|
|
13
|
+
isReset: import("@angular/core").Signal<boolean>;
|
|
14
|
+
isInitiated: import("@angular/core").Signal<boolean>;
|
|
15
|
+
isEmpty: import("@angular/core").Signal<boolean>;
|
|
16
|
+
snapshot: import("@angular/core").Signal<{}>;
|
|
17
|
+
initial: import("@angular/core").Signal<{}>;
|
|
18
|
+
previous: import("@angular/core").Signal<{}>;
|
|
19
|
+
changeEvent: import("@angular/core").Signal<AXPLayoutContextChangeEvent>;
|
|
20
|
+
update: (path: string, value: any) => void;
|
|
21
|
+
reset: () => void;
|
|
22
|
+
set: (initialData: any) => void;
|
|
23
|
+
getValue: (path: string) => any;
|
|
24
|
+
} & import("@ngrx/signals").StateSource<{
|
|
25
|
+
data: {};
|
|
26
|
+
state: import("./context-store.service").AXPLayoutContextState;
|
|
27
|
+
initialSnapshot: {};
|
|
28
|
+
previousSnapshot: {};
|
|
29
|
+
lastChange: AXPLayoutContextChangeEvent;
|
|
30
|
+
}>;
|
|
31
|
+
readonly builderService: AXPLayoutBuilderService;
|
|
32
|
+
readonly onContextChanged: EventEmitter<AXPLayoutContextChangeEvent>;
|
|
33
|
+
set context(value: any);
|
|
8
34
|
set functions(v: any);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ngOnInit(): void;
|
|
35
|
+
constructor();
|
|
36
|
+
status: import("@angular/core").Signal<import("@acorex/platform/layout/builder").AXPPageStatus>;
|
|
37
|
+
isBusy: import("@angular/core").Signal<boolean>;
|
|
13
38
|
static ɵfac: i0.ɵɵFactoryDeclaration<AXPWidgetContainerComponent, never>;
|
|
14
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AXPWidgetContainerComponent, "axp-widgets-container", never, { "context": { "alias": "context"; "required": false;
|
|
39
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AXPWidgetContainerComponent, "axp-widgets-container", never, { "context": { "alias": "context"; "required": false; }; "functions": { "alias": "functions"; "required": false; }; }, { "onContextChanged": "onContextChanged"; }, never, ["*"], false, never>;
|
|
15
40
|
}
|
|
@@ -3,4 +3,5 @@ export declare const AXP_WIDGETS_EDITOR_GROUP: AXPWidgetGroup;
|
|
|
3
3
|
export declare const AXP_WIDGETS_ACTION_GROUP: AXPWidgetGroup;
|
|
4
4
|
export declare const AXP_WIDGETS_LAYOUT_GROUP: AXPWidgetGroup;
|
|
5
5
|
export declare const AXP_WIDGETS_ADVANCE_GROUP: AXPWidgetGroup;
|
|
6
|
+
export declare const AXP_WIDGETS_FILTER_GROUP: AXPWidgetGroup;
|
|
6
7
|
export declare const AXP_WIDGETS_GROUPS: AXPWidgetGroup[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface AXPWidgetTypesMap {
|
|
2
|
+
checkbox: 'checkbox-editor';
|
|
3
|
+
color: 'color-editor';
|
|
4
|
+
contact: 'contact-editor';
|
|
5
|
+
dateTime: 'date-time-editor';
|
|
6
|
+
email: 'email-editor';
|
|
7
|
+
largeText: 'large-text-editor';
|
|
8
|
+
link: 'link-editor';
|
|
9
|
+
number: 'number-editor';
|
|
10
|
+
password: 'password-editor';
|
|
11
|
+
phone: 'phone-editor';
|
|
12
|
+
richText: 'rich-text-editor';
|
|
13
|
+
select: 'select-editor';
|
|
14
|
+
selectionList: 'selection-list-editor';
|
|
15
|
+
text: 'text-editor';
|
|
16
|
+
toggle: 'toggle-editor';
|
|
17
|
+
blockLayout: 'block-layout';
|
|
18
|
+
pageLayout: 'page-layout';
|
|
19
|
+
repeaterLayout: 'repeater-layout';
|
|
20
|
+
textBlockLayout: 'text-block-layout';
|
|
21
|
+
file: 'file';
|
|
22
|
+
map: 'map';
|
|
23
|
+
gallery: 'gallery';
|
|
24
|
+
signature: 'signature';
|
|
25
|
+
buttonAction: 'button-action';
|
|
26
|
+
document: 'document-layout';
|
|
27
|
+
lookup: 'lookup-editor';
|
|
28
|
+
formField: 'form-field';
|
|
29
|
+
grid: 'grid-layout';
|
|
30
|
+
gridRow: 'grid-row-layout';
|
|
31
|
+
gridItem: 'grid-item-layout';
|
|
32
|
+
qrcode: 'qrcode';
|
|
33
|
+
widgetSelector: 'widget-selector';
|
|
34
|
+
template: 'template';
|
|
35
|
+
templateDesigner: 'template-designer';
|
|
36
|
+
cronJob: 'cron-job';
|
|
37
|
+
spacing: 'spacing';
|
|
38
|
+
border: 'border';
|
|
39
|
+
avatar: 'avatar';
|
|
40
|
+
stringFilter: 'string-filter';
|
|
41
|
+
themeColorSelection: 'theme-color-selection';
|
|
42
|
+
flexOptions: 'flex-options';
|
|
43
|
+
}
|
|
@@ -16,6 +16,31 @@ export declare class AXPWidgetRendererDirective {
|
|
|
16
16
|
protected mergedOptions: WritableSignal<any>;
|
|
17
17
|
private injector;
|
|
18
18
|
protected builderService: AXPLayoutBuilderService;
|
|
19
|
+
protected contextService: {
|
|
20
|
+
data: import("@ngrx/signals").DeepSignal<{}>;
|
|
21
|
+
state: import("@angular/core").Signal<import("./context-store.service").AXPLayoutContextState>;
|
|
22
|
+
initialSnapshot: import("@ngrx/signals").DeepSignal<{}>;
|
|
23
|
+
previousSnapshot: import("@ngrx/signals").DeepSignal<{}>;
|
|
24
|
+
lastChange: import("@ngrx/signals").DeepSignal<import("./context-store.service").AXPLayoutContextChangeEvent>;
|
|
25
|
+
isChanged: import("@angular/core").Signal<boolean>;
|
|
26
|
+
isReset: import("@angular/core").Signal<boolean>;
|
|
27
|
+
isInitiated: import("@angular/core").Signal<boolean>;
|
|
28
|
+
isEmpty: import("@angular/core").Signal<boolean>;
|
|
29
|
+
snapshot: import("@angular/core").Signal<{}>;
|
|
30
|
+
initial: import("@angular/core").Signal<{}>;
|
|
31
|
+
previous: import("@angular/core").Signal<{}>;
|
|
32
|
+
changeEvent: import("@angular/core").Signal<import("./context-store.service").AXPLayoutContextChangeEvent>;
|
|
33
|
+
update: (path: string, value: any) => void;
|
|
34
|
+
reset: () => void;
|
|
35
|
+
set: (initialData: any) => void;
|
|
36
|
+
getValue: (path: string) => any;
|
|
37
|
+
} & import("@ngrx/signals").StateSource<{
|
|
38
|
+
data: {};
|
|
39
|
+
state: import("./context-store.service").AXPLayoutContextState;
|
|
40
|
+
initialSnapshot: {};
|
|
41
|
+
previousSnapshot: {};
|
|
42
|
+
lastChange: import("./context-store.service").AXPLayoutContextChangeEvent;
|
|
43
|
+
}>;
|
|
19
44
|
protected widgetRegistery: AXPWidgetRegistryService;
|
|
20
45
|
protected unsubscriber: AXUnsubscriber;
|
|
21
46
|
private viewContainerRef;
|
|
@@ -25,6 +50,7 @@ export declare class AXPWidgetRendererDirective {
|
|
|
25
50
|
private expressionEvaluators;
|
|
26
51
|
private scope;
|
|
27
52
|
private componentRef;
|
|
53
|
+
private onContextChanged;
|
|
28
54
|
constructor();
|
|
29
55
|
ngOnChanges(changes: SimpleChanges): void;
|
|
30
56
|
private rerenderComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum AXPPageStatus {
|
|
2
|
+
Rendering = "rendering",// The widget is being rendered.
|
|
3
|
+
Rendered = "rendered",// The rendering process is complete.
|
|
4
|
+
Processing = "processing",// The widget is performing a task or interaction.
|
|
5
|
+
Submitting = "submitting",// The form is being submitted.
|
|
6
|
+
Submitted = "submitted",// Submission is completed.
|
|
7
|
+
Error = "error"
|
|
8
|
+
}
|
|
9
|
+
export declare enum AXPWidgetStatus {
|
|
10
|
+
Rendering = "rendering",// The widget is being rendered.
|
|
11
|
+
Rendered = "rendered",// The rendering process is complete.
|
|
12
|
+
Processing = "processing",// The widget is performing a task or interaction.
|
|
13
|
+
Error = "error"
|
|
14
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AXDataSource, AXValueChangedEvent } from '@acorex/components/common';
|
|
2
2
|
import { AXPMetaData, AXPOptionsData, AXPPartialNested, AXPValidationRules } from '@acorex/platform/core';
|
|
3
3
|
import { InjectionToken, OnInit } from '@angular/core';
|
|
4
|
-
import {
|
|
5
|
-
import { AXPLayoutElement } from './builder.service';
|
|
4
|
+
import { BehaviorSubject } from 'rxjs';
|
|
5
|
+
import { AXPLayoutBuilderService, AXPLayoutElement } from './builder.service';
|
|
6
|
+
import { AXPPageStatus, AXPWidgetStatus } from './widget-status.types';
|
|
7
|
+
import { AXPWidgetTypesMap } from './widget-map';
|
|
6
8
|
import * as i0 from "@angular/core";
|
|
7
9
|
export type AXPWidgetTrigger = {
|
|
8
10
|
event: string;
|
|
@@ -84,45 +86,6 @@ export interface AXPWidgetNode {
|
|
|
84
86
|
meta?: AXPMetaData;
|
|
85
87
|
valueTransforms?: AXPWidgetValueTransformFunctions;
|
|
86
88
|
}
|
|
87
|
-
export interface AXPWidgetTypesMap {
|
|
88
|
-
checkbox: 'checkbox-editor';
|
|
89
|
-
color: 'color-editor';
|
|
90
|
-
contact: 'contact-editor';
|
|
91
|
-
dateTime: 'date-time-editor';
|
|
92
|
-
email: 'email-editor';
|
|
93
|
-
largeText: 'large-text-editor';
|
|
94
|
-
link: 'link-editor';
|
|
95
|
-
number: 'number-editor';
|
|
96
|
-
password: 'password-editor';
|
|
97
|
-
phone: 'phone-editor';
|
|
98
|
-
richText: 'rich-text-editor';
|
|
99
|
-
select: 'select-editor';
|
|
100
|
-
selectionList: 'selection-list-editor';
|
|
101
|
-
text: 'text-editor';
|
|
102
|
-
toggle: 'toggle-editor';
|
|
103
|
-
blockLayout: 'block-layout';
|
|
104
|
-
pageLayout: 'page-layout';
|
|
105
|
-
repeaterLayout: 'repeater-layout';
|
|
106
|
-
textBlockLayout: 'text-block-layout';
|
|
107
|
-
file: 'file';
|
|
108
|
-
map: 'map';
|
|
109
|
-
gallery: 'gallery';
|
|
110
|
-
signature: 'signature';
|
|
111
|
-
buttonAction: 'button-action';
|
|
112
|
-
document: 'document-layout';
|
|
113
|
-
lookup: 'lookup-editor';
|
|
114
|
-
formField: 'form-field';
|
|
115
|
-
grid: 'grid-layout';
|
|
116
|
-
gridRow: 'grid-row-layout';
|
|
117
|
-
gridItem: 'grid-item-layout';
|
|
118
|
-
qrcode: 'qrcode';
|
|
119
|
-
widgetSelector: 'widget-selector';
|
|
120
|
-
template: 'template';
|
|
121
|
-
templateDesigner: 'template-designer';
|
|
122
|
-
cronJob: 'cron-job';
|
|
123
|
-
spacing: 'spacing';
|
|
124
|
-
border: 'border';
|
|
125
|
-
}
|
|
126
89
|
export interface AXPWidgetNodeToken {
|
|
127
90
|
config: AXPWidgetConfig;
|
|
128
91
|
node: AXPWidgetNode;
|
|
@@ -150,7 +113,7 @@ export interface AXPWidgetConfigComponents {
|
|
|
150
113
|
column?: AXPWidgetComponentConfig;
|
|
151
114
|
filter?: AXPWidgetComponentConfig;
|
|
152
115
|
}
|
|
153
|
-
export type AXPWidgetViewType = 'container' | 'editor' | 'action' | 'view';
|
|
116
|
+
export type AXPWidgetViewType = 'container' | 'editor' | 'action' | 'view' | 'filter';
|
|
154
117
|
export type AXPWidgetOptionsMap = {
|
|
155
118
|
container: {
|
|
156
119
|
canInsert: boolean;
|
|
@@ -177,18 +140,16 @@ export interface AXPWidgetConfig<T = any> {
|
|
|
177
140
|
components: AXPWidgetConfigComponents;
|
|
178
141
|
meta?: AXPMetaData;
|
|
179
142
|
type: AXPExtractWidgetConfig<T>['type'];
|
|
143
|
+
defaultFilterWidgetName?: 'string-filter' | 'number-filter' | 'datetime-filter' | 'select-filter' | 'lookup-filter';
|
|
180
144
|
options?: AXPExtractWidgetConfig<T>['options'];
|
|
181
145
|
visible?: boolean;
|
|
182
146
|
}
|
|
183
147
|
export type AXPWidgetRenderMode = keyof AXPWidgetConfigComponents;
|
|
184
|
-
export interface
|
|
185
|
-
|
|
186
|
-
newValue: any;
|
|
187
|
-
path?: string | null;
|
|
188
|
-
data: any;
|
|
189
|
-
init: boolean;
|
|
148
|
+
export interface AXPLayoutBuilderStatusChangedEvent {
|
|
149
|
+
status: AXPPageStatus;
|
|
190
150
|
}
|
|
191
151
|
export declare abstract class AXPWidgetComponent<T = any | null | void> extends AXPLayoutElement implements OnInit {
|
|
152
|
+
#private;
|
|
192
153
|
protected readonly token: AXPWidgetNodeToken;
|
|
193
154
|
readonly host: HTMLDivElement;
|
|
194
155
|
readonly config: AXPWidgetConfig<any>;
|
|
@@ -200,13 +161,40 @@ export declare abstract class AXPWidgetComponent<T = any | null | void> extends
|
|
|
200
161
|
protected children: import("@angular/core").Signal<AXPWidgetNode[]>;
|
|
201
162
|
protected _options: import("@angular/core").WritableSignal<any>;
|
|
202
163
|
protected options: import("@angular/core").Signal<any>;
|
|
203
|
-
|
|
204
|
-
readonly
|
|
205
|
-
|
|
164
|
+
protected readonly layoutService: AXPLayoutBuilderService;
|
|
165
|
+
protected readonly contextService: {
|
|
166
|
+
data: import("@ngrx/signals").DeepSignal<{}>;
|
|
167
|
+
state: import("@angular/core").Signal<import("./context-store.service").AXPLayoutContextState>;
|
|
168
|
+
initialSnapshot: import("@ngrx/signals").DeepSignal<{}>;
|
|
169
|
+
previousSnapshot: import("@ngrx/signals").DeepSignal<{}>;
|
|
170
|
+
lastChange: import("@ngrx/signals").DeepSignal<import("./context-store.service").AXPLayoutContextChangeEvent>;
|
|
171
|
+
isChanged: import("@angular/core").Signal<boolean>;
|
|
172
|
+
isReset: import("@angular/core").Signal<boolean>;
|
|
173
|
+
isInitiated: import("@angular/core").Signal<boolean>;
|
|
174
|
+
isEmpty: import("@angular/core").Signal<boolean>;
|
|
175
|
+
snapshot: import("@angular/core").Signal<{}>;
|
|
176
|
+
initial: import("@angular/core").Signal<{}>;
|
|
177
|
+
previous: import("@angular/core").Signal<{}>;
|
|
178
|
+
changeEvent: import("@angular/core").Signal<import("./context-store.service").AXPLayoutContextChangeEvent>;
|
|
179
|
+
update: (path: string, value: any) => void;
|
|
180
|
+
reset: () => void;
|
|
181
|
+
set: (initialData: any) => void;
|
|
182
|
+
getValue: (path: string) => any;
|
|
183
|
+
} & import("@ngrx/signals").StateSource<{
|
|
184
|
+
data: {};
|
|
185
|
+
state: import("./context-store.service").AXPLayoutContextState;
|
|
186
|
+
initialSnapshot: {};
|
|
187
|
+
previousSnapshot: {};
|
|
188
|
+
lastChange: import("./context-store.service").AXPLayoutContextChangeEvent;
|
|
189
|
+
}>;
|
|
206
190
|
private _isValueWidget;
|
|
207
191
|
private isValueWidget;
|
|
208
192
|
private _id;
|
|
209
193
|
get id(): string | null;
|
|
194
|
+
private _status;
|
|
195
|
+
status: import("@angular/core").Signal<AXPWidgetStatus>;
|
|
196
|
+
readonly onStatusChanged: BehaviorSubject<AXPWidgetStatus>;
|
|
197
|
+
isBusy: import("@angular/core").Signal<boolean>;
|
|
210
198
|
parent: AXPWidgetComponent | null | undefined;
|
|
211
199
|
index: number | null | undefined;
|
|
212
200
|
mode: AXPWidgetRenderMode;
|
|
@@ -214,16 +202,14 @@ export declare abstract class AXPWidgetComponent<T = any | null | void> extends
|
|
|
214
202
|
protected outputs(): string[];
|
|
215
203
|
protected fullPath: import("@angular/core").WritableSignal<string | null>;
|
|
216
204
|
ngOnInit(): void;
|
|
217
|
-
private nextRender;
|
|
218
|
-
private initRender;
|
|
219
205
|
getValue: import("@angular/core").Signal<T>;
|
|
220
206
|
protected extractValue(path: string): any;
|
|
221
|
-
setValue(value: T | null | undefined
|
|
207
|
+
setValue(value: T | null | undefined): void;
|
|
208
|
+
setStatus(status: AXPWidgetStatus): void;
|
|
222
209
|
setOptions(values: any): void;
|
|
223
210
|
output<T = any>(name: string): T;
|
|
224
211
|
call(name: string, ...args: any[]): void;
|
|
225
212
|
setChildren(children: AXPWidgetNode[]): void;
|
|
226
|
-
onValueChanged(oldValue: T | null, newValue: T | null, init?: boolean): void;
|
|
227
213
|
onAdded(): void;
|
|
228
214
|
private detectFullPath;
|
|
229
215
|
protected handleValueChanged(e: AXValueChangedEvent<T>): void;
|