@milaboratories/milaboratories.ui-examples.model 1.1.73 → 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 +16 -0
- package/dist/bundle.js +409 -339
- package/dist/bundle.js.map +1 -1
- package/dist/index.cjs +105 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -51
- package/dist/index.d.ts +24 -51
- package/dist/index.js +106 -51
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +3 -3
- package/src/index.ts +119 -56
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
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
ImportFileHandle,
|
|
2
3
|
InferHrefType,
|
|
3
4
|
InferOutputsType,
|
|
4
|
-
PlDataTableState,
|
|
5
|
-
PlTableFiltersModel,
|
|
6
5
|
PColumn,
|
|
7
6
|
PColumnValues,
|
|
7
|
+
PlDataTableState,
|
|
8
|
+
PlTableFiltersModel,
|
|
8
9
|
PObjectId,
|
|
9
|
-
|
|
10
|
+
PlDataTableStateV2,
|
|
11
|
+
PlDataTableSheet,
|
|
10
12
|
} from '@platforma-sdk/model';
|
|
11
13
|
import {
|
|
12
14
|
BlockModel,
|
|
13
15
|
createPlDataTable,
|
|
16
|
+
createPlDataTableStateV2,
|
|
14
17
|
createPlDataTableV2,
|
|
15
|
-
selectorsToPredicate,
|
|
16
18
|
} from '@platforma-sdk/model';
|
|
17
19
|
import { z } from 'zod';
|
|
18
20
|
|
|
@@ -55,8 +57,14 @@ export type TableState = {
|
|
|
55
57
|
filterModel: PlTableFiltersModel;
|
|
56
58
|
};
|
|
57
59
|
|
|
60
|
+
export type TableStateV2 = {
|
|
61
|
+
tableState: PlDataTableStateV2;
|
|
62
|
+
filterModel: PlTableFiltersModel;
|
|
63
|
+
};
|
|
64
|
+
|
|
58
65
|
export type UiState = {
|
|
59
66
|
dataTableState: TableState | undefined;
|
|
67
|
+
dataTableStateV2: TableStateV2;
|
|
60
68
|
dynamicSections: {
|
|
61
69
|
id: string;
|
|
62
70
|
label: string;
|
|
@@ -67,7 +75,14 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
67
75
|
|
|
68
76
|
.withArgs<BlockArgs>({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] })
|
|
69
77
|
|
|
70
|
-
.withUiState<UiState>({
|
|
78
|
+
.withUiState<UiState>({
|
|
79
|
+
dataTableState: undefined,
|
|
80
|
+
dataTableStateV2: {
|
|
81
|
+
tableState: createPlDataTableStateV2(),
|
|
82
|
+
filterModel: {},
|
|
83
|
+
},
|
|
84
|
+
dynamicSections: [],
|
|
85
|
+
})
|
|
71
86
|
|
|
72
87
|
.argsValid((ctx) => {
|
|
73
88
|
if (ctx.args.numbers.length === 5) {
|
|
@@ -141,62 +156,109 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
141
156
|
);
|
|
142
157
|
})
|
|
143
158
|
|
|
144
|
-
.output('
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
+
})
|
|
154
179
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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]',
|
|
176
201
|
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
type: 'Int',
|
|
205
|
+
name: 'index',
|
|
206
|
+
annotations: {
|
|
207
|
+
'pl7.app/label': 'Int axis',
|
|
184
208
|
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
+
},
|
|
194
220
|
{
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
+
}),
|
|
199
255
|
},
|
|
256
|
+
];
|
|
257
|
+
return createPlDataTableV2(
|
|
258
|
+
ctx,
|
|
259
|
+
columns,
|
|
260
|
+
ctx.uiState.dataTableStateV2.tableState,
|
|
261
|
+
{ filters: ctx.uiState.dataTableStateV2.filterModel?.filters ?? [] },
|
|
200
262
|
);
|
|
201
263
|
})
|
|
202
264
|
|
|
@@ -237,6 +299,7 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
237
299
|
{ type: 'link', href: '/pl-splash-page', label: 'PlSplashPage' },
|
|
238
300
|
{ type: 'link', href: '/pl-file-input-page', label: 'PlFileInputPage' },
|
|
239
301
|
{ type: 'link', href: '/pl-error-boundary-page', label: 'PlErrorBoundaryPage' },
|
|
302
|
+
{ type: 'link', href: '/pl-element-list-page', label: 'PlElementList' },
|
|
240
303
|
{ type: 'link', href: '/errors', label: 'Errors' },
|
|
241
304
|
{ type: 'link', href: '/text-fields', label: 'PlTextField' },
|
|
242
305
|
{ type: 'link', href: '/tabs', label: 'PlTabs' },
|