@platforma-sdk/ui-vue 1.8.23 → 1.8.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/ui-vue",
3
- "version": "1.8.23",
3
+ "version": "1.8.25",
4
4
  "type": "module",
5
5
  "main": "dist/lib.umd.cjs",
6
6
  "module": "dist/lib.js",
@@ -37,7 +37,7 @@
37
37
  "@ag-grid-community/theming": "^32.3.3",
38
38
  "@ag-grid-enterprise/side-bar": "^32.3.3",
39
39
  "@ag-grid-enterprise/column-tool-panel": "^32.3.3",
40
- "@milaboratories/uikit": "^2.2.1",
40
+ "@milaboratories/uikit": "^2.2.2",
41
41
  "@platforma-sdk/model": "^1.8.19"
42
42
  },
43
43
  "devDependencies": {
@@ -4,6 +4,7 @@ import type {
4
4
  GridApi,
5
5
  GridOptions,
6
6
  GridReadyEvent,
7
+ GridState,
7
8
  ManagedGridOptionKey,
8
9
  ManagedGridOptions,
9
10
  SortState,
@@ -34,7 +35,7 @@ ModuleRegistry.registerModules([
34
35
  ServerSideRowModelModule,
35
36
  RangeSelectionModule,
36
37
  SideBarModule,
37
- ColumnsToolPanelModule
38
+ ColumnsToolPanelModule,
38
39
  ]);
39
40
 
40
41
  const tableState = defineModel<PlDataTableState>({ default: { gridState: {} } });
@@ -139,9 +140,7 @@ const gridState = computed({
139
140
  // do not apply driver sorting for client side rendering
140
141
  const sorting = gridOptions.value.rowModelType === 'clientSide' ? undefined : makeSorting(gridState.sort);
141
142
 
142
- state.gridState.columnOrder = gridState.columnOrder;
143
- state.gridState.sort = gridState.sort;
144
- state.gridState.columnVisibility = gridState.columnVisibility;
143
+ state.gridState = { ...state.gridState, ...gridState };
145
144
 
146
145
  if (settings.value.sourceType === 'ptable' || settings.value.sourceType === 'pframe') {
147
146
  if (!state.pTableParams) {
@@ -314,24 +313,19 @@ const onGridReady = (event: GridReadyEvent) => {
314
313
  },
315
314
  });
316
315
  };
317
- const onStateUpdated = (event: StateUpdatedEvent) => {
318
- gridState.value = {
319
- columnOrder: event.state.columnOrder,
320
- sort: event.state.sort,
321
- columnVisibility: event.state.columnVisibility
322
- ?? (event.state.columnOrder ? { hiddenColIds: [] } : undefined),
323
- };
324
- gridOptions.value.initialState = gridState.value;
325
- };
326
- const onGridPreDestroyed = () => {
327
- const state = gridApi.value!.getState();
328
- gridState.value = {
316
+ const makePartialState = (state: GridState) => {
317
+ return {
329
318
  columnOrder: state.columnOrder,
330
319
  sort: state.sort,
331
- columnVisibility: state.columnVisibility
332
- ?? (state.columnOrder ? { hiddenColIds: [] } : undefined),
320
+ columnVisibility: state.columnVisibility ?? (state.columnOrder ? { hiddenColIds: [] } : undefined),
333
321
  };
334
- gridOptions.value.initialState = gridState.value;
322
+ };
323
+ const onStateUpdated = (event: StateUpdatedEvent) => {
324
+ gridOptions.value.initialState = gridState.value = makePartialState(event.state);
325
+ event.api.autoSizeAllColumns();
326
+ };
327
+ const onGridPreDestroyed = () => {
328
+ gridOptions.value.initialState = gridState.value = makePartialState(gridApi.value!.getState());
335
329
  gridApi.value = undefined;
336
330
  };
337
331
 
@@ -344,13 +338,7 @@ watch(
344
338
  const [gridApi, gridState] = state;
345
339
  if (!gridApi) return;
346
340
 
347
- const selfFullState = gridApi.getState();
348
- const selfState = {
349
- columnOrder: selfFullState.columnOrder,
350
- sort: selfFullState.sort,
351
- columnVisibility: selfFullState.columnVisibility
352
- ?? (selfFullState.columnOrder ? { hiddenColIds: [] } : undefined),
353
- };
341
+ const selfState = makePartialState(gridApi.getState());
354
342
  if (lodash.isEqual(gridState, selfState)) return;
355
343
 
356
344
  gridOptions.value.initialState = gridState;
@@ -280,9 +280,19 @@ export async function updatePFrameGridOptions(
280
280
  const specs = await pfDriver.getSpec(pt);
281
281
 
282
282
  // column indices in the specs array that we are going to process
283
- const indices = [...specs.keys()].filter(
284
- (i) => !lodash.find(sheets, (sheet) => lodash.isEqual(sheet.axis, specs[i].id) || lodash.isEqual(sheet.column, specs[i].id)),
285
- );
283
+ const indices = [...specs.keys()]
284
+ .filter((i) => !lodash.find(sheets, (sheet) => lodash.isEqual(sheet.axis, specs[i].id) || lodash.isEqual(sheet.column, specs[i].id)))
285
+ .sort((a, b) => {
286
+ if (specs[a].type !== specs[b].type) return specs[a].type === 'axis' ? -1 : 1;
287
+
288
+ const aPriority = specs[a].spec.annotations?.['pl7.app/table/orderPriority'];
289
+ const bPriority = specs[b].spec.annotations?.['pl7.app/table/orderPriority'];
290
+
291
+ if (aPriority === undefined) return bPriority === undefined ? 0 : 1;
292
+ if (bPriority === undefined) return -1;
293
+ return Number(bPriority) - Number(aPriority);
294
+ });
295
+
286
296
  const fields = lodash.cloneDeep(indices);
287
297
 
288
298
  // get columns with heterogeneous axes