@milaboratories/milaboratories.ui-examples.model 1.1.10 → 1.1.12
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 +13 -0
- package/dist/bundle.js +22 -5
- package/dist/bundle.js.map +1 -1
- package/dist/index.cjs +21 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/eslint.config.mjs +7 -0
- package/package.json +5 -4
- package/src/index.ts +40 -16
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.12",
|
|
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.21.
|
|
11
|
+
"@platforma-sdk/model": "1.21.20"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"typescript": "~5.5.4",
|
|
15
15
|
"vite": "^5.4.11",
|
|
16
16
|
"tsup": "~8.3.5",
|
|
17
|
-
"@platforma-sdk/block-tools": "2.5.
|
|
17
|
+
"@platforma-sdk/block-tools": "2.5.3"
|
|
18
18
|
},
|
|
19
19
|
"tsup": {
|
|
20
20
|
"entry": [
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"sourcemap": true
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "tsup && vite build && block-tools build-model"
|
|
35
|
+
"build": "tsup && vite build && block-tools build-model",
|
|
36
|
+
"lint": "eslint ."
|
|
36
37
|
}
|
|
37
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BlockModel,
|
|
1
|
+
import type {
|
|
3
2
|
InferHrefType,
|
|
4
3
|
InferOutputsType,
|
|
5
4
|
PlDataTableState,
|
|
6
|
-
createPlDataTable,
|
|
7
5
|
PlTableFiltersModel,
|
|
8
6
|
PColumn,
|
|
9
7
|
PColumnValues,
|
|
10
|
-
PObjectId
|
|
8
|
+
PObjectId } from '@platforma-sdk/model';
|
|
9
|
+
import {
|
|
10
|
+
BlockModel,
|
|
11
|
+
createPlDataTable,
|
|
11
12
|
} from '@platforma-sdk/model';
|
|
12
13
|
import { z } from 'zod';
|
|
13
14
|
|
|
14
15
|
export const $BlockArgs = z.object({
|
|
15
|
-
numbers: z.array(z.coerce.number())
|
|
16
|
+
numbers: z.array(z.coerce.number()),
|
|
16
17
|
});
|
|
17
18
|
|
|
18
19
|
export type BlockArgs = z.infer<typeof $BlockArgs>;
|
|
@@ -24,13 +25,17 @@ export type TableState = {
|
|
|
24
25
|
|
|
25
26
|
export type UiState = {
|
|
26
27
|
dataTableState: TableState | undefined;
|
|
28
|
+
dynamicSections: {
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
}[];
|
|
27
32
|
};
|
|
28
33
|
|
|
29
34
|
export const platforma = BlockModel.create('Heavy')
|
|
30
35
|
|
|
31
|
-
.withArgs<BlockArgs>({ numbers: [1, 2, 3] })
|
|
36
|
+
.withArgs<BlockArgs>({ numbers: [1, 2, 3, 4] })
|
|
32
37
|
|
|
33
|
-
.withUiState<UiState>({ dataTableState: undefined })
|
|
38
|
+
.withUiState<UiState>({ dataTableState: undefined, dynamicSections: [] })
|
|
34
39
|
|
|
35
40
|
.output('numbers', (ctx) => ctx.outputs?.resolve('numbers')?.getDataAsJson<number[]>())
|
|
36
41
|
|
|
@@ -38,7 +43,7 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
38
43
|
if (!ctx.uiState?.dataTableState?.tableState.pTableParams?.filters) return undefined;
|
|
39
44
|
return createPlDataTable(ctx, [
|
|
40
45
|
{
|
|
41
|
-
id:
|
|
46
|
+
id: 'example' as PObjectId,
|
|
42
47
|
spec: {
|
|
43
48
|
kind: 'PColumn',
|
|
44
49
|
valueType: 'String',
|
|
@@ -53,21 +58,27 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
53
58
|
annotations: {
|
|
54
59
|
'pl7.app/label': 'Int axis',
|
|
55
60
|
},
|
|
56
|
-
}
|
|
57
|
-
]
|
|
61
|
+
},
|
|
62
|
+
],
|
|
58
63
|
},
|
|
59
64
|
data: [
|
|
60
65
|
{ key: [1], val: '1' },
|
|
61
|
-
{ key: [2], val: '2' }
|
|
62
|
-
]
|
|
63
|
-
} satisfies PColumn<PColumnValues
|
|
66
|
+
{ key: [2], val: '2' },
|
|
67
|
+
],
|
|
68
|
+
} satisfies PColumn<PColumnValues>,
|
|
64
69
|
], ctx.uiState.dataTableState.tableState, [
|
|
65
|
-
...ctx.uiState.dataTableState.tableState.pTableParams?.filters,
|
|
66
|
-
...(ctx.uiState.dataTableState.filterModel?.filters ?? [])
|
|
70
|
+
...(ctx.uiState.dataTableState.tableState.pTableParams?.filters ?? []),
|
|
71
|
+
...(ctx.uiState.dataTableState.filterModel?.filters ?? []),
|
|
67
72
|
]);
|
|
68
73
|
})
|
|
69
74
|
|
|
70
75
|
.sections((ctx) => {
|
|
76
|
+
const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it) => ({
|
|
77
|
+
type: 'link' as const,
|
|
78
|
+
href: `/section?id=${it.id}` as const,
|
|
79
|
+
label: it.label,
|
|
80
|
+
}));
|
|
81
|
+
|
|
71
82
|
return [
|
|
72
83
|
{ type: 'link', href: '/loaders', label: 'Loaders' },
|
|
73
84
|
{ type: 'link', href: '/', label: 'Icons/Masks' },
|
|
@@ -85,10 +96,23 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
85
96
|
{ type: 'link', href: '/errors', label: 'Errors' },
|
|
86
97
|
{ type: 'link', href: '/text-fields', label: 'PlTextField' },
|
|
87
98
|
{ type: 'link', href: '/tabs', label: 'PlTabs' },
|
|
88
|
-
{ type: 'link', href: '/drafts', label: 'Drafts' },
|
|
89
99
|
{ type: 'link', href: '/stacked-bar', label: 'PlChartStackedBar' },
|
|
100
|
+
{ type: 'link', href: '/histogram', label: 'PlChartHistogram' },
|
|
90
101
|
{ type: 'link', href: '/buttons', label: 'ButtonsPage' },
|
|
91
102
|
{ type: 'link', href: '/notifications', label: 'Notifications' },
|
|
103
|
+
{ type: 'link', href: '/drafts', label: 'Drafts' },
|
|
104
|
+
...(dynamicSections.length
|
|
105
|
+
? [
|
|
106
|
+
{ type: 'delimiter' },
|
|
107
|
+
...dynamicSections,
|
|
108
|
+
{ type: 'delimiter' }] as const
|
|
109
|
+
: []),
|
|
110
|
+
{
|
|
111
|
+
type: 'link',
|
|
112
|
+
href: '/add-section',
|
|
113
|
+
appearance: 'add-section',
|
|
114
|
+
label: 'New Dynamic section',
|
|
115
|
+
},
|
|
92
116
|
];
|
|
93
117
|
})
|
|
94
118
|
|