@platforma-sdk/model 1.20.6 → 1.20.11

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.20.6";
1
+ export declare const PlatformaSDKVersion = "1.20.11";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,WAAW,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/model",
3
- "version": "1.20.6",
3
+ "version": "1.20.11",
4
4
  "description": "Platforma.bio SDK / Block Model",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -234,7 +234,7 @@ export type PlTableFilterStringContainsFuzzyMatch = {
234
234
  */
235
235
  substitutionsOnly: boolean;
236
236
  /**
237
- * Single character in {@link reference} that will match any
237
+ * Single character in {@link reference} that will labelColumn any
238
238
  * single character in searched text.
239
239
  */
240
240
  wildcard?: string;
@@ -269,7 +269,7 @@ export type PlTableFiltersStateEntry = {
269
269
  filter: PlTableFilter;
270
270
  /** Flag to temporarily disable filter */
271
271
  disabled: boolean;
272
- }
272
+ };
273
273
 
274
274
  /** PlTableFiltersModel state */
275
275
  export type PlTableFiltersState = PlTableFiltersStateEntry[];
@@ -302,22 +302,53 @@ export function createPlDataTable<A, U>(
302
302
  .filter(isPColumn)
303
303
  .filter((p) => p.spec.name === 'pl7.app/label' && p.spec.axesSpec.length === 1);
304
304
 
305
- const labelColumns = new Map<PObjectId, PColumn<TreeNodeAccessor>>();
305
+ const colId = (id: PObjectId, domain?: Record<string, string>) => {
306
+ let wid = id.toString();
307
+ if (domain) {
308
+ for (const k in domain) {
309
+ wid += k;
310
+ wid += domain[k];
311
+ }
312
+ }
313
+ return wid;
314
+ };
315
+
316
+ const labelColumns = new Map<string, PColumn<TreeNodeAccessor>>();
317
+
306
318
  for (const col of columns) {
307
319
  for (const axis of col.spec.axesSpec) {
308
320
  const axisId = getAxisId(axis);
309
- for (const match of allLabelCols) {
310
- if (matchAxisId(axisId, getAxisId(match.spec.axesSpec[0]))) {
311
- labelColumns.set(match.id, match);
321
+ for (const labelColumn of allLabelCols) {
322
+ const labelAxis = labelColumn.spec.axesSpec[0];
323
+ const labelAxisId = getAxisId(labelColumn.spec.axesSpec[0]);
324
+ if (matchAxisId(axisId, labelAxisId)) {
325
+ const dataDomainLen = Object.keys(axisId.domain ?? {}).length;
326
+ const labelDomainLen = Object.keys(labelAxisId.domain ?? {}).length;
327
+ if (dataDomainLen > labelDomainLen) {
328
+ const id = colId(labelColumn.id, axisId.domain);
329
+
330
+ labelColumns.set(id, {
331
+ id: id as PObjectId,
332
+ spec: {
333
+ ...labelColumn.spec,
334
+ axesSpec: [{ ...axisId, annotations: labelAxis.annotations }]
335
+ },
336
+ data: labelColumn.data
337
+ });
338
+ } else {
339
+ labelColumns.set(colId(labelColumn.id), labelColumn);
340
+ }
312
341
  }
313
342
  }
314
343
  }
315
344
  }
316
345
 
317
346
  // if at least one column is not yet ready, we can't show the table
318
- if ([...columns, ...labelColumns.values()].some((a) =>
319
- a.data instanceof TreeNodeAccessor && !a.data.getIsReadyOrError()
320
- ))
347
+ if (
348
+ [...columns, ...labelColumns.values()].some(
349
+ (a) => a.data instanceof TreeNodeAccessor && !a.data.getIsReadyOrError()
350
+ )
351
+ )
321
352
  return undefined;
322
353
 
323
354
  return ctx.createPTable({