@synopackageland/ui 0.25.17 → 0.25.19
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 +28 -0
- package/dist/components/containers/card-grid/cardGrid.d.ts +9 -0
- package/dist/components/primitives/tooltip/tooltipStyle.d.ts +1 -1
- package/dist/grid-core/config.d.ts +1 -0
- package/dist/grid-core/renderer/layout.d.ts +5 -0
- package/dist/grid.js +656 -649
- package/dist/index.js +3979 -3943
- package/dist/json-preview/preview.js +3397 -3368
- package/dist/reka-runtime.json +5 -3
- package/dist/rich-text.js +8 -8
- package/dist/theme.css +1 -1
- package/dist/themes/dsm7-embedded-theme.css +1 -1
- package/dist/themes/dsm7-embedded.css +1 -1
- package/dist/themes/dsm7.css +1 -1
- package/docs/button-policy.md +17 -0
- package/package.json +99 -1
package/dist/grid.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*! @synopackageland/ui/grid: MIT, Copyright (c) 2023-2025 Teable, Inc. and Copyright (c) 2019-present Baserow B.V. in parts; see LICENSES/source-notices.md */
|
|
2
|
-
import { watch as de, toValue as
|
|
3
|
-
import { useUiText as
|
|
2
|
+
import { watch as de, toValue as so, getCurrentScope as Jo, onScopeDispose as ro, shallowRef as ue, defineComponent as ei, getCurrentInstance as ti, useId as ni, ref as ke, computed as U, onMounted as oi, onBeforeUnmount as ii, openBlock as Ce, createElementBlock as we, unref as ee, createElementVNode as ne, toDisplayString as ve, normalizeStyle as Be, Fragment as ai, renderList as si, createCommentVNode as Oe, renderSlot as gn, createTextVNode as ri, inject as li } from "vue";
|
|
3
|
+
import { useUiText as ci } from "./index.js";
|
|
4
4
|
var H = /* @__PURE__ */ ((e) => (e.Rows = "Rows", e.Columns = "Columns", e.Cells = "Cells", e.None = "None", e))(H || {}), b = /* @__PURE__ */ ((e) => (e.Cell = "Cell", e.ActiveCell = "ActiveCell", e.AppendRow = "AppendRow", e.AppendColumn = "AppendColumn", e.ColumnHeader = "ColumnHeader", e.ColumnHeaderMenu = "ColumnHeaderMenu", e.ColumnPrimaryIcon = "ColumnPrimaryIcon", e.ColumnDescription = "ColumnDescription", e.ColumnResizeHandler = "ColumnResizeHandler", e.ColumnFreezeHandler = "ColumnFreezeHandler", e.RowHeaderDragHandler = "RowHeaderDragHandler", e.RowHeaderExpandHandler = "RowHeaderExpandHandler", e.RowHeaderCheckbox = "RowHeaderCheckbox", e.RowGroupControl = "RowGroupControl", e.RowGroupHeader = "RowGroupHeader", e.RowHeader = "RowHeader", e.AllCheckbox = "AllCheckbox", e.FillHandler = "FillHandler", e.Blank = "Blank", e.None = "None", e))(b || {}), O = /* @__PURE__ */ ((e) => (e.Rows = "Rows", e.Columns = "Columns", e.None = "None", e))(O || {}), $ = /* @__PURE__ */ ((e) => (e.Spacer = "Spacer", e.Drag = "Drag", e.Expand = "Expand", e.Checkbox = "Checkbox", e))($ || {}), he = /* @__PURE__ */ ((e) => (e.All = "all", e.None = "none", e.Column = "column", e.Row = "row", e))(he || {}), K = /* @__PURE__ */ ((e) => (e.All = "all", e.None = "none", e.Column = "column", e.Row = "row", e.Cell = "cell", e))(K || {}), le = /* @__PURE__ */ ((e) => (e[e.Group = 0] = "Group", e[e.Row = 1] = "Row", e[e.Append = 2] = "Append", e))(le || {});
|
|
5
|
-
const
|
|
5
|
+
const Ot = (e) => ({ type: 1, displayIndex: e + 1, realIndex: e }), lo = (e) => e;
|
|
6
6
|
var Z = /* @__PURE__ */ ((e) => (e.Row = "Row", e.Column = "Column", e))(Z || {});
|
|
7
7
|
const B = {
|
|
8
8
|
rowHeight: 32,
|
|
@@ -20,6 +20,7 @@ const B = {
|
|
|
20
20
|
columnFreezeHandlerHeight: 30,
|
|
21
21
|
/** The minimum while resizing. */
|
|
22
22
|
columnMinWidth: 100,
|
|
23
|
+
/** The cells' side padding: `--ui-space-2` (tests/grid/tokens.test.ts keeps them equal). */
|
|
23
24
|
cellHorizontalPadding: 8,
|
|
24
25
|
cellVerticalPaddingMD: 10,
|
|
25
26
|
cellTextLineHeight: 22,
|
|
@@ -44,7 +45,7 @@ const B = {
|
|
|
44
45
|
ranges: [],
|
|
45
46
|
delta: 0,
|
|
46
47
|
isDragging: !1
|
|
47
|
-
},
|
|
48
|
+
}, ui = /* @__PURE__ */ new Set([
|
|
48
49
|
b.Cell,
|
|
49
50
|
b.RowHeader,
|
|
50
51
|
b.RowHeaderCheckbox,
|
|
@@ -73,14 +74,14 @@ class dt {
|
|
|
73
74
|
this.map.clear();
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
|
-
const ct = "…",
|
|
77
|
+
const ct = "…", fn = new dt(1e3), pn = new dt(1e3), co = () => ({
|
|
77
78
|
segment: (e) => Array.from(e, (t) => ({ segment: t }))
|
|
78
|
-
}),
|
|
79
|
+
}), uo = typeof Intl < "u" && typeof Intl.Segmenter == "function", ho = uo ? new Intl.Segmenter(void 0, { granularity: "word" }) : co(), Nt = uo ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : co(), mo = (e, t, n) => {
|
|
79
80
|
let o = "", i = 0;
|
|
80
|
-
for (const { segment: a } of
|
|
81
|
+
for (const { segment: a } of ho.segment(t)) {
|
|
81
82
|
const s = e.measureText(a).width;
|
|
82
83
|
if (i + s > n) {
|
|
83
|
-
for (const { segment: r } of
|
|
84
|
+
for (const { segment: r } of Nt.segment(a)) {
|
|
84
85
|
const l = e.measureText(r).width;
|
|
85
86
|
if (i + l > n) break;
|
|
86
87
|
o += r, i += l;
|
|
@@ -90,12 +91,12 @@ const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
|
90
91
|
o += a, i += s;
|
|
91
92
|
}
|
|
92
93
|
return { text: o, width: i };
|
|
93
|
-
},
|
|
94
|
+
}, di = (e, t) => {
|
|
94
95
|
const { x: n = 0, y: o = 0, text: i, maxWidth: a, maxLines: s, isUnderline: r, fontSize: l = 13, lineHeight: c = 22, fill: u = "black", textAlign: h = "left", verticalAlign: m = "middle", needRender: g = !0 } = t;
|
|
95
96
|
let C = [];
|
|
96
97
|
const S = e.measureText(ct).width;
|
|
97
98
|
let p = "", w = 0, v = 0;
|
|
98
|
-
const y = `${e.font}-${i}-${l}-${a}-${s}`, R =
|
|
99
|
+
const y = `${e.font}-${i}-${l}-${a}-${s}`, R = pn.get(y);
|
|
99
100
|
if (R)
|
|
100
101
|
C = R;
|
|
101
102
|
else {
|
|
@@ -107,14 +108,14 @@ const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
|
107
108
|
}, M = (z, E = 0) => {
|
|
108
109
|
const W = a - S;
|
|
109
110
|
if (w > W) {
|
|
110
|
-
const
|
|
111
|
-
p =
|
|
111
|
+
const F = mo(e, p, W);
|
|
112
|
+
p = F.text, w = F.width;
|
|
112
113
|
} else if (z) {
|
|
113
|
-
let
|
|
114
|
-
for (const { segment: _ } of
|
|
114
|
+
let F = E;
|
|
115
|
+
for (const { segment: _ } of Nt.segment(z)) {
|
|
115
116
|
const q = e.measureText(_).width;
|
|
116
117
|
if (w + q > W) break;
|
|
117
|
-
P(_, q,
|
|
118
|
+
P(_, q, F), F += _.length;
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
k(p + ct, w + S), p = "", w = 0;
|
|
@@ -127,14 +128,14 @@ const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
|
127
128
|
C.length < s - 1 ? (k(p, w), p = "", w = 0, P(z, E, W)) : M(z, W);
|
|
128
129
|
return;
|
|
129
130
|
}
|
|
130
|
-
let
|
|
131
|
-
for (const { segment: _ } of
|
|
131
|
+
let F = W;
|
|
132
|
+
for (const { segment: _ } of Nt.segment(z)) {
|
|
132
133
|
if (C.length >= s) break;
|
|
133
134
|
const q = e.measureText(_).width;
|
|
134
|
-
w + q > a ? C.length < s - 1 ? (k(p, w), p = "", w = 0, P(_, q,
|
|
135
|
+
w + q > a ? C.length < s - 1 ? (k(p, w), p = "", w = 0, P(_, q, F)) : M() : P(_, q, F), F += _.length;
|
|
135
136
|
}
|
|
136
137
|
};
|
|
137
|
-
for (const { segment: z } of
|
|
138
|
+
for (const { segment: z } of ho.segment(i)) {
|
|
138
139
|
if (C.length >= s) break;
|
|
139
140
|
if (z.includes(`
|
|
140
141
|
`)) {
|
|
@@ -148,14 +149,14 @@ const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
|
148
149
|
}
|
|
149
150
|
k(p, w), p = "", w = 0, v = I;
|
|
150
151
|
}
|
|
151
|
-
const
|
|
152
|
-
|
|
152
|
+
const F = E[W];
|
|
153
|
+
F.length > 0 && (I += F.length, N(F, e.measureText(F).width, I - F.length));
|
|
153
154
|
}
|
|
154
155
|
continue;
|
|
155
156
|
}
|
|
156
157
|
I += z.length, N(z, e.measureText(z).width, I - z.length);
|
|
157
158
|
}
|
|
158
|
-
C.length < s && p !== "" && k(p, w),
|
|
159
|
+
C.length < s && p !== "" && k(p, w), pn.set(y, C);
|
|
159
160
|
}
|
|
160
161
|
if (g) {
|
|
161
162
|
const I = m === "middle" ? l / 2 : 0;
|
|
@@ -172,7 +173,7 @@ const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
|
172
173
|
}, $e = (e, t) => {
|
|
173
174
|
const { x: n = 0, y: o = 0, text: i, fill: a, fontSize: s = 13, textAlign: r = "left", verticalAlign: l = "middle", maxWidth: c = 1 / 0, needRender: u = !0, isUnderline: h = !1 } = t;
|
|
174
175
|
let m, g;
|
|
175
|
-
const C = `${e.font}-${i}-${s}-${c}`, S =
|
|
176
|
+
const C = `${e.font}-${i}-${s}-${c}`, S = fn.get(C);
|
|
176
177
|
if (S)
|
|
177
178
|
m = S.width, g = S.text;
|
|
178
179
|
else {
|
|
@@ -180,10 +181,10 @@ const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
|
180
181
|
if (p <= c)
|
|
181
182
|
g = i, m = p;
|
|
182
183
|
else {
|
|
183
|
-
const w = e.measureText(ct).width, v =
|
|
184
|
+
const w = e.measureText(ct).width, v = mo(e, i, c - w);
|
|
184
185
|
g = v.text + ct, m = v.width + w;
|
|
185
186
|
}
|
|
186
|
-
|
|
187
|
+
fn.set(C, { text: g, width: m });
|
|
187
188
|
}
|
|
188
189
|
if (u) {
|
|
189
190
|
const p = l === "middle" ? s / 2 : 0, w = r === "right" ? n + c : n;
|
|
@@ -209,7 +210,7 @@ const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
|
209
210
|
e.moveTo(n + u.tl, o), e.arcTo(n + i, o, n + i, o + u.tr, u.tr), e.arcTo(n + i, o + a, n + i - u.br, o + a, u.br), e.arcTo(n, o + a, n, o + a - u.bl, u.bl), e.arcTo(n, o, n + u.tl, o, u.tl);
|
|
210
211
|
}
|
|
211
212
|
e.closePath(), s && e.fill(), r && e.stroke(), c && (e.globalAlpha = 1);
|
|
212
|
-
},
|
|
213
|
+
}, hi = (e, t) => {
|
|
213
214
|
const { points: n, radiusAll: o, fill: i, stroke: a } = t, s = (c, u) => {
|
|
214
215
|
const h = u.x - c.x, m = u.y - c.y, g = Math.sqrt(h * h + m * m), C = h / g, S = m / g;
|
|
215
216
|
return { x: h, y: m, len: g, nx: C, ny: S, ang: Math.atan2(S, C) };
|
|
@@ -227,26 +228,26 @@ const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
|
227
228
|
P += -g.ny * k * w, M += g.nx * k * w, e.arc(P, M, k, m.ang + Math.PI / 2 * w, g.ang - Math.PI / 2 * w, v), l = u;
|
|
228
229
|
}
|
|
229
230
|
e.closePath(), i && e.fill(), a && e.stroke();
|
|
230
|
-
},
|
|
231
|
+
}, Vt = (e, t) => {
|
|
231
232
|
const { x: n, y: o, size: i, radius: a = 4, fill: s, stroke: r, isChecked: l = !1 } = t, c = l ? i : i - 1;
|
|
232
233
|
e.beginPath(), D(e, { x: n, y: o, width: c, height: c, radius: a, fill: s, stroke: r }), r && (e.strokeStyle = r), l && (e.save(), e.beginPath(), e.moveTo(n + i / 4.23, o + i / 1.97), e.lineTo(n + i / 2.42, o + i / 1.44), e.lineTo(n + i / 1.29, o + i / 3.25), e.lineJoin = "round", e.lineCap = "round", e.lineWidth = 1.9, e.stroke(), e.restore());
|
|
233
234
|
}, it = (e, t, n) => {
|
|
234
235
|
const { x: o, y: i, width: a, height: s } = t;
|
|
235
236
|
e.save(), e.beginPath(), e.rect(o, i, a, s), e.clip(), n(e), e.restore();
|
|
236
|
-
}, V = (e, t, n) => t > n ? e >= n && e <= t : e >= t && e <= n,
|
|
237
|
+
}, V = (e, t, n) => t > n ? e >= n && e <= t : e >= t && e <= n, mi = (e, t) => {
|
|
237
238
|
const [n, o] = e;
|
|
238
239
|
for (const [i, a] of t)
|
|
239
240
|
if (i <= n && a >= o) return !0;
|
|
240
241
|
return !1;
|
|
241
|
-
},
|
|
242
|
+
}, gi = (e) => {
|
|
242
243
|
const t = [];
|
|
243
244
|
for (const n of e)
|
|
244
245
|
for (let o = n[0]; o <= n[1]; o++) t.push(o);
|
|
245
246
|
return t;
|
|
246
|
-
},
|
|
247
|
+
}, fi = (e, t, n) => {
|
|
247
248
|
const [o, i] = e, [a, s] = t, [r, l] = n;
|
|
248
249
|
return o >= Math.min(a, r) && o <= Math.max(a, r) && i >= Math.min(s, l) && i <= Math.max(s, l);
|
|
249
|
-
},
|
|
250
|
+
}, Ft = (e) => {
|
|
250
251
|
if (e.length <= 1) return e;
|
|
251
252
|
const t = [...e].sort((i, a) => i[0] - a[0]), n = [];
|
|
252
253
|
let o = [...t[0]];
|
|
@@ -255,31 +256,31 @@ const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
|
255
256
|
a[0] <= o[1] + 1 ? o = [o[0], Math.max(o[1], a[1])] : (n.push(o), o = [...a]);
|
|
256
257
|
}
|
|
257
258
|
return n.push(o), n;
|
|
258
|
-
},
|
|
259
|
+
}, pi = (e, t) => {
|
|
259
260
|
const n = [];
|
|
260
261
|
let o = !1;
|
|
261
262
|
for (const i of e)
|
|
262
263
|
!o && i[0] === t[0] && t[1] === i[1] ? o = !0 : !o && t[0] > i[0] && t[1] < i[1] ? (n.push([i[0], t[0] - 1], [t[1] + 1, i[1]]), o = !0) : !o && t[0] <= i[1] && t[1] >= i[0] ? (t[0] > i[0] && n.push([i[0], t[0] - 1]), t[1] < i[1] && n.push([t[1] + 1, i[1]]), o = !0) : n.push([...i]);
|
|
263
|
-
return o || n.push(t),
|
|
264
|
-
},
|
|
264
|
+
return o || n.push(t), Ft(n);
|
|
265
|
+
}, Ci = (e) => {
|
|
265
266
|
if (!e.isCellSelection) return null;
|
|
266
267
|
const [t, n] = e.ranges[0], [o, i] = e.ranges[1];
|
|
267
268
|
return [Math.max(t, o), Math.max(n, i)];
|
|
268
|
-
},
|
|
269
|
+
}, wi = (e, t, n) => {
|
|
269
270
|
if (e == null) return { isRowActive: !1, isCellActive: !1 };
|
|
270
271
|
const [o, i] = e;
|
|
271
272
|
return {
|
|
272
273
|
isRowActive: i === t,
|
|
273
274
|
isCellActive: i === t && o === n
|
|
274
275
|
};
|
|
275
|
-
},
|
|
276
|
+
}, vi = (e, t, n) => e.isRowSelection && e.includes([t, t]) ? { isRowSelected: !0, isCellSelected: !0 } : e.isCellSelection && e.includes([n, t]) ? { isRowSelected: !1, isCellSelected: !0 } : { isRowSelected: !1, isCellSelected: !1 }, Gt = (e, t) => {
|
|
276
277
|
if (e.length !== t.length) return !1;
|
|
277
278
|
for (let n = 0; n < e.length; n++) {
|
|
278
279
|
const o = e[n], i = t[n];
|
|
279
280
|
if (o.length !== i.length || o[0] !== i[0] || o[1] !== i[1]) return !1;
|
|
280
281
|
}
|
|
281
282
|
return !0;
|
|
282
|
-
},
|
|
283
|
+
}, Ut = (e, t, n, o) => {
|
|
283
284
|
const { x: i, y: a } = t, { scrollLeft: s, scrollTop: r } = n, { freezeRegionWidth: l, rowInitSize: c } = e;
|
|
284
285
|
if (o === O.Columns) {
|
|
285
286
|
const u = i <= l ? i : s + i, h = e.getColumnStartIndex(u), m = e.getColumnOffset(h), g = e.getColumnWidth(h);
|
|
@@ -291,7 +292,7 @@ const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
|
291
292
|
}
|
|
292
293
|
return -1 / 0;
|
|
293
294
|
};
|
|
294
|
-
class
|
|
295
|
+
class Si {
|
|
295
296
|
state = It;
|
|
296
297
|
startPosition = 0;
|
|
297
298
|
options;
|
|
@@ -332,7 +333,7 @@ class pi {
|
|
|
332
333
|
end(t, n) {
|
|
333
334
|
const { type: o, isDragging: i, ranges: a } = this.state;
|
|
334
335
|
if (i && n && (o === O.Columns || o === O.Rows)) {
|
|
335
|
-
const s =
|
|
336
|
+
const s = Ut(this.options.coordInstance(), t, this.options.scrollState(), o);
|
|
336
337
|
V(s, a[0][0], a[a.length - 1][1]) || n(a, s);
|
|
337
338
|
}
|
|
338
339
|
this.setState(It);
|
|
@@ -342,20 +343,20 @@ class pi {
|
|
|
342
343
|
this.setState(It);
|
|
343
344
|
}
|
|
344
345
|
}
|
|
345
|
-
const
|
|
346
|
-
const a =
|
|
346
|
+
const go = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0, yi = (e, t, n) => Math.max(e - go(t, n) * 2, 0), Kt = (e, t, n, o, i) => {
|
|
347
|
+
const a = go(t, n), s = yi(e, t, n);
|
|
347
348
|
return a + s / (o || 1) * (i + 0.5);
|
|
348
|
-
},
|
|
349
|
+
}, fo = ({ width: e, theme: t, rowControls: n, rowControlPaddingX: o }) => {
|
|
349
350
|
if (!o) return e / 2;
|
|
350
351
|
const i = n.findIndex((a) => a.type === $.Checkbox);
|
|
351
|
-
return i < 0 ? e / 2 :
|
|
352
|
-
},
|
|
352
|
+
return i < 0 ? e / 2 : Kt(e, t, o, n.length, i);
|
|
353
|
+
}, bi = (e, t, n) => {
|
|
353
354
|
const { x: o, y: i } = n, { scrollLeft: a, scrollTop: s } = t, { freezeRegionWidth: r, totalWidth: l, rowInitSize: c, columnInitSize: u, columnCount: h } = e, { columnAppendBtnWidth: m } = B, g = i < 0 ? -1 / 0 : i <= c ? -1 : e.getRowStartIndex(s + i), C = o < 0 ? -1 / 0 : a + o > l && a + o < l + m ? -2 : o <= r ? o <= u ? -1 : e.getColumnStartIndex(o) : e.getColumnStartIndex(a + o);
|
|
354
355
|
return { x: o, y: i, rowIndex: g, columnIndex: Math.min(C, h - 1) };
|
|
355
|
-
},
|
|
356
|
+
}, xi = (e, t, n, o = e.containerHeight) => {
|
|
356
357
|
const { x: i, y: a } = n, { totalHeight: s, totalWidth: r, containerHeight: l } = e;
|
|
357
358
|
return t.scrollLeft + i > r + B.columnAppendBtnWidth || t.scrollTop + a > s && !V(a, l, o);
|
|
358
|
-
},
|
|
359
|
+
}, Ri = {
|
|
359
360
|
[$.Drag]: b.RowHeaderDragHandler,
|
|
360
361
|
[$.Checkbox]: b.RowHeaderCheckbox,
|
|
361
362
|
[$.Expand]: b.RowHeaderExpandHandler
|
|
@@ -365,13 +366,13 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
365
366
|
y: 1 / 0,
|
|
366
367
|
width: 0,
|
|
367
368
|
height: 0
|
|
368
|
-
}, { groupHeaderHeight:
|
|
369
|
-
const o =
|
|
369
|
+
}, { groupHeaderHeight: ki, columnHeadPadding: Cn, columnResizeHandlerWidth: wn, rowHeadIconPaddingTop: Ii, columnFreezeHandlerWidth: Pi, fillHandlerSize: zi, fillHandlerPadding: Mi } = B, Ai = (e) => Hi(e) ?? Ki(e) ?? Ti(e) ?? Ni(e) ?? Fi(e) ?? Li(e) ?? Di(e) ?? Wi(e) ?? Bi(e) ?? Oi(e) ?? Vi(e) ?? Gi(e) ?? Ui(e) ?? _i(e) ?? $i(e) ?? ie, Ei = (e, t, n) => {
|
|
370
|
+
const o = bi(e.coordInstance, e.scrollState, t), i = xi(e.coordInstance, e.scrollState, t, n), a = Ai({
|
|
370
371
|
...e,
|
|
371
372
|
position: o,
|
|
372
373
|
isOutOfBounds: i,
|
|
373
|
-
getLinearRow: e.getLinearRow ??
|
|
374
|
-
real2RowIndex: e.real2RowIndex ??
|
|
374
|
+
getLinearRow: e.getLinearRow ?? Ot,
|
|
375
|
+
real2RowIndex: e.real2RowIndex ?? lo
|
|
375
376
|
});
|
|
376
377
|
return {
|
|
377
378
|
...o,
|
|
@@ -381,30 +382,30 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
381
382
|
columnIndex: a.columnIndex ?? o.columnIndex,
|
|
382
383
|
region: a
|
|
383
384
|
};
|
|
384
|
-
},
|
|
385
|
+
}, Hi = (e) => e.isFreezing ? { ...ie, type: b.ColumnFreezeHandler } : null, Ti = (e) => {
|
|
385
386
|
const { coordInstance: t, scrollState: n, position: o, activeCell: i, activeCellBound: a, real2RowIndex: s } = e;
|
|
386
387
|
if (i == null || a == null) return null;
|
|
387
388
|
const { x: r, y: l } = o, { scrollTop: c, scrollLeft: u } = n, [h, m] = i, g = s(m);
|
|
388
389
|
if (g == null) return null;
|
|
389
390
|
const C = t.getRowOffset(g) - c, S = t.getColumnRelativeOffset(h, u), { width: p, height: w } = a;
|
|
390
391
|
return V(r, S, S + p) && V(l, C, C + w) ? { type: b.ActiveCell, x: S, y: C, width: p, height: w, rowIndex: g, columnIndex: h, isOutOfBounds: !1 } : null;
|
|
391
|
-
},
|
|
392
|
+
}, Ni = (e) => e.isOutOfBounds ? ie : null, Fi = (e) => !e.isSelecting || !e.selection.isCellSelection ? null : { ...ie, type: b.Cell }, Li = (e) => e.columnResizeState.columnIndex <= -1 ? null : { ...ie, type: b.ColumnResizeHandler }, Di = (e) => e.dragState.isDragging ? { ...ie, type: b.ColumnHeader } : null, Wi = (e) => {
|
|
392
393
|
const { position: t, scrollState: n, coordInstance: o, isColumnFreezable: i } = e;
|
|
393
394
|
if (!i) return null;
|
|
394
|
-
const { x: a, y: s } = t, { freezeRegionWidth: r, rowInitSize: l, rowCount: c, containerHeight: u } = o, h = o.getRowOffset(c) - n.scrollTop, m = Math.min(h, u), g =
|
|
395
|
+
const { x: a, y: s } = t, { freezeRegionWidth: r, rowInitSize: l, rowCount: c, containerHeight: u } = o, h = o.getRowOffset(c) - n.scrollTop, m = Math.min(h, u), g = Pi / 2;
|
|
395
396
|
return V(a, r - g, r + g) && V(s, l, m) ? { ...ie, type: b.ColumnFreezeHandler } : null;
|
|
396
|
-
},
|
|
397
|
+
}, Bi = (e) => {
|
|
397
398
|
const { rowIndex: t, columnIndex: n } = e.position;
|
|
398
399
|
return e.isColumnAppendEnable && t >= -1 && n === -2 ? { ...ie, type: b.AppendColumn } : null;
|
|
399
|
-
},
|
|
400
|
+
}, Oi = (e) => {
|
|
400
401
|
const { position: t, theme: n, rowControls: o, rowControlPaddingX: i, coordInstance: a, isMultiSelectionEnable: s } = e, { x: r, y: l, rowIndex: c, columnIndex: u } = t;
|
|
401
402
|
if (!s || c !== -1 || u !== -1 || !o.some((v) => v.type === $.Checkbox)) return null;
|
|
402
|
-
const { iconSizeXS: h } = n, m = h / 2, { rowInitSize: g, columnInitSize: C } = a, p =
|
|
403
|
+
const { iconSizeXS: h } = n, m = h / 2, { rowInitSize: g, columnInitSize: C } = a, p = fo({ width: C, theme: n, rowControls: o, rowControlPaddingX: i }) - m, w = g / 2 - m;
|
|
403
404
|
return V(r, p, p + h) && V(l, w, w + h) ? { type: b.AllCheckbox, x: p, y: w, width: h, height: h } : null;
|
|
404
|
-
},
|
|
405
|
+
}, Vi = (e) => {
|
|
405
406
|
const { rowIndex: t, columnIndex: n } = e.position;
|
|
406
407
|
return n >= -1 && t > -1 ? e.getLinearRow(t).type !== le.Append ? null : { ...ie, type: b.AppendRow } : null;
|
|
407
|
-
},
|
|
408
|
+
}, Gi = (e) => {
|
|
408
409
|
const { position: t, theme: n, rowControls: o, rowControlPaddingX: i, scrollState: a, coordInstance: s } = e, { x: r, y: l, rowIndex: c, columnIndex: u } = t;
|
|
409
410
|
if (c <= -1 || u !== -1) return null;
|
|
410
411
|
const h = e.getLinearRow(c);
|
|
@@ -412,24 +413,24 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
412
413
|
if (h.type !== le.Row) return null;
|
|
413
414
|
const { iconSizeXS: m } = n, g = m / 2, C = s.getRowOffset(c) - a.scrollTop;
|
|
414
415
|
for (let S = 0; S < o.length; S++) {
|
|
415
|
-
const p =
|
|
416
|
+
const p = Ri[o[S].type], v = Kt(s.columnInitSize, n, i, o.length, S) - g, y = C + Ii;
|
|
416
417
|
if (p && V(r, v, v + m) && V(l, y, y + m))
|
|
417
418
|
return { type: p, x: v, y, width: m, height: m };
|
|
418
419
|
}
|
|
419
420
|
return { ...ie, type: b.RowHeader };
|
|
420
|
-
},
|
|
421
|
+
}, Ui = (e) => {
|
|
421
422
|
const { position: t, scrollState: n, coordInstance: o, getLinearRow: i } = e, { x: a, y: s, rowIndex: r, columnIndex: l } = t;
|
|
422
423
|
if (r <= -1 || l !== 0 || i(r).type !== le.Group) return null;
|
|
423
424
|
const c = o.getColumnWidth(l), u = o.getColumnRelativeOffset(l, n.scrollLeft);
|
|
424
|
-
return V(a, u, u + c) ? { type: b.RowGroupHeader, x: u, y: s, width: c, height:
|
|
425
|
-
},
|
|
425
|
+
return V(a, u, u + c) ? { type: b.RowGroupHeader, x: u, y: s, width: c, height: ki } : null;
|
|
426
|
+
}, Ki = (e) => {
|
|
426
427
|
const { position: t, selection: n, coordInstance: o, scrollState: i, activeCell: a, activeCellBound: s, isFillEnabled: r, real2RowIndex: l } = e;
|
|
427
428
|
if (!r) return null;
|
|
428
429
|
const { isCellSelection: c, ranges: u } = n, { x: h, y: m, rowIndex: g, columnIndex: C } = t;
|
|
429
430
|
if (!c || g < 0 || C < 0) return null;
|
|
430
|
-
const [S, p] = u[0], [w, v] = u[1], y = Math.max(S, w), R = Math.max(p, v), I = l(R), k = o.getColumnRelativeOffset(y, i.scrollLeft) + o.getColumnWidth(y), N = S === w && p === v && a != null && s != null && a[0] === y && a[1] === R && s ? s.height : o.getRowHeight(I), z = o.getRowOffset(I) + N - i.scrollTop, E =
|
|
431
|
-
return V(h, W, W + E * 2) && V(m,
|
|
432
|
-
},
|
|
431
|
+
const [S, p] = u[0], [w, v] = u[1], y = Math.max(S, w), R = Math.max(p, v), I = l(R), k = o.getColumnRelativeOffset(y, i.scrollLeft) + o.getColumnWidth(y), N = S === w && p === v && a != null && s != null && a[0] === y && a[1] === R && s ? s.height : o.getRowHeight(I), z = o.getRowOffset(I) + N - i.scrollTop, E = zi / 2 + Mi, W = k - E, F = z - E;
|
|
432
|
+
return V(h, W, W + E * 2) && V(m, F, F + E * 2) ? { type: b.FillHandler, x: W, y: F, width: E * 2, height: E * 2 } : null;
|
|
433
|
+
}, _i = (e) => {
|
|
433
434
|
const { coordInstance: t, position: n, scrollState: o, getLinearRow: i } = e, { rowIndex: a, columnIndex: s } = n;
|
|
434
435
|
return a > -1 && s > -1 ? i(a).type !== le.Row ? null : {
|
|
435
436
|
type: b.Cell,
|
|
@@ -438,33 +439,33 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
438
439
|
width: t.getColumnWidth(s),
|
|
439
440
|
height: t.getRowHeight(a)
|
|
440
441
|
} : null;
|
|
441
|
-
},
|
|
442
|
+
}, $i = (e) => {
|
|
442
443
|
const { position: t, scrollState: n, coordInstance: o, columns: i, theme: a, isColumnResizable: s, isColumnHeaderMenuVisible: r } = e, { x: l, y: c, rowIndex: u, columnIndex: h } = t, { iconSizeXS: m } = a;
|
|
443
444
|
if (u !== -1 || h <= -1) return null;
|
|
444
445
|
const g = i[h];
|
|
445
446
|
if (g == null) return null;
|
|
446
|
-
const { rowInitSize: C } = o, { isPrimary: S, description: p, hasMenu: w } = g, v = !!(w && r), y = o.getColumnWidth(h), R = o.getColumnRelativeOffset(h, n.scrollLeft), I = R + y, k = v ? I -
|
|
447
|
+
const { rowInitSize: C } = o, { isPrimary: S, description: p, hasMenu: w } = g, v = !!(w && r), y = o.getColumnWidth(h), R = o.getColumnRelativeOffset(h, n.scrollLeft), I = R + y, k = v ? I - Cn / 2 - m : I;
|
|
447
448
|
if (v && V(l, k, k + m))
|
|
448
449
|
return { type: b.ColumnHeaderMenu, x: R, y: 0, width: m, height: C };
|
|
449
|
-
const P = k - m -
|
|
450
|
+
const P = k - m - Cn / 2, M = (C - m) / 2;
|
|
450
451
|
if (p && V(l, P, P + m) && V(c, M, M + m))
|
|
451
452
|
return { type: b.ColumnDescription, x: P, y: M, width: m, height: m };
|
|
452
453
|
const N = R + m / 2, z = (C - m) / 2;
|
|
453
|
-
return S && V(l, N, N + m) && V(c, z, z + m) ? { type: b.ColumnPrimaryIcon, x: N, y: z, width: m, height: m } : s && (h !== 0 && V(l, R, R +
|
|
454
|
+
return S && V(l, N, N + m) && V(c, z, z + m) ? { type: b.ColumnPrimaryIcon, x: N, y: z, width: m, height: m } : s && (h !== 0 && V(l, R, R + wn / 2) || V(l, I - wn / 2, I)) ? { ...ie, type: b.ColumnResizeHandler } : { type: b.ColumnHeader, x: R, y: 0, width: y, height: C };
|
|
454
455
|
}, {
|
|
455
456
|
fillHandlerSize: at,
|
|
456
|
-
cellTextLineHeight:
|
|
457
|
-
rowHeadIconPaddingTop:
|
|
458
|
-
columnHeadHeight:
|
|
457
|
+
cellTextLineHeight: vn,
|
|
458
|
+
rowHeadIconPaddingTop: Sn,
|
|
459
|
+
columnHeadHeight: yn,
|
|
459
460
|
columnHeadPadding: oe,
|
|
460
461
|
columnHeadMenuSize: Me,
|
|
461
|
-
columnAppendBtnWidth:
|
|
462
|
-
columnResizeHandlerWidth:
|
|
463
|
-
columnResizeHandlerPaddingTop:
|
|
462
|
+
columnAppendBtnWidth: bn,
|
|
463
|
+
columnResizeHandlerWidth: xn,
|
|
464
|
+
columnResizeHandlerPaddingTop: Rn,
|
|
464
465
|
cellVerticalPaddingMD: Lt,
|
|
465
|
-
columnFreezeHandlerWidth:
|
|
466
|
-
columnFreezeHandlerHeight:
|
|
467
|
-
} = B,
|
|
466
|
+
columnFreezeHandlerWidth: kn,
|
|
467
|
+
columnFreezeHandlerHeight: In
|
|
468
|
+
} = B, Pn = (e, t) => {
|
|
468
469
|
const { rowCount: n, columnCount: o } = e, i = e.getRowStartIndex(t.scrollTop), a = e.getRowStopIndex(i, t.scrollTop), s = e.getColumnStartIndex(t.scrollLeft), r = e.getColumnStopIndex(s, t.scrollLeft);
|
|
469
470
|
return {
|
|
470
471
|
startRowIndex: Math.max(0, i),
|
|
@@ -472,38 +473,38 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
472
473
|
startColumnIndex: Math.max(0, s),
|
|
473
474
|
stopColumnIndex: Math.max(0, Math.min(o - 1, r))
|
|
474
475
|
};
|
|
475
|
-
},
|
|
476
|
+
}, qi = (e) => ({
|
|
476
477
|
...e,
|
|
477
|
-
getLinearRow: e.getLinearRow ??
|
|
478
|
-
real2RowIndex: e.real2RowIndex ??
|
|
479
|
-
}),
|
|
478
|
+
getLinearRow: e.getLinearRow ?? Ot,
|
|
479
|
+
real2RowIndex: e.real2RowIndex ?? lo
|
|
480
|
+
}), zn = (e, t) => {
|
|
480
481
|
const { coordInstance: n, visibleRegion: o, activeCell: i, highlightedRowIndex: a, mouseState: s, scrollState: r, selection: l, isSelecting: c, theme: u, getLinearRow: h } = e, { freezeColumnCount: m, columnInitSize: g, totalWidth: C, rowCount: S } = n, { isRowSelection: p, isColumnSelection: w } = l, { scrollLeft: v, scrollTop: y } = r, { rowIndex: R, type: I, isOutOfBounds: k } = s, P = [], M = [], N = [];
|
|
481
482
|
if (!S) return { cellPropList: P, rowHeaderPropList: M, appendRowList: N };
|
|
482
|
-
const z = t === "freeze", E = z ? 0 : Math.max(m, o.startColumnIndex), W = z ? Math.max(m - 1, 0) : o.stopColumnIndex,
|
|
483
|
+
const z = t === "freeze", E = z ? 0 : Math.max(m, o.startColumnIndex), W = z ? Math.max(m - 1, 0) : o.stopColumnIndex, F = z && m === 0, { cellBg: _, cellBgHovered: q, cellBgSelected: ae } = u;
|
|
483
484
|
for (let X = E; X <= W; X++) {
|
|
484
|
-
const A = n.getColumnRelativeOffset(X, v),
|
|
485
|
+
const A = n.getColumnRelativeOffset(X, v), L = n.getColumnWidth(X), fe = w && l.includes([X, X]), Te = X === 0;
|
|
485
486
|
for (let Y = o.startRowIndex; Y <= o.stopRowIndex; Y++) {
|
|
486
|
-
const Ne = h(Y),
|
|
487
|
+
const Ne = h(Y), Fe = n.getRowHeight(Y), Le = n.getRowOffset(Y) - y;
|
|
487
488
|
if (Ne.type === le.Group) continue;
|
|
488
489
|
if (Ne.type === le.Append) {
|
|
489
|
-
Te && N.push({ x: 0.5, y:
|
|
490
|
+
Te && N.push({ x: 0.5, y: Le + 0.5, width: C - v, height: Fe, isHover: I === b.AppendRow && R === Y });
|
|
490
491
|
continue;
|
|
491
492
|
}
|
|
492
|
-
const { displayIndex: ft, realIndex: Pe } = Ne, Ye = !k && !c &&
|
|
493
|
+
const { displayIndex: ft, realIndex: Pe } = Ne, Ye = !k && !c && ui.has(I) && Y === R, { isCellActive: je, isRowActive: Se } = wi(i, Pe, X), { isRowSelected: ye, isCellSelected: ce } = vi(l, Pe, X), Qe = a === Pe;
|
|
493
494
|
let re;
|
|
494
495
|
ce || ye || fe ? re = ae : (Ye || Se || Qe) && (re = q), Te && M.push({
|
|
495
496
|
x: 0.5,
|
|
496
|
-
y:
|
|
497
|
+
y: Le + 0.5,
|
|
497
498
|
width: g + 0.5,
|
|
498
|
-
height:
|
|
499
|
+
height: Fe,
|
|
499
500
|
displayIndex: String(ft),
|
|
500
501
|
isHover: Ye || Se || Qe,
|
|
501
502
|
isChecked: p && ye
|
|
502
|
-
}), !
|
|
503
|
+
}), !F && P.push({
|
|
503
504
|
x: A + 0.5,
|
|
504
|
-
y:
|
|
505
|
-
width:
|
|
506
|
-
height:
|
|
505
|
+
y: Le + 0.5,
|
|
506
|
+
width: L,
|
|
507
|
+
height: Fe,
|
|
507
508
|
rowIndex: Pe,
|
|
508
509
|
columnIndex: X,
|
|
509
510
|
theme: u,
|
|
@@ -513,7 +514,7 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
513
514
|
}
|
|
514
515
|
}
|
|
515
516
|
return { cellPropList: P, rowHeaderPropList: M, appendRowList: N };
|
|
516
|
-
},
|
|
517
|
+
}, Xi = (e, t, n) => {
|
|
517
518
|
const { x: o, y: i, width: a, height: s, displayIndex: r, isHover: l, isChecked: c } = t, { theme: u, rowControls: h, rowControlPaddingX: m, rowIndexVisible: g = !0, drawIcon: C } = n, { cellBg: S, cellBgHovered: p, cellBgSelected: w, cellLineColor: v, rowHeaderTextColor: y, iconSizeXS: R, staticWhite: I, iconBgSelected: k } = u;
|
|
518
519
|
D(e, { x: o, y: i, width: a, height: s, fill: c ? w : l ? p : S }), Ke(e, { x: o, y: i, points: [0, 0, a, 0], stroke: v }), Ke(e, { x: o, y: i, points: [0, s, a, s], stroke: v });
|
|
519
520
|
const M = R / 2;
|
|
@@ -521,11 +522,11 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
521
522
|
for (let N = 0; N < h.length; N++) {
|
|
522
523
|
const { type: z } = h[N];
|
|
523
524
|
if (z === $.Spacer) continue;
|
|
524
|
-
const E =
|
|
525
|
+
const E = Kt(a, u, m, h.length, N);
|
|
525
526
|
if (z === $.Checkbox) {
|
|
526
|
-
|
|
527
|
+
Vt(e, {
|
|
527
528
|
x: o + E - M,
|
|
528
|
-
y: i +
|
|
529
|
+
y: i + Sn,
|
|
529
530
|
size: R,
|
|
530
531
|
stroke: c ? I : y,
|
|
531
532
|
fill: c ? k : void 0,
|
|
@@ -533,18 +534,18 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
533
534
|
});
|
|
534
535
|
continue;
|
|
535
536
|
}
|
|
536
|
-
c && !l && g && z === $.Expand || C?.(e, { kind: z === $.Drag ? "drag" : "expand", x: o + E - M, y: i +
|
|
537
|
+
c && !l && g && z === $.Expand || C?.(e, { kind: z === $.Drag ? "drag" : "expand", x: o + E - M, y: i + Sn, size: R, theme: u });
|
|
537
538
|
}
|
|
538
539
|
return;
|
|
539
540
|
}
|
|
540
541
|
$e(e, { x: o + a / 2, y: i + Lt + 1, text: r, textAlign: "center", fill: y, fontSize: u.fontSizeXXS });
|
|
541
|
-
},
|
|
542
|
+
}, Yi = (e, t, n) => {
|
|
542
543
|
const { x: o, y: i, width: a, height: s, isHover: r } = t, { theme: l, coordInstance: c, drawIcon: u } = n, { appendRowBgHovered: h, iconSizeSM: m, cellBg: g, cellLineColor: C } = l, S = m / 2;
|
|
543
544
|
e.save(), e.beginPath(), D(e, { x: o + 0.5, y: i + 0.5, width: a, height: s, fill: r ? h : g }), D(e, { x: o, y: i + s, width: a, height: 1, fill: C }), u?.(e, { kind: "add", x: o + c.columnInitSize / 2 - S + 0.5, y: i + s / 2 - S + 0.5, size: m, theme: l }), e.restore();
|
|
544
|
-
},
|
|
545
|
-
const { coordInstance: o, theme: i, shouldRerender: a, drawCell: s } = n, { fontFamily: r, fontSizeSM: l, cellLineColor: c } = i, { rowInitSize: u, freezeRegionWidth: h, containerWidth: m, containerHeight: g } = o, C =
|
|
546
|
-
S.appendRowList.forEach((v) =>
|
|
547
|
-
S.cellPropList.forEach(({ x: y, y: R, width: I, height: k, fill: P }) => D(v, { x: y, y: R, width: I, height: k, fill: P, stroke: c })), S.rowHeaderPropList.forEach((y) =>
|
|
545
|
+
}, Mn = (e, t, n) => {
|
|
546
|
+
const { coordInstance: o, theme: i, shouldRerender: a, drawCell: s } = n, { fontFamily: r, fontSizeSM: l, cellLineColor: c } = i, { rowInitSize: u, freezeRegionWidth: h, containerWidth: m, containerHeight: g } = o, C = zn(n, "other"), S = zn(n, "freeze"), p = { x: 0, y: u + 1, width: h + 1, height: g - u - 1 }, w = { x: h + 1, y: u + 1, width: m - h, height: g - u - 1 };
|
|
547
|
+
S.appendRowList.forEach((v) => Yi(e, v, n)), it(e, p, (v) => {
|
|
548
|
+
S.cellPropList.forEach(({ x: y, y: R, width: I, height: k, fill: P }) => D(v, { x: y, y: R, width: I, height: k, fill: P, stroke: c })), S.rowHeaderPropList.forEach((y) => Xi(v, y, n));
|
|
548
549
|
}), it(e, w, (v) => {
|
|
549
550
|
C.cellPropList.forEach(({ x: y, y: R, width: I, height: k, fill: P }) => D(v, { x: y, y: R, width: I, height: k, fill: P, stroke: c }));
|
|
550
551
|
}), a && (it(t, p, (v) => {
|
|
@@ -552,34 +553,34 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
552
553
|
}), it(t, w, (v) => {
|
|
553
554
|
v.font = `${l}px ${r}`, C.cellPropList.forEach((y) => s(v, y));
|
|
554
555
|
}));
|
|
555
|
-
},
|
|
556
|
+
}, ji = (e, t) => {
|
|
556
557
|
const { theme: n, scrollState: o, coordInstance: i, activeCellBound: a, real2RowIndex: s, getLinearRow: r, drawCell: l } = t;
|
|
557
558
|
if (a == null) return;
|
|
558
559
|
const { width: c, height: u, columnIndex: h, rowIndex: m } = a, { freezeColumnCount: g, freezeRegionWidth: C, containerWidth: S, containerHeight: p, columnCount: w, rowInitSize: v } = i, y = s(m);
|
|
559
560
|
if (h >= w || r(y)?.type !== le.Row) return;
|
|
560
561
|
const R = h < g, I = i.getColumnRelativeOffset(h, o.scrollLeft), k = i.getRowOffset(y) - o.scrollTop;
|
|
561
562
|
e.save(), e.beginPath(), e.rect(R ? 0 : C, v, R ? C + 1 : S - C, p - v), e.clip(), e.font = `${n.fontSizeSM}px ${n.fontFamily}`, D(e, { x: I + 0.5, y: k + 0.5, width: c, height: u, fill: n.cellBg, stroke: n.cellLineColorActived, radius: 2 }), l(e, { x: I + 0.5, y: k + 0.5, width: c, height: u, rowIndex: m, columnIndex: h, theme: n, isActive: !0 }), e.restore();
|
|
562
|
-
},
|
|
563
|
+
}, Qi = (e, t) => {
|
|
563
564
|
const { selection: n, mouseState: o, coordInstance: i, scrollState: a, theme: s, isFilling: r, isFillEnabled: l, real2RowIndex: c, getLinearRow: u } = t;
|
|
564
565
|
if (!r || !l || !n.isCellSelection) return;
|
|
565
566
|
const [h, m] = n.ranges, g = Math.min(h[0], m[0]), C = Math.max(h[0], m[0]), S = Math.min(h[1], m[1]), p = Math.max(h[1], m[1]), w = u(o.rowIndex).realIndex, { scrollLeft: v, scrollTop: y } = a, R = i.getColumnRelativeOffset(g, v), I = i.getColumnRelativeOffset(C, v) + i.getColumnWidth(C), k = (N) => i.getRowOffset(c(N)) + i.getRowHeight(c(N)) - y;
|
|
566
567
|
let P = null, M = null;
|
|
567
568
|
Number.isFinite(w) && w > p ? (P = i.getRowOffset(c(p + 1)) - y, M = k(w)) : Number.isFinite(w) && w < S && (P = i.getRowOffset(c(w)) - y, M = k(S - 1)), !(P == null || M == null) && (e.save(), e.globalAlpha = 0.12, D(e, { x: R + 0.5, y: P + 0.5, width: I - R, height: M - P, fill: s.interactionLineColorHighlight }), e.restore(), D(e, { x: R + 0.5, y: P + 0.5, width: I - R, height: M - P, stroke: s.interactionLineColorHighlight }));
|
|
568
|
-
},
|
|
569
|
+
}, Zi = (e, t) => {
|
|
569
570
|
const { coordInstance: n, scrollState: o, selection: i, isSelecting: a, isEditing: s, theme: r, activeCellBound: l, isFillEnabled: c, real2RowIndex: u, getLinearRow: h } = t;
|
|
570
571
|
if (!c || s || a) return;
|
|
571
|
-
const m =
|
|
572
|
+
const m = Ci(i);
|
|
572
573
|
if (m == null) return;
|
|
573
|
-
const { freezeColumnCount: g, freezeRegionWidth: C, rowInitSize: S, containerWidth: p, containerHeight: w } = n, [v, y] = m, R = n.getColumnRelativeOffset(v, o.scrollLeft), I = u(y), k = n.getRowOffset(I) - o.scrollTop, P = n.getColumnWidth(v), z =
|
|
574
|
+
const { freezeColumnCount: g, freezeRegionWidth: C, rowInitSize: S, containerWidth: p, containerHeight: w } = n, [v, y] = m, R = n.getColumnRelativeOffset(v, o.scrollLeft), I = u(y), k = n.getRowOffset(I) - o.scrollTop, P = n.getColumnWidth(v), z = Gt([i.ranges[0]], [i.ranges[1]]) && l != null && l.columnIndex === v && l.rowIndex === y && h(I).type === le.Row ? l.height : n.getRowHeight(I);
|
|
574
575
|
e.save(), e.beginPath(), v >= g && (e.rect(C, S, p - C, w - S), e.clip()), D(e, { x: R + P - at / 2 - 0.5, y: k + z - at / 2 - 0.5, width: at, height: at, stroke: r.cellLineColorActived, fill: r.cellBg }), e.restore();
|
|
575
|
-
},
|
|
576
|
+
}, Ji = (e, t, n) => {
|
|
576
577
|
const { x: o, y: i, width: a, height: s, fill: r, column: l, hasMenu: c } = t, { theme: u, drawIcon: h } = n, { name: m, description: g, hasMenu: C, isPrimary: S, hasIcon: p } = l, { cellLineColor: w, columnHeaderBg: v, iconFgCommon: y, columnHeaderNameColor: R, fontSizeSM: I, iconSizeXS: k } = u;
|
|
577
578
|
let P = a - oe * 2, M = oe;
|
|
578
|
-
const N = c && C, z = i + (
|
|
579
|
+
const N = c && C, z = i + (yn - k) / 2;
|
|
579
580
|
if (D(e, { x: o + 0.5, y: i, width: a - 0.5, height: s, fill: r ?? v }), Ke(e, { x: o, y: i, points: [0, s, a, s, a, 0], stroke: w }), S && (P = P - k - oe, h?.(e, { kind: "primary", x: o + M, y: z, size: k, theme: u, column: l }), M += k + oe / 2), p && (P = P - k, h?.(e, { kind: "column", x: o + M, y: z, size: k, theme: u, column: l }), M += k + oe / 2), N) {
|
|
580
581
|
P = P - Me - oe;
|
|
581
|
-
const E = i +
|
|
582
|
-
|
|
582
|
+
const E = i + yn / 2;
|
|
583
|
+
hi(e, {
|
|
583
584
|
points: [
|
|
584
585
|
{ x: o + a - oe - Me, y: E - Me / 4 },
|
|
585
586
|
{ x: o + a - oe, y: E - Me / 4 },
|
|
@@ -589,21 +590,21 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
589
590
|
fill: y
|
|
590
591
|
});
|
|
591
592
|
}
|
|
592
|
-
g && (h?.(e, { kind: "description", x: N ? o + a - 2 * k - oe : o + a - k - oe, y: z, size: k, theme: u, column: l }), P = P - k - oe),
|
|
593
|
+
g && (h?.(e, { kind: "description", x: N ? o + a - 2 * k - oe : o + a - k - oe, y: z, size: k, theme: u, column: l }), P = P - k - oe), di(e, {
|
|
593
594
|
x: o + M,
|
|
594
595
|
y: i + Lt,
|
|
595
596
|
text: m,
|
|
596
|
-
maxLines: Math.max(1, Math.floor((s - Lt) /
|
|
597
|
-
lineHeight:
|
|
597
|
+
maxLines: Math.max(1, Math.floor((s - Lt) / vn)),
|
|
598
|
+
lineHeight: vn,
|
|
598
599
|
fontSize: I,
|
|
599
600
|
maxWidth: P,
|
|
600
601
|
fill: R
|
|
601
602
|
});
|
|
602
|
-
},
|
|
603
|
+
}, ea = (e, t, n) => {
|
|
603
604
|
const { x: o, y: i, width: a, height: s, isChecked: r } = t, { theme: l, rowControls: c, rowControlPaddingX: u, isMultiSelectionEnable: h } = n, { iconSizeXS: m, staticWhite: g, columnHeaderBg: C, cellLineColor: S, rowHeaderTextColor: p, iconBgSelected: w } = l, v = m / 2;
|
|
604
605
|
if (D(e, { x: o, y: i, width: a, height: s, fill: C }), Ke(e, { x: o, y: i, points: [0, s, a, s], stroke: S }), h && c.some((y) => y.type === $.Checkbox)) {
|
|
605
|
-
const y =
|
|
606
|
-
|
|
606
|
+
const y = fo({ width: a, theme: l, rowControls: c, rowControlPaddingX: u });
|
|
607
|
+
Vt(e, {
|
|
607
608
|
x: o + y - v + 0.5,
|
|
608
609
|
y: i + s / 2 - v,
|
|
609
610
|
size: m,
|
|
@@ -612,14 +613,14 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
612
613
|
isChecked: r
|
|
613
614
|
});
|
|
614
615
|
}
|
|
615
|
-
},
|
|
616
|
+
}, An = (e, t, n) => {
|
|
616
617
|
const { visibleRegion: o, coordInstance: i, columns: a, theme: s, mouseState: r, scrollState: l, selection: c, isInteracting: u, isColumnHeaderMenuVisible: h } = t, { containerWidth: m, freezeRegionWidth: g, rowInitSize: C, columnInitSize: S, freezeColumnCount: p, pureRowCount: w } = i, { isColumnSelection: v, isRowSelection: y, ranges: R } = c, { type: I, columnIndex: k } = r, P = n === "freeze", M = P ? 0 : Math.max(p, o.startColumnIndex), N = P ? Math.max(p - 1, 0) : o.stopColumnIndex;
|
|
617
618
|
e.save(), e.beginPath(), e.rect(P ? 0 : g + 1, 0, P ? g + 1 : m - g, C + 1), e.clip(), e.font = `normal ${s.fontSizeSM}px ${s.fontFamily}`;
|
|
618
619
|
for (let E = M; E <= N; E++) {
|
|
619
620
|
const W = a[E];
|
|
620
621
|
if (W == null) continue;
|
|
621
|
-
const
|
|
622
|
-
|
|
622
|
+
const F = v && c.includes([E, E]), _ = !u && (I === b.ColumnHeader || I === b.ColumnHeaderMenu) && k === E, q = F ? s.columnHeaderBgSelected : _ ? s.columnHeaderBgHovered : void 0;
|
|
623
|
+
Ji(e, {
|
|
623
624
|
x: i.getColumnRelativeOffset(E, l.scrollLeft) + 0.5,
|
|
624
625
|
y: 0.5,
|
|
625
626
|
width: i.getColumnWidth(E),
|
|
@@ -629,42 +630,42 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
629
630
|
hasMenu: h
|
|
630
631
|
}, t);
|
|
631
632
|
}
|
|
632
|
-
const z = y && R.length > 0 &&
|
|
633
|
-
|
|
634
|
-
},
|
|
633
|
+
const z = y && R.length > 0 && Gt([R[0]], [[0, w - 1]]);
|
|
634
|
+
ea(e, { x: 0, y: 0.5, width: S + 1.5, height: C, isChecked: z }, t), e.restore();
|
|
635
|
+
}, ta = (e, t) => {
|
|
635
636
|
const { coordInstance: n, theme: o, mouseState: i, scrollState: a, isColumnAppendEnable: s, drawIcon: r } = t;
|
|
636
637
|
if (!s) return;
|
|
637
638
|
const { totalWidth: l, totalHeight: c, rowInitSize: u } = n, { iconSizeSM: h, columnHeaderBg: m, cellLineColor: g, columnHeaderBgHovered: C } = o, S = l - a.scrollLeft;
|
|
638
|
-
D(e, { x: S + 1, y: 0.5, width:
|
|
639
|
+
D(e, { x: S + 1, y: 0.5, width: bn, height: c - a.scrollTop, fill: i.type === b.AppendColumn ? C : m }), Ke(e, { x: S + 0.5, y: u + 0.5, points: [0, 0, 0, c - a.scrollTop - u], stroke: g });
|
|
639
640
|
const p = h / 2;
|
|
640
|
-
r?.(e, { kind: "add", x: S +
|
|
641
|
-
},
|
|
641
|
+
r?.(e, { kind: "add", x: S + bn / 2 - p + 0.5, y: u / 2 - p + 0.5, size: h, theme: o });
|
|
642
|
+
}, na = (e, t) => {
|
|
642
643
|
const { theme: n, scrollState: o, coordInstance: i, isColumnResizable: a, columnResizeState: s, hoveredColumnResizeIndex: r } = t, l = s.columnIndex, c = !!a && r > -1, u = l > -1;
|
|
643
644
|
if (!c && !u) return;
|
|
644
645
|
const h = u ? l : r, m = i.getColumnRelativeOffset(h, o.scrollLeft) + i.getColumnWidth(h);
|
|
645
646
|
D(e, {
|
|
646
|
-
x: m -
|
|
647
|
-
y:
|
|
648
|
-
width:
|
|
649
|
-
height: i.rowInitSize -
|
|
647
|
+
x: m - xn / 2 + 0.5,
|
|
648
|
+
y: Rn + 0.5,
|
|
649
|
+
width: xn,
|
|
650
|
+
height: i.rowInitSize - Rn * 2,
|
|
650
651
|
fill: n.columnResizeHandlerBg,
|
|
651
652
|
radius: 3
|
|
652
653
|
});
|
|
653
|
-
},
|
|
654
|
+
}, oa = (e, t) => {
|
|
654
655
|
const { theme: n, mouseState: o, scrollState: i, dragState: a, coordInstance: s } = t, { type: r, isDragging: l, ranges: c, delta: u } = a;
|
|
655
656
|
if (!l || r !== O.Columns) return;
|
|
656
657
|
const h = c[0][0];
|
|
657
658
|
D(e, { x: o.x - u, y: 0.5, width: s.getColumnWidth(h), height: s.containerHeight, fill: n.columnDraggingPlaceholderBg });
|
|
658
|
-
const m =
|
|
659
|
+
const m = Ut(s, o, i, r), g = s.getColumnRelativeOffset(m, i.scrollLeft);
|
|
659
660
|
D(e, { x: g - 0.5, y: 0.5, width: 2, height: s.containerHeight, fill: n.interactionLineColorHighlight });
|
|
660
|
-
},
|
|
661
|
+
}, ia = (e, t) => {
|
|
661
662
|
const { theme: n, mouseState: o, scrollState: i, dragState: a, coordInstance: s } = t, { type: r, isDragging: l, ranges: c, delta: u } = a;
|
|
662
663
|
if (!l || r !== O.Rows) return;
|
|
663
664
|
const h = c[0][0];
|
|
664
665
|
D(e, { x: 0.5, y: o.y - u, width: s.containerWidth, height: s.getRowHeight(h), fill: n.columnDraggingPlaceholderBg });
|
|
665
|
-
const m =
|
|
666
|
+
const m = Ut(s, o, i, r), g = s.getRowOffset(m) - i.scrollTop;
|
|
666
667
|
D(e, { x: 0.5, y: g - 0.5, width: s.containerWidth, height: 2, fill: n.interactionLineColorHighlight });
|
|
667
|
-
},
|
|
668
|
+
}, aa = (e, t) => {
|
|
668
669
|
const { coordInstance: n, mouseState: o, scrollState: i, columnFreezeState: a, theme: s } = t, { isFreezing: r, targetIndex: l } = a;
|
|
669
670
|
if (o.type !== b.ColumnFreezeHandler && !r) return;
|
|
670
671
|
const { containerHeight: c, freezeRegionWidth: u } = n, h = s.interactionLineColorHighlight, m = r ? o.x : u;
|
|
@@ -672,33 +673,33 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
672
673
|
const g = n.getColumnRelativeOffset(l + 1, i.scrollLeft);
|
|
673
674
|
D(e, { x: g - 1, y: 0, width: 2, height: c, fill: h });
|
|
674
675
|
}
|
|
675
|
-
D(e, { x: m -
|
|
676
|
-
},
|
|
676
|
+
D(e, { x: m - kn / 2, y: o.y - In / 2, width: kn, height: In, fill: h, radius: 4 }), D(e, { x: m - 1, y: 0, width: 2, height: c, fill: h });
|
|
677
|
+
}, sa = (e, t) => {
|
|
677
678
|
const { theme: n, coordInstance: o, scrollState: i } = t, { freezeRegionWidth: a, containerHeight: s } = o, r = n.interactionLineColorCommon;
|
|
678
679
|
if (i.scrollLeft === 0) {
|
|
679
680
|
D(e, { x: a, y: 0.5, width: 1, height: s, fill: r });
|
|
680
681
|
return;
|
|
681
682
|
}
|
|
682
683
|
e.save(), e.beginPath(), e.shadowColor = r, e.shadowBlur = 5, e.shadowOffsetX = 3, e.strokeStyle = r, e.moveTo(a + 0.5, 0), e.lineTo(a + 0.5, s), e.stroke(), e.restore();
|
|
683
|
-
},
|
|
684
|
+
}, ra = (e, t) => t == null ? !0 : !(e.scrollState.scrollLeft === t.scrollState.scrollLeft && e.scrollState.scrollTop === t.scrollState.scrollTop && e.theme === t.theme && e.columns === t.columns && e.getLinearRow === t.getLinearRow && e.real2RowIndex === t.real2RowIndex && e.drawCell === t.drawCell && e.coordInstance === t.coordInstance && e.visibleRegion === t.visibleRegion && e.forceRenderFlag === t.forceRenderFlag), la = (e, t) => {
|
|
684
685
|
const { containerWidth: n, containerHeight: o, pixelRatio: i, shouldRerender: a, draw: s } = t, r = Math.ceil(n * i), l = Math.ceil(o * i);
|
|
685
686
|
(e.width !== r || e.height !== l) && (e.width = r, e.height = l);
|
|
686
687
|
const c = e.getContext("2d");
|
|
687
688
|
c != null && (a && (c.clearRect(0, 0, r, l), c.save(), i !== 1 && c.scale(i, i), c.beginPath(), c.rect(0, 0, n, o), c.clip()), s(c), a && c.restore());
|
|
688
|
-
},
|
|
689
|
-
const a =
|
|
690
|
-
if (
|
|
691
|
-
const
|
|
692
|
-
(e.width !==
|
|
689
|
+
}, Pt = /* @__PURE__ */ new WeakSet(), ca = (e, t) => e.scrollState.isScrolling || t != null && (e.scrollState.scrollLeft !== t.scrollState.scrollLeft || e.scrollState.scrollTop !== t.scrollState.scrollTop), ua = (e, t, n, o, i = Math.ceil(globalThis.devicePixelRatio ?? 1)) => {
|
|
690
|
+
const a = qi(n), { coordInstance: s, height: r } = a, { containerWidth: l } = s;
|
|
691
|
+
if (l === 0 || r === 0) return;
|
|
692
|
+
const c = Math.ceil(l * i), u = Math.ceil(r * i), h = ca(n, o), m = h || Pt.has(t) || ra(n, o);
|
|
693
|
+
(e.width !== c || e.height !== u) && (e.width = c, e.height = u, e.style.width = `${l}px`, e.style.height = `${r}px`);
|
|
693
694
|
const g = e.getContext("2d");
|
|
694
|
-
g != null && (g.clearRect(0, 0,
|
|
695
|
-
containerWidth:
|
|
696
|
-
containerHeight:
|
|
695
|
+
g != null && (g.clearRect(0, 0, c, u), g.save(), i !== 1 && g.scale(i, i), g.beginPath(), g.rect(0, 0, l, r), g.clip(), h ? (Mn(g, g, { ...a, shouldRerender: !0 }), Pt.add(t)) : (la(t, {
|
|
696
|
+
containerWidth: l,
|
|
697
|
+
containerHeight: r,
|
|
697
698
|
pixelRatio: i,
|
|
698
699
|
shouldRerender: m,
|
|
699
|
-
draw: (C) =>
|
|
700
|
-
}), g.save(), g.setTransform(1, 0, 0, 1, 0, 0), g.drawImage(t, 0, 0,
|
|
701
|
-
},
|
|
700
|
+
draw: (C) => Mn(g, C, { ...a, shouldRerender: m })
|
|
701
|
+
}), Pt.delete(t), g.save(), g.setTransform(1, 0, 0, 1, 0, 0), g.drawImage(t, 0, 0, c, u), g.restore()), s.rowInitSize > 0 && (An(g, a, "freeze"), An(g, a, "other"), ta(g, a)), sa(g, a), ji(g, a), Qi(g, a), Zi(g, a), na(g, a), ia(g, a), oa(g, a), aa(g, a), g.restore());
|
|
702
|
+
}, po = {
|
|
702
703
|
staticWhite: "#FFFFFF",
|
|
703
704
|
staticBlack: "#000000",
|
|
704
705
|
iconFgCommon: "#6b7280",
|
|
@@ -743,7 +744,7 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
743
744
|
interactionLineColorCommon: "#d4d4d8",
|
|
744
745
|
interactionLineColorHighlight: "#3b82f6",
|
|
745
746
|
themeKey: "light"
|
|
746
|
-
},
|
|
747
|
+
}, Co = {
|
|
747
748
|
staticWhite: "--ui-accent-contrast",
|
|
748
749
|
staticBlack: "--ui-text",
|
|
749
750
|
iconFgCommon: "--ui-icon-tertiary",
|
|
@@ -777,62 +778,62 @@ const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
777
778
|
scrollBarBg: "--ui-scrollbar-thumb-hover",
|
|
778
779
|
interactionLineColorCommon: "--ui-border-strong",
|
|
779
780
|
interactionLineColorHighlight: "--ui-accent-9"
|
|
780
|
-
},
|
|
781
|
+
}, En = {
|
|
781
782
|
fontFamily: "--ui-font-sans",
|
|
782
783
|
/** Cell text: the grid's own size (14px on a phone), else the body size. */
|
|
783
784
|
fontSizeSM: "--ui-grid-font-size",
|
|
784
785
|
fontSizeXS: "--ui-font-size-sm"
|
|
785
|
-
},
|
|
786
|
-
const n = { ...
|
|
787
|
-
for (const [i, a] of Object.entries(
|
|
786
|
+
}, da = { fontSizeSM: "--ui-font-size" }, ha = (e, t = {}) => {
|
|
787
|
+
const n = { ...po };
|
|
788
|
+
for (const [i, a] of Object.entries(Co)) {
|
|
788
789
|
const s = e(a)?.trim();
|
|
789
790
|
s && (n[i] = s);
|
|
790
791
|
}
|
|
791
|
-
const o = e(
|
|
792
|
+
const o = e(En.fontFamily)?.trim();
|
|
792
793
|
o && (n.fontFamily = o);
|
|
793
794
|
for (const i of ["fontSizeSM", "fontSizeXS"]) {
|
|
794
|
-
const a =
|
|
795
|
-
let s = Number.parseFloat(e(
|
|
795
|
+
const a = da[i];
|
|
796
|
+
let s = Number.parseFloat(e(En[i]) ?? "");
|
|
796
797
|
!(s > 0) && a && (s = Number.parseFloat(e(a) ?? "")), Number.isFinite(s) && s > 0 && (n[i] = s);
|
|
797
798
|
}
|
|
798
799
|
return { ...n, ...t };
|
|
799
|
-
},
|
|
800
|
+
}, ma = (e) => {
|
|
800
801
|
const t = getComputedStyle(e), n = e.ownerDocument.createElement("span");
|
|
801
802
|
n.setAttribute("aria-hidden", "true"), n.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none", e.appendChild(n);
|
|
802
|
-
const o = new Set(Object.values(
|
|
803
|
+
const o = new Set(Object.values(Co));
|
|
803
804
|
return Object.assign((a) => {
|
|
804
805
|
const s = t.getPropertyValue(a).trim();
|
|
805
806
|
return !s || !o.has(a) ? s : (n.style.color = "", n.style.color = `var(${a})`, getComputedStyle(n).color || s);
|
|
806
807
|
}, { dispose: () => n.remove() });
|
|
807
|
-
},
|
|
808
|
-
const n =
|
|
808
|
+
}, ga = (e, t = {}) => {
|
|
809
|
+
const n = ma(e);
|
|
809
810
|
try {
|
|
810
811
|
const o = e.closest('[data-ui-color-scheme="dark"]') != null;
|
|
811
|
-
return
|
|
812
|
+
return ha(n, { themeKey: o ? "dark" : "light", ...t });
|
|
812
813
|
} finally {
|
|
813
814
|
n.dispose();
|
|
814
815
|
}
|
|
815
|
-
},
|
|
816
|
-
function
|
|
817
|
-
return (e instanceof Element ? e : e?.parentElement)?.closest(
|
|
816
|
+
}, wo = '[role="dialog"],[role="alertdialog"],[aria-modal="true"]';
|
|
817
|
+
function fa(e) {
|
|
818
|
+
return (e instanceof Element ? e : e?.parentElement)?.closest(wo) ?? null;
|
|
818
819
|
}
|
|
819
|
-
function
|
|
820
|
-
const n =
|
|
820
|
+
function pa(e, t) {
|
|
821
|
+
const n = fa(e);
|
|
821
822
|
return !!n && !n.contains(t);
|
|
822
823
|
}
|
|
823
|
-
function
|
|
824
|
-
return e.some((n) => n instanceof Element && n.matches(
|
|
824
|
+
function Hn(e, t) {
|
|
825
|
+
return e.some((n) => n instanceof Element && n.matches(wo) && !t.some((o) => n.contains(o) || o.contains(n)));
|
|
825
826
|
}
|
|
826
|
-
function
|
|
827
|
+
function Ca(e, t = e ?? null) {
|
|
827
828
|
if (!e?.isConnected) return !1;
|
|
828
829
|
const n = e.ownerDocument, o = n.activeElement;
|
|
829
|
-
return o === e ? !0 : o && o !== n.body &&
|
|
830
|
+
return o === e ? !0 : o && o !== n.body && pa(o, t ?? e) ? !1 : (e.focus({ preventScroll: !0 }), n.activeElement === e);
|
|
830
831
|
}
|
|
831
|
-
const
|
|
832
|
-
function
|
|
832
|
+
const wa = /* @__PURE__ */ new Set(["Enter", "Escape", "Tab"]), va = 50;
|
|
833
|
+
function vo(e) {
|
|
833
834
|
return e.isComposing || e.keyCode === 229;
|
|
834
835
|
}
|
|
835
|
-
function
|
|
836
|
+
function Sa(e) {
|
|
836
837
|
const { keyCode: t, metaKey: n, ctrlKey: o } = e;
|
|
837
838
|
return n || o || t === 32 ? !1 : t >= 65 && t <= 90 || // A-Z
|
|
838
839
|
t >= 48 && t <= 57 || // 0-9 (ClosedParen..OpenParen)
|
|
@@ -842,7 +843,7 @@ function pa(e) {
|
|
|
842
843
|
t >= 106 && t <= 111 || // Multiply..Divide
|
|
843
844
|
t === 61 || t === 173 || (t === 229 || t === 0) && e.key !== "Shift";
|
|
844
845
|
}
|
|
845
|
-
function
|
|
846
|
+
function So(e, t = {}) {
|
|
846
847
|
let n = !1, o = -1 / 0, i = !1;
|
|
847
848
|
const a = /* @__PURE__ */ new WeakMap(), s = (l) => {
|
|
848
849
|
n = !0, t.onStart?.(l);
|
|
@@ -854,11 +855,11 @@ function po(e, t = {}) {
|
|
|
854
855
|
return n;
|
|
855
856
|
},
|
|
856
857
|
ownsKey(l) {
|
|
857
|
-
if (n ||
|
|
858
|
-
if (!
|
|
858
|
+
if (n || vo(l)) return !0;
|
|
859
|
+
if (!wa.has(l.key)) return !1;
|
|
859
860
|
const c = a.get(l);
|
|
860
861
|
if (c !== void 0) return c;
|
|
861
|
-
const u = l.timeStamp - o <=
|
|
862
|
+
const u = l.timeStamp - o <= va;
|
|
862
863
|
return o = -1 / 0, a.set(l, u), u;
|
|
863
864
|
},
|
|
864
865
|
dispose() {
|
|
@@ -866,12 +867,12 @@ function po(e, t = {}) {
|
|
|
866
867
|
}
|
|
867
868
|
};
|
|
868
869
|
}
|
|
869
|
-
const
|
|
870
|
+
const ya = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
870
871
|
if (!e || t == null || t === n || !(t instanceof HTMLElement)) return !0;
|
|
871
872
|
const o = t.isContentEditable || t.contentEditable === "true";
|
|
872
873
|
return t.tagName !== "INPUT" && t.tagName !== "TEXTAREA" && !o;
|
|
873
|
-
},
|
|
874
|
-
`),
|
|
874
|
+
}, ba = /[\t\n\r"]/, xa = (e) => ba.test(e) ? `"${e.replace(/"/g, '""')}"` : e, Ra = (e) => e.map((t) => t.map(xa).join(" ")).join(`\r
|
|
875
|
+
`), ka = (e) => {
|
|
875
876
|
if (!e) return [];
|
|
876
877
|
const t = [];
|
|
877
878
|
let n = [], o = "", i = 0, a = !0;
|
|
@@ -883,7 +884,7 @@ const Ca = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
883
884
|
for (; i < s; ) {
|
|
884
885
|
const c = e[i];
|
|
885
886
|
if (a && c === '"') {
|
|
886
|
-
const u =
|
|
887
|
+
const u = Ia(e, i + 1);
|
|
887
888
|
if (u === -1) {
|
|
888
889
|
o += c, a = !1, i++;
|
|
889
890
|
continue;
|
|
@@ -896,12 +897,12 @@ const Ca = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
896
897
|
else if (c === "\r" || c === `
|
|
897
898
|
`) {
|
|
898
899
|
if (l(), i += c === "\r" && e[i + 1] === `
|
|
899
|
-
` ? 2 : 1, i >= s) return
|
|
900
|
+
` ? 2 : 1, i >= s) return Tn(t);
|
|
900
901
|
} else
|
|
901
902
|
o += c, i++;
|
|
902
903
|
}
|
|
903
|
-
return l(),
|
|
904
|
-
},
|
|
904
|
+
return l(), Tn(t);
|
|
905
|
+
}, Ia = (e, t) => {
|
|
905
906
|
let n = t;
|
|
906
907
|
for (; n < e.length; ) {
|
|
907
908
|
const o = e.indexOf('"', n);
|
|
@@ -915,11 +916,11 @@ const Ca = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
915
916
|
` || i === "\r" ? o : -1;
|
|
916
917
|
}
|
|
917
918
|
return -1;
|
|
918
|
-
},
|
|
919
|
+
}, Tn = (e) => {
|
|
919
920
|
const t = Math.max(0, ...e.map((n) => n.length));
|
|
920
921
|
for (const n of e) for (; n.length < t; ) n.push("");
|
|
921
922
|
return e;
|
|
922
|
-
},
|
|
923
|
+
}, Pa = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), za = (e) => e.length === 0 || e.length === 1 && e[0].length <= 1 ? void 0 : `<table><tbody>${e.map((n) => `<tr>${n.map((o) => `<td>${Pa(o).replace(/\r?\n/g, "<br>")}</td>`).join("")}</tr>`).join("")}</tbody></table>`, Ma = (e, t) => {
|
|
923
924
|
const n = e.clipboardData;
|
|
924
925
|
if (!n) return !1;
|
|
925
926
|
try {
|
|
@@ -928,18 +929,18 @@ const Ca = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
928
929
|
return !1;
|
|
929
930
|
}
|
|
930
931
|
return e.preventDefault(), !0;
|
|
931
|
-
},
|
|
932
|
+
}, Aa = () => ({
|
|
932
933
|
clipboard: typeof navigator < "u" ? navigator.clipboard : void 0,
|
|
933
934
|
ClipboardItem: typeof ClipboardItem < "u" ? ClipboardItem : void 0,
|
|
934
935
|
hasFocus: () => typeof document < "u" ? document.hasFocus() : !0,
|
|
935
936
|
onFocus: (e) => window.addEventListener("focus", e, { once: !0 })
|
|
936
|
-
}),
|
|
937
|
+
}), Ea = (e, t = Aa()) => {
|
|
937
938
|
const { clipboard: n, ClipboardItem: o } = t, i = () => {
|
|
938
939
|
if (o && n?.write) {
|
|
939
940
|
const a = new o({
|
|
940
941
|
"text/plain": e.then(({ text: s }) => new Blob([s], { type: "text/plain" })),
|
|
941
942
|
// Null means no HTML; an empty table keeps the blob type valid in every browser.
|
|
942
|
-
"text/html": e.then(({ text: s, html: r }) => new Blob([r ??
|
|
943
|
+
"text/html": e.then(({ text: s, html: r }) => new Blob([r ?? Ha(s)], { type: "text/html" }))
|
|
943
944
|
});
|
|
944
945
|
return n.write([a]);
|
|
945
946
|
}
|
|
@@ -956,7 +957,7 @@ const Ca = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
956
957
|
}
|
|
957
958
|
})) : Promise.reject(a);
|
|
958
959
|
}
|
|
959
|
-
},
|
|
960
|
+
}, Ha = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), st = (e, t, n) => Math.min(n, Math.max(t, e)), qe = (e, t) => {
|
|
960
961
|
if (e.kind !== "cells" || e.ranges.length < 2 || t.rowCount <= 0 || t.columnCount <= 0) return null;
|
|
961
962
|
const [n, o] = e.ranges, i = t.columnCount - 1, a = t.rowCount - 1;
|
|
962
963
|
return {
|
|
@@ -969,12 +970,12 @@ const Ca = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
969
970
|
const n = [];
|
|
970
971
|
for (let o = e; o <= t; o++) n.push(o);
|
|
971
972
|
return n;
|
|
972
|
-
},
|
|
973
|
+
}, Nn = (e, t) => {
|
|
973
974
|
const n = /* @__PURE__ */ new Set(), o = [...e].map(([i, a]) => [Math.min(i, a), Math.max(i, a)]).sort((i, a) => i[0] - a[0]);
|
|
974
975
|
for (const [i, a] of o)
|
|
975
976
|
for (let s = Math.max(0, i); s <= Math.min(t - 1, a); s++) n.add(s);
|
|
976
977
|
return [...n].sort((i, a) => i - a);
|
|
977
|
-
},
|
|
978
|
+
}, yo = (e, t) => {
|
|
978
979
|
const { rowCount: n, columnCount: o } = t;
|
|
979
980
|
if (n <= 0 || o <= 0) return null;
|
|
980
981
|
switch (e.kind) {
|
|
@@ -983,27 +984,27 @@ const Ca = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
983
984
|
return i ? { rows: rt(i.startRow, i.endRow), columns: rt(i.startColumn, i.endColumn) } : null;
|
|
984
985
|
}
|
|
985
986
|
case "rows": {
|
|
986
|
-
const i =
|
|
987
|
+
const i = Nn(e.ranges, n);
|
|
987
988
|
return i.length ? { rows: i, columns: rt(0, o - 1) } : null;
|
|
988
989
|
}
|
|
989
990
|
case "columns": {
|
|
990
|
-
const i =
|
|
991
|
+
const i = Nn(e.ranges, o);
|
|
991
992
|
return i.length ? { rows: rt(0, n - 1), columns: i } : null;
|
|
992
993
|
}
|
|
993
994
|
default:
|
|
994
995
|
return null;
|
|
995
996
|
}
|
|
996
|
-
},
|
|
997
|
+
}, Ta = (e, t) => {
|
|
997
998
|
if (e.kind === "cells") {
|
|
998
999
|
const o = qe(e, t);
|
|
999
1000
|
return o ? [o.startColumn, o.startRow] : null;
|
|
1000
1001
|
}
|
|
1001
|
-
const n =
|
|
1002
|
+
const n = yo(e, t);
|
|
1002
1003
|
return n ? [n.columns[0], n.rows[0]] : null;
|
|
1003
|
-
},
|
|
1004
|
-
const o =
|
|
1004
|
+
}, Na = (e) => e.rows.length * e.columns.length, Fa = (e, t, n) => {
|
|
1005
|
+
const o = ka(e);
|
|
1005
1006
|
if (o.length === 0) return null;
|
|
1006
|
-
const i =
|
|
1007
|
+
const i = Ta(t, n);
|
|
1007
1008
|
if (!i) return null;
|
|
1008
1009
|
const { rowCount: a, columnCount: s } = n;
|
|
1009
1010
|
let r = o, l = !1;
|
|
@@ -1027,8 +1028,8 @@ const Ca = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
1027
1028
|
readonlyColumns: p,
|
|
1028
1029
|
repeated: l
|
|
1029
1030
|
};
|
|
1030
|
-
},
|
|
1031
|
-
function
|
|
1031
|
+
}, Fn = (e, t) => e.rows.map((n) => e.columns.map((o) => t([o, n]))), zt = (e) => ({ text: Ra(e), html: za(e) }), La = (e, t) => !t || e.rows.every((n) => t(n));
|
|
1032
|
+
function Da(e) {
|
|
1032
1033
|
const t = e.equals ?? Object.is;
|
|
1033
1034
|
let n = !1, o = null, i, a, s = !1, r = null, l = 0, c = !1;
|
|
1034
1035
|
const u = {
|
|
@@ -1091,20 +1092,20 @@ function Ta(e) {
|
|
|
1091
1092
|
};
|
|
1092
1093
|
return g;
|
|
1093
1094
|
}
|
|
1094
|
-
const
|
|
1095
|
-
function
|
|
1095
|
+
const bo = "data-ui-ignore-outside", Mt = /* @__PURE__ */ new WeakMap(), Ln = /* @__PURE__ */ new WeakSet();
|
|
1096
|
+
function Dn(e) {
|
|
1096
1097
|
return [...e.options.elements()].filter((t) => !!t);
|
|
1097
1098
|
}
|
|
1098
|
-
function
|
|
1099
|
+
function Wn(e, t) {
|
|
1099
1100
|
return e.some((n) => n instanceof Node && t.some((o) => o === n || o.contains(n)));
|
|
1100
1101
|
}
|
|
1101
|
-
function
|
|
1102
|
-
return e.some((t) => t instanceof Element && t.hasAttribute(
|
|
1102
|
+
function Wa(e) {
|
|
1103
|
+
return e.some((t) => t instanceof Element && t.hasAttribute(bo));
|
|
1103
1104
|
}
|
|
1104
|
-
function
|
|
1105
|
+
function Ba(e, t) {
|
|
1105
1106
|
return e.length > 0 && !e.includes(t);
|
|
1106
1107
|
}
|
|
1107
|
-
function
|
|
1108
|
+
function Oa(e, t = 400) {
|
|
1108
1109
|
let n = 0;
|
|
1109
1110
|
const o = () => {
|
|
1110
1111
|
e.clearTimeout(n), e.removeEventListener("click", i, !0), e.removeEventListener("pointerdown", o, !0), e.removeEventListener("keydown", o, !0);
|
|
@@ -1113,19 +1114,19 @@ function Fa(e, t = 400) {
|
|
|
1113
1114
|
};
|
|
1114
1115
|
return e.addEventListener("click", i, !0), e.addEventListener("pointerdown", o, !0), e.addEventListener("keydown", o, !0), n = e.setTimeout(o, t), o;
|
|
1115
1116
|
}
|
|
1116
|
-
function
|
|
1117
|
-
const t = e.document, n = { layers: [], guard:
|
|
1117
|
+
function Va(e) {
|
|
1118
|
+
const t = e.document, n = { layers: [], guard: So(e), teardown: () => {
|
|
1118
1119
|
} }, o = (a) => {
|
|
1119
|
-
if (
|
|
1120
|
-
|
|
1120
|
+
if (Ln.has(a)) return;
|
|
1121
|
+
Ln.add(a);
|
|
1121
1122
|
const s = a.composedPath();
|
|
1122
|
-
if (!(
|
|
1123
|
+
if (!(Wa(s) || Ba(s, t)))
|
|
1123
1124
|
for (const r of [...n.layers].reverse()) {
|
|
1124
1125
|
if (r.disposed) continue;
|
|
1125
|
-
const l =
|
|
1126
|
-
if (
|
|
1126
|
+
const l = Dn(r);
|
|
1127
|
+
if (Wn(s, l) || Hn(s, l)) return;
|
|
1127
1128
|
if (r.options.onOutside?.(a) === "veto") {
|
|
1128
|
-
a.preventDefault(), a.stopImmediatePropagation(),
|
|
1129
|
+
a.preventDefault(), a.stopImmediatePropagation(), Oa(e);
|
|
1129
1130
|
return;
|
|
1130
1131
|
}
|
|
1131
1132
|
}
|
|
@@ -1133,46 +1134,46 @@ function Da(e) {
|
|
|
1133
1134
|
if (a.key !== "Escape" || a.defaultPrevented || n.guard.ownsKey(a)) return;
|
|
1134
1135
|
const s = n.layers.at(-1);
|
|
1135
1136
|
if (!s?.options.onEscape) return;
|
|
1136
|
-
const r = a.composedPath(), l =
|
|
1137
|
-
if (
|
|
1138
|
-
const c = r.find((u) => u instanceof Element && u.hasAttribute(
|
|
1139
|
-
c && !
|
|
1137
|
+
const r = a.composedPath(), l = Dn(s);
|
|
1138
|
+
if (Hn(r, l)) return;
|
|
1139
|
+
const c = r.find((u) => u instanceof Element && u.hasAttribute(bo));
|
|
1140
|
+
c && !Wn([c], l) || s.options.onEscape(a) && (a.preventDefault(), a.stopPropagation());
|
|
1140
1141
|
};
|
|
1141
1142
|
return e.addEventListener("pointerdown", o, !0), e.addEventListener("keydown", i, !0), n.teardown = () => {
|
|
1142
1143
|
e.removeEventListener("pointerdown", o, !0), e.removeEventListener("keydown", i, !0), n.guard.dispose();
|
|
1143
1144
|
}, n;
|
|
1144
1145
|
}
|
|
1145
|
-
function
|
|
1146
|
-
const n =
|
|
1147
|
-
|
|
1146
|
+
function Ga(e, t) {
|
|
1147
|
+
const n = Mt.get(e) ?? Va(e);
|
|
1148
|
+
Mt.set(e, n);
|
|
1148
1149
|
const o = { options: t, disposed: !1 };
|
|
1149
1150
|
return n.layers.push(o), {
|
|
1150
1151
|
get disposed() {
|
|
1151
1152
|
return o.disposed;
|
|
1152
1153
|
},
|
|
1153
1154
|
dispose() {
|
|
1154
|
-
o.disposed || (o.disposed = !0, n.layers = n.layers.filter((i) => i !== o), !n.layers.length && (n.teardown(),
|
|
1155
|
+
o.disposed || (o.disposed = !0, n.layers = n.layers.filter((i) => i !== o), !n.layers.length && (n.teardown(), Mt.delete(e)));
|
|
1155
1156
|
}
|
|
1156
1157
|
};
|
|
1157
1158
|
}
|
|
1158
|
-
function
|
|
1159
|
-
const t =
|
|
1159
|
+
function Bn(e) {
|
|
1160
|
+
const t = so(e);
|
|
1160
1161
|
return Array.isArray(t) ? [...t] : [t];
|
|
1161
1162
|
}
|
|
1162
|
-
function
|
|
1163
|
-
const o = de(() =>
|
|
1163
|
+
function Ua(e, t, n) {
|
|
1164
|
+
const o = de(() => so(t), (i, a, s) => {
|
|
1164
1165
|
if (!i || typeof window > "u") return;
|
|
1165
|
-
const r =
|
|
1166
|
-
elements: () =>
|
|
1166
|
+
const r = Bn(e).find(Boolean)?.ownerDocument?.defaultView ?? window, l = Ga(r, {
|
|
1167
|
+
elements: () => Bn(e),
|
|
1167
1168
|
onOutside: (c) => n.onOutside?.(c),
|
|
1168
1169
|
onEscape: (c) => n.onEscape?.(c)
|
|
1169
1170
|
});
|
|
1170
1171
|
s(() => l.dispose());
|
|
1171
1172
|
}, { immediate: !0, flush: "sync" });
|
|
1172
|
-
return
|
|
1173
|
+
return Jo() && ro(o), o;
|
|
1173
1174
|
}
|
|
1174
|
-
const
|
|
1175
|
-
function
|
|
1175
|
+
const xo = 2, Ka = 4, At = 20, _a = 2, $a = 5, ut = 16;
|
|
1176
|
+
function qa(e, t, n) {
|
|
1176
1177
|
const o = e.createElement("canvas").getContext("2d");
|
|
1177
1178
|
if (!o) return null;
|
|
1178
1179
|
o.font = `${t}px ${n}`, o.textBaseline = "alphabetic";
|
|
@@ -1181,27 +1182,27 @@ function Ua(e, t, n) {
|
|
|
1181
1182
|
const { alphabeticBaseline: s } = o.measureText("Hg"), r = { ascent: i, descent: a, drop: -s };
|
|
1182
1183
|
return Object.values(r).every((l) => Number.isFinite(l) && Math.abs(l) < t * 2) ? r : null;
|
|
1183
1184
|
}
|
|
1184
|
-
const
|
|
1185
|
+
const _t = (e) => e.view || e.kind === "long-text";
|
|
1185
1186
|
function ht(e) {
|
|
1186
1187
|
const t = e.textBox, n = e.rowHeight;
|
|
1187
|
-
if (!
|
|
1188
|
+
if (!_t(e)) {
|
|
1188
1189
|
if (!t) return { top: 0, bottom: 0, lineHeight: n };
|
|
1189
1190
|
const a = Math.ceil(t.ascent + t.descent), s = Math.round(n / 2 + t.drop - t.ascent);
|
|
1190
1191
|
return { top: Math.max(0, Math.min(n - a, s)), bottom: 0, lineHeight: a };
|
|
1191
1192
|
}
|
|
1192
|
-
const o = Math.max(0, (n -
|
|
1193
|
-
return { top: Math.max(0, i), bottom: e.hint ? ut : o, lineHeight:
|
|
1193
|
+
const o = Math.max(0, (n - At) / 2), i = t ? Math.round(n / 2 + t.drop - t.ascent) - Math.floor((At - Math.ceil(t.ascent + t.descent)) / 2) : o;
|
|
1194
|
+
return { top: Math.max(0, i), bottom: e.hint ? ut : o, lineHeight: At };
|
|
1194
1195
|
}
|
|
1195
|
-
function
|
|
1196
|
-
if (!
|
|
1197
|
-
const { top: t, bottom: n, lineHeight: o } = ht(e), i = e.view ? 1 :
|
|
1196
|
+
function Ro(e) {
|
|
1197
|
+
if (!_t(e)) return e.rowHeight;
|
|
1198
|
+
const { top: t, bottom: n, lineHeight: o } = ht(e), i = e.view ? 1 : _a, a = Math.min($a, Math.max(i, Math.ceil(e.lines)));
|
|
1198
1199
|
return Math.max(e.rowHeight, t + n + a * o);
|
|
1199
1200
|
}
|
|
1200
|
-
function
|
|
1201
|
+
function Xa(e, t) {
|
|
1201
1202
|
const { top: n, bottom: o, lineHeight: i } = ht(t);
|
|
1202
1203
|
return Math.max(1, Math.round((e - n - o) / i));
|
|
1203
1204
|
}
|
|
1204
|
-
const
|
|
1205
|
+
const Ya = {
|
|
1205
1206
|
display: "block",
|
|
1206
1207
|
width: "100%",
|
|
1207
1208
|
height: "100%",
|
|
@@ -1217,14 +1218,14 @@ const _a = {
|
|
|
1217
1218
|
color: "transparent",
|
|
1218
1219
|
font: "inherit"
|
|
1219
1220
|
};
|
|
1220
|
-
function
|
|
1221
|
-
if (!e.open) return
|
|
1222
|
-
const { top: t, bottom: n, lineHeight: o } = ht(e), i = B.cellHorizontalPadding, a =
|
|
1221
|
+
function ja(e) {
|
|
1222
|
+
if (!e.open) return Ya;
|
|
1223
|
+
const { top: t, bottom: n, lineHeight: o } = ht(e), i = B.cellHorizontalPadding, a = _t(e), s = e.invalid ? e.dangerColor : e.theme.cellLineColorActived;
|
|
1223
1224
|
return {
|
|
1224
1225
|
display: "block",
|
|
1225
1226
|
"box-sizing": "border-box",
|
|
1226
1227
|
width: "100%",
|
|
1227
|
-
height: `${
|
|
1228
|
+
height: `${Ro(e)}px`,
|
|
1228
1229
|
margin: "0",
|
|
1229
1230
|
padding: `${t}px ${i}px ${n}px`,
|
|
1230
1231
|
border: "0",
|
|
@@ -1240,12 +1241,12 @@ function $a(e) {
|
|
|
1240
1241
|
"caret-color": e.theme.cellTextColor,
|
|
1241
1242
|
font: `${e.theme.fontSizeSM}px/${o}px ${e.theme.fontFamily}`,
|
|
1242
1243
|
"text-align": e.kind === "number" && !e.view ? "right" : "left",
|
|
1243
|
-
"border-radius": `${
|
|
1244
|
-
"box-shadow": `0 0 0 ${
|
|
1244
|
+
"border-radius": `${Ka}px`,
|
|
1245
|
+
"box-shadow": `0 0 0 ${xo}px ${s}`,
|
|
1245
1246
|
transition: "none"
|
|
1246
1247
|
};
|
|
1247
1248
|
}
|
|
1248
|
-
function
|
|
1249
|
+
function Qa(e) {
|
|
1249
1250
|
return {
|
|
1250
1251
|
position: "absolute",
|
|
1251
1252
|
left: `${B.cellHorizontalPadding}px`,
|
|
@@ -1262,10 +1263,10 @@ function qa(e) {
|
|
|
1262
1263
|
"pointer-events": "none"
|
|
1263
1264
|
};
|
|
1264
1265
|
}
|
|
1265
|
-
function
|
|
1266
|
+
function Za(e) {
|
|
1266
1267
|
return {
|
|
1267
1268
|
position: "absolute",
|
|
1268
|
-
left: `-${
|
|
1269
|
+
left: `-${xo}px`,
|
|
1269
1270
|
"max-width": "320px",
|
|
1270
1271
|
"min-width": "120px",
|
|
1271
1272
|
"box-sizing": "border-box",
|
|
@@ -1281,8 +1282,8 @@ function Xa(e) {
|
|
|
1281
1282
|
"pointer-events": "none"
|
|
1282
1283
|
};
|
|
1283
1284
|
}
|
|
1284
|
-
const
|
|
1285
|
-
class
|
|
1285
|
+
const Ja = (e, t) => !!e && !!t && e[0] === t[0] && e[1] === t[1];
|
|
1286
|
+
class es {
|
|
1286
1287
|
session;
|
|
1287
1288
|
options;
|
|
1288
1289
|
mode = "edit";
|
|
@@ -1322,7 +1323,7 @@ class ja {
|
|
|
1322
1323
|
get version() {
|
|
1323
1324
|
return n().version;
|
|
1324
1325
|
}
|
|
1325
|
-
}, this.session =
|
|
1326
|
+
}, this.session = Da({
|
|
1326
1327
|
validate: (i, a) => this.mode === "edit" ? this.options.validate?.(a, i ?? "") : null,
|
|
1327
1328
|
onCommit: (i, a, s) => {
|
|
1328
1329
|
const { move: r, reason: l } = this.pending;
|
|
@@ -1337,7 +1338,7 @@ class ja {
|
|
|
1337
1338
|
* edited (the IME keydown, then its `compositionstart`) changes nothing.
|
|
1338
1339
|
*/
|
|
1339
1340
|
begin(t) {
|
|
1340
|
-
if (this.state.active &&
|
|
1341
|
+
if (this.state.active && Ja(this.state.cell, t.cell)) return null;
|
|
1341
1342
|
this.state.active && this.commit("selection", "none");
|
|
1342
1343
|
const n = t.mode === "edit" && (t.trigger === "key" || t.trigger === "composition");
|
|
1343
1344
|
this.mode = t.mode, this.kind = t.kind, this.pending = { move: "none", reason: "blur" };
|
|
@@ -1403,10 +1404,10 @@ class ja {
|
|
|
1403
1404
|
return this.pending.reason;
|
|
1404
1405
|
}
|
|
1405
1406
|
}
|
|
1406
|
-
function
|
|
1407
|
+
function ts(e) {
|
|
1407
1408
|
const t = ue(1);
|
|
1408
1409
|
let n = null;
|
|
1409
|
-
const o = new
|
|
1410
|
+
const o = new es({
|
|
1410
1411
|
validate: (u, h) => {
|
|
1411
1412
|
const m = e.columnAt(u[0]);
|
|
1412
1413
|
return m && e.validate ? e.validate(u, m, h) : null;
|
|
@@ -1442,8 +1443,8 @@ function Qa(e) {
|
|
|
1442
1443
|
const u = e.owner(), { kind: h, mode: m, active: g } = o.state;
|
|
1443
1444
|
if (!u || !g || h !== "long-text" && m !== "view") return;
|
|
1444
1445
|
const C = { kind: h, view: m === "view", hint: h === "long-text" && m === "edit" && e.hasHint(), rowHeight: e.rowHeight(), textBox: e.textBox() }, { top: S, bottom: p } = ht(C), { height: w, padding: v, whiteSpace: y } = u.style;
|
|
1445
|
-
u.style.height = "0px", u.style.padding = `${S}px
|
|
1446
|
-
const R =
|
|
1446
|
+
u.style.height = "0px", u.style.padding = `${S}px ${B.cellHorizontalPadding}px ${p}px`, u.style.whiteSpace = "pre-wrap";
|
|
1447
|
+
const R = Xa(u.scrollHeight, C);
|
|
1447
1448
|
u.style.height = w, u.style.padding = v, u.style.whiteSpace = y, R !== t.value && (t.value = R);
|
|
1448
1449
|
}, c = {
|
|
1449
1450
|
state: a,
|
|
@@ -1494,10 +1495,10 @@ function Qa(e) {
|
|
|
1494
1495
|
}
|
|
1495
1496
|
};
|
|
1496
1497
|
return de(e.owner, (u, h, m) => {
|
|
1497
|
-
u && (n =
|
|
1498
|
+
u && (n = So(u), m(() => {
|
|
1498
1499
|
n?.dispose(), n = null;
|
|
1499
1500
|
}));
|
|
1500
|
-
}, { immediate: !0, flush: "sync" }),
|
|
1501
|
+
}, { immediate: !0, flush: "sync" }), Ua(
|
|
1501
1502
|
() => e.root() ?? null,
|
|
1502
1503
|
() => a.value.active || e.hasSelection(),
|
|
1503
1504
|
{
|
|
@@ -1509,9 +1510,9 @@ function Qa(e) {
|
|
|
1509
1510
|
if (o.commit("outside", "none") === "invalid") return "veto";
|
|
1510
1511
|
}
|
|
1511
1512
|
}
|
|
1512
|
-
),
|
|
1513
|
+
), ro(() => o.cancel()), c;
|
|
1513
1514
|
}
|
|
1514
|
-
const
|
|
1515
|
+
const ns = {
|
|
1515
1516
|
text: "--ui-text",
|
|
1516
1517
|
textMuted: "--ui-text-secondary",
|
|
1517
1518
|
link: "--ui-accent-11",
|
|
@@ -1532,7 +1533,7 @@ const Za = {
|
|
|
1532
1533
|
avatarText: "--ui-text",
|
|
1533
1534
|
badgeFill: "--ui-neutral-soft",
|
|
1534
1535
|
badgeText: "--ui-neutral-text"
|
|
1535
|
-
},
|
|
1536
|
+
}, os = {
|
|
1536
1537
|
neutral: { fill: "--ui-neutral-soft", color: "--ui-neutral-text" },
|
|
1537
1538
|
info: { fill: "--ui-info-soft", color: "--ui-info-text" },
|
|
1538
1539
|
success: { fill: "--ui-success-soft", color: "--ui-success-text" },
|
|
@@ -1577,15 +1578,15 @@ const Za = {
|
|
|
1577
1578
|
gray: { fill: "rgba(198, 212, 224, 0.4)", color: "#636b74" }
|
|
1578
1579
|
},
|
|
1579
1580
|
themeKey: "light"
|
|
1580
|
-
},
|
|
1581
|
+
}, is = (e, t = {}) => {
|
|
1581
1582
|
const n = (i, a) => e(i)?.trim() || a, o = { ...Ue, chips: { ...Ue.chips } };
|
|
1582
|
-
for (const [i, a] of Object.entries(
|
|
1583
|
-
for (const [i, a] of Object.entries(
|
|
1583
|
+
for (const [i, a] of Object.entries(ns)) o[i] = n(a, o[i]);
|
|
1584
|
+
for (const [i, a] of Object.entries(os)) {
|
|
1584
1585
|
const s = Ue.chips[i];
|
|
1585
1586
|
o.chips[i] = { fill: n(a.fill, s.fill), color: n(a.color, s.color) };
|
|
1586
1587
|
}
|
|
1587
1588
|
return { ...o, ...t };
|
|
1588
|
-
},
|
|
1589
|
+
}, ko = (e, t = {}) => {
|
|
1589
1590
|
const n = getComputedStyle(e), o = e.ownerDocument.createElement("span");
|
|
1590
1591
|
o.setAttribute("aria-hidden", "true"), o.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none", e.appendChild(o);
|
|
1591
1592
|
try {
|
|
@@ -1593,18 +1594,18 @@ const Za = {
|
|
|
1593
1594
|
if (n.getPropertyValue(s).trim())
|
|
1594
1595
|
return o.style.color = "", o.style.color = `var(${s})`, getComputedStyle(o).color || void 0;
|
|
1595
1596
|
}, a = e.closest('[data-ui-color-scheme="dark"]') != null;
|
|
1596
|
-
return
|
|
1597
|
+
return is(i, { themeKey: a ? "dark" : "light", ...t });
|
|
1597
1598
|
} finally {
|
|
1598
1599
|
o.remove();
|
|
1599
1600
|
}
|
|
1600
|
-
},
|
|
1601
|
+
}, On = (e, t = 13, n = 12) => ({
|
|
1601
1602
|
rowHeight: e,
|
|
1602
|
-
padding:
|
|
1603
|
+
padding: B.cellHorizontalPadding,
|
|
1603
1604
|
chip: Math.max(14, Math.min(20, e - 8)),
|
|
1604
1605
|
icon: Math.max(12, Math.min(16, e - 8)),
|
|
1605
1606
|
fontSize: t,
|
|
1606
1607
|
chipFontSize: Math.min(n, Math.max(10, e - 12))
|
|
1607
|
-
}),
|
|
1608
|
+
}), as = 30, ss = 2, rs = 1200, ls = (e, t, n, o = as) => {
|
|
1608
1609
|
const { x: i, y: a } = e, { containerWidth: s, containerHeight: r, freezeRegionWidth: l, columnInitSize: c, rowInitSize: u } = t;
|
|
1609
1610
|
let h = 0, m = 0;
|
|
1610
1611
|
if (!n || n === O.None || n === O.Columns) {
|
|
@@ -1612,11 +1613,11 @@ const Za = {
|
|
|
1612
1613
|
s - i < o ? h = 1 : i < l + o && !g && (h = -1);
|
|
1613
1614
|
}
|
|
1614
1615
|
return (!n || n === O.None || n === O.Rows) && (r - a < o ? m = 1 : a < u + o && (m = -1)), [h, m];
|
|
1615
|
-
},
|
|
1616
|
-
const o = Math.min(1, e + t /
|
|
1616
|
+
}, cs = (e, t, n) => {
|
|
1617
|
+
const o = Math.min(1, e + t / rs), i = o * t * ss + (n ?? 0), a = Math.floor(i);
|
|
1617
1618
|
return { speed: o, motion: a, carry: n == null ? 0 : i - a };
|
|
1618
1619
|
};
|
|
1619
|
-
class
|
|
1620
|
+
class us {
|
|
1620
1621
|
direction = [0, 0];
|
|
1621
1622
|
speed = 0;
|
|
1622
1623
|
carry = 0;
|
|
@@ -1630,7 +1631,7 @@ class ss {
|
|
|
1630
1631
|
return this.frameId != null;
|
|
1631
1632
|
}
|
|
1632
1633
|
update(t, n) {
|
|
1633
|
-
const [o, i] =
|
|
1634
|
+
const [o, i] = ls(t, this.options.getBounds(), n);
|
|
1634
1635
|
if (!(o === this.direction[0] && i === this.direction[1])) {
|
|
1635
1636
|
if (this.direction = [o, i], this.cancel(), o === 0 && i === 0) {
|
|
1636
1637
|
this.speed = 0, this.carry = 0;
|
|
@@ -1644,7 +1645,7 @@ class ss {
|
|
|
1644
1645
|
}
|
|
1645
1646
|
processFrame = (t) => {
|
|
1646
1647
|
if (this.lastTime !== 0) {
|
|
1647
|
-
const n =
|
|
1648
|
+
const n = cs(this.speed, t - this.lastTime, this.options.carryFraction === !1 ? void 0 : this.carry);
|
|
1648
1649
|
this.speed = n.speed, this.carry = n.carry;
|
|
1649
1650
|
const [o, i] = this.direction, a = o * n.motion, s = i * n.motion;
|
|
1650
1651
|
(a !== 0 || s !== 0) && this.options.scrollBy(a, s), this.options.onTick?.(a, s);
|
|
@@ -1658,11 +1659,11 @@ class ss {
|
|
|
1658
1659
|
this.frameId != null && ((this.options.cancelFrame ?? cancelAnimationFrame)(this.frameId), this.frameId = null);
|
|
1659
1660
|
}
|
|
1660
1661
|
}
|
|
1661
|
-
const
|
|
1662
|
+
const Vn = (e, t, n, o) => {
|
|
1662
1663
|
const i = e.getColumnRelativeOffset(o, t);
|
|
1663
1664
|
return V(n, i, i + B.columnResizeHandlerWidth / 2) ? o - 1 : o;
|
|
1664
1665
|
};
|
|
1665
|
-
class
|
|
1666
|
+
class ds {
|
|
1666
1667
|
state = kt;
|
|
1667
1668
|
hoveredIndex = -1;
|
|
1668
1669
|
pressed = null;
|
|
@@ -1684,7 +1685,7 @@ class rs {
|
|
|
1684
1685
|
start(t) {
|
|
1685
1686
|
const { type: n, columnIndex: o, x: i } = t;
|
|
1686
1687
|
if (n !== b.ColumnResizeHandler) return !1;
|
|
1687
|
-
const a = this.options.coordInstance(), s =
|
|
1688
|
+
const a = this.options.coordInstance(), s = Vn(a, this.options.scrollState().scrollLeft, i, o);
|
|
1688
1689
|
if (s < 0) return !1;
|
|
1689
1690
|
const r = a.getColumnWidth(s);
|
|
1690
1691
|
return this.pressed = { x: i, width: r }, this.state = { x: i, columnIndex: s, width: r }, this.emit(), !0;
|
|
@@ -1698,7 +1699,7 @@ class rs {
|
|
|
1698
1699
|
this.state = { x: o, columnIndex: a, width: r }, this.emit(), this.options.onResize?.(r, a);
|
|
1699
1700
|
return;
|
|
1700
1701
|
}
|
|
1701
|
-
const s = n === b.ColumnResizeHandler ?
|
|
1702
|
+
const s = n === b.ColumnResizeHandler ? Vn(this.options.coordInstance(), this.options.scrollState().scrollLeft, o, i) : -1;
|
|
1702
1703
|
s !== this.hoveredIndex && (this.hoveredIndex = s, this.emit());
|
|
1703
1704
|
}
|
|
1704
1705
|
/** On pointerup; returns the final width and column, or null when not resizing. */
|
|
@@ -1714,7 +1715,7 @@ class rs {
|
|
|
1714
1715
|
this.pressed = null, this.state = kt, this.emit(), this.options.onResize?.(n, t);
|
|
1715
1716
|
}
|
|
1716
1717
|
}
|
|
1717
|
-
class
|
|
1718
|
+
class hs {
|
|
1718
1719
|
defaultRowHeight;
|
|
1719
1720
|
defaultColumnWidth;
|
|
1720
1721
|
pureRowCount;
|
|
@@ -1869,12 +1870,12 @@ class ls {
|
|
|
1869
1870
|
this.rowCount = t, this.pureRowCount = n, this.rowInitSize = o, this.rowHeightMap = i, a != null && (this.defaultRowHeight = a), this.lastRowIndex = -1, this.rowMetaDataMap = {};
|
|
1870
1871
|
}
|
|
1871
1872
|
}
|
|
1872
|
-
const
|
|
1873
|
+
const ms = 240, gs = ({
|
|
1873
1874
|
containerWidth: e,
|
|
1874
1875
|
columnInitSize: t,
|
|
1875
1876
|
columnCount: n,
|
|
1876
1877
|
getColumnWidth: o,
|
|
1877
|
-
minScrollableWidth: i =
|
|
1878
|
+
minScrollableWidth: i = ms
|
|
1878
1879
|
}) => {
|
|
1879
1880
|
const a = e - i;
|
|
1880
1881
|
if (a <= t) return 0;
|
|
@@ -1882,7 +1883,7 @@ const cs = 240, us = ({
|
|
|
1882
1883
|
for (let r = 0; r < n; r++)
|
|
1883
1884
|
if (s += o(r) ?? 0, s > a) return r;
|
|
1884
1885
|
return n;
|
|
1885
|
-
},
|
|
1886
|
+
}, fs = (e, t, n, o) => {
|
|
1886
1887
|
const { pureRowCount: i, columnCount: a } = o, s = !!n.expand;
|
|
1887
1888
|
let [r, l] = e.ranges[s ? 1 : 0];
|
|
1888
1889
|
n.jump ? t === "up" ? l = 0 : t === "down" ? l = i - 1 : t === "left" ? r = 0 : r = a - 1 : t === "up" ? l = Math.max(l - 1, 0) : t === "down" ? l = Math.min(l + 1, i - 1) : t === "left" ? r = Math.max(r - 1, 0) : r = Math.min(r + 1, a - 1);
|
|
@@ -1892,10 +1893,10 @@ const cs = 240, us = ({
|
|
|
1892
1893
|
...s ? {} : { activeCell: c },
|
|
1893
1894
|
scrollTo: c
|
|
1894
1895
|
};
|
|
1895
|
-
},
|
|
1896
|
+
}, Gn = (e, t, n) => {
|
|
1896
1897
|
const [o, i] = e.ranges[0], s = [t ? Math.max(o - 1, 0) : Math.min(o + 1, n.columnCount - 1), i];
|
|
1897
1898
|
return { selection: e.setRanges([s, s]), activeCell: s, scrollTo: s };
|
|
1898
|
-
},
|
|
1899
|
+
}, ps = (e, t) => e.setRanges([[0, 0], [t.columnCount - 1, t.pureRowCount - 1]]), Cs = (e, t, n = !1) => {
|
|
1899
1900
|
let o = e.ranges[0];
|
|
1900
1901
|
e.isColumnSelection && (o = [o[0], 0]);
|
|
1901
1902
|
const [i, a] = o, s = n ? a : Math.min(a + 1, t.pureRowCount - 1), r = [i, s];
|
|
@@ -1941,7 +1942,7 @@ class se {
|
|
|
1941
1942
|
case H.Columns: {
|
|
1942
1943
|
let n = !1;
|
|
1943
1944
|
const o = this.ranges.map((i) => this.isOverlap(i, t) ? (n = !0, [Math.min(i[0], t[0]), Math.max(i[1], t[1])]) : i);
|
|
1944
|
-
return n || o.push(t), new se(this.type,
|
|
1945
|
+
return n || o.push(t), new se(this.type, Ft(o));
|
|
1945
1946
|
}
|
|
1946
1947
|
case H.Cells:
|
|
1947
1948
|
return new se(this.type, [this.ranges[0], t]);
|
|
@@ -1954,7 +1955,7 @@ class se {
|
|
|
1954
1955
|
switch (this.type) {
|
|
1955
1956
|
case H.Rows:
|
|
1956
1957
|
case H.Columns: {
|
|
1957
|
-
const n =
|
|
1958
|
+
const n = pi(this.ranges, t);
|
|
1958
1959
|
return n.length ? new se(this.type, n) : Ge;
|
|
1959
1960
|
}
|
|
1960
1961
|
case H.Cells:
|
|
@@ -1965,14 +1966,14 @@ class se {
|
|
|
1965
1966
|
}
|
|
1966
1967
|
flatten() {
|
|
1967
1968
|
const [t, n] = this.ranges;
|
|
1968
|
-
return this.isCellSelection ? [...t, ...n] :
|
|
1969
|
+
return this.isCellSelection ? [...t, ...n] : gi(this.ranges);
|
|
1969
1970
|
}
|
|
1970
1971
|
/** Runs merged and sorted, or the cell rectangle as `[topLeft, bottomRight]`. */
|
|
1971
1972
|
serialize() {
|
|
1972
1973
|
switch (this.type) {
|
|
1973
1974
|
case H.Rows:
|
|
1974
1975
|
case H.Columns:
|
|
1975
|
-
return
|
|
1976
|
+
return Ft(this.ranges);
|
|
1976
1977
|
case H.Cells: {
|
|
1977
1978
|
const [t, n] = this.ranges;
|
|
1978
1979
|
return [
|
|
@@ -1990,19 +1991,19 @@ class se {
|
|
|
1990
1991
|
switch (this.type) {
|
|
1991
1992
|
case H.Rows:
|
|
1992
1993
|
case H.Columns:
|
|
1993
|
-
return
|
|
1994
|
+
return mi(t, this.ranges);
|
|
1994
1995
|
case H.Cells:
|
|
1995
|
-
return
|
|
1996
|
+
return fi(t, this.ranges[0], this.ranges[1]);
|
|
1996
1997
|
default:
|
|
1997
1998
|
return !1;
|
|
1998
1999
|
}
|
|
1999
2000
|
}
|
|
2000
2001
|
equals(t) {
|
|
2001
|
-
return
|
|
2002
|
+
return Gt(this.ranges, t);
|
|
2002
2003
|
}
|
|
2003
2004
|
}
|
|
2004
2005
|
const Ge = new se(H.None, []);
|
|
2005
|
-
class
|
|
2006
|
+
class ws {
|
|
2006
2007
|
selection = new se();
|
|
2007
2008
|
activeCell = null;
|
|
2008
2009
|
isSelecting = !1;
|
|
@@ -2018,7 +2019,7 @@ class gs {
|
|
|
2018
2019
|
return this.options.isMultiSelectionEnable ?? !0;
|
|
2019
2020
|
}
|
|
2020
2021
|
getLinearRow(t) {
|
|
2021
|
-
return (this.options.getLinearRow ??
|
|
2022
|
+
return (this.options.getLinearRow ?? Ot)(t);
|
|
2022
2023
|
}
|
|
2023
2024
|
/** Replaces the selection and/or the active cell; notifies once if either changed. */
|
|
2024
2025
|
update(t) {
|
|
@@ -2043,6 +2044,8 @@ class gs {
|
|
|
2043
2044
|
});
|
|
2044
2045
|
return;
|
|
2045
2046
|
}
|
|
2047
|
+
// The expand control opens the record on release; the selection stays.
|
|
2048
|
+
case b.RowHeaderExpandHandler:
|
|
2046
2049
|
case b.RowHeaderDragHandler:
|
|
2047
2050
|
case b.RowHeaderCheckbox:
|
|
2048
2051
|
case b.ColumnHeader:
|
|
@@ -2140,57 +2143,57 @@ class gs {
|
|
|
2140
2143
|
}
|
|
2141
2144
|
}
|
|
2142
2145
|
}
|
|
2143
|
-
const
|
|
2146
|
+
const vs = (e, t, n) => {
|
|
2144
2147
|
if (!Number.isFinite(t) || n <= 0) return null;
|
|
2145
2148
|
const o = Math.min(n - 1, Math.max(0, Math.trunc(t))), i = { startColumn: e.startColumn, endColumn: e.endColumn };
|
|
2146
2149
|
return o > e.endRow ? { source: e, target: { ...i, startRow: e.endRow + 1, endRow: o }, direction: "down" } : o < e.startRow ? { source: e, target: { ...i, startRow: o, endRow: e.startRow - 1 }, direction: "up" } : null;
|
|
2147
|
-
},
|
|
2150
|
+
}, Ss = (e) => ({
|
|
2148
2151
|
startColumn: e.source.startColumn,
|
|
2149
2152
|
endColumn: e.source.endColumn,
|
|
2150
2153
|
startRow: Math.min(e.source.startRow, e.target.startRow),
|
|
2151
2154
|
endRow: Math.max(e.source.endRow, e.target.endRow)
|
|
2152
|
-
}),
|
|
2155
|
+
}), ys = (e) => typeof e == "number" && Number.isFinite(e), Or = (e, t, n = "down") => {
|
|
2153
2156
|
if (t <= 0 || e.length === 0) return [];
|
|
2154
|
-
const o = n === "down" ? e : [...e].reverse(), i = o.length >= 2 && o.every(
|
|
2157
|
+
const o = n === "down" ? e : [...e].reverse(), i = o.length >= 2 && o.every(ys) && o.some((s) => s !== o[0]), a = [];
|
|
2155
2158
|
if (i) {
|
|
2156
2159
|
const s = o.slice(1).map((l, c) => l - o[c]);
|
|
2157
2160
|
let r = o[o.length - 1];
|
|
2158
2161
|
for (let l = 0; l < t; l++)
|
|
2159
|
-
r += s[l % s.length], a.push(
|
|
2162
|
+
r += s[l % s.length], a.push(bs(r, o));
|
|
2160
2163
|
} else
|
|
2161
2164
|
for (let s = 0; s < t; s++) a.push(o[s % o.length]);
|
|
2162
2165
|
return n === "down" ? a : a.reverse();
|
|
2163
|
-
},
|
|
2166
|
+
}, bs = (e, t) => {
|
|
2164
2167
|
const n = Math.max(...t.map((i) => (String(i).split(".")[1] ?? "").length));
|
|
2165
2168
|
if (n > 12) return e;
|
|
2166
2169
|
const o = 10 ** n;
|
|
2167
2170
|
return Math.round(e * o) / o;
|
|
2168
|
-
},
|
|
2171
|
+
}, Un = 20, Et = {
|
|
2169
2172
|
drag: $.Drag,
|
|
2170
2173
|
expand: $.Expand,
|
|
2171
2174
|
checkbox: $.Checkbox
|
|
2172
|
-
},
|
|
2175
|
+
}, xs = {
|
|
2173
2176
|
none: K.None,
|
|
2174
2177
|
cell: K.Cell,
|
|
2175
2178
|
row: K.Row,
|
|
2176
2179
|
column: K.Column,
|
|
2177
2180
|
all: K.All
|
|
2178
|
-
},
|
|
2181
|
+
}, Rs = {
|
|
2179
2182
|
none: he.None,
|
|
2180
2183
|
column: he.Column,
|
|
2181
2184
|
row: he.Row,
|
|
2182
2185
|
all: he.All
|
|
2183
|
-
},
|
|
2186
|
+
}, ks = {
|
|
2184
2187
|
[H.None]: "none",
|
|
2185
2188
|
[H.Cells]: "cells",
|
|
2186
2189
|
[H.Rows]: "rows",
|
|
2187
2190
|
[H.Columns]: "columns"
|
|
2188
|
-
},
|
|
2191
|
+
}, Is = {
|
|
2189
2192
|
none: H.None,
|
|
2190
2193
|
cells: H.Cells,
|
|
2191
2194
|
rows: H.Rows,
|
|
2192
2195
|
columns: H.Columns
|
|
2193
|
-
},
|
|
2196
|
+
}, Kn = { ArrowUp: "up", ArrowDown: "down", ArrowLeft: "left", ArrowRight: "right" }, Ps = (e) => Math.max(B.rowHeadWidth, 46 + e.length * 24), zs = 640, Ms = 50, As = (e, t) => ({
|
|
2194
2197
|
id: e.id,
|
|
2195
2198
|
name: e.name,
|
|
2196
2199
|
width: t,
|
|
@@ -2199,8 +2202,8 @@ const fs = (e, t, n) => {
|
|
|
2199
2202
|
isPrimary: e.isPrimary,
|
|
2200
2203
|
description: e.description,
|
|
2201
2204
|
hasIcon: e.hasIcon
|
|
2202
|
-
}),
|
|
2203
|
-
class
|
|
2205
|
+
}), Io = (e, t) => e === t || !!e && !!t && e[0] === t[0] && e[1] === t[1], Es = (e, t) => e.kind === t.kind && Io(e.activeCell, t.activeCell) && e.ranges.length === t.ranges.length && e.ranges.every((n, o) => n[0] === t.ranges[o][0] && n[1] === t.ranges[o][1]);
|
|
2206
|
+
class Hs {
|
|
2204
2207
|
coord;
|
|
2205
2208
|
scroll = { scrollTop: 0, scrollLeft: 0, isScrolling: !1 };
|
|
2206
2209
|
mouseState = Ve;
|
|
@@ -2232,19 +2235,19 @@ class zs {
|
|
|
2232
2235
|
constructor(t, n) {
|
|
2233
2236
|
this.config = t, this.hooks = n, this.coord = this.createCoordinate();
|
|
2234
2237
|
const o = () => this.config;
|
|
2235
|
-
this.selection = new
|
|
2238
|
+
this.selection = new ws({
|
|
2236
2239
|
getPureRowCount: () => this.config.rowCount,
|
|
2237
2240
|
get selectable() {
|
|
2238
|
-
return
|
|
2241
|
+
return xs[o().selectable];
|
|
2239
2242
|
},
|
|
2240
2243
|
onChange: () => {
|
|
2241
2244
|
const i = this.getSelection();
|
|
2242
|
-
|
|
2245
|
+
Es(i, this.lastSelection) || (this.lastSelection = i, this.hooks.selectionChange(i), this.hooks.render());
|
|
2243
2246
|
},
|
|
2244
2247
|
onRowControlClick: (i, a) => {
|
|
2245
2248
|
a === $.Expand && this.hooks.rowExpand(i);
|
|
2246
2249
|
}
|
|
2247
|
-
}), this.resize = new
|
|
2250
|
+
}), this.resize = new ds({
|
|
2248
2251
|
coordInstance: () => this.coord,
|
|
2249
2252
|
scrollState: () => this.scroll,
|
|
2250
2253
|
minWidth: (i) => this.config.columns[i]?.minWidth ?? B.columnMinWidth,
|
|
@@ -2254,17 +2257,17 @@ class zs {
|
|
|
2254
2257
|
onChange: (i) => {
|
|
2255
2258
|
this.resizeState = i, this.hooks.render();
|
|
2256
2259
|
}
|
|
2257
|
-
}), this.resizeState = this.resize.state, this.drag = new
|
|
2260
|
+
}), this.resizeState = this.resize.state, this.drag = new Si({
|
|
2258
2261
|
coordInstance: () => this.coord,
|
|
2259
2262
|
scrollState: () => this.scroll,
|
|
2260
2263
|
selection: () => this.selection.selection,
|
|
2261
2264
|
get draggable() {
|
|
2262
|
-
return
|
|
2265
|
+
return Rs[o().draggable];
|
|
2263
2266
|
},
|
|
2264
2267
|
onChange: (i) => {
|
|
2265
2268
|
this.dragState = i, this.hooks.render();
|
|
2266
2269
|
}
|
|
2267
|
-
}), this.dragState = this.drag.state, this.autoScroller = new
|
|
2270
|
+
}), this.dragState = this.drag.state, this.autoScroller = new us({
|
|
2268
2271
|
getBounds: () => ({
|
|
2269
2272
|
containerWidth: this.coord.containerWidth,
|
|
2270
2273
|
containerHeight: this.coord.containerHeight,
|
|
@@ -2276,7 +2279,7 @@ class zs {
|
|
|
2276
2279
|
onTick: () => {
|
|
2277
2280
|
this.lastPoint && this.pointerMove({ ...this.lastPoint, ...this.lastModifiers }, !0);
|
|
2278
2281
|
}
|
|
2279
|
-
}), this.rowControls = this.visibleRowControls().map((i) => ({ type:
|
|
2282
|
+
}), this.rowControls = this.visibleRowControls().map((i) => ({ type: Et[i] })), this.applyColumns();
|
|
2280
2283
|
}
|
|
2281
2284
|
/**
|
|
2282
2285
|
* Touch on a grid no wider than 640 px. There a tap opens the record (the
|
|
@@ -2284,18 +2287,18 @@ class zs {
|
|
|
2284
2287
|
* numbers only and no column is frozen.
|
|
2285
2288
|
*/
|
|
2286
2289
|
get isPhone() {
|
|
2287
|
-
return !!this.config.touch && this.width > 0 && this.width <=
|
|
2290
|
+
return !!this.config.touch && this.width > 0 && this.width <= zs;
|
|
2288
2291
|
}
|
|
2289
2292
|
visibleRowControls() {
|
|
2290
2293
|
return this.isPhone ? [] : this.config.rowControls;
|
|
2291
2294
|
}
|
|
2292
2295
|
gutterWidth() {
|
|
2293
|
-
return this.isPhone ?
|
|
2296
|
+
return this.isPhone ? Ms : Ps(this.config.rowControls);
|
|
2294
2297
|
}
|
|
2295
2298
|
// ---- configuration ----------------------------------------------------
|
|
2296
2299
|
createCoordinate() {
|
|
2297
2300
|
const { rowCount: t, rowHeight: n, headerHeight: o, columns: i, freezeColumnCount: a } = this.config;
|
|
2298
|
-
return new
|
|
2301
|
+
return new hs({
|
|
2299
2302
|
rowHeight: n,
|
|
2300
2303
|
columnWidth: B.columnWidth,
|
|
2301
2304
|
rowCount: t,
|
|
@@ -2312,7 +2315,7 @@ class zs {
|
|
|
2312
2315
|
const { columns: t } = this.config, n = {};
|
|
2313
2316
|
this.gridColumns = t.map((o, i) => {
|
|
2314
2317
|
const a = this.widthOverrides.get(i) ?? o.width ?? B.columnWidth;
|
|
2315
|
-
return n[i] = a,
|
|
2318
|
+
return n[i] = a, As(o, a);
|
|
2316
2319
|
}), this.coord.refreshColumnDimensions({ columnCount: t.length, columnInitSize: this.gutterWidth(), columnWidthMap: n }), this.coord.freezeColumnCount = this.freezeCount(this.config.freezeColumnCount), this.invalidate();
|
|
2317
2320
|
}
|
|
2318
2321
|
/**
|
|
@@ -2321,7 +2324,7 @@ class zs {
|
|
|
2321
2324
|
*/
|
|
2322
2325
|
freezeCount(t) {
|
|
2323
2326
|
const { columns: n } = this.config, o = Math.min(t, n.length);
|
|
2324
|
-
return this.width <= 0 ? o : this.isPhone ? 0 : Math.min(o,
|
|
2327
|
+
return this.width <= 0 ? o : this.isPhone ? 0 : Math.min(o, gs({
|
|
2325
2328
|
containerWidth: this.width,
|
|
2326
2329
|
columnInitSize: this.gutterWidth(),
|
|
2327
2330
|
columnCount: n.length,
|
|
@@ -2330,7 +2333,7 @@ class zs {
|
|
|
2330
2333
|
}
|
|
2331
2334
|
configure(t) {
|
|
2332
2335
|
const n = this.config;
|
|
2333
|
-
this.config = t, n.rowHeight !== t.rowHeight || n.headerHeight !== t.headerHeight ? this.coord = this.createCoordinate() : n.rowCount !== t.rowCount && this.coord.refreshRowDimensions({ rowCount: t.rowCount, pureRowCount: t.rowCount, rowInitSize: t.headerHeight }), n.columns !== t.columns && this.widthOverrides.clear(), this.rowControls = this.visibleRowControls().map((o) => ({ type:
|
|
2336
|
+
this.config = t, n.rowHeight !== t.rowHeight || n.headerHeight !== t.headerHeight ? this.coord = this.createCoordinate() : n.rowCount !== t.rowCount && this.coord.refreshRowDimensions({ rowCount: t.rowCount, pureRowCount: t.rowCount, rowInitSize: t.headerHeight }), n.columns !== t.columns && this.widthOverrides.clear(), this.rowControls = this.visibleRowControls().map((o) => ({ type: Et[o] })), this.applyColumns(), this.clampSelection(), this.setScroll(this.scroll.scrollLeft, this.scroll.scrollTop), this.updateVisible();
|
|
2334
2337
|
}
|
|
2335
2338
|
/** Drops a selection that points past the data after rows or columns went away. */
|
|
2336
2339
|
clampSelection() {
|
|
@@ -2343,7 +2346,7 @@ class zs {
|
|
|
2343
2346
|
setViewport(t, n) {
|
|
2344
2347
|
if (t === this.width && n === this.height) return;
|
|
2345
2348
|
const o = this.isPhone;
|
|
2346
|
-
this.width = t, this.height = n, this.coord.containerWidth = t, this.coord.containerHeight = n, this.isPhone !== o && (this.rowControls = this.visibleRowControls().map((i) => ({ type:
|
|
2349
|
+
this.width = t, this.height = n, this.coord.containerWidth = t, this.coord.containerHeight = n, this.isPhone !== o && (this.rowControls = this.visibleRowControls().map((i) => ({ type: Et[i] })), this.applyColumns()), this.coord.freezeColumnCount = this.freezeCount(this.config.freezeColumnCount), this.invalidate(), this.updateVisible();
|
|
2347
2350
|
}
|
|
2348
2351
|
get viewport() {
|
|
2349
2352
|
return { width: this.width, height: this.height };
|
|
@@ -2357,7 +2360,7 @@ class zs {
|
|
|
2357
2360
|
* keeps room for a vertical overlay bar beside them.
|
|
2358
2361
|
*/
|
|
2359
2362
|
get contentSize() {
|
|
2360
|
-
const { totalWidth: t, totalHeight: n } = this.coord, o = t > this.width ?
|
|
2363
|
+
const { totalWidth: t, totalHeight: n } = this.coord, o = t > this.width ? Un : 0, i = n > this.height - o ? Un : 0;
|
|
2361
2364
|
return { width: t + o, height: n + i };
|
|
2362
2365
|
}
|
|
2363
2366
|
/** The scroller moved (native scroll or our own `scrollTo`). */
|
|
@@ -2370,7 +2373,7 @@ class zs {
|
|
|
2370
2373
|
this.setScroll(t, n), this.scroll !== o && this.hooks.scrollTo(this.scroll.scrollLeft, this.scroll.scrollTop);
|
|
2371
2374
|
}
|
|
2372
2375
|
updateVisible() {
|
|
2373
|
-
const t =
|
|
2376
|
+
const t = Pn(this.coord, this.scroll), n = this.visible;
|
|
2374
2377
|
n && n.startRowIndex === t.startRowIndex && n.stopRowIndex === t.stopRowIndex && n.startColumnIndex === t.startColumnIndex && n.stopColumnIndex === t.stopColumnIndex || (this.visible = t, this.contentVersion++, this.config.rowCount > 0 && this.config.columns.length > 0 && this.hooks.visibleRangeChange({
|
|
2375
2378
|
startRow: t.startRowIndex,
|
|
2376
2379
|
stopRow: t.stopRowIndex,
|
|
@@ -2379,7 +2382,7 @@ class zs {
|
|
|
2379
2382
|
}));
|
|
2380
2383
|
}
|
|
2381
2384
|
get visibleRegion() {
|
|
2382
|
-
return this.visible ?? (this.visible =
|
|
2385
|
+
return this.visible ?? (this.visible = Pn(this.coord, this.scroll));
|
|
2383
2386
|
}
|
|
2384
2387
|
/** Marks cell content stale (data, columns or theme changed). */
|
|
2385
2388
|
invalidate() {
|
|
@@ -2388,10 +2391,10 @@ class zs {
|
|
|
2388
2391
|
// ---- selection --------------------------------------------------------
|
|
2389
2392
|
getSelection() {
|
|
2390
2393
|
const { selection: t, activeCell: n } = this.selection;
|
|
2391
|
-
return { kind:
|
|
2394
|
+
return { kind: ks[t.type], ranges: t.ranges.map((o) => [o[0], o[1]]), activeCell: n ? [n[0], n[1]] : null };
|
|
2392
2395
|
}
|
|
2393
2396
|
setSelection(t) {
|
|
2394
|
-
const n = t.ranges.map((a) => [a[0], a[1]]), o = t.kind === "none" ? Ge : new se(
|
|
2397
|
+
const n = t.ranges.map((a) => [a[0], a[1]]), o = t.kind === "none" ? Ge : new se(Is[t.kind], n), i = t.activeCell !== void 0 ? t.activeCell ? [t.activeCell[0], t.activeCell[1]] : null : t.kind === "cells" && n[0] ? [n[0][0], n[0][1]] : null;
|
|
2395
2398
|
this.selection.update({ selection: o, activeCell: i });
|
|
2396
2399
|
}
|
|
2397
2400
|
selectCell(t, n) {
|
|
@@ -2477,7 +2480,7 @@ class zs {
|
|
|
2477
2480
|
return !t || t[0] >= this.coord.columnCount || t[1] >= this.coord.pureRowCount ? null : { columnIndex: t[0], rowIndex: t[1], width: this.coord.getColumnWidth(t[0]), height: this.coord.getRowHeight(t[1]) };
|
|
2478
2481
|
}
|
|
2479
2482
|
hitTest(t) {
|
|
2480
|
-
return
|
|
2483
|
+
return Ei(this.regionContext(), t);
|
|
2481
2484
|
}
|
|
2482
2485
|
// ---- pointer ----------------------------------------------------------
|
|
2483
2486
|
/** Returns true when the press belongs to the grid (the host then claims focus). */
|
|
@@ -2553,12 +2556,12 @@ class zs {
|
|
|
2553
2556
|
endFill(t) {
|
|
2554
2557
|
const n = this.fillSource;
|
|
2555
2558
|
this.fillSource = null;
|
|
2556
|
-
const o =
|
|
2559
|
+
const o = vs(n, this.fillTargetRow(t), this.config.rowCount);
|
|
2557
2560
|
if (!o) {
|
|
2558
2561
|
this.hooks.render();
|
|
2559
2562
|
return;
|
|
2560
2563
|
}
|
|
2561
|
-
const i =
|
|
2564
|
+
const i = Ss(o), a = this.selection.activeCell;
|
|
2562
2565
|
this.selection.update({
|
|
2563
2566
|
selection: this.selection.selection.set(H.Cells, [[i.startColumn, i.startRow], [i.endColumn, i.endRow]]),
|
|
2564
2567
|
...a ? {} : { activeCell: [n.startColumn, n.startRow] }
|
|
@@ -2591,7 +2594,7 @@ class zs {
|
|
|
2591
2594
|
/** True when `cell` is the active cell and the whole selection. */
|
|
2592
2595
|
isSoleActiveCell(t) {
|
|
2593
2596
|
const { selection: n, activeCell: o } = this.selection;
|
|
2594
|
-
if (!n.isCellSelection || !
|
|
2597
|
+
if (!n.isCellSelection || !Io(o, t)) return !1;
|
|
2595
2598
|
const [i, a] = n.ranges;
|
|
2596
2599
|
return !!i && !!a && i[0] === a[0] && i[1] === a[1];
|
|
2597
2600
|
}
|
|
@@ -2674,7 +2677,7 @@ class zs {
|
|
|
2674
2677
|
moveAfterEdit(t, n) {
|
|
2675
2678
|
const { rowCount: o, columns: i } = this.config;
|
|
2676
2679
|
if (!o || !i.length) return;
|
|
2677
|
-
const a = { pureRowCount: o, columnCount: i.length }, s = new se(H.Cells, [[t[0], t[1]], [t[0], t[1]]]), r = n === "down" ?
|
|
2680
|
+
const a = { pureRowCount: o, columnCount: i.length }, s = new se(H.Cells, [[t[0], t[1]], [t[0], t[1]]]), r = n === "down" ? Cs(s, a) : Gn(s, n === "left", a);
|
|
2678
2681
|
this.selection.update({ selection: r.selection, activeCell: r.activeCell }), this.scrollToCell(r.scrollTo);
|
|
2679
2682
|
}
|
|
2680
2683
|
/** An input method started composing on the selected cell. */
|
|
@@ -2689,22 +2692,22 @@ class zs {
|
|
|
2689
2692
|
keyDown(t) {
|
|
2690
2693
|
if (t.key === "Escape" && this.down)
|
|
2691
2694
|
return this.cancelGesture(), "prevent";
|
|
2692
|
-
if (
|
|
2695
|
+
if (vo(t))
|
|
2693
2696
|
return this.compositionStart(), "pass";
|
|
2694
2697
|
const { rowCount: n, columns: o } = this.config;
|
|
2695
2698
|
if (!n || !o.length) return "ignore";
|
|
2696
2699
|
const i = { pureRowCount: n, columnCount: o.length }, a = this.selection.selection, s = this.selection.activeCell;
|
|
2697
2700
|
if (!a.isCellSelection || !s)
|
|
2698
|
-
return
|
|
2699
|
-
const r =
|
|
2701
|
+
return Kn[t.key] || t.key === "Tab" || t.key === "Home" ? t.key === "Tab" && !s ? "ignore" : (this.selectCell(s ?? [0, 0], !1), "prevent") : "ignore";
|
|
2702
|
+
const r = Kn[t.key];
|
|
2700
2703
|
if (r) {
|
|
2701
2704
|
if (t.altKey) return "ignore";
|
|
2702
|
-
const l =
|
|
2705
|
+
const l = fs(a, r, { expand: t.shiftKey, jump: t.commandKey }, i);
|
|
2703
2706
|
return this.selection.update({ selection: l.selection, ...l.activeCell ? { activeCell: l.activeCell } : {} }), this.scrollToCell(l.scrollTo), "prevent";
|
|
2704
2707
|
}
|
|
2705
2708
|
switch (t.key) {
|
|
2706
2709
|
case "Tab": {
|
|
2707
|
-
const l =
|
|
2710
|
+
const l = Gn(a, t.shiftKey, i);
|
|
2708
2711
|
return this.selection.update({ selection: l.selection, activeCell: l.activeCell }), this.scrollToCell(l.scrollTo), "prevent";
|
|
2709
2712
|
}
|
|
2710
2713
|
case "Home":
|
|
@@ -2720,7 +2723,7 @@ class zs {
|
|
|
2720
2723
|
case "a":
|
|
2721
2724
|
case "A":
|
|
2722
2725
|
if (!t.commandKey || t.shiftKey || t.altKey) break;
|
|
2723
|
-
return this.selection.update({ selection:
|
|
2726
|
+
return this.selection.update({ selection: ps(a, i) }), "prevent";
|
|
2724
2727
|
case "Enter":
|
|
2725
2728
|
return t.shiftKey || t.altKey || t.commandKey ? "ignore" : (this.requestEdit(s, "enter", !1), "prevent");
|
|
2726
2729
|
case "F2":
|
|
@@ -2734,7 +2737,7 @@ class zs {
|
|
|
2734
2737
|
case "Escape":
|
|
2735
2738
|
return "ignore";
|
|
2736
2739
|
}
|
|
2737
|
-
return
|
|
2740
|
+
return Sa(t) ? this.requestEdit(s, "key", !0) ? "pass" : "prevent" : "ignore";
|
|
2738
2741
|
}
|
|
2739
2742
|
// ---- drawing ----------------------------------------------------------
|
|
2740
2743
|
/** Everything `drawGrid` needs except the theme and the cell/icon painters. */
|
|
@@ -2790,31 +2793,31 @@ class zs {
|
|
|
2790
2793
|
this.autoScroller.stop();
|
|
2791
2794
|
}
|
|
2792
2795
|
}
|
|
2793
|
-
const
|
|
2796
|
+
const Ts = () => {
|
|
2794
2797
|
if (typeof navigator > "u") return !1;
|
|
2795
2798
|
const e = navigator.userAgentData?.platform ?? navigator.platform ?? "";
|
|
2796
2799
|
return /mac|iphone|ipad|ipod/i.test(e);
|
|
2797
|
-
},
|
|
2800
|
+
}, _n = (e, t) => {
|
|
2798
2801
|
const n = Number.parseFloat(e.getPropertyValue(t));
|
|
2799
2802
|
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
2800
|
-
},
|
|
2803
|
+
}, Ns = (e, t = { rowHeight: B.rowHeight, headerHeight: B.columnHeadHeight }) => {
|
|
2801
2804
|
const n = getComputedStyle(e);
|
|
2802
2805
|
return {
|
|
2803
|
-
rowHeight:
|
|
2804
|
-
headerHeight:
|
|
2806
|
+
rowHeight: _n(n, "--ui-grid-row-height") ?? t.rowHeight,
|
|
2807
|
+
headerHeight: _n(n, "--ui-grid-header-height") ?? t.headerHeight
|
|
2805
2808
|
};
|
|
2806
|
-
},
|
|
2809
|
+
}, Fs = (e, t, n) => n > 0 ? Math.max(0, Math.floor((e - t) / n)) : 0, Ls = ["aria-labelledby", "aria-rowcount", "aria-colcount", "aria-readonly", "aria-busy", "data-ui-grid-skeleton"], Ds = ["id"], Ws = { role: "rowgroup" }, Bs = {
|
|
2807
2810
|
role: "row",
|
|
2808
2811
|
"aria-rowindex": "1"
|
|
2809
|
-
},
|
|
2812
|
+
}, Os = ["id", "aria-colindex"], Vs = { role: "rowgroup" }, Gs = ["aria-rowindex", "aria-hidden"], Us = ["id"], Ks = ["aria-colindex", "aria-selected", "aria-readonly"], _s = ["id"], $s = ["data-ui-grid-editing", "aria-labelledby", "aria-invalid", "aria-describedby", "readonly"], qs = ["id"], Xs = {
|
|
2810
2813
|
key: 1,
|
|
2811
2814
|
role: "status",
|
|
2812
2815
|
class: "sr-only"
|
|
2813
|
-
},
|
|
2816
|
+
}, Ys = {
|
|
2814
2817
|
key: 2,
|
|
2815
2818
|
"data-ui-grid-overlay": "",
|
|
2816
2819
|
style: { position: "absolute", inset: "0", "pointer-events": "none", "z-index": "3" }
|
|
2817
|
-
},
|
|
2820
|
+
}, js = 6, Qs = 250, Zs = 100, Js = 800, er = 300, tr = 300, Vr = /* @__PURE__ */ ei({
|
|
2818
2821
|
__name: "GridHost",
|
|
2819
2822
|
props: {
|
|
2820
2823
|
columns: {},
|
|
@@ -2848,9 +2851,9 @@ const Ms = () => {
|
|
|
2848
2851
|
},
|
|
2849
2852
|
emits: ["selection-change", "edit-request", "cell-commit", "edit-end", "clear-request", "row-expand", "header-menu", "column-resize", "column-resize-end", "column-width-save", "fill-request", "clipboard-copy", "paste-request", "column-reorder", "row-reorder", "context-menu", "visible-range-change"],
|
|
2850
2853
|
setup(e, { expose: t, emit: n }) {
|
|
2851
|
-
const o = e, i = n, a =
|
|
2854
|
+
const o = e, i = n, a = ti(), s = ci(), r = ni(), l = ke(), c = ke(), u = ke(), h = ke(), m = ke(), g = ue({ rowHeight: B.rowHeight, headerHeight: B.columnHeadHeight }), C = ue({ ...po, ...o.themeOverrides }), S = ue({ width: 0, height: 0 }), p = ue({ kind: "none", ranges: [], activeCell: null }), w = ue({ width: 0, height: 0 }), v = ke(!1), y = ke(!1), R = ue(0);
|
|
2852
2855
|
let I = Ue.danger;
|
|
2853
|
-
const k = ue(null), P = U(() => o.rowHeight ?? g.value.rowHeight), M = U(() => o.headerHeight ?? g.value.headerHeight), N = U(() =>
|
|
2856
|
+
const k = ue(null), P = U(() => o.rowHeight ?? g.value.rowHeight), M = U(() => o.headerHeight ?? g.value.headerHeight), N = U(() => Fs(S.value.height, M.value, P.value)), z = U(() => !o.loading && o.rowCount === 0), E = () => {
|
|
2854
2857
|
const d = o.loading && o.rowCount === 0;
|
|
2855
2858
|
return {
|
|
2856
2859
|
columns: o.columns,
|
|
@@ -2867,26 +2870,26 @@ const Ms = () => {
|
|
|
2867
2870
|
touch: y.value
|
|
2868
2871
|
};
|
|
2869
2872
|
}, W = () => o.loading && o.rowCount === 0;
|
|
2870
|
-
let
|
|
2871
|
-
const X = () => o.editing ||
|
|
2873
|
+
let F = 0, _, q = null, ae = null;
|
|
2874
|
+
const X = () => o.editing || L.active, A = new Hs(E(), {
|
|
2872
2875
|
render: () => fe(),
|
|
2873
2876
|
selectionChange: (d) => {
|
|
2874
|
-
const f =
|
|
2875
|
-
|
|
2877
|
+
const f = L.state.value.cell;
|
|
2878
|
+
L.active && f && (d.activeCell?.[0] !== f[0] || d.activeCell?.[1] !== f[1]) && L.commit("selection"), p.value = d, !X() && m.value && (m.value.value = ""), je(), i("selection-change", d);
|
|
2876
2879
|
},
|
|
2877
2880
|
scrollTo: (d, f) => {
|
|
2878
2881
|
const x = u.value;
|
|
2879
2882
|
x && (x.scrollLeft = d, x.scrollTop = f);
|
|
2880
2883
|
},
|
|
2881
2884
|
editRequest: (d, f, x, T) => {
|
|
2882
|
-
if ((x !== "tap" || f.editor !== "long-text") &&
|
|
2885
|
+
if ((x !== "tap" || f.editor !== "long-text") && L.open(d, f, x, "edit")) {
|
|
2883
2886
|
Ze = x === "tap";
|
|
2884
2887
|
return;
|
|
2885
2888
|
}
|
|
2886
2889
|
i("edit-request", { cell: d, column: f, trigger: x, replace: T });
|
|
2887
2890
|
},
|
|
2888
2891
|
viewRequest: (d, f, x) => {
|
|
2889
|
-
|
|
2892
|
+
L.open(d, f, x, "view") && (Ze = x === "tap");
|
|
2890
2893
|
},
|
|
2891
2894
|
clearRequest: (d) => {
|
|
2892
2895
|
De(), i("clear-request", d);
|
|
@@ -2896,7 +2899,7 @@ const Ms = () => {
|
|
|
2896
2899
|
canExpandRow: () => !!(a?.vnode.props?.onRowExpand || a?.vnode.props?.onRowExpandOnce),
|
|
2897
2900
|
headerMenu: (d, f) => i("header-menu", d, f),
|
|
2898
2901
|
columnResize: (d, f, x) => {
|
|
2899
|
-
w.value = A.contentSize, x ? (i("column-resize-end", d, f),
|
|
2902
|
+
w.value = A.contentSize, x ? (i("column-resize-end", d, f), _o(d, f)) : i("column-resize", d, f);
|
|
2900
2903
|
},
|
|
2901
2904
|
fill: (d) => {
|
|
2902
2905
|
De(), i("fill-request", d);
|
|
@@ -2909,7 +2912,7 @@ const Ms = () => {
|
|
|
2909
2912
|
visibleRangeChange: (d) => {
|
|
2910
2913
|
W() || i("visible-range-change", d);
|
|
2911
2914
|
}
|
|
2912
|
-
}),
|
|
2915
|
+
}), L = ts({
|
|
2913
2916
|
owner: () => m.value,
|
|
2914
2917
|
root: () => l.value,
|
|
2915
2918
|
enabled: () => !!o.getEditText,
|
|
@@ -2927,12 +2930,12 @@ const Ms = () => {
|
|
|
2927
2930
|
i("edit-end", { cell: d, column: f, committed: x }), fe();
|
|
2928
2931
|
},
|
|
2929
2932
|
moveSelection: (d) => {
|
|
2930
|
-
const f =
|
|
2933
|
+
const f = L.state.value.cell ?? p.value.activeCell;
|
|
2931
2934
|
f && A.moveAfterEdit(f, d);
|
|
2932
2935
|
},
|
|
2933
2936
|
clearSelection: () => A.setSelection({ kind: "none", ranges: [] }),
|
|
2934
2937
|
refocus: () => {
|
|
2935
|
-
if (Ze && !
|
|
2938
|
+
if (Ze && !L.active) {
|
|
2936
2939
|
Ze = !1, m.value?.blur();
|
|
2937
2940
|
return;
|
|
2938
2941
|
}
|
|
@@ -2940,10 +2943,10 @@ const Ms = () => {
|
|
|
2940
2943
|
}
|
|
2941
2944
|
});
|
|
2942
2945
|
function fe() {
|
|
2943
|
-
|
|
2946
|
+
F || typeof requestAnimationFrame > "u" || (F = requestAnimationFrame(Te));
|
|
2944
2947
|
}
|
|
2945
2948
|
function Te() {
|
|
2946
|
-
|
|
2949
|
+
F = 0;
|
|
2947
2950
|
const d = c.value;
|
|
2948
2951
|
if (!d || !q) return;
|
|
2949
2952
|
const f = {
|
|
@@ -2955,10 +2958,10 @@ const Ms = () => {
|
|
|
2955
2958
|
drawCell: Pe,
|
|
2956
2959
|
drawIcon: o.drawIcon ? Ye : void 0
|
|
2957
2960
|
};
|
|
2958
|
-
|
|
2961
|
+
ua(d, q, f, _), _ = f, Ne(d), u.value && (u.value.style.cursor = A.cursor), je();
|
|
2959
2962
|
}
|
|
2960
2963
|
function Y() {
|
|
2961
|
-
|
|
2964
|
+
F && (cancelAnimationFrame(F), Te());
|
|
2962
2965
|
}
|
|
2963
2966
|
function Ne(d) {
|
|
2964
2967
|
const f = tt;
|
|
@@ -2967,15 +2970,15 @@ const Ms = () => {
|
|
|
2967
2970
|
if (!x) return;
|
|
2968
2971
|
const T = A.getCellRect([f.startColumn, f.startRow]), G = A.getCellRect([f.endColumn, f.endRow]);
|
|
2969
2972
|
if (!T || !G) return;
|
|
2970
|
-
const { columnInitSize: J, rowInitSize: Re } = A.coord, { width: xt, height: Rt } = A.viewport,
|
|
2971
|
-
x.save(), x.setTransform(
|
|
2973
|
+
const { columnInitSize: J, rowInitSize: Re } = A.coord, { width: xt, height: Rt } = A.viewport, mn = Math.ceil(globalThis.devicePixelRatio ?? 1);
|
|
2974
|
+
x.save(), x.setTransform(mn, 0, 0, mn, 0, 0), x.beginPath(), x.rect(J, Re, xt - J, Rt - Re), x.clip(), x.setLineDash([4, 3]), x.lineWidth = 1, x.strokeStyle = C.value.interactionLineColorHighlight, x.strokeRect(T.x + 0.5, T.y + 0.5, G.x + G.width - T.x - 1, G.y + G.height - T.y - 1), x.restore();
|
|
2972
2975
|
}
|
|
2973
|
-
const
|
|
2974
|
-
function
|
|
2976
|
+
const Fe = (d) => Math.max(0, Math.min(d.width - 2 * B.cellHorizontalPadding, d.width * 0.6));
|
|
2977
|
+
function Le(d, f) {
|
|
2975
2978
|
D(d, {
|
|
2976
2979
|
x: f.x + B.cellHorizontalPadding,
|
|
2977
2980
|
y: f.y + (f.height - 8) / 2,
|
|
2978
|
-
width:
|
|
2981
|
+
width: Fe(f),
|
|
2979
2982
|
height: 8,
|
|
2980
2983
|
radius: 8 / 2,
|
|
2981
2984
|
fill: f.theme.cellBgLoading
|
|
@@ -3008,7 +3011,7 @@ const Ms = () => {
|
|
|
3008
3011
|
isLoading: T
|
|
3009
3012
|
};
|
|
3010
3013
|
if (T) {
|
|
3011
|
-
|
|
3014
|
+
Le(d, G);
|
|
3012
3015
|
return;
|
|
3013
3016
|
}
|
|
3014
3017
|
const J = o.cellRenderer?.(x, f.columnIndex);
|
|
@@ -3030,9 +3033,9 @@ const Ms = () => {
|
|
|
3030
3033
|
d.style.transform = `translate(${xt}px, ${Rt}px)`, d.style.width = `${x.width}px`, d.style.height = `${x.height}px`;
|
|
3031
3034
|
}
|
|
3032
3035
|
function Se() {
|
|
3033
|
-
return
|
|
3036
|
+
return Ca(m.value, l.value ?? null);
|
|
3034
3037
|
}
|
|
3035
|
-
const ye = (d) =>
|
|
3038
|
+
const ye = (d) => Ts() ? d.metaKey : d.ctrlKey;
|
|
3036
3039
|
function ce(d) {
|
|
3037
3040
|
const f = ae ?? (ae = l.value.getBoundingClientRect());
|
|
3038
3041
|
return { x: d.clientX - f.left, y: d.clientY - f.top, shiftKey: d.shiftKey, commandKey: ye(d) };
|
|
@@ -3041,12 +3044,12 @@ const Ms = () => {
|
|
|
3041
3044
|
const f = u.value, x = ae;
|
|
3042
3045
|
return d.clientX - x.left >= f.clientWidth || d.clientY - x.top >= f.clientHeight;
|
|
3043
3046
|
}
|
|
3044
|
-
let re = null, te = null,
|
|
3045
|
-
const Je = () => typeof performance > "u" ? Date.now() : performance.now(),
|
|
3047
|
+
let re = null, te = null, Qt = -1 / 0, Zt = -1 / 0, Ze = !1;
|
|
3048
|
+
const Je = () => typeof performance > "u" ? Date.now() : performance.now(), Jt = () => te != null || Je() - Qt < Js;
|
|
3046
3049
|
function et() {
|
|
3047
|
-
te && clearTimeout(te.timer), te = null,
|
|
3050
|
+
te && clearTimeout(te.timer), te = null, Qt = Je();
|
|
3048
3051
|
}
|
|
3049
|
-
function
|
|
3052
|
+
function Eo(d) {
|
|
3050
3053
|
if (te) {
|
|
3051
3054
|
et();
|
|
3052
3055
|
return;
|
|
@@ -3055,31 +3058,31 @@ const Ms = () => {
|
|
|
3055
3058
|
id: d.pointerId,
|
|
3056
3059
|
x: d.clientX,
|
|
3057
3060
|
y: d.clientY,
|
|
3058
|
-
flingStop: Je() -
|
|
3061
|
+
flingStop: Je() - Zt < Zs,
|
|
3059
3062
|
longPressed: !1,
|
|
3060
3063
|
timer: setTimeout(() => {
|
|
3061
3064
|
te !== f || f.flingStop || X() || (f.longPressed = !0, A.longPress(ce(d)), Y());
|
|
3062
|
-
},
|
|
3065
|
+
}, Qs)
|
|
3063
3066
|
};
|
|
3064
3067
|
te = f;
|
|
3065
3068
|
}
|
|
3066
|
-
function
|
|
3069
|
+
function Ho(d) {
|
|
3067
3070
|
const f = te;
|
|
3068
|
-
!f || f.id !== d.pointerId || Math.hypot(d.clientX - f.x, d.clientY - f.y) >
|
|
3071
|
+
!f || f.id !== d.pointerId || Math.hypot(d.clientX - f.x, d.clientY - f.y) > js && et();
|
|
3069
3072
|
}
|
|
3070
|
-
function
|
|
3073
|
+
function To(d) {
|
|
3071
3074
|
const f = te;
|
|
3072
|
-
!f || f.id !== d.pointerId || (et(), !(f.longPressed || f.flingStop) && (
|
|
3075
|
+
!f || f.id !== d.pointerId || (et(), !(f.longPressed || f.flingStop) && (L.active && !L.commit("pointer") || o.editing || (A.tap(ce(d)), Y(), re && clearTimeout(re), re = setTimeout(() => {
|
|
3073
3076
|
re = null, A.clearTapFeedback();
|
|
3074
|
-
},
|
|
3077
|
+
}, er))));
|
|
3075
3078
|
}
|
|
3076
|
-
function
|
|
3079
|
+
function No(d) {
|
|
3077
3080
|
if (ae = l.value.getBoundingClientRect(), d.pointerType === "touch") {
|
|
3078
|
-
|
|
3081
|
+
Eo(d);
|
|
3079
3082
|
return;
|
|
3080
3083
|
}
|
|
3081
3084
|
if (d.button !== 0 || Qe(d)) return;
|
|
3082
|
-
if (
|
|
3085
|
+
if (L.active && !L.commit("pointer")) {
|
|
3083
3086
|
d.preventDefault();
|
|
3084
3087
|
return;
|
|
3085
3088
|
}
|
|
@@ -3093,16 +3096,16 @@ const Ms = () => {
|
|
|
3093
3096
|
Se();
|
|
3094
3097
|
}
|
|
3095
3098
|
}
|
|
3096
|
-
function
|
|
3099
|
+
function Fo(d) {
|
|
3097
3100
|
if (d.pointerType === "touch") {
|
|
3098
|
-
|
|
3101
|
+
Ho(d);
|
|
3099
3102
|
return;
|
|
3100
3103
|
}
|
|
3101
3104
|
ae || (ae = l.value.getBoundingClientRect()), A.pointerMove(ce(d)), Y(), u.value && (u.value.style.cursor = A.cursor);
|
|
3102
3105
|
}
|
|
3103
|
-
function
|
|
3106
|
+
function Lo(d) {
|
|
3104
3107
|
if (d.pointerType === "touch") {
|
|
3105
|
-
|
|
3108
|
+
To(d);
|
|
3106
3109
|
return;
|
|
3107
3110
|
}
|
|
3108
3111
|
if (A.isGestureActive) {
|
|
@@ -3113,38 +3116,38 @@ const Ms = () => {
|
|
|
3113
3116
|
}
|
|
3114
3117
|
}
|
|
3115
3118
|
}
|
|
3116
|
-
function
|
|
3119
|
+
function en(d) {
|
|
3117
3120
|
if (d.pointerType === "touch") {
|
|
3118
3121
|
te?.id === d.pointerId && et();
|
|
3119
3122
|
return;
|
|
3120
3123
|
}
|
|
3121
3124
|
A.cancelGesture(), Y();
|
|
3122
3125
|
}
|
|
3123
|
-
function
|
|
3126
|
+
function Do() {
|
|
3124
3127
|
A.pointerLeave();
|
|
3125
3128
|
}
|
|
3126
|
-
function
|
|
3127
|
-
X() ||
|
|
3129
|
+
function Wo(d) {
|
|
3130
|
+
X() || Jt() || A.doubleClick(ce(d));
|
|
3128
3131
|
}
|
|
3129
|
-
function
|
|
3130
|
-
if (
|
|
3132
|
+
function Bo(d) {
|
|
3133
|
+
if (Jt()) {
|
|
3131
3134
|
d.preventDefault();
|
|
3132
3135
|
return;
|
|
3133
3136
|
}
|
|
3134
3137
|
ae = l.value.getBoundingClientRect(), A.contextMenu(ce(d)) && (d.preventDefault(), Se());
|
|
3135
3138
|
}
|
|
3136
|
-
function
|
|
3139
|
+
function Oo() {
|
|
3137
3140
|
const d = u.value;
|
|
3138
|
-
d && (ae = null,
|
|
3141
|
+
d && (ae = null, Zt = Je(), A.setScroll(d.scrollLeft, d.scrollTop));
|
|
3139
3142
|
}
|
|
3140
|
-
function
|
|
3141
|
-
if (
|
|
3142
|
-
|
|
3143
|
+
function Vo(d) {
|
|
3144
|
+
if (L.active) {
|
|
3145
|
+
L.keyDown(d, ye(d)) && d.stopPropagation();
|
|
3143
3146
|
return;
|
|
3144
3147
|
}
|
|
3145
3148
|
if (o.editing) return;
|
|
3146
|
-
if (d.key === "Escape" && De(),
|
|
3147
|
-
|
|
3149
|
+
if (d.key === "Escape" && De(), Go(d)) {
|
|
3150
|
+
Uo();
|
|
3148
3151
|
return;
|
|
3149
3152
|
}
|
|
3150
3153
|
A.keyDown({
|
|
@@ -3163,74 +3166,74 @@ const Ms = () => {
|
|
|
3163
3166
|
tt && (tt = null, fe());
|
|
3164
3167
|
}
|
|
3165
3168
|
const pt = () => ({ rowCount: o.loading && o.rowCount === 0 ? 0 : o.rowCount, columnCount: o.columns.length });
|
|
3166
|
-
function
|
|
3169
|
+
function Go(d) {
|
|
3167
3170
|
if (!ye(d) || d.altKey || d.shiftKey) return !1;
|
|
3168
3171
|
const f = d.key.toLowerCase();
|
|
3169
3172
|
return f === "c" || f === "x" || d.code === "KeyC" || d.code === "KeyX";
|
|
3170
3173
|
}
|
|
3171
|
-
function
|
|
3174
|
+
function Uo() {
|
|
3172
3175
|
const d = m.value;
|
|
3173
|
-
!d || d.value || (d.value = " ", d.select(), pe && clearTimeout(pe), pe = setTimeout(
|
|
3176
|
+
!d || d.value || (d.value = " ", d.select(), pe && clearTimeout(pe), pe = setTimeout(tn, 0));
|
|
3174
3177
|
}
|
|
3175
|
-
function
|
|
3176
|
-
pe && clearTimeout(pe), pe = null, m.value && !
|
|
3178
|
+
function tn() {
|
|
3179
|
+
pe && clearTimeout(pe), pe = null, m.value && !L.active && (m.value.value = "");
|
|
3177
3180
|
}
|
|
3178
3181
|
function Ct(d, f, x, T) {
|
|
3179
|
-
T && (tt = qe(d, pt()), fe()), i("clipboard-copy", { block: f, cellCount:
|
|
3182
|
+
T && (tt = qe(d, pt()), fe()), i("clipboard-copy", { block: f, cellCount: Na(f), cut: x, ok: T }), T && x && !o.readonly && i("clear-request", d);
|
|
3180
3183
|
}
|
|
3181
|
-
function
|
|
3182
|
-
const x = A.getSelection(), T =
|
|
3184
|
+
function nn(d, f) {
|
|
3185
|
+
const x = A.getSelection(), T = yo(x, pt());
|
|
3183
3186
|
if (!T) return Promise.resolve(!1);
|
|
3184
|
-
const G =
|
|
3187
|
+
const G = La(T, o.isRowLoaded);
|
|
3185
3188
|
if (f && G) {
|
|
3186
|
-
const Re =
|
|
3189
|
+
const Re = Ma(f, zt(Fn(T, o.getCopyText ?? o.getCellText)));
|
|
3187
3190
|
return Ct(x, T, d, Re), Promise.resolve(Re);
|
|
3188
3191
|
}
|
|
3189
3192
|
f?.preventDefault();
|
|
3190
3193
|
let J;
|
|
3191
|
-
return G ? J = Promise.resolve(
|
|
3192
|
-
}),
|
|
3194
|
+
return G ? J = Promise.resolve(zt(Fn(T, o.getCopyText ?? o.getCellText))) : o.resolveCopy ? J = o.resolveCopy(T).then(zt) : J = Promise.reject(new Error("Rows are not loaded")), J.catch(() => {
|
|
3195
|
+
}), Ea(J).then(
|
|
3193
3196
|
() => (Ct(x, T, d, !0), !0),
|
|
3194
3197
|
() => (Ct(x, T, d, !1), !1)
|
|
3195
3198
|
);
|
|
3196
3199
|
}
|
|
3197
|
-
function
|
|
3198
|
-
|
|
3200
|
+
function on(d, f) {
|
|
3201
|
+
L.active || o.editing || (tn(), d.preventDefault(), nn(f, d));
|
|
3199
3202
|
}
|
|
3200
|
-
function
|
|
3203
|
+
function an(d) {
|
|
3201
3204
|
if (o.readonly) return null;
|
|
3202
|
-
const f =
|
|
3205
|
+
const f = Fa(d, A.getSelection(), {
|
|
3203
3206
|
...pt(),
|
|
3204
3207
|
isReadonlyColumn: (x) => !!o.columns[x]?.readonly
|
|
3205
3208
|
});
|
|
3206
3209
|
return f ? (De(), i("paste-request", f), f) : null;
|
|
3207
3210
|
}
|
|
3208
|
-
function
|
|
3209
|
-
|
|
3211
|
+
function Ko(d) {
|
|
3212
|
+
L.active || ya({ isEditing: o.editing, eventTarget: d.target, hiddenFocusEl: m.value ?? null }) && (d.preventDefault(), p.value.kind !== "none" && an(d.clipboardData?.getData("text/plain") ?? ""));
|
|
3210
3213
|
}
|
|
3211
3214
|
const wt = /* @__PURE__ */ new Map();
|
|
3212
3215
|
let ze = null;
|
|
3213
|
-
function
|
|
3216
|
+
function sn() {
|
|
3214
3217
|
ze && clearTimeout(ze), ze = null;
|
|
3215
3218
|
const d = [...wt];
|
|
3216
3219
|
wt.clear();
|
|
3217
3220
|
for (const [f, x] of d) i("column-width-save", f, x);
|
|
3218
3221
|
}
|
|
3219
|
-
function
|
|
3220
|
-
wt.set(d, f), ze && clearTimeout(ze), ze = setTimeout(
|
|
3222
|
+
function _o(d, f) {
|
|
3223
|
+
wt.set(d, f), ze && clearTimeout(ze), ze = setTimeout(sn, tr);
|
|
3221
3224
|
}
|
|
3222
|
-
function
|
|
3223
|
-
o.editing || (
|
|
3225
|
+
function $o() {
|
|
3226
|
+
o.editing || (L.active || A.compositionStart(), L.active && L.compositionStart());
|
|
3224
3227
|
}
|
|
3225
|
-
function
|
|
3226
|
-
|
|
3228
|
+
function qo() {
|
|
3229
|
+
L.compositionEnd();
|
|
3227
3230
|
}
|
|
3228
3231
|
let vt = null, St = null, yt = null, We = null;
|
|
3229
|
-
function
|
|
3232
|
+
function rn() {
|
|
3230
3233
|
y.value = !!We?.matches, xe();
|
|
3231
3234
|
}
|
|
3232
3235
|
let be = null;
|
|
3233
|
-
function
|
|
3236
|
+
function ln() {
|
|
3234
3237
|
const d = l.value;
|
|
3235
3238
|
if (!d) return;
|
|
3236
3239
|
ae = null;
|
|
@@ -3239,7 +3242,7 @@ const Ms = () => {
|
|
|
3239
3242
|
}
|
|
3240
3243
|
function xe() {
|
|
3241
3244
|
const d = l.value;
|
|
3242
|
-
d && (g.value =
|
|
3245
|
+
d && (g.value = Ns(d, g.value), C.value = ga(d, o.themeOverrides), I = ko(d).danger, k.value = qa(d.ownerDocument, C.value.fontSizeSM, C.value.fontFamily), A.theme = C.value, bt(), A.invalidate());
|
|
3243
3246
|
}
|
|
3244
3247
|
function bt() {
|
|
3245
3248
|
A.configure(E()), w.value = A.contentSize;
|
|
@@ -3255,32 +3258,32 @@ const Ms = () => {
|
|
|
3255
3258
|
}, { immediate: !0 }), de(
|
|
3256
3259
|
() => [o.columns, o.rowCount, o.freezeColumnCount, o.rowControls, o.selectable, o.draggable, o.columnResizable, o.readonly, y.value, P.value, M.value, v.value, N.value],
|
|
3257
3260
|
bt
|
|
3258
|
-
), de(() => [o.getCellText, o.cellRenderer, o.isRowLoaded, o.drawIcon], () => A.invalidate()), de(() => o.themeOverrides, xe), de(() => o.editing, () => fe()), de(() => o.highlightedRow, () => A.invalidate()),
|
|
3259
|
-
if (q = document.createElement("canvas"), xe(),
|
|
3261
|
+
), de(() => [o.getCellText, o.cellRenderer, o.isRowLoaded, o.drawIcon], () => A.invalidate()), de(() => o.themeOverrides, xe), de(() => o.editing, () => fe()), de(() => o.highlightedRow, () => A.invalidate()), oi(() => {
|
|
3262
|
+
if (q = document.createElement("canvas"), xe(), ln(), typeof ResizeObserver < "u" && (vt = new ResizeObserver(() => ln()), vt.observe(l.value)), typeof MutationObserver < "u") {
|
|
3260
3263
|
St = new MutationObserver(() => xe());
|
|
3261
3264
|
const d = l.value.closest("[data-ui-app]");
|
|
3262
3265
|
for (const f of /* @__PURE__ */ new Set([d, document.documentElement]))
|
|
3263
3266
|
f && St.observe(f, { attributes: !0, attributeFilter: ["data-ui-color-scheme", "data-ui-density", "style", "class"] });
|
|
3264
3267
|
}
|
|
3265
|
-
yt = typeof matchMedia == "function" ? matchMedia("(prefers-color-scheme: dark)") : null, yt?.addEventListener?.("change", xe), We = typeof matchMedia == "function" ? matchMedia("(pointer: coarse)") : null, y.value = !!We?.matches, We?.addEventListener?.("change",
|
|
3266
|
-
}),
|
|
3267
|
-
|
|
3268
|
+
yt = typeof matchMedia == "function" ? matchMedia("(prefers-color-scheme: dark)") : null, yt?.addEventListener?.("change", xe), We = typeof matchMedia == "function" ? matchMedia("(pointer: coarse)") : null, y.value = !!We?.matches, We?.addEventListener?.("change", rn), fe();
|
|
3269
|
+
}), ii(() => {
|
|
3270
|
+
F && cancelAnimationFrame(F), be && clearTimeout(be), vt?.disconnect(), St?.disconnect(), yt?.removeEventListener?.("change", xe), We?.removeEventListener?.("change", rn), te && clearTimeout(te.timer), re && clearTimeout(re), A.dispose(), pe && clearTimeout(pe), sn(), q = null;
|
|
3268
3271
|
});
|
|
3269
|
-
const j = U(() => p.value.activeCell),
|
|
3272
|
+
const j = U(() => p.value.activeCell), Xo = U(() => j.value ? o.columns[j.value[0]] : void 0), Yo = U(() => {
|
|
3270
3273
|
const d = j.value;
|
|
3271
3274
|
return d ? o.getRowLabel?.(d[1]) ?? String(d[1] + 1) : "";
|
|
3272
|
-
}),
|
|
3275
|
+
}), jo = U(() => j.value && o.rowCount > 0 ? o.getCellText(j.value) : ""), cn = (d) => `${r}-col-${d}`, Qo = U(() => j.value ? `${cn(j.value[0])} ${r}-rowheader ${r}-cell` : `${r}-label`), un = (d) => A.getCellRect(d), Q = U(() => L.state.value), dn = U(() => Q.value.active && Q.value.mode === "edit" && Q.value.kind === "long-text" && !!o.editHint), nt = U(() => ({
|
|
3273
3276
|
open: Q.value.active,
|
|
3274
3277
|
kind: Q.value.kind,
|
|
3275
3278
|
view: Q.value.mode === "view",
|
|
3276
3279
|
invalid: !!Q.value.error,
|
|
3277
|
-
hint:
|
|
3280
|
+
hint: dn.value,
|
|
3278
3281
|
rowHeight: P.value,
|
|
3279
|
-
lines:
|
|
3282
|
+
lines: L.lines.value,
|
|
3280
3283
|
theme: C.value,
|
|
3281
3284
|
dangerColor: I,
|
|
3282
3285
|
textBox: k.value
|
|
3283
|
-
})),
|
|
3286
|
+
})), Zo = U(() => ja(nt.value)), hn = U(() => Q.value.active ? Ro(nt.value) : P.value), ot = U(() => {
|
|
3284
3287
|
if (R.value, Q.value.active) return Q.value.error;
|
|
3285
3288
|
const d = p.value.activeCell, f = d && o.cellStatus ? o.cellStatus(d) : null;
|
|
3286
3289
|
return f?.state === "error" ? f.message : null;
|
|
@@ -3288,7 +3291,7 @@ const Ms = () => {
|
|
|
3288
3291
|
return t({
|
|
3289
3292
|
focus: Se,
|
|
3290
3293
|
focusOwner: () => m.value ?? null,
|
|
3291
|
-
getCellRect:
|
|
3294
|
+
getCellRect: un,
|
|
3292
3295
|
scrollToCell: (d) => A.scrollToCell(d),
|
|
3293
3296
|
getSelection: () => A.getSelection(),
|
|
3294
3297
|
setSelection: (d) => A.setSelection(d),
|
|
@@ -3296,11 +3299,11 @@ const Ms = () => {
|
|
|
3296
3299
|
R.value++, A.invalidate();
|
|
3297
3300
|
},
|
|
3298
3301
|
refreshTheme: xe,
|
|
3299
|
-
isEditing: () =>
|
|
3300
|
-
commitEdit: () => !
|
|
3301
|
-
cancelEdit: () =>
|
|
3302
|
-
copy: (d = !1) =>
|
|
3303
|
-
paste: (d) =>
|
|
3302
|
+
isEditing: () => L.active,
|
|
3303
|
+
commitEdit: () => !L.active || L.commit("selection"),
|
|
3304
|
+
cancelEdit: () => L.cancel(),
|
|
3305
|
+
copy: (d = !1) => nn(d),
|
|
3306
|
+
paste: (d) => an(d)
|
|
3304
3307
|
}), (d, f) => (Ce(), we("div", {
|
|
3305
3308
|
ref_key: "root",
|
|
3306
3309
|
ref: l,
|
|
@@ -3314,12 +3317,12 @@ const Ms = () => {
|
|
|
3314
3317
|
"data-ui-grid-skeleton": v.value && e.loading && e.rowCount === 0 ? "" : void 0,
|
|
3315
3318
|
"aria-multiselectable": "true",
|
|
3316
3319
|
style: { position: "relative", overflow: "hidden", width: "100%", height: "100%", "min-height": "0", background: "var(--ui-surface)", contain: "strict", isolation: "isolate" },
|
|
3317
|
-
onPaste:
|
|
3320
|
+
onPaste: Ko
|
|
3318
3321
|
}, [
|
|
3319
3322
|
ne("span", {
|
|
3320
3323
|
id: `${ee(r)}-label`,
|
|
3321
3324
|
class: "sr-only"
|
|
3322
|
-
}, ve(e.label), 9,
|
|
3325
|
+
}, ve(e.label), 9, Ds),
|
|
3323
3326
|
ne("canvas", {
|
|
3324
3327
|
ref_key: "canvas",
|
|
3325
3328
|
ref: c,
|
|
@@ -3332,32 +3335,32 @@ const Ms = () => {
|
|
|
3332
3335
|
"data-ui-grid-scroller": "",
|
|
3333
3336
|
"aria-hidden": "true",
|
|
3334
3337
|
style: { position: "absolute", inset: "0", overflow: "auto", "overscroll-behavior": "contain", "z-index": "1", "touch-action": "pan-x pan-y", "-webkit-overflow-scrolling": "touch", "-webkit-touch-callout": "none", "-webkit-user-select": "none", "user-select": "none", "-webkit-tap-highlight-color": "transparent" },
|
|
3335
|
-
onScrollPassive:
|
|
3336
|
-
onPointerdown:
|
|
3337
|
-
onPointermove:
|
|
3338
|
-
onPointerup:
|
|
3339
|
-
onPointercancel:
|
|
3340
|
-
onLostpointercapture:
|
|
3341
|
-
onPointerleave:
|
|
3342
|
-
onDblclick:
|
|
3343
|
-
onContextmenu:
|
|
3338
|
+
onScrollPassive: Oo,
|
|
3339
|
+
onPointerdown: No,
|
|
3340
|
+
onPointermove: Fo,
|
|
3341
|
+
onPointerup: Lo,
|
|
3342
|
+
onPointercancel: en,
|
|
3343
|
+
onLostpointercapture: en,
|
|
3344
|
+
onPointerleave: Do,
|
|
3345
|
+
onDblclick: Wo,
|
|
3346
|
+
onContextmenu: Bo
|
|
3344
3347
|
}, [
|
|
3345
3348
|
ne("div", {
|
|
3346
3349
|
style: Be({ width: `${w.value.width}px`, height: `${w.value.height}px` })
|
|
3347
3350
|
}, null, 4)
|
|
3348
3351
|
], 544),
|
|
3349
|
-
ne("div",
|
|
3350
|
-
ne("div",
|
|
3351
|
-
(Ce(!0), we(
|
|
3352
|
-
id:
|
|
3352
|
+
ne("div", Ws, [
|
|
3353
|
+
ne("div", Bs, [
|
|
3354
|
+
(Ce(!0), we(ai, null, si(e.columns, (x, T) => (Ce(), we("span", {
|
|
3355
|
+
id: cn(T),
|
|
3353
3356
|
key: x.id,
|
|
3354
3357
|
role: "columnheader",
|
|
3355
3358
|
class: "sr-only",
|
|
3356
3359
|
"aria-colindex": T + 1
|
|
3357
|
-
}, ve(x.name), 9,
|
|
3360
|
+
}, ve(x.name), 9, Os))), 128))
|
|
3358
3361
|
])
|
|
3359
3362
|
]),
|
|
3360
|
-
ne("div",
|
|
3363
|
+
ne("div", Vs, [
|
|
3361
3364
|
ne("div", {
|
|
3362
3365
|
role: "row",
|
|
3363
3366
|
"aria-rowindex": j.value ? j.value[1] + 2 : 2,
|
|
@@ -3367,27 +3370,27 @@ const Ms = () => {
|
|
|
3367
3370
|
id: `${ee(r)}-rowheader`,
|
|
3368
3371
|
role: "rowheader",
|
|
3369
3372
|
class: "sr-only"
|
|
3370
|
-
}, ve(
|
|
3373
|
+
}, ve(Yo.value), 9, Us),
|
|
3371
3374
|
ne("div", {
|
|
3372
3375
|
ref_key: "focusCell",
|
|
3373
3376
|
ref: h,
|
|
3374
3377
|
role: "gridcell",
|
|
3375
3378
|
"aria-colindex": j.value ? j.value[0] + 1 : 1,
|
|
3376
3379
|
"aria-selected": j.value ? "true" : void 0,
|
|
3377
|
-
"aria-readonly": e.readonly ||
|
|
3380
|
+
"aria-readonly": e.readonly || Xo.value?.readonly ? "true" : void 0,
|
|
3378
3381
|
"data-ui-grid-focus-cell": "",
|
|
3379
3382
|
style: { position: "absolute", top: "0", left: "0", width: "0", height: "0", transform: "translate(-10000px, 0)", "z-index": "2", "pointer-events": "none" }
|
|
3380
3383
|
}, [
|
|
3381
3384
|
ne("span", {
|
|
3382
3385
|
id: `${ee(r)}-cell`,
|
|
3383
3386
|
class: "sr-only"
|
|
3384
|
-
}, ve(
|
|
3387
|
+
}, ve(jo.value), 9, _s),
|
|
3385
3388
|
ne("textarea", {
|
|
3386
3389
|
ref_key: "focusOwner",
|
|
3387
3390
|
ref: m,
|
|
3388
3391
|
"data-ui-grid-focus-owner": "",
|
|
3389
3392
|
"data-ui-grid-editing": Q.value.active ? Q.value.mode : void 0,
|
|
3390
|
-
"aria-labelledby":
|
|
3393
|
+
"aria-labelledby": Qo.value,
|
|
3391
3394
|
"aria-invalid": ot.value ? "true" : void 0,
|
|
3392
3395
|
"aria-describedby": ot.value ? `${ee(r)}-message` : void 0,
|
|
3393
3396
|
readonly: Q.value.active && Q.value.mode === "view" ? !0 : void 0,
|
|
@@ -3395,49 +3398,49 @@ const Ms = () => {
|
|
|
3395
3398
|
autocapitalize: "off",
|
|
3396
3399
|
spellcheck: "false",
|
|
3397
3400
|
rows: "1",
|
|
3398
|
-
style: Be(
|
|
3399
|
-
onKeydown:
|
|
3400
|
-
onCompositionstart:
|
|
3401
|
-
onCompositionend:
|
|
3402
|
-
onInput: f[0] || (f[0] = (x) => ee(
|
|
3403
|
-
onBlur: f[1] || (f[1] = (x) => ee(
|
|
3404
|
-
onCopy: f[2] || (f[2] = (x) =>
|
|
3405
|
-
onCut: f[3] || (f[3] = (x) =>
|
|
3406
|
-
}, null, 44,
|
|
3407
|
-
|
|
3401
|
+
style: Be(Zo.value),
|
|
3402
|
+
onKeydown: Vo,
|
|
3403
|
+
onCompositionstart: $o,
|
|
3404
|
+
onCompositionend: qo,
|
|
3405
|
+
onInput: f[0] || (f[0] = (x) => ee(L).input()),
|
|
3406
|
+
onBlur: f[1] || (f[1] = (x) => ee(L).blur()),
|
|
3407
|
+
onCopy: f[2] || (f[2] = (x) => on(x, !1)),
|
|
3408
|
+
onCut: f[3] || (f[3] = (x) => on(x, !0))
|
|
3409
|
+
}, null, 44, $s),
|
|
3410
|
+
dn.value ? (Ce(), we("span", {
|
|
3408
3411
|
key: 0,
|
|
3409
3412
|
"data-ui-grid-edit-hint": "",
|
|
3410
3413
|
"aria-hidden": "true",
|
|
3411
|
-
style: Be({ ...ee(
|
|
3414
|
+
style: Be({ ...ee(Qa)(nt.value), top: `${hn.value - ee(ut)}px` })
|
|
3412
3415
|
}, ve(e.editHint), 5)) : Oe("", !0),
|
|
3413
3416
|
ot.value ? (Ce(), we("div", {
|
|
3414
3417
|
key: 1,
|
|
3415
3418
|
id: `${ee(r)}-message`,
|
|
3416
3419
|
"data-ui-grid-edit-message": "",
|
|
3417
|
-
style: Be({ ...ee(
|
|
3418
|
-
}, ve(ot.value), 13,
|
|
3419
|
-
], 8,
|
|
3420
|
-
], 8,
|
|
3420
|
+
style: Be({ ...ee(Za)(nt.value), top: `${hn.value + 4}px` })
|
|
3421
|
+
}, ve(ot.value), 13, qs)) : Oe("", !0)
|
|
3422
|
+
], 8, Ks)
|
|
3423
|
+
], 8, Gs)
|
|
3421
3424
|
]),
|
|
3422
3425
|
z.value ? (Ce(), we("div", {
|
|
3423
3426
|
key: 0,
|
|
3424
3427
|
"data-ui-grid-empty": "",
|
|
3425
3428
|
style: Be([{ top: `${M.value}px` }, { position: "absolute", left: "0", right: "0", bottom: "0", display: "flex", "align-items": "center", "justify-content": "center", overflow: "hidden", color: "var(--ui-text-muted)", "font-size": "var(--ui-font-size)", "pointer-events": "none", "z-index": "1" }])
|
|
3426
3429
|
}, [
|
|
3427
|
-
|
|
3428
|
-
|
|
3430
|
+
gn(d.$slots, "empty", {}, () => [
|
|
3431
|
+
ri(ve(ee(s)("No data")), 1)
|
|
3429
3432
|
])
|
|
3430
3433
|
], 4)) : Oe("", !0),
|
|
3431
|
-
e.loading ? (Ce(), we("span",
|
|
3432
|
-
d.$slots.overlay ? (Ce(), we("div",
|
|
3433
|
-
|
|
3434
|
+
e.loading ? (Ce(), we("span", Xs, ve(ee(s)("Loading")), 1)) : Oe("", !0),
|
|
3435
|
+
d.$slots.overlay ? (Ce(), we("div", Ys, [
|
|
3436
|
+
gn(d.$slots, "overlay", {
|
|
3434
3437
|
activeCell: j.value,
|
|
3435
|
-
getCellRect:
|
|
3438
|
+
getCellRect: un
|
|
3436
3439
|
})
|
|
3437
3440
|
])) : Oe("", !0)
|
|
3438
|
-
], 40,
|
|
3441
|
+
], 40, Ls));
|
|
3439
3442
|
}
|
|
3440
|
-
}),
|
|
3443
|
+
}), nr = (e, t = 500) => {
|
|
3441
3444
|
const n = new dt(t);
|
|
3442
3445
|
let o = !1;
|
|
3443
3446
|
const i = () => {
|
|
@@ -3460,13 +3463,13 @@ const Ms = () => {
|
|
|
3460
3463
|
},
|
|
3461
3464
|
clear: () => n.clear()
|
|
3462
3465
|
};
|
|
3463
|
-
},
|
|
3464
|
-
function
|
|
3466
|
+
}, $n = ["en", "zh-TW", "zh-CN", "ja", "ko", "de", "fr", "es", "it"], or = /* @__PURE__ */ Symbol("syno-pkg-land-ui:locale"), qn = { enu: "en", cht: "zh-TW", chs: "zh-CN", jpn: "ja", krn: "ko", ger: "de", fre: "fr", spn: "es", ita: "it" };
|
|
3467
|
+
function Xn(e) {
|
|
3465
3468
|
if (!e) return;
|
|
3466
3469
|
const n = e.trim().replaceAll("_", "-").toLowerCase();
|
|
3467
|
-
return
|
|
3470
|
+
return qn[n] ? qn[n] : n.startsWith("zh") ? /-(hant|tw|hk|mo)\b/.test(n) ? "zh-TW" : "zh-CN" : $n.find((i) => i.toLowerCase() === n) ?? $n.find((i) => i === n.split("-")[0]);
|
|
3468
3471
|
}
|
|
3469
|
-
function
|
|
3472
|
+
function ir() {
|
|
3470
3473
|
if (typeof window > "u") return "en";
|
|
3471
3474
|
const e = window;
|
|
3472
3475
|
let t;
|
|
@@ -3475,31 +3478,31 @@ function er() {
|
|
|
3475
3478
|
} catch {
|
|
3476
3479
|
t = void 0;
|
|
3477
3480
|
}
|
|
3478
|
-
const n = typeof t == "string" ?
|
|
3481
|
+
const n = typeof t == "string" ? Xn(t) : void 0;
|
|
3479
3482
|
if (n) return n;
|
|
3480
3483
|
const o = typeof navigator > "u" ? [] : navigator.languages?.length ? navigator.languages : [navigator.language];
|
|
3481
3484
|
for (const i of o) {
|
|
3482
|
-
const a =
|
|
3485
|
+
const a = Xn(i);
|
|
3483
3486
|
if (a) return a;
|
|
3484
3487
|
}
|
|
3485
3488
|
return "en";
|
|
3486
3489
|
}
|
|
3487
|
-
function
|
|
3488
|
-
const t =
|
|
3490
|
+
function ar(e) {
|
|
3491
|
+
const t = li(or, null);
|
|
3489
3492
|
let n;
|
|
3490
|
-
return U(() => e() ?? t?.value ?? (n ??=
|
|
3493
|
+
return U(() => e() ?? t?.value ?? (n ??= ir()));
|
|
3491
3494
|
}
|
|
3492
|
-
function
|
|
3495
|
+
function Po(e, t) {
|
|
3493
3496
|
return e.replace(/\{(\w+)\}/g, (n, o) => String(t[o] ?? n));
|
|
3494
3497
|
}
|
|
3495
|
-
const _e = 4, Ie = 6,
|
|
3498
|
+
const _e = 4, Ie = 6, sr = 4, Ae = 4, me = (e, t, n, o = "") => {
|
|
3496
3499
|
const i = `${o ? `${o} ` : ""}${t}px ${n}`;
|
|
3497
3500
|
e.font !== i && (e.font = i);
|
|
3498
|
-
}, Ee = (e, t, n) => $e(e, { text: t, fontSize: n, needRender: !1 }).width,
|
|
3501
|
+
}, Ee = (e, t, n) => $e(e, { text: t, fontSize: n, needRender: !1 }).width, Yn = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null, rr = (e) => {
|
|
3499
3502
|
const t = e.trim();
|
|
3500
3503
|
if (!t) return "";
|
|
3501
|
-
if (
|
|
3502
|
-
for (const { segment: n } of
|
|
3504
|
+
if (Yn)
|
|
3505
|
+
for (const { segment: n } of Yn.segment(t)) return n.toLocaleUpperCase();
|
|
3503
3506
|
return Array.from(t)[0].toLocaleUpperCase();
|
|
3504
3507
|
}, ge = (e, t, n, o = {}) => {
|
|
3505
3508
|
if (!n) return 0;
|
|
@@ -3515,9 +3518,9 @@ const _e = 4, Ie = 6, nr = 4, Ae = 4, me = (e, t, n, o = "") => {
|
|
|
3515
3518
|
fontSize: s,
|
|
3516
3519
|
textAlign: o.align ?? "left"
|
|
3517
3520
|
}).width;
|
|
3518
|
-
},
|
|
3521
|
+
}, zo = (e, t, n, o, i) => {
|
|
3519
3522
|
const { metrics: a, theme: s } = t;
|
|
3520
|
-
D(e, { ...n, radius:
|
|
3523
|
+
D(e, { ...n, radius: sr, fill: i.fill }), me(e, a.chipFontSize, s.fontFamily), $e(e, {
|
|
3521
3524
|
text: o,
|
|
3522
3525
|
x: n.x + Ie,
|
|
3523
3526
|
y: n.y + (n.height - a.chipFontSize) / 2,
|
|
@@ -3525,7 +3528,7 @@ const _e = 4, Ie = 6, nr = 4, Ae = 4, me = (e, t, n, o = "") => {
|
|
|
3525
3528
|
fill: i.color,
|
|
3526
3529
|
fontSize: a.chipFontSize
|
|
3527
3530
|
});
|
|
3528
|
-
},
|
|
3531
|
+
}, $t = (e, t, n, o) => {
|
|
3529
3532
|
const i = [];
|
|
3530
3533
|
let a = 0;
|
|
3531
3534
|
for (let s = 0; s < e.length; s++) {
|
|
@@ -3542,10 +3545,10 @@ const _e = 4, Ie = 6, nr = 4, Ae = 4, me = (e, t, n, o = "") => {
|
|
|
3542
3545
|
return { widths: i, more: u, badgeWidth: n(u) };
|
|
3543
3546
|
}
|
|
3544
3547
|
return { widths: i, more: 0, badgeWidth: 0 };
|
|
3545
|
-
},
|
|
3548
|
+
}, qt = (e, t, n) => (me(e, t.metrics.chipFontSize, t.theme.fontFamily), Ee(e, `+${n}`, t.metrics.chipFontSize) + 2 * Ie), Xt = (e, t, n, o, i) => {
|
|
3546
3549
|
const { metrics: a, cellTheme: s } = t, r = t.y + (t.height - a.chip) / 2;
|
|
3547
|
-
|
|
3548
|
-
},
|
|
3550
|
+
zo(e, t, { x: n, y: r, width: i, height: a.chip }, `+${o}`, { fill: s.badgeFill, color: s.badgeText });
|
|
3551
|
+
}, lr = (e, t, n, o, i) => {
|
|
3549
3552
|
const a = t + o / 2, s = n + o / 2 + o * 0.04, r = o / 2, l = r * 0.45;
|
|
3550
3553
|
e.beginPath();
|
|
3551
3554
|
for (let c = 0; c < 10; c++) {
|
|
@@ -3553,11 +3556,11 @@ const _e = 4, Ie = 6, nr = 4, Ae = 4, me = (e, t, n, o = "") => {
|
|
|
3553
3556
|
c === 0 ? e.moveTo(m, g) : e.lineTo(m, g);
|
|
3554
3557
|
}
|
|
3555
3558
|
e.closePath(), e.fillStyle = i, e.fill();
|
|
3556
|
-
},
|
|
3559
|
+
}, cr = (e, t, n, o, i) => {
|
|
3557
3560
|
const a = o;
|
|
3558
3561
|
e.save(), e.strokeStyle = i, e.lineWidth = Math.max(1.25, a / 11), e.lineCap = "round", e.lineJoin = "round", e.beginPath(), e.moveTo(t + a * 0.45, n + a * 0.2), e.lineTo(t + a * 0.2, n + a * 0.2), e.lineTo(t + a * 0.2, n + a * 0.8), e.lineTo(t + a * 0.8, n + a * 0.8), e.lineTo(t + a * 0.8, n + a * 0.55), e.moveTo(t + a * 0.55, n + a * 0.2), e.lineTo(t + a * 0.8, n + a * 0.2), e.lineTo(t + a * 0.8, n + a * 0.45), e.moveTo(t + a * 0.8, n + a * 0.2), e.lineTo(t + a * 0.48, n + a * 0.52), e.stroke(), e.restore();
|
|
3559
3562
|
};
|
|
3560
|
-
class
|
|
3563
|
+
class Yt {
|
|
3561
3564
|
cache = new dt(200);
|
|
3562
3565
|
set(t, n) {
|
|
3563
3566
|
this.cache.set(t, n);
|
|
@@ -3569,71 +3572,75 @@ class Xt {
|
|
|
3569
3572
|
this.cache.clear();
|
|
3570
3573
|
}
|
|
3571
3574
|
}
|
|
3572
|
-
const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.y + t.height,
|
|
3575
|
+
const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.y + t.height, ur = { type: "decimal", precision: 2 }, jn = (e, t) => {
|
|
3573
3576
|
if (!Number.isFinite(e) || Math.abs(e) <= Number.MAX_SAFE_INTEGER) return e.toFixed(t);
|
|
3574
3577
|
const n = String(e), o = n.includes("e") ? "" : "0".repeat(t);
|
|
3575
3578
|
return o ? `${n}.${o}` : n;
|
|
3576
|
-
},
|
|
3579
|
+
}, Qn = /* @__PURE__ */ new Map(), dr = (e, t) => {
|
|
3580
|
+
const n = `${e}|${t}`;
|
|
3581
|
+
let o = Qn.get(n);
|
|
3582
|
+
return o || (o = new Intl.NumberFormat(e, { minimumFractionDigits: t, maximumFractionDigits: t }), Qn.set(n, o)), o;
|
|
3583
|
+
}, hr = (e, t = ur, n = "en-US") => {
|
|
3577
3584
|
if (e == null) return "";
|
|
3578
3585
|
const o = Number(e), i = t.precision ?? 2;
|
|
3579
3586
|
if (t.type === "currency") {
|
|
3580
|
-
const a = t.symbol ?? "$", s = o < 0 ? "-" : "", r = Math.abs(o)
|
|
3587
|
+
const a = t.symbol ?? "$", s = o < 0 ? "-" : "", r = dr(n, i).format(Math.abs(o));
|
|
3581
3588
|
return s + a + r;
|
|
3582
3589
|
}
|
|
3583
|
-
return t.type === "percent" ? `${
|
|
3584
|
-
},
|
|
3590
|
+
return t.type === "percent" ? `${jn(o * 100, i)}%` : jn(o, i);
|
|
3591
|
+
}, Gr = (e, t) => {
|
|
3585
3592
|
if (e == null || e === "") return null;
|
|
3586
3593
|
const n = String(e), o = t?.type === "percent" || n.includes("%"), i = n.replace(/[^\d.+-]/g, "").replace(/([+\-.])+/g, "$1"), a = Number.parseFloat(i);
|
|
3587
3594
|
return Number.isNaN(a) ? null : o ? a / 100 : a;
|
|
3588
|
-
}, mt = (e) => e.map(String).filter(Boolean).join(", "),
|
|
3595
|
+
}, mt = (e) => e.map(String).filter(Boolean).join(", "), mr = (e, t) => {
|
|
3589
3596
|
const n = t.chips[e.tone ?? "neutral"] ?? t.chips.neutral;
|
|
3590
3597
|
return { fill: e.fill ?? n.fill, color: e.color ?? n.color };
|
|
3591
|
-
}, gt = (e) => Math.max(0, e.width - 2 * e.metrics.padding),
|
|
3598
|
+
}, gt = (e) => Math.max(0, e.width - 2 * e.metrics.padding), gr = {
|
|
3592
3599
|
draw: (e, t, n) => {
|
|
3593
3600
|
ge(e, t, n.text);
|
|
3594
3601
|
},
|
|
3595
3602
|
describe: (e) => e.text
|
|
3596
|
-
},
|
|
3603
|
+
}, fr = {
|
|
3597
3604
|
draw: (e, t, n) => {
|
|
3598
3605
|
ge(e, t, n.text.replace(/\s*\n\s*/g, " "));
|
|
3599
3606
|
},
|
|
3600
3607
|
describe: (e) => e.text
|
|
3601
|
-
},
|
|
3608
|
+
}, pr = {
|
|
3602
3609
|
draw: (e, t, n) => {
|
|
3603
3610
|
ge(e, t, n.text);
|
|
3604
3611
|
},
|
|
3605
3612
|
describe: (e) => e.text
|
|
3606
|
-
},
|
|
3613
|
+
}, Cr = {
|
|
3607
3614
|
draw: (e, t, n) => {
|
|
3608
3615
|
ge(e, t, n.text, { color: t.cellTheme.textMuted, align: n.align === "end" ? "right" : "left" });
|
|
3609
3616
|
},
|
|
3610
3617
|
describe: (e) => e.text
|
|
3611
|
-
},
|
|
3618
|
+
}, Zn = (e, t) => e.text ?? hr(e.value, e.format, t), wr = {
|
|
3612
3619
|
draw: (e, t, n) => {
|
|
3613
|
-
ge(e, t,
|
|
3620
|
+
ge(e, t, Zn(n, t.locale), { align: "right" });
|
|
3614
3621
|
},
|
|
3615
|
-
describe: (e, t) =>
|
|
3616
|
-
},
|
|
3622
|
+
describe: (e, t) => Zn(e, t.locale)
|
|
3623
|
+
}, Jn = (e, t, n) => {
|
|
3617
3624
|
const o = n.icon;
|
|
3618
3625
|
return { x: e - n.padding - o, y: (t - o) / 2, width: o, height: o };
|
|
3619
|
-
},
|
|
3626
|
+
}, vr = {
|
|
3620
3627
|
draw: (e, t, n) => {
|
|
3621
|
-
const { metrics: o, cellTheme: i } = t, a =
|
|
3622
|
-
n.text && (ge(e, t, n.text, { color: i.link, maxWidth: Math.max(0, a.x - Ae - o.padding) }),
|
|
3628
|
+
const { metrics: o, cellTheme: i } = t, a = Jn(t.width, t.height, o);
|
|
3629
|
+
n.text && (ge(e, t, n.text, { color: i.link, maxWidth: Math.max(0, a.x - Ae - o.padding) }), cr(e, t.x + a.x, t.y + a.y, a.width, i.link));
|
|
3623
3630
|
},
|
|
3624
3631
|
describe: (e) => e.text,
|
|
3625
3632
|
hitTest: (e, { point: t, size: n, metrics: o }) => {
|
|
3626
3633
|
if (!e.text || !e.href) return null;
|
|
3627
|
-
const i =
|
|
3634
|
+
const i = Jn(n.width, n.height, o), a = { x: i.x - 4, y: Math.max(0, i.y - 4), width: i.width + 8, height: Math.min(n.height, i.height + 8) };
|
|
3628
3635
|
return Xe(t, a) ? { action: { type: "open-url", href: e.href }, area: a } : null;
|
|
3629
3636
|
}
|
|
3630
|
-
},
|
|
3637
|
+
}, eo = (e, t, n) => {
|
|
3631
3638
|
const o = n.icon;
|
|
3632
3639
|
return { x: e / 2 - o / 2, y: t / 2 - o / 2, width: o, height: o };
|
|
3633
|
-
},
|
|
3640
|
+
}, to = (e) => ({ type: "update", value: !e.value }), Sr = {
|
|
3634
3641
|
draw: (e, t, n) => {
|
|
3635
|
-
const { cellTheme: o, metrics: i } = t, a =
|
|
3636
|
-
|
|
3642
|
+
const { cellTheme: o, metrics: i } = t, a = eo(t.width, t.height, i);
|
|
3643
|
+
Vt(e, {
|
|
3637
3644
|
x: t.x + a.x,
|
|
3638
3645
|
y: t.y + a.y,
|
|
3639
3646
|
size: a.width,
|
|
@@ -3647,22 +3654,22 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3647
3654
|
// The icon box is hit exactly, plus 4 px around it (a 24 px target at 16 px).
|
|
3648
3655
|
hitTest: (e, { point: t, size: n, metrics: o }) => {
|
|
3649
3656
|
if (e.readonly) return null;
|
|
3650
|
-
const i =
|
|
3651
|
-
return Xe(t, a) ? { action:
|
|
3657
|
+
const i = eo(n.width, n.height, o), a = { x: i.x - 4, y: Math.max(0, i.y - 4), width: i.width + 8, height: Math.min(n.height, i.height + 8) };
|
|
3658
|
+
return Xe(t, a) ? { action: to(e), area: a } : null;
|
|
3652
3659
|
},
|
|
3653
|
-
keyAction: (e, t) => !e.readonly && (t === "Enter" || t === " ") ?
|
|
3654
|
-
},
|
|
3660
|
+
keyAction: (e, t) => !e.readonly && (t === "Enter" || t === " ") ? to(e) : null
|
|
3661
|
+
}, Ht = 2, lt = (e) => Math.max(1, Math.min(10, Math.round(e.max ?? 5))), yr = {
|
|
3655
3662
|
draw: (e, t, n) => {
|
|
3656
3663
|
const { metrics: o, cellTheme: i } = t, a = o.icon, s = t.y + (t.height - a) / 2, r = lt(n);
|
|
3657
3664
|
let l = t.x + o.padding;
|
|
3658
|
-
for (let c = 0; c < r && l + a <= t.x + t.width - o.padding +
|
|
3659
|
-
|
|
3665
|
+
for (let c = 0; c < r && l + a <= t.x + t.width - o.padding + Ht; c++)
|
|
3666
|
+
lr(e, l, s, a, n.value > c ? i.ratingOn : i.ratingOff), l += a + Ht;
|
|
3660
3667
|
},
|
|
3661
|
-
describe: (e, { labels: t }) => e.value > 0 ?
|
|
3668
|
+
describe: (e, { labels: t }) => e.value > 0 ? Po(t.rating, { value: e.value, max: lt(e) }) : "",
|
|
3662
3669
|
// Click the n-th star: value n; click the current value again: clear.
|
|
3663
3670
|
hitTest: (e, { point: t, size: n, metrics: o }) => {
|
|
3664
3671
|
if (e.readonly) return null;
|
|
3665
|
-
const i = o.icon +
|
|
3672
|
+
const i = o.icon + Ht, a = lt(e), s = { x: o.padding, y: Math.max(0, n.height / 2 - o.icon), width: a * i, height: Math.min(n.height, 2 * o.icon) };
|
|
3666
3673
|
if (!Xe(t, s)) return null;
|
|
3667
3674
|
const r = Math.min(a, Math.max(1, Math.ceil((t.x - o.padding) / i)));
|
|
3668
3675
|
return { action: { type: "update", value: r !== e.value ? r : null }, area: s };
|
|
@@ -3675,133 +3682,133 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3675
3682
|
const n = Math.min(lt(e), Number(t));
|
|
3676
3683
|
return { type: "update", value: n === 0 || n === e.value ? null : n };
|
|
3677
3684
|
}
|
|
3678
|
-
}, He = (e, t, n) => `${e}|${t.width}|${t.metrics.rowHeight}|${n.join("\0")}`,
|
|
3685
|
+
}, He = (e, t, n) => `${e}|${t.width}|${t.metrics.rowHeight}|${n.join("\0")}`, Dt = new Yt(), Mo = (e, t, n) => {
|
|
3679
3686
|
const { metrics: o, theme: i } = t;
|
|
3680
3687
|
if (!n.length) return [];
|
|
3681
3688
|
me(e, o.chipFontSize, i.fontFamily);
|
|
3682
|
-
const a = n.map((h) => Ee(e, h.label, o.chipFontSize) + 2 * Ie), s = 2 * Ie + Ee(e, "…", o.chipFontSize) + o.chipFontSize, r =
|
|
3689
|
+
const a = n.map((h) => Ee(e, h.label, o.chipFontSize) + 2 * Ie), s = 2 * Ie + Ee(e, "…", o.chipFontSize) + o.chipFontSize, r = $t(a, gt(t), (h) => qt(e, t, h), s), l = t.y + (t.height - o.chip) / 2;
|
|
3683
3690
|
let c = t.x + o.padding;
|
|
3684
3691
|
const u = [];
|
|
3685
3692
|
return r.widths.forEach((h, m) => {
|
|
3686
3693
|
const g = { x: c, y: l, width: h, height: o.chip };
|
|
3687
|
-
|
|
3688
|
-
}), r.more > 0 &&
|
|
3689
|
-
},
|
|
3694
|
+
zo(e, t, g, n[m].label, n[m].colors), u.push({ x: c - t.x, y: l - t.y, width: h, height: o.chip }), c += h + _e;
|
|
3695
|
+
}), r.more > 0 && Xt(e, t, c, r.more, r.badgeWidth), u;
|
|
3696
|
+
}, br = {
|
|
3690
3697
|
draw: (e, t, n) => {
|
|
3691
|
-
|
|
3698
|
+
Mo(e, t, n.options.map((o) => ({ label: o.label, colors: mr(o, t.cellTheme) })));
|
|
3692
3699
|
},
|
|
3693
3700
|
describe: (e) => mt(e.options.map((t) => t.label))
|
|
3694
|
-
},
|
|
3701
|
+
}, xr = {
|
|
3695
3702
|
draw: (e, t, n) => {
|
|
3696
|
-
const o = { fill: t.cellTheme.badgeFill, color: t.cellTheme.text }, i =
|
|
3697
|
-
|
|
3703
|
+
const o = { fill: t.cellTheme.badgeFill, color: t.cellTheme.text }, i = Mo(e, t, n.records.map((a) => ({ label: a.label, colors: o })));
|
|
3704
|
+
Dt.set(He("link", t, n.records.map((a) => a.id)), i);
|
|
3698
3705
|
},
|
|
3699
3706
|
describe: (e) => mt(e.records.map((t) => t.label)),
|
|
3700
|
-
hitTest: (e, t) =>
|
|
3701
|
-
},
|
|
3707
|
+
hitTest: (e, t) => Ao(Dt.get(He("link", jt(t), e.records.map((n) => n.id))), t, (n) => ({ type: "open-record", id: e.records[n].id }))
|
|
3708
|
+
}, jt = (e) => ({ width: e.size.width, metrics: e.metrics }), Ao = (e, t, n, o = !1) => {
|
|
3702
3709
|
if (!t.wasActive && !o || !e) return null;
|
|
3703
3710
|
const i = e.findIndex((a) => Xe(t.point, a));
|
|
3704
3711
|
return i < 0 ? null : { action: n(i), area: e[i] };
|
|
3705
|
-
},
|
|
3712
|
+
}, Rr = (e, t, n, o, i, a, s) => {
|
|
3706
3713
|
const { cellTheme: r, theme: l } = t, c = s ? t.images.get(s) : void 0;
|
|
3707
3714
|
if (e.save(), e.beginPath(), e.arc(n + i / 2, o + i / 2, i / 2, 0, Math.PI * 2), e.closePath(), c)
|
|
3708
3715
|
e.clip(), e.drawImage(c, n, o, i, i);
|
|
3709
3716
|
else {
|
|
3710
3717
|
e.fillStyle = r.avatarFill, e.fill();
|
|
3711
|
-
const u =
|
|
3718
|
+
const u = rr(a);
|
|
3712
3719
|
if (u) {
|
|
3713
3720
|
const h = Math.round(i * 0.55);
|
|
3714
3721
|
me(e, h, l.fontFamily), e.fillStyle = r.avatarText, e.textAlign = "center", e.textBaseline = "middle", e.fillText(u, n + i / 2, o + i / 2 + 0.5);
|
|
3715
3722
|
}
|
|
3716
3723
|
}
|
|
3717
3724
|
e.restore();
|
|
3718
|
-
},
|
|
3725
|
+
}, kr = {
|
|
3719
3726
|
draw: (e, t, n) => {
|
|
3720
3727
|
const { metrics: o, theme: i } = t;
|
|
3721
3728
|
if (!n.people.length) return;
|
|
3722
3729
|
const a = o.chip;
|
|
3723
3730
|
me(e, o.fontSize, i.fontFamily);
|
|
3724
|
-
const s = n.people.map((u) => a + Ae + Ee(e, u.name, o.fontSize) + Ie), r =
|
|
3731
|
+
const s = n.people.map((u) => a + Ae + Ee(e, u.name, o.fontSize) + Ie), r = $t(s, gt(t), (u) => qt(e, t, u), a), l = t.y + (t.height - a) / 2;
|
|
3725
3732
|
let c = t.x + o.padding;
|
|
3726
3733
|
r.widths.forEach((u, h) => {
|
|
3727
3734
|
const m = n.people[h];
|
|
3728
|
-
|
|
3729
|
-
}), r.more > 0 &&
|
|
3735
|
+
Rr(e, t, c, l, a, m.name, m.avatarUrl), u > a + Ae && ge(e, t, m.name, { x: c + a + Ae, maxWidth: u - a - Ae - (h < r.widths.length - 1 || r.more ? Ie : 0) }), c += u + _e;
|
|
3736
|
+
}), r.more > 0 && Xt(e, t, c, r.more, r.badgeWidth);
|
|
3730
3737
|
},
|
|
3731
3738
|
describe: (e) => mt(e.people.map((t) => t.name))
|
|
3732
|
-
},
|
|
3739
|
+
}, no = (e) => {
|
|
3733
3740
|
const t = /\.([\p{L}\p{N}]{1,5})$/u.exec(e);
|
|
3734
3741
|
return t ? t[1].toUpperCase() : "";
|
|
3735
|
-
},
|
|
3742
|
+
}, Wt = new Yt(), Ir = {
|
|
3736
3743
|
draw: (e, t, n) => {
|
|
3737
3744
|
const { metrics: o, cellTheme: i, theme: a } = t;
|
|
3738
3745
|
if (!n.files.length) return;
|
|
3739
3746
|
const s = o.chip, r = Math.max(8, Math.round(s * 0.42));
|
|
3740
3747
|
me(e, r, a.fontFamily, "600");
|
|
3741
|
-
const l = n.files.map((g) => (g.thumbnailUrl ? t.images.get(g.thumbnailUrl) : void 0) ? s : Math.max(s, Ee(e,
|
|
3748
|
+
const l = n.files.map((g) => (g.thumbnailUrl ? t.images.get(g.thumbnailUrl) : void 0) ? s : Math.max(s, Ee(e, no(g.name) || "?", r) + 6)), c = $t(l, gt(t), (g) => qt(e, t, g), s), u = t.y + (t.height - s) / 2;
|
|
3742
3749
|
let h = t.x + o.padding;
|
|
3743
3750
|
const m = [];
|
|
3744
3751
|
c.widths.forEach((g, C) => {
|
|
3745
3752
|
const S = n.files[C], p = S.thumbnailUrl ? t.images.get(S.thumbnailUrl) : void 0;
|
|
3746
|
-
p ? (e.save(), D(e, { x: h, y: u, width: g, height: s, radius: 3 }), e.clip(), e.drawImage(p, h, u, g, s), e.restore(), D(e, { x: h + 0.5, y: u + 0.5, width: g - 1, height: s - 1, radius: 3, stroke: a.cellLineColor })) : (D(e, { x: h, y: u, width: g, height: s, radius: 3, fill: i.badgeFill }), me(e, r, a.fontFamily, "600"), e.fillStyle = i.badgeText, e.textAlign = "center", e.textBaseline = "middle", e.fillText(
|
|
3747
|
-
}), c.more > 0 &&
|
|
3753
|
+
p ? (e.save(), D(e, { x: h, y: u, width: g, height: s, radius: 3 }), e.clip(), e.drawImage(p, h, u, g, s), e.restore(), D(e, { x: h + 0.5, y: u + 0.5, width: g - 1, height: s - 1, radius: 3, stroke: a.cellLineColor })) : (D(e, { x: h, y: u, width: g, height: s, radius: 3, fill: i.badgeFill }), me(e, r, a.fontFamily, "600"), e.fillStyle = i.badgeText, e.textAlign = "center", e.textBaseline = "middle", e.fillText(no(S.name) || "?", h + g / 2, u + s / 2 + 0.5, g - 4)), m.push({ x: h - t.x, y: u - t.y, width: g, height: s }), h += g + _e;
|
|
3754
|
+
}), c.more > 0 && Xt(e, t, h, c.more, c.badgeWidth), Wt.set(He("attachment", t, n.files.map((g) => g.id)), m);
|
|
3748
3755
|
},
|
|
3749
3756
|
describe: (e) => mt(e.files.map((t) => t.name)),
|
|
3750
|
-
hitTest: (e, t) =>
|
|
3751
|
-
},
|
|
3757
|
+
hitTest: (e, t) => Ao(Wt.get(He("attachment", jt(t), e.files.map((n) => n.id))), t, (n) => ({ type: "open-attachment", id: e.files[n].id }), !0)
|
|
3758
|
+
}, oo = (e) => `${Math.round(Math.max(0, Math.min(1, e)) * 100)}%`, Pr = {
|
|
3752
3759
|
draw: (e, t, n) => {
|
|
3753
3760
|
if (n.value == null) return;
|
|
3754
3761
|
const { metrics: o, cellTheme: i } = t, a = o.icon, s = Math.max(0, Math.min(1, n.value)), r = t.x + o.padding + a / 2, l = t.y + t.height / 2, c = a / 2 - 1.25;
|
|
3755
|
-
e.save(), e.lineWidth = 2.5, e.beginPath(), e.arc(r, l, c, 0, Math.PI * 2), e.strokeStyle = i.progressTrack, e.stroke(), s > 0 && (e.beginPath(), e.arc(r, l, c, -Math.PI / 2, -Math.PI / 2 + s * Math.PI * 2), e.strokeStyle = i.progressFill, e.lineCap = s < 1 ? "round" : "butt", e.stroke()), e.restore(), ge(e, t,
|
|
3762
|
+
e.save(), e.lineWidth = 2.5, e.beginPath(), e.arc(r, l, c, 0, Math.PI * 2), e.strokeStyle = i.progressTrack, e.stroke(), s > 0 && (e.beginPath(), e.arc(r, l, c, -Math.PI / 2, -Math.PI / 2 + s * Math.PI * 2), e.strokeStyle = i.progressFill, e.lineCap = s < 1 ? "round" : "butt", e.stroke()), e.restore(), ge(e, t, oo(s), { x: t.x + o.padding + a + Ae + 2 });
|
|
3756
3763
|
},
|
|
3757
|
-
describe: (e) => e.value == null ? "" :
|
|
3758
|
-
},
|
|
3764
|
+
describe: (e) => e.value == null ? "" : oo(e.value)
|
|
3765
|
+
}, Tt = 10, Bt = new Yt(), zr = {
|
|
3759
3766
|
draw: (e, t, n) => {
|
|
3760
3767
|
const { metrics: o, cellTheme: i, theme: a } = t;
|
|
3761
3768
|
if (!n.label) return;
|
|
3762
3769
|
me(e, o.chipFontSize, a.fontFamily);
|
|
3763
|
-
const s = Math.min(gt(t), Ee(e, n.label, o.chipFontSize) + 2 *
|
|
3764
|
-
D(e, { ...r, radius:
|
|
3770
|
+
const s = Math.min(gt(t), Ee(e, n.label, o.chipFontSize) + 2 * Tt), r = { x: t.x + o.padding, y: t.y + (t.height - o.chip) / 2, width: s, height: o.chip };
|
|
3771
|
+
D(e, { ...r, radius: io, fill: i.buttonFill }), D(e, { x: r.x + 0.5, y: r.y + 0.5, width: r.width - 1, height: r.height - 1, radius: io, stroke: i.buttonBorder }), n.disabled && (e.globalAlpha = 0.5), ge(e, t, n.label, { x: r.x + Tt, maxWidth: s - 2 * Tt, color: i.buttonText, fontSize: o.chipFontSize }), e.globalAlpha = 1, Bt.set(He("button", t, [n.label]), [{ x: r.x - t.x, y: r.y - t.y, width: s, height: o.chip }]);
|
|
3765
3772
|
},
|
|
3766
3773
|
describe: (e) => e.label,
|
|
3767
3774
|
hitTest: (e, t) => {
|
|
3768
3775
|
if (e.disabled || !e.label) return null;
|
|
3769
|
-
const n =
|
|
3776
|
+
const n = Bt.get(He("button", jt(t), [e.label]))?.[0];
|
|
3770
3777
|
return n && Xe(t.point, n) ? { action: { type: "press" }, area: n } : null;
|
|
3771
3778
|
},
|
|
3772
3779
|
keyAction: (e, t) => !e.disabled && (t === "Enter" || t === " ") ? { type: "press" } : null
|
|
3773
|
-
},
|
|
3774
|
-
text:
|
|
3775
|
-
longText:
|
|
3776
|
-
number:
|
|
3777
|
-
select:
|
|
3778
|
-
person:
|
|
3779
|
-
date:
|
|
3780
|
-
boolean:
|
|
3781
|
-
rating:
|
|
3782
|
-
url:
|
|
3783
|
-
link:
|
|
3784
|
-
attachment:
|
|
3785
|
-
progress:
|
|
3786
|
-
button:
|
|
3787
|
-
derived:
|
|
3788
|
-
},
|
|
3789
|
-
|
|
3790
|
-
},
|
|
3780
|
+
}, io = 4, Mr = {
|
|
3781
|
+
text: gr,
|
|
3782
|
+
longText: fr,
|
|
3783
|
+
number: wr,
|
|
3784
|
+
select: br,
|
|
3785
|
+
person: kr,
|
|
3786
|
+
date: pr,
|
|
3787
|
+
boolean: Sr,
|
|
3788
|
+
rating: yr,
|
|
3789
|
+
url: vr,
|
|
3790
|
+
link: xr,
|
|
3791
|
+
attachment: Ir,
|
|
3792
|
+
progress: Pr,
|
|
3793
|
+
button: zr,
|
|
3794
|
+
derived: Cr
|
|
3795
|
+
}, Ur = () => {
|
|
3796
|
+
Dt.clear(), Wt.clear(), Bt.clear();
|
|
3797
|
+
}, Ar = 6, Er = (e, t, n, o) => {
|
|
3791
3798
|
if (e.save(), n === "pending") {
|
|
3792
|
-
const i =
|
|
3799
|
+
const i = Ar / 2, a = t.x + t.width - 3 - i, s = t.y + 3 + i;
|
|
3793
3800
|
e.beginPath(), e.arc(a, s, i + 1, 0, Math.PI * 2), e.fillStyle = o.surface, e.fill(), e.beginPath(), e.arc(a, s, i, 0, Math.PI * 2), e.fillStyle = o.pending, e.fill();
|
|
3794
3801
|
} else
|
|
3795
3802
|
e.lineWidth = 2, e.strokeStyle = o.danger, e.strokeRect(t.x + 1, t.y + 1, t.width - 2, t.height - 2);
|
|
3796
3803
|
e.restore();
|
|
3797
|
-
},
|
|
3798
|
-
const t = { ...
|
|
3804
|
+
}, ao = (e, t) => !!e && !!t && e[0] === t[0] && e[1] === t[1], Hr = (e) => {
|
|
3805
|
+
const t = { ...Mr, ...e.renderers }, n = e.locale ?? "en-US";
|
|
3799
3806
|
let o = e.labels, i = e.theme ?? Ue, a = null, s = null;
|
|
3800
|
-
const r =
|
|
3807
|
+
const r = nr(() => e.onImageLoad?.()), l = (p) => ((!s || s.rowHeight !== p.height || s.fontSize !== p.theme.fontSizeSM || s.chipFontSize > p.theme.fontSizeXS) && (s = On(p.height, p.theme.fontSizeSM, p.theme.fontSizeXS)), s), c = (p) => {
|
|
3801
3808
|
if (e.theme || a === p.theme) return;
|
|
3802
3809
|
a = p.theme;
|
|
3803
3810
|
const w = e.themeRoot?.();
|
|
3804
|
-
w && (i =
|
|
3811
|
+
w && (i = ko(w));
|
|
3805
3812
|
}, u = {
|
|
3806
3813
|
draw: (p, w) => {
|
|
3807
3814
|
const v = e.getValue(w.cell);
|
|
@@ -3810,7 +3817,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3810
3817
|
R && (p.save(), p.beginPath(), p.rect(w.x, w.y, w.width, w.height), p.clip(), R.draw(p, { ...w, cellTheme: i, metrics: l(w), images: r, labels: o, locale: n }, v), p.restore());
|
|
3811
3818
|
}
|
|
3812
3819
|
const y = e.getStatus?.(w.cell);
|
|
3813
|
-
y &&
|
|
3820
|
+
y && Er(p, w, y, i);
|
|
3814
3821
|
}
|
|
3815
3822
|
}, h = (p, w) => w?.type === "update" && e.isReadonly?.(p) ? null : w, m = (p) => {
|
|
3816
3823
|
const w = e.getValue(p), v = w ? t[w.kind]?.describe(w, { labels: o, locale: n }) ?? "" : "", y = e.getStatus?.(p);
|
|
@@ -3820,7 +3827,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3820
3827
|
}, g = (p, w, v, y) => {
|
|
3821
3828
|
const R = e.getValue(p), I = R ? t[R.kind] : void 0;
|
|
3822
3829
|
if (!R || !I?.hitTest) return null;
|
|
3823
|
-
const k = I.hitTest(R, { point: w, size: { width: v.width, height: v.height }, metrics:
|
|
3830
|
+
const k = I.hitTest(R, { point: w, size: { width: v.width, height: v.height }, metrics: On(v.height), wasActive: y });
|
|
3824
3831
|
return k && h(p, k.action) ? k : null;
|
|
3825
3832
|
};
|
|
3826
3833
|
return {
|
|
@@ -3842,12 +3849,12 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3842
3849
|
const R = p();
|
|
3843
3850
|
if (!R || y.button !== 0 || y.shiftKey || y.metaKey || y.ctrlKey) return;
|
|
3844
3851
|
const I = R.getSelection(), k = I.activeCell;
|
|
3845
|
-
if (!k || I.kind !== "cells" || !
|
|
3852
|
+
if (!k || I.kind !== "cells" || !ao(I.ranges[0], I.ranges[1])) return;
|
|
3846
3853
|
const P = y.currentTarget?.querySelector("[data-ui-grid]"), M = R.getCellRect(k);
|
|
3847
3854
|
if (!P || !M) return;
|
|
3848
3855
|
const N = P.getBoundingClientRect(), z = { x: y.clientX - N.left - M.x, y: y.clientY - N.top - M.y };
|
|
3849
3856
|
if (z.x < 0 || z.y < 0 || z.x >= M.width || z.y >= M.height) return;
|
|
3850
|
-
const E = g(k, z, M,
|
|
3857
|
+
const E = g(k, z, M, ao(v, k));
|
|
3851
3858
|
E && w(E.action, k);
|
|
3852
3859
|
}
|
|
3853
3860
|
};
|
|
@@ -3860,7 +3867,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3860
3867
|
},
|
|
3861
3868
|
clearImages: () => r.clear()
|
|
3862
3869
|
};
|
|
3863
|
-
},
|
|
3870
|
+
}, Tr = {
|
|
3864
3871
|
"{count} failed": "{count} failed",
|
|
3865
3872
|
"{name} is not a JPEG, PNG, WebP or GIF image": "{name} is not a JPEG, PNG, WebP or GIF image",
|
|
3866
3873
|
"{name}: {kind} images are not supported; on an iPhone, set Settings > Camera > Formats to Most Compatible": "{name}: {kind} images are not supported; on an iPhone, set Settings > Camera > Formats to Most Compatible",
|
|
@@ -4132,8 +4139,8 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
4132
4139
|
"At most {max} tags": "At most {max} tags",
|
|
4133
4140
|
"Expand all": "Expand all",
|
|
4134
4141
|
"Collapse all": "Collapse all"
|
|
4135
|
-
},
|
|
4136
|
-
en:
|
|
4142
|
+
}, Nr = {
|
|
4143
|
+
en: Tr,
|
|
4137
4144
|
"zh-TW": {
|
|
4138
4145
|
"{count} failed": "{count} 個失敗",
|
|
4139
4146
|
"{name} is not a JPEG, PNG, WebP or GIF image": "{name} 不是 JPEG、PNG、WebP 或 GIF 圖片",
|
|
@@ -6319,27 +6326,27 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
6319
6326
|
"Collapse all": "Comprimi tutto"
|
|
6320
6327
|
}
|
|
6321
6328
|
};
|
|
6322
|
-
function
|
|
6323
|
-
return
|
|
6329
|
+
function Fr(e, t, n = {}) {
|
|
6330
|
+
return Po(Nr[e][t], n);
|
|
6324
6331
|
}
|
|
6325
|
-
function
|
|
6326
|
-
const e =
|
|
6332
|
+
function Lr() {
|
|
6333
|
+
const e = ar(() => {
|
|
6327
6334
|
});
|
|
6328
|
-
return (t, n) =>
|
|
6335
|
+
return (t, n) => Fr(e.value, t, n);
|
|
6329
6336
|
}
|
|
6330
|
-
const
|
|
6331
|
-
const t =
|
|
6337
|
+
const Kr = (e) => {
|
|
6338
|
+
const t = Lr(), n = U(() => ({
|
|
6332
6339
|
checked: t("Checked"),
|
|
6333
6340
|
unchecked: t("Not checked"),
|
|
6334
6341
|
rating: t("Rating {value} of {max}", { value: "{value}", max: "{max}" }),
|
|
6335
6342
|
saving: t("Saving"),
|
|
6336
6343
|
failed: t("Not saved"),
|
|
6337
6344
|
...e.labels
|
|
6338
|
-
})), o =
|
|
6345
|
+
})), o = Hr({ ...e, labels: n.value });
|
|
6339
6346
|
return de(n, (i) => o.setLabels(i)), o;
|
|
6340
|
-
},
|
|
6341
|
-
function
|
|
6342
|
-
const t = e.delayMs ??
|
|
6347
|
+
}, Dr = 300;
|
|
6348
|
+
function _r(e) {
|
|
6349
|
+
const t = e.delayMs ?? Dr, n = e.setTimer ?? ((c, u) => setTimeout(c, u)), o = e.clearTimer ?? ((c) => clearTimeout(c)), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
6343
6350
|
let s = 0;
|
|
6344
6351
|
const r = (c, u) => {
|
|
6345
6352
|
const h = i.get(c);
|
|
@@ -6376,39 +6383,39 @@ function Or(e) {
|
|
|
6376
6383
|
}
|
|
6377
6384
|
};
|
|
6378
6385
|
}
|
|
6379
|
-
function
|
|
6386
|
+
function $r(e) {
|
|
6380
6387
|
return e ? e.state === "saving" ? "pending" : "error" : null;
|
|
6381
6388
|
}
|
|
6382
6389
|
export {
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6390
|
+
ns as GRID_CELL_TOKENS,
|
|
6391
|
+
os as GRID_CHIP_TOKENS,
|
|
6392
|
+
Vr as GridHost,
|
|
6393
|
+
Dr as SAVING_MARK_DELAY_MS,
|
|
6394
|
+
Na as blockCellCount,
|
|
6395
|
+
Fa as buildPasteProposal,
|
|
6389
6396
|
qe as cellRange,
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
+
$r as cellStatusMark,
|
|
6398
|
+
Ur as clearGridCellRegions,
|
|
6399
|
+
_r as createCellStatusStore,
|
|
6400
|
+
is as createGridCellTheme,
|
|
6401
|
+
Hr as createGridCells,
|
|
6402
|
+
nr as createGridImageCache,
|
|
6403
|
+
Mr as defaultGridCellRenderers,
|
|
6397
6404
|
Ue as defaultGridCellTheme,
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6405
|
+
Er as drawGridCellStatus,
|
|
6406
|
+
Or as fillSeries,
|
|
6407
|
+
Ss as filledRange,
|
|
6408
|
+
hr as formatGridNumber,
|
|
6409
|
+
On as gridCellMetrics,
|
|
6410
|
+
Gr as parseGridNumber,
|
|
6411
|
+
ka as parseTsv,
|
|
6412
|
+
vs as planFill,
|
|
6413
|
+
ko as readGridCellTheme,
|
|
6414
|
+
yo as selectionBlock,
|
|
6415
|
+
Ta as selectionStart,
|
|
6416
|
+
za as toHtmlTable,
|
|
6417
|
+
Ra as toTsv,
|
|
6418
|
+
Kr as useGridCells,
|
|
6419
|
+
Ea as writeClipboardAsync,
|
|
6420
|
+
Ma as writeClipboardEvent
|
|
6414
6421
|
};
|