@platforma-sdk/ui-vue 1.5.42 → 1.5.57

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.5.42",
3
+ "version": "1.5.57",
4
4
  "type": "module",
5
5
  "main": "dist/lib.umd.cjs",
6
6
  "module": "dist/lib.js",
@@ -21,7 +21,7 @@
21
21
  "lru-cache": "^11.0.1",
22
22
  "vue": "^3.5.11",
23
23
  "canonicalize": "^2.0.0",
24
- "@milaboratories/uikit": "^1.2.18",
24
+ "@milaboratories/uikit": "^1.2.20",
25
25
  "@platforma-sdk/model": "^1.5.40"
26
26
  },
27
27
  "devDependencies": {
@@ -14,12 +14,7 @@ import { computed, ref, watch, shallowRef, toRefs } from 'vue';
14
14
  import OverlayLoading from './OverlayLoading.vue';
15
15
  import OverlayNoRows from './OverlayNoRows.vue';
16
16
  import { updateXsvGridOptions } from './sources/file-source';
17
- import {
18
- parseColId,
19
- makeSheets,
20
- updatePFrameGridOptions,
21
- enrichJoinWithLabelColumns
22
- } from './sources/table-source';
17
+ import { parseColId, makeSheets, updatePFrameGridOptions, enrichJoinWithLabelColumns } from './sources/table-source';
23
18
  import type { PlDataTableSheet, PlDataTableSettings } from './types';
24
19
  import * as lodash from 'lodash';
25
20
  import { computedAsync } from '@vueuse/core';
@@ -35,19 +30,15 @@ const { settings } = toRefs(props);
35
30
  watch(
36
31
  () => settings.value,
37
32
  async (settings, oldSettings) => {
38
- if (
39
- settings.sourceType !== 'pframe' ||
40
- !settings.pFrame?.ok ||
41
- !settings.pFrame.value ||
42
- !settings.join
43
- ) return;
44
-
33
+ if (settings.sourceType !== 'pframe' || !settings.pFrame?.ok || !settings.pFrame.value || !settings.join) return;
34
+
45
35
  if (
46
36
  oldSettings &&
47
- oldSettings.sourceType === 'pframe' &&
37
+ oldSettings.sourceType === 'pframe' &&
48
38
  lodash.isEqual(settings.pFrame, oldSettings.pFrame) &&
49
39
  lodash.isEqual(settings.join, oldSettings.join)
50
- ) return;
40
+ )
41
+ return;
51
42
 
52
43
  const platforma = window.platforma;
53
44
  if (!platforma) throw Error('platforma not set');
@@ -68,39 +59,37 @@ watch(
68
59
  state.pTableParams.join = enrichedJoin;
69
60
 
70
61
  tableState.value = state;
71
- }
62
+ },
72
63
  );
73
64
 
