@zeng-alt/formkit-form-builder 1.4.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/README.md +325 -137
- package/dist/builder.css +1 -1
- package/dist/builder.es.js +7922 -42834
- package/dist/builder.es.js.map +1 -0
- package/dist/builder.umd.js +58 -86
- package/dist/chunks/AiPrompt-CWUhBDH4.js +174 -0
- package/dist/chunks/AiPrompt-CWUhBDH4.js.map +1 -0
- package/dist/chunks/BadgeEditor-B1kB2DXg.js +133 -0
- package/dist/chunks/BadgeEditor-B1kB2DXg.js.map +1 -0
- package/dist/chunks/BuilderPreview-CKL5bqCP.js +142 -0
- package/dist/chunks/BuilderPreview-CKL5bqCP.js.map +1 -0
- package/dist/chunks/ButtonGroupEditor-C5pChDFz.js +55 -0
- package/dist/chunks/ButtonGroupEditor-C5pChDFz.js.map +1 -0
- package/dist/chunks/CardEditor-Bsbriwvu.js +61 -0
- package/dist/chunks/CardEditor-Bsbriwvu.js.map +1 -0
- package/dist/chunks/CheckboxEditor-CxNEvn_Y.js +23 -0
- package/dist/chunks/CheckboxEditor-CxNEvn_Y.js.map +1 -0
- package/dist/chunks/CollapseEditor-CUFTdj0V.js +36 -0
- package/dist/chunks/CollapseEditor-CUFTdj0V.js.map +1 -0
- package/dist/chunks/ColorEditor-Bo9QkLsR.js +17 -0
- package/dist/chunks/ColorEditor-Bo9QkLsR.js.map +1 -0
- package/dist/chunks/DataTableContainerPreview-phlGcigM.js +403 -0
- package/dist/chunks/DataTableContainerPreview-phlGcigM.js.map +1 -0
- package/dist/chunks/DataTableEditor-BTDWXdtk.js +473 -0
- package/dist/chunks/DataTableEditor-BTDWXdtk.js.map +1 -0
- package/dist/chunks/DataTableFieldPicker-qWxGmVxr.js +1579 -0
- package/dist/chunks/DataTableFieldPicker-qWxGmVxr.js.map +1 -0
- package/dist/chunks/DataTableRowCellInput-BLTM3I21.js +195 -0
- package/dist/chunks/DataTableRowCellInput-BLTM3I21.js.map +1 -0
- package/dist/chunks/DataTableSearchField-PU89hniM.js +81 -0
- package/dist/chunks/DataTableSearchField-PU89hniM.js.map +1 -0
- package/dist/chunks/DateLikeEditor-ZkCbMhpE.js +74 -0
- package/dist/chunks/DateLikeEditor-ZkCbMhpE.js.map +1 -0
- package/dist/chunks/DateTimeEditor-C-jZKTT5.js +73 -0
- package/dist/chunks/DateTimeEditor-C-jZKTT5.js.map +1 -0
- package/dist/chunks/EditorSection-BR3qdK2c.js +23 -0
- package/dist/chunks/EditorSection-BR3qdK2c.js.map +1 -0
- package/dist/chunks/EditsLayout-fueCrxZM.js +22 -0
- package/dist/chunks/EditsLayout-fueCrxZM.js.map +1 -0
- package/dist/chunks/ExprEditModal-CeXiPStM.js +540 -0
- package/dist/chunks/ExprEditModal-CeXiPStM.js.map +1 -0
- package/dist/chunks/FileEditor-BXELd_SD.js +35 -0
- package/dist/chunks/FileEditor-BXELd_SD.js.map +1 -0
- package/dist/chunks/FormRenderer-BwykpB3h.js +2625 -0
- package/dist/chunks/FormRenderer-BwykpB3h.js.map +1 -0
- package/dist/chunks/GroupEditor-DchDUDDY.js +13 -0
- package/dist/chunks/GroupEditor-DchDUDDY.js.map +1 -0
- package/dist/chunks/HistoryPanel-1p0-Obef.js +104 -0
- package/dist/chunks/HistoryPanel-1p0-Obef.js.map +1 -0
- package/dist/chunks/ImportExportModal-CTqkyp1s.js +266 -0
- package/dist/chunks/ImportExportModal-CTqkyp1s.js.map +1 -0
- package/dist/chunks/InlineEditableText-BO-dT5rp.js +68 -0
- package/dist/chunks/InlineEditableText-BO-dT5rp.js.map +1 -0
- package/dist/chunks/InputGroupEditor-D_5giZtN.js +13 -0
- package/dist/chunks/InputGroupEditor-D_5giZtN.js.map +1 -0
- package/dist/chunks/IssuesPanel-CW5bdwvC.js +82 -0
- package/dist/chunks/IssuesPanel-CW5bdwvC.js.map +1 -0
- package/dist/chunks/JsCodeEditor-CIPxhwZa.js +751 -0
- package/dist/chunks/JsCodeEditor-CIPxhwZa.js.map +1 -0
- package/dist/chunks/JsonTextarea-C3mnRwtG.js +54 -0
- package/dist/chunks/JsonTextarea-C3mnRwtG.js.map +1 -0
- package/dist/chunks/ListEditor-C1hn5yOi.js +25 -0
- package/dist/chunks/ListEditor-C1hn5yOi.js.map +1 -0
- package/dist/chunks/NaiveAlertEditor-DACimYS1.js +67 -0
- package/dist/chunks/NaiveAlertEditor-DACimYS1.js.map +1 -0
- package/dist/chunks/NaiveAutoCompleteEditor-CtCvPe7H.js +122 -0
- package/dist/chunks/NaiveAutoCompleteEditor-CtCvPe7H.js.map +1 -0
- package/dist/chunks/NaiveAvatarEditor-CmDUodoa.js +36 -0
- package/dist/chunks/NaiveAvatarEditor-CmDUodoa.js.map +1 -0
- package/dist/chunks/NaiveBackTopEditor-Iq-li1JT.js +69 -0
- package/dist/chunks/NaiveBackTopEditor-Iq-li1JT.js.map +1 -0
- package/dist/chunks/NaiveBasicSection-wNyhGLou.js +184 -0
- package/dist/chunks/NaiveBasicSection-wNyhGLou.js.map +1 -0
- package/dist/chunks/NaiveBlockquoteEditor-BfqWqKwF.js +13 -0
- package/dist/chunks/NaiveBlockquoteEditor-BfqWqKwF.js.map +1 -0
- package/dist/chunks/NaiveButtonEditor-B4Rp2T7n.js +168 -0
- package/dist/chunks/NaiveButtonEditor-B4Rp2T7n.js.map +1 -0
- package/dist/chunks/NaiveCascaderEditor-BtD6KRXl.js +26 -0
- package/dist/chunks/NaiveCascaderEditor-BtD6KRXl.js.map +1 -0
- package/dist/chunks/NaiveDividerEditor-B1dPteDV.js +52 -0
- package/dist/chunks/NaiveDividerEditor-B1dPteDV.js.map +1 -0
- package/dist/chunks/NaiveH1Editor-Can7c9mh.js +14 -0
- package/dist/chunks/NaiveH1Editor-Can7c9mh.js.map +1 -0
- package/dist/chunks/NaiveH2Editor-BRKeEVf4.js +14 -0
- package/dist/chunks/NaiveH2Editor-BRKeEVf4.js.map +1 -0
- package/dist/chunks/NaiveH3Editor-DCdyd3-n.js +14 -0
- package/dist/chunks/NaiveH3Editor-DCdyd3-n.js.map +1 -0
- package/dist/chunks/NaiveH4Editor-COFS6udv.js +14 -0
- package/dist/chunks/NaiveH4Editor-COFS6udv.js.map +1 -0
- package/dist/chunks/NaiveH5Editor-CQEe6s1O.js +14 -0
- package/dist/chunks/NaiveH5Editor-CQEe6s1O.js.map +1 -0
- package/dist/chunks/NaiveH6Editor-DHGzIUAl.js +14 -0
- package/dist/chunks/NaiveH6Editor-DHGzIUAl.js.map +1 -0
- package/dist/chunks/NaiveHeaderEditor-Cy02AmLI.js +12 -0
- package/dist/chunks/NaiveHeaderEditor-Cy02AmLI.js.map +1 -0
- package/dist/chunks/NaiveImageEditor-WyVYLNbT.js +201 -0
- package/dist/chunks/NaiveImageEditor-WyVYLNbT.js.map +1 -0
- package/dist/chunks/NaiveLiEditor-CC65rrna.js +13 -0
- package/dist/chunks/NaiveLiEditor-CC65rrna.js.map +1 -0
- package/dist/chunks/NaiveLinkEditor-DkjFrzEE.js +38 -0
- package/dist/chunks/NaiveLinkEditor-DkjFrzEE.js.map +1 -0
- package/dist/chunks/NaiveMentionEditor-BupocM2c.js +23 -0
- package/dist/chunks/NaiveMentionEditor-BupocM2c.js.map +1 -0
- package/dist/chunks/NaiveOlEditor-DYFqg6Sp.js +16 -0
- package/dist/chunks/NaiveOlEditor-DYFqg6Sp.js.map +1 -0
- package/dist/chunks/NaiveParagraphEditor-B3Ju6ZNI.js +104 -0
- package/dist/chunks/NaiveParagraphEditor-B3Ju6ZNI.js.map +1 -0
- package/dist/chunks/NaiveProgressEditor-CwpsZG2z.js +119 -0
- package/dist/chunks/NaiveProgressEditor-CwpsZG2z.js.map +1 -0
- package/dist/chunks/NaiveQrCodeEditor-YWWAozHe.js +77 -0
- package/dist/chunks/NaiveQrCodeEditor-YWWAozHe.js.map +1 -0
- package/dist/chunks/NaiveRateEditor-BVY1QiXv.js +44 -0
- package/dist/chunks/NaiveRateEditor-BVY1QiXv.js.map +1 -0
- package/dist/chunks/NaiveSwitchEditor-BP1v-oZf.js +17 -0
- package/dist/chunks/NaiveSwitchEditor-BP1v-oZf.js.map +1 -0
- package/dist/chunks/NaiveTextEditor-C38l4Q-j.js +107 -0
- package/dist/chunks/NaiveTextEditor-C38l4Q-j.js.map +1 -0
- package/dist/chunks/NaiveTransferEditor-BRH_5ioX.js +19 -0
- package/dist/chunks/NaiveTransferEditor-BRH_5ioX.js.map +1 -0
- package/dist/chunks/NaiveTreeSelectEditor-jX2DrMcT.js +26 -0
- package/dist/chunks/NaiveTreeSelectEditor-jX2DrMcT.js.map +1 -0
- package/dist/chunks/NaiveUlEditor-CMKofBid.js +16 -0
- package/dist/chunks/NaiveUlEditor-CMKofBid.js.map +1 -0
- package/dist/chunks/NumberEditor-0P2Li_GH.js +40 -0
- package/dist/chunks/NumberEditor-0P2Li_GH.js.map +1 -0
- package/dist/chunks/NumberInput-DU-FiLxW.js +37 -0
- package/dist/chunks/NumberInput-DU-FiLxW.js.map +1 -0
- package/dist/chunks/OptionsLayoutSection-C9gVadRA.js +21 -0
- package/dist/chunks/OptionsLayoutSection-C9gVadRA.js.map +1 -0
- package/dist/chunks/OptionsSourceTabs-3fsum0OI.js +628 -0
- package/dist/chunks/OptionsSourceTabs-3fsum0OI.js.map +1 -0
- package/dist/chunks/OptionsTagsSection-vKkxlWLw.js +31 -0
- package/dist/chunks/OptionsTagsSection-vKkxlWLw.js.map +1 -0
- package/dist/chunks/PasswordEditor-Igld1ak6.js +29 -0
- package/dist/chunks/PasswordEditor-Igld1ak6.js.map +1 -0
- package/dist/chunks/PlaceholderSection-BKOS-7Qu.js +26 -0
- package/dist/chunks/PlaceholderSection-BKOS-7Qu.js.map +1 -0
- package/dist/chunks/RadioEditor-CyJhILjI.js +23 -0
- package/dist/chunks/RadioEditor-CyJhILjI.js.map +1 -0
- package/dist/chunks/RangeEditor-PGOnGfuV.js +86 -0
- package/dist/chunks/RangeEditor-PGOnGfuV.js.map +1 -0
- package/dist/chunks/RichText-DqcMtoil.js +424 -0
- package/dist/chunks/RichText-DqcMtoil.js.map +1 -0
- package/dist/chunks/RichTextEditor-EfA6m9w2.js +81 -0
- package/dist/chunks/RichTextEditor-EfA6m9w2.js.map +1 -0
- package/dist/chunks/SelectEditor-mJ_zUivj.js +21 -0
- package/dist/chunks/SelectEditor-mJ_zUivj.js.map +1 -0
- package/dist/chunks/SelectInput-DY4Oi2Lp.js +31 -0
- package/dist/chunks/SelectInput-DY4Oi2Lp.js.map +1 -0
- package/dist/chunks/SignatureEditor-BNttg68X.js +52 -0
- package/dist/chunks/SignatureEditor-BNttg68X.js.map +1 -0
- package/dist/chunks/SignaturePad-qhmoMg1E.js +170 -0
- package/dist/chunks/SignaturePad-qhmoMg1E.js.map +1 -0
- package/dist/chunks/StepsEditor-C8U-ext8.js +63 -0
- package/dist/chunks/StepsEditor-C8U-ext8.js.map +1 -0
- package/dist/chunks/SubmitEditor-B9R984q8.js +168 -0
- package/dist/chunks/SubmitEditor-B9R984q8.js.map +1 -0
- package/dist/chunks/SwitchInput-DQrSTyW0.js +34 -0
- package/dist/chunks/SwitchInput-DQrSTyW0.js.map +1 -0
- package/dist/chunks/TabsEditor-DepUhmsz.js +100 -0
- package/dist/chunks/TabsEditor-DepUhmsz.js.map +1 -0
- package/dist/chunks/TagsInput-DeG3Om1R.js +36 -0
- package/dist/chunks/TagsInput-DeG3Om1R.js.map +1 -0
- package/dist/chunks/TemplatePickerModal-DPkdJJJs.js +440 -0
- package/dist/chunks/TemplatePickerModal-DPkdJJJs.js.map +1 -0
- package/dist/chunks/TextInput-D1EMeBPf.js +53 -0
- package/dist/chunks/TextInput-D1EMeBPf.js.map +1 -0
- package/dist/chunks/TextLikeEditor-Du0nHQWQ.js +56 -0
- package/dist/chunks/TextLikeEditor-Du0nHQWQ.js.map +1 -0
- package/dist/chunks/ToggleInput-DoZPwM0A.js +51 -0
- package/dist/chunks/ToggleInput-DoZPwM0A.js.map +1 -0
- package/dist/chunks/_plugin-vue_export-helper-BxNYtmDu.js +8 -0
- package/dist/chunks/axios-agM_iOnv.js +1589 -0
- package/dist/chunks/axios-agM_iOnv.js.map +1 -0
- package/dist/chunks/bind-runtime-CRyrBYCi.js +58 -0
- package/dist/chunks/bind-runtime-CRyrBYCi.js.map +1 -0
- package/dist/chunks/canvas-locate-CxDD4bDp.js +64 -0
- package/dist/chunks/canvas-locate-CxDD4bDp.js.map +1 -0
- package/dist/chunks/context-4zkSHwVA.js +2510 -0
- package/dist/chunks/context-4zkSHwVA.js.map +1 -0
- package/dist/chunks/create-form-builder-state-CoXaJhWO.js +358 -0
- package/dist/chunks/create-form-builder-state-CoXaJhWO.js.map +1 -0
- package/dist/chunks/date-family-BYkr1OaE.js +75 -0
- package/dist/chunks/date-family-BYkr1OaE.js.map +1 -0
- package/dist/chunks/evaluator-DqNftI0d.js +139 -0
- package/dist/chunks/evaluator-DqNftI0d.js.map +1 -0
- package/dist/chunks/expr-parse-u7_CxMWg.js +463 -0
- package/dist/chunks/expr-parse-u7_CxMWg.js.map +1 -0
- package/dist/chunks/expr-source-BRPYrxuB.js +118 -0
- package/dist/chunks/expr-source-BRPYrxuB.js.map +1 -0
- package/dist/chunks/form-builder-plugin-BCbiWZKT.js +280 -0
- package/dist/chunks/form-builder-plugin-BCbiWZKT.js.map +1 -0
- package/dist/chunks/form-fields-DjLk8iH2.js +877 -0
- package/dist/chunks/form-fields-DjLk8iH2.js.map +1 -0
- package/dist/chunks/form-layout-Dm4QeYrL.js +69 -0
- package/dist/chunks/form-layout-Dm4QeYrL.js.map +1 -0
- package/dist/chunks/grid-C8xMKll5.js +137 -0
- package/dist/chunks/grid-C8xMKll5.js.map +1 -0
- package/dist/chunks/keys-D4DlFgJT.js +61 -0
- package/dist/chunks/keys-D4DlFgJT.js.map +1 -0
- package/dist/chunks/media-family-B4Wijm18.js +178 -0
- package/dist/chunks/media-family-B4Wijm18.js.map +1 -0
- package/dist/chunks/misc-family-CQJhCKco.js +133 -0
- package/dist/chunks/misc-family-CQJhCKco.js.map +1 -0
- package/dist/chunks/rich-text-toolbar-CQidmjGI.js +32 -0
- package/dist/chunks/rich-text-toolbar-CQidmjGI.js.map +1 -0
- package/dist/chunks/rolldown-runtime-DMoxecvO.js +11 -0
- package/dist/chunks/schema-adapter-_sLPmdLy.js +2089 -0
- package/dist/chunks/schema-adapter-_sLPmdLy.js.map +1 -0
- package/dist/chunks/selection-family-T_wZGrXc.js +249 -0
- package/dist/chunks/selection-family-T_wZGrXc.js.map +1 -0
- package/dist/chunks/use-ai-prompt-focus-39DHK41R.js +14 -0
- package/dist/chunks/use-ai-prompt-focus-39DHK41R.js.map +1 -0
- package/dist/chunks/use-bind-events-C-H7jhW_.js +89 -0
- package/dist/chunks/use-bind-events-C-H7jhW_.js.map +1 -0
- package/dist/chunks/use-config-DTr8dhzM.js +16 -0
- package/dist/chunks/use-config-DTr8dhzM.js.map +1 -0
- package/dist/chunks/use-dictionary-BAN34x49.js +26 -0
- package/dist/chunks/use-dictionary-BAN34x49.js.map +1 -0
- package/dist/chunks/use-dynamic-options-DbGSz-3_.js +29 -0
- package/dist/chunks/use-dynamic-options-DbGSz-3_.js.map +1 -0
- package/dist/chunks/use-schema-render-data-DagOPKiy.js +33 -0
- package/dist/chunks/use-schema-render-data-DagOPKiy.js.map +1 -0
- package/dist/chunks/utils-DlUMv2vG.js +53 -0
- package/dist/chunks/utils-DlUMv2vG.js.map +1 -0
- package/dist/index.d.ts +243 -1060
- package/dist/renderer.d.ts +632 -0
- package/dist/renderer.es.js +6 -0
- package/dist/renderer.umd.js +34 -0
- package/package.json +48 -33
|
@@ -0,0 +1,2089 @@
|
|
|
1
|
+
import { i as e, t } from "./expr-parse-u7_CxMWg.js";
|
|
2
|
+
import { a as n, o as r } from "./form-layout-Dm4QeYrL.js";
|
|
3
|
+
import { toRaw as i } from "vue";
|
|
4
|
+
//#region src/elements/constants.ts
|
|
5
|
+
var a = "yyyy-MM-dd", o = "HH:mm:ss", s = "yyyy-MM-dd HH:mm:ss", c = {
|
|
6
|
+
date: a,
|
|
7
|
+
datetime: s,
|
|
8
|
+
daterange: a,
|
|
9
|
+
datetimerange: s,
|
|
10
|
+
month: "yyyy-MM",
|
|
11
|
+
monthrange: "yyyy-MM",
|
|
12
|
+
year: "yyyy",
|
|
13
|
+
yearrange: "yyyy",
|
|
14
|
+
quarter: "yyyy-QQ",
|
|
15
|
+
quarterrange: "yyyy-QQ",
|
|
16
|
+
week: "YYYY-w"
|
|
17
|
+
}, l = {
|
|
18
|
+
group: {
|
|
19
|
+
dataShape: "object",
|
|
20
|
+
keyProp: "groupKey",
|
|
21
|
+
primitive: "group"
|
|
22
|
+
},
|
|
23
|
+
list: {
|
|
24
|
+
dataShape: "array",
|
|
25
|
+
keyProp: "listKey",
|
|
26
|
+
primitive: "cmp"
|
|
27
|
+
},
|
|
28
|
+
card: {
|
|
29
|
+
dataShape: "object",
|
|
30
|
+
keyProp: "cardKey",
|
|
31
|
+
primitive: "cmp"
|
|
32
|
+
},
|
|
33
|
+
inputGroup: {
|
|
34
|
+
dataShape: "object",
|
|
35
|
+
keyProp: "inputGroupKey",
|
|
36
|
+
primitive: "cmp"
|
|
37
|
+
},
|
|
38
|
+
buttonGroup: {
|
|
39
|
+
dataShape: "none",
|
|
40
|
+
keyProp: "buttonGroupKey",
|
|
41
|
+
primitive: "cmp"
|
|
42
|
+
},
|
|
43
|
+
badge: {
|
|
44
|
+
dataShape: "none",
|
|
45
|
+
keyProp: "badgeKey",
|
|
46
|
+
primitive: "cmp"
|
|
47
|
+
},
|
|
48
|
+
tabs: {
|
|
49
|
+
dataShape: "objectOfObjects",
|
|
50
|
+
keyProp: "tabsKey",
|
|
51
|
+
primitive: "cmp"
|
|
52
|
+
},
|
|
53
|
+
steps: {
|
|
54
|
+
dataShape: "objectOfObjects",
|
|
55
|
+
keyProp: "stepsKey",
|
|
56
|
+
primitive: "cmp"
|
|
57
|
+
},
|
|
58
|
+
dataTable: {
|
|
59
|
+
dataShape: "none",
|
|
60
|
+
keyProp: "dataTableKey",
|
|
61
|
+
primitive: "cmp"
|
|
62
|
+
},
|
|
63
|
+
collapse: {
|
|
64
|
+
dataShape: "object",
|
|
65
|
+
keyProp: "collapseKey",
|
|
66
|
+
primitive: "cmp"
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
function u(e) {
|
|
70
|
+
return e ? l[e] ?? null : null;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/utils/schema/types.ts
|
|
74
|
+
function d(e) {
|
|
75
|
+
return Array.isArray(e?.children) ? e.children : [];
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/utils/dnd/schema.ts
|
|
79
|
+
var f = () => globalThis.crypto?.randomUUID?.() || `${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`, p = (e, t) => {
|
|
80
|
+
for (let n of e) {
|
|
81
|
+
if (n && typeof n == "object" && n.__key === t) return n;
|
|
82
|
+
let e = p(d(n), t);
|
|
83
|
+
if (e) return e;
|
|
84
|
+
}
|
|
85
|
+
}, m = (e, t) => {
|
|
86
|
+
for (let n of e) typeof n?.name == "string" && n.name && t.add(n.name), m(d(n), t);
|
|
87
|
+
}, h = (e) => {
|
|
88
|
+
let t = 0;
|
|
89
|
+
for (let n of e) {
|
|
90
|
+
let e = /^field_(\d+)$/.exec(n);
|
|
91
|
+
e && (t = Math.max(t, Number(e[1])));
|
|
92
|
+
}
|
|
93
|
+
let n = `field_${t + 1}`;
|
|
94
|
+
for (; e.has(n);) t++, n = `field_${t + 1}`;
|
|
95
|
+
return e.add(n), n;
|
|
96
|
+
};
|
|
97
|
+
function g(e, t, n, r) {
|
|
98
|
+
let i = JSON.parse(JSON.stringify(e));
|
|
99
|
+
if (typeof i != "object" || !i) return i;
|
|
100
|
+
let a = f(), o = i.$formkit === "submit" || n ? i.name : h(t);
|
|
101
|
+
if (i.$formkit === "submit") return i.__key = a, i.outerClass = i.outerClass || "col-span-12 pt-2", Array.isArray(i.children) && delete i.children, i;
|
|
102
|
+
typeof i.$cmp == "string" && (i.props = i.props && typeof i.props == "object" ? {
|
|
103
|
+
...i.props,
|
|
104
|
+
name: o,
|
|
105
|
+
id: `field_${a}`,
|
|
106
|
+
__key: a
|
|
107
|
+
} : {
|
|
108
|
+
name: o,
|
|
109
|
+
id: `field_${a}`,
|
|
110
|
+
__key: a
|
|
111
|
+
});
|
|
112
|
+
let s = u(i.$cmp ?? i.$formkit);
|
|
113
|
+
if (s && s.primitive === "cmp") {
|
|
114
|
+
let e = {
|
|
115
|
+
...i.props,
|
|
116
|
+
[s.keyProp]: a
|
|
117
|
+
};
|
|
118
|
+
delete e.modelValue, i.__key = a, i.name = o, i.id = `field_${a}`, i.props = e, i.children = d(i);
|
|
119
|
+
} else i.__key = a, i.name = o, i.id = `field_${a}`;
|
|
120
|
+
r && (typeof i.label == "string" && i.label ? i.label = `${i.label}${r}` : i.props && typeof i.props.label == "string" && i.props.label && (i.props = {
|
|
121
|
+
...i.props,
|
|
122
|
+
label: `${i.props.label}${r}`
|
|
123
|
+
}));
|
|
124
|
+
let c = typeof i.__paneType == "string" || (s ? s.dataShape === "object" || s.dataShape === "array" : i.$formkit === "group");
|
|
125
|
+
return Array.isArray(i.children) && (i.children = d(i).map((e) => g(e, t, c, void 0))), i;
|
|
126
|
+
}
|
|
127
|
+
var _ = (e, t, n) => g(e, t, !1, n?.labelSuffix);
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/dsl/compile.ts
|
|
130
|
+
function v(t) {
|
|
131
|
+
switch (t.type) {
|
|
132
|
+
case "literal": return t.value === void 0 ? "undefined" : JSON.stringify(t.value);
|
|
133
|
+
case "field": return `$${t.name}`;
|
|
134
|
+
case "call": {
|
|
135
|
+
if (t.fn === "__raw__") {
|
|
136
|
+
let e = t.args[0];
|
|
137
|
+
if (e && e.type === "literal" && typeof e.value == "string") return e.value;
|
|
138
|
+
}
|
|
139
|
+
let n = t.args.map((e) => v(e));
|
|
140
|
+
return e(t.fn, n);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function y(e, t, n) {
|
|
145
|
+
return n === void 0 ? {
|
|
146
|
+
if: e,
|
|
147
|
+
then: t
|
|
148
|
+
} : {
|
|
149
|
+
if: e,
|
|
150
|
+
then: t,
|
|
151
|
+
else: n
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function ee(e) {
|
|
155
|
+
if (!e) return "";
|
|
156
|
+
let t = "";
|
|
157
|
+
return e.debounce && (t += `(${e.debounce})`), e.empty && (t += "+"), e.force && (t += "*"), e.optional && (t += "?"), t;
|
|
158
|
+
}
|
|
159
|
+
function b(e) {
|
|
160
|
+
let t = (e ?? []).map((e) => [`${ee(e)}${e.rule}`, ...e.args ?? []]), n = e?.filter((e) => e.message).reduce((e, t) => (e[t.rule] = t.message, e), {}) ?? {};
|
|
161
|
+
return {
|
|
162
|
+
validation: t,
|
|
163
|
+
...Object.keys(n).length ? { "validation-messages": n } : {}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function x(e) {
|
|
167
|
+
let t = r(e);
|
|
168
|
+
return t ? { __bind: t } : {};
|
|
169
|
+
}
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/dsl/convert/shared.ts
|
|
172
|
+
function S(e) {
|
|
173
|
+
let t = e;
|
|
174
|
+
return typeof t.$cmp == "string" ? {
|
|
175
|
+
renderAs: "cmp",
|
|
176
|
+
target: t.$cmp
|
|
177
|
+
} : typeof t.$el == "string" ? {
|
|
178
|
+
renderAs: "el",
|
|
179
|
+
target: t.$el
|
|
180
|
+
} : {
|
|
181
|
+
renderAs: "formkit",
|
|
182
|
+
target: typeof t.$formkit == "string" ? t.$formkit : void 0
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function te(e, t) {
|
|
186
|
+
let n = e, r = t?.renderAs ?? "formkit", i = t?.target;
|
|
187
|
+
return r === "cmp" ? typeof n.$cmp == "string" && n.$cmp === i : r === "el" ? typeof n.$el == "string" && n.$el === i : typeof n.$formkit == "string" ? i == null || n.$formkit === i : !1;
|
|
188
|
+
}
|
|
189
|
+
function C(e, t) {
|
|
190
|
+
let n = typeof e == "string" ? e.trim() : "";
|
|
191
|
+
n && n !== "col-span-12" && (t.outerClass = n);
|
|
192
|
+
}
|
|
193
|
+
function w(e) {
|
|
194
|
+
return e.outerClass?.trim() ? e.outerClass : "col-span-12";
|
|
195
|
+
}
|
|
196
|
+
function T(e, t, n, r) {
|
|
197
|
+
r === "cmp" ? (e.props ||= {}, e.props[t] = n) : r === "el" ? (e.attrs ||= {}, e.attrs[t] = n) : e[t] = n;
|
|
198
|
+
}
|
|
199
|
+
function E(e, t, n) {
|
|
200
|
+
n === "cmp" ? (e.props ||= {}, Object.assign(e.props, t)) : n === "el" ? (e.attrs ||= {}, Object.assign(e.attrs, t)) : Object.assign(e, t);
|
|
201
|
+
}
|
|
202
|
+
function D(e, t, n) {
|
|
203
|
+
let r = t === "cmp" ? { $cmp: n ?? e.type } : t === "el" ? { $el: n ?? e.type } : { $formkit: e.type };
|
|
204
|
+
e.key && (r.__key = e.key), e.visibleIf && (r.if = v(e.visibleIf));
|
|
205
|
+
let i = x(e.events);
|
|
206
|
+
return i && Object.keys(i).length && E(r, i, t), e.label && T(r, "label", e.label, t), e.id && T(r, "id", e.id, t), r;
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/dsl/convert/validation-parse.ts
|
|
210
|
+
function O(e, t) {
|
|
211
|
+
if (!Array.isArray(e) || !e.length) return;
|
|
212
|
+
let n = t && typeof t == "object" ? t : {};
|
|
213
|
+
return e.map((e) => {
|
|
214
|
+
let [t, ...r] = Array.isArray(e) ? e : [e], i = typeof t == "string" ? t : "", a = { rule: "" }, o = i.match(/^\((\d+)\)/);
|
|
215
|
+
return o && (a.debounce = Number(o[1]), i = i.slice(o[0].length)), i.startsWith("+") && (a.empty = !0, i = i.slice(1)), i.startsWith("*") && (a.force = !0, i = i.slice(1)), i.startsWith("?") && (a.optional = !0, i = i.slice(1)), a.rule = i, r.length && (a.args = r), n[a.rule] && (a.message = n[a.rule]), a;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/dsl/convert/field.ts
|
|
220
|
+
var k = new Set([
|
|
221
|
+
"$formkit",
|
|
222
|
+
"$cmp",
|
|
223
|
+
"$el",
|
|
224
|
+
"name",
|
|
225
|
+
"id",
|
|
226
|
+
"label",
|
|
227
|
+
"if",
|
|
228
|
+
"__raw__ifExpression",
|
|
229
|
+
"value",
|
|
230
|
+
"expr",
|
|
231
|
+
"validation",
|
|
232
|
+
"validation-messages",
|
|
233
|
+
"validationMessages",
|
|
234
|
+
"options",
|
|
235
|
+
"__disabledIf",
|
|
236
|
+
"__readonlyIf",
|
|
237
|
+
"outerClass",
|
|
238
|
+
"children",
|
|
239
|
+
"__key",
|
|
240
|
+
"bind",
|
|
241
|
+
"props",
|
|
242
|
+
"attrs",
|
|
243
|
+
"__bind"
|
|
244
|
+
]), ne = new Set([
|
|
245
|
+
"min",
|
|
246
|
+
"max",
|
|
247
|
+
"step",
|
|
248
|
+
"multiple",
|
|
249
|
+
"accept",
|
|
250
|
+
"number",
|
|
251
|
+
"validationVisibility",
|
|
252
|
+
"placeholder",
|
|
253
|
+
"help",
|
|
254
|
+
"description",
|
|
255
|
+
"options",
|
|
256
|
+
"value",
|
|
257
|
+
"buttonText"
|
|
258
|
+
]);
|
|
259
|
+
function re(e) {
|
|
260
|
+
let t = b(e.validation);
|
|
261
|
+
if (!e.requiredIf) return t;
|
|
262
|
+
let n = (e.validation ?? []).some((e) => e.rule === "required") ? t.validation : [...t.validation, ["required"]];
|
|
263
|
+
return {
|
|
264
|
+
...t,
|
|
265
|
+
validation: y(v(e.requiredIf), n, t.validation)
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function ie(e, t) {
|
|
269
|
+
let n = t?.renderAs ?? "formkit", r = D(e, n, t?.target ?? e.type);
|
|
270
|
+
if (e.name ? T(r, "name", e.name, n) : e.id && T(r, "name", e.id, n), e.value !== void 0 && T(r, "value", e.value, n), typeof e.expr == "string" && e.expr.trim() && (r.expr = e.expr, n === "formkit" ? delete r.value : n === "cmp" ? delete r.props?.value : delete r.attrs?.value), E(r, re(e), n), (Array.isArray(e.options) ? e.options.length : e.options !== void 0) && T(r, "options", e.options, n), e.disabledIf && T(r, "__disabledIf", y(v(e.disabledIf), !0), n), e.readonlyIf && T(r, "__readonlyIf", y(v(e.readonlyIf), !0), n), e.props) {
|
|
271
|
+
let t = {};
|
|
272
|
+
for (let [i, a] of Object.entries(e.props)) i !== "__bind" && (n === "formkit" && ne.has(i) ? r[i] = a : t[i] = a);
|
|
273
|
+
Object.keys(t).length && (n === "cmp" ? r.props = {
|
|
274
|
+
...r.props,
|
|
275
|
+
...t
|
|
276
|
+
} : n === "el" ? r.attrs = {
|
|
277
|
+
...r.attrs,
|
|
278
|
+
...t
|
|
279
|
+
} : r.props = t);
|
|
280
|
+
}
|
|
281
|
+
return r.outerClass = w(e), n === "cmp" && (Object.keys(r.props ?? {}).length === 0 && delete r.props, typeof r.outerClass == "string" && r.outerClass && (r.props = {
|
|
282
|
+
...r.props,
|
|
283
|
+
outerClass: r.outerClass
|
|
284
|
+
}), typeof r.props?.name == "string" && (r.name = r.props.name)), r;
|
|
285
|
+
}
|
|
286
|
+
function ae(e, r = "text") {
|
|
287
|
+
let i = e, a = S(e), o = a.renderAs === "cmp", s = a.renderAs === "el", c = o ? i.props && typeof i.props == "object" ? i.props : {} : s ? i.attrs && typeof i.attrs == "object" ? i.attrs : {} : i, l = typeof i.$formkit == "string" ? i.$formkit : typeof i.$cmp == "string" ? r : typeof i.$el == "string" ? i.$el : r, u = {
|
|
288
|
+
id: typeof c.id == "string" && c.id ? c.id : typeof i.__key == "string" ? i.__key : f(),
|
|
289
|
+
category: "field",
|
|
290
|
+
type: l,
|
|
291
|
+
renderAs: a.renderAs
|
|
292
|
+
};
|
|
293
|
+
a.target && a.target !== l && (u.target = a.target), typeof i.__key == "string" && i.__key && (u.key = i.__key), typeof c.name == "string" && c.name && c.name !== u.id && (u.name = c.name), typeof c.label == "string" && c.label && (u.label = c.label), typeof i.expr == "string" && i.expr ? u.expr = i.expr : typeof c.expr == "string" && c.expr && (u.expr = c.expr), c.value === void 0 ? i.value === void 0 ? typeof i.expr == "string" && i.expr || typeof c.expr == "string" && c.expr : u.value = i.value : u.value = c.value;
|
|
294
|
+
let d, p = c.validation;
|
|
295
|
+
if (p && typeof p == "object" && !Array.isArray(p) && typeof p.if == "string") {
|
|
296
|
+
let e = p;
|
|
297
|
+
d = t(e.if), p = Array.isArray(e.else) ? e.else : Array.isArray(e.then) ? e.then : [];
|
|
298
|
+
}
|
|
299
|
+
let m = O(p, c["validation-messages"] ?? c.validationMessages);
|
|
300
|
+
m?.length && (u.validation = m), d && (u.requiredIf = d), Array.isArray(c.options) && (u.options = c.options), typeof i.if == "string" && i.if ? u.visibleIf = t(i.if) : typeof i.if == "boolean" && (u.visibleIf = {
|
|
301
|
+
type: "literal",
|
|
302
|
+
value: i.if
|
|
303
|
+
});
|
|
304
|
+
let h = c.__disabledIf;
|
|
305
|
+
h && typeof h == "object" && typeof h.if == "string" && (u.disabledIf = t(h.if));
|
|
306
|
+
let g = c.__readonlyIf;
|
|
307
|
+
g && typeof g == "object" && typeof g.if == "string" && (u.readonlyIf = t(g.if));
|
|
308
|
+
let _ = n(c.__bind);
|
|
309
|
+
_?.length && (u.events = _), C(i.outerClass, u);
|
|
310
|
+
let v = {}, y = (e, t = !1) => {
|
|
311
|
+
for (let [n, r] of Object.entries(e)) (t && n === "children" ? Array.isArray(r) : k.has(n)) || /^on[A-Z]/.test(n) || r !== void 0 && (v[n] = r);
|
|
312
|
+
};
|
|
313
|
+
if (o) {
|
|
314
|
+
y(i.props ?? {}, !0);
|
|
315
|
+
for (let [e, t] of Object.entries(i)) e === "props" || e === "$cmp" || k.has(e) || /^on[A-Z]/.test(e) || t === void 0 || v[e] !== void 0 || (v[e] = t);
|
|
316
|
+
} else if (s) {
|
|
317
|
+
y(i.attrs ?? {}, !0);
|
|
318
|
+
for (let [e, t] of Object.entries(i)) e === "attrs" || e === "$el" || k.has(e) || /^on[A-Z]/.test(e) || t !== void 0 && (v[e] = t);
|
|
319
|
+
} else {
|
|
320
|
+
y(i), y(i.props ?? {}, !0);
|
|
321
|
+
for (let [e, t] of Object.entries(i)) e === "props" || k.has(e) || /^on[A-Z]/.test(e) || t === void 0 || v[e] !== void 0 || (v[e] = t);
|
|
322
|
+
}
|
|
323
|
+
return Object.keys(v).length && (u.props = v), u;
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region src/dsl/convert/container.ts
|
|
327
|
+
var oe = new Set([
|
|
328
|
+
"listKey",
|
|
329
|
+
"cardKey",
|
|
330
|
+
"inputGroupKey",
|
|
331
|
+
"buttonGroupKey",
|
|
332
|
+
"badgeKey",
|
|
333
|
+
"tabsKey",
|
|
334
|
+
"stepsKey",
|
|
335
|
+
"groupKey",
|
|
336
|
+
"dataTableKey",
|
|
337
|
+
"collapseKey",
|
|
338
|
+
"modelValue",
|
|
339
|
+
"label",
|
|
340
|
+
"title"
|
|
341
|
+
]);
|
|
342
|
+
function se(e, t, n) {
|
|
343
|
+
let r = t ?? [], i = e.label, a = n?.container;
|
|
344
|
+
if (a) {
|
|
345
|
+
if (a.primitive === "group") {
|
|
346
|
+
let t = {
|
|
347
|
+
$formkit: "group",
|
|
348
|
+
name: e.name ?? e.id
|
|
349
|
+
};
|
|
350
|
+
return e.id && (t.id = e.id), e.key && (t.__key = e.key), i && (t.label = i), e.visibleIf && (t.if = v(e.visibleIf)), e.props && Object.assign(t, e.props), r.length && (t.children = r), t.outerClass = w(e), t;
|
|
351
|
+
}
|
|
352
|
+
let t = {
|
|
353
|
+
[a.keyProp]: e.key ?? e.id,
|
|
354
|
+
name: e.name ?? e.id,
|
|
355
|
+
modelValue: r,
|
|
356
|
+
...e.props
|
|
357
|
+
};
|
|
358
|
+
i && (t.label = i);
|
|
359
|
+
let n = {
|
|
360
|
+
$cmp: e.type,
|
|
361
|
+
props: t
|
|
362
|
+
};
|
|
363
|
+
return e.key && (n.__key = e.key), e.visibleIf && (n.if = v(e.visibleIf)), typeof n.props?.name == "string" && (n.name = n.props.name), n.children = r, n.outerClass = w(e), n;
|
|
364
|
+
}
|
|
365
|
+
let o = n?.renderAs ?? "cmp", s = D(e, o, n?.target);
|
|
366
|
+
return o === "cmp" ? (s.props = {
|
|
367
|
+
...s.props,
|
|
368
|
+
...e.props,
|
|
369
|
+
label: i
|
|
370
|
+
}, r.length && (s.children = r)) : o === "el" ? r.length && (s.children = r) : (i && (s.label = i), e.props && Object.assign(s, e.props), r.length && (s.children = r)), s.outerClass = w(e), s;
|
|
371
|
+
}
|
|
372
|
+
function ce(e, n) {
|
|
373
|
+
let r = e, i = typeof r.$formkit == "string" ? r.$formkit : typeof r.$cmp == "string" ? r.$cmp : typeof r.$el == "string" ? r.$el : "group", a = r.props && typeof r.props == "object" ? { ...r.props } : {}, o = typeof r.name == "string" && r.name ? r.name : typeof a.name == "string" ? a.name : void 0;
|
|
374
|
+
delete a.name;
|
|
375
|
+
let s = Array.isArray(r.children) ? r.children : Array.isArray(a.modelValue) ? a.modelValue : [], c = u(i), l = {
|
|
376
|
+
id: typeof r.id == "string" && r.id ? r.id : typeof a.id == "string" && a.id ? a.id : typeof r.__key == "string" ? r.__key : f(),
|
|
377
|
+
category: "container",
|
|
378
|
+
type: i,
|
|
379
|
+
renderAs: S(e).renderAs,
|
|
380
|
+
dataType: c == null ? i === "group" ? "object" : "array" : c.dataShape === "object" ? "object" : "array",
|
|
381
|
+
children: n.children ? n.children(s) : []
|
|
382
|
+
}, d = S(e);
|
|
383
|
+
d.target && d.target !== i && (l.target = d.target), typeof r.__key == "string" && r.__key && (l.key = r.__key), typeof o == "string" && o && o !== l.id && (l.name = o), typeof r.label == "string" && r.label ? l.label = r.label : typeof a.label == "string" && a.label && (l.label = a.label), typeof r.if == "string" && r.if && (l.visibleIf = t(r.if)), C(r.outerClass, l);
|
|
384
|
+
let p = {};
|
|
385
|
+
for (let [e, t] of Object.entries(a)) oe.has(e) || t !== void 0 && (p[e] = t);
|
|
386
|
+
for (let [e, t] of Object.entries(r)) [
|
|
387
|
+
"$formkit",
|
|
388
|
+
"$cmp",
|
|
389
|
+
"$el",
|
|
390
|
+
"name",
|
|
391
|
+
"label",
|
|
392
|
+
"if",
|
|
393
|
+
"children",
|
|
394
|
+
"outerClass",
|
|
395
|
+
"props",
|
|
396
|
+
"attrs",
|
|
397
|
+
"__key",
|
|
398
|
+
"id"
|
|
399
|
+
].includes(e) || p[e] === void 0 && t !== void 0 && (p[e] = t);
|
|
400
|
+
return Object.keys(p).length && (l.props = p), l;
|
|
401
|
+
}
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/dsl/convert/layout.ts
|
|
404
|
+
function le(e, t, n) {
|
|
405
|
+
let r = t ?? [], i = e.label, a = n?.container;
|
|
406
|
+
if (a) {
|
|
407
|
+
let t = a.dataShape === "objectOfObjects" ? r.map((t) => ({
|
|
408
|
+
...t,
|
|
409
|
+
__key: t?.__key ?? f(),
|
|
410
|
+
__paneType: e.type
|
|
411
|
+
})) : r, n = {
|
|
412
|
+
$cmp: e.type,
|
|
413
|
+
props: {
|
|
414
|
+
[a.keyProp]: e.key ?? e.id,
|
|
415
|
+
name: e.name,
|
|
416
|
+
modelValue: t,
|
|
417
|
+
...e.props
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
return i && (n.props = {
|
|
421
|
+
...n.props,
|
|
422
|
+
label: i
|
|
423
|
+
}), e.key && (n.__key = e.key), e.visibleIf && (n.if = v(e.visibleIf)), typeof n.props?.name == "string" && (n.name = n.props.name), n.children = t, n.outerClass = w(e), n;
|
|
424
|
+
}
|
|
425
|
+
switch (e.type) {
|
|
426
|
+
case "grid": {
|
|
427
|
+
let t = {
|
|
428
|
+
$el: "div",
|
|
429
|
+
attrs: { class: `grid grid-cols-${Number(e.props?.columns) || 12} gap-${Number(e.props?.gap) || 4}` }
|
|
430
|
+
};
|
|
431
|
+
return e.key && (t.__key = e.key), e.visibleIf && (t.if = v(e.visibleIf)), r.length && (t.children = r), t.outerClass = w(e), t;
|
|
432
|
+
}
|
|
433
|
+
case "row": {
|
|
434
|
+
let t = {
|
|
435
|
+
$el: "div",
|
|
436
|
+
attrs: { class: "flex flex-row flex-wrap gap-2" }
|
|
437
|
+
};
|
|
438
|
+
return e.key && (t.__key = e.key), e.visibleIf && (t.if = v(e.visibleIf)), r.length && (t.children = r), t.outerClass = w(e), t;
|
|
439
|
+
}
|
|
440
|
+
case "column": {
|
|
441
|
+
let t = {
|
|
442
|
+
$el: "div",
|
|
443
|
+
attrs: { class: "flex flex-col gap-2" }
|
|
444
|
+
};
|
|
445
|
+
return e.key && (t.__key = e.key), e.visibleIf && (t.if = v(e.visibleIf)), r.length && (t.children = r), t.outerClass = w(e), t;
|
|
446
|
+
}
|
|
447
|
+
default: {
|
|
448
|
+
let t = n?.renderAs ?? "cmp", a = D(e, t, n?.target);
|
|
449
|
+
return t === "cmp" ? a.props = {
|
|
450
|
+
...a.props,
|
|
451
|
+
...e.props,
|
|
452
|
+
...i ? { label: i } : {}
|
|
453
|
+
} : t === "el" ? e.props && (a.attrs = {
|
|
454
|
+
...a.attrs,
|
|
455
|
+
...e.props
|
|
456
|
+
}) : (i && (a.label = i), e.props && Object.assign(a, e.props)), r.length && (a.children = r), a.outerClass = w(e), a;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
function ue(e, n) {
|
|
461
|
+
let r = e, i = de(e), a = Array.isArray(r.children) ? r.children : [], o = {
|
|
462
|
+
id: typeof r.id == "string" && r.id ? r.id : typeof r.__key == "string" ? r.__key : f(),
|
|
463
|
+
category: "layout",
|
|
464
|
+
type: i,
|
|
465
|
+
renderAs: S(e).renderAs,
|
|
466
|
+
children: n.children ? n.children(a) : []
|
|
467
|
+
}, s = S(e);
|
|
468
|
+
s.target && s.target !== i && (o.target = s.target), typeof r.__key == "string" && r.__key && (o.key = r.__key), typeof r.label == "string" && r.label ? o.label = r.label : typeof r.props?.label == "string" && r.props.label && (o.label = r.props.label), typeof r.if == "string" && r.if && (o.visibleIf = t(r.if)), C(r.outerClass, o);
|
|
469
|
+
let c = typeof r.name == "string" && r.name ? r.name : typeof r.props?.name == "string" ? r.props.name : void 0;
|
|
470
|
+
typeof c == "string" && c && c !== o.id && (o.name = c);
|
|
471
|
+
let l = {};
|
|
472
|
+
if (r.props && typeof r.props == "object") for (let [e, t] of Object.entries(r.props)) oe.has(e) || e === "name" || t !== void 0 && (l[e] = t);
|
|
473
|
+
if (typeof r.props?.title == "string" && (o.label = o.label ?? r.props.title, delete l.title), s.renderAs === "el" && r.attrs && typeof r.attrs == "object") for (let [e, t] of Object.entries(r.attrs)) e === "class" || t === void 0 || (l[e] = t);
|
|
474
|
+
if (i === "grid" && typeof r.attrs?.class == "string") {
|
|
475
|
+
let e = r.attrs.class.match(/grid-cols-(\d+)/), t = r.attrs.class.match(/gap-(\d+)/);
|
|
476
|
+
e && (l.columns = Number(e[1])), t && (l.gap = Number(t[1]));
|
|
477
|
+
}
|
|
478
|
+
return Object.keys(l).length && (o.props = l), o;
|
|
479
|
+
}
|
|
480
|
+
function de(e) {
|
|
481
|
+
let t = e;
|
|
482
|
+
if (t.$cmp === "card") return "card";
|
|
483
|
+
if (t.$cmp === "tabs") return "tabs";
|
|
484
|
+
if (t.$cmp === "steps") return "steps";
|
|
485
|
+
if (t.$el === "div" && typeof t.attrs?.class == "string") {
|
|
486
|
+
let e = t.attrs.class;
|
|
487
|
+
if (e.includes("grid-cols")) return "grid";
|
|
488
|
+
if (e.includes("flex-row")) return "row";
|
|
489
|
+
if (e.includes("flex-col")) return "column";
|
|
490
|
+
}
|
|
491
|
+
return typeof t.__key == "string" && !t.$formkit && !t.$cmp && !t.$el ? "tabsPane" : typeof t.$cmp == "string" ? t.$cmp : "card";
|
|
492
|
+
}
|
|
493
|
+
function fe(e, t) {
|
|
494
|
+
let n = {
|
|
495
|
+
__key: e.key ?? e.id,
|
|
496
|
+
__paneType: e.type
|
|
497
|
+
};
|
|
498
|
+
e.label && (n.label = e.label), e.name && (n.name = e.name);
|
|
499
|
+
let r = e.props?.description;
|
|
500
|
+
typeof r == "string" && r && (n.description = r);
|
|
501
|
+
let i = t ?? [];
|
|
502
|
+
return i.length && (n.children = i), n.outerClass = w(e), n;
|
|
503
|
+
}
|
|
504
|
+
function pe(e, t) {
|
|
505
|
+
let n = e, r = Array.isArray(n.children) ? n.children : [], i = {
|
|
506
|
+
id: typeof n.__key == "string" && n.__key ? n.__key : f(),
|
|
507
|
+
category: "layout",
|
|
508
|
+
type: n.__paneType === "steps" ? "stepsPane" : "tabsPane",
|
|
509
|
+
renderAs: "el",
|
|
510
|
+
children: t.children ? t.children(r) : []
|
|
511
|
+
};
|
|
512
|
+
typeof n.__key == "string" && n.__key && (i.key = n.__key), typeof n.name == "string" && n.name && (i.name = n.name), typeof n.label == "string" && n.label && (i.label = n.label);
|
|
513
|
+
let a = n.description;
|
|
514
|
+
return typeof a == "string" && a && (i.props = {
|
|
515
|
+
...i.props,
|
|
516
|
+
description: a
|
|
517
|
+
}), C(n.outerClass, i), i;
|
|
518
|
+
}
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region src/dsl/convert/static.ts
|
|
521
|
+
var me = new Set([
|
|
522
|
+
"options",
|
|
523
|
+
"value",
|
|
524
|
+
"min",
|
|
525
|
+
"max",
|
|
526
|
+
"step",
|
|
527
|
+
"multiple",
|
|
528
|
+
"accept",
|
|
529
|
+
"placeholder",
|
|
530
|
+
"buttonText"
|
|
531
|
+
]), A = new Set([
|
|
532
|
+
"$formkit",
|
|
533
|
+
"$el",
|
|
534
|
+
"$cmp",
|
|
535
|
+
"name",
|
|
536
|
+
"id",
|
|
537
|
+
"label",
|
|
538
|
+
"type",
|
|
539
|
+
"if",
|
|
540
|
+
"children",
|
|
541
|
+
"attrs",
|
|
542
|
+
"outerClass",
|
|
543
|
+
"props",
|
|
544
|
+
"__bind",
|
|
545
|
+
"__key"
|
|
546
|
+
]);
|
|
547
|
+
function he(e, t) {
|
|
548
|
+
let n = e.props && typeof e.props == "object" ? e.props : {}, r = t?.renderAs ?? (e.type === "submit" || e.type === "reset" ? "formkit" : "el"), i = {}, a = (e) => r === "cmp" ? { $cmp: t?.target ?? e } : r === "el" ? { $el: t?.target ?? e } : { $formkit: e };
|
|
549
|
+
switch (e.type) {
|
|
550
|
+
case "submit":
|
|
551
|
+
case "reset": {
|
|
552
|
+
let t = e.type;
|
|
553
|
+
Object.assign(i, a(t));
|
|
554
|
+
let o = (e, t) => T(i, e, t, r);
|
|
555
|
+
o("name", e.name ?? `${t}_button`), o("label", e.label ?? (t === "submit" ? "Submit" : "Reset")), o("type", t), E(i, n, r);
|
|
556
|
+
let s = w(e);
|
|
557
|
+
i.outerClass = s === "col-span-12" && !e.outerClass ? "col-span-12 pt-2" : s;
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
case "button":
|
|
561
|
+
i.$el = "button", i.attrs = {
|
|
562
|
+
type: n.htmlType ?? "button",
|
|
563
|
+
...n.attrs
|
|
564
|
+
}, e.label && (i.children = e.label);
|
|
565
|
+
break;
|
|
566
|
+
case "paragraph":
|
|
567
|
+
i.$el = "p", i.attrs = { class: "text-sm text-muted-foreground" }, i.children = e.text ?? e.label ?? "";
|
|
568
|
+
break;
|
|
569
|
+
case "heading":
|
|
570
|
+
i.$el = "h3", i.children = e.text ?? e.label ?? "";
|
|
571
|
+
break;
|
|
572
|
+
case "divider":
|
|
573
|
+
i.$el = "hr";
|
|
574
|
+
break;
|
|
575
|
+
default: {
|
|
576
|
+
Object.assign(i, a(e.type));
|
|
577
|
+
let t = (e, t) => T(i, e, t, r);
|
|
578
|
+
e.name && t("name", e.name), e.id && t("id", e.id), e.label && t("label", e.label);
|
|
579
|
+
for (let [e, t] of Object.entries(n)) e !== "__bind" && (r === "formkit" && me.has(e) ? i[e] = t : T(i, e, t, r));
|
|
580
|
+
i.outerClass = w(e);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
e.key && (i.__key = e.key), e.visibleIf && (i.if = v(e.visibleIf));
|
|
584
|
+
let o = x(e.events);
|
|
585
|
+
return o && Object.keys(o).length && E(i, o, r), r === "cmp" && (Object.keys(i.props ?? {}).length === 0 && delete i.props, typeof i.outerClass == "string" && i.outerClass && (i.props = {
|
|
586
|
+
...i.props,
|
|
587
|
+
outerClass: i.outerClass
|
|
588
|
+
}), typeof i.props?.name == "string" && (i.name = i.props.name)), i;
|
|
589
|
+
}
|
|
590
|
+
function ge(e, r) {
|
|
591
|
+
let i = e, a = S(e), o = a.renderAs === "cmp", s = a.renderAs === "el", c = o ? i.props && typeof i.props == "object" ? i.props : {} : s ? i.attrs && typeof i.attrs == "object" ? i.attrs : {} : i, l = i.$formkit === "submit" ? "submit" : typeof i.$formkit == "string" ? i.$formkit : typeof i.$el == "string" ? _e(i.$el) : r ?? "html", u = {
|
|
592
|
+
id: typeof c.id == "string" && c.id ? c.id : typeof i.__key == "string" ? i.__key : f(),
|
|
593
|
+
category: "static",
|
|
594
|
+
type: l,
|
|
595
|
+
renderAs: a.renderAs
|
|
596
|
+
};
|
|
597
|
+
a.target && a.target !== l && (u.target = a.target), typeof i.__key == "string" && i.__key && (u.key = i.__key), typeof c.name == "string" && c.name && c.name !== u.id && (u.name = c.name), typeof c.label == "string" && c.label && (u.label = c.label), typeof i.if == "string" && i.if ? u.visibleIf = t(i.if) : typeof i.if == "boolean" && (u.visibleIf = {
|
|
598
|
+
type: "literal",
|
|
599
|
+
value: i.if
|
|
600
|
+
}), (u.type === "paragraph" || u.type === "heading") && (typeof i.children == "string" ? u.text = i.children : typeof i.children == "number" && (u.text = String(i.children)));
|
|
601
|
+
let d = n(c.__bind);
|
|
602
|
+
d?.length && (u.events = d), C(i.outerClass, u);
|
|
603
|
+
let p = {}, m = (e) => {
|
|
604
|
+
for (let [t, n] of Object.entries(e)) A.has(t) || /^on[A-Z]/.test(t) || n !== void 0 && (p[t] = n);
|
|
605
|
+
};
|
|
606
|
+
if (o) {
|
|
607
|
+
for (let [e, t] of Object.entries(i.props ?? {})) {
|
|
608
|
+
if (e === "type") {
|
|
609
|
+
p.type = t;
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
A.has(e) || /^on[A-Z]/.test(e) || t !== void 0 && (p[e] = t);
|
|
613
|
+
}
|
|
614
|
+
for (let [e, t] of Object.entries(i)) e === "props" || e === "$cmp" || A.has(e) || /^on[A-Z]/.test(e) || t === void 0 || p[e] !== void 0 || (p[e] = t);
|
|
615
|
+
} else if (s) {
|
|
616
|
+
m(i.attrs ?? {});
|
|
617
|
+
for (let [e, t] of Object.entries(i)) e === "attrs" || e === "$el" || A.has(e) || /^on[A-Z]/.test(e) || t !== void 0 && (p[e] = t);
|
|
618
|
+
} else m(i);
|
|
619
|
+
return u.type === "button" && i.attrs && (p.attrs = i.attrs), Object.keys(p).length && (u.props = p), u;
|
|
620
|
+
}
|
|
621
|
+
function _e(e) {
|
|
622
|
+
return e === "button" ? "button" : e === "h1" || e === "h2" || e === "h3" || e === "h4" || e === "h5" || e === "h6" ? "heading" : e === "hr" ? "divider" : e === "p" || e === "span" || e === "div" ? "paragraph" : "html";
|
|
623
|
+
}
|
|
624
|
+
//#endregion
|
|
625
|
+
//#region src/dsl/convert/dispatch.ts
|
|
626
|
+
function j(e, t, n, r) {
|
|
627
|
+
switch (t) {
|
|
628
|
+
case "field": return ie(e, n);
|
|
629
|
+
case "container": return se(e, r?.children, n);
|
|
630
|
+
case "layout": return le(e, r?.children, n);
|
|
631
|
+
case "static": return he(e, n);
|
|
632
|
+
default: throw Error(`[dsl/convert] 未知分类: ${t}`);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
function M(e, t, n, r) {
|
|
636
|
+
switch (t) {
|
|
637
|
+
case "field": return ae(e, r);
|
|
638
|
+
case "container": return ce(e, n ?? {});
|
|
639
|
+
case "layout": return ue(e, n ?? {});
|
|
640
|
+
case "static": return ge(e, r);
|
|
641
|
+
default: throw Error(`[dsl/convert] 未知分类: ${t}`);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region src/dsl/registry.ts
|
|
646
|
+
var N = /* @__PURE__ */ new Map();
|
|
647
|
+
function P(e, t = !1) {
|
|
648
|
+
if (N.has(e.type)) {
|
|
649
|
+
if (!t) throw Error(`[formkit-form-builder] DSL 元素类型 "${e.type}" 重复注册`);
|
|
650
|
+
N.delete(e.type);
|
|
651
|
+
}
|
|
652
|
+
N.set(e.type, e);
|
|
653
|
+
}
|
|
654
|
+
function F(e) {
|
|
655
|
+
if (e) return N.get(e);
|
|
656
|
+
}
|
|
657
|
+
function I() {
|
|
658
|
+
return Array.from(N.values());
|
|
659
|
+
}
|
|
660
|
+
function ve(e) {
|
|
661
|
+
for (let [t, n] of Object.entries(e)) {
|
|
662
|
+
let e = N.get(t);
|
|
663
|
+
e && (e.editor = n);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
var L = {
|
|
667
|
+
NaiveSubmit: "submit",
|
|
668
|
+
NaiveReset: "reset",
|
|
669
|
+
NaiveButton: "naiveButton",
|
|
670
|
+
NaiveH1: "naiveH1",
|
|
671
|
+
NaiveH2: "naiveH2",
|
|
672
|
+
NaiveH3: "naiveH3",
|
|
673
|
+
NaiveH4: "naiveH4",
|
|
674
|
+
NaiveH5: "naiveH5",
|
|
675
|
+
NaiveH6: "naiveH6"
|
|
676
|
+
};
|
|
677
|
+
function ye(e) {
|
|
678
|
+
Object.assign(L, e);
|
|
679
|
+
}
|
|
680
|
+
function be(e) {
|
|
681
|
+
let t = e?.$cmp;
|
|
682
|
+
if (typeof t == "string") return L[t];
|
|
683
|
+
}
|
|
684
|
+
function xe(e, t, n, r) {
|
|
685
|
+
let i = r ?? e ?? t;
|
|
686
|
+
return e ? {
|
|
687
|
+
renderAs: "cmp",
|
|
688
|
+
target: i
|
|
689
|
+
} : {
|
|
690
|
+
renderAs: n,
|
|
691
|
+
target: i
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
function R(e) {
|
|
695
|
+
let { type: t, category: n, schema: r } = e, i = e.container ?? u(t), a = {
|
|
696
|
+
renderAs: r.renderAs,
|
|
697
|
+
target: r.target ?? t,
|
|
698
|
+
...i ? { container: i } : {}
|
|
699
|
+
};
|
|
700
|
+
return {
|
|
701
|
+
type: t,
|
|
702
|
+
category: n,
|
|
703
|
+
renderAs: a.renderAs,
|
|
704
|
+
target: a.target,
|
|
705
|
+
...i ? { container: i } : {},
|
|
706
|
+
template: r,
|
|
707
|
+
icon: e.icon,
|
|
708
|
+
tooltipKey: e.tooltipKey,
|
|
709
|
+
editor: e.editor,
|
|
710
|
+
bindEvents: e.bindEvents,
|
|
711
|
+
defaults: () => Se(e),
|
|
712
|
+
toSchema: r.toSchema ?? ((e, t) => j(e, n, a, t)),
|
|
713
|
+
match: r.match ?? ((e) => te(e, a) || e.$formkit === t || be(e) === t),
|
|
714
|
+
fromSchema: r.fromSchema ?? ((e, r) => M(e, n, r, t))
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
function Se(e) {
|
|
718
|
+
let { type: t, category: n, schema: r } = e, i = r.presetOf ?? t, a = {
|
|
719
|
+
id: f(),
|
|
720
|
+
category: n,
|
|
721
|
+
type: i,
|
|
722
|
+
renderAs: r.renderAs
|
|
723
|
+
};
|
|
724
|
+
r.target && r.target !== i && (a.target = r.target), r.outerClass && (a.outerClass = r.outerClass);
|
|
725
|
+
let o = { ...r.props };
|
|
726
|
+
if (n === "field") {
|
|
727
|
+
r.value !== void 0 && (a.value = r.value), Array.isArray(r.options) ? a.options = r.options : Array.isArray(o.options) && (a.options = o.options, delete o.options);
|
|
728
|
+
let e = O(r.validation ? [[r.validation]] : void 0);
|
|
729
|
+
e?.length && (a.validation = e);
|
|
730
|
+
} else r.value !== void 0 && (o.value = r.value), r.options !== void 0 && (o.options = r.options);
|
|
731
|
+
if (Object.keys(o).length && (a.props = o), n === "container" || n === "layout") {
|
|
732
|
+
a.children = typeof r.defaultChildren == "function" ? r.defaultChildren() : [];
|
|
733
|
+
let t = e.container ?? u(i);
|
|
734
|
+
t && n === "container" && (a.dataType = t.dataShape === "object" ? "object" : "array");
|
|
735
|
+
}
|
|
736
|
+
return a;
|
|
737
|
+
}
|
|
738
|
+
function z(e, t) {
|
|
739
|
+
let n = t?.cmp, r = t?.container ?? u(e), i = {
|
|
740
|
+
renderAs: n != null || r != null ? "cmp" : "el",
|
|
741
|
+
target: t?.target ?? n ?? e,
|
|
742
|
+
...r ? { container: r } : {}
|
|
743
|
+
};
|
|
744
|
+
return {
|
|
745
|
+
type: e,
|
|
746
|
+
category: "layout",
|
|
747
|
+
renderAs: i.renderAs,
|
|
748
|
+
target: i.target,
|
|
749
|
+
container: r ?? void 0,
|
|
750
|
+
defaults: () => ({
|
|
751
|
+
id: f(),
|
|
752
|
+
category: "layout",
|
|
753
|
+
type: e,
|
|
754
|
+
renderAs: i.renderAs,
|
|
755
|
+
...i.target && i.target !== e ? { target: i.target } : {},
|
|
756
|
+
children: []
|
|
757
|
+
}),
|
|
758
|
+
toSchema: (e, t) => j(e, "layout", i, t),
|
|
759
|
+
match: (t) => {
|
|
760
|
+
let n = t;
|
|
761
|
+
return e === "card" ? n.$cmp === "card" || n.$formkit === "card" : e === "tabs" ? n.$cmp === "tabs" || n.$formkit === "tabs" : e === "steps" ? n.$cmp === "steps" || n.$formkit === "steps" : e === "grid" ? n.$el === "div" && typeof n.attrs?.class == "string" && String(n.attrs.class).includes("grid-cols") : e === "row" ? n.$el === "div" && typeof n.attrs?.class == "string" && String(n.attrs.class).includes("flex-row") : e === "column" ? n.$el === "div" && typeof n.attrs?.class == "string" && String(n.attrs.class).includes("flex-col") : n.$cmp === e;
|
|
762
|
+
},
|
|
763
|
+
fromSchema: (t, n) => M(t, "layout", n, e),
|
|
764
|
+
...t
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
function B(e, t) {
|
|
768
|
+
let n = xe(t?.cmp, e, e === "submit" || e === "reset" ? "formkit" : "el", t?.target);
|
|
769
|
+
return {
|
|
770
|
+
type: e,
|
|
771
|
+
category: "static",
|
|
772
|
+
renderAs: n.renderAs,
|
|
773
|
+
target: n.target,
|
|
774
|
+
defaults: () => ({
|
|
775
|
+
id: f(),
|
|
776
|
+
category: "static",
|
|
777
|
+
type: e,
|
|
778
|
+
renderAs: n.renderAs,
|
|
779
|
+
...n.target && n.target !== e ? { target: n.target } : {}
|
|
780
|
+
}),
|
|
781
|
+
toSchema: (e) => j(e, "static", n, void 0),
|
|
782
|
+
match: (t) => {
|
|
783
|
+
let r = t;
|
|
784
|
+
return n.renderAs === "cmp" ? r.$cmp === n.target || r.$formkit === e : e === "submit" ? r.$formkit === "submit" : e === "reset" ? r.$formkit === "reset" : r.$el === e;
|
|
785
|
+
},
|
|
786
|
+
fromSchema: (t) => M(t, "static", void 0, e),
|
|
787
|
+
...t
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
function Ce(e) {
|
|
791
|
+
let t = e === "stepsPane";
|
|
792
|
+
return {
|
|
793
|
+
type: e,
|
|
794
|
+
category: "layout",
|
|
795
|
+
renderAs: "el",
|
|
796
|
+
defaults: () => ({
|
|
797
|
+
id: f(),
|
|
798
|
+
category: "layout",
|
|
799
|
+
type: e,
|
|
800
|
+
renderAs: "el",
|
|
801
|
+
children: []
|
|
802
|
+
}),
|
|
803
|
+
toSchema: (e, t) => fe(e, t.children),
|
|
804
|
+
match: (e) => {
|
|
805
|
+
let n = e;
|
|
806
|
+
return typeof n.__key == "string" && !n.$formkit && !n.$cmp && !n.$el && (t ? n.__paneType === "steps" : n.__paneType !== "steps");
|
|
807
|
+
},
|
|
808
|
+
fromSchema: (e, t) => pe(e, t)
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
function we() {
|
|
812
|
+
return Ce("tabsPane");
|
|
813
|
+
}
|
|
814
|
+
function Te() {
|
|
815
|
+
return Ce("stepsPane");
|
|
816
|
+
}
|
|
817
|
+
//#endregion
|
|
818
|
+
//#region src/elements/definitions/bind-events.ts
|
|
819
|
+
var V = [
|
|
820
|
+
"onChange",
|
|
821
|
+
"onInput",
|
|
822
|
+
"onFocus",
|
|
823
|
+
"onBlur"
|
|
824
|
+
], H = ["onChange", "onInput"], Ee = ["onClick"], U = [
|
|
825
|
+
"onClick",
|
|
826
|
+
"onFocus",
|
|
827
|
+
"onBlur"
|
|
828
|
+
], W = [], G = {
|
|
829
|
+
size: "medium",
|
|
830
|
+
clearable: !0
|
|
831
|
+
}, De = [
|
|
832
|
+
{
|
|
833
|
+
type: "text",
|
|
834
|
+
category: "field",
|
|
835
|
+
icon: "i-lucide-type",
|
|
836
|
+
tooltipKey: "fieldProps.tooltip.text",
|
|
837
|
+
bindEvents: V,
|
|
838
|
+
schema: {
|
|
839
|
+
renderAs: "cmp",
|
|
840
|
+
nameKey: "elements.text.name",
|
|
841
|
+
labelKey: "elements.text.label",
|
|
842
|
+
props: { ...G },
|
|
843
|
+
placeholderKey: "elements.text.placeholder",
|
|
844
|
+
descriptionKey: "elements.text.description"
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
type: "textarea",
|
|
849
|
+
category: "field",
|
|
850
|
+
icon: "i-lucide-letter-text",
|
|
851
|
+
tooltipKey: "fieldProps.tooltip.textarea",
|
|
852
|
+
bindEvents: V,
|
|
853
|
+
schema: {
|
|
854
|
+
renderAs: "cmp",
|
|
855
|
+
nameKey: "elements.textarea.name",
|
|
856
|
+
labelKey: "elements.textarea.label",
|
|
857
|
+
props: { ...G },
|
|
858
|
+
placeholderKey: "elements.textarea.placeholder",
|
|
859
|
+
descriptionKey: "elements.textarea.description"
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
type: "email",
|
|
864
|
+
category: "field",
|
|
865
|
+
icon: "i-lucide-mail",
|
|
866
|
+
tooltipKey: "fieldProps.tooltip.email",
|
|
867
|
+
bindEvents: V,
|
|
868
|
+
schema: {
|
|
869
|
+
renderAs: "cmp",
|
|
870
|
+
nameKey: "elements.email.name",
|
|
871
|
+
labelKey: "elements.email.label",
|
|
872
|
+
props: { ...G },
|
|
873
|
+
placeholderKey: "elements.email.placeholder",
|
|
874
|
+
validation: "email",
|
|
875
|
+
descriptionKey: "elements.email.description"
|
|
876
|
+
}
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
type: "url",
|
|
880
|
+
category: "field",
|
|
881
|
+
icon: "i-lucide-link-2",
|
|
882
|
+
tooltipKey: "fieldProps.tooltip.url",
|
|
883
|
+
bindEvents: V,
|
|
884
|
+
schema: {
|
|
885
|
+
renderAs: "cmp",
|
|
886
|
+
nameKey: "elements.url.name",
|
|
887
|
+
labelKey: "elements.url.label",
|
|
888
|
+
props: { ...G },
|
|
889
|
+
placeholderKey: "elements.url.placeholder",
|
|
890
|
+
validation: "url",
|
|
891
|
+
descriptionKey: "elements.url.description"
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
type: "tel",
|
|
896
|
+
category: "field",
|
|
897
|
+
icon: "i-lucide-phone",
|
|
898
|
+
tooltipKey: "fieldProps.tooltip.tel",
|
|
899
|
+
bindEvents: V,
|
|
900
|
+
schema: {
|
|
901
|
+
renderAs: "cmp",
|
|
902
|
+
nameKey: "elements.tel.name",
|
|
903
|
+
labelKey: "elements.tel.label",
|
|
904
|
+
placeholderKey: "elements.tel.placeholder",
|
|
905
|
+
props: { ...G },
|
|
906
|
+
descriptionKey: "elements.tel.description"
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
type: "password",
|
|
911
|
+
category: "field",
|
|
912
|
+
icon: "i-lucide-lock",
|
|
913
|
+
tooltipKey: "fieldProps.tooltip.password",
|
|
914
|
+
bindEvents: V,
|
|
915
|
+
schema: {
|
|
916
|
+
renderAs: "cmp",
|
|
917
|
+
nameKey: "elements.password.name",
|
|
918
|
+
labelKey: "elements.password.label",
|
|
919
|
+
placeholderKey: "elements.password.placeholder",
|
|
920
|
+
props: { ...G },
|
|
921
|
+
descriptionKey: "elements.password.description"
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
type: "number",
|
|
926
|
+
category: "field",
|
|
927
|
+
icon: "i-lucide-hash",
|
|
928
|
+
tooltipKey: "fieldProps.tooltip.number",
|
|
929
|
+
bindEvents: V,
|
|
930
|
+
schema: {
|
|
931
|
+
renderAs: "cmp",
|
|
932
|
+
nameKey: "elements.number.name",
|
|
933
|
+
labelKey: "elements.number.label",
|
|
934
|
+
props: {
|
|
935
|
+
...G,
|
|
936
|
+
number: "integer"
|
|
937
|
+
},
|
|
938
|
+
placeholderKey: "elements.number.placeholder",
|
|
939
|
+
validation: "number",
|
|
940
|
+
descriptionKey: "elements.number.description"
|
|
941
|
+
}
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
type: "range",
|
|
945
|
+
category: "field",
|
|
946
|
+
icon: "i-lucide-sliders-horizontal",
|
|
947
|
+
tooltipKey: "fieldProps.tooltip.range",
|
|
948
|
+
bindEvents: H,
|
|
949
|
+
schema: {
|
|
950
|
+
renderAs: "cmp",
|
|
951
|
+
nameKey: "elements.range.name",
|
|
952
|
+
labelKey: "elements.range.label",
|
|
953
|
+
props: {
|
|
954
|
+
...G,
|
|
955
|
+
children: "$slots.default",
|
|
956
|
+
__raw__sectionsSchema: { prefix: {
|
|
957
|
+
$el: "div",
|
|
958
|
+
attrs: { class: " py-1 px-2 mr-1 text-sm flex items-center bg-muted mr-2 rounded-md" },
|
|
959
|
+
children: "$value"
|
|
960
|
+
} }
|
|
961
|
+
},
|
|
962
|
+
value: 0,
|
|
963
|
+
descriptionKey: "elements.range.description"
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
type: "date",
|
|
968
|
+
category: "field",
|
|
969
|
+
icon: "i-lucide-calendar",
|
|
970
|
+
tooltipKey: "fieldProps.tooltip.date",
|
|
971
|
+
bindEvents: V,
|
|
972
|
+
schema: {
|
|
973
|
+
renderAs: "cmp",
|
|
974
|
+
nameKey: "elements.date.name",
|
|
975
|
+
labelKey: "elements.date.label",
|
|
976
|
+
props: {
|
|
977
|
+
...G,
|
|
978
|
+
valueFormat: a,
|
|
979
|
+
pickerType: "date"
|
|
980
|
+
},
|
|
981
|
+
descriptionKey: "elements.date.description"
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
type: "time",
|
|
986
|
+
category: "field",
|
|
987
|
+
icon: "i-lucide-clock",
|
|
988
|
+
tooltipKey: "fieldProps.tooltip.time",
|
|
989
|
+
bindEvents: V,
|
|
990
|
+
schema: {
|
|
991
|
+
renderAs: "cmp",
|
|
992
|
+
nameKey: "elements.time.name",
|
|
993
|
+
labelKey: "elements.time.label",
|
|
994
|
+
props: {
|
|
995
|
+
...G,
|
|
996
|
+
valueFormat: o
|
|
997
|
+
},
|
|
998
|
+
descriptionKey: "elements.time.description"
|
|
999
|
+
}
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
type: "naiveDateTime",
|
|
1003
|
+
category: "field",
|
|
1004
|
+
icon: "i-lucide-calendar-clock",
|
|
1005
|
+
tooltipKey: "fieldProps.tooltip.dateTime",
|
|
1006
|
+
bindEvents: V,
|
|
1007
|
+
schema: {
|
|
1008
|
+
renderAs: "cmp",
|
|
1009
|
+
nameKey: "elements.dateTime.name",
|
|
1010
|
+
labelKey: "elements.dateTime.label",
|
|
1011
|
+
props: {
|
|
1012
|
+
...G,
|
|
1013
|
+
valueFormat: s,
|
|
1014
|
+
pickerType: "datetime"
|
|
1015
|
+
},
|
|
1016
|
+
descriptionKey: "elements.dateTime.description"
|
|
1017
|
+
}
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
type: "select",
|
|
1021
|
+
category: "field",
|
|
1022
|
+
icon: "i-lucide-list",
|
|
1023
|
+
tooltipKey: "fieldProps.tooltip.select",
|
|
1024
|
+
bindEvents: V,
|
|
1025
|
+
schema: {
|
|
1026
|
+
renderAs: "cmp",
|
|
1027
|
+
nameKey: "elements.select.name",
|
|
1028
|
+
labelKey: "elements.select.label",
|
|
1029
|
+
props: {
|
|
1030
|
+
...G,
|
|
1031
|
+
filterable: !1,
|
|
1032
|
+
multiple: !1,
|
|
1033
|
+
options: ["one"]
|
|
1034
|
+
},
|
|
1035
|
+
descriptionKey: "elements.select.description"
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
type: "radio",
|
|
1040
|
+
category: "field",
|
|
1041
|
+
icon: "i-lucide-circle-dot",
|
|
1042
|
+
tooltipKey: "fieldProps.tooltip.radio",
|
|
1043
|
+
bindEvents: H,
|
|
1044
|
+
schema: {
|
|
1045
|
+
renderAs: "cmp",
|
|
1046
|
+
nameKey: "elements.radio.name",
|
|
1047
|
+
labelKey: "elements.radio.label",
|
|
1048
|
+
props: {
|
|
1049
|
+
...G,
|
|
1050
|
+
options: ["one"]
|
|
1051
|
+
},
|
|
1052
|
+
descriptionKey: "elements.radio.description"
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
type: "checkbox",
|
|
1057
|
+
category: "field",
|
|
1058
|
+
icon: "i-lucide-square-check",
|
|
1059
|
+
tooltipKey: "fieldProps.tooltip.checkbox",
|
|
1060
|
+
bindEvents: H,
|
|
1061
|
+
schema: {
|
|
1062
|
+
renderAs: "cmp",
|
|
1063
|
+
nameKey: "elements.checkbox.name",
|
|
1064
|
+
labelKey: "elements.checkbox.label",
|
|
1065
|
+
props: {
|
|
1066
|
+
...G,
|
|
1067
|
+
options: ["One"]
|
|
1068
|
+
},
|
|
1069
|
+
descriptionKey: "elements.checkbox.description"
|
|
1070
|
+
}
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
type: "naiveCascader",
|
|
1074
|
+
category: "field",
|
|
1075
|
+
icon: "i-lucide-list",
|
|
1076
|
+
tooltipKey: "fieldProps.tooltip.naiveCascader",
|
|
1077
|
+
bindEvents: V,
|
|
1078
|
+
schema: {
|
|
1079
|
+
renderAs: "cmp",
|
|
1080
|
+
nameKey: "elements.naiveCascader.name",
|
|
1081
|
+
labelKey: "elements.naiveCascader.label",
|
|
1082
|
+
props: {
|
|
1083
|
+
...G,
|
|
1084
|
+
filterable: !1,
|
|
1085
|
+
multiple: !1,
|
|
1086
|
+
options: [{
|
|
1087
|
+
label: "Option 1",
|
|
1088
|
+
value: "1",
|
|
1089
|
+
children: [{
|
|
1090
|
+
label: "Option 1-1",
|
|
1091
|
+
value: "1-1"
|
|
1092
|
+
}, {
|
|
1093
|
+
label: "Option 1-2",
|
|
1094
|
+
value: "1-2"
|
|
1095
|
+
}]
|
|
1096
|
+
}, {
|
|
1097
|
+
label: "Option 2",
|
|
1098
|
+
value: "2"
|
|
1099
|
+
}]
|
|
1100
|
+
},
|
|
1101
|
+
placeholderKey: "elements.common.selectPlaceholder",
|
|
1102
|
+
descriptionKey: "elements.naiveCascader.description"
|
|
1103
|
+
}
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
type: "naiveTreeSelect",
|
|
1107
|
+
category: "field",
|
|
1108
|
+
icon: "i-lucide-list-tree",
|
|
1109
|
+
tooltipKey: "fieldProps.tooltip.naiveTreeSelect",
|
|
1110
|
+
bindEvents: V,
|
|
1111
|
+
schema: {
|
|
1112
|
+
renderAs: "cmp",
|
|
1113
|
+
nameKey: "elements.naiveTreeSelect.name",
|
|
1114
|
+
labelKey: "elements.naiveTreeSelect.label",
|
|
1115
|
+
props: {
|
|
1116
|
+
...G,
|
|
1117
|
+
filterable: !1,
|
|
1118
|
+
multiple: !1,
|
|
1119
|
+
options: [{
|
|
1120
|
+
label: "Node 1",
|
|
1121
|
+
key: "1",
|
|
1122
|
+
children: [{
|
|
1123
|
+
label: "Node 1-1",
|
|
1124
|
+
key: "1-1"
|
|
1125
|
+
}, {
|
|
1126
|
+
label: "Node 1-2",
|
|
1127
|
+
key: "1-2"
|
|
1128
|
+
}]
|
|
1129
|
+
}, {
|
|
1130
|
+
label: "Node 2",
|
|
1131
|
+
key: "2"
|
|
1132
|
+
}]
|
|
1133
|
+
},
|
|
1134
|
+
placeholderKey: "elements.common.selectPlaceholder",
|
|
1135
|
+
descriptionKey: "elements.naiveTreeSelect.description"
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
type: "naiveTransfer",
|
|
1140
|
+
category: "field",
|
|
1141
|
+
icon: "i-lucide-arrow-left-right",
|
|
1142
|
+
tooltipKey: "fieldProps.tooltip.naiveTransfer",
|
|
1143
|
+
bindEvents: H,
|
|
1144
|
+
schema: {
|
|
1145
|
+
renderAs: "cmp",
|
|
1146
|
+
nameKey: "elements.naiveTransfer.name",
|
|
1147
|
+
labelKey: "elements.naiveTransfer.label",
|
|
1148
|
+
props: {
|
|
1149
|
+
size: "medium",
|
|
1150
|
+
filterable: !1,
|
|
1151
|
+
options: [
|
|
1152
|
+
{
|
|
1153
|
+
label: "Option 1",
|
|
1154
|
+
value: "1"
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
label: "Option 2",
|
|
1158
|
+
value: "2"
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
label: "Option 3",
|
|
1162
|
+
value: "3"
|
|
1163
|
+
}
|
|
1164
|
+
]
|
|
1165
|
+
},
|
|
1166
|
+
value: [],
|
|
1167
|
+
descriptionKey: "elements.naiveTransfer.description"
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
type: "naiveMention",
|
|
1172
|
+
category: "field",
|
|
1173
|
+
icon: "i-lucide-letter-text",
|
|
1174
|
+
tooltipKey: "fieldProps.tooltip.naiveMention",
|
|
1175
|
+
bindEvents: V,
|
|
1176
|
+
schema: {
|
|
1177
|
+
renderAs: "cmp",
|
|
1178
|
+
nameKey: "elements.naiveMention.name",
|
|
1179
|
+
labelKey: "elements.naiveMention.label",
|
|
1180
|
+
props: { size: "medium" },
|
|
1181
|
+
placeholderKey: "elements.naiveMention.placeholder",
|
|
1182
|
+
options: ["alice", "bob"],
|
|
1183
|
+
descriptionKey: "elements.naiveMention.description"
|
|
1184
|
+
}
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
type: "naiveAutoComplete",
|
|
1188
|
+
category: "field",
|
|
1189
|
+
icon: "i-lucide-sparkles",
|
|
1190
|
+
tooltipKey: "fieldProps.tooltip.naiveAutoComplete",
|
|
1191
|
+
bindEvents: V,
|
|
1192
|
+
schema: {
|
|
1193
|
+
renderAs: "cmp",
|
|
1194
|
+
nameKey: "elements.naiveAutoComplete.name",
|
|
1195
|
+
labelKey: "elements.naiveAutoComplete.label",
|
|
1196
|
+
props: { ...G },
|
|
1197
|
+
placeholderKey: "elements.naiveAutoComplete.placeholder",
|
|
1198
|
+
options: ["Apple", "Banana"],
|
|
1199
|
+
descriptionKey: "elements.naiveAutoComplete.description"
|
|
1200
|
+
}
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
type: "naiveSwitch",
|
|
1204
|
+
category: "field",
|
|
1205
|
+
icon: "i-lucide-square-check",
|
|
1206
|
+
tooltipKey: "fieldProps.tooltip.naiveSwitch",
|
|
1207
|
+
bindEvents: H,
|
|
1208
|
+
schema: {
|
|
1209
|
+
renderAs: "cmp",
|
|
1210
|
+
nameKey: "elements.naiveSwitch.name",
|
|
1211
|
+
labelKey: "elements.naiveSwitch.label",
|
|
1212
|
+
props: { size: "medium" },
|
|
1213
|
+
value: !1,
|
|
1214
|
+
descriptionKey: "elements.naiveSwitch.description"
|
|
1215
|
+
}
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
type: "naiveRate",
|
|
1219
|
+
category: "field",
|
|
1220
|
+
icon: "i-lucide-sliders-horizontal",
|
|
1221
|
+
tooltipKey: "fieldProps.tooltip.naiveRate",
|
|
1222
|
+
bindEvents: H,
|
|
1223
|
+
schema: {
|
|
1224
|
+
renderAs: "cmp",
|
|
1225
|
+
nameKey: "elements.naiveRate.name",
|
|
1226
|
+
labelKey: "elements.naiveRate.label",
|
|
1227
|
+
props: {
|
|
1228
|
+
clearable: !0,
|
|
1229
|
+
allowHalf: !1,
|
|
1230
|
+
count: 5
|
|
1231
|
+
},
|
|
1232
|
+
value: 0,
|
|
1233
|
+
descriptionKey: "elements.naiveRate.description"
|
|
1234
|
+
}
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
type: "file",
|
|
1238
|
+
category: "field",
|
|
1239
|
+
icon: "i-lucide-paperclip",
|
|
1240
|
+
tooltipKey: "fieldProps.tooltip.file",
|
|
1241
|
+
bindEvents: H,
|
|
1242
|
+
schema: {
|
|
1243
|
+
renderAs: "cmp",
|
|
1244
|
+
nameKey: "elements.file.name",
|
|
1245
|
+
labelKey: "elements.file.label",
|
|
1246
|
+
helpKey: "elements.file.help",
|
|
1247
|
+
props: {
|
|
1248
|
+
...G,
|
|
1249
|
+
accept: ".pdf,.doc,.docx,.xml,.md,.csv,.jpg,.png,.webp"
|
|
1250
|
+
},
|
|
1251
|
+
descriptionKey: "elements.file.description"
|
|
1252
|
+
}
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
type: "naiveImage",
|
|
1256
|
+
category: "field",
|
|
1257
|
+
icon: "i-lucide-image",
|
|
1258
|
+
tooltipKey: "fieldProps.tooltip.naiveImage",
|
|
1259
|
+
bindEvents: Ee,
|
|
1260
|
+
schema: {
|
|
1261
|
+
renderAs: "cmp",
|
|
1262
|
+
nameKey: "elements.naiveImage.name",
|
|
1263
|
+
labelKey: "elements.naiveImage.label",
|
|
1264
|
+
props: {
|
|
1265
|
+
src: "",
|
|
1266
|
+
alt: "",
|
|
1267
|
+
sizeMode: "ratio",
|
|
1268
|
+
aspectRatio: "16/9",
|
|
1269
|
+
objectFit: "cover",
|
|
1270
|
+
previewDisabled: !1,
|
|
1271
|
+
lazy: !1
|
|
1272
|
+
},
|
|
1273
|
+
descriptionKey: "elements.naiveImage.description"
|
|
1274
|
+
}
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
type: "naiveAvatar",
|
|
1278
|
+
category: "field",
|
|
1279
|
+
icon: "i-stash:user-avatar",
|
|
1280
|
+
tooltipKey: "fieldProps.tooltip.naiveAvatar",
|
|
1281
|
+
bindEvents: Ee,
|
|
1282
|
+
schema: {
|
|
1283
|
+
renderAs: "cmp",
|
|
1284
|
+
nameKey: "elements.naiveAvatar.name",
|
|
1285
|
+
labelKey: "elements.naiveAvatar.label",
|
|
1286
|
+
props: {
|
|
1287
|
+
src: "",
|
|
1288
|
+
size: "small",
|
|
1289
|
+
round: !0,
|
|
1290
|
+
bordered: !1,
|
|
1291
|
+
fallbackText: "A"
|
|
1292
|
+
},
|
|
1293
|
+
descriptionKey: "elements.naiveAvatar.description"
|
|
1294
|
+
}
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
type: "color",
|
|
1298
|
+
category: "field",
|
|
1299
|
+
icon: "i-lucide-pipette",
|
|
1300
|
+
tooltipKey: "fieldProps.tooltip.color",
|
|
1301
|
+
bindEvents: H,
|
|
1302
|
+
schema: {
|
|
1303
|
+
renderAs: "cmp",
|
|
1304
|
+
nameKey: "elements.color.name",
|
|
1305
|
+
labelKey: "elements.color.label",
|
|
1306
|
+
value: "#00ff00",
|
|
1307
|
+
props: { ...G },
|
|
1308
|
+
descriptionKey: "elements.color.description"
|
|
1309
|
+
}
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
type: "richText",
|
|
1313
|
+
category: "field",
|
|
1314
|
+
icon: "i-lucide-file-text",
|
|
1315
|
+
tooltipKey: "fieldProps.tooltip.richText",
|
|
1316
|
+
bindEvents: H,
|
|
1317
|
+
schema: {
|
|
1318
|
+
renderAs: "cmp",
|
|
1319
|
+
nameKey: "elements.richText.name",
|
|
1320
|
+
labelKey: "elements.richText.label",
|
|
1321
|
+
props: {
|
|
1322
|
+
minHeight: 160,
|
|
1323
|
+
maxLength: null,
|
|
1324
|
+
toolbar: [
|
|
1325
|
+
"bold",
|
|
1326
|
+
"italic",
|
|
1327
|
+
"underline",
|
|
1328
|
+
"strike",
|
|
1329
|
+
"heading",
|
|
1330
|
+
"bulletList",
|
|
1331
|
+
"orderedList",
|
|
1332
|
+
"blockquote",
|
|
1333
|
+
"link",
|
|
1334
|
+
"clear",
|
|
1335
|
+
"undo",
|
|
1336
|
+
"redo"
|
|
1337
|
+
]
|
|
1338
|
+
},
|
|
1339
|
+
placeholderKey: "elements.richText.placeholder",
|
|
1340
|
+
value: "",
|
|
1341
|
+
descriptionKey: "elements.richText.description"
|
|
1342
|
+
}
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
type: "signature",
|
|
1346
|
+
category: "field",
|
|
1347
|
+
icon: "i-lucide-signature",
|
|
1348
|
+
tooltipKey: "fieldProps.tooltip.signature",
|
|
1349
|
+
bindEvents: H,
|
|
1350
|
+
schema: {
|
|
1351
|
+
renderAs: "cmp",
|
|
1352
|
+
nameKey: "elements.signature.name",
|
|
1353
|
+
labelKey: "elements.signature.label",
|
|
1354
|
+
props: {
|
|
1355
|
+
height: 180,
|
|
1356
|
+
strokeColor: "#111111",
|
|
1357
|
+
strokeWidth: 2
|
|
1358
|
+
},
|
|
1359
|
+
value: "",
|
|
1360
|
+
descriptionKey: "elements.signature.description"
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
], K = (e, t, n) => ({
|
|
1364
|
+
type: `naiveH${e}`,
|
|
1365
|
+
category: "static",
|
|
1366
|
+
icon: t,
|
|
1367
|
+
tooltipKey: n,
|
|
1368
|
+
bindEvents: W,
|
|
1369
|
+
schema: {
|
|
1370
|
+
renderAs: "cmp",
|
|
1371
|
+
props: { text: "text" },
|
|
1372
|
+
nameKey: `elements.naiveH${e}.name`,
|
|
1373
|
+
descriptionKey: `elements.naiveH${e}.description`
|
|
1374
|
+
}
|
|
1375
|
+
}), Oe = [
|
|
1376
|
+
{
|
|
1377
|
+
type: "submit",
|
|
1378
|
+
category: "static",
|
|
1379
|
+
icon: "i-lucide-send-horizontal",
|
|
1380
|
+
tooltipKey: "fieldProps.tooltip.submit",
|
|
1381
|
+
bindEvents: U,
|
|
1382
|
+
schema: {
|
|
1383
|
+
renderAs: "cmp",
|
|
1384
|
+
nameKey: "elements.submit.name",
|
|
1385
|
+
descriptionKey: "elements.submit.description",
|
|
1386
|
+
labelKey: "elements.submit.label",
|
|
1387
|
+
props: {
|
|
1388
|
+
buttonType: "success",
|
|
1389
|
+
block: !0
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
type: "reset",
|
|
1395
|
+
category: "static",
|
|
1396
|
+
icon: "i-lucide-rotate-ccw",
|
|
1397
|
+
tooltipKey: "fieldProps.tooltip.reset",
|
|
1398
|
+
bindEvents: U,
|
|
1399
|
+
schema: {
|
|
1400
|
+
renderAs: "cmp",
|
|
1401
|
+
nameKey: "elements.reset.name",
|
|
1402
|
+
descriptionKey: "elements.reset.description",
|
|
1403
|
+
labelKey: "elements.reset.label",
|
|
1404
|
+
props: {
|
|
1405
|
+
buttonType: "warning",
|
|
1406
|
+
block: !0
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
type: "naiveButton",
|
|
1412
|
+
category: "static",
|
|
1413
|
+
icon: "i-lucide-square-mouse-pointer",
|
|
1414
|
+
tooltipKey: "fieldProps.tooltip.naiveButton",
|
|
1415
|
+
bindEvents: U,
|
|
1416
|
+
schema: {
|
|
1417
|
+
renderAs: "cmp",
|
|
1418
|
+
props: {
|
|
1419
|
+
block: !0,
|
|
1420
|
+
bordered: !0,
|
|
1421
|
+
circle: !1,
|
|
1422
|
+
dashed: !1,
|
|
1423
|
+
focusable: !0,
|
|
1424
|
+
fullWidth: !1,
|
|
1425
|
+
align: "left",
|
|
1426
|
+
ghost: !1,
|
|
1427
|
+
round: !1,
|
|
1428
|
+
secondary: !1,
|
|
1429
|
+
size: "medium",
|
|
1430
|
+
buttonType: "default"
|
|
1431
|
+
},
|
|
1432
|
+
nameKey: "elements.naiveButton.name",
|
|
1433
|
+
descriptionKey: "elements.naiveButton.description",
|
|
1434
|
+
labelKey: "elements.naiveButton.label"
|
|
1435
|
+
}
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
type: "naiveText",
|
|
1439
|
+
category: "static",
|
|
1440
|
+
icon: "i-lucide-letter-text",
|
|
1441
|
+
tooltipKey: "fieldProps.tooltip.naiveText",
|
|
1442
|
+
bindEvents: W,
|
|
1443
|
+
schema: {
|
|
1444
|
+
renderAs: "cmp",
|
|
1445
|
+
props: {
|
|
1446
|
+
text: "text",
|
|
1447
|
+
theme: "default",
|
|
1448
|
+
depth: 1,
|
|
1449
|
+
strong: !1,
|
|
1450
|
+
italic: !1,
|
|
1451
|
+
underline: !1,
|
|
1452
|
+
delete: !1,
|
|
1453
|
+
code: !1
|
|
1454
|
+
},
|
|
1455
|
+
nameKey: "elements.naiveText.name",
|
|
1456
|
+
descriptionKey: "elements.naiveText.description"
|
|
1457
|
+
}
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
type: "naiveP",
|
|
1461
|
+
category: "static",
|
|
1462
|
+
icon: "i-lucide-letter-text",
|
|
1463
|
+
tooltipKey: "fieldProps.tooltip.naiveP",
|
|
1464
|
+
bindEvents: W,
|
|
1465
|
+
schema: {
|
|
1466
|
+
renderAs: "cmp",
|
|
1467
|
+
props: {
|
|
1468
|
+
theme: "default",
|
|
1469
|
+
depth: 1,
|
|
1470
|
+
align: "start",
|
|
1471
|
+
text: "text"
|
|
1472
|
+
},
|
|
1473
|
+
nameKey: "elements.naiveP.name",
|
|
1474
|
+
descriptionKey: "elements.naiveP.description"
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
type: "naiveA",
|
|
1479
|
+
category: "static",
|
|
1480
|
+
icon: "i-lucide-link-2",
|
|
1481
|
+
tooltipKey: "fieldProps.tooltip.naiveA",
|
|
1482
|
+
bindEvents: W,
|
|
1483
|
+
schema: {
|
|
1484
|
+
renderAs: "cmp",
|
|
1485
|
+
props: {
|
|
1486
|
+
text: "text",
|
|
1487
|
+
href: "https://www.example.com",
|
|
1488
|
+
target: "_blank"
|
|
1489
|
+
},
|
|
1490
|
+
nameKey: "elements.naiveA.name",
|
|
1491
|
+
descriptionKey: "elements.naiveA.description"
|
|
1492
|
+
}
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
type: "naiveBlockquote",
|
|
1496
|
+
category: "static",
|
|
1497
|
+
icon: "i-lucide-letter-text",
|
|
1498
|
+
tooltipKey: "fieldProps.tooltip.naiveBlockquote",
|
|
1499
|
+
bindEvents: W,
|
|
1500
|
+
schema: {
|
|
1501
|
+
renderAs: "cmp",
|
|
1502
|
+
props: { text: "text" },
|
|
1503
|
+
nameKey: "elements.naiveBlockquote.name",
|
|
1504
|
+
descriptionKey: "elements.naiveBlockquote.description"
|
|
1505
|
+
}
|
|
1506
|
+
},
|
|
1507
|
+
K(1, "i-lucide-heading-1", "fieldProps.tooltip.naiveH1"),
|
|
1508
|
+
K(2, "i-lucide-heading-2", "fieldProps.tooltip.naiveH2"),
|
|
1509
|
+
K(3, "i-lucide-heading-3", "fieldProps.tooltip.naiveH3"),
|
|
1510
|
+
K(4, "i-lucide-heading-4", "fieldProps.tooltip.naiveH4"),
|
|
1511
|
+
K(5, "i-lucide-heading-5", "fieldProps.tooltip.naiveH5"),
|
|
1512
|
+
K(6, "i-lucide-heading-6", "fieldProps.tooltip.naiveH6"),
|
|
1513
|
+
{
|
|
1514
|
+
type: "naiveUl",
|
|
1515
|
+
category: "static",
|
|
1516
|
+
icon: "i-lucide-list",
|
|
1517
|
+
tooltipKey: "fieldProps.tooltip.naiveUl",
|
|
1518
|
+
bindEvents: W,
|
|
1519
|
+
schema: {
|
|
1520
|
+
renderAs: "cmp",
|
|
1521
|
+
options: [
|
|
1522
|
+
"Item 1",
|
|
1523
|
+
"Item 2",
|
|
1524
|
+
"Item 3"
|
|
1525
|
+
],
|
|
1526
|
+
nameKey: "elements.naiveUl.name",
|
|
1527
|
+
descriptionKey: "elements.naiveUl.description"
|
|
1528
|
+
}
|
|
1529
|
+
},
|
|
1530
|
+
{
|
|
1531
|
+
type: "naiveOl",
|
|
1532
|
+
category: "static",
|
|
1533
|
+
icon: "i-lucide-list",
|
|
1534
|
+
tooltipKey: "fieldProps.tooltip.naiveOl",
|
|
1535
|
+
bindEvents: W,
|
|
1536
|
+
schema: {
|
|
1537
|
+
renderAs: "cmp",
|
|
1538
|
+
options: [
|
|
1539
|
+
"Item 1",
|
|
1540
|
+
"Item 2",
|
|
1541
|
+
"Item 3"
|
|
1542
|
+
],
|
|
1543
|
+
nameKey: "elements.naiveOl.name",
|
|
1544
|
+
descriptionKey: "elements.naiveOl.description"
|
|
1545
|
+
}
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
type: "naiveLi",
|
|
1549
|
+
category: "static",
|
|
1550
|
+
icon: "i-lucide-list",
|
|
1551
|
+
tooltipKey: "fieldProps.tooltip.naiveLi",
|
|
1552
|
+
bindEvents: W,
|
|
1553
|
+
schema: {
|
|
1554
|
+
renderAs: "cmp",
|
|
1555
|
+
value: "List Item",
|
|
1556
|
+
nameKey: "elements.naiveLi.name",
|
|
1557
|
+
descriptionKey: "elements.naiveLi.description"
|
|
1558
|
+
}
|
|
1559
|
+
},
|
|
1560
|
+
{
|
|
1561
|
+
type: "naiveDivider",
|
|
1562
|
+
category: "static",
|
|
1563
|
+
icon: "i-lucide-sliders-horizontal",
|
|
1564
|
+
tooltipKey: "fieldProps.tooltip.naiveDivider",
|
|
1565
|
+
bindEvents: W,
|
|
1566
|
+
schema: {
|
|
1567
|
+
renderAs: "cmp",
|
|
1568
|
+
props: {
|
|
1569
|
+
title: "Divider",
|
|
1570
|
+
titlePlacement: "center",
|
|
1571
|
+
dashed: !1,
|
|
1572
|
+
vertical: !1
|
|
1573
|
+
},
|
|
1574
|
+
nameKey: "elements.naiveDivider.name",
|
|
1575
|
+
descriptionKey: "elements.naiveDivider.description"
|
|
1576
|
+
}
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
type: "naiveAlert",
|
|
1580
|
+
category: "static",
|
|
1581
|
+
icon: "i-lucide-triangle-alert",
|
|
1582
|
+
tooltipKey: "fieldProps.tooltip.naiveAlert",
|
|
1583
|
+
bindEvents: W,
|
|
1584
|
+
schema: {
|
|
1585
|
+
renderAs: "cmp",
|
|
1586
|
+
props: {
|
|
1587
|
+
title: "Title",
|
|
1588
|
+
content: "Alert",
|
|
1589
|
+
theme: "default",
|
|
1590
|
+
closable: !1,
|
|
1591
|
+
bordered: !1,
|
|
1592
|
+
showIcon: !0
|
|
1593
|
+
},
|
|
1594
|
+
nameKey: "elements.naiveAlert.name",
|
|
1595
|
+
labelKey: "elements.naiveAlert.label",
|
|
1596
|
+
descriptionKey: "elements.naiveAlert.description"
|
|
1597
|
+
}
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
type: "naiveBackTop",
|
|
1601
|
+
category: "static",
|
|
1602
|
+
icon: "i-lucide-arrow-up-to-line",
|
|
1603
|
+
tooltipKey: "fieldProps.tooltip.naiveBackTop",
|
|
1604
|
+
bindEvents: W,
|
|
1605
|
+
schema: {
|
|
1606
|
+
renderAs: "cmp",
|
|
1607
|
+
props: {
|
|
1608
|
+
show: !0,
|
|
1609
|
+
right: 40,
|
|
1610
|
+
bottom: 40,
|
|
1611
|
+
visibilityHeight: 0
|
|
1612
|
+
},
|
|
1613
|
+
nameKey: "elements.naiveBackTop.name",
|
|
1614
|
+
descriptionKey: "elements.naiveBackTop.description"
|
|
1615
|
+
}
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
type: "naiveQrCode",
|
|
1619
|
+
category: "static",
|
|
1620
|
+
icon: "i-lucide-qr-code",
|
|
1621
|
+
tooltipKey: "fieldProps.tooltip.naiveQrCode",
|
|
1622
|
+
bindEvents: W,
|
|
1623
|
+
schema: {
|
|
1624
|
+
renderAs: "cmp",
|
|
1625
|
+
value: "https://github.com/zeng-alt/formkit-form-builder",
|
|
1626
|
+
props: {
|
|
1627
|
+
size: 128,
|
|
1628
|
+
color: "#000000",
|
|
1629
|
+
backgroundColor: "#ffffff",
|
|
1630
|
+
padding: 10,
|
|
1631
|
+
errorCorrectionLevel: "M"
|
|
1632
|
+
},
|
|
1633
|
+
nameKey: "elements.naiveQrCode.name",
|
|
1634
|
+
descriptionKey: "elements.naiveQrCode.description"
|
|
1635
|
+
}
|
|
1636
|
+
},
|
|
1637
|
+
{
|
|
1638
|
+
type: "naiveProgress",
|
|
1639
|
+
category: "static",
|
|
1640
|
+
icon: "i-lucide-gauge",
|
|
1641
|
+
tooltipKey: "fieldProps.tooltip.naiveProgress",
|
|
1642
|
+
bindEvents: W,
|
|
1643
|
+
schema: {
|
|
1644
|
+
renderAs: "cmp",
|
|
1645
|
+
props: {
|
|
1646
|
+
percentage: 60,
|
|
1647
|
+
progressType: "line",
|
|
1648
|
+
status: "default",
|
|
1649
|
+
processing: !1,
|
|
1650
|
+
showIndicator: !0,
|
|
1651
|
+
height: 8,
|
|
1652
|
+
strokeWidth: 6
|
|
1653
|
+
},
|
|
1654
|
+
nameKey: "elements.naiveProgress.name",
|
|
1655
|
+
descriptionKey: "elements.naiveProgress.description"
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
], ke = () => ({
|
|
1659
|
+
id: f(),
|
|
1660
|
+
key: f(),
|
|
1661
|
+
category: "container",
|
|
1662
|
+
type: "group",
|
|
1663
|
+
renderAs: "formkit",
|
|
1664
|
+
dataType: "object",
|
|
1665
|
+
children: []
|
|
1666
|
+
}), Ae = [
|
|
1667
|
+
{
|
|
1668
|
+
type: "group",
|
|
1669
|
+
category: "container",
|
|
1670
|
+
icon: "i-lucide-group",
|
|
1671
|
+
tooltipKey: "fieldProps.tooltip.group",
|
|
1672
|
+
bindEvents: W,
|
|
1673
|
+
container: u("group") ?? void 0,
|
|
1674
|
+
schema: {
|
|
1675
|
+
renderAs: "formkit",
|
|
1676
|
+
nameKey: "elements.group.name",
|
|
1677
|
+
props: {},
|
|
1678
|
+
descriptionKey: "elements.group.description"
|
|
1679
|
+
}
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
type: "list",
|
|
1683
|
+
category: "container",
|
|
1684
|
+
icon: "i-lucide-list-tree",
|
|
1685
|
+
tooltipKey: "fieldProps.tooltip.list",
|
|
1686
|
+
bindEvents: W,
|
|
1687
|
+
container: u("list") ?? void 0,
|
|
1688
|
+
schema: {
|
|
1689
|
+
renderAs: "cmp",
|
|
1690
|
+
nameKey: "elements.list.name",
|
|
1691
|
+
labelKey: "elements.list.label",
|
|
1692
|
+
props: {
|
|
1693
|
+
showActions: !1,
|
|
1694
|
+
bordered: !0
|
|
1695
|
+
},
|
|
1696
|
+
descriptionKey: "elements.list.description"
|
|
1697
|
+
}
|
|
1698
|
+
},
|
|
1699
|
+
{
|
|
1700
|
+
type: "nestedList",
|
|
1701
|
+
category: "container",
|
|
1702
|
+
icon: "i-lucide-list-plus",
|
|
1703
|
+
tooltipKey: "fieldProps.tooltip.nestedList",
|
|
1704
|
+
schema: {
|
|
1705
|
+
renderAs: "cmp",
|
|
1706
|
+
presetOf: "list",
|
|
1707
|
+
nameKey: "elements.nestedList.name",
|
|
1708
|
+
labelKey: "elements.nestedList.label",
|
|
1709
|
+
props: {
|
|
1710
|
+
showActions: !1,
|
|
1711
|
+
bordered: !0
|
|
1712
|
+
},
|
|
1713
|
+
descriptionKey: "elements.nestedList.description",
|
|
1714
|
+
defaultChildren: () => [ke()]
|
|
1715
|
+
}
|
|
1716
|
+
},
|
|
1717
|
+
{
|
|
1718
|
+
type: "inputGroup",
|
|
1719
|
+
category: "container",
|
|
1720
|
+
icon: "i-lucide-align-horizontal-justify-start",
|
|
1721
|
+
tooltipKey: "fieldProps.tooltip.inputGroup",
|
|
1722
|
+
bindEvents: W,
|
|
1723
|
+
container: u("inputGroup") ?? void 0,
|
|
1724
|
+
schema: {
|
|
1725
|
+
renderAs: "cmp",
|
|
1726
|
+
nameKey: "elements.inputGroup.name",
|
|
1727
|
+
labelKey: "elements.inputGroup.label",
|
|
1728
|
+
props: {},
|
|
1729
|
+
descriptionKey: "elements.inputGroup.description"
|
|
1730
|
+
}
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
type: "buttonGroup",
|
|
1734
|
+
category: "container",
|
|
1735
|
+
icon: "i-lucide-rectangle-horizontal",
|
|
1736
|
+
tooltipKey: "fieldProps.tooltip.buttonGroup",
|
|
1737
|
+
bindEvents: W,
|
|
1738
|
+
container: u("buttonGroup") ?? void 0,
|
|
1739
|
+
schema: {
|
|
1740
|
+
renderAs: "cmp",
|
|
1741
|
+
nameKey: "elements.buttonGroup.name",
|
|
1742
|
+
props: {
|
|
1743
|
+
size: "medium",
|
|
1744
|
+
vertical: !1
|
|
1745
|
+
},
|
|
1746
|
+
descriptionKey: "elements.buttonGroup.description"
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
type: "card",
|
|
1751
|
+
category: "layout",
|
|
1752
|
+
icon: "i-lucide-credit-card",
|
|
1753
|
+
tooltipKey: "fieldProps.tooltip.card",
|
|
1754
|
+
bindEvents: W,
|
|
1755
|
+
container: u("card") ?? void 0,
|
|
1756
|
+
schema: {
|
|
1757
|
+
renderAs: "cmp",
|
|
1758
|
+
nameKey: "elements.card.name",
|
|
1759
|
+
labelKey: "elements.card.label",
|
|
1760
|
+
props: {
|
|
1761
|
+
size: "medium",
|
|
1762
|
+
bordered: !0,
|
|
1763
|
+
embedded: !1,
|
|
1764
|
+
hoverable: !1
|
|
1765
|
+
},
|
|
1766
|
+
descriptionKey: "elements.card.description"
|
|
1767
|
+
}
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
type: "badge",
|
|
1771
|
+
category: "container",
|
|
1772
|
+
icon: "i-lucide-badge",
|
|
1773
|
+
tooltipKey: "fieldProps.tooltip.badge",
|
|
1774
|
+
bindEvents: W,
|
|
1775
|
+
container: u("badge") ?? void 0,
|
|
1776
|
+
schema: {
|
|
1777
|
+
renderAs: "cmp",
|
|
1778
|
+
nameKey: "elements.badge.name",
|
|
1779
|
+
props: {
|
|
1780
|
+
value: 0,
|
|
1781
|
+
max: 99,
|
|
1782
|
+
dot: !1,
|
|
1783
|
+
show: !0,
|
|
1784
|
+
showZero: !1,
|
|
1785
|
+
processing: !1,
|
|
1786
|
+
type: "error"
|
|
1787
|
+
},
|
|
1788
|
+
descriptionKey: "elements.badge.description"
|
|
1789
|
+
}
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
type: "tabs",
|
|
1793
|
+
category: "layout",
|
|
1794
|
+
icon: "i-lucide-panel-top",
|
|
1795
|
+
tooltipKey: "fieldProps.tooltip.tabs",
|
|
1796
|
+
bindEvents: W,
|
|
1797
|
+
container: u("tabs") ?? void 0,
|
|
1798
|
+
schema: {
|
|
1799
|
+
renderAs: "cmp",
|
|
1800
|
+
nameKey: "elements.tabs.name",
|
|
1801
|
+
labelKey: "elements.tabs.label",
|
|
1802
|
+
props: {},
|
|
1803
|
+
descriptionKey: "elements.tabs.description"
|
|
1804
|
+
}
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
type: "steps",
|
|
1808
|
+
category: "layout",
|
|
1809
|
+
icon: "i-lucide-list-ordered",
|
|
1810
|
+
tooltipKey: "fieldProps.tooltip.steps",
|
|
1811
|
+
bindEvents: W,
|
|
1812
|
+
container: u("steps") ?? void 0,
|
|
1813
|
+
schema: {
|
|
1814
|
+
renderAs: "cmp",
|
|
1815
|
+
nameKey: "elements.steps.name",
|
|
1816
|
+
labelKey: "elements.steps.label",
|
|
1817
|
+
props: {},
|
|
1818
|
+
descriptionKey: "elements.steps.description"
|
|
1819
|
+
}
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
type: "dataTable",
|
|
1823
|
+
category: "container",
|
|
1824
|
+
icon: "i-lucide-table-2",
|
|
1825
|
+
tooltipKey: "fieldProps.tooltip.dataTable",
|
|
1826
|
+
bindEvents: W,
|
|
1827
|
+
container: u("dataTable") ?? void 0,
|
|
1828
|
+
schema: {
|
|
1829
|
+
renderAs: "cmp",
|
|
1830
|
+
nameKey: "elements.dataTable.name",
|
|
1831
|
+
labelKey: "elements.dataTable.label",
|
|
1832
|
+
props: {
|
|
1833
|
+
rowKey: "id",
|
|
1834
|
+
bordered: !0,
|
|
1835
|
+
size: "medium",
|
|
1836
|
+
pagination: !1,
|
|
1837
|
+
remote: !1,
|
|
1838
|
+
pageSize: 10
|
|
1839
|
+
},
|
|
1840
|
+
descriptionKey: "elements.dataTable.description"
|
|
1841
|
+
}
|
|
1842
|
+
},
|
|
1843
|
+
{
|
|
1844
|
+
type: "collapse",
|
|
1845
|
+
category: "container",
|
|
1846
|
+
icon: "i-lucide-list-collapse",
|
|
1847
|
+
tooltipKey: "fieldProps.tooltip.collapse",
|
|
1848
|
+
bindEvents: W,
|
|
1849
|
+
container: u("collapse") ?? void 0,
|
|
1850
|
+
schema: {
|
|
1851
|
+
renderAs: "cmp",
|
|
1852
|
+
nameKey: "elements.collapse.name",
|
|
1853
|
+
labelKey: "elements.collapse.label",
|
|
1854
|
+
props: {
|
|
1855
|
+
defaultExpanded: !0,
|
|
1856
|
+
disableCollapse: !1,
|
|
1857
|
+
bordered: !0
|
|
1858
|
+
},
|
|
1859
|
+
descriptionKey: "elements.collapse.description"
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
], je = !1;
|
|
1863
|
+
function q() {
|
|
1864
|
+
if (!je) {
|
|
1865
|
+
je = !0;
|
|
1866
|
+
for (let e of [
|
|
1867
|
+
...De,
|
|
1868
|
+
...Oe,
|
|
1869
|
+
...Ae
|
|
1870
|
+
]) P(R(e));
|
|
1871
|
+
P(z("grid", { target: "div" })), P(z("row", { target: "div" })), P(z("column", { target: "div" })), P(we()), P(Te()), P(B("button", { match: (e) => e.$el === "button" })), P(B("paragraph", { match: (e) => e.$el === "p" })), P(B("heading", { match: (e) => /^h[1-6]$/.test(String(e.$el)) })), P(B("divider", { match: (e) => e.$el === "hr" }));
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
//#endregion
|
|
1875
|
+
//#region src/utils/freeze.ts
|
|
1876
|
+
function Me(e) {
|
|
1877
|
+
return e;
|
|
1878
|
+
}
|
|
1879
|
+
//#endregion
|
|
1880
|
+
//#region src/dsl/schema-adapter.ts
|
|
1881
|
+
q();
|
|
1882
|
+
function J(e, t) {
|
|
1883
|
+
let n = i(e);
|
|
1884
|
+
if (t) {
|
|
1885
|
+
let e = t.get(n);
|
|
1886
|
+
if (e) return e;
|
|
1887
|
+
}
|
|
1888
|
+
let r = F(n.type), a;
|
|
1889
|
+
if (r) {
|
|
1890
|
+
let e = (n.category === "container" || n.category === "layout") && Array.isArray(n.children) ? n.children.map((e) => J(e, t)) : void 0;
|
|
1891
|
+
a = r.toSchema(n, { children: e });
|
|
1892
|
+
} else {
|
|
1893
|
+
let e = n.meta?.rawSchema;
|
|
1894
|
+
if (e && typeof e == "object") a = e;
|
|
1895
|
+
else throw Error(`[dslToSchema] 未注册的 DSL 类型: ${n.category}/${n.type}`);
|
|
1896
|
+
}
|
|
1897
|
+
return t && t.set(n, a), a;
|
|
1898
|
+
}
|
|
1899
|
+
function Y(e, t) {
|
|
1900
|
+
let n = i(e), r = n.root.children.map((e) => J(e, t)), a = n.settings;
|
|
1901
|
+
return [{
|
|
1902
|
+
$formkit: "form",
|
|
1903
|
+
name: n.name,
|
|
1904
|
+
props: {
|
|
1905
|
+
labelPosition: a.labelAlign === "left" ? "left" : "top",
|
|
1906
|
+
labelWidth: a.labelWidth ?? 80,
|
|
1907
|
+
submit: a.submit,
|
|
1908
|
+
size: a.size,
|
|
1909
|
+
disabled: a.disabled,
|
|
1910
|
+
readonly: a.readonly,
|
|
1911
|
+
successMessage: a.successMessage,
|
|
1912
|
+
successRedirect: a.successRedirect,
|
|
1913
|
+
showReset: a.showReset,
|
|
1914
|
+
submitText: a.submitText,
|
|
1915
|
+
resetText: a.resetText,
|
|
1916
|
+
id: n.id,
|
|
1917
|
+
version: n.version
|
|
1918
|
+
},
|
|
1919
|
+
children: r
|
|
1920
|
+
}];
|
|
1921
|
+
}
|
|
1922
|
+
function Ne(e, t) {
|
|
1923
|
+
let n = e;
|
|
1924
|
+
return !n || typeof n != "object" || !Array.isArray(n.children) ? e : {
|
|
1925
|
+
...n,
|
|
1926
|
+
children: n.children.map((e) => Pe(e, t))
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
function Pe(e, t) {
|
|
1930
|
+
if (!e || typeof e != "object") return e;
|
|
1931
|
+
if (t) {
|
|
1932
|
+
let n = t.get(e);
|
|
1933
|
+
if (n) return n;
|
|
1934
|
+
}
|
|
1935
|
+
let n = Array.isArray(e.children) ? {
|
|
1936
|
+
...e,
|
|
1937
|
+
children: e.children.map((e) => Pe(e, t))
|
|
1938
|
+
} : e, r;
|
|
1939
|
+
if (n.$formkit === "group" || n.$formkit === "form" || n.$formkit === "list") r = n;
|
|
1940
|
+
else if (n.$formkit === "submit" || n.$formkit === "reset") r = n;
|
|
1941
|
+
else {
|
|
1942
|
+
let e = Array.isArray(n.children) && n.children.length > 0, t = typeof n.$cmp == "string" && n.$cmp !== "" ? n.$cmp : void 0, i = t ? F(t) : void 0;
|
|
1943
|
+
if (!(typeof n.$cmp == "string" && n.$cmp !== "" && (!i || i.category === "container" || i.category === "layout") || typeof n.$el == "string" && e)) r = n;
|
|
1944
|
+
else {
|
|
1945
|
+
let e = n.props?.name ?? n.name, t = { ...n };
|
|
1946
|
+
t.props && t.props.name && (t.props = { ...t.props }, delete t.props.name), delete t.name;
|
|
1947
|
+
let i = t.outerClass;
|
|
1948
|
+
delete t.outerClass;
|
|
1949
|
+
let a = {
|
|
1950
|
+
$formkit: "group",
|
|
1951
|
+
children: [t],
|
|
1952
|
+
outerClass: [
|
|
1953
|
+
i || "col-span-12",
|
|
1954
|
+
"!border-0",
|
|
1955
|
+
"!p-0",
|
|
1956
|
+
"!m-0",
|
|
1957
|
+
"[&>.formkit-wrapper]:!border-0",
|
|
1958
|
+
"[&>.formkit-wrapper]:!p-0",
|
|
1959
|
+
"[&>.formkit-wrapper]:!m-0",
|
|
1960
|
+
"[&>.formkit-wrapper>fieldset]:!border-0",
|
|
1961
|
+
"[&>.formkit-wrapper>fieldset]:!p-0",
|
|
1962
|
+
"[&>.formkit-wrapper>fieldset]:!m-0"
|
|
1963
|
+
].join(" ")
|
|
1964
|
+
};
|
|
1965
|
+
typeof e == "string" && e.trim() && (a.name = e), r = a;
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
return t && t.set(e, r), r;
|
|
1969
|
+
}
|
|
1970
|
+
function Fe(e) {
|
|
1971
|
+
return Y(e, null);
|
|
1972
|
+
}
|
|
1973
|
+
function Ie(e) {
|
|
1974
|
+
return Y(e, null).map((e) => Ne(e, null));
|
|
1975
|
+
}
|
|
1976
|
+
function Le() {
|
|
1977
|
+
let e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
1978
|
+
return {
|
|
1979
|
+
toSchema: (t) => Y(t, e),
|
|
1980
|
+
toOutputSchema: (n) => Y(n, e).map((e) => Ne(e, t))
|
|
1981
|
+
};
|
|
1982
|
+
}
|
|
1983
|
+
function Re(e, t) {
|
|
1984
|
+
q();
|
|
1985
|
+
let n = e, r = t?.name ?? "form", i = t?.id ?? f(), a = 1, o = {};
|
|
1986
|
+
if (e.length === 1) {
|
|
1987
|
+
let t = e[0];
|
|
1988
|
+
t?.$formkit === "form" && Array.isArray(t.children) && (typeof t.name == "string" && t.name.trim() && (r = t.name), typeof t.props?.id == "string" && t.props.id.trim() && (i = t.props.id), Number.isFinite(Number(t.props?.version)) && (a = Number(t.props.version)), Object.assign(o, Be(t.props)), n = t.children);
|
|
1989
|
+
}
|
|
1990
|
+
let s = (e) => {
|
|
1991
|
+
for (let t of I()) if (t.match?.(e)) {
|
|
1992
|
+
if (t.fromSchema) {
|
|
1993
|
+
let n = t.fromSchema(e, { children: (e) => Array.isArray(e) ? e.map(s) : [] });
|
|
1994
|
+
if (n) return n;
|
|
1995
|
+
}
|
|
1996
|
+
break;
|
|
1997
|
+
}
|
|
1998
|
+
return $(e);
|
|
1999
|
+
};
|
|
2000
|
+
return {
|
|
2001
|
+
version: a,
|
|
2002
|
+
id: i,
|
|
2003
|
+
name: r,
|
|
2004
|
+
root: {
|
|
2005
|
+
id: "root",
|
|
2006
|
+
category: "container",
|
|
2007
|
+
type: "group",
|
|
2008
|
+
renderAs: "formkit",
|
|
2009
|
+
dataType: "object",
|
|
2010
|
+
children: n.map(s)
|
|
2011
|
+
},
|
|
2012
|
+
settings: o
|
|
2013
|
+
};
|
|
2014
|
+
}
|
|
2015
|
+
function X(e) {
|
|
2016
|
+
q();
|
|
2017
|
+
let t = (e) => {
|
|
2018
|
+
for (let n of I()) if (n.match?.(e)) {
|
|
2019
|
+
if (n.fromSchema) {
|
|
2020
|
+
let r = n.fromSchema(e, { children: (e) => Array.isArray(e) ? e.map(t) : [] });
|
|
2021
|
+
if (r) return r;
|
|
2022
|
+
}
|
|
2023
|
+
break;
|
|
2024
|
+
}
|
|
2025
|
+
return $(e);
|
|
2026
|
+
};
|
|
2027
|
+
return t(e);
|
|
2028
|
+
}
|
|
2029
|
+
function Z(e) {
|
|
2030
|
+
let t = e;
|
|
2031
|
+
if (typeof t?.__key == "string" && t.__key) return t.__key;
|
|
2032
|
+
if (typeof t?.id == "string" && t.id) return t.id;
|
|
2033
|
+
}
|
|
2034
|
+
function Q(e) {
|
|
2035
|
+
let t = e, n = Array.isArray(t?.children) ? t.children : t?.props?.modelValue;
|
|
2036
|
+
return Array.isArray(n) ? n : [];
|
|
2037
|
+
}
|
|
2038
|
+
function ze(e, t, n) {
|
|
2039
|
+
let r = /* @__PURE__ */ new Map(), a = (e) => {
|
|
2040
|
+
for (let t of e) {
|
|
2041
|
+
t.key && r.set(t.key, t), t.id && r.set(t.id, t);
|
|
2042
|
+
let e = t.children;
|
|
2043
|
+
Array.isArray(e) && a(e);
|
|
2044
|
+
}
|
|
2045
|
+
};
|
|
2046
|
+
a(e);
|
|
2047
|
+
let o = /* @__PURE__ */ new Map(), s = (e) => {
|
|
2048
|
+
for (let t of e) {
|
|
2049
|
+
let e = Z(t);
|
|
2050
|
+
e && o.set(e, t);
|
|
2051
|
+
let n = Q(t);
|
|
2052
|
+
n.length && s(n);
|
|
2053
|
+
}
|
|
2054
|
+
};
|
|
2055
|
+
s(t);
|
|
2056
|
+
let c = (e, t) => t.map((e) => {
|
|
2057
|
+
let t = Z(e), n = r.get(t);
|
|
2058
|
+
if (!t) return X(e);
|
|
2059
|
+
n = r.get(t);
|
|
2060
|
+
let a = o.get(t);
|
|
2061
|
+
if (n && a && i(a) === i(e) || n && a && JSON.stringify(a) === JSON.stringify(e)) return n;
|
|
2062
|
+
let s = X(e);
|
|
2063
|
+
if (!n) return s;
|
|
2064
|
+
let l = { ...s };
|
|
2065
|
+
if (l.id = n.id, l.key = n.key, n.category === "container" || n.category === "layout") {
|
|
2066
|
+
let t = n.children, r = Q(e), o = a ? Q(a) : [];
|
|
2067
|
+
a != null && o.length === r.length && o.every((e, t) => i(e) === i(r[t])) || a && JSON.stringify(o) === JSON.stringify(r) ? l.children = t : l.children = c(t, r);
|
|
2068
|
+
}
|
|
2069
|
+
return l;
|
|
2070
|
+
});
|
|
2071
|
+
return c(e, n);
|
|
2072
|
+
}
|
|
2073
|
+
function Be(e) {
|
|
2074
|
+
let t = e ?? {}, n = {};
|
|
2075
|
+
return (t.labelPosition === "left" || t.labelPosition === "top") && (n.labelAlign = t.labelPosition), Number.isFinite(Number(t.labelWidth)) && (n.labelWidth = Number(t.labelWidth)), typeof t.submit == "string" && t.submit && (n.submit = t.submit), (t.size === "small" || t.size === "medium" || t.size === "large") && (n.size = t.size), typeof t.disabled == "boolean" && (n.disabled = t.disabled), typeof t.readonly == "boolean" && (n.readonly = t.readonly), typeof t.successMessage == "string" && t.successMessage && (n.successMessage = t.successMessage), typeof t.successRedirect == "string" && t.successRedirect && (n.successRedirect = t.successRedirect), typeof t.showReset == "boolean" && (n.showReset = t.showReset), typeof t.submitText == "string" && t.submitText && (n.submitText = t.submitText), typeof t.resetText == "string" && t.resetText && (n.resetText = t.resetText), n;
|
|
2076
|
+
}
|
|
2077
|
+
function $(e) {
|
|
2078
|
+
let t = e, n = t.$formkit ? "field" : t.$cmp ? "container" : "layout", r = {
|
|
2079
|
+
id: typeof t.id == "string" && t.id ? t.id : f(),
|
|
2080
|
+
category: n,
|
|
2081
|
+
type: t.$formkit ?? t.$cmp ?? t.$el ?? "unknown",
|
|
2082
|
+
meta: { rawSchema: e }
|
|
2083
|
+
};
|
|
2084
|
+
return typeof t.label == "string" && t.label && (r.label = t.label), (n === "container" || n === "layout") && (r.children = Array.isArray(t.children) ? t.children.map($) : []), r;
|
|
2085
|
+
}
|
|
2086
|
+
//#endregion
|
|
2087
|
+
export { c as C, o as E, u as S, a as T, _, X as a, h as b, q as c, I as d, P as f, m as g, b as h, ze as i, R as l, ve as m, Ie as n, Re as o, ye as p, Fe as r, Me as s, Le as t, F as u, p as v, s as w, d as x, f as y };
|
|
2088
|
+
|
|
2089
|
+
//# sourceMappingURL=schema-adapter-_sLPmdLy.js.map
|