@milaboratories/milaboratories.ui-examples.model 1.1.79 → 1.2.1

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.1.79",
3
+ "version": "1.2.1",
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.37.18"
11
+ "@platforma-sdk/model": "1.39.0"
12
12
  },
13
13
  "devDependencies": {
14
- "typescript": "~5.5.4",
14
+ "typescript": "~5.6.3",
15
15
  "vite": "^6.3.5",
16
16
  "tsup": "~8.3.5",
17
- "@platforma-sdk/block-tools": "2.5.60"
17
+ "@platforma-sdk/block-tools": "2.5.62"
18
18
  },
19
19
  "tsup": {
20
20
  "entry": [
package/src/index.ts CHANGED
@@ -4,15 +4,12 @@ import type {
4
4
  InferOutputsType,
5
5
  PColumn,
6
6
  PColumnValues,
7
- PlDataTableState,
8
- PlTableFiltersModel,
9
7
  PObjectId,
10
8
  PlDataTableStateV2,
11
9
  PlDataTableSheet,
12
10
  } from '@platforma-sdk/model';
13
11
  import {
14
12
  BlockModel,
15
- createPlDataTable,
16
13
  createPlDataTableStateV2,
17
14
  createPlDataTableV2,
18
15
  } from '@platforma-sdk/model';
@@ -52,19 +49,8 @@ export const $BlockArgs = z.object({
52
49
 
53
50
  export type BlockArgs = z.infer<typeof $BlockArgs>;
54
51
 
55
- export type TableState = {
56
- tableState: PlDataTableState;
57
- filterModel: PlTableFiltersModel;
58
- };
59
-
60
- export type TableStateV2 = {
61
- tableState: PlDataTableStateV2;
62
- filterModel: PlTableFiltersModel;
63
- };
64
-
65
52
  export type UiState = {
66
- dataTableState: TableState | undefined;
67
- dataTableStateV2: TableStateV2;
53
+ dataTableStateV2: PlDataTableStateV2;
68
54
  dynamicSections: {
69
55
  id: string;
70
56
  label: string;
@@ -76,11 +62,7 @@ export const platforma = BlockModel.create('Heavy')
76
62
  .withArgs<BlockArgs>({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] })
77
63
 
78
64
  .withUiState<UiState>({
79
- dataTableState: undefined,
80
- dataTableStateV2: {
81
- tableState: createPlDataTableStateV2(),
82
- filterModel: {},
83
- },
65
+ dataTableStateV2: createPlDataTableStateV2(),
84
66
  dynamicSections: [],
85
67
  })
86
68
 
@@ -100,62 +82,6 @@ export const platforma = BlockModel.create('Heavy')
100
82
  return Object.fromEntries(progresses ?? []);
101
83
  })
102
84
 
103
- .output('pt', (ctx) => {
104
- if (!ctx.uiState?.dataTableState?.tableState.pTableParams?.filters) return undefined;
105
-
106
- const data = times(ctx.args.tableNumRows ?? 0, (i) => {
107
- const v = i + 1;
108
- return {
109
- key: [v, v + 0.1],
110
- val: v.toString(),
111
- };
112
- });
113
-
114
- return createPlDataTable(
115
- ctx,
116
- [
117
- {
118
- id: 'example' as PObjectId,
119
- spec: {
120
- kind: 'PColumn',
121
- valueType: 'String',
122
- name: 'example',
123
- annotations: {
124
- 'pl7.app/label': 'String column',
125
- 'pl7.app/discreteValues': '["up","down"]',
126
- },
127
- axesSpec: [
128
- {
129
- type: 'Int',
130
- name: 'index',
131
- annotations: {
132
- 'pl7.app/label': 'Int axis',
133
- 'pl7.app/discreteValues': '[1,2]',
134
- },
135
- },
136
- {
137
- type: 'Float',
138
- name: 'value',
139
- annotations: {
140
- 'pl7.app/label': 'Float axis',
141
- 'pl7.app/table/visibility': 'optional',
142
- },
143
- },
144
- ],
145
- },
146
- data,
147
- } satisfies PColumn<PColumnValues>,
148
- ],
149
- ctx.uiState.dataTableState.tableState,
150
- {
151
- filters: [
152
- ...(ctx.uiState.dataTableState.tableState.pTableParams?.filters ?? []),
153
- ...(ctx.uiState.dataTableState.filterModel?.filters ?? []),
154
- ],
155
- },
156
- );
157
- })
158
-
159
85
  .output('ptV2Sheets', (ctx) => {
160
86
  const rowCount = ctx.args.tableNumRows ?? 0;
161
87
  const sheets = [
@@ -254,11 +180,40 @@ export const platforma = BlockModel.create('Heavy')
254
180
  }),
255
181
  },
256
182
  ];
183
+ for (let j = 3; j < 10; ++j) {
184
+ columns.push({
185
+ id: `column${j}` as PObjectId,
186
+ spec: {
187
+ kind: 'PColumn',
188
+ valueType: 'String',
189
+ name: 'value',
190
+ annotations: {
191
+ 'pl7.app/label': `Alphabetical column ${j - 2}`,
192
+ 'pl7.app/table/visibility': 'optional',
193
+ },
194
+ axesSpec: [
195
+ {
196
+ type: 'Int',
197
+ name: 'index',
198
+ annotations: {
199
+ 'pl7.app/label': 'Int axis',
200
+ },
201
+ },
202
+ ],
203
+ },
204
+ data: times(rowCount, (i) => {
205
+ const v = i + 1;
206
+ return {
207
+ key: [v],
208
+ val: v.toString().repeat(j),
209
+ };
210
+ }),
211
+ });
212
+ }
257
213
  return createPlDataTableV2(
258
214
  ctx,
259
215
  columns,
260
- ctx.uiState.dataTableStateV2.tableState,
261
- { filters: ctx.uiState.dataTableStateV2.filterModel?.filters ?? [] },
216
+ ctx.uiState.dataTableStateV2,
262
217
  );
263
218
  })
264
219
 
@@ -294,7 +249,6 @@ export const platforma = BlockModel.create('Heavy')
294
249
  { type: 'link', href: '/typography', label: 'Typography' },
295
250
  { type: 'link', href: '/ag-grid-vue', label: 'AgGridVue' },
296
251
  { type: 'link', href: '/ag-grid-vue-with-builder', label: 'AgGridVue with builder' },
297
- { type: 'link', href: '/pl-ag-data-table', label: 'PlAgDataTable' },
298
252
  { type: 'link', href: '/pl-ag-data-table-v2', label: 'PlAgDataTableV2' },
299
253
  { type: 'link', href: '/pl-splash-page', label: 'PlSplashPage' },
300
254
  { type: 'link', href: '/pl-file-input-page', label: 'PlFileInputPage' },