@synopackageland/ui 0.25.16 → 0.25.18
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 +34 -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/host/controller.d.ts +9 -0
- package/dist/grid-core/config.d.ts +1 -0
- package/dist/grid-core/renderer/layout.d.ts +5 -0
- package/dist/grid.js +1327 -1305
- package/dist/index.js +3966 -3940
- package/dist/json-preview/preview.js +3392 -3367
- 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/ux-grid.md +23 -1
- package/package.json +1 -97
package/dist/grid.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
|
|
3
|
-
import { useUiText as
|
|
4
|
-
var H = /* @__PURE__ */ ((e) => (e.Rows = "Rows", e.Columns = "Columns", e.Cells = "Cells", e.None = "None", e))(H || {}),
|
|
5
|
-
const
|
|
6
|
-
var
|
|
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
|
+
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 Ot = (e) => ({ type: 1, displayIndex: e + 1, realIndex: e }), lo = (e) => e;
|
|
6
|
+
var Z = /* @__PURE__ */ ((e) => (e.Row = "Row", e.Column = "Column", e))(Z || {});
|
|
7
7
|
const B = {
|
|
8
8
|
rowHeight: 32,
|
|
9
9
|
rowHeadWidth: 70,
|
|
@@ -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,
|
|
@@ -33,25 +34,25 @@ const B = {
|
|
|
33
34
|
y: 0,
|
|
34
35
|
rowIndex: -1 / 0,
|
|
35
36
|
columnIndex: -1 / 0,
|
|
36
|
-
type:
|
|
37
|
+
type: b.None,
|
|
37
38
|
isOutOfBounds: !0
|
|
38
|
-
},
|
|
39
|
+
}, kt = {
|
|
39
40
|
columnIndex: -1,
|
|
40
41
|
width: 0,
|
|
41
42
|
x: 0
|
|
42
|
-
},
|
|
43
|
+
}, It = {
|
|
43
44
|
type: O.None,
|
|
44
45
|
ranges: [],
|
|
45
46
|
delta: 0,
|
|
46
47
|
isDragging: !1
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
}, ui = /* @__PURE__ */ new Set([
|
|
49
|
+
b.Cell,
|
|
50
|
+
b.RowHeader,
|
|
51
|
+
b.RowHeaderCheckbox,
|
|
52
|
+
b.RowHeaderDragHandler,
|
|
53
|
+
b.RowHeaderExpandHandler
|
|
53
54
|
]);
|
|
54
|
-
class
|
|
55
|
+
class dt {
|
|
55
56
|
map = /* @__PURE__ */ new Map();
|
|
56
57
|
max;
|
|
57
58
|
constructor(t) {
|
|
@@ -73,180 +74,180 @@ class ct {
|
|
|
73
74
|
this.map.clear();
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
|
-
const
|
|
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
|
-
const
|
|
85
|
-
if (i +
|
|
86
|
-
o += r, i +=
|
|
84
|
+
for (const { segment: r } of Nt.segment(a)) {
|
|
85
|
+
const l = e.measureText(r).width;
|
|
86
|
+
if (i + l > n) break;
|
|
87
|
+
o += r, i += l;
|
|
87
88
|
}
|
|
88
89
|
break;
|
|
89
90
|
}
|
|
90
91
|
o += a, i += s;
|
|
91
92
|
}
|
|
92
93
|
return { text: o, width: i };
|
|
93
|
-
},
|
|
94
|
-
const { x: n = 0, y: o = 0, text: i, maxWidth: a, maxLines: s, isUnderline: r, fontSize:
|
|
94
|
+
}, di = (e, t) => {
|
|
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
|
-
const S = e.measureText(
|
|
97
|
+
const S = e.measureText(ct).width;
|
|
97
98
|
let p = "", w = 0, v = 0;
|
|
98
|
-
const y = `${e.font}-${i}-${
|
|
99
|
+
const y = `${e.font}-${i}-${l}-${a}-${s}`, R = pn.get(y);
|
|
99
100
|
if (R)
|
|
100
101
|
C = R;
|
|
101
102
|
else {
|
|
102
103
|
let I = 0;
|
|
103
|
-
const k = (
|
|
104
|
-
C.push({ text:
|
|
105
|
-
}, P = (
|
|
106
|
-
p === "" && (v =
|
|
107
|
-
},
|
|
108
|
-
const
|
|
109
|
-
if (w >
|
|
110
|
-
const
|
|
111
|
-
p =
|
|
112
|
-
} else if (
|
|
113
|
-
let
|
|
114
|
-
for (const { segment:
|
|
115
|
-
const
|
|
116
|
-
if (w +
|
|
117
|
-
P(
|
|
104
|
+
const k = (z, E) => {
|
|
105
|
+
C.push({ text: z, width: E, start: v });
|
|
106
|
+
}, P = (z, E, W) => {
|
|
107
|
+
p === "" && (v = W), p += z, w += E;
|
|
108
|
+
}, M = (z, E = 0) => {
|
|
109
|
+
const W = a - S;
|
|
110
|
+
if (w > W) {
|
|
111
|
+
const F = mo(e, p, W);
|
|
112
|
+
p = F.text, w = F.width;
|
|
113
|
+
} else if (z) {
|
|
114
|
+
let F = E;
|
|
115
|
+
for (const { segment: _ } of Nt.segment(z)) {
|
|
116
|
+
const q = e.measureText(_).width;
|
|
117
|
+
if (w + q > W) break;
|
|
118
|
+
P(_, q, F), F += _.length;
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
|
-
k(p +
|
|
121
|
-
},
|
|
121
|
+
k(p + ct, w + S), p = "", w = 0;
|
|
122
|
+
}, N = (z, E, W) => {
|
|
122
123
|
if (w + E <= a) {
|
|
123
|
-
P(
|
|
124
|
+
P(z, E, W);
|
|
124
125
|
return;
|
|
125
126
|
}
|
|
126
127
|
if (E <= a) {
|
|
127
|
-
C.length < s - 1 ? (k(p, w), p = "", w = 0, P(
|
|
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:
|
|
131
|
+
let F = W;
|
|
132
|
+
for (const { segment: _ } of Nt.segment(z)) {
|
|
132
133
|
if (C.length >= s) break;
|
|
133
|
-
const
|
|
134
|
-
w +
|
|
134
|
+
const q = e.measureText(_).width;
|
|
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:
|
|
138
|
+
for (const { segment: z } of ho.segment(i)) {
|
|
138
139
|
if (C.length >= s) break;
|
|
139
|
-
if (
|
|
140
|
+
if (z.includes(`
|
|
140
141
|
`)) {
|
|
141
|
-
const E =
|
|
142
|
+
const E = z.split(`
|
|
142
143
|
`);
|
|
143
|
-
for (let
|
|
144
|
-
if (
|
|
144
|
+
for (let W = 0; W < E.length && !(C.length >= s); W++) {
|
|
145
|
+
if (W > 0) {
|
|
145
146
|
if (I++, C.length + 1 === s && I < i.length) {
|
|
146
|
-
|
|
147
|
+
M();
|
|
147
148
|
break;
|
|
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
|
-
I +=
|
|
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
|
-
const I = m === "middle" ?
|
|
162
|
+
const I = m === "middle" ? l / 2 : 0;
|
|
162
163
|
u && (e.fillStyle = u, e.strokeStyle = u), e.textAlign = h, e.textBaseline = m;
|
|
163
164
|
for (let k = 0; k < C.length; k++) {
|
|
164
165
|
const P = C[k];
|
|
165
|
-
if (e.fillText(P.text, n, o + k *
|
|
166
|
-
const
|
|
167
|
-
e.beginPath(), e.moveTo(n, o + k *
|
|
166
|
+
if (e.fillText(P.text, n, o + k * c + I), r) {
|
|
167
|
+
const M = e.measureText(P.text).width;
|
|
168
|
+
e.beginPath(), e.moveTo(n, o + k * c + l - 1), e.lineTo(n + M, o + k * c + l - 1), e.stroke();
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
172
|
return C;
|
|
172
173
|
}, $e = (e, t) => {
|
|
173
|
-
const { x: n = 0, y: o = 0, text: i, fill: a, fontSize: s = 13, textAlign: r = "left", verticalAlign:
|
|
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}-${
|
|
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 {
|
|
179
180
|
const p = e.measureText(i).width;
|
|
180
|
-
if (p <=
|
|
181
|
+
if (p <= c)
|
|
181
182
|
g = i, m = p;
|
|
182
183
|
else {
|
|
183
|
-
const w = e.measureText(
|
|
184
|
-
g = v.text +
|
|
184
|
+
const w = e.measureText(ct).width, v = mo(e, i, c - w);
|
|
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
|
-
const p =
|
|
190
|
-
a && (e.fillStyle = a, e.strokeStyle = a), e.textAlign = r, e.textBaseline =
|
|
190
|
+
const p = l === "middle" ? s / 2 : 0, w = r === "right" ? n + c : n;
|
|
191
|
+
a && (e.fillStyle = a, e.strokeStyle = a), e.textAlign = r, e.textBaseline = l, e.fillText(g, w, o + p), h && (e.beginPath(), e.moveTo(w, o + p + s / 2 - 1), e.lineTo(w + m, o + p + s / 2 - 1), e.stroke());
|
|
191
192
|
}
|
|
192
193
|
return { text: g, width: m };
|
|
193
194
|
}, Ke = (e, t) => {
|
|
194
195
|
const { x: n, y: o, points: i, stroke: a, lineWidth: s = 1, closed: r = !1 } = t;
|
|
195
196
|
e.save(), e.beginPath(), a && (e.strokeStyle = a), e.lineWidth = s, e.lineJoin = "round", e.translate(n, o), e.moveTo(i[0], i[1]);
|
|
196
|
-
for (let
|
|
197
|
+
for (let l = 2; l < i.length; l += 2) e.lineTo(i[l], i[l + 1]);
|
|
197
198
|
r && e.closePath(), e.stroke(), e.restore();
|
|
198
199
|
}, D = (e, t) => {
|
|
199
|
-
const { x: n, y: o, width: i, height: a, fill: s, stroke: r, radius:
|
|
200
|
-
if (e.beginPath(), s && (e.fillStyle = s), r && (e.strokeStyle = r),
|
|
200
|
+
const { x: n, y: o, width: i, height: a, fill: s, stroke: r, radius: l, opacity: c } = t;
|
|
201
|
+
if (e.beginPath(), s && (e.fillStyle = s), r && (e.strokeStyle = r), c && (e.globalAlpha = c), l == null)
|
|
201
202
|
e.rect(n, o, i, a);
|
|
202
203
|
else {
|
|
203
|
-
const u = typeof
|
|
204
|
-
tl: Math.min(
|
|
205
|
-
tr: Math.min(
|
|
206
|
-
bl: Math.min(
|
|
207
|
-
br: Math.min(
|
|
204
|
+
const u = typeof l == "number" ? { tl: l, tr: l, br: l, bl: l } : {
|
|
205
|
+
tl: Math.min(l.tl, a / 2, i / 2),
|
|
206
|
+
tr: Math.min(l.tr, a / 2, i / 2),
|
|
207
|
+
bl: Math.min(l.bl, a / 2, i / 2),
|
|
208
|
+
br: Math.min(l.br, a / 2, i / 2)
|
|
208
209
|
};
|
|
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
|
-
e.closePath(), s && e.fill(), r && e.stroke(),
|
|
212
|
-
},
|
|
213
|
-
const { points: n, radiusAll: o, fill: i, stroke: a } = t, s = (
|
|
214
|
-
const h = u.x -
|
|
212
|
+
e.closePath(), s && e.fill(), r && e.stroke(), c && (e.globalAlpha = 1);
|
|
213
|
+
}, hi = (e, t) => {
|
|
214
|
+
const { points: n, radiusAll: o, fill: i, stroke: a } = t, s = (c, u) => {
|
|
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) };
|
|
216
217
|
}, r = n.length;
|
|
217
|
-
let
|
|
218
|
+
let l = n[r - 1];
|
|
218
219
|
e.beginPath(), i && (e.fillStyle = i), a && (e.strokeStyle = a);
|
|
219
|
-
for (let
|
|
220
|
-
const u = n[
|
|
220
|
+
for (let c = 0; c < r; c++) {
|
|
221
|
+
const u = n[c % r], h = n[(c + 1) % r], m = s(u, l), g = s(u, h), C = m.nx * g.ny - m.ny * g.nx, S = m.nx * g.nx - m.ny * -g.ny;
|
|
221
222
|
let p = Math.asin(Math.min(Math.max(C, -1), 1)), w = 1, v = !1;
|
|
222
223
|
S < 0 ? p < 0 ? p = Math.PI + p : (p = Math.PI - p, w = -1, v = !0) : p > 0 && (w = -1, v = !0);
|
|
223
224
|
const y = u.radius !== void 0 ? u.radius : o, R = p / 2;
|
|
224
225
|
let I = Math.abs(Math.cos(R) * y / Math.sin(R)), k;
|
|
225
226
|
I > Math.min(m.len / 2, g.len / 2) ? (I = Math.min(m.len / 2, g.len / 2), k = Math.abs(I * Math.sin(R) / Math.cos(R))) : k = y;
|
|
226
|
-
let P = u.x + g.nx * I,
|
|
227
|
-
P += -g.ny * k * w,
|
|
227
|
+
let P = u.x + g.nx * I, M = u.y + g.ny * I;
|
|
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
|
-
const { x: n, y: o, size: i, radius: a = 4, fill: s, stroke: r, isChecked:
|
|
232
|
-
e.beginPath(), D(e, { x: n, y: o, width:
|
|
233
|
-
},
|
|
231
|
+
}, Vt = (e, t) => {
|
|
232
|
+
const { x: n, y: o, size: i, radius: a = 4, fill: s, stroke: r, isChecked: l = !1 } = t, c = l ? i : i - 1;
|
|
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());
|
|
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
|
-
const [o, i] = e, [a, s] = t, [r,
|
|
248
|
-
return o >= Math.min(a, r) && o <= Math.max(a, r) && i >= Math.min(s,
|
|
249
|
-
},
|
|
247
|
+
}, fi = (e, t, n) => {
|
|
248
|
+
const [o, i] = e, [a, s] = t, [r, l] = n;
|
|
249
|
+
return o >= Math.min(a, r) && o <= Math.max(a, r) && i >= Math.min(s, l) && i <= Math.max(s, l);
|
|
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,44 +256,44 @@ const rt = "…", mn = new ct(1e3), gn = new ct(1e3), io = () => ({
|
|
|
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
|
-
const { x: i, y: a } = t, { scrollLeft: s, scrollTop: r } = n, { freezeRegionWidth:
|
|
283
|
+
}, Ut = (e, t, n, o) => {
|
|
284
|
+
const { x: i, y: a } = t, { scrollLeft: s, scrollTop: r } = n, { freezeRegionWidth: l, rowInitSize: c } = e;
|
|
284
285
|
if (o === O.Columns) {
|
|
285
|
-
const u = i <=
|
|
286
|
+
const u = i <= l ? i : s + i, h = e.getColumnStartIndex(u), m = e.getColumnOffset(h), g = e.getColumnWidth(h);
|
|
286
287
|
return V(u, m, m + g / 2) ? h : h + 1;
|
|
287
288
|
}
|
|
288
289
|
if (o === O.Rows) {
|
|
289
|
-
const u = a <=
|
|
290
|
+
const u = a <= c ? a : r + a, h = e.getRowStartIndex(u), m = e.getRowOffset(h), g = e.getRowHeight(h);
|
|
290
291
|
return V(u, m, m + g / 2) ? h : h + 1;
|
|
291
292
|
}
|
|
292
293
|
return -1 / 0;
|
|
293
294
|
};
|
|
294
|
-
class
|
|
295
|
-
state =
|
|
295
|
+
class Si {
|
|
296
|
+
state = It;
|
|
296
297
|
startPosition = 0;
|
|
297
298
|
options;
|
|
298
299
|
constructor(t) {
|
|
@@ -303,18 +304,18 @@ class gi {
|
|
|
303
304
|
}
|
|
304
305
|
/** On pointerdown. Returns the drag type and ranges when the press can start a drag. */
|
|
305
306
|
start(t) {
|
|
306
|
-
const n = this.options.draggable ??
|
|
307
|
-
if (n ===
|
|
308
|
-
const o = this.options.coordInstance(), { scrollTop: i, scrollLeft: a } = this.options.scrollState(), s = this.options.selection(), { type: r, rowIndex:
|
|
309
|
-
if (r ===
|
|
307
|
+
const n = this.options.draggable ?? he.All;
|
|
308
|
+
if (n === he.None) return null;
|
|
309
|
+
const o = this.options.coordInstance(), { scrollTop: i, scrollLeft: a } = this.options.scrollState(), s = this.options.selection(), { type: r, rowIndex: l, columnIndex: c, x: u, y: h } = t, { isRowSelection: m, isColumnSelection: g, ranges: C } = s;
|
|
310
|
+
if (r === b.RowHeaderDragHandler && n !== he.Column) {
|
|
310
311
|
this.startPosition = h;
|
|
311
|
-
const S = m && s.includes([
|
|
312
|
-
return this.setState({ type: O.Rows, ranges: S, delta: h + i - o.getRowOffset(
|
|
312
|
+
const S = m && s.includes([l, l]) ? C : [[l, l]];
|
|
313
|
+
return this.setState({ type: O.Rows, ranges: S, delta: h + i - o.getRowOffset(l), isDragging: !1 }), { type: O.Rows, ranges: S };
|
|
313
314
|
}
|
|
314
|
-
if (r ===
|
|
315
|
+
if (r === b.ColumnHeader && n !== he.Row) {
|
|
315
316
|
this.startPosition = u;
|
|
316
|
-
const S = g && s.includes([
|
|
317
|
-
return this.setState({ type: O.Columns, ranges: S, delta: u - o.getColumnRelativeOffset(
|
|
317
|
+
const S = g && s.includes([c, c]) ? C : [[c, c]];
|
|
318
|
+
return this.setState({ type: O.Columns, ranges: S, delta: u - o.getColumnRelativeOffset(c, a), isDragging: !1 }), { type: O.Columns, ranges: S };
|
|
318
319
|
}
|
|
319
320
|
return null;
|
|
320
321
|
}
|
|
@@ -332,46 +333,46 @@ class gi {
|
|
|
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
|
-
this.setState(
|
|
339
|
+
this.setState(It);
|
|
339
340
|
}
|
|
340
341
|
/** Esc while pressed or dragging: nothing moves. */
|
|
341
342
|
cancel() {
|
|
342
|
-
this.setState(
|
|
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
|
-
const i = n.findIndex((a) => a.type ===
|
|
351
|
-
return i < 0 ? e / 2 :
|
|
352
|
-
},
|
|
353
|
-
const { x: o, y: i } = n, { scrollLeft: a, scrollTop: s } = t, { freezeRegionWidth: r, totalWidth:
|
|
351
|
+
const i = n.findIndex((a) => a.type === $.Checkbox);
|
|
352
|
+
return i < 0 ? e / 2 : Kt(e, t, o, n.length, i);
|
|
353
|
+
}, bi = (e, t, n) => {
|
|
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
|
-
const { x: i, y: a } = n, { totalHeight: s, totalWidth: r, containerHeight:
|
|
357
|
-
return t.scrollLeft + i > r + B.columnAppendBtnWidth || t.scrollTop + a > s && !V(a,
|
|
358
|
-
},
|
|
359
|
-
[
|
|
360
|
-
[
|
|
361
|
-
[
|
|
362
|
-
},
|
|
363
|
-
type:
|
|
356
|
+
}, xi = (e, t, n, o = e.containerHeight) => {
|
|
357
|
+
const { x: i, y: a } = n, { totalHeight: s, totalWidth: r, containerHeight: l } = e;
|
|
358
|
+
return t.scrollLeft + i > r + B.columnAppendBtnWidth || t.scrollTop + a > s && !V(a, l, o);
|
|
359
|
+
}, Ri = {
|
|
360
|
+
[$.Drag]: b.RowHeaderDragHandler,
|
|
361
|
+
[$.Checkbox]: b.RowHeaderCheckbox,
|
|
362
|
+
[$.Expand]: b.RowHeaderExpandHandler
|
|
363
|
+
}, ie = {
|
|
364
|
+
type: b.Blank,
|
|
364
365
|
x: 1 / 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,90 +382,90 @@ const lo = (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
|
-
const { x: r, y:
|
|
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
|
-
const C = t.getRowOffset(g) -
|
|
390
|
-
return V(r, S, S + p) && V(
|
|
391
|
-
},
|
|
390
|
+
const C = t.getRowOffset(g) - c, S = t.getColumnRelativeOffset(h, u), { width: p, height: w } = a;
|
|
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;
|
|
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:
|
|
395
|
-
return V(a, r - g, r + g) && V(s,
|
|
396
|
-
},
|
|
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;
|
|
396
|
+
return V(a, r - g, r + g) && V(s, l, m) ? { ...ie, type: b.ColumnFreezeHandler } : null;
|
|
397
|
+
}, Bi = (e) => {
|
|
397
398
|
const { rowIndex: t, columnIndex: n } = e.position;
|
|
398
|
-
return e.isColumnAppendEnable && t >= -1 && n === -2 ? { ...
|
|
399
|
-
},
|
|
400
|
-
const { position: t, theme: n, rowControls: o, rowControlPaddingX: i, coordInstance: a, isMultiSelectionEnable: s } = e, { x: r, y:
|
|
401
|
-
if (!s ||
|
|
402
|
-
const { iconSizeXS: h } = n, m = h / 2, { rowInitSize: g, columnInitSize: C } = a, p =
|
|
403
|
-
return V(r, p, p + h) && V(
|
|
404
|
-
},
|
|
399
|
+
return e.isColumnAppendEnable && t >= -1 && n === -2 ? { ...ie, type: b.AppendColumn } : null;
|
|
400
|
+
}, Oi = (e) => {
|
|
401
|
+
const { position: t, theme: n, rowControls: o, rowControlPaddingX: i, coordInstance: a, isMultiSelectionEnable: s } = e, { x: r, y: l, rowIndex: c, columnIndex: u } = t;
|
|
402
|
+
if (!s || c !== -1 || u !== -1 || !o.some((v) => v.type === $.Checkbox)) return null;
|
|
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;
|
|
404
|
+
return V(r, p, p + h) && V(l, w, w + h) ? { type: b.AllCheckbox, x: p, y: w, width: h, height: h } : null;
|
|
405
|
+
}, Vi = (e) => {
|
|
405
406
|
const { rowIndex: t, columnIndex: n } = e.position;
|
|
406
|
-
return n >= -1 && t > -1 ? e.getLinearRow(t).type !==
|
|
407
|
-
},
|
|
408
|
-
const { position: t, theme: n, rowControls: o, rowControlPaddingX: i, scrollState: a, coordInstance: s } = e, { x: r, y:
|
|
409
|
-
if (
|
|
410
|
-
const h = e.getLinearRow(
|
|
411
|
-
if (h.type ===
|
|
412
|
-
if (h.type !==
|
|
413
|
-
const { iconSizeXS: m } = n, g = m / 2, C = s.getRowOffset(
|
|
407
|
+
return n >= -1 && t > -1 ? e.getLinearRow(t).type !== le.Append ? null : { ...ie, type: b.AppendRow } : null;
|
|
408
|
+
}, Gi = (e) => {
|
|
409
|
+
const { position: t, theme: n, rowControls: o, rowControlPaddingX: i, scrollState: a, coordInstance: s } = e, { x: r, y: l, rowIndex: c, columnIndex: u } = t;
|
|
410
|
+
if (c <= -1 || u !== -1) return null;
|
|
411
|
+
const h = e.getLinearRow(c);
|
|
412
|
+
if (h.type === le.Group) return { ...ie, type: b.RowGroupControl };
|
|
413
|
+
if (h.type !== le.Row) return null;
|
|
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
|
-
if (p && V(r, v, v + m) && V(
|
|
416
|
+
const p = Ri[o[S].type], v = Kt(s.columnInitSize, n, i, o.length, S) - g, y = C + Ii;
|
|
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
|
-
return { ...
|
|
420
|
-
},
|
|
421
|
-
const { position: t, scrollState: n, coordInstance: o, getLinearRow: i } = e, { x: a, y: s, rowIndex: r, columnIndex:
|
|
422
|
-
if (r <= -1 ||
|
|
423
|
-
const
|
|
424
|
-
return V(a, u, u +
|
|
425
|
-
},
|
|
426
|
-
const { position: t, selection: n, coordInstance: o, scrollState: i, activeCell: a, activeCellBound: s, isFillEnabled: r, real2RowIndex:
|
|
420
|
+
return { ...ie, type: b.RowHeader };
|
|
421
|
+
}, Ui = (e) => {
|
|
422
|
+
const { position: t, scrollState: n, coordInstance: o, getLinearRow: i } = e, { x: a, y: s, rowIndex: r, columnIndex: l } = t;
|
|
423
|
+
if (r <= -1 || l !== 0 || i(r).type !== le.Group) return null;
|
|
424
|
+
const c = o.getColumnWidth(l), u = o.getColumnRelativeOffset(l, n.scrollLeft);
|
|
425
|
+
return V(a, u, u + c) ? { type: b.RowGroupHeader, x: u, y: s, width: c, height: ki } : null;
|
|
426
|
+
}, Ki = (e) => {
|
|
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
|
-
const { isCellSelection:
|
|
429
|
-
if (!
|
|
430
|
-
const [S, p] = u[0], [w, v] = u[1], y = Math.max(S, w), R = Math.max(p, v), I =
|
|
431
|
-
return V(h,
|
|
432
|
-
},
|
|
429
|
+
const { isCellSelection: c, ranges: u } = n, { x: h, y: m, rowIndex: g, columnIndex: C } = t;
|
|
430
|
+
if (!c || g < 0 || C < 0) return null;
|
|
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
|
-
return a > -1 && s > -1 ? i(a).type !==
|
|
435
|
-
type:
|
|
435
|
+
return a > -1 && s > -1 ? i(a).type !== le.Row ? null : {
|
|
436
|
+
type: b.Cell,
|
|
436
437
|
x: t.getColumnRelativeOffset(s, o.scrollLeft),
|
|
437
438
|
y: t.getRowOffset(a) - o.scrollTop,
|
|
438
439
|
width: t.getColumnWidth(s),
|
|
439
440
|
height: t.getRowHeight(a)
|
|
440
441
|
} : null;
|
|
441
|
-
},
|
|
442
|
-
const { position: t, scrollState: n, coordInstance: o, columns: i, theme: a, isColumnResizable: s, isColumnHeaderMenuVisible: r } = e, { x:
|
|
442
|
+
}, $i = (e) => {
|
|
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
|
-
if (v && V(
|
|
448
|
-
return { type:
|
|
449
|
-
const P = k - m -
|
|
450
|
-
if (p && V(
|
|
451
|
-
return { type:
|
|
452
|
-
const
|
|
453
|
-
return S && V(
|
|
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;
|
|
448
|
+
if (v && V(l, k, k + m))
|
|
449
|
+
return { type: b.ColumnHeaderMenu, x: R, y: 0, width: m, height: C };
|
|
450
|
+
const P = k - m - Cn / 2, M = (C - m) / 2;
|
|
451
|
+
if (p && V(l, P, P + m) && V(c, M, M + m))
|
|
452
|
+
return { type: b.ColumnDescription, x: P, y: M, width: m, height: m };
|
|
453
|
+
const N = R + m / 2, z = (C - m) / 2;
|
|
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
|
-
fillHandlerSize:
|
|
456
|
-
cellTextLineHeight:
|
|
457
|
-
rowHeadIconPaddingTop:
|
|
458
|
-
columnHeadHeight:
|
|
459
|
-
columnHeadPadding:
|
|
456
|
+
fillHandlerSize: at,
|
|
457
|
+
cellTextLineHeight: vn,
|
|
458
|
+
rowHeadIconPaddingTop: Sn,
|
|
459
|
+
columnHeadHeight: yn,
|
|
460
|
+
columnHeadPadding: oe,
|
|
460
461
|
columnHeadMenuSize: Me,
|
|
461
|
-
columnAppendBtnWidth:
|
|
462
|
-
columnResizeHandlerWidth:
|
|
463
|
-
columnResizeHandlerPaddingTop:
|
|
464
|
-
cellVerticalPaddingMD:
|
|
465
|
-
columnFreezeHandlerWidth:
|
|
466
|
-
columnFreezeHandlerHeight:
|
|
467
|
-
} = B,
|
|
462
|
+
columnAppendBtnWidth: bn,
|
|
463
|
+
columnResizeHandlerWidth: xn,
|
|
464
|
+
columnResizeHandlerPaddingTop: Rn,
|
|
465
|
+
cellVerticalPaddingMD: Lt,
|
|
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,138 +473,138 @@ const lo = (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
|
-
}),
|
|
480
|
-
const { coordInstance: n, visibleRegion: o, activeCell: i, highlightedRowIndex: a, mouseState: s, scrollState: r, selection:
|
|
481
|
-
if (!S) return { cellPropList: P, rowHeaderPropList:
|
|
482
|
-
const
|
|
483
|
-
for (let
|
|
484
|
-
const
|
|
485
|
-
for (let
|
|
486
|
-
const
|
|
487
|
-
if (
|
|
488
|
-
if (
|
|
489
|
-
|
|
478
|
+
getLinearRow: e.getLinearRow ?? Ot,
|
|
479
|
+
real2RowIndex: e.real2RowIndex ?? lo
|
|
480
|
+
}), zn = (e, t) => {
|
|
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 = [];
|
|
482
|
+
if (!S) return { cellPropList: P, rowHeaderPropList: M, appendRowList: N };
|
|
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;
|
|
484
|
+
for (let X = E; X <= W; X++) {
|
|
485
|
+
const A = n.getColumnRelativeOffset(X, v), L = n.getColumnWidth(X), fe = w && l.includes([X, X]), Te = X === 0;
|
|
486
|
+
for (let Y = o.startRowIndex; Y <= o.stopRowIndex; Y++) {
|
|
487
|
+
const Ne = h(Y), Fe = n.getRowHeight(Y), Le = n.getRowOffset(Y) - y;
|
|
488
|
+
if (Ne.type === le.Group) continue;
|
|
489
|
+
if (Ne.type === le.Append) {
|
|
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:
|
|
493
|
-
let
|
|
494
|
-
|
|
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;
|
|
494
|
+
let re;
|
|
495
|
+
ce || ye || fe ? re = ae : (Ye || Se || Qe) && (re = q), Te && M.push({
|
|
495
496
|
x: 0.5,
|
|
496
497
|
y: Le + 0.5,
|
|
497
498
|
width: g + 0.5,
|
|
498
|
-
height:
|
|
499
|
-
displayIndex: String(
|
|
500
|
-
isHover:
|
|
501
|
-
isChecked: p &&
|
|
502
|
-
}), !
|
|
503
|
-
x:
|
|
499
|
+
height: Fe,
|
|
500
|
+
displayIndex: String(ft),
|
|
501
|
+
isHover: Ye || Se || Qe,
|
|
502
|
+
isChecked: p && ye
|
|
503
|
+
}), !F && P.push({
|
|
504
|
+
x: A + 0.5,
|
|
504
505
|
y: Le + 0.5,
|
|
505
|
-
width:
|
|
506
|
-
height:
|
|
507
|
-
rowIndex:
|
|
508
|
-
columnIndex:
|
|
506
|
+
width: L,
|
|
507
|
+
height: Fe,
|
|
508
|
+
rowIndex: Pe,
|
|
509
|
+
columnIndex: X,
|
|
509
510
|
theme: u,
|
|
510
511
|
isActive: !1,
|
|
511
|
-
fill:
|
|
512
|
+
fill: je ? _ : re ?? _
|
|
512
513
|
});
|
|
513
514
|
}
|
|
514
515
|
}
|
|
515
|
-
return { cellPropList: P, rowHeaderPropList:
|
|
516
|
-
},
|
|
517
|
-
const { x: o, y: i, width: a, height: s, displayIndex: r, isHover:
|
|
518
|
-
D(e, { x: o, y: i, width: a, height: s, fill:
|
|
519
|
-
const
|
|
520
|
-
if (e.font = `${u.fontSizeXXS}px ${u.fontFamily}`, (
|
|
521
|
-
for (let
|
|
522
|
-
const { type:
|
|
523
|
-
if (
|
|
524
|
-
const E =
|
|
525
|
-
if (
|
|
526
|
-
|
|
527
|
-
x: o + E -
|
|
528
|
-
y: i +
|
|
516
|
+
return { cellPropList: P, rowHeaderPropList: M, appendRowList: N };
|
|
517
|
+
}, Xi = (e, t, n) => {
|
|
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;
|
|
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 });
|
|
520
|
+
const M = R / 2;
|
|
521
|
+
if (e.font = `${u.fontSizeXXS}px ${u.fontFamily}`, (c || l || !g) && h.length > 0) {
|
|
522
|
+
for (let N = 0; N < h.length; N++) {
|
|
523
|
+
const { type: z } = h[N];
|
|
524
|
+
if (z === $.Spacer) continue;
|
|
525
|
+
const E = Kt(a, u, m, h.length, N);
|
|
526
|
+
if (z === $.Checkbox) {
|
|
527
|
+
Vt(e, {
|
|
528
|
+
x: o + E - M,
|
|
529
|
+
y: i + Sn,
|
|
529
530
|
size: R,
|
|
530
|
-
stroke:
|
|
531
|
-
fill:
|
|
532
|
-
isChecked:
|
|
531
|
+
stroke: c ? I : y,
|
|
532
|
+
fill: c ? k : void 0,
|
|
533
|
+
isChecked: c
|
|
533
534
|
});
|
|
534
535
|
continue;
|
|
535
536
|
}
|
|
536
|
-
|
|
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
|
-
$e(e, { x: o + a / 2, y: i +
|
|
541
|
-
},
|
|
542
|
-
const { x: o, y: i, width: a, height: s, isHover: r } = t, { theme:
|
|
543
|
-
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 +
|
|
544
|
-
},
|
|
545
|
-
const { coordInstance: o, theme: i, shouldRerender: a, drawCell: s } = n, { fontFamily: r, fontSizeSM:
|
|
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:
|
|
548
|
-
}),
|
|
549
|
-
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:
|
|
550
|
-
}), a && (
|
|
551
|
-
v.font = `${
|
|
552
|
-
}),
|
|
553
|
-
v.font = `${
|
|
541
|
+
$e(e, { x: o + a / 2, y: i + Lt + 1, text: r, textAlign: "center", fill: y, fontSize: u.fontSizeXXS });
|
|
542
|
+
}, Yi = (e, t, n) => {
|
|
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;
|
|
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();
|
|
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));
|
|
549
|
+
}), it(e, w, (v) => {
|
|
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 }));
|
|
551
|
+
}), a && (it(t, p, (v) => {
|
|
552
|
+
v.font = `${l}px ${r}`, S.cellPropList.forEach((y) => s(v, y));
|
|
553
|
+
}), it(t, w, (v) => {
|
|
554
|
+
v.font = `${l}px ${r}`, C.cellPropList.forEach((y) => s(v, y));
|
|
554
555
|
}));
|
|
555
|
-
},
|
|
556
|
-
const { theme: n, scrollState: o, coordInstance: i, activeCellBound: a, real2RowIndex: s, getLinearRow: r, drawCell:
|
|
556
|
+
}, ji = (e, t) => {
|
|
557
|
+
const { theme: n, scrollState: o, coordInstance: i, activeCellBound: a, real2RowIndex: s, getLinearRow: r, drawCell: l } = t;
|
|
557
558
|
if (a == null) return;
|
|
558
|
-
const { width:
|
|
559
|
-
if (h >= w || r(y)?.type !==
|
|
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);
|
|
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
|
-
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:
|
|
562
|
-
},
|
|
563
|
-
const { selection: n, mouseState: o, coordInstance: i, scrollState: a, theme: s, isFilling: r, isFillEnabled:
|
|
564
|
-
if (!r || !
|
|
565
|
-
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 = (
|
|
566
|
-
let P = null,
|
|
567
|
-
Number.isFinite(w) && w > p ? (P = i.getRowOffset(
|
|
568
|
-
},
|
|
569
|
-
const { coordInstance: n, scrollState: o, selection: i, isSelecting: a, isEditing: s, theme: r, activeCellBound:
|
|
570
|
-
if (!
|
|
571
|
-
const m =
|
|
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();
|
|
563
|
+
}, Qi = (e, t) => {
|
|
564
|
+
const { selection: n, mouseState: o, coordInstance: i, scrollState: a, theme: s, isFilling: r, isFillEnabled: l, real2RowIndex: c, getLinearRow: u } = t;
|
|
565
|
+
if (!r || !l || !n.isCellSelection) return;
|
|
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;
|
|
567
|
+
let P = null, M = null;
|
|
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 }));
|
|
569
|
+
}, Zi = (e, t) => {
|
|
570
|
+
const { coordInstance: n, scrollState: o, selection: i, isSelecting: a, isEditing: s, theme: r, activeCellBound: l, isFillEnabled: c, real2RowIndex: u, getLinearRow: h } = t;
|
|
571
|
+
if (!c || s || a) return;
|
|
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),
|
|
574
|
-
e.save(), e.beginPath(), v >= g && (e.rect(C, S, p - C, w - S), e.clip()), D(e, { x: R + P -
|
|
575
|
-
},
|
|
576
|
-
const { x: o, y: i, width: a, height: s, fill: r, column:
|
|
577
|
-
let P = a -
|
|
578
|
-
const
|
|
579
|
-
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 -
|
|
580
|
-
P = P - Me -
|
|
581
|
-
const E = i +
|
|
582
|
-
|
|
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);
|
|
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();
|
|
576
|
+
}, Ji = (e, t, n) => {
|
|
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;
|
|
578
|
+
let P = a - oe * 2, M = oe;
|
|
579
|
+
const N = c && C, z = i + (yn - k) / 2;
|
|
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) {
|
|
581
|
+
P = P - Me - oe;
|
|
582
|
+
const E = i + yn / 2;
|
|
583
|
+
hi(e, {
|
|
583
584
|
points: [
|
|
584
|
-
{ x: o + a -
|
|
585
|
-
{ x: o + a -
|
|
586
|
-
{ x: o + a -
|
|
585
|
+
{ x: o + a - oe - Me, y: E - Me / 4 },
|
|
586
|
+
{ x: o + a - oe, y: E - Me / 4 },
|
|
587
|
+
{ x: o + a - oe - Me / 2, y: E + Me / 4 }
|
|
587
588
|
],
|
|
588
589
|
radiusAll: 1,
|
|
589
590
|
fill: y
|
|
590
591
|
});
|
|
591
592
|
}
|
|
592
|
-
g && (h?.(e, { kind: "description", x:
|
|
593
|
-
x: o +
|
|
594
|
-
y: i +
|
|
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, {
|
|
594
|
+
x: o + M,
|
|
595
|
+
y: i + Lt,
|
|
595
596
|
text: m,
|
|
596
|
-
maxLines: Math.max(1, Math.floor((s -
|
|
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
|
-
const { x: o, y: i, width: a, height: s, isChecked: r } = t, { theme:
|
|
604
|
-
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 &&
|
|
605
|
-
const y =
|
|
606
|
-
|
|
603
|
+
}, ea = (e, t, n) => {
|
|
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;
|
|
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)) {
|
|
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,93 +613,93 @@ const lo = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
612
613
|
isChecked: r
|
|
613
614
|
});
|
|
614
615
|
}
|
|
615
|
-
},
|
|
616
|
-
const { visibleRegion: o, coordInstance: i, columns: a, theme: s, mouseState: r, scrollState:
|
|
616
|
+
}, An = (e, t, n) => {
|
|
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
|
-
for (let E =
|
|
619
|
-
const
|
|
620
|
-
if (
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
x: i.getColumnRelativeOffset(E,
|
|
619
|
+
for (let E = M; E <= N; E++) {
|
|
620
|
+
const W = a[E];
|
|
621
|
+
if (W == null) continue;
|
|
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, {
|
|
624
|
+
x: i.getColumnRelativeOffset(E, l.scrollLeft) + 0.5,
|
|
624
625
|
y: 0.5,
|
|
625
626
|
width: i.getColumnWidth(E),
|
|
626
627
|
height: C,
|
|
627
|
-
column:
|
|
628
|
-
fill:
|
|
628
|
+
column: W,
|
|
629
|
+
fill: q,
|
|
629
630
|
hasMenu: h
|
|
630
631
|
}, t);
|
|
631
632
|
}
|
|
632
|
-
const
|
|
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
|
-
const { totalWidth:
|
|
638
|
-
D(e, { x: S + 1, y: 0.5, width:
|
|
638
|
+
const { totalWidth: l, totalHeight: c, rowInitSize: u } = n, { iconSizeSM: h, columnHeaderBg: m, cellLineColor: g, columnHeaderBgHovered: C } = o, S = l - a.scrollLeft;
|
|
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
|
-
},
|
|
642
|
-
const { theme: n, scrollState: o, coordInstance: i, isColumnResizable: a, columnResizeState: s, hoveredColumnResizeIndex: r } = t,
|
|
643
|
-
if (!
|
|
644
|
-
const h = u ?
|
|
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) => {
|
|
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;
|
|
644
|
+
if (!c && !u) return;
|
|
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
|
-
const { theme: n, mouseState: o, scrollState: i, dragState: a, coordInstance: s } = t, { type: r, isDragging:
|
|
655
|
-
if (!
|
|
656
|
-
const h =
|
|
654
|
+
}, oa = (e, t) => {
|
|
655
|
+
const { theme: n, mouseState: o, scrollState: i, dragState: a, coordInstance: s } = t, { type: r, isDragging: l, ranges: c, delta: u } = a;
|
|
656
|
+
if (!l || r !== O.Columns) return;
|
|
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
|
-
const { theme: n, mouseState: o, scrollState: i, dragState: a, coordInstance: s } = t, { type: r, isDragging:
|
|
662
|
-
if (!
|
|
663
|
-
const h =
|
|
661
|
+
}, ia = (e, t) => {
|
|
662
|
+
const { theme: n, mouseState: o, scrollState: i, dragState: a, coordInstance: s } = t, { type: r, isDragging: l, ranges: c, delta: u } = a;
|
|
663
|
+
if (!l || r !== O.Rows) return;
|
|
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
|
-
const { coordInstance: n, mouseState: o, scrollState: i, columnFreezeState: a, theme: s } = t, { isFreezing: r, targetIndex:
|
|
669
|
-
if (o.type !==
|
|
670
|
-
const { containerHeight:
|
|
668
|
+
}, aa = (e, t) => {
|
|
669
|
+
const { coordInstance: n, mouseState: o, scrollState: i, columnFreezeState: a, theme: s } = t, { isFreezing: r, targetIndex: l } = a;
|
|
670
|
+
if (o.type !== b.ColumnFreezeHandler && !r) return;
|
|
671
|
+
const { containerHeight: c, freezeRegionWidth: u } = n, h = s.interactionLineColorHighlight, m = r ? o.x : u;
|
|
671
672
|
if (r) {
|
|
672
|
-
const g = n.getColumnRelativeOffset(
|
|
673
|
-
D(e, { x: g - 1, y: 0, width: 2, height:
|
|
673
|
+
const g = n.getColumnRelativeOffset(l + 1, i.scrollLeft);
|
|
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
|
-
const { containerWidth: n, containerHeight: o, pixelRatio: i, shouldRerender: a, draw: s } = t, r = Math.ceil(n * i),
|
|
685
|
-
(e.width !== r || e.height !==
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
},
|
|
689
|
-
const a =
|
|
690
|
-
if (l === 0 ||
|
|
691
|
-
const
|
|
692
|
-
(e.width !==
|
|
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) => {
|
|
685
|
+
const { containerWidth: n, containerHeight: o, pixelRatio: i, shouldRerender: a, draw: s } = t, r = Math.ceil(n * i), l = Math.ceil(o * i);
|
|
686
|
+
(e.width !== r || e.height !== l) && (e.width = r, e.height = l);
|
|
687
|
+
const c = e.getContext("2d");
|
|
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());
|
|
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
|
+
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, {
|
|
695
696
|
containerWidth: l,
|
|
696
|
-
containerHeight:
|
|
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 lo = (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 lo = (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,66 +843,66 @@ function ga(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
|
-
const a = /* @__PURE__ */ new WeakMap(), s = (
|
|
848
|
-
n = !0, t.onStart?.(
|
|
849
|
-
}, r = (
|
|
850
|
-
n = !1, o =
|
|
848
|
+
const a = /* @__PURE__ */ new WeakMap(), s = (l) => {
|
|
849
|
+
n = !0, t.onStart?.(l);
|
|
850
|
+
}, r = (l) => {
|
|
851
|
+
n = !1, o = l.timeStamp, t.onEnd?.(l);
|
|
851
852
|
};
|
|
852
853
|
return e.addEventListener("compositionstart", s, !0), e.addEventListener("compositionend", r, !0), {
|
|
853
854
|
get composing() {
|
|
854
855
|
return n;
|
|
855
856
|
},
|
|
856
|
-
ownsKey(
|
|
857
|
-
if (n ||
|
|
858
|
-
if (!
|
|
859
|
-
const
|
|
860
|
-
if (
|
|
861
|
-
const u =
|
|
862
|
-
return o = -1 / 0, a.set(
|
|
857
|
+
ownsKey(l) {
|
|
858
|
+
if (n || vo(l)) return !0;
|
|
859
|
+
if (!wa.has(l.key)) return !1;
|
|
860
|
+
const c = a.get(l);
|
|
861
|
+
if (c !== void 0) return c;
|
|
862
|
+
const u = l.timeStamp - o <= va;
|
|
863
|
+
return o = -1 / 0, a.set(l, u), u;
|
|
863
864
|
},
|
|
864
865
|
dispose() {
|
|
865
866
|
i || (i = !0, e.removeEventListener("compositionstart", s, !0), e.removeEventListener("compositionend", r, !0));
|
|
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;
|
|
878
879
|
const s = e.length, r = () => {
|
|
879
880
|
n.push(o), o = "", a = !0;
|
|
880
|
-
},
|
|
881
|
+
}, l = () => {
|
|
881
882
|
r(), t.push(n), n = [];
|
|
882
883
|
};
|
|
883
884
|
for (; i < s; ) {
|
|
884
|
-
const
|
|
885
|
-
if (a &&
|
|
886
|
-
const u =
|
|
885
|
+
const c = e[i];
|
|
886
|
+
if (a && c === '"') {
|
|
887
|
+
const u = Ia(e, i + 1);
|
|
887
888
|
if (u === -1) {
|
|
888
|
-
o +=
|
|
889
|
+
o += c, a = !1, i++;
|
|
889
890
|
continue;
|
|
890
891
|
}
|
|
891
892
|
o += e.slice(i + 1, u).replace(/""/g, '"'), i = u + 1, a = !1;
|
|
892
893
|
continue;
|
|
893
894
|
}
|
|
894
|
-
if (a = !1,
|
|
895
|
+
if (a = !1, c === " ")
|
|
895
896
|
r(), i++;
|
|
896
|
-
else if (
|
|
897
|
+
else if (c === "\r" || c === `
|
|
897
898
|
`) {
|
|
898
|
-
if (
|
|
899
|
-
` ? 2 : 1, i >= s) return
|
|
899
|
+
if (l(), i += c === "\r" && e[i + 1] === `
|
|
900
|
+
` ? 2 : 1, i >= s) return Tn(t);
|
|
900
901
|
} else
|
|
901
|
-
o +=
|
|
902
|
+
o += c, i++;
|
|
902
903
|
}
|
|
903
|
-
return
|
|
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 fa = ({ 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 fa = ({ 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
|
}
|
|
@@ -951,66 +952,66 @@ const fa = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
951
952
|
return t.hasFocus && !t.hasFocus() && t.onFocus ? new Promise((s, r) => t.onFocus(() => {
|
|
952
953
|
try {
|
|
953
954
|
i().then(s, r);
|
|
954
|
-
} catch (
|
|
955
|
-
r(
|
|
955
|
+
} catch (l) {
|
|
956
|
+
r(l);
|
|
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 {
|
|
963
|
-
startColumn:
|
|
964
|
-
endColumn:
|
|
965
|
-
startRow:
|
|
966
|
-
endRow:
|
|
964
|
+
startColumn: st(Math.min(n[0], o[0]), 0, i),
|
|
965
|
+
endColumn: st(Math.max(n[0], o[0]), 0, i),
|
|
966
|
+
startRow: st(Math.min(n[1], o[1]), 0, a),
|
|
967
|
+
endRow: st(Math.max(n[1], o[1]), 0, a)
|
|
967
968
|
};
|
|
968
|
-
},
|
|
969
|
+
}, rt = (e, t) => {
|
|
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) {
|
|
981
982
|
case "cells": {
|
|
982
983
|
const i = qe(e, t);
|
|
983
|
-
return i ? { rows:
|
|
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
|
-
return i.length ? { rows: i, columns:
|
|
987
|
+
const i = Nn(e.ranges, n);
|
|
988
|
+
return i.length ? { rows: i, columns: rt(0, o - 1) } : null;
|
|
988
989
|
}
|
|
989
990
|
case "columns": {
|
|
990
|
-
const i =
|
|
991
|
-
return i.length ? { rows:
|
|
991
|
+
const i = Nn(e.ranges, o);
|
|
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
|
-
let r = o,
|
|
1010
|
-
const
|
|
1011
|
-
if (o.length === 1 && o[0].length === 1 &&
|
|
1010
|
+
let r = o, l = !1;
|
|
1011
|
+
const c = qe(t, n);
|
|
1012
|
+
if (o.length === 1 && o[0].length === 1 && c && (c.endRow > c.startRow || c.endColumn > c.startColumn)) {
|
|
1012
1013
|
const w = o[0][0];
|
|
1013
|
-
r = Array.from({ length:
|
|
1014
|
+
r = Array.from({ length: c.endRow - c.startRow + 1 }, () => Array.from({ length: c.endColumn - c.startColumn + 1 }, () => w)), l = !0;
|
|
1014
1015
|
}
|
|
1015
1016
|
const u = s - i[0], h = r[0].length, m = Math.max(0, h - u);
|
|
1016
1017
|
m > 0 && (r = r.map((w) => w.slice(0, u)));
|
|
@@ -1025,12 +1026,12 @@ const fa = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
1025
1026
|
extraRows: Math.max(0, C - (a - 1)),
|
|
1026
1027
|
droppedColumns: m,
|
|
1027
1028
|
readonlyColumns: p,
|
|
1028
|
-
repeated:
|
|
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
|
-
let n = !1, o = null, i, a, s = !1, r = null,
|
|
1034
|
+
let n = !1, o = null, i, a, s = !1, r = null, l = 0, c = !1;
|
|
1034
1035
|
const u = {
|
|
1035
1036
|
get editing() {
|
|
1036
1037
|
return n;
|
|
@@ -1054,12 +1055,12 @@ function Ea(e) {
|
|
|
1054
1055
|
return r;
|
|
1055
1056
|
},
|
|
1056
1057
|
get version() {
|
|
1057
|
-
return
|
|
1058
|
+
return l;
|
|
1058
1059
|
}
|
|
1059
1060
|
}, h = () => {
|
|
1060
|
-
|
|
1061
|
+
l += 1, e.onChange?.(u);
|
|
1061
1062
|
}, m = () => {
|
|
1062
|
-
n = !1, o = null, i = void 0, a = void 0, r = null,
|
|
1063
|
+
n = !1, o = null, i = void 0, a = void 0, r = null, c = !1;
|
|
1063
1064
|
}, g = {
|
|
1064
1065
|
state: u,
|
|
1065
1066
|
start(C, S, p = S) {
|
|
@@ -1069,12 +1070,12 @@ function Ea(e) {
|
|
|
1069
1070
|
n && (a = C, r = null, h());
|
|
1070
1071
|
},
|
|
1071
1072
|
setComposing(C) {
|
|
1072
|
-
s !== C && (s = C, h(), !C &&
|
|
1073
|
+
s !== C && (s = C, h(), !C && c && (c = !1, g.commit()));
|
|
1073
1074
|
},
|
|
1074
1075
|
commit() {
|
|
1075
1076
|
if (!n || o === null) return "idle";
|
|
1076
1077
|
if (s)
|
|
1077
|
-
return
|
|
1078
|
+
return c = !0, "composing";
|
|
1078
1079
|
if (!u.dirty)
|
|
1079
1080
|
return m(), h(), "clean";
|
|
1080
1081
|
const C = e.validate?.(a, o);
|
|
@@ -1091,20 +1092,20 @@ function Ea(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 Na(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
|
|
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,75 +1134,75 @@ function La(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(),
|
|
1137
|
-
if (
|
|
1138
|
-
const
|
|
1139
|
-
|
|
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 =
|
|
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: () =>
|
|
1167
|
-
onOutside: (
|
|
1168
|
-
onEscape: (
|
|
1166
|
+
const r = Bn(e).find(Boolean)?.ownerDocument?.defaultView ?? window, l = Ga(r, {
|
|
1167
|
+
elements: () => Bn(e),
|
|
1168
|
+
onOutside: (c) => n.onOutside?.(c),
|
|
1169
|
+
onEscape: (c) => n.onEscape?.(c)
|
|
1169
1170
|
});
|
|
1170
|
-
s(() =>
|
|
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";
|
|
1179
1180
|
const { fontBoundingBoxAscent: i, fontBoundingBoxDescent: a } = o.measureText("Hg");
|
|
1180
1181
|
o.textBaseline = "middle";
|
|
1181
1182
|
const { alphabeticBaseline: s } = o.measureText("Hg"), r = { ascent: i, descent: a, drop: -s };
|
|
1182
|
-
return Object.values(r).every((
|
|
1183
|
+
return Object.values(r).every((l) => Number.isFinite(l) && Math.abs(l) < t * 2) ? r : null;
|
|
1183
1184
|
}
|
|
1184
|
-
const
|
|
1185
|
-
function
|
|
1185
|
+
const _t = (e) => e.view || e.kind === "long-text";
|
|
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 ?
|
|
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 } =
|
|
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
|
-
const { top: n, bottom: o, lineHeight: i } =
|
|
1201
|
+
function Xa(e, t) {
|
|
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 Ua = {
|
|
|
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 } =
|
|
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,19 +1241,19 @@ function Ka(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`,
|
|
1252
1253
|
right: `${B.cellHorizontalPadding}px`,
|
|
1253
1254
|
// Placed by `top` from the editor height so it never depends on layout.
|
|
1254
|
-
height: `${
|
|
1255
|
-
"line-height": `${
|
|
1255
|
+
height: `${ut}px`,
|
|
1256
|
+
"line-height": `${ut - 2}px`,
|
|
1256
1257
|
"font-size": "var(--ui-font-size-sm, 12px)",
|
|
1257
1258
|
"font-family": e.theme.fontFamily,
|
|
1258
1259
|
color: "var(--ui-text-muted)",
|
|
@@ -1262,10 +1263,10 @@ function _a(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 $a(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,11 +1323,11 @@ class Xa {
|
|
|
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
|
-
const { move: r, reason:
|
|
1329
|
-
this.wrote = !0, this.options.onCommit({ cell: [i[0], i[1]], value: a ?? "", previous: s ?? "", move: r, reason:
|
|
1329
|
+
const { move: r, reason: l } = this.pending;
|
|
1330
|
+
this.wrote = !0, this.options.onCommit({ cell: [i[0], i[1]], value: a ?? "", previous: s ?? "", move: r, reason: l });
|
|
1330
1331
|
},
|
|
1331
1332
|
onChange: () => this.options.onChange?.(this.state)
|
|
1332
1333
|
});
|
|
@@ -1337,7 +1338,7 @@ class Xa {
|
|
|
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 Xa {
|
|
|
1403
1404
|
return this.pending.reason;
|
|
1404
1405
|
}
|
|
1405
1406
|
}
|
|
1406
|
-
function
|
|
1407
|
-
const t =
|
|
1407
|
+
function ts(e) {
|
|
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;
|
|
@@ -1438,14 +1439,14 @@ function Ya(e) {
|
|
|
1438
1439
|
dirty: o.state.dirty,
|
|
1439
1440
|
error: o.state.error,
|
|
1440
1441
|
version: o.state.version
|
|
1441
|
-
}), a =
|
|
1442
|
+
}), a = ue(i()), s = (u) => u.editor ?? "text", r = (u) => e.enabled() && s(u) !== "custom", l = () => {
|
|
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
|
-
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 } =
|
|
1445
|
-
u.style.height = "0px", u.style.padding = `${S}px
|
|
1446
|
-
const R =
|
|
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;
|
|
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,
|
|
1450
1451
|
lines: t,
|
|
1451
1452
|
get active() {
|
|
@@ -1463,7 +1464,7 @@ function Ya(e) {
|
|
|
1463
1464
|
});
|
|
1464
1465
|
if (!S) return !0;
|
|
1465
1466
|
const p = e.owner();
|
|
1466
|
-
return p && (p.value !== S.text && (p.value = S.text), S.caretAtEnd && p.setSelectionRange(S.text.length, S.text.length), p.ownerDocument.activeElement !== p && e.refocus()), t.value = 1,
|
|
1467
|
+
return p && (p.value !== S.text && (p.value = S.text), S.caretAtEnd && p.setSelectionRange(S.text.length, S.text.length), p.ownerDocument.activeElement !== p && e.refocus()), t.value = 1, l(), !0;
|
|
1467
1468
|
},
|
|
1468
1469
|
keyDown(u, h) {
|
|
1469
1470
|
if (!o.state.active) return !1;
|
|
@@ -1476,11 +1477,11 @@ function Ya(e) {
|
|
|
1476
1477
|
compositionEnd() {
|
|
1477
1478
|
if (!o.state.active) return;
|
|
1478
1479
|
const u = e.owner();
|
|
1479
|
-
u && o.input(u.value), o.setComposing(!1), o.state.active &&
|
|
1480
|
+
u && o.input(u.value), o.setComposing(!1), o.state.active && l();
|
|
1480
1481
|
},
|
|
1481
1482
|
input() {
|
|
1482
1483
|
const u = e.owner();
|
|
1483
|
-
!u || !o.state.active || (o.input(u.value),
|
|
1484
|
+
!u || !o.state.active || (o.input(u.value), l());
|
|
1484
1485
|
},
|
|
1485
1486
|
blur() {
|
|
1486
1487
|
!o.state.active || o.state.composing || o.commit("blur", "none");
|
|
@@ -1493,11 +1494,11 @@ function Ya(e) {
|
|
|
1493
1494
|
o.cancel();
|
|
1494
1495
|
}
|
|
1495
1496
|
};
|
|
1496
|
-
return
|
|
1497
|
-
u && (n =
|
|
1497
|
+
return de(e.owner, (u, h, m) => {
|
|
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 Ya(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 ja = {
|
|
|
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 ja = {
|
|
|
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,30 +1594,30 @@ const ja = {
|
|
|
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
|
-
const { x: i, y: a } = e, { containerWidth: s, containerHeight: r, freezeRegionWidth:
|
|
1608
|
+
}), as = 30, ss = 2, rs = 1200, ls = (e, t, n, o = as) => {
|
|
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) {
|
|
1611
|
-
const g = i >=
|
|
1612
|
-
s - i < o ? h = 1 : i <
|
|
1612
|
+
const g = i >= c && i < l;
|
|
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 is {
|
|
|
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 is {
|
|
|
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,12 +1659,12 @@ class is {
|
|
|
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
|
-
state =
|
|
1666
|
+
class ds {
|
|
1667
|
+
state = kt;
|
|
1667
1668
|
hoveredIndex = -1;
|
|
1668
1669
|
pressed = null;
|
|
1669
1670
|
options;
|
|
@@ -1683,8 +1684,8 @@ class as {
|
|
|
1683
1684
|
/** On pointerdown; returns false unless the pointer is on a resize zone. */
|
|
1684
1685
|
start(t) {
|
|
1685
1686
|
const { type: n, columnIndex: o, x: i } = t;
|
|
1686
|
-
if (n !==
|
|
1687
|
-
const a = this.options.coordInstance(), s =
|
|
1687
|
+
if (n !== b.ColumnResizeHandler) return !1;
|
|
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,23 +1699,23 @@ class as {
|
|
|
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 ===
|
|
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. */
|
|
1705
1706
|
end() {
|
|
1706
1707
|
if (!this.isResizing) return null;
|
|
1707
1708
|
const t = { width: this.state.width, columnIndex: this.state.columnIndex };
|
|
1708
|
-
return this.pressed = null, this.state =
|
|
1709
|
+
return this.pressed = null, this.state = kt, this.emit(), t;
|
|
1709
1710
|
}
|
|
1710
1711
|
/** Esc while resizing: puts the width back. */
|
|
1711
1712
|
cancel() {
|
|
1712
1713
|
if (!this.isResizing || !this.pressed) return;
|
|
1713
1714
|
const { columnIndex: t } = this.state, { width: n } = this.pressed;
|
|
1714
|
-
this.pressed = null, this.state =
|
|
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;
|
|
@@ -1739,13 +1740,13 @@ class ss {
|
|
|
1739
1740
|
columnCount: a,
|
|
1740
1741
|
containerWidth: s,
|
|
1741
1742
|
containerHeight: r,
|
|
1742
|
-
rowInitSize:
|
|
1743
|
-
columnInitSize:
|
|
1743
|
+
rowInitSize: l = 0,
|
|
1744
|
+
columnInitSize: c = 0,
|
|
1744
1745
|
rowHeightMap: u = {},
|
|
1745
1746
|
columnWidthMap: h = {},
|
|
1746
1747
|
freezeColumnCount: m = 1
|
|
1747
1748
|
}) {
|
|
1748
|
-
this.defaultRowHeight = t, this.defaultColumnWidth = n, this.rowCount = o, this.pureRowCount = i, this.columnCount = a, this.rowInitSize =
|
|
1749
|
+
this.defaultRowHeight = t, this.defaultColumnWidth = n, this.rowCount = o, this.pureRowCount = i, this.columnCount = a, this.rowInitSize = l, this.columnInitSize = c, this._containerWidth = s, this._containerHeight = r, this.rowHeightMap = u, this.columnWidthMap = h, this._freezeColumnCount = m;
|
|
1749
1750
|
}
|
|
1750
1751
|
/** Width of the row header plus the frozen columns. */
|
|
1751
1752
|
get freezeRegionWidth() {
|
|
@@ -1782,11 +1783,11 @@ class ss {
|
|
|
1782
1783
|
this.defaultRowHeight = t;
|
|
1783
1784
|
}
|
|
1784
1785
|
get totalWidth() {
|
|
1785
|
-
const { offset: t, size: n } = this.getCellMetaData(this.columnCount - 1,
|
|
1786
|
+
const { offset: t, size: n } = this.getCellMetaData(this.columnCount - 1, Z.Column);
|
|
1786
1787
|
return t + n;
|
|
1787
1788
|
}
|
|
1788
1789
|
get totalHeight() {
|
|
1789
|
-
const { offset: t, size: n } = this.getCellMetaData(this.rowCount - 1,
|
|
1790
|
+
const { offset: t, size: n } = this.getCellMetaData(this.rowCount - 1, Z.Row);
|
|
1790
1791
|
return t + n;
|
|
1791
1792
|
}
|
|
1792
1793
|
getRowHeight(t) {
|
|
@@ -1797,22 +1798,22 @@ class ss {
|
|
|
1797
1798
|
}
|
|
1798
1799
|
/** Offset and size of one row or column, extending the prefix-sum cache up to `index` when needed. */
|
|
1799
1800
|
getCellMetaData(t, n) {
|
|
1800
|
-
const o = n ===
|
|
1801
|
+
const o = n === Z.Column, i = o ? this.columnWidth : this.rowHeight;
|
|
1801
1802
|
let a = o ? this.columnInitSize : this.rowInitSize;
|
|
1802
1803
|
const s = o ? this.lastColumnIndex : this.lastRowIndex, r = o ? this.columnMetaDataMap : this.rowMetaDataMap;
|
|
1803
1804
|
if (t > s) {
|
|
1804
|
-
const
|
|
1805
|
-
s >= 0 &&
|
|
1806
|
-
for (let
|
|
1807
|
-
const u = (o ? this.columnWidthMap[
|
|
1808
|
-
r[
|
|
1805
|
+
const l = r[s];
|
|
1806
|
+
s >= 0 && l && (a = l.offset + l.size);
|
|
1807
|
+
for (let c = s + 1; c <= t; c++) {
|
|
1808
|
+
const u = (o ? this.columnWidthMap[c] : this.rowHeightMap[c]) ?? i;
|
|
1809
|
+
r[c] = { offset: a, size: u }, a += u;
|
|
1809
1810
|
}
|
|
1810
1811
|
o ? this.lastColumnIndex = t : this.lastRowIndex = t;
|
|
1811
1812
|
}
|
|
1812
1813
|
return r[t] ?? { size: 0, offset: 0 };
|
|
1813
1814
|
}
|
|
1814
1815
|
findNearestCellIndexLinear(t, n, o) {
|
|
1815
|
-
const i = o ===
|
|
1816
|
+
const i = o === Z.Column ? this.columnCount : this.rowCount;
|
|
1816
1817
|
let a = 1;
|
|
1817
1818
|
for (; t < i && this.getCellMetaData(t, o).offset < n; )
|
|
1818
1819
|
t += a, a *= 2;
|
|
@@ -1828,34 +1829,34 @@ class ss {
|
|
|
1828
1829
|
}
|
|
1829
1830
|
/** Index of the row or column that contains `offset` (in content coordinates, headers included). */
|
|
1830
1831
|
findNearestCellIndex(t, n) {
|
|
1831
|
-
const o = n ===
|
|
1832
|
+
const o = n === Z.Column, i = o ? this.columnMetaDataMap : this.rowMetaDataMap, a = o ? this.lastColumnIndex : this.lastRowIndex;
|
|
1832
1833
|
return (a > 0 ? i[a]?.offset ?? 0 : 0) >= t ? this.findNearestCellIndexBinary(t, 0, a, n) : this.findNearestCellIndexLinear(Math.max(0, a), t, n);
|
|
1833
1834
|
}
|
|
1834
1835
|
getRowStartIndex(t) {
|
|
1835
|
-
return this.findNearestCellIndex(t,
|
|
1836
|
+
return this.findNearestCellIndex(t, Z.Row);
|
|
1836
1837
|
}
|
|
1837
1838
|
getRowStopIndex(t, n) {
|
|
1838
|
-
const o = this.getCellMetaData(t,
|
|
1839
|
+
const o = this.getCellMetaData(t, Z.Row), i = n + this._containerHeight;
|
|
1839
1840
|
let a = o.offset + o.size, s = t;
|
|
1840
1841
|
for (; s < this.rowCount - 1 && a < i; )
|
|
1841
|
-
s++, a += this.getCellMetaData(s,
|
|
1842
|
+
s++, a += this.getCellMetaData(s, Z.Row).size;
|
|
1842
1843
|
return s;
|
|
1843
1844
|
}
|
|
1844
1845
|
getColumnStartIndex(t) {
|
|
1845
|
-
return this.findNearestCellIndex(t,
|
|
1846
|
+
return this.findNearestCellIndex(t, Z.Column);
|
|
1846
1847
|
}
|
|
1847
1848
|
getColumnStopIndex(t, n) {
|
|
1848
|
-
const o = this.getCellMetaData(t,
|
|
1849
|
+
const o = this.getCellMetaData(t, Z.Column), i = n + this._containerWidth;
|
|
1849
1850
|
let a = o.offset + o.size, s = t;
|
|
1850
1851
|
for (; s < this.columnCount - 1 && a < i; )
|
|
1851
|
-
s++, a += this.getCellMetaData(s,
|
|
1852
|
+
s++, a += this.getCellMetaData(s, Z.Column).size;
|
|
1852
1853
|
return s;
|
|
1853
1854
|
}
|
|
1854
1855
|
getRowOffset(t) {
|
|
1855
|
-
return this.getCellMetaData(t,
|
|
1856
|
+
return this.getCellMetaData(t, Z.Row).offset;
|
|
1856
1857
|
}
|
|
1857
1858
|
getColumnOffset(t) {
|
|
1858
|
-
return this.getCellMetaData(t,
|
|
1859
|
+
return this.getCellMetaData(t, Z.Column).offset;
|
|
1859
1860
|
}
|
|
1860
1861
|
/** Column x on screen: frozen columns ignore horizontal scroll. */
|
|
1861
1862
|
getColumnRelativeOffset(t, n) {
|
|
@@ -1869,12 +1870,12 @@ class ss {
|
|
|
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,26 +1883,26 @@ const rs = 240, ls = ({
|
|
|
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
|
-
let [r,
|
|
1888
|
-
n.jump ? t === "up" ?
|
|
1889
|
-
const
|
|
1888
|
+
let [r, l] = e.ranges[s ? 1 : 0];
|
|
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);
|
|
1890
|
+
const c = [r, l], u = s ? [e.ranges[0], c] : [c, c];
|
|
1890
1891
|
return {
|
|
1891
1892
|
selection: e.setRanges(u),
|
|
1892
|
-
...s ? {} : { activeCell:
|
|
1893
|
-
scrollTo:
|
|
1893
|
+
...s ? {} : { activeCell: c },
|
|
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];
|
|
1902
1903
|
return { selection: e.set(H.Cells, [r, r]), activeCell: r, scrollTo: r };
|
|
1903
1904
|
};
|
|
1904
|
-
class
|
|
1905
|
+
class se {
|
|
1905
1906
|
type;
|
|
1906
1907
|
ranges;
|
|
1907
1908
|
constructor(t = H.None, n = []) {
|
|
@@ -1926,10 +1927,10 @@ class oe {
|
|
|
1926
1927
|
if (!Array.isArray(n)) throw new Error("Ranges of the selection should be an array type!");
|
|
1927
1928
|
if (t === H.Cells && n.length < 2) throw new Error("Ranges of type cells should have a length greater than 2!");
|
|
1928
1929
|
if ((t === H.Columns || t === H.Rows) && !n.length) throw new Error("Ranges of type columns or rows should have a length greater than 1!");
|
|
1929
|
-
return new
|
|
1930
|
+
return new se(t, n);
|
|
1930
1931
|
}
|
|
1931
1932
|
setRanges(t) {
|
|
1932
|
-
return new
|
|
1933
|
+
return new se(this.type, t);
|
|
1933
1934
|
}
|
|
1934
1935
|
isOverlap(t, n) {
|
|
1935
1936
|
return !(t[1] < n[0] || t[0] > n[1]);
|
|
@@ -1941,10 +1942,10 @@ class oe {
|
|
|
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
|
|
1945
|
+
return n || o.push(t), new se(this.type, Ft(o));
|
|
1945
1946
|
}
|
|
1946
1947
|
case H.Cells:
|
|
1947
|
-
return new
|
|
1948
|
+
return new se(this.type, [this.ranges[0], t]);
|
|
1948
1949
|
default:
|
|
1949
1950
|
return Ge;
|
|
1950
1951
|
}
|
|
@@ -1954,25 +1955,25 @@ class oe {
|
|
|
1954
1955
|
switch (this.type) {
|
|
1955
1956
|
case H.Rows:
|
|
1956
1957
|
case H.Columns: {
|
|
1957
|
-
const n =
|
|
1958
|
-
return n.length ? new
|
|
1958
|
+
const n = pi(this.ranges, t);
|
|
1959
|
+
return n.length ? new se(this.type, n) : Ge;
|
|
1959
1960
|
}
|
|
1960
1961
|
case H.Cells:
|
|
1961
|
-
return new
|
|
1962
|
+
return new se(this.type, [this.ranges[0], t]);
|
|
1962
1963
|
default:
|
|
1963
1964
|
return Ge;
|
|
1964
1965
|
}
|
|
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,20 +1991,20 @@ class oe {
|
|
|
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
|
-
const Ge = new
|
|
2005
|
-
class
|
|
2006
|
-
selection = new
|
|
2005
|
+
const Ge = new se(H.None, []);
|
|
2006
|
+
class ws {
|
|
2007
|
+
selection = new se();
|
|
2007
2008
|
activeCell = null;
|
|
2008
2009
|
isSelecting = !1;
|
|
2009
2010
|
prevSelectedRowIndex = null;
|
|
@@ -2012,13 +2013,13 @@ class hs {
|
|
|
2012
2013
|
this.options = t;
|
|
2013
2014
|
}
|
|
2014
2015
|
get selectable() {
|
|
2015
|
-
return this.options.selectable ??
|
|
2016
|
+
return this.options.selectable ?? K.All;
|
|
2016
2017
|
}
|
|
2017
2018
|
get isMultiSelectionEnable() {
|
|
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) {
|
|
@@ -2031,24 +2032,26 @@ class hs {
|
|
|
2031
2032
|
}
|
|
2032
2033
|
onSelectionStart(t, n) {
|
|
2033
2034
|
const o = this.selectable;
|
|
2034
|
-
if (o !==
|
|
2035
|
-
const { type: i, rowIndex: a, columnIndex: s } = n, { isRowSelection: r, ranges:
|
|
2035
|
+
if (o !== K.All && o !== K.Cell) return;
|
|
2036
|
+
const { type: i, rowIndex: a, columnIndex: s } = n, { isRowSelection: r, ranges: l } = this.selection, c = t.shiftKey && !t.metaKey;
|
|
2036
2037
|
switch (i) {
|
|
2037
|
-
case
|
|
2038
|
-
case
|
|
2039
|
-
const { realIndex: u } = this.getLinearRow(a), h = [s, u], m =
|
|
2038
|
+
case b.Cell:
|
|
2039
|
+
case b.ActiveCell: {
|
|
2040
|
+
const { realIndex: u } = this.getLinearRow(a), h = [s, u], m = c && !r && l[0] != null, g = [m ? l[0] : h, h];
|
|
2040
2041
|
this.isMultiSelectionEnable && (this.isSelecting = !0), this.update({
|
|
2041
2042
|
selection: this.selection.set(H.Cells, g),
|
|
2042
2043
|
...m ? {} : { activeCell: h }
|
|
2043
2044
|
});
|
|
2044
2045
|
return;
|
|
2045
2046
|
}
|
|
2046
|
-
|
|
2047
|
-
case
|
|
2048
|
-
case
|
|
2049
|
-
case
|
|
2050
|
-
case
|
|
2051
|
-
case
|
|
2047
|
+
// The expand control opens the record on release; the selection stays.
|
|
2048
|
+
case b.RowHeaderExpandHandler:
|
|
2049
|
+
case b.RowHeaderDragHandler:
|
|
2050
|
+
case b.RowHeaderCheckbox:
|
|
2051
|
+
case b.ColumnHeader:
|
|
2052
|
+
case b.AllCheckbox:
|
|
2053
|
+
case b.RowHeader:
|
|
2054
|
+
case b.AppendRow:
|
|
2052
2055
|
return;
|
|
2053
2056
|
default:
|
|
2054
2057
|
this.update({ selection: this.selection.reset(), activeCell: null });
|
|
@@ -2057,14 +2060,14 @@ class hs {
|
|
|
2057
2060
|
/** Moves the head to the cell under the pointer while drag-selecting. Positions above or left of the grid clamp to 0. */
|
|
2058
2061
|
onSelectionChange(t) {
|
|
2059
2062
|
if (!this.isSelecting) return;
|
|
2060
|
-
const { isCellSelection: n, ranges: o } = this.selection, { rowIndex: i, columnIndex: a } = t, s = Number.isFinite(i) ? i : 0, r = Number.isFinite(a) ? a : 0, { realIndex:
|
|
2061
|
-
n && !this.selection.equals([o[0],
|
|
2063
|
+
const { isCellSelection: n, ranges: o } = this.selection, { rowIndex: i, columnIndex: a } = t, s = Number.isFinite(i) ? i : 0, r = Number.isFinite(a) ? a : 0, { realIndex: l } = this.getLinearRow(s), c = [r, l];
|
|
2064
|
+
n && !this.selection.equals([o[0], c]) && this.update({ selection: this.selection.merge(c) });
|
|
2062
2065
|
}
|
|
2063
2066
|
onSelectionEnd() {
|
|
2064
2067
|
this.isSelecting = !1;
|
|
2065
2068
|
}
|
|
2066
2069
|
onSelectionClick(t, n) {
|
|
2067
|
-
const { shiftKey: o, metaKey: i } = t, a = o && !i, s = i && !o, { type: r, rowIndex:
|
|
2070
|
+
const { shiftKey: o, metaKey: i } = t, a = o && !i, s = i && !o, { type: r, rowIndex: l, columnIndex: c } = n, u = this.selection, { ranges: h, isColumnSelection: m, isRowSelection: g } = u, C = this.selectable, S = this.isMultiSelectionEnable, p = (v, y) => {
|
|
2068
2071
|
const R = [v, v], I = g && (S || h[0][0] === v) ? u.merge(R) : u.set(y, [R]);
|
|
2069
2072
|
I.includes(R) && (this.prevSelectedRowIndex = v), this.update({ selection: I, activeCell: null });
|
|
2070
2073
|
}, w = (v) => {
|
|
@@ -2076,37 +2079,37 @@ class hs {
|
|
|
2076
2079
|
return;
|
|
2077
2080
|
}
|
|
2078
2081
|
const R = u.includes(y);
|
|
2079
|
-
p(v, H.Rows), this.options.onRowControlClick?.(v,
|
|
2082
|
+
p(v, H.Rows), this.options.onRowControlClick?.(v, $.Checkbox, !R);
|
|
2080
2083
|
};
|
|
2081
2084
|
switch (r) {
|
|
2082
|
-
case
|
|
2083
|
-
if (C !==
|
|
2084
|
-
const v = S && a && m ? h[0][0] :
|
|
2085
|
+
case b.ColumnHeader: {
|
|
2086
|
+
if (C !== K.All && C !== K.Column) return;
|
|
2087
|
+
const v = S && a && m ? h[0][0] : c, y = [[Math.min(v, c), Math.max(v, c)]];
|
|
2085
2088
|
let R = u.set(H.Columns, y);
|
|
2086
|
-
if (S && s && m && (R = u.merge([
|
|
2089
|
+
if (S && s && m && (R = u.merge([c, c])), !a || !m) {
|
|
2087
2090
|
this.update({ selection: R, activeCell: R.isNoneSelection ? null : [R.ranges[0][0], 0] });
|
|
2088
2091
|
return;
|
|
2089
2092
|
}
|
|
2090
2093
|
this.update({ selection: R });
|
|
2091
2094
|
return;
|
|
2092
2095
|
}
|
|
2093
|
-
case
|
|
2094
|
-
if (C !==
|
|
2095
|
-
w(this.getLinearRow(
|
|
2096
|
+
case b.RowHeaderCheckbox: {
|
|
2097
|
+
if (C !== K.All && C !== K.Row) return;
|
|
2098
|
+
w(this.getLinearRow(l).realIndex);
|
|
2096
2099
|
return;
|
|
2097
2100
|
}
|
|
2098
|
-
case
|
|
2099
|
-
const { realIndex: v } = this.getLinearRow(
|
|
2100
|
-
if (C ===
|
|
2101
|
+
case b.Cell: {
|
|
2102
|
+
const { realIndex: v } = this.getLinearRow(l);
|
|
2103
|
+
if (C === K.Row) {
|
|
2101
2104
|
if (this.options.isRowClickSelectionEnabled === !1) return;
|
|
2102
2105
|
w(v);
|
|
2103
2106
|
return;
|
|
2104
2107
|
}
|
|
2105
|
-
C ===
|
|
2108
|
+
C === K.Column && p(c, H.Columns);
|
|
2106
2109
|
return;
|
|
2107
2110
|
}
|
|
2108
|
-
case
|
|
2109
|
-
if (C !==
|
|
2111
|
+
case b.AllCheckbox: {
|
|
2112
|
+
if (C !== K.All && C !== K.Row) return;
|
|
2110
2113
|
const v = [[0, this.options.getPureRowCount() - 1]];
|
|
2111
2114
|
if (g && u.equals(v)) {
|
|
2112
2115
|
this.update({ selection: u.reset() });
|
|
@@ -2123,74 +2126,74 @@ class hs {
|
|
|
2123
2126
|
*/
|
|
2124
2127
|
onSelectionContextMenu(t, n) {
|
|
2125
2128
|
const { x: o, y: i, columnIndex: a, rowIndex: s, type: r } = t;
|
|
2126
|
-
if (r ===
|
|
2127
|
-
const
|
|
2129
|
+
if (r === b.Blank) return;
|
|
2130
|
+
const l = this.selection, { isCellSelection: c, isRowSelection: u, isColumnSelection: h } = l, m = a >= -1 && s > -1, g = a > -1 && s === -1;
|
|
2128
2131
|
if (m) {
|
|
2129
|
-
const { realIndex: C } = this.getLinearRow(s), S =
|
|
2130
|
-
if (
|
|
2132
|
+
const { realIndex: C } = this.getLinearRow(s), S = c ? [a, C] : u ? [C, C] : h ? [a, a] : void 0;
|
|
2133
|
+
if (l.includes(S)) return n(l, { x: o, y: i });
|
|
2131
2134
|
if (a > -1) {
|
|
2132
|
-
const p = [a, C], w =
|
|
2135
|
+
const p = [a, C], w = l.set(H.Cells, [p, p]);
|
|
2133
2136
|
return this.update({ selection: w, activeCell: p }), n(w, { x: o, y: i });
|
|
2134
2137
|
}
|
|
2135
2138
|
}
|
|
2136
2139
|
if (g) {
|
|
2137
|
-
if (h &&
|
|
2138
|
-
const C =
|
|
2140
|
+
if (h && l.includes([a, a])) return n(l, { x: o, y: i });
|
|
2141
|
+
const C = l.set(H.Columns, [[a, a]]);
|
|
2139
2142
|
this.update({ selection: C, activeCell: [a, 0] }), n(C, { x: o, y: i });
|
|
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
|
-
const s = o.slice(1).map((
|
|
2159
|
+
const s = o.slice(1).map((l, c) => l - o[c]);
|
|
2157
2160
|
let r = o[o.length - 1];
|
|
2158
|
-
for (let
|
|
2159
|
-
r += s[
|
|
2161
|
+
for (let l = 0; l < t; l++)
|
|
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
|
-
},
|
|
2169
|
-
drag:
|
|
2170
|
-
expand:
|
|
2171
|
-
checkbox:
|
|
2172
|
-
},
|
|
2173
|
-
none:
|
|
2174
|
-
cell:
|
|
2175
|
-
row:
|
|
2176
|
-
column:
|
|
2177
|
-
all:
|
|
2178
|
-
},
|
|
2179
|
-
none:
|
|
2180
|
-
column:
|
|
2181
|
-
row:
|
|
2182
|
-
all:
|
|
2183
|
-
},
|
|
2171
|
+
}, Un = 20, Et = {
|
|
2172
|
+
drag: $.Drag,
|
|
2173
|
+
expand: $.Expand,
|
|
2174
|
+
checkbox: $.Checkbox
|
|
2175
|
+
}, xs = {
|
|
2176
|
+
none: K.None,
|
|
2177
|
+
cell: K.Cell,
|
|
2178
|
+
row: K.Row,
|
|
2179
|
+
column: K.Column,
|
|
2180
|
+
all: K.All
|
|
2181
|
+
}, Rs = {
|
|
2182
|
+
none: he.None,
|
|
2183
|
+
column: he.Column,
|
|
2184
|
+
row: he.Row,
|
|
2185
|
+
all: he.All
|
|
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 ms = (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 Is {
|
|
|
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
|
-
a ===
|
|
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 Is {
|
|
|
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 Is {
|
|
|
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 Is {
|
|
|
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 Is {
|
|
|
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 Is {
|
|
|
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 Is {
|
|
|
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 Is {
|
|
|
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 Is {
|
|
|
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 Is {
|
|
|
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 Is {
|
|
|
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 Is {
|
|
|
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
|
|
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) {
|
|
@@ -2413,12 +2416,12 @@ class Is {
|
|
|
2413
2416
|
const [n, o] = t, { coord: i } = this, a = B.cellScrollBuffer;
|
|
2414
2417
|
let { scrollLeft: s, scrollTop: r } = this.scroll;
|
|
2415
2418
|
if (n >= i.freezeColumnCount && n < i.columnCount) {
|
|
2416
|
-
const
|
|
2417
|
-
|
|
2419
|
+
const l = i.getColumnOffset(n), c = l + i.getColumnWidth(n), u = s + i.freezeRegionWidth, h = s + this.width;
|
|
2420
|
+
l < u ? s = l - i.freezeRegionWidth : c > h && (s = c - this.width + a);
|
|
2418
2421
|
}
|
|
2419
2422
|
if (o >= 0 && o < i.rowCount) {
|
|
2420
|
-
const
|
|
2421
|
-
|
|
2423
|
+
const l = i.getRowOffset(o), c = l + i.getRowHeight(o), u = r + i.rowInitSize, h = r + this.height;
|
|
2424
|
+
l < u ? r = l - i.rowInitSize : c > h && (r = c - this.height + a);
|
|
2422
2425
|
}
|
|
2423
2426
|
this.scrollTo(s, r);
|
|
2424
2427
|
}
|
|
@@ -2448,6 +2451,10 @@ class Is {
|
|
|
2448
2451
|
get isResizeEnabled() {
|
|
2449
2452
|
return this.config.columnResizable && !this.config.touch;
|
|
2450
2453
|
}
|
|
2454
|
+
/** A click on the row number opens the record (someone listens for `rowExpand`). */
|
|
2455
|
+
get canExpandRow() {
|
|
2456
|
+
return !!this.hooks.canExpandRow?.();
|
|
2457
|
+
}
|
|
2451
2458
|
/** True while the fill handle is dragged. */
|
|
2452
2459
|
get isFilling() {
|
|
2453
2460
|
return this.fillSource != null;
|
|
@@ -2473,13 +2480,13 @@ class Is {
|
|
|
2473
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]) };
|
|
2474
2481
|
}
|
|
2475
2482
|
hitTest(t) {
|
|
2476
|
-
return
|
|
2483
|
+
return Ei(this.regionContext(), t);
|
|
2477
2484
|
}
|
|
2478
2485
|
// ---- pointer ----------------------------------------------------------
|
|
2479
2486
|
/** Returns true when the press belongs to the grid (the host then claims focus). */
|
|
2480
2487
|
pointerDown(t) {
|
|
2481
2488
|
const n = { x: t.x, y: t.y }, o = this.hitTest(n);
|
|
2482
|
-
return this.mouseState = o, this.down = { state: o, point: n }, this.lastPoint = n, this.lastModifiers = { shiftKey: t.shiftKey, commandKey: t.commandKey }, o.type ===
|
|
2489
|
+
return this.mouseState = o, this.down = { state: o, point: n }, this.lastPoint = n, this.lastModifiers = { shiftKey: t.shiftKey, commandKey: t.commandKey }, o.type === b.Blank || o.type === b.None ? (this.hooks.render(), !1) : o.type === b.FillHandler && (this.fillSource = qe(this.getSelection(), { rowCount: this.config.rowCount, columnCount: this.config.columns.length }), this.fillSource) ? (this.hooks.render(), !0) : (this.isResizeEnabled && this.resize.start(o) || (this.drag.start(o), this.selection.onSelectionStart({ shiftKey: t.shiftKey, metaKey: t.commandKey }, o), this.hooks.render()), !0);
|
|
2483
2490
|
}
|
|
2484
2491
|
/** Hover and gestures. `fromAutoScroll` re-derives the head after an auto-scroll tick. */
|
|
2485
2492
|
pointerMove(t, n = !1) {
|
|
@@ -2513,8 +2520,8 @@ class Is {
|
|
|
2513
2520
|
return;
|
|
2514
2521
|
}
|
|
2515
2522
|
if (this.dragState.isDragging) {
|
|
2516
|
-
const
|
|
2517
|
-
this.drag.end(n, (u, h) => this.hooks.reorder(
|
|
2523
|
+
const c = this.dragState.type === O.Columns ? "columns" : "rows";
|
|
2524
|
+
this.drag.end(n, (u, h) => this.hooks.reorder(c, u.map((m) => [m[0], m[1]]), h)), this.selection.onSelectionEnd();
|
|
2518
2525
|
return;
|
|
2519
2526
|
}
|
|
2520
2527
|
this.drag.cancel();
|
|
@@ -2525,29 +2532,36 @@ class Is {
|
|
|
2525
2532
|
a && this.hooks.render();
|
|
2526
2533
|
return;
|
|
2527
2534
|
}
|
|
2528
|
-
const
|
|
2535
|
+
const l = { shiftKey: t.shiftKey, metaKey: t.commandKey };
|
|
2529
2536
|
switch (s.type) {
|
|
2530
|
-
case
|
|
2537
|
+
case b.RowHeaderExpandHandler:
|
|
2531
2538
|
this.hooks.rowExpand(s.rowIndex);
|
|
2532
2539
|
return;
|
|
2533
|
-
case
|
|
2534
|
-
|
|
2535
|
-
|
|
2540
|
+
case b.RowHeader:
|
|
2541
|
+
if (this.canExpandRow) {
|
|
2542
|
+
this.hooks.rowExpand(s.rowIndex);
|
|
2543
|
+
return;
|
|
2544
|
+
}
|
|
2545
|
+
this.selection.onSelectionClick(l, s);
|
|
2546
|
+
return;
|
|
2547
|
+
case b.ColumnHeaderMenu: {
|
|
2548
|
+
const c = this.coord.getColumnRelativeOffset(s.columnIndex, this.scroll.scrollLeft);
|
|
2549
|
+
this.hooks.headerMenu(s.columnIndex, { x: c, y: 0, width: this.coord.getColumnWidth(s.columnIndex), height: this.coord.rowInitSize });
|
|
2536
2550
|
return;
|
|
2537
2551
|
}
|
|
2538
2552
|
default:
|
|
2539
|
-
this.selection.onSelectionClick(
|
|
2553
|
+
this.selection.onSelectionClick(l, s);
|
|
2540
2554
|
}
|
|
2541
2555
|
}
|
|
2542
2556
|
endFill(t) {
|
|
2543
2557
|
const n = this.fillSource;
|
|
2544
2558
|
this.fillSource = null;
|
|
2545
|
-
const o =
|
|
2559
|
+
const o = vs(n, this.fillTargetRow(t), this.config.rowCount);
|
|
2546
2560
|
if (!o) {
|
|
2547
2561
|
this.hooks.render();
|
|
2548
2562
|
return;
|
|
2549
2563
|
}
|
|
2550
|
-
const i =
|
|
2564
|
+
const i = Ss(o), a = this.selection.activeCell;
|
|
2551
2565
|
this.selection.update({
|
|
2552
2566
|
selection: this.selection.selection.set(H.Cells, [[i.startColumn, i.startRow], [i.endColumn, i.endRow]]),
|
|
2553
2567
|
...a ? {} : { activeCell: [n.startColumn, n.startRow] }
|
|
@@ -2567,7 +2581,7 @@ class Is {
|
|
|
2567
2581
|
}
|
|
2568
2582
|
doubleClick(t) {
|
|
2569
2583
|
const n = this.hitTest(t);
|
|
2570
|
-
n.type !==
|
|
2584
|
+
n.type !== b.Cell && n.type !== b.ActiveCell || this.requestEdit([n.columnIndex, n.rowIndex], "dblclick", !1);
|
|
2571
2585
|
}
|
|
2572
2586
|
contextMenu(t) {
|
|
2573
2587
|
const n = this.hitTest(t);
|
|
@@ -2580,7 +2594,7 @@ class Is {
|
|
|
2580
2594
|
/** True when `cell` is the active cell and the whole selection. */
|
|
2581
2595
|
isSoleActiveCell(t) {
|
|
2582
2596
|
const { selection: n, activeCell: o } = this.selection;
|
|
2583
|
-
if (!n.isCellSelection || !
|
|
2597
|
+
if (!n.isCellSelection || !Io(o, t)) return !1;
|
|
2584
2598
|
const [i, a] = n.ranges;
|
|
2585
2599
|
return !!i && !!a && i[0] === a[0] && i[1] === a[1];
|
|
2586
2600
|
}
|
|
@@ -2604,8 +2618,8 @@ class Is {
|
|
|
2604
2618
|
this.mouseState = n;
|
|
2605
2619
|
const o = { shiftKey: !1, metaKey: !1 }, i = this.config.rowControls;
|
|
2606
2620
|
switch (n.type) {
|
|
2607
|
-
case
|
|
2608
|
-
case
|
|
2621
|
+
case b.Cell:
|
|
2622
|
+
case b.ActiveCell: {
|
|
2609
2623
|
const a = [n.columnIndex, n.rowIndex], s = this.config.selectable;
|
|
2610
2624
|
if (this.isPhone)
|
|
2611
2625
|
s !== "none" && this.selectCell([a[0], a[1]], !1), this.hooks.rowExpand(a[1], a[0]);
|
|
@@ -2616,27 +2630,27 @@ class Is {
|
|
|
2616
2630
|
}
|
|
2617
2631
|
this.selectCell([a[0], a[1]], !1);
|
|
2618
2632
|
} else
|
|
2619
|
-
this.selection.onSelectionClick(o, { ...n, type:
|
|
2633
|
+
this.selection.onSelectionClick(o, { ...n, type: b.Cell });
|
|
2620
2634
|
this.hooks.render();
|
|
2621
2635
|
return;
|
|
2622
2636
|
}
|
|
2623
|
-
case
|
|
2624
|
-
case
|
|
2637
|
+
case b.ColumnHeader:
|
|
2638
|
+
case b.ColumnHeaderMenu: {
|
|
2625
2639
|
if (this.config.columns[n.columnIndex]?.hasMenu) {
|
|
2626
2640
|
const a = this.coord.getColumnRelativeOffset(n.columnIndex, this.scroll.scrollLeft);
|
|
2627
2641
|
this.hooks.headerMenu(n.columnIndex, { x: a, y: 0, width: this.coord.getColumnWidth(n.columnIndex), height: this.coord.rowInitSize });
|
|
2628
2642
|
return;
|
|
2629
2643
|
}
|
|
2630
|
-
this.selection.onSelectionClick(o, { ...n, type:
|
|
2644
|
+
this.selection.onSelectionClick(o, { ...n, type: b.ColumnHeader }), this.hooks.render();
|
|
2631
2645
|
return;
|
|
2632
2646
|
}
|
|
2633
|
-
case
|
|
2634
|
-
case
|
|
2635
|
-
case
|
|
2636
|
-
case
|
|
2637
|
-
this.isPhone || i.includes("expand") ? this.hooks.rowExpand(n.rowIndex) : i.includes("checkbox") && this.selection.onSelectionClick(o, { ...n, type:
|
|
2647
|
+
case b.RowHeader:
|
|
2648
|
+
case b.RowHeaderCheckbox:
|
|
2649
|
+
case b.RowHeaderDragHandler:
|
|
2650
|
+
case b.RowHeaderExpandHandler:
|
|
2651
|
+
this.isPhone || i.includes("expand") ? this.hooks.rowExpand(n.rowIndex) : i.includes("checkbox") && this.selection.onSelectionClick(o, { ...n, type: b.RowHeaderCheckbox }), this.hooks.render();
|
|
2638
2652
|
return;
|
|
2639
|
-
case
|
|
2653
|
+
case b.AllCheckbox:
|
|
2640
2654
|
this.selection.onSelectionClick(o, n), this.hooks.render();
|
|
2641
2655
|
return;
|
|
2642
2656
|
default:
|
|
@@ -2663,7 +2677,7 @@ class Is {
|
|
|
2663
2677
|
moveAfterEdit(t, n) {
|
|
2664
2678
|
const { rowCount: o, columns: i } = this.config;
|
|
2665
2679
|
if (!o || !i.length) return;
|
|
2666
|
-
const a = { pureRowCount: o, columnCount: i.length }, s = new
|
|
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);
|
|
2667
2681
|
this.selection.update({ selection: r.selection, activeCell: r.activeCell }), this.scrollToCell(r.scrollTo);
|
|
2668
2682
|
}
|
|
2669
2683
|
/** An input method started composing on the selected cell. */
|
|
@@ -2678,38 +2692,38 @@ class Is {
|
|
|
2678
2692
|
keyDown(t) {
|
|
2679
2693
|
if (t.key === "Escape" && this.down)
|
|
2680
2694
|
return this.cancelGesture(), "prevent";
|
|
2681
|
-
if (
|
|
2695
|
+
if (vo(t))
|
|
2682
2696
|
return this.compositionStart(), "pass";
|
|
2683
2697
|
const { rowCount: n, columns: o } = this.config;
|
|
2684
2698
|
if (!n || !o.length) return "ignore";
|
|
2685
2699
|
const i = { pureRowCount: n, columnCount: o.length }, a = this.selection.selection, s = this.selection.activeCell;
|
|
2686
2700
|
if (!a.isCellSelection || !s)
|
|
2687
|
-
return
|
|
2688
|
-
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];
|
|
2689
2703
|
if (r) {
|
|
2690
2704
|
if (t.altKey) return "ignore";
|
|
2691
|
-
const
|
|
2692
|
-
return this.selection.update({ selection:
|
|
2705
|
+
const l = fs(a, r, { expand: t.shiftKey, jump: t.commandKey }, i);
|
|
2706
|
+
return this.selection.update({ selection: l.selection, ...l.activeCell ? { activeCell: l.activeCell } : {} }), this.scrollToCell(l.scrollTo), "prevent";
|
|
2693
2707
|
}
|
|
2694
2708
|
switch (t.key) {
|
|
2695
2709
|
case "Tab": {
|
|
2696
|
-
const
|
|
2697
|
-
return this.selection.update({ selection:
|
|
2710
|
+
const l = Gn(a, t.shiftKey, i);
|
|
2711
|
+
return this.selection.update({ selection: l.selection, activeCell: l.activeCell }), this.scrollToCell(l.scrollTo), "prevent";
|
|
2698
2712
|
}
|
|
2699
2713
|
case "Home":
|
|
2700
2714
|
case "End": {
|
|
2701
|
-
const
|
|
2702
|
-
return this.selectCell([
|
|
2715
|
+
const l = a.ranges[t.shiftKey ? 1 : 0], c = t.key === "Home" ? 0 : o.length - 1, u = t.commandKey ? t.key === "Home" ? 0 : n - 1 : l[1];
|
|
2716
|
+
return this.selectCell([c, u], t.shiftKey), "prevent";
|
|
2703
2717
|
}
|
|
2704
2718
|
case "PageUp":
|
|
2705
2719
|
case "PageDown": {
|
|
2706
|
-
const
|
|
2707
|
-
return this.selectCell([
|
|
2720
|
+
const l = Math.max(1, Math.floor((this.height - this.coord.rowInitSize) / this.config.rowHeight)), c = a.ranges[t.shiftKey ? 1 : 0], u = Math.min(n - 1, Math.max(0, c[1] + (t.key === "PageUp" ? -l : l)));
|
|
2721
|
+
return this.selectCell([c[0], u], t.shiftKey), "prevent";
|
|
2708
2722
|
}
|
|
2709
2723
|
case "a":
|
|
2710
2724
|
case "A":
|
|
2711
2725
|
if (!t.commandKey || t.shiftKey || t.altKey) break;
|
|
2712
|
-
return this.selection.update({ selection:
|
|
2726
|
+
return this.selection.update({ selection: ps(a, i) }), "prevent";
|
|
2713
2727
|
case "Enter":
|
|
2714
2728
|
return t.shiftKey || t.altKey || t.commandKey ? "ignore" : (this.requestEdit(s, "enter", !1), "prevent");
|
|
2715
2729
|
case "F2":
|
|
@@ -2723,7 +2737,7 @@ class Is {
|
|
|
2723
2737
|
case "Escape":
|
|
2724
2738
|
return "ignore";
|
|
2725
2739
|
}
|
|
2726
|
-
return
|
|
2740
|
+
return Sa(t) ? this.requestEdit(s, "key", !0) ? "pass" : "prevent" : "ignore";
|
|
2727
2741
|
}
|
|
2728
2742
|
// ---- drawing ----------------------------------------------------------
|
|
2729
2743
|
/** Everything `drawGrid` needs except the theme and the cell/icon painters. */
|
|
@@ -2758,17 +2772,19 @@ class Is {
|
|
|
2758
2772
|
}
|
|
2759
2773
|
/** Cursor for the current hover state; set on the same move (spec §3.12). */
|
|
2760
2774
|
get cursor() {
|
|
2761
|
-
if (this.resize.isResizing || this.mouseState.type ===
|
|
2775
|
+
if (this.resize.isResizing || this.mouseState.type === b.ColumnResizeHandler) return "col-resize";
|
|
2762
2776
|
if (this.dragState.isDragging) return "grabbing";
|
|
2763
|
-
if (this.isFilling || this.mouseState.type ===
|
|
2777
|
+
if (this.isFilling || this.mouseState.type === b.FillHandler) return "crosshair";
|
|
2764
2778
|
switch (this.mouseState.type) {
|
|
2765
|
-
case
|
|
2779
|
+
case b.RowHeaderDragHandler:
|
|
2766
2780
|
return "grab";
|
|
2767
|
-
case
|
|
2768
|
-
case
|
|
2769
|
-
case
|
|
2770
|
-
case
|
|
2781
|
+
case b.RowHeaderExpandHandler:
|
|
2782
|
+
case b.RowHeaderCheckbox:
|
|
2783
|
+
case b.AllCheckbox:
|
|
2784
|
+
case b.ColumnHeaderMenu:
|
|
2771
2785
|
return "pointer";
|
|
2786
|
+
case b.RowHeader:
|
|
2787
|
+
return this.canExpandRow ? "pointer" : "default";
|
|
2772
2788
|
default:
|
|
2773
2789
|
return "default";
|
|
2774
2790
|
}
|
|
@@ -2777,31 +2793,31 @@ class Is {
|
|
|
2777
2793
|
this.autoScroller.stop();
|
|
2778
2794
|
}
|
|
2779
2795
|
}
|
|
2780
|
-
const
|
|
2796
|
+
const Ts = () => {
|
|
2781
2797
|
if (typeof navigator > "u") return !1;
|
|
2782
2798
|
const e = navigator.userAgentData?.platform ?? navigator.platform ?? "";
|
|
2783
2799
|
return /mac|iphone|ipad|ipod/i.test(e);
|
|
2784
|
-
},
|
|
2800
|
+
}, _n = (e, t) => {
|
|
2785
2801
|
const n = Number.parseFloat(e.getPropertyValue(t));
|
|
2786
2802
|
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
2787
|
-
},
|
|
2803
|
+
}, Ns = (e, t = { rowHeight: B.rowHeight, headerHeight: B.columnHeadHeight }) => {
|
|
2788
2804
|
const n = getComputedStyle(e);
|
|
2789
2805
|
return {
|
|
2790
|
-
rowHeight:
|
|
2791
|
-
headerHeight:
|
|
2806
|
+
rowHeight: _n(n, "--ui-grid-row-height") ?? t.rowHeight,
|
|
2807
|
+
headerHeight: _n(n, "--ui-grid-header-height") ?? t.headerHeight
|
|
2792
2808
|
};
|
|
2793
|
-
},
|
|
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 = {
|
|
2794
2810
|
role: "row",
|
|
2795
2811
|
"aria-rowindex": "1"
|
|
2796
|
-
},
|
|
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 = {
|
|
2797
2813
|
key: 1,
|
|
2798
2814
|
role: "status",
|
|
2799
2815
|
class: "sr-only"
|
|
2800
|
-
},
|
|
2816
|
+
}, Ys = {
|
|
2801
2817
|
key: 2,
|
|
2802
2818
|
"data-ui-grid-overlay": "",
|
|
2803
2819
|
style: { position: "absolute", inset: "0", "pointer-events": "none", "z-index": "3" }
|
|
2804
|
-
},
|
|
2820
|
+
}, js = 6, Qs = 250, Zs = 100, Js = 800, er = 300, tr = 300, Vr = /* @__PURE__ */ ei({
|
|
2805
2821
|
__name: "GridHost",
|
|
2806
2822
|
props: {
|
|
2807
2823
|
columns: {},
|
|
@@ -2835,15 +2851,15 @@ const Ps = () => {
|
|
|
2835
2851
|
},
|
|
2836
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"],
|
|
2837
2853
|
setup(e, { expose: t, emit: n }) {
|
|
2838
|
-
const o = e, i = n, a =
|
|
2839
|
-
let
|
|
2840
|
-
const
|
|
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);
|
|
2855
|
+
let I = Ue.danger;
|
|
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 = () => {
|
|
2841
2857
|
const d = o.loading && o.rowCount === 0;
|
|
2842
2858
|
return {
|
|
2843
2859
|
columns: o.columns,
|
|
2844
|
-
rowCount: d ?
|
|
2845
|
-
rowHeight:
|
|
2846
|
-
headerHeight:
|
|
2860
|
+
rowCount: d ? v.value ? N.value : 0 : o.rowCount,
|
|
2861
|
+
rowHeight: P.value,
|
|
2862
|
+
headerHeight: M.value,
|
|
2847
2863
|
freezeColumnCount: o.freezeColumnCount,
|
|
2848
2864
|
rowControls: o.rowControls,
|
|
2849
2865
|
selectable: d ? "none" : o.selectable,
|
|
@@ -2851,288 +2867,290 @@ const Ps = () => {
|
|
|
2851
2867
|
columnResizable: o.columnResizable,
|
|
2852
2868
|
readonly: o.readonly || d,
|
|
2853
2869
|
fillable: o.fillable,
|
|
2854
|
-
touch:
|
|
2870
|
+
touch: y.value
|
|
2855
2871
|
};
|
|
2856
|
-
},
|
|
2857
|
-
let
|
|
2858
|
-
const
|
|
2859
|
-
render: () =>
|
|
2872
|
+
}, W = () => o.loading && o.rowCount === 0;
|
|
2873
|
+
let F = 0, _, q = null, ae = null;
|
|
2874
|
+
const X = () => o.editing || L.active, A = new Hs(E(), {
|
|
2875
|
+
render: () => fe(),
|
|
2860
2876
|
selectionChange: (d) => {
|
|
2861
|
-
const f =
|
|
2862
|
-
|
|
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);
|
|
2863
2879
|
},
|
|
2864
2880
|
scrollTo: (d, f) => {
|
|
2865
|
-
const
|
|
2866
|
-
|
|
2881
|
+
const x = u.value;
|
|
2882
|
+
x && (x.scrollLeft = d, x.scrollTop = f);
|
|
2867
2883
|
},
|
|
2868
|
-
editRequest: (d, f,
|
|
2869
|
-
if ((
|
|
2870
|
-
|
|
2884
|
+
editRequest: (d, f, x, T) => {
|
|
2885
|
+
if ((x !== "tap" || f.editor !== "long-text") && L.open(d, f, x, "edit")) {
|
|
2886
|
+
Ze = x === "tap";
|
|
2871
2887
|
return;
|
|
2872
2888
|
}
|
|
2873
|
-
i("edit-request", { cell: d, column: f, trigger:
|
|
2889
|
+
i("edit-request", { cell: d, column: f, trigger: x, replace: T });
|
|
2874
2890
|
},
|
|
2875
|
-
viewRequest: (d, f,
|
|
2876
|
-
|
|
2891
|
+
viewRequest: (d, f, x) => {
|
|
2892
|
+
L.open(d, f, x, "view") && (Ze = x === "tap");
|
|
2877
2893
|
},
|
|
2878
2894
|
clearRequest: (d) => {
|
|
2879
2895
|
De(), i("clear-request", d);
|
|
2880
2896
|
},
|
|
2881
2897
|
rowExpand: (d, f) => f === void 0 ? i("row-expand", d) : i("row-expand", d, f),
|
|
2898
|
+
// Read at click time: listeners are vnode props, not reactive attrs.
|
|
2899
|
+
canExpandRow: () => !!(a?.vnode.props?.onRowExpand || a?.vnode.props?.onRowExpandOnce),
|
|
2882
2900
|
headerMenu: (d, f) => i("header-menu", d, f),
|
|
2883
|
-
columnResize: (d, f,
|
|
2884
|
-
|
|
2901
|
+
columnResize: (d, f, x) => {
|
|
2902
|
+
w.value = A.contentSize, x ? (i("column-resize-end", d, f), _o(d, f)) : i("column-resize", d, f);
|
|
2885
2903
|
},
|
|
2886
2904
|
fill: (d) => {
|
|
2887
2905
|
De(), i("fill-request", d);
|
|
2888
2906
|
},
|
|
2889
|
-
reorder: (d, f,
|
|
2890
|
-
d === "columns" ? i("column-reorder", { ranges: f, dropIndex:
|
|
2907
|
+
reorder: (d, f, x) => {
|
|
2908
|
+
d === "columns" ? i("column-reorder", { ranges: f, dropIndex: x }) : i("row-reorder", { ranges: f, dropIndex: x });
|
|
2891
2909
|
},
|
|
2892
2910
|
contextMenu: (d, f) => i("context-menu", { selection: d, x: f.x, y: f.y }),
|
|
2893
2911
|
// Skeleton rows are not data; callers fetch only for real rows.
|
|
2894
2912
|
visibleRangeChange: (d) => {
|
|
2895
|
-
|
|
2913
|
+
W() || i("visible-range-change", d);
|
|
2896
2914
|
}
|
|
2897
|
-
}),
|
|
2898
|
-
owner: () =>
|
|
2899
|
-
root: () =>
|
|
2915
|
+
}), L = ts({
|
|
2916
|
+
owner: () => m.value,
|
|
2917
|
+
root: () => l.value,
|
|
2900
2918
|
enabled: () => !!o.getEditText,
|
|
2901
2919
|
getEditText: (d) => o.getEditText?.(d) ?? "",
|
|
2902
|
-
validate: (d, f,
|
|
2920
|
+
validate: (d, f, x) => o.validateEdit?.(d, f, x),
|
|
2903
2921
|
columnAt: (d) => o.columns[d],
|
|
2904
|
-
rowHeight: () =>
|
|
2905
|
-
textBox: () =>
|
|
2922
|
+
rowHeight: () => P.value,
|
|
2923
|
+
textBox: () => k.value,
|
|
2906
2924
|
hasHint: () => !!o.editHint,
|
|
2907
|
-
hasSelection: () =>
|
|
2908
|
-
onCommit: ({ cell: d, column: f, value:
|
|
2909
|
-
De(), i("cell-commit", { cell: d, column: f, value:
|
|
2925
|
+
hasSelection: () => p.value.kind !== "none",
|
|
2926
|
+
onCommit: ({ cell: d, column: f, value: x, previous: T, reason: G }) => {
|
|
2927
|
+
De(), i("cell-commit", { cell: d, column: f, value: x, previous: T, reason: G }), A.invalidate();
|
|
2910
2928
|
},
|
|
2911
|
-
onEnd: (d, f,
|
|
2912
|
-
i("edit-end", { cell: d, column: f, committed:
|
|
2929
|
+
onEnd: (d, f, x) => {
|
|
2930
|
+
i("edit-end", { cell: d, column: f, committed: x }), fe();
|
|
2913
2931
|
},
|
|
2914
2932
|
moveSelection: (d) => {
|
|
2915
|
-
const f =
|
|
2916
|
-
f &&
|
|
2933
|
+
const f = L.state.value.cell ?? p.value.activeCell;
|
|
2934
|
+
f && A.moveAfterEdit(f, d);
|
|
2917
2935
|
},
|
|
2918
|
-
clearSelection: () =>
|
|
2936
|
+
clearSelection: () => A.setSelection({ kind: "none", ranges: [] }),
|
|
2919
2937
|
refocus: () => {
|
|
2920
|
-
if (
|
|
2921
|
-
|
|
2938
|
+
if (Ze && !L.active) {
|
|
2939
|
+
Ze = !1, m.value?.blur();
|
|
2922
2940
|
return;
|
|
2923
2941
|
}
|
|
2924
|
-
|
|
2942
|
+
Se();
|
|
2925
2943
|
}
|
|
2926
2944
|
});
|
|
2927
|
-
function
|
|
2928
|
-
|
|
2945
|
+
function fe() {
|
|
2946
|
+
F || typeof requestAnimationFrame > "u" || (F = requestAnimationFrame(Te));
|
|
2929
2947
|
}
|
|
2930
|
-
function
|
|
2931
|
-
|
|
2948
|
+
function Te() {
|
|
2949
|
+
F = 0;
|
|
2932
2950
|
const d = c.value;
|
|
2933
|
-
if (!d || !
|
|
2951
|
+
if (!d || !q) return;
|
|
2934
2952
|
const f = {
|
|
2935
|
-
...
|
|
2936
|
-
isEditing:
|
|
2953
|
+
...A.frame(),
|
|
2954
|
+
isEditing: X(),
|
|
2937
2955
|
highlightedRowIndex: o.highlightedRow,
|
|
2938
|
-
theme:
|
|
2939
|
-
height:
|
|
2940
|
-
drawCell:
|
|
2941
|
-
drawIcon: o.drawIcon ?
|
|
2956
|
+
theme: C.value,
|
|
2957
|
+
height: A.viewport.height,
|
|
2958
|
+
drawCell: Pe,
|
|
2959
|
+
drawIcon: o.drawIcon ? Ye : void 0
|
|
2942
2960
|
};
|
|
2943
|
-
|
|
2961
|
+
ua(d, q, f, _), _ = f, Ne(d), u.value && (u.value.style.cursor = A.cursor), je();
|
|
2944
2962
|
}
|
|
2945
|
-
function
|
|
2946
|
-
|
|
2963
|
+
function Y() {
|
|
2964
|
+
F && (cancelAnimationFrame(F), Te());
|
|
2947
2965
|
}
|
|
2948
|
-
function
|
|
2949
|
-
const f =
|
|
2966
|
+
function Ne(d) {
|
|
2967
|
+
const f = tt;
|
|
2950
2968
|
if (!f) return;
|
|
2951
|
-
const
|
|
2952
|
-
if (!
|
|
2953
|
-
const T =
|
|
2954
|
-
if (!T || !
|
|
2955
|
-
const { columnInitSize:
|
|
2956
|
-
|
|
2969
|
+
const x = d.getContext("2d");
|
|
2970
|
+
if (!x) return;
|
|
2971
|
+
const T = A.getCellRect([f.startColumn, f.startRow]), G = A.getCellRect([f.endColumn, f.endRow]);
|
|
2972
|
+
if (!T || !G) return;
|
|
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();
|
|
2957
2975
|
}
|
|
2958
|
-
const
|
|
2959
|
-
function
|
|
2976
|
+
const Fe = (d) => Math.max(0, Math.min(d.width - 2 * B.cellHorizontalPadding, d.width * 0.6));
|
|
2977
|
+
function Le(d, f) {
|
|
2960
2978
|
D(d, {
|
|
2961
2979
|
x: f.x + B.cellHorizontalPadding,
|
|
2962
2980
|
y: f.y + (f.height - 8) / 2,
|
|
2963
|
-
width:
|
|
2981
|
+
width: Fe(f),
|
|
2964
2982
|
height: 8,
|
|
2965
2983
|
radius: 8 / 2,
|
|
2966
2984
|
fill: f.theme.cellBgLoading
|
|
2967
2985
|
});
|
|
2968
2986
|
}
|
|
2969
|
-
function
|
|
2970
|
-
if (!
|
|
2971
|
-
const { fontSizeSM: T, cellTextColor:
|
|
2987
|
+
function ft(d, f, x) {
|
|
2988
|
+
if (!x) return;
|
|
2989
|
+
const { fontSizeSM: T, cellTextColor: G } = f.theme;
|
|
2972
2990
|
$e(d, {
|
|
2973
|
-
text:
|
|
2991
|
+
text: x,
|
|
2974
2992
|
x: f.x + B.cellHorizontalPadding,
|
|
2975
2993
|
y: f.y + (f.height - T) / 2,
|
|
2976
2994
|
maxWidth: f.width - 2 * B.cellHorizontalPadding,
|
|
2977
|
-
fill:
|
|
2995
|
+
fill: G,
|
|
2978
2996
|
fontSize: T
|
|
2979
2997
|
});
|
|
2980
2998
|
}
|
|
2981
|
-
function
|
|
2982
|
-
const
|
|
2983
|
-
if (!
|
|
2984
|
-
const T =
|
|
2999
|
+
function Pe(d, f) {
|
|
3000
|
+
const x = o.columns[f.columnIndex];
|
|
3001
|
+
if (!x) return;
|
|
3002
|
+
const T = W() || (o.isRowLoaded ? !o.isRowLoaded(f.rowIndex) : !1), G = {
|
|
2985
3003
|
x: f.x,
|
|
2986
3004
|
y: f.y,
|
|
2987
3005
|
width: f.width,
|
|
2988
3006
|
height: f.height,
|
|
2989
3007
|
cell: [f.columnIndex, f.rowIndex],
|
|
2990
|
-
column:
|
|
3008
|
+
column: x,
|
|
2991
3009
|
theme: f.theme,
|
|
2992
3010
|
isActive: f.isActive,
|
|
2993
3011
|
isLoading: T
|
|
2994
3012
|
};
|
|
2995
3013
|
if (T) {
|
|
2996
|
-
|
|
3014
|
+
Le(d, G);
|
|
2997
3015
|
return;
|
|
2998
3016
|
}
|
|
2999
|
-
const
|
|
3000
|
-
|
|
3017
|
+
const J = o.cellRenderer?.(x, f.columnIndex);
|
|
3018
|
+
J ? J.draw(d, G) : ft(d, G, o.getCellText(G.cell));
|
|
3001
3019
|
}
|
|
3002
|
-
function
|
|
3003
|
-
const
|
|
3004
|
-
o.drawIcon?.(d, { kind: f.kind, x: f.x, y: f.y, size: f.size, theme: f.theme, column:
|
|
3020
|
+
function Ye(d, f) {
|
|
3021
|
+
const x = f.column ? o.columns.find((T) => T.id === f.column?.id) : void 0;
|
|
3022
|
+
o.drawIcon?.(d, { kind: f.kind, x: f.x, y: f.y, size: f.size, theme: f.theme, column: x });
|
|
3005
3023
|
}
|
|
3006
|
-
function
|
|
3007
|
-
const d =
|
|
3024
|
+
function je() {
|
|
3025
|
+
const d = h.value;
|
|
3008
3026
|
if (!d) return;
|
|
3009
|
-
const f =
|
|
3010
|
-
if (!
|
|
3027
|
+
const f = A.selection.activeCell, x = f ? A.getCellRect(f) : null;
|
|
3028
|
+
if (!x) {
|
|
3011
3029
|
d.style.transform = "translate(-10000px, 0)";
|
|
3012
3030
|
return;
|
|
3013
3031
|
}
|
|
3014
|
-
const { rowInitSize: T, freezeRegionWidth:
|
|
3015
|
-
d.style.transform = `translate(${
|
|
3032
|
+
const { rowInitSize: T, freezeRegionWidth: G, freezeColumnCount: J } = A.coord, Re = f[0] < J ? A.coord.columnInitSize : G, xt = Math.max(x.x, Re), Rt = Math.max(x.y, T);
|
|
3033
|
+
d.style.transform = `translate(${xt}px, ${Rt}px)`, d.style.width = `${x.width}px`, d.style.height = `${x.height}px`;
|
|
3016
3034
|
}
|
|
3017
|
-
function
|
|
3018
|
-
return
|
|
3035
|
+
function Se() {
|
|
3036
|
+
return Ca(m.value, l.value ?? null);
|
|
3019
3037
|
}
|
|
3020
|
-
const
|
|
3021
|
-
function
|
|
3022
|
-
const f =
|
|
3023
|
-
return { x: d.clientX - f.left, y: d.clientY - f.top, shiftKey: d.shiftKey, commandKey:
|
|
3038
|
+
const ye = (d) => Ts() ? d.metaKey : d.ctrlKey;
|
|
3039
|
+
function ce(d) {
|
|
3040
|
+
const f = ae ?? (ae = l.value.getBoundingClientRect());
|
|
3041
|
+
return { x: d.clientX - f.left, y: d.clientY - f.top, shiftKey: d.shiftKey, commandKey: ye(d) };
|
|
3024
3042
|
}
|
|
3025
|
-
function
|
|
3026
|
-
const f =
|
|
3027
|
-
return d.clientX -
|
|
3043
|
+
function Qe(d) {
|
|
3044
|
+
const f = u.value, x = ae;
|
|
3045
|
+
return d.clientX - x.left >= f.clientWidth || d.clientY - x.top >= f.clientHeight;
|
|
3028
3046
|
}
|
|
3029
|
-
let
|
|
3030
|
-
const
|
|
3031
|
-
function
|
|
3032
|
-
|
|
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;
|
|
3049
|
+
function et() {
|
|
3050
|
+
te && clearTimeout(te.timer), te = null, Qt = Je();
|
|
3033
3051
|
}
|
|
3034
|
-
function
|
|
3035
|
-
if (
|
|
3036
|
-
|
|
3052
|
+
function Eo(d) {
|
|
3053
|
+
if (te) {
|
|
3054
|
+
et();
|
|
3037
3055
|
return;
|
|
3038
3056
|
}
|
|
3039
3057
|
const f = {
|
|
3040
3058
|
id: d.pointerId,
|
|
3041
3059
|
x: d.clientX,
|
|
3042
3060
|
y: d.clientY,
|
|
3043
|
-
flingStop:
|
|
3061
|
+
flingStop: Je() - Zt < Zs,
|
|
3044
3062
|
longPressed: !1,
|
|
3045
3063
|
timer: setTimeout(() => {
|
|
3046
|
-
|
|
3047
|
-
},
|
|
3064
|
+
te !== f || f.flingStop || X() || (f.longPressed = !0, A.longPress(ce(d)), Y());
|
|
3065
|
+
}, Qs)
|
|
3048
3066
|
};
|
|
3049
|
-
|
|
3067
|
+
te = f;
|
|
3050
3068
|
}
|
|
3051
|
-
function
|
|
3052
|
-
const f =
|
|
3053
|
-
!f || f.id !== d.pointerId || Math.hypot(d.clientX - f.x, d.clientY - f.y) >
|
|
3069
|
+
function Ho(d) {
|
|
3070
|
+
const f = te;
|
|
3071
|
+
!f || f.id !== d.pointerId || Math.hypot(d.clientX - f.x, d.clientY - f.y) > js && et();
|
|
3054
3072
|
}
|
|
3055
|
-
function
|
|
3056
|
-
const f =
|
|
3057
|
-
!f || f.id !== d.pointerId || (
|
|
3058
|
-
|
|
3059
|
-
},
|
|
3073
|
+
function To(d) {
|
|
3074
|
+
const f = te;
|
|
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(() => {
|
|
3076
|
+
re = null, A.clearTapFeedback();
|
|
3077
|
+
}, er))));
|
|
3060
3078
|
}
|
|
3061
|
-
function
|
|
3062
|
-
if (
|
|
3063
|
-
|
|
3079
|
+
function No(d) {
|
|
3080
|
+
if (ae = l.value.getBoundingClientRect(), d.pointerType === "touch") {
|
|
3081
|
+
Eo(d);
|
|
3064
3082
|
return;
|
|
3065
3083
|
}
|
|
3066
|
-
if (d.button !== 0 ||
|
|
3067
|
-
if (
|
|
3084
|
+
if (d.button !== 0 || Qe(d)) return;
|
|
3085
|
+
if (L.active && !L.commit("pointer")) {
|
|
3068
3086
|
d.preventDefault();
|
|
3069
3087
|
return;
|
|
3070
3088
|
}
|
|
3071
|
-
const f =
|
|
3072
|
-
if (
|
|
3089
|
+
const f = A.pointerDown(ce(d));
|
|
3090
|
+
if (Y(), !!f) {
|
|
3073
3091
|
d.preventDefault();
|
|
3074
3092
|
try {
|
|
3075
|
-
|
|
3093
|
+
u.value.setPointerCapture(d.pointerId);
|
|
3076
3094
|
} catch {
|
|
3077
3095
|
}
|
|
3078
|
-
|
|
3096
|
+
Se();
|
|
3079
3097
|
}
|
|
3080
3098
|
}
|
|
3081
|
-
function
|
|
3099
|
+
function Fo(d) {
|
|
3082
3100
|
if (d.pointerType === "touch") {
|
|
3083
|
-
|
|
3101
|
+
Ho(d);
|
|
3084
3102
|
return;
|
|
3085
3103
|
}
|
|
3086
|
-
|
|
3104
|
+
ae || (ae = l.value.getBoundingClientRect()), A.pointerMove(ce(d)), Y(), u.value && (u.value.style.cursor = A.cursor);
|
|
3087
3105
|
}
|
|
3088
|
-
function
|
|
3106
|
+
function Lo(d) {
|
|
3089
3107
|
if (d.pointerType === "touch") {
|
|
3090
|
-
|
|
3108
|
+
To(d);
|
|
3091
3109
|
return;
|
|
3092
3110
|
}
|
|
3093
|
-
if (
|
|
3094
|
-
|
|
3111
|
+
if (A.isGestureActive) {
|
|
3112
|
+
A.pointerUp(ce(d)), Y();
|
|
3095
3113
|
try {
|
|
3096
|
-
|
|
3114
|
+
u.value?.releasePointerCapture(d.pointerId);
|
|
3097
3115
|
} catch {
|
|
3098
3116
|
}
|
|
3099
3117
|
}
|
|
3100
3118
|
}
|
|
3101
|
-
function
|
|
3119
|
+
function en(d) {
|
|
3102
3120
|
if (d.pointerType === "touch") {
|
|
3103
|
-
|
|
3121
|
+
te?.id === d.pointerId && et();
|
|
3104
3122
|
return;
|
|
3105
3123
|
}
|
|
3106
|
-
|
|
3124
|
+
A.cancelGesture(), Y();
|
|
3107
3125
|
}
|
|
3108
|
-
function
|
|
3109
|
-
|
|
3126
|
+
function Do() {
|
|
3127
|
+
A.pointerLeave();
|
|
3110
3128
|
}
|
|
3111
|
-
function
|
|
3112
|
-
|
|
3129
|
+
function Wo(d) {
|
|
3130
|
+
X() || Jt() || A.doubleClick(ce(d));
|
|
3113
3131
|
}
|
|
3114
|
-
function
|
|
3115
|
-
if (
|
|
3132
|
+
function Bo(d) {
|
|
3133
|
+
if (Jt()) {
|
|
3116
3134
|
d.preventDefault();
|
|
3117
3135
|
return;
|
|
3118
3136
|
}
|
|
3119
|
-
|
|
3137
|
+
ae = l.value.getBoundingClientRect(), A.contextMenu(ce(d)) && (d.preventDefault(), Se());
|
|
3120
3138
|
}
|
|
3121
|
-
function
|
|
3122
|
-
const d =
|
|
3123
|
-
d && (
|
|
3139
|
+
function Oo() {
|
|
3140
|
+
const d = u.value;
|
|
3141
|
+
d && (ae = null, Zt = Je(), A.setScroll(d.scrollLeft, d.scrollTop));
|
|
3124
3142
|
}
|
|
3125
|
-
function
|
|
3126
|
-
if (
|
|
3127
|
-
|
|
3143
|
+
function Vo(d) {
|
|
3144
|
+
if (L.active) {
|
|
3145
|
+
L.keyDown(d, ye(d)) && d.stopPropagation();
|
|
3128
3146
|
return;
|
|
3129
3147
|
}
|
|
3130
3148
|
if (o.editing) return;
|
|
3131
|
-
if (d.key === "Escape" && De(),
|
|
3132
|
-
|
|
3149
|
+
if (d.key === "Escape" && De(), Go(d)) {
|
|
3150
|
+
Uo();
|
|
3133
3151
|
return;
|
|
3134
3152
|
}
|
|
3135
|
-
|
|
3153
|
+
A.keyDown({
|
|
3136
3154
|
key: d.key,
|
|
3137
3155
|
keyCode: d.keyCode,
|
|
3138
3156
|
shiftKey: d.shiftKey,
|
|
@@ -3140,290 +3158,290 @@ const Ps = () => {
|
|
|
3140
3158
|
metaKey: d.metaKey,
|
|
3141
3159
|
ctrlKey: d.ctrlKey,
|
|
3142
3160
|
isComposing: d.isComposing,
|
|
3143
|
-
commandKey:
|
|
3144
|
-
}) === "prevent" && d.preventDefault(),
|
|
3161
|
+
commandKey: ye(d)
|
|
3162
|
+
}) === "prevent" && d.preventDefault(), Y();
|
|
3145
3163
|
}
|
|
3146
|
-
let
|
|
3164
|
+
let tt = null, pe = null;
|
|
3147
3165
|
function De() {
|
|
3148
|
-
|
|
3166
|
+
tt && (tt = null, fe());
|
|
3149
3167
|
}
|
|
3150
|
-
const
|
|
3151
|
-
function
|
|
3152
|
-
if (!
|
|
3168
|
+
const pt = () => ({ rowCount: o.loading && o.rowCount === 0 ? 0 : o.rowCount, columnCount: o.columns.length });
|
|
3169
|
+
function Go(d) {
|
|
3170
|
+
if (!ye(d) || d.altKey || d.shiftKey) return !1;
|
|
3153
3171
|
const f = d.key.toLowerCase();
|
|
3154
3172
|
return f === "c" || f === "x" || d.code === "KeyC" || d.code === "KeyX";
|
|
3155
3173
|
}
|
|
3156
|
-
function
|
|
3157
|
-
const d =
|
|
3158
|
-
!d || d.value || (d.value = " ", d.select(),
|
|
3174
|
+
function Uo() {
|
|
3175
|
+
const d = m.value;
|
|
3176
|
+
!d || d.value || (d.value = " ", d.select(), pe && clearTimeout(pe), pe = setTimeout(tn, 0));
|
|
3159
3177
|
}
|
|
3160
|
-
function
|
|
3161
|
-
|
|
3178
|
+
function tn() {
|
|
3179
|
+
pe && clearTimeout(pe), pe = null, m.value && !L.active && (m.value.value = "");
|
|
3162
3180
|
}
|
|
3163
|
-
function
|
|
3164
|
-
T && (
|
|
3181
|
+
function Ct(d, f, x, T) {
|
|
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);
|
|
3165
3183
|
}
|
|
3166
|
-
function
|
|
3167
|
-
const
|
|
3184
|
+
function nn(d, f) {
|
|
3185
|
+
const x = A.getSelection(), T = yo(x, pt());
|
|
3168
3186
|
if (!T) return Promise.resolve(!1);
|
|
3169
|
-
const
|
|
3170
|
-
if (f &&
|
|
3171
|
-
const
|
|
3172
|
-
return
|
|
3187
|
+
const G = La(T, o.isRowLoaded);
|
|
3188
|
+
if (f && G) {
|
|
3189
|
+
const Re = Ma(f, zt(Fn(T, o.getCopyText ?? o.getCellText)));
|
|
3190
|
+
return Ct(x, T, d, Re), Promise.resolve(Re);
|
|
3173
3191
|
}
|
|
3174
3192
|
f?.preventDefault();
|
|
3175
|
-
let
|
|
3176
|
-
return
|
|
3177
|
-
}),
|
|
3178
|
-
() => (
|
|
3179
|
-
() => (
|
|
3193
|
+
let J;
|
|
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(
|
|
3196
|
+
() => (Ct(x, T, d, !0), !0),
|
|
3197
|
+
() => (Ct(x, T, d, !1), !1)
|
|
3180
3198
|
);
|
|
3181
3199
|
}
|
|
3182
|
-
function
|
|
3183
|
-
|
|
3200
|
+
function on(d, f) {
|
|
3201
|
+
L.active || o.editing || (tn(), d.preventDefault(), nn(f, d));
|
|
3184
3202
|
}
|
|
3185
|
-
function
|
|
3203
|
+
function an(d) {
|
|
3186
3204
|
if (o.readonly) return null;
|
|
3187
|
-
const f =
|
|
3188
|
-
...
|
|
3189
|
-
isReadonlyColumn: (
|
|
3205
|
+
const f = Fa(d, A.getSelection(), {
|
|
3206
|
+
...pt(),
|
|
3207
|
+
isReadonlyColumn: (x) => !!o.columns[x]?.readonly
|
|
3190
3208
|
});
|
|
3191
3209
|
return f ? (De(), i("paste-request", f), f) : null;
|
|
3192
3210
|
}
|
|
3193
|
-
function
|
|
3194
|
-
|
|
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") ?? ""));
|
|
3195
3213
|
}
|
|
3196
|
-
const
|
|
3214
|
+
const wt = /* @__PURE__ */ new Map();
|
|
3197
3215
|
let ze = null;
|
|
3198
|
-
function
|
|
3216
|
+
function sn() {
|
|
3199
3217
|
ze && clearTimeout(ze), ze = null;
|
|
3200
|
-
const d = [...
|
|
3201
|
-
|
|
3202
|
-
for (const [f,
|
|
3218
|
+
const d = [...wt];
|
|
3219
|
+
wt.clear();
|
|
3220
|
+
for (const [f, x] of d) i("column-width-save", f, x);
|
|
3203
3221
|
}
|
|
3204
|
-
function
|
|
3205
|
-
|
|
3222
|
+
function _o(d, f) {
|
|
3223
|
+
wt.set(d, f), ze && clearTimeout(ze), ze = setTimeout(sn, tr);
|
|
3206
3224
|
}
|
|
3207
|
-
function
|
|
3208
|
-
o.editing || (
|
|
3225
|
+
function $o() {
|
|
3226
|
+
o.editing || (L.active || A.compositionStart(), L.active && L.compositionStart());
|
|
3209
3227
|
}
|
|
3210
|
-
function
|
|
3211
|
-
|
|
3228
|
+
function qo() {
|
|
3229
|
+
L.compositionEnd();
|
|
3212
3230
|
}
|
|
3213
|
-
let
|
|
3214
|
-
function
|
|
3215
|
-
|
|
3231
|
+
let vt = null, St = null, yt = null, We = null;
|
|
3232
|
+
function rn() {
|
|
3233
|
+
y.value = !!We?.matches, xe();
|
|
3216
3234
|
}
|
|
3217
|
-
let
|
|
3218
|
-
function
|
|
3219
|
-
const d =
|
|
3235
|
+
let be = null;
|
|
3236
|
+
function ln() {
|
|
3237
|
+
const d = l.value;
|
|
3220
3238
|
if (!d) return;
|
|
3221
|
-
|
|
3222
|
-
const f = d.clientWidth,
|
|
3223
|
-
f ===
|
|
3239
|
+
ae = null;
|
|
3240
|
+
const f = d.clientWidth, x = d.clientHeight;
|
|
3241
|
+
f === S.value.width && x === S.value.height || (S.value = { width: f, height: x }, A.setViewport(f, x), bt());
|
|
3224
3242
|
}
|
|
3225
|
-
function
|
|
3226
|
-
const d =
|
|
3227
|
-
d && (
|
|
3243
|
+
function xe() {
|
|
3244
|
+
const d = l.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());
|
|
3228
3246
|
}
|
|
3229
|
-
function
|
|
3230
|
-
|
|
3247
|
+
function bt() {
|
|
3248
|
+
A.configure(E()), w.value = A.contentSize;
|
|
3231
3249
|
}
|
|
3232
|
-
|
|
3233
|
-
if (
|
|
3234
|
-
|
|
3250
|
+
de(() => o.loading && o.rowCount === 0, (d) => {
|
|
3251
|
+
if (be && clearTimeout(be), be = null, !d) {
|
|
3252
|
+
v.value = !1;
|
|
3235
3253
|
return;
|
|
3236
3254
|
}
|
|
3237
|
-
|
|
3238
|
-
|
|
3255
|
+
be = setTimeout(() => {
|
|
3256
|
+
be = null, v.value = !0;
|
|
3239
3257
|
}, o.loadingDelay);
|
|
3240
|
-
}, { immediate: !0 }),
|
|
3241
|
-
() => [o.columns, o.rowCount, o.freezeColumnCount, o.rowControls, o.selectable, o.draggable, o.columnResizable, o.readonly,
|
|
3242
|
-
|
|
3243
|
-
),
|
|
3244
|
-
if (
|
|
3245
|
-
|
|
3246
|
-
const d =
|
|
3258
|
+
}, { immediate: !0 }), de(
|
|
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],
|
|
3260
|
+
bt
|
|
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") {
|
|
3263
|
+
St = new MutationObserver(() => xe());
|
|
3264
|
+
const d = l.value.closest("[data-ui-app]");
|
|
3247
3265
|
for (const f of /* @__PURE__ */ new Set([d, document.documentElement]))
|
|
3248
|
-
f &&
|
|
3266
|
+
f && St.observe(f, { attributes: !0, attributeFilter: ["data-ui-color-scheme", "data-ui-density", "style", "class"] });
|
|
3249
3267
|
}
|
|
3250
|
-
|
|
3251
|
-
}),
|
|
3252
|
-
|
|
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;
|
|
3253
3271
|
});
|
|
3254
|
-
const
|
|
3255
|
-
const d =
|
|
3272
|
+
const j = U(() => p.value.activeCell), Xo = U(() => j.value ? o.columns[j.value[0]] : void 0), Yo = U(() => {
|
|
3273
|
+
const d = j.value;
|
|
3256
3274
|
return d ? o.getRowLabel?.(d[1]) ?? String(d[1] + 1) : "";
|
|
3257
|
-
}),
|
|
3258
|
-
open:
|
|
3259
|
-
kind:
|
|
3260
|
-
view:
|
|
3261
|
-
invalid: !!
|
|
3262
|
-
hint:
|
|
3263
|
-
rowHeight:
|
|
3264
|
-
lines:
|
|
3265
|
-
theme:
|
|
3266
|
-
dangerColor:
|
|
3267
|
-
textBox:
|
|
3268
|
-
})),
|
|
3269
|
-
if (
|
|
3270
|
-
const d =
|
|
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(() => ({
|
|
3276
|
+
open: Q.value.active,
|
|
3277
|
+
kind: Q.value.kind,
|
|
3278
|
+
view: Q.value.mode === "view",
|
|
3279
|
+
invalid: !!Q.value.error,
|
|
3280
|
+
hint: dn.value,
|
|
3281
|
+
rowHeight: P.value,
|
|
3282
|
+
lines: L.lines.value,
|
|
3283
|
+
theme: C.value,
|
|
3284
|
+
dangerColor: I,
|
|
3285
|
+
textBox: k.value
|
|
3286
|
+
})), Zo = U(() => ja(nt.value)), hn = U(() => Q.value.active ? Ro(nt.value) : P.value), ot = U(() => {
|
|
3287
|
+
if (R.value, Q.value.active) return Q.value.error;
|
|
3288
|
+
const d = p.value.activeCell, f = d && o.cellStatus ? o.cellStatus(d) : null;
|
|
3271
3289
|
return f?.state === "error" ? f.message : null;
|
|
3272
3290
|
});
|
|
3273
3291
|
return t({
|
|
3274
|
-
focus:
|
|
3275
|
-
focusOwner: () =>
|
|
3276
|
-
getCellRect:
|
|
3277
|
-
scrollToCell: (d) =>
|
|
3278
|
-
getSelection: () =>
|
|
3279
|
-
setSelection: (d) =>
|
|
3292
|
+
focus: Se,
|
|
3293
|
+
focusOwner: () => m.value ?? null,
|
|
3294
|
+
getCellRect: un,
|
|
3295
|
+
scrollToCell: (d) => A.scrollToCell(d),
|
|
3296
|
+
getSelection: () => A.getSelection(),
|
|
3297
|
+
setSelection: (d) => A.setSelection(d),
|
|
3280
3298
|
invalidate: () => {
|
|
3281
|
-
|
|
3299
|
+
R.value++, A.invalidate();
|
|
3282
3300
|
},
|
|
3283
|
-
refreshTheme:
|
|
3284
|
-
isEditing: () =>
|
|
3285
|
-
commitEdit: () => !
|
|
3286
|
-
cancelEdit: () =>
|
|
3287
|
-
copy: (d = !1) =>
|
|
3288
|
-
paste: (d) =>
|
|
3289
|
-
}), (d, f) => (
|
|
3301
|
+
refreshTheme: xe,
|
|
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)
|
|
3307
|
+
}), (d, f) => (Ce(), we("div", {
|
|
3290
3308
|
ref_key: "root",
|
|
3291
|
-
ref:
|
|
3309
|
+
ref: l,
|
|
3292
3310
|
role: "grid",
|
|
3293
3311
|
"data-ui-grid": "",
|
|
3294
|
-
"aria-labelledby": `${
|
|
3312
|
+
"aria-labelledby": `${ee(r)}-label`,
|
|
3295
3313
|
"aria-rowcount": e.loading && e.rowCount === 0 ? -1 : e.rowCount + 1,
|
|
3296
3314
|
"aria-colcount": e.columns.length,
|
|
3297
3315
|
"aria-readonly": e.readonly ? "true" : void 0,
|
|
3298
3316
|
"aria-busy": e.loading ? "true" : void 0,
|
|
3299
|
-
"data-ui-grid-skeleton":
|
|
3317
|
+
"data-ui-grid-skeleton": v.value && e.loading && e.rowCount === 0 ? "" : void 0,
|
|
3300
3318
|
"aria-multiselectable": "true",
|
|
3301
3319
|
style: { position: "relative", overflow: "hidden", width: "100%", height: "100%", "min-height": "0", background: "var(--ui-surface)", contain: "strict", isolation: "isolate" },
|
|
3302
|
-
onPaste:
|
|
3320
|
+
onPaste: Ko
|
|
3303
3321
|
}, [
|
|
3304
|
-
|
|
3305
|
-
id: `${
|
|
3322
|
+
ne("span", {
|
|
3323
|
+
id: `${ee(r)}-label`,
|
|
3306
3324
|
class: "sr-only"
|
|
3307
|
-
},
|
|
3308
|
-
|
|
3325
|
+
}, ve(e.label), 9, Ds),
|
|
3326
|
+
ne("canvas", {
|
|
3309
3327
|
ref_key: "canvas",
|
|
3310
3328
|
ref: c,
|
|
3311
3329
|
"aria-hidden": "true",
|
|
3312
3330
|
style: { position: "absolute", top: "0", left: "0", "pointer-events": "none", "z-index": "0" }
|
|
3313
3331
|
}, null, 512),
|
|
3314
|
-
|
|
3332
|
+
ne("div", {
|
|
3315
3333
|
ref_key: "scroller",
|
|
3316
|
-
ref:
|
|
3334
|
+
ref: u,
|
|
3317
3335
|
"data-ui-grid-scroller": "",
|
|
3318
3336
|
"aria-hidden": "true",
|
|
3319
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" },
|
|
3320
|
-
onScrollPassive:
|
|
3321
|
-
onPointerdown:
|
|
3322
|
-
onPointermove:
|
|
3323
|
-
onPointerup:
|
|
3324
|
-
onPointercancel:
|
|
3325
|
-
onLostpointercapture:
|
|
3326
|
-
onPointerleave:
|
|
3327
|
-
onDblclick:
|
|
3328
|
-
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
|
|
3329
3347
|
}, [
|
|
3330
|
-
|
|
3331
|
-
style: Be({ width: `${
|
|
3348
|
+
ne("div", {
|
|
3349
|
+
style: Be({ width: `${w.value.width}px`, height: `${w.value.height}px` })
|
|
3332
3350
|
}, null, 4)
|
|
3333
3351
|
], 544),
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
(
|
|
3337
|
-
id:
|
|
3338
|
-
key:
|
|
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),
|
|
3356
|
+
key: x.id,
|
|
3339
3357
|
role: "columnheader",
|
|
3340
3358
|
class: "sr-only",
|
|
3341
3359
|
"aria-colindex": T + 1
|
|
3342
|
-
},
|
|
3360
|
+
}, ve(x.name), 9, Os))), 128))
|
|
3343
3361
|
])
|
|
3344
3362
|
]),
|
|
3345
|
-
|
|
3346
|
-
|
|
3363
|
+
ne("div", Vs, [
|
|
3364
|
+
ne("div", {
|
|
3347
3365
|
role: "row",
|
|
3348
|
-
"aria-rowindex":
|
|
3349
|
-
"aria-hidden":
|
|
3366
|
+
"aria-rowindex": j.value ? j.value[1] + 2 : 2,
|
|
3367
|
+
"aria-hidden": j.value ? void 0 : "true"
|
|
3350
3368
|
}, [
|
|
3351
|
-
|
|
3352
|
-
id: `${
|
|
3369
|
+
ne("span", {
|
|
3370
|
+
id: `${ee(r)}-rowheader`,
|
|
3353
3371
|
role: "rowheader",
|
|
3354
3372
|
class: "sr-only"
|
|
3355
|
-
},
|
|
3356
|
-
|
|
3373
|
+
}, ve(Yo.value), 9, Us),
|
|
3374
|
+
ne("div", {
|
|
3357
3375
|
ref_key: "focusCell",
|
|
3358
|
-
ref:
|
|
3376
|
+
ref: h,
|
|
3359
3377
|
role: "gridcell",
|
|
3360
|
-
"aria-colindex":
|
|
3361
|
-
"aria-selected":
|
|
3362
|
-
"aria-readonly": e.readonly ||
|
|
3378
|
+
"aria-colindex": j.value ? j.value[0] + 1 : 1,
|
|
3379
|
+
"aria-selected": j.value ? "true" : void 0,
|
|
3380
|
+
"aria-readonly": e.readonly || Xo.value?.readonly ? "true" : void 0,
|
|
3363
3381
|
"data-ui-grid-focus-cell": "",
|
|
3364
3382
|
style: { position: "absolute", top: "0", left: "0", width: "0", height: "0", transform: "translate(-10000px, 0)", "z-index": "2", "pointer-events": "none" }
|
|
3365
3383
|
}, [
|
|
3366
|
-
|
|
3367
|
-
id: `${
|
|
3384
|
+
ne("span", {
|
|
3385
|
+
id: `${ee(r)}-cell`,
|
|
3368
3386
|
class: "sr-only"
|
|
3369
|
-
},
|
|
3370
|
-
|
|
3387
|
+
}, ve(jo.value), 9, _s),
|
|
3388
|
+
ne("textarea", {
|
|
3371
3389
|
ref_key: "focusOwner",
|
|
3372
|
-
ref:
|
|
3390
|
+
ref: m,
|
|
3373
3391
|
"data-ui-grid-focus-owner": "",
|
|
3374
|
-
"data-ui-grid-editing":
|
|
3375
|
-
"aria-labelledby":
|
|
3376
|
-
"aria-invalid":
|
|
3377
|
-
"aria-describedby":
|
|
3378
|
-
readonly:
|
|
3392
|
+
"data-ui-grid-editing": Q.value.active ? Q.value.mode : void 0,
|
|
3393
|
+
"aria-labelledby": Qo.value,
|
|
3394
|
+
"aria-invalid": ot.value ? "true" : void 0,
|
|
3395
|
+
"aria-describedby": ot.value ? `${ee(r)}-message` : void 0,
|
|
3396
|
+
readonly: Q.value.active && Q.value.mode === "view" ? !0 : void 0,
|
|
3379
3397
|
autocomplete: "off",
|
|
3380
3398
|
autocapitalize: "off",
|
|
3381
3399
|
spellcheck: "false",
|
|
3382
3400
|
rows: "1",
|
|
3383
|
-
style: Be(
|
|
3384
|
-
onKeydown:
|
|
3385
|
-
onCompositionstart:
|
|
3386
|
-
onCompositionend:
|
|
3387
|
-
onInput: f[0] || (f[0] = (
|
|
3388
|
-
onBlur: f[1] || (f[1] = (
|
|
3389
|
-
onCopy: f[2] || (f[2] = (
|
|
3390
|
-
onCut: f[3] || (f[3] = (
|
|
3391
|
-
}, null, 44,
|
|
3392
|
-
|
|
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", {
|
|
3393
3411
|
key: 0,
|
|
3394
3412
|
"data-ui-grid-edit-hint": "",
|
|
3395
3413
|
"aria-hidden": "true",
|
|
3396
|
-
style: Be({ ...
|
|
3397
|
-
},
|
|
3398
|
-
|
|
3414
|
+
style: Be({ ...ee(Qa)(nt.value), top: `${hn.value - ee(ut)}px` })
|
|
3415
|
+
}, ve(e.editHint), 5)) : Oe("", !0),
|
|
3416
|
+
ot.value ? (Ce(), we("div", {
|
|
3399
3417
|
key: 1,
|
|
3400
|
-
id: `${
|
|
3418
|
+
id: `${ee(r)}-message`,
|
|
3401
3419
|
"data-ui-grid-edit-message": "",
|
|
3402
|
-
style: Be({ ...
|
|
3403
|
-
},
|
|
3404
|
-
], 8,
|
|
3405
|
-
], 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)
|
|
3406
3424
|
]),
|
|
3407
|
-
|
|
3425
|
+
z.value ? (Ce(), we("div", {
|
|
3408
3426
|
key: 0,
|
|
3409
3427
|
"data-ui-grid-empty": "",
|
|
3410
|
-
style: Be([{ top: `${
|
|
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" }])
|
|
3411
3429
|
}, [
|
|
3412
|
-
|
|
3413
|
-
|
|
3430
|
+
gn(d.$slots, "empty", {}, () => [
|
|
3431
|
+
ri(ve(ee(s)("No data")), 1)
|
|
3414
3432
|
])
|
|
3415
3433
|
], 4)) : Oe("", !0),
|
|
3416
|
-
e.loading ? (
|
|
3417
|
-
d.$slots.overlay ? (
|
|
3418
|
-
|
|
3419
|
-
activeCell:
|
|
3420
|
-
getCellRect:
|
|
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", {
|
|
3437
|
+
activeCell: j.value,
|
|
3438
|
+
getCellRect: un
|
|
3421
3439
|
})
|
|
3422
3440
|
])) : Oe("", !0)
|
|
3423
|
-
], 40,
|
|
3441
|
+
], 40, Ls));
|
|
3424
3442
|
}
|
|
3425
|
-
}),
|
|
3426
|
-
const n = new
|
|
3443
|
+
}), nr = (e, t = 500) => {
|
|
3444
|
+
const n = new dt(t);
|
|
3427
3445
|
let o = !1;
|
|
3428
3446
|
const i = () => {
|
|
3429
3447
|
if (o) return;
|
|
@@ -3438,20 +3456,20 @@ const Ps = () => {
|
|
|
3438
3456
|
const s = n.get(a);
|
|
3439
3457
|
if (s) return s.ready ? s.image : void 0;
|
|
3440
3458
|
if (typeof Image > "u") return;
|
|
3441
|
-
const r = new Image(),
|
|
3459
|
+
const r = new Image(), l = { image: r, ready: !1 };
|
|
3442
3460
|
r.decoding = "async", r.onload = () => {
|
|
3443
|
-
|
|
3444
|
-
}, r.src = a, n.set(a,
|
|
3461
|
+
l.ready = !0, i();
|
|
3462
|
+
}, r.src = a, n.set(a, l);
|
|
3445
3463
|
},
|
|
3446
3464
|
clear: () => n.clear()
|
|
3447
3465
|
};
|
|
3448
|
-
},
|
|
3449
|
-
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) {
|
|
3450
3468
|
if (!e) return;
|
|
3451
3469
|
const n = e.trim().replaceAll("_", "-").toLowerCase();
|
|
3452
|
-
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]);
|
|
3453
3471
|
}
|
|
3454
|
-
function
|
|
3472
|
+
function ir() {
|
|
3455
3473
|
if (typeof window > "u") return "en";
|
|
3456
3474
|
const e = window;
|
|
3457
3475
|
let t;
|
|
@@ -3460,90 +3478,90 @@ function Zs() {
|
|
|
3460
3478
|
} catch {
|
|
3461
3479
|
t = void 0;
|
|
3462
3480
|
}
|
|
3463
|
-
const n = typeof t == "string" ?
|
|
3481
|
+
const n = typeof t == "string" ? Xn(t) : void 0;
|
|
3464
3482
|
if (n) return n;
|
|
3465
3483
|
const o = typeof navigator > "u" ? [] : navigator.languages?.length ? navigator.languages : [navigator.language];
|
|
3466
3484
|
for (const i of o) {
|
|
3467
|
-
const a =
|
|
3485
|
+
const a = Xn(i);
|
|
3468
3486
|
if (a) return a;
|
|
3469
3487
|
}
|
|
3470
3488
|
return "en";
|
|
3471
3489
|
}
|
|
3472
|
-
function
|
|
3473
|
-
const t =
|
|
3490
|
+
function ar(e) {
|
|
3491
|
+
const t = li(or, null);
|
|
3474
3492
|
let n;
|
|
3475
|
-
return
|
|
3493
|
+
return U(() => e() ?? t?.value ?? (n ??= ir()));
|
|
3476
3494
|
}
|
|
3477
|
-
function
|
|
3495
|
+
function Po(e, t) {
|
|
3478
3496
|
return e.replace(/\{(\w+)\}/g, (n, o) => String(t[o] ?? n));
|
|
3479
3497
|
}
|
|
3480
|
-
const _e = 4,
|
|
3498
|
+
const _e = 4, Ie = 6, sr = 4, Ae = 4, me = (e, t, n, o = "") => {
|
|
3481
3499
|
const i = `${o ? `${o} ` : ""}${t}px ${n}`;
|
|
3482
3500
|
e.font !== i && (e.font = i);
|
|
3483
|
-
}, 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) => {
|
|
3484
3502
|
const t = e.trim();
|
|
3485
3503
|
if (!t) return "";
|
|
3486
|
-
if (
|
|
3487
|
-
for (const { segment: n } of
|
|
3504
|
+
if (Yn)
|
|
3505
|
+
for (const { segment: n } of Yn.segment(t)) return n.toLocaleUpperCase();
|
|
3488
3506
|
return Array.from(t)[0].toLocaleUpperCase();
|
|
3489
|
-
},
|
|
3507
|
+
}, ge = (e, t, n, o = {}) => {
|
|
3490
3508
|
if (!n) return 0;
|
|
3491
3509
|
const { metrics: i, theme: a } = t, s = o.fontSize ?? i.fontSize;
|
|
3492
|
-
|
|
3493
|
-
const r = o.x ?? t.x + i.padding,
|
|
3510
|
+
me(e, s, a.fontFamily);
|
|
3511
|
+
const r = o.x ?? t.x + i.padding, l = Math.max(0, o.maxWidth ?? t.x + t.width - i.padding - r);
|
|
3494
3512
|
return $e(e, {
|
|
3495
3513
|
text: n,
|
|
3496
3514
|
x: r,
|
|
3497
3515
|
y: t.y + (t.height - s) / 2,
|
|
3498
|
-
maxWidth:
|
|
3516
|
+
maxWidth: l,
|
|
3499
3517
|
fill: o.color ?? t.cellTheme.text,
|
|
3500
3518
|
fontSize: s,
|
|
3501
3519
|
textAlign: o.align ?? "left"
|
|
3502
3520
|
}).width;
|
|
3503
|
-
},
|
|
3521
|
+
}, zo = (e, t, n, o, i) => {
|
|
3504
3522
|
const { metrics: a, theme: s } = t;
|
|
3505
|
-
D(e, { ...n, radius:
|
|
3523
|
+
D(e, { ...n, radius: sr, fill: i.fill }), me(e, a.chipFontSize, s.fontFamily), $e(e, {
|
|
3506
3524
|
text: o,
|
|
3507
|
-
x: n.x +
|
|
3525
|
+
x: n.x + Ie,
|
|
3508
3526
|
y: n.y + (n.height - a.chipFontSize) / 2,
|
|
3509
|
-
maxWidth: Math.max(0, n.width - 2 *
|
|
3527
|
+
maxWidth: Math.max(0, n.width - 2 * Ie),
|
|
3510
3528
|
fill: i.color,
|
|
3511
3529
|
fontSize: a.chipFontSize
|
|
3512
3530
|
});
|
|
3513
|
-
},
|
|
3531
|
+
}, $t = (e, t, n, o) => {
|
|
3514
3532
|
const i = [];
|
|
3515
3533
|
let a = 0;
|
|
3516
3534
|
for (let s = 0; s < e.length; s++) {
|
|
3517
|
-
const r = e.length - s - 1,
|
|
3518
|
-
if (a +
|
|
3519
|
-
i.push(
|
|
3535
|
+
const r = e.length - s - 1, l = r > 0 ? n(r) + _e : 0, c = e[s];
|
|
3536
|
+
if (a + c + l <= t) {
|
|
3537
|
+
i.push(c), a += c + _e;
|
|
3520
3538
|
continue;
|
|
3521
3539
|
}
|
|
3522
3540
|
if (s === 0) {
|
|
3523
|
-
const h = t -
|
|
3541
|
+
const h = t - l;
|
|
3524
3542
|
return h >= o ? (i.push(h), { widths: i, more: r, badgeWidth: r > 0 ? n(r) : 0 }) : { widths: i, more: e.length, badgeWidth: n(e.length) };
|
|
3525
3543
|
}
|
|
3526
3544
|
const u = e.length - s;
|
|
3527
3545
|
return { widths: i, more: u, badgeWidth: n(u) };
|
|
3528
3546
|
}
|
|
3529
3547
|
return { widths: i, more: 0, badgeWidth: 0 };
|
|
3530
|
-
},
|
|
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) => {
|
|
3531
3549
|
const { metrics: a, cellTheme: s } = t, r = t.y + (t.height - a.chip) / 2;
|
|
3532
|
-
|
|
3533
|
-
},
|
|
3534
|
-
const a = t + o / 2, s = n + o / 2 + o * 0.04, r = o / 2,
|
|
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) => {
|
|
3552
|
+
const a = t + o / 2, s = n + o / 2 + o * 0.04, r = o / 2, l = r * 0.45;
|
|
3535
3553
|
e.beginPath();
|
|
3536
|
-
for (let
|
|
3537
|
-
const u =
|
|
3538
|
-
|
|
3554
|
+
for (let c = 0; c < 10; c++) {
|
|
3555
|
+
const u = c % 2 === 0 ? r : l, h = -Math.PI / 2 + c * Math.PI / 5, m = a + u * Math.cos(h), g = s + u * Math.sin(h);
|
|
3556
|
+
c === 0 ? e.moveTo(m, g) : e.lineTo(m, g);
|
|
3539
3557
|
}
|
|
3540
3558
|
e.closePath(), e.fillStyle = i, e.fill();
|
|
3541
|
-
},
|
|
3559
|
+
}, cr = (e, t, n, o, i) => {
|
|
3542
3560
|
const a = o;
|
|
3543
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();
|
|
3544
3562
|
};
|
|
3545
|
-
class
|
|
3546
|
-
cache = new
|
|
3563
|
+
class Yt {
|
|
3564
|
+
cache = new dt(200);
|
|
3547
3565
|
set(t, n) {
|
|
3548
3566
|
this.cache.set(t, n);
|
|
3549
3567
|
}
|
|
@@ -3554,71 +3572,75 @@ class qt {
|
|
|
3554
3572
|
this.cache.clear();
|
|
3555
3573
|
}
|
|
3556
3574
|
}
|
|
3557
|
-
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) => {
|
|
3558
3576
|
if (!Number.isFinite(e) || Math.abs(e) <= Number.MAX_SAFE_INTEGER) return e.toFixed(t);
|
|
3559
3577
|
const n = String(e), o = n.includes("e") ? "" : "0".repeat(t);
|
|
3560
3578
|
return o ? `${n}.${o}` : n;
|
|
3561
|
-
},
|
|
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") => {
|
|
3562
3584
|
if (e == null) return "";
|
|
3563
3585
|
const o = Number(e), i = t.precision ?? 2;
|
|
3564
3586
|
if (t.type === "currency") {
|
|
3565
|
-
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));
|
|
3566
3588
|
return s + a + r;
|
|
3567
3589
|
}
|
|
3568
|
-
return t.type === "percent" ? `${
|
|
3569
|
-
},
|
|
3590
|
+
return t.type === "percent" ? `${jn(o * 100, i)}%` : jn(o, i);
|
|
3591
|
+
}, Gr = (e, t) => {
|
|
3570
3592
|
if (e == null || e === "") return null;
|
|
3571
3593
|
const n = String(e), o = t?.type === "percent" || n.includes("%"), i = n.replace(/[^\d.+-]/g, "").replace(/([+\-.])+/g, "$1"), a = Number.parseFloat(i);
|
|
3572
3594
|
return Number.isNaN(a) ? null : o ? a / 100 : a;
|
|
3573
|
-
},
|
|
3595
|
+
}, mt = (e) => e.map(String).filter(Boolean).join(", "), mr = (e, t) => {
|
|
3574
3596
|
const n = t.chips[e.tone ?? "neutral"] ?? t.chips.neutral;
|
|
3575
3597
|
return { fill: e.fill ?? n.fill, color: e.color ?? n.color };
|
|
3576
|
-
},
|
|
3598
|
+
}, gt = (e) => Math.max(0, e.width - 2 * e.metrics.padding), gr = {
|
|
3577
3599
|
draw: (e, t, n) => {
|
|
3578
|
-
|
|
3600
|
+
ge(e, t, n.text);
|
|
3579
3601
|
},
|
|
3580
3602
|
describe: (e) => e.text
|
|
3581
|
-
},
|
|
3603
|
+
}, fr = {
|
|
3582
3604
|
draw: (e, t, n) => {
|
|
3583
|
-
|
|
3605
|
+
ge(e, t, n.text.replace(/\s*\n\s*/g, " "));
|
|
3584
3606
|
},
|
|
3585
3607
|
describe: (e) => e.text
|
|
3586
|
-
},
|
|
3608
|
+
}, pr = {
|
|
3587
3609
|
draw: (e, t, n) => {
|
|
3588
|
-
|
|
3610
|
+
ge(e, t, n.text);
|
|
3589
3611
|
},
|
|
3590
3612
|
describe: (e) => e.text
|
|
3591
|
-
},
|
|
3613
|
+
}, Cr = {
|
|
3592
3614
|
draw: (e, t, n) => {
|
|
3593
|
-
|
|
3615
|
+
ge(e, t, n.text, { color: t.cellTheme.textMuted, align: n.align === "end" ? "right" : "left" });
|
|
3594
3616
|
},
|
|
3595
3617
|
describe: (e) => e.text
|
|
3596
|
-
},
|
|
3618
|
+
}, Zn = (e, t) => e.text ?? hr(e.value, e.format, t), wr = {
|
|
3597
3619
|
draw: (e, t, n) => {
|
|
3598
|
-
|
|
3620
|
+
ge(e, t, Zn(n, t.locale), { align: "right" });
|
|
3599
3621
|
},
|
|
3600
|
-
describe: (e, t) =>
|
|
3601
|
-
},
|
|
3622
|
+
describe: (e, t) => Zn(e, t.locale)
|
|
3623
|
+
}, Jn = (e, t, n) => {
|
|
3602
3624
|
const o = n.icon;
|
|
3603
3625
|
return { x: e - n.padding - o, y: (t - o) / 2, width: o, height: o };
|
|
3604
|
-
},
|
|
3626
|
+
}, vr = {
|
|
3605
3627
|
draw: (e, t, n) => {
|
|
3606
|
-
const { metrics: o, cellTheme: i } = t, a =
|
|
3607
|
-
n.text && (
|
|
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));
|
|
3608
3630
|
},
|
|
3609
3631
|
describe: (e) => e.text,
|
|
3610
3632
|
hitTest: (e, { point: t, size: n, metrics: o }) => {
|
|
3611
3633
|
if (!e.text || !e.href) return null;
|
|
3612
|
-
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) };
|
|
3613
3635
|
return Xe(t, a) ? { action: { type: "open-url", href: e.href }, area: a } : null;
|
|
3614
3636
|
}
|
|
3615
|
-
},
|
|
3637
|
+
}, eo = (e, t, n) => {
|
|
3616
3638
|
const o = n.icon;
|
|
3617
3639
|
return { x: e / 2 - o / 2, y: t / 2 - o / 2, width: o, height: o };
|
|
3618
|
-
},
|
|
3640
|
+
}, to = (e) => ({ type: "update", value: !e.value }), Sr = {
|
|
3619
3641
|
draw: (e, t, n) => {
|
|
3620
|
-
const { cellTheme: o, metrics: i } = t, a =
|
|
3621
|
-
|
|
3642
|
+
const { cellTheme: o, metrics: i } = t, a = eo(t.width, t.height, i);
|
|
3643
|
+
Vt(e, {
|
|
3622
3644
|
x: t.x + a.x,
|
|
3623
3645
|
y: t.y + a.y,
|
|
3624
3646
|
size: a.width,
|
|
@@ -3632,22 +3654,22 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3632
3654
|
// The icon box is hit exactly, plus 4 px around it (a 24 px target at 16 px).
|
|
3633
3655
|
hitTest: (e, { point: t, size: n, metrics: o }) => {
|
|
3634
3656
|
if (e.readonly) return null;
|
|
3635
|
-
const i =
|
|
3636
|
-
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;
|
|
3637
3659
|
},
|
|
3638
|
-
keyAction: (e, t) => !e.readonly && (t === "Enter" || t === " ") ?
|
|
3639
|
-
},
|
|
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 = {
|
|
3640
3662
|
draw: (e, t, n) => {
|
|
3641
|
-
const { metrics: o, cellTheme: i } = t, a = o.icon, s = t.y + (t.height - a) / 2, r =
|
|
3642
|
-
let
|
|
3643
|
-
for (let
|
|
3644
|
-
|
|
3663
|
+
const { metrics: o, cellTheme: i } = t, a = o.icon, s = t.y + (t.height - a) / 2, r = lt(n);
|
|
3664
|
+
let l = t.x + o.padding;
|
|
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;
|
|
3645
3667
|
},
|
|
3646
|
-
describe: (e, { labels: t }) => e.value > 0 ?
|
|
3668
|
+
describe: (e, { labels: t }) => e.value > 0 ? Po(t.rating, { value: e.value, max: lt(e) }) : "",
|
|
3647
3669
|
// Click the n-th star: value n; click the current value again: clear.
|
|
3648
3670
|
hitTest: (e, { point: t, size: n, metrics: o }) => {
|
|
3649
3671
|
if (e.readonly) return null;
|
|
3650
|
-
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) };
|
|
3651
3673
|
if (!Xe(t, s)) return null;
|
|
3652
3674
|
const r = Math.min(a, Math.max(1, Math.ceil((t.x - o.padding) / i)));
|
|
3653
3675
|
return { action: { type: "update", value: r !== e.value ? r : null }, area: s };
|
|
@@ -3657,145 +3679,145 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3657
3679
|
if (e.readonly) return null;
|
|
3658
3680
|
if (t === "Backspace") return { type: "update", value: null };
|
|
3659
3681
|
if (!/^\d$/.test(t)) return null;
|
|
3660
|
-
const n = Math.min(
|
|
3682
|
+
const n = Math.min(lt(e), Number(t));
|
|
3661
3683
|
return { type: "update", value: n === 0 || n === e.value ? null : n };
|
|
3662
3684
|
}
|
|
3663
|
-
}, 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) => {
|
|
3664
3686
|
const { metrics: o, theme: i } = t;
|
|
3665
3687
|
if (!n.length) return [];
|
|
3666
|
-
|
|
3667
|
-
const a = n.map((h) => Ee(e, h.label, o.chipFontSize) + 2 *
|
|
3668
|
-
let
|
|
3688
|
+
me(e, o.chipFontSize, i.fontFamily);
|
|
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;
|
|
3690
|
+
let c = t.x + o.padding;
|
|
3669
3691
|
const u = [];
|
|
3670
3692
|
return r.widths.forEach((h, m) => {
|
|
3671
|
-
const g = { x:
|
|
3672
|
-
|
|
3673
|
-
}), r.more > 0 &&
|
|
3674
|
-
},
|
|
3693
|
+
const g = { x: c, y: l, width: h, height: o.chip };
|
|
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 = {
|
|
3675
3697
|
draw: (e, t, n) => {
|
|
3676
|
-
|
|
3698
|
+
Mo(e, t, n.options.map((o) => ({ label: o.label, colors: mr(o, t.cellTheme) })));
|
|
3677
3699
|
},
|
|
3678
|
-
describe: (e) =>
|
|
3679
|
-
},
|
|
3700
|
+
describe: (e) => mt(e.options.map((t) => t.label))
|
|
3701
|
+
}, xr = {
|
|
3680
3702
|
draw: (e, t, n) => {
|
|
3681
|
-
const o = { fill: t.cellTheme.badgeFill, color: t.cellTheme.text }, i =
|
|
3682
|
-
|
|
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);
|
|
3683
3705
|
},
|
|
3684
|
-
describe: (e) =>
|
|
3685
|
-
hitTest: (e, t) =>
|
|
3686
|
-
},
|
|
3706
|
+
describe: (e) => mt(e.records.map((t) => t.label)),
|
|
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) => {
|
|
3687
3709
|
if (!t.wasActive && !o || !e) return null;
|
|
3688
3710
|
const i = e.findIndex((a) => Xe(t.point, a));
|
|
3689
3711
|
return i < 0 ? null : { action: n(i), area: e[i] };
|
|
3690
|
-
},
|
|
3691
|
-
const { cellTheme: r, theme:
|
|
3692
|
-
if (e.save(), e.beginPath(), e.arc(n + i / 2, o + i / 2, i / 2, 0, Math.PI * 2), e.closePath(),
|
|
3693
|
-
e.clip(), e.drawImage(
|
|
3712
|
+
}, Rr = (e, t, n, o, i, a, s) => {
|
|
3713
|
+
const { cellTheme: r, theme: l } = t, c = s ? t.images.get(s) : void 0;
|
|
3714
|
+
if (e.save(), e.beginPath(), e.arc(n + i / 2, o + i / 2, i / 2, 0, Math.PI * 2), e.closePath(), c)
|
|
3715
|
+
e.clip(), e.drawImage(c, n, o, i, i);
|
|
3694
3716
|
else {
|
|
3695
3717
|
e.fillStyle = r.avatarFill, e.fill();
|
|
3696
|
-
const u =
|
|
3718
|
+
const u = rr(a);
|
|
3697
3719
|
if (u) {
|
|
3698
3720
|
const h = Math.round(i * 0.55);
|
|
3699
|
-
|
|
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);
|
|
3700
3722
|
}
|
|
3701
3723
|
}
|
|
3702
3724
|
e.restore();
|
|
3703
|
-
},
|
|
3725
|
+
}, kr = {
|
|
3704
3726
|
draw: (e, t, n) => {
|
|
3705
3727
|
const { metrics: o, theme: i } = t;
|
|
3706
3728
|
if (!n.people.length) return;
|
|
3707
3729
|
const a = o.chip;
|
|
3708
|
-
|
|
3709
|
-
const s = n.people.map((u) => a + Ae + Ee(e, u.name, o.fontSize) +
|
|
3710
|
-
let
|
|
3730
|
+
me(e, o.fontSize, i.fontFamily);
|
|
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;
|
|
3732
|
+
let c = t.x + o.padding;
|
|
3711
3733
|
r.widths.forEach((u, h) => {
|
|
3712
3734
|
const m = n.people[h];
|
|
3713
|
-
|
|
3714
|
-
}), 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);
|
|
3715
3737
|
},
|
|
3716
|
-
describe: (e) =>
|
|
3717
|
-
},
|
|
3738
|
+
describe: (e) => mt(e.people.map((t) => t.name))
|
|
3739
|
+
}, no = (e) => {
|
|
3718
3740
|
const t = /\.([\p{L}\p{N}]{1,5})$/u.exec(e);
|
|
3719
3741
|
return t ? t[1].toUpperCase() : "";
|
|
3720
|
-
},
|
|
3742
|
+
}, Wt = new Yt(), Ir = {
|
|
3721
3743
|
draw: (e, t, n) => {
|
|
3722
3744
|
const { metrics: o, cellTheme: i, theme: a } = t;
|
|
3723
3745
|
if (!n.files.length) return;
|
|
3724
3746
|
const s = o.chip, r = Math.max(8, Math.round(s * 0.42));
|
|
3725
|
-
|
|
3726
|
-
const
|
|
3747
|
+
me(e, r, a.fontFamily, "600");
|
|
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;
|
|
3727
3749
|
let h = t.x + o.padding;
|
|
3728
3750
|
const m = [];
|
|
3729
|
-
|
|
3751
|
+
c.widths.forEach((g, C) => {
|
|
3730
3752
|
const S = n.files[C], p = S.thumbnailUrl ? t.images.get(S.thumbnailUrl) : void 0;
|
|
3731
|
-
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 }),
|
|
3732
|
-
}),
|
|
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);
|
|
3733
3755
|
},
|
|
3734
|
-
describe: (e) =>
|
|
3735
|
-
hitTest: (e, t) =>
|
|
3736
|
-
},
|
|
3756
|
+
describe: (e) => mt(e.files.map((t) => t.name)),
|
|
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 = {
|
|
3737
3759
|
draw: (e, t, n) => {
|
|
3738
3760
|
if (n.value == null) return;
|
|
3739
|
-
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,
|
|
3740
|
-
e.save(), e.lineWidth = 2.5, e.beginPath(), e.arc(r,
|
|
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;
|
|
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 });
|
|
3741
3763
|
},
|
|
3742
|
-
describe: (e) => e.value == null ? "" :
|
|
3743
|
-
},
|
|
3764
|
+
describe: (e) => e.value == null ? "" : oo(e.value)
|
|
3765
|
+
}, Tt = 10, Bt = new Yt(), zr = {
|
|
3744
3766
|
draw: (e, t, n) => {
|
|
3745
3767
|
const { metrics: o, cellTheme: i, theme: a } = t;
|
|
3746
3768
|
if (!n.label) return;
|
|
3747
|
-
|
|
3748
|
-
const s = Math.min(
|
|
3749
|
-
D(e, { ...r, radius:
|
|
3769
|
+
me(e, o.chipFontSize, a.fontFamily);
|
|
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 }]);
|
|
3750
3772
|
},
|
|
3751
3773
|
describe: (e) => e.label,
|
|
3752
3774
|
hitTest: (e, t) => {
|
|
3753
3775
|
if (e.disabled || !e.label) return null;
|
|
3754
|
-
const n =
|
|
3776
|
+
const n = Bt.get(He("button", jt(t), [e.label]))?.[0];
|
|
3755
3777
|
return n && Xe(t.point, n) ? { action: { type: "press" }, area: n } : null;
|
|
3756
3778
|
},
|
|
3757
3779
|
keyAction: (e, t) => !e.disabled && (t === "Enter" || t === " ") ? { type: "press" } : null
|
|
3758
|
-
},
|
|
3759
|
-
text:
|
|
3760
|
-
longText:
|
|
3761
|
-
number:
|
|
3762
|
-
select:
|
|
3763
|
-
person:
|
|
3764
|
-
date:
|
|
3765
|
-
boolean:
|
|
3766
|
-
rating:
|
|
3767
|
-
url:
|
|
3768
|
-
link:
|
|
3769
|
-
attachment:
|
|
3770
|
-
progress:
|
|
3771
|
-
button:
|
|
3772
|
-
derived:
|
|
3773
|
-
},
|
|
3774
|
-
|
|
3775
|
-
},
|
|
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) => {
|
|
3776
3798
|
if (e.save(), n === "pending") {
|
|
3777
|
-
const i =
|
|
3799
|
+
const i = Ar / 2, a = t.x + t.width - 3 - i, s = t.y + 3 + i;
|
|
3778
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();
|
|
3779
3801
|
} else
|
|
3780
3802
|
e.lineWidth = 2, e.strokeStyle = o.danger, e.strokeRect(t.x + 1, t.y + 1, t.width - 2, t.height - 2);
|
|
3781
3803
|
e.restore();
|
|
3782
|
-
},
|
|
3783
|
-
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";
|
|
3784
3806
|
let o = e.labels, i = e.theme ?? Ue, a = null, s = null;
|
|
3785
|
-
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) => {
|
|
3786
3808
|
if (e.theme || a === p.theme) return;
|
|
3787
3809
|
a = p.theme;
|
|
3788
3810
|
const w = e.themeRoot?.();
|
|
3789
|
-
w && (i =
|
|
3811
|
+
w && (i = ko(w));
|
|
3790
3812
|
}, u = {
|
|
3791
3813
|
draw: (p, w) => {
|
|
3792
3814
|
const v = e.getValue(w.cell);
|
|
3793
|
-
if (
|
|
3815
|
+
if (c(w), v) {
|
|
3794
3816
|
const R = t[v.kind];
|
|
3795
|
-
R && (p.save(), p.beginPath(), p.rect(w.x, w.y, w.width, w.height), p.clip(), R.draw(p, { ...w, cellTheme: i, metrics:
|
|
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());
|
|
3796
3818
|
}
|
|
3797
3819
|
const y = e.getStatus?.(w.cell);
|
|
3798
|
-
y &&
|
|
3820
|
+
y && Er(p, w, y, i);
|
|
3799
3821
|
}
|
|
3800
3822
|
}, h = (p, w) => w?.type === "update" && e.isReadonly?.(p) ? null : w, m = (p) => {
|
|
3801
3823
|
const w = e.getValue(p), v = w ? t[w.kind]?.describe(w, { labels: o, locale: n }) ?? "" : "", y = e.getStatus?.(p);
|
|
@@ -3805,7 +3827,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3805
3827
|
}, g = (p, w, v, y) => {
|
|
3806
3828
|
const R = e.getValue(p), I = R ? t[R.kind] : void 0;
|
|
3807
3829
|
if (!R || !I?.hitTest) return null;
|
|
3808
|
-
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 });
|
|
3809
3831
|
return k && h(p, k.action) ? k : null;
|
|
3810
3832
|
};
|
|
3811
3833
|
return {
|
|
@@ -3827,12 +3849,12 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3827
3849
|
const R = p();
|
|
3828
3850
|
if (!R || y.button !== 0 || y.shiftKey || y.metaKey || y.ctrlKey) return;
|
|
3829
3851
|
const I = R.getSelection(), k = I.activeCell;
|
|
3830
|
-
if (!k || I.kind !== "cells" || !
|
|
3831
|
-
const P = y.currentTarget?.querySelector("[data-ui-grid]"),
|
|
3832
|
-
if (!P || !
|
|
3833
|
-
const
|
|
3834
|
-
if (
|
|
3835
|
-
const E = g(k,
|
|
3852
|
+
if (!k || I.kind !== "cells" || !ao(I.ranges[0], I.ranges[1])) return;
|
|
3853
|
+
const P = y.currentTarget?.querySelector("[data-ui-grid]"), M = R.getCellRect(k);
|
|
3854
|
+
if (!P || !M) return;
|
|
3855
|
+
const N = P.getBoundingClientRect(), z = { x: y.clientX - N.left - M.x, y: y.clientY - N.top - M.y };
|
|
3856
|
+
if (z.x < 0 || z.y < 0 || z.x >= M.width || z.y >= M.height) return;
|
|
3857
|
+
const E = g(k, z, M, ao(v, k));
|
|
3836
3858
|
E && w(E.action, k);
|
|
3837
3859
|
}
|
|
3838
3860
|
};
|
|
@@ -3845,7 +3867,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3845
3867
|
},
|
|
3846
3868
|
clearImages: () => r.clear()
|
|
3847
3869
|
};
|
|
3848
|
-
},
|
|
3870
|
+
}, Tr = {
|
|
3849
3871
|
"{count} failed": "{count} failed",
|
|
3850
3872
|
"{name} is not a JPEG, PNG, WebP or GIF image": "{name} is not a JPEG, PNG, WebP or GIF image",
|
|
3851
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",
|
|
@@ -4117,8 +4139,8 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
4117
4139
|
"At most {max} tags": "At most {max} tags",
|
|
4118
4140
|
"Expand all": "Expand all",
|
|
4119
4141
|
"Collapse all": "Collapse all"
|
|
4120
|
-
},
|
|
4121
|
-
en:
|
|
4142
|
+
}, Nr = {
|
|
4143
|
+
en: Tr,
|
|
4122
4144
|
"zh-TW": {
|
|
4123
4145
|
"{count} failed": "{count} 個失敗",
|
|
4124
4146
|
"{name} is not a JPEG, PNG, WebP or GIF image": "{name} 不是 JPEG、PNG、WebP 或 GIF 圖片",
|
|
@@ -6304,96 +6326,96 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
6304
6326
|
"Collapse all": "Comprimi tutto"
|
|
6305
6327
|
}
|
|
6306
6328
|
};
|
|
6307
|
-
function
|
|
6308
|
-
return
|
|
6329
|
+
function Fr(e, t, n = {}) {
|
|
6330
|
+
return Po(Nr[e][t], n);
|
|
6309
6331
|
}
|
|
6310
|
-
function
|
|
6311
|
-
const e =
|
|
6332
|
+
function Lr() {
|
|
6333
|
+
const e = ar(() => {
|
|
6312
6334
|
});
|
|
6313
|
-
return (t, n) =>
|
|
6335
|
+
return (t, n) => Fr(e.value, t, n);
|
|
6314
6336
|
}
|
|
6315
|
-
const
|
|
6316
|
-
const t =
|
|
6337
|
+
const Kr = (e) => {
|
|
6338
|
+
const t = Lr(), n = U(() => ({
|
|
6317
6339
|
checked: t("Checked"),
|
|
6318
6340
|
unchecked: t("Not checked"),
|
|
6319
6341
|
rating: t("Rating {value} of {max}", { value: "{value}", max: "{max}" }),
|
|
6320
6342
|
saving: t("Saving"),
|
|
6321
6343
|
failed: t("Not saved"),
|
|
6322
6344
|
...e.labels
|
|
6323
|
-
})), o =
|
|
6324
|
-
return
|
|
6325
|
-
},
|
|
6326
|
-
function
|
|
6327
|
-
const t = e.delayMs ??
|
|
6345
|
+
})), o = Hr({ ...e, labels: n.value });
|
|
6346
|
+
return de(n, (i) => o.setLabels(i)), o;
|
|
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();
|
|
6328
6350
|
let s = 0;
|
|
6329
|
-
const r = (
|
|
6330
|
-
const h = i.get(
|
|
6331
|
-
u ? i.set(
|
|
6332
|
-
},
|
|
6333
|
-
const u = a.get(
|
|
6334
|
-
u && o(u.timer), a.delete(
|
|
6351
|
+
const r = (c, u) => {
|
|
6352
|
+
const h = i.get(c);
|
|
6353
|
+
u ? i.set(c, u) : i.delete(c), h === u || h?.state === u?.state && (h?.state !== "error" || h.message === u.message) || e.onChange();
|
|
6354
|
+
}, l = (c) => {
|
|
6355
|
+
const u = a.get(c);
|
|
6356
|
+
u && o(u.timer), a.delete(c);
|
|
6335
6357
|
};
|
|
6336
6358
|
return {
|
|
6337
|
-
get: (
|
|
6338
|
-
track(
|
|
6339
|
-
c
|
|
6340
|
-
const u = ++s, h = () => a.get(
|
|
6341
|
-
return i.get(
|
|
6342
|
-
h() && r(
|
|
6359
|
+
get: (c) => i.get(c) ?? null,
|
|
6360
|
+
track(c) {
|
|
6361
|
+
l(c);
|
|
6362
|
+
const u = ++s, h = () => a.get(c)?.id === u;
|
|
6363
|
+
return i.get(c)?.state === "error" && r(c, null), a.set(c, { id: u, timer: n(() => {
|
|
6364
|
+
h() && r(c, { state: "saving" });
|
|
6343
6365
|
}, t) }), {
|
|
6344
6366
|
done() {
|
|
6345
|
-
h() && (c
|
|
6367
|
+
h() && (l(c), r(c, null));
|
|
6346
6368
|
},
|
|
6347
6369
|
fail(m) {
|
|
6348
|
-
h() && (c
|
|
6370
|
+
h() && (l(c), r(c, { state: "error", message: m }));
|
|
6349
6371
|
}
|
|
6350
6372
|
};
|
|
6351
6373
|
},
|
|
6352
|
-
fail(
|
|
6353
|
-
c
|
|
6374
|
+
fail(c, u) {
|
|
6375
|
+
l(c), r(c, { state: "error", message: u });
|
|
6354
6376
|
},
|
|
6355
|
-
clear(
|
|
6356
|
-
c
|
|
6377
|
+
clear(c) {
|
|
6378
|
+
l(c), r(c, null);
|
|
6357
6379
|
},
|
|
6358
6380
|
dispose() {
|
|
6359
|
-
for (const
|
|
6381
|
+
for (const c of [...a.keys()]) l(c);
|
|
6360
6382
|
i.clear();
|
|
6361
6383
|
}
|
|
6362
6384
|
};
|
|
6363
6385
|
}
|
|
6364
|
-
function
|
|
6386
|
+
function $r(e) {
|
|
6365
6387
|
return e ? e.state === "saving" ? "pending" : "error" : null;
|
|
6366
6388
|
}
|
|
6367
6389
|
export {
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
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,
|
|
6374
6396
|
qe as cellRange,
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
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,
|
|
6382
6404
|
Ue as defaultGridCellTheme,
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
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
|
|
6399
6421
|
};
|