74
- const sheets = computedAsync<PlDataTableSheet[]>(
75
- async () => {
76
- const sourceType = settings.value.sourceType;
77
- switch(sourceType) {
78
- case 'pframe': {
79
- const platforma = window.platforma;
80
- if (!platforma) throw Error('platforma not set');
65
+ const sheets = computedAsync<PlDataTableSheet[]>(async () => {
66
+ const sourceType = settings.value.sourceType;
67
+ switch (sourceType) {
68
+ case 'pframe': {
69
+ const platforma = window.platforma;
70
+ if (!platforma) throw Error('platforma not set');
81
71
 
82
- const pfDriver = platforma.pFrameDriver;
83
- if (!pfDriver) throw Error('platforma.pFrameDriver not set');
72
+ const pfDriver = platforma.pFrameDriver;
73
+ if (!pfDriver) throw Error('platforma.pFrameDriver not set');
84
74
 
85
- if (!settings.value.pFrame?.ok || !settings.value.pFrame.value) return [];
86
- const pFrame = settings.value.pFrame.value;
75
+ if (!settings.value.pFrame?.ok || !settings.value.pFrame.value) return [];
76
+ const pFrame = settings.value.pFrame.value;
87
77
 
88
- const join = tableState.value.pTableParams?.join;
89
- if (!join) return [];
78
+ const join = tableState.value.pTableParams?.join;
79
+ if (!join) return [];
90
80
 
91
- return await makeSheets(pfDriver, pFrame, settings.value.sheetAxes, join);
92
- }
93
- case 'ptable': {
94
- return settings.value.sheets ?? [];
95
- }
96
- case 'xsv': {
97
- return [];
98
- }
99
- default: throw Error(`unsupported source type: ${sourceType satisfies never}`);
81
+ return await makeSheets(pfDriver, pFrame, settings.value.sheetAxes, join);
100
82
  }
101
- },
102
- []
103
- );
83
+ case 'ptable': {
84
+ return settings.value.sheets ?? [];
85
+ }
86
+ case 'xsv': {
87
+ return [];
88
+ }
89
+ default:
90
+ throw Error(`unsupported source type: ${sourceType satisfies never}`);
91
+ }
92
+ }, []);
104
93
 
105
94
  function makeSorting(state?: SortState): PTableSorting[] | undefined {
106
95
  if (settings.value.sourceType !== 'ptable' && settings.value.sourceType !== 'pframe') return undefined;
@@ -199,7 +188,12 @@ watch(
199
188
  const [settings, sheets] = state;
200
189
  if (oldState) {
201
190
  const [oldSettings, oldSheets] = oldState;
202
- if ((settings.sourceType === 'ptable' || settings.sourceType === 'pframe') && settings.sourceType === oldSettings?.sourceType && lodash.isEqual(sheets, oldSheets)) return;
191
+ if (
192
+ (settings.sourceType === 'ptable' || settings.sourceType === 'pframe') &&
193
+ settings.sourceType === oldSettings?.sourceType &&
194
+ lodash.isEqual(sheets, oldSheets)
195
+ )
196
+ return;
203
197
  }
204
198
 
205
199
  if (settings.sourceType !== 'ptable' && settings.sourceType !== 'pframe') {
@@ -1,4 +1,5 @@
1
1
  import type { ColDef, GridApi, IDatasource, IGetRowsParams } from '@ag-grid-community/core';
2
+ import type { PFrameHandle, AxisId, PColumnIdAndSpec, JoinEntry, PObjectId } from '@platforma-sdk/model';
2
3
  import {
3
4
  type ValueType,
4
5
  type PValue,
@@ -11,12 +12,7 @@ import {
11
12
  getAxesId,
12
13
  isValueNA,
13
14
  isValueAbsent,
14
- PFrameHandle,
15
- AxisId,
16
- PColumnIdAndSpec,
17
- JoinEntry,
18
15
  mapJoinEntry,
19
- PObjectId
20
16
  } from '@platforma-sdk/model';
21
17
  import * as lodash from 'lodash';
22
18
  import canonicalize from 'canonicalize';
@@ -84,7 +80,7 @@ function toDisplayValue(value: Exclude<PValue, null>, valueType: ValueType): str
84
80
  case 'Int':
85
81
  return value as number;
86
82
  case 'Long':
87
- return typeof value === 'bigint' ? Number(value as bigint) : value as number;
83
+ return typeof value === 'bigint' ? Number(value as bigint) : (value as number);
88
84
  case 'Float':
89
85
  return value as number;
90
86
  case 'Double':
@@ -96,7 +92,7 @@ function toDisplayValue(value: Exclude<PValue, null>, valueType: ValueType): str
96
92
  default:
97
93
  throw Error(`unsupported data type: ${valueType satisfies never}`);
98
94
  }
99
- };
95
+ }
100
96
 
101
97
  function getColumnsFromJoin(join: JoinEntry<PColumnIdAndSpec>): PColumnIdAndSpec[] {
102
98
  const columns: PColumnIdAndSpec[] = [];
@@ -107,22 +103,15 @@ function getColumnsFromJoin(join: JoinEntry<PColumnIdAndSpec>): PColumnIdAndSpec
107
103
  return columns;
108
104
  }
109
105
 
110
- async function getLabelColumns(
111
- pfDriver: PFrameDriver,
112
- pFrame: PFrameHandle,
113
- idsAndSpecs: PColumnIdAndSpec[]
114
- ): Promise<PColumnIdAndSpec[]> {
106
+ async function getLabelColumns(pfDriver: PFrameDriver, pFrame: PFrameHandle, idsAndSpecs: PColumnIdAndSpec[]): Promise<PColumnIdAndSpec[]> {
115
107
  if (!idsAndSpecs.length) return [];
116
108
 
117
109
  const response = await pfDriver.findColumns(pFrame, {
118
110
  columnFilter: {
119
- name: ['pl7.app/label']
111
+ name: ['pl7.app/label'],
120
112
  },
121
- compatibleWith: lodash.uniqWith(
122
- idsAndSpecs.map((column) => getAxesId(column.spec.axesSpec).map(lodash.cloneDeep)).flat(),
123
- lodash.isEqual
124
- ),
125
- strictlyCompatible: true
113
+ compatibleWith: lodash.uniqWith(idsAndSpecs.map((column) => getAxesId(column.spec.axesSpec).map(lodash.cloneDeep)).flat(), lodash.isEqual),
114
+ strictlyCompatible: true,
126
115
  });
127
116
  return response.hits.filter((idAndSpec) => idAndSpec.spec.axesSpec.length === 1);
128
117
  }
@@ -130,7 +119,7 @@ async function getLabelColumns(
130
119
  export async function enrichJoinWithLabelColumns(
131
120
  pfDriver: PFrameDriver,
132
121
  pFrame: PFrameHandle,
133
- join: JoinEntry<PColumnIdAndSpec>
122
+ join: JoinEntry<PColumnIdAndSpec>,
134
123
  ): Promise<JoinEntry<PColumnIdAndSpec>> {
135
124
  const columns = getColumnsFromJoin(join);
136
125
  const labelColumns = await getLabelColumns(pfDriver, pFrame, columns);
@@ -142,15 +131,15 @@ export async function enrichJoinWithLabelColumns(
142
131
  secondary: missingLabelColumns.map((column) => ({
143
132
  type: 'column',
144
133
  column,
145
- }))
146
- }
134
+ })),
135
+ };
147
136
  }
