@noraent/nora-datagrid 0.0.194 → 0.0.195

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noraent/nora-datagrid",
3
- "version": "0.0.194",
3
+ "version": "0.0.195",
4
4
  "module": "./dist/nora_datagrid.es.js",
5
5
  "main": "./dist/nora_datagrid.cjs.js",
6
6
  "private": false,
@@ -2,4 +2,4 @@
2
2
  to {
3
3
  transform: rotate(360deg);
4
4
  }
5
- `,xn=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((()=>{const n=r.current.store.state.cellFocus[0]?Math.max(r.current.store.state.cellFocus[0]-1,0):void 0,t=r.current.store.state.cellFocus[1]?Math.max(r.current.store.state.cellFocus[1]-1,0):void 0;if(void 0===n||void 0===t)return;const e=r.current.store.state.columns[t],u=r.current.store.state.dataSource[n];return e?{id:u.id,field:e.fieldId,fieldName:e.fieldName,value:u[e.fieldId],startRowIndex:n,endRowIndex:t}:void 0}),[]),i=n.useCallback((n=>{if(r.current.initHeightCache(),r.current.store.gridContainer.current){const t=r.current.store.gridContainer.current.querySelector(`.${g.body.scroll.root}`);if(t){const e=r.current.getScrollTop(n);t.scrollTop=e}}}),[]),o=n.useCallback((n=>{const t=structuredClone(r.current.store.U);t.push(n),r.current={...r.current,store:{...r.current.store,U:t}}}),[]),f=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)}),[]),c=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:o,getData:t,scrollToRowIndex:i,setRowHeight:f,getSelectedRow:e,setSelection:c,getSelectedCell:u},"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","onCellClick"].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(),L:t,N: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:()=>{},onCellClick:()=>{}}[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(`.${g.body.scroll.root}`);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(R.Provider,{value:u,children:v.jsx(S,{value:u,children:v.jsxs(E,{ref:o,children:[v.jsx(E.Title,{}),v.jsxs(E.Body,{children:[f&&v.jsxs(pn,{children:[v.jsx(bn,{}),v.jsx(wn,{style:{marginTop:"8px",fontSize:"14px"},children:"로딩중"})]}),!f&&u.current.store&&v.jsx(hn,{})]})]})})})})})),_n=i.memo(xn);exports.DataGrid=_n,exports.classes=x,exports.useGridApiRef=()=>n.useRef({});
5
+ `,xn=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((()=>{const n=r.current.store.state.cellFocus[0]?Math.max(r.current.store.state.cellFocus[0]-1,0):void 0,t=r.current.store.state.cellFocus[1]?Math.max(r.current.store.state.cellFocus[1]-1,0):void 0;if(void 0===n||void 0===t)return;const e=r.current.store.state.columns[t],u=r.current.store.state.dataSource[n];return e?{id:u.id,field:e.fieldId,fieldName:e.fieldName,value:u[e.fieldId],row:u,startRowIndex:n,endRowIndex:t}:void 0}),[]),i=n.useCallback((n=>{if(r.current.initHeightCache(),r.current.store.gridContainer.current){const t=r.current.store.gridContainer.current.querySelector(`.${g.body.scroll.root}`);if(t){const e=r.current.getScrollTop(n);t.scrollTop=e}}}),[]),o=n.useCallback((n=>{const t=structuredClone(r.current.store.U);t.push(n),r.current={...r.current,store:{...r.current.store,U:t}}}),[]),f=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)}),[]),c=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:o,getData:t,scrollToRowIndex:i,setRowHeight:f,getSelectedRow:e,setSelection:c,getSelectedCell:u},"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","onCellClick"].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(),L:t,N: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:()=>{},onCellClick:()=>{}}[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(`.${g.body.scroll.root}`);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(R.Provider,{value:u,children:v.jsx(S,{value:u,children:v.jsxs(E,{ref:o,children:[v.jsx(E.Title,{}),v.jsxs(E.Body,{children:[f&&v.jsxs(pn,{children:[v.jsx(bn,{}),v.jsx(wn,{style:{marginTop:"8px",fontSize:"14px"},children:"로딩중"})]}),!f&&u.current.store&&v.jsx(hn,{})]})]})})})})})),_n=i.memo(xn);exports.DataGrid=_n,exports.classes=x,exports.useGridApiRef=()=>n.useRef({});
@@ -488,6 +488,7 @@ function usePublicTest(apiRef) {
488
488
  field: column.fieldId,
489
489
  fieldName: column.fieldName,
490
490
  value: row[column.fieldId],
491
+ row,
491
492
  startRowIndex,
492
493
  endRowIndex
493
494
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noraent/nora-datagrid",
3
- "version": "0.0.194",
3
+ "version": "0.0.195",
4
4
  "module": "./dist/nora_datagrid.es.js",
5
5
  "main": "./dist/nora_datagrid.cjs.js",
6
6
  "private": false,