@materialui-reactjs/admin 1.0.6 → 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 +322 -0
- package/LICENSE +21 -0
- package/README.md +587 -453
- package/dist/Common-DFahMuQE.cjs +11 -0
- package/dist/Common-_PK8HLKN.js +267 -0
- package/dist/Env-DoS-iQjs.cjs +1 -0
- package/dist/Env-SHztUA3s.js +16 -0
- package/dist/HeaderUpdate-Dirxjmxs.cjs +1 -0
- package/dist/{chunks/HeaderUpdate-DuS-gHNR.js → HeaderUpdate-drlnuHI8.js} +28 -25
- package/dist/SortableItem-C3KzO8Xh.cjs +1 -0
- package/dist/SpinnerLoader-BujLjvC3.cjs +1 -0
- package/dist/{chunks/SpinnerLoader-h8RDIarB.js → SpinnerLoader-CyhOQC6d.js} +2 -2
- package/dist/UDragFile-D8wOZ1Ut.js +96 -0
- package/dist/UDragFile-Db0sK4M7.cjs +1 -0
- package/dist/{chunks/Validator-CXYkI7vJ.js → Validator-D2zwZeov.js} +83 -52
- package/dist/Validator-DBxl8wtE.cjs +1 -0
- package/dist/assets/css/form.css +1 -1
- package/dist/assets/css/index.css +1 -1
- package/dist/ckeditor/ckeditor.d.ts +3 -0
- package/dist/ckeditor/plugins/elfinder.d.ts +11 -0
- package/dist/ckeditor/plugins/fullscreen.d.ts +15 -0
- package/dist/ckeditor/plugins/pdffinder.d.ts +18 -0
- package/dist/ckeditor/types.d.ts +37 -0
- package/dist/common-CEZp8xpQ.js +30 -0
- package/dist/common-ivDX6gGq.cjs +1 -0
- package/dist/components/echarts/index.cjs +1 -0
- package/dist/components/echarts/index.js +1 -1
- package/dist/components/form/AdvancedMultiSelect.d.ts +6 -3
- package/dist/components/form/AsxhUImages.d.ts +2 -1
- package/dist/components/form/BoxAddRow.d.ts +13 -2
- package/dist/components/form/CheckTreeBox.d.ts +12 -3
- package/dist/components/form/CusForm.d.ts +19 -6
- package/dist/components/form/DateInput.d.ts +2 -1
- package/dist/components/form/Editor.d.ts +2 -1
- package/dist/components/form/EfFile.d.ts +2 -1
- package/dist/components/form/EfImage.d.ts +2 -1
- package/dist/components/form/EfImages.d.ts +2 -1
- package/dist/components/form/PImage.d.ts +2 -1
- package/dist/components/form/SelectAddRowBox.d.ts +9 -5
- package/dist/components/form/SelectAddRowBoxAdvanced.d.ts +13 -4
- package/dist/components/form/SelectBox.d.ts +20 -7
- package/dist/components/form/UDragFile.d.ts +2 -1
- package/dist/components/form/UFile.d.ts +2 -1
- package/dist/components/form/UFiles.d.ts +9 -2
- package/dist/components/form/UImages.d.ts +2 -1
- package/dist/components/form/index.cjs +1 -0
- package/dist/components/form/index.js +2 -2
- package/dist/components/loader/SpinnerLoader.d.ts +5 -1
- package/dist/components/loader/index.cjs +1 -0
- package/dist/components/loader/index.js +1 -2
- package/dist/components/meta/CardTable.d.ts +11 -5
- package/dist/components/meta/CardTable.types.d.ts +57 -0
- package/dist/components/meta/CusTooltip.d.ts +8 -2
- package/dist/components/meta/Head.d.ts +10 -1
- package/dist/components/meta/HeaderDetail.d.ts +2 -1
- package/dist/components/meta/HeaderUpdate.d.ts +5 -1
- package/dist/components/meta/ModalForm.d.ts +41 -11
- package/dist/components/meta/Navtabs.d.ts +1 -1
- package/dist/components/meta/ScrollTable.d.ts +7 -3
- package/dist/components/meta/SearchBox.d.ts +8 -5
- package/dist/components/meta/SortableItem.d.ts +11 -1
- package/dist/components/meta/index.cjs +1 -0
- package/dist/components/meta/index.d.ts +1 -0
- package/dist/components/meta/index.js +3 -3
- package/dist/components/sidebar/Sidebar.types.d.ts +9 -7
- package/dist/components/sidebar/index.cjs +1 -0
- package/dist/components/sidebar/index.js +1 -1
- package/dist/components/single/Detail.d.ts +8 -3
- package/dist/components/single/Fields.d.ts +10 -4
- package/dist/components/single/Import.d.ts +8 -3
- package/dist/components/single/List.d.ts +33 -7
- package/dist/components/single/Update.d.ts +10 -4
- package/dist/components/single/UpdateDetail.d.ts +3 -2
- package/dist/components/single/UpdateTableDetail.d.ts +4 -3
- package/dist/components/single/index.cjs +1 -0
- package/dist/components/single/index.js +1 -1
- package/dist/components/top-navbar/index.cjs +1 -0
- package/dist/components/top-navbar/index.js +78 -2
- package/dist/echarts-Bi3uwLbg.cjs +1 -0
- package/dist/{chunks/echarts-CRmndsxC.js → echarts-CTzMqeR5.js} +4 -4
- package/dist/form-heyswTRq.js +3897 -0
- package/dist/form-sgtop6li.cjs +49 -0
- package/dist/hook/common.d.ts +87 -0
- package/dist/hook/detail.cjs +1 -0
- package/dist/hook/detail.d.ts +9 -15
- package/dist/hook/detail.js +1 -11
- package/dist/hook/fields.cjs +1 -0
- package/dist/hook/fields.d.ts +6 -14
- package/dist/hook/fields.js +1 -11
- package/dist/hook/import.d.ts +6 -11
- package/dist/hook/index.cjs +1 -0
- package/dist/hook/index.d.ts +29 -20
- package/dist/hook/index.js +14 -11
- package/dist/hook/update.cjs +1 -0
- package/dist/hook/update.d.ts +11 -19
- package/dist/hook/update.js +12 -9
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +14 -11
- package/dist/meta-BANk9kHW.cjs +1 -0
- package/dist/meta-CheDAmMh.js +745 -0
- package/dist/rolldown-runtime-BocRIvOZ.cjs +1 -0
- package/dist/sidebar-CfQAYWi-.cjs +1 -0
- package/dist/{chunks/sidebar-Dj4Xr9du.js → sidebar-CzRmfvhi.js} +10 -13
- package/dist/{chunks/single-CRF61o_U.js → single-BsJ7TYJi.js} +364 -282
- package/dist/single-C2WPEjhk.cjs +1 -0
- package/dist/style.cjs +0 -0
- package/dist/style.d.ts +0 -0
- package/dist/style.js +0 -0
- package/dist/types/Menu.d.ts +25 -0
- package/dist/utils/Common.d.ts +224 -43
- package/dist/utils/CusRoute.d.ts +21 -1
- package/dist/utils/Env.d.ts +23 -2
- package/dist/utils/Group.d.ts +12 -1
- package/dist/utils/Validator.d.ts +34 -12
- package/dist/utils/index.cjs +11 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +212 -171
- package/package.json +190 -163
- package/dist/chunks/Common-BURf0rBN.js +0 -222
- package/dist/chunks/Env-DRXhvUcb.js +0 -16
- package/dist/chunks/UDragFile-BnUR3riq.js +0 -92
- package/dist/chunks/form-CPkpL5eA.js +0 -45889
- package/dist/chunks/loader-BUiOnhOH.js +0 -1
- package/dist/chunks/meta-4qPWijBT.js +0 -758
- package/dist/chunks/top-navbar-Bob0gMUh.js +0 -78
- package/scripts/postinstall.cjs +0 -80
- /package/dist/{chunks/SortableItem-B4-Zsso3.js → SortableItem-B4-Zsso3.js} +0 -0
- /package/dist/{components/meta/Pdfviewer.d.ts → hook/import.cjs} +0 -0
|
@@ -0,0 +1,3897 @@
|
|
|
1
|
+
import { t as e } from "./Env-SHztUA3s.js";
|
|
2
|
+
import { _ as t, b as n, c as r, f as i, g as a, h as o, i as s, m as c, o as l, p as u, r as d, t as f, u as p, v as m } from "./Common-_PK8HLKN.js";
|
|
3
|
+
import { a as h, i as g, t as _ } from "./Validator-D2zwZeov.js";
|
|
4
|
+
import { t as v } from "./SortableItem-B4-Zsso3.js";
|
|
5
|
+
import y, { createContext as b, memo as x, useCallback as S, useContext as C, useEffect as w, useId as ee, useMemo as T, useReducer as te, useRef as E, useState as D } from "react";
|
|
6
|
+
import O, { components as k } from "react-select";
|
|
7
|
+
import { DragDropContext as ne, Draggable as re, Droppable as A } from "@hello-pangea/dnd";
|
|
8
|
+
import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
9
|
+
import { format as ie } from "date-fns";
|
|
10
|
+
import { createPortal as P, unstable_batchedUpdates as ae } from "react-dom";
|
|
11
|
+
import { add as oe, canUseDOM as F, findFirstFocusableNode as se, getEventCoordinates as ce, getOwnerDocument as I, getWindow as L, isDocument as R, isHTMLElement as le, isKeyboardEvent as ue, isNode as de, isSVGElement as z, isWindow as fe, subtract as B, useEvent as pe, useInterval as V, useIsomorphicLayoutEffect as me, useLatestValue as he, useLazyMemo as H, useNodeRef as U, usePrevious as ge, useUniqueId as _e } from "@dnd-kit/utilities";
|
|
12
|
+
import { SortableContext as ve, arrayMove as ye } from "@dnd-kit/sortable";
|
|
13
|
+
import { CKEditor as W } from "@ckeditor/ckeditor5-react";
|
|
14
|
+
import { Alignment as be, BlockQuote as xe, Bold as Se, ButtonView as Ce, ClassicEditor as we, Code as Te, CodeBlock as G, Emoji as K, Essentials as Ee, FontBackgroundColor as De, FontColor as q, FontFamily as Oe, FontSize as ke, GeneralHtmlSupport as Ae, Heading as je, Highlight as Me, HorizontalLine as Ne, HtmlEmbed as Pe, Image as Fe, ImageCaption as Ie, ImageInsertViaUrl as Le, ImageResize as Re, ImageStyle as ze, ImageToolbar as Be, Indent as Ve, IndentBlock as He, Italic as Ue, Link as We, List as Ge, MediaEmbed as Ke, Mention as qe, Paragraph as Je, Plugin as Ye, RemoveFormat as Xe, SourceEditing as Ze, SpecialCharacters as Qe, SpecialCharactersEssentials as $e, Strikethrough as et, Subscript as tt, Superscript as nt, Table as rt, TableCellProperties as it, TableProperties as at, TableToolbar as ot, TodoList as st, Underline as ct, WordCount as lt } from "ckeditor5";
|
|
15
|
+
import "ckeditor5/ckeditor5.css";
|
|
16
|
+
import { DatePicker as ut } from "@mui/x-date-pickers/DatePicker";
|
|
17
|
+
import { LocalizationProvider as dt } from "@mui/x-date-pickers/LocalizationProvider";
|
|
18
|
+
import { AdapterDateFns as ft } from "@mui/x-date-pickers/AdapterDateFns";
|
|
19
|
+
import { vi as pt } from "date-fns/locale";
|
|
20
|
+
import { DateTimePicker as mt } from "@mui/x-date-pickers/DateTimePicker";
|
|
21
|
+
import { Form as ht } from "react-router-dom";
|
|
22
|
+
//#region src/components/form/AdvancedMultiSelect.tsx
|
|
23
|
+
var gt = (e, t) => (Array.isArray(t) ? t : []).map((t) => e.find((e) => e.value === t)).filter((e) => e !== void 0), _t = (e, t, n, r, i) => {
|
|
24
|
+
let a = [];
|
|
25
|
+
r && a.push({
|
|
26
|
+
value: -1,
|
|
27
|
+
label: "Tất cả"
|
|
28
|
+
}), i && a.push({
|
|
29
|
+
value: 0,
|
|
30
|
+
label: "Không có"
|
|
31
|
+
});
|
|
32
|
+
let o = Array.isArray(e) ? e.map((e) => ({
|
|
33
|
+
value: e[t],
|
|
34
|
+
label: String(e[n] ?? "")
|
|
35
|
+
})) : [];
|
|
36
|
+
return [...a, ...o];
|
|
37
|
+
}, vt = ({ label: e, name: t, lists: n = [], keyValue: r = "id", keyName: i = "name", value: a = [], cpnClass: o = "", required: s = !1, disabled: c = !1, all: l = !1, zero: u = !1, onChange: d }) => {
|
|
38
|
+
let [f, p] = D([]);
|
|
39
|
+
w(() => {
|
|
40
|
+
p(_t(n, r, i, l, u));
|
|
41
|
+
}, [n]);
|
|
42
|
+
let m = (e) => {
|
|
43
|
+
if (!e.destination) return;
|
|
44
|
+
let n = [...gt(f, a)], [r] = n.splice(e.source.index, 1);
|
|
45
|
+
n.splice(e.destination.index, 0, r), d?.({
|
|
46
|
+
target: {
|
|
47
|
+
name: t,
|
|
48
|
+
value: n.map((e) => e?.value)
|
|
49
|
+
},
|
|
50
|
+
preventDefault: () => {}
|
|
51
|
+
});
|
|
52
|
+
}, h = (e) => {
|
|
53
|
+
d?.({
|
|
54
|
+
target: {
|
|
55
|
+
name: t,
|
|
56
|
+
value: e
|
|
57
|
+
},
|
|
58
|
+
preventDefault: () => {}
|
|
59
|
+
});
|
|
60
|
+
}, g = (e) => /* @__PURE__ */ N(k.Option, {
|
|
61
|
+
...e,
|
|
62
|
+
children: [/* @__PURE__ */ M("input", {
|
|
63
|
+
type: "checkbox",
|
|
64
|
+
checked: e.isSelected,
|
|
65
|
+
onChange: () => null,
|
|
66
|
+
style: { marginRight: 8 }
|
|
67
|
+
}), /* @__PURE__ */ M("div", { children: e.label })]
|
|
68
|
+
}), _ = (e) => /* @__PURE__ */ M(re, {
|
|
69
|
+
draggableId: String(e.data.value),
|
|
70
|
+
index: e.index,
|
|
71
|
+
children: (t) => /* @__PURE__ */ M("div", {
|
|
72
|
+
ref: t.innerRef,
|
|
73
|
+
...t.draggableProps,
|
|
74
|
+
...t.dragHandleProps,
|
|
75
|
+
style: {
|
|
76
|
+
display: "inline-flex",
|
|
77
|
+
alignItems: "center",
|
|
78
|
+
marginRight: 6,
|
|
79
|
+
...t.draggableProps.style
|
|
80
|
+
},
|
|
81
|
+
children: /* @__PURE__ */ M(k.MultiValue, { ...e })
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
return /* @__PURE__ */ N("div", {
|
|
85
|
+
className: "form-group " + (o ?? ""),
|
|
86
|
+
children: [/* @__PURE__ */ M("div", {
|
|
87
|
+
className: "form-label mb-1",
|
|
88
|
+
children: e + (s ? " *" : "")
|
|
89
|
+
}), /* @__PURE__ */ M(ne, {
|
|
90
|
+
onDragEnd: m,
|
|
91
|
+
children: /* @__PURE__ */ M(A, {
|
|
92
|
+
droppableId: "selected",
|
|
93
|
+
direction: "horizontal",
|
|
94
|
+
children: (e) => /* @__PURE__ */ N("div", {
|
|
95
|
+
ref: e.innerRef,
|
|
96
|
+
...e.droppableProps,
|
|
97
|
+
children: [/* @__PURE__ */ M(O, {
|
|
98
|
+
options: f,
|
|
99
|
+
value: gt(f, a),
|
|
100
|
+
isMulti: !0,
|
|
101
|
+
isSearchable: !0,
|
|
102
|
+
closeMenuOnSelect: !1,
|
|
103
|
+
hideSelectedOptions: !1,
|
|
104
|
+
placeholder: "Chọn và kéo thả để sắp xếp...",
|
|
105
|
+
noOptionsMessage: () => "Không có dữ liệu",
|
|
106
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
107
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
108
|
+
isDisabled: c,
|
|
109
|
+
components: {
|
|
110
|
+
Option: g,
|
|
111
|
+
MultiValue: _
|
|
112
|
+
},
|
|
113
|
+
onChange: (e) => h((e ?? []).map((e) => e.value)),
|
|
114
|
+
menuPortalTarget: document.body,
|
|
115
|
+
styles: {
|
|
116
|
+
menuPortal: (e) => ({
|
|
117
|
+
...e,
|
|
118
|
+
zIndex: 99999
|
|
119
|
+
}),
|
|
120
|
+
input: (e) => ({
|
|
121
|
+
...e,
|
|
122
|
+
minHeight: 30
|
|
123
|
+
}),
|
|
124
|
+
multiValue: (e) => ({
|
|
125
|
+
...e,
|
|
126
|
+
cursor: "grab"
|
|
127
|
+
}),
|
|
128
|
+
menuList: (e) => ({
|
|
129
|
+
...e,
|
|
130
|
+
display: "flex",
|
|
131
|
+
flexDirection: "column",
|
|
132
|
+
alignItems: "center",
|
|
133
|
+
paddingLeft: 5,
|
|
134
|
+
paddingRight: 5,
|
|
135
|
+
paddingTop: 5,
|
|
136
|
+
paddingBottom: 2
|
|
137
|
+
}),
|
|
138
|
+
option: (e, t) => ({
|
|
139
|
+
...e,
|
|
140
|
+
minHeight: 40,
|
|
141
|
+
width: "100%",
|
|
142
|
+
display: "flex",
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
paddingTop: 8,
|
|
145
|
+
paddingBottom: 8,
|
|
146
|
+
marginBottom: 5,
|
|
147
|
+
borderRadius: 6,
|
|
148
|
+
justifyContent: "flex-start",
|
|
149
|
+
backgroundColor: t.isFocused ? "#FFC20E" : t.isSelected ? "#ED7D31" : "white",
|
|
150
|
+
color: t.isFocused ? "#333" : t.isSelected ? "#fff" : "#333",
|
|
151
|
+
cursor: "pointer"
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
}), e.placeholder]
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
})]
|
|
158
|
+
});
|
|
159
|
+
}, yt = ({ label: t, name: n, cpnClass: r = "", required: i = !1, value: a = [], onChange: o, isEdit: s = !1, ext: c = ".png, .jpg, .jpeg, .ico", df: l = "" }) => {
|
|
160
|
+
let u = E(null), [p, m] = D([]), [g, _] = D(Array.isArray(a) ? a : []), v = E(/* @__PURE__ */ new Map()), y = (e) => {
|
|
161
|
+
let t = v.current.get(e);
|
|
162
|
+
return t || (t = URL.createObjectURL(e), v.current.set(e, t)), t;
|
|
163
|
+
};
|
|
164
|
+
w(() => () => {
|
|
165
|
+
v.current.forEach((e) => URL.revokeObjectURL(e)), v.current.clear();
|
|
166
|
+
}, []), w(() => {
|
|
167
|
+
_((e) => {
|
|
168
|
+
let t = Array.isArray(a) ? a : [];
|
|
169
|
+
return e.length === t.length && e.every((e, n) => e === t[n]) ? e : t;
|
|
170
|
+
});
|
|
171
|
+
}, [a]);
|
|
172
|
+
let b = (e) => {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
let t = /\.(png|jpg|jpeg|ico)$/i, n = u.current?.querySelector(".default-file-input");
|
|
175
|
+
if (!n) return;
|
|
176
|
+
let r = n.files;
|
|
177
|
+
if (!r) return;
|
|
178
|
+
let i = n.getAttribute("accept"), a = f(i, t);
|
|
179
|
+
d(r, 10, a).then(() => {
|
|
180
|
+
let e = Array.from(r);
|
|
181
|
+
m((t) => [...t, ...e]);
|
|
182
|
+
}).catch((e) => {
|
|
183
|
+
console.error("[AsxhUImages] Upload không hợp lệ:", e.message);
|
|
184
|
+
});
|
|
185
|
+
}, x = (e, t) => {
|
|
186
|
+
e.preventDefault(), _((e) => e.filter((e, n) => n !== t));
|
|
187
|
+
}, S = (e, t) => {
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
let n = p[t];
|
|
190
|
+
if (n) {
|
|
191
|
+
let e = v.current.get(n);
|
|
192
|
+
e && (URL.revokeObjectURL(e), v.current.delete(n));
|
|
193
|
+
}
|
|
194
|
+
m((e) => e.filter((e, n) => n !== t));
|
|
195
|
+
};
|
|
196
|
+
w(() => {
|
|
197
|
+
o && o(h(`${n}_upload`, p, "files"));
|
|
198
|
+
}, [p]), w(() => {
|
|
199
|
+
o && o(h(n, g));
|
|
200
|
+
}, [g]);
|
|
201
|
+
let C = (t, n = "/styles/default.jpg") => t ? (e().API_URL ?? "") + "/uploads/" + t : n;
|
|
202
|
+
return /* @__PURE__ */ N("div", {
|
|
203
|
+
ref: u,
|
|
204
|
+
className: `card boxUImage ${r}`,
|
|
205
|
+
children: [
|
|
206
|
+
/* @__PURE__ */ M("div", {
|
|
207
|
+
className: "card-header",
|
|
208
|
+
children: /* @__PURE__ */ M("div", {
|
|
209
|
+
className: "row",
|
|
210
|
+
children: /* @__PURE__ */ N("div", {
|
|
211
|
+
className: "flex-auto col-auto d-flex align-items-center",
|
|
212
|
+
children: [/* @__PURE__ */ M("h3", {
|
|
213
|
+
className: "card-title",
|
|
214
|
+
children: t
|
|
215
|
+
}), s && /* @__PURE__ */ N("label", {
|
|
216
|
+
className: "text-info cursor-pointer m-0 ms-auto",
|
|
217
|
+
children: ["Tải lên", /* @__PURE__ */ M("input", {
|
|
218
|
+
required: i,
|
|
219
|
+
name: n,
|
|
220
|
+
multiple: !0,
|
|
221
|
+
type: "file",
|
|
222
|
+
onChange: b,
|
|
223
|
+
className: "d-none default-file-input",
|
|
224
|
+
accept: c
|
|
225
|
+
})]
|
|
226
|
+
})]
|
|
227
|
+
})
|
|
228
|
+
})
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ M("hr", { className: "my-0" }),
|
|
231
|
+
/* @__PURE__ */ N("div", {
|
|
232
|
+
className: "card-body py-2 px-3",
|
|
233
|
+
style: { minHeight: "50px" },
|
|
234
|
+
children: [g?.map((e, t) => {
|
|
235
|
+
let n = (e ? e.split("/").pop() ?? "" : "").split("___");
|
|
236
|
+
return /* @__PURE__ */ N("div", {
|
|
237
|
+
className: "d-flex w-100 justify-content-between",
|
|
238
|
+
children: [/* @__PURE__ */ N("div", {
|
|
239
|
+
className: `d-flex justify-content-center flex-column ${e ? "" : "d-none"}`,
|
|
240
|
+
children: [/* @__PURE__ */ N("div", {
|
|
241
|
+
className: "w-100",
|
|
242
|
+
children: [/* @__PURE__ */ M("i", { className: "fal fa-file me-1" }), /* @__PURE__ */ M("a", {
|
|
243
|
+
className: "text-info",
|
|
244
|
+
href: C(e, l),
|
|
245
|
+
target: "_blank",
|
|
246
|
+
children: n?.[1]
|
|
247
|
+
})]
|
|
248
|
+
}), /* @__PURE__ */ M("span", { children: n[0] ? new Date(Number(n[0])).toLocaleString("vi-VN") : "" })]
|
|
249
|
+
}), s && /* @__PURE__ */ M("a", {
|
|
250
|
+
onClick: (e) => x(e, t),
|
|
251
|
+
href: "#",
|
|
252
|
+
className: `ml-auto link text-danger ${e ? "" : "d-none"}`,
|
|
253
|
+
children: "Xóa"
|
|
254
|
+
})]
|
|
255
|
+
}, t);
|
|
256
|
+
}), p?.map((e, t) => /* @__PURE__ */ N("div", {
|
|
257
|
+
className: "d-flex w-100 justify-content-between",
|
|
258
|
+
children: [/* @__PURE__ */ N("div", {
|
|
259
|
+
className: `d-flex align-items-center justify-content-center ${e ? "" : "d-none"}`,
|
|
260
|
+
children: [/* @__PURE__ */ M("i", { className: "fal fa-file me-1" }), /* @__PURE__ */ M("a", {
|
|
261
|
+
className: "text-info text-1-line",
|
|
262
|
+
href: y(e),
|
|
263
|
+
target: "_blank",
|
|
264
|
+
rel: "noopener noreferrer",
|
|
265
|
+
children: e?.name
|
|
266
|
+
})]
|
|
267
|
+
}), s && /* @__PURE__ */ M("a", {
|
|
268
|
+
onClick: (e) => S(e, t),
|
|
269
|
+
href: "#",
|
|
270
|
+
className: `ml-auto link text-danger ${e ? "" : "d-none"}`,
|
|
271
|
+
children: "Xóa"
|
|
272
|
+
})]
|
|
273
|
+
}, t))]
|
|
274
|
+
})
|
|
275
|
+
]
|
|
276
|
+
});
|
|
277
|
+
}, bt = (e, t) => {
|
|
278
|
+
t?.(e);
|
|
279
|
+
let n = e.currentTarget.closest(".input-group-outline");
|
|
280
|
+
e.currentTarget.value.trim() === "" ? n?.classList.remove("is-filled") : n?.classList.add("is-filled");
|
|
281
|
+
}, xt = (e) => {
|
|
282
|
+
e.preventDefault(), e.currentTarget.closest(".input-group-outline")?.classList.add("is-focused");
|
|
283
|
+
}, St = (e) => {
|
|
284
|
+
e.preventDefault(), e.currentTarget.closest(".input-group-outline")?.classList.remove("is-focused");
|
|
285
|
+
}, Ct = ({ label: e, name: t, value: n = "", required: r = !1, disabled: i = !1, readonly: a = !1, cpnClass: o = "", minLength: s = 0, maxLength: c = 255, onChange: l, style: u = {} }) => {
|
|
286
|
+
let d = E(null);
|
|
287
|
+
return w(() => {
|
|
288
|
+
document.activeElement !== d.current && l && l(h(t, n));
|
|
289
|
+
}, [n]), /* @__PURE__ */ M("div", {
|
|
290
|
+
className: "form-group " + (o ?? ""),
|
|
291
|
+
children: /* @__PURE__ */ N("div", {
|
|
292
|
+
className: `input-group input-group-outline ${n ? "is-filled" : ""}`,
|
|
293
|
+
children: [/* @__PURE__ */ M("div", {
|
|
294
|
+
className: "form-label",
|
|
295
|
+
children: e + (r ? " *" : "")
|
|
296
|
+
}), /* @__PURE__ */ M("input", {
|
|
297
|
+
style: u,
|
|
298
|
+
name: t,
|
|
299
|
+
placeholder: "",
|
|
300
|
+
readOnly: a,
|
|
301
|
+
disabled: i,
|
|
302
|
+
required: r,
|
|
303
|
+
minLength: s,
|
|
304
|
+
maxLength: c,
|
|
305
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
306
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
307
|
+
className: "form-control",
|
|
308
|
+
value: n,
|
|
309
|
+
onChange: (e) => bt(e, l),
|
|
310
|
+
onFocus: xt,
|
|
311
|
+
onBlur: St
|
|
312
|
+
})]
|
|
313
|
+
})
|
|
314
|
+
});
|
|
315
|
+
}, wt = ({ label: e, name: t, value: n = "", required: r = !1, disabled: i = !1, readonly: a = !1, cpnClass: o = "", minLength: s = 0, maxLength: c = 255, onChange: l }) => {
|
|
316
|
+
let u = E(null);
|
|
317
|
+
return w(() => {
|
|
318
|
+
document.activeElement !== u.current && l && l(h(t, n));
|
|
319
|
+
}, [n]), /* @__PURE__ */ M("div", {
|
|
320
|
+
className: "form-group " + (o ?? ""),
|
|
321
|
+
children: /* @__PURE__ */ N("div", {
|
|
322
|
+
className: `input-group input-group-outline ${n ? "is-filled" : ""}`,
|
|
323
|
+
children: [/* @__PURE__ */ M("div", {
|
|
324
|
+
className: "form-label",
|
|
325
|
+
children: e + (r ? " *" : "")
|
|
326
|
+
}), /* @__PURE__ */ M("input", {
|
|
327
|
+
type: "email",
|
|
328
|
+
name: t,
|
|
329
|
+
readOnly: a,
|
|
330
|
+
disabled: i,
|
|
331
|
+
required: r,
|
|
332
|
+
minLength: s,
|
|
333
|
+
maxLength: c,
|
|
334
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
335
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
336
|
+
className: "form-control",
|
|
337
|
+
value: n,
|
|
338
|
+
onChange: (e) => bt(e, l),
|
|
339
|
+
onFocus: xt,
|
|
340
|
+
onBlur: St
|
|
341
|
+
})]
|
|
342
|
+
})
|
|
343
|
+
});
|
|
344
|
+
}, Tt = ({ label: e, name: t, value: n = "", cpnClass: r = "", required: i = !1, disabled: a = !1, readonly: o = !1, rows: s = 3, onChange: c }) => {
|
|
345
|
+
let l = E(null);
|
|
346
|
+
return w(() => {
|
|
347
|
+
document.activeElement !== l.current && c && c(h(t, n));
|
|
348
|
+
}, [n]), /* @__PURE__ */ M("div", {
|
|
349
|
+
className: "form-group " + (r ?? ""),
|
|
350
|
+
children: /* @__PURE__ */ N("div", {
|
|
351
|
+
className: `input-group input-group-outline ${n ? "is-filled" : ""}`,
|
|
352
|
+
children: [/* @__PURE__ */ M("div", {
|
|
353
|
+
className: "form-label",
|
|
354
|
+
children: e + (i ? " *" : "")
|
|
355
|
+
}), /* @__PURE__ */ M("textarea", {
|
|
356
|
+
name: t,
|
|
357
|
+
rows: s,
|
|
358
|
+
onFocus: xt,
|
|
359
|
+
onBlur: St,
|
|
360
|
+
readOnly: o,
|
|
361
|
+
disabled: a,
|
|
362
|
+
required: i,
|
|
363
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
364
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
365
|
+
className: "form-control",
|
|
366
|
+
value: n,
|
|
367
|
+
onChange: (e) => bt(e, c)
|
|
368
|
+
})]
|
|
369
|
+
})
|
|
370
|
+
});
|
|
371
|
+
}, Et = ({ label: e, name: t, value: n = 0, step: r = 1, required: i = !1, disabled: a = !1, readonly: o = !1, cpnClass: s = "", max: c, min: l, onChange: u, style: d = {} }) => {
|
|
372
|
+
let [f, p] = D("0"), m = E(null);
|
|
373
|
+
w(() => {
|
|
374
|
+
if (document.activeElement !== m.current) {
|
|
375
|
+
n &&= String(n).replace(/\./g, ",");
|
|
376
|
+
let e = _(String(n));
|
|
377
|
+
if (Number(e) > 2 ** 53 - 1 || Number(e) < -(2 ** 53 - 1)) return;
|
|
378
|
+
let r = e.split("."), i = r[0]?.replace(/[^\d-]/g, "");
|
|
379
|
+
i.indexOf("-") > 0 && (i = "-" + i.replace(/-/g, ""));
|
|
380
|
+
let a = r[1];
|
|
381
|
+
i = BigInt(i).toLocaleString("vi-VN");
|
|
382
|
+
let o = a === void 0 ? i : `${i},${a}`;
|
|
383
|
+
p(o), u && u(h(t, e));
|
|
384
|
+
}
|
|
385
|
+
}, [n]);
|
|
386
|
+
let g = (e, n) => {
|
|
387
|
+
let r = String(e.currentTarget.value), i = e.currentTarget.selectionStart ?? 0, a = (r.slice(0, i).match(/\d/g) || []).length, o = _(r);
|
|
388
|
+
if (Number(o) > 2 ** 53 - 1 || Number(o) < -(2 ** 53 - 1)) return;
|
|
389
|
+
let s = o.split("."), c = s[0]?.replace(/[^\d-]/g, "");
|
|
390
|
+
c.indexOf("-") > 0 && (c = "-" + c.replace(/-/g, ""));
|
|
391
|
+
let l = s[1];
|
|
392
|
+
c = BigInt(c).toLocaleString("vi-VN");
|
|
393
|
+
let u = l === void 0 ? c : `${c},${l}`;
|
|
394
|
+
p(u), n?.(h(t, o));
|
|
395
|
+
let d = e.currentTarget.closest(".input-group-outline");
|
|
396
|
+
r.trim() === "" ? d?.classList.remove("is-filled") : d?.classList.add("is-filled"), requestAnimationFrame(() => {
|
|
397
|
+
let e = v(u, a), t = m.current;
|
|
398
|
+
if (t) {
|
|
399
|
+
let n = Math.max(0, Math.min(u.length, e));
|
|
400
|
+
t.setSelectionRange(n, n);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
function _(e) {
|
|
405
|
+
if (!e) return "";
|
|
406
|
+
let t = e;
|
|
407
|
+
t = t.replace(/[^\d,-]/g, ""), t = t.replace(/(?!^)-/g, "");
|
|
408
|
+
let n = t.indexOf(",");
|
|
409
|
+
return n !== -1 && (t = t.slice(0, n + 1) + t.slice(n + 1).replace(/,/g, "")), t = t.replace(/,/g, "."), t;
|
|
410
|
+
}
|
|
411
|
+
function v(e, t) {
|
|
412
|
+
let n = 0;
|
|
413
|
+
for (let r = 0; r < e.length; r++) if (/\d/.test(e[r]) && n++, n === t) return r + 1;
|
|
414
|
+
return e.length;
|
|
415
|
+
}
|
|
416
|
+
return /* @__PURE__ */ M("div", {
|
|
417
|
+
className: "form-group " + (s ?? ""),
|
|
418
|
+
children: /* @__PURE__ */ N("div", {
|
|
419
|
+
className: "input-group input-group-outline is-filled",
|
|
420
|
+
children: [/* @__PURE__ */ M("div", {
|
|
421
|
+
className: "form-label",
|
|
422
|
+
children: e + (i ? " *" : "") + (c ? " (Tối đa " + c + ")" : "")
|
|
423
|
+
}), /* @__PURE__ */ M("input", {
|
|
424
|
+
ref: m,
|
|
425
|
+
style: d,
|
|
426
|
+
type: "text",
|
|
427
|
+
name: t,
|
|
428
|
+
step: r,
|
|
429
|
+
readOnly: o,
|
|
430
|
+
max: c ?? 2 ** 53 - 1,
|
|
431
|
+
min: l ?? -(2 ** 53 - 1),
|
|
432
|
+
disabled: a,
|
|
433
|
+
required: i,
|
|
434
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
435
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
436
|
+
className: "form-control",
|
|
437
|
+
value: f,
|
|
438
|
+
onChange: (e) => g(e, u),
|
|
439
|
+
onFocus: xt,
|
|
440
|
+
onBlur: St
|
|
441
|
+
})]
|
|
442
|
+
})
|
|
443
|
+
});
|
|
444
|
+
}, Dt = ({ label: e, name: t, value: n = "", cpnClass: r = "", required: i = !1, disabled: a = !1, readonly: o = !1, onChange: s, autoComplete: c = "" }) => /* @__PURE__ */ M("div", {
|
|
445
|
+
className: "form-group " + (r ?? ""),
|
|
446
|
+
children: /* @__PURE__ */ N("div", {
|
|
447
|
+
className: `input-group input-group-outline ${n ? "is-filled" : ""}`,
|
|
448
|
+
children: [/* @__PURE__ */ M("div", {
|
|
449
|
+
className: "form-label",
|
|
450
|
+
children: e + (i ? " *" : "")
|
|
451
|
+
}), /* @__PURE__ */ M("input", {
|
|
452
|
+
name: t,
|
|
453
|
+
type: "password",
|
|
454
|
+
disabled: a,
|
|
455
|
+
readOnly: o,
|
|
456
|
+
required: i,
|
|
457
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
458
|
+
className: "form-control",
|
|
459
|
+
value: n,
|
|
460
|
+
onChange: (e) => bt(e, s),
|
|
461
|
+
onFocus: xt,
|
|
462
|
+
onBlur: St,
|
|
463
|
+
autoComplete: c,
|
|
464
|
+
"data-error": "Vui lòng nhập mật khẩu dài 8-32 ký tự, có ký tự chữ số, chữ hoa và chữ thường, ký tự @#$!%^&*",
|
|
465
|
+
pattern: "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$!%^&*])[0-9a-zA-Z@#$!%^&*.]{8,32}$"
|
|
466
|
+
})]
|
|
467
|
+
})
|
|
468
|
+
}), Ot = ({ label: e, name: t = "", value: n = "", cpnClass: r = "", required: i = !1, disabled: a = !1, readonly: o = !1, onChange: s }) => /* @__PURE__ */ M("div", {
|
|
469
|
+
className: "form-group " + (r ?? ""),
|
|
470
|
+
children: /* @__PURE__ */ N("div", {
|
|
471
|
+
className: `input-group input-group-outline ${n ? "is-filled" : ""}`,
|
|
472
|
+
children: [/* @__PURE__ */ M("div", {
|
|
473
|
+
className: "form-label",
|
|
474
|
+
children: e + (i ? " *" : "")
|
|
475
|
+
}), /* @__PURE__ */ M("input", {
|
|
476
|
+
type: "text",
|
|
477
|
+
name: t,
|
|
478
|
+
disabled: a,
|
|
479
|
+
readOnly: o,
|
|
480
|
+
required: i,
|
|
481
|
+
"data-pattern": "^[03|05|07|08|09]{2}[0-9]{8}$",
|
|
482
|
+
"data-pattern-error": "Vui lòng nhập đúng số điện thoại thuê bao Việt Nam",
|
|
483
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
484
|
+
className: "form-control",
|
|
485
|
+
onChange: (e) => bt(e, s),
|
|
486
|
+
onFocus: xt,
|
|
487
|
+
onBlur: St,
|
|
488
|
+
value: n
|
|
489
|
+
})]
|
|
490
|
+
})
|
|
491
|
+
}), kt = ({ label: e, lists: t, name: n = "", value: r = "", cpnClass: i = "", required: a = !1, disabled: o = !1 }) => {
|
|
492
|
+
let s = ee(), c = Array.isArray(t) ? t : [], l = (e) => typeof e == "object" && !!e && !(e instanceof File);
|
|
493
|
+
return /* @__PURE__ */ N("div", {
|
|
494
|
+
className: "form-group " + (i ?? ""),
|
|
495
|
+
children: [/* @__PURE__ */ M("label", {
|
|
496
|
+
className: "form-label ms-auto font-weight-bold",
|
|
497
|
+
children: e + (a ? " *" : "")
|
|
498
|
+
}), /* @__PURE__ */ M("div", {
|
|
499
|
+
className: "row grid-space-16",
|
|
500
|
+
children: c.map((e, t) => {
|
|
501
|
+
let i = l(e) ? e.id : e, c = `${s}-${t}`;
|
|
502
|
+
return /* @__PURE__ */ M("div", {
|
|
503
|
+
className: "col-auto",
|
|
504
|
+
children: /* @__PURE__ */ N("div", {
|
|
505
|
+
className: "form-check ps-0",
|
|
506
|
+
children: [/* @__PURE__ */ M("input", {
|
|
507
|
+
type: "radio",
|
|
508
|
+
name: n,
|
|
509
|
+
required: a,
|
|
510
|
+
disabled: o,
|
|
511
|
+
id: c,
|
|
512
|
+
className: "form-check-input",
|
|
513
|
+
value: String(i ?? ""),
|
|
514
|
+
defaultChecked: r == i
|
|
515
|
+
}), /* @__PURE__ */ M("label", {
|
|
516
|
+
className: "custom-control-label",
|
|
517
|
+
htmlFor: c,
|
|
518
|
+
children: l(e) ? String(e.name ?? "") : String(e)
|
|
519
|
+
})]
|
|
520
|
+
})
|
|
521
|
+
}, c);
|
|
522
|
+
})
|
|
523
|
+
})]
|
|
524
|
+
});
|
|
525
|
+
}, At = ({ label: e, name: t, col: n = "col-auto", keyValue: r = "id", keyName: i = "name", lists: a = [], value: o = [], required: s = !1, disabled: c = !1, readonly: l = !1, cpnClass: u = "", onChange: d }) => {
|
|
526
|
+
let f = Array.isArray(a) ? a : [], p = Array.isArray(o) ? o : [];
|
|
527
|
+
return /* @__PURE__ */ N("div", {
|
|
528
|
+
className: "form-group " + (u ?? ""),
|
|
529
|
+
children: [/* @__PURE__ */ M("div", {
|
|
530
|
+
className: "form-label",
|
|
531
|
+
children: e + (s ? " *" : "")
|
|
532
|
+
}), /* @__PURE__ */ M("div", {
|
|
533
|
+
className: "row grid-space-16",
|
|
534
|
+
children: f.map((e) => /* @__PURE__ */ M("div", {
|
|
535
|
+
className: n,
|
|
536
|
+
children: /* @__PURE__ */ M("div", {
|
|
537
|
+
className: "form-check ps-0",
|
|
538
|
+
children: /* @__PURE__ */ N("label", {
|
|
539
|
+
className: "form-check-label d-flex",
|
|
540
|
+
children: [
|
|
541
|
+
/* @__PURE__ */ M("input", {
|
|
542
|
+
type: "checkbox",
|
|
543
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
544
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
545
|
+
name: t,
|
|
546
|
+
className: "form-check-input d-none",
|
|
547
|
+
readOnly: l,
|
|
548
|
+
disabled: c,
|
|
549
|
+
required: s,
|
|
550
|
+
value: String(e[r] ?? ""),
|
|
551
|
+
checked: p.includes(e[r]),
|
|
552
|
+
onChange: d
|
|
553
|
+
}),
|
|
554
|
+
/* @__PURE__ */ M("span", {
|
|
555
|
+
className: "form-check-sign",
|
|
556
|
+
children: /* @__PURE__ */ M("span", { className: "check" })
|
|
557
|
+
}),
|
|
558
|
+
/* @__PURE__ */ M("span", {
|
|
559
|
+
className: "cursor-pointer mb-0 ms-2",
|
|
560
|
+
children: String(e[i] ?? "")
|
|
561
|
+
})
|
|
562
|
+
]
|
|
563
|
+
})
|
|
564
|
+
})
|
|
565
|
+
}))
|
|
566
|
+
})]
|
|
567
|
+
});
|
|
568
|
+
}, jt = (e, t) => e.find((e) => e.value === t) || null, Mt = (e, t) => {
|
|
569
|
+
let n = Array.isArray(t) ? t : [];
|
|
570
|
+
return e.filter((e) => n.includes(e.value));
|
|
571
|
+
}, Nt = (e, t, n, r, i) => {
|
|
572
|
+
let a = [];
|
|
573
|
+
r && a.push({
|
|
574
|
+
value: -1,
|
|
575
|
+
label: "Tất cả"
|
|
576
|
+
}), i && a.push({
|
|
577
|
+
value: 0,
|
|
578
|
+
label: "Không có"
|
|
579
|
+
});
|
|
580
|
+
let o = Array.isArray(e) ? e.map((e) => ({
|
|
581
|
+
value: e[t],
|
|
582
|
+
label: e[n]
|
|
583
|
+
})) : [];
|
|
584
|
+
return [...a, ...o];
|
|
585
|
+
}, Pt = ({ label: e, name: t, lists: n = [], keyValue: r = "id", keyName: i = "name", value: a = "", cpnClass: o = "", required: s = !1, disabled: c = !1, all: l = !1, zero: u = !1, onChange: d, style: f = {} }) => {
|
|
586
|
+
let [p, m] = D([]);
|
|
587
|
+
w(() => {
|
|
588
|
+
m(Nt(n, r, i, l, u));
|
|
589
|
+
}, [n]);
|
|
590
|
+
let g = E(!1);
|
|
591
|
+
w(() => {
|
|
592
|
+
g.current || p.length && (g.current = !0, d?.(h(t, a)));
|
|
593
|
+
}, [p]);
|
|
594
|
+
let _ = (e) => {
|
|
595
|
+
d && d(h(t, e));
|
|
596
|
+
}, v = E(null);
|
|
597
|
+
return w(() => {
|
|
598
|
+
let e = v.current?.querySelector(`input[name="${t}"][required]`);
|
|
599
|
+
e && e.setCustomValidity(a ? "" : "Vui lòng nhập dữ liệu");
|
|
600
|
+
}, [
|
|
601
|
+
a,
|
|
602
|
+
t,
|
|
603
|
+
s
|
|
604
|
+
]), /* @__PURE__ */ M("div", {
|
|
605
|
+
ref: v,
|
|
606
|
+
className: "form-group box-select " + (o ?? ""),
|
|
607
|
+
style: f,
|
|
608
|
+
children: /* @__PURE__ */ N("div", {
|
|
609
|
+
className: "input-group input-group-outline is-filled",
|
|
610
|
+
children: [/* @__PURE__ */ M("span", {
|
|
611
|
+
className: "form-label",
|
|
612
|
+
children: e + (s ? " *" : "")
|
|
613
|
+
}), /* @__PURE__ */ M(O, {
|
|
614
|
+
menuPortalTarget: document.body,
|
|
615
|
+
styles: { menuPortal: (e) => ({
|
|
616
|
+
...e,
|
|
617
|
+
zIndex: 99999
|
|
618
|
+
}) },
|
|
619
|
+
classNamePrefix: "react-select",
|
|
620
|
+
placeholder: "Chọn",
|
|
621
|
+
name: t,
|
|
622
|
+
options: p,
|
|
623
|
+
value: jt(p, a),
|
|
624
|
+
onChange: (e) => _(e?.value ?? null),
|
|
625
|
+
noOptionsMessage: () => "Không có dữ liệu",
|
|
626
|
+
isDisabled: c,
|
|
627
|
+
required: s,
|
|
628
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
629
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
630
|
+
className: "form-control"
|
|
631
|
+
})]
|
|
632
|
+
})
|
|
633
|
+
});
|
|
634
|
+
}, Ft = ({ label: e, name: t, lists: n = [], keyValue: r = "id", keyName: i = "name", value: a = [], cpnClass: o = "", required: s = !1, disabled: c = !1, all: l = !1, zero: u = !1, onChange: d }) => {
|
|
635
|
+
let [f, p] = D([]);
|
|
636
|
+
w(() => {
|
|
637
|
+
p(Nt(n, r, i, l, u));
|
|
638
|
+
}, [n]);
|
|
639
|
+
let m = (e) => {
|
|
640
|
+
d?.(h(t, e));
|
|
641
|
+
}, g = E(null);
|
|
642
|
+
return w(() => {
|
|
643
|
+
let e = g.current?.querySelector(`input[name="${t}"][required]`);
|
|
644
|
+
e && e.setCustomValidity(a?.length ? "" : "Vui lòng nhập dữ liệu");
|
|
645
|
+
}, [
|
|
646
|
+
a,
|
|
647
|
+
t,
|
|
648
|
+
s
|
|
649
|
+
]), /* @__PURE__ */ M("div", {
|
|
650
|
+
ref: g,
|
|
651
|
+
className: "form-group box-select " + (o ?? ""),
|
|
652
|
+
children: /* @__PURE__ */ N("div", {
|
|
653
|
+
className: "input-group input-group-outline is-filled",
|
|
654
|
+
children: [/* @__PURE__ */ M("span", {
|
|
655
|
+
className: "form-label",
|
|
656
|
+
children: e + (s ? " *" : "")
|
|
657
|
+
}), /* @__PURE__ */ M(O, {
|
|
658
|
+
menuPortalTarget: document.body,
|
|
659
|
+
styles: { menuPortal: (e) => ({
|
|
660
|
+
...e,
|
|
661
|
+
zIndex: 99999
|
|
662
|
+
}) },
|
|
663
|
+
classNamePrefix: "react-select",
|
|
664
|
+
placeholder: "Chọn",
|
|
665
|
+
name: t,
|
|
666
|
+
options: f,
|
|
667
|
+
value: Mt(f, a),
|
|
668
|
+
onChange: (e) => m((e ?? []).map((e) => e.value)),
|
|
669
|
+
noOptionsMessage: () => "Không có dữ liệu",
|
|
670
|
+
isDisabled: c,
|
|
671
|
+
required: s,
|
|
672
|
+
isMulti: !0,
|
|
673
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
674
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
675
|
+
className: "form-control"
|
|
676
|
+
})]
|
|
677
|
+
})
|
|
678
|
+
});
|
|
679
|
+
}, It = ({ label: e, name: t, cpnClass: n = "", required: r = !1, value: a = "", onChange: o, isEdit: s = !1, ext: c = ".jpg, .jpeg, .png", df: l = "/styles/default.jpg" }) => {
|
|
680
|
+
let u = E(null), [d, f] = D(a);
|
|
681
|
+
return w(() => {
|
|
682
|
+
let e = u.current?.querySelector(".upImage");
|
|
683
|
+
e && m(e, "#elfinderModal", (e) => {
|
|
684
|
+
let { data: t, md: n } = e;
|
|
685
|
+
if (t) {
|
|
686
|
+
let e = Array.isArray(t) ? t[0] : t;
|
|
687
|
+
f(e.url?.replace(/^.*\/static/, "")), n?.hide();
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
}, []), w(() => {
|
|
691
|
+
o && o(h(t, d));
|
|
692
|
+
}, [d]), w(() => {
|
|
693
|
+
f(a);
|
|
694
|
+
}, [a]), /* @__PURE__ */ N("div", {
|
|
695
|
+
ref: u,
|
|
696
|
+
className: `card ${n}`,
|
|
697
|
+
children: [
|
|
698
|
+
/* @__PURE__ */ M("div", {
|
|
699
|
+
className: "card-header",
|
|
700
|
+
children: /* @__PURE__ */ M("div", {
|
|
701
|
+
className: "row",
|
|
702
|
+
children: /* @__PURE__ */ M("div", {
|
|
703
|
+
className: "flex-auto col-auto d-flex align-items-center",
|
|
704
|
+
children: /* @__PURE__ */ M("h3", {
|
|
705
|
+
className: "card-title",
|
|
706
|
+
children: e
|
|
707
|
+
})
|
|
708
|
+
})
|
|
709
|
+
})
|
|
710
|
+
}),
|
|
711
|
+
/* @__PURE__ */ M("hr", { className: "my-0" }),
|
|
712
|
+
/* @__PURE__ */ M("div", {
|
|
713
|
+
className: "card-body d-flex justify-content-center p-0",
|
|
714
|
+
children: /* @__PURE__ */ M("div", {
|
|
715
|
+
className: "d-flex align-items-center justify-content-center",
|
|
716
|
+
children: /* @__PURE__ */ M("img", {
|
|
717
|
+
className: "height-100 object-fit-contain",
|
|
718
|
+
src: i(d, l),
|
|
719
|
+
alt: "img"
|
|
720
|
+
})
|
|
721
|
+
})
|
|
722
|
+
}),
|
|
723
|
+
s && /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("hr", { className: "my-0" }), /* @__PURE__ */ N("div", {
|
|
724
|
+
className: "card-footer d-flex justify-content-between",
|
|
725
|
+
children: [
|
|
726
|
+
/* @__PURE__ */ M("label", {
|
|
727
|
+
className: "text-info cursor-pointer m-0 upImage",
|
|
728
|
+
children: "Tải lên"
|
|
729
|
+
}),
|
|
730
|
+
/* @__PURE__ */ M("input", {
|
|
731
|
+
value: d,
|
|
732
|
+
required: r,
|
|
733
|
+
name: t,
|
|
734
|
+
type: "text",
|
|
735
|
+
onChange: o,
|
|
736
|
+
className: "d-none default-file-input",
|
|
737
|
+
accept: c
|
|
738
|
+
}),
|
|
739
|
+
d && /* @__PURE__ */ M("a", {
|
|
740
|
+
href: "#",
|
|
741
|
+
onClick: () => {
|
|
742
|
+
f("");
|
|
743
|
+
},
|
|
744
|
+
className: "ml-auto link text-danger",
|
|
745
|
+
children: "Xóa"
|
|
746
|
+
})
|
|
747
|
+
]
|
|
748
|
+
})] })
|
|
749
|
+
]
|
|
750
|
+
});
|
|
751
|
+
}, Lt = { display: "none" };
|
|
752
|
+
function Rt(e) {
|
|
753
|
+
let { id: t, value: n } = e;
|
|
754
|
+
return y.createElement("div", {
|
|
755
|
+
id: t,
|
|
756
|
+
style: Lt
|
|
757
|
+
}, n);
|
|
758
|
+
}
|
|
759
|
+
function zt(e) {
|
|
760
|
+
let { id: t, announcement: n, ariaLiveType: r = "assertive" } = e;
|
|
761
|
+
return y.createElement("div", {
|
|
762
|
+
id: t,
|
|
763
|
+
style: {
|
|
764
|
+
position: "fixed",
|
|
765
|
+
top: 0,
|
|
766
|
+
left: 0,
|
|
767
|
+
width: 1,
|
|
768
|
+
height: 1,
|
|
769
|
+
margin: -1,
|
|
770
|
+
border: 0,
|
|
771
|
+
padding: 0,
|
|
772
|
+
overflow: "hidden",
|
|
773
|
+
clip: "rect(0 0 0 0)",
|
|
774
|
+
clipPath: "inset(100%)",
|
|
775
|
+
whiteSpace: "nowrap"
|
|
776
|
+
},
|
|
777
|
+
role: "status",
|
|
778
|
+
"aria-live": r,
|
|
779
|
+
"aria-atomic": !0
|
|
780
|
+
}, n);
|
|
781
|
+
}
|
|
782
|
+
function Bt() {
|
|
783
|
+
let [e, t] = D("");
|
|
784
|
+
return {
|
|
785
|
+
announce: S((e) => {
|
|
786
|
+
e != null && t(e);
|
|
787
|
+
}, []),
|
|
788
|
+
announcement: e
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
//#endregion
|
|
792
|
+
//#region node_modules/@dnd-kit/core/dist/core.esm.js
|
|
793
|
+
var Vt = /*#__PURE__*/ b(null);
|
|
794
|
+
function Ht(e) {
|
|
795
|
+
let t = C(Vt);
|
|
796
|
+
w(() => {
|
|
797
|
+
if (!t) throw Error("useDndMonitor must be used within a children of <DndContext>");
|
|
798
|
+
return t(e);
|
|
799
|
+
}, [e, t]);
|
|
800
|
+
}
|
|
801
|
+
function Ut() {
|
|
802
|
+
let [e] = D(() => /* @__PURE__ */ new Set()), t = S((t) => (e.add(t), () => e.delete(t)), [e]);
|
|
803
|
+
return [S((t) => {
|
|
804
|
+
let { type: n, event: r } = t;
|
|
805
|
+
e.forEach((e) => e[n]?.call(e, r));
|
|
806
|
+
}, [e]), t];
|
|
807
|
+
}
|
|
808
|
+
var Wt = { draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n " }, Gt = {
|
|
809
|
+
onDragStart(e) {
|
|
810
|
+
let { active: t } = e;
|
|
811
|
+
return "Picked up draggable item " + t.id + ".";
|
|
812
|
+
},
|
|
813
|
+
onDragOver(e) {
|
|
814
|
+
let { active: t, over: n } = e;
|
|
815
|
+
return n ? "Draggable item " + t.id + " was moved over droppable area " + n.id + "." : "Draggable item " + t.id + " is no longer over a droppable area.";
|
|
816
|
+
},
|
|
817
|
+
onDragEnd(e) {
|
|
818
|
+
let { active: t, over: n } = e;
|
|
819
|
+
return n ? "Draggable item " + t.id + " was dropped over droppable area " + n.id : "Draggable item " + t.id + " was dropped.";
|
|
820
|
+
},
|
|
821
|
+
onDragCancel(e) {
|
|
822
|
+
let { active: t } = e;
|
|
823
|
+
return "Dragging was cancelled. Draggable item " + t.id + " was dropped.";
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
function Kt(e) {
|
|
827
|
+
let { announcements: t = Gt, container: n, hiddenTextDescribedById: r, screenReaderInstructions: i = Wt } = e, { announce: a, announcement: o } = Bt(), s = _e("DndLiveRegion"), [c, l] = D(!1);
|
|
828
|
+
if (w(() => {
|
|
829
|
+
l(!0);
|
|
830
|
+
}, []), Ht(T(() => ({
|
|
831
|
+
onDragStart(e) {
|
|
832
|
+
let { active: n } = e;
|
|
833
|
+
a(t.onDragStart({ active: n }));
|
|
834
|
+
},
|
|
835
|
+
onDragMove(e) {
|
|
836
|
+
let { active: n, over: r } = e;
|
|
837
|
+
t.onDragMove && a(t.onDragMove({
|
|
838
|
+
active: n,
|
|
839
|
+
over: r
|
|
840
|
+
}));
|
|
841
|
+
},
|
|
842
|
+
onDragOver(e) {
|
|
843
|
+
let { active: n, over: r } = e;
|
|
844
|
+
a(t.onDragOver({
|
|
845
|
+
active: n,
|
|
846
|
+
over: r
|
|
847
|
+
}));
|
|
848
|
+
},
|
|
849
|
+
onDragEnd(e) {
|
|
850
|
+
let { active: n, over: r } = e;
|
|
851
|
+
a(t.onDragEnd({
|
|
852
|
+
active: n,
|
|
853
|
+
over: r
|
|
854
|
+
}));
|
|
855
|
+
},
|
|
856
|
+
onDragCancel(e) {
|
|
857
|
+
let { active: n, over: r } = e;
|
|
858
|
+
a(t.onDragCancel({
|
|
859
|
+
active: n,
|
|
860
|
+
over: r
|
|
861
|
+
}));
|
|
862
|
+
}
|
|
863
|
+
}), [a, t])), !c) return null;
|
|
864
|
+
let u = y.createElement(y.Fragment, null, y.createElement(Rt, {
|
|
865
|
+
id: r,
|
|
866
|
+
value: i.draggable
|
|
867
|
+
}), y.createElement(zt, {
|
|
868
|
+
id: s,
|
|
869
|
+
announcement: o
|
|
870
|
+
}));
|
|
871
|
+
return n ? P(u, n) : u;
|
|
872
|
+
}
|
|
873
|
+
var J;
|
|
874
|
+
(function(e) {
|
|
875
|
+
e.DragStart = "dragStart", e.DragMove = "dragMove", e.DragEnd = "dragEnd", e.DragCancel = "dragCancel", e.DragOver = "dragOver", e.RegisterDroppable = "registerDroppable", e.SetDroppableDisabled = "setDroppableDisabled", e.UnregisterDroppable = "unregisterDroppable";
|
|
876
|
+
})(J ||= {});
|
|
877
|
+
function qt() {}
|
|
878
|
+
var Y = /*#__PURE__*/ Object.freeze({
|
|
879
|
+
x: 0,
|
|
880
|
+
y: 0
|
|
881
|
+
});
|
|
882
|
+
function Jt(e, t) {
|
|
883
|
+
return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
884
|
+
}
|
|
885
|
+
function Yt(e, t) {
|
|
886
|
+
let { data: { value: n } } = e, { data: { value: r } } = t;
|
|
887
|
+
return n - r;
|
|
888
|
+
}
|
|
889
|
+
function Xt(e, t) {
|
|
890
|
+
let { data: { value: n } } = e, { data: { value: r } } = t;
|
|
891
|
+
return r - n;
|
|
892
|
+
}
|
|
893
|
+
function Zt(e, t) {
|
|
894
|
+
if (!e || e.length === 0) return null;
|
|
895
|
+
let [n] = e;
|
|
896
|
+
return t ? n[t] : n;
|
|
897
|
+
}
|
|
898
|
+
function Qt(e, t, n) {
|
|
899
|
+
return t === void 0 && (t = e.left), n === void 0 && (n = e.top), {
|
|
900
|
+
x: t + e.width * .5,
|
|
901
|
+
y: n + e.height * .5
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
var $t = (e) => {
|
|
905
|
+
let { collisionRect: t, droppableRects: n, droppableContainers: r } = e, i = Qt(t, t.left, t.top), a = [];
|
|
906
|
+
for (let e of r) {
|
|
907
|
+
let { id: t } = e, r = n.get(t);
|
|
908
|
+
if (r) {
|
|
909
|
+
let n = Jt(Qt(r), i);
|
|
910
|
+
a.push({
|
|
911
|
+
id: t,
|
|
912
|
+
data: {
|
|
913
|
+
droppableContainer: e,
|
|
914
|
+
value: n
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
return a.sort(Yt);
|
|
920
|
+
};
|
|
921
|
+
function en(e, t) {
|
|
922
|
+
let n = Math.max(t.top, e.top), r = Math.max(t.left, e.left), i = Math.min(t.left + t.width, e.left + e.width), a = Math.min(t.top + t.height, e.top + e.height), o = i - r, s = a - n;
|
|
923
|
+
if (r < i && n < a) {
|
|
924
|
+
let n = t.width * t.height, r = e.width * e.height, i = o * s, a = i / (n + r - i);
|
|
925
|
+
return Number(a.toFixed(4));
|
|
926
|
+
}
|
|
927
|
+
return 0;
|
|
928
|
+
}
|
|
929
|
+
var tn = (e) => {
|
|
930
|
+
let { collisionRect: t, droppableRects: n, droppableContainers: r } = e, i = [];
|
|
931
|
+
for (let e of r) {
|
|
932
|
+
let { id: r } = e, a = n.get(r);
|
|
933
|
+
if (a) {
|
|
934
|
+
let n = en(a, t);
|
|
935
|
+
n > 0 && i.push({
|
|
936
|
+
id: r,
|
|
937
|
+
data: {
|
|
938
|
+
droppableContainer: e,
|
|
939
|
+
value: n
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
return i.sort(Xt);
|
|
945
|
+
};
|
|
946
|
+
function nn(e, t, n) {
|
|
947
|
+
return {
|
|
948
|
+
...e,
|
|
949
|
+
scaleX: t && n ? t.width / n.width : 1,
|
|
950
|
+
scaleY: t && n ? t.height / n.height : 1
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
function rn(e, t) {
|
|
954
|
+
return e && t ? {
|
|
955
|
+
x: e.left - t.left,
|
|
956
|
+
y: e.top - t.top
|
|
957
|
+
} : Y;
|
|
958
|
+
}
|
|
959
|
+
function an(e) {
|
|
960
|
+
return function(t) {
|
|
961
|
+
return [...arguments].slice(1).reduce((t, n) => ({
|
|
962
|
+
...t,
|
|
963
|
+
top: t.top + e * n.y,
|
|
964
|
+
bottom: t.bottom + e * n.y,
|
|
965
|
+
left: t.left + e * n.x,
|
|
966
|
+
right: t.right + e * n.x
|
|
967
|
+
}), { ...t });
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
var on = /*#__PURE__*/ an(1);
|
|
971
|
+
function sn(e) {
|
|
972
|
+
if (e.startsWith("matrix3d(")) {
|
|
973
|
+
let t = e.slice(9, -1).split(/, /);
|
|
974
|
+
return {
|
|
975
|
+
x: +t[12],
|
|
976
|
+
y: +t[13],
|
|
977
|
+
scaleX: +t[0],
|
|
978
|
+
scaleY: +t[5]
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
if (e.startsWith("matrix(")) {
|
|
982
|
+
let t = e.slice(7, -1).split(/, /);
|
|
983
|
+
return {
|
|
984
|
+
x: +t[4],
|
|
985
|
+
y: +t[5],
|
|
986
|
+
scaleX: +t[0],
|
|
987
|
+
scaleY: +t[3]
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
return null;
|
|
991
|
+
}
|
|
992
|
+
function cn(e, t, n) {
|
|
993
|
+
let r = sn(t);
|
|
994
|
+
if (!r) return e;
|
|
995
|
+
let { scaleX: i, scaleY: a, x: o, y: s } = r, c = e.left - o - (1 - i) * parseFloat(n), l = e.top - s - (1 - a) * parseFloat(n.slice(n.indexOf(" ") + 1)), u = i ? e.width / i : e.width, d = a ? e.height / a : e.height;
|
|
996
|
+
return {
|
|
997
|
+
width: u,
|
|
998
|
+
height: d,
|
|
999
|
+
top: l,
|
|
1000
|
+
right: c + u,
|
|
1001
|
+
bottom: l + d,
|
|
1002
|
+
left: c
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
var ln = { ignoreTransform: !1 };
|
|
1006
|
+
function un(e, t) {
|
|
1007
|
+
t === void 0 && (t = ln);
|
|
1008
|
+
let n = e.getBoundingClientRect();
|
|
1009
|
+
if (t.ignoreTransform) {
|
|
1010
|
+
let { transform: t, transformOrigin: r } = L(e).getComputedStyle(e);
|
|
1011
|
+
t && (n = cn(n, t, r));
|
|
1012
|
+
}
|
|
1013
|
+
let { top: r, left: i, width: a, height: o, bottom: s, right: c } = n;
|
|
1014
|
+
return {
|
|
1015
|
+
top: r,
|
|
1016
|
+
left: i,
|
|
1017
|
+
width: a,
|
|
1018
|
+
height: o,
|
|
1019
|
+
bottom: s,
|
|
1020
|
+
right: c
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
function dn(e) {
|
|
1024
|
+
return un(e, { ignoreTransform: !0 });
|
|
1025
|
+
}
|
|
1026
|
+
function fn(e) {
|
|
1027
|
+
let t = e.innerWidth, n = e.innerHeight;
|
|
1028
|
+
return {
|
|
1029
|
+
top: 0,
|
|
1030
|
+
left: 0,
|
|
1031
|
+
right: t,
|
|
1032
|
+
bottom: n,
|
|
1033
|
+
width: t,
|
|
1034
|
+
height: n
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
function pn(e, t) {
|
|
1038
|
+
return t === void 0 && (t = L(e).getComputedStyle(e)), t.position === "fixed";
|
|
1039
|
+
}
|
|
1040
|
+
function mn(e, t) {
|
|
1041
|
+
t === void 0 && (t = L(e).getComputedStyle(e));
|
|
1042
|
+
let n = /(auto|scroll|overlay)/;
|
|
1043
|
+
return [
|
|
1044
|
+
"overflow",
|
|
1045
|
+
"overflowX",
|
|
1046
|
+
"overflowY"
|
|
1047
|
+
].some((e) => {
|
|
1048
|
+
let r = t[e];
|
|
1049
|
+
return typeof r == "string" && n.test(r);
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
function hn(e, t) {
|
|
1053
|
+
let n = [];
|
|
1054
|
+
function r(i) {
|
|
1055
|
+
if (t != null && n.length >= t || !i) return n;
|
|
1056
|
+
if (R(i) && i.scrollingElement != null && !n.includes(i.scrollingElement)) return n.push(i.scrollingElement), n;
|
|
1057
|
+
if (!le(i) || z(i) || n.includes(i)) return n;
|
|
1058
|
+
let a = L(e).getComputedStyle(i);
|
|
1059
|
+
return i !== e && mn(i, a) && n.push(i), pn(i, a) ? n : r(i.parentNode);
|
|
1060
|
+
}
|
|
1061
|
+
return e ? r(e) : n;
|
|
1062
|
+
}
|
|
1063
|
+
function gn(e) {
|
|
1064
|
+
let [t] = hn(e, 1);
|
|
1065
|
+
return t ?? null;
|
|
1066
|
+
}
|
|
1067
|
+
function _n(e) {
|
|
1068
|
+
return !F || !e ? null : fe(e) ? e : de(e) ? R(e) || e === I(e).scrollingElement ? window : le(e) ? e : null : null;
|
|
1069
|
+
}
|
|
1070
|
+
function vn(e) {
|
|
1071
|
+
return fe(e) ? e.scrollX : e.scrollLeft;
|
|
1072
|
+
}
|
|
1073
|
+
function yn(e) {
|
|
1074
|
+
return fe(e) ? e.scrollY : e.scrollTop;
|
|
1075
|
+
}
|
|
1076
|
+
function bn(e) {
|
|
1077
|
+
return {
|
|
1078
|
+
x: vn(e),
|
|
1079
|
+
y: yn(e)
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
var X;
|
|
1083
|
+
(function(e) {
|
|
1084
|
+
e[e.Forward = 1] = "Forward", e[e.Backward = -1] = "Backward";
|
|
1085
|
+
})(X ||= {});
|
|
1086
|
+
function xn(e) {
|
|
1087
|
+
return !F || !e ? !1 : e === document.scrollingElement;
|
|
1088
|
+
}
|
|
1089
|
+
function Sn(e) {
|
|
1090
|
+
let t = {
|
|
1091
|
+
x: 0,
|
|
1092
|
+
y: 0
|
|
1093
|
+
}, n = xn(e) ? {
|
|
1094
|
+
height: window.innerHeight,
|
|
1095
|
+
width: window.innerWidth
|
|
1096
|
+
} : {
|
|
1097
|
+
height: e.clientHeight,
|
|
1098
|
+
width: e.clientWidth
|
|
1099
|
+
}, r = {
|
|
1100
|
+
x: e.scrollWidth - n.width,
|
|
1101
|
+
y: e.scrollHeight - n.height
|
|
1102
|
+
};
|
|
1103
|
+
return {
|
|
1104
|
+
isTop: e.scrollTop <= t.y,
|
|
1105
|
+
isLeft: e.scrollLeft <= t.x,
|
|
1106
|
+
isBottom: e.scrollTop >= r.y,
|
|
1107
|
+
isRight: e.scrollLeft >= r.x,
|
|
1108
|
+
maxScroll: r,
|
|
1109
|
+
minScroll: t
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
var Cn = {
|
|
1113
|
+
x: .2,
|
|
1114
|
+
y: .2
|
|
1115
|
+
};
|
|
1116
|
+
function wn(e, t, n, r, i) {
|
|
1117
|
+
let { top: a, left: o, right: s, bottom: c } = n;
|
|
1118
|
+
r === void 0 && (r = 10), i === void 0 && (i = Cn);
|
|
1119
|
+
let { isTop: l, isBottom: u, isLeft: d, isRight: f } = Sn(e), p = {
|
|
1120
|
+
x: 0,
|
|
1121
|
+
y: 0
|
|
1122
|
+
}, m = {
|
|
1123
|
+
x: 0,
|
|
1124
|
+
y: 0
|
|
1125
|
+
}, h = {
|
|
1126
|
+
height: t.height * i.y,
|
|
1127
|
+
width: t.width * i.x
|
|
1128
|
+
};
|
|
1129
|
+
return !l && a <= t.top + h.height ? (p.y = X.Backward, m.y = r * Math.abs((t.top + h.height - a) / h.height)) : !u && c >= t.bottom - h.height && (p.y = X.Forward, m.y = r * Math.abs((t.bottom - h.height - c) / h.height)), !f && s >= t.right - h.width ? (p.x = X.Forward, m.x = r * Math.abs((t.right - h.width - s) / h.width)) : !d && o <= t.left + h.width && (p.x = X.Backward, m.x = r * Math.abs((t.left + h.width - o) / h.width)), {
|
|
1130
|
+
direction: p,
|
|
1131
|
+
speed: m
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
function Tn(e) {
|
|
1135
|
+
if (e === document.scrollingElement) {
|
|
1136
|
+
let { innerWidth: e, innerHeight: t } = window;
|
|
1137
|
+
return {
|
|
1138
|
+
top: 0,
|
|
1139
|
+
left: 0,
|
|
1140
|
+
right: e,
|
|
1141
|
+
bottom: t,
|
|
1142
|
+
width: e,
|
|
1143
|
+
height: t
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
let { top: t, left: n, right: r, bottom: i } = e.getBoundingClientRect();
|
|
1147
|
+
return {
|
|
1148
|
+
top: t,
|
|
1149
|
+
left: n,
|
|
1150
|
+
right: r,
|
|
1151
|
+
bottom: i,
|
|
1152
|
+
width: e.clientWidth,
|
|
1153
|
+
height: e.clientHeight
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
function En(e) {
|
|
1157
|
+
return e.reduce((e, t) => oe(e, bn(t)), Y);
|
|
1158
|
+
}
|
|
1159
|
+
function Dn(e) {
|
|
1160
|
+
return e.reduce((e, t) => e + vn(t), 0);
|
|
1161
|
+
}
|
|
1162
|
+
function On(e) {
|
|
1163
|
+
return e.reduce((e, t) => e + yn(t), 0);
|
|
1164
|
+
}
|
|
1165
|
+
function kn(e, t) {
|
|
1166
|
+
if (t === void 0 && (t = un), !e) return;
|
|
1167
|
+
let { top: n, left: r, bottom: i, right: a } = t(e);
|
|
1168
|
+
gn(e) && (i <= 0 || a <= 0 || n >= window.innerHeight || r >= window.innerWidth) && e.scrollIntoView({
|
|
1169
|
+
block: "center",
|
|
1170
|
+
inline: "center"
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
var An = [[
|
|
1174
|
+
"x",
|
|
1175
|
+
["left", "right"],
|
|
1176
|
+
Dn
|
|
1177
|
+
], [
|
|
1178
|
+
"y",
|
|
1179
|
+
["top", "bottom"],
|
|
1180
|
+
On
|
|
1181
|
+
]], jn = class {
|
|
1182
|
+
constructor(e, t) {
|
|
1183
|
+
this.rect = void 0, this.width = void 0, this.height = void 0, this.top = void 0, this.bottom = void 0, this.right = void 0, this.left = void 0;
|
|
1184
|
+
let n = hn(t), r = En(n);
|
|
1185
|
+
this.rect = { ...e }, this.width = e.width, this.height = e.height;
|
|
1186
|
+
for (let [e, t, i] of An) for (let a of t) Object.defineProperty(this, a, {
|
|
1187
|
+
get: () => {
|
|
1188
|
+
let t = i(n), o = r[e] - t;
|
|
1189
|
+
return this.rect[a] + o;
|
|
1190
|
+
},
|
|
1191
|
+
enumerable: !0
|
|
1192
|
+
});
|
|
1193
|
+
Object.defineProperty(this, "rect", { enumerable: !1 });
|
|
1194
|
+
}
|
|
1195
|
+
}, Mn = class {
|
|
1196
|
+
constructor(e) {
|
|
1197
|
+
this.target = void 0, this.listeners = [], this.removeAll = () => {
|
|
1198
|
+
this.listeners.forEach((e) => this.target?.removeEventListener(...e));
|
|
1199
|
+
}, this.target = e;
|
|
1200
|
+
}
|
|
1201
|
+
add(e, t, n) {
|
|
1202
|
+
var r;
|
|
1203
|
+
(r = this.target) == null || r.addEventListener(e, t, n), this.listeners.push([
|
|
1204
|
+
e,
|
|
1205
|
+
t,
|
|
1206
|
+
n
|
|
1207
|
+
]);
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
function Nn(e) {
|
|
1211
|
+
let { EventTarget: t } = L(e);
|
|
1212
|
+
return e instanceof t ? e : I(e);
|
|
1213
|
+
}
|
|
1214
|
+
function Pn(e, t) {
|
|
1215
|
+
let n = Math.abs(e.x), r = Math.abs(e.y);
|
|
1216
|
+
return typeof t == "number" ? Math.sqrt(n ** 2 + r ** 2) > t : "x" in t && "y" in t ? n > t.x && r > t.y : "x" in t ? n > t.x : "y" in t && r > t.y;
|
|
1217
|
+
}
|
|
1218
|
+
var Z;
|
|
1219
|
+
(function(e) {
|
|
1220
|
+
e.Click = "click", e.DragStart = "dragstart", e.Keydown = "keydown", e.ContextMenu = "contextmenu", e.Resize = "resize", e.SelectionChange = "selectionchange", e.VisibilityChange = "visibilitychange";
|
|
1221
|
+
})(Z ||= {});
|
|
1222
|
+
function Fn(e) {
|
|
1223
|
+
e.preventDefault();
|
|
1224
|
+
}
|
|
1225
|
+
function In(e) {
|
|
1226
|
+
e.stopPropagation();
|
|
1227
|
+
}
|
|
1228
|
+
var Q;
|
|
1229
|
+
(function(e) {
|
|
1230
|
+
e.Space = "Space", e.Down = "ArrowDown", e.Right = "ArrowRight", e.Left = "ArrowLeft", e.Up = "ArrowUp", e.Esc = "Escape", e.Enter = "Enter", e.Tab = "Tab";
|
|
1231
|
+
})(Q ||= {});
|
|
1232
|
+
var Ln = {
|
|
1233
|
+
start: [Q.Space, Q.Enter],
|
|
1234
|
+
cancel: [Q.Esc],
|
|
1235
|
+
end: [
|
|
1236
|
+
Q.Space,
|
|
1237
|
+
Q.Enter,
|
|
1238
|
+
Q.Tab
|
|
1239
|
+
]
|
|
1240
|
+
}, Rn = (e, t) => {
|
|
1241
|
+
let { currentCoordinates: n } = t;
|
|
1242
|
+
switch (e.code) {
|
|
1243
|
+
case Q.Right: return {
|
|
1244
|
+
...n,
|
|
1245
|
+
x: n.x + 25
|
|
1246
|
+
};
|
|
1247
|
+
case Q.Left: return {
|
|
1248
|
+
...n,
|
|
1249
|
+
x: n.x - 25
|
|
1250
|
+
};
|
|
1251
|
+
case Q.Down: return {
|
|
1252
|
+
...n,
|
|
1253
|
+
y: n.y + 25
|
|
1254
|
+
};
|
|
1255
|
+
case Q.Up: return {
|
|
1256
|
+
...n,
|
|
1257
|
+
y: n.y - 25
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
}, zn = class {
|
|
1261
|
+
constructor(e) {
|
|
1262
|
+
this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = e;
|
|
1263
|
+
let { event: { target: t } } = e;
|
|
1264
|
+
this.props = e, this.listeners = new Mn(I(t)), this.windowListeners = new Mn(L(t)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
|
|
1265
|
+
}
|
|
1266
|
+
attach() {
|
|
1267
|
+
this.handleStart(), this.windowListeners.add(Z.Resize, this.handleCancel), this.windowListeners.add(Z.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(Z.Keydown, this.handleKeyDown));
|
|
1268
|
+
}
|
|
1269
|
+
handleStart() {
|
|
1270
|
+
let { activeNode: e, onStart: t } = this.props, n = e.node.current;
|
|
1271
|
+
n && kn(n), t(Y);
|
|
1272
|
+
}
|
|
1273
|
+
handleKeyDown(e) {
|
|
1274
|
+
if (ue(e)) {
|
|
1275
|
+
let { active: t, context: n, options: r } = this.props, { keyboardCodes: i = Ln, coordinateGetter: a = Rn, scrollBehavior: o = "smooth" } = r, { code: s } = e;
|
|
1276
|
+
if (i.end.includes(s)) {
|
|
1277
|
+
this.handleEnd(e);
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
if (i.cancel.includes(s)) {
|
|
1281
|
+
this.handleCancel(e);
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
let { collisionRect: c } = n.current, l = c ? {
|
|
1285
|
+
x: c.left,
|
|
1286
|
+
y: c.top
|
|
1287
|
+
} : Y;
|
|
1288
|
+
this.referenceCoordinates ||= l;
|
|
1289
|
+
let u = a(e, {
|
|
1290
|
+
active: t,
|
|
1291
|
+
context: n.current,
|
|
1292
|
+
currentCoordinates: l
|
|
1293
|
+
});
|
|
1294
|
+
if (u) {
|
|
1295
|
+
let t = B(u, l), r = {
|
|
1296
|
+
x: 0,
|
|
1297
|
+
y: 0
|
|
1298
|
+
}, { scrollableAncestors: i } = n.current;
|
|
1299
|
+
for (let n of i) {
|
|
1300
|
+
let i = e.code, { isTop: a, isRight: s, isLeft: c, isBottom: l, maxScroll: d, minScroll: f } = Sn(n), p = Tn(n), m = {
|
|
1301
|
+
x: Math.min(i === Q.Right ? p.right - p.width / 2 : p.right, Math.max(i === Q.Right ? p.left : p.left + p.width / 2, u.x)),
|
|
1302
|
+
y: Math.min(i === Q.Down ? p.bottom - p.height / 2 : p.bottom, Math.max(i === Q.Down ? p.top : p.top + p.height / 2, u.y))
|
|
1303
|
+
}, h = i === Q.Right && !s || i === Q.Left && !c, g = i === Q.Down && !l || i === Q.Up && !a;
|
|
1304
|
+
if (h && m.x !== u.x) {
|
|
1305
|
+
let e = n.scrollLeft + t.x, a = i === Q.Right && e <= d.x || i === Q.Left && e >= f.x;
|
|
1306
|
+
if (a && !t.y) {
|
|
1307
|
+
n.scrollTo({
|
|
1308
|
+
left: e,
|
|
1309
|
+
behavior: o
|
|
1310
|
+
});
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
r.x = a ? n.scrollLeft - e : i === Q.Right ? n.scrollLeft - d.x : n.scrollLeft - f.x, r.x && n.scrollBy({
|
|
1314
|
+
left: -r.x,
|
|
1315
|
+
behavior: o
|
|
1316
|
+
});
|
|
1317
|
+
break;
|
|
1318
|
+
}
|
|
1319
|
+
if (g && m.y !== u.y) {
|
|
1320
|
+
let e = n.scrollTop + t.y, a = i === Q.Down && e <= d.y || i === Q.Up && e >= f.y;
|
|
1321
|
+
if (a && !t.x) {
|
|
1322
|
+
n.scrollTo({
|
|
1323
|
+
top: e,
|
|
1324
|
+
behavior: o
|
|
1325
|
+
});
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
r.y = a ? n.scrollTop - e : i === Q.Down ? n.scrollTop - d.y : n.scrollTop - f.y, r.y && n.scrollBy({
|
|
1329
|
+
top: -r.y,
|
|
1330
|
+
behavior: o
|
|
1331
|
+
});
|
|
1332
|
+
break;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
this.handleMove(e, oe(B(u, this.referenceCoordinates), r));
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
handleMove(e, t) {
|
|
1340
|
+
let { onMove: n } = this.props;
|
|
1341
|
+
e.preventDefault(), n(t);
|
|
1342
|
+
}
|
|
1343
|
+
handleEnd(e) {
|
|
1344
|
+
let { onEnd: t } = this.props;
|
|
1345
|
+
e.preventDefault(), this.detach(), t();
|
|
1346
|
+
}
|
|
1347
|
+
handleCancel(e) {
|
|
1348
|
+
let { onCancel: t } = this.props;
|
|
1349
|
+
e.preventDefault(), this.detach(), t();
|
|
1350
|
+
}
|
|
1351
|
+
detach() {
|
|
1352
|
+
this.listeners.removeAll(), this.windowListeners.removeAll();
|
|
1353
|
+
}
|
|
1354
|
+
};
|
|
1355
|
+
zn.activators = [{
|
|
1356
|
+
eventName: "onKeyDown",
|
|
1357
|
+
handler: (e, t, n) => {
|
|
1358
|
+
let { keyboardCodes: r = Ln, onActivation: i } = t, { active: a } = n, { code: o } = e.nativeEvent;
|
|
1359
|
+
if (r.start.includes(o)) {
|
|
1360
|
+
let t = a.activatorNode.current;
|
|
1361
|
+
return t && e.target !== t ? !1 : (e.preventDefault(), i?.({ event: e.nativeEvent }), !0);
|
|
1362
|
+
}
|
|
1363
|
+
return !1;
|
|
1364
|
+
}
|
|
1365
|
+
}];
|
|
1366
|
+
function Bn(e) {
|
|
1367
|
+
return !!(e && "distance" in e);
|
|
1368
|
+
}
|
|
1369
|
+
function Vn(e) {
|
|
1370
|
+
return !!(e && "delay" in e);
|
|
1371
|
+
}
|
|
1372
|
+
var Hn = class {
|
|
1373
|
+
constructor(e, t, n) {
|
|
1374
|
+
n === void 0 && (n = Nn(e.event.target)), this.props = void 0, this.events = void 0, this.autoScrollEnabled = !0, this.document = void 0, this.activated = !1, this.initialCoordinates = void 0, this.timeoutId = null, this.listeners = void 0, this.documentListeners = void 0, this.windowListeners = void 0, this.props = e, this.events = t;
|
|
1375
|
+
let { event: r } = e, { target: i } = r;
|
|
1376
|
+
this.props = e, this.events = t, this.document = I(i), this.documentListeners = new Mn(this.document), this.listeners = new Mn(n), this.windowListeners = new Mn(L(i)), this.initialCoordinates = ce(r) ?? Y, this.handleStart = this.handleStart.bind(this), this.handleMove = this.handleMove.bind(this), this.handleEnd = this.handleEnd.bind(this), this.handleCancel = this.handleCancel.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.removeTextSelection = this.removeTextSelection.bind(this), this.attach();
|
|
1377
|
+
}
|
|
1378
|
+
attach() {
|
|
1379
|
+
let { events: e, props: { options: { activationConstraint: t, bypassActivationConstraint: n } } } = this;
|
|
1380
|
+
if (this.listeners.add(e.move.name, this.handleMove, { passive: !1 }), this.listeners.add(e.end.name, this.handleEnd), e.cancel && this.listeners.add(e.cancel.name, this.handleCancel), this.windowListeners.add(Z.Resize, this.handleCancel), this.windowListeners.add(Z.DragStart, Fn), this.windowListeners.add(Z.VisibilityChange, this.handleCancel), this.windowListeners.add(Z.ContextMenu, Fn), this.documentListeners.add(Z.Keydown, this.handleKeydown), t) {
|
|
1381
|
+
if (n != null && n({
|
|
1382
|
+
event: this.props.event,
|
|
1383
|
+
activeNode: this.props.activeNode,
|
|
1384
|
+
options: this.props.options
|
|
1385
|
+
})) return this.handleStart();
|
|
1386
|
+
if (Vn(t)) {
|
|
1387
|
+
this.timeoutId = setTimeout(this.handleStart, t.delay), this.handlePending(t);
|
|
1388
|
+
return;
|
|
1389
|
+
}
|
|
1390
|
+
if (Bn(t)) {
|
|
1391
|
+
this.handlePending(t);
|
|
1392
|
+
return;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
this.handleStart();
|
|
1396
|
+
}
|
|
1397
|
+
detach() {
|
|
1398
|
+
this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null);
|
|
1399
|
+
}
|
|
1400
|
+
handlePending(e, t) {
|
|
1401
|
+
let { active: n, onPending: r } = this.props;
|
|
1402
|
+
r(n, e, this.initialCoordinates, t);
|
|
1403
|
+
}
|
|
1404
|
+
handleStart() {
|
|
1405
|
+
let { initialCoordinates: e } = this, { onStart: t } = this.props;
|
|
1406
|
+
e && (this.activated = !0, this.documentListeners.add(Z.Click, In, { capture: !0 }), this.removeTextSelection(), this.documentListeners.add(Z.SelectionChange, this.removeTextSelection), t(e));
|
|
1407
|
+
}
|
|
1408
|
+
handleMove(e) {
|
|
1409
|
+
let { activated: t, initialCoordinates: n, props: r } = this, { onMove: i, options: { activationConstraint: a } } = r;
|
|
1410
|
+
if (!n) return;
|
|
1411
|
+
let o = ce(e) ?? Y, s = B(n, o);
|
|
1412
|
+
if (!t && a) {
|
|
1413
|
+
if (Bn(a)) {
|
|
1414
|
+
if (a.tolerance != null && Pn(s, a.tolerance)) return this.handleCancel();
|
|
1415
|
+
if (Pn(s, a.distance)) return this.handleStart();
|
|
1416
|
+
}
|
|
1417
|
+
if (Vn(a) && Pn(s, a.tolerance)) return this.handleCancel();
|
|
1418
|
+
this.handlePending(a, s);
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
e.cancelable && e.preventDefault(), i(o);
|
|
1422
|
+
}
|
|
1423
|
+
handleEnd() {
|
|
1424
|
+
let { onAbort: e, onEnd: t } = this.props;
|
|
1425
|
+
this.detach(), this.activated || e(this.props.active), t();
|
|
1426
|
+
}
|
|
1427
|
+
handleCancel() {
|
|
1428
|
+
let { onAbort: e, onCancel: t } = this.props;
|
|
1429
|
+
this.detach(), this.activated || e(this.props.active), t();
|
|
1430
|
+
}
|
|
1431
|
+
handleKeydown(e) {
|
|
1432
|
+
e.code === Q.Esc && this.handleCancel();
|
|
1433
|
+
}
|
|
1434
|
+
removeTextSelection() {
|
|
1435
|
+
var e;
|
|
1436
|
+
(e = this.document.getSelection()) == null || e.removeAllRanges();
|
|
1437
|
+
}
|
|
1438
|
+
}, Un = {
|
|
1439
|
+
cancel: { name: "pointercancel" },
|
|
1440
|
+
move: { name: "pointermove" },
|
|
1441
|
+
end: { name: "pointerup" }
|
|
1442
|
+
}, Wn = class extends Hn {
|
|
1443
|
+
constructor(e) {
|
|
1444
|
+
let { event: t } = e, n = I(t.target);
|
|
1445
|
+
super(e, Un, n);
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
Wn.activators = [{
|
|
1449
|
+
eventName: "onPointerDown",
|
|
1450
|
+
handler: (e, t) => {
|
|
1451
|
+
let { nativeEvent: n } = e, { onActivation: r } = t;
|
|
1452
|
+
return !n.isPrimary || n.button !== 0 ? !1 : (r?.({ event: n }), !0);
|
|
1453
|
+
}
|
|
1454
|
+
}];
|
|
1455
|
+
var Gn = {
|
|
1456
|
+
move: { name: "mousemove" },
|
|
1457
|
+
end: { name: "mouseup" }
|
|
1458
|
+
}, Kn;
|
|
1459
|
+
(function(e) {
|
|
1460
|
+
e[e.RightClick = 2] = "RightClick";
|
|
1461
|
+
})(Kn ||= {});
|
|
1462
|
+
var qn = class extends Hn {
|
|
1463
|
+
constructor(e) {
|
|
1464
|
+
super(e, Gn, I(e.event.target));
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
qn.activators = [{
|
|
1468
|
+
eventName: "onMouseDown",
|
|
1469
|
+
handler: (e, t) => {
|
|
1470
|
+
let { nativeEvent: n } = e, { onActivation: r } = t;
|
|
1471
|
+
return n.button !== Kn.RightClick && (r?.({ event: n }), !0);
|
|
1472
|
+
}
|
|
1473
|
+
}];
|
|
1474
|
+
var Jn = {
|
|
1475
|
+
cancel: { name: "touchcancel" },
|
|
1476
|
+
move: { name: "touchmove" },
|
|
1477
|
+
end: { name: "touchend" }
|
|
1478
|
+
}, Yn = class extends Hn {
|
|
1479
|
+
constructor(e) {
|
|
1480
|
+
super(e, Jn);
|
|
1481
|
+
}
|
|
1482
|
+
static setup() {
|
|
1483
|
+
return window.addEventListener(Jn.move.name, e, {
|
|
1484
|
+
capture: !1,
|
|
1485
|
+
passive: !1
|
|
1486
|
+
}), function() {
|
|
1487
|
+
window.removeEventListener(Jn.move.name, e);
|
|
1488
|
+
};
|
|
1489
|
+
function e() {}
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1492
|
+
Yn.activators = [{
|
|
1493
|
+
eventName: "onTouchStart",
|
|
1494
|
+
handler: (e, t) => {
|
|
1495
|
+
let { nativeEvent: n } = e, { onActivation: r } = t, { touches: i } = n;
|
|
1496
|
+
return i.length > 1 ? !1 : (r?.({ event: n }), !0);
|
|
1497
|
+
}
|
|
1498
|
+
}];
|
|
1499
|
+
var Xn;
|
|
1500
|
+
(function(e) {
|
|
1501
|
+
e[e.Pointer = 0] = "Pointer", e[e.DraggableRect = 1] = "DraggableRect";
|
|
1502
|
+
})(Xn ||= {});
|
|
1503
|
+
var Zn;
|
|
1504
|
+
(function(e) {
|
|
1505
|
+
e[e.TreeOrder = 0] = "TreeOrder", e[e.ReversedTreeOrder = 1] = "ReversedTreeOrder";
|
|
1506
|
+
})(Zn ||= {});
|
|
1507
|
+
function Qn(e) {
|
|
1508
|
+
let { acceleration: t, activator: n = Xn.Pointer, canScroll: r, draggingRect: i, enabled: a, interval: o = 5, order: s = Zn.TreeOrder, pointerCoordinates: c, scrollableAncestors: l, scrollableAncestorRects: u, delta: d, threshold: f } = e, p = er({
|
|
1509
|
+
delta: d,
|
|
1510
|
+
disabled: !a
|
|
1511
|
+
}), [m, h] = V(), g = E({
|
|
1512
|
+
x: 0,
|
|
1513
|
+
y: 0
|
|
1514
|
+
}), _ = E({
|
|
1515
|
+
x: 0,
|
|
1516
|
+
y: 0
|
|
1517
|
+
}), v = T(() => {
|
|
1518
|
+
switch (n) {
|
|
1519
|
+
case Xn.Pointer: return c ? {
|
|
1520
|
+
top: c.y,
|
|
1521
|
+
bottom: c.y,
|
|
1522
|
+
left: c.x,
|
|
1523
|
+
right: c.x
|
|
1524
|
+
} : null;
|
|
1525
|
+
case Xn.DraggableRect: return i;
|
|
1526
|
+
}
|
|
1527
|
+
}, [
|
|
1528
|
+
n,
|
|
1529
|
+
i,
|
|
1530
|
+
c
|
|
1531
|
+
]), y = E(null), b = S(() => {
|
|
1532
|
+
let e = y.current;
|
|
1533
|
+
if (!e) return;
|
|
1534
|
+
let t = g.current.x * _.current.x, n = g.current.y * _.current.y;
|
|
1535
|
+
e.scrollBy(t, n);
|
|
1536
|
+
}, []), x = T(() => s === Zn.TreeOrder ? [...l].reverse() : l, [s, l]);
|
|
1537
|
+
w(() => {
|
|
1538
|
+
if (!a || !l.length || !v) {
|
|
1539
|
+
h();
|
|
1540
|
+
return;
|
|
1541
|
+
}
|
|
1542
|
+
for (let e of x) {
|
|
1543
|
+
if (r?.(e) === !1) continue;
|
|
1544
|
+
let n = l.indexOf(e), i = u[n];
|
|
1545
|
+
if (!i) continue;
|
|
1546
|
+
let { direction: a, speed: s } = wn(e, i, v, t, f);
|
|
1547
|
+
for (let e of ["x", "y"]) p[e][a[e]] || (s[e] = 0, a[e] = 0);
|
|
1548
|
+
if (s.x > 0 || s.y > 0) {
|
|
1549
|
+
h(), y.current = e, m(b, o), g.current = s, _.current = a;
|
|
1550
|
+
return;
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
g.current = {
|
|
1554
|
+
x: 0,
|
|
1555
|
+
y: 0
|
|
1556
|
+
}, _.current = {
|
|
1557
|
+
x: 0,
|
|
1558
|
+
y: 0
|
|
1559
|
+
}, h();
|
|
1560
|
+
}, [
|
|
1561
|
+
t,
|
|
1562
|
+
b,
|
|
1563
|
+
r,
|
|
1564
|
+
h,
|
|
1565
|
+
a,
|
|
1566
|
+
o,
|
|
1567
|
+
JSON.stringify(v),
|
|
1568
|
+
JSON.stringify(p),
|
|
1569
|
+
m,
|
|
1570
|
+
l,
|
|
1571
|
+
x,
|
|
1572
|
+
u,
|
|
1573
|
+
JSON.stringify(f)
|
|
1574
|
+
]);
|
|
1575
|
+
}
|
|
1576
|
+
var $n = {
|
|
1577
|
+
x: {
|
|
1578
|
+
[X.Backward]: !1,
|
|
1579
|
+
[X.Forward]: !1
|
|
1580
|
+
},
|
|
1581
|
+
y: {
|
|
1582
|
+
[X.Backward]: !1,
|
|
1583
|
+
[X.Forward]: !1
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
function er(e) {
|
|
1587
|
+
let { delta: t, disabled: n } = e, r = ge(t);
|
|
1588
|
+
return H((e) => {
|
|
1589
|
+
if (n || !r || !e) return $n;
|
|
1590
|
+
let i = {
|
|
1591
|
+
x: Math.sign(t.x - r.x),
|
|
1592
|
+
y: Math.sign(t.y - r.y)
|
|
1593
|
+
};
|
|
1594
|
+
return {
|
|
1595
|
+
x: {
|
|
1596
|
+
[X.Backward]: e.x[X.Backward] || i.x === -1,
|
|
1597
|
+
[X.Forward]: e.x[X.Forward] || i.x === 1
|
|
1598
|
+
},
|
|
1599
|
+
y: {
|
|
1600
|
+
[X.Backward]: e.y[X.Backward] || i.y === -1,
|
|
1601
|
+
[X.Forward]: e.y[X.Forward] || i.y === 1
|
|
1602
|
+
}
|
|
1603
|
+
};
|
|
1604
|
+
}, [
|
|
1605
|
+
n,
|
|
1606
|
+
t,
|
|
1607
|
+
r
|
|
1608
|
+
]);
|
|
1609
|
+
}
|
|
1610
|
+
function tr(e, t) {
|
|
1611
|
+
let n = t == null ? void 0 : e.get(t), r = n ? n.node.current : null;
|
|
1612
|
+
return H((e) => t == null ? null : r ?? e ?? null, [r, t]);
|
|
1613
|
+
}
|
|
1614
|
+
function nr(e, t) {
|
|
1615
|
+
return T(() => e.reduce((e, n) => {
|
|
1616
|
+
let { sensor: r } = n, i = r.activators.map((e) => ({
|
|
1617
|
+
eventName: e.eventName,
|
|
1618
|
+
handler: t(e.handler, n)
|
|
1619
|
+
}));
|
|
1620
|
+
return [...e, ...i];
|
|
1621
|
+
}, []), [e, t]);
|
|
1622
|
+
}
|
|
1623
|
+
var rr;
|
|
1624
|
+
(function(e) {
|
|
1625
|
+
e[e.Always = 0] = "Always", e[e.BeforeDragging = 1] = "BeforeDragging", e[e.WhileDragging = 2] = "WhileDragging";
|
|
1626
|
+
})(rr ||= {});
|
|
1627
|
+
var ir;
|
|
1628
|
+
(function(e) {
|
|
1629
|
+
e.Optimized = "optimized";
|
|
1630
|
+
})(ir ||= {});
|
|
1631
|
+
var ar = /*#__PURE__*/ new Map();
|
|
1632
|
+
function or(e, t) {
|
|
1633
|
+
let { dragging: n, dependencies: r, config: i } = t, [a, o] = D(null), { frequency: s, measure: c, strategy: l } = i, u = E(e), d = g(), f = he(d), p = S(function(e) {
|
|
1634
|
+
e === void 0 && (e = []), !f.current && o((t) => t === null ? e : t.concat(e.filter((e) => !t.includes(e))));
|
|
1635
|
+
}, [f]), m = E(null), h = H((t) => {
|
|
1636
|
+
if (d && !n) return ar;
|
|
1637
|
+
if (!t || t === ar || u.current !== e || a != null) {
|
|
1638
|
+
let t = /* @__PURE__ */ new Map();
|
|
1639
|
+
for (let n of e) {
|
|
1640
|
+
if (!n) continue;
|
|
1641
|
+
if (a && a.length > 0 && !a.includes(n.id) && n.rect.current) {
|
|
1642
|
+
t.set(n.id, n.rect.current);
|
|
1643
|
+
continue;
|
|
1644
|
+
}
|
|
1645
|
+
let e = n.node.current, r = e ? new jn(c(e), e) : null;
|
|
1646
|
+
n.rect.current = r, r && t.set(n.id, r);
|
|
1647
|
+
}
|
|
1648
|
+
return t;
|
|
1649
|
+
}
|
|
1650
|
+
return t;
|
|
1651
|
+
}, [
|
|
1652
|
+
e,
|
|
1653
|
+
a,
|
|
1654
|
+
n,
|
|
1655
|
+
d,
|
|
1656
|
+
c
|
|
1657
|
+
]);
|
|
1658
|
+
return w(() => {
|
|
1659
|
+
u.current = e;
|
|
1660
|
+
}, [e]), w(() => {
|
|
1661
|
+
d || p();
|
|
1662
|
+
}, [n, d]), w(() => {
|
|
1663
|
+
a && a.length > 0 && o(null);
|
|
1664
|
+
}, [JSON.stringify(a)]), w(() => {
|
|
1665
|
+
d || typeof s != "number" || m.current !== null || (m.current = setTimeout(() => {
|
|
1666
|
+
p(), m.current = null;
|
|
1667
|
+
}, s));
|
|
1668
|
+
}, [
|
|
1669
|
+
s,
|
|
1670
|
+
d,
|
|
1671
|
+
p,
|
|
1672
|
+
...r
|
|
1673
|
+
]), {
|
|
1674
|
+
droppableRects: h,
|
|
1675
|
+
measureDroppableContainers: p,
|
|
1676
|
+
measuringScheduled: a != null
|
|
1677
|
+
};
|
|
1678
|
+
function g() {
|
|
1679
|
+
switch (l) {
|
|
1680
|
+
case rr.Always: return !1;
|
|
1681
|
+
case rr.BeforeDragging: return n;
|
|
1682
|
+
default: return !n;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
function sr(e, t) {
|
|
1687
|
+
return H((n) => e ? n || (typeof t == "function" ? t(e) : e) : null, [t, e]);
|
|
1688
|
+
}
|
|
1689
|
+
function cr(e, t) {
|
|
1690
|
+
return sr(e, t);
|
|
1691
|
+
}
|
|
1692
|
+
function lr(e) {
|
|
1693
|
+
let { callback: t, disabled: n } = e, r = pe(t), i = T(() => {
|
|
1694
|
+
if (n || typeof window > "u" || window.MutationObserver === void 0) return;
|
|
1695
|
+
let { MutationObserver: e } = window;
|
|
1696
|
+
return new e(r);
|
|
1697
|
+
}, [r, n]);
|
|
1698
|
+
return w(() => () => i?.disconnect(), [i]), i;
|
|
1699
|
+
}
|
|
1700
|
+
function ur(e) {
|
|
1701
|
+
let { callback: t, disabled: n } = e, r = pe(t), i = T(() => {
|
|
1702
|
+
if (n || typeof window > "u" || window.ResizeObserver === void 0) return;
|
|
1703
|
+
let { ResizeObserver: e } = window;
|
|
1704
|
+
return new e(r);
|
|
1705
|
+
}, [n]);
|
|
1706
|
+
return w(() => () => i?.disconnect(), [i]), i;
|
|
1707
|
+
}
|
|
1708
|
+
function dr(e) {
|
|
1709
|
+
return new jn(un(e), e);
|
|
1710
|
+
}
|
|
1711
|
+
function fr(e, t, n) {
|
|
1712
|
+
t === void 0 && (t = dr);
|
|
1713
|
+
let [r, i] = D(null);
|
|
1714
|
+
function a() {
|
|
1715
|
+
i((r) => {
|
|
1716
|
+
if (!e) return null;
|
|
1717
|
+
if (e.isConnected === !1) return r ?? n ?? null;
|
|
1718
|
+
let i = t(e);
|
|
1719
|
+
return JSON.stringify(r) === JSON.stringify(i) ? r : i;
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
let o = lr({ callback(t) {
|
|
1723
|
+
if (e) for (let n of t) {
|
|
1724
|
+
let { type: t, target: r } = n;
|
|
1725
|
+
if (t === "childList" && r instanceof HTMLElement && r.contains(e)) {
|
|
1726
|
+
a();
|
|
1727
|
+
break;
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
} }), s = ur({ callback: a });
|
|
1731
|
+
return me(() => {
|
|
1732
|
+
a(), e ? (s?.observe(e), o?.observe(document.body, {
|
|
1733
|
+
childList: !0,
|
|
1734
|
+
subtree: !0
|
|
1735
|
+
})) : (s?.disconnect(), o?.disconnect());
|
|
1736
|
+
}, [e]), r;
|
|
1737
|
+
}
|
|
1738
|
+
function pr(e) {
|
|
1739
|
+
return rn(e, sr(e));
|
|
1740
|
+
}
|
|
1741
|
+
var mr = [];
|
|
1742
|
+
function hr(e) {
|
|
1743
|
+
let t = E(e), n = H((n) => e ? n && n !== mr && e && t.current && e.parentNode === t.current.parentNode ? n : hn(e) : mr, [e]);
|
|
1744
|
+
return w(() => {
|
|
1745
|
+
t.current = e;
|
|
1746
|
+
}, [e]), n;
|
|
1747
|
+
}
|
|
1748
|
+
function gr(e) {
|
|
1749
|
+
let [t, n] = D(null), r = E(e), i = S((e) => {
|
|
1750
|
+
let t = _n(e.target);
|
|
1751
|
+
t && n((e) => e ? (e.set(t, bn(t)), new Map(e)) : null);
|
|
1752
|
+
}, []);
|
|
1753
|
+
return w(() => {
|
|
1754
|
+
let t = r.current;
|
|
1755
|
+
if (e !== t) {
|
|
1756
|
+
a(t);
|
|
1757
|
+
let o = e.map((e) => {
|
|
1758
|
+
let t = _n(e);
|
|
1759
|
+
return t ? (t.addEventListener("scroll", i, { passive: !0 }), [t, bn(t)]) : null;
|
|
1760
|
+
}).filter((e) => e != null);
|
|
1761
|
+
n(o.length ? new Map(o) : null), r.current = e;
|
|
1762
|
+
}
|
|
1763
|
+
return () => {
|
|
1764
|
+
a(e), a(t);
|
|
1765
|
+
};
|
|
1766
|
+
function a(e) {
|
|
1767
|
+
e.forEach((e) => {
|
|
1768
|
+
_n(e)?.removeEventListener("scroll", i);
|
|
1769
|
+
});
|
|
1770
|
+
}
|
|
1771
|
+
}, [i, e]), T(() => e.length ? t ? Array.from(t.values()).reduce((e, t) => oe(e, t), Y) : En(e) : Y, [e, t]);
|
|
1772
|
+
}
|
|
1773
|
+
function _r(e, t) {
|
|
1774
|
+
t === void 0 && (t = []);
|
|
1775
|
+
let n = E(null);
|
|
1776
|
+
return w(() => {
|
|
1777
|
+
n.current = null;
|
|
1778
|
+
}, t), w(() => {
|
|
1779
|
+
let t = e !== Y;
|
|
1780
|
+
t && !n.current && (n.current = e), !t && n.current && (n.current = null);
|
|
1781
|
+
}, [e]), n.current ? B(e, n.current) : Y;
|
|
1782
|
+
}
|
|
1783
|
+
function vr(e) {
|
|
1784
|
+
w(() => {
|
|
1785
|
+
if (!F) return;
|
|
1786
|
+
let t = e.map((e) => {
|
|
1787
|
+
let { sensor: t } = e;
|
|
1788
|
+
return t.setup == null ? void 0 : t.setup();
|
|
1789
|
+
});
|
|
1790
|
+
return () => {
|
|
1791
|
+
for (let e of t) e?.();
|
|
1792
|
+
};
|
|
1793
|
+
}, e.map((e) => {
|
|
1794
|
+
let { sensor: t } = e;
|
|
1795
|
+
return t;
|
|
1796
|
+
}));
|
|
1797
|
+
}
|
|
1798
|
+
function yr(e) {
|
|
1799
|
+
return T(() => e ? fn(e) : null, [e]);
|
|
1800
|
+
}
|
|
1801
|
+
var br = [];
|
|
1802
|
+
function xr(e, t) {
|
|
1803
|
+
t === void 0 && (t = un);
|
|
1804
|
+
let [n] = e, r = yr(n ? L(n) : null), [i, a] = D(br);
|
|
1805
|
+
function o() {
|
|
1806
|
+
a(() => e.length ? e.map((e) => xn(e) ? r : new jn(t(e), e)) : br);
|
|
1807
|
+
}
|
|
1808
|
+
let s = ur({ callback: o });
|
|
1809
|
+
return me(() => {
|
|
1810
|
+
s?.disconnect(), o(), e.forEach((e) => s?.observe(e));
|
|
1811
|
+
}, [e]), i;
|
|
1812
|
+
}
|
|
1813
|
+
function Sr(e) {
|
|
1814
|
+
if (!e) return null;
|
|
1815
|
+
if (e.children.length > 1) return e;
|
|
1816
|
+
let t = e.children[0];
|
|
1817
|
+
return le(t) ? t : e;
|
|
1818
|
+
}
|
|
1819
|
+
function Cr(e) {
|
|
1820
|
+
let { measure: t } = e, [n, r] = D(null), i = ur({ callback: S((e) => {
|
|
1821
|
+
for (let { target: n } of e) if (le(n)) {
|
|
1822
|
+
r((e) => {
|
|
1823
|
+
let r = t(n);
|
|
1824
|
+
return e ? {
|
|
1825
|
+
...e,
|
|
1826
|
+
width: r.width,
|
|
1827
|
+
height: r.height
|
|
1828
|
+
} : r;
|
|
1829
|
+
});
|
|
1830
|
+
break;
|
|
1831
|
+
}
|
|
1832
|
+
}, [t]) }), a = S((e) => {
|
|
1833
|
+
let n = Sr(e);
|
|
1834
|
+
i?.disconnect(), n && i?.observe(n), r(n ? t(n) : null);
|
|
1835
|
+
}, [t, i]), [o, s] = U(a);
|
|
1836
|
+
return T(() => ({
|
|
1837
|
+
nodeRef: o,
|
|
1838
|
+
rect: n,
|
|
1839
|
+
setRef: s
|
|
1840
|
+
}), [
|
|
1841
|
+
n,
|
|
1842
|
+
o,
|
|
1843
|
+
s
|
|
1844
|
+
]);
|
|
1845
|
+
}
|
|
1846
|
+
var wr = [{
|
|
1847
|
+
sensor: Wn,
|
|
1848
|
+
options: {}
|
|
1849
|
+
}, {
|
|
1850
|
+
sensor: zn,
|
|
1851
|
+
options: {}
|
|
1852
|
+
}], Tr = { current: {} }, Er = {
|
|
1853
|
+
draggable: { measure: dn },
|
|
1854
|
+
droppable: {
|
|
1855
|
+
measure: dn,
|
|
1856
|
+
strategy: rr.WhileDragging,
|
|
1857
|
+
frequency: ir.Optimized
|
|
1858
|
+
},
|
|
1859
|
+
dragOverlay: { measure: un }
|
|
1860
|
+
}, Dr = class extends Map {
|
|
1861
|
+
get(e) {
|
|
1862
|
+
return e == null ? void 0 : super.get(e) ?? void 0;
|
|
1863
|
+
}
|
|
1864
|
+
toArray() {
|
|
1865
|
+
return Array.from(this.values());
|
|
1866
|
+
}
|
|
1867
|
+
getEnabled() {
|
|
1868
|
+
return this.toArray().filter((e) => {
|
|
1869
|
+
let { disabled: t } = e;
|
|
1870
|
+
return !t;
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
getNodeFor(e) {
|
|
1874
|
+
return this.get(e)?.node.current ?? void 0;
|
|
1875
|
+
}
|
|
1876
|
+
}, Or = {
|
|
1877
|
+
activatorEvent: null,
|
|
1878
|
+
active: null,
|
|
1879
|
+
activeNode: null,
|
|
1880
|
+
activeNodeRect: null,
|
|
1881
|
+
collisions: null,
|
|
1882
|
+
containerNodeRect: null,
|
|
1883
|
+
draggableNodes: /*#__PURE__*/ new Map(),
|
|
1884
|
+
droppableRects: /*#__PURE__*/ new Map(),
|
|
1885
|
+
droppableContainers: /*#__PURE__*/ new Dr(),
|
|
1886
|
+
over: null,
|
|
1887
|
+
dragOverlay: {
|
|
1888
|
+
nodeRef: { current: null },
|
|
1889
|
+
rect: null,
|
|
1890
|
+
setRef: qt
|
|
1891
|
+
},
|
|
1892
|
+
scrollableAncestors: [],
|
|
1893
|
+
scrollableAncestorRects: [],
|
|
1894
|
+
measuringConfiguration: Er,
|
|
1895
|
+
measureDroppableContainers: qt,
|
|
1896
|
+
windowRect: null,
|
|
1897
|
+
measuringScheduled: !1
|
|
1898
|
+
}, kr = /*#__PURE__*/ b({
|
|
1899
|
+
activatorEvent: null,
|
|
1900
|
+
activators: [],
|
|
1901
|
+
active: null,
|
|
1902
|
+
activeNodeRect: null,
|
|
1903
|
+
ariaDescribedById: { draggable: "" },
|
|
1904
|
+
dispatch: qt,
|
|
1905
|
+
draggableNodes: /*#__PURE__*/ new Map(),
|
|
1906
|
+
over: null,
|
|
1907
|
+
measureDroppableContainers: qt
|
|
1908
|
+
}), Ar = /*#__PURE__*/ b(Or);
|
|
1909
|
+
function jr() {
|
|
1910
|
+
return {
|
|
1911
|
+
draggable: {
|
|
1912
|
+
active: null,
|
|
1913
|
+
initialCoordinates: {
|
|
1914
|
+
x: 0,
|
|
1915
|
+
y: 0
|
|
1916
|
+
},
|
|
1917
|
+
nodes: /* @__PURE__ */ new Map(),
|
|
1918
|
+
translate: {
|
|
1919
|
+
x: 0,
|
|
1920
|
+
y: 0
|
|
1921
|
+
}
|
|
1922
|
+
},
|
|
1923
|
+
droppable: { containers: new Dr() }
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
function Mr(e, t) {
|
|
1927
|
+
switch (t.type) {
|
|
1928
|
+
case J.DragStart: return {
|
|
1929
|
+
...e,
|
|
1930
|
+
draggable: {
|
|
1931
|
+
...e.draggable,
|
|
1932
|
+
initialCoordinates: t.initialCoordinates,
|
|
1933
|
+
active: t.active
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
case J.DragMove: return e.draggable.active == null ? e : {
|
|
1937
|
+
...e,
|
|
1938
|
+
draggable: {
|
|
1939
|
+
...e.draggable,
|
|
1940
|
+
translate: {
|
|
1941
|
+
x: t.coordinates.x - e.draggable.initialCoordinates.x,
|
|
1942
|
+
y: t.coordinates.y - e.draggable.initialCoordinates.y
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
case J.DragEnd:
|
|
1947
|
+
case J.DragCancel: return {
|
|
1948
|
+
...e,
|
|
1949
|
+
draggable: {
|
|
1950
|
+
...e.draggable,
|
|
1951
|
+
active: null,
|
|
1952
|
+
initialCoordinates: {
|
|
1953
|
+
x: 0,
|
|
1954
|
+
y: 0
|
|
1955
|
+
},
|
|
1956
|
+
translate: {
|
|
1957
|
+
x: 0,
|
|
1958
|
+
y: 0
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
case J.RegisterDroppable: {
|
|
1963
|
+
let { element: n } = t, { id: r } = n, i = new Dr(e.droppable.containers);
|
|
1964
|
+
return i.set(r, n), {
|
|
1965
|
+
...e,
|
|
1966
|
+
droppable: {
|
|
1967
|
+
...e.droppable,
|
|
1968
|
+
containers: i
|
|
1969
|
+
}
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
case J.SetDroppableDisabled: {
|
|
1973
|
+
let { id: n, key: r, disabled: i } = t, a = e.droppable.containers.get(n);
|
|
1974
|
+
if (!a || r !== a.key) return e;
|
|
1975
|
+
let o = new Dr(e.droppable.containers);
|
|
1976
|
+
return o.set(n, {
|
|
1977
|
+
...a,
|
|
1978
|
+
disabled: i
|
|
1979
|
+
}), {
|
|
1980
|
+
...e,
|
|
1981
|
+
droppable: {
|
|
1982
|
+
...e.droppable,
|
|
1983
|
+
containers: o
|
|
1984
|
+
}
|
|
1985
|
+
};
|
|
1986
|
+
}
|
|
1987
|
+
case J.UnregisterDroppable: {
|
|
1988
|
+
let { id: n, key: r } = t, i = e.droppable.containers.get(n);
|
|
1989
|
+
if (!i || r !== i.key) return e;
|
|
1990
|
+
let a = new Dr(e.droppable.containers);
|
|
1991
|
+
return a.delete(n), {
|
|
1992
|
+
...e,
|
|
1993
|
+
droppable: {
|
|
1994
|
+
...e.droppable,
|
|
1995
|
+
containers: a
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
default: return e;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
function Nr(e) {
|
|
2003
|
+
let { disabled: t } = e, { active: n, activatorEvent: r, draggableNodes: i } = C(kr), a = ge(r), o = ge(n?.id);
|
|
2004
|
+
return w(() => {
|
|
2005
|
+
if (!t && !r && a && o != null) {
|
|
2006
|
+
if (!ue(a) || document.activeElement === a.target) return;
|
|
2007
|
+
let e = i.get(o);
|
|
2008
|
+
if (!e) return;
|
|
2009
|
+
let { activatorNode: t, node: n } = e;
|
|
2010
|
+
if (!t.current && !n.current) return;
|
|
2011
|
+
requestAnimationFrame(() => {
|
|
2012
|
+
for (let e of [t.current, n.current]) {
|
|
2013
|
+
if (!e) continue;
|
|
2014
|
+
let t = se(e);
|
|
2015
|
+
if (t) {
|
|
2016
|
+
t.focus();
|
|
2017
|
+
break;
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
}, [
|
|
2023
|
+
r,
|
|
2024
|
+
t,
|
|
2025
|
+
i,
|
|
2026
|
+
o,
|
|
2027
|
+
a
|
|
2028
|
+
]), null;
|
|
2029
|
+
}
|
|
2030
|
+
function Pr(e, t) {
|
|
2031
|
+
let { transform: n, ...r } = t;
|
|
2032
|
+
return e != null && e.length ? e.reduce((e, t) => t({
|
|
2033
|
+
transform: e,
|
|
2034
|
+
...r
|
|
2035
|
+
}), n) : n;
|
|
2036
|
+
}
|
|
2037
|
+
function Fr(e) {
|
|
2038
|
+
return T(() => ({
|
|
2039
|
+
draggable: {
|
|
2040
|
+
...Er.draggable,
|
|
2041
|
+
...e?.draggable
|
|
2042
|
+
},
|
|
2043
|
+
droppable: {
|
|
2044
|
+
...Er.droppable,
|
|
2045
|
+
...e?.droppable
|
|
2046
|
+
},
|
|
2047
|
+
dragOverlay: {
|
|
2048
|
+
...Er.dragOverlay,
|
|
2049
|
+
...e?.dragOverlay
|
|
2050
|
+
}
|
|
2051
|
+
}), [
|
|
2052
|
+
e?.draggable,
|
|
2053
|
+
e?.droppable,
|
|
2054
|
+
e?.dragOverlay
|
|
2055
|
+
]);
|
|
2056
|
+
}
|
|
2057
|
+
function Ir(e) {
|
|
2058
|
+
let { activeNode: t, measure: n, initialRect: r, config: i = !0 } = e, a = E(!1), { x: o, y: s } = typeof i == "boolean" ? {
|
|
2059
|
+
x: i,
|
|
2060
|
+
y: i
|
|
2061
|
+
} : i;
|
|
2062
|
+
me(() => {
|
|
2063
|
+
if (!o && !s || !t) {
|
|
2064
|
+
a.current = !1;
|
|
2065
|
+
return;
|
|
2066
|
+
}
|
|
2067
|
+
if (a.current || !r) return;
|
|
2068
|
+
let e = t?.node.current;
|
|
2069
|
+
if (!e || e.isConnected === !1) return;
|
|
2070
|
+
let i = rn(n(e), r);
|
|
2071
|
+
if (o || (i.x = 0), s || (i.y = 0), a.current = !0, Math.abs(i.x) > 0 || Math.abs(i.y) > 0) {
|
|
2072
|
+
let t = gn(e);
|
|
2073
|
+
t && t.scrollBy({
|
|
2074
|
+
top: i.y,
|
|
2075
|
+
left: i.x
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
}, [
|
|
2079
|
+
t,
|
|
2080
|
+
o,
|
|
2081
|
+
s,
|
|
2082
|
+
r,
|
|
2083
|
+
n
|
|
2084
|
+
]);
|
|
2085
|
+
}
|
|
2086
|
+
var Lr = /*#__PURE__*/ b({
|
|
2087
|
+
...Y,
|
|
2088
|
+
scaleX: 1,
|
|
2089
|
+
scaleY: 1
|
|
2090
|
+
}), $;
|
|
2091
|
+
(function(e) {
|
|
2092
|
+
e[e.Uninitialized = 0] = "Uninitialized", e[e.Initializing = 1] = "Initializing", e[e.Initialized = 2] = "Initialized";
|
|
2093
|
+
})($ ||= {});
|
|
2094
|
+
var Rr = /*#__PURE__*/ x(function(e) {
|
|
2095
|
+
let { id: t, accessibility: n, autoScroll: r = !0, children: i, sensors: a = wr, collisionDetection: o = tn, measuring: s, modifiers: c, ...l } = e, [u, d] = te(Mr, void 0, jr), [f, p] = Ut(), [m, h] = D($.Uninitialized), g = m === $.Initialized, { draggable: { active: _, nodes: v, translate: b }, droppable: { containers: x } } = u, C = _ == null ? null : v.get(_), ee = E({
|
|
2096
|
+
initial: null,
|
|
2097
|
+
translated: null
|
|
2098
|
+
}), O = T(() => _ == null ? null : {
|
|
2099
|
+
id: _,
|
|
2100
|
+
data: C?.data ?? Tr,
|
|
2101
|
+
rect: ee
|
|
2102
|
+
}, [_, C]), k = E(null), [ne, re] = D(null), [A, j] = D(null), M = he(l, Object.values(l)), N = _e("DndDescribedBy", t), ie = T(() => x.getEnabled(), [x]), P = Fr(s), { droppableRects: F, measureDroppableContainers: se, measuringScheduled: I } = or(ie, {
|
|
2103
|
+
dragging: g,
|
|
2104
|
+
dependencies: [b.x, b.y],
|
|
2105
|
+
config: P.droppable
|
|
2106
|
+
}), R = tr(v, _), le = T(() => A ? ce(A) : null, [A]), ue = Fe(), de = cr(R, P.draggable.measure);
|
|
2107
|
+
Ir({
|
|
2108
|
+
activeNode: _ == null ? null : v.get(_),
|
|
2109
|
+
config: ue.layoutShiftCompensation,
|
|
2110
|
+
initialRect: de,
|
|
2111
|
+
measure: P.draggable.measure
|
|
2112
|
+
});
|
|
2113
|
+
let z = fr(R, P.draggable.measure, de), fe = fr(R ? R.parentElement : null), B = E({
|
|
2114
|
+
activatorEvent: null,
|
|
2115
|
+
active: null,
|
|
2116
|
+
activeNode: R,
|
|
2117
|
+
collisionRect: null,
|
|
2118
|
+
collisions: null,
|
|
2119
|
+
droppableRects: F,
|
|
2120
|
+
draggableNodes: v,
|
|
2121
|
+
draggingNode: null,
|
|
2122
|
+
draggingNodeRect: null,
|
|
2123
|
+
droppableContainers: x,
|
|
2124
|
+
over: null,
|
|
2125
|
+
scrollableAncestors: [],
|
|
2126
|
+
scrollAdjustedTranslate: null
|
|
2127
|
+
}), pe = x.getNodeFor(B.current.over?.id), V = Cr({ measure: P.dragOverlay.measure }), H = V.nodeRef.current ?? R, U = g ? V.rect ?? z : null, ge = !!(V.nodeRef.current && V.rect), ve = pr(ge ? null : z), ye = yr(H ? L(H) : null), W = hr(g ? pe ?? R : null), be = xr(W), xe = Pr(c, {
|
|
2128
|
+
transform: {
|
|
2129
|
+
x: b.x - ve.x,
|
|
2130
|
+
y: b.y - ve.y,
|
|
2131
|
+
scaleX: 1,
|
|
2132
|
+
scaleY: 1
|
|
2133
|
+
},
|
|
2134
|
+
activatorEvent: A,
|
|
2135
|
+
active: O,
|
|
2136
|
+
activeNodeRect: z,
|
|
2137
|
+
containerNodeRect: fe,
|
|
2138
|
+
draggingNodeRect: U,
|
|
2139
|
+
over: B.current.over,
|
|
2140
|
+
overlayNodeRect: V.rect,
|
|
2141
|
+
scrollableAncestors: W,
|
|
2142
|
+
scrollableAncestorRects: be,
|
|
2143
|
+
windowRect: ye
|
|
2144
|
+
}), Se = le ? oe(le, b) : null, Ce = gr(W), we = _r(Ce), Te = _r(Ce, [z]), G = oe(xe, we), K = U ? on(U, xe) : null, Ee = O && K ? o({
|
|
2145
|
+
active: O,
|
|
2146
|
+
collisionRect: K,
|
|
2147
|
+
droppableRects: F,
|
|
2148
|
+
droppableContainers: ie,
|
|
2149
|
+
pointerCoordinates: Se
|
|
2150
|
+
}) : null, De = Zt(Ee, "id"), [q, Oe] = D(null), ke = nn(ge ? xe : oe(xe, Te), q?.rect ?? null, z), Ae = E(null), je = S((e, t) => {
|
|
2151
|
+
let { sensor: n, options: r } = t;
|
|
2152
|
+
if (k.current == null) return;
|
|
2153
|
+
let i = v.get(k.current);
|
|
2154
|
+
if (!i) return;
|
|
2155
|
+
let a = e.nativeEvent, o = new n({
|
|
2156
|
+
active: k.current,
|
|
2157
|
+
activeNode: i,
|
|
2158
|
+
event: a,
|
|
2159
|
+
options: r,
|
|
2160
|
+
context: B,
|
|
2161
|
+
onAbort(e) {
|
|
2162
|
+
if (!v.get(e)) return;
|
|
2163
|
+
let { onDragAbort: t } = M.current, n = { id: e };
|
|
2164
|
+
t?.(n), f({
|
|
2165
|
+
type: "onDragAbort",
|
|
2166
|
+
event: n
|
|
2167
|
+
});
|
|
2168
|
+
},
|
|
2169
|
+
onPending(e, t, n, r) {
|
|
2170
|
+
if (!v.get(e)) return;
|
|
2171
|
+
let { onDragPending: i } = M.current, a = {
|
|
2172
|
+
id: e,
|
|
2173
|
+
constraint: t,
|
|
2174
|
+
initialCoordinates: n,
|
|
2175
|
+
offset: r
|
|
2176
|
+
};
|
|
2177
|
+
i?.(a), f({
|
|
2178
|
+
type: "onDragPending",
|
|
2179
|
+
event: a
|
|
2180
|
+
});
|
|
2181
|
+
},
|
|
2182
|
+
onStart(e) {
|
|
2183
|
+
let t = k.current;
|
|
2184
|
+
if (t == null) return;
|
|
2185
|
+
let n = v.get(t);
|
|
2186
|
+
if (!n) return;
|
|
2187
|
+
let { onDragStart: r } = M.current, i = {
|
|
2188
|
+
activatorEvent: a,
|
|
2189
|
+
active: {
|
|
2190
|
+
id: t,
|
|
2191
|
+
data: n.data,
|
|
2192
|
+
rect: ee
|
|
2193
|
+
}
|
|
2194
|
+
};
|
|
2195
|
+
ae(() => {
|
|
2196
|
+
r?.(i), h($.Initializing), d({
|
|
2197
|
+
type: J.DragStart,
|
|
2198
|
+
initialCoordinates: e,
|
|
2199
|
+
active: t
|
|
2200
|
+
}), f({
|
|
2201
|
+
type: "onDragStart",
|
|
2202
|
+
event: i
|
|
2203
|
+
}), re(Ae.current), j(a);
|
|
2204
|
+
});
|
|
2205
|
+
},
|
|
2206
|
+
onMove(e) {
|
|
2207
|
+
d({
|
|
2208
|
+
type: J.DragMove,
|
|
2209
|
+
coordinates: e
|
|
2210
|
+
});
|
|
2211
|
+
},
|
|
2212
|
+
onEnd: s(J.DragEnd),
|
|
2213
|
+
onCancel: s(J.DragCancel)
|
|
2214
|
+
});
|
|
2215
|
+
Ae.current = o;
|
|
2216
|
+
function s(e) {
|
|
2217
|
+
return async function() {
|
|
2218
|
+
let { active: t, collisions: n, over: r, scrollAdjustedTranslate: i } = B.current, o = null;
|
|
2219
|
+
if (t && i) {
|
|
2220
|
+
let { cancelDrop: s } = M.current;
|
|
2221
|
+
o = {
|
|
2222
|
+
activatorEvent: a,
|
|
2223
|
+
active: t,
|
|
2224
|
+
collisions: n,
|
|
2225
|
+
delta: i,
|
|
2226
|
+
over: r
|
|
2227
|
+
}, e === J.DragEnd && typeof s == "function" && await Promise.resolve(s(o)) && (e = J.DragCancel);
|
|
2228
|
+
}
|
|
2229
|
+
k.current = null, ae(() => {
|
|
2230
|
+
d({ type: e }), h($.Uninitialized), Oe(null), re(null), j(null), Ae.current = null;
|
|
2231
|
+
let t = e === J.DragEnd ? "onDragEnd" : "onDragCancel";
|
|
2232
|
+
if (o) {
|
|
2233
|
+
let e = M.current[t];
|
|
2234
|
+
e?.(o), f({
|
|
2235
|
+
type: t,
|
|
2236
|
+
event: o
|
|
2237
|
+
});
|
|
2238
|
+
}
|
|
2239
|
+
});
|
|
2240
|
+
};
|
|
2241
|
+
}
|
|
2242
|
+
}, [v]), Me = nr(a, S((e, t) => (n, r) => {
|
|
2243
|
+
let i = n.nativeEvent, a = v.get(r);
|
|
2244
|
+
if (k.current !== null || !a || i.dndKit || i.defaultPrevented) return;
|
|
2245
|
+
let o = { active: a };
|
|
2246
|
+
e(n, t.options, o) === !0 && (i.dndKit = { capturedBy: t.sensor }, k.current = r, je(n, t));
|
|
2247
|
+
}, [v, je]));
|
|
2248
|
+
vr(a), me(() => {
|
|
2249
|
+
z && m === $.Initializing && h($.Initialized);
|
|
2250
|
+
}, [z, m]), w(() => {
|
|
2251
|
+
let { onDragMove: e } = M.current, { active: t, activatorEvent: n, collisions: r, over: i } = B.current;
|
|
2252
|
+
if (!t || !n) return;
|
|
2253
|
+
let a = {
|
|
2254
|
+
active: t,
|
|
2255
|
+
activatorEvent: n,
|
|
2256
|
+
collisions: r,
|
|
2257
|
+
delta: {
|
|
2258
|
+
x: G.x,
|
|
2259
|
+
y: G.y
|
|
2260
|
+
},
|
|
2261
|
+
over: i
|
|
2262
|
+
};
|
|
2263
|
+
ae(() => {
|
|
2264
|
+
e?.(a), f({
|
|
2265
|
+
type: "onDragMove",
|
|
2266
|
+
event: a
|
|
2267
|
+
});
|
|
2268
|
+
});
|
|
2269
|
+
}, [G.x, G.y]), w(() => {
|
|
2270
|
+
let { active: e, activatorEvent: t, collisions: n, droppableContainers: r, scrollAdjustedTranslate: i } = B.current;
|
|
2271
|
+
if (!e || k.current == null || !t || !i) return;
|
|
2272
|
+
let { onDragOver: a } = M.current, o = r.get(De), s = o && o.rect.current ? {
|
|
2273
|
+
id: o.id,
|
|
2274
|
+
rect: o.rect.current,
|
|
2275
|
+
data: o.data,
|
|
2276
|
+
disabled: o.disabled
|
|
2277
|
+
} : null, c = {
|
|
2278
|
+
active: e,
|
|
2279
|
+
activatorEvent: t,
|
|
2280
|
+
collisions: n,
|
|
2281
|
+
delta: {
|
|
2282
|
+
x: i.x,
|
|
2283
|
+
y: i.y
|
|
2284
|
+
},
|
|
2285
|
+
over: s
|
|
2286
|
+
};
|
|
2287
|
+
ae(() => {
|
|
2288
|
+
Oe(s), a?.(c), f({
|
|
2289
|
+
type: "onDragOver",
|
|
2290
|
+
event: c
|
|
2291
|
+
});
|
|
2292
|
+
});
|
|
2293
|
+
}, [De]), me(() => {
|
|
2294
|
+
B.current = {
|
|
2295
|
+
activatorEvent: A,
|
|
2296
|
+
active: O,
|
|
2297
|
+
activeNode: R,
|
|
2298
|
+
collisionRect: K,
|
|
2299
|
+
collisions: Ee,
|
|
2300
|
+
droppableRects: F,
|
|
2301
|
+
draggableNodes: v,
|
|
2302
|
+
draggingNode: H,
|
|
2303
|
+
draggingNodeRect: U,
|
|
2304
|
+
droppableContainers: x,
|
|
2305
|
+
over: q,
|
|
2306
|
+
scrollableAncestors: W,
|
|
2307
|
+
scrollAdjustedTranslate: G
|
|
2308
|
+
}, ee.current = {
|
|
2309
|
+
initial: U,
|
|
2310
|
+
translated: K
|
|
2311
|
+
};
|
|
2312
|
+
}, [
|
|
2313
|
+
O,
|
|
2314
|
+
R,
|
|
2315
|
+
Ee,
|
|
2316
|
+
K,
|
|
2317
|
+
v,
|
|
2318
|
+
H,
|
|
2319
|
+
U,
|
|
2320
|
+
F,
|
|
2321
|
+
x,
|
|
2322
|
+
q,
|
|
2323
|
+
W,
|
|
2324
|
+
G
|
|
2325
|
+
]), Qn({
|
|
2326
|
+
...ue,
|
|
2327
|
+
delta: b,
|
|
2328
|
+
draggingRect: K,
|
|
2329
|
+
pointerCoordinates: Se,
|
|
2330
|
+
scrollableAncestors: W,
|
|
2331
|
+
scrollableAncestorRects: be
|
|
2332
|
+
});
|
|
2333
|
+
let Ne = T(() => ({
|
|
2334
|
+
active: O,
|
|
2335
|
+
activeNode: R,
|
|
2336
|
+
activeNodeRect: z,
|
|
2337
|
+
activatorEvent: A,
|
|
2338
|
+
collisions: Ee,
|
|
2339
|
+
containerNodeRect: fe,
|
|
2340
|
+
dragOverlay: V,
|
|
2341
|
+
draggableNodes: v,
|
|
2342
|
+
droppableContainers: x,
|
|
2343
|
+
droppableRects: F,
|
|
2344
|
+
over: q,
|
|
2345
|
+
measureDroppableContainers: se,
|
|
2346
|
+
scrollableAncestors: W,
|
|
2347
|
+
scrollableAncestorRects: be,
|
|
2348
|
+
measuringConfiguration: P,
|
|
2349
|
+
measuringScheduled: I,
|
|
2350
|
+
windowRect: ye
|
|
2351
|
+
}), [
|
|
2352
|
+
O,
|
|
2353
|
+
R,
|
|
2354
|
+
z,
|
|
2355
|
+
A,
|
|
2356
|
+
Ee,
|
|
2357
|
+
fe,
|
|
2358
|
+
V,
|
|
2359
|
+
v,
|
|
2360
|
+
x,
|
|
2361
|
+
F,
|
|
2362
|
+
q,
|
|
2363
|
+
se,
|
|
2364
|
+
W,
|
|
2365
|
+
be,
|
|
2366
|
+
P,
|
|
2367
|
+
I,
|
|
2368
|
+
ye
|
|
2369
|
+
]), Pe = T(() => ({
|
|
2370
|
+
activatorEvent: A,
|
|
2371
|
+
activators: Me,
|
|
2372
|
+
active: O,
|
|
2373
|
+
activeNodeRect: z,
|
|
2374
|
+
ariaDescribedById: { draggable: N },
|
|
2375
|
+
dispatch: d,
|
|
2376
|
+
draggableNodes: v,
|
|
2377
|
+
over: q,
|
|
2378
|
+
measureDroppableContainers: se
|
|
2379
|
+
}), [
|
|
2380
|
+
A,
|
|
2381
|
+
Me,
|
|
2382
|
+
O,
|
|
2383
|
+
z,
|
|
2384
|
+
d,
|
|
2385
|
+
N,
|
|
2386
|
+
v,
|
|
2387
|
+
q,
|
|
2388
|
+
se
|
|
2389
|
+
]);
|
|
2390
|
+
return y.createElement(Vt.Provider, { value: p }, y.createElement(kr.Provider, { value: Pe }, y.createElement(Ar.Provider, { value: Ne }, y.createElement(Lr.Provider, { value: ke }, i)), y.createElement(Nr, { disabled: n?.restoreFocus === !1 })), y.createElement(Kt, {
|
|
2391
|
+
...n,
|
|
2392
|
+
hiddenTextDescribedById: N
|
|
2393
|
+
}));
|
|
2394
|
+
function Fe() {
|
|
2395
|
+
let e = ne?.autoScrollEnabled === !1, t = typeof r == "object" ? r.enabled === !1 : r === !1, n = g && !e && !t;
|
|
2396
|
+
return typeof r == "object" ? {
|
|
2397
|
+
...r,
|
|
2398
|
+
enabled: n
|
|
2399
|
+
} : { enabled: n };
|
|
2400
|
+
}
|
|
2401
|
+
}), zr = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\"><path d=\"M6.66 9.118a.693.693 0 0 1 .956.032l3.65 3.411 2.422-2.238a.695.695 0 0 1 .945 0L17.5 13.6V2.5h-15v11.1zM17.8 1c.652 0 1.2.47 1.2 1.1v14.362c0 .64-.532 1.038-1.184 1.038H2.184C1.532 17.5 1 17.103 1 16.462V2.1C1 1.47 1.537 1 2.2 1zm-5.655 6a2.13 2.13 0 0 1 .157-2.364A2.133 2.133 0 1 1 12.145 7\"/></svg>\n", Br = class extends Ye {
|
|
2402
|
+
init() {
|
|
2403
|
+
let e = this.editor;
|
|
2404
|
+
e.ui.componentFactory.add("elfinder", (t) => {
|
|
2405
|
+
let n = new Ce(t);
|
|
2406
|
+
return n.set({
|
|
2407
|
+
label: "Insert Image",
|
|
2408
|
+
icon: zr,
|
|
2409
|
+
tooltip: !0
|
|
2410
|
+
}), n.on("execute", async () => {
|
|
2411
|
+
let t = e.config.get("elfinder");
|
|
2412
|
+
typeof t == "function" && await t(e);
|
|
2413
|
+
}), n;
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2416
|
+
}, Vr = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\"><path d=\"M11.5 5.75a.75.75 0 0 1 0-1.5H15a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0V6.81l-2.72 2.72a.75.75 0 0 1-1.06-1.06l2.72-2.72zm-1.97 4.72a.75.75 0 0 1 0 1.06l-2.72 2.72H8.5a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75v-3.5a.75.75 0 0 1 1.5 0v1.69l2.72-2.72a.75.75 0 0 1 1.06 0\"/><path d=\"M2 0h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2m16 1.5H2a.5.5 0 0 0-.5.5v16a.5.5 0 0 0 .5.5h16a.5.5 0 0 0 .5-.5V2a.5.5 0 0 0-.5-.5\"/></svg>\n", Hr = class extends Ye {
|
|
2417
|
+
isFullscreen = !1;
|
|
2418
|
+
originalStyles = {};
|
|
2419
|
+
init() {
|
|
2420
|
+
this.editor.ui.componentFactory.add("fullscreen", (e) => {
|
|
2421
|
+
let t = new Ce(e);
|
|
2422
|
+
return t.set({
|
|
2423
|
+
label: "Toàn màn hình",
|
|
2424
|
+
icon: Vr,
|
|
2425
|
+
tooltip: !0
|
|
2426
|
+
}), t.on("execute", () => this.toggle()), t;
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2429
|
+
toggle() {
|
|
2430
|
+
let e = this.editor.ui.getEditableElement()?.closest(".ck-editor");
|
|
2431
|
+
e && (this.isFullscreen ? (Object.assign(e.style, this.originalStyles), document.body.style.overflow = "") : (this.originalStyles = {
|
|
2432
|
+
position: e.style.position,
|
|
2433
|
+
top: e.style.top,
|
|
2434
|
+
left: e.style.left,
|
|
2435
|
+
width: e.style.width,
|
|
2436
|
+
height: e.style.height,
|
|
2437
|
+
zIndex: e.style.zIndex
|
|
2438
|
+
}, Object.assign(e.style, {
|
|
2439
|
+
position: "fixed",
|
|
2440
|
+
top: "0",
|
|
2441
|
+
left: "0",
|
|
2442
|
+
width: "100vw",
|
|
2443
|
+
height: "100vh",
|
|
2444
|
+
zIndex: "9999",
|
|
2445
|
+
background: "#fff"
|
|
2446
|
+
}), document.body.style.overflow = "hidden"), this.isFullscreen = !this.isFullscreen);
|
|
2447
|
+
}
|
|
2448
|
+
}, Ur = "\n<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M3 1h9l5 5v13H3V1zM12 1v5h5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1\"\n />\n <text\n x=\"10\"\n y=\"14\"\n text-anchor=\"middle\"\n font-size=\"5\"\n font-weight=\"700\"\n fill=\"currentColor\"\n font-family=\"Arial, Helvetica, sans-serif\"\n >\n PDF\n </text>\n</svg>\n", Wr = class extends Ye {
|
|
2449
|
+
init() {
|
|
2450
|
+
let e = this.editor;
|
|
2451
|
+
e.ui.componentFactory.add("pdffinder", (t) => {
|
|
2452
|
+
let n = new Ce(t);
|
|
2453
|
+
return n.set({
|
|
2454
|
+
label: "Insert PDF Viewer",
|
|
2455
|
+
icon: Ur,
|
|
2456
|
+
tooltip: !0
|
|
2457
|
+
}), n.on("execute", async () => {
|
|
2458
|
+
let t = e.config.get("pdffinder");
|
|
2459
|
+
if (typeof t == "function") {
|
|
2460
|
+
let n = await t(e);
|
|
2461
|
+
if (n && n.mime === "application/pdf") {
|
|
2462
|
+
let t = window.prompt("Nhập tiêu đề file PDF:", n.name || "");
|
|
2463
|
+
this.insertPdf(e, n.url, t || "");
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
}), n;
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
insertPdf(e, t, n) {
|
|
2470
|
+
let i = encodeURIComponent(n), a = n ? `${t}${t.includes("?") ? "&" : "?"}_title=${i}` : t, o = `
|
|
2471
|
+
<div class="pdf-wrapper">
|
|
2472
|
+
${n ? `<div class="pdf-title">${r(n)}</div>` : ""}
|
|
2473
|
+
<oembed url="${r(a)}"></oembed>
|
|
2474
|
+
</div>
|
|
2475
|
+
`, s = e.data.processor.toView(o), c = e.data.toModel(s);
|
|
2476
|
+
e.model.insertContent(c);
|
|
2477
|
+
}
|
|
2478
|
+
}, Gr = class extends we {};
|
|
2479
|
+
Gr.builtinPlugins = [
|
|
2480
|
+
Ee,
|
|
2481
|
+
Je,
|
|
2482
|
+
je,
|
|
2483
|
+
Se,
|
|
2484
|
+
Ue,
|
|
2485
|
+
ct,
|
|
2486
|
+
et,
|
|
2487
|
+
tt,
|
|
2488
|
+
nt,
|
|
2489
|
+
Te,
|
|
2490
|
+
Oe,
|
|
2491
|
+
ke,
|
|
2492
|
+
q,
|
|
2493
|
+
De,
|
|
2494
|
+
Me,
|
|
2495
|
+
Xe,
|
|
2496
|
+
be,
|
|
2497
|
+
Ve,
|
|
2498
|
+
He,
|
|
2499
|
+
Ge,
|
|
2500
|
+
st,
|
|
2501
|
+
xe,
|
|
2502
|
+
Ne,
|
|
2503
|
+
We,
|
|
2504
|
+
Fe,
|
|
2505
|
+
Le,
|
|
2506
|
+
Be,
|
|
2507
|
+
ze,
|
|
2508
|
+
Re,
|
|
2509
|
+
Ie,
|
|
2510
|
+
rt,
|
|
2511
|
+
ot,
|
|
2512
|
+
at,
|
|
2513
|
+
it,
|
|
2514
|
+
Ke,
|
|
2515
|
+
G,
|
|
2516
|
+
Qe,
|
|
2517
|
+
$e,
|
|
2518
|
+
K,
|
|
2519
|
+
qe,
|
|
2520
|
+
Ze,
|
|
2521
|
+
Ae,
|
|
2522
|
+
Pe,
|
|
2523
|
+
lt,
|
|
2524
|
+
Br,
|
|
2525
|
+
Wr,
|
|
2526
|
+
Hr
|
|
2527
|
+
], Gr.defaultConfig = {
|
|
2528
|
+
licenseKey: "GPL",
|
|
2529
|
+
toolbar: {
|
|
2530
|
+
items: /* @__PURE__ */ "undo.redo.|.fullscreen.sourceEditing.heading.|.fontFamily.fontSize.fontColor.fontBackgroundColor.|.bold.italic.underline.strikethrough.subscript.superscript.code.removeFormat.|.alignment.outdent.indent.|.bulletedList.numberedList.todoList.|.insertImage.elfinder.pdffinder.link.mediaEmbed.insertTable.horizontalLine.|.blockQuote.codeBlock.specialCharacters.emoji.|.htmlEmbed".split("."),
|
|
2531
|
+
shouldNotGroupWhenFull: !0
|
|
2532
|
+
},
|
|
2533
|
+
image: { toolbar: [
|
|
2534
|
+
"imageStyle:inline",
|
|
2535
|
+
"imageStyle:block",
|
|
2536
|
+
"imageStyle:side",
|
|
2537
|
+
"|",
|
|
2538
|
+
"toggleImageCaption",
|
|
2539
|
+
"imageTextAlternative"
|
|
2540
|
+
] },
|
|
2541
|
+
table: { contentToolbar: [
|
|
2542
|
+
"tableColumn",
|
|
2543
|
+
"tableRow",
|
|
2544
|
+
"mergeTableCells",
|
|
2545
|
+
"tableProperties",
|
|
2546
|
+
"tableCellProperties"
|
|
2547
|
+
] },
|
|
2548
|
+
mention: { feeds: [{
|
|
2549
|
+
marker: "@",
|
|
2550
|
+
feed: [],
|
|
2551
|
+
minimumCharacters: 0
|
|
2552
|
+
}] },
|
|
2553
|
+
htmlSupport: { allow: [{
|
|
2554
|
+
name: /.*/,
|
|
2555
|
+
classes: !0,
|
|
2556
|
+
styles: !0,
|
|
2557
|
+
attributes: { "data-*": !0 }
|
|
2558
|
+
}] },
|
|
2559
|
+
language: "vi"
|
|
2560
|
+
};
|
|
2561
|
+
//#endregion
|
|
2562
|
+
//#region src/components/form/Editor.tsx
|
|
2563
|
+
var Kr = ({ label: t, name: n, cpnClass: r = "", required: i = !1, disabled: a = !1, value: o = "", onChange: c }) => {
|
|
2564
|
+
let u = E(null), d = E(null), f = E(null), p = E(null), [m, g] = D(!1);
|
|
2565
|
+
w(() => (g(!0), () => g(!1)), []), w(() => {
|
|
2566
|
+
document.activeElement !== p.current && c && c(h(n, o));
|
|
2567
|
+
}, [o]);
|
|
2568
|
+
let _ = (e) => {
|
|
2569
|
+
c && c(h(n, e));
|
|
2570
|
+
}, { editorConfig: v } = T(() => m ? { editorConfig: {
|
|
2571
|
+
elfinder: async (e) => {
|
|
2572
|
+
let { md: t } = await s("#elfinderModal");
|
|
2573
|
+
l("#elfinderStatic").then((n) => {
|
|
2574
|
+
let r = Array.isArray(n) ? n[0] : n;
|
|
2575
|
+
e.execute("imageInsert", { source: r.url }), t.hide();
|
|
2576
|
+
}), t.show();
|
|
2577
|
+
},
|
|
2578
|
+
pdffinder: async () => new Promise((t, n) => {
|
|
2579
|
+
s("#elfinderModal").then(({ md: r }) => {
|
|
2580
|
+
let i = {
|
|
2581
|
+
url: (e().API_URL ?? "") + "/elfinder/connectorFiles",
|
|
2582
|
+
onlyMimes: ["application/pdf"]
|
|
2583
|
+
};
|
|
2584
|
+
l("#elfinderStatic", i).then((e) => {
|
|
2585
|
+
let n = Array.isArray(e) ? e[0] : e;
|
|
2586
|
+
r.hide(), t({
|
|
2587
|
+
url: n.url,
|
|
2588
|
+
name: n.name,
|
|
2589
|
+
mime: n.mime
|
|
2590
|
+
});
|
|
2591
|
+
}).catch(n), r.show();
|
|
2592
|
+
}).catch(n);
|
|
2593
|
+
}),
|
|
2594
|
+
mediaEmbed: {
|
|
2595
|
+
previewsInData: !0,
|
|
2596
|
+
providers: [{
|
|
2597
|
+
name: "pdf",
|
|
2598
|
+
url: /.+\.pdf(\?.*)?$/,
|
|
2599
|
+
html: (e) => {
|
|
2600
|
+
let t = e[0], n = new URL(t, window.location.origin), r = n.searchParams.get("_title") || "";
|
|
2601
|
+
return n.searchParams.delete("_title"), `
|
|
2602
|
+
<div
|
|
2603
|
+
class="pdf-iframe-wrapper"
|
|
2604
|
+
${r ? `data-title="${r}"` : ""}
|
|
2605
|
+
style="width:100%; height:600px; position:relative"
|
|
2606
|
+
>
|
|
2607
|
+
<iframe
|
|
2608
|
+
src="${n.href}"
|
|
2609
|
+
width="100%"
|
|
2610
|
+
height="600"
|
|
2611
|
+
style="border:1px solid #ddd"
|
|
2612
|
+
${r ? `data-title="${r}"` : ""}
|
|
2613
|
+
></iframe>
|
|
2614
|
+
</div>
|
|
2615
|
+
`;
|
|
2616
|
+
}
|
|
2617
|
+
}]
|
|
2618
|
+
}
|
|
2619
|
+
} } : {}, [m]);
|
|
2620
|
+
return /* @__PURE__ */ M(j, { children: /* @__PURE__ */ N("div", {
|
|
2621
|
+
className: "form-group " + (r ?? ""),
|
|
2622
|
+
children: [
|
|
2623
|
+
/* @__PURE__ */ M("div", {
|
|
2624
|
+
className: "form-label",
|
|
2625
|
+
children: t + (i ? " *" : "")
|
|
2626
|
+
}),
|
|
2627
|
+
/* @__PURE__ */ M("div", {
|
|
2628
|
+
className: "main-container w-100",
|
|
2629
|
+
children: /* @__PURE__ */ N("div", {
|
|
2630
|
+
className: "editor-container editor-container_classic-editor editor-container_include-block-toolbar editor-container_include-word-count editor-container_include-fullscreen",
|
|
2631
|
+
ref: u,
|
|
2632
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2633
|
+
className: "editor-container__editor",
|
|
2634
|
+
children: /* @__PURE__ */ M("div", {
|
|
2635
|
+
ref: d,
|
|
2636
|
+
children: v && /* @__PURE__ */ M(W, {
|
|
2637
|
+
onReady: (e) => {
|
|
2638
|
+
let t = e.plugins.get(lt);
|
|
2639
|
+
f.current?.appendChild(t.wordCountContainer);
|
|
2640
|
+
},
|
|
2641
|
+
onAfterDestroy: () => {
|
|
2642
|
+
f.current && Array.from(f.current.children).forEach((e) => e.remove());
|
|
2643
|
+
},
|
|
2644
|
+
data: o,
|
|
2645
|
+
editor: Gr,
|
|
2646
|
+
config: v,
|
|
2647
|
+
onChange: (e, t) => {
|
|
2648
|
+
let n = t.getData();
|
|
2649
|
+
_(n);
|
|
2650
|
+
},
|
|
2651
|
+
disabled: a
|
|
2652
|
+
})
|
|
2653
|
+
})
|
|
2654
|
+
}), /* @__PURE__ */ M("div", {
|
|
2655
|
+
className: "editor_container__word-count",
|
|
2656
|
+
ref: f
|
|
2657
|
+
})]
|
|
2658
|
+
})
|
|
2659
|
+
}),
|
|
2660
|
+
/* @__PURE__ */ M("textarea", {
|
|
2661
|
+
className: "form-control",
|
|
2662
|
+
style: { display: "none" },
|
|
2663
|
+
name: n,
|
|
2664
|
+
value: o,
|
|
2665
|
+
readOnly: !0
|
|
2666
|
+
})
|
|
2667
|
+
]
|
|
2668
|
+
}) });
|
|
2669
|
+
}, qr = (e, t, n) => {
|
|
2670
|
+
let r = e[t];
|
|
2671
|
+
if (r && typeof r == "object") {
|
|
2672
|
+
let e = r[n];
|
|
2673
|
+
return typeof e == "string" ? e : "";
|
|
2674
|
+
}
|
|
2675
|
+
return typeof r == "string" ? r : "";
|
|
2676
|
+
}, Jr = [], Yr = ({ options: e, layout: t = 1, onChange: r, data: i = Jr }) => {
|
|
2677
|
+
let o = Array.isArray(e) ? e : [], [s, c] = D([]);
|
|
2678
|
+
w(() => {
|
|
2679
|
+
if (!Array.isArray(i)) return;
|
|
2680
|
+
let e = i.map((e) => e._uid ? e : {
|
|
2681
|
+
...e,
|
|
2682
|
+
_uid: a(10)
|
|
2683
|
+
});
|
|
2684
|
+
c(e);
|
|
2685
|
+
}, [i]);
|
|
2686
|
+
let l = E([]);
|
|
2687
|
+
l.current = s;
|
|
2688
|
+
let d = () => {
|
|
2689
|
+
let e = { _uid: a(10) };
|
|
2690
|
+
o.forEach((t) => {
|
|
2691
|
+
t.type === "image" ? e[t.name] = "" : t.type === "selectMulti" ? e[t.name] = [] : e[t.name] = "";
|
|
2692
|
+
});
|
|
2693
|
+
let t = [...l.current, e];
|
|
2694
|
+
l.current = t, c(t), r?.(t);
|
|
2695
|
+
}, f = async (e) => {
|
|
2696
|
+
if (!(await n()).isConfirmed) return;
|
|
2697
|
+
let t = s.filter((t, n) => n !== e);
|
|
2698
|
+
c(t), r?.(t);
|
|
2699
|
+
}, p = (e) => {
|
|
2700
|
+
let { active: t, over: n } = e;
|
|
2701
|
+
n && t.id !== n.id && c((e) => {
|
|
2702
|
+
let i = e.findIndex((e) => e._uid === t.id), a = e.findIndex((e) => e._uid === n.id);
|
|
2703
|
+
if (i === -1 || a === -1) return e;
|
|
2704
|
+
let o = ye(e, i, a);
|
|
2705
|
+
return r?.(o), o;
|
|
2706
|
+
});
|
|
2707
|
+
}, m = (e, t) => {
|
|
2708
|
+
let n = g(e), i = s.map((e, r) => r === t ? {
|
|
2709
|
+
...e,
|
|
2710
|
+
[n.name]: n.value
|
|
2711
|
+
} : e);
|
|
2712
|
+
c(i), r?.(i);
|
|
2713
|
+
}, h = (e, t, n) => {
|
|
2714
|
+
let r = o.find((e) => e.name === n);
|
|
2715
|
+
if (!r) return null;
|
|
2716
|
+
let i = u(), a = Array.isArray(i) ? i : [];
|
|
2717
|
+
switch (r.type) {
|
|
2718
|
+
case "text": return /* @__PURE__ */ M(j, { children: a.map((i) => /* @__PURE__ */ M(Ct, {
|
|
2719
|
+
cpnClass: "mb-3",
|
|
2720
|
+
label: `${r.label} - ${i?.name}`,
|
|
2721
|
+
name: `{${r.name}}{${i.id}}`,
|
|
2722
|
+
value: qr(e, n, i.id),
|
|
2723
|
+
onChange: (e) => m(e, t)
|
|
2724
|
+
}, i?.id)) });
|
|
2725
|
+
case "textarea": return /* @__PURE__ */ M(j, { children: a.map((i) => /* @__PURE__ */ M(Tt, {
|
|
2726
|
+
cpnClass: "mb-3",
|
|
2727
|
+
label: `${r.label} - ${i?.name}`,
|
|
2728
|
+
name: `{${r.name}}{${i.id}}`,
|
|
2729
|
+
value: qr(e, n, i.id),
|
|
2730
|
+
onChange: (e) => m(e, t)
|
|
2731
|
+
}, i?.id)) });
|
|
2732
|
+
case "select": return /* @__PURE__ */ M(Pt, {
|
|
2733
|
+
cpnClass: "mb-3",
|
|
2734
|
+
label: r.label,
|
|
2735
|
+
name: r.name,
|
|
2736
|
+
lists: r.options || [],
|
|
2737
|
+
value: e[n],
|
|
2738
|
+
all: r.all,
|
|
2739
|
+
zero: r.zero,
|
|
2740
|
+
onChange: (e) => m(e, t)
|
|
2741
|
+
});
|
|
2742
|
+
case "selectMulti": return /* @__PURE__ */ M(Ft, {
|
|
2743
|
+
cpnClass: "mb-3",
|
|
2744
|
+
label: r.label,
|
|
2745
|
+
name: r.name,
|
|
2746
|
+
lists: r.options || [],
|
|
2747
|
+
value: e[n],
|
|
2748
|
+
all: r.all,
|
|
2749
|
+
zero: r.zero,
|
|
2750
|
+
onChange: (e) => m(e, t)
|
|
2751
|
+
});
|
|
2752
|
+
case "image": return /* @__PURE__ */ M(It, {
|
|
2753
|
+
cpnClass: "border mb-3",
|
|
2754
|
+
label: r.label,
|
|
2755
|
+
name: r.name,
|
|
2756
|
+
value: e[n],
|
|
2757
|
+
df: r.df,
|
|
2758
|
+
ext: r.ext || ".jpg,.jpeg,.png",
|
|
2759
|
+
isEdit: !0,
|
|
2760
|
+
onChange: (e) => m(e, t)
|
|
2761
|
+
});
|
|
2762
|
+
case "editor": return /* @__PURE__ */ M(j, { children: a.map((i) => /* @__PURE__ */ M(Kr, {
|
|
2763
|
+
cpnClass: "mb-3",
|
|
2764
|
+
label: `${r.label} - ${i?.name}`,
|
|
2765
|
+
name: `{${r.name}}{${i.id}}`,
|
|
2766
|
+
value: qr(e, n, i.id),
|
|
2767
|
+
onChange: (e) => m(e, t)
|
|
2768
|
+
}, i?.id)) });
|
|
2769
|
+
default: return null;
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
return /* @__PURE__ */ N("div", { children: [Array.isArray(s) && /* @__PURE__ */ M(Rr, {
|
|
2773
|
+
collisionDetection: $t,
|
|
2774
|
+
onDragEnd: p,
|
|
2775
|
+
children: /* @__PURE__ */ M(ve, {
|
|
2776
|
+
items: s.map((e) => e._uid ?? `row-${a(8)}`),
|
|
2777
|
+
children: s.map((e, n) => {
|
|
2778
|
+
if (!e._uid) return;
|
|
2779
|
+
let r = o.filter((e) => e.type !== "image"), i = o.filter((e) => e.type === "image");
|
|
2780
|
+
return /* @__PURE__ */ N(v, {
|
|
2781
|
+
id: e._uid,
|
|
2782
|
+
className: "border border-dark rounded p-3 mb-3 position-relative",
|
|
2783
|
+
iconSize: "20px",
|
|
2784
|
+
iconStyle: {
|
|
2785
|
+
cursor: "move",
|
|
2786
|
+
right: "35px",
|
|
2787
|
+
top: "7px",
|
|
2788
|
+
zIndex: 1e4
|
|
2789
|
+
},
|
|
2790
|
+
children: [
|
|
2791
|
+
/* @__PURE__ */ M("button", {
|
|
2792
|
+
type: "button",
|
|
2793
|
+
className: "btn btn-sm btn-danger position-absolute d-flex align-items-center justify-content-center",
|
|
2794
|
+
style: {
|
|
2795
|
+
top: 5,
|
|
2796
|
+
right: 5,
|
|
2797
|
+
zIndex: 1e4,
|
|
2798
|
+
height: 25,
|
|
2799
|
+
width: 25
|
|
2800
|
+
},
|
|
2801
|
+
onClick: () => f(n),
|
|
2802
|
+
children: /* @__PURE__ */ M("i", {
|
|
2803
|
+
className: "material-icons text-white",
|
|
2804
|
+
children: "delete"
|
|
2805
|
+
})
|
|
2806
|
+
}),
|
|
2807
|
+
t === 1 && /* @__PURE__ */ M("div", {
|
|
2808
|
+
className: "row grid-space-16",
|
|
2809
|
+
children: o.map((t) => /* @__PURE__ */ M("div", {
|
|
2810
|
+
className: `${t?.colClass || "col-12"}`,
|
|
2811
|
+
children: h(e, n, t.name)
|
|
2812
|
+
}, t.name))
|
|
2813
|
+
}),
|
|
2814
|
+
t === 2 && /* @__PURE__ */ N("div", {
|
|
2815
|
+
className: "row grid-space-16",
|
|
2816
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2817
|
+
className: "col-md-8",
|
|
2818
|
+
children: /* @__PURE__ */ M("div", {
|
|
2819
|
+
className: "row grid-space-16",
|
|
2820
|
+
children: r.map((t) => /* @__PURE__ */ M("div", {
|
|
2821
|
+
className: `${t?.colClass || "col-12"}`,
|
|
2822
|
+
children: h(e, n, t.name)
|
|
2823
|
+
}, t.name))
|
|
2824
|
+
})
|
|
2825
|
+
}), /* @__PURE__ */ M("div", {
|
|
2826
|
+
className: "col-md-4",
|
|
2827
|
+
children: /* @__PURE__ */ M("div", {
|
|
2828
|
+
className: "row grid-space-16",
|
|
2829
|
+
children: i.map((t) => /* @__PURE__ */ M("div", {
|
|
2830
|
+
className: "col-12",
|
|
2831
|
+
children: h(e, n, t.name)
|
|
2832
|
+
}, t.name))
|
|
2833
|
+
})
|
|
2834
|
+
})]
|
|
2835
|
+
})
|
|
2836
|
+
]
|
|
2837
|
+
}, e._uid);
|
|
2838
|
+
})
|
|
2839
|
+
})
|
|
2840
|
+
}), /* @__PURE__ */ N("button", {
|
|
2841
|
+
type: "button",
|
|
2842
|
+
className: "btn btn-sm btn-info align-items-center d-flex",
|
|
2843
|
+
onClick: d,
|
|
2844
|
+
children: [/* @__PURE__ */ M("i", {
|
|
2845
|
+
className: "material-icons text-white position-relative text-lg me-1",
|
|
2846
|
+
children: "add"
|
|
2847
|
+
}), " Thêm"]
|
|
2848
|
+
})] });
|
|
2849
|
+
}, Xr = ({ label: e, name: t, col: n = "col-auto", keyValue: r = "id", keyName: i = "name", lists: a = [], values: o = [], required: s = !1, disabled: c = !1, readonly: l = !1, cpnClass: u = "", onChange: d }) => {
|
|
2850
|
+
let f = Array.isArray(a) ? a : [], p = Array.isArray(o) ? o : [], m = (e) => {
|
|
2851
|
+
let { checked: n, value: r } = e.target;
|
|
2852
|
+
n && p.push(r);
|
|
2853
|
+
let i = n ? p : p.filter((e) => e !== String(r));
|
|
2854
|
+
d && d({
|
|
2855
|
+
currentTarget: {
|
|
2856
|
+
name: t,
|
|
2857
|
+
value: [...new Set(i)]
|
|
2858
|
+
},
|
|
2859
|
+
preventDefault: () => {}
|
|
2860
|
+
});
|
|
2861
|
+
};
|
|
2862
|
+
return /* @__PURE__ */ N("div", {
|
|
2863
|
+
className: "form-group " + (u ?? ""),
|
|
2864
|
+
children: [e && /* @__PURE__ */ M("label", {
|
|
2865
|
+
className: "form-label ms-auto font-weight-bold",
|
|
2866
|
+
children: e + (s ? " *" : "")
|
|
2867
|
+
}), /* @__PURE__ */ M("div", {
|
|
2868
|
+
className: "row grid-space-16",
|
|
2869
|
+
children: f.map((e) => {
|
|
2870
|
+
let t = Array.isArray(e?.subs) ? e.subs : [];
|
|
2871
|
+
return /* @__PURE__ */ N("div", {
|
|
2872
|
+
className: n + " mb-3",
|
|
2873
|
+
children: [/* @__PURE__ */ M("div", {
|
|
2874
|
+
className: "col-dropdown py-2 ratioChevron cursor-pointer",
|
|
2875
|
+
children: /* @__PURE__ */ M("div", {
|
|
2876
|
+
className: "form-check ps-0 m-0",
|
|
2877
|
+
children: /* @__PURE__ */ N("label", {
|
|
2878
|
+
className: "form-check-label m-0 d-flex align-items-center",
|
|
2879
|
+
children: [
|
|
2880
|
+
/* @__PURE__ */ M("input", {
|
|
2881
|
+
type: "checkbox",
|
|
2882
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
2883
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
2884
|
+
className: "form-check-input d-none",
|
|
2885
|
+
readOnly: l,
|
|
2886
|
+
disabled: c,
|
|
2887
|
+
required: s,
|
|
2888
|
+
value: String(e[r]),
|
|
2889
|
+
checked: p.includes(String(e[r])),
|
|
2890
|
+
onChange: m
|
|
2891
|
+
}),
|
|
2892
|
+
/* @__PURE__ */ M("span", {
|
|
2893
|
+
className: "form-check-sign",
|
|
2894
|
+
style: { height: "20px" },
|
|
2895
|
+
children: /* @__PURE__ */ M("span", { className: "check" })
|
|
2896
|
+
}),
|
|
2897
|
+
/* @__PURE__ */ M("span", {
|
|
2898
|
+
className: "cursor-pointer mb-0 ms-2 d-flex align-items-center",
|
|
2899
|
+
children: String(e[i] ?? "")
|
|
2900
|
+
})
|
|
2901
|
+
]
|
|
2902
|
+
})
|
|
2903
|
+
})
|
|
2904
|
+
}), t.length > 0 && /* @__PURE__ */ M("div", {
|
|
2905
|
+
className: "check-dropdown mt-0",
|
|
2906
|
+
children: t.map((e) => {
|
|
2907
|
+
let t = Array.isArray(e?.subs) ? e.subs : [];
|
|
2908
|
+
return /* @__PURE__ */ N("div", { children: [/* @__PURE__ */ M("div", {
|
|
2909
|
+
className: "form-check",
|
|
2910
|
+
style: { paddingLeft: "30px" },
|
|
2911
|
+
children: /* @__PURE__ */ N("label", {
|
|
2912
|
+
className: "form-check-label m-0 d-flex align-items-center",
|
|
2913
|
+
children: [
|
|
2914
|
+
/* @__PURE__ */ M("input", {
|
|
2915
|
+
type: "checkbox",
|
|
2916
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
2917
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
2918
|
+
className: "form-check-input d-none",
|
|
2919
|
+
readOnly: l,
|
|
2920
|
+
disabled: c,
|
|
2921
|
+
required: s,
|
|
2922
|
+
value: String(e[r]),
|
|
2923
|
+
checked: p.includes(String(e[r])),
|
|
2924
|
+
onChange: m
|
|
2925
|
+
}),
|
|
2926
|
+
/* @__PURE__ */ M("span", {
|
|
2927
|
+
className: "form-check-sign",
|
|
2928
|
+
style: { height: "20px" },
|
|
2929
|
+
children: /* @__PURE__ */ M("span", { className: "check" })
|
|
2930
|
+
}),
|
|
2931
|
+
/* @__PURE__ */ M("span", {
|
|
2932
|
+
className: "cursor-pointer mb-0 ms-2",
|
|
2933
|
+
children: String(e[i] ?? "")
|
|
2934
|
+
})
|
|
2935
|
+
]
|
|
2936
|
+
})
|
|
2937
|
+
}), t.length > 0 && /* @__PURE__ */ M("div", {
|
|
2938
|
+
className: "check-dropdown mb-3",
|
|
2939
|
+
children: t.map((e) => /* @__PURE__ */ M("div", {
|
|
2940
|
+
className: "form-check",
|
|
2941
|
+
style: { paddingLeft: "60px" },
|
|
2942
|
+
children: /* @__PURE__ */ N("label", {
|
|
2943
|
+
className: "form-check-label m-0 d-flex align-items-center",
|
|
2944
|
+
children: [
|
|
2945
|
+
/* @__PURE__ */ M("input", {
|
|
2946
|
+
type: "checkbox",
|
|
2947
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
2948
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
2949
|
+
className: "form-check-input d-none",
|
|
2950
|
+
readOnly: l,
|
|
2951
|
+
disabled: c,
|
|
2952
|
+
required: s,
|
|
2953
|
+
value: String(e[r]),
|
|
2954
|
+
checked: p.includes(String(e[r])),
|
|
2955
|
+
onChange: m
|
|
2956
|
+
}),
|
|
2957
|
+
/* @__PURE__ */ M("span", {
|
|
2958
|
+
className: "form-check-sign",
|
|
2959
|
+
style: { height: "20px" },
|
|
2960
|
+
children: /* @__PURE__ */ M("span", { className: "check" })
|
|
2961
|
+
}),
|
|
2962
|
+
/* @__PURE__ */ M("span", {
|
|
2963
|
+
className: "cursor-pointer mb-0 ms-2",
|
|
2964
|
+
children: String(e[i] ?? "")
|
|
2965
|
+
})
|
|
2966
|
+
]
|
|
2967
|
+
})
|
|
2968
|
+
}, e.id))
|
|
2969
|
+
})] }, e.id);
|
|
2970
|
+
})
|
|
2971
|
+
})]
|
|
2972
|
+
}, e.id);
|
|
2973
|
+
})
|
|
2974
|
+
})]
|
|
2975
|
+
});
|
|
2976
|
+
}, Zr = { textField: { className: "datepicker-custom" } }, Qr = ({ label: e, name: t, value: n = "", cpnClass: r = "", required: i = !1, disabled: a = !1, readonly: o = !1, onChange: s }) => /* @__PURE__ */ M("div", {
|
|
2977
|
+
className: "form-group " + (r ?? ""),
|
|
2978
|
+
children: /* @__PURE__ */ M("div", {
|
|
2979
|
+
className: "input-group input-group-outline",
|
|
2980
|
+
children: /* @__PURE__ */ M(dt, {
|
|
2981
|
+
dateAdapter: ft,
|
|
2982
|
+
adapterLocale: pt,
|
|
2983
|
+
children: /* @__PURE__ */ M(ut, {
|
|
2984
|
+
slotProps: Zr,
|
|
2985
|
+
label: e + (i ? " *" : ""),
|
|
2986
|
+
name: t,
|
|
2987
|
+
value: ((e) => {
|
|
2988
|
+
if (!e) return null;
|
|
2989
|
+
let t = new Date(e);
|
|
2990
|
+
return isNaN(t.getTime()) ? null : t;
|
|
2991
|
+
})(n),
|
|
2992
|
+
onChange: (e) => {
|
|
2993
|
+
s && e && !isNaN(new Date(e).getTime()) && s({
|
|
2994
|
+
target: {
|
|
2995
|
+
name: t,
|
|
2996
|
+
value: ie(new Date(e), "yyyy-MM-dd")
|
|
2997
|
+
},
|
|
2998
|
+
preventDefault: () => {}
|
|
2999
|
+
});
|
|
3000
|
+
},
|
|
3001
|
+
disabled: a,
|
|
3002
|
+
readOnly: o
|
|
3003
|
+
})
|
|
3004
|
+
})
|
|
3005
|
+
})
|
|
3006
|
+
}), $r = { textField: { className: "datepicker-custom" } }, ei = ({ label: e, name: t, value: n = "", debug: r = !1, defaultValue: i = "", cpnClass: a = "", required: o, onChange: s, ...c }) => {
|
|
3007
|
+
let l = E(!1);
|
|
3008
|
+
w(() => {
|
|
3009
|
+
if (r && console.log("DateTimeInput mounted", {
|
|
3010
|
+
value: n,
|
|
3011
|
+
defaultValue: i,
|
|
3012
|
+
onChange: !!s
|
|
3013
|
+
}), !l.current && !n && i && s) {
|
|
3014
|
+
let e = u(i);
|
|
3015
|
+
e && (l.current = !0, d(e));
|
|
3016
|
+
}
|
|
3017
|
+
}, [
|
|
3018
|
+
n,
|
|
3019
|
+
i,
|
|
3020
|
+
s
|
|
3021
|
+
]);
|
|
3022
|
+
let u = (e) => {
|
|
3023
|
+
if (!e) return null;
|
|
3024
|
+
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
3025
|
+
let t = new Date(e);
|
|
3026
|
+
return isNaN(t.getTime()) ? null : t;
|
|
3027
|
+
}, d = (e) => {
|
|
3028
|
+
r && console.log("handleChange", {
|
|
3029
|
+
name: t,
|
|
3030
|
+
date: e
|
|
3031
|
+
}), s && e && !isNaN(e.getTime()) && s({
|
|
3032
|
+
target: {
|
|
3033
|
+
name: t,
|
|
3034
|
+
value: ie(e, "yyyy-MM-dd HH:mm:ss")
|
|
3035
|
+
},
|
|
3036
|
+
preventDefault: () => {}
|
|
3037
|
+
});
|
|
3038
|
+
}, f = u(n) ?? u(i);
|
|
3039
|
+
return /* @__PURE__ */ M("div", {
|
|
3040
|
+
className: "form-group " + (a ?? ""),
|
|
3041
|
+
children: /* @__PURE__ */ M("div", {
|
|
3042
|
+
className: "input-group input-group-outline",
|
|
3043
|
+
children: /* @__PURE__ */ M(dt, {
|
|
3044
|
+
dateAdapter: ft,
|
|
3045
|
+
adapterLocale: pt,
|
|
3046
|
+
children: /* @__PURE__ */ M(mt, {
|
|
3047
|
+
slotProps: $r,
|
|
3048
|
+
label: e + (o ? " *" : ""),
|
|
3049
|
+
name: t,
|
|
3050
|
+
value: f,
|
|
3051
|
+
onChange: d,
|
|
3052
|
+
...c
|
|
3053
|
+
})
|
|
3054
|
+
})
|
|
3055
|
+
})
|
|
3056
|
+
});
|
|
3057
|
+
}, ti = ({ label: e, name: n, cpnClass: r = "", required: i = !1, value: a = "", onChange: o, isEdit: s = !1, ext: c = ".jpg, .jpeg, .png", df: l = "/styles/default.jpg" }) => {
|
|
3058
|
+
let u = E(null), [d, f] = D(a), [m, h] = D("");
|
|
3059
|
+
return w(() => {
|
|
3060
|
+
let e = u.current?.querySelector(".upFile");
|
|
3061
|
+
e && t(e, "#elfinderModal", (e) => {
|
|
3062
|
+
let { data: t, md: n } = e;
|
|
3063
|
+
if (t) {
|
|
3064
|
+
let e = (Array.isArray(t) ? t[0] : t).url?.replace(/^.*\/static/, "") ?? "";
|
|
3065
|
+
f(e);
|
|
3066
|
+
let r = e ? e.split("/").pop() ?? "" : "";
|
|
3067
|
+
h(r), n?.hide();
|
|
3068
|
+
}
|
|
3069
|
+
});
|
|
3070
|
+
}, []), w(() => {
|
|
3071
|
+
o && o({
|
|
3072
|
+
target: {
|
|
3073
|
+
name: n,
|
|
3074
|
+
value: d
|
|
3075
|
+
},
|
|
3076
|
+
preventDefault: () => {}
|
|
3077
|
+
});
|
|
3078
|
+
}, [
|
|
3079
|
+
d,
|
|
3080
|
+
n,
|
|
3081
|
+
o
|
|
3082
|
+
]), w(() => {
|
|
3083
|
+
f(a);
|
|
3084
|
+
let e = a ? a.split("/").pop() : "";
|
|
3085
|
+
h(e ?? "");
|
|
3086
|
+
}, [a, l]), /* @__PURE__ */ N("div", {
|
|
3087
|
+
ref: u,
|
|
3088
|
+
className: `card ${r}`,
|
|
3089
|
+
children: [
|
|
3090
|
+
/* @__PURE__ */ M("div", {
|
|
3091
|
+
className: "card-header",
|
|
3092
|
+
children: /* @__PURE__ */ M("div", {
|
|
3093
|
+
className: "row",
|
|
3094
|
+
children: /* @__PURE__ */ M("div", {
|
|
3095
|
+
className: "flex-auto col-auto d-flex align-items-center",
|
|
3096
|
+
children: /* @__PURE__ */ M("h3", {
|
|
3097
|
+
className: "card-title",
|
|
3098
|
+
children: e
|
|
3099
|
+
})
|
|
3100
|
+
})
|
|
3101
|
+
})
|
|
3102
|
+
}),
|
|
3103
|
+
/* @__PURE__ */ M("hr", { className: "my-0" }),
|
|
3104
|
+
/* @__PURE__ */ M("div", {
|
|
3105
|
+
className: "card-body p-0 px-3",
|
|
3106
|
+
children: /* @__PURE__ */ M("div", {
|
|
3107
|
+
className: "d-flex align-items-center",
|
|
3108
|
+
style: { minHeight: 30 },
|
|
3109
|
+
children: d && /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("i", { className: "fal fa-file me-1" }), /* @__PURE__ */ M("a", {
|
|
3110
|
+
className: "text-info text-1-line",
|
|
3111
|
+
href: p(d),
|
|
3112
|
+
target: "_blank",
|
|
3113
|
+
children: m
|
|
3114
|
+
})] })
|
|
3115
|
+
})
|
|
3116
|
+
}),
|
|
3117
|
+
s && /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("hr", { className: "my-0" }), /* @__PURE__ */ N("div", {
|
|
3118
|
+
className: "card-footer d-flex justify-content-between",
|
|
3119
|
+
children: [
|
|
3120
|
+
/* @__PURE__ */ M("label", {
|
|
3121
|
+
className: "text-info cursor-pointer m-0 upFile",
|
|
3122
|
+
children: "Tải lên"
|
|
3123
|
+
}),
|
|
3124
|
+
/* @__PURE__ */ M("input", {
|
|
3125
|
+
value: d,
|
|
3126
|
+
required: i,
|
|
3127
|
+
name: n,
|
|
3128
|
+
type: "text",
|
|
3129
|
+
onChange: o,
|
|
3130
|
+
className: "d-none default-file-input",
|
|
3131
|
+
accept: c
|
|
3132
|
+
}),
|
|
3133
|
+
d && /* @__PURE__ */ M("a", {
|
|
3134
|
+
href: "#",
|
|
3135
|
+
onClick: (e) => {
|
|
3136
|
+
f("");
|
|
3137
|
+
},
|
|
3138
|
+
className: "ml-auto link text-danger",
|
|
3139
|
+
children: "Xóa"
|
|
3140
|
+
})
|
|
3141
|
+
]
|
|
3142
|
+
})] })
|
|
3143
|
+
]
|
|
3144
|
+
});
|
|
3145
|
+
}, ni = ({ label: e, name: t, cpnClass: n = "", required: r = !1, value: a = [], onChange: o, isEdit: s = !1, ext: c = ".jpg, .jpeg, .png" }) => {
|
|
3146
|
+
let l = Array.isArray(a) ? a : [];
|
|
3147
|
+
return /* @__PURE__ */ N("div", {
|
|
3148
|
+
className: `card card-primary card-outline boxSImgs ${n}`,
|
|
3149
|
+
children: [
|
|
3150
|
+
/* @__PURE__ */ M("div", {
|
|
3151
|
+
className: "card-header",
|
|
3152
|
+
children: /* @__PURE__ */ M("div", {
|
|
3153
|
+
className: "row",
|
|
3154
|
+
children: /* @__PURE__ */ M("div", {
|
|
3155
|
+
className: "flex-auto col-auto d-flex align-items-center",
|
|
3156
|
+
children: /* @__PURE__ */ M("h3", {
|
|
3157
|
+
className: "card-title",
|
|
3158
|
+
children: e
|
|
3159
|
+
})
|
|
3160
|
+
})
|
|
3161
|
+
})
|
|
3162
|
+
}),
|
|
3163
|
+
/* @__PURE__ */ M("hr", { className: "my-0" }),
|
|
3164
|
+
/* @__PURE__ */ M("div", {
|
|
3165
|
+
className: "card-body d-flex justify-content-center min-height-100 pb-2",
|
|
3166
|
+
children: /* @__PURE__ */ M("div", {
|
|
3167
|
+
className: "row grid-space-10 showImg w-100",
|
|
3168
|
+
children: l.map((e, n) => /* @__PURE__ */ N("div", {
|
|
3169
|
+
className: "col-auto col-img mb-2",
|
|
3170
|
+
children: [/* @__PURE__ */ N("div", {
|
|
3171
|
+
className: "d-flex align-items-center",
|
|
3172
|
+
children: [/* @__PURE__ */ M("a", {
|
|
3173
|
+
target: "_blank",
|
|
3174
|
+
href: i(e),
|
|
3175
|
+
children: /* @__PURE__ */ M("img", {
|
|
3176
|
+
src: i(e),
|
|
3177
|
+
className: "height-50 object-fit-contain"
|
|
3178
|
+
})
|
|
3179
|
+
}), s && /* @__PURE__ */ M("a", {
|
|
3180
|
+
"data-file": e,
|
|
3181
|
+
href: "#",
|
|
3182
|
+
className: "rmImg ms-2 link text-danger",
|
|
3183
|
+
children: "Xóa"
|
|
3184
|
+
})]
|
|
3185
|
+
}), /* @__PURE__ */ M("input", {
|
|
3186
|
+
type: "hidden",
|
|
3187
|
+
name: `${t}Old[]`,
|
|
3188
|
+
value: e
|
|
3189
|
+
})]
|
|
3190
|
+
}, n))
|
|
3191
|
+
})
|
|
3192
|
+
}),
|
|
3193
|
+
s && /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("hr", { className: "my-0" }), /* @__PURE__ */ N("div", {
|
|
3194
|
+
className: "card-footer d-flex justify-content-between",
|
|
3195
|
+
children: [/* @__PURE__ */ M("label", {
|
|
3196
|
+
className: "text-info cursor-pointer p-0 upMImage",
|
|
3197
|
+
children: "Tải lên"
|
|
3198
|
+
}), /* @__PURE__ */ M("input", {
|
|
3199
|
+
required: r,
|
|
3200
|
+
onChange: o,
|
|
3201
|
+
name: `${t}[]`,
|
|
3202
|
+
type: "file",
|
|
3203
|
+
className: "d-none default-file-input",
|
|
3204
|
+
multiple: !0,
|
|
3205
|
+
accept: c
|
|
3206
|
+
})]
|
|
3207
|
+
})] })
|
|
3208
|
+
]
|
|
3209
|
+
});
|
|
3210
|
+
}, ri = ({ label: e, name: t, cpnClass: n = "", required: r = !1, value: i = "", onChange: a, isEdit: o = !1, ext: s = ".jpg, .png, .jpeg, .ico", df: l = "" }) => {
|
|
3211
|
+
let u = E(null), [p, m] = D(""), [g, _] = D(""), [v, y] = D(i || ""), b = (e) => {
|
|
3212
|
+
e.preventDefault();
|
|
3213
|
+
let t = /\.(jpg|png|jpeg|ico)$/i, n = u.current?.querySelector(".default-file-input");
|
|
3214
|
+
if (!n) return;
|
|
3215
|
+
let r = n.files;
|
|
3216
|
+
if (!r) return;
|
|
3217
|
+
let i = n.getAttribute("accept"), a = f(i, t);
|
|
3218
|
+
d(r, 10, a).then(async () => {
|
|
3219
|
+
let e = Array.from(r);
|
|
3220
|
+
e.length && (m(e[0]), _(await S(e[0])));
|
|
3221
|
+
}).catch((e) => {
|
|
3222
|
+
console.error("[PImage] Upload không hợp lệ:", e.message);
|
|
3223
|
+
});
|
|
3224
|
+
}, x = (e) => {
|
|
3225
|
+
e.preventDefault(), m(""), y("");
|
|
3226
|
+
}, S = (e) => new Promise((t, n) => {
|
|
3227
|
+
let r = new FileReader();
|
|
3228
|
+
r.onload = (e) => t(e.target?.result), r.onerror = n, r.readAsDataURL(e);
|
|
3229
|
+
});
|
|
3230
|
+
return w(() => {
|
|
3231
|
+
a && a(h(`${t}_upload`, p, "file"));
|
|
3232
|
+
}, [p]), w(() => {
|
|
3233
|
+
a && a(h(t, v));
|
|
3234
|
+
}, [v]), /* @__PURE__ */ N("div", {
|
|
3235
|
+
ref: u,
|
|
3236
|
+
className: `card boxPImage ${n}`,
|
|
3237
|
+
children: [
|
|
3238
|
+
/* @__PURE__ */ M("div", {
|
|
3239
|
+
className: "card-header",
|
|
3240
|
+
children: /* @__PURE__ */ M("div", {
|
|
3241
|
+
className: "row",
|
|
3242
|
+
children: /* @__PURE__ */ M("div", {
|
|
3243
|
+
className: "flex-auto col-auto d-flex align-items-center",
|
|
3244
|
+
children: /* @__PURE__ */ M("h3", {
|
|
3245
|
+
className: "card-title",
|
|
3246
|
+
children: e
|
|
3247
|
+
})
|
|
3248
|
+
})
|
|
3249
|
+
})
|
|
3250
|
+
}),
|
|
3251
|
+
/* @__PURE__ */ M("hr", { className: "my-0" }),
|
|
3252
|
+
/* @__PURE__ */ M("div", {
|
|
3253
|
+
className: "card-body d-flex justify-content-center p-0 showImg",
|
|
3254
|
+
style: { minHeight: "50px" },
|
|
3255
|
+
children: /* @__PURE__ */ N("div", {
|
|
3256
|
+
className: "d-flex align-items-center justify-content-center",
|
|
3257
|
+
children: [
|
|
3258
|
+
p && /* @__PURE__ */ M("img", {
|
|
3259
|
+
className: "height-100 object-fit-contain w-100",
|
|
3260
|
+
src: p ? g : "",
|
|
3261
|
+
alt: "img"
|
|
3262
|
+
}),
|
|
3263
|
+
v && !p && /* @__PURE__ */ M("img", {
|
|
3264
|
+
className: "height-100 object-fit-contain w-100",
|
|
3265
|
+
src: c(v, l),
|
|
3266
|
+
alt: "img"
|
|
3267
|
+
}),
|
|
3268
|
+
!v && !p && l && /* @__PURE__ */ M("img", {
|
|
3269
|
+
className: "height-100 object-fit-contain w-100",
|
|
3270
|
+
src: c(v, l),
|
|
3271
|
+
alt: "img"
|
|
3272
|
+
})
|
|
3273
|
+
]
|
|
3274
|
+
})
|
|
3275
|
+
}),
|
|
3276
|
+
o && /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("hr", { className: "my-0" }), /* @__PURE__ */ N("div", {
|
|
3277
|
+
className: "card-footer d-flex justify-content-between",
|
|
3278
|
+
children: [/* @__PURE__ */ M("a", {
|
|
3279
|
+
onClick: (e) => x(e),
|
|
3280
|
+
href: "#",
|
|
3281
|
+
className: `ml-auto link text-danger ${p || v ? "" : "d-none"}`,
|
|
3282
|
+
children: "Xóa"
|
|
3283
|
+
}), o && /* @__PURE__ */ N("label", {
|
|
3284
|
+
className: "text-info cursor-pointer m-0",
|
|
3285
|
+
children: ["Tải lên", /* @__PURE__ */ M("input", {
|
|
3286
|
+
required: r,
|
|
3287
|
+
name: t,
|
|
3288
|
+
type: "file",
|
|
3289
|
+
onChange: b,
|
|
3290
|
+
className: "d-none default-file-input",
|
|
3291
|
+
accept: s
|
|
3292
|
+
})]
|
|
3293
|
+
})]
|
|
3294
|
+
})] })
|
|
3295
|
+
]
|
|
3296
|
+
});
|
|
3297
|
+
}, ii = ({ itemLabel: e, itemName: t, selectName: n = "", lists: r, rendeRowData: i, detailRow: a, onSubmit: o, onChangeRow: s, keyName: c = "name", keyValue: l = "id", isEdit: u = !0 }) => {
|
|
3298
|
+
let d = E(null), [f, p] = D([]), [m, h] = D([]);
|
|
3299
|
+
w(() => {
|
|
3300
|
+
d?.current && (new _(d?.current).run(), h(Array.isArray(f) ? [...new Set(f.map((e) => e[t]))].filter((e) => typeof e == "string" || typeof e == "number") : []));
|
|
3301
|
+
}, [f, t]), w(() => {
|
|
3302
|
+
p(Array.isArray(a) ? a : []);
|
|
3303
|
+
}, [a]);
|
|
3304
|
+
let g = async (e) => {
|
|
3305
|
+
if (e.preventDefault(), !d?.current) return;
|
|
3306
|
+
let t = new _(d?.current);
|
|
3307
|
+
!t.hasErrors() && !t.isIncomplete() && f?.length && o && o(f, d?.current);
|
|
3308
|
+
}, v = (e) => {
|
|
3309
|
+
let { value: n } = e.target, r = Array.isArray(n) ? n : [], i = f.filter((e) => r.includes(e[t])), a = r.filter((e) => !i.some((n) => n[t] === e)), o = [...i, ...a.map((e) => ({ [t]: e }))];
|
|
3310
|
+
p(o), s && s(o);
|
|
3311
|
+
}, y = (e, t) => {
|
|
3312
|
+
let { name: n, value: r } = e.target, i = [...f];
|
|
3313
|
+
i[t] = {
|
|
3314
|
+
...i[t],
|
|
3315
|
+
[n]: r
|
|
3316
|
+
}, p(i);
|
|
3317
|
+
};
|
|
3318
|
+
return /* @__PURE__ */ M(j, { children: /* @__PURE__ */ M(ht, {
|
|
3319
|
+
ref: d,
|
|
3320
|
+
className: "position-relative",
|
|
3321
|
+
action: "/abc",
|
|
3322
|
+
method: "post",
|
|
3323
|
+
encType: "multipart/form-data",
|
|
3324
|
+
"data-toggle": "validator",
|
|
3325
|
+
role: "form",
|
|
3326
|
+
onSubmit: g,
|
|
3327
|
+
children: /* @__PURE__ */ N("div", {
|
|
3328
|
+
className: "card mb-20",
|
|
3329
|
+
children: [
|
|
3330
|
+
/* @__PURE__ */ N("div", {
|
|
3331
|
+
className: "card-header flex-auto col-auto d-flex align-items-center",
|
|
3332
|
+
children: [/* @__PURE__ */ M("h3", {
|
|
3333
|
+
className: "card-title",
|
|
3334
|
+
children: e
|
|
3335
|
+
}), u && /* @__PURE__ */ M("button", {
|
|
3336
|
+
type: "submit",
|
|
3337
|
+
title: "Cập nhật",
|
|
3338
|
+
className: "btn btn-success btn-sm btn-icon ms-auto",
|
|
3339
|
+
children: /* @__PURE__ */ M("i", {
|
|
3340
|
+
className: "material-icons text-white position-relative text-lg",
|
|
3341
|
+
children: "save"
|
|
3342
|
+
})
|
|
3343
|
+
})]
|
|
3344
|
+
}),
|
|
3345
|
+
/* @__PURE__ */ M("hr", { className: "m-0" }),
|
|
3346
|
+
/* @__PURE__ */ N("div", {
|
|
3347
|
+
className: "card-body pb-0",
|
|
3348
|
+
children: [u && /* @__PURE__ */ M(Ft, {
|
|
3349
|
+
cpnClass: "mb-20",
|
|
3350
|
+
label: n || e,
|
|
3351
|
+
onChange: v,
|
|
3352
|
+
required: !0,
|
|
3353
|
+
lists: r,
|
|
3354
|
+
name: t,
|
|
3355
|
+
value: m,
|
|
3356
|
+
keyName: c,
|
|
3357
|
+
keyValue: l
|
|
3358
|
+
}), Array.isArray(f) && f?.map((e, t) => /* @__PURE__ */ N("div", { children: [i?.(e, t, y), t !== f.length - 1 && /* @__PURE__ */ M("hr", { className: "mt-0 mb-20" })] }, t))]
|
|
3359
|
+
})
|
|
3360
|
+
]
|
|
3361
|
+
})
|
|
3362
|
+
}) });
|
|
3363
|
+
}, ai = (e, t) => (Array.isArray(t) ? t : []).map((t) => e.find((e) => e.value === t)).filter((e) => e !== void 0), oi = (e, t, n, r, i) => {
|
|
3364
|
+
let a = [];
|
|
3365
|
+
r && a.push({
|
|
3366
|
+
value: -1,
|
|
3367
|
+
label: "Tất cả"
|
|
3368
|
+
}), i && a.push({
|
|
3369
|
+
value: 0,
|
|
3370
|
+
label: "Không có"
|
|
3371
|
+
});
|
|
3372
|
+
let o = Array.isArray(e) ? e.map((e) => ({
|
|
3373
|
+
value: e[t],
|
|
3374
|
+
label: String(e[n] ?? "")
|
|
3375
|
+
})) : [];
|
|
3376
|
+
return [...a, ...o];
|
|
3377
|
+
}, si = ({ label: e, name: t, lists: n = [], keyValue: r = "id", keyName: i = "name", value: a = [], cpnClass: o = "", required: s = !1, disabled: c = !1, all: l = !1, zero: u = !1, onChange: d }) => {
|
|
3378
|
+
let [f, p] = D([]);
|
|
3379
|
+
w(() => {
|
|
3380
|
+
p(oi(n, r, i, l, u));
|
|
3381
|
+
}, [n]);
|
|
3382
|
+
let m = (e) => {
|
|
3383
|
+
if (!e.destination) return;
|
|
3384
|
+
let n = [...ai(f, a)], [r] = n.splice(e.source.index, 1);
|
|
3385
|
+
n.splice(e.destination.index, 0, r), d?.({
|
|
3386
|
+
target: {
|
|
3387
|
+
name: t,
|
|
3388
|
+
value: n.map((e) => e?.value)
|
|
3389
|
+
},
|
|
3390
|
+
preventDefault: () => {}
|
|
3391
|
+
});
|
|
3392
|
+
}, h = (e) => {
|
|
3393
|
+
d?.({
|
|
3394
|
+
target: {
|
|
3395
|
+
name: t,
|
|
3396
|
+
value: e
|
|
3397
|
+
},
|
|
3398
|
+
preventDefault: () => {}
|
|
3399
|
+
});
|
|
3400
|
+
}, g = (e) => /* @__PURE__ */ N(k.Option, {
|
|
3401
|
+
...e,
|
|
3402
|
+
children: [/* @__PURE__ */ M("input", {
|
|
3403
|
+
type: "checkbox",
|
|
3404
|
+
checked: e.isSelected,
|
|
3405
|
+
onChange: () => null,
|
|
3406
|
+
style: { marginRight: 8 }
|
|
3407
|
+
}), /* @__PURE__ */ M("div", { children: e.label })]
|
|
3408
|
+
}), _ = (e) => /* @__PURE__ */ M(re, {
|
|
3409
|
+
draggableId: String(e.data.value),
|
|
3410
|
+
index: e.index,
|
|
3411
|
+
children: (t) => /* @__PURE__ */ M("div", {
|
|
3412
|
+
ref: t.innerRef,
|
|
3413
|
+
...t.draggableProps,
|
|
3414
|
+
...t.dragHandleProps,
|
|
3415
|
+
style: {
|
|
3416
|
+
display: "inline-flex",
|
|
3417
|
+
alignItems: "center",
|
|
3418
|
+
marginRight: 6,
|
|
3419
|
+
...t.draggableProps.style
|
|
3420
|
+
},
|
|
3421
|
+
children: /* @__PURE__ */ M(k.MultiValue, { ...e })
|
|
3422
|
+
})
|
|
3423
|
+
});
|
|
3424
|
+
return /* @__PURE__ */ N("div", {
|
|
3425
|
+
className: "form-group " + (o ?? ""),
|
|
3426
|
+
children: [/* @__PURE__ */ M("div", {
|
|
3427
|
+
className: "form-label mb-1",
|
|
3428
|
+
children: e + (s ? " *" : "")
|
|
3429
|
+
}), /* @__PURE__ */ M(ne, {
|
|
3430
|
+
onDragEnd: m,
|
|
3431
|
+
children: /* @__PURE__ */ M(A, {
|
|
3432
|
+
droppableId: "selected",
|
|
3433
|
+
direction: "horizontal",
|
|
3434
|
+
children: (e) => /* @__PURE__ */ N("div", {
|
|
3435
|
+
ref: e.innerRef,
|
|
3436
|
+
...e.droppableProps,
|
|
3437
|
+
children: [/* @__PURE__ */ M(O, {
|
|
3438
|
+
options: f,
|
|
3439
|
+
value: ai(f, a),
|
|
3440
|
+
isMulti: !0,
|
|
3441
|
+
isSearchable: !0,
|
|
3442
|
+
closeMenuOnSelect: !1,
|
|
3443
|
+
hideSelectedOptions: !1,
|
|
3444
|
+
placeholder: "Chọn và kéo thả để sắp xếp...",
|
|
3445
|
+
noOptionsMessage: () => "Không có dữ liệu",
|
|
3446
|
+
"data-required-error": "Vui lòng nhập dữ liệu",
|
|
3447
|
+
"data-error": "Dữ liệu không hợp lệ",
|
|
3448
|
+
isDisabled: c,
|
|
3449
|
+
components: {
|
|
3450
|
+
Option: g,
|
|
3451
|
+
MultiValue: _
|
|
3452
|
+
},
|
|
3453
|
+
onChange: (e) => h((e ?? []).map((e) => e.value)),
|
|
3454
|
+
menuPortalTarget: document.body,
|
|
3455
|
+
styles: {
|
|
3456
|
+
menuPortal: (e) => ({
|
|
3457
|
+
...e,
|
|
3458
|
+
zIndex: 99999
|
|
3459
|
+
}),
|
|
3460
|
+
input: (e) => ({
|
|
3461
|
+
...e,
|
|
3462
|
+
minHeight: 30
|
|
3463
|
+
}),
|
|
3464
|
+
multiValue: (e) => ({
|
|
3465
|
+
...e,
|
|
3466
|
+
cursor: "grab"
|
|
3467
|
+
}),
|
|
3468
|
+
menuList: (e) => ({
|
|
3469
|
+
...e,
|
|
3470
|
+
display: "flex",
|
|
3471
|
+
flexDirection: "column",
|
|
3472
|
+
alignItems: "center",
|
|
3473
|
+
paddingLeft: 5,
|
|
3474
|
+
paddingRight: 5,
|
|
3475
|
+
paddingTop: 5,
|
|
3476
|
+
paddingBottom: 2
|
|
3477
|
+
}),
|
|
3478
|
+
option: (e, t) => ({
|
|
3479
|
+
...e,
|
|
3480
|
+
minHeight: 40,
|
|
3481
|
+
width: "100%",
|
|
3482
|
+
display: "flex",
|
|
3483
|
+
alignItems: "center",
|
|
3484
|
+
paddingTop: 8,
|
|
3485
|
+
paddingBottom: 8,
|
|
3486
|
+
marginBottom: 5,
|
|
3487
|
+
borderRadius: 6,
|
|
3488
|
+
justifyContent: "flex-start",
|
|
3489
|
+
backgroundColor: t.isFocused ? "#FFC20E" : t.isSelected ? "#ED7D31" : "white",
|
|
3490
|
+
color: t.isFocused ? "#333" : t.isSelected ? "#fff" : "#333",
|
|
3491
|
+
cursor: "pointer"
|
|
3492
|
+
})
|
|
3493
|
+
}
|
|
3494
|
+
}), e.placeholder]
|
|
3495
|
+
})
|
|
3496
|
+
})
|
|
3497
|
+
})]
|
|
3498
|
+
});
|
|
3499
|
+
}, ci = ({ itemLabel: e, itemName: t, selectName: n = "", lists: r, rendeRowData: i, detailRow: a, onSubmit: o, keyValue: s = "id", keyName: c = "name", isEdit: l = !0 }) => {
|
|
3500
|
+
let u = E(null), [d, f] = D([]), [p, m] = D([]);
|
|
3501
|
+
w(() => {
|
|
3502
|
+
if (!u?.current) return;
|
|
3503
|
+
new _(u?.current).run();
|
|
3504
|
+
let e = Array.isArray(d) ? [...new Set(d.map((e) => e[t]))] : [];
|
|
3505
|
+
m(e);
|
|
3506
|
+
}, [d]), w(() => {
|
|
3507
|
+
f(Array.isArray(a) ? a : []);
|
|
3508
|
+
}, [a]);
|
|
3509
|
+
let h = async (e) => {
|
|
3510
|
+
if (e.preventDefault(), !u?.current) return;
|
|
3511
|
+
let t = new _(u?.current);
|
|
3512
|
+
!t.hasErrors() && !t.isIncomplete() && d?.length && o && o(d, u?.current);
|
|
3513
|
+
}, g = (e) => {
|
|
3514
|
+
let { value: n } = e.target, r = Array.isArray(n) ? n : [], i = d.filter((e) => r.includes(e[t])), a = r.filter((e) => !i.some((n) => n[t] === e)), o = Array.isArray(a) ? a.map((e) => ({ [t]: e })) : [], s = [...i, ...o];
|
|
3515
|
+
f(s);
|
|
3516
|
+
}, v = (e, t) => {
|
|
3517
|
+
let { name: n, value: r } = e.target, i = [...d];
|
|
3518
|
+
i[t] = {
|
|
3519
|
+
...i[t],
|
|
3520
|
+
[n]: r
|
|
3521
|
+
}, f(i);
|
|
3522
|
+
};
|
|
3523
|
+
return /* @__PURE__ */ M(j, { children: /* @__PURE__ */ M(ht, {
|
|
3524
|
+
ref: u,
|
|
3525
|
+
className: "position-relative",
|
|
3526
|
+
action: "/abc",
|
|
3527
|
+
method: "post",
|
|
3528
|
+
encType: "multipart/form-data",
|
|
3529
|
+
"data-toggle": "validator",
|
|
3530
|
+
role: "form",
|
|
3531
|
+
onSubmit: h,
|
|
3532
|
+
children: /* @__PURE__ */ N("div", {
|
|
3533
|
+
className: "card mb-20",
|
|
3534
|
+
children: [
|
|
3535
|
+
/* @__PURE__ */ N("div", {
|
|
3536
|
+
className: "card-header flex-auto col-auto d-flex align-items-center",
|
|
3537
|
+
children: [/* @__PURE__ */ M("h3", {
|
|
3538
|
+
className: "card-title",
|
|
3539
|
+
children: e
|
|
3540
|
+
}), l && /* @__PURE__ */ M("button", {
|
|
3541
|
+
type: "submit",
|
|
3542
|
+
title: "Cập nhật",
|
|
3543
|
+
className: "btn btn-success btn-sm btn-icon ms-auto",
|
|
3544
|
+
children: /* @__PURE__ */ M("i", {
|
|
3545
|
+
className: "material-icons text-white position-relative text-lg",
|
|
3546
|
+
children: "save"
|
|
3547
|
+
})
|
|
3548
|
+
})]
|
|
3549
|
+
}),
|
|
3550
|
+
/* @__PURE__ */ M("hr", { className: "m-0" }),
|
|
3551
|
+
/* @__PURE__ */ N("div", {
|
|
3552
|
+
className: "card-body pb-0",
|
|
3553
|
+
children: [l && /* @__PURE__ */ M(si, {
|
|
3554
|
+
cpnClass: "mb-20",
|
|
3555
|
+
label: n || e,
|
|
3556
|
+
onChange: g,
|
|
3557
|
+
keyName: c,
|
|
3558
|
+
keyValue: s,
|
|
3559
|
+
required: !0,
|
|
3560
|
+
lists: r,
|
|
3561
|
+
name: t,
|
|
3562
|
+
value: p
|
|
3563
|
+
}), /* @__PURE__ */ M("div", {
|
|
3564
|
+
className: "row grid-space-10",
|
|
3565
|
+
children: Array.isArray(d) && d.map((e, t) => /* @__PURE__ */ M("div", {
|
|
3566
|
+
style: { minWidth: 200 },
|
|
3567
|
+
className: "col-auto flex-1",
|
|
3568
|
+
children: i?.(e, t, v)
|
|
3569
|
+
}, t))
|
|
3570
|
+
})]
|
|
3571
|
+
})
|
|
3572
|
+
]
|
|
3573
|
+
})
|
|
3574
|
+
}) });
|
|
3575
|
+
}, li = ({ label: e, name: t, cpnClass: n = "", required: r = !1, disabled: i, readonly: a, value: s = "", onChange: c, isEdit: l = !1, ext: u = ".xlsx, .xls, .docx, .doc, .pdf", df: p = "" }) => {
|
|
3576
|
+
let m = E(null), g = E(null), [_, v] = D(""), [y, b] = D("");
|
|
3577
|
+
w(() => {
|
|
3578
|
+
b((s ?? "").split("/").pop() ?? ""), v(o(s, p));
|
|
3579
|
+
}, [s, p]), w(() => () => {
|
|
3580
|
+
g.current &&= (URL.revokeObjectURL(g.current), null);
|
|
3581
|
+
}, []);
|
|
3582
|
+
let x = (e) => {
|
|
3583
|
+
e.preventDefault();
|
|
3584
|
+
let t = /\.(pdf|docx|doc|xlsx|xls)$/i, n = e.target.files;
|
|
3585
|
+
if (!n || n.length === 0) return;
|
|
3586
|
+
let r = e.target.getAttribute("accept"), i = f(r, t);
|
|
3587
|
+
d(n, 10, i).then(() => {
|
|
3588
|
+
let t = n[0];
|
|
3589
|
+
if (!t) return;
|
|
3590
|
+
g.current && URL.revokeObjectURL(g.current);
|
|
3591
|
+
let r = URL.createObjectURL(t);
|
|
3592
|
+
g.current = r, v(r), b(t.name), c?.(e);
|
|
3593
|
+
}).catch((t) => {
|
|
3594
|
+
console.error("Upload file validation failed:", t), e.target.value = "";
|
|
3595
|
+
});
|
|
3596
|
+
}, S = (e) => {
|
|
3597
|
+
e.preventDefault(), g.current &&= (URL.revokeObjectURL(g.current), null), v(""), b(""), m.current && (m.current.value = ""), c && c(h(t, "", "input"));
|
|
3598
|
+
}, C = l && !i && !a;
|
|
3599
|
+
return /* @__PURE__ */ N("div", {
|
|
3600
|
+
className: `card ${n}`,
|
|
3601
|
+
children: [
|
|
3602
|
+
/* @__PURE__ */ M("div", {
|
|
3603
|
+
className: "card-header",
|
|
3604
|
+
children: /* @__PURE__ */ M("div", {
|
|
3605
|
+
className: "row",
|
|
3606
|
+
children: /* @__PURE__ */ N("div", {
|
|
3607
|
+
className: "flex-auto col-auto d-flex align-items-center",
|
|
3608
|
+
children: [/* @__PURE__ */ M("h3", {
|
|
3609
|
+
className: "card-title",
|
|
3610
|
+
children: e
|
|
3611
|
+
}), C && /* @__PURE__ */ N("label", {
|
|
3612
|
+
className: "text-info cursor-pointer m-0 ms-auto",
|
|
3613
|
+
children: ["Tải lên", /* @__PURE__ */ M("input", {
|
|
3614
|
+
ref: m,
|
|
3615
|
+
required: r,
|
|
3616
|
+
disabled: i,
|
|
3617
|
+
name: t,
|
|
3618
|
+
type: "file",
|
|
3619
|
+
onChange: x,
|
|
3620
|
+
className: "d-none default-file-input",
|
|
3621
|
+
accept: u
|
|
3622
|
+
})]
|
|
3623
|
+
})]
|
|
3624
|
+
})
|
|
3625
|
+
})
|
|
3626
|
+
}),
|
|
3627
|
+
/* @__PURE__ */ M("hr", { className: "my-0" }),
|
|
3628
|
+
/* @__PURE__ */ N("div", {
|
|
3629
|
+
className: "card-body d-flex justify-content-between align-items-center px-3 py-0 showFile",
|
|
3630
|
+
style: { minHeight: "50px" },
|
|
3631
|
+
children: [_ && /* @__PURE__ */ N("div", {
|
|
3632
|
+
className: "d-flex align-items-center justify-content-center",
|
|
3633
|
+
children: [/* @__PURE__ */ M("i", { className: "fal fa-file me-1" }), /* @__PURE__ */ M("a", {
|
|
3634
|
+
className: "text-info",
|
|
3635
|
+
href: _,
|
|
3636
|
+
target: "_blank",
|
|
3637
|
+
rel: "noopener noreferrer",
|
|
3638
|
+
children: y
|
|
3639
|
+
})]
|
|
3640
|
+
}), C && _ && /* @__PURE__ */ M("a", {
|
|
3641
|
+
onClick: S,
|
|
3642
|
+
href: "#",
|
|
3643
|
+
className: "ml-auto link text-danger",
|
|
3644
|
+
children: "Xóa"
|
|
3645
|
+
})]
|
|
3646
|
+
})
|
|
3647
|
+
]
|
|
3648
|
+
});
|
|
3649
|
+
}, ui = ({ label: e, name: t, cpnClass: n = "", required: r = !1, disabled: i, readonly: a, value: s = [], onChange: c, isEdit: l = !1, ext: u = ".xlsx, .xls, .docx, .doc, .pdf", df: p = "" }) => {
|
|
3650
|
+
let [m, g] = D([]), [_, v] = D(Array.isArray(s) ? s : []), [y, b] = D(""), x = E(/* @__PURE__ */ new Map()), S = (e) => {
|
|
3651
|
+
let t = x.current.get(e);
|
|
3652
|
+
return t || (t = URL.createObjectURL(e), x.current.set(e, t)), t;
|
|
3653
|
+
}, C = (t, n) => {
|
|
3654
|
+
r && t.length === 0 && n.length === 0 ? b(e + " không được để trống") : b("");
|
|
3655
|
+
};
|
|
3656
|
+
w(() => () => {
|
|
3657
|
+
x.current.forEach((e) => {
|
|
3658
|
+
URL.revokeObjectURL(e);
|
|
3659
|
+
}), x.current.clear();
|
|
3660
|
+
}, []), w(() => {
|
|
3661
|
+
v((e) => {
|
|
3662
|
+
let t = Array.isArray(s) ? s : [];
|
|
3663
|
+
return e.length === t.length && e.every((e, n) => e === t[n]) ? e : t;
|
|
3664
|
+
});
|
|
3665
|
+
}, [s]);
|
|
3666
|
+
let ee = (e) => {
|
|
3667
|
+
e.preventDefault();
|
|
3668
|
+
let n = /\.(pdf|docx|doc|xlsx|xls)$/i, r = e.currentTarget, i = r.files;
|
|
3669
|
+
if (!i || i.length === 0) return;
|
|
3670
|
+
let a = r.getAttribute("accept"), o = f(a, n);
|
|
3671
|
+
d(i, 10, o).then(() => {
|
|
3672
|
+
let e = Array.from(i), n = [...m, ...e];
|
|
3673
|
+
g(n), b(""), c?.(h(`${t}_upload`, n, "files")), r.value = "";
|
|
3674
|
+
}).catch((e) => {
|
|
3675
|
+
console.error("[UFiles] Upload không hợp lệ:", e.message), r.value = "";
|
|
3676
|
+
});
|
|
3677
|
+
}, T = (e, n) => {
|
|
3678
|
+
e.preventDefault();
|
|
3679
|
+
let r = _.filter((e, t) => t !== n);
|
|
3680
|
+
v(r), C(r, m), c?.(h(t, r));
|
|
3681
|
+
}, te = (e, n) => {
|
|
3682
|
+
e.preventDefault();
|
|
3683
|
+
let r = m[n];
|
|
3684
|
+
if (r) {
|
|
3685
|
+
let e = x.current.get(r);
|
|
3686
|
+
e && (URL.revokeObjectURL(e), x.current.delete(r));
|
|
3687
|
+
}
|
|
3688
|
+
let i = m.filter((e, t) => t !== n);
|
|
3689
|
+
g(i), C(_, i), c?.(h(`${t}_upload`, i, "files"));
|
|
3690
|
+
}, O = l && !i && !a;
|
|
3691
|
+
return /* @__PURE__ */ N("div", {
|
|
3692
|
+
className: `card ${n}`,
|
|
3693
|
+
children: [
|
|
3694
|
+
/* @__PURE__ */ M("div", {
|
|
3695
|
+
className: "card-header position-relative",
|
|
3696
|
+
children: /* @__PURE__ */ M("div", {
|
|
3697
|
+
className: "row",
|
|
3698
|
+
children: /* @__PURE__ */ N("div", {
|
|
3699
|
+
className: "flex-auto col-auto d-flex align-items-center",
|
|
3700
|
+
children: [/* @__PURE__ */ M("h3", {
|
|
3701
|
+
className: "card-title",
|
|
3702
|
+
children: e
|
|
3703
|
+
}), O && /* @__PURE__ */ N("label", {
|
|
3704
|
+
className: "text-info cursor-pointer m-0 ms-auto",
|
|
3705
|
+
children: ["Tải lên", /* @__PURE__ */ M("input", {
|
|
3706
|
+
disabled: i,
|
|
3707
|
+
name: t,
|
|
3708
|
+
multiple: !0,
|
|
3709
|
+
type: "file",
|
|
3710
|
+
onChange: ee,
|
|
3711
|
+
style: {
|
|
3712
|
+
position: "absolute",
|
|
3713
|
+
left: -9999
|
|
3714
|
+
},
|
|
3715
|
+
accept: u
|
|
3716
|
+
})]
|
|
3717
|
+
})]
|
|
3718
|
+
})
|
|
3719
|
+
})
|
|
3720
|
+
}),
|
|
3721
|
+
/* @__PURE__ */ M("hr", { className: "my-0" }),
|
|
3722
|
+
/* @__PURE__ */ N("div", {
|
|
3723
|
+
className: "card-body py-2 px-3",
|
|
3724
|
+
style: { minHeight: "50px" },
|
|
3725
|
+
children: [
|
|
3726
|
+
_?.map((e, t) => {
|
|
3727
|
+
let n = (e ? e.split("/").pop() : "")?.split("___");
|
|
3728
|
+
return /* @__PURE__ */ N("div", {
|
|
3729
|
+
className: "d-flex w-100 justify-content-between",
|
|
3730
|
+
children: [/* @__PURE__ */ N("div", {
|
|
3731
|
+
className: "d-flex justify-content-center flex-column",
|
|
3732
|
+
children: [/* @__PURE__ */ N("div", {
|
|
3733
|
+
className: "w-100",
|
|
3734
|
+
children: [/* @__PURE__ */ M("i", { className: "fal fa-file me-1" }), /* @__PURE__ */ M("a", {
|
|
3735
|
+
className: "text-info",
|
|
3736
|
+
href: o(e, p),
|
|
3737
|
+
target: "_blank",
|
|
3738
|
+
rel: "noopener noreferrer",
|
|
3739
|
+
children: n?.[1]
|
|
3740
|
+
})]
|
|
3741
|
+
}), /* @__PURE__ */ M("span", { children: n?.[0] ? new Date(Number(n[0])).toLocaleString("vi-VN") : "" })]
|
|
3742
|
+
}), O && /* @__PURE__ */ M("a", {
|
|
3743
|
+
onClick: (e) => T(e, t),
|
|
3744
|
+
href: "#",
|
|
3745
|
+
className: "ml-auto link text-danger",
|
|
3746
|
+
children: "Xóa"
|
|
3747
|
+
})]
|
|
3748
|
+
}, t);
|
|
3749
|
+
}),
|
|
3750
|
+
m?.map((e, t) => /* @__PURE__ */ N("div", {
|
|
3751
|
+
className: "d-flex w-100 justify-content-between",
|
|
3752
|
+
children: [/* @__PURE__ */ N("div", {
|
|
3753
|
+
className: "d-flex align-items-center justify-content-center",
|
|
3754
|
+
children: [/* @__PURE__ */ M("i", { className: "fal fa-file me-1" }), /* @__PURE__ */ M("a", {
|
|
3755
|
+
className: "text-info text-1-line",
|
|
3756
|
+
href: S(e),
|
|
3757
|
+
target: "_blank",
|
|
3758
|
+
rel: "noopener noreferrer",
|
|
3759
|
+
children: e?.name
|
|
3760
|
+
})]
|
|
3761
|
+
}), O && /* @__PURE__ */ M("a", {
|
|
3762
|
+
onClick: (e) => te(e, t),
|
|
3763
|
+
href: "#",
|
|
3764
|
+
className: "ml-auto link text-danger",
|
|
3765
|
+
children: "Xóa"
|
|
3766
|
+
})]
|
|
3767
|
+
}, t)),
|
|
3768
|
+
y && /* @__PURE__ */ M("div", {
|
|
3769
|
+
className: "text-danger mt-1",
|
|
3770
|
+
children: y
|
|
3771
|
+
})
|
|
3772
|
+
]
|
|
3773
|
+
})
|
|
3774
|
+
]
|
|
3775
|
+
});
|
|
3776
|
+
}, di = (e) => e == null ? !0 : Array.isArray(e) || typeof e == "string" ? e.length === 0 : !1, fi = (e, t, n) => {
|
|
3777
|
+
if (di(e?.[t]) && di(e?.[`${t}_upload`])) throw Error(`${n} không được để trống`);
|
|
3778
|
+
return !0;
|
|
3779
|
+
}, pi = ({ label: e, name: t, cpnClass: n = "", required: r = !1, value: i = [], onChange: a, isEdit: s = !1, ext: c = ".png, .jpg, .jpeg, .ico", df: l = "" }) => {
|
|
3780
|
+
let u = E(null), [p, m] = D([]), [g, _] = D(Array.isArray(i) ? i : []), v = E(/* @__PURE__ */ new Map()), y = (e) => {
|
|
3781
|
+
let t = v.current.get(e);
|
|
3782
|
+
return t || (t = URL.createObjectURL(e), v.current.set(e, t)), t;
|
|
3783
|
+
};
|
|
3784
|
+
w(() => () => {
|
|
3785
|
+
v.current.forEach((e) => URL.revokeObjectURL(e)), v.current.clear();
|
|
3786
|
+
}, []), w(() => {
|
|
3787
|
+
_((e) => {
|
|
3788
|
+
let t = Array.isArray(i) ? i : [];
|
|
3789
|
+
return e.length === t.length && e.every((e, n) => e === t[n]) ? e : t;
|
|
3790
|
+
});
|
|
3791
|
+
}, [i]);
|
|
3792
|
+
let b = (e) => {
|
|
3793
|
+
e.preventDefault();
|
|
3794
|
+
let t = /\.(png|jpg|jpeg|ico)$/i, n = u.current?.querySelector(".default-file-input");
|
|
3795
|
+
if (!n) return;
|
|
3796
|
+
let r = n.files;
|
|
3797
|
+
if (!r) return;
|
|
3798
|
+
let i = n.getAttribute("accept"), a = f(i, t);
|
|
3799
|
+
d(r, 10, a).then(() => {
|
|
3800
|
+
let e = Array.from(r);
|
|
3801
|
+
m((t) => [...t, ...e]);
|
|
3802
|
+
}).catch((e) => {
|
|
3803
|
+
console.error("[UImages] Upload không hợp lệ:", e.message);
|
|
3804
|
+
});
|
|
3805
|
+
}, x = (e, t) => {
|
|
3806
|
+
e.preventDefault(), _((e) => e.filter((e, n) => n !== t));
|
|
3807
|
+
}, S = (e, t) => {
|
|
3808
|
+
e.preventDefault();
|
|
3809
|
+
let n = p[t];
|
|
3810
|
+
if (n) {
|
|
3811
|
+
let e = v.current.get(n);
|
|
3812
|
+
e && (URL.revokeObjectURL(e), v.current.delete(n));
|
|
3813
|
+
}
|
|
3814
|
+
m((e) => e.filter((e, n) => n !== t));
|
|
3815
|
+
};
|
|
3816
|
+
return w(() => {
|
|
3817
|
+
a && a(h(`${t}_upload`, p, "files"));
|
|
3818
|
+
}, [p]), w(() => {
|
|
3819
|
+
a && a(h(t, g));
|
|
3820
|
+
}, [g]), /* @__PURE__ */ N("div", {
|
|
3821
|
+
ref: u,
|
|
3822
|
+
className: `card boxUImage ${n}`,
|
|
3823
|
+
children: [
|
|
3824
|
+
/* @__PURE__ */ M("div", {
|
|
3825
|
+
className: "card-header",
|
|
3826
|
+
children: /* @__PURE__ */ M("div", {
|
|
3827
|
+
className: "row",
|
|
3828
|
+
children: /* @__PURE__ */ N("div", {
|
|
3829
|
+
className: "flex-auto col-auto d-flex align-items-center",
|
|
3830
|
+
children: [/* @__PURE__ */ M("h3", {
|
|
3831
|
+
className: "card-title",
|
|
3832
|
+
children: e
|
|
3833
|
+
}), s && /* @__PURE__ */ N("label", {
|
|
3834
|
+
className: "text-info cursor-pointer m-0 ms-auto",
|
|
3835
|
+
children: ["Tải lên", /* @__PURE__ */ M("input", {
|
|
3836
|
+
required: r,
|
|
3837
|
+
name: t,
|
|
3838
|
+
multiple: !0,
|
|
3839
|
+
type: "file",
|
|
3840
|
+
onChange: b,
|
|
3841
|
+
className: "d-none default-file-input",
|
|
3842
|
+
accept: c
|
|
3843
|
+
})]
|
|
3844
|
+
})]
|
|
3845
|
+
})
|
|
3846
|
+
})
|
|
3847
|
+
}),
|
|
3848
|
+
/* @__PURE__ */ M("hr", { className: "my-0" }),
|
|
3849
|
+
/* @__PURE__ */ N("div", {
|
|
3850
|
+
className: "card-body py-2 px-3",
|
|
3851
|
+
style: { minHeight: "50px" },
|
|
3852
|
+
children: [g?.map((e, t) => {
|
|
3853
|
+
let n = (e ? e.split("/").pop() ?? "" : "").split("___");
|
|
3854
|
+
return /* @__PURE__ */ N("div", {
|
|
3855
|
+
className: "d-flex w-100 justify-content-between",
|
|
3856
|
+
children: [/* @__PURE__ */ N("div", {
|
|
3857
|
+
className: `d-flex justify-content-center flex-column ${e ? "" : "d-none"}`,
|
|
3858
|
+
children: [/* @__PURE__ */ N("div", {
|
|
3859
|
+
className: "w-100",
|
|
3860
|
+
children: [/* @__PURE__ */ M("i", { className: "fal fa-file me-1" }), /* @__PURE__ */ M("a", {
|
|
3861
|
+
className: "text-info",
|
|
3862
|
+
href: o(e, l),
|
|
3863
|
+
target: "_blank",
|
|
3864
|
+
children: n?.[1]
|
|
3865
|
+
})]
|
|
3866
|
+
}), /* @__PURE__ */ M("span", { children: n[0] ? new Date(Number(n[0])).toLocaleString("vi-VN") : "" })]
|
|
3867
|
+
}), s && /* @__PURE__ */ M("a", {
|
|
3868
|
+
onClick: (e) => x(e, t),
|
|
3869
|
+
href: "#",
|
|
3870
|
+
className: `ml-auto link text-danger ${e ? "" : "d-none"}`,
|
|
3871
|
+
children: "Xóa"
|
|
3872
|
+
})]
|
|
3873
|
+
}, t);
|
|
3874
|
+
}), p?.map((e, t) => /* @__PURE__ */ N("div", {
|
|
3875
|
+
className: "d-flex w-100 justify-content-between",
|
|
3876
|
+
children: [/* @__PURE__ */ N("div", {
|
|
3877
|
+
className: `d-flex align-items-center justify-content-center ${e ? "" : "d-none"}`,
|
|
3878
|
+
children: [/* @__PURE__ */ M("i", { className: "fal fa-file me-1" }), /* @__PURE__ */ M("a", {
|
|
3879
|
+
className: "text-info text-1-line",
|
|
3880
|
+
href: y(e),
|
|
3881
|
+
target: "_blank",
|
|
3882
|
+
rel: "noopener noreferrer",
|
|
3883
|
+
children: e?.name
|
|
3884
|
+
})]
|
|
3885
|
+
}), s && /* @__PURE__ */ M("a", {
|
|
3886
|
+
onClick: (e) => S(e, t),
|
|
3887
|
+
href: "#",
|
|
3888
|
+
className: `ml-auto link text-danger ${e ? "" : "d-none"}`,
|
|
3889
|
+
children: "Xóa"
|
|
3890
|
+
})]
|
|
3891
|
+
}, t))]
|
|
3892
|
+
})
|
|
3893
|
+
]
|
|
3894
|
+
});
|
|
3895
|
+
};
|
|
3896
|
+
//#endregion
|
|
3897
|
+
export { kt as C, vt as D, yt as E, Ot as S, Tt as T, Ft as _, ci as a, Et as b, ni as c, Qr as d, Xr as f, Pt as g, It as h, li as i, ti as l, Kr as m, ui as n, ii as o, Yr as p, fi as r, ri as s, pi as t, ei as u, At as v, Ct as w, Dt as x, wt as y };
|