@zeng-alt/formkit-form-builder 1.3.0 → 2.0.0

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 (231) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +323 -137
  3. package/dist/builder.css +1 -1
  4. package/dist/builder.es.js +7916 -42625
  5. package/dist/builder.es.js.map +1 -0
  6. package/dist/builder.umd.js +61 -90
  7. package/dist/chunks/AiPrompt-CWUhBDH4.js +174 -0
  8. package/dist/chunks/AiPrompt-CWUhBDH4.js.map +1 -0
  9. package/dist/chunks/BadgeEditor-B1kB2DXg.js +133 -0
  10. package/dist/chunks/BadgeEditor-B1kB2DXg.js.map +1 -0
  11. package/dist/chunks/BuilderPreview-CKL5bqCP.js +142 -0
  12. package/dist/chunks/BuilderPreview-CKL5bqCP.js.map +1 -0
  13. package/dist/chunks/ButtonGroupEditor-C5pChDFz.js +55 -0
  14. package/dist/chunks/ButtonGroupEditor-C5pChDFz.js.map +1 -0
  15. package/dist/chunks/CardEditor-Bsbriwvu.js +61 -0
  16. package/dist/chunks/CardEditor-Bsbriwvu.js.map +1 -0
  17. package/dist/chunks/CheckboxEditor-CxNEvn_Y.js +23 -0
  18. package/dist/chunks/CheckboxEditor-CxNEvn_Y.js.map +1 -0
  19. package/dist/chunks/CollapseEditor-CUFTdj0V.js +36 -0
  20. package/dist/chunks/CollapseEditor-CUFTdj0V.js.map +1 -0
  21. package/dist/chunks/ColorEditor-Bo9QkLsR.js +17 -0
  22. package/dist/chunks/ColorEditor-Bo9QkLsR.js.map +1 -0
  23. package/dist/chunks/DataTableContainerPreview-phlGcigM.js +403 -0
  24. package/dist/chunks/DataTableContainerPreview-phlGcigM.js.map +1 -0
  25. package/dist/chunks/DataTableEditor-BTDWXdtk.js +473 -0
  26. package/dist/chunks/DataTableEditor-BTDWXdtk.js.map +1 -0
  27. package/dist/chunks/DataTableFieldPicker-qWxGmVxr.js +1579 -0
  28. package/dist/chunks/DataTableFieldPicker-qWxGmVxr.js.map +1 -0
  29. package/dist/chunks/DataTableRowCellInput-BLTM3I21.js +195 -0
  30. package/dist/chunks/DataTableRowCellInput-BLTM3I21.js.map +1 -0
  31. package/dist/chunks/DataTableSearchField-PU89hniM.js +81 -0
  32. package/dist/chunks/DataTableSearchField-PU89hniM.js.map +1 -0
  33. package/dist/chunks/DateLikeEditor-ZkCbMhpE.js +74 -0
  34. package/dist/chunks/DateLikeEditor-ZkCbMhpE.js.map +1 -0
  35. package/dist/chunks/DateTimeEditor-C-jZKTT5.js +73 -0
  36. package/dist/chunks/DateTimeEditor-C-jZKTT5.js.map +1 -0
  37. package/dist/chunks/EditorSection-BR3qdK2c.js +23 -0
  38. package/dist/chunks/EditorSection-BR3qdK2c.js.map +1 -0
  39. package/dist/chunks/EditsLayout-fueCrxZM.js +22 -0
  40. package/dist/chunks/EditsLayout-fueCrxZM.js.map +1 -0
  41. package/dist/chunks/ExprEditModal-CeXiPStM.js +540 -0
  42. package/dist/chunks/ExprEditModal-CeXiPStM.js.map +1 -0
  43. package/dist/chunks/FileEditor-BXELd_SD.js +35 -0
  44. package/dist/chunks/FileEditor-BXELd_SD.js.map +1 -0
  45. package/dist/chunks/FormRenderer-BwykpB3h.js +2625 -0
  46. package/dist/chunks/FormRenderer-BwykpB3h.js.map +1 -0
  47. package/dist/chunks/GroupEditor-DchDUDDY.js +13 -0
  48. package/dist/chunks/GroupEditor-DchDUDDY.js.map +1 -0
  49. package/dist/chunks/HistoryPanel-1p0-Obef.js +104 -0
  50. package/dist/chunks/HistoryPanel-1p0-Obef.js.map +1 -0
  51. package/dist/chunks/ImportExportModal-CTqkyp1s.js +266 -0
  52. package/dist/chunks/ImportExportModal-CTqkyp1s.js.map +1 -0
  53. package/dist/chunks/InlineEditableText-BO-dT5rp.js +68 -0
  54. package/dist/chunks/InlineEditableText-BO-dT5rp.js.map +1 -0
  55. package/dist/chunks/InputGroupEditor-D_5giZtN.js +13 -0
  56. package/dist/chunks/InputGroupEditor-D_5giZtN.js.map +1 -0
  57. package/dist/chunks/IssuesPanel-CW5bdwvC.js +82 -0
  58. package/dist/chunks/IssuesPanel-CW5bdwvC.js.map +1 -0
  59. package/dist/chunks/JsCodeEditor-CIPxhwZa.js +751 -0
  60. package/dist/chunks/JsCodeEditor-CIPxhwZa.js.map +1 -0
  61. package/dist/chunks/JsonTextarea-C3mnRwtG.js +54 -0
  62. package/dist/chunks/JsonTextarea-C3mnRwtG.js.map +1 -0
  63. package/dist/chunks/ListEditor-C1hn5yOi.js +25 -0
  64. package/dist/chunks/ListEditor-C1hn5yOi.js.map +1 -0
  65. package/dist/chunks/NaiveAlertEditor-DACimYS1.js +67 -0
  66. package/dist/chunks/NaiveAlertEditor-DACimYS1.js.map +1 -0
  67. package/dist/chunks/NaiveAutoCompleteEditor-CtCvPe7H.js +122 -0
  68. package/dist/chunks/NaiveAutoCompleteEditor-CtCvPe7H.js.map +1 -0
  69. package/dist/chunks/NaiveAvatarEditor-CmDUodoa.js +36 -0
  70. package/dist/chunks/NaiveAvatarEditor-CmDUodoa.js.map +1 -0
  71. package/dist/chunks/NaiveBackTopEditor-Iq-li1JT.js +69 -0
  72. package/dist/chunks/NaiveBackTopEditor-Iq-li1JT.js.map +1 -0
  73. package/dist/chunks/NaiveBasicSection-wNyhGLou.js +184 -0
  74. package/dist/chunks/NaiveBasicSection-wNyhGLou.js.map +1 -0
  75. package/dist/chunks/NaiveBlockquoteEditor-BfqWqKwF.js +13 -0
  76. package/dist/chunks/NaiveBlockquoteEditor-BfqWqKwF.js.map +1 -0
  77. package/dist/chunks/NaiveButtonEditor-B4Rp2T7n.js +168 -0
  78. package/dist/chunks/NaiveButtonEditor-B4Rp2T7n.js.map +1 -0
  79. package/dist/chunks/NaiveCascaderEditor-BtD6KRXl.js +26 -0
  80. package/dist/chunks/NaiveCascaderEditor-BtD6KRXl.js.map +1 -0
  81. package/dist/chunks/NaiveDividerEditor-B1dPteDV.js +52 -0
  82. package/dist/chunks/NaiveDividerEditor-B1dPteDV.js.map +1 -0
  83. package/dist/chunks/NaiveH1Editor-Can7c9mh.js +14 -0
  84. package/dist/chunks/NaiveH1Editor-Can7c9mh.js.map +1 -0
  85. package/dist/chunks/NaiveH2Editor-BRKeEVf4.js +14 -0
  86. package/dist/chunks/NaiveH2Editor-BRKeEVf4.js.map +1 -0
  87. package/dist/chunks/NaiveH3Editor-DCdyd3-n.js +14 -0
  88. package/dist/chunks/NaiveH3Editor-DCdyd3-n.js.map +1 -0
  89. package/dist/chunks/NaiveH4Editor-COFS6udv.js +14 -0
  90. package/dist/chunks/NaiveH4Editor-COFS6udv.js.map +1 -0
  91. package/dist/chunks/NaiveH5Editor-CQEe6s1O.js +14 -0
  92. package/dist/chunks/NaiveH5Editor-CQEe6s1O.js.map +1 -0
  93. package/dist/chunks/NaiveH6Editor-DHGzIUAl.js +14 -0
  94. package/dist/chunks/NaiveH6Editor-DHGzIUAl.js.map +1 -0
  95. package/dist/chunks/NaiveHeaderEditor-Cy02AmLI.js +12 -0
  96. package/dist/chunks/NaiveHeaderEditor-Cy02AmLI.js.map +1 -0
  97. package/dist/chunks/NaiveImageEditor-WyVYLNbT.js +201 -0
  98. package/dist/chunks/NaiveImageEditor-WyVYLNbT.js.map +1 -0
  99. package/dist/chunks/NaiveLiEditor-CC65rrna.js +13 -0
  100. package/dist/chunks/NaiveLiEditor-CC65rrna.js.map +1 -0
  101. package/dist/chunks/NaiveLinkEditor-DkjFrzEE.js +38 -0
  102. package/dist/chunks/NaiveLinkEditor-DkjFrzEE.js.map +1 -0
  103. package/dist/chunks/NaiveMentionEditor-BupocM2c.js +23 -0
  104. package/dist/chunks/NaiveMentionEditor-BupocM2c.js.map +1 -0
  105. package/dist/chunks/NaiveOlEditor-DYFqg6Sp.js +16 -0
  106. package/dist/chunks/NaiveOlEditor-DYFqg6Sp.js.map +1 -0
  107. package/dist/chunks/NaiveParagraphEditor-B3Ju6ZNI.js +104 -0
  108. package/dist/chunks/NaiveParagraphEditor-B3Ju6ZNI.js.map +1 -0
  109. package/dist/chunks/NaiveProgressEditor-CwpsZG2z.js +119 -0
  110. package/dist/chunks/NaiveProgressEditor-CwpsZG2z.js.map +1 -0
  111. package/dist/chunks/NaiveQrCodeEditor-YWWAozHe.js +77 -0
  112. package/dist/chunks/NaiveQrCodeEditor-YWWAozHe.js.map +1 -0
  113. package/dist/chunks/NaiveRateEditor-BVY1QiXv.js +44 -0
  114. package/dist/chunks/NaiveRateEditor-BVY1QiXv.js.map +1 -0
  115. package/dist/chunks/NaiveSwitchEditor-BP1v-oZf.js +17 -0
  116. package/dist/chunks/NaiveSwitchEditor-BP1v-oZf.js.map +1 -0
  117. package/dist/chunks/NaiveTextEditor-C38l4Q-j.js +107 -0
  118. package/dist/chunks/NaiveTextEditor-C38l4Q-j.js.map +1 -0
  119. package/dist/chunks/NaiveTransferEditor-BRH_5ioX.js +19 -0
  120. package/dist/chunks/NaiveTransferEditor-BRH_5ioX.js.map +1 -0
  121. package/dist/chunks/NaiveTreeSelectEditor-jX2DrMcT.js +26 -0
  122. package/dist/chunks/NaiveTreeSelectEditor-jX2DrMcT.js.map +1 -0
  123. package/dist/chunks/NaiveUlEditor-CMKofBid.js +16 -0
  124. package/dist/chunks/NaiveUlEditor-CMKofBid.js.map +1 -0
  125. package/dist/chunks/NumberEditor-0P2Li_GH.js +40 -0
  126. package/dist/chunks/NumberEditor-0P2Li_GH.js.map +1 -0
  127. package/dist/chunks/NumberInput-DU-FiLxW.js +37 -0
  128. package/dist/chunks/NumberInput-DU-FiLxW.js.map +1 -0
  129. package/dist/chunks/OptionsLayoutSection-C9gVadRA.js +21 -0
  130. package/dist/chunks/OptionsLayoutSection-C9gVadRA.js.map +1 -0
  131. package/dist/chunks/OptionsSourceTabs-3fsum0OI.js +628 -0
  132. package/dist/chunks/OptionsSourceTabs-3fsum0OI.js.map +1 -0
  133. package/dist/chunks/OptionsTagsSection-vKkxlWLw.js +31 -0
  134. package/dist/chunks/OptionsTagsSection-vKkxlWLw.js.map +1 -0
  135. package/dist/chunks/PasswordEditor-Igld1ak6.js +29 -0
  136. package/dist/chunks/PasswordEditor-Igld1ak6.js.map +1 -0
  137. package/dist/chunks/PlaceholderSection-BKOS-7Qu.js +26 -0
  138. package/dist/chunks/PlaceholderSection-BKOS-7Qu.js.map +1 -0
  139. package/dist/chunks/RadioEditor-CyJhILjI.js +23 -0
  140. package/dist/chunks/RadioEditor-CyJhILjI.js.map +1 -0
  141. package/dist/chunks/RangeEditor-PGOnGfuV.js +86 -0
  142. package/dist/chunks/RangeEditor-PGOnGfuV.js.map +1 -0
  143. package/dist/chunks/RichText-DqcMtoil.js +424 -0
  144. package/dist/chunks/RichText-DqcMtoil.js.map +1 -0
  145. package/dist/chunks/RichTextEditor-EfA6m9w2.js +81 -0
  146. package/dist/chunks/RichTextEditor-EfA6m9w2.js.map +1 -0
  147. package/dist/chunks/SelectEditor-mJ_zUivj.js +21 -0
  148. package/dist/chunks/SelectEditor-mJ_zUivj.js.map +1 -0
  149. package/dist/chunks/SelectInput-DY4Oi2Lp.js +31 -0
  150. package/dist/chunks/SelectInput-DY4Oi2Lp.js.map +1 -0
  151. package/dist/chunks/SignatureEditor-BNttg68X.js +52 -0
  152. package/dist/chunks/SignatureEditor-BNttg68X.js.map +1 -0
  153. package/dist/chunks/SignaturePad-qhmoMg1E.js +170 -0
  154. package/dist/chunks/SignaturePad-qhmoMg1E.js.map +1 -0
  155. package/dist/chunks/StepsEditor-C8U-ext8.js +63 -0
  156. package/dist/chunks/StepsEditor-C8U-ext8.js.map +1 -0
  157. package/dist/chunks/SubmitEditor-B9R984q8.js +168 -0
  158. package/dist/chunks/SubmitEditor-B9R984q8.js.map +1 -0
  159. package/dist/chunks/SwitchInput-DQrSTyW0.js +34 -0
  160. package/dist/chunks/SwitchInput-DQrSTyW0.js.map +1 -0
  161. package/dist/chunks/TabsEditor-DepUhmsz.js +100 -0
  162. package/dist/chunks/TabsEditor-DepUhmsz.js.map +1 -0
  163. package/dist/chunks/TagsInput-DeG3Om1R.js +36 -0
  164. package/dist/chunks/TagsInput-DeG3Om1R.js.map +1 -0
  165. package/dist/chunks/TemplatePickerModal-DPkdJJJs.js +440 -0
  166. package/dist/chunks/TemplatePickerModal-DPkdJJJs.js.map +1 -0
  167. package/dist/chunks/TextInput-D1EMeBPf.js +53 -0
  168. package/dist/chunks/TextInput-D1EMeBPf.js.map +1 -0
  169. package/dist/chunks/TextLikeEditor-Du0nHQWQ.js +56 -0
  170. package/dist/chunks/TextLikeEditor-Du0nHQWQ.js.map +1 -0
  171. package/dist/chunks/ToggleInput-DoZPwM0A.js +51 -0
  172. package/dist/chunks/ToggleInput-DoZPwM0A.js.map +1 -0
  173. package/dist/chunks/_plugin-vue_export-helper-BxNYtmDu.js +8 -0
  174. package/dist/chunks/axios-agM_iOnv.js +1589 -0
  175. package/dist/chunks/axios-agM_iOnv.js.map +1 -0
  176. package/dist/chunks/bind-runtime-CRyrBYCi.js +58 -0
  177. package/dist/chunks/bind-runtime-CRyrBYCi.js.map +1 -0
  178. package/dist/chunks/canvas-locate-CxDD4bDp.js +64 -0
  179. package/dist/chunks/canvas-locate-CxDD4bDp.js.map +1 -0
  180. package/dist/chunks/context-4zkSHwVA.js +2510 -0
  181. package/dist/chunks/context-4zkSHwVA.js.map +1 -0
  182. package/dist/chunks/create-form-builder-state-CoXaJhWO.js +358 -0
  183. package/dist/chunks/create-form-builder-state-CoXaJhWO.js.map +1 -0
  184. package/dist/chunks/date-family-BYkr1OaE.js +75 -0
  185. package/dist/chunks/date-family-BYkr1OaE.js.map +1 -0
  186. package/dist/chunks/evaluator-DqNftI0d.js +139 -0
  187. package/dist/chunks/evaluator-DqNftI0d.js.map +1 -0
  188. package/dist/chunks/expr-parse-u7_CxMWg.js +463 -0
  189. package/dist/chunks/expr-parse-u7_CxMWg.js.map +1 -0
  190. package/dist/chunks/expr-source-BRPYrxuB.js +118 -0
  191. package/dist/chunks/expr-source-BRPYrxuB.js.map +1 -0
  192. package/dist/chunks/form-builder-plugin-BCbiWZKT.js +280 -0
  193. package/dist/chunks/form-builder-plugin-BCbiWZKT.js.map +1 -0
  194. package/dist/chunks/form-fields-DjLk8iH2.js +877 -0
  195. package/dist/chunks/form-fields-DjLk8iH2.js.map +1 -0
  196. package/dist/chunks/form-layout-Dm4QeYrL.js +69 -0
  197. package/dist/chunks/form-layout-Dm4QeYrL.js.map +1 -0
  198. package/dist/chunks/grid-C8xMKll5.js +137 -0
  199. package/dist/chunks/grid-C8xMKll5.js.map +1 -0
  200. package/dist/chunks/keys-D4DlFgJT.js +61 -0
  201. package/dist/chunks/keys-D4DlFgJT.js.map +1 -0
  202. package/dist/chunks/media-family-B4Wijm18.js +178 -0
  203. package/dist/chunks/media-family-B4Wijm18.js.map +1 -0
  204. package/dist/chunks/misc-family-CQJhCKco.js +133 -0
  205. package/dist/chunks/misc-family-CQJhCKco.js.map +1 -0
  206. package/dist/chunks/rich-text-toolbar-CQidmjGI.js +32 -0
  207. package/dist/chunks/rich-text-toolbar-CQidmjGI.js.map +1 -0
  208. package/dist/chunks/rolldown-runtime-DMoxecvO.js +11 -0
  209. package/dist/chunks/schema-adapter-_sLPmdLy.js +2089 -0
  210. package/dist/chunks/schema-adapter-_sLPmdLy.js.map +1 -0
  211. package/dist/chunks/selection-family-T_wZGrXc.js +249 -0
  212. package/dist/chunks/selection-family-T_wZGrXc.js.map +1 -0
  213. package/dist/chunks/use-ai-prompt-focus-39DHK41R.js +14 -0
  214. package/dist/chunks/use-ai-prompt-focus-39DHK41R.js.map +1 -0
  215. package/dist/chunks/use-bind-events-C-H7jhW_.js +89 -0
  216. package/dist/chunks/use-bind-events-C-H7jhW_.js.map +1 -0
  217. package/dist/chunks/use-config-DTr8dhzM.js +16 -0
  218. package/dist/chunks/use-config-DTr8dhzM.js.map +1 -0
  219. package/dist/chunks/use-dictionary-BAN34x49.js +26 -0
  220. package/dist/chunks/use-dictionary-BAN34x49.js.map +1 -0
  221. package/dist/chunks/use-dynamic-options-DbGSz-3_.js +29 -0
  222. package/dist/chunks/use-dynamic-options-DbGSz-3_.js.map +1 -0
  223. package/dist/chunks/use-schema-render-data-DagOPKiy.js +33 -0
  224. package/dist/chunks/use-schema-render-data-DagOPKiy.js.map +1 -0
  225. package/dist/chunks/utils-DlUMv2vG.js +53 -0
  226. package/dist/chunks/utils-DlUMv2vG.js.map +1 -0
  227. package/dist/index.d.ts +244 -1079
  228. package/dist/renderer.d.ts +632 -0
  229. package/dist/renderer.es.js +6 -0
  230. package/dist/renderer.umd.js +34 -0
  231. package/package.json +39 -24
