@noraent/nora-datagrid 0.0.188 → 0.0.189
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/buildPackage.json
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
to {
|
|
3
3
|
transform: rotate(360deg);
|
|
4
4
|
}
|
|
5
|
-
`,Rn=i.forwardRef(((r,t)=>{const{gridRef:e}=r,u=function(r){const t=function(r){const t=n.useRef(null),e=n.useRef(null);return t.current||(t.current={}),e.current||(e.current=function(n){const r={getPublicApi:()=>n,register:(t,e)=>{Object.keys(e).forEach((u=>{"public"===t?n[u]=e[u]:r[u]=e[u]}))}};return new Proxy(r,{get:(n,t)=>t in n?n[t]:r[t],set:(n,r,t)=>(n[r]=t,!0)})}(t.current)),n.useImperativeHandle(r,(()=>t.current),[]),e}(r);return function(r){const t=n.useCallback((()=>r.current.store.state.dataSource),[]),e=n.useCallback((()=>r.current.store.state.dataSource.filter((n=>r.current.store.u.includes(n.o)))),[]),u=n.useCallback((n=>{if(r.current.initHeightCache(),r.current.store.gridContainer.current){const t=r.current.store.gridContainer.current.querySelector(`.${j}`);if(t){const e=r.current.getScrollTop(n);t.scrollTop=e}}}),[]),i=n.useCallback((n=>{const t=structuredClone(r.current.store.U);t.push(n),r.current={...r.current,store:{...r.current.store,U:t}}}),[]),o=n.useCallback(((n,t=32)=>{r.current.store.state.dataSource[n]={...r.current.store.state.dataSource[n],height:t},r.current.initHeightCache(),r.current.store.W=`${Math.random()}`,r.current.store.updateKeyTemp.add("state, dataSource"),r.current.store.updateKeyTemp.add("__randomDataSourceKey"),r.current.store.updateKeyTemp.add("cumulativeHeights"),setTimeout((()=>{r.current.getPublicApi().forceUpdate()}),10)}),[]),f=n.useCallback((n=>{const t=r.current.store.state.dataSource.filter(((r,t)=>n.includes(t))).flatMap((n=>n.o)),e=r.current.store.state.dataSource.filter(((r,t)=>n.includes(t)))
|
|
5
|
+
`,Rn=i.forwardRef(((r,t)=>{const{gridRef:e}=r,u=function(r){const t=function(r){const t=n.useRef(null),e=n.useRef(null);return t.current||(t.current={}),e.current||(e.current=function(n){const r={getPublicApi:()=>n,register:(t,e)=>{Object.keys(e).forEach((u=>{"public"===t?n[u]=e[u]:r[u]=e[u]}))}};return new Proxy(r,{get:(n,t)=>t in n?n[t]:r[t],set:(n,r,t)=>(n[r]=t,!0)})}(t.current)),n.useImperativeHandle(r,(()=>t.current),[]),e}(r);return function(r){const t=n.useCallback((()=>r.current.store.state.dataSource),[]),e=n.useCallback((()=>r.current.store.state.dataSource.filter((n=>r.current.store.u.includes(n.o)))),[]),u=n.useCallback((n=>{if(r.current.initHeightCache(),r.current.store.gridContainer.current){const t=r.current.store.gridContainer.current.querySelector(`.${j}`);if(t){const e=r.current.getScrollTop(n);t.scrollTop=e}}}),[]),i=n.useCallback((n=>{const t=structuredClone(r.current.store.U);t.push(n),r.current={...r.current,store:{...r.current.store,U:t}}}),[]),o=n.useCallback(((n,t=32)=>{r.current.store.state.dataSource[n]={...r.current.store.state.dataSource[n],height:t},r.current.initHeightCache(),r.current.store.W=`${Math.random()}`,r.current.store.updateKeyTemp.add("state, dataSource"),r.current.store.updateKeyTemp.add("__randomDataSourceKey"),r.current.store.updateKeyTemp.add("cumulativeHeights"),setTimeout((()=>{r.current.getPublicApi().forceUpdate()}),10)}),[]),f=n.useCallback((n=>{const t=r.current.store.state.dataSource.filter(((r,t)=>n.includes(t))).flatMap((n=>n.o)),e=r.current.store.state.dataSource.filter(((r,t)=>n.includes(t)));r.current.store.u=t,r.current.store.updateKeyTemp.add("__selectionList"),setTimeout((()=>{var n;null==(n=r.current.getPublicApi())||n.forceUpdate(),r.current.store.state.onSelectionRowChange&&r.current.store.state.onSelectionRowChange(e)}),10)}),[]);d(r,{addCellRange:i,getData:t,scrollToRowIndex:u,setRowHeight:o,getSelectedRow:e,setSelection:f},"public")}(t),function(r){const t=n.useCallback((()=>{}),[]),e=n.useCallback((n=>{r.current={...r.current,store:{...r.current.store,gridContainer:n}}}),[]),u=n.useCallback((n=>{const t=i(n),e=["__selectionMode","__checkboxSelection"].reduce(((r,t)=>("__selectionMode"===t&&(r[t]=n.selectionMode??"single"),"__checkboxSelection"===t&&(r[t]=n.checkboxSelection??!0),r)),{});return r.current={...r.current,store:{...r.current.store,original:t,state:{...t},U:[],H:{},p:0,cumulativeHeights:[],u:[],updateKeyTemp:new Set,W:"",h:"single",v:!1,l:!0,...e}},r.current}),[]),i=n.useCallback((n=>["columns","dataSource","cellFocus","editStatus","readOnly","onSelectionRowChange"].reduce(((r,t)=>{if(t in n)if("dataSource"===t)r[t]=n[t].map((({height:n=32,...r},t)=>({height:n,...r,o:window.crypto.randomUUID(),N:t,L:t+1})));else if("columns"===t){const e=/[^0-9]/g;r[t]=n[t].map((({width:n=20,...r},t)=>({width:Number(`${n}`.replace(e,"")),...r,o:window.crypto.randomUUID(),m:t,i:t+1})))}else r[t]=n[t];else r[t]=function(n){return{cellFocus:[],columns:void 0,dataSource:void 0,gridRef:void 0,renderedRowStartEnd:void 0,editStatus:void 0,readOnly:!1,selectionMode:"multiple",checkboxSelection:!0,onSelectionRowChange:()=>{}}[n]}(t);return r}),{})),[]),o=n.useCallback((n=>{if(r.current.initHeightCache(),r.current.store.gridContainer.current){const t=r.current.store.gridContainer.current.querySelector(`.${j}`);if(t){const r=h(n);t.scrollTop=r}}}),[]),f=n.useCallback((n=>{const t=Object.assign(r.current.store.H,n);r.current={...r.current,store:{...r.current.store,H:t}}}),[]),c=n.useCallback((async(n,t)=>{const{store:e}=r.current,{dataSource:u,columns:i}=e.state,o=[n?Math.max(1,Math.min(n,u.length)):void 0,t?Math.max(1,Math.min(t,i.length)):void 0];return e.state.cellFocus=o,o}),[]),a=n.useCallback((()=>{const{store:n}=r.current;return n.state.cellFocus}),[]),l=n.useCallback((async n=>{const{store:t}=r.current;return t.state.editStatus=n,t.state.editStatus}),[]),s=n.useCallback((async(n,t,e)=>{const{store:u}=r.current;return u.state.dataSource[n]={...u.state.dataSource[n],[t]:e},u.state.dataSource}),[]),v=n.useCallback((()=>{let n=0;const t=r.current.store.state.dataSource.length-1,e=r.current.store.state.dataSource.map(((r,e)=>(n+=r.height??32,t===e?n+40:n)));return e[0]=0,r.current.store.cumulativeHeights=e,e}),[]),h=n.useCallback((n=>{let t=0,e=r.current.store.cumulativeHeights.length-1,u=0;for(;e>=t;){const i=Math.floor((t+e)/2);i>n?e=i-1:(u=r.current.store.cumulativeHeights[i],t=i+1)}return u}),[]);d(r,{setText:t,setGridContainer:e,setInitialStore:u,scrollToRowIndex:o,addCellRangeTemp:f,setCellFocus:c,getCellFocus:a,setEditStatus:l,cellByRowIndex:s,setBasicStore:i,initHeightCache:v,getScrollTop:h},"private")}(t),t}(e),o=i.useRef(null),[f,c]=i.useTransition();i.useEffect((()=>{c((()=>{u.current.setGridContainer(o),u.current.setInitialStore(r),u.current.initHeightCache()}))}),[]);const a=i.useRef(null);return function(t,e){const i=n.useRef(!1);n.useEffect((()=>{i.current?c((()=>{a.current?Object.keys(r).forEach((n=>{var t;const e=n;if(a.current&&(null==(t=a.current)?void 0:t[e])!==r[e]){const t=u.current.setBasicStore(r);u.current.store.original[e]=t[e],u.current.store.state[e]=t[e],"dataSource"===n&&u.current.initHeightCache()}})):Object.keys(r).forEach((n=>{const t=n,e=u.current.setBasicStore(r);u.current.store.original[t]=e[t],u.current.store.state[t]=e[t],"dataSource"===n&&u.current.initHeightCache()})),a.current=r})):i.current=!0}),e)}(0,[r]),v.jsx(v.Fragment,{children:v.jsx(O.Provider,{value:u,children:v.jsx(E,{value:u,children:v.jsxs(z,{ref:o,children:[v.jsx(z.Title,{}),v.jsxs(z.Body,{children:[f&&v.jsxs(Sn,{children:[v.jsx(Cn,{}),v.jsx(An,{style:{marginTop:"8px",fontSize:"14px"},children:"로딩중"})]}),!f&&u.current.store&&v.jsx(mn,{})]})]})})})})})),kn=i.memo(Rn);exports.DataGrid=kn,exports.useGridApiRef=()=>n.useRef({});
|
package/dist/nora_datagrid.es.js
CHANGED
|
@@ -485,13 +485,13 @@ function usePublicTest(apiRef) {
|
|
|
485
485
|
}, []);
|
|
486
486
|
const setSelection = React__default.useCallback((rowIndexs) => {
|
|
487
487
|
const uuids = apiRef.current.store.state.dataSource.filter((_v, i) => rowIndexs.includes(i)).flatMap((v) => v.__uuid);
|
|
488
|
-
const
|
|
488
|
+
const rows = apiRef.current.store.state.dataSource.filter((_v, i) => rowIndexs.includes(i));
|
|
489
489
|
apiRef.current.store.__selectionList = uuids;
|
|
490
490
|
apiRef.current.store.updateKeyTemp.add("__selectionList");
|
|
491
491
|
setTimeout(() => {
|
|
492
492
|
var _a;
|
|
493
493
|
(_a = apiRef.current.getPublicApi()) == null ? void 0 : _a.forceUpdate();
|
|
494
|
-
apiRef.current.store.state.onSelectionRowChange && apiRef.current.store.state.onSelectionRowChange(
|
|
494
|
+
apiRef.current.store.state.onSelectionRowChange && apiRef.current.store.state.onSelectionRowChange(rows);
|
|
495
495
|
}, 10);
|
|
496
496
|
}, []);
|
|
497
497
|
const apiMethods = { addCellRange, getData, scrollToRowIndex, setRowHeight, getSelectedRow, setSelection };
|