@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.
Files changed (229) hide show
  1. package/CHANGELOG.md +176 -0
  2. package/README.md +275 -2
  3. package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
  4. package/dist/api.js +149 -0
  5. package/dist/comb/design-comb.vue.js +7 -0
  6. package/dist/comb/design-comb2.vue.js +591 -0
  7. package/dist/compat.js +74 -0
  8. package/dist/components/ApiSwitch.vue.js +7 -0
  9. package/dist/components/ApiSwitch2.vue.js +98 -0
  10. package/dist/components/design-debug/dev-mode-toggle.vue.js +7 -0
  11. package/dist/components/design-debug/dev-mode-toggle2.vue.js +41 -0
  12. package/dist/components/design-debug/dev-mode.js +45 -0
  13. package/dist/components/design-debug/dev-state-button.vue.js +7 -0
  14. package/dist/components/design-debug/dev-state-button2.vue.js +447 -0
  15. package/dist/components/design-debug/expr-eval.js +81 -0
  16. package/dist/components/design-shared/host-api.js +47 -0
  17. package/dist/components/design-shared/popup-host.js +11 -0
  18. package/dist/components/design-table/design-table-inner.vue.js +7 -0
  19. package/dist/components/design-table/design-table-inner2.vue.js +39 -0
  20. package/dist/components/design-table/design-table.vue.js +7 -0
  21. package/dist/components/design-table/design-table2.vue.js +937 -0
  22. package/dist/components/design-table/row-actions/delete-action.vue.js +4 -0
  23. package/dist/components/design-table/row-actions/delete-action2.vue.js +42 -0
  24. package/dist/components/design-table/row-actions/edit-action.vue.js +4 -0
  25. package/dist/components/design-table/row-actions/edit-action2.vue.js +145 -0
  26. package/dist/components/design-table/row-actions/index.js +36 -0
  27. package/dist/components/design-table/row-actions/modal-comb-action.vue.js +4 -0
  28. package/dist/components/design-table/row-actions/modal-comb-action2.vue.js +66 -0
  29. package/dist/components/design-table/row-actions/modal-custom-action.vue.js +7 -0
  30. package/dist/components/design-table/row-actions/modal-custom-action2.vue.js +105 -0
  31. package/dist/components/design-table/row-actions/modal-form-action.vue.js +4 -0
  32. package/dist/components/design-table/row-actions/modal-form-action2.vue.js +82 -0
  33. package/dist/components/design-table/row-actions/modal-table-action.vue.js +4 -0
  34. package/dist/components/design-table/row-actions/modal-table-action2.vue.js +67 -0
  35. package/dist/components/design-table/row-actions/modal-tree-action.vue.js +4 -0
  36. package/dist/components/design-table/row-actions/modal-tree-action2.vue.js +70 -0
  37. package/dist/components/design-table/row-actions/navigate-comb-action.vue.js +4 -0
  38. package/dist/components/design-table/row-actions/navigate-comb-action2.vue.js +47 -0
  39. package/dist/components/design-table/row-actions/navigate-form-action.vue.js +4 -0
  40. package/dist/components/design-table/row-actions/navigate-form-action2.vue.js +47 -0
  41. package/dist/components/design-table/row-actions/navigate-table-action.vue.js +4 -0
  42. package/dist/components/design-table/row-actions/navigate-table-action2.vue.js +47 -0
  43. package/dist/components/design-table/row-actions/navigate-tree-action.vue.js +4 -0
  44. package/dist/components/design-table/row-actions/navigate-tree-action2.vue.js +47 -0
  45. package/dist/components/design-table/row-actions/other-action.vue.js +4 -0
  46. package/dist/components/design-table/row-actions/other-action2.vue.js +44 -0
  47. package/dist/components/design-tools/add-tool.vue.js +4 -0
  48. package/dist/components/design-tools/add-tool2.vue.js +136 -0
  49. package/dist/components/design-tools/command-executor.js +135 -0
  50. package/dist/components/design-tools/export-tool.vue.js +4 -0
  51. package/dist/components/design-tools/export-tool2.vue.js +46 -0
  52. package/dist/components/design-tools/import-tool.vue.js +4 -0
  53. package/dist/components/design-tools/import-tool2.vue.js +101 -0
  54. package/dist/components/design-tools/index.js +36 -0
  55. package/dist/components/design-tools/modal-comb-tool.vue.js +4 -0
  56. package/dist/components/design-tools/modal-comb-tool2.vue.js +56 -0
  57. package/dist/components/design-tools/modal-form-tool.vue.js +4 -0
  58. package/dist/components/design-tools/modal-form-tool2.vue.js +66 -0
  59. package/dist/components/design-tools/modal-hcm-tool.vue.js +7 -0
  60. package/dist/components/design-tools/modal-hcm-tool2.vue.js +85 -0
  61. package/dist/components/design-tools/modal-table-tool.vue.js +4 -0
  62. package/dist/components/design-tools/modal-table-tool2.vue.js +54 -0
  63. package/dist/components/design-tools/modal-tree-tool.vue.js +4 -0
  64. package/dist/components/design-tools/modal-tree-tool2.vue.js +57 -0
  65. package/dist/components/design-tools/navigate-comb-tool.vue.js +4 -0
  66. package/dist/components/design-tools/navigate-comb-tool2.vue.js +34 -0
  67. package/dist/components/design-tools/navigate-form-tool.vue.js +4 -0
  68. package/dist/components/design-tools/navigate-form-tool2.vue.js +34 -0
  69. package/dist/components/design-tools/navigate-table-tool.vue.js +4 -0
  70. package/dist/components/design-tools/navigate-table-tool2.vue.js +33 -0
  71. package/dist/components/design-tools/other-tool.vue.js +4 -0
  72. package/dist/components/design-tools/other-tool2.vue.js +34 -0
  73. package/dist/components/flow-status-cell/flow-status-cell.vue.js +7 -0
  74. package/dist/components/flow-status-cell/flow-status-cell2.vue.js +124 -0
  75. package/dist/flow.js +22 -0
  76. package/dist/form/cell-condition.js +122 -0
  77. package/dist/form/derived-express.js +34 -0
  78. package/dist/form/design-form-inner.vue.js +7 -0
  79. package/dist/form/design-form-inner2.vue.js +449 -0
  80. package/dist/form/design-form.vue.js +7 -0
  81. package/dist/form/design-form2.vue.js +681 -0
  82. package/dist/form/fields/checkbox-field.vue.js +88 -0
  83. package/dist/form/fields/checkbox-field2.vue.js +4 -0
  84. package/dist/form/fields/custom-field.vue.js +36 -0
  85. package/dist/form/fields/custom-field2.vue.js +4 -0
  86. package/dist/form/fields/date-field.vue.js +64 -0
  87. package/dist/form/fields/date-field2.vue.js +4 -0
  88. package/dist/form/fields/embedded-list-field.vue.js +7 -0
  89. package/dist/form/fields/embedded-list-field2.vue.js +437 -0
  90. package/dist/form/fields/file-field.vue.js +88 -0
  91. package/dist/form/fields/file-field2.vue.js +4 -0
  92. package/dist/form/fields/image-field.vue.js +90 -0
  93. package/dist/form/fields/image-field2.vue.js +4 -0
  94. package/dist/form/fields/index.js +106 -0
  95. package/dist/form/fields/month-field.vue.js +51 -0
  96. package/dist/form/fields/month-field2.vue.js +4 -0
  97. package/dist/form/fields/org-select-field.vue.js +7 -0
  98. package/dist/form/fields/org-select-field2.vue.js +187 -0
  99. package/dist/form/fields/orgs-select-field.vue.js +182 -0
  100. package/dist/form/fields/orgs-select-field2.vue.js +4 -0
  101. package/dist/form/fields/radio-field.vue.js +91 -0
  102. package/dist/form/fields/radio-field2.vue.js +4 -0
  103. package/dist/form/fields/select-field.vue.js +7 -0
  104. package/dist/form/fields/select-field2.vue.js +317 -0
  105. package/dist/form/fields/splitline-field.vue.js +7 -0
  106. package/dist/form/fields/splitline-field2.vue.js +50 -0
  107. package/dist/form/fields/switch-field.vue.js +32 -0
  108. package/dist/form/fields/switch-field2.vue.js +4 -0
  109. package/dist/form/fields/text-field.vue.js +78 -0
  110. package/dist/form/fields/text-field2.vue.js +4 -0
  111. package/dist/form/fields/time-field.vue.js +50 -0
  112. package/dist/form/fields/time-field2.vue.js +4 -0
  113. package/dist/form/fields/tree-field.vue.js +157 -0
  114. package/dist/form/fields/tree-field2.vue.js +4 -0
  115. package/dist/form/number-precision.js +18 -0
  116. package/dist/form/transformer.js +162 -0
  117. package/dist/host.js +76 -0
  118. package/dist/http.js +19 -0
  119. package/dist/index.js +166 -0
  120. package/dist/mapping.js +44 -0
  121. package/dist/org/dept-api.js +30 -0
  122. package/dist/org/dept-tree-source.js +53 -0
  123. package/dist/org/dept-tree.js +122 -0
  124. package/dist/registry.js +77 -0
  125. package/dist/search/design-search.vue.js +7 -0
  126. package/dist/search/design-search2.vue.js +232 -0
  127. package/dist/search/transformer.js +115 -0
  128. package/dist/style.css +1220 -0
  129. package/dist/table/data.js +18 -0
  130. package/dist/table/load-gate.js +19 -0
  131. package/dist/table/query-body.js +59 -0
  132. package/dist/table/query-dedupe.js +54 -0
  133. package/dist/table/query-search.js +9 -0
  134. package/dist/table/row-action-mapping.js +34 -0
  135. package/dist/table/transformer.js +328 -0
  136. package/dist/tree/design-tree.vue.js +7 -0
  137. package/dist/tree/design-tree2.vue.js +783 -0
  138. package/dist/types/api.d.ts +83 -0
  139. package/dist/types/comb/design-comb.vue.d.ts +38 -0
  140. package/dist/types/compat.d.ts +46 -0
  141. package/dist/types/components/ApiSwitch.vue.d.ts +31 -0
  142. package/dist/types/components/design-debug/dev-mode-toggle.vue.d.ts +2 -0
  143. package/dist/types/components/design-debug/dev-mode.d.ts +8 -0
  144. package/dist/types/components/design-debug/dev-state-button.vue.d.ts +55 -0
  145. package/dist/types/components/design-debug/expr-eval.d.ts +55 -0
  146. package/dist/types/components/design-shared/host-api.d.ts +60 -0
  147. package/dist/types/components/design-shared/popup-host.d.ts +13 -0
  148. package/dist/types/components/design-table/design-table-inner.vue.d.ts +19 -0
  149. package/dist/types/components/design-table/design-table.vue.d.ts +70 -0
  150. package/dist/types/components/design-table/row-actions/delete-action.vue.d.ts +12 -0
  151. package/dist/types/components/design-table/row-actions/edit-action.vue.d.ts +14 -0
  152. package/dist/types/components/design-table/row-actions/index.d.ts +25 -0
  153. package/dist/types/components/design-table/row-actions/modal-comb-action.vue.d.ts +10 -0
  154. package/dist/types/components/design-table/row-actions/modal-custom-action.vue.d.ts +15 -0
  155. package/dist/types/components/design-table/row-actions/modal-form-action.vue.d.ts +10 -0
  156. package/dist/types/components/design-table/row-actions/modal-table-action.vue.d.ts +10 -0
  157. package/dist/types/components/design-table/row-actions/modal-tree-action.vue.d.ts +10 -0
  158. package/dist/types/components/design-table/row-actions/navigate-comb-action.vue.d.ts +10 -0
  159. package/dist/types/components/design-table/row-actions/navigate-form-action.vue.d.ts +10 -0
  160. package/dist/types/components/design-table/row-actions/navigate-table-action.vue.d.ts +10 -0
  161. package/dist/types/components/design-table/row-actions/navigate-tree-action.vue.d.ts +10 -0
  162. package/dist/types/components/design-table/row-actions/other-action.vue.d.ts +14 -0
  163. package/dist/types/components/design-tools/add-tool.vue.d.ts +23 -0
  164. package/dist/types/components/design-tools/command-executor.d.ts +80 -0
  165. package/dist/types/components/design-tools/export-tool.vue.d.ts +9 -0
  166. package/dist/types/components/design-tools/import-tool.vue.d.ts +14 -0
  167. package/dist/types/components/design-tools/index.d.ts +23 -0
  168. package/dist/types/components/design-tools/modal-comb-tool.vue.d.ts +12 -0
  169. package/dist/types/components/design-tools/modal-form-tool.vue.d.ts +12 -0
  170. package/dist/types/components/design-tools/modal-hcm-tool.vue.d.ts +23 -0
  171. package/dist/types/components/design-tools/modal-table-tool.vue.d.ts +12 -0
  172. package/dist/types/components/design-tools/modal-tree-tool.vue.d.ts +12 -0
  173. package/dist/types/components/design-tools/navigate-comb-tool.vue.d.ts +12 -0
  174. package/dist/types/components/design-tools/navigate-form-tool.vue.d.ts +11 -0
  175. package/dist/types/components/design-tools/navigate-table-tool.vue.d.ts +12 -0
  176. package/dist/types/components/design-tools/other-tool.vue.d.ts +16 -0
  177. package/dist/types/components/flow-status-cell/flow-status-cell.vue.d.ts +14 -0
  178. package/dist/types/components/index.d.ts +33 -0
  179. package/dist/types/flow.d.ts +50 -0
  180. package/dist/types/form/cell-condition.d.ts +35 -0
  181. package/dist/types/form/derived-express.d.ts +28 -0
  182. package/dist/types/form/design-form-inner.vue.d.ts +55 -0
  183. package/dist/types/form/design-form.vue.d.ts +96 -0
  184. package/dist/types/form/fields/checkbox-field.vue.d.ts +14 -0
  185. package/dist/types/form/fields/custom-field.vue.d.ts +22 -0
  186. package/dist/types/form/fields/date-field.vue.d.ts +12 -0
  187. package/dist/types/form/fields/embedded-list-field.vue.d.ts +26 -0
  188. package/dist/types/form/fields/file-field.vue.d.ts +12 -0
  189. package/dist/types/form/fields/image-field.vue.d.ts +12 -0
  190. package/dist/types/form/fields/index.d.ts +34 -0
  191. package/dist/types/form/fields/month-field.vue.d.ts +12 -0
  192. package/dist/types/form/fields/org-select-field.vue.d.ts +14 -0
  193. package/dist/types/form/fields/orgs-select-field.vue.d.ts +12 -0
  194. package/dist/types/form/fields/radio-field.vue.d.ts +14 -0
  195. package/dist/types/form/fields/select-field.vue.d.ts +14 -0
  196. package/dist/types/form/fields/splitline-field.vue.d.ts +7 -0
  197. package/dist/types/form/fields/switch-field.vue.d.ts +12 -0
  198. package/dist/types/form/fields/text-field.vue.d.ts +12 -0
  199. package/dist/types/form/fields/time-field.vue.d.ts +12 -0
  200. package/dist/types/form/fields/tree-field.vue.d.ts +12 -0
  201. package/dist/types/form/number-precision.d.ts +15 -0
  202. package/dist/types/form/transformer.d.ts +27 -0
  203. package/dist/types/host.d.ts +182 -0
  204. package/dist/types/http.d.ts +59 -0
  205. package/dist/types/index.d.ts +41 -0
  206. package/dist/types/mapping.d.ts +39 -0
  207. package/dist/types/org/dept-api.d.ts +12 -0
  208. package/dist/types/org/dept-tree-source.d.ts +15 -0
  209. package/dist/types/org/dept-tree.d.ts +62 -0
  210. package/dist/types/registry.d.ts +79 -0
  211. package/dist/types/search/design-search.vue.d.ts +46 -0
  212. package/dist/types/search/transformer.d.ts +36 -0
  213. package/dist/types/table/data.d.ts +30 -0
  214. package/dist/types/table/index.d.ts +20 -0
  215. package/dist/types/table/load-gate.d.ts +24 -0
  216. package/dist/types/table/query-body.d.ts +46 -0
  217. package/dist/types/table/query-dedupe.d.ts +42 -0
  218. package/dist/types/table/query-search.d.ts +21 -0
  219. package/dist/types/table/row-action-mapping.d.ts +36 -0
  220. package/dist/types/table/transformer.d.ts +59 -0
  221. package/dist/types/tree/design-tree.vue.d.ts +33 -0
  222. package/dist/types/types.d.ts +525 -0
  223. package/dist/types/utils/default-value.d.ts +16 -0
  224. package/dist/types/utils/download.d.ts +9 -0
  225. package/dist/types/utils/popup-width.d.ts +21 -0
  226. package/dist/utils/default-value.js +38 -0
  227. package/dist/utils/download.js +19 -0
  228. package/dist/utils/popup-width.js +19 -0
  229. package/package.json +73 -4
