weaver-e10-builder 1.6.15 → 1.7.0
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/dist/cli-register.d.ts +8 -1
- package/dist/cli-register.d.ts.map +1 -1
- package/dist/cli-register.js +238 -86
- package/dist/cli-register.js.map +1 -1
- package/dist/commands/actionflow.d.ts +1 -0
- package/dist/commands/actionflow.d.ts.map +1 -1
- package/dist/commands/actionflow.js +17 -1
- package/dist/commands/actionflow.js.map +1 -1
- package/dist/commands/designer-custom-page.d.ts +3 -0
- package/dist/commands/designer-custom-page.d.ts.map +1 -0
- package/dist/commands/designer-custom-page.js +56 -0
- package/dist/commands/designer-custom-page.js.map +1 -0
- package/dist/commands/designer-event.d.ts.map +1 -1
- package/dist/commands/designer-event.js +70 -5
- package/dist/commands/designer-event.js.map +1 -1
- package/dist/commands/designer-list-advanced.d.ts +3 -0
- package/dist/commands/designer-list-advanced.d.ts.map +1 -0
- package/dist/commands/designer-list-advanced.js +53 -0
- package/dist/commands/designer-list-advanced.js.map +1 -0
- package/dist/commands/designer-list-controls.d.ts +3 -0
- package/dist/commands/designer-list-controls.d.ts.map +1 -0
- package/dist/commands/designer-list-controls.js +39 -0
- package/dist/commands/designer-list-controls.js.map +1 -0
- package/dist/commands/designer-permission.d.ts +3 -0
- package/dist/commands/designer-permission.d.ts.map +1 -0
- package/dist/commands/designer-permission.js +32 -0
- package/dist/commands/designer-permission.js.map +1 -0
- package/dist/commands/designer-tabbar.d.ts +3 -0
- package/dist/commands/designer-tabbar.d.ts.map +1 -0
- package/dist/commands/designer-tabbar.js +24 -0
- package/dist/commands/designer-tabbar.js.map +1 -0
- package/dist/commands/ecode.d.ts +9 -0
- package/dist/commands/ecode.d.ts.map +1 -0
- package/dist/commands/ecode.js +81 -0
- package/dist/commands/ecode.js.map +1 -0
- package/dist/commands/form-base-setting.d.ts +3 -0
- package/dist/commands/form-base-setting.d.ts.map +1 -0
- package/dist/commands/form-base-setting.js +192 -0
- package/dist/commands/form-base-setting.js.map +1 -0
- package/dist/commands/form-field-linkage.d.ts +5 -0
- package/dist/commands/form-field-linkage.d.ts.map +1 -1
- package/dist/commands/form-field-linkage.js +82 -16
- package/dist/commands/form-field-linkage.js.map +1 -1
- package/dist/commands/form-list-columns.d.ts.map +1 -1
- package/dist/commands/form-list-columns.js +4 -0
- package/dist/commands/form-list-columns.js.map +1 -1
- package/dist/commands/form-list-config.d.ts.map +1 -1
- package/dist/commands/form-list-config.js +19 -3
- package/dist/commands/form-list-config.js.map +1 -1
- package/dist/commands/form-list-permission.d.ts.map +1 -1
- package/dist/commands/form-list-permission.js +34 -1
- package/dist/commands/form-list-permission.js.map +1 -1
- package/dist/commands/form-obj-meta.d.ts.map +1 -1
- package/dist/commands/form-obj-meta.js +194 -1
- package/dist/commands/form-obj-meta.js.map +1 -1
- package/dist/commands/form-table-view.d.ts.map +1 -1
- package/dist/commands/form-table-view.js +14 -4
- package/dist/commands/form-table-view.js.map +1 -1
- package/dist/commands/matrix-person.d.ts +3 -0
- package/dist/commands/matrix-person.d.ts.map +1 -0
- package/dist/commands/matrix-person.js +95 -0
- package/dist/commands/matrix-person.js.map +1 -0
- package/dist/commands/matrix.d.ts.map +1 -1
- package/dist/commands/matrix.js +3 -1
- package/dist/commands/matrix.js.map +1 -1
- package/dist/commands/page-combination.d.ts.map +1 -1
- package/dist/commands/page-combination.js +15 -0
- package/dist/commands/page-combination.js.map +1 -1
- package/dist/commands/page-management.d.ts +3 -0
- package/dist/commands/page-management.d.ts.map +1 -0
- package/dist/commands/page-management.js +16 -0
- package/dist/commands/page-management.js.map +1 -0
- package/dist/commands/page.d.ts.map +1 -1
- package/dist/commands/page.js +8 -9
- package/dist/commands/page.js.map +1 -1
- package/dist/commands/report-cell.d.ts.map +1 -1
- package/dist/commands/report-cell.js +215 -0
- package/dist/commands/report-cell.js.map +1 -1
- package/dist/commands/report-code.d.ts +9 -0
- package/dist/commands/report-code.d.ts.map +1 -0
- package/dist/commands/report-code.js +105 -0
- package/dist/commands/report-code.js.map +1 -0
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +70 -17
- package/dist/commands/report.js.map +1 -1
- package/dist/core/client.d.ts +12 -0
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +23 -2
- package/dist/core/client.js.map +1 -1
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/services/action-detail.d.ts +2 -0
- package/dist/services/action-detail.d.ts.map +1 -1
- package/dist/services/action-detail.js +11 -5
- package/dist/services/action-detail.js.map +1 -1
- package/dist/services/actionflow/build_workflow_draft.d.ts +1 -1
- package/dist/services/actionflow/build_workflow_draft.d.ts.map +1 -1
- package/dist/services/actionflow/build_workflow_draft.js +28 -24
- package/dist/services/actionflow/build_workflow_draft.js.map +1 -1
- package/dist/services/actionflow/components/action_eb_update_compiler.d.ts.map +1 -1
- package/dist/services/actionflow/components/action_eb_update_compiler.js +2 -15
- package/dist/services/actionflow/components/action_eb_update_compiler.js.map +1 -1
- package/dist/services/actionflow/components/custom_set_form.d.ts.map +1 -1
- package/dist/services/actionflow/components/custom_set_form.js +1 -9
- package/dist/services/actionflow/components/custom_set_form.js.map +1 -1
- package/dist/services/actionflow/components/dml_execute.d.ts.map +1 -1
- package/dist/services/actionflow/components/dml_execute.js +3 -4
- package/dist/services/actionflow/components/dml_execute.js.map +1 -1
- package/dist/services/actionflow/components/document_actions.d.ts.map +1 -1
- package/dist/services/actionflow/components/document_actions.js +0 -3
- package/dist/services/actionflow/components/document_actions.js.map +1 -1
- package/dist/services/actionflow/components/form_data_builder.d.ts.map +1 -1
- package/dist/services/actionflow/components/form_data_builder.js +27 -5
- package/dist/services/actionflow/components/form_data_builder.js.map +1 -1
- package/dist/services/actionflow/components/hrm_actions.d.ts.map +1 -1
- package/dist/services/actionflow/components/hrm_actions.js +1 -3
- package/dist/services/actionflow/components/hrm_actions.js.map +1 -1
- package/dist/services/actionflow/components/index.d.ts +1 -1
- package/dist/services/actionflow/components/index.d.ts.map +1 -1
- package/dist/services/actionflow/components/index.js +1 -1
- package/dist/services/actionflow/components/index.js.map +1 -1
- package/dist/services/actionflow/components/inner_mq_listener.js +1 -1
- package/dist/services/actionflow/components/inner_mq_listener.js.map +1 -1
- package/dist/services/actionflow/components/inner_mq_send.d.ts.map +1 -1
- package/dist/services/actionflow/components/inner_mq_send.js +6 -2
- package/dist/services/actionflow/components/inner_mq_send.js.map +1 -1
- package/dist/services/actionflow/components/multiple_execution.d.ts +1 -2
- package/dist/services/actionflow/components/multiple_execution.d.ts.map +1 -1
- package/dist/services/actionflow/components/multiple_execution.js +55 -276
- package/dist/services/actionflow/components/multiple_execution.js.map +1 -1
- package/dist/services/actionflow/components/output.d.ts.map +1 -1
- package/dist/services/actionflow/components/output.js +3 -7
- package/dist/services/actionflow/components/output.js.map +1 -1
- package/dist/services/actionflow/components/send_message.d.ts.map +1 -1
- package/dist/services/actionflow/components/send_message.js +6 -10
- package/dist/services/actionflow/components/send_message.js.map +1 -1
- package/dist/services/actionflow/components/serverless_action.d.ts.map +1 -1
- package/dist/services/actionflow/components/serverless_action.js +3 -2
- package/dist/services/actionflow/components/serverless_action.js.map +1 -1
- package/dist/services/actionflow/components/workflow_actions.d.ts.map +1 -1
- package/dist/services/actionflow/components/workflow_actions.js +0 -3
- package/dist/services/actionflow/components/workflow_actions.js.map +1 -1
- package/dist/services/actionflow/context_preflight.d.ts.map +1 -1
- package/dist/services/actionflow/context_preflight.js +12 -9
- package/dist/services/actionflow/context_preflight.js.map +1 -1
- package/dist/services/actionflow/filter_rules.js +4 -4
- package/dist/services/actionflow/filter_rules.js.map +1 -1
- package/dist/services/actionflow/formula_service.d.ts +0 -13
- package/dist/services/actionflow/formula_service.d.ts.map +1 -1
- package/dist/services/actionflow/formula_service.js +45 -267
- package/dist/services/actionflow/formula_service.js.map +1 -1
- package/dist/services/actionflow/generation_service.d.ts.map +1 -1
- package/dist/services/actionflow/generation_service.js +10 -12
- package/dist/services/actionflow/generation_service.js.map +1 -1
- package/dist/services/actionflow/id_generator.d.ts +2 -2
- package/dist/services/actionflow/id_generator.d.ts.map +1 -1
- package/dist/services/actionflow/id_generator.js +5 -11
- package/dist/services/actionflow/id_generator.js.map +1 -1
- package/dist/services/actionflow/loop_context.d.ts +12 -0
- package/dist/services/actionflow/loop_context.d.ts.map +1 -0
- package/dist/services/actionflow/loop_context.js +134 -0
- package/dist/services/actionflow/loop_context.js.map +1 -0
- package/dist/services/actionflow/param_group_dto.d.ts +7 -0
- package/dist/services/actionflow/param_group_dto.d.ts.map +1 -1
- package/dist/services/actionflow/param_group_dto.js +128 -16
- package/dist/services/actionflow/param_group_dto.js.map +1 -1
- package/dist/services/actionflow/param_mapping_basis.js +2 -2
- package/dist/services/actionflow/param_mapping_basis.js.map +1 -1
- package/dist/services/actionflow/preflight_service.d.ts +1 -0
- package/dist/services/actionflow/preflight_service.d.ts.map +1 -1
- package/dist/services/actionflow/preflight_service.js +88 -291
- package/dist/services/actionflow/preflight_service.js.map +1 -1
- package/dist/services/actionflow/readback_verifier.d.ts.map +1 -1
- package/dist/services/actionflow/readback_verifier.js +21 -2
- package/dist/services/actionflow/readback_verifier.js.map +1 -1
- package/dist/services/actionflow/save_workflow_draft.d.ts +2 -3
- package/dist/services/actionflow/save_workflow_draft.d.ts.map +1 -1
- package/dist/services/actionflow/save_workflow_draft.js +14 -16
- package/dist/services/actionflow/save_workflow_draft.js.map +1 -1
- package/dist/services/actionflow/update_service.d.ts +5 -0
- package/dist/services/actionflow/update_service.d.ts.map +1 -1
- package/dist/services/actionflow/update_service.js +126 -3
- package/dist/services/actionflow/update_service.js.map +1 -1
- package/dist/services/actionflow/workflow_compiler.d.ts +1 -2
- package/dist/services/actionflow/workflow_compiler.d.ts.map +1 -1
- package/dist/services/actionflow/workflow_compiler.js +79 -105
- package/dist/services/actionflow/workflow_compiler.js.map +1 -1
- package/dist/services/designer-custom-page.d.ts +11 -0
- package/dist/services/designer-custom-page.d.ts.map +1 -0
- package/dist/services/designer-custom-page.js +227 -0
- package/dist/services/designer-custom-page.js.map +1 -0
- package/dist/services/designer-event.d.ts +7 -2
- package/dist/services/designer-event.d.ts.map +1 -1
- package/dist/services/designer-event.js +357 -33
- package/dist/services/designer-event.js.map +1 -1
- package/dist/services/designer-list-advanced.d.ts +9 -0
- package/dist/services/designer-list-advanced.d.ts.map +1 -0
- package/dist/services/designer-list-advanced.js +64 -0
- package/dist/services/designer-list-advanced.js.map +1 -0
- package/dist/services/designer-list-controls.d.ts +2 -0
- package/dist/services/designer-list-controls.d.ts.map +1 -0
- package/dist/services/designer-list-controls.js +85 -0
- package/dist/services/designer-list-controls.js.map +1 -0
- package/dist/services/designer-list-presentation.d.ts +2 -0
- package/dist/services/designer-list-presentation.d.ts.map +1 -0
- package/dist/services/designer-list-presentation.js +45 -0
- package/dist/services/designer-list-presentation.js.map +1 -0
- package/dist/services/designer-list-runtime.d.ts +2 -0
- package/dist/services/designer-list-runtime.d.ts.map +1 -0
- package/dist/services/designer-list-runtime.js +80 -0
- package/dist/services/designer-list-runtime.js.map +1 -0
- package/dist/services/designer-list-search.d.ts +2 -0
- package/dist/services/designer-list-search.d.ts.map +1 -0
- package/dist/services/designer-list-search.js +72 -0
- package/dist/services/designer-list-search.js.map +1 -0
- package/dist/services/designer-permission.d.ts +52 -0
- package/dist/services/designer-permission.d.ts.map +1 -0
- package/dist/services/designer-permission.js +316 -0
- package/dist/services/designer-permission.js.map +1 -0
- package/dist/services/designer-tabbar.d.ts +11 -0
- package/dist/services/designer-tabbar.d.ts.map +1 -0
- package/dist/services/designer-tabbar.js +114 -0
- package/dist/services/designer-tabbar.js.map +1 -0
- package/dist/services/ecode-check.d.ts +50 -0
- package/dist/services/ecode-check.d.ts.map +1 -0
- package/dist/services/ecode-check.js +408 -0
- package/dist/services/ecode-check.js.map +1 -0
- package/dist/services/esb-interface/importer.d.ts +35 -1
- package/dist/services/esb-interface/importer.d.ts.map +1 -1
- package/dist/services/esb-interface/importer.js +77 -1
- package/dist/services/esb-interface/importer.js.map +1 -1
- package/dist/services/form-base-setting.d.ts +88 -0
- package/dist/services/form-base-setting.d.ts.map +1 -0
- package/dist/services/form-base-setting.js +272 -0
- package/dist/services/form-base-setting.js.map +1 -0
- package/dist/services/form-list-columns.d.ts.map +1 -1
- package/dist/services/form-list-columns.js +12 -3
- package/dist/services/form-list-columns.js.map +1 -1
- package/dist/services/form-list-config.d.ts +40 -3
- package/dist/services/form-list-config.d.ts.map +1 -1
- package/dist/services/form-list-config.js +207 -25
- package/dist/services/form-list-config.js.map +1 -1
- package/dist/services/form-list-fields.d.ts.map +1 -1
- package/dist/services/form-list-fields.js +3 -1
- package/dist/services/form-list-fields.js.map +1 -1
- package/dist/services/form-log-setting.d.ts +55 -0
- package/dist/services/form-log-setting.d.ts.map +1 -0
- package/dist/services/form-log-setting.js +108 -0
- package/dist/services/form-log-setting.js.map +1 -0
- package/dist/services/form-obj-lang.d.ts +45 -0
- package/dist/services/form-obj-lang.d.ts.map +1 -0
- package/dist/services/form-obj-lang.js +127 -0
- package/dist/services/form-obj-lang.js.map +1 -0
- package/dist/services/form-obj-meta.d.ts +34 -0
- package/dist/services/form-obj-meta.d.ts.map +1 -1
- package/dist/services/form-obj-meta.js +81 -12
- package/dist/services/form-obj-meta.js.map +1 -1
- package/dist/services/form-table-view.d.ts +8 -2
- package/dist/services/form-table-view.d.ts.map +1 -1
- package/dist/services/form-table-view.js +22 -5
- package/dist/services/form-table-view.js.map +1 -1
- package/dist/services/form-view.d.ts +1 -1
- package/dist/services/form-view.d.ts.map +1 -1
- package/dist/services/form-view.js +38 -13
- package/dist/services/form-view.js.map +1 -1
- package/dist/services/matrix-person.d.ts +37 -0
- package/dist/services/matrix-person.d.ts.map +1 -0
- package/dist/services/matrix-person.js +57 -0
- package/dist/services/matrix-person.js.map +1 -0
- package/dist/services/org-browser.d.ts +32 -0
- package/dist/services/org-browser.d.ts.map +1 -1
- package/dist/services/org-browser.js +90 -12
- package/dist/services/org-browser.js.map +1 -1
- package/dist/services/page-combination.d.ts +1 -1
- package/dist/services/page-combination.d.ts.map +1 -1
- package/dist/services/page-combination.js +43 -10
- package/dist/services/page-combination.js.map +1 -1
- package/dist/services/page-management.d.ts +67 -0
- package/dist/services/page-management.d.ts.map +1 -0
- package/dist/services/page-management.js +166 -0
- package/dist/services/page-management.js.map +1 -0
- package/dist/services/page-permission.d.ts +2 -2
- package/dist/services/page-permission.d.ts.map +1 -1
- package/dist/services/page-permission.js +22 -9
- package/dist/services/page-permission.js.map +1 -1
- package/dist/services/report/cell-transform.d.ts +62 -0
- package/dist/services/report/cell-transform.d.ts.map +1 -0
- package/dist/services/report/cell-transform.js +192 -0
- package/dist/services/report/cell-transform.js.map +1 -0
- package/dist/services/report/code-block.d.ts +45 -0
- package/dist/services/report/code-block.d.ts.map +1 -0
- package/dist/services/report/code-block.js +92 -0
- package/dist/services/report/code-block.js.map +1 -0
- package/dist/services/report/dataset.d.ts +40 -0
- package/dist/services/report/dataset.d.ts.map +1 -1
- package/dist/services/report/dataset.js +171 -1
- package/dist/services/report/dataset.js.map +1 -1
- package/dist/services/report/lifecycle.d.ts.map +1 -1
- package/dist/services/report/lifecycle.js +24 -3
- package/dist/services/report/lifecycle.js.map +1 -1
- package/dist/services/workflow-base-settings.d.ts.map +1 -1
- package/dist/services/workflow-base-settings.js +19 -5
- package/dist/services/workflow-base-settings.js.map +1 -1
- package/ecode-ui/README.md +9 -0
- package/ecode-ui/ui-types.zip +0 -0
- package/ecode-ui/version.json +7 -0
- package/package.json +4 -1
- package/skill-docs/SKILL.md +19 -5
- package/skill-docs/_catalog.md +22 -1
- package/skill-docs/actionflows/SKILL.md +15 -11
- package/skill-docs/actionflows/references/components/database/DMLExecute.md +4 -0
- package/skill-docs/actionflows/references/components/ebuilder/ActionEbAdd.md +1 -1
- package/skill-docs/actionflows/references/components/ebuilder/ActionEbUpdate.md +2 -0
- package/skill-docs/actionflows/references/components/logic/MultipleExecution.md +9 -30
- package/skill-docs/actionflows/references/components/message/InnerMQSend.md +7 -3
- package/skill-docs/actionflows/references/components/serverless/ServerlessAction.md +4 -0
- package/skill-docs/actionflows/references/components/trigger/CustomTrigger.md +6 -6
- package/skill-docs/actionflows/references/components/trigger/InnerMQListener.md +46 -41
- package/skill-docs/actionflows/references/components/trigger/WebHookTrigger.md +4 -0
- package/skill-docs/actionflows/references/dynamic_capability_matrix.md +3 -4
- package/skill-docs/actionflows/references/function_rules.md +5 -1
- package/skill-docs/actionflows/references/trigger_runtime_notes.md +1 -1
- package/skill-docs/assets/factory/factory-custom-page.json +339 -0
- package/skill-docs/references/common/ref-cli-commands.md +34 -5
- package/skill-docs/references/ebuilder-designer/component-permission.md +131 -0
- package/skill-docs/references/ebuilder-designer/events/actions-interaction.md +132 -108
- package/skill-docs/references/ebuilder-designer/events/guide-events.md +112 -57
- package/skill-docs/references/ebuilder-designer/guide-custom-page.md +176 -0
- package/skill-docs/references/ebuilder-designer/guide-designer-components.md +2 -0
- package/skill-docs/references/ebuilder-designer/guide-designer-factory.md +2 -0
- package/skill-docs/references/ebuilder-designer/guide-designer.md +304 -296
- package/skill-docs/references/ebuilder-designer/guide-list.md +339 -0
- package/skill-docs/references/ebuilder-designer/guide-page-combination.md +162 -142
- package/skill-docs/references/ebuilder-designer/guide-page-management.md +90 -0
- package/skill-docs/references/ebuilder-designer/guide-page-permission.md +151 -145
- package/skill-docs/references/ebuilder-designer/guide-tabbar.md +57 -0
- package/skill-docs/references/esb-interface/guide-import.md +38 -34
- package/skill-docs/references/form/guide-create-form.md +13 -0
- package/skill-docs/references/form/guide-form-base-setting.md +78 -0
- package/skill-docs/references/form/guide-form-view.md +77 -13
- package/skill-docs/references/form/guide-list-columns.md +8 -0
- package/skill-docs/references/hrm/guide-matrix.md +16 -0
- package/skill-docs/references/report/cell-transform-guide.md +17 -3
- package/skill-docs/references/report/code-block-guide.md +54 -0
- package/skill-docs/references/report/dataset-sidebar-ops-guide.md +8 -0
- package/skill-docs/references/report/ref-report-commands.md +7 -1
- package/skill-docs/references/report/report-designer-feature-map.md +1 -1
- package/skill-docs/references/report/report-list-page-ops-guide.md +2 -0
|
@@ -8,7 +8,7 @@ const uid = () => randomUUID().replace(/-/g, '');
|
|
|
8
8
|
export const EVENT_OPEN_MODES = { '4': '当前页面', '0': '新窗口', '5': '弹出窗口', '1': '右侧滑出', '7': '右侧推出' };
|
|
9
9
|
export const EVENT_ACTIONS = {
|
|
10
10
|
NewPage: { label: '打开页面', key: 'linkInfo' }, RefreshComp: { label: '刷新组件', key: 'refreshInfo' }, ClosePage: { label: '关闭页面' },
|
|
11
|
-
IF: { label: '条件控制', key: 'conditionData' }, JsCode: { label: 'JavaScript', key: 'jsCode' },
|
|
11
|
+
IF: { label: '条件控制', key: 'conditionData' }, ELSEIF: { label: '否则如果', key: 'conditionData' }, ELSE: { label: '否则' }, JsCode: { label: 'JavaScript', key: 'jsCode' },
|
|
12
12
|
ShowHideComponent: { label: '显示/隐藏组件', key: 'displayComs' }, ShowMenu: { label: '显示菜单', key: 'menuInfo' },
|
|
13
13
|
ScanUpload: { label: '扫描上传', key: 'scanUploadInfo' }, CopyLink: { label: '复制链接' },
|
|
14
14
|
LoginAuthentication: { label: '身份识别', key: 'loginAuthenticationInfo' }, EsbFlow: { label: '执行 ESB', key: 'esbFlow' },
|
|
@@ -37,7 +37,7 @@ function savedComps(comps) {
|
|
|
37
37
|
return value;
|
|
38
38
|
}
|
|
39
39
|
const clone = (x) => structuredClone(x);
|
|
40
|
-
const eventNames = { CLICK: '单击', DIDMOUNT: '加载完成' };
|
|
40
|
+
const eventNames = { CLICK: '单击', DIDMOUNT: '加载完成', CLICKDATA: '单击每一条数据' };
|
|
41
41
|
export function eventTarget(layout, scope) {
|
|
42
42
|
if (!scope.compId) {
|
|
43
43
|
check(!scope.collection && !scope.itemId, '子项必须指定组件');
|
|
@@ -50,7 +50,25 @@ export function eventTarget(layout, scope) {
|
|
|
50
50
|
check(!scope.itemId, '子项需要 collection');
|
|
51
51
|
return config;
|
|
52
52
|
}
|
|
53
|
-
check(['menuConfig', 'btnGroup', 'navMenus', 'newButtons'].includes(scope.collection) && scope.itemId, '子项集合或 ID 无效');
|
|
53
|
+
check(['menuConfig', 'btnGroup', 'navMenus', 'newButtons', 'items', 'listButtons', 'customPageButtons'].includes(scope.collection) && scope.itemId, '子项集合或 ID 无效');
|
|
54
|
+
if (scope.collection === 'customPageButtons') {
|
|
55
|
+
check(matches[0].type === 'CustomPage', 'customPageButtons 仅用于自定义页面');
|
|
56
|
+
const rows = (config.topOperatBtns?.btns || []).filter((x) => x.id === scope.itemId);
|
|
57
|
+
check(rows.length === 1 && rows[0].event?.to === 'HELP', '仅帮助按钮可通过本入口配置动作,其他按钮保留内置动作');
|
|
58
|
+
return new Proxy(rows[0], { get: (t, k) => k === 'eventGroup' ? t.event.value : t[k], set: (t, k, v) => { if (k === 'eventGroup')
|
|
59
|
+
t.event.value = v;
|
|
60
|
+
else
|
|
61
|
+
t[k] = v; return true; } });
|
|
62
|
+
}
|
|
63
|
+
if (scope.collection === 'items')
|
|
64
|
+
check(matches[0].type === 'TabBar', 'items 事件定位仅用于标签栏');
|
|
65
|
+
if (scope.collection === 'listButtons') {
|
|
66
|
+
check(matches[0].type === 'NList', 'listButtons 仅用于列表');
|
|
67
|
+
const hits = (config.buttonConfig?.btns || []).filter((x) => String(x.id) === scope.itemId);
|
|
68
|
+
check(hits.length === 1, '列表按钮未唯一匹配');
|
|
69
|
+
check(!hits[0].system && !hits[0].hideAction, '系统内置动作不可用自定义事件覆盖');
|
|
70
|
+
return new Proxy(hits[0], { get: (t, k) => t[k === 'eventGroup' ? 'actions' : k], set: (t, k, v) => { t[k === 'eventGroup' ? 'actions' : k] = v; return true; } });
|
|
71
|
+
}
|
|
54
72
|
const items = config[scope.collection];
|
|
55
73
|
check(Array.isArray(items), '组件没有指定子项集合');
|
|
56
74
|
const rows = items.filter((x) => String(x.id) === scope.itemId);
|
|
@@ -64,9 +82,68 @@ export function validateEventGroups(groups) {
|
|
|
64
82
|
check(entry && typeof entry.type === 'string' && entry.id, '事件类型或 ID 缺失');
|
|
65
83
|
check(!seen.has(entry.type), '同一触发事件最多配置一条');
|
|
66
84
|
seen.add(entry.type);
|
|
67
|
-
|
|
85
|
+
validateEventSequence(entry.events);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Ordered siblings encode IF/ELSEIF/ELSE; each branch recursively owns another sequence. */
|
|
89
|
+
export function validateEventSequence(events, ids = new Set()) {
|
|
90
|
+
check(Array.isArray(events), '动作列表需数组');
|
|
91
|
+
let chain = false, ended = false;
|
|
92
|
+
for (const a of events) {
|
|
93
|
+
check(a && typeof a.id === 'string' && a.id && typeof a.type === 'string', '动作需 id/type');
|
|
94
|
+
check(!ids.has(a.id), '同一执行树动作 ID 重复');
|
|
95
|
+
ids.add(a.id);
|
|
96
|
+
if (a.type === 'IF') {
|
|
97
|
+
chain = true;
|
|
98
|
+
ended = false;
|
|
99
|
+
}
|
|
100
|
+
else if (a.type === 'ELSEIF' || a.type === 'ELSE') {
|
|
101
|
+
check(chain && !ended, 'ELSEIF/ELSE 必须紧随同组 IF 分支,ELSE 只能位于组末');
|
|
102
|
+
if (a.type === 'ELSE')
|
|
103
|
+
ended = true;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
chain = false;
|
|
107
|
+
ended = false;
|
|
108
|
+
}
|
|
109
|
+
if (['IF', 'ELSEIF'].includes(a.type))
|
|
110
|
+
check(['Rule', 'Dialog'].includes(a.conditionData?.conditionType), '条件分支需要 Rule/Dialog');
|
|
111
|
+
if (a.events !== undefined)
|
|
112
|
+
validateEventSequence(a.events, ids);
|
|
113
|
+
if (a.menuInfo?.menuItems)
|
|
114
|
+
for (const m of a.menuInfo.menuItems)
|
|
115
|
+
validateEventGroups(m.menuEvent || []);
|
|
68
116
|
}
|
|
69
117
|
}
|
|
118
|
+
export function compileEventSequence(inputs, layout) {
|
|
119
|
+
check(Array.isArray(inputs), 'actions 需数组');
|
|
120
|
+
const result = [];
|
|
121
|
+
for (const input of inputs) {
|
|
122
|
+
if (input?.type === 'IF' && input.config?.branches !== undefined) {
|
|
123
|
+
object(input, ['id', 'type', 'enabled', 'config']);
|
|
124
|
+
object(input.config, ['branches']);
|
|
125
|
+
const branches = input.config.branches;
|
|
126
|
+
check(Array.isArray(branches) && branches.length, 'branches 不能为空');
|
|
127
|
+
for (let i = 0; i < branches.length; i++) {
|
|
128
|
+
const b = branches[i];
|
|
129
|
+
object(b, ['id', 'mode', 'title', 'content', 'confirmText', 'cancelText', 'condition', 'conditionsText', 'actions', 'enabled']);
|
|
130
|
+
const { id, actions, enabled, ...config } = b;
|
|
131
|
+
const type = i === 0 ? 'IF' : b.mode === 'else' ? 'ELSE' : 'ELSEIF';
|
|
132
|
+
check(i !== 0 || b.mode !== 'else', '首分支必须是 IF');
|
|
133
|
+
if (type === 'ELSE')
|
|
134
|
+
check(i === branches.length - 1, 'ELSE 必须最后');
|
|
135
|
+
const a = compileEventAction({ id, type, enabled: enabled ?? input.enabled, config: type === 'ELSE' ? {} : config, actions: actions || [] }, layout);
|
|
136
|
+
if (i === 0 && input.id)
|
|
137
|
+
a.id = input.id;
|
|
138
|
+
result.push(a);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else
|
|
142
|
+
result.push(compileEventAction(input, layout));
|
|
143
|
+
}
|
|
144
|
+
validateEventSequence(result);
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
70
147
|
export function compileEventJs(code) {
|
|
71
148
|
check(typeof code === 'string', 'JavaScript code 必须为字符串');
|
|
72
149
|
try {
|
|
@@ -77,9 +154,11 @@ export function compileEventJs(code) {
|
|
|
77
154
|
}
|
|
78
155
|
}
|
|
79
156
|
export function eventCondition(spec) {
|
|
80
|
-
|
|
157
|
+
if (spec?.isParent !== undefined) {
|
|
158
|
+
validateNativeEventCondition(spec);
|
|
159
|
+
return clone(spec);
|
|
160
|
+
}
|
|
81
161
|
const build = (n, parent, depth) => {
|
|
82
|
-
check(depth <= 12 && ++count <= 500, '条件树过深或过大');
|
|
83
162
|
const key = uid();
|
|
84
163
|
if (n?.rules !== undefined) {
|
|
85
164
|
object(n, ['logic', 'rules']);
|
|
@@ -87,29 +166,59 @@ export function eventCondition(spec) {
|
|
|
87
166
|
// This event condition protocol uses 1 = AND, 0 = OR (different from other scopes).
|
|
88
167
|
return { key, relationship: n.logic === 'and' ? '1' : '0', isParent: true, parentNode: parent, datas: n.rules.map((r) => build(r, key, depth + 1)) };
|
|
89
168
|
}
|
|
90
|
-
object(n, ['left', 'operator', 'right']);
|
|
169
|
+
object(n, ['left', 'field', 'operator', 'right', 'valueType', 'text']);
|
|
170
|
+
check(typeof n.operator === 'string' && n.operator, '条件需要本入口保存操作符');
|
|
171
|
+
if (n.field) {
|
|
172
|
+
object(n.field);
|
|
173
|
+
check(n.field.id && (n.field.fieldName || n.field.name) && n.field.compType, '字段需要真实 id/name/compType');
|
|
174
|
+
const f = clone(n.field);
|
|
175
|
+
delete f.conditionType;
|
|
176
|
+
return { ...f, key, parentNode: parent, isParent: false, type: 'condition', fieldType: f.fieldType || f.type || f.compType, fieldName: f.fieldName || f.name, conditions: { func: n.operator, ...(n.right !== undefined ? { value: clone(n.right) } : {}), ...(n.valueType !== undefined ? { type: n.valueType } : {}), ...(n.text !== undefined ? { text: n.text } : {}), isEsb: false } };
|
|
177
|
+
}
|
|
91
178
|
check(typeof n.left === 'string' && n.left, '条件 left 需平台表达式或文字');
|
|
92
|
-
check(['
|
|
93
|
-
check(typeof n.right === 'string', '条件 right 必须为字符串');
|
|
179
|
+
check(n.right === undefined || ['string', 'number', 'boolean'].includes(typeof n.right), '自定义条件值需标量,浏览对象请使用 field 或原生条件树');
|
|
94
180
|
return { isParent: false, parentNode: parent, id: `Custom_${uid()}`, fieldName: 'customField', fieldType: 'String', text: n.left, objId: '', optionType: '', compType: 'Text', formatType: '', opts: [], type: 'condition', conditions: { func: n.operator, value: n.right, type: '', text: '', isEsb: false }, refObjId: '', key };
|
|
95
181
|
};
|
|
96
182
|
return build(spec.rules !== undefined ? spec : { logic: 'and', rules: [spec] }, '', 0);
|
|
97
183
|
}
|
|
184
|
+
export function validateNativeEventCondition(tree) {
|
|
185
|
+
const seen = new Set();
|
|
186
|
+
function visit(n, parent) {
|
|
187
|
+
object(n);
|
|
188
|
+
check(n.key !== undefined && !seen.has(String(n.key)), '条件节点 key 缺失或重复');
|
|
189
|
+
seen.add(String(n.key));
|
|
190
|
+
check(String(n.parentNode ?? '') === String(parent), '条件父子关系不一致');
|
|
191
|
+
if (n.isParent) {
|
|
192
|
+
check(['0', '1'].includes(String(n.relationship)) && Array.isArray(n.datas), '条件组需 relationship/datas');
|
|
193
|
+
n.datas.forEach((x) => visit(x, n.key));
|
|
194
|
+
}
|
|
195
|
+
else
|
|
196
|
+
check(n.fieldName && n.compType && n.conditions?.func, '条件叶子缺少字段或操作符');
|
|
197
|
+
}
|
|
198
|
+
check(tree?.isParent === true, '条件根需组');
|
|
199
|
+
visit(tree, '');
|
|
200
|
+
}
|
|
98
201
|
function conditionText(tree) {
|
|
99
202
|
if (tree.isParent)
|
|
100
|
-
return `(${tree.datas.map(conditionText).join(tree.relationship === '1' ? ' AND ' : ' OR ')})`;
|
|
101
|
-
return `${tree.text} ${
|
|
203
|
+
return `(${tree.datas.map(conditionText).join(String(tree.relationship) === '1' ? ' AND ' : ' OR ')})`;
|
|
204
|
+
return `${tree.text} ${{ eq: '等于', neq: '不等于', gt: '大于', lt: '小于' }[tree.conditions.func] || tree.conditions.func} ${JSON.stringify(tree.conditions.value)}`;
|
|
102
205
|
}
|
|
103
206
|
function requireComp(layout, id) { check(typeof id === 'string' && layout.comps.some((c) => String(c.id) === id), `目标组件 ${id} 不属于本终端`); }
|
|
207
|
+
function componentChildren(config) {
|
|
208
|
+
return ['menuConfig', 'btnGroup', 'navMenus', 'newButtons', 'items'].flatMap(k => Array.isArray(config?.[k]) ? config[k] : []).concat(config?.buttonConfig?.btns || [], config?.topOperatBtns?.btns || []);
|
|
209
|
+
}
|
|
104
210
|
function realObjects(rows, label, minimum = 1) { check(Array.isArray(rows) && rows.length >= minimum && rows.every((x) => x && typeof x.id === 'string' && x.id), `${label}需要真实浏览对象数组`); }
|
|
105
211
|
export function compileEventAction(input, layout, previous, depth = 0) {
|
|
106
|
-
|
|
107
|
-
object(input, ['type', 'enabled', 'config']);
|
|
212
|
+
object(input, ['id', 'type', 'enabled', 'config', 'actions']);
|
|
108
213
|
const descriptor = EVENT_ACTIONS[input.type];
|
|
109
214
|
check(descriptor, '不支持该事件动作类型');
|
|
110
215
|
if (input.enabled !== undefined)
|
|
111
216
|
check(typeof input.enabled === 'boolean', 'enabled 必须为布尔值');
|
|
112
|
-
const a = { id: previous?.id || uid(), type: input.type, enable: input.enabled ?? true };
|
|
217
|
+
const a = { id: previous?.id || input.id || uid(), type: input.type, enable: input.enabled ?? previous?.enable ?? true };
|
|
218
|
+
if (['IF', 'ELSEIF', 'ELSE'].includes(input.type))
|
|
219
|
+
a.events = input.actions === undefined ? clone(previous?.events || []) : compileEventSequence(input.actions, layout);
|
|
220
|
+
else
|
|
221
|
+
check(input.actions === undefined, '普通动作不能携带分支 actions');
|
|
113
222
|
const config = clone(input.config ?? {});
|
|
114
223
|
if (!descriptor.key) {
|
|
115
224
|
check(Object.keys(config).length === 0, '此动作不接收 config');
|
|
@@ -120,14 +229,14 @@ export function compileEventAction(input, layout, previous, depth = 0) {
|
|
|
120
229
|
a.jsCode = { code: config.code, compiledCode: compileEventJs(config.code) };
|
|
121
230
|
return a;
|
|
122
231
|
}
|
|
123
|
-
if (input.type === 'IF') {
|
|
124
|
-
object(config, ['mode', 'title', 'content', 'confirmText', 'cancelText', 'condition']);
|
|
232
|
+
if (input.type === 'IF' || input.type === 'ELSEIF') {
|
|
233
|
+
object(config, ['mode', 'title', 'content', 'confirmText', 'cancelText', 'condition', 'conditionsText']);
|
|
125
234
|
check(['rule', 'dialog'].includes(config.mode), '条件 mode 只能为 rule/dialog');
|
|
126
235
|
a.conditionData = { conditionType: config.mode === 'rule' ? 'Rule' : 'Dialog', conditionTitle: config.title ?? '确认', conditionContent: config.content ?? '', confirmBtnText: config.confirmText ?? '是', cancelBtnText: config.cancelText ?? '否' };
|
|
127
236
|
if (config.mode === 'rule') {
|
|
128
237
|
check(config.condition, '规则模式需要 condition');
|
|
129
238
|
a.conditionData.conditions = eventCondition(config.condition);
|
|
130
|
-
a.conditionData.conditionsText = conditionText(a.conditionData.conditions);
|
|
239
|
+
a.conditionData.conditionsText = config.conditionsText ?? conditionText(a.conditionData.conditions);
|
|
131
240
|
}
|
|
132
241
|
return a;
|
|
133
242
|
}
|
|
@@ -142,7 +251,7 @@ export function compileEventAction(input, layout, previous, depth = 0) {
|
|
|
142
251
|
for (const child of item.children) {
|
|
143
252
|
check(child.id && ['show', 'hide', 'switchover'].includes(child.display), '子项显示设置无效');
|
|
144
253
|
const parent = layout.comps.find((c) => c.id === item.id);
|
|
145
|
-
check(
|
|
254
|
+
check(componentChildren(parent.config).some((x) => x.id === child.id), '显示隐藏子项不属于目标组件');
|
|
146
255
|
}
|
|
147
256
|
}
|
|
148
257
|
}
|
|
@@ -179,8 +288,8 @@ export function compileEventAction(input, layout, previous, depth = 0) {
|
|
|
179
288
|
check(typeof m.menuName === 'string' && m.menuName, '菜单项需要 menuName');
|
|
180
289
|
if (m.action !== undefined) {
|
|
181
290
|
check(!m.menuEvent, '菜单项 action 与 menuEvent 二选一');
|
|
182
|
-
const
|
|
183
|
-
m.menuEvent = [[{ type: 'CLICK', name: '单击', id: uid(), disableDelete: true, events:
|
|
291
|
+
const children = m.action.type === undefined && m.action.nativeActions !== undefined ? prepareNativeActions(m.action.nativeActions, layout) : compileEventSequence(m.action.type === undefined && m.action.actions !== undefined ? m.action.actions : [m.action], layout);
|
|
292
|
+
m.menuEvent = [[{ type: 'CLICK', name: '单击', id: uid(), disableDelete: true, events: children }]];
|
|
184
293
|
delete m.action;
|
|
185
294
|
}
|
|
186
295
|
validateEventGroups(m.menuEvent || []);
|
|
@@ -236,12 +345,210 @@ function remapAction(input, primary, target) {
|
|
|
236
345
|
if (next.type === 'RefreshComp')
|
|
237
346
|
next.config.selectedCom = next.config.selectedCom.map(map);
|
|
238
347
|
if (next.type === 'ShowHideComponent')
|
|
239
|
-
next.config.forEach((x) => {
|
|
348
|
+
next.config.forEach((x) => {
|
|
349
|
+
const source = primary.comps.find((c) => c.id === x.id);
|
|
350
|
+
x.id = map(x.id);
|
|
351
|
+
const dest = target.comps.find((c) => c.id === x.id);
|
|
352
|
+
for (const child of x.children || []) {
|
|
353
|
+
const origin = componentChildren(source.config).find((c) => c.id === child.id);
|
|
354
|
+
const matched = componentChildren(dest.config).find((c) => c.id === child.id || (origin?.refCompId && c.id === origin.refCompId));
|
|
355
|
+
check(matched, '显隐子项在另一终端无明确对应关系,请分别配置');
|
|
356
|
+
child.id = matched.id;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
if (next.nativeActions)
|
|
360
|
+
next.nativeActions = next.nativeActions.map((a) => remapNativeAction(a, primary, target));
|
|
361
|
+
if (next.actions)
|
|
362
|
+
next.actions = next.actions.map((x) => remapAction(x, primary, target));
|
|
363
|
+
if (next.config?.branches)
|
|
364
|
+
for (const b of next.config.branches)
|
|
365
|
+
if (b.actions)
|
|
366
|
+
b.actions = b.actions.map((x) => remapAction(x, primary, target));
|
|
367
|
+
if (next.type === 'ShowMenu')
|
|
368
|
+
for (const m of next.config.menuItems || []) {
|
|
369
|
+
if (m.action)
|
|
370
|
+
m.action = remapAction(m.action, primary, target);
|
|
371
|
+
if (m.menuEvent)
|
|
372
|
+
for (const e of m.menuEvent.flat())
|
|
373
|
+
e.events = e.events.map((a) => remapNativeAction(a, primary, target));
|
|
374
|
+
}
|
|
240
375
|
return next;
|
|
241
376
|
}
|
|
377
|
+
function remapNativeAction(a, primary, target) {
|
|
378
|
+
const n = clone(a);
|
|
379
|
+
const key = EVENT_ACTIONS[n.type]?.key;
|
|
380
|
+
if (['RefreshComp', 'ShowHideComponent'].includes(n.type))
|
|
381
|
+
n[key] = remapAction({ type: n.type, config: n[key] }, primary, target).config;
|
|
382
|
+
if (n.events)
|
|
383
|
+
n.events = n.events.map((v) => remapNativeAction(v, primary, target));
|
|
384
|
+
if (n.menuInfo)
|
|
385
|
+
for (const m of n.menuInfo.menuItems || [])
|
|
386
|
+
for (const e of (m.menuEvent || []).flat())
|
|
387
|
+
e.events = e.events.map((v) => remapNativeAction(v, primary, target));
|
|
388
|
+
return n;
|
|
389
|
+
}
|
|
390
|
+
export function editEventSequence(root, edit, layout) {
|
|
391
|
+
object(edit, ['kind', 'action', 'parent', 'item', 'before', 'config']);
|
|
392
|
+
const find = (id) => {
|
|
393
|
+
const hits = [];
|
|
394
|
+
function walk(list) { list.forEach((n, index) => { if (n.id === id)
|
|
395
|
+
hits.push({ list, index }); if (n.events)
|
|
396
|
+
walk(n.events); if (n.menuInfo)
|
|
397
|
+
for (const m of n.menuInfo.menuItems || [])
|
|
398
|
+
for (const t of (m.menuEvent || []).flat())
|
|
399
|
+
walk(t.events); }); }
|
|
400
|
+
walk(root);
|
|
401
|
+
check(hits.length === 1, '动作/分支 ID 未唯一匹配');
|
|
402
|
+
return hits[0];
|
|
403
|
+
};
|
|
404
|
+
let list = root;
|
|
405
|
+
if (edit.parent) {
|
|
406
|
+
const p = find(edit.parent);
|
|
407
|
+
const node = p.list[p.index];
|
|
408
|
+
check(['IF', 'ELSEIF', 'ELSE'].includes(node.type), 'parent 必须是条件分支 ID');
|
|
409
|
+
node.events ||= [];
|
|
410
|
+
list = node.events;
|
|
411
|
+
}
|
|
412
|
+
const blockEnd = (rows, index) => { let end = index + 1; if (rows[index]?.type === 'IF')
|
|
413
|
+
while (['ELSEIF', 'ELSE'].includes(rows[end]?.type))
|
|
414
|
+
end++; return end; };
|
|
415
|
+
if (edit.kind === 'branch' && ['add', 'order'].includes(edit.action)) {
|
|
416
|
+
check(edit.parent, '分支新增/排序需 parent=IF ID');
|
|
417
|
+
const p = find(edit.parent);
|
|
418
|
+
check(p.list[p.index].type === 'IF', '分支组必须定位 IF');
|
|
419
|
+
const end = blockEnd(p.list, p.index);
|
|
420
|
+
if (edit.action === 'add') {
|
|
421
|
+
check(['ELSEIF', 'ELSE'].includes(edit.config?.type), '新增分支类型为 ELSEIF/ELSE');
|
|
422
|
+
const node = compileEventAction(edit.config, layout);
|
|
423
|
+
const elseIndex = p.list.findIndex((a, i) => i > p.index && i < end && a.type === 'ELSE');
|
|
424
|
+
let index = node.type === 'ELSE' ? end : (elseIndex < 0 ? end : elseIndex);
|
|
425
|
+
if (edit.before) {
|
|
426
|
+
index = p.list.findIndex((a) => a.id === edit.before);
|
|
427
|
+
check(index > p.index && index < end, 'before 必须是同组后续分支');
|
|
428
|
+
}
|
|
429
|
+
p.list.splice(index, 0, node);
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
const rows = p.list.slice(p.index, end);
|
|
433
|
+
const ids = edit.config;
|
|
434
|
+
check(Array.isArray(ids) && ids.length === rows.length && new Set(ids).size === ids.length && ids[0] === rows[0].id && ids.every((id) => rows.some((a) => a.id === id)), '分支排序需同组全部 ID,IF 在首位');
|
|
435
|
+
p.list.splice(p.index, rows.length, ...ids.map((id) => rows.find((a) => a.id === id)));
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
else if (edit.action === 'add') {
|
|
439
|
+
const nodes = compileEventSequence([edit.config], layout);
|
|
440
|
+
let index = list.length;
|
|
441
|
+
if (edit.before) {
|
|
442
|
+
index = list.findIndex((a) => a.id === edit.before);
|
|
443
|
+
check(index >= 0, 'before 不属于目标动作列表');
|
|
444
|
+
}
|
|
445
|
+
list.splice(index, 0, ...nodes);
|
|
446
|
+
}
|
|
447
|
+
else if (edit.action === 'order') {
|
|
448
|
+
const blocks = [];
|
|
449
|
+
for (let i = 0; i < list.length;) {
|
|
450
|
+
const end = blockEnd(list, i);
|
|
451
|
+
blocks.push(list.slice(i, end));
|
|
452
|
+
i = end;
|
|
453
|
+
}
|
|
454
|
+
const ids = edit.config;
|
|
455
|
+
check(Array.isArray(ids) && ids.length === blocks.length && new Set(ids).size === ids.length && ids.every((id) => blocks.some(a => a[0].id === id)), '排序提供该层全部普通动作/IF组首节点 ID;分支组整体移动');
|
|
456
|
+
list.splice(0, list.length, ...ids.flatMap((id) => blocks.find(a => a[0].id === id)));
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
const hit = find(edit.item);
|
|
460
|
+
if (edit.parent)
|
|
461
|
+
check(hit.list === list, '动作不属于指定父分支');
|
|
462
|
+
const old = hit.list[hit.index];
|
|
463
|
+
if (edit.kind === 'branch')
|
|
464
|
+
check(['IF', 'ELSEIF', 'ELSE'].includes(old.type), '目标不是条件分支');
|
|
465
|
+
if (edit.action === 'remove')
|
|
466
|
+
hit.list.splice(hit.index, blockEnd(hit.list, hit.index) - hit.index);
|
|
467
|
+
else if (edit.action === 'enable') {
|
|
468
|
+
check(typeof edit.config === 'boolean', '启停值需布尔值');
|
|
469
|
+
old.enable = edit.config;
|
|
470
|
+
}
|
|
471
|
+
else if (edit.action === 'update') {
|
|
472
|
+
check(edit.config?.type, '修改需要完整动作 type/config');
|
|
473
|
+
check(!(['ELSEIF', 'ELSE'].includes(old.type)) || edit.config.type === old.type, '分支修改不隐式改变分支类型');
|
|
474
|
+
const block = old.type === 'IF' && edit.config.config?.branches;
|
|
475
|
+
if (block) {
|
|
476
|
+
const nodes = compileEventSequence([{ ...edit.config, id: old.id }], layout);
|
|
477
|
+
hit.list.splice(hit.index, blockEnd(hit.list, hit.index) - hit.index, ...nodes);
|
|
478
|
+
}
|
|
479
|
+
else
|
|
480
|
+
hit.list[hit.index] = compileEventAction(edit.config, layout, old);
|
|
481
|
+
}
|
|
482
|
+
else
|
|
483
|
+
throw Error('动作操作无效');
|
|
484
|
+
}
|
|
485
|
+
validateEventSequence(root);
|
|
486
|
+
}
|
|
487
|
+
function prepareNativeActions(input, layout) {
|
|
488
|
+
validateEventSequence(input);
|
|
489
|
+
const rows = clone(input);
|
|
490
|
+
function walk(events) {
|
|
491
|
+
for (const a of events) {
|
|
492
|
+
if (['IF', 'ELSEIF'].includes(a.type) && a.conditionData?.conditionType === 'Rule')
|
|
493
|
+
validateNativeEventCondition(a.conditionData.conditions);
|
|
494
|
+
if (a.type === 'JsCode') {
|
|
495
|
+
check(typeof a.jsCode?.code === 'string', '原生 JS 需要 code');
|
|
496
|
+
a.jsCode.compiledCode = compileEventJs(a.jsCode.code);
|
|
497
|
+
}
|
|
498
|
+
if (a.type === 'RefreshComp') {
|
|
499
|
+
check(Array.isArray(a.refreshInfo?.selectedCom), '刷新目标需数组');
|
|
500
|
+
a.refreshInfo.selectedCom.forEach((id) => requireComp(layout, id));
|
|
501
|
+
}
|
|
502
|
+
if (a.type === 'ShowHideComponent') {
|
|
503
|
+
check(Array.isArray(a.displayComs), '显隐配置需数组');
|
|
504
|
+
a.displayComs.forEach((x) => requireComp(layout, x.id));
|
|
505
|
+
}
|
|
506
|
+
if (a.events)
|
|
507
|
+
walk(a.events);
|
|
508
|
+
if (a.menuInfo)
|
|
509
|
+
for (const m of a.menuInfo.menuItems || [])
|
|
510
|
+
for (const t of (m.menuEvent || []).flat())
|
|
511
|
+
walk(t.events);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
walk(rows);
|
|
515
|
+
return rows;
|
|
516
|
+
}
|
|
517
|
+
function assignInputIds(input) {
|
|
518
|
+
const n = clone(input);
|
|
519
|
+
if (!n || typeof n !== 'object')
|
|
520
|
+
return n;
|
|
521
|
+
if (Array.isArray(n))
|
|
522
|
+
return n;
|
|
523
|
+
if (n.type)
|
|
524
|
+
n.id ||= uid();
|
|
525
|
+
if (n.actions)
|
|
526
|
+
n.actions = n.actions.map(assignInputIds);
|
|
527
|
+
if (n.config?.branches)
|
|
528
|
+
for (const b of n.config.branches) {
|
|
529
|
+
b.id ||= uid();
|
|
530
|
+
if (b.actions)
|
|
531
|
+
b.actions = b.actions.map(assignInputIds);
|
|
532
|
+
}
|
|
533
|
+
if (n.type === 'ShowMenu')
|
|
534
|
+
for (const m of n.config.menuItems || []) {
|
|
535
|
+
m.id ||= uid();
|
|
536
|
+
if (m.action)
|
|
537
|
+
m.action = assignInputIds(m.action);
|
|
538
|
+
}
|
|
539
|
+
return n;
|
|
540
|
+
}
|
|
242
541
|
export function patchDesignerEvent(layouts, scope, terminal, trigger, operation, input) {
|
|
243
542
|
check(['pc', 'mobile', 'both'].includes(terminal), 'terminal 需 pc/mobile/both');
|
|
244
|
-
check(eventNames[trigger], '仅支持 CLICK/DIDMOUNT');
|
|
543
|
+
check(eventNames[trigger], '仅支持 CLICK/DIDMOUNT/CLICKDATA');
|
|
544
|
+
if (scope.collection === 'customPageButtons')
|
|
545
|
+
check(trigger === 'CLICK', '帮助按钮仅支持单击事件');
|
|
546
|
+
if (trigger === 'CLICKDATA')
|
|
547
|
+
check(scope.compId && !scope.collection && layouts.some(l => l.comps.some((c) => c.id === scope.compId && c.type === 'NList')), 'CLICKDATA 仅用于列表组件');
|
|
548
|
+
if (operation === 'set')
|
|
549
|
+
input = assignInputIds(input);
|
|
550
|
+
if (operation === 'edit' && ['add', 'update'].includes(input?.action))
|
|
551
|
+
input = { ...input, config: assignInputIds(input.config) };
|
|
245
552
|
const next = clone(layouts), primary = next.find((l) => l.terminalType === (terminal === 'mobile' ? 'MOBILE' : 'PC'));
|
|
246
553
|
check(primary, '缺少目标终端');
|
|
247
554
|
const targets = terminal === 'both' ? next.filter((l) => ['PC', 'MOBILE'].includes(l.terminalType)) : [primary];
|
|
@@ -257,15 +564,28 @@ export function patchDesignerEvent(layouts, scope, terminal, trigger, operation,
|
|
|
257
564
|
target.eventGroup = groups.map((g) => g.filter(e => e.type !== trigger)).filter((g) => g.length);
|
|
258
565
|
}
|
|
259
566
|
else if (operation === 'enable') {
|
|
260
|
-
check(hits.length === 1 && hits[0].events.length === 1, '
|
|
567
|
+
check(hits.length === 1 && hits[0].events.length === 1, '需唯一动作;多动作请按动作 ID 启停');
|
|
261
568
|
check(typeof input === 'boolean', '启停需布尔值');
|
|
262
569
|
hits[0].events[0].enable = input;
|
|
263
570
|
}
|
|
571
|
+
else if (operation === 'edit') {
|
|
572
|
+
check(hits.length === 1, '没有对应触发,请先整体设置动作列表');
|
|
573
|
+
const edit = clone(input);
|
|
574
|
+
if (layout.id !== primary.id && edit.config)
|
|
575
|
+
edit.config = remapAction(edit.config, primary, layout);
|
|
576
|
+
editEventSequence(hits[0].events, edit, layout);
|
|
577
|
+
hits[0].actionDesc = hits[0].events.map((a) => EVENT_ACTIONS[a.type]?.label || a.type).join(' → ');
|
|
578
|
+
}
|
|
264
579
|
else {
|
|
265
580
|
const actionInput = layout.id === primary.id ? input : remapAction(input, primary, layout);
|
|
266
581
|
const old = hits[0];
|
|
267
|
-
const
|
|
268
|
-
|
|
582
|
+
const batch = (actionInput.actions !== undefined || actionInput.nativeActions !== undefined) && actionInput.type === undefined;
|
|
583
|
+
if (batch)
|
|
584
|
+
object(actionInput, ['actions', 'nativeActions']);
|
|
585
|
+
check(!(actionInput.actions !== undefined && actionInput.nativeActions !== undefined), 'actions 与 nativeActions 二选一');
|
|
586
|
+
check(batch || !old || old.events.length <= 1, '已有多动作;请使用 {actions:[...]} 明确整体替换或按动作 ID 修改');
|
|
587
|
+
const actions = actionInput.nativeActions !== undefined ? prepareNativeActions(actionInput.nativeActions, layout) : batch ? compileEventSequence(actionInput.actions, layout) : [compileEventAction(actionInput, layout, old?.events[0])];
|
|
588
|
+
const entry = { ...(old || {}), id: old?.id || uid(), type: trigger, name: eventNames[trigger], disableDelete: old?.disableDelete ?? false, events: actions, actionDesc: actions.map((a) => EVENT_ACTIONS[a.type]?.label || a.type).join(' → ') };
|
|
269
589
|
if (old)
|
|
270
590
|
target.eventGroup = groups.map((g) => g.map(e => e.type === trigger ? entry : e));
|
|
271
591
|
else
|
|
@@ -288,14 +608,18 @@ export async function mutateDesignerEvent(client, base, pageId, scope, terminal,
|
|
|
288
608
|
const latestInfo = response(await client.get(infoUrl), '检查编辑状态');
|
|
289
609
|
check(latestInfo.allowEdit === true && !latestInfo.isLock, '页面编辑状态变化');
|
|
290
610
|
response(await client.post(`${base}/api/bs/ebuilder/designer/layout/save?pageId=${pageId}`, lzwCompress(JSON.stringify(after)), { 'content-type': 'application/json;charset=UTF-8', ebbusinessid: pageId }), '保存事件');
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
611
|
+
try {
|
|
612
|
+
const readback = await readSourceLayouts(client, base, pageId);
|
|
613
|
+
check(readback.length === after.length, '保存后布局集合变化');
|
|
614
|
+
for (const l of after) {
|
|
615
|
+
const actual = readback.find((x) => String(x.id) === String(l.id));
|
|
616
|
+
check(actual && same(savedComps(l.comps), savedComps(actual.comps)) && same(l.config, actual.config) && same(l.sourceCode, actual.sourceCode), '事件保存后回读不一致,请检查实际状态');
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
finally {
|
|
620
|
+
const unlock = await client.post(`${base}/api/bs/ebuilder/designer/layout/lock?pageId=${pageId}&isLock=false`, {});
|
|
621
|
+
check(unlock?.code === 200 && unlock.status === true, '事件已保存,但释放本次软锁失败');
|
|
622
|
+
}
|
|
299
623
|
return { saved: true, changed: true, pageId, terminal, trigger, scope };
|
|
300
624
|
}
|
|
301
625
|
export async function createRefreshCondition(client, base, compId, sqlWhere, apply) {
|