@platforma-sdk/model 1.24.5 → 1.24.9

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/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const PlatformaSDKVersion = "1.24.5";
1
+ export declare const PlatformaSDKVersion = "1.24.9";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/model",
3
- "version": "1.24.5",
3
+ "version": "1.24.9",
4
4
  "description": "Platforma.bio SDK / Block Model",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "utility-types": "^3.11.0",
22
22
  "zod": "~3.23.8",
23
- "@milaboratories/pl-model-common": "^1.11.1"
23
+ "@milaboratories/pl-model-common": "^1.11.2"
24
24
  },
25
25
  "devDependencies": {
26
26
  "typescript": "~5.5.4",
@@ -29,8 +29,8 @@
29
29
  "jest": "^29.7.0",
30
30
  "@jest/globals": "^29.7.0",
31
31
  "ts-jest": "^29.2.6",
32
- "@milaboratories/platforma-build-configs": "1.0.3",
33
- "@platforma-sdk/eslint-config": "1.0.2"
32
+ "@platforma-sdk/eslint-config": "1.0.2",
33
+ "@milaboratories/platforma-build-configs": "1.0.3"
34
34
  },
35
35
  "scripts": {
36
36
  "type-check": "node ./scripts/save-package-version.cjs && tsc --noEmit --composite false",
@@ -1,9 +1,6 @@
1
- import {
1
+ import type {
2
2
  AxisSpec,
3
- getAxisId,
4
- isPColumn,
5
3
  JoinEntry,
6
- matchAxisId,
7
4
  PColumn,
8
5
  PColumnIdAndSpec,
9
6
  PColumnSpec,
@@ -11,12 +8,23 @@ import {
11
8
  PObjectId,
12
9
  PTableHandle,
13
10
  PTableRecordFilter,
14
- PTableSorting
11
+ PTableSorting,
15
12
  } from '@milaboratories/pl-model-common';
16
- import { RenderCtx, TreeNodeAccessor } from '../render';
13
+ import {
14
+ getAxisId,
15
+ isPColumn,
16
+ matchAxisId,
17
+ } from '@milaboratories/pl-model-common';
18
+ import type { RenderCtx } from '../render';
19
+ import { TreeNodeAccessor } from '../render';
17
20
 
18
21
  /** Data table state */
19
22
  export type PlDataTableGridState = {
23
+ // TODO request stable key from the driver
24
+ /**
25
+ * Hash of the specs for now, but in the future it will be a stable id of the source
26
+ */
27
+ sourceId?: string;
20
28
  /** Includes column ordering */
21
29
  columnOrder?: {
22
30
  /** All colIds in order */
@@ -37,11 +45,13 @@ export type PlDataTableGridState = {
37
45
  /** All colIds which were hidden */
38
46
  hiddenColIds: string[];
39
47
  };
40
-
41
48
  /** current sheet selections */
42
49
  sheets?: Record<string, string | number>;
43
50
  };
44
51
 
52
+ /** TODO: refactor to use sheets in the grid state */
53
+ export type PlDataTableGridStateWithoutSheets = Omit<PlDataTableGridState, 'sheets'>;
54
+
45
55
  export type PlDataTableSheet = {
46
56
  /** spec of the axis to use */
47
57
  axis: AxisSpec;
@@ -338,7 +348,7 @@ export function createPlDataTable<A, U>(
338
348
  ctx: RenderCtx<A, U>,
339
349
  columns: PColumn<TreeNodeAccessor | PColumnValues>[],
340
350
  tableState: PlDataTableState | undefined,
341
- ops?: PTableRecordFilter[] | CreatePlDataTableOps
351
+ ops?: PTableRecordFilter[] | CreatePlDataTableOps,
342
352
  ): PTableHandle | undefined {
343
353
  // ops migration for backward compatibility with previous deprecated API
344
354
  if (Array.isArray(ops)) {
@@ -380,9 +390,9 @@ export function createPlDataTable<A, U>(
380
390
  id: id as PObjectId,
381
391
  spec: {
382
392
  ...labelColumn.spec,
383
- axesSpec: [{ ...axisId, annotations: labelAxis.annotations }]
393
+ axesSpec: [{ ...axisId, annotations: labelAxis.annotations }],
384
394
  },
385
- data: labelColumn.data
395
+ data: labelColumn.data,
386
396
  });
387
397
  } else {
388
398
  labelColumns.set(colId(labelColumn.id), labelColumn);
@@ -395,7 +405,7 @@ export function createPlDataTable<A, U>(
395
405
  // if at least one column is not yet ready, we can't show the table
396
406
  if (
397
407
  [...columns, ...labelColumns.values()].some(
398
- (a) => a.data instanceof TreeNodeAccessor && !a.data.getIsReadyOrError()
408
+ (a) => a.data instanceof TreeNodeAccessor && !a.data.getIsReadyOrError(),
399
409
  )
400
410
  )
401
411
  return undefined;
@@ -417,12 +427,12 @@ export function createPlDataTable<A, U>(
417
427
  type: 'outer',
418
428
  primary: {
419
429
  type: ops?.coreJoinType ?? 'full',
420
- entries: coreColumns.map((c) => ({ type: 'column', column: c }))
430
+ entries: coreColumns.map((c) => ({ type: 'column', column: c })),
421
431
  },
422
- secondary: secondaryColumns.map((c) => ({ type: 'column', column: c }))
432
+ secondary: secondaryColumns.map((c) => ({ type: 'column', column: c })),
423
433
  },
424
434
  filters: [...(ops?.filters ?? []), ...(tableState?.pTableParams?.filters ?? [])],
425
- sorting: tableState?.pTableParams?.sorting ?? []
435
+ sorting: tableState?.pTableParams?.sorting ?? [],
426
436
  });
427
437
  }
428
438
 
@@ -430,15 +440,15 @@ export function createPlDataTable<A, U>(
430
440
  export function createPlDataTableSheet<A, U>(
431
441
  ctx: RenderCtx<A, U>,
432
442
  axis: AxisSpec,
433
- values: (string | number)[]
443
+ values: (string | number)[],
434
444
  ): PlDataTableSheet {
435
445
  const labels = ctx.findLabels(axis);
436
446
  return {
437
447
  axis,
438
448
  options: values.map((v) => ({
439
449
  value: v,
440
- label: labels?.[v] ?? v.toString()
450
+ label: labels?.[v] ?? v.toString(),
441
451
  })),
442
- defaultValue: values[0]
452
+ defaultValue: values[0],
443
453
  };
444
454
  }