@milaboratories/milaboratories.ui-examples.model 1.0.47 → 1.0.48
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 +12 -12
- package/CHANGELOG.md +7 -0
- package/dist/bundle.js +157 -40
- package/dist/bundle.js.map +1 -1
- package/dist/index.cjs +19 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -13
- package/dist/index.d.ts +30 -13
- package/dist/index.js +20 -28
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +2 -2
- package/src/index.ts +32 -50
package/dist/index.cjs
CHANGED
|
@@ -7,35 +7,27 @@ var zod = require('zod');
|
|
|
7
7
|
var $BlockArgs = zod.z.object({
|
|
8
8
|
numbers: zod.z.array(zod.z.coerce.number())
|
|
9
9
|
});
|
|
10
|
-
var platforma = model.BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3] }).withUiState({ dataTableState: void 0 }).output("numbers", (ctx) => ctx.outputs?.resolve("numbers")?.getDataAsJson()).
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
var platforma = model.BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3] }).withUiState({ dataTableState: void 0 }).output("numbers", (ctx) => ctx.outputs?.resolve("numbers")?.getDataAsJson()).retentiveOutput("inputOptions", (ctx) => {
|
|
11
|
+
return ctx.resultPool.getOptions((spec) => model.isPColumnSpec(spec));
|
|
12
|
+
}).output("sheets", (ctx) => {
|
|
13
|
+
if (!ctx.uiState?.dataTableState?.anchorColumn) return void 0;
|
|
14
|
+
const anchor = ctx.resultPool.getPColumnByRef(ctx.uiState.dataTableState.anchorColumn);
|
|
15
|
+
if (!anchor) return void 0;
|
|
16
|
+
const r = model.getUniquePartitionKeys(anchor.data);
|
|
17
|
+
if (!r) return void 0;
|
|
18
|
+
return r.map((values, i) => model.createPlDataTableSheet(ctx, anchor.spec.axesSpec[i], values));
|
|
19
|
+
}).output("pt", (ctx) => {
|
|
20
|
+
if (ctx.uiState?.dataTableState?.anchorColumn === void 0) return void 0;
|
|
21
|
+
const anchorColumn = ctx.resultPool.getDataByRef(ctx.uiState.dataTableState.anchorColumn);
|
|
22
|
+
if (!anchorColumn || !model.isPColumn(anchorColumn)) {
|
|
23
|
+
console.error("Anchor column is undefined or is not PColumn", anchorColumn);
|
|
18
24
|
return void 0;
|
|
19
25
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const columns = collection.entries.map(({ obj }) => obj).filter(model.isPColumn);
|
|
26
|
-
if (columns.length === 0) return void 0;
|
|
27
|
-
let columnMissing = false;
|
|
28
|
-
const src = model.mapJoinEntry(join, (idAndSpec) => {
|
|
29
|
-
const column = columns.find((it) => it.id === idAndSpec.columnId);
|
|
30
|
-
if (!column) columnMissing = true;
|
|
31
|
-
return column;
|
|
32
|
-
});
|
|
33
|
-
if (columnMissing) return void 0;
|
|
34
|
-
return ctx.createPTable({
|
|
35
|
-
src,
|
|
36
|
-
filters: ctx.uiState.dataTableState?.tableState.pTableParams?.filters ?? [],
|
|
37
|
-
sorting: ctx.uiState.dataTableState?.tableState.pTableParams?.sorting ?? []
|
|
38
|
-
});
|
|
26
|
+
if (ctx.uiState.dataTableState.tableState.pTableParams?.filters === void 0) return void 0;
|
|
27
|
+
return model.createPlDataTable(ctx, [anchorColumn], ctx.uiState.dataTableState.tableState, [
|
|
28
|
+
...ctx.uiState.dataTableState.tableState.pTableParams?.filters,
|
|
29
|
+
...ctx.uiState.dataTableState.filterModel?.filters ?? []
|
|
30
|
+
]);
|
|
39
31
|
}).sections((ctx) => {
|
|
40
32
|
return [
|
|
41
33
|
{ type: "link", href: "/", label: "Icons/Masks" },
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["z","BlockModel","isPColumn","
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["z","BlockModel","isPColumnSpec","getUniquePartitionKeys","createPlDataTableSheet","isPColumn","createPlDataTable"],"mappings":";;;;;;AAgBa,IAAA,UAAA,GAAaA,MAAE,MAAO,CAAA;AAAA,EACjC,SAASA,KAAE,CAAA,KAAA,CAAMA,KAAE,CAAA,MAAA,CAAO,QAAQ;AACpC,CAAC;AAcM,IAAM,YAAYC,gBAAW,CAAA,MAAA,CAAO,OAAO,CAAA,CAE/C,SAAoB,EAAE,OAAA,EAAS,CAAC,CAAA,EAAG,GAAG,CAAC,CAAA,EAAG,CAAA,CAE1C,YAAqB,EAAE,cAAA,EAAgB,KAAU,CAAA,EAAC,EAElD,MAAO,CAAA,SAAA,EAAW,CAAC,GAAA,KAAQ,IAAI,OAAS,EAAA,OAAA,CAAQ,SAAS,CAAA,EAAG,eAAyB,CAAA,CAErF,eAAgB,CAAA,cAAA,EAAgB,CAAC,GAAQ,KAAA;AACxC,EAAA,OAAO,IAAI,UAAW,CAAA,UAAA,CAAW,CAAC,IAAS,KAAAC,mBAAA,CAAc,IAAI,CAAC,CAAA;AAChE,CAAC,CAEA,CAAA,MAAA,CAAO,QAAU,EAAA,CAAC,GAAQ,KAAA;AACzB,EAAA,IAAI,CAAC,GAAA,CAAI,OAAS,EAAA,cAAA,EAAgB,cAAqB,OAAA,KAAA,CAAA;AAEvD,EAAA,MAAM,SAAS,GAAI,CAAA,UAAA,CAAW,gBAAgB,GAAI,CAAA,OAAA,CAAQ,eAAe,YAAY,CAAA;AACrF,EAAI,IAAA,CAAC,QAAe,OAAA,KAAA,CAAA;AAEpB,EAAM,MAAA,CAAA,GAAIC,4BAAuB,CAAA,MAAA,CAAO,IAAI,CAAA;AAC5C,EAAI,IAAA,CAAC,GAAU,OAAA,KAAA,CAAA;AACf,EAAA,OAAO,CAAE,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,CAAM,KAAAC,4BAAA,C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PColumn,\n isPColumnSpec,\n PlRef,\n getUniquePartitionKeys,\n createPlDataTableSheet,\n createPlDataTable,\n PlTableFiltersModel\n} from '@platforma-sdk/model';\nimport { z } from 'zod';\n\nexport const $BlockArgs = z.object({\n numbers: z.array(z.coerce.number())\n});\n\nexport type BlockArgs = z.infer<typeof $BlockArgs>;\n\nexport type TableState = {\n tableState: PlDataTableState;\n anchorColumn?: PlRef;\n filterModel: PlTableFiltersModel;\n};\n\nexport type UiState = {\n dataTableState: TableState | undefined;\n};\n\nexport const platforma = BlockModel.create('Heavy')\n\n .withArgs<BlockArgs>({ numbers: [1, 2, 3] })\n\n .withUiState<UiState>({ dataTableState: undefined })\n\n .output('numbers', (ctx) => ctx.outputs?.resolve('numbers')?.getDataAsJson<number[]>())\n\n .retentiveOutput('inputOptions', (ctx) => {\n return ctx.resultPool.getOptions((spec) => isPColumnSpec(spec));\n })\n\n .output('sheets', (ctx) => {\n if (!ctx.uiState?.dataTableState?.anchorColumn) return undefined;\n\n const anchor = ctx.resultPool.getPColumnByRef(ctx.uiState.dataTableState.anchorColumn);\n if (!anchor) return undefined;\n\n const r = getUniquePartitionKeys(anchor.data);\n if (!r) return undefined;\n return r.map((values, i) => createPlDataTableSheet(ctx, anchor.spec.axesSpec[i], values));\n })\n\n .output('pt', (ctx) => {\n if (ctx.uiState?.dataTableState?.anchorColumn === undefined) return undefined;\n\n const anchorColumn = ctx.resultPool.getDataByRef(ctx.uiState.dataTableState.anchorColumn);\n if (!anchorColumn || !isPColumn(anchorColumn)) {\n console.error('Anchor column is undefined or is not PColumn', anchorColumn);\n return undefined;\n }\n\n // wait until sheet filters are set\n if (ctx.uiState.dataTableState.tableState.pTableParams?.filters === undefined) return undefined;\n\n return createPlDataTable(ctx, [anchorColumn], ctx.uiState.dataTableState.tableState, [\n ...ctx.uiState.dataTableState.tableState.pTableParams?.filters,\n ...(ctx.uiState.dataTableState.filterModel?.filters ?? [])\n ]);\n })\n\n .sections((ctx) => {\n return [\n { type: 'link', href: '/', label: 'Icons/Masks' },\n { type: 'link', href: '/layout', label: 'Layout' },\n { type: 'link', href: '/form-components', label: 'Form Components' },\n { type: 'link', href: '/log-view', label: 'PlLogView' },\n { type: 'link', href: '/modals', label: 'Modals' },\n { type: 'link', href: '/select-files', label: 'Select Files' },\n { type: 'link', href: '/inject-env', label: 'Inject env' },\n { type: 'link', href: '/dropdowns', label: 'Dropdowns' },\n { type: 'link', href: '/use-watch-fetch', label: 'useWatchFetch' },\n { type: 'link', href: '/typography', label: 'Typography' },\n { type: 'link', href: '/ag-grid-vue', label: 'AgGridVue' },\n { type: 'link', href: '/pl-ag-data-table', label: 'PlAgDataTable' },\n { type: 'link', href: '/errors', label: 'Errors' },\n { type: 'link', href: '/text-fields', label: 'PlTextField' },\n { type: 'link', href: '/tabs', label: 'PlTabs' },\n { type: 'link', href: '/drafts', label: 'Drafts' },\n ];\n })\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof platforma>;\nexport type Href = InferHrefType<typeof platforma>;\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _platforma_sdk_model from '@platforma-sdk/model';
|
|
2
|
-
import {
|
|
2
|
+
import { PlDataTableState, PlRef, PlTableFiltersModel, ValueType, InferOutputsType, InferHrefType } from '@platforma-sdk/model';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
declare const $BlockArgs: z.ZodObject<{
|
|
@@ -11,17 +11,9 @@ declare const $BlockArgs: z.ZodObject<{
|
|
|
11
11
|
}>;
|
|
12
12
|
type BlockArgs = z.infer<typeof $BlockArgs>;
|
|
13
13
|
type TableState = {
|
|
14
|
-
settingsOpened: boolean;
|
|
15
|
-
gridState: PlDataTableGridState;
|
|
16
|
-
group: {
|
|
17
|
-
mainColumn?: PColumnIdAndSpec;
|
|
18
|
-
additionalColumns: PColumnIdAndSpec[];
|
|
19
|
-
enrichmentColumns: PColumnIdAndSpec[];
|
|
20
|
-
possiblePartitioningAxes: AxisSpec[];
|
|
21
|
-
join?: JoinEntry<PColumnIdAndSpec>;
|
|
22
|
-
};
|
|
23
|
-
partitioningAxes: AxisId[];
|
|
24
14
|
tableState: PlDataTableState;
|
|
15
|
+
anchorColumn?: PlRef;
|
|
16
|
+
filterModel: PlTableFiltersModel;
|
|
25
17
|
};
|
|
26
18
|
type UiState = {
|
|
27
19
|
dataTableState: TableState | undefined;
|
|
@@ -30,8 +22,33 @@ declare const platforma: _platforma_sdk_model.Platforma<{
|
|
|
30
22
|
numbers: number[];
|
|
31
23
|
}, {
|
|
32
24
|
numbers: _platforma_sdk_model.ValueOrErrors<number[] | undefined>;
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
inputOptions: _platforma_sdk_model.ValueOrErrors<{
|
|
26
|
+
readonly ref: {
|
|
27
|
+
readonly __isRef: true;
|
|
28
|
+
readonly blockId: string;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
};
|
|
31
|
+
readonly label: string;
|
|
32
|
+
}[]>;
|
|
33
|
+
sheets: _platforma_sdk_model.ValueOrErrors<{
|
|
34
|
+
axis: {
|
|
35
|
+
readonly type: ValueType;
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly domain?: {
|
|
38
|
+
[x: string]: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
readonly annotations?: {
|
|
41
|
+
[x: string]: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
readonly parentAxes?: number[] | undefined;
|
|
44
|
+
};
|
|
45
|
+
options: {
|
|
46
|
+
value: string | number;
|
|
47
|
+
label: string;
|
|
48
|
+
}[];
|
|
49
|
+
defaultValue?: (string | number) | undefined;
|
|
50
|
+
}[] | undefined>;
|
|
51
|
+
pt: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PTableHandle | undefined>;
|
|
35
52
|
}, UiState, "/" | "/layout" | "/form-components" | "/log-view" | "/modals" | "/select-files" | "/inject-env" | "/dropdowns" | "/use-watch-fetch" | "/typography" | "/ag-grid-vue" | "/pl-ag-data-table" | "/errors" | "/text-fields" | "/tabs" | "/drafts">;
|
|
36
53
|
type BlockOutputs = InferOutputsType<typeof platforma>;
|
|
37
54
|
type Href = InferHrefType<typeof platforma>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _platforma_sdk_model from '@platforma-sdk/model';
|
|
2
|
-
import {
|
|
2
|
+
import { PlDataTableState, PlRef, PlTableFiltersModel, ValueType, InferOutputsType, InferHrefType } from '@platforma-sdk/model';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
declare const $BlockArgs: z.ZodObject<{
|
|
@@ -11,17 +11,9 @@ declare const $BlockArgs: z.ZodObject<{
|
|
|
11
11
|
}>;
|
|
12
12
|
type BlockArgs = z.infer<typeof $BlockArgs>;
|
|
13
13
|
type TableState = {
|
|
14
|
-
settingsOpened: boolean;
|
|
15
|
-
gridState: PlDataTableGridState;
|
|
16
|
-
group: {
|
|
17
|
-
mainColumn?: PColumnIdAndSpec;
|
|
18
|
-
additionalColumns: PColumnIdAndSpec[];
|
|
19
|
-
enrichmentColumns: PColumnIdAndSpec[];
|
|
20
|
-
possiblePartitioningAxes: AxisSpec[];
|
|
21
|
-
join?: JoinEntry<PColumnIdAndSpec>;
|
|
22
|
-
};
|
|
23
|
-
partitioningAxes: AxisId[];
|
|
24
14
|
tableState: PlDataTableState;
|
|
15
|
+
anchorColumn?: PlRef;
|
|
16
|
+
filterModel: PlTableFiltersModel;
|
|
25
17
|
};
|
|
26
18
|
type UiState = {
|
|
27
19
|
dataTableState: TableState | undefined;
|
|
@@ -30,8 +22,33 @@ declare const platforma: _platforma_sdk_model.Platforma<{
|
|
|
30
22
|
numbers: number[];
|
|
31
23
|
}, {
|
|
32
24
|
numbers: _platforma_sdk_model.ValueOrErrors<number[] | undefined>;
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
inputOptions: _platforma_sdk_model.ValueOrErrors<{
|
|
26
|
+
readonly ref: {
|
|
27
|
+
readonly __isRef: true;
|
|
28
|
+
readonly blockId: string;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
};
|
|
31
|
+
readonly label: string;
|
|
32
|
+
}[]>;
|
|
33
|
+
sheets: _platforma_sdk_model.ValueOrErrors<{
|
|
34
|
+
axis: {
|
|
35
|
+
readonly type: ValueType;
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly domain?: {
|
|
38
|
+
[x: string]: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
readonly annotations?: {
|
|
41
|
+
[x: string]: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
readonly parentAxes?: number[] | undefined;
|
|
44
|
+
};
|
|
45
|
+
options: {
|
|
46
|
+
value: string | number;
|
|
47
|
+
label: string;
|
|
48
|
+
}[];
|
|
49
|
+
defaultValue?: (string | number) | undefined;
|
|
50
|
+
}[] | undefined>;
|
|
51
|
+
pt: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PTableHandle | undefined>;
|
|
35
52
|
}, UiState, "/" | "/layout" | "/form-components" | "/log-view" | "/modals" | "/select-files" | "/inject-env" | "/dropdowns" | "/use-watch-fetch" | "/typography" | "/ag-grid-vue" | "/pl-ag-data-table" | "/errors" | "/text-fields" | "/tabs" | "/drafts">;
|
|
36
53
|
type BlockOutputs = InferOutputsType<typeof platforma>;
|
|
37
54
|
type Href = InferHrefType<typeof platforma>;
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
import { BlockModel, isPColumn,
|
|
1
|
+
import { BlockModel, isPColumnSpec, getUniquePartitionKeys, createPlDataTableSheet, isPColumn, createPlDataTable } from '@platforma-sdk/model';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
5
|
var $BlockArgs = z.object({
|
|
6
6
|
numbers: z.array(z.coerce.number())
|
|
7
7
|
});
|
|
8
|
-
var platforma = BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3] }).withUiState({ dataTableState: void 0 }).output("numbers", (ctx) => ctx.outputs?.resolve("numbers")?.getDataAsJson()).
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
var platforma = BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3] }).withUiState({ dataTableState: void 0 }).output("numbers", (ctx) => ctx.outputs?.resolve("numbers")?.getDataAsJson()).retentiveOutput("inputOptions", (ctx) => {
|
|
9
|
+
return ctx.resultPool.getOptions((spec) => isPColumnSpec(spec));
|
|
10
|
+
}).output("sheets", (ctx) => {
|
|
11
|
+
if (!ctx.uiState?.dataTableState?.anchorColumn) return void 0;
|
|
12
|
+
const anchor = ctx.resultPool.getPColumnByRef(ctx.uiState.dataTableState.anchorColumn);
|
|
13
|
+
if (!anchor) return void 0;
|
|
14
|
+
const r = getUniquePartitionKeys(anchor.data);
|
|
15
|
+
if (!r) return void 0;
|
|
16
|
+
return r.map((values, i) => createPlDataTableSheet(ctx, anchor.spec.axesSpec[i], values));
|
|
17
|
+
}).output("pt", (ctx) => {
|
|
18
|
+
if (ctx.uiState?.dataTableState?.anchorColumn === void 0) return void 0;
|
|
19
|
+
const anchorColumn = ctx.resultPool.getDataByRef(ctx.uiState.dataTableState.anchorColumn);
|
|
20
|
+
if (!anchorColumn || !isPColumn(anchorColumn)) {
|
|
21
|
+
console.error("Anchor column is undefined or is not PColumn", anchorColumn);
|
|
16
22
|
return void 0;
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const columns = collection.entries.map(({ obj }) => obj).filter(isPColumn);
|
|
24
|
-
if (columns.length === 0) return void 0;
|
|
25
|
-
let columnMissing = false;
|
|
26
|
-
const src = mapJoinEntry(join, (idAndSpec) => {
|
|
27
|
-
const column = columns.find((it) => it.id === idAndSpec.columnId);
|
|
28
|
-
if (!column) columnMissing = true;
|
|
29
|
-
return column;
|
|
30
|
-
});
|
|
31
|
-
if (columnMissing) return void 0;
|
|
32
|
-
return ctx.createPTable({
|
|
33
|
-
src,
|
|
34
|
-
filters: ctx.uiState.dataTableState?.tableState.pTableParams?.filters ?? [],
|
|
35
|
-
sorting: ctx.uiState.dataTableState?.tableState.pTableParams?.sorting ?? []
|
|
36
|
-
});
|
|
24
|
+
if (ctx.uiState.dataTableState.tableState.pTableParams?.filters === void 0) return void 0;
|
|
25
|
+
return createPlDataTable(ctx, [anchorColumn], ctx.uiState.dataTableState.tableState, [
|
|
26
|
+
...ctx.uiState.dataTableState.tableState.pTableParams?.filters,
|
|
27
|
+
...ctx.uiState.dataTableState.filterModel?.filters ?? []
|
|
28
|
+
]);
|
|
37
29
|
}).sections((ctx) => {
|
|
38
30
|
return [
|
|
39
31
|
{ type: "link", href: "/", label: "Icons/Masks" },
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;AAgBa,IAAA,UAAA,GAAa,EAAE,MAAO,CAAA;AAAA,EACjC,SAAS,CAAE,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,CAAO,QAAQ;AACpC,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;AAgBa,IAAA,UAAA,GAAa,EAAE,MAAO,CAAA;AAAA,EACjC,SAAS,CAAE,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,CAAO,QAAQ;AACpC,CAAC;AAcM,IAAM,YAAY,UAAW,CAAA,MAAA,CAAO,OAAO,CAAA,CAE/C,SAAoB,EAAE,OAAA,EAAS,CAAC,CAAA,EAAG,GAAG,CAAC,CAAA,EAAG,CAAA,CAE1C,YAAqB,EAAE,cAAA,EAAgB,KAAU,CAAA,EAAC,EAElD,MAAO,CAAA,SAAA,EAAW,CAAC,GAAA,KAAQ,IAAI,OAAS,EAAA,OAAA,CAAQ,SAAS,CAAA,EAAG,e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A,aAAA,EAAe,OAAO,YAAa,EAAA;AAAA,IACzD,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,cAAA,EAAgB,OAAO,WAAY,EAAA;AAAA,IACzD,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,mBAAA,EAAqB,OAAO,eAAgB,EAAA;AAAA,IAClE,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,SAAA,EAAW,OAAO,QAAS,EAAA;AAAA,IACjD,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,cAAA,EAAgB,OAAO,aAAc,EAAA;AAAA,IAC3D,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,OAAA,EAAS,OAAO,QAAS,EAAA;AAAA,IAC/C,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,SAAA,EAAW,OAAO,QAAS;AAAA,GACnD;AACF,CAAC,EAEA,IAAK","file":"index.js","sourcesContent":["import {\n BlockModel,\n InferHrefType,\n InferOutputsType,\n PlDataTableState,\n ValueType,\n isPColumn,\n isPColumnSpec,\n PlRef,\n getUniquePartitionKeys,\n createPlDataTableSheet,\n createPlDataTable,\n PlTableFiltersModel\n} from '@platforma-sdk/model';\nimport { z } from 'zod';\n\nexport const $BlockArgs = z.object({\n numbers: z.array(z.coerce.number())\n});\n\nexport type BlockArgs = z.infer<typeof $BlockArgs>;\n\nexport type TableState = {\n tableState: PlDataTableState;\n anchorColumn?: PlRef;\n filterModel: PlTableFiltersModel;\n};\n\nexport type UiState = {\n dataTableState: TableState | undefined;\n};\n\nexport const platforma = BlockModel.create('Heavy')\n\n .withArgs<BlockArgs>({ numbers: [1, 2, 3] })\n\n .withUiState<UiState>({ dataTableState: undefined })\n\n .output('numbers', (ctx) => ctx.outputs?.resolve('numbers')?.getDataAsJson<number[]>())\n\n .retentiveOutput('inputOptions', (ctx) => {\n return ctx.resultPool.getOptions((spec) => isPColumnSpec(spec));\n })\n\n .output('sheets', (ctx) => {\n if (!ctx.uiState?.dataTableState?.anchorColumn) return undefined;\n\n const anchor = ctx.resultPool.getPColumnByRef(ctx.uiState.dataTableState.anchorColumn);\n if (!anchor) return undefined;\n\n const r = getUniquePartitionKeys(anchor.data);\n if (!r) return undefined;\n return r.map((values, i) => createPlDataTableSheet(ctx, anchor.spec.axesSpec[i], values));\n })\n\n .output('pt', (ctx) => {\n if (ctx.uiState?.dataTableState?.anchorColumn === undefined) return undefined;\n\n const anchorColumn = ctx.resultPool.getDataByRef(ctx.uiState.dataTableState.anchorColumn);\n if (!anchorColumn || !isPColumn(anchorColumn)) {\n console.error('Anchor column is undefined or is not PColumn', anchorColumn);\n return undefined;\n }\n\n // wait until sheet filters are set\n if (ctx.uiState.dataTableState.tableState.pTableParams?.filters === undefined) return undefined;\n\n return createPlDataTable(ctx, [anchorColumn], ctx.uiState.dataTableState.tableState, [\n ...ctx.uiState.dataTableState.tableState.pTableParams?.filters,\n ...(ctx.uiState.dataTableState.filterModel?.filters ?? [])\n ]);\n })\n\n .sections((ctx) => {\n return [\n { type: 'link', href: '/', label: 'Icons/Masks' },\n { type: 'link', href: '/layout', label: 'Layout' },\n { type: 'link', href: '/form-components', label: 'Form Components' },\n { type: 'link', href: '/log-view', label: 'PlLogView' },\n { type: 'link', href: '/modals', label: 'Modals' },\n { type: 'link', href: '/select-files', label: 'Select Files' },\n { type: 'link', href: '/inject-env', label: 'Inject env' },\n { type: 'link', href: '/dropdowns', label: 'Dropdowns' },\n { type: 'link', href: '/use-watch-fetch', label: 'useWatchFetch' },\n { type: 'link', href: '/typography', label: 'Typography' },\n { type: 'link', href: '/ag-grid-vue', label: 'AgGridVue' },\n { type: 'link', href: '/pl-ag-data-table', label: 'PlAgDataTable' },\n { type: 'link', href: '/errors', label: 'Errors' },\n { type: 'link', href: '/text-fields', label: 'PlTextField' },\n { type: 'link', href: '/tabs', label: 'PlTabs' },\n { type: 'link', href: '/drafts', label: 'Drafts' },\n ];\n })\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof platforma>;\nexport type Href = InferHrefType<typeof platforma>;\n"]}
|