@opencorestack/opengridx 0.1.5 → 0.1.7

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.
Files changed (130) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +9 -0
  3. package/dist/index.d.ts +6 -0
  4. package/dist/opengridx.css +1 -1
  5. package/dist/opengridx.es.js +319 -319
  6. package/dist/opengridx.es.js.map +1 -1
  7. package/dist/opengridx.umd.js +7 -7
  8. package/dist/opengridx.umd.js.map +1 -1
  9. package/docs/API_REFERENCE.md +177 -0
  10. package/docs/README.md +60 -0
  11. package/docs/components/cell.md +44 -0
  12. package/docs/components/column-group-header.md +57 -0
  13. package/docs/components/column-resize.md +63 -0
  14. package/docs/components/column-visibility.md +61 -0
  15. package/docs/components/datagrid.md +70 -0
  16. package/docs/components/filter-panel.md +26 -0
  17. package/docs/components/header.md +39 -0
  18. package/docs/components/pagination.md +34 -0
  19. package/docs/components/row.md +31 -0
  20. package/docs/components/toolbar.md +40 -0
  21. package/docs/components/tooltip.md +68 -0
  22. package/docs/customization/slots-api.md +227 -0
  23. package/docs/customization/theming.md +293 -0
  24. package/docs/features/aggregation-pivot.md +79 -0
  25. package/docs/features/cell-spanning.md +520 -0
  26. package/docs/features/clipboard.md +76 -0
  27. package/docs/features/custom-pagination.md +143 -0
  28. package/docs/features/data-source.md +72 -0
  29. package/docs/features/editing-reordering.md +99 -0
  30. package/docs/features/export-guide.md +434 -0
  31. package/docs/features/filtering.md +83 -0
  32. package/docs/features/infinite-scroll.md +87 -0
  33. package/docs/features/list-view.md +65 -0
  34. package/docs/features/loading-states.md +68 -0
  35. package/docs/features/master-detail.md +46 -0
  36. package/docs/features/pinning.md +67 -0
  37. package/docs/features/selection.md +70 -0
  38. package/docs/features/sorting-pagination.md +66 -0
  39. package/docs/features/state-persistence.md +67 -0
  40. package/docs/features/tree-data-grouping.md +67 -0
  41. package/docs/features/virtualization.md +188 -0
  42. package/docs/roadmap.md +71 -0
  43. package/lib/components/Cell/Cell.css +119 -0
  44. package/lib/components/Cell/Cell.tsx +264 -0
  45. package/lib/components/Cell/GridEditInputCell.css +62 -0
  46. package/lib/components/Cell/GridEditInputCell.tsx +152 -0
  47. package/lib/components/ColumnGroupHeader/ColumnGroupHeader.css +67 -0
  48. package/lib/components/ColumnGroupHeader/ColumnGroupHeader.tsx +220 -0
  49. package/lib/components/ColumnResizeHandle/ColumnResizeHandle.css +31 -0
  50. package/lib/components/ColumnResizeHandle/ColumnResizeHandle.tsx +85 -0
  51. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.css +137 -0
  52. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.tsx +190 -0
  53. package/lib/components/DataGrid/DataGrid.css +224 -0
  54. package/lib/components/DataGrid/DataGrid.tsx +2253 -0
  55. package/lib/components/DetailPanel/DetailPanel.css +36 -0
  56. package/lib/components/DetailPanel/DetailPanel.tsx +34 -0
  57. package/lib/components/FilterPanel/FilterPanel.css +196 -0
  58. package/lib/components/FilterPanel/FilterPanel.tsx +183 -0
  59. package/lib/components/FilterPanel/index.ts +1 -0
  60. package/lib/components/Header/ColumnMenu.css +68 -0
  61. package/lib/components/Header/ColumnMenu.tsx +249 -0
  62. package/lib/components/Header/Header.css +224 -0
  63. package/lib/components/Header/Header.tsx +516 -0
  64. package/lib/components/ListView/ListView.css +112 -0
  65. package/lib/components/ListView/ListViewRow.tsx +63 -0
  66. package/lib/components/Pagination/Pagination.css +91 -0
  67. package/lib/components/Pagination/Pagination.tsx +151 -0
  68. package/lib/components/QuickFilter/QuickFilter.css +23 -0
  69. package/lib/components/QuickFilter/QuickFilter.tsx +79 -0
  70. package/lib/components/Row/Row.css +126 -0
  71. package/lib/components/Row/Row.tsx +377 -0
  72. package/lib/components/Skeleton/Skeleton.css +55 -0
  73. package/lib/components/Skeleton/Skeleton.tsx +22 -0
  74. package/lib/components/SkeletonRow/SkeletonRow.css +32 -0
  75. package/lib/components/SkeletonRow/SkeletonRow.tsx +89 -0
  76. package/lib/components/SkeletonRow/index.ts +1 -0
  77. package/lib/components/Toolbar/GlobalSearch.css +113 -0
  78. package/lib/components/Toolbar/GlobalSearch.tsx +120 -0
  79. package/lib/components/Toolbar/GridToolbar.css +204 -0
  80. package/lib/components/Toolbar/GridToolbar.tsx +647 -0
  81. package/lib/components/Toolbar/PivotPanel.css +212 -0
  82. package/lib/components/Toolbar/PivotPanel.tsx +239 -0
  83. package/lib/components/Tooltip/Tooltip.css +59 -0
  84. package/lib/components/Tooltip/Tooltip.tsx +106 -0
  85. package/lib/components/ui/Button.css +89 -0
  86. package/lib/components/ui/Button.tsx +39 -0
  87. package/lib/components/ui/Checkbox.css +71 -0
  88. package/lib/components/ui/Checkbox.tsx +66 -0
  89. package/lib/components/ui/DragHandleIcon.css +19 -0
  90. package/lib/components/ui/DragHandleIcon.tsx +18 -0
  91. package/lib/components/ui/ExpandIcon.css +38 -0
  92. package/lib/components/ui/ExpandIcon.tsx +75 -0
  93. package/lib/components/ui/Input.css +59 -0
  94. package/lib/components/ui/Input.tsx +45 -0
  95. package/lib/components/ui/index.ts +15 -0
  96. package/lib/hooks/core/useDataGrid.ts +392 -0
  97. package/lib/hooks/core/useGridApiRef.ts +10 -0
  98. package/lib/hooks/features/useAggregation.ts +143 -0
  99. package/lib/hooks/features/useGridClipboard.ts +133 -0
  100. package/lib/hooks/features/useGridDataSource.ts +190 -0
  101. package/lib/hooks/features/useGridEditing.ts +100 -0
  102. package/lib/hooks/features/useGridSpanning.ts +349 -0
  103. package/lib/hooks/features/usePivot.ts +149 -0
  104. package/lib/hooks/useColumnReorder.ts +114 -0
  105. package/lib/hooks/useRowGrouping.ts +302 -0
  106. package/lib/hooks/useRowReorder.ts +83 -0
  107. package/lib/hooks/useTreeData.ts +323 -0
  108. package/lib/index.ts +106 -0
  109. package/lib/state/index.ts +17 -0
  110. package/lib/state/types.ts +48 -0
  111. package/lib/state/useGridStateStorage.ts +113 -0
  112. package/lib/styles/base/reset.css +21 -0
  113. package/lib/styles/base/variables.css +161 -0
  114. package/lib/styles/opengridx.css +27 -0
  115. package/lib/styles/opengridx.css.d.ts +4 -0
  116. package/lib/theme/DataGridThemeProvider.tsx +276 -0
  117. package/lib/theme/defaultStyles.ts +0 -0
  118. package/lib/theme/index.ts +21 -0
  119. package/lib/theme/presets.ts +148 -0
  120. package/lib/theme/types.ts +155 -0
  121. package/lib/types/index.ts +764 -0
  122. package/lib/utils/export/exportToExcelAdvanced.ts +516 -0
  123. package/lib/utils/export/index.ts +550 -0
  124. package/lib/utils/filtering/index.ts +240 -0
  125. package/lib/utils/pinning/index.ts +282 -0
  126. package/lib/utils/sorting/index.ts +55 -0
  127. package/lib/utils/virtualization/index.ts +106 -0
  128. package/lib/vite-env.d.ts +1 -0
  129. package/llms.txt +12 -2
  130. package/package.json +13 -4
