@open-grid/vue-ui 0.1.0 → 0.2.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/README.md +6 -0
- package/dist/index.css +5 -0
- package/dist/index.d.ts +90 -12
- package/dist/index.js +122 -75
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@ Use this package for the reference Vue grid UI, including sorting, filtering, se
|
|
|
8
8
|
|
|
9
9
|
Use Vue's `class` attribute, `getRowClassName(row)`, `getHeaderClassName(context)`, and `getCellClassName(context)` to attach product-owned root, row, header, and cell classes for status, risk, or workflow styling without replacing the renderer. Header contexts include the grid, column, and header; cell contexts also include the row and current value.
|
|
10
10
|
|
|
11
|
+
Use `renderHeader` and `renderCell` for framework-native VNodes, `renderToolbar` for
|
|
12
|
+
product commands, and the state render callbacks for component-based loading,
|
|
13
|
+
error, and empty content. See the
|
|
14
|
+
[custom rendering](https://goatshave.github.io/open-grid/custom-rendering) and
|
|
15
|
+
[composition](https://goatshave.github.io/open-grid/composition) guides.
|
|
16
|
+
|
|
11
17
|
## Install
|
|
12
18
|
|
|
13
19
|
```bash
|
package/dist/index.css
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { DefineComponent, PropType, VNodeChild, VNode } from 'vue';
|
|
3
|
-
import { GridOptions, Grid, Row, HeaderContext, CellContext,
|
|
3
|
+
import { GridOptions, Grid, Row, Column, HeaderContext, CellContext, CellFillOptions, ClipboardPasteResult, ClipboardPasteOptions, ExportFile } from '@open-grid/core';
|
|
4
4
|
export { AccessorColumnOptions, AccessorFnColumnDef, AccessorKey, AccessorKeyColumnDef, AnyColumnDef, CellContext, CellCoordinate, CellEditEvent, CellEditEventParams, CellEditHistoryAction, CellEditHistoryState, CellEditOption, CellEditParserContext, CellEditPhase, CellEditValidationContext, CellEditValidationResult, CellEditValidationState, CellEditingState, CellFillOptions, CellInteractionEvent, CellInteractionEventParams, CellRange, CellRangeSelectionState, ClipboardCellContext, ClipboardCopyOptions, ClipboardPasteCellContext, ClipboardPasteCommittedCell, ClipboardPasteOptions, ClipboardPasteResult, ClipboardPasteSkippedCell, ClipboardPasteSkippedReason, ClipboardPasteValidationError, Column, ColumnDef, ColumnFilter, ColumnFiltersState, ColumnHelper, ColumnId, ColumnMovePosition, ColumnOrderState, ColumnPinningPosition, ColumnPinningState, ColumnResizeEvent, ColumnResizeEventParams, ColumnResizePhase, ColumnSizingState, ColumnVisibilityState, DisplayColumnDef, ExpandedState, ExportFile, ExportFileOptions, FilterFn, FitColumnsToWidthOptions, Grid, GridCacheDiagnostics, GridCacheDiagnosticsEntry, GridCacheKey, GridOptions, GridState, GroupColumnDef, GroupingState, Header, HeaderContext, HeaderGroup, MoveFocusOptions, PaginationState, Row, RowId, RowInteractionEvent, RowInteractionEventParams, RowModel, RowSelectionCleanupScope, RowSelectionState, SortFn, SortingRule, SortingState, Updater, fitColumnsToWidth } from '@open-grid/core';
|
|
5
|
-
import { ColumnVirtualizationPrimitiveOptions, GridDensity, RowVirtualizationPrimitiveOptions } from '@open-grid/primitives';
|
|
6
|
-
export { GRID_PREFERENCES_VERSION, GridDensity, GridPreferences, GridPreferencesOptions, GridPreferencesState, GridPreferencesStorageEnvironmentLike, GridPreferencesStorageLike, createGridPreferences, getBrowserGridPreferencesStorage, parseGridPreferences, readGridPreferences, removeGridPreferences, serializeGridPreferences, writeGridPreferences } from '@open-grid/primitives';
|
|
5
|
+
import { ColumnVirtualizationPrimitiveOptions, GridLocalizationOverrides, GridDensity, RowVirtualizationPrimitiveOptions, GridLocalization } from '@open-grid/primitives';
|
|
6
|
+
export { DEFAULT_GRID_LOCALIZATION, GRID_PREFERENCES_VERSION, GridDensity, GridLocalization, GridLocalizationOverrides, GridPreferences, GridPreferencesMigration, GridPreferencesOptions, GridPreferencesParseOptions, GridPreferencesState, GridPreferencesStorageEnvironmentLike, GridPreferencesStorageLike, createGridLocalization, createGridPreferences, getBrowserGridPreferencesStorage, migrateGridPreferences, parseGridPreferences, readGridPreferences, removeGridPreferences, serializeGridPreferences, writeGridPreferences } from '@open-grid/primitives';
|
|
7
7
|
export { createColumnHelper, useGrid } from '@open-grid/vue';
|
|
8
8
|
|
|
9
|
+
interface DataGridRenderContext<TData> {
|
|
10
|
+
grid: Grid<TData>;
|
|
11
|
+
rows: readonly Row<TData>[];
|
|
12
|
+
visibleColumns: readonly Column<TData, unknown>[];
|
|
13
|
+
}
|
|
14
|
+
interface DataGridErrorRenderContext<TData> extends DataGridRenderContext<TData> {
|
|
15
|
+
retry: (() => void) | undefined;
|
|
16
|
+
}
|
|
9
17
|
interface DataGridProps<TData> {
|
|
10
18
|
ariaLabel?: string;
|
|
19
|
+
localization?: GridLocalizationOverrides;
|
|
11
20
|
options: GridOptions<TData>;
|
|
12
21
|
emptyState?: VNodeChild;
|
|
13
22
|
error?: boolean;
|
|
@@ -15,6 +24,12 @@ interface DataGridProps<TData> {
|
|
|
15
24
|
onRetry?: () => void;
|
|
16
25
|
loading?: boolean;
|
|
17
26
|
loadingState?: VNodeChild;
|
|
27
|
+
renderToolbar?: (context: DataGridRenderContext<TData>) => VNodeChild;
|
|
28
|
+
renderEmptyState?: (context: DataGridRenderContext<TData>) => VNodeChild;
|
|
29
|
+
renderLoadingState?: (context: DataGridRenderContext<TData>) => VNodeChild;
|
|
30
|
+
renderErrorState?: (context: DataGridErrorRenderContext<TData>) => VNodeChild;
|
|
31
|
+
renderHeader?: (context: HeaderContext<TData, unknown>) => VNodeChild;
|
|
32
|
+
renderCell?: (context: CellContext<TData, unknown>) => VNodeChild;
|
|
18
33
|
onGridReady?: GridReadyHandler<TData>;
|
|
19
34
|
getRowClassName?: (row: Row<TData>) => string | undefined;
|
|
20
35
|
getHeaderClassName?: (context: HeaderContext<TData, unknown>) => string | undefined;
|
|
@@ -83,7 +98,11 @@ type HeaderActionMenuItems<TData> = (context: HeaderActionMenuContext<TData>) =>
|
|
|
83
98
|
declare const DataGrid: DefineComponent<vue.ExtractPropTypes<{
|
|
84
99
|
ariaLabel: {
|
|
85
100
|
type: StringConstructor;
|
|
86
|
-
default:
|
|
101
|
+
default: undefined;
|
|
102
|
+
};
|
|
103
|
+
localization: {
|
|
104
|
+
type: PropType<GridLocalizationOverrides>;
|
|
105
|
+
default: undefined;
|
|
87
106
|
};
|
|
88
107
|
options: {
|
|
89
108
|
type: PropType<GridOptions<unknown>>;
|
|
@@ -91,7 +110,7 @@ declare const DataGrid: DefineComponent<vue.ExtractPropTypes<{
|
|
|
91
110
|
};
|
|
92
111
|
emptyState: {
|
|
93
112
|
type: PropType<VNodeChild>;
|
|
94
|
-
default:
|
|
113
|
+
default: undefined;
|
|
95
114
|
};
|
|
96
115
|
error: {
|
|
97
116
|
type: BooleanConstructor;
|
|
@@ -99,7 +118,7 @@ declare const DataGrid: DefineComponent<vue.ExtractPropTypes<{
|
|
|
99
118
|
};
|
|
100
119
|
errorState: {
|
|
101
120
|
type: PropType<VNodeChild>;
|
|
102
|
-
default:
|
|
121
|
+
default: undefined;
|
|
103
122
|
};
|
|
104
123
|
onRetry: {
|
|
105
124
|
type: PropType<() => void>;
|
|
@@ -111,7 +130,31 @@ declare const DataGrid: DefineComponent<vue.ExtractPropTypes<{
|
|
|
111
130
|
};
|
|
112
131
|
loadingState: {
|
|
113
132
|
type: PropType<VNodeChild>;
|
|
114
|
-
default:
|
|
133
|
+
default: undefined;
|
|
134
|
+
};
|
|
135
|
+
renderToolbar: {
|
|
136
|
+
type: PropType<(context: DataGridRenderContext<unknown>) => VNodeChild>;
|
|
137
|
+
default: undefined;
|
|
138
|
+
};
|
|
139
|
+
renderEmptyState: {
|
|
140
|
+
type: PropType<(context: DataGridRenderContext<unknown>) => VNodeChild>;
|
|
141
|
+
default: undefined;
|
|
142
|
+
};
|
|
143
|
+
renderLoadingState: {
|
|
144
|
+
type: PropType<(context: DataGridRenderContext<unknown>) => VNodeChild>;
|
|
145
|
+
default: undefined;
|
|
146
|
+
};
|
|
147
|
+
renderErrorState: {
|
|
148
|
+
type: PropType<(context: DataGridErrorRenderContext<unknown>) => VNodeChild>;
|
|
149
|
+
default: undefined;
|
|
150
|
+
};
|
|
151
|
+
renderHeader: {
|
|
152
|
+
type: PropType<(context: HeaderContext<unknown, unknown>) => VNodeChild>;
|
|
153
|
+
default: undefined;
|
|
154
|
+
};
|
|
155
|
+
renderCell: {
|
|
156
|
+
type: PropType<(context: CellContext<unknown, unknown>) => VNodeChild>;
|
|
157
|
+
default: undefined;
|
|
115
158
|
};
|
|
116
159
|
onGridReady: {
|
|
117
160
|
type: PropType<GridReadyHandler<unknown>>;
|
|
@@ -210,7 +253,11 @@ declare const DataGrid: DefineComponent<vue.ExtractPropTypes<{
|
|
|
210
253
|
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
211
254
|
ariaLabel: {
|
|
212
255
|
type: StringConstructor;
|
|
213
|
-
default:
|
|
256
|
+
default: undefined;
|
|
257
|
+
};
|
|
258
|
+
localization: {
|
|
259
|
+
type: PropType<GridLocalizationOverrides>;
|
|
260
|
+
default: undefined;
|
|
214
261
|
};
|
|
215
262
|
options: {
|
|
216
263
|
type: PropType<GridOptions<unknown>>;
|
|
@@ -218,7 +265,7 @@ declare const DataGrid: DefineComponent<vue.ExtractPropTypes<{
|
|
|
218
265
|
};
|
|
219
266
|
emptyState: {
|
|
220
267
|
type: PropType<VNodeChild>;
|
|
221
|
-
default:
|
|
268
|
+
default: undefined;
|
|
222
269
|
};
|
|
223
270
|
error: {
|
|
224
271
|
type: BooleanConstructor;
|
|
@@ -226,7 +273,7 @@ declare const DataGrid: DefineComponent<vue.ExtractPropTypes<{
|
|
|
226
273
|
};
|
|
227
274
|
errorState: {
|
|
228
275
|
type: PropType<VNodeChild>;
|
|
229
|
-
default:
|
|
276
|
+
default: undefined;
|
|
230
277
|
};
|
|
231
278
|
onRetry: {
|
|
232
279
|
type: PropType<() => void>;
|
|
@@ -238,7 +285,31 @@ declare const DataGrid: DefineComponent<vue.ExtractPropTypes<{
|
|
|
238
285
|
};
|
|
239
286
|
loadingState: {
|
|
240
287
|
type: PropType<VNodeChild>;
|
|
241
|
-
default:
|
|
288
|
+
default: undefined;
|
|
289
|
+
};
|
|
290
|
+
renderToolbar: {
|
|
291
|
+
type: PropType<(context: DataGridRenderContext<unknown>) => VNodeChild>;
|
|
292
|
+
default: undefined;
|
|
293
|
+
};
|
|
294
|
+
renderEmptyState: {
|
|
295
|
+
type: PropType<(context: DataGridRenderContext<unknown>) => VNodeChild>;
|
|
296
|
+
default: undefined;
|
|
297
|
+
};
|
|
298
|
+
renderLoadingState: {
|
|
299
|
+
type: PropType<(context: DataGridRenderContext<unknown>) => VNodeChild>;
|
|
300
|
+
default: undefined;
|
|
301
|
+
};
|
|
302
|
+
renderErrorState: {
|
|
303
|
+
type: PropType<(context: DataGridErrorRenderContext<unknown>) => VNodeChild>;
|
|
304
|
+
default: undefined;
|
|
305
|
+
};
|
|
306
|
+
renderHeader: {
|
|
307
|
+
type: PropType<(context: HeaderContext<unknown, unknown>) => VNodeChild>;
|
|
308
|
+
default: undefined;
|
|
309
|
+
};
|
|
310
|
+
renderCell: {
|
|
311
|
+
type: PropType<(context: CellContext<unknown, unknown>) => VNodeChild>;
|
|
312
|
+
default: undefined;
|
|
242
313
|
};
|
|
243
314
|
onGridReady: {
|
|
244
315
|
type: PropType<GridReadyHandler<unknown>>;
|
|
@@ -334,12 +405,19 @@ declare const DataGrid: DefineComponent<vue.ExtractPropTypes<{
|
|
|
334
405
|
};
|
|
335
406
|
}>> & Readonly<{}>, {
|
|
336
407
|
ariaLabel: string;
|
|
408
|
+
localization: Partial<GridLocalization>;
|
|
337
409
|
emptyState: VNodeChild;
|
|
338
410
|
error: boolean;
|
|
339
411
|
errorState: VNodeChild;
|
|
340
412
|
onRetry: () => void;
|
|
341
413
|
loading: boolean;
|
|
342
414
|
loadingState: VNodeChild;
|
|
415
|
+
renderToolbar: (context: DataGridRenderContext<unknown>) => VNodeChild;
|
|
416
|
+
renderEmptyState: (context: DataGridRenderContext<unknown>) => VNodeChild;
|
|
417
|
+
renderLoadingState: (context: DataGridRenderContext<unknown>) => VNodeChild;
|
|
418
|
+
renderErrorState: (context: DataGridErrorRenderContext<unknown>) => VNodeChild;
|
|
419
|
+
renderHeader: (context: HeaderContext<unknown, unknown>) => VNodeChild;
|
|
420
|
+
renderCell: (context: CellContext<unknown, unknown>) => VNodeChild;
|
|
343
421
|
onGridReady: GridReadyHandler<unknown>;
|
|
344
422
|
getRowClassName: (row: Row<unknown>) => string | undefined;
|
|
345
423
|
getHeaderClassName: (context: HeaderContext<unknown, unknown>) => string | undefined;
|
|
@@ -367,4 +445,4 @@ declare const DataGrid: DefineComponent<vue.ExtractPropTypes<{
|
|
|
367
445
|
declare function createDataGrid<TData>(): DataGridComponent<TData>;
|
|
368
446
|
declare function downloadExportFile(file: ExportFile): boolean;
|
|
369
447
|
|
|
370
|
-
export { type ColumnVirtualizationOptions, DataGrid, type DataGridComponent, type DataGridProps, type GridReadyHandler, type HeaderActionMenuActionItem, type HeaderActionMenuContext, type HeaderActionMenuCustomItem, type HeaderActionMenuItem, type HeaderActionMenuItems, type HeaderActionMenuLabelItem, type HeaderActionMenuSeparatorItem, type RowVirtualizationOptions, createDataGrid, downloadExportFile };
|
|
448
|
+
export { type ColumnVirtualizationOptions, DataGrid, type DataGridComponent, type DataGridErrorRenderContext, type DataGridProps, type DataGridRenderContext, type GridReadyHandler, type HeaderActionMenuActionItem, type HeaderActionMenuContext, type HeaderActionMenuCustomItem, type HeaderActionMenuItem, type HeaderActionMenuItems, type HeaderActionMenuLabelItem, type HeaderActionMenuSeparatorItem, type RowVirtualizationOptions, createDataGrid, downloadExportFile };
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,9 @@ import {
|
|
|
5
5
|
addPointerMoveUpListeners,
|
|
6
6
|
applyResizeObserverMeasuredSizes,
|
|
7
7
|
createClickSuppressionController,
|
|
8
|
+
createGridLocalization,
|
|
8
9
|
createResizeObserver,
|
|
9
10
|
disconnectResizeObserver,
|
|
10
|
-
GROUPING_PANEL_EMPTY_MESSAGE,
|
|
11
|
-
HEADER_ACTION_MENU_TRIGGER_TEXT,
|
|
12
11
|
getCellEditorProps,
|
|
13
12
|
getCellEditorEventValue,
|
|
14
13
|
getCellEditorKeyboardAction,
|
|
@@ -203,9 +202,12 @@ import { createMeasuredSizeCache, createMeasuredSizeResolver, getColumnCellRende
|
|
|
203
202
|
import { defineComponent, Fragment, h, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
204
203
|
import { fitColumnsToWidth } from "@open-grid/core";
|
|
205
204
|
import {
|
|
205
|
+
DEFAULT_GRID_LOCALIZATION,
|
|
206
206
|
GRID_PREFERENCES_VERSION,
|
|
207
|
+
createGridLocalization as createGridLocalization2,
|
|
207
208
|
createGridPreferences,
|
|
208
209
|
getBrowserGridPreferencesStorage,
|
|
210
|
+
migrateGridPreferences,
|
|
209
211
|
parseGridPreferences,
|
|
210
212
|
readGridPreferences,
|
|
211
213
|
removeGridPreferences,
|
|
@@ -218,7 +220,11 @@ var DataGrid = defineComponent({
|
|
|
218
220
|
props: {
|
|
219
221
|
ariaLabel: {
|
|
220
222
|
type: String,
|
|
221
|
-
default:
|
|
223
|
+
default: void 0
|
|
224
|
+
},
|
|
225
|
+
localization: {
|
|
226
|
+
type: Object,
|
|
227
|
+
default: void 0
|
|
222
228
|
},
|
|
223
229
|
options: {
|
|
224
230
|
type: Object,
|
|
@@ -226,7 +232,7 @@ var DataGrid = defineComponent({
|
|
|
226
232
|
},
|
|
227
233
|
emptyState: {
|
|
228
234
|
type: [String, Number, Object, Array],
|
|
229
|
-
default:
|
|
235
|
+
default: void 0
|
|
230
236
|
},
|
|
231
237
|
error: {
|
|
232
238
|
type: Boolean,
|
|
@@ -234,7 +240,7 @@ var DataGrid = defineComponent({
|
|
|
234
240
|
},
|
|
235
241
|
errorState: {
|
|
236
242
|
type: [String, Number, Object, Array],
|
|
237
|
-
default:
|
|
243
|
+
default: void 0
|
|
238
244
|
},
|
|
239
245
|
onRetry: {
|
|
240
246
|
type: Function,
|
|
@@ -246,7 +252,31 @@ var DataGrid = defineComponent({
|
|
|
246
252
|
},
|
|
247
253
|
loadingState: {
|
|
248
254
|
type: [String, Number, Object, Array],
|
|
249
|
-
default:
|
|
255
|
+
default: void 0
|
|
256
|
+
},
|
|
257
|
+
renderToolbar: {
|
|
258
|
+
type: Function,
|
|
259
|
+
default: void 0
|
|
260
|
+
},
|
|
261
|
+
renderEmptyState: {
|
|
262
|
+
type: Function,
|
|
263
|
+
default: void 0
|
|
264
|
+
},
|
|
265
|
+
renderLoadingState: {
|
|
266
|
+
type: Function,
|
|
267
|
+
default: void 0
|
|
268
|
+
},
|
|
269
|
+
renderErrorState: {
|
|
270
|
+
type: Function,
|
|
271
|
+
default: void 0
|
|
272
|
+
},
|
|
273
|
+
renderHeader: {
|
|
274
|
+
type: Function,
|
|
275
|
+
default: void 0
|
|
276
|
+
},
|
|
277
|
+
renderCell: {
|
|
278
|
+
type: Function,
|
|
279
|
+
default: void 0
|
|
250
280
|
},
|
|
251
281
|
onGridReady: {
|
|
252
282
|
type: Function,
|
|
@@ -792,6 +822,11 @@ var DataGrid = defineComponent({
|
|
|
792
822
|
}
|
|
793
823
|
};
|
|
794
824
|
return () => {
|
|
825
|
+
const localization = createGridLocalization(props.localization);
|
|
826
|
+
const ariaLabel = props.ariaLabel ?? localization.dataGridLabel;
|
|
827
|
+
const emptyState = props.emptyState ?? localization.noRows;
|
|
828
|
+
const errorState = props.errorState ?? getGridErrorText(localization);
|
|
829
|
+
const loadingState = props.loadingState ?? getGridLoadingText(localization);
|
|
795
830
|
state.value;
|
|
796
831
|
rowSizeVersion.value;
|
|
797
832
|
columnSizeVersion.value;
|
|
@@ -805,6 +840,10 @@ var DataGrid = defineComponent({
|
|
|
805
840
|
const rows = grid.getRowModel().rows;
|
|
806
841
|
const allColumns = grid.getAllLeafColumns();
|
|
807
842
|
const visibleColumns = grid.getVisibleLeafColumns();
|
|
843
|
+
const renderContext = { grid, rows, visibleColumns };
|
|
844
|
+
const resolvedEmptyState = props.renderEmptyState?.(renderContext) ?? emptyState;
|
|
845
|
+
const resolvedLoadingState = props.renderLoadingState?.(renderContext) ?? loadingState;
|
|
846
|
+
const resolvedErrorState = props.renderErrorState?.({ ...renderContext, retry: props.onRetry }) ?? errorState;
|
|
808
847
|
const layout = grid.getColumnLayout();
|
|
809
848
|
const columnById = new Map(visibleColumns.map((column) => [column.id, column]));
|
|
810
849
|
const columnIndexById = new Map(visibleColumns.map((column, index) => [column.id, index]));
|
|
@@ -835,7 +874,7 @@ var DataGrid = defineComponent({
|
|
|
835
874
|
style: rootStyle
|
|
836
875
|
};
|
|
837
876
|
const semanticGridProps = {
|
|
838
|
-
...getGridProps(grid, { additionalHeaderRowCount, ariaLabel
|
|
877
|
+
...getGridProps(grid, { additionalHeaderRowCount, ariaLabel, error: props.error, loading: props.loading }),
|
|
839
878
|
...densitySizingEnabled ? getGridDensityProps(resolvedDensity) : {},
|
|
840
879
|
...gridAttrs
|
|
841
880
|
};
|
|
@@ -847,61 +886,61 @@ var DataGrid = defineComponent({
|
|
|
847
886
|
}));
|
|
848
887
|
resetPaginationScroll();
|
|
849
888
|
};
|
|
850
|
-
const quickFilterNode = props.quickFilterControl ? h("div", { ...getQuickFilterProps(), class: "og-grid__quick-filter" }, [
|
|
889
|
+
const quickFilterNode = props.quickFilterControl ? h("div", { ...getQuickFilterProps(localization), class: "og-grid__quick-filter" }, [
|
|
851
890
|
h("input", {
|
|
852
|
-
...getQuickFilterInputProps({ value: state.value.globalFilter }),
|
|
891
|
+
...getQuickFilterInputProps({ value: state.value.globalFilter }, localization),
|
|
853
892
|
class: "og-grid__quick-filter-input",
|
|
854
893
|
onInput: (event) => setQuickFilter(getCellEditorEventValue(event))
|
|
855
894
|
}),
|
|
856
895
|
h(
|
|
857
896
|
"button",
|
|
858
897
|
{
|
|
859
|
-
...getQuickFilterClearButtonProps(state.value.globalFilter),
|
|
898
|
+
...getQuickFilterClearButtonProps(state.value.globalFilter, localization),
|
|
860
899
|
class: "og-grid__quick-filter-clear",
|
|
861
900
|
onClick: () => setQuickFilter("")
|
|
862
901
|
},
|
|
863
|
-
getQuickFilterClearButtonText()
|
|
902
|
+
getQuickFilterClearButtonText(localization)
|
|
864
903
|
)
|
|
865
904
|
]) : null;
|
|
866
905
|
const allPageRowsSelected = props.rowSelectionControls ? grid.getIsAllPageRowsSelected() : false;
|
|
867
906
|
const somePageRowsSelected = props.rowSelectionControls ? grid.getIsSomePageRowsSelected() : false;
|
|
868
907
|
const selectedRowCount = props.rowSelectionControls ? grid.getSelectedRowModel().rows.length : 0;
|
|
869
|
-
const selectionControlsNode = props.rowSelectionControls ? h("div", { ...getRowSelectionControlsProps(), class: "og-grid__selection-controls" }, [
|
|
908
|
+
const selectionControlsNode = props.rowSelectionControls ? h("div", { ...getRowSelectionControlsProps(localization), class: "og-grid__selection-controls" }, [
|
|
870
909
|
h("label", { class: "og-grid__selection-toggle" }, [
|
|
871
910
|
h("input", {
|
|
872
911
|
...getRowSelectionCheckboxProps({
|
|
873
912
|
allSelected: allPageRowsSelected,
|
|
874
913
|
someSelected: somePageRowsSelected,
|
|
875
914
|
disabled: rows.length === 0
|
|
876
|
-
}),
|
|
915
|
+
}, localization),
|
|
877
916
|
ref: (element) => {
|
|
878
917
|
setCheckboxIndeterminate(element, somePageRowsSelected);
|
|
879
918
|
},
|
|
880
919
|
onChange: () => grid.toggleAllPageRowsSelected(!allPageRowsSelected)
|
|
881
920
|
}),
|
|
882
|
-
h("span", getRowSelectionCheckboxText())
|
|
921
|
+
h("span", getRowSelectionCheckboxText(localization))
|
|
883
922
|
]),
|
|
884
|
-
h("span", { ...getRowSelectionStatusProps(), class: "og-grid__selection-status" }, getRowSelectionStatusText(selectedRowCount)),
|
|
923
|
+
h("span", { ...getRowSelectionStatusProps(), class: "og-grid__selection-status" }, getRowSelectionStatusText(selectedRowCount, localization)),
|
|
885
924
|
h(
|
|
886
925
|
"button",
|
|
887
926
|
{
|
|
888
|
-
...getRowSelectionClearButtonProps(selectedRowCount === 0),
|
|
927
|
+
...getRowSelectionClearButtonProps(selectedRowCount === 0, localization),
|
|
889
928
|
class: "og-grid__selection-clear",
|
|
890
929
|
onClick: () => grid.resetRowSelection()
|
|
891
930
|
},
|
|
892
|
-
getRowSelectionClearButtonText()
|
|
931
|
+
getRowSelectionClearButtonText(localization)
|
|
893
932
|
)
|
|
894
933
|
]) : null;
|
|
895
934
|
const filteredVisibilityColumns = getFilteredColumnVisibilityColumns(allColumns, columnVisibilityQuery.value);
|
|
896
|
-
const columnVisibilityNode = props.columnVisibilityControls ? h("details", { ...getColumnVisibilityControlsProps(), class: "og-grid__column-visibility" }, [
|
|
935
|
+
const columnVisibilityNode = props.columnVisibilityControls ? h("details", { ...getColumnVisibilityControlsProps(localization), class: "og-grid__column-visibility" }, [
|
|
897
936
|
h(
|
|
898
937
|
"summary",
|
|
899
|
-
{ ...getColumnVisibilitySummaryProps(visibleColumns.length, allColumns.length), class: "og-grid__column-visibility-summary" },
|
|
900
|
-
getColumnVisibilitySummaryText(visibleColumns.length, allColumns.length)
|
|
938
|
+
{ ...getColumnVisibilitySummaryProps(visibleColumns.length, allColumns.length, localization), class: "og-grid__column-visibility-summary" },
|
|
939
|
+
getColumnVisibilitySummaryText(visibleColumns.length, allColumns.length, localization)
|
|
901
940
|
),
|
|
902
941
|
h("div", { class: "og-grid__column-visibility-panel" }, [
|
|
903
942
|
h("input", {
|
|
904
|
-
...getColumnVisibilitySearchInputProps(columnVisibilityQuery.value),
|
|
943
|
+
...getColumnVisibilitySearchInputProps(columnVisibilityQuery.value, localization),
|
|
905
944
|
class: "og-grid__column-visibility-search",
|
|
906
945
|
onInput: (event) => {
|
|
907
946
|
columnVisibilityQuery.value = getCellEditorEventValue(event);
|
|
@@ -910,11 +949,11 @@ var DataGrid = defineComponent({
|
|
|
910
949
|
h(
|
|
911
950
|
"span",
|
|
912
951
|
{ ...getColumnVisibilityStatusProps(), class: "og-grid__column-visibility-status" },
|
|
913
|
-
getColumnVisibilityStatusText(visibleColumns.length, allColumns.length)
|
|
952
|
+
getColumnVisibilityStatusText(visibleColumns.length, allColumns.length, localization)
|
|
914
953
|
),
|
|
915
954
|
h(
|
|
916
955
|
"div",
|
|
917
|
-
{ ...getColumnVisibilityListProps(), class: "og-grid__column-visibility-list" },
|
|
956
|
+
{ ...getColumnVisibilityListProps(localization), class: "og-grid__column-visibility-list" },
|
|
918
957
|
filteredVisibilityColumns.length > 0 ? filteredVisibilityColumns.map((column) => {
|
|
919
958
|
const label = getColumnHeaderText(column);
|
|
920
959
|
const visible = grid.getIsColumnVisible(column.id);
|
|
@@ -930,27 +969,27 @@ var DataGrid = defineComponent({
|
|
|
930
969
|
}),
|
|
931
970
|
h("span", label)
|
|
932
971
|
]);
|
|
933
|
-
}) : [h("span", { class: "og-grid__column-visibility-empty" }, getColumnVisibilityEmptyText())]
|
|
972
|
+
}) : [h("span", { class: "og-grid__column-visibility-empty" }, getColumnVisibilityEmptyText(localization))]
|
|
934
973
|
),
|
|
935
974
|
h(
|
|
936
975
|
"button",
|
|
937
976
|
{
|
|
938
|
-
...getColumnVisibilityResetButtonProps(allColumns.length - visibleColumns.length),
|
|
977
|
+
...getColumnVisibilityResetButtonProps(allColumns.length - visibleColumns.length, localization),
|
|
939
978
|
class: "og-grid__column-visibility-reset",
|
|
940
979
|
onClick: () => grid.resetColumnVisibility()
|
|
941
980
|
},
|
|
942
|
-
getColumnVisibilityResetButtonText()
|
|
981
|
+
getColumnVisibilityResetButtonText(localization)
|
|
943
982
|
)
|
|
944
983
|
])
|
|
945
984
|
]) : null;
|
|
946
985
|
const densityNode = props.densityControl ? h(
|
|
947
986
|
"div",
|
|
948
|
-
{ ...getDensityControlsProps(), class: "og-grid__density-controls" },
|
|
987
|
+
{ ...getDensityControlsProps(localization), class: "og-grid__density-controls" },
|
|
949
988
|
GRID_DENSITIES.map(
|
|
950
989
|
(densityOption) => h(
|
|
951
990
|
"button",
|
|
952
991
|
{
|
|
953
|
-
...getDensityButtonProps(densityOption, resolvedDensity),
|
|
992
|
+
...getDensityButtonProps(densityOption, resolvedDensity, localization),
|
|
954
993
|
class: "og-grid__density-button",
|
|
955
994
|
onClick: () => {
|
|
956
995
|
if (props.density === void 0) {
|
|
@@ -962,13 +1001,13 @@ var DataGrid = defineComponent({
|
|
|
962
1001
|
props.onDensityChange?.(densityOption);
|
|
963
1002
|
}
|
|
964
1003
|
},
|
|
965
|
-
getDensityButtonText(densityOption)
|
|
1004
|
+
getDensityButtonText(densityOption, localization)
|
|
966
1005
|
)
|
|
967
1006
|
)
|
|
968
1007
|
) : null;
|
|
969
1008
|
const controlsNode = props.quickFilterControl || props.rowSelectionControls || props.columnVisibilityControls || props.densityControl ? h("div", { class: "og-grid__controls" }, [selectionControlsNode, columnVisibilityNode, densityNode, quickFilterNode]) : null;
|
|
970
1009
|
const gridNode = h("div", rootProps, [
|
|
971
|
-
props.groupingPanel ? renderGroupingPanel(grid, groupingColumns, groupingPanelRef) : null,
|
|
1010
|
+
props.groupingPanel ? renderGroupingPanel(grid, groupingColumns, groupingPanelRef, localization) : null,
|
|
972
1011
|
h("div", { ...semanticGridProps, class: "og-grid__scroller", onKeydown: handleKeyDown, ref: scrollerRef }, [
|
|
973
1012
|
h("div", { class: "og-grid__canvas", style: getInlineSizeStyleText(totalWidth) }, [
|
|
974
1013
|
h(
|
|
@@ -1017,7 +1056,9 @@ var DataGrid = defineComponent({
|
|
|
1017
1056
|
},
|
|
1018
1057
|
() => {
|
|
1019
1058
|
headerMenuColumnId.value = null;
|
|
1020
|
-
}
|
|
1059
|
+
},
|
|
1060
|
+
localization,
|
|
1061
|
+
props.renderHeader
|
|
1021
1062
|
);
|
|
1022
1063
|
})
|
|
1023
1064
|
)
|
|
@@ -1054,7 +1095,7 @@ var DataGrid = defineComponent({
|
|
|
1054
1095
|
...getColumnFilterInputProps(column, {
|
|
1055
1096
|
label: getColumnHeaderText(column),
|
|
1056
1097
|
value: getColumnFilterText(state.value.columnFilters, column.id)
|
|
1057
|
-
}),
|
|
1098
|
+
}, localization),
|
|
1058
1099
|
class: "og-grid__filter-input",
|
|
1059
1100
|
onInput: (event) => {
|
|
1060
1101
|
const value = getCellEditorEventValue(event);
|
|
@@ -1082,7 +1123,7 @@ var DataGrid = defineComponent({
|
|
|
1082
1123
|
rows.length === 0 ? [
|
|
1083
1124
|
h("div", { ...getGridEmptyRowProps({ rowIndexOffset: bodyRowIndexOffset }), class: "og-grid__empty" }, [
|
|
1084
1125
|
h("div", { ...getGridEmptyCellProps({ rowIndexOffset: bodyRowIndexOffset, columnCount: visibleColumns.length }), class: "og-grid__empty-cell", style: getInlineSizeStyleText(totalWidth) }, [
|
|
1085
|
-
|
|
1126
|
+
resolvedEmptyState
|
|
1086
1127
|
])
|
|
1087
1128
|
])
|
|
1088
1129
|
] : visibleRowItems.map(
|
|
@@ -1137,7 +1178,9 @@ var DataGrid = defineComponent({
|
|
|
1137
1178
|
grid.cancelCellEdit(event);
|
|
1138
1179
|
},
|
|
1139
1180
|
rangeDragHandlers,
|
|
1140
|
-
props.getCellClassName
|
|
1181
|
+
props.getCellClassName,
|
|
1182
|
+
localization,
|
|
1183
|
+
props.renderCell
|
|
1141
1184
|
)
|
|
1142
1185
|
];
|
|
1143
1186
|
})
|
|
@@ -1146,26 +1189,26 @@ var DataGrid = defineComponent({
|
|
|
1146
1189
|
)
|
|
1147
1190
|
])
|
|
1148
1191
|
]),
|
|
1149
|
-
props.error ? h("div", { ...getGridErrorOverlayProps(), class: "og-grid__status-overlay og-grid__error-overlay" }, [
|
|
1150
|
-
h("span", { class: "og-grid__status-text" }, [
|
|
1151
|
-
props.onRetry ? h("button", { ...getGridErrorRetryButtonProps(), class: "og-grid__retry-button", onClick: props.onRetry }, getGridErrorRetryButtonText()) : null
|
|
1152
|
-
]) : props.loading ? h("div", { ...getGridLoadingOverlayProps(), class: "og-grid__status-overlay og-grid__loading-overlay" }, [
|
|
1192
|
+
props.error ? h("div", { ...getGridErrorOverlayProps(localization), class: "og-grid__status-overlay og-grid__error-overlay" }, [
|
|
1193
|
+
h("span", { class: "og-grid__status-text" }, [resolvedErrorState]),
|
|
1194
|
+
props.onRetry ? h("button", { ...getGridErrorRetryButtonProps(localization), class: "og-grid__retry-button", onClick: props.onRetry }, getGridErrorRetryButtonText(localization)) : null
|
|
1195
|
+
]) : props.loading ? h("div", { ...getGridLoadingOverlayProps(localization), class: "og-grid__status-overlay og-grid__loading-overlay" }, [
|
|
1153
1196
|
h("span", { class: "og-grid__loading-spinner", "aria-hidden": "true" }),
|
|
1154
|
-
h("span", { class: "og-grid__status-text" }, [
|
|
1197
|
+
h("span", { class: "og-grid__status-text" }, [resolvedLoadingState])
|
|
1155
1198
|
]) : null
|
|
1156
1199
|
]);
|
|
1157
|
-
const paginationNode = props.paginationControls ? h("nav", { ...getPaginationProps(), class: "og-grid__pagination" }, [
|
|
1200
|
+
const paginationNode = props.paginationControls ? h("nav", { ...getPaginationProps(localization), class: "og-grid__pagination" }, [
|
|
1158
1201
|
h("div", { class: "og-grid__pagination-buttons" }, [
|
|
1159
|
-
h("button", { ...getPaginationButtonProps({ action: "first", disabled: !grid.getCanPreviousPage() }), class: "og-grid__pagination-button", onClick: () => runPaginationAction(() => grid.firstPage()) }, getPaginationButtonText("first")),
|
|
1160
|
-
h("button", { ...getPaginationButtonProps({ action: "previous", disabled: !grid.getCanPreviousPage() }), class: "og-grid__pagination-button", onClick: () => runPaginationAction(() => grid.previousPage()) }, getPaginationButtonText("previous")),
|
|
1161
|
-
h("span", { ...getPaginationStatusProps(), class: "og-grid__pagination-status" }, getPaginationPageText(grid)),
|
|
1162
|
-
h("button", { ...getPaginationButtonProps({ action: "next", disabled: !grid.getCanNextPage() }), class: "og-grid__pagination-button", onClick: () => runPaginationAction(() => grid.nextPage()) }, getPaginationButtonText("next")),
|
|
1163
|
-
h("button", { ...getPaginationButtonProps({ action: "last", disabled: !grid.getCanNextPage() }), class: "og-grid__pagination-button", onClick: () => runPaginationAction(() => grid.lastPage()) }, getPaginationButtonText("last"))
|
|
1202
|
+
h("button", { ...getPaginationButtonProps({ action: "first", disabled: !grid.getCanPreviousPage() }, localization), class: "og-grid__pagination-button", onClick: () => runPaginationAction(() => grid.firstPage()) }, getPaginationButtonText("first")),
|
|
1203
|
+
h("button", { ...getPaginationButtonProps({ action: "previous", disabled: !grid.getCanPreviousPage() }, localization), class: "og-grid__pagination-button", onClick: () => runPaginationAction(() => grid.previousPage()) }, getPaginationButtonText("previous")),
|
|
1204
|
+
h("span", { ...getPaginationStatusProps(), class: "og-grid__pagination-status" }, getPaginationPageText(grid, localization)),
|
|
1205
|
+
h("button", { ...getPaginationButtonProps({ action: "next", disabled: !grid.getCanNextPage() }, localization), class: "og-grid__pagination-button", onClick: () => runPaginationAction(() => grid.nextPage()) }, getPaginationButtonText("next")),
|
|
1206
|
+
h("button", { ...getPaginationButtonProps({ action: "last", disabled: !grid.getCanNextPage() }, localization), class: "og-grid__pagination-button", onClick: () => runPaginationAction(() => grid.lastPage()) }, getPaginationButtonText("last"))
|
|
1164
1207
|
]),
|
|
1165
1208
|
h(
|
|
1166
1209
|
"select",
|
|
1167
1210
|
{
|
|
1168
|
-
...getPaginationPageSizeSelectProps(state.value.pagination.pageSize),
|
|
1211
|
+
...getPaginationPageSizeSelectProps(state.value.pagination.pageSize, localization),
|
|
1169
1212
|
class: "og-grid__pagination-size",
|
|
1170
1213
|
onChange: (event) => {
|
|
1171
1214
|
grid.setPageSize(Number(getCellEditorEventValue(event)));
|
|
@@ -1173,18 +1216,19 @@ var DataGrid = defineComponent({
|
|
|
1173
1216
|
}
|
|
1174
1217
|
},
|
|
1175
1218
|
resolvedPageSizeOptions.map(
|
|
1176
|
-
(pageSize) => h("option", { key: pageSize, value: pageSize }, getPaginationPageSizeOptionText(pageSize))
|
|
1219
|
+
(pageSize) => h("option", { key: pageSize, value: pageSize }, getPaginationPageSizeOptionText(pageSize, localization))
|
|
1177
1220
|
)
|
|
1178
1221
|
)
|
|
1179
1222
|
]) : null;
|
|
1180
|
-
|
|
1223
|
+
const toolbarNode = props.renderToolbar ? h("div", { class: "og-grid__toolbar-slot" }, [props.renderToolbar(renderContext)]) : null;
|
|
1224
|
+
return h(Fragment, null, [toolbarNode, controlsNode, gridNode, paginationNode]);
|
|
1181
1225
|
};
|
|
1182
1226
|
}
|
|
1183
1227
|
});
|
|
1184
1228
|
function createDataGrid() {
|
|
1185
1229
|
return DataGrid;
|
|
1186
1230
|
}
|
|
1187
|
-
function renderHeader(grid, renderKey, header, layout, size, colSpan, columnIndex, headerDragHandlers, columnPinningControls, headerActionMenu, headerActionMenuItems, getHeaderClassName, openHeaderMenuColumnId, onMeasureColumn, onOpenHeaderMenu, onToggleHeaderMenu, onCloseHeaderMenu) {
|
|
1231
|
+
function renderHeader(grid, renderKey, header, layout, size, colSpan, columnIndex, headerDragHandlers, columnPinningControls, headerActionMenu, headerActionMenuItems, getHeaderClassName, openHeaderMenuColumnId, onMeasureColumn, onOpenHeaderMenu, onToggleHeaderMenu, onCloseHeaderMenu, localization, renderHeaderProp) {
|
|
1188
1232
|
const canSort = !header.isPlaceholder && header.column.columns.length === 0 && header.column.getCanSort();
|
|
1189
1233
|
const canResize = !header.isPlaceholder && header.column.columns.length === 0;
|
|
1190
1234
|
const canInteract = !header.isPlaceholder && header.column.columns.length === 0;
|
|
@@ -1204,7 +1248,7 @@ function renderHeader(grid, renderKey, header, layout, size, colSpan, columnInde
|
|
|
1204
1248
|
canGroup: header.column.getCanGroup(),
|
|
1205
1249
|
canMoveLeft,
|
|
1206
1250
|
canMoveRight
|
|
1207
|
-
}).map((descriptor) => {
|
|
1251
|
+
}, localization).map((descriptor) => {
|
|
1208
1252
|
if (descriptor.id === "sort-asc") {
|
|
1209
1253
|
return { ...descriptor, onSelect: () => grid.toggleColumnSorting(header.column.id, false) };
|
|
1210
1254
|
}
|
|
@@ -1268,19 +1312,19 @@ function renderHeader(grid, renderKey, header, layout, size, colSpan, columnInde
|
|
|
1268
1312
|
},
|
|
1269
1313
|
header.isPlaceholder ? "" : [
|
|
1270
1314
|
h("button", getHeaderButtonEventProps(grid, header.column, canSort, canInteract, headerDragHandlers), [
|
|
1271
|
-
h("span", { class: "og-grid__header-label" }, renderHeaderValue(grid, header)),
|
|
1315
|
+
h("span", { class: "og-grid__header-label" }, normalizeRenderable(renderHeaderProp?.({ grid, column: header.column, header }) ?? renderHeaderValue(grid, header))),
|
|
1272
1316
|
h("span", { ...getHeaderSortIndicatorProps(), class: "og-grid__sort-indicator" }, getHeaderSortIndicatorText(sortDirection, { visible: canSort }))
|
|
1273
1317
|
]),
|
|
1274
|
-
canInteract && columnPinningControls ? h("span", { ...getColumnPinningControlsProps(header.column), class: "og-grid__pinning-controls" }, [
|
|
1275
|
-
h("button", getPinningButtonProps(grid, header.column, "left", pinningPosition === "left"), getColumnPinningButtonText("left")),
|
|
1276
|
-
h("button", getPinningButtonProps(grid, header.column, false, pinningPosition === false), getColumnPinningButtonText(false)),
|
|
1277
|
-
h("button", getPinningButtonProps(grid, header.column, "right", pinningPosition === "right"), getColumnPinningButtonText("right"))
|
|
1318
|
+
canInteract && columnPinningControls ? h("span", { ...getColumnPinningControlsProps(header.column, localization), class: "og-grid__pinning-controls" }, [
|
|
1319
|
+
h("button", getPinningButtonProps(grid, header.column, "left", pinningPosition === "left", localization), getColumnPinningButtonText("left")),
|
|
1320
|
+
h("button", getPinningButtonProps(grid, header.column, false, pinningPosition === false, localization), getColumnPinningButtonText(false)),
|
|
1321
|
+
h("button", getPinningButtonProps(grid, header.column, "right", pinningPosition === "right", localization), getColumnPinningButtonText("right"))
|
|
1278
1322
|
]) : null,
|
|
1279
1323
|
canInteract && headerActionMenu ? h("span", { class: "og-grid__header-menu" }, [
|
|
1280
1324
|
h(
|
|
1281
1325
|
"button",
|
|
1282
1326
|
{
|
|
1283
|
-
...getHeaderActionMenuTriggerProps(header.column, { expanded: openHeaderMenuColumnId === header.column.id, controls: menuId }),
|
|
1327
|
+
...getHeaderActionMenuTriggerProps(header.column, { expanded: openHeaderMenuColumnId === header.column.id, controls: menuId }, localization),
|
|
1284
1328
|
id: menuTriggerId,
|
|
1285
1329
|
class: "og-grid__header-menu-trigger",
|
|
1286
1330
|
onPointerdown: (event) => stopEventPropagation(event),
|
|
@@ -1298,12 +1342,12 @@ function renderHeader(grid, renderKey, header, layout, size, colSpan, columnInde
|
|
|
1298
1342
|
nextTick(() => focusHeaderActionMenuItemById(document, menuId, focusPosition));
|
|
1299
1343
|
}
|
|
1300
1344
|
},
|
|
1301
|
-
|
|
1345
|
+
localization.headerActionMenuTrigger
|
|
1302
1346
|
),
|
|
1303
1347
|
openHeaderMenuColumnId === header.column.id ? h(
|
|
1304
1348
|
"div",
|
|
1305
1349
|
{
|
|
1306
|
-
...getHeaderActionMenuProps(header.column),
|
|
1350
|
+
...getHeaderActionMenuProps(header.column, localization),
|
|
1307
1351
|
class: "og-grid__header-menu-popover",
|
|
1308
1352
|
id: menuId,
|
|
1309
1353
|
onPointerdown: (event) => stopEventPropagation(event),
|
|
@@ -1338,7 +1382,7 @@ function renderHeader(grid, renderKey, header, layout, size, colSpan, columnInde
|
|
|
1338
1382
|
) : null
|
|
1339
1383
|
]) : null,
|
|
1340
1384
|
canResize ? h("span", {
|
|
1341
|
-
...getColumnResizeHandleProps(header.column),
|
|
1385
|
+
...getColumnResizeHandleProps(header.column, {}, localization),
|
|
1342
1386
|
class: "og-grid__resize-handle",
|
|
1343
1387
|
onKeydown: (event) => handleResizeKeyDown(grid, header.column, Math.max(0, columnIndex), event),
|
|
1344
1388
|
onPointerdown: (event) => handleResizePointerDown(grid, header.column, Math.max(0, columnIndex), event)
|
|
@@ -1346,9 +1390,9 @@ function renderHeader(grid, renderKey, header, layout, size, colSpan, columnInde
|
|
|
1346
1390
|
]
|
|
1347
1391
|
);
|
|
1348
1392
|
}
|
|
1349
|
-
function getPinningButtonProps(grid, column, position, active) {
|
|
1393
|
+
function getPinningButtonProps(grid, column, position, active, localization) {
|
|
1350
1394
|
return {
|
|
1351
|
-
...getColumnPinningButtonProps(column, { position, active }),
|
|
1395
|
+
...getColumnPinningButtonProps(column, { position, active }, localization),
|
|
1352
1396
|
class: "og-grid__pinning-button",
|
|
1353
1397
|
onPointerdown: (event) => stopEventPropagation(event),
|
|
1354
1398
|
onClick: (event) => {
|
|
@@ -1468,7 +1512,7 @@ function handleResizeKeyDown(grid, column, columnIndex, event) {
|
|
|
1468
1512
|
sourceEvent: event
|
|
1469
1513
|
});
|
|
1470
1514
|
}
|
|
1471
|
-
function renderCell(grid, row, rowIndex, rowIndexOffset, column, columnIndex, layout, beforeSpacerSize, afterSpacerSize, visibleColumns, editDraft, editValidationMessage, commitCellEdit, cancelCellEdit, rangeDragHandlers, getCellClassName) {
|
|
1515
|
+
function renderCell(grid, row, rowIndex, rowIndexOffset, column, columnIndex, layout, beforeSpacerSize, afterSpacerSize, visibleColumns, editDraft, editValidationMessage, commitCellEdit, cancelCellEdit, rangeDragHandlers, getCellClassName, localization, renderCellProp) {
|
|
1472
1516
|
const editing = grid.getIsCellEditing(row.id, column.id);
|
|
1473
1517
|
const rangeSelected = grid.getIsCellRangeSelected(row.id, column.id);
|
|
1474
1518
|
const groupLabelCell = getIsGroupLabelCell(row, column, visibleColumns);
|
|
@@ -1518,7 +1562,7 @@ function renderCell(grid, row, rowIndex, rowIndexOffset, column, columnIndex, la
|
|
|
1518
1562
|
column.columnDef.editOptions ? h(
|
|
1519
1563
|
"select",
|
|
1520
1564
|
{
|
|
1521
|
-
...getCellEditorProps(column, { invalid: Boolean(editValidationMessage.value) }),
|
|
1565
|
+
...getCellEditorProps(column, { invalid: Boolean(editValidationMessage.value) }, localization),
|
|
1522
1566
|
class: "og-grid__cell-editor",
|
|
1523
1567
|
value: editDraft.value,
|
|
1524
1568
|
onChange: (event) => {
|
|
@@ -1555,7 +1599,7 @@ function renderCell(grid, row, rowIndex, rowIndexOffset, column, columnIndex, la
|
|
|
1555
1599
|
},
|
|
1556
1600
|
column.columnDef.editOptions.map((option) => h("option", getCellEditorOptionProps(option), getCellEditorOptionText(option)))
|
|
1557
1601
|
) : h("input", {
|
|
1558
|
-
...getCellEditorProps(column, { invalid: Boolean(editValidationMessage.value) }),
|
|
1602
|
+
...getCellEditorProps(column, { invalid: Boolean(editValidationMessage.value) }, localization),
|
|
1559
1603
|
class: "og-grid__cell-editor",
|
|
1560
1604
|
value: editDraft.value,
|
|
1561
1605
|
onInput: (event) => {
|
|
@@ -1591,13 +1635,13 @@ function renderCell(grid, row, rowIndex, rowIndexOffset, column, columnIndex, la
|
|
|
1591
1635
|
}
|
|
1592
1636
|
}),
|
|
1593
1637
|
editValidationMessage.value ? h("span", { ...getCellValidationMessageProps(), class: "og-grid__cell-validation" }, editValidationMessage.value) : null
|
|
1594
|
-
] : fillHandleVisible ? [renderFillHandle(coordinate, rangeDragHandlers), renderCellValue(grid, row, column)] : groupLabelCell ? renderGroupCell(grid, row, column) : renderCellValue(grid, row, column)
|
|
1638
|
+
] : fillHandleVisible ? [renderFillHandle(coordinate, rangeDragHandlers), renderCellProp?.({ grid, row, column, value: row.getValue(column.id) }) ?? renderCellValue(grid, row, column)] : groupLabelCell ? renderGroupCell(grid, row, column, localization, renderCellProp) : renderCellProp?.({ grid, row, column, value: row.getValue(column.id) }) ?? renderCellValue(grid, row, column)
|
|
1595
1639
|
);
|
|
1596
1640
|
}
|
|
1597
|
-
function renderGroupCell(grid, row, column) {
|
|
1641
|
+
function renderGroupCell(grid, row, column, localization, renderCellProp) {
|
|
1598
1642
|
const expanded = grid.getIsRowExpanded(row.id);
|
|
1599
|
-
const fallback = row.getIsGroupFooter() || row.groupingColumnId ? void 0 : renderCellValue(grid, row, column);
|
|
1600
|
-
const label = getGroupRowLabel(row, column, { fallback });
|
|
1643
|
+
const fallback = row.getIsGroupFooter() || row.groupingColumnId ? void 0 : renderCellProp?.({ grid, row, column, value: row.getValue(column.id) }) ?? renderCellValue(grid, row, column);
|
|
1644
|
+
const label = getGroupRowLabel(row, column, { fallback }, localization);
|
|
1601
1645
|
const countText = getGroupRowCountText(row);
|
|
1602
1646
|
return h(
|
|
1603
1647
|
"span",
|
|
@@ -1609,7 +1653,7 @@ function renderGroupCell(grid, row, column) {
|
|
|
1609
1653
|
row.getCanExpand() ? h(
|
|
1610
1654
|
"button",
|
|
1611
1655
|
{
|
|
1612
|
-
...getRowExpansionToggleProps(row, { expanded, label: String(label) }),
|
|
1656
|
+
...getRowExpansionToggleProps(row, { expanded, label: String(label) }, localization),
|
|
1613
1657
|
class: "og-grid__group-toggle",
|
|
1614
1658
|
onPointerdown: (event) => {
|
|
1615
1659
|
stopEventPropagation(event);
|
|
@@ -1643,21 +1687,21 @@ function startCellEdit(grid, rowId, columnId, sourceEvent, editDraft, editValida
|
|
|
1643
1687
|
editValidationMessage.value = null;
|
|
1644
1688
|
grid.startCellEdit(rowId, columnId, sourceEvent);
|
|
1645
1689
|
}
|
|
1646
|
-
function renderGroupingPanel(grid, groupingColumns, panelRef) {
|
|
1690
|
+
function renderGroupingPanel(grid, groupingColumns, panelRef, localization) {
|
|
1647
1691
|
return h(
|
|
1648
1692
|
"div",
|
|
1649
1693
|
{
|
|
1650
1694
|
ref: panelRef,
|
|
1651
|
-
...getGroupingPanelProps({ empty: groupingColumns.length === 0 }),
|
|
1695
|
+
...getGroupingPanelProps({ empty: groupingColumns.length === 0 }, localization),
|
|
1652
1696
|
class: "og-grid__grouping-panel"
|
|
1653
1697
|
},
|
|
1654
|
-
groupingColumns.length === 0 ? [h("span", { ...getGroupingPanelPlaceholderProps(), class: "og-grid__grouping-placeholder" },
|
|
1698
|
+
groupingColumns.length === 0 ? [h("span", { ...getGroupingPanelPlaceholderProps(), class: "og-grid__grouping-placeholder" }, localization.groupingPanelEmpty)] : groupingColumns.map(
|
|
1655
1699
|
(column, index) => h("span", { key: column.id, ...getGroupingPanelChipProps(column), class: "og-grid__grouping-chip" }, [
|
|
1656
1700
|
h("span", { class: "og-grid__grouping-chip-label" }, getColumnLabel(column)),
|
|
1657
1701
|
h(
|
|
1658
1702
|
"button",
|
|
1659
1703
|
{
|
|
1660
|
-
...getGroupingPanelMoveButtonProps(column, { direction: "left", disabled: index === 0 }),
|
|
1704
|
+
...getGroupingPanelMoveButtonProps(column, { direction: "left", disabled: index === 0 }, localization),
|
|
1661
1705
|
class: "og-grid__grouping-move",
|
|
1662
1706
|
onClick: () => moveGroupedColumn(grid, groupingColumns, column.id, "left")
|
|
1663
1707
|
},
|
|
@@ -1666,7 +1710,7 @@ function renderGroupingPanel(grid, groupingColumns, panelRef) {
|
|
|
1666
1710
|
h(
|
|
1667
1711
|
"button",
|
|
1668
1712
|
{
|
|
1669
|
-
...getGroupingPanelMoveButtonProps(column, { direction: "right", disabled: index === groupingColumns.length - 1 }),
|
|
1713
|
+
...getGroupingPanelMoveButtonProps(column, { direction: "right", disabled: index === groupingColumns.length - 1 }, localization),
|
|
1670
1714
|
class: "og-grid__grouping-move",
|
|
1671
1715
|
onClick: () => moveGroupedColumn(grid, groupingColumns, column.id, "right")
|
|
1672
1716
|
},
|
|
@@ -1675,7 +1719,7 @@ function renderGroupingPanel(grid, groupingColumns, panelRef) {
|
|
|
1675
1719
|
h(
|
|
1676
1720
|
"button",
|
|
1677
1721
|
{
|
|
1678
|
-
...getGroupingPanelRemoveButtonProps(column),
|
|
1722
|
+
...getGroupingPanelRemoveButtonProps(column, localization),
|
|
1679
1723
|
class: "og-grid__grouping-remove",
|
|
1680
1724
|
onClick: () => grid.toggleColumnGrouping(column.id, false)
|
|
1681
1725
|
},
|
|
@@ -1725,14 +1769,17 @@ function downloadExportFile(file) {
|
|
|
1725
1769
|
return downloadBrowserExportFile(file);
|
|
1726
1770
|
}
|
|
1727
1771
|
export {
|
|
1772
|
+
DEFAULT_GRID_LOCALIZATION,
|
|
1728
1773
|
DataGrid,
|
|
1729
1774
|
GRID_PREFERENCES_VERSION,
|
|
1730
1775
|
createColumnHelper,
|
|
1731
1776
|
createDataGrid,
|
|
1777
|
+
createGridLocalization2 as createGridLocalization,
|
|
1732
1778
|
createGridPreferences,
|
|
1733
1779
|
downloadExportFile,
|
|
1734
1780
|
fitColumnsToWidth,
|
|
1735
1781
|
getBrowserGridPreferencesStorage,
|
|
1782
|
+
migrateGridPreferences,
|
|
1736
1783
|
parseGridPreferences,
|
|
1737
1784
|
readGridPreferences,
|
|
1738
1785
|
removeGridPreferences,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-grid/vue-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Optional styled Vue data grid for Open Grid.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-grid",
|
|
@@ -35,23 +35,24 @@
|
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsup src/index.ts --format esm --dts --clean --external vue && mkdir -p dist && cp ../react-ui/src/index.css dist/index.css",
|
|
37
37
|
"check": "tsc --noEmit",
|
|
38
|
-
"test": "vitest run
|
|
38
|
+
"test": "vitest run",
|
|
39
39
|
"lint": "tsc --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@open-grid/core": "0.
|
|
43
|
-
"@open-grid/primitives": "0.
|
|
44
|
-
"@open-grid/vue": "0.
|
|
45
|
-
"@open-grid/virtual": "0.
|
|
42
|
+
"@open-grid/core": "0.2.0",
|
|
43
|
+
"@open-grid/primitives": "0.2.0",
|
|
44
|
+
"@open-grid/vue": "0.2.0",
|
|
45
|
+
"@open-grid/virtual": "0.2.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"vue": "^3.4.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
+
"@vue/server-renderer": "^3.5.42",
|
|
51
52
|
"tsup": "^8.3.5",
|
|
52
53
|
"typescript": "^5.7.2",
|
|
53
54
|
"vitest": "^2.1.8",
|
|
54
|
-
"vue": "^3.5.
|
|
55
|
+
"vue": "^3.5.42"
|
|
55
56
|
},
|
|
56
57
|
"repository": {
|
|
57
58
|
"type": "git",
|