@milaboratories/milaboratories.ui-examples.model 1.1.74 → 1.1.75
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 +13 -13
- package/CHANGELOG.md +10 -0
- package/dist/bundle.js +408 -339
- package/dist/bundle.js.map +1 -1
- package/dist/index.cjs +104 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -50
- package/dist/index.d.ts +23 -50
- package/dist/index.js +105 -51
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +3 -3
- package/src/index.ts +120 -53
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/milaboratories.ui-examples.model",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.75",
|
|
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.
|
|
11
|
+
"@platforma-sdk/model": "1.37.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"typescript": "~5.5.4",
|
|
15
15
|
"vite": "^6.3.5",
|
|
16
16
|
"tsup": "~8.3.5",
|
|
17
|
-
"@platforma-sdk/block-tools": "2.5.
|
|
17
|
+
"@platforma-sdk/block-tools": "2.5.58"
|
|
18
18
|
},
|
|
19
19
|
"tsup": {
|
|
20
20
|
"entry": [
|
package/src/index.ts
CHANGED
|
@@ -7,8 +7,15 @@ import type {
|
|
|
7
7
|
PlDataTableState,
|
|
8
8
|
PlTableFiltersModel,
|
|
9
9
|
PObjectId,
|
|
10
|
+
PlDataTableStateV2,
|
|
11
|
+
PlDataTableSheet,
|
|
12
|
+
} from '@platforma-sdk/model';
|
|
13
|
+
import {
|
|
14
|
+
BlockModel,
|
|
15
|
+
createPlDataTable,
|
|
16
|
+
createPlDataTableStateV2,
|
|
17
|
+
createPlDataTableV2,
|
|
10
18
|
} from '@platforma-sdk/model';
|
|
11
|
-
import { BlockModel, createPlDataTable, createPlDataTableV2, selectorsToPredicate } from '@platforma-sdk/model';
|
|
12
19
|
import { z } from 'zod';
|
|
13
20
|
|
|
14
21
|
export const ImportFileHandleSchema = z
|
|
@@ -50,8 +57,14 @@ export type TableState = {
|
|
|
50
57
|
filterModel: PlTableFiltersModel;
|
|
51
58
|
};
|
|
52
59
|
|
|
60
|
+
export type TableStateV2 = {
|
|
61
|
+
tableState: PlDataTableStateV2;
|
|
62
|
+
filterModel: PlTableFiltersModel;
|
|
63
|
+
};
|
|
64
|
+
|
|
53
65
|
export type UiState = {
|
|
54
66
|
dataTableState: TableState | undefined;
|
|
67
|
+
dataTableStateV2: TableStateV2;
|
|
55
68
|
dynamicSections: {
|
|
56
69
|
id: string;
|
|
57
70
|
label: string;
|
|
@@ -62,7 +75,14 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
62
75
|
|
|
63
76
|
.withArgs<BlockArgs>({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] })
|
|
64
77
|
|
|
65
|
-
.withUiState<UiState>({
|
|
78
|
+
.withUiState<UiState>({
|
|
79
|
+
dataTableState: undefined,
|
|
80
|
+
dataTableStateV2: {
|
|
81
|
+
tableState: createPlDataTableStateV2(),
|
|
82
|
+
filterModel: {},
|
|
83
|
+
},
|
|
84
|
+
dynamicSections: [],
|
|
85
|
+
})
|
|
66
86
|
|
|
67
87
|
.argsValid((ctx) => {
|
|
68
88
|
if (ctx.args.numbers.length === 5) {
|
|
@@ -136,62 +156,109 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
136
156
|
);
|
|
137
157
|
})
|
|
138
158
|
|
|
139
|
-
.output('
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
159
|
+
.output('ptV2Sheets', (ctx) => {
|
|
160
|
+
const rowCount = ctx.args.tableNumRows ?? 0;
|
|
161
|
+
const sheets = [
|
|
162
|
+
{
|
|
163
|
+
axis: {
|
|
164
|
+
type: 'Int',
|
|
165
|
+
name: 'part',
|
|
166
|
+
annotations: {
|
|
167
|
+
'pl7.app/label': 'Partitioned axis',
|
|
168
|
+
'pl7.app/discreteValues': '[0,1]',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
options: [
|
|
172
|
+
{ value: 0, label: 'Partition 1' },
|
|
173
|
+
{ value: 1, label: 'Partition 2' },
|
|
174
|
+
],
|
|
175
|
+
} satisfies PlDataTableSheet,
|
|
176
|
+
];
|
|
177
|
+
return rowCount > 0 ? sheets : [];
|
|
178
|
+
})
|
|
149
179
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
180
|
+
.output('ptV2', (ctx) => {
|
|
181
|
+
const rowCount = ctx.args.tableNumRows ?? 0;
|
|
182
|
+
const makePartitionId = (rowCount: number, i: number) => Math.floor((2 * i) / (rowCount + 1));
|
|
183
|
+
const columns: PColumn<PColumnValues>[] = [
|
|
184
|
+
{
|
|
185
|
+
id: 'column1' as PObjectId,
|
|
186
|
+
spec: {
|
|
187
|
+
kind: 'PColumn',
|
|
188
|
+
valueType: 'String',
|
|
189
|
+
name: 'example',
|
|
190
|
+
annotations: {
|
|
191
|
+
'pl7.app/label': 'String column',
|
|
192
|
+
'pl7.app/discreteValues': '["up","down"]',
|
|
193
|
+
},
|
|
194
|
+
axesSpec: [
|
|
195
|
+
{
|
|
196
|
+
type: 'Int',
|
|
197
|
+
name: 'part',
|
|
198
|
+
annotations: {
|
|
199
|
+
'pl7.app/label': 'Partitioned axis',
|
|
200
|
+
'pl7.app/discreteValues': '[0,1]',
|
|
171
201
|
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
type: 'Int',
|
|
205
|
+
name: 'index',
|
|
206
|
+
annotations: {
|
|
207
|
+
'pl7.app/label': 'Int axis',
|
|
179
208
|
},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
data: times(rowCount, (i) => {
|
|
213
|
+
const v = i + 1;
|
|
214
|
+
return {
|
|
215
|
+
key: [makePartitionId(rowCount, v), v],
|
|
216
|
+
val: v.toString(),
|
|
217
|
+
};
|
|
218
|
+
}),
|
|
219
|
+
},
|
|
189
220
|
{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
221
|
+
id: 'column2' as PObjectId,
|
|
222
|
+
spec: {
|
|
223
|
+
kind: 'PColumn',
|
|
224
|
+
valueType: 'Float',
|
|
225
|
+
name: 'value',
|
|
226
|
+
annotations: {
|
|
227
|
+
'pl7.app/label': 'Float column',
|
|
228
|
+
'pl7.app/table/visibility': 'optional',
|
|
229
|
+
},
|
|
230
|
+
axesSpec: [
|
|
231
|
+
{
|
|
232
|
+
type: 'Int',
|
|
233
|
+
name: 'part',
|
|
234
|
+
annotations: {
|
|
235
|
+
'pl7.app/label': 'Partitioned axis',
|
|
236
|
+
'pl7.app/discreteValues': '[0,1]',
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
type: 'Int',
|
|
241
|
+
name: 'index',
|
|
242
|
+
annotations: {
|
|
243
|
+
'pl7.app/label': 'Int axis',
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
},
|
|
248
|
+
data: times(rowCount, (i) => {
|
|
249
|
+
const v = i + 1;
|
|
250
|
+
return {
|
|
251
|
+
key: [makePartitionId(rowCount, v), v],
|
|
252
|
+
val: v + 0.1,
|
|
253
|
+
};
|
|
254
|
+
}),
|
|
194
255
|
},
|
|
256
|
+
];
|
|
257
|
+
return createPlDataTableV2(
|
|
258
|
+
ctx,
|
|
259
|
+
columns,
|
|
260
|
+
ctx.uiState.dataTableStateV2.tableState,
|
|
261
|
+
{ filters: ctx.uiState.dataTableStateV2.filterModel?.filters ?? [] },
|
|
195
262
|
);
|
|
196
263
|
})
|
|
197
264
|
|