Compare commits
	
		
			No commits in common. "9506d123f33fc10875f0b0655a56e9f72d0d8eef" and "af68d6d37744265bfa54ce0020eb0c4d58dadb01" have entirely different histories.
		
	
	
		
			9506d123f3
			...
			af68d6d377
		
	
		
| @ -1,11 +1,5 @@ | |||||||
| # @warkypublic/zustandsyncstore | # @warkypublic/zustandsyncstore | ||||||
| 
 | 
 | ||||||
| ## 0.0.6 |  | ||||||
| 
 |  | ||||||
| ### Patch Changes |  | ||||||
| 
 |  | ||||||
| - 182a5f8: Flex changes and event handlers |  | ||||||
| 
 |  | ||||||
| ## 0.0.5 | ## 0.0.5 | ||||||
| 
 | 
 | ||||||
| ### Patch Changes | ### Patch Changes | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| { | { | ||||||
|   "name": "@warkypublic/oranguru", |   "name": "@warkypublic/oranguru", | ||||||
|   "author": "Warky Devs", |   "author": "Warky Devs", | ||||||
|   "version": "0.0.6", |   "version": "0.0.5", | ||||||
|   "type": "module", |   "type": "module", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "dev": "vite", |     "dev": "vite", | ||||||
|  | |||||||
| @ -3,7 +3,11 @@ | |||||||
|     1px 0 0 #00000030, |     1px 0 0 #00000030, | ||||||
|     0 1px 0 #00000030, |     0 1px 0 #00000030, | ||||||
|     -1px 0 0 #00000030; |     -1px 0 0 #00000030; | ||||||
| 
 |   display: flex; | ||||||
