@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,1579 @@
|
|
|
1
|
+
import { c as e, d as t, u as n } from "./schema-adapter-_sLPmdLy.js";
|
|
2
|
+
import { n as r } from "./context-4zkSHwVA.js";
|
|
3
|
+
import { t as i } from "./_plugin-vue_export-helper-BxNYtmDu.js";
|
|
4
|
+
import { a, o, r as s, t as c } from "./DataTableRowCellInput-BLTM3I21.js";
|
|
5
|
+
import { Fragment as l, computed as u, createBlock as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineAsyncComponent as g, defineComponent as _, nextTick as v, normalizeClass as ee, normalizeStyle as te, onMounted as y, onUnmounted as ne, openBlock as b, ref as x, renderList as S, renderSlot as re, toDisplayString as C, toRaw as ie, unref as w, watch as ae, withCtx as T, withKeys as oe, withModifiers as se } from "vue";
|
|
6
|
+
import { NButton as E, NCollapse as ce, NCollapseItem as le, NEmpty as ue, NInput as de, NModal as fe, NScrollbar as pe } from "naive-ui";
|
|
7
|
+
import { FormKit as me } from "@formkit/vue";
|
|
8
|
+
//#region src/elements/registry.ts
|
|
9
|
+
e();
|
|
10
|
+
function D(e) {
|
|
11
|
+
if (!e) return null;
|
|
12
|
+
let t = n(e);
|
|
13
|
+
return !t || !t.template ? null : {
|
|
14
|
+
type: t.type,
|
|
15
|
+
category: t.category,
|
|
16
|
+
icon: t.icon ?? "",
|
|
17
|
+
tooltipKey: t.tooltipKey ?? "",
|
|
18
|
+
schema: t.template,
|
|
19
|
+
editor: t.editor
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function O() {
|
|
23
|
+
return t().filter((e) => e.template).map((e) => ({
|
|
24
|
+
type: e.type,
|
|
25
|
+
category: e.category,
|
|
26
|
+
icon: e.icon ?? "",
|
|
27
|
+
tooltipKey: e.tooltipKey ?? "",
|
|
28
|
+
schema: e.template,
|
|
29
|
+
editor: e.editor
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
var k = /* @__PURE__ */ new Map();
|
|
33
|
+
function he(e) {
|
|
34
|
+
let t = n(e ?? void 0);
|
|
35
|
+
if (!t?.editor) return null;
|
|
36
|
+
let r = k.get(e);
|
|
37
|
+
if (r) return r;
|
|
38
|
+
let i = g(t.editor);
|
|
39
|
+
return k.set(e, i), i;
|
|
40
|
+
}
|
|
41
|
+
function ge(e) {
|
|
42
|
+
return t().filter((e) => e.template && e.icon).map((t) => ({
|
|
43
|
+
name: t.type,
|
|
44
|
+
tooltip: e(t.tooltipKey ?? ""),
|
|
45
|
+
icon: t.icon,
|
|
46
|
+
category: t.category
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
function _e(e, t) {
|
|
50
|
+
let n = e.defaults(), r = e.template;
|
|
51
|
+
r.nameKey && (n.name = t(r.nameKey)), r.labelKey && (n.label = t(r.labelKey));
|
|
52
|
+
let i = { ...n.props };
|
|
53
|
+
return r.placeholderKey && (i.placeholder = t(r.placeholderKey)), r.helpKey && (i.help = t(r.helpKey)), r.labelKey && e.category === "static" && (e.type === "submit" || e.type === "reset" || e.type === "naiveButton") && (i.text = t(r.labelKey)), n.props = Object.keys(i).length ? i : void 0, n;
|
|
54
|
+
}
|
|
55
|
+
function ve(e) {
|
|
56
|
+
let r = (e) => {
|
|
57
|
+
let t = n(e.type), i = (e.category === "container" || e.category === "layout") && Array.isArray(e.children) ? e.children.map(r) : void 0;
|
|
58
|
+
return t.toSchema(e, { children: i });
|
|
59
|
+
}, i = [];
|
|
60
|
+
for (let n of t()) {
|
|
61
|
+
if (!n.template) continue;
|
|
62
|
+
let t = r(_e(n, e));
|
|
63
|
+
Object.defineProperty(t, "description", {
|
|
64
|
+
value: e(n.template.descriptionKey),
|
|
65
|
+
enumerable: !1,
|
|
66
|
+
configurable: !0
|
|
67
|
+
}), n.icon && Object.defineProperty(t, "__paletteIcon", {
|
|
68
|
+
value: n.icon,
|
|
69
|
+
enumerable: !1,
|
|
70
|
+
configurable: !0
|
|
71
|
+
}), i.push(t);
|
|
72
|
+
}
|
|
73
|
+
return i;
|
|
74
|
+
}
|
|
75
|
+
function ye(e) {
|
|
76
|
+
let n = e;
|
|
77
|
+
if (!(!n || typeof n != "object")) {
|
|
78
|
+
for (let e of t()) if (e.match?.(n)) return e.type;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region node_modules/.pnpm/@formkit+drag-and-drop@0.5.3/node_modules/@formkit/drag-and-drop/index.mjs
|
|
83
|
+
function A(e) {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
}
|
|
86
|
+
function j(e) {
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
}
|
|
89
|
+
function be() {
|
|
90
|
+
let e = /* @__PURE__ */ new Map();
|
|
91
|
+
return [function(t, n) {
|
|
92
|
+
e.get(t) && e.get(t).forEach((e) => {
|
|
93
|
+
e(n);
|
|
94
|
+
});
|
|
95
|
+
}, function(t, n) {
|
|
96
|
+
let r = e.get(t) ?? [];
|
|
97
|
+
r.push(n), e.set(t, r);
|
|
98
|
+
}];
|
|
99
|
+
}
|
|
100
|
+
var [xe, Se] = be();
|
|
101
|
+
function Ce(e, t) {
|
|
102
|
+
return e.source === t.source && e.flags.split("").sort().join("") === t.flags.split("").sort().join("");
|
|
103
|
+
}
|
|
104
|
+
function M(e, t, n = !0, r = ["__key"]) {
|
|
105
|
+
if (e === t) return !0;
|
|
106
|
+
if (typeof t == "object" && typeof e == "object" && e && t !== null) {
|
|
107
|
+
if (e instanceof Map || e instanceof Set) return !1;
|
|
108
|
+
if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
|
|
109
|
+
if (e instanceof RegExp && t instanceof RegExp) return Ce(e, t);
|
|
110
|
+
if (e === null || t === null) return !1;
|
|
111
|
+
let i = e, a = t;
|
|
112
|
+
if (Object.keys(i).length !== Object.keys(a).length) return !1;
|
|
113
|
+
for (let e of r) if ((e in i || e in a) && i[e] !== a[e]) return !1;
|
|
114
|
+
for (let e in i) if (!(e in a) || i[e] !== a[e] && !n || n && !M(i[e], a[e], n, r)) return !1;
|
|
115
|
+
return !0;
|
|
116
|
+
}
|
|
117
|
+
return !1;
|
|
118
|
+
}
|
|
119
|
+
function we(e) {
|
|
120
|
+
return e.split(" ").filter((e) => e);
|
|
121
|
+
}
|
|
122
|
+
function N(e) {
|
|
123
|
+
return {
|
|
124
|
+
x: e.clientX,
|
|
125
|
+
y: e.clientY
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
var Te = typeof window < "u", P = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap();
|
|
129
|
+
function Ee() {
|
|
130
|
+
if (!Te) return !1;
|
|
131
|
+
if ("userAgentData" in navigator) return navigator.userAgentData.mobile === !0;
|
|
132
|
+
let e = navigator.userAgent, t = /android|iphone|ipod/i.test(e), n = /iPad/.test(e) || e.includes("Macintosh") && navigator.maxTouchPoints > 1;
|
|
133
|
+
return t || n;
|
|
134
|
+
}
|
|
135
|
+
var I = {
|
|
136
|
+
affectedNodes: [],
|
|
137
|
+
coordinates: {
|
|
138
|
+
x: 0,
|
|
139
|
+
y: 0
|
|
140
|
+
},
|
|
141
|
+
currentTargetValue: void 0,
|
|
142
|
+
on: Se,
|
|
143
|
+
emit: xe,
|
|
144
|
+
originalZIndex: void 0,
|
|
145
|
+
pointerSelection: !1,
|
|
146
|
+
preventEnter: !1,
|
|
147
|
+
rootUserSelect: void 0,
|
|
148
|
+
nodePointerdown: void 0,
|
|
149
|
+
longPress: !1,
|
|
150
|
+
scrolling: !1,
|
|
151
|
+
longPressTimeout: void 0,
|
|
152
|
+
remapJustFinished: !1,
|
|
153
|
+
selectedNodes: [],
|
|
154
|
+
selectedParent: void 0,
|
|
155
|
+
preventSynthDrag: !1,
|
|
156
|
+
pointerDown: void 0,
|
|
157
|
+
lastScrollContainerX: null,
|
|
158
|
+
lastScrollContainerY: null,
|
|
159
|
+
rootScrollWidth: void 0,
|
|
160
|
+
rootScrollHeight: void 0,
|
|
161
|
+
dragItemRect: void 0,
|
|
162
|
+
windowScrollX: void 0,
|
|
163
|
+
windowScrollY: void 0,
|
|
164
|
+
lastScrollDirectionX: void 0,
|
|
165
|
+
lastScrollDirectionY: void 0,
|
|
166
|
+
scrollDebounceTimeout: void 0,
|
|
167
|
+
frameIdX: void 0,
|
|
168
|
+
frameIdY: void 0
|
|
169
|
+
}, L = !1, De, Oe;
|
|
170
|
+
function ke() {
|
|
171
|
+
I.scrollDebounceTimeout && clearTimeout(I.scrollDebounceTimeout), I.longPressTimeout && clearTimeout(I.longPressTimeout), I.frameIdX !== void 0 && cancelAnimationFrame(I.frameIdX), I.frameIdY !== void 0 && cancelAnimationFrame(I.frameIdY), I = {
|
|
172
|
+
affectedNodes: [],
|
|
173
|
+
coordinates: {
|
|
174
|
+
x: 0,
|
|
175
|
+
y: 0
|
|
176
|
+
},
|
|
177
|
+
on: Se,
|
|
178
|
+
emit: xe,
|
|
179
|
+
currentTargetValue: void 0,
|
|
180
|
+
originalZIndex: void 0,
|
|
181
|
+
pointerId: void 0,
|
|
182
|
+
preventEnter: !1,
|
|
183
|
+
remapJustFinished: !1,
|
|
184
|
+
selectedNodes: [],
|
|
185
|
+
nodePointerdown: void 0,
|
|
186
|
+
rootUserSelect: void 0,
|
|
187
|
+
preventSynthDrag: !1,
|
|
188
|
+
scrolling: !1,
|
|
189
|
+
selectedParent: void 0,
|
|
190
|
+
pointerSelection: !1,
|
|
191
|
+
synthScrollDirection: void 0,
|
|
192
|
+
draggedNodeDisplay: void 0,
|
|
193
|
+
synthDragScrolling: !1,
|
|
194
|
+
longPress: !1,
|
|
195
|
+
pointerDown: void 0,
|
|
196
|
+
longPressTimeout: void 0,
|
|
197
|
+
lastScrollContainerX: null,
|
|
198
|
+
lastScrollContainerY: null,
|
|
199
|
+
rootScrollWidth: void 0,
|
|
200
|
+
rootScrollHeight: void 0,
|
|
201
|
+
dragItemRect: void 0,
|
|
202
|
+
windowScrollX: void 0,
|
|
203
|
+
windowScrollY: void 0,
|
|
204
|
+
lastScrollDirectionX: void 0,
|
|
205
|
+
lastScrollDirectionY: void 0,
|
|
206
|
+
scrollDebounceTimeout: void 0,
|
|
207
|
+
frameIdX: void 0,
|
|
208
|
+
frameIdY: void 0
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function Ae(e) {
|
|
212
|
+
return Object.assign(I, e), e.initialParent.data.emit("dragStarted", I), L = !1, I.emit("dragStarted", I), I;
|
|
213
|
+
}
|
|
214
|
+
function je() {
|
|
215
|
+
I.activeState && R(I.activeState.parent, void 0, I), I.selectedState && z(I.selectedState.nodes, I.selectedState.parent, I), I.selectedState = I.activeState = void 0;
|
|
216
|
+
}
|
|
217
|
+
function Me() {
|
|
218
|
+
if (I.pointerDown && (I.pointerDown.node.el.draggable = !0), I.pointerDown = void 0, !W(I)) return;
|
|
219
|
+
let e = I.currentParent.data.config;
|
|
220
|
+
W(I) && e.handleEnd(I);
|
|
221
|
+
}
|
|
222
|
+
function Ne(e) {
|
|
223
|
+
e.key === "Escape" && (I.selectedState && z(I.selectedState.nodes, I.selectedState.parent, I), I.activeState && R(I.activeState.parent, void 0, I), I.selectedState = I.activeState = void 0);
|
|
224
|
+
}
|
|
225
|
+
function Pe(e) {
|
|
226
|
+
if (!U(I)) return;
|
|
227
|
+
L = !0;
|
|
228
|
+
let t = I.initialParent.data.config.handleEnd;
|
|
229
|
+
t(I);
|
|
230
|
+
}
|
|
231
|
+
function Fe(e) {
|
|
232
|
+
if (!U(I)) return;
|
|
233
|
+
A(e);
|
|
234
|
+
let { x: t, y: n } = N(e);
|
|
235
|
+
U(I) && Z({
|
|
236
|
+
x: t,
|
|
237
|
+
y: n
|
|
238
|
+
}, e, I);
|
|
239
|
+
}
|
|
240
|
+
function Ie(e) {
|
|
241
|
+
if (!I.pointerDown || !I.pointerDown.validated) return;
|
|
242
|
+
let t = I.pointerDown.parent.data.config;
|
|
243
|
+
if (!(e.pointerType === "mouse" && !Ee())) if (W(I)) W(I) && yt(e, I);
|
|
244
|
+
else {
|
|
245
|
+
if (A(e), t.longPress && !I.longPress) {
|
|
246
|
+
clearTimeout(I.longPressTimeout), I.longPress = !1;
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
let n = t.draggedNodes(I.pointerDown);
|
|
250
|
+
t.dragstartClasses(I.pointerDown.node, n, t, !0);
|
|
251
|
+
let r = I.pointerDown.node.el.getBoundingClientRect();
|
|
252
|
+
yt(e, ht(I.pointerDown.node, I.pointerDown.parent, e, I, n, r), !0);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function Le({ parent: e, getValues: t, setValues: n, config: r = {} }) {
|
|
256
|
+
if (!Te) return;
|
|
257
|
+
De ||= $(document, {
|
|
258
|
+
dragover: Fe,
|
|
259
|
+
pointerdown: je,
|
|
260
|
+
pointerup: Me,
|
|
261
|
+
keydown: Ne,
|
|
262
|
+
drop: Pe,
|
|
263
|
+
pointermove: Ie,
|
|
264
|
+
pointercancel: K(r.handlePointercancel),
|
|
265
|
+
touchmove: (e) => {
|
|
266
|
+
U(I) && e.cancelable && A(e);
|
|
267
|
+
},
|
|
268
|
+
contextmenu: (e) => {
|
|
269
|
+
W(I) && A(e);
|
|
270
|
+
}
|
|
271
|
+
}), Ue(e);
|
|
272
|
+
let [i, a] = be(), o = {
|
|
273
|
+
getValues: t,
|
|
274
|
+
setValues: n,
|
|
275
|
+
config: {
|
|
276
|
+
dragDropEffect: r.dragDropEffect ?? "move",
|
|
277
|
+
dragEffectAllowed: r.dragEffectAllowed ?? "move",
|
|
278
|
+
draggedNodes: $e,
|
|
279
|
+
dragstartClasses: rt,
|
|
280
|
+
handleNodeKeydown: ot,
|
|
281
|
+
handleDragstart: tt,
|
|
282
|
+
handleNodeDragover: bt,
|
|
283
|
+
handleParentDragover: xt,
|
|
284
|
+
handleNodeDrop: ct,
|
|
285
|
+
handleNodeFocus: lt,
|
|
286
|
+
handleNodeBlur: ut,
|
|
287
|
+
handlePointercancel: ft,
|
|
288
|
+
handleEnd: pt,
|
|
289
|
+
handleDragend: dt,
|
|
290
|
+
handleParentFocus: Be,
|
|
291
|
+
handleNodePointerup: mt,
|
|
292
|
+
handleNodePointerover: st,
|
|
293
|
+
handleParentPointerover: St,
|
|
294
|
+
handleParentScroll: et,
|
|
295
|
+
handleNodePointerdown: nt,
|
|
296
|
+
handleNodeDragenter: wt,
|
|
297
|
+
handleNodeDragleave: Tt,
|
|
298
|
+
handleParentDrop: He,
|
|
299
|
+
multiDrag: r.multiDrag ?? !1,
|
|
300
|
+
nativeDrag: r.nativeDrag ?? !0,
|
|
301
|
+
performSort: ze,
|
|
302
|
+
performTransfer: Ve,
|
|
303
|
+
root: r.root ?? document,
|
|
304
|
+
setupNode: Ge,
|
|
305
|
+
setupNodeRemap: Ke,
|
|
306
|
+
reapplyDragClasses: qe,
|
|
307
|
+
tearDownNode: Ye,
|
|
308
|
+
tearDownNodeRemap: Je,
|
|
309
|
+
remapFinished: Ze,
|
|
310
|
+
threshold: {
|
|
311
|
+
horizontal: 0,
|
|
312
|
+
vertical: 0
|
|
313
|
+
},
|
|
314
|
+
...r
|
|
315
|
+
},
|
|
316
|
+
enabledNodes: [],
|
|
317
|
+
abortControllers: {},
|
|
318
|
+
privateClasses: [],
|
|
319
|
+
on: a,
|
|
320
|
+
emit: i
|
|
321
|
+
};
|
|
322
|
+
new MutationObserver(Xe).observe(e, { childList: !0 }), P.set(e, o), r.plugins?.forEach((t) => {
|
|
323
|
+
t(e)?.tearDown?.();
|
|
324
|
+
}), r.plugins?.forEach((t) => {
|
|
325
|
+
t(e)?.tearDown?.();
|
|
326
|
+
}), r.plugins?.forEach((t) => {
|
|
327
|
+
t(e)?.setup?.();
|
|
328
|
+
}), We(e, o), G(e, !0);
|
|
329
|
+
}
|
|
330
|
+
function Re(e, t, n, r, i, a) {
|
|
331
|
+
let { x: o, y: s } = N(n), c = e.el.getBoundingClientRect();
|
|
332
|
+
return {
|
|
333
|
+
affectedNodes: [],
|
|
334
|
+
ascendingDirection: !1,
|
|
335
|
+
clonedDraggedEls: [],
|
|
336
|
+
coordinates: {
|
|
337
|
+
x: o,
|
|
338
|
+
y: s
|
|
339
|
+
},
|
|
340
|
+
draggedNode: {
|
|
341
|
+
el: e.el,
|
|
342
|
+
data: e.data
|
|
343
|
+
},
|
|
344
|
+
draggedNodes: r,
|
|
345
|
+
incomingDirection: void 0,
|
|
346
|
+
initialIndex: e.data.index,
|
|
347
|
+
initialParent: {
|
|
348
|
+
el: t.el,
|
|
349
|
+
data: t.data
|
|
350
|
+
},
|
|
351
|
+
currentParent: {
|
|
352
|
+
el: t.el,
|
|
353
|
+
data: t.data
|
|
354
|
+
},
|
|
355
|
+
longPress: t.data.config.longPress ?? !1,
|
|
356
|
+
longPressTimeout: void 0,
|
|
357
|
+
currentTargetValue: e.data.value,
|
|
358
|
+
scrollEls: [],
|
|
359
|
+
startLeft: i || o - (c?.left ?? 0),
|
|
360
|
+
startTop: a || s - (c?.top ?? 0),
|
|
361
|
+
targetIndex: e.data.index,
|
|
362
|
+
transferred: !1
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
function ze({ parent: e, draggedNodes: t, targetNodes: n }) {
|
|
366
|
+
G(e.el);
|
|
367
|
+
let r = t.map((e) => e.data.value), i = V(e.el, e.data), a = t[0].data.index, o = [...e.data.enabledNodes], s = [...i.filter((e) => !r.some((t) => M(e, t)))];
|
|
368
|
+
s.splice(n[0].data.index, 0, ...r), "draggedNode" in I && (I.currentTargetValue = n[0].data.value), H(e.el, e.data, [...s]), e.data.config.onSort && e.data.config.onSort({
|
|
369
|
+
parent: {
|
|
370
|
+
el: e.el,
|
|
371
|
+
data: e.data
|
|
372
|
+
},
|
|
373
|
+
previousValues: [...i],
|
|
374
|
+
previousNodes: [...o],
|
|
375
|
+
nodes: [...e.data.enabledNodes],
|
|
376
|
+
values: [...s],
|
|
377
|
+
draggedNodes: t,
|
|
378
|
+
previousPosition: a,
|
|
379
|
+
position: n[0].data.index,
|
|
380
|
+
targetNodes: n,
|
|
381
|
+
state: I
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
function R(e, t, n) {
|
|
385
|
+
if (!t) {
|
|
386
|
+
n.activeState = void 0;
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
n.activeState = {
|
|
390
|
+
node: t,
|
|
391
|
+
parent: e
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function z(e, t, n) {
|
|
395
|
+
let r = t.data.config.selectedClass;
|
|
396
|
+
if (!n.selectedState) return;
|
|
397
|
+
let i = Array.from(e);
|
|
398
|
+
X(e.map((e) => e.el), r);
|
|
399
|
+
for (let e of i) {
|
|
400
|
+
e.el.setAttribute("aria-selected", "false");
|
|
401
|
+
let t = n.selectedState.nodes.findIndex((t) => t.el === e.el);
|
|
402
|
+
t !== -1 && n.selectedState.nodes.splice(t, 1);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function B(e, t, n, r, i = !1) {
|
|
406
|
+
r.pointerSelection = i;
|
|
407
|
+
for (let n of t) n.el.setAttribute("aria-selected", "true"), Y([n.el], e.data.config.selectedClass, !0);
|
|
408
|
+
r.selectedState = {
|
|
409
|
+
nodes: t,
|
|
410
|
+
parent: e
|
|
411
|
+
}, R(e, n, r);
|
|
412
|
+
}
|
|
413
|
+
function Be(e, t) {
|
|
414
|
+
let n = e.targetData.parent.data.enabledNodes[0];
|
|
415
|
+
n && (t.selectedState && t.selectedState.parent.el !== e.targetData.parent.el ? R(e.targetData.parent, n, t) : t.selectedState || R(e.targetData.parent, n, t));
|
|
416
|
+
}
|
|
417
|
+
function Ve({ currentParent: e, targetParent: t, initialParent: n, draggedNodes: r, initialIndex: i, targetNodes: a, state: o }) {
|
|
418
|
+
G(n.el);
|
|
419
|
+
let s = r.map((e) => e.data.value), c = [...V(e.el, e.data).filter((e) => !s.some((t) => M(e, t)))], l = V(t.el, t.data), u = n.el === t.el && t.data.config.sortable === !1, d;
|
|
420
|
+
a.length ? (d = u ? i : t.data.config.sortable === !1 ? t.data.enabledNodes.length : a[0].data.index, l.splice(d, 0, ...s)) : (d = u ? i : t.data.enabledNodes.length, l.splice(d, 0, ...s)), H(e.el, e.data, c), H(t.el, t.data, l), t.data.config.onTransfer && t.data.config.onTransfer({
|
|
421
|
+
sourceParent: e,
|
|
422
|
+
targetParent: t,
|
|
423
|
+
initialParent: n,
|
|
424
|
+
draggedNodes: r,
|
|
425
|
+
targetIndex: d,
|
|
426
|
+
state: o,
|
|
427
|
+
targetNodes: a
|
|
428
|
+
}), e.data.config.onTransfer && e.data.config.onTransfer({
|
|
429
|
+
sourceParent: e,
|
|
430
|
+
targetParent: t,
|
|
431
|
+
initialParent: n,
|
|
432
|
+
draggedNodes: r,
|
|
433
|
+
targetIndex: d,
|
|
434
|
+
state: o,
|
|
435
|
+
targetNodes: a || []
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
function V(e, t) {
|
|
439
|
+
return [...t.getValues(e)];
|
|
440
|
+
}
|
|
441
|
+
function H(e, t, n) {
|
|
442
|
+
t.setValues(n, e);
|
|
443
|
+
}
|
|
444
|
+
function He(e, t) {
|
|
445
|
+
j(e.e), L = !0;
|
|
446
|
+
let n = t.initialParent.data.config.handleEnd;
|
|
447
|
+
n(t);
|
|
448
|
+
}
|
|
449
|
+
function Ue(e) {
|
|
450
|
+
let t = P.get(e);
|
|
451
|
+
t && t.abortControllers.mainParent && t.abortControllers.mainParent.abort();
|
|
452
|
+
}
|
|
453
|
+
function U(e) {
|
|
454
|
+
return "draggedNode" in e && !!e.draggedNode;
|
|
455
|
+
}
|
|
456
|
+
function W(e) {
|
|
457
|
+
return "synthDragging" in e && !!e.synthDragging;
|
|
458
|
+
}
|
|
459
|
+
function We(e, t) {
|
|
460
|
+
t.abortControllers.mainParent = $(e, {
|
|
461
|
+
dragover: J(t.config.handleParentDragover),
|
|
462
|
+
handleParentPointerover: t.config.handleParentPointerover,
|
|
463
|
+
scroll: J(t.config.handleParentScroll),
|
|
464
|
+
drop: J(t.config.handleParentDrop),
|
|
465
|
+
hasNestedParent: (e) => {
|
|
466
|
+
let t = P.get(e.target);
|
|
467
|
+
t && (t.nestedParent = e.detail.parent);
|
|
468
|
+
},
|
|
469
|
+
focus: J(t.config.handleParentFocus)
|
|
470
|
+
}), t.config.externalDragHandle && t.config.externalDragHandle.el && t.config.externalDragHandle.callback && (t.abortControllers.externalDragHandle = $(t.config.externalDragHandle.el, { pointerdown: (e) => {
|
|
471
|
+
if (!t.config.externalDragHandle || !t.config.externalDragHandle.callback) return;
|
|
472
|
+
let n = t.config.externalDragHandle.callback();
|
|
473
|
+
if (!Q(n)) {
|
|
474
|
+
console.warn("No draggable item found from external drag handle callback");
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
let r = F.get(n);
|
|
478
|
+
if (!r) return;
|
|
479
|
+
let i = n.parentNode;
|
|
480
|
+
if (!(i instanceof HTMLElement)) return;
|
|
481
|
+
let a = P.get(i);
|
|
482
|
+
a && (I.pointerDown = {
|
|
483
|
+
parent: {
|
|
484
|
+
el: i,
|
|
485
|
+
data: a
|
|
486
|
+
},
|
|
487
|
+
node: {
|
|
488
|
+
el: n,
|
|
489
|
+
data: r
|
|
490
|
+
},
|
|
491
|
+
validated: !0
|
|
492
|
+
}, n.draggable = !0);
|
|
493
|
+
} }));
|
|
494
|
+
}
|
|
495
|
+
function Ge(e) {
|
|
496
|
+
let t = e.parent.data.config;
|
|
497
|
+
e.node.data.abortControllers.mainNode = $(e.node.el, {
|
|
498
|
+
keydown: K(t.handleNodeKeydown),
|
|
499
|
+
dragstart: K(t.handleDragstart),
|
|
500
|
+
dragover: K(t.handleNodeDragover),
|
|
501
|
+
dragenter: K(t.handleNodeDragenter),
|
|
502
|
+
dragleave: K(t.handleNodeDragleave),
|
|
503
|
+
dragend: K(t.handleDragend),
|
|
504
|
+
drop: K(t.handleNodeDrop),
|
|
505
|
+
focus: K(t.handleNodeFocus),
|
|
506
|
+
blur: K(t.handleNodeBlur),
|
|
507
|
+
pointerup: K(t.handleNodePointerup),
|
|
508
|
+
pointercancel: K(t.handlePointercancel),
|
|
509
|
+
pointerdown: K(t.handleNodePointerdown),
|
|
510
|
+
handleNodePointerover: t.handleNodePointerover,
|
|
511
|
+
touchmove: (e) => {
|
|
512
|
+
U(I) && e.cancelable && A(e);
|
|
513
|
+
},
|
|
514
|
+
contextmenu: (e) => {
|
|
515
|
+
W(I) && A(e);
|
|
516
|
+
}
|
|
517
|
+
}), e.node.el.draggable = !0, t.reapplyDragClasses(e.node.el, e.parent.data), e.parent.data.config.plugins?.forEach((t) => {
|
|
518
|
+
t(e.parent.el)?.setupNode?.(e);
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function Ke(e) {
|
|
522
|
+
F.set(e.node.el, e.node.data), e.parent.data.config.plugins?.forEach((t) => {
|
|
523
|
+
t(e.parent.el)?.setupNodeRemap?.(e);
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
function qe(e, t) {
|
|
527
|
+
if (!U(I)) return;
|
|
528
|
+
let n = W(I) ? t.config.synthDropZoneClass : t.config.dropZoneClass;
|
|
529
|
+
I.draggedNode.el === e && Y([e], n, !0);
|
|
530
|
+
}
|
|
531
|
+
function Je(e) {
|
|
532
|
+
e.parent.data.config.plugins?.forEach((t) => {
|
|
533
|
+
t(e.parent.el)?.tearDownNodeRemap?.(e);
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
function Ye(e) {
|
|
537
|
+
e.parent.data.config.plugins?.forEach((t) => {
|
|
538
|
+
t(e.parent.el)?.tearDownNode?.(e);
|
|
539
|
+
}), e.node.el.draggable = !1, e.node.data?.abortControllers?.mainNode && e.node.data?.abortControllers?.mainNode.abort();
|
|
540
|
+
}
|
|
541
|
+
function Xe(e) {
|
|
542
|
+
if (e.length === 1 && e[0].addedNodes.length === 1 && !(e[0].addedNodes[0] instanceof HTMLElement)) return;
|
|
543
|
+
let t = e[0].target;
|
|
544
|
+
t instanceof HTMLElement && P.get(t) && G(t);
|
|
545
|
+
}
|
|
546
|
+
function G(e, t) {
|
|
547
|
+
let n = P.get(e);
|
|
548
|
+
if (!n) return;
|
|
549
|
+
n.privateClasses = Array.from(e.classList);
|
|
550
|
+
let r = [], i = n.config;
|
|
551
|
+
for (let a = 0; a < e.children.length; a++) {
|
|
552
|
+
let o = e.children[a];
|
|
553
|
+
if (!Q(o) || o.id === "dnd-dragged-node-clone") continue;
|
|
554
|
+
let s = F.get(o);
|
|
555
|
+
(t || !s) && i.tearDownNode({
|
|
556
|
+
parent: {
|
|
557
|
+
el: e,
|
|
558
|
+
data: n
|
|
559
|
+
},
|
|
560
|
+
node: {
|
|
561
|
+
el: o,
|
|
562
|
+
data: s
|
|
563
|
+
}
|
|
564
|
+
}), !i.disabled && (!i.draggable || i.draggable && i.draggable(o)) && r.push(o);
|
|
565
|
+
}
|
|
566
|
+
if (r.length !== n.getValues(e).length && !i.disabled) {
|
|
567
|
+
console.warn("The number of draggable items defined in the parent element does not match the number of values. This may cause unexpected behavior.");
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
let a = n.getValues(e), o = [];
|
|
571
|
+
for (let s = 0; s < r.length; s++) {
|
|
572
|
+
let c = r[s], l = F.get(c);
|
|
573
|
+
if (i.draggableValue && !i.draggableValue(a[s])) continue;
|
|
574
|
+
let u = Object.assign(l ?? {
|
|
575
|
+
privateClasses: [],
|
|
576
|
+
abortControllers: {}
|
|
577
|
+
}, {
|
|
578
|
+
value: a[s],
|
|
579
|
+
index: s
|
|
580
|
+
});
|
|
581
|
+
if (!U(I) && I.activeState && M(I.activeState.node.data.value, u.value) && R({
|
|
582
|
+
data: n,
|
|
583
|
+
el: e
|
|
584
|
+
}, {
|
|
585
|
+
el: c,
|
|
586
|
+
data: u
|
|
587
|
+
}, I), U(I) && M(I.draggedNode.data.value, u.value)) {
|
|
588
|
+
I.draggedNode.data = u, I.draggedNode.el = c;
|
|
589
|
+
let e = I.draggedNodes.find((e) => e.data.value === u.value);
|
|
590
|
+
e && (e.el = c);
|
|
591
|
+
}
|
|
592
|
+
o.push({
|
|
593
|
+
el: c,
|
|
594
|
+
data: u
|
|
595
|
+
}), (t || !l) && i.setupNode({
|
|
596
|
+
parent: {
|
|
597
|
+
el: e,
|
|
598
|
+
data: n
|
|
599
|
+
},
|
|
600
|
+
node: {
|
|
601
|
+
el: c,
|
|
602
|
+
data: u
|
|
603
|
+
}
|
|
604
|
+
}), Ke({
|
|
605
|
+
parent: {
|
|
606
|
+
el: e,
|
|
607
|
+
data: n
|
|
608
|
+
},
|
|
609
|
+
node: {
|
|
610
|
+
el: c,
|
|
611
|
+
data: u
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
P.set(e, {
|
|
616
|
+
...n,
|
|
617
|
+
enabledNodes: o
|
|
618
|
+
}), i.remapFinished(n), n.config.plugins?.forEach((t) => {
|
|
619
|
+
t(e)?.remapFinished?.();
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
function Ze() {
|
|
623
|
+
I.remapJustFinished = !0, "draggedNode" in I && (I.affectedNodes = []);
|
|
624
|
+
}
|
|
625
|
+
function Qe(e) {
|
|
626
|
+
return !!e.targetData.parent.data.config.nativeDrag;
|
|
627
|
+
}
|
|
628
|
+
function $e(e) {
|
|
629
|
+
return e.parent.data.config.multiDrag ? I.selectedState ? [e.node, ...I.selectedState?.nodes.filter((t) => t.el !== e.node.el)] : [] : [e.node];
|
|
630
|
+
}
|
|
631
|
+
function et(e) {
|
|
632
|
+
U(I) && (I.emit("scrollStarted", I), !W(I) && (I.preventEnter = !0, Oe && clearTimeout(Oe), Oe = setTimeout(() => {
|
|
633
|
+
I.preventEnter = !1, I.emit("scrollEnded", I);
|
|
634
|
+
}, 100)));
|
|
635
|
+
}
|
|
636
|
+
function tt(e, t) {
|
|
637
|
+
let n = e.targetData.parent.data.config;
|
|
638
|
+
if (!n.nativeDrag || !Qe(e) || !at({
|
|
639
|
+
x: e.e.clientX,
|
|
640
|
+
y: e.e.clientY,
|
|
641
|
+
node: e.targetData.node,
|
|
642
|
+
config: n
|
|
643
|
+
})) {
|
|
644
|
+
A(e.e);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
let r = n.draggedNodes({
|
|
648
|
+
parent: e.targetData.parent,
|
|
649
|
+
node: e.targetData.node
|
|
650
|
+
});
|
|
651
|
+
r.length === 0 && (r = [e.targetData.node]), n.dragstartClasses(e.targetData.node, r, n);
|
|
652
|
+
let i = it(e, r);
|
|
653
|
+
if (n.onDragstart) {
|
|
654
|
+
let t = {
|
|
655
|
+
parent: e.targetData.parent,
|
|
656
|
+
values: V(e.targetData.parent.el, e.targetData.parent.data),
|
|
657
|
+
draggedNode: i.draggedNode,
|
|
658
|
+
draggedNodes: i.draggedNodes,
|
|
659
|
+
position: i.initialIndex,
|
|
660
|
+
state: i
|
|
661
|
+
};
|
|
662
|
+
n.onDragstart(t);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
function nt(e, t) {
|
|
666
|
+
if (j(e.e), t.pointerDown = {
|
|
667
|
+
parent: e.targetData.parent,
|
|
668
|
+
node: e.targetData.node,
|
|
669
|
+
validated: !1
|
|
670
|
+
}, !at({
|
|
671
|
+
x: e.e.clientX,
|
|
672
|
+
y: e.e.clientY,
|
|
673
|
+
node: e.targetData.node,
|
|
674
|
+
config: e.targetData.parent.data.config
|
|
675
|
+
})) return;
|
|
676
|
+
t.pointerDown.validated = !0, gt(e, t, e.targetData.node);
|
|
677
|
+
let n = e.targetData.parent.data, r = [e.targetData.node], i = e.e.ctrlKey || e.e.metaKey, a = e.e.shiftKey, o = e.targetData.node;
|
|
678
|
+
if (i && n.config.multiDrag) {
|
|
679
|
+
r = t.selectedState ? t.selectedState.nodes.findIndex((e) => e.el === o.el) === -1 ? [...t.selectedState.nodes, o] : t.selectedState.nodes.filter((e) => e.el !== o.el) : [o], B(e.targetData.parent, r, e.targetData.node, t, !0);
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
if (a && n.config.multiDrag) {
|
|
683
|
+
let n = e.targetData.parent.data.enabledNodes;
|
|
684
|
+
if (t.selectedState && t.activeState) if (t.selectedState.parent.el !== e.targetData.parent.el) {
|
|
685
|
+
z(t.selectedState.nodes, t.selectedState.parent, t), t.selectedState = void 0;
|
|
686
|
+
for (let e = 0; e <= o.data.index; e++) r.push(n[e]);
|
|
687
|
+
} else {
|
|
688
|
+
let [i, a] = t.activeState.node.data.index < e.targetData.node.data.index ? [t.activeState.node.data.index, e.targetData.node.data.index] : [e.targetData.node.data.index, t.activeState.node.data.index];
|
|
689
|
+
r = n.slice(i, a + 1);
|
|
690
|
+
}
|
|
691
|
+
else for (let e = 0; e <= o.data.index; e++) r.push(n[e]);
|
|
692
|
+
B(e.targetData.parent, r, e.targetData.node, t, !0);
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
t.selectedState?.nodes?.length ? t.selectedState.nodes.findIndex((t) => t.el === e.targetData.node.el) === -1 && (t.selectedState.parent.el === e.targetData.parent.el && n.config.multiDrag && Ee() ? r.push(...t.selectedState.nodes) : z(t.selectedState.nodes, e.targetData.parent, t), B(e.targetData.parent, r, e.targetData.node, t, !0)) : B(e.targetData.parent, [e.targetData.node], e.targetData.node, t, !0);
|
|
696
|
+
}
|
|
697
|
+
function rt(e, t, n, r = !1) {
|
|
698
|
+
Y(t.map((e) => e.el), r ? n.synthDraggingClass : n.draggingClass), setTimeout(() => {
|
|
699
|
+
X(t.map((e) => e.el), r ? n.synthDraggingClass : n.draggingClass), Y(t.map((e) => e.el), r ? n.synthDragPlaceholderClass : n.dragPlaceholderClass), Y(t.map((e) => e.el), r ? n.synthDropZoneClass : n.dropZoneClass), X(t.map((e) => e.el), n.selectedClass);
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
function it(e, t) {
|
|
703
|
+
j(e.e);
|
|
704
|
+
let n = Ae(Re(e.targetData.node, e.targetData.parent, e.e, t));
|
|
705
|
+
if (e.e.dataTransfer) {
|
|
706
|
+
let r = e.targetData.parent.data.config;
|
|
707
|
+
e.e.dataTransfer.dropEffect = r.dragDropEffect, e.e.dataTransfer.effectAllowed = r.dragEffectAllowed;
|
|
708
|
+
let i;
|
|
709
|
+
if (e.e.dataTransfer.setData("text/plain", ""), r.dragImage) i = r.dragImage(e, t);
|
|
710
|
+
else if (!r.multiDrag || t.length === 1) return e.targetData.node.el.style.zIndex = "9999", e.targetData.node.el.style.boxSizing = "border-box", e.e.dataTransfer.setDragImage(e.targetData.node.el, e.e.offsetX, e.e.offsetY), n.originalZIndex = e.targetData.node.el.style.zIndex, n;
|
|
711
|
+
else {
|
|
712
|
+
let n = document.createElement("div");
|
|
713
|
+
n.setAttribute("id", "dnd-dragged-node-clone"), n.setAttribute("popover", "manual");
|
|
714
|
+
for (let e of t) {
|
|
715
|
+
let t = e.el.cloneNode(!0);
|
|
716
|
+
t.id = e.el.id + "-clone", t.style.pointerEvents = "none", n.appendChild(t);
|
|
717
|
+
}
|
|
718
|
+
let { width: r } = t[0].el.getBoundingClientRect();
|
|
719
|
+
Object.assign(n.style, {
|
|
720
|
+
display: "flex",
|
|
721
|
+
flexDirection: "column",
|
|
722
|
+
width: `${r}px`,
|
|
723
|
+
position: "absolute",
|
|
724
|
+
pointerEvents: "none",
|
|
725
|
+
zIndex: "9999",
|
|
726
|
+
left: "-9999px",
|
|
727
|
+
boxSizing: "border-box",
|
|
728
|
+
background: "transparent",
|
|
729
|
+
overflow: "hidden"
|
|
730
|
+
}), e.targetData.parent.el.appendChild(n), n.showPopover(), n.getBoundingClientRect(), i = n, e.e.dataTransfer.setDragImage(i, e.e.offsetX, e.e.offsetY);
|
|
731
|
+
}
|
|
732
|
+
setTimeout(() => {
|
|
733
|
+
i?.remove();
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
return n;
|
|
737
|
+
}
|
|
738
|
+
function at({ x: e, y: t, node: n, config: r }) {
|
|
739
|
+
if (r.externalDragHandle) return !1;
|
|
740
|
+
if (!r.dragHandle) return !0;
|
|
741
|
+
let i = n.el.querySelectorAll(r.dragHandle);
|
|
742
|
+
if (!i) return !1;
|
|
743
|
+
let a = r.root.elementFromPoint(e, t);
|
|
744
|
+
if (!a) return !1;
|
|
745
|
+
for (let e of Array.from(i)) if (a === e || e.contains(a)) return !0;
|
|
746
|
+
return !1;
|
|
747
|
+
}
|
|
748
|
+
function ot(e) {}
|
|
749
|
+
function st(e) {
|
|
750
|
+
e.detail.targetData.parent.el === e.detail.state.currentParent.el ? Dt(e.detail, e.detail.state) : q(e.detail, e.detail.state);
|
|
751
|
+
}
|
|
752
|
+
function ct(e, t) {
|
|
753
|
+
let n = e.targetData.parent.data.config;
|
|
754
|
+
n.nativeDrag && (j(e.e), L = !0, n.handleEnd(t));
|
|
755
|
+
}
|
|
756
|
+
function lt(e) {
|
|
757
|
+
e.e.target !== e.e.currentTarget && I.pointerDown && (I.pointerDown.node.el.draggable = !1);
|
|
758
|
+
}
|
|
759
|
+
function ut(e) {
|
|
760
|
+
e.e.target !== e.e.currentTarget && I.pointerDown && (I.pointerDown.node.el.draggable = !0);
|
|
761
|
+
}
|
|
762
|
+
function dt(e, t) {
|
|
763
|
+
let n = e.targetData.parent.data.config;
|
|
764
|
+
if (n.nativeDrag) {
|
|
765
|
+
if (A(e.e), j(e.e), L) {
|
|
766
|
+
L = !1;
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
n.handleEnd(t);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
function ft(e, t) {
|
|
773
|
+
if (!W(t)) return;
|
|
774
|
+
if (A(e.e), L) {
|
|
775
|
+
L = !1;
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
let n = P.get(t.initialParent.el)?.config;
|
|
779
|
+
n?.onDragend && n.onDragend({
|
|
780
|
+
parent: t.currentParent,
|
|
781
|
+
values: V(t.currentParent.el, t.currentParent.data),
|
|
782
|
+
draggedNode: t.draggedNode,
|
|
783
|
+
draggedNodes: t.draggedNodes,
|
|
784
|
+
state: t
|
|
785
|
+
}), n?.handleEnd(t);
|
|
786
|
+
}
|
|
787
|
+
function pt(e) {
|
|
788
|
+
e.draggedNode && (e.draggedNode.el.draggable = !0);
|
|
789
|
+
let t = e.draggedNodes.map((e) => e.el), n = e.initialParent.data, r = W(e), i = P.get(e.initialParent.el)?.config, a = r ? i?.synthDropZoneClass : i?.dropZoneClass, o = n?.config?.longPressClass, s = r ? n?.config?.synthDragPlaceholderClass : n?.config?.dragPlaceholderClass, c = e.originalZIndex;
|
|
790
|
+
W(e) && (e.clonedDraggedNode && e.clonedDraggedNode.remove(), e.longPressTimeout && clearTimeout(e.longPressTimeout)), _t(e), e.lastScrollDirectionX = void 0, e.lastScrollDirectionY = void 0, e.preventEnter = !1, e.scrollDebounceTimeout &&= (clearTimeout(e.scrollDebounceTimeout), void 0), c !== void 0 && e.draggedNode && (e.draggedNode.el.style.zIndex = c), requestAnimationFrame(() => {
|
|
791
|
+
X(t, a), X(t, o), X(t, s);
|
|
792
|
+
}), z(e.draggedNodes, e.currentParent, e), R(e.currentParent, void 0, e);
|
|
793
|
+
let l = { ...e };
|
|
794
|
+
i?.onDragend?.({
|
|
795
|
+
parent: l.currentParent,
|
|
796
|
+
values: V(l.currentParent.el, l.currentParent.data),
|
|
797
|
+
draggedNode: l.draggedNode,
|
|
798
|
+
draggedNodes: l.draggedNodes,
|
|
799
|
+
state: l
|
|
800
|
+
}), e.emit("dragEnded", l), ke();
|
|
801
|
+
}
|
|
802
|
+
function mt(e, t) {
|
|
803
|
+
j(e.e), !t.pointerSelection && t.selectedState && z(t.selectedState.nodes, e.targetData.parent, t);
|
|
804
|
+
let n = e.targetData.parent.data.config;
|
|
805
|
+
t.pointerSelection = !1, "longPressTimeout" in t && t.longPressTimeout && clearTimeout(t.longPressTimeout), t.longPress = !1, X(e.targetData.parent.data.enabledNodes.map((e) => e.el), n.longPressClass), U(t) && n.handleEnd(t);
|
|
806
|
+
}
|
|
807
|
+
function ht(e, t, n, r, i, a) {
|
|
808
|
+
let o = t.data.config, s, c, l = /* @__PURE__ */ "display.flexDirection.alignItems.justifyContent.padding.paddingTop.margin.marginTop.marginBottom.marginLeft.marginRight.paddingBottom.paddingLeft.paddingRight.border.borderRadius.background.backgroundColor.boxShadow.font.color.lineHeight.gap.width.height.boxSizing.overflow".split("."), u = (e, t) => {
|
|
809
|
+
let n = window.getComputedStyle(e);
|
|
810
|
+
l.forEach((e) => {
|
|
811
|
+
t.style[e] = n[e];
|
|
812
|
+
});
|
|
813
|
+
}, d = (e, t = {}) => {
|
|
814
|
+
Object.assign(e.style, {
|
|
815
|
+
position: "absolute",
|
|
816
|
+
zIndex: "9999",
|
|
817
|
+
pointerEvents: "none",
|
|
818
|
+
willChange: "transform",
|
|
819
|
+
boxSizing: "border-box",
|
|
820
|
+
opacity: "0",
|
|
821
|
+
overflow: "hidden",
|
|
822
|
+
width: `${a.width}px`,
|
|
823
|
+
height: `${a.height}px`,
|
|
824
|
+
...t
|
|
825
|
+
});
|
|
826
|
+
};
|
|
827
|
+
if (o.synthDragImage) c = o.synthDragImage(e, t, n, i), s = c.dragImage, s.setAttribute("popover", "manual"), d(s);
|
|
828
|
+
else if (!o.multiDrag || i.length === 1) s = e.el.cloneNode(!0), u(e.el, s), s.setAttribute("popover", "manual"), d(s);
|
|
829
|
+
else {
|
|
830
|
+
let e = document.createElement("div");
|
|
831
|
+
e.setAttribute("popover", "manual"), i.forEach((t) => {
|
|
832
|
+
let n = t.el.cloneNode(!0);
|
|
833
|
+
u(t.el, n), n.style.pointerEvents = "none", n.style.margin = "0", e.append(n);
|
|
834
|
+
}), e.style.display = "flex", e.style.flexDirection = "column", e.style.padding = "0", e.style.margin = "0", e.style.position = "absolute", e.style.zIndex = "9999", e.style.pointerEvents = "none", s = e;
|
|
835
|
+
}
|
|
836
|
+
s.id = "dnd-dragged-node-clone", t.el.appendChild(s), s.showPopover();
|
|
837
|
+
let f = {
|
|
838
|
+
clonedDraggedEls: [],
|
|
839
|
+
clonedDraggedNode: s,
|
|
840
|
+
synthDragScrolling: !1,
|
|
841
|
+
synthDragging: !0,
|
|
842
|
+
rootScrollWidth: document.scrollingElement?.scrollWidth,
|
|
843
|
+
rootScrollHeight: document.scrollingElement?.scrollHeight
|
|
844
|
+
};
|
|
845
|
+
return Ae({
|
|
846
|
+
...Re(e, t, n, i, c?.offsetX, c?.offsetY),
|
|
847
|
+
...f
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
function gt(e, t, n) {
|
|
851
|
+
let r = e.targetData.parent.data.config;
|
|
852
|
+
t.longPressTimeout = setTimeout(() => {
|
|
853
|
+
t && (t.longPress = !0, r.longPressClass && e.e.cancelable && Y([n.el], r.longPressClass), A(e.e));
|
|
854
|
+
}, r.longPressDuration || 1e3);
|
|
855
|
+
}
|
|
856
|
+
function _t(e, t = !0, n = !0) {
|
|
857
|
+
t && (e.frameIdX !== void 0 && (cancelAnimationFrame(e.frameIdX), e.frameIdX = void 0), e.lastScrollDirectionX = void 0), n && (e.frameIdY !== void 0 && (cancelAnimationFrame(e.frameIdY), e.frameIdY = void 0), e.lastScrollDirectionY = void 0), !e.frameIdX && !e.frameIdY && (e.preventEnter = !1);
|
|
858
|
+
}
|
|
859
|
+
function vt(e, t = !1) {
|
|
860
|
+
let { x: n, y: r } = e.coordinates, i = e.startLeft ?? 0, a = e.startTop ?? 0, o = window.scrollX ?? 0, s = window.scrollY ?? 0, c = n - i + o, l = r - a + s;
|
|
861
|
+
e.clonedDraggedNode.style.transform = `translate3d(${c}px, ${l}px, 0px)`, t && (e.clonedDraggedNode.style.opacity = "1", X(e.draggedNodes.map((e) => e.el), e.initialParent.data.config?.longPressClass));
|
|
862
|
+
}
|
|
863
|
+
function yt(e, t, n = !1) {
|
|
864
|
+
let r = N(e);
|
|
865
|
+
t.coordinates.x = r.x, t.coordinates.y = r.y, vt(t, n), t.scrollDebounceTimeout &&= (clearTimeout(t.scrollDebounceTimeout), void 0), t.scrollDebounceTimeout = setTimeout(() => {
|
|
866
|
+
W(t) && Z(t.coordinates, e, t);
|
|
867
|
+
}, 16);
|
|
868
|
+
let i = Nt(r);
|
|
869
|
+
if (!i) {
|
|
870
|
+
document.dispatchEvent(new CustomEvent("handleRootPointerover", { detail: {
|
|
871
|
+
e,
|
|
872
|
+
state: t
|
|
873
|
+
} }));
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
let a = {
|
|
877
|
+
e,
|
|
878
|
+
targetData: i,
|
|
879
|
+
state: t
|
|
880
|
+
};
|
|
881
|
+
"node" in i ? i.node.el.dispatchEvent(new CustomEvent("handleNodePointerover", { detail: a })) : i.parent.el.dispatchEvent(new CustomEvent("handleParentPointerover", { detail: a }));
|
|
882
|
+
}
|
|
883
|
+
function bt(e, t) {
|
|
884
|
+
if (!e.targetData.parent.data.config.nativeDrag) return;
|
|
885
|
+
let { x: n, y: r } = N(e.e);
|
|
886
|
+
t.coordinates.y = r, t.coordinates.x = n, A(e.e), j(e.e), U(t) && Z({
|
|
887
|
+
x: n,
|
|
888
|
+
y: r
|
|
889
|
+
}, e.e, t), e.targetData.parent.el === t.currentParent?.el ? Dt(e, t) : q(e, t);
|
|
890
|
+
}
|
|
891
|
+
function xt(e, t) {
|
|
892
|
+
if (!e.targetData.parent.data.config.nativeDrag) return;
|
|
893
|
+
A(e.e), j(e.e);
|
|
894
|
+
let { x: n, y: r } = N(e.e);
|
|
895
|
+
U(t) && Z({
|
|
896
|
+
x: n,
|
|
897
|
+
y: r
|
|
898
|
+
}, e.e, t), q(e, t);
|
|
899
|
+
}
|
|
900
|
+
function St(e) {
|
|
901
|
+
e.detail.targetData.parent.el !== e.detail.state.currentParent.el && q(e.detail, e.detail.state);
|
|
902
|
+
}
|
|
903
|
+
function Ct({ currentParent: e, targetParent: t, initialParent: n, draggedNodes: r, state: i }) {
|
|
904
|
+
if (t.el === e.el) return !1;
|
|
905
|
+
let a = t.data.config;
|
|
906
|
+
if (r[0].el.contains(t.el) || a.dropZone === !1) return !1;
|
|
907
|
+
let o = n.data.config;
|
|
908
|
+
return a.accepts ? a.accepts(t, n, e, i) : !(!a.group || a.group !== o.group);
|
|
909
|
+
}
|
|
910
|
+
function wt(e, t) {
|
|
911
|
+
A(e.e);
|
|
912
|
+
}
|
|
913
|
+
function Tt(e, t) {
|
|
914
|
+
A(e.e);
|
|
915
|
+
}
|
|
916
|
+
function Et(e, t, n, r) {
|
|
917
|
+
if (t.affectedNodes.map((e) => e.data.value).includes(e.targetData.node.data.value)) return !1;
|
|
918
|
+
if (t.remapJustFinished) return t.remapJustFinished = !1, (e.targetData.node.data.value === t.currentTargetValue || t.draggedNodes.map((e) => e.el).includes(e.targetData.node.el)) && (t.currentTargetValue = e.targetData.node.data.value), !1;
|
|
919
|
+
if (t.preventEnter) return !1;
|
|
920
|
+
if (t.draggedNodes.map((e) => e.el).includes(e.targetData.node.el)) return t.currentTargetValue = void 0, !1;
|
|
921
|
+
if (e.targetData.node.data.value === t.currentTargetValue || e.targetData.parent.el !== t.currentParent?.el || e.targetData.parent.data.config.sortable === !1 || e.targetData.node.el.contains(t.draggedNodes[0].el)) return !1;
|
|
922
|
+
let i = e.targetData.node.el.getBoundingClientRect(), a = t.draggedNode.el.getBoundingClientRect(), o = i.y - a.y, s = i.x - a.x, c;
|
|
923
|
+
c = Math.abs(o) > Math.abs(s) ? o > 0 ? "above" : "below" : s > 0 ? "left" : "right";
|
|
924
|
+
let l = t.currentParent.data.config.threshold;
|
|
925
|
+
switch (c) {
|
|
926
|
+
case "left":
|
|
927
|
+
if (n > i.x + i.width * l.horizontal) return t.incomingDirection = "left", !0;
|
|
928
|
+
break;
|
|
929
|
+
case "right":
|
|
930
|
+
if (n < i.x + i.width * (1 - l.horizontal)) return t.incomingDirection = "right", !0;
|
|
931
|
+
break;
|
|
932
|
+
case "above":
|
|
933
|
+
if (r > i.y + i.height * l.vertical) return t.incomingDirection = "above", !0;
|
|
934
|
+
break;
|
|
935
|
+
case "below":
|
|
936
|
+
if (r < i.y + i.height * (1 - l.vertical)) return t.incomingDirection = "below", !0;
|
|
937
|
+
break;
|
|
938
|
+
default: break;
|
|
939
|
+
}
|
|
940
|
+
return !1;
|
|
941
|
+
}
|
|
942
|
+
function Dt(e, t) {
|
|
943
|
+
let { x: n, y: r } = N(e.e);
|
|
944
|
+
if (!Et(e, t, n, r)) return;
|
|
945
|
+
let i = t.draggedNode.data.index > e.targetData.node.data.index ? [e.targetData.node.data.index, t.draggedNode.data.index] : [t.draggedNode.data.index, e.targetData.node.data.index];
|
|
946
|
+
t.targetIndex = e.targetData.node.data.index, t.affectedNodes = e.targetData.parent.data.enabledNodes.filter((e) => i[0] <= e.data.index && e.data.index <= i[1] && e.el !== t.draggedNode.el), e.targetData.parent.data.config.performSort({
|
|
947
|
+
parent: e.targetData.parent,
|
|
948
|
+
draggedNodes: t.draggedNodes,
|
|
949
|
+
targetNodes: [e.targetData.node]
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
function K(e) {
|
|
953
|
+
function t(e) {
|
|
954
|
+
let t = F.get(e);
|
|
955
|
+
if (!t) return;
|
|
956
|
+
let n = P.get(e.parentNode);
|
|
957
|
+
if (n) return {
|
|
958
|
+
node: {
|
|
959
|
+
el: e,
|
|
960
|
+
data: t
|
|
961
|
+
},
|
|
962
|
+
parent: {
|
|
963
|
+
el: e.parentNode,
|
|
964
|
+
data: n
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
return (n) => {
|
|
969
|
+
let r = t(n.currentTarget);
|
|
970
|
+
if (r) return e({
|
|
971
|
+
e: n,
|
|
972
|
+
targetData: r
|
|
973
|
+
}, I);
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
function q(e, t) {
|
|
977
|
+
A(e.e), Ct({
|
|
978
|
+
currentParent: t.currentParent,
|
|
979
|
+
targetParent: e.targetData.parent,
|
|
980
|
+
initialParent: t.initialParent,
|
|
981
|
+
draggedNodes: t.draggedNodes,
|
|
982
|
+
state: t
|
|
983
|
+
}) && (e.targetData.parent.data.config.performTransfer({
|
|
984
|
+
currentParent: t.currentParent,
|
|
985
|
+
targetParent: e.targetData.parent,
|
|
986
|
+
initialParent: t.initialParent,
|
|
987
|
+
draggedNodes: t.draggedNodes,
|
|
988
|
+
initialIndex: t.initialIndex,
|
|
989
|
+
state: t,
|
|
990
|
+
targetNodes: "node" in e.targetData ? [e.targetData.node] : []
|
|
991
|
+
}), t.currentParent = e.targetData.parent, t.transferred = !0);
|
|
992
|
+
}
|
|
993
|
+
function J(e) {
|
|
994
|
+
function t(e) {
|
|
995
|
+
let t = P.get(e);
|
|
996
|
+
if (t) return { parent: {
|
|
997
|
+
el: e,
|
|
998
|
+
data: t
|
|
999
|
+
} };
|
|
1000
|
+
}
|
|
1001
|
+
return (n) => {
|
|
1002
|
+
let r = t(n.currentTarget);
|
|
1003
|
+
if (r) return e({
|
|
1004
|
+
e: n,
|
|
1005
|
+
targetData: r
|
|
1006
|
+
}, I);
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
function Y(e, t, n = !1) {
|
|
1010
|
+
function r(e, t) {
|
|
1011
|
+
F.set(e, t);
|
|
1012
|
+
}
|
|
1013
|
+
for (let i of e) {
|
|
1014
|
+
let e = kt(i, t, F.get(i), n);
|
|
1015
|
+
e && r(i, e);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
function Ot(e, t, n = !1) {
|
|
1019
|
+
function r(e, t) {
|
|
1020
|
+
P.set(e, t);
|
|
1021
|
+
}
|
|
1022
|
+
for (let i of e) {
|
|
1023
|
+
let e = kt(i, t, P.get(i), n);
|
|
1024
|
+
e && r(i, e);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
function kt(e, t, n, r = !1) {
|
|
1028
|
+
if (!t) return;
|
|
1029
|
+
let i = we(t);
|
|
1030
|
+
if (!i.length) return;
|
|
1031
|
+
if (!n) {
|
|
1032
|
+
e.classList.add(...i);
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
let a = [];
|
|
1036
|
+
for (let t of i) e.classList.contains(t) ? e.classList.contains(t) && r === !1 && a.push(t) : e.classList.add(t);
|
|
1037
|
+
return n.privateClasses = a, n;
|
|
1038
|
+
}
|
|
1039
|
+
function X(e, t) {
|
|
1040
|
+
if (!t) return;
|
|
1041
|
+
let n = we(t);
|
|
1042
|
+
if (n.length) for (let t of e) {
|
|
1043
|
+
if (!Q(t)) {
|
|
1044
|
+
t.classList.remove(...n);
|
|
1045
|
+
continue;
|
|
1046
|
+
}
|
|
1047
|
+
let e = F.get(t) || P.get(t);
|
|
1048
|
+
if (e) for (let r of n) e.privateClasses.includes(r) || t.classList.remove(r);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
function At(e, t, n, r, i) {
|
|
1052
|
+
let a = .075, o = i.axis === "x", s = e === document.scrollingElement, c = o ? "scrollLeft" : "scrollTop", l = o ? "clientWidth" : "clientHeight", u = o ? "offsetWidth" : "offsetHeight", d = o ? "scrollWidth" : "scrollHeight", f = o ? t.clientX : t.clientY, p = o ? r.left : r.top, m = o ? n.overflowX : n.overflowY;
|
|
1053
|
+
if (s) {
|
|
1054
|
+
let t = e[c], n = e[l], r = t > 0, s = t + n < (o ? i.state.rootScrollWidth || 0 : e[d]);
|
|
1055
|
+
return o ? {
|
|
1056
|
+
left: r && f < n * a,
|
|
1057
|
+
right: s && f > n * (1 - a)
|
|
1058
|
+
} : {
|
|
1059
|
+
up: r && f < n * a,
|
|
1060
|
+
down: s && f > n * (1 - a)
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
if ((m === "auto" || m === "scroll") && e !== document.body && e !== document.documentElement) {
|
|
1064
|
+
let t = e[d], n = e[u], r = e[c], i = r > 0, s = r < t - n;
|
|
1065
|
+
return o ? {
|
|
1066
|
+
left: i && f < p + n * a,
|
|
1067
|
+
right: s && f > p + n * (1 - a)
|
|
1068
|
+
} : {
|
|
1069
|
+
up: i && f < p + n * a,
|
|
1070
|
+
down: s && f > p + n * (1 - a)
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
return o ? {
|
|
1074
|
+
left: !1,
|
|
1075
|
+
right: !1
|
|
1076
|
+
} : {
|
|
1077
|
+
up: !1,
|
|
1078
|
+
down: !1
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
function jt(e, t, n, r) {
|
|
1082
|
+
if (!U(n) || !n.draggedNode) return;
|
|
1083
|
+
n.preventEnter = !0;
|
|
1084
|
+
let i = r.axis === "x", a = r.direction === "positive" ? 1 : -1, o = i ? "lastScrollDirectionX" : "lastScrollDirectionY", s = i ? "frameIdX" : "frameIdY";
|
|
1085
|
+
n[s] !== void 0 && (cancelAnimationFrame(n[s]), n[s] = void 0), n[o] = r.direction;
|
|
1086
|
+
let c = () => {
|
|
1087
|
+
if (!U(n) || !n.draggedNode) {
|
|
1088
|
+
n[s] !== void 0 && (cancelAnimationFrame(n[s]), n[s] = void 0);
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
let t = i ? "scrollLeft" : "scrollTop", r = i ? "clientWidth" : "clientHeight", l = i ? "scrollWidth" : "scrollHeight", u = e[t], d = e[r], f = e[l];
|
|
1092
|
+
if (!(a > 0 ? u + d < f : u > 0)) {
|
|
1093
|
+
n[s] = void 0, n[o] = void 0;
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
e[t] += 20 * a, W(n) && vt(n), n[s] = requestAnimationFrame(c);
|
|
1097
|
+
};
|
|
1098
|
+
n[s] = requestAnimationFrame(c);
|
|
1099
|
+
}
|
|
1100
|
+
function Mt(e, t, n) {
|
|
1101
|
+
let r = e.getBoundingClientRect();
|
|
1102
|
+
return t >= r.left && t <= r.right && n >= r.top && n <= r.bottom;
|
|
1103
|
+
}
|
|
1104
|
+
function Z(e, t, n) {
|
|
1105
|
+
if (!U(n) || !n.draggedNode) return;
|
|
1106
|
+
_t(n);
|
|
1107
|
+
let { x: r, y: i } = e, a = !1, o = (e, r, i) => {
|
|
1108
|
+
jt(i, t, n, {
|
|
1109
|
+
axis: e,
|
|
1110
|
+
direction: r
|
|
1111
|
+
}), a = !0;
|
|
1112
|
+
}, s = (e) => {
|
|
1113
|
+
let r = window.getComputedStyle(e), i = e.getBoundingClientRect(), a = At(e, t, r, i, {
|
|
1114
|
+
axis: "x",
|
|
1115
|
+
state: n
|
|
1116
|
+
}), s = At(e, t, r, i, { axis: "y" });
|
|
1117
|
+
(a.left || a.right) && (n.lastScrollContainerX = e, o("x", a.right ? "positive" : "negative", e)), (s.up || s.down) && (n.lastScrollContainerY = e, o("y", s.down ? "positive" : "negative", e));
|
|
1118
|
+
};
|
|
1119
|
+
if (n.lastScrollContainerX && Mt(n.lastScrollContainerX, r, i) && s(n.lastScrollContainerX), !a && n.lastScrollContainerY && Mt(n.lastScrollContainerY, r, i) && s(n.lastScrollContainerY), !a) {
|
|
1120
|
+
let e = document.elementFromPoint(r, i);
|
|
1121
|
+
for (; e && !(a && n.lastScrollContainerX && n.lastScrollContainerY);) e instanceof HTMLElement && s(e), e = e.parentElement;
|
|
1122
|
+
}
|
|
1123
|
+
if (!a) {
|
|
1124
|
+
let e = document.scrollingElement;
|
|
1125
|
+
e instanceof HTMLElement && s(e);
|
|
1126
|
+
}
|
|
1127
|
+
a || _t(n);
|
|
1128
|
+
}
|
|
1129
|
+
function Nt(e) {
|
|
1130
|
+
let t = document.elementFromPoint(e.x, e.y);
|
|
1131
|
+
if (!Q(t)) return;
|
|
1132
|
+
let n, r = !0;
|
|
1133
|
+
for (; t && r;) {
|
|
1134
|
+
if (F.has(t) || P.has(t)) {
|
|
1135
|
+
r = !1, n = P.has(t);
|
|
1136
|
+
break;
|
|
1137
|
+
}
|
|
1138
|
+
t = t.parentNode;
|
|
1139
|
+
}
|
|
1140
|
+
if (n) {
|
|
1141
|
+
let e = P.get(t);
|
|
1142
|
+
return e ? { parent: {
|
|
1143
|
+
el: t,
|
|
1144
|
+
data: e
|
|
1145
|
+
} } : void 0;
|
|
1146
|
+
} else {
|
|
1147
|
+
let e = F.get(t);
|
|
1148
|
+
if (!e) return;
|
|
1149
|
+
let n = P.get(t.parentNode);
|
|
1150
|
+
return n ? {
|
|
1151
|
+
node: {
|
|
1152
|
+
el: t,
|
|
1153
|
+
data: e
|
|
1154
|
+
},
|
|
1155
|
+
parent: {
|
|
1156
|
+
el: t.parentNode,
|
|
1157
|
+
data: n
|
|
1158
|
+
}
|
|
1159
|
+
} : void 0;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
function Q(e) {
|
|
1163
|
+
return e instanceof HTMLElement && e.parentNode instanceof HTMLElement;
|
|
1164
|
+
}
|
|
1165
|
+
function $(e, t) {
|
|
1166
|
+
let n = new AbortController();
|
|
1167
|
+
for (let r in t) {
|
|
1168
|
+
let i = t[r];
|
|
1169
|
+
e.addEventListener(r, i, {
|
|
1170
|
+
signal: n.signal,
|
|
1171
|
+
passive: !1,
|
|
1172
|
+
capture: r === "focus" || r === "blur"
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
return n;
|
|
1176
|
+
}
|
|
1177
|
+
//#endregion
|
|
1178
|
+
//#region node_modules/.pnpm/@formkit+drag-and-drop@0.5.3/node_modules/@formkit/drag-and-drop/vue/index.mjs
|
|
1179
|
+
function Pt(e) {
|
|
1180
|
+
if (e instanceof HTMLElement) return e;
|
|
1181
|
+
if (e.value instanceof HTMLElement) return e.value;
|
|
1182
|
+
if ("$el" in e && e.$el instanceof HTMLElement) return e.$el;
|
|
1183
|
+
}
|
|
1184
|
+
function Ft(e, t) {
|
|
1185
|
+
Array.isArray(e) || (e = [e]);
|
|
1186
|
+
for (let n of e) {
|
|
1187
|
+
let e = Pt(n);
|
|
1188
|
+
if (e) return t(e);
|
|
1189
|
+
let r = ae(n, (e) => {
|
|
1190
|
+
if (!e) return;
|
|
1191
|
+
let n = Pt(e);
|
|
1192
|
+
n ? t(n) : console.warn("Invalid parent element", e), r();
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
var It = /* @__PURE__ */ new WeakMap();
|
|
1197
|
+
function Lt(e) {
|
|
1198
|
+
let t = It.get(e);
|
|
1199
|
+
return t ? "value" in t ? t.value : t : (console.warn("No values found for parent element"), []);
|
|
1200
|
+
}
|
|
1201
|
+
function Rt(e, t) {
|
|
1202
|
+
let n = It.get(t);
|
|
1203
|
+
n && "value" in n && (n.value = e);
|
|
1204
|
+
}
|
|
1205
|
+
function zt(e) {
|
|
1206
|
+
Te && (Array.isArray(e) || (e = [e]), e.forEach((e) => {
|
|
1207
|
+
let { parent: t, values: n, ...r } = e;
|
|
1208
|
+
Ft(t, Vt(r, n));
|
|
1209
|
+
}));
|
|
1210
|
+
}
|
|
1211
|
+
function Bt(e, t = {}) {
|
|
1212
|
+
let n = x(), r = x(e);
|
|
1213
|
+
function i(e = {}) {
|
|
1214
|
+
zt({
|
|
1215
|
+
parent: n,
|
|
1216
|
+
values: r,
|
|
1217
|
+
...e
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
return zt({
|
|
1221
|
+
parent: n,
|
|
1222
|
+
values: r,
|
|
1223
|
+
...t
|
|
1224
|
+
}), ne(() => n.value && Ue(n.value)), [
|
|
1225
|
+
n,
|
|
1226
|
+
r,
|
|
1227
|
+
i
|
|
1228
|
+
];
|
|
1229
|
+
}
|
|
1230
|
+
function Vt(e, t) {
|
|
1231
|
+
return (n) => {
|
|
1232
|
+
It.set(n, t), Le({
|
|
1233
|
+
parent: n,
|
|
1234
|
+
getValues: Lt,
|
|
1235
|
+
setValues: Rt,
|
|
1236
|
+
config: { ...e }
|
|
1237
|
+
});
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
//#endregion
|
|
1241
|
+
//#region src/components/sidebar-right/edits/common/EditorCollapse.vue?vue&type=script&setup=true&lang.ts
|
|
1242
|
+
var Ht = { class: "text-xs font-semibold text-foreground" }, Ut = /* @__PURE__ */ i(/* @__PURE__ */ _({
|
|
1243
|
+
__name: "EditorCollapse",
|
|
1244
|
+
props: {
|
|
1245
|
+
title: {},
|
|
1246
|
+
name: {},
|
|
1247
|
+
defaultExpanded: {
|
|
1248
|
+
type: Boolean,
|
|
1249
|
+
default: !1
|
|
1250
|
+
}
|
|
1251
|
+
},
|
|
1252
|
+
setup(e) {
|
|
1253
|
+
let t = e;
|
|
1254
|
+
return (e, n) => (b(), d(w(ce), {
|
|
1255
|
+
class: "editor-collapse mt-4 pt-3 border-t border-border/50",
|
|
1256
|
+
"default-expanded-names": t.defaultExpanded ? [t.name] : []
|
|
1257
|
+
}, {
|
|
1258
|
+
default: T(() => [h(w(le), { name: t.name }, {
|
|
1259
|
+
header: T(() => [p("span", Ht, C(t.title), 1)]),
|
|
1260
|
+
arrow: T(() => [...n[0] ||= [p("span", null, null, -1)]]),
|
|
1261
|
+
"header-extra": T(({ collapsed: e }) => [p("span", { class: ee([e ? "i-lucide-chevron-right" : "i-lucide-chevron-down", "h-3.5 w-3.5 text-muted-foreground"]) }, null, 2)]),
|
|
1262
|
+
default: T(() => [re(e.$slots, "default", {}, void 0, !0)]),
|
|
1263
|
+
_: 3
|
|
1264
|
+
}, 8, ["name"])]),
|
|
1265
|
+
_: 3
|
|
1266
|
+
}, 8, ["default-expanded-names"]));
|
|
1267
|
+
}
|
|
1268
|
+
}), [["__scopeId", "data-v-2f585b5a"]]);
|
|
1269
|
+
//#endregion
|
|
1270
|
+
//#region src/components/ui/containers/data-table/column-factory.ts
|
|
1271
|
+
function Wt(e) {
|
|
1272
|
+
return O().filter((e) => e.category === "field").map((t) => ({
|
|
1273
|
+
type: t.type,
|
|
1274
|
+
label: t.tooltipKey ? e(t.tooltipKey) : t.type,
|
|
1275
|
+
icon: t.icon
|
|
1276
|
+
}));
|
|
1277
|
+
}
|
|
1278
|
+
function Gt(e, t) {
|
|
1279
|
+
let n = new Set(t);
|
|
1280
|
+
if (!n.has(e)) return e;
|
|
1281
|
+
let r = 1;
|
|
1282
|
+
for (; n.has(`${e}_${r}`);) r++;
|
|
1283
|
+
return `${e}_${r}`;
|
|
1284
|
+
}
|
|
1285
|
+
function Kt(e, t, r) {
|
|
1286
|
+
let i = D(e), a = i?.tooltipKey ? t(i.tooltipKey) : e, o = Gt(e, r), s = n(e);
|
|
1287
|
+
return {
|
|
1288
|
+
key: o,
|
|
1289
|
+
title: a,
|
|
1290
|
+
render: e,
|
|
1291
|
+
element: s ? {
|
|
1292
|
+
...s.defaults(),
|
|
1293
|
+
name: o,
|
|
1294
|
+
label: a
|
|
1295
|
+
} : void 0
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
function qt(e, t, n) {
|
|
1299
|
+
let r = Gt(`${e.key}_copy`, t), i = `${e.title}${n}`, a = JSON.parse(JSON.stringify(e));
|
|
1300
|
+
return a.key = r, a.title = i, a.element &&= {
|
|
1301
|
+
...a.element,
|
|
1302
|
+
name: r,
|
|
1303
|
+
label: i
|
|
1304
|
+
}, a;
|
|
1305
|
+
}
|
|
1306
|
+
function Jt(e) {
|
|
1307
|
+
let t = e.element?.type ?? e.render;
|
|
1308
|
+
return t ? D(t)?.icon : void 0;
|
|
1309
|
+
}
|
|
1310
|
+
//#endregion
|
|
1311
|
+
//#region src/components/ui/containers/data-table/DataTableDataGridModal.vue?vue&type=script&setup=true&lang.ts
|
|
1312
|
+
var Yt = { class: "text-sm font-medium" }, Xt = { class: "text-[11px] text-muted-foreground" }, Zt = {
|
|
1313
|
+
"data-canvas-edit": "",
|
|
1314
|
+
class: "space-y-2"
|
|
1315
|
+
}, Qt = { class: "flex items-center justify-between" }, $t = {
|
|
1316
|
+
key: 1,
|
|
1317
|
+
class: "max-h-[60vh] overflow-auto rounded-md border border-border/50 thin-scrollbar"
|
|
1318
|
+
}, en = { class: "w-full border-collapse text-left text-xs" }, tn = { class: "sticky top-0 z-10 bg-muted/60" }, nn = { class: "px-2 py-1.5 align-top text-muted-foreground whitespace-nowrap" }, rn = { class: "px-2 py-1.5 align-top border-l border-border/40" }, an = { class: "flex justify-end gap-2" }, on = /* @__PURE__ */ _({
|
|
1319
|
+
__name: "DataTableDataGridModal",
|
|
1320
|
+
props: {
|
|
1321
|
+
show: { type: Boolean },
|
|
1322
|
+
columns: {},
|
|
1323
|
+
data: {},
|
|
1324
|
+
rowKey: {}
|
|
1325
|
+
},
|
|
1326
|
+
emits: ["update:show", "save"],
|
|
1327
|
+
setup(e, { emit: t }) {
|
|
1328
|
+
let n = e, i = t, { t: g } = r(), [_, v] = Bt([], {
|
|
1329
|
+
group: "edits-data-table-grid-rows",
|
|
1330
|
+
sortable: !0,
|
|
1331
|
+
nativeDrag: !0,
|
|
1332
|
+
draggable: () => !0,
|
|
1333
|
+
dragHandle: "[data-drag-handle]",
|
|
1334
|
+
handleNodePointerup(e) {
|
|
1335
|
+
e.targetData.node.el.setAttribute("draggable", "true");
|
|
1336
|
+
}
|
|
1337
|
+
}), y = 0, ne = 0;
|
|
1338
|
+
function re() {
|
|
1339
|
+
return `r${ne++}`;
|
|
1340
|
+
}
|
|
1341
|
+
function oe() {
|
|
1342
|
+
let e = {};
|
|
1343
|
+
for (let t of n.columns) {
|
|
1344
|
+
if (!t.key) continue;
|
|
1345
|
+
let n = t.element;
|
|
1346
|
+
if (n && n.value !== void 0) {
|
|
1347
|
+
e[t.key] = n.value;
|
|
1348
|
+
continue;
|
|
1349
|
+
}
|
|
1350
|
+
let r = s(n?.type ?? t.render);
|
|
1351
|
+
r === "switch" ? e[t.key] = !1 : r === "rate" ? e[t.key] = 0 : e[t.key] = "";
|
|
1352
|
+
}
|
|
1353
|
+
return e;
|
|
1354
|
+
}
|
|
1355
|
+
ae(() => n.show, (e) => {
|
|
1356
|
+
e && (ne = 0, v.value = JSON.parse(JSON.stringify(n.data ?? [])).map((e) => ({
|
|
1357
|
+
...e,
|
|
1358
|
+
__gridRowId: re()
|
|
1359
|
+
})), y = 0);
|
|
1360
|
+
}, { immediate: !0 });
|
|
1361
|
+
let se = u(() => Math.max(640, n.columns.length * 180 + 120));
|
|
1362
|
+
function ce() {
|
|
1363
|
+
v.value = [...v.value, {
|
|
1364
|
+
...oe(),
|
|
1365
|
+
__gridRowId: re()
|
|
1366
|
+
}];
|
|
1367
|
+
}
|
|
1368
|
+
function le(e) {
|
|
1369
|
+
v.value = v.value.filter((t, n) => n !== e);
|
|
1370
|
+
}
|
|
1371
|
+
function de(e, t, n) {
|
|
1372
|
+
v.value = v.value.map((r, i) => i === e ? {
|
|
1373
|
+
...r,
|
|
1374
|
+
[t]: n
|
|
1375
|
+
} : r);
|
|
1376
|
+
}
|
|
1377
|
+
function pe(e, t) {
|
|
1378
|
+
return o(t.element, e);
|
|
1379
|
+
}
|
|
1380
|
+
function D(e, t) {
|
|
1381
|
+
return a(t.element, e, e[t.key]);
|
|
1382
|
+
}
|
|
1383
|
+
function O() {
|
|
1384
|
+
i("update:show", !1);
|
|
1385
|
+
}
|
|
1386
|
+
let k = x(null);
|
|
1387
|
+
function he() {
|
|
1388
|
+
k.value?.node?.submit?.();
|
|
1389
|
+
}
|
|
1390
|
+
function ge() {
|
|
1391
|
+
let e = n.rowKey;
|
|
1392
|
+
i("save", v.value.map((t) => {
|
|
1393
|
+
let r = { ...ie(t) };
|
|
1394
|
+
delete r.__gridRowId;
|
|
1395
|
+
for (let e of n.columns) {
|
|
1396
|
+
if (!e.key) continue;
|
|
1397
|
+
let t = D(r, e);
|
|
1398
|
+
t.derived && (r[e.key] = t.value);
|
|
1399
|
+
}
|
|
1400
|
+
return e && !r[e] && (r[e] = `local_${Date.now()}_${y++}`), r;
|
|
1401
|
+
})), i("update:show", !1);
|
|
1402
|
+
}
|
|
1403
|
+
return (e, t) => (b(), d(w(fe), {
|
|
1404
|
+
show: n.show,
|
|
1405
|
+
preset: "card",
|
|
1406
|
+
style: te({
|
|
1407
|
+
width: `${se.value}px`,
|
|
1408
|
+
maxWidth: "90vw"
|
|
1409
|
+
}),
|
|
1410
|
+
"onUpdate:show": t[0] ||= (e) => i("update:show", e)
|
|
1411
|
+
}, {
|
|
1412
|
+
header: T(() => [p("span", Yt, C(w(g)("builder.dataTableGrid.title")), 1)]),
|
|
1413
|
+
"header-extra": T(() => [p("span", Xt, C(w(g)("builder.dataTableGrid.rowsCount", { count: w(v).length })), 1)]),
|
|
1414
|
+
footer: T(() => [p("div", an, [h(w(E), {
|
|
1415
|
+
size: "small",
|
|
1416
|
+
"data-testid": "dt-grid-cancel",
|
|
1417
|
+
onClick: O
|
|
1418
|
+
}, {
|
|
1419
|
+
default: T(() => [m(C(w(g)("common.cancel")), 1)]),
|
|
1420
|
+
_: 1
|
|
1421
|
+
}), h(w(E), {
|
|
1422
|
+
size: "small",
|
|
1423
|
+
type: "primary",
|
|
1424
|
+
"data-testid": "dt-grid-save",
|
|
1425
|
+
onClick: he
|
|
1426
|
+
}, {
|
|
1427
|
+
default: T(() => [m(C(w(g)("common.save")), 1)]),
|
|
1428
|
+
_: 1
|
|
1429
|
+
})])]),
|
|
1430
|
+
default: T(() => [h(w(me), {
|
|
1431
|
+
ref_key: "gridFormRef",
|
|
1432
|
+
ref: k,
|
|
1433
|
+
type: "form",
|
|
1434
|
+
ignore: !0,
|
|
1435
|
+
actions: !1,
|
|
1436
|
+
"incomplete-message": !1,
|
|
1437
|
+
onSubmit: ge
|
|
1438
|
+
}, {
|
|
1439
|
+
default: T(() => [p("div", Zt, [p("div", Qt, [h(w(E), {
|
|
1440
|
+
size: "small",
|
|
1441
|
+
"data-testid": "dt-grid-add-row",
|
|
1442
|
+
onClick: ce
|
|
1443
|
+
}, {
|
|
1444
|
+
icon: T(() => [...t[1] ||= [p("span", { class: "i-lucide-plus h-3.5 w-3.5" }, null, -1)]]),
|
|
1445
|
+
default: T(() => [m(" " + C(w(g)("builder.dataTableGrid.addRow")), 1)]),
|
|
1446
|
+
_: 1
|
|
1447
|
+
})]), w(v).length ? (b(), f("div", $t, [p("table", en, [p("thead", tn, [p("tr", null, [
|
|
1448
|
+
t[2] ||= p("th", { class: "w-12 px-2 py-1.5 font-medium text-muted-foreground" }, "#", -1),
|
|
1449
|
+
(b(!0), f(l, null, S(n.columns, (e) => (b(), f("th", {
|
|
1450
|
+
key: e.key,
|
|
1451
|
+
class: "min-w-[160px] px-2 py-1.5 font-medium text-foreground whitespace-nowrap border-l border-border/50"
|
|
1452
|
+
}, C(e.title), 1))), 128)),
|
|
1453
|
+
t[3] ||= p("th", { class: "w-10 px-2 py-1.5 border-l border-border/50" }, null, -1)
|
|
1454
|
+
])]), p("tbody", {
|
|
1455
|
+
ref_key: "listRef",
|
|
1456
|
+
ref: _
|
|
1457
|
+
}, [(b(!0), f(l, null, S(w(v), (e, r) => (b(), f("tr", {
|
|
1458
|
+
key: r,
|
|
1459
|
+
class: "border-t border-border/40"
|
|
1460
|
+
}, [h(w(me), {
|
|
1461
|
+
type: "group",
|
|
1462
|
+
name: `row_${e.__gridRowId}`
|
|
1463
|
+
}, {
|
|
1464
|
+
default: T(() => [
|
|
1465
|
+
p("td", nn, [t[4] ||= p("span", {
|
|
1466
|
+
"data-drag-handle": "",
|
|
1467
|
+
class: "i-lucide-grip-vertical mr-1 inline-block h-3.5 w-3.5 cursor-grab align-middle active:cursor-grabbing"
|
|
1468
|
+
}, null, -1), m(" " + C(r + 1), 1)]),
|
|
1469
|
+
(b(!0), f(l, null, S(n.columns, (t) => (b(), f("td", {
|
|
1470
|
+
key: t.key,
|
|
1471
|
+
class: ee(["px-2 py-1.5 align-top border-l border-border/40", { "opacity-40 pointer-events-none": !pe(e, t) }])
|
|
1472
|
+
}, [h(c, {
|
|
1473
|
+
column: t,
|
|
1474
|
+
value: D(e, t).value,
|
|
1475
|
+
disabled: D(e, t).derived,
|
|
1476
|
+
validate: pe(e, t),
|
|
1477
|
+
row: e,
|
|
1478
|
+
"onUpdate:value": (e) => de(r, t.key, e)
|
|
1479
|
+
}, null, 8, [
|
|
1480
|
+
"column",
|
|
1481
|
+
"value",
|
|
1482
|
+
"disabled",
|
|
1483
|
+
"validate",
|
|
1484
|
+
"row",
|
|
1485
|
+
"onUpdate:value"
|
|
1486
|
+
])], 2))), 128)),
|
|
1487
|
+
p("td", rn, [h(w(E), {
|
|
1488
|
+
text: "",
|
|
1489
|
+
size: "tiny",
|
|
1490
|
+
type: "error",
|
|
1491
|
+
"data-testid": "dt-grid-delete-row",
|
|
1492
|
+
"aria-label": w(g)("builder.dataTableGrid.deleteRow"),
|
|
1493
|
+
onClick: (e) => le(r)
|
|
1494
|
+
}, {
|
|
1495
|
+
icon: T(() => [...t[5] ||= [p("span", { class: "i-lucide-trash-2 h-3.5 w-3.5" }, null, -1)]]),
|
|
1496
|
+
_: 1
|
|
1497
|
+
}, 8, ["aria-label", "onClick"])])
|
|
1498
|
+
]),
|
|
1499
|
+
_: 2
|
|
1500
|
+
}, 1032, ["name"])]))), 128))], 512)])])) : (b(), d(w(ue), {
|
|
1501
|
+
key: 0,
|
|
1502
|
+
class: "py-8",
|
|
1503
|
+
description: w(g)("builder.dataTableGrid.empty")
|
|
1504
|
+
}, {
|
|
1505
|
+
extra: T(() => [h(w(E), {
|
|
1506
|
+
size: "small",
|
|
1507
|
+
"data-testid": "dt-grid-add-row-empty",
|
|
1508
|
+
onClick: ce
|
|
1509
|
+
}, {
|
|
1510
|
+
default: T(() => [m(C(w(g)("builder.dataTableGrid.addRow")), 1)]),
|
|
1511
|
+
_: 1
|
|
1512
|
+
})]),
|
|
1513
|
+
_: 1
|
|
1514
|
+
}, 8, ["description"]))])]),
|
|
1515
|
+
_: 1
|
|
1516
|
+
}, 512)]),
|
|
1517
|
+
_: 1
|
|
1518
|
+
}, 8, ["show", "style"]));
|
|
1519
|
+
}
|
|
1520
|
+
}), sn = {
|
|
1521
|
+
class: "w-[320px] space-y-2",
|
|
1522
|
+
"data-canvas-edit": ""
|
|
1523
|
+
}, cn = {
|
|
1524
|
+
key: 0,
|
|
1525
|
+
class: "grid grid-cols-3 gap-1.5"
|
|
1526
|
+
}, ln = ["data-field-type", "onClick"], un = { class: "w-full truncate text-center" }, dn = /* @__PURE__ */ _({
|
|
1527
|
+
__name: "DataTableFieldPicker",
|
|
1528
|
+
emits: ["pick"],
|
|
1529
|
+
setup(e, { emit: t }) {
|
|
1530
|
+
let n = t, { t: i } = r(), a = x(""), o = x(null), s = u(() => Wt(i)), c = u(() => {
|
|
1531
|
+
let e = a.value.trim().toLowerCase();
|
|
1532
|
+
return e ? s.value.filter((t) => t.label.toLowerCase().includes(e) || t.type.toLowerCase().includes(e)) : s.value;
|
|
1533
|
+
});
|
|
1534
|
+
function m(e) {
|
|
1535
|
+
n("pick", e), a.value = "";
|
|
1536
|
+
}
|
|
1537
|
+
function g() {
|
|
1538
|
+
let e = c.value[0];
|
|
1539
|
+
e && m(e.type);
|
|
1540
|
+
}
|
|
1541
|
+
return y(() => v(() => o.value?.focus())), (e, t) => (b(), f("div", sn, [h(w(de), {
|
|
1542
|
+
ref_key: "inputRef",
|
|
1543
|
+
ref: o,
|
|
1544
|
+
value: a.value,
|
|
1545
|
+
"onUpdate:value": t[0] ||= (e) => a.value = e,
|
|
1546
|
+
size: "small",
|
|
1547
|
+
clearable: "",
|
|
1548
|
+
placeholder: w(i)("builder.dataTableFieldPicker.search"),
|
|
1549
|
+
onKeydown: oe(se(g, ["prevent"]), ["enter"])
|
|
1550
|
+
}, {
|
|
1551
|
+
prefix: T(() => [...t[1] ||= [p("span", { class: "i-lucide-search h-3.5 w-3.5 text-muted-foreground" }, null, -1)]]),
|
|
1552
|
+
_: 1
|
|
1553
|
+
}, 8, [
|
|
1554
|
+
"value",
|
|
1555
|
+
"placeholder",
|
|
1556
|
+
"onKeydown"
|
|
1557
|
+
]), h(w(pe), {
|
|
1558
|
+
class: "max-h-[280px]",
|
|
1559
|
+
"content-class": "pr-1"
|
|
1560
|
+
}, {
|
|
1561
|
+
default: T(() => [c.value.length ? (b(), f("div", cn, [(b(!0), f(l, null, S(c.value, (e) => (b(), f("button", {
|
|
1562
|
+
key: e.type,
|
|
1563
|
+
type: "button",
|
|
1564
|
+
class: "flex flex-col items-center gap-1 rounded-md border border-transparent bg-transparent cursor-pointer px-1 py-2 text-[11px] text-foreground transition-colors hover:border-[#7c9ef8] hover:bg-[#f0f4ff] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#a277ff] dark:hover:bg-[rgba(100,130,255,0.07)]",
|
|
1565
|
+
"data-field-type": e.type,
|
|
1566
|
+
onClick: (t) => m(e.type)
|
|
1567
|
+
}, [p("span", { class: ee(`${e.icon} h-4 w-4 text-muted-foreground`) }, null, 2), p("span", un, C(e.label), 1)], 8, ln))), 128))])) : (b(), d(w(ue), {
|
|
1568
|
+
key: 1,
|
|
1569
|
+
class: "py-6",
|
|
1570
|
+
description: w(i)("builder.dataTableFieldPicker.empty")
|
|
1571
|
+
}, null, 8, ["description"]))]),
|
|
1572
|
+
_: 1
|
|
1573
|
+
})]));
|
|
1574
|
+
}
|
|
1575
|
+
});
|
|
1576
|
+
//#endregion
|
|
1577
|
+
export { ye as C, O as S, H as _, qt as a, ge as b, Bt as c, U as d, W as f, X as g, P as h, Kt as i, $ as l, V as m, on as n, Gt as o, F as p, Jt as r, Ut as s, dn as t, Ot as u, I as v, he as w, D as x, ve as y };
|
|
1578
|
+
|
|
1579
|
+
//# sourceMappingURL=DataTableFieldPicker-qWxGmVxr.js.map
|