@milaboratories/milaboratories.ui-examples.model 1.4.9 → 1.4.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/.oxfmtrc.json +4 -0
- package/.oxlintrc.json +3 -0
- package/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-formatter$colon$check.log +12 -0
- package/.turbo/turbo-linter$colon$check.log +10 -0
- package/.turbo/{turbo-type-check.log → turbo-types$colon$check.log} +2 -2
- package/CHANGELOG.md +15 -0
- package/dist/bundle.js +596 -566
- package/dist/bundle.js.map +1 -1
- package/dist/index.cjs +96 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +96 -100
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +10 -9
- package/src/index.ts +100 -108
- package/tsconfig.json +3 -10
- package/.turbo/turbo-lint.log +0 -5
- package/eslint.config.mjs +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/milaboratories.ui-examples.model",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.11",
|
|
4
4
|
"description": "Block model",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -8,20 +8,21 @@
|
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"zod": "~3.23.8",
|
|
11
|
-
"@platforma-sdk/model": "1.53.
|
|
11
|
+
"@platforma-sdk/model": "1.53.13"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"eslint": "^9.25.1",
|
|
15
14
|
"typescript": "~5.6.3",
|
|
16
|
-
"@
|
|
17
|
-
"@platforma-sdk/block-tools": "2.6.42",
|
|
15
|
+
"@milaboratories/ts-builder": "1.2.5",
|
|
18
16
|
"@milaboratories/ts-configs": "1.2.0",
|
|
19
|
-
"@
|
|
20
|
-
"@milaboratories/build-configs": "1.4.
|
|
17
|
+
"@platforma-sdk/block-tools": "2.6.45",
|
|
18
|
+
"@milaboratories/build-configs": "1.4.1"
|
|
21
19
|
},
|
|
22
20
|
"scripts": {
|
|
23
21
|
"build": "ts-builder build --target block-model && block-tools build-model",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
22
|
+
"check": "ts-builder check --target block-model",
|
|
23
|
+
"formatter:check": "ts-builder formatter --check",
|
|
24
|
+
"linter:check": "ts-builder linter --check",
|
|
25
|
+
"types:check": "ts-builder type-check --target block-model",
|
|
26
|
+
"fmt": "ts-builder format"
|
|
26
27
|
}
|
|
27
28
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
PlDataTableSheet,
|
|
8
8
|
PlDataTableStateV2,
|
|
9
9
|
PObjectId,
|
|
10
|
-
} from
|
|
10
|
+
} from "@platforma-sdk/model";
|
|
11
11
|
import {
|
|
12
12
|
Annotation,
|
|
13
13
|
BlockModel,
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
PColumnName,
|
|
17
17
|
stringifyJson,
|
|
18
18
|
ValueType,
|
|
19
|
-
} from
|
|
20
|
-
import { z } from
|
|
19
|
+
} from "@platforma-sdk/model";
|
|
20
|
+
import { z } from "zod";
|
|
21
21
|
|
|
22
22
|
export const ImportFileHandleSchema = z
|
|
23
23
|
.string()
|
|
@@ -68,13 +68,13 @@ export type UiState = {
|
|
|
68
68
|
}[];
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
export const platforma = BlockModel.create(
|
|
71
|
+
export const platforma = BlockModel.create("Heavy")
|
|
72
72
|
|
|
73
73
|
.withArgs<BlockArgs>({ numbers: [1, 2, 3, 4], handles: [] })
|
|
74
74
|
|
|
75
75
|
.withUiState<UiState>({
|
|
76
76
|
dataTableV2: {
|
|
77
|
-
sourceId:
|
|
77
|
+
sourceId: "source_1",
|
|
78
78
|
numRows: 200,
|
|
79
79
|
state: createPlDataTableStateV2(),
|
|
80
80
|
},
|
|
@@ -84,71 +84,71 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
84
84
|
|
|
85
85
|
.argsValid((ctx) => {
|
|
86
86
|
if (ctx.args.numbers.length === 5) {
|
|
87
|
-
throw new Error(
|
|
87
|
+
throw new Error("argsValid: test error");
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
return ctx.args.numbers.length > 0;
|
|
91
91
|
})
|
|
92
92
|
|
|
93
|
-
.output(
|
|
93
|
+
.output("numbers", (ctx) => ctx.outputs?.resolve("numbers")?.getDataAsJson<number[]>())
|
|
94
94
|
|
|
95
|
-
.output(
|
|
96
|
-
const m = ctx.outputs?.resolve(
|
|
95
|
+
.output("progresses", (ctx) => {
|
|
96
|
+
const m = ctx.outputs?.resolve("progresses");
|
|
97
97
|
const progresses = m?.mapFields((name, val) => [name, val?.getImportProgress()] as const);
|
|
98
98
|
return Object.fromEntries(progresses ?? []);
|
|
99
99
|
})
|
|
100
100
|
|
|
101
|
-
.output(
|
|
101
|
+
.output("ptV2Sheets", (ctx) => {
|
|
102
102
|
const rowCount = ctx.uiState.dataTableV2.numRows ?? 0;
|
|
103
103
|
const sheets = [
|
|
104
104
|
{
|
|
105
105
|
axis: {
|
|
106
106
|
type: ValueType.Int,
|
|
107
|
-
name:
|
|
107
|
+
name: "part",
|
|
108
108
|
annotations: {
|
|
109
|
-
[Annotation.Label]:
|
|
109
|
+
[Annotation.Label]: "Partitioned axis",
|
|
110
110
|
[Annotation.DiscreteValues]: stringifyJson([0, 1]),
|
|
111
111
|
} satisfies Annotation,
|
|
112
112
|
},
|
|
113
113
|
options: [
|
|
114
|
-
{ value: 0, label:
|
|
115
|
-
{ value: 1, label:
|
|
114
|
+
{ value: 0, label: "Partition 1" },
|
|
115
|
+
{ value: 1, label: "Partition 2" },
|
|
116
116
|
],
|
|
117
117
|
} satisfies PlDataTableSheet,
|
|
118
118
|
];
|
|
119
119
|
return rowCount > 0 ? sheets : [];
|
|
120
120
|
})
|
|
121
121
|
|
|
122
|
-
.outputWithStatus(
|
|
122
|
+
.outputWithStatus("ptV2", (ctx) => {
|
|
123
123
|
const rowCount = ctx.uiState.dataTableV2.numRows ?? 0;
|
|
124
124
|
const makePartitionId = (rowCount: number, i: number) => Math.floor((2 * i) / (rowCount + 1));
|
|
125
125
|
const columns: PColumn<PColumnValues>[] = [
|
|
126
126
|
{
|
|
127
|
-
id:
|
|
127
|
+
id: "column1" as PObjectId,
|
|
128
128
|
spec: {
|
|
129
|
-
kind:
|
|
129
|
+
kind: "PColumn",
|
|
130
130
|
valueType: ValueType.String,
|
|
131
|
-
name:
|
|
131
|
+
name: "example",
|
|
132
132
|
annotations: {
|
|
133
|
-
[Annotation.Label]:
|
|
134
|
-
[Annotation.DiscreteValues]: stringifyJson([
|
|
133
|
+
[Annotation.Label]: "String column",
|
|
134
|
+
[Annotation.DiscreteValues]: stringifyJson(["up", "down"]),
|
|
135
135
|
[Annotation.Table.OrderPriority]: stringifyJson(101),
|
|
136
|
-
[Annotation.Description]:
|
|
136
|
+
[Annotation.Description]: "String column description",
|
|
137
137
|
} satisfies Annotation,
|
|
138
138
|
axesSpec: [
|
|
139
139
|
{
|
|
140
140
|
type: ValueType.Int,
|
|
141
|
-
name:
|
|
141
|
+
name: "part",
|
|
142
142
|
annotations: {
|
|
143
|
-
[Annotation.Label]:
|
|
143
|
+
[Annotation.Label]: "Partitioned axis",
|
|
144
144
|
[Annotation.DiscreteValues]: stringifyJson([0, 1]),
|
|
145
145
|
} satisfies Annotation,
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
type: ValueType.Int,
|
|
149
|
-
name:
|
|
149
|
+
name: "index",
|
|
150
150
|
annotations: {
|
|
151
|
-
[Annotation.Label]:
|
|
151
|
+
[Annotation.Label]: "Int axis",
|
|
152
152
|
} satisfies Annotation,
|
|
153
153
|
},
|
|
154
154
|
],
|
|
@@ -162,31 +162,31 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
162
162
|
}),
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
|
-
id:
|
|
165
|
+
id: "column2" as PObjectId,
|
|
166
166
|
spec: {
|
|
167
|
-
kind:
|
|
167
|
+
kind: "PColumn",
|
|
168
168
|
valueType: ValueType.Float,
|
|
169
|
-
name:
|
|
169
|
+
name: "value",
|
|
170
170
|
annotations: {
|
|
171
|
-
[Annotation.Label]:
|
|
172
|
-
[Annotation.Table.Visibility]:
|
|
171
|
+
[Annotation.Label]: "Float column",
|
|
172
|
+
[Annotation.Table.Visibility]: "optional",
|
|
173
173
|
[Annotation.Table.OrderPriority]: stringifyJson(100),
|
|
174
|
-
[Annotation.Description]:
|
|
174
|
+
[Annotation.Description]: "Float column description",
|
|
175
175
|
} satisfies Annotation,
|
|
176
176
|
axesSpec: [
|
|
177
177
|
{
|
|
178
178
|
type: ValueType.Int,
|
|
179
|
-
name:
|
|
179
|
+
name: "part",
|
|
180
180
|
annotations: {
|
|
181
|
-
[Annotation.Label]:
|
|
181
|
+
[Annotation.Label]: "Partitioned axis",
|
|
182
182
|
[Annotation.DiscreteValues]: stringifyJson([0, 1]),
|
|
183
183
|
} satisfies Annotation,
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
186
|
type: ValueType.Int,
|
|
187
|
-
name:
|
|
187
|
+
name: "index",
|
|
188
188
|
annotations: {
|
|
189
|
-
[Annotation.Label]:
|
|
189
|
+
[Annotation.Label]: "Int axis",
|
|
190
190
|
} satisfies Annotation,
|
|
191
191
|
},
|
|
192
192
|
],
|
|
@@ -200,20 +200,20 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
200
200
|
}),
|
|
201
201
|
},
|
|
202
202
|
{
|
|
203
|
-
id:
|
|
203
|
+
id: "labelColumn" as PObjectId,
|
|
204
204
|
spec: {
|
|
205
|
-
kind:
|
|
205
|
+
kind: "PColumn",
|
|
206
206
|
valueType: ValueType.Int,
|
|
207
207
|
name: PColumnName.Label,
|
|
208
208
|
annotations: {
|
|
209
|
-
[Annotation.Label]:
|
|
209
|
+
[Annotation.Label]: "Int axis labels",
|
|
210
210
|
} satisfies Annotation,
|
|
211
211
|
axesSpec: [
|
|
212
212
|
{
|
|
213
213
|
type: ValueType.Int,
|
|
214
|
-
name:
|
|
214
|
+
name: "index",
|
|
215
215
|
annotations: {
|
|
216
|
-
[Annotation.Label]:
|
|
216
|
+
[Annotation.Label]: "Int axis",
|
|
217
217
|
} satisfies Annotation,
|
|
218
218
|
},
|
|
219
219
|
],
|
|
@@ -227,29 +227,29 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
227
227
|
}),
|
|
228
228
|
},
|
|
229
229
|
{
|
|
230
|
-
id:
|
|
230
|
+
id: "linkerColumn" as PObjectId,
|
|
231
231
|
spec: {
|
|
232
|
-
kind:
|
|
232
|
+
kind: "PColumn",
|
|
233
233
|
valueType: ValueType.Int,
|
|
234
|
-
name:
|
|
234
|
+
name: "linker",
|
|
235
235
|
annotations: {
|
|
236
|
-
[Annotation.Label]:
|
|
236
|
+
[Annotation.Label]: "Index axis linker",
|
|
237
237
|
[Annotation.IsLinkerColumn]: stringifyJson(true),
|
|
238
|
-
[Annotation.Table.Visibility]:
|
|
238
|
+
[Annotation.Table.Visibility]: "hidden",
|
|
239
239
|
} satisfies Annotation,
|
|
240
240
|
axesSpec: [
|
|
241
241
|
{
|
|
242
242
|
type: ValueType.Int,
|
|
243
|
-
name:
|
|
243
|
+
name: "index",
|
|
244
244
|
annotations: {
|
|
245
|
-
[Annotation.Label]:
|
|
245
|
+
[Annotation.Label]: "Int axis",
|
|
246
246
|
} satisfies Annotation,
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
249
|
type: ValueType.Int,
|
|
250
|
-
name:
|
|
250
|
+
name: "linkedIndex",
|
|
251
251
|
annotations: {
|
|
252
|
-
[Annotation.Label]:
|
|
252
|
+
[Annotation.Label]: "Linked int axis",
|
|
253
253
|
} satisfies Annotation,
|
|
254
254
|
},
|
|
255
255
|
],
|
|
@@ -267,20 +267,20 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
267
267
|
columns.push({
|
|
268
268
|
id: `alphabeticalColumn${j}` as PObjectId,
|
|
269
269
|
spec: {
|
|
270
|
-
kind:
|
|
270
|
+
kind: "PColumn",
|
|
271
271
|
valueType: ValueType.String,
|
|
272
|
-
name:
|
|
272
|
+
name: "value",
|
|
273
273
|
annotations: {
|
|
274
274
|
[Annotation.Label]: `Alphabetical column ${j}`,
|
|
275
|
-
[Annotation.Table.Visibility]:
|
|
275
|
+
[Annotation.Table.Visibility]: "optional",
|
|
276
276
|
[Annotation.Table.OrderPriority]: stringifyJson(10 - j),
|
|
277
277
|
} satisfies Annotation,
|
|
278
278
|
axesSpec: [
|
|
279
279
|
{
|
|
280
280
|
type: ValueType.Int,
|
|
281
|
-
name:
|
|
281
|
+
name: "linkedIndex",
|
|
282
282
|
annotations: {
|
|
283
|
-
[Annotation.Label]:
|
|
283
|
+
[Annotation.Label]: "Linked int axis",
|
|
284
284
|
} satisfies Annotation,
|
|
285
285
|
},
|
|
286
286
|
],
|
|
@@ -294,80 +294,72 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
294
294
|
}),
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
return createPlDataTableV2(
|
|
298
|
-
ctx,
|
|
299
|
-
columns,
|
|
300
|
-
ctx.uiState.dataTableV2.state,
|
|
301
|
-
);
|
|
297
|
+
return createPlDataTableV2(ctx, columns, ctx.uiState.dataTableV2.state);
|
|
302
298
|
})
|
|
303
299
|
|
|
304
300
|
.title((ctx) => {
|
|
305
301
|
if (ctx.args.numbers.length === 5) {
|
|
306
|
-
throw new Error(
|
|
302
|
+
throw new Error("block title: test error");
|
|
307
303
|
}
|
|
308
304
|
|
|
309
|
-
return
|
|
305
|
+
return "Ui Examples";
|
|
310
306
|
})
|
|
311
307
|
|
|
312
308
|
.sections((ctx) => {
|
|
313
309
|
const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it) => ({
|
|
314
|
-
type:
|
|
310
|
+
type: "link" as const,
|
|
315
311
|
href: `/section?id=${it.id}` as const,
|
|
316
312
|
label: it.label,
|
|
317
313
|
}));
|
|
318
314
|
|
|
319
|
-
if (dynamicSections.some((it) => it.label ===
|
|
320
|
-
throw new Error(
|
|
315
|
+
if (dynamicSections.some((it) => it.label === "Error")) {
|
|
316
|
+
throw new Error("sections: test error");
|
|
321
317
|
}
|
|
322
318
|
|
|
323
319
|
return [
|
|
324
|
-
{ type:
|
|
325
|
-
{ type:
|
|
326
|
-
{ type:
|
|
327
|
-
{ type:
|
|
328
|
-
{ type:
|
|
329
|
-
{ type:
|
|
330
|
-
{ type:
|
|
331
|
-
{ type:
|
|
332
|
-
{ type:
|
|
333
|
-
{ type:
|
|
334
|
-
{ type:
|
|
335
|
-
{ type:
|
|
336
|
-
{ type:
|
|
337
|
-
{ type:
|
|
338
|
-
{ type:
|
|
339
|
-
{ type:
|
|
340
|
-
{ type:
|
|
341
|
-
{ type:
|
|
342
|
-
{ type:
|
|
343
|
-
{ type:
|
|
344
|
-
{ type:
|
|
345
|
-
{ type:
|
|
346
|
-
{ type:
|
|
347
|
-
{ type:
|
|
348
|
-
{ type:
|
|
349
|
-
{ type:
|
|
350
|
-
{ type:
|
|
351
|
-
{ type:
|
|
352
|
-
{ type:
|
|
353
|
-
{ type:
|
|
354
|
-
{ type:
|
|
355
|
-
{ type:
|
|
356
|
-
{ type:
|
|
357
|
-
{ type:
|
|
358
|
-
{ type:
|
|
320
|
+
{ type: "link", href: "/loaders", label: "Loaders" },
|
|
321
|
+
{ type: "link", href: "/", label: "Icons/Masks" },
|
|
322
|
+
{ type: "link", href: "/state", label: "State" },
|
|
323
|
+
{ type: "link", href: "/layout", label: "Layout" },
|
|
324
|
+
{ type: "link", href: "/form-components", label: "Form Components" },
|
|
325
|
+
{ type: "link", href: "/log-view", label: "PlLogView" },
|
|
326
|
+
{ type: "link", href: "/modals", label: "Modals" },
|
|
327
|
+
{ type: "link", href: "/select-files", label: "Select Files" },
|
|
328
|
+
{ type: "link", href: "/inject-env", label: "Inject env" },
|
|
329
|
+
{ type: "link", href: "/use-watch-fetch", label: "useWatchFetch" },
|
|
330
|
+
{ type: "link", href: "/typography", label: "Typography" },
|
|
331
|
+
{ type: "link", href: "/ag-grid-vue", label: "AgGridVue" },
|
|
332
|
+
{ type: "link", href: "/ag-grid-vue-with-builder", label: "AgGridVue with builder" },
|
|
333
|
+
{ type: "link", href: "/pl-annotations", label: "PlAnnotations" },
|
|
334
|
+
{ type: "link", href: "/pl-ag-data-table-v2", label: "PlAgDataTableV2" },
|
|
335
|
+
{ type: "link", href: "/pl-splash-page", label: "PlSplashPage" },
|
|
336
|
+
{ type: "link", href: "/pl-file-input-page", label: "PlFileInputPage" },
|
|
337
|
+
{ type: "link", href: "/pl-number-field-page", label: "PlNumberFieldPage" },
|
|
338
|
+
{ type: "link", href: "/pl-error-boundary-page", label: "PlErrorBoundaryPage" },
|
|
339
|
+
{ type: "link", href: "/pl-element-list-page", label: "PlElementList" },
|
|
340
|
+
{ type: "link", href: "/text-fields", label: "PlTextField" },
|
|
341
|
+
{ type: "link", href: "/tabs", label: "PlTabs" },
|
|
342
|
+
{ type: "link", href: "/pl-autocomplete", label: "PlAutocomplete" },
|
|
343
|
+
{ type: "link", href: "/radio", label: "PlRadio" },
|
|
344
|
+
{ type: "link", href: "/stacked-bar", label: "PlChartStackedBar" },
|
|
345
|
+
{ type: "link", href: "/histogram", label: "PlChartHistogram" },
|
|
346
|
+
{ type: "link", href: "/buttons", label: "ButtonsPage" },
|
|
347
|
+
{ type: "link", href: "/errors", label: "Errors" },
|
|
348
|
+
{ type: "link", href: "/downloads", label: "Downloads" },
|
|
349
|
+
{ type: "link", href: "/notifications", label: "Notifications" },
|
|
350
|
+
{ type: "link", href: "/drafts", label: "Drafts" },
|
|
351
|
+
{ type: "link", href: "/pl-autocomplete", label: "PlAutocomplete" },
|
|
352
|
+
{ type: "link", href: "/pl-autocomplete-multi", label: "PlAutocompleteMulti" },
|
|
353
|
+
{ type: "link", href: "/radio", label: "PlRadio" },
|
|
354
|
+
{ type: "link", href: "/advanced-filter", label: "PlAdvancedFilter" },
|
|
359
355
|
...(dynamicSections.length
|
|
360
|
-
? [
|
|
361
|
-
{ type: 'delimiter' },
|
|
362
|
-
...dynamicSections,
|
|
363
|
-
{ type: 'delimiter' },
|
|
364
|
-
] as const
|
|
356
|
+
? ([{ type: "delimiter" }, ...dynamicSections, { type: "delimiter" }] as const)
|
|
365
357
|
: []),
|
|
366
358
|
{
|
|
367
|
-
type:
|
|
368
|
-
href:
|
|
369
|
-
appearance:
|
|
370
|
-
label:
|
|
359
|
+
type: "link",
|
|
360
|
+
href: "/add-section",
|
|
361
|
+
appearance: "add-section",
|
|
362
|
+
label: "New Dynamic section",
|
|
371
363
|
},
|
|
372
364
|
];
|
|
373
365
|
})
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@milaboratories/ts-configs/block/model",
|
|
3
|
-
"include": [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"exclude": [
|
|
7
|
-
"node_modules",
|
|
8
|
-
"dist",
|
|
9
|
-
"**/*.test.ts",
|
|
10
|
-
"**/*.spec.ts"
|
|
11
|
-
]
|
|
12
|
-
}
|
|
3
|
+
"include": ["src/**/*"],
|
|
4
|
+
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
|
|
5
|
+
}
|
package/.turbo/turbo-lint.log
DELETED