@ishibashi0112/spreadsheet-grid-solid 1.4.0 → 1.5.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/API_REFERENCE.md +26 -9
- package/README.md +9 -9
- package/dist/editors/CellEditorLayer.d.ts +2 -0
- package/dist/editors/CustomCellEditor.d.ts +2 -0
- package/dist/index.js +2088 -1968
- package/dist/primitives/reusedRow.d.ts +2 -0
- package/dist/primitives/rowSlots.d.ts +12 -0
- package/dist/primitives/serverSide.d.ts +1 -0
- package/dist/source/index.jsx +216 -40
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/dist/view/DetailToggleButton.d.ts +1 -0
- package/package.json +3 -3
- package/skills/spreadsheet-grid-solid/SKILL.md +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type RowSlotKind = 'data' | 'skeleton' | 'keyed';
|
|
2
|
+
export type RowSlotItem = {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
};
|
|
5
|
+
export type SlottedRow<R extends RowSlotItem> = R & {
|
|
6
|
+
readonly slot: string;
|
|
7
|
+
};
|
|
8
|
+
export type RowSlotState<R extends RowSlotItem> = {
|
|
9
|
+
readonly items: readonly SlottedRow<R>[];
|
|
10
|
+
readonly next: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const assignRowSlots: <R extends RowSlotItem>(prev: RowSlotState<R> | undefined, rows: readonly R[], kindOf: (row: R) => RowSlotKind, reuseFreedSlots: boolean) => RowSlotState<R>;
|
|
@@ -4,6 +4,7 @@ export declare function createServerSide<T>(args: () => ServerSideRowModelArgs<T
|
|
|
4
4
|
rowCount: () => number;
|
|
5
5
|
loadError: import("solid-js").SourceAccessor<import("@ishibashi0112/spreadsheet-grid-core/internal/controllers/serverSideRowModel").ServerSideLoadErrorState | null>;
|
|
6
6
|
writeError: import("solid-js").SourceAccessor<import("@ishibashi0112/spreadsheet-grid-core/internal/controllers/serverSideRowModel").ServerSideWriteErrorState | null>;
|
|
7
|
+
refetching: import("solid-js").SourceAccessor<boolean>;
|
|
7
8
|
isRowLoaded: (viewIndex: number) => boolean;
|
|
8
9
|
requestRange: (startIndex: number, endIndex: number) => void;
|
|
9
10
|
refresh: () => void;
|
package/dist/source/index.jsx
CHANGED
|
@@ -315,6 +315,7 @@ function createLiveObject(keys, read) {
|
|
|
315
315
|
// src/primitives/serverSnapshot.ts
|
|
316
316
|
var SERVER_FRAME_ATTRIBUTE = "data-ssg-ssr";
|
|
317
317
|
var SERVER_SNAPSHOT_ATTRIBUTE = "data-ssg-ssr-snapshot";
|
|
318
|
+
var ROOT_CLASS_NAME = "ssg-root";
|
|
318
319
|
var NOOP = () => {
|
|
319
320
|
};
|
|
320
321
|
var isCallbackKey = (key) => typeof key === "string" && /^on[A-Z]/.test(key);
|
|
@@ -346,6 +347,7 @@ function revealServerFrame(root, display) {
|
|
|
346
347
|
}
|
|
347
348
|
root.removeAttribute(SERVER_FRAME_ATTRIBUTE);
|
|
348
349
|
root.removeAttribute("hidden");
|
|
350
|
+
root.classList.add(ROOT_CLASS_NAME);
|
|
349
351
|
const style = root.style;
|
|
350
352
|
if (display === void 0 || display === "") {
|
|
351
353
|
style.removeProperty("display");
|
|
@@ -596,7 +598,7 @@ function GridHeaderRow(props) {
|
|
|
596
598
|
}
|
|
597
599
|
|
|
598
600
|
// src/view/GridBodyLayer.tsx
|
|
599
|
-
import { For as For2, Show as Show2, createMemo as createMemo5, untrack as untrack3 } from "solid-js";
|
|
601
|
+
import { For as For2, Show as Show2, createMemo as createMemo5, createRenderEffect, untrack as untrack3 } from "solid-js";
|
|
600
602
|
import { getCellValue, isCellEditable } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/permissions";
|
|
601
603
|
import { resolveIsRowSelected } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/rowSelection";
|
|
602
604
|
import { resolveDataRowNumber } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/labelRows";
|
|
@@ -637,6 +639,83 @@ var markClickTarget = (element) => {
|
|
|
637
639
|
element.onclick = noop;
|
|
638
640
|
};
|
|
639
641
|
|
|
642
|
+
// src/primitives/rowSlots.ts
|
|
643
|
+
var PREFIX = { data: "r", skeleton: "s", keyed: "k" };
|
|
644
|
+
var assignRowSlots = (prev, rows, kindOf, reuseFreedSlots) => {
|
|
645
|
+
const slotByKey = /* @__PURE__ */ new Map();
|
|
646
|
+
if (prev) {
|
|
647
|
+
for (const item of prev.items) {
|
|
648
|
+
slotByKey.set(item.key, item.slot);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
const used = /* @__PURE__ */ new Set();
|
|
652
|
+
const items = new Array(rows.length);
|
|
653
|
+
const unassigned = [];
|
|
654
|
+
for (let index = 0; index < rows.length; index += 1) {
|
|
655
|
+
const row = rows[index];
|
|
656
|
+
const kind = kindOf(row);
|
|
657
|
+
if (kind === "keyed") {
|
|
658
|
+
const slot2 = `${PREFIX.keyed}${row.key}`;
|
|
659
|
+
items[index] = { ...row, slot: slot2 };
|
|
660
|
+
used.add(slot2);
|
|
661
|
+
continue;
|
|
662
|
+
}
|
|
663
|
+
const slot = slotByKey.get(row.key);
|
|
664
|
+
if (slot !== void 0 && slot[0] === PREFIX[kind] && !used.has(slot)) {
|
|
665
|
+
items[index] = { ...row, slot };
|
|
666
|
+
used.add(slot);
|
|
667
|
+
} else {
|
|
668
|
+
unassigned.push(index);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
const freed = { [PREFIX.data]: [], [PREFIX.skeleton]: [] };
|
|
672
|
+
if (reuseFreedSlots && prev) {
|
|
673
|
+
for (const item of prev.items) {
|
|
674
|
+
if (!used.has(item.slot)) {
|
|
675
|
+
freed[item.slot[0]]?.push(item.slot);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
const taken = { [PREFIX.data]: 0, [PREFIX.skeleton]: 0 };
|
|
680
|
+
let next = prev?.next ?? 0;
|
|
681
|
+
for (const index of unassigned) {
|
|
682
|
+
const row = rows[index];
|
|
683
|
+
const prefix = PREFIX[kindOf(row)];
|
|
684
|
+
const position = taken[prefix];
|
|
685
|
+
let slot = freed[prefix][position];
|
|
686
|
+
if (slot === void 0) {
|
|
687
|
+
slot = `${prefix}${next}`;
|
|
688
|
+
next += 1;
|
|
689
|
+
} else {
|
|
690
|
+
taken[prefix] = position + 1;
|
|
691
|
+
}
|
|
692
|
+
items[index] = { ...row, slot };
|
|
693
|
+
}
|
|
694
|
+
return { items, next };
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
// src/primitives/reusedRow.ts
|
|
698
|
+
var REUSED_ROW_ATTRIBUTE = "data-ssg-reused";
|
|
699
|
+
var marked = /* @__PURE__ */ new Set();
|
|
700
|
+
var frame = null;
|
|
701
|
+
var release = () => {
|
|
702
|
+
frame = null;
|
|
703
|
+
for (const element of marked) {
|
|
704
|
+
element.removeAttribute(REUSED_ROW_ATTRIBUTE);
|
|
705
|
+
}
|
|
706
|
+
marked.clear();
|
|
707
|
+
};
|
|
708
|
+
var markReusedRow = (element) => {
|
|
709
|
+
element.setAttribute(REUSED_ROW_ATTRIBUTE, "");
|
|
710
|
+
marked.add(element);
|
|
711
|
+
if (frame !== null || typeof requestAnimationFrame !== "function") {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
frame = requestAnimationFrame(() => {
|
|
715
|
+
frame = requestAnimationFrame(release);
|
|
716
|
+
});
|
|
717
|
+
};
|
|
718
|
+
|
|
640
719
|
// src/view/GridBodyLayer.tsx
|
|
641
720
|
var NO_SELECTED_COLUMNS = [-1, -1];
|
|
642
721
|
var EMPTY_SLOT = resolveSlotProps(void 0);
|
|
@@ -650,11 +729,24 @@ var joinClasses = (...parts) => {
|
|
|
650
729
|
return out;
|
|
651
730
|
};
|
|
652
731
|
var isPlainCellColumn = (column) => column.cellClassName === void 0 && !column.cellNote && !hasCellValidation(column) && column.conditionalFormat?.dataBar === void 0 && column.conditionalFormat?.colorScale === void 0 && column.autoHeight !== true;
|
|
653
|
-
var cellKey = (entry) => isPlainCellColumn(entry.column) ?
|
|
732
|
+
var cellKey = (entry) => `${entry.column.key}\0${isPlainCellColumn(entry.column) ? "plain" : "decorated"}${entry.column.renderCell ? "+render" : ""}`;
|
|
654
733
|
var CHIP_COMPACT_MAX_WIDTH = 80;
|
|
655
734
|
function GridBodyLayer(props) {
|
|
656
735
|
const texts = useGridLocaleText();
|
|
657
|
-
|
|
736
|
+
const slotKindOf = (row) => {
|
|
737
|
+
if (row.skeleton) {
|
|
738
|
+
return "skeleton";
|
|
739
|
+
}
|
|
740
|
+
const model = props.rowModel;
|
|
741
|
+
return model.getGroupRow?.(row.index) !== void 0 || model.getLabelRow?.(row.index) !== void 0 ? "keyed" : "data";
|
|
742
|
+
};
|
|
743
|
+
const slotted = createMemo5(
|
|
744
|
+
(prev) => {
|
|
745
|
+
const model = props.rowModel;
|
|
746
|
+
return { state: assignRowSlots(prev?.state, props.rows, slotKindOf, prev?.model === model), model };
|
|
747
|
+
}
|
|
748
|
+
);
|
|
749
|
+
return <For2 each={slotted().state.items} keyed={(item) => item.slot}>
|
|
658
750
|
{(item) => {
|
|
659
751
|
const rowIndex = createMemo5(() => item().index);
|
|
660
752
|
const SkeletonRow = untrack3(() => item().skeleton ? props.skeletonRow : void 0);
|
|
@@ -738,7 +830,17 @@ function GridBodyLayer(props) {
|
|
|
738
830
|
</Show2>
|
|
739
831
|
<Show2 when={row()}>
|
|
740
832
|
{(currentRow) => {
|
|
741
|
-
const rowKey = () => props.rowModel.getRowKey(rowIndex()) ?? rowIndex();
|
|
833
|
+
const rowKey = createMemo5(() => props.rowModel.getRowKey(rowIndex()) ?? rowIndex());
|
|
834
|
+
let rowElement;
|
|
835
|
+
createRenderEffect(
|
|
836
|
+
rowKey,
|
|
837
|
+
(_next, previous) => {
|
|
838
|
+
if (previous !== void 0 && rowElement) {
|
|
839
|
+
markReusedRow(rowElement);
|
|
840
|
+
}
|
|
841
|
+
},
|
|
842
|
+
{ name: "reusedRow" }
|
|
843
|
+
);
|
|
742
844
|
const sourceRowIndex = () => props.rowModel.getSourceIndex(rowIndex()) ?? rowIndex();
|
|
743
845
|
const rowSize = createMemo5(() => item().size ?? props.rowHeight);
|
|
744
846
|
const isRowChecked = createMemo5(
|
|
@@ -790,6 +892,9 @@ function GridBodyLayer(props) {
|
|
|
790
892
|
);
|
|
791
893
|
const rowNumber = () => props.labelViewIndexes ? resolveDataRowNumber(props.labelViewIndexes, rowIndex()) : rowIndex() + 1;
|
|
792
894
|
return <div
|
|
895
|
+
ref={(element) => {
|
|
896
|
+
rowElement = element;
|
|
897
|
+
}}
|
|
793
898
|
data-pane={props.pane}
|
|
794
899
|
data-row-index={rowIndex()}
|
|
795
900
|
role="row"
|
|
@@ -865,7 +970,6 @@ function GridBodyLayer(props) {
|
|
|
865
970
|
() => rowFindHits()?.get(colIndex()),
|
|
866
971
|
void 0
|
|
867
972
|
);
|
|
868
|
-
const cellRowKey = untrack3(rowKey);
|
|
869
973
|
const cellState = {
|
|
870
974
|
get rowIndex() {
|
|
871
975
|
return rowIndex();
|
|
@@ -876,7 +980,9 @@ function GridBodyLayer(props) {
|
|
|
876
980
|
get sourceRowIndex() {
|
|
877
981
|
return sourceRowIndex();
|
|
878
982
|
},
|
|
879
|
-
rowKey
|
|
983
|
+
get rowKey() {
|
|
984
|
+
return rowKey();
|
|
985
|
+
},
|
|
880
986
|
get findRanges() {
|
|
881
987
|
return findRanges();
|
|
882
988
|
},
|
|
@@ -985,6 +1091,7 @@ function GridBodyLayer(props) {
|
|
|
985
1091
|
hasRenderCell: column().renderCell !== void 0
|
|
986
1092
|
});
|
|
987
1093
|
const cell = () => ({ row: rowIndex(), col: colIndex() });
|
|
1094
|
+
const keyedContent = untrack3(() => entry().column.renderCell !== void 0);
|
|
988
1095
|
const cellChildren = plain ? () => props.renderCellContent(currentRow, column(), cellState) : () => <>
|
|
989
1096
|
<Show2 when={dataBar()}>
|
|
990
1097
|
{(bar) => <span
|
|
@@ -1006,6 +1113,10 @@ function GridBodyLayer(props) {
|
|
|
1006
1113
|
</div>
|
|
1007
1114
|
</Show2>
|
|
1008
1115
|
</>;
|
|
1116
|
+
const cellContent = keyedContent ? () => {
|
|
1117
|
+
rowKey();
|
|
1118
|
+
return cellChildren();
|
|
1119
|
+
} : cellChildren;
|
|
1009
1120
|
return <div
|
|
1010
1121
|
role="gridcell"
|
|
1011
1122
|
aria-colindex={colIndex() + 2}
|
|
@@ -1060,7 +1171,7 @@ function GridBodyLayer(props) {
|
|
|
1060
1171
|
"z-index": isActive() ? 3 : 1
|
|
1061
1172
|
}}
|
|
1062
1173
|
>
|
|
1063
|
-
{
|
|
1174
|
+
{cellContent()}
|
|
1064
1175
|
</div>;
|
|
1065
1176
|
}}
|
|
1066
1177
|
</For2>
|
|
@@ -1196,6 +1307,7 @@ function DetailToggleButton(props) {
|
|
|
1196
1307
|
}
|
|
1197
1308
|
event.preventDefault();
|
|
1198
1309
|
event.currentTarget.closest(".ssg-shell")?.focus({ preventScroll: true });
|
|
1310
|
+
props.onPress?.();
|
|
1199
1311
|
}}
|
|
1200
1312
|
onDblClick={(event) => event.stopPropagation()}
|
|
1201
1313
|
>
|
|
@@ -1229,7 +1341,7 @@ import { resolveTypedStartText } from "@ishibashi0112/spreadsheet-grid-core/inte
|
|
|
1229
1341
|
import { formatLocaleText as formatLocaleText4 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
1230
1342
|
|
|
1231
1343
|
// src/editors/TextCellEditor.tsx
|
|
1232
|
-
import { Show as Show6, createRenderEffect as
|
|
1344
|
+
import { Show as Show6, createRenderEffect as createRenderEffect3, createSignal as createSignal4, onCleanup as onCleanup3, onSettled as onSettled3, untrack as untrack6 } from "solid-js";
|
|
1233
1345
|
import { handleEditorKeyDown } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorKeys";
|
|
1234
1346
|
import {
|
|
1235
1347
|
fitMultilineEditor,
|
|
@@ -1239,7 +1351,7 @@ import {
|
|
|
1239
1351
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/utils/multilineEditor";
|
|
1240
1352
|
|
|
1241
1353
|
// src/primitives/topAlignedInput.ts
|
|
1242
|
-
import { createRenderEffect, onSettled, untrack as untrack5 } from "solid-js";
|
|
1354
|
+
import { createRenderEffect as createRenderEffect2, onSettled, untrack as untrack5 } from "solid-js";
|
|
1243
1355
|
import {
|
|
1244
1356
|
alignInputTextToTop,
|
|
1245
1357
|
resolveHiddenTopOf
|
|
@@ -1251,7 +1363,7 @@ function createTopAlignedInput(input, alignTop, cellHeight) {
|
|
|
1251
1363
|
}
|
|
1252
1364
|
};
|
|
1253
1365
|
const read = () => [input(), alignTop(), cellHeight()];
|
|
1254
|
-
|
|
1366
|
+
createRenderEffect2(read, apply, { name: "topAlignedInput" });
|
|
1255
1367
|
onSettled(() => apply(untrack5(read)));
|
|
1256
1368
|
}
|
|
1257
1369
|
|
|
@@ -1318,7 +1430,7 @@ function TextCellEditor(props) {
|
|
|
1318
1430
|
element.setSelectionRange(caret, caret);
|
|
1319
1431
|
}
|
|
1320
1432
|
};
|
|
1321
|
-
|
|
1433
|
+
createRenderEffect3(() => [textarea(), cellHeight(), alignTop(), draft()], fit, { name: "textEditorFit" });
|
|
1322
1434
|
onSettled3(() => {
|
|
1323
1435
|
const element = untrack6(() => input() ?? textarea());
|
|
1324
1436
|
if (!element) {
|
|
@@ -1502,7 +1614,7 @@ import {
|
|
|
1502
1614
|
For as For4,
|
|
1503
1615
|
Show as Show7,
|
|
1504
1616
|
createEffect as createEffect2,
|
|
1505
|
-
createRenderEffect as
|
|
1617
|
+
createRenderEffect as createRenderEffect4,
|
|
1506
1618
|
createSignal as createSignal6,
|
|
1507
1619
|
createUniqueId,
|
|
1508
1620
|
onCleanup as onCleanup5,
|
|
@@ -1733,7 +1845,7 @@ function SelectCellEditor(props) {
|
|
|
1733
1845
|
</Show7>
|
|
1734
1846
|
</>;
|
|
1735
1847
|
createPortalTokens(list, () => props.themeClassName, placement2);
|
|
1736
|
-
|
|
1848
|
+
createRenderEffect4(
|
|
1737
1849
|
() => [input(), composing() ?? shownText()],
|
|
1738
1850
|
([element, text]) => {
|
|
1739
1851
|
if (element && element.value !== text) {
|
|
@@ -1742,7 +1854,7 @@ function SelectCellEditor(props) {
|
|
|
1742
1854
|
},
|
|
1743
1855
|
{ name: "selectEditorInputText" }
|
|
1744
1856
|
);
|
|
1745
|
-
|
|
1857
|
+
createRenderEffect4(
|
|
1746
1858
|
() => [input(), shownText(), composing()],
|
|
1747
1859
|
([element, , composingText]) => {
|
|
1748
1860
|
if (!element || composingText !== null) {
|
|
@@ -1841,13 +1953,29 @@ function DateCellEditor(props) {
|
|
|
1841
1953
|
import { onCleanup as onCleanup7, untrack as untrack10 } from "solid-js";
|
|
1842
1954
|
function CustomCellEditor(props) {
|
|
1843
1955
|
let alive = true;
|
|
1956
|
+
let late = null;
|
|
1957
|
+
const unregisterLateCommit = untrack10(() => props.onRegisterLateCommit)?.((commit) => {
|
|
1958
|
+
late = commit;
|
|
1959
|
+
});
|
|
1844
1960
|
onCleanup7(() => {
|
|
1845
1961
|
alive = false;
|
|
1962
|
+
unregisterLateCommit?.();
|
|
1846
1963
|
});
|
|
1847
1964
|
const context = untrack10(() => props.context);
|
|
1848
1965
|
const sessionContext = Object.defineProperties({}, Object.getOwnPropertyDescriptors(context));
|
|
1849
|
-
sessionContext.commit = (value, direction) =>
|
|
1966
|
+
sessionContext.commit = (value, direction) => {
|
|
1967
|
+
if (late !== null) {
|
|
1968
|
+
const commit = late;
|
|
1969
|
+
late = null;
|
|
1970
|
+
return commit(value);
|
|
1971
|
+
}
|
|
1972
|
+
return alive ? context.commit(value, direction) : { status: "noop" };
|
|
1973
|
+
};
|
|
1850
1974
|
sessionContext.cancel = () => {
|
|
1975
|
+
if (late !== null) {
|
|
1976
|
+
late = null;
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1851
1979
|
if (alive) {
|
|
1852
1980
|
context.cancel();
|
|
1853
1981
|
}
|
|
@@ -1856,6 +1984,8 @@ function CustomCellEditor(props) {
|
|
|
1856
1984
|
}
|
|
1857
1985
|
|
|
1858
1986
|
// src/editors/CellEditorLayer.tsx
|
|
1987
|
+
var NOOP2 = () => {
|
|
1988
|
+
};
|
|
1859
1989
|
function CellEditorLayer(props) {
|
|
1860
1990
|
const texts = useGridLocaleText();
|
|
1861
1991
|
const editor = () => props.editor;
|
|
@@ -1914,7 +2044,11 @@ function CellEditorLayer(props) {
|
|
|
1914
2044
|
cancel: () => props.onCancel()
|
|
1915
2045
|
};
|
|
1916
2046
|
return <Show8 when={session() !== null}>
|
|
1917
|
-
<CustomCellEditor
|
|
2047
|
+
<CustomCellEditor
|
|
2048
|
+
render={render}
|
|
2049
|
+
context={context}
|
|
2050
|
+
onRegisterLateCommit={(receiver) => props.onRegisterLateCommit?.(receiver) ?? NOOP2}
|
|
2051
|
+
/>
|
|
1918
2052
|
</Show8>;
|
|
1919
2053
|
};
|
|
1920
2054
|
const renderEditor = (type, sessionId) => {
|
|
@@ -2023,7 +2157,7 @@ function CellEditorLayer(props) {
|
|
|
2023
2157
|
}
|
|
2024
2158
|
|
|
2025
2159
|
// src/view/DefaultGridTopBar.tsx
|
|
2026
|
-
import { Show as Show9, createMemo as createMemo8, createRenderEffect as
|
|
2160
|
+
import { Show as Show9, createMemo as createMemo8, createRenderEffect as createRenderEffect5, createSignal as createSignal8, createUniqueId as createUniqueId2, untrack as untrack12 } from "solid-js";
|
|
2027
2161
|
var DefaultFilterIcon = () => <svg
|
|
2028
2162
|
width="14"
|
|
2029
2163
|
height="14"
|
|
@@ -2057,7 +2191,7 @@ function DefaultGridTopBar(props) {
|
|
|
2057
2191
|
const placeholder = () => props.globalFilterPlaceholder ?? texts().globalFilterPlaceholder;
|
|
2058
2192
|
const [input, setInput] = createSignal8();
|
|
2059
2193
|
const initialText = untrack12(() => props.globalFilterText);
|
|
2060
|
-
|
|
2194
|
+
createRenderEffect5(
|
|
2061
2195
|
() => [input(), props.globalFilterText],
|
|
2062
2196
|
([element, text]) => {
|
|
2063
2197
|
if (element && element.value !== text) {
|
|
@@ -2251,6 +2385,7 @@ var FEATURE_PROPS = {
|
|
|
2251
2385
|
serverSide: [
|
|
2252
2386
|
{ prop: "dataSource", isUsed: (props) => props.dataSource !== void 0 },
|
|
2253
2387
|
{ prop: "serverSideRefreshToken", isUsed: (props) => props.serverSideRefreshToken !== void 0 },
|
|
2388
|
+
{ prop: "serverSideRefetch", isUsed: (props) => props.serverSideRefetch !== void 0 },
|
|
2254
2389
|
{ prop: "onServerSideLoadError", isUsed: (props) => props.onServerSideLoadError !== void 0 },
|
|
2255
2390
|
{ prop: "onServerSideWriteError", isUsed: (props) => props.onServerSideWriteError !== void 0 },
|
|
2256
2391
|
{ prop: "showSaveStatus", isUsed: (props) => props.showSaveStatus === true }
|
|
@@ -2480,14 +2615,14 @@ var DERIVED_SUMMARY_KEYS = Object.keys({
|
|
|
2480
2615
|
function GridShell(props, features) {
|
|
2481
2616
|
const serverSnapshot = isServer && untrack13(() => props.dataSource == null);
|
|
2482
2617
|
const mountGate = createMountGate();
|
|
2483
|
-
const
|
|
2618
|
+
const frame2 = runInMountGate(mountGate, () => GridShellBody(props, features, mountGate, serverSnapshot ? "hiddenFrame" : "normal"));
|
|
2484
2619
|
const snapshot2 = <NoHydration>
|
|
2485
2620
|
{serverSnapshot ? (() => {
|
|
2486
2621
|
const snapshotGate = createMountGate();
|
|
2487
2622
|
return runInMountGate(snapshotGate, () => GridShellBody(createSnapshotProps(props), features, snapshotGate, "snapshot"));
|
|
2488
2623
|
})() : null}
|
|
2489
2624
|
</NoHydration>;
|
|
2490
|
-
return [
|
|
2625
|
+
return [frame2, snapshot2];
|
|
2491
2626
|
}
|
|
2492
2627
|
function GridShellBody(props, features, mountGate, mode) {
|
|
2493
2628
|
const serverSideFeature2 = features.serverSide;
|
|
@@ -2773,11 +2908,15 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
2773
2908
|
query: serverSideQuerySnapshot().query,
|
|
2774
2909
|
queryKey: serverSideQuerySnapshot().queryKey,
|
|
2775
2910
|
refreshToken: props.serverSideRefreshToken,
|
|
2911
|
+
// 追加(1.5.0): 取り直しの間の見せ方('keep' = 新しい行が届くまで前の行を薄く見せる)。
|
|
2912
|
+
refetch: props.serverSideRefetch,
|
|
2776
2913
|
onLoadError: inOwnTick(props.onServerSideLoadError),
|
|
2777
2914
|
onWriteError: inOwnTick(props.onServerSideWriteError),
|
|
2778
2915
|
// 書き戻しのセル単位の保存状態(pending → ok | failed)を saveStatusController へ。
|
|
2779
2916
|
onWriteStateChange: engine.saveStatus.handle
|
|
2780
2917
|
}));
|
|
2918
|
+
const refetchingRows = createMemo10(() => isServerSide() && serverSide !== void 0 && serverSide.refetching());
|
|
2919
|
+
const editLocked = () => readOnly() || refetchingRows();
|
|
2781
2920
|
const rowModel = createMemo10(() => {
|
|
2782
2921
|
if (!isServerSide() || !serverSide) {
|
|
2783
2922
|
return clientRowModel().rowModel;
|
|
@@ -3489,11 +3628,14 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3489
3628
|
"effect",
|
|
3490
3629
|
"activeCellNotifier"
|
|
3491
3630
|
);
|
|
3631
|
+
const edit = createEditController();
|
|
3492
3632
|
const pointer = createPointerInteractionsController();
|
|
3493
3633
|
connectController(pointer, () => ({
|
|
3494
3634
|
gridRootRef,
|
|
3495
3635
|
bodyScrollRef,
|
|
3496
3636
|
onCellDoubleClickRef: cellDoubleClickRef,
|
|
3637
|
+
// 押してフォーカスをルートへ移した後、開いたままの custom エディタの編集を終える(1.4.1 / AP-11)。
|
|
3638
|
+
endEditLeftOpen: edit.endEditLeftOpen,
|
|
3497
3639
|
scrollContainerRef,
|
|
3498
3640
|
leftPaneScrollRef,
|
|
3499
3641
|
rightPaneScrollRef,
|
|
@@ -3559,7 +3701,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3559
3701
|
uiState: ui(),
|
|
3560
3702
|
// イベントの時点の状態は store から読む(core controllers/liveUiState)。
|
|
3561
3703
|
getUiState: store.getState,
|
|
3562
|
-
readOnly:
|
|
3704
|
+
readOnly: editLocked(),
|
|
3563
3705
|
canEditCell: canEditCell(),
|
|
3564
3706
|
rowKeyGetter: resolvedRowKeyGetter(),
|
|
3565
3707
|
onCopied: (selection) => {
|
|
@@ -3594,7 +3736,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3594
3736
|
const fillHandleFeature2 = features.fillHandle;
|
|
3595
3737
|
const fill = fillHandleFeature2?.createFillHandle({
|
|
3596
3738
|
fillHandle: () => props.fillHandle,
|
|
3597
|
-
readOnly,
|
|
3739
|
+
readOnly: editLocked,
|
|
3598
3740
|
isServerSide,
|
|
3599
3741
|
rows,
|
|
3600
3742
|
rowModel,
|
|
@@ -3847,7 +3989,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3847
3989
|
getUiState: store.getState,
|
|
3848
3990
|
rowModel: rowModel(),
|
|
3849
3991
|
visibleColumns: orderedColumns(),
|
|
3850
|
-
readOnly:
|
|
3992
|
+
readOnly: editLocked(),
|
|
3851
3993
|
canEditCell: canEditCell(),
|
|
3852
3994
|
setEditorInitialValue,
|
|
3853
3995
|
dispatch,
|
|
@@ -3869,7 +4011,6 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3869
4011
|
// 最終列の Tab: その行のカードが開いていればカードの最初の要素へ、無ければ表の直後の目印から既定の Tab(段階 2 C-N2 / F-10)。
|
|
3870
4012
|
onTabPastLastColumn: detailRows.handleTabPastLastColumn
|
|
3871
4013
|
}), "render", "keyboard");
|
|
3872
|
-
const edit = createEditController();
|
|
3873
4014
|
connectController(edit, () => ({
|
|
3874
4015
|
uiState: ui(),
|
|
3875
4016
|
rows: rows(),
|
|
@@ -3881,7 +4022,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3881
4022
|
dispatch,
|
|
3882
4023
|
gridRootRef,
|
|
3883
4024
|
editorActionGuardRef,
|
|
3884
|
-
readOnly:
|
|
4025
|
+
readOnly: editLocked(),
|
|
3885
4026
|
canEditCell: canEditCell(),
|
|
3886
4027
|
localeTexts: localeTexts(),
|
|
3887
4028
|
followsRow: activeRowFollowEnabled(),
|
|
@@ -3894,7 +4035,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3894
4035
|
orderedColumns: orderedColumns(),
|
|
3895
4036
|
uiState: ui(),
|
|
3896
4037
|
getUiState: store.getState,
|
|
3897
|
-
readOnly:
|
|
4038
|
+
readOnly: editLocked(),
|
|
3898
4039
|
canEditCell: canEditCell(),
|
|
3899
4040
|
handleRowsChange: handleRowsChange(),
|
|
3900
4041
|
applyServerSideCellEdits: applyServerSideCellEdits(),
|
|
@@ -3919,7 +4060,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3919
4060
|
{
|
|
3920
4061
|
rowModel: untrack13(rowModel),
|
|
3921
4062
|
columns: untrack13(orderedColumns),
|
|
3922
|
-
readOnly: untrack13(
|
|
4063
|
+
readOnly: untrack13(editLocked),
|
|
3923
4064
|
canEditCell: untrack13(canEditCell)
|
|
3924
4065
|
},
|
|
3925
4066
|
cell
|
|
@@ -4182,6 +4323,8 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4182
4323
|
scrollContainerRef,
|
|
4183
4324
|
bodyScrollRef,
|
|
4184
4325
|
gridRootRef,
|
|
4326
|
+
// 追加(1.4.1 / AP-11 のレビュー): フォーカスを移した後に、開いたままの custom エディタの編集を終える。
|
|
4327
|
+
endEditLeftOpen: edit.endEditLeftOpen,
|
|
4185
4328
|
commitRowMove: commitRowMoveFromDrag,
|
|
4186
4329
|
ghostSlot: slots().dragGhost,
|
|
4187
4330
|
motion: resolvedMotion() === "off" ? "ghost" : props.rowDragMotion ?? "ghost"
|
|
@@ -4209,6 +4352,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4209
4352
|
return;
|
|
4210
4353
|
}
|
|
4211
4354
|
gridRootRef.current?.focus({ preventScroll: true });
|
|
4355
|
+
edit.endEditLeftOpen();
|
|
4212
4356
|
if (enableSelectAllRows()) {
|
|
4213
4357
|
rowSelectionCommands.handleToggleSelectAllRows();
|
|
4214
4358
|
return;
|
|
@@ -4574,7 +4718,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4574
4718
|
return indexes ? resolveDataRowNumber2(indexes, cell.rowIndex) : cell.rowIndex + 1;
|
|
4575
4719
|
};
|
|
4576
4720
|
return <Show11 when={expandable()}>
|
|
4577
|
-
<DetailToggleButton detail={detail} rowNumber={rowNumber()} />
|
|
4721
|
+
<DetailToggleButton detail={detail} rowNumber={rowNumber()} onPress={edit.endEditLeftOpen} />
|
|
4578
4722
|
</Show11>;
|
|
4579
4723
|
}
|
|
4580
4724
|
return column.renderCell({
|
|
@@ -4613,9 +4757,10 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4613
4757
|
setValue: (nextValue) => writeRenderedCellValue(cell.rowKey, unbound, nextValue)
|
|
4614
4758
|
});
|
|
4615
4759
|
}
|
|
4616
|
-
const
|
|
4617
|
-
|
|
4618
|
-
|
|
4760
|
+
const textOf = (row) => {
|
|
4761
|
+
const value = getCellValue2(row, unbound);
|
|
4762
|
+
return column.valueFormatter ? column.valueFormatter({ value, row, column }) : String(value ?? "");
|
|
4763
|
+
};
|
|
4619
4764
|
const splitFind = findFeature2?.splitTextByFindRanges;
|
|
4620
4765
|
const highlightFind = (content) => {
|
|
4621
4766
|
const ranges = cell.findRanges;
|
|
@@ -4631,11 +4776,15 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4631
4776
|
};
|
|
4632
4777
|
const formatRules = conditionalFormatFeature2 ? unbound.conditionalFormat : void 0;
|
|
4633
4778
|
if (formatRules?.dataBar?.showValue === false) {
|
|
4779
|
+
textOf(currentRow());
|
|
4634
4780
|
return null;
|
|
4635
4781
|
}
|
|
4636
4782
|
const chips = formatRules?.chips;
|
|
4637
4783
|
if (conditionalFormatFeature2 && chips) {
|
|
4638
4784
|
const { GridChip: GridChip2, resolveChipSpec: resolveChipSpec2 } = conditionalFormatFeature2;
|
|
4785
|
+
const row = currentRow();
|
|
4786
|
+
const value = getCellValue2(row, unbound);
|
|
4787
|
+
const text = textOf(row);
|
|
4639
4788
|
const chip = createMemo10(
|
|
4640
4789
|
() => resolveChipSpec2(chips, {
|
|
4641
4790
|
row,
|
|
@@ -4669,7 +4818,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4669
4818
|
{(spec) => <GridChip2 spec={spec()}>{highlightFind(spec().label ?? text)}</GridChip2>}
|
|
4670
4819
|
</Show11>;
|
|
4671
4820
|
}
|
|
4672
|
-
return <span class="ssg-cell-value">{highlightFind(
|
|
4821
|
+
return <span class="ssg-cell-value">{highlightFind(textOf(currentRow()))}</span>;
|
|
4673
4822
|
};
|
|
4674
4823
|
const pinnedPaneStyle = (side, width, hasContent) => ({
|
|
4675
4824
|
position: "sticky",
|
|
@@ -4864,6 +5013,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4864
5013
|
onCommit={(value, direction) => edit.commitEdit(value, direction)}
|
|
4865
5014
|
onCancel={edit.cancelEdit}
|
|
4866
5015
|
onRegisterFlush={edit.registerDraftFlush}
|
|
5016
|
+
onRegisterLateCommit={edit.registerLateCommitReceiver}
|
|
4867
5017
|
align={editingColumn()?.align}
|
|
4868
5018
|
enterMove={props.editorEnterMove}
|
|
4869
5019
|
domId={cellEditorDomId}
|
|
@@ -4958,7 +5108,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4958
5108
|
<GridPortalContext value={portalContext}>
|
|
4959
5109
|
<div
|
|
4960
5110
|
class={[
|
|
4961
|
-
"ssg-root",
|
|
5111
|
+
mode === "hiddenFrame" ? void 0 : "ssg-root",
|
|
4962
5112
|
themeClassName(),
|
|
4963
5113
|
slots().root?.className,
|
|
4964
5114
|
props.className,
|
|
@@ -4969,6 +5119,8 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4969
5119
|
"ssg-root--filling": fill?.filling() ?? false,
|
|
4970
5120
|
"ssg-root--animate-rows": animateRowsActive(),
|
|
4971
5121
|
"ssg-root--dim-readonly": props.dimReadOnlyCells ?? false,
|
|
5122
|
+
// 追加(1.5.0 / serverSideRefetch="keep"): 取り直しの間に前の行を見せている(行を薄くする)。
|
|
5123
|
+
"ssg-root--refetching": refetchingRows(),
|
|
4972
5124
|
"ssg-root--fill-height": heightLayout().fillParent,
|
|
4973
5125
|
// クロスヘア(列見出し / 行番号を選択の色で染める。列の帯は ColumnHoverOverlay)。
|
|
4974
5126
|
"ssg-root--hover-cross": hoverCross()
|
|
@@ -5047,6 +5199,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5047
5199
|
onFocusIn={(event) => {
|
|
5048
5200
|
if (event.target === event.currentTarget) {
|
|
5049
5201
|
gridRootRef.current?.focus({ preventScroll: true });
|
|
5202
|
+
edit.endEditLeftOpen();
|
|
5050
5203
|
}
|
|
5051
5204
|
}}
|
|
5052
5205
|
role="grid"
|
|
@@ -5055,6 +5208,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5055
5208
|
aria-colcount={orderedColumns().length + 1}
|
|
5056
5209
|
aria-multiselectable={enableRangeSelection() ? "true" : void 0}
|
|
5057
5210
|
aria-readonly={readOnly() ? "true" : void 0}
|
|
5211
|
+
aria-busy={refetchingRows() ? "true" : void 0}
|
|
5058
5212
|
class={["ssg-scroll-container", { "ssg-scroll-container--custom-scrollbar": customScrollbar() }]}
|
|
5059
5213
|
style={toSolidStyle(heightLayout().scrollContainerStyle)}
|
|
5060
5214
|
>
|
|
@@ -5200,6 +5354,26 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5200
5354
|
/>
|
|
5201
5355
|
</Show11> : null}
|
|
5202
5356
|
{
|
|
5357
|
+
/* 追加(1.5.0 / serverSideRefetch="keep"): 前の行を見せたまま取り直している間、本体の見えている所を薄くする面と、
|
|
5358
|
+
列見出しの下に流れる線(大きさはスクロールバーを除いた見える範囲。測る前は CSS の left / right / bottom。React 版と同じ)。 */
|
|
5359
|
+
}
|
|
5360
|
+
<Show11 when={refetchingRows()}>
|
|
5361
|
+
<div
|
|
5362
|
+
class="ssg-refetch-veil"
|
|
5363
|
+
aria-hidden="true"
|
|
5364
|
+
style={{
|
|
5365
|
+
top: `${headerHeight()}px`,
|
|
5366
|
+
width: viewportWidth() > 0 ? `${viewportWidth()}px` : void 0,
|
|
5367
|
+
height: viewportHeight() > headerHeight() ? `${viewportHeight() - headerHeight()}px` : void 0
|
|
5368
|
+
}}
|
|
5369
|
+
/>
|
|
5370
|
+
<div
|
|
5371
|
+
class="ssg-refetch-bar"
|
|
5372
|
+
aria-hidden="true"
|
|
5373
|
+
style={{ top: `${headerHeight()}px`, width: viewportWidth() > 0 ? `${viewportWidth()}px` : void 0 }}
|
|
5374
|
+
/>
|
|
5375
|
+
</Show11>
|
|
5376
|
+
{
|
|
5203
5377
|
/* IME オンのままの直接入力の入力受け(imeDirectInput が有効なときだけ)。値 / 位置 / 変換中の見た目はコントローラが
|
|
5204
5378
|
直接扱います。Tab の順番には入れません(タブストップはシェルのまま)。 */
|
|
5205
5379
|
}
|
|
@@ -6800,17 +6974,17 @@ function createFilterManagement(inputs) {
|
|
|
6800
6974
|
let disposed = false;
|
|
6801
6975
|
onCleanup12(() => {
|
|
6802
6976
|
disposed = true;
|
|
6803
|
-
for (const
|
|
6804
|
-
cancelAnimationFrame(
|
|
6977
|
+
for (const frame2 of pendingFrames) {
|
|
6978
|
+
cancelAnimationFrame(frame2);
|
|
6805
6979
|
}
|
|
6806
6980
|
pendingFrames.clear();
|
|
6807
6981
|
});
|
|
6808
6982
|
const scheduleFrame = (callback) => {
|
|
6809
|
-
const
|
|
6810
|
-
pendingFrames.delete(
|
|
6983
|
+
const frame2 = requestAnimationFrame(() => {
|
|
6984
|
+
pendingFrames.delete(frame2);
|
|
6811
6985
|
callback();
|
|
6812
6986
|
});
|
|
6813
|
-
pendingFrames.add(
|
|
6987
|
+
pendingFrames.add(frame2);
|
|
6814
6988
|
};
|
|
6815
6989
|
const jumpToColumnFilter = (columnKey) => untrack15(() => {
|
|
6816
6990
|
const scrollElement = inputs.scrollContainerRef.current;
|
|
@@ -7228,7 +7402,7 @@ import { splitTextByFindRanges } from "@ishibashi0112/spreadsheet-grid-core/inte
|
|
|
7228
7402
|
import { DEFAULT_FIND_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
7229
7403
|
|
|
7230
7404
|
// src/view/GridFindBar.tsx
|
|
7231
|
-
import { createRenderEffect as
|
|
7405
|
+
import { createRenderEffect as createRenderEffect6, createSignal as createSignal14, onSettled as onSettled7, untrack as untrack17 } from "solid-js";
|
|
7232
7406
|
import { isImeComposingKeyEvent as isImeComposingKeyEvent3 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
7233
7407
|
function GridFindBar(props) {
|
|
7234
7408
|
const texts = useFeatureLocaleText();
|
|
@@ -7239,7 +7413,7 @@ function GridFindBar(props) {
|
|
|
7239
7413
|
element?.focus();
|
|
7240
7414
|
element?.select();
|
|
7241
7415
|
});
|
|
7242
|
-
|
|
7416
|
+
createRenderEffect6(
|
|
7243
7417
|
() => [input(), props.snapshot.query],
|
|
7244
7418
|
([element, query]) => {
|
|
7245
7419
|
if (element && element.value !== query) {
|
|
@@ -7771,6 +7945,8 @@ function createServerSide(args) {
|
|
|
7771
7945
|
rowCount: () => snapshot2().rowCount,
|
|
7772
7946
|
loadError: createMemo25(() => snapshot2().loadError),
|
|
7773
7947
|
writeError: createMemo25(() => snapshot2().writeError),
|
|
7948
|
+
// 追加(1.5.0 / serverSideRefetch="keep"): 取り直しの間、前の行を見せているか。
|
|
7949
|
+
refetching: createMemo25(() => snapshot2().refetching),
|
|
7774
7950
|
isRowLoaded: controller.isRowLoaded,
|
|
7775
7951
|
requestRange,
|
|
7776
7952
|
refresh: controller.refresh,
|