148
137
 
149
138
  export async function makeSheets(
150
139
  pfDriver: PFrameDriver,
151
140
  pFrameHandle: PFrameHandle,
152
141
  sheetAxes: AxisId[],
153
- join: JoinEntry<PColumnIdAndSpec>
142
+ join: JoinEntry<PColumnIdAndSpec>,
154
143
  ): Promise<PlDataTableSheet[]> {
155
144
  const axes = sheetAxes.filter((spec) => spec.type !== 'Bytes');
156
145
 
@@ -190,7 +179,7 @@ export async function makeSheets(
190
179
  columnId: columns[column].columnId,
191
180
  ...(!labelCol[i] && { axis: lodash.cloneDeep(axes[i]) }),
192
181
  filters: [],
193
- limit
182
+ limit,
194
183
  });
195
184
  if (response.overflow) {
196
185
  labelCol.splice(i, 1);
@@ -224,14 +213,14 @@ export async function makeSheets(
224
213
  return axes.map((axis, i) => {
225
214
  const options = [...possibleValues[i]].map((value) => ({
226
215
  value: value,
227
- text: value.toString()
216
+ text: value.toString(),
228
217
  }));
229
218
  const defaultValue = options[0].value;
230
219
  return {
231
220
  axis: lodash.cloneDeep(axis),
232
221
  ...(labelCol[i] && { column: labelCol[i] }),
233
222
  options,
234
- defaultValue
223
+ defaultValue,
235
224
  } as PlDataTableSheet;
236
225
  });
237
226
  }
@@ -287,8 +276,9 @@ export async function updatePFrameGridOptions(
287
276
  datasource: IDatasource;
288
277
  }> {
289
278
  const specs = await pfDriver.getSpec(pt);
290
- const indices = [...specs.keys()]
291
- .filter((i) => !lodash.find(sheets, (sheet) => lodash.isEqual(sheet.axis, specs[i].id) || lodash.isEqual(sheet.column, specs[i].id)));
279
+ const indices = [...specs.keys()].filter(
280
+ (i) => !lodash.find(sheets, (sheet) => lodash.isEqual(sheet.axis, specs[i].id) || lodash.isEqual(sheet.column, specs[i].id)),
281
+ );
292
282
  const fields = lodash.cloneDeep(indices);
293
283
 
294
284
  for (let i = indices.length - 1; i >= 0; --i) {
@@ -1,4 +1,14 @@
1
- import type { AxisId, JoinEntry, LocalBlobHandleAndSize, PColumnIdAndSpec, PFrameHandle, PObjectId, PTableHandle, RemoteBlobHandleAndSize, ValueOrErrors } from '@platforma-sdk/model';
1
+ import type {
2
+ AxisId,
3
+ JoinEntry,
4
+ LocalBlobHandleAndSize,
5
+ PColumnIdAndSpec,
6
+ PFrameHandle,
7
+ PObjectId,
8
+ PTableHandle,
9
+ RemoteBlobHandleAndSize,
10
+ ValueOrErrors,
11
+ } from '@platforma-sdk/model';
2
12
 
3
13
  export type PlDataTableSheet = {
4
14
  /** id of the axis to use */