@ishibashi0112/spreadsheet-grid-solid 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API_REFERENCE.md +4 -2
- package/README.md +2 -2
- package/dist/devWarnings.d.ts +1 -0
- package/dist/index.js +1722 -1661
- package/dist/source/index.jsx +153 -48
- package/dist/view/GridBodyLayer.d.ts +2 -0
- package/package.json +3 -3
package/dist/source/index.jsx
CHANGED
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/gridBarSummary";
|
|
76
76
|
import { isCheckboxChecked } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/checkboxEditor";
|
|
77
77
|
import {
|
|
78
|
-
MAX_BODY_PX
|
|
78
|
+
MAX_BODY_PX,
|
|
79
79
|
physicalToLogicalScrollTop,
|
|
80
80
|
resolvePageTargetRow
|
|
81
81
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/verticalGeometry";
|
|
@@ -599,7 +599,7 @@ function GridHeaderRow(props) {
|
|
|
599
599
|
|
|
600
600
|
// src/view/GridBodyLayer.tsx
|
|
601
601
|
import { For as For2, Show as Show2, createMemo as createMemo5, createRenderEffect, untrack as untrack3 } from "solid-js";
|
|
602
|
-
import { getCellValue, isCellEditable } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/permissions";
|
|
602
|
+
import { getCellValue, isCellEditable, isColumnEditable } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/permissions";
|
|
603
603
|
import { resolveIsRowSelected } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/rowSelection";
|
|
604
604
|
import { resolveDataRowNumber } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/labelRows";
|
|
605
605
|
import { shouldMarkCellOverflowTooltip } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cellOverflowTooltip";
|
|
@@ -719,6 +719,8 @@ var markReusedRow = (element) => {
|
|
|
719
719
|
// src/view/GridBodyLayer.tsx
|
|
720
720
|
var NO_SELECTED_COLUMNS = [-1, -1];
|
|
721
721
|
var EMPTY_SLOT = resolveSlotProps(void 0);
|
|
722
|
+
var NO_VALUE = () => null;
|
|
723
|
+
var NO_SLOT = () => EMPTY_SLOT;
|
|
722
724
|
var joinClasses = (...parts) => {
|
|
723
725
|
let out = "";
|
|
724
726
|
for (const part of parts) {
|
|
@@ -729,10 +731,34 @@ var joinClasses = (...parts) => {
|
|
|
729
731
|
return out;
|
|
730
732
|
};
|
|
731
733
|
var isPlainCellColumn = (column) => column.cellClassName === void 0 && !column.cellNote && !hasCellValidation(column) && column.conditionalFormat?.dataBar === void 0 && column.conditionalFormat?.colorScale === void 0 && column.autoHeight !== true;
|
|
732
|
-
var cellKey = (entry) => `${entry.column.key}\0${isPlainCellColumn(entry.column) ? "plain" : "decorated"}${entry.column.renderCell ? "+render" : ""}`;
|
|
733
734
|
var CHIP_COMPACT_MAX_WIDTH = 80;
|
|
734
735
|
function GridBodyLayer(props) {
|
|
735
736
|
const texts = useGridLocaleText();
|
|
737
|
+
const cellShapes = /* @__PURE__ */ new WeakMap();
|
|
738
|
+
const cellShapeOf = (column) => {
|
|
739
|
+
const known = cellShapes.get(column);
|
|
740
|
+
if (known !== void 0 && known.renderCell === column.renderCell) {
|
|
741
|
+
return known.shape;
|
|
742
|
+
}
|
|
743
|
+
const shape = !isPlainCellColumn(column) ? "decorated" : props.isTextCellColumn(column) ? "text" : "plain";
|
|
744
|
+
cellShapes.set(column, { shape, renderCell: column.renderCell });
|
|
745
|
+
return shape;
|
|
746
|
+
};
|
|
747
|
+
const cellKey = (entry) => `${entry.column.key}\0${cellShapeOf(entry.column)}${entry.column.renderCell ? "+render" : ""}`;
|
|
748
|
+
const editPermission = createMemo5(
|
|
749
|
+
() => ({ readOnly: props.readOnly, canEditCell: props.canEditCell }),
|
|
750
|
+
{ equals: (a, b) => a.readOnly === b.readOnly && a.canEditCell === b.canEditCell }
|
|
751
|
+
);
|
|
752
|
+
const cellEnv = createMemo5(
|
|
753
|
+
() => ({
|
|
754
|
+
showCellOverflowTooltip: props.showCellOverflowTooltip,
|
|
755
|
+
bodyCellSlot: props.slots.bodyCell,
|
|
756
|
+
leadingWidth: props.leadingWidth
|
|
757
|
+
}),
|
|
758
|
+
{
|
|
759
|
+
equals: (a, b) => a.showCellOverflowTooltip === b.showCellOverflowTooltip && a.bodyCellSlot === b.bodyCellSlot && a.leadingWidth === b.leadingWidth
|
|
760
|
+
}
|
|
761
|
+
);
|
|
736
762
|
const slotKindOf = (row) => {
|
|
737
763
|
if (row.skeleton) {
|
|
738
764
|
return "skeleton";
|
|
@@ -841,7 +867,7 @@ function GridBodyLayer(props) {
|
|
|
841
867
|
},
|
|
842
868
|
{ name: "reusedRow" }
|
|
843
869
|
);
|
|
844
|
-
const sourceRowIndex = () => props.rowModel.getSourceIndex(rowIndex()) ?? rowIndex();
|
|
870
|
+
const sourceRowIndex = createMemo5(() => props.rowModel.getSourceIndex(rowIndex()) ?? rowIndex());
|
|
845
871
|
const rowSize = createMemo5(() => item().size ?? props.rowHeight);
|
|
846
872
|
const isRowChecked = createMemo5(
|
|
847
873
|
() => props.enableRowSelection ? resolveIsRowSelected(props.rowSelectionState, rowKey()) : false
|
|
@@ -891,6 +917,73 @@ function GridBodyLayer(props) {
|
|
|
891
917
|
)
|
|
892
918
|
);
|
|
893
919
|
const rowNumber = () => props.labelViewIndexes ? resolveDataRowNumber(props.labelViewIndexes, rowIndex()) : rowIndex() + 1;
|
|
920
|
+
const textCellBase = createMemo5(() => {
|
|
921
|
+
const slot = rowSlot();
|
|
922
|
+
const bodyCell = cellEnv().bodyCellSlot;
|
|
923
|
+
return {
|
|
924
|
+
className: joinClasses("ssg-body-cell", slot.className, bodyCell?.className),
|
|
925
|
+
style: bodyCell?.style || slot.style ? { ...bodyCell?.style, ...slot.style } : void 0
|
|
926
|
+
};
|
|
927
|
+
});
|
|
928
|
+
const renderTextCell = (entry) => {
|
|
929
|
+
const unbound = createMemo5(() => entry().column);
|
|
930
|
+
const column = () => unbound();
|
|
931
|
+
const colIndex = () => entry().logicalIndex;
|
|
932
|
+
const size = () => entry().paneLocalSize;
|
|
933
|
+
const isActive = () => activeCol() === colIndex();
|
|
934
|
+
const isSelected = () => isRowSelected() || selectedColStart() >= 0 && colIndex() >= selectedColStart() && colIndex() <= selectedColEnd();
|
|
935
|
+
const readOnlyCell = () => {
|
|
936
|
+
const env = editPermission();
|
|
937
|
+
return !isColumnEditable(env.readOnly, unbound()) || env.canEditCell !== void 0 && !isCellEditable(env, rowIndex(), colIndex(), currentRow(), unbound(), {
|
|
938
|
+
sourceRowIndex: sourceRowIndex(),
|
|
939
|
+
rowKey: rowKey()
|
|
940
|
+
});
|
|
941
|
+
};
|
|
942
|
+
const alignTop = () => rowAutoHeight() && rowSize() > props.rowHeight && (column().verticalAlign ?? props.verticalAlign ?? "center") === "top";
|
|
943
|
+
const findRanges = createMemoWhen(
|
|
944
|
+
() => rowFindHits() !== void 0,
|
|
945
|
+
() => rowFindHits()?.get(colIndex()),
|
|
946
|
+
void 0
|
|
947
|
+
);
|
|
948
|
+
const cell = () => ({ row: rowIndex(), col: colIndex() });
|
|
949
|
+
return <div
|
|
950
|
+
role="gridcell"
|
|
951
|
+
aria-colindex={colIndex() + 2}
|
|
952
|
+
aria-selected={isSelected() ? "true" : "false"}
|
|
953
|
+
aria-readonly={readOnlyCell() ? "true" : void 0}
|
|
954
|
+
id={isActive() ? props.activeCellDomId : void 0}
|
|
955
|
+
aria-owns={editingCol() === colIndex() ? props.cellEditorDomId : void 0}
|
|
956
|
+
data-ssg-col-key={column().key}
|
|
957
|
+
data-ssg-tooltip-overflow={cellEnv().showCellOverflowTooltip ? "" : void 0}
|
|
958
|
+
class={joinClasses(
|
|
959
|
+
textCellBase().className,
|
|
960
|
+
column().align === "center" && "ssg-body-cell--align-center",
|
|
961
|
+
column().align === "right" && "ssg-body-cell--align-right",
|
|
962
|
+
alignTop() && "ssg-body-cell--valign-top",
|
|
963
|
+
readOnlyCell() && !isSelected() && "ssg-body-cell--readonly",
|
|
964
|
+
isHovered() && "ssg-body-cell--row-hovered"
|
|
965
|
+
)}
|
|
966
|
+
onPointerDown={(event) => props.onCellPointerDown(cell(), event)}
|
|
967
|
+
onPointerEnter={(event) => props.onCellPointerEnter(cell(), event)}
|
|
968
|
+
onClick={(event) => props.onCellClick(cell(), event)}
|
|
969
|
+
onDblClick={(event) => props.onCellDoubleClick(cell(), event)}
|
|
970
|
+
ref={markClickTarget}
|
|
971
|
+
style={{
|
|
972
|
+
...textCellBase().style,
|
|
973
|
+
left: px(cellEnv().leadingWidth + entry().paneLocalStart),
|
|
974
|
+
width: px(size()),
|
|
975
|
+
"min-width": px(size()),
|
|
976
|
+
height: px(rowSize()),
|
|
977
|
+
"word-break": column().wordBreak,
|
|
978
|
+
"line-break": column().lineBreak,
|
|
979
|
+
"z-index": isActive() ? 3 : 1
|
|
980
|
+
}}
|
|
981
|
+
>
|
|
982
|
+
<span class="ssg-cell-value">
|
|
983
|
+
{props.cellText(currentRow(), column(), findRanges(), rowFindCurrent)}
|
|
984
|
+
</span>
|
|
985
|
+
</div>;
|
|
986
|
+
};
|
|
894
987
|
return <div
|
|
895
988
|
ref={(element) => {
|
|
896
989
|
rowElement = element;
|
|
@@ -948,7 +1041,11 @@ function GridBodyLayer(props) {
|
|
|
948
1041
|
</Show2>
|
|
949
1042
|
<For2 each={props.entries} keyed={cellKey}>
|
|
950
1043
|
{(entry) => {
|
|
951
|
-
const
|
|
1044
|
+
const shape = untrack3(() => cellShapeOf(entry().column));
|
|
1045
|
+
if (shape === "text") {
|
|
1046
|
+
return renderTextCell(entry);
|
|
1047
|
+
}
|
|
1048
|
+
const plain = shape === "plain";
|
|
952
1049
|
const unbound = createMemo5(() => entry().column);
|
|
953
1050
|
const column = () => unbound();
|
|
954
1051
|
const colIndex = createMemo5(() => entry().logicalIndex);
|
|
@@ -956,14 +1053,13 @@ function GridBodyLayer(props) {
|
|
|
956
1053
|
const isActive = () => activeCol() === colIndex();
|
|
957
1054
|
const isEditing = () => editingCol() === colIndex();
|
|
958
1055
|
const isSelected = () => isRowSelected() || selectedColStart() >= 0 && colIndex() >= selectedColStart() && colIndex() <= selectedColEnd();
|
|
959
|
-
const readOnlyCell = () =>
|
|
960
|
-
|
|
961
|
-
rowIndex(),
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
);
|
|
1056
|
+
const readOnlyCell = () => {
|
|
1057
|
+
const env = editPermission();
|
|
1058
|
+
return !isColumnEditable(env.readOnly, unbound()) || env.canEditCell !== void 0 && !isCellEditable(env, rowIndex(), colIndex(), currentRow(), unbound(), {
|
|
1059
|
+
sourceRowIndex: sourceRowIndex(),
|
|
1060
|
+
rowKey: rowKey()
|
|
1061
|
+
});
|
|
1062
|
+
};
|
|
967
1063
|
const value = () => getCellValue(currentRow(), unbound());
|
|
968
1064
|
const findRanges = createMemoWhen(
|
|
969
1065
|
() => rowFindHits()?.has(colIndex()) === true,
|
|
@@ -1003,7 +1099,7 @@ function GridBodyLayer(props) {
|
|
|
1003
1099
|
}
|
|
1004
1100
|
};
|
|
1005
1101
|
const needsStyleContext = () => typeof column().cellClassName === "function" || !!column().cellNote;
|
|
1006
|
-
const styleContext = plain ?
|
|
1102
|
+
const styleContext = plain ? NO_VALUE : createMemoWhen(
|
|
1007
1103
|
needsStyleContext,
|
|
1008
1104
|
() => ({
|
|
1009
1105
|
row: currentRow(),
|
|
@@ -1020,7 +1116,7 @@ function GridBodyLayer(props) {
|
|
|
1020
1116
|
}),
|
|
1021
1117
|
null
|
|
1022
1118
|
);
|
|
1023
|
-
const conditionalCell = plain ?
|
|
1119
|
+
const conditionalCell = plain ? NO_SLOT : createMemoWhen(
|
|
1024
1120
|
() => column().cellClassName !== void 0,
|
|
1025
1121
|
() => {
|
|
1026
1122
|
const cellClassName = column().cellClassName;
|
|
@@ -1032,7 +1128,7 @@ function GridBodyLayer(props) {
|
|
|
1032
1128
|
resolveSlotProps(void 0)
|
|
1033
1129
|
);
|
|
1034
1130
|
const formatRules = () => props.conditionalFormat ? column().conditionalFormat : void 0;
|
|
1035
|
-
const dataBar = plain ?
|
|
1131
|
+
const dataBar = plain ? NO_VALUE : createMemoWhen(
|
|
1036
1132
|
() => formatRules()?.dataBar !== void 0,
|
|
1037
1133
|
() => {
|
|
1038
1134
|
const feature = props.conditionalFormat;
|
|
@@ -1041,7 +1137,7 @@ function GridBodyLayer(props) {
|
|
|
1041
1137
|
},
|
|
1042
1138
|
null
|
|
1043
1139
|
);
|
|
1044
|
-
const scaleBackground = plain ?
|
|
1140
|
+
const scaleBackground = plain ? NO_VALUE : createMemoWhen(
|
|
1045
1141
|
() => formatRules()?.colorScale !== void 0,
|
|
1046
1142
|
() => {
|
|
1047
1143
|
const feature = props.conditionalFormat;
|
|
@@ -1059,12 +1155,12 @@ function GridBodyLayer(props) {
|
|
|
1059
1155
|
const rules = formatRules()?.dataBar;
|
|
1060
1156
|
return bar ? bar.negative ? rules?.negativeColor : rules?.color : void 0;
|
|
1061
1157
|
};
|
|
1062
|
-
const invalidMessage = plain ?
|
|
1158
|
+
const invalidMessage = plain ? NO_VALUE : createMemoWhen(
|
|
1063
1159
|
() => !!props.showValidationMarks && hasCellValidation(unbound()),
|
|
1064
1160
|
() => getInvalidMessage(unbound(), currentRow(), value(), texts()),
|
|
1065
1161
|
null
|
|
1066
1162
|
);
|
|
1067
|
-
const cellNote = plain ?
|
|
1163
|
+
const cellNote = plain ? NO_VALUE : createMemoWhen(
|
|
1068
1164
|
() => !!column().cellNote,
|
|
1069
1165
|
() => {
|
|
1070
1166
|
const note = column().cellNote;
|
|
@@ -1086,7 +1182,7 @@ function GridBodyLayer(props) {
|
|
|
1086
1182
|
const isAutoHeightCell = () => (autoHeightFlags() & 1) !== 0;
|
|
1087
1183
|
const alignTop = () => (autoHeightFlags() & 2) !== 0;
|
|
1088
1184
|
const markOverflowTooltip = () => shouldMarkCellOverflowTooltip({
|
|
1089
|
-
enabled:
|
|
1185
|
+
enabled: cellEnv().showCellOverflowTooltip,
|
|
1090
1186
|
isAutoHeightCell: isAutoHeightCell(),
|
|
1091
1187
|
hasRenderCell: column().renderCell !== void 0
|
|
1092
1188
|
});
|
|
@@ -1134,7 +1230,7 @@ function GridBodyLayer(props) {
|
|
|
1134
1230
|
"ssg-body-cell",
|
|
1135
1231
|
rowSlot().className,
|
|
1136
1232
|
conditionalCell().className,
|
|
1137
|
-
|
|
1233
|
+
cellEnv().bodyCellSlot?.className,
|
|
1138
1234
|
column().align === "center" && "ssg-body-cell--align-center",
|
|
1139
1235
|
column().align === "right" && "ssg-body-cell--align-right",
|
|
1140
1236
|
dataBar() !== null && "ssg-body-cell--cf-bar",
|
|
@@ -1158,11 +1254,11 @@ function GridBodyLayer(props) {
|
|
|
1158
1254
|
onDblClick={(event) => props.onCellDoubleClick(cell(), event)}
|
|
1159
1255
|
ref={markClickTarget}
|
|
1160
1256
|
style={{
|
|
1161
|
-
...
|
|
1257
|
+
...cellEnv().bodyCellSlot?.style,
|
|
1162
1258
|
...scaleBackground() !== null ? { "background-color": scaleBackground() } : null,
|
|
1163
1259
|
...rowSlot().style,
|
|
1164
1260
|
...conditionalCell().style,
|
|
1165
|
-
left: px(
|
|
1261
|
+
left: px(cellEnv().leadingWidth + entry().paneLocalStart),
|
|
1166
1262
|
width: px(size()),
|
|
1167
1263
|
"min-width": px(size()),
|
|
1168
1264
|
height: px(rowSize()),
|
|
@@ -2310,7 +2406,7 @@ function DefaultGridBottomBar(props) {
|
|
|
2310
2406
|
|
|
2311
2407
|
// src/devWarnings.ts
|
|
2312
2408
|
import { createEffect as createEffect3, createMemo as createMemo9 } from "solid-js";
|
|
2313
|
-
import { AUTO_HEIGHT_MAX_ROWS
|
|
2409
|
+
import { AUTO_HEIGHT_MAX_ROWS } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/verticalGeometry";
|
|
2314
2410
|
import { createInertExportCommands } from "@ishibashi0112/spreadsheet-grid-core/internal/engine/features";
|
|
2315
2411
|
import {
|
|
2316
2412
|
warnUnregisteredFeatureMethod,
|
|
@@ -2511,8 +2607,8 @@ function createShellDevWarningsInDev(args) {
|
|
|
2511
2607
|
warnOncePerGrid(
|
|
2512
2608
|
warned,
|
|
2513
2609
|
"detailMaxBody",
|
|
2514
|
-
`[SpreadsheetGrid] \u5C55\u958B\u884C\u306F\u8AD6\u7406\u5168\u9AD8(\u884C\u9AD8\u5408\u8A08 + \u5E2F\u9AD8)\u304C ${
|
|
2515
|
-
[SpreadsheetGrid] Detail rows are drawn only while the total height (rows + details) is at most ${
|
|
2610
|
+
`[SpreadsheetGrid] \u5C55\u958B\u884C\u306F\u8AD6\u7406\u5168\u9AD8(\u884C\u9AD8\u5408\u8A08 + \u5E2F\u9AD8)\u304C ${args.maxBodyPx()}px \u4EE5\u5185\u306E\u3068\u304D\u3060\u3051\u63CF\u753B\u3057\u307E\u3059(\u884C\u6570\u4E0A\u9650\u8D85\u904E)\u3002\u5C55\u958B\u72B6\u614B\u306F\u4FDD\u6301\u3055\u308C\u307E\u3059\u304C\u5E2F\u306F\u63CF\u304B\u308C\u307E\u305B\u3093\u3002
|
|
2611
|
+
[SpreadsheetGrid] Detail rows are drawn only while the total height (rows + details) is at most ${args.maxBodyPx()}px (too many rows). The expanded state is kept, but the details are not drawn.`
|
|
2516
2612
|
);
|
|
2517
2613
|
}
|
|
2518
2614
|
}
|
|
@@ -2734,6 +2830,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
2734
2830
|
const viewportWidth = createMemo10(() => view().viewportWidth);
|
|
2735
2831
|
const viewportHeight = createMemo10(() => view().viewportHeight);
|
|
2736
2832
|
const viewScrollTop = createMemo10(() => view().scrollTop);
|
|
2833
|
+
const viewMaxBodyPx = createMemo10(() => view().maxBodyPx);
|
|
2737
2834
|
const viewSetters = createGridViewSetters(store);
|
|
2738
2835
|
const { setHoveredColumnIndex, setIsCornerHovered, setEditorInitialValue } = viewSetters;
|
|
2739
2836
|
const gridRootRef = { current: null };
|
|
@@ -2978,7 +3075,8 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
2978
3075
|
detailIsExpandable: props.detailRow?.isExpandable,
|
|
2979
3076
|
detailIndexCacheRef: engine.detailIndexCache,
|
|
2980
3077
|
labelDisplay: labelDisplay(),
|
|
2981
|
-
labelRowHeight: labelRowHeightOption()
|
|
3078
|
+
labelRowHeight: labelRowHeightOption(),
|
|
3079
|
+
maxBodyPx: viewMaxBodyPx()
|
|
2982
3080
|
})
|
|
2983
3081
|
);
|
|
2984
3082
|
createShellDevWarnings({
|
|
@@ -2993,6 +3091,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
2993
3091
|
detailRowEnabled,
|
|
2994
3092
|
detailExtraCount: () => vertical().detailExtras.length,
|
|
2995
3093
|
detailActive: () => vertical().detailActive,
|
|
3094
|
+
maxBodyPx: () => viewMaxBodyPx() ?? MAX_BODY_PX,
|
|
2996
3095
|
globalFilterText,
|
|
2997
3096
|
columnFilterCount: () => Object.keys(columnFilters()).length
|
|
2998
3097
|
});
|
|
@@ -3528,7 +3627,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3528
3627
|
keyOf: resolvedRowKeyGetter(),
|
|
3529
3628
|
setExpandedKeys: (keys) => dispatch(gridActions.setExpandedDetailRowKeys(keys))
|
|
3530
3629
|
}), "render", "detailKeysPruner");
|
|
3531
|
-
const detailDrawable = createMemo10(() => vertical().baseRowMetrics.totalBodyHeight <=
|
|
3630
|
+
const detailDrawable = createMemo10(() => vertical().baseRowMetrics.totalBodyHeight <= (viewMaxBodyPx() ?? MAX_BODY_PX));
|
|
3532
3631
|
const hasDetailCards = createMemo10(() => detailRowEnabled() && vertical().detailEntries.length > 0);
|
|
3533
3632
|
const detailRows = createDetailRowController();
|
|
3534
3633
|
connectController(detailRows, () => ({
|
|
@@ -4681,6 +4780,24 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4681
4780
|
/>
|
|
4682
4781
|
</Show11>;
|
|
4683
4782
|
};
|
|
4783
|
+
const cellTextOf = (row, column) => {
|
|
4784
|
+
const value = getCellValue2(row, column);
|
|
4785
|
+
return column.valueFormatter ? column.valueFormatter({ value, row, column }) : String(value ?? "");
|
|
4786
|
+
};
|
|
4787
|
+
const splitFind = findFeature2?.splitTextByFindRanges;
|
|
4788
|
+
const highlightFind = (content, ranges, findCurrentIndex2) => {
|
|
4789
|
+
if (!splitFind || !ranges || ranges.length === 0) {
|
|
4790
|
+
return content;
|
|
4791
|
+
}
|
|
4792
|
+
return splitFind(content, ranges).map((segment) => {
|
|
4793
|
+
const range = segment.range;
|
|
4794
|
+
return range ? <mark class={["ssg-find-mark", { "ssg-find-mark--current": range.matchIndex === findCurrentIndex2() }]}>
|
|
4795
|
+
{segment.text}
|
|
4796
|
+
</mark> : segment.text;
|
|
4797
|
+
});
|
|
4798
|
+
};
|
|
4799
|
+
const isTextCellColumn = (column) => column.key !== ROW_DRAG_HANDLE_COLUMN_KEY2 && !column.renderCell && column.editor?.type !== "checkbox" && !(conditionalFormatFeature2 && (column.conditionalFormat?.chips !== void 0 || column.conditionalFormat?.dataBar?.showValue === false));
|
|
4800
|
+
const cellText = (row, column, ranges, findCurrentIndex2) => highlightFind(cellTextOf(row, column), ranges, findCurrentIndex2);
|
|
4684
4801
|
const renderCellContent = (currentRow, column, cell) => {
|
|
4685
4802
|
if (column.key === ROW_DRAG_HANDLE_COLUMN_KEY2) {
|
|
4686
4803
|
return renderRowDragHandleCell(currentRow(), cell);
|
|
@@ -4757,23 +4874,9 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4757
4874
|
setValue: (nextValue) => writeRenderedCellValue(cell.rowKey, unbound, nextValue)
|
|
4758
4875
|
});
|
|
4759
4876
|
}
|
|
4760
|
-
const textOf = (row) =>
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
};
|
|
4764
|
-
const splitFind = findFeature2?.splitTextByFindRanges;
|
|
4765
|
-
const highlightFind = (content) => {
|
|
4766
|
-
const ranges = cell.findRanges;
|
|
4767
|
-
if (!splitFind || !ranges || ranges.length === 0) {
|
|
4768
|
-
return content;
|
|
4769
|
-
}
|
|
4770
|
-
return splitFind(content, ranges).map((segment) => {
|
|
4771
|
-
const range = segment.range;
|
|
4772
|
-
return range ? <mark class={["ssg-find-mark", { "ssg-find-mark--current": range.matchIndex === cell.findCurrentIndex }]}>
|
|
4773
|
-
{segment.text}
|
|
4774
|
-
</mark> : segment.text;
|
|
4775
|
-
});
|
|
4776
|
-
};
|
|
4877
|
+
const textOf = (row) => cellTextOf(row, column);
|
|
4878
|
+
const findCurrentIndex2 = () => cell.findCurrentIndex;
|
|
4879
|
+
const highlightCellFind = (content) => highlightFind(content, cell.findRanges, findCurrentIndex2);
|
|
4777
4880
|
const formatRules = conditionalFormatFeature2 ? unbound.conditionalFormat : void 0;
|
|
4778
4881
|
if (formatRules?.dataBar?.showValue === false) {
|
|
4779
4882
|
textOf(currentRow());
|
|
@@ -4814,11 +4917,11 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4814
4917
|
}
|
|
4815
4918
|
})
|
|
4816
4919
|
);
|
|
4817
|
-
return <Show11 when={chip()} fallback={<span class="ssg-cell-value">{
|
|
4818
|
-
{(spec) => <GridChip2 spec={spec()}>{
|
|
4920
|
+
return <Show11 when={chip()} fallback={<span class="ssg-cell-value">{highlightCellFind(text)}</span>}>
|
|
4921
|
+
{(spec) => <GridChip2 spec={spec()}>{highlightCellFind(spec().label ?? text)}</GridChip2>}
|
|
4819
4922
|
</Show11>;
|
|
4820
4923
|
}
|
|
4821
|
-
return <span class="ssg-cell-value">{
|
|
4924
|
+
return <span class="ssg-cell-value">{highlightCellFind(textOf(currentRow()))}</span>;
|
|
4822
4925
|
};
|
|
4823
4926
|
const pinnedPaneStyle = (side, width, hasContent) => ({
|
|
4824
4927
|
position: "sticky",
|
|
@@ -5057,6 +5160,8 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5057
5160
|
activeCellDomId={activeCellDomId}
|
|
5058
5161
|
cellEditorDomId={cellEditorDomId}
|
|
5059
5162
|
renderCellContent={renderCellContent}
|
|
5163
|
+
isTextCellColumn={isTextCellColumn}
|
|
5164
|
+
cellText={cellText}
|
|
5060
5165
|
onRowHeaderPointerDown={pointer.handleRowHeaderPointerDown}
|
|
5061
5166
|
onRowHeaderPointerEnter={pointer.handleRowHeaderPointerEnter}
|
|
5062
5167
|
onRowHeaderPointerLeave={handleRowHeaderPointerLeave}
|
|
@@ -69,6 +69,8 @@ type GridBodyLayerProps<T> = {
|
|
|
69
69
|
activeCellDomId: string;
|
|
70
70
|
cellEditorDomId: string;
|
|
71
71
|
renderCellContent: (row: () => T, column: GridColumn<T>, cell: GridCellContentContext) => JSX.Element;
|
|
72
|
+
isTextCellColumn: (column: GridColumn<T>) => boolean;
|
|
73
|
+
cellText: (row: T, column: GridColumn<T>, findRanges: readonly FindRange[] | undefined, findCurrentIndex: () => number | null) => JSX.Element;
|
|
72
74
|
onRowHeaderPointerDown: (rowIndex: number, event: PointerEvent) => void;
|
|
73
75
|
onRowHeaderPointerEnter: (rowIndex: number, event: PointerEvent) => void;
|
|
74
76
|
onRowHeaderPointerLeave: (rowIndex: number) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ishibashi0112/spreadsheet-grid-solid",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Solid 2.0 向けの仮想化データグリッド。React 版(@ishibashi0112/spreadsheet-grid)と同じ props・同じ見た目で、SSRM(書き戻し付き)/ 行グルーピング + 集計 / Master/Detail / 範囲選択 + クリップボードを MIT で。IME に強い編集、100 万行の仮想化。コアは @ishibashi0112/spreadsheet-grid-core。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"solid",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"@tanstack/virtual-core": "^3.19.11",
|
|
104
|
-
"@ishibashi0112/spreadsheet-grid-core": "1.5.
|
|
104
|
+
"@ishibashi0112/spreadsheet-grid-core": "1.5.1"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@babel/core": "^7.28.0",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"react": "^19.3.0",
|
|
116
116
|
"react-dom": "^19.3.0",
|
|
117
117
|
"solid-js": "2.0.0",
|
|
118
|
-
"@ishibashi0112/spreadsheet-grid": "1.5.
|
|
118
|
+
"@ishibashi0112/spreadsheet-grid": "1.5.1"
|
|
119
119
|
},
|
|
120
120
|
"scripts": {
|
|
121
121
|
"dev": "vp dev --config vite.config.ts",
|