@ishibashi0112/spreadsheet-grid-solid 1.15.0 → 1.16.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.
@@ -33,7 +33,8 @@ import {
33
33
  import { merge } from "solid-js";
34
34
 
35
35
  // src/SpreadsheetGrid.tsx
36
- import { For as For6, Match, NoHydration, Show as Show13, Switch, createEffect as createEffect4, createMemo as createMemo10, createSignal as createSignal9, createUniqueId as createUniqueId3, isHydrating, latest as latest2, onCleanup as onCleanup8, runWithOwner as runWithOwner3, untrack as untrack13 } from "solid-js";
36
+ import { For as For6, Match, NoHydration, Show as Show13, Switch, createEffect as createEffect4, createMemo as createMemo10, createSignal as createSignal9, createUniqueId as createUniqueId3, flush, isHydrating, latest as latest2, onCleanup as onCleanup8, runWithOwner as runWithOwner3, untrack as untrack13 } from "solid-js";
37
+ import { INERT_CELL_SPAN_INDEX } from "@ishibashi0112/spreadsheet-grid-core/internal/engine/features";
37
38
  import { isServer } from "@solidjs/web";
38
39
  import { createGridEngine } from "@ishibashi0112/spreadsheet-grid-core/internal/engine/createGridEngine";
39
40
  import { gridActions } from "@ishibashi0112/spreadsheet-grid-core/internal/model/gridActions";
@@ -793,6 +794,23 @@ var NO_VALUE = () => null;
793
794
  var joinMarks = (first, second) => first === null ? second : second === null ? first : () => [first(), second()];
794
795
  var NO_SLOT = () => EMPTY_SLOT;
795
796
  var NO_FALSE = () => false;
797
+ var NO_SPAN = () => void 0;
798
+ var writeSpanAttributes = (element, draw) => {
799
+ const rows = draw && draw.rowSpan > 1 ? String(draw.rowSpan) : null;
800
+ const cols = draw && draw.colSpan > 1 ? String(draw.colSpan) : null;
801
+ for (const [name, value] of [
802
+ ["aria-rowspan", rows],
803
+ ["aria-colspan", cols],
804
+ ["data-ssg-row-span", rows],
805
+ ["data-ssg-col-span", cols]
806
+ ]) {
807
+ if (value === null) {
808
+ element.removeAttribute(name);
809
+ } else if (element.getAttribute(name) !== value) {
810
+ element.setAttribute(name, value);
811
+ }
812
+ }
813
+ };
796
814
  var EMPTY_NEW_ROW = /* @__PURE__ */ Object.freeze({});
797
815
  var renderNewRowPlaceholder = (text) => text === null ? null : <span class="ssg-new-row-placeholder">{text}</span>;
798
816
  var joinClasses = (...parts) => {
@@ -841,18 +859,30 @@ function GridBodyLayer(props) {
841
859
  if (row.skeleton) {
842
860
  return "skeleton";
843
861
  }
844
- if (row.newRow === true) {
862
+ if (row.newRow === true || row.spanGhost !== void 0) {
845
863
  return "keyed";
846
864
  }
847
865
  const model = props.rowModel;
848
866
  return model.getGroupRow?.(row.index) !== void 0 || model.getLabelRow?.(row.index) !== void 0 ? "keyed" : "data";
849
867
  };
868
+ const paneRows = createMemo5(() => {
869
+ const rows = props.rows;
870
+ if (!rows.some((row) => row.spanGhost !== void 0)) {
871
+ return rows;
872
+ }
873
+ const entries = props.entries;
874
+ return rows.filter((row) => {
875
+ const ghost = row.spanGhost;
876
+ return ghost === void 0 || entries.some((entry) => ghost.has(entry.logicalIndex));
877
+ });
878
+ });
850
879
  const slotted = createMemo5(
851
880
  (prev) => {
852
881
  const model = props.rowModel;
853
- return { state: assignRowSlots(prev?.state, props.rows, slotKindOf, prev?.model === model), model };
882
+ return { state: assignRowSlots(prev?.state, paneRows(), slotKindOf, prev?.model === model), model };
854
883
  }
855
884
  );
885
+ const spanOn = createMemo5(() => props.cellSpans !== void 0);
856
886
  const trackingOn = createMemo5(() => props.unsavedTracking !== void 0);
857
887
  const originalOn = createMemo5(() => props.unsavedTracking?.describeOriginal !== void 0);
858
888
  const treeKey = createMemo5(() => props.treeColumnKey);
@@ -972,6 +1002,24 @@ function GridBodyLayer(props) {
972
1002
  }
973
1003
  const sourceRowIndex = isEntry || isRemoved ? () => -1 : createMemo5(() => props.rowModel.getSourceIndex(rowIndex()) ?? rowIndex());
974
1004
  const rowSize = createMemo5(() => item().size ?? props.rowHeight);
1005
+ const isGhost = untrack3(() => item().spanGhost) !== void 0;
1006
+ const rowSpans = createMemoWhen(
1007
+ spanOn,
1008
+ () => props.cellSpans?.forRow(rowIndex()),
1009
+ void 0
1010
+ );
1011
+ const rowEntries = createMemo5(() => {
1012
+ const ghostCols = isGhost ? item().spanGhost : void 0;
1013
+ const base = ghostCols ? props.entries.filter((entry) => ghostCols.has(entry.logicalIndex)) : props.entries;
1014
+ const spans = rowSpans();
1015
+ if (!spans) {
1016
+ return base;
1017
+ }
1018
+ const extras = props.pane === "center" ? spans.centerExtras : void 0;
1019
+ const withExtras = extras && extras.length > 0 ? [...extras, ...base] : base;
1020
+ return spans.hidden.size > 0 ? withExtras.filter((entry) => !spans.hidden.has(entry.logicalIndex)) : withExtras;
1021
+ });
1022
+ const spanHost = () => rowSpans()?.host === true;
975
1023
  const isRowChecked = createMemo5(
976
1024
  () => props.enableRowSelection && !isEntry && !isRemoved ? resolveIsRowSelected(props.rowSelectionState, rowKey()) : false
977
1025
  );
@@ -1181,279 +1229,308 @@ ${decoration}`;
1181
1229
  {trailingMark}
1182
1230
  </div>;
1183
1231
  };
1184
- const cells = () => <For2 each={props.entries} keyed={cellKey}>
1232
+ const cells = () => {
1233
+ const spanMode = untrack3(spanOn);
1234
+ return <For2 each={rowEntries()} keyed={cellKey}>
1185
1235
  {(entry) => {
1186
- const shape = untrack3(() => cellShapeOf(entry().column));
1187
- if (shape === "text" && !isEntry && !isRemoved) {
1188
- return renderTextCell(entry);
1189
- }
1190
- const plain = shape !== "decorated";
1191
- const newRowSynthetic = isEntry && untrack3(() => isSyntheticColumnKey2(entry().column.key));
1192
- const removedSynthetic = isRemoved && untrack3(() => isSyntheticColumnKey2(entry().column.key));
1193
- const decorOff = newRowSynthetic || isRemoved ? () => true : newRowBlank;
1194
- const unbound = createMemo5(() => entry().column);
1195
- const column = () => unbound();
1196
- const colIndex = createMemo5(() => entry().logicalIndex);
1197
- const size = () => entry().paneLocalSize;
1198
- const isActive = () => activeCol() === colIndex();
1199
- const isEditing = () => editingCol() === colIndex();
1200
- const isSelected = () => isRowSelected() || selectedColStart() >= 0 && colIndex() >= selectedColStart() && colIndex() <= selectedColEnd();
1201
- const readOnlyCell = () => {
1202
- if (isRemoved) {
1203
- return true;
1236
+ const shape = untrack3(() => cellShapeOf(entry().column));
1237
+ if (shape === "text" && !isEntry && !isRemoved && !spanMode) {
1238
+ return renderTextCell(entry);
1204
1239
  }
1205
- const env = editPermission();
1206
- return !isColumnEditable(env.readOnly, unbound()) || env.canEditCell !== void 0 && !newRowBlank() && !isCellEditable(env, rowIndex() + rowOffset(), colIndex(), currentRow(), unbound(), {
1207
- sourceRowIndex: sourceRowIndex(),
1208
- rowKey: rowKey()
1240
+ const plain = shape !== "decorated";
1241
+ const newRowSynthetic = isEntry && untrack3(() => isSyntheticColumnKey2(entry().column.key));
1242
+ const removedSynthetic = isRemoved && untrack3(() => isSyntheticColumnKey2(entry().column.key));
1243
+ const decorOff = newRowSynthetic || isRemoved ? () => true : newRowBlank;
1244
+ const unbound = createMemo5(() => entry().column);
1245
+ const column = () => unbound();
1246
+ const colIndex = createMemo5(() => entry().logicalIndex);
1247
+ const spanDraw = spanMode ? createMemo5(() => rowSpans()?.cells.get(colIndex())) : NO_SPAN;
1248
+ const spanned = spanMode ? createMemo5(() => spanDraw() !== void 0) : NO_FALSE;
1249
+ const size = () => spanDraw()?.width ?? entry().paneLocalSize;
1250
+ const isActive = () => activeCol() === colIndex();
1251
+ const isEditing = () => editingCol() === colIndex();
1252
+ const isSelected = () => isRowSelected() || selectedColStart() >= 0 && colIndex() >= selectedColStart() && colIndex() <= selectedColEnd();
1253
+ const readOnlyCell = () => {
1254
+ if (isRemoved) {
1255
+ return true;
1256
+ }
1257
+ const env = editPermission();
1258
+ return !isColumnEditable(env.readOnly, unbound()) || env.canEditCell !== void 0 && !newRowBlank() && !isCellEditable(env, rowIndex() + rowOffset(), colIndex(), currentRow(), unbound(), {
1259
+ sourceRowIndex: sourceRowIndex(),
1260
+ rowKey: rowKey()
1261
+ });
1262
+ };
1263
+ const value = () => getCellValue(currentRow(), unbound());
1264
+ const treeAggregates = () => {
1265
+ const aggregates = treeRow()?.aggregates;
1266
+ return aggregates !== void 0 && Object.prototype.hasOwnProperty.call(aggregates, column().key) ? aggregates : void 0;
1267
+ };
1268
+ const shownValue = () => {
1269
+ const aggregates = treeAggregates();
1270
+ return aggregates !== void 0 ? aggregates[column().key] : value();
1271
+ };
1272
+ const findRanges = createMemoWhen(
1273
+ () => rowFindHits()?.has(colIndex()) === true,
1274
+ () => rowFindHits()?.get(colIndex()),
1275
+ void 0
1276
+ );
1277
+ const cellState = {
1278
+ get rowIndex() {
1279
+ return rowIndex();
1280
+ },
1281
+ get colIndex() {
1282
+ return colIndex();
1283
+ },
1284
+ get sourceRowIndex() {
1285
+ return sourceRowIndex();
1286
+ },
1287
+ get rowKey() {
1288
+ return rowKey();
1289
+ },
1290
+ get findRanges() {
1291
+ return findRanges();
1292
+ },
1293
+ get findCurrentIndex() {
1294
+ return rowFindCurrent();
1295
+ },
1296
+ get treeRow() {
1297
+ return treeRow();
1298
+ },
1299
+ get isActive() {
1300
+ return isActive();
1301
+ },
1302
+ get isSelected() {
1303
+ return isSelected();
1304
+ },
1305
+ get isEditing() {
1306
+ return isEditing();
1307
+ },
1308
+ get readOnly() {
1309
+ return readOnlyCell();
1310
+ }
1311
+ };
1312
+ const needsStyleContext = () => typeof column().cellClassName === "function" || !!column().cellNote;
1313
+ const styleContext = plain ? NO_VALUE : createMemoWhen(
1314
+ () => !decorOff() && needsStyleContext(),
1315
+ () => ({
1316
+ row: currentRow(),
1317
+ rowIndex: rowIndex() + rowOffset(),
1318
+ sourceRowIndex: sourceRowIndex(),
1319
+ rowKey: rowKey(),
1320
+ colIndex: colIndex(),
1321
+ value: shownValue(),
1322
+ column: column(),
1323
+ isActive: isActive(),
1324
+ isSelected: isSelected(),
1325
+ isEditing: isEditing(),
1326
+ readOnly: readOnlyCell(),
1327
+ // 追加(1.9.0 の点検 案 A): ツリーデータの行のセルのときだけ、深さ・子の有無・開閉と集計のセルか(React 版と同じ)。
1328
+ ...treeStyleOf(treeRow(), treeAggregates() !== void 0)
1329
+ }),
1330
+ null
1331
+ );
1332
+ const conditionalCell = plain || newRowSynthetic || removedSynthetic ? NO_SLOT : createMemoWhen(
1333
+ () => column().cellClassName !== void 0,
1334
+ () => {
1335
+ const cellClassName = column().cellClassName;
1336
+ const context = styleContext();
1337
+ return resolveSlotProps(
1338
+ typeof cellClassName === "function" ? context ? cellClassName(context) : void 0 : cellClassName
1339
+ );
1340
+ },
1341
+ resolveSlotProps(void 0)
1342
+ );
1343
+ const formatRules = () => props.conditionalFormat && !decorOff() ? column().conditionalFormat : void 0;
1344
+ const dataBar = plain ? NO_VALUE : createMemoWhen(
1345
+ () => formatRules()?.dataBar !== void 0,
1346
+ () => {
1347
+ const feature = props.conditionalFormat;
1348
+ const rules = formatRules();
1349
+ return feature && rules?.dataBar && treeAggregates() === void 0 ? feature.resolveDataBar(rules.dataBar, value(), props.conditionalFormatStats.get(column().key)) : null;
1350
+ },
1351
+ null
1352
+ );
1353
+ const scaleBackground = plain ? NO_VALUE : createMemoWhen(
1354
+ () => formatRules()?.colorScale !== void 0,
1355
+ () => {
1356
+ const feature = props.conditionalFormat;
1357
+ const rules = formatRules();
1358
+ return feature && rules?.colorScale && treeAggregates() === void 0 ? feature.resolveColorScaleBackground(
1359
+ rules.colorScale,
1360
+ value(),
1361
+ props.conditionalFormatStats.get(column().key)
1362
+ ) : null;
1363
+ },
1364
+ null
1365
+ );
1366
+ const dataBarColor = () => {
1367
+ const bar = dataBar();
1368
+ const rules = formatRules()?.dataBar;
1369
+ return bar ? bar.negative ? rules?.negativeColor : rules?.color : void 0;
1370
+ };
1371
+ const invalidMessage = plain ? NO_VALUE : createMemoWhen(
1372
+ () => !decorOff() && !!props.showValidationMarks && hasCellValidation(unbound()),
1373
+ () => treeAggregates() !== void 0 ? null : getInvalidMessage(unbound(), currentRow(), value(), texts()),
1374
+ null
1375
+ );
1376
+ const cellNote = plain ? NO_VALUE : createMemoWhen(
1377
+ () => !decorOff() && !!column().cellNote,
1378
+ () => {
1379
+ const note = column().cellNote;
1380
+ const context = styleContext();
1381
+ return note && context ? normalizeCellNote(note(context)) : null;
1382
+ },
1383
+ null
1384
+ );
1385
+ const unsavedText = unsavedTextOf(untrack3(unbound).key);
1386
+ const unsavedMark = unsavedMarkOf(unsavedText);
1387
+ const originalText = originalTextOf(untrack3(unbound).key);
1388
+ const trailingMark = joinMarks(originalMarkOf(originalText), unsavedMark);
1389
+ const tooltipText = () => resolveCellTooltipText(invalidMessage(), cellNote(), unsavedText());
1390
+ const autoHeightFlags = createMemoWhen(
1391
+ rowAutoHeight,
1392
+ () => {
1393
+ const content = column().autoHeight === true;
1394
+ const top = rowSize() > props.rowHeight && (column().verticalAlign ?? props.verticalAlign ?? (content ? "top" : "center")) === "top";
1395
+ return (content ? 1 : 0) | (top ? 2 : 0);
1396
+ },
1397
+ 0
1398
+ );
1399
+ const isAutoHeightCell = () => (autoHeightFlags() & 1) !== 0 && !spanned();
1400
+ const alignTop = () => (autoHeightFlags() & 2) !== 0;
1401
+ const markOverflowTooltip = () => shouldMarkCellOverflowTooltip({
1402
+ enabled: cellEnv().showCellOverflowTooltip,
1403
+ isAutoHeightCell: isAutoHeightCell(),
1404
+ hasRenderCell: column().renderCell !== void 0
1209
1405
  });
1210
- };
1211
- const value = () => getCellValue(currentRow(), unbound());
1212
- const treeAggregates = () => {
1213
- const aggregates = treeRow()?.aggregates;
1214
- return aggregates !== void 0 && Object.prototype.hasOwnProperty.call(aggregates, column().key) ? aggregates : void 0;
1215
- };
1216
- const shownValue = () => {
1217
- const aggregates = treeAggregates();
1218
- return aggregates !== void 0 ? aggregates[column().key] : value();
1219
- };
1220
- const findRanges = createMemoWhen(
1221
- () => rowFindHits()?.has(colIndex()) === true,
1222
- () => rowFindHits()?.get(colIndex()),
1223
- void 0
1224
- );
1225
- const cellState = {
1226
- get rowIndex() {
1227
- return rowIndex();
1228
- },
1229
- get colIndex() {
1230
- return colIndex();
1231
- },
1232
- get sourceRowIndex() {
1233
- return sourceRowIndex();
1234
- },
1235
- get rowKey() {
1236
- return rowKey();
1237
- },
1238
- get findRanges() {
1239
- return findRanges();
1240
- },
1241
- get findCurrentIndex() {
1242
- return rowFindCurrent();
1243
- },
1244
- get treeRow() {
1245
- return treeRow();
1246
- },
1247
- get isActive() {
1248
- return isActive();
1249
- },
1250
- get isSelected() {
1251
- return isSelected();
1252
- },
1253
- get isEditing() {
1254
- return isEditing();
1255
- },
1256
- get readOnly() {
1257
- return readOnlyCell();
1258
- }
1259
- };
1260
- const needsStyleContext = () => typeof column().cellClassName === "function" || !!column().cellNote;
1261
- const styleContext = plain ? NO_VALUE : createMemoWhen(
1262
- () => !decorOff() && needsStyleContext(),
1263
- () => ({
1264
- row: currentRow(),
1265
- rowIndex: rowIndex() + rowOffset(),
1266
- sourceRowIndex: sourceRowIndex(),
1267
- rowKey: rowKey(),
1268
- colIndex: colIndex(),
1269
- value: shownValue(),
1270
- column: column(),
1271
- isActive: isActive(),
1272
- isSelected: isSelected(),
1273
- isEditing: isEditing(),
1274
- readOnly: readOnlyCell(),
1275
- // 追加(1.9.0 の点検 案 A): ツリーデータの行のセルのときだけ、深さ・子の有無・開閉と集計のセルか(React 版と同じ)。
1276
- ...treeStyleOf(treeRow(), treeAggregates() !== void 0)
1277
- }),
1278
- null
1279
- );
1280
- const conditionalCell = plain || newRowSynthetic || removedSynthetic ? NO_SLOT : createMemoWhen(
1281
- () => column().cellClassName !== void 0,
1282
- () => {
1283
- const cellClassName = column().cellClassName;
1284
- const context = styleContext();
1285
- return resolveSlotProps(
1286
- typeof cellClassName === "function" ? context ? cellClassName(context) : void 0 : cellClassName
1287
- );
1288
- },
1289
- resolveSlotProps(void 0)
1290
- );
1291
- const formatRules = () => props.conditionalFormat && !decorOff() ? column().conditionalFormat : void 0;
1292
- const dataBar = plain ? NO_VALUE : createMemoWhen(
1293
- () => formatRules()?.dataBar !== void 0,
1294
- () => {
1295
- const feature = props.conditionalFormat;
1296
- const rules = formatRules();
1297
- return feature && rules?.dataBar && treeAggregates() === void 0 ? feature.resolveDataBar(rules.dataBar, value(), props.conditionalFormatStats.get(column().key)) : null;
1298
- },
1299
- null
1300
- );
1301
- const scaleBackground = plain ? NO_VALUE : createMemoWhen(
1302
- () => formatRules()?.colorScale !== void 0,
1303
- () => {
1304
- const feature = props.conditionalFormat;
1305
- const rules = formatRules();
1306
- return feature && rules?.colorScale && treeAggregates() === void 0 ? feature.resolveColorScaleBackground(
1307
- rules.colorScale,
1308
- value(),
1309
- props.conditionalFormatStats.get(column().key)
1310
- ) : null;
1311
- },
1312
- null
1313
- );
1314
- const dataBarColor = () => {
1315
- const bar = dataBar();
1316
- const rules = formatRules()?.dataBar;
1317
- return bar ? bar.negative ? rules?.negativeColor : rules?.color : void 0;
1318
- };
1319
- const invalidMessage = plain ? NO_VALUE : createMemoWhen(
1320
- () => !decorOff() && !!props.showValidationMarks && hasCellValidation(unbound()),
1321
- () => treeAggregates() !== void 0 ? null : getInvalidMessage(unbound(), currentRow(), value(), texts()),
1322
- null
1323
- );
1324
- const cellNote = plain ? NO_VALUE : createMemoWhen(
1325
- () => !decorOff() && !!column().cellNote,
1326
- () => {
1327
- const note = column().cellNote;
1328
- const context = styleContext();
1329
- return note && context ? normalizeCellNote(note(context)) : null;
1330
- },
1331
- null
1332
- );
1333
- const unsavedText = unsavedTextOf(untrack3(unbound).key);
1334
- const unsavedMark = unsavedMarkOf(unsavedText);
1335
- const originalText = originalTextOf(untrack3(unbound).key);
1336
- const trailingMark = joinMarks(originalMarkOf(originalText), unsavedMark);
1337
- const tooltipText = () => resolveCellTooltipText(invalidMessage(), cellNote(), unsavedText());
1338
- const autoHeightFlags = createMemoWhen(
1339
- rowAutoHeight,
1340
- () => {
1341
- const content = column().autoHeight === true;
1342
- const top = rowSize() > props.rowHeight && (column().verticalAlign ?? props.verticalAlign ?? (content ? "top" : "center")) === "top";
1343
- return (content ? 1 : 0) | (top ? 2 : 0);
1344
- },
1345
- 0
1346
- );
1347
- const isAutoHeightCell = () => (autoHeightFlags() & 1) !== 0;
1348
- const alignTop = () => (autoHeightFlags() & 2) !== 0;
1349
- const markOverflowTooltip = () => shouldMarkCellOverflowTooltip({
1350
- enabled: cellEnv().showCellOverflowTooltip,
1351
- isAutoHeightCell: isAutoHeightCell(),
1352
- hasRenderCell: column().renderCell !== void 0
1353
- });
1354
- const cell = () => ({ row: rowIndex(), col: colIndex() });
1355
- const keyedContent = untrack3(() => entry().column.renderCell !== void 0);
1356
- const contentColumn = isRemoved ? createMemo5(() => {
1357
- const current = column();
1358
- return current.renderCell || current.conditionalFormat ? { ...current, renderCell: void 0, conditionalFormat: void 0 } : current;
1359
- }) : column;
1360
- const cellChildren = plain ? () => props.renderCellContent(currentRow, contentColumn(), cellState) : () => <>
1406
+ const cell = () => ({ row: rowIndex(), col: colIndex() });
1407
+ const keyedContent = untrack3(() => entry().column.renderCell !== void 0);
1408
+ const contentColumn = isRemoved ? createMemo5(() => {
1409
+ const current = column();
1410
+ return current.renderCell || current.conditionalFormat ? { ...current, renderCell: void 0, conditionalFormat: void 0 } : current;
1411
+ }) : column;
1412
+ const cellChildren = plain ? () => props.renderCellContent(currentRow, contentColumn(), cellState) : () => <>
1361
1413
  <Show2 when={dataBar()}>
1362
1414
  {(bar) => <span
1363
- class={["ssg-cf-bar", { "ssg-cf-bar--negative": bar().negative }]}
1364
- style={{
1365
- left: `${bar().start}%`,
1366
- width: `${bar().end - bar().start}%`,
1367
- ...dataBarColor() ? { "background-color": dataBarColor() } : null
1368
- }}
1369
- aria-hidden="true"
1370
- />}
1415
+ class={["ssg-cf-bar", { "ssg-cf-bar--negative": bar().negative }]}
1416
+ style={{
1417
+ left: `${bar().start}%`,
1418
+ width: `${bar().end - bar().start}%`,
1419
+ ...dataBarColor() ? { "background-color": dataBarColor() } : null
1420
+ }}
1421
+ aria-hidden="true"
1422
+ />}
1371
1423
  </Show2>
1372
1424
  <Show2
1373
- when={isAutoHeightCell()}
1374
- fallback={props.renderCellContent(currentRow, contentColumn(), cellState)}
1375
- >
1425
+ when={isAutoHeightCell()}
1426
+ fallback={props.renderCellContent(currentRow, contentColumn(), cellState)}
1427
+ >
1376
1428
  <div class="ssg-autoheight-content" data-autoheight-content="">
1377
1429
  {props.renderCellContent(currentRow, contentColumn(), cellState)}
1378
1430
  </div>
1379
1431
  </Show2>
1380
1432
  </>;
1381
- const dataContent = keyedContent ? () => {
1382
- rowKey();
1383
- return cellChildren();
1384
- } : cellChildren;
1385
- const cellContent = removedSynthetic ? NO_VALUE : !isEntry ? dataContent : newRowSynthetic ? NO_VALUE : () => newRowBlank() ? renderNewRowPlaceholder(isEditing() ? null : props.newRowLayer?.placeholder(column()) ?? null) : dataContent();
1386
- return <div
1387
- role="gridcell"
1388
- aria-colindex={colIndex() + 2}
1389
- aria-selected={isSelected() ? "true" : "false"}
1390
- aria-readonly={readOnlyCell() ? "true" : void 0}
1391
- aria-invalid={invalidMessage() !== null ? "true" : void 0}
1392
- aria-description={describeCell(tooltipText(), isActive())}
1393
- id={isActive() ? props.activeCellDomId : void 0}
1394
- aria-owns={isEditing() ? props.cellEditorDomId : void 0}
1395
- data-ssg-col-key={column().key}
1396
- data-autoheight-cell={isAutoHeightCell() ? "" : void 0}
1397
- data-ssg-tooltip={tooltipText() ?? void 0}
1398
- data-ssg-tooltip-overflow={markOverflowTooltip() ? "" : void 0}
1399
- class={joinClasses(
1400
- "ssg-body-cell",
1401
- treeRow() !== void 0 && column().key === props.treeColumnKey && "ssg-tree-cell",
1402
- rowSlot().className,
1403
- conditionalCell().className,
1404
- cellEnv().bodyCellSlot?.className,
1405
- column().align === "center" && "ssg-body-cell--align-center",
1406
- column().align === "right" && "ssg-body-cell--align-right",
1407
- dataBar() !== null && "ssg-body-cell--cf-bar",
1408
- scaleBackground() !== null && "ssg-body-cell--cf-scale",
1409
- formatRules()?.chips !== void 0 && size() < CHIP_COMPACT_MAX_WIDTH && "ssg-body-cell--chip-compact",
1410
- isAutoHeightCell() && "ssg-body-cell--autoheight",
1411
- alignTop() && "ssg-body-cell--valign-top",
1412
- readOnlyCell() && !isSelected() && "ssg-body-cell--readonly",
1413
- // 追加(1.9.0 の点検 案 A「今の見た目 + 目印のクラス」): 子を持つ行の集計のセル(公開の契約)。
1414
- treeAggregates() !== void 0 && "ssg-body-cell--tree-aggregate",
1415
- invalidMessage() !== null && "ssg-body-cell--invalid",
1416
- cellNote() !== null && "ssg-body-cell--has-note",
1417
- unsavedText() !== null && "ssg-body-cell--unsaved",
1418
- originalText() !== null && "ssg-body-cell--with-original",
1419
- isHovered() && "ssg-body-cell--row-hovered"
1420
- )}
1421
- onPointerDown={(event) => {
1422
- if (isRemoved) {
1423
- return;
1424
- }
1425
- if (event.target instanceof Element && event.target.closest(".ssg-detail-toggle, .ssg-tree-toggle")) {
1426
- return;
1427
- }
1428
- props.onCellPointerDown(cell(), event);
1429
- }}
1430
- onPointerEnter={isRemoved ? IGNORE_POINTER : (event) => props.onCellPointerEnter(cell(), event)}
1431
- onClick={isRemoved ? IGNORE_POINTER : (event) => props.onCellClick(cell(), event)}
1432
- onDblClick={isRemoved ? IGNORE_POINTER : (event) => props.onCellDoubleClick(cell(), event)}
1433
- ref={markClickTarget}
1434
- style={{
1435
- ...cellEnv().bodyCellSlot?.style,
1436
- ...scaleBackground() !== null ? { "background-color": scaleBackground() } : null,
1437
- ...rowSlot().style,
1438
- ...conditionalCell().style,
1439
- left: px(cellEnv().leadingWidth + entry().paneLocalStart),
1440
- width: px(size()),
1441
- "min-width": px(size()),
1442
- height: px(rowSize()),
1443
- "word-break": column().wordBreak,
1444
- "line-break": column().lineBreak,
1445
- "z-index": isActive() ? 3 : 1
1446
- }}
1447
- >
1448
- {cellContent()}
1433
+ const dataContent = keyedContent ? () => {
1434
+ rowKey();
1435
+ return cellChildren();
1436
+ } : cellChildren;
1437
+ const cellContent = removedSynthetic ? NO_VALUE : !isEntry ? dataContent : newRowSynthetic ? NO_VALUE : () => newRowBlank() ? renderNewRowPlaceholder(isEditing() ? null : props.newRowLayer?.placeholder(column()) ?? null) : dataContent();
1438
+ const shownContent = spanMode ? () => <Show2 when={spanned()} fallback={cellContent()}>
1439
+ <div
1440
+ class="ssg-cell-span-content"
1441
+ style={{ top: px(props.spanStickyTop ?? 0), height: px(rowSize()) }}
1442
+ >
1443
+ {cellContent()}
1444
+ </div>
1445
+ </Show2> : cellContent;
1446
+ let spanElement;
1447
+ if (spanMode) {
1448
+ createRenderEffect(spanDraw, (draw) => {
1449
+ if (spanElement) {
1450
+ writeSpanAttributes(spanElement, draw);
1451
+ }
1452
+ });
1453
+ }
1454
+ const bindSpanAttributes = (element) => {
1455
+ markClickTarget(element);
1456
+ spanElement = element;
1457
+ writeSpanAttributes(element, untrack3(spanDraw));
1458
+ };
1459
+ return <div
1460
+ role="gridcell"
1461
+ aria-colindex={colIndex() + 2}
1462
+ aria-selected={isSelected() ? "true" : "false"}
1463
+ aria-readonly={readOnlyCell() ? "true" : void 0}
1464
+ aria-invalid={invalidMessage() !== null ? "true" : void 0}
1465
+ aria-description={describeCell(tooltipText(), isActive())}
1466
+ id={isActive() ? props.activeCellDomId : void 0}
1467
+ aria-owns={isEditing() ? props.cellEditorDomId : void 0}
1468
+ data-ssg-col-key={column().key}
1469
+ data-autoheight-cell={isAutoHeightCell() ? "" : void 0}
1470
+ data-ssg-tooltip={tooltipText() ?? void 0}
1471
+ data-ssg-tooltip-overflow={markOverflowTooltip() ? "" : void 0}
1472
+ class={joinClasses(
1473
+ "ssg-body-cell",
1474
+ treeRow() !== void 0 && column().key === props.treeColumnKey && "ssg-tree-cell",
1475
+ rowSlot().className,
1476
+ conditionalCell().className,
1477
+ cellEnv().bodyCellSlot?.className,
1478
+ column().align === "center" && "ssg-body-cell--align-center",
1479
+ column().align === "right" && "ssg-body-cell--align-right",
1480
+ dataBar() !== null && "ssg-body-cell--cf-bar",
1481
+ scaleBackground() !== null && "ssg-body-cell--cf-scale",
1482
+ formatRules()?.chips !== void 0 && size() < CHIP_COMPACT_MAX_WIDTH && "ssg-body-cell--chip-compact",
1483
+ isAutoHeightCell() && "ssg-body-cell--autoheight",
1484
+ alignTop() && "ssg-body-cell--valign-top",
1485
+ readOnlyCell() && !isSelected() && "ssg-body-cell--readonly",
1486
+ // 追加(1.9.0 の点検 案 A「今の見た目 + 目印のクラス」): 子を持つ行の集計のセル(公開の契約)。
1487
+ treeAggregates() !== void 0 && "ssg-body-cell--tree-aggregate",
1488
+ invalidMessage() !== null && "ssg-body-cell--invalid",
1489
+ cellNote() !== null && "ssg-body-cell--has-note",
1490
+ unsavedText() !== null && "ssg-body-cell--unsaved",
1491
+ originalText() !== null && "ssg-body-cell--with-original",
1492
+ // 変更(1.16.0): 結合のセルは行のホバーの色を塗りません(ほかの行にもかかるため)。
1493
+ isHovered() && !spanned() && "ssg-body-cell--row-hovered",
1494
+ spanned() && "ssg-body-cell--spanned"
1495
+ )}
1496
+ onPointerDown={(event) => {
1497
+ if (isRemoved) {
1498
+ return;
1499
+ }
1500
+ if (event.target instanceof Element && event.target.closest(".ssg-detail-toggle, .ssg-tree-toggle")) {
1501
+ return;
1502
+ }
1503
+ props.onCellPointerDown(cell(), event);
1504
+ }}
1505
+ onPointerEnter={isRemoved ? IGNORE_POINTER : (event) => props.onCellPointerEnter(cell(), event)}
1506
+ onClick={isRemoved ? IGNORE_POINTER : (event) => props.onCellClick(cell(), event)}
1507
+ onDblClick={isRemoved ? IGNORE_POINTER : (event) => props.onCellDoubleClick(cell(), event)}
1508
+ ref={spanMode ? bindSpanAttributes : markClickTarget}
1509
+ style={{
1510
+ ...cellEnv().bodyCellSlot?.style,
1511
+ ...scaleBackground() !== null ? { "background-color": scaleBackground() } : null,
1512
+ ...rowSlot().style,
1513
+ ...conditionalCell().style,
1514
+ left: px(cellEnv().leadingWidth + entry().paneLocalStart),
1515
+ width: px(size()),
1516
+ "min-width": px(size()),
1517
+ height: px(spanDraw()?.height ?? rowSize()),
1518
+ "word-break": column().wordBreak,
1519
+ "line-break": column().lineBreak,
1520
+ "z-index": isActive() ? 3 : 1
1521
+ }}
1522
+ >
1523
+ {shownContent()}
1449
1524
  {trailingMark}
1450
1525
  </div>;
1451
- }}
1526
+ }}
1452
1527
  </For2>;
1528
+ };
1453
1529
  const switchedCells = createMemo5(() => {
1454
1530
  trackingOn();
1455
1531
  originalOn();
1456
1532
  treeKey();
1533
+ spanOn();
1457
1534
  return untrack3(cells);
1458
1535
  });
1459
1536
  return <div
@@ -1485,16 +1562,19 @@ ${decoration}`;
1485
1562
  isEntry && "ssg-body-row--new",
1486
1563
  // 追加(1.13.0 / 差分の表示): 削除の行と、変更を回って着いた削除の行。
1487
1564
  isRemoved && "ssg-body-row--removed",
1488
- isRemoved && props.changeNavRowKey !== null && props.changeNavRowKey !== void 0 && props.changeNavRowKey === rowKey() && "ssg-body-row--change-target"
1565
+ isRemoved && props.changeNavRowKey !== null && props.changeNavRowKey !== void 0 && props.changeNavRowKey === rowKey() && "ssg-body-row--change-target",
1566
+ // 追加(1.16.0 の別視点のレビュー): 縦の結合を描く行(内部のクラス。行の枠は押せず、塗りはセルで)。
1567
+ spanHost() && "ssg-body-row--span-host"
1489
1568
  )}
1490
1569
  style={{
1491
1570
  ...props.slots.bodyRow?.style,
1492
1571
  ...rowSlot().style,
1493
1572
  height: px(rowSize()),
1494
- transform: `translateY(${item().start}px)`
1573
+ // 変更(1.16.0): 縦の結合を描く行は top で置き(中身の sticky を効かせる)、塗りの閉じ込めを外して下の行に重ねます。
1574
+ ...spanHost() ? { top: px(item().start), transform: "none", contain: "layout style", "z-index": 1 } : { transform: `translateY(${item().start}px)` }
1495
1575
  }}
1496
1576
  >
1497
- <Show2 when={props.ownsRowHeader}>
1577
+ <Show2 when={props.ownsRowHeader && !isGhost}>
1498
1578
  <div
1499
1579
  role="rowheader"
1500
1580
  aria-colindex={1}
@@ -2580,7 +2660,7 @@ function CellEditorLayer(props) {
2580
2660
  get onCommitToSelection() {
2581
2661
  return props.onCommitToSelection;
2582
2662
  },
2583
- onRegisterFlush: (flush) => props.onRegisterFlush?.(flush)
2663
+ onRegisterFlush: (flush2) => props.onRegisterFlush?.(flush2)
2584
2664
  };
2585
2665
  const initialValue = untrack11(props.initialValue);
2586
2666
  if (type === "select" || type === "custom") {
@@ -3009,6 +3089,15 @@ var FEATURE_PROPS = {
3009
3089
  rangeDecorations: [{ prop: "rangeDecorations", isUsed: (props) => (props.rangeDecorations?.length ?? 0) > 0 }],
3010
3090
  // 追加(1.15.0 / ページ送り)
3011
3091
  pagination: [{ prop: "pagination", isUsed: (props) => props.pagination !== void 0 && props.pagination !== false }],
3092
+ // 追加(1.16.0 / セルの結合): どれか 1 列でも spanRows / colSpan を書いたら(機能が無いとふつうのセルで描く)。
3093
+ cellSpan: [
3094
+ {
3095
+ prop: "columns[].spanRows / colSpan",
3096
+ isUsed: (props) => props.columns.some(
3097
+ (column) => column.spanRows !== void 0 && column.spanRows !== false || typeof column.colSpan === "function"
3098
+ )
3099
+ }
3100
+ ],
3012
3101
  // 追加(1.10.0 / Excel のキー): 切り取り以外のキーを効かせたとき(切り取りは本体なので、既定の省略では警告しない)。
3013
3102
  excelShortcuts: [
3014
3103
  {
@@ -3286,6 +3375,12 @@ function createShellDevWarningsInDev(args) {
3286
3375
  warnOncePerGrid(treeDataWarned, warning.id, warning.message);
3287
3376
  }
3288
3377
  });
3378
+ const cellSpanWarned = /* @__PURE__ */ new Set();
3379
+ createChangeEffect(args.cellSpanWarnings, (warnings) => {
3380
+ for (const warning of warnings) {
3381
+ warnOncePerGrid(cellSpanWarned, warning.id, warning.message);
3382
+ }
3383
+ });
3289
3384
  const multiSelectWarned = /* @__PURE__ */ new Set();
3290
3385
  createChangeEffect(args.multiSelectWarnings, (warnings) => {
3291
3386
  for (const warning of warnings) {
@@ -4115,6 +4210,13 @@ function GridShellBody(props, features, mountGate, mode) {
4115
4210
  rangeDecorationWarnCount: rangeDecorationResolver?.warnCount ?? Number.POSITIVE_INFINITY,
4116
4211
  rangeDecorationWithoutRowKeysWarning: rangeDecorationResolver?.withoutRowKeysWarning,
4117
4212
  hasRowKeyGetter: () => props.rowKeyGetter !== void 0,
4213
+ // 追加(1.16.0 / セルの結合): serverSide では結ばない(React 版と同じ)。
4214
+ cellSpanWarnings: () => engine.cellSpan.warnings({
4215
+ isServerSide: isServerSide(),
4216
+ columns: props.columns,
4217
+ // 追加(1.16.0 の実アプリの点検 CS3-04): 木の列に書いた結合も警告(React 版と同じ)。
4218
+ treeColumnKey: treeColumnKey()
4219
+ }),
4118
4220
  // 追加(1.9.0 / ツリーデータ): 一緒に使えないもの・効かない理由と、木の形の問題(親のキーが rows に無い行・循環・同じキーの行)。
4119
4221
  treeDataWarnings: () => {
4120
4222
  const parts = treeDataParts;
@@ -4483,16 +4585,83 @@ function GridShellBody(props, features, mountGate, mode) {
4483
4585
  const entries = centerEntries();
4484
4586
  return columnVirtualizer.items().map((item) => entries[item.index]).filter((entry) => Boolean(entry));
4485
4587
  });
4588
+ const cellSpanParts = features.cellSpan;
4589
+ const [rowDragging, setRowDragging] = createSignal9(false, { name: "cellSpanRowDragging" });
4590
+ const cellSpanBaseIndex = createMemo10(() => {
4591
+ const columns2 = orderedColumns();
4592
+ if (cellSpanParts === void 0 || !cellSpanParts.hasCellSpanColumns(columns2)) {
4593
+ return INERT_CELL_SPAN_INDEX;
4594
+ }
4595
+ return engine.cellSpan.resolve({
4596
+ enabled: !isServerSide() && !loadingEmpty(),
4597
+ rowModel: rowModel(),
4598
+ columns: columns2,
4599
+ detailOpenRows: vertical().detailActive ? vertical().detailExtras : null,
4600
+ treeColumnKey: treeStage() ? treeColumnKey() : void 0
4601
+ });
4602
+ });
4603
+ const cellSpanIndex = createMemo10(() => rowDragging() ? INERT_CELL_SPAN_INDEX : cellSpanBaseIndex());
4604
+ connectController(engine.cellSpan, () => ({ index: cellSpanIndex(), dispatch }), "render", "cellSpan");
4605
+ const handleRowDraggingChange = (dragging) => {
4606
+ setRowDragging(dragging);
4607
+ if (dragging) {
4608
+ flush();
4609
+ }
4610
+ };
4611
+ const cellSpanLayoutResolver = cellSpanParts?.createCellSpanLayoutResolver();
4612
+ const cellSpanLayout = createMemo10(() => {
4613
+ const index = cellSpanIndex();
4614
+ if (!cellSpanLayoutResolver || !index.active) {
4615
+ return void 0;
4616
+ }
4617
+ const v = vertical();
4618
+ return cellSpanLayoutResolver({
4619
+ index,
4620
+ windowFirstRow: v.windowFirstRow,
4621
+ windowLastRow: v.windowLastRow,
4622
+ rowMetrics: v.rowMetrics,
4623
+ paneLayout: paneLayout(),
4624
+ centerRenderEntries: centerRenderEntries()
4625
+ });
4626
+ });
4627
+ const bodyRowsWithSpans = createMemo10(() => {
4628
+ const items = bodyRows();
4629
+ const spanLayout = cellSpanLayout();
4630
+ if (!spanLayout || spanLayout.ghosts.length === 0) {
4631
+ return items;
4632
+ }
4633
+ const top = vertical().virtualRows.find((virtualRow) => virtualRow.index === spanLayout.windowFirstRow);
4634
+ if (!top) {
4635
+ return items;
4636
+ }
4637
+ const model = layoutRowModel();
4638
+ const ghosts = [];
4639
+ for (const ghost of spanLayout.ghosts) {
4640
+ if (model.getRow(ghost.row) === void 0) {
4641
+ continue;
4642
+ }
4643
+ ghosts.push({
4644
+ index: ghost.row,
4645
+ start: top.start,
4646
+ size: top.size,
4647
+ key: `__ssg_span__:${String(model.getRowKey(ghost.row) ?? ghost.row)}`,
4648
+ skeleton: false,
4649
+ spanGhost: ghost.cols
4650
+ });
4651
+ }
4652
+ return ghosts.length === 0 ? items : [...ghosts, ...items];
4653
+ });
4486
4654
  const activeCellRendered = createMemo10(
4487
4655
  () => isActiveCellRendered(ui().activeCell, vertical().virtualRowIndexes, rowModel(), [
4488
4656
  paneLayout().left.entries,
4489
4657
  centerRenderEntries(),
4490
4658
  paneLayout().right.entries
4491
- ])
4659
+ ]) || // 追加(1.16.0): 窓より上の結合の左上・横の窓の外の結合の左の列も描いている(React 版と同じ)。
4660
+ ui().activeCell !== null && cellSpanLayout()?.drawsCell(ui().activeCell) === true
4492
4661
  );
4493
4662
  const prefersReducedMotion = createExternalStoreSignal(reducedMotionStore, "reducedMotionStore");
4494
4663
  const resolvedMotion = () => resolveGridMotion(props.motion ?? "auto", prefersReducedMotion());
4495
- const animateRowsActive = () => (props.animateRows ?? true) && resolvedMotion() === "on" && !autoHeightActive() && !isServerSide();
4664
+ const animateRowsActive = () => (props.animateRows ?? true) && resolvedMotion() === "on" && !autoHeightActive() && !isServerSide() && !cellSpanBaseIndex().active;
4496
4665
  connectController(engine.rowEnter, () => ({
4497
4666
  scrollContainerRef,
4498
4667
  skeletonEnter: isServerSide() && resolvedMotion() === "on",
@@ -4523,12 +4692,56 @@ function GridShellBody(props, features, mountGate, mode) {
4523
4692
  const slots = createMemo10(
4524
4693
  () => resolveSlotMapFromSignature(slotSignature())
4525
4694
  );
4526
- const activeCellPlacement = createMemo10(
4527
- () => resolveCellPlacement(ui().activeCell, viewRowCount(), paneLayout(), vertical().rowMetrics)
4528
- );
4529
- const editingCellPlacement = createMemo10(
4530
- () => resolveCellPlacement(ui().editingCell, viewRowCount(), paneLayout(), vertical().rowMetrics)
4531
- );
4695
+ const spanPlacementOf = (cell) => {
4696
+ const index = cellSpanIndex();
4697
+ if (!cell || !cellSpanParts || !index.active) {
4698
+ return null;
4699
+ }
4700
+ const v = vertical();
4701
+ return cellSpanParts.resolveCellSpanPlacement(index, cell, paneLayout(), v.rowMetrics, v.windowFirstRow, v.windowLastRow);
4702
+ };
4703
+ const activeCellPlacement = createMemo10(() => {
4704
+ const cell = ui().activeCell;
4705
+ const placement2 = resolveCellPlacement(cell, viewRowCount(), paneLayout(), vertical().rowMetrics);
4706
+ const span = placement2 ? spanPlacementOf(cell) : null;
4707
+ return placement2 && span ? { pane: placement2.pane, rect: { left: span.left, top: span.top, width: span.width, height: span.height } } : placement2;
4708
+ });
4709
+ const editingSpanRow = createMemo10(() => {
4710
+ const cell = ui().editingCell;
4711
+ const index = cellSpanIndex();
4712
+ const span = cell && index.active ? index.getSpan(cell.row, cell.col) : null;
4713
+ if (!span || span.top === span.bottom) {
4714
+ return null;
4715
+ }
4716
+ const metrics = vertical().rowMetrics;
4717
+ const visibleTop = untrack13(
4718
+ () => physicalToLogicalScrollTop(store.getViewState().scrollTop, vertical().verticalScaleFactor)
4719
+ );
4720
+ let row = Math.max(span.top, Math.min(span.bottom, metrics.rowAtContentY(visibleTop)));
4721
+ if (row < span.bottom && metrics.rowTop(row) < visibleTop) {
4722
+ row += 1;
4723
+ }
4724
+ return row;
4725
+ });
4726
+ const editingCellPlacement = createMemo10(() => {
4727
+ const cell = ui().editingCell;
4728
+ const metrics = vertical().rowMetrics;
4729
+ const placement2 = resolveCellPlacement(cell, viewRowCount(), paneLayout(), metrics);
4730
+ const span = placement2 ? spanPlacementOf(cell) : null;
4731
+ if (!placement2 || !cell || !span) {
4732
+ return placement2;
4733
+ }
4734
+ const column = orderedColumns()[cell.col];
4735
+ const editor = column ? resolveColumnEditor(column, rowModel().getRow(cell.row)) : void 0;
4736
+ const spanRow = editingSpanRow();
4737
+ if (spanRow === null || editor?.type === "text" && editor.multiline === true) {
4738
+ return { pane: placement2.pane, rect: { left: span.left, top: span.top, width: span.width, height: span.height } };
4739
+ }
4740
+ return {
4741
+ pane: placement2.pane,
4742
+ rect: { left: span.left, top: metrics.rowTop(spanRow), width: span.width, height: metrics.cellHeight(spanRow) }
4743
+ };
4744
+ });
4532
4745
  const editorAlignTop = createMemo10(() => {
4533
4746
  const editing = ui().editingCell;
4534
4747
  const column = editing ? orderedColumns()[editing.col] : void 0;
@@ -4670,6 +4883,15 @@ function GridShellBody(props, features, mountGate, mode) {
4670
4883
  "effect",
4671
4884
  "verticalScaleAnchor"
4672
4885
  );
4886
+ const activeCellSpanned = createMemo10(() => {
4887
+ const index = cellSpanIndex();
4888
+ if (!index.active) {
4889
+ return void 0;
4890
+ }
4891
+ const cell = ui().activeCell;
4892
+ const span = cell ? index.getSpan(cell.row, cell.col) : null;
4893
+ return span !== null && span.bottom > span.top;
4894
+ });
4673
4895
  connectController(
4674
4896
  viewportSync,
4675
4897
  () => ({
@@ -4685,6 +4907,8 @@ function GridShellBody(props, features, mountGate, mode) {
4685
4907
  activeCellRect: activeCellPlacement()?.rect ?? null,
4686
4908
  isRowFollowMove: engine.activeRowFollow.isFollowMove,
4687
4909
  activeCellPinned: activeCellPlacement() !== null && activeCellPlacement()?.pane !== "center",
4910
+ // 追加(1.16.0 の別視点のレビュー): 縦に結合したセルは、見えている所にかかっていれば縦に動かさない(React 版と同じ)。
4911
+ activeCellSpanned: activeCellSpanned(),
4688
4912
  activeCell: ui().activeCell,
4689
4913
  verticalScaleFactor: vertical().verticalScaleFactor,
4690
4914
  footerHeight: footerHeight(),
@@ -4812,6 +5036,10 @@ function GridShellBody(props, features, mountGate, mode) {
4812
5036
  const entry = stickyLabelEntry();
4813
5037
  return resolveSlotProps2(entry ? resolveLabelRowSlot(entry.labelRow) : void 0);
4814
5038
  });
5039
+ const spanStickyTop = () => {
5040
+ const label = stickyLabelEntry();
5041
+ return headerHeight() + (label ? Math.max(0, label.height - label.pushOffset) : 0) - vertical().bodyLayerTranslateY;
5042
+ };
4815
5043
  const labelRowExport = createMemo10(() => {
4816
5044
  const isLabelRow = labelIsLabelRow();
4817
5045
  const getLabel = labelGetLabel();
@@ -5022,10 +5250,26 @@ function GridShellBody(props, features, mountGate, mode) {
5022
5250
  getUnsavedCells: changeTracker.getUnsavedCells,
5023
5251
  trackedColumns: changeTracker.getTrackedColumns(),
5024
5252
  revert: changeTracker.revert,
5025
- texts
5253
+ texts,
5254
+ // 追加(1.16.0 の実アプリの点検 CS1-01): 縦の結合のセルは結合のすべての行を取り消す(React 版と同じ)。
5255
+ getSpan: (row, col) => engine.cellSpan.current().getSpan(row, col)
5026
5256
  });
5027
5257
  };
5028
5258
  const handleRowsChange = () => props.onRowsChange ? history.handleRowsChange : void 0;
5259
+ const spanRowsChange = () => {
5260
+ const write = handleRowsChange();
5261
+ return write && cellSpanBaseIndex().active ? (next) => {
5262
+ const previous = untrack13(rows);
5263
+ const reconciled = engine.cellSpan.reconcileWrites(previous, next, {
5264
+ readOnly: untrack13(readOnly),
5265
+ canEditCell: untrack13(canEditCell),
5266
+ validationTexts: untrack13(localeTexts)
5267
+ });
5268
+ if (reconciled !== previous) {
5269
+ write(reconciled);
5270
+ }
5271
+ } : write;
5272
+ };
5029
5273
  connectController(engine.newRow, () => {
5030
5274
  rowModel();
5031
5275
  void ui().activeCell;
@@ -5148,7 +5392,9 @@ function GridShellBody(props, features, mountGate, mode) {
5148
5392
  richCopy: props.copyFormat === "rich" ? features.richCopy : void 0,
5149
5393
  getCopyColorHost: () => gridRootRef.current,
5150
5394
  getConditionalFormatStats: features.conditionalFormat ? () => untrack13(conditionalFormatStats) : void 0,
5151
- onRowsChange: handleRowsChange(),
5395
+ onRowsChange: spanRowsChange(),
5396
+ // 追加(1.16.0 / セルの結合): 書式つきのコピーの rowspan / colspan。
5397
+ cellSpans: engine.cellSpan,
5152
5398
  onColumnsChange: inOwnTick(props.onColumnsChange),
5153
5399
  applyServerSideCellEdits: applyServerSideCellEdits(),
5154
5400
  isRowExportable: props.isRowExportable,
@@ -5209,6 +5455,16 @@ function GridShellBody(props, features, mountGate, mode) {
5209
5455
  const { viewIndexOf } = stage.display;
5210
5456
  return (rowIndex) => viewIndexOf[allOpen.order[rowIndex] ?? -1] ?? -1;
5211
5457
  });
5458
+ const findPageSize = createMemo10(() => pageWindow()?.pageSize ?? null);
5459
+ const findIsHiddenCell = createMemo10(() => {
5460
+ if (!cellSpanBaseIndex().active) {
5461
+ return void 0;
5462
+ }
5463
+ const model = findTreeRowModel() ?? fullRowModel();
5464
+ const pageSize = findPageSize();
5465
+ const detailKeys = vertical().detailActive ? ui().expandedDetailRowKeys : null;
5466
+ return (rowIndex, colIndex) => engine.cellSpan.resolveFull(model, pageSize, detailKeys).isCovered(rowIndex, colIndex);
5467
+ });
5212
5468
  connectController(engine.find, () => {
5213
5469
  const treeRowModel = findTreeRowModel();
5214
5470
  return {
@@ -5225,6 +5481,9 @@ function GridShellBody(props, features, mountGate, mode) {
5225
5481
  multiSelectSeparator: localeTexts().multiSelectSeparator,
5226
5482
  // 追加(1.12.0 / 検索と置換): 「選んだ範囲だけ」の範囲(件数・印・↑↓ も範囲の中だけ。React 版と同じ)。
5227
5483
  scope: findReplaceSnapshot().scope,
5484
+ // 追加(1.16.0 / セルの結合): 結合に隠れたセルは数えない(結合は 1 つのセルとして 1 回。ページ送りではページごとに結ぶ)。
5485
+ // 変更(1.16.0 の別視点のレビュー): 結合の表が変わったら(ページの行の数・展開行の開閉・列)探し直す(関数を memo で控える)。
5486
+ isHiddenCell: findIsHiddenCell(),
5228
5487
  // カレントのヒットへ: クリックと同じ 1 セルの選択 + 見える位置へのスクロール(命令的 API と同じ経路)。
5229
5488
  // 変更(1.9.0 の点検 T3-02 / T6-09): 打っている途中の移動('query')で開いた親は、次の文字の移動で閉じ直す(React 版と同じ)。
5230
5489
  onNavigate: (rowIndex, colIndex, cause) => {
@@ -5257,10 +5516,12 @@ function GridShellBody(props, features, mountGate, mode) {
5257
5516
  multiSelectSeparator: localeTexts().multiSelectSeparator,
5258
5517
  validationTexts: localeTexts(),
5259
5518
  toViewRow: findToViewRow(),
5519
+ // 追加(1.16.0 の実アプリの点検 CS1-05): すべて置換は結合を 1 つと数える(検索と同じ。React 版と同じ)。
5520
+ isHiddenCell: findIsHiddenCell(),
5260
5521
  readOnly: editLocked(),
5261
5522
  canEditCell: canEditCell(),
5262
5523
  // 履歴付きの onRowsChange(元に戻すが 1 回・変更の追跡の印も付く)。
5263
- commitRows: (nextRows) => handleRowsChange()?.(nextRows),
5524
+ commitRows: (nextRows) => spanRowsChange()?.(nextRows),
5264
5525
  // 変更(1.15.0 / ページ送り): 選んだ範囲は通し番号で(探す行モデルが全ページのため。React 版と同じ)。
5265
5526
  getSelection: () => {
5266
5527
  const offset = untrack13(pageStart);
@@ -5585,7 +5846,9 @@ function GridShellBody(props, features, mountGate, mode) {
5585
5846
  // 最終列の Tab: その行のカードが開いていればカードの最初の要素へ、無ければ表の直後の目印から既定の Tab(段階 2 C-N2 / F-10)。
5586
5847
  onTabPastLastColumn: detailRows.handleTabPastLastColumn,
5587
5848
  // 追加(1.9.0 / ツリーデータ): 木の列のセルの Alt+Shift+↓ / ↑ で開く / 閉じる。
5588
- onToggleTreeRow: treeStage() ? engine.gridApi.toggleTreeCell : void 0
5849
+ onToggleTreeRow: treeStage() ? engine.gridApi.toggleTreeCell : void 0,
5850
+ // 追加(1.16.0 / セルの結合): 結合から出るとき(入ったセルの行 / 列から)。
5851
+ cellSpans: engine.cellSpan
5589
5852
  }), "render", "keyboard");
5590
5853
  connectController(edit, () => ({
5591
5854
  uiState: ui(),
@@ -5593,10 +5856,12 @@ function GridShellBody(props, features, mountGate, mode) {
5593
5856
  visibleColumns: orderedColumns(),
5594
5857
  rowModel: rowModel(),
5595
5858
  setEditorInitialValue,
5596
- onRowsChange: handleRowsChange(),
5859
+ onRowsChange: spanRowsChange(),
5597
5860
  applyServerSideCellEdits: applyServerSideCellEdits(),
5598
5861
  dispatch,
5599
5862
  gridRootRef,
5863
+ // 追加(1.16.0 / セルの結合): Enter / Tab の確定の後の移動は結合の外へ(入ったセルの行 / 列から)。
5864
+ cellSpans: engine.cellSpan,
5600
5865
  editorActionGuardRef,
5601
5866
  readOnly: editCommitLocked(),
5602
5867
  startLocked: loading(),
@@ -5616,7 +5881,7 @@ function GridShellBody(props, features, mountGate, mode) {
5616
5881
  getUiState: store.getState,
5617
5882
  readOnly: editLocked(),
5618
5883
  canEditCell: canEditCell(),
5619
- handleRowsChange: handleRowsChange(),
5884
+ handleRowsChange: spanRowsChange(),
5620
5885
  applyServerSideCellEdits: applyServerSideCellEdits(),
5621
5886
  startEditWithValue: edit.startEditWithValue,
5622
5887
  dispatch
@@ -5629,7 +5894,7 @@ function GridShellBody(props, features, mountGate, mode) {
5629
5894
  getUiState: store.getState,
5630
5895
  readOnly: editLocked(),
5631
5896
  canEditCell: canEditCell(),
5632
- handleRowsChange: handleRowsChange(),
5897
+ handleRowsChange: spanRowsChange(),
5633
5898
  applyServerSideCellEdits: applyServerSideCellEdits(),
5634
5899
  dispatch,
5635
5900
  shortcuts: resolvedExcelShortcuts(),
@@ -5943,7 +6208,9 @@ function GridShellBody(props, features, mountGate, mode) {
5943
6208
  endEditLeftOpen: edit.endEditLeftOpen,
5944
6209
  commitRowMove: commitRowMoveFromDrag,
5945
6210
  ghostSlot: slots().dragGhost,
5946
- motion: resolvedMotion() === "off" ? "ghost" : props.rowDragMotion ?? "ghost"
6211
+ motion: resolvedMotion() === "off" ? "ghost" : props.rowDragMotion ?? "ghost",
6212
+ // 追加(1.16.0 / セルの結合): 引いている間は結合を外す(結合の列があるときだけ)。
6213
+ onDraggingChange: cellSpanBaseIndex().active || rowDragging() ? handleRowDraggingChange : void 0
5947
6214
  }),
5948
6215
  rowModel,
5949
6216
  visibleColumns,
@@ -6003,6 +6270,8 @@ function GridShellBody(props, features, mountGate, mode) {
6003
6270
  connectController(engine.gridApi, () => ({
6004
6271
  scrollContainerRef,
6005
6272
  dispatch,
6273
+ // 追加(1.16.0 / セルの結合): エクスポートの cellSpans。
6274
+ cellSpans: engine.cellSpan,
6006
6275
  // 追加(1.10.0 / 入力行): focusNewRow() が移る最初の編集できる列を決める。
6007
6276
  readOnly: editLocked(),
6008
6277
  rowModel: rowModel(),
@@ -6462,7 +6731,7 @@ function GridShellBody(props, features, mountGate, mode) {
6462
6731
  return;
6463
6732
  }
6464
6733
  writeCellValueTo(
6465
- { rows: untrack13(rows), rowModel: model, handleRowsChange: untrack13(handleRowsChange), applyServerSideCellEdits: untrack13(applyServerSideCellEdits) },
6734
+ { rows: untrack13(rows), rowModel: model, handleRowsChange: untrack13(spanRowsChange), applyServerSideCellEdits: untrack13(applyServerSideCellEdits) },
6466
6735
  viewIndex,
6467
6736
  row,
6468
6737
  column,
@@ -7017,7 +7286,7 @@ function GridShellBody(props, features, mountGate, mode) {
7017
7286
  changeNavRowKey={changeNavRowKey()}
7018
7287
  activeCellDecorationText={activeCellDecorationText()}
7019
7288
  rowHeaderWidth={rowHeaderWidth()}
7020
- rows={bodyRows()}
7289
+ rows={bodyRowsWithSpans()}
7021
7290
  entries={entries()}
7022
7291
  rowModel={layoutRowModel()}
7023
7292
  ariaRowOffset={pinnedTopCount() + columnGroupDepth()}
@@ -7039,6 +7308,8 @@ function GridShellBody(props, features, mountGate, mode) {
7039
7308
  renderCellContent={renderCellContent}
7040
7309
  isTextCellColumn={isTextCellColumn}
7041
7310
  treeColumnKey={treeStage() ? treeColumnKey() : void 0}
7311
+ cellSpans={cellSpanLayout()}
7312
+ spanStickyTop={spanStickyTop()}
7042
7313
  cellText={cellText}
7043
7314
  onRowHeaderPointerDown={pointer.handleRowHeaderPointerDown}
7044
7315
  onRowHeaderPointerEnter={pointer.handleRowHeaderPointerEnter}
@@ -7122,7 +7393,9 @@ function GridShellBody(props, features, mountGate, mode) {
7122
7393
  "ssg-root--diff": diffActive(),
7123
7394
  "ssg-root--fill-height": heightLayout().fillParent,
7124
7395
  // クロスヘア(列見出し / 行番号を選択の色で染める。列の帯は ColumnHoverOverlay)。
7125
- "ssg-root--hover-cross": hoverCross()
7396
+ "ssg-root--hover-cross": hoverCross(),
7397
+ // 追加(1.16.0 の別視点のレビュー): セルの結合を描いている(内部のクラス。React 版と同じ)。
7398
+ "ssg-root--cell-spans": cellSpanIndex().active
7126
7399
  }
7127
7400
  ]}
7128
7401
  style={{
@@ -11584,7 +11857,7 @@ function DateTimeCellEditor(props) {
11584
11857
  onCommit={(value, direction) => props.onCommit(value, direction)}
11585
11858
  onCancel={() => props.onCancel()}
11586
11859
  onCommitToSelection={props.onCommitToSelection}
11587
- onRegisterFlush={(flush) => props.onRegisterFlush?.(flush)}
11860
+ onRegisterFlush={(flush2) => props.onRegisterFlush?.(flush2)}
11588
11861
  align={props.align}
11589
11862
  cellHeight={props.cellHeight}
11590
11863
  alignTop={props.alignTop}
@@ -12704,6 +12977,20 @@ var paginationFeature = {
12704
12977
  localeText: DEFAULT_PAGINATION_LOCALE_TEXT
12705
12978
  };
12706
12979
 
12980
+ // src/features/cellSpan.ts
12981
+ import { createCellSpanController } from "@ishibashi0112/spreadsheet-grid-core/internal/engine/cellSpanController";
12982
+ import {
12983
+ createCellSpanLayoutResolver,
12984
+ resolveCellSpanPlacement
12985
+ } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cellSpanLayout";
12986
+ import { hasCellSpanColumns } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cellSpans";
12987
+ var cellSpanFeature = {
12988
+ createCellSpanController,
12989
+ createCellSpanLayoutResolver,
12990
+ resolveCellSpanPlacement,
12991
+ hasCellSpanColumns
12992
+ };
12993
+
12707
12994
  // src/features/excelShortcuts.ts
12708
12995
  import { createExcelShortcutCommands } from "@ishibashi0112/spreadsheet-grid-core/internal/engine/excelShortcutCommands";
12709
12996
  var excelShortcutsFeature = {
@@ -13114,6 +13401,7 @@ var fullGridFeatures = {
13114
13401
  diffView: diffViewFeature,
13115
13402
  rangeDecorations: rangeDecorationsFeature,
13116
13403
  pagination: paginationFeature,
13404
+ cellSpan: cellSpanFeature,
13117
13405
  excelShortcuts: excelShortcutsFeature,
13118
13406
  newRow: newRowFeature,
13119
13407
  treeData: treeDataFeature,
@@ -13152,6 +13440,7 @@ import { restoreColumnsFromState } from "@ishibashi0112/spreadsheet-grid-core/in
13152
13440
  export {
13153
13441
  SpreadsheetGrid,
13154
13442
  autoHeightFeature,
13443
+ cellSpanFeature,
13155
13444
  changeTrackingFeature,
13156
13445
  columnAutosizeFeature,
13157
13446
  columnGroupsFeature,