@@ -0,0 +1,36 @@
1
+ .ogx__detail-panel {
2
+ display: flex;
3
+ background: var(--ogx-color-gray-50);
4
+ border-top: 1px solid var(--ogx-border-color);
5
+ border-bottom: 1px solid var(--ogx-border-color);
6
+ transition: height 0.2s ease-in-out;
7
+ position: relative;
8
+ min-width: fit-content;
9
+ width: 100%;
10
+ box-sizing: border-box;
11
+ }
12
+ .ogx__detail-panel-content {
13
+ padding: var(--ogx-spacing-md);
14
+ width: 100%;
15
+ min-width: 100%;
16
+ box-sizing: border-box;
17
+ }
18
+ @keyframes detailPanelExpand {
19
+ from {
20
+ opacity: 0;
21
+ transform: translateY(-10px);
22
+ }
23
+ to {
24
+ opacity: 1;
25
+ transform: translateY(0);
26
+ }
27
+ }
28
+ .ogx__detail-panel {
29
+ animation: detailPanelExpand 0.2s ease-out;
30
+ }
31
+ @media (prefers-color-scheme: dark) {
32
+ .ogx__detail-panel {
33
+ background: var(--ogx-color-gray-800);
34
+ border-color: var(--ogx-color-gray-700);
35
+ }
36
+ }
@@ -0,0 +1,34 @@
1
+
2
+ import React from 'react';
3
+ import type { GridRowModel, GridRowId, GridDetailPanelHeight } from '../../types';
4
+
5
+
6
+ export interface DetailPanelProps<R extends GridRowModel = GridRowModel> {
7
+ row: R;
8
+ rowId: GridRowId;
9
+ rowIndex: number;
10
+ content: React.ReactNode;
11
+ height: GridDetailPanelHeight;
12
+ isExpanded: boolean;
13
+ }
14
+
15
+ export function DetailPanel<R extends GridRowModel = GridRowModel>(props: DetailPanelProps<R>) {
16
+ const { content, height, isExpanded } = props;
17
+
18
+ if (!isExpanded) {
19
+ return null;
20
+ }
21
+
22
+ const style: React.CSSProperties = {
23
+ height: height === 'auto' ? 'auto' : `${height}px`,
24
+ overflow: height === 'auto' ? 'visible' : 'auto'
25
+ };
26
+
27
+ return (
28
+ <div className="ogx__detail-panel" style={style}>
29
+ <div className="ogx__detail-panel-content">
30
+ {content}
31
+ </div>
32
+ </div>
33
+ );
34
+ }
@@ -0,0 +1,196 @@
1
+ .ogx-filter__logic-bar {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 6px;
5
+ padding: 8px var(--ogx-spacing-md);
6
+ border-bottom: var(--ogx-border-width-thin) solid var(--ogx-grid-border-color);
7
+ background: var(--ogx-grid-header-background);
8
+ }
9
+ .ogx-filter__logic-label {
10
+ font-family: var(--ogx-font-family);
11
+ font-size: var(--ogx-font-size-xs);
12
+ font-weight: 500;
13
+ color: var(--ogx-grid-header-text);
14
+ margin-right: 2px;
15
+ }
16
+ .ogx-filter__logic-pill {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ padding: 3px 8px;
20
+ border: var(--ogx-border-width-thin) solid var(--ogx-border-color);
21
+ border-radius: 999px;
22
+ background: transparent;
23
+ color: var(--ogx-grid-row-text);
24
+ font-family: var(--ogx-font-family-mono, monospace);
25
+ font-size: 10px;
26
+ font-weight: 500;
27
+ letter-spacing: 0.04em;
28
+ text-transform: uppercase;
29
+ cursor: pointer;
30
+ transition: background 0.15s, border-color 0.15s, color 0.15s;
31
+ line-height: 1;
32
+ }
33
+ .ogx-filter__logic-pill:hover {
34
+ border-color: var(--ogx-color-primary);
35
+ color: var(--ogx-color-primary);
36
+ }
37
+ .ogx-filter__logic-pill--active {
38
+ background: var(--ogx-toolbar-chip-active-bg, var(--ogx-color-primary));
39
+ border-color: var(--ogx-toolbar-chip-active-bg, var(--ogx-color-primary));
40
+ color: var(--ogx-toolbar-chip-active-text, #fff);
41
+ font-weight: 700;
42
+ }
43
+ .ogx-filter__row {
44
+ display: flex;
45
+ align-items: center;
46
+ gap: var(--ogx-spacing-sm);
47
+ padding: 8px var(--ogx-spacing-md);
48
+ border-bottom: var(--ogx-border-width-thin) solid var(--ogx-grid-border-color);
49
+ transition: background 0.1s;
50
+ min-height: 44px;
51
+ }
52
+ .ogx-filter__row:last-child {
53
+ border-bottom: none;
54
+ }
55
+ .ogx-filter__row:hover {
56
+ background: var(--ogx-grid-row-hover-background);
57
+ }
58
+ .ogx-filter__row--active {
59
+ background: var(--ogx-overlay-item-selected-bg, rgba(25, 118, 210, 0.04));
60
+ }
61
+ .ogx-filter__row--active:hover {
62
+ background: var(--ogx-overlay-item-selected-bg, rgba(25, 118, 210, 0.07));
63
+ opacity: 0.9;
64
+ }
65
+ .ogx-filter__col-label {
66
+ flex: 0 0 140px;
67
+ font-family: var(--ogx-font-family);
68
+ font-size: var(--ogx-font-size-xs);
69
+ font-weight: 500;
70
+ color: var(--ogx-grid-row-text);
71
+ overflow: hidden;
72
+ text-overflow: ellipsis;
73
+ white-space: nowrap;
74
+ }
75
+ .ogx-filter__controls {
76
+ display: flex;
77
+ align-items: center;
78
+ gap: 6px;
79
+ flex: 1;
80
+ }
81
+ .ogx-filter__op-select {
82
+ padding: 5px 24px 5px 8px;
83
+ border: var(--ogx-border-width-thin) solid var(--ogx-border-color);
84
+ border-radius: var(--ogx-border-radius-sm);
85
+ font-family: var(--ogx-font-family-mono, monospace);
86
+ font-size: 11px;
87
+ font-weight: 600;
88
+ text-transform: uppercase;
89
+ letter-spacing: 0.04em;
90
+ background: var(--ogx-grid-background);
91
+ color: var(--ogx-grid-row-text);
92
+ cursor: pointer;
93
+ outline: none;
94
+ transition: border-color 0.15s;
95
+ appearance: none;
96
+ -webkit-appearance: none;
97
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
98
+ background-repeat: no-repeat;
99
+ background-position: right 6px center;
100
+ min-width: 130px;
101
+ }
102
+ .ogx-filter__op-select:focus-visible {
103
+ border-color: var(--ogx-color-primary);
104
+ }
105
+ .ogx-filter__op-select--active {
106
+ border-color: var(--ogx-toolbar-input-focus-border, var(--ogx-color-primary));
107
+ color: var(--ogx-color-primary);
108
+ font-weight: 700;
109
+ }
110
+ .ogx-filter__value-input {
111
+ flex: 1;
112
+ min-width: 60px;
113
+ padding: 4px 8px;
114
+ border: var(--ogx-border-width-thin) solid var(--ogx-border-color);
115
+ border-radius: var(--ogx-border-radius-sm);
116
+ font-family: var(--ogx-font-family);
117
+ font-size: var(--ogx-font-size-xs);
118
+ background: var(--ogx-grid-background);
119
+ color: var(--ogx-grid-row-text);
120
+ outline: none;
121
+ transition: border-color 0.15s, box-shadow 0.15s;
122
+ }
123
+ .ogx-filter__value-input::placeholder {
124
+ color: var(--ogx-overlay-text, var(--ogx-color-gray-400));
125
+ opacity: 0.6;
126
+ }
127
+ .ogx-filter__value-input:focus {
128
+ border-color: var(--ogx-toolbar-input-focus-border, var(--ogx-color-primary));
129
+ box-shadow: var(--ogx-toolbar-input-focus-shadow, 0 0 0 2px rgba(25, 118, 210, 0.15));
130
+ }
131
+ .ogx-filter__value-input--active {
132
+ border-color: var(--ogx-color-primary);
133
+ }
134
+ .ogx-filter__value-select {
135
+ flex: 1;
136
+ appearance: none;
137
+ -webkit-appearance: none;
138
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
139
+ background-repeat: no-repeat;
140
+ background-position: right 10px center;
141
+ padding-right: 28px;
142
+ cursor: pointer;
143
+ }
144
+ .ogx-filter__row-clear {
145
+ display: inline-flex;
146
+ align-items: center;
147
+ justify-content: center;
148
+ width: 22px;
149
+ height: 22px;
150
+ padding: 0;
151
+ border: none;
152
+ border-radius: 50%;
153
+ background: transparent;
154
+ color: var(--ogx-overlay-text, var(--ogx-color-gray-400));
155
+ font-size: 16px;
156
+ line-height: 1;
157
+ cursor: pointer;
158
+ flex-shrink: 0;
159
+ transition: background 0.15s, color 0.15s;
160
+ }
161
+ .ogx-filter__row-clear:hover {
162
+ background: var(--ogx-toolbar-btn-danger-bg, rgba(239, 68, 68, 0.08));
163
+ color: var(--ogx-toolbar-btn-danger-text, #ef4444);
164
+ }
165
+ .ogx-filter__empty {
166
+ padding: var(--ogx-spacing-md);
167
+ font-family: var(--ogx-font-family);
168
+ font-size: var(--ogx-font-size-sm);
169
+ color: var(--ogx-overlay-text, var(--ogx-color-gray-400));
170
+ opacity: 0.7;
171
+ text-align: center;
172
+ }
173
+ .ogx-toolbar__panel--filter {
174
+ width: 640px;
175
+ max-width: calc(100vw - 24px);
176
+ }
177
+ .ogx-toolbar__panel-body--filter {
178
+ max-height: 420px;
179
+ overflow-y: auto;
180
+ padding: 0;
181
+ }
182
+ .ogx-toolbar__panel-count {
183
+ display: inline-flex;
184
+ align-items: center;
185
+ justify-content: center;
186
+ min-width: 18px;
187
+ height: 18px;
188
+ padding: 0 5px;
189
+ border-radius: 999px;
190
+ background: var(--ogx-toolbar-btn-primary-bg, var(--ogx-color-primary));
191
+ color: var(--ogx-toolbar-btn-primary-text, #fff);
192
+ font-size: 10px;
193
+ font-weight: 700;
194
+ line-height: 1;
195
+ margin-left: 4px;
196
+ }
@@ -0,0 +1,183 @@
1
+ import React, { useCallback } from 'react';
2
+ import type {
3
+ GridFilterModel,
4
+ GridFilterItem,
5
+ GridColDef,
6
+ GridFilterOperator
7
+ } from '../../types';
8
+ import { getOperatorsForType } from '../../utils/filtering';
9
+
10
+
11
+ interface FilterPanelProps {
12
+ filterModel: GridFilterModel;
13
+ columns: GridColDef[];
14
+ onFilterModelChange: (model: GridFilterModel) => void;
15
+ }
16
+
17
+ const NO_VALUE_OPERATORS = new Set(['isEmpty', 'isNotEmpty']);
18
+
19
+ function getActiveFilter(items: GridFilterItem[], field: string): GridFilterItem | undefined {
20
+ return items.find(item => 'field' in item && item.field === field) as GridFilterItem | undefined;
21
+ }
22
+
23
+ const FilterRow: React.FC<{
24
+ col: GridColDef;
25
+ item: GridFilterItem | undefined;
26
+ onChange: (item: GridFilterItem | null) => void;
27
+ }> = ({ col, item, onChange }) => {
28
+ const operators = getOperatorsForType(col.type);
29
+ const isActive = !!item;
30
+ const currentOperator = item?.operator ?? operators[0];
31
+
32
+ const handleOperatorChange = (op: string) => {
33
+ const noValue = NO_VALUE_OPERATORS.has(op);
34
+ const newItem: GridFilterItem = {
35
+ id: item?.id ?? `${col.field}-${Date.now()}`,
36
+ field: col.field,
37
+ operator: op as GridFilterOperator,
38
+ value: noValue ? undefined : (item?.value ?? (col.type === 'boolean' ? 'true' : '')),
39
+ };
40
+ onChange(newItem);
41
+ };
42
+
43
+ const handleValueChange = (value: string) => {
44
+ onChange({
45
+ id: item?.id ?? `${col.field}-${Date.now()}`,
46
+ field: col.field,
47
+ operator: currentOperator as GridFilterOperator,
48
+ value,
49
+ });
50
+ };
51
+
52
+ const handleClear = () => {
53
+ onChange(null);
54
+ };
55
+
56
+ const isNoValue = NO_VALUE_OPERATORS.has(String(currentOperator));
57
+ const isBoolean = col.type === 'boolean';
58
+ const showValue = !isNoValue;
59
+
60
+ return (
61
+ <div className={`ogx-filter__row${isActive ? ' ogx-filter__row--active' : ''}`}>
62
+ { }
63
+ <span className="ogx-filter__col-label" title={col.field}>
64
+ {col.headerName || col.field}
65
+ </span>
66
+
67
+ { }
68
+ <div className="ogx-filter__controls">
69
+ { }
70
+ <select
71
+ id={`ogx-filter-op-${col.field}`}
72
+ name={`filter-op-${col.field}`}
73
+ className={`ogx-filter__op-select${isActive ? ' ogx-filter__op-select--active' : ''}`}
74
+ value={String(currentOperator)}
75
+ onChange={(e) => handleOperatorChange(e.target.value)}
76
+ aria-label={`Filter operator for ${col.headerName || col.field}`}
77
+ >
78
+ {operators.map(op => (
79
+ <option key={op} value={op}>{op}</option>
80
+ ))}
81
+ </select>
82
+
83
+ { }
84
+ {showValue && isBoolean && (
85
+ <select
86
+ id={`ogx-filter-val-${col.field}`}
87
+ name={`filter-val-${col.field}`}
88
+ className={`ogx-filter__value-input ogx-filter__value-select${isActive ? ' ogx-filter__value-input--active' : ''}`}
89
+ value={String(item?.value ?? 'true')}
90
+ onChange={(e) => handleValueChange(e.target.value)}
91
+ aria-label={`Filter value for ${col.headerName || col.field}`}
92
+ >
93
+ <option value="true">true</option>
94
+ <option value="false">false</option>
95
+ </select>
96
+ )}
97
+
98
+ {showValue && !isBoolean && (
99
+ <input
100
+ id={`ogx-filter-val-${col.field}`}
101
+ name={`filter-val-${col.field}`}
102
+ className={`ogx-filter__value-input${isActive ? ' ogx-filter__value-input--active' : ''}`}
103
+ type={col.type === 'number' ? 'number' : 'text'}
104
+ value={item?.value ?? ''}
105
+ onChange={(e) => handleValueChange(e.target.value)}
106
+ placeholder="Value…"
107
+ aria-label={`Filter value for ${col.headerName || col.field}`}
108
+ />
109
+ )}
110
+
111
+ {/* Clear button — only when active */}
112
+ {isActive && (
113
+ <button
114
+ className="ogx-filter__row-clear"
115
+ onClick={handleClear}
116
+ aria-label={`Clear filter for ${col.headerName || col.field}`}
117
+ title="Clear"
118
+ >
119
+ ×
120
+ </button>
121
+ )}
122
+ </div>
123
+ </div>
124
+ );
125
+ };
126
+
127
+ // ── Root panel ────────────────────────────────────────────────────────────────
128
+
129
+ export const FilterPanel: React.FC<FilterPanelProps> = ({ filterModel, columns, onFilterModelChange }) => {
130
+ const items: GridFilterItem[] = (filterModel.items ?? []) as GridFilterItem[];
131
+ const logicOperator = filterModel.logicOperator ?? 'and';
132
+
133
+ const handleItemChange = useCallback((field: string, newItem: GridFilterItem | null) => {
134
+ const rest = items.filter(i => 'field' in i && (i as GridFilterItem).field !== field);
135
+ const next: GridFilterItem[] = newItem ? [...rest, newItem] : rest;
136
+ onFilterModelChange({ ...filterModel, items: next });
137
+ }, [items, filterModel, onFilterModelChange]);
138
+
139
+ const handleLogicChange = useCallback((op: 'and' | 'or') => {
140
+ onFilterModelChange({ ...filterModel, logicOperator: op });
141
+ }, [filterModel, onFilterModelChange]);
142
+
143
+ const filterableColumns = columns.filter(col => col.filterable !== false);
144
+
145
+ return (
146
+ <>
147
+ { }
148
+ {items.length > 1 && (
149
+ <div className="ogx-filter__logic-bar">
150
+ <span className="ogx-filter__logic-label">Match:</span>
151
+ <button
152
+ className={`ogx-filter__logic-pill${logicOperator === 'and' ? ' ogx-filter__logic-pill--active' : ''}`}
153
+ onClick={() => handleLogicChange('and')}
154
+ aria-pressed={logicOperator === 'and'}
155
+ >
156
+ ALL (AND)
157
+ </button>
158
+ <button
159
+ className={`ogx-filter__logic-pill${logicOperator === 'or' ? ' ogx-filter__logic-pill--active' : ''}`}
160
+ onClick={() => handleLogicChange('or')}
161
+ aria-pressed={logicOperator === 'or'}
162
+ >
163
+ ANY (OR)
164
+ </button>
165
+ </div>
166
+ )}
167
+
168
+ { }
169
+ {filterableColumns.length === 0 ? (
170
+ <div className="ogx-filter__empty">No filterable columns.</div>
171
+ ) : (
172
+ filterableColumns.map(col => (
173
+ <FilterRow
174
+ key={col.field}
175
+ col={col}
176
+ item={getActiveFilter(items, col.field)}
177
+ onChange={(item) => handleItemChange(col.field, item)}
178
+ />
179
+ ))
180
+ )}
181
+ </>
182
+ );
183
+ };
@@ -0,0 +1 @@
1
+ export * from './FilterPanel';
@@ -0,0 +1,68 @@
1
+ .ogx-column-menu {
2
+ position: fixed;
3
+ background: var(--ogx-overlay-background, #fff);
4
+ box-shadow: var(--ogx-overlay-shadow, 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.06));
5
+ border-radius: var(--ogx-border-radius-md, 8px);
6
+ padding: 4px 0;
7
+ min-width: 190px;
8
+ z-index: 1300;
9
+ }
10
+ .ogx-menu-section-label {
11
+ padding: 6px 14px 2px;
12
+ font-family: var(--ogx-font-family, system-ui, sans-serif);
13
+ font-size: 11px;
14
+ font-weight: 600;
15
+ text-transform: uppercase;
16
+ letter-spacing: 0.06em;
17
+ color: var(--ogx-color-gray-400, #94a3b8);
18
+ user-select: none;
19
+ }
20
+ .ogx-menu-item {
21
+ display: flex;
22
+ align-items: center;
23
+ width: 100%;
24
+ padding: 7px 14px;
25
+ border: none;
26
+ background: transparent;
27
+ cursor: pointer;
28
+ font-family: var(--ogx-font-family, system-ui, sans-serif);
29
+ font-size: var(--ogx-font-size-xs);
30
+ color: var(--ogx-overlay-text, #334155);
31
+ text-align: left;
32
+ gap: 6px;
33
+ transition: background 0.1s;
34
+ }
35
+ .ogx-menu-item:hover {
36
+ background: var(--ogx-overlay-item-hover-bg, #f8fafc);
37
+ color: var(--ogx-overlay-item-hover-text, #0f172a);
38
+ }
39
+ .ogx-menu-item--active {
40
+ color: var(--ogx-overlay-item-selected-text, #1976d2);
41
+ font-weight: 600;
42
+ }
43
+ .ogx-menu-item--active:hover {
44
+ background: var(--ogx-overlay-item-selected-bg, rgba(25, 118, 210, 0.05));
45
+ }
46
+ .ogx-menu-item__indicator {
47
+ flex: 0 0 14px;
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ color: var(--ogx-overlay-item-selected-text, #1976d2);
52
+ }
53
+ .ogx-menu-item__icon {
54
+ flex: 0 0 16px;
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ color: var(--ogx-color-gray-400, #94a3b8);
59
+ transition: color 0.1s;
60
+ }
61
+ .ogx-menu-item--active .ogx-menu-item__icon {
62
+ color: var(--ogx-color-primary, #1976d2);
63
+ }
64
+ .ogx-menu-divider {
65
+ height: 1px;
66
+ background: var(--ogx-overlay-border, #e2e8f0);
67
+ margin: 4px 0;
68
+ }