@@ -0,0 +1,182 @@
1
+ import { defineComponent, computed, ref, watch, openBlock, createElementBlock, Fragment, createVNode, unref, withCtx, createElementVNode, normalizeStyle, createBlock, createCommentVNode } from "vue";
2
+ import { Input, Modal, Spin, 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 _sfc_main = /* @__PURE__ */ defineComponent({
8
+ __name: "orgs-select-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
+ const isDisabled = computed(
19
+ () => props.disabled || props.cell.readonly === "2"
20
+ );
21
+ const modalVisible = ref(false);
22
+ const loading = ref(false);
23
+ const searchValue = ref("");
24
+ const treeData = ref([]);
25
+ const nameMap = ref({});
26
+ const checkedKeys = ref([]);
27
+ const displayText = computed(() => {
28
+ const val = props.modelValue;
29
+ if (val === void 0 || val === null || val === "") return "";
30
+ const ids = String(val).split(",").filter(Boolean);
31
+ return ids.map((id) => nameMap.value[id] || id).join("、");
32
+ });
33
+ const lazyTree = createLazyDeptTree(createDeptTreeSource());
34
+ async function loadRoot() {
35
+ if (treeData.value.length > 0) return;
36
+ loading.value = true;
37
+ try {
38
+ treeData.value = await lazyTree.treeNodesOf(0);
39
+ } catch (err) {
40
+ console.error("[orgs-select-field] 机构树加载失败:", (err == null ? void 0 : err.message) ?? err);
41
+ } finally {
42
+ loading.value = false;
43
+ }
44
+ }
45
+ async function onLoadData(node) {
46
+ const key = (node == null ? void 0 : node.key) ?? (node == null ? void 0 : node.eventKey);
47
+ if (key === void 0 || key === null) return;
48
+ try {
49
+ const children = await lazyTree.treeNodesOf(key);
50
+ treeData.value = attachChildren(treeData.value, key, children);
51
+ } catch (err) {
52
+ console.error("[orgs-select-field] 子机构加载失败:", (err == null ? void 0 : err.message) ?? err);
53
+ }
54
+ }
55
+ let searchTimer = null;
56
+ watch(searchValue, (val) => {
57
+ clearTimeout(searchTimer);
58
+ searchTimer = setTimeout(() => void runSearch(val ?? ""), 300);
59
+ });
60
+ async function runSearch(keyword) {
61
+ loading.value = true;
62
+ try {
63
+ if (!keyword) {
64
+ treeData.value = await lazyTree.treeNodesOf(0);
65
+ return;
66
+ }
67
+ const list = await deptList({ deptName: keyword });
68
+ treeData.value = await lazyTree.searchNodes(list ?? []);
69
+ } catch (err) {
70
+ console.error("[orgs-select-field] 机构搜索失败:", (err == null ? void 0 : err.message) ?? err);
71
+ } finally {
72
+ loading.value = false;
73
+ }
74
+ }
75
+ async function resolveNames(val) {
76
+ if (val === void 0 || val === null || val === "") return;
77
+ const ids = String(val).split(",").filter(Boolean);
78
+ for (const id of ids) {
79
+ if (nameMap.value[id]) continue;
80
+ try {
81
+ const { fullName } = await lazyTree.pathOf(id);
82
+ if (fullName) nameMap.value = { ...nameMap.value, [id]: fullName };
83
+ } catch (err) {
84
+ console.warn("[orgs-select-field] 机构回显解析失败:", (err == null ? void 0 : err.message) ?? err);
85
+ }
86
+ }
87
+ }
88
+ watch(
89
+ () => props.modelValue,
90
+ (val) => {
91
+ void resolveNames(val);
92
+ },
93
+ { immediate: true }
94
+ );
95
+ function openModal() {
96
+ if (isDisabled.value) return;
97
+ const val = props.modelValue;
98
+ checkedKeys.value = val == null || val === "" ? [] : String(val).split(",").filter(Boolean).map((id) => String(id));
99
+ modalVisible.value = true;
100
+ void loadRoot();
101
+ }
102
+ function handleCheck(keys) {
103
+ checkedKeys.value = (Array.isArray(keys) ? keys : (keys == null ? void 0 : keys.checked) ?? []).map(
104
+ (k) => String(k)
105
+ );
106
+ }
107
+ function handleOk() {
108
+ emit("update:modelValue", checkedKeys.value.join(","));
109
+ modalVisible.value = false;
110
+ }
111
+ function handleClear() {
112
+ checkedKeys.value = [];
113
+ emit("update:modelValue", "");
114
+ }
115
+ return (_ctx, _cache) => {
116
+ return openBlock(), createElementBlock(Fragment, null, [
117
+ createVNode(unref(Input), {
118
+ value: displayText.value,
119
+ disabled: isDisabled.value,
120
+ placeholder: `请选择${__props.cell.title}`,
121
+ "allow-clear": "",
122
+ onClear: handleClear,
123
+ onClick: openModal
124
+ }, {
125
+ suffix: withCtx(() => [
126
+ createElementVNode("span", {
127
+ style: normalizeStyle({
128
+ cursor: isDisabled.value ? "not-allowed" : "pointer",
129
+ color: "#bfbfbf",
130
+ marginLeft: "10px"
131
+ }),
132
+ onClick: openModal
133
+ }, [
134
+ createVNode(unref(SearchOutlined))
135
+ ], 4)
136
+ ]),
137
+ _: 1
138
+ }, 8, ["value", "disabled", "placeholder"]),
139
+ createVNode(unref(Modal), {
140
+ title: "机构选择(多选)",
141
+ open: modalVisible.value,
142
+ width: "640px",
143
+ "ok-text": "确定",
144
+ "cancel-text": "取消",
145
+ onOk: handleOk,
146
+ onCancel: _cache[1] || (_cache[1] = ($event) => modalVisible.value = false)
147
+ }, {
148
+ default: withCtx(() => [
149
+ createVNode(unref(Spin), { spinning: loading.value }, {
150
+ default: withCtx(() => [
151
+ createVNode(unref(Input), {
152
+ value: searchValue.value,
153
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
154
+ placeholder: "输入机构名称搜索",
155
+ "allow-clear": "",
156
+ style: { "margin-bottom": "12px" }
157
+ }, null, 8, ["value"]),
158
+ treeData.value.length > 0 ? (openBlock(), createBlock(unref(Tree), {
159
+ key: 0,
160
+ checkable: "",
161
+ "tree-data": treeData.value,
162
+ "field-names": { key: "key", title: "title", children: "children" },
163
+ "checked-keys": checkedKeys.value,
164
+ "load-data": onLoadData,
165
+ onCheck: handleCheck
166
+ }, null, 8, ["tree-data", "checked-keys"])) : !loading.value ? (openBlock(), createBlock(unref(Empty), {
167
+ key: 1,
168
+ description: "暂无机构数据"
169
+ })) : createCommentVNode("", true)
170
+ ]),
171
+ _: 1
172
+ }, 8, ["spinning"])
173
+ ]),
174
+ _: 1
175
+ }, 8, ["open"])
176
+ ], 64);
177
+ };
178
+ }
179
+ });
180
+ export {
181
+ _sfc_main as default
182
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./orgs-select-field.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,91 @@
1
+ import { defineComponent, computed, watch, openBlock, createBlock, unref, withCtx, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
2
+ import { RadioGroup, RadioButton } from "antdv-next";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "radio-field",
5
+ props: {
6
+ cell: {},
7
+ disabled: { type: Boolean },
8
+ modelValue: {}
9
+ },
10
+ emits: ["update:modelValue", "update:derived"],
11
+ setup(__props, { emit: __emit }) {
12
+ const props = __props;
13
+ const emit = __emit;
14
+ const value = computed({
15
+ get: () => props.modelValue != null ? String(props.modelValue) : void 0,
16
+ set: (val) => emit("update:modelValue", val)
17
+ });
18
+ function parseOptions() {
19
+ var _a;
20
+ if ((_a = props.cell.dicts) == null ? void 0 : _a.length) {
21
+ return props.cell.dicts.map((d) => ({
22
+ // 合并 select_sql 整行数据,树形/其它字段可直接取用(label/value 优先)
23
+ ...d.data || {},
24
+ label: d.dictLabel,
25
+ value: d.dictValue
26
+ }));
27
+ }
28
+ if (!props.cell.select_options) return [];
29
+ return props.cell.select_options.split("\n").map((line) => {
30
+ const [val, ...labelParts] = line.split("|");
31
+ return {
32
+ label: (labelParts.join("|") || val || "").trim(),
33
+ value: (val || "").trim()
34
+ };
35
+ }).filter((opt) => opt.value);
36
+ }
37
+ const options = computed(() => parseOptions());
38
+ function emitDerived() {
39
+ var _a;
40
+ const deriveTo = props.cell.deriveTo;
41
+ if (!(deriveTo == null ? void 0 : deriveTo.length)) return;
42
+ const item = (props.cell.dicts || []).find(
43
+ (d) => String(d.dictValue) === String(props.modelValue)
44
+ );
45
+ const derived = {};
46
+ let has = false;
47
+ for (const dt of deriveTo) {
48
+ let v;
49
+ if (item == null) {
50
+ v = null;
51
+ } else if (dt.source === "value") {
52
+ v = item.dictValue;
53
+ } else if (dt.source === "label") {
54
+ v = item.dictLabel;
55
+ } else {
56
+ v = (_a = item.data) == null ? void 0 : _a[dt.source];
57
+ }
58
+ if (v === void 0) continue;
59
+ derived[dt.field] = v;
60
+ has = true;
61
+ }
62
+ if (has) emit("update:derived", derived);
63
+ }
64
+ watch(() => props.modelValue, emitDerived, { immediate: true });
65
+ return (_ctx, _cache) => {
66
+ return openBlock(), createBlock(unref(RadioGroup), {
67
+ value: value.value,
68
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => value.value = $event),
69
+ disabled: props.disabled
70
+ }, {
71
+ default: withCtx(() => [
72
+ (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (opt, i) => {
73
+ return openBlock(), createBlock(unref(RadioButton), {
74
+ key: i,
75
+ value: opt.value
76
+ }, {
77
+ default: withCtx(() => [
78
+ createTextVNode(toDisplayString(opt.label), 1)
79
+ ]),
80
+ _: 2
81
+ }, 1032, ["value"]);
82
+ }), 128))
83
+ ]),
84
+ _: 1
85
+ }, 8, ["value", "disabled"]);
86
+ };
87
+ }
88
+ });
89
+ export {
90
+ _sfc_main as default
91
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./radio-field.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from "./select-field2.vue.js";
2
+ /* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const SelectField = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3f1bb602"]]);
5
+ export {
6
+ SelectField as default
7
+ };
@@ -0,0 +1,317 @@
1
+ import { defineComponent, inject, computed, ref, onMounted, watch, openBlock, createBlock, unref } from "vue";
2
+ import { Select } from "antdv-next";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "select-field",
5
+ props: {
6
+ cell: {},
7
+ disabled: { type: Boolean },
8
+ modelValue: {}
9
+ },
10
+ emits: ["update:modelValue", "update:derived"],
11
+ setup(__props, { emit: __emit }) {
12
+ const props = __props;
13
+ const emit = __emit;
14
+ const derivedValues = inject("derivedValues", {});
15
+ const formData = inject("formData", {});
16
+ const value = computed({
17
+ get: () => props.modelValue,
18
+ set: (val) => emit("update:modelValue", val)
19
+ });
20
+ const isDisabled = computed(
21
+ () => props.disabled || props.cell.readonly === "2"
22
+ );
23
+ function parseOptions() {
24
+ var _a;
25
+ if ((_a = props.cell.dicts) == null ? void 0 : _a.length) {
26
+ return props.cell.dicts.map((d) => ({
27
+ // 合并 select_sql 整行数据,树形/其它字段可直接取用(label/value 优先)
28
+ ...d.data || {},
29
+ label: d.dictLabel,
30
+ value: d.dictValue
31
+ }));
32
+ }
33
+ if (!props.cell.select_options) return [];
34
+ return props.cell.select_options.split("\n").map((line) => {
35
+ const [val, ...labelParts] = line.split("|");
36
+ return {
37
+ label: (labelParts.join("|") || val || "").trim(),
38
+ value: (val || "").trim()
39
+ };
40
+ }).filter((opt) => opt.value);
41
+ }
42
+ const compiledFns = /* @__PURE__ */ new Map();
43
+ const warnAssigned = /* @__PURE__ */ new Set();
44
+ function dictFilterDebugOn() {
45
+ var _a;
46
+ const g = globalThis.__DICT_FILTER_DEBUG__;
47
+ if (g === false) return false;
48
+ try {
49
+ if (localStorage.getItem("dictFilterDebug") === "off") return false;
50
+ if (new URLSearchParams(((_a = globalThis.location) == null ? void 0 : _a.search) ?? "").get("dictDebug") === "0")
51
+ return false;
52
+ } catch {
53
+ }
54
+ return true;
55
+ }
56
+ function collectMissingRefs(expr, rowKeys, dataKeys) {
57
+ const missRow = /* @__PURE__ */ new Set();
58
+ const missData = /* @__PURE__ */ new Set();
59
+ const re = /\b(row|data)\.([A-Za-z_$][\w$]*)/g;
60
+ let m;
61
+ while ((m = re.exec(expr)) !== null) {
62
+ const scope = m[1] ?? "";
63
+ const key = m[2] ?? "";
64
+ if (!key) continue;
65
+ if (scope === "row") {
66
+ if (!rowKeys.includes(key)) missRow.add(key);
67
+ } else if (!dataKeys.includes(key)) {
68
+ missData.add(key);
69
+ }
70
+ }
71
+ return { missData: [...missData], missRow: [...missRow] };
72
+ }
73
+ function findAssignEquals(expr) {
74
+ const hits = [];
75
+ const re = /([^=!<>])=(?!=)/g;
76
+ let m;
77
+ while ((m = re.exec(expr)) !== null) {
78
+ const pos = m.index + 1;
79
+ hits.push({
80
+ near: expr.slice(Math.max(0, pos - 24), pos + 16).replace(/\s+/g, " "),
81
+ pos
82
+ });
83
+ }
84
+ return hits;
85
+ }
86
+ function splitTopLevelOr(expr) {
87
+ const parts = [];
88
+ let depth = 0;
89
+ let quote = "";
90
+ let start = 0;
91
+ for (let i = 0; i < expr.length; i++) {
92
+ const ch = expr[i];
93
+ if (quote) {
94
+ if (ch === "\\") i++;
95
+ else if (ch === quote) quote = "";
96
+ continue;
97
+ }
98
+ if (ch === '"' || ch === "'" || ch === "`") {
99
+ quote = ch;
100
+ continue;
101
+ }
102
+ if (ch === "(" || ch === "[" || ch === "{") depth++;
103
+ else if (ch === ")" || ch === "]" || ch === "}") depth--;
104
+ else if (ch === "|" && expr[i + 1] === "|" && depth === 0) {
105
+ parts.push(expr.slice(start, i));
106
+ i++;
107
+ start = i + 1;
108
+ }
109
+ }
110
+ parts.push(expr.slice(start));
111
+ return parts.map((s) => s.trim()).filter(Boolean);
112
+ }
113
+ function compileLenient(expr) {
114
+ try {
115
+ return new Function("row", "data", `return (${expr});`);
116
+ } catch {
117
+ return null;
118
+ }
119
+ }
120
+ function compileFilter(expr) {
121
+ const cached = compiledFns.get(expr);
122
+ if (cached) return cached;
123
+ if (!warnAssigned.has(expr)) {
124
+ const assigns = findAssignEquals(expr);
125
+ if (assigns.length > 0) {
126
+ warnAssigned.add(expr);
127
+ console.warn(
128
+ `[select-field] dictFilter 疑似用了赋值 "="(比较请用 "==" 或 "==="):
129
+ ${expr}
130
+ ` + assigns.map((a, i) => ` ${i + 1}) 第 ${a.pos} 个字符处:…${a.near}…`).join("\n")
131
+ );
132
+ }
133
+ }
134
+ const fn = new Function("row", "data", `return (${expr});`);
135
+ compiledFns.set(expr, fn);
136
+ return fn;
137
+ }
138
+ const filteredOptions = ref([]);
139
+ const lastLogSig = /* @__PURE__ */ new Map();
140
+ function recomputeOptions() {
141
+ const raw = parseOptions();
142
+ const expr = props.cell.dictFilter;
143
+ const cellKey = String(props.cell.name ?? props.cell.title ?? "未命名");
144
+ const tag = `[dictFilter:${cellKey}]`;
145
+ const dbg = dictFilterDebugOn();
146
+ if (!expr) {
147
+ filteredOptions.value = raw;
148
+ if (dbg) console.log(`${tag} 未配置 dictFilter,选项 ${raw.length} 条`);
149
+ return;
150
+ }
151
+ const data = { ...formData, ...derivedValues };
152
+ const keySet = /* @__PURE__ */ new Set();
153
+ for (const opt of raw) for (const k of Object.keys(opt)) keySet.add(k);
154
+ const rowKeys = [...keySet];
155
+ const dataKeys = Object.keys(data);
156
+ let compiled = null;
157
+ let compileErr = null;
158
+ try {
159
+ compiled = compileFilter(expr);
160
+ } catch (err) {
161
+ compileErr = err;
162
+ }
163
+ if (!compiled) {
164
+ filteredOptions.value = [];
165
+ console.error(
166
+ `${tag} dictFilter 表达式【编译失败】,选项已全部清空:
167
+ ${expr}
168
+ 原因:${(compileErr == null ? void 0 : compileErr.message) ?? compileErr}`
169
+ );
170
+ const assigns = findAssignEquals(expr);
171
+ if (assigns.length > 0) {
172
+ console.error(
173
+ `${tag} 命门在此——把「比较」写成了「赋值」=,左侧是字面量会直接语法错误,请改成 == 或 ===:
174
+ ` + assigns.map((a, i) => ` ${i + 1}) 第 ${a.pos} 个字符处:…${a.near}…`).join("\n")
175
+ );
176
+ }
177
+ const miss0 = collectMissingRefs(expr, rowKeys, dataKeys);
178
+ if (miss0.missRow.length > 0) {
179
+ console.error(
180
+ `${tag} row 上不存在的字段(恒为 undefined):${miss0.missRow.join("、")}
181
+ row 实际字段:${rowKeys.join("、")}
182
+ 提示:比较选项值用 row.value,比较显示文本用 row.label`
183
+ );
184
+ }
185
+ if (miss0.missData.length > 0) {
186
+ console.error(
187
+ `${tag} data 上不存在的字段(恒为 undefined):${miss0.missData.join("、")}
188
+ data 实际字段:${dataKeys.join("、")}`
189
+ );
190
+ }
191
+ console.info(`${tag} 当前选项(前 3 条):`, raw.slice(0, 3));
192
+ return;
193
+ }
194
+ const pass = compiled;
195
+ try {
196
+ filteredOptions.value = raw.filter((opt) => !!pass(opt, data));
197
+ } catch (err) {
198
+ filteredOptions.value = [];
199
+ console.error(
200
+ `${tag} dictFilter【求值抛错】,选项已全部清空:
201
+ ${expr}
202
+ 原因:${(err == null ? void 0 : err.message) ?? err}
203
+ 提示:表达式由 new Function('row','data',…) 执行,只能引用 row / data(及全局变量)。选项值请写 row.value(显示文本 row.label,select_sql 其它列 row.<列名>),裸 value 取不到。`
204
+ );
205
+ return;
206
+ }
207
+ if (!dbg) return;
208
+ const sig = `${expr}|${JSON.stringify(data)}|${filteredOptions.value.length}`;
209
+ if (lastLogSig.get(cellKey) === sig) return;
210
+ lastLogSig.set(cellKey, sig);
211
+ const branches = splitTopLevelOr(expr).map((text, i) => ({
212
+ fn: compileLenient(text),
213
+ no: i + 1,
214
+ text
215
+ }));
216
+ const table = raw.map((opt) => {
217
+ const line = {
218
+ 命中: !!pass(opt, data),
219
+ 选项值: opt.value,
220
+ 选项标签: opt.label
221
+ };
222
+ for (const b of branches) {
223
+ const col = `分支${b.no}`;
224
+ if (!b.fn) {
225
+ line[col] = "编译失败";
226
+ continue;
227
+ }
228
+ try {
229
+ line[col] = !!b.fn(opt, data);
230
+ } catch (e) {
231
+ line[col] = `求值异常:${(e == null ? void 0 : e.message) ?? e}`;
232
+ }
233
+ }
234
+ return line;
235
+ });
236
+ console.groupCollapsed(
237
+ `${tag} dictFilter 过滤:${raw.length} 条 → ${filteredOptions.value.length} 条`
238
+ );
239
+ console.log("表达式:\n" + expr);
240
+ console.log("data(formData + derivedValues):", data);
241
+ console.log("row 可用字段:", rowKeys);
242
+ if (branches.length > 1) {
243
+ console.log("按顶层 || 拆分(分支1 = 表达式里第一个 (...)):");
244
+ for (const b of branches) console.log(` 分支${b.no}: ${b.text}`);
245
+ }
246
+ console.table(table);
247
+ console.log("保留的选项:", filteredOptions.value);
248
+ const miss = collectMissingRefs(expr, rowKeys, dataKeys);
249
+ if (miss.missRow.length > 0) {
250
+ console.warn(
251
+ `${tag} row 上不存在的字段(恒为 undefined,对应分支永远不成立):${miss.missRow.join("、")}
252
+ row 实际字段:${rowKeys.join("、")}
253
+ 提示:比较选项值用 row.value,比较显示文本用 row.label`
254
+ );
255
+ }
256
+ if (miss.missData.length > 0) {
257
+ console.warn(
258
+ `${tag} data 上不存在的字段(恒为 undefined,对应分支永远不成立):${miss.missData.join("、")}
259
+ data 实际字段:${dataKeys.join("、")}`
260
+ );
261
+ }
262
+ console.groupEnd();
263
+ }
264
+ onMounted(recomputeOptions);
265
+ watch(() => derivedValues, recomputeOptions, { deep: true });
266
+ watch(() => formData, recomputeOptions, { deep: true });
267
+ watch(filteredOptions, (opts) => {
268
+ const val = props.modelValue;
269
+ if (val === void 0 || val === null || val === "") return;
270
+ const exists = opts.some((o) => String(o.value) === String(val));
271
+ if (!exists) emit("update:modelValue", void 0);
272
+ });
273
+ function emitDerived() {
274
+ var _a;
275
+ const deriveTo = props.cell.deriveTo;
276
+ if (!(deriveTo == null ? void 0 : deriveTo.length)) return;
277
+ const item = (props.cell.dicts || []).find(
278
+ (d) => String(d.dictValue) === String(props.modelValue)
279
+ );
280
+ const derived = {};
281
+ let has = false;
282
+ for (const dt of deriveTo) {
283
+ let v;
284
+ if (item == null) {
285
+ v = null;
286
+ } else if (dt.source === "value") {
287
+ v = item.dictValue;
288
+ } else if (dt.source === "label") {
289
+ v = item.dictLabel;
290
+ } else {
291
+ v = (_a = item.data) == null ? void 0 : _a[dt.source];
292
+ }
293
+ if (v === void 0) continue;
294
+ derived[dt.field] = v;
295
+ has = true;
296
+ }
297
+ if (has) emit("update:derived", derived);
298
+ }
299
+ watch(() => props.modelValue, emitDerived, { immediate: true });
300
+ return (_ctx, _cache) => {
301
+ return openBlock(), createBlock(unref(Select), {
302
+ value: value.value,
303
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => value.value = $event),
304
+ disabled: isDisabled.value,
305
+ options: filteredOptions.value,
306
+ placeholder: `请选择${__props.cell.title}`,
307
+ "allow-clear": "",
308
+ "show-search": "",
309
+ class: "select-field",
310
+ style: { "width": "100%" }
311
+ }, null, 8, ["value", "disabled", "options", "placeholder"]);
312
+ };
313
+ }
314
+ });
315
+ export {
316
+ _sfc_main as default
317
+ };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from "./splitline-field2.vue.js";
2
+ /* empty css */
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const SplitlineField = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0127fd50"]]);
5
+ export {
6
+ SplitlineField as default
7
+ };
@@ -0,0 +1,50 @@
1
+ import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, toDisplayString } from "vue";
2
+ import { PartitionOutlined } from "@antdv-next/icons";
3
+ import { Divider } from "antdv-next";
4
+ const _hoisted_1 = { class: "splitline-title" };
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ __name: "splitline-field",
7
+ props: {
8
+ cell: {},
9
+ disabled: { type: Boolean }
10
+ },
11
+ setup(__props) {
12
+ const props = __props;
13
+ const titlePlacement = computed(() => {
14
+ const raw = props.cell.orientation;
15
+ if (raw === "center") return "center";
16
+ if (raw === "right") return "right";
17
+ return "left";
18
+ });
19
+ const vertical = computed(() => props.cell.orientation === "vertical");
20
+ const dashed = computed(
21
+ () => props.cell.dashed !== 0 && props.cell.dashed !== "0"
22
+ );
23
+ const plain = computed(
24
+ () => props.cell.plain !== 0 && props.cell.plain !== "0"
25
+ );
26
+ return (_ctx, _cache) => {
27
+ return __props.cell.title ? (openBlock(), createBlock(unref(Divider), {
28
+ key: 0,
29
+ "title-placement": titlePlacement.value,
30
+ vertical: vertical.value,
31
+ dashed: dashed.value,
32
+ plain: plain.value
33
+ }, {
34
+ default: withCtx(() => [
35
+ createElementVNode("span", _hoisted_1, [
36
+ createVNode(unref(PartitionOutlined)),
37
+ createElementVNode("span", null, toDisplayString(__props.cell.title), 1)
38
+ ])
39
+ ]),
40
+ _: 1
41
+ }, 8, ["title-placement", "vertical", "dashed", "plain"])) : (openBlock(), createBlock(unref(Divider), {
42
+ key: 1,
43
+ dashed: dashed.value
44
+ }, null, 8, ["dashed"]));
45
+ };
46
+ }
47
+ });
48
+ export {
49
+ _sfc_main as default
50
+ };