@ishibashi0112/spreadsheet-grid-core 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/activeRowFollowController.cjs +1 -0
- package/dist/controllers/activeRowFollowController.d.ts +18 -0
- package/dist/controllers/activeRowFollowController.js +68 -0
- package/dist/controllers/autoHeightMeasurer.cjs +1 -1
- package/dist/controllers/autoHeightMeasurer.js +17 -17
- package/dist/controllers/clipboardController.cjs +1 -1
- package/dist/controllers/clipboardController.d.ts +1 -0
- package/dist/controllers/clipboardController.js +58 -49
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.js +10 -10
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.d.ts +1 -0
- package/dist/controllers/contextMenuController.js +12 -7
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.d.ts +1 -0
- package/dist/controllers/editController.js +106 -99
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +78 -78
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +6 -6
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +1 -0
- package/dist/controllers/findController.js +16 -15
- package/dist/controllers/imeInputController.cjs +1 -1
- package/dist/controllers/imeInputController.js +65 -54
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.js +43 -43
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.js +64 -64
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +117 -104
- package/dist/controllers/scrollSyncController.cjs +1 -1
- package/dist/controllers/scrollSyncController.js +45 -43
- package/dist/controllers/serverSideRowModel.cjs +1 -1
- package/dist/controllers/serverSideRowModel.js +19 -19
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +1 -0
- package/dist/controllers/viewportSyncController.js +1 -1
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.js +113 -113
- package/dist/engine/createGridEngine.cjs +3 -3
- package/dist/engine/createGridEngine.d.ts +2 -0
- package/dist/engine/createGridEngine.js +72 -70
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +4 -2
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +6 -6
- package/dist/engine/gridApi.cjs +6 -6
- package/dist/engine/gridApi.d.ts +2 -0
- package/dist/engine/gridApi.js +193 -183
- package/dist/engine/notifiers.cjs +1 -1
- package/dist/engine/notifiers.d.ts +4 -0
- package/dist/engine/notifiers.js +7 -7
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +2 -0
- package/dist/logic/exportCsv.cjs +2 -2
- package/dist/logic/exportCsv.d.ts +2 -1
- package/dist/logic/exportCsv.js +13 -13
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +2 -1
- package/dist/logic/exportData.js +18 -18
- package/dist/logic/geometry.cjs +1 -1
- package/dist/logic/geometry.d.ts +2 -0
- package/dist/logic/geometry.js +41 -20
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +3 -2
- package/dist/logic/gridState.js +32 -23
- package/dist/logic/grouping.cjs +1 -1
- package/dist/logic/grouping.js +1 -1
- package/dist/logic/imeInput.cjs +1 -1
- package/dist/logic/imeInput.js +6 -4
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +4 -0
- package/dist/logic/localeTextFeatures.js +8 -5
- package/dist/logic/pasteFill.cjs +1 -0
- package/dist/logic/pasteFill.d.ts +2 -0
- package/dist/logic/pasteFill.js +25 -0
- package/dist/logic/selectEditorState.cjs +1 -1
- package/dist/logic/selectEditorState.d.ts +4 -1
- package/dist/logic/selectEditorState.js +14 -14
- package/dist/logic/selectionAggregates.cjs +1 -1
- package/dist/logic/selectionAggregates.js +2 -3
- package/dist/logic/validation.cjs +1 -1
- package/dist/logic/validation.d.ts +1 -1
- package/dist/logic/validation.js +21 -21
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +13 -0
- package/dist/model/gridActions.js +11 -0
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +128 -65
- package/dist/model/gridTypes.core.d.ts +172 -26
- package/dist/utils/gridVisibleBand.cjs +1 -0
- package/dist/utils/gridVisibleBand.d.ts +4 -0
- package/dist/utils/gridVisibleBand.js +24 -0
- package/dist/utils/scrollBottom.cjs +1 -0
- package/dist/utils/scrollBottom.d.ts +1 -0
- package/dist/utils/scrollBottom.js +4 -0
- package/dist/utils/topAlignedInput.cjs +1 -0
- package/dist/utils/topAlignedInput.d.ts +3 -0
- package/dist/utils/topAlignedInput.js +23 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/columnWidthState.cjs"),t=require("../logic/rowSelection.cjs"),n=require("../logic/gridState.cjs");var r=60,i=(e,t,n)=>Math.min(Math.max(e,t),n),a=(e,t)=>{let{activeCell:n,selection:r,dragState:i}=e;if(t<=0){let t=r!==null&&r.type!==`col`,a=i?.type===`selection`&&i.selectionKind!==`col`;return n===null&&!t&&!a?e:{...e,activeCell:null,selection:t?null:r,dragState:a?null:i}}let a=t-1,o=e;if(n!==null&&n.row>a&&(o={...o,activeCell:{row:a,col:n.col}}),r?.type===`cell`){let{start:e,end:t}=r.range;(e.row>a||t.row>a)&&(o={...o,selection:{type:`cell`,range:{start:{row:Math.min(e.row,a),col:e.col},end:{row:Math.min(t.row,a),col:t.col}}}})}else r?.type===`row`&&(r.startRow>a||r.endRow>a)&&(o={...o,selection:{type:`row`,startRow:Math.min(r.startRow,a),endRow:Math.min(r.endRow,a)}});return i?.type===`selection`&&(i.selectionKind===`cell`&&i.anchor.row>a?o={...o,dragState:{...i,anchor:{row:a,col:i.anchor.col}}}:i.selectionKind===`row`&&i.anchorRow>a&&(o={...o,dragState:{...i,anchorRow:a}})),o},o=(e,t)=>{let{activeCell:n,selection:r,dragState:i}=e;if(t<=0){let t=r!==null&&r.type!==`row`,a=i?.type===`selection`&&i.selectionKind!==`row`;return n===null&&!t&&!a?e:{...e,activeCell:null,selection:t?null:r,dragState:a?null:i}}let a=t-1,o=e;if(n!==null&&n.col>a&&(o={...o,activeCell:{row:n.row,col:a}}),r?.type===`cell`){let{start:e,end:t}=r.range;(e.col>a||t.col>a)&&(o={...o,selection:{type:`cell`,range:{start:{row:e.row,col:Math.min(e.col,a)},end:{row:t.row,col:Math.min(t.col,a)}}}})}else r?.type===`col`&&(r.startCol>a||r.endCol>a)&&(o={...o,selection:{type:`col`,startCol:Math.min(r.startCol,a),endCol:Math.min(r.endCol,a)}});return i?.type===`selection`&&(i.selectionKind===`cell`&&i.anchor.col>a?o={...o,dragState:{...i,anchor:{row:i.anchor.row,col:a}}}:i.selectionKind===`col`&&i.anchorCol>a&&(o={...o,dragState:{...i,anchorCol:a}})),o},
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/columnWidthState.cjs"),t=require("../logic/rowSelection.cjs"),n=require("../logic/gridState.cjs");var r=60,i=(e,t,n)=>Math.min(Math.max(e,t),n),a=(e,t)=>{let{activeCell:n,selection:r,dragState:i}=e;if(t<=0){let t=r!==null&&r.type!==`col`,a=i?.type===`selection`&&i.selectionKind!==`col`;return n===null&&!t&&!a?e:{...e,activeCell:null,selection:t?null:r,dragState:a?null:i}}let a=t-1,o=e;if(n!==null&&n.row>a&&(o={...o,activeCell:{row:a,col:n.col}}),r?.type===`cell`){let{start:e,end:t}=r.range;(e.row>a||t.row>a)&&(o={...o,selection:{type:`cell`,range:{start:{row:Math.min(e.row,a),col:e.col},end:{row:Math.min(t.row,a),col:t.col}}}})}else r?.type===`row`&&(r.startRow>a||r.endRow>a)&&(o={...o,selection:{type:`row`,startRow:Math.min(r.startRow,a),endRow:Math.min(r.endRow,a)}});return i?.type===`selection`&&(i.selectionKind===`cell`&&i.anchor.row>a?o={...o,dragState:{...i,anchor:{row:a,col:i.anchor.col}}}:i.selectionKind===`row`&&i.anchorRow>a&&(o={...o,dragState:{...i,anchorRow:a}})),o},o=(e,t,n)=>{let{activeCell:r,selection:i}=e;if(r===null||r.row===t.row&&r.col===t.col)return e;let a=r.row,o=t.row,s=r.col===t.col,c={row:o,col:t.col},l={type:`cell`,range:{start:c,end:c}},u=(e,t)=>n!==void 0&&n>0&&Math.min(e,t)<=0&&Math.max(e,t)>=n-1,d=i;if(i?.type===`cell`){let{start:e,end:t}=i.range;d=e.row===a&&t.row===a&&s?{type:`cell`,range:{start:{row:o,col:e.col},end:{row:o,col:t.col}}}:u(e.row,t.row)&&s?i:l}else i?.type===`row`&&(d=i.startRow===a&&i.endRow===a?{type:`row`,startRow:o,endRow:o}:u(i.startRow,i.endRow)?i:l);return{...e,activeCell:c,selection:d}},s=(e,t)=>{let{activeCell:n,selection:r,dragState:i}=e;if(t<=0){let t=r!==null&&r.type!==`row`,a=i?.type===`selection`&&i.selectionKind!==`row`;return n===null&&!t&&!a?e:{...e,activeCell:null,selection:t?null:r,dragState:a?null:i}}let a=t-1,o=e;if(n!==null&&n.col>a&&(o={...o,activeCell:{row:n.row,col:a}}),r?.type===`cell`){let{start:e,end:t}=r.range;(e.col>a||t.col>a)&&(o={...o,selection:{type:`cell`,range:{start:{row:e.row,col:Math.min(e.col,a)},end:{row:t.row,col:Math.min(t.col,a)}}}})}else r?.type===`col`&&(r.startCol>a||r.endCol>a)&&(o={...o,selection:{type:`col`,startCol:Math.min(r.startCol,a),endCol:Math.min(r.endCol,a)}});return i?.type===`selection`&&(i.selectionKind===`cell`&&i.anchor.col>a?o={...o,dragState:{...i,anchor:{row:i.anchor.row,col:a}}}:i.selectionKind===`col`&&i.anchorCol>a&&(o={...o,dragState:{...i,anchorCol:a}})),o},c=(e,t,n)=>{if(t===null)return e;let r=new Set(n.map(e=>e.key)),i=new Set(t.filter(e=>!r.has(e.key)).map(e=>e.key));if(i.size===0)return e;let a=e,o=e.filters.columnFilters;if(Object.keys(o).some(e=>i.has(e))){let e={};for(let[t,n]of Object.entries(o))i.has(t)||(e[t]=n);a={...a,filters:{...a.filters,columnFilters:e}}}return e.sort.some(e=>i.has(e.columnKey))&&(a={...a,sort:e.sort.filter(e=>!i.has(e.columnKey))}),a},l=()=>({activeCell:null,selection:null,rowSelection:t.createEmptyRowSelection(),editingCell:null,dragState:null,columnWidths:{},filters:{globalText:``,columnFilters:{}},sort:[],collapsedGroupKeys:new Set,expandedDetailRowKeys:new Set}),u=(l,u)=>{switch(u.type){case`cell/activate`:return u.cell===l.activeCell||u.cell!==null&&l.activeCell!==null&&u.cell.row===l.activeCell.row&&u.cell.col===l.activeCell.col?l:{...l,activeCell:u.cell};case`selection/start`:return{...l,activeCell:u.cell,selection:{type:`cell`,range:{start:u.cell,end:u.cell}},dragState:{type:`selection`,selectionKind:`cell`,anchor:u.cell}};case`rowSelection/start`:return{...l,activeCell:{row:u.row,col:l.activeCell?.col??u.col??0},selection:{type:`row`,startRow:u.row,endRow:u.row},dragState:{type:`selection`,selectionKind:`row`,anchorRow:u.row}};case`rowSelection/update`:return l.dragState?.type!==`selection`||l.dragState.selectionKind!==`row`||l.selection?.type===`row`&&l.selection.endRow===u.row?l:{...l,selection:{type:`row`,startRow:l.dragState.anchorRow,endRow:u.row}};case`selection/update`:return l.dragState?.type!==`selection`||l.dragState.selectionKind!==`cell`||l.selection?.type===`cell`&&l.selection.range.end.row===u.cell.row&&l.selection.range.end.col===u.cell.col?l:{...l,selection:{type:`cell`,range:{start:l.dragState.anchor,end:u.cell}}};case`columnSelection/start`:return{...l,activeCell:{row:l.activeCell?.row??u.row??0,col:u.col},selection:{type:`col`,startCol:u.col,endCol:u.col},dragState:{type:`selection`,selectionKind:`col`,anchorCol:u.col}};case`columnSelection/update`:return l.dragState?.type!==`selection`||l.dragState.selectionKind!==`col`||l.selection?.type===`col`&&l.selection.endCol===u.col?l:{...l,selection:{type:`col`,startCol:l.dragState.anchorCol,endCol:u.col}};case`selection/end`:return l.dragState?.type===`selection`?{...l,dragState:null}:l;case`selection/clear`:return l.selection===null&&l.dragState===null?l:{...l,selection:null,dragState:null};case`selection/followActiveRow`:return l.activeCell===null?l:o(l,{row:u.row,col:l.activeCell.col},u.rowCount);case`selection/collapseToActiveCell`:{let{activeCell:e,selection:t}=l;return e===null||t?.type===`cell`&&t.range.start.row===e.row&&t.range.end.row===e.row&&t.range.start.col===e.col&&t.range.end.col===e.col?l:{...l,selection:{type:`cell`,range:{start:e,end:e}}}}case`selection/clampToRowCount`:{let e=a(l,u.rowCount);return u.colCount===void 0?e:s(e,u.colCount)}case`edit/start`:return{...l,editingCell:u.cell,activeCell:u.cell};case`edit/retarget`:{let e=o(l,u.cell,u.rowCount),t=l.editingCell;return t!==null&&t.row===u.cell.row&&t.col===u.cell.col&&e===l?l:{...e,editingCell:u.cell,activeCell:e.activeCell??u.cell}}case`edit/stop`:return l.editingCell===null?l:{...l,editingCell:null};case`column/resizeStart`:return{...l,dragState:{type:`columnResize`,columnKey:u.columnKey,startX:u.startX,startWidth:u.startWidth,minWidth:u.minWidth??r,maxWidth:u.maxWidth??1/0}};case`column/resizeUpdate`:{if(l.dragState?.type!==`columnResize`)return l;let e=i(l.dragState.startWidth+(u.clientX-l.dragState.startX),l.dragState.minWidth,l.dragState.maxWidth);return l.columnWidths[l.dragState.columnKey]===e?l:{...l,columnWidths:{...l.columnWidths,[l.dragState.columnKey]:e}}}case`column/resizeEnd`:return l.dragState?.type===`columnResize`?{...l,dragState:null}:l;case`columnWidths/sync`:return{...l,columnWidths:{...l.columnWidths,...u.widths}};case`columnWidths/reset`:return{...l,columnWidths:u.widths};case`columnWidths/reconcile`:{let t=e.reconcileColumnWidths(l.columnWidths,u.prevColumns,u.nextColumns);return c(t===l.columnWidths?l:{...l,columnWidths:t},u.prevColumns,u.nextColumns)}case`filter/setGlobal`:return l.filters.globalText===u.value?l:{...l,filters:{...l.filters,globalText:u.value}};case`filter/setColumn`:{let e=l.filters.columnFilters[u.columnKey];return e!==void 0&&(e===u.value||n.isSameColumnFilterValue(e,u.value))?l:{...l,filters:{...l.filters,columnFilters:{...l.filters.columnFilters,[u.columnKey]:u.value}}}}case`filter/clearColumn`:{if(!(u.columnKey in l.filters.columnFilters))return l;let e={...l.filters.columnFilters};return delete e[u.columnKey],{...l,filters:{...l.filters,columnFilters:e}}}case`filter/resetAll`:return l.filters.globalText===``&&Object.keys(l.filters.columnFilters).length===0?l:{...l,filters:{globalText:``,columnFilters:{}}};case`filter/setAll`:return{...l,filters:u.filters};case`sort/set`:return n.isSameSortState(l.sort,u.entries)?l:{...l,sort:u.entries};case`sort/clear`:return l.sort.length===0?l:{...l,sort:[]};case`rowSelect/set`:return t.rowSelectionStateEquals(l.rowSelection,u.state)?l:{...l,rowSelection:u.state};case`group/toggleCollapsed`:{let e=new Set(l.collapsedGroupKeys);return e.has(u.groupKey)?e.delete(u.groupKey):e.add(u.groupKey),{...l,collapsedGroupKeys:e}}case`group/setCollapsed`:{if(l.collapsedGroupKeys.has(u.groupKey)===u.collapsed)return l;let e=new Set(l.collapsedGroupKeys);return u.collapsed?e.add(u.groupKey):e.delete(u.groupKey),{...l,collapsedGroupKeys:e}}case`group/setCollapsedKeys`:return u.keys===l.collapsedGroupKeys||u.keys.size===0&&l.collapsedGroupKeys.size===0?l:{...l,collapsedGroupKeys:u.keys};case`detail/toggle`:{let e=new Set(l.expandedDetailRowKeys);return e.has(u.rowKey)?e.delete(u.rowKey):e.add(u.rowKey),{...l,expandedDetailRowKeys:e}}case`detail/setExpanded`:{if(l.expandedDetailRowKeys.has(u.rowKey)===u.expanded)return l;let e=new Set(l.expandedDetailRowKeys);return u.expanded?e.add(u.rowKey):e.delete(u.rowKey),{...l,expandedDetailRowKeys:e}}case`detail/setKeys`:return u.keys===l.expandedDetailRowKeys||u.keys.size===0&&l.expandedDetailRowKeys.size===0?l:{...l,expandedDetailRowKeys:u.keys};default:return l}};exports.createInitialGridUiState=l,exports.gridUiReducer=u;
|
|
@@ -62,7 +62,45 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
62
62
|
anchorRow: a
|
|
63
63
|
}
|
|
64
64
|
})), o;
|
|
65
|
-
}, c = (e, t) => {
|
|
65
|
+
}, c = (e, t, n) => {
|
|
66
|
+
let { activeCell: r, selection: i } = e;
|
|
67
|
+
if (r === null || r.row === t.row && r.col === t.col) return e;
|
|
68
|
+
let a = r.row, o = t.row, s = r.col === t.col, c = {
|
|
69
|
+
row: o,
|
|
70
|
+
col: t.col
|
|
71
|
+
}, l = {
|
|
72
|
+
type: "cell",
|
|
73
|
+
range: {
|
|
74
|
+
start: c,
|
|
75
|
+
end: c
|
|
76
|
+
}
|
|
77
|
+
}, u = (e, t) => n !== void 0 && n > 0 && Math.min(e, t) <= 0 && Math.max(e, t) >= n - 1, d = i;
|
|
78
|
+
if (i?.type === "cell") {
|
|
79
|
+
let { start: e, end: t } = i.range;
|
|
80
|
+
d = e.row === a && t.row === a && s ? {
|
|
81
|
+
type: "cell",
|
|
82
|
+
range: {
|
|
83
|
+
start: {
|
|
84
|
+
row: o,
|
|
85
|
+
col: e.col
|
|
86
|
+
},
|
|
87
|
+
end: {
|
|
88
|
+
row: o,
|
|
89
|
+
col: t.col
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
} : u(e.row, t.row) && s ? i : l;
|
|
93
|
+
} else i?.type === "row" && (d = i.startRow === a && i.endRow === a ? {
|
|
94
|
+
type: "row",
|
|
95
|
+
startRow: o,
|
|
96
|
+
endRow: o
|
|
97
|
+
} : u(i.startRow, i.endRow) ? i : l);
|
|
98
|
+
return {
|
|
99
|
+
...e,
|
|
100
|
+
activeCell: c,
|
|
101
|
+
selection: d
|
|
102
|
+
};
|
|
103
|
+
}, l = (e, t) => {
|
|
66
104
|
let { activeCell: n, selection: r, dragState: i } = e;
|
|
67
105
|
if (t <= 0) {
|
|
68
106
|
let t = r !== null && r.type !== "row", a = i?.type === "selection" && i.selectionKind !== "row";
|
|
@@ -122,7 +160,7 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
122
160
|
anchorCol: a
|
|
123
161
|
}
|
|
124
162
|
})), o;
|
|
125
|
-
},
|
|
163
|
+
}, u = (e, t, n) => {
|
|
126
164
|
if (t === null) return e;
|
|
127
165
|
let r = new Set(n.map((e) => e.key)), i = new Set(t.filter((e) => !r.has(e.key)).map((e) => e.key));
|
|
128
166
|
if (i.size === 0) return e;
|
|
@@ -142,7 +180,7 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
142
180
|
...a,
|
|
143
181
|
sort: e.sort.filter((e) => !i.has(e.columnKey))
|
|
144
182
|
}), a;
|
|
145
|
-
},
|
|
183
|
+
}, d = () => ({
|
|
146
184
|
activeCell: null,
|
|
147
185
|
selection: null,
|
|
148
186
|
rowSelection: t(),
|
|
@@ -156,86 +194,86 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
156
194
|
sort: [],
|
|
157
195
|
collapsedGroupKeys: /* @__PURE__ */ new Set(),
|
|
158
196
|
expandedDetailRowKeys: /* @__PURE__ */ new Set()
|
|
159
|
-
}),
|
|
160
|
-
switch (
|
|
161
|
-
case "cell/activate": return
|
|
197
|
+
}), f = (t, d) => {
|
|
198
|
+
switch (d.type) {
|
|
199
|
+
case "cell/activate": return d.cell === t.activeCell || d.cell !== null && t.activeCell !== null && d.cell.row === t.activeCell.row && d.cell.col === t.activeCell.col ? t : {
|
|
162
200
|
...t,
|
|
163
|
-
activeCell:
|
|
201
|
+
activeCell: d.cell
|
|
164
202
|
};
|
|
165
203
|
case "selection/start": return {
|
|
166
204
|
...t,
|
|
167
|
-
activeCell:
|
|
205
|
+
activeCell: d.cell,
|
|
168
206
|
selection: {
|
|
169
207
|
type: "cell",
|
|
170
208
|
range: {
|
|
171
|
-
start:
|
|
172
|
-
end:
|
|
209
|
+
start: d.cell,
|
|
210
|
+
end: d.cell
|
|
173
211
|
}
|
|
174
212
|
},
|
|
175
213
|
dragState: {
|
|
176
214
|
type: "selection",
|
|
177
215
|
selectionKind: "cell",
|
|
178
|
-
anchor:
|
|
216
|
+
anchor: d.cell
|
|
179
217
|
}
|
|
180
218
|
};
|
|
181
219
|
case "rowSelection/start": return {
|
|
182
220
|
...t,
|
|
183
221
|
activeCell: {
|
|
184
|
-
row:
|
|
185
|
-
col: t.activeCell?.col ??
|
|
222
|
+
row: d.row,
|
|
223
|
+
col: t.activeCell?.col ?? d.col ?? 0
|
|
186
224
|
},
|
|
187
225
|
selection: {
|
|
188
226
|
type: "row",
|
|
189
|
-
startRow:
|
|
190
|
-
endRow:
|
|
227
|
+
startRow: d.row,
|
|
228
|
+
endRow: d.row
|
|
191
229
|
},
|
|
192
230
|
dragState: {
|
|
193
231
|
type: "selection",
|
|
194
232
|
selectionKind: "row",
|
|
195
|
-
anchorRow:
|
|
233
|
+
anchorRow: d.row
|
|
196
234
|
}
|
|
197
235
|
};
|
|
198
|
-
case "rowSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "row" || t.selection?.type === "row" && t.selection.endRow ===
|
|
236
|
+
case "rowSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "row" || t.selection?.type === "row" && t.selection.endRow === d.row ? t : {
|
|
199
237
|
...t,
|
|
200
238
|
selection: {
|
|
201
239
|
type: "row",
|
|
202
240
|
startRow: t.dragState.anchorRow,
|
|
203
|
-
endRow:
|
|
241
|
+
endRow: d.row
|
|
204
242
|
}
|
|
205
243
|
};
|
|
206
|
-
case "selection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "cell" || t.selection?.type === "cell" && t.selection.range.end.row ===
|
|
244
|
+
case "selection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "cell" || t.selection?.type === "cell" && t.selection.range.end.row === d.cell.row && t.selection.range.end.col === d.cell.col ? t : {
|
|
207
245
|
...t,
|
|
208
246
|
selection: {
|
|
209
247
|
type: "cell",
|
|
210
248
|
range: {
|
|
211
249
|
start: t.dragState.anchor,
|
|
212
|
-
end:
|
|
250
|
+
end: d.cell
|
|
213
251
|
}
|
|
214
252
|
}
|
|
215
253
|
};
|
|
216
254
|
case "columnSelection/start": return {
|
|
217
255
|
...t,
|
|
218
256
|
activeCell: {
|
|
219
|
-
row: t.activeCell?.row ??
|
|
220
|
-
col:
|
|
257
|
+
row: t.activeCell?.row ?? d.row ?? 0,
|
|
258
|
+
col: d.col
|
|
221
259
|
},
|
|
222
260
|
selection: {
|
|
223
261
|
type: "col",
|
|
224
|
-
startCol:
|
|
225
|
-
endCol:
|
|
262
|
+
startCol: d.col,
|
|
263
|
+
endCol: d.col
|
|
226
264
|
},
|
|
227
265
|
dragState: {
|
|
228
266
|
type: "selection",
|
|
229
267
|
selectionKind: "col",
|
|
230
|
-
anchorCol:
|
|
268
|
+
anchorCol: d.col
|
|
231
269
|
}
|
|
232
270
|
};
|
|
233
|
-
case "columnSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "col" || t.selection?.type === "col" && t.selection.endCol ===
|
|
271
|
+
case "columnSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "col" || t.selection?.type === "col" && t.selection.endCol === d.col ? t : {
|
|
234
272
|
...t,
|
|
235
273
|
selection: {
|
|
236
274
|
type: "col",
|
|
237
275
|
startCol: t.dragState.anchorCol,
|
|
238
|
-
endCol:
|
|
276
|
+
endCol: d.col
|
|
239
277
|
}
|
|
240
278
|
};
|
|
241
279
|
case "selection/end": return t.dragState?.type === "selection" ? {
|
|
@@ -247,15 +285,40 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
247
285
|
selection: null,
|
|
248
286
|
dragState: null
|
|
249
287
|
};
|
|
288
|
+
case "selection/followActiveRow": return t.activeCell === null ? t : c(t, {
|
|
289
|
+
row: d.row,
|
|
290
|
+
col: t.activeCell.col
|
|
291
|
+
}, d.rowCount);
|
|
292
|
+
case "selection/collapseToActiveCell": {
|
|
293
|
+
let { activeCell: e, selection: n } = t;
|
|
294
|
+
return e === null || n?.type === "cell" && n.range.start.row === e.row && n.range.end.row === e.row && n.range.start.col === e.col && n.range.end.col === e.col ? t : {
|
|
295
|
+
...t,
|
|
296
|
+
selection: {
|
|
297
|
+
type: "cell",
|
|
298
|
+
range: {
|
|
299
|
+
start: e,
|
|
300
|
+
end: e
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
250
305
|
case "selection/clampToRowCount": {
|
|
251
|
-
let e = s(t,
|
|
252
|
-
return
|
|
306
|
+
let e = s(t, d.rowCount);
|
|
307
|
+
return d.colCount === void 0 ? e : l(e, d.colCount);
|
|
253
308
|
}
|
|
254
309
|
case "edit/start": return {
|
|
255
310
|
...t,
|
|
256
|
-
editingCell:
|
|
257
|
-
activeCell:
|
|
311
|
+
editingCell: d.cell,
|
|
312
|
+
activeCell: d.cell
|
|
258
313
|
};
|
|
314
|
+
case "edit/retarget": {
|
|
315
|
+
let e = c(t, d.cell, d.rowCount), n = t.editingCell;
|
|
316
|
+
return n !== null && n.row === d.cell.row && n.col === d.cell.col && e === t ? t : {
|
|
317
|
+
...e,
|
|
318
|
+
editingCell: d.cell,
|
|
319
|
+
activeCell: e.activeCell ?? d.cell
|
|
320
|
+
};
|
|
321
|
+
}
|
|
259
322
|
case "edit/stop": return t.editingCell === null ? t : {
|
|
260
323
|
...t,
|
|
261
324
|
editingCell: null
|
|
@@ -264,16 +327,16 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
264
327
|
...t,
|
|
265
328
|
dragState: {
|
|
266
329
|
type: "columnResize",
|
|
267
|
-
columnKey:
|
|
268
|
-
startX:
|
|
269
|
-
startWidth:
|
|
270
|
-
minWidth:
|
|
271
|
-
maxWidth:
|
|
330
|
+
columnKey: d.columnKey,
|
|
331
|
+
startX: d.startX,
|
|
332
|
+
startWidth: d.startWidth,
|
|
333
|
+
minWidth: d.minWidth ?? a,
|
|
334
|
+
maxWidth: d.maxWidth ?? Infinity
|
|
272
335
|
}
|
|
273
336
|
};
|
|
274
337
|
case "column/resizeUpdate": {
|
|
275
338
|
if (t.dragState?.type !== "columnResize") return t;
|
|
276
|
-
let e = o(t.dragState.startWidth + (
|
|
339
|
+
let e = o(t.dragState.startWidth + (d.clientX - t.dragState.startX), t.dragState.minWidth, t.dragState.maxWidth);
|
|
277
340
|
return t.columnWidths[t.dragState.columnKey] === e ? t : {
|
|
278
341
|
...t,
|
|
279
342
|
columnWidths: {
|
|
@@ -290,44 +353,44 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
290
353
|
...t,
|
|
291
354
|
columnWidths: {
|
|
292
355
|
...t.columnWidths,
|
|
293
|
-
...
|
|
356
|
+
...d.widths
|
|
294
357
|
}
|
|
295
358
|
};
|
|
296
359
|
case "columnWidths/reset": return {
|
|
297
360
|
...t,
|
|
298
|
-
columnWidths:
|
|
361
|
+
columnWidths: d.widths
|
|
299
362
|
};
|
|
300
363
|
case "columnWidths/reconcile": {
|
|
301
|
-
let n = e(t.columnWidths,
|
|
302
|
-
return
|
|
364
|
+
let n = e(t.columnWidths, d.prevColumns, d.nextColumns);
|
|
365
|
+
return u(n === t.columnWidths ? t : {
|
|
303
366
|
...t,
|
|
304
367
|
columnWidths: n
|
|
305
|
-
},
|
|
368
|
+
}, d.prevColumns, d.nextColumns);
|
|
306
369
|
}
|
|
307
|
-
case "filter/setGlobal": return t.filters.globalText ===
|
|
370
|
+
case "filter/setGlobal": return t.filters.globalText === d.value ? t : {
|
|
308
371
|
...t,
|
|
309
372
|
filters: {
|
|
310
373
|
...t.filters,
|
|
311
|
-
globalText:
|
|
374
|
+
globalText: d.value
|
|
312
375
|
}
|
|
313
376
|
};
|
|
314
377
|
case "filter/setColumn": {
|
|
315
|
-
let e = t.filters.columnFilters[
|
|
316
|
-
return e !== void 0 && (e ===
|
|
378
|
+
let e = t.filters.columnFilters[d.columnKey];
|
|
379
|
+
return e !== void 0 && (e === d.value || r(e, d.value)) ? t : {
|
|
317
380
|
...t,
|
|
318
381
|
filters: {
|
|
319
382
|
...t.filters,
|
|
320
383
|
columnFilters: {
|
|
321
384
|
...t.filters.columnFilters,
|
|
322
|
-
[
|
|
385
|
+
[d.columnKey]: d.value
|
|
323
386
|
}
|
|
324
387
|
}
|
|
325
388
|
};
|
|
326
389
|
}
|
|
327
390
|
case "filter/clearColumn": {
|
|
328
|
-
if (!(
|
|
391
|
+
if (!(d.columnKey in t.filters.columnFilters)) return t;
|
|
329
392
|
let e = { ...t.filters.columnFilters };
|
|
330
|
-
return delete e[
|
|
393
|
+
return delete e[d.columnKey], {
|
|
331
394
|
...t,
|
|
332
395
|
filters: {
|
|
333
396
|
...t.filters,
|
|
@@ -344,60 +407,60 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
344
407
|
};
|
|
345
408
|
case "filter/setAll": return {
|
|
346
409
|
...t,
|
|
347
|
-
filters:
|
|
410
|
+
filters: d.filters
|
|
348
411
|
};
|
|
349
|
-
case "sort/set": return i(t.sort,
|
|
412
|
+
case "sort/set": return i(t.sort, d.entries) ? t : {
|
|
350
413
|
...t,
|
|
351
|
-
sort:
|
|
414
|
+
sort: d.entries
|
|
352
415
|
};
|
|
353
416
|
case "sort/clear": return t.sort.length === 0 ? t : {
|
|
354
417
|
...t,
|
|
355
418
|
sort: []
|
|
356
419
|
};
|
|
357
|
-
case "rowSelect/set": return n(t.rowSelection,
|
|
420
|
+
case "rowSelect/set": return n(t.rowSelection, d.state) ? t : {
|
|
358
421
|
...t,
|
|
359
|
-
rowSelection:
|
|
422
|
+
rowSelection: d.state
|
|
360
423
|
};
|
|
361
424
|
case "group/toggleCollapsed": {
|
|
362
425
|
let e = new Set(t.collapsedGroupKeys);
|
|
363
|
-
return e.has(
|
|
426
|
+
return e.has(d.groupKey) ? e.delete(d.groupKey) : e.add(d.groupKey), {
|
|
364
427
|
...t,
|
|
365
428
|
collapsedGroupKeys: e
|
|
366
429
|
};
|
|
367
430
|
}
|
|
368
431
|
case "group/setCollapsed": {
|
|
369
|
-
if (t.collapsedGroupKeys.has(
|
|
432
|
+
if (t.collapsedGroupKeys.has(d.groupKey) === d.collapsed) return t;
|
|
370
433
|
let e = new Set(t.collapsedGroupKeys);
|
|
371
|
-
return
|
|
434
|
+
return d.collapsed ? e.add(d.groupKey) : e.delete(d.groupKey), {
|
|
372
435
|
...t,
|
|
373
436
|
collapsedGroupKeys: e
|
|
374
437
|
};
|
|
375
438
|
}
|
|
376
|
-
case "group/setCollapsedKeys": return
|
|
439
|
+
case "group/setCollapsedKeys": return d.keys === t.collapsedGroupKeys || d.keys.size === 0 && t.collapsedGroupKeys.size === 0 ? t : {
|
|
377
440
|
...t,
|
|
378
|
-
collapsedGroupKeys:
|
|
441
|
+
collapsedGroupKeys: d.keys
|
|
379
442
|
};
|
|
380
443
|
case "detail/toggle": {
|
|
381
444
|
let e = new Set(t.expandedDetailRowKeys);
|
|
382
|
-
return e.has(
|
|
445
|
+
return e.has(d.rowKey) ? e.delete(d.rowKey) : e.add(d.rowKey), {
|
|
383
446
|
...t,
|
|
384
447
|
expandedDetailRowKeys: e
|
|
385
448
|
};
|
|
386
449
|
}
|
|
387
450
|
case "detail/setExpanded": {
|
|
388
|
-
if (t.expandedDetailRowKeys.has(
|
|
451
|
+
if (t.expandedDetailRowKeys.has(d.rowKey) === d.expanded) return t;
|
|
389
452
|
let e = new Set(t.expandedDetailRowKeys);
|
|
390
|
-
return
|
|
453
|
+
return d.expanded ? e.add(d.rowKey) : e.delete(d.rowKey), {
|
|
391
454
|
...t,
|
|
392
455
|
expandedDetailRowKeys: e
|
|
393
456
|
};
|
|
394
457
|
}
|
|
395
|
-
case "detail/setKeys": return
|
|
458
|
+
case "detail/setKeys": return d.keys === t.expandedDetailRowKeys || d.keys.size === 0 && t.expandedDetailRowKeys.size === 0 ? t : {
|
|
396
459
|
...t,
|
|
397
|
-
expandedDetailRowKeys:
|
|
460
|
+
expandedDetailRowKeys: d.keys
|
|
398
461
|
};
|
|
399
462
|
default: return t;
|
|
400
463
|
}
|
|
401
464
|
};
|
|
402
465
|
//#endregion
|
|
403
|
-
export {
|
|
466
|
+
export { d as createInitialGridUiState, f as gridUiReducer };
|