@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,32 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref } from "vue";
|
|
2
|
+
import { Switch } from "antdv-next";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "switch-field",
|
|
5
|
+
props: {
|
|
6
|
+
cell: {},
|
|
7
|
+
disabled: { type: Boolean },
|
|
8
|
+
modelValue: {}
|
|
9
|
+
},
|
|
10
|
+
emits: ["update:modelValue"],
|
|
11
|
+
setup(__props, { emit: __emit }) {
|
|
12
|
+
const props = __props;
|
|
13
|
+
const emit = __emit;
|
|
14
|
+
const isDisabled = computed(
|
|
15
|
+
() => props.disabled || props.cell.readonly === "2"
|
|
16
|
+
);
|
|
17
|
+
const checked = computed({
|
|
18
|
+
get: () => props.modelValue !== "0" && props.modelValue !== 0 && props.modelValue !== false && !!props.modelValue,
|
|
19
|
+
set: (val) => emit("update:modelValue", val ? 1 : 0)
|
|
20
|
+
});
|
|
21
|
+
return (_ctx, _cache) => {
|
|
22
|
+
return openBlock(), createBlock(unref(Switch), {
|
|
23
|
+
checked: checked.value,
|
|
24
|
+
"onUpdate:checked": _cache[0] || (_cache[0] = ($event) => checked.value = $event),
|
|
25
|
+
disabled: isDisabled.value
|
|
26
|
+
}, null, 8, ["checked", "disabled"]);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
_sfc_main as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref } from "vue";
|
|
2
|
+
import { TextArea, InputNumber, InputPassword, Input } from "antdv-next";
|
|
3
|
+
import { parsePrecision, roundToPrecision } from "../number-precision.js";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "text-field",
|
|
6
|
+
props: {
|
|
7
|
+
cell: {},
|
|
8
|
+
disabled: { type: Boolean },
|
|
9
|
+
modelValue: {}
|
|
10
|
+
},
|
|
11
|
+
emits: ["update:modelValue"],
|
|
12
|
+
setup(__props, { emit: __emit }) {
|
|
13
|
+
const props = __props;
|
|
14
|
+
const emit = __emit;
|
|
15
|
+
const value = computed({
|
|
16
|
+
get: () => props.modelValue,
|
|
17
|
+
set: (val) => emit("update:modelValue", val)
|
|
18
|
+
});
|
|
19
|
+
const isDisabled = computed(
|
|
20
|
+
() => props.disabled || props.cell.readonly === "2"
|
|
21
|
+
);
|
|
22
|
+
const precision = computed(
|
|
23
|
+
() => parsePrecision(props.cell.decimalLen)
|
|
24
|
+
);
|
|
25
|
+
function onNumberInput(text) {
|
|
26
|
+
if (text === "" || text === null || text === void 0) {
|
|
27
|
+
emit("update:modelValue", void 0);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const num = Number(text);
|
|
31
|
+
if (Number.isNaN(num)) {
|
|
32
|
+
emit("update:modelValue", text);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
emit("update:modelValue", roundToPrecision(num, precision.value));
|
|
36
|
+
}
|
|
37
|
+
return (_ctx, _cache) => {
|
|
38
|
+
return __props.cell.text_type === "textarea" ? (openBlock(), createBlock(unref(TextArea), {
|
|
39
|
+
key: 0,
|
|
40
|
+
value: value.value,
|
|
41
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
42
|
+
disabled: isDisabled.value,
|
|
43
|
+
placeholder: `请输入${__props.cell.title}`,
|
|
44
|
+
"auto-size": { minRows: 3, maxRows: 6 }
|
|
45
|
+
}, null, 8, ["value", "disabled", "placeholder"])) : __props.cell.text_type === "number" ? (openBlock(), createBlock(unref(InputNumber), {
|
|
46
|
+
key: 1,
|
|
47
|
+
value: value.value,
|
|
48
|
+
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => value.value = $event),
|
|
49
|
+
disabled: isDisabled.value,
|
|
50
|
+
precision: precision.value,
|
|
51
|
+
"addon-after": __props.cell.after,
|
|
52
|
+
"addon-before": __props.cell.before,
|
|
53
|
+
placeholder: `请输入${__props.cell.title}`,
|
|
54
|
+
style: { "width": "100%" },
|
|
55
|
+
onInput: onNumberInput
|
|
56
|
+
}, null, 8, ["value", "disabled", "precision", "addon-after", "addon-before", "placeholder"])) : __props.cell.text_type === "password" ? (openBlock(), createBlock(unref(InputPassword), {
|
|
57
|
+
key: 2,
|
|
58
|
+
value: value.value,
|
|
59
|
+
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => value.value = $event),
|
|
60
|
+
disabled: isDisabled.value,
|
|
61
|
+
"addon-after": __props.cell.after,
|
|
62
|
+
"addon-before": __props.cell.before,
|
|
63
|
+
placeholder: `请输入${__props.cell.title}`
|
|
64
|
+
}, null, 8, ["value", "disabled", "addon-after", "addon-before", "placeholder"])) : (openBlock(), createBlock(unref(Input), {
|
|
65
|
+
key: 3,
|
|
66
|
+
value: value.value,
|
|
67
|
+
"onUpdate:value": _cache[3] || (_cache[3] = ($event) => value.value = $event),
|
|
68
|
+
disabled: isDisabled.value,
|
|
69
|
+
"addon-after": __props.cell.after,
|
|
70
|
+
"addon-before": __props.cell.before,
|
|
71
|
+
placeholder: `请输入${__props.cell.title}`
|
|
72
|
+
}, null, 8, ["value", "disabled", "addon-after", "addon-before", "placeholder"]));
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
_sfc_main as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { defineComponent, watch, computed, openBlock, createBlock, unref } from "vue";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import { DatePicker } from "antdv-next";
|
|
4
|
+
const dateFormat = "YYYY-MM-DD HH:mm:ss";
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "time-field",
|
|
7
|
+
props: {
|
|
8
|
+
cell: {},
|
|
9
|
+
disabled: { type: Boolean },
|
|
10
|
+
modelValue: {}
|
|
11
|
+
},
|
|
12
|
+
emits: ["update:modelValue"],
|
|
13
|
+
setup(__props, { emit: __emit }) {
|
|
14
|
+
const props = __props;
|
|
15
|
+
const emit = __emit;
|
|
16
|
+
watch(
|
|
17
|
+
() => props.modelValue,
|
|
18
|
+
(val) => {
|
|
19
|
+
if (typeof val === "string" && val.includes("T") && dayjs(val).isValid()) {
|
|
20
|
+
const normalized = dayjs(val).format(dateFormat);
|
|
21
|
+
if (normalized !== val) {
|
|
22
|
+
emit("update:modelValue", normalized);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{ immediate: true }
|
|
27
|
+
);
|
|
28
|
+
const value = computed({
|
|
29
|
+
get: () => props.modelValue,
|
|
30
|
+
set: (val) => emit("update:modelValue", val)
|
|
31
|
+
});
|
|
32
|
+
const isDisabled = computed(
|
|
33
|
+
() => props.disabled || props.cell.readonly === "2"
|
|
34
|
+
);
|
|
35
|
+
return (_ctx, _cache) => {
|
|
36
|
+
return openBlock(), createBlock(unref(DatePicker), {
|
|
37
|
+
value: value.value,
|
|
38
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
39
|
+
disabled: isDisabled.value,
|
|
40
|
+
"show-time": "",
|
|
41
|
+
"value-format": "YYYY-MM-DD HH:mm:ss",
|
|
42
|
+
placeholder: "请选择时间",
|
|
43
|
+
style: { "width": "100%" }
|
|
44
|
+
}, null, 8, ["value", "disabled"]);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
export {
|
|
49
|
+
_sfc_main as default
|
|
50
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, normalizeStyle, createBlock } from "vue";
|
|
2
|
+
import { Input, Modal, Spin, Empty, Table } from "antdv-next";
|
|
3
|
+
import { SearchOutlined } from "@antdv-next/icons";
|
|
4
|
+
const _hoisted_1 = { style: { "width": "100%" } };
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "tree-field",
|
|
7
|
+
props: {
|
|
8
|
+
cell: {},
|
|
9
|
+
disabled: { type: Boolean },
|
|
10
|
+
modelValue: {}
|
|
11
|
+
},
|
|
12
|
+
emits: ["update:modelValue"],
|
|
13
|
+
setup(__props, { emit: __emit }) {
|
|
14
|
+
const props = __props;
|
|
15
|
+
const emit = __emit;
|
|
16
|
+
const isDisabled = computed(
|
|
17
|
+
() => props.disabled || props.cell.readonly === "2"
|
|
18
|
+
);
|
|
19
|
+
const modalVisible = ref(false);
|
|
20
|
+
const searchValue = ref("");
|
|
21
|
+
const expandedRowKeys = ref([]);
|
|
22
|
+
const selectedRowKeys = ref([]);
|
|
23
|
+
const selectedNode = ref(null);
|
|
24
|
+
const displayText = ref("");
|
|
25
|
+
const loading = ref(false);
|
|
26
|
+
const dataSource = ref([]);
|
|
27
|
+
const dataList = ref([]);
|
|
28
|
+
const columns = [
|
|
29
|
+
{ title: "编号", dataIndex: "code", key: "code", width: "30%" },
|
|
30
|
+
{ title: "名称", dataIndex: "name", key: "name", width: "70%" }
|
|
31
|
+
];
|
|
32
|
+
const tableData = computed(() => {
|
|
33
|
+
if (!searchValue.value) return dataSource.value;
|
|
34
|
+
return dataList.value.filter((item) => {
|
|
35
|
+
const name = item.name || item.label || "";
|
|
36
|
+
const code = item.code || "";
|
|
37
|
+
return name.includes(searchValue.value) || String(code).includes(searchValue.value);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
async function loadTreeRoot() {
|
|
41
|
+
const dict = props.cell.dict;
|
|
42
|
+
if (!dict) return;
|
|
43
|
+
loading.value = true;
|
|
44
|
+
try {
|
|
45
|
+
console.warn("[TreeField] 树形字典接口待对接,dict:", dict);
|
|
46
|
+
} finally {
|
|
47
|
+
loading.value = false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function openModal() {
|
|
51
|
+
if (isDisabled.value) return;
|
|
52
|
+
modalVisible.value = true;
|
|
53
|
+
if (dataSource.value.length === 0) {
|
|
54
|
+
loadTreeRoot();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function handleOk() {
|
|
58
|
+
if (selectedNode.value) {
|
|
59
|
+
displayText.value = selectedNode.value.name || "";
|
|
60
|
+
emit("update:modelValue", selectedNode.value.code || selectedNode.value.id);
|
|
61
|
+
}
|
|
62
|
+
modalVisible.value = false;
|
|
63
|
+
}
|
|
64
|
+
function handleCancel() {
|
|
65
|
+
modalVisible.value = false;
|
|
66
|
+
}
|
|
67
|
+
function handleClear() {
|
|
68
|
+
displayText.value = "";
|
|
69
|
+
selectedNode.value = null;
|
|
70
|
+
selectedRowKeys.value = [];
|
|
71
|
+
emit("update:modelValue", "");
|
|
72
|
+
}
|
|
73
|
+
function onSelectRow(record) {
|
|
74
|
+
selectedRowKeys.value = [record.id || record.key];
|
|
75
|
+
selectedNode.value = record;
|
|
76
|
+
}
|
|
77
|
+
function handleExpand(expanded, record) {
|
|
78
|
+
const key = record.id || record.key;
|
|
79
|
+
if (expanded) {
|
|
80
|
+
expandedRowKeys.value.push(key);
|
|
81
|
+
} else {
|
|
82
|
+
expandedRowKeys.value = expandedRowKeys.value.filter((k) => k !== key);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function handleSearch() {
|
|
86
|
+
expandedRowKeys.value = [];
|
|
87
|
+
}
|
|
88
|
+
const sourceDisplay = computed(() => {
|
|
89
|
+
return props.modelValue || "";
|
|
90
|
+
});
|
|
91
|
+
return (_ctx, _cache) => {
|
|
92
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
93
|
+
createVNode(unref(Input), {
|
|
94
|
+
value: sourceDisplay.value,
|
|
95
|
+
disabled: isDisabled.value,
|
|
96
|
+
placeholder: `请选择${__props.cell.title}`,
|
|
97
|
+
"allow-clear": "",
|
|
98
|
+
style: { "width": "100%" },
|
|
99
|
+
onClear: handleClear,
|
|
100
|
+
onClick: openModal
|
|
101
|
+
}, {
|
|
102
|
+
suffix: withCtx(() => [
|
|
103
|
+
createElementVNode("span", {
|
|
104
|
+
style: normalizeStyle({
|
|
105
|
+
cursor: isDisabled.value ? "not-allowed" : "pointer",
|
|
106
|
+
color: "#bfbfbf",
|
|
107
|
+
marginLeft: "10px"
|
|
108
|
+
}),
|
|
109
|
+
onClick: openModal
|
|
110
|
+
}, [
|
|
111
|
+
createVNode(unref(SearchOutlined))
|
|
112
|
+
], 4)
|
|
113
|
+
]),
|
|
114
|
+
_: 1
|
|
115
|
+
}, 8, ["value", "disabled", "placeholder"]),
|
|
116
|
+
createVNode(unref(Modal), {
|
|
117
|
+
title: `${__props.cell.title || "选择"}帮助`,
|
|
118
|
+
open: modalVisible.value,
|
|
119
|
+
width: "800px",
|
|
120
|
+
onOk: handleOk,
|
|
121
|
+
onCancel: handleCancel
|
|
122
|
+
}, {
|
|
123
|
+
default: withCtx(() => [
|
|
124
|
+
createVNode(unref(Spin), { spinning: loading.value }, {
|
|
125
|
+
default: withCtx(() => [
|
|
126
|
+
createVNode(unref(Input), {
|
|
127
|
+
value: searchValue.value,
|
|
128
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
|
|
129
|
+
placeholder: "请输入编号或名称按回车进行搜索",
|
|
130
|
+
style: { "margin-bottom": "16px" },
|
|
131
|
+
onPressEnter: handleSearch
|
|
132
|
+
}, null, 8, ["value"]),
|
|
133
|
+
tableData.value.length === 0 ? (openBlock(), createBlock(unref(Empty), { key: 0 })) : (openBlock(), createBlock(unref(Table), {
|
|
134
|
+
key: 1,
|
|
135
|
+
"row-key": "id",
|
|
136
|
+
columns,
|
|
137
|
+
"data-source": tableData.value,
|
|
138
|
+
pagination: false,
|
|
139
|
+
"expanded-row-keys": expandedRowKeys.value,
|
|
140
|
+
"row-class-name": (record) => selectedRowKeys.value.includes(record.id) ? "tree-select-row-selected" : "",
|
|
141
|
+
size: "middle",
|
|
142
|
+
onExpand: handleExpand,
|
|
143
|
+
onCustomRow: _cache[1] || (_cache[1] = (record) => ({ onClick: () => onSelectRow(record) }))
|
|
144
|
+
}, null, 8, ["data-source", "expanded-row-keys", "row-class-name"]))
|
|
145
|
+
]),
|
|
146
|
+
_: 1
|
|
147
|
+
}, 8, ["spinning"])
|
|
148
|
+
]),
|
|
149
|
+
_: 1
|
|
150
|
+
}, 8, ["title", "open"])
|
|
151
|
+
]);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
export {
|
|
156
|
+
_sfc_main as default
|
|
157
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function parsePrecision(raw) {
|
|
2
|
+
if (raw === null || raw === void 0) return void 0;
|
|
3
|
+
const s = typeof raw === "string" ? raw.trim() : raw;
|
|
4
|
+
if (s === "") return void 0;
|
|
5
|
+
const n = Number(s);
|
|
6
|
+
if (!Number.isFinite(n) || !Number.isInteger(n) || n < 0) return void 0;
|
|
7
|
+
return n;
|
|
8
|
+
}
|
|
9
|
+
function roundToPrecision(num, precision) {
|
|
10
|
+
if (precision === void 0 || !Number.isFinite(num)) return num;
|
|
11
|
+
const f = 10 ** precision;
|
|
12
|
+
const sign = num < 0 ? -1 : 1;
|
|
13
|
+
return Math.round((num + Number.EPSILON * sign) * f) / f;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
parsePrecision,
|
|
17
|
+
roundToPrecision
|
|
18
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
function parseSelectOptions(raw) {
|
|
2
|
+
if (!raw) return [];
|
|
3
|
+
return raw.split("\n").map((line) => {
|
|
4
|
+
const [value, ...labelParts] = line.split("|");
|
|
5
|
+
return {
|
|
6
|
+
label: (labelParts.join("|") || value || "").trim(),
|
|
7
|
+
value: (value || "").trim()
|
|
8
|
+
};
|
|
9
|
+
}).filter((opt) => opt.value);
|
|
10
|
+
}
|
|
11
|
+
function mapFieldType(cell) {
|
|
12
|
+
const type = cell.type || "text";
|
|
13
|
+
switch (type) {
|
|
14
|
+
case "text": {
|
|
15
|
+
switch (cell.text_type) {
|
|
16
|
+
case "textarea":
|
|
17
|
+
return "Textarea";
|
|
18
|
+
case "number":
|
|
19
|
+
return "InputNumber";
|
|
20
|
+
case "password":
|
|
21
|
+
return "InputPassword";
|
|
22
|
+
default:
|
|
23
|
+
return "Input";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
case "select":
|
|
27
|
+
return "Select";
|
|
28
|
+
case "date":
|
|
29
|
+
return "DatePicker";
|
|
30
|
+
case "time":
|
|
31
|
+
return "TimePicker";
|
|
32
|
+
case "tree":
|
|
33
|
+
return "TreeSelect";
|
|
34
|
+
case "radio":
|
|
35
|
+
return "RadioGroup";
|
|
36
|
+
case "checkbox":
|
|
37
|
+
return "CheckboxGroup";
|
|
38
|
+
case "image":
|
|
39
|
+
return "ImageUpload";
|
|
40
|
+
case "file":
|
|
41
|
+
case "fj":
|
|
42
|
+
return "FileUpload";
|
|
43
|
+
case "switch":
|
|
44
|
+
return "Switch";
|
|
45
|
+
case "splitline":
|
|
46
|
+
return "Divider";
|
|
47
|
+
case "org-select":
|
|
48
|
+
case "orgs-select":
|
|
49
|
+
return "ApiTreeSelect";
|
|
50
|
+
default:
|
|
51
|
+
return "Input";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function transformCellToSchema(cell) {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
if (cell.type === "splitline") return null;
|
|
57
|
+
if (!cell.name) return null;
|
|
58
|
+
const component = mapFieldType(cell);
|
|
59
|
+
const schema = {
|
|
60
|
+
component,
|
|
61
|
+
fieldName: cell.name,
|
|
62
|
+
label: cell.title
|
|
63
|
+
};
|
|
64
|
+
const componentProps = {};
|
|
65
|
+
if (cell.type === "text") {
|
|
66
|
+
componentProps.placeholder = `请输入${cell.title}`;
|
|
67
|
+
}
|
|
68
|
+
if (cell.type === "select" || cell.type === "radio" || cell.type === "checkbox") {
|
|
69
|
+
let options = [];
|
|
70
|
+
if ((_a = cell.dicts) == null ? void 0 : _a.length) {
|
|
71
|
+
options = cell.dicts.map((d) => ({
|
|
72
|
+
// 合并 select_sql 整行数据,树形/其它字段可直接取用(label/value 优先)
|
|
73
|
+
...d.data || {},
|
|
74
|
+
label: d.dictLabel,
|
|
75
|
+
value: d.dictValue
|
|
76
|
+
}));
|
|
77
|
+
} else {
|
|
78
|
+
options = parseSelectOptions(cell.select_options);
|
|
79
|
+
}
|
|
80
|
+
if (options.length > 0) {
|
|
81
|
+
componentProps.options = options;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (cell.after) componentProps.addonAfter = cell.after;
|
|
85
|
+
if (cell.before) componentProps.addonBefore = cell.before;
|
|
86
|
+
if (cell.type === "text" && cell.text_type === "textarea") {
|
|
87
|
+
componentProps.autoSize = { minRows: 3, maxRows: 6 };
|
|
88
|
+
}
|
|
89
|
+
if (cell.type === "text" && cell.text_type === "number") {
|
|
90
|
+
componentProps.style = { width: "100%" };
|
|
91
|
+
}
|
|
92
|
+
if (cell.type === "date") {
|
|
93
|
+
componentProps.valueFormat = ((_b = cell.dateType) == null ? void 0 : _b.includes("HH")) ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
94
|
+
}
|
|
95
|
+
if (cell.readonly === "2") {
|
|
96
|
+
componentProps.disabled = true;
|
|
97
|
+
}
|
|
98
|
+
schema.componentProps = componentProps;
|
|
99
|
+
if (cell.isneed === "1") {
|
|
100
|
+
schema.rules = "required";
|
|
101
|
+
}
|
|
102
|
+
const span = cell.mergeColCount || 1;
|
|
103
|
+
if (span > 1) {
|
|
104
|
+
schema.formItemClass = `col-span-${span}`;
|
|
105
|
+
}
|
|
106
|
+
return schema;
|
|
107
|
+
}
|
|
108
|
+
function transformFormConfig(config) {
|
|
109
|
+
let rawCells = [];
|
|
110
|
+
let colWidths = [];
|
|
111
|
+
let rowHeights = [];
|
|
112
|
+
let totalCol = 0;
|
|
113
|
+
let totalRow = 0;
|
|
114
|
+
if (config.config) {
|
|
115
|
+
rawCells = config.config.cells;
|
|
116
|
+
colWidths = config.config.colWidths ?? [];
|
|
117
|
+
rowHeights = config.config.rowHeights ?? [];
|
|
118
|
+
totalCol = config.config.totalCol ?? 0;
|
|
119
|
+
totalRow = config.config.totalRow ?? 0;
|
|
120
|
+
} else if (config.content) {
|
|
121
|
+
try {
|
|
122
|
+
const parsed = typeof config.content === "string" ? JSON.parse(config.content) : config.content;
|
|
123
|
+
if (parsed && Array.isArray(parsed.cells)) {
|
|
124
|
+
rawCells = parsed.cells;
|
|
125
|
+
colWidths = parsed.colWidths ?? [];
|
|
126
|
+
rowHeights = parsed.rowHeights ?? [];
|
|
127
|
+
totalCol = parsed.totalCol ?? 0;
|
|
128
|
+
totalRow = parsed.totalRow ?? 0;
|
|
129
|
+
} else {
|
|
130
|
+
console.warn(
|
|
131
|
+
"[design-runtime][form] 旧格式 content 解析结果不是表单结构,已按空表单处理"
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.warn(
|
|
136
|
+
"[design-runtime][form] 旧格式 content 不是合法 JSON,已按空表单处理:",
|
|
137
|
+
(error == null ? void 0 : error.message) ?? error
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const schema = rawCells.map(transformCellToSchema).filter((s) => s !== null);
|
|
142
|
+
const gridConfig = {
|
|
143
|
+
cells: rawCells,
|
|
144
|
+
colWidths,
|
|
145
|
+
rowHeights,
|
|
146
|
+
totalCol,
|
|
147
|
+
totalRow,
|
|
148
|
+
derivedFieldList: config.derivedFieldList ?? []
|
|
149
|
+
};
|
|
150
|
+
return {
|
|
151
|
+
gridConfig,
|
|
152
|
+
schema,
|
|
153
|
+
labelWidth: config.labelwidth || 150,
|
|
154
|
+
insertUrl: config.insertUrl,
|
|
155
|
+
updateUrl: config.updateUrl,
|
|
156
|
+
deleteUrl: config.deleteUrl,
|
|
157
|
+
showUrl: config.showUrl
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
export {
|
|
161
|
+
transformFormConfig
|
|
162
|
+
};
|
package/dist/host.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { checkDesignRuntimeCompat } from "./compat.js";
|
|
2
|
+
let host = {};
|
|
3
|
+
let compatChecked = false;
|
|
4
|
+
function mergeGroup(prev, next) {
|
|
5
|
+
if (!next) return prev;
|
|
6
|
+
return { ...prev ?? {}, ...next };
|
|
7
|
+
}
|
|
8
|
+
function installDesignPlatform(next) {
|
|
9
|
+
host = {
|
|
10
|
+
...host,
|
|
11
|
+
...next,
|
|
12
|
+
dict: mergeGroup(host.dict, next.dict),
|
|
13
|
+
ui: mergeGroup(host.ui, next.ui),
|
|
14
|
+
workflow: mergeGroup(host.workflow, next.workflow)
|
|
15
|
+
};
|
|
16
|
+
if (!compatChecked) {
|
|
17
|
+
compatChecked = true;
|
|
18
|
+
checkDesignRuntimeCompat({ throwOnError: host.strictCompat === true });
|
|
19
|
+
}
|
|
20
|
+
return host;
|
|
21
|
+
}
|
|
22
|
+
function getDesignHost() {
|
|
23
|
+
return host;
|
|
24
|
+
}
|
|
25
|
+
function hostT(key, fallback) {
|
|
26
|
+
var _a;
|
|
27
|
+
const value = (_a = host.t) == null ? void 0 : _a.call(host, key);
|
|
28
|
+
return typeof value === "string" && value.length > 0 ? value : fallback;
|
|
29
|
+
}
|
|
30
|
+
function resetDesignHost() {
|
|
31
|
+
host = {};
|
|
32
|
+
}
|
|
33
|
+
function getHostUi() {
|
|
34
|
+
return host.ui ?? {};
|
|
35
|
+
}
|
|
36
|
+
function getHostDict() {
|
|
37
|
+
return host.dict ?? {};
|
|
38
|
+
}
|
|
39
|
+
function getHostWorkflow() {
|
|
40
|
+
return host.workflow ?? {};
|
|
41
|
+
}
|
|
42
|
+
function requireHttp() {
|
|
43
|
+
const { http } = host;
|
|
44
|
+
if (!http) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
"[design-platform] 未注入 host.http:请在 app 启动时调用 installDesignPlatform({ http: <宿主请求实例适配> })(见 README「接入宿主」)"
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
return http;
|
|
50
|
+
}
|
|
51
|
+
function requireVxeGrid() {
|
|
52
|
+
var _a;
|
|
53
|
+
const useVxeGrid = (_a = host.ui) == null ? void 0 : _a.useVbenVxeGrid;
|
|
54
|
+
if (!useVxeGrid) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
"[design-platform] 未注入 host.ui.useVbenVxeGrid:表格 / 树形视图需要它在宿主里创建网格。请在 bootstrap 里注入宿主 adapter 里那个包装过的版本:installDesignPlatform({ ui: { useVbenVxeGrid } })(来自 #/adapter/vxe-table)"
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return useVxeGrid;
|
|
60
|
+
}
|
|
61
|
+
function getHostPopup(kind) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return kind === "drawer" ? (_a = host.ui) == null ? void 0 : _a.useVbenDrawer : (_b = host.ui) == null ? void 0 : _b.useVbenModal;
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
getDesignHost,
|
|
67
|
+
getHostDict,
|
|
68
|
+
getHostPopup,
|
|
69
|
+
getHostUi,
|
|
70
|
+
getHostWorkflow,
|
|
71
|
+
hostT,
|
|
72
|
+
installDesignPlatform,
|
|
73
|
+
requireHttp,
|
|
74
|
+
requireVxeGrid,
|
|
75
|
+
resetDesignHost
|
|
76
|
+
};
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function createMemoryHttp(handler) {
|
|
2
|
+
const log = [];
|
|
3
|
+
const run = (req) => {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
log.push(req);
|
|
6
|
+
if ((_b = (_a = req.options) == null ? void 0 : _a.signal) == null ? void 0 : _b.aborted) {
|
|
7
|
+
return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
8
|
+
}
|
|
9
|
+
return Promise.resolve().then(() => handler(req));
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
log,
|
|
13
|
+
get: (url, options) => run({ method: "GET", options, url }),
|
|
14
|
+
post: (url, data, options) => run({ data, method: "POST", options, url })
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
createMemoryHttp
|
|
19
|
+
};
|