@svgrid/grid-wc 2.5.0 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{GridMenus-Boz00ms0.js → GridMenus-CU_-Ks4f.js} +11 -10
- package/dist/SvGrid.helpers-CgUd39VT.js +109 -0
- package/dist/SvGridCellEditor-CBJUbAsR.js +523 -0
- package/dist/editor-registry-DxGKqcvx.js +24 -0
- package/dist/row-drag-touch-Ddaa-QeB.js +91 -0
- package/dist/sv-grid-element.js +2681 -2883
- package/dist/{svelte-virtualizer.svelte-ZL3wxPzD.js → svelte-virtualizer.svelte-CFoYP2Ls.js} +73 -165
- package/package.json +16 -2
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
import { $ as e, A as t, C as n, D as r, E as i, F as a, H as o, I as s, J as c, K as l, L as u, O as d, R as f, V as p, W as m, X as h, Z as g, _, at as v, b as y, d as b, f as x, g as S, h as C, i as ee, it as w, j as T, k as E, n as D, nt as O, p as te, q as k, tt as ne, w as A, x as j, y as M } from "./client-DoXxrq8q.js";
|
|
2
|
+
import { d as N, f as P, o as re, p as ie, v as ae, y as oe } from "./SvGrid.helpers-CgUd39VT.js";
|
|
3
|
+
import { n as se, r as ce, t as le } from "./editor-registry-DxGKqcvx.js";
|
|
4
|
+
//#region ../grid/dist/SvGridCellEditor.svelte
|
|
5
|
+
var F = T("<span class=\"sv-grid-chip sv-grid-chip-removable\"> <button type=\"button\" class=\"sv-grid-chip-remove\">×</button></span>"), I = T("<button type=\"button\" class=\"sv-grid-chip-commit\" aria-label=\"Commit chip selection\">Done</button>"), L = T("<div class=\"sv-grid-cell-editor sv-grid-cell-editor-chips\" role=\"group\"><div class=\"sv-grid-chips-row\"><!> <input class=\"sv-grid-chip-input\" type=\"text\"/> <!></div></div>"), R = T("<input type=\"checkbox\" class=\"sv-grid-fr-editor sv-grid-fr-checkbox\"/>"), z = T("<option> </option>"), B = T("<select class=\"sv-grid-cell-editor sv-grid-fr-editor\"></select>"), V = T("<input class=\"sv-grid-cell-editor sv-grid-fr-editor\"/>"), ue = T("<button type=\"button\" class=\"sv-grid-checkbox\" role=\"checkbox\" aria-label=\"Edit checkbox value\"></button>"), de = T("<button type=\"button\" role=\"radio\">★</button>"), fe = T("<span class=\"sv-grid-rating-editor\" role=\"radiogroup\" aria-label=\"Rating\"><!> <button type=\"button\" aria-label=\"Clear rating\" class=\"sv-grid-rating-clear\">×</button></span>"), pe = T("<textarea class=\"sv-grid-cell-editor sv-grid-cell-editor-textarea\" rows=\"4\"></textarea>"), me = T("<button type=\"button\" class=\"sv-grid-autocomplete-option\" role=\"option\"> </button>"), he = T("<div class=\"sv-grid-autocomplete-list\" role=\"listbox\"></div>"), ge = T("<div class=\"sv-grid-autocomplete\"><input class=\"sv-grid-cell-editor sv-grid-cell-editor-autocomplete\" type=\"text\"/> <!></div>"), _e = T("<input type=\"color\"/>"), ve = T("<input/>");
|
|
6
|
+
function H(a, T) {
|
|
7
|
+
O(T, !0);
|
|
8
|
+
let H = (r, a = v, o = v, m = v, h = v) => {
|
|
9
|
+
var g = t(), _ = k(g), y = (r) => {
|
|
10
|
+
var s = t(), c = k(s), l = (r) => {
|
|
11
|
+
var i = t(), s = k(i);
|
|
12
|
+
{
|
|
13
|
+
let t = e(() => U().editingCell?.value);
|
|
14
|
+
n(s, () => f(G), (e, n) => {
|
|
15
|
+
n(e, {
|
|
16
|
+
get options() {
|
|
17
|
+
return a();
|
|
18
|
+
},
|
|
19
|
+
get loading() {
|
|
20
|
+
return h();
|
|
21
|
+
},
|
|
22
|
+
get value() {
|
|
23
|
+
return f(t);
|
|
24
|
+
},
|
|
25
|
+
get multiple() {
|
|
26
|
+
return o();
|
|
27
|
+
},
|
|
28
|
+
placeholder: "Pick…",
|
|
29
|
+
renderChipsInTrigger: !0,
|
|
30
|
+
onChange: (e) => {
|
|
31
|
+
U().editingCell = U().editingCell ? {
|
|
32
|
+
...U().editingCell,
|
|
33
|
+
value: e
|
|
34
|
+
} : U().editingCell;
|
|
35
|
+
},
|
|
36
|
+
onCommit: () => f(Y)(),
|
|
37
|
+
onCancel: () => {
|
|
38
|
+
U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
E(r, i);
|
|
44
|
+
};
|
|
45
|
+
i(c, (e) => {
|
|
46
|
+
f(G) && e(l);
|
|
47
|
+
}), E(r, s);
|
|
48
|
+
}, b = (e) => {
|
|
49
|
+
var t = L();
|
|
50
|
+
x(t, "tabindex", -1);
|
|
51
|
+
var n = l(t), r = l(n);
|
|
52
|
+
A(r, 19, m, (e, t) => String(e) + "_" + t, (e, t, n) => {
|
|
53
|
+
var r = F(), i = l(r), a = c(i);
|
|
54
|
+
w(r), p((e, t) => {
|
|
55
|
+
d(i, `${e ?? ""} `), x(a, "aria-label", `Remove ${t ?? ""}`);
|
|
56
|
+
}, [() => String(f(t)), () => String(f(t))]), s("mousedown", a, (e) => e.preventDefault()), s("click", a, () => {
|
|
57
|
+
let e = m().filter((e, t) => t !== f(n));
|
|
58
|
+
U().editingCell = U().editingCell ? {
|
|
59
|
+
...U().editingCell,
|
|
60
|
+
value: o() ? e : e[0] ?? null
|
|
61
|
+
} : U().editingCell;
|
|
62
|
+
}), E(e, r);
|
|
63
|
+
});
|
|
64
|
+
var a = c(r, 2);
|
|
65
|
+
j(a, (e) => f(Q)?.(e));
|
|
66
|
+
var h = c(a, 2), g = (e) => {
|
|
67
|
+
var t = I();
|
|
68
|
+
s("mousedown", t, (e) => e.preventDefault()), s("click", t, () => f(Y)()), E(e, t);
|
|
69
|
+
};
|
|
70
|
+
i(h, (e) => {
|
|
71
|
+
o() && e(g);
|
|
72
|
+
}), w(n), w(t), p(() => x(a, "placeholder", o() ? "Type, Enter to add" : "Type a value")), s("keydown", a, (e) => {
|
|
73
|
+
if (e.key === "Enter" || o() && e.key === ",") {
|
|
74
|
+
e.preventDefault(), e.stopPropagation();
|
|
75
|
+
let t = e.currentTarget, n = t.value.trim();
|
|
76
|
+
if (n) {
|
|
77
|
+
let e = o() ? [...m(), n] : [n];
|
|
78
|
+
U().editingCell = U().editingCell ? {
|
|
79
|
+
...U().editingCell,
|
|
80
|
+
value: o() ? e : n
|
|
81
|
+
} : U().editingCell, t.value = "", o() || f(Y)();
|
|
82
|
+
}
|
|
83
|
+
} else if (e.key === "Escape") f(Z)(e);
|
|
84
|
+
else if (e.key === "Backspace" && e.currentTarget.value === "" && m().length > 0) {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
let t = m().slice(0, -1);
|
|
87
|
+
U().editingCell = U().editingCell ? {
|
|
88
|
+
...U().editingCell,
|
|
89
|
+
value: o() ? t : t[0] ?? null
|
|
90
|
+
} : U().editingCell;
|
|
91
|
+
}
|
|
92
|
+
}), u("blur", a, () => f(Y)()), E(e, t);
|
|
93
|
+
};
|
|
94
|
+
i(_, (e) => {
|
|
95
|
+
a().length > 0 ? e(y) : e(b, -1);
|
|
96
|
+
}), E(r, g);
|
|
97
|
+
}, U = D(T, "ctrl", 7), W = D(T, "fullRow", 3, !1), G = g(null), K = g(null);
|
|
98
|
+
o(() => {
|
|
99
|
+
let e = U().editingCell?.editorType;
|
|
100
|
+
(e === "list" || e === "chips" || e === "select" || e === "rich-select") && !f(G) && import("./SvGridDropdown-BXqvR1cs.js").then((e) => h(G, e.default, !0)), (e === "date" || e === "datetime" || e === "time") && !f(K) && import("./SvDateTimePicker-Ch1Vug8H.js").then((e) => h(K, e.default, !0));
|
|
101
|
+
});
|
|
102
|
+
let ye = e(() => U().grid), be = e(() => U().fullRowEdit), q = e(() => U().getColumnEditorOptions), J = e(() => U().areEditorOptionsLoading), Y = e(() => U().saveEditingCell), X = e(() => U().updateEditingCellValue), Z = e(() => U().onEditorKeyDown), Q = e(() => U().focusOnMount), xe = e(() => U().toggleCheckboxWithKeyboard);
|
|
103
|
+
function $(e) {
|
|
104
|
+
e.key === "Enter" ? (e.preventDefault(), U().commitFullRowEdit(), U().gridRootEl?.focus({ preventScroll: !0 })) : e.key === "Escape" && (e.preventDefault(), U().cancelFullRowEdit(), U().gridRootEl?.focus({ preventScroll: !0 }));
|
|
105
|
+
}
|
|
106
|
+
function Se(e) {
|
|
107
|
+
return typeof e == "object" && e && "value" in e ? String(e.value) : String(e);
|
|
108
|
+
}
|
|
109
|
+
function Ce(e) {
|
|
110
|
+
return typeof e == "object" && e && "label" in e ? String(e.label) : String(e);
|
|
111
|
+
}
|
|
112
|
+
function we() {
|
|
113
|
+
let e = U().editingCell;
|
|
114
|
+
return {
|
|
115
|
+
value: e?.value,
|
|
116
|
+
rowId: e?.rowId ?? "",
|
|
117
|
+
columnId: e?.columnId ?? "",
|
|
118
|
+
onChange: (e) => f(X)(e),
|
|
119
|
+
onCommit: (e) => {
|
|
120
|
+
e !== void 0 && f(X)(e), f(Y)();
|
|
121
|
+
},
|
|
122
|
+
onCancel: () => {
|
|
123
|
+
U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
124
|
+
},
|
|
125
|
+
onCommitAndMove: (e, t) => {
|
|
126
|
+
e !== void 0 && f(X)(e), U().commitAndMoveByTab(t === -1);
|
|
127
|
+
},
|
|
128
|
+
onRequestClose: () => {
|
|
129
|
+
U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
130
|
+
},
|
|
131
|
+
inCell: !0
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
var Te = t(), Ee = k(Te), De = (n) => {
|
|
135
|
+
let r = e(() => T.column.columnDef.editorType ?? "text"), a = e(() => f(be)?.draft[T.column.id]);
|
|
136
|
+
var o = t(), c = k(o), u = (e) => {
|
|
137
|
+
var t = R();
|
|
138
|
+
b(t), p((e) => te(t, e), [() => !!f(a)]), s("change", t, (e) => U().setFullRowDraft(T.column.id, e.currentTarget.checked)), s("keydown", t, $), s("pointerdown", t, (e) => e.stopPropagation()), s("click", t, (e) => e.stopPropagation()), E(e, t);
|
|
139
|
+
}, m = (t) => {
|
|
140
|
+
let n = e(() => f(q)(T.column, T.row));
|
|
141
|
+
var r = B();
|
|
142
|
+
A(r, 21, () => f(n), (e) => Se(e), (e, t) => {
|
|
143
|
+
var n = z(), r = l(n, !0);
|
|
144
|
+
w(n);
|
|
145
|
+
var i = {};
|
|
146
|
+
p((e, t) => {
|
|
147
|
+
d(r, e), i !== (i = t) && (n.value = (n.__value = t) ?? "");
|
|
148
|
+
}, [() => Ce(f(t)), () => Se(f(t))]), E(e, n);
|
|
149
|
+
}), w(r);
|
|
150
|
+
var i;
|
|
151
|
+
S(r), p((e) => {
|
|
152
|
+
i !== (i = e) && (r.value = (r.__value = e) ?? "", _(r, e));
|
|
153
|
+
}, [() => String(f(a) ?? "")]), s("change", r, (e) => U().setFullRowDraft(T.column.id, e.currentTarget.value)), s("keydown", r, $), s("pointerdown", r, (e) => e.stopPropagation()), s("click", r, (e) => e.stopPropagation()), E(t, r);
|
|
154
|
+
}, h = (t) => {
|
|
155
|
+
let n = e(() => f(r) === "number" ? "number" : f(r) === "date" ? "date" : f(r) === "datetime" ? "datetime-local" : f(r) === "time" ? "time" : f(r) === "password" ? "password" : "text");
|
|
156
|
+
var i = V();
|
|
157
|
+
b(i), p((e) => {
|
|
158
|
+
x(i, "type", f(n)), C(i, e);
|
|
159
|
+
}, [() => String(f(a) ?? "")]), s("input", i, (e) => U().setFullRowDraft(T.column.id, e.currentTarget.value)), s("keydown", i, $), s("pointerdown", i, (e) => e.stopPropagation()), s("click", i, (e) => e.stopPropagation()), E(t, i);
|
|
160
|
+
};
|
|
161
|
+
i(c, (e) => {
|
|
162
|
+
f(r) === "checkbox" ? e(u) : f(r) === "list" || f(r) === "select" || f(r) === "rich-select" ? e(m, 1) : e(h, -1);
|
|
163
|
+
}), E(n, o);
|
|
164
|
+
}, Oe = (a) => {
|
|
165
|
+
var o = t(), h = k(o), g = (n) => {
|
|
166
|
+
let i = e(() => T.column.columnDef.cellEditor);
|
|
167
|
+
var a = t(), o = k(a);
|
|
168
|
+
{
|
|
169
|
+
let t = e(() => ({
|
|
170
|
+
cell: T.row.getAllCells().find((e) => e.column.id === T.column.id),
|
|
171
|
+
row: T.row,
|
|
172
|
+
column: T.column,
|
|
173
|
+
table: f(ye),
|
|
174
|
+
getValue: () => U().editingCell?.value,
|
|
175
|
+
value: U().editingCell?.value,
|
|
176
|
+
update: (e) => {
|
|
177
|
+
U().editingCell = U().editingCell ? {
|
|
178
|
+
...U().editingCell,
|
|
179
|
+
value: e
|
|
180
|
+
} : U().editingCell;
|
|
181
|
+
},
|
|
182
|
+
commit: (e) => {
|
|
183
|
+
e !== void 0 && (U().editingCell = U().editingCell ? {
|
|
184
|
+
...U().editingCell,
|
|
185
|
+
value: e
|
|
186
|
+
} : U().editingCell), f(Y)();
|
|
187
|
+
},
|
|
188
|
+
cancel: () => {
|
|
189
|
+
U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
190
|
+
}
|
|
191
|
+
}));
|
|
192
|
+
r(o, () => f(i), () => f(t));
|
|
193
|
+
}
|
|
194
|
+
E(n, a);
|
|
195
|
+
}, _ = (e) => {
|
|
196
|
+
var t = ue();
|
|
197
|
+
p((e) => x(t, "aria-checked", e), [() => !!U().editingCell.value]), s("click", t, (e) => {
|
|
198
|
+
e.stopPropagation();
|
|
199
|
+
let t = !U().editingCell?.value;
|
|
200
|
+
U().editingCell = U().editingCell ? {
|
|
201
|
+
...U().editingCell,
|
|
202
|
+
value: t
|
|
203
|
+
} : U().editingCell, f(Y)();
|
|
204
|
+
}), s("keydown", t, (e) => f(xe)(e, () => {
|
|
205
|
+
e.stopPropagation();
|
|
206
|
+
let t = !U().editingCell?.value;
|
|
207
|
+
U().editingCell = U().editingCell ? {
|
|
208
|
+
...U().editingCell,
|
|
209
|
+
value: t
|
|
210
|
+
} : U().editingCell, f(Y)();
|
|
211
|
+
})), u("blur", t, () => f(Y)()), E(e, t);
|
|
212
|
+
}, v = (r) => {
|
|
213
|
+
let a = e(() => f(q)(T.column, T.row)), o = e(() => f(J)(T.column, T.row)), s = e(() => T.column.columnDef.editorMultiple === !0);
|
|
214
|
+
var c = t(), l = k(c), u = (r) => {
|
|
215
|
+
var i = t(), c = k(i);
|
|
216
|
+
{
|
|
217
|
+
let t = e(() => U().editingCell?.value);
|
|
218
|
+
n(c, () => f(G), (e, n) => {
|
|
219
|
+
n(e, {
|
|
220
|
+
get options() {
|
|
221
|
+
return f(a);
|
|
222
|
+
},
|
|
223
|
+
get loading() {
|
|
224
|
+
return f(o);
|
|
225
|
+
},
|
|
226
|
+
get value() {
|
|
227
|
+
return f(t);
|
|
228
|
+
},
|
|
229
|
+
get multiple() {
|
|
230
|
+
return f(s);
|
|
231
|
+
},
|
|
232
|
+
placeholder: "Select…",
|
|
233
|
+
onChange: (e) => {
|
|
234
|
+
U().editingCell = U().editingCell ? {
|
|
235
|
+
...U().editingCell,
|
|
236
|
+
value: e
|
|
237
|
+
} : U().editingCell;
|
|
238
|
+
},
|
|
239
|
+
onCommit: () => f(Y)(),
|
|
240
|
+
onCancel: () => {
|
|
241
|
+
U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
E(r, i);
|
|
247
|
+
};
|
|
248
|
+
i(l, (e) => {
|
|
249
|
+
f(G) && e(u);
|
|
250
|
+
}), E(r, c);
|
|
251
|
+
}, S = (t) => {
|
|
252
|
+
let n = e(() => f(q)(T.column, T.row)), r = e(() => f(J)(T.column, T.row)), i = e(() => T.column.columnDef.editorMultiple === !0), a = e(() => oe(U().editingCell?.value));
|
|
253
|
+
H(t, () => f(n), () => f(i), () => f(a), () => f(r));
|
|
254
|
+
}, D = (t) => {
|
|
255
|
+
let n = e(() => Math.max(0, Math.min(5, Math.round(Number(U().editingCell?.value) || 0))));
|
|
256
|
+
var r = fe(), i = l(r);
|
|
257
|
+
A(i, 16, () => [
|
|
258
|
+
1,
|
|
259
|
+
2,
|
|
260
|
+
3,
|
|
261
|
+
4,
|
|
262
|
+
5
|
|
263
|
+
], (e) => e, (e, t) => {
|
|
264
|
+
var r = de();
|
|
265
|
+
p(() => {
|
|
266
|
+
x(r, "aria-checked", f(n) >= t), x(r, "aria-label", `${t} ${t === 1 ? "star" : "stars"}`), M(r, 1, `sv-grid-rating-star ${f(n) >= t ? "sv-grid-rating-star-on" : ""}`);
|
|
267
|
+
}), s("mousedown", r, (e) => e.preventDefault()), s("click", r, (e) => {
|
|
268
|
+
e.stopPropagation(), U().editingCell = U().editingCell ? {
|
|
269
|
+
...U().editingCell,
|
|
270
|
+
value: t
|
|
271
|
+
} : U().editingCell, f(Y)();
|
|
272
|
+
}), s("keydown", r, function(...e) {
|
|
273
|
+
f(Z)?.apply(this, e);
|
|
274
|
+
}), E(e, r);
|
|
275
|
+
});
|
|
276
|
+
var a = c(i, 2);
|
|
277
|
+
w(r), s("mousedown", a, (e) => e.preventDefault()), s("click", a, (e) => {
|
|
278
|
+
e.stopPropagation(), U().editingCell = U().editingCell ? {
|
|
279
|
+
...U().editingCell,
|
|
280
|
+
value: 0
|
|
281
|
+
} : U().editingCell, f(Y)();
|
|
282
|
+
}), E(t, r);
|
|
283
|
+
}, O = (r) => {
|
|
284
|
+
let a = e(() => f(q)(T.column, T.row)), o = e(() => f(J)(T.column, T.row));
|
|
285
|
+
var s = t(), c = k(s), l = (r) => {
|
|
286
|
+
var i = t(), s = k(i);
|
|
287
|
+
{
|
|
288
|
+
let t = e(() => U().editingCell?.value);
|
|
289
|
+
n(s, () => f(G), (e, n) => {
|
|
290
|
+
n(e, {
|
|
291
|
+
get options() {
|
|
292
|
+
return f(a);
|
|
293
|
+
},
|
|
294
|
+
get loading() {
|
|
295
|
+
return f(o);
|
|
296
|
+
},
|
|
297
|
+
get value() {
|
|
298
|
+
return f(t);
|
|
299
|
+
},
|
|
300
|
+
multiple: !1,
|
|
301
|
+
placeholder: "Select…",
|
|
302
|
+
onChange: (e) => {
|
|
303
|
+
U().editingCell = U().editingCell ? {
|
|
304
|
+
...U().editingCell,
|
|
305
|
+
value: e
|
|
306
|
+
} : U().editingCell;
|
|
307
|
+
},
|
|
308
|
+
onCommit: () => f(Y)(),
|
|
309
|
+
onCancel: () => {
|
|
310
|
+
U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
E(r, i);
|
|
316
|
+
};
|
|
317
|
+
i(c, (e) => {
|
|
318
|
+
f(G) && e(l);
|
|
319
|
+
}), E(r, s);
|
|
320
|
+
}, te = (r) => {
|
|
321
|
+
let a = e(() => f(q)(T.column, T.row)), o = e(() => f(J)(T.column, T.row));
|
|
322
|
+
var s = t(), c = k(s), l = (r) => {
|
|
323
|
+
var i = t(), s = k(i);
|
|
324
|
+
{
|
|
325
|
+
let t = e(() => U().editingCell?.value);
|
|
326
|
+
n(s, () => f(G), (e, n) => {
|
|
327
|
+
n(e, {
|
|
328
|
+
get options() {
|
|
329
|
+
return f(a);
|
|
330
|
+
},
|
|
331
|
+
get loading() {
|
|
332
|
+
return f(o);
|
|
333
|
+
},
|
|
334
|
+
get value() {
|
|
335
|
+
return f(t);
|
|
336
|
+
},
|
|
337
|
+
multiple: !1,
|
|
338
|
+
searchable: !0,
|
|
339
|
+
placeholder: "Search…",
|
|
340
|
+
onChange: (e) => {
|
|
341
|
+
U().editingCell = U().editingCell ? {
|
|
342
|
+
...U().editingCell,
|
|
343
|
+
value: e
|
|
344
|
+
} : U().editingCell;
|
|
345
|
+
},
|
|
346
|
+
onCommit: () => f(Y)(),
|
|
347
|
+
onCancel: () => {
|
|
348
|
+
U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
E(r, i);
|
|
354
|
+
};
|
|
355
|
+
i(c, (e) => {
|
|
356
|
+
f(G) && e(l);
|
|
357
|
+
}), E(r, s);
|
|
358
|
+
}, ne = (e) => {
|
|
359
|
+
var t = pe();
|
|
360
|
+
m(t), j(t, (e) => f(Q)?.(e)), p((e) => C(t, e), [() => String(U().editingCell?.value ?? "")]), s("pointerdown", t, (e) => e.stopPropagation()), s("input", t, (e) => f(X)(e.currentTarget.value)), s("keydown", t, (e) => {
|
|
361
|
+
if (e.stopPropagation(), e.key === "Escape") {
|
|
362
|
+
e.preventDefault(), U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (e.key === "Tab") {
|
|
366
|
+
e.preventDefault(), U().commitAndMoveByTab(e.shiftKey);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), f(Y)(), U().gridRootEl?.focus({ preventScroll: !0 }));
|
|
370
|
+
}), u("blur", t, () => f(Y)()), E(e, t);
|
|
371
|
+
}, F = (t) => {
|
|
372
|
+
let n = e(() => f(q)(T.column, T.row)), r = e(() => String(U().editingCell?.value ?? "")), a = e(() => f(r).trim() ? f(n).filter((e) => String(e.label).toLowerCase().includes(f(r).toLowerCase())) : f(n));
|
|
373
|
+
var o = ge(), m = l(o);
|
|
374
|
+
b(m), j(m, (e) => f(Q)?.(e));
|
|
375
|
+
var h = c(m, 2), g = (e) => {
|
|
376
|
+
var t = he();
|
|
377
|
+
A(t, 21, () => f(a).slice(0, 50), (e) => e.value, (e, t) => {
|
|
378
|
+
var n = me(), i = l(n, !0);
|
|
379
|
+
w(n), p((e) => {
|
|
380
|
+
x(n, "aria-selected", e), d(i, f(t).label);
|
|
381
|
+
}, [() => String(f(t).value) === f(r)]), s("mousedown", n, (e) => {
|
|
382
|
+
e.preventDefault(), U().editingCell = U().editingCell ? {
|
|
383
|
+
...U().editingCell,
|
|
384
|
+
value: f(t).value
|
|
385
|
+
} : U().editingCell, f(Y)();
|
|
386
|
+
}), E(e, n);
|
|
387
|
+
}), w(t), E(e, t);
|
|
388
|
+
};
|
|
389
|
+
i(h, (e) => {
|
|
390
|
+
f(a).length > 0 && e(g);
|
|
391
|
+
}), w(o), p(() => C(m, f(r))), s("pointerdown", m, (e) => e.stopPropagation()), s("input", m, (e) => f(X)(e.currentTarget.value)), u("blur", m, () => f(Y)()), s("keydown", m, function(...e) {
|
|
392
|
+
f(Z)?.apply(this, e);
|
|
393
|
+
}), E(t, o);
|
|
394
|
+
}, I = (r) => {
|
|
395
|
+
var a = t(), o = k(a), s = (r) => {
|
|
396
|
+
var i = t(), a = k(i);
|
|
397
|
+
{
|
|
398
|
+
let t = e(() => U().editingCell?.value);
|
|
399
|
+
n(a, () => f(K), (e, n) => {
|
|
400
|
+
n(e, {
|
|
401
|
+
get value() {
|
|
402
|
+
return f(t);
|
|
403
|
+
},
|
|
404
|
+
formatString: "yyyy-MM-dd",
|
|
405
|
+
dropDownDisplayMode: "calendar",
|
|
406
|
+
autoOpen: !0,
|
|
407
|
+
block: !0,
|
|
408
|
+
onChange: (e) => f(X)(e),
|
|
409
|
+
onCommit: () => f(Y)(),
|
|
410
|
+
onCancel: () => {
|
|
411
|
+
U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
E(r, i);
|
|
417
|
+
};
|
|
418
|
+
i(o, (e) => {
|
|
419
|
+
f(K) && e(s);
|
|
420
|
+
}), E(r, a);
|
|
421
|
+
}, L = (r) => {
|
|
422
|
+
var a = t(), o = k(a), s = (r) => {
|
|
423
|
+
var i = t(), a = k(i);
|
|
424
|
+
{
|
|
425
|
+
let t = e(() => U().editingCell?.value);
|
|
426
|
+
n(a, () => f(K), (e, n) => {
|
|
427
|
+
n(e, {
|
|
428
|
+
get value() {
|
|
429
|
+
return f(t);
|
|
430
|
+
},
|
|
431
|
+
formatString: "yyyy-MM-dd HH:mm",
|
|
432
|
+
dropDownDisplayMode: "both",
|
|
433
|
+
autoOpen: !0,
|
|
434
|
+
block: !0,
|
|
435
|
+
onChange: (e) => f(X)(e),
|
|
436
|
+
onCommit: () => f(Y)(),
|
|
437
|
+
onCancel: () => {
|
|
438
|
+
U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
E(r, i);
|
|
444
|
+
};
|
|
445
|
+
i(o, (e) => {
|
|
446
|
+
f(K) && e(s);
|
|
447
|
+
}), E(r, a);
|
|
448
|
+
}, R = (r) => {
|
|
449
|
+
var a = t(), o = k(a), s = (r) => {
|
|
450
|
+
var i = t(), a = k(i);
|
|
451
|
+
{
|
|
452
|
+
let t = e(() => ae(U().editingCell?.value));
|
|
453
|
+
n(a, () => f(K), (e, n) => {
|
|
454
|
+
n(e, {
|
|
455
|
+
get value() {
|
|
456
|
+
return f(t);
|
|
457
|
+
},
|
|
458
|
+
formatString: "HH:mm",
|
|
459
|
+
dropDownDisplayMode: "time",
|
|
460
|
+
autoOpen: !0,
|
|
461
|
+
block: !0,
|
|
462
|
+
onChange: (e) => f(X)(re(e)),
|
|
463
|
+
onCommit: () => f(Y)(),
|
|
464
|
+
onCancel: () => {
|
|
465
|
+
U().editingCell = null, U().gridRootEl?.focus({ preventScroll: !0 });
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
E(r, i);
|
|
471
|
+
};
|
|
472
|
+
i(o, (e) => {
|
|
473
|
+
f(K) && e(s);
|
|
474
|
+
}), E(r, a);
|
|
475
|
+
}, z = (e) => {
|
|
476
|
+
var t = _e();
|
|
477
|
+
b(t), j(t, (e) => f(Q)?.(e)), p((e, n) => {
|
|
478
|
+
M(t, 1, e), C(t, n);
|
|
479
|
+
}, [() => y(P("color")), () => N("color", U().editingCell?.value)]), s("input", t, (e) => f(X)(e.currentTarget.value)), s("change", t, (e) => {
|
|
480
|
+
f(X)(e.currentTarget.value), f(Y)();
|
|
481
|
+
}), u("blur", t, () => f(Y)()), s("keydown", t, function(...e) {
|
|
482
|
+
f(Z)?.apply(this, e);
|
|
483
|
+
}), E(e, t);
|
|
484
|
+
}, B = (r) => {
|
|
485
|
+
let i = e(() => le(String(U().editingCell?.editorType))), a = e(() => f(i).component);
|
|
486
|
+
var o = t(), s = k(o);
|
|
487
|
+
{
|
|
488
|
+
let t = e(() => ce(f(i), we()));
|
|
489
|
+
n(s, () => f(a), (e, n) => {
|
|
490
|
+
n(e, ee(() => f(t)));
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
E(r, o);
|
|
494
|
+
}, V = e(() => se(String(U().editingCell?.editorType ?? ""))), W = (e) => {
|
|
495
|
+
var t = ve();
|
|
496
|
+
b(t), j(t, (e) => f(Q)?.(e)), p((e, n, r) => {
|
|
497
|
+
M(t, 1, e), x(t, "type", n), C(t, r);
|
|
498
|
+
}, [
|
|
499
|
+
() => y(P(U().editingCell?.editorType ?? "text")),
|
|
500
|
+
() => ie(U().editingCell?.editorType ?? "text"),
|
|
501
|
+
() => N(U().editingCell?.editorType ?? "text", U().editingCell?.value)
|
|
502
|
+
]), s("input", t, (e) => f(X)(e.currentTarget.value)), u("blur", t, () => f(Y)()), s("keydown", t, function(...e) {
|
|
503
|
+
f(Z)?.apply(this, e);
|
|
504
|
+
}), E(e, t);
|
|
505
|
+
};
|
|
506
|
+
i(h, (e) => {
|
|
507
|
+
T.column.columnDef.cellEditor ? e(g) : U().editingCell?.editorType === "checkbox" ? e(_, 1) : U().editingCell?.editorType === "list" ? e(v, 2) : U().editingCell?.editorType === "chips" ? e(S, 3) : U().editingCell?.editorType === "rating" ? e(D, 4) : U().editingCell?.editorType === "select" ? e(O, 5) : U().editingCell?.editorType === "rich-select" ? e(te, 6) : U().editingCell?.editorType === "textarea" ? e(ne, 7) : U().editingCell?.editorType === "autocomplete" ? e(F, 8) : U().editingCell?.editorType === "date" ? e(I, 9) : U().editingCell?.editorType === "datetime" ? e(L, 10) : U().editingCell?.editorType === "time" ? e(R, 11) : U().editingCell?.editorType === "color" ? e(z, 12) : f(V) ? e(B, 13) : e(W, -1);
|
|
508
|
+
}), E(a, o);
|
|
509
|
+
};
|
|
510
|
+
i(Ee, (e) => {
|
|
511
|
+
W() ? e(De) : e(Oe, -1);
|
|
512
|
+
}), E(a, Te), ne();
|
|
513
|
+
}
|
|
514
|
+
a([
|
|
515
|
+
"mousedown",
|
|
516
|
+
"click",
|
|
517
|
+
"keydown",
|
|
518
|
+
"change",
|
|
519
|
+
"pointerdown",
|
|
520
|
+
"input"
|
|
521
|
+
]);
|
|
522
|
+
//#endregion
|
|
523
|
+
export { H as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region ../grid/dist/editor-registry.js
|
|
2
|
+
var e = /* @__PURE__ */ new Map();
|
|
3
|
+
function t(t) {
|
|
4
|
+
return e.get(t);
|
|
5
|
+
}
|
|
6
|
+
function n(t) {
|
|
7
|
+
return e.has(t);
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
return {
|
|
11
|
+
value: e.value,
|
|
12
|
+
onChange: e.onChange,
|
|
13
|
+
onCommit: e.onCommit,
|
|
14
|
+
onCancel: e.onCancel,
|
|
15
|
+
onCommitAndMove: e.onCommitAndMove,
|
|
16
|
+
onRequestClose: e.onRequestClose,
|
|
17
|
+
inCell: e.inCell
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function i(e, t) {
|
|
21
|
+
return e.props ? e.props(t) : r(t);
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { n, i as r, t };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
function e(e) {
|
|
2
|
+
let { ctx: t } = e, n = null;
|
|
3
|
+
function r(e, t) {
|
|
4
|
+
let n = document.elementFromPoint(e, t)?.closest?.("tr.sv-grid-row");
|
|
5
|
+
if (!n) return null;
|
|
6
|
+
let r = n.querySelector("[data-svgrid-row]")?.dataset.svgridRow;
|
|
7
|
+
if (r == null) return null;
|
|
8
|
+
let i = Number(r);
|
|
9
|
+
if (!Number.isFinite(i)) return null;
|
|
10
|
+
let a = n.getBoundingClientRect();
|
|
11
|
+
return {
|
|
12
|
+
index: i,
|
|
13
|
+
side: t < a.top + a.height / 2 ? "before" : "after"
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function i() {
|
|
17
|
+
n?.scrollFrame != null && (cancelAnimationFrame(n.scrollFrame), n.scrollFrame = null);
|
|
18
|
+
}
|
|
19
|
+
function a(e) {
|
|
20
|
+
let a = n?.scroller;
|
|
21
|
+
if (!n || !a) return;
|
|
22
|
+
let o = a.getBoundingClientRect(), s = 0;
|
|
23
|
+
if (e < o.top + 48 ? s = -12 : e > o.bottom - 48 && (s = 12), i(), s === 0) return;
|
|
24
|
+
let c = () => {
|
|
25
|
+
if (!n?.started) return;
|
|
26
|
+
a.scrollTop += s;
|
|
27
|
+
let i = r(n.startX, e);
|
|
28
|
+
i && (t.rowDropIndex = i.index, t.rowDropSide = i.side), n.scrollFrame = requestAnimationFrame(c);
|
|
29
|
+
};
|
|
30
|
+
n.scrollFrame = requestAnimationFrame(c);
|
|
31
|
+
}
|
|
32
|
+
function o(e) {
|
|
33
|
+
n?.started && e.preventDefault();
|
|
34
|
+
}
|
|
35
|
+
function s() {
|
|
36
|
+
window.removeEventListener("pointermove", l), window.removeEventListener("pointerup", u), window.removeEventListener("pointercancel", d), window.removeEventListener("touchmove", o);
|
|
37
|
+
}
|
|
38
|
+
function c(r) {
|
|
39
|
+
if (!n) return;
|
|
40
|
+
let a = n;
|
|
41
|
+
a.timer && clearTimeout(a.timer), i(), n = null, s(), a.root?.classList.remove("sv-grid-row-drag-active"), a.started && (r && t.rowDropIndex != null ? e.commitDropOnRow(t.rowDropIndex, t.rowDropSide ?? "before") : (e.clearIndicators(), e.closeBus()));
|
|
42
|
+
}
|
|
43
|
+
function l(i) {
|
|
44
|
+
if (!n || i.pointerId !== n.pointerId) return;
|
|
45
|
+
if (!n.started) {
|
|
46
|
+
Math.abs(i.clientY - n.startY) + Math.abs(i.clientX - n.startX) > 10 && c(!1);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
i.preventDefault();
|
|
50
|
+
let o = r(i.clientX, i.clientY);
|
|
51
|
+
o && (e.cancelPendingLeave(), t.rowDropIndex = o.index, t.rowDropSide = o.side), n.startX = i.clientX, a(i.clientY);
|
|
52
|
+
}
|
|
53
|
+
function u(e) {
|
|
54
|
+
!n || e.pointerId !== n.pointerId || c(!0);
|
|
55
|
+
}
|
|
56
|
+
function d(e) {
|
|
57
|
+
!n || e.pointerId !== n.pointerId || c(!1);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
start(r, i) {
|
|
61
|
+
if (!e.managed() || n) return;
|
|
62
|
+
let a = e.originalAt(i);
|
|
63
|
+
if (a == null) return;
|
|
64
|
+
let s = r.currentTarget;
|
|
65
|
+
n = {
|
|
66
|
+
pointerId: r.pointerId,
|
|
67
|
+
rowIndex: i,
|
|
68
|
+
startX: r.clientX,
|
|
69
|
+
startY: r.clientY,
|
|
70
|
+
started: !1,
|
|
71
|
+
timer: null,
|
|
72
|
+
scrollFrame: null,
|
|
73
|
+
scroller: s?.closest?.(".sv-grid-container") ?? null,
|
|
74
|
+
root: s?.closest?.(".sv-grid-root") ?? null
|
|
75
|
+
}, window.addEventListener("pointermove", l, { passive: !1 }), window.addEventListener("pointerup", u), window.addEventListener("pointercancel", d), window.addEventListener("touchmove", o, { passive: !1 }), n.timer = setTimeout(() => {
|
|
76
|
+
if (n) {
|
|
77
|
+
n.started = !0, n.timer = null, n.root?.classList.add("sv-grid-row-drag-active");
|
|
78
|
+
try {
|
|
79
|
+
s?.setPointerCapture?.(r.pointerId);
|
|
80
|
+
} catch {}
|
|
81
|
+
e.openBus(a), t.rowDragActive = !0, t.rowDropIndex = i, t.rowDropSide = "before";
|
|
82
|
+
}
|
|
83
|
+
}, 350);
|
|
84
|
+
},
|
|
85
|
+
destroy() {
|
|
86
|
+
c(!1);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { e as createTouchDrag };
|