@gp-grid/vue 0.8.2 → 0.9.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/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as vue from "vue";
2
2
  import { Component as Component$1, ComputedRef, Ref, ShallowRef, VNode } from "vue";
3
- import * as _gp_grid_core0 from "@gp-grid/core";
4
- import { CellDataType, CellPosition, CellPosition as CellPosition$1, CellRange, CellRange as CellRange$1, CellRendererParams, CellRendererParams as CellRendererParams$1, CellValue, CellValue as CellValue$1, CellValueChangedEvent, CellValueChangedEvent as CellValueChangedEvent$1, ColumnDefinition, ColumnDefinition as ColumnDefinition$1, ColumnFilterModel, ColumnFilterModel as ColumnFilterModel$1, ContainerBounds, DataSource, DataSource as DataSource$1, DataSourceRequest, DataSourceResponse, DateFilterCondition, DragState, DragState as DragState$1, EditRendererParams, EditRendererParams as EditRendererParams$1, FilterCondition, FilterModel, FilterPopupState, GridCore, GridCore as GridCore$1, GridInstruction, GridInstruction as GridInstruction$1, GridState, GridState as GridState$1, HeaderData, HeaderData as HeaderData$1, HeaderRendererParams, HeaderRendererParams as HeaderRendererParams$1, HighlightingOptions, KeyEventData, MutableDataSource, MutableDataSource as MutableDataSource$1, NumberFilterCondition, ParallelSortOptions, PointerEventData, Row, Row as Row$1, RowId, RowId as RowId$1, SelectionState, SlotData, SlotData as SlotData$1, SortDirection, SortDirection as SortDirection$1, SortModel, TextFilterCondition, buildCellClasses, buildCellClasses as buildCellClasses$1, calculateColumnPositions, createClientDataSource, createDataSourceFromArray, createMutableClientDataSource, createServerDataSource, findColumnAtX, getTotalWidth, gridStyles, injectStyles, isCellActive, isCellActive as isCellActive$1, isCellEditing, isCellEditing as isCellEditing$1, isCellInFillPreview, isCellInFillPreview as isCellInFillPreview$1, isCellSelected, isCellSelected as isCellSelected$1, isRowVisible } from "@gp-grid/core";
3
+ import { CellDataType, CellPosition, CellPosition as CellPosition$1, CellRange, CellRange as CellRange$1, CellRendererParams, CellRendererParams as CellRendererParams$1, CellValue, CellValue as CellValue$1, CellValueChangedEvent, CellValueChangedEvent as CellValueChangedEvent$1, ColumnDefinition as ColumnDefinition$1, ColumnDefinition as ColumnDefinition$2, ColumnFilterModel, ColumnFilterModel as ColumnFilterModel$1, ContainerBounds, DataSource, DataSource as DataSource$1, DataSourceRequest, DataSourceResponse, DateFilterCondition, DragState, DragState as DragState$1, EditRendererParams, EditRendererParams as EditRendererParams$1, FillHandlePosition, FilterCondition, FilterModel, FilterPopupState, GridCore, GridCore as GridCore$1, GridInstruction, GridInstruction as GridInstruction$1, GridState, GridState as GridState$1, HeaderData, HeaderRendererParams, HeaderRendererParams as HeaderRendererParams$1, HighlightingOptions, KeyEventData, MutableDataSource, MutableDataSource as MutableDataSource$1, NumberFilterCondition, ParallelSortOptions, PointerEventData, Row, Row as Row$1, RowId, RowId as RowId$1, SelectionState, SlotData, SlotData as SlotData$1, SortDirection, SortDirection as SortDirection$1, SortModel, TextFilterCondition, VisibleColumnInfo, buildCellClasses, buildCellClasses as buildCellClasses$1, calculateColumnPositions, createClientDataSource, createDataSourceFromArray, createInitialState, createMutableClientDataSource, createServerDataSource, findColumnAtX, getFieldValue as getCellValue, getTotalWidth, gridStyles, injectStyles, isCellActive, isCellActive as isCellActive$1, isCellEditing, isCellEditing as isCellEditing$1, isCellInFillPreview, isCellInFillPreview as isCellInFillPreview$1, isCellSelected, isCellSelected as isCellSelected$1, isRowVisible } from "@gp-grid/core";
5
4
 
6
5
  //#region src/types.d.ts
7
6
  /**
@@ -17,7 +16,7 @@ type VueEditRenderer<TData extends Row$1 = Row$1> = (params: EditRendererParams$
17
16
  */
18
17
  type VueHeaderRenderer = (params: HeaderRendererParams$1) => VNode | string | null;
