@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,88 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createVNode, createTextVNode } from "vue";
|
|
2
|
+
import { Upload, Button } from "antdv-next";
|
|
3
|
+
import { UploadOutlined } from "@antdv-next/icons";
|
|
4
|
+
import { getDesignHost } from "../../host.js";
|
|
5
|
+
import { platformMessage } from "../../components/design-shared/host-api.js";
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "file-field",
|
|
8
|
+
props: {
|
|
9
|
+
cell: {},
|
|
10
|
+
disabled: { type: Boolean },
|
|
11
|
+
modelValue: {}
|
|
12
|
+
},
|
|
13
|
+
emits: ["update:modelValue"],
|
|
14
|
+
setup(__props, { emit: __emit }) {
|
|
15
|
+
const props = __props;
|
|
16
|
+
const emit = __emit;
|
|
17
|
+
let warnedNoUpload = false;
|
|
18
|
+
const customRequest = async ({
|
|
19
|
+
file,
|
|
20
|
+
onSuccess,
|
|
21
|
+
onError
|
|
22
|
+
}) => {
|
|
23
|
+
const upload = getDesignHost().upload;
|
|
24
|
+
if (!upload) {
|
|
25
|
+
if (!warnedNoUpload) {
|
|
26
|
+
warnedNoUpload = true;
|
|
27
|
+
console.warn(
|
|
28
|
+
"[design-runtime] 未注入 host.upload:file / image 字段无法上传。请在 installDesignPlatform({ upload: (file) => … }) 里实现(vben/ruoyi 可直接用 #/api 的 uploadApi)"
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
onError == null ? void 0 : onError(new Error("未注入 host.upload"));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const res = await upload(file);
|
|
36
|
+
onSuccess == null ? void 0 : onSuccess(res);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
onError == null ? void 0 : onError(error);
|
|
39
|
+
platformMessage().error(`上传失败:${(error == null ? void 0 : error.message) ?? "未知错误"}`);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const fileList = computed({
|
|
43
|
+
get: () => {
|
|
44
|
+
if (!props.modelValue) return [];
|
|
45
|
+
const url = String(props.modelValue);
|
|
46
|
+
return [
|
|
47
|
+
{ uid: "-1", name: url.split("/").pop() || "file", status: "done", url }
|
|
48
|
+
];
|
|
49
|
+
},
|
|
50
|
+
set: () => {
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
function handleChange(info) {
|
|
54
|
+
var _a, _b, _c;
|
|
55
|
+
if (info.file.status === "done") {
|
|
56
|
+
const url = ((_a = info.file.response) == null ? void 0 : _a.url) || ((_c = (_b = info.file.response) == null ? void 0 : _b.data) == null ? void 0 : _c.url) || "";
|
|
57
|
+
emit("update:modelValue", url);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return (_ctx, _cache) => {
|
|
61
|
+
return openBlock(), createBlock(unref(Upload), {
|
|
62
|
+
"file-list": fileList.value,
|
|
63
|
+
"custom-request": customRequest,
|
|
64
|
+
disabled: props.disabled,
|
|
65
|
+
"max-count": 1,
|
|
66
|
+
onChange: handleChange
|
|
67
|
+
}, {
|
|
68
|
+
default: withCtx(() => [
|
|
69
|
+
createVNode(unref(Button), {
|
|
70
|
+
disabled: props.disabled
|
|
71
|
+
}, {
|
|
72
|
+
icon: withCtx(() => [
|
|
73
|
+
createVNode(unref(UploadOutlined))
|
|
74
|
+
]),
|
|
75
|
+
default: withCtx(() => [
|
|
76
|
+
_cache[0] || (_cache[0] = createTextVNode(" 上传 ", -1))
|
|
77
|
+
]),
|
|
78
|
+
_: 1
|
|
79
|
+
}, 8, ["disabled"])
|
|
80
|
+
]),
|
|
81
|
+
_: 1
|
|
82
|
+
}, 8, ["file-list", "disabled"]);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
export {
|
|
87
|
+
_sfc_main as default
|
|
88
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementBlock, createVNode, createTextVNode, createCommentVNode } from "vue";
|
|
2
|
+
import { Upload } from "antdv-next";
|
|
3
|
+
import { PlusOutlined } from "@antdv-next/icons";
|
|
4
|
+
import { getDesignHost } from "../../host.js";
|
|
5
|
+
import { platformMessage } from "../../components/design-shared/host-api.js";
|
|
6
|
+
const _hoisted_1 = { key: 0 };
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
__name: "image-field",
|
|
9
|
+
props: {
|
|
10
|
+
cell: {},
|
|
11
|
+
disabled: { type: Boolean },
|
|
12
|
+
modelValue: {}
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:modelValue"],
|
|
15
|
+
setup(__props, { emit: __emit }) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const emit = __emit;
|
|
18
|
+
let warnedNoUpload = false;
|
|
19
|
+
const customRequest = async ({
|
|
20
|
+
file,
|
|
21
|
+
onSuccess,
|
|
22
|
+
onError
|
|
23
|
+
}) => {
|
|
24
|
+
const upload = getDesignHost().upload;
|
|
25
|
+
if (!upload) {
|
|
26
|
+
if (!warnedNoUpload) {
|
|
27
|
+
warnedNoUpload = true;
|
|
28
|
+
console.warn(
|
|
29
|
+
"[design-runtime] 未注入 host.upload:file / image 字段无法上传。请在 installDesignPlatform({ upload: (file) => … }) 里实现(vben/ruoyi 可直接用 #/api 的 uploadApi)"
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
onError == null ? void 0 : onError(new Error("未注入 host.upload"));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const res = await upload(file);
|
|
37
|
+
onSuccess == null ? void 0 : onSuccess(res);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
onError == null ? void 0 : onError(error);
|
|
40
|
+
platformMessage().error(`上传失败:${(error == null ? void 0 : error.message) ?? "未知错误"}`);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const fileList = computed({
|
|
44
|
+
get: () => {
|
|
45
|
+
if (!props.modelValue) return [];
|
|
46
|
+
const url = String(props.modelValue);
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
uid: "-1",
|
|
50
|
+
name: "image",
|
|
51
|
+
status: "done",
|
|
52
|
+
url,
|
|
53
|
+
thumbUrl: url
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
},
|
|
57
|
+
set: () => {
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
function handleChange(info) {
|
|
61
|
+
var _a, _b, _c;
|
|
62
|
+
if (info.file.status === "done") {
|
|
63
|
+
const url = ((_a = info.file.response) == null ? void 0 : _a.url) || ((_c = (_b = info.file.response) == null ? void 0 : _b.data) == null ? void 0 : _c.url) || "";
|
|
64
|
+
emit("update:modelValue", url);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return (_ctx, _cache) => {
|
|
68
|
+
return openBlock(), createBlock(unref(Upload), {
|
|
69
|
+
"file-list": fileList.value,
|
|
70
|
+
"onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => fileList.value = $event),
|
|
71
|
+
"custom-request": customRequest,
|
|
72
|
+
disabled: props.disabled,
|
|
73
|
+
"list-type": "picture",
|
|
74
|
+
"max-count": 1,
|
|
75
|
+
onChange: handleChange
|
|
76
|
+
}, {
|
|
77
|
+
default: withCtx(() => [
|
|
78
|
+
!props.modelValue ? (openBlock(), createElementBlock("span", _hoisted_1, [
|
|
79
|
+
createVNode(unref(PlusOutlined)),
|
|
80
|
+
_cache[1] || (_cache[1] = createTextVNode(" 上传图片 ", -1))
|
|
81
|
+
])) : createCommentVNode("", true)
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
}, 8, ["file-list", "disabled"]);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
export {
|
|
89
|
+
_sfc_main as default
|
|
90
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { resolveDesignComponent, hasDesignComponent, listDesignComponents, registerComponents } from "../../registry.js";
|
|
2
|
+
import _sfc_main$a from "./checkbox-field.vue.js";
|
|
3
|
+
import _sfc_main$b from "./custom-field.vue.js";
|
|
4
|
+
import _sfc_main$9 from "./date-field.vue.js";
|
|
5
|
+
import EmbeddedListField from "./embedded-list-field.vue.js";
|
|
6
|
+
import _sfc_main$8 from "./file-field.vue.js";
|
|
7
|
+
import _sfc_main$7 from "./image-field.vue.js";
|
|
8
|
+
import OrgSelectField from "./org-select-field.vue.js";
|
|
9
|
+
import _sfc_main$6 from "./orgs-select-field.vue.js";
|
|
10
|
+
import _sfc_main$5 from "./month-field.vue.js";
|
|
11
|
+
import _sfc_main$4 from "./radio-field.vue.js";
|
|
12
|
+
import SelectField from "./select-field.vue.js";
|
|
13
|
+
import SplitlineField from "./splitline-field.vue.js";
|
|
14
|
+
import _sfc_main$3 from "./switch-field.vue.js";
|
|
15
|
+
import _sfc_main from "./text-field.vue.js";
|
|
16
|
+
import _sfc_main$2 from "./time-field.vue.js";
|
|
17
|
+
import _sfc_main$1 from "./tree-field.vue.js";
|
|
18
|
+
const builtin = {
|
|
19
|
+
checkbox: _sfc_main$a,
|
|
20
|
+
date: _sfc_main$9,
|
|
21
|
+
embeddedList: EmbeddedListField,
|
|
22
|
+
"embedded-list": EmbeddedListField,
|
|
23
|
+
file: _sfc_main$8,
|
|
24
|
+
fj: _sfc_main$8,
|
|
25
|
+
// 附件同 file
|
|
26
|
+
image: _sfc_main$7,
|
|
27
|
+
"org-select": OrgSelectField,
|
|
28
|
+
"orgs-select": _sfc_main$6,
|
|
29
|
+
month: _sfc_main$5,
|
|
30
|
+
radio: _sfc_main$4,
|
|
31
|
+
select: SelectField,
|
|
32
|
+
splitline: SplitlineField,
|
|
33
|
+
switch: _sfc_main$3,
|
|
34
|
+
text: _sfc_main,
|
|
35
|
+
time: _sfc_main$2,
|
|
36
|
+
tree: _sfc_main$1
|
|
37
|
+
};
|
|
38
|
+
const pendingFieldTypes = [];
|
|
39
|
+
const warnedTypes = /* @__PURE__ */ new Set();
|
|
40
|
+
function register(type, comp) {
|
|
41
|
+
registerComponents({ [type]: () => comp });
|
|
42
|
+
}
|
|
43
|
+
function registerFields(map) {
|
|
44
|
+
const loaders = {};
|
|
45
|
+
for (const [type, comp] of Object.entries(map)) {
|
|
46
|
+
loaders[type] = () => comp;
|
|
47
|
+
}
|
|
48
|
+
registerComponents(loaders);
|
|
49
|
+
}
|
|
50
|
+
function resolveComponent(type) {
|
|
51
|
+
if (!type) return _sfc_main;
|
|
52
|
+
const custom = resolveDesignComponent(type);
|
|
53
|
+
if (custom) return custom;
|
|
54
|
+
const comp = builtin[type];
|
|
55
|
+
if (comp) return comp;
|
|
56
|
+
if (!warnedTypes.has(type)) {
|
|
57
|
+
warnedTypes.add(type);
|
|
58
|
+
const hint = pendingFieldTypes.includes(type) ? "该类字段尚未迁入 design-runtime" : "未知字段类型";
|
|
59
|
+
console.warn(
|
|
60
|
+
`[design-runtime] 表单字段类型「${type}」使用占位输入框:${hint}(可注册同名 comname 覆盖)`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return _sfc_main$b;
|
|
64
|
+
}
|
|
65
|
+
function resolveCellComponent(cell) {
|
|
66
|
+
if (!cell) return _sfc_main;
|
|
67
|
+
if (cell.type === "my") {
|
|
68
|
+
const name = (cell.comname ?? "").trim();
|
|
69
|
+
if (name) {
|
|
70
|
+
const comp = resolveDesignComponent(name) ?? builtin[name];
|
|
71
|
+
if (comp) return comp;
|
|
72
|
+
console.warn(
|
|
73
|
+
`[design-runtime] 自定义组件 "${name}" 未注册(单元格「组件」名):请在该项目的注册表里登记同名字符串,已回退为占位输入框`
|
|
74
|
+
);
|
|
75
|
+
return _sfc_main$b;
|
|
76
|
+
}
|
|
77
|
+
console.warn(
|
|
78
|
+
"[design-runtime] 单元格类型为「自定义」但没填「组件」名,已回退为占位输入框"
|
|
79
|
+
);
|
|
80
|
+
return _sfc_main$b;
|
|
81
|
+
}
|
|
82
|
+
return resolveComponent(cell.type);
|
|
83
|
+
}
|
|
84
|
+
function listCustomComponents() {
|
|
85
|
+
const names = /* @__PURE__ */ new Set([
|
|
86
|
+
...listDesignComponents().map((item) => item.name),
|
|
87
|
+
...Object.keys(builtin)
|
|
88
|
+
]);
|
|
89
|
+
return [...names].sort();
|
|
90
|
+
}
|
|
91
|
+
function hasCustomComponent(comname) {
|
|
92
|
+
const name = (comname ?? "").trim();
|
|
93
|
+
if (!name) return false;
|
|
94
|
+
return Boolean(hasDesignComponent(name) || builtin[name]);
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
_sfc_main$b as CustomField,
|
|
98
|
+
_sfc_main as TextField,
|
|
99
|
+
hasCustomComponent,
|
|
100
|
+
listCustomComponents,
|
|
101
|
+
pendingFieldTypes,
|
|
102
|
+
register,
|
|
103
|
+
registerFields,
|
|
104
|
+
resolveCellComponent,
|
|
105
|
+
resolveComponent
|
|
106
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineComponent, computed, watch, openBlock, createBlock, unref } from "vue";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import { DateMonthPicker } from "antdv-next";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "month-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 monthFormat = computed(() => props.cell.dateType || "YYYY-MM");
|
|
16
|
+
watch(
|
|
17
|
+
() => props.modelValue,
|
|
18
|
+
(val) => {
|
|
19
|
+
if (val === null || val === void 0 || val === "") return;
|
|
20
|
+
if (typeof val !== "string") return;
|
|
21
|
+
if (!dayjs(val).isValid()) return;
|
|
22
|
+
const normalized = dayjs(val).format(monthFormat.value);
|
|
23
|
+
if (normalized !== val) {
|
|
24
|
+
emit("update:modelValue", normalized);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{ immediate: true }
|
|
28
|
+
);
|
|
29
|
+
const value = computed({
|
|
30
|
+
get: () => props.modelValue,
|
|
31
|
+
set: (val) => emit("update:modelValue", val)
|
|
32
|
+
});
|
|
33
|
+
const isDisabled = computed(
|
|
34
|
+
() => props.disabled || props.cell.readonly === "2"
|
|
35
|
+
);
|
|
36
|
+
return (_ctx, _cache) => {
|
|
37
|
+
return openBlock(), createBlock(unref(DateMonthPicker), {
|
|
38
|
+
value: value.value,
|
|
39
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
40
|
+
disabled: isDisabled.value,
|
|
41
|
+
format: monthFormat.value,
|
|
42
|
+
"value-format": monthFormat.value,
|
|
43
|
+
placeholder: "请选择月份",
|
|
44
|
+
style: { "width": "100%" }
|
|
45
|
+
}, null, 8, ["value", "disabled", "format", "value-format"]);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
_sfc_main as default
|
|
51
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./org-select-field2.vue.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const OrgSelectField = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-227d414b"]]);
|
|
5
|
+
export {
|
|
6
|
+
OrgSelectField as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, reactive, watch, openBlock, createElementBlock, Fragment, createElementVNode, normalizeClass, withModifiers, createCommentVNode, createVNode, unref, withCtx, createBlock } from "vue";
|
|
2
|
+
import { Modal, Spin, Input, Tree, Empty } from "antdv-next";
|
|
3
|
+
import { SearchOutlined } from "@antdv-next/icons";
|
|
4
|
+
import { deptList } from "../../org/dept-api.js";
|
|
5
|
+
import { createLazyDeptTree, attachChildren } from "../../org/dept-tree.js";
|
|
6
|
+
import { createDeptTreeSource } from "../../org/dept-tree-source.js";
|
|
7
|
+
const _hoisted_1 = ["value", "placeholder", "disabled"];
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "org-select-field",
|
|
10
|
+
props: {
|
|
11
|
+
cell: {},
|
|
12
|
+
disabled: { type: Boolean },
|
|
13
|
+
modelValue: {}
|
|
14
|
+
},
|
|
15
|
+
emits: ["update:modelValue", "update:derived"],
|
|
16
|
+
setup(__props, { emit: __emit }) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const emit = __emit;
|
|
19
|
+
const isDisabled = computed(
|
|
20
|
+
() => props.disabled || props.cell.readonly === "2"
|
|
21
|
+
);
|
|
22
|
+
const modalVisible = ref(false);
|
|
23
|
+
const loading = ref(false);
|
|
24
|
+
const searchValue = ref("");
|
|
25
|
+
const treeData = ref([]);
|
|
26
|
+
const displayText = reactive({ text: "" });
|
|
27
|
+
const lazyTree = createLazyDeptTree(createDeptTreeSource());
|
|
28
|
+
async function loadRoot() {
|
|
29
|
+
if (treeData.value.length > 0) return;
|
|
30
|
+
loading.value = true;
|
|
31
|
+
try {
|
|
32
|
+
treeData.value = await lazyTree.treeNodesOf(0);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
console.error("[org-select-field] 机构树加载失败:", (err == null ? void 0 : err.message) ?? err);
|
|
35
|
+
} finally {
|
|
36
|
+
loading.value = false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function onLoadData(node) {
|
|
40
|
+
const key = (node == null ? void 0 : node.key) ?? (node == null ? void 0 : node.eventKey);
|
|
41
|
+
if (key === void 0 || key === null) return;
|
|
42
|
+
try {
|
|
43
|
+
const children = await lazyTree.treeNodesOf(key);
|
|
44
|
+
treeData.value = attachChildren(treeData.value, key, children);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error("[org-select-field] 子机构加载失败:", (err == null ? void 0 : err.message) ?? err);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
let searchTimer = null;
|
|
50
|
+
watch(searchValue, (val) => {
|
|
51
|
+
clearTimeout(searchTimer);
|
|
52
|
+
searchTimer = setTimeout(() => void runSearch(val ?? ""), 300);
|
|
53
|
+
});
|
|
54
|
+
async function runSearch(keyword) {
|
|
55
|
+
loading.value = true;
|
|
56
|
+
try {
|
|
57
|
+
if (!keyword) {
|
|
58
|
+
treeData.value = await lazyTree.treeNodesOf(0);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const list = await deptList({ deptName: keyword });
|
|
62
|
+
treeData.value = await lazyTree.searchNodes(list ?? []);
|
|
63
|
+
} catch (err) {
|
|
64
|
+
console.error("[org-select-field] 机构搜索失败:", (err == null ? void 0 : err.message) ?? err);
|
|
65
|
+
} finally {
|
|
66
|
+
loading.value = false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function resolveDisplay(id) {
|
|
70
|
+
var _a;
|
|
71
|
+
if (id === void 0 || id === null || id === "") return;
|
|
72
|
+
try {
|
|
73
|
+
const { fullName, node } = await lazyTree.pathOf(id);
|
|
74
|
+
if (fullName) displayText.text = fullName;
|
|
75
|
+
if ((((_a = props.cell.deriveTo) == null ? void 0 : _a.length) ?? 0) > 0 && node) emitDerived(node);
|
|
76
|
+
} catch (err) {
|
|
77
|
+
console.warn("[org-select-field] 机构回显解析失败:", (err == null ? void 0 : err.message) ?? err);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
watch(
|
|
81
|
+
() => props.modelValue,
|
|
82
|
+
(val) => {
|
|
83
|
+
if (val === void 0 || val === null || val === "") {
|
|
84
|
+
displayText.text = "";
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
displayText.text = String(val);
|
|
88
|
+
void resolveDisplay(val);
|
|
89
|
+
},
|
|
90
|
+
{ immediate: true }
|
|
91
|
+
);
|
|
92
|
+
function handleSelect(keys, info) {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
const key = keys == null ? void 0 : keys[0];
|
|
95
|
+
if (key != null) {
|
|
96
|
+
emit("update:modelValue", key);
|
|
97
|
+
const raw = ((_a = info == null ? void 0 : info.node) == null ? void 0 : _a.raw) ?? (info == null ? void 0 : info.node);
|
|
98
|
+
emitDerived(raw);
|
|
99
|
+
displayText.text = String(((_b = info == null ? void 0 : info.node) == null ? void 0 : _b.title) ?? (raw == null ? void 0 : raw.label) ?? key);
|
|
100
|
+
void resolveDisplay(key);
|
|
101
|
+
}
|
|
102
|
+
modalVisible.value = false;
|
|
103
|
+
}
|
|
104
|
+
function handleClear() {
|
|
105
|
+
emit("update:modelValue", "");
|
|
106
|
+
emitDerived(null);
|
|
107
|
+
displayText.text = "";
|
|
108
|
+
}
|
|
109
|
+
function openModal() {
|
|
110
|
+
if (isDisabled.value) return;
|
|
111
|
+
modalVisible.value = true;
|
|
112
|
+
void loadRoot();
|
|
113
|
+
}
|
|
114
|
+
function emitDerived(node) {
|
|
115
|
+
const deriveTo = props.cell.deriveTo;
|
|
116
|
+
if (!(deriveTo == null ? void 0 : deriveTo.length)) return;
|
|
117
|
+
const derived = {};
|
|
118
|
+
let has = false;
|
|
119
|
+
for (const dt of deriveTo) {
|
|
120
|
+
const v = node == null ? null : node == null ? void 0 : node[dt.source];
|
|
121
|
+
if (v === void 0) continue;
|
|
122
|
+
derived[dt.field] = v;
|
|
123
|
+
has = true;
|
|
124
|
+
}
|
|
125
|
+
if (has) emit("update:derived", derived);
|
|
126
|
+
}
|
|
127
|
+
return (_ctx, _cache) => {
|
|
128
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
129
|
+
createElementVNode("div", {
|
|
130
|
+
class: normalizeClass(["org-select", { "org-select--disabled": isDisabled.value }]),
|
|
131
|
+
onClick: openModal
|
|
132
|
+
}, [
|
|
133
|
+
createElementVNode("input", {
|
|
134
|
+
class: "org-select__input",
|
|
135
|
+
value: displayText.text,
|
|
136
|
+
placeholder: `请选择${__props.cell.title}`,
|
|
137
|
+
disabled: isDisabled.value,
|
|
138
|
+
readonly: ""
|
|
139
|
+
}, null, 8, _hoisted_1),
|
|
140
|
+
displayText.text && !isDisabled.value ? (openBlock(), createElementBlock("span", {
|
|
141
|
+
key: 0,
|
|
142
|
+
class: "org-select__clear",
|
|
143
|
+
onClick: withModifiers(handleClear, ["stop"])
|
|
144
|
+
}, "✕")) : createCommentVNode("", true),
|
|
145
|
+
createVNode(unref(SearchOutlined), { class: "org-select__suffix" })
|
|
146
|
+
], 2),
|
|
147
|
+
createVNode(unref(Modal), {
|
|
148
|
+
title: "机构选择",
|
|
149
|
+
open: modalVisible.value,
|
|
150
|
+
width: "640px",
|
|
151
|
+
footer: null,
|
|
152
|
+
onCancel: _cache[1] || (_cache[1] = ($event) => modalVisible.value = false)
|
|
153
|
+
}, {
|
|
154
|
+
default: withCtx(() => [
|
|
155
|
+
createVNode(unref(Spin), { spinning: loading.value }, {
|
|
156
|
+
default: withCtx(() => [
|
|
157
|
+
createVNode(unref(Input), {
|
|
158
|
+
value: searchValue.value,
|
|
159
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
|
|
160
|
+
placeholder: "输入机构名称搜索",
|
|
161
|
+
"allow-clear": "",
|
|
162
|
+
style: { "margin-bottom": "12px" }
|
|
163
|
+
}, null, 8, ["value"]),
|
|
164
|
+
treeData.value.length > 0 ? (openBlock(), createBlock(unref(Tree), {
|
|
165
|
+
key: 0,
|
|
166
|
+
"tree-data": treeData.value,
|
|
167
|
+
"field-names": { key: "key", title: "title", children: "children" },
|
|
168
|
+
"selected-keys": props.modelValue != null && props.modelValue !== "" ? [String(props.modelValue)] : [],
|
|
169
|
+
"load-data": onLoadData,
|
|
170
|
+
onSelect: handleSelect
|
|
171
|
+
}, null, 8, ["tree-data", "selected-keys"])) : !loading.value ? (openBlock(), createBlock(unref(Empty), {
|
|
172
|
+
key: 1,
|
|
173
|
+
description: "暂无机构数据"
|
|
174
|
+
})) : createCommentVNode("", true)
|
|
175
|
+
]),
|
|
176
|
+
_: 1
|
|
177
|
+
}, 8, ["spinning"])
|
|
178
|
+
]),
|
|
179
|
+
_: 1
|
|
180
|
+
}, 8, ["open"])
|
|
181
|
+
], 64);
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
export {
|
|
186
|
+
_sfc_main as default
|
|
187
|
+
};
|