@synopackageland/ui 0.25.15 → 0.25.17
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 +23 -0
- package/dist/components/app/app-layout/pageTitle.d.ts +6 -0
- package/dist/components/app/app-layout/shellBack.d.ts +4 -4
- package/dist/grid/host/controller.d.ts +9 -0
- package/dist/grid.js +1317 -1302
- package/dist/i18n/text.d.ts +1 -1
- package/dist/index.js +6060 -6046
- package/dist/json-preview/preview.js +4818 -4789
- package/dist/lib/nativeShell.d.ts +37 -5
- package/dist/reka-runtime.json +1 -1
- package/docs/adaptive-layout.md +40 -10
- package/docs/ux-grid.md +23 -1
- package/package.json +1 -1
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 no, getCurrentScope as Yo, onScopeDispose as oo, shallowRef as ue, defineComponent as jo, getCurrentInstance as Qo, useId as Zo, ref as ke, computed as U, onMounted as Jo, onBeforeUnmount as ei, openBlock as Ce, createElementBlock as we, unref as ee, createElementVNode as ne, toDisplayString as ve, normalizeStyle as Be, Fragment as ti, renderList as ni, createCommentVNode as Oe, renderSlot as mn, createTextVNode as oi, inject as ii } from "vue";
|
|
3
|
+
import { useUiText as ai } 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 Bt = (e) => ({ type: 1, displayIndex: e + 1, realIndex: e }), io = (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,
|
|
@@ -33,25 +33,25 @@ const B = {
|
|
|
33
33
|
y: 0,
|
|
34
34
|
rowIndex: -1 / 0,
|
|
35
35
|
columnIndex: -1 / 0,
|
|
36
|
-
type:
|
|
36
|
+
type: b.None,
|
|
37
37
|
isOutOfBounds: !0
|
|
38
|
-
},
|
|
38
|
+
}, kt = {
|
|
39
39
|
columnIndex: -1,
|
|
40
40
|
width: 0,
|
|
41
41
|
x: 0
|
|
42
|
-
},
|
|
42
|
+
}, It = {
|
|
43
43
|
type: O.None,
|
|
44
44
|
ranges: [],
|
|
45
45
|
delta: 0,
|
|
46
46
|
isDragging: !1
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
}, si = /* @__PURE__ */ new Set([
|
|
48
|
+
b.Cell,
|
|
49
|
+
b.RowHeader,
|
|
50
|
+
b.RowHeaderCheckbox,
|
|
51
|
+
b.RowHeaderDragHandler,
|
|
52
|
+
b.RowHeaderExpandHandler
|
|
53
53
|
]);
|
|
54
|
-
class
|
|
54
|
+
class dt {
|
|
55
55
|
map = /* @__PURE__ */ new Map();
|
|
56
56
|
max;
|
|
57
57
|
constructor(t) {
|
|
@@ -73,180 +73,180 @@ class ct {
|
|
|
73
73
|
this.map.clear();
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
const
|
|
76
|
+
const ct = "…", gn = new dt(1e3), fn = new dt(1e3), ao = () => ({
|
|
77
77
|
segment: (e) => Array.from(e, (t) => ({ segment: t }))
|
|
78
|
-
}),
|
|
78
|
+
}), so = typeof Intl < "u" && typeof Intl.Segmenter == "function", ro = so ? new Intl.Segmenter(void 0, { granularity: "word" }) : ao(), Tt = so ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : ao(), lo = (e, t, n) => {
|
|
79
79
|
let o = "", i = 0;
|
|
80
|
-
for (const { segment: a } of
|
|
80
|
+
for (const { segment: a } of ro.segment(t)) {
|
|
81
81
|
const s = e.measureText(a).width;
|
|
82
82
|
if (i + s > n) {
|
|
83
|
-
for (const { segment: r } of
|
|
84
|
-
const
|
|
85
|
-
if (i +
|
|
86
|
-
o += r, i +=
|
|
83
|
+
for (const { segment: r } of Tt.segment(a)) {
|
|
84
|
+
const l = e.measureText(r).width;
|
|
85
|
+
if (i + l > n) break;
|
|
86
|
+
o += r, i += l;
|
|
87
87
|
}
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
90
|
o += a, i += s;
|
|
91
91
|
}
|
|
92
92
|
return { text: o, width: i };
|
|
93
|
-
},
|
|
94
|
-
const { x: n = 0, y: o = 0, text: i, maxWidth: a, maxLines: s, isUnderline: r, fontSize:
|
|
93
|
+
}, ri = (e, t) => {
|
|
94
|
+
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
95
|
let C = [];
|
|
96
|
-
const S = e.measureText(
|
|
96
|
+
const S = e.measureText(ct).width;
|
|
97
97
|
let p = "", w = 0, v = 0;
|
|
98
|
-
const y = `${e.font}-${i}-${
|
|
98
|
+
const y = `${e.font}-${i}-${l}-${a}-${s}`, R = fn.get(y);
|
|
99
99
|
if (R)
|
|
100
100
|
C = R;
|
|
101
101
|
else {
|
|
102
102
|
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(
|
|
103
|
+
const k = (z, E) => {
|
|
104
|
+
C.push({ text: z, width: E, start: v });
|
|
105
|
+
}, P = (z, E, W) => {
|
|
106
|
+
p === "" && (v = W), p += z, w += E;
|
|
107
|
+
}, M = (z, E = 0) => {
|
|
108
|
+
const W = a - S;
|
|
109
|
+
if (w > W) {
|
|
110
|
+
const L = lo(e, p, W);
|
|
111
|
+
p = L.text, w = L.width;
|
|
112
|
+
} else if (z) {
|
|
113
|
+
let L = E;
|
|
114
|
+
for (const { segment: _ } of Tt.segment(z)) {
|
|
115
|
+
const q = e.measureText(_).width;
|
|
116
|
+
if (w + q > W) break;
|
|
117
|
+
P(_, q, L), L += _.length;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
k(p +
|
|
121
|
-
},
|
|
120
|
+
k(p + ct, w + S), p = "", w = 0;
|
|
121
|
+
}, N = (z, E, W) => {
|
|
122
122
|
if (w + E <= a) {
|
|
123
|
-
P(
|
|
123
|
+
P(z, E, W);
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
if (E <= a) {
|
|
127
|
-
C.length < s - 1 ? (k(p, w), p = "", w = 0, P(
|
|
127
|
+
C.length < s - 1 ? (k(p, w), p = "", w = 0, P(z, E, W)) : M(z, W);
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
let
|
|
131
|
-
for (const { segment:
|
|
130
|
+
let L = W;
|
|
131
|
+
for (const { segment: _ } of Tt.segment(z)) {
|
|
132
132
|
if (C.length >= s) break;
|
|
133
|
-
const
|
|
134
|
-
w +
|
|
133
|
+
const q = e.measureText(_).width;
|
|
134
|
+
w + q > a ? C.length < s - 1 ? (k(p, w), p = "", w = 0, P(_, q, L)) : M() : P(_, q, L), L += _.length;
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
|
-
for (const { segment:
|
|
137
|
+
for (const { segment: z } of ro.segment(i)) {
|
|
138
138
|
if (C.length >= s) break;
|
|
139
|
-
if (
|
|
139
|
+
if (z.includes(`
|
|
140
140
|
`)) {
|
|
141
|
-
const E =
|
|
141
|
+
const E = z.split(`
|
|
142
142
|
`);
|
|
143
|
-
for (let
|
|
144
|
-
if (
|
|
143
|
+
for (let W = 0; W < E.length && !(C.length >= s); W++) {
|
|
144
|
+
if (W > 0) {
|
|
145
145
|
if (I++, C.length + 1 === s && I < i.length) {
|
|
146
|
-
|
|
146
|
+
M();
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
149
|
k(p, w), p = "", w = 0, v = I;
|
|
150
150
|
}
|
|
151
|
-
const
|
|
152
|
-
|
|
151
|
+
const L = E[W];
|
|
152
|
+
L.length > 0 && (I += L.length, N(L, e.measureText(L).width, I - L.length));
|
|
153
153
|
}
|
|
154
154
|
continue;
|
|
155
155
|
}
|
|
156
|
-
I +=
|
|
156
|
+
I += z.length, N(z, e.measureText(z).width, I - z.length);
|
|
157
157
|
}
|
|
158
|
-
C.length < s && p !== "" && k(p, w),
|
|
158
|
+
C.length < s && p !== "" && k(p, w), fn.set(y, C);
|
|
159
159
|
}
|
|
160
160
|
if (g) {
|
|
161
|
-
const I = m === "middle" ?
|
|
161
|
+
const I = m === "middle" ? l / 2 : 0;
|
|
162
162
|
u && (e.fillStyle = u, e.strokeStyle = u), e.textAlign = h, e.textBaseline = m;
|
|
163
163
|
for (let k = 0; k < C.length; k++) {
|
|
164
164
|
const P = C[k];
|
|
165
|
-
if (e.fillText(P.text, n, o + k *
|
|
166
|
-
const
|
|
167
|
-
e.beginPath(), e.moveTo(n, o + k *
|
|
165
|
+
if (e.fillText(P.text, n, o + k * c + I), r) {
|
|
166
|
+
const M = e.measureText(P.text).width;
|
|
167
|
+
e.beginPath(), e.moveTo(n, o + k * c + l - 1), e.lineTo(n + M, o + k * c + l - 1), e.stroke();
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
return C;
|
|
172
172
|
}, $e = (e, t) => {
|
|
173
|
-
const { x: n = 0, y: o = 0, text: i, fill: a, fontSize: s = 13, textAlign: r = "left", verticalAlign:
|
|
173
|
+
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
174
|
let m, g;
|
|
175
|
-
const C = `${e.font}-${i}-${s}-${
|
|
175
|
+
const C = `${e.font}-${i}-${s}-${c}`, S = gn.get(C);
|
|
176
176
|
if (S)
|
|
177
177
|
m = S.width, g = S.text;
|
|
178
178
|
else {
|
|
179
179
|
const p = e.measureText(i).width;
|
|
180
|
-
if (p <=
|
|
180
|
+
if (p <= c)
|
|
181
181
|
g = i, m = p;
|
|
182
182
|
else {
|
|
183
|
-
const w = e.measureText(
|
|
184
|
-
g = v.text +
|
|
183
|
+
const w = e.measureText(ct).width, v = lo(e, i, c - w);
|
|
184
|
+
g = v.text + ct, m = v.width + w;
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
gn.set(C, { text: g, width: m });
|
|
187
187
|
}
|
|
188
188
|
if (u) {
|
|
189
|
-
const p =
|
|
190
|
-
a && (e.fillStyle = a, e.strokeStyle = a), e.textAlign = r, e.textBaseline =
|
|
189
|
+
const p = l === "middle" ? s / 2 : 0, w = r === "right" ? n + c : n;
|
|
190
|
+
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
191
|
}
|
|
192
192
|
return { text: g, width: m };
|
|
193
193
|
}, Ke = (e, t) => {
|
|
194
194
|
const { x: n, y: o, points: i, stroke: a, lineWidth: s = 1, closed: r = !1 } = t;
|
|
195
195
|
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
|
|
196
|
+
for (let l = 2; l < i.length; l += 2) e.lineTo(i[l], i[l + 1]);
|
|
197
197
|
r && e.closePath(), e.stroke(), e.restore();
|
|
198
198
|
}, 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),
|
|
199
|
+
const { x: n, y: o, width: i, height: a, fill: s, stroke: r, radius: l, opacity: c } = t;
|
|
200
|
+
if (e.beginPath(), s && (e.fillStyle = s), r && (e.strokeStyle = r), c && (e.globalAlpha = c), l == null)
|
|
201
201
|
e.rect(n, o, i, a);
|
|
202
202
|
else {
|
|
203
|
-
const u = typeof
|
|
204
|
-
tl: Math.min(
|
|
205
|
-
tr: Math.min(
|
|
206
|
-
bl: Math.min(
|
|
207
|
-
br: Math.min(
|
|
203
|
+
const u = typeof l == "number" ? { tl: l, tr: l, br: l, bl: l } : {
|
|
204
|
+
tl: Math.min(l.tl, a / 2, i / 2),
|
|
205
|
+
tr: Math.min(l.tr, a / 2, i / 2),
|
|
206
|
+
bl: Math.min(l.bl, a / 2, i / 2),
|
|
207
|
+
br: Math.min(l.br, a / 2, i / 2)
|
|
208
208
|
};
|
|
209
209
|
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
210
|
}
|
|
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 -
|
|
211
|
+
e.closePath(), s && e.fill(), r && e.stroke(), c && (e.globalAlpha = 1);
|
|
212
|
+
}, li = (e, t) => {
|
|
213
|
+
const { points: n, radiusAll: o, fill: i, stroke: a } = t, s = (c, u) => {
|
|
214
|
+
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
215
|
return { x: h, y: m, len: g, nx: C, ny: S, ang: Math.atan2(S, C) };
|
|
216
216
|
}, r = n.length;
|
|
217
|
-
let
|
|
217
|
+
let l = n[r - 1];
|
|
218
218
|
e.beginPath(), i && (e.fillStyle = i), a && (e.strokeStyle = a);
|
|
219
|
-
for (let
|
|
220
|
-
const u = n[
|
|
219
|
+
for (let c = 0; c < r; c++) {
|
|
220
|
+
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
221
|
let p = Math.asin(Math.min(Math.max(C, -1), 1)), w = 1, v = !1;
|
|
222
222
|
S < 0 ? p < 0 ? p = Math.PI + p : (p = Math.PI - p, w = -1, v = !0) : p > 0 && (w = -1, v = !0);
|
|
223
223
|
const y = u.radius !== void 0 ? u.radius : o, R = p / 2;
|
|
224
224
|
let I = Math.abs(Math.cos(R) * y / Math.sin(R)), k;
|
|
225
225
|
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,
|
|
226
|
+
let P = u.x + g.nx * I, M = u.y + g.ny * I;
|
|
227
|
+
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
228
|
}
|
|
229
229
|
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
|
-
},
|
|
230
|
+
}, Ot = (e, t) => {
|
|
231
|
+
const { x: n, y: o, size: i, radius: a = 4, fill: s, stroke: r, isChecked: l = !1 } = t, c = l ? i : i - 1;
|
|
232
|
+
e.beginPath(), D(e, { x: n, y: o, width: c, height: c, radius: a, fill: s, stroke: r }), r && (e.strokeStyle = r), l && (e.save(), e.beginPath(), e.moveTo(n + i / 4.23, o + i / 1.97), e.lineTo(n + i / 2.42, o + i / 1.44), e.lineTo(n + i / 1.29, o + i / 3.25), e.lineJoin = "round", e.lineCap = "round", e.lineWidth = 1.9, e.stroke(), e.restore());
|
|
233
|
+
}, it = (e, t, n) => {
|
|
234
234
|
const { x: o, y: i, width: a, height: s } = t;
|
|
235
235
|
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,
|
|
236
|
+
}, V = (e, t, n) => t > n ? e >= n && e <= t : e >= t && e <= n, ci = (e, t) => {
|
|
237
237
|
const [n, o] = e;
|
|
238
238
|
for (const [i, a] of t)
|
|
239
239
|
if (i <= n && a >= o) return !0;
|
|
240
240
|
return !1;
|
|
241
|
-
},
|
|
241
|
+
}, ui = (e) => {
|
|
242
242
|
const t = [];
|
|
243
243
|
for (const n of e)
|
|
244
244
|
for (let o = n[0]; o <= n[1]; o++) t.push(o);
|
|
245
245
|
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
|
-
},
|
|
246
|
+
}, di = (e, t, n) => {
|
|
247
|
+
const [o, i] = e, [a, s] = t, [r, l] = n;
|
|
248
|
+
return o >= Math.min(a, r) && o <= Math.max(a, r) && i >= Math.min(s, l) && i <= Math.max(s, l);
|
|
249
|
+
}, Nt = (e) => {
|
|
250
250
|
if (e.length <= 1) return e;
|
|
251
251
|
const t = [...e].sort((i, a) => i[0] - a[0]), n = [];
|
|
252
252
|
let o = [...t[0]];
|
|
@@ -255,44 +255,44 @@ const rt = "…", mn = new ct(1e3), gn = new ct(1e3), io = () => ({
|
|
|
255
255
|
a[0] <= o[1] + 1 ? o = [o[0], Math.max(o[1], a[1])] : (n.push(o), o = [...a]);
|
|
256
256
|
}
|
|
257
257
|
return n.push(o), n;
|
|
258
|
-
},
|
|
258
|
+
}, hi = (e, t) => {
|
|
259
259
|
const n = [];
|
|
260
260
|
let o = !1;
|
|
261
261
|
for (const i of e)
|
|
262
262
|
!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
|
-
},
|
|
263
|
+
return o || n.push(t), Nt(n);
|
|
264
|
+
}, mi = (e) => {
|
|
265
265
|
if (!e.isCellSelection) return null;
|
|
266
266
|
const [t, n] = e.ranges[0], [o, i] = e.ranges[1];
|
|
267
267
|
return [Math.max(t, o), Math.max(n, i)];
|
|
268
|
-
},
|
|
268
|
+
}, gi = (e, t, n) => {
|
|
269
269
|
if (e == null) return { isRowActive: !1, isCellActive: !1 };
|
|
270
270
|
const [o, i] = e;
|
|
271
271
|
return {
|
|
272
272
|
isRowActive: i === t,
|
|
273
273
|
isCellActive: i === t && o === n
|
|
274
274
|
};
|
|
275
|
-
},
|
|
275
|
+
}, fi = (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 }, Vt = (e, t) => {
|
|
276
276
|
if (e.length !== t.length) return !1;
|
|
277
277
|
for (let n = 0; n < e.length; n++) {
|
|
278
278
|
const o = e[n], i = t[n];
|
|
279
279
|
if (o.length !== i.length || o[0] !== i[0] || o[1] !== i[1]) return !1;
|
|
280
280
|
}
|
|
281
281
|
return !0;
|
|
282
|
-
},
|
|
283
|
-
const { x: i, y: a } = t, { scrollLeft: s, scrollTop: r } = n, { freezeRegionWidth:
|
|
282
|
+
}, Gt = (e, t, n, o) => {
|
|
283
|
+
const { x: i, y: a } = t, { scrollLeft: s, scrollTop: r } = n, { freezeRegionWidth: l, rowInitSize: c } = e;
|
|
284
284
|
if (o === O.Columns) {
|
|
285
|
-
const u = i <=
|
|
285
|
+
const u = i <= l ? i : s + i, h = e.getColumnStartIndex(u), m = e.getColumnOffset(h), g = e.getColumnWidth(h);
|
|
286
286
|
return V(u, m, m + g / 2) ? h : h + 1;
|
|
287
287
|
}
|
|
288
288
|
if (o === O.Rows) {
|
|
289
|
-
const u = a <=
|
|
289
|
+
const u = a <= c ? a : r + a, h = e.getRowStartIndex(u), m = e.getRowOffset(h), g = e.getRowHeight(h);
|
|
290
290
|
return V(u, m, m + g / 2) ? h : h + 1;
|
|
291
291
|
}
|
|
292
292
|
return -1 / 0;
|
|
293
293
|
};
|
|
294
|
-
class
|
|
295
|
-
state =
|
|
294
|
+
class pi {
|
|
295
|
+
state = It;
|
|
296
296
|
startPosition = 0;
|
|
297
297
|
options;
|
|
298
298
|
constructor(t) {
|
|
@@ -303,18 +303,18 @@ class gi {
|
|
|
303
303
|
}
|
|
304
304
|
/** On pointerdown. Returns the drag type and ranges when the press can start a drag. */
|
|
305
305
|
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 ===
|
|
306
|
+
const n = this.options.draggable ?? he.All;
|
|
307
|
+
if (n === he.None) return null;
|
|
308
|
+
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;
|
|
309
|
+
if (r === b.RowHeaderDragHandler && n !== he.Column) {
|
|
310
310
|
this.startPosition = h;
|
|
311
|
-
const S = m && s.includes([
|
|
312
|
-
return this.setState({ type: O.Rows, ranges: S, delta: h + i - o.getRowOffset(
|
|
311
|
+
const S = m && s.includes([l, l]) ? C : [[l, l]];
|
|
312
|
+
return this.setState({ type: O.Rows, ranges: S, delta: h + i - o.getRowOffset(l), isDragging: !1 }), { type: O.Rows, ranges: S };
|
|
313
313
|
}
|
|
314
|
-
if (r ===
|
|
314
|
+
if (r === b.ColumnHeader && n !== he.Row) {
|
|
315
315
|
this.startPosition = u;
|
|
316
|
-
const S = g && s.includes([
|
|
317
|
-
return this.setState({ type: O.Columns, ranges: S, delta: u - o.getColumnRelativeOffset(
|
|
316
|
+
const S = g && s.includes([c, c]) ? C : [[c, c]];
|
|
317
|
+
return this.setState({ type: O.Columns, ranges: S, delta: u - o.getColumnRelativeOffset(c, a), isDragging: !1 }), { type: O.Columns, ranges: S };
|
|
318
318
|
}
|
|
319
319
|
return null;
|
|
320
320
|
}
|
|
@@ -332,46 +332,46 @@ class gi {
|
|
|
332
332
|
end(t, n) {
|
|
333
333
|
const { type: o, isDragging: i, ranges: a } = this.state;
|
|
334
334
|
if (i && n && (o === O.Columns || o === O.Rows)) {
|
|
335
|
-
const s =
|
|
335
|
+
const s = Gt(this.options.coordInstance(), t, this.options.scrollState(), o);
|
|
336
336
|
V(s, a[0][0], a[a.length - 1][1]) || n(a, s);
|
|
337
337
|
}
|
|
338
|
-
this.setState(
|
|
338
|
+
this.setState(It);
|
|
339
339
|
}
|
|
340
340
|
/** Esc while pressed or dragging: nothing moves. */
|
|
341
341
|
cancel() {
|
|
342
|
-
this.setState(
|
|
342
|
+
this.setState(It);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
const a =
|
|
345
|
+
const co = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0, Ci = (e, t, n) => Math.max(e - co(t, n) * 2, 0), Ut = (e, t, n, o, i) => {
|
|
346
|
+
const a = co(t, n), s = Ci(e, t, n);
|
|
347
347
|
return a + s / (o || 1) * (i + 0.5);
|
|
348
|
-
},
|
|
348
|
+
}, uo = ({ width: e, theme: t, rowControls: n, rowControlPaddingX: o }) => {
|
|
349
349
|
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:
|
|
350
|
+
const i = n.findIndex((a) => a.type === $.Checkbox);
|
|
351
|
+
return i < 0 ? e / 2 : Ut(e, t, o, n.length, i);
|
|
352
|
+
}, wi = (e, t, n) => {
|
|
353
|
+
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
354
|
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:
|
|
355
|
+
}, vi = (e, t, n, o = e.containerHeight) => {
|
|
356
|
+
const { x: i, y: a } = n, { totalHeight: s, totalWidth: r, containerHeight: l } = e;
|
|
357
|
+
return t.scrollLeft + i > r + B.columnAppendBtnWidth || t.scrollTop + a > s && !V(a, l, o);
|
|
358
|
+
}, Si = {
|
|
359
|
+
[$.Drag]: b.RowHeaderDragHandler,
|
|
360
|
+
[$.Checkbox]: b.RowHeaderCheckbox,
|
|
361
|
+
[$.Expand]: b.RowHeaderExpandHandler
|
|
362
|
+
}, ie = {
|
|
363
|
+
type: b.Blank,
|
|
364
364
|
x: 1 / 0,
|
|
365
365
|
y: 1 / 0,
|
|
366
366
|
width: 0,
|
|
367
367
|
height: 0
|
|
368
|
-
}, { groupHeaderHeight:
|
|
369
|
-
const o =
|
|
368
|
+
}, { groupHeaderHeight: yi, columnHeadPadding: pn, columnResizeHandlerWidth: Cn, rowHeadIconPaddingTop: bi, columnFreezeHandlerWidth: xi, fillHandlerSize: Ri, fillHandlerPadding: ki } = B, Ii = (e) => zi(e) ?? Oi(e) ?? Mi(e) ?? Ai(e) ?? Ei(e) ?? Hi(e) ?? Ti(e) ?? Ni(e) ?? Li(e) ?? Fi(e) ?? Di(e) ?? Wi(e) ?? Bi(e) ?? Vi(e) ?? Gi(e) ?? ie, Pi = (e, t, n) => {
|
|
369
|
+
const o = wi(e.coordInstance, e.scrollState, t), i = vi(e.coordInstance, e.scrollState, t, n), a = Ii({
|
|
370
370
|
...e,
|
|
371
371
|
position: o,
|
|
372
372
|
isOutOfBounds: i,
|
|
373
|
-
getLinearRow: e.getLinearRow ??
|
|
374
|
-
real2RowIndex: e.real2RowIndex ??
|
|
373
|
+
getLinearRow: e.getLinearRow ?? Bt,
|
|
374
|
+
real2RowIndex: e.real2RowIndex ?? io
|
|
375
375
|
});
|
|
376
376
|
return {
|
|
377
377
|
...o,
|
|
@@ -381,90 +381,90 @@ const lo = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
381
381
|
columnIndex: a.columnIndex ?? o.columnIndex,
|
|
382
382
|
region: a
|
|
383
383
|
};
|
|
384
|
-
},
|
|
384
|
+
}, zi = (e) => e.isFreezing ? { ...ie, type: b.ColumnFreezeHandler } : null, Mi = (e) => {
|
|
385
385
|
const { coordInstance: t, scrollState: n, position: o, activeCell: i, activeCellBound: a, real2RowIndex: s } = e;
|
|
386
386
|
if (i == null || a == null) return null;
|
|
387
|
-
const { x: r, y:
|
|
387
|
+
const { x: r, y: l } = o, { scrollTop: c, scrollLeft: u } = n, [h, m] = i, g = s(m);
|
|
388
388
|
if (g == null) return null;
|
|
389
|
-
const C = t.getRowOffset(g) -
|
|
390
|
-
return V(r, S, S + p) && V(
|
|
391
|
-
},
|
|
389
|
+
const C = t.getRowOffset(g) - c, S = t.getColumnRelativeOffset(h, u), { width: p, height: w } = a;
|
|
390
|
+
return V(r, S, S + p) && V(l, C, C + w) ? { type: b.ActiveCell, x: S, y: C, width: p, height: w, rowIndex: g, columnIndex: h, isOutOfBounds: !1 } : null;
|
|
391
|
+
}, Ai = (e) => e.isOutOfBounds ? ie : null, Ei = (e) => !e.isSelecting || !e.selection.isCellSelection ? null : { ...ie, type: b.Cell }, Hi = (e) => e.columnResizeState.columnIndex <= -1 ? null : { ...ie, type: b.ColumnResizeHandler }, Ti = (e) => e.dragState.isDragging ? { ...ie, type: b.ColumnHeader } : null, Ni = (e) => {
|
|
392
392
|
const { position: t, scrollState: n, coordInstance: o, isColumnFreezable: i } = e;
|
|
393
393
|
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
|
-
},
|
|
394
|
+
const { x: a, y: s } = t, { freezeRegionWidth: r, rowInitSize: l, rowCount: c, containerHeight: u } = o, h = o.getRowOffset(c) - n.scrollTop, m = Math.min(h, u), g = xi / 2;
|
|
395
|
+
return V(a, r - g, r + g) && V(s, l, m) ? { ...ie, type: b.ColumnFreezeHandler } : null;
|
|
396
|
+
}, Li = (e) => {
|
|
397
397
|
const { rowIndex: t, columnIndex: n } = e.position;
|
|
398
|
-
return e.isColumnAppendEnable && t >= -1 && n === -2 ? { ...
|
|
399
|
-
}, Ni = (e) => {
|
|
400
|
-
const { position: t, theme: n, rowControls: o, rowControlPaddingX: i, coordInstance: a, isMultiSelectionEnable: s } = e, { x: r, y: c, rowIndex: l, columnIndex: u } = t;
|
|
401
|
-
if (!s || l !== -1 || u !== -1 || !o.some((v) => v.type === X.Checkbox)) return null;
|
|
402
|
-
const { iconSizeXS: h } = n, m = h / 2, { rowInitSize: g, columnInitSize: C } = a, p = co({ width: C, theme: n, rowControls: o, rowControlPaddingX: i }) - m, w = g / 2 - m;
|
|
403
|
-
return V(r, p, p + h) && V(c, w, w + h) ? { type: x.AllCheckbox, x: p, y: w, width: h, height: h } : null;
|
|
398
|
+
return e.isColumnAppendEnable && t >= -1 && n === -2 ? { ...ie, type: b.AppendColumn } : null;
|
|
404
399
|
}, Fi = (e) => {
|
|
400
|
+
const { position: t, theme: n, rowControls: o, rowControlPaddingX: i, coordInstance: a, isMultiSelectionEnable: s } = e, { x: r, y: l, rowIndex: c, columnIndex: u } = t;
|
|
401
|
+
if (!s || c !== -1 || u !== -1 || !o.some((v) => v.type === $.Checkbox)) return null;
|
|
402
|
+
const { iconSizeXS: h } = n, m = h / 2, { rowInitSize: g, columnInitSize: C } = a, p = uo({ width: C, theme: n, rowControls: o, rowControlPaddingX: i }) - m, w = g / 2 - m;
|
|
403
|
+
return V(r, p, p + h) && V(l, w, w + h) ? { type: b.AllCheckbox, x: p, y: w, width: h, height: h } : null;
|
|
404
|
+
}, Di = (e) => {
|
|
405
405
|
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(
|
|
406
|
+
return n >= -1 && t > -1 ? e.getLinearRow(t).type !== le.Append ? null : { ...ie, type: b.AppendRow } : null;
|
|
407
|
+
}, Wi = (e) => {
|
|
408
|
+
const { position: t, theme: n, rowControls: o, rowControlPaddingX: i, scrollState: a, coordInstance: s } = e, { x: r, y: l, rowIndex: c, columnIndex: u } = t;
|
|
409
|
+
if (c <= -1 || u !== -1) return null;
|
|
410
|
+
const h = e.getLinearRow(c);
|
|
411
|
+
if (h.type === le.Group) return { ...ie, type: b.RowGroupControl };
|
|
412
|
+
if (h.type !== le.Row) return null;
|
|
413
|
+
const { iconSizeXS: m } = n, g = m / 2, C = s.getRowOffset(c) - a.scrollTop;
|
|
414
414
|
for (let S = 0; S < o.length; S++) {
|
|
415
|
-
const p =
|
|
416
|
-
if (p && V(r, v, v + m) && V(
|
|
415
|
+
const p = Si[o[S].type], v = Ut(s.columnInitSize, n, i, o.length, S) - g, y = C + bi;
|
|
416
|
+
if (p && V(r, v, v + m) && V(l, y, y + m))
|
|
417
417
|
return { type: p, x: v, y, width: m, height: m };
|
|
418
418
|
}
|
|
419
|
-
return { ...
|
|
420
|
-
}, Di = (e) => {
|
|
421
|
-
const { position: t, scrollState: n, coordInstance: o, getLinearRow: i } = e, { x: a, y: s, rowIndex: r, columnIndex: c } = t;
|
|
422
|
-
if (r <= -1 || c !== 0 || i(r).type !== se.Group) return null;
|
|
423
|
-
const l = o.getColumnWidth(c), u = o.getColumnRelativeOffset(c, n.scrollLeft);
|
|
424
|
-
return V(a, u, u + l) ? { type: x.RowGroupHeader, x: u, y: s, width: l, height: vi } : null;
|
|
425
|
-
}, Wi = (e) => {
|
|
426
|
-
const { position: t, selection: n, coordInstance: o, scrollState: i, activeCell: a, activeCellBound: s, isFillEnabled: r, real2RowIndex: c } = e;
|
|
427
|
-
if (!r) return null;
|
|
428
|
-
const { isCellSelection: l, ranges: u } = n, { x: h, y: m, rowIndex: g, columnIndex: C } = t;
|
|
429
|
-
if (!l || g < 0 || C < 0) return null;
|
|
430
|
-
const [S, p] = u[0], [w, v] = u[1], y = Math.max(S, w), R = Math.max(p, v), I = c(R), k = o.getColumnRelativeOffset(y, i.scrollLeft) + o.getColumnWidth(y), F = S === w && p === v && a != null && s != null && a[0] === y && a[1] === R && s ? s.height : o.getRowHeight(I), M = o.getRowOffset(I) + F - i.scrollTop, E = bi / 2 + xi, N = k - E, W = M - E;
|
|
431
|
-
return V(h, N, N + E * 2) && V(m, W, W + E * 2) ? { type: x.FillHandler, x: N, y: W, width: E * 2, height: E * 2 } : null;
|
|
419
|
+
return { ...ie, type: b.RowHeader };
|
|
432
420
|
}, Bi = (e) => {
|
|
421
|
+
const { position: t, scrollState: n, coordInstance: o, getLinearRow: i } = e, { x: a, y: s, rowIndex: r, columnIndex: l } = t;
|
|
422
|
+
if (r <= -1 || l !== 0 || i(r).type !== le.Group) return null;
|
|
423
|
+
const c = o.getColumnWidth(l), u = o.getColumnRelativeOffset(l, n.scrollLeft);
|
|
424
|
+
return V(a, u, u + c) ? { type: b.RowGroupHeader, x: u, y: s, width: c, height: yi } : null;
|
|
425
|
+
}, Oi = (e) => {
|
|
426
|
+
const { position: t, selection: n, coordInstance: o, scrollState: i, activeCell: a, activeCellBound: s, isFillEnabled: r, real2RowIndex: l } = e;
|
|
427
|
+
if (!r) return null;
|
|
428
|
+
const { isCellSelection: c, ranges: u } = n, { x: h, y: m, rowIndex: g, columnIndex: C } = t;
|
|
429
|
+
if (!c || g < 0 || C < 0) return null;
|
|
430
|
+
const [S, p] = u[0], [w, v] = u[1], y = Math.max(S, w), R = Math.max(p, v), I = l(R), k = o.getColumnRelativeOffset(y, i.scrollLeft) + o.getColumnWidth(y), N = S === w && p === v && a != null && s != null && a[0] === y && a[1] === R && s ? s.height : o.getRowHeight(I), z = o.getRowOffset(I) + N - i.scrollTop, E = Ri / 2 + ki, W = k - E, L = z - E;
|
|
431
|
+
return V(h, W, W + E * 2) && V(m, L, L + E * 2) ? { type: b.FillHandler, x: W, y: L, width: E * 2, height: E * 2 } : null;
|
|
432
|
+
}, Vi = (e) => {
|
|
433
433
|
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:
|
|
434
|
+
return a > -1 && s > -1 ? i(a).type !== le.Row ? null : {
|
|
435
|
+
type: b.Cell,
|
|
436
436
|
x: t.getColumnRelativeOffset(s, o.scrollLeft),
|
|
437
437
|
y: t.getRowOffset(a) - o.scrollTop,
|
|
438
438
|
width: t.getColumnWidth(s),
|
|
439
439
|
height: t.getRowHeight(a)
|
|
440
440
|
} : null;
|
|
441
|
-
},
|
|
442
|
-
const { position: t, scrollState: n, coordInstance: o, columns: i, theme: a, isColumnResizable: s, isColumnHeaderMenuVisible: r } = e, { x:
|
|
441
|
+
}, Gi = (e) => {
|
|
442
|
+
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
443
|
if (u !== -1 || h <= -1) return null;
|
|
444
444
|
const g = i[h];
|
|
445
445
|
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(
|
|
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 - pn / 2 - m : I;
|
|
447
|
+
if (v && V(l, k, k + m))
|
|
448
|
+
return { type: b.ColumnHeaderMenu, x: R, y: 0, width: m, height: C };
|
|
449
|
+
const P = k - m - pn / 2, M = (C - m) / 2;
|
|
450
|
+
if (p && V(l, P, P + m) && V(c, M, M + m))
|
|
451
|
+
return { type: b.ColumnDescription, x: P, y: M, width: m, height: m };
|
|
452
|
+
const N = R + m / 2, z = (C - m) / 2;
|
|
453
|
+
return S && V(l, N, N + m) && V(c, z, z + m) ? { type: b.ColumnPrimaryIcon, x: N, y: z, width: m, height: m } : s && (h !== 0 && V(l, R, R + Cn / 2) || V(l, I - Cn / 2, I)) ? { ...ie, type: b.ColumnResizeHandler } : { type: b.ColumnHeader, x: R, y: 0, width: y, height: C };
|
|
454
454
|
}, {
|
|
455
|
-
fillHandlerSize:
|
|
456
|
-
cellTextLineHeight:
|
|
457
|
-
rowHeadIconPaddingTop:
|
|
458
|
-
columnHeadHeight:
|
|
459
|
-
columnHeadPadding:
|
|
455
|
+
fillHandlerSize: at,
|
|
456
|
+
cellTextLineHeight: wn,
|
|
457
|
+
rowHeadIconPaddingTop: vn,
|
|
458
|
+
columnHeadHeight: Sn,
|
|
459
|
+
columnHeadPadding: oe,
|
|
460
460
|
columnHeadMenuSize: Me,
|
|
461
|
-
columnAppendBtnWidth:
|
|
462
|
-
columnResizeHandlerWidth:
|
|
463
|
-
columnResizeHandlerPaddingTop:
|
|
464
|
-
cellVerticalPaddingMD:
|
|
465
|
-
columnFreezeHandlerWidth:
|
|
466
|
-
columnFreezeHandlerHeight:
|
|
467
|
-
} = B,
|
|
461
|
+
columnAppendBtnWidth: yn,
|
|
462
|
+
columnResizeHandlerWidth: bn,
|
|
463
|
+
columnResizeHandlerPaddingTop: xn,
|
|
464
|
+
cellVerticalPaddingMD: Lt,
|
|
465
|
+
columnFreezeHandlerWidth: Rn,
|
|
466
|
+
columnFreezeHandlerHeight: kn
|
|
467
|
+
} = B, In = (e, t) => {
|
|
468
468
|
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
469
|
return {
|
|
470
470
|
startRowIndex: Math.max(0, i),
|
|
@@ -472,138 +472,138 @@ const lo = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
472
472
|
startColumnIndex: Math.max(0, s),
|
|
473
473
|
stopColumnIndex: Math.max(0, Math.min(o - 1, r))
|
|
474
474
|
};
|
|
475
|
-
},
|
|
475
|
+
}, Ui = (e) => ({
|
|
476
476
|
...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
|
-
|
|
477
|
+
getLinearRow: e.getLinearRow ?? Bt,
|
|
478
|
+
real2RowIndex: e.real2RowIndex ?? io
|
|
479
|
+
}), Pn = (e, t) => {
|
|
480
|
+
const { coordInstance: n, visibleRegion: o, activeCell: i, highlightedRowIndex: a, mouseState: s, scrollState: r, selection: l, isSelecting: c, theme: u, getLinearRow: h } = e, { freezeColumnCount: m, columnInitSize: g, totalWidth: C, rowCount: S } = n, { isRowSelection: p, isColumnSelection: w } = l, { scrollLeft: v, scrollTop: y } = r, { rowIndex: R, type: I, isOutOfBounds: k } = s, P = [], M = [], N = [];
|
|
481
|
+
if (!S) return { cellPropList: P, rowHeaderPropList: M, appendRowList: N };
|
|
482
|
+
const z = t === "freeze", E = z ? 0 : Math.max(m, o.startColumnIndex), W = z ? Math.max(m - 1, 0) : o.stopColumnIndex, L = z && m === 0, { cellBg: _, cellBgHovered: q, cellBgSelected: ae } = u;
|
|
483
|
+
for (let X = E; X <= W; X++) {
|
|
484
|
+
const A = n.getColumnRelativeOffset(X, v), F = n.getColumnWidth(X), fe = w && l.includes([X, X]), Te = X === 0;
|
|
485
|
+
for (let Y = o.startRowIndex; Y <= o.stopRowIndex; Y++) {
|
|
486
|
+
const Ne = h(Y), Le = n.getRowHeight(Y), Fe = n.getRowOffset(Y) - y;
|
|
487
|
+
if (Ne.type === le.Group) continue;
|
|
488
|
+
if (Ne.type === le.Append) {
|
|
489
|
+
Te && N.push({ x: 0.5, y: Fe + 0.5, width: C - v, height: Le, isHover: I === b.AppendRow && R === Y });
|
|
490
490
|
continue;
|
|
491
491
|
}
|
|
492
|
-
const { displayIndex:
|
|
493
|
-
let
|
|
494
|
-
|
|
492
|
+
const { displayIndex: ft, realIndex: Pe } = Ne, Ye = !k && !c && si.has(I) && Y === R, { isCellActive: je, isRowActive: Se } = gi(i, Pe, X), { isRowSelected: ye, isCellSelected: ce } = fi(l, Pe, X), Qe = a === Pe;
|
|
493
|
+
let re;
|
|
494
|
+
ce || ye || fe ? re = ae : (Ye || Se || Qe) && (re = q), Te && M.push({
|
|
495
495
|
x: 0.5,
|
|
496
496
|
y: Fe + 0.5,
|
|
497
497
|
width: g + 0.5,
|
|
498
|
-
height:
|
|
499
|
-
displayIndex: String(
|
|
500
|
-
isHover:
|
|
501
|
-
isChecked: p &&
|
|
502
|
-
}), !
|
|
503
|
-
x:
|
|
498
|
+
height: Le,
|
|
499
|
+
displayIndex: String(ft),
|
|
500
|
+
isHover: Ye || Se || Qe,
|
|
501
|
+
isChecked: p && ye
|
|
502
|
+
}), !L && P.push({
|
|
503
|
+
x: A + 0.5,
|
|
504
504
|
y: Fe + 0.5,
|
|
505
|
-
width:
|
|
506
|
-
height:
|
|
507
|
-
rowIndex:
|
|
508
|
-
columnIndex:
|
|
505
|
+
width: F,
|
|
506
|
+
height: Le,
|
|
507
|
+
rowIndex: Pe,
|
|
508
|
+
columnIndex: X,
|
|
509
509
|
theme: u,
|
|
510
510
|
isActive: !1,
|
|
511
|
-
fill:
|
|
511
|
+
fill: je ? _ : re ?? _
|
|
512
512
|
});
|
|
513
513
|
}
|
|
514
514
|
}
|
|
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 +
|
|
515
|
+
return { cellPropList: P, rowHeaderPropList: M, appendRowList: N };
|
|
516
|
+
}, Ki = (e, t, n) => {
|
|
517
|
+
const { x: o, y: i, width: a, height: s, displayIndex: r, isHover: l, isChecked: c } = t, { theme: u, rowControls: h, rowControlPaddingX: m, rowIndexVisible: g = !0, drawIcon: C } = n, { cellBg: S, cellBgHovered: p, cellBgSelected: w, cellLineColor: v, rowHeaderTextColor: y, iconSizeXS: R, staticWhite: I, iconBgSelected: k } = u;
|
|
518
|
+
D(e, { x: o, y: i, width: a, height: s, fill: c ? w : l ? p : S }), Ke(e, { x: o, y: i, points: [0, 0, a, 0], stroke: v }), Ke(e, { x: o, y: i, points: [0, s, a, s], stroke: v });
|
|
519
|
+
const M = R / 2;
|
|
520
|
+
if (e.font = `${u.fontSizeXXS}px ${u.fontFamily}`, (c || l || !g) && h.length > 0) {
|
|
521
|
+
for (let N = 0; N < h.length; N++) {
|
|
522
|
+
const { type: z } = h[N];
|
|
523
|
+
if (z === $.Spacer) continue;
|
|
524
|
+
const E = Ut(a, u, m, h.length, N);
|
|
525
|
+
if (z === $.Checkbox) {
|
|
526
|
+
Ot(e, {
|
|
527
|
+
x: o + E - M,
|
|
528
|
+
y: i + vn,
|
|
529
529
|
size: R,
|
|
530
|
-
stroke:
|
|
531
|
-
fill:
|
|
532
|
-
isChecked:
|
|
530
|
+
stroke: c ? I : y,
|
|
531
|
+
fill: c ? k : void 0,
|
|
532
|
+
isChecked: c
|
|
533
533
|
});
|
|
534
534
|
continue;
|
|
535
535
|
}
|
|
536
|
-
|
|
536
|
+
c && !l && g && z === $.Expand || C?.(e, { kind: z === $.Drag ? "drag" : "expand", x: o + E - M, y: i + vn, size: R, theme: u });
|
|
537
537
|
}
|
|
538
538
|
return;
|
|
539
539
|
}
|
|
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 = `${
|
|
540
|
+
$e(e, { x: o + a / 2, y: i + Lt + 1, text: r, textAlign: "center", fill: y, fontSize: u.fontSizeXXS });
|
|
541
|
+
}, _i = (e, t, n) => {
|
|
542
|
+
const { x: o, y: i, width: a, height: s, isHover: r } = t, { theme: l, coordInstance: c, drawIcon: u } = n, { appendRowBgHovered: h, iconSizeSM: m, cellBg: g, cellLineColor: C } = l, S = m / 2;
|
|
543
|
+
e.save(), e.beginPath(), D(e, { x: o + 0.5, y: i + 0.5, width: a, height: s, fill: r ? h : g }), D(e, { x: o, y: i + s, width: a, height: 1, fill: C }), u?.(e, { kind: "add", x: o + c.columnInitSize / 2 - S + 0.5, y: i + s / 2 - S + 0.5, size: m, theme: l }), e.restore();
|
|
544
|
+
}, $i = (e, t, n) => {
|
|
545
|
+
const { coordInstance: o, theme: i, shouldRerender: a, drawCell: s } = n, { fontFamily: r, fontSizeSM: l, cellLineColor: c } = i, { rowInitSize: u, freezeRegionWidth: h, containerWidth: m, containerHeight: g } = o, C = Pn(n, "other"), S = Pn(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 };
|
|
546
|
+
S.appendRowList.forEach((v) => _i(e, v, n)), it(e, p, (v) => {
|
|
547
|
+
S.cellPropList.forEach(({ x: y, y: R, width: I, height: k, fill: P }) => D(v, { x: y, y: R, width: I, height: k, fill: P, stroke: c })), S.rowHeaderPropList.forEach((y) => Ki(v, y, n));
|
|
548
|
+
}), it(e, w, (v) => {
|
|
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: c }));
|
|
550
|
+
}), a && (it(t, p, (v) => {
|
|
551
|
+
v.font = `${l}px ${r}`, S.cellPropList.forEach((y) => s(v, y));
|
|
552
|
+
}), it(t, w, (v) => {
|
|
553
|
+
v.font = `${l}px ${r}`, C.cellPropList.forEach((y) => s(v, y));
|
|
554
554
|
}));
|
|
555
|
-
},
|
|
556
|
-
const { theme: n, scrollState: o, coordInstance: i, activeCellBound: a, real2RowIndex: s, getLinearRow: r, drawCell:
|
|
555
|
+
}, qi = (e, t) => {
|
|
556
|
+
const { theme: n, scrollState: o, coordInstance: i, activeCellBound: a, real2RowIndex: s, getLinearRow: r, drawCell: l } = t;
|
|
557
557
|
if (a == null) return;
|
|
558
|
-
const { width:
|
|
559
|
-
if (h >= w || r(y)?.type !==
|
|
558
|
+
const { width: c, height: u, columnIndex: h, rowIndex: m } = a, { freezeColumnCount: g, freezeRegionWidth: C, containerWidth: S, containerHeight: p, columnCount: w, rowInitSize: v } = i, y = s(m);
|
|
559
|
+
if (h >= w || r(y)?.type !== le.Row) return;
|
|
560
560
|
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 =
|
|
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: c, height: u, fill: n.cellBg, stroke: n.cellLineColorActived, radius: 2 }), l(e, { x: I + 0.5, y: k + 0.5, width: c, height: u, rowIndex: m, columnIndex: h, theme: n, isActive: !0 }), e.restore();
|
|
562
|
+
}, Xi = (e, t) => {
|
|
563
|
+
const { selection: n, mouseState: o, coordInstance: i, scrollState: a, theme: s, isFilling: r, isFillEnabled: l, real2RowIndex: c, getLinearRow: u } = t;
|
|
564
|
+
if (!r || !l || !n.isCellSelection) return;
|
|
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 = (N) => i.getRowOffset(c(N)) + i.getRowHeight(c(N)) - y;
|
|
566
|
+
let P = null, M = null;
|
|
567
|
+
Number.isFinite(w) && w > p ? (P = i.getRowOffset(c(p + 1)) - y, M = k(w)) : Number.isFinite(w) && w < S && (P = i.getRowOffset(c(w)) - y, M = k(S - 1)), !(P == null || M == null) && (e.save(), e.globalAlpha = 0.12, D(e, { x: R + 0.5, y: P + 0.5, width: I - R, height: M - P, fill: s.interactionLineColorHighlight }), e.restore(), D(e, { x: R + 0.5, y: P + 0.5, width: I - R, height: M - P, stroke: s.interactionLineColorHighlight }));
|
|
568
|
+
}, Yi = (e, t) => {
|
|
569
|
+
const { coordInstance: n, scrollState: o, selection: i, isSelecting: a, isEditing: s, theme: r, activeCellBound: l, isFillEnabled: c, real2RowIndex: u, getLinearRow: h } = t;
|
|
570
|
+
if (!c || s || a) return;
|
|
571
|
+
const m = mi(i);
|
|
572
572
|
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
|
-
|
|
573
|
+
const { freezeColumnCount: g, freezeRegionWidth: C, rowInitSize: S, containerWidth: p, containerHeight: w } = n, [v, y] = m, R = n.getColumnRelativeOffset(v, o.scrollLeft), I = u(y), k = n.getRowOffset(I) - o.scrollTop, P = n.getColumnWidth(v), z = Vt([i.ranges[0]], [i.ranges[1]]) && l != null && l.columnIndex === v && l.rowIndex === y && h(I).type === le.Row ? l.height : n.getRowHeight(I);
|
|
574
|
+
e.save(), e.beginPath(), v >= g && (e.rect(C, S, p - C, w - S), e.clip()), D(e, { x: R + P - at / 2 - 0.5, y: k + z - at / 2 - 0.5, width: at, height: at, stroke: r.cellLineColorActived, fill: r.cellBg }), e.restore();
|
|
575
|
+
}, ji = (e, t, n) => {
|
|
576
|
+
const { x: o, y: i, width: a, height: s, fill: r, column: l, hasMenu: c } = t, { theme: u, drawIcon: h } = n, { name: m, description: g, hasMenu: C, isPrimary: S, hasIcon: p } = l, { cellLineColor: w, columnHeaderBg: v, iconFgCommon: y, columnHeaderNameColor: R, fontSizeSM: I, iconSizeXS: k } = u;
|
|
577
|
+
let P = a - oe * 2, M = oe;
|
|
578
|
+
const N = c && C, z = i + (Sn - k) / 2;
|
|
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 - oe, h?.(e, { kind: "primary", x: o + M, y: z, size: k, theme: u, column: l }), M += k + oe / 2), p && (P = P - k, h?.(e, { kind: "column", x: o + M, y: z, size: k, theme: u, column: l }), M += k + oe / 2), N) {
|
|
580
|
+
P = P - Me - oe;
|
|
581
|
+
const E = i + Sn / 2;
|
|
582
|
+
li(e, {
|
|
583
583
|
points: [
|
|
584
|
-
{ x: o + a -
|
|
585
|
-
{ x: o + a -
|
|
586
|
-
{ x: o + a -
|
|
584
|
+
{ x: o + a - oe - Me, y: E - Me / 4 },
|
|
585
|
+
{ x: o + a - oe, y: E - Me / 4 },
|
|
586
|
+
{ x: o + a - oe - Me / 2, y: E + Me / 4 }
|
|
587
587
|
],
|
|
588
588
|
radiusAll: 1,
|
|
589
589
|
fill: y
|
|
590
590
|
});
|
|
591
591
|
}
|
|
592
|
-
g && (h?.(e, { kind: "description", x:
|
|
593
|
-
x: o +
|
|
594
|
-
y: i +
|
|
592
|
+
g && (h?.(e, { kind: "description", x: N ? o + a - 2 * k - oe : o + a - k - oe, y: z, size: k, theme: u, column: l }), P = P - k - oe), ri(e, {
|
|
593
|
+
x: o + M,
|
|
594
|
+
y: i + Lt,
|
|
595
595
|
text: m,
|
|
596
|
-
maxLines: Math.max(1, Math.floor((s -
|
|
597
|
-
lineHeight:
|
|
596
|
+
maxLines: Math.max(1, Math.floor((s - Lt) / wn)),
|
|
597
|
+
lineHeight: wn,
|
|
598
598
|
fontSize: I,
|
|
599
599
|
maxWidth: P,
|
|
600
600
|
fill: R
|
|
601
601
|
});
|
|
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
|
-
|
|
602
|
+
}, Qi = (e, t, n) => {
|
|
603
|
+
const { x: o, y: i, width: a, height: s, isChecked: r } = t, { theme: l, rowControls: c, rowControlPaddingX: u, isMultiSelectionEnable: h } = n, { iconSizeXS: m, staticWhite: g, columnHeaderBg: C, cellLineColor: S, rowHeaderTextColor: p, iconBgSelected: w } = l, v = m / 2;
|
|
604
|
+
if (D(e, { x: o, y: i, width: a, height: s, fill: C }), Ke(e, { x: o, y: i, points: [0, s, a, s], stroke: S }), h && c.some((y) => y.type === $.Checkbox)) {
|
|
605
|
+
const y = uo({ width: a, theme: l, rowControls: c, rowControlPaddingX: u });
|
|
606
|
+
Ot(e, {
|
|
607
607
|
x: o + y - v + 0.5,
|
|
608
608
|
y: i + s / 2 - v,
|
|
609
609
|
size: m,
|
|
@@ -612,93 +612,93 @@ const lo = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
612
612
|
isChecked: r
|
|
613
613
|
});
|
|
614
614
|
}
|
|
615
|
-
},
|
|
616
|
-
const { visibleRegion: o, coordInstance: i, columns: a, theme: s, mouseState: r, scrollState:
|
|
615
|
+
}, zn = (e, t, n) => {
|
|
616
|
+
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
617
|
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,
|
|
618
|
+
for (let E = M; E <= N; E++) {
|
|
619
|
+
const W = a[E];
|
|
620
|
+
if (W == null) continue;
|
|
621
|
+
const L = v && c.includes([E, E]), _ = !u && (I === b.ColumnHeader || I === b.ColumnHeaderMenu) && k === E, q = L ? s.columnHeaderBgSelected : _ ? s.columnHeaderBgHovered : void 0;
|
|
622
|
+
ji(e, {
|
|
623
|
+
x: i.getColumnRelativeOffset(E, l.scrollLeft) + 0.5,
|
|
624
624
|
y: 0.5,
|
|
625
625
|
width: i.getColumnWidth(E),
|
|
626
626
|
height: C,
|
|
627
|
-
column:
|
|
628
|
-
fill:
|
|
627
|
+
column: W,
|
|
628
|
+
fill: q,
|
|
629
629
|
hasMenu: h
|
|
630
630
|
}, t);
|
|
631
631
|
}
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
},
|
|
632
|
+
const z = y && R.length > 0 && Vt([R[0]], [[0, w - 1]]);
|
|
633
|
+
Qi(e, { x: 0, y: 0.5, width: S + 1.5, height: C, isChecked: z }, t), e.restore();
|
|
634
|
+
}, Zi = (e, t) => {
|
|
635
635
|
const { coordInstance: n, theme: o, mouseState: i, scrollState: a, isColumnAppendEnable: s, drawIcon: r } = t;
|
|
636
636
|
if (!s) return;
|
|
637
|
-
const { totalWidth:
|
|
638
|
-
D(e, { x: S + 1, y: 0.5, width:
|
|
637
|
+
const { totalWidth: l, totalHeight: c, rowInitSize: u } = n, { iconSizeSM: h, columnHeaderBg: m, cellLineColor: g, columnHeaderBgHovered: C } = o, S = l - a.scrollLeft;
|
|
638
|
+
D(e, { x: S + 1, y: 0.5, width: yn, 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
639
|
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 ?
|
|
640
|
+
r?.(e, { kind: "add", x: S + yn / 2 - p + 0.5, y: u / 2 - p + 0.5, size: h, theme: o });
|
|
641
|
+
}, Ji = (e, t) => {
|
|
642
|
+
const { theme: n, scrollState: o, coordInstance: i, isColumnResizable: a, columnResizeState: s, hoveredColumnResizeIndex: r } = t, l = s.columnIndex, c = !!a && r > -1, u = l > -1;
|
|
643
|
+
if (!c && !u) return;
|
|
644
|
+
const h = u ? l : r, m = i.getColumnRelativeOffset(h, o.scrollLeft) + i.getColumnWidth(h);
|
|
645
645
|
D(e, {
|
|
646
|
-
x: m -
|
|
647
|
-
y:
|
|
648
|
-
width:
|
|
649
|
-
height: i.rowInitSize -
|
|
646
|
+
x: m - bn / 2 + 0.5,
|
|
647
|
+
y: xn + 0.5,
|
|
648
|
+
width: bn,
|
|
649
|
+
height: i.rowInitSize - xn * 2,
|
|
650
650
|
fill: n.columnResizeHandlerBg,
|
|
651
651
|
radius: 3
|
|
652
652
|
});
|
|
653
|
-
},
|
|
654
|
-
const { theme: n, mouseState: o, scrollState: i, dragState: a, coordInstance: s } = t, { type: r, isDragging:
|
|
655
|
-
if (!
|
|
656
|
-
const h =
|
|
653
|
+
}, ea = (e, t) => {
|
|
654
|
+
const { theme: n, mouseState: o, scrollState: i, dragState: a, coordInstance: s } = t, { type: r, isDragging: l, ranges: c, delta: u } = a;
|
|
655
|
+
if (!l || r !== O.Columns) return;
|
|
656
|
+
const h = c[0][0];
|
|
657
657
|
D(e, { x: o.x - u, y: 0.5, width: s.getColumnWidth(h), height: s.containerHeight, fill: n.columnDraggingPlaceholderBg });
|
|
658
|
-
const m =
|
|
658
|
+
const m = Gt(s, o, i, r), g = s.getColumnRelativeOffset(m, i.scrollLeft);
|
|
659
659
|
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 =
|
|
660
|
+
}, ta = (e, t) => {
|
|
661
|
+
const { theme: n, mouseState: o, scrollState: i, dragState: a, coordInstance: s } = t, { type: r, isDragging: l, ranges: c, delta: u } = a;
|
|
662
|
+
if (!l || r !== O.Rows) return;
|
|
663
|
+
const h = c[0][0];
|
|
664
664
|
D(e, { x: 0.5, y: o.y - u, width: s.containerWidth, height: s.getRowHeight(h), fill: n.columnDraggingPlaceholderBg });
|
|
665
|
-
const m =
|
|
665
|
+
const m = Gt(s, o, i, r), g = s.getRowOffset(m) - i.scrollTop;
|
|
666
666
|
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:
|
|
667
|
+
}, na = (e, t) => {
|
|
668
|
+
const { coordInstance: n, mouseState: o, scrollState: i, columnFreezeState: a, theme: s } = t, { isFreezing: r, targetIndex: l } = a;
|
|
669
|
+
if (o.type !== b.ColumnFreezeHandler && !r) return;
|
|
670
|
+
const { containerHeight: c, freezeRegionWidth: u } = n, h = s.interactionLineColorHighlight, m = r ? o.x : u;
|
|
671
671
|
if (r) {
|
|
672
|
-
const g = n.getColumnRelativeOffset(
|
|
673
|
-
D(e, { x: g - 1, y: 0, width: 2, height:
|
|
672
|
+
const g = n.getColumnRelativeOffset(l + 1, i.scrollLeft);
|
|
673
|
+
D(e, { x: g - 1, y: 0, width: 2, height: c, fill: h });
|
|
674
674
|
}
|
|
675
|
-
D(e, { x: m -
|
|
676
|
-
},
|
|
675
|
+
D(e, { x: m - Rn / 2, y: o.y - kn / 2, width: Rn, height: kn, fill: h, radius: 4 }), D(e, { x: m - 1, y: 0, width: 2, height: c, fill: h });
|
|
676
|
+
}, oa = (e, t) => {
|
|
677
677
|
const { theme: n, coordInstance: o, scrollState: i } = t, { freezeRegionWidth: a, containerHeight: s } = o, r = n.interactionLineColorCommon;
|
|
678
678
|
if (i.scrollLeft === 0) {
|
|
679
679
|
D(e, { x: a, y: 0.5, width: 1, height: s, fill: r });
|
|
680
680
|
return;
|
|
681
681
|
}
|
|
682
682
|
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 (
|
|
691
|
-
const u = Math.ceil(
|
|
692
|
-
(e.width !== u || e.height !== h) && (e.width = u, e.height = h, e.style.width = `${
|
|
683
|
+
}, ia = (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), aa = (e, t) => {
|
|
684
|
+
const { containerWidth: n, containerHeight: o, pixelRatio: i, shouldRerender: a, draw: s } = t, r = Math.ceil(n * i), l = Math.ceil(o * i);
|
|
685
|
+
(e.width !== r || e.height !== l) && (e.width = r, e.height = l);
|
|
686
|
+
const c = e.getContext("2d");
|
|
687
|
+
c != null && (a && (c.clearRect(0, 0, r, l), c.save(), i !== 1 && c.scale(i, i), c.beginPath(), c.rect(0, 0, n, o), c.clip()), s(c), a && c.restore());
|
|
688
|
+
}, sa = (e, t, n, o, i = Math.ceil(globalThis.devicePixelRatio ?? 1)) => {
|
|
689
|
+
const a = Ui(n), { coordInstance: s, scrollState: r, height: l } = a, { containerWidth: c } = s;
|
|
690
|
+
if (c === 0 || l === 0) return;
|
|
691
|
+
const u = Math.ceil(c * i), h = Math.ceil(l * i), m = r.isScrolling || ia(n, o);
|
|
692
|
+
(e.width !== u || e.height !== h) && (e.width = u, e.height = h, e.style.width = `${c}px`, e.style.height = `${l}px`);
|
|
693
693
|
const g = e.getContext("2d");
|
|
694
|
-
g != null && (g.clearRect(0, 0, u, h), g.save(), i !== 1 && g.scale(i, i), g.beginPath(), g.rect(0, 0,
|
|
695
|
-
containerWidth:
|
|
696
|
-
containerHeight:
|
|
694
|
+
g != null && (g.clearRect(0, 0, u, h), g.save(), i !== 1 && g.scale(i, i), g.beginPath(), g.rect(0, 0, c, l), g.clip(), aa(t, {
|
|
695
|
+
containerWidth: c,
|
|
696
|
+
containerHeight: l,
|
|
697
697
|
pixelRatio: i,
|
|
698
698
|
shouldRerender: m,
|
|
699
|
-
draw: (C) =>
|
|
700
|
-
}), g.save(), g.setTransform(1, 0, 0, 1, 0, 0), g.drawImage(t, 0, 0, u, h), g.restore(), s.rowInitSize > 0 && (
|
|
701
|
-
},
|
|
699
|
+
draw: (C) => $i(g, C, { ...a, shouldRerender: m })
|
|
700
|
+
}), g.save(), g.setTransform(1, 0, 0, 1, 0, 0), g.drawImage(t, 0, 0, u, h), g.restore(), s.rowInitSize > 0 && (zn(g, a, "freeze"), zn(g, a, "other"), Zi(g, a)), oa(g, a), qi(g, a), Xi(g, a), Yi(g, a), Ji(g, a), ta(g, a), ea(g, a), na(g, a), g.restore());
|
|
701
|
+
}, ho = {
|
|
702
702
|
staticWhite: "#FFFFFF",
|
|
703
703
|
staticBlack: "#000000",
|
|
704
704
|
iconFgCommon: "#6b7280",
|
|
@@ -743,7 +743,7 @@ const lo = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
743
743
|
interactionLineColorCommon: "#d4d4d8",
|
|
744
744
|
interactionLineColorHighlight: "#3b82f6",
|
|
745
745
|
themeKey: "light"
|
|
746
|
-
},
|
|
746
|
+
}, mo = {
|
|
747
747
|
staticWhite: "--ui-accent-contrast",
|
|
748
748
|
staticBlack: "--ui-text",
|
|
749
749
|
iconFgCommon: "--ui-icon-tertiary",
|
|
@@ -777,62 +777,62 @@ const lo = (e, t) => t ? Math.max(t - (e.iconSizeMD - e.iconSizeXS) / 2, 0) : 0,
|
|
|
777
777
|
scrollBarBg: "--ui-scrollbar-thumb-hover",
|
|
778
778
|
interactionLineColorCommon: "--ui-border-strong",
|
|
779
779
|
interactionLineColorHighlight: "--ui-accent-9"
|
|
780
|
-
},
|
|
780
|
+
}, Mn = {
|
|
781
781
|
fontFamily: "--ui-font-sans",
|
|
782
782
|
/** Cell text: the grid's own size (14px on a phone), else the body size. */
|
|
783
783
|
fontSizeSM: "--ui-grid-font-size",
|
|
784
784
|
fontSizeXS: "--ui-font-size-sm"
|
|
785
|
-
},
|
|
786
|
-
const n = { ...
|
|
787
|
-
for (const [i, a] of Object.entries(
|
|
785
|
+
}, ra = { fontSizeSM: "--ui-font-size" }, la = (e, t = {}) => {
|
|
786
|
+
const n = { ...ho };
|
|
787
|
+
for (const [i, a] of Object.entries(mo)) {
|
|
788
788
|
const s = e(a)?.trim();
|
|
789
789
|
s && (n[i] = s);
|
|
790
790
|
}
|
|
791
|
-
const o = e(
|
|
791
|
+
const o = e(Mn.fontFamily)?.trim();
|
|
792
792
|
o && (n.fontFamily = o);
|
|
793
793
|
for (const i of ["fontSizeSM", "fontSizeXS"]) {
|
|
794
|
-
const a =
|
|
795
|
-
let s = Number.parseFloat(e(
|
|
794
|
+
const a = ra[i];
|
|
795
|
+
let s = Number.parseFloat(e(Mn[i]) ?? "");
|
|
796
796
|
!(s > 0) && a && (s = Number.parseFloat(e(a) ?? "")), Number.isFinite(s) && s > 0 && (n[i] = s);
|
|
797
797
|
}
|
|
798
798
|
return { ...n, ...t };
|
|
799
|
-
},
|
|
799
|
+
}, ca = (e) => {
|
|
800
800
|
const t = getComputedStyle(e), n = e.ownerDocument.createElement("span");
|
|
801
801
|
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(
|
|
802
|
+
const o = new Set(Object.values(mo));
|
|
803
803
|
return Object.assign((a) => {
|
|
804
804
|
const s = t.getPropertyValue(a).trim();
|
|
805
805
|
return !s || !o.has(a) ? s : (n.style.color = "", n.style.color = `var(${a})`, getComputedStyle(n).color || s);
|
|
806
806
|
}, { dispose: () => n.remove() });
|
|
807
|
-
},
|
|
808
|
-
const n =
|
|
807
|
+
}, ua = (e, t = {}) => {
|
|
808
|
+
const n = ca(e);
|
|
809
809
|
try {
|
|
810
810
|
const o = e.closest('[data-ui-color-scheme="dark"]') != null;
|
|
811
|
-
return
|
|
811
|
+
return la(n, { themeKey: o ? "dark" : "light", ...t });
|
|
812
812
|
} finally {
|
|
813
813
|
n.dispose();
|
|
814
814
|
}
|
|
815
|
-
},
|
|
816
|
-
function
|
|
817
|
-
return (e instanceof Element ? e : e?.parentElement)?.closest(
|
|
815
|
+
}, go = '[role="dialog"],[role="alertdialog"],[aria-modal="true"]';
|
|
816
|
+
function da(e) {
|
|
817
|
+
return (e instanceof Element ? e : e?.parentElement)?.closest(go) ?? null;
|
|
818
818
|
}
|
|
819
|
-
function
|
|
820
|
-
const n =
|
|
819
|
+
function ha(e, t) {
|
|
820
|
+
const n = da(e);
|
|
821
821
|
return !!n && !n.contains(t);
|
|
822
822
|
}
|
|
823
|
-
function
|
|
824
|
-
return e.some((n) => n instanceof Element && n.matches(
|
|
823
|
+
function An(e, t) {
|
|
824
|
+
return e.some((n) => n instanceof Element && n.matches(go) && !t.some((o) => n.contains(o) || o.contains(n)));
|
|
825
825
|
}
|
|
826
|
-
function
|
|
826
|
+
function ma(e, t = e ?? null) {
|
|
827
827
|
if (!e?.isConnected) return !1;
|
|
828
828
|
const n = e.ownerDocument, o = n.activeElement;
|
|
829
|
-
return o === e ? !0 : o && o !== n.body &&
|
|
829
|
+
return o === e ? !0 : o && o !== n.body && ha(o, t ?? e) ? !1 : (e.focus({ preventScroll: !0 }), n.activeElement === e);
|
|
830
830
|
}
|
|
831
|
-
const
|
|
832
|
-
function
|
|
831
|
+
const ga = /* @__PURE__ */ new Set(["Enter", "Escape", "Tab"]), fa = 50;
|
|
832
|
+
function fo(e) {
|
|
833
833
|
return e.isComposing || e.keyCode === 229;
|
|
834
834
|
}
|
|
835
|
-
function
|
|
835
|
+
function pa(e) {
|
|
836
836
|
const { keyCode: t, metaKey: n, ctrlKey: o } = e;
|
|
837
837
|
return n || o || t === 32 ? !1 : t >= 65 && t <= 90 || // A-Z
|
|
838
838
|
t >= 48 && t <= 57 || // 0-9 (ClosedParen..OpenParen)
|
|
@@ -842,66 +842,66 @@ function ga(e) {
|
|
|
842
842
|
t >= 106 && t <= 111 || // Multiply..Divide
|
|
843
843
|
t === 61 || t === 173 || (t === 229 || t === 0) && e.key !== "Shift";
|
|
844
844
|
}
|
|
845
|
-
function
|
|
845
|
+
function po(e, t = {}) {
|
|
846
846
|
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 =
|
|
847
|
+
const a = /* @__PURE__ */ new WeakMap(), s = (l) => {
|
|
848
|
+
n = !0, t.onStart?.(l);
|
|
849
|
+
}, r = (l) => {
|
|
850
|
+
n = !1, o = l.timeStamp, t.onEnd?.(l);
|
|
851
851
|
};
|
|
852
852
|
return e.addEventListener("compositionstart", s, !0), e.addEventListener("compositionend", r, !0), {
|
|
853
853
|
get composing() {
|
|
854
854
|
return n;
|
|
855
855
|
},
|
|
856
|
-
ownsKey(
|
|
857
|
-
if (n ||
|
|
858
|
-
if (!
|
|
859
|
-
const
|
|
860
|
-
if (
|
|
861
|
-
const u =
|
|
862
|
-
return o = -1 / 0, a.set(
|
|
856
|
+
ownsKey(l) {
|
|
857
|
+
if (n || fo(l)) return !0;
|
|
858
|
+
if (!ga.has(l.key)) return !1;
|
|
859
|
+
const c = a.get(l);
|
|
860
|
+
if (c !== void 0) return c;
|
|
861
|
+
const u = l.timeStamp - o <= fa;
|
|
862
|
+
return o = -1 / 0, a.set(l, u), u;
|
|
863
863
|
},
|
|
864
864
|
dispose() {
|
|
865
865
|
i || (i = !0, e.removeEventListener("compositionstart", s, !0), e.removeEventListener("compositionend", r, !0));
|
|
866
866
|
}
|
|
867
867
|
};
|
|
868
868
|
}
|
|
869
|
-
const
|
|
869
|
+
const Ca = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
870
870
|
if (!e || t == null || t === n || !(t instanceof HTMLElement)) return !0;
|
|
871
871
|
const o = t.isContentEditable || t.contentEditable === "true";
|
|
872
872
|
return t.tagName !== "INPUT" && t.tagName !== "TEXTAREA" && !o;
|
|
873
|
-
},
|
|
874
|
-
`),
|
|
873
|
+
}, wa = /[\t\n\r"]/, va = (e) => wa.test(e) ? `"${e.replace(/"/g, '""')}"` : e, Sa = (e) => e.map((t) => t.map(va).join(" ")).join(`\r
|
|
874
|
+
`), ya = (e) => {
|
|
875
875
|
if (!e) return [];
|
|
876
876
|
const t = [];
|
|
877
877
|
let n = [], o = "", i = 0, a = !0;
|
|
878
878
|
const s = e.length, r = () => {
|
|
879
879
|
n.push(o), o = "", a = !0;
|
|
880
|
-
},
|
|
880
|
+
}, l = () => {
|
|
881
881
|
r(), t.push(n), n = [];
|
|
882
882
|
};
|
|
883
883
|
for (; i < s; ) {
|
|
884
|
-
const
|
|
885
|
-
if (a &&
|
|
886
|
-
const u =
|
|
884
|
+
const c = e[i];
|
|
885
|
+
if (a && c === '"') {
|
|
886
|
+
const u = ba(e, i + 1);
|
|
887
887
|
if (u === -1) {
|
|
888
|
-
o +=
|
|
888
|
+
o += c, a = !1, i++;
|
|
889
889
|
continue;
|
|
890
890
|
}
|
|
891
891
|
o += e.slice(i + 1, u).replace(/""/g, '"'), i = u + 1, a = !1;
|
|
892
892
|
continue;
|
|
893
893
|
}
|
|
894
|
-
if (a = !1,
|
|
894
|
+
if (a = !1, c === " ")
|
|
895
895
|
r(), i++;
|
|
896
|
-
else if (
|
|
896
|
+
else if (c === "\r" || c === `
|
|
897
897
|
`) {
|
|
898
|
-
if (
|
|
899
|
-
` ? 2 : 1, i >= s) return
|
|
898
|
+
if (l(), i += c === "\r" && e[i + 1] === `
|
|
899
|
+
` ? 2 : 1, i >= s) return En(t);
|
|
900
900
|
} else
|
|
901
|
-
o +=
|
|
901
|
+
o += c, i++;
|
|
902
902
|
}
|
|
903
|
-
return
|
|
904
|
-
},
|
|
903
|
+
return l(), En(t);
|
|
904
|
+
}, ba = (e, t) => {
|
|
905
905
|
let n = t;
|
|
906
906
|
for (; n < e.length; ) {
|
|
907
907
|
const o = e.indexOf('"', n);
|
|
@@ -915,11 +915,11 @@ const fa = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
915
915
|
` || i === "\r" ? o : -1;
|
|
916
916
|
}
|
|
917
917
|
return -1;
|
|
918
|
-
},
|
|
918
|
+
}, En = (e) => {
|
|
919
919
|
const t = Math.max(0, ...e.map((n) => n.length));
|
|
920
920
|
for (const n of e) for (; n.length < t; ) n.push("");
|
|
921
921
|
return e;
|
|
922
|
-
},
|
|
922
|
+
}, xa = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), Ra = (e) => e.length === 0 || e.length === 1 && e[0].length <= 1 ? void 0 : `<table><tbody>${e.map((n) => `<tr>${n.map((o) => `<td>${xa(o).replace(/\r?\n/g, "<br>")}</td>`).join("")}</tr>`).join("")}</tbody></table>`, ka = (e, t) => {
|
|
923
923
|
const n = e.clipboardData;
|
|
924
924
|
if (!n) return !1;
|
|
925
925
|
try {
|
|
@@ -928,18 +928,18 @@ const fa = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
928
928
|
return !1;
|
|
929
929
|
}
|
|
930
930
|
return e.preventDefault(), !0;
|
|
931
|
-
},
|
|
931
|
+
}, Ia = () => ({
|
|
932
932
|
clipboard: typeof navigator < "u" ? navigator.clipboard : void 0,
|
|
933
933
|
ClipboardItem: typeof ClipboardItem < "u" ? ClipboardItem : void 0,
|
|
934
934
|
hasFocus: () => typeof document < "u" ? document.hasFocus() : !0,
|
|
935
935
|
onFocus: (e) => window.addEventListener("focus", e, { once: !0 })
|
|
936
|
-
}),
|
|
936
|
+
}), Pa = (e, t = Ia()) => {
|
|
937
937
|
const { clipboard: n, ClipboardItem: o } = t, i = () => {
|
|
938
938
|
if (o && n?.write) {
|
|
939
939
|
const a = new o({
|
|
940
940
|
"text/plain": e.then(({ text: s }) => new Blob([s], { type: "text/plain" })),
|
|
941
941
|
// 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 ??
|
|
942
|
+
"text/html": e.then(({ text: s, html: r }) => new Blob([r ?? za(s)], { type: "text/html" }))
|
|
943
943
|
});
|
|
944
944
|
return n.write([a]);
|
|
945
945
|
}
|
|
@@ -951,66 +951,66 @@ const fa = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
951
951
|
return t.hasFocus && !t.hasFocus() && t.onFocus ? new Promise((s, r) => t.onFocus(() => {
|
|
952
952
|
try {
|
|
953
953
|
i().then(s, r);
|
|
954
|
-
} catch (
|
|
955
|
-
r(
|
|
954
|
+
} catch (l) {
|
|
955
|
+
r(l);
|
|
956
956
|
}
|
|
957
957
|
})) : Promise.reject(a);
|
|
958
958
|
}
|
|
959
|
-
},
|
|
959
|
+
}, za = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), st = (e, t, n) => Math.min(n, Math.max(t, e)), qe = (e, t) => {
|
|
960
960
|
if (e.kind !== "cells" || e.ranges.length < 2 || t.rowCount <= 0 || t.columnCount <= 0) return null;
|
|
961
961
|
const [n, o] = e.ranges, i = t.columnCount - 1, a = t.rowCount - 1;
|
|
962
962
|
return {
|
|
963
|
-
startColumn:
|
|
964
|
-
endColumn:
|
|
965
|
-
startRow:
|
|
966
|
-
endRow:
|
|
963
|
+
startColumn: st(Math.min(n[0], o[0]), 0, i),
|
|
964
|
+
endColumn: st(Math.max(n[0], o[0]), 0, i),
|
|
965
|
+
startRow: st(Math.min(n[1], o[1]), 0, a),
|
|
966
|
+
endRow: st(Math.max(n[1], o[1]), 0, a)
|
|
967
967
|
};
|
|
968
|
-
},
|
|
968
|
+
}, rt = (e, t) => {
|
|
969
969
|
const n = [];
|
|
970
970
|
for (let o = e; o <= t; o++) n.push(o);
|
|
971
971
|
return n;
|
|
972
|
-
},
|
|
972
|
+
}, Hn = (e, t) => {
|
|
973
973
|
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
974
|
for (const [i, a] of o)
|
|
975
975
|
for (let s = Math.max(0, i); s <= Math.min(t - 1, a); s++) n.add(s);
|
|
976
976
|
return [...n].sort((i, a) => i - a);
|
|
977
|
-
},
|
|
977
|
+
}, Co = (e, t) => {
|
|
978
978
|
const { rowCount: n, columnCount: o } = t;
|
|
979
979
|
if (n <= 0 || o <= 0) return null;
|
|
980
980
|
switch (e.kind) {
|
|
981
981
|
case "cells": {
|
|
982
982
|
const i = qe(e, t);
|
|
983
|
-
return i ? { rows:
|
|
983
|
+
return i ? { rows: rt(i.startRow, i.endRow), columns: rt(i.startColumn, i.endColumn) } : null;
|
|
984
984
|
}
|
|
985
985
|
case "rows": {
|
|
986
|
-
const i =
|
|
987
|
-
return i.length ? { rows: i, columns:
|
|
986
|
+
const i = Hn(e.ranges, n);
|
|
987
|
+
return i.length ? { rows: i, columns: rt(0, o - 1) } : null;
|
|
988
988
|
}
|
|
989
989
|
case "columns": {
|
|
990
|
-
const i =
|
|
991
|
-
return i.length ? { rows:
|
|
990
|
+
const i = Hn(e.ranges, o);
|
|
991
|
+
return i.length ? { rows: rt(0, n - 1), columns: i } : null;
|
|
992
992
|
}
|
|
993
993
|
default:
|
|
994
994
|
return null;
|
|
995
995
|
}
|
|
996
|
-
},
|
|
996
|
+
}, Ma = (e, t) => {
|
|
997
997
|
if (e.kind === "cells") {
|
|
998
998
|
const o = qe(e, t);
|
|
999
999
|
return o ? [o.startColumn, o.startRow] : null;
|
|
1000
1000
|
}
|
|
1001
|
-
const n =
|
|
1001
|
+
const n = Co(e, t);
|
|
1002
1002
|
return n ? [n.columns[0], n.rows[0]] : null;
|
|
1003
|
-
},
|
|
1004
|
-
const o =
|
|
1003
|
+
}, Aa = (e) => e.rows.length * e.columns.length, Ea = (e, t, n) => {
|
|
1004
|
+
const o = ya(e);
|
|
1005
1005
|
if (o.length === 0) return null;
|
|
1006
|
-
const i =
|
|
1006
|
+
const i = Ma(t, n);
|
|
1007
1007
|
if (!i) return null;
|
|
1008
1008
|
const { rowCount: a, columnCount: s } = n;
|
|
1009
|
-
let r = o,
|
|
1010
|
-
const
|
|
1011
|
-
if (o.length === 1 && o[0].length === 1 &&
|
|
1009
|
+
let r = o, l = !1;
|
|
1010
|
+
const c = qe(t, n);
|
|
1011
|
+
if (o.length === 1 && o[0].length === 1 && c && (c.endRow > c.startRow || c.endColumn > c.startColumn)) {
|
|
1012
1012
|
const w = o[0][0];
|
|
1013
|
-
r = Array.from({ length:
|
|
1013
|
+
r = Array.from({ length: c.endRow - c.startRow + 1 }, () => Array.from({ length: c.endColumn - c.startColumn + 1 }, () => w)), l = !0;
|
|
1014
1014
|
}
|
|
1015
1015
|
const u = s - i[0], h = r[0].length, m = Math.max(0, h - u);
|
|
1016
1016
|
m > 0 && (r = r.map((w) => w.slice(0, u)));
|
|
@@ -1025,12 +1025,12 @@ const fa = ({ isEditing: e, eventTarget: t, hiddenFocusEl: n }) => {
|
|
|
1025
1025
|
extraRows: Math.max(0, C - (a - 1)),
|
|
1026
1026
|
droppedColumns: m,
|
|
1027
1027
|
readonlyColumns: p,
|
|
1028
|
-
repeated:
|
|
1028
|
+
repeated: l
|
|
1029
1029
|
};
|
|
1030
|
-
},
|
|
1031
|
-
function
|
|
1030
|
+
}, Tn = (e, t) => e.rows.map((n) => e.columns.map((o) => t([o, n]))), Pt = (e) => ({ text: Sa(e), html: Ra(e) }), Ha = (e, t) => !t || e.rows.every((n) => t(n));
|
|
1031
|
+
function Ta(e) {
|
|
1032
1032
|
const t = e.equals ?? Object.is;
|
|
1033
|
-
let n = !1, o = null, i, a, s = !1, r = null,
|
|
1033
|
+
let n = !1, o = null, i, a, s = !1, r = null, l = 0, c = !1;
|
|
1034
1034
|
const u = {
|
|
1035
1035
|
get editing() {
|
|
1036
1036
|
return n;
|
|
@@ -1054,12 +1054,12 @@ function Ea(e) {
|
|
|
1054
1054
|
return r;
|
|
1055
1055
|
},
|
|
1056
1056
|
get version() {
|
|
1057
|
-
return
|
|
1057
|
+
return l;
|
|
1058
1058
|
}
|
|
1059
1059
|
}, h = () => {
|
|
1060
|
-
|
|
1060
|
+
l += 1, e.onChange?.(u);
|
|
1061
1061
|
}, m = () => {
|
|
1062
|
-
n = !1, o = null, i = void 0, a = void 0, r = null,
|
|
1062
|
+
n = !1, o = null, i = void 0, a = void 0, r = null, c = !1;
|
|
1063
1063
|
}, g = {
|
|
1064
1064
|
state: u,
|
|
1065
1065
|
start(C, S, p = S) {
|
|
@@ -1069,12 +1069,12 @@ function Ea(e) {
|
|
|
1069
1069
|
n && (a = C, r = null, h());
|
|
1070
1070
|
},
|
|
1071
1071
|
setComposing(C) {
|
|
1072
|
-
s !== C && (s = C, h(), !C &&
|
|
1072
|
+
s !== C && (s = C, h(), !C && c && (c = !1, g.commit()));
|
|
1073
1073
|
},
|
|
1074
1074
|
commit() {
|
|
1075
1075
|
if (!n || o === null) return "idle";
|
|
1076
1076
|
if (s)
|
|
1077
|
-
return
|
|
1077
|
+
return c = !0, "composing";
|
|
1078
1078
|
if (!u.dirty)
|
|
1079
1079
|
return m(), h(), "clean";
|
|
1080
1080
|
const C = e.validate?.(a, o);
|
|
@@ -1091,20 +1091,20 @@ function Ea(e) {
|
|
|
1091
1091
|
};
|
|
1092
1092
|
return g;
|
|
1093
1093
|
}
|
|
1094
|
-
const
|
|
1095
|
-
function
|
|
1094
|
+
const wo = "data-ui-ignore-outside", zt = /* @__PURE__ */ new WeakMap(), Nn = /* @__PURE__ */ new WeakSet();
|
|
1095
|
+
function Ln(e) {
|
|
1096
1096
|
return [...e.options.elements()].filter((t) => !!t);
|
|
1097
1097
|
}
|
|
1098
1098
|
function Fn(e, t) {
|
|
1099
1099
|
return e.some((n) => n instanceof Node && t.some((o) => o === n || o.contains(n)));
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1102
|
-
return e.some((t) => t instanceof Element && t.hasAttribute(
|
|
1101
|
+
function Na(e) {
|
|
1102
|
+
return e.some((t) => t instanceof Element && t.hasAttribute(wo));
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1104
|
+
function La(e, t) {
|
|
1105
1105
|
return e.length > 0 && !e.includes(t);
|
|
1106
1106
|
}
|
|
1107
|
-
function
|
|
1107
|
+
function Fa(e, t = 400) {
|
|
1108
1108
|
let n = 0;
|
|
1109
1109
|
const o = () => {
|
|
1110
1110
|
e.clearTimeout(n), e.removeEventListener("click", i, !0), e.removeEventListener("pointerdown", o, !0), e.removeEventListener("keydown", o, !0);
|
|
@@ -1113,19 +1113,19 @@ function Na(e, t = 400) {
|
|
|
1113
1113
|
};
|
|
1114
1114
|
return e.addEventListener("click", i, !0), e.addEventListener("pointerdown", o, !0), e.addEventListener("keydown", o, !0), n = e.setTimeout(o, t), o;
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
const t = e.document, n = { layers: [], guard:
|
|
1116
|
+
function Da(e) {
|
|
1117
|
+
const t = e.document, n = { layers: [], guard: po(e), teardown: () => {
|
|
1118
1118
|
} }, o = (a) => {
|
|
1119
|
-
if (
|
|
1120
|
-
|
|
1119
|
+
if (Nn.has(a)) return;
|
|
1120
|
+
Nn.add(a);
|
|
1121
1121
|
const s = a.composedPath();
|
|
1122
|
-
if (!(
|
|
1122
|
+
if (!(Na(s) || La(s, t)))
|
|
1123
1123
|
for (const r of [...n.layers].reverse()) {
|
|
1124
1124
|
if (r.disposed) continue;
|
|
1125
|
-
const
|
|
1126
|
-
if (Fn(s,
|
|
1125
|
+
const l = Ln(r);
|
|
1126
|
+
if (Fn(s, l) || An(s, l)) return;
|
|
1127
1127
|
if (r.options.onOutside?.(a) === "veto") {
|
|
1128
|
-
a.preventDefault(), a.stopImmediatePropagation(),
|
|
1128
|
+
a.preventDefault(), a.stopImmediatePropagation(), Fa(e);
|
|
1129
1129
|
return;
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
@@ -1133,75 +1133,75 @@ function Fa(e) {
|
|
|
1133
1133
|
if (a.key !== "Escape" || a.defaultPrevented || n.guard.ownsKey(a)) return;
|
|
1134
1134
|
const s = n.layers.at(-1);
|
|
1135
1135
|
if (!s?.options.onEscape) return;
|
|
1136
|
-
const r = a.composedPath(),
|
|
1137
|
-
if (
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1136
|
+
const r = a.composedPath(), l = Ln(s);
|
|
1137
|
+
if (An(r, l)) return;
|
|
1138
|
+
const c = r.find((u) => u instanceof Element && u.hasAttribute(wo));
|
|
1139
|
+
c && !Fn([c], l) || s.options.onEscape(a) && (a.preventDefault(), a.stopPropagation());
|
|
1140
1140
|
};
|
|
1141
1141
|
return e.addEventListener("pointerdown", o, !0), e.addEventListener("keydown", i, !0), n.teardown = () => {
|
|
1142
1142
|
e.removeEventListener("pointerdown", o, !0), e.removeEventListener("keydown", i, !0), n.guard.dispose();
|
|
1143
1143
|
}, n;
|
|
1144
1144
|
}
|
|
1145
|
-
function
|
|
1146
|
-
const n =
|
|
1147
|
-
|
|
1145
|
+
function Wa(e, t) {
|
|
1146
|
+
const n = zt.get(e) ?? Da(e);
|
|
1147
|
+
zt.set(e, n);
|
|
1148
1148
|
const o = { options: t, disposed: !1 };
|
|
1149
1149
|
return n.layers.push(o), {
|
|
1150
1150
|
get disposed() {
|
|
1151
1151
|
return o.disposed;
|
|
1152
1152
|
},
|
|
1153
1153
|
dispose() {
|
|
1154
|
-
o.disposed || (o.disposed = !0, n.layers = n.layers.filter((i) => i !== o), !n.layers.length && (n.teardown(),
|
|
1154
|
+
o.disposed || (o.disposed = !0, n.layers = n.layers.filter((i) => i !== o), !n.layers.length && (n.teardown(), zt.delete(e)));
|
|
1155
1155
|
}
|
|
1156
1156
|
};
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1159
|
-
const t =
|
|
1158
|
+
function Dn(e) {
|
|
1159
|
+
const t = no(e);
|
|
1160
1160
|
return Array.isArray(t) ? [...t] : [t];
|
|
1161
1161
|
}
|
|
1162
|
-
function
|
|
1163
|
-
const o =
|
|
1162
|
+
function Ba(e, t, n) {
|
|
1163
|
+
const o = de(() => no(t), (i, a, s) => {
|
|
1164
1164
|
if (!i || typeof window > "u") return;
|
|
1165
|
-
const r =
|
|
1166
|
-
elements: () =>
|
|
1167
|
-
onOutside: (
|
|
1168
|
-
onEscape: (
|
|
1165
|
+
const r = Dn(e).find(Boolean)?.ownerDocument?.defaultView ?? window, l = Wa(r, {
|
|
1166
|
+
elements: () => Dn(e),
|
|
1167
|
+
onOutside: (c) => n.onOutside?.(c),
|
|
1168
|
+
onEscape: (c) => n.onEscape?.(c)
|
|
1169
1169
|
});
|
|
1170
|
-
s(() =>
|
|
1170
|
+
s(() => l.dispose());
|
|
1171
1171
|
}, { immediate: !0, flush: "sync" });
|
|
1172
|
-
return
|
|
1172
|
+
return Yo() && oo(o), o;
|
|
1173
1173
|
}
|
|
1174
|
-
const
|
|
1175
|
-
function
|
|
1174
|
+
const vo = 2, Oa = 4, Mt = 20, Va = 2, Ga = 5, ut = 16;
|
|
1175
|
+
function Ua(e, t, n) {
|
|
1176
1176
|
const o = e.createElement("canvas").getContext("2d");
|
|
1177
1177
|
if (!o) return null;
|
|
1178
1178
|
o.font = `${t}px ${n}`, o.textBaseline = "alphabetic";
|
|
1179
1179
|
const { fontBoundingBoxAscent: i, fontBoundingBoxDescent: a } = o.measureText("Hg");
|
|
1180
1180
|
o.textBaseline = "middle";
|
|
1181
1181
|
const { alphabeticBaseline: s } = o.measureText("Hg"), r = { ascent: i, descent: a, drop: -s };
|
|
1182
|
-
return Object.values(r).every((
|
|
1182
|
+
return Object.values(r).every((l) => Number.isFinite(l) && Math.abs(l) < t * 2) ? r : null;
|
|
1183
1183
|
}
|
|
1184
|
-
const
|
|
1185
|
-
function
|
|
1184
|
+
const Kt = (e) => e.view || e.kind === "long-text";
|
|
1185
|
+
function ht(e) {
|
|
1186
1186
|
const t = e.textBox, n = e.rowHeight;
|
|
1187
|
-
if (!
|
|
1187
|
+
if (!Kt(e)) {
|
|
1188
1188
|
if (!t) return { top: 0, bottom: 0, lineHeight: n };
|
|
1189
1189
|
const a = Math.ceil(t.ascent + t.descent), s = Math.round(n / 2 + t.drop - t.ascent);
|
|
1190
1190
|
return { top: Math.max(0, Math.min(n - a, s)), bottom: 0, lineHeight: a };
|
|
1191
1191
|
}
|
|
1192
|
-
const o = Math.max(0, (n -
|
|
1193
|
-
return { top: Math.max(0, i), bottom: e.hint ?
|
|
1192
|
+
const o = Math.max(0, (n - Mt) / 2), i = t ? Math.round(n / 2 + t.drop - t.ascent) - Math.floor((Mt - Math.ceil(t.ascent + t.descent)) / 2) : o;
|
|
1193
|
+
return { top: Math.max(0, i), bottom: e.hint ? ut : o, lineHeight: Mt };
|
|
1194
1194
|
}
|
|
1195
|
-
function
|
|
1196
|
-
if (!
|
|
1197
|
-
const { top: t, bottom: n, lineHeight: o } =
|
|
1195
|
+
function So(e) {
|
|
1196
|
+
if (!Kt(e)) return e.rowHeight;
|
|
1197
|
+
const { top: t, bottom: n, lineHeight: o } = ht(e), i = e.view ? 1 : Va, a = Math.min(Ga, Math.max(i, Math.ceil(e.lines)));
|
|
1198
1198
|
return Math.max(e.rowHeight, t + n + a * o);
|
|
1199
1199
|
}
|
|
1200
|
-
function
|
|
1201
|
-
const { top: n, bottom: o, lineHeight: i } =
|
|
1200
|
+
function Ka(e, t) {
|
|
1201
|
+
const { top: n, bottom: o, lineHeight: i } = ht(t);
|
|
1202
1202
|
return Math.max(1, Math.round((e - n - o) / i));
|
|
1203
1203
|
}
|
|
1204
|
-
const
|
|
1204
|
+
const _a = {
|
|
1205
1205
|
display: "block",
|
|
1206
1206
|
width: "100%",
|
|
1207
1207
|
height: "100%",
|
|
@@ -1217,14 +1217,14 @@ const Ua = {
|
|
|
1217
1217
|
color: "transparent",
|
|
1218
1218
|
font: "inherit"
|
|
1219
1219
|
};
|
|
1220
|
-
function
|
|
1221
|
-
if (!e.open) return
|
|
1222
|
-
const { top: t, bottom: n, lineHeight: o } =
|
|
1220
|
+
function $a(e) {
|
|
1221
|
+
if (!e.open) return _a;
|
|
1222
|
+
const { top: t, bottom: n, lineHeight: o } = ht(e), i = B.cellHorizontalPadding, a = Kt(e), s = e.invalid ? e.dangerColor : e.theme.cellLineColorActived;
|
|
1223
1223
|
return {
|
|
1224
1224
|
display: "block",
|
|
1225
1225
|
"box-sizing": "border-box",
|
|
1226
1226
|
width: "100%",
|
|
1227
|
-
height: `${
|
|
1227
|
+
height: `${So(e)}px`,
|
|
1228
1228
|
margin: "0",
|
|
1229
1229
|
padding: `${t}px ${i}px ${n}px`,
|
|
1230
1230
|
border: "0",
|
|
@@ -1240,19 +1240,19 @@ function Ka(e) {
|
|
|
1240
1240
|
"caret-color": e.theme.cellTextColor,
|
|
1241
1241
|
font: `${e.theme.fontSizeSM}px/${o}px ${e.theme.fontFamily}`,
|
|
1242
1242
|
"text-align": e.kind === "number" && !e.view ? "right" : "left",
|
|
1243
|
-
"border-radius": `${
|
|
1244
|
-
"box-shadow": `0 0 0 ${
|
|
1243
|
+
"border-radius": `${Oa}px`,
|
|
1244
|
+
"box-shadow": `0 0 0 ${vo}px ${s}`,
|
|
1245
1245
|
transition: "none"
|
|
1246
1246
|
};
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1248
|
+
function qa(e) {
|
|
1249
1249
|
return {
|
|
1250
1250
|
position: "absolute",
|
|
1251
1251
|
left: `${B.cellHorizontalPadding}px`,
|
|
1252
1252
|
right: `${B.cellHorizontalPadding}px`,
|
|
1253
1253
|
// Placed by `top` from the editor height so it never depends on layout.
|
|
1254
|
-
height: `${
|
|
1255
|
-
"line-height": `${
|
|
1254
|
+
height: `${ut}px`,
|
|
1255
|
+
"line-height": `${ut - 2}px`,
|
|
1256
1256
|
"font-size": "var(--ui-font-size-sm, 12px)",
|
|
1257
1257
|
"font-family": e.theme.fontFamily,
|
|
1258
1258
|
color: "var(--ui-text-muted)",
|
|
@@ -1262,10 +1262,10 @@ function _a(e) {
|
|
|
1262
1262
|
"pointer-events": "none"
|
|
1263
1263
|
};
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1265
|
+
function Xa(e) {
|
|
1266
1266
|
return {
|
|
1267
1267
|
position: "absolute",
|
|
1268
|
-
left: `-${
|
|
1268
|
+
left: `-${vo}px`,
|
|
1269
1269
|
"max-width": "320px",
|
|
1270
1270
|
"min-width": "120px",
|
|
1271
1271
|
"box-sizing": "border-box",
|
|
@@ -1281,8 +1281,8 @@ function $a(e) {
|
|
|
1281
1281
|
"pointer-events": "none"
|
|
1282
1282
|
};
|
|
1283
1283
|
}
|
|
1284
|
-
const
|
|
1285
|
-
class
|
|
1284
|
+
const Ya = (e, t) => !!e && !!t && e[0] === t[0] && e[1] === t[1];
|
|
1285
|
+
class ja {
|
|
1286
1286
|
session;
|
|
1287
1287
|
options;
|
|
1288
1288
|
mode = "edit";
|
|
@@ -1322,11 +1322,11 @@ class Xa {
|
|
|
1322
1322
|
get version() {
|
|
1323
1323
|
return n().version;
|
|
1324
1324
|
}
|
|
1325
|
-
}, this.session =
|
|
1325
|
+
}, this.session = Ta({
|
|
1326
1326
|
validate: (i, a) => this.mode === "edit" ? this.options.validate?.(a, i ?? "") : null,
|
|
1327
1327
|
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:
|
|
1328
|
+
const { move: r, reason: l } = this.pending;
|
|
1329
|
+
this.wrote = !0, this.options.onCommit({ cell: [i[0], i[1]], value: a ?? "", previous: s ?? "", move: r, reason: l });
|
|
1330
1330
|
},
|
|
1331
1331
|
onChange: () => this.options.onChange?.(this.state)
|
|
1332
1332
|
});
|
|
@@ -1337,7 +1337,7 @@ class Xa {
|
|
|
1337
1337
|
* edited (the IME keydown, then its `compositionstart`) changes nothing.
|
|
1338
1338
|
*/
|
|
1339
1339
|
begin(t) {
|
|
1340
|
-
if (this.state.active &&
|
|
1340
|
+
if (this.state.active && Ya(this.state.cell, t.cell)) return null;
|
|
1341
1341
|
this.state.active && this.commit("selection", "none");
|
|
1342
1342
|
const n = t.mode === "edit" && (t.trigger === "key" || t.trigger === "composition");
|
|
1343
1343
|
this.mode = t.mode, this.kind = t.kind, this.pending = { move: "none", reason: "blur" };
|
|
@@ -1403,10 +1403,10 @@ class Xa {
|
|
|
1403
1403
|
return this.pending.reason;
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1407
|
-
const t =
|
|
1406
|
+
function Qa(e) {
|
|
1407
|
+
const t = ue(1);
|
|
1408
1408
|
let n = null;
|
|
1409
|
-
const o = new
|
|
1409
|
+
const o = new ja({
|
|
1410
1410
|
validate: (u, h) => {
|
|
1411
1411
|
const m = e.columnAt(u[0]);
|
|
1412
1412
|
return m && e.validate ? e.validate(u, m, h) : null;
|
|
@@ -1438,14 +1438,14 @@ function Ya(e) {
|
|
|
1438
1438
|
dirty: o.state.dirty,
|
|
1439
1439
|
error: o.state.error,
|
|
1440
1440
|
version: o.state.version
|
|
1441
|
-
}), a =
|
|
1441
|
+
}), a = ue(i()), s = (u) => u.editor ?? "text", r = (u) => e.enabled() && s(u) !== "custom", l = () => {
|
|
1442
1442
|
const u = e.owner(), { kind: h, mode: m, active: g } = o.state;
|
|
1443
1443
|
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 } =
|
|
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 } = ht(C), { height: w, padding: v, whiteSpace: y } = u.style;
|
|
1445
1445
|
u.style.height = "0px", u.style.padding = `${S}px 8px ${p}px`, u.style.whiteSpace = "pre-wrap";
|
|
1446
|
-
const R =
|
|
1446
|
+
const R = Ka(u.scrollHeight, C);
|
|
1447
1447
|
u.style.height = w, u.style.padding = v, u.style.whiteSpace = y, R !== t.value && (t.value = R);
|
|
1448
|
-
},
|
|
1448
|
+
}, c = {
|
|
1449
1449
|
state: a,
|
|
1450
1450
|
lines: t,
|
|
1451
1451
|
get active() {
|
|
@@ -1463,7 +1463,7 @@ function Ya(e) {
|
|
|
1463
1463
|
});
|
|
1464
1464
|
if (!S) return !0;
|
|
1465
1465
|
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,
|
|
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, l(), !0;
|
|
1467
1467
|
},
|
|
1468
1468
|
keyDown(u, h) {
|
|
1469
1469
|
if (!o.state.active) return !1;
|
|
@@ -1476,11 +1476,11 @@ function Ya(e) {
|
|
|
1476
1476
|
compositionEnd() {
|
|
1477
1477
|
if (!o.state.active) return;
|
|
1478
1478
|
const u = e.owner();
|
|
1479
|
-
u && o.input(u.value), o.setComposing(!1), o.state.active &&
|
|
1479
|
+
u && o.input(u.value), o.setComposing(!1), o.state.active && l();
|
|
1480
1480
|
},
|
|
1481
1481
|
input() {
|
|
1482
1482
|
const u = e.owner();
|
|
1483
|
-
!u || !o.state.active || (o.input(u.value),
|
|
1483
|
+
!u || !o.state.active || (o.input(u.value), l());
|
|
1484
1484
|
},
|
|
1485
1485
|
blur() {
|
|
1486
1486
|
!o.state.active || o.state.composing || o.commit("blur", "none");
|
|
@@ -1493,11 +1493,11 @@ function Ya(e) {
|
|
|
1493
1493
|
o.cancel();
|
|
1494
1494
|
}
|
|
1495
1495
|
};
|
|
1496
|
-
return
|
|
1497
|
-
u && (n =
|
|
1496
|
+
return de(e.owner, (u, h, m) => {
|
|
1497
|
+
u && (n = po(u), m(() => {
|
|
1498
1498
|
n?.dispose(), n = null;
|
|
1499
1499
|
}));
|
|
1500
|
-
}, { immediate: !0, flush: "sync" }),
|
|
1500
|
+
}, { immediate: !0, flush: "sync" }), Ba(
|
|
1501
1501
|
() => e.root() ?? null,
|
|
1502
1502
|
() => a.value.active || e.hasSelection(),
|
|
1503
1503
|
{
|
|
@@ -1509,9 +1509,9 @@ function Ya(e) {
|
|
|
1509
1509
|
if (o.commit("outside", "none") === "invalid") return "veto";
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
|
-
),
|
|
1512
|
+
), oo(() => o.cancel()), c;
|
|
1513
1513
|
}
|
|
1514
|
-
const
|
|
1514
|
+
const Za = {
|
|
1515
1515
|
text: "--ui-text",
|
|
1516
1516
|
textMuted: "--ui-text-secondary",
|
|
1517
1517
|
link: "--ui-accent-11",
|
|
@@ -1532,7 +1532,7 @@ const ja = {
|
|
|
1532
1532
|
avatarText: "--ui-text",
|
|
1533
1533
|
badgeFill: "--ui-neutral-soft",
|
|
1534
1534
|
badgeText: "--ui-neutral-text"
|
|
1535
|
-
},
|
|
1535
|
+
}, Ja = {
|
|
1536
1536
|
neutral: { fill: "--ui-neutral-soft", color: "--ui-neutral-text" },
|
|
1537
1537
|
info: { fill: "--ui-info-soft", color: "--ui-info-text" },
|
|
1538
1538
|
success: { fill: "--ui-success-soft", color: "--ui-success-text" },
|
|
@@ -1577,15 +1577,15 @@ const ja = {
|
|
|
1577
1577
|
gray: { fill: "rgba(198, 212, 224, 0.4)", color: "#636b74" }
|
|
1578
1578
|
},
|
|
1579
1579
|
themeKey: "light"
|
|
1580
|
-
},
|
|
1580
|
+
}, es = (e, t = {}) => {
|
|
1581
1581
|
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(
|
|
1582
|
+
for (const [i, a] of Object.entries(Za)) o[i] = n(a, o[i]);
|
|
1583
|
+
for (const [i, a] of Object.entries(Ja)) {
|
|
1584
1584
|
const s = Ue.chips[i];
|
|
1585
1585
|
o.chips[i] = { fill: n(a.fill, s.fill), color: n(a.color, s.color) };
|
|
1586
1586
|
}
|
|
1587
1587
|
return { ...o, ...t };
|
|
1588
|
-
},
|
|
1588
|
+
}, yo = (e, t = {}) => {
|
|
1589
1589
|
const n = getComputedStyle(e), o = e.ownerDocument.createElement("span");
|
|
1590
1590
|
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
1591
|
try {
|
|
@@ -1593,30 +1593,30 @@ const ja = {
|
|
|
1593
1593
|
if (n.getPropertyValue(s).trim())
|
|
1594
1594
|
return o.style.color = "", o.style.color = `var(${s})`, getComputedStyle(o).color || void 0;
|
|
1595
1595
|
}, a = e.closest('[data-ui-color-scheme="dark"]') != null;
|
|
1596
|
-
return
|
|
1596
|
+
return es(i, { themeKey: a ? "dark" : "light", ...t });
|
|
1597
1597
|
} finally {
|
|
1598
1598
|
o.remove();
|
|
1599
1599
|
}
|
|
1600
|
-
},
|
|
1600
|
+
}, Wn = (e, t = 13, n = 12) => ({
|
|
1601
1601
|
rowHeight: e,
|
|
1602
1602
|
padding: 8,
|
|
1603
1603
|
chip: Math.max(14, Math.min(20, e - 8)),
|
|
1604
1604
|
icon: Math.max(12, Math.min(16, e - 8)),
|
|
1605
1605
|
fontSize: t,
|
|
1606
1606
|
chipFontSize: Math.min(n, Math.max(10, e - 12))
|
|
1607
|
-
}),
|
|
1608
|
-
const { x: i, y: a } = e, { containerWidth: s, containerHeight: r, freezeRegionWidth:
|
|
1607
|
+
}), ts = 30, ns = 2, os = 1200, is = (e, t, n, o = ts) => {
|
|
1608
|
+
const { x: i, y: a } = e, { containerWidth: s, containerHeight: r, freezeRegionWidth: l, columnInitSize: c, rowInitSize: u } = t;
|
|
1609
1609
|
let h = 0, m = 0;
|
|
1610
1610
|
if (!n || n === O.None || n === O.Columns) {
|
|
1611
|
-
const g = i >=
|
|
1612
|
-
s - i < o ? h = 1 : i <
|
|
1611
|
+
const g = i >= c && i < l;
|
|
1612
|
+
s - i < o ? h = 1 : i < l + o && !g && (h = -1);
|
|
1613
1613
|
}
|
|
1614
1614
|
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 /
|
|
1615
|
+
}, as = (e, t, n) => {
|
|
1616
|
+
const o = Math.min(1, e + t / os), i = o * t * ns + (n ?? 0), a = Math.floor(i);
|
|
1617
1617
|
return { speed: o, motion: a, carry: n == null ? 0 : i - a };
|
|
1618
1618
|
};
|
|
1619
|
-
class
|
|
1619
|
+
class ss {
|
|
1620
1620
|
direction = [0, 0];
|
|
1621
1621
|
speed = 0;
|
|
1622
1622
|
carry = 0;
|
|
@@ -1630,7 +1630,7 @@ class is {
|
|
|
1630
1630
|
return this.frameId != null;
|
|
1631
1631
|
}
|
|
1632
1632
|
update(t, n) {
|
|
1633
|
-
const [o, i] =
|
|
1633
|
+
const [o, i] = is(t, this.options.getBounds(), n);
|
|
1634
1634
|
if (!(o === this.direction[0] && i === this.direction[1])) {
|
|
1635
1635
|
if (this.direction = [o, i], this.cancel(), o === 0 && i === 0) {
|
|
1636
1636
|
this.speed = 0, this.carry = 0;
|
|
@@ -1644,7 +1644,7 @@ class is {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
processFrame = (t) => {
|
|
1646
1646
|
if (this.lastTime !== 0) {
|
|
1647
|
-
const n =
|
|
1647
|
+
const n = as(this.speed, t - this.lastTime, this.options.carryFraction === !1 ? void 0 : this.carry);
|
|
1648
1648
|
this.speed = n.speed, this.carry = n.carry;
|
|
1649
1649
|
const [o, i] = this.direction, a = o * n.motion, s = i * n.motion;
|
|
1650
1650
|
(a !== 0 || s !== 0) && this.options.scrollBy(a, s), this.options.onTick?.(a, s);
|
|
@@ -1658,12 +1658,12 @@ class is {
|
|
|
1658
1658
|
this.frameId != null && ((this.options.cancelFrame ?? cancelAnimationFrame)(this.frameId), this.frameId = null);
|
|
1659
1659
|
}
|
|
1660
1660
|
}
|
|
1661
|
-
const
|
|
1661
|
+
const Bn = (e, t, n, o) => {
|
|
1662
1662
|
const i = e.getColumnRelativeOffset(o, t);
|
|
1663
1663
|
return V(n, i, i + B.columnResizeHandlerWidth / 2) ? o - 1 : o;
|
|
1664
1664
|
};
|
|
1665
|
-
class
|
|
1666
|
-
state =
|
|
1665
|
+
class rs {
|
|
1666
|
+
state = kt;
|
|
1667
1667
|
hoveredIndex = -1;
|
|
1668
1668
|
pressed = null;
|
|
1669
1669
|
options;
|
|
@@ -1683,8 +1683,8 @@ class as {
|
|
|
1683
1683
|
/** On pointerdown; returns false unless the pointer is on a resize zone. */
|
|
1684
1684
|
start(t) {
|
|
1685
1685
|
const { type: n, columnIndex: o, x: i } = t;
|
|
1686
|
-
if (n !==
|
|
1687
|
-
const a = this.options.coordInstance(), s =
|
|
1686
|
+
if (n !== b.ColumnResizeHandler) return !1;
|
|
1687
|
+
const a = this.options.coordInstance(), s = Bn(a, this.options.scrollState().scrollLeft, i, o);
|
|
1688
1688
|
if (s < 0) return !1;
|
|
1689
1689
|
const r = a.getColumnWidth(s);
|
|
1690
1690
|
return this.pressed = { x: i, width: r }, this.state = { x: i, columnIndex: s, width: r }, this.emit(), !0;
|
|
@@ -1698,23 +1698,23 @@ class as {
|
|
|
1698
1698
|
this.state = { x: o, columnIndex: a, width: r }, this.emit(), this.options.onResize?.(r, a);
|
|
1699
1699
|
return;
|
|
1700
1700
|
}
|
|
1701
|
-
const s = n ===
|
|
1701
|
+
const s = n === b.ColumnResizeHandler ? Bn(this.options.coordInstance(), this.options.scrollState().scrollLeft, o, i) : -1;
|
|
1702
1702
|
s !== this.hoveredIndex && (this.hoveredIndex = s, this.emit());
|
|
1703
1703
|
}
|
|
1704
1704
|
/** On pointerup; returns the final width and column, or null when not resizing. */
|
|
1705
1705
|
end() {
|
|
1706
1706
|
if (!this.isResizing) return null;
|
|
1707
1707
|
const t = { width: this.state.width, columnIndex: this.state.columnIndex };
|
|
1708
|
-
return this.pressed = null, this.state =
|
|
1708
|
+
return this.pressed = null, this.state = kt, this.emit(), t;
|
|
1709
1709
|
}
|
|
1710
1710
|
/** Esc while resizing: puts the width back. */
|
|
1711
1711
|
cancel() {
|
|
1712
1712
|
if (!this.isResizing || !this.pressed) return;
|
|
1713
1713
|
const { columnIndex: t } = this.state, { width: n } = this.pressed;
|
|
1714
|
-
this.pressed = null, this.state =
|
|
1714
|
+
this.pressed = null, this.state = kt, this.emit(), this.options.onResize?.(n, t);
|
|
1715
1715
|
}
|
|
1716
1716
|
}
|
|
1717
|
-
class
|
|
1717
|
+
class ls {
|
|
1718
1718
|
defaultRowHeight;
|
|
1719
1719
|
defaultColumnWidth;
|
|
1720
1720
|
pureRowCount;
|
|
@@ -1739,13 +1739,13 @@ class ss {
|
|
|
1739
1739
|
columnCount: a,
|
|
1740
1740
|
containerWidth: s,
|
|
1741
1741
|
containerHeight: r,
|
|
1742
|
-
rowInitSize:
|
|
1743
|
-
columnInitSize:
|
|
1742
|
+
rowInitSize: l = 0,
|
|
1743
|
+
columnInitSize: c = 0,
|
|
1744
1744
|
rowHeightMap: u = {},
|
|
1745
1745
|
columnWidthMap: h = {},
|
|
1746
1746
|
freezeColumnCount: m = 1
|
|
1747
1747
|
}) {
|
|
1748
|
-
this.defaultRowHeight = t, this.defaultColumnWidth = n, this.rowCount = o, this.pureRowCount = i, this.columnCount = a, this.rowInitSize =
|
|
1748
|
+
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
1749
|
}
|
|
1750
1750
|
/** Width of the row header plus the frozen columns. */
|
|
1751
1751
|
get freezeRegionWidth() {
|
|
@@ -1782,11 +1782,11 @@ class ss {
|
|
|
1782
1782
|
this.defaultRowHeight = t;
|
|
1783
1783
|
}
|
|
1784
1784
|
get totalWidth() {
|
|
1785
|
-
const { offset: t, size: n } = this.getCellMetaData(this.columnCount - 1,
|
|
1785
|
+
const { offset: t, size: n } = this.getCellMetaData(this.columnCount - 1, Z.Column);
|
|
1786
1786
|
return t + n;
|
|
1787
1787
|
}
|
|
1788
1788
|
get totalHeight() {
|
|
1789
|
-
const { offset: t, size: n } = this.getCellMetaData(this.rowCount - 1,
|
|
1789
|
+
const { offset: t, size: n } = this.getCellMetaData(this.rowCount - 1, Z.Row);
|
|
1790
1790
|
return t + n;
|
|
1791
1791
|
}
|
|
1792
1792
|
getRowHeight(t) {
|
|
@@ -1797,22 +1797,22 @@ class ss {
|
|
|
1797
1797
|
}
|
|
1798
1798
|
/** Offset and size of one row or column, extending the prefix-sum cache up to `index` when needed. */
|
|
1799
1799
|
getCellMetaData(t, n) {
|
|
1800
|
-
const o = n ===
|
|
1800
|
+
const o = n === Z.Column, i = o ? this.columnWidth : this.rowHeight;
|
|
1801
1801
|
let a = o ? this.columnInitSize : this.rowInitSize;
|
|
1802
1802
|
const s = o ? this.lastColumnIndex : this.lastRowIndex, r = o ? this.columnMetaDataMap : this.rowMetaDataMap;
|
|
1803
1803
|
if (t > s) {
|
|
1804
|
-
const
|
|
1805
|
-
s >= 0 &&
|
|
1806
|
-
for (let
|
|
1807
|
-
const u = (o ? this.columnWidthMap[
|
|
1808
|
-
r[
|
|
1804
|
+
const l = r[s];
|
|
1805
|
+
s >= 0 && l && (a = l.offset + l.size);
|
|
1806
|
+
for (let c = s + 1; c <= t; c++) {
|
|
1807
|
+
const u = (o ? this.columnWidthMap[c] : this.rowHeightMap[c]) ?? i;
|
|
1808
|
+
r[c] = { offset: a, size: u }, a += u;
|
|
1809
1809
|
}
|
|
1810
1810
|
o ? this.lastColumnIndex = t : this.lastRowIndex = t;
|
|
1811
1811
|
}
|
|
1812
1812
|
return r[t] ?? { size: 0, offset: 0 };
|
|
1813
1813
|
}
|
|
1814
1814
|
findNearestCellIndexLinear(t, n, o) {
|
|
1815
|
-
const i = o ===
|
|
1815
|
+
const i = o === Z.Column ? this.columnCount : this.rowCount;
|
|
1816
1816
|
let a = 1;
|
|
1817
1817
|
for (; t < i && this.getCellMetaData(t, o).offset < n; )
|
|
1818
1818
|
t += a, a *= 2;
|
|
@@ -1828,34 +1828,34 @@ class ss {
|
|
|
1828
1828
|
}
|
|
1829
1829
|
/** Index of the row or column that contains `offset` (in content coordinates, headers included). */
|
|
1830
1830
|
findNearestCellIndex(t, n) {
|
|
1831
|
-
const o = n ===
|
|
1831
|
+
const o = n === Z.Column, i = o ? this.columnMetaDataMap : this.rowMetaDataMap, a = o ? this.lastColumnIndex : this.lastRowIndex;
|
|
1832
1832
|
return (a > 0 ? i[a]?.offset ?? 0 : 0) >= t ? this.findNearestCellIndexBinary(t, 0, a, n) : this.findNearestCellIndexLinear(Math.max(0, a), t, n);
|
|
1833
1833
|
}
|
|
1834
1834
|
getRowStartIndex(t) {
|
|
1835
|
-
return this.findNearestCellIndex(t,
|
|
1835
|
+
return this.findNearestCellIndex(t, Z.Row);
|
|
1836
1836
|
}
|
|
1837
1837
|
getRowStopIndex(t, n) {
|
|
1838
|
-
const o = this.getCellMetaData(t,
|
|
1838
|
+
const o = this.getCellMetaData(t, Z.Row), i = n + this._containerHeight;
|
|
1839
1839
|
let a = o.offset + o.size, s = t;
|
|
1840
1840
|
for (; s < this.rowCount - 1 && a < i; )
|
|
1841
|
-
s++, a += this.getCellMetaData(s,
|
|
1841
|
+
s++, a += this.getCellMetaData(s, Z.Row).size;
|
|
1842
1842
|
return s;
|
|
1843
1843
|
}
|
|
1844
1844
|
getColumnStartIndex(t) {
|
|
1845
|
-
return this.findNearestCellIndex(t,
|
|
1845
|
+
return this.findNearestCellIndex(t, Z.Column);
|
|
1846
1846
|
}
|
|
1847
1847
|
getColumnStopIndex(t, n) {
|
|
1848
|
-
const o = this.getCellMetaData(t,
|
|
1848
|
+
const o = this.getCellMetaData(t, Z.Column), i = n + this._containerWidth;
|
|
1849
1849
|
let a = o.offset + o.size, s = t;
|
|
1850
1850
|
for (; s < this.columnCount - 1 && a < i; )
|
|
1851
|
-
s++, a += this.getCellMetaData(s,
|
|
1851
|
+
s++, a += this.getCellMetaData(s, Z.Column).size;
|
|
1852
1852
|
return s;
|
|
1853
1853
|
}
|
|
1854
1854
|
getRowOffset(t) {
|
|
1855
|
-
return this.getCellMetaData(t,
|
|
1855
|
+
return this.getCellMetaData(t, Z.Row).offset;
|
|
1856
1856
|
}
|
|
1857
1857
|
getColumnOffset(t) {
|
|
1858
|
-
return this.getCellMetaData(t,
|
|
1858
|
+
return this.getCellMetaData(t, Z.Column).offset;
|
|
1859
1859
|
}
|
|
1860
1860
|
/** Column x on screen: frozen columns ignore horizontal scroll. */
|
|
1861
1861
|
getColumnRelativeOffset(t, n) {
|
|
@@ -1869,12 +1869,12 @@ class ss {
|
|
|
1869
1869
|
this.rowCount = t, this.pureRowCount = n, this.rowInitSize = o, this.rowHeightMap = i, a != null && (this.defaultRowHeight = a), this.lastRowIndex = -1, this.rowMetaDataMap = {};
|
|
1870
1870
|
}
|
|
1871
1871
|
}
|
|
1872
|
-
const
|
|
1872
|
+
const cs = 240, us = ({
|
|
1873
1873
|
containerWidth: e,
|
|
1874
1874
|
columnInitSize: t,
|
|
1875
1875
|
columnCount: n,
|
|
1876
1876
|
getColumnWidth: o,
|
|
1877
|
-
minScrollableWidth: i =
|
|
1877
|
+
minScrollableWidth: i = cs
|
|
1878
1878
|
}) => {
|
|
1879
1879
|
const a = e - i;
|
|
1880
1880
|
if (a <= t) return 0;
|
|
@@ -1882,26 +1882,26 @@ const rs = 240, ls = ({
|
|
|
1882
1882
|
for (let r = 0; r < n; r++)
|
|
1883
1883
|
if (s += o(r) ?? 0, s > a) return r;
|
|
1884
1884
|
return n;
|
|
1885
|
-
},
|
|
1885
|
+
}, ds = (e, t, n, o) => {
|
|
1886
1886
|
const { pureRowCount: i, columnCount: a } = o, s = !!n.expand;
|
|
1887
|
-
let [r,
|
|
1888
|
-
n.jump ? t === "up" ?
|
|
1889
|
-
const
|
|
1887
|
+
let [r, l] = e.ranges[s ? 1 : 0];
|
|
1888
|
+
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);
|
|
1889
|
+
const c = [r, l], u = s ? [e.ranges[0], c] : [c, c];
|
|
1890
1890
|
return {
|
|
1891
1891
|
selection: e.setRanges(u),
|
|
1892
|
-
...s ? {} : { activeCell:
|
|
1893
|
-
scrollTo:
|
|
1892
|
+
...s ? {} : { activeCell: c },
|
|
1893
|
+
scrollTo: c
|
|
1894
1894
|
};
|
|
1895
|
-
},
|
|
1895
|
+
}, On = (e, t, n) => {
|
|
1896
1896
|
const [o, i] = e.ranges[0], s = [t ? Math.max(o - 1, 0) : Math.min(o + 1, n.columnCount - 1), i];
|
|
1897
1897
|
return { selection: e.setRanges([s, s]), activeCell: s, scrollTo: s };
|
|
1898
|
-
},
|
|
1898
|
+
}, hs = (e, t) => e.setRanges([[0, 0], [t.columnCount - 1, t.pureRowCount - 1]]), ms = (e, t, n = !1) => {
|
|
1899
1899
|
let o = e.ranges[0];
|
|
1900
1900
|
e.isColumnSelection && (o = [o[0], 0]);
|
|
1901
1901
|
const [i, a] = o, s = n ? a : Math.min(a + 1, t.pureRowCount - 1), r = [i, s];
|
|
1902
1902
|
return { selection: e.set(H.Cells, [r, r]), activeCell: r, scrollTo: r };
|
|
1903
1903
|
};
|
|
1904
|
-
class
|
|
1904
|
+
class se {
|
|
1905
1905
|
type;
|
|
1906
1906
|
ranges;
|
|
1907
1907
|
constructor(t = H.None, n = []) {
|
|
@@ -1926,10 +1926,10 @@ class oe {
|
|
|
1926
1926
|
if (!Array.isArray(n)) throw new Error("Ranges of the selection should be an array type!");
|
|
1927
1927
|
if (t === H.Cells && n.length < 2) throw new Error("Ranges of type cells should have a length greater than 2!");
|
|
1928
1928
|
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
|
|
1929
|
+
return new se(t, n);
|
|
1930
1930
|
}
|
|
1931
1931
|
setRanges(t) {
|
|
1932
|
-
return new
|
|
1932
|
+
return new se(this.type, t);
|
|
1933
1933
|
}
|
|
1934
1934
|
isOverlap(t, n) {
|
|
1935
1935
|
return !(t[1] < n[0] || t[0] > n[1]);
|
|
@@ -1941,10 +1941,10 @@ class oe {
|
|
|
1941
1941
|
case H.Columns: {
|
|
1942
1942
|
let n = !1;
|
|
1943
1943
|
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
|
|
1944
|
+
return n || o.push(t), new se(this.type, Nt(o));
|
|
1945
1945
|
}
|
|
1946
1946
|
case H.Cells:
|
|
1947
|
-
return new
|
|
1947
|
+
return new se(this.type, [this.ranges[0], t]);
|
|
1948
1948
|
default:
|
|
1949
1949
|
return Ge;
|
|
1950
1950
|
}
|
|
@@ -1954,25 +1954,25 @@ class oe {
|
|
|
1954
1954
|
switch (this.type) {
|
|
1955
1955
|
case H.Rows:
|
|
1956
1956
|
case H.Columns: {
|
|
1957
|
-
const n =
|
|
1958
|
-
return n.length ? new
|
|
1957
|
+
const n = hi(this.ranges, t);
|
|
1958
|
+
return n.length ? new se(this.type, n) : Ge;
|
|
1959
1959
|
}
|
|
1960
1960
|
case H.Cells:
|
|
1961
|
-
return new
|
|
1961
|
+
return new se(this.type, [this.ranges[0], t]);
|
|
1962
1962
|
default:
|
|
1963
1963
|
return Ge;
|
|
1964
1964
|
}
|
|
1965
1965
|
}
|
|
1966
1966
|
flatten() {
|
|
1967
1967
|
const [t, n] = this.ranges;
|
|
1968
|
-
return this.isCellSelection ? [...t, ...n] :
|
|
1968
|
+
return this.isCellSelection ? [...t, ...n] : ui(this.ranges);
|
|
1969
1969
|
}
|
|
1970
1970
|
/** Runs merged and sorted, or the cell rectangle as `[topLeft, bottomRight]`. */
|
|
1971
1971
|
serialize() {
|
|
1972
1972
|
switch (this.type) {
|
|
1973
1973
|
case H.Rows:
|
|
1974
1974
|
case H.Columns:
|
|
1975
|
-
return
|
|
1975
|
+
return Nt(this.ranges);
|
|
1976
1976
|
case H.Cells: {
|
|
1977
1977
|
const [t, n] = this.ranges;
|
|
1978
1978
|
return [
|
|
@@ -1990,20 +1990,20 @@ class oe {
|
|
|
1990
1990
|
switch (this.type) {
|
|
1991
1991
|
case H.Rows:
|
|
1992
1992
|
case H.Columns:
|
|
1993
|
-
return
|
|
1993
|
+
return ci(t, this.ranges);
|
|
1994
1994
|
case H.Cells:
|
|
1995
|
-
return
|
|
1995
|
+
return di(t, this.ranges[0], this.ranges[1]);
|
|
1996
1996
|
default:
|
|
1997
1997
|
return !1;
|
|
1998
1998
|
}
|
|
1999
1999
|
}
|
|
2000
2000
|
equals(t) {
|
|
2001
|
-
return
|
|
2001
|
+
return Vt(this.ranges, t);
|
|
2002
2002
|
}
|
|
2003
2003
|
}
|
|
2004
|
-
const Ge = new
|
|
2005
|
-
class
|
|
2006
|
-
selection = new
|
|
2004
|
+
const Ge = new se(H.None, []);
|
|
2005
|
+
class gs {
|
|
2006
|
+
selection = new se();
|
|
2007
2007
|
activeCell = null;
|
|
2008
2008
|
isSelecting = !1;
|
|
2009
2009
|
prevSelectedRowIndex = null;
|
|
@@ -2012,13 +2012,13 @@ class hs {
|
|
|
2012
2012
|
this.options = t;
|
|
2013
2013
|
}
|
|
2014
2014
|
get selectable() {
|
|
2015
|
-
return this.options.selectable ??
|
|
2015
|
+
return this.options.selectable ?? K.All;
|
|
2016
2016
|
}
|
|
2017
2017
|
get isMultiSelectionEnable() {
|
|
2018
2018
|
return this.options.isMultiSelectionEnable ?? !0;
|
|
2019
2019
|
}
|
|
2020
2020
|
getLinearRow(t) {
|
|
2021
|
-
return (this.options.getLinearRow ??
|
|
2021
|
+
return (this.options.getLinearRow ?? Bt)(t);
|
|
2022
2022
|
}
|
|
2023
2023
|
/** Replaces the selection and/or the active cell; notifies once if either changed. */
|
|
2024
2024
|
update(t) {
|
|
@@ -2031,24 +2031,24 @@ class hs {
|
|
|
2031
2031
|
}
|
|
2032
2032
|
onSelectionStart(t, n) {
|
|
2033
2033
|
const o = this.selectable;
|
|
2034
|
-
if (o !==
|
|
2035
|
-
const { type: i, rowIndex: a, columnIndex: s } = n, { isRowSelection: r, ranges:
|
|
2034
|
+
if (o !== K.All && o !== K.Cell) return;
|
|
2035
|
+
const { type: i, rowIndex: a, columnIndex: s } = n, { isRowSelection: r, ranges: l } = this.selection, c = t.shiftKey && !t.metaKey;
|
|
2036
2036
|
switch (i) {
|
|
2037
|
-
case
|
|
2038
|
-
case
|
|
2039
|
-
const { realIndex: u } = this.getLinearRow(a), h = [s, u], m =
|
|
2037
|
+
case b.Cell:
|
|
2038
|
+
case b.ActiveCell: {
|
|
2039
|
+
const { realIndex: u } = this.getLinearRow(a), h = [s, u], m = c && !r && l[0] != null, g = [m ? l[0] : h, h];
|
|
2040
2040
|
this.isMultiSelectionEnable && (this.isSelecting = !0), this.update({
|
|
2041
2041
|
selection: this.selection.set(H.Cells, g),
|
|
2042
2042
|
...m ? {} : { activeCell: h }
|
|
2043
2043
|
});
|
|
2044
2044
|
return;
|
|
2045
2045
|
}
|
|
2046
|
-
case
|
|
2047
|
-
case
|
|
2048
|
-
case
|
|
2049
|
-
case
|
|
2050
|
-
case
|
|
2051
|
-
case
|
|
2046
|
+
case b.RowHeaderDragHandler:
|
|
2047
|
+
case b.RowHeaderCheckbox:
|
|
2048
|
+
case b.ColumnHeader:
|
|
2049
|
+
case b.AllCheckbox:
|
|
2050
|
+
case b.RowHeader:
|
|
2051
|
+
case b.AppendRow:
|
|
2052
2052
|
return;
|
|
2053
2053
|
default:
|
|
2054
2054
|
this.update({ selection: this.selection.reset(), activeCell: null });
|
|
@@ -2057,14 +2057,14 @@ class hs {
|
|
|
2057
2057
|
/** Moves the head to the cell under the pointer while drag-selecting. Positions above or left of the grid clamp to 0. */
|
|
2058
2058
|
onSelectionChange(t) {
|
|
2059
2059
|
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],
|
|
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: l } = this.getLinearRow(s), c = [r, l];
|
|
2061
|
+
n && !this.selection.equals([o[0], c]) && this.update({ selection: this.selection.merge(c) });
|
|
2062
2062
|
}
|
|
2063
2063
|
onSelectionEnd() {
|
|
2064
2064
|
this.isSelecting = !1;
|
|
2065
2065
|
}
|
|
2066
2066
|
onSelectionClick(t, n) {
|
|
2067
|
-
const { shiftKey: o, metaKey: i } = t, a = o && !i, s = i && !o, { type: r, rowIndex:
|
|
2067
|
+
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
2068
|
const R = [v, v], I = g && (S || h[0][0] === v) ? u.merge(R) : u.set(y, [R]);
|
|
2069
2069
|
I.includes(R) && (this.prevSelectedRowIndex = v), this.update({ selection: I, activeCell: null });
|
|
2070
2070
|
}, w = (v) => {
|
|
@@ -2076,37 +2076,37 @@ class hs {
|
|
|
2076
2076
|
return;
|
|
2077
2077
|
}
|
|
2078
2078
|
const R = u.includes(y);
|
|
2079
|
-
p(v, H.Rows), this.options.onRowControlClick?.(v,
|
|
2079
|
+
p(v, H.Rows), this.options.onRowControlClick?.(v, $.Checkbox, !R);
|
|
2080
2080
|
};
|
|
2081
2081
|
switch (r) {
|
|
2082
|
-
case
|
|
2083
|
-
if (C !==
|
|
2084
|
-
const v = S && a && m ? h[0][0] :
|
|
2082
|
+
case b.ColumnHeader: {
|
|
2083
|
+
if (C !== K.All && C !== K.Column) return;
|
|
2084
|
+
const v = S && a && m ? h[0][0] : c, y = [[Math.min(v, c), Math.max(v, c)]];
|
|
2085
2085
|
let R = u.set(H.Columns, y);
|
|
2086
|
-
if (S && s && m && (R = u.merge([
|
|
2086
|
+
if (S && s && m && (R = u.merge([c, c])), !a || !m) {
|
|
2087
2087
|
this.update({ selection: R, activeCell: R.isNoneSelection ? null : [R.ranges[0][0], 0] });
|
|
2088
2088
|
return;
|
|
2089
2089
|
}
|
|
2090
2090
|
this.update({ selection: R });
|
|
2091
2091
|
return;
|
|
2092
2092
|
}
|
|
2093
|
-
case
|
|
2094
|
-
if (C !==
|
|
2095
|
-
w(this.getLinearRow(
|
|
2093
|
+
case b.RowHeaderCheckbox: {
|
|
2094
|
+
if (C !== K.All && C !== K.Row) return;
|
|
2095
|
+
w(this.getLinearRow(l).realIndex);
|
|
2096
2096
|
return;
|
|
2097
2097
|
}
|
|
2098
|
-
case
|
|
2099
|
-
const { realIndex: v } = this.getLinearRow(
|
|
2100
|
-
if (C ===
|
|
2098
|
+
case b.Cell: {
|
|
2099
|
+
const { realIndex: v } = this.getLinearRow(l);
|
|
2100
|
+
if (C === K.Row) {
|
|
2101
2101
|
if (this.options.isRowClickSelectionEnabled === !1) return;
|
|
2102
2102
|
w(v);
|
|
2103
2103
|
return;
|
|
2104
2104
|
}
|
|
2105
|
-
C ===
|
|
2105
|
+
C === K.Column && p(c, H.Columns);
|
|
2106
2106
|
return;
|
|
2107
2107
|
}
|
|
2108
|
-
case
|
|
2109
|
-
if (C !==
|
|
2108
|
+
case b.AllCheckbox: {
|
|
2109
|
+
if (C !== K.All && C !== K.Row) return;
|
|
2110
2110
|
const v = [[0, this.options.getPureRowCount() - 1]];
|
|
2111
2111
|
if (g && u.equals(v)) {
|
|
2112
2112
|
this.update({ selection: u.reset() });
|
|
@@ -2123,74 +2123,74 @@ class hs {
|
|
|
2123
2123
|
*/
|
|
2124
2124
|
onSelectionContextMenu(t, n) {
|
|
2125
2125
|
const { x: o, y: i, columnIndex: a, rowIndex: s, type: r } = t;
|
|
2126
|
-
if (r ===
|
|
2127
|
-
const
|
|
2126
|
+
if (r === b.Blank) return;
|
|
2127
|
+
const l = this.selection, { isCellSelection: c, isRowSelection: u, isColumnSelection: h } = l, m = a >= -1 && s > -1, g = a > -1 && s === -1;
|
|
2128
2128
|
if (m) {
|
|
2129
|
-
const { realIndex: C } = this.getLinearRow(s), S =
|
|
2130
|
-
if (
|
|
2129
|
+
const { realIndex: C } = this.getLinearRow(s), S = c ? [a, C] : u ? [C, C] : h ? [a, a] : void 0;
|
|
2130
|
+
if (l.includes(S)) return n(l, { x: o, y: i });
|
|
2131
2131
|
if (a > -1) {
|
|
2132
|
-
const p = [a, C], w =
|
|
2132
|
+
const p = [a, C], w = l.set(H.Cells, [p, p]);
|
|
2133
2133
|
return this.update({ selection: w, activeCell: p }), n(w, { x: o, y: i });
|
|
2134
2134
|
}
|
|
2135
2135
|
}
|
|
2136
2136
|
if (g) {
|
|
2137
|
-
if (h &&
|
|
2138
|
-
const C =
|
|
2137
|
+
if (h && l.includes([a, a])) return n(l, { x: o, y: i });
|
|
2138
|
+
const C = l.set(H.Columns, [[a, a]]);
|
|
2139
2139
|
this.update({ selection: C, activeCell: [a, 0] }), n(C, { x: o, y: i });
|
|
2140
2140
|
}
|
|
2141
2141
|
}
|
|
2142
2142
|
}
|
|
2143
|
-
const
|
|
2143
|
+
const fs = (e, t, n) => {
|
|
2144
2144
|
if (!Number.isFinite(t) || n <= 0) return null;
|
|
2145
2145
|
const o = Math.min(n - 1, Math.max(0, Math.trunc(t))), i = { startColumn: e.startColumn, endColumn: e.endColumn };
|
|
2146
2146
|
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
|
-
},
|
|
2147
|
+
}, ps = (e) => ({
|
|
2148
2148
|
startColumn: e.source.startColumn,
|
|
2149
2149
|
endColumn: e.source.endColumn,
|
|
2150
2150
|
startRow: Math.min(e.source.startRow, e.target.startRow),
|
|
2151
2151
|
endRow: Math.max(e.source.endRow, e.target.endRow)
|
|
2152
|
-
}),
|
|
2152
|
+
}), Cs = (e) => typeof e == "number" && Number.isFinite(e), Lr = (e, t, n = "down") => {
|
|
2153
2153
|
if (t <= 0 || e.length === 0) return [];
|
|
2154
|
-
const o = n === "down" ? e : [...e].reverse(), i = o.length >= 2 && o.every(
|
|
2154
|
+
const o = n === "down" ? e : [...e].reverse(), i = o.length >= 2 && o.every(Cs) && o.some((s) => s !== o[0]), a = [];
|
|
2155
2155
|
if (i) {
|
|
2156
|
-
const s = o.slice(1).map((
|
|
2156
|
+
const s = o.slice(1).map((l, c) => l - o[c]);
|
|
2157
2157
|
let r = o[o.length - 1];
|
|
2158
|
-
for (let
|
|
2159
|
-
r += s[
|
|
2158
|
+
for (let l = 0; l < t; l++)
|
|
2159
|
+
r += s[l % s.length], a.push(ws(r, o));
|
|
2160
2160
|
} else
|
|
2161
2161
|
for (let s = 0; s < t; s++) a.push(o[s % o.length]);
|
|
2162
2162
|
return n === "down" ? a : a.reverse();
|
|
2163
|
-
},
|
|
2163
|
+
}, ws = (e, t) => {
|
|
2164
2164
|
const n = Math.max(...t.map((i) => (String(i).split(".")[1] ?? "").length));
|
|
2165
2165
|
if (n > 12) return e;
|
|
2166
2166
|
const o = 10 ** n;
|
|
2167
2167
|
return Math.round(e * o) / o;
|
|
2168
|
-
},
|
|
2169
|
-
drag:
|
|
2170
|
-
expand:
|
|
2171
|
-
checkbox:
|
|
2172
|
-
}, Cs = {
|
|
2173
|
-
none: $.None,
|
|
2174
|
-
cell: $.Cell,
|
|
2175
|
-
row: $.Row,
|
|
2176
|
-
column: $.Column,
|
|
2177
|
-
all: $.All
|
|
2178
|
-
}, ws = {
|
|
2179
|
-
none: de.None,
|
|
2180
|
-
column: de.Column,
|
|
2181
|
-
row: de.Row,
|
|
2182
|
-
all: de.All
|
|
2168
|
+
}, Vn = 20, At = {
|
|
2169
|
+
drag: $.Drag,
|
|
2170
|
+
expand: $.Expand,
|
|
2171
|
+
checkbox: $.Checkbox
|
|
2183
2172
|
}, vs = {
|
|
2173
|
+
none: K.None,
|
|
2174
|
+
cell: K.Cell,
|
|
2175
|
+
row: K.Row,
|
|
2176
|
+
column: K.Column,
|
|
2177
|
+
all: K.All
|
|
2178
|
+
}, Ss = {
|
|
2179
|
+
none: he.None,
|
|
2180
|
+
column: he.Column,
|
|
2181
|
+
row: he.Row,
|
|
2182
|
+
all: he.All
|
|
2183
|
+
}, ys = {
|
|
2184
2184
|
[H.None]: "none",
|
|
2185
2185
|
[H.Cells]: "cells",
|
|
2186
2186
|
[H.Rows]: "rows",
|
|
2187
2187
|
[H.Columns]: "columns"
|
|
2188
|
-
},
|
|
2188
|
+
}, bs = {
|
|
2189
2189
|
none: H.None,
|
|
2190
2190
|
cells: H.Cells,
|
|
2191
2191
|
rows: H.Rows,
|
|
2192
2192
|
columns: H.Columns
|
|
2193
|
-
},
|
|
2193
|
+
}, Gn = { ArrowUp: "up", ArrowDown: "down", ArrowLeft: "left", ArrowRight: "right" }, xs = (e) => Math.max(B.rowHeadWidth, 46 + e.length * 24), Rs = 640, ks = 50, Is = (e, t) => ({
|
|
2194
2194
|
id: e.id,
|
|
2195
2195
|
name: e.name,
|
|
2196
2196
|
width: t,
|
|
@@ -2199,8 +2199,8 @@ const ms = (e, t, n) => {
|
|
|
2199
2199
|
isPrimary: e.isPrimary,
|
|
2200
2200
|
description: e.description,
|
|
2201
2201
|
hasIcon: e.hasIcon
|
|
2202
|
-
}),
|
|
2203
|
-
class
|
|
2202
|
+
}), bo = (e, t) => e === t || !!e && !!t && e[0] === t[0] && e[1] === t[1], Ps = (e, t) => e.kind === t.kind && bo(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]);
|
|
2203
|
+
class zs {
|
|
2204
2204
|
coord;
|
|
2205
2205
|
scroll = { scrollTop: 0, scrollLeft: 0, isScrolling: !1 };
|
|
2206
2206
|
mouseState = Ve;
|
|
@@ -2232,19 +2232,19 @@ class Is {
|
|
|
2232
2232
|
constructor(t, n) {
|
|
2233
2233
|
this.config = t, this.hooks = n, this.coord = this.createCoordinate();
|
|
2234
2234
|
const o = () => this.config;
|
|
2235
|
-
this.selection = new
|
|
2235
|
+
this.selection = new gs({
|
|
2236
2236
|
getPureRowCount: () => this.config.rowCount,
|
|
2237
2237
|
get selectable() {
|
|
2238
|
-
return
|
|
2238
|
+
return vs[o().selectable];
|
|
2239
2239
|
},
|
|
2240
2240
|
onChange: () => {
|
|
2241
2241
|
const i = this.getSelection();
|
|
2242
|
-
|
|
2242
|
+
Ps(i, this.lastSelection) || (this.lastSelection = i, this.hooks.selectionChange(i), this.hooks.render());
|
|
2243
2243
|
},
|
|
2244
2244
|
onRowControlClick: (i, a) => {
|
|
2245
|
-
a ===
|
|
2245
|
+
a === $.Expand && this.hooks.rowExpand(i);
|
|
2246
2246
|
}
|
|
2247
|
-
}), this.resize = new
|
|
2247
|
+
}), this.resize = new rs({
|
|
2248
2248
|
coordInstance: () => this.coord,
|
|
2249
2249
|
scrollState: () => this.scroll,
|
|
2250
2250
|
minWidth: (i) => this.config.columns[i]?.minWidth ?? B.columnMinWidth,
|
|
@@ -2254,17 +2254,17 @@ class Is {
|
|
|
2254
2254
|
onChange: (i) => {
|
|
2255
2255
|
this.resizeState = i, this.hooks.render();
|
|
2256
2256
|
}
|
|
2257
|
-
}), this.resizeState = this.resize.state, this.drag = new
|
|
2257
|
+
}), this.resizeState = this.resize.state, this.drag = new pi({
|
|
2258
2258
|
coordInstance: () => this.coord,
|
|
2259
2259
|
scrollState: () => this.scroll,
|
|
2260
2260
|
selection: () => this.selection.selection,
|
|
2261
2261
|
get draggable() {
|
|
2262
|
-
return
|
|
2262
|
+
return Ss[o().draggable];
|
|
2263
2263
|
},
|
|
2264
2264
|
onChange: (i) => {
|
|
2265
2265
|
this.dragState = i, this.hooks.render();
|
|
2266
2266
|
}
|
|
2267
|
-
}), this.dragState = this.drag.state, this.autoScroller = new
|
|
2267
|
+
}), this.dragState = this.drag.state, this.autoScroller = new ss({
|
|
2268
2268
|
getBounds: () => ({
|
|
2269
2269
|
containerWidth: this.coord.containerWidth,
|
|
2270
2270
|
containerHeight: this.coord.containerHeight,
|
|
@@ -2276,7 +2276,7 @@ class Is {
|
|
|
2276
2276
|
onTick: () => {
|
|
2277
2277
|
this.lastPoint && this.pointerMove({ ...this.lastPoint, ...this.lastModifiers }, !0);
|
|
2278
2278
|
}
|
|
2279
|
-
}), this.rowControls = this.visibleRowControls().map((i) => ({ type:
|
|
2279
|
+
}), this.rowControls = this.visibleRowControls().map((i) => ({ type: At[i] })), this.applyColumns();
|
|
2280
2280
|
}
|
|
2281
2281
|
/**
|
|
2282
2282
|
* Touch on a grid no wider than 640 px. There a tap opens the record (the
|
|
@@ -2284,18 +2284,18 @@ class Is {
|
|
|
2284
2284
|
* numbers only and no column is frozen.
|
|
2285
2285
|
*/
|
|
2286
2286
|
get isPhone() {
|
|
2287
|
-
return !!this.config.touch && this.width > 0 && this.width <=
|
|
2287
|
+
return !!this.config.touch && this.width > 0 && this.width <= Rs;
|
|
2288
2288
|
}
|
|
2289
2289
|
visibleRowControls() {
|
|
2290
2290
|
return this.isPhone ? [] : this.config.rowControls;
|
|
2291
2291
|
}
|
|
2292
2292
|
gutterWidth() {
|
|
2293
|
-
return this.isPhone ?
|
|
2293
|
+
return this.isPhone ? ks : xs(this.config.rowControls);
|
|
2294
2294
|
}
|
|
2295
2295
|
// ---- configuration ----------------------------------------------------
|
|
2296
2296
|
createCoordinate() {
|
|
2297
2297
|
const { rowCount: t, rowHeight: n, headerHeight: o, columns: i, freezeColumnCount: a } = this.config;
|
|
2298
|
-
return new
|
|
2298
|
+
return new ls({
|
|
2299
2299
|
rowHeight: n,
|
|
2300
2300
|
columnWidth: B.columnWidth,
|
|
2301
2301
|
rowCount: t,
|
|
@@ -2312,7 +2312,7 @@ class Is {
|
|
|
2312
2312
|
const { columns: t } = this.config, n = {};
|
|
2313
2313
|
this.gridColumns = t.map((o, i) => {
|
|
2314
2314
|
const a = this.widthOverrides.get(i) ?? o.width ?? B.columnWidth;
|
|
2315
|
-
return n[i] = a,
|
|
2315
|
+
return n[i] = a, Is(o, a);
|
|
2316
2316
|
}), this.coord.refreshColumnDimensions({ columnCount: t.length, columnInitSize: this.gutterWidth(), columnWidthMap: n }), this.coord.freezeColumnCount = this.freezeCount(this.config.freezeColumnCount), this.invalidate();
|
|
2317
2317
|
}
|
|
2318
2318
|
/**
|
|
@@ -2321,7 +2321,7 @@ class Is {
|
|
|
2321
2321
|
*/
|
|
2322
2322
|
freezeCount(t) {
|
|
2323
2323
|
const { columns: n } = this.config, o = Math.min(t, n.length);
|
|
2324
|
-
return this.width <= 0 ? o : this.isPhone ? 0 : Math.min(o,
|
|
2324
|
+
return this.width <= 0 ? o : this.isPhone ? 0 : Math.min(o, us({
|
|
2325
2325
|
containerWidth: this.width,
|
|
2326
2326
|
columnInitSize: this.gutterWidth(),
|
|
2327
2327
|
columnCount: n.length,
|
|
@@ -2330,7 +2330,7 @@ class Is {
|
|
|
2330
2330
|
}
|
|
2331
2331
|
configure(t) {
|
|
2332
2332
|
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:
|
|
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: At[o] })), this.applyColumns(), this.clampSelection(), this.setScroll(this.scroll.scrollLeft, this.scroll.scrollTop), this.updateVisible();
|
|
2334
2334
|
}
|
|
2335
2335
|
/** Drops a selection that points past the data after rows or columns went away. */
|
|
2336
2336
|
clampSelection() {
|
|
@@ -2343,7 +2343,7 @@ class Is {
|
|
|
2343
2343
|
setViewport(t, n) {
|
|
2344
2344
|
if (t === this.width && n === this.height) return;
|
|
2345
2345
|
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:
|
|
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: At[i] })), this.applyColumns()), this.coord.freezeColumnCount = this.freezeCount(this.config.freezeColumnCount), this.invalidate(), this.updateVisible();
|
|
2347
2347
|
}
|
|
2348
2348
|
get viewport() {
|
|
2349
2349
|
return { width: this.width, height: this.height };
|
|
@@ -2357,7 +2357,7 @@ class Is {
|
|
|
2357
2357
|
* keeps room for a vertical overlay bar beside them.
|
|
2358
2358
|
*/
|
|
2359
2359
|
get contentSize() {
|
|
2360
|
-
const { totalWidth: t, totalHeight: n } = this.coord, o = t > this.width ?
|
|
2360
|
+
const { totalWidth: t, totalHeight: n } = this.coord, o = t > this.width ? Vn : 0, i = n > this.height - o ? Vn : 0;
|
|
2361
2361
|
return { width: t + o, height: n + i };
|
|
2362
2362
|
}
|
|
2363
2363
|
/** The scroller moved (native scroll or our own `scrollTo`). */
|
|
@@ -2370,7 +2370,7 @@ class Is {
|
|
|
2370
2370
|
this.setScroll(t, n), this.scroll !== o && this.hooks.scrollTo(this.scroll.scrollLeft, this.scroll.scrollTop);
|
|
2371
2371
|
}
|
|
2372
2372
|
updateVisible() {
|
|
2373
|
-
const t =
|
|
2373
|
+
const t = In(this.coord, this.scroll), n = this.visible;
|
|
2374
2374
|
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
2375
|
startRow: t.startRowIndex,
|
|
2376
2376
|
stopRow: t.stopRowIndex,
|
|
@@ -2379,7 +2379,7 @@ class Is {
|
|
|
2379
2379
|
}));
|
|
2380
2380
|
}
|
|
2381
2381
|
get visibleRegion() {
|
|
2382
|
-
return this.visible ?? (this.visible =
|
|
2382
|
+
return this.visible ?? (this.visible = In(this.coord, this.scroll));
|
|
2383
2383
|
}
|
|
2384
2384
|
/** Marks cell content stale (data, columns or theme changed). */
|
|
2385
2385
|
invalidate() {
|
|
@@ -2388,10 +2388,10 @@ class Is {
|
|
|
2388
2388
|
// ---- selection --------------------------------------------------------
|
|
2389
2389
|
getSelection() {
|
|
2390
2390
|
const { selection: t, activeCell: n } = this.selection;
|
|
2391
|
-
return { kind:
|
|
2391
|
+
return { kind: ys[t.type], ranges: t.ranges.map((o) => [o[0], o[1]]), activeCell: n ? [n[0], n[1]] : null };
|
|
2392
2392
|
}
|
|
2393
2393
|
setSelection(t) {
|
|
2394
|
-
const n = t.ranges.map((a) => [a[0], a[1]]), o = t.kind === "none" ? Ge : new
|
|
2394
|
+
const n = t.ranges.map((a) => [a[0], a[1]]), o = t.kind === "none" ? Ge : new se(bs[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
2395
|
this.selection.update({ selection: o, activeCell: i });
|
|
2396
2396
|
}
|
|
2397
2397
|
selectCell(t, n) {
|
|
@@ -2413,12 +2413,12 @@ class Is {
|
|
|
2413
2413
|
const [n, o] = t, { coord: i } = this, a = B.cellScrollBuffer;
|
|
2414
2414
|
let { scrollLeft: s, scrollTop: r } = this.scroll;
|
|
2415
2415
|
if (n >= i.freezeColumnCount && n < i.columnCount) {
|
|
2416
|
-
const
|
|
2417
|
-
|
|
2416
|
+
const l = i.getColumnOffset(n), c = l + i.getColumnWidth(n), u = s + i.freezeRegionWidth, h = s + this.width;
|
|
2417
|
+
l < u ? s = l - i.freezeRegionWidth : c > h && (s = c - this.width + a);
|
|
2418
2418
|
}
|
|
2419
2419
|
if (o >= 0 && o < i.rowCount) {
|
|
2420
|
-
const
|
|
2421
|
-
|
|
2420
|
+
const l = i.getRowOffset(o), c = l + i.getRowHeight(o), u = r + i.rowInitSize, h = r + this.height;
|
|
2421
|
+
l < u ? r = l - i.rowInitSize : c > h && (r = c - this.height + a);
|
|
2422
2422
|
}
|
|
2423
2423
|
this.scrollTo(s, r);
|
|
2424
2424
|
}
|
|
@@ -2448,6 +2448,10 @@ class Is {
|
|
|
2448
2448
|
get isResizeEnabled() {
|
|
2449
2449
|
return this.config.columnResizable && !this.config.touch;
|
|
2450
2450
|
}
|
|
2451
|
+
/** A click on the row number opens the record (someone listens for `rowExpand`). */
|
|
2452
|
+
get canExpandRow() {
|
|
2453
|
+
return !!this.hooks.canExpandRow?.();
|
|
2454
|
+
}
|
|
2451
2455
|
/** True while the fill handle is dragged. */
|
|
2452
2456
|
get isFilling() {
|
|
2453
2457
|
return this.fillSource != null;
|
|
@@ -2473,13 +2477,13 @@ class Is {
|
|
|
2473
2477
|
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
2478
|
}
|
|
2475
2479
|
hitTest(t) {
|
|
2476
|
-
return
|
|
2480
|
+
return Pi(this.regionContext(), t);
|
|
2477
2481
|
}
|
|
2478
2482
|
// ---- pointer ----------------------------------------------------------
|
|
2479
2483
|
/** Returns true when the press belongs to the grid (the host then claims focus). */
|
|
2480
2484
|
pointerDown(t) {
|
|
2481
2485
|
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 ===
|
|
2486
|
+
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
2487
|
}
|
|
2484
2488
|
/** Hover and gestures. `fromAutoScroll` re-derives the head after an auto-scroll tick. */
|
|
2485
2489
|
pointerMove(t, n = !1) {
|
|
@@ -2513,8 +2517,8 @@ class Is {
|
|
|
2513
2517
|
return;
|
|
2514
2518
|
}
|
|
2515
2519
|
if (this.dragState.isDragging) {
|
|
2516
|
-
const
|
|
2517
|
-
this.drag.end(n, (u, h) => this.hooks.reorder(
|
|
2520
|
+
const c = this.dragState.type === O.Columns ? "columns" : "rows";
|
|
2521
|
+
this.drag.end(n, (u, h) => this.hooks.reorder(c, u.map((m) => [m[0], m[1]]), h)), this.selection.onSelectionEnd();
|
|
2518
2522
|
return;
|
|
2519
2523
|
}
|
|
2520
2524
|
this.drag.cancel();
|
|
@@ -2525,29 +2529,36 @@ class Is {
|
|
|
2525
2529
|
a && this.hooks.render();
|
|
2526
2530
|
return;
|
|
2527
2531
|
}
|
|
2528
|
-
const
|
|
2532
|
+
const l = { shiftKey: t.shiftKey, metaKey: t.commandKey };
|
|
2529
2533
|
switch (s.type) {
|
|
2530
|
-
case
|
|
2534
|
+
case b.RowHeaderExpandHandler:
|
|
2531
2535
|
this.hooks.rowExpand(s.rowIndex);
|
|
2532
2536
|
return;
|
|
2533
|
-
case
|
|
2534
|
-
|
|
2535
|
-
|
|
2537
|
+
case b.RowHeader:
|
|
2538
|
+
if (this.canExpandRow) {
|
|
2539
|
+
this.hooks.rowExpand(s.rowIndex);
|
|
2540
|
+
return;
|
|
2541
|
+
}
|
|
2542
|
+
this.selection.onSelectionClick(l, s);
|
|
2543
|
+
return;
|
|
2544
|
+
case b.ColumnHeaderMenu: {
|
|
2545
|
+
const c = this.coord.getColumnRelativeOffset(s.columnIndex, this.scroll.scrollLeft);
|
|
2546
|
+
this.hooks.headerMenu(s.columnIndex, { x: c, y: 0, width: this.coord.getColumnWidth(s.columnIndex), height: this.coord.rowInitSize });
|
|
2536
2547
|
return;
|
|
2537
2548
|
}
|
|
2538
2549
|
default:
|
|
2539
|
-
this.selection.onSelectionClick(
|
|
2550
|
+
this.selection.onSelectionClick(l, s);
|
|
2540
2551
|
}
|
|
2541
2552
|
}
|
|
2542
2553
|
endFill(t) {
|
|
2543
2554
|
const n = this.fillSource;
|
|
2544
2555
|
this.fillSource = null;
|
|
2545
|
-
const o =
|
|
2556
|
+
const o = fs(n, this.fillTargetRow(t), this.config.rowCount);
|
|
2546
2557
|
if (!o) {
|
|
2547
2558
|
this.hooks.render();
|
|
2548
2559
|
return;
|
|
2549
2560
|
}
|
|
2550
|
-
const i =
|
|
2561
|
+
const i = ps(o), a = this.selection.activeCell;
|
|
2551
2562
|
this.selection.update({
|
|
2552
2563
|
selection: this.selection.selection.set(H.Cells, [[i.startColumn, i.startRow], [i.endColumn, i.endRow]]),
|
|
2553
2564
|
...a ? {} : { activeCell: [n.startColumn, n.startRow] }
|
|
@@ -2567,7 +2578,7 @@ class Is {
|
|
|
2567
2578
|
}
|
|
2568
2579
|
doubleClick(t) {
|
|
2569
2580
|
const n = this.hitTest(t);
|
|
2570
|
-
n.type !==
|
|
2581
|
+
n.type !== b.Cell && n.type !== b.ActiveCell || this.requestEdit([n.columnIndex, n.rowIndex], "dblclick", !1);
|
|
2571
2582
|
}
|
|
2572
2583
|
contextMenu(t) {
|
|
2573
2584
|
const n = this.hitTest(t);
|
|
@@ -2580,7 +2591,7 @@ class Is {
|
|
|
2580
2591
|
/** True when `cell` is the active cell and the whole selection. */
|
|
2581
2592
|
isSoleActiveCell(t) {
|
|
2582
2593
|
const { selection: n, activeCell: o } = this.selection;
|
|
2583
|
-
if (!n.isCellSelection || !
|
|
2594
|
+
if (!n.isCellSelection || !bo(o, t)) return !1;
|
|
2584
2595
|
const [i, a] = n.ranges;
|
|
2585
2596
|
return !!i && !!a && i[0] === a[0] && i[1] === a[1];
|
|
2586
2597
|
}
|
|
@@ -2604,8 +2615,8 @@ class Is {
|
|
|
2604
2615
|
this.mouseState = n;
|
|
2605
2616
|
const o = { shiftKey: !1, metaKey: !1 }, i = this.config.rowControls;
|
|
2606
2617
|
switch (n.type) {
|
|
2607
|
-
case
|
|
2608
|
-
case
|
|
2618
|
+
case b.Cell:
|
|
2619
|
+
case b.ActiveCell: {
|
|
2609
2620
|
const a = [n.columnIndex, n.rowIndex], s = this.config.selectable;
|
|
2610
2621
|
if (this.isPhone)
|
|
2611
2622
|
s !== "none" && this.selectCell([a[0], a[1]], !1), this.hooks.rowExpand(a[1], a[0]);
|
|
@@ -2616,27 +2627,27 @@ class Is {
|
|
|
2616
2627
|
}
|
|
2617
2628
|
this.selectCell([a[0], a[1]], !1);
|
|
2618
2629
|
} else
|
|
2619
|
-
this.selection.onSelectionClick(o, { ...n, type:
|
|
2630
|
+
this.selection.onSelectionClick(o, { ...n, type: b.Cell });
|
|
2620
2631
|
this.hooks.render();
|
|
2621
2632
|
return;
|
|
2622
2633
|
}
|
|
2623
|
-
case
|
|
2624
|
-
case
|
|
2634
|
+
case b.ColumnHeader:
|
|
2635
|
+
case b.ColumnHeaderMenu: {
|
|
2625
2636
|
if (this.config.columns[n.columnIndex]?.hasMenu) {
|
|
2626
2637
|
const a = this.coord.getColumnRelativeOffset(n.columnIndex, this.scroll.scrollLeft);
|
|
2627
2638
|
this.hooks.headerMenu(n.columnIndex, { x: a, y: 0, width: this.coord.getColumnWidth(n.columnIndex), height: this.coord.rowInitSize });
|
|
2628
2639
|
return;
|
|
2629
2640
|
}
|
|
2630
|
-
this.selection.onSelectionClick(o, { ...n, type:
|
|
2641
|
+
this.selection.onSelectionClick(o, { ...n, type: b.ColumnHeader }), this.hooks.render();
|
|
2631
2642
|
return;
|
|
2632
2643
|
}
|
|
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:
|
|
2644
|
+
case b.RowHeader:
|
|
2645
|
+
case b.RowHeaderCheckbox:
|
|
2646
|
+
case b.RowHeaderDragHandler:
|
|
2647
|
+
case b.RowHeaderExpandHandler:
|
|
2648
|
+
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
2649
|
return;
|
|
2639
|
-
case
|
|
2650
|
+
case b.AllCheckbox:
|
|
2640
2651
|
this.selection.onSelectionClick(o, n), this.hooks.render();
|
|
2641
2652
|
return;
|
|
2642
2653
|
default:
|
|
@@ -2663,7 +2674,7 @@ class Is {
|
|
|
2663
2674
|
moveAfterEdit(t, n) {
|
|
2664
2675
|
const { rowCount: o, columns: i } = this.config;
|
|
2665
2676
|
if (!o || !i.length) return;
|
|
2666
|
-
const a = { pureRowCount: o, columnCount: i.length }, s = new
|
|
2677
|
+
const a = { pureRowCount: o, columnCount: i.length }, s = new se(H.Cells, [[t[0], t[1]], [t[0], t[1]]]), r = n === "down" ? ms(s, a) : On(s, n === "left", a);
|
|
2667
2678
|
this.selection.update({ selection: r.selection, activeCell: r.activeCell }), this.scrollToCell(r.scrollTo);
|
|
2668
2679
|
}
|
|
2669
2680
|
/** An input method started composing on the selected cell. */
|
|
@@ -2678,38 +2689,38 @@ class Is {
|
|
|
2678
2689
|
keyDown(t) {
|
|
2679
2690
|
if (t.key === "Escape" && this.down)
|
|
2680
2691
|
return this.cancelGesture(), "prevent";
|
|
2681
|
-
if (
|
|
2692
|
+
if (fo(t))
|
|
2682
2693
|
return this.compositionStart(), "pass";
|
|
2683
2694
|
const { rowCount: n, columns: o } = this.config;
|
|
2684
2695
|
if (!n || !o.length) return "ignore";
|
|
2685
2696
|
const i = { pureRowCount: n, columnCount: o.length }, a = this.selection.selection, s = this.selection.activeCell;
|
|
2686
2697
|
if (!a.isCellSelection || !s)
|
|
2687
|
-
return
|
|
2688
|
-
const r =
|
|
2698
|
+
return Gn[t.key] || t.key === "Tab" || t.key === "Home" ? t.key === "Tab" && !s ? "ignore" : (this.selectCell(s ?? [0, 0], !1), "prevent") : "ignore";
|
|
2699
|
+
const r = Gn[t.key];
|
|
2689
2700
|
if (r) {
|
|
2690
2701
|
if (t.altKey) return "ignore";
|
|
2691
|
-
const
|
|
2692
|
-
return this.selection.update({ selection:
|
|
2702
|
+
const l = ds(a, r, { expand: t.shiftKey, jump: t.commandKey }, i);
|
|
2703
|
+
return this.selection.update({ selection: l.selection, ...l.activeCell ? { activeCell: l.activeCell } : {} }), this.scrollToCell(l.scrollTo), "prevent";
|
|
2693
2704
|
}
|
|
2694
2705
|
switch (t.key) {
|
|
2695
2706
|
case "Tab": {
|
|
2696
|
-
const
|
|
2697
|
-
return this.selection.update({ selection:
|
|
2707
|
+
const l = On(a, t.shiftKey, i);
|
|
2708
|
+
return this.selection.update({ selection: l.selection, activeCell: l.activeCell }), this.scrollToCell(l.scrollTo), "prevent";
|
|
2698
2709
|
}
|
|
2699
2710
|
case "Home":
|
|
2700
2711
|
case "End": {
|
|
2701
|
-
const
|
|
2702
|
-
return this.selectCell([
|
|
2712
|
+
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];
|
|
2713
|
+
return this.selectCell([c, u], t.shiftKey), "prevent";
|
|
2703
2714
|
}
|
|
2704
2715
|
case "PageUp":
|
|
2705
2716
|
case "PageDown": {
|
|
2706
|
-
const
|
|
2707
|
-
return this.selectCell([
|
|
2717
|
+
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)));
|
|
2718
|
+
return this.selectCell([c[0], u], t.shiftKey), "prevent";
|
|
2708
2719
|
}
|
|
2709
2720
|
case "a":
|
|
2710
2721
|
case "A":
|
|
2711
2722
|
if (!t.commandKey || t.shiftKey || t.altKey) break;
|
|
2712
|
-
return this.selection.update({ selection:
|
|
2723
|
+
return this.selection.update({ selection: hs(a, i) }), "prevent";
|
|
2713
2724
|
case "Enter":
|
|
2714
2725
|
return t.shiftKey || t.altKey || t.commandKey ? "ignore" : (this.requestEdit(s, "enter", !1), "prevent");
|
|
2715
2726
|
case "F2":
|
|
@@ -2723,7 +2734,7 @@ class Is {
|
|
|
2723
2734
|
case "Escape":
|
|
2724
2735
|
return "ignore";
|
|
2725
2736
|
}
|
|
2726
|
-
return
|
|
2737
|
+
return pa(t) ? this.requestEdit(s, "key", !0) ? "pass" : "prevent" : "ignore";
|
|
2727
2738
|
}
|
|
2728
2739
|
// ---- drawing ----------------------------------------------------------
|
|
2729
2740
|
/** Everything `drawGrid` needs except the theme and the cell/icon painters. */
|
|
@@ -2758,17 +2769,19 @@ class Is {
|
|
|
2758
2769
|
}
|
|
2759
2770
|
/** Cursor for the current hover state; set on the same move (spec §3.12). */
|
|
2760
2771
|
get cursor() {
|
|
2761
|
-
if (this.resize.isResizing || this.mouseState.type ===
|
|
2772
|
+
if (this.resize.isResizing || this.mouseState.type === b.ColumnResizeHandler) return "col-resize";
|
|
2762
2773
|
if (this.dragState.isDragging) return "grabbing";
|
|
2763
|
-
if (this.isFilling || this.mouseState.type ===
|
|
2774
|
+
if (this.isFilling || this.mouseState.type === b.FillHandler) return "crosshair";
|
|
2764
2775
|
switch (this.mouseState.type) {
|
|
2765
|
-
case
|
|
2776
|
+
case b.RowHeaderDragHandler:
|
|
2766
2777
|
return "grab";
|
|
2767
|
-
case
|
|
2768
|
-
case
|
|
2769
|
-
case
|
|
2770
|
-
case
|
|
2778
|
+
case b.RowHeaderExpandHandler:
|
|
2779
|
+
case b.RowHeaderCheckbox:
|
|
2780
|
+
case b.AllCheckbox:
|
|
2781
|
+
case b.ColumnHeaderMenu:
|
|
2771
2782
|
return "pointer";
|
|
2783
|
+
case b.RowHeader:
|
|
2784
|
+
return this.canExpandRow ? "pointer" : "default";
|
|
2772
2785
|
default:
|
|
2773
2786
|
return "default";
|
|
2774
2787
|
}
|
|
@@ -2777,31 +2790,31 @@ class Is {
|
|
|
2777
2790
|
this.autoScroller.stop();
|
|
2778
2791
|
}
|
|
2779
2792
|
}
|
|
2780
|
-
const
|
|
2793
|
+
const Ms = () => {
|
|
2781
2794
|
if (typeof navigator > "u") return !1;
|
|
2782
2795
|
const e = navigator.userAgentData?.platform ?? navigator.platform ?? "";
|
|
2783
2796
|
return /mac|iphone|ipad|ipod/i.test(e);
|
|
2784
|
-
},
|
|
2797
|
+
}, Un = (e, t) => {
|
|
2785
2798
|
const n = Number.parseFloat(e.getPropertyValue(t));
|
|
2786
2799
|
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
2787
|
-
},
|
|
2800
|
+
}, As = (e, t = { rowHeight: B.rowHeight, headerHeight: B.columnHeadHeight }) => {
|
|
2788
2801
|
const n = getComputedStyle(e);
|
|
2789
2802
|
return {
|
|
2790
|
-
rowHeight:
|
|
2791
|
-
headerHeight:
|
|
2803
|
+
rowHeight: Un(n, "--ui-grid-row-height") ?? t.rowHeight,
|
|
2804
|
+
headerHeight: Un(n, "--ui-grid-header-height") ?? t.headerHeight
|
|
2792
2805
|
};
|
|
2793
|
-
},
|
|
2806
|
+
}, Es = (e, t, n) => n > 0 ? Math.max(0, Math.floor((e - t) / n)) : 0, Hs = ["aria-labelledby", "aria-rowcount", "aria-colcount", "aria-readonly", "aria-busy", "data-ui-grid-skeleton"], Ts = ["id"], Ns = { role: "rowgroup" }, Ls = {
|
|
2794
2807
|
role: "row",
|
|
2795
2808
|
"aria-rowindex": "1"
|
|
2796
|
-
},
|
|
2809
|
+
}, Fs = ["id", "aria-colindex"], Ds = { role: "rowgroup" }, Ws = ["aria-rowindex", "aria-hidden"], Bs = ["id"], Os = ["aria-colindex", "aria-selected", "aria-readonly"], Vs = ["id"], Gs = ["data-ui-grid-editing", "aria-labelledby", "aria-invalid", "aria-describedby", "readonly"], Us = ["id"], Ks = {
|
|
2797
2810
|
key: 1,
|
|
2798
2811
|
role: "status",
|
|
2799
2812
|
class: "sr-only"
|
|
2800
|
-
},
|
|
2813
|
+
}, _s = {
|
|
2801
2814
|
key: 2,
|
|
2802
2815
|
"data-ui-grid-overlay": "",
|
|
2803
2816
|
style: { position: "absolute", inset: "0", "pointer-events": "none", "z-index": "3" }
|
|
2804
|
-
},
|
|
2817
|
+
}, $s = 6, qs = 250, Xs = 100, Ys = 800, js = 300, Qs = 300, Fr = /* @__PURE__ */ jo({
|
|
2805
2818
|
__name: "GridHost",
|
|
2806
2819
|
props: {
|
|
2807
2820
|
columns: {},
|
|
@@ -2835,15 +2848,15 @@ const Ps = () => {
|
|
|
2835
2848
|
},
|
|
2836
2849
|
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
2850
|
setup(e, { expose: t, emit: n }) {
|
|
2838
|
-
const o = e, i = n, a =
|
|
2839
|
-
let
|
|
2840
|
-
const
|
|
2851
|
+
const o = e, i = n, a = Qo(), s = ai(), r = Zo(), l = ke(), c = ke(), u = ke(), h = ke(), m = ke(), g = ue({ rowHeight: B.rowHeight, headerHeight: B.columnHeadHeight }), C = ue({ ...ho, ...o.themeOverrides }), S = ue({ width: 0, height: 0 }), p = ue({ kind: "none", ranges: [], activeCell: null }), w = ue({ width: 0, height: 0 }), v = ke(!1), y = ke(!1), R = ue(0);
|
|
2852
|
+
let I = Ue.danger;
|
|
2853
|
+
const k = ue(null), P = U(() => o.rowHeight ?? g.value.rowHeight), M = U(() => o.headerHeight ?? g.value.headerHeight), N = U(() => Es(S.value.height, M.value, P.value)), z = U(() => !o.loading && o.rowCount === 0), E = () => {
|
|
2841
2854
|
const d = o.loading && o.rowCount === 0;
|
|
2842
2855
|
return {
|
|
2843
2856
|
columns: o.columns,
|
|
2844
|
-
rowCount: d ?
|
|
2845
|
-
rowHeight:
|
|
2846
|
-
headerHeight:
|
|
2857
|
+
rowCount: d ? v.value ? N.value : 0 : o.rowCount,
|
|
2858
|
+
rowHeight: P.value,
|
|
2859
|
+
headerHeight: M.value,
|
|
2847
2860
|
freezeColumnCount: o.freezeColumnCount,
|
|
2848
2861
|
rowControls: o.rowControls,
|
|
2849
2862
|
selectable: d ? "none" : o.selectable,
|
|
@@ -2851,288 +2864,290 @@ const Ps = () => {
|
|
|
2851
2864
|
columnResizable: o.columnResizable,
|
|
2852
2865
|
readonly: o.readonly || d,
|
|
2853
2866
|
fillable: o.fillable,
|
|
2854
|
-
touch:
|
|
2867
|
+
touch: y.value
|
|
2855
2868
|
};
|
|
2856
|
-
},
|
|
2857
|
-
let
|
|
2858
|
-
const
|
|
2859
|
-
render: () =>
|
|
2869
|
+
}, W = () => o.loading && o.rowCount === 0;
|
|
2870
|
+
let L = 0, _, q = null, ae = null;
|
|
2871
|
+
const X = () => o.editing || F.active, A = new zs(E(), {
|
|
2872
|
+
render: () => fe(),
|
|
2860
2873
|
selectionChange: (d) => {
|
|
2861
|
-
const f =
|
|
2862
|
-
|
|
2874
|
+
const f = F.state.value.cell;
|
|
2875
|
+
F.active && f && (d.activeCell?.[0] !== f[0] || d.activeCell?.[1] !== f[1]) && F.commit("selection"), p.value = d, !X() && m.value && (m.value.value = ""), je(), i("selection-change", d);
|
|
2863
2876
|
},
|
|
2864
2877
|
scrollTo: (d, f) => {
|
|
2865
|
-
const
|
|
2866
|
-
|
|
2878
|
+
const x = u.value;
|
|
2879
|
+
x && (x.scrollLeft = d, x.scrollTop = f);
|
|
2867
2880
|
},
|
|
2868
|
-
editRequest: (d, f,
|
|
2869
|
-
if ((
|
|
2870
|
-
|
|
2881
|
+
editRequest: (d, f, x, T) => {
|
|
2882
|
+
if ((x !== "tap" || f.editor !== "long-text") && F.open(d, f, x, "edit")) {
|
|
2883
|
+
Ze = x === "tap";
|
|
2871
2884
|
return;
|
|
2872
2885
|
}
|
|
2873
|
-
i("edit-request", { cell: d, column: f, trigger:
|
|
2886
|
+
i("edit-request", { cell: d, column: f, trigger: x, replace: T });
|
|
2874
2887
|
},
|
|
2875
|
-
viewRequest: (d, f,
|
|
2876
|
-
|
|
2888
|
+
viewRequest: (d, f, x) => {
|
|
2889
|
+
F.open(d, f, x, "view") && (Ze = x === "tap");
|
|
2877
2890
|
},
|
|
2878
2891
|
clearRequest: (d) => {
|
|
2879
2892
|
De(), i("clear-request", d);
|
|
2880
2893
|
},
|
|
2881
2894
|
rowExpand: (d, f) => f === void 0 ? i("row-expand", d) : i("row-expand", d, f),
|
|
2895
|
+
// Read at click time: listeners are vnode props, not reactive attrs.
|
|
2896
|
+
canExpandRow: () => !!(a?.vnode.props?.onRowExpand || a?.vnode.props?.onRowExpandOnce),
|
|
2882
2897
|
headerMenu: (d, f) => i("header-menu", d, f),
|
|
2883
|
-
columnResize: (d, f,
|
|
2884
|
-
|
|
2898
|
+
columnResize: (d, f, x) => {
|
|
2899
|
+
w.value = A.contentSize, x ? (i("column-resize-end", d, f), Vo(d, f)) : i("column-resize", d, f);
|
|
2885
2900
|
},
|
|
2886
2901
|
fill: (d) => {
|
|
2887
2902
|
De(), i("fill-request", d);
|
|
2888
2903
|
},
|
|
2889
|
-
reorder: (d, f,
|
|
2890
|
-
d === "columns" ? i("column-reorder", { ranges: f, dropIndex:
|
|
2904
|
+
reorder: (d, f, x) => {
|
|
2905
|
+
d === "columns" ? i("column-reorder", { ranges: f, dropIndex: x }) : i("row-reorder", { ranges: f, dropIndex: x });
|
|
2891
2906
|
},
|
|
2892
2907
|
contextMenu: (d, f) => i("context-menu", { selection: d, x: f.x, y: f.y }),
|
|
2893
2908
|
// Skeleton rows are not data; callers fetch only for real rows.
|
|
2894
2909
|
visibleRangeChange: (d) => {
|
|
2895
|
-
|
|
2910
|
+
W() || i("visible-range-change", d);
|
|
2896
2911
|
}
|
|
2897
|
-
}),
|
|
2898
|
-
owner: () =>
|
|
2899
|
-
root: () =>
|
|
2912
|
+
}), F = Qa({
|
|
2913
|
+
owner: () => m.value,
|
|
2914
|
+
root: () => l.value,
|
|
2900
2915
|
enabled: () => !!o.getEditText,
|
|
2901
2916
|
getEditText: (d) => o.getEditText?.(d) ?? "",
|
|
2902
|
-
validate: (d, f,
|
|
2917
|
+
validate: (d, f, x) => o.validateEdit?.(d, f, x),
|
|
2903
2918
|
columnAt: (d) => o.columns[d],
|
|
2904
|
-
rowHeight: () =>
|
|
2905
|
-
textBox: () =>
|
|
2919
|
+
rowHeight: () => P.value,
|
|
2920
|
+
textBox: () => k.value,
|
|
2906
2921
|
hasHint: () => !!o.editHint,
|
|
2907
|
-
hasSelection: () =>
|
|
2908
|
-
onCommit: ({ cell: d, column: f, value:
|
|
2909
|
-
De(), i("cell-commit", { cell: d, column: f, value:
|
|
2922
|
+
hasSelection: () => p.value.kind !== "none",
|
|
2923
|
+
onCommit: ({ cell: d, column: f, value: x, previous: T, reason: G }) => {
|
|
2924
|
+
De(), i("cell-commit", { cell: d, column: f, value: x, previous: T, reason: G }), A.invalidate();
|
|
2910
2925
|
},
|
|
2911
|
-
onEnd: (d, f,
|
|
2912
|
-
i("edit-end", { cell: d, column: f, committed:
|
|
2926
|
+
onEnd: (d, f, x) => {
|
|
2927
|
+
i("edit-end", { cell: d, column: f, committed: x }), fe();
|
|
2913
2928
|
},
|
|
2914
2929
|
moveSelection: (d) => {
|
|
2915
|
-
const f =
|
|
2916
|
-
f &&
|
|
2930
|
+
const f = F.state.value.cell ?? p.value.activeCell;
|
|
2931
|
+
f && A.moveAfterEdit(f, d);
|
|
2917
2932
|
},
|
|
2918
|
-
clearSelection: () =>
|
|
2933
|
+
clearSelection: () => A.setSelection({ kind: "none", ranges: [] }),
|
|
2919
2934
|
refocus: () => {
|
|
2920
|
-
if (
|
|
2921
|
-
|
|
2935
|
+
if (Ze && !F.active) {
|
|
2936
|
+
Ze = !1, m.value?.blur();
|
|
2922
2937
|
return;
|
|
2923
2938
|
}
|
|
2924
|
-
|
|
2939
|
+
Se();
|
|
2925
2940
|
}
|
|
2926
2941
|
});
|
|
2927
|
-
function
|
|
2928
|
-
|
|
2942
|
+
function fe() {
|
|
2943
|
+
L || typeof requestAnimationFrame > "u" || (L = requestAnimationFrame(Te));
|
|
2929
2944
|
}
|
|
2930
|
-
function
|
|
2931
|
-
|
|
2945
|
+
function Te() {
|
|
2946
|
+
L = 0;
|
|
2932
2947
|
const d = c.value;
|
|
2933
|
-
if (!d || !
|
|
2948
|
+
if (!d || !q) return;
|
|
2934
2949
|
const f = {
|
|
2935
|
-
...
|
|
2936
|
-
isEditing:
|
|
2950
|
+
...A.frame(),
|
|
2951
|
+
isEditing: X(),
|
|
2937
2952
|
highlightedRowIndex: o.highlightedRow,
|
|
2938
|
-
theme:
|
|
2939
|
-
height:
|
|
2940
|
-
drawCell:
|
|
2941
|
-
drawIcon: o.drawIcon ?
|
|
2953
|
+
theme: C.value,
|
|
2954
|
+
height: A.viewport.height,
|
|
2955
|
+
drawCell: Pe,
|
|
2956
|
+
drawIcon: o.drawIcon ? Ye : void 0
|
|
2942
2957
|
};
|
|
2943
|
-
|
|
2958
|
+
sa(d, q, f, _), _ = f, Ne(d), u.value && (u.value.style.cursor = A.cursor), je();
|
|
2944
2959
|
}
|
|
2945
|
-
function
|
|
2946
|
-
|
|
2960
|
+
function Y() {
|
|
2961
|
+
L && (cancelAnimationFrame(L), Te());
|
|
2947
2962
|
}
|
|
2948
|
-
function
|
|
2949
|
-
const f =
|
|
2963
|
+
function Ne(d) {
|
|
2964
|
+
const f = tt;
|
|
2950
2965
|
if (!f) return;
|
|
2951
|
-
const
|
|
2952
|
-
if (!
|
|
2953
|
-
const T =
|
|
2954
|
-
if (!T || !
|
|
2955
|
-
const { columnInitSize:
|
|
2956
|
-
|
|
2966
|
+
const x = d.getContext("2d");
|
|
2967
|
+
if (!x) return;
|
|
2968
|
+
const T = A.getCellRect([f.startColumn, f.startRow]), G = A.getCellRect([f.endColumn, f.endRow]);
|
|
2969
|
+
if (!T || !G) return;
|
|
2970
|
+
const { columnInitSize: J, rowInitSize: Re } = A.coord, { width: xt, height: Rt } = A.viewport, hn = Math.ceil(globalThis.devicePixelRatio ?? 1);
|
|
2971
|
+
x.save(), x.setTransform(hn, 0, 0, hn, 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
2972
|
}
|
|
2958
|
-
const
|
|
2959
|
-
function
|
|
2973
|
+
const Le = (d) => Math.max(0, Math.min(d.width - 2 * B.cellHorizontalPadding, d.width * 0.6));
|
|
2974
|
+
function Fe(d, f) {
|
|
2960
2975
|
D(d, {
|
|
2961
2976
|
x: f.x + B.cellHorizontalPadding,
|
|
2962
2977
|
y: f.y + (f.height - 8) / 2,
|
|
2963
|
-
width:
|
|
2978
|
+
width: Le(f),
|
|
2964
2979
|
height: 8,
|
|
2965
2980
|
radius: 8 / 2,
|
|
2966
2981
|
fill: f.theme.cellBgLoading
|
|
2967
2982
|
});
|
|
2968
2983
|
}
|
|
2969
|
-
function
|
|
2970
|
-
if (!
|
|
2971
|
-
const { fontSizeSM: T, cellTextColor:
|
|
2984
|
+
function ft(d, f, x) {
|
|
2985
|
+
if (!x) return;
|
|
2986
|
+
const { fontSizeSM: T, cellTextColor: G } = f.theme;
|
|
2972
2987
|
$e(d, {
|
|
2973
|
-
text:
|
|
2988
|
+
text: x,
|
|
2974
2989
|
x: f.x + B.cellHorizontalPadding,
|
|
2975
2990
|
y: f.y + (f.height - T) / 2,
|
|
2976
2991
|
maxWidth: f.width - 2 * B.cellHorizontalPadding,
|
|
2977
|
-
fill:
|
|
2992
|
+
fill: G,
|
|
2978
2993
|
fontSize: T
|
|
2979
2994
|
});
|
|
2980
2995
|
}
|
|
2981
|
-
function
|
|
2982
|
-
const
|
|
2983
|
-
if (!
|
|
2984
|
-
const T =
|
|
2996
|
+
function Pe(d, f) {
|
|
2997
|
+
const x = o.columns[f.columnIndex];
|
|
2998
|
+
if (!x) return;
|
|
2999
|
+
const T = W() || (o.isRowLoaded ? !o.isRowLoaded(f.rowIndex) : !1), G = {
|
|
2985
3000
|
x: f.x,
|
|
2986
3001
|
y: f.y,
|
|
2987
3002
|
width: f.width,
|
|
2988
3003
|
height: f.height,
|
|
2989
3004
|
cell: [f.columnIndex, f.rowIndex],
|
|
2990
|
-
column:
|
|
3005
|
+
column: x,
|
|
2991
3006
|
theme: f.theme,
|
|
2992
3007
|
isActive: f.isActive,
|
|
2993
3008
|
isLoading: T
|
|
2994
3009
|
};
|
|
2995
3010
|
if (T) {
|
|
2996
|
-
|
|
3011
|
+
Fe(d, G);
|
|
2997
3012
|
return;
|
|
2998
3013
|
}
|
|
2999
|
-
const
|
|
3000
|
-
|
|
3014
|
+
const J = o.cellRenderer?.(x, f.columnIndex);
|
|
3015
|
+
J ? J.draw(d, G) : ft(d, G, o.getCellText(G.cell));
|
|
3001
3016
|
}
|
|
3002
|
-
function
|
|
3003
|
-
const
|
|
3004
|
-
o.drawIcon?.(d, { kind: f.kind, x: f.x, y: f.y, size: f.size, theme: f.theme, column:
|
|
3017
|
+
function Ye(d, f) {
|
|
3018
|
+
const x = f.column ? o.columns.find((T) => T.id === f.column?.id) : void 0;
|
|
3019
|
+
o.drawIcon?.(d, { kind: f.kind, x: f.x, y: f.y, size: f.size, theme: f.theme, column: x });
|
|
3005
3020
|
}
|
|
3006
|
-
function
|
|
3007
|
-
const d =
|
|
3021
|
+
function je() {
|
|
3022
|
+
const d = h.value;
|
|
3008
3023
|
if (!d) return;
|
|
3009
|
-
const f =
|
|
3010
|
-
if (!
|
|
3024
|
+
const f = A.selection.activeCell, x = f ? A.getCellRect(f) : null;
|
|
3025
|
+
if (!x) {
|
|
3011
3026
|
d.style.transform = "translate(-10000px, 0)";
|
|
3012
3027
|
return;
|
|
3013
3028
|
}
|
|
3014
|
-
const { rowInitSize: T, freezeRegionWidth:
|
|
3015
|
-
d.style.transform = `translate(${
|
|
3029
|
+
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);
|
|
3030
|
+
d.style.transform = `translate(${xt}px, ${Rt}px)`, d.style.width = `${x.width}px`, d.style.height = `${x.height}px`;
|
|
3016
3031
|
}
|
|
3017
|
-
function
|
|
3018
|
-
return
|
|
3032
|
+
function Se() {
|
|
3033
|
+
return ma(m.value, l.value ?? null);
|
|
3019
3034
|
}
|
|
3020
|
-
const
|
|
3021
|
-
function
|
|
3022
|
-
const f =
|
|
3023
|
-
return { x: d.clientX - f.left, y: d.clientY - f.top, shiftKey: d.shiftKey, commandKey:
|
|
3035
|
+
const ye = (d) => Ms() ? d.metaKey : d.ctrlKey;
|
|
3036
|
+
function ce(d) {
|
|
3037
|
+
const f = ae ?? (ae = l.value.getBoundingClientRect());
|
|
3038
|
+
return { x: d.clientX - f.left, y: d.clientY - f.top, shiftKey: d.shiftKey, commandKey: ye(d) };
|
|
3024
3039
|
}
|
|
3025
|
-
function
|
|
3026
|
-
const f =
|
|
3027
|
-
return d.clientX -
|
|
3040
|
+
function Qe(d) {
|
|
3041
|
+
const f = u.value, x = ae;
|
|
3042
|
+
return d.clientX - x.left >= f.clientWidth || d.clientY - x.top >= f.clientHeight;
|
|
3028
3043
|
}
|
|
3029
|
-
let
|
|
3030
|
-
const
|
|
3031
|
-
function
|
|
3032
|
-
|
|
3044
|
+
let re = null, te = null, jt = -1 / 0, Qt = -1 / 0, Ze = !1;
|
|
3045
|
+
const Je = () => typeof performance > "u" ? Date.now() : performance.now(), Zt = () => te != null || Je() - jt < Ys;
|
|
3046
|
+
function et() {
|
|
3047
|
+
te && clearTimeout(te.timer), te = null, jt = Je();
|
|
3033
3048
|
}
|
|
3034
|
-
function
|
|
3035
|
-
if (
|
|
3036
|
-
|
|
3049
|
+
function Po(d) {
|
|
3050
|
+
if (te) {
|
|
3051
|
+
et();
|
|
3037
3052
|
return;
|
|
3038
3053
|
}
|
|
3039
3054
|
const f = {
|
|
3040
3055
|
id: d.pointerId,
|
|
3041
3056
|
x: d.clientX,
|
|
3042
3057
|
y: d.clientY,
|
|
3043
|
-
flingStop:
|
|
3058
|
+
flingStop: Je() - Qt < Xs,
|
|
3044
3059
|
longPressed: !1,
|
|
3045
3060
|
timer: setTimeout(() => {
|
|
3046
|
-
|
|
3047
|
-
},
|
|
3061
|
+
te !== f || f.flingStop || X() || (f.longPressed = !0, A.longPress(ce(d)), Y());
|
|
3062
|
+
}, qs)
|
|
3048
3063
|
};
|
|
3049
|
-
|
|
3050
|
-
}
|
|
3051
|
-
function Po(d) {
|
|
3052
|
-
const f = q;
|
|
3053
|
-
!f || f.id !== d.pointerId || Math.hypot(d.clientX - f.x, d.clientY - f.y) > Ks && Ze();
|
|
3064
|
+
te = f;
|
|
3054
3065
|
}
|
|
3055
3066
|
function zo(d) {
|
|
3056
|
-
const f =
|
|
3057
|
-
!f || f.id !== d.pointerId || (
|
|
3058
|
-
le = null, z.clearTapFeedback();
|
|
3059
|
-
}, Xs))));
|
|
3067
|
+
const f = te;
|
|
3068
|
+
!f || f.id !== d.pointerId || Math.hypot(d.clientX - f.x, d.clientY - f.y) > $s && et();
|
|
3060
3069
|
}
|
|
3061
3070
|
function Mo(d) {
|
|
3062
|
-
|
|
3063
|
-
|
|
3071
|
+
const f = te;
|
|
3072
|
+
!f || f.id !== d.pointerId || (et(), !(f.longPressed || f.flingStop) && (F.active && !F.commit("pointer") || o.editing || (A.tap(ce(d)), Y(), re && clearTimeout(re), re = setTimeout(() => {
|
|
3073
|
+
re = null, A.clearTapFeedback();
|
|
3074
|
+
}, js))));
|
|
3075
|
+
}
|
|
3076
|
+
function Ao(d) {
|
|
3077
|
+
if (ae = l.value.getBoundingClientRect(), d.pointerType === "touch") {
|
|
3078
|
+
Po(d);
|
|
3064
3079
|
return;
|
|
3065
3080
|
}
|
|
3066
|
-
if (d.button !== 0 ||
|
|
3067
|
-
if (
|
|
3081
|
+
if (d.button !== 0 || Qe(d)) return;
|
|
3082
|
+
if (F.active && !F.commit("pointer")) {
|
|
3068
3083
|
d.preventDefault();
|
|
3069
3084
|
return;
|
|
3070
3085
|
}
|
|
3071
|
-
const f =
|
|
3072
|
-
if (
|
|
3086
|
+
const f = A.pointerDown(ce(d));
|
|
3087
|
+
if (Y(), !!f) {
|
|
3073
3088
|
d.preventDefault();
|
|
3074
3089
|
try {
|
|
3075
|
-
|
|
3090
|
+
u.value.setPointerCapture(d.pointerId);
|
|
3076
3091
|
} catch {
|
|
3077
3092
|
}
|
|
3078
|
-
|
|
3093
|
+
Se();
|
|
3079
3094
|
}
|
|
3080
3095
|
}
|
|
3081
|
-
function
|
|
3096
|
+
function Eo(d) {
|
|
3082
3097
|
if (d.pointerType === "touch") {
|
|
3083
|
-
|
|
3098
|
+
zo(d);
|
|
3084
3099
|
return;
|
|
3085
3100
|
}
|
|
3086
|
-
|
|
3101
|
+
ae || (ae = l.value.getBoundingClientRect()), A.pointerMove(ce(d)), Y(), u.value && (u.value.style.cursor = A.cursor);
|
|
3087
3102
|
}
|
|
3088
|
-
function
|
|
3103
|
+
function Ho(d) {
|
|
3089
3104
|
if (d.pointerType === "touch") {
|
|
3090
|
-
|
|
3105
|
+
Mo(d);
|
|
3091
3106
|
return;
|
|
3092
3107
|
}
|
|
3093
|
-
if (
|
|
3094
|
-
|
|
3108
|
+
if (A.isGestureActive) {
|
|
3109
|
+
A.pointerUp(ce(d)), Y();
|
|
3095
3110
|
try {
|
|
3096
|
-
|
|
3111
|
+
u.value?.releasePointerCapture(d.pointerId);
|
|
3097
3112
|
} catch {
|
|
3098
3113
|
}
|
|
3099
3114
|
}
|
|
3100
3115
|
}
|
|
3101
|
-
function
|
|
3116
|
+
function Jt(d) {
|
|
3102
3117
|
if (d.pointerType === "touch") {
|
|
3103
|
-
|
|
3118
|
+
te?.id === d.pointerId && et();
|
|
3104
3119
|
return;
|
|
3105
3120
|
}
|
|
3106
|
-
|
|
3107
|
-
}
|
|
3108
|
-
function Ho() {
|
|
3109
|
-
z.pointerLeave();
|
|
3121
|
+
A.cancelGesture(), Y();
|
|
3110
3122
|
}
|
|
3111
|
-
function To(
|
|
3112
|
-
|
|
3123
|
+
function To() {
|
|
3124
|
+
A.pointerLeave();
|
|
3113
3125
|
}
|
|
3114
3126
|
function No(d) {
|
|
3115
|
-
|
|
3127
|
+
X() || Zt() || A.doubleClick(ce(d));
|
|
3128
|
+
}
|
|
3129
|
+
function Lo(d) {
|
|
3130
|
+
if (Zt()) {
|
|
3116
3131
|
d.preventDefault();
|
|
3117
3132
|
return;
|
|
3118
3133
|
}
|
|
3119
|
-
|
|
3134
|
+
ae = l.value.getBoundingClientRect(), A.contextMenu(ce(d)) && (d.preventDefault(), Se());
|
|
3120
3135
|
}
|
|
3121
3136
|
function Fo() {
|
|
3122
|
-
const d =
|
|
3123
|
-
d && (
|
|
3137
|
+
const d = u.value;
|
|
3138
|
+
d && (ae = null, Qt = Je(), A.setScroll(d.scrollLeft, d.scrollTop));
|
|
3124
3139
|
}
|
|
3125
|
-
function
|
|
3126
|
-
if (
|
|
3127
|
-
|
|
3140
|
+
function Do(d) {
|
|
3141
|
+
if (F.active) {
|
|
3142
|
+
F.keyDown(d, ye(d)) && d.stopPropagation();
|
|
3128
3143
|
return;
|
|
3129
3144
|
}
|
|
3130
3145
|
if (o.editing) return;
|
|
3131
|
-
if (d.key === "Escape" && De(),
|
|
3132
|
-
|
|
3146
|
+
if (d.key === "Escape" && De(), Wo(d)) {
|
|
3147
|
+
Bo();
|
|
3133
3148
|
return;
|
|
3134
3149
|
}
|
|
3135
|
-
|
|
3150
|
+
A.keyDown({
|
|
3136
3151
|
key: d.key,
|
|
3137
3152
|
keyCode: d.keyCode,
|
|
3138
3153
|
shiftKey: d.shiftKey,
|
|
@@ -3140,290 +3155,290 @@ const Ps = () => {
|
|
|
3140
3155
|
metaKey: d.metaKey,
|
|
3141
3156
|
ctrlKey: d.ctrlKey,
|
|
3142
3157
|
isComposing: d.isComposing,
|
|
3143
|
-
commandKey:
|
|
3144
|
-
}) === "prevent" && d.preventDefault(),
|
|
3158
|
+
commandKey: ye(d)
|
|
3159
|
+
}) === "prevent" && d.preventDefault(), Y();
|
|
3145
3160
|
}
|
|
3146
|
-
let
|
|
3161
|
+
let tt = null, pe = null;
|
|
3147
3162
|
function De() {
|
|
3148
|
-
|
|
3163
|
+
tt && (tt = null, fe());
|
|
3149
3164
|
}
|
|
3150
|
-
const
|
|
3151
|
-
function
|
|
3152
|
-
if (!
|
|
3165
|
+
const pt = () => ({ rowCount: o.loading && o.rowCount === 0 ? 0 : o.rowCount, columnCount: o.columns.length });
|
|
3166
|
+
function Wo(d) {
|
|
3167
|
+
if (!ye(d) || d.altKey || d.shiftKey) return !1;
|
|
3153
3168
|
const f = d.key.toLowerCase();
|
|
3154
3169
|
return f === "c" || f === "x" || d.code === "KeyC" || d.code === "KeyX";
|
|
3155
3170
|
}
|
|
3156
|
-
function
|
|
3157
|
-
const d =
|
|
3158
|
-
!d || d.value || (d.value = " ", d.select(),
|
|
3171
|
+
function Bo() {
|
|
3172
|
+
const d = m.value;
|
|
3173
|
+
!d || d.value || (d.value = " ", d.select(), pe && clearTimeout(pe), pe = setTimeout(en, 0));
|
|
3159
3174
|
}
|
|
3160
|
-
function
|
|
3161
|
-
|
|
3175
|
+
function en() {
|
|
3176
|
+
pe && clearTimeout(pe), pe = null, m.value && !F.active && (m.value.value = "");
|
|
3162
3177
|
}
|
|
3163
|
-
function
|
|
3164
|
-
T && (
|
|
3178
|
+
function Ct(d, f, x, T) {
|
|
3179
|
+
T && (tt = qe(d, pt()), fe()), i("clipboard-copy", { block: f, cellCount: Aa(f), cut: x, ok: T }), T && x && !o.readonly && i("clear-request", d);
|
|
3165
3180
|
}
|
|
3166
|
-
function
|
|
3167
|
-
const
|
|
3181
|
+
function tn(d, f) {
|
|
3182
|
+
const x = A.getSelection(), T = Co(x, pt());
|
|
3168
3183
|
if (!T) return Promise.resolve(!1);
|
|
3169
|
-
const
|
|
3170
|
-
if (f &&
|
|
3171
|
-
const
|
|
3172
|
-
return
|
|
3184
|
+
const G = Ha(T, o.isRowLoaded);
|
|
3185
|
+
if (f && G) {
|
|
3186
|
+
const Re = ka(f, Pt(Tn(T, o.getCopyText ?? o.getCellText)));
|
|
3187
|
+
return Ct(x, T, d, Re), Promise.resolve(Re);
|
|
3173
3188
|
}
|
|
3174
3189
|
f?.preventDefault();
|
|
3175
|
-
let
|
|
3176
|
-
return
|
|
3177
|
-
}),
|
|
3178
|
-
() => (
|
|
3179
|
-
() => (
|
|
3190
|
+
let J;
|
|
3191
|
+
return G ? J = Promise.resolve(Pt(Tn(T, o.getCopyText ?? o.getCellText))) : o.resolveCopy ? J = o.resolveCopy(T).then(Pt) : J = Promise.reject(new Error("Rows are not loaded")), J.catch(() => {
|
|
3192
|
+
}), Pa(J).then(
|
|
3193
|
+
() => (Ct(x, T, d, !0), !0),
|
|
3194
|
+
() => (Ct(x, T, d, !1), !1)
|
|
3180
3195
|
);
|
|
3181
3196
|
}
|
|
3182
|
-
function
|
|
3183
|
-
|
|
3197
|
+
function nn(d, f) {
|
|
3198
|
+
F.active || o.editing || (en(), d.preventDefault(), tn(f, d));
|
|
3184
3199
|
}
|
|
3185
|
-
function
|
|
3200
|
+
function on(d) {
|
|
3186
3201
|
if (o.readonly) return null;
|
|
3187
|
-
const f =
|
|
3188
|
-
...
|
|
3189
|
-
isReadonlyColumn: (
|
|
3202
|
+
const f = Ea(d, A.getSelection(), {
|
|
3203
|
+
...pt(),
|
|
3204
|
+
isReadonlyColumn: (x) => !!o.columns[x]?.readonly
|
|
3190
3205
|
});
|
|
3191
3206
|
return f ? (De(), i("paste-request", f), f) : null;
|
|
3192
3207
|
}
|
|
3193
|
-
function
|
|
3194
|
-
|
|
3208
|
+
function Oo(d) {
|
|
3209
|
+
F.active || Ca({ isEditing: o.editing, eventTarget: d.target, hiddenFocusEl: m.value ?? null }) && (d.preventDefault(), p.value.kind !== "none" && on(d.clipboardData?.getData("text/plain") ?? ""));
|
|
3195
3210
|
}
|
|
3196
|
-
const
|
|
3211
|
+
const wt = /* @__PURE__ */ new Map();
|
|
3197
3212
|
let ze = null;
|
|
3198
|
-
function
|
|
3213
|
+
function an() {
|
|
3199
3214
|
ze && clearTimeout(ze), ze = null;
|
|
3200
|
-
const d = [...
|
|
3201
|
-
|
|
3202
|
-
for (const [f,
|
|
3215
|
+
const d = [...wt];
|
|
3216
|
+
wt.clear();
|
|
3217
|
+
for (const [f, x] of d) i("column-width-save", f, x);
|
|
3203
3218
|
}
|
|
3204
|
-
function
|
|
3205
|
-
|
|
3206
|
-
}
|
|
3207
|
-
function Vo() {
|
|
3208
|
-
o.editing || (L.active || z.compositionStart(), L.active && L.compositionStart());
|
|
3219
|
+
function Vo(d, f) {
|
|
3220
|
+
wt.set(d, f), ze && clearTimeout(ze), ze = setTimeout(an, Qs);
|
|
3209
3221
|
}
|
|
3210
3222
|
function Go() {
|
|
3211
|
-
|
|
3223
|
+
o.editing || (F.active || A.compositionStart(), F.active && F.compositionStart());
|
|
3212
3224
|
}
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
v.value = !!We?.matches, ye();
|
|
3225
|
+
function Uo() {
|
|
3226
|
+
F.compositionEnd();
|
|
3216
3227
|
}
|
|
3217
|
-
let
|
|
3228
|
+
let vt = null, St = null, yt = null, We = null;
|
|
3218
3229
|
function sn() {
|
|
3219
|
-
|
|
3230
|
+
y.value = !!We?.matches, xe();
|
|
3231
|
+
}
|
|
3232
|
+
let be = null;
|
|
3233
|
+
function rn() {
|
|
3234
|
+
const d = l.value;
|
|
3220
3235
|
if (!d) return;
|
|
3221
|
-
|
|
3222
|
-
const f = d.clientWidth,
|
|
3223
|
-
f ===
|
|
3236
|
+
ae = null;
|
|
3237
|
+
const f = d.clientWidth, x = d.clientHeight;
|
|
3238
|
+
f === S.value.width && x === S.value.height || (S.value = { width: f, height: x }, A.setViewport(f, x), bt());
|
|
3224
3239
|
}
|
|
3225
|
-
function
|
|
3226
|
-
const d =
|
|
3227
|
-
d && (
|
|
3240
|
+
function xe() {
|
|
3241
|
+
const d = l.value;
|
|
3242
|
+
d && (g.value = As(d, g.value), C.value = ua(d, o.themeOverrides), I = yo(d).danger, k.value = Ua(d.ownerDocument, C.value.fontSizeSM, C.value.fontFamily), A.theme = C.value, bt(), A.invalidate());
|
|
3228
3243
|
}
|
|
3229
|
-
function
|
|
3230
|
-
|
|
3244
|
+
function bt() {
|
|
3245
|
+
A.configure(E()), w.value = A.contentSize;
|
|
3231
3246
|
}
|
|
3232
|
-
|
|
3233
|
-
if (
|
|
3234
|
-
|
|
3247
|
+
de(() => o.loading && o.rowCount === 0, (d) => {
|
|
3248
|
+
if (be && clearTimeout(be), be = null, !d) {
|
|
3249
|
+
v.value = !1;
|
|
3235
3250
|
return;
|
|
3236
3251
|
}
|
|
3237
|
-
|
|
3238
|
-
|
|
3252
|
+
be = setTimeout(() => {
|
|
3253
|
+
be = null, v.value = !0;
|
|
3239
3254
|
}, 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 =
|
|
3255
|
+
}, { immediate: !0 }), de(
|
|
3256
|
+
() => [o.columns, o.rowCount, o.freezeColumnCount, o.rowControls, o.selectable, o.draggable, o.columnResizable, o.readonly, y.value, P.value, M.value, v.value, N.value],
|
|
3257
|
+
bt
|
|
3258
|
+
), de(() => [o.getCellText, o.cellRenderer, o.isRowLoaded, o.drawIcon], () => A.invalidate()), de(() => o.themeOverrides, xe), de(() => o.editing, () => fe()), de(() => o.highlightedRow, () => A.invalidate()), Jo(() => {
|
|
3259
|
+
if (q = document.createElement("canvas"), xe(), rn(), typeof ResizeObserver < "u" && (vt = new ResizeObserver(() => rn()), vt.observe(l.value)), typeof MutationObserver < "u") {
|
|
3260
|
+
St = new MutationObserver(() => xe());
|
|
3261
|
+
const d = l.value.closest("[data-ui-app]");
|
|
3247
3262
|
for (const f of /* @__PURE__ */ new Set([d, document.documentElement]))
|
|
3248
|
-
f &&
|
|
3263
|
+
f && St.observe(f, { attributes: !0, attributeFilter: ["data-ui-color-scheme", "data-ui-density", "style", "class"] });
|
|
3249
3264
|
}
|
|
3250
|
-
|
|
3251
|
-
}),
|
|
3252
|
-
|
|
3265
|
+
yt = typeof matchMedia == "function" ? matchMedia("(prefers-color-scheme: dark)") : null, yt?.addEventListener?.("change", xe), We = typeof matchMedia == "function" ? matchMedia("(pointer: coarse)") : null, y.value = !!We?.matches, We?.addEventListener?.("change", sn), fe();
|
|
3266
|
+
}), ei(() => {
|
|
3267
|
+
L && cancelAnimationFrame(L), be && clearTimeout(be), vt?.disconnect(), St?.disconnect(), yt?.removeEventListener?.("change", xe), We?.removeEventListener?.("change", sn), te && clearTimeout(te.timer), re && clearTimeout(re), A.dispose(), pe && clearTimeout(pe), an(), q = null;
|
|
3253
3268
|
});
|
|
3254
|
-
const
|
|
3255
|
-
const d =
|
|
3269
|
+
const j = U(() => p.value.activeCell), Ko = U(() => j.value ? o.columns[j.value[0]] : void 0), _o = U(() => {
|
|
3270
|
+
const d = j.value;
|
|
3256
3271
|
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 =
|
|
3272
|
+
}), $o = U(() => j.value && o.rowCount > 0 ? o.getCellText(j.value) : ""), ln = (d) => `${r}-col-${d}`, qo = U(() => j.value ? `${ln(j.value[0])} ${r}-rowheader ${r}-cell` : `${r}-label`), cn = (d) => A.getCellRect(d), Q = U(() => F.state.value), un = U(() => Q.value.active && Q.value.mode === "edit" && Q.value.kind === "long-text" && !!o.editHint), nt = U(() => ({
|
|
3273
|
+
open: Q.value.active,
|
|
3274
|
+
kind: Q.value.kind,
|
|
3275
|
+
view: Q.value.mode === "view",
|
|
3276
|
+
invalid: !!Q.value.error,
|
|
3277
|
+
hint: un.value,
|
|
3278
|
+
rowHeight: P.value,
|
|
3279
|
+
lines: F.lines.value,
|
|
3280
|
+
theme: C.value,
|
|
3281
|
+
dangerColor: I,
|
|
3282
|
+
textBox: k.value
|
|
3283
|
+
})), Xo = U(() => $a(nt.value)), dn = U(() => Q.value.active ? So(nt.value) : P.value), ot = U(() => {
|
|
3284
|
+
if (R.value, Q.value.active) return Q.value.error;
|
|
3285
|
+
const d = p.value.activeCell, f = d && o.cellStatus ? o.cellStatus(d) : null;
|
|
3271
3286
|
return f?.state === "error" ? f.message : null;
|
|
3272
3287
|
});
|
|
3273
3288
|
return t({
|
|
3274
|
-
focus:
|
|
3275
|
-
focusOwner: () =>
|
|
3276
|
-
getCellRect:
|
|
3277
|
-
scrollToCell: (d) =>
|
|
3278
|
-
getSelection: () =>
|
|
3279
|
-
setSelection: (d) =>
|
|
3289
|
+
focus: Se,
|
|
3290
|
+
focusOwner: () => m.value ?? null,
|
|
3291
|
+
getCellRect: cn,
|
|
3292
|
+
scrollToCell: (d) => A.scrollToCell(d),
|
|
3293
|
+
getSelection: () => A.getSelection(),
|
|
3294
|
+
setSelection: (d) => A.setSelection(d),
|
|
3280
3295
|
invalidate: () => {
|
|
3281
|
-
|
|
3296
|
+
R.value++, A.invalidate();
|
|
3282
3297
|
},
|
|
3283
|
-
refreshTheme:
|
|
3284
|
-
isEditing: () =>
|
|
3285
|
-
commitEdit: () => !
|
|
3286
|
-
cancelEdit: () =>
|
|
3287
|
-
copy: (d = !1) =>
|
|
3288
|
-
paste: (d) =>
|
|
3289
|
-
}), (d, f) => (
|
|
3298
|
+
refreshTheme: xe,
|
|
3299
|
+
isEditing: () => F.active,
|
|
3300
|
+
commitEdit: () => !F.active || F.commit("selection"),
|
|
3301
|
+
cancelEdit: () => F.cancel(),
|
|
3302
|
+
copy: (d = !1) => tn(d),
|
|
3303
|
+
paste: (d) => on(d)
|
|
3304
|
+
}), (d, f) => (Ce(), we("div", {
|
|
3290
3305
|
ref_key: "root",
|
|
3291
|
-
ref:
|
|
3306
|
+
ref: l,
|
|
3292
3307
|
role: "grid",
|
|
3293
3308
|
"data-ui-grid": "",
|
|
3294
|
-
"aria-labelledby": `${
|
|
3309
|
+
"aria-labelledby": `${ee(r)}-label`,
|
|
3295
3310
|
"aria-rowcount": e.loading && e.rowCount === 0 ? -1 : e.rowCount + 1,
|
|
3296
3311
|
"aria-colcount": e.columns.length,
|
|
3297
3312
|
"aria-readonly": e.readonly ? "true" : void 0,
|
|
3298
3313
|
"aria-busy": e.loading ? "true" : void 0,
|
|
3299
|
-
"data-ui-grid-skeleton":
|
|
3314
|
+
"data-ui-grid-skeleton": v.value && e.loading && e.rowCount === 0 ? "" : void 0,
|
|
3300
3315
|
"aria-multiselectable": "true",
|
|
3301
3316
|
style: { position: "relative", overflow: "hidden", width: "100%", height: "100%", "min-height": "0", background: "var(--ui-surface)", contain: "strict", isolation: "isolate" },
|
|
3302
|
-
onPaste:
|
|
3317
|
+
onPaste: Oo
|
|
3303
3318
|
}, [
|
|
3304
|
-
|
|
3305
|
-
id: `${
|
|
3319
|
+
ne("span", {
|
|
3320
|
+
id: `${ee(r)}-label`,
|
|
3306
3321
|
class: "sr-only"
|
|
3307
|
-
},
|
|
3308
|
-
|
|
3322
|
+
}, ve(e.label), 9, Ts),
|
|
3323
|
+
ne("canvas", {
|
|
3309
3324
|
ref_key: "canvas",
|
|
3310
3325
|
ref: c,
|
|
3311
3326
|
"aria-hidden": "true",
|
|
3312
3327
|
style: { position: "absolute", top: "0", left: "0", "pointer-events": "none", "z-index": "0" }
|
|
3313
3328
|
}, null, 512),
|
|
3314
|
-
|
|
3329
|
+
ne("div", {
|
|
3315
3330
|
ref_key: "scroller",
|
|
3316
|
-
ref:
|
|
3331
|
+
ref: u,
|
|
3317
3332
|
"data-ui-grid-scroller": "",
|
|
3318
3333
|
"aria-hidden": "true",
|
|
3319
3334
|
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
3335
|
onScrollPassive: Fo,
|
|
3321
|
-
onPointerdown:
|
|
3322
|
-
onPointermove:
|
|
3323
|
-
onPointerup:
|
|
3324
|
-
onPointercancel:
|
|
3325
|
-
onLostpointercapture:
|
|
3326
|
-
onPointerleave:
|
|
3327
|
-
onDblclick:
|
|
3328
|
-
onContextmenu:
|
|
3336
|
+
onPointerdown: Ao,
|
|
3337
|
+
onPointermove: Eo,
|
|
3338
|
+
onPointerup: Ho,
|
|
3339
|
+
onPointercancel: Jt,
|
|
3340
|
+
onLostpointercapture: Jt,
|
|
3341
|
+
onPointerleave: To,
|
|
3342
|
+
onDblclick: No,
|
|
3343
|
+
onContextmenu: Lo
|
|
3329
3344
|
}, [
|
|
3330
|
-
|
|
3331
|
-
style: Be({ width: `${
|
|
3345
|
+
ne("div", {
|
|
3346
|
+
style: Be({ width: `${w.value.width}px`, height: `${w.value.height}px` })
|
|
3332
3347
|
}, null, 4)
|
|
3333
3348
|
], 544),
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
(
|
|
3337
|
-
id:
|
|
3338
|
-
key:
|
|
3349
|
+
ne("div", Ns, [
|
|
3350
|
+
ne("div", Ls, [
|
|
3351
|
+
(Ce(!0), we(ti, null, ni(e.columns, (x, T) => (Ce(), we("span", {
|
|
3352
|
+
id: ln(T),
|
|
3353
|
+
key: x.id,
|
|
3339
3354
|
role: "columnheader",
|
|
3340
3355
|
class: "sr-only",
|
|
3341
3356
|
"aria-colindex": T + 1
|
|
3342
|
-
},
|
|
3357
|
+
}, ve(x.name), 9, Fs))), 128))
|
|
3343
3358
|
])
|
|
3344
3359
|
]),
|
|
3345
|
-
|
|
3346
|
-
|
|
3360
|
+
ne("div", Ds, [
|
|
3361
|
+
ne("div", {
|
|
3347
3362
|
role: "row",
|
|
3348
|
-
"aria-rowindex":
|
|
3349
|
-
"aria-hidden":
|
|
3363
|
+
"aria-rowindex": j.value ? j.value[1] + 2 : 2,
|
|
3364
|
+
"aria-hidden": j.value ? void 0 : "true"
|
|
3350
3365
|
}, [
|
|
3351
|
-
|
|
3352
|
-
id: `${
|
|
3366
|
+
ne("span", {
|
|
3367
|
+
id: `${ee(r)}-rowheader`,
|
|
3353
3368
|
role: "rowheader",
|
|
3354
3369
|
class: "sr-only"
|
|
3355
|
-
},
|
|
3356
|
-
|
|
3370
|
+
}, ve(_o.value), 9, Bs),
|
|
3371
|
+
ne("div", {
|
|
3357
3372
|
ref_key: "focusCell",
|
|
3358
|
-
ref:
|
|
3373
|
+
ref: h,
|
|
3359
3374
|
role: "gridcell",
|
|
3360
|
-
"aria-colindex":
|
|
3361
|
-
"aria-selected":
|
|
3362
|
-
"aria-readonly": e.readonly ||
|
|
3375
|
+
"aria-colindex": j.value ? j.value[0] + 1 : 1,
|
|
3376
|
+
"aria-selected": j.value ? "true" : void 0,
|
|
3377
|
+
"aria-readonly": e.readonly || Ko.value?.readonly ? "true" : void 0,
|
|
3363
3378
|
"data-ui-grid-focus-cell": "",
|
|
3364
3379
|
style: { position: "absolute", top: "0", left: "0", width: "0", height: "0", transform: "translate(-10000px, 0)", "z-index": "2", "pointer-events": "none" }
|
|
3365
3380
|
}, [
|
|
3366
|
-
|
|
3367
|
-
id: `${
|
|
3381
|
+
ne("span", {
|
|
3382
|
+
id: `${ee(r)}-cell`,
|
|
3368
3383
|
class: "sr-only"
|
|
3369
|
-
},
|
|
3370
|
-
|
|
3384
|
+
}, ve($o.value), 9, Vs),
|
|
3385
|
+
ne("textarea", {
|
|
3371
3386
|
ref_key: "focusOwner",
|
|
3372
|
-
ref:
|
|
3387
|
+
ref: m,
|
|
3373
3388
|
"data-ui-grid-focus-owner": "",
|
|
3374
|
-
"data-ui-grid-editing":
|
|
3375
|
-
"aria-labelledby":
|
|
3376
|
-
"aria-invalid":
|
|
3377
|
-
"aria-describedby":
|
|
3378
|
-
readonly:
|
|
3389
|
+
"data-ui-grid-editing": Q.value.active ? Q.value.mode : void 0,
|
|
3390
|
+
"aria-labelledby": qo.value,
|
|
3391
|
+
"aria-invalid": ot.value ? "true" : void 0,
|
|
3392
|
+
"aria-describedby": ot.value ? `${ee(r)}-message` : void 0,
|
|
3393
|
+
readonly: Q.value.active && Q.value.mode === "view" ? !0 : void 0,
|
|
3379
3394
|
autocomplete: "off",
|
|
3380
3395
|
autocapitalize: "off",
|
|
3381
3396
|
spellcheck: "false",
|
|
3382
3397
|
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
|
-
|
|
3398
|
+
style: Be(Xo.value),
|
|
3399
|
+
onKeydown: Do,
|
|
3400
|
+
onCompositionstart: Go,
|
|
3401
|
+
onCompositionend: Uo,
|
|
3402
|
+
onInput: f[0] || (f[0] = (x) => ee(F).input()),
|
|
3403
|
+
onBlur: f[1] || (f[1] = (x) => ee(F).blur()),
|
|
3404
|
+
onCopy: f[2] || (f[2] = (x) => nn(x, !1)),
|
|
3405
|
+
onCut: f[3] || (f[3] = (x) => nn(x, !0))
|
|
3406
|
+
}, null, 44, Gs),
|
|
3407
|
+
un.value ? (Ce(), we("span", {
|
|
3393
3408
|
key: 0,
|
|
3394
3409
|
"data-ui-grid-edit-hint": "",
|
|
3395
3410
|
"aria-hidden": "true",
|
|
3396
|
-
style: Be({ ...
|
|
3397
|
-
},
|
|
3398
|
-
|
|
3411
|
+
style: Be({ ...ee(qa)(nt.value), top: `${dn.value - ee(ut)}px` })
|
|
3412
|
+
}, ve(e.editHint), 5)) : Oe("", !0),
|
|
3413
|
+
ot.value ? (Ce(), we("div", {
|
|
3399
3414
|
key: 1,
|
|
3400
|
-
id: `${
|
|
3415
|
+
id: `${ee(r)}-message`,
|
|
3401
3416
|
"data-ui-grid-edit-message": "",
|
|
3402
|
-
style: Be({ ...
|
|
3403
|
-
},
|
|
3404
|
-
], 8,
|
|
3405
|
-
], 8,
|
|
3417
|
+
style: Be({ ...ee(Xa)(nt.value), top: `${dn.value + 4}px` })
|
|
3418
|
+
}, ve(ot.value), 13, Us)) : Oe("", !0)
|
|
3419
|
+
], 8, Os)
|
|
3420
|
+
], 8, Ws)
|
|
3406
3421
|
]),
|
|
3407
|
-
|
|
3422
|
+
z.value ? (Ce(), we("div", {
|
|
3408
3423
|
key: 0,
|
|
3409
3424
|
"data-ui-grid-empty": "",
|
|
3410
|
-
style: Be([{ top: `${
|
|
3425
|
+
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
3426
|
}, [
|
|
3412
|
-
|
|
3413
|
-
|
|
3427
|
+
mn(d.$slots, "empty", {}, () => [
|
|
3428
|
+
oi(ve(ee(s)("No data")), 1)
|
|
3414
3429
|
])
|
|
3415
3430
|
], 4)) : Oe("", !0),
|
|
3416
|
-
e.loading ? (
|
|
3417
|
-
d.$slots.overlay ? (
|
|
3418
|
-
|
|
3419
|
-
activeCell:
|
|
3420
|
-
getCellRect:
|
|
3431
|
+
e.loading ? (Ce(), we("span", Ks, ve(ee(s)("Loading")), 1)) : Oe("", !0),
|
|
3432
|
+
d.$slots.overlay ? (Ce(), we("div", _s, [
|
|
3433
|
+
mn(d.$slots, "overlay", {
|
|
3434
|
+
activeCell: j.value,
|
|
3435
|
+
getCellRect: cn
|
|
3421
3436
|
})
|
|
3422
3437
|
])) : Oe("", !0)
|
|
3423
|
-
], 40,
|
|
3438
|
+
], 40, Hs));
|
|
3424
3439
|
}
|
|
3425
|
-
}),
|
|
3426
|
-
const n = new
|
|
3440
|
+
}), Zs = (e, t = 500) => {
|
|
3441
|
+
const n = new dt(t);
|
|
3427
3442
|
let o = !1;
|
|
3428
3443
|
const i = () => {
|
|
3429
3444
|
if (o) return;
|
|
@@ -3438,20 +3453,20 @@ const Ps = () => {
|
|
|
3438
3453
|
const s = n.get(a);
|
|
3439
3454
|
if (s) return s.ready ? s.image : void 0;
|
|
3440
3455
|
if (typeof Image > "u") return;
|
|
3441
|
-
const r = new Image(),
|
|
3456
|
+
const r = new Image(), l = { image: r, ready: !1 };
|
|
3442
3457
|
r.decoding = "async", r.onload = () => {
|
|
3443
|
-
|
|
3444
|
-
}, r.src = a, n.set(a,
|
|
3458
|
+
l.ready = !0, i();
|
|
3459
|
+
}, r.src = a, n.set(a, l);
|
|
3445
3460
|
},
|
|
3446
3461
|
clear: () => n.clear()
|
|
3447
3462
|
};
|
|
3448
|
-
},
|
|
3449
|
-
function
|
|
3463
|
+
}, Kn = ["en", "zh-TW", "zh-CN", "ja", "ko", "de", "fr", "es", "it"], Js = /* @__PURE__ */ Symbol("syno-pkg-land-ui:locale"), _n = { enu: "en", cht: "zh-TW", chs: "zh-CN", jpn: "ja", krn: "ko", ger: "de", fre: "fr", spn: "es", ita: "it" };
|
|
3464
|
+
function $n(e) {
|
|
3450
3465
|
if (!e) return;
|
|
3451
3466
|
const n = e.trim().replaceAll("_", "-").toLowerCase();
|
|
3452
|
-
return
|
|
3467
|
+
return _n[n] ? _n[n] : n.startsWith("zh") ? /-(hant|tw|hk|mo)\b/.test(n) ? "zh-TW" : "zh-CN" : Kn.find((i) => i.toLowerCase() === n) ?? Kn.find((i) => i === n.split("-")[0]);
|
|
3453
3468
|
}
|
|
3454
|
-
function
|
|
3469
|
+
function er() {
|
|
3455
3470
|
if (typeof window > "u") return "en";
|
|
3456
3471
|
const e = window;
|
|
3457
3472
|
let t;
|
|
@@ -3460,90 +3475,90 @@ function Zs() {
|
|
|
3460
3475
|
} catch {
|
|
3461
3476
|
t = void 0;
|
|
3462
3477
|
}
|
|
3463
|
-
const n = typeof t == "string" ?
|
|
3478
|
+
const n = typeof t == "string" ? $n(t) : void 0;
|
|
3464
3479
|
if (n) return n;
|
|
3465
3480
|
const o = typeof navigator > "u" ? [] : navigator.languages?.length ? navigator.languages : [navigator.language];
|
|
3466
3481
|
for (const i of o) {
|
|
3467
|
-
const a =
|
|
3482
|
+
const a = $n(i);
|
|
3468
3483
|
if (a) return a;
|
|
3469
3484
|
}
|
|
3470
3485
|
return "en";
|
|
3471
3486
|
}
|
|
3472
|
-
function
|
|
3473
|
-
const t =
|
|
3487
|
+
function tr(e) {
|
|
3488
|
+
const t = ii(Js, null);
|
|
3474
3489
|
let n;
|
|
3475
|
-
return
|
|
3490
|
+
return U(() => e() ?? t?.value ?? (n ??= er()));
|
|
3476
3491
|
}
|
|
3477
|
-
function
|
|
3492
|
+
function xo(e, t) {
|
|
3478
3493
|
return e.replace(/\{(\w+)\}/g, (n, o) => String(t[o] ?? n));
|
|
3479
3494
|
}
|
|
3480
|
-
const _e = 4,
|
|
3495
|
+
const _e = 4, Ie = 6, nr = 4, Ae = 4, me = (e, t, n, o = "") => {
|
|
3481
3496
|
const i = `${o ? `${o} ` : ""}${t}px ${n}`;
|
|
3482
3497
|
e.font !== i && (e.font = i);
|
|
3483
|
-
}, Ee = (e, t, n) => $e(e, { text: t, fontSize: n, needRender: !1 }).width,
|
|
3498
|
+
}, Ee = (e, t, n) => $e(e, { text: t, fontSize: n, needRender: !1 }).width, or = (e) => {
|
|
3484
3499
|
const t = e.trim();
|
|
3485
3500
|
if (!t) return "";
|
|
3486
3501
|
if (typeof Intl < "u" && typeof Intl.Segmenter == "function")
|
|
3487
3502
|
for (const { segment: n } of new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(t)) return n.toLocaleUpperCase();
|
|
3488
3503
|
return Array.from(t)[0].toLocaleUpperCase();
|
|
3489
|
-
},
|
|
3504
|
+
}, ge = (e, t, n, o = {}) => {
|
|
3490
3505
|
if (!n) return 0;
|
|
3491
3506
|
const { metrics: i, theme: a } = t, s = o.fontSize ?? i.fontSize;
|
|
3492
|
-
|
|
3493
|
-
const r = o.x ?? t.x + i.padding,
|
|
3507
|
+
me(e, s, a.fontFamily);
|
|
3508
|
+
const r = o.x ?? t.x + i.padding, l = Math.max(0, o.maxWidth ?? t.x + t.width - i.padding - r);
|
|
3494
3509
|
return $e(e, {
|
|
3495
3510
|
text: n,
|
|
3496
3511
|
x: r,
|
|
3497
3512
|
y: t.y + (t.height - s) / 2,
|
|
3498
|
-
maxWidth:
|
|
3513
|
+
maxWidth: l,
|
|
3499
3514
|
fill: o.color ?? t.cellTheme.text,
|
|
3500
3515
|
fontSize: s,
|
|
3501
3516
|
textAlign: o.align ?? "left"
|
|
3502
3517
|
}).width;
|
|
3503
|
-
},
|
|
3518
|
+
}, Ro = (e, t, n, o, i) => {
|
|
3504
3519
|
const { metrics: a, theme: s } = t;
|
|
3505
|
-
D(e, { ...n, radius:
|
|
3520
|
+
D(e, { ...n, radius: nr, fill: i.fill }), me(e, a.chipFontSize, s.fontFamily), $e(e, {
|
|
3506
3521
|
text: o,
|
|
3507
|
-
x: n.x +
|
|
3522
|
+
x: n.x + Ie,
|
|
3508
3523
|
y: n.y + (n.height - a.chipFontSize) / 2,
|
|
3509
|
-
maxWidth: Math.max(0, n.width - 2 *
|
|
3524
|
+
maxWidth: Math.max(0, n.width - 2 * Ie),
|
|
3510
3525
|
fill: i.color,
|
|
3511
3526
|
fontSize: a.chipFontSize
|
|
3512
3527
|
});
|
|
3513
|
-
},
|
|
3528
|
+
}, _t = (e, t, n, o) => {
|
|
3514
3529
|
const i = [];
|
|
3515
3530
|
let a = 0;
|
|
3516
3531
|
for (let s = 0; s < e.length; s++) {
|
|
3517
|
-
const r = e.length - s - 1,
|
|
3518
|
-
if (a +
|
|
3519
|
-
i.push(
|
|
3532
|
+
const r = e.length - s - 1, l = r > 0 ? n(r) + _e : 0, c = e[s];
|
|
3533
|
+
if (a + c + l <= t) {
|
|
3534
|
+
i.push(c), a += c + _e;
|
|
3520
3535
|
continue;
|
|
3521
3536
|
}
|
|
3522
3537
|
if (s === 0) {
|
|
3523
|
-
const h = t -
|
|
3538
|
+
const h = t - l;
|
|
3524
3539
|
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
3540
|
}
|
|
3526
3541
|
const u = e.length - s;
|
|
3527
3542
|
return { widths: i, more: u, badgeWidth: n(u) };
|
|
3528
3543
|
}
|
|
3529
3544
|
return { widths: i, more: 0, badgeWidth: 0 };
|
|
3530
|
-
},
|
|
3545
|
+
}, $t = (e, t, n) => (me(e, t.metrics.chipFontSize, t.theme.fontFamily), Ee(e, `+${n}`, t.metrics.chipFontSize) + 2 * Ie), qt = (e, t, n, o, i) => {
|
|
3531
3546
|
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,
|
|
3547
|
+
Ro(e, t, { x: n, y: r, width: i, height: a.chip }, `+${o}`, { fill: s.badgeFill, color: s.badgeText });
|
|
3548
|
+
}, ir = (e, t, n, o, i) => {
|
|
3549
|
+
const a = t + o / 2, s = n + o / 2 + o * 0.04, r = o / 2, l = r * 0.45;
|
|
3535
3550
|
e.beginPath();
|
|
3536
|
-
for (let
|
|
3537
|
-
const u =
|
|
3538
|
-
|
|
3551
|
+
for (let c = 0; c < 10; c++) {
|
|
3552
|
+
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);
|
|
3553
|
+
c === 0 ? e.moveTo(m, g) : e.lineTo(m, g);
|
|
3539
3554
|
}
|
|
3540
3555
|
e.closePath(), e.fillStyle = i, e.fill();
|
|
3541
|
-
},
|
|
3556
|
+
}, ar = (e, t, n, o, i) => {
|
|
3542
3557
|
const a = o;
|
|
3543
3558
|
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
3559
|
};
|
|
3545
|
-
class
|
|
3546
|
-
cache = new
|
|
3560
|
+
class Xt {
|
|
3561
|
+
cache = new dt(200);
|
|
3547
3562
|
set(t, n) {
|
|
3548
3563
|
this.cache.set(t, n);
|
|
3549
3564
|
}
|
|
@@ -3554,71 +3569,71 @@ class qt {
|
|
|
3554
3569
|
this.cache.clear();
|
|
3555
3570
|
}
|
|
3556
3571
|
}
|
|
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,
|
|
3572
|
+
const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.y + t.height, sr = { type: "decimal", precision: 2 }, qn = (e, t) => {
|
|
3558
3573
|
if (!Number.isFinite(e) || Math.abs(e) <= Number.MAX_SAFE_INTEGER) return e.toFixed(t);
|
|
3559
3574
|
const n = String(e), o = n.includes("e") ? "" : "0".repeat(t);
|
|
3560
3575
|
return o ? `${n}.${o}` : n;
|
|
3561
|
-
},
|
|
3576
|
+
}, rr = (e, t = sr, n = "en-US") => {
|
|
3562
3577
|
if (e == null) return "";
|
|
3563
3578
|
const o = Number(e), i = t.precision ?? 2;
|
|
3564
3579
|
if (t.type === "currency") {
|
|
3565
3580
|
const a = t.symbol ?? "$", s = o < 0 ? "-" : "", r = Math.abs(o).toLocaleString(n, { minimumFractionDigits: i, maximumFractionDigits: i });
|
|
3566
3581
|
return s + a + r;
|
|
3567
3582
|
}
|
|
3568
|
-
return t.type === "percent" ? `${
|
|
3569
|
-
},
|
|
3583
|
+
return t.type === "percent" ? `${qn(o * 100, i)}%` : qn(o, i);
|
|
3584
|
+
}, Dr = (e, t) => {
|
|
3570
3585
|
if (e == null || e === "") return null;
|
|
3571
3586
|
const n = String(e), o = t?.type === "percent" || n.includes("%"), i = n.replace(/[^\d.+-]/g, "").replace(/([+\-.])+/g, "$1"), a = Number.parseFloat(i);
|
|
3572
3587
|
return Number.isNaN(a) ? null : o ? a / 100 : a;
|
|
3573
|
-
},
|
|
3588
|
+
}, mt = (e) => e.map(String).filter(Boolean).join(", "), lr = (e, t) => {
|
|
3574
3589
|
const n = t.chips[e.tone ?? "neutral"] ?? t.chips.neutral;
|
|
3575
3590
|
return { fill: e.fill ?? n.fill, color: e.color ?? n.color };
|
|
3576
|
-
},
|
|
3591
|
+
}, gt = (e) => Math.max(0, e.width - 2 * e.metrics.padding), cr = {
|
|
3577
3592
|
draw: (e, t, n) => {
|
|
3578
|
-
|
|
3593
|
+
ge(e, t, n.text);
|
|
3579
3594
|
},
|
|
3580
3595
|
describe: (e) => e.text
|
|
3581
|
-
},
|
|
3596
|
+
}, ur = {
|
|
3582
3597
|
draw: (e, t, n) => {
|
|
3583
|
-
|
|
3598
|
+
ge(e, t, n.text.replace(/\s*\n\s*/g, " "));
|
|
3584
3599
|
},
|
|
3585
3600
|
describe: (e) => e.text
|
|
3586
|
-
},
|
|
3601
|
+
}, dr = {
|
|
3587
3602
|
draw: (e, t, n) => {
|
|
3588
|
-
|
|
3603
|
+
ge(e, t, n.text);
|
|
3589
3604
|
},
|
|
3590
3605
|
describe: (e) => e.text
|
|
3591
|
-
},
|
|
3606
|
+
}, hr = {
|
|
3592
3607
|
draw: (e, t, n) => {
|
|
3593
|
-
|
|
3608
|
+
ge(e, t, n.text, { color: t.cellTheme.textMuted, align: n.align === "end" ? "right" : "left" });
|
|
3594
3609
|
},
|
|
3595
3610
|
describe: (e) => e.text
|
|
3596
|
-
},
|
|
3611
|
+
}, Xn = (e, t) => e.text ?? rr(e.value, e.format, t), mr = {
|
|
3597
3612
|
draw: (e, t, n) => {
|
|
3598
|
-
|
|
3613
|
+
ge(e, t, Xn(n, t.locale), { align: "right" });
|
|
3599
3614
|
},
|
|
3600
|
-
describe: (e, t) =>
|
|
3601
|
-
},
|
|
3615
|
+
describe: (e, t) => Xn(e, t.locale)
|
|
3616
|
+
}, Yn = (e, t, n) => {
|
|
3602
3617
|
const o = n.icon;
|
|
3603
3618
|
return { x: e - n.padding - o, y: (t - o) / 2, width: o, height: o };
|
|
3604
|
-
},
|
|
3619
|
+
}, gr = {
|
|
3605
3620
|
draw: (e, t, n) => {
|
|
3606
|
-
const { metrics: o, cellTheme: i } = t, a =
|
|
3607
|
-
n.text && (
|
|
3621
|
+
const { metrics: o, cellTheme: i } = t, a = Yn(t.width, t.height, o);
|
|
3622
|
+
n.text && (ge(e, t, n.text, { color: i.link, maxWidth: Math.max(0, a.x - Ae - o.padding) }), ar(e, t.x + a.x, t.y + a.y, a.width, i.link));
|
|
3608
3623
|
},
|
|
3609
3624
|
describe: (e) => e.text,
|
|
3610
3625
|
hitTest: (e, { point: t, size: n, metrics: o }) => {
|
|
3611
3626
|
if (!e.text || !e.href) return null;
|
|
3612
|
-
const i =
|
|
3627
|
+
const i = Yn(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
3628
|
return Xe(t, a) ? { action: { type: "open-url", href: e.href }, area: a } : null;
|
|
3614
3629
|
}
|
|
3615
|
-
},
|
|
3630
|
+
}, jn = (e, t, n) => {
|
|
3616
3631
|
const o = n.icon;
|
|
3617
3632
|
return { x: e / 2 - o / 2, y: t / 2 - o / 2, width: o, height: o };
|
|
3618
|
-
},
|
|
3633
|
+
}, Qn = (e) => ({ type: "update", value: !e.value }), fr = {
|
|
3619
3634
|
draw: (e, t, n) => {
|
|
3620
|
-
const { cellTheme: o, metrics: i } = t, a =
|
|
3621
|
-
|
|
3635
|
+
const { cellTheme: o, metrics: i } = t, a = jn(t.width, t.height, i);
|
|
3636
|
+
Ot(e, {
|
|
3622
3637
|
x: t.x + a.x,
|
|
3623
3638
|
y: t.y + a.y,
|
|
3624
3639
|
size: a.width,
|
|
@@ -3632,22 +3647,22 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3632
3647
|
// The icon box is hit exactly, plus 4 px around it (a 24 px target at 16 px).
|
|
3633
3648
|
hitTest: (e, { point: t, size: n, metrics: o }) => {
|
|
3634
3649
|
if (e.readonly) return null;
|
|
3635
|
-
const i =
|
|
3636
|
-
return Xe(t, a) ? { action:
|
|
3650
|
+
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) };
|
|
3651
|
+
return Xe(t, a) ? { action: Qn(e), area: a } : null;
|
|
3637
3652
|
},
|
|
3638
|
-
keyAction: (e, t) => !e.readonly && (t === "Enter" || t === " ") ?
|
|
3639
|
-
},
|
|
3653
|
+
keyAction: (e, t) => !e.readonly && (t === "Enter" || t === " ") ? Qn(e) : null
|
|
3654
|
+
}, Et = 2, lt = (e) => Math.max(1, Math.min(10, Math.round(e.max ?? 5))), pr = {
|
|
3640
3655
|
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
|
-
|
|
3656
|
+
const { metrics: o, cellTheme: i } = t, a = o.icon, s = t.y + (t.height - a) / 2, r = lt(n);
|
|
3657
|
+
let l = t.x + o.padding;
|
|
3658
|
+
for (let c = 0; c < r && l + a <= t.x + t.width - o.padding + Et; c++)
|
|
3659
|
+
ir(e, l, s, a, n.value > c ? i.ratingOn : i.ratingOff), l += a + Et;
|
|
3645
3660
|
},
|
|
3646
|
-
describe: (e, { labels: t }) => e.value > 0 ?
|
|
3661
|
+
describe: (e, { labels: t }) => e.value > 0 ? xo(t.rating, { value: e.value, max: lt(e) }) : "",
|
|
3647
3662
|
// Click the n-th star: value n; click the current value again: clear.
|
|
3648
3663
|
hitTest: (e, { point: t, size: n, metrics: o }) => {
|
|
3649
3664
|
if (e.readonly) return null;
|
|
3650
|
-
const i = o.icon +
|
|
3665
|
+
const i = o.icon + Et, 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
3666
|
if (!Xe(t, s)) return null;
|
|
3652
3667
|
const r = Math.min(a, Math.max(1, Math.ceil((t.x - o.padding) / i)));
|
|
3653
3668
|
return { action: { type: "update", value: r !== e.value ? r : null }, area: s };
|
|
@@ -3657,145 +3672,145 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3657
3672
|
if (e.readonly) return null;
|
|
3658
3673
|
if (t === "Backspace") return { type: "update", value: null };
|
|
3659
3674
|
if (!/^\d$/.test(t)) return null;
|
|
3660
|
-
const n = Math.min(
|
|
3675
|
+
const n = Math.min(lt(e), Number(t));
|
|
3661
3676
|
return { type: "update", value: n === 0 || n === e.value ? null : n };
|
|
3662
3677
|
}
|
|
3663
|
-
}, He = (e, t, n) => `${e}|${t.width}|${t.metrics.rowHeight}|${n.join("\0")}`, Ft = new
|
|
3678
|
+
}, He = (e, t, n) => `${e}|${t.width}|${t.metrics.rowHeight}|${n.join("\0")}`, Ft = new Xt(), ko = (e, t, n) => {
|
|
3664
3679
|
const { metrics: o, theme: i } = t;
|
|
3665
3680
|
if (!n.length) return [];
|
|
3666
|
-
|
|
3667
|
-
const a = n.map((h) => Ee(e, h.label, o.chipFontSize) + 2 *
|
|
3668
|
-
let
|
|
3681
|
+
me(e, o.chipFontSize, i.fontFamily);
|
|
3682
|
+
const a = n.map((h) => Ee(e, h.label, o.chipFontSize) + 2 * Ie), s = 2 * Ie + Ee(e, "…", o.chipFontSize) + o.chipFontSize, r = _t(a, gt(t), (h) => $t(e, t, h), s), l = t.y + (t.height - o.chip) / 2;
|
|
3683
|
+
let c = t.x + o.padding;
|
|
3669
3684
|
const u = [];
|
|
3670
3685
|
return r.widths.forEach((h, m) => {
|
|
3671
|
-
const g = { x:
|
|
3672
|
-
|
|
3673
|
-
}), r.more > 0 &&
|
|
3674
|
-
},
|
|
3686
|
+
const g = { x: c, y: l, width: h, height: o.chip };
|
|
3687
|
+
Ro(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;
|
|
3688
|
+
}), r.more > 0 && qt(e, t, c, r.more, r.badgeWidth), u;
|
|
3689
|
+
}, Cr = {
|
|
3675
3690
|
draw: (e, t, n) => {
|
|
3676
|
-
|
|
3691
|
+
ko(e, t, n.options.map((o) => ({ label: o.label, colors: lr(o, t.cellTheme) })));
|
|
3677
3692
|
},
|
|
3678
|
-
describe: (e) =>
|
|
3679
|
-
},
|
|
3693
|
+
describe: (e) => mt(e.options.map((t) => t.label))
|
|
3694
|
+
}, wr = {
|
|
3680
3695
|
draw: (e, t, n) => {
|
|
3681
|
-
const o = { fill: t.cellTheme.badgeFill, color: t.cellTheme.text }, i =
|
|
3696
|
+
const o = { fill: t.cellTheme.badgeFill, color: t.cellTheme.text }, i = ko(e, t, n.records.map((a) => ({ label: a.label, colors: o })));
|
|
3682
3697
|
Ft.set(He("link", t, n.records.map((a) => a.id)), i);
|
|
3683
3698
|
},
|
|
3684
|
-
describe: (e) =>
|
|
3685
|
-
hitTest: (e, t) =>
|
|
3686
|
-
},
|
|
3699
|
+
describe: (e) => mt(e.records.map((t) => t.label)),
|
|
3700
|
+
hitTest: (e, t) => Io(Ft.get(He("link", Yt(t), e.records.map((n) => n.id))), t, (n) => ({ type: "open-record", id: e.records[n].id }))
|
|
3701
|
+
}, Yt = (e) => ({ width: e.size.width, metrics: e.metrics }), Io = (e, t, n, o = !1) => {
|
|
3687
3702
|
if (!t.wasActive && !o || !e) return null;
|
|
3688
3703
|
const i = e.findIndex((a) => Xe(t.point, a));
|
|
3689
3704
|
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(
|
|
3705
|
+
}, vr = (e, t, n, o, i, a, s) => {
|
|
3706
|
+
const { cellTheme: r, theme: l } = t, c = s ? t.images.get(s) : void 0;
|
|
3707
|
+
if (e.save(), e.beginPath(), e.arc(n + i / 2, o + i / 2, i / 2, 0, Math.PI * 2), e.closePath(), c)
|
|
3708
|
+
e.clip(), e.drawImage(c, n, o, i, i);
|
|
3694
3709
|
else {
|
|
3695
3710
|
e.fillStyle = r.avatarFill, e.fill();
|
|
3696
|
-
const u =
|
|
3711
|
+
const u = or(a);
|
|
3697
3712
|
if (u) {
|
|
3698
3713
|
const h = Math.round(i * 0.55);
|
|
3699
|
-
|
|
3714
|
+
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
3715
|
}
|
|
3701
3716
|
}
|
|
3702
3717
|
e.restore();
|
|
3703
|
-
},
|
|
3718
|
+
}, Sr = {
|
|
3704
3719
|
draw: (e, t, n) => {
|
|
3705
3720
|
const { metrics: o, theme: i } = t;
|
|
3706
3721
|
if (!n.people.length) return;
|
|
3707
3722
|
const a = o.chip;
|
|
3708
|
-
|
|
3709
|
-
const s = n.people.map((u) => a + Ae + Ee(e, u.name, o.fontSize) +
|
|
3710
|
-
let
|
|
3723
|
+
me(e, o.fontSize, i.fontFamily);
|
|
3724
|
+
const s = n.people.map((u) => a + Ae + Ee(e, u.name, o.fontSize) + Ie), r = _t(s, gt(t), (u) => $t(e, t, u), a), l = t.y + (t.height - a) / 2;
|
|
3725
|
+
let c = t.x + o.padding;
|
|
3711
3726
|
r.widths.forEach((u, h) => {
|
|
3712
3727
|
const m = n.people[h];
|
|
3713
|
-
|
|
3714
|
-
}), r.more > 0 &&
|
|
3728
|
+
vr(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;
|
|
3729
|
+
}), r.more > 0 && qt(e, t, c, r.more, r.badgeWidth);
|
|
3715
3730
|
},
|
|
3716
|
-
describe: (e) =>
|
|
3717
|
-
},
|
|
3731
|
+
describe: (e) => mt(e.people.map((t) => t.name))
|
|
3732
|
+
}, Zn = (e) => {
|
|
3718
3733
|
const t = /\.([\p{L}\p{N}]{1,5})$/u.exec(e);
|
|
3719
3734
|
return t ? t[1].toUpperCase() : "";
|
|
3720
|
-
},
|
|
3735
|
+
}, Dt = new Xt(), yr = {
|
|
3721
3736
|
draw: (e, t, n) => {
|
|
3722
3737
|
const { metrics: o, cellTheme: i, theme: a } = t;
|
|
3723
3738
|
if (!n.files.length) return;
|
|
3724
3739
|
const s = o.chip, r = Math.max(8, Math.round(s * 0.42));
|
|
3725
|
-
|
|
3726
|
-
const
|
|
3740
|
+
me(e, r, a.fontFamily, "600");
|
|
3741
|
+
const l = n.files.map((g) => (g.thumbnailUrl ? t.images.get(g.thumbnailUrl) : void 0) ? s : Math.max(s, Ee(e, Zn(g.name) || "?", r) + 6)), c = _t(l, gt(t), (g) => $t(e, t, g), s), u = t.y + (t.height - s) / 2;
|
|
3727
3742
|
let h = t.x + o.padding;
|
|
3728
3743
|
const m = [];
|
|
3729
|
-
|
|
3744
|
+
c.widths.forEach((g, C) => {
|
|
3730
3745
|
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
|
-
}),
|
|
3746
|
+
p ? (e.save(), D(e, { x: h, y: u, width: g, height: s, radius: 3 }), e.clip(), e.drawImage(p, h, u, g, s), e.restore(), D(e, { x: h + 0.5, y: u + 0.5, width: g - 1, height: s - 1, radius: 3, stroke: a.cellLineColor })) : (D(e, { x: h, y: u, width: g, height: s, radius: 3, fill: i.badgeFill }), me(e, r, a.fontFamily, "600"), e.fillStyle = i.badgeText, e.textAlign = "center", e.textBaseline = "middle", e.fillText(Zn(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;
|
|
3747
|
+
}), c.more > 0 && qt(e, t, h, c.more, c.badgeWidth), Dt.set(He("attachment", t, n.files.map((g) => g.id)), m);
|
|
3733
3748
|
},
|
|
3734
|
-
describe: (e) =>
|
|
3735
|
-
hitTest: (e, t) =>
|
|
3736
|
-
},
|
|
3749
|
+
describe: (e) => mt(e.files.map((t) => t.name)),
|
|
3750
|
+
hitTest: (e, t) => Io(Dt.get(He("attachment", Yt(t), e.files.map((n) => n.id))), t, (n) => ({ type: "open-attachment", id: e.files[n].id }), !0)
|
|
3751
|
+
}, Jn = (e) => `${Math.round(Math.max(0, Math.min(1, e)) * 100)}%`, br = {
|
|
3737
3752
|
draw: (e, t, n) => {
|
|
3738
3753
|
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,
|
|
3754
|
+
const { metrics: o, cellTheme: i } = t, a = o.icon, s = Math.max(0, Math.min(1, n.value)), r = t.x + o.padding + a / 2, l = t.y + t.height / 2, c = a / 2 - 1.25;
|
|
3755
|
+
e.save(), e.lineWidth = 2.5, e.beginPath(), e.arc(r, l, c, 0, Math.PI * 2), e.strokeStyle = i.progressTrack, e.stroke(), s > 0 && (e.beginPath(), e.arc(r, l, c, -Math.PI / 2, -Math.PI / 2 + s * Math.PI * 2), e.strokeStyle = i.progressFill, e.lineCap = s < 1 ? "round" : "butt", e.stroke()), e.restore(), ge(e, t, Jn(s), { x: t.x + o.padding + a + Ae + 2 });
|
|
3741
3756
|
},
|
|
3742
|
-
describe: (e) => e.value == null ? "" :
|
|
3743
|
-
},
|
|
3757
|
+
describe: (e) => e.value == null ? "" : Jn(e.value)
|
|
3758
|
+
}, Ht = 10, Wt = new Xt(), xr = {
|
|
3744
3759
|
draw: (e, t, n) => {
|
|
3745
3760
|
const { metrics: o, cellTheme: i, theme: a } = t;
|
|
3746
3761
|
if (!n.label) return;
|
|
3747
|
-
|
|
3748
|
-
const s = Math.min(
|
|
3749
|
-
D(e, { ...r, radius:
|
|
3762
|
+
me(e, o.chipFontSize, a.fontFamily);
|
|
3763
|
+
const s = Math.min(gt(t), Ee(e, n.label, o.chipFontSize) + 2 * Ht), r = { x: t.x + o.padding, y: t.y + (t.height - o.chip) / 2, width: s, height: o.chip };
|
|
3764
|
+
D(e, { ...r, radius: eo, fill: i.buttonFill }), D(e, { x: r.x + 0.5, y: r.y + 0.5, width: r.width - 1, height: r.height - 1, radius: eo, stroke: i.buttonBorder }), n.disabled && (e.globalAlpha = 0.5), ge(e, t, n.label, { x: r.x + Ht, maxWidth: s - 2 * Ht, color: i.buttonText, fontSize: o.chipFontSize }), e.globalAlpha = 1, Wt.set(He("button", t, [n.label]), [{ x: r.x - t.x, y: r.y - t.y, width: s, height: o.chip }]);
|
|
3750
3765
|
},
|
|
3751
3766
|
describe: (e) => e.label,
|
|
3752
3767
|
hitTest: (e, t) => {
|
|
3753
3768
|
if (e.disabled || !e.label) return null;
|
|
3754
|
-
const n =
|
|
3769
|
+
const n = Wt.get(He("button", Yt(t), [e.label]))?.[0];
|
|
3755
3770
|
return n && Xe(t.point, n) ? { action: { type: "press" }, area: n } : null;
|
|
3756
3771
|
},
|
|
3757
3772
|
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
|
-
Ft.clear(),
|
|
3775
|
-
},
|
|
3773
|
+
}, eo = 4, Rr = {
|
|
3774
|
+
text: cr,
|
|
3775
|
+
longText: ur,
|
|
3776
|
+
number: mr,
|
|
3777
|
+
select: Cr,
|
|
3778
|
+
person: Sr,
|
|
3779
|
+
date: dr,
|
|
3780
|
+
boolean: fr,
|
|
3781
|
+
rating: pr,
|
|
3782
|
+
url: gr,
|
|
3783
|
+
link: wr,
|
|
3784
|
+
attachment: yr,
|
|
3785
|
+
progress: br,
|
|
3786
|
+
button: xr,
|
|
3787
|
+
derived: hr
|
|
3788
|
+
}, Wr = () => {
|
|
3789
|
+
Ft.clear(), Dt.clear(), Wt.clear();
|
|
3790
|
+
}, kr = 6, Ir = (e, t, n, o) => {
|
|
3776
3791
|
if (e.save(), n === "pending") {
|
|
3777
|
-
const i =
|
|
3792
|
+
const i = kr / 2, a = t.x + t.width - 3 - i, s = t.y + 3 + i;
|
|
3778
3793
|
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
3794
|
} else
|
|
3780
3795
|
e.lineWidth = 2, e.strokeStyle = o.danger, e.strokeRect(t.x + 1, t.y + 1, t.width - 2, t.height - 2);
|
|
3781
3796
|
e.restore();
|
|
3782
|
-
},
|
|
3783
|
-
const t = { ...
|
|
3797
|
+
}, to = (e, t) => !!e && !!t && e[0] === t[0] && e[1] === t[1], Pr = (e) => {
|
|
3798
|
+
const t = { ...Rr, ...e.renderers }, n = e.locale ?? "en-US";
|
|
3784
3799
|
let o = e.labels, i = e.theme ?? Ue, a = null, s = null;
|
|
3785
|
-
const r =
|
|
3800
|
+
const r = Zs(() => e.onImageLoad?.()), l = (p) => ((!s || s.rowHeight !== p.height || s.fontSize !== p.theme.fontSizeSM || s.chipFontSize > p.theme.fontSizeXS) && (s = Wn(p.height, p.theme.fontSizeSM, p.theme.fontSizeXS)), s), c = (p) => {
|
|
3786
3801
|
if (e.theme || a === p.theme) return;
|
|
3787
3802
|
a = p.theme;
|
|
3788
3803
|
const w = e.themeRoot?.();
|
|
3789
|
-
w && (i =
|
|
3804
|
+
w && (i = yo(w));
|
|
3790
3805
|
}, u = {
|
|
3791
3806
|
draw: (p, w) => {
|
|
3792
3807
|
const v = e.getValue(w.cell);
|
|
3793
|
-
if (
|
|
3808
|
+
if (c(w), v) {
|
|
3794
3809
|
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:
|
|
3810
|
+
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
3811
|
}
|
|
3797
3812
|
const y = e.getStatus?.(w.cell);
|
|
3798
|
-
y &&
|
|
3813
|
+
y && Ir(p, w, y, i);
|
|
3799
3814
|
}
|
|
3800
3815
|
}, h = (p, w) => w?.type === "update" && e.isReadonly?.(p) ? null : w, m = (p) => {
|
|
3801
3816
|
const w = e.getValue(p), v = w ? t[w.kind]?.describe(w, { labels: o, locale: n }) ?? "" : "", y = e.getStatus?.(p);
|
|
@@ -3805,7 +3820,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3805
3820
|
}, g = (p, w, v, y) => {
|
|
3806
3821
|
const R = e.getValue(p), I = R ? t[R.kind] : void 0;
|
|
3807
3822
|
if (!R || !I?.hitTest) return null;
|
|
3808
|
-
const k = I.hitTest(R, { point: w, size: { width: v.width, height: v.height }, metrics:
|
|
3823
|
+
const k = I.hitTest(R, { point: w, size: { width: v.width, height: v.height }, metrics: Wn(v.height), wasActive: y });
|
|
3809
3824
|
return k && h(p, k.action) ? k : null;
|
|
3810
3825
|
};
|
|
3811
3826
|
return {
|
|
@@ -3827,12 +3842,12 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3827
3842
|
const R = p();
|
|
3828
3843
|
if (!R || y.button !== 0 || y.shiftKey || y.metaKey || y.ctrlKey) return;
|
|
3829
3844
|
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,
|
|
3845
|
+
if (!k || I.kind !== "cells" || !to(I.ranges[0], I.ranges[1])) return;
|
|
3846
|
+
const P = y.currentTarget?.querySelector("[data-ui-grid]"), M = R.getCellRect(k);
|
|
3847
|
+
if (!P || !M) return;
|
|
3848
|
+
const N = P.getBoundingClientRect(), z = { x: y.clientX - N.left - M.x, y: y.clientY - N.top - M.y };
|
|
3849
|
+
if (z.x < 0 || z.y < 0 || z.x >= M.width || z.y >= M.height) return;
|
|
3850
|
+
const E = g(k, z, M, to(v, k));
|
|
3836
3851
|
E && w(E.action, k);
|
|
3837
3852
|
}
|
|
3838
3853
|
};
|
|
@@ -3845,7 +3860,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3845
3860
|
},
|
|
3846
3861
|
clearImages: () => r.clear()
|
|
3847
3862
|
};
|
|
3848
|
-
},
|
|
3863
|
+
}, zr = {
|
|
3849
3864
|
"{count} failed": "{count} failed",
|
|
3850
3865
|
"{name} is not a JPEG, PNG, WebP or GIF image": "{name} is not a JPEG, PNG, WebP or GIF image",
|
|
3851
3866
|
"{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",
|
|
@@ -3952,7 +3967,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
3952
3967
|
"Free now {now}, free after {after}": "Free now {now}, free after {after}",
|
|
3953
3968
|
Sections: "Sections",
|
|
3954
3969
|
"Back to the previous page": "Back",
|
|
3955
|
-
"
|
|
3970
|
+
"Launcher home": "Home",
|
|
3956
3971
|
"Page actions": "Page actions",
|
|
3957
3972
|
Slider: "Slider",
|
|
3958
3973
|
"Increase value": "Increase value",
|
|
@@ -4117,8 +4132,8 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
4117
4132
|
"At most {max} tags": "At most {max} tags",
|
|
4118
4133
|
"Expand all": "Expand all",
|
|
4119
4134
|
"Collapse all": "Collapse all"
|
|
4120
|
-
},
|
|
4121
|
-
en:
|
|
4135
|
+
}, Mr = {
|
|
4136
|
+
en: zr,
|
|
4122
4137
|
"zh-TW": {
|
|
4123
4138
|
"{count} failed": "{count} 個失敗",
|
|
4124
4139
|
"{name} is not a JPEG, PNG, WebP or GIF image": "{name} 不是 JPEG、PNG、WebP 或 GIF 圖片",
|
|
@@ -4226,7 +4241,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
4226
4241
|
"Free now {now}, free after {after}": "目前可用 {now},清理後可用 {after}",
|
|
4227
4242
|
Sections: "區段",
|
|
4228
4243
|
"Back to the previous page": "返回",
|
|
4229
|
-
"
|
|
4244
|
+
"Launcher home": "主畫面",
|
|
4230
4245
|
"Page actions": "頁面動作",
|
|
4231
4246
|
Slider: "滑桿",
|
|
4232
4247
|
"Increase value": "增加數值",
|
|
@@ -4499,7 +4514,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
4499
4514
|
"Free now {now}, free after {after}": "当前可用 {now},清理后可用 {after}",
|
|
4500
4515
|
Sections: "区段",
|
|
4501
4516
|
"Back to the previous page": "返回",
|
|
4502
|
-
"
|
|
4517
|
+
"Launcher home": "主屏幕",
|
|
4503
4518
|
"Page actions": "页面操作",
|
|
4504
4519
|
Slider: "滑块",
|
|
4505
4520
|
"Increase value": "增加数值",
|
|
@@ -4772,7 +4787,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
4772
4787
|
"Free now {now}, free after {after}": "現在の空き {now}、解放後の空き {after}",
|
|
4773
4788
|
Sections: "セクション",
|
|
4774
4789
|
"Back to the previous page": "戻る",
|
|
4775
|
-
"
|
|
4790
|
+
"Launcher home": "ホーム",
|
|
4776
4791
|
"Page actions": "ページの操作",
|
|
4777
4792
|
Slider: "スライダー",
|
|
4778
4793
|
"Increase value": "値を増やす",
|
|
@@ -5045,7 +5060,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
5045
5060
|
"Free now {now}, free after {after}": "현재 여유 공간 {now}, 정리 후 여유 공간 {after}",
|
|
5046
5061
|
Sections: "섹션",
|
|
5047
5062
|
"Back to the previous page": "뒤로",
|
|
5048
|
-
"
|
|
5063
|
+
"Launcher home": "홈",
|
|
5049
5064
|
"Page actions": "페이지 작업",
|
|
5050
5065
|
Slider: "슬라이더",
|
|
5051
5066
|
"Increase value": "값 증가",
|
|
@@ -5318,7 +5333,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
5318
5333
|
"Free now {now}, free after {after}": "Jetzt frei {now}, danach frei {after}",
|
|
5319
5334
|
Sections: "Abschnitte",
|
|
5320
5335
|
"Back to the previous page": "Zurück",
|
|
5321
|
-
"
|
|
5336
|
+
"Launcher home": "Startseite",
|
|
5322
5337
|
"Page actions": "Seitenaktionen",
|
|
5323
5338
|
Slider: "Schieberegler",
|
|
5324
5339
|
"Increase value": "Wert erhöhen",
|
|
@@ -5591,7 +5606,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
5591
5606
|
"Free now {now}, free after {after}": "Libre maintenant {now}, libre ensuite {after}",
|
|
5592
5607
|
Sections: "Sections",
|
|
5593
5608
|
"Back to the previous page": "Retour",
|
|
5594
|
-
"
|
|
5609
|
+
"Launcher home": "Accueil",
|
|
5595
5610
|
"Page actions": "Actions de la page",
|
|
5596
5611
|
Slider: "Curseur",
|
|
5597
5612
|
"Increase value": "Augmenter la valeur",
|
|
@@ -5864,7 +5879,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
5864
5879
|
"Free now {now}, free after {after}": "Libre ahora {now}, libre después {after}",
|
|
5865
5880
|
Sections: "Secciones",
|
|
5866
5881
|
"Back to the previous page": "Atrás",
|
|
5867
|
-
"
|
|
5882
|
+
"Launcher home": "Inicio",
|
|
5868
5883
|
"Page actions": "Acciones de la página",
|
|
5869
5884
|
Slider: "Control deslizante",
|
|
5870
5885
|
"Increase value": "Aumentar valor",
|
|
@@ -6137,7 +6152,7 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
6137
6152
|
"Free now {now}, free after {after}": "Libero ora {now}, libero dopo {after}",
|
|
6138
6153
|
Sections: "Sezioni",
|
|
6139
6154
|
"Back to the previous page": "Indietro",
|
|
6140
|
-
"
|
|
6155
|
+
"Launcher home": "Home",
|
|
6141
6156
|
"Page actions": "Azioni della pagina",
|
|
6142
6157
|
Slider: "Cursore",
|
|
6143
6158
|
"Increase value": "Aumenta valore",
|
|
@@ -6304,96 +6319,96 @@ const Xe = (e, t) => e.x >= t.x && e.x < t.x + t.width && e.y >= t.y && e.y < t.
|
|
|
6304
6319
|
"Collapse all": "Comprimi tutto"
|
|
6305
6320
|
}
|
|
6306
6321
|
};
|
|
6307
|
-
function
|
|
6308
|
-
return
|
|
6322
|
+
function Ar(e, t, n = {}) {
|
|
6323
|
+
return xo(Mr[e][t], n);
|
|
6309
6324
|
}
|
|
6310
|
-
function
|
|
6311
|
-
const e =
|
|
6325
|
+
function Er() {
|
|
6326
|
+
const e = tr(() => {
|
|
6312
6327
|
});
|
|
6313
|
-
return (t, n) =>
|
|
6328
|
+
return (t, n) => Ar(e.value, t, n);
|
|
6314
6329
|
}
|
|
6315
|
-
const
|
|
6316
|
-
const t =
|
|
6330
|
+
const Br = (e) => {
|
|
6331
|
+
const t = Er(), n = U(() => ({
|
|
6317
6332
|
checked: t("Checked"),
|
|
6318
6333
|
unchecked: t("Not checked"),
|
|
6319
6334
|
rating: t("Rating {value} of {max}", { value: "{value}", max: "{max}" }),
|
|
6320
6335
|
saving: t("Saving"),
|
|
6321
6336
|
failed: t("Not saved"),
|
|
6322
6337
|
...e.labels
|
|
6323
|
-
})), o =
|
|
6324
|
-
return
|
|
6325
|
-
},
|
|
6326
|
-
function
|
|
6327
|
-
const t = e.delayMs ??
|
|
6338
|
+
})), o = Pr({ ...e, labels: n.value });
|
|
6339
|
+
return de(n, (i) => o.setLabels(i)), o;
|
|
6340
|
+
}, Hr = 300;
|
|
6341
|
+
function Or(e) {
|
|
6342
|
+
const t = e.delayMs ?? Hr, n = e.setTimer ?? ((c, u) => setTimeout(c, u)), o = e.clearTimer ?? ((c) => clearTimeout(c)), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
6328
6343
|
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(
|
|
6344
|
+
const r = (c, u) => {
|
|
6345
|
+
const h = i.get(c);
|
|
6346
|
+
u ? i.set(c, u) : i.delete(c), h === u || h?.state === u?.state && (h?.state !== "error" || h.message === u.message) || e.onChange();
|
|
6347
|
+
}, l = (c) => {
|
|
6348
|
+
const u = a.get(c);
|
|
6349
|
+
u && o(u.timer), a.delete(c);
|
|
6335
6350
|
};
|
|
6336
6351
|
return {
|
|
6337
|
-
get: (
|
|
6338
|
-
track(
|
|
6339
|
-
c
|
|
6340
|
-
const u = ++s, h = () => a.get(
|
|
6341
|
-
return i.get(
|
|
6342
|
-
h() && r(
|
|
6352
|
+
get: (c) => i.get(c) ?? null,
|
|
6353
|
+
track(c) {
|
|
6354
|
+
l(c);
|
|
6355
|
+
const u = ++s, h = () => a.get(c)?.id === u;
|
|
6356
|
+
return i.get(c)?.state === "error" && r(c, null), a.set(c, { id: u, timer: n(() => {
|
|
6357
|
+
h() && r(c, { state: "saving" });
|
|
6343
6358
|
}, t) }), {
|
|
6344
6359
|
done() {
|
|
6345
|
-
h() && (c
|
|
6360
|
+
h() && (l(c), r(c, null));
|
|
6346
6361
|
},
|
|
6347
6362
|
fail(m) {
|
|
6348
|
-
h() && (c
|
|
6363
|
+
h() && (l(c), r(c, { state: "error", message: m }));
|
|
6349
6364
|
}
|
|
6350
6365
|
};
|
|
6351
6366
|
},
|
|
6352
|
-
fail(
|
|
6353
|
-
c
|
|
6367
|
+
fail(c, u) {
|
|
6368
|
+
l(c), r(c, { state: "error", message: u });
|
|
6354
6369
|
},
|
|
6355
|
-
clear(
|
|
6356
|
-
c
|
|
6370
|
+
clear(c) {
|
|
6371
|
+
l(c), r(c, null);
|
|
6357
6372
|
},
|
|
6358
6373
|
dispose() {
|
|
6359
|
-
for (const
|
|
6374
|
+
for (const c of [...a.keys()]) l(c);
|
|
6360
6375
|
i.clear();
|
|
6361
6376
|
}
|
|
6362
6377
|
};
|
|
6363
6378
|
}
|
|
6364
|
-
function
|
|
6379
|
+
function Vr(e) {
|
|
6365
6380
|
return e ? e.state === "saving" ? "pending" : "error" : null;
|
|
6366
6381
|
}
|
|
6367
6382
|
export {
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6383
|
+
Za as GRID_CELL_TOKENS,
|
|
6384
|
+
Ja as GRID_CHIP_TOKENS,
|
|
6385
|
+
Fr as GridHost,
|
|
6386
|
+
Hr as SAVING_MARK_DELAY_MS,
|
|
6387
|
+
Aa as blockCellCount,
|
|
6388
|
+
Ea as buildPasteProposal,
|
|
6374
6389
|
qe as cellRange,
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6390
|
+
Vr as cellStatusMark,
|
|
6391
|
+
Wr as clearGridCellRegions,
|
|
6392
|
+
Or as createCellStatusStore,
|
|
6393
|
+
es as createGridCellTheme,
|
|
6394
|
+
Pr as createGridCells,
|
|
6395
|
+
Zs as createGridImageCache,
|
|
6396
|
+
Rr as defaultGridCellRenderers,
|
|
6382
6397
|
Ue as defaultGridCellTheme,
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6398
|
+
Ir as drawGridCellStatus,
|
|
6399
|
+
Lr as fillSeries,
|
|
6400
|
+
ps as filledRange,
|
|
6401
|
+
rr as formatGridNumber,
|
|
6402
|
+
Wn as gridCellMetrics,
|
|
6403
|
+
Dr as parseGridNumber,
|
|
6404
|
+
ya as parseTsv,
|
|
6405
|
+
fs as planFill,
|
|
6406
|
+
yo as readGridCellTheme,
|
|
6407
|
+
Co as selectionBlock,
|
|
6408
|
+
Ma as selectionStart,
|
|
6409
|
+
Ra as toHtmlTable,
|
|
6410
|
+
Sa as toTsv,
|
|
6411
|
+
Br as useGridCells,
|
|
6412
|
+
Pa as writeClipboardAsync,
|
|
6413
|
+
ka as writeClipboardEvent
|
|
6399
6414
|
};
|