@medyat/vue-data-table 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +179 -2
- package/dist/DateEditor-BTIZMwf1.js +224 -0
- package/dist/DateEditor-BTIZMwf1.js.map +1 -0
- package/dist/FiltersSheet-o2HaQuhq.js +285 -0
- package/dist/FiltersSheet-o2HaQuhq.js.map +1 -0
- package/dist/Layer-Di-tPd8b.js +106 -0
- package/dist/Layer-Di-tPd8b.js.map +1 -0
- package/dist/PhoneMoreSheet-gfkH96RR.js +227 -0
- package/dist/PhoneMoreSheet-gfkH96RR.js.map +1 -0
- package/dist/TextEditor-DPqiiRau.js +331 -0
- package/dist/TextEditor-DPqiiRau.js.map +1 -0
- package/dist/index.d.ts +711 -0
- package/dist/index.js +3331 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-DhgcjEdi.js +813 -0
- package/dist/plugin-DhgcjEdi.js.map +1 -0
- package/dist/query-DQWMlX0m.js +2121 -0
- package/dist/query-DQWMlX0m.js.map +1 -0
- package/dist/shadcn-bridge-hsl.css +22 -0
- package/dist/shadcn-bridge.css +23 -0
- package/dist/sheet.d.ts +622 -0
- package/dist/sheet.js +3783 -0
- package/dist/sheet.js.map +1 -0
- package/dist/style.css +2 -0
- package/package.json +85 -3
package/dist/sheet.js
ADDED
|
@@ -0,0 +1,3783 @@
|
|
|
1
|
+
import { $ as e, B as t, C as n, E as r, G as i, H as a, J as o, K as s, Q as c, R as l, S as u, U as d, V as f, W as p, X as m, Y as h, Z as g, a as _, b as v, c as y, d as b, et as x, g as S, h as ee, i as C, j as w, l as te, n as ne, p as T, q as E, r as re, t as D, u as ie, v as ae, w as oe, x as se, y as O } from "./query-DQWMlX0m.js";
|
|
2
|
+
import { i as ce } from "./plugin-DhgcjEdi.js";
|
|
3
|
+
import { Fragment as k, computed as A, createBlock as j, createCommentVNode as M, createElementBlock as N, createElementVNode as P, createSlots as le, createTextVNode as F, createVNode as I, defineComponent as L, h as R, inject as z, mergeModels as ue, mergeProps as de, nextTick as fe, normalizeClass as pe, normalizeStyle as me, onBeforeUnmount as he, onMounted as ge, openBlock as B, provide as _e, ref as V, renderList as ve, renderSlot as ye, shallowReactive as H, shallowRef as U, toDisplayString as W, toHandlers as be, toRaw as xe, toValue as G, unref as K, useId as Se, useModel as Ce, useTemplateRef as we, vModelCheckbox as Te, vModelSelect as Ee, vShow as De, watch as Oe, watchEffect as ke, withCtx as q, withDirectives as Ae, withModifiers as je } from "vue";
|
|
4
|
+
import { PhArrowLeft as J, PhArrowRight as Me, PhArrowUUpLeft as Ne, PhArrowUUpRight as Pe, PhArrowUp as Y, PhCalendarBlank as Fe, PhCaretDown as Ie, PhCaretLeft as X, PhCaretRight as Z, PhCaretUp as Le, PhCheck as Re, PhCircleNotch as ze, PhCopy as Be, PhDownloadSimple as Ve, PhExport as He, PhInfo as Ue, PhLink as We, PhLock as Ge, PhMonitor as Ke, PhPlus as qe, PhTable as Je, PhUploadSimple as Ye, PhWarning as Xe, PhWarningCircle as Ze, PhX as Qe } from "@phosphor-icons/vue";
|
|
5
|
+
import { cellSelectionFeature as Q, tableFeatures as $e, useTable as $ } from "@tanstack/vue-table";
|
|
6
|
+
import { AlertDialogCancel as et, AlertDialogContent as tt, AlertDialogDescription as nt, AlertDialogOverlay as rt, AlertDialogPortal as it, AlertDialogRoot as at, AlertDialogTitle as ot, CalendarCell as st, CalendarCellTrigger as ct, CalendarGrid as lt, CalendarGridBody as ut, CalendarGridHead as dt, CalendarGridRow as ft, CalendarHeadCell as pt, CalendarHeader as mt, CalendarHeading as ht, CalendarNext as gt, CalendarPrev as _t, CalendarRoot as vt, ComboboxAnchor as yt, ComboboxContent as bt, ComboboxEmpty as xt, ComboboxInput as St, ComboboxItem as Ct, ComboboxItemIndicator as wt, ComboboxPortal as Tt, ComboboxRoot as Et, ComboboxViewport as Dt, ContextMenuContent as Ot, ContextMenuItem as kt, ContextMenuPortal as At, ContextMenuRoot as jt, ContextMenuSeparator as Mt, ContextMenuTrigger as Nt, DialogClose as Pt, DialogContent as Ft, DialogDescription as It, DialogOverlay as Lt, DialogPortal as Rt, DialogRoot as zt, DialogTitle as Bt, DropdownMenuContent as Vt, DropdownMenuItem as Ht, DropdownMenuPortal as Ut, DropdownMenuRoot as Wt, DropdownMenuSub as Gt, DropdownMenuSubContent as Kt, DropdownMenuSubTrigger as qt, DropdownMenuTrigger as Jt, PopoverContent as Yt, PopoverPortal as Xt, PopoverRoot as Zt, PopoverTrigger as Qt, ToggleGroupItem as $t, ToggleGroupRoot as en } from "reka-ui";
|
|
7
|
+
import { useVirtualizer as tn } from "@tanstack/vue-virtual";
|
|
8
|
+
import { getDayOfWeek as nn, getLocalTimeZone as rn, parseDate as an, startOfWeek as on, today as sn } from "@internationalized/date";
|
|
9
|
+
//#region src/sheet/clipboard.ts
|
|
10
|
+
var cn = (e) => /[\t\n\r"]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e, ln = (e) => e.map((e) => e.map(cn).join(" ")).join("\n"), un = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br>"), dn = (e) => `<table><tbody>${e.map((e) => `<tr>${e.map((e) => `<td>${un(e)}</td>`).join("")}</tr>`).join("")}</tbody></table>`;
|
|
11
|
+
function fn(e) {
|
|
12
|
+
let t = [], n = [], r = "", i = !1;
|
|
13
|
+
for (let a = 0; a < e.length; a++) {
|
|
14
|
+
let o = e[a];
|
|
15
|
+
i ? o === "\"" ? e[a + 1] === "\"" ? (r += "\"", a++) : i = !1 : r += o : o === "\"" && r === "" ? i = !0 : o === " " ? (n.push(r), r = "") : o === "\n" || o === "\r" ? (o === "\r" && e[a + 1] === "\n" && a++, n.push(r), t.push(n), n = [], r = "") : r += o;
|
|
16
|
+
}
|
|
17
|
+
return (r !== "" || n.length) && (n.push(r), t.push(n)), t.length > 1 && t[t.length - 1].every((e) => e === "") && t.pop(), t;
|
|
18
|
+
}
|
|
19
|
+
function pn(e) {
|
|
20
|
+
return typeof DOMParser > "u" ? [] : [...new DOMParser().parseFromString(e, "text/html").querySelectorAll("tr")].map((e) => [...e.querySelectorAll("td, th")].map((e) => (e.textContent ?? "").replace(/\u00a0/g, " ").trim()));
|
|
21
|
+
}
|
|
22
|
+
function mn(e) {
|
|
23
|
+
let t = e?.getData("text/plain") ?? "";
|
|
24
|
+
if (t) return fn(t);
|
|
25
|
+
let n = e?.getData("text/html") ?? "";
|
|
26
|
+
return n ? pn(n) : [];
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/sheet/parse.ts
|
|
30
|
+
var hn = (e, t, n) => {
|
|
31
|
+
let r = e.find((e) => vn(e.label, n) === vn(t, n) || String(e.value) === t.trim());
|
|
32
|
+
return r ? r.value : t.trim();
|
|
33
|
+
}, gn = (e) => e.split(/[;,]/).map((e) => e.trim()).filter(Boolean);
|
|
34
|
+
function _n(e) {
|
|
35
|
+
for (let t of e) {
|
|
36
|
+
let e = t.replace(/[\s%\u00a0A-Za-z₺€$£]/g, ""), n = e.lastIndexOf(","), r = e.lastIndexOf(".");
|
|
37
|
+
if (n >= 0 && r >= 0) return n > r ? "," : ".";
|
|
38
|
+
if (n >= 0 && /,\d{1,2}$/.test(e) && !/^\d{1,3}(,\d{3})+$/.test(e)) return ",";
|
|
39
|
+
if (r >= 0 && /\.\d{1,2}$/.test(e) && !/^\d{1,3}(\.\d{3})+$/.test(e)) return ".";
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
var vn = (e, t) => e.trim().toLocaleLowerCase(t).replace(/ı|i̇/g, "i"), yn = (e, t, n) => {
|
|
44
|
+
let r = new Date(e, t - 1, n);
|
|
45
|
+
return r.getFullYear() === e && r.getMonth() === t - 1 && r.getDate() === n ? w(r) : null;
|
|
46
|
+
};
|
|
47
|
+
function bn(e, t) {
|
|
48
|
+
let n = e.trim();
|
|
49
|
+
if (!n) return null;
|
|
50
|
+
let r = vn(n, t.locale);
|
|
51
|
+
if (r === "today" || r === vn(t.todayWord, t.locale)) return w(t.today);
|
|
52
|
+
let i = /^([+-])(\d+)d$/i.exec(n);
|
|
53
|
+
if (i) {
|
|
54
|
+
let e = new Date(t.today);
|
|
55
|
+
return e.setDate(e.getDate() + (i[1] === "-" ? -1 : 1) * Number(i[2])), w(e);
|
|
56
|
+
}
|
|
57
|
+
let a = /^(\d{4})-(\d{2})-(\d{2})/.exec(n);
|
|
58
|
+
if (a) return yn(+a[1], +a[2], +a[3]);
|
|
59
|
+
let o = /^(\d{1,2})[./](\d{1,2})(?:[./](\d{2}|\d{4}))?$/.exec(n);
|
|
60
|
+
return o ? yn(o[3] ? o[3].length === 2 ? 2e3 + +o[3] : +o[3] : t.today.getFullYear(), +o[2], +o[1]) : null;
|
|
61
|
+
}
|
|
62
|
+
function xn(e, t, n) {
|
|
63
|
+
let r = t.trim();
|
|
64
|
+
if (r === "") return null;
|
|
65
|
+
if (i[e.type].numeric || e.type === "star") return r.startsWith("=") ? r : l(n.locale, r) ?? r;
|
|
66
|
+
switch (e.type) {
|
|
67
|
+
case "date":
|
|
68
|
+
case "datetime": return bn(r, n) ?? r;
|
|
69
|
+
case "select": return hn(e.options, r, n.locale);
|
|
70
|
+
case "multiselect": return gn(r).map((t) => hn(e.options, t, n.locale));
|
|
71
|
+
case "boolean": {
|
|
72
|
+
let e = vn(r, n.locale);
|
|
73
|
+
return [
|
|
74
|
+
"true",
|
|
75
|
+
"1",
|
|
76
|
+
"yes",
|
|
77
|
+
vn(n.yesWord, n.locale)
|
|
78
|
+
].includes(e) ? !0 : ![
|
|
79
|
+
"false",
|
|
80
|
+
"0",
|
|
81
|
+
"no",
|
|
82
|
+
vn(n.noWord, n.locale)
|
|
83
|
+
].includes(e) && r;
|
|
84
|
+
}
|
|
85
|
+
case "uppercase": return r.toLocaleUpperCase(n.locale);
|
|
86
|
+
case "lowercase": return r.toLocaleLowerCase(n.locale);
|
|
87
|
+
default: return r;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function Sn(e, t) {
|
|
91
|
+
return t == null ? "" : e.type === "select" ? c(e.options, t) : Array.isArray(t) ? t.join(", ") : typeof t == "object" ? JSON.stringify(t) : String(t);
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/sheet/editors/useParseEnv.ts
|
|
95
|
+
function Cn() {
|
|
96
|
+
let { i18n: e, locale: t } = ce();
|
|
97
|
+
return () => ({
|
|
98
|
+
locale: t,
|
|
99
|
+
today: /* @__PURE__ */ new Date(),
|
|
100
|
+
todayWord: e.t("date.today"),
|
|
101
|
+
yesWord: e.t("common.yes"),
|
|
102
|
+
noWord: e.t("common.no")
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function wn(e) {
|
|
106
|
+
if (!e) return;
|
|
107
|
+
e.focus({ preventScroll: !0 });
|
|
108
|
+
let t = e.value.length;
|
|
109
|
+
e.setSelectionRange(t, t);
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/sheet/editors/NumberCell.vue?vue&type=script&setup=true&lang.ts
|
|
113
|
+
var Tn = { class: "dt-cell-editor is-number" }, En = ["value", "aria-label"], Dn = {
|
|
114
|
+
key: 0,
|
|
115
|
+
class: "dt-ccy",
|
|
116
|
+
"aria-hidden": "true"
|
|
117
|
+
}, On = /* @__PURE__ */ L({
|
|
118
|
+
__name: "NumberCell",
|
|
119
|
+
props: {
|
|
120
|
+
modelValue: {},
|
|
121
|
+
row: {},
|
|
122
|
+
column: {}
|
|
123
|
+
},
|
|
124
|
+
emits: ["update:modelValue"],
|
|
125
|
+
setup(e, { emit: t }) {
|
|
126
|
+
let n = e, r = t, i = Cn(), a = V(null), o = V(Sn(n.column, n.modelValue)), s = A(() => {
|
|
127
|
+
let e = n.column;
|
|
128
|
+
return e.type === "currency" && typeof e.currency == "string" ? e.currency : e.type === "percentage" ? "%" : "";
|
|
129
|
+
});
|
|
130
|
+
ge(() => wn(a.value));
|
|
131
|
+
let c = () => {
|
|
132
|
+
o.value = a.value.value, r("update:modelValue", xn(n.column, o.value, i()));
|
|
133
|
+
};
|
|
134
|
+
return (t, n) => (B(), N("span", Tn, [P("input", {
|
|
135
|
+
ref_key: "el",
|
|
136
|
+
ref: a,
|
|
137
|
+
class: "dt-cell-input is-right",
|
|
138
|
+
type: "text",
|
|
139
|
+
inputmode: "decimal",
|
|
140
|
+
value: o.value,
|
|
141
|
+
"aria-label": e.column.header,
|
|
142
|
+
autocomplete: "off",
|
|
143
|
+
onInput: c
|
|
144
|
+
}, null, 40, En), s.value ? (B(), N("span", Dn, W(s.value), 1)) : M("", !0)]));
|
|
145
|
+
}
|
|
146
|
+
}), kn = /* @__PURE__ */ L({
|
|
147
|
+
__name: "OptionCell",
|
|
148
|
+
props: {
|
|
149
|
+
modelValue: {},
|
|
150
|
+
row: {},
|
|
151
|
+
column: {}
|
|
152
|
+
},
|
|
153
|
+
emits: ["update:modelValue"],
|
|
154
|
+
setup(e, { emit: n }) {
|
|
155
|
+
let r = e, i = n, { i18n: a } = ce(), o = Cn(), s = A(() => r.column), l = A(() => {
|
|
156
|
+
let e = s.value;
|
|
157
|
+
return e.optionEnabled ? e.options.filter((t) => e.optionEnabled(t, r.row)) : e.options;
|
|
158
|
+
}), u = V(!0), d = V();
|
|
159
|
+
Oe(u, (e) => {
|
|
160
|
+
e && fe(() => {
|
|
161
|
+
d.value = document.querySelector(".dt-cell-list[role=\"listbox\"]")?.id || void 0;
|
|
162
|
+
});
|
|
163
|
+
}, { immediate: !0 });
|
|
164
|
+
let f = V(Sn(r.column, r.modelValue)), p = V(null), m = () => p.value?.$el ?? null;
|
|
165
|
+
ge(() => void fe(() => wn(m())));
|
|
166
|
+
let h = (e) => {
|
|
167
|
+
f.value = e, i("update:modelValue", xn(r.column, e, o()));
|
|
168
|
+
}, g = (e) => {
|
|
169
|
+
e != null && (i("update:modelValue", e), f.value = c(s.value.options, e), u.value = !1, fe(() => wn(m())));
|
|
170
|
+
}, _ = (e) => {
|
|
171
|
+
e.altKey && e.key === "ArrowDown" && (e.preventDefault(), u.value = !0);
|
|
172
|
+
}, v = (e) => t(e.o.tone, e.o.label);
|
|
173
|
+
return (t, n) => (B(), j(K(Et), {
|
|
174
|
+
open: u.value,
|
|
175
|
+
"onUpdate:open": n[0] ||= (e) => u.value = e,
|
|
176
|
+
class: "dt-cell-editor is-option",
|
|
177
|
+
"model-value": e.modelValue ?? void 0,
|
|
178
|
+
"reset-search-term-on-blur": !1,
|
|
179
|
+
"onUpdate:modelValue": g
|
|
180
|
+
}, {
|
|
181
|
+
default: q(() => [I(K(yt), { class: "dt-cell-anchor" }, {
|
|
182
|
+
default: q(() => [I(K(St), {
|
|
183
|
+
ref_key: "input",
|
|
184
|
+
ref: p,
|
|
185
|
+
class: "dt-cell-input",
|
|
186
|
+
autocomplete: "off",
|
|
187
|
+
"aria-label": e.column.header,
|
|
188
|
+
"aria-controls": d.value,
|
|
189
|
+
"model-value": f.value,
|
|
190
|
+
"display-value": () => f.value,
|
|
191
|
+
"onUpdate:modelValue": h,
|
|
192
|
+
onKeydown: _
|
|
193
|
+
}, null, 8, [
|
|
194
|
+
"aria-label",
|
|
195
|
+
"aria-controls",
|
|
196
|
+
"model-value",
|
|
197
|
+
"display-value"
|
|
198
|
+
])]),
|
|
199
|
+
_: 1
|
|
200
|
+
}), I(K(Tt), null, {
|
|
201
|
+
default: q(() => [I(K(bt), {
|
|
202
|
+
class: "dt-pop dt-cell-list dt-sheet-layer",
|
|
203
|
+
position: "popper",
|
|
204
|
+
align: "end",
|
|
205
|
+
"side-offset": 2,
|
|
206
|
+
"aria-label": e.column.header
|
|
207
|
+
}, {
|
|
208
|
+
default: q(() => [I(K(Dt), null, {
|
|
209
|
+
default: q(() => [(B(!0), N(k, null, ve(l.value, (e) => (B(), j(K(Ct), {
|
|
210
|
+
key: String(e.value),
|
|
211
|
+
class: "dt-pop-item dt-cell-option",
|
|
212
|
+
value: e.value,
|
|
213
|
+
"text-value": e.label
|
|
214
|
+
}, {
|
|
215
|
+
default: q(() => [I(v, { o: e }, null, 8, ["o"]), n[1] ||= P("kbd", {
|
|
216
|
+
class: "dt-kbd dt-cell-option-enter",
|
|
217
|
+
"aria-hidden": "true"
|
|
218
|
+
}, "↵", -1)]),
|
|
219
|
+
_: 2
|
|
220
|
+
}, 1032, ["value", "text-value"]))), 128)), I(K(xt), { class: "dt-options-empty" }, {
|
|
221
|
+
default: q(() => [F(W(K(a).t("picker.noMatch")), 1)]),
|
|
222
|
+
_: 1
|
|
223
|
+
})]),
|
|
224
|
+
_: 1
|
|
225
|
+
})]),
|
|
226
|
+
_: 1
|
|
227
|
+
}, 8, ["aria-label"])]),
|
|
228
|
+
_: 1
|
|
229
|
+
})]),
|
|
230
|
+
_: 1
|
|
231
|
+
}, 8, ["open", "model-value"]));
|
|
232
|
+
}
|
|
233
|
+
}), An = ["value", "aria-label"], jn = ["value", "aria-label"], Mn = /* @__PURE__ */ L({
|
|
234
|
+
__name: "TextCell",
|
|
235
|
+
props: {
|
|
236
|
+
modelValue: {},
|
|
237
|
+
row: {},
|
|
238
|
+
column: {}
|
|
239
|
+
},
|
|
240
|
+
emits: ["update:modelValue"],
|
|
241
|
+
setup(e, { emit: t }) {
|
|
242
|
+
let n = e, r = t, i = Cn(), a = V(null), o = V(Sn(n.column, n.modelValue));
|
|
243
|
+
ge(() => wn(a.value));
|
|
244
|
+
let s = () => {
|
|
245
|
+
o.value = a.value.value, r("update:modelValue", xn(n.column, o.value, i()));
|
|
246
|
+
};
|
|
247
|
+
return (t, n) => e.column.type === "text" ? (B(), N("textarea", {
|
|
248
|
+
key: 0,
|
|
249
|
+
ref_key: "el",
|
|
250
|
+
ref: a,
|
|
251
|
+
class: "dt-cell-input is-multiline",
|
|
252
|
+
value: o.value,
|
|
253
|
+
"aria-label": e.column.header,
|
|
254
|
+
rows: "3",
|
|
255
|
+
onInput: s
|
|
256
|
+
}, null, 40, An)) : (B(), N("input", {
|
|
257
|
+
key: 1,
|
|
258
|
+
ref_key: "el",
|
|
259
|
+
ref: a,
|
|
260
|
+
class: "dt-cell-input",
|
|
261
|
+
type: "text",
|
|
262
|
+
value: o.value,
|
|
263
|
+
"aria-label": e.column.header,
|
|
264
|
+
autocomplete: "off",
|
|
265
|
+
onInput: s
|
|
266
|
+
}, null, 40, jn));
|
|
267
|
+
}
|
|
268
|
+
}), Nn = { class: "dt-cell-editor is-date" }, Pn = ["value", "aria-label"], Fn = ["aria-label"], In = {
|
|
269
|
+
key: 0,
|
|
270
|
+
class: "dt-cell-date-head"
|
|
271
|
+
}, Ln = /* @__PURE__ */ L({
|
|
272
|
+
__name: "DateCell",
|
|
273
|
+
props: {
|
|
274
|
+
modelValue: {},
|
|
275
|
+
row: {},
|
|
276
|
+
column: {}
|
|
277
|
+
},
|
|
278
|
+
emits: ["update:modelValue"],
|
|
279
|
+
setup(t, { emit: n }) {
|
|
280
|
+
let r = t, i = n, { i18n: a, locale: o } = ce(), s = Cn(), c = e(o), l = new Intl.DateTimeFormat(o, {
|
|
281
|
+
weekday: "short",
|
|
282
|
+
month: "short",
|
|
283
|
+
day: "numeric"
|
|
284
|
+
}), u = V(null), d = V(!1), f = V(Sn(r.column, r.modelValue));
|
|
285
|
+
ge(() => wn(u.value));
|
|
286
|
+
let p = rn(), m = sn(p), h = nn(on(m, o), "en-US"), g = (e) => {
|
|
287
|
+
try {
|
|
288
|
+
return typeof e == "string" && e ? an(e.slice(0, 10)) : void 0;
|
|
289
|
+
} catch {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
}, _ = A(() => g(r.modelValue)), v = A(() => {
|
|
293
|
+
let e = r.modelValue;
|
|
294
|
+
if (typeof e != "string" || !_.value) return null;
|
|
295
|
+
let t = x(e.slice(0, 10));
|
|
296
|
+
return {
|
|
297
|
+
day: l.format(t),
|
|
298
|
+
relative: c.relative(t)
|
|
299
|
+
};
|
|
300
|
+
}), y = () => {
|
|
301
|
+
f.value = u.value.value, i("update:modelValue", xn(r.column, f.value, s()));
|
|
302
|
+
}, b = (e) => {
|
|
303
|
+
if (!e) return;
|
|
304
|
+
let t = e.toString();
|
|
305
|
+
f.value = t, i("update:modelValue", t), d.value = !1;
|
|
306
|
+
}, S = (e) => {
|
|
307
|
+
e.preventDefault(), fe(() => wn(u.value));
|
|
308
|
+
}, ee = (e) => {
|
|
309
|
+
e.altKey && e.key === "ArrowDown" && (e.preventDefault(), d.value = !0);
|
|
310
|
+
};
|
|
311
|
+
return (e, n) => (B(), N("span", Nn, [P("input", {
|
|
312
|
+
ref_key: "el",
|
|
313
|
+
ref: u,
|
|
314
|
+
class: "dt-cell-input",
|
|
315
|
+
type: "text",
|
|
316
|
+
value: f.value,
|
|
317
|
+
"aria-label": t.column.header,
|
|
318
|
+
autocomplete: "off",
|
|
319
|
+
onInput: y,
|
|
320
|
+
onKeydown: ee
|
|
321
|
+
}, null, 40, Pn), I(K(Zt), {
|
|
322
|
+
open: d.value,
|
|
323
|
+
"onUpdate:open": n[1] ||= (e) => d.value = e
|
|
324
|
+
}, {
|
|
325
|
+
default: q(() => [I(K(Qt), { "as-child": "" }, {
|
|
326
|
+
default: q(() => [P("button", {
|
|
327
|
+
type: "button",
|
|
328
|
+
class: "dt-cell-editor-btn",
|
|
329
|
+
tabindex: "-1",
|
|
330
|
+
"aria-label": K(a).t("type.date")
|
|
331
|
+
}, [I(K(Fe), {
|
|
332
|
+
size: 14,
|
|
333
|
+
"aria-hidden": "true"
|
|
334
|
+
})], 8, Fn)]),
|
|
335
|
+
_: 1
|
|
336
|
+
}), I(K(Xt), null, {
|
|
337
|
+
default: q(() => [I(K(Yt), {
|
|
338
|
+
class: "dt-pop dt-cell-date dt-sheet-layer",
|
|
339
|
+
align: "start",
|
|
340
|
+
"side-offset": 4,
|
|
341
|
+
onCloseAutoFocus: S
|
|
342
|
+
}, {
|
|
343
|
+
default: q(() => [v.value ? (B(), N("div", In, [P("strong", null, W(v.value.day), 1), P("span", null, W(v.value.relative), 1)])) : M("", !0), I(K(vt), {
|
|
344
|
+
class: "dt-calendar",
|
|
345
|
+
"model-value": _.value,
|
|
346
|
+
locale: K(o),
|
|
347
|
+
"week-starts-on": K(h),
|
|
348
|
+
placeholder: _.value ?? K(m),
|
|
349
|
+
"onUpdate:modelValue": n[0] ||= (e) => b(e)
|
|
350
|
+
}, {
|
|
351
|
+
default: q(({ weekDays: e, grid: t }) => [I(K(mt), { class: "dt-cal-head" }, {
|
|
352
|
+
default: q(() => [
|
|
353
|
+
I(K(_t), { class: "dt-icon-btn-sm" }, {
|
|
354
|
+
default: q(() => [I(K(X), {
|
|
355
|
+
size: 16,
|
|
356
|
+
"aria-hidden": "true"
|
|
357
|
+
})]),
|
|
358
|
+
_: 1
|
|
359
|
+
}),
|
|
360
|
+
I(K(ht), { class: "dt-cal-title" }),
|
|
361
|
+
I(K(gt), { class: "dt-icon-btn-sm" }, {
|
|
362
|
+
default: q(() => [I(K(Z), {
|
|
363
|
+
size: 16,
|
|
364
|
+
"aria-hidden": "true"
|
|
365
|
+
})]),
|
|
366
|
+
_: 1
|
|
367
|
+
})
|
|
368
|
+
]),
|
|
369
|
+
_: 1
|
|
370
|
+
}), (B(!0), N(k, null, ve(t, (t) => (B(), j(K(lt), {
|
|
371
|
+
key: t.value.toString(),
|
|
372
|
+
class: "dt-cal-grid"
|
|
373
|
+
}, {
|
|
374
|
+
default: q(() => [I(K(dt), null, {
|
|
375
|
+
default: q(() => [I(K(ft), null, {
|
|
376
|
+
default: q(() => [(B(!0), N(k, null, ve(e, (e) => (B(), j(K(pt), {
|
|
377
|
+
key: e,
|
|
378
|
+
class: "dt-cal-dow"
|
|
379
|
+
}, {
|
|
380
|
+
default: q(() => [F(W(e), 1)]),
|
|
381
|
+
_: 2
|
|
382
|
+
}, 1024))), 128))]),
|
|
383
|
+
_: 2
|
|
384
|
+
}, 1024)]),
|
|
385
|
+
_: 2
|
|
386
|
+
}, 1024), I(K(ut), null, {
|
|
387
|
+
default: q(() => [(B(!0), N(k, null, ve(t.rows, (e, n) => (B(), j(K(ft), { key: n }, {
|
|
388
|
+
default: q(() => [(B(!0), N(k, null, ve(e, (e) => (B(), j(K(st), {
|
|
389
|
+
key: e.toString(),
|
|
390
|
+
date: e,
|
|
391
|
+
class: "dt-cal-cell"
|
|
392
|
+
}, {
|
|
393
|
+
default: q(() => [I(K(ct), {
|
|
394
|
+
day: e,
|
|
395
|
+
month: t.value,
|
|
396
|
+
class: "dt-cal-day"
|
|
397
|
+
}, null, 8, ["day", "month"])]),
|
|
398
|
+
_: 2
|
|
399
|
+
}, 1032, ["date"]))), 128))]),
|
|
400
|
+
_: 2
|
|
401
|
+
}, 1024))), 128))]),
|
|
402
|
+
_: 2
|
|
403
|
+
}, 1024)]),
|
|
404
|
+
_: 2
|
|
405
|
+
}, 1024))), 128))]),
|
|
406
|
+
_: 1
|
|
407
|
+
}, 8, [
|
|
408
|
+
"model-value",
|
|
409
|
+
"locale",
|
|
410
|
+
"week-starts-on",
|
|
411
|
+
"placeholder"
|
|
412
|
+
])]),
|
|
413
|
+
_: 1
|
|
414
|
+
})]),
|
|
415
|
+
_: 1
|
|
416
|
+
})]),
|
|
417
|
+
_: 1
|
|
418
|
+
}, 8, ["open"])]));
|
|
419
|
+
}
|
|
420
|
+
}), Rn = Symbol("dt-sheet-editor"), zn = () => z(Rn, { seed: () => void 0 }), Bn = /* @__PURE__ */ L({
|
|
421
|
+
__name: "MultiCell",
|
|
422
|
+
props: {
|
|
423
|
+
modelValue: {},
|
|
424
|
+
row: {},
|
|
425
|
+
column: {}
|
|
426
|
+
},
|
|
427
|
+
emits: ["update:modelValue"],
|
|
428
|
+
setup(e, { emit: n }) {
|
|
429
|
+
let r = e, i = n, { locale: a } = ce(), o = (e) => e.toLocaleLowerCase(a), s = zn(), c = A(() => r.column), l = A(() => Array.isArray(r.modelValue) ? r.modelValue : []), u = A(() => {
|
|
430
|
+
let e = c.value;
|
|
431
|
+
return e.options.filter((t) => l.value.includes(t.value) || !e.optionEnabled || e.optionEnabled(t, r.row));
|
|
432
|
+
}), d = V(s.seed() ?? ""), f = A(() => {
|
|
433
|
+
let e = o(d.value.trim());
|
|
434
|
+
return e ? u.value.filter((t) => o(t.label).includes(e)) : u.value;
|
|
435
|
+
}), p = V(!0), m = A({
|
|
436
|
+
get: () => p.value && f.value.length > 0,
|
|
437
|
+
set: (e) => p.value = e
|
|
438
|
+
}), h = V();
|
|
439
|
+
Oe(m, (e) => {
|
|
440
|
+
e && fe(() => {
|
|
441
|
+
h.value = document.querySelector(".dt-cell-list[role=\"listbox\"]")?.id || void 0;
|
|
442
|
+
});
|
|
443
|
+
}, { immediate: !0 });
|
|
444
|
+
let g = (e) => {
|
|
445
|
+
Array.isArray(e) && (i("update:modelValue", e.length ? e : null), d.value = "", fe(y));
|
|
446
|
+
}, _ = (e) => {
|
|
447
|
+
e.altKey && e.key === "ArrowDown" && (e.preventDefault(), m.value = !0);
|
|
448
|
+
}, v = V(null), y = () => wn(v.value?.$el ?? null);
|
|
449
|
+
ge(() => void fe(y));
|
|
450
|
+
let b = (e) => t(e.o.tone, e.o.label);
|
|
451
|
+
return (t, n) => (B(), j(K(Et), {
|
|
452
|
+
open: m.value,
|
|
453
|
+
"onUpdate:open": n[1] ||= (e) => m.value = e,
|
|
454
|
+
class: "dt-cell-editor is-multi",
|
|
455
|
+
multiple: "",
|
|
456
|
+
"model-value": l.value,
|
|
457
|
+
"reset-search-term-on-blur": !1,
|
|
458
|
+
"reset-search-term-on-select": !1,
|
|
459
|
+
"ignore-filter": "",
|
|
460
|
+
"onUpdate:modelValue": g
|
|
461
|
+
}, {
|
|
462
|
+
default: q(() => [I(K(yt), { class: "dt-cell-anchor" }, {
|
|
463
|
+
default: q(() => [I(K(St), {
|
|
464
|
+
ref_key: "input",
|
|
465
|
+
ref: v,
|
|
466
|
+
modelValue: d.value,
|
|
467
|
+
"onUpdate:modelValue": n[0] ||= (e) => d.value = e,
|
|
468
|
+
class: "dt-cell-input",
|
|
469
|
+
"display-value": () => d.value,
|
|
470
|
+
autocomplete: "off",
|
|
471
|
+
"aria-label": e.column.header,
|
|
472
|
+
"aria-controls": h.value,
|
|
473
|
+
onKeydown: _
|
|
474
|
+
}, null, 8, [
|
|
475
|
+
"modelValue",
|
|
476
|
+
"display-value",
|
|
477
|
+
"aria-label",
|
|
478
|
+
"aria-controls"
|
|
479
|
+
])]),
|
|
480
|
+
_: 1
|
|
481
|
+
}), I(K(Tt), null, {
|
|
482
|
+
default: q(() => [I(K(bt), {
|
|
483
|
+
class: "dt-pop dt-cell-list dt-sheet-layer",
|
|
484
|
+
position: "popper",
|
|
485
|
+
align: "start",
|
|
486
|
+
"side-offset": 2,
|
|
487
|
+
"aria-label": e.column.header
|
|
488
|
+
}, {
|
|
489
|
+
default: q(() => [I(K(Dt), null, {
|
|
490
|
+
default: q(() => [(B(!0), N(k, null, ve(f.value, (e) => (B(), j(K(Ct), {
|
|
491
|
+
key: String(e.value),
|
|
492
|
+
class: "dt-pop-item dt-cell-option",
|
|
493
|
+
value: e.value,
|
|
494
|
+
"text-value": e.label
|
|
495
|
+
}, {
|
|
496
|
+
default: q(() => [
|
|
497
|
+
I(b, { o: e }, null, 8, ["o"]),
|
|
498
|
+
I(K(wt), { class: "dt-cell-option-check" }, {
|
|
499
|
+
default: q(() => [I(K(Re), {
|
|
500
|
+
size: 14,
|
|
501
|
+
"aria-hidden": "true"
|
|
502
|
+
})]),
|
|
503
|
+
_: 1
|
|
504
|
+
}),
|
|
505
|
+
n[2] ||= P("kbd", {
|
|
506
|
+
class: "dt-kbd dt-cell-option-enter",
|
|
507
|
+
"aria-hidden": "true"
|
|
508
|
+
}, "↵", -1)
|
|
509
|
+
]),
|
|
510
|
+
_: 2
|
|
511
|
+
}, 1032, ["value", "text-value"]))), 128))]),
|
|
512
|
+
_: 1
|
|
513
|
+
})]),
|
|
514
|
+
_: 1
|
|
515
|
+
}, 8, ["aria-label"])]),
|
|
516
|
+
_: 1
|
|
517
|
+
})]),
|
|
518
|
+
_: 1
|
|
519
|
+
}, 8, ["open", "model-value"]));
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region src/sheet/fill.ts
|
|
524
|
+
function Vn(e, t, n = !1) {
|
|
525
|
+
if (!e.length || t <= 0) return [];
|
|
526
|
+
let r = e.every((e) => typeof e == "number") ? e : null;
|
|
527
|
+
if (r && r.length >= 2) {
|
|
528
|
+
let e = r[1] - r[0];
|
|
529
|
+
if (r.every((t, n) => n === 0 || Math.abs(t - r[n - 1] - e) < 1e-9)) {
|
|
530
|
+
let i = n ? r[0] : r[r.length - 1], a = n ? -1 : 1;
|
|
531
|
+
return Array.from({ length: t }, (t, n) => Hn(i + a * e * (n + 1)));
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
let i = e.length;
|
|
535
|
+
return Array.from({ length: t }, (t, r) => n ? e[(i - 1 - r % i + i) % i] : e[r % i]);
|
|
536
|
+
}
|
|
537
|
+
var Hn = (e) => Number(e.toPrecision(10));
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/sheet/import/model.ts
|
|
540
|
+
function Un(e) {
|
|
541
|
+
return e == null ? "" : e instanceof Date ? Number.isNaN(e.getTime()) ? "" : w(e) : String(e).trim();
|
|
542
|
+
}
|
|
543
|
+
var Wn = {
|
|
544
|
+
ı: "i",
|
|
545
|
+
i̇: "i",
|
|
546
|
+
ş: "s",
|
|
547
|
+
ğ: "g",
|
|
548
|
+
ç: "c",
|
|
549
|
+
ö: "o",
|
|
550
|
+
ü: "u",
|
|
551
|
+
â: "a",
|
|
552
|
+
î: "i",
|
|
553
|
+
û: "u"
|
|
554
|
+
}, Gn = (e) => e.toLocaleLowerCase("tr").replace(/ı|i̇|ş|ğ|ç|ö|ü|â|î|û/g, (e) => Wn[e] ?? e).replace(/[^a-z0-9]+/g, " ").trim(), Kn = (e) => /^[-+]?[\d.,\s]*\d[\d.,\s]*%?$/.test(e);
|
|
555
|
+
function qn(e) {
|
|
556
|
+
let t = -1, n = -1;
|
|
557
|
+
for (let r = 0; r < Math.min(e.length, 20); r++) {
|
|
558
|
+
let i = (e[r] ?? []).map(Un).filter(Boolean);
|
|
559
|
+
i.length && (i.filter((e) => !Kn(e)).length * 2 < i.length || i.length > n && (n = i.length, t = r));
|
|
560
|
+
}
|
|
561
|
+
if (t >= 0) return t;
|
|
562
|
+
let r = e.findIndex((e) => (e ?? []).some((e) => Un(e) !== ""));
|
|
563
|
+
return r < 0 ? 0 : r;
|
|
564
|
+
}
|
|
565
|
+
function Jn(e, t) {
|
|
566
|
+
let n = {}, r = t.map((e) => new Set([
|
|
567
|
+
e.header,
|
|
568
|
+
String(e.id),
|
|
569
|
+
...e.importAliases ?? []
|
|
570
|
+
].map(Gn)));
|
|
571
|
+
return e.forEach((e, i) => {
|
|
572
|
+
let a = Gn(e);
|
|
573
|
+
if (!a) return;
|
|
574
|
+
let o = t.filter((e, t) => r[t].has(a));
|
|
575
|
+
o.length === 1 && (n[i] = String(o[0].id));
|
|
576
|
+
}), n;
|
|
577
|
+
}
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region src/sheet/ImportDialog.vue?vue&type=script&setup=true&lang.ts
|
|
580
|
+
var Yn = { class: "dt-import-head" }, Xn = { class: "dt-import-body" }, Zn = ["aria-busy"], Qn = { class: "dt-import-drop-icon" }, $n = { class: "dt-import-file" }, er = { class: "dt-import-file-icon" }, tr = { class: "dt-import-file-text" }, nr = {
|
|
581
|
+
key: 0,
|
|
582
|
+
class: "dt-select dt-import-sheet"
|
|
583
|
+
}, rr = ["aria-label"], ir = ["value"], ar = {
|
|
584
|
+
key: 1,
|
|
585
|
+
class: "dt-import-sheet-info"
|
|
586
|
+
}, or = { class: "dt-import-match" }, sr = { class: "dt-import-match-label" }, cr = { class: "dt-import-key" }, lr = { class: "dt-mono" }, ur = ["value", "aria-label"], dr = { value: "" }, fr = ["value", "disabled"], pr = { class: "dt-select dt-import-headerrow" }, mr = { class: "dt-import-match-label" }, hr = ["value"], gr = ["value"], _r = {
|
|
587
|
+
key: 0,
|
|
588
|
+
class: "dt-import-warn"
|
|
589
|
+
}, vr = { class: "dt-import-table" }, yr = ["title"], br = { class: "dt-mono" }, xr = { class: "dt-import-muted" }, Sr = {
|
|
590
|
+
key: 1,
|
|
591
|
+
class: "dt-select dt-import-field"
|
|
592
|
+
}, Cr = [
|
|
593
|
+
"value",
|
|
594
|
+
"aria-label",
|
|
595
|
+
"onChange"
|
|
596
|
+
], wr = {
|
|
597
|
+
value: "",
|
|
598
|
+
disabled: ""
|
|
599
|
+
}, Tr = ["value", "disabled"], Er = { class: "dt-import-preview" }, Dr = {
|
|
600
|
+
key: 0,
|
|
601
|
+
class: "dt-mono"
|
|
602
|
+
}, Or = { class: "dt-import-muted" }, kr = {
|
|
603
|
+
key: 1,
|
|
604
|
+
class: "dt-import-summary"
|
|
605
|
+
}, Ar = { class: "dt-import-summary-line" }, jr = {
|
|
606
|
+
key: 0,
|
|
607
|
+
class: "dt-import-newlist dt-mono"
|
|
608
|
+
}, Mr = {
|
|
609
|
+
key: 1,
|
|
610
|
+
class: "dt-check-row"
|
|
611
|
+
}, Nr = {
|
|
612
|
+
key: 2,
|
|
613
|
+
class: "dt-import-warn"
|
|
614
|
+
}, Pr = {
|
|
615
|
+
key: 2,
|
|
616
|
+
class: "dt-import-error",
|
|
617
|
+
role: "alert"
|
|
618
|
+
}, Fr = { class: "dt-import-foot" }, Ir = ["disabled"], Lr = "__skip__", Rr = /* @__PURE__ */ L({
|
|
619
|
+
__name: "ImportDialog",
|
|
620
|
+
props: /*@__PURE__*/ ue({
|
|
621
|
+
parseFile: { type: Function },
|
|
622
|
+
columns: {},
|
|
623
|
+
keyColumn: {},
|
|
624
|
+
entity: {},
|
|
625
|
+
maxRows: {},
|
|
626
|
+
rowCount: {},
|
|
627
|
+
inList: { type: Function },
|
|
628
|
+
lookupKeys: { type: Function },
|
|
629
|
+
parseEnv: { type: Function },
|
|
630
|
+
fmtEnv: {}
|
|
631
|
+
}, {
|
|
632
|
+
open: {
|
|
633
|
+
type: Boolean,
|
|
634
|
+
default: !1
|
|
635
|
+
},
|
|
636
|
+
openModifiers: {}
|
|
637
|
+
}),
|
|
638
|
+
emits: /*@__PURE__*/ ue(["apply"], ["update:open"]),
|
|
639
|
+
setup(e, { emit: t }) {
|
|
640
|
+
let n = e, r = t, a = Ce(e, "open"), { i18n: o, locale: s } = ce(), c = A(() => n.columns.find((e) => e.id === n.keyColumn)), l = A(() => c.value?.header ?? n.keyColumn), u = A(() => n.columns.filter((e) => e.id !== n.keyColumn).map((e) => ({
|
|
641
|
+
id: e.id,
|
|
642
|
+
def: e,
|
|
643
|
+
editable: !!e.editable
|
|
644
|
+
}))), d = U(null), f = U(null), p = V(!1), h = V(!1), g = V(""), _ = V(0), v = V(0), y = V({}), b = V(null), x = V(!0), S = V(!1), ee = V(!1), C = V(null), w = A(() => f.value?.sheets[_.value]?.rows ?? []), te = A(() => (w.value[v.value] ?? []).map(Un)), ne = A(() => w.value.slice(v.value + 1).filter((e) => (e ?? []).some((e) => Un(e) !== ""))), T = A(() => Math.min(w.value.length, 20)), E = () => {
|
|
645
|
+
let e = Jn(te.value, n.columns), t = {}, r = null;
|
|
646
|
+
for (let [i, a] of Object.entries(e)) a === n.keyColumn ? r ??= Number(i) : u.value.find((e) => e.id === a)?.editable && (t[Number(i)] = a);
|
|
647
|
+
y.value = t, b.value = r, S.value = !1;
|
|
648
|
+
}, re = async (e) => {
|
|
649
|
+
d.value = e, h.value = !1, p.value = !0;
|
|
650
|
+
try {
|
|
651
|
+
let t = await n.parseFile(e);
|
|
652
|
+
f.value = t, _.value = 0, v.value = qn(t.sheets[0]?.rows ?? []), E();
|
|
653
|
+
} catch (e) {
|
|
654
|
+
f.value = null, h.value = !0, g.value = e instanceof Error ? e.message : "";
|
|
655
|
+
} finally {
|
|
656
|
+
p.value = !1;
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
Oe(_, () => {
|
|
660
|
+
v.value = qn(w.value), E();
|
|
661
|
+
});
|
|
662
|
+
let D = (e) => {
|
|
663
|
+
v.value = e, E();
|
|
664
|
+
}, ie = (e) => {
|
|
665
|
+
let t = e.target.files?.[0];
|
|
666
|
+
t && re(t), e.target.value = "";
|
|
667
|
+
}, ae = (e) => {
|
|
668
|
+
ee.value = !1;
|
|
669
|
+
let t = e.dataTransfer?.files?.[0];
|
|
670
|
+
t && re(t);
|
|
671
|
+
}, oe = () => {
|
|
672
|
+
d.value = null, f.value = null, h.value = !1, y.value = {}, b.value = null, O.value = null;
|
|
673
|
+
};
|
|
674
|
+
Oe(a, (e) => {
|
|
675
|
+
e || oe();
|
|
676
|
+
});
|
|
677
|
+
let se = A(() => b.value === null ? [] : ne.value.map((e) => Un(e?.[b.value])).filter(Boolean)), O = U(null), le = null;
|
|
678
|
+
Oe(se, async (e) => {
|
|
679
|
+
O.value = null, le?.abort();
|
|
680
|
+
let t = [...new Set(e.filter((e) => !n.inList(e)))];
|
|
681
|
+
if (!t.length || !n.lookupKeys) {
|
|
682
|
+
O.value = new Map(t.map((e) => [e, null]));
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
le = new AbortController();
|
|
686
|
+
let r = /* @__PURE__ */ new Map();
|
|
687
|
+
try {
|
|
688
|
+
for (let e = 0; e < t.length; e += 500) {
|
|
689
|
+
let i = t.slice(e, e + 500), a = await n.lookupKeys(i, { signal: le.signal });
|
|
690
|
+
for (let e of i) r.set(e, a[e] ?? null);
|
|
691
|
+
}
|
|
692
|
+
O.value = r;
|
|
693
|
+
} catch {
|
|
694
|
+
le.signal.aborted || (O.value = new Map(t.map((e) => [e, null])));
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
let L = A(() => {
|
|
698
|
+
if (!se.value.length) return null;
|
|
699
|
+
let e = /* @__PURE__ */ new Set(), t = 0, r = 0, i = [];
|
|
700
|
+
for (let a of se.value) e.has(a) || (e.add(a), n.inList(a) ? t++ : O.value?.get(a) ? r++ : i.push(a));
|
|
701
|
+
return {
|
|
702
|
+
updates: t + r,
|
|
703
|
+
news: i,
|
|
704
|
+
pending: O.value === null && !!n.lookupKeys
|
|
705
|
+
};
|
|
706
|
+
}), R = A(() => {
|
|
707
|
+
let e = L.value;
|
|
708
|
+
return !!e && x.value && n.rowCount + e.news.length > n.maxRows;
|
|
709
|
+
}), z = A(() => !!f.value && b.value !== null && !!L.value && !L.value.pending && !R.value), ue = (e, t) => {
|
|
710
|
+
if (!i[t.type].numeric) return s;
|
|
711
|
+
let n = _n(ne.value.slice(0, 50).map((t) => Un(t?.[e])));
|
|
712
|
+
return n === "," ? "de" : n === "." ? "en" : s;
|
|
713
|
+
}, de = (e, t, r) => {
|
|
714
|
+
if (typeof r == "number" || typeof r == "boolean") return r;
|
|
715
|
+
if (r instanceof Date) return Un(r);
|
|
716
|
+
let i = Un(r);
|
|
717
|
+
return i === "" ? null : xn(t, i, n.parseEnv(ue(e, t)));
|
|
718
|
+
}, fe = (e) => {
|
|
719
|
+
let t = ne.value[0], r = Un(t?.[e]), i = y.value[e], a = i ? n.columns.find((e) => e.id === i) : void 0;
|
|
720
|
+
if (!a || !r) return {
|
|
721
|
+
raw: r,
|
|
722
|
+
shown: null
|
|
723
|
+
};
|
|
724
|
+
let o = de(e, a, t?.[e]), s = m(a, {}, o, n.fmtEnv);
|
|
725
|
+
return {
|
|
726
|
+
raw: r,
|
|
727
|
+
shown: s === r ? null : s
|
|
728
|
+
};
|
|
729
|
+
}, me = () => {
|
|
730
|
+
if (!z.value || b.value === null) return;
|
|
731
|
+
let e = [];
|
|
732
|
+
for (let t of ne.value) {
|
|
733
|
+
let r = Un(t?.[b.value]);
|
|
734
|
+
if (!r) continue;
|
|
735
|
+
let i = {};
|
|
736
|
+
for (let [e, r] of Object.entries(y.value)) {
|
|
737
|
+
if (!r || r === Lr) continue;
|
|
738
|
+
let a = n.columns.find((e) => e.id === r), o = t?.[Number(e)];
|
|
739
|
+
a && Un(o) !== "" && (i[r] = de(Number(e), a, o));
|
|
740
|
+
}
|
|
741
|
+
e.push({
|
|
742
|
+
key: r,
|
|
743
|
+
values: i,
|
|
744
|
+
server: n.inList(r) ? void 0 : O.value?.get(r) ?? null
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
r("apply", {
|
|
748
|
+
rows: e,
|
|
749
|
+
addNew: x.value
|
|
750
|
+
}), a.value = !1;
|
|
751
|
+
}, he = A(() => {
|
|
752
|
+
let e = f.value?.sheets[_.value];
|
|
753
|
+
return e ? o.t("import.sheetInfo", {
|
|
754
|
+
sheet: e.name,
|
|
755
|
+
count: ne.value.length
|
|
756
|
+
}) : "";
|
|
757
|
+
});
|
|
758
|
+
return (t, n) => (B(), j(K(zt), {
|
|
759
|
+
open: a.value,
|
|
760
|
+
"onUpdate:open": n[9] ||= (e) => a.value = e
|
|
761
|
+
}, {
|
|
762
|
+
default: q(() => [I(K(Rt), null, {
|
|
763
|
+
default: q(() => [I(K(Lt), { class: "dt-scrim" }), I(K(Ft), { class: "dt-dialog dt-import" }, {
|
|
764
|
+
default: q(() => [
|
|
765
|
+
P("div", Yn, [P("div", null, [I(K(Bt), { class: "dt-dialog-title" }, {
|
|
766
|
+
default: q(() => [F(W(K(o).t("import.title")), 1)]),
|
|
767
|
+
_: 1
|
|
768
|
+
}), I(K(It), { class: "dt-dialog-body" }, {
|
|
769
|
+
default: q(() => [F(W(K(o).t("import.body", {
|
|
770
|
+
key: l.value,
|
|
771
|
+
entity: e.entity
|
|
772
|
+
})), 1)]),
|
|
773
|
+
_: 1
|
|
774
|
+
})]), I(K(Pt), {
|
|
775
|
+
class: "dt-btn dt-btn-icon dt-btn-ghost",
|
|
776
|
+
"aria-label": K(o).t("common.close")
|
|
777
|
+
}, {
|
|
778
|
+
default: q(() => [I(K(Qe), {
|
|
779
|
+
size: 16,
|
|
780
|
+
"aria-hidden": "true"
|
|
781
|
+
})]),
|
|
782
|
+
_: 1
|
|
783
|
+
}, 8, ["aria-label"])]),
|
|
784
|
+
P("div", Xn, [
|
|
785
|
+
P("input", {
|
|
786
|
+
ref_key: "input",
|
|
787
|
+
ref: C,
|
|
788
|
+
type: "file",
|
|
789
|
+
class: "dt-sr-only",
|
|
790
|
+
accept: ".xlsx,.xls,.csv",
|
|
791
|
+
tabindex: "-1",
|
|
792
|
+
onChange: ie
|
|
793
|
+
}, null, 544),
|
|
794
|
+
f.value ? (B(), N(k, { key: 1 }, [
|
|
795
|
+
P("div", $n, [
|
|
796
|
+
P("span", er, [I(K(Je), {
|
|
797
|
+
size: 18,
|
|
798
|
+
"aria-hidden": "true"
|
|
799
|
+
})]),
|
|
800
|
+
P("span", tr, [P("strong", null, W(d.value?.name), 1), f.value.sheets.length > 1 ? (B(), N("label", nr, [Ae(P("select", {
|
|
801
|
+
"onUpdate:modelValue": n[3] ||= (e) => _.value = e,
|
|
802
|
+
"aria-label": K(o).t("import.sheetInfo", {
|
|
803
|
+
sheet: "",
|
|
804
|
+
count: 0
|
|
805
|
+
})
|
|
806
|
+
}, [(B(!0), N(k, null, ve(f.value.sheets, (e, t) => (B(), N("option", {
|
|
807
|
+
key: t,
|
|
808
|
+
value: t
|
|
809
|
+
}, W(K(o).t("import.sheetInfo", {
|
|
810
|
+
sheet: e.name,
|
|
811
|
+
count: e.rows.length
|
|
812
|
+
})), 9, ir))), 128))], 8, rr), [[Ee, _.value]])])) : (B(), N("span", ar, W(he.value), 1))]),
|
|
813
|
+
P("button", {
|
|
814
|
+
type: "button",
|
|
815
|
+
class: "dt-btn dt-btn-sm",
|
|
816
|
+
onClick: n[4] ||= (e) => C.value?.click()
|
|
817
|
+
}, W(K(o).t("import.replace")), 1)
|
|
818
|
+
]),
|
|
819
|
+
P("div", or, [
|
|
820
|
+
P("span", sr, W(K(o).t("import.matchBy")), 1),
|
|
821
|
+
P("span", cr, [I(K(Ge), {
|
|
822
|
+
size: 12,
|
|
823
|
+
"aria-hidden": "true"
|
|
824
|
+
}), P("span", lr, W(l.value), 1)]),
|
|
825
|
+
I(K(J), {
|
|
826
|
+
size: 14,
|
|
827
|
+
"aria-hidden": "true"
|
|
828
|
+
}),
|
|
829
|
+
P("label", { class: pe(["dt-select dt-import-keysel", { "is-missing": b.value === null }]) }, [P("select", {
|
|
830
|
+
value: b.value ?? "",
|
|
831
|
+
"aria-label": K(o).t("import.excelColumn"),
|
|
832
|
+
onChange: n[5] ||= (e) => b.value = e.target.value === "" ? null : Number(e.target.value)
|
|
833
|
+
}, [P("option", dr, W(K(o).t("import.excelColumn")), 1), (B(!0), N(k, null, ve(te.value, (e, t) => (B(), N("option", {
|
|
834
|
+
key: t,
|
|
835
|
+
value: t,
|
|
836
|
+
disabled: !e
|
|
837
|
+
}, W(e), 9, fr))), 128))], 40, ur)], 2),
|
|
838
|
+
n[10] ||= P("span", { class: "dt-import-spacer" }, null, -1),
|
|
839
|
+
P("label", pr, [P("span", mr, W(K(o).t("import.headerRow")), 1), P("select", {
|
|
840
|
+
value: v.value,
|
|
841
|
+
onChange: n[6] ||= (e) => D(Number(e.target.value))
|
|
842
|
+
}, [(B(!0), N(k, null, ve(T.value, (e) => (B(), N("option", {
|
|
843
|
+
key: e,
|
|
844
|
+
value: e - 1
|
|
845
|
+
}, W(K(o).t("import.headerRowN", { n: e })), 9, gr))), 128))], 40, hr)])
|
|
846
|
+
]),
|
|
847
|
+
b.value === null ? (B(), N("p", _r, [I(K(Ze), {
|
|
848
|
+
size: 14,
|
|
849
|
+
"aria-hidden": "true"
|
|
850
|
+
}), F(" " + W(K(o).t("import.keyRequired", { key: l.value })), 1)])) : M("", !0),
|
|
851
|
+
P("table", vr, [
|
|
852
|
+
n[12] ||= P("colgroup", null, [
|
|
853
|
+
P("col", { class: "dt-import-col-excel" }),
|
|
854
|
+
P("col", { class: "dt-import-col-arrow" }),
|
|
855
|
+
P("col", { class: "dt-import-col-field" }),
|
|
856
|
+
P("col")
|
|
857
|
+
], -1),
|
|
858
|
+
P("thead", null, [P("tr", null, [
|
|
859
|
+
P("th", null, W(K(o).t("import.excelColumn")), 1),
|
|
860
|
+
n[11] ||= P("th", null, null, -1),
|
|
861
|
+
P("th", null, W(K(o).t("import.field")), 1),
|
|
862
|
+
P("th", null, W(K(o).t("import.firstValue")), 1)
|
|
863
|
+
])]),
|
|
864
|
+
P("tbody", null, [(B(!0), N(k, null, ve(te.value, (e, t) => (B(), N("tr", {
|
|
865
|
+
key: t,
|
|
866
|
+
class: pe({ "is-skipped": t !== b.value && (y.value[t] ?? "") === Lr })
|
|
867
|
+
}, [
|
|
868
|
+
P("td", {
|
|
869
|
+
class: "dt-import-col",
|
|
870
|
+
title: e
|
|
871
|
+
}, W(e), 9, yr),
|
|
872
|
+
P("td", null, [I(K(Me), {
|
|
873
|
+
size: 14,
|
|
874
|
+
"aria-hidden": "true"
|
|
875
|
+
})]),
|
|
876
|
+
P("td", null, [t === b.value ? (B(), N(k, { key: 0 }, [P("span", br, W(l.value), 1), P("span", xr, W(K(o).t("import.matchKey")), 1)], 64)) : (B(), N("label", Sr, [P("select", {
|
|
877
|
+
value: y.value[t] ?? "",
|
|
878
|
+
"aria-label": K(o).t("import.field"),
|
|
879
|
+
onChange: (e) => y.value = {
|
|
880
|
+
...y.value,
|
|
881
|
+
[t]: e.target.value
|
|
882
|
+
}
|
|
883
|
+
}, [
|
|
884
|
+
P("option", wr, W(K(o).t("import.chooseField")), 1),
|
|
885
|
+
P("option", { value: Lr }, W(K(o).t("import.skip")), 1),
|
|
886
|
+
(B(!0), N(k, null, ve(u.value, (e) => (B(), N("option", {
|
|
887
|
+
key: e.id,
|
|
888
|
+
value: e.id,
|
|
889
|
+
disabled: !e.editable
|
|
890
|
+
}, W(e.def.header) + W(e.editable ? "" : ` · ${K(o).t("sheet.readOnly.badge")}`), 9, Tr))), 128))
|
|
891
|
+
], 40, Cr)]))]),
|
|
892
|
+
P("td", Er, [t === b.value ? (B(), N("span", Dr, W(fe(t).raw), 1)) : fe(t).shown ? (B(), N(k, { key: 1 }, [
|
|
893
|
+
P("span", Or, W(fe(t).raw), 1),
|
|
894
|
+
I(K(Me), {
|
|
895
|
+
size: 12,
|
|
896
|
+
"aria-hidden": "true"
|
|
897
|
+
}),
|
|
898
|
+
P("strong", null, W(fe(t).shown), 1)
|
|
899
|
+
], 64)) : (B(), N("span", {
|
|
900
|
+
key: 2,
|
|
901
|
+
class: pe({ "dt-import-muted": !y.value[t] || y.value[t] === Lr })
|
|
902
|
+
}, W(fe(t).raw), 3))])
|
|
903
|
+
], 2))), 128))])
|
|
904
|
+
]),
|
|
905
|
+
L.value && b.value !== null ? (B(), N("div", kr, [
|
|
906
|
+
P("div", Ar, [
|
|
907
|
+
I(K(Ue), {
|
|
908
|
+
size: 16,
|
|
909
|
+
"aria-hidden": "true"
|
|
910
|
+
}),
|
|
911
|
+
P("span", null, W(K(o).t("import.summary", {
|
|
912
|
+
updates: L.value.updates,
|
|
913
|
+
news: L.value.news.length,
|
|
914
|
+
entity: e.entity,
|
|
915
|
+
key: l.value
|
|
916
|
+
})), 1),
|
|
917
|
+
L.value.news.length ? (B(), N("button", {
|
|
918
|
+
key: 0,
|
|
919
|
+
type: "button",
|
|
920
|
+
class: "dt-link dt-import-link",
|
|
921
|
+
onClick: n[7] ||= (e) => S.value = !S.value
|
|
922
|
+
}, W(K(o).t("import.seeNew", { key: l.value })), 1)) : M("", !0)
|
|
923
|
+
]),
|
|
924
|
+
S.value ? (B(), N("div", jr, W(L.value.news.join(", ")), 1)) : M("", !0),
|
|
925
|
+
L.value.news.length ? (B(), N("label", Mr, [Ae(P("input", {
|
|
926
|
+
"onUpdate:modelValue": n[8] ||= (e) => x.value = e,
|
|
927
|
+
type: "checkbox",
|
|
928
|
+
class: "dt-checkbox"
|
|
929
|
+
}, null, 512), [[Te, x.value]]), F(" " + W(K(o).t("import.addNew", {
|
|
930
|
+
count: L.value.news.length,
|
|
931
|
+
key: l.value
|
|
932
|
+
})), 1)])) : M("", !0),
|
|
933
|
+
R.value ? (B(), N("p", Nr, [I(K(Ze), {
|
|
934
|
+
size: 14,
|
|
935
|
+
"aria-hidden": "true"
|
|
936
|
+
}), F(" " + W(K(o).t("sheet.limitFile", {
|
|
937
|
+
count: e.rowCount + L.value.news.length,
|
|
938
|
+
max: e.maxRows
|
|
939
|
+
})), 1)])) : M("", !0)
|
|
940
|
+
])) : M("", !0)
|
|
941
|
+
], 64)) : (B(), N("button", {
|
|
942
|
+
key: 0,
|
|
943
|
+
type: "button",
|
|
944
|
+
class: pe(["dt-import-drop", {
|
|
945
|
+
"is-over": ee.value,
|
|
946
|
+
"is-failed": h.value
|
|
947
|
+
}]),
|
|
948
|
+
"aria-busy": p.value ? "true" : void 0,
|
|
949
|
+
onClick: n[0] ||= (e) => C.value?.click(),
|
|
950
|
+
onDragover: n[1] ||= je((e) => ee.value = !0, ["prevent"]),
|
|
951
|
+
onDragleave: n[2] ||= (e) => ee.value = !1,
|
|
952
|
+
onDrop: je(ae, ["prevent"])
|
|
953
|
+
}, [P("span", Qn, [I(K(Ye), {
|
|
954
|
+
size: 20,
|
|
955
|
+
"aria-hidden": "true"
|
|
956
|
+
})]), P("span", null, W(K(o).t("import.drop")), 1)], 42, Zn)),
|
|
957
|
+
h.value && !f.value ? (B(), N("p", Pr, [F(W(K(o).t("import.failed")) + " ", 1), g.value ? (B(), N(k, { key: 0 }, [F("· " + W(g.value), 1)], 64)) : M("", !0)])) : M("", !0)
|
|
958
|
+
]),
|
|
959
|
+
P("div", Fr, [I(K(Pt), { class: "dt-btn" }, {
|
|
960
|
+
default: q(() => [F(W(K(o).t("common.cancel")), 1)]),
|
|
961
|
+
_: 1
|
|
962
|
+
}), P("button", {
|
|
963
|
+
type: "button",
|
|
964
|
+
class: "dt-btn dt-btn-primary",
|
|
965
|
+
disabled: !z.value,
|
|
966
|
+
onClick: me
|
|
967
|
+
}, W(K(o).t("import.apply")), 9, Ir)])
|
|
968
|
+
]),
|
|
969
|
+
_: 1
|
|
970
|
+
})]),
|
|
971
|
+
_: 1
|
|
972
|
+
})]),
|
|
973
|
+
_: 1
|
|
974
|
+
}, 8, ["open"]));
|
|
975
|
+
}
|
|
976
|
+
}), zr = { class: "dt-error-list" }, Br = { class: "dt-error-no" }, Vr = { class: "dt-mono" }, Hr = { class: "dt-error-msg" }, Ur = { class: "dt-dialog-actions" }, Wr = ["disabled"], Gr = /* @__PURE__ */ L({
|
|
977
|
+
__name: "SaveErrorsDialog",
|
|
978
|
+
props: /*@__PURE__*/ ue({
|
|
979
|
+
errors: {},
|
|
980
|
+
okRows: {}
|
|
981
|
+
}, {
|
|
982
|
+
open: {
|
|
983
|
+
type: Boolean,
|
|
984
|
+
default: !1
|
|
985
|
+
},
|
|
986
|
+
openModifiers: {}
|
|
987
|
+
}),
|
|
988
|
+
emits: /*@__PURE__*/ ue(["fix", "save"], ["update:open"]),
|
|
989
|
+
setup(e, { emit: t }) {
|
|
990
|
+
let n = t, r = Ce(e, "open"), { i18n: i } = ce(), a = () => {
|
|
991
|
+
n("save"), r.value = !1;
|
|
992
|
+
};
|
|
993
|
+
return (t, o) => (B(), j(K(at), {
|
|
994
|
+
open: r.value,
|
|
995
|
+
"onUpdate:open": o[1] ||= (e) => r.value = e
|
|
996
|
+
}, {
|
|
997
|
+
default: q(() => [I(K(it), null, {
|
|
998
|
+
default: q(() => [I(K(rt), { class: "dt-scrim" }), I(K(tt), { class: "dt-dialog dt-dialog-errors" }, {
|
|
999
|
+
default: q(() => [
|
|
1000
|
+
I(K(ot), { class: "dt-dialog-title" }, {
|
|
1001
|
+
default: q(() => [F(W(K(i).t("sheet.errDialog.title", { count: e.errors.length })), 1)]),
|
|
1002
|
+
_: 1
|
|
1003
|
+
}),
|
|
1004
|
+
I(K(nt), { class: "dt-dialog-body" }, {
|
|
1005
|
+
default: q(() => [F(W(K(i).t("sheet.errDialog.body", { count: e.okRows })), 1)]),
|
|
1006
|
+
_: 1
|
|
1007
|
+
}),
|
|
1008
|
+
P("ul", zr, [(B(!0), N(k, null, ve(e.errors.slice(0, 8), (e) => (B(), N("li", {
|
|
1009
|
+
key: e.rowNo,
|
|
1010
|
+
class: "dt-error-row"
|
|
1011
|
+
}, [
|
|
1012
|
+
I(K(Ze), {
|
|
1013
|
+
size: 14,
|
|
1014
|
+
"aria-hidden": "true"
|
|
1015
|
+
}),
|
|
1016
|
+
P("span", Br, W(e.rowNo), 1),
|
|
1017
|
+
P("span", Vr, W(e.key), 1),
|
|
1018
|
+
P("span", Hr, W(e.message), 1)
|
|
1019
|
+
]))), 128))]),
|
|
1020
|
+
P("div", Ur, [I(K(et), {
|
|
1021
|
+
class: "dt-btn",
|
|
1022
|
+
onClick: o[0] ||= (e) => n("fix")
|
|
1023
|
+
}, {
|
|
1024
|
+
default: q(() => [F(W(K(i).t("sheet.errDialog.fix")), 1)]),
|
|
1025
|
+
_: 1
|
|
1026
|
+
}), P("button", {
|
|
1027
|
+
type: "button",
|
|
1028
|
+
class: "dt-btn dt-btn-primary",
|
|
1029
|
+
disabled: !e.okRows,
|
|
1030
|
+
onClick: a
|
|
1031
|
+
}, W(K(i).t("sheet.errDialog.save", { count: e.okRows })), 9, Wr)])
|
|
1032
|
+
]),
|
|
1033
|
+
_: 1
|
|
1034
|
+
})]),
|
|
1035
|
+
_: 1
|
|
1036
|
+
})]),
|
|
1037
|
+
_: 1
|
|
1038
|
+
}, 8, ["open"]));
|
|
1039
|
+
}
|
|
1040
|
+
}), Kr = { class: "dt-kbd" }, qr = { class: "dt-kbd" }, Jr = { class: "dt-kbd" }, Yr = { class: "dt-kbd" }, Xr = { class: "dt-kbd" }, Zr = { class: "dt-kbd" }, Qr = ["href"], $r = /* @__PURE__ */ L({
|
|
1041
|
+
__name: "SheetMenu",
|
|
1042
|
+
props: {
|
|
1043
|
+
sheet: {},
|
|
1044
|
+
entity: {},
|
|
1045
|
+
href: {},
|
|
1046
|
+
readOnly: { type: Boolean }
|
|
1047
|
+
},
|
|
1048
|
+
setup(e) {
|
|
1049
|
+
let { i18n: t } = ce(), n = {
|
|
1050
|
+
cut: u ? "⌘X" : "Ctrl+X",
|
|
1051
|
+
copy: u ? "⌘C" : "Ctrl+C",
|
|
1052
|
+
paste: u ? "⌘V" : "Ctrl+V",
|
|
1053
|
+
clear: "Del"
|
|
1054
|
+
};
|
|
1055
|
+
return (r, i) => (B(), j(K(At), null, {
|
|
1056
|
+
default: q(() => [I(K(Ot), { class: "dt-menu dt-sheet-menu" }, {
|
|
1057
|
+
default: q(() => [
|
|
1058
|
+
I(K(kt), {
|
|
1059
|
+
class: "dt-menu-item",
|
|
1060
|
+
disabled: e.readOnly,
|
|
1061
|
+
onSelect: i[0] ||= (t) => e.sheet.copyToClipboard(!0)
|
|
1062
|
+
}, {
|
|
1063
|
+
default: q(() => [F(W(K(t).t("sheet.menu.cut")) + " ", 1), P("kbd", Kr, W(n.cut), 1)]),
|
|
1064
|
+
_: 1
|
|
1065
|
+
}, 8, ["disabled"]),
|
|
1066
|
+
I(K(kt), {
|
|
1067
|
+
class: "dt-menu-item",
|
|
1068
|
+
onSelect: i[1] ||= (t) => e.sheet.copyToClipboard(!1)
|
|
1069
|
+
}, {
|
|
1070
|
+
default: q(() => [F(W(K(t).t("sheet.menu.copy")) + " ", 1), P("kbd", qr, W(n.copy), 1)]),
|
|
1071
|
+
_: 1
|
|
1072
|
+
}),
|
|
1073
|
+
I(K(kt), {
|
|
1074
|
+
class: "dt-menu-item",
|
|
1075
|
+
disabled: e.readOnly,
|
|
1076
|
+
onSelect: i[2] ||= (t) => e.sheet.pasteFromClipboard()
|
|
1077
|
+
}, {
|
|
1078
|
+
default: q(() => [F(W(K(t).t("sheet.menu.paste")) + " ", 1), P("kbd", Jr, W(n.paste), 1)]),
|
|
1079
|
+
_: 1
|
|
1080
|
+
}, 8, ["disabled"]),
|
|
1081
|
+
I(K(kt), {
|
|
1082
|
+
class: "dt-menu-item",
|
|
1083
|
+
disabled: e.readOnly,
|
|
1084
|
+
onSelect: i[3] ||= (t) => e.sheet.fillDown()
|
|
1085
|
+
}, {
|
|
1086
|
+
default: q(() => [F(W(K(t).t("sheet.menu.fillDown")) + " ", 1), P("kbd", Yr, W(K(ee)), 1)]),
|
|
1087
|
+
_: 1
|
|
1088
|
+
}, 8, ["disabled"]),
|
|
1089
|
+
I(K(kt), {
|
|
1090
|
+
class: "dt-menu-item",
|
|
1091
|
+
disabled: e.readOnly,
|
|
1092
|
+
onSelect: i[4] ||= (t) => e.sheet.clearCells()
|
|
1093
|
+
}, {
|
|
1094
|
+
default: q(() => [F(W(K(t).t("sheet.menu.clear")) + " ", 1), P("kbd", Xr, W(n.clear), 1)]),
|
|
1095
|
+
_: 1
|
|
1096
|
+
}, 8, ["disabled"]),
|
|
1097
|
+
I(K(Mt), { class: "dt-menu-sep" }),
|
|
1098
|
+
I(K(kt), {
|
|
1099
|
+
class: "dt-menu-item",
|
|
1100
|
+
disabled: e.readOnly,
|
|
1101
|
+
onSelect: i[5] ||= (t) => e.sheet.insertRow("above")
|
|
1102
|
+
}, {
|
|
1103
|
+
default: q(() => [F(W(K(t).t("sheet.menu.insertAbove")), 1)]),
|
|
1104
|
+
_: 1
|
|
1105
|
+
}, 8, ["disabled"]),
|
|
1106
|
+
I(K(kt), {
|
|
1107
|
+
class: "dt-menu-item",
|
|
1108
|
+
disabled: e.readOnly,
|
|
1109
|
+
onSelect: i[6] ||= (t) => e.sheet.insertRow("below")
|
|
1110
|
+
}, {
|
|
1111
|
+
default: q(() => [F(W(K(t).t("sheet.menu.insertBelow")), 1)]),
|
|
1112
|
+
_: 1
|
|
1113
|
+
}, 8, ["disabled"]),
|
|
1114
|
+
I(K(kt), {
|
|
1115
|
+
class: "dt-menu-item",
|
|
1116
|
+
disabled: e.readOnly,
|
|
1117
|
+
onSelect: i[7] ||= (t) => e.sheet.removeSelectedRows()
|
|
1118
|
+
}, {
|
|
1119
|
+
default: q(() => [F(W(K(t).t("sheet.menu.remove")) + " ", 1), P("kbd", Zr, W(K(O)), 1)]),
|
|
1120
|
+
_: 1
|
|
1121
|
+
}, 8, ["disabled"]),
|
|
1122
|
+
e.href ? (B(), N(k, { key: 0 }, [I(K(Mt), { class: "dt-menu-sep" }), I(K(kt), {
|
|
1123
|
+
"as-child": "",
|
|
1124
|
+
class: "dt-menu-item"
|
|
1125
|
+
}, {
|
|
1126
|
+
default: q(() => [P("a", {
|
|
1127
|
+
href: e.href,
|
|
1128
|
+
target: "_blank",
|
|
1129
|
+
rel: "noopener"
|
|
1130
|
+
}, W(K(t).t("sheet.menu.open", { entity: e.entity })), 9, Qr)]),
|
|
1131
|
+
_: 1
|
|
1132
|
+
})], 64)) : M("", !0)
|
|
1133
|
+
]),
|
|
1134
|
+
_: 1
|
|
1135
|
+
})]),
|
|
1136
|
+
_: 1
|
|
1137
|
+
}));
|
|
1138
|
+
}
|
|
1139
|
+
}), ei = /* @__PURE__ */ new WeakMap(), ti = (e) => {
|
|
1140
|
+
if (!e.href) return e;
|
|
1141
|
+
let t = ei.get(e);
|
|
1142
|
+
return t || ei.set(e, t = {
|
|
1143
|
+
...e,
|
|
1144
|
+
href: void 0
|
|
1145
|
+
}), t;
|
|
1146
|
+
}, ni = L({
|
|
1147
|
+
name: "DtSheetRow",
|
|
1148
|
+
props: {
|
|
1149
|
+
row: {
|
|
1150
|
+
type: Object,
|
|
1151
|
+
required: !0
|
|
1152
|
+
},
|
|
1153
|
+
index: {
|
|
1154
|
+
type: Number,
|
|
1155
|
+
required: !0
|
|
1156
|
+
},
|
|
1157
|
+
rowNo: {
|
|
1158
|
+
type: Number,
|
|
1159
|
+
required: !0
|
|
1160
|
+
},
|
|
1161
|
+
columns: {
|
|
1162
|
+
type: Array,
|
|
1163
|
+
required: !0
|
|
1164
|
+
},
|
|
1165
|
+
env: {
|
|
1166
|
+
type: Object,
|
|
1167
|
+
required: !0
|
|
1168
|
+
},
|
|
1169
|
+
keyColumn: {
|
|
1170
|
+
type: String,
|
|
1171
|
+
required: !0
|
|
1172
|
+
},
|
|
1173
|
+
read: {
|
|
1174
|
+
type: Function,
|
|
1175
|
+
required: !0
|
|
1176
|
+
},
|
|
1177
|
+
original: {
|
|
1178
|
+
type: Function,
|
|
1179
|
+
required: !0
|
|
1180
|
+
},
|
|
1181
|
+
canEdit: {
|
|
1182
|
+
type: Function,
|
|
1183
|
+
required: !0
|
|
1184
|
+
},
|
|
1185
|
+
current: {
|
|
1186
|
+
type: Function,
|
|
1187
|
+
required: !0
|
|
1188
|
+
},
|
|
1189
|
+
editorFor: {
|
|
1190
|
+
type: Function,
|
|
1191
|
+
required: !0
|
|
1192
|
+
},
|
|
1193
|
+
draft: {
|
|
1194
|
+
type: Map,
|
|
1195
|
+
default: void 0
|
|
1196
|
+
},
|
|
1197
|
+
issues: {
|
|
1198
|
+
type: Map,
|
|
1199
|
+
default: void 0
|
|
1200
|
+
},
|
|
1201
|
+
isNew: {
|
|
1202
|
+
type: Boolean,
|
|
1203
|
+
default: !1
|
|
1204
|
+
},
|
|
1205
|
+
keyState: {
|
|
1206
|
+
type: String,
|
|
1207
|
+
default: void 0
|
|
1208
|
+
},
|
|
1209
|
+
rowError: {
|
|
1210
|
+
type: String,
|
|
1211
|
+
default: void 0
|
|
1212
|
+
},
|
|
1213
|
+
active: {
|
|
1214
|
+
type: String,
|
|
1215
|
+
default: null
|
|
1216
|
+
},
|
|
1217
|
+
selection: {
|
|
1218
|
+
type: Object,
|
|
1219
|
+
default: null
|
|
1220
|
+
},
|
|
1221
|
+
handleAt: {
|
|
1222
|
+
type: String,
|
|
1223
|
+
default: null
|
|
1224
|
+
},
|
|
1225
|
+
fill: {
|
|
1226
|
+
type: Object,
|
|
1227
|
+
default: null
|
|
1228
|
+
},
|
|
1229
|
+
found: {
|
|
1230
|
+
type: Set,
|
|
1231
|
+
default: void 0
|
|
1232
|
+
},
|
|
1233
|
+
editing: {
|
|
1234
|
+
type: Object,
|
|
1235
|
+
default: null
|
|
1236
|
+
},
|
|
1237
|
+
tipBelow: {
|
|
1238
|
+
type: Boolean,
|
|
1239
|
+
default: !1
|
|
1240
|
+
},
|
|
1241
|
+
gutter: {
|
|
1242
|
+
type: Boolean,
|
|
1243
|
+
default: !0
|
|
1244
|
+
},
|
|
1245
|
+
uid: {
|
|
1246
|
+
type: String,
|
|
1247
|
+
default: "dt"
|
|
1248
|
+
},
|
|
1249
|
+
style: {
|
|
1250
|
+
type: Object,
|
|
1251
|
+
default: void 0
|
|
1252
|
+
}
|
|
1253
|
+
},
|
|
1254
|
+
emits: ["edit-value", "use-suggestion"],
|
|
1255
|
+
setup(e, { emit: t }) {
|
|
1256
|
+
let n = (t, n) => e.env.i18n.t(t, n), r = (r, i) => {
|
|
1257
|
+
let o = r.def, c = r.id, l = e.read(e.row, o), u = e.canEdit(e.row, o), d = e.issues?.get(c), p = e.draft?.has(c) ?? !1, h = e.active === c, _ = e.selection, v = !!_ && i >= _.from && i <= _.to, y = e.fill, b = !!y && i >= y.from && i <= y.to, x = e.editing?.columnId === c ? e.editing : null, S = c === e.keyColumn, ee;
|
|
1258
|
+
if (x?.inCell) {
|
|
1259
|
+
let n = e.editorFor(o);
|
|
1260
|
+
ee = R(n, {
|
|
1261
|
+
modelValue: x.value,
|
|
1262
|
+
row: e.current(e.row),
|
|
1263
|
+
column: o,
|
|
1264
|
+
"onUpdate:modelValue": (e) => t("edit-value", e)
|
|
1265
|
+
});
|
|
1266
|
+
} else ee = x ? R("span", { class: "dt-cell-content" }, Sn(o, x.value)) : d?.level === "error" && g(l) && d.message === n("sheet.required") ? R("span", { class: "dt-cell-content dt-cell-required" }, d.message) : R("span", { class: "dt-cell-content" }, [a(ti(o), e.row, l, e.env)]);
|
|
1267
|
+
let C = [ee];
|
|
1268
|
+
S && e.isNew && !x && C.push(e.keyState === "checking" ? R(ze, {
|
|
1269
|
+
size: 12,
|
|
1270
|
+
class: "dt-tag-spin dt-spin",
|
|
1271
|
+
role: "img",
|
|
1272
|
+
"aria-label": n("common.loading")
|
|
1273
|
+
}) : R("span", { class: ["dt-tag-new", { "is-update": e.keyState === "update" }] }, n(e.keyState === "update" ? "sheet.tag.update" : "sheet.tag.new"))), S && e.rowError && !x && C.push(R("span", {
|
|
1274
|
+
class: "dt-cell-tip is-error",
|
|
1275
|
+
role: "tooltip"
|
|
1276
|
+
}, e.rowError)), !u && !S && C.push(R(Ge, {
|
|
1277
|
+
size: 12,
|
|
1278
|
+
class: "dt-cell-lock",
|
|
1279
|
+
role: "img",
|
|
1280
|
+
"aria-label": n("sheet.readOnly.badge")
|
|
1281
|
+
}));
|
|
1282
|
+
let w = d ? `${e.uid}-${e.rowNo}-${i}` : void 0;
|
|
1283
|
+
return d && C.push(R("span", {
|
|
1284
|
+
id: w,
|
|
1285
|
+
class: ["dt-cell-tip", `is-${d.level}`],
|
|
1286
|
+
role: "tooltip"
|
|
1287
|
+
}, [d.message, d.suggest ? R("button", {
|
|
1288
|
+
type: "button",
|
|
1289
|
+
class: "dt-cell-tip-btn",
|
|
1290
|
+
tabindex: -1,
|
|
1291
|
+
onClick: () => t("use-suggestion", o, d.suggest.value)
|
|
1292
|
+
}, n("sheet.useOption", { option: d.suggest.label })) : null])), e.handleAt === c && !x && C.push(R("span", {
|
|
1293
|
+
class: "dt-fill-handle",
|
|
1294
|
+
"aria-hidden": "true"
|
|
1295
|
+
})), R("div", {
|
|
1296
|
+
class: [
|
|
1297
|
+
"dt-cell",
|
|
1298
|
+
`is-${s(o)}`,
|
|
1299
|
+
{
|
|
1300
|
+
"is-numeric": E(o.type),
|
|
1301
|
+
"is-key": S,
|
|
1302
|
+
"is-new": S && e.isNew,
|
|
1303
|
+
"is-readonly": !u,
|
|
1304
|
+
"is-active": h,
|
|
1305
|
+
"is-selected": v,
|
|
1306
|
+
"is-edge-l": v && i === _.from,
|
|
1307
|
+
"is-edge-r": v && i === _.to,
|
|
1308
|
+
"is-edge-t": v && _.top,
|
|
1309
|
+
"is-edge-b": v && _.bottom,
|
|
1310
|
+
"is-fill": b,
|
|
1311
|
+
"is-fill-end": b && y.last,
|
|
1312
|
+
"is-match": e.found?.has(c) ?? !1,
|
|
1313
|
+
"is-editing": !!x,
|
|
1314
|
+
"is-changed": p,
|
|
1315
|
+
"is-error": d?.level === "error" || S && !!e.rowError,
|
|
1316
|
+
"is-warning": d?.level === "warning",
|
|
1317
|
+
"is-tip-below": e.tipBelow,
|
|
1318
|
+
"is-pinned-start": r.pinned === "start",
|
|
1319
|
+
"is-pinned-end": r.pinned === "end",
|
|
1320
|
+
"is-pin-edge": r.pinEdge
|
|
1321
|
+
}
|
|
1322
|
+
],
|
|
1323
|
+
style: {
|
|
1324
|
+
...r.pinned === "start" ? { left: `var(${r.offsetVar})` } : r.pinned === "end" ? { right: `var(${r.offsetVar})` } : null,
|
|
1325
|
+
...f(o, l)
|
|
1326
|
+
},
|
|
1327
|
+
role: "gridcell",
|
|
1328
|
+
tabindex: h ? 0 : -1,
|
|
1329
|
+
"aria-readonly": u ? void 0 : "true",
|
|
1330
|
+
"aria-selected": v ? "true" : void 0,
|
|
1331
|
+
"aria-describedby": w,
|
|
1332
|
+
"aria-invalid": d?.level === "error" ? "true" : void 0,
|
|
1333
|
+
"data-col": c,
|
|
1334
|
+
"data-dt-tip": p && !d && !x && !e.isNew ? n("sheet.was", { value: m(o, e.row, e.original(e.row, o), e.env) }) : void 0
|
|
1335
|
+
}, C);
|
|
1336
|
+
}, i = () => {
|
|
1337
|
+
let t = !!e.rowError;
|
|
1338
|
+
for (let n of e.issues?.values() ?? []) n.level === "error" && (t = !0);
|
|
1339
|
+
let r = !!e.draft?.size;
|
|
1340
|
+
return R("div", {
|
|
1341
|
+
class: [
|
|
1342
|
+
"dt-cell",
|
|
1343
|
+
"dt-gutter",
|
|
1344
|
+
"is-pinned-start"
|
|
1345
|
+
],
|
|
1346
|
+
style: { left: "0px" },
|
|
1347
|
+
role: "rowheader",
|
|
1348
|
+
"data-dt-tip": e.rowError
|
|
1349
|
+
}, [t ? R(Ze, {
|
|
1350
|
+
size: 13,
|
|
1351
|
+
class: "dt-mark is-error",
|
|
1352
|
+
role: "img",
|
|
1353
|
+
"aria-label": n("sheet.hasErrors")
|
|
1354
|
+
}) : e.isNew ? R(qe, {
|
|
1355
|
+
size: 13,
|
|
1356
|
+
class: "dt-mark is-new",
|
|
1357
|
+
role: "img",
|
|
1358
|
+
"aria-label": n("sheet.tag.new")
|
|
1359
|
+
}) : r ? R("span", {
|
|
1360
|
+
class: "dt-mark is-changed",
|
|
1361
|
+
role: "img",
|
|
1362
|
+
"aria-label": n("sheet.changed")
|
|
1363
|
+
}) : null, R("span", { class: "dt-gutter-no" }, String(e.rowNo))]);
|
|
1364
|
+
};
|
|
1365
|
+
return () => {
|
|
1366
|
+
let t = new Map(e.columns.map((e, t) => [e.id, t]));
|
|
1367
|
+
return R("div", {
|
|
1368
|
+
class: ["dt-row", { "is-active-row": e.active !== null }],
|
|
1369
|
+
role: "row",
|
|
1370
|
+
"aria-rowindex": e.index + 2,
|
|
1371
|
+
"data-index": e.index,
|
|
1372
|
+
style: e.style
|
|
1373
|
+
}, [e.gutter ? i() : null, ...T(e.columns, (e) => r(e, t.get(e.id)))]);
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
}), ri = [
|
|
1377
|
+
"aria-label",
|
|
1378
|
+
"aria-rowcount",
|
|
1379
|
+
"aria-colcount",
|
|
1380
|
+
"aria-busy",
|
|
1381
|
+
"aria-readonly",
|
|
1382
|
+
"data-density"
|
|
1383
|
+
], ii = {
|
|
1384
|
+
class: "dt-head",
|
|
1385
|
+
role: "row",
|
|
1386
|
+
"aria-rowindex": "1"
|
|
1387
|
+
}, ai = {
|
|
1388
|
+
key: 0,
|
|
1389
|
+
class: "dt-head-cell dt-gutter is-pinned-start",
|
|
1390
|
+
style: { left: "0px" },
|
|
1391
|
+
role: "columnheader"
|
|
1392
|
+
}, oi = ["aria-sort", "data-col"], si = [
|
|
1393
|
+
"data-dt-tip",
|
|
1394
|
+
"aria-describedby",
|
|
1395
|
+
"onClick"
|
|
1396
|
+
], ci = { class: "dt-head-text" }, li = ["aria-label"], ui = {
|
|
1397
|
+
key: 1,
|
|
1398
|
+
class: "dt-head-unit"
|
|
1399
|
+
}, di = {
|
|
1400
|
+
key: 2,
|
|
1401
|
+
class: "dt-head-sort",
|
|
1402
|
+
"aria-hidden": "true"
|
|
1403
|
+
}, fi = {
|
|
1404
|
+
key: 0,
|
|
1405
|
+
class: "dt-head-sort-index"
|
|
1406
|
+
}, pi = ["id"], mi = ["onMousedown", "onTouchstartPassive"], hi = {
|
|
1407
|
+
key: 0,
|
|
1408
|
+
class: "dt-resize-badge"
|
|
1409
|
+
}, gi = ["data-index"], _i = {
|
|
1410
|
+
key: 1,
|
|
1411
|
+
class: "dt-body-state"
|
|
1412
|
+
}, vi = 56, yi = 24, bi = 12, xi = /* @__PURE__ */ L({
|
|
1413
|
+
__name: "SheetGrid",
|
|
1414
|
+
props: {
|
|
1415
|
+
sheet: {},
|
|
1416
|
+
layout: {},
|
|
1417
|
+
rows: {},
|
|
1418
|
+
density: { default: "compact" },
|
|
1419
|
+
label: {},
|
|
1420
|
+
loading: {
|
|
1421
|
+
type: Boolean,
|
|
1422
|
+
default: !1
|
|
1423
|
+
},
|
|
1424
|
+
skeleton: {
|
|
1425
|
+
type: Boolean,
|
|
1426
|
+
default: !1
|
|
1427
|
+
},
|
|
1428
|
+
verticalLines: {
|
|
1429
|
+
type: Boolean,
|
|
1430
|
+
default: !0
|
|
1431
|
+
},
|
|
1432
|
+
keyColumn: {},
|
|
1433
|
+
found: { default: null },
|
|
1434
|
+
readOnly: {
|
|
1435
|
+
type: Boolean,
|
|
1436
|
+
default: !1
|
|
1437
|
+
},
|
|
1438
|
+
sort: {},
|
|
1439
|
+
entity: {},
|
|
1440
|
+
phone: {
|
|
1441
|
+
type: Boolean,
|
|
1442
|
+
default: !1
|
|
1443
|
+
}
|
|
1444
|
+
},
|
|
1445
|
+
setup(t, { expose: i }) {
|
|
1446
|
+
let a = t, o = ce(), c = Se(), l = V(null), u = V(null), d = a.layout, f = a.sheet, p = f.table, m = f.store, g = m.keyOf, _ = typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches, v = A(() => _ && a.density === "compact" ? "standard" : a.density), y = A(() => a.phone ? 0 : vi);
|
|
1447
|
+
ke(() => {
|
|
1448
|
+
let e = l.value;
|
|
1449
|
+
if (!e) return;
|
|
1450
|
+
let t = y.value;
|
|
1451
|
+
e.style.setProperty("--cols", `${t ? `${t}px ` : ""}${d.colsVar.value}`), e.style.setProperty("--dt-min-w", `${d.minWidth.value + t}px`);
|
|
1452
|
+
let n = new Set(d.start.value.map((e) => e.offsetVar));
|
|
1453
|
+
for (let [r, i] of Object.entries(d.offsetVars.value)) e.style.setProperty(r, n.has(r) ? `${parseFloat(i) + t}px` : i);
|
|
1454
|
+
}, { flush: "sync" });
|
|
1455
|
+
let x = V(32), S = V(32), ee = V(0), C = () => {
|
|
1456
|
+
let e = u.value;
|
|
1457
|
+
ee.value = e ? Math.max(0, e.offsetHeight - e.clientHeight) : 0;
|
|
1458
|
+
}, w = () => {
|
|
1459
|
+
let e = l.value ? parseFloat(getComputedStyle(l.value).getPropertyValue("--dt-row-h")) : NaN;
|
|
1460
|
+
x.value = Number.isFinite(e) ? e : 32, S.value = l.value?.querySelector(".dt-head")?.offsetHeight ?? S.value, C();
|
|
1461
|
+
};
|
|
1462
|
+
ge(w), Oe(v, () => requestAnimationFrame(w));
|
|
1463
|
+
let te = new h(), ne = A(() => ({
|
|
1464
|
+
fmt: e(o.locale),
|
|
1465
|
+
i18n: o.i18n,
|
|
1466
|
+
today: /* @__PURE__ */ new Date(),
|
|
1467
|
+
labels: te,
|
|
1468
|
+
density: v.value,
|
|
1469
|
+
coarse: _
|
|
1470
|
+
})), T = A(() => d.columns.value), re = A(() => new Map(T.value.map((e) => [e.id, e.def]))), D = A(() => {
|
|
1471
|
+
let e = /* @__PURE__ */ new Map();
|
|
1472
|
+
return a.rows.forEach((t, n) => e.set(g(t), n)), e;
|
|
1473
|
+
}), ie = p.active, ae = A(() => ie.value ? D.value.get(ie.value.rowId) ?? -1 : -1), se = A(() => {
|
|
1474
|
+
let e = p.bounds.value;
|
|
1475
|
+
return !!e && (e.maxRowIndex > e.minRowIndex || e.maxColumnIndex > e.minColumnIndex);
|
|
1476
|
+
}), O = (e) => {
|
|
1477
|
+
let t = p.bounds.value;
|
|
1478
|
+
return !t || !se.value || e < t.minRowIndex || e > t.maxRowIndex ? null : {
|
|
1479
|
+
from: t.minColumnIndex,
|
|
1480
|
+
to: t.maxColumnIndex,
|
|
1481
|
+
top: e === t.minRowIndex,
|
|
1482
|
+
bottom: e === t.maxRowIndex
|
|
1483
|
+
};
|
|
1484
|
+
}, le = (e) => {
|
|
1485
|
+
let t = p.bounds.value;
|
|
1486
|
+
return !t || Z.value || a.phone ? null : se.value ? e === t.maxRowIndex ? T.value[t.maxColumnIndex]?.id ?? null : null : e === ae.value ? ie.value?.columnId ?? null : null;
|
|
1487
|
+
}, F = (e) => {
|
|
1488
|
+
let t = f.edit.editing.value, n = a.rows[e];
|
|
1489
|
+
return t && n && g(t.row) === g(n) ? {
|
|
1490
|
+
columnId: t.def.id,
|
|
1491
|
+
value: t.value,
|
|
1492
|
+
inCell: t.inCell
|
|
1493
|
+
} : null;
|
|
1494
|
+
}, L = (e) => {
|
|
1495
|
+
let t = a.rows[e];
|
|
1496
|
+
return t ? a.found?.get(g(t)) : void 0;
|
|
1497
|
+
}, R = A(() => a.skeleton ? 24 : a.rows.length), z = tn(A(() => ({
|
|
1498
|
+
count: R.value,
|
|
1499
|
+
getScrollElement: () => u.value,
|
|
1500
|
+
estimateSize: () => x.value + 1,
|
|
1501
|
+
scrollMargin: S.value,
|
|
1502
|
+
scrollPaddingStart: S.value,
|
|
1503
|
+
scrollPaddingEnd: ee.value,
|
|
1504
|
+
overscan: 10,
|
|
1505
|
+
getItemKey: (e) => a.skeleton ? `sk-${e}` : g(a.rows[e]),
|
|
1506
|
+
rangeExtractor: (e) => {
|
|
1507
|
+
let t = Math.max(0, e.startIndex - e.overscan), n = Math.min(e.count - 1, e.endIndex + e.overscan), r = [], i = a.skeleton ? -1 : ae.value;
|
|
1508
|
+
i >= 0 && i < t && r.push(i);
|
|
1509
|
+
for (let e = t; e <= n; e++) r.push(e);
|
|
1510
|
+
return i > n && i < e.count && r.push(i), r;
|
|
1511
|
+
}
|
|
1512
|
+
}))), ue = A(() => z.value.getVirtualItems()), de = A(() => z.value.getTotalSize());
|
|
1513
|
+
Oe(x, () => z.value.measure());
|
|
1514
|
+
let _e = U(!1), H = () => {
|
|
1515
|
+
C(), _e.value = (u.value?.scrollLeft ?? 0) > 0;
|
|
1516
|
+
}, be = (e, t) => {
|
|
1517
|
+
let n = l.value?.querySelector(`.dt-row[data-index="${e}"]`);
|
|
1518
|
+
if (!n) return null;
|
|
1519
|
+
for (let e of n.querySelectorAll(".dt-cell[data-col]")) if (e.dataset.col === t) return e;
|
|
1520
|
+
return null;
|
|
1521
|
+
}, xe = () => {
|
|
1522
|
+
let e = 0;
|
|
1523
|
+
for (let t of l.value?.querySelectorAll(".dt-head .is-pinned-start") ?? []) e += t.offsetWidth;
|
|
1524
|
+
return e;
|
|
1525
|
+
}, G = (e) => {
|
|
1526
|
+
let t = u.value;
|
|
1527
|
+
if (!t || e.classList.contains("is-pinned-start")) return;
|
|
1528
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = r.left + xe();
|
|
1529
|
+
n.left < i ? t.scrollLeft -= i - n.left : n.right > r.right && (t.scrollLeft += n.right - r.right);
|
|
1530
|
+
}, Ce = () => {
|
|
1531
|
+
let e = p.rangeEnd.value, t = e ? D.value.get(e.rowId) : void 0;
|
|
1532
|
+
e && t !== void 0 && (z.value.scrollToIndex(t, { align: "auto" }), requestAnimationFrame(() => {
|
|
1533
|
+
let n = be(t, e.columnId);
|
|
1534
|
+
n && G(n);
|
|
1535
|
+
}));
|
|
1536
|
+
}, we = () => void fe(() => Te(0)), Te = (e) => {
|
|
1537
|
+
let t = ie.value;
|
|
1538
|
+
if (!t || f.edit.editing.value?.inCell) return;
|
|
1539
|
+
let n = D.value.get(t.rowId);
|
|
1540
|
+
if (n === void 0) {
|
|
1541
|
+
e < 3 && requestAnimationFrame(() => Te(e + 1));
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
z.value.scrollToIndex(n, { align: "auto" });
|
|
1545
|
+
let r = (e) => {
|
|
1546
|
+
let i = be(n, t.columnId);
|
|
1547
|
+
i ? (i.focus({ preventScroll: !0 }), G(i)) : e < 3 && requestAnimationFrame(() => r(e + 1));
|
|
1548
|
+
};
|
|
1549
|
+
r(0);
|
|
1550
|
+
}, Ee = (e, t) => {
|
|
1551
|
+
let n = a.rows[Math.max(0, Math.min(a.rows.length - 1, e))];
|
|
1552
|
+
n && (p.focus(g(n), t), we());
|
|
1553
|
+
}, De = (e) => {
|
|
1554
|
+
let t = ie.value;
|
|
1555
|
+
if (!t) return;
|
|
1556
|
+
let n = T.value, r = n.findIndex((e) => e.id === t.columnId), i = ae.value;
|
|
1557
|
+
e === "right" ? r < n.length - 1 ? p.move("right") : i < a.rows.length - 1 && p.focus(g(a.rows[i + 1]), n[0].id) : r > 0 ? p.move("left") : i > 0 && p.focus(g(a.rows[i - 1]), n[n.length - 1].id), we();
|
|
1558
|
+
}, Ae = (e) => {
|
|
1559
|
+
let t = ie.value, n = T.value;
|
|
1560
|
+
if (e === "left") p.focus(t.rowId, n[0].id);
|
|
1561
|
+
else if (e === "right") p.focus(t.rowId, n[n.length - 1].id);
|
|
1562
|
+
else {
|
|
1563
|
+
let n = a.rows[e === "up" ? 0 : a.rows.length - 1];
|
|
1564
|
+
n && p.focus(g(n), t.columnId);
|
|
1565
|
+
}
|
|
1566
|
+
}, je = () => Math.max(1, Math.floor((u.value?.clientHeight ?? 0) / (x.value + 1)) - 1), J = {
|
|
1567
|
+
ArrowUp: "up",
|
|
1568
|
+
ArrowDown: "down",
|
|
1569
|
+
ArrowLeft: "left",
|
|
1570
|
+
ArrowRight: "right"
|
|
1571
|
+
}, Me = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform), Ne = (e) => {
|
|
1572
|
+
let t = e.target, r = f.edit.editing.value;
|
|
1573
|
+
if (r?.inCell) {
|
|
1574
|
+
if (e.key === "Tab") {
|
|
1575
|
+
e.preventDefault(), f.edit.commit(), De(e.shiftKey ? "left" : "right");
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1578
|
+
if (e.key === "Escape" && r.def.type === "multiselect" && !r.def.editor) {
|
|
1579
|
+
e.preventDefault(), f.edit.commit(), we();
|
|
1580
|
+
return;
|
|
1581
|
+
}
|
|
1582
|
+
if (e.defaultPrevented || t.getAttribute("aria-expanded") === "true" || t.tagName === "BUTTON") return;
|
|
1583
|
+
e.key === "Enter" && !(e.shiftKey && t.tagName === "TEXTAREA") ? (e.preventDefault(), f.edit.commit(), p.move("down"), we()) : e.key === "Escape" && (e.preventDefault(), f.edit.cancel(), we());
|
|
1584
|
+
return;
|
|
1585
|
+
}
|
|
1586
|
+
let i = t.closest(".dt-cell[data-col]");
|
|
1587
|
+
if (!i) return;
|
|
1588
|
+
if (t !== i) {
|
|
1589
|
+
e.key === "Escape" && (e.preventDefault(), i.focus());
|
|
1590
|
+
return;
|
|
1591
|
+
}
|
|
1592
|
+
let o = ie.value, s = a.rows[ae.value], c = o ? re.value.get(o.columnId) : void 0;
|
|
1593
|
+
if (!o || !s || !c) return;
|
|
1594
|
+
let l = f.canEdit(s, c), u = e.metaKey || e.ctrlKey, d = J[e.key];
|
|
1595
|
+
if (d) {
|
|
1596
|
+
if (e.preventDefault(), e.shiftKey) {
|
|
1597
|
+
p.extend(d), fe(Ce);
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
u ? Ae(d) : p.move(d), we();
|
|
1601
|
+
} else {
|
|
1602
|
+
switch (e.key) {
|
|
1603
|
+
case "Tab":
|
|
1604
|
+
e.preventDefault(), De(e.shiftKey ? "left" : "right");
|
|
1605
|
+
return;
|
|
1606
|
+
case "Enter": {
|
|
1607
|
+
e.preventDefault();
|
|
1608
|
+
let t = l ? null : i.querySelector(n);
|
|
1609
|
+
t ? t.focus() : (p.move("down"), we());
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1612
|
+
case "F2":
|
|
1613
|
+
e.preventDefault(), f.edit.start(s, c, { inCell: !0 });
|
|
1614
|
+
return;
|
|
1615
|
+
case "Escape":
|
|
1616
|
+
e.preventDefault(), p.focus(o.rowId, o.columnId);
|
|
1617
|
+
return;
|
|
1618
|
+
case " ":
|
|
1619
|
+
e.preventDefault(), c.type === "boolean" && l && f.toggle(s, c);
|
|
1620
|
+
return;
|
|
1621
|
+
case "Delete":
|
|
1622
|
+
case "Backspace":
|
|
1623
|
+
e.preventDefault(), f.clearCells();
|
|
1624
|
+
return;
|
|
1625
|
+
case "Home":
|
|
1626
|
+
e.preventDefault(), Ee(u ? 0 : ae.value, T.value[0].id);
|
|
1627
|
+
return;
|
|
1628
|
+
case "End":
|
|
1629
|
+
e.preventDefault(), Ee(u ? a.rows.length - 1 : ae.value, T.value[T.value.length - 1].id);
|
|
1630
|
+
return;
|
|
1631
|
+
case "PageDown":
|
|
1632
|
+
e.preventDefault(), Ee(ae.value + je(), o.columnId);
|
|
1633
|
+
return;
|
|
1634
|
+
case "PageUp":
|
|
1635
|
+
e.preventDefault(), Ee(ae.value - je(), o.columnId);
|
|
1636
|
+
return;
|
|
1637
|
+
case "F8":
|
|
1638
|
+
e.preventDefault(), f.goToError(e.shiftKey ? -1 : 1);
|
|
1639
|
+
return;
|
|
1640
|
+
case "ContextMenu":
|
|
1641
|
+
case "F10":
|
|
1642
|
+
if (e.key === "F10" && !e.shiftKey) return;
|
|
1643
|
+
e.preventDefault(), Qe(i);
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
if (u) {
|
|
1647
|
+
let t = e.key.toLowerCase();
|
|
1648
|
+
t === "a" && !e.shiftKey ? (e.preventDefault(), p.selectAll()) : t === "s" ? (e.preventDefault(), f.save()) : t === "d" && !e.shiftKey ? (e.preventDefault(), f.fillDown()) : t === "z" && !e.shiftKey ? (e.preventDefault(), f.undo()) : t === "z" && e.shiftKey || t === "y" && !Me ? (e.preventDefault(), f.redo()) : (e.key === "-" || e.key === "Subtract") && (e.preventDefault(), f.removeSelectedRows());
|
|
1649
|
+
} else e.key.length === 1 && !e.altKey && l && (e.preventDefault(), f.edit.start(s, c, {
|
|
1650
|
+
inCell: !0,
|
|
1651
|
+
replace: e.key
|
|
1652
|
+
}));
|
|
1653
|
+
}
|
|
1654
|
+
}, Pe = (e, t) => {
|
|
1655
|
+
f.edit.editing.value?.inCell || r(e.target) || e.target.closest(".dt-cell[data-col]") && f[t](e.clipboardData) && e.preventDefault();
|
|
1656
|
+
}, Fe = (e) => {
|
|
1657
|
+
let t = e?.closest(".dt-cell[data-col]"), n = e?.closest(".dt-row[data-index]");
|
|
1658
|
+
if (!t || !n || a.skeleton) return null;
|
|
1659
|
+
let r = Number(n.dataset.index), i = a.rows[r];
|
|
1660
|
+
return i ? {
|
|
1661
|
+
index: r,
|
|
1662
|
+
row: i,
|
|
1663
|
+
columnId: t.dataset.col,
|
|
1664
|
+
cell: t,
|
|
1665
|
+
target: e
|
|
1666
|
+
} : null;
|
|
1667
|
+
}, Ie = (e) => Fe(e.target), X = U(null), Z = U(null), Le = U(null), Re = {
|
|
1668
|
+
x: 0,
|
|
1669
|
+
y: 0
|
|
1670
|
+
}, ze = 0, Be = (e) => {
|
|
1671
|
+
if (e) {
|
|
1672
|
+
if (X.value === "fill") {
|
|
1673
|
+
let t = Z.value, n = e.index > t.toRow || e.index < t.fromRow ? e.index : t.toRow;
|
|
1674
|
+
n !== t.target && (Z.value = {
|
|
1675
|
+
...t,
|
|
1676
|
+
target: n
|
|
1677
|
+
}, Ue());
|
|
1678
|
+
} else p.extendHandler(g(e.row), e.columnId)?.(new MouseEvent("mouseover"));
|
|
1679
|
+
}
|
|
1680
|
+
}, Ve = () => {
|
|
1681
|
+
ze = 0;
|
|
1682
|
+
let e = u.value;
|
|
1683
|
+
if (!X.value || !e) return;
|
|
1684
|
+
let t = e.getBoundingClientRect(), n = 0;
|
|
1685
|
+
Re.y < t.top + yi ? n = -12 : Re.y > t.bottom - yi && (n = bi);
|
|
1686
|
+
let r = 0;
|
|
1687
|
+
X.value === "select" && (Re.x < t.left + xe() + yi ? r = -12 : Re.x > t.right - yi && (r = bi)), (n || r) && (e.scrollTop += n, e.scrollLeft += r, Be(Fe(document.elementFromPoint(Re.x, Re.y))), ze = requestAnimationFrame(Ve));
|
|
1688
|
+
}, He = (e) => {
|
|
1689
|
+
X.value && (Re = {
|
|
1690
|
+
x: e.clientX,
|
|
1691
|
+
y: e.clientY
|
|
1692
|
+
}, X.value === "fill" && Be(Ie(e)), ze ||= requestAnimationFrame(Ve));
|
|
1693
|
+
}, Ue = () => {
|
|
1694
|
+
let e = Z.value;
|
|
1695
|
+
if (!e || e.target === e.toRow) {
|
|
1696
|
+
Le.value = null;
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
let t = (e.target, e.toRow, e.target), n = be(t, T.value[e.cols[1]].id), r = l.value?.getBoundingClientRect();
|
|
1700
|
+
if (!n || !r) {
|
|
1701
|
+
Le.value = null;
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
let i = n.getBoundingClientRect();
|
|
1705
|
+
Le.value = {
|
|
1706
|
+
left: i.right - r.left + 10,
|
|
1707
|
+
top: i.bottom - r.top - 13,
|
|
1708
|
+
text: f.fillLabel(e.fromRow, e.toRow, e.cols, e.target)
|
|
1709
|
+
};
|
|
1710
|
+
}, We = () => {
|
|
1711
|
+
if (X.value === "fill" && Z.value) {
|
|
1712
|
+
let e = Z.value;
|
|
1713
|
+
e.target !== e.toRow && f.fill(e.fromRow, e.toRow, e.cols, e.target), Z.value = null, Le.value = null, we();
|
|
1714
|
+
}
|
|
1715
|
+
X.value = null, cancelAnimationFrame(ze), ze = 0;
|
|
1716
|
+
};
|
|
1717
|
+
ge(() => document.addEventListener("mouseup", We)), he(() => {
|
|
1718
|
+
document.removeEventListener("mouseup", We), cancelAnimationFrame(ze);
|
|
1719
|
+
});
|
|
1720
|
+
let Ke = -1, qe = (e) => {
|
|
1721
|
+
if (e.button !== 0) return;
|
|
1722
|
+
let t = e.target, n = (l.value?.querySelector(".dt-fill-handle"))?.getBoundingClientRect();
|
|
1723
|
+
if (n && e.clientX >= n.left - 2 && e.clientX <= n.right + 2 && e.clientY >= n.top - 2 && e.clientY <= n.bottom + 2) {
|
|
1724
|
+
let t = p.bounds.value;
|
|
1725
|
+
if (!t) return;
|
|
1726
|
+
e.preventDefault(), f.edit.commit(), Z.value = {
|
|
1727
|
+
fromRow: t.minRowIndex,
|
|
1728
|
+
toRow: t.maxRowIndex,
|
|
1729
|
+
cols: [t.minColumnIndex, t.maxColumnIndex],
|
|
1730
|
+
target: t.maxRowIndex
|
|
1731
|
+
}, X.value = "fill", Re = {
|
|
1732
|
+
x: e.clientX,
|
|
1733
|
+
y: e.clientY
|
|
1734
|
+
};
|
|
1735
|
+
return;
|
|
1736
|
+
}
|
|
1737
|
+
let r = t.closest(".dt-row[data-index]");
|
|
1738
|
+
if (t.closest(".dt-gutter") && r && !a.skeleton) {
|
|
1739
|
+
e.preventDefault();
|
|
1740
|
+
let t = Number(r.dataset.index), n = T.value, i = e.shiftKey && Ke >= 0 ? Ke : t;
|
|
1741
|
+
Ke = i, f.edit.commit(), p.selectRange({
|
|
1742
|
+
anchorRowId: g(a.rows[i]),
|
|
1743
|
+
anchorColumnId: n[0].id,
|
|
1744
|
+
focusRowId: g(a.rows[t]),
|
|
1745
|
+
focusColumnId: n[n.length - 1].id
|
|
1746
|
+
}), we();
|
|
1747
|
+
return;
|
|
1748
|
+
}
|
|
1749
|
+
let i = Ie(e);
|
|
1750
|
+
i && (Ke = -1, !(f.edit.editing.value?.inCell && i.cell.classList.contains("is-editing")) && (f.edit.commit(), a.phone ? p.focus(g(i.row), i.columnId) : (oe(i.target, i.cell) || e.preventDefault(), p.startHandler(g(i.row), i.columnId)?.(e), X.value = "select", Re = {
|
|
1751
|
+
x: e.clientX,
|
|
1752
|
+
y: e.clientY
|
|
1753
|
+
}, i.cell.focus({ preventScroll: !0 }))));
|
|
1754
|
+
}, Je = (e) => {
|
|
1755
|
+
if (X.value === "fill") return;
|
|
1756
|
+
let t = Ie(e);
|
|
1757
|
+
t && p.extendHandler(g(t.row), t.columnId)?.(e);
|
|
1758
|
+
}, Ye = (e) => {
|
|
1759
|
+
let t = Ie(e);
|
|
1760
|
+
if (!t || oe(t.target, t.cell)) return;
|
|
1761
|
+
let n = re.value.get(t.columnId);
|
|
1762
|
+
n && (n.type === "boolean" && !n.editor ? f.canEdit(t.row, n) && f.toggle(t.row, n) : f.edit.start(t.row, n, { inCell: !0 }));
|
|
1763
|
+
}, Xe = (e) => {
|
|
1764
|
+
let t = Z.value;
|
|
1765
|
+
if (!t || t.target === t.toRow) return null;
|
|
1766
|
+
let n = t.target > t.toRow;
|
|
1767
|
+
return (n ? e > t.toRow && e <= t.target : e < t.fromRow && e >= t.target) ? {
|
|
1768
|
+
from: t.cols[0],
|
|
1769
|
+
to: t.cols[1],
|
|
1770
|
+
last: n ? e === t.target : e === t.fromRow - 1
|
|
1771
|
+
} : null;
|
|
1772
|
+
}, Ze = (e) => {
|
|
1773
|
+
let t = Ie(e);
|
|
1774
|
+
if (!t || a.skeleton) {
|
|
1775
|
+
e.stopPropagation();
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1778
|
+
let n = p.bounds.value, r = T.value.findIndex((e) => e.id === t.columnId);
|
|
1779
|
+
n && t.index >= n.minRowIndex && t.index <= n.maxRowIndex && r >= n.minColumnIndex && r <= n.maxColumnIndex || (f.edit.commit(), p.focus(g(t.row), t.columnId), t.cell.focus({ preventScroll: !0 }));
|
|
1780
|
+
}, Qe = (e) => {
|
|
1781
|
+
let t = e.getBoundingClientRect();
|
|
1782
|
+
e.dispatchEvent(new MouseEvent("contextmenu", {
|
|
1783
|
+
bubbles: !0,
|
|
1784
|
+
cancelable: !0,
|
|
1785
|
+
clientX: t.left + 8,
|
|
1786
|
+
clientY: t.bottom - 4
|
|
1787
|
+
}));
|
|
1788
|
+
}, Q = A(() => {
|
|
1789
|
+
let e = a.rows[ae.value];
|
|
1790
|
+
return e ? f.openHref(e) : void 0;
|
|
1791
|
+
}), $e = (e) => a.sort?.get(e), $ = (e) => typeof e.unit == "string" ? e.unit : void 0, et = (e) => {
|
|
1792
|
+
let t = e.id === a.keyColumn ? o.i18n.t("sheet.keyTooltip", { key: e.def.header }) : void 0;
|
|
1793
|
+
return e.def.description ? `${t ?? e.def.header}\n${e.def.description}` : t;
|
|
1794
|
+
}, tt = (e, t) => {
|
|
1795
|
+
let n = t.currentTarget.parentElement;
|
|
1796
|
+
d.setWidth(e.id, n.getBoundingClientRect().width), e.header.getResizeHandler()(t);
|
|
1797
|
+
}, nt = o.i18n.t("sheet.required").toLocaleLowerCase(o.locale);
|
|
1798
|
+
return i({
|
|
1799
|
+
focusActive: we,
|
|
1800
|
+
scrollToIndex: (e) => z.value.scrollToIndex(e)
|
|
1801
|
+
}), (e, n) => (B(), j(K(jt), null, {
|
|
1802
|
+
default: q(() => [I(K(Nt), { "as-child": "" }, {
|
|
1803
|
+
default: q(() => [P("div", {
|
|
1804
|
+
ref_key: "root",
|
|
1805
|
+
ref: l,
|
|
1806
|
+
class: pe(["dt-grid dt-sheet-grid", {
|
|
1807
|
+
"is-scrolled-start": _e.value,
|
|
1808
|
+
"is-skeleton": t.skeleton,
|
|
1809
|
+
"has-vlines": t.verticalLines,
|
|
1810
|
+
"is-filling": X.value === "fill",
|
|
1811
|
+
"is-phone": t.phone
|
|
1812
|
+
}]),
|
|
1813
|
+
role: "grid",
|
|
1814
|
+
"aria-label": t.label,
|
|
1815
|
+
"aria-rowcount": t.skeleton ? -1 : t.rows.length,
|
|
1816
|
+
"aria-colcount": T.value.length + +!t.phone,
|
|
1817
|
+
"aria-busy": t.loading || t.readOnly ? "true" : void 0,
|
|
1818
|
+
"aria-readonly": t.readOnly ? "true" : void 0,
|
|
1819
|
+
"data-density": v.value,
|
|
1820
|
+
onKeydown: Ne,
|
|
1821
|
+
onMousedown: qe,
|
|
1822
|
+
onMousemove: He,
|
|
1823
|
+
onMouseover: Je,
|
|
1824
|
+
onDblclick: Ye,
|
|
1825
|
+
onContextmenuCapture: Ze,
|
|
1826
|
+
onCopy: n[1] ||= (e) => Pe(e, "copy"),
|
|
1827
|
+
onCut: n[2] ||= (e) => Pe(e, "cut"),
|
|
1828
|
+
onPaste: n[3] ||= (e) => Pe(e, "paste")
|
|
1829
|
+
}, [
|
|
1830
|
+
P("div", {
|
|
1831
|
+
ref_key: "scrollEl",
|
|
1832
|
+
ref: u,
|
|
1833
|
+
class: "dt-scroll",
|
|
1834
|
+
onScrollPassive: H
|
|
1835
|
+
}, [P("div", ii, [
|
|
1836
|
+
t.phone ? M("", !0) : (B(), N("div", ai, W(K(o).i18n.t("sheet.err.row")), 1)),
|
|
1837
|
+
(B(!0), N(k, null, ve(T.value, (e) => (B(), N("div", {
|
|
1838
|
+
key: e.id,
|
|
1839
|
+
class: pe(["dt-head-cell", [`is-${K(s)(e.def)}`, {
|
|
1840
|
+
"is-numeric": K(E)(e.def.type),
|
|
1841
|
+
"is-key": e.id === t.keyColumn,
|
|
1842
|
+
"is-pinned-start": e.pinned === "start",
|
|
1843
|
+
"is-pin-edge": e.pinEdge,
|
|
1844
|
+
"is-resizing": K(d).resizing.value?.id === e.id
|
|
1845
|
+
}]]),
|
|
1846
|
+
style: me(e.pinned === "start" ? { left: `var(${e.offsetVar})` } : void 0),
|
|
1847
|
+
role: "columnheader",
|
|
1848
|
+
"aria-sort": $e(e.id)?.dir === "asc" ? "ascending" : $e(e.id)?.dir === "desc" ? "descending" : void 0,
|
|
1849
|
+
"data-col": e.id
|
|
1850
|
+
}, [
|
|
1851
|
+
e.id === t.keyColumn ? (B(), j(K(Ge), {
|
|
1852
|
+
key: 0,
|
|
1853
|
+
size: 12,
|
|
1854
|
+
class: "dt-head-lock",
|
|
1855
|
+
"aria-hidden": "true"
|
|
1856
|
+
})) : M("", !0),
|
|
1857
|
+
P("button", {
|
|
1858
|
+
type: "button",
|
|
1859
|
+
class: "dt-head-label",
|
|
1860
|
+
tabindex: "-1",
|
|
1861
|
+
"data-dt-tip": et(e),
|
|
1862
|
+
"aria-describedby": e.def.description ? `${K(c)}-desc-${e.id}` : void 0,
|
|
1863
|
+
onClick: (t) => K(f).sort(e.id, t.shiftKey)
|
|
1864
|
+
}, [
|
|
1865
|
+
P("span", ci, W(e.def.header), 1),
|
|
1866
|
+
e.def.required ? (B(), N("span", {
|
|
1867
|
+
key: 0,
|
|
1868
|
+
class: "dt-head-required",
|
|
1869
|
+
"aria-label": K(nt)
|
|
1870
|
+
}, "*", 8, li)) : M("", !0),
|
|
1871
|
+
$(e.def) ? (B(), N("span", ui, W($(e.def)), 1)) : M("", !0),
|
|
1872
|
+
$e(e.id) ? (B(), N("span", di, [I(K(Y), {
|
|
1873
|
+
size: 12,
|
|
1874
|
+
class: pe({ "is-desc": $e(e.id).dir === "desc" })
|
|
1875
|
+
}, null, 8, ["class"]), $e(e.id).index ? (B(), N("span", fi, W($e(e.id).index), 1)) : M("", !0)])) : M("", !0)
|
|
1876
|
+
], 8, si),
|
|
1877
|
+
e.def.description ? (B(), N("span", {
|
|
1878
|
+
key: 1,
|
|
1879
|
+
id: `${K(c)}-desc-${e.id}`,
|
|
1880
|
+
class: "dt-sr-only"
|
|
1881
|
+
}, W(e.def.description), 9, pi)) : M("", !0),
|
|
1882
|
+
n[4] ||= P("span", {
|
|
1883
|
+
class: "dt-head-sep",
|
|
1884
|
+
"aria-hidden": "true"
|
|
1885
|
+
}, null, -1),
|
|
1886
|
+
P("span", {
|
|
1887
|
+
class: "dt-resize",
|
|
1888
|
+
"aria-hidden": "true",
|
|
1889
|
+
onMousedown: (t) => tt(e, t),
|
|
1890
|
+
onTouchstartPassive: (t) => tt(e, t)
|
|
1891
|
+
}, [K(d).resizing.value?.id === e.id ? (B(), N("span", hi, W(Math.round(K(d).resizing.value.size)) + " px ", 1)) : M("", !0)], 40, mi)
|
|
1892
|
+
], 14, oi))), 128)),
|
|
1893
|
+
n[5] ||= P("div", {
|
|
1894
|
+
class: "dt-head-cell dt-cell-fill",
|
|
1895
|
+
role: "presentation",
|
|
1896
|
+
"aria-hidden": "true"
|
|
1897
|
+
}, null, -1)
|
|
1898
|
+
]), P("div", {
|
|
1899
|
+
class: "dt-body",
|
|
1900
|
+
role: "presentation",
|
|
1901
|
+
style: me({ height: `${de.value}px` })
|
|
1902
|
+
}, [(B(!0), N(k, null, ve(ue.value, (e) => (B(), N("div", {
|
|
1903
|
+
key: String(e.key),
|
|
1904
|
+
class: "dt-item",
|
|
1905
|
+
"data-index": e.index,
|
|
1906
|
+
style: me({ transform: `translateY(${e.start - S.value}px)` })
|
|
1907
|
+
}, [t.skeleton ? (B(), j(K(b), {
|
|
1908
|
+
key: 0,
|
|
1909
|
+
index: e.index,
|
|
1910
|
+
columns: T.value,
|
|
1911
|
+
gutter: !t.phone
|
|
1912
|
+
}, null, 8, [
|
|
1913
|
+
"index",
|
|
1914
|
+
"columns",
|
|
1915
|
+
"gutter"
|
|
1916
|
+
])) : (B(), j(K(ni), {
|
|
1917
|
+
key: 1,
|
|
1918
|
+
row: t.rows[e.index],
|
|
1919
|
+
index: e.index,
|
|
1920
|
+
"row-no": K(m).rowNoOf(K(g)(t.rows[e.index])),
|
|
1921
|
+
gutter: !t.phone,
|
|
1922
|
+
uid: K(c),
|
|
1923
|
+
columns: T.value,
|
|
1924
|
+
env: ne.value,
|
|
1925
|
+
"key-column": t.keyColumn,
|
|
1926
|
+
read: K(m).read,
|
|
1927
|
+
original: K(m).original,
|
|
1928
|
+
"can-edit": K(f).canEdit,
|
|
1929
|
+
current: K(m).current,
|
|
1930
|
+
"editor-for": K(f).editorFor,
|
|
1931
|
+
draft: K(m).rowDraft(K(g)(t.rows[e.index])),
|
|
1932
|
+
issues: K(m).rowIssues(K(g)(t.rows[e.index])),
|
|
1933
|
+
"is-new": K(m).isNew(K(g)(t.rows[e.index])),
|
|
1934
|
+
"key-state": K(m).keyState(K(g)(t.rows[e.index])),
|
|
1935
|
+
"row-error": K(m).rowError(K(g)(t.rows[e.index])),
|
|
1936
|
+
active: ae.value === e.index ? K(ie).columnId : null,
|
|
1937
|
+
selection: O(e.index),
|
|
1938
|
+
"handle-at": le(e.index),
|
|
1939
|
+
fill: Xe(e.index),
|
|
1940
|
+
found: L(e.index),
|
|
1941
|
+
editing: F(e.index),
|
|
1942
|
+
"tip-below": e.index === 0,
|
|
1943
|
+
onEditValue: n[0] ||= (e) => K(f).edit.setValue(e),
|
|
1944
|
+
onUseSuggestion: (n, r) => K(f).useSuggestion(t.rows[e.index], n, r)
|
|
1945
|
+
}, null, 8, /* @__PURE__ */ "row.index.row-no.gutter.uid.columns.env.key-column.read.original.can-edit.current.editor-for.draft.issues.is-new.key-state.row-error.active.selection.handle-at.fill.found.editing.tip-below.onUseSuggestion".split(".")))], 12, gi))), 128))], 4)], 544),
|
|
1946
|
+
Le.value ? (B(), N("div", {
|
|
1947
|
+
key: 0,
|
|
1948
|
+
class: "dt-fill-label",
|
|
1949
|
+
role: "status",
|
|
1950
|
+
style: me({
|
|
1951
|
+
left: `${Le.value.left}px`,
|
|
1952
|
+
top: `${Le.value.top}px`
|
|
1953
|
+
})
|
|
1954
|
+
}, W(Le.value.text), 5)) : M("", !0),
|
|
1955
|
+
e.$slots.state && !t.skeleton && t.rows.length === 0 ? (B(), N("div", _i, [ye(e.$slots, "state")])) : M("", !0),
|
|
1956
|
+
I($r, {
|
|
1957
|
+
sheet: K(f),
|
|
1958
|
+
entity: t.entity,
|
|
1959
|
+
href: Q.value,
|
|
1960
|
+
"read-only": t.readOnly || t.loading
|
|
1961
|
+
}, null, 8, [
|
|
1962
|
+
"sheet",
|
|
1963
|
+
"entity",
|
|
1964
|
+
"href",
|
|
1965
|
+
"read-only"
|
|
1966
|
+
])
|
|
1967
|
+
], 42, ri)]),
|
|
1968
|
+
_: 3
|
|
1969
|
+
})]),
|
|
1970
|
+
_: 3
|
|
1971
|
+
}));
|
|
1972
|
+
}
|
|
1973
|
+
});
|
|
1974
|
+
//#endregion
|
|
1975
|
+
//#region src/sheet/useSheetEditing.ts
|
|
1976
|
+
function Si(e) {
|
|
1977
|
+
let t = U(null);
|
|
1978
|
+
return {
|
|
1979
|
+
editing: t,
|
|
1980
|
+
start: (n, r, i) => {
|
|
1981
|
+
if (!e.canEdit(n, r) || r.type === "boolean" && !r.editor) return !1;
|
|
1982
|
+
if (i.replace !== void 0 && !r.editor && r.type === "multiselect") return t.value = {
|
|
1983
|
+
row: n,
|
|
1984
|
+
def: r,
|
|
1985
|
+
value: e.store.read(n, r),
|
|
1986
|
+
inCell: i.inCell,
|
|
1987
|
+
seed: i.replace
|
|
1988
|
+
}, !0;
|
|
1989
|
+
let a = i.replace === void 0 ? e.store.read(n, r) : e.parse(r, i.replace);
|
|
1990
|
+
return t.value = {
|
|
1991
|
+
row: n,
|
|
1992
|
+
def: r,
|
|
1993
|
+
value: a,
|
|
1994
|
+
inCell: i.inCell,
|
|
1995
|
+
text: i.replace
|
|
1996
|
+
}, !0;
|
|
1997
|
+
},
|
|
1998
|
+
setValue: (e, n, r) => {
|
|
1999
|
+
let i = t.value;
|
|
2000
|
+
i && (t.value = {
|
|
2001
|
+
...i,
|
|
2002
|
+
value: e,
|
|
2003
|
+
text: n,
|
|
2004
|
+
inCell: r ?? i.inCell
|
|
2005
|
+
});
|
|
2006
|
+
},
|
|
2007
|
+
commit: () => {
|
|
2008
|
+
let n = t.value;
|
|
2009
|
+
return n ? (t.value = null, e.store.set(n.row, n.def, n.value === "" ? null : n.value), !0) : !1;
|
|
2010
|
+
},
|
|
2011
|
+
cancel: () => {
|
|
2012
|
+
t.value = null;
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
//#endregion
|
|
2017
|
+
//#region src/sheet/useSheetStore.ts
|
|
2018
|
+
var Ci = 100, wi = (e, t) => g(e) && g(t) || Object.is(e, t) || Array.isArray(e) && Array.isArray(t) && e.length === t.length && e.every((e, n) => Object.is(e, t[n]));
|
|
2019
|
+
function Ti(e, t, n) {
|
|
2020
|
+
let r = t.split("."), i = e;
|
|
2021
|
+
for (let e of r.slice(0, -1)) {
|
|
2022
|
+
let t = i[e];
|
|
2023
|
+
i[e] = t && typeof t == "object" ? { ...t } : {}, i = i[e];
|
|
2024
|
+
}
|
|
2025
|
+
i[r[r.length - 1]] = n;
|
|
2026
|
+
}
|
|
2027
|
+
var Ei = (e, t) => e.trim().toLocaleLowerCase(t).replace(/ı|i̇/g, "i");
|
|
2028
|
+
function Di(e, t, n) {
|
|
2029
|
+
let r = Ei(t, n);
|
|
2030
|
+
if (!r) return;
|
|
2031
|
+
let i = (e, t) => {
|
|
2032
|
+
let n = Array.from({ length: t.length + 1 }, (e, t) => t);
|
|
2033
|
+
for (let r = 1; r <= e.length; r++) {
|
|
2034
|
+
let i = n[0];
|
|
2035
|
+
n[0] = r;
|
|
2036
|
+
for (let a = 1; a <= t.length; a++) {
|
|
2037
|
+
let o = n[a];
|
|
2038
|
+
n[a] = Math.min(n[a] + 1, n[a - 1] + 1, i + (e[r - 1] === t[a - 1] ? 0 : 1)), i = o;
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
return n[t.length];
|
|
2042
|
+
};
|
|
2043
|
+
return e.find((e) => Ei(e.label, n).startsWith(r) || r.startsWith(Ei(e.label, n))) ?? e.find((e) => i(Ei(e.label, n), r) <= 2);
|
|
2044
|
+
}
|
|
2045
|
+
function Oi(e) {
|
|
2046
|
+
let t = e.i18n.t, n = A(() => G(e.columns)), r = A(() => new Map(n.value.map((e) => [e.id, e]))), a = () => G(e.keyColumn), o = H(/* @__PURE__ */ new Map()), s = H(/* @__PURE__ */ new Map()), l = H(/* @__PURE__ */ new Map()), u = H(/* @__PURE__ */ new Map()), d = H(/* @__PURE__ */ new Map()), f = U([]), m = H(/* @__PURE__ */ new Set()), h = H(/* @__PURE__ */ new Map()), _ = U(0), v = [], y = [], b = U(!1), S = U(!1), ee = 0, C = (t) => String(p(t, G(e.rowKey))), w = A(() => f.value.length ? [...G(e.rows), ...f.value.map((e) => e.row)] : G(e.rows)), te = A(() => {
|
|
2047
|
+
let e = /* @__PURE__ */ new Map();
|
|
2048
|
+
return w.value.forEach((t, n) => e.set(C(t), n)), e;
|
|
2049
|
+
}), ne = A(() => m.size ? w.value.filter((e) => !m.has(C(e))) : w.value), T = A(() => {
|
|
2050
|
+
let e = /* @__PURE__ */ new Map();
|
|
2051
|
+
for (let t of w.value) e.set(C(t), t);
|
|
2052
|
+
return e;
|
|
2053
|
+
}), E = A(() => new Map(f.value.map((e) => [e.key, e]))), re = (e) => !!E.value.get(e) && !E.value.get(e).saved, D = (e) => (te.value.get(e) ?? -1) + 1, ie = (e, t) => {
|
|
2054
|
+
let n = C(e), r = d.get(n);
|
|
2055
|
+
if (r) return t.accessor ? t.accessor(r.row) : p(r.row, t.id);
|
|
2056
|
+
if (!re(n)) return t.accessor ? t.accessor(e) : p(e, t.id);
|
|
2057
|
+
}, ae = (e, t, n) => {
|
|
2058
|
+
let r = e.get(C(t)), i = n.id;
|
|
2059
|
+
return r?.has(i) ? r.get(i) : ie(t, n);
|
|
2060
|
+
}, oe = (e, t) => ae(o, e, t), se = (e, t) => ae(xe(o), e, t), O = (e) => {
|
|
2061
|
+
let t = C(e), n = d.get(t), r = o.get(t);
|
|
2062
|
+
if (!n && !r?.size) return e;
|
|
2063
|
+
let i = {
|
|
2064
|
+
...e,
|
|
2065
|
+
...n?.row
|
|
2066
|
+
};
|
|
2067
|
+
for (let [e, t] of r ?? []) Ti(i, e, t);
|
|
2068
|
+
return i;
|
|
2069
|
+
}, ce = A(() => {
|
|
2070
|
+
_.value;
|
|
2071
|
+
let e = /* @__PURE__ */ new Map(), t = r.value.get(a());
|
|
2072
|
+
if (!t) return e;
|
|
2073
|
+
for (let n of ne.value) {
|
|
2074
|
+
let r = se(n, t);
|
|
2075
|
+
if (g(r)) continue;
|
|
2076
|
+
let i = String(r), a = e.get(i);
|
|
2077
|
+
a || e.set(i, a = /* @__PURE__ */ new Set()), a.add(C(n));
|
|
2078
|
+
}
|
|
2079
|
+
return e;
|
|
2080
|
+
}), k = (n, r) => {
|
|
2081
|
+
if (g(r)) return null;
|
|
2082
|
+
let a = (e, t) => ({
|
|
2083
|
+
level: "error",
|
|
2084
|
+
message: e,
|
|
2085
|
+
suggest: t
|
|
2086
|
+
});
|
|
2087
|
+
if ((i[n.type].numeric || n.type === "star") && typeof r != "number") return a(typeof r == "string" && r.trim().startsWith("=") ? t("sheet.noFormulas") : t("sheet.notANumber"));
|
|
2088
|
+
if ((n.type === "date" || n.type === "datetime") && Number.isNaN(x(r).getTime())) return a(t("sheet.notADate"));
|
|
2089
|
+
if (n.type === "boolean" && typeof r != "boolean") return a(t("sheet.notAnOption", { value: String(r) }));
|
|
2090
|
+
if (n.type === "select" && !n.options.some((e) => e.value === r)) return a(t("sheet.notAnOption", { value: String(r) }), Di(n.options, String(r), e.locale));
|
|
2091
|
+
if (n.type === "multiselect") {
|
|
2092
|
+
let e = (Array.isArray(r) ? r : [r]).find((e) => !n.options.some((t) => t.value === e));
|
|
2093
|
+
if (e !== void 0) return a(t("sheet.notAnOption", { value: String(e) }));
|
|
2094
|
+
}
|
|
2095
|
+
return null;
|
|
2096
|
+
}, j = (e, n, r) => {
|
|
2097
|
+
if (e.type !== "select" && e.type !== "multiselect" || !e.optionEnabled || g(n) || wi(n, r.original)) return null;
|
|
2098
|
+
let { options: i, optionEnabled: a } = e, o = (Array.isArray(n) ? n : [n]).find((e) => {
|
|
2099
|
+
let t = i.find((t) => t.value === e);
|
|
2100
|
+
return t && !a(t, r.row);
|
|
2101
|
+
});
|
|
2102
|
+
return o === void 0 ? null : {
|
|
2103
|
+
level: "error",
|
|
2104
|
+
message: t("sheet.notAnOption", { value: c(i, o) })
|
|
2105
|
+
};
|
|
2106
|
+
}, M = (e, n) => {
|
|
2107
|
+
if (g(n)) return null;
|
|
2108
|
+
let r = ce.value.get(String(n));
|
|
2109
|
+
if (!r || r.size < 2) return null;
|
|
2110
|
+
let i = [...r].find((t) => t !== e);
|
|
2111
|
+
return i ? {
|
|
2112
|
+
level: "error",
|
|
2113
|
+
message: t("sheet.duplicateKey", {
|
|
2114
|
+
key: String(n),
|
|
2115
|
+
row: D(i)
|
|
2116
|
+
})
|
|
2117
|
+
} : null;
|
|
2118
|
+
}, N = (e) => {
|
|
2119
|
+
let r = C(e), i = re(r), o = O(e), c = /* @__PURE__ */ new Map();
|
|
2120
|
+
for (let s of n.value) {
|
|
2121
|
+
let n = oe(e, s), l = {
|
|
2122
|
+
row: o,
|
|
2123
|
+
isNew: i,
|
|
2124
|
+
original: ie(e, s)
|
|
2125
|
+
}, u = s.id === a(), d = s.required || i && u, p = k(s, n) ?? j(s, n, l) ?? (d && g(n) ? {
|
|
2126
|
+
level: "error",
|
|
2127
|
+
message: t("sheet.required")
|
|
2128
|
+
} : null) ?? (u && (i || f.value.length) ? M(r, n) : null) ?? (() => {
|
|
2129
|
+
let e = s.validate?.(n, l);
|
|
2130
|
+
if (e) return {
|
|
2131
|
+
level: "error",
|
|
2132
|
+
message: e
|
|
2133
|
+
};
|
|
2134
|
+
let t = s.warn?.(n, l);
|
|
2135
|
+
return t ? {
|
|
2136
|
+
level: "warning",
|
|
2137
|
+
message: t
|
|
2138
|
+
} : null;
|
|
2139
|
+
})();
|
|
2140
|
+
p && c.set(s.id, p);
|
|
2141
|
+
}
|
|
2142
|
+
c.size ? s.set(r, c) : s.delete(r);
|
|
2143
|
+
}, P = (e) => {
|
|
2144
|
+
for (let t of e) if (!g(t)) for (let e of ce.value.get(String(t)) ?? []) {
|
|
2145
|
+
let t = T.value.get(e);
|
|
2146
|
+
t && N(t);
|
|
2147
|
+
}
|
|
2148
|
+
}, le = (e) => {
|
|
2149
|
+
let t = [], n = /* @__PURE__ */ new Map(), r = [];
|
|
2150
|
+
for (let i of e) {
|
|
2151
|
+
let e = C(i.row), s = i.def.id, c = oe(i.row, i.def);
|
|
2152
|
+
if (wi(c, i.value)) continue;
|
|
2153
|
+
let d = n.get(e);
|
|
2154
|
+
d || n.set(e, d = {
|
|
2155
|
+
row: i.row,
|
|
2156
|
+
map: new Map(o.get(e))
|
|
2157
|
+
}), wi(i.value, ie(i.row, i.def)) ? d.map.delete(s) : d.map.set(s, i.value), t.push({
|
|
2158
|
+
key: e,
|
|
2159
|
+
col: s,
|
|
2160
|
+
before: c,
|
|
2161
|
+
after: i.value
|
|
2162
|
+
}), s === a() && r.push(c, i.value);
|
|
2163
|
+
let f = l.get(e);
|
|
2164
|
+
if (f?.has(s)) {
|
|
2165
|
+
let t = new Map(f);
|
|
2166
|
+
t.delete(s), t.size ? l.set(e, t) : l.delete(e);
|
|
2167
|
+
}
|
|
2168
|
+
u.delete(e);
|
|
2169
|
+
}
|
|
2170
|
+
for (let [e, { map: t }] of n) t.size ? o.set(e, t) : o.delete(e);
|
|
2171
|
+
t.length && _.value++;
|
|
2172
|
+
for (let { row: e, map: t } of n.values()) t.size || re(C(e)) ? N(e) : s.delete(C(e));
|
|
2173
|
+
return r.length && P(r), t;
|
|
2174
|
+
}, F = () => {
|
|
2175
|
+
b.value = v.length > 0, S.value = y.length > 0;
|
|
2176
|
+
}, I = (e) => {
|
|
2177
|
+
v.push(e), v.length > Ci && v.shift(), y.length = 0, F();
|
|
2178
|
+
}, L = (e, t = []) => {
|
|
2179
|
+
let n = le(e);
|
|
2180
|
+
return (n.length || t.length) && I({
|
|
2181
|
+
patches: n,
|
|
2182
|
+
added: t.length ? t : void 0
|
|
2183
|
+
}), n;
|
|
2184
|
+
}, R = (e, t, n) => L([{
|
|
2185
|
+
row: e,
|
|
2186
|
+
def: t,
|
|
2187
|
+
value: n
|
|
2188
|
+
}]), z = (t) => {
|
|
2189
|
+
let n = Array.from({ length: t }, () => {
|
|
2190
|
+
let t = `new:${++ee}`, n = {};
|
|
2191
|
+
return Ti(n, G(e.rowKey), t), {
|
|
2192
|
+
key: t,
|
|
2193
|
+
row: n
|
|
2194
|
+
};
|
|
2195
|
+
});
|
|
2196
|
+
f.value = [...f.value, ...n], _.value++;
|
|
2197
|
+
for (let e of n) h.set(e.key, "new"), N(e.row);
|
|
2198
|
+
return n;
|
|
2199
|
+
}, ue = (e) => {
|
|
2200
|
+
let t = new Set(e);
|
|
2201
|
+
f.value = f.value.filter((e) => !t.has(e.key));
|
|
2202
|
+
for (let t of e) o.delete(t), s.delete(t), h.delete(t), d.delete(t);
|
|
2203
|
+
_.value++;
|
|
2204
|
+
}, de = (e) => {
|
|
2205
|
+
let t = r.value.get(a()), n = t ? e.map((e) => T.value.get(e)).map((e) => e ? oe(e, t) : null) : [];
|
|
2206
|
+
for (let t of e) m.add(t);
|
|
2207
|
+
_.value++, I({
|
|
2208
|
+
patches: [],
|
|
2209
|
+
removed: e
|
|
2210
|
+
}), P(n);
|
|
2211
|
+
}, fe = (e) => {
|
|
2212
|
+
for (let t of e) m.delete(t);
|
|
2213
|
+
_.value++;
|
|
2214
|
+
let t = r.value.get(a());
|
|
2215
|
+
t && P(e.map((e) => T.value.get(e)).map((e) => e ? oe(e, t) : null));
|
|
2216
|
+
}, pe = (e, t) => {
|
|
2217
|
+
if (t === "undo" && e.added && ue(e.added.map((e) => e.key)), t === "redo" && e.added) {
|
|
2218
|
+
f.value = [...f.value, ...e.added];
|
|
2219
|
+
for (let t of e.added) h.set(t.key, "new");
|
|
2220
|
+
_.value++;
|
|
2221
|
+
}
|
|
2222
|
+
if (e.removed) {
|
|
2223
|
+
if (t === "undo") fe(e.removed);
|
|
2224
|
+
else {
|
|
2225
|
+
for (let t of e.removed) m.add(t);
|
|
2226
|
+
_.value++;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
let n = [];
|
|
2230
|
+
for (let i of e.patches) {
|
|
2231
|
+
let e = T.value.get(i.key), a = r.value.get(i.col);
|
|
2232
|
+
e && a && n.push({
|
|
2233
|
+
row: e,
|
|
2234
|
+
def: a,
|
|
2235
|
+
value: t === "undo" ? i.before : i.after
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
if (le(n), t === "redo" && e.added) for (let t of e.added) N(t.row);
|
|
2239
|
+
}, me = () => {
|
|
2240
|
+
let e = v.pop();
|
|
2241
|
+
return e ? (pe(e, "undo"), y.push(e), F(), e) : null;
|
|
2242
|
+
}, he = () => {
|
|
2243
|
+
let e = y.pop();
|
|
2244
|
+
return e ? (pe(e, "redo"), v.push(e), F(), e) : null;
|
|
2245
|
+
}, ge = () => {
|
|
2246
|
+
v.length = 0, y.length = 0, F();
|
|
2247
|
+
}, B = (e) => o.get(e), _e = (e) => {
|
|
2248
|
+
let t = s.get(e), n = l.get(e);
|
|
2249
|
+
if (!n) return t;
|
|
2250
|
+
let r = new Map(t);
|
|
2251
|
+
for (let [e, t] of n) r.has(e) || r.set(e, {
|
|
2252
|
+
level: "error",
|
|
2253
|
+
message: t,
|
|
2254
|
+
server: !0
|
|
2255
|
+
});
|
|
2256
|
+
return r;
|
|
2257
|
+
}, V = (e) => u.get(e), ve = (e) => {
|
|
2258
|
+
if (l.has(e) || u.has(e)) return !0;
|
|
2259
|
+
let t = s.get(e);
|
|
2260
|
+
if (!t) return !1;
|
|
2261
|
+
for (let e of t.values()) if (e.level === "error") return !0;
|
|
2262
|
+
return !1;
|
|
2263
|
+
}, ye = (e) => h.get(e), W = (e, t) => {
|
|
2264
|
+
E.value.has(e) && h.set(e, t);
|
|
2265
|
+
}, be = (e, t) => {
|
|
2266
|
+
d.set(e, {
|
|
2267
|
+
row: t,
|
|
2268
|
+
from: re(e) ? void 0 : T.value.get(e)
|
|
2269
|
+
}), _.value++;
|
|
2270
|
+
let n = T.value.get(e);
|
|
2271
|
+
if (n) {
|
|
2272
|
+
let t = o.get(e);
|
|
2273
|
+
if (t) {
|
|
2274
|
+
let i = new Map(t);
|
|
2275
|
+
for (let [e, a] of t) {
|
|
2276
|
+
let t = r.value.get(e);
|
|
2277
|
+
t && wi(a, ie(n, t)) && i.delete(e);
|
|
2278
|
+
}
|
|
2279
|
+
i.size ? o.set(e, i) : o.delete(e);
|
|
2280
|
+
}
|
|
2281
|
+
N(n);
|
|
2282
|
+
}
|
|
2283
|
+
}, K = A(() => {
|
|
2284
|
+
let e = 0, t = /* @__PURE__ */ new Set();
|
|
2285
|
+
for (let [n, r] of o) m.has(n) || (e += r.size, t.add(n));
|
|
2286
|
+
let n = 0, r = 0, i = /* @__PURE__ */ new Set([...l.keys(), ...u.keys()]);
|
|
2287
|
+
for (let [e, t] of s) {
|
|
2288
|
+
if (m.has(e)) continue;
|
|
2289
|
+
let n = !1;
|
|
2290
|
+
for (let r of t.values()) r.level === "error" ? i.add(e) : n = !0;
|
|
2291
|
+
n && r++;
|
|
2292
|
+
}
|
|
2293
|
+
for (let e of i) m.has(e) || n++;
|
|
2294
|
+
let a = 0, c = t.size;
|
|
2295
|
+
for (let e of f.value) e.saved || m.has(e.key) || (a++, t.has(e.key) || c++);
|
|
2296
|
+
return {
|
|
2297
|
+
changedCells: e,
|
|
2298
|
+
changedRows: t.size,
|
|
2299
|
+
errorRows: n,
|
|
2300
|
+
warningRows: r,
|
|
2301
|
+
newRows: a,
|
|
2302
|
+
changedOrNewRows: c
|
|
2303
|
+
};
|
|
2304
|
+
});
|
|
2305
|
+
return Oe(() => G(e.rows), (e) => {
|
|
2306
|
+
if (!d.size) return;
|
|
2307
|
+
let t = /* @__PURE__ */ new Map();
|
|
2308
|
+
for (let n of e) t.set(C(n), n);
|
|
2309
|
+
for (let [e, n] of d) {
|
|
2310
|
+
let r = t.get(e);
|
|
2311
|
+
n.from && r && r !== n.from && d.delete(e);
|
|
2312
|
+
}
|
|
2313
|
+
_.value++;
|
|
2314
|
+
}), {
|
|
2315
|
+
keyOf: C,
|
|
2316
|
+
batch: w,
|
|
2317
|
+
allRows: ne,
|
|
2318
|
+
rowByKey: (e) => T.value.get(e),
|
|
2319
|
+
rowNoOf: D,
|
|
2320
|
+
isNew: re,
|
|
2321
|
+
isRemoved: (e) => m.has(e),
|
|
2322
|
+
keyState: ye,
|
|
2323
|
+
setKeyState: W,
|
|
2324
|
+
setBase: be,
|
|
2325
|
+
read: oe,
|
|
2326
|
+
readUntracked: se,
|
|
2327
|
+
original: ie,
|
|
2328
|
+
current: O,
|
|
2329
|
+
set: R,
|
|
2330
|
+
apply: L,
|
|
2331
|
+
addRows: z,
|
|
2332
|
+
removeRows: de,
|
|
2333
|
+
undo: me,
|
|
2334
|
+
redo: he,
|
|
2335
|
+
canUndo: b,
|
|
2336
|
+
canRedo: S,
|
|
2337
|
+
clearHistory: ge,
|
|
2338
|
+
version: _,
|
|
2339
|
+
rowDraft: B,
|
|
2340
|
+
rowIssues: _e,
|
|
2341
|
+
rowError: V,
|
|
2342
|
+
hasError: ve,
|
|
2343
|
+
counts: K,
|
|
2344
|
+
reset: () => {
|
|
2345
|
+
o.clear(), s.clear(), l.clear(), u.clear(), f.value = [], m.clear(), h.clear(), ge(), _.value++;
|
|
2346
|
+
},
|
|
2347
|
+
getChanges: () => {
|
|
2348
|
+
let e = r.value.get(a()), t = [];
|
|
2349
|
+
for (let [n, r] of o) {
|
|
2350
|
+
let i = T.value.get(n);
|
|
2351
|
+
if (!i || m.has(n) || ve(n)) continue;
|
|
2352
|
+
let o = re(n) && h.get(n) !== "update", s = Object.fromEntries([...r].filter(([, e]) => !o || !g(e)));
|
|
2353
|
+
t.push({
|
|
2354
|
+
clientId: n,
|
|
2355
|
+
key: String(e ? oe(i, e) : p(i, a())),
|
|
2356
|
+
op: o ? "create" : "update",
|
|
2357
|
+
values: s
|
|
2358
|
+
});
|
|
2359
|
+
}
|
|
2360
|
+
return t.sort((e, t) => D(e.clientId) - D(t.clientId)), { rows: t };
|
|
2361
|
+
},
|
|
2362
|
+
settleUntouched: () => {
|
|
2363
|
+
let e = !1, t = f.value.map((t) => t.saved || m.has(t.key) || h.get(t.key) !== "update" || o.get(t.key)?.size ? t : (e = !0, h.delete(t.key), s.delete(t.key), {
|
|
2364
|
+
...t,
|
|
2365
|
+
saved: !0
|
|
2366
|
+
}));
|
|
2367
|
+
e && (f.value = t, _.value++);
|
|
2368
|
+
},
|
|
2369
|
+
applyResult: (e) => {
|
|
2370
|
+
let t = 0, n = 0, r = 0;
|
|
2371
|
+
for (let i of e) {
|
|
2372
|
+
let e = i.clientId, a = T.value.get(e);
|
|
2373
|
+
if (a) {
|
|
2374
|
+
if (i.status === "error") {
|
|
2375
|
+
r++;
|
|
2376
|
+
let t = i.fieldErrors ? new Map(Object.entries(i.fieldErrors)) : null;
|
|
2377
|
+
t?.size ? l.set(e, t) : l.delete(e), i.rowError ? u.set(e, i.rowError) : u.delete(e);
|
|
2378
|
+
} else i.status === "created" ? t++ : n++, d.set(e, {
|
|
2379
|
+
row: i.row ?? O(a),
|
|
2380
|
+
from: re(e) ? void 0 : a
|
|
2381
|
+
}), o.delete(e), s.delete(e), l.delete(e), u.delete(e), h.delete(e), E.value.get(e) && (f.value = f.value.map((t) => t.key === e ? {
|
|
2382
|
+
...t,
|
|
2383
|
+
saved: !0
|
|
2384
|
+
} : t));
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
return ge(), _.value++, {
|
|
2388
|
+
created: t,
|
|
2389
|
+
updated: n,
|
|
2390
|
+
errors: r
|
|
2391
|
+
};
|
|
2392
|
+
}
|
|
2393
|
+
};
|
|
2394
|
+
}
|
|
2395
|
+
//#endregion
|
|
2396
|
+
//#region src/sheet/useSheetTable.ts
|
|
2397
|
+
var ki = $e({ cellSelectionFeature: Q });
|
|
2398
|
+
function Ai(e) {
|
|
2399
|
+
let t = A(() => G(e.columnIds).map((e) => ({
|
|
2400
|
+
id: e,
|
|
2401
|
+
accessorFn: () => void 0
|
|
2402
|
+
}))), n = $({
|
|
2403
|
+
features: ki,
|
|
2404
|
+
columns: t,
|
|
2405
|
+
data: A(() => G(e.rows)),
|
|
2406
|
+
getRowId: e.rowId,
|
|
2407
|
+
autoResetCellSelection: !1,
|
|
2408
|
+
enableMultiCellRangeSelection: !1
|
|
2409
|
+
}), r = A(() => {
|
|
2410
|
+
let e = n.atoms.cellSelection.get(), t = e[e.length - 1];
|
|
2411
|
+
return t ? {
|
|
2412
|
+
rowId: t.anchorRowId,
|
|
2413
|
+
columnId: t.anchorColumnId
|
|
2414
|
+
} : null;
|
|
2415
|
+
}), i = A(() => n.getCellSelectionBounds()[0] ?? null), a = A(() => {
|
|
2416
|
+
let e = n.atoms.cellSelection.get()[0];
|
|
2417
|
+
return e ? {
|
|
2418
|
+
rowId: e.focusRowId,
|
|
2419
|
+
columnId: e.focusColumnId
|
|
2420
|
+
} : null;
|
|
2421
|
+
}), o = (e, t) => n.getCoreRowModel().rowsById[e]?.getAllCellsByColumnId()[t];
|
|
2422
|
+
return {
|
|
2423
|
+
active: r,
|
|
2424
|
+
bounds: i,
|
|
2425
|
+
rangeEnd: a,
|
|
2426
|
+
focus: (e, t) => n.setFocusedCell(e, t),
|
|
2427
|
+
move: (e) => n.moveCellSelection(e),
|
|
2428
|
+
extend: (e) => n.extendCellSelection(e),
|
|
2429
|
+
selectAll: () => n.selectAllCells(),
|
|
2430
|
+
selectRange: (e) => n.selectCellRange(e),
|
|
2431
|
+
clear: () => n.resetCellSelection(!0),
|
|
2432
|
+
startHandler: (e, t) => o(e, t)?.getSelectionStartHandler(),
|
|
2433
|
+
extendHandler: (e, t) => o(e, t)?.getSelectionExtendHandler()
|
|
2434
|
+
};
|
|
2435
|
+
}
|
|
2436
|
+
//#endregion
|
|
2437
|
+
//#region src/sheet/DataSheet.vue?vue&type=script&setup=true&lang.ts
|
|
2438
|
+
var ji = ["data-density"], Mi = {
|
|
2439
|
+
key: 0,
|
|
2440
|
+
class: "dt-sheet-readonly",
|
|
2441
|
+
role: "note"
|
|
2442
|
+
}, Ni = { class: "dt-sheet-readonly-text" }, Pi = {
|
|
2443
|
+
class: "dt-toolbar dt-sheet-toolbar",
|
|
2444
|
+
role: "toolbar"
|
|
2445
|
+
}, Fi = {
|
|
2446
|
+
key: 0,
|
|
2447
|
+
class: "dt-progress-strip"
|
|
2448
|
+
}, Ii = {
|
|
2449
|
+
key: 0,
|
|
2450
|
+
class: "dt-progress-count"
|
|
2451
|
+
}, Li = ["aria-valuenow"], Ri = {
|
|
2452
|
+
key: 0,
|
|
2453
|
+
class: "dt-find-count",
|
|
2454
|
+
role: "status"
|
|
2455
|
+
}, zi = {
|
|
2456
|
+
key: 0,
|
|
2457
|
+
class: "dt-find-count",
|
|
2458
|
+
role: "status"
|
|
2459
|
+
}, Bi = { class: "dt-seg-count" }, Vi = { class: "dt-seg-count" }, Hi = { class: "dt-seg-count" }, Ui = ["aria-disabled"], Wi = ["aria-disabled"], Gi = {
|
|
2460
|
+
type: "button",
|
|
2461
|
+
class: "dt-btn dt-btn-ghost has-icon dt-sheet-export"
|
|
2462
|
+
}, Ki = {
|
|
2463
|
+
key: 0,
|
|
2464
|
+
class: "dt-sheet-dot",
|
|
2465
|
+
"aria-hidden": "true"
|
|
2466
|
+
}, qi = ["disabled"], Ji = [
|
|
2467
|
+
"disabled",
|
|
2468
|
+
"aria-disabled",
|
|
2469
|
+
"data-dt-tip"
|
|
2470
|
+
], Yi = {
|
|
2471
|
+
key: 1,
|
|
2472
|
+
class: "dt-sheet-partly",
|
|
2473
|
+
role: "alert"
|
|
2474
|
+
}, Xi = { class: "dt-partly-nav" }, Zi = ["aria-label"], Qi = ["aria-label"], $i = {
|
|
2475
|
+
key: 2,
|
|
2476
|
+
class: "dt-strip dt-sheet-strip",
|
|
2477
|
+
role: "status"
|
|
2478
|
+
}, ea = {
|
|
2479
|
+
key: 3,
|
|
2480
|
+
class: "dt-formula"
|
|
2481
|
+
}, ta = { class: "dt-formula-name" }, na = { class: "dt-mono" }, ra = { class: "dt-formula-col" }, ia = [
|
|
2482
|
+
"value",
|
|
2483
|
+
"readonly",
|
|
2484
|
+
"aria-label"
|
|
2485
|
+
], aa = {
|
|
2486
|
+
key: 0,
|
|
2487
|
+
class: "dt-formula-hint"
|
|
2488
|
+
}, oa = {
|
|
2489
|
+
key: 1,
|
|
2490
|
+
class: "dt-formula-hint"
|
|
2491
|
+
}, sa = {
|
|
2492
|
+
key: 4,
|
|
2493
|
+
class: "dt-sheet-footer",
|
|
2494
|
+
role: "status"
|
|
2495
|
+
}, ca = { class: "dt-sheet-footer-badge" }, la = ["aria-label"], ua = { class: "dt-status-rows" }, da = {
|
|
2496
|
+
key: 0,
|
|
2497
|
+
class: "dt-status-saved"
|
|
2498
|
+
}, fa = {
|
|
2499
|
+
key: 1,
|
|
2500
|
+
class: "dt-status-changes"
|
|
2501
|
+
}, pa = {
|
|
2502
|
+
key: 2,
|
|
2503
|
+
class: "dt-status-muted"
|
|
2504
|
+
}, ma = {
|
|
2505
|
+
key: 3,
|
|
2506
|
+
class: "dt-status-new"
|
|
2507
|
+
}, ha = ["aria-label"], ga = { key: 0 }, _a = { key: 1 }, va = {
|
|
2508
|
+
key: 6,
|
|
2509
|
+
class: "dt-toast dt-sheet-toast",
|
|
2510
|
+
role: "status"
|
|
2511
|
+
}, ya = { class: "dt-toast-warn" }, ba = { class: "dt-kbd" }, xa = {
|
|
2512
|
+
class: "dt-sr-only",
|
|
2513
|
+
"aria-live": "polite"
|
|
2514
|
+
}, Sa = {
|
|
2515
|
+
class: "dt-sr-only",
|
|
2516
|
+
"aria-live": "assertive"
|
|
2517
|
+
}, Ca = /* @__PURE__ */ L({
|
|
2518
|
+
__name: "DataSheet",
|
|
2519
|
+
props: {
|
|
2520
|
+
tableId: {},
|
|
2521
|
+
columns: {},
|
|
2522
|
+
rows: {},
|
|
2523
|
+
rowKey: { default: "id" },
|
|
2524
|
+
density: {},
|
|
2525
|
+
entityName: {},
|
|
2526
|
+
keyColumn: {},
|
|
2527
|
+
loading: {
|
|
2528
|
+
type: [Boolean, Object],
|
|
2529
|
+
default: !1
|
|
2530
|
+
},
|
|
2531
|
+
saving: {
|
|
2532
|
+
type: [Boolean, Object],
|
|
2533
|
+
default: !1
|
|
2534
|
+
},
|
|
2535
|
+
lookupKeys: {},
|
|
2536
|
+
newRowDefaults: {},
|
|
2537
|
+
parseFile: {},
|
|
2538
|
+
maxRows: { default: 1e4 },
|
|
2539
|
+
readOnlyBelow: { default: 768 }
|
|
2540
|
+
},
|
|
2541
|
+
emits: ["save", "export"],
|
|
2542
|
+
setup(t, { expose: n, emit: r }) {
|
|
2543
|
+
let a = t, s = r, l = ce(), { i18n: u } = l, f = e(l.locale), p = A(() => a.entityName ?? {
|
|
2544
|
+
one: a.tableId,
|
|
2545
|
+
other: a.tableId
|
|
2546
|
+
}), b = te(() => a.tableId, l.preferences, {
|
|
2547
|
+
density: a.density ?? "compact",
|
|
2548
|
+
verticalLines: !0,
|
|
2549
|
+
pageSize: 0,
|
|
2550
|
+
defaultViewId: null
|
|
2551
|
+
}), x = A(() => a.density ?? b.prefs.density), ee = A(() => a.rows.length > a.maxRows), w = A(() => ee.value ? a.rows.slice(0, a.maxRows) : a.rows), T = A(() => a.loading !== !1), E = A(() => a.saving !== !1), D = A(() => {
|
|
2552
|
+
let e = T.value ? a.loading : a.saving;
|
|
2553
|
+
return typeof e == "object" ? e : null;
|
|
2554
|
+
}), oe = A(() => D.value && D.value.total > 0 ? Math.round(100 * D.value.done / D.value.total) : null), O = typeof matchMedia == "function" && (matchMedia(`(max-width: ${a.readOnlyBelow - 1}px)`).matches || !matchMedia("(any-pointer: fine)").matches), L = A(() => a.columns.map((e) => e.id === a.keyColumn ? {
|
|
2555
|
+
...e,
|
|
2556
|
+
pinned: "left",
|
|
2557
|
+
width: O ? 104 : 128
|
|
2558
|
+
} : e.primary && !O ? {
|
|
2559
|
+
...e,
|
|
2560
|
+
pinned: "left"
|
|
2561
|
+
} : e)), R = A(() => new Map(L.value.map((e) => [e.id, e]))), z = A(() => R.value.get(a.keyColumn)), ue = A(() => L.value.find((e) => e.primary)), H = Oi({
|
|
2562
|
+
rows: w,
|
|
2563
|
+
columns: L,
|
|
2564
|
+
rowKey: () => a.rowKey,
|
|
2565
|
+
keyColumn: () => a.keyColumn,
|
|
2566
|
+
i18n: u,
|
|
2567
|
+
locale: l.locale
|
|
2568
|
+
}), xe = V([]), G = U(null), Se = V("all"), Ce = U(/* @__PURE__ */ new Set()), Te = (e) => Se.value === "changed" ? !!H.rowDraft(e)?.size || H.isNew(e) : Se.value !== "errors" || H.hasError(e), Ee = (e) => {
|
|
2569
|
+
let t = e ? new Set(Ce.value) : /* @__PURE__ */ new Set();
|
|
2570
|
+
for (let e of H.batch.value) {
|
|
2571
|
+
let n = H.keyOf(e);
|
|
2572
|
+
Te(n) && t.add(n);
|
|
2573
|
+
}
|
|
2574
|
+
Ce.value = t;
|
|
2575
|
+
}, ke = (e) => {
|
|
2576
|
+
Se.value = e, Ee(!1);
|
|
2577
|
+
};
|
|
2578
|
+
Oe(H.version, () => {
|
|
2579
|
+
Se.value !== "all" && Ee(!0);
|
|
2580
|
+
});
|
|
2581
|
+
let je = A(() => {
|
|
2582
|
+
let e = H.batch.value, t = G.value;
|
|
2583
|
+
if (!t) return e;
|
|
2584
|
+
let n = new Set(t), r = [];
|
|
2585
|
+
for (let e of t) {
|
|
2586
|
+
let t = H.rowByKey(e);
|
|
2587
|
+
t && r.push(t);
|
|
2588
|
+
}
|
|
2589
|
+
for (let t of e) n.has(H.keyOf(t)) || r.push(t);
|
|
2590
|
+
return r;
|
|
2591
|
+
}), J = A(() => {
|
|
2592
|
+
let e = Se.value === "all", t = Ce.value;
|
|
2593
|
+
return je.value.filter((n) => {
|
|
2594
|
+
let r = H.keyOf(n);
|
|
2595
|
+
return !H.isRemoved(r) && (e || t.has(r));
|
|
2596
|
+
});
|
|
2597
|
+
}), Me = d({
|
|
2598
|
+
columns: L,
|
|
2599
|
+
rows: J,
|
|
2600
|
+
rowKey: () => a.rowKey,
|
|
2601
|
+
flexLastStart: !0
|
|
2602
|
+
}), Y = Ai({
|
|
2603
|
+
rows: J,
|
|
2604
|
+
columnIds: () => Me.columns.value.map((e) => e.id),
|
|
2605
|
+
rowId: H.keyOf
|
|
2606
|
+
}), Fe = A(() => {
|
|
2607
|
+
let e = /* @__PURE__ */ new Map();
|
|
2608
|
+
return J.value.forEach((t, n) => e.set(H.keyOf(t), n)), e;
|
|
2609
|
+
}), X = A(() => Me.columns.value), Z = A(() => T.value || E.value || O), Ue = {
|
|
2610
|
+
string: Mn,
|
|
2611
|
+
text: Mn,
|
|
2612
|
+
uppercase: Mn,
|
|
2613
|
+
lowercase: Mn,
|
|
2614
|
+
email: Mn,
|
|
2615
|
+
url: Mn,
|
|
2616
|
+
phone: Mn,
|
|
2617
|
+
id: Mn,
|
|
2618
|
+
color: Mn,
|
|
2619
|
+
int: On,
|
|
2620
|
+
float: On,
|
|
2621
|
+
percentage: On,
|
|
2622
|
+
currency: On,
|
|
2623
|
+
star: On,
|
|
2624
|
+
select: kn,
|
|
2625
|
+
multiselect: Bn,
|
|
2626
|
+
date: Ln,
|
|
2627
|
+
datetime: Ln
|
|
2628
|
+
}, Je = (e) => e.editor ?? Ue[e.type] ?? null, Ye = (e, t) => {
|
|
2629
|
+
if (Z.value) return !1;
|
|
2630
|
+
let n = H.isNew(H.keyOf(e));
|
|
2631
|
+
return t.id === a.keyColumn ? n : t.type !== "boolean" && !Je(t) ? !1 : typeof t.editable == "function" ? t.editable(H.current(e), { isNew: n }) : t.editable === !0;
|
|
2632
|
+
}, Qe = (e = l.locale) => ({
|
|
2633
|
+
locale: e,
|
|
2634
|
+
today: /* @__PURE__ */ new Date(),
|
|
2635
|
+
todayWord: u.t("date.today"),
|
|
2636
|
+
yesWord: u.t("common.yes"),
|
|
2637
|
+
noWord: u.t("common.no")
|
|
2638
|
+
}), Q = Si({
|
|
2639
|
+
store: H,
|
|
2640
|
+
canEdit: Ye,
|
|
2641
|
+
parse: (e, t) => xn(e, t, Qe())
|
|
2642
|
+
});
|
|
2643
|
+
_e(Rn, { seed: () => Q.editing.value?.seed });
|
|
2644
|
+
let $e = we("grid"), $ = H.counts, et = {
|
|
2645
|
+
fmt: f,
|
|
2646
|
+
i18n: u,
|
|
2647
|
+
today: /* @__PURE__ */ new Date(),
|
|
2648
|
+
labels: new h()
|
|
2649
|
+
}, tt = (e, t, n, r) => {
|
|
2650
|
+
let i = J.value, a = X.value, o = i[e], s = i[n];
|
|
2651
|
+
o && s && a[t] && a[r] && (Y.selectRange({
|
|
2652
|
+
anchorRowId: H.keyOf(o),
|
|
2653
|
+
anchorColumnId: a[t].id,
|
|
2654
|
+
focusRowId: H.keyOf(s),
|
|
2655
|
+
focusColumnId: a[r].id
|
|
2656
|
+
}), $e.value?.focusActive());
|
|
2657
|
+
}, nt = (e, t) => {
|
|
2658
|
+
let n = J.value[Math.max(0, Math.min(J.value.length - 1, e))];
|
|
2659
|
+
n && (Y.focus(H.keyOf(n), t), $e.value?.focusActive());
|
|
2660
|
+
}, rt = () => {
|
|
2661
|
+
let e = Y.bounds.value;
|
|
2662
|
+
if (!e) return [];
|
|
2663
|
+
let t = [];
|
|
2664
|
+
for (let n = e.minRowIndex; n <= e.maxRowIndex; n++) for (let r = e.minColumnIndex; r <= e.maxColumnIndex; r++) t.push({
|
|
2665
|
+
r: n,
|
|
2666
|
+
c: r
|
|
2667
|
+
});
|
|
2668
|
+
return t;
|
|
2669
|
+
}, it = (e, t) => H.set(e, t, !H.read(e, t)), at = () => {
|
|
2670
|
+
let e = [];
|
|
2671
|
+
for (let { r: t, c: n } of rt()) {
|
|
2672
|
+
let r = J.value[t], i = X.value[n]?.def;
|
|
2673
|
+
r && i && Ye(r, i) && e.push({
|
|
2674
|
+
row: r,
|
|
2675
|
+
def: i,
|
|
2676
|
+
value: null
|
|
2677
|
+
});
|
|
2678
|
+
}
|
|
2679
|
+
H.apply(e);
|
|
2680
|
+
}, ot = A(() => (H.version.value, je.value.map((e) => H.keyOf(e)).filter((e) => !H.isRemoved(e) && H.hasError(e)))), st = (e) => {
|
|
2681
|
+
let t = J.value, n = t.length, r = Y.active.value, i = r ? Fe.value.get(r.rowId) ?? -1 : -1;
|
|
2682
|
+
for (let r = 1; r <= n; r++) {
|
|
2683
|
+
let o = ((i + e * r) % n + n) % n, s = H.keyOf(t[o]);
|
|
2684
|
+
if (!H.hasError(s)) continue;
|
|
2685
|
+
let c = H.rowIssues(s), l = X.value.find((e) => c?.get(e.id)?.level === "error") ?? (H.rowError(s) ? X.value.find((e) => e.id === a.keyColumn) : void 0);
|
|
2686
|
+
if (l) {
|
|
2687
|
+
Y.focus(s, l.id), $e.value?.focusActive();
|
|
2688
|
+
return;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
ot.value.length && Se.value !== "all" && sr({
|
|
2692
|
+
text: u.t("sheet.nextErrorHidden"),
|
|
2693
|
+
action: {
|
|
2694
|
+
label: u.t("sheet.showIt"),
|
|
2695
|
+
run: () => {
|
|
2696
|
+
ke("all"), st(e);
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
});
|
|
2700
|
+
}, ct = (e, t, n) => {
|
|
2701
|
+
if (g(n)) return "";
|
|
2702
|
+
switch (e.type) {
|
|
2703
|
+
case "currency": return f.decimal(Number(n), e.decimalPlaces ?? 2);
|
|
2704
|
+
case "date":
|
|
2705
|
+
case "datetime": return n instanceof Date ? n.toISOString() : String(n);
|
|
2706
|
+
case "multiselect": return n.map((t) => c(e.options, t)).join("; ");
|
|
2707
|
+
case "string":
|
|
2708
|
+
case "text":
|
|
2709
|
+
case "uppercase":
|
|
2710
|
+
case "lowercase":
|
|
2711
|
+
case "email":
|
|
2712
|
+
case "url":
|
|
2713
|
+
case "phone":
|
|
2714
|
+
case "id": return String(n);
|
|
2715
|
+
default: return m(e, t, n, et);
|
|
2716
|
+
}
|
|
2717
|
+
}, lt = () => {
|
|
2718
|
+
let e = Y.bounds.value;
|
|
2719
|
+
if (!e) return null;
|
|
2720
|
+
let t = [];
|
|
2721
|
+
for (let n = e.minRowIndex; n <= e.maxRowIndex; n++) {
|
|
2722
|
+
let r = J.value[n];
|
|
2723
|
+
if (!r) continue;
|
|
2724
|
+
let i = [];
|
|
2725
|
+
for (let t = e.minColumnIndex; t <= e.maxColumnIndex; t++) {
|
|
2726
|
+
let e = X.value[t].def;
|
|
2727
|
+
i.push(ct(e, r, H.read(r, e)));
|
|
2728
|
+
}
|
|
2729
|
+
t.push(i);
|
|
2730
|
+
}
|
|
2731
|
+
return t;
|
|
2732
|
+
}, ut = (e) => {
|
|
2733
|
+
let t = lt();
|
|
2734
|
+
return !t || !e ? !1 : (e.setData("text/plain", ln(t)), e.setData("text/html", dn(t)), !0);
|
|
2735
|
+
}, dt = (e) => ut(e) ? (Z.value || at(), !0) : !1, ft = (e) => {
|
|
2736
|
+
let t = lt(), n = typeof navigator < "u" ? navigator.clipboard : void 0;
|
|
2737
|
+
if (!t || !n) return;
|
|
2738
|
+
let r = ln(t);
|
|
2739
|
+
(typeof ClipboardItem == "function" && n.write ? n.write([new ClipboardItem({
|
|
2740
|
+
"text/plain": new Blob([r], { type: "text/plain" }),
|
|
2741
|
+
"text/html": new Blob([dn(t)], { type: "text/html" })
|
|
2742
|
+
})]) : n.writeText(r)).catch(() => n.writeText(r)).catch(() => {}), e && !Z.value && at();
|
|
2743
|
+
}, pt = (e) => {
|
|
2744
|
+
let t = Y.active.value, n = Math.max(0, ...e.map((e) => e.length));
|
|
2745
|
+
if (!t || !e.length || !n || Z.value) return !1;
|
|
2746
|
+
let r = X.value, o = Fe.value.get(t.rowId), s = r.findIndex((e) => e.id === t.columnId);
|
|
2747
|
+
if (o === void 0 || s < 0) return !1;
|
|
2748
|
+
let c = Y.bounds.value, d = [];
|
|
2749
|
+
if (e.length === 1 && n === 1 && c && (c.maxRowIndex > c.minRowIndex || c.maxColumnIndex > c.minColumnIndex)) for (let { r: t, c: n } of rt()) d.push({
|
|
2750
|
+
r: t,
|
|
2751
|
+
c: n,
|
|
2752
|
+
text: e[0][0]
|
|
2753
|
+
});
|
|
2754
|
+
else e.forEach((e, t) => e.forEach((e, n) => {
|
|
2755
|
+
s + n < r.length && d.push({
|
|
2756
|
+
r: o + t,
|
|
2757
|
+
c: s + n,
|
|
2758
|
+
text: e
|
|
2759
|
+
});
|
|
2760
|
+
}));
|
|
2761
|
+
let p = Math.max(...d.map((e) => e.r)), m = p - J.value.length + 1;
|
|
2762
|
+
if (m > 0 && H.allRows.value.length + m > a.maxRows) return sr({ text: u.t("sheet.limitPaste", {
|
|
2763
|
+
count: f.int(H.allRows.value.length + m),
|
|
2764
|
+
max: f.int(a.maxRows)
|
|
2765
|
+
}) }), !0;
|
|
2766
|
+
let h = m > 0 ? H.addRows(m) : [];
|
|
2767
|
+
h.length && G.value && (G.value = [...G.value, ...h.map((e) => e.key)]);
|
|
2768
|
+
let g = J.value, _ = /* @__PURE__ */ new Map();
|
|
2769
|
+
for (let e of new Set(d.map((e) => e.c))) {
|
|
2770
|
+
let t = r[e].def;
|
|
2771
|
+
if (!i[t.type].numeric) continue;
|
|
2772
|
+
let n = _n(d.filter((t) => t.c === e).map((e) => e.text));
|
|
2773
|
+
_.set(e, n === "," ? "de" : n === "." ? "en" : l.locale);
|
|
2774
|
+
}
|
|
2775
|
+
let v = [];
|
|
2776
|
+
for (let e of d) {
|
|
2777
|
+
let t = g[e.r], n = r[e.c]?.def;
|
|
2778
|
+
t && n && Ye(t, n) && v.push({
|
|
2779
|
+
row: t,
|
|
2780
|
+
def: n,
|
|
2781
|
+
value: xn(n, e.text, Qe(_.get(e.c)))
|
|
2782
|
+
});
|
|
2783
|
+
}
|
|
2784
|
+
H.apply(v, h);
|
|
2785
|
+
let y = Math.min(...d.map((e) => e.r)), b = Math.min(...d.map((e) => e.c)), x = Math.max(...d.map((e) => e.c));
|
|
2786
|
+
tt(y, b, p, x);
|
|
2787
|
+
let S = d.map((e) => {
|
|
2788
|
+
let t = g[e.r];
|
|
2789
|
+
return (t && H.rowIssues(H.keyOf(t))?.get(r[e.c].id))?.level === "error" ? {
|
|
2790
|
+
...e,
|
|
2791
|
+
option: r[e.c].def.type === "select" || r[e.c].def.type === "multiselect"
|
|
2792
|
+
} : null;
|
|
2793
|
+
}).filter((e) => e !== null), ee = S.filter((e) => e.option).length, C = S.length - ee, w = {
|
|
2794
|
+
rows: p - y + 1,
|
|
2795
|
+
cols: x - b + 1
|
|
2796
|
+
}, te = S[0];
|
|
2797
|
+
return sr({
|
|
2798
|
+
text: u.t("sheet.pasted", {
|
|
2799
|
+
rows: f.int(w.rows),
|
|
2800
|
+
cols: f.int(w.cols)
|
|
2801
|
+
}),
|
|
2802
|
+
issues: [ee ? u.t("sheet.pasteIssues", { count: ee }) : "", C ? u.t("sheet.pasteErrors", { count: C }) : ""].filter(Boolean).join(" · ") || void 0,
|
|
2803
|
+
review: te ? () => tt(te.r, te.c, te.r, te.c) : void 0,
|
|
2804
|
+
undo: !0
|
|
2805
|
+
}), ur.value = u.t("sr.pasted", w), !0;
|
|
2806
|
+
}, mt = (e) => pt(mn(e)), ht = () => {
|
|
2807
|
+
navigator.clipboard?.readText().then((e) => pt(fn(e))).catch(() => {});
|
|
2808
|
+
}, gt = (e, t, n, r) => {
|
|
2809
|
+
let i = J.value, a = r < e, o = a ? e - r : r - t, s = [];
|
|
2810
|
+
for (let r = n[0]; r <= n[1]; r++) {
|
|
2811
|
+
let n = X.value[r]?.def;
|
|
2812
|
+
if (!n) continue;
|
|
2813
|
+
let c = Vn(i.slice(e, t + 1).map((e) => H.read(e, n)), o, a);
|
|
2814
|
+
for (let r = 0; r < o; r++) {
|
|
2815
|
+
let o = i[a ? e - 1 - r : t + 1 + r];
|
|
2816
|
+
o && Ye(o, n) && s.push({
|
|
2817
|
+
row: o,
|
|
2818
|
+
def: n,
|
|
2819
|
+
value: c[r]
|
|
2820
|
+
});
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
return {
|
|
2824
|
+
changes: s,
|
|
2825
|
+
count: o
|
|
2826
|
+
};
|
|
2827
|
+
}, _t = (e, t, n, r) => {
|
|
2828
|
+
let { changes: i } = gt(e, t, n, r);
|
|
2829
|
+
H.apply(i), tt(Math.min(e, r), n[0], Math.max(t, r), n[1]);
|
|
2830
|
+
}, vt = (e, t, n, r) => {
|
|
2831
|
+
let { changes: i, count: a } = gt(e, t, n, r), o = i[0], s = o ? m(o.def, o.row, o.value, et) : "";
|
|
2832
|
+
return u.t("sheet.fillPreview", {
|
|
2833
|
+
count: a * (n[1] - n[0] + 1),
|
|
2834
|
+
value: s
|
|
2835
|
+
});
|
|
2836
|
+
}, yt = () => {
|
|
2837
|
+
let e = Y.bounds.value;
|
|
2838
|
+
e && e.maxRowIndex !== e.minRowIndex && _t(e.minRowIndex, e.minRowIndex, [e.minColumnIndex, e.maxColumnIndex], e.maxRowIndex);
|
|
2839
|
+
}, bt = (e) => {
|
|
2840
|
+
if (!e) return;
|
|
2841
|
+
if (e.removed?.length && !e.patches.length) {
|
|
2842
|
+
let t = Fe.value.get(e.removed[0]);
|
|
2843
|
+
t !== void 0 && nt(t, Y.active.value?.columnId ?? X.value[0].id);
|
|
2844
|
+
return;
|
|
2845
|
+
}
|
|
2846
|
+
if (!e.patches.length) return;
|
|
2847
|
+
let t = X.value.map((e) => e.id), n = Infinity, r = -1, i = Infinity, a = -1;
|
|
2848
|
+
for (let o of e.patches) {
|
|
2849
|
+
let e = Fe.value.get(o.key), s = t.indexOf(o.col);
|
|
2850
|
+
e === void 0 || s < 0 || (n = Math.min(n, e), r = Math.max(r, e), i = Math.min(i, s), a = Math.max(a, s));
|
|
2851
|
+
}
|
|
2852
|
+
r >= 0 && tt(n, i, r, a);
|
|
2853
|
+
}, xt = () => {
|
|
2854
|
+
Z.value || (Q.cancel(), bt(H.undo()));
|
|
2855
|
+
}, St = () => {
|
|
2856
|
+
Z.value || (Q.cancel(), bt(H.redo()));
|
|
2857
|
+
}, Ct = (e, t, n) => H.set(e, t, n), wt = (e) => {
|
|
2858
|
+
if (Z.value) return;
|
|
2859
|
+
if (H.allRows.value.length + 1 > a.maxRows) {
|
|
2860
|
+
sr({ text: u.t("sheet.limitPaste", {
|
|
2861
|
+
count: f.int(H.allRows.value.length + 1),
|
|
2862
|
+
max: f.int(a.maxRows)
|
|
2863
|
+
}) });
|
|
2864
|
+
return;
|
|
2865
|
+
}
|
|
2866
|
+
Q.commit();
|
|
2867
|
+
let [t] = H.addRows(1);
|
|
2868
|
+
if (!t) return;
|
|
2869
|
+
let n = a.newRowDefaults?.() ?? {}, r = [];
|
|
2870
|
+
for (let [e, i] of Object.entries(n)) {
|
|
2871
|
+
let n = R.value.get(e);
|
|
2872
|
+
n && !g(i) && r.push({
|
|
2873
|
+
row: t.row,
|
|
2874
|
+
def: n,
|
|
2875
|
+
value: i
|
|
2876
|
+
});
|
|
2877
|
+
}
|
|
2878
|
+
if (H.apply(r, [t]), e !== void 0) {
|
|
2879
|
+
let n = G.value ?? H.batch.value.map((e) => H.keyOf(e)).filter((e) => e !== t.key), r = Math.max(0, Math.min(n.length, e));
|
|
2880
|
+
G.value = [
|
|
2881
|
+
...n.slice(0, r),
|
|
2882
|
+
t.key,
|
|
2883
|
+
...n.slice(r)
|
|
2884
|
+
];
|
|
2885
|
+
} else G.value &&= [...G.value, t.key];
|
|
2886
|
+
Se.value !== "all" && (Ce.value = /* @__PURE__ */ new Set([...Ce.value, t.key])), Y.focus(t.key, a.keyColumn), fe(() => $e.value?.scrollToIndex(J.value.findIndex((e) => H.keyOf(e) === t.key))), $e.value?.focusActive(), z.value && Q.start(t.row, z.value, { inCell: !0 });
|
|
2887
|
+
}, Tt = (e) => {
|
|
2888
|
+
let t = Y.active.value, n = t ? je.value.findIndex((e) => H.keyOf(e) === t.rowId) : -1;
|
|
2889
|
+
wt(n < 0 ? void 0 : e === "above" ? n : n + 1);
|
|
2890
|
+
}, Et = () => {
|
|
2891
|
+
if (Z.value) return;
|
|
2892
|
+
let e = Y.bounds.value;
|
|
2893
|
+
if (!e) return;
|
|
2894
|
+
Q.cancel();
|
|
2895
|
+
let t = J.value.slice(e.minRowIndex, e.maxRowIndex + 1).map((e) => H.keyOf(e));
|
|
2896
|
+
t.length && (H.removeRows(t), sr({
|
|
2897
|
+
text: t.length === 1 ? u.t("sheet.removed", {
|
|
2898
|
+
count: 1,
|
|
2899
|
+
row: H.rowNoOf(t[0]),
|
|
2900
|
+
entity: p.value
|
|
2901
|
+
}) : u.t("sheet.removed", {
|
|
2902
|
+
count: t.length,
|
|
2903
|
+
entity: p.value
|
|
2904
|
+
}),
|
|
2905
|
+
undo: !0
|
|
2906
|
+
}), nt(e.minRowIndex, Y.active.value?.columnId ?? X.value[0].id));
|
|
2907
|
+
}, Dt = (e, t) => {
|
|
2908
|
+
let n = R.value.get(e);
|
|
2909
|
+
if (!n || !(n.sortable ?? i[n.type].sortable)) return;
|
|
2910
|
+
let r = xe.value, a = r.find((t) => t.column === e), o = a ? a.dir === "asc" ? {
|
|
2911
|
+
column: e,
|
|
2912
|
+
dir: "desc"
|
|
2913
|
+
} : null : {
|
|
2914
|
+
column: e,
|
|
2915
|
+
dir: "asc"
|
|
2916
|
+
}, s = r.filter((t) => t.column !== e);
|
|
2917
|
+
if (xe.value = t ? o ? a ? r.map((t) => t.column === e ? o : t) : [...s, o].slice(-3) : s : o ? [o] : [], !xe.value.length) {
|
|
2918
|
+
G.value = null;
|
|
2919
|
+
return;
|
|
2920
|
+
}
|
|
2921
|
+
let c = xe.value.map((e) => ({
|
|
2922
|
+
def: R.value.get(e.column),
|
|
2923
|
+
cmp: ne(R.value.get(e.column), l.locale),
|
|
2924
|
+
sign: e.dir === "desc" ? -1 : 1
|
|
2925
|
+
}));
|
|
2926
|
+
G.value = [...H.batch.value].sort((e, t) => {
|
|
2927
|
+
for (let { def: n, cmp: r, sign: i } of c) {
|
|
2928
|
+
let a = r(H.read(e, n), H.read(t, n)) * i;
|
|
2929
|
+
if (a) return a;
|
|
2930
|
+
}
|
|
2931
|
+
return H.rowNoOf(H.keyOf(e)) - H.rowNoOf(H.keyOf(t));
|
|
2932
|
+
}).map((e) => H.keyOf(e));
|
|
2933
|
+
}, Ot = A(() => {
|
|
2934
|
+
let e = /* @__PURE__ */ new Map();
|
|
2935
|
+
return xe.value.forEach((t, n) => e.set(t.column, {
|
|
2936
|
+
dir: t.dir,
|
|
2937
|
+
index: xe.value.length > 1 ? n + 1 : null
|
|
2938
|
+
})), e;
|
|
2939
|
+
}), kt = /* @__PURE__ */ new Map(), At = /* @__PURE__ */ new Map(), jt, Mt = null, Nt = async () => {
|
|
2940
|
+
let e = new Map(At);
|
|
2941
|
+
if (At.clear(), e.size) {
|
|
2942
|
+
if (a.lookupKeys) {
|
|
2943
|
+
for (let t of e.keys()) H.setKeyState(t, "checking");
|
|
2944
|
+
Mt?.abort(), Mt = new AbortController();
|
|
2945
|
+
try {
|
|
2946
|
+
let t = [...new Set(e.values())].slice(0, 500), n = await a.lookupKeys(t, { signal: Mt.signal });
|
|
2947
|
+
for (let [t, r] of e) {
|
|
2948
|
+
if (kt.get(t) !== r) continue;
|
|
2949
|
+
let e = n[r];
|
|
2950
|
+
e ? (H.setKeyState(t, "update"), H.setBase(t, e)) : H.setKeyState(t, "new");
|
|
2951
|
+
}
|
|
2952
|
+
} catch {
|
|
2953
|
+
for (let t of e.keys()) H.setKeyState(t, "new");
|
|
2954
|
+
}
|
|
2955
|
+
} else for (let t of e.keys()) H.setKeyState(t, "new");
|
|
2956
|
+
}
|
|
2957
|
+
};
|
|
2958
|
+
Oe(H.version, () => {
|
|
2959
|
+
let e = z.value;
|
|
2960
|
+
if (e) {
|
|
2961
|
+
for (let t of H.batch.value) {
|
|
2962
|
+
let n = H.keyOf(t);
|
|
2963
|
+
if (!H.isNew(n)) continue;
|
|
2964
|
+
let r = H.readUntracked(t, e), i = g(r) ? "" : String(r);
|
|
2965
|
+
kt.get(n) !== i && (kt.set(n, i), i ? At.set(n, i) : H.setKeyState(n, "new"));
|
|
2966
|
+
}
|
|
2967
|
+
At.size && (clearTimeout(jt), jt = setTimeout(() => void Nt(), 300));
|
|
2968
|
+
}
|
|
2969
|
+
});
|
|
2970
|
+
let Pt = V(!1), Ft = A(() => ot.value.filter((e) => !!H.rowDraft(e)?.size || H.isNew(e)).map((e) => {
|
|
2971
|
+
let t = H.rowByKey(e), n = H.rowIssues(e), r = n ? [...n.values()].find((e) => e.level === "error") : void 0;
|
|
2972
|
+
return {
|
|
2973
|
+
rowNo: H.rowNoOf(e),
|
|
2974
|
+
key: z.value ? Sn(z.value, H.read(t, z.value)) : e,
|
|
2975
|
+
message: r?.message ?? H.rowError(e) ?? ""
|
|
2976
|
+
};
|
|
2977
|
+
})), It = U({
|
|
2978
|
+
created: 0,
|
|
2979
|
+
updated: 0,
|
|
2980
|
+
errors: 0
|
|
2981
|
+
}), Lt = U(null), Rt = U(null), zt = () => {
|
|
2982
|
+
It.value = {
|
|
2983
|
+
created: 0,
|
|
2984
|
+
updated: 0,
|
|
2985
|
+
errors: 0
|
|
2986
|
+
}, Lt.value = null, Rt.value = null, H.settleUntouched(), s("save", H.getChanges());
|
|
2987
|
+
}, Bt = () => {
|
|
2988
|
+
Z.value || (Q.commit(), ($.value.changedCells || $.value.newRows) && (Ft.value.length ? Pt.value = !0 : zt()));
|
|
2989
|
+
}, Yt = () => {
|
|
2990
|
+
ke("errors"), st(1);
|
|
2991
|
+
}, Xt = () => {
|
|
2992
|
+
let e = It.value;
|
|
2993
|
+
(e.created || e.updated || e.errors) && (e.errors ? (Rt.value = {
|
|
2994
|
+
failed: e.errors,
|
|
2995
|
+
saved: e.created + e.updated
|
|
2996
|
+
}, dr.value = u.t("sheet.partly.title", { count: f.int(e.errors) }), ke("errors"), st(1)) : (Lt.value = {
|
|
2997
|
+
count: e.created + e.updated,
|
|
2998
|
+
created: e.created,
|
|
2999
|
+
updated: e.updated
|
|
3000
|
+
}, ur.value = u.t("sheet.saved", { count: f.int(e.created + e.updated) })), It.value = {
|
|
3001
|
+
created: 0,
|
|
3002
|
+
updated: 0,
|
|
3003
|
+
errors: 0
|
|
3004
|
+
});
|
|
3005
|
+
}, Zt = -1, Qt = (e) => {
|
|
3006
|
+
let t = H.applyResult(e);
|
|
3007
|
+
Zt = H.version.value;
|
|
3008
|
+
let n = It.value;
|
|
3009
|
+
It.value = {
|
|
3010
|
+
created: n.created + t.created,
|
|
3011
|
+
updated: n.updated + t.updated,
|
|
3012
|
+
errors: n.errors + t.errors
|
|
3013
|
+
}, E.value || Xt();
|
|
3014
|
+
};
|
|
3015
|
+
Oe(E, (e) => {
|
|
3016
|
+
e || Xt();
|
|
3017
|
+
}), Oe(H.version, (e) => {
|
|
3018
|
+
e !== Zt && (Lt.value = null), Rt.value && !$.value.errorRows && (Rt.value = null);
|
|
3019
|
+
});
|
|
3020
|
+
let tn = A(() => {
|
|
3021
|
+
let e = Y.active.value, t = e ? ot.value.indexOf(e.rowId) : -1;
|
|
3022
|
+
return t < 0 ? 0 : t + 1;
|
|
3023
|
+
}), nn = () => {
|
|
3024
|
+
let e = [[
|
|
3025
|
+
u.t("sheet.err.row"),
|
|
3026
|
+
z.value?.header ?? a.keyColumn,
|
|
3027
|
+
u.t("sheet.err.column"),
|
|
3028
|
+
u.t("sheet.err.message")
|
|
3029
|
+
]];
|
|
3030
|
+
for (let t of ot.value) {
|
|
3031
|
+
let n = H.rowByKey(t), r = z.value ? Sn(z.value, H.read(n, z.value)) : t, i = H.rowError(t);
|
|
3032
|
+
i && e.push([
|
|
3033
|
+
String(H.rowNoOf(t)),
|
|
3034
|
+
r,
|
|
3035
|
+
"",
|
|
3036
|
+
i
|
|
3037
|
+
]);
|
|
3038
|
+
for (let [n, i] of H.rowIssues(t) ?? []) i.level === "error" && e.push([
|
|
3039
|
+
String(H.rowNoOf(t)),
|
|
3040
|
+
r,
|
|
3041
|
+
R.value.get(n)?.header ?? n,
|
|
3042
|
+
i.message
|
|
3043
|
+
]);
|
|
3044
|
+
}
|
|
3045
|
+
navigator.clipboard?.writeText(ln(e)).catch(() => {});
|
|
3046
|
+
}, rn = (e) => {
|
|
3047
|
+
if (!H.isNew(H.keyOf(e))) return z.value?.href?.(e) ?? ue.value?.href?.(e);
|
|
3048
|
+
}, an = V(!1), on = A(() => {
|
|
3049
|
+
H.version.value;
|
|
3050
|
+
let e = /* @__PURE__ */ new Set(), t = z.value;
|
|
3051
|
+
if (!t) return e;
|
|
3052
|
+
for (let n of H.allRows.value) {
|
|
3053
|
+
let r = H.readUntracked(n, t);
|
|
3054
|
+
g(r) || e.add(String(r));
|
|
3055
|
+
}
|
|
3056
|
+
return e;
|
|
3057
|
+
}), sn = (e) => on.value.has(e), cn = (e) => {
|
|
3058
|
+
if (Z.value || !z.value) return;
|
|
3059
|
+
Q.commit();
|
|
3060
|
+
let t = z.value, n = /* @__PURE__ */ new Map();
|
|
3061
|
+
for (let e of H.allRows.value) {
|
|
3062
|
+
let r = H.readUntracked(e, t);
|
|
3063
|
+
g(r) || n.set(String(r), e);
|
|
3064
|
+
}
|
|
3065
|
+
let r = [], i = [], o = [], s = 0, c = 0;
|
|
3066
|
+
for (let l of e.rows) {
|
|
3067
|
+
let u = n.get(l.key);
|
|
3068
|
+
if (u) s++;
|
|
3069
|
+
else {
|
|
3070
|
+
if (l.server === null && !e.addNew) continue;
|
|
3071
|
+
if (H.allRows.value.length + i.length + 1 > a.maxRows) break;
|
|
3072
|
+
let [d] = H.addRows(1);
|
|
3073
|
+
if (!d) continue;
|
|
3074
|
+
u = d.row, i.push(d), n.set(l.key, u), r.push({
|
|
3075
|
+
row: u,
|
|
3076
|
+
def: t,
|
|
3077
|
+
value: l.key
|
|
3078
|
+
}), l.server ? (o.push({
|
|
3079
|
+
key: d.key,
|
|
3080
|
+
row: l.server
|
|
3081
|
+
}), s++) : c++;
|
|
3082
|
+
}
|
|
3083
|
+
for (let [e, t] of Object.entries(l.values)) {
|
|
3084
|
+
let n = R.value.get(e);
|
|
3085
|
+
n && Ye(u, n) && r.push({
|
|
3086
|
+
row: u,
|
|
3087
|
+
def: n,
|
|
3088
|
+
value: t
|
|
3089
|
+
});
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
for (let e of o) H.setKeyState(e.key, "update"), H.setBase(e.key, e.row);
|
|
3093
|
+
H.apply(r, i), i.length && G.value && (G.value = [...G.value, ...i.map((e) => e.key)]), sr({
|
|
3094
|
+
text: u.t("import.done", {
|
|
3095
|
+
count: f.int(e.rows.length),
|
|
3096
|
+
updated: f.int(s),
|
|
3097
|
+
news: f.int(c)
|
|
3098
|
+
}),
|
|
3099
|
+
undo: !0
|
|
3100
|
+
});
|
|
3101
|
+
let l = e.rows[0]?.key, d = l ? n.get(l) : void 0, p = d ? Fe.value.get(H.keyOf(d)) : void 0;
|
|
3102
|
+
p !== void 0 && nt(p, a.keyColumn);
|
|
3103
|
+
}, un = (e, t) => {
|
|
3104
|
+
Q.commit();
|
|
3105
|
+
let n = (t === "all" ? H.allRows.value : J.value).map((e) => H.current(e));
|
|
3106
|
+
s("export", {
|
|
3107
|
+
format: e,
|
|
3108
|
+
scope: t,
|
|
3109
|
+
columns: X.value.map((e) => e.id),
|
|
3110
|
+
rows: n
|
|
3111
|
+
});
|
|
3112
|
+
}, pn = (e) => u.t(e === "all" ? "sheet.exportAll" : "sheet.exportVisible", { count: f.int(e === "all" ? H.allRows.value.length : J.value.length) }), hn = () => void navigator.clipboard?.writeText(location.href).catch(() => {}), gn = {
|
|
3113
|
+
store: H,
|
|
3114
|
+
table: Y,
|
|
3115
|
+
edit: Q,
|
|
3116
|
+
canEdit: Ye,
|
|
3117
|
+
editorFor: Je,
|
|
3118
|
+
toggle: it,
|
|
3119
|
+
clearCells: at,
|
|
3120
|
+
save: Bt,
|
|
3121
|
+
goToError: st,
|
|
3122
|
+
copy: ut,
|
|
3123
|
+
cut: dt,
|
|
3124
|
+
paste: mt,
|
|
3125
|
+
fill: _t,
|
|
3126
|
+
fillLabel: vt,
|
|
3127
|
+
fillDown: yt,
|
|
3128
|
+
undo: xt,
|
|
3129
|
+
redo: St,
|
|
3130
|
+
useSuggestion: Ct,
|
|
3131
|
+
copyToClipboard: ft,
|
|
3132
|
+
pasteFromClipboard: ht,
|
|
3133
|
+
insertRow: Tt,
|
|
3134
|
+
removeSelectedRows: Et,
|
|
3135
|
+
sort: Dt,
|
|
3136
|
+
openHref: rn
|
|
3137
|
+
}, vn = (e) => {
|
|
3138
|
+
Q.editing.value && (e.target?.closest(".dt-cell.is-editing, .dt-formula, .dt-sheet-layer") || Q.commit());
|
|
3139
|
+
}, yn = () => $.value.changedCells > 0 || $.value.newRows > 0, bn = (e) => {
|
|
3140
|
+
yn() && (e.preventDefault(), e.returnValue = "");
|
|
3141
|
+
};
|
|
3142
|
+
ge(() => {
|
|
3143
|
+
document.addEventListener("pointerdown", vn, !0), window.addEventListener("beforeunload", bn);
|
|
3144
|
+
}), he(() => {
|
|
3145
|
+
document.removeEventListener("pointerdown", vn, !0), window.removeEventListener("beforeunload", bn), clearTimeout(or), clearTimeout(jt), Mt?.abort();
|
|
3146
|
+
});
|
|
3147
|
+
let Cn = we("findBox"), wn = (e) => {
|
|
3148
|
+
if (e.defaultPrevented || !(e.metaKey || e.ctrlKey)) return;
|
|
3149
|
+
let t = e.key.toLowerCase();
|
|
3150
|
+
t === "s" ? (e.preventDefault(), Bt()) : t === "f" && !T.value && (e.preventDefault(), Cn.value?.focus());
|
|
3151
|
+
}, Tn = (e) => e.toLocaleLowerCase(l.locale), En = V(""), Dn = V(0), An = A(() => {
|
|
3152
|
+
let e = Tn(En.value.trim());
|
|
3153
|
+
if (!e) return null;
|
|
3154
|
+
H.version.value;
|
|
3155
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = J.value, i = X.value;
|
|
3156
|
+
for (let a = 0; a < r.length; a++) {
|
|
3157
|
+
let o = r[a];
|
|
3158
|
+
for (let r = 0; r < i.length; r++) {
|
|
3159
|
+
let s = i[r].def, c = H.readUntracked(o, s);
|
|
3160
|
+
if (g(c) || !Tn(m(s, o, c, et)).includes(e)) continue;
|
|
3161
|
+
let l = H.keyOf(o), u = t.get(l);
|
|
3162
|
+
u || t.set(l, u = /* @__PURE__ */ new Set()), u.add(s.id), n.push({
|
|
3163
|
+
r: a,
|
|
3164
|
+
c: r
|
|
3165
|
+
});
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
return {
|
|
3169
|
+
map: t,
|
|
3170
|
+
list: n
|
|
3171
|
+
};
|
|
3172
|
+
}), jn = (e) => {
|
|
3173
|
+
let t = An.value?.list[e];
|
|
3174
|
+
if (!t) return;
|
|
3175
|
+
Dn.value = e;
|
|
3176
|
+
let n = J.value[t.r];
|
|
3177
|
+
Y.focus(H.keyOf(n), X.value[t.c].id), $e.value?.scrollToIndex(t.r);
|
|
3178
|
+
};
|
|
3179
|
+
Oe(() => An.value?.list.length ?? 0, () => jn(0));
|
|
3180
|
+
let Nn = (e) => {
|
|
3181
|
+
let t = An.value?.list.length ?? 0;
|
|
3182
|
+
t && jn(((Dn.value + e) % t + t) % t);
|
|
3183
|
+
}, Pn = (e) => {
|
|
3184
|
+
e.key === "Enter" ? (e.preventDefault(), Nn(e.shiftKey ? -1 : 1)) : e.key === "Escape" && !En.value && (e.preventDefault(), $e.value?.focusActive());
|
|
3185
|
+
}, Fn = A(() => An.value ? u.t("sheet.findCount", {
|
|
3186
|
+
index: An.value.list.length ? Dn.value + 1 : 0,
|
|
3187
|
+
total: An.value.list.length
|
|
3188
|
+
}) : ""), In = A(() => ({
|
|
3189
|
+
all: H.allRows.value.length,
|
|
3190
|
+
changed: $.value.changedOrNewRows,
|
|
3191
|
+
errors: $.value.errorRows
|
|
3192
|
+
})), zn = A(() => {
|
|
3193
|
+
let e = Y.active.value;
|
|
3194
|
+
return e ? H.rowByKey(e.rowId) ?? null : null;
|
|
3195
|
+
}), Hn = A(() => {
|
|
3196
|
+
let e = Y.active.value;
|
|
3197
|
+
return e ? R.value.get(e.columnId) ?? null : null;
|
|
3198
|
+
}), Un = A(() => {
|
|
3199
|
+
let e = Y.bounds.value;
|
|
3200
|
+
if (!e) return null;
|
|
3201
|
+
let t = e.maxRowIndex - e.minRowIndex + 1, n = e.maxColumnIndex - e.minColumnIndex + 1;
|
|
3202
|
+
return t * n > 1 ? {
|
|
3203
|
+
rows: t,
|
|
3204
|
+
cols: n
|
|
3205
|
+
} : null;
|
|
3206
|
+
}), Wn = A(() => Un.value ? u.t("sheet.cells", Un.value) : null), Gn = A(() => zn.value && z.value ? Sn(z.value, H.read(zn.value, z.value)) : ""), Kn = A(() => {
|
|
3207
|
+
let e = Q.editing.value;
|
|
3208
|
+
return e ? e.text ?? Sn(e.def, e.value) : zn.value && Hn.value ? Sn(Hn.value, H.read(zn.value, Hn.value)) : "";
|
|
3209
|
+
}), qn = A(() => !!zn.value && !!Hn.value && Hn.value.type !== "boolean" && Ye(zn.value, Hn.value)), Jn = (e) => {
|
|
3210
|
+
let t = e.target.value, n = zn.value, r = Hn.value;
|
|
3211
|
+
n && r && qn.value && (Q.editing.value || Q.start(n, r, { inCell: !1 })) && Q.setValue(xn(r, t, Qe()), t, !1);
|
|
3212
|
+
}, Yn = (e) => {
|
|
3213
|
+
e.key === "Enter" ? (e.preventDefault(), Q.commit() && Y.move("down"), $e.value?.focusActive()) : e.key === "Escape" && (e.preventDefault(), Q.cancel(), $e.value?.focusActive());
|
|
3214
|
+
}, Xn = A(() => {
|
|
3215
|
+
let e = Hn.value;
|
|
3216
|
+
if (!e) return "";
|
|
3217
|
+
let t = [u.t(o(e.type))];
|
|
3218
|
+
return e.type === "currency" && typeof e.currency == "string" && t.push(e.currency), e.required && t.push(u.t("sheet.required").toLocaleLowerCase(l.locale)), e.hint && t.push(e.hint), t.join(" · ");
|
|
3219
|
+
}), Zn = A(() => Hn.value ? u.t("sheet.valueAria", {
|
|
3220
|
+
column: Hn.value.header,
|
|
3221
|
+
key: Gn.value
|
|
3222
|
+
}) : ""), Qn = A(() => {
|
|
3223
|
+
H.version.value;
|
|
3224
|
+
let e = Y.bounds.value;
|
|
3225
|
+
if (!e || !Un.value) return null;
|
|
3226
|
+
let t = 0, n = 0, r = 0;
|
|
3227
|
+
for (let a = e.minRowIndex; a <= e.maxRowIndex; a++) {
|
|
3228
|
+
let o = J.value[a];
|
|
3229
|
+
if (o) for (let a = e.minColumnIndex; a <= e.maxColumnIndex; a++) {
|
|
3230
|
+
let e = X.value[a].def, s = H.readUntracked(o, e);
|
|
3231
|
+
g(s) || (t++, i[e.type].numeric && typeof s == "number" && (n += s, r++));
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
return {
|
|
3235
|
+
count: t,
|
|
3236
|
+
sum: r ? f.decimal(n, 2) : null,
|
|
3237
|
+
avg: r ? f.decimal(n / r, 2) : null
|
|
3238
|
+
};
|
|
3239
|
+
}), $n = A(() => ({
|
|
3240
|
+
phase: T.value ? "loading" : E.value ? "saving" : Rt.value ? "partly-saved" : Lt.value ? "saved" : "ready",
|
|
3241
|
+
...$.value
|
|
3242
|
+
})), er = A(() => $.value.changedCells ? u.t("sheet.changes", {
|
|
3243
|
+
cells: f.int($.value.changedCells),
|
|
3244
|
+
rows: f.int($.value.changedRows)
|
|
3245
|
+
}) : u.t("sheet.noChanges")), tr = `${u.t("sheet.save")} · ${v}`, nr = `${u.t("common.undo")} (${se})`, rr = `${u.t("common.redo")} (${ae})`, ir = A(() => !Z.value && ($.value.changedCells > 0 || $.value.newRows > 0)), ar = U(null), or, sr = (e) => {
|
|
3246
|
+
ar.value = e, clearTimeout(or), or = setTimeout(() => ar.value = null, 6e3);
|
|
3247
|
+
}, cr = () => {
|
|
3248
|
+
ar.value = null, xt();
|
|
3249
|
+
}, lr = () => {
|
|
3250
|
+
let e = ar.value?.action?.run;
|
|
3251
|
+
ar.value = null, e?.();
|
|
3252
|
+
}, ur = V(""), dr = V(""), fr = -1;
|
|
3253
|
+
Oe(oe, (e) => {
|
|
3254
|
+
if (e === null) {
|
|
3255
|
+
fr = -1;
|
|
3256
|
+
return;
|
|
3257
|
+
}
|
|
3258
|
+
let t = Math.floor(e / 25);
|
|
3259
|
+
t !== fr && e !== 0 && (fr = t, ur.value = u.t(T.value ? "sr.loadingPercent" : "sr.savingPercent", { percent: t * 25 }));
|
|
3260
|
+
});
|
|
3261
|
+
let pr = V(!1), mr = () => {
|
|
3262
|
+
Q.cancel(), H.reset(), G.value = null, xe.value = [], Rt.value = null, Lt.value = null, kt.clear(), At.clear(), $e.value?.focusActive();
|
|
3263
|
+
}, hr = A(() => ({
|
|
3264
|
+
density: x.value,
|
|
3265
|
+
verticalLines: b.prefs.verticalLines,
|
|
3266
|
+
columns: Me.panel.value,
|
|
3267
|
+
counts: Me.counts.value,
|
|
3268
|
+
persistent: b.persistent
|
|
3269
|
+
})), gr = {
|
|
3270
|
+
"update:density": (e) => b.set({ density: e }),
|
|
3271
|
+
"update:verticalLines": (e) => b.set({ verticalLines: e }),
|
|
3272
|
+
"column-visible": (e, t) => Me.setVisible(e, t),
|
|
3273
|
+
"column-move": (e, t) => Me.move(e, t),
|
|
3274
|
+
"columns-all": (e) => {
|
|
3275
|
+
for (let t of Me.panel.value) !t.pinned && t.canHide && Me.setVisible(t.id, e);
|
|
3276
|
+
},
|
|
3277
|
+
"columns-reset": () => Me.reset(),
|
|
3278
|
+
reset: () => b.reset()
|
|
3279
|
+
}, _r = V(null), vr = ie(_r);
|
|
3280
|
+
return n({
|
|
3281
|
+
status: $n,
|
|
3282
|
+
isDirty: yn,
|
|
3283
|
+
getChanges: H.getChanges,
|
|
3284
|
+
applyResult: Qt,
|
|
3285
|
+
reset: mr,
|
|
3286
|
+
undo: xt,
|
|
3287
|
+
redo: St,
|
|
3288
|
+
goToNextError: () => st(1)
|
|
3289
|
+
}), (e, n) => (B(), N("div", {
|
|
3290
|
+
ref_key: "rootEl",
|
|
3291
|
+
ref: _r,
|
|
3292
|
+
class: pe(["dt dt-sheet", { "is-phone": K(O) }]),
|
|
3293
|
+
"data-density": x.value,
|
|
3294
|
+
onKeydown: wn
|
|
3295
|
+
}, [
|
|
3296
|
+
K(O) ? (B(), N("div", Mi, [I(K(Ke), {
|
|
3297
|
+
size: 20,
|
|
3298
|
+
"aria-hidden": "true"
|
|
3299
|
+
}), P("div", Ni, [
|
|
3300
|
+
P("strong", null, W(K(u).t("sheet.readOnly.title")), 1),
|
|
3301
|
+
P("span", null, W(K(u).t("sheet.readOnly.body", { entity: p.value })), 1),
|
|
3302
|
+
P("button", {
|
|
3303
|
+
type: "button",
|
|
3304
|
+
class: "dt-btn has-icon",
|
|
3305
|
+
onClick: hn
|
|
3306
|
+
}, [I(K(We), {
|
|
3307
|
+
size: 16,
|
|
3308
|
+
"aria-hidden": "true"
|
|
3309
|
+
}), F(" " + W(K(u).t("common.copyLink")), 1)])
|
|
3310
|
+
])])) : M("", !0),
|
|
3311
|
+
P("div", Pi, [
|
|
3312
|
+
T.value || E.value ? (B(), N("div", Fi, [
|
|
3313
|
+
P("strong", null, W(T.value ? K(u).t("sheet.loading", { entity: p.value }) : D.value ? K(u).t("sheet.saving", {
|
|
3314
|
+
sent: K(f).int(D.value.done),
|
|
3315
|
+
total: K(f).int(D.value.total)
|
|
3316
|
+
}) : K(u).t("sheet.savingIndeterminate")), 1),
|
|
3317
|
+
T.value && D.value ? (B(), N("span", Ii, W(K(u).t("sheet.loadingCount", {
|
|
3318
|
+
loaded: K(f).int(D.value.done),
|
|
3319
|
+
total: K(f).int(D.value.total)
|
|
3320
|
+
})), 1)) : M("", !0),
|
|
3321
|
+
P("div", {
|
|
3322
|
+
class: pe(["dt-progress", { "is-indeterminate": oe.value === null }]),
|
|
3323
|
+
role: "progressbar",
|
|
3324
|
+
"aria-valuemin": "0",
|
|
3325
|
+
"aria-valuemax": "100",
|
|
3326
|
+
"aria-valuenow": oe.value ?? void 0
|
|
3327
|
+
}, [P("div", {
|
|
3328
|
+
class: "dt-progress-fill",
|
|
3329
|
+
style: me(oe.value === null ? void 0 : { width: `${oe.value}%` })
|
|
3330
|
+
}, null, 4)], 10, Li)
|
|
3331
|
+
])) : K(O) ? (B(), N("div", {
|
|
3332
|
+
key: 1,
|
|
3333
|
+
class: "dt-find",
|
|
3334
|
+
onKeydown: Pn
|
|
3335
|
+
}, [I(C, {
|
|
3336
|
+
ref_key: "findBox",
|
|
3337
|
+
ref: Cn,
|
|
3338
|
+
"model-value": En.value,
|
|
3339
|
+
placeholder: K(u).t("sheet.find"),
|
|
3340
|
+
kbd: K(S),
|
|
3341
|
+
"onUpdate:modelValue": n[0] ||= (e) => En.value = e
|
|
3342
|
+
}, null, 8, [
|
|
3343
|
+
"model-value",
|
|
3344
|
+
"placeholder",
|
|
3345
|
+
"kbd"
|
|
3346
|
+
]), Fn.value ? (B(), N("span", Ri, W(Fn.value), 1)) : M("", !0)], 32)) : (B(), N(k, { key: 2 }, [
|
|
3347
|
+
P("div", {
|
|
3348
|
+
class: "dt-find",
|
|
3349
|
+
onKeydown: Pn
|
|
3350
|
+
}, [I(C, {
|
|
3351
|
+
ref_key: "findBox",
|
|
3352
|
+
ref: Cn,
|
|
3353
|
+
"model-value": En.value,
|
|
3354
|
+
placeholder: K(u).t("sheet.find"),
|
|
3355
|
+
kbd: K(S),
|
|
3356
|
+
"onUpdate:modelValue": n[1] ||= (e) => En.value = e
|
|
3357
|
+
}, null, 8, [
|
|
3358
|
+
"model-value",
|
|
3359
|
+
"placeholder",
|
|
3360
|
+
"kbd"
|
|
3361
|
+
]), Fn.value ? (B(), N("span", zi, W(Fn.value), 1)) : M("", !0)], 32),
|
|
3362
|
+
n[16] ||= P("span", {
|
|
3363
|
+
class: "dt-toolbar-sep",
|
|
3364
|
+
"aria-hidden": "true"
|
|
3365
|
+
}, null, -1),
|
|
3366
|
+
I(K(en), {
|
|
3367
|
+
class: "dt-seg dt-sheet-views",
|
|
3368
|
+
type: "single",
|
|
3369
|
+
"model-value": Se.value,
|
|
3370
|
+
"aria-label": K(u).t("sheet.showRows"),
|
|
3371
|
+
"onUpdate:modelValue": n[2] ||= (e) => e && ke(e)
|
|
3372
|
+
}, {
|
|
3373
|
+
default: q(() => [
|
|
3374
|
+
I(K($t), {
|
|
3375
|
+
class: "dt-seg-item",
|
|
3376
|
+
value: "all"
|
|
3377
|
+
}, {
|
|
3378
|
+
default: q(() => [F(W(K(u).t("sheet.all")) + " ", 1), P("span", Bi, W(K(f).int(In.value.all)), 1)]),
|
|
3379
|
+
_: 1
|
|
3380
|
+
}),
|
|
3381
|
+
I(K($t), {
|
|
3382
|
+
class: "dt-seg-item",
|
|
3383
|
+
value: "changed"
|
|
3384
|
+
}, {
|
|
3385
|
+
default: q(() => [F(W(K(u).t("sheet.changed")) + " ", 1), P("span", Vi, W(K(f).int(In.value.changed)), 1)]),
|
|
3386
|
+
_: 1
|
|
3387
|
+
}),
|
|
3388
|
+
I(K($t), {
|
|
3389
|
+
class: pe(["dt-seg-item", { "is-errors": In.value.errors > 0 }]),
|
|
3390
|
+
value: "errors"
|
|
3391
|
+
}, {
|
|
3392
|
+
default: q(() => [F(W(K(u).t("sheet.errors")) + " ", 1), P("span", Hi, W(K(f).int(In.value.errors)), 1)]),
|
|
3393
|
+
_: 1
|
|
3394
|
+
}, 8, ["class"])
|
|
3395
|
+
]),
|
|
3396
|
+
_: 1
|
|
3397
|
+
}, 8, ["model-value", "aria-label"]),
|
|
3398
|
+
P("button", {
|
|
3399
|
+
type: "button",
|
|
3400
|
+
class: "dt-btn dt-sheet-undo",
|
|
3401
|
+
"aria-disabled": K(H).canUndo.value ? void 0 : "true",
|
|
3402
|
+
"aria-label": nr,
|
|
3403
|
+
"data-dt-tip": nr,
|
|
3404
|
+
onClick: n[3] ||= (e) => K(H).canUndo.value && xt()
|
|
3405
|
+
}, [I(K(Ne), {
|
|
3406
|
+
size: 16,
|
|
3407
|
+
"aria-hidden": "true"
|
|
3408
|
+
})], 8, Ui),
|
|
3409
|
+
P("button", {
|
|
3410
|
+
type: "button",
|
|
3411
|
+
class: "dt-btn dt-sheet-undo",
|
|
3412
|
+
"aria-disabled": K(H).canRedo.value ? void 0 : "true",
|
|
3413
|
+
"aria-label": rr,
|
|
3414
|
+
"data-dt-tip": rr,
|
|
3415
|
+
onClick: n[4] ||= (e) => K(H).canRedo.value && St()
|
|
3416
|
+
}, [I(K(Pe), {
|
|
3417
|
+
size: 16,
|
|
3418
|
+
"aria-hidden": "true"
|
|
3419
|
+
})], 8, Wi),
|
|
3420
|
+
n[17] ||= P("span", {
|
|
3421
|
+
class: "dt-toolbar-sep",
|
|
3422
|
+
"aria-hidden": "true"
|
|
3423
|
+
}, null, -1),
|
|
3424
|
+
P("button", {
|
|
3425
|
+
type: "button",
|
|
3426
|
+
class: "dt-btn dt-btn-ghost has-icon dt-sheet-add",
|
|
3427
|
+
onClick: n[5] ||= (e) => wt()
|
|
3428
|
+
}, [I(K(qe), {
|
|
3429
|
+
size: 16,
|
|
3430
|
+
"aria-hidden": "true"
|
|
3431
|
+
}), F(" " + W(K(u).t("sheet.addRow")), 1)]),
|
|
3432
|
+
t.parseFile ? (B(), N("button", {
|
|
3433
|
+
key: 0,
|
|
3434
|
+
type: "button",
|
|
3435
|
+
class: "dt-btn dt-btn-ghost has-icon dt-sheet-import",
|
|
3436
|
+
onClick: n[6] ||= (e) => an.value = !0
|
|
3437
|
+
}, [I(K(Ve), {
|
|
3438
|
+
size: 16,
|
|
3439
|
+
"aria-hidden": "true"
|
|
3440
|
+
}), F(" " + W(K(u).t("sheet.import")), 1)])) : M("", !0),
|
|
3441
|
+
I(K(Wt), null, {
|
|
3442
|
+
default: q(() => [I(K(Jt), { "as-child": "" }, {
|
|
3443
|
+
default: q(() => [P("button", Gi, [I(K(He), {
|
|
3444
|
+
size: 16,
|
|
3445
|
+
"aria-hidden": "true"
|
|
3446
|
+
}), F(" " + W(K(u).t("sheet.export")), 1)])]),
|
|
3447
|
+
_: 1
|
|
3448
|
+
}), I(K(Ut), null, {
|
|
3449
|
+
default: q(() => [I(K(Vt), {
|
|
3450
|
+
class: "dt-menu",
|
|
3451
|
+
align: "start",
|
|
3452
|
+
"side-offset": 4
|
|
3453
|
+
}, {
|
|
3454
|
+
default: q(() => [(B(), N(k, null, ve(["all", "visible"], (e) => I(K(Gt), { key: e }, {
|
|
3455
|
+
default: q(() => [I(K(qt), { class: "dt-menu-item" }, {
|
|
3456
|
+
default: q(() => [F(W(pn(e)), 1)]),
|
|
3457
|
+
_: 2
|
|
3458
|
+
}, 1024), I(K(Ut), null, {
|
|
3459
|
+
default: q(() => [I(K(Kt), {
|
|
3460
|
+
class: "dt-menu",
|
|
3461
|
+
"side-offset": 4
|
|
3462
|
+
}, {
|
|
3463
|
+
default: q(() => [I(K(Ht), {
|
|
3464
|
+
class: "dt-menu-item",
|
|
3465
|
+
onSelect: (t) => un("xlsx", e)
|
|
3466
|
+
}, {
|
|
3467
|
+
default: q(() => [F(W(K(u).t("toolbar.xlsx")), 1)]),
|
|
3468
|
+
_: 1
|
|
3469
|
+
}, 8, ["onSelect"]), I(K(Ht), {
|
|
3470
|
+
class: "dt-menu-item",
|
|
3471
|
+
onSelect: (t) => un("csv", e)
|
|
3472
|
+
}, {
|
|
3473
|
+
default: q(() => [F(W(K(u).t("toolbar.csv")), 1)]),
|
|
3474
|
+
_: 1
|
|
3475
|
+
}, 8, ["onSelect"])]),
|
|
3476
|
+
_: 2
|
|
3477
|
+
}, 1024)]),
|
|
3478
|
+
_: 2
|
|
3479
|
+
}, 1024)]),
|
|
3480
|
+
_: 2
|
|
3481
|
+
}, 1024)), 64))]),
|
|
3482
|
+
_: 1
|
|
3483
|
+
})]),
|
|
3484
|
+
_: 1
|
|
3485
|
+
})]),
|
|
3486
|
+
_: 1
|
|
3487
|
+
}),
|
|
3488
|
+
I(_, de(hr.value, be(gr)), null, 16)
|
|
3489
|
+
], 64)),
|
|
3490
|
+
n[18] ||= P("span", { class: "dt-toolbar-spacer" }, null, -1),
|
|
3491
|
+
K(O) ? (B(), N(k, { key: 3 }, [], 64)) : E.value ? M("", !0) : (B(), N("span", {
|
|
3492
|
+
key: 4,
|
|
3493
|
+
class: pe(["dt-sheet-changes", { "is-empty": !K($).changedCells }])
|
|
3494
|
+
}, [
|
|
3495
|
+
K($).changedCells ? (B(), N("span", Ki)) : M("", !0),
|
|
3496
|
+
F(" " + W(er.value) + " ", 1),
|
|
3497
|
+
K($).newRows ? (B(), N(k, { key: 1 }, [F("· " + W(K(u).t("sheet.newShort", { count: K($).newRows })), 1)], 64)) : M("", !0)
|
|
3498
|
+
], 2)),
|
|
3499
|
+
K(O) ? M("", !0) : (B(), N("button", {
|
|
3500
|
+
key: 5,
|
|
3501
|
+
type: "button",
|
|
3502
|
+
class: "dt-btn dt-btn-ghost",
|
|
3503
|
+
disabled: E.value || !K($).changedCells && !K($).newRows,
|
|
3504
|
+
onClick: n[7] ||= (e) => pr.value = !0
|
|
3505
|
+
}, W(K(u).t("sheet.discard")), 9, qi)),
|
|
3506
|
+
K(O) ? M("", !0) : (B(), N("button", {
|
|
3507
|
+
key: 6,
|
|
3508
|
+
type: "button",
|
|
3509
|
+
class: "dt-btn dt-btn-primary has-icon dt-sheet-save",
|
|
3510
|
+
disabled: !E.value && !ir.value,
|
|
3511
|
+
"aria-disabled": E.value ? "true" : void 0,
|
|
3512
|
+
"data-dt-tip": E.value ? void 0 : tr,
|
|
3513
|
+
onClick: n[8] ||= (e) => !E.value && Bt()
|
|
3514
|
+
}, [E.value ? (B(), j(K(ze), {
|
|
3515
|
+
key: 0,
|
|
3516
|
+
size: 16,
|
|
3517
|
+
class: "dt-spin",
|
|
3518
|
+
"aria-hidden": "true"
|
|
3519
|
+
})) : (B(), j(K(Re), {
|
|
3520
|
+
key: 1,
|
|
3521
|
+
size: 16,
|
|
3522
|
+
"aria-hidden": "true"
|
|
3523
|
+
})), F(" " + W(E.value ? K(u).t("sheet.savingButton") : K(u).t("sheet.save")), 1)], 8, Ji))
|
|
3524
|
+
]),
|
|
3525
|
+
Rt.value ? (B(), N("div", Yi, [
|
|
3526
|
+
I(K(Ze), {
|
|
3527
|
+
size: 16,
|
|
3528
|
+
"aria-hidden": "true"
|
|
3529
|
+
}),
|
|
3530
|
+
P("span", null, [P("strong", null, W(K(u).t("sheet.partly.title", { count: K(f).int(Rt.value.failed) })), 1), F(" " + W(K(u).t("sheet.partly.body", { count: K(f).int(Rt.value.saved) })), 1)]),
|
|
3531
|
+
n[19] ||= P("span", { class: "dt-partly-spacer" }, null, -1),
|
|
3532
|
+
P("span", Xi, [
|
|
3533
|
+
P("button", {
|
|
3534
|
+
type: "button",
|
|
3535
|
+
class: "dt-partly-btn",
|
|
3536
|
+
"aria-label": K(u).t("sheet.prevError"),
|
|
3537
|
+
onClick: n[9] ||= (e) => st(-1)
|
|
3538
|
+
}, [I(K(Le), {
|
|
3539
|
+
size: 14,
|
|
3540
|
+
"aria-hidden": "true"
|
|
3541
|
+
})], 8, Zi),
|
|
3542
|
+
P("span", null, W(K(u).t("sheet.findCount", {
|
|
3543
|
+
index: tn.value,
|
|
3544
|
+
total: ot.value.length
|
|
3545
|
+
})), 1),
|
|
3546
|
+
P("button", {
|
|
3547
|
+
type: "button",
|
|
3548
|
+
class: "dt-partly-btn",
|
|
3549
|
+
"aria-label": K(u).t("sheet.nextError"),
|
|
3550
|
+
onClick: n[10] ||= (e) => st(1)
|
|
3551
|
+
}, [I(K(Ie), {
|
|
3552
|
+
size: 14,
|
|
3553
|
+
"aria-hidden": "true"
|
|
3554
|
+
})], 8, Qi)
|
|
3555
|
+
]),
|
|
3556
|
+
n[20] ||= P("span", {
|
|
3557
|
+
class: "dt-partly-sep",
|
|
3558
|
+
"aria-hidden": "true"
|
|
3559
|
+
}, null, -1),
|
|
3560
|
+
P("button", {
|
|
3561
|
+
type: "button",
|
|
3562
|
+
class: "dt-partly-copy",
|
|
3563
|
+
onClick: nn
|
|
3564
|
+
}, [I(K(Be), {
|
|
3565
|
+
size: 14,
|
|
3566
|
+
"aria-hidden": "true"
|
|
3567
|
+
}), F(" " + W(K(u).t("sheet.copyErrors")), 1)])
|
|
3568
|
+
])) : M("", !0),
|
|
3569
|
+
ee.value ? (B(), N("div", $i, [I(K(Xe), {
|
|
3570
|
+
size: 16,
|
|
3571
|
+
"aria-hidden": "true"
|
|
3572
|
+
}), P("span", null, W(K(u).t("sheet.firstN", {
|
|
3573
|
+
max: K(f).int(t.maxRows),
|
|
3574
|
+
entity: p.value
|
|
3575
|
+
})), 1)])) : M("", !0),
|
|
3576
|
+
K(O) ? M("", !0) : (B(), N("div", ea, [
|
|
3577
|
+
P("div", ta, [Wn.value ? (B(), N(k, { key: 0 }, [F(W(Wn.value), 1)], 64)) : Hn.value ? (B(), N(k, { key: 1 }, [P("span", na, W(Gn.value), 1), P("span", ra, "· " + W(Hn.value.header), 1)], 64)) : M("", !0)]),
|
|
3578
|
+
n[21] ||= P("span", {
|
|
3579
|
+
class: "dt-formula-fx",
|
|
3580
|
+
"aria-hidden": "true"
|
|
3581
|
+
}, "fx", -1),
|
|
3582
|
+
P("input", {
|
|
3583
|
+
class: "dt-formula-value",
|
|
3584
|
+
type: "text",
|
|
3585
|
+
value: Kn.value,
|
|
3586
|
+
readonly: !qn.value,
|
|
3587
|
+
"aria-label": Zn.value,
|
|
3588
|
+
autocomplete: "off",
|
|
3589
|
+
onInput: Jn,
|
|
3590
|
+
onKeydown: Yn
|
|
3591
|
+
}, null, 40, ia),
|
|
3592
|
+
E.value ? (B(), N("span", aa, [I(K(Ge), {
|
|
3593
|
+
size: 12,
|
|
3594
|
+
"aria-hidden": "true"
|
|
3595
|
+
}), F(" " + W(K(u).t("sheet.savingReadOnly")), 1)])) : Xn.value ? (B(), N("span", oa, W(Xn.value), 1)) : M("", !0)
|
|
3596
|
+
])),
|
|
3597
|
+
I(xi, {
|
|
3598
|
+
ref_key: "grid",
|
|
3599
|
+
ref: $e,
|
|
3600
|
+
sheet: gn,
|
|
3601
|
+
layout: K(Me),
|
|
3602
|
+
rows: J.value,
|
|
3603
|
+
density: x.value,
|
|
3604
|
+
label: p.value.other,
|
|
3605
|
+
entity: p.value,
|
|
3606
|
+
loading: T.value,
|
|
3607
|
+
skeleton: T.value,
|
|
3608
|
+
"read-only": E.value,
|
|
3609
|
+
"vertical-lines": K(b).prefs.verticalLines,
|
|
3610
|
+
"key-column": t.keyColumn,
|
|
3611
|
+
found: An.value?.map ?? null,
|
|
3612
|
+
sort: Ot.value,
|
|
3613
|
+
phone: K(O)
|
|
3614
|
+
}, le({ _: 2 }, [!T.value && J.value.length === 0 ? {
|
|
3615
|
+
name: "state",
|
|
3616
|
+
fn: q(() => [ye(e.$slots, "empty", {}, () => [I(y, {
|
|
3617
|
+
kind: "empty",
|
|
3618
|
+
title: K(u).t("state.emptyTitle", { entity: p.value })
|
|
3619
|
+
}, null, 8, ["title"])])]),
|
|
3620
|
+
key: "0"
|
|
3621
|
+
} : void 0]), 1032, [
|
|
3622
|
+
"layout",
|
|
3623
|
+
"rows",
|
|
3624
|
+
"density",
|
|
3625
|
+
"label",
|
|
3626
|
+
"entity",
|
|
3627
|
+
"loading",
|
|
3628
|
+
"skeleton",
|
|
3629
|
+
"read-only",
|
|
3630
|
+
"vertical-lines",
|
|
3631
|
+
"key-column",
|
|
3632
|
+
"found",
|
|
3633
|
+
"sort",
|
|
3634
|
+
"phone"
|
|
3635
|
+
]),
|
|
3636
|
+
K(O) ? (B(), N("div", sa, [
|
|
3637
|
+
P("span", null, W(K(u).t("sheet.readOnly.total", {
|
|
3638
|
+
count: K(f).int(K(H).allRows.value.length),
|
|
3639
|
+
entity: p.value
|
|
3640
|
+
})), 1),
|
|
3641
|
+
n[22] ||= P("span", { "aria-hidden": "true" }, "·", -1),
|
|
3642
|
+
P("span", ca, [I(K(Ge), {
|
|
3643
|
+
size: 14,
|
|
3644
|
+
"aria-hidden": "true"
|
|
3645
|
+
}), F(" " + W(K(u).t("sheet.readOnly.badge")), 1)])
|
|
3646
|
+
])) : (B(), N("div", {
|
|
3647
|
+
key: 5,
|
|
3648
|
+
class: "dt-status",
|
|
3649
|
+
role: "status",
|
|
3650
|
+
"aria-label": K(u).t("sheet.statusAria")
|
|
3651
|
+
}, [P("span", ua, W(T.value ? K(u).t("common.loading") : K(u).t("sheet.rows", { count: K(f).int(K(H).allRows.value.length) })), 1), T.value ? M("", !0) : (B(), N(k, { key: 0 }, [
|
|
3652
|
+
Lt.value ? (B(), N("span", da, [
|
|
3653
|
+
I(K(Re), {
|
|
3654
|
+
size: 14,
|
|
3655
|
+
"aria-hidden": "true"
|
|
3656
|
+
}),
|
|
3657
|
+
P("strong", null, W(K(u).t("sheet.saved", { count: K(f).int(Lt.value.count) })), 1),
|
|
3658
|
+
P("span", null, " · " + W(K(u).t("sheet.savedDetail", {
|
|
3659
|
+
created: K(f).int(Lt.value.created),
|
|
3660
|
+
updated: K(f).int(Lt.value.updated)
|
|
3661
|
+
})), 1)
|
|
3662
|
+
])) : K($).changedCells ? (B(), N("span", fa, [n[23] ||= P("span", {
|
|
3663
|
+
class: "dt-mark is-changed",
|
|
3664
|
+
"aria-hidden": "true"
|
|
3665
|
+
}, null, -1), F(" " + W(er.value), 1)])) : (B(), N("span", pa, W(er.value), 1)),
|
|
3666
|
+
K($).newRows ? (B(), N("span", ma, W(K(u).t("sheet.newRows", { count: K($).newRows })), 1)) : M("", !0),
|
|
3667
|
+
K($).errorRows ? (B(), N("button", {
|
|
3668
|
+
key: 4,
|
|
3669
|
+
type: "button",
|
|
3670
|
+
class: "dt-status-errors",
|
|
3671
|
+
onClick: n[11] ||= (e) => st(1)
|
|
3672
|
+
}, [n[24] ||= P("span", {
|
|
3673
|
+
class: "dt-mark is-error",
|
|
3674
|
+
"aria-hidden": "true"
|
|
3675
|
+
}, null, -1), F(" " + W(K(u).t("sheet.errorsGoTo", { count: K($).errorRows })), 1)])) : M("", !0),
|
|
3676
|
+
Qn.value ? (B(), N("span", {
|
|
3677
|
+
key: 5,
|
|
3678
|
+
class: "dt-status-summary",
|
|
3679
|
+
"aria-label": K(u).t("sheet.selectionSummary")
|
|
3680
|
+
}, [
|
|
3681
|
+
P("span", null, [F(W(K(u).t("sheet.agg.count")) + " ", 1), P("b", null, W(K(f).int(Qn.value.count)), 1)]),
|
|
3682
|
+
Qn.value.sum === null ? M("", !0) : (B(), N("span", ga, [F(W(K(u).t("sheet.agg.sum")) + " ", 1), P("b", null, W(Qn.value.sum), 1)])),
|
|
3683
|
+
Qn.value.avg === null ? M("", !0) : (B(), N("span", _a, [F(W(K(u).t("sheet.agg.avg")) + " ", 1), P("b", null, W(Qn.value.avg), 1)]))
|
|
3684
|
+
], 8, ha)) : M("", !0)
|
|
3685
|
+
], 64))], 8, la)),
|
|
3686
|
+
ar.value ? (B(), N("div", va, [
|
|
3687
|
+
P("strong", null, W(ar.value.text), 1),
|
|
3688
|
+
ar.value.issues ? (B(), N(k, { key: 0 }, [
|
|
3689
|
+
n[25] ||= P("span", { "aria-hidden": "true" }, "·", -1),
|
|
3690
|
+
P("span", ya, W(ar.value.issues), 1),
|
|
3691
|
+
ar.value.review ? (B(), N("button", {
|
|
3692
|
+
key: 0,
|
|
3693
|
+
type: "button",
|
|
3694
|
+
class: "dt-toast-link",
|
|
3695
|
+
onClick: n[12] ||= (e) => ar.value.review()
|
|
3696
|
+
}, W(K(u).t("sheet.review")), 1)) : M("", !0)
|
|
3697
|
+
], 64)) : M("", !0),
|
|
3698
|
+
ar.value.action ? (B(), N("button", {
|
|
3699
|
+
key: 1,
|
|
3700
|
+
type: "button",
|
|
3701
|
+
class: "dt-toast-link",
|
|
3702
|
+
onClick: lr
|
|
3703
|
+
}, W(ar.value.action.label), 1)) : M("", !0),
|
|
3704
|
+
ar.value.undo ? (B(), N(k, { key: 2 }, [n[26] ||= P("span", {
|
|
3705
|
+
class: "dt-toast-sep",
|
|
3706
|
+
"aria-hidden": "true"
|
|
3707
|
+
}, null, -1), P("button", {
|
|
3708
|
+
type: "button",
|
|
3709
|
+
class: "dt-toast-undo",
|
|
3710
|
+
onClick: cr
|
|
3711
|
+
}, [F(W(K(u).t("common.undo")) + " ", 1), P("kbd", ba, W(K(se)), 1)])], 64)) : M("", !0)
|
|
3712
|
+
])) : M("", !0),
|
|
3713
|
+
P("span", xa, W(ur.value), 1),
|
|
3714
|
+
P("span", Sa, W(dr.value), 1),
|
|
3715
|
+
Ae(P("div", {
|
|
3716
|
+
class: pe(["dt-tip", { "is-multi": K(vr).text.value.includes("\n") }]),
|
|
3717
|
+
role: "tooltip",
|
|
3718
|
+
style: me(K(vr).style.value)
|
|
3719
|
+
}, W(K(vr).text.value), 7), [[De, K(vr).open.value]]),
|
|
3720
|
+
I(re, {
|
|
3721
|
+
open: pr.value,
|
|
3722
|
+
"onUpdate:open": n[13] ||= (e) => pr.value = e,
|
|
3723
|
+
title: K(u).t("sheet.discard.title", {
|
|
3724
|
+
cells: K(f).int(K($).changedCells),
|
|
3725
|
+
rows: K(f).int(K($).changedRows)
|
|
3726
|
+
}),
|
|
3727
|
+
body: K(u).t("sheet.discard.body"),
|
|
3728
|
+
"confirm-label": K(u).t("sheet.leave.discard"),
|
|
3729
|
+
"cancel-label": K(u).t("sheet.discard.keep"),
|
|
3730
|
+
danger: "",
|
|
3731
|
+
onConfirm: mr
|
|
3732
|
+
}, null, 8, [
|
|
3733
|
+
"open",
|
|
3734
|
+
"title",
|
|
3735
|
+
"body",
|
|
3736
|
+
"confirm-label",
|
|
3737
|
+
"cancel-label"
|
|
3738
|
+
]),
|
|
3739
|
+
t.parseFile && an.value ? (B(), j(Rr, {
|
|
3740
|
+
key: 7,
|
|
3741
|
+
open: an.value,
|
|
3742
|
+
"onUpdate:open": n[14] ||= (e) => an.value = e,
|
|
3743
|
+
"parse-file": t.parseFile,
|
|
3744
|
+
columns: L.value,
|
|
3745
|
+
"key-column": t.keyColumn,
|
|
3746
|
+
entity: p.value,
|
|
3747
|
+
"max-rows": t.maxRows,
|
|
3748
|
+
"row-count": K(H).allRows.value.length,
|
|
3749
|
+
"in-list": sn,
|
|
3750
|
+
"lookup-keys": t.lookupKeys,
|
|
3751
|
+
"parse-env": Qe,
|
|
3752
|
+
"fmt-env": et,
|
|
3753
|
+
onApply: cn
|
|
3754
|
+
}, null, 8, [
|
|
3755
|
+
"open",
|
|
3756
|
+
"parse-file",
|
|
3757
|
+
"columns",
|
|
3758
|
+
"key-column",
|
|
3759
|
+
"entity",
|
|
3760
|
+
"max-rows",
|
|
3761
|
+
"row-count",
|
|
3762
|
+
"lookup-keys"
|
|
3763
|
+
])) : M("", !0),
|
|
3764
|
+
Pt.value ? (B(), j(Gr, {
|
|
3765
|
+
key: 8,
|
|
3766
|
+
open: Pt.value,
|
|
3767
|
+
"onUpdate:open": n[15] ||= (e) => Pt.value = e,
|
|
3768
|
+
errors: Ft.value,
|
|
3769
|
+
"ok-rows": K(H).getChanges().rows.length,
|
|
3770
|
+
onFix: Yt,
|
|
3771
|
+
onSave: zt
|
|
3772
|
+
}, null, 8, [
|
|
3773
|
+
"open",
|
|
3774
|
+
"errors",
|
|
3775
|
+
"ok-rows"
|
|
3776
|
+
])) : M("", !0)
|
|
3777
|
+
], 42, ji));
|
|
3778
|
+
}
|
|
3779
|
+
});
|
|
3780
|
+
//#endregion
|
|
3781
|
+
export { Ca as DataSheet, D as ME, qn as detectHeaderRow, Jn as matchColumns, Gn as normalizeHeader };
|
|
3782
|
+
|
|
3783
|
+
//# sourceMappingURL=sheet.js.map
|