19
18
  interface GpGridProps<TData extends Row$1 = Row$1> {
20
- columns: ColumnDefinition$1[];
19
+ columns: ColumnDefinition$2[];
21
20
  dataSource?: DataSource$1<TData>;
22
21
  rowData?: TData[];
23
22
  rowHeight: number;
@@ -44,7 +43,7 @@ interface GpGridProps<TData extends Row$1 = Row$1> {
44
43
  //#endregion
45
44
  //#region src/GpGrid.vue.d.ts
46
45
  type __VLS_Props = {
47
- columns: ColumnDefinition$1[];
46
+ columns: ColumnDefinition$2[];
48
47
  dataSource?: DataSource$1<Row$1>;
49
48
  rowData?: Row$1[];
50
49
  rowHeight: number;
@@ -66,7 +65,11 @@ type __VLS_Props = {
66
65
  onCellValueChanged?: (event: CellValueChangedEvent$1<Row$1>) => void; /** Custom loading component to render instead of default spinner */
67
66
  loadingComponent?: Component<{
68
67
  isLoading: boolean;
69
- }>;
68
+ }>; /** Whether clicking and dragging any cell in a row drags the entire row. Default: false */
69
+ rowDragEntireRow?: boolean; /** Called when a row is dropped after dragging. Consumer handles data reordering. */
70
+ onRowDragEnd?: (sourceIndex: number, targetIndex: number) => void; /** Called when a column is resized. */
71
+ onColumnResized?: (colIndex: number, newWidth: number) => void; /** Called when a column is moved/reordered. */
72
+ onColumnMoved?: (fromIndex: number, toIndex: number) => void;
70
73
  };
71
74
  declare const __VLS_export: vue.DefineComponent<__VLS_Props, {
72
75
  core: vue.ShallowRef<GridCore$1<unknown> | null, GridCore$1<unknown> | null>;
@@ -83,7 +86,7 @@ declare const _default: typeof __VLS_export;
83
86
  //#endregion
84
87
  //#region src/composables/useGpGrid.d.ts
85
88
  interface UseGpGridOptions<TData extends Row$1 = Row$1> {
86
- columns: ColumnDefinition$1[];
89
+ columns: ColumnDefinition$2[];
87
90
  dataSource?: DataSource$1<TData>;
88
91
  rowData?: TData[];
89
92
  rowHeight: number;
@@ -107,7 +110,7 @@ interface UseGpGridOptions<TData extends Row$1 = Row$1> {
107
110
  interface UseGpGridResult<TData extends Row$1 = Row$1> {
108
111
  containerRef: Ref<HTMLDivElement | null>;
109
112
  coreRef: Ref<GridCore$1<TData> | null>;
110
- state: GridState$1;
113
+ state: ShallowRef<GridState$1>;
111
114
  slotsArray: ComputedRef<SlotData$1[]>;
112
115
  totalHeaderHeight: ComputedRef<number>;
113
116
  columnPositions: ComputedRef<number[]>;
@@ -207,10 +210,6 @@ interface UseGridDataResult<TData> {
207
210
  declare const useGridData: <TData extends Row$1 = Row$1>(initialData: TData[], options: UseGridDataOptions<TData>) => UseGridDataResult<TData>;
208
211
  //#endregion
209
212
  //#region src/composables/useInputHandler.d.ts
210
- interface VisibleColumnInfo$1 {
211
- column: ColumnDefinition$1;
212
- originalIndex: number;
213
- }
214
213
  interface UseInputHandlerOptions {
215
214
  activeCell: ComputedRef<CellPosition$1 | null>;
216
215
  selectionRange: ComputedRef<CellRange$1 | null>;
@@ -223,7 +222,7 @@ interface UseInputHandlerOptions {
223
222
  headerHeight: number;
224
223
  columnPositions: ComputedRef<number[]>;
225
224
  /** Visible columns with their original indices (for hidden column support) */
226
- visibleColumnsWithIndices: ComputedRef<VisibleColumnInfo$1[]>;
225
+ visibleColumnsWithIndices: ComputedRef<VisibleColumnInfo[]>;
227
226
  slots: ComputedRef<Map<string, SlotData$1>>;
228
227
  }
229
228
  interface UseInputHandlerResult {
@@ -231,6 +230,8 @@ interface UseInputHandlerResult {
231
230
  handleCellDoubleClick: (rowIndex: number, colIndex: number) => void;
232
231
  handleFillHandleMouseDown: (e: MouseEvent) => void;
233
232
  handleHeaderClick: (colIndex: number, e: MouseEvent) => void;
233
+ handleHeaderMouseDown: (colIndex: number, colWidth: number, colHeight: number, e: MouseEvent) => void;
234
+ handleHeaderResizeMouseDown: (colIndex: number, colWidth: number, e: MouseEvent) => void;
234
235
  handleKeyDown: (e: KeyboardEvent) => void;
235
236
  handleWheel: (e: WheelEvent, wheelDampening: number) => void;
236
237
  dragState: Ref<DragState$1>;
@@ -238,44 +239,37 @@ interface UseInputHandlerResult {
238
239
  /**
239
240
  * Vue composable for handling all input interactions
240
241
  */
241
- declare function useInputHandler<TData extends Row$1 = Row$1>(coreRef: ShallowRef<GridCore$1<TData> | null>, containerRef: Ref<HTMLDivElement | null>, columns: ComputedRef<ColumnDefinition$1[]>, options: UseInputHandlerOptions): UseInputHandlerResult;
242
+ declare function useInputHandler<TData extends Row$1 = Row$1>(coreRef: ShallowRef<GridCore$1<TData> | null>, containerRef: Ref<HTMLDivElement | null>, columns: ComputedRef<ColumnDefinition[]>, options: UseInputHandlerOptions): UseInputHandlerResult;
242
243
  //#endregion
243
244
  //#region src/composables/useAutoScroll.d.ts
244
245
  /**
245
246
  * Vue composable for auto-scrolling during drag operations
246
247
  */
247
- declare function useAutoScroll(containerRef: Ref<HTMLDivElement | null>): {
248
+ declare function useAutoScroll(containerRef: Ref<HTMLDivElement | null>, onTick?: () => void): {
248
249
  startAutoScroll: (dx: number, dy: number) => void;
249
250
  stopAutoScroll: () => void;
250
251
  };
251
252
  //#endregion
252
253
  //#region src/composables/useFillHandle.d.ts
253
- interface VisibleColumnInfo {
254
- column: ColumnDefinition$1;
255
- originalIndex: number;
256
- }
257
254
  interface UseFillHandleOptions {
258
255
  activeCell: ComputedRef<CellPosition$1 | null>;
259
256
  selectionRange: ComputedRef<CellRange$1 | null>;
260
257
  slots: ComputedRef<Map<string, SlotData$1>>;
261
- columns: ComputedRef<ColumnDefinition$1[]>;
258
+ columns: ComputedRef<ColumnDefinition$2[]>;
262
259
  visibleColumnsWithIndices: ComputedRef<VisibleColumnInfo[]>;
263
260
  columnPositions: ComputedRef<number[]>;
264
261
  columnWidths: ComputedRef<number[]>;
265
262
  rowHeight: number;
266
263
  }
267
264
  interface UseFillHandleResult {
268
- fillHandlePosition: ComputedRef<{
269
- top: number;
270
- left: number;
271
- } | null>;
265
+ fillHandlePosition: ComputedRef<FillHandlePosition | null>;
272
266
  }
273
267
  /**
274
268
  * Composable for calculating the fill handle position.
275
269
  * The fill handle appears at the bottom-right corner of the selection
276
270
  * when all selected columns are editable.
277
271
  */
278
- declare function useFillHandle(options: UseFillHandleOptions): UseFillHandleResult;
272
+ declare const useFillHandle: (options: UseFillHandleOptions) => UseFillHandleResult;
279
273
  //#endregion
280
274
  //#region src/composables/useFilterPopup.d.ts
281
275
  interface UseFilterPopupOptions {
@@ -309,138 +303,26 @@ interface UseFilterConditionsResult<TOperator extends string> {
309
303
  declare function useFilterConditions<TOperator extends string>(initialConditions: LocalFilterCondition<TOperator>[], initialCombination?: "and" | "or"): UseFilterConditionsResult<TOperator>;
310
304
  //#endregion
311
305
  //#region src/gridState/useGridState.d.ts
312
- interface InitialStateArgs {
313
- initialWidth?: number;
314
- initialHeight?: number;
315
- }
316
- declare function createInitialState(args?: InitialStateArgs): GridState$1;
317
306
  /**
318
307
  * Vue composable for managing grid state
308
+ *
309
+ * Uses shallowRef so that state replacement is atomic — a single assignment
310
+ * to state.value triggers exactly one reactive notification. Vue's own
311
+ * scheduler batches multiple synchronous state.value replacements into a
312
+ * single re-render, so no microtask buffering is needed.
319
313
  */
320
- declare function useGridState(args?: InitialStateArgs): {
321
- state: {
322
- slots: Map<string, {
323
- slotId: string;
324
- rowIndex: number;
325
- rowData: unknown;
326
- translateY: number;
327
- }> & Omit<Map<string, SlotData$1<unknown>>, keyof Map<any, any>>;
328
- activeCell: {
329
- row: number;
330
- col: number;
331
- } | null;
332
- selectionRange: {
333
- startRow: number;
334
- startCol: number;
335
- endRow: number;
336
- endCol: number;
337
- } | null;
338
- editingCell: {
339
- row: number;
340
- col: number;
341
- initialValue: _gp_grid_core0.CellValue;
342
- } | null;
343
- contentWidth: number;
344
- contentHeight: number;
345
- viewportWidth: number;
346
- viewportHeight: number;
347
- rowsWrapperOffset: number;
348
- headers: Map<number, {
349
- column: {
350
- field: string;
351
- colId?: string | undefined;
352
- cellDataType: _gp_grid_core0.CellDataType;
353
- width: number;
354
- headerName?: string | undefined;
355
- editable?: boolean | undefined;
356
- sortable?: boolean | undefined;
357
- filterable?: boolean | undefined;
358
- hidden?: boolean | undefined;
359
- cellRenderer?: string | undefined;
360
- editRenderer?: string | undefined;
361
- headerRenderer?: string | undefined;
362
- computeColumnClasses?: ((context: _gp_grid_core0.HighlightContext) => string[]) | undefined;
363
- computeCellClasses?: ((context: _gp_grid_core0.HighlightContext) => string[]) | undefined;
364
- };
365
- sortDirection?: _gp_grid_core0.SortDirection | undefined;
366
- sortIndex?: number | undefined;
367
- sortable: boolean;
368
- filterable: boolean;
369
- hasFilter: boolean;
370
- }> & Omit<Map<number, HeaderData$1>, keyof Map<any, any>>;
371
- filterPopup: {
372
- isOpen: boolean;
373
- colIndex: number;
374
- column: {
375
- field: string;
376
- colId?: string | undefined;
377
- cellDataType: _gp_grid_core0.CellDataType;
378
- width: number;
379
- headerName?: string | undefined;
380
- editable?: boolean | undefined;
381
- sortable?: boolean | undefined;
382
- filterable?: boolean | undefined;
383
- hidden?: boolean | undefined;
384
- cellRenderer?: string | undefined;
385
- editRenderer?: string | undefined;
386
- headerRenderer?: string | undefined;
387
- computeColumnClasses?: ((context: _gp_grid_core0.HighlightContext) => string[]) | undefined;
388
- computeCellClasses?: ((context: _gp_grid_core0.HighlightContext) => string[]) | undefined;
389
- } | null;
390
- anchorRect: {
391
- top: number;
392
- left: number;
393
- width: number;
394
- height: number;
395
- } | null;
396
- distinctValues: _gp_grid_core0.CellValue[];
397
- currentFilter?: {
398
- conditions: ({
399
- type: "text";
400
- operator: _gp_grid_core0.TextFilterOperator;
401
- value?: string | undefined;
402
- selectedValues?: (Set<string> & Omit<Set<string>, keyof Set<any>>) | undefined;
403
- includeBlank?: boolean | undefined;
404
- nextOperator?: _gp_grid_core0.FilterCombination | undefined;
405
- } | {
406
- type: "number";
407
- operator: _gp_grid_core0.NumberFilterOperator;
408
- value?: number | undefined;
409
- valueTo?: number | undefined;
410
- nextOperator?: _gp_grid_core0.FilterCombination | undefined;
411
- } | {
412
- type: "date";
413
- operator: _gp_grid_core0.DateFilterOperator;
414
- value?: (Date | string) | undefined;
415
- valueTo?: (Date | string) | undefined;
416
- nextOperator?: _gp_grid_core0.FilterCombination | undefined;
417
- })[];
418
- combination: _gp_grid_core0.FilterCombination;
419
- } | undefined;
420
- } | null;
421
- isLoading: boolean;
422
- error: string | null;
423
- totalRows: number;
424
- visibleRowRange: {
425
- start: number;
426
- end: number;
427
- } | null;
428
- hoverPosition: {
429
- row: number;
430
- col: number;
431
- } | null;
432
- };
314
+ declare function useGridState(args?: {
315
+ initialWidth?: number;
316
+ initialHeight?: number;
317
+ }): {
318
+ state: ShallowRef<GridState$1>;
433
319
  applyInstructions: (instructions: GridInstruction$1[]) => void;
434
320
  reset: () => void;
435
321
  };
436
322
  //#endregion
437
323
  //#region src/renderers/cellRenderer.d.ts
438
- /**
439
- * Get cell value from row data, supporting dot-notation for nested fields
440
- */
441
- declare function getCellValue(rowData: Row$1, field: string): CellValue$1;
442
324
  interface RenderCellOptions {
443
- column: ColumnDefinition$1;
325
+ column: ColumnDefinition$2;
444
326
  rowData: Row$1;
445
327
  rowIndex: number;
446
328
  colIndex: number;
@@ -457,7 +339,7 @@ declare function renderCell(options: RenderCellOptions): VNode;
457
339
  //#endregion
458
340
  //#region src/renderers/editRenderer.d.ts
459
341
  interface RenderEditCellOptions {
460
- column: ColumnDefinition$1;
342
+ column: ColumnDefinition$2;
461
343
  rowData: Row$1;
462
344
  rowIndex: number;
463
345
  colIndex: number;
@@ -473,7 +355,7 @@ declare function renderEditCell(options: RenderEditCellOptions): VNode;
473
355
  //#endregion
474
356
  //#region src/renderers/headerRenderer.d.ts
475
357
  interface RenderHeaderOptions {
476
- column: ColumnDefinition$1;
358
+ column: ColumnDefinition$2;
477
359
  colIndex: number;
478
360
  sortDirection?: SortDirection$1;
479
361
  sortIndex?: number;
@@ -490,4 +372,4 @@ interface RenderHeaderOptions {
490
372
  */
491
373
  declare function renderHeader(options: RenderHeaderOptions): VNode;
492
374
  //#endregion
493
- export { type CellDataType, type CellPosition, type CellRange, type CellRendererParams, type CellValue, type CellValueChangedEvent, type ColumnDefinition, type ColumnFilterModel, type ContainerBounds, type DataSource, type DataSourceRequest, type DataSourceResponse, type DateFilterCondition, type DragState, type EditRendererParams, type FilterCondition, type FilterModel, type FilterPopupState, _default as GpGrid, _default as default, type GpGridProps, GridCore, type GridInstruction, type GridState, type HeaderData, type HeaderRendererParams, type KeyEventData, type LocalFilterCondition, type MutableDataSource, type NumberFilterCondition, type PointerEventData, type Row, type RowId, type SelectionState, type SlotData, type SortDirection, type SortModel, type TextFilterCondition, type UseFillHandleOptions, type UseFillHandleResult, type UseFilterConditionsResult, type UseFilterPopupOptions, type UseGpGridOptions, type UseGpGridResult, type UseGridDataOptions, type UseGridDataResult, type UseInputHandlerOptions, type UseInputHandlerResult, type VueCellRenderer, type VueEditRenderer, type VueHeaderRenderer, buildCellClasses, calculateColumnPositions, createClientDataSource, createDataSourceFromArray, createInitialState, createMutableClientDataSource, createServerDataSource, findColumnAtX, getCellValue, getTotalWidth, gridStyles, injectStyles, isCellActive, isCellEditing, isCellInFillPreview, isCellSelected, isRowVisible, renderCell, renderEditCell, renderHeader, useAutoScroll, useFillHandle, useFilterConditions, useFilterPopup, useGpGrid, useGridData, useGridState, useInputHandler };
375
+ export { type CellDataType, type CellPosition, type CellRange, type CellRendererParams, type CellValue, type CellValueChangedEvent, type ColumnDefinition$1 as ColumnDefinition, type ColumnFilterModel, type ContainerBounds, type DataSource, type DataSourceRequest, type DataSourceResponse, type DateFilterCondition, type DragState, type EditRendererParams, type FilterCondition, type FilterModel, type FilterPopupState, _default as GpGrid, _default as default, type GpGridProps, GridCore, type GridInstruction, type GridState, type HeaderData, type HeaderRendererParams, type KeyEventData, type LocalFilterCondition, type MutableDataSource, type NumberFilterCondition, type PointerEventData, type Row, type RowId, type SelectionState, type SlotData, type SortDirection, type SortModel, type TextFilterCondition, type UseFillHandleOptions, type UseFillHandleResult, type UseFilterConditionsResult, type UseFilterPopupOptions, type UseGpGridOptions, type UseGpGridResult, type UseGridDataOptions, type UseGridDataResult, type UseInputHandlerOptions, type UseInputHandlerResult, type VueCellRenderer, type VueEditRenderer, type VueHeaderRenderer, buildCellClasses, calculateColumnPositions, createClientDataSource, createDataSourceFromArray, createInitialState, createMutableClientDataSource, createServerDataSource, findColumnAtX, getCellValue, getTotalWidth, gridStyles, injectStyles, isCellActive, isCellEditing, isCellInFillPreview, isCellSelected, isRowVisible, renderCell, renderEditCell, renderHeader, useAutoScroll, useFillHandle, useFilterConditions, useFilterPopup, useGpGrid, useGridData, useGridState, useInputHandler };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{Fragment as e,computed as t,createBlock as n,createCommentVNode as r,createElementBlock as i,createElementVNode as a,createTextVNode as o,createVNode as s,defineComponent as c,h as l,normalizeClass as u,normalizeStyle as d,onMounted as f,onUnmounted as p,openBlock as m,reactive as h,ref as g,renderList as _,resolveDynamicComponent as v,shallowRef as y,toDisplayString as b,unref as x,vModelText as S,watch as C,withDirectives as w}from"vue";import{GridCore as T,GridCore as E,buildCellClasses as D,buildCellClasses as ee,calculateColumnPositions as O,calculateScaledColumnPositions as k,createClientDataSource as A,createClientDataSource as j,createDataSourceFromArray as M,createDataSourceFromArray as N,createMutableClientDataSource as P,createMutableClientDataSource as F,createServerDataSource as I,findColumnAtX as L,getTotalWidth as R,getTotalWidth as te,gridStyles as z,injectStyles as ne,injectStyles as re,isCellActive as ie,isCellActive as B,isCellEditing as ae,isCellEditing as V,isCellInFillPreview as H,isCellInFillPreview as oe,isCellSelected as se,isCellSelected as U,isRowVisible as W}from"@gp-grid/core";function G(e){return{slots:new Map,activeCell:null,selectionRange:null,editingCell:null,contentWidth:0,contentHeight:e?.initialHeight??0,viewportWidth:e?.initialWidth??0,viewportHeight:e?.initialHeight??0,rowsWrapperOffset:0,headers:new Map,filterPopup:null,isLoading:!1,error:null,totalRows:0,visibleRowRange:null,hoverPosition:null}}function K(e,t){switch(e.type){case`CREATE_SLOT`:t.slots.set(e.slotId,{slotId:e.slotId,rowIndex:-1,rowData:{},translateY:0});break;case`DESTROY_SLOT`:t.slots.delete(e.slotId);break;case`ASSIGN_SLOT`:{let n=t.slots.get(e.slotId);n&&t.slots.set(e.slotId,{...n,rowIndex:e.rowIndex,rowData:e.rowData});break}case`MOVE_SLOT`:{let n=t.slots.get(e.slotId);n&&t.slots.set(e.slotId,{...n,translateY:e.translateY});break}case`SET_ACTIVE_CELL`:t.activeCell=e.position;break;case`SET_SELECTION_RANGE`:t.selectionRange=e.range;break;case`UPDATE_VISIBLE_RANGE`:t.visibleRowRange={start:e.start,end:e.end},t.rowsWrapperOffset=e.rowsWrapperOffset;break;case`SET_HOVER_POSITION`:t.hoverPosition=e.position;break;case`START_EDIT`:t.editingCell={row:e.row,col:e.col,initialValue:e.initialValue};break;case`STOP_EDIT`:t.editingCell=null;break;case`SET_CONTENT_SIZE`:t.contentWidth=e.width,t.contentHeight=e.height,t.viewportWidth=e.viewportWidth,t.viewportHeight=e.viewportHeight,t.rowsWrapperOffset=e.rowsWrapperOffset;break;case`UPDATE_HEADER`:t.headers.set(e.colIndex,{column:e.column,sortDirection:e.sortDirection,sortIndex:e.sortIndex,sortable:e.sortable,filterable:e.filterable,hasFilter:e.hasFilter});break;case`OPEN_FILTER_POPUP`:t.filterPopup={isOpen:!0,colIndex:e.colIndex,column:e.column,anchorRect:e.anchorRect,distinctValues:e.distinctValues,currentFilter:e.currentFilter};break;case`CLOSE_FILTER_POPUP`:t.filterPopup=null;break;case`DATA_LOADING`:t.isLoading=!0,t.error=null;break;case`DATA_LOADED`:t.isLoading=!1,t.totalRows=e.totalRows;break;case`DATA_ERROR`:t.isLoading=!1,t.error=e.error;break;case`ROWS_ADDED`:case`ROWS_REMOVED`:t.totalRows=e.totalRows;break;case`ROWS_UPDATED`:case`TRANSACTION_PROCESSED`:break}}function q(e){let t=h(G(e));function n(e){for(let n of e)K(n,t)}function r(){let e=G();t.slots=e.slots,t.activeCell=e.activeCell,t.selectionRange=e.selectionRange,t.editingCell=e.editingCell,t.contentWidth=e.contentWidth,t.contentHeight=e.contentHeight,t.viewportWidth=e.viewportWidth,t.viewportHeight=e.viewportHeight,t.rowsWrapperOffset=e.rowsWrapperOffset,t.headers=e.headers,t.filterPopup=e.filterPopup,t.isLoading=e.isLoading,t.error=e.error,t.totalRows=e.totalRows,t.visibleRowRange=e.visibleRowRange,t.hoverPosition=e.hoverPosition}return{state:t,applyInstructions:n,reset:r}}function J(e){let t=g(null);function n(n,r){t.value&&clearInterval(t.value),t.value=setInterval(()=>{let t=e.value;t&&(t.scrollTop+=r,t.scrollLeft+=n)},16)}function r(){t.value&&=(clearInterval(t.value),null)}return p(()=>{r()}),{startAutoScroll:n,stopAutoScroll:r}}function ce(e,t){for(let n of e.values())if(n.rowIndex===t)return n;return null}function le(e,t,n,r,i,a){let o=ce(a,n),s=(o?o.translateY:i+n*r)-t.scrollTop,c=s+r,l=i,u=t.clientHeight;if(s<l)t.scrollTop=e.getScrollTopForRow(n);else if(c>u){let a=t.clientHeight-i,o=Math.floor(a/r),s=Math.max(0,n-o+1);t.scrollTop=e.getScrollTopForRow(s)}}function Y(e,t,n,r){let{activeCell:i,selectionRange:a,editingCell:o,filterPopupOpen:s,rowHeight:c,headerHeight:l,columnPositions:u,visibleColumnsWithIndices:d,slots:f}=r,{startAutoScroll:m,stopAutoScroll:h}=J(t),_=g({isDragging:!1,dragType:null,fillSourceRange:null,fillTarget:null});C([()=>l,()=>c,u,d],()=>{let t=e.value;if(t?.input){let e=d.value;t.input.updateDeps({getHeaderHeight:()=>l,getRowHeight:()=>c,getColumnPositions:()=>u.value,getColumnCount:()=>e.length,getOriginalColumnIndex:t=>{let n=e[t];return n?n.originalIndex:t}})}},{immediate:!0});function v(){let e=t.value;if(!e)return null;let n=e.getBoundingClientRect();return{top:n.top,left:n.left,width:n.width,height:n.height,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}}function y(e){return{clientX:e.clientX,clientY:e.clientY,button:e.button,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey}}function b(){let t=t=>{let n=e.value,r=v();if(!n?.input||!r)return;let i=n.input.handleDragMove(y(t),r);i&&(i.autoScroll?m(i.autoScroll.dx,i.autoScroll.dy):h(),_.value=n.input.getDragState())},n=()=>{let r=e.value;r?.input&&(r.input.handleDragEnd(),_.value=r.input.getDragState()),h(),document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n)}function x(n,r,i){let a=e.value;if(!a?.input)return;let o=a.input.handleCellMouseDown(n,r,y(i));o.focusContainer&&t.value?.focus(),o.startDrag===`selection`&&(a.input.startSelectionDrag(),_.value=a.input.getDragState(),b())}function S(t,n){let r=e.value;r?.input&&r.input.handleCellDoubleClick(t,n)}function w(t){let n=e.value;if(!n?.input)return;let r=n.input.handleFillHandleMouseDown(i.value,a.value,y(t));r.preventDefault&&t.preventDefault(),r.stopPropagation&&t.stopPropagation(),r.startDrag===`fill`&&(_.value=n.input.getDragState(),b())}function T(t,r){let i=e.value;if(!i?.input)return;let a=n.value[t];if(!a)return;let o=a.colId??a.field;i.input.handleHeaderClick(o,r.shiftKey)}function E(n){let r=e.value,a=t.value;if(!r?.input)return;let u=r.input.handleKeyDown({key:n.key,shiftKey:n.shiftKey,ctrlKey:n.ctrlKey,metaKey:n.metaKey},i.value,o.value,s.value);u.preventDefault&&n.preventDefault(),u.scrollToCell&&a&&le(r,a,u.scrollToCell.row,c,l,f.value)}function D(n,r){let i=e.value,a=t.value;if(!i?.input||!a)return;let o=i.input.handleWheel(n.deltaY,n.deltaX,r);o&&(n.preventDefault(),a.scrollTop+=o.dy,a.scrollLeft+=o.dx)}return p(()=>{h()}),{handleCellMouseDown:x,handleCellDoubleClick:S,handleFillHandleMouseDown:w,handleHeaderClick:T,handleKeyDown:E,handleWheel:D,dragState:_}}function X(e){let{activeCell:n,selectionRange:r,slots:i,columns:a,visibleColumnsWithIndices:o,columnPositions:s,columnWidths:c,rowHeight:l}=e;return{fillHandlePosition:t(()=>{let e=n.value,t=r.value,u=i.value;if(!e&&!t)return null;let d,f,p,m;if(t)d=Math.max(t.startRow,t.endRow),f=Math.max(t.startCol,t.endCol),p=Math.min(t.startCol,t.endCol),m=Math.max(t.startCol,t.endCol);else if(e)d=e.row,f=e.col,p=f,m=f;else return null;let h=a.value;for(let e=p;e<=m;e++){let t=h[e];if(!(!t||t.hidden)&&t.editable!==!0)return null}let g=o.value.findIndex(e=>e.originalIndex===f);if(g===-1)return null;let _=null;for(let e of u.values())if(e.rowIndex===d){_=e.translateY;break}if(_===null)return null;let v=s.value[g]??0,y=c.value[g]??0;return{top:_+l-5,left:v+y-20}})}}function Z(e){return e==null||e===``?o(``):typeof e==`string`?o(e):e}function Q(e,t){let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return null;r=r[e]}return r??null}function ue(e){let{column:t,rowData:n,rowIndex:r,colIndex:i,isActive:a,isSelected:s,isEditing:c,cellRenderers:l,globalCellRenderer:u}=e,d=Q(n,t.field),f={value:d,rowData:n,column:t,rowIndex:r,colIndex:i,isActive:a,isSelected:s,isEditing:c};if(t.cellRenderer&&typeof t.cellRenderer==`string`){let e=l[t.cellRenderer];if(e)return Z(e(f))}return u?Z(u(f)):o(d==null?``:String(d))}function de(e){return e==null||e===``?o(``):typeof e==`string`?o(e):e}function fe(e){let{column:t,rowData:n,rowIndex:r,colIndex:i,initialValue:a,core:s,editRenderers:c,globalEditRenderer:u}=e;if(!s)return o(``);let d={value:Q(n,t.field),rowData:n,column:t,rowIndex:r,colIndex:i,isActive:!0,isSelected:!0,isEditing:!0,initialValue:a,onValueChange:e=>s.updateEditValue(e),onCommit:()=>s.commitEdit(),onCancel:()=>s.cancelEdit()};if(t.editRenderer&&typeof t.editRenderer==`string`){let e=c[t.editRenderer];if(e)return de(e(d))}return u?de(u(d)):l(`input`,{class:`gp-grid-edit-input`,type:`text`,value:a==null?``:String(a),autofocus:!0,onFocus:e=>e.target.select(),onInput:e=>s.updateEditValue(e.target.value),onKeydown:e=>{e.stopPropagation(),e.key===`Enter`?s.commitEdit():e.key===`Escape`?s.cancelEdit():e.key===`Tab`&&(e.preventDefault(),s.commitEdit(),s.selection.moveFocus(e.shiftKey?`left`:`right`,!1))},onBlur:()=>s.commitEdit()})}function pe(e){return e==null||e===``?o(``):typeof e==`string`?o(e):e}function me(t){let{column:n,colIndex:r,sortDirection:i,sortIndex:a,sortable:o,filterable:s,hasFilter:c,core:u,container:d,headerRenderers:f,globalHeaderRenderer:p}=t,m={column:n,colIndex:r,sortDirection:i,sortIndex:a,sortable:o,filterable:s,hasFilter:c,onSort:(e,t)=>{u&&o&&u.setSort(n.colId??n.field,e,t)},onFilterClick:()=>{if(u&&s){let e=d?.querySelector(`[data-col-index="${r}"]`);if(e){let t=e.getBoundingClientRect();u.openFilterPopup(r,{top:t.top,left:t.left,width:t.width,height:t.height})}}}};if(n.headerRenderer&&typeof n.headerRenderer==`string`){let e=f[n.headerRenderer];if(e)return pe(e(m))}if(p)return pe(p(m));let h=[l(`span`,{class:`gp-grid-header-text`},n.headerName??n.field)],g=[];if(o){let e=[l(`span`,{class:`gp-grid-sort-arrows-stack`},[l(`svg`,{class:`gp-grid-sort-arrow-up${i===`asc`?` active`:``}`,width:`8`,height:`6`,viewBox:`0 0 8 6`},[l(`path`,{d:`M4 0L8 6H0L4 0Z`,fill:`currentColor`})]),l(`svg`,{class:`gp-grid-sort-arrow-down${i===`desc`?` active`:``}`,width:`8`,height:`6`,viewBox:`0 0 8 6`},[l(`path`,{d:`M4 6L0 0H8L4 6Z`,fill:`currentColor`})])])];a!==void 0&&a>0&&e.push(l(`span`,{class:`gp-grid-sort-index`},String(a))),g.push(l(`span`,{class:`gp-grid-sort-arrows`},e))}return s&&g.push(l(`span`,{class:`gp-grid-filter-icon${c?` active`:``}`,onMousedown:e=>{e.stopPropagation(),e.preventDefault(),m.onFilterClick()},onClick:e=>{e.stopPropagation()}},[l(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`currentColor`},[l(`path`,{d:`M4 4h16l-6 8v5l-4 2v-7L4 4z`})])])),g.length>0&&h.push(l(`span`,{class:`gp-grid-header-icons`},g)),l(e,h)}function he(e,t){let{onClose:n,ignoreSelector:r=`.gp-grid-filter-icon`}=t,i=null,a=null;f(()=>{i=t=>{let i=t.target;r&&i.closest(r)||e.value&&!e.value.contains(i)&&n()},a=e=>{e.key===`Escape`&&n()},requestAnimationFrame(()=>{i&&document.addEventListener(`mousedown`,i),a&&document.addEventListener(`keydown`,a)})}),p(()=>{i&&document.removeEventListener(`mousedown`,i),a&&document.removeEventListener(`keydown`,a)})}function $(e,t=`and`){let n=g([...e]);return{conditions:n,combination:g(t),updateCondition:(e,t)=>{let r=[...n.value];r[e]={...r[e],...t},n.value=r},addCondition:e=>{n.value=[...n.value,{operator:e,value:``,valueTo:``,nextOperator:`and`}]},removeCondition:e=>{n.value=n.value.filter((t,n)=>n!==e)}}}const ge={class:`gp-grid-filter-content gp-grid-filter-text`},_e={key:0,class:`gp-grid-filter-mode-toggle`},ve={key:1,class:`gp-grid-filter-info`},ye={class:`gp-grid-filter-actions`},be=[`disabled`],xe={class:`gp-grid-filter-list`},Se={key:0,class:`gp-grid-filter-option`},Ce=[`checked`],we=[`checked`,`onChange`],Te={key:0,class:`gp-grid-filter-combination`},Ee=[`onClick`],De=[`onClick`],Oe={class:`gp-grid-filter-row`},ke=[`value`,`autofocus`,`onChange`],Ae=[`value`],je=[`value`,`onInput`],Me=[`onClick`],Ne=c({__name:`TextFilterContent`,props:{distinctValues:{},currentFilter:{}},emits:[`apply`,`close`],setup(n,{emit:o}){let s=[{value:`contains`,label:`Contains`},{value:`notContains`,label:`Does not contain`},{value:`equals`,label:`Equals`},{value:`notEquals`,label:`Does not equal`},{value:`startsWith`,label:`Starts with`},{value:`endsWith`,label:`Ends with`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Is not blank`}],c=n,l=o;function d(e){return Array.isArray(e)?e.join(`, `):String(e??``)}let f=t(()=>{let e=c.distinctValues.filter(e=>e!=null&&e!==``&&!(Array.isArray(e)&&e.length===0)).map(e=>d(e));return Array.from(new Set(e)).sort((e,t)=>{let n=parseFloat(e),r=parseFloat(t);return!isNaN(n)&&!isNaN(r)?n-r:e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})})}),p=t(()=>f.value.length>100),h=g(t(()=>{if(!c.currentFilter?.conditions[0])return p.value?`condition`:`values`;let e=c.currentFilter.conditions[0];return e.selectedValues&&e.selectedValues.size>0?`values`:`condition`}).value),v=t(()=>c.currentFilter?.conditions[0]?c.currentFilter.conditions[0].selectedValues??new Set:new Set),y=t(()=>c.currentFilter?.conditions[0]?c.currentFilter.conditions[0].includeBlank??!0:!0),C=g(``),T=g(new Set(v.value)),E=g(y.value),{conditions:D,combination:ee,updateCondition:O,addCondition:k,removeCondition:A}=$(t(()=>{if(!c.currentFilter?.conditions.length)return[{operator:`contains`,value:``,valueTo:``,nextOperator:`and`}];let e=c.currentFilter.conditions[0];if(e.selectedValues&&e.selectedValues.size>0)return[{operator:`contains`,value:``,valueTo:``,nextOperator:`and`}];let t=c.currentFilter.combination??`and`;return c.currentFilter.conditions.map(e=>{let n=e;return{operator:n.operator,value:n.value??``,valueTo:``,nextOperator:n.nextOperator??t}})}).value,c.currentFilter?.combination??`and`),j=t(()=>{if(!C.value)return f.value;let e=C.value.toLowerCase();return f.value.filter(t=>t.toLowerCase().includes(e))}),M=t(()=>c.distinctValues.some(e=>e==null||e===``)),N=t(()=>j.value.every(e=>T.value.has(e))&&(!M.value||E.value));function P(){T.value=new Set(j.value),M.value&&(E.value=!0)}function F(){T.value=new Set,E.value=!1}function I(e){let t=new Set(T.value);t.has(e)?t.delete(e):t.add(e),T.value=t}function L(){if(h.value===`values`){if(f.value.every(e=>T.value.has(e))&&(!M.value||E.value)){l(`apply`,null);return}l(`apply`,{conditions:[{type:`text`,operator:`equals`,selectedValues:T.value,includeBlank:E.value}],combination:`and`})}else{let e=D.value.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.value.trim()!==``);if(e.length===0){l(`apply`,null);return}l(`apply`,{conditions:e.map(e=>({type:`text`,operator:e.operator,value:e.value,nextOperator:e.nextOperator})),combination:`and`})}}function R(){l(`apply`,null)}return(t,n)=>(m(),i(`div`,ge,[r(` Mode toggle - only show if not too many values `),p.value?r(`v-if`,!0):(m(),i(`div`,_e,[a(`button`,{type:`button`,class:u({active:h.value===`values`}),onClick:n[0]||=e=>h.value=`values`},` Values `,2),a(`button`,{type:`button`,class:u({active:h.value===`condition`}),onClick:n[1]||=e=>h.value=`condition`},` Condition `,2)])),r(` Too many values message `),p.value&&h.value===`condition`?(m(),i(`div`,ve,` Too many unique values (`+b(f.value.length)+`). Use conditions to filter. `,1)):r(`v-if`,!0),r(` VALUES MODE `),h.value===`values`?(m(),i(e,{key:2},[r(` Search input `),w(a(`input`,{"onUpdate:modelValue":n[2]||=e=>C.value=e,class:`gp-grid-filter-search`,type:`text`,placeholder:`Search...`,autofocus:``},null,512),[[S,C.value]]),r(` Select all / Deselect all `),a(`div`,ye,[a(`button`,{type:`button`,disabled:N.value,onClick:P},` Select All `,8,be),a(`button`,{type:`button`,onClick:F},` Deselect All `)]),r(` Checkbox list `),a(`div`,xe,[r(` Blanks option `),M.value?(m(),i(`label`,Se,[a(`input`,{type:`checkbox`,checked:E.value,onChange:n[3]||=e=>E.value=!E.value},null,40,Ce),n[5]||=a(`span`,{class:`gp-grid-filter-blank`},`(Blanks)`,-1)])):r(`v-if`,!0),r(` Values `),(m(!0),i(e,null,_(j.value,e=>(m(),i(`label`,{key:e,class:`gp-grid-filter-option`},[a(`input`,{type:`checkbox`,checked:T.value.has(e),onChange:t=>I(e)},null,40,we),a(`span`,null,b(e),1)]))),128))])],64)):r(`v-if`,!0),r(` CONDITION MODE `),h.value===`condition`?(m(),i(e,{key:3},[(m(!0),i(e,null,_(x(D),(t,n)=>(m(),i(`div`,{key:n,class:`gp-grid-filter-condition`},[r(` Combination toggle (AND/OR) for conditions after the first `),n>0?(m(),i(`div`,Te,[a(`button`,{type:`button`,class:u({active:x(D)[n-1]?.nextOperator===`and`}),onClick:e=>x(O)(n-1,{nextOperator:`and`})},` AND `,10,Ee),a(`button`,{type:`button`,class:u({active:x(D)[n-1]?.nextOperator===`or`}),onClick:e=>x(O)(n-1,{nextOperator:`or`})},` OR `,10,De)])):r(`v-if`,!0),a(`div`,Oe,[r(` Operator select `),a(`select`,{value:t.operator,autofocus:n===0,onChange:e=>x(O)(n,{operator:e.target.value})},[(m(),i(e,null,_(s,e=>a(`option`,{key:e.value,value:e.value},b(e.label),9,Ae)),64))],40,ke),r(` Text input (hidden for blank/notBlank) `),t.operator!==`blank`&&t.operator!==`notBlank`?(m(),i(`input`,{key:0,type:`text`,value:t.value,placeholder:`Value`,class:`gp-grid-filter-text-input`,onInput:e=>x(O)(n,{value:e.target.value})},null,40,je)):r(`v-if`,!0),r(` Remove button (only if more than one condition) `),x(D).length>1?(m(),i(`button`,{key:1,type:`button`,class:`gp-grid-filter-remove`,onClick:e=>x(A)(n)},` × `,8,Me)):r(`v-if`,!0)])]))),128)),r(` Add condition button `),a(`button`,{type:`button`,class:`gp-grid-filter-add`,onClick:n[4]||=e=>x(k)(`contains`)},` + Add condition `)],64)):r(`v-if`,!0),r(` Apply/Clear buttons `),a(`div`,{class:`gp-grid-filter-buttons`},[a(`button`,{type:`button`,class:`gp-grid-filter-btn-clear`,onClick:R},` Clear `),a(`button`,{type:`button`,class:`gp-grid-filter-btn-apply`,onClick:L},` Apply `)])]))}}),Pe={class:`gp-grid-filter-content gp-grid-filter-number`},Fe={key:0,class:`gp-grid-filter-combination`},Ie=[`onClick`],Le=[`onClick`],Re={class:`gp-grid-filter-row`},ze=[`value`,`onChange`],Be=[`value`],Ve=[`value`,`onInput`],He=[`value`,`onInput`],Ue=[`onClick`],We=c({__name:`NumberFilterContent`,props:{currentFilter:{}},emits:[`apply`,`close`],setup(n,{emit:o}){let s=[{value:`=`,label:`=`},{value:`!=`,label:`≠`},{value:`>`,label:`>`},{value:`<`,label:`<`},{value:`>=`,label:`≥`},{value:`<=`,label:`≤`},{value:`between`,label:`↔`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Not blank`}],c=n,l=o,{conditions:d,combination:f,updateCondition:p,addCondition:h,removeCondition:g}=$(t(()=>{if(!c.currentFilter?.conditions.length)return[{operator:`=`,value:``,valueTo:``,nextOperator:`and`}];let e=c.currentFilter.combination??`and`;return c.currentFilter.conditions.map(t=>{let n=t;return{operator:n.operator,value:n.value==null?``:String(n.value),valueTo:n.valueTo==null?``:String(n.valueTo),nextOperator:n.nextOperator??e}})}).value,c.currentFilter?.combination??`and`);function v(){let e=d.value.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.operator===`between`?e.value!==``&&e.valueTo!==``:e.value!==``);if(e.length===0){l(`apply`,null);return}l(`apply`,{conditions:e.map(e=>({type:`number`,operator:e.operator,value:e.value?parseFloat(e.value):void 0,valueTo:e.valueTo?parseFloat(e.valueTo):void 0,nextOperator:e.nextOperator})),combination:`and`})}function y(){l(`apply`,null)}return(t,n)=>(m(),i(`div`,Pe,[(m(!0),i(e,null,_(x(d),(t,o)=>(m(),i(`div`,{key:o,class:`gp-grid-filter-condition`},[r(` Combination toggle (AND/OR) for conditions after the first `),o>0?(m(),i(`div`,Fe,[a(`button`,{type:`button`,class:u({active:x(d)[o-1]?.nextOperator===`and`}),onClick:e=>x(p)(o-1,{nextOperator:`and`})},` AND `,10,Ie),a(`button`,{type:`button`,class:u({active:x(d)[o-1]?.nextOperator===`or`}),onClick:e=>x(p)(o-1,{nextOperator:`or`})},` OR `,10,Le)])):r(`v-if`,!0),a(`div`,Re,[r(` Operator select `),a(`select`,{value:t.operator,onChange:e=>x(p)(o,{operator:e.target.value})},[(m(),i(e,null,_(s,e=>a(`option`,{key:e.value,value:e.value},b(e.label),9,Be)),64))],40,ze),r(` Number input (hidden for blank/notBlank) `),t.operator!==`blank`&&t.operator!==`notBlank`?(m(),i(`input`,{key:0,type:`number`,value:t.value,placeholder:`Value`,onInput:e=>x(p)(o,{value:e.target.value})},null,40,Ve)):r(`v-if`,!0),r(` Second number input for "between" `),t.operator===`between`?(m(),i(e,{key:1},[n[1]||=a(`span`,{class:`gp-grid-filter-to`},`to`,-1),a(`input`,{type:`number`,value:t.valueTo,placeholder:`Value`,onInput:e=>x(p)(o,{valueTo:e.target.value})},null,40,He)],64)):r(`v-if`,!0),r(` Remove button (only if more than one condition) `),x(d).length>1?(m(),i(`button`,{key:2,type:`button`,class:`gp-grid-filter-remove`,onClick:e=>x(g)(o)},` × `,8,Ue)):r(`v-if`,!0)])]))),128)),r(` Add condition button `),a(`button`,{type:`button`,class:`gp-grid-filter-add`,onClick:n[0]||=e=>x(h)(`=`)},` + Add condition `),r(` Apply/Clear buttons `),a(`div`,{class:`gp-grid-filter-buttons`},[a(`button`,{type:`button`,class:`gp-grid-filter-btn-clear`,onClick:y},` Clear `),a(`button`,{type:`button`,class:`gp-grid-filter-btn-apply`,onClick:v},` Apply `)])]))}}),Ge={class:`gp-grid-filter-content gp-grid-filter-date`},Ke={key:0,class:`gp-grid-filter-combination`},qe=[`onClick`],Je=[`onClick`],Ye={class:`gp-grid-filter-row`},Xe=[`value`,`onChange`],Ze=[`value`],Qe=[`value`,`onInput`],$e=[`value`,`onInput`],et=[`onClick`],tt=c({__name:`DateFilterContent`,props:{currentFilter:{}},emits:[`apply`,`close`],setup(n,{emit:o}){let s=[{value:`=`,label:`=`},{value:`!=`,label:`≠`},{value:`>`,label:`>`},{value:`<`,label:`<`},{value:`between`,label:`↔`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Not blank`}],c=n,l=o;function d(e){if(!e)return``;let t=typeof e==`string`?new Date(e):e;return isNaN(t.getTime())?``:t.toISOString().split(`T`)[0]}let{conditions:f,combination:p,updateCondition:h,addCondition:g,removeCondition:v}=$(t(()=>{if(!c.currentFilter?.conditions.length)return[{operator:`=`,value:``,valueTo:``,nextOperator:`and`}];let e=c.currentFilter.combination??`and`;return c.currentFilter.conditions.map(t=>{let n=t;return{operator:n.operator,value:d(n.value),valueTo:d(n.valueTo),nextOperator:n.nextOperator??e}})}).value,c.currentFilter?.combination??`and`);function y(){let e=f.value.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.operator===`between`?e.value!==``&&e.valueTo!==``:e.value!==``);if(e.length===0){l(`apply`,null);return}l(`apply`,{conditions:e.map(e=>({type:`date`,operator:e.operator,value:e.value||void 0,valueTo:e.valueTo||void 0,nextOperator:e.nextOperator})),combination:`and`})}function S(){l(`apply`,null)}return(t,n)=>(m(),i(`div`,Ge,[(m(!0),i(e,null,_(x(f),(t,o)=>(m(),i(`div`,{key:o,class:`gp-grid-filter-condition`},[r(` Combination toggle (AND/OR) for conditions after the first `),o>0?(m(),i(`div`,Ke,[a(`button`,{type:`button`,class:u({active:x(f)[o-1]?.nextOperator===`and`}),onClick:e=>x(h)(o-1,{nextOperator:`and`})},` AND `,10,qe),a(`button`,{type:`button`,class:u({active:x(f)[o-1]?.nextOperator===`or`}),onClick:e=>x(h)(o-1,{nextOperator:`or`})},` OR `,10,Je)])):r(`v-if`,!0),a(`div`,Ye,[r(` Operator select `),a(`select`,{value:t.operator,onChange:e=>x(h)(o,{operator:e.target.value})},[(m(),i(e,null,_(s,e=>a(`option`,{key:e.value,value:e.value},b(e.label),9,Ze)),64))],40,Xe),r(` Date input (hidden for blank/notBlank) `),t.operator!==`blank`&&t.operator!==`notBlank`?(m(),i(`input`,{key:0,type:`date`,value:t.value,onInput:e=>x(h)(o,{value:e.target.value})},null,40,Qe)):r(`v-if`,!0),r(` Second date input for "between" `),t.operator===`between`?(m(),i(e,{key:1},[n[1]||=a(`span`,{class:`gp-grid-filter-to`},`to`,-1),a(`input`,{type:`date`,value:t.valueTo,onInput:e=>x(h)(o,{valueTo:e.target.value})},null,40,$e)],64)):r(`v-if`,!0),r(` Remove button (only if more than one condition) `),x(f).length>1?(m(),i(`button`,{key:2,type:`button`,class:`gp-grid-filter-remove`,onClick:e=>x(v)(o)},` × `,8,et)):r(`v-if`,!0)])]))),128)),r(` Add condition button `),a(`button`,{type:`button`,class:`gp-grid-filter-add`,onClick:n[0]||=e=>x(g)(`=`)},` + Add condition `),r(` Apply/Clear buttons `),a(`div`,{class:`gp-grid-filter-buttons`},[a(`button`,{type:`button`,class:`gp-grid-filter-btn-clear`,onClick:S},` Clear `),a(`button`,{type:`button`,class:`gp-grid-filter-btn-apply`,onClick:y},` Apply `)])]))}}),nt={class:`gp-grid-filter-header`},rt=c({__name:`FilterPopup`,props:{column:{},colIndex:{},anchorRect:{},distinctValues:{},currentFilter:{}},emits:[`apply`,`close`],setup(o,{emit:c}){let l=o,u=c,f=g(null);he(f,{onClose:()=>u(`close`),ignoreSelector:`.gp-grid-filter-icon`});let p=t(()=>l.column.colId??l.column.field);function h(e){u(`apply`,p.value,e),u(`close`)}function _(){u(`close`)}let v=t(()=>l.column.cellDataType);t(()=>v.value===`text`||v.value===`object`);let y=t(()=>v.value===`number`),x=t(()=>v.value===`date`||v.value===`dateString`||v.value===`dateTime`||v.value===`dateTimeString`),S=t(()=>({position:`fixed`,top:`${l.anchorRect.top+l.anchorRect.height+4}px`,left:`${l.anchorRect.left}px`,minWidth:`${Math.max(200,l.anchorRect.width)}px`,zIndex:1e4}));return(t,c)=>(m(),i(`div`,{ref_key:`popupRef`,ref:f,class:`gp-grid-filter-popup`,style:d(S.value)},[a(`div`,nt,` Filter: `+b(o.column.headerName??o.column.field),1),r(` Number filter `),y.value?(m(),n(We,{key:0,"current-filter":o.currentFilter,onApply:h,onClose:_},null,8,[`current-filter`])):x.value?(m(),i(e,{key:1},[r(` Date filter `),s(tt,{"current-filter":o.currentFilter,onApply:h,onClose:_},null,8,[`current-filter`])],2112)):(m(),i(e,{key:2},[r(` Text filter (default) `),s(Ne,{"distinct-values":o.distinctValues,"current-filter":o.currentFilter,onApply:h,onClose:_},null,8,[`distinct-values`,`current-filter`])],2112))],4))}}),it=[`data-col-index`,`onClick`],at=[`onMousedown`,`onDblclick`,`onMouseenter`],ot={key:0,class:`gp-grid-error`},st={key:1,class:`gp-grid-empty`},ct={key:1,class:`gp-grid-loading`,style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,pointerEvents:`auto`}},lt=c({__name:`GpGrid`,props:{columns:{},dataSource:{},rowData:{},rowHeight:{},headerHeight:{},overscan:{default:3},sortingEnabled:{type:Boolean,default:!0},darkMode:{type:Boolean,default:!1},wheelDampening:{default:.1},cellRenderers:{default:()=>({})},editRenderers:{default:()=>({})},headerRenderers:{default:()=>({})},cellRenderer:{},editRenderer:{},headerRenderer:{},initialWidth:{},initialHeight:{},highlighting:{},getRowId:{},onCellValueChanged:{},loadingComponent:{}},setup(o,{expose:s}){re();let c=o,l=g(null),h=g(null),S=y(null),w=y(null),T=y(null),D=g(0),{state:O,applyInstructions:A,reset:M}=q({initialWidth:c.initialWidth,initialHeight:c.initialHeight}),P=t(()=>c.headerHeight??c.rowHeight),F=t(()=>c.columns.map((e,t)=>({column:e,originalIndex:t})).filter(({column:e})=>!e.hidden)),I=t(()=>k(F.value.map(e=>e.column),O.viewportWidth)),L=t(()=>I.value.positions),R=t(()=>I.value.widths),z=t(()=>te(L.value)),ne=t(()=>Array.from(O.slots.values())),{handleCellMouseDown:ie,handleCellDoubleClick:ae,handleFillHandleMouseDown:H,handleHeaderClick:se,handleKeyDown:W,handleWheel:G,dragState:K}=Y(S,h,t(()=>c.columns),{activeCell:t(()=>O.activeCell),selectionRange:t(()=>O.selectionRange),editingCell:t(()=>O.editingCell),filterPopupOpen:t(()=>O.filterPopup?.isOpen??!1),rowHeight:c.rowHeight,headerHeight:P.value,columnPositions:L,visibleColumnsWithIndices:F,slots:t(()=>O.slots)}),{fillHandlePosition:J}=X({activeCell:t(()=>O.activeCell),selectionRange:t(()=>O.selectionRange),slots:t(()=>O.slots),columns:t(()=>c.columns),visibleColumnsWithIndices:F,columnPositions:L,columnWidths:R,rowHeight:c.rowHeight});function ce(){let e=h.value,t=S.value;!e||!t||t.setViewport(e.scrollTop,e.scrollLeft,e.clientWidth,e.clientHeight)}function le(){let e=h.value;e&&(D.value=e.scrollLeft),ce()}function Z(e,t){let n=S.value;n&&n.setFilter(e,t)}function Q(){let e=S.value;e&&e.closeFilterPopup()}function de(e,t){S.value?.input.handleCellMouseEnter(e,t)}function pe(){S.value?.input.handleCellMouseLeave()}function he(e){return[`gp-grid-row`,...S.value?.highlight?.computeRowClasses(e.rowIndex,e.rowData)??[]].filter(Boolean).join(` `)}function $(e,t,n,r,i){let a=V(e,t,O.editingCell);return[ee(B(e,t,O.activeCell),U(e,t,O.selectionRange),a,oe(e,t,K.value.dragType===`fill`,K.value.fillSourceRange,K.value.fillTarget)),...S.value?.highlight?.computeCombinedCellClasses(e,t,n,r)??[]].filter(Boolean).join(` `)}function ge(){return c.dataSource??(c.rowData?N(c.rowData):j([]))}function _e(e){T.value&&=(T.value(),null),S.value&&S.value.destroy();let t=new E({columns:c.columns,dataSource:e,rowHeight:c.rowHeight,headerHeight:P.value,overscan:c.overscan,sortingEnabled:c.sortingEnabled,highlighting:c.highlighting,getRowId:c.getRowId,onCellValueChanged:c.onCellValueChanged?e=>c.onCellValueChanged?.(e):void 0});S.value=t,T.value=t.onBatchInstruction(e=>{A(e)}),t.initialize();let n=h.value;n&&t.setViewport(n.scrollTop,n.scrollLeft,n.clientWidth,n.clientHeight)}return f(()=>{let e=ge();w.value=e,_e(e);let t=h.value;if(t&&typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>{S.value?.setViewport(t.scrollTop,t.scrollLeft,t.clientWidth,t.clientHeight)});e.observe(t),p(()=>{e.disconnect()})}p(()=>{T.value&&=(T.value(),null),S.value&&=(S.value.destroy(),null),w.value&&=(w.value.destroy?.(),null)})}),C([()=>c.dataSource,()=>c.rowData],()=>{c.rowData&&c.rowData.length>1e4&&w.value&&console.warn(`[gp-grid] rowData prop changed with ${c.rowData.length} rows — this triggers a full rebuild. Use useGridData() for efficient updates.`);let e=ge(),t=w.value;t&&t!==e?(t.destroy?.(),w.value=e,S.value?.setDataSource(e)):t||(w.value=e)}),C(()=>c.dataSource,e=>{if(e){let t=e;if(t.subscribe){let e=t.subscribe(()=>{S.value?.refreshFromTransaction()});p(()=>e())}}},{immediate:!0}),C(()=>c.highlighting,e=>{S.value?.highlight&&e&&S.value.highlight.updateOptions(e)}),s({core:S}),(t,s)=>(m(),i(`div`,{ref_key:`outerContainerRef`,ref:l,class:u([`gp-grid-container`,{"gp-grid-container--dark":o.darkMode}]),style:{width:`100%`,height:`100%`,position:`relative`,display:`flex`,"flex-direction":`column`},tabindex:`0`,onKeydown:s[2]||=(...e)=>x(W)&&x(W)(...e)},[r(` Header container - fixed height, horizontal scroll synced with body `),a(`div`,{class:u([`gp-grid-header`,{"gp-grid-header--loading":x(O).isLoading}]),style:d({flexShrink:0,height:`${P.value}px`,overflow:`hidden`,position:`relative`,zIndex:100})},[a(`div`,{style:d({position:`absolute`,top:0,left:0,transform:`translateX(${-D.value}px)`,width:`${Math.max(x(O).contentWidth,z.value)}px`,height:`${P.value}px`})},[(m(!0),i(e,null,_(F.value,({column:e,originalIndex:t},r)=>(m(),i(`div`,{key:e.colId??e.field,class:`gp-grid-header-cell`,"data-col-index":t,style:d({position:`absolute`,left:`${L.value[r]}px`,top:0,width:`${R.value[r]}px`,height:`${P.value}px`,background:`transparent`}),onClick:e=>x(se)(t,e)},[(m(),n(v(x(me)({column:e,colIndex:t,sortDirection:x(O).headers.get(t)?.sortDirection,sortIndex:x(O).headers.get(t)?.sortIndex,sortable:x(O).headers.get(t)?.sortable??!0,filterable:x(O).headers.get(t)?.filterable??!0,hasFilter:x(O).headers.get(t)?.hasFilter??!1,core:S.value,container:l.value,headerRenderers:o.headerRenderers??{},globalHeaderRenderer:o.headerRenderer}))))],12,it))),128))],4)],6),r(` Scrollable body container `),a(`div`,{ref_key:`bodyContainerRef`,ref:h,style:{flex:`1`,overflow:`auto`,position:`relative`},onScroll:le,onWheel:s[1]||=e=>x(G)(e,o.wheelDampening)},[r(` Content sizer - provides scroll range `),a(`div`,{style:d({width:`${Math.max(x(O).contentWidth,z.value)}px`,height:`${Math.max(x(O).contentHeight-P.value,0)}px`,position:`relative`,minWidth:`100%`})},[r(` Rows wrapper - uses transform to position rows with small translateY values `),r(` This prevents browser rendering issues at extreme pixel positions (millions of px) `),a(`div`,{class:`gp-grid-rows-wrapper`,style:d({position:`absolute`,top:0,left:0,width:`${Math.max(x(O).contentWidth,z.value)}px`,transform:`translateY(${x(O).rowsWrapperOffset}px)`,willChange:`transform`})},[r(` Row slots `),(m(!0),i(e,null,_(ne.value.filter(e=>e.rowIndex>=0),t=>(m(),i(`div`,{key:t.slotId,class:u(he(t)),style:d({position:`absolute`,top:0,left:0,transform:`translateY(${t.translateY}px)`,width:`${Math.max(x(O).contentWidth,z.value)}px`,height:`${o.rowHeight}px`})},[(m(!0),i(e,null,_(F.value,({column:a,originalIndex:s},c)=>(m(),i(`div`,{key:`${t.slotId}-${s}`,class:u($(t.rowIndex,s,a,t.rowData,x(O).hoverPosition)),style:d({position:`absolute`,left:`${L.value[c]}px`,top:0,width:`${R.value[c]}px`,height:`${o.rowHeight}px`}),onMousedown:e=>x(ie)(t.rowIndex,s,e),onDblclick:()=>x(ae)(t.rowIndex,s),onMouseenter:()=>de(t.rowIndex,s),onMouseleave:pe},[r(` Edit mode `),x(V)(t.rowIndex,s,x(O).editingCell)&&x(O).editingCell?(m(),n(v(x(fe)({column:a,rowData:t.rowData,rowIndex:t.rowIndex,colIndex:s,initialValue:x(O).editingCell.initialValue,core:S.value,editRenderers:o.editRenderers??{},globalEditRenderer:o.editRenderer})),{key:0})):(m(),i(e,{key:1},[r(` View mode `),(m(),n(v(x(ue)({column:a,rowData:t.rowData,rowIndex:t.rowIndex,colIndex:s,isActive:x(B)(t.rowIndex,s,x(O).activeCell),isSelected:x(U)(t.rowIndex,s,x(O).selectionRange),isEditing:!1,cellRenderers:o.cellRenderers??{},globalCellRenderer:o.cellRenderer}))))],64))],46,at))),128))],6))),128)),r(` Fill handle - inside wrapper so it moves with rows `),x(J)&&!x(O).editingCell?(m(),i(`div`,{key:0,class:`gp-grid-fill-handle`,style:d({position:`absolute`,top:`${x(J).top}px`,left:`${x(J).left}px`,zIndex:200}),onMousedown:s[0]||=(...e)=>x(H)&&x(H)(...e)},null,36)):r(`v-if`,!0)],4),r(` Error message `),x(O).error?(m(),i(`div`,ot,` Error: `+b(x(O).error),1)):r(`v-if`,!0),r(` Empty state `),!x(O).isLoading&&!x(O).error&&x(O).totalRows===0?(m(),i(`div`,st,` No data to display `)):r(`v-if`,!0)],4),r(` End content sizer `)],544),r(` End scrollable body container `),r(` Loading overlay - positioned outside scrollable area to avoid Firefox sticky issues `),x(O).isLoading?(m(),i(`div`,{key:0,style:d({position:`absolute`,top:`${P.value}px`,left:0,right:0,bottom:0,zIndex:50,pointerEvents:`none`})},[s[4]||=a(`div`,{class:`gp-grid-loading-overlay`,style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`}},null,-1),c.loadingComponent?(m(),n(v(c.loadingComponent),{key:0,"is-loading":!0})):(m(),i(`div`,ct,[...s[3]||=[a(`div`,{class:`gp-grid-loading-spinner`},null,-1)]]))],4)):r(`v-if`,!0),r(` Filter Popup `),x(O).filterPopup?.isOpen&&x(O).filterPopup.column&&x(O).filterPopup.anchorRect?(m(),n(rt,{key:1,column:x(O).filterPopup.column,"col-index":x(O).filterPopup.colIndex,"anchor-rect":x(O).filterPopup.anchorRect,"distinct-values":x(O).filterPopup.distinctValues,"current-filter":x(O).filterPopup.currentFilter,onApply:Z,onClose:Q},null,8,[`column`,`col-index`,`anchor-rect`,`distinct-values`,`current-filter`])):r(`v-if`,!0)],34))}});function ut(e){re();let n=g(null),r=g(null),{state:i,applyInstructions:a}=q(),o=t(()=>e.headerHeight??e.rowHeight),s=t(()=>e.columns.map((e,t)=>({column:e,originalIndex:t})).filter(({column:e})=>!e.hidden)),c=t(()=>k(s.value.map(e=>e.column),i.viewportWidth)),l=t(()=>c.value.positions),u=t(()=>c.value.widths),d=t(()=>te(l.value)),m=t(()=>Array.from(i.slots.values())),{handleCellMouseDown:h,handleCellDoubleClick:_,handleFillHandleMouseDown:v,handleHeaderClick:y,handleKeyDown:b,handleWheel:x,dragState:S}=Y(r,n,t(()=>e.columns),{activeCell:t(()=>i.activeCell),selectionRange:t(()=>i.selectionRange),editingCell:t(()=>i.editingCell),filterPopupOpen:t(()=>i.filterPopup?.isOpen??!1),rowHeight:e.rowHeight,headerHeight:o.value,columnPositions:l,visibleColumnsWithIndices:s,slots:t(()=>i.slots)}),w=()=>{let e=n.value,t=r.value;!e||!t||t.setViewport(e.scrollTop,e.scrollLeft,e.clientWidth,e.clientHeight)},T=(e,t)=>{let n=r.value;n&&n.setFilter(e,t)},D=()=>{let e=r.value;e&&e.closeFilterPopup()},O=(e,t)=>{r.value?.input.handleCellMouseEnter(e,t)},A=()=>{r.value?.input.handleCellMouseLeave()};f(()=>{let t=e.dataSource??(e.rowData?N(e.rowData):j([])),i=new E({columns:e.columns,dataSource:t,rowHeight:e.rowHeight,headerHeight:o.value,overscan:e.overscan??3,sortingEnabled:e.sortingEnabled??!0,highlighting:e.highlighting,getRowId:e.getRowId,onCellValueChanged:e.onCellValueChanged?t=>e.onCellValueChanged?.(t):void 0});r.value=i;let s=i.onBatchInstruction(e=>{a(e)});i.initialize();let c=n.value;if(c){i.setViewport(c.scrollTop,c.scrollLeft,c.clientWidth,c.clientHeight);let e=new ResizeObserver(()=>{i.setViewport(c.scrollTop,c.scrollLeft,c.clientWidth,c.clientHeight)});e.observe(c),p(()=>{e.disconnect(),s(),r.value=null})}}),C(()=>e.dataSource,e=>{if(e){let t=e;if(t.subscribe){let e=t.subscribe(()=>{r.value?.refresh()});p(()=>e())}}},{immediate:!0}),C(()=>e.highlighting,e=>{r.value?.highlight&&e&&r.value.highlight.updateOptions(e)});let{fillHandlePosition:M}=X({activeCell:t(()=>i.activeCell),selectionRange:t(()=>i.selectionRange),slots:t(()=>i.slots),columns:t(()=>e.columns),visibleColumnsWithIndices:s,columnPositions:l,columnWidths:u,rowHeight:e.rowHeight});return{containerRef:n,coreRef:r,state:i,slotsArray:m,totalHeaderHeight:o,columnPositions:l,columnWidths:u,totalWidth:d,fillHandlePosition:M,handleScroll:w,handleCellMouseDown:h,handleCellDoubleClick:_,handleFillHandleMouseDown:v,handleHeaderClick:y,handleKeyDown:b,handleWheel:x,handleFilterApply:T,handleFilterPopupClose:D,handleCellMouseEnter:O,handleCellMouseLeave:A,dragState:S,isCellSelected:U,isCellActive:B,isCellEditing:V,isCellInFillPreview:oe,buildCellClasses:ee}}const dt=(e,t)=>{let n=F(e,{getRowId:t.getRowId,debounceMs:t.debounceMs,useWorker:t.useWorker,parallelSort:t.parallelSort});return p(()=>{n.clear()}),{dataSource:n,updateRow:n.updateRow,addRows:n.addRows,removeRows:n.removeRows,updateCell:n.updateCell,clear:n.clear,getRowById:n.getRowById,getTotalRowCount:n.getTotalRowCount,flushTransactions:n.flushTransactions}};export{lt as GpGrid,lt as default,T as GridCore,D as buildCellClasses,O as calculateColumnPositions,A as createClientDataSource,M as createDataSourceFromArray,G as createInitialState,P as createMutableClientDataSource,I as createServerDataSource,L as findColumnAtX,Q as getCellValue,R as getTotalWidth,z as gridStyles,ne as injectStyles,ie as isCellActive,ae as isCellEditing,H as isCellInFillPreview,se as isCellSelected,W as isRowVisible,ue as renderCell,fe as renderEditCell,me as renderHeader,J as useAutoScroll,X as useFillHandle,$ as useFilterConditions,he as useFilterPopup,ut as useGpGrid,dt as useGridData,q as useGridState,Y as useInputHandler};
1
+ import{Fragment as e,computed as t,createBlock as n,createCommentVNode as r,createElementBlock as i,createElementVNode as a,createTextVNode as o,createVNode as s,defineComponent as c,h as l,normalizeClass as u,normalizeStyle as d,onMounted as f,onUnmounted as p,openBlock as m,ref as h,renderList as g,resolveDynamicComponent as _,shallowRef as v,toDisplayString as y,unref as b,vModelText as x,watch as S,withDirectives as C,withModifiers as w}from"vue";import{GridCore as T,GridCore as E,applyInstruction as D,buildCellClasses as O,buildCellClasses as k,calculateColumnPositions as A,calculateFillHandlePosition as j,calculateScaledColumnPositions as M,createClientDataSource as N,createClientDataSource as P,createDataSourceFromArray as F,createDataSourceFromArray as I,createInitialState as L,createInitialState as R,createMutableClientDataSource as z,createMutableClientDataSource as B,createServerDataSource as V,findColumnAtX as ee,getFieldValue as te,getFieldValue as H,getTotalWidth as ne,getTotalWidth as re,gridStyles as ie,injectStyles as ae,injectStyles as oe,isCellActive as se,isCellActive as U,isCellEditing as ce,isCellEditing as W,isCellInFillPreview as le,isCellInFillPreview as G,isCellSelected as ue,isCellSelected as K,isRowVisible as de,scrollCellIntoView as fe}from"@gp-grid/core";function q(e){let t=v(R(e));return{state:t,applyInstructions:e=>{let n=t.value,r=new Map(n.slots),i=new Map(n.headers),a={};for(let t of e){let e=D(t,r,i);e&&Object.assign(a,e)}a.slots=r,a.headers=i,t.value={...n,...a}},reset:()=>{t.value=R()}}}function J(e,t){let n=h(null);function r(r,i){n.value&&clearInterval(n.value),n.value=setInterval(()=>{let n=e.value;n&&(n.scrollTop+=i,n.scrollLeft+=r,t?.())},16)}function i(){n.value&&=(clearInterval(n.value),null)}return p(()=>{i()}),{startAutoScroll:r,stopAutoScroll:i}}function Y(e,t,n,r){let{activeCell:i,selectionRange:a,editingCell:o,filterPopupOpen:s,rowHeight:c,headerHeight:l,columnPositions:u,visibleColumnsWithIndices:d,slots:f}=r,m=h({isDragging:!1,dragType:null,fillSourceRange:null,fillTarget:null,columnResize:null,columnMove:null,rowDrag:null}),g=null,_=null,{startAutoScroll:v,stopAutoScroll:y}=J(t,()=>{let t=e.value;if(g&&t?.input){let e=b();e&&(t.input.handleDragMove(g,e),m.value=t.input.getDragState())}});S([()=>l,()=>c,u,d],()=>{let t=e.value;if(t?.input){let e=d.value;t.input.updateDeps({getHeaderHeight:()=>l,getRowHeight:()=>c,getColumnPositions:()=>u.value,getColumnCount:()=>e.length,getOriginalColumnIndex:t=>{let n=e[t];return n?n.originalIndex:t}})}},{immediate:!0});function b(){let e=t.value;if(!e)return null;let n=e.getBoundingClientRect();return{top:n.top,left:n.left,width:n.width,height:n.height,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}}function x(e){return{clientX:e.clientX,clientY:e.clientY,button:e.button,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey}}function C(){_?.();let t=t=>{let n=e.value,r=b();if(!n?.input||!r)return;let i=x(t);g=i;let a=n.input.handleDragMove(i,r);a&&(a.autoScroll?v(a.autoScroll.dx,a.autoScroll.dy):y(),m.value=n.input.getDragState())},n=()=>{console.log(`[gp-grid] handleMouseUp fired`);try{let t=e.value;t?.input&&(t.input.handleDragEnd(),console.log(`[gp-grid] handleDragEnd completed`))}catch(e){console.error(`[gp-grid] handleDragEnd threw:`,e)}finally{let r=e.value,i=r?.input?r.input.getDragState():{isDragging:!1,dragType:null,fillSourceRange:null,fillTarget:null,columnResize:null,columnMove:null,rowDrag:null};console.log(`[gp-grid] resetting dragState, dragType:`,i.dragType),m.value=i,g=null,y(),document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n),_=null}};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n),_=()=>{document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)}}function w(n,r,i){let a=e.value;if(!a?.input)return;let o=a.input.handleCellMouseDown(n,r,x(i));o.focusContainer&&t.value?.focus(),o.startDrag===`selection`?(a.input.startSelectionDrag(),m.value=a.input.getDragState(),C()):o.startDrag===`row-drag`&&(m.value=a.input.getDragState(),C())}function T(t,n){let r=e.value;r?.input&&r.input.handleCellDoubleClick(t,n)}function E(t){let n=e.value;if(!n?.input)return;let r=n.input.handleFillHandleMouseDown(i.value,a.value,x(t));r.preventDefault&&t.preventDefault(),r.stopPropagation&&t.stopPropagation(),r.startDrag===`fill`&&(m.value=n.input.getDragState(),C())}function D(t,r){let i=e.value;if(!i?.input)return;let a=n.value[t];if(!a)return;let o=a.colId??a.field;i.input.handleHeaderClick(o,r.shiftKey)}function O(t,n,r,i){let a=e.value;if(!a?.input)return;let o=a.input.handleHeaderMouseDown(t,n,r,x(i));o.preventDefault&&i.preventDefault(),o.stopPropagation&&i.stopPropagation(),o.startDrag===`column-move`&&(m.value=a.input.getDragState(),C())}function k(t,n,r){let i=e.value;if(!i?.input)return;let a=i.input.handleHeaderResizeMouseDown(t,n,x(r));a.preventDefault&&r.preventDefault(),a.stopPropagation&&r.stopPropagation(),a.startDrag===`column-resize`&&(m.value=i.input.getDragState(),C())}function A(n){let r=e.value,a=t.value;if(!r?.input)return;let u=r.input.handleKeyDown({key:n.key,shiftKey:n.shiftKey,ctrlKey:n.ctrlKey,metaKey:n.metaKey},i.value,o.value,s.value);u.preventDefault&&n.preventDefault(),u.scrollToCell&&a&&fe(r,a,u.scrollToCell.row,c,l,f.value)}function j(n,r){let i=e.value,a=t.value;if(!i?.input||!a)return;let o=i.input.handleWheel(n.deltaY,n.deltaX,r);o&&(n.preventDefault(),a.scrollTop+=o.dy,a.scrollLeft+=o.dx)}return p(()=>{_?.(),_=null,y()}),{handleCellMouseDown:w,handleCellDoubleClick:T,handleFillHandleMouseDown:E,handleHeaderClick:D,handleHeaderMouseDown:O,handleHeaderResizeMouseDown:k,handleKeyDown:A,handleWheel:j,dragState:m}}const X=e=>{let{activeCell:n,selectionRange:r,slots:i,columns:a,visibleColumnsWithIndices:o,columnPositions:s,columnWidths:c,rowHeight:l}=e;return{fillHandlePosition:t(()=>j({activeCell:n.value,selectionRange:r.value,slots:i.value,columns:a.value,visibleColumnsWithIndices:o.value,columnPositions:s.value,columnWidths:c.value,rowHeight:l}))}};function Z(e,t){let{onClose:n,ignoreSelector:r=`.gp-grid-filter-icon`}=t,i=null,a=null;f(()=>{i=t=>{let i=t.target;r&&i.closest(r)||e.value&&!e.value.contains(i)&&n()},a=e=>{e.key===`Escape`&&n()},requestAnimationFrame(()=>{i&&document.addEventListener(`mousedown`,i),a&&document.addEventListener(`keydown`,a)})}),p(()=>{i&&document.removeEventListener(`mousedown`,i),a&&document.removeEventListener(`keydown`,a)})}function Q(e,t=`and`){let n=h([...e]);return{conditions:n,combination:h(t),updateCondition:(e,t)=>{let r=[...n.value];r[e]={...r[e],...t},n.value=r},addCondition:e=>{n.value=[...n.value,{operator:e,value:``,valueTo:``,nextOperator:`and`}]},removeCondition:e=>{n.value=n.value.filter((t,n)=>n!==e)}}}const pe={class:`gp-grid-filter-content gp-grid-filter-text`},me={key:0,class:`gp-grid-filter-mode-toggle`},he={key:1,class:`gp-grid-filter-info`},ge={class:`gp-grid-filter-actions`},_e=[`disabled`],ve={class:`gp-grid-filter-list`},ye={key:0,class:`gp-grid-filter-option`},be=[`checked`],xe=[`checked`,`onChange`],Se={key:0,class:`gp-grid-filter-combination`},Ce=[`onClick`],we=[`onClick`],Te={class:`gp-grid-filter-row`},Ee=[`value`,`autofocus`,`onChange`],De=[`value`],Oe=[`value`,`onInput`],ke=[`onClick`],Ae=c({__name:`TextFilterContent`,props:{distinctValues:{},currentFilter:{}},emits:[`apply`,`close`],setup(n,{emit:o}){let s=[{value:`contains`,label:`Contains`},{value:`notContains`,label:`Does not contain`},{value:`equals`,label:`Equals`},{value:`notEquals`,label:`Does not equal`},{value:`startsWith`,label:`Starts with`},{value:`endsWith`,label:`Ends with`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Is not blank`}],c=n,l=o;function d(e){return Array.isArray(e)?e.join(`, `):String(e??``)}let f=t(()=>{let e=c.distinctValues.filter(e=>e!=null&&e!==``&&!(Array.isArray(e)&&e.length===0)).map(e=>d(e));return Array.from(new Set(e)).sort((e,t)=>{let n=parseFloat(e),r=parseFloat(t);return!isNaN(n)&&!isNaN(r)?n-r:e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})})}),p=t(()=>f.value.length>100),_=h(t(()=>{if(!c.currentFilter?.conditions[0])return p.value?`condition`:`values`;let e=c.currentFilter.conditions[0];return e.selectedValues&&e.selectedValues.size>0?`values`:`condition`}).value),v=t(()=>c.currentFilter?.conditions[0]?c.currentFilter.conditions[0].selectedValues??new Set:new Set),S=t(()=>c.currentFilter?.conditions[0]?c.currentFilter.conditions[0].includeBlank??!0:!0),w=h(``),T=h(new Set(v.value)),E=h(S.value),{conditions:D,combination:O,updateCondition:k,addCondition:A,removeCondition:j}=Q(t(()=>{if(!c.currentFilter?.conditions.length)return[{operator:`contains`,value:``,valueTo:``,nextOperator:`and`}];let e=c.currentFilter.conditions[0];if(e.selectedValues&&e.selectedValues.size>0)return[{operator:`contains`,value:``,valueTo:``,nextOperator:`and`}];let t=c.currentFilter.combination??`and`;return c.currentFilter.conditions.map(e=>{let n=e;return{operator:n.operator,value:n.value??``,valueTo:``,nextOperator:n.nextOperator??t}})}).value,c.currentFilter?.combination??`and`),M=t(()=>{if(!w.value)return f.value;let e=w.value.toLowerCase();return f.value.filter(t=>t.toLowerCase().includes(e))}),N=t(()=>c.distinctValues.some(e=>e==null||e===``)),P=t(()=>M.value.every(e=>T.value.has(e))&&(!N.value||E.value));function F(){T.value=new Set(M.value),N.value&&(E.value=!0)}function I(){T.value=new Set,E.value=!1}function L(e){let t=new Set(T.value);t.has(e)?t.delete(e):t.add(e),T.value=t}function R(){if(_.value===`values`){if(f.value.every(e=>T.value.has(e))&&(!N.value||E.value)){l(`apply`,null);return}l(`apply`,{conditions:[{type:`text`,operator:`equals`,selectedValues:T.value,includeBlank:E.value}],combination:`and`})}else{let e=D.value.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.value.trim()!==``);if(e.length===0){l(`apply`,null);return}l(`apply`,{conditions:e.map(e=>({type:`text`,operator:e.operator,value:e.value,nextOperator:e.nextOperator})),combination:`and`})}}function z(){l(`apply`,null)}return(t,n)=>(m(),i(`div`,pe,[r(` Mode toggle - only show if not too many values `),p.value?r(`v-if`,!0):(m(),i(`div`,me,[a(`button`,{type:`button`,class:u({active:_.value===`values`}),onClick:n[0]||=e=>_.value=`values`},` Values `,2),a(`button`,{type:`button`,class:u({active:_.value===`condition`}),onClick:n[1]||=e=>_.value=`condition`},` Condition `,2)])),r(` Too many values message `),p.value&&_.value===`condition`?(m(),i(`div`,he,` Too many unique values (`+y(f.value.length)+`). Use conditions to filter. `,1)):r(`v-if`,!0),r(` VALUES MODE `),_.value===`values`?(m(),i(e,{key:2},[r(` Search input `),C(a(`input`,{"onUpdate:modelValue":n[2]||=e=>w.value=e,class:`gp-grid-filter-search`,type:`text`,placeholder:`Search...`,autofocus:``},null,512),[[x,w.value]]),r(` Select all / Deselect all `),a(`div`,ge,[a(`button`,{type:`button`,disabled:P.value,onClick:F},` Select All `,8,_e),a(`button`,{type:`button`,onClick:I},` Deselect All `)]),r(` Checkbox list `),a(`div`,ve,[r(` Blanks option `),N.value?(m(),i(`label`,ye,[a(`input`,{type:`checkbox`,checked:E.value,onChange:n[3]||=e=>E.value=!E.value},null,40,be),n[5]||=a(`span`,{class:`gp-grid-filter-blank`},`(Blanks)`,-1)])):r(`v-if`,!0),r(` Values `),(m(!0),i(e,null,g(M.value,e=>(m(),i(`label`,{key:e,class:`gp-grid-filter-option`},[a(`input`,{type:`checkbox`,checked:T.value.has(e),onChange:t=>L(e)},null,40,xe),a(`span`,null,y(e),1)]))),128))])],64)):r(`v-if`,!0),r(` CONDITION MODE `),_.value===`condition`?(m(),i(e,{key:3},[(m(!0),i(e,null,g(b(D),(t,n)=>(m(),i(`div`,{key:n,class:`gp-grid-filter-condition`},[r(` Combination toggle (AND/OR) for conditions after the first `),n>0?(m(),i(`div`,Se,[a(`button`,{type:`button`,class:u({active:b(D)[n-1]?.nextOperator===`and`}),onClick:e=>b(k)(n-1,{nextOperator:`and`})},` AND `,10,Ce),a(`button`,{type:`button`,class:u({active:b(D)[n-1]?.nextOperator===`or`}),onClick:e=>b(k)(n-1,{nextOperator:`or`})},` OR `,10,we)])):r(`v-if`,!0),a(`div`,Te,[r(` Operator select `),a(`select`,{value:t.operator,autofocus:n===0,onChange:e=>b(k)(n,{operator:e.target.value})},[(m(),i(e,null,g(s,e=>a(`option`,{key:e.value,value:e.value},y(e.label),9,De)),64))],40,Ee),r(` Text input (hidden for blank/notBlank) `),t.operator!==`blank`&&t.operator!==`notBlank`?(m(),i(`input`,{key:0,type:`text`,value:t.value,placeholder:`Value`,class:`gp-grid-filter-text-input`,onInput:e=>b(k)(n,{value:e.target.value})},null,40,Oe)):r(`v-if`,!0),r(` Remove button (only if more than one condition) `),b(D).length>1?(m(),i(`button`,{key:1,type:`button`,class:`gp-grid-filter-remove`,onClick:e=>b(j)(n)},` × `,8,ke)):r(`v-if`,!0)])]))),128)),r(` Add condition button `),a(`button`,{type:`button`,class:`gp-grid-filter-add`,onClick:n[4]||=e=>b(A)(`contains`)},` + Add condition `)],64)):r(`v-if`,!0),r(` Apply/Clear buttons `),a(`div`,{class:`gp-grid-filter-buttons`},[a(`button`,{type:`button`,class:`gp-grid-filter-btn-clear`,onClick:z},` Clear `),a(`button`,{type:`button`,class:`gp-grid-filter-btn-apply`,onClick:R},` Apply `)])]))}}),je={class:`gp-grid-filter-content gp-grid-filter-number`},Me={key:0,class:`gp-grid-filter-combination`},Ne=[`onClick`],Pe=[`onClick`],Fe={class:`gp-grid-filter-row`},Ie=[`value`,`onChange`],Le=[`value`],Re=[`value`,`onInput`],ze=[`value`,`onInput`],Be=[`onClick`],Ve=c({__name:`NumberFilterContent`,props:{currentFilter:{}},emits:[`apply`,`close`],setup(n,{emit:o}){let s=[{value:`=`,label:`=`},{value:`!=`,label:`≠`},{value:`>`,label:`>`},{value:`<`,label:`<`},{value:`>=`,label:`≥`},{value:`<=`,label:`≤`},{value:`between`,label:`↔`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Not blank`}],c=n,l=o,{conditions:d,combination:f,updateCondition:p,addCondition:h,removeCondition:_}=Q(t(()=>{if(!c.currentFilter?.conditions.length)return[{operator:`=`,value:``,valueTo:``,nextOperator:`and`}];let e=c.currentFilter.combination??`and`;return c.currentFilter.conditions.map(t=>{let n=t;return{operator:n.operator,value:n.value==null?``:String(n.value),valueTo:n.valueTo==null?``:String(n.valueTo),nextOperator:n.nextOperator??e}})}).value,c.currentFilter?.combination??`and`);function v(){let e=d.value.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.operator===`between`?e.value!==``&&e.valueTo!==``:e.value!==``);if(e.length===0){l(`apply`,null);return}l(`apply`,{conditions:e.map(e=>({type:`number`,operator:e.operator,value:e.value?parseFloat(e.value):void 0,valueTo:e.valueTo?parseFloat(e.valueTo):void 0,nextOperator:e.nextOperator})),combination:`and`})}function x(){l(`apply`,null)}return(t,n)=>(m(),i(`div`,je,[(m(!0),i(e,null,g(b(d),(t,o)=>(m(),i(`div`,{key:o,class:`gp-grid-filter-condition`},[r(` Combination toggle (AND/OR) for conditions after the first `),o>0?(m(),i(`div`,Me,[a(`button`,{type:`button`,class:u({active:b(d)[o-1]?.nextOperator===`and`}),onClick:e=>b(p)(o-1,{nextOperator:`and`})},` AND `,10,Ne),a(`button`,{type:`button`,class:u({active:b(d)[o-1]?.nextOperator===`or`}),onClick:e=>b(p)(o-1,{nextOperator:`or`})},` OR `,10,Pe)])):r(`v-if`,!0),a(`div`,Fe,[r(` Operator select `),a(`select`,{value:t.operator,onChange:e=>b(p)(o,{operator:e.target.value})},[(m(),i(e,null,g(s,e=>a(`option`,{key:e.value,value:e.value},y(e.label),9,Le)),64))],40,Ie),r(` Number input (hidden for blank/notBlank) `),t.operator!==`blank`&&t.operator!==`notBlank`?(m(),i(`input`,{key:0,type:`number`,value:t.value,placeholder:`Value`,onInput:e=>b(p)(o,{value:e.target.value})},null,40,Re)):r(`v-if`,!0),r(` Second number input for "between" `),t.operator===`between`?(m(),i(e,{key:1},[n[1]||=a(`span`,{class:`gp-grid-filter-to`},`to`,-1),a(`input`,{type:`number`,value:t.valueTo,placeholder:`Value`,onInput:e=>b(p)(o,{valueTo:e.target.value})},null,40,ze)],64)):r(`v-if`,!0),r(` Remove button (only if more than one condition) `),b(d).length>1?(m(),i(`button`,{key:2,type:`button`,class:`gp-grid-filter-remove`,onClick:e=>b(_)(o)},` × `,8,Be)):r(`v-if`,!0)])]))),128)),r(` Add condition button `),a(`button`,{type:`button`,class:`gp-grid-filter-add`,onClick:n[0]||=e=>b(h)(`=`)},` + Add condition `),r(` Apply/Clear buttons `),a(`div`,{class:`gp-grid-filter-buttons`},[a(`button`,{type:`button`,class:`gp-grid-filter-btn-clear`,onClick:x},` Clear `),a(`button`,{type:`button`,class:`gp-grid-filter-btn-apply`,onClick:v},` Apply `)])]))}}),He={class:`gp-grid-filter-content gp-grid-filter-date`},Ue={key:0,class:`gp-grid-filter-combination`},We=[`onClick`],Ge=[`onClick`],Ke={class:`gp-grid-filter-row`},qe=[`value`,`onChange`],Je=[`value`],Ye=[`value`,`onInput`],Xe=[`value`,`onInput`],Ze=[`onClick`],Qe=c({__name:`DateFilterContent`,props:{currentFilter:{}},emits:[`apply`,`close`],setup(n,{emit:o}){let s=[{value:`=`,label:`=`},{value:`!=`,label:`≠`},{value:`>`,label:`>`},{value:`<`,label:`<`},{value:`between`,label:`↔`},{value:`blank`,label:`Is blank`},{value:`notBlank`,label:`Not blank`}],c=n,l=o;function d(e){if(!e)return``;let t=typeof e==`string`?new Date(e):e;return isNaN(t.getTime())?``:t.toISOString().split(`T`)[0]}let{conditions:f,combination:p,updateCondition:h,addCondition:_,removeCondition:v}=Q(t(()=>{if(!c.currentFilter?.conditions.length)return[{operator:`=`,value:``,valueTo:``,nextOperator:`and`}];let e=c.currentFilter.combination??`and`;return c.currentFilter.conditions.map(t=>{let n=t;return{operator:n.operator,value:d(n.value),valueTo:d(n.valueTo),nextOperator:n.nextOperator??e}})}).value,c.currentFilter?.combination??`and`);function x(){let e=f.value.filter(e=>e.operator===`blank`||e.operator===`notBlank`?!0:e.operator===`between`?e.value!==``&&e.valueTo!==``:e.value!==``);if(e.length===0){l(`apply`,null);return}l(`apply`,{conditions:e.map(e=>({type:`date`,operator:e.operator,value:e.value||void 0,valueTo:e.valueTo||void 0,nextOperator:e.nextOperator})),combination:`and`})}function S(){l(`apply`,null)}return(t,n)=>(m(),i(`div`,He,[(m(!0),i(e,null,g(b(f),(t,o)=>(m(),i(`div`,{key:o,class:`gp-grid-filter-condition`},[r(` Combination toggle (AND/OR) for conditions after the first `),o>0?(m(),i(`div`,Ue,[a(`button`,{type:`button`,class:u({active:b(f)[o-1]?.nextOperator===`and`}),onClick:e=>b(h)(o-1,{nextOperator:`and`})},` AND `,10,We),a(`button`,{type:`button`,class:u({active:b(f)[o-1]?.nextOperator===`or`}),onClick:e=>b(h)(o-1,{nextOperator:`or`})},` OR `,10,Ge)])):r(`v-if`,!0),a(`div`,Ke,[r(` Operator select `),a(`select`,{value:t.operator,onChange:e=>b(h)(o,{operator:e.target.value})},[(m(),i(e,null,g(s,e=>a(`option`,{key:e.value,value:e.value},y(e.label),9,Je)),64))],40,qe),r(` Date input (hidden for blank/notBlank) `),t.operator!==`blank`&&t.operator!==`notBlank`?(m(),i(`input`,{key:0,type:`date`,value:t.value,onInput:e=>b(h)(o,{value:e.target.value})},null,40,Ye)):r(`v-if`,!0),r(` Second date input for "between" `),t.operator===`between`?(m(),i(e,{key:1},[n[1]||=a(`span`,{class:`gp-grid-filter-to`},`to`,-1),a(`input`,{type:`date`,value:t.valueTo,onInput:e=>b(h)(o,{valueTo:e.target.value})},null,40,Xe)],64)):r(`v-if`,!0),r(` Remove button (only if more than one condition) `),b(f).length>1?(m(),i(`button`,{key:2,type:`button`,class:`gp-grid-filter-remove`,onClick:e=>b(v)(o)},` × `,8,Ze)):r(`v-if`,!0)])]))),128)),r(` Add condition button `),a(`button`,{type:`button`,class:`gp-grid-filter-add`,onClick:n[0]||=e=>b(_)(`=`)},` + Add condition `),r(` Apply/Clear buttons `),a(`div`,{class:`gp-grid-filter-buttons`},[a(`button`,{type:`button`,class:`gp-grid-filter-btn-clear`,onClick:S},` Clear `),a(`button`,{type:`button`,class:`gp-grid-filter-btn-apply`,onClick:x},` Apply `)])]))}}),$e={class:`gp-grid-filter-header`},et=c({__name:`FilterPopup`,props:{column:{},colIndex:{},anchorRect:{},distinctValues:{},currentFilter:{}},emits:[`apply`,`close`],setup(o,{emit:c}){let l=o,u=c,f=h(null);Z(f,{onClose:()=>u(`close`),ignoreSelector:`.gp-grid-filter-icon`});let p=t(()=>l.column.colId??l.column.field);function g(e){u(`apply`,p.value,e),u(`close`)}function _(){u(`close`)}let v=t(()=>l.column.cellDataType);t(()=>v.value===`text`||v.value===`object`);let b=t(()=>v.value===`number`),x=t(()=>v.value===`date`||v.value===`dateString`||v.value===`dateTime`||v.value===`dateTimeString`),S=t(()=>({position:`fixed`,top:`${l.anchorRect.top+l.anchorRect.height+4}px`,left:`${l.anchorRect.left}px`,minWidth:`${Math.max(200,l.anchorRect.width)}px`,zIndex:1e4}));return(t,c)=>(m(),i(`div`,{ref_key:`popupRef`,ref:f,class:`gp-grid-filter-popup`,style:d(S.value)},[a(`div`,$e,` Filter: `+y(o.column.headerName??o.column.field),1),r(` Number filter `),b.value?(m(),n(Ve,{key:0,"current-filter":o.currentFilter,onApply:g,onClose:_},null,8,[`current-filter`])):x.value?(m(),i(e,{key:1},[r(` Date filter `),s(Qe,{"current-filter":o.currentFilter,onApply:g,onClose:_},null,8,[`current-filter`])],2112)):(m(),i(e,{key:2},[r(` Text filter (default) `),s(Ae,{"distinct-values":o.distinctValues,"current-filter":o.currentFilter,onApply:g,onClose:_},null,8,[`distinct-values`,`current-filter`])],2112))],4))}}),$=e=>e==null||e===``?o(``):typeof e==`string`?o(e):e;function tt(t){let{column:n,colIndex:r,sortDirection:i,sortIndex:a,sortable:o,filterable:s,hasFilter:c,core:u,container:d,headerRenderers:f,globalHeaderRenderer:p}=t,m={column:n,colIndex:r,sortDirection:i,sortIndex:a,sortable:o,filterable:s,hasFilter:c,onSort:(e,t)=>{u&&o&&u.setSort(n.colId??n.field,e,t)},onFilterClick:()=>{if(u&&s){let e=d?.querySelector(`[data-col-index="${r}"]`);if(e){let t=e.getBoundingClientRect();u.openFilterPopup(r,{top:t.top,left:t.left,width:t.width,height:t.height})}}}};if(n.headerRenderer){if(typeof n.headerRenderer==`function`)return $(n.headerRenderer(m));let e=f[n.headerRenderer];if(e)return $(e(m))}if(p)return $(p(m));let h=[l(`span`,{class:`gp-grid-header-text`},n.headerName??n.field)],g=[];if(o){let e=[l(`span`,{class:`gp-grid-sort-arrows-stack`},[l(`svg`,{class:`gp-grid-sort-arrow-up${i===`asc`?` active`:``}`,width:`8`,height:`6`,viewBox:`0 0 8 6`},[l(`path`,{d:`M4 0L8 6H0L4 0Z`,fill:`currentColor`})]),l(`svg`,{class:`gp-grid-sort-arrow-down${i===`desc`?` active`:``}`,width:`8`,height:`6`,viewBox:`0 0 8 6`},[l(`path`,{d:`M4 6L0 0H8L4 6Z`,fill:`currentColor`})])])];a!==void 0&&a>0&&e.push(l(`span`,{class:`gp-grid-sort-index`},String(a))),g.push(l(`span`,{class:`gp-grid-sort-arrows`},e))}return s&&g.push(l(`span`,{class:`gp-grid-filter-icon${c?` active`:``}`,onMousedown:e=>{e.stopPropagation(),e.preventDefault(),m.onFilterClick()},onClick:e=>{e.stopPropagation()}},[l(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`currentColor`},[l(`path`,{d:`M4 4h16l-6 8v5l-4 2v-7L4 4z`})])])),g.length>0&&h.push(l(`span`,{class:`gp-grid-header-icons`},g)),l(e,h)}const nt=[`data-col-index`,`onMousedown`],rt=[`onMousedown`],it=c({__name:`GridHeader`,props:{headerHeight:{},scrollLeft:{},contentWidth:{},totalWidth:{},isLoading:{type:Boolean},visibleColumnsWithIndices:{},columnPositions:{},columnWidths:{},headers:{},sortingEnabled:{type:Boolean},onHeaderMouseDown:{type:Function},onHeaderResizeMouseDown:{type:Function},coreRef:{},outerContainerRef:{},headerRenderers:{},globalHeaderRenderer:{type:Function}},setup(t){let o=t;return(t,s)=>(m(),i(`div`,{class:u([`gp-grid-header`,{"gp-grid-header--loading":o.isLoading}]),style:d({height:`${o.headerHeight}px`})},[a(`div`,{style:d({position:`absolute`,top:0,left:0,transform:`translateX(${-o.scrollLeft}px)`,width:`${Math.max(o.contentWidth,o.totalWidth)}px`,height:`${o.headerHeight}px`})},[(m(!0),i(e,null,g(o.visibleColumnsWithIndices,({column:e,originalIndex:t},a)=>(m(),i(`div`,{key:e.colId??e.field,class:`gp-grid-header-cell`,"data-col-index":t,style:d({left:`${o.columnPositions[a]}px`,width:`${o.columnWidths[a]}px`,height:`${o.headerHeight}px`}),onMousedown:e=>o.onHeaderMouseDown(t,o.columnWidths[a]??0,o.headerHeight,e)},[(m(),n(_(b(tt)({column:e,colIndex:t,sortDirection:o.headers.get(t)?.sortDirection,sortIndex:o.headers.get(t)?.sortIndex,sortable:e.sortable!==!1&&o.sortingEnabled,filterable:e.filterable!==!1,hasFilter:o.headers.get(t)?.hasFilter??!1,core:o.coreRef,container:o.outerContainerRef,headerRenderers:o.headerRenderers,globalHeaderRenderer:o.globalHeaderRenderer})))),e.resizable===!1?r(`v-if`,!0):(m(),i(`div`,{key:0,class:`gp-grid-header-resize-handle`,onMousedown:w(e=>o.onHeaderResizeMouseDown(t,o.columnWidths[a]??0,e),[`stop`])},null,40,rt))],44,nt))),128))],4)],6))}});function at(e){let{column:t,rowData:n,rowIndex:r,colIndex:i,isActive:a,isSelected:s,isEditing:c,cellRenderers:l,globalCellRenderer:u}=e,d=te(n,t.field),f={value:d,rowData:n,column:t,rowIndex:r,colIndex:i,isActive:a,isSelected:s,isEditing:c};if(t.cellRenderer){if(typeof t.cellRenderer==`function`)return $(t.cellRenderer(f));let e=l[t.cellRenderer];if(e)return $(e(f))}return u?$(u(f)):o(d==null?``:String(d))}function ot(e){let{column:t,rowData:n,rowIndex:r,colIndex:i,initialValue:a,core:s,editRenderers:c,globalEditRenderer:u}=e;if(!s)return o(``);let d={value:H(n,t.field),rowData:n,column:t,rowIndex:r,colIndex:i,isActive:!0,isSelected:!0,isEditing:!0,initialValue:a,onValueChange:e=>s.updateEditValue(e),onCommit:()=>s.commitEdit(),onCancel:()=>s.cancelEdit()};if(t.editRenderer){if(typeof t.editRenderer==`function`)return $(t.editRenderer(d));let e=c[t.editRenderer];if(e)return $(e(d))}return u?$(u(d)):l(`input`,{class:`gp-grid-edit-input`,type:`text`,value:a==null?``:String(a),autofocus:!0,onFocus:e=>e.target.select(),onInput:e=>s.updateEditValue(e.target.value),onKeydown:e=>{e.stopPropagation(),e.key===`Enter`?s.commitEdit():e.key===`Escape`?s.cancelEdit():e.key===`Tab`&&(e.preventDefault(),s.commitEdit(),s.selection.moveFocus(e.shiftKey?`left`:`right`,!1))},onBlur:()=>s.commitEdit()})}const st=[`onMousedown`,`onDblclick`,`onMouseenter`],ct={key:0,class:`gp-grid-error`},lt={key:1,class:`gp-grid-empty`},ut=c({__name:`GridBody`,props:{rowHeight:{},totalHeaderHeight:{},contentWidth:{},contentHeight:{},totalWidth:{},rowsWrapperOffset:{},activeCell:{},selectionRange:{},editingCell:{},hoverPosition:{},error:{},isLoading:{type:Boolean},totalRows:{},slotsArray:{},visibleColumnsWithIndices:{},columnPositions:{},columnWidths:{},fillHandlePosition:{},dragState:{},onScroll:{type:Function},onWheel:{type:Function},wheelDampening:{},onCellMouseDown:{type:Function},onCellDoubleClick:{type:Function},onCellMouseEnter:{type:Function},onCellMouseLeave:{type:Function},onFillHandleMouseDown:{type:Function},coreRef:{},cellRenderers:{},editRenderers:{},globalCellRenderer:{type:Function},globalEditRenderer:{type:Function}},setup(t,{expose:o}){let s=t,c=h(null),l=e=>[`gp-grid-row`,...s.coreRef?.highlight?.computeRowClasses(e.rowIndex,e.rowData)??[]].filter(Boolean).join(` `),f=(e,t,n,r,i)=>{let a=W(e,t,s.editingCell),o=k(U(e,t,s.activeCell),K(e,t,s.selectionRange),a,G(e,t,s.dragState.dragType===`fill`,s.dragState.fillSourceRange,s.dragState.fillTarget)),c=s.coreRef?.highlight?.computeCombinedCellClasses(e,t,n,r)??[],l=n.rowDrag===!0;return[o,...c,l?`gp-grid-cell--row-drag-handle`:``].filter(Boolean).join(` `)};return o({bodyRef:c}),(t,o)=>(m(),i(`div`,{ref_key:`bodyRef`,ref:c,style:{flex:`1`,overflow:`auto`,position:`relative`},onScroll:o[2]||=(...e)=>s.onScroll&&s.onScroll(...e),onWheel:o[3]||=e=>s.onWheel(e,s.wheelDampening)},[r(` Content sizer - provides scroll range `),a(`div`,{style:d({width:`${Math.max(s.contentWidth,s.totalWidth)}px`,height:`${Math.max(s.contentHeight-s.totalHeaderHeight,0)}px`,position:`relative`,minWidth:`100%`})},[r(` Rows wrapper `),a(`div`,{class:`gp-grid-rows-wrapper`,style:d({width:`${Math.max(s.contentWidth,s.totalWidth)}px`,transform:`translateY(${s.rowsWrapperOffset}px)`})},[r(` Row slots `),(m(!0),i(e,null,g(s.slotsArray.filter(e=>e.rowIndex>=0),t=>(m(),i(`div`,{key:t.slotId,class:u(l(t)),style:d({position:`absolute`,top:0,left:0,transform:`translateY(${t.translateY}px)`,width:`${Math.max(s.contentWidth,s.totalWidth)}px`,height:`${s.rowHeight}px`})},[(m(!0),i(e,null,g(s.visibleColumnsWithIndices,({column:a,originalIndex:c},l)=>(m(),i(`div`,{key:`${t.slotId}-${a.colId??a.field}`,class:u(f(t.rowIndex,c,a,t.rowData,s.hoverPosition)),style:d({position:`absolute`,left:`${s.columnPositions[l]}px`,top:0,width:`${s.columnWidths[l]}px`,height:`${s.rowHeight}px`}),onMousedown:e=>s.onCellMouseDown(t.rowIndex,c,e),onDblclick:()=>s.onCellDoubleClick(t.rowIndex,c),onMouseenter:()=>s.onCellMouseEnter(t.rowIndex,c),onMouseleave:o[0]||=(...e)=>s.onCellMouseLeave&&s.onCellMouseLeave(...e)},[r(` Edit mode `),b(W)(t.rowIndex,c,s.editingCell)&&s.editingCell?(m(),n(_(b(ot)({column:a,rowData:t.rowData,rowIndex:t.rowIndex,colIndex:c,initialValue:s.editingCell.initialValue,core:s.coreRef,editRenderers:s.editRenderers,globalEditRenderer:s.globalEditRenderer})),{key:0})):(m(),i(e,{key:1},[r(` View mode `),(m(),n(_(b(at)({column:a,rowData:t.rowData,rowIndex:t.rowIndex,colIndex:c,isActive:b(U)(t.rowIndex,c,s.activeCell),isSelected:b(K)(t.rowIndex,c,s.selectionRange),isEditing:!1,cellRenderers:s.cellRenderers,globalCellRenderer:s.globalCellRenderer}))))],64))],46,st))),128))],6))),128)),r(` Fill handle `),s.fillHandlePosition&&!s.editingCell?(m(),i(`div`,{key:0,class:`gp-grid-fill-handle`,style:d({top:`${s.fillHandlePosition.top}px`,left:`${s.fillHandlePosition.left}px`}),onMousedown:o[1]||=(...e)=>s.onFillHandleMouseDown&&s.onFillHandleMouseDown(...e)},null,36)):r(`v-if`,!0),r(` Row drop indicator `),s.dragState.dragType===`row-drag`&&s.dragState.rowDrag?.dropTargetIndex!==null?(m(),i(`div`,{key:1,class:`gp-grid-row-drop-indicator`,style:d({transform:`translateY(${s.dragState.rowDrag.dropIndicatorY}px)`,width:`${Math.max(s.contentWidth,s.totalWidth)}px`})},null,4)):r(`v-if`,!0)],4),r(` Error message `),s.error?(m(),i(`div`,ct,` Error: `+y(s.error),1)):r(`v-if`,!0),r(` Empty state `),!s.isLoading&&!s.error&&s.totalRows===0?(m(),i(`div`,lt,` No data to display `)):r(`v-if`,!0)],4)],544))}}),dt={key:1,class:`gp-grid-loading`},ft=c({__name:`GpGrid`,props:{columns:{},dataSource:{},rowData:{},rowHeight:{},headerHeight:{},overscan:{default:3},sortingEnabled:{type:Boolean,default:!0},darkMode:{type:Boolean,default:!1},wheelDampening:{default:.1},cellRenderers:{default:()=>({})},editRenderers:{default:()=>({})},headerRenderers:{default:()=>({})},cellRenderer:{},editRenderer:{},headerRenderer:{},initialWidth:{},initialHeight:{},highlighting:{},getRowId:{},onCellValueChanged:{},loadingComponent:{},rowDragEntireRow:{type:Boolean},onRowDragEnd:{},onColumnResized:{},onColumnMoved:{}},setup(o,{expose:c}){oe();let l=o,g=h(null),x=h(null),C=t(()=>x.value?.bodyRef??null),w=v(null),T=v(null),D=v(null),O=h(0),{state:k,applyInstructions:A,reset:j}=q({initialWidth:l.initialWidth,initialHeight:l.initialHeight}),N=t(()=>l.headerHeight??l.rowHeight),F=t(()=>k.value.columns??l.columns),L=t(()=>F.value.map((e,t)=>({column:e,originalIndex:t})).filter(({column:e})=>!e.hidden)),R=t(()=>M(L.value.map(e=>e.column),k.value.viewportWidth)),z=t(()=>R.value.positions),B=t(()=>R.value.widths),V=t(()=>re(z.value)),ee=t(()=>Array.from(k.value.slots.values())),{handleCellMouseDown:te,handleCellDoubleClick:H,handleFillHandleMouseDown:ne,handleHeaderClick:ie,handleHeaderMouseDown:ae,handleHeaderResizeMouseDown:se,handleKeyDown:U,handleWheel:ce,dragState:W}=Y(w,C,F,{activeCell:t(()=>k.value.activeCell),selectionRange:t(()=>k.value.selectionRange),editingCell:t(()=>k.value.editingCell),filterPopupOpen:t(()=>k.value.filterPopup?.isOpen??!1),rowHeight:l.rowHeight,headerHeight:N.value,columnPositions:z,visibleColumnsWithIndices:L,slots:t(()=>k.value.slots)}),{fillHandlePosition:le}=X({activeCell:t(()=>k.value.activeCell),selectionRange:t(()=>k.value.selectionRange),slots:t(()=>k.value.slots),columns:F,visibleColumnsWithIndices:L,columnPositions:z,columnWidths:B,rowHeight:l.rowHeight});function G(){let e=C.value,t=w.value;!e||!t||t.setViewport(e.scrollTop,e.scrollLeft,e.clientWidth,e.clientHeight)}function ue(){let e=C.value;e&&(O.value=e.scrollLeft),G()}function K(e,t){let n=w.value;n&&n.setFilter(e,t)}function de(){let e=w.value;e&&e.closeFilterPopup()}function fe(e,t){w.value?.input.handleCellMouseEnter(e,t)}function J(){w.value?.input.handleCellMouseLeave()}function Z(){return l.dataSource??(l.rowData?I(l.rowData):P([]))}function Q(e){D.value&&=(D.value(),null),w.value&&w.value.destroy();let t=new E({columns:l.columns,dataSource:e,rowHeight:l.rowHeight,headerHeight:N.value,overscan:l.overscan,sortingEnabled:l.sortingEnabled,highlighting:l.highlighting,getRowId:l.getRowId,onCellValueChanged:l.onCellValueChanged?e=>l.onCellValueChanged?.(e):void 0,rowDragEntireRow:l.rowDragEntireRow??!1,onRowDragEnd:(e,t)=>l.onRowDragEnd?.(e,t),onColumnResized:(e,t)=>l.onColumnResized?.(e,t),onColumnMoved:(e,t)=>l.onColumnMoved?.(e,t)});w.value=t,D.value=t.onBatchInstruction(e=>{A(e)}),t.initialize();let n=C.value;n&&t.setViewport(n.scrollTop,n.scrollLeft,n.clientWidth,n.clientHeight)}return f(()=>{let e=Z();T.value=e,Q(e);let t=C.value;if(t&&typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>{w.value?.setViewport(t.scrollTop,t.scrollLeft,t.clientWidth,t.clientHeight)});e.observe(t),p(()=>{e.disconnect()})}p(()=>{D.value&&=(D.value(),null),w.value&&=(w.value.destroy(),null),T.value&&=(T.value.destroy?.(),null)})}),S([()=>l.dataSource,()=>l.rowData],()=>{l.rowData&&l.rowData.length>1e4&&T.value&&console.warn(`[gp-grid] rowData prop changed with ${l.rowData.length} rows — this triggers a full rebuild. Use useGridData() for efficient updates.`);let e=Z(),t=T.value;t&&t!==e?(t.destroy?.(),T.value=e,w.value?.setDataSource(e)):t||(T.value=e)}),S(()=>l.dataSource,e=>{if(e){let t=e;if(t.subscribe){let e=t.subscribe(()=>{w.value?.refreshFromTransaction()});p(()=>e())}}},{immediate:!0}),S(()=>l.highlighting,e=>{w.value?.highlight&&e&&w.value.highlight.updateOptions(e)}),c({core:w}),(t,c)=>(m(),i(`div`,{ref_key:`outerContainerRef`,ref:g,class:u([`gp-grid-container`,{"gp-grid-container--dark":o.darkMode}]),style:{width:`100%`,height:`100%`,position:`relative`,display:`flex`,"flex-direction":`column`},tabindex:`0`,onKeydown:c[0]||=(...e)=>b(U)&&b(U)(...e)},[s(it,{"header-height":N.value,"scroll-left":O.value,"content-width":b(k).contentWidth,"total-width":V.value,"is-loading":b(k).isLoading,"visible-columns-with-indices":L.value,"column-positions":z.value,"column-widths":B.value,headers:b(k).headers,"sorting-enabled":o.sortingEnabled,"on-header-mouse-down":b(ae),"on-header-resize-mouse-down":b(se),"core-ref":w.value,"outer-container-ref":g.value,"header-renderers":o.headerRenderers??{},"global-header-renderer":o.headerRenderer},null,8,[`header-height`,`scroll-left`,`content-width`,`total-width`,`is-loading`,`visible-columns-with-indices`,`column-positions`,`column-widths`,`headers`,`sorting-enabled`,`on-header-mouse-down`,`on-header-resize-mouse-down`,`core-ref`,`outer-container-ref`,`header-renderers`,`global-header-renderer`]),s(ut,{ref_key:`gridBodyComp`,ref:x,"row-height":o.rowHeight,"total-header-height":N.value,"content-width":b(k).contentWidth,"content-height":b(k).contentHeight,"total-width":V.value,"rows-wrapper-offset":b(k).rowsWrapperOffset,"active-cell":b(k).activeCell,"selection-range":b(k).selectionRange,"editing-cell":b(k).editingCell,"hover-position":b(k).hoverPosition,error:b(k).error,"is-loading":b(k).isLoading,"total-rows":b(k).totalRows,"slots-array":ee.value,"visible-columns-with-indices":L.value,"column-positions":z.value,"column-widths":B.value,"fill-handle-position":b(le),"drag-state":b(W),"on-scroll":ue,"on-wheel":b(ce),"wheel-dampening":o.wheelDampening,"on-cell-mouse-down":b(te),"on-cell-double-click":b(H),"on-cell-mouse-enter":fe,"on-cell-mouse-leave":J,"on-fill-handle-mouse-down":b(ne),"core-ref":w.value,"cell-renderers":o.cellRenderers??{},"edit-renderers":o.editRenderers??{},"global-cell-renderer":o.cellRenderer,"global-edit-renderer":o.editRenderer},null,8,`row-height.total-header-height.content-width.content-height.total-width.rows-wrapper-offset.active-cell.selection-range.editing-cell.hover-position.error.is-loading.total-rows.slots-array.visible-columns-with-indices.column-positions.column-widths.fill-handle-position.drag-state.on-wheel.wheel-dampening.on-cell-mouse-down.on-cell-double-click.on-fill-handle-mouse-down.core-ref.cell-renderers.edit-renderers.global-cell-renderer.global-edit-renderer`.split(`.`)),r(` Loading overlay - positioned outside scrollable area to avoid Firefox sticky issues `),b(k).isLoading?(m(),i(`div`,{key:0,style:d({position:`absolute`,top:`${N.value}px`,left:0,right:0,bottom:0,zIndex:50,pointerEvents:`none`})},[c[2]||=a(`div`,{class:`gp-grid-loading-overlay`},null,-1),l.loadingComponent?(m(),n(_(l.loadingComponent),{key:0,"is-loading":!0})):(m(),i(`div`,dt,[...c[1]||=[a(`div`,{class:`gp-grid-loading-spinner`},null,-1)]]))],4)):r(`v-if`,!0),r(` Filter Popup `),b(k).filterPopup?.isOpen&&b(k).filterPopup.column&&b(k).filterPopup.anchorRect?(m(),n(et,{key:1,column:b(k).filterPopup.column,"col-index":b(k).filterPopup.colIndex,"anchor-rect":b(k).filterPopup.anchorRect,"distinct-values":b(k).filterPopup.distinctValues,"current-filter":b(k).filterPopup.currentFilter,onApply:K,onClose:de},null,8,[`column`,`col-index`,`anchor-rect`,`distinct-values`,`current-filter`])):r(`v-if`,!0),r(` Column resize line `),b(W).dragType===`column-resize`&&b(W).columnResize?(m(),i(`div`,{key:2,class:`gp-grid-column-resize-line`,style:d({left:`${(z.value[L.value.findIndex(e=>e.originalIndex===b(W).columnResize.colIndex)]??0)+b(W).columnResize.currentWidth}px`})},null,4)):r(`v-if`,!0),r(` Column move ghost `),b(W).dragType===`column-move`&&b(W).columnMove?(m(),i(e,{key:3},[a(`div`,{class:`gp-grid-column-move-ghost`,style:d({left:`${b(W).columnMove.currentX-b(W).columnMove.ghostWidth/2}px`,top:`${b(W).columnMove.currentY-b(W).columnMove.ghostHeight/2}px`,width:`${b(W).columnMove.ghostWidth}px`,height:`${b(W).columnMove.ghostHeight}px`})},y(F.value[b(W).columnMove.sourceColIndex]?.headerName??F.value[b(W).columnMove.sourceColIndex]?.field??``),5),b(W).columnMove.dropTargetIndex===null?r(`v-if`,!0):(m(),i(`div`,{key:0,class:`gp-grid-column-drop-indicator`,style:d({left:`${z.value[b(W).columnMove.dropTargetIndex]??0}px`,height:`${N.value}px`})},null,4))],64)):r(`v-if`,!0),r(` Row drag ghost (fixed position, follows cursor) `),b(W).dragType===`row-drag`&&b(W).rowDrag?(m(),i(`div`,{key:4,class:`gp-grid-row-drag-ghost`,style:d({left:`${b(W).rowDrag.currentX+12}px`,top:`${b(W).rowDrag.currentY-o.rowHeight/2}px`,width:`${Math.min(300,V.value)}px`,height:`${o.rowHeight}px`})},null,4)):r(`v-if`,!0)],34))}});function pt(e){oe();let n=h(null),r=h(null),{state:i,applyInstructions:a}=q(),o=t(()=>e.headerHeight??e.rowHeight),s=t(()=>e.columns.map((e,t)=>({column:e,originalIndex:t})).filter(({column:e})=>!e.hidden)),c=t(()=>M(s.value.map(e=>e.column),i.value.viewportWidth)),l=t(()=>c.value.positions),u=t(()=>c.value.widths),d=t(()=>re(l.value)),m=t(()=>Array.from(i.value.slots.values())),{handleCellMouseDown:g,handleCellDoubleClick:_,handleFillHandleMouseDown:v,handleHeaderClick:y,handleKeyDown:b,handleWheel:x,dragState:C}=Y(r,n,t(()=>e.columns),{activeCell:t(()=>i.value.activeCell),selectionRange:t(()=>i.value.selectionRange),editingCell:t(()=>i.value.editingCell),filterPopupOpen:t(()=>i.value.filterPopup?.isOpen??!1),rowHeight:e.rowHeight,headerHeight:o.value,columnPositions:l,visibleColumnsWithIndices:s,slots:t(()=>i.value.slots)}),w=()=>{let e=n.value,t=r.value;!e||!t||t.setViewport(e.scrollTop,e.scrollLeft,e.clientWidth,e.clientHeight)},T=(e,t)=>{let n=r.value;n&&n.setFilter(e,t)},D=()=>{let e=r.value;e&&e.closeFilterPopup()},O=(e,t)=>{r.value?.input.handleCellMouseEnter(e,t)},A=()=>{r.value?.input.handleCellMouseLeave()};f(()=>{let t=e.dataSource??(e.rowData?I(e.rowData):P([])),i=new E({columns:e.columns,dataSource:t,rowHeight:e.rowHeight,headerHeight:o.value,overscan:e.overscan??3,sortingEnabled:e.sortingEnabled??!0,highlighting:e.highlighting,getRowId:e.getRowId,onCellValueChanged:e.onCellValueChanged?t=>e.onCellValueChanged?.(t):void 0});r.value=i;let s=i.onBatchInstruction(e=>{a(e)});i.initialize();let c=n.value;if(c){i.setViewport(c.scrollTop,c.scrollLeft,c.clientWidth,c.clientHeight);let e=new ResizeObserver(()=>{i.setViewport(c.scrollTop,c.scrollLeft,c.clientWidth,c.clientHeight)});e.observe(c),p(()=>{e.disconnect(),s(),r.value=null})}}),S(()=>e.dataSource,e=>{if(e){let t=e;if(t.subscribe){let e=t.subscribe(()=>{r.value?.refresh()});p(()=>e())}}},{immediate:!0}),S(()=>e.highlighting,e=>{r.value?.highlight&&e&&r.value.highlight.updateOptions(e)});let{fillHandlePosition:j}=X({activeCell:t(()=>i.value.activeCell),selectionRange:t(()=>i.value.selectionRange),slots:t(()=>i.value.slots),columns:t(()=>e.columns),visibleColumnsWithIndices:s,columnPositions:l,columnWidths:u,rowHeight:e.rowHeight});return{containerRef:n,coreRef:r,state:i,slotsArray:m,totalHeaderHeight:o,columnPositions:l,columnWidths:u,totalWidth:d,fillHandlePosition:j,handleScroll:w,handleCellMouseDown:g,handleCellDoubleClick:_,handleFillHandleMouseDown:v,handleHeaderClick:y,handleKeyDown:b,handleWheel:x,handleFilterApply:T,handleFilterPopupClose:D,handleCellMouseEnter:O,handleCellMouseLeave:A,dragState:C,isCellSelected:K,isCellActive:U,isCellEditing:W,isCellInFillPreview:G,buildCellClasses:k}}const mt=(e,t)=>{let n=B(e,{getRowId:t.getRowId,debounceMs:t.debounceMs,useWorker:t.useWorker,parallelSort:t.parallelSort});return p(()=>{n.clear()}),{dataSource:n,updateRow:n.updateRow,addRows:n.addRows,removeRows:n.removeRows,updateCell:n.updateCell,clear:n.clear,getRowById:n.getRowById,getTotalRowCount:n.getTotalRowCount,flushTransactions:n.flushTransactions}};export{ft as GpGrid,ft as default,T as GridCore,O as buildCellClasses,A as calculateColumnPositions,N as createClientDataSource,F as createDataSourceFromArray,L as createInitialState,z as createMutableClientDataSource,V as createServerDataSource,ee as findColumnAtX,H as getCellValue,ne as getTotalWidth,ie as gridStyles,ae as injectStyles,se as isCellActive,ce as isCellEditing,le as isCellInFillPreview,ue as isCellSelected,de as isRowVisible,at as renderCell,ot as renderEditCell,tt as renderHeader,J as useAutoScroll,X as useFillHandle,Q as useFilterConditions,Z as useFilterPopup,pt as useGpGrid,mt as useGridData,q as useGridState,Y as useInputHandler};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gp-grid/vue",
3
3
  "description": "A high-performance Vue 3 data grid component with virtual scrolling, cell selection, sorting, filtering, and Excel-like editing",
4
- "version": "0.8.2",
4
+ "version": "0.9.0",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "nuxt3"
44
44
  ],
45
45
  "dependencies": {
46
- "@gp-grid/core": "0.8.2"
46
+ "@gp-grid/core": "0.9.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "vue": "^3.4.0"