@jzg223/design-runtime 0.0.0-stage → 0.0.1
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/CHANGELOG.md +176 -0
- package/README.md +275 -2
- package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/api.js +149 -0
- package/dist/comb/design-comb.vue.js +7 -0
- package/dist/comb/design-comb2.vue.js +591 -0
- package/dist/compat.js +74 -0
- package/dist/components/ApiSwitch.vue.js +7 -0
- package/dist/components/ApiSwitch2.vue.js +98 -0
- package/dist/components/design-debug/dev-mode-toggle.vue.js +7 -0
- package/dist/components/design-debug/dev-mode-toggle2.vue.js +41 -0
- package/dist/components/design-debug/dev-mode.js +45 -0
- package/dist/components/design-debug/dev-state-button.vue.js +7 -0
- package/dist/components/design-debug/dev-state-button2.vue.js +447 -0
- package/dist/components/design-debug/expr-eval.js +81 -0
- package/dist/components/design-shared/host-api.js +47 -0
- package/dist/components/design-shared/popup-host.js +11 -0
- package/dist/components/design-table/design-table-inner.vue.js +7 -0
- package/dist/components/design-table/design-table-inner2.vue.js +39 -0
- package/dist/components/design-table/design-table.vue.js +7 -0
- package/dist/components/design-table/design-table2.vue.js +937 -0
- package/dist/components/design-table/row-actions/delete-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/delete-action2.vue.js +42 -0
- package/dist/components/design-table/row-actions/edit-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/edit-action2.vue.js +145 -0
- package/dist/components/design-table/row-actions/index.js +36 -0
- package/dist/components/design-table/row-actions/modal-comb-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-comb-action2.vue.js +66 -0
- package/dist/components/design-table/row-actions/modal-custom-action.vue.js +7 -0
- package/dist/components/design-table/row-actions/modal-custom-action2.vue.js +105 -0
- package/dist/components/design-table/row-actions/modal-form-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-form-action2.vue.js +82 -0
- package/dist/components/design-table/row-actions/modal-table-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-table-action2.vue.js +67 -0
- package/dist/components/design-table/row-actions/modal-tree-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-tree-action2.vue.js +70 -0
- package/dist/components/design-table/row-actions/navigate-comb-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-comb-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/navigate-form-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-form-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/navigate-table-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-table-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/navigate-tree-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-tree-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/other-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/other-action2.vue.js +44 -0
- package/dist/components/design-tools/add-tool.vue.js +4 -0
- package/dist/components/design-tools/add-tool2.vue.js +136 -0
- package/dist/components/design-tools/command-executor.js +135 -0
- package/dist/components/design-tools/export-tool.vue.js +4 -0
- package/dist/components/design-tools/export-tool2.vue.js +46 -0
- package/dist/components/design-tools/import-tool.vue.js +4 -0
- package/dist/components/design-tools/import-tool2.vue.js +101 -0
- package/dist/components/design-tools/index.js +36 -0
- package/dist/components/design-tools/modal-comb-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-comb-tool2.vue.js +56 -0
- package/dist/components/design-tools/modal-form-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-form-tool2.vue.js +66 -0
- package/dist/components/design-tools/modal-hcm-tool.vue.js +7 -0
- package/dist/components/design-tools/modal-hcm-tool2.vue.js +85 -0
- package/dist/components/design-tools/modal-table-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-table-tool2.vue.js +54 -0
- package/dist/components/design-tools/modal-tree-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-tree-tool2.vue.js +57 -0
- package/dist/components/design-tools/navigate-comb-tool.vue.js +4 -0
- package/dist/components/design-tools/navigate-comb-tool2.vue.js +34 -0
- package/dist/components/design-tools/navigate-form-tool.vue.js +4 -0
- package/dist/components/design-tools/navigate-form-tool2.vue.js +34 -0
- package/dist/components/design-tools/navigate-table-tool.vue.js +4 -0
- package/dist/components/design-tools/navigate-table-tool2.vue.js +33 -0
- package/dist/components/design-tools/other-tool.vue.js +4 -0
- package/dist/components/design-tools/other-tool2.vue.js +34 -0
- package/dist/components/flow-status-cell/flow-status-cell.vue.js +7 -0
- package/dist/components/flow-status-cell/flow-status-cell2.vue.js +124 -0
- package/dist/flow.js +22 -0
- package/dist/form/cell-condition.js +122 -0
- package/dist/form/derived-express.js +34 -0
- package/dist/form/design-form-inner.vue.js +7 -0
- package/dist/form/design-form-inner2.vue.js +449 -0
- package/dist/form/design-form.vue.js +7 -0
- package/dist/form/design-form2.vue.js +681 -0
- package/dist/form/fields/checkbox-field.vue.js +88 -0
- package/dist/form/fields/checkbox-field2.vue.js +4 -0
- package/dist/form/fields/custom-field.vue.js +36 -0
- package/dist/form/fields/custom-field2.vue.js +4 -0
- package/dist/form/fields/date-field.vue.js +64 -0
- package/dist/form/fields/date-field2.vue.js +4 -0
- package/dist/form/fields/embedded-list-field.vue.js +7 -0
- package/dist/form/fields/embedded-list-field2.vue.js +437 -0
- package/dist/form/fields/file-field.vue.js +88 -0
- package/dist/form/fields/file-field2.vue.js +4 -0
- package/dist/form/fields/image-field.vue.js +90 -0
- package/dist/form/fields/image-field2.vue.js +4 -0
- package/dist/form/fields/index.js +106 -0
- package/dist/form/fields/month-field.vue.js +51 -0
- package/dist/form/fields/month-field2.vue.js +4 -0
- package/dist/form/fields/org-select-field.vue.js +7 -0
- package/dist/form/fields/org-select-field2.vue.js +187 -0
- package/dist/form/fields/orgs-select-field.vue.js +182 -0
- package/dist/form/fields/orgs-select-field2.vue.js +4 -0
- package/dist/form/fields/radio-field.vue.js +91 -0
- package/dist/form/fields/radio-field2.vue.js +4 -0
- package/dist/form/fields/select-field.vue.js +7 -0
- package/dist/form/fields/select-field2.vue.js +317 -0
- package/dist/form/fields/splitline-field.vue.js +7 -0
- package/dist/form/fields/splitline-field2.vue.js +50 -0
- package/dist/form/fields/switch-field.vue.js +32 -0
- package/dist/form/fields/switch-field2.vue.js +4 -0
- package/dist/form/fields/text-field.vue.js +78 -0
- package/dist/form/fields/text-field2.vue.js +4 -0
- package/dist/form/fields/time-field.vue.js +50 -0
- package/dist/form/fields/time-field2.vue.js +4 -0
- package/dist/form/fields/tree-field.vue.js +157 -0
- package/dist/form/fields/tree-field2.vue.js +4 -0
- package/dist/form/number-precision.js +18 -0
- package/dist/form/transformer.js +162 -0
- package/dist/host.js +76 -0
- package/dist/http.js +19 -0
- package/dist/index.js +166 -0
- package/dist/mapping.js +44 -0
- package/dist/org/dept-api.js +30 -0
- package/dist/org/dept-tree-source.js +53 -0
- package/dist/org/dept-tree.js +122 -0
- package/dist/registry.js +77 -0
- package/dist/search/design-search.vue.js +7 -0
- package/dist/search/design-search2.vue.js +232 -0
- package/dist/search/transformer.js +115 -0
- package/dist/style.css +1220 -0
- package/dist/table/data.js +18 -0
- package/dist/table/load-gate.js +19 -0
- package/dist/table/query-body.js +59 -0
- package/dist/table/query-dedupe.js +54 -0
- package/dist/table/query-search.js +9 -0
- package/dist/table/row-action-mapping.js +34 -0
- package/dist/table/transformer.js +328 -0
- package/dist/tree/design-tree.vue.js +7 -0
- package/dist/tree/design-tree2.vue.js +783 -0
- package/dist/types/api.d.ts +83 -0
- package/dist/types/comb/design-comb.vue.d.ts +38 -0
- package/dist/types/compat.d.ts +46 -0
- package/dist/types/components/ApiSwitch.vue.d.ts +31 -0
- package/dist/types/components/design-debug/dev-mode-toggle.vue.d.ts +2 -0
- package/dist/types/components/design-debug/dev-mode.d.ts +8 -0
- package/dist/types/components/design-debug/dev-state-button.vue.d.ts +55 -0
- package/dist/types/components/design-debug/expr-eval.d.ts +55 -0
- package/dist/types/components/design-shared/host-api.d.ts +60 -0
- package/dist/types/components/design-shared/popup-host.d.ts +13 -0
- package/dist/types/components/design-table/design-table-inner.vue.d.ts +19 -0
- package/dist/types/components/design-table/design-table.vue.d.ts +70 -0
- package/dist/types/components/design-table/row-actions/delete-action.vue.d.ts +12 -0
- package/dist/types/components/design-table/row-actions/edit-action.vue.d.ts +14 -0
- package/dist/types/components/design-table/row-actions/index.d.ts +25 -0
- package/dist/types/components/design-table/row-actions/modal-comb-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/modal-custom-action.vue.d.ts +15 -0
- package/dist/types/components/design-table/row-actions/modal-form-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/modal-table-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/modal-tree-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-comb-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-form-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-table-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-tree-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/other-action.vue.d.ts +14 -0
- package/dist/types/components/design-tools/add-tool.vue.d.ts +23 -0
- package/dist/types/components/design-tools/command-executor.d.ts +80 -0
- package/dist/types/components/design-tools/export-tool.vue.d.ts +9 -0
- package/dist/types/components/design-tools/import-tool.vue.d.ts +14 -0
- package/dist/types/components/design-tools/index.d.ts +23 -0
- package/dist/types/components/design-tools/modal-comb-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/modal-form-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/modal-hcm-tool.vue.d.ts +23 -0
- package/dist/types/components/design-tools/modal-table-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/modal-tree-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/navigate-comb-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/navigate-form-tool.vue.d.ts +11 -0
- package/dist/types/components/design-tools/navigate-table-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/other-tool.vue.d.ts +16 -0
- package/dist/types/components/flow-status-cell/flow-status-cell.vue.d.ts +14 -0
- package/dist/types/components/index.d.ts +33 -0
- package/dist/types/flow.d.ts +50 -0
- package/dist/types/form/cell-condition.d.ts +35 -0
- package/dist/types/form/derived-express.d.ts +28 -0
- package/dist/types/form/design-form-inner.vue.d.ts +55 -0
- package/dist/types/form/design-form.vue.d.ts +96 -0
- package/dist/types/form/fields/checkbox-field.vue.d.ts +14 -0
- package/dist/types/form/fields/custom-field.vue.d.ts +22 -0
- package/dist/types/form/fields/date-field.vue.d.ts +12 -0
- package/dist/types/form/fields/embedded-list-field.vue.d.ts +26 -0
- package/dist/types/form/fields/file-field.vue.d.ts +12 -0
- package/dist/types/form/fields/image-field.vue.d.ts +12 -0
- package/dist/types/form/fields/index.d.ts +34 -0
- package/dist/types/form/fields/month-field.vue.d.ts +12 -0
- package/dist/types/form/fields/org-select-field.vue.d.ts +14 -0
- package/dist/types/form/fields/orgs-select-field.vue.d.ts +12 -0
- package/dist/types/form/fields/radio-field.vue.d.ts +14 -0
- package/dist/types/form/fields/select-field.vue.d.ts +14 -0
- package/dist/types/form/fields/splitline-field.vue.d.ts +7 -0
- package/dist/types/form/fields/switch-field.vue.d.ts +12 -0
- package/dist/types/form/fields/text-field.vue.d.ts +12 -0
- package/dist/types/form/fields/time-field.vue.d.ts +12 -0
- package/dist/types/form/fields/tree-field.vue.d.ts +12 -0
- package/dist/types/form/number-precision.d.ts +15 -0
- package/dist/types/form/transformer.d.ts +27 -0
- package/dist/types/host.d.ts +182 -0
- package/dist/types/http.d.ts +59 -0
- package/dist/types/index.d.ts +41 -0
- package/dist/types/mapping.d.ts +39 -0
- package/dist/types/org/dept-api.d.ts +12 -0
- package/dist/types/org/dept-tree-source.d.ts +15 -0
- package/dist/types/org/dept-tree.d.ts +62 -0
- package/dist/types/registry.d.ts +79 -0
- package/dist/types/search/design-search.vue.d.ts +46 -0
- package/dist/types/search/transformer.d.ts +36 -0
- package/dist/types/table/data.d.ts +30 -0
- package/dist/types/table/index.d.ts +20 -0
- package/dist/types/table/load-gate.d.ts +24 -0
- package/dist/types/table/query-body.d.ts +46 -0
- package/dist/types/table/query-dedupe.d.ts +42 -0
- package/dist/types/table/query-search.d.ts +21 -0
- package/dist/types/table/row-action-mapping.d.ts +36 -0
- package/dist/types/table/transformer.d.ts +59 -0
- package/dist/types/tree/design-tree.vue.d.ts +33 -0
- package/dist/types/types.d.ts +525 -0
- package/dist/types/utils/default-value.d.ts +16 -0
- package/dist/types/utils/download.d.ts +9 -0
- package/dist/types/utils/popup-width.d.ts +21 -0
- package/dist/utils/default-value.js +38 -0
- package/dist/utils/download.js +19 -0
- package/dist/utils/popup-width.js +19 -0
- package/package.json +73 -4
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, openBlock, createBlock, unref, withCtx, createVNode, createTextVNode, toDisplayString, createCommentVNode, createElementBlock } from "vue";
|
|
2
|
+
import { Space, Tag, Popconfirm, Button } from "antdv-next";
|
|
3
|
+
import { getHostWorkflow } from "../../host.js";
|
|
4
|
+
const _hoisted_1 = {
|
|
5
|
+
key: 1,
|
|
6
|
+
class: "design-platform-muted"
|
|
7
|
+
};
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
...{ name: "DesignTableFlowStatusCell" },
|
|
10
|
+
__name: "flow-status-cell",
|
|
11
|
+
props: {
|
|
12
|
+
flowMap: {},
|
|
13
|
+
pfield: {},
|
|
14
|
+
row: {}
|
|
15
|
+
},
|
|
16
|
+
emits: ["changed"],
|
|
17
|
+
setup(__props, { emit: __emit }) {
|
|
18
|
+
let warnedMissingCancel = false;
|
|
19
|
+
const props = __props;
|
|
20
|
+
const emit = __emit;
|
|
21
|
+
const businessId = computed(() => {
|
|
22
|
+
var _a;
|
|
23
|
+
const v = (_a = props.row) == null ? void 0 : _a[props.pfield ?? "id"];
|
|
24
|
+
return v === void 0 || v === null ? "" : String(v);
|
|
25
|
+
});
|
|
26
|
+
const flow = computed(() => {
|
|
27
|
+
const id = businessId.value;
|
|
28
|
+
return id && props.flowMap ? props.flowMap[id] : void 0;
|
|
29
|
+
});
|
|
30
|
+
function statusColor(status) {
|
|
31
|
+
switch (status) {
|
|
32
|
+
case "waiting":
|
|
33
|
+
return "processing";
|
|
34
|
+
case "finish":
|
|
35
|
+
return "success";
|
|
36
|
+
case "back":
|
|
37
|
+
return "orange";
|
|
38
|
+
case "cancel":
|
|
39
|
+
return "default";
|
|
40
|
+
case "invalid":
|
|
41
|
+
case "termination":
|
|
42
|
+
return "red";
|
|
43
|
+
case "draft":
|
|
44
|
+
return "default";
|
|
45
|
+
default:
|
|
46
|
+
return "default";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const canCancel = computed(
|
|
50
|
+
() => typeof getHostWorkflow().cancelProcessApply === "function"
|
|
51
|
+
);
|
|
52
|
+
const showCancel = computed(
|
|
53
|
+
() => {
|
|
54
|
+
var _a;
|
|
55
|
+
return ((_a = flow.value) == null ? void 0 : _a.status) === "waiting" && canCancel.value;
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
const cancelling = ref(false);
|
|
59
|
+
async function handleCancel() {
|
|
60
|
+
const id = businessId.value;
|
|
61
|
+
if (!id || cancelling.value) return;
|
|
62
|
+
const { cancelProcessApply } = getHostWorkflow();
|
|
63
|
+
if (!cancelProcessApply) {
|
|
64
|
+
if (!warnedMissingCancel) {
|
|
65
|
+
warnedMissingCancel = true;
|
|
66
|
+
console.warn(
|
|
67
|
+
"[design-runtime] 未注入 host.workflow.cancelProcessApply:流程状态列的「撤销」按钮已隐藏。请在 installDesignPlatform({ workflow: { cancelProcessApply } }) 里注入(宿主用 #/api/workflow/instance 的实现即可)"
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
cancelling.value = true;
|
|
73
|
+
try {
|
|
74
|
+
await cancelProcessApply({ businessId: id, message: "申请人撤销流程!" });
|
|
75
|
+
emit("changed");
|
|
76
|
+
} catch (err) {
|
|
77
|
+
console.error("撤销流程失败:", (err == null ? void 0 : err.message) ?? err);
|
|
78
|
+
} finally {
|
|
79
|
+
cancelling.value = false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return (_ctx, _cache) => {
|
|
83
|
+
return flow.value ? (openBlock(), createBlock(unref(Space), {
|
|
84
|
+
key: 0,
|
|
85
|
+
class: "dr-flow-status",
|
|
86
|
+
size: "small"
|
|
87
|
+
}, {
|
|
88
|
+
default: withCtx(() => [
|
|
89
|
+
createVNode(unref(Tag), {
|
|
90
|
+
color: statusColor(flow.value.status)
|
|
91
|
+
}, {
|
|
92
|
+
default: withCtx(() => [
|
|
93
|
+
createTextVNode(toDisplayString(flow.value.statusName || flow.value.status), 1)
|
|
94
|
+
]),
|
|
95
|
+
_: 1
|
|
96
|
+
}, 8, ["color"]),
|
|
97
|
+
showCancel.value ? (openBlock(), createBlock(unref(Popconfirm), {
|
|
98
|
+
key: 0,
|
|
99
|
+
title: "确认撤销该流程?",
|
|
100
|
+
onConfirm: handleCancel
|
|
101
|
+
}, {
|
|
102
|
+
default: withCtx(() => [
|
|
103
|
+
createVNode(unref(Button), {
|
|
104
|
+
size: "small",
|
|
105
|
+
type: "link",
|
|
106
|
+
loading: cancelling.value
|
|
107
|
+
}, {
|
|
108
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
109
|
+
createTextVNode("撤销", -1)
|
|
110
|
+
])]),
|
|
111
|
+
_: 1
|
|
112
|
+
}, 8, ["loading"])
|
|
113
|
+
]),
|
|
114
|
+
_: 1
|
|
115
|
+
})) : createCommentVNode("", true)
|
|
116
|
+
]),
|
|
117
|
+
_: 1
|
|
118
|
+
})) : (openBlock(), createElementBlock("span", _hoisted_1, "—"));
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
export {
|
|
123
|
+
_sfc_main as default
|
|
124
|
+
};
|
package/dist/flow.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { requireHttp } from "./host.js";
|
|
2
|
+
function designFlowSubmit(body) {
|
|
3
|
+
return requireHttp().post(
|
|
4
|
+
"/design/flowData/submit",
|
|
5
|
+
body
|
|
6
|
+
);
|
|
7
|
+
}
|
|
8
|
+
function designFlowStatus(body) {
|
|
9
|
+
return requireHttp().post(
|
|
10
|
+
"/design/flowData/status",
|
|
11
|
+
body,
|
|
12
|
+
{ silent: true }
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
function designFlowRemove(body) {
|
|
16
|
+
return requireHttp().post("/design/flowData/remove", body);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
designFlowRemove,
|
|
20
|
+
designFlowStatus,
|
|
21
|
+
designFlowSubmit
|
|
22
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const IDENTIFIER_RE = /^[A-Za-z_$][\w$]*$/;
|
|
2
|
+
const RESERVED_WORDS = /* @__PURE__ */ new Set([
|
|
3
|
+
"arguments",
|
|
4
|
+
"await",
|
|
5
|
+
"break",
|
|
6
|
+
"case",
|
|
7
|
+
"catch",
|
|
8
|
+
"class",
|
|
9
|
+
"const",
|
|
10
|
+
"continue",
|
|
11
|
+
"debugger",
|
|
12
|
+
"default",
|
|
13
|
+
"delete",
|
|
14
|
+
"do",
|
|
15
|
+
"else",
|
|
16
|
+
"enum",
|
|
17
|
+
"eval",
|
|
18
|
+
"export",
|
|
19
|
+
"extends",
|
|
20
|
+
"false",
|
|
21
|
+
"finally",
|
|
22
|
+
"for",
|
|
23
|
+
"function",
|
|
24
|
+
"if",
|
|
25
|
+
"implements",
|
|
26
|
+
"import",
|
|
27
|
+
"in",
|
|
28
|
+
"instanceof",
|
|
29
|
+
"interface",
|
|
30
|
+
"let",
|
|
31
|
+
"new",
|
|
32
|
+
"null",
|
|
33
|
+
"package",
|
|
34
|
+
"private",
|
|
35
|
+
"protected",
|
|
36
|
+
"public",
|
|
37
|
+
"return",
|
|
38
|
+
"static",
|
|
39
|
+
"super",
|
|
40
|
+
"switch",
|
|
41
|
+
"this",
|
|
42
|
+
"throw",
|
|
43
|
+
"true",
|
|
44
|
+
"try",
|
|
45
|
+
"typeof",
|
|
46
|
+
"var",
|
|
47
|
+
"void",
|
|
48
|
+
"while",
|
|
49
|
+
"with",
|
|
50
|
+
"yield"
|
|
51
|
+
]);
|
|
52
|
+
function isInjectableScopeKey(key) {
|
|
53
|
+
return IDENTIFIER_RE.test(key) && !RESERVED_WORDS.has(key);
|
|
54
|
+
}
|
|
55
|
+
function buildConditionScope(derivedValues) {
|
|
56
|
+
const values = derivedValues ?? {};
|
|
57
|
+
return { ...values, derivedValues: values };
|
|
58
|
+
}
|
|
59
|
+
const PASS = { render: true, show: true };
|
|
60
|
+
const warnedExpressions = /* @__PURE__ */ new Set();
|
|
61
|
+
function evalTruthy(expression, scope) {
|
|
62
|
+
const source = expression == null ? void 0 : expression.trim();
|
|
63
|
+
if (!source) return { pass: true };
|
|
64
|
+
const keys = Object.keys(scope).filter(isInjectableScopeKey);
|
|
65
|
+
try {
|
|
66
|
+
const fn = new Function(...keys, `return (${source});`);
|
|
67
|
+
return { pass: Boolean(fn(...keys.map((key) => scope[key]))) };
|
|
68
|
+
} catch (err) {
|
|
69
|
+
const message = (err == null ? void 0 : err.message) ?? String(err);
|
|
70
|
+
if (!warnedExpressions.has(source)) {
|
|
71
|
+
warnedExpressions.add(source);
|
|
72
|
+
console.warn(
|
|
73
|
+
`[design-runtime] 条件表达式求值失败(按「不隐藏」处理):${source} —— ${message}`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return { pass: true, error: message };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function evalCellCondition(cell, scope) {
|
|
80
|
+
if (!cell) return PASS;
|
|
81
|
+
const render = evalTruthy(cell.vif, scope);
|
|
82
|
+
const show = evalTruthy(cell.vshow, scope);
|
|
83
|
+
const error = [render.error, show.error].filter(Boolean).join(" / ");
|
|
84
|
+
if (render.pass && show.pass && !error) return PASS;
|
|
85
|
+
return {
|
|
86
|
+
render: render.pass,
|
|
87
|
+
show: show.pass,
|
|
88
|
+
...error ? { error } : {}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function isConditionHidden(result) {
|
|
92
|
+
return !result.render || !result.show;
|
|
93
|
+
}
|
|
94
|
+
function computeConditionDebug(cells, scope) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
const items = [];
|
|
97
|
+
for (const cell of cells ?? []) {
|
|
98
|
+
const vif = (_a = cell == null ? void 0 : cell.vif) == null ? void 0 : _a.trim();
|
|
99
|
+
const vshow = (_b = cell == null ? void 0 : cell.vshow) == null ? void 0 : _b.trim();
|
|
100
|
+
if (!vif && !vshow) continue;
|
|
101
|
+
const result = evalCellCondition(cell, scope);
|
|
102
|
+
items.push({
|
|
103
|
+
row: cell.row,
|
|
104
|
+
col: cell.col,
|
|
105
|
+
name: cell.name,
|
|
106
|
+
title: cell.title,
|
|
107
|
+
vif,
|
|
108
|
+
vshow,
|
|
109
|
+
render: result.render,
|
|
110
|
+
show: result.show,
|
|
111
|
+
...result.error ? { error: result.error } : {}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return items;
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
buildConditionScope,
|
|
118
|
+
computeConditionDebug,
|
|
119
|
+
evalCellCondition,
|
|
120
|
+
isConditionHidden,
|
|
121
|
+
isInjectableScopeKey
|
|
122
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { evaluateMappedExpress } from "../mapping.js";
|
|
2
|
+
function buildDerivedScope(formData, derivedValues) {
|
|
3
|
+
return { ...formData, ...derivedValues, formData, derivedValues };
|
|
4
|
+
}
|
|
5
|
+
function isEmptyVal(v) {
|
|
6
|
+
return v === void 0 || v === null || v === "";
|
|
7
|
+
}
|
|
8
|
+
function evalDerivedExpress(cell, formData, derivedValues) {
|
|
9
|
+
var _a;
|
|
10
|
+
const expr = (_a = cell == null ? void 0 : cell.derivedExpress) == null ? void 0 : _a.trim();
|
|
11
|
+
if (!expr) return void 0;
|
|
12
|
+
const val = evaluateMappedExpress(expr, buildDerivedScope(formData, derivedValues));
|
|
13
|
+
if (val === void 0 || val === null) return void 0;
|
|
14
|
+
return val;
|
|
15
|
+
}
|
|
16
|
+
function computeDerivedFills(cells, formData, derivedValues) {
|
|
17
|
+
var _a;
|
|
18
|
+
const fills = [];
|
|
19
|
+
for (const cell of cells ?? []) {
|
|
20
|
+
const name = cell == null ? void 0 : cell.name;
|
|
21
|
+
if (!name || !((_a = cell == null ? void 0 : cell.derivedExpress) == null ? void 0 : _a.trim())) continue;
|
|
22
|
+
const val = evalDerivedExpress(cell, formData, derivedValues);
|
|
23
|
+
if (val === void 0) continue;
|
|
24
|
+
const cur = formData[name];
|
|
25
|
+
if (cur === val || isEmptyVal(cur) && isEmptyVal(val)) continue;
|
|
26
|
+
fills.push({ name, value: val });
|
|
27
|
+
}
|
|
28
|
+
return fills;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
buildDerivedScope,
|
|
32
|
+
computeDerivedFills,
|
|
33
|
+
evalDerivedExpress
|
|
34
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./design-form-inner2.vue.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const DesignFormInner = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-52abdc9f"]]);
|
|
5
|
+
export {
|
|
6
|
+
DesignFormInner as default
|
|
7
|
+
};
|