@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,47 @@
1
+ import { defineComponent, openBlock, createBlock, unref, withCtx, createTextVNode, toDisplayString } from "vue";
2
+ import { Button } from "antdv-next";
3
+ import { useRouter } from "vue-router";
4
+ import { buildNavigateQuery } from "../../../table/row-action-mapping.js";
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ ...{ name: "DesignTableNavigateCombAction" },
7
+ __name: "navigate-comb-action",
8
+ props: {
9
+ action: {},
10
+ category: {},
11
+ params: {},
12
+ pfield: {},
13
+ row: {}
14
+ },
15
+ setup(__props) {
16
+ const props = __props;
17
+ const router = useRouter();
18
+ function handleClick() {
19
+ const category = props.action.targetComboCategory || props.category || "";
20
+ const name = props.action.targetComboName;
21
+ if (!category || !name) return;
22
+ const query = buildNavigateQuery(
23
+ props.action.mappings,
24
+ props.params ?? {},
25
+ props.row,
26
+ props.pfield
27
+ );
28
+ router.push({ path: `/design/comb/${category}/${name}`, query }).catch(() => {
29
+ });
30
+ }
31
+ return (_ctx, _cache) => {
32
+ return openBlock(), createBlock(unref(Button), {
33
+ size: "small",
34
+ type: "link",
35
+ onClick: handleClick
36
+ }, {
37
+ default: withCtx(() => [
38
+ createTextVNode(toDisplayString(__props.action.title), 1)
39
+ ]),
40
+ _: 1
41
+ });
42
+ };
43
+ }
44
+ });
45
+ export {
46
+ _sfc_main as default
47
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./navigate-form-action2.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,47 @@
1
+ import { defineComponent, openBlock, createBlock, unref, withCtx, createTextVNode, toDisplayString } from "vue";
2
+ import { Button } from "antdv-next";
3
+ import { useRouter } from "vue-router";
4
+ import { buildNavigateQuery } from "../../../table/row-action-mapping.js";
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ ...{ name: "DesignTableNavigateFormAction" },
7
+ __name: "navigate-form-action",
8
+ props: {
9
+ action: {},
10
+ category: {},
11
+ params: {},
12
+ pfield: {},
13
+ row: {}
14
+ },
15
+ setup(__props) {
16
+ const props = __props;
17
+ const router = useRouter();
18
+ function handleClick() {
19
+ const category = props.action.targetFormCategory || props.category || "";
20
+ const name = props.action.targetFormName;
21
+ if (!category || !name) return;
22
+ const query = buildNavigateQuery(
23
+ props.action.mappings,
24
+ props.params ?? {},
25
+ props.row,
26
+ props.pfield
27
+ );
28
+ router.push({ path: `/design/form/${category}/${name}`, query }).catch(() => {
29
+ });
30
+ }
31
+ return (_ctx, _cache) => {
32
+ return openBlock(), createBlock(unref(Button), {
33
+ size: "small",
34
+ type: "link",
35
+ onClick: handleClick
36
+ }, {
37
+ default: withCtx(() => [
38
+ createTextVNode(toDisplayString(__props.action.title), 1)
39
+ ]),
40
+ _: 1
41
+ });
42
+ };
43
+ }
44
+ });
45
+ export {
46
+ _sfc_main as default
47
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./navigate-table-action2.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,47 @@
1
+ import { defineComponent, openBlock, createBlock, unref, withCtx, createTextVNode, toDisplayString } from "vue";
2
+ import { Button } from "antdv-next";
3
+ import { useRouter } from "vue-router";
4
+ import { buildNavigateQuery } from "../../../table/row-action-mapping.js";
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ ...{ name: "DesignTableNavigateTableAction" },
7
+ __name: "navigate-table-action",
8
+ props: {
9
+ action: {},
10
+ category: {},
11
+ params: {},
12
+ pfield: {},
13
+ row: {}
14
+ },
15
+ setup(__props) {
16
+ const props = __props;
17
+ const router = useRouter();
18
+ function handleClick() {
19
+ const category = props.action.targetTableCategory || props.category || "";
20
+ const name = props.action.targetTableName;
21
+ if (!category || !name) return;
22
+ const query = buildNavigateQuery(
23
+ props.action.mappings,
24
+ props.params ?? {},
25
+ props.row,
26
+ props.pfield
27
+ );
28
+ router.push({ path: `/design/table/${category}/${name}`, query }).catch(() => {
29
+ });
30
+ }
31
+ return (_ctx, _cache) => {
32
+ return openBlock(), createBlock(unref(Button), {
33
+ size: "small",
34
+ type: "link",
35
+ onClick: handleClick
36
+ }, {
37
+ default: withCtx(() => [
38
+ createTextVNode(toDisplayString(__props.action.title), 1)
39
+ ]),
40
+ _: 1
41
+ });
42
+ };
43
+ }
44
+ });
45
+ export {
46
+ _sfc_main as default
47
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./navigate-tree-action2.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,47 @@
1
+ import { defineComponent, openBlock, createBlock, unref, withCtx, createTextVNode, toDisplayString } from "vue";
2
+ import { Button } from "antdv-next";
3
+ import { useRouter } from "vue-router";
4
+ import { buildNavigateQuery } from "../../../table/row-action-mapping.js";
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ ...{ name: "DesignTableNavigateTreeAction" },
7
+ __name: "navigate-tree-action",
8
+ props: {
9
+ action: {},
10
+ category: {},
11
+ params: {},
12
+ pfield: {},
13
+ row: {}
14
+ },
15
+ setup(__props) {
16
+ const props = __props;
17
+ const router = useRouter();
18
+ function handleClick() {
19
+ const category = props.action.targetTreeCategory || props.category || "";
20
+ const name = props.action.targetTreeName;
21
+ if (!category || !name) return;
22
+ const query = buildNavigateQuery(
23
+ props.action.mappings,
24
+ props.params ?? {},
25
+ props.row,
26
+ props.pfield
27
+ );
28
+ router.push({ path: `/design/tree/${category}/${name}`, query }).catch(() => {
29
+ });
30
+ }
31
+ return (_ctx, _cache) => {
32
+ return openBlock(), createBlock(unref(Button), {
33
+ size: "small",
34
+ type: "link",
35
+ onClick: handleClick
36
+ }, {
37
+ default: withCtx(() => [
38
+ createTextVNode(toDisplayString(__props.action.title), 1)
39
+ ]),
40
+ _: 1
41
+ });
42
+ };
43
+ }
44
+ });
45
+ export {
46
+ _sfc_main as default
47
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./other-action2.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,44 @@
1
+ import { defineComponent, openBlock, createBlock, unref, withCtx, createTextVNode, toDisplayString } from "vue";
2
+ import { Button } from "antdv-next";
3
+ import { executeCommand } from "../../design-tools/command-executor.js";
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ ...{ name: "DesignTableOtherAction" },
6
+ __name: "other-action",
7
+ props: {
8
+ action: {},
9
+ category: {},
10
+ gridApi: {},
11
+ pfield: {},
12
+ row: {}
13
+ },
14
+ emits: ["command"],
15
+ setup(__props, { emit: __emit }) {
16
+ const props = __props;
17
+ const emit = __emit;
18
+ function handleClick() {
19
+ emit("command", props.action, props.row);
20
+ executeCommand(props.action.command, {
21
+ action: props.action,
22
+ category: props.category,
23
+ gridApi: props.gridApi,
24
+ pfield: props.pfield,
25
+ row: props.row
26
+ });
27
+ }
28
+ return (_ctx, _cache) => {
29
+ return openBlock(), createBlock(unref(Button), {
30
+ size: "small",
31
+ type: "link",
32
+ onClick: handleClick
33
+ }, {
34
+ default: withCtx(() => [
35
+ createTextVNode(toDisplayString(__props.action.title), 1)
36
+ ]),
37
+ _: 1
38
+ });
39
+ };
40
+ }
41
+ });
42
+ export {
43
+ _sfc_main as default
44
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./add-tool2.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,136 @@
1
+ import { defineComponent, computed, ref, unref, openBlock, createBlock, resolveDynamicComponent, withCtx, createCommentVNode } from "vue";
2
+ import { Drawer } from "antdv-next";
3
+ import { getHostPopup } from "../../host.js";
4
+ import { fetchFormConfig } from "../../api.js";
5
+ import DesignForm from "../../form/design-form.vue.js";
6
+ import { usePopupHost } from "../design-shared/popup-host.js";
7
+ import { DEFAULT_POPUP_WIDTH, resolvePopupWidth } from "../../utils/popup-width.js";
8
+ import { buildMappedParams } from "../../mapping.js";
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ ...{ name: "DesignTableAddTool" },
11
+ __name: "add-tool",
12
+ props: {
13
+ tool: {},
14
+ category: {},
15
+ gridApi: {},
16
+ extraParams: {},
17
+ mappingScope: {}
18
+ },
19
+ emits: ["saved"],
20
+ setup(__props, { expose: __expose, emit: __emit }) {
21
+ const props = __props;
22
+ const emit = __emit;
23
+ const popupHost = usePopupHost();
24
+ const useAntd = computed(() => popupHost === "antd" || !useVbenDrawer);
25
+ const formCategory = computed(() => {
26
+ return props.tool.targetFormCategory || props.category || "";
27
+ });
28
+ const toolLabel = props.tool.title || props.tool.label || "新增";
29
+ const formExtraParams = computed(() => ({
30
+ ...buildMappedParams(props.tool, props.mappingScope ?? {})
31
+ }));
32
+ const formRef = ref(null);
33
+ const useVbenDrawer = getHostPopup("drawer");
34
+ const [AddDrawer, addDrawerApi] = useVbenDrawer ? useVbenDrawer({ onClosed: handleClosed }) : [null, null];
35
+ let widthStyleEl = null;
36
+ function setDrawerWidth(width) {
37
+ if (widthStyleEl) {
38
+ widthStyleEl.textContent = `.design-add-drawer{width:${width}px!important}`;
39
+ } else {
40
+ widthStyleEl = document.createElement("style");
41
+ widthStyleEl.textContent = `.design-add-drawer{width:${width}px!important}`;
42
+ document.head.appendChild(widthStyleEl);
43
+ }
44
+ }
45
+ const antdOpen = ref(false);
46
+ const antdTitle = ref(toolLabel);
47
+ const antdWidth = ref(DEFAULT_POPUP_WIDTH);
48
+ const opening = ref(false);
49
+ const fetchedConfig = ref(null);
50
+ const openSeq = ref(0);
51
+ async function open() {
52
+ if (!props.tool.targetFormName) return;
53
+ opening.value = true;
54
+ try {
55
+ const cfg = await fetchFormConfig(formCategory.value, props.tool.targetFormName);
56
+ fetchedConfig.value = cfg;
57
+ openSeq.value += 1;
58
+ const width = resolvePopupWidth(cfg.width, props.tool.formWidth);
59
+ const title = cfg.title ? `${toolLabel} - ${cfg.title}` : toolLabel;
60
+ if (useAntd.value) {
61
+ antdWidth.value = width;
62
+ antdTitle.value = title;
63
+ antdOpen.value = true;
64
+ return;
65
+ }
66
+ setDrawerWidth(width);
67
+ addDrawerApi.setState({ class: "design-add-drawer", title, footer: false });
68
+ addDrawerApi.open();
69
+ } catch (err) {
70
+ console.error("加载表单配置失败:", (err == null ? void 0 : err.message) ?? err);
71
+ } finally {
72
+ opening.value = false;
73
+ }
74
+ }
75
+ function handleSaved() {
76
+ var _a, _b;
77
+ if (useAntd.value) {
78
+ antdOpen.value = false;
79
+ } else {
80
+ addDrawerApi.setState({ confirmLoading: false });
81
+ addDrawerApi.close();
82
+ }
83
+ (_b = (_a = props.gridApi) == null ? void 0 : _a.query) == null ? void 0 : _b.call(_a);
84
+ emit("saved");
85
+ }
86
+ function handleClosed() {
87
+ addDrawerApi.setState({ class: "", confirmLoading: false });
88
+ if (widthStyleEl) {
89
+ widthStyleEl.remove();
90
+ widthStyleEl = null;
91
+ }
92
+ }
93
+ __expose({ trigger: open });
94
+ return (_ctx, _cache) => {
95
+ return !useAntd.value && unref(AddDrawer) ? (openBlock(), createBlock(resolveDynamicComponent(unref(AddDrawer)), { key: 0 }, {
96
+ default: withCtx(() => [
97
+ __props.tool.targetFormName && fetchedConfig.value ? (openBlock(), createBlock(DesignForm, {
98
+ ref_key: "formRef",
99
+ ref: formRef,
100
+ key: `${__props.tool.targetFormName}-${openSeq.value}`,
101
+ config: fetchedConfig.value,
102
+ category: formCategory.value,
103
+ name: __props.tool.targetFormName,
104
+ "parent-params": formExtraParams.value,
105
+ mode: "standalone",
106
+ onSaved: handleSaved
107
+ }, null, 8, ["config", "category", "name", "parent-params"])) : createCommentVNode("", true)
108
+ ]),
109
+ _: 1
110
+ })) : (openBlock(), createBlock(unref(Drawer), {
111
+ key: 1,
112
+ open: antdOpen.value,
113
+ title: antdTitle.value,
114
+ width: antdWidth.value,
115
+ closable: true,
116
+ onClose: _cache[0] || (_cache[0] = ($event) => antdOpen.value = false)
117
+ }, {
118
+ default: withCtx(() => [
119
+ __props.tool.targetFormName && fetchedConfig.value ? (openBlock(), createBlock(DesignForm, {
120
+ key: `antd-add-${__props.tool.targetFormName}-${openSeq.value}`,
121
+ config: fetchedConfig.value,
122
+ category: formCategory.value,
123
+ name: __props.tool.targetFormName,
124
+ "parent-params": formExtraParams.value,
125
+ mode: "standalone",
126
+ onSaved: handleSaved
127
+ }, null, 8, ["config", "category", "name", "parent-params"])) : createCommentVNode("", true)
128
+ ]),
129
+ _: 1
130
+ }, 8, ["open", "title", "width"]));
131
+ };
132
+ }
133
+ });
134
+ export {
135
+ _sfc_main as default
136
+ };
@@ -0,0 +1,135 @@
1
+ import { ref, createApp, h } from "vue";
2
+ import { Modal } from "antdv-next";
3
+ import { getDesignHost } from "../../host.js";
4
+ import { resolveDesignComponent } from "../../registry.js";
5
+ import { platformMessage } from "../design-shared/host-api.js";
6
+ function mountInModal(Comp, opts = {}) {
7
+ const container = document.createElement("div");
8
+ document.body.appendChild(container);
9
+ const open = ref(true);
10
+ let app;
11
+ const close = () => {
12
+ open.value = false;
13
+ window.setTimeout(() => {
14
+ app == null ? void 0 : app.unmount();
15
+ container.remove();
16
+ }, 300);
17
+ };
18
+ const Wrapper = {
19
+ setup() {
20
+ return () => h(
21
+ Modal,
22
+ {
23
+ footer: null,
24
+ onCancel: close,
25
+ open: open.value,
26
+ title: opts.title,
27
+ width: opts.width ?? 720
28
+ },
29
+ { default: () => h(Comp, { ...opts.props, ...opts.on }) }
30
+ );
31
+ }
32
+ };
33
+ app = createApp(Wrapper);
34
+ app.mount(container);
35
+ return { close };
36
+ }
37
+ async function openComponent(comname, opts = {}) {
38
+ const name = String(comname ?? "").trim();
39
+ const Comp = resolveDesignComponent(name);
40
+ if (!Comp) {
41
+ throw new Error(
42
+ `[design-runtime] openComponent 未注册的组件「${name}」:请在宿主的注册表里用 registerComponents() 登记这个名字(旧写法 /src/views/xxx.vue 的路径式加载已废弃)`
43
+ );
44
+ }
45
+ return mountInModal(Comp, opts);
46
+ }
47
+ let warnedNav = false;
48
+ let warnedModal = false;
49
+ async function executeCommand(command, context, helpers = {}) {
50
+ if (!(command == null ? void 0 : command.trim())) return;
51
+ const { row = {}, action } = context;
52
+ const message = platformMessage();
53
+ const api = {
54
+ /** 打开 URL */
55
+ openUrl: (url, target = "_blank") => window.open(url, target),
56
+ /** SPA 内部路由跳转(调用方传入的 vue-router 实例) */
57
+ navigate: (to, options = {}) => {
58
+ var _a;
59
+ const { nav } = context;
60
+ if (!nav) {
61
+ if (!warnedNav) {
62
+ warnedNav = true;
63
+ console.warn(
64
+ "[design-runtime] 脚本调用了 api.navigate,但上下文没有 nav:请在组件里把 useRouter() 的结果作为 ctx.nav 传入 executeCommand()"
65
+ );
66
+ }
67
+ return;
68
+ }
69
+ const navResult = options.replace ? ((_a = nav.replace) == null ? void 0 : _a.call(nav, to)) ?? nav.push(to) : nav.push(to);
70
+ Promise.resolve(navResult).catch(
71
+ (error) => console.error("路由跳转失败:", error)
72
+ );
73
+ },
74
+ /** 动态加载组件并渲染到弹窗(comname 注册表) */
75
+ openComponent,
76
+ /** 刷新表格 */
77
+ refresh: () => {
78
+ var _a, _b;
79
+ return (_b = (_a = context.gridApi) == null ? void 0 : _a.query) == null ? void 0 : _b.call(_a);
80
+ },
81
+ /** 全局消息(宿主 message) */
82
+ message,
83
+ /** 确认框(宿主 modal.confirm) */
84
+ confirm: (opts) => {
85
+ const { modal } = getDesignHost();
86
+ if (!modal) {
87
+ warnMissingModal("confirm");
88
+ return;
89
+ }
90
+ modal.confirm(opts);
91
+ },
92
+ /** 打开一个信息/确认弹窗 */
93
+ openDialog: (opts = {}) => {
94
+ const { title = "提示", content = "", onOk } = opts;
95
+ const { modal } = getDesignHost();
96
+ if (!modal) {
97
+ warnMissingModal("openDialog");
98
+ message.warning(String(content) || String(title));
99
+ return;
100
+ }
101
+ if (onOk) {
102
+ modal.confirm({ content, onOk, title });
103
+ } else if (modal.info) {
104
+ modal.info({ content, title });
105
+ } else {
106
+ message.warning(String(content) || String(title));
107
+ }
108
+ },
109
+ ...helpers
110
+ };
111
+ const fn = new Function(
112
+ "row",
113
+ "action",
114
+ "ctx",
115
+ "api",
116
+ `"use strict"; return (async function () { ${command} })();`
117
+ );
118
+ try {
119
+ return await fn(row, action, context, api);
120
+ } catch (err) {
121
+ console.error("[design-runtime] 脚本执行失败:", err);
122
+ message.error(`脚本执行失败:${(err == null ? void 0 : err.message) ?? err}`);
123
+ }
124
+ }
125
+ function warnMissingModal(where) {
126
+ if (warnedModal) return;
127
+ warnedModal = true;
128
+ console.warn(
129
+ `[design-runtime] 脚本用了 api.${where},但未注入 host.modal:已降级为轻提示。请在 installDesignPlatform({ modal }) 里注入 antd 的 modal 实例`
130
+ );
131
+ }
132
+ export {
133
+ executeCommand,
134
+ openComponent
135
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./export-tool2.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,46 @@
1
+ import { defineComponent, ref, createCommentVNode } from "vue";
2
+ import { requireHttp } from "../../host.js";
3
+ import { downloadByData } from "../../utils/download.js";
4
+ import { platformMessage } from "../design-shared/host-api.js";
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ ...{ name: "DesignTableExportTool" },
7
+ __name: "export-tool",
8
+ props: {
9
+ tool: {}
10
+ },
11
+ setup(__props, { expose: __expose }) {
12
+ const props = __props;
13
+ const exporting = ref(false);
14
+ const message = platformMessage();
15
+ async function execute() {
16
+ if (!props.tool.url) return;
17
+ exporting.value = true;
18
+ const hide = message.loading("导出中,请稍候...");
19
+ try {
20
+ const http = requireHttp();
21
+ if (!http.download) {
22
+ throw new Error(
23
+ "宿主未提供 http.download 能力:导出需要下载二进制流,请在 installDesignPlatform({ http: { ..., download } }) 里实现"
24
+ );
25
+ }
26
+ const blob = await http.download(props.tool.url);
27
+ hide();
28
+ downloadByData(blob, `export_${Date.now()}.xlsx`);
29
+ message.success("导出成功");
30
+ } catch (err) {
31
+ hide();
32
+ console.error("导出失败:", (err == null ? void 0 : err.message) ?? err);
33
+ message.error(`导出失败:${(err == null ? void 0 : err.message) ?? err}`);
34
+ } finally {
35
+ exporting.value = false;
36
+ }
37
+ }
38
+ __expose({ trigger: execute });
39
+ return (_ctx, _cache) => {
40
+ return createCommentVNode("", true);
41
+ };
42
+ }
43
+ });
44
+ export {
45
+ _sfc_main as default
46
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./import-tool2.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };