@milaboratories/milaboratories.ui-examples.model 1.0.32 → 1.0.33

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": "@milaboratories/milaboratories.ui-examples.model",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -8,13 +8,13 @@
8
8
  "types": "dist/index.d.ts",
9
9
  "dependencies": {
10
10
  "zod": "^3.23.8",
11
- "@platforma-sdk/model": "1.8.19"
11
+ "@platforma-sdk/model": "1.9.0"
12
12
  },
13
13
  "devDependencies": {
14
14
  "typescript": "~5.5.4",
15
15
  "vite": "^5.4.11",
16
16
  "tsup": "~8.2.4",
17
- "@platforma-sdk/block-tools": "2.3.24"
17
+ "@platforma-sdk/block-tools": "2.3.25"
18
18
  },
19
19
  "tsup": {
20
20
  "entry": [
package/src/index.ts CHANGED
@@ -1,18 +1,18 @@
1
- import {
2
- BlockModel,
3
- InferHrefType,
4
- InferOutputsType,
5
- mapJoinEntry,
6
- PColumnIdAndSpec,
7
- AxisSpec,
8
- JoinEntry,
9
- AxisId,
10
- PlDataTableState,
11
- ValueType,
1
+ import {
2
+ BlockModel,
3
+ InferHrefType,
4
+ InferOutputsType,
5
+ mapJoinEntry,
6
+ PColumnIdAndSpec,
7
+ AxisSpec,
8
+ JoinEntry,
9
+ AxisId,
10
+ PlDataTableState,
11
+ ValueType,
12
12
  isPColumn,
13
- PlDataTableGridState
13
+ PlDataTableGridState
14
14
  } from '@platforma-sdk/model';
15
- import {z} from 'zod';
15
+ import { z } from 'zod';
16
16
 
17
17
  export const $BlockArgs = z.object({
18
18
  numbers: z.array(z.coerce.number())
@@ -35,16 +35,16 @@ export type TableState = {
35
35
  };
36
36
 
37
37
  export type UiState = {
38
- dataTableState: TableState | undefined,
38
+ dataTableState: TableState | undefined;
39
39
  };
40
40
 
41
- export const platforma = BlockModel.create<BlockArgs, UiState>('Heavy')
41
+ export const platforma = BlockModel.create('Heavy')
42
42
 
43
- .initialArgs({ numbers: [] })
43
+ .withArgs<BlockArgs>({ numbers: [] })
44
44
 
45
- .output('numbers', (ctx) =>
46
- ctx.outputs?.resolve('numbers')?.getDataAsJson<number[]>()
47
- )
45
+ .withUiState<UiState>({ dataTableState: undefined })
46
+
47
+ .output('numbers', (ctx) => ctx.outputs?.resolve('numbers')?.getDataAsJson<number[]>())
48
48
 
49
49
  .output('pFrame', (ctx) => {
50
50
  const collection = ctx.resultPool.getData();
@@ -62,6 +62,7 @@ export const platforma = BlockModel.create<BlockArgs, UiState>('Heavy')
62
62
  return undefined;
63
63
  }
64
64
  })
65
+
65
66
  .output('pTable', (ctx) => {
66
67
  const join = ctx.uiState?.dataTableState?.tableState.pTableParams?.join;
67
68
  if (!join) return undefined;
@@ -75,7 +76,7 @@ export const platforma = BlockModel.create<BlockArgs, UiState>('Heavy')
75
76
  try {
76
77
  return ctx.createPTable({
77
78
  src: mapJoinEntry(join, (idAndSpec) => {
78
- const column = columns.find(it => it.id === idAndSpec.columnId);
79
+ const column = columns.find((it) => it.id === idAndSpec.columnId);
79
80
  if (!column) throw Error(`column '${column}' not ready`);
80
81
  return column;
81
82
  }),