@ishibashi0112/spreadsheet-grid-core 1.0.0 → 1.0.2
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/autoHeightMeasurer.cjs +1 -1
- package/dist/controllers/autoHeightMeasurer.js +4 -2
- package/dist/controllers/clipboardController.cjs +1 -2
- package/dist/controllers/clipboardController.d.ts +2 -1
- package/dist/controllers/clipboardController.js +79 -63
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +4 -1
- package/dist/controllers/columnAutosizeRunner.js +60 -33
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.d.ts +4 -0
- package/dist/controllers/columnHeaderDragController.js +205 -184
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +1 -1
- package/dist/controllers/dateRolloverStore.cjs +1 -1
- package/dist/controllers/dateRolloverStore.js +1 -1
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +90 -74
- package/dist/controllers/escapeClaimController.cjs +1 -0
- package/dist/controllers/escapeClaimController.d.ts +19 -0
- package/dist/controllers/escapeClaimController.js +36 -0
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +77 -74
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +81 -77
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +2 -0
- package/dist/controllers/findController.js +103 -75
- package/dist/controllers/globalFilteredOrder.cjs +1 -1
- package/dist/controllers/globalFilteredOrder.js +52 -21
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.js +137 -140
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.js +159 -144
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.js +14 -6
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +131 -128
- package/dist/controllers/rowEnterController.cjs +1 -1
- package/dist/controllers/rowEnterController.d.ts +1 -0
- package/dist/controllers/rowEnterController.js +47 -42
- package/dist/controllers/scrollSyncController.cjs +1 -1
- package/dist/controllers/scrollSyncController.d.ts +1 -1
- package/dist/controllers/scrollSyncController.js +7 -4
- package/dist/controllers/selectOptionsCollector.cjs +1 -1
- package/dist/controllers/selectOptionsCollector.d.ts +5 -2
- package/dist/controllers/selectOptionsCollector.js +39 -27
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.d.ts +6 -0
- package/dist/controllers/toolPanelController.js +69 -59
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.d.ts +2 -0
- package/dist/controllers/tooltipController.js +86 -39
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +5 -0
- package/dist/controllers/viewportSyncController.js +40 -9
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.js +2 -1
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.d.ts +2 -0
- package/dist/engine/columnLayout.js +51 -18
- package/dist/engine/filterPopoverCommands.cjs +1 -1
- package/dist/engine/filterPopoverCommands.d.ts +2 -0
- package/dist/engine/filterPopoverCommands.js +15 -15
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +17 -17
- package/dist/engine/gridApi.cjs +3 -3
- package/dist/engine/gridApi.d.ts +2 -1
- package/dist/engine/gridApi.js +19 -19
- package/dist/engine/rowPipeline.cjs +1 -1
- package/dist/engine/rowPipeline.js +46 -46
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +9 -1
- package/dist/engine/rowSelectionCommands.js +45 -25
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +8 -5
- package/dist/logic/autoScrollGeometry.cjs +1 -1
- package/dist/logic/autoScrollGeometry.d.ts +5 -1
- package/dist/logic/autoScrollGeometry.js +6 -6
- package/dist/logic/clearCells.cjs +1 -1
- package/dist/logic/clearCells.js +13 -13
- package/dist/logic/columnAutosize.cjs +1 -1
- package/dist/logic/columnAutosize.d.ts +8 -2
- package/dist/logic/columnAutosize.js +102 -87
- package/dist/logic/columnReset.cjs +1 -1
- package/dist/logic/columnReset.d.ts +1 -0
- package/dist/logic/columnReset.js +21 -19
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +4 -0
- package/dist/logic/detailRow.js +18 -15
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +1 -0
- package/dist/logic/editorValues.js +49 -23
- package/dist/logic/elementScale.cjs +1 -0
- package/dist/logic/elementScale.d.ts +8 -0
- package/dist/logic/elementScale.js +14 -0
- package/dist/logic/filterSummary.cjs +1 -1
- package/dist/logic/filterSummary.js +9 -2
- package/dist/logic/filtering.cjs +1 -1
- package/dist/logic/filtering.js +14 -11
- package/dist/logic/find.cjs +1 -1
- package/dist/logic/find.d.ts +4 -3
- package/dist/logic/find.js +27 -13
- package/dist/logic/focusCycle.cjs +1 -0
- package/dist/logic/focusCycle.d.ts +1 -0
- package/dist/logic/focusCycle.js +15 -0
- package/dist/logic/gridAsk.cjs +2 -2
- package/dist/logic/gridAsk.d.ts +7 -7
- package/dist/logic/gridAsk.js +140 -122
- package/dist/logic/gridAskLocaleText.cjs +1 -1
- package/dist/logic/gridAskLocaleText.d.ts +2 -0
- package/dist/logic/gridAskLocaleText.js +1 -0
- package/dist/logic/gridState.d.ts +2 -2
- package/dist/logic/labelRows.cjs +1 -1
- package/dist/logic/labelRows.d.ts +2 -0
- package/dist/logic/labelRows.js +8 -4
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.d.ts +2 -0
- package/dist/logic/localeText.js +2 -1
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.js +2 -2
- package/dist/logic/localeTextFilters.cjs +1 -1
- package/dist/logic/localeTextFilters.d.ts +1 -0
- package/dist/logic/localeTextFilters.js +1 -0
- package/dist/logic/localeTextPopups.cjs +1 -1
- package/dist/logic/localeTextPopups.js +2 -2
- package/dist/logic/numberFilterCondition.cjs +1 -1
- package/dist/logic/numberFilterCondition.d.ts +1 -1
- package/dist/logic/numberFilterCondition.js +5 -5
- package/dist/logic/rowSelection.cjs +1 -1
- package/dist/logic/rowSelection.d.ts +4 -0
- package/dist/logic/rowSelection.js +31 -8
- package/dist/logic/scrollTargets.cjs +1 -1
- package/dist/logic/scrollTargets.js +2 -2
- package/dist/logic/selectEditorState.cjs +1 -1
- package/dist/logic/selectEditorState.d.ts +1 -0
- package/dist/logic/selectEditorState.js +8 -1
- package/dist/logic/selectOptions.cjs +1 -1
- package/dist/logic/selectOptions.d.ts +2 -2
- package/dist/logic/selectOptions.js +16 -12
- package/dist/logic/selectionOverlayGeometry.cjs +1 -1
- package/dist/logic/selectionOverlayGeometry.js +12 -12
- package/dist/logic/sorting.cjs +1 -1
- package/dist/logic/sorting.d.ts +1 -0
- package/dist/logic/sorting.js +24 -12
- package/dist/logic/valueFormatters.d.ts +5 -5
- package/dist/logic/verticalGeometry.cjs +1 -1
- package/dist/logic/verticalGeometry.d.ts +1 -0
- package/dist/logic/verticalGeometry.js +12 -8
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +2 -1
- package/dist/model/gridActions.js +3 -2
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +145 -62
- package/dist/model/gridTypes.core.d.ts +365 -318
- package/dist/utils/clipboard.cjs +3 -5
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.js +25 -22
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=15e6,t=5e4,n=(e,t,n,r)=>e&&t&&n>0&&n<=r,r=1<<20,i=(e,t)=>({rowCount:e,rowTop:e=>e*t,rowsHeight:(e,n)=>(n-e+1)*t,totalBodyHeight:e*t,rowAtContentY:n=>Math.min(Math.max(Math.floor(n/t),0),Math.max(e-1,0)),cellHeight:()=>t,detailHeight:()=>0}),
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=15e6,t=5e4,n=(e,t,n,r)=>e&&t&&n>0&&n<=r,r=1<<20,i=(e,t,n,r)=>{if(n>0)return e.rowAtContentY(e.rowTop(t)+r);let i=e.rowTop(t)-r,a=e.rowAtContentY(Math.max(i,0));return e.rowTop(a)<i?a+1:a},a=(e,t)=>({rowCount:e,rowTop:e=>e*t,rowsHeight:(e,n)=>(n-e+1)*t,totalBodyHeight:e*t,rowAtContentY:n=>Math.min(Math.max(Math.floor(n/t),0),Math.max(e-1,0)),cellHeight:()=>t,detailHeight:()=>0}),o=(e,t)=>{let n=t.filter(t=>t.height>0&&t.index>=0&&t.index<e.rowCount).sort((e,t)=>e.index-t.index),r=n.length,i=new Float64Array(r),a=new Float64Array(r+1);for(let e=0;e<r;e+=1)i[e]=n[e].index,a[e+1]=a[e]+n[e].height;let o=a[r],{rowCount:s}=e,c=e=>{let t=0,n=r;for(;t<n;){let r=t+n>>>1;i[r]<e?t=r+1:n=r}return t},l=t=>{let n=Math.min(Math.max(t,0),s);return(n===s?e.totalBodyHeight:e.rowTop(n))+a[c(n)]};return{rowCount:s,rowTop:l,rowsHeight:(e,t)=>l(t+1)-l(e),totalBodyHeight:e.totalBodyHeight+o,rowAtContentY:e=>{if(s<=0||e<=0)return 0;let t=0,n=s-1;for(;t<n;){let r=t+n+1>>>1;l(r)<=e?t=r:n=r-1}return t},cellHeight:t=>e.cellHeight(t),detailHeight:e=>{let t=c(e);return t<r&&i[t]===e?a[t+1]-a[t]:0}}},s=(e,t)=>{let{rowCount:n}=e,r=t.filter(e=>e.index>=0&&e.index<n&&e.height>=0).sort((e,t)=>e.index-t.index),i=r.length,a=new Float64Array(i),o=new Float64Array(i),s=new Float64Array(i+1);for(let t=0;t<i;t+=1)a[t]=r[t].index,o[t]=r[t].height,s[t+1]=s[t]+(r[t].height-e.cellHeight(r[t].index));let c=s[i],l=e=>{let t=0,n=i;for(;t<n;){let r=t+n>>>1;a[r]<e?t=r+1:n=r}return t},u=t=>{let r=Math.min(Math.max(t,0),n);return(r===n?e.totalBodyHeight:e.rowTop(r))+s[l(r)]};return{rowCount:n,rowTop:u,rowsHeight:(e,t)=>u(t+1)-u(e),totalBodyHeight:e.totalBodyHeight+c,rowAtContentY:e=>{if(n<=0||e<=0)return 0;let t=0,r=n-1;for(;t<r;){let n=t+r+1>>>1;u(n)<=e?t=n:r=n-1}return t},cellHeight:t=>{let n=l(t);return n<i&&a[n]===t?o[n]:e.cellHeight(t)},detailHeight:t=>e.detailHeight(t)}},c=(e,t,n,r)=>{if(r<n)return null;let i=Math.max(e,n),a=Math.min(t,r);return i>a?null:{start:i,end:a}},l=(e,t)=>e*t,u=(e,t)=>t===1?e:e/t,d=(e,t,n,r)=>{let i=t*(1-n);return r.rowAtContentY(e-i)},f=({rowCount:e,rowHeight:t,headerHeight:n,viewportHeight:i,scrollTop:a,overscan:o,maxBodyPx:s})=>{let c=e*t,l=Math.min(c,s),u=Math.max(n+c-i,0),d=Math.max(n+l-i,0),f=d>0&&c>l?u/d:1,p=Math.min(Math.max(a,0),d),m=p*f,h=Math.ceil(i/t)+1,g=Math.floor(m/t),_=Math.max(g-o,0),v=Math.min(g+h+o,e),y=f===1?0:Math.floor(_*t/r)*r,b=p-m+y,x=[],S=new Set;for(let e=_;e<v;e+=1)x.push({index:e,start:n+e*t-y}),S.add(e);return{physicalBodyHeight:l,logicalBodyHeight:c,scaleFactor:f,translateY:b,windowBaseOffsetPx:y,rows:x,rowIndexSet:S}},p=({headerHeight:e,viewportHeight:t,scrollTop:n,overscan:r},i)=>{let a=i.rowCount,o=i.totalBodyHeight,s=o,c=Math.max(e+o-t,0),l=Math.min(Math.max(n,0),c),u=i.rowAtContentY(l),d=i.rowAtContentY(l+t),f=Math.max(u-r,0),p=Math.min(d+r+1,a),m=[],h=new Set;for(let t=f;t<p;t+=1){let n={index:t,start:e+i.rowTop(t),size:i.cellHeight(t)},r=i.detailHeight(t);r>0&&(n.detailSize=r),m.push(n),h.add(t)}return{physicalBodyHeight:s,logicalBodyHeight:o,scaleFactor:1,translateY:0,windowBaseOffsetPx:0,rows:m,rowIndexSet:h}};exports.AUTO_HEIGHT_MAX_ROWS=t,exports.MAX_BODY_PX=e,exports.WINDOW_BASE_CHUNK_PX=r,exports.clientYToRowIndex=d,exports.clipRowRangeToWindow=c,exports.computeAutoHeightVerticalGeometry=p,exports.computeVerticalGeometry=f,exports.createDetailRowMetrics=o,exports.createRowHeightOverrideMetrics=s,exports.createUniformRowMetrics=a,exports.logicalToPhysicalScrollTop=u,exports.physicalToLogicalScrollTop=l,exports.resolvePageTargetRow=i,exports.shouldUseAutoHeight=n;
|
|
@@ -35,6 +35,7 @@ export type RowMetrics = {
|
|
|
35
35
|
cellHeight(index: number): number;
|
|
36
36
|
detailHeight(index: number): number;
|
|
37
37
|
};
|
|
38
|
+
export declare const resolvePageTargetRow: (metrics: Pick<RowMetrics, "rowTop" | "rowAtContentY">, fromRow: number, direction: 1 | -1, pageHeight: number) => number;
|
|
38
39
|
export declare const createUniformRowMetrics: (rowCount: number, rowHeight: number) => RowMetrics;
|
|
39
40
|
export type DetailRowExtra = {
|
|
40
41
|
index: number;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
//#region src/logic/verticalGeometry.ts
|
|
2
|
-
var e = 15e6, t = 5e4, n = (e, t, n, r) => e && t && n > 0 && n <= r, r = 1 << 20, i = (e, t) =>
|
|
2
|
+
var e = 15e6, t = 5e4, n = (e, t, n, r) => e && t && n > 0 && n <= r, r = 1 << 20, i = (e, t, n, r) => {
|
|
3
|
+
if (n > 0) return e.rowAtContentY(e.rowTop(t) + r);
|
|
4
|
+
let i = e.rowTop(t) - r, a = e.rowAtContentY(Math.max(i, 0));
|
|
5
|
+
return e.rowTop(a) < i ? a + 1 : a;
|
|
6
|
+
}, a = (e, t) => ({
|
|
3
7
|
rowCount: e,
|
|
4
8
|
rowTop: (e) => e * t,
|
|
5
9
|
rowsHeight: (e, n) => (n - e + 1) * t,
|
|
@@ -7,7 +11,7 @@ var e = 15e6, t = 5e4, n = (e, t, n, r) => e && t && n > 0 && n <= r, r = 1 << 2
|
|
|
7
11
|
rowAtContentY: (n) => Math.min(Math.max(Math.floor(n / t), 0), Math.max(e - 1, 0)),
|
|
8
12
|
cellHeight: () => t,
|
|
9
13
|
detailHeight: () => 0
|
|
10
|
-
}),
|
|
14
|
+
}), o = (e, t) => {
|
|
11
15
|
let n = t.filter((t) => t.height > 0 && t.index >= 0 && t.index < e.rowCount).sort((e, t) => e.index - t.index), r = n.length, i = new Float64Array(r), a = new Float64Array(r + 1);
|
|
12
16
|
for (let e = 0; e < r; e += 1) i[e] = n[e].index, a[e + 1] = a[e] + n[e].height;
|
|
13
17
|
let o = a[r], { rowCount: s } = e, c = (e) => {
|
|
@@ -41,7 +45,7 @@ var e = 15e6, t = 5e4, n = (e, t, n, r) => e && t && n > 0 && n <= r, r = 1 << 2
|
|
|
41
45
|
return t < r && i[t] === e ? a[t + 1] - a[t] : 0;
|
|
42
46
|
}
|
|
43
47
|
};
|
|
44
|
-
},
|
|
48
|
+
}, s = (e, t) => {
|
|
45
49
|
let { rowCount: n } = e, r = t.filter((e) => e.index >= 0 && e.index < n && e.height >= 0).sort((e, t) => e.index - t.index), i = r.length, a = new Float64Array(i), o = new Float64Array(i), s = new Float64Array(i + 1);
|
|
46
50
|
for (let t = 0; t < i; t += 1) a[t] = r[t].index, o[t] = r[t].height, s[t + 1] = s[t] + (r[t].height - e.cellHeight(r[t].index));
|
|
47
51
|
let c = s[i], l = (e) => {
|
|
@@ -75,17 +79,17 @@ var e = 15e6, t = 5e4, n = (e, t, n, r) => e && t && n > 0 && n <= r, r = 1 << 2
|
|
|
75
79
|
},
|
|
76
80
|
detailHeight: (t) => e.detailHeight(t)
|
|
77
81
|
};
|
|
78
|
-
},
|
|
82
|
+
}, c = (e, t, n, r) => {
|
|
79
83
|
if (r < n) return null;
|
|
80
84
|
let i = Math.max(e, n), a = Math.min(t, r);
|
|
81
85
|
return i > a ? null : {
|
|
82
86
|
start: i,
|
|
83
87
|
end: a
|
|
84
88
|
};
|
|
85
|
-
},
|
|
89
|
+
}, l = (e, t) => e * t, u = (e, t) => t === 1 ? e : e / t, d = (e, t, n, r) => {
|
|
86
90
|
let i = t * (1 - n);
|
|
87
91
|
return r.rowAtContentY(e - i);
|
|
88
|
-
},
|
|
92
|
+
}, f = ({ rowCount: e, rowHeight: t, headerHeight: n, viewportHeight: i, scrollTop: a, overscan: o, maxBodyPx: s }) => {
|
|
89
93
|
let c = e * t, l = Math.min(c, s), u = Math.max(n + c - i, 0), d = Math.max(n + l - i, 0), f = d > 0 && c > l ? u / d : 1, p = Math.min(Math.max(a, 0), d), m = p * f, h = Math.ceil(i / t) + 1, g = Math.floor(m / t), _ = Math.max(g - o, 0), v = Math.min(g + h + o, e), y = f === 1 ? 0 : Math.floor(_ * t / r) * r, b = p - m + y, x = [], S = /* @__PURE__ */ new Set();
|
|
90
94
|
for (let e = _; e < v; e += 1) x.push({
|
|
91
95
|
index: e,
|
|
@@ -100,7 +104,7 @@ var e = 15e6, t = 5e4, n = (e, t, n, r) => e && t && n > 0 && n <= r, r = 1 << 2
|
|
|
100
104
|
rows: x,
|
|
101
105
|
rowIndexSet: S
|
|
102
106
|
};
|
|
103
|
-
},
|
|
107
|
+
}, p = ({ headerHeight: e, viewportHeight: t, scrollTop: n, overscan: r }, i) => {
|
|
104
108
|
let a = i.rowCount, o = i.totalBodyHeight, s = o, c = Math.max(e + o - t, 0), l = Math.min(Math.max(n, 0), c), u = i.rowAtContentY(l), d = i.rowAtContentY(l + t), f = Math.max(u - r, 0), p = Math.min(d + r + 1, a), m = [], h = /* @__PURE__ */ new Set();
|
|
105
109
|
for (let t = f; t < p; t += 1) {
|
|
106
110
|
let n = {
|
|
@@ -121,4 +125,4 @@ var e = 15e6, t = 5e4, n = (e, t, n, r) => e && t && n > 0 && n <= r, r = 1 << 2
|
|
|
121
125
|
};
|
|
122
126
|
};
|
|
123
127
|
//#endregion
|
|
124
|
-
export { t as AUTO_HEIGHT_MAX_ROWS, e as MAX_BODY_PX, r as WINDOW_BASE_CHUNK_PX,
|
|
128
|
+
export { t as AUTO_HEIGHT_MAX_ROWS, e as MAX_BODY_PX, r as WINDOW_BASE_CHUNK_PX, d as clientYToRowIndex, c as clipRowRangeToWindow, p as computeAutoHeightVerticalGeometry, f as computeVerticalGeometry, o as createDetailRowMetrics, s as createRowHeightOverrideMetrics, a as createUniformRowMetrics, u as logicalToPhysicalScrollTop, l as physicalToLogicalScrollTop, i as resolvePageTargetRow, n as shouldUseAutoHeight };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e={activateCell:e=>({type:`cell/activate`,cell:e}),startSelection:e=>({type:`selection/start`,cell:e}),updateSelection:e=>({type:`selection/update`,cell:e}),startRowSelection:(e,t)=>t===void 0?{type:`rowSelection/start`,row:e}:{type:`rowSelection/start`,row:e,col:t},updateRowSelection:e=>({type:`rowSelection/update`,row:e}),startColumnSelection:(e,t)=>t===void 0?{type:`columnSelection/start`,col:e}:{type:`columnSelection/start`,col:e,row:t},updateColumnSelection:e=>({type:`columnSelection/update`,col:e}),endSelection:()=>({type:`selection/end`}),clearSelection:()=>({type:`selection/clear`}),startEdit:e=>({type:`edit/start`,cell:e}),stopEdit:()=>({type:`edit/stop`}),startColumnResize:(e,t,n,r,i)=>({type:`column/resizeStart`,columnKey:e,startX:t,startWidth:n,minWidth:r,maxWidth:i}),updateColumnResize:e=>({type:`column/resizeUpdate`,clientX:e}),endColumnResize:()=>({type:`column/resizeEnd`}),syncColumnWidths:e=>({type:`columnWidths/sync`,widths:e}),resetColumnWidths:e=>({type:`columnWidths/reset`,widths:e}),clampSelectionToRowCount:e=>({type:`selection/clampToRowCount`,rowCount:e}),reconcileColumnWidths:(e,t)=>({type:`columnWidths/reconcile`,prevColumns:e,nextColumns:t}),setGlobalFilter:e=>({type:`filter/setGlobal`,value:e}),setColumnFilter:(e,t)=>({type:`filter/setColumn`,columnKey:e,value:t}),clearColumnFilter:e=>({type:`filter/clearColumn`,columnKey:e}),resetAllFilters:()=>({type:`filter/resetAll`}),setAllFilters:e=>({type:`filter/setAll`,filters:e}),setSort:e=>({type:`sort/set`,entries:e}),clearSort:()=>({type:`sort/clear`}),setRowSelectionState:e=>({type:`rowSelect/set`,state:e}),toggleGroupCollapsed:e=>({type:`group/toggleCollapsed`,groupKey:e}),setGroupCollapsed:(e,t)=>({type:`group/setCollapsed`,groupKey:e,collapsed:t}),setCollapsedGroupKeys:e=>({type:`group/setCollapsedKeys`,keys:e}),toggleDetailRow:e=>({type:`detail/toggle`,rowKey:e}),setDetailRowExpanded:(e,t)=>({type:`detail/setExpanded`,rowKey:e,expanded:t}),setExpandedDetailRowKeys:e=>({type:`detail/setKeys`,keys:e})};exports.gridActions=e;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e={activateCell:e=>({type:`cell/activate`,cell:e}),startSelection:e=>({type:`selection/start`,cell:e}),updateSelection:e=>({type:`selection/update`,cell:e}),startRowSelection:(e,t)=>t===void 0?{type:`rowSelection/start`,row:e}:{type:`rowSelection/start`,row:e,col:t},updateRowSelection:e=>({type:`rowSelection/update`,row:e}),startColumnSelection:(e,t)=>t===void 0?{type:`columnSelection/start`,col:e}:{type:`columnSelection/start`,col:e,row:t},updateColumnSelection:e=>({type:`columnSelection/update`,col:e}),endSelection:()=>({type:`selection/end`}),clearSelection:()=>({type:`selection/clear`}),startEdit:e=>({type:`edit/start`,cell:e}),stopEdit:()=>({type:`edit/stop`}),startColumnResize:(e,t,n,r,i)=>({type:`column/resizeStart`,columnKey:e,startX:t,startWidth:n,minWidth:r,maxWidth:i}),updateColumnResize:e=>({type:`column/resizeUpdate`,clientX:e}),endColumnResize:()=>({type:`column/resizeEnd`}),syncColumnWidths:e=>({type:`columnWidths/sync`,widths:e}),resetColumnWidths:e=>({type:`columnWidths/reset`,widths:e}),clampSelectionToRowCount:(e,t)=>({type:`selection/clampToRowCount`,rowCount:e,...t===void 0?{}:{colCount:t}}),reconcileColumnWidths:(e,t)=>({type:`columnWidths/reconcile`,prevColumns:e,nextColumns:t}),setGlobalFilter:e=>({type:`filter/setGlobal`,value:e}),setColumnFilter:(e,t)=>({type:`filter/setColumn`,columnKey:e,value:t}),clearColumnFilter:e=>({type:`filter/clearColumn`,columnKey:e}),resetAllFilters:()=>({type:`filter/resetAll`}),setAllFilters:e=>({type:`filter/setAll`,filters:e}),setSort:e=>({type:`sort/set`,entries:e}),clearSort:()=>({type:`sort/clear`}),setRowSelectionState:e=>({type:`rowSelect/set`,state:e}),toggleGroupCollapsed:e=>({type:`group/toggleCollapsed`,groupKey:e}),setGroupCollapsed:(e,t)=>({type:`group/setCollapsed`,groupKey:e,collapsed:t}),setCollapsedGroupKeys:e=>({type:`group/setCollapsedKeys`,keys:e}),toggleDetailRow:e=>({type:`detail/toggle`,rowKey:e}),setDetailRowExpanded:(e,t)=>({type:`detail/setExpanded`,rowKey:e,expanded:t}),setExpandedDetailRowKeys:e=>({type:`detail/setKeys`,keys:e})};exports.gridActions=e;
|
|
@@ -29,6 +29,7 @@ export type GridUiAction = {
|
|
|
29
29
|
} | {
|
|
30
30
|
type: 'selection/clampToRowCount';
|
|
31
31
|
rowCount: number;
|
|
32
|
+
colCount?: number;
|
|
32
33
|
} | {
|
|
33
34
|
type: 'edit/start';
|
|
34
35
|
cell: CellCoord;
|
|
@@ -117,7 +118,7 @@ export declare const gridActions: {
|
|
|
117
118
|
endColumnResize: () => GridUiAction;
|
|
118
119
|
syncColumnWidths: (widths: Record<string, number>) => GridUiAction;
|
|
119
120
|
resetColumnWidths: (widths: Record<string, number>) => GridUiAction;
|
|
120
|
-
clampSelectionToRowCount: (rowCount: number) => GridUiAction;
|
|
121
|
+
clampSelectionToRowCount: (rowCount: number, colCount?: number) => GridUiAction;
|
|
121
122
|
reconcileColumnWidths: <T>(prevColumns: readonly GridColumn<T>[] | null, nextColumns: readonly GridColumn<T>[]) => GridUiAction;
|
|
122
123
|
setGlobalFilter: (value: string) => GridUiAction;
|
|
123
124
|
setColumnFilter: (columnKey: string, value: ColumnFilterValue) => GridUiAction;
|
|
@@ -64,9 +64,10 @@ var e = {
|
|
|
64
64
|
type: "columnWidths/reset",
|
|
65
65
|
widths: e
|
|
66
66
|
}),
|
|
67
|
-
clampSelectionToRowCount: (e) => ({
|
|
67
|
+
clampSelectionToRowCount: (e, t) => ({
|
|
68
68
|
type: "selection/clampToRowCount",
|
|
69
|
-
rowCount: e
|
|
69
|
+
rowCount: e,
|
|
70
|
+
...t === void 0 ? {} : { colCount: t }
|
|
70
71
|
}),
|
|
71
72
|
reconcileColumnWidths: (e, t) => ({
|
|
72
73
|
type: "columnWidths/reconcile",
|
|
@@ -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=()=>({activeCell:null,selection:null,rowSelection:t.createEmptyRowSelection(),editingCell:null,dragState:null,columnWidths:{},filters:{globalText:``,columnFilters:{}},sort:[],collapsedGroupKeys:new Set,expandedDetailRowKeys:new Set}),
|
|
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},s=(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},c=()=>({activeCell:null,selection:null,rowSelection:t.createEmptyRowSelection(),editingCell:null,dragState:null,columnWidths:{},filters:{globalText:``,columnFilters:{}},sort:[],collapsedGroupKeys:new Set,expandedDetailRowKeys:new Set}),l=(c,l)=>{switch(l.type){case`cell/activate`:return l.cell===c.activeCell||l.cell!==null&&c.activeCell!==null&&l.cell.row===c.activeCell.row&&l.cell.col===c.activeCell.col?c:{...c,activeCell:l.cell};case`selection/start`:return{...c,activeCell:l.cell,selection:{type:`cell`,range:{start:l.cell,end:l.cell}},dragState:{type:`selection`,selectionKind:`cell`,anchor:l.cell}};case`rowSelection/start`:return{...c,activeCell:{row:l.row,col:c.activeCell?.col??l.col??0},selection:{type:`row`,startRow:l.row,endRow:l.row},dragState:{type:`selection`,selectionKind:`row`,anchorRow:l.row}};case`rowSelection/update`:return c.dragState?.type!==`selection`||c.dragState.selectionKind!==`row`||c.selection?.type===`row`&&c.selection.endRow===l.row?c:{...c,selection:{type:`row`,startRow:c.dragState.anchorRow,endRow:l.row}};case`selection/update`:return c.dragState?.type!==`selection`||c.dragState.selectionKind!==`cell`||c.selection?.type===`cell`&&c.selection.range.end.row===l.cell.row&&c.selection.range.end.col===l.cell.col?c:{...c,selection:{type:`cell`,range:{start:c.dragState.anchor,end:l.cell}}};case`columnSelection/start`:return{...c,activeCell:{row:c.activeCell?.row??l.row??0,col:l.col},selection:{type:`col`,startCol:l.col,endCol:l.col},dragState:{type:`selection`,selectionKind:`col`,anchorCol:l.col}};case`columnSelection/update`:return c.dragState?.type!==`selection`||c.dragState.selectionKind!==`col`||c.selection?.type===`col`&&c.selection.endCol===l.col?c:{...c,selection:{type:`col`,startCol:c.dragState.anchorCol,endCol:l.col}};case`selection/end`:return c.dragState?.type===`selection`?{...c,dragState:null}:c;case`selection/clear`:return c.selection===null&&c.dragState===null?c:{...c,selection:null,dragState:null};case`selection/clampToRowCount`:{let e=a(c,l.rowCount);return l.colCount===void 0?e:o(e,l.colCount)}case`edit/start`:return{...c,editingCell:l.cell,activeCell:l.cell};case`edit/stop`:return c.editingCell===null?c:{...c,editingCell:null};case`column/resizeStart`:return{...c,dragState:{type:`columnResize`,columnKey:l.columnKey,startX:l.startX,startWidth:l.startWidth,minWidth:l.minWidth??r,maxWidth:l.maxWidth??1/0}};case`column/resizeUpdate`:{if(c.dragState?.type!==`columnResize`)return c;let e=i(c.dragState.startWidth+(l.clientX-c.dragState.startX),c.dragState.minWidth,c.dragState.maxWidth);return c.columnWidths[c.dragState.columnKey]===e?c:{...c,columnWidths:{...c.columnWidths,[c.dragState.columnKey]:e}}}case`column/resizeEnd`:return c.dragState?.type===`columnResize`?{...c,dragState:null}:c;case`columnWidths/sync`:return{...c,columnWidths:{...c.columnWidths,...l.widths}};case`columnWidths/reset`:return{...c,columnWidths:l.widths};case`columnWidths/reconcile`:{let t=e.reconcileColumnWidths(c.columnWidths,l.prevColumns,l.nextColumns);return s(t===c.columnWidths?c:{...c,columnWidths:t},l.prevColumns,l.nextColumns)}case`filter/setGlobal`:return c.filters.globalText===l.value?c:{...c,filters:{...c.filters,globalText:l.value}};case`filter/setColumn`:{let e=c.filters.columnFilters[l.columnKey];return e!==void 0&&(e===l.value||n.isSameColumnFilterValue(e,l.value))?c:{...c,filters:{...c.filters,columnFilters:{...c.filters.columnFilters,[l.columnKey]:l.value}}}}case`filter/clearColumn`:{if(!(l.columnKey in c.filters.columnFilters))return c;let e={...c.filters.columnFilters};return delete e[l.columnKey],{...c,filters:{...c.filters,columnFilters:e}}}case`filter/resetAll`:return c.filters.globalText===``&&Object.keys(c.filters.columnFilters).length===0?c:{...c,filters:{globalText:``,columnFilters:{}}};case`filter/setAll`:return{...c,filters:l.filters};case`sort/set`:return n.isSameSortState(c.sort,l.entries)?c:{...c,sort:l.entries};case`sort/clear`:return c.sort.length===0?c:{...c,sort:[]};case`rowSelect/set`:return t.rowSelectionStateEquals(c.rowSelection,l.state)?c:{...c,rowSelection:l.state};case`group/toggleCollapsed`:{let e=new Set(c.collapsedGroupKeys);return e.has(l.groupKey)?e.delete(l.groupKey):e.add(l.groupKey),{...c,collapsedGroupKeys:e}}case`group/setCollapsed`:{if(c.collapsedGroupKeys.has(l.groupKey)===l.collapsed)return c;let e=new Set(c.collapsedGroupKeys);return l.collapsed?e.add(l.groupKey):e.delete(l.groupKey),{...c,collapsedGroupKeys:e}}case`group/setCollapsedKeys`:return l.keys===c.collapsedGroupKeys||l.keys.size===0&&c.collapsedGroupKeys.size===0?c:{...c,collapsedGroupKeys:l.keys};case`detail/toggle`:{let e=new Set(c.expandedDetailRowKeys);return e.has(l.rowKey)?e.delete(l.rowKey):e.add(l.rowKey),{...c,expandedDetailRowKeys:e}}case`detail/setExpanded`:{if(c.expandedDetailRowKeys.has(l.rowKey)===l.expanded)return c;let e=new Set(c.expandedDetailRowKeys);return l.expanded?e.add(l.rowKey):e.delete(l.rowKey),{...c,expandedDetailRowKeys:e}}case`detail/setKeys`:return l.keys===c.expandedDetailRowKeys||l.keys.size===0&&c.expandedDetailRowKeys.size===0?c:{...c,expandedDetailRowKeys:l.keys};default:return c}};exports.createInitialGridUiState=c,exports.gridUiReducer=l;
|
|
@@ -62,7 +62,87 @@ 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 = () =>
|
|
65
|
+
}, c = (e, t) => {
|
|
66
|
+
let { activeCell: n, selection: r, dragState: i } = e;
|
|
67
|
+
if (t <= 0) {
|
|
68
|
+
let t = r !== null && r.type !== "row", a = i?.type === "selection" && i.selectionKind !== "row";
|
|
69
|
+
return n === null && !t && !a ? e : {
|
|
70
|
+
...e,
|
|
71
|
+
activeCell: null,
|
|
72
|
+
selection: t ? null : r,
|
|
73
|
+
dragState: a ? null : i
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
let a = t - 1, o = e;
|
|
77
|
+
if (n !== null && n.col > a && (o = {
|
|
78
|
+
...o,
|
|
79
|
+
activeCell: {
|
|
80
|
+
row: n.row,
|
|
81
|
+
col: a
|
|
82
|
+
}
|
|
83
|
+
}), r?.type === "cell") {
|
|
84
|
+
let { start: e, end: t } = r.range;
|
|
85
|
+
(e.col > a || t.col > a) && (o = {
|
|
86
|
+
...o,
|
|
87
|
+
selection: {
|
|
88
|
+
type: "cell",
|
|
89
|
+
range: {
|
|
90
|
+
start: {
|
|
91
|
+
row: e.row,
|
|
92
|
+
col: Math.min(e.col, a)
|
|
93
|
+
},
|
|
94
|
+
end: {
|
|
95
|
+
row: t.row,
|
|
96
|
+
col: Math.min(t.col, a)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
} else r?.type === "col" && (r.startCol > a || r.endCol > a) && (o = {
|
|
102
|
+
...o,
|
|
103
|
+
selection: {
|
|
104
|
+
type: "col",
|
|
105
|
+
startCol: Math.min(r.startCol, a),
|
|
106
|
+
endCol: Math.min(r.endCol, a)
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return i?.type === "selection" && (i.selectionKind === "cell" && i.anchor.col > a ? o = {
|
|
110
|
+
...o,
|
|
111
|
+
dragState: {
|
|
112
|
+
...i,
|
|
113
|
+
anchor: {
|
|
114
|
+
row: i.anchor.row,
|
|
115
|
+
col: a
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
} : i.selectionKind === "col" && i.anchorCol > a && (o = {
|
|
119
|
+
...o,
|
|
120
|
+
dragState: {
|
|
121
|
+
...i,
|
|
122
|
+
anchorCol: a
|
|
123
|
+
}
|
|
124
|
+
})), o;
|
|
125
|
+
}, l = (e, t, n) => {
|
|
126
|
+
if (t === null) return e;
|
|
127
|
+
let r = new Set(n.map((e) => e.key)), i = new Set(t.filter((e) => !r.has(e.key)).map((e) => e.key));
|
|
128
|
+
if (i.size === 0) return e;
|
|
129
|
+
let a = e, o = e.filters.columnFilters;
|
|
130
|
+
if (Object.keys(o).some((e) => i.has(e))) {
|
|
131
|
+
let e = {};
|
|
132
|
+
for (let [t, n] of Object.entries(o)) i.has(t) || (e[t] = n);
|
|
133
|
+
a = {
|
|
134
|
+
...a,
|
|
135
|
+
filters: {
|
|
136
|
+
...a.filters,
|
|
137
|
+
columnFilters: e
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
return e.sort.some((e) => i.has(e.columnKey)) && (a = {
|
|
142
|
+
...a,
|
|
143
|
+
sort: e.sort.filter((e) => !i.has(e.columnKey))
|
|
144
|
+
}), a;
|
|
145
|
+
}, u = () => ({
|
|
66
146
|
activeCell: null,
|
|
67
147
|
selection: null,
|
|
68
148
|
rowSelection: t(),
|
|
@@ -76,86 +156,86 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
76
156
|
sort: [],
|
|
77
157
|
collapsedGroupKeys: /* @__PURE__ */ new Set(),
|
|
78
158
|
expandedDetailRowKeys: /* @__PURE__ */ new Set()
|
|
79
|
-
}),
|
|
80
|
-
switch (
|
|
81
|
-
case "cell/activate": return
|
|
159
|
+
}), d = (t, u) => {
|
|
160
|
+
switch (u.type) {
|
|
161
|
+
case "cell/activate": return u.cell === t.activeCell || u.cell !== null && t.activeCell !== null && u.cell.row === t.activeCell.row && u.cell.col === t.activeCell.col ? t : {
|
|
82
162
|
...t,
|
|
83
|
-
activeCell:
|
|
163
|
+
activeCell: u.cell
|
|
84
164
|
};
|
|
85
165
|
case "selection/start": return {
|
|
86
166
|
...t,
|
|
87
|
-
activeCell:
|
|
167
|
+
activeCell: u.cell,
|
|
88
168
|
selection: {
|
|
89
169
|
type: "cell",
|
|
90
170
|
range: {
|
|
91
|
-
start:
|
|
92
|
-
end:
|
|
171
|
+
start: u.cell,
|
|
172
|
+
end: u.cell
|
|
93
173
|
}
|
|
94
174
|
},
|
|
95
175
|
dragState: {
|
|
96
176
|
type: "selection",
|
|
97
177
|
selectionKind: "cell",
|
|
98
|
-
anchor:
|
|
178
|
+
anchor: u.cell
|
|
99
179
|
}
|
|
100
180
|
};
|
|
101
181
|
case "rowSelection/start": return {
|
|
102
182
|
...t,
|
|
103
183
|
activeCell: {
|
|
104
|
-
row:
|
|
105
|
-
col: t.activeCell?.col ??
|
|
184
|
+
row: u.row,
|
|
185
|
+
col: t.activeCell?.col ?? u.col ?? 0
|
|
106
186
|
},
|
|
107
187
|
selection: {
|
|
108
188
|
type: "row",
|
|
109
|
-
startRow:
|
|
110
|
-
endRow:
|
|
189
|
+
startRow: u.row,
|
|
190
|
+
endRow: u.row
|
|
111
191
|
},
|
|
112
192
|
dragState: {
|
|
113
193
|
type: "selection",
|
|
114
194
|
selectionKind: "row",
|
|
115
|
-
anchorRow:
|
|
195
|
+
anchorRow: u.row
|
|
116
196
|
}
|
|
117
197
|
};
|
|
118
|
-
case "rowSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "row" || t.selection?.type === "row" && t.selection.endRow ===
|
|
198
|
+
case "rowSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "row" || t.selection?.type === "row" && t.selection.endRow === u.row ? t : {
|
|
119
199
|
...t,
|
|
120
200
|
selection: {
|
|
121
201
|
type: "row",
|
|
122
202
|
startRow: t.dragState.anchorRow,
|
|
123
|
-
endRow:
|
|
203
|
+
endRow: u.row
|
|
124
204
|
}
|
|
125
205
|
};
|
|
126
|
-
case "selection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "cell" || t.selection?.type === "cell" && t.selection.range.end.row ===
|
|
206
|
+
case "selection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "cell" || t.selection?.type === "cell" && t.selection.range.end.row === u.cell.row && t.selection.range.end.col === u.cell.col ? t : {
|
|
127
207
|
...t,
|
|
128
208
|
selection: {
|
|
129
209
|
type: "cell",
|
|
130
210
|
range: {
|
|
131
211
|
start: t.dragState.anchor,
|
|
132
|
-
end:
|
|
212
|
+
end: u.cell
|
|
133
213
|
}
|
|
134
214
|
}
|
|
135
215
|
};
|
|
136
216
|
case "columnSelection/start": return {
|
|
137
217
|
...t,
|
|
138
218
|
activeCell: {
|
|
139
|
-
row: t.activeCell?.row ??
|
|
140
|
-
col:
|
|
219
|
+
row: t.activeCell?.row ?? u.row ?? 0,
|
|
220
|
+
col: u.col
|
|
141
221
|
},
|
|
142
222
|
selection: {
|
|
143
223
|
type: "col",
|
|
144
|
-
startCol:
|
|
145
|
-
endCol:
|
|
224
|
+
startCol: u.col,
|
|
225
|
+
endCol: u.col
|
|
146
226
|
},
|
|
147
227
|
dragState: {
|
|
148
228
|
type: "selection",
|
|
149
229
|
selectionKind: "col",
|
|
150
|
-
anchorCol:
|
|
230
|
+
anchorCol: u.col
|
|
151
231
|
}
|
|
152
232
|
};
|
|
153
|
-
case "columnSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "col" || t.selection?.type === "col" && t.selection.endCol ===
|
|
233
|
+
case "columnSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "col" || t.selection?.type === "col" && t.selection.endCol === u.col ? t : {
|
|
154
234
|
...t,
|
|
155
235
|
selection: {
|
|
156
236
|
type: "col",
|
|
157
237
|
startCol: t.dragState.anchorCol,
|
|
158
|
-
endCol:
|
|
238
|
+
endCol: u.col
|
|
159
239
|
}
|
|
160
240
|
};
|
|
161
241
|
case "selection/end": return t.dragState?.type === "selection" ? {
|
|
@@ -167,11 +247,14 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
167
247
|
selection: null,
|
|
168
248
|
dragState: null
|
|
169
249
|
};
|
|
170
|
-
case "selection/clampToRowCount":
|
|
250
|
+
case "selection/clampToRowCount": {
|
|
251
|
+
let e = s(t, u.rowCount);
|
|
252
|
+
return u.colCount === void 0 ? e : c(e, u.colCount);
|
|
253
|
+
}
|
|
171
254
|
case "edit/start": return {
|
|
172
255
|
...t,
|
|
173
|
-
editingCell:
|
|
174
|
-
activeCell:
|
|
256
|
+
editingCell: u.cell,
|
|
257
|
+
activeCell: u.cell
|
|
175
258
|
};
|
|
176
259
|
case "edit/stop": return t.editingCell === null ? t : {
|
|
177
260
|
...t,
|
|
@@ -181,16 +264,16 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
181
264
|
...t,
|
|
182
265
|
dragState: {
|
|
183
266
|
type: "columnResize",
|
|
184
|
-
columnKey:
|
|
185
|
-
startX:
|
|
186
|
-
startWidth:
|
|
187
|
-
minWidth:
|
|
188
|
-
maxWidth:
|
|
267
|
+
columnKey: u.columnKey,
|
|
268
|
+
startX: u.startX,
|
|
269
|
+
startWidth: u.startWidth,
|
|
270
|
+
minWidth: u.minWidth ?? a,
|
|
271
|
+
maxWidth: u.maxWidth ?? Infinity
|
|
189
272
|
}
|
|
190
273
|
};
|
|
191
274
|
case "column/resizeUpdate": {
|
|
192
275
|
if (t.dragState?.type !== "columnResize") return t;
|
|
193
|
-
let e = o(t.dragState.startWidth + (
|
|
276
|
+
let e = o(t.dragState.startWidth + (u.clientX - t.dragState.startX), t.dragState.minWidth, t.dragState.maxWidth);
|
|
194
277
|
return t.columnWidths[t.dragState.columnKey] === e ? t : {
|
|
195
278
|
...t,
|
|
196
279
|
columnWidths: {
|
|
@@ -207,44 +290,44 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
207
290
|
...t,
|
|
208
291
|
columnWidths: {
|
|
209
292
|
...t.columnWidths,
|
|
210
|
-
...
|
|
293
|
+
...u.widths
|
|
211
294
|
}
|
|
212
295
|
};
|
|
213
296
|
case "columnWidths/reset": return {
|
|
214
297
|
...t,
|
|
215
|
-
columnWidths:
|
|
298
|
+
columnWidths: u.widths
|
|
216
299
|
};
|
|
217
300
|
case "columnWidths/reconcile": {
|
|
218
|
-
let n = e(t.columnWidths,
|
|
219
|
-
return n === t.columnWidths ? t : {
|
|
301
|
+
let n = e(t.columnWidths, u.prevColumns, u.nextColumns);
|
|
302
|
+
return l(n === t.columnWidths ? t : {
|
|
220
303
|
...t,
|
|
221
304
|
columnWidths: n
|
|
222
|
-
};
|
|
305
|
+
}, u.prevColumns, u.nextColumns);
|
|
223
306
|
}
|
|
224
|
-
case "filter/setGlobal": return t.filters.globalText ===
|
|
307
|
+
case "filter/setGlobal": return t.filters.globalText === u.value ? t : {
|
|
225
308
|
...t,
|
|
226
309
|
filters: {
|
|
227
310
|
...t.filters,
|
|
228
|
-
globalText:
|
|
311
|
+
globalText: u.value
|
|
229
312
|
}
|
|
230
313
|
};
|
|
231
314
|
case "filter/setColumn": {
|
|
232
|
-
let e = t.filters.columnFilters[
|
|
233
|
-
return e !== void 0 && (e ===
|
|
315
|
+
let e = t.filters.columnFilters[u.columnKey];
|
|
316
|
+
return e !== void 0 && (e === u.value || r(e, u.value)) ? t : {
|
|
234
317
|
...t,
|
|
235
318
|
filters: {
|
|
236
319
|
...t.filters,
|
|
237
320
|
columnFilters: {
|
|
238
321
|
...t.filters.columnFilters,
|
|
239
|
-
[
|
|
322
|
+
[u.columnKey]: u.value
|
|
240
323
|
}
|
|
241
324
|
}
|
|
242
325
|
};
|
|
243
326
|
}
|
|
244
327
|
case "filter/clearColumn": {
|
|
245
|
-
if (!(
|
|
328
|
+
if (!(u.columnKey in t.filters.columnFilters)) return t;
|
|
246
329
|
let e = { ...t.filters.columnFilters };
|
|
247
|
-
return delete e[
|
|
330
|
+
return delete e[u.columnKey], {
|
|
248
331
|
...t,
|
|
249
332
|
filters: {
|
|
250
333
|
...t.filters,
|
|
@@ -261,60 +344,60 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
|
261
344
|
};
|
|
262
345
|
case "filter/setAll": return {
|
|
263
346
|
...t,
|
|
264
|
-
filters:
|
|
347
|
+
filters: u.filters
|
|
265
348
|
};
|
|
266
|
-
case "sort/set": return i(t.sort,
|
|
349
|
+
case "sort/set": return i(t.sort, u.entries) ? t : {
|
|
267
350
|
...t,
|
|
268
|
-
sort:
|
|
351
|
+
sort: u.entries
|
|
269
352
|
};
|
|
270
353
|
case "sort/clear": return t.sort.length === 0 ? t : {
|
|
271
354
|
...t,
|
|
272
355
|
sort: []
|
|
273
356
|
};
|
|
274
|
-
case "rowSelect/set": return n(t.rowSelection,
|
|
357
|
+
case "rowSelect/set": return n(t.rowSelection, u.state) ? t : {
|
|
275
358
|
...t,
|
|
276
|
-
rowSelection:
|
|
359
|
+
rowSelection: u.state
|
|
277
360
|
};
|
|
278
361
|
case "group/toggleCollapsed": {
|
|
279
362
|
let e = new Set(t.collapsedGroupKeys);
|
|
280
|
-
return e.has(
|
|
363
|
+
return e.has(u.groupKey) ? e.delete(u.groupKey) : e.add(u.groupKey), {
|
|
281
364
|
...t,
|
|
282
365
|
collapsedGroupKeys: e
|
|
283
366
|
};
|
|
284
367
|
}
|
|
285
368
|
case "group/setCollapsed": {
|
|
286
|
-
if (t.collapsedGroupKeys.has(
|
|
369
|
+
if (t.collapsedGroupKeys.has(u.groupKey) === u.collapsed) return t;
|
|
287
370
|
let e = new Set(t.collapsedGroupKeys);
|
|
288
|
-
return
|
|
371
|
+
return u.collapsed ? e.add(u.groupKey) : e.delete(u.groupKey), {
|
|
289
372
|
...t,
|
|
290
373
|
collapsedGroupKeys: e
|
|
291
374
|
};
|
|
292
375
|
}
|
|
293
|
-
case "group/setCollapsedKeys": return
|
|
376
|
+
case "group/setCollapsedKeys": return u.keys === t.collapsedGroupKeys || u.keys.size === 0 && t.collapsedGroupKeys.size === 0 ? t : {
|
|
294
377
|
...t,
|
|
295
|
-
collapsedGroupKeys:
|
|
378
|
+
collapsedGroupKeys: u.keys
|
|
296
379
|
};
|
|
297
380
|
case "detail/toggle": {
|
|
298
381
|
let e = new Set(t.expandedDetailRowKeys);
|
|
299
|
-
return e.has(
|
|
382
|
+
return e.has(u.rowKey) ? e.delete(u.rowKey) : e.add(u.rowKey), {
|
|
300
383
|
...t,
|
|
301
384
|
expandedDetailRowKeys: e
|
|
302
385
|
};
|
|
303
386
|
}
|
|
304
387
|
case "detail/setExpanded": {
|
|
305
|
-
if (t.expandedDetailRowKeys.has(
|
|
388
|
+
if (t.expandedDetailRowKeys.has(u.rowKey) === u.expanded) return t;
|
|
306
389
|
let e = new Set(t.expandedDetailRowKeys);
|
|
307
|
-
return
|
|
390
|
+
return u.expanded ? e.add(u.rowKey) : e.delete(u.rowKey), {
|
|
308
391
|
...t,
|
|
309
392
|
expandedDetailRowKeys: e
|
|
310
393
|
};
|
|
311
394
|
}
|
|
312
|
-
case "detail/setKeys": return
|
|
395
|
+
case "detail/setKeys": return u.keys === t.expandedDetailRowKeys || u.keys.size === 0 && t.expandedDetailRowKeys.size === 0 ? t : {
|
|
313
396
|
...t,
|
|
314
|
-
expandedDetailRowKeys:
|
|
397
|
+
expandedDetailRowKeys: u.keys
|
|
315
398
|
};
|
|
316
399
|
default: return t;
|
|
317
400
|
}
|
|
318
401
|
};
|
|
319
402
|
//#endregion
|
|
320
|
-
export {
|
|
403
|
+
export { u as createInitialGridUiState, d as gridUiReducer };
|