@gridsheet/preact-core 2.0.5-0 → 2.1.0
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/components/Cell.d.ts +1 -2
- package/dist/components/CellStateOverlay.d.ts +8 -0
- package/dist/index.js +411 -273
- package/dist/index.js.map +1 -1
- package/dist/lib/table.d.ts +5 -6
- package/dist/styles/minified.d.ts +2 -2
- package/dist/types.d.ts +4 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -506,21 +506,17 @@ const isXSheetFocused = (store) => {
|
|
|
506
506
|
};
|
|
507
507
|
const getCellRectPositions = (table, { y, x }) => {
|
|
508
508
|
var _a, _b;
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
width += table.headerWidth;
|
|
516
|
-
height += table.headerHeight;
|
|
517
|
-
const w = ((_a = table.getCellByPoint({ y: 0, x }, "SYSTEM")) == null ? void 0 : _a.width) || DEFAULT_WIDTH;
|
|
518
|
-
const h2 = ((_b = table.getCellByPoint({ y, x: 0 }, "SYSTEM")) == null ? void 0 : _b.height) || DEFAULT_HEIGHT;
|
|
509
|
+
const colCell = table.getCellByPoint({ y: 0, x }, "SYSTEM");
|
|
510
|
+
const rowCell = table.getCellByPoint({ y, x: 0 }, "SYSTEM");
|
|
511
|
+
const left = ((_a = colCell == null ? void 0 : colCell.system) == null ? void 0 : _a.offsetLeft) ?? 0;
|
|
512
|
+
const top = ((_b = rowCell == null ? void 0 : rowCell.system) == null ? void 0 : _b.offsetTop) ?? 0;
|
|
513
|
+
const w = (colCell == null ? void 0 : colCell.width) || DEFAULT_WIDTH;
|
|
514
|
+
const h2 = (rowCell == null ? void 0 : rowCell.height) || DEFAULT_HEIGHT;
|
|
519
515
|
return {
|
|
520
|
-
top
|
|
521
|
-
left
|
|
522
|
-
bottom:
|
|
523
|
-
right:
|
|
516
|
+
top,
|
|
517
|
+
left,
|
|
518
|
+
bottom: top + h2,
|
|
519
|
+
right: left + w,
|
|
524
520
|
width: w,
|
|
525
521
|
height: h2
|
|
526
522
|
};
|
|
@@ -3193,7 +3189,6 @@ class InsertRowsAboveAction extends CoreAction {
|
|
|
3193
3189
|
});
|
|
3194
3190
|
return {
|
|
3195
3191
|
...store,
|
|
3196
|
-
...table.getTotalSize(),
|
|
3197
3192
|
tableReactive: { current: table }
|
|
3198
3193
|
};
|
|
3199
3194
|
}
|
|
@@ -3231,7 +3226,6 @@ class InsertRowsBelowAction extends CoreAction {
|
|
|
3231
3226
|
});
|
|
3232
3227
|
return {
|
|
3233
3228
|
...store,
|
|
3234
|
-
...table.getTotalSize(),
|
|
3235
3229
|
selectingZone: nextSelectingZone,
|
|
3236
3230
|
choosing: nextChoosing,
|
|
3237
3231
|
tableReactive: { current: table }
|
|
@@ -3265,7 +3259,6 @@ class InsertColsLeftAction extends CoreAction {
|
|
|
3265
3259
|
});
|
|
3266
3260
|
return {
|
|
3267
3261
|
...store,
|
|
3268
|
-
...table.getTotalSize(),
|
|
3269
3262
|
tableReactive: { current: table }
|
|
3270
3263
|
};
|
|
3271
3264
|
}
|
|
@@ -3305,7 +3298,6 @@ class InsertColsRightAction extends CoreAction {
|
|
|
3305
3298
|
});
|
|
3306
3299
|
return {
|
|
3307
3300
|
...store,
|
|
3308
|
-
...table.getTotalSize(),
|
|
3309
3301
|
selectingZone: nextSelectingZone,
|
|
3310
3302
|
choosing: nextChoosing,
|
|
3311
3303
|
tableReactive: { current: table }
|
|
@@ -3339,7 +3331,6 @@ class RemoveRowsAction extends CoreAction {
|
|
|
3339
3331
|
});
|
|
3340
3332
|
return {
|
|
3341
3333
|
...store,
|
|
3342
|
-
...table.getTotalSize(),
|
|
3343
3334
|
tableReactive: { current: table }
|
|
3344
3335
|
};
|
|
3345
3336
|
}
|
|
@@ -3371,7 +3362,6 @@ class RemoveColsAction extends CoreAction {
|
|
|
3371
3362
|
});
|
|
3372
3363
|
return {
|
|
3373
3364
|
...store,
|
|
3374
|
-
...table.getTotalSize(),
|
|
3375
3365
|
tableReactive: { current: table }
|
|
3376
3366
|
};
|
|
3377
3367
|
}
|
|
@@ -4653,8 +4643,7 @@ const Resizer = () => {
|
|
|
4653
4643
|
});
|
|
4654
4644
|
dispatch(
|
|
4655
4645
|
setStore({
|
|
4656
|
-
tableReactive: { current: table }
|
|
4657
|
-
...table.getTotalSize()
|
|
4646
|
+
tableReactive: { current: table }
|
|
4658
4647
|
})
|
|
4659
4648
|
);
|
|
4660
4649
|
dispatch(setResizingPositionY([-1, -1, -1]));
|
|
@@ -7718,6 +7707,8 @@ class Table {
|
|
|
7718
7707
|
this.prevSheetName = "";
|
|
7719
7708
|
this.status = 0;
|
|
7720
7709
|
this.idsToBeIdentified = [];
|
|
7710
|
+
this.totalWidth = 0;
|
|
7711
|
+
this.totalHeight = 0;
|
|
7721
7712
|
this.version = 0;
|
|
7722
7713
|
this.area = { top: 0, left: 0, bottom: 0, right: 0 };
|
|
7723
7714
|
this.addressCaches = /* @__PURE__ */ new Map();
|
|
@@ -7894,42 +7885,63 @@ class Table {
|
|
|
7894
7885
|
return (this.wire.cellHead++).toString(36);
|
|
7895
7886
|
}
|
|
7896
7887
|
getRectSize({ top, left, bottom, right }) {
|
|
7897
|
-
var _a, _b;
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
}
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7888
|
+
var _a, _b, _c, _d;
|
|
7889
|
+
const l = left || 1;
|
|
7890
|
+
const t = top || 1;
|
|
7891
|
+
const colRightCell = this.getCellByPoint({ y: 0, x: right }, "SYSTEM");
|
|
7892
|
+
const colLeftCell = this.getCellByPoint({ y: 0, x: l }, "SYSTEM");
|
|
7893
|
+
const rowBottomCell = this.getCellByPoint({ y: bottom, x: 0 }, "SYSTEM");
|
|
7894
|
+
const rowTopCell = this.getCellByPoint({ y: t, x: 0 }, "SYSTEM");
|
|
7895
|
+
const rw = ((_a = colRightCell == null ? void 0 : colRightCell.system) == null ? void 0 : _a.offsetLeft) ?? 0;
|
|
7896
|
+
const lw = ((_b = colLeftCell == null ? void 0 : colLeftCell.system) == null ? void 0 : _b.offsetLeft) ?? 0;
|
|
7897
|
+
const rh = ((_c = rowBottomCell == null ? void 0 : rowBottomCell.system) == null ? void 0 : _c.offsetTop) ?? 0;
|
|
7898
|
+
const th = ((_d = rowTopCell == null ? void 0 : rowTopCell.system) == null ? void 0 : _d.offsetTop) ?? 0;
|
|
7899
|
+
const width = Math.max(0, rw - lw);
|
|
7900
|
+
const height = Math.max(0, rh - th);
|
|
7905
7901
|
return { width, height };
|
|
7906
7902
|
}
|
|
7907
|
-
|
|
7908
|
-
const
|
|
7909
|
-
const
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7903
|
+
setTotalSize() {
|
|
7904
|
+
const numCols = this.getNumCols();
|
|
7905
|
+
const numRows = this.getNumRows();
|
|
7906
|
+
const headerW = this.headerWidth;
|
|
7907
|
+
const headerH = this.headerHeight;
|
|
7908
|
+
let accW = 0;
|
|
7909
|
+
for (let x = 1; x <= numCols; x++) {
|
|
7910
|
+
const cell = this.getCellByPoint({ y: 0, x }, "SYSTEM");
|
|
7911
|
+
const w = (cell == null ? void 0 : cell.width) || DEFAULT_WIDTH;
|
|
7912
|
+
if (cell == null ? void 0 : cell.system) {
|
|
7913
|
+
cell.system.offsetLeft = headerW + accW;
|
|
7914
|
+
}
|
|
7915
|
+
accW += w;
|
|
7916
|
+
}
|
|
7917
|
+
this.totalWidth = headerW + accW;
|
|
7918
|
+
let accH = 0;
|
|
7919
|
+
for (let y = 1; y <= numRows; y++) {
|
|
7920
|
+
const cell = this.getCellByPoint({ y, x: 0 }, "SYSTEM");
|
|
7921
|
+
const h2 = (cell == null ? void 0 : cell.height) || DEFAULT_HEIGHT;
|
|
7922
|
+
if (cell == null ? void 0 : cell.system) {
|
|
7923
|
+
cell.system.offsetTop = headerH + accH;
|
|
7924
|
+
}
|
|
7925
|
+
accH += h2;
|
|
7926
|
+
}
|
|
7927
|
+
this.totalHeight = headerH + accH;
|
|
7928
|
+
}
|
|
7929
|
+
refresh(relocate = false, resize = false) {
|
|
7921
7930
|
this.incrementVersion();
|
|
7922
7931
|
this.lastChangedAt = this.changedAt;
|
|
7923
7932
|
this.changedAt = /* @__PURE__ */ new Date();
|
|
7924
7933
|
this.clearSolvedCaches();
|
|
7925
|
-
if (
|
|
7934
|
+
if (relocate) {
|
|
7926
7935
|
this.addressCaches.clear();
|
|
7927
7936
|
}
|
|
7937
|
+
if (resize) {
|
|
7938
|
+
this.setTotalSize();
|
|
7939
|
+
}
|
|
7928
7940
|
return this;
|
|
7929
7941
|
}
|
|
7930
|
-
clone(
|
|
7942
|
+
clone(relocate = false) {
|
|
7931
7943
|
const copied = Object.assign(Object.create(Object.getPrototypeOf(this)), this);
|
|
7932
|
-
return copied.refresh(
|
|
7944
|
+
return copied.refresh(relocate);
|
|
7933
7945
|
}
|
|
7934
7946
|
getPointById(id, slideY = 0, slideX = 0) {
|
|
7935
7947
|
const absCol = id.startsWith("$");
|
|
@@ -8447,7 +8459,7 @@ class Table {
|
|
|
8447
8459
|
this.wire.onEdit({ table: srcTable.__raw__.trim(src) });
|
|
8448
8460
|
this.wire.onEdit({ table: this.__raw__.trim(dst) });
|
|
8449
8461
|
}
|
|
8450
|
-
return this.refresh(
|
|
8462
|
+
return this.refresh(true);
|
|
8451
8463
|
}
|
|
8452
8464
|
copy({
|
|
8453
8465
|
srcTable = this,
|
|
@@ -8533,15 +8545,16 @@ class Table {
|
|
|
8533
8545
|
const diffBefore = {};
|
|
8534
8546
|
const diffAfter = {};
|
|
8535
8547
|
const changedAt = /* @__PURE__ */ new Date();
|
|
8548
|
+
let resized = false;
|
|
8536
8549
|
Object.keys(diff).forEach((address) => {
|
|
8537
8550
|
var _a, _b, _c, _d;
|
|
8538
8551
|
const point = a2p(address);
|
|
8539
8552
|
const id = this.getId(point);
|
|
8540
8553
|
const original = this.wire.data[id];
|
|
8541
|
-
let patch = { ...diff[address] };
|
|
8542
8554
|
if (operator === "USER" && hasOperation(original.prevention, Update)) {
|
|
8543
8555
|
return;
|
|
8544
8556
|
}
|
|
8557
|
+
let patch = { ...diff[address] };
|
|
8545
8558
|
if (formulaIdentify) {
|
|
8546
8559
|
patch.value = identifyFormula(patch.value, {
|
|
8547
8560
|
table: this,
|
|
@@ -8571,6 +8584,9 @@ class Table {
|
|
|
8571
8584
|
if (updateChangedAt) {
|
|
8572
8585
|
this.setChangedAt(patch, changedAt);
|
|
8573
8586
|
}
|
|
8587
|
+
if (patch.width != null || patch.height != null) {
|
|
8588
|
+
resized = true;
|
|
8589
|
+
}
|
|
8574
8590
|
diffBefore[id] = { ...original };
|
|
8575
8591
|
const policy = this.policies[original.policy] ?? defaultPolicy;
|
|
8576
8592
|
const p = policy.restrict({
|
|
@@ -8593,7 +8609,8 @@ class Table {
|
|
|
8593
8609
|
}
|
|
8594
8610
|
return {
|
|
8595
8611
|
diffBefore,
|
|
8596
|
-
diffAfter
|
|
8612
|
+
diffAfter,
|
|
8613
|
+
resized
|
|
8597
8614
|
};
|
|
8598
8615
|
}
|
|
8599
8616
|
update({
|
|
@@ -8606,7 +8623,7 @@ class Table {
|
|
|
8606
8623
|
undoReflection,
|
|
8607
8624
|
redoReflection
|
|
8608
8625
|
}) {
|
|
8609
|
-
const { diffBefore, diffAfter } = this._update({
|
|
8626
|
+
const { diffBefore, diffAfter, resized } = this._update({
|
|
8610
8627
|
diff,
|
|
8611
8628
|
partial,
|
|
8612
8629
|
operator,
|
|
@@ -8626,7 +8643,7 @@ class Table {
|
|
|
8626
8643
|
partial
|
|
8627
8644
|
});
|
|
8628
8645
|
}
|
|
8629
|
-
return this.refresh(
|
|
8646
|
+
return this.refresh(false, resized);
|
|
8630
8647
|
}
|
|
8631
8648
|
writeRawCellMatrix({
|
|
8632
8649
|
point,
|
|
@@ -8756,7 +8773,7 @@ class Table {
|
|
|
8756
8773
|
cloned.addressCaches = /* @__PURE__ */ new Map();
|
|
8757
8774
|
this.wire.onInsertRows({ table: cloned, y, numRows });
|
|
8758
8775
|
}
|
|
8759
|
-
return this.refresh(
|
|
8776
|
+
return this.refresh(true, true);
|
|
8760
8777
|
}
|
|
8761
8778
|
removeRows({
|
|
8762
8779
|
y,
|
|
@@ -8818,7 +8835,7 @@ class Table {
|
|
|
8818
8835
|
cloned.addressCaches = /* @__PURE__ */ new Map();
|
|
8819
8836
|
this.wire.onRemoveRows({ table: cloned, ys: ys.reverse() });
|
|
8820
8837
|
}
|
|
8821
|
-
return this.refresh(
|
|
8838
|
+
return this.refresh(true, true);
|
|
8822
8839
|
}
|
|
8823
8840
|
insertCols({
|
|
8824
8841
|
x,
|
|
@@ -8884,7 +8901,7 @@ class Table {
|
|
|
8884
8901
|
cloned.addressCaches = /* @__PURE__ */ new Map();
|
|
8885
8902
|
this.wire.onInsertCols({ table: cloned, x, numCols });
|
|
8886
8903
|
}
|
|
8887
|
-
return this.refresh(
|
|
8904
|
+
return this.refresh(true, true);
|
|
8888
8905
|
}
|
|
8889
8906
|
removeCols({
|
|
8890
8907
|
x,
|
|
@@ -8949,7 +8966,7 @@ class Table {
|
|
|
8949
8966
|
cloned.addressCaches = /* @__PURE__ */ new Map();
|
|
8950
8967
|
this.wire.onRemoveCols({ table: cloned, xs: xs.reverse() });
|
|
8951
8968
|
}
|
|
8952
|
-
return this.refresh(
|
|
8969
|
+
return this.refresh(true, true);
|
|
8953
8970
|
}
|
|
8954
8971
|
getHistories() {
|
|
8955
8972
|
return [...this.wire.histories];
|
|
@@ -9109,7 +9126,7 @@ class Table {
|
|
|
9109
9126
|
break;
|
|
9110
9127
|
}
|
|
9111
9128
|
}
|
|
9112
|
-
this.refresh(
|
|
9129
|
+
this.refresh(shouldTracking(history.operation), true);
|
|
9113
9130
|
return {
|
|
9114
9131
|
history,
|
|
9115
9132
|
callback: ({ tableReactive: tableRef }) => {
|
|
@@ -9181,7 +9198,7 @@ class Table {
|
|
|
9181
9198
|
}
|
|
9182
9199
|
}
|
|
9183
9200
|
}
|
|
9184
|
-
this.refresh(
|
|
9201
|
+
this.refresh(shouldTracking(history.operation), true);
|
|
9185
9202
|
return {
|
|
9186
9203
|
history,
|
|
9187
9204
|
callback: ({ tableReactive: tableRef }) => {
|
|
@@ -9263,7 +9280,7 @@ const safePreventDefault = (e) => {
|
|
|
9263
9280
|
e.preventDefault();
|
|
9264
9281
|
}
|
|
9265
9282
|
};
|
|
9266
|
-
const Cell = memo(({ y, x
|
|
9283
|
+
const Cell = memo(({ y, x }) => {
|
|
9267
9284
|
const rowId = y2r(y);
|
|
9268
9285
|
const colId = x2c(x);
|
|
9269
9286
|
const address = `${colId}${rowId}`;
|
|
@@ -9499,8 +9516,7 @@ const Cell = memo(({ y, x, operationStyle }) => {
|
|
|
9499
9516
|
"data-address": address,
|
|
9500
9517
|
className: `gs-cell ${among(selectingArea, { y, x }) ? "gs-selecting" : ""} ${pointed ? "gs-choosing" : ""} ${editing ? "gs-editing" : ""}`,
|
|
9501
9518
|
style: {
|
|
9502
|
-
...cell == null ? void 0 : cell.style
|
|
9503
|
-
...operationStyle
|
|
9519
|
+
...cell == null ? void 0 : cell.style
|
|
9504
9520
|
},
|
|
9505
9521
|
onContextMenu,
|
|
9506
9522
|
onDoubleClick,
|
|
@@ -10076,6 +10092,260 @@ const HeaderCellLeft = memo(({ y }) => {
|
|
|
10076
10092
|
}
|
|
10077
10093
|
);
|
|
10078
10094
|
});
|
|
10095
|
+
const COLOR_POINTED = "#0077ff";
|
|
10096
|
+
const COLOR_SELECTED = "#0077ff";
|
|
10097
|
+
const SELECTING_FILL = "rgba(0, 128, 255, 0.2)";
|
|
10098
|
+
const COLOR_COPYING = "#0077ff";
|
|
10099
|
+
const COLOR_CUTTING = "#0077ff";
|
|
10100
|
+
const SEARCH_MATCHING_BACKGROUND = "rgba(0, 200, 100, 0.2)";
|
|
10101
|
+
const COLOR_SEARCH_MATCHING = "#00aa78";
|
|
10102
|
+
const COLOR_AUTOFILL = "#444444";
|
|
10103
|
+
const HEADER_COLORS = {
|
|
10104
|
+
light: {
|
|
10105
|
+
selecting: "rgba(0, 0, 0, 0.1)",
|
|
10106
|
+
choosing: "rgba(0, 0, 0, 0.2)",
|
|
10107
|
+
thSelecting: "rgba(0, 0, 0, 0.55)"
|
|
10108
|
+
},
|
|
10109
|
+
dark: {
|
|
10110
|
+
selecting: "rgba(255, 255, 255, 0.08)",
|
|
10111
|
+
choosing: "rgba(255, 255, 255, 0.18)",
|
|
10112
|
+
thSelecting: "rgba(255, 255, 255, 0.4)"
|
|
10113
|
+
}
|
|
10114
|
+
};
|
|
10115
|
+
const fillRect = (ctx, x, y, width, height, color) => {
|
|
10116
|
+
ctx.fillStyle = color;
|
|
10117
|
+
ctx.fillRect(x, y, width, height);
|
|
10118
|
+
};
|
|
10119
|
+
const drawRect = (ctx, x, y, width, height, color, lineWidth = 2, dashPattern = [], fillColor) => {
|
|
10120
|
+
if (fillColor) {
|
|
10121
|
+
ctx.fillStyle = fillColor;
|
|
10122
|
+
ctx.fillRect(x, y, width, height);
|
|
10123
|
+
}
|
|
10124
|
+
ctx.strokeStyle = color;
|
|
10125
|
+
ctx.lineWidth = lineWidth;
|
|
10126
|
+
ctx.setLineDash(dashPattern);
|
|
10127
|
+
ctx.strokeRect(x + lineWidth / 2, y + lineWidth / 2, width - lineWidth, height - lineWidth);
|
|
10128
|
+
ctx.setLineDash([]);
|
|
10129
|
+
};
|
|
10130
|
+
const drawAreaRectViewport = (ctx, table, scrollTop, scrollLeft, viewW, viewH, area, color, lineWidth = 2, dashPattern = [], fillColor) => {
|
|
10131
|
+
const { top, left, bottom, right } = area;
|
|
10132
|
+
if (top === -1 || left === -1 || bottom === -1 || right === -1) {
|
|
10133
|
+
return;
|
|
10134
|
+
}
|
|
10135
|
+
const topLeft = getCellRectPositions(table, { y: top, x: left });
|
|
10136
|
+
const bottomRight = getCellRectPositions(table, { y: bottom, x: right });
|
|
10137
|
+
const x1 = topLeft.left - scrollLeft;
|
|
10138
|
+
const y1 = topLeft.top - scrollTop;
|
|
10139
|
+
const x2 = bottomRight.right - scrollLeft;
|
|
10140
|
+
const y2 = bottomRight.bottom - scrollTop;
|
|
10141
|
+
if (x2 < 0 || x1 > viewW || y2 < 0 || y1 > viewH) {
|
|
10142
|
+
return;
|
|
10143
|
+
}
|
|
10144
|
+
drawRect(ctx, x1, y1, x2 - x1, y2 - y1, color, lineWidth, dashPattern, fillColor);
|
|
10145
|
+
};
|
|
10146
|
+
const CellStateOverlay = ({ refs = {} }) => {
|
|
10147
|
+
const { store } = useContext(Context);
|
|
10148
|
+
const {
|
|
10149
|
+
tableReactive,
|
|
10150
|
+
tabularRef,
|
|
10151
|
+
choosing,
|
|
10152
|
+
selectingZone,
|
|
10153
|
+
matchingCells,
|
|
10154
|
+
matchingCellIndex,
|
|
10155
|
+
autofillDraggingTo,
|
|
10156
|
+
topHeaderSelecting,
|
|
10157
|
+
leftHeaderSelecting,
|
|
10158
|
+
mode,
|
|
10159
|
+
dragging
|
|
10160
|
+
} = store;
|
|
10161
|
+
const table = tableReactive.current;
|
|
10162
|
+
const canvasRef = useRef(null);
|
|
10163
|
+
const rafIdRef = useRef(0);
|
|
10164
|
+
const storeRef = useRef(store);
|
|
10165
|
+
storeRef.current = store;
|
|
10166
|
+
const drawCanvas = useCallback(() => {
|
|
10167
|
+
if (!table || !tabularRef.current || !canvasRef.current) {
|
|
10168
|
+
return;
|
|
10169
|
+
}
|
|
10170
|
+
const canvas = canvasRef.current;
|
|
10171
|
+
const ctx = canvas.getContext("2d");
|
|
10172
|
+
if (!ctx) {
|
|
10173
|
+
return;
|
|
10174
|
+
}
|
|
10175
|
+
const container = tabularRef.current;
|
|
10176
|
+
const dpr = window.devicePixelRatio || 1;
|
|
10177
|
+
const w = container.clientWidth;
|
|
10178
|
+
const h2 = container.clientHeight;
|
|
10179
|
+
if (canvas.width !== w * dpr || canvas.height !== h2 * dpr) {
|
|
10180
|
+
canvas.style.width = `${w}px`;
|
|
10181
|
+
canvas.style.height = `${h2}px`;
|
|
10182
|
+
canvas.width = w * dpr;
|
|
10183
|
+
canvas.height = h2 * dpr;
|
|
10184
|
+
}
|
|
10185
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
10186
|
+
ctx.clearRect(0, 0, w, h2);
|
|
10187
|
+
const { wire } = table;
|
|
10188
|
+
const scrollTop = container.scrollTop;
|
|
10189
|
+
const scrollLeft = container.scrollLeft;
|
|
10190
|
+
const headerW = table.headerWidth;
|
|
10191
|
+
const headerH = table.headerHeight;
|
|
10192
|
+
ctx.save();
|
|
10193
|
+
ctx.beginPath();
|
|
10194
|
+
ctx.rect(headerW, headerH, w - headerW, h2 - headerH);
|
|
10195
|
+
ctx.clip();
|
|
10196
|
+
const selectingArea = zoneToArea(selectingZone);
|
|
10197
|
+
drawAreaRectViewport(ctx, table, scrollTop, scrollLeft, w, h2, selectingArea, COLOR_SELECTED, 1, [], SELECTING_FILL);
|
|
10198
|
+
if (autofillDraggingTo) {
|
|
10199
|
+
const autofill = new Autofill(storeRef.current, autofillDraggingTo);
|
|
10200
|
+
drawAreaRectViewport(ctx, table, scrollTop, scrollLeft, w, h2, autofill.wholeArea, COLOR_AUTOFILL, 1, [5, 5]);
|
|
10201
|
+
}
|
|
10202
|
+
{
|
|
10203
|
+
const { y, x } = choosing;
|
|
10204
|
+
if (y !== -1 && x !== -1) {
|
|
10205
|
+
const pos = getCellRectPositions(table, { y, x });
|
|
10206
|
+
const vx = pos.left - scrollLeft;
|
|
10207
|
+
const vy = pos.top - scrollTop;
|
|
10208
|
+
drawRect(ctx, vx, vy, pos.width, pos.height, COLOR_POINTED, 2, []);
|
|
10209
|
+
}
|
|
10210
|
+
}
|
|
10211
|
+
const { copyingSheetId, copyingZone, cutting } = wire;
|
|
10212
|
+
if (table.sheetId === copyingSheetId) {
|
|
10213
|
+
const copyingArea = zoneToArea(copyingZone);
|
|
10214
|
+
const color = cutting ? COLOR_CUTTING : COLOR_COPYING;
|
|
10215
|
+
const dashPattern = cutting ? [4, 4] : [6, 4];
|
|
10216
|
+
drawAreaRectViewport(ctx, table, scrollTop, scrollLeft, w, h2, copyingArea, color, 2.5, dashPattern);
|
|
10217
|
+
}
|
|
10218
|
+
Object.entries(refs).forEach(([ref, i]) => {
|
|
10219
|
+
const palette = COLOR_PALETTE[i % COLOR_PALETTE.length];
|
|
10220
|
+
try {
|
|
10221
|
+
const refArea = table.rangeToArea(ref);
|
|
10222
|
+
drawAreaRectViewport(ctx, table, scrollTop, scrollLeft, w, h2, refArea, palette, 2, [5, 5]);
|
|
10223
|
+
} catch (e) {
|
|
10224
|
+
}
|
|
10225
|
+
});
|
|
10226
|
+
matchingCells.forEach((address, index) => {
|
|
10227
|
+
const { y, x } = a2p(address);
|
|
10228
|
+
const pos = getCellRectPositions(table, { y, x });
|
|
10229
|
+
const vx = pos.left - scrollLeft;
|
|
10230
|
+
const vy = pos.top - scrollTop;
|
|
10231
|
+
if (vx + pos.width < 0 || vx > w || vy + pos.height < 0 || vy > h2) {
|
|
10232
|
+
return;
|
|
10233
|
+
}
|
|
10234
|
+
const isCurrentMatch = index === matchingCellIndex;
|
|
10235
|
+
drawRect(
|
|
10236
|
+
ctx,
|
|
10237
|
+
vx,
|
|
10238
|
+
vy,
|
|
10239
|
+
pos.width,
|
|
10240
|
+
pos.height,
|
|
10241
|
+
isCurrentMatch ? COLOR_SEARCH_MATCHING : "transparent",
|
|
10242
|
+
isCurrentMatch ? 2 : 0,
|
|
10243
|
+
[],
|
|
10244
|
+
SEARCH_MATCHING_BACKGROUND
|
|
10245
|
+
);
|
|
10246
|
+
});
|
|
10247
|
+
ctx.restore();
|
|
10248
|
+
const headerColors = HEADER_COLORS[mode] || HEADER_COLORS.light;
|
|
10249
|
+
const numCols = table.getNumCols();
|
|
10250
|
+
const numRows = table.getNumRows();
|
|
10251
|
+
for (let x = 1; x <= numCols; x++) {
|
|
10252
|
+
let color = null;
|
|
10253
|
+
if (between({ start: selectingZone.startX, end: selectingZone.endX }, x)) {
|
|
10254
|
+
color = topHeaderSelecting ? headerColors.thSelecting : headerColors.selecting;
|
|
10255
|
+
}
|
|
10256
|
+
if (choosing.x === x) {
|
|
10257
|
+
color = headerColors.choosing;
|
|
10258
|
+
}
|
|
10259
|
+
if (!color) {
|
|
10260
|
+
continue;
|
|
10261
|
+
}
|
|
10262
|
+
const pos = getCellRectPositions(table, { y: 1, x });
|
|
10263
|
+
const left = pos.left - scrollLeft;
|
|
10264
|
+
if (left + pos.width < headerW || left > w) {
|
|
10265
|
+
continue;
|
|
10266
|
+
}
|
|
10267
|
+
fillRect(ctx, left, 0, pos.width, headerH, color);
|
|
10268
|
+
}
|
|
10269
|
+
for (let y = 1; y <= numRows; y++) {
|
|
10270
|
+
let color = null;
|
|
10271
|
+
if (between({ start: selectingZone.startY, end: selectingZone.endY }, y)) {
|
|
10272
|
+
color = leftHeaderSelecting ? headerColors.thSelecting : headerColors.selecting;
|
|
10273
|
+
}
|
|
10274
|
+
if (choosing.y === y) {
|
|
10275
|
+
color = headerColors.choosing;
|
|
10276
|
+
}
|
|
10277
|
+
if (!color) {
|
|
10278
|
+
continue;
|
|
10279
|
+
}
|
|
10280
|
+
const pos = getCellRectPositions(table, { y, x: 1 });
|
|
10281
|
+
const top = pos.top - scrollTop;
|
|
10282
|
+
if (top + pos.height < headerH || top > h2) {
|
|
10283
|
+
continue;
|
|
10284
|
+
}
|
|
10285
|
+
fillRect(ctx, 0, top, headerW, pos.height, color);
|
|
10286
|
+
}
|
|
10287
|
+
}, [
|
|
10288
|
+
table,
|
|
10289
|
+
tabularRef,
|
|
10290
|
+
choosing,
|
|
10291
|
+
selectingZone,
|
|
10292
|
+
matchingCells,
|
|
10293
|
+
matchingCellIndex,
|
|
10294
|
+
autofillDraggingTo,
|
|
10295
|
+
topHeaderSelecting,
|
|
10296
|
+
leftHeaderSelecting,
|
|
10297
|
+
mode,
|
|
10298
|
+
dragging,
|
|
10299
|
+
refs
|
|
10300
|
+
]);
|
|
10301
|
+
const scheduleDrawCanvas = useCallback(() => {
|
|
10302
|
+
cancelAnimationFrame(rafIdRef.current);
|
|
10303
|
+
rafIdRef.current = requestAnimationFrame(drawCanvas);
|
|
10304
|
+
}, [drawCanvas]);
|
|
10305
|
+
const handleScroll = useCallback(() => {
|
|
10306
|
+
drawCanvas();
|
|
10307
|
+
}, [drawCanvas]);
|
|
10308
|
+
useEffect(() => {
|
|
10309
|
+
scheduleDrawCanvas();
|
|
10310
|
+
return () => cancelAnimationFrame(rafIdRef.current);
|
|
10311
|
+
}, [scheduleDrawCanvas]);
|
|
10312
|
+
useEffect(() => {
|
|
10313
|
+
const container = tabularRef.current;
|
|
10314
|
+
if (!container) {
|
|
10315
|
+
return;
|
|
10316
|
+
}
|
|
10317
|
+
container.addEventListener("scroll", handleScroll);
|
|
10318
|
+
return () => {
|
|
10319
|
+
container.removeEventListener("scroll", handleScroll);
|
|
10320
|
+
};
|
|
10321
|
+
}, [tabularRef, handleScroll]);
|
|
10322
|
+
return /* @__PURE__ */ jsx(
|
|
10323
|
+
"div",
|
|
10324
|
+
{
|
|
10325
|
+
style: {
|
|
10326
|
+
position: "sticky",
|
|
10327
|
+
top: 0,
|
|
10328
|
+
left: 0,
|
|
10329
|
+
width: 0,
|
|
10330
|
+
height: 0,
|
|
10331
|
+
overflow: "visible",
|
|
10332
|
+
pointerEvents: "none",
|
|
10333
|
+
zIndex: 10
|
|
10334
|
+
},
|
|
10335
|
+
children: /* @__PURE__ */ jsx(
|
|
10336
|
+
"canvas",
|
|
10337
|
+
{
|
|
10338
|
+
ref: canvasRef,
|
|
10339
|
+
className: "gs-cell-state-overlay",
|
|
10340
|
+
style: {
|
|
10341
|
+
pointerEvents: "none",
|
|
10342
|
+
display: "block"
|
|
10343
|
+
}
|
|
10344
|
+
}
|
|
10345
|
+
)
|
|
10346
|
+
}
|
|
10347
|
+
);
|
|
10348
|
+
};
|
|
10079
10349
|
const Tabular = () => {
|
|
10080
10350
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
10081
10351
|
const [palette, setPalette] = useState({});
|
|
@@ -10090,9 +10360,7 @@ const Tabular = () => {
|
|
|
10090
10360
|
sheetHeight,
|
|
10091
10361
|
inputting,
|
|
10092
10362
|
leftHeaderSelecting,
|
|
10093
|
-
topHeaderSelecting
|
|
10094
|
-
totalWidth,
|
|
10095
|
-
totalHeight
|
|
10363
|
+
topHeaderSelecting
|
|
10096
10364
|
} = store;
|
|
10097
10365
|
const table = tableReactive.current;
|
|
10098
10366
|
const [virtualized, setVirtualized] = useState(null);
|
|
@@ -10178,13 +10446,13 @@ const Tabular = () => {
|
|
|
10178
10446
|
}
|
|
10179
10447
|
setVirtualized(virtualize(table, tabularRef.current));
|
|
10180
10448
|
}, [tabularRef.current, tableReactive, (_a = mainRef.current) == null ? void 0 : _a.clientHeight, (_b = mainRef.current) == null ? void 0 : _b.clientWidth]);
|
|
10449
|
+
const mergedRefs = {
|
|
10450
|
+
...palette,
|
|
10451
|
+
...table ? table.wire.paletteBySheetName[table.sheetName] : {}
|
|
10452
|
+
};
|
|
10181
10453
|
if (!table || !table.wire.ready) {
|
|
10182
10454
|
return null;
|
|
10183
10455
|
}
|
|
10184
|
-
const operationStyles = useOperationStyles(store, {
|
|
10185
|
-
...palette,
|
|
10186
|
-
...table.wire.paletteBySheetName[table.sheetName]
|
|
10187
|
-
});
|
|
10188
10456
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
10189
10457
|
"div",
|
|
10190
10458
|
{
|
|
@@ -10196,212 +10464,81 @@ const Tabular = () => {
|
|
|
10196
10464
|
ref: tabularRef,
|
|
10197
10465
|
onMouseMove: handleMouseMove,
|
|
10198
10466
|
onScroll: handleScroll,
|
|
10199
|
-
children: /* @__PURE__ */
|
|
10467
|
+
children: /* @__PURE__ */ jsxs(
|
|
10200
10468
|
"div",
|
|
10201
10469
|
{
|
|
10202
10470
|
className: "gs-tabular-inner",
|
|
10203
10471
|
style: {
|
|
10204
|
-
width: totalWidth + 1,
|
|
10205
|
-
height: totalHeight + 1
|
|
10472
|
+
width: table.totalWidth + 1,
|
|
10473
|
+
height: table.totalHeight + 1
|
|
10206
10474
|
},
|
|
10207
|
-
children:
|
|
10208
|
-
/* @__PURE__ */ jsx(
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
{
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
/* @__PURE__ */
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10475
|
+
children: [
|
|
10476
|
+
/* @__PURE__ */ jsx(CellStateOverlay, { refs: mergedRefs }),
|
|
10477
|
+
/* @__PURE__ */ jsxs("table", { className: `gs-table`, children: [
|
|
10478
|
+
/* @__PURE__ */ jsx("thead", { className: "gs-thead", style: { height: table.headerHeight }, children: /* @__PURE__ */ jsxs("tr", { className: "gs-row", children: [
|
|
10479
|
+
/* @__PURE__ */ jsx(
|
|
10480
|
+
"th",
|
|
10481
|
+
{
|
|
10482
|
+
className: "gs-th gs-th-left gs-th-top",
|
|
10483
|
+
style: { position: "sticky", width: table.headerWidth, height: table.headerHeight },
|
|
10484
|
+
onClick: handleSelectAllClick,
|
|
10485
|
+
children: /* @__PURE__ */ jsx("div", { className: "gs-th-inner", children: /* @__PURE__ */ jsx(
|
|
10486
|
+
ScrollHandle,
|
|
10487
|
+
{
|
|
10488
|
+
className: leftHeaderSelecting || topHeaderSelecting ? "gs-hidden" : "",
|
|
10489
|
+
style: { position: "absolute" },
|
|
10490
|
+
horizontal: leftHeaderSelecting ? 0 : -1,
|
|
10491
|
+
vertical: topHeaderSelecting ? 0 : -1
|
|
10492
|
+
}
|
|
10493
|
+
) })
|
|
10494
|
+
}
|
|
10495
|
+
),
|
|
10496
|
+
/* @__PURE__ */ jsx(
|
|
10497
|
+
"th",
|
|
10498
|
+
{
|
|
10499
|
+
className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-left",
|
|
10500
|
+
style: { width: ((_c = virtualized == null ? void 0 : virtualized.adjuster) == null ? void 0 : _c.left) ?? 1 }
|
|
10501
|
+
}
|
|
10502
|
+
),
|
|
10503
|
+
(_e = (_d = virtualized == null ? void 0 : virtualized.xs) == null ? void 0 : _d.map) == null ? void 0 : _e.call(_d, (x) => /* @__PURE__ */ jsx(HeaderCellTop, { x }, x)),
|
|
10504
|
+
/* @__PURE__ */ jsx(
|
|
10505
|
+
"th",
|
|
10506
|
+
{
|
|
10507
|
+
className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-right",
|
|
10508
|
+
style: { width: (_f = virtualized == null ? void 0 : virtualized.adjuster) == null ? void 0 : _f.right }
|
|
10509
|
+
}
|
|
10510
|
+
)
|
|
10511
|
+
] }) }),
|
|
10512
|
+
/* @__PURE__ */ jsx("tbody", { className: "gs-table-body-adjuster", children: /* @__PURE__ */ jsxs("tr", { className: "gs-row", children: [
|
|
10513
|
+
/* @__PURE__ */ jsx(
|
|
10514
|
+
"th",
|
|
10515
|
+
{
|
|
10516
|
+
className: `gs-adjuster gs-adjuster-horizontal gs-adjuster-vertical`,
|
|
10517
|
+
style: { height: ((_g = virtualized == null ? void 0 : virtualized.adjuster) == null ? void 0 : _g.top) ?? 1 }
|
|
10518
|
+
}
|
|
10519
|
+
),
|
|
10520
|
+
/* @__PURE__ */ jsx("td", { className: "gs-adjuster gs-adjuster-vertical" }),
|
|
10521
|
+
(_h = virtualized == null ? void 0 : virtualized.xs) == null ? void 0 : _h.map((x) => /* @__PURE__ */ jsx("td", { className: "gs-adjuster gs-adjuster-vertical" }, x)),
|
|
10522
|
+
/* @__PURE__ */ jsx("th", { className: `gs-adjuster gs-adjuster-horizontal gs-adjuster-vertical` })
|
|
10523
|
+
] }) }),
|
|
10524
|
+
/* @__PURE__ */ jsx("tbody", { className: "gs-table-body-data", children: (_i = virtualized == null ? void 0 : virtualized.ys) == null ? void 0 : _i.map((y) => {
|
|
10525
|
+
var _a2;
|
|
10526
|
+
return /* @__PURE__ */ jsxs("tr", { className: "gs-row", children: [
|
|
10527
|
+
/* @__PURE__ */ jsx(HeaderCellLeft, { y }),
|
|
10528
|
+
/* @__PURE__ */ jsx("td", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-left" }),
|
|
10529
|
+
(_a2 = virtualized == null ? void 0 : virtualized.xs) == null ? void 0 : _a2.map((x) => /* @__PURE__ */ jsx(Cell, { y, x }, x)),
|
|
10530
|
+
/* @__PURE__ */ jsx("td", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-right" })
|
|
10531
|
+
] }, y);
|
|
10532
|
+
}) })
|
|
10533
|
+
] })
|
|
10534
|
+
]
|
|
10264
10535
|
}
|
|
10265
10536
|
)
|
|
10266
10537
|
}
|
|
10267
10538
|
) });
|
|
10268
10539
|
};
|
|
10269
|
-
const
|
|
10270
|
-
const BORDER_SELECTED = "solid 1px #0077ff";
|
|
10271
|
-
const BORDER_CUTTING = "dotted 2px #0077ff";
|
|
10272
|
-
const BORDER_COPYING = "dashed 2px #0077ff";
|
|
10273
|
-
const SEARCH_MATCHING_BACKGROUND = "rgba(0,200,100,.2)";
|
|
10274
|
-
const SEARCH_MATCHING_BORDER = "solid 2px #00aa78";
|
|
10275
|
-
const AUTOFILL_BORDER = "dashed 1px #444444";
|
|
10276
|
-
const useOperationStyles = (store, refs) => {
|
|
10277
|
-
const cellStyles = {};
|
|
10278
|
-
const updateStyle = (point, style) => {
|
|
10279
|
-
const address = p2a(point);
|
|
10280
|
-
cellStyles[address] = cellStyles[address] || {};
|
|
10281
|
-
Object.assign(cellStyles[address], style);
|
|
10282
|
-
};
|
|
10283
|
-
const {
|
|
10284
|
-
choosing,
|
|
10285
|
-
selectingZone,
|
|
10286
|
-
matchingCells,
|
|
10287
|
-
matchingCellIndex,
|
|
10288
|
-
tableReactive,
|
|
10289
|
-
autofillDraggingTo,
|
|
10290
|
-
editingAddress
|
|
10291
|
-
} = store;
|
|
10292
|
-
const table = tableReactive.current;
|
|
10293
|
-
if (!table) {
|
|
10294
|
-
return {};
|
|
10295
|
-
}
|
|
10296
|
-
const { wire } = table;
|
|
10297
|
-
const { copyingSheetId, copyingZone, cutting } = wire;
|
|
10298
|
-
const editingAnywhere = !!(wire.editingAddress || editingAddress);
|
|
10299
|
-
{
|
|
10300
|
-
const { top, left, bottom, right } = zoneToArea(selectingZone);
|
|
10301
|
-
if (!editingAnywhere) {
|
|
10302
|
-
for (let y = top; y <= bottom; y++) {
|
|
10303
|
-
updateStyle({ y, x: left - 1 }, { borderRight: BORDER_SELECTED });
|
|
10304
|
-
updateStyle({ y, x: left }, { borderLeft: BORDER_SELECTED });
|
|
10305
|
-
updateStyle({ y, x: right }, { borderRight: BORDER_SELECTED });
|
|
10306
|
-
updateStyle({ y, x: right + 1 }, { borderLeft: BORDER_SELECTED });
|
|
10307
|
-
}
|
|
10308
|
-
for (let x = left; x <= right; x++) {
|
|
10309
|
-
updateStyle({ y: top - 1, x }, { borderBottom: BORDER_SELECTED });
|
|
10310
|
-
updateStyle({ y: top, x }, { borderTop: BORDER_SELECTED });
|
|
10311
|
-
updateStyle({ y: bottom, x }, { borderBottom: BORDER_SELECTED });
|
|
10312
|
-
updateStyle({ y: bottom + 1, x }, { borderTop: BORDER_SELECTED });
|
|
10313
|
-
}
|
|
10314
|
-
}
|
|
10315
|
-
}
|
|
10316
|
-
if (autofillDraggingTo) {
|
|
10317
|
-
const autofill = new Autofill(store, autofillDraggingTo);
|
|
10318
|
-
const { top, left, bottom, right } = autofill.wholeArea;
|
|
10319
|
-
for (let y = top; y <= bottom; y++) {
|
|
10320
|
-
updateStyle({ y, x: left - 1 }, { borderRight: AUTOFILL_BORDER });
|
|
10321
|
-
updateStyle({ y, x: left }, { borderLeft: AUTOFILL_BORDER });
|
|
10322
|
-
updateStyle({ y, x: right }, { borderRight: AUTOFILL_BORDER });
|
|
10323
|
-
updateStyle({ y, x: right + 1 }, { borderLeft: AUTOFILL_BORDER });
|
|
10324
|
-
}
|
|
10325
|
-
for (let x = left; x <= right; x++) {
|
|
10326
|
-
updateStyle({ y: top - 1, x }, { borderBottom: AUTOFILL_BORDER });
|
|
10327
|
-
updateStyle({ y: top, x }, { borderTop: AUTOFILL_BORDER });
|
|
10328
|
-
updateStyle({ y: bottom, x }, { borderBottom: AUTOFILL_BORDER });
|
|
10329
|
-
updateStyle({ y: bottom + 1, x }, { borderTop: AUTOFILL_BORDER });
|
|
10330
|
-
}
|
|
10331
|
-
}
|
|
10332
|
-
{
|
|
10333
|
-
const { y, x } = choosing;
|
|
10334
|
-
updateStyle(
|
|
10335
|
-
{ y, x },
|
|
10336
|
-
{
|
|
10337
|
-
borderLeft: BORDER_POINTED,
|
|
10338
|
-
borderRight: BORDER_POINTED,
|
|
10339
|
-
borderTop: BORDER_POINTED,
|
|
10340
|
-
borderBottom: BORDER_POINTED
|
|
10341
|
-
}
|
|
10342
|
-
);
|
|
10343
|
-
updateStyle({ y, x: x - 1 }, { borderRight: BORDER_POINTED });
|
|
10344
|
-
updateStyle({ y, x: x + 1 }, { borderLeft: BORDER_POINTED });
|
|
10345
|
-
updateStyle({ y: y - 1, x }, { borderBottom: BORDER_POINTED });
|
|
10346
|
-
updateStyle({ y: y + 1, x }, { borderTop: BORDER_POINTED });
|
|
10347
|
-
}
|
|
10348
|
-
if (table.sheetId === copyingSheetId) {
|
|
10349
|
-
const borderStyle = cutting ? BORDER_CUTTING : BORDER_COPYING;
|
|
10350
|
-
const { top, left, bottom, right } = zoneToArea(copyingZone);
|
|
10351
|
-
for (let y = top; y <= bottom; y++) {
|
|
10352
|
-
updateStyle({ y, x: left - 1 }, { borderRight: borderStyle });
|
|
10353
|
-
updateStyle({ y, x: left }, { borderLeft: borderStyle });
|
|
10354
|
-
updateStyle({ y, x: right }, { borderRight: borderStyle });
|
|
10355
|
-
updateStyle({ y, x: right + 1 }, { borderLeft: borderStyle });
|
|
10356
|
-
}
|
|
10357
|
-
for (let x = left; x <= right; x++) {
|
|
10358
|
-
updateStyle({ y: top - 1, x }, { borderBottom: borderStyle });
|
|
10359
|
-
updateStyle({ y: top, x }, { borderTop: borderStyle });
|
|
10360
|
-
updateStyle({ y: bottom, x }, { borderBottom: borderStyle });
|
|
10361
|
-
updateStyle({ y: bottom + 1, x }, { borderTop: borderStyle });
|
|
10362
|
-
}
|
|
10363
|
-
}
|
|
10364
|
-
Object.entries(refs).forEach(([ref, i]) => {
|
|
10365
|
-
const palette = COLOR_PALETTE[i % COLOR_PALETTE.length];
|
|
10366
|
-
const borderStyle = `dashed 2px ${palette}`;
|
|
10367
|
-
const { top, left, bottom, right } = table.rangeToArea(ref);
|
|
10368
|
-
for (let y = top; y <= bottom; y++) {
|
|
10369
|
-
updateStyle({ y, x: left - 1 }, { borderRight: borderStyle });
|
|
10370
|
-
updateStyle({ y, x: left }, { borderLeft: borderStyle });
|
|
10371
|
-
updateStyle({ y, x: right }, { borderRight: borderStyle });
|
|
10372
|
-
updateStyle({ y, x: right + 1 }, { borderLeft: borderStyle });
|
|
10373
|
-
}
|
|
10374
|
-
for (let x = left; x <= right; x++) {
|
|
10375
|
-
updateStyle({ y: top - 1, x }, { borderBottom: borderStyle });
|
|
10376
|
-
updateStyle({ y: top, x }, { borderTop: borderStyle });
|
|
10377
|
-
updateStyle({ y: bottom, x }, { borderBottom: borderStyle });
|
|
10378
|
-
updateStyle({ y: bottom + 1, x }, { borderTop: borderStyle });
|
|
10379
|
-
}
|
|
10380
|
-
});
|
|
10381
|
-
matchingCells.forEach((address) => {
|
|
10382
|
-
const { y, x } = a2p(address);
|
|
10383
|
-
updateStyle({ y, x }, { backgroundColor: SEARCH_MATCHING_BACKGROUND });
|
|
10384
|
-
});
|
|
10385
|
-
if (matchingCells.length > 0) {
|
|
10386
|
-
const { y, x } = a2p(matchingCells[matchingCellIndex]);
|
|
10387
|
-
updateStyle(
|
|
10388
|
-
{ y, x },
|
|
10389
|
-
{
|
|
10390
|
-
borderLeft: SEARCH_MATCHING_BORDER,
|
|
10391
|
-
borderRight: SEARCH_MATCHING_BORDER,
|
|
10392
|
-
borderTop: SEARCH_MATCHING_BORDER,
|
|
10393
|
-
borderBottom: SEARCH_MATCHING_BORDER
|
|
10394
|
-
}
|
|
10395
|
-
);
|
|
10396
|
-
updateStyle({ y, x: x - 1 }, { borderRight: SEARCH_MATCHING_BORDER });
|
|
10397
|
-
updateStyle({ y, x: x + 1 }, { borderLeft: SEARCH_MATCHING_BORDER });
|
|
10398
|
-
updateStyle({ y: y - 1, x }, { borderBottom: SEARCH_MATCHING_BORDER });
|
|
10399
|
-
updateStyle({ y: y + 1, x }, { borderTop: SEARCH_MATCHING_BORDER });
|
|
10400
|
-
}
|
|
10401
|
-
return cellStyles;
|
|
10402
|
-
};
|
|
10403
|
-
const LAST_MODIFIED = 1753483021;
|
|
10404
|
-
const CSS = `.gs-root1{display:inline-block;position:relative;border-spacing:0;width:fit-content;max-width:100%;overflow:auto;font-family:"SF Pro Text","SF Pro Icons","Helvetica Neue",Helvetica,Arial,Meiryo,sans-serif;visibility:hidden;opacity:0}.gs-root1.gs-initialized{visibility:visible;opacity:1;transition:opacity .2s ease-in-out}.gs-root1 .gs-main{flex:1;max-width:100%;overflow:hidden;position:relative;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.gs-root1 .gs-resizing{width:100%;height:100%;position:absolute;background-color:rgba(0,127,255,.08);top:0;left:0;z-index:2}.gs-root1 .gs-line-horizontal{width:100%}.gs-root1 .gs-line-vertical{height:100%}.gs-root1 .gs-line{position:relative;top:0;left:0;border:dotted 1px #07f;box-sizing:border-box}.gs-root1 .gs-line span{font-size:10px;padding:3px;background-color:#07f;color:#fff;margin:0;position:absolute;top:0;left:0}.gs-root1 .gs-scroll-handle{width:100%;height:100%;cursor:cell}.gs-hidden{visibility:hidden;position:absolute;top:0;left:0;width:0;height:0;overflow:hidden;pointer-events:none;z-index:-1}.gs-fixed{position:fixed;top:0;left:0;z-index:1}.gs-root1[data-mode=light]{background-color:#e2e2e2;color:#000}.gs-root1[data-mode=light] .gs-main{background-color:#e2e2e2;border-right:solid 1px #ddd;border-bottom:solid 1px #ddd}.gs-root1[data-mode=light] .gs-tabular{background-color:#e2e2e2}.gs-root1[data-mode=light] .gs-formula-bar{background-color:#efefef}.gs-root1[data-mode=light] .gs-formula-bar-editor-inner{color:#555}.gs-root1[data-mode=light] .gs-cell{border-top:solid 1px #ddd;border-left:solid 1px #ddd}.gs-root1[data-mode=light] .gs-adjuster{background-color:#ddd}.gs-root1[data-mode=light] .gs-tabular-inner{background-color:#f7f7f7}.gs-root1[data-mode=light] .gs-th{background-color:#efefef;color:#666}.gs-root1[data-mode=light] .gs-th.gs-selecting{background-color:#d2d2d2}.gs-root1[data-mode=light] .gs-th.gs-choosing{background-color:#bbb}.gs-root1[data-mode=light] .gs-th.gs-th-selecting{background-color:#555;color:#fff}.gs-root1[data-mode=light] .gs-th-top{border-left:solid 1px #ddd}.gs-root1[data-mode=light] .gs-th-top .gs-th-inner{border-top:solid 1px #ddd}.gs-root1[data-mode=light] .gs-th-left{border-top:solid 1px #ddd}.gs-root1[data-mode=light] .gs-th-left .gs-th-inner{border-left:solid 1px #ddd}.gs-root1[data-mode=light] .gs-search-bar{color:rgba(0,0,0,.3)}.gs-editor[data-mode=light].gs-editing textarea{caret-color:#000000}.gs-editor[data-mode=light].gs-editing .gs-editor-hl{background-color:#f7f7f7;color:#000}.gs-editor[data-mode=light] .gs-editor-options{color:#000;background-color:#f7f7f7;border:solid 1px #ddd}.gs-root1[data-mode=dark]{background-color:#5a5a5a;color:#eee}.gs-root1[data-mode=dark] .gs-main{background-color:#3f3f3f;border-right:solid 1px #5a5a5a;border-bottom:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-tabular{background-color:#3f3f3f}.gs-root1[data-mode=dark] .gs-formula-bar{background-color:#4f4f4f}.gs-root1[data-mode=dark] .gs-formula-bar-editor-inner{color:#bbb}.gs-root1[data-mode=dark] .gs-cell{border-top:solid 1px #5a5a5a;border-left:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-adjuster{background-color:#5a5a5a}.gs-root1[data-mode=dark] .gs-tabular-inner{background-color:#212121}.gs-root1[data-mode=dark] .gs-large-editor textarea{color:#eee;caret-color:#eeeeee}.gs-root1[data-mode=dark] .gs-th{background-color:#4f4f4f;color:#eee}.gs-root1[data-mode=dark] .gs-th.gs-selecting{background-color:#606060}.gs-root1[data-mode=dark] .gs-th.gs-choosing{background-color:#777}.gs-root1[data-mode=dark] .gs-th.gs-th-selecting{background-color:#aaa;color:#444}.gs-root1[data-mode=dark] .gs-th-top{border-left:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-th-top .gs-th-inner{border-top:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-th-left{border-top:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-th-left .gs-th-inner{border-left:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-search-bar textarea{color:#eee;caret-color:#eeeeee}.gs-root1[data-mode=dark] .gs-search-bar{color:rgba(255,255,255,.3)}.gs-editor[data-mode=dark].gs-editing textarea{caret-color:#eeeeee}.gs-editor[data-mode=dark].gs-editing .gs-editor-hl{background-color:#212121;color:#eee}.gs-editor[data-mode=dark] .gs-editor-options{color:#eee;background-color:#5a5a5a;border:solid 1px #5a5a5a}.gs-cell{transition:border-color .2s ease;padding:0;margin:0;box-sizing:border-box;position:relative;font-size:13px;letter-spacing:1px;line-height:24px;cursor:cell;user-select:none;-webkit-user-select:none;-moz-user-select:none}.gs-cell .gs-cell-inner-wrap.gs-selecting{background-color:rgba(0,128,255,.2)}.gs-cell.gs-copying textarea:focus{outline:solid 1px #0077ff}.gs-cell.gs-selecting{z-index:1}.gs-cell.gs-selecting .gs-cell-inner{background-color:rgba(0,128,255,.2)}.gs-cell.gs-selecting .gs-cell-label{display:block}.gs-cell.gs-choosing{margin-top:-1px;margin-left:-1px;z-index:1}.gs-cell.gs-choosing.gs-editing{color:transparent}.gs-cell.gs-choosing .gs-cell-label{display:block}.gs-cell .gs-formula-error-triangle{position:absolute;top:0;right:0;border-top:3px solid rgba(200,0,0,.9);border-right:3px solid rgba(200,0,0,.9);border-bottom:3px solid transparent;border-left:3px solid transparent;z-index:1}.gs-cell .gs-cell-label{font-size:8px;font-weight:400;font-style:normal;font-family:math,monospace,serif;letter-spacing:1px;line-height:14px;position:absolute;top:0;right:0;background-color:rgba(0,128,255,.2);color:rgba(255,255,255,.6);padding:0 2px;display:none;opacity:.7}.gs-cell .gs-cell-inner-wrap{width:100%;height:100%;position:absolute;top:0;left:0}.gs-cell .gs-cell-inner{width:100%;height:100%;overflow:hidden;display:flex;box-sizing:border-box;border:none!important}.gs-cell .gs-cell-rendered{overflow:hidden;white-space:pre-wrap;cursor:cell;word-wrap:break-word;word-break:break-all;padding:0 2px;width:100%;height:100%}.gs-cell .gs-cell-rendered>*{position:relative}.gs-cell .gs-cell-rendered>.backface{z-index:0}.gs-cell .gs-autofill-drag{background-color:#07f;position:absolute;width:7px;height:7px;bottom:0;right:0;margin-right:-3.5px;margin-bottom:-3.5px;cursor:crosshair;z-index:1}.gs-th[data-x="1"] .gs-th-inner-wrap{border-left:none}.gs-th[data-y="1"] .gs-th-inner-wrap{border-top:none}.gs-cell[data-x="1"]{border-left:none}.gs-cell[data-y="1"]{border-top:none}.gs-contextmenu-modal{width:100%;height:100vh;z-index:3}.gs-contextmenu{z-index:3;position:fixed;background-color:#fff;padding:5px 0;border-radius:5px;box-shadow:rgba(60,64,67,.3) 0 1px 2px 0,rgba(60,64,67,.15) 0 1px 3px 1px}.gs-contextmenu ul{min-width:250px;color:#555;margin:0;padding:0}.gs-contextmenu li{padding:5px 10px;list-style-type:none;display:flex}.gs-contextmenu li.gs-enabled{cursor:pointer}.gs-contextmenu li.gs-enabled:hover{background-color:#eee}.gs-contextmenu li.gs-disabled{opacity:.5;cursor:not-allowed}.gs-contextmenu li.gs-menu-divider{background-color:#aaa;margin:10px 0;padding:0;height:1px}.gs-contextmenu li .gs-menu-name{flex:1;font-size:15px;letter-spacing:1px}.gs-contextmenu li .gs-menu-shortcut{font-size:10px;line-height:20px;color:#999}.gs-contextmenu li .gs-menu-shortcut:before{content:"( "}.gs-contextmenu li .gs-menu-shortcut:after{content:" )"}.gs-contextmenu li .gs-menu-shortcut .gs-menu-underline{text-decoration:underline}.gs-editor-hl{padding:0 2px!important;position:absolute;font-family:monospace,Arial;font-size:12px;line-height:24px;letter-spacing:1px}.gs-formula-bar-editor-inner{position:relative;display:table-cell}.gs-editor{opacity:0;z-index:-1}.gs-editor .gs-editor-inner{position:relative}.gs-editor .gs-editor-hl{box-sizing:content-box;border:solid 2px #07f;margin:-2px -1px}.gs-editor textarea{width:100%;padding:0 2px!important;position:absolute;font-size:12px;font-family:monospace,Arial;line-height:24px;letter-spacing:1px;top:0;left:0;border:none;outline:0;background-color:transparent;color:transparent;resize:none;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;overflow:hidden;cursor:default;white-space:pre;height:auto}.gs-editor.gs-editing{z-index:3;opacity:1}.gs-editor.gs-editing .gs-cell-label{pointer-events:none;font-family:math,monospace,serif;position:absolute;top:0;right:0;margin-top:-15px;margin-right:-2px;padding:0 2px;font-size:10px;background-color:rgba(0,119,255,.75);color:#fff;z-index:1}.gs-formula-bar{width:100%;position:relative;display:table;align-items:center;justify-content:center;border-top:solid 1px rgba(128,128,128,.3);border-left:solid 1px rgba(128,128,128,.3);border-right:solid 1px rgba(128,128,128,.3);box-sizing:border-box}.gs-formula-bar .gs-selecting-address{display:table-cell;vertical-align:middle;width:60px;color:rgba(200,200,200);font-size:13px;text-align:center}.gs-formula-bar .gs-fx{display:table-cell;vertical-align:middle;width:30px;color:rgba(200,200,200);font-style:italic;font-family:cursive;text-align:center;border-left:solid 1px rgba(128,128,128,.5);font-size:15px}.gs-formula-bar .gs-editor-hl{z-index:0;overflow-y:auto;box-sizing:border-box;white-space:pre-wrap;word-break:break-all}.gs-formula-bar textarea{position:relative;z-index:1;width:100%;vertical-align:bottom;color:transparent;border:none;background-color:transparent;padding:0 2px;box-sizing:border-box;outline:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;font-size:12px;font-family:monospace,Arial;height:24px;line-height:24px;min-height:24px;letter-spacing:1px;resize:vertical;caret-color:rgba(128,128,128);white-space:pre-wrap;word-break:break-all}.gs-token-type-INVALID_REF{color:red}.gs-token-type-VALUE.gs-token-entity-type-boolean,.gs-token-type-VALUE.gs-token-entity-type-number{color:#39f}.gs-token-type-VALUE.gs-token-entity-type-string{color:#090}.gs-editor-options{padding:0;box-shadow:0 2px 8px rgba(0,0,0,.25);border:1px solid rgba(128,128,128,.2);border-radius:4px}.gs-editor-option{cursor:pointer;list-style:none;padding:5px;font-size:12px}.gs-editor-option:hover{background-color:rgba(128,128,128,.1)}.gs-editor-option-selected{background-color:rgba(128,128,128,.2)}.gs-adjuster{padding:0}.gs-table{margin:0}.gs-tabular{overflow:auto;display:block;box-sizing:border-box;overscroll-behavior-x:contain}.gs-tabular-inner>table{table-layout:fixed;border-collapse:collapse;border-spacing:0}.gs-th{z-index:2;padding:0;position:sticky;font-size:13px;font-weight:400;box-sizing:border-box;vertical-align:top}.gs-th .gs-resizer{position:absolute;border-color:transparent;box-sizing:border-box;z-index:2}.gs-th .gs-resizer:hover{background-color:#07f}.gs-th .gs-resizer.gs-protected{display:none}.gs-th-inner{height:100%;box-sizing:border-box;vertical-align:middle;overflow:hidden;display:flex;align-items:center;justify-content:center}.gs-th-inner-wrap{height:100%;box-sizing:border-box;background-color:transparent}.gs-th-top{top:0;overflow:hidden}.gs-th-top .gs-resizer{top:0;right:0;width:3px;cursor:e-resize}.gs-th-top .gs-resizer.gs-dragging{border-right-style:dotted;height:1000000px!important;cursor:e-resize}.gs-th-left{left:0;overflow:hidden;min-width:30px;border-top:solid 1px #ddd}.gs-th-left .gs-resizer{left:0;bottom:0;height:3px;cursor:n-resize}.gs-th-left .gs-resizer.gs-dragging{border-bottom-style:dotted;width:1000000px!important;cursor:n-resize}.gs-th-top.gs-th-left{top:0;left:0;z-index:3;border:none!important}.gs-search-bar{width:100%;display:table;align-items:center;justify-content:center;border-top:solid 1px rgba(128,128,128,.3);border-left:solid 1px rgba(128,128,128,.3);border-right:solid 1px rgba(128,128,128,.3);box-sizing:border-box;background-color:rgba(200,50,0,.2)}.gs-search-bar.gs-search-found{background-color:rgba(0,200,100,.2)}.gs-search-bar .gs-search-bar-inner{vertical-align:middle;border-left:solid 1px rgba(128,128,128,.5)}.gs-search-bar .gs-search-bar-icon{border-left:solid 1px rgba(128,128,128,.3);display:table-cell;vertical-align:middle;width:30px}.gs-search-bar textarea{background-color:transparent;border:none;padding:0 2px;box-sizing:border-box;outline:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;font-size:12px;font-family:monospace,Arial;height:24px;line-height:24px;min-height:24px;letter-spacing:1px;caret-color:rgba(128,128,128);white-space:pre-wrap;word-break:break-all;display:table-cell;vertical-align:middle;width:100%;resize:none}.gs-search-progress{display:table-cell;color:#999;font-size:13px;width:60px;vertical-align:middle;white-space:nowrap;text-align:center}.gs-search-close{display:table-cell;cursor:pointer;vertical-align:middle;width:24px}.gs-search-casesensitive{display:table-cell;cursor:pointer;vertical-align:middle;width:30px}.gs-search-casesensitive span{font-size:14px;padding:0 3px}.gs-search-casesensitive span.gs-search-casesensitive-on{color:#07f;background-color:rgba(200,200,255,.5);border-radius:3px}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}`;
|
|
10540
|
+
const LAST_MODIFIED = 1770663713;
|
|
10541
|
+
const CSS = `.gs-root1{display:inline-block;position:relative;border-spacing:0;width:fit-content;max-width:100%;line-height:normal;overflow:auto;font-family:"SF Pro Text","SF Pro Icons","Helvetica Neue",Helvetica,Arial,Meiryo,sans-serif;visibility:hidden;opacity:0}.gs-root1.gs-initialized{visibility:visible;opacity:1;transition:opacity .2s ease-in-out}.gs-root1 .gs-main{flex:1;max-width:100%;overflow:hidden;position:relative;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}.gs-root1 .gs-resizing{width:100%;height:100%;position:absolute;background-color:rgba(0,127,255,.08);top:0;left:0;z-index:2}.gs-root1 .gs-line-horizontal{width:100%}.gs-root1 .gs-line-vertical{height:100%}.gs-root1 .gs-line{position:relative;top:0;left:0;border:dotted 1px #07f;box-sizing:border-box}.gs-root1 .gs-line span{font-size:10px;padding:3px;background-color:#07f;color:#fff;margin:0;position:absolute;top:0;left:0}.gs-root1 .gs-scroll-handle{width:100%;height:100%;cursor:cell}.gs-hidden{visibility:hidden;position:absolute;top:0;left:0;width:0;height:0;overflow:hidden;pointer-events:none;z-index:-1}.gs-fixed{position:fixed;top:0;left:0;z-index:1}.gs-root1[data-mode=light]{background-color:#e2e2e2;color:#000}.gs-root1[data-mode=light] .gs-main{background-color:#e2e2e2;border-right:solid 1px #ddd;border-bottom:solid 1px #ddd}.gs-root1[data-mode=light] .gs-tabular{background-color:#e2e2e2}.gs-root1[data-mode=light] .gs-formula-bar{background-color:#efefef}.gs-root1[data-mode=light] .gs-formula-bar-editor-inner{color:#555}.gs-root1[data-mode=light] .gs-cell{border-top:solid 1px #ddd;border-left:solid 1px #ddd}.gs-root1[data-mode=light] .gs-adjuster{background-color:#ddd}.gs-root1[data-mode=light] .gs-tabular-inner{background-color:#f7f7f7}.gs-root1[data-mode=light] .gs-th{background-color:#efefef;color:#666}.gs-root1[data-mode=light] .gs-th-top{border-left:solid 1px #ddd}.gs-root1[data-mode=light] .gs-th-top .gs-th-inner{border-top:solid 1px #ddd}.gs-root1[data-mode=light] .gs-th-left{border-top:solid 1px #ddd}.gs-root1[data-mode=light] .gs-th-left .gs-th-inner{border-left:solid 1px #ddd}.gs-root1[data-mode=light] .gs-search-bar{color:rgba(0,0,0,.3)}.gs-editor[data-mode=light].gs-editing textarea{caret-color:#000000}.gs-editor[data-mode=light].gs-editing .gs-editor-hl{background-color:#f7f7f7;color:#000}.gs-editor[data-mode=light] .gs-editor-options{color:#000;background-color:#f7f7f7;border:solid 1px #ddd}.gs-root1[data-mode=dark]{background-color:#5a5a5a;color:#eee}.gs-root1[data-mode=dark] .gs-main{background-color:#3f3f3f;border-right:solid 1px #5a5a5a;border-bottom:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-tabular{background-color:#3f3f3f}.gs-root1[data-mode=dark] .gs-formula-bar{background-color:#4f4f4f}.gs-root1[data-mode=dark] .gs-formula-bar-editor-inner{color:#bbb}.gs-root1[data-mode=dark] .gs-cell{border-top:solid 1px #5a5a5a;border-left:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-adjuster{background-color:#5a5a5a}.gs-root1[data-mode=dark] .gs-tabular-inner{background-color:#212121}.gs-root1[data-mode=dark] .gs-large-editor textarea{color:#eee;caret-color:#eeeeee}.gs-root1[data-mode=dark] .gs-th{background-color:#4f4f4f;color:#eee}.gs-root1[data-mode=dark] .gs-th-top{border-left:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-th-top .gs-th-inner{border-top:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-th-left{border-top:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-th-left .gs-th-inner{border-left:solid 1px #5a5a5a}.gs-root1[data-mode=dark] .gs-search-bar textarea{color:#eee;caret-color:#eeeeee}.gs-root1[data-mode=dark] .gs-search-bar{color:rgba(255,255,255,.3)}.gs-editor[data-mode=dark].gs-editing textarea{caret-color:#eeeeee}.gs-editor[data-mode=dark].gs-editing .gs-editor-hl{background-color:#212121;color:#eee}.gs-editor[data-mode=dark] .gs-editor-options{color:#eee;background-color:#5a5a5a;border:solid 1px #5a5a5a}.gs-cell{transition:border-color .2s ease;padding:0;margin:0;box-sizing:border-box;position:relative;font-size:13px;letter-spacing:1px;line-height:24px;cursor:cell;user-select:none;-webkit-user-select:none;-moz-user-select:none}.gs-cell.gs-copying textarea:focus{outline:solid 1px #0077ff}.gs-cell.gs-selecting{z-index:1}.gs-cell.gs-selecting .gs-cell-label{display:block}.gs-cell.gs-choosing{margin-top:-1px;margin-left:-1px;z-index:1}.gs-cell.gs-choosing.gs-editing{color:transparent}.gs-cell.gs-choosing .gs-cell-label{display:block}.gs-cell .gs-formula-error-triangle{position:absolute;top:0;right:0;border-top:3px solid rgba(200,0,0,.9);border-right:3px solid rgba(200,0,0,.9);border-bottom:3px solid transparent;border-left:3px solid transparent;z-index:1}.gs-cell .gs-cell-label{font-size:8px;font-weight:400;font-style:normal;font-family:math,monospace,serif;letter-spacing:1px;line-height:14px;position:absolute;top:0;right:0;background-color:rgba(0,128,255,.2);color:rgba(255,255,255,.6);padding:0 2px;display:none;opacity:.7}.gs-cell .gs-cell-inner-wrap{width:100%;height:100%;position:absolute;top:0;left:0}.gs-cell .gs-cell-inner{width:100%;height:100%;overflow:hidden;display:flex;box-sizing:border-box;border:none!important}.gs-cell .gs-cell-rendered{overflow:hidden;white-space:pre-wrap;cursor:cell;word-wrap:break-word;word-break:break-all;padding:0 2px;width:100%;height:100%}.gs-cell .gs-cell-rendered>*{position:relative}.gs-cell .gs-cell-rendered>.backface{z-index:0}.gs-cell .gs-autofill-drag{background-color:#07f;position:absolute;width:7px;height:7px;bottom:0;right:0;margin-right:-3.5px;margin-bottom:-3.5px;cursor:crosshair;z-index:1}.gs-th[data-x="1"] .gs-th-inner-wrap{border-left:none}.gs-th[data-y="1"] .gs-th-inner-wrap{border-top:none}.gs-cell[data-x="1"]{border-left:none}.gs-cell[data-y="1"]{border-top:none}.gs-contextmenu-modal{width:100%;height:100vh;z-index:3}.gs-contextmenu{z-index:3;position:fixed;background-color:#fff;padding:5px 0;border-radius:5px;box-shadow:rgba(60,64,67,.3) 0 1px 2px 0,rgba(60,64,67,.15) 0 1px 3px 1px}.gs-contextmenu ul{min-width:250px;color:#555;margin:0;padding:0}.gs-contextmenu li{padding:5px 10px;list-style-type:none;display:flex}.gs-contextmenu li.gs-enabled{cursor:pointer}.gs-contextmenu li.gs-enabled:hover{background-color:#eee}.gs-contextmenu li.gs-disabled{opacity:.5;cursor:not-allowed}.gs-contextmenu li.gs-menu-divider{background-color:#aaa;margin:10px 0;padding:0;height:1px}.gs-contextmenu li .gs-menu-name{flex:1;font-size:15px;letter-spacing:1px}.gs-contextmenu li .gs-menu-shortcut{font-size:10px;line-height:20px;color:#999}.gs-contextmenu li .gs-menu-shortcut:before{content:"( "}.gs-contextmenu li .gs-menu-shortcut:after{content:" )"}.gs-contextmenu li .gs-menu-shortcut .gs-menu-underline{text-decoration:underline}.gs-editor-hl{padding:0 2px!important;position:absolute;font-family:monospace,Arial;font-size:12px;line-height:24px;letter-spacing:1px}.gs-formula-bar-editor-inner{position:relative;display:table-cell}.gs-editor{opacity:0;z-index:-1}.gs-editor .gs-editor-inner{position:relative}.gs-editor .gs-editor-hl{box-sizing:content-box;border:solid 2px #07f;margin:-2px -1px}.gs-editor textarea{width:100%;padding:0 2px!important;position:absolute;font-size:12px;font-family:monospace,Arial;line-height:24px;letter-spacing:1px;top:0;left:0;border:none;outline:0;background-color:transparent;color:transparent;resize:none;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;overflow:hidden;cursor:default;white-space:pre;height:auto}.gs-editor.gs-editing{z-index:11;opacity:1}.gs-editor.gs-editing .gs-cell-label{pointer-events:none;font-family:math,monospace,serif;position:absolute;top:0;right:0;margin-top:-15px;margin-right:-2px;padding:0 2px;font-size:10px;background-color:rgba(0,119,255,.75);color:#fff;z-index:1}.gs-formula-bar{width:100%;position:relative;display:table;align-items:center;justify-content:center;border-top:solid 1px rgba(128,128,128,.3);border-left:solid 1px rgba(128,128,128,.3);border-right:solid 1px rgba(128,128,128,.3);box-sizing:border-box}.gs-formula-bar .gs-selecting-address{display:table-cell;vertical-align:middle;width:60px;color:rgba(200,200,200);font-size:13px;text-align:center}.gs-formula-bar .gs-fx{display:table-cell;vertical-align:middle;width:30px;color:rgba(200,200,200);font-style:italic;font-family:cursive;text-align:center;border-left:solid 1px rgba(128,128,128,.5);font-size:15px}.gs-formula-bar .gs-editor-hl{z-index:0;overflow-y:auto;box-sizing:border-box;white-space:pre-wrap;word-break:break-all}.gs-formula-bar textarea{position:relative;z-index:1;width:100%;vertical-align:bottom;color:transparent;border:none;background-color:transparent;padding:0 2px;box-sizing:border-box;outline:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;font-size:12px;font-family:monospace,Arial;height:24px;line-height:24px;min-height:24px;letter-spacing:1px;resize:vertical;caret-color:rgba(128,128,128);white-space:pre-wrap;word-break:break-all}.gs-token-type-INVALID_REF{color:red}.gs-token-type-VALUE.gs-token-entity-type-boolean,.gs-token-type-VALUE.gs-token-entity-type-number{color:#39f}.gs-token-type-VALUE.gs-token-entity-type-string{color:#090}.gs-editor-options{padding:0;box-shadow:0 2px 8px rgba(0,0,0,.25);border:1px solid rgba(128,128,128,.2);border-radius:4px}.gs-editor-option{cursor:pointer;list-style:none;padding:5px;font-size:12px}.gs-editor-option:hover{background-color:rgba(128,128,128,.1)}.gs-editor-option-selected{background-color:rgba(128,128,128,.2)}.gs-adjuster{padding:0}.gs-table{margin:0}.gs-tabular{overflow:auto;display:block;box-sizing:border-box;overscroll-behavior:none;position:relative}.gs-tabular-inner>table{table-layout:fixed;border-collapse:collapse;border-spacing:0}.gs-th{z-index:2;padding:0;position:sticky;font-size:13px;font-weight:400;box-sizing:border-box;vertical-align:top}.gs-th .gs-resizer{position:absolute;border-color:transparent;box-sizing:border-box;z-index:2}.gs-th .gs-resizer:hover{background-color:#07f}.gs-th .gs-resizer.gs-protected{display:none}.gs-th-inner{height:100%;box-sizing:border-box;vertical-align:middle;overflow:hidden;display:flex;align-items:center;justify-content:center}.gs-th-inner-wrap{height:100%;box-sizing:border-box;background-color:transparent}.gs-th-top{top:0;overflow:hidden}.gs-th-top .gs-resizer{top:0;right:0;width:3px;cursor:e-resize}.gs-th-top .gs-resizer.gs-dragging{border-right-style:dotted;height:1000000px!important;cursor:e-resize}.gs-th-left{left:0;overflow:hidden;min-width:30px;border-top:solid 1px #ddd}.gs-th-left .gs-resizer{left:0;bottom:0;height:3px;cursor:n-resize}.gs-th-left .gs-resizer.gs-dragging{border-bottom-style:dotted;width:1000000px!important;cursor:n-resize}.gs-th-top.gs-th-left{top:0;left:0;z-index:3;border:none!important}.gs-search-bar{width:100%;display:table;align-items:center;justify-content:center;border-top:solid 1px rgba(128,128,128,.3);border-left:solid 1px rgba(128,128,128,.3);border-right:solid 1px rgba(128,128,128,.3);box-sizing:border-box;background-color:rgba(200,50,0,.2)}.gs-search-bar.gs-search-found{background-color:rgba(0,200,100,.2)}.gs-search-bar .gs-search-bar-inner{vertical-align:middle;border-left:solid 1px rgba(128,128,128,.5)}.gs-search-bar .gs-search-bar-icon{border-left:solid 1px rgba(128,128,128,.3);display:table-cell;vertical-align:middle;width:30px}.gs-search-bar textarea{background-color:transparent;border:none;padding:0 2px;box-sizing:border-box;outline:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;font-size:12px;font-family:monospace,Arial;height:24px;line-height:24px;min-height:24px;letter-spacing:1px;caret-color:rgba(128,128,128);white-space:pre-wrap;word-break:break-all;display:table-cell;vertical-align:middle;width:100%;resize:none}.gs-search-progress{display:table-cell;color:#999;font-size:13px;width:60px;vertical-align:middle;white-space:nowrap;text-align:center}.gs-search-close{display:table-cell;cursor:pointer;vertical-align:middle;width:24px}.gs-search-casesensitive{display:table-cell;cursor:pointer;vertical-align:middle;width:30px}.gs-search-casesensitive span{font-size:14px;padding:0 3px}.gs-search-casesensitive span.gs-search-casesensitive-on{color:#07f;background-color:rgba(200,200,255,.5);border-radius:3px}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}`;
|
|
10405
10542
|
const embedStyle = () => {
|
|
10406
10543
|
if (typeof window === "undefined") {
|
|
10407
10544
|
return;
|
|
@@ -10736,6 +10873,7 @@ function GridSheet({
|
|
|
10736
10873
|
style,
|
|
10737
10874
|
hub: initialHub
|
|
10738
10875
|
}) {
|
|
10876
|
+
var _a, _b;
|
|
10739
10877
|
const { sheetResize, showFormulaBar = true, mode = "light" } = options;
|
|
10740
10878
|
const rootRef = useRef(null);
|
|
10741
10879
|
const mainRef = useRef(null);
|
|
@@ -10755,7 +10893,7 @@ function GridSheet({
|
|
|
10755
10893
|
const sheetId = sheetIdRef.current;
|
|
10756
10894
|
const tableReactive = useRef(null);
|
|
10757
10895
|
const [initialState] = useState(() => {
|
|
10758
|
-
var
|
|
10896
|
+
var _a2;
|
|
10759
10897
|
if (!sheetName) {
|
|
10760
10898
|
sheetName = `Sheet${sheetId}`;
|
|
10761
10899
|
console.debug("GridSheet: sheetName is not provided, using default name:", sheetName);
|
|
@@ -10772,7 +10910,8 @@ function GridSheet({
|
|
|
10772
10910
|
table.sheetId = sheetId;
|
|
10773
10911
|
wire.sheetIdsByName[sheetName] = sheetId;
|
|
10774
10912
|
table.initialize(initialCells);
|
|
10775
|
-
(
|
|
10913
|
+
(_a2 = wire.onInit) == null ? void 0 : _a2.call(wire, { table });
|
|
10914
|
+
table.setTotalSize();
|
|
10776
10915
|
tableReactive.current = table;
|
|
10777
10916
|
const store2 = {
|
|
10778
10917
|
sheetId,
|
|
@@ -10808,8 +10947,7 @@ function GridSheet({
|
|
|
10808
10947
|
maxNumRows: -1,
|
|
10809
10948
|
minNumCols: 1,
|
|
10810
10949
|
maxNumCols: -1,
|
|
10811
|
-
mode: "light"
|
|
10812
|
-
...table.getTotalSize()
|
|
10950
|
+
mode: "light"
|
|
10813
10951
|
};
|
|
10814
10952
|
return store2;
|
|
10815
10953
|
});
|
|
@@ -10825,9 +10963,9 @@ function GridSheet({
|
|
|
10825
10963
|
const [sheetWidth, setSheetWidth] = useState((options == null ? void 0 : options.sheetWidth) || estimateSheetWidth(initialCells));
|
|
10826
10964
|
useEffect(() => {
|
|
10827
10965
|
const intervalId = window.setInterval(() => {
|
|
10828
|
-
var
|
|
10829
|
-
setSheetHeight(((
|
|
10830
|
-
setSheetWidth(((
|
|
10966
|
+
var _a2, _b2;
|
|
10967
|
+
setSheetHeight(((_a2 = mainRef.current) == null ? void 0 : _a2.clientHeight) || 0);
|
|
10968
|
+
setSheetWidth(((_b2 = mainRef.current) == null ? void 0 : _b2.clientWidth) || 0);
|
|
10831
10969
|
}, 1e3);
|
|
10832
10970
|
return () => window.clearInterval(intervalId);
|
|
10833
10971
|
}, []);
|
|
@@ -10860,8 +10998,8 @@ function GridSheet({
|
|
|
10860
10998
|
ref: mainRef,
|
|
10861
10999
|
style: {
|
|
10862
11000
|
//width: '100%',
|
|
10863
|
-
maxWidth: (store.totalWidth || 0) + 2,
|
|
10864
|
-
maxHeight: (store.totalHeight || 0) + 2,
|
|
11001
|
+
maxWidth: (((_a = store.tableReactive.current) == null ? void 0 : _a.totalWidth) || 0) + 2,
|
|
11002
|
+
maxHeight: (((_b = store.tableReactive.current) == null ? void 0 : _b.totalHeight) || 0) + 2,
|
|
10865
11003
|
overflow: "auto",
|
|
10866
11004
|
resize: sheetResize,
|
|
10867
11005
|
...style
|