|  |   min-height: 40px; | ||||||
|  |   min-width: 40px; | ||||||
|  |   height: 100%; | ||||||
|  |   width: 100%; | ||||||
|    |    | ||||||
|   &[data-focused='true'] { |   &[data-focused='true'] { | ||||||
|     box-shadow: |     box-shadow: | ||||||
|  | |||||||
| @ -24,19 +24,7 @@ export const GridlerDataGrid = () => { | |||||||
|   const ref = React.useRef<DataEditorRef | null>(null); |   const ref = React.useRef<DataEditorRef | null>(null); | ||||||
|   const refContextActivated = React.useRef<boolean>(false); |   const refContextActivated = React.useRef<boolean>(false); | ||||||
| 
 | 
 | ||||||
|   const { height, ref: refWrapper, width } = useElementSize({ box: 'content-box' }); |   const { height, ref: refWrapper, width } = useElementSize(); | ||||||
|   /* |  | ||||||
|     const [_dimensions, setDimensions] = useState<{ height: number; width: number } | null>(null); |  | ||||||
|   const { height, width } = _dimensions ?? { height: 0, width: 0 }; |  | ||||||
| 
 |  | ||||||
|   useLayoutEffect(() => { |  | ||||||
|     // Measure container before rendering grid
 |  | ||||||
|     if (refWrapper.current) { |  | ||||||
|       const { height, width } = refWrapper.current.getBoundingClientRect(); |  | ||||||
|       setDimensions({ height, width }); |  | ||||||
|     } |  | ||||||
|   }, []); |  | ||||||
|    */ |  | ||||||
| 
 | 
 | ||||||
|   const { |   const { | ||||||
|     _gridSelection, |     _gridSelection, | ||||||
| @ -49,7 +37,6 @@ export const GridlerDataGrid = () => { | |||||||
|     headerHeight, |     headerHeight, | ||||||
|     heightProp, |     heightProp, | ||||||
|     mounted, |     mounted, | ||||||
|     onCellClicked, |  | ||||||
|     onCellEdited, |     onCellEdited, | ||||||
|     onColumnMoved, |     onColumnMoved, | ||||||
|     onColumnProposeMove, |     onColumnProposeMove, | ||||||
| @ -78,7 +65,6 @@ export const GridlerDataGrid = () => { | |||||||
|     headerHeight: s.headerHeight, |     headerHeight: s.headerHeight, | ||||||
|     heightProp: s.height, |     heightProp: s.height, | ||||||
|     mounted: s.mounted, |     mounted: s.mounted, | ||||||
|     onCellClicked: s.onCellClicked, |  | ||||||
|     onCellEdited: s.onCellEdited, |     onCellEdited: s.onCellEdited, | ||||||
|     onColumnMoved: s.onColumnMoved, |     onColumnMoved: s.onColumnMoved, | ||||||
|     onColumnProposeMove: s.onColumnProposeMove, |     onColumnProposeMove: s.onColumnProposeMove, | ||||||
| @ -86,7 +72,6 @@ export const GridlerDataGrid = () => { | |||||||
|     onContextClick: s.onContextClick, |     onContextClick: s.onContextClick, | ||||||
|     onHeaderClicked: s.onHeaderClicked, |     onHeaderClicked: s.onHeaderClicked, | ||||||
|     onHeaderMenuClick: s.onHeaderMenuClick, |     onHeaderMenuClick: s.onHeaderMenuClick, | ||||||
| 
 |  | ||||||
|     onItemHovered: s.onItemHovered, |     onItemHovered: s.onItemHovered, | ||||||
|     onVisibleRegionChanged: s.onVisibleRegionChanged, |     onVisibleRegionChanged: s.onVisibleRegionChanged, | ||||||
|     renderColumns: s.renderColumns, |     renderColumns: s.renderColumns, | ||||||
| @ -137,13 +122,6 @@ export const GridlerDataGrid = () => { | |||||||
|           } |           } | ||||||
|         }} |         }} | ||||||
|         ref={refWrapper} |         ref={refWrapper} | ||||||
|         style={{ |  | ||||||
|           display: 'flex', |  | ||||||
|           height: '100%', |  | ||||||
|           minHeight: '64px', |  | ||||||
|           minWidth: '32px', |  | ||||||
|           width: '100%', |  | ||||||
|         }} |  | ||||||
|       > |       > | ||||||
|         {sections?.left} |         {sections?.left} | ||||||
| 
 | 
 | ||||||
| @ -154,14 +132,8 @@ export const GridlerDataGrid = () => { | |||||||
|             columns={(renderColumns as Array<GridColumn>) ?? []} |             columns={(renderColumns as Array<GridColumn>) ?? []} | ||||||
|             columnSelect="none" |             columnSelect="none" | ||||||
|             drawFocusRing |             drawFocusRing | ||||||
|             height={height ?? 400} |             height={(height ?? 400) - 4} | ||||||
|             overscrollX={16} |  | ||||||
|             overscrollY={32} |  | ||||||
|             rangeSelect="multi-rect" |             rangeSelect="multi-rect" | ||||||
|             rightElementProps={{ |  | ||||||
|               fill: false, |  | ||||||
|               sticky: true, |  | ||||||
|             }} |  | ||||||
|             rowMarkers={{ |             rowMarkers={{ | ||||||
|               checkboxStyle: 'square', |               checkboxStyle: 'square', | ||||||
|               kind: 'both', |               kind: 'both', | ||||||
| @ -176,7 +148,6 @@ export const GridlerDataGrid = () => { | |||||||
|             gridSelection={_gridSelection} |             gridSelection={_gridSelection} | ||||||
|             headerHeight={headerHeight ?? 32} |             headerHeight={headerHeight ?? 32} | ||||||
|             headerIcons={{ sort: SortSprite, sortdown: SortDownSprite, sortup: SortUpSprite }} |             headerIcons={{ sort: SortSprite, sortdown: SortDownSprite, sortup: SortUpSprite }} | ||||||
|             onCellClicked={onCellClicked} |  | ||||||
|             onCellContextMenu={(cell, event) => { |             onCellContextMenu={(cell, event) => { | ||||||
|               event.preventDefault(); |               event.preventDefault(); | ||||||
|               glideProps?.onCellContextMenu?.(cell, event); |               glideProps?.onCellContextMenu?.(cell, event); | ||||||
| @ -258,10 +229,8 @@ export const GridlerDataGrid = () => { | |||||||
|         {!hasLocalData && <Pager />} |         {!hasLocalData && <Pager />} | ||||||
|         {sections?.right} |         {sections?.right} | ||||||
|       </div> |       </div> | ||||||
|       <div style={{ flexGrow: 0 }}> |       <BottomBar /> | ||||||
|         <BottomBar /> |       {sections?.bottom} | ||||||
|         {sections?.bottom} |  | ||||||
|       </div> |  | ||||||
|       {/* <Portal> */} |       {/* <Portal> */} | ||||||
|     </Stack> |     </Stack> | ||||||
|   ); |   ); | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ export interface GridlerColumn extends Partial<BaseGridColumn> { | |||||||
|     colIndx: string, |     colIndx: string, | ||||||
|     value: any, |     value: any, | ||||||
|     storeState: GridlerStoreState |     storeState: GridlerStoreState | ||||||
|   ) => Partial<GridCellLoose>; |   ) => GridCellLoose; | ||||||
|   defaultIcon?: string; |   defaultIcon?: string; | ||||||
|   disableFilter?: boolean; |   disableFilter?: boolean; | ||||||
|   disableMove?: boolean; |   disableMove?: boolean; | ||||||
|  | |||||||
| @ -181,11 +181,6 @@ export const Computer = React.memo(() => { | |||||||
|       })); |       })); | ||||||
|     }).then(() => { |     }).then(() => { | ||||||
|       loadPage(0, 'all'); |       loadPage(0, 'all'); | ||||||
|       getState('_events')?.dispatchEvent?.( |  | ||||||
|         new CustomEvent('onColumnSorted', { |  | ||||||
|           detail: { cols: colSort }, |  | ||||||
|         }) |  | ||||||
|       ); |  | ||||||
|     }); |     }); | ||||||
|   }, [colSort]); |   }, [colSort]); | ||||||
| 
 | 
 | ||||||