@@ -0,0 +1,628 @@
1
+ import { n as e, t } from "./use-dictionary-BAN34x49.js";
2
+ import { n } from "./context-4zkSHwVA.js";
3
+ import { r } from "./create-form-builder-state-CoXaJhWO.js";
4
+ import { t as i } from "./form-fields-DjLk8iH2.js";
5
+ import { t as a } from "./EditorSection-BR3qdK2c.js";
6
+ import { t as o } from "./EditsLayout-fueCrxZM.js";
7
+ import { t as s } from "./JsonTextarea-C3mnRwtG.js";
8
+ import { t as c } from "./TagsInput-DeG3Om1R.js";
9
+ import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createTextVNode as h, createVNode as g, defineComponent as _, h as v, openBlock as y, ref as b, renderList as x, toDisplayString as S, unref as C, watch as w, withCtx as T } from "vue";
10
+ import { NButton as E, NDataTable as D, NEmpty as O, NInput as k, NInputGroup as A, NModal as j, NPagination as M, NTabPane as N, NTabs as P } from "naive-ui";
11
+ //#region src/components/sidebar-right/edits/common/DictionaryPickerModal.vue?vue&type=script&setup=true&lang.ts
12
+ var F = { class: "flex flex-col gap-3" }, I = { class: "flex flex-row gap-2 items-center" }, L = { class: "flex justify-end" }, R = { class: "flex justify-end" }, z = /* @__PURE__ */ _({
13
+ __name: "DictionaryPickerModal",
14
+ props: { show: { type: Boolean } },
15
+ emits: ["update:show", "select"],
16
+ setup(t, { emit: r }) {
17
+ let i = t, a = r, { fetchDictionaryPage: o } = e(), { t: s } = n(), c = u(() => typeof o == "function"), l = b(""), f = b(""), p = b([]), _ = b(0), x = b(1), A = b(10), N = b(!1), P = [
18
+ {
19
+ title: () => s("edits.optionsSource.dictCode"),
20
+ key: "code",
21
+ minWidth: 140
22
+ },
23
+ {
24
+ title: () => s("edits.optionsSource.dictLabel"),
25
+ key: "label",
26
+ minWidth: 200
27
+ },
28
+ {
29
+ title: () => s("edits.optionsSource.dictAction"),
30
+ key: "actions",
31
+ width: 72,
32
+ render: (e) => v(E, {
33
+ size: "tiny",
34
+ type: "primary",
35
+ secondary: !0,
36
+ onClick: () => H(e)
37
+ }, { default: () => s("edits.optionsSource.dictChoose") })
38
+ }
39
+ ];
40
+ async function z() {
41
+ if (o) {
42
+ N.value = !0;
43
+ try {
44
+ let e = await o({
45
+ code: l.value.trim() || void 0,
46
+ label: f.value.trim() || void 0,
47
+ pageNum: x.value,
48
+ pageSize: A.value
49
+ });
50
+ p.value = e?.data ?? [], _.value = e?.total ?? 0;
51
+ } catch {
52
+ p.value = [], _.value = 0;
53
+ } finally {
54
+ N.value = !1;
55
+ }
56
+ }
57
+ }
58
+ function B(e) {
59
+ x.value = e, z();
60
+ }
61
+ function V(e) {
62
+ A.value = e, x.value = 1, z();
63
+ }
64
+ function H(e) {
65
+ a("select", e), a("update:show", !1);
66
+ }
67
+ return w(() => i.show, (e) => {
68
+ e && (x.value = 1, z());
69
+ }), (e, t) => (y(), d(C(j), {
70
+ show: i.show,
71
+ preset: "card",
72
+ title: C(s)("edits.optionsSource.dictPickerTitle"),
73
+ class: "!w-[560px]",
74
+ "onUpdate:show": t[4] ||= (e) => a("update:show", !!e)
75
+ }, {
76
+ footer: T(() => [m("div", R, [g(C(E), {
77
+ size: "small",
78
+ onClick: t[3] ||= (e) => a("update:show", !1)
79
+ }, {
80
+ default: T(() => [h(S(C(s)("edits.optionsSource.dictCancel")), 1)]),
81
+ _: 1
82
+ })])]),
83
+ default: T(() => [m("div", F, [
84
+ m("div", I, [
85
+ g(C(k), {
86
+ size: "small",
87
+ placeholder: C(s)("edits.optionsSource.dictCodePlaceholder"),
88
+ value: l.value,
89
+ "onUpdate:value": t[0] ||= (e) => l.value = e
90
+ }, null, 8, ["placeholder", "value"]),
91
+ g(C(k), {
92
+ size: "small",
93
+ placeholder: C(s)("edits.optionsSource.dictLabelPlaceholder"),
94
+ value: f.value,
95
+ "onUpdate:value": t[1] ||= (e) => f.value = e
96
+ }, null, 8, ["placeholder", "value"]),
97
+ g(C(E), {
98
+ size: "small",
99
+ type: "primary",
100
+ loading: N.value,
101
+ onClick: z
102
+ }, {
103
+ default: T(() => [h(S(C(s)("edits.optionsSource.dictSearch")), 1)]),
104
+ _: 1
105
+ }, 8, ["loading"])
106
+ ]),
107
+ g(C(D), {
108
+ size: "small",
109
+ loading: N.value,
110
+ columns: P,
111
+ data: p.value,
112
+ "max-height": 320
113
+ }, {
114
+ empty: T(() => [g(C(O), { description: c.value ? C(s)("edits.optionsSource.dictEmpty") : C(s)("edits.optionsSource.dictProviderMissing") }, null, 8, ["description"])]),
115
+ _: 1
116
+ }, 8, ["loading", "data"]),
117
+ m("div", L, [g(C(M), {
118
+ page: x.value,
119
+ "onUpdate:page": t[2] ||= (e) => x.value = e,
120
+ "page-size": A.value,
121
+ "item-count": _.value,
122
+ "on-update:page": B,
123
+ "on-update:page-size": V,
124
+ "show-size-picker": !0,
125
+ "page-sizes": [
126
+ 10,
127
+ 20,
128
+ 50
129
+ ],
130
+ size: "small"
131
+ }, null, 8, [
132
+ "page",
133
+ "page-size",
134
+ "item-count"
135
+ ])])
136
+ ])]),
137
+ _: 1
138
+ }, 8, ["show", "title"]));
139
+ }
140
+ }), B = { class: "flex flex-col gap-3" }, V = { class: "flex flex-row gap-2 items-center" }, H = { class: "flex justify-end" }, U = { class: "flex justify-end" }, ee = /* @__PURE__ */ _({
141
+ __name: "TreeDictionaryPickerModal",
142
+ props: { show: { type: Boolean } },
143
+ emits: ["update:show", "select"],
144
+ setup(t, { emit: r }) {
145
+ let i = t, a = r, { fetchTreeDictionaryPage: o } = e(), { t: s } = n(), c = u(() => typeof o == "function"), l = b(""), f = b(""), p = b([]), _ = b(0), x = b(1), A = b(10), N = b(!1), P = [
146
+ {
147
+ title: () => s("edits.optionsSource.dictCode"),
148
+ key: "value",
149
+ minWidth: 140
150
+ },
151
+ {
152
+ title: () => s("edits.optionsSource.dictLabel"),
153
+ key: "label",
154
+ minWidth: 200
155
+ },
156
+ {
157
+ title: () => s("edits.optionsSource.dictAction"),
158
+ key: "actions",
159
+ width: 72,
160
+ render: (e) => v(E, {
161
+ size: "tiny",
162
+ type: "primary",
163
+ secondary: !0,
164
+ onClick: () => R(e)
165
+ }, { default: () => s("edits.optionsSource.dictChoose") })
166
+ }
167
+ ];
168
+ async function F() {
169
+ if (o) {
170
+ N.value = !0;
171
+ try {
172
+ let e = await o({
173
+ value: l.value.trim() || void 0,
174
+ label: f.value.trim() || void 0,
175
+ pageNum: x.value,
176
+ pageSize: A.value
177
+ });
178
+ p.value = e?.data ?? [], _.value = e?.total ?? 0;
179
+ } catch {
180
+ p.value = [], _.value = 0;
181
+ } finally {
182
+ N.value = !1;
183
+ }
184
+ }
185
+ }
186
+ function I(e) {
187
+ x.value = e, F();
188
+ }
189
+ function L(e) {
190
+ A.value = e, x.value = 1, F();
191
+ }
192
+ function R(e) {
193
+ a("select", e), a("update:show", !1);
194
+ }
195
+ return w(() => i.show, (e) => {
196
+ e && (x.value = 1, F());
197
+ }), (e, t) => (y(), d(C(j), {
198
+ show: i.show,
199
+ preset: "card",
200
+ title: C(s)("edits.optionsSource.dictPickerTitle"),
201
+ class: "!w-[560px]",
202
+ "onUpdate:show": t[4] ||= (e) => a("update:show", !!e)
203
+ }, {
204
+ footer: T(() => [m("div", U, [g(C(E), {
205
+ size: "small",
206
+ onClick: t[3] ||= (e) => a("update:show", !1)
207
+ }, {
208
+ default: T(() => [h(S(C(s)("edits.optionsSource.dictCancel")), 1)]),
209
+ _: 1
210
+ })])]),
211
+ default: T(() => [m("div", B, [
212
+ m("div", V, [
213
+ g(C(k), {
214
+ size: "small",
215
+ placeholder: C(s)("edits.optionsSource.dictCodePlaceholder"),
216
+ value: l.value,
217
+ "onUpdate:value": t[0] ||= (e) => l.value = e
218
+ }, null, 8, ["placeholder", "value"]),
219
+ g(C(k), {
220
+ size: "small",
221
+ placeholder: C(s)("edits.optionsSource.dictLabelPlaceholder"),
222
+ value: f.value,
223
+ "onUpdate:value": t[1] ||= (e) => f.value = e
224
+ }, null, 8, ["placeholder", "value"]),
225
+ g(C(E), {
226
+ size: "small",
227
+ type: "primary",
228
+ loading: N.value,
229
+ onClick: F
230
+ }, {
231
+ default: T(() => [h(S(C(s)("edits.optionsSource.dictSearch")), 1)]),
232
+ _: 1
233
+ }, 8, ["loading"])
234
+ ]),
235
+ g(C(D), {
236
+ size: "small",
237
+ loading: N.value,
238
+ columns: P,
239
+ data: p.value,
240
+ "max-height": 320
241
+ }, {
242
+ empty: T(() => [g(C(O), { description: c.value ? C(s)("edits.optionsSource.dictEmpty") : C(s)("edits.optionsSource.dictProviderMissing") }, null, 8, ["description"])]),
243
+ _: 1
244
+ }, 8, ["loading", "data"]),
245
+ m("div", H, [g(C(M), {
246
+ page: x.value,
247
+ "onUpdate:page": t[2] ||= (e) => x.value = e,
248
+ "page-size": A.value,
249
+ "item-count": _.value,
250
+ "on-update:page": I,
251
+ "on-update:page-size": L,
252
+ "show-size-picker": !0,
253
+ "page-sizes": [
254
+ 10,
255
+ 20,
256
+ 50
257
+ ],
258
+ size: "small"
259
+ }, null, 8, [
260
+ "page",
261
+ "page-size",
262
+ "item-count"
263
+ ])])
264
+ ])]),
265
+ _: 1
266
+ }, 8, ["show", "title"]));
267
+ }
268
+ }), te = { class: "text-xs font-medium tracking-wide text-foreground/80 block mb-1" }, ne = { class: "flex flex-col gap-2" }, re = { class: "flex flex-col gap-2" }, ie = {
269
+ key: 0,
270
+ class: "text-[11px] text-muted-foreground"
271
+ }, ae = { class: "flex flex-col gap-2" }, oe = {
272
+ key: 0,
273
+ class: "text-[11px] text-muted-foreground"
274
+ }, W = /* @__PURE__ */ _({
275
+ __name: "OptionsSourceTabs",
276
+ props: { mode: {} },
277
+ setup(_) {
278
+ let v = _, { selectedIndex: D, selectedKey: O } = r(), { optionsRaw: j } = i(), { t: M } = n(), F = u(() => O.value ?? String(D.value)), I = u(() => {
279
+ let e = [
280
+ "label",
281
+ "pair",
282
+ "json"
283
+ ];
284
+ return v.mode === "tree" ? [...e, "dynamicTreeDict"] : [...e, "dynamicDict"];
285
+ }), L = b("json"), R = b([]), B = b([{
286
+ label: "",
287
+ value: ""
288
+ }]), V = b(""), H = b(""), U = b(""), W = b(""), G = b(!1), K = b(""), q = b(""), J = b(!1), se = (e) => e.length === 0 ? !1 : e.every((e) => {
289
+ if (!e || typeof e != "object") return !1;
290
+ let t = e;
291
+ return !("label" in t) || !("value" in t) ? !1 : Object.keys(t).every((e) => e === "label" || e === "value" || e === "disabled");
292
+ }), ce = (e) => e.length === 0 ? [{
293
+ label: "",
294
+ value: ""
295
+ }] : e.map((e) => {
296
+ if (!e || typeof e != "object") return {
297
+ label: String(e ?? ""),
298
+ value: String(e ?? "")
299
+ };
300
+ let t = e;
301
+ return {
302
+ label: String(t.label ?? ""),
303
+ value: String(t.value ?? "")
304
+ };
305
+ }), le = (e) => {
306
+ let t = e.trim();
307
+ return /^-?\d+(\.\d+)?$/.test(t) ? Number(t) : t;
308
+ }, ue = (e) => Array.isArray(e) ? e.every((e) => typeof e == "string" || typeof e == "number") ? e.map(String) : e.map((e) => e && typeof e == "object" ? String(e.value ?? "") : "").filter((e) => e !== "") : [], de = (e) => !Array.isArray(e) || e.length === 0 ? [{
309
+ label: "",
310
+ value: ""
311
+ }] : e.map((e) => {
312
+ if (typeof e == "string" || typeof e == "number") return {
313
+ label: String(e),
314
+ value: String(e)
315
+ };
316
+ if (e && typeof e == "object") {
317
+ let t = e;
318
+ return {
319
+ label: String(t.label ?? t.value ?? ""),
320
+ value: String(t.value ?? t.label ?? "")
321
+ };
322
+ }
323
+ return {
324
+ label: "",
325
+ value: ""
326
+ };
327
+ }), fe = (e) => {
328
+ if (!Array.isArray(e)) return "";
329
+ let t = e.every((e) => typeof e == "string" || typeof e == "number") ? e.map((e) => ({
330
+ label: String(e),
331
+ value: String(e)
332
+ })) : e;
333
+ return JSON.stringify(t, null, 2);
334
+ }, Y = (e) => {
335
+ let n = t(e);
336
+ U.value = n?.code ?? "", W.value = n?.label ?? "";
337
+ }, X = (e) => {
338
+ let n = t(e);
339
+ K.value = n?.code ?? "", q.value = n?.label ?? "";
340
+ }, Z = (e) => {
341
+ R.value = e, j.value = [...e];
342
+ }, Q = (e) => {
343
+ B.value = e, j.value = e.map((e) => ({
344
+ label: e.label.trim(),
345
+ value: le(e.value)
346
+ })).filter((e) => e.label && String(e.value).trim() !== "");
347
+ }, $ = (e) => {
348
+ if (V.value = e, !e.trim()) {
349
+ j.value = [], H.value = "";
350
+ return;
351
+ }
352
+ try {
353
+ let t = JSON.parse(e);
354
+ if (!Array.isArray(t)) {
355
+ H.value = M("edits.optionsSource.jsonArrayError");
356
+ return;
357
+ }
358
+ j.value = t, H.value = "";
359
+ } catch {
360
+ H.value = M("edits.optionsSource.jsonParseError");
361
+ }
362
+ }, pe = (e) => {
363
+ U.value = e;
364
+ let t = e.trim();
365
+ if (!t) {
366
+ j.value = [];
367
+ return;
368
+ }
369
+ j.value = {
370
+ dynamic: !0,
371
+ code: t,
372
+ ...W.value ? { label: W.value } : {}
373
+ };
374
+ }, me = (e) => {
375
+ K.value = e;
376
+ let t = e.trim();
377
+ if (!t) {
378
+ j.value = [];
379
+ return;
380
+ }
381
+ j.value = {
382
+ dynamic: !0,
383
+ code: t,
384
+ ...q.value ? { label: q.value } : {}
385
+ };
386
+ }, he = (e) => {
387
+ U.value = e.code, W.value = e.label ?? "", j.value = {
388
+ dynamic: !0,
389
+ code: e.code,
390
+ ...e.label ? { label: e.label } : {}
391
+ };
392
+ }, ge = (e) => {
393
+ K.value = e.value, q.value = e.label ?? "", j.value = {
394
+ dynamic: !0,
395
+ code: e.value,
396
+ ...e.label ? { label: e.label } : {}
397
+ };
398
+ }, { fetchDictionary: _e, fetchTreeDictionary: ve } = e(), ye = async (e) => {
399
+ if (!_e) return [];
400
+ try {
401
+ return await _e(e.code);
402
+ } catch {
403
+ return [];
404
+ }
405
+ }, be = async (e) => {
406
+ if (!ve) return [];
407
+ try {
408
+ return await ve(e.code);
409
+ } catch {
410
+ return [];
411
+ }
412
+ }, xe = (e) => t(e) ? v.mode === "tree" ? "dynamicTreeDict" : "dynamicDict" : Array.isArray(e) ? e.every((e) => typeof e == "string" || typeof e == "number") ? "label" : se(e) ? "pair" : "json" : "label";
413
+ w(F, () => {
414
+ let e = j.value, t = xe(e);
415
+ L.value = I.value.includes(t) ? t : I.value[0] || "json", H.value = "", t === "label" ? R.value = Array.isArray(e) ? e.filter((e) => typeof e == "string") : [] : t === "pair" ? B.value = Array.isArray(e) ? ce(e) : [{
416
+ label: "",
417
+ value: ""
418
+ }] : t === "json" ? V.value = JSON.stringify(Array.isArray(e) ? e : [], null, 2) : t === "dynamicDict" ? Y(e) : t === "dynamicTreeDict" && X(e);
419
+ }, { immediate: !0 });
420
+ let Se = async (e) => {
421
+ let n = e;
422
+ H.value = "";
423
+ let r = j.value;
424
+ if (n !== "dynamicDict" && n !== "dynamicTreeDict") {
425
+ let e = t(r);
426
+ if (e) {
427
+ let t = [];
428
+ L.value === "dynamicDict" ? t = await ye(e) : L.value === "dynamicTreeDict" && (t = await be(e)), j.value = [], n === "label" ? Z(t.map((e) => String(e.label))) : n === "pair" ? Q(t.map((e) => ({
429
+ label: String(e.label),
430
+ value: String(e.value)
431
+ }))) : $(JSON.stringify(t, null, 2));
432
+ return;
433
+ }
434
+ }
435
+ L.value = n, n === "label" ? Z(ue(r)) : n === "pair" ? Q(de(r)) : n === "json" ? $(fe(r)) : n === "dynamicDict" ? Y(r) : n === "dynamicTreeDict" && X(r);
436
+ }, Ce = () => {
437
+ B.value = [...B.value, {
438
+ label: "",
439
+ value: ""
440
+ }];
441
+ }, we = (e) => {
442
+ let t = B.value.filter((t, n) => n !== e);
443
+ B.value = t.length ? t : [{
444
+ label: "",
445
+ value: ""
446
+ }], Q(B.value);
447
+ };
448
+ return (e, t) => (y(), d(a, { title: C(M)("edits.sections.options") }, {
449
+ default: T(() => [g(o, null, {
450
+ default: T(() => [m("label", te, S(C(M)("edits.optionsSource.title")), 1), g(C(P), {
451
+ type: "segment",
452
+ size: "small",
453
+ value: L.value,
454
+ "onUpdate:value": t[8] ||= (e) => Se(String(e))
455
+ }, {
456
+ default: T(() => [
457
+ I.value.includes("label") ? (y(), d(C(N), {
458
+ key: 0,
459
+ name: "label",
460
+ tab: C(M)("edits.optionsSource.tabs.label")
461
+ }, {
462
+ default: T(() => [g(c, {
463
+ label: C(M)("edits.optionsSource.labelList"),
464
+ placeholder: C(M)("edits.placeholder.addItems"),
465
+ value: R.value,
466
+ "onUpdate:value": t[0] ||= (e) => Z(e)
467
+ }, null, 8, [
468
+ "label",
469
+ "placeholder",
470
+ "value"
471
+ ])]),
472
+ _: 1
473
+ }, 8, ["tab"])) : f("", !0),
474
+ I.value.includes("pair") ? (y(), d(C(N), {
475
+ key: 1,
476
+ name: "pair",
477
+ tab: C(M)("edits.optionsSource.tabs.pair")
478
+ }, {
479
+ default: T(() => [m("div", ne, [(y(!0), p(l, null, x(B.value, (e, n) => (y(), p("div", {
480
+ key: n,
481
+ class: "flex flex-row gap-2 items-center"
482
+ }, [
483
+ g(C(k), {
484
+ size: "small",
485
+ class: "flex-1",
486
+ placeholder: C(M)("edits.optionsSource.pairLabelPlaceholder"),
487
+ value: e.label,
488
+ "onUpdate:value": (t) => {
489
+ B.value[n] = {
490
+ ...e,
491
+ label: t
492
+ }, Q(B.value);
493
+ }
494
+ }, null, 8, [
495
+ "placeholder",
496
+ "value",
497
+ "onUpdate:value"
498
+ ]),
499
+ g(C(k), {
500
+ size: "small",
501
+ class: "flex-1",
502
+ placeholder: C(M)("edits.optionsSource.pairValuePlaceholder"),
503
+ value: e.value,
504
+ "onUpdate:value": (t) => {
505
+ B.value[n] = {
506
+ ...e,
507
+ value: t
508
+ }, Q(B.value);
509
+ }
510
+ }, null, 8, [
511
+ "placeholder",
512
+ "value",
513
+ "onUpdate:value"
514
+ ]),
515
+ g(C(E), {
516
+ quaternary: "",
517
+ size: "small",
518
+ onClick: (e) => we(n),
519
+ class: "!px-2"
520
+ }, {
521
+ default: T(() => [...t[9] ||= [m("span", { class: "i-lucide-trash-2 h-4 w-4" }, null, -1)]]),
522
+ _: 1
523
+ }, 8, ["onClick"])
524
+ ]))), 128)), g(C(E), {
525
+ size: "small",
526
+ secondary: "",
527
+ onClick: Ce
528
+ }, {
529
+ default: T(() => [h(S(C(M)("edits.optionsSource.addPairRow")), 1)]),
530
+ _: 1
531
+ })])]),
532
+ _: 1
533
+ }, 8, ["tab"])) : f("", !0),
534
+ I.value.includes("json") ? (y(), d(C(N), {
535
+ key: 2,
536
+ name: "json",
537
+ tab: C(M)("edits.optionsSource.tabs.json")
538
+ }, {
539
+ default: T(() => [g(s, {
540
+ label: C(M)("edits.optionsJsonLabel"),
541
+ placeholder: "[{\"label\":\"Option 1\",\"value\":\"1\"}]",
542
+ value: V.value,
543
+ error: H.value,
544
+ "onUpdate:value": t[1] ||= (e) => $(e)
545
+ }, null, 8, [
546
+ "label",
547
+ "value",
548
+ "error"
549
+ ])]),
550
+ _: 1
551
+ }, 8, ["tab"])) : f("", !0),
552
+ I.value.includes("dynamicDict") ? (y(), d(C(N), {
553
+ key: 3,
554
+ name: "dynamicDict",
555
+ tab: C(M)("edits.optionsSource.tabs.dynamicDict")
556
+ }, {
557
+ default: T(() => [m("div", re, [
558
+ g(C(A), null, {
559
+ default: T(() => [g(C(k), {
560
+ size: "small",
561
+ placeholder: C(M)("edits.optionsSource.dictInputPlaceholder"),
562
+ value: U.value,
563
+ "onUpdate:value": t[2] ||= (e) => pe(String(e))
564
+ }, null, 8, ["placeholder", "value"]), g(C(E), {
565
+ size: "small",
566
+ type: "primary",
567
+ secondary: "",
568
+ onClick: t[3] ||= (e) => G.value = !0
569
+ }, {
570
+ default: T(() => [h(S(C(M)("edits.optionsSource.dictBrowse")), 1)]),
571
+ _: 1
572
+ })]),
573
+ _: 1
574
+ }),
575
+ W.value ? (y(), p("div", ie, S(W.value), 1)) : f("", !0),
576
+ g(z, {
577
+ show: G.value,
578
+ "onUpdate:show": t[4] ||= (e) => G.value = e,
579
+ onSelect: he
580
+ }, null, 8, ["show"])
581
+ ])]),
582
+ _: 1
583
+ }, 8, ["tab"])) : f("", !0),
584
+ I.value.includes("dynamicTreeDict") ? (y(), d(C(N), {
585
+ key: 4,
586
+ name: "dynamicTreeDict",
587
+ tab: C(M)("edits.optionsSource.tabs.dynamicTreeDict")
588
+ }, {
589
+ default: T(() => [m("div", ae, [
590
+ g(C(A), null, {
591
+ default: T(() => [g(C(k), {
592
+ size: "small",
593
+ placeholder: C(M)("edits.optionsSource.dictInputPlaceholder"),
594
+ value: K.value,
595
+ "onUpdate:value": t[5] ||= (e) => me(String(e))
596
+ }, null, 8, ["placeholder", "value"]), g(C(E), {
597
+ size: "small",
598
+ type: "primary",
599
+ secondary: "",
600
+ onClick: t[6] ||= (e) => J.value = !0
601
+ }, {
602
+ default: T(() => [h(S(C(M)("edits.optionsSource.dictBrowse")), 1)]),
603
+ _: 1
604
+ })]),
605
+ _: 1
606
+ }),
607
+ q.value ? (y(), p("div", oe, S(q.value), 1)) : f("", !0),
608
+ g(ee, {
609
+ show: J.value,
610
+ "onUpdate:show": t[7] ||= (e) => J.value = e,
611
+ onSelect: ge
612
+ }, null, 8, ["show"])
613
+ ])]),
614
+ _: 1
615
+ }, 8, ["tab"])) : f("", !0)
616
+ ]),
617
+ _: 1
618
+ }, 8, ["value"])]),
619
+ _: 1
620
+ })]),
621
+ _: 1
622
+ }, 8, ["title"]));
623
+ }
624
+ });
625
+ //#endregion
626
+ export { W as t };
627
+
628
+ //# sourceMappingURL=OptionsSourceTabs-3fsum0OI.js.map