@extable/core 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.css +1 -1
- package/dist/dataModel.d.ts +1 -0
- package/dist/geometry.d.ts +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1121 -975
- package/dist/index.js.map +1 -1
- package/dist/numberIO-CGTV3-KW.js +1017 -0
- package/dist/numberIO-CGTV3-KW.js.map +1 -0
- package/dist/numberIO-CTEeBhef.js +1046 -0
- package/dist/numberIO-CTEeBhef.js.map +1 -0
- package/dist/numberIO-CYskf90V.js +1017 -0
- package/dist/numberIO-CYskf90V.js.map +1 -0
- package/dist/numberIO-DBddtK0s.js +1063 -0
- package/dist/numberIO-DBddtK0s.js.map +1 -0
- package/dist/numberIO-UZ5ksMqf.js +1063 -0
- package/dist/numberIO-UZ5ksMqf.js.map +1 -0
- package/dist/renderers.d.ts +2 -0
- package/dist/selectionManager.d.ts +10 -2
- package/dist/ssr/index.js +1 -1
- package/dist/types.d.ts +16 -12
- package/dist/uniqueBooleanCommit.d.ts +6 -0
- package/package.json +2 -2
- package/src/styles.css +36 -3
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
function
|
|
1
|
+
import { D as wt, R as ct, g as J, c as Bt, s as ae, r as O, m as ht, a as vt, b as bt, d as ut, e as ft, t as Ue, C as dt, f as Et, h as At, i as Ut, j as Nt, k as ge, H as at, l as yt, p as Xe, n as Wt, o as ce, q as he, u as Ge, v as Ye, w as Qe, x as de, y as Je } from "./numberIO-UZ5ksMqf.js";
|
|
2
|
+
function Ze(c) {
|
|
3
3
|
const t = c.payload;
|
|
4
4
|
if (!t) return null;
|
|
5
5
|
const e = t.batchId;
|
|
6
6
|
return typeof e == "string" && e.length ? e : null;
|
|
7
7
|
}
|
|
8
|
-
class
|
|
8
|
+
class ti {
|
|
9
9
|
constructor(t = 100) {
|
|
10
10
|
this.applied = [], this.undone = [], this.cap = t;
|
|
11
11
|
}
|
|
12
12
|
enqueue(t) {
|
|
13
|
-
const e =
|
|
13
|
+
const e = Ze(t), i = this.applied.at(-1);
|
|
14
14
|
for (e && i && i.batchId === e ? i.commands.push(t) : this.applied.push({ batchId: e, commands: [t] }); this.applied.length > this.cap; ) this.applied.shift();
|
|
15
15
|
this.undone = [];
|
|
16
16
|
}
|
|
@@ -43,7 +43,7 @@ class Ue {
|
|
|
43
43
|
this.applied = [], this.undone = [];
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function ei(c, t) {
|
|
47
47
|
const e = c.getSchema(), i = c.listRows(), o = (s, l) => {
|
|
48
48
|
if (!Number.isInteger(s) || !Number.isInteger(l) || s < 0 || s >= i.length || l < 0 || l >= e.columns.length) return null;
|
|
49
49
|
const a = i[s], r = e.columns[l];
|
|
@@ -68,7 +68,7 @@ function ze(c, t) {
|
|
|
68
68
|
}
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
|
-
class
|
|
71
|
+
class ii {
|
|
72
72
|
constructor(t, e, i) {
|
|
73
73
|
this.lockedRows = /* @__PURE__ */ new Set(), this.mode = "none", this.mode = t, this.server = e, this.user = i;
|
|
74
74
|
}
|
|
@@ -109,7 +109,7 @@ class Xe {
|
|
|
109
109
|
return new Set(this.lockedRows);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
const
|
|
112
|
+
const It = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "), oi = (c) => {
|
|
113
113
|
const t = [];
|
|
114
114
|
if (c)
|
|
115
115
|
for (const e of c) {
|
|
@@ -117,7 +117,7 @@ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
|
|
|
117
117
|
!i || t.includes(i) || t.push(i);
|
|
118
118
|
}
|
|
119
119
|
return t.length === 0 ? t.push("en") : t.includes("en") || t.push("en"), t;
|
|
120
|
-
},
|
|
120
|
+
}, ni = (c, t) => {
|
|
121
121
|
const e = c.items.indexOf(t);
|
|
122
122
|
if (e !== -1)
|
|
123
123
|
return e;
|
|
@@ -128,17 +128,17 @@ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
|
|
|
128
128
|
return null;
|
|
129
129
|
const o = c.items.indexOf(i);
|
|
130
130
|
return o === -1 ? null : o;
|
|
131
|
-
},
|
|
132
|
-
const e =
|
|
133
|
-
if (
|
|
131
|
+
}, si = (c, t) => {
|
|
132
|
+
const e = It(t);
|
|
133
|
+
if (It(c.id).includes(e))
|
|
134
134
|
return !0;
|
|
135
135
|
for (const i of c.items)
|
|
136
|
-
if (
|
|
136
|
+
if (It(i).includes(e))
|
|
137
137
|
return !0;
|
|
138
138
|
return c.aliases ? Object.keys(c.aliases).some(
|
|
139
|
-
(i) =>
|
|
139
|
+
(i) => It(i).includes(e)
|
|
140
140
|
) : !1;
|
|
141
|
-
},
|
|
141
|
+
}, li = (c, t) => {
|
|
142
142
|
if (c.langs.length === 0)
|
|
143
143
|
return 0;
|
|
144
144
|
let e = Number.POSITIVE_INFINITY;
|
|
@@ -147,10 +147,10 @@ const xt = (c) => c.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "),
|
|
|
147
147
|
o !== -1 && o < e && (e = o);
|
|
148
148
|
}
|
|
149
149
|
return e;
|
|
150
|
-
},
|
|
151
|
-
class
|
|
150
|
+
}, ri = (c, t) => !c.langs || c.langs.length === 0 ? !0 : c.langs.some((e) => t.includes(e));
|
|
151
|
+
class ai {
|
|
152
152
|
constructor(t) {
|
|
153
|
-
this.lists = [], this.matchers = [], this.langs =
|
|
153
|
+
this.lists = [], this.matchers = [], this.langs = oi(t?.langs);
|
|
154
154
|
}
|
|
155
155
|
register(t) {
|
|
156
156
|
const e = this.lists.findIndex((i) => i.id === t.id);
|
|
@@ -170,7 +170,7 @@ class ti {
|
|
|
170
170
|
e = e.filter((n) => o.has(n.id));
|
|
171
171
|
}
|
|
172
172
|
const i = t?.queryText;
|
|
173
|
-
return i && (e = e.filter((o) =>
|
|
173
|
+
return i && (e = e.filter((o) => si(o, i))), e;
|
|
174
174
|
}
|
|
175
175
|
match(t, e) {
|
|
176
176
|
if (t.length === 0)
|
|
@@ -178,7 +178,7 @@ class ti {
|
|
|
178
178
|
let i = null, o = Number.NEGATIVE_INFINITY;
|
|
179
179
|
const n = e?.enabledIds ? new Set(e.enabledIds) : null;
|
|
180
180
|
for (const l of this.matchers) {
|
|
181
|
-
if (n && !n.has(l.id) || !
|
|
181
|
+
if (n && !n.has(l.id) || !ri(l, this.langs))
|
|
182
182
|
continue;
|
|
183
183
|
const a = l.match(t);
|
|
184
184
|
if (!a)
|
|
@@ -191,12 +191,12 @@ class ti {
|
|
|
191
191
|
state: a.state
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
-
const s = this.list(e).map((l) => ({ list: l, rank:
|
|
194
|
+
const s = this.list(e).map((l) => ({ list: l, rank: li(l, this.langs) })).filter((l) => Number.isFinite(l.rank)).sort((l, a) => l.rank - a.rank);
|
|
195
195
|
for (const { list: l, rank: a } of s) {
|
|
196
196
|
const r = [];
|
|
197
197
|
let h = !1;
|
|
198
198
|
for (const p of t) {
|
|
199
|
-
const m =
|
|
199
|
+
const m = ni(l, p);
|
|
200
200
|
if (m === null) {
|
|
201
201
|
h = !0;
|
|
202
202
|
break;
|
|
@@ -208,8 +208,8 @@ class ti {
|
|
|
208
208
|
const d = this.inferStep(l, r);
|
|
209
209
|
if (d === null)
|
|
210
210
|
continue;
|
|
211
|
-
const
|
|
212
|
-
|
|
211
|
+
const f = 10 - a;
|
|
212
|
+
f > o && (o = f, i = {
|
|
213
213
|
kind: "list",
|
|
214
214
|
list: l,
|
|
215
215
|
startIndex: r[r.length - 1] ?? 0,
|
|
@@ -244,12 +244,12 @@ class ti {
|
|
|
244
244
|
return n >= e ? null : n;
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
const
|
|
247
|
+
const ci = {
|
|
248
248
|
id: "weekdays-en-long",
|
|
249
249
|
mode: "cycle",
|
|
250
250
|
langs: ["en"],
|
|
251
251
|
items: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
|
252
|
-
},
|
|
252
|
+
}, hi = {
|
|
253
253
|
id: "weekdays-en-short",
|
|
254
254
|
mode: "cycle",
|
|
255
255
|
langs: ["en"],
|
|
@@ -259,22 +259,22 @@ const ei = {
|
|
|
259
259
|
Thur: "Thu",
|
|
260
260
|
Thurs: "Thu"
|
|
261
261
|
}
|
|
262
|
-
},
|
|
262
|
+
}, di = {
|
|
263
263
|
id: "weekdays-ja-long",
|
|
264
264
|
mode: "cycle",
|
|
265
265
|
langs: ["ja"],
|
|
266
266
|
items: ["月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日", "日曜日"]
|
|
267
|
-
},
|
|
267
|
+
}, ui = {
|
|
268
268
|
id: "weekdays-ja-short",
|
|
269
269
|
mode: "cycle",
|
|
270
270
|
langs: ["ja"],
|
|
271
271
|
items: ["月曜", "火曜", "水曜", "木曜", "金曜", "土曜", "日曜"]
|
|
272
|
-
},
|
|
272
|
+
}, fi = {
|
|
273
273
|
id: "weekdays-ja-single",
|
|
274
274
|
mode: "cycle",
|
|
275
275
|
langs: ["ja"],
|
|
276
276
|
items: ["月", "火", "水", "木", "金", "土", "日"]
|
|
277
|
-
},
|
|
277
|
+
}, pi = {
|
|
278
278
|
id: "months-en-long",
|
|
279
279
|
mode: "cycle",
|
|
280
280
|
langs: ["en"],
|
|
@@ -292,7 +292,7 @@ const ei = {
|
|
|
292
292
|
"November",
|
|
293
293
|
"December"
|
|
294
294
|
]
|
|
295
|
-
},
|
|
295
|
+
}, mi = {
|
|
296
296
|
id: "months-en-short",
|
|
297
297
|
mode: "cycle",
|
|
298
298
|
langs: ["en"],
|
|
@@ -300,32 +300,32 @@ const ei = {
|
|
|
300
300
|
aliases: {
|
|
301
301
|
Sept: "Sep"
|
|
302
302
|
}
|
|
303
|
-
},
|
|
303
|
+
}, gi = {
|
|
304
304
|
id: "months-ja",
|
|
305
305
|
mode: "cycle",
|
|
306
306
|
langs: ["ja"],
|
|
307
307
|
items: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
|
|
308
|
-
},
|
|
308
|
+
}, yi = {
|
|
309
309
|
id: "months-ja-traditional",
|
|
310
310
|
mode: "cycle",
|
|
311
311
|
langs: ["ja"],
|
|
312
312
|
items: ["睦月", "如月", "弥生", "卯月", "皐月", "水無月", "文月", "葉月", "長月", "神無月", "霜月", "師走"]
|
|
313
|
-
},
|
|
313
|
+
}, wi = {
|
|
314
314
|
id: "quarters-en",
|
|
315
315
|
mode: "cycle",
|
|
316
316
|
langs: ["en"],
|
|
317
317
|
items: ["Q1", "Q2", "Q3", "Q4"]
|
|
318
|
-
},
|
|
318
|
+
}, vi = {
|
|
319
319
|
id: "quarters-ja",
|
|
320
320
|
mode: "cycle",
|
|
321
321
|
langs: ["ja"],
|
|
322
322
|
items: ["第1四半期", "第2四半期", "第3四半期", "第4四半期"]
|
|
323
|
-
},
|
|
323
|
+
}, bi = {
|
|
324
324
|
id: "zodiac-animals-ja",
|
|
325
325
|
mode: "cycle",
|
|
326
326
|
langs: ["ja"],
|
|
327
327
|
items: ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]
|
|
328
|
-
},
|
|
328
|
+
}, Ci = {
|
|
329
329
|
id: "zodiac-signs-en",
|
|
330
330
|
mode: "cycle",
|
|
331
331
|
langs: ["en"],
|
|
@@ -343,7 +343,7 @@ const ei = {
|
|
|
343
343
|
"Aquarius",
|
|
344
344
|
"Pisces"
|
|
345
345
|
]
|
|
346
|
-
},
|
|
346
|
+
}, xi = {
|
|
347
347
|
id: "zodiac-signs-ja",
|
|
348
348
|
mode: "cycle",
|
|
349
349
|
langs: ["ja"],
|
|
@@ -351,7 +351,7 @@ const ei = {
|
|
|
351
351
|
aliases: {
|
|
352
352
|
さそり座: "蠍座"
|
|
353
353
|
}
|
|
354
|
-
},
|
|
354
|
+
}, Si = {
|
|
355
355
|
id: "directions-16-en",
|
|
356
356
|
mode: "cycle",
|
|
357
357
|
langs: ["en"],
|
|
@@ -373,7 +373,7 @@ const ei = {
|
|
|
373
373
|
"Northwest",
|
|
374
374
|
"North-Northwest"
|
|
375
375
|
]
|
|
376
|
-
},
|
|
376
|
+
}, Ri = {
|
|
377
377
|
id: "directions-16-ja",
|
|
378
378
|
mode: "cycle",
|
|
379
379
|
langs: ["ja"],
|
|
@@ -395,7 +395,7 @@ const ei = {
|
|
|
395
395
|
"北西",
|
|
396
396
|
"北北西"
|
|
397
397
|
]
|
|
398
|
-
},
|
|
398
|
+
}, Mi = {
|
|
399
399
|
id: "ampm-en",
|
|
400
400
|
mode: "cycle",
|
|
401
401
|
langs: ["en"],
|
|
@@ -404,12 +404,12 @@ const ei = {
|
|
|
404
404
|
"A.M.": "AM",
|
|
405
405
|
"P.M.": "PM"
|
|
406
406
|
}
|
|
407
|
-
},
|
|
407
|
+
}, ki = {
|
|
408
408
|
id: "ampm-ja",
|
|
409
409
|
mode: "cycle",
|
|
410
410
|
langs: ["ja"],
|
|
411
411
|
items: ["午前", "午後"]
|
|
412
|
-
},
|
|
412
|
+
}, Ii = {
|
|
413
413
|
id: "seasons-en",
|
|
414
414
|
mode: "cycle",
|
|
415
415
|
langs: ["en"],
|
|
@@ -417,17 +417,17 @@ const ei = {
|
|
|
417
417
|
aliases: {
|
|
418
418
|
Fall: "Autumn"
|
|
419
419
|
}
|
|
420
|
-
},
|
|
420
|
+
}, Ti = {
|
|
421
421
|
id: "seasons-ja",
|
|
422
422
|
mode: "cycle",
|
|
423
423
|
langs: ["ja"],
|
|
424
424
|
items: ["春", "夏", "秋", "冬"]
|
|
425
|
-
},
|
|
425
|
+
}, Ei = {
|
|
426
426
|
id: "solfege-ja",
|
|
427
427
|
mode: "cycle",
|
|
428
428
|
langs: ["ja"],
|
|
429
429
|
items: ["ド", "レ", "ミ", "ファ", "ソ", "ラ", "シ"]
|
|
430
|
-
},
|
|
430
|
+
}, Ai = {
|
|
431
431
|
id: "solfege-en",
|
|
432
432
|
mode: "cycle",
|
|
433
433
|
langs: ["en"],
|
|
@@ -436,7 +436,7 @@ const ei = {
|
|
|
436
436
|
So: "Sol",
|
|
437
437
|
Si: "Ti"
|
|
438
438
|
}
|
|
439
|
-
},
|
|
439
|
+
}, Hi = {
|
|
440
440
|
id: "greek-letters-en",
|
|
441
441
|
mode: "cycle",
|
|
442
442
|
langs: ["en"],
|
|
@@ -466,7 +466,7 @@ const ei = {
|
|
|
466
466
|
"Psi",
|
|
467
467
|
"Omega"
|
|
468
468
|
]
|
|
469
|
-
},
|
|
469
|
+
}, Li = {
|
|
470
470
|
id: "greek-letters-ja",
|
|
471
471
|
mode: "cycle",
|
|
472
472
|
langs: ["ja"],
|
|
@@ -496,7 +496,7 @@ const ei = {
|
|
|
496
496
|
"プサイ",
|
|
497
497
|
"オメガ"
|
|
498
498
|
]
|
|
499
|
-
},
|
|
499
|
+
}, Di = {
|
|
500
500
|
id: "greek-letters-symbols",
|
|
501
501
|
mode: "cycle",
|
|
502
502
|
langs: ["en", "ja"],
|
|
@@ -529,37 +529,37 @@ const ei = {
|
|
|
529
529
|
aliases: {
|
|
530
530
|
ς: "σ"
|
|
531
531
|
}
|
|
532
|
-
},
|
|
532
|
+
}, Ki = {
|
|
533
533
|
id: "rokuyo-ja",
|
|
534
534
|
mode: "cycle",
|
|
535
535
|
langs: ["ja"],
|
|
536
536
|
items: ["先勝", "友引", "先負", "仏滅", "大安", "赤口"]
|
|
537
|
-
},
|
|
537
|
+
}, _i = {
|
|
538
538
|
id: "heavenly-stems-ja",
|
|
539
539
|
mode: "finite",
|
|
540
540
|
langs: ["ja"],
|
|
541
541
|
items: ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"]
|
|
542
|
-
},
|
|
542
|
+
}, Fi = {
|
|
543
543
|
id: "planets-en",
|
|
544
544
|
mode: "finite",
|
|
545
545
|
langs: ["en"],
|
|
546
546
|
items: ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
|
|
547
|
-
},
|
|
547
|
+
}, Vi = {
|
|
548
548
|
id: "planets-ja",
|
|
549
549
|
mode: "finite",
|
|
550
550
|
langs: ["ja"],
|
|
551
551
|
items: ["水星", "金星", "地球", "火星", "木星", "土星", "天王星", "海王星"]
|
|
552
|
-
},
|
|
552
|
+
}, Ni = {
|
|
553
553
|
id: "kuji-in-ja",
|
|
554
554
|
mode: "finite",
|
|
555
555
|
langs: ["ja"],
|
|
556
556
|
items: ["臨", "兵", "闘", "者", "皆", "陣", "烈", "在", "前"]
|
|
557
|
-
},
|
|
557
|
+
}, Pi = {
|
|
558
558
|
id: "eight-virtues-ja",
|
|
559
559
|
mode: "finite",
|
|
560
560
|
langs: ["ja"],
|
|
561
561
|
items: ["仁", "義", "礼", "智", "忠", "信", "孝", "悌"]
|
|
562
|
-
},
|
|
562
|
+
}, Bi = {
|
|
563
563
|
id: "element-symbols",
|
|
564
564
|
mode: "finite",
|
|
565
565
|
langs: ["ja", "en"],
|
|
@@ -683,7 +683,7 @@ const ei = {
|
|
|
683
683
|
"Ts",
|
|
684
684
|
"Og"
|
|
685
685
|
]
|
|
686
|
-
},
|
|
686
|
+
}, Wi = {
|
|
687
687
|
id: "element-names-ja",
|
|
688
688
|
mode: "finite",
|
|
689
689
|
langs: ["ja"],
|
|
@@ -807,7 +807,7 @@ const ei = {
|
|
|
807
807
|
"テネシン",
|
|
808
808
|
"オガネソン"
|
|
809
809
|
]
|
|
810
|
-
},
|
|
810
|
+
}, $i = {
|
|
811
811
|
id: "shoguns-kamakura-ja",
|
|
812
812
|
mode: "finite",
|
|
813
813
|
langs: ["ja"],
|
|
@@ -822,7 +822,7 @@ const ei = {
|
|
|
822
822
|
"久明親王",
|
|
823
823
|
"守邦親王"
|
|
824
824
|
]
|
|
825
|
-
},
|
|
825
|
+
}, Oi = {
|
|
826
826
|
id: "shoguns-ashikaga-ja",
|
|
827
827
|
mode: "finite",
|
|
828
828
|
langs: ["ja"],
|
|
@@ -843,7 +843,7 @@ const ei = {
|
|
|
843
843
|
"足利義栄",
|
|
844
844
|
"足利義昭"
|
|
845
845
|
]
|
|
846
|
-
},
|
|
846
|
+
}, ji = {
|
|
847
847
|
id: "shoguns-ashikaga-given-ja",
|
|
848
848
|
mode: "finite",
|
|
849
849
|
langs: ["ja"],
|
|
@@ -864,7 +864,7 @@ const ei = {
|
|
|
864
864
|
"義栄",
|
|
865
865
|
"義昭"
|
|
866
866
|
]
|
|
867
|
-
},
|
|
867
|
+
}, qi = {
|
|
868
868
|
id: "shoguns-tokugawa-ja",
|
|
869
869
|
mode: "finite",
|
|
870
870
|
langs: ["ja"],
|
|
@@ -885,7 +885,7 @@ const ei = {
|
|
|
885
885
|
"徳川家茂",
|
|
886
886
|
"徳川慶喜"
|
|
887
887
|
]
|
|
888
|
-
},
|
|
888
|
+
}, zi = {
|
|
889
889
|
id: "shoguns-tokugawa-given-ja",
|
|
890
890
|
mode: "finite",
|
|
891
891
|
langs: ["ja"],
|
|
@@ -906,7 +906,7 @@ const ei = {
|
|
|
906
906
|
"家茂",
|
|
907
907
|
"慶喜"
|
|
908
908
|
]
|
|
909
|
-
},
|
|
909
|
+
}, ye = [
|
|
910
910
|
"北海道",
|
|
911
911
|
"青森県",
|
|
912
912
|
"岩手県",
|
|
@@ -954,7 +954,7 @@ const ei = {
|
|
|
954
954
|
"宮崎県",
|
|
955
955
|
"鹿児島県",
|
|
956
956
|
"沖縄県"
|
|
957
|
-
],
|
|
957
|
+
], Ui = ye.reduce(
|
|
958
958
|
(c, t) => {
|
|
959
959
|
if (t === "北海道")
|
|
960
960
|
return c;
|
|
@@ -965,13 +965,13 @@ const ei = {
|
|
|
965
965
|
return c;
|
|
966
966
|
},
|
|
967
967
|
{}
|
|
968
|
-
),
|
|
968
|
+
), Xi = {
|
|
969
969
|
id: "prefectures-ja",
|
|
970
970
|
mode: "finite",
|
|
971
971
|
langs: ["ja"],
|
|
972
|
-
items:
|
|
973
|
-
aliases:
|
|
974
|
-
},
|
|
972
|
+
items: ye,
|
|
973
|
+
aliases: Ui
|
|
974
|
+
}, Gi = {
|
|
975
975
|
id: "us-states-en",
|
|
976
976
|
mode: "finite",
|
|
977
977
|
langs: ["en"],
|
|
@@ -1027,7 +1027,7 @@ const ei = {
|
|
|
1027
1027
|
"Wisconsin",
|
|
1028
1028
|
"Wyoming"
|
|
1029
1029
|
]
|
|
1030
|
-
},
|
|
1030
|
+
}, Yi = {
|
|
1031
1031
|
id: "us-states-abbrev-en",
|
|
1032
1032
|
mode: "finite",
|
|
1033
1033
|
langs: ["en"],
|
|
@@ -1083,7 +1083,7 @@ const ei = {
|
|
|
1083
1083
|
"WI",
|
|
1084
1084
|
"WY"
|
|
1085
1085
|
]
|
|
1086
|
-
},
|
|
1086
|
+
}, Qi = {
|
|
1087
1087
|
id: "windows-versions",
|
|
1088
1088
|
mode: "finite",
|
|
1089
1089
|
langs: ["ja", "en"],
|
|
@@ -1106,7 +1106,7 @@ const ei = {
|
|
|
1106
1106
|
"Windows 10",
|
|
1107
1107
|
"Windows 11"
|
|
1108
1108
|
]
|
|
1109
|
-
},
|
|
1109
|
+
}, Ji = {
|
|
1110
1110
|
id: "macos-versions",
|
|
1111
1111
|
mode: "finite",
|
|
1112
1112
|
langs: ["ja", "en"],
|
|
@@ -1134,7 +1134,7 @@ const ei = {
|
|
|
1134
1134
|
"Sequoia",
|
|
1135
1135
|
"Tahoe"
|
|
1136
1136
|
]
|
|
1137
|
-
},
|
|
1137
|
+
}, Zi = {
|
|
1138
1138
|
id: "debian-codenames",
|
|
1139
1139
|
mode: "finite",
|
|
1140
1140
|
langs: ["ja", "en"],
|
|
@@ -1158,15 +1158,7 @@ const ei = {
|
|
|
1158
1158
|
"bookworm",
|
|
1159
1159
|
"trixie"
|
|
1160
1160
|
]
|
|
1161
|
-
},
|
|
1162
|
-
ei,
|
|
1163
|
-
ii,
|
|
1164
|
-
oi,
|
|
1165
|
-
ni,
|
|
1166
|
-
si,
|
|
1167
|
-
li,
|
|
1168
|
-
ri,
|
|
1169
|
-
ai,
|
|
1161
|
+
}, to = [
|
|
1170
1162
|
ci,
|
|
1171
1163
|
hi,
|
|
1172
1164
|
di,
|
|
@@ -1178,13 +1170,13 @@ const ei = {
|
|
|
1178
1170
|
yi,
|
|
1179
1171
|
wi,
|
|
1180
1172
|
vi,
|
|
1181
|
-
Ci,
|
|
1182
1173
|
bi,
|
|
1174
|
+
Ci,
|
|
1183
1175
|
xi,
|
|
1184
1176
|
Si,
|
|
1177
|
+
Ri,
|
|
1185
1178
|
Mi,
|
|
1186
1179
|
ki,
|
|
1187
|
-
Ri,
|
|
1188
1180
|
Ii,
|
|
1189
1181
|
Ti,
|
|
1190
1182
|
Ei,
|
|
@@ -1193,22 +1185,30 @@ const ei = {
|
|
|
1193
1185
|
Li,
|
|
1194
1186
|
Di,
|
|
1195
1187
|
Ki,
|
|
1196
|
-
Fi,
|
|
1197
1188
|
_i,
|
|
1189
|
+
Fi,
|
|
1198
1190
|
Vi,
|
|
1199
1191
|
Ni,
|
|
1192
|
+
Pi,
|
|
1200
1193
|
Bi,
|
|
1201
|
-
$i,
|
|
1202
1194
|
Wi,
|
|
1195
|
+
$i,
|
|
1203
1196
|
Oi,
|
|
1204
1197
|
ji,
|
|
1205
|
-
qi
|
|
1206
|
-
|
|
1198
|
+
qi,
|
|
1199
|
+
zi,
|
|
1200
|
+
Xi,
|
|
1201
|
+
Gi,
|
|
1202
|
+
Yi,
|
|
1203
|
+
Qi,
|
|
1204
|
+
Ji,
|
|
1205
|
+
Zi
|
|
1206
|
+
], Dt = (c) => {
|
|
1207
1207
|
const t = c % 100;
|
|
1208
1208
|
if (t >= 11 && t <= 13) return "th";
|
|
1209
1209
|
const e = c % 10;
|
|
1210
1210
|
return e === 1 ? "st" : e === 2 ? "nd" : e === 3 ? "rd" : "th";
|
|
1211
|
-
},
|
|
1211
|
+
}, $t = {
|
|
1212
1212
|
1: "first",
|
|
1213
1213
|
2: "second",
|
|
1214
1214
|
3: "third",
|
|
@@ -1228,7 +1228,7 @@ const ei = {
|
|
|
1228
1228
|
17: "seventeenth",
|
|
1229
1229
|
18: "eighteenth",
|
|
1230
1230
|
19: "nineteenth"
|
|
1231
|
-
},
|
|
1231
|
+
}, Ot = {
|
|
1232
1232
|
20: "twentieth",
|
|
1233
1233
|
30: "thirtieth",
|
|
1234
1234
|
40: "fortieth",
|
|
@@ -1237,7 +1237,7 @@ const ei = {
|
|
|
1237
1237
|
70: "seventieth",
|
|
1238
1238
|
80: "eightieth",
|
|
1239
1239
|
90: "ninetieth"
|
|
1240
|
-
},
|
|
1240
|
+
}, we = {
|
|
1241
1241
|
20: "twenty",
|
|
1242
1242
|
30: "thirty",
|
|
1243
1243
|
40: "forty",
|
|
@@ -1246,46 +1246,46 @@ const ei = {
|
|
|
1246
1246
|
70: "seventy",
|
|
1247
1247
|
80: "eighty",
|
|
1248
1248
|
90: "ninety"
|
|
1249
|
-
},
|
|
1250
|
-
Object.entries(
|
|
1251
|
-
),
|
|
1252
|
-
Object.entries(
|
|
1253
|
-
),
|
|
1254
|
-
Object.entries(
|
|
1255
|
-
),
|
|
1249
|
+
}, ue = Object.fromEntries(
|
|
1250
|
+
Object.entries($t).map(([c, t]) => [t, Number(c)])
|
|
1251
|
+
), eo = Object.fromEntries(
|
|
1252
|
+
Object.entries(Ot).map(([c, t]) => [t, Number(c)])
|
|
1253
|
+
), io = Object.fromEntries(
|
|
1254
|
+
Object.entries(we).map(([c, t]) => [t, Number(c)])
|
|
1255
|
+
), ve = (c) => {
|
|
1256
1256
|
const t = c.trim().toLowerCase();
|
|
1257
1257
|
if (!t) return null;
|
|
1258
|
-
const e =
|
|
1258
|
+
const e = ue[t] ?? eo[t];
|
|
1259
1259
|
if (e) return e;
|
|
1260
1260
|
const i = t.split(/[-\s]+/);
|
|
1261
1261
|
if (i.length !== 2) return null;
|
|
1262
|
-
const o =
|
|
1262
|
+
const o = io[i[0] ?? ""], n = ue[i[1] ?? ""];
|
|
1263
1263
|
return !o || !n ? null : o + n;
|
|
1264
|
-
},
|
|
1264
|
+
}, be = (c) => {
|
|
1265
1265
|
if (!Number.isFinite(c) || c <= 0 || Math.floor(c) !== c) return null;
|
|
1266
|
-
if (c <= 19) return
|
|
1266
|
+
if (c <= 19) return $t[c] ?? null;
|
|
1267
1267
|
if (c < 100) {
|
|
1268
|
-
if (
|
|
1269
|
-
const t = Math.floor(c / 10) * 10, e = c % 10, i =
|
|
1268
|
+
if (Ot[c]) return Ot[c] ?? null;
|
|
1269
|
+
const t = Math.floor(c / 10) * 10, e = c % 10, i = we[t], o = $t[e];
|
|
1270
1270
|
return !i || !o ? null : `${i}-${o}`;
|
|
1271
1271
|
}
|
|
1272
1272
|
return null;
|
|
1273
|
-
},
|
|
1273
|
+
}, fe = (c) => {
|
|
1274
1274
|
const t = /^(\d+)(st|nd|rd|th)$/i.exec(c);
|
|
1275
1275
|
if (t) {
|
|
1276
1276
|
const i = Number(t[1]);
|
|
1277
1277
|
if (!Number.isFinite(i) || i <= 0) return null;
|
|
1278
1278
|
const o = t[2]?.toLowerCase();
|
|
1279
|
-
return
|
|
1279
|
+
return Dt(i) !== o ? null : { value: i, format: "numeric" };
|
|
1280
1280
|
}
|
|
1281
|
-
const e =
|
|
1281
|
+
const e = ve(c);
|
|
1282
1282
|
return e !== null ? { value: e, format: "word" } : null;
|
|
1283
|
-
},
|
|
1283
|
+
}, oo = {
|
|
1284
1284
|
id: "ordinal-en",
|
|
1285
1285
|
langs: ["en"],
|
|
1286
1286
|
match(c) {
|
|
1287
1287
|
if (c.length < 2) return null;
|
|
1288
|
-
const t = c.map((n) =>
|
|
1288
|
+
const t = c.map((n) => fe(n));
|
|
1289
1289
|
if (t.some((n) => n === null)) return null;
|
|
1290
1290
|
const e = t[0].format;
|
|
1291
1291
|
if (t.some((n) => n?.format !== e)) return null;
|
|
@@ -1295,29 +1295,29 @@ const ei = {
|
|
|
1295
1295
|
return { score: 80, step: o, state: { format: e } };
|
|
1296
1296
|
},
|
|
1297
1297
|
createIterator(c, t) {
|
|
1298
|
-
const e =
|
|
1298
|
+
const e = fe(c[c.length - 1] ?? ""), i = t.state?.format ?? "numeric";
|
|
1299
1299
|
let o = e?.value ?? 0;
|
|
1300
1300
|
return {
|
|
1301
1301
|
next() {
|
|
1302
1302
|
if (o += t.step, o <= 0 || !Number.isFinite(o))
|
|
1303
1303
|
return { value: void 0, done: !0 };
|
|
1304
1304
|
if (i === "word") {
|
|
1305
|
-
const n =
|
|
1305
|
+
const n = be(o);
|
|
1306
1306
|
return n ? { value: n, done: !1 } : { value: void 0, done: !0 };
|
|
1307
1307
|
}
|
|
1308
|
-
return { value: `${o}${
|
|
1308
|
+
return { value: `${o}${Dt(o)}`, done: !1 };
|
|
1309
1309
|
}
|
|
1310
1310
|
};
|
|
1311
1311
|
}
|
|
1312
|
-
},
|
|
1313
|
-
for (const t of
|
|
1312
|
+
}, no = (c) => {
|
|
1313
|
+
for (const t of to)
|
|
1314
1314
|
c.register(t);
|
|
1315
|
-
},
|
|
1316
|
-
c.registerMatch(
|
|
1317
|
-
},
|
|
1318
|
-
const t = c ?? ["en", "ja"], e = new
|
|
1319
|
-
return
|
|
1320
|
-
},
|
|
1315
|
+
}, so = (c) => {
|
|
1316
|
+
c.registerMatch(oo);
|
|
1317
|
+
}, Ce = (c) => {
|
|
1318
|
+
const t = c ?? ["en", "ja"], e = new ai({ langs: t });
|
|
1319
|
+
return no(e), so(e), e;
|
|
1320
|
+
}, lo = (c) => {
|
|
1321
1321
|
let t = 0;
|
|
1322
1322
|
return {
|
|
1323
1323
|
next() {
|
|
@@ -1328,13 +1328,13 @@ const ei = {
|
|
|
1328
1328
|
}
|
|
1329
1329
|
};
|
|
1330
1330
|
};
|
|
1331
|
-
class
|
|
1331
|
+
class Q {
|
|
1332
1332
|
constructor(...t) {
|
|
1333
1333
|
const e = t;
|
|
1334
|
-
this.seed = e, this.kind = e.length === 1 ? "copy" : "seed-repeat", this.iterator =
|
|
1334
|
+
this.seed = e, this.kind = e.length === 1 ? "copy" : "seed-repeat", this.iterator = lo(e);
|
|
1335
1335
|
}
|
|
1336
1336
|
static fromSeed(t, e, i) {
|
|
1337
|
-
const o = new
|
|
1337
|
+
const o = new Q(...t);
|
|
1338
1338
|
return o.kind = e, o.iterator = i, o;
|
|
1339
1339
|
}
|
|
1340
1340
|
next() {
|
|
@@ -1344,11 +1344,11 @@ class G {
|
|
|
1344
1344
|
return this;
|
|
1345
1345
|
}
|
|
1346
1346
|
}
|
|
1347
|
-
const
|
|
1347
|
+
const xe = 1e-9, ro = 100, ao = (c) => ({
|
|
1348
1348
|
next() {
|
|
1349
1349
|
return { value: c, done: !1 };
|
|
1350
1350
|
}
|
|
1351
|
-
}),
|
|
1351
|
+
}), pe = (c) => {
|
|
1352
1352
|
let t = 0;
|
|
1353
1353
|
return {
|
|
1354
1354
|
next() {
|
|
@@ -1358,28 +1358,28 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1358
1358
|
return t += 1, { value: e, done: !1 };
|
|
1359
1359
|
}
|
|
1360
1360
|
};
|
|
1361
|
-
},
|
|
1361
|
+
}, co = (c, t) => {
|
|
1362
1362
|
let e = 0;
|
|
1363
1363
|
return {
|
|
1364
1364
|
next() {
|
|
1365
1365
|
return e += 1, { value: c + t * e, done: !1 };
|
|
1366
1366
|
}
|
|
1367
1367
|
};
|
|
1368
|
-
},
|
|
1368
|
+
}, ho = (c, t) => {
|
|
1369
1369
|
let e = 0;
|
|
1370
1370
|
return {
|
|
1371
1371
|
next() {
|
|
1372
1372
|
return e += 1, { value: new Date(c.getTime() + t * e), done: !1 };
|
|
1373
1373
|
}
|
|
1374
1374
|
};
|
|
1375
|
-
},
|
|
1375
|
+
}, uo = (c, t) => {
|
|
1376
1376
|
let e = 0;
|
|
1377
1377
|
return {
|
|
1378
1378
|
next() {
|
|
1379
1379
|
return e += 1, { value: c * t ** e, done: !1 };
|
|
1380
1380
|
}
|
|
1381
1381
|
};
|
|
1382
|
-
},
|
|
1382
|
+
}, fo = (c, t) => {
|
|
1383
1383
|
if (c.kind === "matcher")
|
|
1384
1384
|
return c.matcher.createIterator(t, { step: c.step, state: c.state });
|
|
1385
1385
|
const { list: e, startIndex: i, step: o } = c, n = e.items.length;
|
|
@@ -1393,7 +1393,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1393
1393
|
return s = (s + o) % n, { value: e.items[s], done: !1 };
|
|
1394
1394
|
}
|
|
1395
1395
|
};
|
|
1396
|
-
},
|
|
1396
|
+
}, po = (c) => c.every((t) => typeof t == "number" && Number.isFinite(t)), mo = (c) => c.every((t) => t instanceof Date && !Number.isNaN(t.getTime())), go = (c) => c.every((t) => typeof t == "string"), yo = (c) => {
|
|
1397
1397
|
const t = /^(.*?)(-?\d+)([^0-9]*)$/.exec(c);
|
|
1398
1398
|
if (!t)
|
|
1399
1399
|
return null;
|
|
@@ -1402,13 +1402,13 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1402
1402
|
return null;
|
|
1403
1403
|
const s = i.replace("-", "").length;
|
|
1404
1404
|
return { prefix: e, num: n, width: s, suffix: o };
|
|
1405
|
-
},
|
|
1405
|
+
}, wo = (c) => {
|
|
1406
1406
|
const t = /^(.*?)(\d+)(st|nd|rd|th)([^0-9]*)$/i.exec(c);
|
|
1407
1407
|
if (t) {
|
|
1408
1408
|
const o = Number(t[2]);
|
|
1409
1409
|
if (!Number.isFinite(o) || o <= 0) return null;
|
|
1410
1410
|
const n = t[3]?.toLowerCase();
|
|
1411
|
-
return
|
|
1411
|
+
return Dt(o) !== n ? null : {
|
|
1412
1412
|
prefix: t[1] ?? "",
|
|
1413
1413
|
num: o,
|
|
1414
1414
|
suffix: t[4] ?? "",
|
|
@@ -1417,14 +1417,14 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1417
1417
|
}
|
|
1418
1418
|
const e = /^(.*?)([A-Za-z-]+)([^A-Za-z]*)$/.exec(c);
|
|
1419
1419
|
if (!e) return null;
|
|
1420
|
-
const i =
|
|
1420
|
+
const i = ve(e[2] ?? "");
|
|
1421
1421
|
return i === null ? null : {
|
|
1422
1422
|
prefix: e[1] ?? "",
|
|
1423
1423
|
num: i,
|
|
1424
1424
|
suffix: e[3] ?? "",
|
|
1425
1425
|
format: "word"
|
|
1426
1426
|
};
|
|
1427
|
-
},
|
|
1427
|
+
}, vo = (c, t, e) => {
|
|
1428
1428
|
let i = 0;
|
|
1429
1429
|
return {
|
|
1430
1430
|
next() {
|
|
@@ -1433,16 +1433,16 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1433
1433
|
if (o <= 0 || !Number.isFinite(o))
|
|
1434
1434
|
return { value: void 0, done: !0 };
|
|
1435
1435
|
if (c.format === "word") {
|
|
1436
|
-
const n =
|
|
1436
|
+
const n = be(o);
|
|
1437
1437
|
return n ? { value: `${c.prefix}${n}${c.suffix}`, done: !1 } : { value: void 0, done: !0 };
|
|
1438
1438
|
}
|
|
1439
1439
|
return {
|
|
1440
|
-
value: `${c.prefix}${o}${
|
|
1440
|
+
value: `${c.prefix}${o}${Dt(o)}${c.suffix}`,
|
|
1441
1441
|
done: !1
|
|
1442
1442
|
};
|
|
1443
1443
|
}
|
|
1444
1444
|
};
|
|
1445
|
-
},
|
|
1445
|
+
}, bo = (c, t, e) => {
|
|
1446
1446
|
let i = 0;
|
|
1447
1447
|
return {
|
|
1448
1448
|
next() {
|
|
@@ -1451,7 +1451,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1451
1451
|
return { value: `${c.prefix}${n}${s}${c.suffix}`, done: !1 };
|
|
1452
1452
|
}
|
|
1453
1453
|
};
|
|
1454
|
-
},
|
|
1454
|
+
}, Se = [
|
|
1455
1455
|
["C", 100],
|
|
1456
1456
|
["XC", 90],
|
|
1457
1457
|
["L", 50],
|
|
@@ -1461,39 +1461,39 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1461
1461
|
["V", 5],
|
|
1462
1462
|
["IV", 4],
|
|
1463
1463
|
["I", 1]
|
|
1464
|
-
],
|
|
1465
|
-
if (c < 1 || c >
|
|
1464
|
+
], Xt = (c) => {
|
|
1465
|
+
if (c < 1 || c > ro)
|
|
1466
1466
|
return null;
|
|
1467
1467
|
let t = c, e = "";
|
|
1468
|
-
for (const [i, o] of
|
|
1468
|
+
for (const [i, o] of Se)
|
|
1469
1469
|
for (; t >= o; )
|
|
1470
1470
|
e += i, t -= o;
|
|
1471
1471
|
return e;
|
|
1472
|
-
},
|
|
1472
|
+
}, Re = (c) => {
|
|
1473
1473
|
if (c.length === 0 || c !== c.toUpperCase())
|
|
1474
1474
|
return null;
|
|
1475
1475
|
let t = c, e = 0;
|
|
1476
|
-
for (const [o, n] of
|
|
1476
|
+
for (const [o, n] of Se)
|
|
1477
1477
|
for (; t.startsWith(o); )
|
|
1478
1478
|
e += n, t = t.slice(o.length);
|
|
1479
1479
|
if (t.length > 0)
|
|
1480
1480
|
return null;
|
|
1481
|
-
const i =
|
|
1481
|
+
const i = Xt(e);
|
|
1482
1482
|
return !i || i !== c ? null : e;
|
|
1483
|
-
},
|
|
1483
|
+
}, Co = (c, t) => {
|
|
1484
1484
|
let e = 0;
|
|
1485
1485
|
return {
|
|
1486
1486
|
next() {
|
|
1487
1487
|
e += 1;
|
|
1488
|
-
const i = c + t * e, o =
|
|
1488
|
+
const i = c + t * e, o = Xt(i);
|
|
1489
1489
|
return o ? { value: o, done: !1 } : { value: void 0, done: !0 };
|
|
1490
1490
|
}
|
|
1491
1491
|
};
|
|
1492
|
-
},
|
|
1492
|
+
}, xo = (c) => new RegExp("\\p{White_Space}", "u").test(c) ? "space" : new RegExp("\\p{P}", "u").test(c) ? "punct" : new RegExp("\\p{S}", "u").test(c) ? "symbol" : new RegExp("\\p{Script=Latin}", "u").test(c) ? "latin" : new RegExp("\\p{Script=Han}", "u").test(c) ? "han" : new RegExp("\\p{Script=Hiragana}", "u").test(c) ? "hiragana" : new RegExp("\\p{Script=Katakana}", "u").test(c) ? "katakana" : new RegExp("\\p{N}", "u").test(c) ? "number" : "other", So = (c) => {
|
|
1493
1493
|
const t = [];
|
|
1494
1494
|
let e = "", i = null;
|
|
1495
1495
|
for (const o of c) {
|
|
1496
|
-
const n =
|
|
1496
|
+
const n = xo(o);
|
|
1497
1497
|
if (i === n) {
|
|
1498
1498
|
e += o;
|
|
1499
1499
|
continue;
|
|
@@ -1501,22 +1501,22 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1501
1501
|
i !== null && t.push({ value: e, group: i }), e = o, i = n;
|
|
1502
1502
|
}
|
|
1503
1503
|
return i !== null && t.push({ value: e, group: i }), t;
|
|
1504
|
-
},
|
|
1505
|
-
const t =
|
|
1504
|
+
}, Ro = (c) => {
|
|
1505
|
+
const t = So(c), e = t.map((l, a) => ({ index: a, num: Re(l.value) })).filter((l) => l.num !== null);
|
|
1506
1506
|
if (e.length !== 1)
|
|
1507
1507
|
return null;
|
|
1508
1508
|
const i = e[0].index, o = e[0].num, n = t.slice(0, i).map((l) => l.value).join(""), s = t.slice(i + 1).map((l) => l.value).join("");
|
|
1509
1509
|
return { prefix: n, num: o, suffix: s };
|
|
1510
|
-
},
|
|
1510
|
+
}, Mo = (c, t, e) => {
|
|
1511
1511
|
let i = 0;
|
|
1512
1512
|
return {
|
|
1513
1513
|
next() {
|
|
1514
1514
|
i += 1;
|
|
1515
|
-
const o = t + e * i, n =
|
|
1515
|
+
const o = t + e * i, n = Xt(o);
|
|
1516
1516
|
return n ? { value: `${c.prefix}${n}${c.suffix}`, done: !1 } : { value: void 0, done: !0 };
|
|
1517
1517
|
}
|
|
1518
1518
|
};
|
|
1519
|
-
},
|
|
1519
|
+
}, jt = {
|
|
1520
1520
|
一: 1,
|
|
1521
1521
|
二: 2,
|
|
1522
1522
|
三: 3,
|
|
@@ -1526,7 +1526,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1526
1526
|
七: 7,
|
|
1527
1527
|
八: 8,
|
|
1528
1528
|
九: 9
|
|
1529
|
-
},
|
|
1529
|
+
}, qt = {
|
|
1530
1530
|
壱: 1,
|
|
1531
1531
|
弐: 2,
|
|
1532
1532
|
参: 3,
|
|
@@ -1536,42 +1536,42 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1536
1536
|
柒: 7,
|
|
1537
1537
|
捌: 8,
|
|
1538
1538
|
玖: 9
|
|
1539
|
-
},
|
|
1539
|
+
}, Me = {
|
|
1540
1540
|
十: 10,
|
|
1541
1541
|
拾: 10,
|
|
1542
1542
|
百: 100,
|
|
1543
1543
|
佰: 100,
|
|
1544
1544
|
千: 1e3,
|
|
1545
1545
|
仟: 1e3
|
|
1546
|
-
},
|
|
1546
|
+
}, ko = {
|
|
1547
1547
|
万: 1e4,
|
|
1548
1548
|
萬: 1e4
|
|
1549
|
-
},
|
|
1550
|
-
...Object.keys(
|
|
1551
|
-
...Object.keys(
|
|
1552
|
-
...Object.keys(
|
|
1553
|
-
...Object.keys(
|
|
1554
|
-
]),
|
|
1549
|
+
}, Io = /* @__PURE__ */ new Set([
|
|
1550
|
+
...Object.keys(jt),
|
|
1551
|
+
...Object.keys(qt),
|
|
1552
|
+
...Object.keys(Me),
|
|
1553
|
+
...Object.keys(ko)
|
|
1554
|
+
]), To = (c) => Io.has(c), Eo = (c) => /[壱弐参肆伍陸柒捌玖拾萬佰仟]/.test(c) ? "traditional" : "modern", ke = (c) => {
|
|
1555
1555
|
if (!c)
|
|
1556
1556
|
return null;
|
|
1557
|
-
const t =
|
|
1557
|
+
const t = Eo(c);
|
|
1558
1558
|
if (c.includes("万") || c.includes("萬")) {
|
|
1559
1559
|
const s = /^([一二三四五六七八九壱弐参肆伍陸柒捌玖])?(万|萬)$/.exec(c);
|
|
1560
1560
|
if (!s)
|
|
1561
1561
|
return null;
|
|
1562
1562
|
const l = s[1];
|
|
1563
|
-
return l ? (
|
|
1563
|
+
return l ? (jt[l] ?? qt[l]) !== 1 ? null : { num: 1e4, style: t } : { num: 1e4, style: t };
|
|
1564
1564
|
}
|
|
1565
1565
|
let e = 0, i = 0, o = Number.POSITIVE_INFINITY, n = !1;
|
|
1566
1566
|
for (const s of c) {
|
|
1567
|
-
const l =
|
|
1567
|
+
const l = jt[s] ?? qt[s];
|
|
1568
1568
|
if (l) {
|
|
1569
1569
|
if (n)
|
|
1570
1570
|
return null;
|
|
1571
1571
|
i = l, n = !0;
|
|
1572
1572
|
continue;
|
|
1573
1573
|
}
|
|
1574
|
-
const a =
|
|
1574
|
+
const a = Me[s];
|
|
1575
1575
|
if (a) {
|
|
1576
1576
|
if (a >= o)
|
|
1577
1577
|
return null;
|
|
@@ -1581,13 +1581,13 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1581
1581
|
return null;
|
|
1582
1582
|
}
|
|
1583
1583
|
return e += i, e <= 0 || e > 1e4 ? null : { num: e, style: t };
|
|
1584
|
-
},
|
|
1584
|
+
}, Ao = (c) => {
|
|
1585
1585
|
const t = [];
|
|
1586
1586
|
let e = "", i = 0, o = 0;
|
|
1587
1587
|
for (const r of c)
|
|
1588
|
-
|
|
1588
|
+
To(r) ? (e || (i = o), e += r) : e && (t.push({ start: i, end: o, text: e }), e = ""), o += r.length;
|
|
1589
1589
|
e && t.push({ start: i, end: o, text: e });
|
|
1590
|
-
const n = t.map((r) => ({ run: r, parsed:
|
|
1590
|
+
const n = t.map((r) => ({ run: r, parsed: ke(r.text) })).filter((r) => r.parsed !== null);
|
|
1591
1591
|
if (n.length !== 1)
|
|
1592
1592
|
return null;
|
|
1593
1593
|
const s = n[0], l = c.slice(0, s.run.start), a = c.slice(s.run.end);
|
|
@@ -1597,7 +1597,7 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1597
1597
|
suffix: a,
|
|
1598
1598
|
style: s.parsed.style
|
|
1599
1599
|
};
|
|
1600
|
-
},
|
|
1600
|
+
}, Ie = (c, t) => {
|
|
1601
1601
|
if (!Number.isFinite(c) || c <= 0 || c > 1e4)
|
|
1602
1602
|
return null;
|
|
1603
1603
|
const e = t === "traditional" ? ["", "壱", "弐", "参", "肆", "伍", "陸", "柒", "捌", "玖"] : ["", "一", "二", "三", "四", "五", "六", "七", "八", "九"], i = t === "traditional" ? "拾" : "十", o = t === "traditional" ? "萬" : "万";
|
|
@@ -1610,53 +1610,53 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1610
1610
|
a > 0 && (a > 1 && (s += e[a]), s += "百", n %= 100);
|
|
1611
1611
|
const r = Math.floor(n / 10);
|
|
1612
1612
|
return r > 0 && (r > 1 && (s += e[r]), s += i, n %= 10), n > 0 && (s += e[n]), s || null;
|
|
1613
|
-
},
|
|
1613
|
+
}, Ho = (c, t, e) => {
|
|
1614
1614
|
let i = 0;
|
|
1615
1615
|
return {
|
|
1616
1616
|
next() {
|
|
1617
1617
|
i += 1;
|
|
1618
|
-
const o = c + t * i, n =
|
|
1618
|
+
const o = c + t * i, n = Ie(o, e);
|
|
1619
1619
|
return n ? { value: n, done: !1 } : { value: void 0, done: !0 };
|
|
1620
1620
|
}
|
|
1621
1621
|
};
|
|
1622
|
-
},
|
|
1622
|
+
}, Lo = (c, t, e) => {
|
|
1623
1623
|
let i = 0;
|
|
1624
1624
|
return {
|
|
1625
1625
|
next() {
|
|
1626
1626
|
i += 1;
|
|
1627
|
-
const o = t + e * i, n =
|
|
1627
|
+
const o = t + e * i, n = Ie(o, c.style);
|
|
1628
1628
|
return n ? { value: `${c.prefix}${n}${c.suffix}`, done: !1 } : { value: void 0, done: !0 };
|
|
1629
1629
|
}
|
|
1630
1630
|
};
|
|
1631
|
-
},
|
|
1631
|
+
}, it = (c) => {
|
|
1632
1632
|
if (c.length < 2)
|
|
1633
1633
|
return null;
|
|
1634
1634
|
const t = c[1] - c[0];
|
|
1635
1635
|
for (let e = 2; e < c.length; e += 1)
|
|
1636
|
-
if (Math.abs(c[e] - c[e - 1] - t) >
|
|
1636
|
+
if (Math.abs(c[e] - c[e - 1] - t) > xe)
|
|
1637
1637
|
return null;
|
|
1638
1638
|
return t;
|
|
1639
|
-
},
|
|
1639
|
+
}, Do = (c) => {
|
|
1640
1640
|
if (c.length < 2 || c[0] === 0)
|
|
1641
1641
|
return null;
|
|
1642
1642
|
const t = c[1] / c[0];
|
|
1643
1643
|
for (let e = 2; e < c.length; e += 1)
|
|
1644
|
-
if (c[e - 1] === 0 || Math.abs(c[e] / c[e - 1] - t) >
|
|
1644
|
+
if (c[e - 1] === 0 || Math.abs(c[e] / c[e - 1] - t) > xe)
|
|
1645
1645
|
return null;
|
|
1646
1646
|
return t;
|
|
1647
|
-
},
|
|
1648
|
-
const t = c.map((l) =>
|
|
1647
|
+
}, Ko = (c) => {
|
|
1648
|
+
const t = c.map((l) => wo(l));
|
|
1649
1649
|
if (t.every((l) => l !== null)) {
|
|
1650
1650
|
const l = t, a = l[0];
|
|
1651
1651
|
if (l.every(
|
|
1652
1652
|
(r) => r.prefix === a.prefix && r.suffix === a.suffix && r.format === a.format
|
|
1653
1653
|
)) {
|
|
1654
|
-
const r = l.map((d) => d.num), h =
|
|
1654
|
+
const r = l.map((d) => d.num), h = it(r);
|
|
1655
1655
|
if (h !== null) {
|
|
1656
1656
|
const d = l[l.length - 1];
|
|
1657
1657
|
return {
|
|
1658
1658
|
kind: "arithmetic",
|
|
1659
|
-
iterator:
|
|
1659
|
+
iterator: vo(
|
|
1660
1660
|
{ prefix: a.prefix, suffix: a.suffix, format: a.format },
|
|
1661
1661
|
d.num,
|
|
1662
1662
|
h
|
|
@@ -1665,17 +1665,17 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1665
1665
|
}
|
|
1666
1666
|
}
|
|
1667
1667
|
}
|
|
1668
|
-
const e = c.map((l) =>
|
|
1668
|
+
const e = c.map((l) => yo(l));
|
|
1669
1669
|
if (e.every(Boolean)) {
|
|
1670
1670
|
const l = e[0], a = e[e.length - 1];
|
|
1671
1671
|
if (e.every(
|
|
1672
1672
|
(r) => r?.prefix === l.prefix && r?.suffix === l.suffix
|
|
1673
1673
|
)) {
|
|
1674
|
-
const r = e.map((d) => d?.num ?? 0), h =
|
|
1674
|
+
const r = e.map((d) => d?.num ?? 0), h = it(r);
|
|
1675
1675
|
if (h !== null)
|
|
1676
1676
|
return {
|
|
1677
1677
|
kind: "arithmetic",
|
|
1678
|
-
iterator:
|
|
1678
|
+
iterator: bo(
|
|
1679
1679
|
{ prefix: a.prefix, suffix: a.suffix, width: a.width },
|
|
1680
1680
|
a.num,
|
|
1681
1681
|
h
|
|
@@ -1683,43 +1683,43 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1683
1683
|
};
|
|
1684
1684
|
}
|
|
1685
1685
|
}
|
|
1686
|
-
const i = c.map((l) =>
|
|
1686
|
+
const i = c.map((l) => Re(l));
|
|
1687
1687
|
if (i.every((l) => l !== null)) {
|
|
1688
|
-
const l = i, a =
|
|
1688
|
+
const l = i, a = it(l);
|
|
1689
1689
|
if (a !== null) {
|
|
1690
1690
|
const r = l[l.length - 1];
|
|
1691
1691
|
return {
|
|
1692
1692
|
kind: "arithmetic",
|
|
1693
|
-
iterator:
|
|
1693
|
+
iterator: Co(r, a)
|
|
1694
1694
|
};
|
|
1695
1695
|
}
|
|
1696
1696
|
}
|
|
1697
|
-
const o = c.map((l) =>
|
|
1697
|
+
const o = c.map((l) => ke(l));
|
|
1698
1698
|
if (o.every((l) => l !== null)) {
|
|
1699
1699
|
const l = o, a = l[0].style;
|
|
1700
1700
|
if (l.every((r) => r.style === a)) {
|
|
1701
|
-
const r = l.map((d) => d.num), h =
|
|
1701
|
+
const r = l.map((d) => d.num), h = it(r);
|
|
1702
1702
|
if (h !== null) {
|
|
1703
1703
|
const d = l[l.length - 1];
|
|
1704
1704
|
return {
|
|
1705
1705
|
kind: "arithmetic",
|
|
1706
|
-
iterator:
|
|
1706
|
+
iterator: Ho(d.num, h, d.style)
|
|
1707
1707
|
};
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
1710
|
}
|
|
1711
|
-
const n = c.map((l) =>
|
|
1711
|
+
const n = c.map((l) => Ro(l));
|
|
1712
1712
|
if (n.every((l) => l !== null)) {
|
|
1713
1713
|
const l = n, a = l[0];
|
|
1714
1714
|
if (l.every(
|
|
1715
1715
|
(r) => r.prefix === a.prefix && r.suffix === a.suffix
|
|
1716
1716
|
)) {
|
|
1717
|
-
const r = l.map((d) => d.num), h =
|
|
1717
|
+
const r = l.map((d) => d.num), h = it(r);
|
|
1718
1718
|
if (h !== null) {
|
|
1719
1719
|
const d = r[r.length - 1];
|
|
1720
1720
|
return {
|
|
1721
1721
|
kind: "arithmetic",
|
|
1722
|
-
iterator:
|
|
1722
|
+
iterator: Mo(
|
|
1723
1723
|
{ prefix: a.prefix, suffix: a.suffix },
|
|
1724
1724
|
d,
|
|
1725
1725
|
h
|
|
@@ -1728,18 +1728,18 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1728
1728
|
}
|
|
1729
1729
|
}
|
|
1730
1730
|
}
|
|
1731
|
-
const s = c.map((l) =>
|
|
1731
|
+
const s = c.map((l) => Ao(l));
|
|
1732
1732
|
if (s.every((l) => l !== null)) {
|
|
1733
1733
|
const l = s, a = l[0];
|
|
1734
1734
|
if (l.every(
|
|
1735
1735
|
(r) => r.prefix === a.prefix && r.suffix === a.suffix && r.style === a.style
|
|
1736
1736
|
)) {
|
|
1737
|
-
const r = l.map((d) => d.num), h =
|
|
1737
|
+
const r = l.map((d) => d.num), h = it(r);
|
|
1738
1738
|
if (h !== null) {
|
|
1739
1739
|
const d = l[l.length - 1];
|
|
1740
1740
|
return {
|
|
1741
1741
|
kind: "arithmetic",
|
|
1742
|
-
iterator:
|
|
1742
|
+
iterator: Lo(
|
|
1743
1743
|
{ prefix: a.prefix, suffix: a.suffix, style: a.style },
|
|
1744
1744
|
d.num,
|
|
1745
1745
|
h
|
|
@@ -1749,55 +1749,55 @@ const ge = 1e-9, Zi = 100, to = (c) => ({
|
|
|
1749
1749
|
}
|
|
1750
1750
|
}
|
|
1751
1751
|
return null;
|
|
1752
|
-
},
|
|
1752
|
+
}, _o = (c, t) => {
|
|
1753
1753
|
const e = t.match(c);
|
|
1754
1754
|
return e ? {
|
|
1755
1755
|
kind: "list",
|
|
1756
|
-
iterator:
|
|
1756
|
+
iterator: fo(e, c)
|
|
1757
1757
|
} : null;
|
|
1758
1758
|
};
|
|
1759
|
-
function
|
|
1760
|
-
const e = t?.registry ??
|
|
1759
|
+
function Pt(c, t) {
|
|
1760
|
+
const e = t?.registry ?? Ce();
|
|
1761
1761
|
if (c.length === 0)
|
|
1762
|
-
return
|
|
1762
|
+
return Q.fromSeed(c, "seed-repeat", pe(c));
|
|
1763
1763
|
if (c.length === 1)
|
|
1764
|
-
return
|
|
1765
|
-
if (
|
|
1766
|
-
const i =
|
|
1764
|
+
return Q.fromSeed(c, "copy", ao(c[0]));
|
|
1765
|
+
if (go(c)) {
|
|
1766
|
+
const i = _o(c, e);
|
|
1767
1767
|
if (i)
|
|
1768
|
-
return
|
|
1769
|
-
const o =
|
|
1768
|
+
return Q.fromSeed(c, i.kind, i.iterator);
|
|
1769
|
+
const o = Ko(c);
|
|
1770
1770
|
if (o)
|
|
1771
|
-
return
|
|
1771
|
+
return Q.fromSeed(c, o.kind, o.iterator);
|
|
1772
1772
|
}
|
|
1773
|
-
if (
|
|
1774
|
-
const i =
|
|
1773
|
+
if (po(c)) {
|
|
1774
|
+
const i = it(c);
|
|
1775
1775
|
if (i !== null)
|
|
1776
|
-
return
|
|
1776
|
+
return Q.fromSeed(
|
|
1777
1777
|
c,
|
|
1778
1778
|
"arithmetic",
|
|
1779
|
-
|
|
1779
|
+
co(c[c.length - 1], i)
|
|
1780
1780
|
);
|
|
1781
|
-
const o =
|
|
1781
|
+
const o = Do(c);
|
|
1782
1782
|
if (o !== null)
|
|
1783
|
-
return
|
|
1783
|
+
return Q.fromSeed(
|
|
1784
1784
|
c,
|
|
1785
1785
|
"geometric",
|
|
1786
|
-
|
|
1786
|
+
uo(c[c.length - 1], o)
|
|
1787
1787
|
);
|
|
1788
1788
|
}
|
|
1789
|
-
if (
|
|
1790
|
-
const i = c.map((n) => n.getTime()), o =
|
|
1789
|
+
if (mo(c)) {
|
|
1790
|
+
const i = c.map((n) => n.getTime()), o = it(i);
|
|
1791
1791
|
if (o !== null)
|
|
1792
|
-
return
|
|
1792
|
+
return Q.fromSeed(
|
|
1793
1793
|
c,
|
|
1794
1794
|
"arithmetic",
|
|
1795
|
-
|
|
1795
|
+
ho(c[c.length - 1], o)
|
|
1796
1796
|
);
|
|
1797
1797
|
}
|
|
1798
|
-
return
|
|
1798
|
+
return Q.fromSeed(c, "seed-repeat", pe(c));
|
|
1799
1799
|
}
|
|
1800
|
-
function
|
|
1800
|
+
function Fo(c) {
|
|
1801
1801
|
return {
|
|
1802
1802
|
...c,
|
|
1803
1803
|
startRow: Math.min(c.startRow, c.endRow),
|
|
@@ -1806,7 +1806,7 @@ function To(c) {
|
|
|
1806
1806
|
endCol: Math.max(c.startCol, c.endCol)
|
|
1807
1807
|
};
|
|
1808
1808
|
}
|
|
1809
|
-
function
|
|
1809
|
+
function Vo(c) {
|
|
1810
1810
|
if (c instanceof Date) return c;
|
|
1811
1811
|
if (typeof c == "number" && Number.isFinite(c)) return new Date(c);
|
|
1812
1812
|
if (typeof c == "string") {
|
|
@@ -1820,7 +1820,7 @@ function Eo(c) {
|
|
|
1820
1820
|
}
|
|
1821
1821
|
return null;
|
|
1822
1822
|
}
|
|
1823
|
-
function
|
|
1823
|
+
function No(c) {
|
|
1824
1824
|
if (c instanceof Date) return c;
|
|
1825
1825
|
if (typeof c == "number" && Number.isFinite(c)) return new Date(c);
|
|
1826
1826
|
if (typeof c == "string") {
|
|
@@ -1829,9 +1829,9 @@ function Ao(c) {
|
|
|
1829
1829
|
}
|
|
1830
1830
|
return null;
|
|
1831
1831
|
}
|
|
1832
|
-
function
|
|
1832
|
+
function Te(c, t) {
|
|
1833
1833
|
if (t.length !== 1) return null;
|
|
1834
|
-
const e =
|
|
1834
|
+
const e = Fo(t[0]);
|
|
1835
1835
|
if (e.kind !== "cells") return null;
|
|
1836
1836
|
const i = e.endCol - e.startCol + 1, o = e.endRow - e.startRow + 1;
|
|
1837
1837
|
if (i !== 1 || o < 1) return null;
|
|
@@ -1850,7 +1850,7 @@ function xe(c, t) {
|
|
|
1850
1850
|
mode: "sequence"
|
|
1851
1851
|
} : null : null;
|
|
1852
1852
|
}
|
|
1853
|
-
function
|
|
1853
|
+
function Po(c, t, e) {
|
|
1854
1854
|
const i = c.getSchema(), o = c.listRows(), n = i.columns[t.colIndex];
|
|
1855
1855
|
if (!n) return null;
|
|
1856
1856
|
const s = [];
|
|
@@ -1863,14 +1863,14 @@ function Ho(c, t, e) {
|
|
|
1863
1863
|
const a = s[s.length - 1];
|
|
1864
1864
|
return () => a;
|
|
1865
1865
|
}
|
|
1866
|
-
const l =
|
|
1866
|
+
const l = Ce(e);
|
|
1867
1867
|
if (n.type === "number") {
|
|
1868
|
-
const a = s.map((
|
|
1869
|
-
if (!a.every((
|
|
1870
|
-
const r =
|
|
1868
|
+
const a = s.map((f) => typeof f == "number" ? f : Number(f));
|
|
1869
|
+
if (!a.every((f) => Number.isFinite(f))) return null;
|
|
1870
|
+
const r = Pt(a, { registry: l }), h = [];
|
|
1871
1871
|
let d = !1;
|
|
1872
|
-
return (
|
|
1873
|
-
for (; !d && h.length <
|
|
1872
|
+
return (f) => {
|
|
1873
|
+
for (; !d && h.length < f; ) {
|
|
1874
1874
|
const p = r.next();
|
|
1875
1875
|
if (p.done) {
|
|
1876
1876
|
d = !0;
|
|
@@ -1878,18 +1878,18 @@ function Ho(c, t, e) {
|
|
|
1878
1878
|
}
|
|
1879
1879
|
h.push(p.value);
|
|
1880
1880
|
}
|
|
1881
|
-
return
|
|
1881
|
+
return f <= 0 ? null : h[f - 1] ?? null;
|
|
1882
1882
|
};
|
|
1883
1883
|
}
|
|
1884
1884
|
if (n.type === "date" || n.type === "time" || n.type === "datetime") {
|
|
1885
1885
|
const a = s.map(
|
|
1886
|
-
(
|
|
1886
|
+
(f) => n.type === "time" ? Vo(f) : No(f)
|
|
1887
1887
|
);
|
|
1888
|
-
if (!a.every((
|
|
1889
|
-
const r =
|
|
1888
|
+
if (!a.every((f) => f instanceof Date)) return null;
|
|
1889
|
+
const r = Pt(a, { registry: l }), h = [];
|
|
1890
1890
|
let d = !1;
|
|
1891
|
-
return (
|
|
1892
|
-
for (; !d && h.length <
|
|
1891
|
+
return (f) => {
|
|
1892
|
+
for (; !d && h.length < f; ) {
|
|
1893
1893
|
const p = r.next();
|
|
1894
1894
|
if (p.done) {
|
|
1895
1895
|
d = !0;
|
|
@@ -1897,14 +1897,14 @@ function Ho(c, t, e) {
|
|
|
1897
1897
|
}
|
|
1898
1898
|
h.push(p.value);
|
|
1899
1899
|
}
|
|
1900
|
-
return
|
|
1900
|
+
return f <= 0 ? null : h[f - 1] ?? null;
|
|
1901
1901
|
};
|
|
1902
1902
|
}
|
|
1903
1903
|
if (n.type === "string") {
|
|
1904
|
-
const a = s.map((
|
|
1904
|
+
const a = s.map((f) => String(f ?? "")), r = Pt(a, { registry: l }), h = [];
|
|
1905
1905
|
let d = !1;
|
|
1906
|
-
return (
|
|
1907
|
-
for (; !d && h.length <
|
|
1906
|
+
return (f) => {
|
|
1907
|
+
for (; !d && h.length < f; ) {
|
|
1908
1908
|
const p = r.next();
|
|
1909
1909
|
if (p.done) {
|
|
1910
1910
|
d = !0;
|
|
@@ -1912,29 +1912,48 @@ function Ho(c, t, e) {
|
|
|
1912
1912
|
}
|
|
1913
1913
|
h.push(p.value);
|
|
1914
1914
|
}
|
|
1915
|
-
return
|
|
1915
|
+
return f <= 0 ? null : h[f - 1] ?? null;
|
|
1916
1916
|
};
|
|
1917
1917
|
}
|
|
1918
1918
|
return null;
|
|
1919
1919
|
}
|
|
1920
|
-
const
|
|
1921
|
-
function
|
|
1920
|
+
const Ee = 12, Ae = 14;
|
|
1921
|
+
function He(c, t = Ee) {
|
|
1922
1922
|
return new DOMRect(c.right - t - 1, c.bottom - t - 1, t, t);
|
|
1923
1923
|
}
|
|
1924
|
-
function
|
|
1924
|
+
function Le(c, t, e) {
|
|
1925
1925
|
return c >= e.left && c <= e.right && t >= e.top && t <= e.bottom;
|
|
1926
1926
|
}
|
|
1927
|
-
function
|
|
1927
|
+
function Ht(c, t, e, i, o) {
|
|
1928
1928
|
if (o === "readonly") return !1;
|
|
1929
|
-
const n =
|
|
1929
|
+
const n = Te(c, t);
|
|
1930
1930
|
return !(!n || !e || e === "__all__" || i === null || i === "__all__" || i === null || i !== n.colKey || c.isReadonly(e, i));
|
|
1931
1931
|
}
|
|
1932
|
-
const
|
|
1933
|
-
function
|
|
1932
|
+
const me = (c) => c === !0 || c === "true" || c === "1" || c === 1;
|
|
1933
|
+
function De(c, t, e) {
|
|
1934
|
+
const i = /* @__PURE__ */ new Map();
|
|
1935
|
+
if (t.size === 0) return i;
|
|
1936
|
+
const o = /* @__PURE__ */ new Set();
|
|
1937
|
+
for (const n of c.columns)
|
|
1938
|
+
n && n.type === "boolean" && n.unique && o.add(String(n.key));
|
|
1939
|
+
if (o.size === 0) return i;
|
|
1940
|
+
for (const [n, s] of t)
|
|
1941
|
+
for (const [l, a] of Object.entries(s)) {
|
|
1942
|
+
const r = String(l);
|
|
1943
|
+
if (!o.has(r)) continue;
|
|
1944
|
+
const h = e(n, r), d = me(h), f = me(a);
|
|
1945
|
+
if (d === f) continue;
|
|
1946
|
+
const p = i.get(r) ?? { currentRowId: null, previousRowId: null };
|
|
1947
|
+
f && !d && (p.currentRowId = n), d && !f && (p.previousRowId = n), i.set(r, p);
|
|
1948
|
+
}
|
|
1949
|
+
return i;
|
|
1950
|
+
}
|
|
1951
|
+
const Z = '"Inter","Segoe UI",system-ui,-apple-system,"Helvetica Neue",sans-serif', et = 13.5, Bo = 10;
|
|
1952
|
+
function Ke(c, t) {
|
|
1934
1953
|
const e = c.sorts?.[0];
|
|
1935
1954
|
return e && e.key === t ? e.dir : null;
|
|
1936
1955
|
}
|
|
1937
|
-
function
|
|
1956
|
+
function _e(c, t) {
|
|
1938
1957
|
if ((c.filters ?? []).some((o) => {
|
|
1939
1958
|
const n = o;
|
|
1940
1959
|
return n?.kind === "values" && n.key === t;
|
|
@@ -1942,27 +1961,27 @@ function Te(c, t) {
|
|
|
1942
1961
|
const i = c.columnDiagnostics?.[t];
|
|
1943
1962
|
return !!(i?.errors || i?.warnings);
|
|
1944
1963
|
}
|
|
1945
|
-
function
|
|
1964
|
+
function Wo() {
|
|
1946
1965
|
return `
|
|
1947
1966
|
<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false">
|
|
1948
1967
|
<path d="M3 5h18l-7 8v6l-4 2v-8L3 5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
|
|
1949
1968
|
</svg>
|
|
1950
1969
|
`.trim();
|
|
1951
1970
|
}
|
|
1952
|
-
function
|
|
1971
|
+
function $o(c) {
|
|
1953
1972
|
return `
|
|
1954
1973
|
<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false">
|
|
1955
1974
|
<path d="${c === "asc" ? "M12 6l6 8H6l6-8z" : "M12 18l-6-8h12l-6 8z"}" fill="currentColor"/>
|
|
1956
1975
|
</svg>
|
|
1957
1976
|
`.trim();
|
|
1958
1977
|
}
|
|
1959
|
-
function
|
|
1978
|
+
function Oo(c, t, e, i, o, n) {
|
|
1960
1979
|
const s = Math.min(10, Math.floor(Math.min(i, o) / 2));
|
|
1961
1980
|
if (s <= 0) return;
|
|
1962
1981
|
const l = n === "error" ? "#ef4444" : "#f59e0b";
|
|
1963
1982
|
c.save(), c.fillStyle = l, c.beginPath(), c.moveTo(t + i, e), c.lineTo(t + i - s, e), c.lineTo(t + i, e + s), c.closePath(), c.fill(), c.restore();
|
|
1964
1983
|
}
|
|
1965
|
-
class
|
|
1984
|
+
class Fe {
|
|
1966
1985
|
constructor() {
|
|
1967
1986
|
this.numberFormatCache = /* @__PURE__ */ new Map(), this.dateParseCache = /* @__PURE__ */ new Map();
|
|
1968
1987
|
}
|
|
@@ -1974,17 +1993,17 @@ class Ee {
|
|
|
1974
1993
|
parseIsoDate(t) {
|
|
1975
1994
|
const e = this.dateParseCache.get(t);
|
|
1976
1995
|
if (e) return e;
|
|
1977
|
-
const i =
|
|
1996
|
+
const i = Xe(t);
|
|
1978
1997
|
return !i || Number.isNaN(i.getTime()) ? null : (this.dateParseCache.set(t, i), i);
|
|
1979
1998
|
}
|
|
1980
1999
|
}
|
|
1981
|
-
function
|
|
2000
|
+
function jo(c, t, e, i, o) {
|
|
1982
2001
|
c.save(), c.globalAlpha = o, c.strokeStyle = "rgba(15,23,42,1)", c.lineWidth = 2, c.lineJoin = "round", c.beginPath(), c.moveTo(t, e), c.lineTo(t + i, e), c.lineTo(t + Math.round(i * 0.62), e + Math.round(i * 0.46)), c.lineTo(t + Math.round(i * 0.38), e + Math.round(i * 0.46)), c.closePath(), c.stroke(), c.beginPath(), c.moveTo(t + Math.round(i * 0.46), e + Math.round(i * 0.46)), c.lineTo(t + Math.round(i * 0.46), e + i), c.lineTo(t + Math.round(i * 0.54), e + i - 2), c.lineTo(t + Math.round(i * 0.54), e + Math.round(i * 0.46)), c.stroke(), c.restore();
|
|
1983
2002
|
}
|
|
1984
|
-
function
|
|
2003
|
+
function qo(c, t, e, i, o, n) {
|
|
1985
2004
|
c.save(), c.globalAlpha = o, c.fillStyle = "rgba(15,23,42,1)", c.beginPath(), n === "asc" ? (c.moveTo(t + i / 2, e), c.lineTo(t + i, e + i), c.lineTo(t, e + i)) : (c.moveTo(t, e), c.lineTo(t + i, e), c.lineTo(t + i / 2, e + i)), c.closePath(), c.fill(), c.restore();
|
|
1986
2005
|
}
|
|
1987
|
-
function
|
|
2006
|
+
function zt(c) {
|
|
1988
2007
|
if (Array.isArray(c) && c.every((t) => typeof t == "string"))
|
|
1989
2008
|
return c;
|
|
1990
2009
|
if (c && typeof c == "object") {
|
|
@@ -1997,17 +2016,17 @@ function $t(c) {
|
|
|
1997
2016
|
}
|
|
1998
2017
|
return null;
|
|
1999
2018
|
}
|
|
2000
|
-
function
|
|
2019
|
+
function Ve(c) {
|
|
2001
2020
|
if (!c || typeof c != "object") return null;
|
|
2002
2021
|
const t = c;
|
|
2003
2022
|
return typeof t.kind == "string" ? null : typeof t.label == "string" && "value" in t ? t.label : null;
|
|
2004
2023
|
}
|
|
2005
|
-
class
|
|
2024
|
+
class Gt {
|
|
2006
2025
|
constructor(t) {
|
|
2007
2026
|
this.n = t, this.tree = new Array(t + 1).fill(0);
|
|
2008
2027
|
}
|
|
2009
2028
|
static from(t) {
|
|
2010
|
-
const e = new
|
|
2029
|
+
const e = new Gt(t.length);
|
|
2011
2030
|
for (let i = 0; i < t.length; i += 1) e.add(i, t[i] ?? 0);
|
|
2012
2031
|
return e;
|
|
2013
2032
|
}
|
|
@@ -2047,9 +2066,9 @@ class jt {
|
|
|
2047
2066
|
return Math.min(this.n - 1, i);
|
|
2048
2067
|
}
|
|
2049
2068
|
}
|
|
2050
|
-
class
|
|
2069
|
+
class Tt {
|
|
2051
2070
|
constructor(t) {
|
|
2052
|
-
this.dataModel = t, this.tableEl = null, this.defaultRowHeight =
|
|
2071
|
+
this.dataModel = t, this.tableEl = null, this.defaultRowHeight = wt, this.rowHeaderWidth = ct, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Fe(), this.measureCache = /* @__PURE__ */ new Map(), this.frame = 0;
|
|
2053
2072
|
}
|
|
2054
2073
|
mount(t) {
|
|
2055
2074
|
this.tableEl = document.createElement("table"), this.tableEl.dataset.extableRenderer = "html", t.innerHTML = "", t.appendChild(this.tableEl), this.render();
|
|
@@ -2064,14 +2083,20 @@ class St {
|
|
|
2064
2083
|
if (this.frame += 1, !this.tableEl) return;
|
|
2065
2084
|
const e = this.tableEl.parentElement, i = e?.scrollTop ?? 0, o = e?.scrollLeft ?? 0, n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows();
|
|
2066
2085
|
this.tableEl.innerHTML = "";
|
|
2067
|
-
const a =
|
|
2086
|
+
const a = J(n, s), r = n.columns.map((m) => Bt(m)), h = r.map((m) => ae(m)), d = this.rowHeaderWidth + a.reduce((m, g) => m + (g ?? 0), 0);
|
|
2068
2087
|
this.tableEl.style.width = `${d}px`, this.tableEl.appendChild(this.renderHeader(n, a));
|
|
2069
|
-
const
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2088
|
+
const f = De(
|
|
2089
|
+
n,
|
|
2090
|
+
this.dataModel.getPending(),
|
|
2091
|
+
(m, g) => this.dataModel.getRawCell(m, g)
|
|
2092
|
+
), p = document.createElement("tbody");
|
|
2093
|
+
for (const m of l)
|
|
2094
|
+
p.appendChild(
|
|
2095
|
+
this.renderRow(m, n, a, r, h, f)
|
|
2096
|
+
);
|
|
2097
|
+
this.tableEl.appendChild(p), this.updateActiveClasses(), this.applySelectionClasses(), e && (e.scrollTop = i, e.scrollLeft = o);
|
|
2098
|
+
for (const [m, g] of Array.from(this.measureCache.entries()))
|
|
2099
|
+
g.frame !== this.frame && this.measureCache.delete(m);
|
|
2075
2100
|
}
|
|
2076
2101
|
destroy() {
|
|
2077
2102
|
O(this.tableEl), this.tableEl = null;
|
|
@@ -2092,21 +2117,29 @@ class St {
|
|
|
2092
2117
|
};
|
|
2093
2118
|
const o = e.closest("th.extable-row-header:not(.extable-corner)");
|
|
2094
2119
|
if (o) {
|
|
2095
|
-
const
|
|
2096
|
-
if (
|
|
2120
|
+
const a = o.closest("tr[data-row-id]");
|
|
2121
|
+
if (a)
|
|
2097
2122
|
return {
|
|
2098
|
-
rowId:
|
|
2123
|
+
rowId: a.dataset.rowId ?? "",
|
|
2099
2124
|
colKey: null,
|
|
2100
2125
|
element: o,
|
|
2101
2126
|
rect: o.getBoundingClientRect()
|
|
2102
2127
|
};
|
|
2103
2128
|
}
|
|
2104
|
-
const n = e.closest("
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2129
|
+
const n = e.closest("th[data-col-key]:not(.extable-row-header)");
|
|
2130
|
+
if (n)
|
|
2131
|
+
return {
|
|
2132
|
+
rowId: "__header__",
|
|
2133
|
+
colKey: n.dataset.colKey ?? "",
|
|
2134
|
+
element: n,
|
|
2135
|
+
rect: n.getBoundingClientRect()
|
|
2136
|
+
};
|
|
2137
|
+
const s = e.closest("td[data-col-key]"), l = s?.closest("tr[data-row-id]");
|
|
2138
|
+
return !s || !l ? null : {
|
|
2139
|
+
rowId: l.dataset.rowId ?? "",
|
|
2140
|
+
colKey: s.dataset.colKey ?? "",
|
|
2141
|
+
element: s,
|
|
2142
|
+
rect: s.getBoundingClientRect()
|
|
2110
2143
|
};
|
|
2111
2144
|
}
|
|
2112
2145
|
hitTestAction(t) {
|
|
@@ -2146,98 +2179,102 @@ class St {
|
|
|
2146
2179
|
if (!a) continue;
|
|
2147
2180
|
const r = document.createElement("th");
|
|
2148
2181
|
r.dataset.colKey = a.key;
|
|
2149
|
-
const h =
|
|
2182
|
+
const h = Ke(s, a.key), d = _e(s, a.key);
|
|
2150
2183
|
h ? r.dataset.extableSortDir = h : r.removeAttribute("data-extable-sort-dir"), d ? r.dataset.extableFsActive = "1" : r.removeAttribute("data-extable-fs-active");
|
|
2151
|
-
const
|
|
2152
|
-
|
|
2184
|
+
const f = document.createElement("div");
|
|
2185
|
+
f.className = "extable-col-header";
|
|
2153
2186
|
const p = document.createElement("span");
|
|
2154
2187
|
p.className = "extable-col-header-text", p.textContent = a.header ?? a.key;
|
|
2155
2188
|
const m = document.createElement("button");
|
|
2156
|
-
m.type = "button", m.className = "extable-filter-sort-trigger", m.dataset.extableFsOpen = "1", m.dataset.extableColKey = a.key, m.title = "Filter / Sort", m.innerHTML = h ?
|
|
2157
|
-
const
|
|
2158
|
-
|
|
2189
|
+
m.type = "button", m.className = "extable-filter-sort-trigger", m.dataset.extableFsOpen = "1", m.dataset.extableColKey = a.key, m.title = "Filter / Sort", m.innerHTML = h ? $o(h) : Wo(), f.appendChild(p), f.appendChild(m), r.appendChild(f);
|
|
2190
|
+
const g = e[l] ?? a.width;
|
|
2191
|
+
g && (r.style.width = `${g}px`), r.dataset.colKey = a.key, this.activeColKey !== null && this.activeColKey === a.key && r.classList.add("extable-active-col-header"), o.appendChild(r);
|
|
2159
2192
|
}
|
|
2160
2193
|
return i.appendChild(o), i;
|
|
2161
2194
|
}
|
|
2162
|
-
renderRow(t, e, i, o, n) {
|
|
2163
|
-
const
|
|
2164
|
-
|
|
2165
|
-
const
|
|
2166
|
-
|
|
2167
|
-
const
|
|
2168
|
-
|
|
2169
|
-
for (let
|
|
2170
|
-
const
|
|
2171
|
-
if (!
|
|
2172
|
-
const
|
|
2173
|
-
|
|
2174
|
-
const
|
|
2175
|
-
if (!
|
|
2176
|
-
const
|
|
2177
|
-
|
|
2195
|
+
renderRow(t, e, i, o, n, s) {
|
|
2196
|
+
const l = document.createElement("tr");
|
|
2197
|
+
l.dataset.rowId = t.id, l.style.height = `${this.defaultRowHeight}px`, e.columns.some((p) => p && p.type === "boolean" && p.unique && this.dataModel.getCell(t.id, p.key) === !0) && l.classList.add("extable-row--unique-true");
|
|
2198
|
+
const r = this.dataModel.getView(), h = document.createElement("th");
|
|
2199
|
+
h.scope = "row", h.classList.add("extable-row-header");
|
|
2200
|
+
const d = this.dataModel.getDisplayIndex(t.id) ?? "";
|
|
2201
|
+
h.textContent = String(d), this.activeRowId === t.id && h.classList.add("extable-active-row-header"), l.appendChild(h);
|
|
2202
|
+
for (let p = 0; p < e.columns.length; p += 1) {
|
|
2203
|
+
const m = e.columns[p];
|
|
2204
|
+
if (!m) continue;
|
|
2205
|
+
const g = document.createElement("td");
|
|
2206
|
+
g.classList.add("extable-cell"), g.dataset.colKey = m.key, m.type === "boolean" && g.classList.add("extable-boolean");
|
|
2207
|
+
const S = this.dataModel.hasPending(t.id, m.key), v = this.dataModel.resolveConditionalStyle(t.id, m), u = this.dataModel.getCellStyle(t.id, m.key), w = !!(u?.textColor || v.delta?.textColor || m.style?.textColor);
|
|
2208
|
+
if (!u && !v.delta && !S) {
|
|
2209
|
+
const I = n[p] ?? "";
|
|
2210
|
+
I && (g.style.cssText = I);
|
|
2178
2211
|
} else {
|
|
2179
|
-
const
|
|
2180
|
-
E && (
|
|
2212
|
+
const I = o[p] ?? {}, F = v.delta ? ht(I, v.delta) : I, B = u ? ht(F, u) : F, T = S ? { ...B, textColor: void 0 } : B, E = ae(T);
|
|
2213
|
+
E && (g.style.cssText = E);
|
|
2181
2214
|
}
|
|
2182
|
-
const y =
|
|
2183
|
-
|
|
2184
|
-
const
|
|
2185
|
-
if (
|
|
2186
|
-
const
|
|
2187
|
-
|
|
2188
|
-
const
|
|
2189
|
-
|
|
2215
|
+
const y = r.wrapText?.[m.key] ?? m.wrapText;
|
|
2216
|
+
g.classList.add(y ? "cell-wrap" : "cell-nowrap");
|
|
2217
|
+
const C = this.dataModel.getRawCell(t.id, m.key), b = this.dataModel.resolveCellValue(t.id, m), M = b.textOverride ?? (v.forceErrorText ? "#ERROR" : void 0), x = M ? { text: M } : this.formatValue(b.value, m), L = this.dataModel.getCellInteraction(t.id, m.key), K = m.type === "tags" && !M ? zt(b.value) : null, _ = m.type === "button" || m.type === "link", R = _ ? m.type === "button" ? vt(b.value) : bt(b.value) : null, A = _ ? m.type === "button" ? ut(b.value) : ft(b.value) : "";
|
|
2218
|
+
if (K && K.length) {
|
|
2219
|
+
const I = document.createElement("div");
|
|
2220
|
+
I.className = "extable-tag-list", K.forEach((F, B) => {
|
|
2221
|
+
const T = document.createElement("span");
|
|
2222
|
+
T.className = "extable-tag";
|
|
2190
2223
|
const E = document.createElement("span");
|
|
2191
|
-
E.className = "extable-tag-label", E.textContent =
|
|
2192
|
-
const
|
|
2193
|
-
|
|
2194
|
-
}),
|
|
2195
|
-
} else if (
|
|
2196
|
-
const
|
|
2197
|
-
|
|
2198
|
-
} else if (
|
|
2199
|
-
if (
|
|
2200
|
-
const
|
|
2201
|
-
|
|
2224
|
+
E.className = "extable-tag-label", E.textContent = F;
|
|
2225
|
+
const H = document.createElement("button");
|
|
2226
|
+
H.type = "button", H.className = "extable-tag-remove", H.dataset.extableTagRemove = "1", H.dataset.extableTagIndex = String(B), H.textContent = "×", (L.readonly || L.disabled) && (H.disabled = !0), T.appendChild(E), T.appendChild(H), I.appendChild(T);
|
|
2227
|
+
}), g.replaceChildren(I);
|
|
2228
|
+
} else if (_ && !M && R && A) {
|
|
2229
|
+
const I = m.type === "button" ? document.createElement("button") : document.createElement("span");
|
|
2230
|
+
I instanceof HTMLButtonElement && (I.type = "button"), I.className = m.type === "button" ? "extable-action-button" : "extable-action-link", L.disabled && I.classList.add("extable-action-disabled"), m.type === "link" && w && (I.style.color = "inherit"), I.dataset.extableAction = m.type, I.textContent = A, g.replaceChildren(I);
|
|
2231
|
+
} else if (m.type === "boolean" && !M)
|
|
2232
|
+
if (m.unique) {
|
|
2233
|
+
const I = document.createElement("span");
|
|
2234
|
+
I.className = "extable-unique-radio", I.setAttribute("role", "radio");
|
|
2235
|
+
const F = !!b.value;
|
|
2236
|
+
I.setAttribute("aria-checked", F ? "true" : "false"), (L.readonly || L.disabled) && (I.setAttribute("aria-disabled", "true"), I.classList.add("extable-unique-radio--disabled"));
|
|
2237
|
+
const B = s.get(String(m.key));
|
|
2238
|
+
B?.currentRowId === t.id ? I.classList.add("extable-unique-dot-current") : B?.previousRowId === t.id ? I.classList.add("extable-unique-dot-previous") : F && I.classList.add("extable-unique-dot-default"), I.setAttribute("aria-label", m.header ?? String(m.key)), g.replaceChildren(I);
|
|
2202
2239
|
} else
|
|
2203
|
-
|
|
2240
|
+
g.textContent = x.text, x.color && (g.style.color = x.color);
|
|
2204
2241
|
else
|
|
2205
|
-
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2208
|
-
const
|
|
2209
|
-
|
|
2210
|
-
const
|
|
2211
|
-
if (
|
|
2212
|
-
|
|
2242
|
+
g.textContent = A || x.text, x.color && (g.style.color = x.color);
|
|
2243
|
+
const D = this.dataModel.getCellMarker(t.id, m.key);
|
|
2244
|
+
D ? (g.classList.toggle("extable-diag-warning", D.level === "warning"), g.classList.toggle("extable-diag-error", D.level === "error"), g.dataset.extableDiagMessage = D.message) : (g.classList.remove("extable-diag-warning", "extable-diag-error"), g.removeAttribute("data-extable-diag-message"));
|
|
2245
|
+
const P = m.style?.align ?? (m.type === "number" || m.type === "int" || m.type === "uint" ? "right" : "left");
|
|
2246
|
+
g.classList.add(P === "right" ? "align-right" : "align-left");
|
|
2247
|
+
const j = Ue(C, b.value, m);
|
|
2248
|
+
if (j !== null)
|
|
2249
|
+
g.dataset.raw = j;
|
|
2213
2250
|
else {
|
|
2214
|
-
const
|
|
2215
|
-
|
|
2251
|
+
const I = C == null ? "" : String(C);
|
|
2252
|
+
g.dataset.raw = I;
|
|
2216
2253
|
}
|
|
2217
|
-
|
|
2218
|
-
}
|
|
2219
|
-
if (e.columns.some((
|
|
2220
|
-
let
|
|
2221
|
-
for (let
|
|
2222
|
-
const
|
|
2223
|
-
if (!
|
|
2224
|
-
const
|
|
2225
|
-
if (
|
|
2226
|
-
|
|
2254
|
+
S && g.classList.add("pending"), L.readonly ? (g.classList.add("extable-readonly"), m.formula && g.classList.add("extable-readonly-formula")) : g.classList.add("extable-editable"), L.muted && g.classList.add("extable-readonly-muted"), L.disabled && g.classList.add("extable-disabled"), this.activeRowId === t.id && this.activeColKey !== null && this.activeColKey === m.key && g.classList.add("extable-active-cell"), l.appendChild(g);
|
|
2255
|
+
}
|
|
2256
|
+
if (e.columns.some((p) => r.wrapText?.[p.key] ?? p.wrapText)) {
|
|
2257
|
+
let p = this.defaultRowHeight;
|
|
2258
|
+
for (let m = 0; m < e.columns.length; m += 1) {
|
|
2259
|
+
const g = e.columns[m];
|
|
2260
|
+
if (!g || !g.wrapText) continue;
|
|
2261
|
+
const S = i[m] ?? r.columnWidths?.[g.key] ?? g.width ?? 100, v = this.dataModel.resolveCellValue(t.id, g), u = this.dataModel.resolveConditionalStyle(t.id, g), y = v.textOverride ?? (u.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(v.value, g).text, C = this.dataModel.getRowVersion(t.id), b = `${t.id}|${g.key}|${C}|${S}|${y}`, M = this.measureCache.get(b);
|
|
2262
|
+
if (M) {
|
|
2263
|
+
M.frame = this.frame, this.measureCache.set(b, M), p = Math.max(p, M.height);
|
|
2227
2264
|
continue;
|
|
2228
2265
|
}
|
|
2229
|
-
const
|
|
2230
|
-
|
|
2231
|
-
const
|
|
2232
|
-
if (!
|
|
2233
|
-
|
|
2234
|
-
const
|
|
2235
|
-
|
|
2266
|
+
const x = document.createElement("span");
|
|
2267
|
+
x.style.visibility = "hidden", x.style.position = "absolute", x.style.left = "-10000px", x.style.top = "0", x.style.whiteSpace = "pre-wrap", x.style.overflowWrap = "anywhere", x.style.display = "inline-block", x.style.width = `${S}px`, x.textContent = y;
|
|
2268
|
+
const L = this.tableEl?.parentElement;
|
|
2269
|
+
if (!L) continue;
|
|
2270
|
+
L.appendChild(x);
|
|
2271
|
+
const K = x.clientHeight + dt + Et + 2;
|
|
2272
|
+
x.remove(), this.measureCache.set(b, { height: K, frame: this.frame }), p = Math.max(p, K);
|
|
2236
2273
|
}
|
|
2237
|
-
|
|
2274
|
+
l.style.height = `${p}px`, this.dataModel.setRowHeight(t.id, p);
|
|
2238
2275
|
} else
|
|
2239
|
-
|
|
2240
|
-
return
|
|
2276
|
+
l.style.height = `${this.defaultRowHeight}px`, this.dataModel.setRowHeight(t.id, this.defaultRowHeight);
|
|
2277
|
+
return l;
|
|
2241
2278
|
}
|
|
2242
2279
|
updateActiveClasses() {
|
|
2243
2280
|
if (!this.tableEl) return;
|
|
@@ -2284,8 +2321,8 @@ class St {
|
|
|
2284
2321
|
const h = r.querySelector("th.extable-row-header");
|
|
2285
2322
|
h && h.classList.add("extable-selected");
|
|
2286
2323
|
const d = Array.from(r.querySelectorAll("td"));
|
|
2287
|
-
for (let
|
|
2288
|
-
const p = d[
|
|
2324
|
+
for (let f = s; f <= l; f += 1) {
|
|
2325
|
+
const p = d[f];
|
|
2289
2326
|
p && p.classList.add("extable-selected");
|
|
2290
2327
|
}
|
|
2291
2328
|
}
|
|
@@ -2297,15 +2334,15 @@ class St {
|
|
|
2297
2334
|
const i = t;
|
|
2298
2335
|
if (i.kind === "lookup" && typeof i.label == "string")
|
|
2299
2336
|
return { text: i.label };
|
|
2300
|
-
const o =
|
|
2337
|
+
const o = Ve(t);
|
|
2301
2338
|
if (o !== null) return { text: o };
|
|
2302
2339
|
}
|
|
2303
2340
|
if (e.type === "button")
|
|
2304
|
-
return { text:
|
|
2341
|
+
return { text: ut(t) || String(t) };
|
|
2305
2342
|
if (e.type === "link")
|
|
2306
|
-
return { text:
|
|
2343
|
+
return { text: ft(t) || String(t) };
|
|
2307
2344
|
if (e.type === "tags") {
|
|
2308
|
-
const i =
|
|
2345
|
+
const i = zt(t);
|
|
2309
2346
|
if (i) return { text: i.join(", ") };
|
|
2310
2347
|
}
|
|
2311
2348
|
if (e.type === "boolean")
|
|
@@ -2313,7 +2350,7 @@ class St {
|
|
|
2313
2350
|
if (e.type === "number" && typeof t == "number") {
|
|
2314
2351
|
const i = t, o = e.format;
|
|
2315
2352
|
if ((o?.format ?? "decimal") === "scientific") {
|
|
2316
|
-
const r =
|
|
2353
|
+
const r = At(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
|
|
2317
2354
|
return { text: r, color: h };
|
|
2318
2355
|
}
|
|
2319
2356
|
const s = {};
|
|
@@ -2324,7 +2361,7 @@ class St {
|
|
|
2324
2361
|
if ((e.type === "int" || e.type === "uint") && typeof t == "number") {
|
|
2325
2362
|
const i = t, o = e.format, n = o?.format ?? "decimal";
|
|
2326
2363
|
if (n === "binary" || n === "octal" || n === "hex") {
|
|
2327
|
-
const r =
|
|
2364
|
+
const r = Ut(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
|
|
2328
2365
|
return { text: r, color: h };
|
|
2329
2366
|
}
|
|
2330
2367
|
const s = {
|
|
@@ -2335,34 +2372,34 @@ class St {
|
|
|
2335
2372
|
return { text: l, color: a };
|
|
2336
2373
|
}
|
|
2337
2374
|
if ((e.type === "date" || e.type === "time" || e.type === "datetime") && (t instanceof Date || typeof t == "string")) {
|
|
2338
|
-
const i = e.format, o = e.type === "date" ?
|
|
2375
|
+
const i = e.format, o = e.type === "date" ? Nt(i, "date") : e.type === "time" ? Nt(i, "time") : Nt(i, "datetime");
|
|
2339
2376
|
let n = null;
|
|
2340
|
-
return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text:
|
|
2377
|
+
return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: ge(n, o) } : { text: String(t) };
|
|
2341
2378
|
}
|
|
2342
2379
|
return { text: String(t) };
|
|
2343
2380
|
}
|
|
2344
2381
|
}
|
|
2345
2382
|
const U = class U {
|
|
2346
2383
|
constructor(t, e = () => "direct") {
|
|
2347
|
-
this.getEditMode = e, this.root = null, this.canvas = null, this.spacer = null, this.overlayLayer = null, this.tooltip = null, this.tooltipTarget = null, this.tooltipMessage = null, this.rowHeight =
|
|
2384
|
+
this.getEditMode = e, this.root = null, this.canvas = null, this.spacer = null, this.overlayLayer = null, this.tooltip = null, this.tooltipTarget = null, this.tooltipMessage = null, this.rowHeight = wt, this.headerHeight = at, this.lineHeight = 16, this.padding = 12, this.rowHeaderWidth = ct, this.activeRowId = null, this.activeColKey = null, this.selection = [], this.valueFormatCache = new Fe(), this.textMeasureCache = /* @__PURE__ */ new Map(), this.frame = 0, this.cursorTimer = null, this.pendingCursorPoint = null, this.hoverHeaderColKey = null, this.hoverHeaderIcon = !1, this.hoverActionKey = null, this.activeActionKey = null, this.rowHeightCacheKey = null, this.rowHeightMeasuredVersion = /* @__PURE__ */ new Map(), this.rowHeightMeasureRaf = null, this.rowHeightMeasureTask = null, this.heightIndex = null, this.handleClick = (i) => {
|
|
2348
2385
|
if (!this.root || !this.canvas) return;
|
|
2349
2386
|
const o = this.canvas.getBoundingClientRect(), n = i.clientX - o.left, s = i.clientY - o.top, l = n + this.root.scrollLeft, a = s;
|
|
2350
2387
|
if (a >= this.headerHeight || l < this.rowHeaderWidth) return;
|
|
2351
|
-
const r = this.dataModel.getSchema(), h = this.dataModel.getView(), d =
|
|
2352
|
-
let
|
|
2353
|
-
for (let
|
|
2354
|
-
const
|
|
2355
|
-
if (l >=
|
|
2356
|
-
p =
|
|
2388
|
+
const r = this.dataModel.getSchema(), h = this.dataModel.getView(), d = J(r, h);
|
|
2389
|
+
let f = this.rowHeaderWidth, p = -1;
|
|
2390
|
+
for (let C = 0; C < d.length; C += 1) {
|
|
2391
|
+
const b = d[C] ?? 100;
|
|
2392
|
+
if (l >= f && l <= f + b) {
|
|
2393
|
+
p = C;
|
|
2357
2394
|
break;
|
|
2358
2395
|
}
|
|
2359
|
-
|
|
2396
|
+
f += b;
|
|
2360
2397
|
}
|
|
2361
2398
|
if (p < 0) return;
|
|
2362
2399
|
const m = r.columns[p];
|
|
2363
2400
|
if (!m) return;
|
|
2364
|
-
const
|
|
2365
|
-
l >=
|
|
2401
|
+
const g = d[p] ?? 100, S = 18, u = f + g - S - 4, w = Math.floor((this.headerHeight - S) / 2);
|
|
2402
|
+
l >= u && l <= u + S && a >= w && a <= w + S && this.root.dispatchEvent(
|
|
2366
2403
|
new CustomEvent("extable:filter-sort-open", { bubbles: !0, detail: { colKey: m.key } })
|
|
2367
2404
|
);
|
|
2368
2405
|
}, this.handlePointerMove = (i) => {
|
|
@@ -2401,149 +2438,162 @@ const U = class U {
|
|
|
2401
2438
|
if (this.frame += 1, !this.canvas || !this.root) return;
|
|
2402
2439
|
const e = this.canvas.getContext("2d");
|
|
2403
2440
|
if (!e) return;
|
|
2404
|
-
e.font = `${
|
|
2441
|
+
e.font = `${et}px ${Z}`;
|
|
2405
2442
|
let i = e.font;
|
|
2406
|
-
const o = this.activeRowId === "__all__" && this.activeColKey === "__all__", n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows(), a =
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
const
|
|
2413
|
-
|
|
2443
|
+
const o = this.activeRowId === "__all__" && this.activeColKey === "__all__", n = this.dataModel.getSchema(), s = this.dataModel.getView(), l = this.dataModel.listRows(), a = J(n, s), r = n.columns.map((T) => Bt(T)), h = De(
|
|
2444
|
+
n,
|
|
2445
|
+
this.dataModel.getPending(),
|
|
2446
|
+
(T, E) => this.dataModel.getRawCell(T, E)
|
|
2447
|
+
), d = this.getUniqueDotColors(), f = /* @__PURE__ */ new Map(), p = n.columns.some((T) => s.wrapText?.[T.key] ?? T.wrapText), m = p ? this.getRowHeightCacheKey(n, s, a) : null;
|
|
2448
|
+
m !== this.rowHeightCacheKey && (this.rowHeightCacheKey = m, this.rowHeightMeasuredVersion.clear(), this.rowHeightMeasureTask = null), p || this.cancelRowHeightMeasurement(), this.ensureHeightIndex(l, p ? m : null, p);
|
|
2449
|
+
const g = this.heightIndex;
|
|
2450
|
+
if (!g) return;
|
|
2451
|
+
const S = this.rowHeaderWidth + a.reduce((T, E) => T + (E ?? 0), 0), v = t?.clientWidth ?? (this.root.clientWidth || 600), u = t?.clientHeight ?? (this.root.clientHeight || this.canvas.height || 400), w = U.MAX_CANVAS_DIM_PX, y = Math.max(1, Math.min(w, Math.floor(v))), C = Math.max(1, Math.min(w, Math.floor(u)));
|
|
2452
|
+
this.canvas.width !== y && (this.canvas.width = y), this.canvas.height !== C && (this.canvas.height = C), this.canvas.style.width = `${y}px`, this.canvas.style.height = `${C}px`, e.font = `${et}px ${Z}`, i = e.font, this.refreshTooltipPosition();
|
|
2453
|
+
const b = t?.scrollTop ?? this.root.scrollTop, M = t?.scrollLeft ?? this.root.scrollLeft, x = (T) => {
|
|
2454
|
+
const E = T + 1, H = Math.max(
|
|
2414
2455
|
0,
|
|
2415
|
-
Math.min(l.length - 1,
|
|
2416
|
-
),
|
|
2417
|
-
let
|
|
2418
|
-
const
|
|
2419
|
-
for (let
|
|
2420
|
-
|
|
2421
|
-
return { accum:
|
|
2456
|
+
Math.min(l.length - 1, g.fenwick.lowerBound(E))
|
|
2457
|
+
), X = g.fenwick.sum(H);
|
|
2458
|
+
let N = H, z = 0;
|
|
2459
|
+
const q = (this.canvas?.height ?? 0) + this.rowHeight * 2;
|
|
2460
|
+
for (let k = H; k < l.length && z < q; k += 1)
|
|
2461
|
+
z += g.heights[k] ?? this.rowHeight, N = k + 1;
|
|
2462
|
+
return { accum: X, visibleStart: H, visibleEnd: N };
|
|
2422
2463
|
};
|
|
2423
|
-
let
|
|
2424
|
-
const
|
|
2425
|
-
let
|
|
2426
|
-
if (
|
|
2427
|
-
const
|
|
2428
|
-
for (let
|
|
2429
|
-
const
|
|
2430
|
-
if (!
|
|
2431
|
-
const
|
|
2432
|
-
if (this.rowHeightMeasuredVersion.get(
|
|
2433
|
-
const
|
|
2434
|
-
|
|
2464
|
+
let L = g.fenwick.total();
|
|
2465
|
+
const K = this.canvas?.height ?? this.root.clientHeight, _ = Math.max(0, K - this.headerHeight);
|
|
2466
|
+
let R = Math.max(0, L - _), A = Math.max(0, Math.min(b, R)), { accum: D, visibleStart: P, visibleEnd: j } = x(A);
|
|
2467
|
+
if (p && m) {
|
|
2468
|
+
const T = {};
|
|
2469
|
+
for (let E = P; E < j; E += 1) {
|
|
2470
|
+
const H = l[E];
|
|
2471
|
+
if (!H) continue;
|
|
2472
|
+
const X = this.dataModel.getRowVersion(H.id);
|
|
2473
|
+
if (this.rowHeightMeasuredVersion.get(H.id) === X) continue;
|
|
2474
|
+
const N = this.measureRowHeight(e, H, n, a);
|
|
2475
|
+
T[H.id] = N, this.rowHeightMeasuredVersion.set(H.id, X);
|
|
2435
2476
|
}
|
|
2436
|
-
this.applyRowHeightUpdates(
|
|
2477
|
+
this.applyRowHeightUpdates(T), L = g.fenwick.total(), this.dataModel.setRowHeightsBulk(T), R = Math.max(0, L - _), A = Math.max(0, Math.min(b, R)), { accum: D, visibleStart: P, visibleEnd: j } = x(A), (this.rowHeightMeasureTask || Object.keys(T).length > 0) && this.scheduleRowHeightMeasurement();
|
|
2437
2478
|
}
|
|
2438
|
-
this.spacer && (this.spacer.style.height = `${
|
|
2439
|
-
const
|
|
2479
|
+
this.spacer && (this.spacer.style.height = `${R}px`, this.spacer.style.width = `${S}px`);
|
|
2480
|
+
const I = this.rowHeaderWidth - M;
|
|
2440
2481
|
e.clearRect(0, 0, this.canvas.width, this.canvas.height), e.fillStyle = "#e5e7eb", e.fillRect(0, 0, this.rowHeaderWidth, this.canvas.height);
|
|
2441
|
-
let
|
|
2442
|
-
for (let
|
|
2443
|
-
const
|
|
2444
|
-
e.strokeStyle = "#d0d7de", e.fillStyle = "#e5e7eb", e.fillRect(0,
|
|
2445
|
-
const
|
|
2446
|
-
this.activeRowId ===
|
|
2482
|
+
let F = this.headerHeight + D - A;
|
|
2483
|
+
for (let T = P; T < j; T += 1) {
|
|
2484
|
+
const E = l[T], H = g.heights[T] ?? this.rowHeight;
|
|
2485
|
+
e.strokeStyle = "#d0d7de", e.fillStyle = "#e5e7eb", e.fillRect(0, F, this.rowHeaderWidth, H), e.strokeRect(0, F, this.rowHeaderWidth, H);
|
|
2486
|
+
const X = this.dataModel.getDisplayIndex(E.id) ?? "";
|
|
2487
|
+
this.activeRowId === E.id && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, F, this.rowHeaderWidth, H)), e.fillStyle = "#0f172a", e.font = `bold ${et}px ${Z}`, e.textAlign = "center", e.textBaseline = "middle", e.fillText(String(X), this.rowHeaderWidth / 2, F + H / 2), e.font = i, e.textAlign = "left", e.textBaseline = "alphabetic", e.save(), e.beginPath(), e.rect(
|
|
2447
2488
|
this.rowHeaderWidth,
|
|
2448
2489
|
this.headerHeight,
|
|
2449
2490
|
this.canvas.width - this.rowHeaderWidth,
|
|
2450
2491
|
this.canvas.height - this.headerHeight
|
|
2451
|
-
), e.clip(), e.translate(
|
|
2452
|
-
let
|
|
2453
|
-
for (let
|
|
2454
|
-
const
|
|
2455
|
-
if (!
|
|
2456
|
-
|
|
2492
|
+
), e.clip(), e.translate(I, 0);
|
|
2493
|
+
let N = 0, z = "";
|
|
2494
|
+
for (let q = 0; q < n.columns.length; q += 1) {
|
|
2495
|
+
const k = n.columns[q], W = a[q] ?? 100;
|
|
2496
|
+
if (!k) {
|
|
2497
|
+
N += W;
|
|
2457
2498
|
continue;
|
|
2458
2499
|
}
|
|
2459
|
-
const
|
|
2500
|
+
const $ = this.dataModel.getCellInteraction(E.id, k.key), st = $.muted;
|
|
2460
2501
|
e.strokeStyle = "#d0d7de";
|
|
2461
|
-
const
|
|
2462
|
-
e.fillStyle =
|
|
2463
|
-
const
|
|
2464
|
-
let
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
if (
|
|
2502
|
+
const lt = this.dataModel.resolveConditionalStyle(E.id, k), pt = this.dataModel.getCellStyle(E.id, k.key), Yt = r[q] ?? {}, Qt = lt.delta ? ht(Yt, lt.delta) : Yt, G = pt ? ht(Qt, pt) : Qt, Ne = n.columns.some((V) => V && V.type === "boolean" && V.unique && this.dataModel.getCell(E.id, V.key) === !0) ? "rgba(59,130,246,0.06)" : st ? "#f3f4f6" : G.backgroundColor ?? "#ffffff";
|
|
2503
|
+
e.fillStyle = Ne, e.fillRect(N, F, W, H), e.strokeRect(N, F, W, H);
|
|
2504
|
+
const Y = this.dataModel.resolveCellValue(E.id, k), Jt = Y.textOverride ?? (lt.forceErrorText ? "#ERROR" : void 0), Ct = Jt ? { text: "#ERROR" } : this.formatValue(Y.value, k), Kt = k.type === "button" || k.type === "link", Zt = Kt ? k.type === "button" ? vt(Y.value) : bt(Y.value) : null, te = Kt ? Zt?.label ?? (k.type === "button" ? ut(Y.value) : ft(Y.value)) : "", xt = !!(Kt && Zt && te && !Jt);
|
|
2505
|
+
let _t = te || Ct.text;
|
|
2506
|
+
const ee = k.type === "boolean" && k.unique;
|
|
2507
|
+
let rt = null;
|
|
2508
|
+
if (ee) {
|
|
2509
|
+
const V = h.get(String(k.key));
|
|
2510
|
+
V?.currentRowId === E.id ? rt = "current" : V?.previousRowId === E.id ? rt = "previous" : rt = Y.value === !0 || Y.value === "true" || Y.value === "1" || Y.value === 1 ? "default" : null, _t = "";
|
|
2511
|
+
}
|
|
2512
|
+
const Ft = k.style?.align ?? (k.type === "number" ? "right" : "left");
|
|
2513
|
+
if (this.activeRowId === E.id && this.activeColKey !== null && this.activeColKey === k.key && (e.strokeStyle = "#3b82f6", e.lineWidth = 2, e.strokeRect(N + 1, F + 1, W - 2, H - 2), e.lineWidth = 1, Ht(
|
|
2468
2514
|
this.dataModel,
|
|
2469
2515
|
this.selection,
|
|
2470
2516
|
this.activeRowId,
|
|
2471
2517
|
this.activeColKey,
|
|
2472
2518
|
this.getEditMode()
|
|
2473
2519
|
))) {
|
|
2474
|
-
const
|
|
2475
|
-
e.fillStyle = "#3b82f6", e.fillRect(nt,
|
|
2520
|
+
const V = Ee, nt = N + W - V - 1, tt = F + H - V - 1;
|
|
2521
|
+
e.fillStyle = "#3b82f6", e.fillRect(nt, tt, V, V), e.strokeStyle = "#ffffff", e.strokeRect(nt + 0.5, tt + 0.5, V - 1, V - 1);
|
|
2476
2522
|
}
|
|
2477
|
-
const
|
|
2478
|
-
e.fillStyle = this.dataModel.hasPending(
|
|
2479
|
-
const
|
|
2480
|
-
if (
|
|
2481
|
-
e.font = i,
|
|
2523
|
+
const ie = xt && k.type === "link" && !st && !G.textColor ? "#2563eb" : void 0, Pe = this.getEditMode() === "readonly", Be = !!(Ct.color || G.textColor || ie), We = !Pe && k.formula && $.readonly && !st && !Be ? "#99aaff" : void 0;
|
|
2524
|
+
e.fillStyle = this.dataModel.hasPending(E.id, k.key) ? "#b91c1c" : Ct.color ? Ct.color : st ? "#94a3b8" : ie ?? G.textColor ?? We ?? "#0f172a";
|
|
2525
|
+
const oe = s.wrapText?.[k.key] ?? k.wrapText ?? !1, Vt = k.type === "boolean" && (!k.format || k.format === "checkbox"), $e = k.type === "boolean" && !!(k.format && k.format !== "checkbox");
|
|
2526
|
+
if (Vt)
|
|
2527
|
+
e.font = i, z = "";
|
|
2482
2528
|
else {
|
|
2483
|
-
const
|
|
2484
|
-
if (
|
|
2485
|
-
const nt =
|
|
2529
|
+
const V = `${G.italic ? "i" : ""}${G.bold ? "b" : ""}`;
|
|
2530
|
+
if (V !== z) {
|
|
2531
|
+
const nt = f.get(V);
|
|
2486
2532
|
if (nt) e.font = nt;
|
|
2487
2533
|
else {
|
|
2488
|
-
const
|
|
2489
|
-
|
|
2534
|
+
const tt = G.bold ? "600 " : "", kt = `${G.italic ? "italic " : ""}${tt}${et}px ${Z}`.trim();
|
|
2535
|
+
f.set(V, kt), e.font = kt;
|
|
2490
2536
|
}
|
|
2491
|
-
|
|
2537
|
+
z = V;
|
|
2492
2538
|
}
|
|
2493
2539
|
}
|
|
2494
|
-
const
|
|
2495
|
-
underline: !!
|
|
2496
|
-
strike: !!
|
|
2497
|
-
},
|
|
2540
|
+
const mt = N + yt, gt = F + dt, St = Math.max(0, W - yt * 2), Rt = Math.max(0, H - (dt + Et)), Oe = {
|
|
2541
|
+
underline: !!G.underline || xt && k.type === "link",
|
|
2542
|
+
strike: !!G.strike
|
|
2543
|
+
}, ot = xt && !Vt ? this.measureTextBounds(
|
|
2498
2544
|
e,
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2545
|
+
_t,
|
|
2546
|
+
mt,
|
|
2547
|
+
gt,
|
|
2548
|
+
St,
|
|
2549
|
+
Rt,
|
|
2550
|
+
oe,
|
|
2551
|
+
Ft
|
|
2506
2552
|
) : null;
|
|
2507
|
-
if (
|
|
2508
|
-
const
|
|
2553
|
+
if (xt && k.type === "button" && ot) {
|
|
2554
|
+
const tt = Math.max(mt, ot.x - 6), Mt = Math.max(gt, ot.y - 4), kt = Math.min(mt + St, ot.x + ot.width + 6), je = Math.min(gt + Rt, ot.y + ot.height + 4), se = Math.max(0, kt - tt), le = Math.max(0, je - Mt);
|
|
2509
2555
|
e.save();
|
|
2510
|
-
const
|
|
2511
|
-
|
|
2556
|
+
const re = `${E.id}::${k.key}::button`, qe = this.hoverActionKey === re, ze = this.activeActionKey === re;
|
|
2557
|
+
st ? (e.fillStyle = "#f3f4f6", e.strokeStyle = "#e2e8f0") : ze ? (e.fillStyle = "#cbd5e1", e.strokeStyle = "#94a3b8") : qe ? (e.fillStyle = "#e2e8f0", e.strokeStyle = "#94a3b8") : (e.fillStyle = "#f8fafc", e.strokeStyle = "#cbd5e1"), e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(tt, Mt, se, le, 6) : e.rect(tt, Mt, se, le), e.fill(), e.stroke(), e.restore();
|
|
2558
|
+
}
|
|
2559
|
+
if (ee && rt) {
|
|
2560
|
+
const V = rt === "current" ? d.current : rt === "previous" ? d.previous : d.default;
|
|
2561
|
+
this.drawUniqueRadio(e, mt, gt, St, Rt, Ft, V);
|
|
2512
2562
|
}
|
|
2513
2563
|
this.drawCellText(
|
|
2514
2564
|
e,
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
!!
|
|
2525
|
-
|
|
2565
|
+
_t,
|
|
2566
|
+
mt,
|
|
2567
|
+
gt,
|
|
2568
|
+
St,
|
|
2569
|
+
Rt,
|
|
2570
|
+
oe,
|
|
2571
|
+
Ft,
|
|
2572
|
+
Vt,
|
|
2573
|
+
$e,
|
|
2574
|
+
!!k.unique,
|
|
2575
|
+
Oe
|
|
2526
2576
|
);
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2577
|
+
const ne = this.dataModel.getCellMarker(E.id, k.key);
|
|
2578
|
+
ne && Oo(e, N, F, W, H, ne.level), N += W;
|
|
2529
2579
|
}
|
|
2530
|
-
e.restore(),
|
|
2580
|
+
e.restore(), F += H;
|
|
2531
2581
|
}
|
|
2532
|
-
e.fillStyle = "#e5e7eb", e.fillRect(0, 0, this.canvas.width, this.headerHeight), e.strokeStyle = "#d0d7de", e.strokeRect(0, 0, this.rowHeaderWidth, this.headerHeight), e.fillStyle = "#9ca3af", e.beginPath(), e.moveTo(4, 4), e.lineTo(16, 4), e.lineTo(4, 16), e.closePath(), e.fill(), this.activeRowId && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, 0, this.rowHeaderWidth, this.headerHeight)), e.save(), e.beginPath(), e.rect(this.rowHeaderWidth, 0, this.canvas.width - this.rowHeaderWidth, this.headerHeight), e.clip(), e.translate(
|
|
2582
|
+
e.fillStyle = "#e5e7eb", e.fillRect(0, 0, this.canvas.width, this.headerHeight), e.strokeStyle = "#d0d7de", e.strokeRect(0, 0, this.rowHeaderWidth, this.headerHeight), e.fillStyle = "#9ca3af", e.beginPath(), e.moveTo(4, 4), e.lineTo(16, 4), e.lineTo(4, 16), e.closePath(), e.fill(), this.activeRowId && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(0, 0, this.rowHeaderWidth, this.headerHeight)), e.save(), e.beginPath(), e.rect(this.rowHeaderWidth, 0, this.canvas.width - this.rowHeaderWidth, this.headerHeight), e.clip(), e.translate(I, 0);
|
|
2533
2583
|
let B = 0;
|
|
2534
|
-
for (let
|
|
2535
|
-
const
|
|
2536
|
-
if (!
|
|
2537
|
-
B +=
|
|
2584
|
+
for (let T = 0; T < n.columns.length; T += 1) {
|
|
2585
|
+
const E = n.columns[T], H = a[T] ?? 100;
|
|
2586
|
+
if (!E) {
|
|
2587
|
+
B += H;
|
|
2538
2588
|
continue;
|
|
2539
2589
|
}
|
|
2540
|
-
this.activeColKey !== null && this.activeColKey ===
|
|
2541
|
-
const
|
|
2542
|
-
if (!!
|
|
2543
|
-
const
|
|
2544
|
-
|
|
2590
|
+
this.activeColKey !== null && this.activeColKey === E.key && (e.fillStyle = "rgba(59,130,246,0.16)", e.fillRect(B, 0, H, this.headerHeight)), e.strokeStyle = "#d0d7de", e.strokeRect(B, 0, H, this.headerHeight), e.fillStyle = "#0f172a", e.font = `bold ${et}px ${Z}`, e.fillText(E.header ?? E.key, B + 8, this.headerHeight - 8), e.font = i;
|
|
2591
|
+
const N = Ke(s, E.key), z = _e(s, E.key), q = this.hoverHeaderColKey !== null && this.hoverHeaderColKey === E.key;
|
|
2592
|
+
if (!!N || z || q) {
|
|
2593
|
+
const W = q ? 0.9 : z || N ? 0.75 : 0.45, $ = 16, lt = B + H - $ - 6, pt = Math.floor((this.headerHeight - $) / 2);
|
|
2594
|
+
N ? qo(e, lt + 3, pt + 3, $ - 6, W, N) : jo(e, lt + 2, pt + 2, $ - 4, W);
|
|
2545
2595
|
}
|
|
2546
|
-
B +=
|
|
2596
|
+
B += H;
|
|
2547
2597
|
}
|
|
2548
2598
|
if (e.restore(), this.selection.length) {
|
|
2549
2599
|
e.save(), e.beginPath(), e.rect(
|
|
@@ -2552,18 +2602,18 @@ const U = class U {
|
|
|
2552
2602
|
this.canvas.width - this.rowHeaderWidth,
|
|
2553
2603
|
this.canvas.height - this.headerHeight
|
|
2554
2604
|
), e.clip(), e.strokeStyle = "#3b82f6", e.fillStyle = "rgba(59,130,246,0.12)";
|
|
2555
|
-
for (const
|
|
2556
|
-
const
|
|
2605
|
+
for (const T of this.selection) {
|
|
2606
|
+
const E = Math.max(0, Math.min(T.startRow, T.endRow)), H = Math.min(l.length - 1, Math.max(T.startRow, T.endRow)), X = Math.max(0, Math.min(T.startCol, T.endCol)), N = Math.min(
|
|
2557
2607
|
n.columns.length - 1,
|
|
2558
|
-
Math.max(
|
|
2559
|
-
),
|
|
2560
|
-
let
|
|
2561
|
-
for (let
|
|
2562
|
-
|
|
2563
|
-
let
|
|
2564
|
-
for (let
|
|
2565
|
-
|
|
2566
|
-
|
|
2608
|
+
Math.max(T.startCol, T.endCol)
|
|
2609
|
+
), z = this.headerHeight + g.fenwick.sum(E) - A, q = g.fenwick.sum(H + 1) - g.fenwick.sum(E);
|
|
2610
|
+
let k = this.rowHeaderWidth;
|
|
2611
|
+
for (let $ = 0; $ < X; $ += 1)
|
|
2612
|
+
k += a[$] ?? 100;
|
|
2613
|
+
let W = 0;
|
|
2614
|
+
for (let $ = X; $ <= N; $ += 1)
|
|
2615
|
+
W += a[$] ?? 100;
|
|
2616
|
+
k -= M, e.fillRect(k, z, W, q), e.strokeRect(k + 0.5, z + 0.5, W - 1, q - 1);
|
|
2567
2617
|
}
|
|
2568
2618
|
e.restore();
|
|
2569
2619
|
}
|
|
@@ -2585,8 +2635,8 @@ const U = class U {
|
|
|
2585
2635
|
s.set(a.id, l);
|
|
2586
2636
|
let r = this.rowHeight;
|
|
2587
2637
|
if (i && e) {
|
|
2588
|
-
const h = this.dataModel.getRowVersion(a.id), d = this.rowHeightMeasuredVersion.get(a.id),
|
|
2589
|
-
d === h && typeof
|
|
2638
|
+
const h = this.dataModel.getRowVersion(a.id), d = this.rowHeightMeasuredVersion.get(a.id), f = this.dataModel.getRowHeight(a.id);
|
|
2639
|
+
d === h && typeof f == "number" && (r = f);
|
|
2590
2640
|
}
|
|
2591
2641
|
n[l] = r;
|
|
2592
2642
|
}
|
|
@@ -2595,7 +2645,7 @@ const U = class U {
|
|
|
2595
2645
|
rowsRef: t,
|
|
2596
2646
|
idToIndex: s,
|
|
2597
2647
|
heights: n,
|
|
2598
|
-
fenwick:
|
|
2648
|
+
fenwick: Gt.from(n)
|
|
2599
2649
|
};
|
|
2600
2650
|
}
|
|
2601
2651
|
applyRowHeightUpdates(t) {
|
|
@@ -2624,9 +2674,9 @@ const U = class U {
|
|
|
2624
2674
|
if (!this.canvas) return;
|
|
2625
2675
|
const t = this.canvas.getContext("2d");
|
|
2626
2676
|
if (!t) return;
|
|
2627
|
-
t.font = `${
|
|
2628
|
-
const e = this.dataModel.getSchema(), i = this.dataModel.getView(), o =
|
|
2629
|
-
if (!e.columns.some((
|
|
2677
|
+
t.font = `${et}px ${Z}`;
|
|
2678
|
+
const e = this.dataModel.getSchema(), i = this.dataModel.getView(), o = J(e, i);
|
|
2679
|
+
if (!e.columns.some((f) => i.wrapText?.[f.key] ?? f.wrapText)) return;
|
|
2630
2680
|
const s = this.getRowHeightCacheKey(e, i, o);
|
|
2631
2681
|
this.rowHeightCacheKey !== s && (this.rowHeightCacheKey = s, this.rowHeightMeasuredVersion.clear(), this.rowHeightMeasureTask = null);
|
|
2632
2682
|
const l = this.rowHeightMeasureTask ?? { key: s, nextIndex: 0 };
|
|
@@ -2635,12 +2685,12 @@ const U = class U {
|
|
|
2635
2685
|
let h = 0;
|
|
2636
2686
|
const d = performance.now();
|
|
2637
2687
|
for (; l.nextIndex < a.length && h < U.ROW_HEIGHT_MEASURE_CHUNK && !(performance.now() - d > U.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS); ) {
|
|
2638
|
-
const
|
|
2639
|
-
if (l.nextIndex += 1, !
|
|
2640
|
-
const p = this.dataModel.getRowVersion(
|
|
2641
|
-
if (this.rowHeightMeasuredVersion.get(
|
|
2642
|
-
const m = this.measureRowHeight(t,
|
|
2643
|
-
r[
|
|
2688
|
+
const f = a[l.nextIndex];
|
|
2689
|
+
if (l.nextIndex += 1, !f) continue;
|
|
2690
|
+
const p = this.dataModel.getRowVersion(f.id);
|
|
2691
|
+
if (this.rowHeightMeasuredVersion.get(f.id) === p) continue;
|
|
2692
|
+
const m = this.measureRowHeight(t, f, e, o);
|
|
2693
|
+
r[f.id] = m, this.rowHeightMeasuredVersion.set(f.id, p), h += 1;
|
|
2644
2694
|
}
|
|
2645
2695
|
this.rowHeightMeasureTask = l.nextIndex < a.length ? l : null, this.ensureHeightIndex(a, this.rowHeightCacheKey, !0), this.applyRowHeightUpdates(r), this.dataModel.setRowHeightsBulk(r), this.rowHeightMeasureTask && this.scheduleRowHeightMeasurement();
|
|
2646
2696
|
}
|
|
@@ -2649,11 +2699,11 @@ const U = class U {
|
|
|
2649
2699
|
}
|
|
2650
2700
|
hitTest(t) {
|
|
2651
2701
|
if (!this.root || !this.canvas) return null;
|
|
2652
|
-
const e = this.canvas.getBoundingClientRect(), i = t.clientX - e.left, o = t.clientY - e.top, n = i + this.root.scrollLeft, s = this.dataModel.getSchema(), l = this.dataModel.getView(), a = this.dataModel.listRows(), r = this.headerHeight, h =
|
|
2653
|
-
this.ensureHeightIndex(a,
|
|
2702
|
+
const e = this.canvas.getBoundingClientRect(), i = t.clientX - e.left, o = t.clientY - e.top, n = i + this.root.scrollLeft, s = this.dataModel.getSchema(), l = this.dataModel.getView(), a = this.dataModel.listRows(), r = this.headerHeight, h = J(s, l), d = s.columns.some((R) => l.wrapText?.[R.key] ?? R.wrapText), f = d ? this.getRowHeightCacheKey(s, l, h) : null;
|
|
2703
|
+
this.ensureHeightIndex(a, f, d);
|
|
2654
2704
|
const p = this.heightIndex;
|
|
2655
2705
|
if (!p) return null;
|
|
2656
|
-
const m = p.fenwick.total(),
|
|
2706
|
+
const m = p.fenwick.total(), g = this.canvas?.height ?? this.root.clientHeight, S = Math.max(0, g - this.headerHeight), v = Math.max(0, m - S), u = Math.max(0, Math.min(this.root.scrollTop, v));
|
|
2657
2707
|
if (o < r && i < this.rowHeaderWidth)
|
|
2658
2708
|
return {
|
|
2659
2709
|
rowId: "__all__",
|
|
@@ -2661,90 +2711,90 @@ const U = class U {
|
|
|
2661
2711
|
rect: new DOMRect(e.left, e.top, this.rowHeaderWidth, r)
|
|
2662
2712
|
};
|
|
2663
2713
|
if (o < r) {
|
|
2664
|
-
let
|
|
2665
|
-
for (let
|
|
2666
|
-
const
|
|
2667
|
-
if (n >=
|
|
2668
|
-
|
|
2714
|
+
let R = this.rowHeaderWidth, A = -1;
|
|
2715
|
+
for (let D = 0; D < h.length; D += 1) {
|
|
2716
|
+
const P = h[D] ?? 100;
|
|
2717
|
+
if (n >= R && n <= R + P) {
|
|
2718
|
+
A = D;
|
|
2669
2719
|
break;
|
|
2670
2720
|
}
|
|
2671
|
-
|
|
2721
|
+
R += P;
|
|
2672
2722
|
}
|
|
2673
|
-
if (
|
|
2674
|
-
const
|
|
2675
|
-
e.left +
|
|
2723
|
+
if (A >= 0) {
|
|
2724
|
+
const D = s.columns[A], P = new DOMRect(
|
|
2725
|
+
e.left + R - this.root.scrollLeft,
|
|
2676
2726
|
e.top,
|
|
2677
|
-
h[
|
|
2727
|
+
h[A] ?? 100,
|
|
2678
2728
|
r
|
|
2679
2729
|
);
|
|
2680
|
-
return { rowId: "__header__", colKey:
|
|
2730
|
+
return { rowId: "__header__", colKey: D.key, rect: P };
|
|
2681
2731
|
}
|
|
2682
2732
|
return null;
|
|
2683
2733
|
}
|
|
2684
2734
|
if (i < this.rowHeaderWidth) {
|
|
2685
|
-
const
|
|
2735
|
+
const R = o - r + u, A = Math.max(
|
|
2686
2736
|
0,
|
|
2687
|
-
Math.min(a.length - 1, p.fenwick.lowerBound(
|
|
2688
|
-
),
|
|
2689
|
-
if (
|
|
2690
|
-
const
|
|
2737
|
+
Math.min(a.length - 1, p.fenwick.lowerBound(R + 1))
|
|
2738
|
+
), D = p.fenwick.sum(A);
|
|
2739
|
+
if (A < 0 || A >= a.length) return null;
|
|
2740
|
+
const P = a[A], j = e.top + r + D - u, I = new DOMRect(
|
|
2691
2741
|
e.left,
|
|
2692
|
-
|
|
2742
|
+
j,
|
|
2693
2743
|
this.rowHeaderWidth,
|
|
2694
|
-
p.heights[
|
|
2744
|
+
p.heights[A] ?? this.rowHeight
|
|
2695
2745
|
);
|
|
2696
|
-
return { rowId:
|
|
2697
|
-
}
|
|
2698
|
-
const
|
|
2699
|
-
if (
|
|
2700
|
-
let
|
|
2701
|
-
for (let
|
|
2702
|
-
const
|
|
2703
|
-
if (n >=
|
|
2704
|
-
|
|
2746
|
+
return { rowId: P.id, colKey: null, rect: I };
|
|
2747
|
+
}
|
|
2748
|
+
const w = o - r + u, y = Math.max(0, Math.min(a.length - 1, p.fenwick.lowerBound(w + 1))), C = p.fenwick.sum(y);
|
|
2749
|
+
if (y < 0 || y >= a.length) return null;
|
|
2750
|
+
let b = this.rowHeaderWidth, M = -1;
|
|
2751
|
+
for (let R = 0; R < h.length; R += 1) {
|
|
2752
|
+
const A = h[R] ?? 100;
|
|
2753
|
+
if (n >= b && n <= b + A) {
|
|
2754
|
+
M = R;
|
|
2705
2755
|
break;
|
|
2706
2756
|
}
|
|
2707
|
-
|
|
2757
|
+
b += A;
|
|
2708
2758
|
}
|
|
2709
|
-
if (
|
|
2710
|
-
const
|
|
2711
|
-
e.left +
|
|
2759
|
+
if (M === -1) return null;
|
|
2760
|
+
const x = a[y], L = s.columns[M], K = C, _ = new DOMRect(
|
|
2761
|
+
e.left + b - this.root.scrollLeft,
|
|
2712
2762
|
e.top + r + K - this.root.scrollTop,
|
|
2713
|
-
h[
|
|
2714
|
-
p.heights[
|
|
2763
|
+
h[M] ?? 100,
|
|
2764
|
+
p.heights[y] ?? this.rowHeight
|
|
2715
2765
|
);
|
|
2716
|
-
return { rowId:
|
|
2766
|
+
return { rowId: x.id, colKey: L.key, rect: _ };
|
|
2717
2767
|
}
|
|
2718
2768
|
hitTestAction(t) {
|
|
2719
2769
|
if (!this.root || !this.canvas) return null;
|
|
2720
2770
|
const e = this.hitTest(t);
|
|
2721
2771
|
if (!e || !e.rowId || !e.colKey || e.rowId === "__all__" || e.rowId === "__header__") return null;
|
|
2722
|
-
const o = this.dataModel.getSchema().columns.find((
|
|
2772
|
+
const o = this.dataModel.getSchema().columns.find((A) => String(A.key) === String(e.colKey));
|
|
2723
2773
|
if (!o || o.type !== "button" && o.type !== "link") return null;
|
|
2724
2774
|
const n = this.dataModel.resolveCellValue(e.rowId, o), s = this.dataModel.resolveConditionalStyle(e.rowId, o);
|
|
2725
2775
|
if (n.textOverride ?? (s.forceErrorText ? "#ERROR" : void 0)) return null;
|
|
2726
|
-
const a = o.type === "button" ?
|
|
2776
|
+
const a = o.type === "button" ? vt(n.value) : bt(n.value);
|
|
2727
2777
|
if (!a || !a.label) return null;
|
|
2728
2778
|
const r = this.canvas.getContext("2d");
|
|
2729
2779
|
if (!r) return null;
|
|
2730
|
-
const h =
|
|
2731
|
-
r.save(), r.font = `${
|
|
2732
|
-
const
|
|
2780
|
+
const h = Bt(o), d = s.delta ? ht(h, s.delta) : h, f = this.dataModel.getCellStyle(e.rowId, o.key), p = f ? ht(d, f) : d, m = p.bold ? "600 " : "", g = p.italic ? "italic " : "";
|
|
2781
|
+
r.save(), r.font = `${g}${m}${et}px ${Z}`.trim(), r.textBaseline = "alphabetic";
|
|
2782
|
+
const v = this.dataModel.getView().wrapText?.[o.key] ?? o.wrapText ?? !1, u = o.style?.align ?? "left", w = e.rect.left + yt, y = e.rect.top + dt, C = Math.max(0, e.rect.width - yt * 2), b = Math.max(
|
|
2733
2783
|
0,
|
|
2734
|
-
e.rect.height - (
|
|
2735
|
-
),
|
|
2784
|
+
e.rect.height - (dt + Et)
|
|
2785
|
+
), M = this.measureTextBounds(
|
|
2736
2786
|
r,
|
|
2737
2787
|
a.label,
|
|
2738
|
-
y,
|
|
2739
2788
|
w,
|
|
2789
|
+
y,
|
|
2790
|
+
C,
|
|
2740
2791
|
b,
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
g
|
|
2792
|
+
v,
|
|
2793
|
+
u
|
|
2744
2794
|
);
|
|
2745
|
-
if (r.restore(), !
|
|
2746
|
-
const
|
|
2747
|
-
return t.clientX >=
|
|
2795
|
+
if (r.restore(), !M) return null;
|
|
2796
|
+
const x = o.type === "button" ? 6 : 2, L = Math.max(e.rect.left, M.x - x), K = Math.max(e.rect.top, M.y - x), _ = Math.min(e.rect.right, M.x + M.width + x), R = Math.min(e.rect.bottom, M.y + M.height + x);
|
|
2797
|
+
return t.clientX >= L && t.clientX <= _ && t.clientY >= K && t.clientY <= R ? { rowId: e.rowId, colKey: String(e.colKey), kind: o.type } : null;
|
|
2748
2798
|
}
|
|
2749
2799
|
isPointInSelection(t, e) {
|
|
2750
2800
|
if (!this.selection.length) return !1;
|
|
@@ -2776,21 +2826,21 @@ const U = class U {
|
|
|
2776
2826
|
}
|
|
2777
2827
|
getCellRect(t, e) {
|
|
2778
2828
|
if (!this.root || !this.canvas) return null;
|
|
2779
|
-
const i = this.canvas.getBoundingClientRect(), o = this.dataModel.getSchema(), n = this.dataModel.getView(), s = this.dataModel.listRows(), l = this.dataModel.getRowIndex(t), a = o.columns.findIndex((
|
|
2829
|
+
const i = this.canvas.getBoundingClientRect(), o = this.dataModel.getSchema(), n = this.dataModel.getView(), s = this.dataModel.listRows(), l = this.dataModel.getRowIndex(t), a = o.columns.findIndex((g) => g.key === e);
|
|
2780
2830
|
if (l < 0 || a < 0) return null;
|
|
2781
|
-
const r =
|
|
2831
|
+
const r = J(o, n), h = o.columns.some((g) => n.wrapText?.[g.key] ?? g.wrapText), d = h ? this.getRowHeightCacheKey(o, n, r) : null;
|
|
2782
2832
|
this.ensureHeightIndex(s, d, h);
|
|
2783
|
-
const
|
|
2784
|
-
if (!
|
|
2785
|
-
const p =
|
|
2833
|
+
const f = this.heightIndex;
|
|
2834
|
+
if (!f) return null;
|
|
2835
|
+
const p = f.fenwick.sum(l);
|
|
2786
2836
|
let m = this.rowHeaderWidth;
|
|
2787
|
-
for (let
|
|
2788
|
-
m += r[
|
|
2837
|
+
for (let g = 0; g < a; g += 1)
|
|
2838
|
+
m += r[g] ?? 100;
|
|
2789
2839
|
return new DOMRect(
|
|
2790
2840
|
i.left + m - this.root.scrollLeft,
|
|
2791
2841
|
i.top + this.headerHeight + p - this.root.scrollTop,
|
|
2792
2842
|
r[a] ?? 100,
|
|
2793
|
-
|
|
2843
|
+
f.heights[l] ?? this.rowHeight
|
|
2794
2844
|
);
|
|
2795
2845
|
}
|
|
2796
2846
|
updateCanvasCursor(t, e) {
|
|
@@ -2799,33 +2849,41 @@ const U = class U {
|
|
|
2799
2849
|
this.canvas.style.cursor = "crosshair";
|
|
2800
2850
|
return;
|
|
2801
2851
|
}
|
|
2852
|
+
if (this.root.dataset.extableColumnResize === "1") {
|
|
2853
|
+
this.canvas.style.cursor = "col-resize";
|
|
2854
|
+
return;
|
|
2855
|
+
}
|
|
2802
2856
|
{
|
|
2803
|
-
const d = this.canvas.getBoundingClientRect(),
|
|
2804
|
-
let
|
|
2805
|
-
if (
|
|
2806
|
-
const
|
|
2807
|
-
let
|
|
2808
|
-
for (let
|
|
2809
|
-
const
|
|
2810
|
-
if (m >=
|
|
2811
|
-
|
|
2857
|
+
const d = this.canvas.getBoundingClientRect(), f = t - d.left, p = e - d.top, m = f + this.root.scrollLeft, g = p, S = this.hoverHeaderColKey, v = this.hoverHeaderIcon;
|
|
2858
|
+
let u = null, w = !1;
|
|
2859
|
+
if (g >= 0 && g < this.headerHeight && m >= this.rowHeaderWidth) {
|
|
2860
|
+
const C = this.dataModel.getSchema(), b = this.dataModel.getView(), M = J(C, b);
|
|
2861
|
+
let x = this.rowHeaderWidth, L = -1;
|
|
2862
|
+
for (let _ = 0; _ < M.length; _ += 1) {
|
|
2863
|
+
const R = M[_] ?? 100;
|
|
2864
|
+
if (m >= x && m <= x + R) {
|
|
2865
|
+
L = _;
|
|
2812
2866
|
break;
|
|
2813
2867
|
}
|
|
2814
|
-
|
|
2868
|
+
x += R;
|
|
2815
2869
|
}
|
|
2816
|
-
const K =
|
|
2870
|
+
const K = L >= 0 ? C.columns[L] : null;
|
|
2817
2871
|
if (K) {
|
|
2818
|
-
|
|
2819
|
-
const
|
|
2820
|
-
|
|
2872
|
+
u = K.key;
|
|
2873
|
+
const _ = M[L] ?? 100, R = 18, D = x + _ - R - 4, P = Math.floor((this.headerHeight - R) / 2);
|
|
2874
|
+
if (w = m >= D && m <= D + R && g >= P && g <= P + R, m >= x + _ - Wt && m <= x + _ + Wt && !w) {
|
|
2875
|
+
const I = String(S ?? "") !== String(u ?? "") || !!v != !!w;
|
|
2876
|
+
this.hoverHeaderColKey = u, this.hoverHeaderIcon = w, this.canvas.style.cursor = "col-resize", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, I && this.render();
|
|
2877
|
+
return;
|
|
2878
|
+
}
|
|
2821
2879
|
}
|
|
2822
2880
|
}
|
|
2823
|
-
const
|
|
2824
|
-
if (this.hoverHeaderColKey =
|
|
2825
|
-
this.canvas.style.cursor =
|
|
2881
|
+
const y = String(S ?? "") !== String(u ?? "") || !!v != !!w;
|
|
2882
|
+
if (this.hoverHeaderColKey = u, this.hoverHeaderIcon = w, u !== null) {
|
|
2883
|
+
this.canvas.style.cursor = w ? "pointer" : "default", this.tooltip && (this.tooltip.dataset.visible = "0"), this.tooltipTarget = null, this.tooltipMessage = null, y && this.render();
|
|
2826
2884
|
return;
|
|
2827
2885
|
}
|
|
2828
|
-
|
|
2886
|
+
y && this.render();
|
|
2829
2887
|
}
|
|
2830
2888
|
let i = "cell";
|
|
2831
2889
|
const o = this.hitTest(new MouseEvent("mousemove", { clientX: t, clientY: e }));
|
|
@@ -2843,8 +2901,8 @@ const U = class U {
|
|
|
2843
2901
|
}
|
|
2844
2902
|
const n = this.dataModel.getCellMarker(o.rowId, o.colKey);
|
|
2845
2903
|
if (this.tooltip && n) {
|
|
2846
|
-
const d = this.tooltipTarget && this.tooltipTarget.rowId === o.rowId && this.tooltipTarget.colKey === o.colKey,
|
|
2847
|
-
if (!d || !
|
|
2904
|
+
const d = this.tooltipTarget && this.tooltipTarget.rowId === o.rowId && this.tooltipTarget.colKey === o.colKey, f = this.tooltipMessage === n.message;
|
|
2905
|
+
if (!d || !f || this.tooltip.dataset.visible !== "1") {
|
|
2848
2906
|
this.tooltipTarget = { rowId: o.rowId, colKey: o.colKey }, this.tooltipMessage = n.message, this.tooltip.textContent = n.message;
|
|
2849
2907
|
const p = this.getCellRect(o.rowId, o.colKey);
|
|
2850
2908
|
p ? (this.positionTooltipAtRect(p), this.tooltip.dataset.visible = "1") : this.tooltip.dataset.visible = "0";
|
|
@@ -2863,7 +2921,7 @@ const U = class U {
|
|
|
2863
2921
|
this.canvas.style.cursor = "cell";
|
|
2864
2922
|
return;
|
|
2865
2923
|
}
|
|
2866
|
-
if (this.activeRowId && this.activeColKey !== null && this.activeRowId !== "__all__" && this.activeColKey !== "__all__" &&
|
|
2924
|
+
if (this.activeRowId && this.activeColKey !== null && this.activeRowId !== "__all__" && this.activeColKey !== "__all__" && Ht(
|
|
2867
2925
|
this.dataModel,
|
|
2868
2926
|
this.selection,
|
|
2869
2927
|
this.activeRowId,
|
|
@@ -2872,8 +2930,8 @@ const U = class U {
|
|
|
2872
2930
|
)) {
|
|
2873
2931
|
const d = this.getCellRect(this.activeRowId, this.activeColKey);
|
|
2874
2932
|
if (d) {
|
|
2875
|
-
const
|
|
2876
|
-
if (
|
|
2933
|
+
const f = He(d, Ae);
|
|
2934
|
+
if (Le(t, e, f)) {
|
|
2877
2935
|
this.canvas.style.cursor = "crosshair";
|
|
2878
2936
|
return;
|
|
2879
2937
|
}
|
|
@@ -2888,8 +2946,8 @@ const U = class U {
|
|
|
2888
2946
|
for (let l = 0; l < i.columns.length; l += 1) {
|
|
2889
2947
|
const a = i.columns[l];
|
|
2890
2948
|
if (!a || !(s.wrapText?.[a.key] ?? a.wrapText)) continue;
|
|
2891
|
-
const h = (o[l] ?? 100) - this.padding, d = this.dataModel.resolveCellValue(e.id, a),
|
|
2892
|
-
n = Math.max(n,
|
|
2949
|
+
const h = (o[l] ?? 100) - this.padding, d = this.dataModel.resolveCellValue(e.id, a), f = this.dataModel.resolveConditionalStyle(e.id, a), m = d.textOverride ?? (f.forceErrorText ? "#ERROR" : void 0) ? "#ERROR" : this.formatValue(d.value, a).text, S = this.wrapLines(t, m, h).length * this.lineHeight + this.padding;
|
|
2950
|
+
n = Math.max(n, S);
|
|
2893
2951
|
}
|
|
2894
2952
|
return n;
|
|
2895
2953
|
}
|
|
@@ -2929,63 +2987,82 @@ const U = class U {
|
|
|
2929
2987
|
measureTextBounds(t, e, i, o, n, s, l, a) {
|
|
2930
2988
|
const r = this.getTextLinesForBounds(t, e, n, l, s);
|
|
2931
2989
|
if (!r.length) return null;
|
|
2932
|
-
let h = Number.POSITIVE_INFINITY, d = Number.NEGATIVE_INFINITY,
|
|
2990
|
+
let h = Number.POSITIVE_INFINITY, d = Number.NEGATIVE_INFINITY, f = Number.POSITIVE_INFINITY, p = Number.NEGATIVE_INFINITY;
|
|
2933
2991
|
for (let m = 0; m < r.length; m += 1) {
|
|
2934
|
-
const
|
|
2935
|
-
let
|
|
2936
|
-
a === "right" ?
|
|
2937
|
-
const
|
|
2938
|
-
h = Math.min(h,
|
|
2992
|
+
const g = r[m] ?? "", S = t.measureText(g).width;
|
|
2993
|
+
let v = i;
|
|
2994
|
+
a === "right" ? v = i + n - S : a === "center" && (v = i + (n - S) / 2);
|
|
2995
|
+
const u = o + this.lineHeight * m, w = u + this.lineHeight;
|
|
2996
|
+
h = Math.min(h, v), d = Math.max(d, v + S), f = Math.min(f, u), p = Math.max(p, w);
|
|
2939
2997
|
}
|
|
2940
|
-
return !Number.isFinite(h) || !Number.isFinite(
|
|
2998
|
+
return !Number.isFinite(h) || !Number.isFinite(f) ? null : new DOMRect(h, f, d - h, p - f);
|
|
2941
2999
|
}
|
|
2942
|
-
drawCellText(t, e, i, o, n, s, l, a = "left", r = !1, h = !1, d = !1,
|
|
3000
|
+
drawCellText(t, e, i, o, n, s, l, a = "left", r = !1, h = !1, d = !1, f) {
|
|
2943
3001
|
t.save(), t.beginPath(), t.rect(i - 4, o - 4, n + 8, s + 8), t.clip();
|
|
2944
3002
|
const p = t.font;
|
|
2945
|
-
r ? d ? t.font = `${
|
|
2946
|
-
const m = this.getTextLinesForBounds(t, e, n, l, s),
|
|
2947
|
-
const
|
|
2948
|
-
let
|
|
3003
|
+
r ? d ? t.font = `${Bo}px ${Z}` : t.font = "28px sans-serif" : h && (t.font = `${et}px ${Z}`);
|
|
3004
|
+
const m = this.getTextLinesForBounds(t, e, n, l, s), g = m.length * this.lineHeight, S = o + Math.max(0, Math.floor((s - g) / 2)), v = (u, w) => {
|
|
3005
|
+
const y = S + this.lineHeight * w;
|
|
3006
|
+
let C = i, b = i;
|
|
2949
3007
|
if (a === "right")
|
|
2950
|
-
t.textAlign = "right",
|
|
3008
|
+
t.textAlign = "right", b = i + n, C = b - t.measureText(u).width, t.fillText(u, b, y);
|
|
2951
3009
|
else if (a === "center") {
|
|
2952
3010
|
t.textAlign = "center";
|
|
2953
|
-
const
|
|
2954
|
-
|
|
3011
|
+
const M = i + n / 2, x = t.measureText(u).width;
|
|
3012
|
+
C = M - x / 2, b = M + x / 2, t.fillText(u, M, y);
|
|
2955
3013
|
} else
|
|
2956
|
-
t.textAlign = "left",
|
|
2957
|
-
if (
|
|
2958
|
-
const
|
|
2959
|
-
if (t.strokeStyle = t.fillStyle, t.lineWidth = 1, t.beginPath(),
|
|
2960
|
-
const
|
|
2961
|
-
t.moveTo(
|
|
3014
|
+
t.textAlign = "left", C = i, b = i + t.measureText(u).width, t.fillText(u, i, y);
|
|
3015
|
+
if (f?.underline || f?.strike) {
|
|
3016
|
+
const M = t.strokeStyle, x = t.lineWidth;
|
|
3017
|
+
if (t.strokeStyle = t.fillStyle, t.lineWidth = 1, t.beginPath(), f.underline) {
|
|
3018
|
+
const L = y + 2;
|
|
3019
|
+
t.moveTo(C, L), t.lineTo(b, L);
|
|
2962
3020
|
}
|
|
2963
|
-
if (
|
|
2964
|
-
const
|
|
2965
|
-
t.moveTo(
|
|
3021
|
+
if (f.strike) {
|
|
3022
|
+
const L = y - Math.floor(this.lineHeight / 2) + 2;
|
|
3023
|
+
t.moveTo(C, L), t.lineTo(b, L);
|
|
2966
3024
|
}
|
|
2967
|
-
t.stroke(), t.strokeStyle =
|
|
3025
|
+
t.stroke(), t.strokeStyle = M, t.lineWidth = x;
|
|
2968
3026
|
}
|
|
2969
3027
|
};
|
|
2970
|
-
for (let
|
|
2971
|
-
|
|
3028
|
+
for (let u = 0; u < m.length; u += 1)
|
|
3029
|
+
v(m[u] ?? "", u + 1);
|
|
2972
3030
|
t.textAlign = "left", t.font = p, t.restore();
|
|
2973
3031
|
}
|
|
3032
|
+
getUniqueDotColors() {
|
|
3033
|
+
const t = {
|
|
3034
|
+
current: "#ff3b30",
|
|
3035
|
+
previous: "#b0b0b0",
|
|
3036
|
+
default: "#3b82f6"
|
|
3037
|
+
};
|
|
3038
|
+
if (!this.root || typeof getComputedStyle != "function") return t;
|
|
3039
|
+
const e = getComputedStyle(this.root), i = (o, n) => e.getPropertyValue(o).trim() || n;
|
|
3040
|
+
return {
|
|
3041
|
+
current: i("--extable-unique-dot-current", t.current),
|
|
3042
|
+
previous: i("--extable-unique-dot-previous", t.previous),
|
|
3043
|
+
default: i("--extable-unique-dot-default", t.default)
|
|
3044
|
+
};
|
|
3045
|
+
}
|
|
3046
|
+
drawUniqueRadio(t, e, i, o, n, s, l) {
|
|
3047
|
+
const r = Math.max(8, Math.min(12, Math.min(o, n) - 4)) / 2, h = r / 2.2, d = i + n / 2;
|
|
3048
|
+
let f = e + r;
|
|
3049
|
+
s === "right" ? f = e + o - r : s === "center" && (f = e + o / 2), t.save(), t.strokeStyle = l, t.lineWidth = 1.5, t.beginPath(), t.arc(f, d, r, 0, Math.PI * 2), t.stroke(), t.fillStyle = l, t.beginPath(), t.arc(f, d, h, 0, Math.PI * 2), t.fill(), t.restore();
|
|
3050
|
+
}
|
|
2974
3051
|
formatValue(t, e) {
|
|
2975
3052
|
if (t == null) return { text: "" };
|
|
2976
3053
|
if (typeof t == "object") {
|
|
2977
3054
|
const i = t;
|
|
2978
3055
|
if (i.kind === "lookup" && typeof i.label == "string")
|
|
2979
3056
|
return { text: i.label };
|
|
2980
|
-
const o =
|
|
3057
|
+
const o = Ve(t);
|
|
2981
3058
|
if (o !== null) return { text: o };
|
|
2982
3059
|
}
|
|
2983
3060
|
if (e.type === "button")
|
|
2984
|
-
return { text:
|
|
3061
|
+
return { text: ut(t) || String(t) };
|
|
2985
3062
|
if (e.type === "link")
|
|
2986
|
-
return { text:
|
|
3063
|
+
return { text: ft(t) || String(t) };
|
|
2987
3064
|
if (e.type === "tags") {
|
|
2988
|
-
const i =
|
|
3065
|
+
const i = zt(t);
|
|
2989
3066
|
if (i) return { text: i.join(", ") };
|
|
2990
3067
|
}
|
|
2991
3068
|
if (e.type === "boolean")
|
|
@@ -2993,7 +3070,7 @@ const U = class U {
|
|
|
2993
3070
|
if (e.type === "number" && typeof t == "number") {
|
|
2994
3071
|
const i = t, o = e.format;
|
|
2995
3072
|
if ((o?.format ?? "decimal") === "scientific") {
|
|
2996
|
-
const r =
|
|
3073
|
+
const r = At(i, { format: "scientific", precision: o?.precision }), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
|
|
2997
3074
|
return { text: r, color: h };
|
|
2998
3075
|
}
|
|
2999
3076
|
const s = {};
|
|
@@ -3004,7 +3081,7 @@ const U = class U {
|
|
|
3004
3081
|
if ((e.type === "int" || e.type === "uint") && typeof t == "number") {
|
|
3005
3082
|
const i = t, o = e.format, n = o?.format ?? "decimal";
|
|
3006
3083
|
if (n === "binary" || n === "octal" || n === "hex") {
|
|
3007
|
-
const r =
|
|
3084
|
+
const r = Ut(i, n), h = o?.negativeRed && i < 0 ? "#b91c1c" : void 0;
|
|
3008
3085
|
return { text: r, color: h };
|
|
3009
3086
|
}
|
|
3010
3087
|
const s = {
|
|
@@ -3017,59 +3094,68 @@ const U = class U {
|
|
|
3017
3094
|
if ((e.type === "date" || e.type === "time" || e.type === "datetime") && (t instanceof Date || typeof t == "string")) {
|
|
3018
3095
|
const i = e.format, o = e.type === "date" ? i ?? "yyyy-MM-dd" : e.type === "time" ? i ?? "HH:mm" : i ?? "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
|
3019
3096
|
let n = null;
|
|
3020
|
-
return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text:
|
|
3097
|
+
return t instanceof Date ? n = t : n = this.valueFormatCache.parseIsoDate(t), n ? { text: ge(n, o) } : { text: String(t) };
|
|
3021
3098
|
}
|
|
3022
3099
|
return { text: String(t) };
|
|
3023
3100
|
}
|
|
3024
3101
|
};
|
|
3025
3102
|
U.MAX_CANVAS_DIM_PX = 8192, U.ROW_HEIGHT_MEASURE_CHUNK = 500, U.ROW_HEIGHT_MEASURE_TIME_BUDGET_MS = 8, U.TEXT_MEASURE_CACHE_MAX = 2e3;
|
|
3026
|
-
let
|
|
3027
|
-
class
|
|
3028
|
-
constructor(t, e, i, o, n, s, l, a, r, h, d,
|
|
3029
|
-
this.dataModel = a, this.onActiveChange =
|
|
3103
|
+
let Lt = U;
|
|
3104
|
+
class zo {
|
|
3105
|
+
constructor(t, e, i, o, n, s, l, a, r, h, d, f, p, m, g, S, v) {
|
|
3106
|
+
this.dataModel = a, this.onActiveChange = p, this.onSelectionChange = g, this.onUndo = S, this.onRedo = v, this.hitAction = null, this.handleDocumentContextMenu = null, this.selectionRanges = [], this.inputEl = null, this.floatingInputWrapper = null, this.selectionInput = null, this.copyToastEl = null, this.copyToastTimer = null, this.lookupDropdownEl = null, this.lookupDropdownTarget = null, this.lookupCandidates = [], this.lookupHighlightIndex = -1, this.lookupRequestId = 0, this.lookupAbort = null, this.lookupDebounceTimer = null, this.lookupInputCleanup = null, this.lookupRecentHistory = /* @__PURE__ */ new Map(), this.lastCommittedLookupCell = null, this.hoverTooltipEl = null, this.hoverTooltipTarget = null, this.hoverTooltipMessage = null, this.hoverTooltipRequestId = 0, this.hoverTooltipAbort = null, this.externalEditInFlight = !1, this.externalEditRequestId = 0, this.selectionMode = !0, this.lastBooleanCell = null, this.selectionAnchor = null, this.dragging = !1, this.dragStart = null, this.pointerDownClient = null, this.dragMoved = !1, this.dragSelectionChanged = !1, this.suppressNextClick = !1, this.fillDragging = !1, this.fillSource = null, this.fillEndRowIndex = null, this.columnResizing = !1, this.columnResizeState = null, this.rootCursorBackup = null, this.resizeCursorBackup = null, this.lastPointerClient = null, this.autoScrollRaf = null, this.autoScrollActive = !1, this.activeCell = null, this.activeHost = null, this.activeHostOriginalText = null, this.activeOriginalValue = null, this.composing = !1, this.lastCompositionEnd = 0, this.handleInputCompositionStart = () => {
|
|
3030
3107
|
this.composing = !0;
|
|
3031
3108
|
}, this.handleInputCompositionEnd = () => {
|
|
3032
3109
|
this.composing = !1, this.lastCompositionEnd = Date.now();
|
|
3033
|
-
}, this.handleSelectionBlur = (
|
|
3034
|
-
|
|
3035
|
-
}, this.handleRootKeydown = async (
|
|
3036
|
-
if (
|
|
3037
|
-
const
|
|
3038
|
-
|
|
3110
|
+
}, this.handleSelectionBlur = (u) => {
|
|
3111
|
+
u?.relatedTarget instanceof HTMLElement && this.lookupDropdownEl?.contains(u.relatedTarget) || this.teardownSelectionInput();
|
|
3112
|
+
}, this.handleRootKeydown = async (u) => {
|
|
3113
|
+
if (u.defaultPrevented || !this.selectionMode || this.inputEl || u.isComposing || this.composing || !(typeof navigator < "u" && /mac/i.test(navigator.platform) ? u.metaKey : u.ctrlKey)) return;
|
|
3114
|
+
const C = u.key.toLowerCase();
|
|
3115
|
+
C === "c" ? (u.preventDefault(), await this.copySelection()) : C === "x" && (u.preventDefault(), await this.copySelection(), this.clearSelectionValues());
|
|
3039
3116
|
}, this.handlePointerLeave = () => {
|
|
3040
3117
|
this.hideHoverTooltip();
|
|
3041
|
-
}, this.handlePointerDown = (
|
|
3042
|
-
if (
|
|
3043
|
-
const
|
|
3044
|
-
if (
|
|
3045
|
-
const y = this.
|
|
3046
|
-
if (
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3118
|
+
}, this.handlePointerDown = (u) => {
|
|
3119
|
+
if (u.button !== 0) return;
|
|
3120
|
+
const w = u.target;
|
|
3121
|
+
if (w?.closest('button[data-extable-fs-open="1"]') || w?.closest(".extable-filter-sort-trigger") || w?.closest("button.extable-lookup-option") || this.inputEl && u.target && this.inputEl.contains(u.target) || this.inputEl && this.activeCell && this.activeCell.colKey !== null && !this.tryCommitActiveEditor() || this.fillDragging) return;
|
|
3122
|
+
const y = this.getColumnResizeHit(u.clientX, u.clientY, u.target);
|
|
3123
|
+
if (y) {
|
|
3124
|
+
u.preventDefault(), this.beginColumnResize(y.colKey, y.colIndex, u.clientX), this.suppressNextClick = !0;
|
|
3125
|
+
try {
|
|
3126
|
+
u.target?.setPointerCapture?.(u.pointerId);
|
|
3127
|
+
} catch {
|
|
3128
|
+
}
|
|
3129
|
+
return;
|
|
3130
|
+
}
|
|
3131
|
+
const C = this.hitTest(u);
|
|
3132
|
+
if (!C || C.rowId === "__all__" && C.colKey === "__all__" || C.colKey === "__all__") return;
|
|
3133
|
+
const b = Te(this.dataModel, this.selectionRanges);
|
|
3134
|
+
if (b && this.activeCell) {
|
|
3135
|
+
const R = this.dataModel.getSchema(), A = this.dataModel.listRows(), D = b.endRowIndex, P = b.colIndex, j = A[D], I = R.columns[P];
|
|
3136
|
+
if (j && I) {
|
|
3137
|
+
const F = this.findHtmlCellElement(j.id, I.key)?.getBoundingClientRect() ?? this.computeCanvasCellRect(j.id, I.key);
|
|
3138
|
+
if (F && Ht(
|
|
3053
3139
|
this.dataModel,
|
|
3054
3140
|
this.selectionRanges,
|
|
3055
3141
|
this.activeCell.rowId,
|
|
3056
3142
|
this.activeCell.colKey,
|
|
3057
3143
|
this.editMode
|
|
3058
3144
|
)) {
|
|
3059
|
-
const B =
|
|
3060
|
-
if (
|
|
3061
|
-
|
|
3145
|
+
const B = He(F, Ae);
|
|
3146
|
+
if (Le(u.clientX, u.clientY, B)) {
|
|
3147
|
+
u.preventDefault(), this.fillDragging = !0, this.fillSource = b, this.fillEndRowIndex = b.endRowIndex, this.root.dataset.extableFillDragging = "1", this.rootCursorBackup === null && (this.rootCursorBackup = this.root.style.cursor || ""), this.root.style.cursor = "crosshair", this.lastPointerClient = { x: u.clientX, y: u.clientY }, this.dragging = !1, this.dragStart = null, this.suppressNextClick = !0;
|
|
3062
3148
|
try {
|
|
3063
|
-
|
|
3149
|
+
u.target?.setPointerCapture?.(u.pointerId);
|
|
3064
3150
|
} catch {
|
|
3065
3151
|
}
|
|
3066
3152
|
this.selectionRanges = [
|
|
3067
3153
|
{
|
|
3068
3154
|
kind: "cells",
|
|
3069
|
-
startRow:
|
|
3070
|
-
endRow:
|
|
3071
|
-
startCol:
|
|
3072
|
-
endCol:
|
|
3155
|
+
startRow: b.startRowIndex,
|
|
3156
|
+
endRow: b.endRowIndex,
|
|
3157
|
+
startCol: b.colIndex,
|
|
3158
|
+
endCol: b.colIndex
|
|
3073
3159
|
}
|
|
3074
3160
|
], this.onSelectionChange(this.selectionRanges), this.startAutoScroll();
|
|
3075
3161
|
return;
|
|
@@ -3077,228 +3163,242 @@ class No {
|
|
|
3077
3163
|
}
|
|
3078
3164
|
}
|
|
3079
3165
|
}
|
|
3080
|
-
const
|
|
3081
|
-
if (
|
|
3082
|
-
if (
|
|
3083
|
-
if (!
|
|
3084
|
-
const
|
|
3166
|
+
const M = this.dataModel.getSchema(), x = this.dataModel.listRows(), L = C.rowId === "__header__" ? 0 : this.dataModel.getRowIndex(C.rowId), K = M.columns.findIndex((R) => String(R.key) === String(C.colKey));
|
|
3167
|
+
if (K < 0) return;
|
|
3168
|
+
if (C.rowId === "__header__") {
|
|
3169
|
+
if (!x.length) return;
|
|
3170
|
+
const R = {
|
|
3085
3171
|
kind: "cells",
|
|
3086
3172
|
startRow: 0,
|
|
3087
|
-
endRow:
|
|
3088
|
-
startCol:
|
|
3089
|
-
endCol:
|
|
3173
|
+
endRow: x.length - 1,
|
|
3174
|
+
startCol: K,
|
|
3175
|
+
endCol: K
|
|
3090
3176
|
};
|
|
3091
|
-
this.selectionRanges = [
|
|
3092
|
-
const
|
|
3093
|
-
|
|
3177
|
+
this.selectionRanges = [R], this.onSelectionChange(this.selectionRanges), this.dragging = !1, this.selectionMode = !0, this.dragStart = null, this.selectionAnchor = null, this.suppressNextClick = !1;
|
|
3178
|
+
const A = x[0], D = M.columns[K];
|
|
3179
|
+
A && D && (this.activeCell = { rowId: A.id, colKey: D.key }, this.onActiveChange(A.id, D.key)), this.focusSelectionInput("");
|
|
3094
3180
|
return;
|
|
3095
3181
|
}
|
|
3096
|
-
if (
|
|
3097
|
-
const
|
|
3098
|
-
this.dragging = !0, this.pointerDownClient = { x:
|
|
3182
|
+
if (L < 0) return;
|
|
3183
|
+
const _ = C.colKey === null ? "rows" : "cells";
|
|
3184
|
+
this.dragging = !0, this.pointerDownClient = { x: u.clientX, y: u.clientY }, this.dragMoved = !1, this.dragSelectionChanged = !1, this.dragStart = { rowIndex: L, colIndex: K, kind: _ }, this.suppressNextClick = !1, this.selectionMode = !0, this.selectionAnchor = null, this.lastCommittedLookupCell = null, this.lastPointerClient = { x: u.clientX, y: u.clientY };
|
|
3099
3185
|
try {
|
|
3100
|
-
|
|
3186
|
+
u.target?.setPointerCapture?.(u.pointerId);
|
|
3101
3187
|
} catch {
|
|
3102
3188
|
}
|
|
3103
3189
|
this.startAutoScroll();
|
|
3104
|
-
}, this.handlePointerMove = (
|
|
3105
|
-
if (this.lastPointerClient = { x:
|
|
3106
|
-
this.
|
|
3190
|
+
}, this.handlePointerMove = (u) => {
|
|
3191
|
+
if (this.lastPointerClient = { x: u.clientX, y: u.clientY }, this.columnResizing) {
|
|
3192
|
+
this.updateColumnResize(u.clientX);
|
|
3193
|
+
return;
|
|
3194
|
+
}
|
|
3195
|
+
if (this.fillDragging && this.fillSource) {
|
|
3196
|
+
this.updateFillDragFromClientPoint(u.clientX, u.clientY);
|
|
3107
3197
|
return;
|
|
3108
3198
|
}
|
|
3109
3199
|
if (!this.dragging || !this.dragStart) {
|
|
3110
|
-
this.updateHoverTooltip(
|
|
3200
|
+
this.updateHoverTooltip(u);
|
|
3111
3201
|
return;
|
|
3112
3202
|
}
|
|
3113
3203
|
if (!this.dragMoved && this.pointerDownClient) {
|
|
3114
|
-
const
|
|
3115
|
-
if (
|
|
3204
|
+
const w = u.clientX - this.pointerDownClient.x, y = u.clientY - this.pointerDownClient.y;
|
|
3205
|
+
if (w * w + y * y < 9) return;
|
|
3116
3206
|
this.dragMoved = !0;
|
|
3117
3207
|
}
|
|
3118
|
-
this.updateDragFromClientPoint(
|
|
3119
|
-
}, this.handlePointerUp = (
|
|
3208
|
+
this.updateDragFromClientPoint(u.clientX, u.clientY);
|
|
3209
|
+
}, this.handlePointerUp = (u) => {
|
|
3210
|
+
if (this.columnResizing) {
|
|
3211
|
+
this.endColumnResize();
|
|
3212
|
+
try {
|
|
3213
|
+
u.target?.releasePointerCapture?.(u.pointerId);
|
|
3214
|
+
} catch {
|
|
3215
|
+
}
|
|
3216
|
+
this.suppressNextClick = !0;
|
|
3217
|
+
return;
|
|
3218
|
+
}
|
|
3120
3219
|
if (this.fillDragging && this.fillSource) {
|
|
3121
|
-
const y = this.fillSource,
|
|
3220
|
+
const y = this.fillSource, C = this.fillEndRowIndex ?? y.endRowIndex;
|
|
3122
3221
|
this.fillDragging = !1, this.fillSource = null, this.fillEndRowIndex = null, this.root.dataset.extableFillDragging = "", this.rootCursorBackup !== null && (this.root.style.cursor = this.rootCursorBackup, this.rootCursorBackup = null), this.stopAutoScroll();
|
|
3123
3222
|
try {
|
|
3124
|
-
|
|
3223
|
+
u.target?.releasePointerCapture?.(u.pointerId);
|
|
3125
3224
|
} catch {
|
|
3126
3225
|
}
|
|
3127
|
-
this.commitFill(y,
|
|
3226
|
+
this.commitFill(y, C), this.suppressNextClick = !0;
|
|
3128
3227
|
return;
|
|
3129
3228
|
}
|
|
3130
3229
|
if (!this.dragging) return;
|
|
3131
3230
|
this.dragging = !1, this.dragStart = null;
|
|
3132
|
-
const
|
|
3231
|
+
const w = this.dragSelectionChanged;
|
|
3133
3232
|
this.pointerDownClient = null, this.dragMoved = !1, this.dragSelectionChanged = !1, this.stopAutoScroll();
|
|
3134
3233
|
try {
|
|
3135
|
-
|
|
3234
|
+
u.target?.releasePointerCapture?.(u.pointerId);
|
|
3136
3235
|
} catch {
|
|
3137
3236
|
}
|
|
3138
|
-
if (
|
|
3237
|
+
if (w && (this.suppressNextClick = !0), this.suppressNextClick && this.activeCell && this.activeCell.colKey !== null) {
|
|
3139
3238
|
const y = this.dataModel.getCell(this.activeCell.rowId, this.activeCell.colKey);
|
|
3140
3239
|
this.focusSelectionInput(this.cellToClipboardString(y));
|
|
3141
3240
|
}
|
|
3142
|
-
}, this.handleSelectionCopy = (
|
|
3241
|
+
}, this.handleSelectionCopy = (u) => {
|
|
3143
3242
|
if (!this.selectionMode) return;
|
|
3144
|
-
const
|
|
3145
|
-
|
|
3146
|
-
}, this.handleSelectionCut = (
|
|
3243
|
+
const w = this.buildSelectionClipboardPayload();
|
|
3244
|
+
w && (u.preventDefault(), u.clipboardData?.setData("text/plain", w.text), u.clipboardData?.setData("text/tab-separated-values", w.text), u.clipboardData?.setData("text/html", w.html), this.showCopyToast(`Copied ${w.cellCount} cells`, "info"));
|
|
3245
|
+
}, this.handleSelectionCut = (u) => {
|
|
3147
3246
|
if (!this.selectionMode) return;
|
|
3148
|
-
const
|
|
3149
|
-
|
|
3150
|
-
}, this.handleSelectionPaste = (
|
|
3247
|
+
const w = this.buildSelectionClipboardPayload();
|
|
3248
|
+
w && (u.preventDefault(), u.clipboardData?.setData("text/plain", w.text), u.clipboardData?.setData("text/tab-separated-values", w.text), u.clipboardData?.setData("text/html", w.html), this.clearSelectionValues());
|
|
3249
|
+
}, this.handleSelectionPaste = (u) => {
|
|
3151
3250
|
if (!this.selectionMode) return;
|
|
3152
|
-
|
|
3153
|
-
const
|
|
3251
|
+
u.preventDefault();
|
|
3252
|
+
const w = u.clipboardData?.getData("text/html") ?? "", y = u.clipboardData?.getData("text/tab-separated-values") ?? "", C = u.clipboardData?.getData("text/plain") ?? "", b = this.parseClipboardGrid({ html: w, tsv: y, text: C });
|
|
3154
3253
|
b && this.applyClipboardGrid(b);
|
|
3155
|
-
}, this.handleSelectionCompositionStart = (
|
|
3254
|
+
}, this.handleSelectionCompositionStart = (u) => {
|
|
3156
3255
|
if (!this.selectionMode) return;
|
|
3157
|
-
const
|
|
3158
|
-
if (!(!
|
|
3159
|
-
if (this.isCellReadonly(
|
|
3160
|
-
|
|
3161
|
-
const y = this.dataModel.getCell(
|
|
3162
|
-
this.teardownSelectionInput(), this.focusSelectionInput(
|
|
3256
|
+
const w = this.activeCell;
|
|
3257
|
+
if (!(!w || w.colKey === null)) {
|
|
3258
|
+
if (this.isCellReadonly(w.rowId, w.colKey)) {
|
|
3259
|
+
u?.preventDefault?.(), u?.stopPropagation?.();
|
|
3260
|
+
const y = this.dataModel.getCell(w.rowId, w.colKey), C = this.cellToClipboardString(y);
|
|
3261
|
+
this.teardownSelectionInput(), this.focusSelectionInput(C);
|
|
3163
3262
|
return;
|
|
3164
3263
|
}
|
|
3165
3264
|
this.selectionMode = !1, this.openEditorAtActiveCell();
|
|
3166
3265
|
}
|
|
3167
|
-
}, this.handleSelectionBeforeInput = (
|
|
3266
|
+
}, this.handleSelectionBeforeInput = (u) => {
|
|
3168
3267
|
if (!this.selectionMode) return;
|
|
3169
|
-
const
|
|
3170
|
-
if (!(!
|
|
3171
|
-
|
|
3268
|
+
const w = this.activeCell;
|
|
3269
|
+
if (!(!w || w.colKey === null) && this.isCellReadonly(w.rowId, w.colKey)) {
|
|
3270
|
+
u.preventDefault();
|
|
3172
3271
|
try {
|
|
3173
|
-
const y = this.dataModel.getCell(
|
|
3174
|
-
b.value =
|
|
3272
|
+
const y = this.dataModel.getCell(w.rowId, w.colKey), C = this.cellToClipboardString(y), b = this.ensureSelectionInput();
|
|
3273
|
+
b.value = C, b.select();
|
|
3175
3274
|
} catch {
|
|
3176
3275
|
}
|
|
3177
3276
|
}
|
|
3178
|
-
}, this.handleSelectionKeydown = async (
|
|
3179
|
-
if (!this.activeCell ||
|
|
3277
|
+
}, this.handleSelectionKeydown = async (u) => {
|
|
3278
|
+
if (!this.activeCell || u.isComposing || this.composing) return;
|
|
3180
3279
|
if (!this.selectionMode && this.inputEl) {
|
|
3181
|
-
this.handleKey(
|
|
3280
|
+
this.handleKey(u, document.createElement("div"));
|
|
3182
3281
|
return;
|
|
3183
3282
|
}
|
|
3184
|
-
if (!this.selectionMode ||
|
|
3283
|
+
if (!this.selectionMode || u.key === "Shift" || u.key === "Control" || u.key === "Alt" || u.key === "Meta" || u.key === "CapsLock" || u.key === "NumLock" || u.key === "ScrollLock")
|
|
3185
3284
|
return;
|
|
3186
|
-
const
|
|
3187
|
-
if (
|
|
3188
|
-
const
|
|
3189
|
-
if (
|
|
3190
|
-
|
|
3285
|
+
const w = typeof navigator < "u" && /mac/i.test(navigator.platform);
|
|
3286
|
+
if (w ? u.metaKey : u.ctrlKey) {
|
|
3287
|
+
const x = u.key.toLowerCase();
|
|
3288
|
+
if (x === "z") {
|
|
3289
|
+
u.preventDefault(), w && u.shiftKey ? this.onRedo() : this.onUndo(), this.selectionAnchor = null;
|
|
3191
3290
|
return;
|
|
3192
3291
|
}
|
|
3193
|
-
if (
|
|
3194
|
-
|
|
3292
|
+
if (x === "y") {
|
|
3293
|
+
u.preventDefault(), this.onRedo(), this.selectionAnchor = null;
|
|
3195
3294
|
return;
|
|
3196
3295
|
}
|
|
3197
|
-
if (
|
|
3198
|
-
|
|
3296
|
+
if (x === "c") {
|
|
3297
|
+
u.preventDefault(), await this.copySelection(), this.selectionAnchor = null;
|
|
3199
3298
|
return;
|
|
3200
3299
|
}
|
|
3201
|
-
if (
|
|
3202
|
-
|
|
3300
|
+
if (x === "x") {
|
|
3301
|
+
u.preventDefault(), await this.copySelection(), this.clearSelectionValues(), this.selectionAnchor = null;
|
|
3203
3302
|
return;
|
|
3204
3303
|
}
|
|
3205
|
-
if (
|
|
3304
|
+
if (x === "v") {
|
|
3206
3305
|
this.selectionAnchor = null;
|
|
3207
3306
|
return;
|
|
3208
3307
|
}
|
|
3209
3308
|
}
|
|
3210
|
-
if (
|
|
3211
|
-
const
|
|
3212
|
-
if (
|
|
3213
|
-
|
|
3309
|
+
if (u.key === " " && this.activeCell.colKey !== null) {
|
|
3310
|
+
const x = this.findColumn(this.activeCell.colKey);
|
|
3311
|
+
if (x?.type === "button" || x?.type === "link") {
|
|
3312
|
+
u.preventDefault(), this.triggerCellAction(this.activeCell.rowId, this.activeCell.colKey, x.type), this.selectionAnchor = null;
|
|
3214
3313
|
return;
|
|
3215
3314
|
}
|
|
3216
|
-
if (
|
|
3217
|
-
|
|
3315
|
+
if (x?.type === "boolean") {
|
|
3316
|
+
u.preventDefault(), this.toggleBoolean(this.activeCell.rowId, this.activeCell.colKey), this.selectionAnchor = null;
|
|
3218
3317
|
return;
|
|
3219
3318
|
}
|
|
3220
3319
|
this.selectionAnchor = null;
|
|
3221
3320
|
return;
|
|
3222
3321
|
}
|
|
3223
|
-
const
|
|
3224
|
-
if (
|
|
3225
|
-
if (
|
|
3226
|
-
this.moveActiveCell(0,
|
|
3322
|
+
const C = u.key === "Tab", b = u.key === "Enter", M = u.key === "ArrowLeft" || u.key === "ArrowRight" || u.key === "ArrowUp" || u.key === "ArrowDown";
|
|
3323
|
+
if (C || b || M) {
|
|
3324
|
+
if (u.preventDefault(), this.teardownSelectionInput(), C) {
|
|
3325
|
+
this.moveActiveCell(0, u.shiftKey ? -1 : 1, !1);
|
|
3227
3326
|
return;
|
|
3228
3327
|
}
|
|
3229
3328
|
if (b) {
|
|
3230
|
-
this.moveActiveCell(
|
|
3329
|
+
this.moveActiveCell(u.shiftKey ? -1 : 1, 0, !1);
|
|
3231
3330
|
return;
|
|
3232
3331
|
}
|
|
3233
|
-
const
|
|
3234
|
-
|
|
3332
|
+
const x = u.shiftKey;
|
|
3333
|
+
u.key === "ArrowLeft" ? this.moveActiveCell(0, -1, x) : u.key === "ArrowRight" ? this.moveActiveCell(0, 1, x) : u.key === "ArrowUp" ? this.moveActiveCell(-1, 0, x) : u.key === "ArrowDown" && this.moveActiveCell(1, 0, x);
|
|
3235
3334
|
return;
|
|
3236
3335
|
}
|
|
3237
3336
|
if (this.activeCell.colKey !== null && this.isCellReadonly(this.activeCell.rowId, this.activeCell.colKey)) {
|
|
3238
|
-
|
|
3337
|
+
u.preventDefault(), this.selectionAnchor = null;
|
|
3239
3338
|
return;
|
|
3240
3339
|
}
|
|
3241
3340
|
this.selectionMode = !1, this.selectionAnchor = null, this.openEditorAtActiveCell();
|
|
3242
|
-
}, this.handleClick = (
|
|
3243
|
-
const
|
|
3244
|
-
if (
|
|
3341
|
+
}, this.handleClick = (u) => {
|
|
3342
|
+
const w = u.target;
|
|
3343
|
+
if (u.button !== 0 || w?.closest("button.extable-lookup-option") || w?.closest('button[data-extable-fs-open="1"]'))
|
|
3245
3344
|
return;
|
|
3246
3345
|
if (this.suppressNextClick) {
|
|
3247
3346
|
this.suppressNextClick = !1;
|
|
3248
3347
|
return;
|
|
3249
3348
|
}
|
|
3250
|
-
if (this.inputEl &&
|
|
3349
|
+
if (this.inputEl && u.target && this.inputEl.contains(u.target) || this.inputEl && this.activeCell && this.activeCell.colKey !== null && !this.tryCommitActiveEditor())
|
|
3251
3350
|
return;
|
|
3252
|
-
const y = this.getHitAtClientPoint(
|
|
3253
|
-
if (
|
|
3351
|
+
const y = this.getHitAtClientPoint(u.clientX, u.clientY, u.target), C = u.target?.closest(".extable-unique-radio");
|
|
3352
|
+
if (C && y) {
|
|
3254
3353
|
if (y.colKey === null) return;
|
|
3255
|
-
const
|
|
3256
|
-
if (
|
|
3257
|
-
this.
|
|
3354
|
+
const R = this.findColumn(y.colKey);
|
|
3355
|
+
if (R && R.type === "boolean" && R.unique) {
|
|
3356
|
+
if (this.isCellReadonly(y.rowId, y.colKey) || C.getAttribute("aria-disabled") === "true") return;
|
|
3357
|
+
this.toggleBoolean(y.rowId, y.colKey), u.preventDefault();
|
|
3258
3358
|
return;
|
|
3259
3359
|
}
|
|
3260
3360
|
}
|
|
3261
3361
|
if (!y) return;
|
|
3262
|
-
const b = this.hitAction ? this.hitAction(
|
|
3362
|
+
const b = this.hitAction ? this.hitAction(u) : null;
|
|
3263
3363
|
if (b) {
|
|
3264
3364
|
if (b.kind === "tag-remove") {
|
|
3265
3365
|
if (this.removeTagValue(b.rowId, b.colKey, b.tagIndex)) {
|
|
3266
|
-
|
|
3366
|
+
u.preventDefault();
|
|
3267
3367
|
return;
|
|
3268
3368
|
}
|
|
3269
3369
|
} else if (this.triggerCellAction(b.rowId, b.colKey, b.kind)) {
|
|
3270
|
-
|
|
3370
|
+
u.preventDefault();
|
|
3271
3371
|
return;
|
|
3272
3372
|
}
|
|
3273
3373
|
}
|
|
3274
|
-
const
|
|
3374
|
+
const M = this.selectionMode && !u.shiftKey && !u.metaKey && !u.ctrlKey && this.activeCell?.rowId === y.rowId && String(this.activeCell?.colKey) === String(y.colKey);
|
|
3275
3375
|
if (y.rowId === "__all__" && y.colKey === "__all__") {
|
|
3276
|
-
const
|
|
3277
|
-
this.teardownInput(!1),
|
|
3376
|
+
const R = this.dataModel.getSchema(), A = this.dataModel.listRows();
|
|
3377
|
+
this.teardownInput(!1), A.length && R.columns.length ? (this.selectionRanges = [
|
|
3278
3378
|
{
|
|
3279
3379
|
kind: "cells",
|
|
3280
3380
|
startRow: 0,
|
|
3281
|
-
endRow:
|
|
3381
|
+
endRow: A.length - 1,
|
|
3282
3382
|
startCol: 0,
|
|
3283
|
-
endCol:
|
|
3383
|
+
endCol: R.columns.length - 1
|
|
3284
3384
|
}
|
|
3285
3385
|
], this.activeCell = { rowId: "__all__", colKey: "__all__" }, this.onActiveChange("__all__", "__all__"), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag(), this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput("")) : (this.activeCell = null, this.onActiveChange("__all__", "__all__"), this.selectionAnchor = null);
|
|
3286
3386
|
return;
|
|
3287
3387
|
}
|
|
3288
3388
|
if (this.onRowSelect(y.rowId), y.rowId === "__header__") {
|
|
3289
|
-
const
|
|
3290
|
-
|
|
3389
|
+
const R = this.dataModel.getSchema(), A = this.dataModel.listRows(), D = R.columns.findIndex((P) => String(P.key) === String(y.colKey));
|
|
3390
|
+
A.length && D >= 0 && (this.selectionRanges = [
|
|
3291
3391
|
{
|
|
3292
3392
|
kind: "cells",
|
|
3293
3393
|
startRow: 0,
|
|
3294
|
-
endRow:
|
|
3295
|
-
startCol:
|
|
3296
|
-
endCol:
|
|
3394
|
+
endRow: A.length - 1,
|
|
3395
|
+
startCol: D,
|
|
3396
|
+
endCol: D
|
|
3297
3397
|
}
|
|
3298
|
-
], this.activeCell = { rowId:
|
|
3398
|
+
], this.activeCell = { rowId: A[0].id, colKey: y.colKey }, this.onActiveChange(this.activeCell.rowId, this.activeCell.colKey), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag(), this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput(""));
|
|
3299
3399
|
return;
|
|
3300
3400
|
}
|
|
3301
|
-
if (this.applySelectionFromHit(
|
|
3401
|
+
if (this.applySelectionFromHit(u, y), y.colKey === null || y.colKey === "__all__") {
|
|
3302
3402
|
this.selectionMode = !0, this.selectionAnchor = null, this.focusSelectionInput("");
|
|
3303
3403
|
return;
|
|
3304
3404
|
}
|
|
@@ -3308,13 +3408,13 @@ class No {
|
|
|
3308
3408
|
}
|
|
3309
3409
|
if (this.isCellReadonly(y.rowId, y.colKey)) {
|
|
3310
3410
|
this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1);
|
|
3311
|
-
const
|
|
3312
|
-
this.focusSelectionInput(this.cellToClipboardString(
|
|
3411
|
+
const R = this.dataModel.getCell(y.rowId, y.colKey);
|
|
3412
|
+
this.focusSelectionInput(this.cellToClipboardString(R));
|
|
3313
3413
|
return;
|
|
3314
3414
|
}
|
|
3315
3415
|
if (this.findColumn(y.colKey)?.type === "boolean") {
|
|
3316
|
-
const
|
|
3317
|
-
if (this.lastBooleanCell = { rowId: y.rowId, colKey: y.colKey }, this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1), this.teardownSelectionInput(),
|
|
3416
|
+
const R = this.lastBooleanCell?.rowId === y.rowId && String(this.lastBooleanCell?.colKey) === String(y.colKey);
|
|
3417
|
+
if (this.lastBooleanCell = { rowId: y.rowId, colKey: y.colKey }, this.selectionMode = !0, this.selectionAnchor = null, this.teardownInput(!1), this.teardownSelectionInput(), R) {
|
|
3318
3418
|
this.toggleBoolean(y.rowId, y.colKey), this.focusSelectionInput("");
|
|
3319
3419
|
return;
|
|
3320
3420
|
}
|
|
@@ -3322,19 +3422,19 @@ class No {
|
|
|
3322
3422
|
return;
|
|
3323
3423
|
}
|
|
3324
3424
|
this.lastBooleanCell = null, this.selectionAnchor = null, this.teardownInput(!1);
|
|
3325
|
-
const
|
|
3326
|
-
this.focusSelectionInput(
|
|
3327
|
-
}, this.handleContextMenu = (
|
|
3328
|
-
const
|
|
3329
|
-
if (
|
|
3330
|
-
|
|
3425
|
+
const K = this.dataModel.getCell(y.rowId, y.colKey), _ = this.cellToClipboardString(K);
|
|
3426
|
+
this.focusSelectionInput(_), M && (this.selectionMode = !1, this.openEditorAtActiveCell());
|
|
3427
|
+
}, this.handleContextMenu = (u) => {
|
|
3428
|
+
const w = u.target;
|
|
3429
|
+
if (u.ctrlKey) {
|
|
3430
|
+
u.preventDefault();
|
|
3331
3431
|
return;
|
|
3332
3432
|
}
|
|
3333
|
-
if (!
|
|
3334
|
-
|
|
3335
|
-
const y = this.hitTest(
|
|
3336
|
-
this.onContextMenu(
|
|
3337
|
-
}, this.root = t, this.editMode = e, this.onEdit = i, this.onRowSelect = o, this.onMove = n, this.hitTest = s, this.hitAction = l, this.sequenceLangs = r, this.isCellReadonly = h, this.onCellAction = d, this.onContextMenu =
|
|
3433
|
+
if (!w || !this.root.contains(w)) return;
|
|
3434
|
+
u.preventDefault(), u.stopPropagation();
|
|
3435
|
+
const y = this.hitTest(u), C = y?.rowId ?? null, b = y?.colKey ?? null;
|
|
3436
|
+
this.onContextMenu(C, b, u.clientX, u.clientY);
|
|
3437
|
+
}, this.root = t, this.editMode = e, this.onEdit = i, this.onRowSelect = o, this.onMove = n, this.hitTest = s, this.hitAction = l, this.sequenceLangs = r, this.isCellReadonly = h, this.onCellAction = d, this.onViewChange = f, this.onContextMenu = m, this.bind();
|
|
3338
3438
|
}
|
|
3339
3439
|
setEditMode(t) {
|
|
3340
3440
|
this.editMode = t;
|
|
@@ -3345,9 +3445,9 @@ class No {
|
|
|
3345
3445
|
this.selectionRanges = [], this.activeCell = null, this.selectionAnchor = null, this.lastBooleanCell = null, this.teardownInput(!0), this.onActiveChange(null, null), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
|
|
3346
3446
|
return;
|
|
3347
3447
|
}
|
|
3348
|
-
const i = e.length - 1, o = t.columns.length - 1, n = this.activeCell?.rowId ?? null, s = this.activeCell?.colKey ?? null, l = n ? this.dataModel.getRowIndex(n) : -1, a = s !== null ? t.columns.findIndex((
|
|
3448
|
+
const i = e.length - 1, o = t.columns.length - 1, n = this.activeCell?.rowId ?? null, s = this.activeCell?.colKey ?? null, l = n ? this.dataModel.getRowIndex(n) : -1, a = s !== null ? t.columns.findIndex((u) => String(u.key) === String(s)) : -1;
|
|
3349
3449
|
if (l >= 0 && a >= 0) {
|
|
3350
|
-
let
|
|
3450
|
+
let u = !1;
|
|
3351
3451
|
if (!this.selectionRanges.length)
|
|
3352
3452
|
this.selectionRanges = [
|
|
3353
3453
|
{
|
|
@@ -3357,40 +3457,40 @@ class No {
|
|
|
3357
3457
|
startCol: a,
|
|
3358
3458
|
endCol: a
|
|
3359
3459
|
}
|
|
3360
|
-
],
|
|
3460
|
+
], u = !0;
|
|
3361
3461
|
else {
|
|
3362
|
-
const
|
|
3363
|
-
const
|
|
3364
|
-
...
|
|
3365
|
-
startRow:
|
|
3366
|
-
endRow:
|
|
3367
|
-
startCol:
|
|
3368
|
-
endCol:
|
|
3462
|
+
const w = this.selectionRanges.map((y) => {
|
|
3463
|
+
const C = (M, x) => Math.max(0, Math.min(x, M)), b = {
|
|
3464
|
+
...y,
|
|
3465
|
+
startRow: C(y.startRow, i),
|
|
3466
|
+
endRow: C(y.endRow, i),
|
|
3467
|
+
startCol: C(y.startCol, o),
|
|
3468
|
+
endCol: C(y.endCol, o)
|
|
3369
3469
|
};
|
|
3370
|
-
return (
|
|
3470
|
+
return (b.startRow !== y.startRow || b.endRow !== y.endRow || b.startCol !== y.startCol || b.endCol !== y.endCol) && (u = !0), b;
|
|
3371
3471
|
});
|
|
3372
|
-
this.selectionRanges =
|
|
3472
|
+
this.selectionRanges = w;
|
|
3373
3473
|
}
|
|
3374
|
-
|
|
3474
|
+
u && this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
|
|
3375
3475
|
return;
|
|
3376
3476
|
}
|
|
3377
3477
|
const r = s ?? t.columns[0]?.key ?? "";
|
|
3378
|
-
let h = t.columns.findIndex((
|
|
3478
|
+
let h = t.columns.findIndex((u) => String(u.key) === String(r));
|
|
3379
3479
|
h < 0 && (h = 0);
|
|
3380
|
-
const d = t.columns[h]?.key ?? "",
|
|
3480
|
+
const d = t.columns[h]?.key ?? "", f = n ? this.dataModel.getBaseRowIndex(n) : 0, p = e[e.length - 1] ?? e[0] ?? null, m = e.find((u) => this.dataModel.getBaseRowIndex(u.id) >= f) ?? p;
|
|
3381
3481
|
if (!m) return;
|
|
3382
|
-
const
|
|
3482
|
+
const g = m.id, S = this.dataModel.getRowIndex(g);
|
|
3383
3483
|
this.selectionAnchor = null, this.lastBooleanCell = null, this.teardownInput(!1), this.selectionRanges = [
|
|
3384
3484
|
{
|
|
3385
3485
|
kind: "cells",
|
|
3386
|
-
startRow:
|
|
3387
|
-
endRow:
|
|
3486
|
+
startRow: S,
|
|
3487
|
+
endRow: S,
|
|
3388
3488
|
startCol: h,
|
|
3389
3489
|
endCol: h
|
|
3390
3490
|
}
|
|
3391
|
-
], this.activeCell = { rowId:
|
|
3392
|
-
const
|
|
3393
|
-
this.focusSelectionInput(this.cellToClipboardString(
|
|
3491
|
+
], this.activeCell = { rowId: g, colKey: d }, this.onActiveChange(g, d), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(g, d);
|
|
3492
|
+
const v = this.dataModel.getCell(g, d);
|
|
3493
|
+
this.focusSelectionInput(this.cellToClipboardString(v)), this.updateFillHandleFlag();
|
|
3394
3494
|
}
|
|
3395
3495
|
navigateToCell(t, e) {
|
|
3396
3496
|
const i = this.dataModel.getSchema(), o = this.dataModel.getRowIndex(t), n = i.columns.findIndex((a) => String(a.key) === String(e));
|
|
@@ -3411,7 +3511,7 @@ class No {
|
|
|
3411
3511
|
this.teardownInput(!0);
|
|
3412
3512
|
}
|
|
3413
3513
|
destroy() {
|
|
3414
|
-
this.root.removeEventListener("click", this.handleClick), this.root.removeEventListener("pointerdown", this.handlePointerDown), this.root.removeEventListener("pointermove", this.handlePointerMove), this.root.removeEventListener("pointerup", this.handlePointerUp), this.root.removeEventListener("pointercancel", this.handlePointerUp), this.root.removeEventListener("pointerleave", this.handlePointerLeave), this.root.removeEventListener("keydown", this.handleRootKeydown), this.handleDocumentContextMenu && document.removeEventListener("contextmenu", this.handleDocumentContextMenu, !0), this.teardownInput(!0), this.teardownSelectionInput(), this.teardownCopyToast(), O(this.lookupDropdownEl), this.lookupDropdownEl = null, this.hideHoverTooltip(), this.teardownHoverTooltip(), this.stopAutoScroll();
|
|
3514
|
+
this.root.removeEventListener("click", this.handleClick), this.root.removeEventListener("pointerdown", this.handlePointerDown), this.root.removeEventListener("pointermove", this.handlePointerMove), this.root.removeEventListener("pointerup", this.handlePointerUp), this.root.removeEventListener("pointercancel", this.handlePointerUp), this.root.removeEventListener("pointerleave", this.handlePointerLeave), this.root.removeEventListener("keydown", this.handleRootKeydown), this.handleDocumentContextMenu && document.removeEventListener("contextmenu", this.handleDocumentContextMenu, !0), this.teardownInput(!0), this.teardownSelectionInput(), this.teardownCopyToast(), O(this.lookupDropdownEl), this.lookupDropdownEl = null, this.hideHoverTooltip(), this.teardownHoverTooltip(), this.stopAutoScroll(), this.endColumnResize();
|
|
3415
3515
|
}
|
|
3416
3516
|
onScroll(t, e) {
|
|
3417
3517
|
this.positionCopyToast(), this.refreshHoverTooltipPosition(), this.refreshLookupDropdownPosition();
|
|
@@ -3421,7 +3521,7 @@ class No {
|
|
|
3421
3521
|
}
|
|
3422
3522
|
updateFillHandleFlag() {
|
|
3423
3523
|
const t = this.activeCell?.colKey ?? null, e = this.activeCell?.rowId ?? null;
|
|
3424
|
-
this.root.dataset.extableFillHandle =
|
|
3524
|
+
this.root.dataset.extableFillHandle = Ht(
|
|
3425
3525
|
this.dataModel,
|
|
3426
3526
|
this.selectionRanges,
|
|
3427
3527
|
e,
|
|
@@ -3479,8 +3579,8 @@ class No {
|
|
|
3479
3579
|
if (!this.copyToastEl) return;
|
|
3480
3580
|
const t = this.copyToastEl.offsetWidth || 0, e = this.copyToastEl.offsetHeight || 0, i = 16, o = Math.max(0, this.root.scrollLeft + this.root.clientWidth - t - i), n = Math.max(0, this.root.scrollTop + this.root.clientHeight - e - i), s = Math.max(0, this.root.scrollLeft + i), l = Math.max(0, this.root.scrollTop + i), a = this.root.getBoundingClientRect(), r = this.getActiveCellRect();
|
|
3481
3581
|
if (r) {
|
|
3482
|
-
const h = r.right - a.left + this.root.scrollLeft - t + 8, d = r.top - a.top + this.root.scrollTop - e + 8,
|
|
3483
|
-
this.copyToastEl.style.left = `${
|
|
3582
|
+
const h = r.right - a.left + this.root.scrollLeft - t + 8, d = r.top - a.top + this.root.scrollTop - e + 8, f = Math.min(o, Math.max(s, h)), p = Math.min(n, Math.max(l, d));
|
|
3583
|
+
this.copyToastEl.style.left = `${f}px`, this.copyToastEl.style.top = `${p}px`;
|
|
3484
3584
|
return;
|
|
3485
3585
|
}
|
|
3486
3586
|
this.copyToastEl.style.left = `${o}px`, this.copyToastEl.style.top = `${n}px`;
|
|
@@ -3555,7 +3655,7 @@ class No {
|
|
|
3555
3655
|
this.hoverTooltipAbort = r;
|
|
3556
3656
|
const h = this.hoverTooltipRequestId += 1;
|
|
3557
3657
|
this.hoverTooltipTarget = { rowId: o, colKey: i }, this.hoverTooltipMessage = null;
|
|
3558
|
-
const d = this.dataModel.getCell(o, i),
|
|
3658
|
+
const d = this.dataModel.getCell(o, i), f = (p) => {
|
|
3559
3659
|
if (h !== this.hoverTooltipRequestId || r.signal.aborted) return;
|
|
3560
3660
|
if (!p) {
|
|
3561
3661
|
this.hideHoverTooltip();
|
|
@@ -3566,13 +3666,46 @@ class No {
|
|
|
3566
3666
|
};
|
|
3567
3667
|
try {
|
|
3568
3668
|
const p = l({ rowId: o, colKey: i, value: d, signal: r.signal });
|
|
3569
|
-
p && typeof p.then == "function" ? p.then(
|
|
3669
|
+
p && typeof p.then == "function" ? p.then(f).catch((m) => {
|
|
3570
3670
|
h === this.hoverTooltipRequestId && (r.signal.aborted || (this.hideHoverTooltip(), this.showCopyToast("Tooltip failed", "error", 1800)));
|
|
3571
|
-
}) :
|
|
3671
|
+
}) : f(p);
|
|
3572
3672
|
} catch {
|
|
3573
3673
|
this.hideHoverTooltip(), this.showCopyToast("Tooltip failed", "error", 1800);
|
|
3574
3674
|
}
|
|
3575
3675
|
}
|
|
3676
|
+
getColumnResizeHit(t, e, i) {
|
|
3677
|
+
const o = this.getHitAtClientPoint(t, e, i);
|
|
3678
|
+
if (!o || o.rowId !== "__header__" || !o.colKey || o.colKey === "__all__" || Math.abs(t - o.rect.right) > Wt) return null;
|
|
3679
|
+
if (!o.element) {
|
|
3680
|
+
const r = o.rect.right - 18 - 4, h = o.rect.top + Math.floor((at - 18) / 2);
|
|
3681
|
+
if (t >= r && t <= r + 18 && e >= h && e <= h + 18) return null;
|
|
3682
|
+
}
|
|
3683
|
+
const s = this.dataModel.getSchema().columns.findIndex((l) => String(l.key) === String(o.colKey));
|
|
3684
|
+
return s < 0 ? null : { colKey: String(o.colKey), colIndex: s };
|
|
3685
|
+
}
|
|
3686
|
+
beginColumnResize(t, e, i) {
|
|
3687
|
+
const o = this.dataModel.getSchema(), n = this.dataModel.getView(), s = o.columns[e];
|
|
3688
|
+
if (!s) return;
|
|
3689
|
+
const l = String(t), a = n.columnWidths?.[l] ?? s.width ?? 100, h = J(o, n)[e] ?? a, d = Math.max(0, h - a), f = Ye(0, d);
|
|
3690
|
+
this.columnResizing = !0, this.columnResizeState = {
|
|
3691
|
+
colKey: l,
|
|
3692
|
+
startX: i,
|
|
3693
|
+
startWidth: a,
|
|
3694
|
+
minWidth: f,
|
|
3695
|
+
lastWidth: a
|
|
3696
|
+
}, this.resizeCursorBackup === null && (this.resizeCursorBackup = this.root.style.cursor || ""), this.root.style.cursor = "col-resize", this.root.dataset.extableColumnResize = "1";
|
|
3697
|
+
}
|
|
3698
|
+
updateColumnResize(t) {
|
|
3699
|
+
if (!this.columnResizeState) return;
|
|
3700
|
+
const e = t - this.columnResizeState.startX, i = this.columnResizeState.startWidth + e, o = Math.round(Math.max(this.columnResizeState.minWidth, i));
|
|
3701
|
+
if (o === this.columnResizeState.lastWidth) return;
|
|
3702
|
+
this.columnResizeState.lastWidth = o;
|
|
3703
|
+
const n = this.dataModel.getView(), s = { ...n.columnWidths ?? {} };
|
|
3704
|
+
s[this.columnResizeState.colKey] = o, this.onViewChange({ ...n, columnWidths: s });
|
|
3705
|
+
}
|
|
3706
|
+
endColumnResize() {
|
|
3707
|
+
this.columnResizing && (this.columnResizing = !1, this.columnResizeState = null, this.resizeCursorBackup !== null && (this.root.style.cursor = this.resizeCursorBackup, this.resizeCursorBackup = null), this.root.dataset.extableColumnResize = "");
|
|
3708
|
+
}
|
|
3576
3709
|
ensureLookupDropdown() {
|
|
3577
3710
|
if (this.lookupDropdownEl)
|
|
3578
3711
|
return this.lookupDropdownEl;
|
|
@@ -3640,7 +3773,7 @@ class No {
|
|
|
3640
3773
|
const r = this.getCellRect(t, e);
|
|
3641
3774
|
if (r) {
|
|
3642
3775
|
const h = this.root.getBoundingClientRect();
|
|
3643
|
-
i.style.transform = "none", i.style.left = `${r.left - h.left}px`, i.style.top = `${r.top - h.top}px`, i.style.width = `${r.width}px`, i.style.height = `${r.height}px`, i.style.opacity = "1", i.style.pointerEvents = "auto", i.style.padding = "2px 4px", i.style.border = "none", i.style.background = "#fff", i.style.color = "#000", i.style.fontSize = "14px", i.style.fontFamily = "inherit", i.style.boxSizing = "border-box", i.style.zIndex = "100", i.style.WebkitAppearance = "none", i.style.WebkitUserSelect = "text", i.style.WebkitUserModify = "read-write";
|
|
3776
|
+
i.style.transform = "none", i.style.left = `${r.left - h.left}px`, i.style.top = `${r.top - h.top}px`, i.style.width = `${r.width}px`, i.style.height = `${r.height}px`, i.style.opacity = "1", i.style.pointerEvents = "auto", i.style.padding = "2px 4px", i.style.border = "none", i.style.background = "#fff", i.style.color = "#000", i.style.fontSize = "14px", i.style.fontFamily = "inherit", i.style.boxSizing = "border-box", i.style.zIndex = "100", i.classList.add("extable-editor-input"), i.style.WebkitAppearance = "none", i.style.WebkitUserSelect = "text", i.style.WebkitUserModify = "read-write";
|
|
3644
3777
|
}
|
|
3645
3778
|
}
|
|
3646
3779
|
if (n.recentLookup !== !1) {
|
|
@@ -3657,31 +3790,31 @@ class No {
|
|
|
3657
3790
|
const l = n.debounceMs ?? 250, a = (r) => {
|
|
3658
3791
|
const h = typeof r == "boolean" ? r : !1, d = i.value;
|
|
3659
3792
|
this.lookupDebounceTimer && (window.clearTimeout(this.lookupDebounceTimer), this.lookupDebounceTimer = null), this.lookupAbort?.abort(), this.lookupAbort = null, this.lookupRequestId += 1;
|
|
3660
|
-
const
|
|
3793
|
+
const f = this.lookupRequestId, p = s, m = () => {
|
|
3661
3794
|
this.lookupDebounceTimer = null;
|
|
3662
|
-
const
|
|
3663
|
-
this.lookupAbort =
|
|
3664
|
-
if (
|
|
3795
|
+
const g = new AbortController();
|
|
3796
|
+
this.lookupAbort = g, n.candidates({ query: d, rowId: t, colKey: e, signal: g.signal }).then((S) => {
|
|
3797
|
+
if (f !== this.lookupRequestId || g.signal.aborted || !this.activeCell || this.activeCell.rowId !== t || this.activeCell.colKey !== e)
|
|
3665
3798
|
return;
|
|
3666
|
-
let
|
|
3799
|
+
let v = Array.from(S);
|
|
3667
3800
|
if (n.recentLookup !== !1) {
|
|
3668
|
-
const
|
|
3669
|
-
if (
|
|
3670
|
-
|
|
3671
|
-
const
|
|
3672
|
-
|
|
3801
|
+
const w = this.lookupRecentHistory.get(e);
|
|
3802
|
+
if (w) {
|
|
3803
|
+
v = v.filter((C) => !(C.label === w.label && C.value === w.value));
|
|
3804
|
+
const y = { ...w, isRecent: !0 };
|
|
3805
|
+
v.unshift(y);
|
|
3673
3806
|
}
|
|
3674
3807
|
}
|
|
3675
|
-
s =
|
|
3676
|
-
const
|
|
3677
|
-
if (!n.allowFreeInput && p > 1 &&
|
|
3678
|
-
const
|
|
3679
|
-
this.lookupCandidates =
|
|
3808
|
+
s = v.length;
|
|
3809
|
+
const u = v.filter((w) => !w.isRecent);
|
|
3810
|
+
if (!n.allowFreeInput && p > 1 && u.length === 1) {
|
|
3811
|
+
const w = v.indexOf(u[0]);
|
|
3812
|
+
this.lookupCandidates = v, this.lookupHighlightIndex = w, this.commitLookupCandidate(w);
|
|
3680
3813
|
return;
|
|
3681
3814
|
}
|
|
3682
|
-
this.lookupCandidates =
|
|
3683
|
-
}).catch((
|
|
3684
|
-
|
|
3815
|
+
this.lookupCandidates = v, this.lookupHighlightIndex = v.length ? 0 : -1, this.renderLookupDropdown();
|
|
3816
|
+
}).catch((S) => {
|
|
3817
|
+
f === this.lookupRequestId && (g.signal.aborted || (this.hideLookupDropdown(), this.showCopyToast("Lookup failed", "error", 1800)));
|
|
3685
3818
|
});
|
|
3686
3819
|
};
|
|
3687
3820
|
h ? m() : this.lookupDebounceTimer = window.setTimeout(m, l);
|
|
@@ -3723,7 +3856,7 @@ class No {
|
|
|
3723
3856
|
return t.key === "Escape" ? (t.preventDefault(), this.hideLookupDropdown(), !0) : !1;
|
|
3724
3857
|
}
|
|
3725
3858
|
tryStartExternalEditor(t, e) {
|
|
3726
|
-
const o = this.findColumn(e)?.edit?.externalEditor
|
|
3859
|
+
const o = this.findColumn(e)?.edit?.externalEditor;
|
|
3727
3860
|
if (!o) return !1;
|
|
3728
3861
|
if (this.editMode === "readonly" || this.isCellReadonly(t, e) || this.externalEditInFlight) return !0;
|
|
3729
3862
|
const n = this.externalEditRequestId += 1;
|
|
@@ -3836,59 +3969,59 @@ class No {
|
|
|
3836
3969
|
) ? this.getCanvasCellMetrics(t, e) : null;
|
|
3837
3970
|
}
|
|
3838
3971
|
getCanvasCellMetrics(t, e) {
|
|
3839
|
-
const i = this.dataModel.getSchema(), o = this.dataModel.getView(), n = this.dataModel.listRows(), s = n.findIndex((
|
|
3972
|
+
const i = this.dataModel.getSchema(), o = this.dataModel.getView(), n = this.dataModel.listRows(), s = n.findIndex((S) => S.id === t), l = i.columns.findIndex((S) => String(S.key) === String(e));
|
|
3840
3973
|
if (s < 0 || l < 0) return null;
|
|
3841
|
-
const a =
|
|
3842
|
-
let
|
|
3843
|
-
for (let
|
|
3974
|
+
const a = at, r = ct, h = wt, d = J(i, o);
|
|
3975
|
+
let f = r;
|
|
3976
|
+
for (let S = 0; S < l; S += 1) f += d[S] ?? 100;
|
|
3844
3977
|
let p = a;
|
|
3845
|
-
for (let
|
|
3846
|
-
const
|
|
3847
|
-
if (!
|
|
3848
|
-
const
|
|
3849
|
-
p +=
|
|
3978
|
+
for (let S = 0; S < s; S += 1) {
|
|
3979
|
+
const v = n[S];
|
|
3980
|
+
if (!v) return null;
|
|
3981
|
+
const u = this.dataModel.getRowHeight(v.id) ?? h;
|
|
3982
|
+
p += u;
|
|
3850
3983
|
}
|
|
3851
|
-
const m = this.dataModel.getRowHeight(t) ?? h,
|
|
3852
|
-
return { left:
|
|
3984
|
+
const m = this.dataModel.getRowHeight(t) ?? h, g = d[l] ?? 100;
|
|
3985
|
+
return { left: f, top: p, width: g, height: m, rowIndex: s, colIndex: l };
|
|
3853
3986
|
}
|
|
3854
3987
|
getActiveCellRect() {
|
|
3855
3988
|
const t = this.activeCell;
|
|
3856
3989
|
if (!t) return null;
|
|
3857
3990
|
const e = this.root.getBoundingClientRect(), i = this.dataModel.getSchema(), o = this.dataModel.getView();
|
|
3858
3991
|
if (t.rowId === "__all__" && t.colKey === "__all__")
|
|
3859
|
-
return new DOMRect(e.left, e.top,
|
|
3992
|
+
return new DOMRect(e.left, e.top, ct, at);
|
|
3860
3993
|
if (t.rowId === "__header__" && t.colKey !== null) {
|
|
3861
3994
|
const s = this.escapeCssAttrValue(String(t.colKey)), l = this.root.querySelector(`th[data-col-key="${s}"]`);
|
|
3862
3995
|
if (l) return l.getBoundingClientRect();
|
|
3863
3996
|
const a = i.columns.findIndex((r) => String(r.key) === String(t.colKey));
|
|
3864
3997
|
if (a >= 0) {
|
|
3865
|
-
const r =
|
|
3866
|
-
let h =
|
|
3867
|
-
for (let
|
|
3998
|
+
const r = J(i, o);
|
|
3999
|
+
let h = ct;
|
|
4000
|
+
for (let f = 0; f < a; f += 1) h += r[f] ?? 100;
|
|
3868
4001
|
const d = r[a] ?? 100;
|
|
3869
4002
|
return new DOMRect(
|
|
3870
4003
|
e.left + h - this.root.scrollLeft,
|
|
3871
4004
|
e.top,
|
|
3872
4005
|
d,
|
|
3873
|
-
|
|
4006
|
+
at
|
|
3874
4007
|
);
|
|
3875
4008
|
}
|
|
3876
4009
|
}
|
|
3877
4010
|
if (t.colKey === null) {
|
|
3878
4011
|
const s = this.dataModel.getRowIndex(t.rowId);
|
|
3879
4012
|
if (s >= 0) {
|
|
3880
|
-
let l =
|
|
4013
|
+
let l = at;
|
|
3881
4014
|
const a = this.dataModel.listRows();
|
|
3882
4015
|
for (let h = 0; h < s; h += 1) {
|
|
3883
4016
|
const d = a[h];
|
|
3884
4017
|
if (!d) break;
|
|
3885
|
-
l += this.dataModel.getRowHeight(d.id) ??
|
|
4018
|
+
l += this.dataModel.getRowHeight(d.id) ?? wt;
|
|
3886
4019
|
}
|
|
3887
|
-
const r = this.dataModel.getRowHeight(t.rowId) ??
|
|
4020
|
+
const r = this.dataModel.getRowHeight(t.rowId) ?? wt;
|
|
3888
4021
|
return new DOMRect(
|
|
3889
4022
|
e.left,
|
|
3890
4023
|
e.top + l - this.root.scrollTop,
|
|
3891
|
-
|
|
4024
|
+
ct,
|
|
3892
4025
|
r
|
|
3893
4026
|
);
|
|
3894
4027
|
}
|
|
@@ -3905,8 +4038,8 @@ class No {
|
|
|
3905
4038
|
}
|
|
3906
4039
|
const o = this.getCanvasCellMetrics(t, e);
|
|
3907
4040
|
if (!o) return;
|
|
3908
|
-
const n = o.left, s = o.left + o.width, l = o.top, a = o.top + o.height, r = this.root.scrollLeft, h = this.root.scrollLeft + this.root.clientWidth, d = this.root.scrollTop,
|
|
3909
|
-
n < r ? this.root.scrollLeft = Math.max(0, n) : s > h && (this.root.scrollLeft = Math.max(0, s - this.root.clientWidth)), l < d ? this.root.scrollTop = Math.max(0, l) : a >
|
|
4041
|
+
const n = o.left, s = o.left + o.width, l = o.top, a = o.top + o.height, r = this.root.scrollLeft, h = this.root.scrollLeft + this.root.clientWidth, d = this.root.scrollTop, f = this.root.scrollTop + this.root.clientHeight;
|
|
4042
|
+
n < r ? this.root.scrollLeft = Math.max(0, n) : s > h && (this.root.scrollLeft = Math.max(0, s - this.root.clientWidth)), l < d ? this.root.scrollTop = Math.max(0, l) : a > f && (this.root.scrollTop = Math.max(0, a - this.root.clientHeight));
|
|
3910
4043
|
}
|
|
3911
4044
|
moveActiveCell(t, e, i = !1) {
|
|
3912
4045
|
const o = this.dataModel.getSchema(), n = this.dataModel.listRows();
|
|
@@ -3919,9 +4052,9 @@ class No {
|
|
|
3919
4052
|
{
|
|
3920
4053
|
const d = n[r];
|
|
3921
4054
|
if (!d) return;
|
|
3922
|
-
const
|
|
3923
|
-
if (!
|
|
3924
|
-
const p = d.id, m =
|
|
4055
|
+
const f = o.columns[h];
|
|
4056
|
+
if (!f) return;
|
|
4057
|
+
const p = d.id, m = f.key, g = a ? {
|
|
3925
4058
|
kind: "cells",
|
|
3926
4059
|
startRow: a.rowIndex,
|
|
3927
4060
|
endRow: r,
|
|
@@ -3934,9 +4067,9 @@ class No {
|
|
|
3934
4067
|
startCol: h,
|
|
3935
4068
|
endCol: h
|
|
3936
4069
|
};
|
|
3937
|
-
this.selectionRanges = [
|
|
3938
|
-
const
|
|
3939
|
-
this.focusSelectionInput(
|
|
4070
|
+
this.selectionRanges = [g], this.activeCell = { rowId: p, colKey: m }, this.onActiveChange(p, m), this.onSelectionChange(this.selectionRanges), this.ensureVisibleCell(p, m);
|
|
4071
|
+
const S = this.dataModel.getCell(p, m), v = this.cellToClipboardString(S);
|
|
4072
|
+
this.focusSelectionInput(v), this.updateFillHandleFlag();
|
|
3940
4073
|
return;
|
|
3941
4074
|
}
|
|
3942
4075
|
}
|
|
@@ -4001,8 +4134,8 @@ class No {
|
|
|
4001
4134
|
endCol: h
|
|
4002
4135
|
};
|
|
4003
4136
|
this.selectionRanges = [d];
|
|
4004
|
-
const
|
|
4005
|
-
this.activeCell = { rowId:
|
|
4137
|
+
const f = n[s]?.id ?? i.rowId, p = this.dragStart.kind === "rows" ? o.columns[0]?.key ?? i.colKey : o.columns[l]?.key ?? i.colKey;
|
|
4138
|
+
this.activeCell = { rowId: f, colKey: p }, this.onActiveChange(f, p), this.onSelectionChange(this.selectionRanges), this.updateFillHandleFlag();
|
|
4006
4139
|
}
|
|
4007
4140
|
updateFillDragFromClientPoint(t, e) {
|
|
4008
4141
|
if (!this.fillDragging || !this.fillSource) return;
|
|
@@ -4058,21 +4191,21 @@ class No {
|
|
|
4058
4191
|
commitFill(t, e) {
|
|
4059
4192
|
const i = this.dataModel.getSchema(), o = this.dataModel.listRows(), n = i.columns[t.colIndex];
|
|
4060
4193
|
if (!n || e <= t.endRowIndex) return;
|
|
4061
|
-
const s =
|
|
4194
|
+
const s = Po(this.dataModel, t, this.sequenceLangs);
|
|
4062
4195
|
if (!s) return;
|
|
4063
4196
|
const l = this.editMode === "direct", a = `fill:${Date.now()}:${Math.random().toString(16).slice(2)}`;
|
|
4064
4197
|
for (let d = t.endRowIndex + 1; d <= e; d += 1) {
|
|
4065
|
-
const
|
|
4066
|
-
if (!
|
|
4067
|
-
if (this.isCellReadonly(
|
|
4068
|
-
const p = d - t.endRowIndex, m = s(p),
|
|
4198
|
+
const f = o[d];
|
|
4199
|
+
if (!f) break;
|
|
4200
|
+
if (this.isCellReadonly(f.id, n.key)) continue;
|
|
4201
|
+
const p = d - t.endRowIndex, m = s(p), g = {
|
|
4069
4202
|
kind: "edit",
|
|
4070
|
-
rowId:
|
|
4203
|
+
rowId: f.id,
|
|
4071
4204
|
colKey: n.key,
|
|
4072
4205
|
next: m,
|
|
4073
4206
|
payload: { batchId: a }
|
|
4074
4207
|
};
|
|
4075
|
-
this.onEdit(
|
|
4208
|
+
this.onEdit(g, l);
|
|
4076
4209
|
}
|
|
4077
4210
|
const r = o[e];
|
|
4078
4211
|
if (!r) return;
|
|
@@ -4169,9 +4302,9 @@ class No {
|
|
|
4169
4302
|
if (t instanceof Date) return t.toISOString();
|
|
4170
4303
|
if (typeof t == "boolean") return t ? "TRUE" : "FALSE";
|
|
4171
4304
|
if (typeof t == "number") return String(t);
|
|
4172
|
-
const e =
|
|
4305
|
+
const e = bt(t);
|
|
4173
4306
|
if (e?.href) return e.href;
|
|
4174
|
-
const i =
|
|
4307
|
+
const i = vt(t);
|
|
4175
4308
|
if (i?.label) return i.label;
|
|
4176
4309
|
if (typeof t == "object") {
|
|
4177
4310
|
const o = t, n = o.kind;
|
|
@@ -4191,14 +4324,14 @@ class No {
|
|
|
4191
4324
|
const o = [], n = [], s = "border-collapse:collapse;border-spacing:0;", l = "border:1px solid #d0d7de;padding:4px 6px;vertical-align:top;";
|
|
4192
4325
|
let a = 0;
|
|
4193
4326
|
for (let d = i.startRow; d <= i.endRow; d += 1) {
|
|
4194
|
-
const
|
|
4195
|
-
if (!
|
|
4327
|
+
const f = e[d];
|
|
4328
|
+
if (!f) continue;
|
|
4196
4329
|
const p = [], m = [];
|
|
4197
|
-
for (let
|
|
4198
|
-
const
|
|
4199
|
-
if (!
|
|
4200
|
-
const
|
|
4201
|
-
p.push(
|
|
4330
|
+
for (let g = i.startCol; g <= i.endCol; g += 1) {
|
|
4331
|
+
const S = t.columns[g];
|
|
4332
|
+
if (!S) continue;
|
|
4333
|
+
const v = this.dataModel.getCell(f.id, S.key), u = this.cellToClipboardString(v);
|
|
4334
|
+
p.push(u), m.push(`<td style="${l}">${this.escapeHtml(u)}</td>`), a += 1;
|
|
4202
4335
|
}
|
|
4203
4336
|
o.push(p.join(" ")), n.push(`<tr>${m.join("")}</tr>`);
|
|
4204
4337
|
}
|
|
@@ -4263,9 +4396,9 @@ class No {
|
|
|
4263
4396
|
if (!i) return t;
|
|
4264
4397
|
if (t === "") return "";
|
|
4265
4398
|
if (i.type === "number" || i.type === "int" || i.type === "uint") {
|
|
4266
|
-
const o =
|
|
4399
|
+
const o = ce(t);
|
|
4267
4400
|
if (!o.ok) return t;
|
|
4268
|
-
const n =
|
|
4401
|
+
const n = he(o.value, i.type);
|
|
4269
4402
|
return n.ok ? n.value : t;
|
|
4270
4403
|
}
|
|
4271
4404
|
if (i.type === "boolean") {
|
|
@@ -4281,13 +4414,13 @@ class No {
|
|
|
4281
4414
|
if (!r) break;
|
|
4282
4415
|
const h = t[a] ?? [];
|
|
4283
4416
|
for (let d = 0; d < h.length; d += 1) {
|
|
4284
|
-
const
|
|
4285
|
-
if (!
|
|
4286
|
-
if (this.isCellReadonly(r.id,
|
|
4287
|
-
const p = this.coerceCellValue(h[d] ?? "",
|
|
4417
|
+
const f = e.columns[n + d];
|
|
4418
|
+
if (!f) break;
|
|
4419
|
+
if (this.isCellReadonly(r.id, f.key)) continue;
|
|
4420
|
+
const p = this.coerceCellValue(h[d] ?? "", f.key), m = {
|
|
4288
4421
|
kind: "edit",
|
|
4289
4422
|
rowId: r.id,
|
|
4290
|
-
colKey:
|
|
4423
|
+
colKey: f.key,
|
|
4291
4424
|
next: p,
|
|
4292
4425
|
payload: { batchId: l }
|
|
4293
4426
|
};
|
|
@@ -4320,31 +4453,43 @@ class No {
|
|
|
4320
4453
|
const l = this.normalizeTemporalInitialValue(i.type, e);
|
|
4321
4454
|
return s.value = l, { control: s, value: l };
|
|
4322
4455
|
}
|
|
4323
|
-
if (i?.type === "enum" || i?.type === "tags") {
|
|
4324
|
-
const s = i.enum
|
|
4456
|
+
if (i?.type === "enum" || i?.type === "tags" || i?.type === "labeled") {
|
|
4457
|
+
const s = i.type === "enum" ? i.enumAllowCustom ?? !1 : i.type === "tags" ? i.tagsAllowCustom ?? !1 : i.enumAllowCustom ?? !1;
|
|
4458
|
+
let l = [];
|
|
4459
|
+
i.type === "enum" && Array.isArray(i.enum) && (l = i.enum), i.type === "tags" && Array.isArray(i.tags) && (l = i.tags), i.type === "labeled" && Array.isArray(i.enum) && (l = i.enum);
|
|
4460
|
+
const a = l.map((f) => {
|
|
4461
|
+
if (typeof f == "string") return f;
|
|
4462
|
+
if (f && typeof f == "object") {
|
|
4463
|
+
const p = f;
|
|
4464
|
+
if (i.type === "labeled") return String(p.label ?? p.value ?? "");
|
|
4465
|
+
if ("value" in p) return String(p.value ?? p.label ?? "");
|
|
4466
|
+
if ("label" in p) return String(p.label ?? "");
|
|
4467
|
+
}
|
|
4468
|
+
return String(f ?? "");
|
|
4469
|
+
});
|
|
4325
4470
|
if (s === !1) {
|
|
4326
|
-
const
|
|
4327
|
-
|
|
4328
|
-
for (const
|
|
4329
|
-
const
|
|
4330
|
-
|
|
4471
|
+
const f = document.createElement("select"), p = document.createElement("option");
|
|
4472
|
+
p.value = "", p.textContent = "", f.appendChild(p);
|
|
4473
|
+
for (const m of a) {
|
|
4474
|
+
const g = document.createElement("option");
|
|
4475
|
+
g.value = m, g.textContent = m, e === m && (g.selected = !0), f.appendChild(g);
|
|
4331
4476
|
}
|
|
4332
|
-
return { control:
|
|
4477
|
+
return { control: f, value: e };
|
|
4333
4478
|
}
|
|
4334
|
-
const
|
|
4335
|
-
|
|
4336
|
-
const
|
|
4337
|
-
|
|
4338
|
-
let
|
|
4339
|
-
if (!
|
|
4340
|
-
|
|
4341
|
-
for (const
|
|
4342
|
-
const
|
|
4343
|
-
|
|
4479
|
+
const r = document.createElement("input");
|
|
4480
|
+
r.type = "text";
|
|
4481
|
+
const h = `extable-datalist-${String(t)}`;
|
|
4482
|
+
r.setAttribute("list", h), r.value = e;
|
|
4483
|
+
let d = document.getElementById(h);
|
|
4484
|
+
if (!d) {
|
|
4485
|
+
d = document.createElement("datalist"), d.id = h;
|
|
4486
|
+
for (const f of a) {
|
|
4487
|
+
const p = document.createElement("option");
|
|
4488
|
+
p.value = f, d.appendChild(p);
|
|
4344
4489
|
}
|
|
4345
|
-
this.root.appendChild(
|
|
4490
|
+
this.root.appendChild(d);
|
|
4346
4491
|
}
|
|
4347
|
-
return { control:
|
|
4492
|
+
return { control: r, value: e, datalistId: h };
|
|
4348
4493
|
}
|
|
4349
4494
|
const n = document.createElement("input");
|
|
4350
4495
|
return n.type = "text", n.value = e, { control: n, value: e };
|
|
@@ -4361,10 +4506,10 @@ class No {
|
|
|
4361
4506
|
if ((i.type === "number" || i.type === "int" || i.type === "uint") && typeof e == "number") {
|
|
4362
4507
|
if (i.type === "number") {
|
|
4363
4508
|
const s = i.format;
|
|
4364
|
-
return (s?.format ?? "decimal") === "scientific" ?
|
|
4509
|
+
return (s?.format ?? "decimal") === "scientific" ? At(e, { format: "scientific", precision: s?.precision }) : At(e, { format: "decimal", scale: s?.scale });
|
|
4365
4510
|
}
|
|
4366
4511
|
const n = i.format?.format ?? "decimal";
|
|
4367
|
-
return n === "binary" || n === "octal" || n === "hex" ?
|
|
4512
|
+
return n === "binary" || n === "octal" || n === "hex" ? Ut(e, n) : String(e);
|
|
4368
4513
|
}
|
|
4369
4514
|
return String(e);
|
|
4370
4515
|
}
|
|
@@ -4373,11 +4518,11 @@ class No {
|
|
|
4373
4518
|
return { ok: !0, value: this.inputEl?.value ?? "" };
|
|
4374
4519
|
const t = this.findColumn(this.activeCell.colKey);
|
|
4375
4520
|
if (t && (t.type === "number" || t.type === "int" || t.type === "uint") && this.inputEl instanceof HTMLInputElement) {
|
|
4376
|
-
const e =
|
|
4521
|
+
const e = Ge(this.inputEl.value);
|
|
4377
4522
|
if (e === "") return { ok: !0, value: "" };
|
|
4378
|
-
const i =
|
|
4523
|
+
const i = ce(e);
|
|
4379
4524
|
if (!i.ok) return { ok: !1 };
|
|
4380
|
-
const o =
|
|
4525
|
+
const o = he(i.value, t.type);
|
|
4381
4526
|
return o.ok ? { ok: !0, value: o.value } : { ok: !1 };
|
|
4382
4527
|
}
|
|
4383
4528
|
return { ok: !0, value: this.readActiveValue() };
|
|
@@ -4395,7 +4540,7 @@ class No {
|
|
|
4395
4540
|
t.rows = Math.max(1, o), t.style.minHeight = `${i}px`;
|
|
4396
4541
|
}
|
|
4397
4542
|
positionFloatingContentBox(t, e) {
|
|
4398
|
-
const i =
|
|
4543
|
+
const i = yt, o = dt, n = Et;
|
|
4399
4544
|
e.style.left = `${t.left + i}px`, e.style.top = `${t.top + o}px`, e.style.width = `${Math.max(8, t.width - i * 2)}px`, e.style.height = `${Math.max(8, t.height - (o + n))}px`;
|
|
4400
4545
|
}
|
|
4401
4546
|
triggerCellAction(t, e, i) {
|
|
@@ -4404,11 +4549,11 @@ class No {
|
|
|
4404
4549
|
const s = this.dataModel.resolveCellValue(t, o), l = this.dataModel.resolveConditionalStyle(t, o);
|
|
4405
4550
|
if (s.textOverride ?? (l.forceErrorText ? "#ERROR" : void 0)) return !1;
|
|
4406
4551
|
if (o.type === "button") {
|
|
4407
|
-
const r =
|
|
4552
|
+
const r = vt(s.value);
|
|
4408
4553
|
return r ? (this.onCellAction({ kind: "button", rowId: t, colKey: e, value: r }), !0) : !1;
|
|
4409
4554
|
}
|
|
4410
4555
|
if (o.type === "link") {
|
|
4411
|
-
const r =
|
|
4556
|
+
const r = bt(s.value);
|
|
4412
4557
|
return r?.href ? (this.openLink(r.href, r.target), !0) : !1;
|
|
4413
4558
|
}
|
|
4414
4559
|
return !1;
|
|
@@ -4419,7 +4564,7 @@ class No {
|
|
|
4419
4564
|
if (!o || o.type !== "tags") return !1;
|
|
4420
4565
|
const n = this.dataModel.getCell(t, e), s = this.normalizeTagValues(n);
|
|
4421
4566
|
if (!s || i < 0 || i >= s.length) return !1;
|
|
4422
|
-
const l = s.filter((d,
|
|
4567
|
+
const l = s.filter((d, f) => f !== i), a = n && typeof n == "object" && n.kind === "tags" ? { kind: "tags", values: l } : l, r = {
|
|
4423
4568
|
kind: "edit",
|
|
4424
4569
|
rowId: t,
|
|
4425
4570
|
colKey: e,
|
|
@@ -4454,12 +4599,12 @@ class No {
|
|
|
4454
4599
|
const r = `unique-bool:${Date.now()}:${Math.random().toString(16).slice(2)}`, h = [
|
|
4455
4600
|
{ kind: "edit", rowId: t, colKey: e, next: !0, payload: { batchId: r } }
|
|
4456
4601
|
], d = this.dataModel.listRows();
|
|
4457
|
-
for (const
|
|
4458
|
-
if (!
|
|
4459
|
-
const p = this.dataModel.getCell(
|
|
4460
|
-
(p === !0 || p === "true" || p === "1" || p === 1) && h.push({ kind: "edit", rowId:
|
|
4602
|
+
for (const f of d) {
|
|
4603
|
+
if (!f || f.id === t) continue;
|
|
4604
|
+
const p = this.dataModel.getCell(f.id, e);
|
|
4605
|
+
(p === !0 || p === "true" || p === "1" || p === 1) && h.push({ kind: "edit", rowId: f.id, colKey: e, next: !1, payload: { batchId: r } });
|
|
4461
4606
|
}
|
|
4462
|
-
for (const
|
|
4607
|
+
for (const f of h) this.onEdit(f, s);
|
|
4463
4608
|
this.onMove(t);
|
|
4464
4609
|
return;
|
|
4465
4610
|
}
|
|
@@ -4484,7 +4629,7 @@ class No {
|
|
|
4484
4629
|
};
|
|
4485
4630
|
let a = [];
|
|
4486
4631
|
if (t.shiftKey && this.activeCell) {
|
|
4487
|
-
const h = this.activeCell, d = this.dataModel.getRowIndex(h.rowId),
|
|
4632
|
+
const h = this.activeCell, d = this.dataModel.getRowIndex(h.rowId), f = i.columns.findIndex((m) => String(m.key) === String(h.colKey));
|
|
4488
4633
|
a = [n ? {
|
|
4489
4634
|
kind: "rows",
|
|
4490
4635
|
startRow: d,
|
|
@@ -4495,7 +4640,7 @@ class No {
|
|
|
4495
4640
|
kind: "cells",
|
|
4496
4641
|
startRow: d,
|
|
4497
4642
|
endRow: o,
|
|
4498
|
-
startCol: Math.max(0,
|
|
4643
|
+
startCol: Math.max(0, f),
|
|
4499
4644
|
endCol: Math.max(0, s)
|
|
4500
4645
|
}];
|
|
4501
4646
|
} else t.metaKey || t.ctrlKey ? a = [...this.selectionRanges, l] : a = [l];
|
|
@@ -4542,15 +4687,15 @@ class No {
|
|
|
4542
4687
|
const s = o?.initialValueOverride ?? this.getInitialEditValue(i, n), { control: l, value: a } = this.createEditor(i, s), r = l;
|
|
4543
4688
|
r.value = a;
|
|
4544
4689
|
const h = r instanceof HTMLInputElement && r.type === "checkbox";
|
|
4545
|
-
r.style.width = "100%", r.style.boxSizing = "border-box", r.style.margin = "0", r.style.padding = h ? "0" : "2px 4px", r.style.border = "none", r.style.borderRadius = "0", r.style.boxShadow = "none", r.style.background = "#fff", r.style.color = "#000", r.style.outline = "none", r.style.fontSize = "14px", r.style.fontFamily = "inherit", r.style.lineHeight = "16px", r.style.fontWeight = "inherit", r.style.WebkitAppearance = "none", r.style.WebkitBorderRadius = "0", r.style.WebkitBoxShadow = "none", r.style.WebkitUserSelect = "text", r.style.WebkitUserModify = "read-write", (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement) && (r.style.visibility = "visible", r.style.opacity = "1", r.style.display = "block"), h && (r.style.width = "auto", r.style.lineHeight = "normal");
|
|
4690
|
+
r.style.width = "100%", r.style.boxSizing = "border-box", r.style.margin = "0", r.style.padding = h ? "0" : "2px 4px", r.style.border = "none", r.style.borderRadius = "0", r.style.boxShadow = "none", r.style.background = "#fff", r.style.color = "#000", r.style.outline = "none", r.style.fontSize = "14px", r.style.fontFamily = "inherit", r.style.lineHeight = "16px", r.style.fontWeight = "inherit", r.classList.add("extable-editor-input"), r.style.WebkitAppearance = "none", r.style.WebkitBorderRadius = "0", r.style.WebkitBoxShadow = "none", r.style.WebkitUserSelect = "text", r.style.WebkitUserModify = "read-write", (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement) && (r.style.visibility = "visible", r.style.opacity = "1", r.style.display = "block"), h && (r.style.width = "auto", r.style.lineHeight = "normal");
|
|
4546
4691
|
const d = this.findColumn(i);
|
|
4547
|
-
if (r.style.textAlign = d?.style?.align ?? (d?.type === "number" || d?.type === "int" || d?.type === "uint" ? "right" : "left"), r.addEventListener("keydown", (
|
|
4692
|
+
if (r.style.textAlign = d?.style?.align ?? (d?.type === "number" || d?.type === "int" || d?.type === "uint" ? "right" : "left"), r.addEventListener("keydown", (f) => this.handleKey(f, t)), r.addEventListener("focus", () => {
|
|
4548
4693
|
(r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement) && r.select();
|
|
4549
4694
|
}), this.bindImmediateCommit(r), t.textContent = "", t.appendChild(r), r.tagName.toLowerCase() === "textarea" && requestAnimationFrame(() => {
|
|
4550
4695
|
r instanceof HTMLTextAreaElement && this.autosize(r);
|
|
4551
4696
|
}), r.focus({ preventScroll: !0 }), o?.placeCursorAtEnd && (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement)) {
|
|
4552
|
-
const
|
|
4553
|
-
r.setSelectionRange(
|
|
4697
|
+
const f = r.value.length;
|
|
4698
|
+
r.setSelectionRange(f, f);
|
|
4554
4699
|
}
|
|
4555
4700
|
this.inputEl = r, this.setupLookupEditor(e, i, r);
|
|
4556
4701
|
}
|
|
@@ -4564,8 +4709,8 @@ class No {
|
|
|
4564
4709
|
this.activeOriginalValue = { rowId: e, colKey: i, value: l };
|
|
4565
4710
|
const a = o?.initialValueOverride ?? this.getInitialEditValue(i, l), { control: r, value: h } = this.createEditor(i, a), d = r;
|
|
4566
4711
|
d.value = h;
|
|
4567
|
-
const
|
|
4568
|
-
d.style.width = "100%", d.style.height = "100%", d.style.boxSizing = "border-box", d.style.margin = "0", d.style.padding =
|
|
4712
|
+
const f = d instanceof HTMLInputElement && d.type === "checkbox";
|
|
4713
|
+
d.style.width = "100%", d.style.height = "100%", d.style.boxSizing = "border-box", d.style.margin = "0", d.style.padding = f ? "0" : "2px 4px", d.style.border = "none", d.style.borderRadius = "0", d.style.boxShadow = "none", d.style.background = "#fff", d.style.color = "#000", d.style.outline = "none", d.style.fontSize = "14px", d.style.fontFamily = "inherit", d.style.lineHeight = "16px", d.style.fontWeight = "inherit", d.classList.add("extable-editor-input"), d.style.WebkitAppearance = "none", d.style.WebkitBorderRadius = "0", d.style.WebkitBoxShadow = "none", d.style.WebkitUserSelect = "text", d.style.WebkitUserModify = "read-write", (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement) && (d.style.visibility = "visible", d.style.opacity = "1", d.style.display = "block"), f && (d.style.width = "auto", d.style.height = "auto", d.style.lineHeight = "normal");
|
|
4569
4714
|
const p = this.findColumn(i);
|
|
4570
4715
|
if (d.style.textAlign = p?.style?.align ?? (p?.type === "number" || p?.type === "int" || p?.type === "uint" ? "right" : "left"), d.style.pointerEvents = "auto", d.addEventListener("keydown", (m) => this.handleKey(m, s)), d.addEventListener("compositionstart", this.handleInputCompositionStart), d.addEventListener("compositionend", this.handleInputCompositionEnd), d.addEventListener("focus", () => {
|
|
4571
4716
|
(d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement) && d.select();
|
|
@@ -4658,19 +4803,19 @@ class No {
|
|
|
4658
4803
|
this.teardownInput(!1), t.blur();
|
|
4659
4804
|
}
|
|
4660
4805
|
teardownInput(t = !1) {
|
|
4661
|
-
this.teardownLookupEditor(), this.inputEl && this.inputEl !== this.selectionInput && O(this.inputEl), O(this.floatingInputWrapper), this.activeHost && this.activeHostOriginalText !== null && (this.activeHost.textContent = this.activeHostOriginalText), this.inputEl = null, this.floatingInputWrapper = null, this.activeHost = null, this.activeHostOriginalText = null, this.activeOriginalValue = null, this.composing = !1, t && (this.activeCell = null, this.onActiveChange(null, null), this.hideHoverTooltip());
|
|
4806
|
+
this.teardownLookupEditor(), this.inputEl === this.selectionInput && this.selectionInput && this.selectionInput.classList.remove("extable-editor-input"), this.inputEl && this.inputEl !== this.selectionInput && O(this.inputEl), O(this.floatingInputWrapper), this.activeHost && this.activeHostOriginalText !== null && (this.activeHost.textContent = this.activeHostOriginalText), this.inputEl = null, this.floatingInputWrapper = null, this.activeHost = null, this.activeHostOriginalText = null, this.activeOriginalValue = null, this.composing = !1, t && (this.activeCell = null, this.onActiveChange(null, null), this.hideHoverTooltip());
|
|
4662
4807
|
}
|
|
4663
4808
|
}
|
|
4664
|
-
const
|
|
4665
|
-
class
|
|
4809
|
+
const Qo = (c) => c;
|
|
4810
|
+
class Uo {
|
|
4666
4811
|
constructor(t) {
|
|
4667
4812
|
this.shell = null, this.viewportEl = null, this.viewportResizeObserver = null, this.selectionManager = null, this.resizeHandler = null, this.scrollHandler = null, this.viewportState = null, this.rafId = null, this.contextMenu = null, this.contextMenuRowId = null, this.handleGlobalPointer = null, this.toast = null, this.toastTimer = null, this.mounted = !1, this.filterSortSidebar = null, this.filterSortSidebarUnsub = null, this.filterSortKeydown = null, this.filterSortClickCapture = null, this.filterSortOpenEvent = null, this.filterSortActiveColumnKey = null, this.filterSortDraft = null, this.tableStateListeners = /* @__PURE__ */ new Set(), this.selectionListeners = /* @__PURE__ */ new Set(), this.lastTableState = null, this.lastSelectionSnapshot = null, this.lastAction = null, this.selectionRanges = [], this.activeCell = null, this.activeErrors = [], this.rowStateListeners = /* @__PURE__ */ new Set(), this.lastRowStates = /* @__PURE__ */ new Map(), this.root = t.root, this.root.classList.add("extable-root"), this.renderMode = t.options?.renderMode ?? "auto", this.editMode = t.options?.editMode ?? "direct", this.lockMode = t.options?.lockMode ?? "none", this.server = t.options?.server, this.user = t.options?.user, this.sequenceLangs = t.options?.langs;
|
|
4668
4813
|
const e = t.defaultData ?? null, i = e ?? [];
|
|
4669
|
-
this.dataLoaded = e != null, this.dataModel = new
|
|
4814
|
+
this.dataLoaded = e != null, this.dataModel = new Qe(
|
|
4670
4815
|
i,
|
|
4671
4816
|
t.schema,
|
|
4672
|
-
t.defaultView
|
|
4673
|
-
), this.commandQueue = new
|
|
4817
|
+
t.defaultView ?? {}
|
|
4818
|
+
), this.commandQueue = new ti(), this.lockManager = new ii(this.lockMode, this.server, this.user), this.renderer = this.chooseRenderer(this.renderMode), this.applyRootDecor(t.options), this.applyReadonlyClass(), this.loadInitial();
|
|
4674
4819
|
}
|
|
4675
4820
|
isCellReadonly(t, e) {
|
|
4676
4821
|
return this.editMode === "readonly" || this.dataModel.isReadonly(t, e);
|
|
@@ -4703,7 +4848,7 @@ class Po {
|
|
|
4703
4848
|
this.mount();
|
|
4704
4849
|
}
|
|
4705
4850
|
applyRootDecor(t) {
|
|
4706
|
-
const e =
|
|
4851
|
+
const e = de(t?.defaultClass);
|
|
4707
4852
|
if (e?.length && this.root.classList.add(...e), t?.defaultStyle)
|
|
4708
4853
|
for (const [i, o] of Object.entries(t.defaultStyle))
|
|
4709
4854
|
this.root.style[i] = o ?? "";
|
|
@@ -4716,9 +4861,9 @@ class Po {
|
|
|
4716
4861
|
const e = typeof navigator < "u" ? navigator.userAgent : "";
|
|
4717
4862
|
return /bot|crawl|spider|playwright|puppeteer|selenium|phantomjs/i.test(e) || typeof navigator < "u" && "userAgentData" in navigator && navigator.userAgentData?.brands?.some(
|
|
4718
4863
|
(o) => /bot/i.test(o.brand ?? "")
|
|
4719
|
-
) ? new
|
|
4864
|
+
) ? new Tt(this.dataModel) : new Lt(this.dataModel, () => this.editMode);
|
|
4720
4865
|
}
|
|
4721
|
-
return t === "html" ? new
|
|
4866
|
+
return t === "html" ? new Tt(this.dataModel) : new Lt(this.dataModel, () => this.editMode);
|
|
4722
4867
|
}
|
|
4723
4868
|
ensureShell() {
|
|
4724
4869
|
if (this.shell && this.viewportEl && this.shell.parentElement === this.root) return;
|
|
@@ -4741,7 +4886,7 @@ class Po {
|
|
|
4741
4886
|
this.root.dataset.extable = "loading", this.bindViewport(), this.ensureFilterSort(), this.emitTableState(), this.emitSelection("data");
|
|
4742
4887
|
return;
|
|
4743
4888
|
}
|
|
4744
|
-
this.selectionManager = new
|
|
4889
|
+
this.selectionManager = new zo(
|
|
4745
4890
|
e,
|
|
4746
4891
|
this.editMode,
|
|
4747
4892
|
(i, o) => this.handleEdit(i, o),
|
|
@@ -4757,6 +4902,7 @@ class Po {
|
|
|
4757
4902
|
this.sequenceLangs,
|
|
4758
4903
|
(i, o) => this.isCellReadonly(i, o),
|
|
4759
4904
|
(i) => this.emitAction(i),
|
|
4905
|
+
(i) => this.setView(i),
|
|
4760
4906
|
(i, o) => {
|
|
4761
4907
|
const n = i && o !== null ? { rowId: i, colKey: o } : null;
|
|
4762
4908
|
n && this.renderer.setActiveCell(n.rowId, n.colKey), this.activeCell = n, this.emitSelection("selection");
|
|
@@ -4774,7 +4920,7 @@ class Po {
|
|
|
4774
4920
|
}
|
|
4775
4921
|
// editMode/lockMode are configured only at construction time for consistency.
|
|
4776
4922
|
setRootClass(t) {
|
|
4777
|
-
this.root.className = "", this.root.classList.add(...
|
|
4923
|
+
this.root.className = "", this.root.classList.add(...de(t) ?? []);
|
|
4778
4924
|
}
|
|
4779
4925
|
setRootStyle(t) {
|
|
4780
4926
|
for (const [e, i] of Object.entries(t))
|
|
@@ -4889,9 +5035,9 @@ class Po {
|
|
|
4889
5035
|
if (s.textOverride) return s.textOverride;
|
|
4890
5036
|
const l = s.value;
|
|
4891
5037
|
if (n.type === "button")
|
|
4892
|
-
return
|
|
5038
|
+
return ut(l) || (l == null ? "" : String(l));
|
|
4893
5039
|
if (n.type === "link")
|
|
4894
|
-
return
|
|
5040
|
+
return ft(l) || (l == null ? "" : String(l));
|
|
4895
5041
|
if (l == null) return "";
|
|
4896
5042
|
if (l instanceof Date) return l.toISOString();
|
|
4897
5043
|
if (typeof l == "string") return l;
|
|
@@ -5202,7 +5348,7 @@ class Po {
|
|
|
5202
5348
|
}
|
|
5203
5349
|
// Public API: table-level state callbacks
|
|
5204
5350
|
getTableState() {
|
|
5205
|
-
const t = this.renderer instanceof
|
|
5351
|
+
const t = this.renderer instanceof Tt ? "html" : "canvas", e = this.commandQueue.listApplied(), i = this.editMode === "commit" ? e : [], o = i.length, n = (() => {
|
|
5206
5352
|
const r = /* @__PURE__ */ new Set();
|
|
5207
5353
|
for (const h of i)
|
|
5208
5354
|
h.kind === "edit" && (!h.rowId || h.colKey === void 0 || r.add(`${h.rowId}::${String(h.colKey)}`));
|
|
@@ -5217,8 +5363,8 @@ class Po {
|
|
|
5217
5363
|
target: { rowId: r.rowId, colKey: r.colKey }
|
|
5218
5364
|
} : null).filter(Boolean);
|
|
5219
5365
|
l.sort((r, h) => {
|
|
5220
|
-
const d = r.target?.rowId ? this.dataModel.getRowIndex(r.target.rowId) : -1,
|
|
5221
|
-
if (d !==
|
|
5366
|
+
const d = r.target?.rowId ? this.dataModel.getRowIndex(r.target.rowId) : -1, f = h.target?.rowId ? this.dataModel.getRowIndex(h.target.rowId) : -1;
|
|
5367
|
+
if (d !== f) return d - f;
|
|
5222
5368
|
const p = r.target?.colKey !== void 0 ? this.dataModel.getColumnIndex(r.target.colKey) : -1, m = h.target?.colKey !== void 0 ? this.dataModel.getColumnIndex(h.target.colKey) : -1;
|
|
5223
5369
|
return p !== m ? p - m : r.scope !== h.scope ? r.scope < h.scope ? -1 : 1 : r.message < h.message ? -1 : r.message > h.message ? 1 : 0;
|
|
5224
5370
|
});
|
|
@@ -5258,33 +5404,33 @@ class Po {
|
|
|
5258
5404
|
}
|
|
5259
5405
|
// Public API: selection callbacks
|
|
5260
5406
|
getSelectionSnapshot() {
|
|
5261
|
-
const t = this.selectionRanges, e = this.dataModel.getSchema(), i = this.activeCell, o = i?.rowId ?? null, n = i?.colKey ?? null, s = o ? this.dataModel.getRowIndex(o) : null, l = n !== null ? e.columns.findIndex((
|
|
5407
|
+
const t = this.selectionRanges, e = this.dataModel.getSchema(), i = this.activeCell, o = i?.rowId ?? null, n = i?.colKey ?? null, s = o ? this.dataModel.getRowIndex(o) : null, l = n !== null ? e.columns.findIndex((v) => String(v.key) === String(n)) : null, a = l !== null && l >= 0 ? e.columns[l] : null, r = o && a ? this.dataModel.resolveCellValue(o, a) : null, h = o && a ? this.dataModel.resolveConditionalStyle(o, a) : null, d = r?.textOverride ?? (h?.forceErrorText ? "#ERROR" : void 0), f = r ? r.value : null, p = (() => {
|
|
5262
5408
|
if (d) return d;
|
|
5263
|
-
const
|
|
5409
|
+
const v = f;
|
|
5264
5410
|
if (a?.type === "button")
|
|
5265
|
-
return
|
|
5411
|
+
return ut(v) || (v == null ? "" : String(v));
|
|
5266
5412
|
if (a?.type === "link")
|
|
5267
|
-
return
|
|
5268
|
-
if (
|
|
5269
|
-
if (
|
|
5270
|
-
if (typeof
|
|
5271
|
-
if (typeof
|
|
5272
|
-
if (typeof
|
|
5273
|
-
const
|
|
5274
|
-
if (
|
|
5275
|
-
if (
|
|
5276
|
-
return
|
|
5413
|
+
return ft(v) || (v == null ? "" : String(v));
|
|
5414
|
+
if (v == null) return "";
|
|
5415
|
+
if (v instanceof Date) return v.toISOString();
|
|
5416
|
+
if (typeof v == "string") return v;
|
|
5417
|
+
if (typeof v == "number" || typeof v == "boolean") return String(v);
|
|
5418
|
+
if (typeof v == "object") {
|
|
5419
|
+
const u = v, w = u.kind;
|
|
5420
|
+
if (w === "enum" && typeof u.value == "string") return u.value;
|
|
5421
|
+
if (w === "tags" && Array.isArray(u.values))
|
|
5422
|
+
return u.values.filter((y) => typeof y == "string").join(", ");
|
|
5277
5423
|
}
|
|
5278
|
-
return String(
|
|
5279
|
-
})(), m = a?.type ?? null,
|
|
5424
|
+
return String(v);
|
|
5425
|
+
})(), m = a?.type ?? null, g = o && n !== null ? this.dataModel.getCellDiagnostic(o, n) : null, S = (() => {
|
|
5280
5426
|
if (!o || !a)
|
|
5281
5427
|
return { columnStyle: {}, cellStyle: {}, resolved: {} };
|
|
5282
|
-
const { columnStyle:
|
|
5428
|
+
const { columnStyle: v, cellStyle: u, resolved: w } = Je(
|
|
5283
5429
|
this.dataModel,
|
|
5284
5430
|
o,
|
|
5285
5431
|
a
|
|
5286
5432
|
);
|
|
5287
|
-
return { columnStyle:
|
|
5433
|
+
return { columnStyle: v, cellStyle: u, resolved: w };
|
|
5288
5434
|
})();
|
|
5289
5435
|
return {
|
|
5290
5436
|
ranges: [...t],
|
|
@@ -5292,12 +5438,12 @@ class Po {
|
|
|
5292
5438
|
activeRowKey: o,
|
|
5293
5439
|
activeColumnIndex: l !== null && l >= 0 ? l : null,
|
|
5294
5440
|
activeColumnKey: n,
|
|
5295
|
-
activeValueRaw:
|
|
5441
|
+
activeValueRaw: f,
|
|
5296
5442
|
activeValueDisplay: p,
|
|
5297
5443
|
activeValueType: m,
|
|
5298
|
-
diagnostic:
|
|
5444
|
+
diagnostic: g,
|
|
5299
5445
|
action: this.lastAction,
|
|
5300
|
-
styles:
|
|
5446
|
+
styles: S
|
|
5301
5447
|
};
|
|
5302
5448
|
}
|
|
5303
5449
|
subscribeSelection(t) {
|
|
@@ -5349,7 +5495,7 @@ class Po {
|
|
|
5349
5495
|
}
|
|
5350
5496
|
// Public API: value updates
|
|
5351
5497
|
setCellValue(t, e, i) {
|
|
5352
|
-
const o = typeof t == "string" ? t : this.dataModel.listRows()[t]?.id, n = o ?
|
|
5498
|
+
const o = typeof t == "string" ? t : this.dataModel.listRows()[t]?.id, n = o ? ei(this.dataModel, { rowId: o, colKey: e }) : null;
|
|
5353
5499
|
if (!n || this.isCellReadonly(n.rowId, n.colKey)) return;
|
|
5354
5500
|
const s = this.dataModel.getCell(n.rowId, n.colKey), l = typeof i == "function" ? i(s) : i;
|
|
5355
5501
|
this.handleEdit(
|
|
@@ -5365,14 +5511,14 @@ class Po {
|
|
|
5365
5511
|
for (let h = s; h <= l; h += 1) {
|
|
5366
5512
|
const d = i[h];
|
|
5367
5513
|
if (d)
|
|
5368
|
-
for (let
|
|
5369
|
-
const p = e.columns[
|
|
5514
|
+
for (let f = a; f <= r; f += 1) {
|
|
5515
|
+
const p = e.columns[f];
|
|
5370
5516
|
if (!p) continue;
|
|
5371
5517
|
const m = `${d.id}::${String(p.key)}`;
|
|
5372
5518
|
if (o.has(m) || (o.add(m), this.isCellReadonly(d.id, p.key))) continue;
|
|
5373
|
-
const
|
|
5519
|
+
const g = this.dataModel.getCell(d.id, p.key), S = typeof t == "function" ? t(g) : t;
|
|
5374
5520
|
this.handleEdit(
|
|
5375
|
-
{ kind: "edit", rowId: d.id, colKey: p.key, next:
|
|
5521
|
+
{ kind: "edit", rowId: d.id, colKey: p.key, next: S },
|
|
5376
5522
|
this.editMode === "direct"
|
|
5377
5523
|
);
|
|
5378
5524
|
}
|
|
@@ -5465,12 +5611,12 @@ class Po {
|
|
|
5465
5611
|
'button[data-extable-fs="apply-filter"]'
|
|
5466
5612
|
), d = e.querySelector(
|
|
5467
5613
|
'button[data-extable-fs="clear-filter"]'
|
|
5468
|
-
),
|
|
5614
|
+
), f = e.querySelector('button[data-extable-fs="sort-asc"]'), p = e.querySelector(
|
|
5469
5615
|
'button[data-extable-fs="sort-desc"]'
|
|
5470
5616
|
), m = e.querySelector(
|
|
5471
5617
|
'button[data-extable-fs="clear-sort"]'
|
|
5472
5618
|
);
|
|
5473
|
-
if (!i || !o || !n || !s || !l || !a || !r || !h || !d || !
|
|
5619
|
+
if (!i || !o || !n || !s || !l || !a || !r || !h || !d || !f || !p || !m) {
|
|
5474
5620
|
O(e), this.filterSortSidebar = null;
|
|
5475
5621
|
return;
|
|
5476
5622
|
}
|
|
@@ -5480,18 +5626,18 @@ class Po {
|
|
|
5480
5626
|
this.filterSortDraft && (this.filterSortDraft.diagWarnings = n.checked);
|
|
5481
5627
|
}), s.addEventListener("input", () => {
|
|
5482
5628
|
this.filterSortDraft && (this.filterSortDraft.search = s.value, this.renderFilterSortValues());
|
|
5483
|
-
}), l.addEventListener("change", (
|
|
5484
|
-
const
|
|
5629
|
+
}), l.addEventListener("change", (g) => {
|
|
5630
|
+
const S = g.target?.closest(
|
|
5485
5631
|
'input[type="checkbox"][data-fs-val]'
|
|
5486
5632
|
);
|
|
5487
|
-
if (!
|
|
5488
|
-
const
|
|
5489
|
-
|
|
5633
|
+
if (!S || !this.filterSortDraft) return;
|
|
5634
|
+
const v = S.dataset.fsVal ?? "";
|
|
5635
|
+
v && (v === "__blanks__" ? this.filterSortDraft.includeBlanks = S.checked : S.checked ? this.filterSortDraft.selected.add(v) : this.filterSortDraft.selected.delete(v));
|
|
5490
5636
|
}), a.addEventListener("click", () => {
|
|
5491
|
-
this.filterSortDraft && (this.filterSortDraft.selected = new Set(this.filterSortDraft.values.map((
|
|
5637
|
+
this.filterSortDraft && (this.filterSortDraft.selected = new Set(this.filterSortDraft.values.map((g) => g.key)), this.filterSortDraft.includeBlanks = this.filterSortDraft.hasBlanks, this.renderFilterSortValues());
|
|
5492
5638
|
}), r.addEventListener("click", () => {
|
|
5493
5639
|
this.filterSortDraft && (this.filterSortDraft.selected = /* @__PURE__ */ new Set(), this.filterSortDraft.includeBlanks = !1, this.renderFilterSortValues());
|
|
5494
|
-
}), h.addEventListener("click", () => this.applyFilterSortDraft()), d.addEventListener("click", () => this.clearFilterSortForActiveColumn()),
|
|
5640
|
+
}), h.addEventListener("click", () => this.applyFilterSortDraft()), d.addEventListener("click", () => this.clearFilterSortForActiveColumn()), f.addEventListener("click", () => this.setSortForActiveColumn("asc")), p.addEventListener("click", () => this.setSortForActiveColumn("desc")), m.addEventListener("click", () => this.clearSort()), this.filterSortSidebarUnsub = this.dataModel.subscribe(() => {
|
|
5495
5641
|
this.isFilterSortPanelVisible() && this.filterSortActiveColumnKey && (this.buildFilterSortDraft(this.filterSortActiveColumnKey), this.renderFilterSortSidebar());
|
|
5496
5642
|
});
|
|
5497
5643
|
}
|
|
@@ -5505,18 +5651,18 @@ class Po {
|
|
|
5505
5651
|
this.isFilterSortPanelVisible() ? this.hideFilterSortPanel() : this.showFilterSortPanel(t);
|
|
5506
5652
|
}
|
|
5507
5653
|
buildFilterSortDraft(t) {
|
|
5508
|
-
const e = this.dataModel.getView(), o = this.dataModel.getSchema().columns.find((
|
|
5654
|
+
const e = this.dataModel.getView(), o = this.dataModel.getSchema().columns.find((f) => String(f.key) === String(t));
|
|
5509
5655
|
if (!o) {
|
|
5510
5656
|
this.filterSortDraft = null;
|
|
5511
5657
|
return;
|
|
5512
5658
|
}
|
|
5513
|
-
const n = this.filterSortDraft && String(this.filterSortDraft.colKey) === String(o.key) ? this.filterSortDraft.search : "", s = this.dataModel.getDistinctValuesForColumn(o.key), l = s.values.map((
|
|
5514
|
-
(
|
|
5659
|
+
const n = this.filterSortDraft && String(this.filterSortDraft.colKey) === String(o.key) ? this.filterSortDraft.search : "", s = this.dataModel.getDistinctValuesForColumn(o.key), l = s.values.map((f) => ({ ...f, key: this.stableValueKey(f.value) })), a = (e.filters ?? []).find(
|
|
5660
|
+
(f) => f.kind === "values" && String(f.key) === String(o.key)
|
|
5515
5661
|
), r = /* @__PURE__ */ new Set();
|
|
5516
5662
|
if (a)
|
|
5517
|
-
for (const
|
|
5663
|
+
for (const f of a.values ?? []) r.add(this.stableValueKey(f));
|
|
5518
5664
|
else
|
|
5519
|
-
for (const
|
|
5665
|
+
for (const f of l) r.add(f.key);
|
|
5520
5666
|
const h = a ? !!a.includeBlanks : s.hasBlanks, d = e.columnDiagnostics?.[String(o.key)];
|
|
5521
5667
|
this.filterSortDraft = {
|
|
5522
5668
|
colKey: o.key,
|
|
@@ -5550,8 +5696,8 @@ class Po {
|
|
|
5550
5696
|
}
|
|
5551
5697
|
const h = this.dataModel.getSchema().columns.find((p) => String(p.key) === String(l.colKey))?.header ?? String(l.colKey);
|
|
5552
5698
|
t.textContent = `Sort/Filter: ${h}`, e.checked = l.diagErrors, i.checked = l.diagWarnings, o.value = l.search;
|
|
5553
|
-
const
|
|
5554
|
-
n && (n.dataset.active =
|
|
5699
|
+
const f = this.dataModel.getView().sorts?.find((p) => String(p.key) === String(l.colKey));
|
|
5700
|
+
n && (n.dataset.active = f?.dir === "asc" ? "1" : "0"), s && (s.dataset.active = f?.dir === "desc" ? "1" : "0"), this.renderFilterSortValues();
|
|
5555
5701
|
}
|
|
5556
5702
|
renderFilterSortValues() {
|
|
5557
5703
|
if (!this.filterSortSidebar) return;
|
|
@@ -5671,11 +5817,11 @@ class Po {
|
|
|
5671
5817
|
this.viewportState = i, this.rafId === null && (this.rafId = requestAnimationFrame(() => this.flushRender()));
|
|
5672
5818
|
}
|
|
5673
5819
|
flushRender() {
|
|
5674
|
-
this.rafId = null, this.viewportState && (this.selectionManager?.onScroll(this.viewportState.scrollTop, this.viewportState.scrollLeft), !(this.renderer instanceof
|
|
5820
|
+
this.rafId = null, this.viewportState && (this.selectionManager?.onScroll(this.viewportState.scrollTop, this.viewportState.scrollLeft), !(this.renderer instanceof Tt) && this.safeRender(this.viewportState));
|
|
5675
5821
|
}
|
|
5676
5822
|
}
|
|
5677
|
-
function
|
|
5678
|
-
return new
|
|
5823
|
+
function Jo(c, t) {
|
|
5824
|
+
return new Uo({
|
|
5679
5825
|
root: document.createElement("div"),
|
|
5680
5826
|
defaultData: c.data,
|
|
5681
5827
|
defaultView: c.view,
|
|
@@ -5683,13 +5829,13 @@ function jo(c, t) {
|
|
|
5683
5829
|
options: t
|
|
5684
5830
|
});
|
|
5685
5831
|
}
|
|
5686
|
-
function
|
|
5832
|
+
function Zo(c, t) {
|
|
5687
5833
|
return t.remount(c), t;
|
|
5688
5834
|
}
|
|
5689
5835
|
export {
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5836
|
+
Uo as ExtableCore,
|
|
5837
|
+
Jo as createTablePlaceholder,
|
|
5838
|
+
Qo as defineSchema,
|
|
5839
|
+
Zo as mountTable
|
|
5694
5840
|
};
|
|
5695
5841
|
//# sourceMappingURL=index.js.map
|