@milaboratories/milaboratories.ui-examples.model 1.0.50 → 1.1.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/.turbo/turbo-build.log +13 -13
- package/CHANGELOG.md +18 -0
- package/dist/bundle.js +330 -363
- package/dist/bundle.js.map +1 -1
- package/dist/index.cjs +28 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -28
- package/dist/index.d.ts +1 -28
- package/dist/index.js +29 -19
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +3 -3
- package/src/index.ts +31 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/milaboratories.ui-examples.model",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.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.
|
|
11
|
+
"@platforma-sdk/model": "1.20.0"
|
|
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.4.
|
|
17
|
+
"@platforma-sdk/block-tools": "2.4.11"
|
|
18
18
|
},
|
|
19
19
|
"tsup": {
|
|
20
20
|
"entry": [
|
package/src/index.ts
CHANGED
|
@@ -3,14 +3,11 @@ import {
|
|
|
3
3
|
InferHrefType,
|
|
4
4
|
InferOutputsType,
|
|
5
5
|
PlDataTableState,
|
|
6
|
-
ValueType,
|
|
7
|
-
isPColumn,
|
|
8
|
-
isPColumnSpec,
|
|
9
|
-
PlRef,
|
|
10
|
-
getUniquePartitionKeys,
|
|
11
|
-
createPlDataTableSheet,
|
|
12
6
|
createPlDataTable,
|
|
13
|
-
PlTableFiltersModel
|
|
7
|
+
PlTableFiltersModel,
|
|
8
|
+
PColumn,
|
|
9
|
+
PColumnValues,
|
|
10
|
+
PObjectId,
|
|
14
11
|
} from '@platforma-sdk/model';
|
|
15
12
|
import { z } from 'zod';
|
|
16
13
|
|
|
@@ -22,7 +19,6 @@ export type BlockArgs = z.infer<typeof $BlockArgs>;
|
|
|
22
19
|
|
|
23
20
|
export type TableState = {
|
|
24
21
|
tableState: PlDataTableState;
|
|
25
|
-
anchorColumn?: PlRef;
|
|
26
22
|
filterModel: PlTableFiltersModel;
|
|
27
23
|
};
|
|
28
24
|
|
|
@@ -38,34 +34,34 @@ export const platforma = BlockModel.create('Heavy')
|
|
|
38
34
|
|
|
39
35
|
.output('numbers', (ctx) => ctx.outputs?.resolve('numbers')?.getDataAsJson<number[]>())
|
|
40
36
|
|
|
41
|
-
.retentiveOutput('inputOptions', (ctx) => {
|
|
42
|
-
return ctx.resultPool.getOptions((spec) => isPColumnSpec(spec));
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
.output('sheets', (ctx) => {
|
|
46
|
-
if (!ctx.uiState?.dataTableState?.anchorColumn) return undefined;
|
|
47
|
-
|
|
48
|
-
const anchor = ctx.resultPool.getPColumnByRef(ctx.uiState.dataTableState.anchorColumn);
|
|
49
|
-
if (!anchor) return undefined;
|
|
50
|
-
|
|
51
|
-
const r = getUniquePartitionKeys(anchor.data);
|
|
52
|
-
if (!r) return undefined;
|
|
53
|
-
return r.map((values, i) => createPlDataTableSheet(ctx, anchor.spec.axesSpec[i], values));
|
|
54
|
-
})
|
|
55
|
-
|
|
56
37
|
.output('pt', (ctx) => {
|
|
57
|
-
if (ctx.uiState?.dataTableState?.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
38
|
+
if (!ctx.uiState?.dataTableState?.tableState.pTableParams?.filters) return undefined;
|
|
39
|
+
return createPlDataTable(ctx, [
|
|
40
|
+
{
|
|
41
|
+
id: "example" as PObjectId,
|
|
42
|
+
spec: {
|
|
43
|
+
kind: 'PColumn',
|
|
44
|
+
valueType: 'String',
|
|
45
|
+
name: 'example',
|
|
46
|
+
annotations: {
|
|
47
|
+
'pl7.app/label': 'String column',
|
|
48
|
+
},
|
|
49
|
+
axesSpec: [
|
|
50
|
+
{
|
|
51
|
+
type: 'Int',
|
|
52
|
+
name: 'index',
|
|
53
|
+
annotations: {
|
|
54
|
+
'pl7.app/label': 'Int axis',
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
data: [
|
|
60
|
+
{ key: [1], val: '1' },
|
|
61
|
+
{ key: [2], val: '2' }
|
|
62
|
+
]
|
|
63
|
+
} satisfies PColumn<PColumnValues>
|
|
64
|
+
], ctx.uiState.dataTableState.tableState, [
|
|
69
65
|
...ctx.uiState.dataTableState.tableState.pTableParams?.filters,
|
|
70
66
|
...(ctx.uiState.dataTableState.filterModel?.filters ?? [])
|
|
71
67
|
]);
|