@windwalker-io/unicorn-next 0.1.19 → 0.1.21
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/dist/chunks/_arrayPush.js +325 -108
- package/dist/chunks/_arrayPush.js.map +1 -1
- package/dist/chunks/_baseRest.js +155 -60
- package/dist/chunks/_baseRest.js.map +1 -1
- package/dist/chunks/_baseUnary.js +463 -0
- package/dist/chunks/_baseUnary.js.map +1 -0
- package/dist/chunks/_getPrototype.js +292 -100
- package/dist/chunks/_getPrototype.js.map +1 -1
- package/dist/chunks/alert-adapter.js +29 -0
- package/dist/chunks/alert-adapter.js.map +1 -0
- package/dist/chunks/alert.js +21 -0
- package/dist/chunks/alert.js.map +1 -0
- package/dist/chunks/arr.js +24 -0
- package/dist/chunks/arr.js.map +1 -0
- package/dist/chunks/button-radio.js +127 -145
- package/dist/chunks/button-radio.js.map +1 -1
- package/dist/chunks/checkboxes-multi-select.js +44 -43
- package/dist/chunks/checkboxes-multi-select.js.map +1 -1
- package/dist/chunks/chunk.js +24 -0
- package/dist/chunks/cloneDeep.js +679 -212
- package/dist/chunks/cloneDeep.js.map +1 -1
- package/dist/chunks/cropper.min.js +6 -5
- package/dist/chunks/cropper.min.js.map +1 -1
- package/dist/chunks/crypto.js +26 -0
- package/dist/chunks/crypto.js.map +1 -0
- package/dist/chunks/data.js +49 -0
- package/dist/chunks/data.js.map +1 -0
- package/dist/chunks/dom.js +128 -0
- package/dist/chunks/dom.js.map +1 -0
- package/dist/chunks/events.js +270 -0
- package/dist/chunks/events.js.map +1 -0
- package/dist/chunks/field-cascade-select.js +207 -250
- package/dist/chunks/field-cascade-select.js.map +1 -1
- package/dist/chunks/field-file-drag.js +175 -209
- package/dist/chunks/field-file-drag.js.map +1 -1
- package/dist/chunks/field-flatpickr.js +94 -898
- package/dist/chunks/field-flatpickr.js.map +1 -1
- package/dist/chunks/field-modal-select.js +728 -467
- package/dist/chunks/field-modal-select.js.map +1 -1
- package/dist/chunks/field-modal-tree.js +771 -766
- package/dist/chunks/field-modal-tree.js.map +1 -1
- package/dist/chunks/field-multi-uploader.js +249 -256
- package/dist/chunks/field-multi-uploader.js.map +1 -1
- package/dist/chunks/field-repeatable.js +111 -127
- package/dist/chunks/field-repeatable.js.map +1 -1
- package/dist/chunks/field-single-image-drag.js +286 -338
- package/dist/chunks/field-single-image-drag.js.map +1 -1
- package/dist/chunks/form.js +146 -159
- package/dist/chunks/form.js.map +1 -1
- package/dist/chunks/grid.js +349 -418
- package/dist/chunks/grid.js.map +1 -1
- package/dist/chunks/helper.js +39 -0
- package/dist/chunks/helper.js.map +1 -0
- package/dist/chunks/http-client.js +221 -211
- package/dist/chunks/http-client.js.map +1 -1
- package/dist/chunks/iframe-modal.js +95 -115
- package/dist/chunks/iframe-modal.js.map +1 -1
- package/dist/chunks/keep-tab.js +92 -101
- package/dist/chunks/keep-tab.js.map +1 -1
- package/dist/chunks/lang.js +250 -0
- package/dist/chunks/lang.js.map +1 -0
- package/dist/chunks/legacy.js +197 -201
- package/dist/chunks/legacy.js.map +1 -1
- package/dist/chunks/list-dependent.js +195 -228
- package/dist/chunks/list-dependent.js.map +1 -1
- package/dist/chunks/loader.js +106 -0
- package/dist/chunks/loader.js.map +1 -0
- package/dist/chunks/monthSelect.js +251 -0
- package/dist/chunks/monthSelect.js.map +1 -0
- package/dist/chunks/router.js +111 -0
- package/dist/chunks/router.js.map +1 -0
- package/dist/chunks/s3-multipart-uploader.js +183 -210
- package/dist/chunks/s3-multipart-uploader.js.map +1 -1
- package/dist/chunks/s3-uploader.js +106 -128
- package/dist/chunks/s3-uploader.js.map +1 -1
- package/dist/chunks/show-on.js +358 -205
- package/dist/chunks/show-on.js.map +1 -1
- package/dist/chunks/timing.js +10 -0
- package/dist/chunks/timing.js.map +1 -0
- package/dist/chunks/tinymce.js +153 -203
- package/dist/chunks/tinymce.js.map +1 -1
- package/dist/chunks/ui-bootstrap5.js +58 -72
- package/dist/chunks/ui-bootstrap5.js.map +1 -1
- package/dist/chunks/ui.js +320 -0
- package/dist/chunks/ui.js.map +1 -0
- package/dist/chunks/unicorn.js.map +1 -1
- package/dist/chunks/useQueue.js +111 -0
- package/dist/chunks/useQueue.js.map +1 -0
- package/dist/chunks/useStack.js +76 -0
- package/dist/chunks/useStack.js.map +1 -0
- package/dist/chunks/validation.js +761 -853
- package/dist/chunks/validation.js.map +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/multi-level-menu.css +1 -1
- package/dist/switcher.css +1 -1
- package/dist/unicorn.js +805 -130
- package/dist/unicorn.js.map +1 -1
- package/package.json +3 -3
- package/src/composable/useBsModalAlert.ts +29 -0
- package/src/composable/useHttp.ts +13 -1
- package/src/module/s3-uploader.ts +1 -1
- package/vite.config.ts +5 -1
- package/dist/chunks/_commonjsHelpers.js +0 -7
- package/dist/chunks/index.js +0 -314
- package/dist/chunks/isArguments.js +0 -146
- package/dist/chunks/unicorn.js +0 -2621
|
@@ -1,132 +1,116 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { t as mergeDeep } from "./arr.js";
|
|
2
|
+
import { o as initAlpineComponent, u as prepareAlpineDefer } from "./ui.js";
|
|
3
|
+
import { i as uid } from "./crypto.js";
|
|
4
|
+
import { t as cloneDeep } from "./cloneDeep.js";
|
|
5
|
+
import { n as useCssImport } from "./loader.js";
|
|
6
|
+
//#region src/module/field-repeatable.ts
|
|
7
|
+
var defaultOptions = {
|
|
8
|
+
id: "",
|
|
9
|
+
fieldName: "",
|
|
10
|
+
sortable: false,
|
|
11
|
+
hasKey: false,
|
|
12
|
+
singleArray: false,
|
|
13
|
+
ensureFirstRow: false,
|
|
14
|
+
max: null
|
|
11
15
|
};
|
|
12
16
|
function prepareItem(item) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
return item;
|
|
17
|
+
if (item.uid == null) item.uid = uid();
|
|
18
|
+
return item;
|
|
17
19
|
}
|
|
18
20
|
async function init() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
get canAdd() {
|
|
110
|
-
if (!this.options.max) {
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
return this.options.max > this.items.length;
|
|
114
|
-
},
|
|
115
|
-
get canModify() {
|
|
116
|
-
return this.attrs.disabled == null && this.attrs.readonly == null;
|
|
117
|
-
},
|
|
118
|
-
get fieldName() {
|
|
119
|
-
return this.options.fieldName;
|
|
120
|
-
},
|
|
121
|
-
get id() {
|
|
122
|
-
return this.options.id;
|
|
123
|
-
}
|
|
124
|
-
}));
|
|
125
|
-
});
|
|
126
|
-
await initAlpineComponent("data-repeatable");
|
|
21
|
+
await prepareAlpineDefer(async (Alpine) => {
|
|
22
|
+
useCssImport("@vue-animate");
|
|
23
|
+
Alpine.data("RepeatableField", ({ items, defaultValues, attrs }, options) => ({
|
|
24
|
+
items,
|
|
25
|
+
defaultValues,
|
|
26
|
+
attrs,
|
|
27
|
+
options: mergeDeep(defaultOptions, options),
|
|
28
|
+
init() {
|
|
29
|
+
if (this.options.sortable) import("sortablejs").then(({ default: Sortable }) => {
|
|
30
|
+
Sortable.create(this.$refs.tbody, {
|
|
31
|
+
handle: ".h-handle",
|
|
32
|
+
animation: 300,
|
|
33
|
+
onEnd: (event) => {
|
|
34
|
+
const items = Alpine.raw(this.items);
|
|
35
|
+
const droppedAtItem = items.splice(event.oldIndex, 1)[0];
|
|
36
|
+
items.splice(event.newIndex, 0, droppedAtItem);
|
|
37
|
+
this.items = items;
|
|
38
|
+
let keys = [];
|
|
39
|
+
for (let item of items) keys.push(item.uid);
|
|
40
|
+
this.$refs.steps_template._x_prevKeys = keys;
|
|
41
|
+
const elements = this.$refs.steps_template.parentElement.querySelectorAll("tr");
|
|
42
|
+
[].slice.call(elements).forEach((ele, i) => {
|
|
43
|
+
if (ele?._x_dataStack[0]?.i != null) ele._x_dataStack[0].i = i;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
this.items.forEach(prepareItem);
|
|
49
|
+
if (this.options.ensureFirstRow) this.ensureFirstRow();
|
|
50
|
+
},
|
|
51
|
+
addItem(i) {
|
|
52
|
+
const item = prepareItem(this.getEmptyItem());
|
|
53
|
+
this.items.splice(i + 1, 0, item);
|
|
54
|
+
},
|
|
55
|
+
delItem(i) {
|
|
56
|
+
const el = this.getItemElementByUID(this.items[i].uid);
|
|
57
|
+
let hasAnimate = false;
|
|
58
|
+
el?.addEventListener("animationstart", () => {
|
|
59
|
+
hasAnimate = true;
|
|
60
|
+
}, { once: true });
|
|
61
|
+
el?.classList.add("animate__fadeOut");
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
if (!hasAnimate) this._removeItem(i);
|
|
64
|
+
}, 100);
|
|
65
|
+
el?.addEventListener("animationend", () => {
|
|
66
|
+
this._removeItem(i);
|
|
67
|
+
}, { once: true });
|
|
68
|
+
},
|
|
69
|
+
_removeItem(i) {
|
|
70
|
+
this.items.splice(i, 1);
|
|
71
|
+
if (this.options.ensureFirstRow) this.ensureFirstRow();
|
|
72
|
+
},
|
|
73
|
+
ensureFirstRow() {
|
|
74
|
+
if (this.items.length === 0) this.items.push(prepareItem(this.getEmptyItem()));
|
|
75
|
+
},
|
|
76
|
+
getItemElementByUID(uid) {
|
|
77
|
+
return this.$root.querySelector(`[data-item="${uid}"]`);
|
|
78
|
+
},
|
|
79
|
+
getId(i, item, field) {
|
|
80
|
+
return `${this.id}-${item.uid}-${field}`;
|
|
81
|
+
},
|
|
82
|
+
getName(i, item, field) {
|
|
83
|
+
if (this.options.singleArray) {
|
|
84
|
+
if (this.options.hasKey) {
|
|
85
|
+
if (field === "key") return "";
|
|
86
|
+
return `${this.fieldName}[${item.key}]`;
|
|
87
|
+
}
|
|
88
|
+
return `${this.fieldName}[]`;
|
|
89
|
+
}
|
|
90
|
+
return `${this.fieldName}[${i}][${field}]`;
|
|
91
|
+
},
|
|
92
|
+
getEmptyItem() {
|
|
93
|
+
return cloneDeep(this.defaultValues);
|
|
94
|
+
},
|
|
95
|
+
get canAdd() {
|
|
96
|
+
if (!this.options.max) return true;
|
|
97
|
+
return this.options.max > this.items.length;
|
|
98
|
+
},
|
|
99
|
+
get canModify() {
|
|
100
|
+
return this.attrs.disabled == null && this.attrs.readonly == null;
|
|
101
|
+
},
|
|
102
|
+
get fieldName() {
|
|
103
|
+
return this.options.fieldName;
|
|
104
|
+
},
|
|
105
|
+
get id() {
|
|
106
|
+
return this.options.id;
|
|
107
|
+
}
|
|
108
|
+
}));
|
|
109
|
+
});
|
|
110
|
+
await initAlpineComponent("data-repeatable");
|
|
127
111
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
//# sourceMappingURL=field-repeatable.js.map
|
|
112
|
+
var ready = /* @__PURE__ */ init();
|
|
113
|
+
//#endregion
|
|
114
|
+
export { ready };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=field-repeatable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-repeatable.js","sources":["../../src/module/field-repeatable.ts"],"sourcesContent":["import { cloneDeep } from 'lodash-es';\nimport { initAlpineComponent, prepareAlpineDefer, uid, useCssImport } from '../service';\nimport { mergeDeep } from '../utilities';\n\nexport interface RepeatableOptions {\n id?: string;\n fieldName?: string;\n sortable?: boolean;\n hasKey?: boolean;\n singleArray?: boolean;\n ensureFirstRow?: boolean;\n max?: number | null;\n}\n\nconst defaultOptions: RepeatableOptions = {\n id: '',\n fieldName: '',\n sortable: false,\n hasKey: false,\n singleArray: false,\n ensureFirstRow: false,\n max: null,\n};\n\nfunction prepareItem(item: any) {\n if (item.uid == null) {\n item.uid = uid();\n }\n return item;\n}\n\ntype RepeatableParams = {\n items: Record<string, any>[];\n defaultValues: any;\n attrs: Record<string, any>;\n};\n\nasync function init() {\n await prepareAlpineDefer(async (Alpine) => {\n useCssImport('@vue-animate');\n\n Alpine.data('RepeatableField', ({ items, defaultValues, attrs }: RepeatableParams, options: RepeatableOptions) => ({\n items,\n defaultValues,\n attrs,\n options: mergeDeep<RepeatableOptions>(defaultOptions, options),\n init() {\n // this.items = this.items.filter((item) => item !== '__EMPTY_ARRAY__');\n\n if (this.options.sortable) {\n // @see https://github.com/alpinejs/alpine/discussions/1635\n import('sortablejs').then(({ default: Sortable }) => {\n Sortable.create(this.$refs.tbody, {\n handle: '.h-handle',\n animation: 300,\n onEnd: (event: any) => {\n // V3 helper to unwrap the proxy\n const items = Alpine.raw(this.items);\n\n // splice mutates the original object, which\n // you want to avoid. In this case it works because we\n // created a temporary object that we can control\n // That way we know there are no side effects\n const droppedAtItem = items.splice(event.oldIndex, 1)[0];\n items.splice(event.newIndex, 0, droppedAtItem);\n //\n // // Alpine will update when you modify the state,\n // // so we need to set it back to our new state\n this.items = items;\n\n // HACK update prevKeys to new sort order\n let keys = [];\n for (let item of items) {\n keys.push(item.uid);\n }\n\n // HACK update index of dataStack\n // @ts-ignore\n this.$refs.steps_template._x_prevKeys = keys;\n // @ts-ignore\n const elements = this.$refs.steps_template\n .parentElement\n .querySelectorAll('tr');\n\n [].slice.call(elements).forEach((ele, i) => {\n // @ts-ignore\n if (ele?._x_dataStack[0]?.i != null) {\n // @ts-ignore\n ele._x_dataStack[0].i = i;\n }\n });\n }\n });\n });\n }\n\n this.items.forEach(prepareItem);\n\n if (this.options.ensureFirstRow) {\n this.ensureFirstRow();\n }\n },\n\n addItem(i: number) {\n const item = prepareItem(this.getEmptyItem());\n\n this.items.splice(i + 1, 0, item);\n },\n\n delItem(i: number) {\n const el = this.getItemElementByUID(this.items[i].uid);\n let hasAnimate = false;\n\n el?.addEventListener('animationstart', () => {\n hasAnimate = true;\n }, { once: true });\n\n el?.classList.add('animate__fadeOut');\n\n setTimeout(() => {\n if (!hasAnimate) {\n this._removeItem(i);\n }\n }, 100);\n\n el?.addEventListener('animationend', () => {\n this._removeItem(i);\n }, { once: true });\n },\n\n _removeItem(i: number) {\n this.items.splice(i, 1);\n\n if (this.options.ensureFirstRow) {\n this.ensureFirstRow();\n }\n },\n\n ensureFirstRow() {\n if (this.items.length === 0) {\n this.items.push(prepareItem(this.getEmptyItem()));\n }\n },\n\n getItemElementByUID(uid: string) {\n return this.$root.querySelector(`[data-item=\"${uid}\"]`);\n },\n\n getId(i: number, item: any, field: string) {\n return `${this.id}-${item.uid}-${field}`;\n },\n\n getName(i: number, item: any, field: string) {\n if (this.options.singleArray) {\n if (this.options.hasKey) {\n if (field === 'key') {\n return '';\n }\n\n return `${this.fieldName}[${item.key}]`;\n }\n\n return `${this.fieldName}[]`;\n }\n\n return `${this.fieldName}[${i}][${field}]`;\n },\n\n getEmptyItem() {\n return cloneDeep(this.defaultValues);\n },\n\n get canAdd() {\n if (!this.options.max) {\n return true;\n }\n\n return this.options.max > this.items.length;\n },\n\n get canModify() {\n return this.attrs.disabled == null && this.attrs.readonly == null;\n },\n\n get fieldName() {\n return this.options.fieldName;\n },\n\n get id() {\n return this.options.id;\n }\n }));\n });\n\n await initAlpineComponent('data-repeatable');\n}\n\nexport const ready = init();\n\nexport interface RepeatableModule {\n ready: typeof ready;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"field-repeatable.js","names":[],"sources":["../../src/module/field-repeatable.ts"],"sourcesContent":["import { cloneDeep } from 'lodash-es';\nimport { initAlpineComponent, prepareAlpineDefer, uid, useCssImport } from '../service';\nimport { mergeDeep } from '../utilities';\n\nexport interface RepeatableOptions {\n id?: string;\n fieldName?: string;\n sortable?: boolean;\n hasKey?: boolean;\n singleArray?: boolean;\n ensureFirstRow?: boolean;\n max?: number | null;\n}\n\nconst defaultOptions: RepeatableOptions = {\n id: '',\n fieldName: '',\n sortable: false,\n hasKey: false,\n singleArray: false,\n ensureFirstRow: false,\n max: null,\n};\n\nfunction prepareItem(item: any) {\n if (item.uid == null) {\n item.uid = uid();\n }\n return item;\n}\n\ntype RepeatableParams = {\n items: Record<string, any>[];\n defaultValues: any;\n attrs: Record<string, any>;\n};\n\nasync function init() {\n await prepareAlpineDefer(async (Alpine) => {\n useCssImport('@vue-animate');\n\n Alpine.data('RepeatableField', ({ items, defaultValues, attrs }: RepeatableParams, options: RepeatableOptions) => ({\n items,\n defaultValues,\n attrs,\n options: mergeDeep<RepeatableOptions>(defaultOptions, options),\n init() {\n // this.items = this.items.filter((item) => item !== '__EMPTY_ARRAY__');\n\n if (this.options.sortable) {\n // @see https://github.com/alpinejs/alpine/discussions/1635\n import('sortablejs').then(({ default: Sortable }) => {\n Sortable.create(this.$refs.tbody, {\n handle: '.h-handle',\n animation: 300,\n onEnd: (event: any) => {\n // V3 helper to unwrap the proxy\n const items = Alpine.raw(this.items);\n\n // splice mutates the original object, which\n // you want to avoid. In this case it works because we\n // created a temporary object that we can control\n // That way we know there are no side effects\n const droppedAtItem = items.splice(event.oldIndex, 1)[0];\n items.splice(event.newIndex, 0, droppedAtItem);\n //\n // // Alpine will update when you modify the state,\n // // so we need to set it back to our new state\n this.items = items;\n\n // HACK update prevKeys to new sort order\n let keys = [];\n for (let item of items) {\n keys.push(item.uid);\n }\n\n // HACK update index of dataStack\n // @ts-ignore\n this.$refs.steps_template._x_prevKeys = keys;\n // @ts-ignore\n const elements = this.$refs.steps_template\n .parentElement\n .querySelectorAll('tr');\n\n [].slice.call(elements).forEach((ele, i) => {\n // @ts-ignore\n if (ele?._x_dataStack[0]?.i != null) {\n // @ts-ignore\n ele._x_dataStack[0].i = i;\n }\n });\n }\n });\n });\n }\n\n this.items.forEach(prepareItem);\n\n if (this.options.ensureFirstRow) {\n this.ensureFirstRow();\n }\n },\n\n addItem(i: number) {\n const item = prepareItem(this.getEmptyItem());\n\n this.items.splice(i + 1, 0, item);\n },\n\n delItem(i: number) {\n const el = this.getItemElementByUID(this.items[i].uid);\n let hasAnimate = false;\n\n el?.addEventListener('animationstart', () => {\n hasAnimate = true;\n }, { once: true });\n\n el?.classList.add('animate__fadeOut');\n\n setTimeout(() => {\n if (!hasAnimate) {\n this._removeItem(i);\n }\n }, 100);\n\n el?.addEventListener('animationend', () => {\n this._removeItem(i);\n }, { once: true });\n },\n\n _removeItem(i: number) {\n this.items.splice(i, 1);\n\n if (this.options.ensureFirstRow) {\n this.ensureFirstRow();\n }\n },\n\n ensureFirstRow() {\n if (this.items.length === 0) {\n this.items.push(prepareItem(this.getEmptyItem()));\n }\n },\n\n getItemElementByUID(uid: string) {\n return this.$root.querySelector(`[data-item=\"${uid}\"]`);\n },\n\n getId(i: number, item: any, field: string) {\n return `${this.id}-${item.uid}-${field}`;\n },\n\n getName(i: number, item: any, field: string) {\n if (this.options.singleArray) {\n if (this.options.hasKey) {\n if (field === 'key') {\n return '';\n }\n\n return `${this.fieldName}[${item.key}]`;\n }\n\n return `${this.fieldName}[]`;\n }\n\n return `${this.fieldName}[${i}][${field}]`;\n },\n\n getEmptyItem() {\n return cloneDeep(this.defaultValues);\n },\n\n get canAdd() {\n if (!this.options.max) {\n return true;\n }\n\n return this.options.max > this.items.length;\n },\n\n get canModify() {\n return this.attrs.disabled == null && this.attrs.readonly == null;\n },\n\n get fieldName() {\n return this.options.fieldName;\n },\n\n get id() {\n return this.options.id;\n }\n }));\n });\n\n await initAlpineComponent('data-repeatable');\n}\n\nexport const ready = init();\n\nexport interface RepeatableModule {\n ready: typeof ready;\n}\n"],"mappings":";;;;;;AAcA,IAAM,iBAAoC;CACxC,IAAI;CACJ,WAAW;CACX,UAAU;CACV,QAAQ;CACR,aAAa;CACb,gBAAgB;CAChB,KAAK;CACN;AAED,SAAS,YAAY,MAAW;AAC9B,KAAI,KAAK,OAAO,KACd,MAAK,MAAM,KAAK;AAElB,QAAO;;AAST,eAAe,OAAO;AACpB,OAAM,mBAAmB,OAAO,WAAW;AACzC,eAAa,eAAe;AAE5B,SAAO,KAAK,oBAAoB,EAAE,OAAO,eAAe,SAA2B,aAAgC;GACjH;GACA;GACA;GACA,SAAS,UAA6B,gBAAgB,QAAQ;GAC9D,OAAO;AAGL,QAAI,KAAK,QAAQ,SAEf,QAAO,cAAc,MAAM,EAAE,SAAS,eAAe;AACnD,cAAS,OAAO,KAAK,MAAM,OAAO;MAChC,QAAQ;MACR,W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