@platforma-sdk/ui-vue 1.9.3 → 1.10.2
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/CHANGELOG.md +17 -0
- package/dist/lib.js +7496 -7082
- package/dist/lib.umd.cjs +34 -34
- package/dist/src/components/PlAgDataTable/PlAgDataTable.vue.d.ts +3 -1
- package/dist/src/components/PlAgDataTable/PlAgDataTable.vue.d.ts.map +1 -1
- package/dist/src/components/PlAgDataTable/PlTableFilters.vue.d.ts +17 -0
- package/dist/src/components/PlAgDataTable/PlTableFilters.vue.d.ts.map +1 -0
- package/dist/src/components/PlAgDataTable/sources/table-source.d.ts +3 -3
- package/dist/src/components/PlAgDataTable/sources/table-source.d.ts.map +1 -1
- package/dist/src/components/PlAgDataTable/types.d.ts +15 -1
- package/dist/src/components/PlAgDataTable/types.d.ts.map +1 -1
- package/dist/src/lib.d.ts +2 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/PlAgDataTable/PlAgDataTable.vue +49 -26
- package/src/components/PlAgDataTable/PlTableFilters.vue +471 -0
- package/src/components/PlAgDataTable/sources/table-source.ts +20 -23
- package/src/components/PlAgDataTable/types.ts +19 -0
- package/src/lib.ts +2 -1
|
@@ -3,7 +3,6 @@ import type { AxisId, JoinEntry, PColumnIdAndSpec, PFrameHandle, PObjectId } fro
|
|
|
3
3
|
import {
|
|
4
4
|
type PColumnSpec,
|
|
5
5
|
type PFrameDriver,
|
|
6
|
-
type PTableColumnId,
|
|
7
6
|
type PTableColumnSpec,
|
|
8
7
|
type PTableHandle,
|
|
9
8
|
type PTableVector,
|
|
@@ -23,17 +22,14 @@ import { getHeterogeneousColumns, updatePFrameGridOptionsHeterogeneousAxes } fro
|
|
|
23
22
|
* Generate unique colId based on the column spec.
|
|
24
23
|
*/
|
|
25
24
|
function makeColId(spec: PTableColumnSpec) {
|
|
26
|
-
return canonicalize(
|
|
27
|
-
type: spec.type,
|
|
28
|
-
id: spec.id,
|
|
29
|
-
})!;
|
|
25
|
+
return canonicalize(spec)!;
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
/**
|
|
33
29
|
* Extract `PTableColumnId` from colId string
|
|
34
30
|
*/
|
|
35
31
|
export function parseColId(str: string) {
|
|
36
|
-
return JSON.parse(str) as
|
|
32
|
+
return JSON.parse(str) as PTableColumnSpec;
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
// do not use `any` please
|
|
@@ -234,7 +230,7 @@ export async function makeSheets(
|
|
|
234
230
|
export type PlAgDataTableRow = {
|
|
235
231
|
id: string;
|
|
236
232
|
key: unknown[];
|
|
237
|
-
[field: `${number}`]:
|
|
233
|
+
[field: `${number}`]: undefined | null | number | string;
|
|
238
234
|
};
|
|
239
235
|
|
|
240
236
|
/**
|
|
@@ -245,7 +241,7 @@ export type PlAgDataTableRow = {
|
|
|
245
241
|
* @returns
|
|
246
242
|
*/
|
|
247
243
|
function columns2rows(fields: number[], columns: PTableVector[], axes: number[], index: number): PlAgDataTableRow[] {
|
|
248
|
-
const nCols =
|
|
244
|
+
const nCols = fields.length;
|
|
249
245
|
const rowData: PlAgDataTableRow[] = [];
|
|
250
246
|
for (let iRow = 0; iRow < columns[0].data.length; ++iRow) {
|
|
251
247
|
const key: unknown[] = [];
|
|
@@ -332,6 +328,19 @@ export async function updatePFrameGridOptions(
|
|
|
332
328
|
fields.splice(i, 1);
|
|
333
329
|
}
|
|
334
330
|
|
|
331
|
+
const ptShape = await pfDriver.getShape(pt);
|
|
332
|
+
const rowCount = ptShape.rows;
|
|
333
|
+
const columnDefs = fields.map((i) => getColDef(i, specs[i], hiddenColIds));
|
|
334
|
+
|
|
335
|
+
if (hColumns.length > 1) {
|
|
336
|
+
console.warn('Currently, only one heterogeneous axis is supported in the table, got', hColumns.length, ' transposition will not be applied.');
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (hColumns.length === 1) {
|
|
340
|
+
// return data
|
|
341
|
+
return updatePFrameGridOptionsHeterogeneousAxes(hColumns, ptShape, columnDefs, await pfDriver.getData(pt, indices), fields, indices);
|
|
342
|
+
}
|
|
343
|
+
|
|
335
344
|
// mixing in axis indices
|
|
336
345
|
|
|
337
346
|
const allIndices = [...indices];
|
|
@@ -362,19 +371,6 @@ export async function updatePFrameGridOptions(
|
|
|
362
371
|
axes.push(fieldIdx);
|
|
363
372
|
}
|
|
364
373
|
|
|
365
|
-
const ptShape = await pfDriver.getShape(pt);
|
|
366
|
-
const rowCount = ptShape.rows;
|
|
367
|
-
const columnDefs = fields.map((i) => getColDef(i, specs[i], hiddenColIds));
|
|
368
|
-
|
|
369
|
-
if (hColumns.length > 1) {
|
|
370
|
-
console.warn('Currently, only one heterogeneous axis is supported in the table, got', hColumns.length, ' transposition will not be applied.');
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
if (hColumns.length === 1) {
|
|
374
|
-
// return data
|
|
375
|
-
return updatePFrameGridOptionsHeterogeneousAxes(hColumns, ptShape, columnDefs, await pfDriver.getData(pt, indices), fields, indices);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
374
|
let lastParams: IServerSideGetRowsParams | undefined = undefined;
|
|
379
375
|
const serverSideDatasource = {
|
|
380
376
|
getRows: async (params: IServerSideGetRowsParams) => {
|
|
@@ -389,8 +385,8 @@ export async function updatePFrameGridOptions(
|
|
|
389
385
|
// this is to avoid double flickering when underlying table is changed
|
|
390
386
|
if (lastParams && !lodash.isEqual(lastParams.request.sortModel, params.request.sortModel)) {
|
|
391
387
|
lastParams = undefined;
|
|
392
|
-
params.fail();
|
|
393
388
|
params.api.setGridOption('loading', true);
|
|
389
|
+
params.success({ rowData: [], rowCount: 0 });
|
|
394
390
|
return;
|
|
395
391
|
}
|
|
396
392
|
lastParams = params;
|
|
@@ -412,8 +408,9 @@ export async function updatePFrameGridOptions(
|
|
|
412
408
|
params.api.autoSizeAllColumns();
|
|
413
409
|
params.api.setGridOption('loading', false);
|
|
414
410
|
} catch (error: unknown) {
|
|
415
|
-
params.fail();
|
|
416
411
|
params.api.setGridOption('loading', true);
|
|
412
|
+
params.fail();
|
|
413
|
+
console.trace(error);
|
|
417
414
|
}
|
|
418
415
|
},
|
|
419
416
|
} satisfies IServerSideDatasource;
|
|
@@ -4,7 +4,10 @@ import type {
|
|
|
4
4
|
LocalBlobHandleAndSize,
|
|
5
5
|
PColumnIdAndSpec,
|
|
6
6
|
PFrameHandle,
|
|
7
|
+
PlTableFilter,
|
|
8
|
+
PlTableFilterType,
|
|
7
9
|
PObjectId,
|
|
10
|
+
PTableColumnId,
|
|
8
11
|
PTableHandle,
|
|
9
12
|
RemoteBlobHandleAndSize,
|
|
10
13
|
ValueOrErrors,
|
|
@@ -53,3 +56,19 @@ export type PlDataTableSettings =
|
|
|
53
56
|
sourceType: 'xsv';
|
|
54
57
|
xsvFile: ValueOrErrors<RemoteBlobHandleAndSize | undefined> | ValueOrErrors<LocalBlobHandleAndSize | undefined> | undefined;
|
|
55
58
|
};
|
|
59
|
+
|
|
60
|
+
/** PlTableFilters restriction entry */
|
|
61
|
+
export type PlTableFiltersRestriction = {
|
|
62
|
+
/** Spec of the column for which filter types should be restricted */
|
|
63
|
+
column: PTableColumnId;
|
|
64
|
+
/** List of filter types applicable to the column */
|
|
65
|
+
allowedFilterTypes: PlTableFilterType[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** PlTableFilters default settings entry */
|
|
69
|
+
export type PlTableFiltersDefault = {
|
|
70
|
+
/** Spec of the column the default should be applied */
|
|
71
|
+
column: PTableColumnId;
|
|
72
|
+
/** Filter entry */
|
|
73
|
+
default: PlTableFilter;
|
|
74
|
+
};
|
package/src/lib.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import './assets/ui.scss';
|
|
2
2
|
import BlockLayout from './components/BlockLayout.vue';
|
|
3
3
|
import PlAgDataTable from './components/PlAgDataTable/PlAgDataTable.vue';
|
|
4
|
+
import PlTableFilters from './components/PlAgDataTable/PlTableFilters.vue';
|
|
4
5
|
import PlAgOverlayLoading from './components/PlAgDataTable/PlAgOverlayLoading.vue';
|
|
5
6
|
import PlAgOverlayNoRows from './components/PlAgDataTable/PlAgOverlayNoRows.vue';
|
|
6
7
|
import ValueOrErrorsComponent from './components/ValueOrErrorsComponent.vue';
|
|
7
8
|
|
|
8
|
-
export { BlockLayout, PlAgDataTable, PlAgOverlayLoading, PlAgOverlayNoRows, ValueOrErrorsComponent };
|
|
9
|
+
export { BlockLayout, PlAgDataTable, PlTableFilters, PlAgOverlayLoading, PlAgOverlayNoRows, ValueOrErrorsComponent };
|
|
9
10
|
|
|
10
11
|
export * from './components/PlAgCellFile';
|
|
11
12
|
|