@platforma-sdk/ui-vue 1.79.34 → 1.80.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/.turbo/turbo-build.log +18 -18
- package/.turbo/turbo-formatter$colon$check.log +2 -2
- package/.turbo/turbo-linter$colon$check.log +1 -1
- package/.turbo/turbo-types$colon$check.log +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/components/PlAdvancedFilter/FilterEditor.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.style.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.vue.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js +124 -113
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/types.d.ts +1 -1
- package/dist/components/PlAdvancedFilter/types.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/utils.d.ts +1 -1
- package/dist/components/PlAdvancedFilter/utils.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/utils.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.style.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue.d.ts.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js +125 -121
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/compositions/useFilterableColumns.d.ts +4 -4
- package/dist/components/PlAgDataTable/sources/table-source-v2.d.ts +40 -4
- package/dist/components/PlAgDataTable/sources/table-source-v2.d.ts.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-source-v2.js +91 -56
- package/dist/components/PlAgDataTable/sources/table-source-v2.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-state-v2.d.ts.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-state-v2.js +64 -64
- package/dist/components/PlAgDataTable/sources/table-state-v2.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/value-rendering.d.ts +3 -3
- package/dist/components/PlAgDataTable/sources/value-rendering.d.ts.map +1 -1
- package/dist/components/PlAgDataTable/sources/value-rendering.js +12 -12
- package/dist/components/PlAgDataTable/sources/value-rendering.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.style.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue.d.ts.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue2.js +42 -45
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue2.js.map +1 -1
- package/dist/internal/service_factories.d.ts +4 -3
- package/dist/internal/service_factories.d.ts.map +1 -1
- package/dist/internal/service_factories.js +6 -4
- package/dist/internal/service_factories.js.map +1 -1
- package/package.json +8 -7
- package/src/components/PlAdvancedFilter/FilterEditor.vue +39 -10
- package/src/components/PlAdvancedFilter/types.ts +3 -2
- package/src/components/PlAdvancedFilter/utils.ts +1 -1
- package/src/components/PlAgDataTable/PlAgDataTableV2.vue +21 -5
- package/src/components/PlAgDataTable/sources/table-source-v2.ts +132 -31
- package/src/components/PlAgDataTable/sources/table-state-v2.ts +5 -7
- package/src/components/PlAgDataTable/sources/value-rendering.ts +7 -7
- package/src/components/PlTableFilters/PlTableFiltersV2.vue +9 -13
- package/src/internal/service_factories.ts +2 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
AnnotationDataStatus,
|
|
2
3
|
AxesSpec,
|
|
4
|
+
PlDataTableColumnsMeta,
|
|
3
5
|
PTableColumnId,
|
|
4
6
|
PTableColumnSpecAxis,
|
|
5
7
|
PTableColumnSpecColumn,
|
|
@@ -50,10 +52,6 @@ import { isJsonEqual } from "@milaboratories/helpers";
|
|
|
50
52
|
import type { DeferredCircular } from "./focus-row";
|
|
51
53
|
import { isNil, uniq } from "es-toolkit";
|
|
52
54
|
|
|
53
|
-
export function isLabelColumn(column: PTableColumnSpec): column is PTableColumnSpecColumn {
|
|
54
|
-
return column.type === "column" && isLabelColumnSpec(column.spec);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
55
|
/** Convert columnar data from the driver to rows, used by ag-grid */
|
|
58
56
|
function columns2rows(
|
|
59
57
|
fields: number[],
|
|
@@ -88,6 +86,7 @@ export async function calculateGridOptions({
|
|
|
88
86
|
sheets,
|
|
89
87
|
fullTableHandle,
|
|
90
88
|
visibleTableHandle,
|
|
89
|
+
columnsMeta,
|
|
91
90
|
dataRenderedTracker,
|
|
92
91
|
hiddenColIds,
|
|
93
92
|
cellButtonAxisParams,
|
|
@@ -97,6 +96,8 @@ export async function calculateGridOptions({
|
|
|
97
96
|
generation: Ref<number>;
|
|
98
97
|
fullTableHandle: PTableHandle;
|
|
99
98
|
visibleTableHandle: PTableHandle;
|
|
99
|
+
/** Sidecar display metadata (label/visibility/order/status/hidden axes) from the model. */
|
|
100
|
+
columnsMeta?: PlDataTableColumnsMeta;
|
|
100
101
|
dataRenderedTracker: DeferredCircular<GridApi<PlAgDataTableV2Row>>;
|
|
101
102
|
hiddenColIds?: PlTableColumnIdJson[];
|
|
102
103
|
cellButtonAxisParams?: PlAgCellButtonAxisParams;
|
|
@@ -108,13 +109,19 @@ export async function calculateGridOptions({
|
|
|
108
109
|
const stateGeneration = generation.value;
|
|
109
110
|
|
|
110
111
|
// get specs of the full table
|
|
111
|
-
const [
|
|
112
|
+
const [rawTableSpecs, rawVisibleTableSpecs] = await Promise.all([
|
|
112
113
|
pfDriver.getSpec(fullTableHandle),
|
|
113
114
|
pfDriver.getSpec(visibleTableHandle),
|
|
114
115
|
]);
|
|
115
116
|
|
|
116
117
|
if (stateGeneration !== generation.value) throw new Error("table state generation changed");
|
|
117
118
|
|
|
119
|
+
// Engine specs flow through untouched; readers below merge `columnsMeta` at
|
|
120
|
+
// their use sites via the `effective*` helpers — keeps spec === what the
|
|
121
|
+
// engine produced (matters for `colDef.context` consumers).
|
|
122
|
+
const tableSpecs = rawTableSpecs;
|
|
123
|
+
const visibleTableSpecs = rawVisibleTableSpecs;
|
|
124
|
+
|
|
118
125
|
// index mapping from full specs to visible subset (hidden columns → -1)
|
|
119
126
|
const specsToVisibleSpecsMapping = buildSpecsToVisibleSpecsMapping(tableSpecs, visibleTableSpecs);
|
|
120
127
|
|
|
@@ -125,18 +132,33 @@ export async function calculateGridOptions({
|
|
|
125
132
|
|
|
126
133
|
// displayable column indices ordered: axes first, then columns by OrderPriority
|
|
127
134
|
const fields = sortIndicesByTypeAndPriority(
|
|
128
|
-
selectDisplayableIndices(tableSpecs, isPartitionedAxis, getLabelColumnIndex),
|
|
135
|
+
selectDisplayableIndices(tableSpecs, isPartitionedAxis, getLabelColumnIndex, columnsMeta),
|
|
129
136
|
tableSpecs,
|
|
137
|
+
columnsMeta,
|
|
130
138
|
);
|
|
131
139
|
|
|
132
140
|
// default hidden columns derived from Optional annotation when no saved state
|
|
133
|
-
const resolvedHiddenColIds =
|
|
141
|
+
const resolvedHiddenColIds =
|
|
142
|
+
hiddenColIds ?? computeDefaultHiddenColIds(fields, tableSpecs, columnsMeta);
|
|
134
143
|
|
|
135
144
|
const columnDefs: ColDef<PlAgDataTableV2Row, PTableValue | PTableHidden>[] = [
|
|
136
145
|
makeRowNumberColDef(),
|
|
137
|
-
...fields.map((field) =>
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
...fields.map((field) => {
|
|
147
|
+
const spec = tableSpecs[field];
|
|
148
|
+
// Only visible columns get a status (hidden columns → undefined → no
|
|
149
|
+
// "computing/absent" placeholder rendering).
|
|
150
|
+
const visible = (specsToVisibleSpecsMapping.get(field) ?? -1) >= 0;
|
|
151
|
+
const status =
|
|
152
|
+
visible && spec.type === "column" ? columnsMeta?.columns[spec.id]?.status : undefined;
|
|
153
|
+
return makeColDef({
|
|
154
|
+
iCol: field,
|
|
155
|
+
spec,
|
|
156
|
+
dataStatus: status,
|
|
157
|
+
hiddenColIds: resolvedHiddenColIds,
|
|
158
|
+
cellButtonAxisParams,
|
|
159
|
+
columnsMeta,
|
|
160
|
+
});
|
|
161
|
+
}),
|
|
140
162
|
];
|
|
141
163
|
|
|
142
164
|
// axes — taken directly from visible table (always present as part of join)
|
|
@@ -229,15 +251,26 @@ export type PlAgCellButtonAxisParams = {
|
|
|
229
251
|
/**
|
|
230
252
|
* Calculates column definition for a given p-table column
|
|
231
253
|
*/
|
|
232
|
-
export function makeColDef(
|
|
233
|
-
iCol
|
|
234
|
-
spec
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
254
|
+
export function makeColDef({
|
|
255
|
+
iCol,
|
|
256
|
+
spec,
|
|
257
|
+
dataStatus,
|
|
258
|
+
hiddenColIds,
|
|
259
|
+
cellButtonAxisParams,
|
|
260
|
+
columnsMeta,
|
|
261
|
+
}: {
|
|
262
|
+
iCol: number;
|
|
263
|
+
spec: PTableColumnSpec;
|
|
264
|
+
/** Per-column rendering status from the model; `undefined` for hidden cols. */
|
|
265
|
+
dataStatus: AnnotationDataStatus | undefined;
|
|
266
|
+
hiddenColIds: PlTableColumnIdJson[] | undefined;
|
|
267
|
+
cellButtonAxisParams?: PlAgCellButtonAxisParams;
|
|
268
|
+
/** Sidecar meta used to resolve the effective header label. */
|
|
269
|
+
columnsMeta?: PlDataTableColumnsMeta;
|
|
270
|
+
}): ColDef<PlAgDataTableV2Row, PTableValue | PTableHidden> {
|
|
238
271
|
const colId = canonicalizeJson<PTableColumnId>(getPTableColumnId(spec));
|
|
239
272
|
const valueType = spec.type === "axis" ? spec.spec.type : spec.spec.valueType;
|
|
240
|
-
const columnRenderingSpec = getColumnRenderingSpec(spec);
|
|
273
|
+
const columnRenderingSpec = getColumnRenderingSpec(spec, dataStatus);
|
|
241
274
|
const cellStyle: CellStyle = {};
|
|
242
275
|
if (columnRenderingSpec.fontFamily) {
|
|
243
276
|
if (columnRenderingSpec.fontFamily === "monospace") {
|
|
@@ -247,8 +280,7 @@ export function makeColDef(
|
|
|
247
280
|
cellStyle.fontFamily = columnRenderingSpec.fontFamily;
|
|
248
281
|
}
|
|
249
282
|
}
|
|
250
|
-
const headerName =
|
|
251
|
-
readAnnotation(spec.spec, Annotation.Label)?.trim() ?? `Unlabeled ${spec.type} ${iCol}`;
|
|
283
|
+
const headerName = effectiveLabel(spec, columnsMeta)?.trim() ?? `Unlabeled ${spec.type} ${iCol}`;
|
|
252
284
|
|
|
253
285
|
return {
|
|
254
286
|
colId,
|
|
@@ -318,6 +350,70 @@ export function makeColDef(
|
|
|
318
350
|
};
|
|
319
351
|
}
|
|
320
352
|
|
|
353
|
+
export function isLabelColumn(column: PTableColumnSpec): column is PTableColumnSpecColumn {
|
|
354
|
+
return column.type === "column" && isLabelColumnSpec(column.spec);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Effective column label: sidecar override wins over intrinsic spec
|
|
359
|
+
* annotation. Axes have no label override in the sidecar — they fall through
|
|
360
|
+
* to `pl7.app/label` on the axis spec.
|
|
361
|
+
*/
|
|
362
|
+
export function effectiveLabel(
|
|
363
|
+
spec: PTableColumnSpec,
|
|
364
|
+
meta: PlDataTableColumnsMeta | undefined,
|
|
365
|
+
): string | undefined {
|
|
366
|
+
if (spec.type === "column") {
|
|
367
|
+
const override = meta?.columns[spec.id]?.label;
|
|
368
|
+
if (override !== undefined) return override;
|
|
369
|
+
}
|
|
370
|
+
return readAnnotation(spec.spec, Annotation.Label);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Effective visibility. For columns: sidecar override wins over the intrinsic
|
|
375
|
+
* `pl7.app/table/visibility` annotation. For axes: `meta.axes[id].hidden`
|
|
376
|
+
* forces hidden; otherwise the intrinsic axis annotation rules.
|
|
377
|
+
*
|
|
378
|
+
* Kept out of the spec on purpose — baking visibility into a column spec via
|
|
379
|
+
* override changes its `ColumnUniversalId`, so the same physical column reached
|
|
380
|
+
* two ways (e.g. as primary and as a discovered label) would diverge into two
|
|
381
|
+
* ids and render twice. The sidecar preserves identity; readers apply this at
|
|
382
|
+
* use sites.
|
|
383
|
+
*/
|
|
384
|
+
export function effectiveVisibility(
|
|
385
|
+
spec: PTableColumnSpec,
|
|
386
|
+
meta: PlDataTableColumnsMeta | undefined,
|
|
387
|
+
): "default" | "optional" | "hidden" {
|
|
388
|
+
if (spec.type === "axis") {
|
|
389
|
+
if (meta?.axes[canonicalizeJson<AxisId>(getAxisId(spec.id))]?.hidden === true) return "hidden";
|
|
390
|
+
} else {
|
|
391
|
+
const override = meta?.columns[spec.id]?.visibility;
|
|
392
|
+
if (override !== undefined) return override;
|
|
393
|
+
}
|
|
394
|
+
if (isColumnHidden(spec.spec)) return "hidden";
|
|
395
|
+
if (isColumnOptional(spec.spec)) return "optional";
|
|
396
|
+
return "default";
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Effective order priority — number suitable for left-to-right comparison
|
|
401
|
+
* (higher = further left). Sidecar override on columns wins over the
|
|
402
|
+
* intrinsic `pl7.app/table/orderPriority`; axes have no override.
|
|
403
|
+
* `undefined` when neither source supplied a value (consumer decides default).
|
|
404
|
+
*/
|
|
405
|
+
export function effectiveOrder(
|
|
406
|
+
spec: PTableColumnSpec,
|
|
407
|
+
meta: PlDataTableColumnsMeta | undefined,
|
|
408
|
+
): number | undefined {
|
|
409
|
+
if (spec.type === "column") {
|
|
410
|
+
const override = meta?.columns[spec.id]?.order;
|
|
411
|
+
if (override !== undefined) return override;
|
|
412
|
+
}
|
|
413
|
+
const raw = readAnnotationJson(spec.spec, Annotation.Table.OrderPriority);
|
|
414
|
+
return raw as number | undefined;
|
|
415
|
+
}
|
|
416
|
+
|
|
321
417
|
/** Build index mapping from full tableSpecs to their position in visibleTableSpecs (missing → -1). */
|
|
322
418
|
function buildSpecsToVisibleSpecsMapping(
|
|
323
419
|
tableSpecs: PTableColumnSpec[],
|
|
@@ -370,6 +466,7 @@ function selectDisplayableIndices(
|
|
|
370
466
|
tableSpecs: PTableColumnSpec[],
|
|
371
467
|
isPartitionedAxis: (axisId: AxisId) => boolean,
|
|
372
468
|
getLabelColumnIndex: (axisId: AxisId) => number,
|
|
469
|
+
meta: PlDataTableColumnsMeta | undefined,
|
|
373
470
|
): number[] {
|
|
374
471
|
return tableSpecs
|
|
375
472
|
.entries()
|
|
@@ -377,11 +474,12 @@ function selectDisplayableIndices(
|
|
|
377
474
|
switch (spec.type) {
|
|
378
475
|
case "axis":
|
|
379
476
|
return (
|
|
380
|
-
!(getLabelColumnIndex(spec.id) > -1
|
|
381
|
-
|
|
477
|
+
!(getLabelColumnIndex(spec.id) > -1
|
|
478
|
+
? true
|
|
479
|
+
: effectiveVisibility(spec, meta) === "hidden") && !isPartitionedAxis(spec.id)
|
|
382
480
|
);
|
|
383
481
|
case "column":
|
|
384
|
-
return
|
|
482
|
+
return effectiveVisibility(spec, meta) !== "hidden" && !isLinkerColumnSpec(spec.spec);
|
|
385
483
|
}
|
|
386
484
|
})
|
|
387
485
|
.map(([i]) => i)
|
|
@@ -389,14 +487,15 @@ function selectDisplayableIndices(
|
|
|
389
487
|
}
|
|
390
488
|
|
|
391
489
|
/** Sort: axes first, then columns by OrderPriority annotation (higher priority = further left). */
|
|
392
|
-
function sortIndicesByTypeAndPriority(
|
|
490
|
+
function sortIndicesByTypeAndPriority(
|
|
491
|
+
indices: number[],
|
|
492
|
+
tableSpecs: PTableColumnSpec[],
|
|
493
|
+
meta: PlDataTableColumnsMeta | undefined,
|
|
494
|
+
): number[] {
|
|
393
495
|
const priorityOf = (i: number): number => {
|
|
394
496
|
const spec = tableSpecs[i];
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
? Infinity
|
|
398
|
-
: Number(readAnnotationJson(spec.spec, Annotation.Table.OrderPriority));
|
|
399
|
-
|
|
497
|
+
if (spec.type === "axis" || isLabelColumnSpec(spec.spec)) return Infinity;
|
|
498
|
+
const prior = Number(effectiveOrder(spec, meta));
|
|
400
499
|
return isNaN(prior) ? 0 : prior;
|
|
401
500
|
};
|
|
402
501
|
return [...indices].sort((a, b) => priorityOf(b) - priorityOf(a));
|
|
@@ -406,12 +505,14 @@ function sortIndicesByTypeAndPriority(indices: number[], tableSpecs: PTableColum
|
|
|
406
505
|
function computeDefaultHiddenColIds(
|
|
407
506
|
fields: number[],
|
|
408
507
|
tableSpecs: PTableColumnSpec[],
|
|
508
|
+
meta: PlDataTableColumnsMeta | undefined,
|
|
409
509
|
): PlTableColumnIdJson[] {
|
|
410
510
|
return fields.reduce<PlTableColumnIdJson[]>((acc, field) => {
|
|
411
511
|
const spec = tableSpecs[field];
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
512
|
+
if (spec.type === "column" && effectiveVisibility(spec, meta) === "optional") {
|
|
513
|
+
acc.push(canonicalizeJson<PTableColumnId>(getPTableColumnId(spec)));
|
|
514
|
+
}
|
|
515
|
+
return acc;
|
|
415
516
|
}, []);
|
|
416
517
|
}
|
|
417
518
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createDefaultPTableParams,
|
|
3
3
|
parseJson,
|
|
4
|
-
canonicalizeJson,
|
|
5
4
|
upgradePlDataTableStateV2,
|
|
6
5
|
type FilterSpec,
|
|
7
6
|
type FilterSpecLeaf,
|
|
@@ -20,7 +19,6 @@ import {
|
|
|
20
19
|
distillFilterSpec,
|
|
21
20
|
PlDataTableFiltersWithMeta,
|
|
22
21
|
getPTableColumnId,
|
|
23
|
-
CanonicalizedJson,
|
|
24
22
|
} from "@platforma-sdk/model";
|
|
25
23
|
import { computed, type Ref, type WritableComputedRef } from "vue";
|
|
26
24
|
import type { PlDataTableSettingsV2 } from "../types";
|
|
@@ -334,16 +332,16 @@ function stripSuppressedFilters(node: PlDataTableFiltersWithMeta): PlDataTableFi
|
|
|
334
332
|
function createSearchFilterNode(
|
|
335
333
|
columns: PTableColumnSpec[],
|
|
336
334
|
search: null | undefined | string,
|
|
337
|
-
): null | FilterSpec<FilterSpecLeaf<
|
|
335
|
+
): null | FilterSpec<FilterSpecLeaf<PTableColumnId>> {
|
|
338
336
|
const trimmed = search?.trim();
|
|
339
337
|
if (isNil(trimmed) || trimmed.length === 0) return null;
|
|
340
338
|
|
|
341
|
-
const parts: FilterSpec<FilterSpecLeaf<
|
|
339
|
+
const parts: FilterSpec<FilterSpecLeaf<PTableColumnId>>[] = [];
|
|
342
340
|
const numericValue = Number(trimmed);
|
|
343
341
|
const isValidNumber = trimmed.length > 0 && !isNaN(numericValue) && isFinite(numericValue);
|
|
344
342
|
|
|
345
343
|
for (const col of columns) {
|
|
346
|
-
const column =
|
|
344
|
+
const column = getPTableColumnId(col);
|
|
347
345
|
const spec = col.spec;
|
|
348
346
|
|
|
349
347
|
if (isStringValueType(spec)) {
|
|
@@ -406,9 +404,9 @@ function annotateNodeWithIds(
|
|
|
406
404
|
|
|
407
405
|
function convertPartitionFiltersToFilterSpec(
|
|
408
406
|
sheetsState: PlDataTableSheetState[],
|
|
409
|
-
): FilterSpec<FilterSpecLeaf<
|
|
407
|
+
): FilterSpec<FilterSpecLeaf<PTableColumnId>>[] {
|
|
410
408
|
return sheetsState.map((s) => {
|
|
411
|
-
const column =
|
|
409
|
+
const column: PTableColumnId = { type: "axis", id: s.axisId };
|
|
412
410
|
return typeof s.value === "number"
|
|
413
411
|
? { type: "equal" as const, column, x: s.value }
|
|
414
412
|
: { type: "patternEquals" as const, column, value: s.value };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Annotation,
|
|
3
|
+
AnnotationDataStatus,
|
|
3
4
|
PTableNA,
|
|
4
5
|
readAnnotation,
|
|
5
6
|
ValueType,
|
|
@@ -14,7 +15,7 @@ import type { PlAgDataTableV2Row } from "../types";
|
|
|
14
15
|
|
|
15
16
|
export function formatSpecialValues(
|
|
16
17
|
value: undefined | PTableValue | PTableHidden,
|
|
17
|
-
dataStatus: undefined |
|
|
18
|
+
dataStatus: undefined | AnnotationDataStatus,
|
|
18
19
|
): string | undefined {
|
|
19
20
|
if (dataStatus === "absent") {
|
|
20
21
|
return "absent";
|
|
@@ -36,7 +37,10 @@ export type ColumnRenderingSpec = {
|
|
|
36
37
|
fontFamily?: string;
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
export function getColumnRenderingSpec(
|
|
40
|
+
export function getColumnRenderingSpec(
|
|
41
|
+
spec: PTableColumnSpec,
|
|
42
|
+
dataStatus: undefined | AnnotationDataStatus,
|
|
43
|
+
): ColumnRenderingSpec {
|
|
40
44
|
const valueType = spec.type === "axis" ? spec.spec.type : spec.spec.valueType;
|
|
41
45
|
let renderSpec: ColumnRenderingSpec;
|
|
42
46
|
switch (valueType) {
|
|
@@ -45,7 +49,6 @@ export function getColumnRenderingSpec(spec: PTableColumnSpec): ColumnRenderingS
|
|
|
45
49
|
case ValueType.Float:
|
|
46
50
|
case ValueType.Double: {
|
|
47
51
|
const format = readAnnotation(spec.spec, Annotation.Format);
|
|
48
|
-
const dataStatus = readAnnotation(spec.spec, Annotation.DataStatus);
|
|
49
52
|
const formatFn = format ? d3.format(format) : undefined;
|
|
50
53
|
renderSpec = {
|
|
51
54
|
valueFormatter: (params) => {
|
|
@@ -59,10 +62,7 @@ export function getColumnRenderingSpec(spec: PTableColumnSpec): ColumnRenderingS
|
|
|
59
62
|
default:
|
|
60
63
|
renderSpec = {
|
|
61
64
|
valueFormatter: (params) => {
|
|
62
|
-
const formatted = formatSpecialValues(
|
|
63
|
-
params.value,
|
|
64
|
-
readAnnotation(spec.spec, Annotation.DataStatus),
|
|
65
|
-
);
|
|
65
|
+
const formatted = formatSpecialValues(params.value, dataStatus);
|
|
66
66
|
if (formatted !== undefined) return formatted;
|
|
67
67
|
return params.value?.toString() ?? "";
|
|
68
68
|
},
|
|
@@ -4,16 +4,14 @@ import type {
|
|
|
4
4
|
PlDataTableFiltersWithMeta,
|
|
5
5
|
PFrameHandle,
|
|
6
6
|
PTableColumnId,
|
|
7
|
-
CanonicalizedJson,
|
|
8
7
|
} from "@platforma-sdk/model";
|
|
9
8
|
import {
|
|
10
|
-
canonicalizeJson,
|
|
11
9
|
Annotation,
|
|
12
10
|
Domain,
|
|
13
11
|
readAnnotation,
|
|
14
12
|
readDomain,
|
|
15
13
|
getUniqueSourceValuesWithLabels,
|
|
16
|
-
|
|
14
|
+
extractPObjectId,
|
|
17
15
|
getPTableColumnId,
|
|
18
16
|
} from "@platforma-sdk/model";
|
|
19
17
|
import { computed, ref } from "vue";
|
|
@@ -68,7 +66,7 @@ const onUpdateFilters = (_value: PlAdvancedFilter) => {
|
|
|
68
66
|
|
|
69
67
|
const options = computed<PlAdvancedFilterItem[]>(() => {
|
|
70
68
|
return props.columns.map((col, idx) => {
|
|
71
|
-
const id =
|
|
69
|
+
const id = getPTableColumnId(col);
|
|
72
70
|
const label =
|
|
73
71
|
readAnnotation(col.spec, Annotation.Label)?.trim() ?? `Unlabeled ${col.type} ${idx}`;
|
|
74
72
|
const alphabet =
|
|
@@ -112,25 +110,23 @@ function handleSuggestOptions(params: {
|
|
|
112
110
|
return [];
|
|
113
111
|
}
|
|
114
112
|
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
const tableColumnId = params.columnId as PTableColumnId;
|
|
114
|
+
if (
|
|
115
|
+
typeof tableColumnId !== "object" ||
|
|
116
|
+
tableColumnId === null ||
|
|
117
|
+
tableColumnId.type !== "column"
|
|
118
|
+
) {
|
|
119
119
|
throw new Error("ColumnId should be of type 'column' for suggest options");
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
return getUniqueSourceValuesWithLabels(props.pframeHandle, {
|
|
123
|
-
columnId: tableColumnId.id,
|
|
123
|
+
columnId: extractPObjectId(tableColumnId.id),
|
|
124
124
|
axisIdx: params.axisIdx,
|
|
125
125
|
limit: 100,
|
|
126
126
|
searchQuery: params.searchType === "label" ? params.searchStr : undefined,
|
|
127
127
|
searchQueryValue: params.searchType === "value" ? params.searchStr : undefined,
|
|
128
128
|
}).then((v) => v.values);
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
function makeFilterColumnId(spec: PTableColumnSpec): CanonicalizedJson<PTableColumnId> {
|
|
132
|
-
return canonicalizeJson<PTableColumnId>(getPTableColumnId(spec));
|
|
133
|
-
}
|
|
134
130
|
</script>
|
|
135
131
|
|
|
136
132
|
<template>
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { Services, UiServiceRegistry } from "@milaboratories/pl-model-common";
|
|
11
11
|
import { SpecDriver } from "@milaboratories/pf-spec-driver";
|
|
12
|
+
import { ColumnsCollectionDriverImpl } from "@milaboratories/columns-collection-driver";
|
|
12
13
|
import type { ServiceProxy } from "@platforma-sdk/model";
|
|
13
14
|
|
|
14
15
|
export type UiServiceOptions = {
|
|
@@ -20,5 +21,6 @@ export function createUiServiceRegistry(options: UiServiceOptions) {
|
|
|
20
21
|
PFrameSpec: () => new SpecDriver(),
|
|
21
22
|
PFrame: () => options.proxy(Services.PFrame),
|
|
22
23
|
Dialog: () => options.proxy(Services.Dialog),
|
|
24
|
+
ColumnsCollection: () => new ColumnsCollectionDriverImpl(),
|
|
23
25
|
});
|
|
24
26
|
}
|