@iyulab/flex-table 0.30.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +37 -0
- package/dist/array/index.d.ts +3 -0
- package/dist/array/index.js +51 -0
- package/dist/array/types.d.ts +39 -0
- package/dist/array/use-array-source.d.ts +39 -0
- package/dist/array/use-array-source.test.d.ts +1 -0
- package/dist/{flex-table-DuQWDNlT.js → flex-table-BH1lOINr.js} +244 -293
- package/dist/flex-table.js +1 -1
- package/dist/odata/index.js +2 -83
- package/dist/react.js +1 -1
- package/dist/sorting-CjfjRxwL.js +51 -0
- package/dist/use-odata-source-5gOJiMFj.js +83 -0
- package/package.json +6 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as e, t } from "./sorting-CjfjRxwL.js";
|
|
2
|
+
import { LitElement as n, css as r, html as i, nothing as a } from "lit";
|
|
3
|
+
import { customElement as o, property as s, state as c } from "lit/decorators.js";
|
|
3
4
|
//#region src/styles/flex-table.styles.ts
|
|
4
|
-
var
|
|
5
|
+
var l = r`
|
|
5
6
|
/* --- Theme Variables (Light defaults) --- */
|
|
6
7
|
:host {
|
|
7
8
|
--ft-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
@@ -866,13 +867,13 @@ var s = t`
|
|
|
866
867
|
`;
|
|
867
868
|
//#endregion
|
|
868
869
|
//#region src/renderers/format.ts
|
|
869
|
-
function
|
|
870
|
-
return e == null ? "" : typeof t == "function" ? t(e) :
|
|
870
|
+
function u(e, t) {
|
|
871
|
+
return e == null ? "" : typeof t == "function" ? t(e) : d(t) ? p(e, t) : f(e, t);
|
|
871
872
|
}
|
|
872
|
-
function
|
|
873
|
+
function d(e) {
|
|
873
874
|
return /[yMdHhms]/.test(e);
|
|
874
875
|
}
|
|
875
|
-
function
|
|
876
|
+
function f(e, t) {
|
|
876
877
|
let n = typeof e == "number" ? e : Number(e);
|
|
877
878
|
if (isNaN(n)) return String(e);
|
|
878
879
|
let r = t.endsWith("%"), i = t.match(/^([^#0.,%]+)/), a = i ? i[1] : "", o = t.replace(/^[^#0.,%]+/, "").replace(/%$/, ""), s = o.match(/\.([0#]+)$/), c = s ? s[1].length : 0, l = {
|
|
@@ -885,7 +886,7 @@ function u(e, t) {
|
|
|
885
886
|
style: "percent"
|
|
886
887
|
}).format(n) : (u = new Intl.NumberFormat(void 0, l).format(n), a && (u = a + u)), u + "";
|
|
887
888
|
}
|
|
888
|
-
function
|
|
889
|
+
function p(e, t) {
|
|
889
890
|
let n;
|
|
890
891
|
if (e instanceof Date) n = e;
|
|
891
892
|
else if (typeof e == "string" || typeof e == "number") n = new Date(e);
|
|
@@ -896,29 +897,29 @@ function d(e, t) {
|
|
|
896
897
|
}
|
|
897
898
|
//#endregion
|
|
898
899
|
//#region src/renderers/cell-renderer.ts
|
|
899
|
-
function
|
|
900
|
-
return n.renderer ? n.renderer(e, t, n) : n.format ? typeof n.format == "function" ? n.format(e, t, n) :
|
|
900
|
+
function m(e, t, n) {
|
|
901
|
+
return n.renderer ? n.renderer(e, t, n) : n.format ? typeof n.format == "function" ? n.format(e, t, n) : u(e, n.format) : h(e, n);
|
|
901
902
|
}
|
|
902
|
-
function
|
|
903
|
+
function h(e, t) {
|
|
903
904
|
if (e == null) return "";
|
|
904
905
|
switch (t.type) {
|
|
905
|
-
case "number": return
|
|
906
|
-
case "boolean": return
|
|
907
|
-
case "date": return
|
|
908
|
-
case "datetime": return
|
|
909
|
-
case "select": return
|
|
906
|
+
case "number": return _(e);
|
|
907
|
+
case "boolean": return i`<span class="ft-bool">${e ? "✔" : ""}</span>`;
|
|
908
|
+
case "date": return v(e);
|
|
909
|
+
case "datetime": return y(e);
|
|
910
|
+
case "select": return g(e, t);
|
|
910
911
|
default: return String(e);
|
|
911
912
|
}
|
|
912
913
|
}
|
|
913
|
-
function
|
|
914
|
+
function g(e, t) {
|
|
914
915
|
if (!t.options || t.options.length === 0 || typeof t.options[0] == "string") return e == null ? "" : String(e);
|
|
915
916
|
let n = t.options.find((t) => t.value === e);
|
|
916
917
|
return n ? n.label : e == null ? "" : String(e);
|
|
917
918
|
}
|
|
918
|
-
function
|
|
919
|
+
function _(e) {
|
|
919
920
|
return typeof e == "number" ? Number.isInteger(e) ? e.toLocaleString() : e.toLocaleString(void 0, { minimumFractionDigits: 1 }) : String(e);
|
|
920
921
|
}
|
|
921
|
-
function
|
|
922
|
+
function v(e) {
|
|
922
923
|
if (e instanceof Date) return e.toLocaleDateString();
|
|
923
924
|
if (typeof e == "string") {
|
|
924
925
|
let t = new Date(e);
|
|
@@ -926,7 +927,7 @@ function g(e) {
|
|
|
926
927
|
}
|
|
927
928
|
return String(e);
|
|
928
929
|
}
|
|
929
|
-
function
|
|
930
|
+
function y(e) {
|
|
930
931
|
if (e instanceof Date) return e.toLocaleString();
|
|
931
932
|
if (typeof e == "string") {
|
|
932
933
|
let t = new Date(e);
|
|
@@ -936,7 +937,7 @@ function _(e) {
|
|
|
936
937
|
}
|
|
937
938
|
//#endregion
|
|
938
939
|
//#region src/core/selection.ts
|
|
939
|
-
function
|
|
940
|
+
function b(e) {
|
|
940
941
|
return {
|
|
941
942
|
startRow: Math.min(e.startRow, e.endRow),
|
|
942
943
|
startCol: Math.min(e.startCol, e.endCol),
|
|
@@ -944,7 +945,7 @@ function v(e) {
|
|
|
944
945
|
endCol: Math.max(e.startCol, e.endCol)
|
|
945
946
|
};
|
|
946
947
|
}
|
|
947
|
-
var
|
|
948
|
+
var x = class {
|
|
948
949
|
constructor() {
|
|
949
950
|
this.activeCell = null, this.rangeAnchor = null, this.range = null, this.extraRanges = [], this._rowCount = 0, this._colCount = 0;
|
|
950
951
|
}
|
|
@@ -971,7 +972,7 @@ var y = class {
|
|
|
971
972
|
return e < 0 || e >= this._rowCount || t < 0 || t >= this._colCount ? this.activeCell : (!this.rangeAnchor && this.activeCell && (this.rangeAnchor = { ...this.activeCell }), this.activeCell = {
|
|
972
973
|
row: e,
|
|
973
974
|
col: t
|
|
974
|
-
}, this.rangeAnchor && (this.range =
|
|
975
|
+
}, this.rangeAnchor && (this.range = b({
|
|
975
976
|
startRow: this.rangeAnchor.row,
|
|
976
977
|
startCol: this.rangeAnchor.col,
|
|
977
978
|
endRow: e,
|
|
@@ -1042,7 +1043,7 @@ var y = class {
|
|
|
1042
1043
|
shiftMoveRight() {
|
|
1043
1044
|
return this.activeCell ? this.setActiveWithRange(this.activeCell.row, this.activeCell.col + 1) : null;
|
|
1044
1045
|
}
|
|
1045
|
-
},
|
|
1046
|
+
}, S = class {
|
|
1046
1047
|
constructor() {
|
|
1047
1048
|
this.current = null;
|
|
1048
1049
|
}
|
|
@@ -1063,7 +1064,7 @@ var y = class {
|
|
|
1063
1064
|
let e = this.current;
|
|
1064
1065
|
return this.current = null, e;
|
|
1065
1066
|
}
|
|
1066
|
-
},
|
|
1067
|
+
}, C = class {
|
|
1067
1068
|
constructor() {
|
|
1068
1069
|
this._selected = /* @__PURE__ */ new Set(), this._mode = "multi", this._rowCount = 0;
|
|
1069
1070
|
}
|
|
@@ -1123,58 +1124,8 @@ var y = class {
|
|
|
1123
1124
|
}
|
|
1124
1125
|
};
|
|
1125
1126
|
//#endregion
|
|
1126
|
-
//#region src/core/sorting.ts
|
|
1127
|
-
function S(e, t, n) {
|
|
1128
|
-
let r = Array.from({ length: e.length }, (e, t) => t);
|
|
1129
|
-
if (t.length === 0) return r;
|
|
1130
|
-
let i = /* @__PURE__ */ new Map();
|
|
1131
|
-
for (let e of n) i.set(e.key, e.type ?? "text");
|
|
1132
|
-
return r.sort((n, r) => {
|
|
1133
|
-
for (let { key: a, direction: o } of t) {
|
|
1134
|
-
let t = e[n][a], s = e[r][a], c = t == null, l = s == null;
|
|
1135
|
-
if (c && l) continue;
|
|
1136
|
-
if (c) return 1;
|
|
1137
|
-
if (l) return -1;
|
|
1138
|
-
let u = C(t, s, i.get(a) ?? "text");
|
|
1139
|
-
if (u !== 0) return o === "asc" ? u : -u;
|
|
1140
|
-
}
|
|
1141
|
-
return n - r;
|
|
1142
|
-
}), r;
|
|
1143
|
-
}
|
|
1144
|
-
function C(e, t, n) {
|
|
1145
|
-
switch (n) {
|
|
1146
|
-
case "number": {
|
|
1147
|
-
let n = Number(e), r = Number(t);
|
|
1148
|
-
return isNaN(n) && isNaN(r) ? 0 : isNaN(n) ? 1 : isNaN(r) ? -1 : n - r;
|
|
1149
|
-
}
|
|
1150
|
-
case "boolean": return !!e - +!!t;
|
|
1151
|
-
case "date":
|
|
1152
|
-
case "datetime": {
|
|
1153
|
-
let n = new Date(e).getTime(), r = new Date(t).getTime();
|
|
1154
|
-
return (isNaN(n) ? 0 : n) - (isNaN(r) ? 0 : r);
|
|
1155
|
-
}
|
|
1156
|
-
default: return String(e).localeCompare(String(t));
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
function w(e, t, n) {
|
|
1160
|
-
let r = e.find((e) => e.key === t);
|
|
1161
|
-
return n ? r ? r.direction === "asc" ? e.map((e) => e.key === t ? {
|
|
1162
|
-
...e,
|
|
1163
|
-
direction: "desc"
|
|
1164
|
-
} : e) : e.filter((e) => e.key !== t) : [...e, {
|
|
1165
|
-
key: t,
|
|
1166
|
-
direction: "asc"
|
|
1167
|
-
}] : r ? r.direction === "asc" ? [{
|
|
1168
|
-
key: t,
|
|
1169
|
-
direction: "desc"
|
|
1170
|
-
}] : [] : [{
|
|
1171
|
-
key: t,
|
|
1172
|
-
direction: "asc"
|
|
1173
|
-
}];
|
|
1174
|
-
}
|
|
1175
|
-
//#endregion
|
|
1176
1127
|
//#region src/core/filtering.ts
|
|
1177
|
-
function
|
|
1128
|
+
function w(e, t, n) {
|
|
1178
1129
|
if (t.length === 0) return Array.from({ length: e.length }, (e, t) => t);
|
|
1179
1130
|
let r = [];
|
|
1180
1131
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -1193,9 +1144,9 @@ function T(e, t, n) {
|
|
|
1193
1144
|
}
|
|
1194
1145
|
//#endregion
|
|
1195
1146
|
//#region src/core/undo.ts
|
|
1196
|
-
var
|
|
1147
|
+
var T = 100, E = class {
|
|
1197
1148
|
constructor() {
|
|
1198
|
-
this._undoStack = [], this._redoStack = [], this._maxSize =
|
|
1149
|
+
this._undoStack = [], this._redoStack = [], this._maxSize = T;
|
|
1199
1150
|
}
|
|
1200
1151
|
get maxSize() {
|
|
1201
1152
|
return this._maxSize;
|
|
@@ -1232,7 +1183,7 @@ var E = 100, D = class {
|
|
|
1232
1183
|
};
|
|
1233
1184
|
//#endregion
|
|
1234
1185
|
//#region src/clipboard/clipboard.ts
|
|
1235
|
-
function
|
|
1186
|
+
function D(e, t, n) {
|
|
1236
1187
|
let r = [];
|
|
1237
1188
|
for (let i = n.startRow; i <= n.endRow; i++) {
|
|
1238
1189
|
let a = e[i], o = [];
|
|
@@ -1287,7 +1238,7 @@ function k(e, t) {
|
|
|
1287
1238
|
}
|
|
1288
1239
|
//#endregion
|
|
1289
1240
|
//#region src/export/xlsx-writer.ts
|
|
1290
|
-
var
|
|
1241
|
+
var A = (() => {
|
|
1291
1242
|
let e = /* @__PURE__ */ new Uint32Array(256);
|
|
1292
1243
|
for (let t = 0; t < 256; t++) {
|
|
1293
1244
|
let n = t;
|
|
@@ -1296,56 +1247,56 @@ var te = (() => {
|
|
|
1296
1247
|
}
|
|
1297
1248
|
return e;
|
|
1298
1249
|
})();
|
|
1299
|
-
function
|
|
1250
|
+
function j(e) {
|
|
1300
1251
|
let t = 4294967295;
|
|
1301
|
-
for (let n = 0; n < e.length; n++) t =
|
|
1252
|
+
for (let n = 0; n < e.length; n++) t = A[(t ^ e[n]) & 255] ^ t >>> 8;
|
|
1302
1253
|
return (t ^ 4294967295) >>> 0;
|
|
1303
1254
|
}
|
|
1304
|
-
var
|
|
1305
|
-
function
|
|
1255
|
+
var M = new TextEncoder();
|
|
1256
|
+
function ee(e) {
|
|
1306
1257
|
let t = [], n = [], r = 0;
|
|
1307
1258
|
for (let i of e) {
|
|
1308
|
-
let e =
|
|
1259
|
+
let e = M.encode(i.name), a = j(i.data), o = i.data.length, s = new ArrayBuffer(30 + e.length), c = new DataView(s);
|
|
1309
1260
|
c.setUint32(0, 67324752, !0), c.setUint16(4, 20, !0), c.setUint16(6, 0, !0), c.setUint16(8, 0, !0), c.setUint16(10, 0, !0), c.setUint16(12, 33, !0), c.setUint32(14, a, !0), c.setUint32(18, o, !0), c.setUint32(22, o, !0), c.setUint16(26, e.length, !0), c.setUint16(28, 0, !0), new Uint8Array(s, 30).set(e), t.push(new Uint8Array(s)), t.push(i.data);
|
|
1310
1261
|
let l = new ArrayBuffer(46 + e.length), u = new DataView(l);
|
|
1311
1262
|
u.setUint32(0, 33639248, !0), u.setUint16(4, 20, !0), u.setUint16(6, 20, !0), u.setUint16(8, 0, !0), u.setUint16(10, 0, !0), u.setUint16(12, 0, !0), u.setUint16(14, 33, !0), u.setUint32(16, a, !0), u.setUint32(20, o, !0), u.setUint32(24, o, !0), u.setUint16(28, e.length, !0), u.setUint16(30, 0, !0), u.setUint16(32, 0, !0), u.setUint16(34, 0, !0), u.setUint16(36, 0, !0), u.setUint32(38, 0, !0), u.setUint32(42, r, !0), new Uint8Array(l, 46).set(e), n.push(new Uint8Array(l)), r += 30 + e.length + o;
|
|
1312
1263
|
}
|
|
1313
|
-
let i =
|
|
1314
|
-
return o.setUint32(0, 101010256, !0), o.setUint16(4, 0, !0), o.setUint16(6, 0, !0), o.setUint16(8, e.length, !0), o.setUint16(10, e.length, !0), o.setUint32(12, i.length, !0), o.setUint32(16, r, !0), o.setUint16(20, 0, !0),
|
|
1264
|
+
let i = N(n), a = /* @__PURE__ */ new ArrayBuffer(22), o = new DataView(a);
|
|
1265
|
+
return o.setUint32(0, 101010256, !0), o.setUint16(4, 0, !0), o.setUint16(6, 0, !0), o.setUint16(8, e.length, !0), o.setUint16(10, e.length, !0), o.setUint32(12, i.length, !0), o.setUint32(16, r, !0), o.setUint16(20, 0, !0), N([
|
|
1315
1266
|
...t,
|
|
1316
1267
|
i,
|
|
1317
1268
|
new Uint8Array(a)
|
|
1318
1269
|
]);
|
|
1319
1270
|
}
|
|
1320
|
-
function
|
|
1271
|
+
function N(e) {
|
|
1321
1272
|
let t = e.reduce((e, t) => e + t.length, 0), n = new Uint8Array(t), r = 0;
|
|
1322
1273
|
for (let t of e) n.set(t, r), r += t.length;
|
|
1323
1274
|
return n;
|
|
1324
1275
|
}
|
|
1325
|
-
function
|
|
1276
|
+
function P(e) {
|
|
1326
1277
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1327
1278
|
}
|
|
1328
|
-
function
|
|
1279
|
+
function F(e) {
|
|
1329
1280
|
let t = "";
|
|
1330
1281
|
for (e++; e > 0;) t = String.fromCharCode(64 + (e % 26 || 26)) + t, e = Math.floor((e - 1) / 26);
|
|
1331
1282
|
return t;
|
|
1332
1283
|
}
|
|
1333
|
-
function
|
|
1334
|
-
return
|
|
1284
|
+
function I(e, t) {
|
|
1285
|
+
return F(t) + (e + 1);
|
|
1335
1286
|
}
|
|
1336
|
-
function
|
|
1287
|
+
function te(e) {
|
|
1337
1288
|
let t = Date.UTC(1899, 11, 30);
|
|
1338
1289
|
return (e.getTime() - t) / 864e5;
|
|
1339
1290
|
}
|
|
1340
|
-
var
|
|
1341
|
-
function
|
|
1342
|
-
let n = [], r = t.map((e, t) => `<c r="${
|
|
1291
|
+
var ne = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\n <Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/>\n <Default Extension=\"xml\" ContentType=\"application/xml\"/>\n <Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/>\n <Override PartName=\"/xl/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/>\n <Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/>\n</Types>", re = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n <Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"xl/workbook.xml\"/>\n</Relationships>", ie = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">\n <sheets><sheet name=\"Sheet1\" sheetId=\"1\" r:id=\"rId1\"/></sheets>\n</workbook>", ae = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n <Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/>\n <Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/>\n</Relationships>", oe = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">\n <numFmts count=\"1\"><numFmt numFmtId=\"164\" formatCode=\"yyyy-mm-dd\"/></numFmts>\n <fonts count=\"2\">\n <font><sz val=\"11\"/><name val=\"Calibri\"/></font>\n <font><sz val=\"11\"/><b/><name val=\"Calibri\"/></font>\n </fonts>\n <fills count=\"2\">\n <fill><patternFill patternType=\"none\"/></fill>\n <fill><patternFill patternType=\"gray125\"/></fill>\n </fills>\n <borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders>\n <cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs>\n <cellXfs count=\"3\">\n <xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/>\n <xf numFmtId=\"164\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyNumberFormat=\"1\"/>\n <xf numFmtId=\"0\" fontId=\"1\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\"/>\n </cellXfs>\n</styleSheet>";
|
|
1292
|
+
function se(e, t) {
|
|
1293
|
+
let n = [], r = t.map((e, t) => `<c r="${I(0, t)}" t="str" s="2"><v>${P(e.header)}</v></c>`);
|
|
1343
1294
|
return n.push(`<row r="1">${r.join("")}</row>`), e.forEach((e, r) => {
|
|
1344
1295
|
let i = t.map((t, n) => {
|
|
1345
|
-
let i =
|
|
1296
|
+
let i = I(r + 1, n), a = e[t.key];
|
|
1346
1297
|
if (a == null) return `<c r="${i}" t="str"><v></v></c>`;
|
|
1347
1298
|
let o = t.type ?? "text";
|
|
1348
|
-
return o === "number" && typeof a == "number" ? `<c r="${i}"><v>${a}</v></c>` : (o === "date" || o === "datetime") && a instanceof Date ? `<c r="${i}" s="1"><v>${
|
|
1299
|
+
return o === "number" && typeof a == "number" ? `<c r="${i}"><v>${a}</v></c>` : (o === "date" || o === "datetime") && a instanceof Date ? `<c r="${i}" s="1"><v>${te(a).toFixed(6)}</v></c>` : o === "boolean" ? `<c r="${i}" t="b"><v>${+!!a}</v></c>` : `<c r="${i}" t="str"><v>${P(String(a))}</v></c>`;
|
|
1349
1300
|
});
|
|
1350
1301
|
n.push(`<row r="${r + 2}">${i.join("")}</row>`);
|
|
1351
1302
|
}), `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
@@ -1353,55 +1304,55 @@ function oe(e, t) {
|
|
|
1353
1304
|
<sheetData>${n.join("")}</sheetData>
|
|
1354
1305
|
</worksheet>`;
|
|
1355
1306
|
}
|
|
1356
|
-
function
|
|
1357
|
-
let n =
|
|
1358
|
-
return
|
|
1307
|
+
function ce(e, t) {
|
|
1308
|
+
let n = se(e, t);
|
|
1309
|
+
return ee([
|
|
1359
1310
|
{
|
|
1360
1311
|
name: "[Content_Types].xml",
|
|
1361
|
-
data:
|
|
1312
|
+
data: M.encode(ne)
|
|
1362
1313
|
},
|
|
1363
1314
|
{
|
|
1364
1315
|
name: "_rels/.rels",
|
|
1365
|
-
data:
|
|
1316
|
+
data: M.encode(re)
|
|
1366
1317
|
},
|
|
1367
1318
|
{
|
|
1368
1319
|
name: "xl/workbook.xml",
|
|
1369
|
-
data:
|
|
1320
|
+
data: M.encode(ie)
|
|
1370
1321
|
},
|
|
1371
1322
|
{
|
|
1372
1323
|
name: "xl/_rels/workbook.xml.rels",
|
|
1373
|
-
data:
|
|
1324
|
+
data: M.encode(ae)
|
|
1374
1325
|
},
|
|
1375
1326
|
{
|
|
1376
1327
|
name: "xl/worksheets/sheet1.xml",
|
|
1377
|
-
data:
|
|
1328
|
+
data: M.encode(n)
|
|
1378
1329
|
},
|
|
1379
1330
|
{
|
|
1380
1331
|
name: "xl/styles.xml",
|
|
1381
|
-
data:
|
|
1332
|
+
data: M.encode(oe)
|
|
1382
1333
|
}
|
|
1383
1334
|
]);
|
|
1384
1335
|
}
|
|
1385
1336
|
//#endregion
|
|
1386
1337
|
//#region src/export/export.ts
|
|
1387
|
-
function
|
|
1338
|
+
function L(e, t, n) {
|
|
1388
1339
|
switch (n) {
|
|
1389
|
-
case "csv": return
|
|
1390
|
-
case "tsv": return
|
|
1391
|
-
case "json": return
|
|
1392
|
-
case "xlsx": return
|
|
1340
|
+
case "csv": return z(e, t, ",");
|
|
1341
|
+
case "tsv": return z(e, t, " ");
|
|
1342
|
+
case "json": return V(e, t);
|
|
1343
|
+
case "xlsx": return ce(e, t);
|
|
1393
1344
|
}
|
|
1394
1345
|
}
|
|
1395
|
-
function
|
|
1346
|
+
function R(e, t) {
|
|
1396
1347
|
return e == null ? "" : (t.type === "date" || t.type === "datetime") && e instanceof Date ? e.toISOString() : String(e);
|
|
1397
1348
|
}
|
|
1398
|
-
function
|
|
1399
|
-
return [t.map((e) =>
|
|
1349
|
+
function z(e, t, n) {
|
|
1350
|
+
return [t.map((e) => B(e.header, n)).join(n), ...e.map((e) => t.map((t) => B(R(e[t.key], t), n)).join(n))].join("\n");
|
|
1400
1351
|
}
|
|
1401
|
-
function
|
|
1352
|
+
function B(e, t) {
|
|
1402
1353
|
return e.includes(t) || e.includes("\"") || e.includes("\n") || e.includes("\r") ? "\"" + e.replace(/"/g, "\"\"") + "\"" : e;
|
|
1403
1354
|
}
|
|
1404
|
-
function
|
|
1355
|
+
function V(e, t) {
|
|
1405
1356
|
let n = e.map((e) => {
|
|
1406
1357
|
let n = {};
|
|
1407
1358
|
for (let r of t) {
|
|
@@ -1412,26 +1363,26 @@ function U(e, t) {
|
|
|
1412
1363
|
});
|
|
1413
1364
|
return JSON.stringify(n, null, 2);
|
|
1414
1365
|
}
|
|
1415
|
-
function
|
|
1366
|
+
function H(e, t, n) {
|
|
1416
1367
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
1417
1368
|
a.href = i, a.download = t, a.style.display = "none", document.body.appendChild(a), a.click(), document.body.removeChild(a), setTimeout(() => URL.revokeObjectURL(i), 100);
|
|
1418
1369
|
}
|
|
1419
|
-
var
|
|
1370
|
+
var U = {
|
|
1420
1371
|
csv: "text/csv;charset=utf-8",
|
|
1421
1372
|
tsv: "text/tab-separated-values;charset=utf-8",
|
|
1422
1373
|
json: "application/json;charset=utf-8",
|
|
1423
1374
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
1424
|
-
},
|
|
1375
|
+
}, W = {
|
|
1425
1376
|
csv: ".csv",
|
|
1426
1377
|
tsv: ".tsv",
|
|
1427
1378
|
json: ".json",
|
|
1428
1379
|
xlsx: ".xlsx"
|
|
1429
1380
|
};
|
|
1430
1381
|
function le(e) {
|
|
1431
|
-
return
|
|
1382
|
+
return U[e];
|
|
1432
1383
|
}
|
|
1433
1384
|
function ue(e) {
|
|
1434
|
-
return
|
|
1385
|
+
return W[e];
|
|
1435
1386
|
}
|
|
1436
1387
|
//#endregion
|
|
1437
1388
|
//#region src/export/xlsx-reader.ts
|
|
@@ -1478,13 +1429,13 @@ async function he(e) {
|
|
|
1478
1429
|
return r;
|
|
1479
1430
|
}
|
|
1480
1431
|
var ge = new TextDecoder("utf-8");
|
|
1481
|
-
function
|
|
1432
|
+
function G(e) {
|
|
1482
1433
|
let t = ge.decode(e);
|
|
1483
1434
|
return new DOMParser().parseFromString(t, "application/xml");
|
|
1484
1435
|
}
|
|
1485
1436
|
function _e(e) {
|
|
1486
1437
|
if (!e) return [];
|
|
1487
|
-
let t =
|
|
1438
|
+
let t = G(e);
|
|
1488
1439
|
return Array.from(t.querySelectorAll("si")).map((e) => Array.from(e.querySelectorAll("t")).map((e) => e.textContent ?? "").join(""));
|
|
1489
1440
|
}
|
|
1490
1441
|
function ve(e) {
|
|
@@ -1492,7 +1443,7 @@ function ve(e) {
|
|
|
1492
1443
|
return new Date(t).toISOString().slice(0, 10);
|
|
1493
1444
|
}
|
|
1494
1445
|
function ye(e, t) {
|
|
1495
|
-
let n =
|
|
1446
|
+
let n = G(e).querySelectorAll("row");
|
|
1496
1447
|
if (n.length === 0) return [];
|
|
1497
1448
|
let r = 0, i = /* @__PURE__ */ new Map();
|
|
1498
1449
|
for (let e of n) {
|
|
@@ -1527,7 +1478,7 @@ function be(e) {
|
|
|
1527
1478
|
for (; n < e.length && e[n] >= "A" && e[n] <= "Z";) t = t * 26 + (e.charCodeAt(n) - 64), n++;
|
|
1528
1479
|
return t - 1;
|
|
1529
1480
|
}
|
|
1530
|
-
async function
|
|
1481
|
+
async function K(e) {
|
|
1531
1482
|
let t = await he(e), n = _e(t.get("xl/sharedStrings.xml")), r = t.get("xl/worksheets/sheet1.xml");
|
|
1532
1483
|
if (!r) {
|
|
1533
1484
|
for (let [e, n] of t) if (e.toLowerCase().includes("worksheets/sheet")) {
|
|
@@ -1562,14 +1513,14 @@ var J = {
|
|
|
1562
1513
|
lt: "<",
|
|
1563
1514
|
gte: "≥",
|
|
1564
1515
|
lte: "≤"
|
|
1565
|
-
}, Y = 120, X = 40, Z = 32, Q = 5, $ = class extends
|
|
1516
|
+
}, Y = 120, X = 40, Z = 32, Q = 5, $ = class extends n {
|
|
1566
1517
|
constructor(...e) {
|
|
1567
|
-
super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this._rowHeightFromCss = Z, this.showRowNumbers = !1, this.theme = void 0, this.maxRows = 0, this.editable = !0, this.showFilters = !1, this.showContextMenu = !1, this.frozenRows = 0, this.emptyMessage = "No data", this.noMatchingMessage = "No matching data", this.loading = !1, this.importEnabled = !1, this.selectable = !1, this.dataMode = "client", this.footerData = null, this.stylesheets = [], this._scrollTop = 0, this._scrollLeft = 0, this._viewportHeight = 0, this._viewportWidth = 0, this._colLeftOffsets = [], this._totalRowWidth = 0, this._baseStyleSheets = [], this._activeCell = null, this._editingCell = null, this._sortCriteria = [], this._selection = new
|
|
1518
|
+
super(...e), this.columns = [], this._data = [], this._inUndoRedo = !1, this.clearUndoOnDataChange = !1, this.clearSelectionOnDataChange = !1, this._rowHeightFromCss = Z, this.showRowNumbers = !1, this.theme = void 0, this.maxRows = 0, this.editable = !0, this.showFilters = !1, this.showContextMenu = !1, this.frozenRows = 0, this.emptyMessage = "No data", this.noMatchingMessage = "No matching data", this.loading = !1, this.importEnabled = !1, this.selectable = !1, this.dataMode = "client", this.footerData = null, this.stylesheets = [], this._scrollTop = 0, this._scrollLeft = 0, this._viewportHeight = 0, this._viewportWidth = 0, this._colLeftOffsets = [], this._totalRowWidth = 0, this._baseStyleSheets = [], this._activeCell = null, this._editingCell = null, this._sortCriteria = [], this._selection = new x(), this._editing = new S(), this._rowSelection = new C(), this._undo = new E(), this._filters = [], this._filteredIndices = [], this._sortedIndices = [], this._openFilterKey = null, this._rowSelectionVersion = 0, this._lastCheckboxRowIndex = null, this._checkboxShiftPending = !1, this._autocompleteState = null, this._headerMenu = null, this._bodyContextMenu = null, this._commentPopup = null, this._viewDirty = !0, this._isDragging = !1, this._wasDrag = !1, this._resizing = null, this._resizeCleanup = null, this._colDrag = null, this._colDragIndicatorLeft = null, this._fillDrag = null, this._rowDrag = null, this._rowDragIndicatorY = null, this._findState = null, this._columnWidths = /* @__PURE__ */ new Map(), this._hostResizeObserver = null, this._comments = /* @__PURE__ */ new Map(), this._isDragOver = !1, this._onCommentPopupOutsideClick = () => {
|
|
1568
1519
|
this._commitCommentPopup();
|
|
1569
1520
|
}, this._invalidCells = /* @__PURE__ */ new Map(), this._textFilterState = /* @__PURE__ */ new Map(), this._numberFilterState = /* @__PURE__ */ new Map(), this._dateFilterState = /* @__PURE__ */ new Map(), this._emptyFilterState = /* @__PURE__ */ new Map();
|
|
1570
1521
|
}
|
|
1571
1522
|
static {
|
|
1572
|
-
this.styles =
|
|
1523
|
+
this.styles = l;
|
|
1573
1524
|
}
|
|
1574
1525
|
get data() {
|
|
1575
1526
|
return this._data;
|
|
@@ -1929,12 +1880,12 @@ var J = {
|
|
|
1929
1880
|
if (!t) return "";
|
|
1930
1881
|
let n = this.visibleColumns.slice(t.startCol, t.endCol + 1), r = [];
|
|
1931
1882
|
for (let e = t.startRow; e <= t.endRow; e++) r.push(this.data[this._toDataIndex(e)]);
|
|
1932
|
-
return
|
|
1883
|
+
return L(r, n, e);
|
|
1933
1884
|
}
|
|
1934
|
-
return
|
|
1885
|
+
return L(this._sortedIndices.map((e) => this.data[e]), this.visibleColumns, e);
|
|
1935
1886
|
}
|
|
1936
1887
|
exportToFile(e, t) {
|
|
1937
|
-
|
|
1888
|
+
H(this.exportToString(e), t ?? `export${ue(e)}`, le(e));
|
|
1938
1889
|
}
|
|
1939
1890
|
setComment(e, t, n) {
|
|
1940
1891
|
let r = this.getComment(e, t);
|
|
@@ -1991,7 +1942,7 @@ var J = {
|
|
|
1991
1942
|
async importFromFile(e) {
|
|
1992
1943
|
let t = e.name.toLowerCase();
|
|
1993
1944
|
if (t.endsWith(".xlsx")) {
|
|
1994
|
-
let t = await
|
|
1945
|
+
let t = await K(await e.arrayBuffer());
|
|
1995
1946
|
this._applyImportedSheet(t);
|
|
1996
1947
|
} else if (t.endsWith(".csv") || t.endsWith(".tsv")) {
|
|
1997
1948
|
let t = O(await e.text());
|
|
@@ -2176,7 +2127,7 @@ var J = {
|
|
|
2176
2127
|
this._filteredIndices = Array.from({ length: this.data.length }, (e, t) => t), this._sortedIndices = this._filteredIndices;
|
|
2177
2128
|
return;
|
|
2178
2129
|
}
|
|
2179
|
-
if (this._filteredIndices =
|
|
2130
|
+
if (this._filteredIndices = w(this.data, this._filters, (e, t, n) => {
|
|
2180
2131
|
this.dispatchEvent(new CustomEvent("filter-error", {
|
|
2181
2132
|
detail: {
|
|
2182
2133
|
error: e,
|
|
@@ -2189,8 +2140,8 @@ var J = {
|
|
|
2189
2140
|
}), this._filters.length === 0 && this._sortCriteria.length === 0) this._sortedIndices = Array.from({ length: this.data.length }, (e, t) => t);
|
|
2190
2141
|
else if (this._sortCriteria.length === 0) this._sortedIndices = [...this._filteredIndices];
|
|
2191
2142
|
else {
|
|
2192
|
-
let e =
|
|
2193
|
-
this._sortedIndices =
|
|
2143
|
+
let e = this._filteredIndices.map((e) => this.data[e]), n = t(e, this._sortCriteria, this.visibleColumns);
|
|
2144
|
+
this._sortedIndices = n.map((e) => this._filteredIndices[e]);
|
|
2194
2145
|
}
|
|
2195
2146
|
}
|
|
2196
2147
|
_toDataIndex(e) {
|
|
@@ -2553,7 +2504,7 @@ var J = {
|
|
|
2553
2504
|
async _handleCopy(e) {
|
|
2554
2505
|
let t = this._selection.getEffectiveRange();
|
|
2555
2506
|
if (!t) return;
|
|
2556
|
-
let n = this.visibleColumns, r =
|
|
2507
|
+
let n = this.visibleColumns, r = D(this._sortedIndices.map((e) => this.data[e]), n, t);
|
|
2557
2508
|
try {
|
|
2558
2509
|
await navigator.clipboard.writeText(r);
|
|
2559
2510
|
} catch (e) {
|
|
@@ -2787,13 +2738,13 @@ var J = {
|
|
|
2787
2738
|
composed: !0
|
|
2788
2739
|
}));
|
|
2789
2740
|
}
|
|
2790
|
-
_onHeaderClick(
|
|
2791
|
-
let
|
|
2792
|
-
if (
|
|
2793
|
-
this._selectColumn(
|
|
2741
|
+
_onHeaderClick(t, n) {
|
|
2742
|
+
let r = this.visibleColumns.indexOf(n);
|
|
2743
|
+
if (t.ctrlKey || t.metaKey) {
|
|
2744
|
+
this._selectColumn(r);
|
|
2794
2745
|
return;
|
|
2795
2746
|
}
|
|
2796
|
-
|
|
2747
|
+
n.sortable !== !1 && (this._sortCriteria = e(this._sortCriteria, n.key, t.shiftKey), this.dataMode !== "server" && this._recomputeView(), this.requestUpdate(), this.dispatchEvent(new CustomEvent("sort-change", {
|
|
2797
2748
|
detail: { criteria: [...this._sortCriteria] },
|
|
2798
2749
|
bubbles: !0,
|
|
2799
2750
|
composed: !0
|
|
@@ -2829,27 +2780,27 @@ var J = {
|
|
|
2829
2780
|
return n;
|
|
2830
2781
|
}
|
|
2831
2782
|
_renderHeaderCell(e, t) {
|
|
2832
|
-
let
|
|
2783
|
+
let n = e.sortable !== !1, r = this._sortCriteria.find((t) => t.key === e.key), o = this._sortCriteria.length > 1 ? this._sortCriteria.findIndex((t) => t.key === e.key) : -1, s = this._filters.some((t) => t.key === e.key), c = e.pinned === "left", l = e.pinned === "right", u = [
|
|
2833
2784
|
"ft-header-cell",
|
|
2834
|
-
|
|
2785
|
+
n ? "ft-sortable" : "",
|
|
2835
2786
|
c || l ? "ft-pinned" : "",
|
|
2836
2787
|
e.headerAlign === "center" ? "ft-header-align-center" : "",
|
|
2837
2788
|
e.headerAlign === "end" ? "ft-header-align-end" : ""
|
|
2838
|
-
].filter(Boolean).join(" "), d =
|
|
2789
|
+
].filter(Boolean).join(" "), d = n ? r ? r.direction === "asc" ? "ascending" : "descending" : "none" : void 0, f = this._getColWidth(e), p = this.headerHeight, m = this._colLeftOffsets[t] ?? 0, h;
|
|
2839
2790
|
h = c ? `position: absolute; top: 0; left: ${this._scrollLeft + this._getPinnedLeft(t)}px; width: ${f}px; height: ${p}px; z-index: 4;` : l ? `position: absolute; top: 0; right: ${-this._scrollLeft + this._getPinnedRight(t)}px; width: ${f}px; height: ${p}px; z-index: 4;` : `left: ${m}px; width: ${f}px; height: ${p}px;`;
|
|
2840
2791
|
let g = this._colDrag?.active && this._colDrag.colIndex === t, _ = [...u.split(" "), g ? "ft-col-dragging" : ""].filter(Boolean).join(" "), v = this.columns, y = v.findIndex((t) => t.key === e.key), b = [];
|
|
2841
2792
|
if (y > 0) for (let e = y - 1; e >= 0 && v[e].hidden; e--) b.push(v[e]);
|
|
2842
2793
|
let x = b.length > 0;
|
|
2843
|
-
return
|
|
2794
|
+
return i`
|
|
2844
2795
|
<div class=${_}
|
|
2845
2796
|
role="columnheader"
|
|
2846
2797
|
data-col-index=${t}
|
|
2847
2798
|
style=${h}
|
|
2848
|
-
aria-sort=${d ??
|
|
2799
|
+
aria-sort=${d ?? a}
|
|
2849
2800
|
@contextmenu=${(t) => this._onHeaderContextMenu(t, e)}
|
|
2850
2801
|
@mousedown=${(n) => this._onHeaderMouseDown(n, e, t)}
|
|
2851
|
-
@click=${
|
|
2852
|
-
${x ?
|
|
2802
|
+
@click=${n ? (t) => this._onHeaderClick(t, e) : void 0}>
|
|
2803
|
+
${x ? i`
|
|
2853
2804
|
<button class="ft-hidden-col-indicator"
|
|
2854
2805
|
title="Show hidden column(s)"
|
|
2855
2806
|
@click=${(t) => {
|
|
@@ -2857,9 +2808,9 @@ var J = {
|
|
|
2857
2808
|
}}>❯</button>
|
|
2858
2809
|
` : ""}
|
|
2859
2810
|
<span>${e.header}</span>
|
|
2860
|
-
${
|
|
2861
|
-
${o >= 0 ?
|
|
2862
|
-
${this.showFilters ?
|
|
2811
|
+
${r ? i`<span class="ft-sort-indicator">${r.direction === "asc" ? "▲" : "▼"}</span>` : ""}
|
|
2812
|
+
${o >= 0 ? i`<span class="ft-sort-order">${o + 1}</span>` : ""}
|
|
2813
|
+
${this.showFilters ? i`
|
|
2863
2814
|
<button class="ft-filter-btn ${s ? "ft-filter-active" : ""}"
|
|
2864
2815
|
title="Filter"
|
|
2865
2816
|
aria-label=${`Filter ${e.header}`}
|
|
@@ -2905,10 +2856,10 @@ var J = {
|
|
|
2905
2856
|
for (let e = n - 1; e >= 0 && t[e].hidden; e--) this._setColumnHidden(t[e].key, !1);
|
|
2906
2857
|
}
|
|
2907
2858
|
_renderHeaderContextMenu() {
|
|
2908
|
-
if (!this._headerMenu) return
|
|
2909
|
-
let { key: e, x: t, y:
|
|
2910
|
-
return this.columns.find((t) => t.key === e) ?
|
|
2911
|
-
<div class="ft-header-menu" style="position: fixed; left: ${t}px; top: ${
|
|
2859
|
+
if (!this._headerMenu) return a;
|
|
2860
|
+
let { key: e, x: t, y: n, hiddenNeighbors: r } = this._headerMenu;
|
|
2861
|
+
return this.columns.find((t) => t.key === e) ? i`
|
|
2862
|
+
<div class="ft-header-menu" style="position: fixed; left: ${t}px; top: ${n}px; z-index: 200;"
|
|
2912
2863
|
@mousedown=${(e) => e.stopPropagation()}>
|
|
2913
2864
|
<div class="ft-header-menu-item"
|
|
2914
2865
|
@click=${() => {
|
|
@@ -2916,7 +2867,7 @@ var J = {
|
|
|
2916
2867
|
}}>
|
|
2917
2868
|
Hide column
|
|
2918
2869
|
</div>
|
|
2919
|
-
${
|
|
2870
|
+
${r.map((e) => i`
|
|
2920
2871
|
<div class="ft-header-menu-item"
|
|
2921
2872
|
@click=${() => {
|
|
2922
2873
|
this._setColumnHidden(e.key, !1), this._headerMenu = null;
|
|
@@ -2925,16 +2876,16 @@ var J = {
|
|
|
2925
2876
|
</div>
|
|
2926
2877
|
`)}
|
|
2927
2878
|
</div>
|
|
2928
|
-
` :
|
|
2879
|
+
` : a;
|
|
2929
2880
|
}
|
|
2930
2881
|
_renderBodyContextMenu() {
|
|
2931
|
-
if (!this._bodyContextMenu) return
|
|
2932
|
-
let { colIndex: e, dataIndex: t, x:
|
|
2933
|
-
if (!o) return
|
|
2882
|
+
if (!this._bodyContextMenu) return a;
|
|
2883
|
+
let { colIndex: e, dataIndex: t, x: n, y: r } = this._bodyContextMenu, o = this.visibleColumns[e];
|
|
2884
|
+
if (!o) return a;
|
|
2934
2885
|
let s = this.data[t]?.[o.key], c = this._filters.some((e) => e.key === o.key), l = () => {
|
|
2935
2886
|
this._bodyContextMenu = null;
|
|
2936
|
-
}, u =
|
|
2937
|
-
return
|
|
2887
|
+
}, u = n + 200 > window.innerWidth ? n - 200 : n, d = r + 280 > window.innerHeight ? r - 280 : r;
|
|
2888
|
+
return i`
|
|
2938
2889
|
<div class="ft-body-context-menu" style="position: fixed; left: ${u}px; top: ${d}px; z-index: 200;"
|
|
2939
2890
|
@mousedown=${(e) => e.stopPropagation()}>
|
|
2940
2891
|
<div class="ft-context-menu-item"
|
|
@@ -2989,7 +2940,7 @@ var J = {
|
|
|
2989
2940
|
}}>
|
|
2990
2941
|
Filter by this value
|
|
2991
2942
|
</div>
|
|
2992
|
-
${c ?
|
|
2943
|
+
${c ? i`
|
|
2993
2944
|
<div class="ft-context-menu-item"
|
|
2994
2945
|
@click=${() => {
|
|
2995
2946
|
this.removeFilter(o.key), l();
|
|
@@ -3000,11 +2951,11 @@ var J = {
|
|
|
3000
2951
|
<div class="ft-context-menu-separator"></div>
|
|
3001
2952
|
<div class="ft-context-menu-item"
|
|
3002
2953
|
@click=${() => {
|
|
3003
|
-
this._openCommentPopup(t, o.key,
|
|
2954
|
+
this._openCommentPopup(t, o.key, n, r), l();
|
|
3004
2955
|
}}>
|
|
3005
2956
|
${this.getComment(t, o.key) ? "Edit Comment" : "Add Comment"}
|
|
3006
2957
|
</div>
|
|
3007
|
-
${this.getComment(t, o.key) ?
|
|
2958
|
+
${this.getComment(t, o.key) ? i`
|
|
3008
2959
|
<div class="ft-context-menu-item ft-context-menu-danger"
|
|
3009
2960
|
@click=${() => {
|
|
3010
2961
|
this.setComment(t, o.key, null), l();
|
|
@@ -3035,11 +2986,11 @@ var J = {
|
|
|
3035
2986
|
this._commentPopup &&= (document.removeEventListener("mousedown", this._onCommentPopupOutsideClick), null);
|
|
3036
2987
|
}
|
|
3037
2988
|
_renderCommentPopup() {
|
|
3038
|
-
if (!this._commentPopup) return
|
|
3039
|
-
let { x: e, y: t } = this._commentPopup,
|
|
3040
|
-
return
|
|
2989
|
+
if (!this._commentPopup) return a;
|
|
2990
|
+
let { x: e, y: t } = this._commentPopup, n = e + 240 > window.innerWidth ? e - 240 : e, r = t + 150 > window.innerHeight ? t - 150 : t;
|
|
2991
|
+
return i`
|
|
3041
2992
|
<div class="ft-comment-popup"
|
|
3042
|
-
style="position: fixed; left: ${
|
|
2993
|
+
style="position: fixed; left: ${n}px; top: ${r}px; z-index: 201;"
|
|
3043
2994
|
@mousedown=${(e) => e.stopPropagation()}>
|
|
3044
2995
|
<textarea class="ft-comment-popup-textarea"
|
|
3045
2996
|
rows="4"
|
|
@@ -3054,11 +3005,11 @@ var J = {
|
|
|
3054
3005
|
</div>
|
|
3055
3006
|
`;
|
|
3056
3007
|
}
|
|
3057
|
-
_applySortFromMenu(e,
|
|
3008
|
+
_applySortFromMenu(e, n) {
|
|
3058
3009
|
this.columns.find((t) => t.key === e) && (this._sortCriteria = [{
|
|
3059
3010
|
key: e,
|
|
3060
|
-
direction:
|
|
3061
|
-
}], this._sortedIndices =
|
|
3011
|
+
direction: n
|
|
3012
|
+
}], this._sortedIndices = t(this.data, this._sortCriteria, this.columns), this.dispatchEvent(new CustomEvent("sort-change", {
|
|
3062
3013
|
detail: { sortCriteria: [...this._sortCriteria] },
|
|
3063
3014
|
bubbles: !0,
|
|
3064
3015
|
composed: !0
|
|
@@ -3081,7 +3032,7 @@ var J = {
|
|
|
3081
3032
|
}
|
|
3082
3033
|
_renderFilterDropdown(e) {
|
|
3083
3034
|
let t = e.type ?? "text";
|
|
3084
|
-
return
|
|
3035
|
+
return i`
|
|
3085
3036
|
<div class="ft-filter-dropdown" @click=${(e) => e.stopPropagation()}>
|
|
3086
3037
|
${t === "boolean" ? this._renderBooleanFilter(e) : t === "number" ? this._renderNumberFilter(e) : t === "date" || t === "datetime" ? this._renderDateFilter(e) : this._renderTextFilter(e)}
|
|
3087
3038
|
<div class="ft-filter-actions">
|
|
@@ -3115,12 +3066,12 @@ var J = {
|
|
|
3115
3066
|
return e === "empty" ? (e) => e == null || e === "" : (e) => e != null && e !== "";
|
|
3116
3067
|
}
|
|
3117
3068
|
_renderEmptyFilterRow(e, t) {
|
|
3118
|
-
let
|
|
3119
|
-
return
|
|
3069
|
+
let n = this._emptyFilterState.get(e) ?? "";
|
|
3070
|
+
return i`
|
|
3120
3071
|
<div class="ft-filter-empty-row">
|
|
3121
3072
|
<label>Blank cells</label>
|
|
3122
3073
|
<select class="ft-filter-mode-select"
|
|
3123
|
-
.value=${
|
|
3074
|
+
.value=${n}
|
|
3124
3075
|
@change=${(n) => {
|
|
3125
3076
|
let r = n.target.value;
|
|
3126
3077
|
(r === "" || r === "empty" || r === "non-empty") && (r ? this._emptyFilterState.set(e, r) : this._emptyFilterState.delete(e), t?.(), this._applyFilterForKey(e));
|
|
@@ -3189,7 +3140,7 @@ var J = {
|
|
|
3189
3140
|
value: "",
|
|
3190
3141
|
mode: "contains"
|
|
3191
3142
|
};
|
|
3192
|
-
return
|
|
3143
|
+
return i`
|
|
3193
3144
|
<div class="ft-filter-mode-row">
|
|
3194
3145
|
<select class="ft-filter-mode-select"
|
|
3195
3146
|
.value=${t.mode}
|
|
@@ -3246,11 +3197,11 @@ var J = {
|
|
|
3246
3197
|
};
|
|
3247
3198
|
}
|
|
3248
3199
|
_renderNumCondRow(e, t) {
|
|
3249
|
-
let
|
|
3250
|
-
return
|
|
3200
|
+
let n = (this._numberFilterState.get(e) ?? this._defaultNumState())[t];
|
|
3201
|
+
return i`
|
|
3251
3202
|
<div class="ft-num-cond-row">
|
|
3252
3203
|
<select class="ft-filter-mode-select ft-num-op-select"
|
|
3253
|
-
.value=${
|
|
3204
|
+
.value=${n.op}
|
|
3254
3205
|
@change=${(n) => {
|
|
3255
3206
|
let r = n.target.value, i = this._numberFilterState.get(e) ?? this._defaultNumState();
|
|
3256
3207
|
i[t] = {
|
|
@@ -3261,10 +3212,10 @@ var J = {
|
|
|
3261
3212
|
@keydown=${(e) => {
|
|
3262
3213
|
e.key === "Escape" && (this._openFilterKey = null), e.stopPropagation();
|
|
3263
3214
|
}}>
|
|
3264
|
-
${Object.keys(J).map((e) =>
|
|
3215
|
+
${Object.keys(J).map((e) => i`<option value=${e}>${J[e]}</option>`)}
|
|
3265
3216
|
</select>
|
|
3266
3217
|
<input class="ft-filter-input ft-num-cond-input" type="number" placeholder="Value"
|
|
3267
|
-
.value=${
|
|
3218
|
+
.value=${n.value == null ? "" : String(n.value)}
|
|
3268
3219
|
@input=${(n) => {
|
|
3269
3220
|
let r = n.target.value, i = this._numberFilterState.get(e) ?? this._defaultNumState();
|
|
3270
3221
|
i[t] = {
|
|
@@ -3280,7 +3231,7 @@ var J = {
|
|
|
3280
3231
|
}
|
|
3281
3232
|
_renderNumberFilter(e) {
|
|
3282
3233
|
let t = this._numberFilterState.get(e.key) ?? this._defaultNumState();
|
|
3283
|
-
return
|
|
3234
|
+
return i`
|
|
3284
3235
|
${this._renderNumCondRow(e.key, "cond1")}
|
|
3285
3236
|
<div class="ft-filter-mode-row">
|
|
3286
3237
|
<select class="ft-filter-mode-select"
|
|
@@ -3321,17 +3272,17 @@ var J = {
|
|
|
3321
3272
|
return n ? n.error : null;
|
|
3322
3273
|
}
|
|
3323
3274
|
_renderDateFilter(e) {
|
|
3324
|
-
let t = e.type === "datetime" ? "datetime-local" : "date",
|
|
3325
|
-
return
|
|
3275
|
+
let t = e.type === "datetime" ? "datetime-local" : "date", n = this._dateFilterState.get(e.key) ?? {};
|
|
3276
|
+
return i`
|
|
3326
3277
|
<div class="ft-filter-range">
|
|
3327
3278
|
<input class="ft-filter-input" type=${t} placeholder="From"
|
|
3328
|
-
.value=${
|
|
3279
|
+
.value=${n.from ?? ""}
|
|
3329
3280
|
@input=${(t) => this._applyDateFilter(e.key, t, "from")}
|
|
3330
3281
|
@keydown=${(e) => {
|
|
3331
3282
|
e.key === "Escape" && (this._openFilterKey = null), e.stopPropagation();
|
|
3332
3283
|
}}>
|
|
3333
3284
|
<input class="ft-filter-input" type=${t} placeholder="To"
|
|
3334
|
-
.value=${
|
|
3285
|
+
.value=${n.to ?? ""}
|
|
3335
3286
|
@input=${(t) => this._applyDateFilter(e.key, t, "to")}
|
|
3336
3287
|
@keydown=${(e) => {
|
|
3337
3288
|
e.key === "Escape" && (this._openFilterKey = null), e.stopPropagation();
|
|
@@ -3347,7 +3298,7 @@ var J = {
|
|
|
3347
3298
|
r === "" ? delete i[n] : i[n] = r, this._dateFilterState.set(e, i), this._emptyFilterState.delete(e), this._applyFilterForKey(e);
|
|
3348
3299
|
}
|
|
3349
3300
|
_renderBooleanFilter(e) {
|
|
3350
|
-
return
|
|
3301
|
+
return i`
|
|
3351
3302
|
<select class="ft-filter-input"
|
|
3352
3303
|
@change=${(t) => {
|
|
3353
3304
|
let n = t.target.value;
|
|
@@ -3564,13 +3515,13 @@ var J = {
|
|
|
3564
3515
|
if (!e) return "";
|
|
3565
3516
|
let t = this.visibleColumns;
|
|
3566
3517
|
if (e.endCol >= t.length || e.endRow >= this._visibleRowCount) return "";
|
|
3567
|
-
let
|
|
3568
|
-
if (
|
|
3518
|
+
let n = (this._colLeftOffsets[e.endCol] ?? 0) + this._getColWidth(t[e.endCol]) - this._scrollLeft - 4, r = this.headerHeight + (e.endRow + 1) * this.rowHeight - this._scrollTop - 4;
|
|
3519
|
+
if (n < 0 || r < this.headerHeight) return "";
|
|
3569
3520
|
let a = this._fillDrag?.active && this._fillDrag.targetRange ? this._renderFillPreview(this._fillDrag.targetRange) : "";
|
|
3570
|
-
return
|
|
3521
|
+
return i`
|
|
3571
3522
|
${a}
|
|
3572
3523
|
<div class="ft-fill-handle"
|
|
3573
|
-
style="left:${
|
|
3524
|
+
style="left:${n}px;top:${r}px;"
|
|
3574
3525
|
@mousedown=${(e) => this._onFillHandleMouseDown(e)}>
|
|
3575
3526
|
</div>
|
|
3576
3527
|
`;
|
|
@@ -3578,8 +3529,8 @@ var J = {
|
|
|
3578
3529
|
_renderFillPreview(e) {
|
|
3579
3530
|
let t = this.visibleColumns;
|
|
3580
3531
|
if (e.endCol >= t.length || e.endRow >= this._visibleRowCount) return "";
|
|
3581
|
-
let
|
|
3582
|
-
return
|
|
3532
|
+
let n = (this._colLeftOffsets[e.startCol] ?? 0) - this._scrollLeft, r = this.headerHeight + e.startRow * this.rowHeight - this._scrollTop, a = (this._colLeftOffsets[e.endCol] ?? 0) + this._getColWidth(t[e.endCol]) - (this._colLeftOffsets[e.startCol] ?? 0), o = (e.endRow - e.startRow + 1) * this.rowHeight;
|
|
3533
|
+
return i`<div class="ft-fill-preview" style="left:${n}px;top:${r}px;width:${a}px;height:${o}px;"></div>`;
|
|
3583
3534
|
}
|
|
3584
3535
|
_onRowNumMouseDown(e, t) {
|
|
3585
3536
|
if (e.button !== 0) return;
|
|
@@ -3768,8 +3719,8 @@ var J = {
|
|
|
3768
3719
|
}
|
|
3769
3720
|
_renderFindPanel() {
|
|
3770
3721
|
if (!this._findState) return "";
|
|
3771
|
-
let { mode: e, query: t, replaceWith:
|
|
3772
|
-
return
|
|
3722
|
+
let { mode: e, query: t, replaceWith: n, matchCase: r, wholeCell: a, results: o, currentIndex: s } = this._findState, c = o.length, l = c > 0 ? s + 1 : 0;
|
|
3723
|
+
return i`
|
|
3773
3724
|
<div class="ft-find-panel"
|
|
3774
3725
|
@keydown=${(e) => {
|
|
3775
3726
|
if (e.stopPropagation(), e.key === "Escape") {
|
|
@@ -3787,7 +3738,7 @@ var J = {
|
|
|
3787
3738
|
<span class="ft-find-count">${c > 0 ? `${l}/${c}` : t ? "0 results" : ""}</span>
|
|
3788
3739
|
<button @click=${() => this._findPrev()} title="Previous (Shift+Enter)">◀</button>
|
|
3789
3740
|
<button @click=${() => this._findNext()} title="Next (Enter)">▶</button>
|
|
3790
|
-
<label title="Match case"><input type="checkbox" ?checked=${
|
|
3741
|
+
<label title="Match case"><input type="checkbox" ?checked=${r} @change=${(e) => {
|
|
3791
3742
|
this._findState.matchCase = e.target.checked, this._findSearch();
|
|
3792
3743
|
}}> Aa</label>
|
|
3793
3744
|
<label title="Whole cell"><input type="checkbox" ?checked=${a} @change=${(e) => {
|
|
@@ -3795,10 +3746,10 @@ var J = {
|
|
|
3795
3746
|
}}> [ ]</label>
|
|
3796
3747
|
<button @click=${() => this._closeFindPanel()} title="Close (Escape)">✕</button>
|
|
3797
3748
|
</div>
|
|
3798
|
-
${e === "replace" ?
|
|
3749
|
+
${e === "replace" ? i`
|
|
3799
3750
|
<div class="ft-find-row">
|
|
3800
3751
|
<input class="ft-find-replace-input" type="text" placeholder="Replace with..."
|
|
3801
|
-
.value=${
|
|
3752
|
+
.value=${n}
|
|
3802
3753
|
@input=${(e) => {
|
|
3803
3754
|
this._findState.replaceWith = e.target.value;
|
|
3804
3755
|
}}>
|
|
@@ -3810,13 +3761,13 @@ var J = {
|
|
|
3810
3761
|
`;
|
|
3811
3762
|
}
|
|
3812
3763
|
render() {
|
|
3813
|
-
let e = this.visibleColumns, t = this.importEnabled && this._isDragOver ?
|
|
3814
|
-
if (e.length === 0) return
|
|
3815
|
-
let
|
|
3764
|
+
let e = this.visibleColumns, t = this.importEnabled && this._isDragOver ? i`<div class="ft-import-overlay">Drop file to import (.xlsx / .csv)</div>` : a, n = this.loading ? i`<div class="ft-loading-overlay"></div>` : a;
|
|
3765
|
+
if (e.length === 0) return i`${t}${n}<div class="ft-empty">No columns defined</div>`;
|
|
3766
|
+
let r = this.headerHeight, o = this._totalRowWidth, { start: s, end: c } = this.visibleColRange, l = [];
|
|
3816
3767
|
for (let t = 0; t < e.length; t++) (e[t].pinned === "left" || e[t].pinned === "right") && (t < s || t >= c) && l.push(t);
|
|
3817
|
-
let u = 0, d = this._scrollLeft, f = this.selectable ?
|
|
3818
|
-
style="position: absolute; top: 0; left: ${d + u}px; width: 36px; height: ${
|
|
3819
|
-
${this._rowSelection.mode === "multi" ?
|
|
3768
|
+
let u = 0, d = this._scrollLeft, f = this.selectable ? i`<div class="ft-checkbox-header"
|
|
3769
|
+
style="position: absolute; top: 0; left: ${d + u}px; width: 36px; height: ${r}px; z-index: 4;">
|
|
3770
|
+
${this._rowSelection.mode === "multi" ? i`
|
|
3820
3771
|
<input type="checkbox"
|
|
3821
3772
|
.checked=${this._rowSelection.isAllSelected}
|
|
3822
3773
|
.indeterminate=${this._rowSelection.isSomeSelected}
|
|
@@ -3824,16 +3775,16 @@ var J = {
|
|
|
3824
3775
|
` : ""}
|
|
3825
3776
|
</div>` : "";
|
|
3826
3777
|
this.selectable && (u += 36);
|
|
3827
|
-
let p = this.showRowNumbers ?
|
|
3828
|
-
style="position: absolute; top: 0; left: ${d + u}px; width: 48px; height: ${
|
|
3778
|
+
let p = this.showRowNumbers ? i`<div class="ft-row-num-header"
|
|
3779
|
+
style="position: absolute; top: 0; left: ${d + u}px; width: 48px; height: ${r}px; z-index: 4;">#</div>` : "", m = [];
|
|
3829
3780
|
for (let t of l) m.push(this._renderHeaderCell(e[t], t));
|
|
3830
3781
|
for (let t = s; t < c; t++) m.push(this._renderHeaderCell(e[t], t));
|
|
3831
|
-
let h = this._colDragIndicatorLeft == null ? "" :
|
|
3782
|
+
let h = this._colDragIndicatorLeft == null ? "" : i`<div class="ft-drop-indicator" style="left:${this._colDragIndicatorLeft}px"></div>`;
|
|
3832
3783
|
if (this.data.length === 0 || this._visibleRowCount === 0) {
|
|
3833
3784
|
let e = this.data.length === 0 ? this.emptyMessage : this.noMatchingMessage;
|
|
3834
|
-
return
|
|
3835
|
-
${
|
|
3836
|
-
<div class="ft-header" role="row" style="width: ${o}px; height: ${
|
|
3785
|
+
return i`
|
|
3786
|
+
${n}
|
|
3787
|
+
<div class="ft-header" role="row" style="width: ${o}px; height: ${r}px;">
|
|
3837
3788
|
${f}${p}
|
|
3838
3789
|
${m}
|
|
3839
3790
|
${h}
|
|
@@ -3843,12 +3794,12 @@ var J = {
|
|
|
3843
3794
|
}
|
|
3844
3795
|
let { start: g, end: _ } = this.visibleRange, v = this._frozenRowCount, y = [];
|
|
3845
3796
|
for (let e = g; e < _; e++) y.push(this._renderRow(e, s, c, l, (e - v) * this.rowHeight));
|
|
3846
|
-
let b = this._renderFillHandle(), x = this._rowDragIndicatorY == null ? "" :
|
|
3847
|
-
return
|
|
3797
|
+
let b = this._renderFillHandle(), x = this._rowDragIndicatorY == null ? "" : i`<div class="ft-row-drop-indicator" style="top:${this._rowDragIndicatorY}px;width:${o + this._prefixWidth}px;"></div>`;
|
|
3798
|
+
return i`
|
|
3848
3799
|
${t}
|
|
3849
|
-
${
|
|
3800
|
+
${n}
|
|
3850
3801
|
${this._renderFindPanel()}
|
|
3851
|
-
<div class="ft-header" role="row" style="width: ${o}px; height: ${
|
|
3802
|
+
<div class="ft-header" role="row" style="width: ${o}px; height: ${r}px;">
|
|
3852
3803
|
${f}${p}
|
|
3853
3804
|
${m}
|
|
3854
3805
|
${h}
|
|
@@ -3874,47 +3825,47 @@ var J = {
|
|
|
3874
3825
|
_onRowCheckboxClick(e) {
|
|
3875
3826
|
this._checkboxShiftPending = e.shiftKey;
|
|
3876
3827
|
}
|
|
3877
|
-
_renderFrozenRows(e, t,
|
|
3878
|
-
let
|
|
3879
|
-
if (
|
|
3828
|
+
_renderFrozenRows(e, t, n) {
|
|
3829
|
+
let r = this._frozenRowCount;
|
|
3830
|
+
if (r === 0) return a;
|
|
3880
3831
|
let o = this._totalRowWidth, s = [];
|
|
3881
|
-
for (let
|
|
3882
|
-
return
|
|
3832
|
+
for (let i = 0; i < r; i++) s.push(this._renderRow(i, e, t, n, i * this.rowHeight));
|
|
3833
|
+
return i`
|
|
3883
3834
|
<div class="ft-frozen-rows" style="top: ${this.headerHeight}px; height: ${this.frozenRowsHeight}px; width: ${o}px;">
|
|
3884
3835
|
${s}
|
|
3885
3836
|
</div>
|
|
3886
3837
|
`;
|
|
3887
3838
|
}
|
|
3888
|
-
_renderFooter(e, t,
|
|
3839
|
+
_renderFooter(e, t, n) {
|
|
3889
3840
|
if (!this.footerData) return "";
|
|
3890
|
-
let
|
|
3841
|
+
let r = this.visibleColumns, a = this.rowHeight, o = this._totalRowWidth, s = this._scrollLeft, c = 0, l = this.selectable ? i`<div class="ft-footer-cell ft-checkbox-cell"
|
|
3891
3842
|
style="position: absolute; top: 0; left: ${s + c}px; width: 36px; height: ${a}px; z-index: 2;"></div>` : "";
|
|
3892
3843
|
this.selectable && (c += 36);
|
|
3893
|
-
let u = this.showRowNumbers ?
|
|
3844
|
+
let u = this.showRowNumbers ? i`<div class="ft-footer-cell ft-row-num"
|
|
3894
3845
|
style="position: absolute; top: 0; left: ${s + c}px; width: 48px; height: ${a}px; z-index: 2;"></div>` : "", d = [];
|
|
3895
|
-
for (let e of
|
|
3896
|
-
let t =
|
|
3897
|
-
d.push(
|
|
3846
|
+
for (let e of n) {
|
|
3847
|
+
let t = r[e], n = this._getColWidth(t), o = t.pinned === "right" ? `position: absolute; top: 0; right: ${-s + this._getPinnedRight(e)}px; width: ${n}px; height: ${a}px; z-index: 2;` : `position: absolute; top: 0; left: ${s + this._getPinnedLeft(e)}px; width: ${n}px; height: ${a}px; z-index: 2;`;
|
|
3848
|
+
d.push(i`
|
|
3898
3849
|
<div class="ft-footer-cell ft-pinned" style=${o}>
|
|
3899
3850
|
${this.footerData[t.key] ?? ""}</div>
|
|
3900
3851
|
`);
|
|
3901
3852
|
}
|
|
3902
|
-
for (let
|
|
3903
|
-
let e =
|
|
3904
|
-
f = c ? `position: absolute; top: 0; left: ${s + this._getPinnedLeft(
|
|
3853
|
+
for (let n = e; n < t; n++) {
|
|
3854
|
+
let e = r[n], t = this._getColWidth(e), o = this._colLeftOffsets[n] ?? 0, c = e.pinned === "left", l = e.pinned === "right", u = c || l, f;
|
|
3855
|
+
f = c ? `position: absolute; top: 0; left: ${s + this._getPinnedLeft(n)}px; width: ${t}px; height: ${a}px; z-index: 2;` : l ? `position: absolute; top: 0; right: ${-s + this._getPinnedRight(n)}px; width: ${t}px; height: ${a}px; z-index: 2;` : `left: ${o}px; width: ${t}px; height: ${a}px;`, d.push(i`
|
|
3905
3856
|
<div class="ft-footer-cell ${u ? "ft-pinned" : ""}" style=${f}>
|
|
3906
3857
|
${this.footerData[e.key] ?? ""}</div>
|
|
3907
3858
|
`);
|
|
3908
3859
|
}
|
|
3909
|
-
return
|
|
3860
|
+
return i`
|
|
3910
3861
|
<div class="ft-footer" role="row" style="width: ${o}px; height: ${a}px;">
|
|
3911
3862
|
${l}${u}
|
|
3912
3863
|
${d}
|
|
3913
3864
|
</div>
|
|
3914
3865
|
`;
|
|
3915
3866
|
}
|
|
3916
|
-
_renderRow(e, t,
|
|
3917
|
-
let o = this.visibleColumns, s = this._toDataIndex(e), c = this.data[s], l = a ?? e * this.rowHeight, u = this.rowHeight, d = this._totalRowWidth, f = e % 2 == 0 ? "ft-row-even" : "ft-row-odd", p = this.selectable && this._rowSelection.isSelected(e), m = this._scrollLeft, h = 0, g = this.selectable ?
|
|
3867
|
+
_renderRow(e, t, n, r, a) {
|
|
3868
|
+
let o = this.visibleColumns, s = this._toDataIndex(e), c = this.data[s], l = a ?? e * this.rowHeight, u = this.rowHeight, d = this._totalRowWidth, f = e % 2 == 0 ? "ft-row-even" : "ft-row-odd", p = this.selectable && this._rowSelection.isSelected(e), m = this._scrollLeft, h = 0, g = this.selectable ? i`
|
|
3918
3869
|
<div class="ft-checkbox-cell"
|
|
3919
3870
|
style="position: absolute; top: 0; left: ${m + h}px; width: 36px; height: ${u}px; z-index: 2;">
|
|
3920
3871
|
<input type="checkbox"
|
|
@@ -3924,15 +3875,15 @@ var J = {
|
|
|
3924
3875
|
</div>
|
|
3925
3876
|
` : "";
|
|
3926
3877
|
this.selectable && (h += 36);
|
|
3927
|
-
let _ = this._rowDrag?.active && this._rowDrag.rowIndex === e, v = this.showRowNumbers ?
|
|
3878
|
+
let _ = this._rowDrag?.active && this._rowDrag.rowIndex === e, v = this.showRowNumbers ? i`
|
|
3928
3879
|
<div class="ft-row-num ${_ ? "ft-col-dragging" : ""}"
|
|
3929
3880
|
style="position: absolute; top: 0; left: ${m + h}px; width: 48px; height: ${u}px; z-index: 2; cursor: grab;"
|
|
3930
3881
|
@mousedown=${(t) => this._onRowNumMouseDown(t, e)}
|
|
3931
3882
|
@click=${() => this._onRowNumberClick(e)}>${s + 1}</div>
|
|
3932
3883
|
` : "", y = [];
|
|
3933
|
-
for (let t of
|
|
3934
|
-
for (let
|
|
3935
|
-
return
|
|
3884
|
+
for (let t of r) y.push(this._renderCell(c, o[t], e, t));
|
|
3885
|
+
for (let r = t; r < n; r++) y.push(this._renderCell(c, o[r], e, r));
|
|
3886
|
+
return i`
|
|
3936
3887
|
<div class="ft-row ${f} ${p ? "ft-row-selected" : ""}" role="row"
|
|
3937
3888
|
style="top: ${l}px; height: ${u}px; width: ${d}px;">
|
|
3938
3889
|
${g}${v}
|
|
@@ -3940,9 +3891,9 @@ var J = {
|
|
|
3940
3891
|
</div>
|
|
3941
3892
|
`;
|
|
3942
3893
|
}
|
|
3943
|
-
_renderCell(e, t,
|
|
3944
|
-
let o = this._activeCell?.row ===
|
|
3945
|
-
g = l ? `position: absolute; top: 0; left: ${this._scrollLeft + this._getPinnedLeft(
|
|
3894
|
+
_renderCell(e, t, n, r) {
|
|
3895
|
+
let o = this._activeCell?.row === n && this._activeCell?.col === r, s = this._editingCell?.row === n && this._editingCell?.col === r, c = this._selection.isInRange(n, r), l = t.pinned === "left", u = t.pinned === "right", d = l || u, f = this._getColWidth(t), p = this.rowHeight, h = this._colLeftOffsets[r] ?? 0, g;
|
|
3896
|
+
g = l ? `position: absolute; top: 0; left: ${this._scrollLeft + this._getPinnedLeft(r)}px; width: ${f}px; height: ${p}px; z-index: 2;` : u ? `position: absolute; top: 0; right: ${-this._scrollLeft + this._getPinnedRight(r)}px; width: ${f}px; height: ${p}px; z-index: 2;` : `left: ${h}px; width: ${f}px; height: ${p}px;`;
|
|
3946
3897
|
let _ = !this._isCellEditable(t);
|
|
3947
3898
|
if (t.conditionalRules && t.conditionalRules.length > 0) {
|
|
3948
3899
|
let n = e[t.key], r = {};
|
|
@@ -3950,16 +3901,16 @@ var J = {
|
|
|
3950
3901
|
let i = Object.entries(r).map(([e, t]) => `${e}: ${t}`).join("; ");
|
|
3951
3902
|
i && (g += " " + i + ";");
|
|
3952
3903
|
}
|
|
3953
|
-
if (s) return
|
|
3904
|
+
if (s) return i`
|
|
3954
3905
|
<div class="ft-cell ft-editing ft-active ${d ? "ft-pinned" : ""}" role="gridcell"
|
|
3955
|
-
data-col-index=${
|
|
3906
|
+
data-col-index=${r}
|
|
3956
3907
|
aria-selected="true"
|
|
3957
|
-
aria-readonly=${_ ? "true" :
|
|
3908
|
+
aria-readonly=${_ ? "true" : a}
|
|
3958
3909
|
style=${g}>
|
|
3959
3910
|
${this._renderEditor(e, t)}
|
|
3960
3911
|
</div>
|
|
3961
3912
|
`;
|
|
3962
|
-
let v = o || c, y = this._isCellInvalid(
|
|
3913
|
+
let v = o || c, y = this._isCellInvalid(n, r), b = (this._findState?.results ?? []).findIndex((e) => e.row === n && e.col === r), x = b >= 0, S = x && b === this._findState.currentIndex, C = [
|
|
3963
3914
|
"ft-cell",
|
|
3964
3915
|
`ft-type-${t.type ?? "text"}`,
|
|
3965
3916
|
o ? "ft-active" : "",
|
|
@@ -3967,37 +3918,37 @@ var J = {
|
|
|
3967
3918
|
d ? "ft-pinned" : "",
|
|
3968
3919
|
y ? "ft-invalid" : "",
|
|
3969
3920
|
S ? "ft-find-current" : x ? "ft-find-match" : ""
|
|
3970
|
-
].filter(Boolean).join(" "), w = this._toDataIndex(
|
|
3971
|
-
return
|
|
3921
|
+
].filter(Boolean).join(" "), w = this._toDataIndex(n), T = this._comments.get(w)?.get(t.key) ?? null, E = T !== null, D = E ? i`<div class="ft-comment-indicator" title=${T}></div>` : a;
|
|
3922
|
+
return i`
|
|
3972
3923
|
<div class=${E ? C + " ft-has-comment" : C}
|
|
3973
3924
|
role="gridcell"
|
|
3974
|
-
data-col-index=${
|
|
3925
|
+
data-col-index=${r}
|
|
3975
3926
|
aria-selected=${v ? "true" : "false"}
|
|
3976
|
-
aria-readonly=${_ ? "true" :
|
|
3977
|
-
aria-invalid=${y ? "true" :
|
|
3978
|
-
title=${y ??
|
|
3927
|
+
aria-readonly=${_ ? "true" : a}
|
|
3928
|
+
aria-invalid=${y ? "true" : a}
|
|
3929
|
+
title=${y ?? a}
|
|
3979
3930
|
style=${g}
|
|
3980
|
-
@mousedown=${(e) => this._onCellMouseDown(e,
|
|
3981
|
-
@mouseenter=${() => this._onCellMouseEnter(
|
|
3982
|
-
@click=${(e) => this._onCellClickEvent(e,
|
|
3983
|
-
@dblclick=${() => this._onCellDblClick(
|
|
3931
|
+
@mousedown=${(e) => this._onCellMouseDown(e, n, r)}
|
|
3932
|
+
@mouseenter=${() => this._onCellMouseEnter(n, r)}
|
|
3933
|
+
@click=${(e) => this._onCellClickEvent(e, n, r)}
|
|
3934
|
+
@dblclick=${() => this._onCellDblClick(n, r)}>
|
|
3984
3935
|
${D}
|
|
3985
|
-
${
|
|
3936
|
+
${m(e[t.key], e, t)}
|
|
3986
3937
|
</div>
|
|
3987
3938
|
`;
|
|
3988
3939
|
}
|
|
3989
3940
|
_renderEditor(e, t) {
|
|
3990
3941
|
if (t.editor) return t.editor(e[t.key], e, t);
|
|
3991
|
-
let
|
|
3992
|
-
if (t.type === "number") return
|
|
3942
|
+
let n = e[t.key], r = n == null ? "" : String(n);
|
|
3943
|
+
if (t.type === "number") return i`
|
|
3993
3944
|
<input class="ft-editor ft-editor-number" type="number"
|
|
3994
|
-
.value=${
|
|
3945
|
+
.value=${r}
|
|
3995
3946
|
@keydown=${this._onEditorKeyDown}
|
|
3996
3947
|
@blur=${() => this._commitEdit()}>
|
|
3997
3948
|
`;
|
|
3998
3949
|
if (t.type === "date") {
|
|
3999
|
-
let e = this._toDateInputValue(
|
|
4000
|
-
return
|
|
3950
|
+
let e = this._toDateInputValue(n);
|
|
3951
|
+
return i`
|
|
4001
3952
|
<input class="ft-editor" type="date"
|
|
4002
3953
|
.value=${e}
|
|
4003
3954
|
@keydown=${this._onEditorKeyDown}
|
|
@@ -4005,8 +3956,8 @@ var J = {
|
|
|
4005
3956
|
`;
|
|
4006
3957
|
}
|
|
4007
3958
|
if (t.type === "datetime") {
|
|
4008
|
-
let e = this._toDateTimeInputValue(
|
|
4009
|
-
return
|
|
3959
|
+
let e = this._toDateTimeInputValue(n);
|
|
3960
|
+
return i`
|
|
4010
3961
|
<input class="ft-editor" type="datetime-local"
|
|
4011
3962
|
.value=${e}
|
|
4012
3963
|
@keydown=${this._onEditorKeyDown}
|
|
@@ -4015,27 +3966,27 @@ var J = {
|
|
|
4015
3966
|
}
|
|
4016
3967
|
if (t.type === "select" && t.options && t.options.length > 0) {
|
|
4017
3968
|
let e = t.options, r = typeof e[0] == "string";
|
|
4018
|
-
return
|
|
3969
|
+
return i`
|
|
4019
3970
|
<select class="ft-editor"
|
|
4020
3971
|
@keydown=${this._onEditorKeyDown}
|
|
4021
3972
|
@blur=${() => this._commitEdit()}
|
|
4022
3973
|
@change=${() => this._commitEdit()}>
|
|
4023
|
-
${r ? e.map((e) =>
|
|
3974
|
+
${r ? e.map((e) => i`<option value=${e} ?selected=${e === n}>${e}</option>`) : e.map((e) => i`<option value=${String(e.value)} ?selected=${e.value === n}>${e.label}</option>`)}
|
|
4024
3975
|
</select>
|
|
4025
3976
|
`;
|
|
4026
3977
|
}
|
|
4027
3978
|
if (t.autocomplete) {
|
|
4028
|
-
let e = this._autocompleteState?.candidates ?? [],
|
|
4029
|
-
return
|
|
3979
|
+
let e = this._autocompleteState?.candidates ?? [], n = this._autocompleteState?.activeIndex ?? -1;
|
|
3980
|
+
return i`
|
|
4030
3981
|
<input class="ft-editor" type="text"
|
|
4031
|
-
.value=${
|
|
3982
|
+
.value=${r}
|
|
4032
3983
|
@input=${(e) => this._onAutocompleteInput(e, t)}
|
|
4033
3984
|
@keydown=${this._onEditorKeyDown}
|
|
4034
3985
|
@blur=${() => this._commitEdit()}>
|
|
4035
|
-
${e.length > 0 ?
|
|
3986
|
+
${e.length > 0 ? i`
|
|
4036
3987
|
<div class="ft-autocomplete-dropdown">
|
|
4037
|
-
${e.map((e, t) =>
|
|
4038
|
-
<div class="ft-autocomplete-item ${t ===
|
|
3988
|
+
${e.map((e, t) => i`
|
|
3989
|
+
<div class="ft-autocomplete-item ${t === n ? "ft-autocomplete-active" : ""}"
|
|
4039
3990
|
@mousedown=${(t) => {
|
|
4040
3991
|
t.preventDefault(), this._selectAutocompleteCandidate(e);
|
|
4041
3992
|
}}>
|
|
@@ -4043,12 +3994,12 @@ var J = {
|
|
|
4043
3994
|
</div>
|
|
4044
3995
|
`)}
|
|
4045
3996
|
</div>
|
|
4046
|
-
` :
|
|
3997
|
+
` : a}
|
|
4047
3998
|
`;
|
|
4048
3999
|
}
|
|
4049
|
-
return
|
|
4000
|
+
return i`
|
|
4050
4001
|
<input class="ft-editor" type="text"
|
|
4051
|
-
.value=${
|
|
4002
|
+
.value=${r}
|
|
4052
4003
|
@keydown=${this._onEditorKeyDown}
|
|
4053
4004
|
@blur=${() => this._commitEdit()}>
|
|
4054
4005
|
`;
|
|
@@ -4064,60 +4015,60 @@ var J = {
|
|
|
4064
4015
|
return isNaN(t.getTime()) ? "" : `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}T${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
4065
4016
|
}
|
|
4066
4017
|
};
|
|
4067
|
-
q([
|
|
4018
|
+
q([s({ type: Array })], $.prototype, "columns", void 0), q([s({
|
|
4068
4019
|
type: Array,
|
|
4069
4020
|
hasChanged: () => !0
|
|
4070
|
-
})], $.prototype, "data", null), q([
|
|
4021
|
+
})], $.prototype, "data", null), q([s({
|
|
4071
4022
|
type: Boolean,
|
|
4072
4023
|
attribute: "clear-undo-on-data-change"
|
|
4073
|
-
})], $.prototype, "clearUndoOnDataChange", void 0), q([
|
|
4024
|
+
})], $.prototype, "clearUndoOnDataChange", void 0), q([s({
|
|
4074
4025
|
type: Boolean,
|
|
4075
4026
|
attribute: "clear-selection-on-data-change"
|
|
4076
|
-
})], $.prototype, "clearSelectionOnDataChange", void 0), q([
|
|
4027
|
+
})], $.prototype, "clearSelectionOnDataChange", void 0), q([s({
|
|
4077
4028
|
type: Number,
|
|
4078
4029
|
attribute: "row-height"
|
|
4079
|
-
})], $.prototype, "rowHeight", null), q([
|
|
4030
|
+
})], $.prototype, "rowHeight", null), q([s({
|
|
4080
4031
|
type: Boolean,
|
|
4081
4032
|
attribute: "show-row-numbers"
|
|
4082
|
-
})], $.prototype, "showRowNumbers", void 0), q([
|
|
4033
|
+
})], $.prototype, "showRowNumbers", void 0), q([s({
|
|
4083
4034
|
type: String,
|
|
4084
4035
|
reflect: !0
|
|
4085
|
-
})], $.prototype, "theme", void 0), q([
|
|
4036
|
+
})], $.prototype, "theme", void 0), q([s({
|
|
4086
4037
|
type: Number,
|
|
4087
4038
|
attribute: "max-rows"
|
|
4088
|
-
})], $.prototype, "maxRows", void 0), q([
|
|
4039
|
+
})], $.prototype, "maxRows", void 0), q([s({ type: Boolean })], $.prototype, "editable", void 0), q([s({
|
|
4089
4040
|
type: Boolean,
|
|
4090
4041
|
attribute: "show-filters"
|
|
4091
|
-
})], $.prototype, "showFilters", void 0), q([
|
|
4042
|
+
})], $.prototype, "showFilters", void 0), q([s({
|
|
4092
4043
|
type: Boolean,
|
|
4093
4044
|
attribute: "show-context-menu"
|
|
4094
|
-
})], $.prototype, "showContextMenu", void 0), q([
|
|
4045
|
+
})], $.prototype, "showContextMenu", void 0), q([s({
|
|
4095
4046
|
type: Number,
|
|
4096
4047
|
attribute: "frozen-rows"
|
|
4097
|
-
})], $.prototype, "frozenRows", void 0), q([
|
|
4048
|
+
})], $.prototype, "frozenRows", void 0), q([s({
|
|
4098
4049
|
type: String,
|
|
4099
4050
|
attribute: "empty-message"
|
|
4100
|
-
})], $.prototype, "emptyMessage", void 0), q([
|
|
4051
|
+
})], $.prototype, "emptyMessage", void 0), q([s({
|
|
4101
4052
|
type: String,
|
|
4102
4053
|
attribute: "no-matching-message"
|
|
4103
|
-
})], $.prototype, "noMatchingMessage", void 0), q([
|
|
4054
|
+
})], $.prototype, "noMatchingMessage", void 0), q([s({
|
|
4104
4055
|
type: Boolean,
|
|
4105
4056
|
reflect: !0
|
|
4106
|
-
})], $.prototype, "loading", void 0), q([
|
|
4057
|
+
})], $.prototype, "loading", void 0), q([s({
|
|
4107
4058
|
type: Boolean,
|
|
4108
4059
|
attribute: "import-enabled"
|
|
4109
|
-
})], $.prototype, "importEnabled", void 0), q([
|
|
4060
|
+
})], $.prototype, "importEnabled", void 0), q([s({ type: Boolean })], $.prototype, "selectable", void 0), q([s({
|
|
4110
4061
|
type: String,
|
|
4111
4062
|
attribute: "selection-mode"
|
|
4112
|
-
})], $.prototype, "selectionMode", null), q([
|
|
4063
|
+
})], $.prototype, "selectionMode", null), q([s({
|
|
4113
4064
|
type: String,
|
|
4114
4065
|
attribute: "data-mode"
|
|
4115
|
-
})], $.prototype, "dataMode", void 0), q([
|
|
4066
|
+
})], $.prototype, "dataMode", void 0), q([s({
|
|
4116
4067
|
type: Object,
|
|
4117
4068
|
attribute: "footer-data"
|
|
4118
|
-
})], $.prototype, "footerData", void 0), q([
|
|
4069
|
+
})], $.prototype, "footerData", void 0), q([s({ attribute: !1 })], $.prototype, "stylesheets", void 0), q([s({
|
|
4119
4070
|
type: Number,
|
|
4120
4071
|
attribute: "max-undo-size"
|
|
4121
|
-
})], $.prototype, "maxUndoSize", null), q([
|
|
4072
|
+
})], $.prototype, "maxUndoSize", null), q([c()], $.prototype, "_scrollTop", void 0), q([c()], $.prototype, "_scrollLeft", void 0), q([c()], $.prototype, "_viewportHeight", void 0), q([c()], $.prototype, "_viewportWidth", void 0), q([c()], $.prototype, "_activeCell", void 0), q([c()], $.prototype, "_editingCell", void 0), q([c()], $.prototype, "_sortCriteria", void 0), q([c()], $.prototype, "_openFilterKey", void 0), q([c()], $.prototype, "_rowSelectionVersion", void 0), q([c()], $.prototype, "_autocompleteState", void 0), q([c()], $.prototype, "_headerMenu", void 0), q([c()], $.prototype, "_bodyContextMenu", void 0), q([c()], $.prototype, "_commentPopup", void 0), q([c()], $.prototype, "_isDragOver", void 0), $ = q([o("flex-table")], $);
|
|
4122
4073
|
//#endregion
|
|
4123
|
-
export {
|
|
4074
|
+
export { m as a, C as i, L as n, E as r, $ as t };
|