| @ -197,11 +192,6 @@ export const Computer = React.memo(() => { | |||||||
|     if (JSON.stringify(refLastFilters.current) !== JSON.stringify(colFilters)) { |     if (JSON.stringify(refLastFilters.current) !== JSON.stringify(colFilters)) { | ||||||
|       loadPage(0, 'all'); |       loadPage(0, 'all'); | ||||||
|       refLastFilters.current = colFilters; |       refLastFilters.current = colFilters; | ||||||
|       getState('_events')?.dispatchEvent?.( |  | ||||||
|         new CustomEvent('onColumnFiltered', { |  | ||||||
|           detail: { filters: colFilters }, |  | ||||||
|         }) |  | ||||||
|       ); |  | ||||||
|     } |     } | ||||||
|   }, [colFilters]); |   }, [colFilters]); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| /* eslint-disable @typescript-eslint/no-explicit-any */ | /* eslint-disable @typescript-eslint/no-explicit-any */ | ||||||
| 
 | /* eslint-disable react/react-in-jsx-scope */ | ||||||
| /* eslint-disable react-refresh/only-export-components */ | /* eslint-disable react-refresh/only-export-components */ | ||||||
| /* eslint-disable @typescript-eslint/no-unused-vars */ | /* eslint-disable @typescript-eslint/no-unused-vars */ | ||||||
| import { | import { | ||||||
| @ -143,7 +143,6 @@ export interface GridlerState { | |||||||
|   loadingData?: boolean; |   loadingData?: boolean; | ||||||
|   loadPage: (page: number, clearMode?: 'all' | 'page') => Promise<void>; |   loadPage: (page: number, clearMode?: 'all' | 'page') => Promise<void>; | ||||||
|   mounted: boolean; |   mounted: boolean; | ||||||
|   onCellClicked: (cell: Item, event: CellClickedEventArgs) => void; |  | ||||||
|   onCellEdited: (cell: Item, newVal: EditableGridCell) => void; |   onCellEdited: (cell: Item, newVal: EditableGridCell) => void; | ||||||
|   onColumnMoved: (from: number, to: number) => void; |   onColumnMoved: (from: number, to: number) => void; | ||||||
|   onColumnProposeMove: (startIndex: number, endIndex: number) => boolean; |   onColumnProposeMove: (startIndex: number, endIndex: number) => boolean; | ||||||
| @ -341,16 +340,6 @@ const { Provider, useStore: useGridlerStore } = createSyncStore<GridlerStoreStat | |||||||
|     }, |     }, | ||||||
|     maxConcurrency: 1, |     maxConcurrency: 1, | ||||||
|     mounted: false, |     mounted: false, | ||||||
|     onCellClicked: (cell: Item, event: CellClickedEventArgs) => { |  | ||||||
|       const state = get(); |  | ||||||
|       const [col, row] = cell; |  | ||||||
|       state.glideProps?.onCellClicked?.(cell, event); |  | ||||||
|       state._events.dispatchEvent( |  | ||||||
|         new CustomEvent('onCellClicked', { |  | ||||||
|           detail: { cell, col, row, state }, |  | ||||||
|         }) |  | ||||||
|       ); |  | ||||||
|     }, |  | ||||||
|     onCellEdited: (cell: Item, newVal: EditableGridCell) => { |     onCellEdited: (cell: Item, newVal: EditableGridCell) => { | ||||||
|       const state = get(); |       const state = get(); | ||||||
|       const [, row] = cell; |       const [, row] = cell; | ||||||
| @ -362,7 +351,6 @@ const { Provider, useStore: useGridlerStore } = createSyncStore<GridlerStoreStat | |||||||
|           detail: { cell, newVal, row, state }, |           detail: { cell, newVal, row, state }, | ||||||
|         }) |         }) | ||||||
|       ); |       ); | ||||||
|       state.glideProps?.onCellEdited?.(cell, newVal); |  | ||||||
|     }, |     }, | ||||||
|     onColumnMoved: (from: number, to: number) => { |     onColumnMoved: (from: number, to: number) => { | ||||||
|       const s = get(); |       const s = get(); | ||||||
| @ -749,7 +737,7 @@ const { Provider, useStore: useGridlerStore } = createSyncStore<GridlerStoreStat | |||||||
|         const val = String(ref).includes('.') ? (getNestedValue(ref, row) ?? '') : row?.[ref]; |         const val = String(ref).includes('.') ? (getNestedValue(ref, row) ?? '') : row?.[ref]; | ||||||
| 
 | 
 | ||||||
|         if (coldef?.Cell) { |         if (coldef?.Cell) { | ||||||
|           return { kind: GridCellKind.Text, ...coldef?.Cell(row, col, ref, val, s) } as GridCell; |           return coldef?.Cell(row, col, ref, val, s) as GridCell; | ||||||
|         } |         } | ||||||
|         if (s.RenderCell) { |         if (s.RenderCell) { | ||||||
|           return s.RenderCell(row, col, ref, val, s); |           return s.RenderCell(row, col, ref, val, s); | ||||||
|  | |||||||
| @ -18,25 +18,6 @@ export const GridlerGoAPIExampleEventlog = () => { | |||||||
|   const [sections, setSections] = useState<Record<string, unknown> | undefined>(undefined); |   const [sections, setSections] = useState<Record<string, unknown> | undefined>(undefined); | ||||||
|   const columns: GridlerColumns = [ |   const columns: GridlerColumns = [ | ||||||
|     { |     { | ||||||
|       Cell: (row) => { |  | ||||||
|         const process = `${ |  | ||||||
|           row?.cql2?.length > 0 |  | ||||||
|             ? '🔖' |  | ||||||
|             : row?.cql1?.length > 0 |  | ||||||
|               ? '📕' |  | ||||||
|               : row?.status === 1 |  | ||||||
|                 ? '💡' |  | ||||||
|                 : row?.status === 2 |  | ||||||
|                   ? '🔒' |  | ||||||
|                   : '⚙️' |  | ||||||
|         } ${String(row?.id_process ?? '0')}`;
 |  | ||||||
| 
 |  | ||||||
|         return { |  | ||||||
|           data: process, |  | ||||||
|           displayData: process, |  | ||||||
|           status: row?.status, |  | ||||||
|         } as any; |  | ||||||
|       }, |  | ||||||
|       id: 'id_process', |       id: 'id_process', | ||||||
|       title: 'RID', |       title: 'RID', | ||||||
|       width: 100, |       width: 100, | ||||||
| @ -64,7 +45,7 @@ export const GridlerGoAPIExampleEventlog = () => { | |||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   return ( |   return ( | ||||||
|     <Stack h="80vh" w="50vw"> |     <Stack h="80vh"> | ||||||
|       <h2>Demo Using Go API Adaptor</h2> |       <h2>Demo Using Go API Adaptor</h2> | ||||||
|       <TextInput label="API Url" onChange={(e) => setApiUrl(e.target.value)} value={apiUrl} /> |       <TextInput label="API Url" onChange={(e) => setApiUrl(e.target.value)} value={apiUrl} /> | ||||||
|       <TextInput label="API Key" onChange={(e) => setApiKey(e.target.value)} value={apiKey} /> |       <TextInput label="API Key" onChange={(e) => setApiKey(e.target.value)} value={apiKey} /> | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user