@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/dist/index.cjs CHANGED
@@ -27,7 +27,14 @@ var $BlockArgs = zod.z.object({
27
27
  numbers: zod.z.array(zod.z.coerce.number()),
28
28
  handles: zod.z.array(ImportFileHandleSchema)
29
29
  });
30
- var platforma = model.BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
30
+ var platforma = model.BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] }).withUiState({
31
+ dataTableState: void 0,
32
+ dataTableStateV2: {
33
+ tableState: model.createPlDataTableStateV2(),
34
+ filterModel: {}
35
+ },
36
+ dynamicSections: []
37
+ }).argsValid((ctx) => {
31
38
  if (ctx.args.numbers.length === 5) {
32
39
  throw new Error("argsValid: test error");
33
40
  }
@@ -88,60 +95,107 @@ var platforma = model.BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3, 4
88
95
  ]
89
96
  }
90
97
  );
98
+ }).output("ptV2Sheets", (ctx) => {
99
+ const rowCount = ctx.args.tableNumRows ?? 0;
100
+ const sheets = [
101
+ {
102
+ axis: {
103
+ type: "Int",
104
+ name: "part",
105
+ annotations: {
106
+ "pl7.app/label": "Partitioned axis",
107
+ "pl7.app/discreteValues": "[0,1]"
108
+ }
109
+ },
110
+ options: [
111
+ { value: 0, label: "Partition 1" },
112
+ { value: 1, label: "Partition 2" }
113
+ ]
114
+ }
115
+ ];
116
+ return rowCount > 0 ? sheets : [];
91
117
  }).output("ptV2", (ctx) => {
92
- if (!ctx.uiState?.dataTableState?.tableState.pTableParams?.filters) return void 0;
93
- const data = times(ctx.args.tableNumRows ?? 0, (i) => {
94
- const v = i + 1;
95
- return {
96
- key: [v, v + 0.1],
97
- val: v.toString()
98
- };
99
- });
100
- return model.createPlDataTableV2(
101
- ctx,
102
- [
103
- {
104
- id: "example",
105
- spec: {
106
- kind: "PColumn",
107
- valueType: "String",
108
- name: "example",
109
- annotations: {
110
- "pl7.app/label": "String column",
111
- "pl7.app/discreteValues": '["up","down"]'
118
+ const rowCount = ctx.args.tableNumRows ?? 0;
119
+ const makePartitionId = (rowCount2, i) => Math.floor(2 * i / (rowCount2 + 1));
120
+ const columns = [
121
+ {
122
+ id: "column1",
123
+ spec: {
124
+ kind: "PColumn",
125
+ valueType: "String",
126
+ name: "example",
127
+ annotations: {
128
+ "pl7.app/label": "String column",
129
+ "pl7.app/discreteValues": '["up","down"]'
130
+ },
131
+ axesSpec: [
132
+ {
133
+ type: "Int",
134
+ name: "part",
135
+ annotations: {
136
+ "pl7.app/label": "Partitioned axis",
137
+ "pl7.app/discreteValues": "[0,1]"
138
+ }
112
139
  },
113
- axesSpec: [
114
- {
115
- type: "Int",
116
- name: "index",
117
- annotations: {
118
- "pl7.app/label": "Int axis",
119
- "pl7.app/discreteValues": "[1,2]"
120
- }
121
- },
122
- {
123
- type: "Float",
124
- name: "value",
125
- annotations: {
126
- "pl7.app/label": "Float axis",
127
- "pl7.app/table/visibility": "optional"
128
- }
140
+ {
141
+ type: "Int",
142
+ name: "index",
143
+ annotations: {
144
+ "pl7.app/label": "Int axis"
129
145
  }
130
- ]
131
- },
132
- data
133
- }
134
- ],
135
- model.selectorsToPredicate({
136
- name: "example"
137
- }),
138
- ctx.uiState.dataTableState.tableState,
146
+ }
147
+ ]
148
+ },
149
+ data: times(rowCount, (i) => {
150
+ const v = i + 1;
151
+ return {
152
+ key: [makePartitionId(rowCount, v), v],
153
+ val: v.toString()
154
+ };
155
+ })
156
+ },
139
157
  {
140
- filters: [
141
- ...ctx.uiState.dataTableState.tableState.pTableParams?.filters ?? [],
142
- ...ctx.uiState.dataTableState.filterModel?.filters ?? []
143
- ]
158
+ id: "column2",
159
+ spec: {
160
+ kind: "PColumn",
161
+ valueType: "Float",
162
+ name: "value",
163
+ annotations: {
164
+ "pl7.app/label": "Float column",
165
+ "pl7.app/table/visibility": "optional"
166
+ },
167
+ axesSpec: [
168
+ {
169
+ type: "Int",
170
+ name: "part",
171
+ annotations: {
172
+ "pl7.app/label": "Partitioned axis",
173
+ "pl7.app/discreteValues": "[0,1]"
174
+ }
175
+ },
176
+ {
177
+ type: "Int",
178
+ name: "index",
179
+ annotations: {
180
+ "pl7.app/label": "Int axis"
181
+ }
182
+ }
183
+ ]
184
+ },
185
+ data: times(rowCount, (i) => {
186
+ const v = i + 1;
187
+ return {
188
+ key: [makePartitionId(rowCount, v), v],
189
+ val: v + 0.1
190
+ };
191
+ })
144
192
  }
193
+ ];
194
+ return model.createPlDataTableV2(
195
+ ctx,
196
+ columns,
197
+ ctx.uiState.dataTableStateV2.tableState,
198
+ { filters: ctx.uiState.dataTableStateV2.filterModel?.filters ?? [] }
145
199
  );
146
200
  }).title((ctx) => {
147
201
  if (ctx.args.numbers.length === 5) {
@@ -175,6 +229,7 @@ var platforma = model.BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3, 4
175
229
  { type: "link", href: "/pl-splash-page", label: "PlSplashPage" },
176
230
  { type: "link", href: "/pl-file-input-page", label: "PlFileInputPage" },
177
231
  { type: "link", href: "/pl-error-boundary-page", label: "PlErrorBoundaryPage" },
232
+ { type: "link", href: "/pl-element-list-page", label: "PlElementList" },
178
233
  { type: "link", href: "/errors", label: "Errors" },
179
234
  { type: "link", href: "/text-fields", label: "PlTextField" },
180
235
  { type: "link", href: "/tabs", label: "PlTabs" },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["z","BlockModel","createPlDataTable","createPlDataTableV2","selectorsToPredicate"],"mappings":";;;;;;AAkBO,IAAM,sBAAyB,GAAAA,KAAA,CACnC,MAAO,EAAA,CACP,UACA,CAAA,MAAA;AAAA,EACE,CAAC,EAAO,KAAA;AACX;AAEK,UAAU,KAAM,CAAA,IAAA,EAAc,EAA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AA,EAAQ,IAAM,EAAA,gBAAA,EAAkB,OAAO,eAAgB,EAAA;AAAA,IAC/D,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,SAAA,EAAW,OAAO,QAAS,EAAA;AAAA,IACjD,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,kBAAA,EAAoB,OAAO,gBAAiB,EAAA;AAAA,IAClE,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,QAAA,EAAU,OAAO,SAAU,EAAA;AAAA,IACjD,GAAI,gBAAgB,MAChB,GAAA;AAAA,MACE,EAAE,MAAM,WAAY,EAAA;AAAA,MACpB,GAAG,eAAA;AAAA,MACH,EAAE,MAAM,WAAY;AAAA,QACtB,EAAC;AAAA,IACL;AAAA,MACE,IAAM,EAAA,MAAA;AAAA,MACN,IAAM,EAAA,cAAA;AAAA,MACN,UAAY,EAAA,aAAA;AAAA,MACZ,KAAO,EAAA;AAAA;AACT,GACF;AACF,CAAC,EAEA,IAAK","file":"index.cjs","sourcesContent":["import type {\n InferHrefType,\n InferOutputsType,\n PlDataTableState,\n PlTableFiltersModel,\n PColumn,\n PColumnValues,\n PObjectId,\n ImportFileHandle,\n} from '@platforma-sdk/model';\nimport {\n BlockModel,\n createPlDataTable,\n createPlDataTableV2,\n selectorsToPredicate,\n} from '@platforma-sdk/model';\nimport { z } from 'zod';\n\nexport const ImportFileHandleSchema = z\n .string()\n .optional()\n .refine<ImportFileHandle | undefined>(\n ((_a) => true) as (arg: string | undefined) => arg is ImportFileHandle | undefined,\n );\n\nexport function* range(from: number, to: number, step = 1) {\n for (let i = from; i < to; i += step) {\n yield i;\n }\n}\n\nexport function toList<T>(iterable: Iterable<T>): T[] {\n const lst: T[] = [];\n for (const it of iterable) {\n lst.push(it);\n }\n\n return lst;\n}\n\nexport function times<R>(n: number, cb: (i: number) => R): R[] {\n return toList(range(0, n)).map(cb);\n}\n\nexport const $BlockArgs = z.object({\n tableNumRows: z.number().default(100),\n numbers: z.array(z.coerce.number()),\n handles: z.array(ImportFileHandleSchema),\n});\n\nexport type BlockArgs = z.infer<typeof $BlockArgs>;\n\nexport type TableState = {\n tableState: PlDataTableState;\n filterModel: PlTableFiltersModel;\n};\n\nexport type UiState = {\n dataTableState: TableState | undefined;\n dynamicSections: {\n id: string;\n label: string;\n }[];\n};\n\nexport const platforma = BlockModel.create('Heavy')\n\n .withArgs<BlockArgs>({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] })\n\n .withUiState<UiState>({ dataTableState: undefined, dynamicSections: [] })\n\n .argsValid((ctx) => {\n if (ctx.args.numbers.length === 5) {\n throw new Error('argsValid: test error');\n }\n\n return ctx.args.numbers.length > 0;\n })\n\n .output('numbers', (ctx) => ctx.outputs?.resolve('numbers')?.getDataAsJson<number[]>())\n\n .output('progresses', (ctx) => {\n const m = ctx.outputs?.resolve('progresses');\n const progresses = m?.mapFields((name, val) => [name, val?.getImportProgress()] as const);\n return Object.fromEntries(progresses ?? []);\n })\n\n .output('pt', (ctx) => {\n if (!ctx.uiState?.dataTableState?.tableState.pTableParams?.filters) return undefined;\n\n const data = times(ctx.args.tableNumRows ?? 0, (i) => {\n const v = i + 1;\n return {\n key: [v, v + 0.1],\n val: v.toString(),\n };\n });\n\n return createPlDataTable(\n ctx,\n [\n {\n id: 'example' as PObjectId,\n spec: {\n kind: 'PColumn',\n valueType: 'String',\n name: 'example',\n annotations: {\n 'pl7.app/label': 'String column',\n 'pl7.app/discreteValues': '[\"up\",\"down\"]',\n },\n axesSpec: [\n {\n type: 'Int',\n name: 'index',\n annotations: {\n 'pl7.app/label': 'Int axis',\n 'pl7.app/discreteValues': '[1,2]',\n },\n },\n {\n type: 'Float',\n name: 'value',\n annotations: {\n 'pl7.app/label': 'Float axis',\n 'pl7.app/table/visibility': 'optional',\n },\n },\n ],\n },\n data,\n } satisfies PColumn<PColumnValues>,\n ],\n ctx.uiState.dataTableState.tableState,\n {\n filters: [\n ...(ctx.uiState.dataTableState.tableState.pTableParams?.filters ?? []),\n ...(ctx.uiState.dataTableState.filterModel?.filters ?? []),\n ],\n },\n );\n })\n\n .output('ptV2', (ctx) => {\n if (!ctx.uiState?.dataTableState?.tableState.pTableParams?.filters) return undefined;\n\n const data = times(ctx.args.tableNumRows ?? 0, (i) => {\n const v = i + 1;\n return {\n key: [v, v + 0.1],\n val: v.toString(),\n };\n });\n\n return createPlDataTableV2(\n ctx,\n [\n {\n id: 'example' as PObjectId,\n spec: {\n kind: 'PColumn',\n valueType: 'String',\n name: 'example',\n annotations: {\n 'pl7.app/label': 'String column',\n 'pl7.app/discreteValues': '[\"up\",\"down\"]',\n },\n axesSpec: [\n {\n type: 'Int',\n name: 'index',\n annotations: {\n 'pl7.app/label': 'Int axis',\n 'pl7.app/discreteValues': '[1,2]',\n },\n },\n {\n type: 'Float',\n name: 'value',\n annotations: {\n 'pl7.app/label': 'Float axis',\n 'pl7.app/table/visibility': 'optional',\n },\n },\n ],\n },\n data,\n } satisfies PColumn<PColumnValues>,\n ],\n selectorsToPredicate({\n name: 'example',\n }),\n ctx.uiState.dataTableState.tableState,\n {\n filters: [\n ...(ctx.uiState.dataTableState.tableState.pTableParams?.filters ?? []),\n ...(ctx.uiState.dataTableState.filterModel?.filters ?? []),\n ],\n },\n );\n })\n\n .title((ctx) => {\n if (ctx.args.numbers.length === 5) {\n throw new Error('block title: test error');\n }\n\n return 'Ui Examples';\n })\n\n .sections((ctx) => {\n const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it) => ({\n type: 'link' as const,\n href: `/section?id=${it.id}` as const,\n label: it.label,\n }));\n\n if (dynamicSections.some((it) => it.label === 'Error')) {\n throw new Error('sections: test error');\n }\n\n return [\n { type: 'link', href: '/loaders', label: 'Loaders' },\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: '/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: '/ag-grid-vue-with-builder', label: 'AgGridVue with builder' },\n { type: 'link', href: '/pl-ag-data-table', label: 'PlAgDataTable' },\n { type: 'link', href: '/pl-ag-data-table-v2', label: 'PlAgDataTableV2' },\n { type: 'link', href: '/pl-splash-page', label: 'PlSplashPage' },\n { type: 'link', href: '/pl-file-input-page', label: 'PlFileInputPage' },\n { type: 'link', href: '/pl-error-boundary-page', label: 'PlErrorBoundaryPage' },\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: '/stacked-bar', label: 'PlChartStackedBar' },\n { type: 'link', href: '/histogram', label: 'PlChartHistogram' },\n { type: 'link', href: '/buttons', label: 'ButtonsPage' },\n { type: 'link', href: '/notifications', label: 'Notifications' },\n { type: 'link', href: '/drafts', label: 'Drafts' },\n { type: 'link', href: '/pl-autocomplete', label: 'PlAutocomplete' },\n { type: 'link', href: '/radio', label: 'PlRadio' },\n ...(dynamicSections.length\n ? [\n { type: 'delimiter' },\n ...dynamicSections,\n { type: 'delimiter' }] as const\n : []),\n {\n type: 'link',\n href: '/add-section',\n appearance: 'add-section',\n label: 'New Dynamic section',\n },\n ];\n })\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof platforma>;\nexport type Href = InferHrefType<typeof platforma>;\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["z","BlockModel","createPlDataTableStateV2","createPlDataTable","rowCount","createPlDataTableV2"],"mappings":";;;;;;AAoBO,IAAM,sBAAyB,GAAAA,KAAA,CACnC,MAAO,EAAA,CACP,UACA,CAAA,MAAA;AAAA,EACE,CAAC,EA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;AAAA,IAC/C,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,cAAA,EAAgB,OAAO,mBAAoB,EAAA;AAAA,IACjE,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,YAAA,EAAc,OAAO,kBAAmB,EAAA;AAAA,IAC9D,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,UAAA,EAAY,OAAO,aAAc,EAAA;AAAA,IACvD,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,gBAAA,EAAkB,OAAO,eAAgB,EAAA;AAAA,IAC/D,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,SAAA,EAAW,OAAO,QAAS,EAAA;AAAA,IACjD,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,kBAAA,EAAoB,OAAO,gBAAiB,EAAA;AAAA,IAClE,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,QAAA,EAAU,OAAO,SAAU,EAAA;AAAA,IACjD,GAAI,gBAAgB,MAChB,GAAA;AAAA,MACE,EAAE,MAAM,WAAY,EAAA;AAAA,MACpB,GAAG,eAAA;AAAA,MACH,EAAE,MAAM,WAAY;AAAA,QACtB,EAAC;AAAA,IACL;AAAA,MACE,IAAM,EAAA,MAAA;AAAA,MACN,IAAM,EAAA,cAAA;AAAA,MACN,UAAY,EAAA,aAAA;AAAA,MACZ,KAAO,EAAA;AAAA;AACT,GACF;AACF,CAAC,EAEA,IAAK","file":"index.cjs","sourcesContent":["import type {\n ImportFileHandle,\n InferHrefType,\n InferOutputsType,\n PColumn,\n PColumnValues,\n PlDataTableState,\n PlTableFiltersModel,\n PObjectId,\n PlDataTableStateV2,\n PlDataTableSheet,\n} from '@platforma-sdk/model';\nimport {\n BlockModel,\n createPlDataTable,\n createPlDataTableStateV2,\n createPlDataTableV2,\n} from '@platforma-sdk/model';\nimport { z } from 'zod';\n\nexport const ImportFileHandleSchema = z\n .string()\n .optional()\n .refine<ImportFileHandle | undefined>(\n ((_a) => true) as (arg: string | undefined) => arg is ImportFileHandle | undefined,\n );\n\nexport function* range(from: number, to: number, step = 1) {\n for (let i = from; i < to; i += step) {\n yield i;\n }\n}\n\nexport function toList<T>(iterable: Iterable<T>): T[] {\n const lst: T[] = [];\n for (const it of iterable) {\n lst.push(it);\n }\n\n return lst;\n}\n\nexport function times<R>(n: number, cb: (i: number) => R): R[] {\n return toList(range(0, n)).map(cb);\n}\n\nexport const $BlockArgs = z.object({\n tableNumRows: z.number().default(100),\n numbers: z.array(z.coerce.number()),\n handles: z.array(ImportFileHandleSchema),\n});\n\nexport type BlockArgs = z.infer<typeof $BlockArgs>;\n\nexport type TableState = {\n tableState: PlDataTableState;\n filterModel: PlTableFiltersModel;\n};\n\nexport type TableStateV2 = {\n tableState: PlDataTableStateV2;\n filterModel: PlTableFiltersModel;\n};\n\nexport type UiState = {\n dataTableState: TableState | undefined;\n dataTableStateV2: TableStateV2;\n dynamicSections: {\n id: string;\n label: string;\n }[];\n};\n\nexport const platforma = BlockModel.create('Heavy')\n\n .withArgs<BlockArgs>({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] })\n\n .withUiState<UiState>({\n dataTableState: undefined,\n dataTableStateV2: {\n tableState: createPlDataTableStateV2(),\n filterModel: {},\n },\n dynamicSections: [],\n })\n\n .argsValid((ctx) => {\n if (ctx.args.numbers.length === 5) {\n throw new Error('argsValid: test error');\n }\n\n return ctx.args.numbers.length > 0;\n })\n\n .output('numbers', (ctx) => ctx.outputs?.resolve('numbers')?.getDataAsJson<number[]>())\n\n .output('progresses', (ctx) => {\n const m = ctx.outputs?.resolve('progresses');\n const progresses = m?.mapFields((name, val) => [name, val?.getImportProgress()] as const);\n return Object.fromEntries(progresses ?? []);\n })\n\n .output('pt', (ctx) => {\n if (!ctx.uiState?.dataTableState?.tableState.pTableParams?.filters) return undefined;\n\n const data = times(ctx.args.tableNumRows ?? 0, (i) => {\n const v = i + 1;\n return {\n key: [v, v + 0.1],\n val: v.toString(),\n };\n });\n\n return createPlDataTable(\n ctx,\n [\n {\n id: 'example' as PObjectId,\n spec: {\n kind: 'PColumn',\n valueType: 'String',\n name: 'example',\n annotations: {\n 'pl7.app/label': 'String column',\n 'pl7.app/discreteValues': '[\"up\",\"down\"]',\n },\n axesSpec: [\n {\n type: 'Int',\n name: 'index',\n annotations: {\n 'pl7.app/label': 'Int axis',\n 'pl7.app/discreteValues': '[1,2]',\n },\n },\n {\n type: 'Float',\n name: 'value',\n annotations: {\n 'pl7.app/label': 'Float axis',\n 'pl7.app/table/visibility': 'optional',\n },\n },\n ],\n },\n data,\n } satisfies PColumn<PColumnValues>,\n ],\n ctx.uiState.dataTableState.tableState,\n {\n filters: [\n ...(ctx.uiState.dataTableState.tableState.pTableParams?.filters ?? []),\n ...(ctx.uiState.dataTableState.filterModel?.filters ?? []),\n ],\n },\n );\n })\n\n .output('ptV2Sheets', (ctx) => {\n const rowCount = ctx.args.tableNumRows ?? 0;\n const sheets = [\n {\n axis: {\n type: 'Int',\n name: 'part',\n annotations: {\n 'pl7.app/label': 'Partitioned axis',\n 'pl7.app/discreteValues': '[0,1]',\n },\n },\n options: [\n { value: 0, label: 'Partition 1' },\n { value: 1, label: 'Partition 2' },\n ],\n } satisfies PlDataTableSheet,\n ];\n return rowCount > 0 ? sheets : [];\n })\n\n .output('ptV2', (ctx) => {\n const rowCount = ctx.args.tableNumRows ?? 0;\n const makePartitionId = (rowCount: number, i: number) => Math.floor((2 * i) / (rowCount + 1));\n const columns: PColumn<PColumnValues>[] = [\n {\n id: 'column1' as PObjectId,\n spec: {\n kind: 'PColumn',\n valueType: 'String',\n name: 'example',\n annotations: {\n 'pl7.app/label': 'String column',\n 'pl7.app/discreteValues': '[\"up\",\"down\"]',\n },\n axesSpec: [\n {\n type: 'Int',\n name: 'part',\n annotations: {\n 'pl7.app/label': 'Partitioned axis',\n 'pl7.app/discreteValues': '[0,1]',\n },\n },\n {\n type: 'Int',\n name: 'index',\n annotations: {\n 'pl7.app/label': 'Int axis',\n },\n },\n ],\n },\n data: times(rowCount, (i) => {\n const v = i + 1;\n return {\n key: [makePartitionId(rowCount, v), v],\n val: v.toString(),\n };\n }),\n },\n {\n id: 'column2' as PObjectId,\n spec: {\n kind: 'PColumn',\n valueType: 'Float',\n name: 'value',\n annotations: {\n 'pl7.app/label': 'Float column',\n 'pl7.app/table/visibility': 'optional',\n },\n axesSpec: [\n {\n type: 'Int',\n name: 'part',\n annotations: {\n 'pl7.app/label': 'Partitioned axis',\n 'pl7.app/discreteValues': '[0,1]',\n },\n },\n {\n type: 'Int',\n name: 'index',\n annotations: {\n 'pl7.app/label': 'Int axis',\n },\n },\n ],\n },\n data: times(rowCount, (i) => {\n const v = i + 1;\n return {\n key: [makePartitionId(rowCount, v), v],\n val: v + 0.1,\n };\n }),\n },\n ];\n return createPlDataTableV2(\n ctx,\n columns,\n ctx.uiState.dataTableStateV2.tableState,\n { filters: ctx.uiState.dataTableStateV2.filterModel?.filters ?? [] },\n );\n })\n\n .title((ctx) => {\n if (ctx.args.numbers.length === 5) {\n throw new Error('block title: test error');\n }\n\n return 'Ui Examples';\n })\n\n .sections((ctx) => {\n const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it) => ({\n type: 'link' as const,\n href: `/section?id=${it.id}` as const,\n label: it.label,\n }));\n\n if (dynamicSections.some((it) => it.label === 'Error')) {\n throw new Error('sections: test error');\n }\n\n return [\n { type: 'link', href: '/loaders', label: 'Loaders' },\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: '/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: '/ag-grid-vue-with-builder', label: 'AgGridVue with builder' },\n { type: 'link', href: '/pl-ag-data-table', label: 'PlAgDataTable' },\n { type: 'link', href: '/pl-ag-data-table-v2', label: 'PlAgDataTableV2' },\n { type: 'link', href: '/pl-splash-page', label: 'PlSplashPage' },\n { type: 'link', href: '/pl-file-input-page', label: 'PlFileInputPage' },\n { type: 'link', href: '/pl-error-boundary-page', label: 'PlErrorBoundaryPage' },\n { type: 'link', href: '/pl-element-list-page', label: 'PlElementList' },\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: '/stacked-bar', label: 'PlChartStackedBar' },\n { type: 'link', href: '/histogram', label: 'PlChartHistogram' },\n { type: 'link', href: '/buttons', label: 'ButtonsPage' },\n { type: 'link', href: '/notifications', label: 'Notifications' },\n { type: 'link', href: '/drafts', label: 'Drafts' },\n { type: 'link', href: '/pl-autocomplete', label: 'PlAutocomplete' },\n { type: 'link', href: '/radio', label: 'PlRadio' },\n ...(dynamicSections.length\n ? [\n { type: 'delimiter' },\n ...dynamicSections,\n { type: 'delimiter' }] as const\n : []),\n {\n type: 'link',\n href: '/add-section',\n appearance: 'add-section',\n label: 'New Dynamic section',\n },\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 { ImportFileHandle, PlDataTableState, PlTableFiltersModel, PObjectId, InferOutputsType, InferHrefType } from '@platforma-sdk/model';
2
+ import { ImportFileHandle, PlDataTableState, PlTableFiltersModel, PlDataTableStateV2, InferOutputsType, InferHrefType } from '@platforma-sdk/model';
3
3
  import { z } from 'zod';
4
4
 
5
5
  declare const ImportFileHandleSchema: z.ZodEffects<z.ZodOptional<z.ZodString>, ImportFileHandle | undefined, string | undefined>;
@@ -24,8 +24,13 @@ type TableState = {
24
24
  tableState: PlDataTableState;
25
25
  filterModel: PlTableFiltersModel;
26
26
  };
27
+ type TableStateV2 = {
28
+ tableState: PlDataTableStateV2;
29
+ filterModel: PlTableFiltersModel;
30
+ };
27
31
  type UiState = {
28
32
  dataTableState: TableState | undefined;
33
+ dataTableStateV2: TableStateV2;
29
34
  dynamicSections: {
30
35
  id: string;
31
36
  label: string;
@@ -41,58 +46,26 @@ declare const platforma: _platforma_sdk_model.Platforma<{
41
46
  [x: string]: _platforma_sdk_model.ImportProgress | undefined;
42
47
  }>;
43
48
  pt: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PTableHandle | undefined>;
44
- ptV2: _platforma_sdk_model.ValueOrErrors<{
45
- tableSpec: ({
46
- type: "axis";
47
- id: {
48
- readonly type: _platforma_sdk_model.ValueType;
49
- readonly name: string;
50
- readonly domain?: {
51
- [x: string]: string;
52
- } | undefined;
49
+ ptV2Sheets: _platforma_sdk_model.ValueOrErrors<{
50
+ axis: {
51
+ type: "Int";
52
+ name: string;
53
+ annotations: {
54
+ 'pl7.app/label': string;
55
+ 'pl7.app/discreteValues': string;
53
56
  };
54
- spec: {
55
- readonly type: _platforma_sdk_model.ValueType;
56
- readonly name: string;
57
- readonly domain?: {
58
- [x: string]: string;
59
- } | undefined;
60
- readonly annotations?: {
61
- [x: string]: string;
62
- } | undefined;
63
- readonly parentAxes?: number[] | undefined;
64
- };
65
- } | {
66
- type: "column";
67
- id: PObjectId;
68
- spec: {
69
- readonly valueType: _platforma_sdk_model.ValueType;
70
- readonly kind: "PColumn";
71
- readonly name: string;
72
- readonly domain?: {
73
- [x: string]: string;
74
- } | undefined;
75
- readonly annotations?: {
76
- [x: string]: string;
77
- } | undefined;
78
- readonly parentAxes?: number[] | undefined;
79
- readonly axesSpec: {
80
- readonly type: _platforma_sdk_model.ValueType;
81
- readonly name: string;
82
- readonly domain?: {
83
- [x: string]: string;
84
- } | undefined;
85
- readonly annotations?: {
86
- [x: string]: string;
87
- } | undefined;
88
- readonly parentAxes?: number[] | undefined;
89
- }[];
90
- };
91
- })[];
92
- tableHandle: _platforma_sdk_model.PTableHandle;
57
+ };
58
+ options: {
59
+ value: number;
60
+ label: string;
61
+ }[];
62
+ }[]>;
63
+ ptV2: _platforma_sdk_model.ValueOrErrors<{
64
+ fullTableHandle: _platforma_sdk_model.PTableHandle;
65
+ visibleTableHandle: _platforma_sdk_model.PTableHandle;
93
66
  } | undefined>;
94
- }, UiState, "/" | "/loaders" | "/layout" | "/form-components" | "/log-view" | "/modals" | "/select-files" | "/inject-env" | "/use-watch-fetch" | "/typography" | "/ag-grid-vue" | "/ag-grid-vue-with-builder" | "/pl-ag-data-table" | "/pl-ag-data-table-v2" | "/pl-splash-page" | "/pl-file-input-page" | "/pl-error-boundary-page" | "/errors" | "/text-fields" | "/tabs" | "/stacked-bar" | "/histogram" | "/buttons" | "/notifications" | "/drafts" | "/pl-autocomplete" | "/radio" | `/section?id=${string}` | "/add-section">;
67
+ }, UiState, "/" | "/loaders" | "/layout" | "/form-components" | "/log-view" | "/modals" | "/select-files" | "/inject-env" | "/use-watch-fetch" | "/typography" | "/ag-grid-vue" | "/ag-grid-vue-with-builder" | "/pl-ag-data-table" | "/pl-ag-data-table-v2" | "/pl-splash-page" | "/pl-file-input-page" | "/pl-error-boundary-page" | "/pl-element-list-page" | "/errors" | "/text-fields" | "/tabs" | "/stacked-bar" | "/histogram" | "/buttons" | "/notifications" | "/drafts" | "/pl-autocomplete" | "/radio" | `/section?id=${string}` | "/add-section">;
95
68
  type BlockOutputs = InferOutputsType<typeof platforma>;
96
69
  type Href = InferHrefType<typeof platforma>;
97
70
 
98
- export { $BlockArgs, type BlockArgs, type BlockOutputs, type Href, ImportFileHandleSchema, type TableState, type UiState, platforma, range, times, toList };
71
+ export { $BlockArgs, type BlockArgs, type BlockOutputs, type Href, ImportFileHandleSchema, type TableState, type TableStateV2, type UiState, platforma, range, times, toList };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _platforma_sdk_model from '@platforma-sdk/model';
2
- import { ImportFileHandle, PlDataTableState, PlTableFiltersModel, PObjectId, InferOutputsType, InferHrefType } from '@platforma-sdk/model';
2
+ import { ImportFileHandle, PlDataTableState, PlTableFiltersModel, PlDataTableStateV2, InferOutputsType, InferHrefType } from '@platforma-sdk/model';
3
3
  import { z } from 'zod';
4
4
 
5
5
  declare const ImportFileHandleSchema: z.ZodEffects<z.ZodOptional<z.ZodString>, ImportFileHandle | undefined, string | undefined>;
@@ -24,8 +24,13 @@ type TableState = {
24
24
  tableState: PlDataTableState;
25
25
  filterModel: PlTableFiltersModel;
26
26
  };
27
+ type TableStateV2 = {
28
+ tableState: PlDataTableStateV2;
29
+ filterModel: PlTableFiltersModel;
30
+ };
27
31
  type UiState = {
28
32
  dataTableState: TableState | undefined;
33
+ dataTableStateV2: TableStateV2;
29
34
  dynamicSections: {
30
35
  id: string;
31
36
  label: string;
@@ -41,58 +46,26 @@ declare const platforma: _platforma_sdk_model.Platforma<{
41
46
  [x: string]: _platforma_sdk_model.ImportProgress | undefined;
42
47
  }>;
43
48
  pt: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PTableHandle | undefined>;
44
- ptV2: _platforma_sdk_model.ValueOrErrors<{
45
- tableSpec: ({
46
- type: "axis";
47
- id: {
48
- readonly type: _platforma_sdk_model.ValueType;
49
- readonly name: string;
50
- readonly domain?: {
51
- [x: string]: string;
52
- } | undefined;
49
+ ptV2Sheets: _platforma_sdk_model.ValueOrErrors<{
50
+ axis: {
51
+ type: "Int";
52
+ name: string;
53
+ annotations: {
54
+ 'pl7.app/label': string;
55
+ 'pl7.app/discreteValues': string;
53
56
  };
54
- spec: {
55
- readonly type: _platforma_sdk_model.ValueType;
56
- readonly name: string;
57
- readonly domain?: {
58
- [x: string]: string;
59
- } | undefined;
60
- readonly annotations?: {
61
- [x: string]: string;
62
- } | undefined;
63
- readonly parentAxes?: number[] | undefined;
64
- };
65
- } | {
66
- type: "column";
67
- id: PObjectId;
68
- spec: {
69
- readonly valueType: _platforma_sdk_model.ValueType;
70
- readonly kind: "PColumn";
71
- readonly name: string;
72
- readonly domain?: {
73
- [x: string]: string;
74
- } | undefined;
75
- readonly annotations?: {
76
- [x: string]: string;
77
- } | undefined;
78
- readonly parentAxes?: number[] | undefined;
79
- readonly axesSpec: {
80
- readonly type: _platforma_sdk_model.ValueType;
81
- readonly name: string;
82
- readonly domain?: {
83
- [x: string]: string;
84
- } | undefined;
85
- readonly annotations?: {
86
- [x: string]: string;
87
- } | undefined;
88
- readonly parentAxes?: number[] | undefined;
89
- }[];
90
- };
91
- })[];
92
- tableHandle: _platforma_sdk_model.PTableHandle;
57
+ };
58
+ options: {
59
+ value: number;
60
+ label: string;
61
+ }[];
62
+ }[]>;
63
+ ptV2: _platforma_sdk_model.ValueOrErrors<{
64
+ fullTableHandle: _platforma_sdk_model.PTableHandle;
65
+ visibleTableHandle: _platforma_sdk_model.PTableHandle;
93
66
  } | undefined>;
94
- }, UiState, "/" | "/loaders" | "/layout" | "/form-components" | "/log-view" | "/modals" | "/select-files" | "/inject-env" | "/use-watch-fetch" | "/typography" | "/ag-grid-vue" | "/ag-grid-vue-with-builder" | "/pl-ag-data-table" | "/pl-ag-data-table-v2" | "/pl-splash-page" | "/pl-file-input-page" | "/pl-error-boundary-page" | "/errors" | "/text-fields" | "/tabs" | "/stacked-bar" | "/histogram" | "/buttons" | "/notifications" | "/drafts" | "/pl-autocomplete" | "/radio" | `/section?id=${string}` | "/add-section">;
67
+ }, UiState, "/" | "/loaders" | "/layout" | "/form-components" | "/log-view" | "/modals" | "/select-files" | "/inject-env" | "/use-watch-fetch" | "/typography" | "/ag-grid-vue" | "/ag-grid-vue-with-builder" | "/pl-ag-data-table" | "/pl-ag-data-table-v2" | "/pl-splash-page" | "/pl-file-input-page" | "/pl-error-boundary-page" | "/pl-element-list-page" | "/errors" | "/text-fields" | "/tabs" | "/stacked-bar" | "/histogram" | "/buttons" | "/notifications" | "/drafts" | "/pl-autocomplete" | "/radio" | `/section?id=${string}` | "/add-section">;
95
68
  type BlockOutputs = InferOutputsType<typeof platforma>;
96
69
  type Href = InferHrefType<typeof platforma>;
97
70
 
98
- export { $BlockArgs, type BlockArgs, type BlockOutputs, type Href, ImportFileHandleSchema, type TableState, type UiState, platforma, range, times, toList };
71
+ export { $BlockArgs, type BlockArgs, type BlockOutputs, type Href, ImportFileHandleSchema, type TableState, type TableStateV2, type UiState, platforma, range, times, toList };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { BlockModel, createPlDataTable, createPlDataTableV2, selectorsToPredicate } from '@platforma-sdk/model';
1
+ import { BlockModel, createPlDataTableStateV2, createPlDataTable, createPlDataTableV2 } from '@platforma-sdk/model';
2
2
  import { z } from 'zod';
3
3
 
4
4
  // src/index.ts
@@ -25,7 +25,14 @@ var $BlockArgs = z.object({
25
25
  numbers: z.array(z.coerce.number()),
26
26
  handles: z.array(ImportFileHandleSchema)
27
27
  });
28
- var platforma = BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
28
+ var platforma = BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] }).withUiState({
29
+ dataTableState: void 0,
30
+ dataTableStateV2: {
31
+ tableState: createPlDataTableStateV2(),
32
+ filterModel: {}
33
+ },
34
+ dynamicSections: []
35
+ }).argsValid((ctx) => {
29
36
  if (ctx.args.numbers.length === 5) {
30
37
  throw new Error("argsValid: test error");
31
38
  }
@@ -86,60 +93,107 @@ var platforma = BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tab
86
93
  ]
87
94
  }
88
95
  );
96
+ }).output("ptV2Sheets", (ctx) => {
97
+ const rowCount = ctx.args.tableNumRows ?? 0;
98
+ const sheets = [
99
+ {
100
+ axis: {
101
+ type: "Int",
102
+ name: "part",
103
+ annotations: {
104
+ "pl7.app/label": "Partitioned axis",
105
+ "pl7.app/discreteValues": "[0,1]"
106
+ }
107
+ },
108
+ options: [
109
+ { value: 0, label: "Partition 1" },
110
+ { value: 1, label: "Partition 2" }
111
+ ]
112
+ }
113
+ ];
114
+ return rowCount > 0 ? sheets : [];
89
115
  }).output("ptV2", (ctx) => {
90
- if (!ctx.uiState?.dataTableState?.tableState.pTableParams?.filters) return void 0;
91
- const data = times(ctx.args.tableNumRows ?? 0, (i) => {
92
- const v = i + 1;
93
- return {
94
- key: [v, v + 0.1],
95
- val: v.toString()
96
- };
97
- });
98
- return createPlDataTableV2(
99
- ctx,
100
- [
101
- {
102
- id: "example",
103
- spec: {
104
- kind: "PColumn",
105
- valueType: "String",
106
- name: "example",
107
- annotations: {
108
- "pl7.app/label": "String column",
109
- "pl7.app/discreteValues": '["up","down"]'
116
+ const rowCount = ctx.args.tableNumRows ?? 0;
117
+ const makePartitionId = (rowCount2, i) => Math.floor(2 * i / (rowCount2 + 1));
118
+ const columns = [
119
+ {
120
+ id: "column1",
121
+ spec: {
122
+ kind: "PColumn",
123
+ valueType: "String",
124
+ name: "example",
125
+ annotations: {
126
+ "pl7.app/label": "String column",
127
+ "pl7.app/discreteValues": '["up","down"]'
128
+ },
129
+ axesSpec: [
130
+ {
131
+ type: "Int",
132
+ name: "part",
133
+ annotations: {
134
+ "pl7.app/label": "Partitioned axis",
135
+ "pl7.app/discreteValues": "[0,1]"
136
+ }
110
137
  },
111
- axesSpec: [
112
- {
113
- type: "Int",
114
- name: "index",
115
- annotations: {
116
- "pl7.app/label": "Int axis",
117
- "pl7.app/discreteValues": "[1,2]"
118
- }
119
- },
120
- {
121
- type: "Float",
122
- name: "value",
123
- annotations: {
124
- "pl7.app/label": "Float axis",
125
- "pl7.app/table/visibility": "optional"
126
- }
138
+ {
139
+ type: "Int",
140
+ name: "index",
141
+ annotations: {
142
+ "pl7.app/label": "Int axis"
127
143
  }
128
- ]
129
- },
130
- data
131
- }
132
- ],
133
- selectorsToPredicate({
134
- name: "example"
135
- }),
136
- ctx.uiState.dataTableState.tableState,
144
+ }
145
+ ]
146
+ },
147
+ data: times(rowCount, (i) => {
148
+ const v = i + 1;
149
+ return {
150
+ key: [makePartitionId(rowCount, v), v],
151
+ val: v.toString()
152
+ };
153
+ })
154
+ },
137
155
  {
138
- filters: [
139
- ...ctx.uiState.dataTableState.tableState.pTableParams?.filters ?? [],
140
- ...ctx.uiState.dataTableState.filterModel?.filters ?? []
141
- ]
156
+ id: "column2",
157
+ spec: {
158
+ kind: "PColumn",
159
+ valueType: "Float",
160
+ name: "value",
161
+ annotations: {
162
+ "pl7.app/label": "Float column",
163
+ "pl7.app/table/visibility": "optional"
164
+ },
165
+ axesSpec: [
166
+ {
167
+ type: "Int",
168
+ name: "part",
169
+ annotations: {
170
+ "pl7.app/label": "Partitioned axis",
171
+ "pl7.app/discreteValues": "[0,1]"
172
+ }
173
+ },
174
+ {
175
+ type: "Int",
176
+ name: "index",
177
+ annotations: {
178
+ "pl7.app/label": "Int axis"
179
+ }
180
+ }
181
+ ]
182
+ },
183
+ data: times(rowCount, (i) => {
184
+ const v = i + 1;
185
+ return {
186
+ key: [makePartitionId(rowCount, v), v],
187
+ val: v + 0.1
188
+ };
189
+ })
142
190
  }
191
+ ];
192
+ return createPlDataTableV2(
193
+ ctx,
194
+ columns,
195
+ ctx.uiState.dataTableStateV2.tableState,
196
+ { filters: ctx.uiState.dataTableStateV2.filterModel?.filters ?? [] }
143
197
  );
144
198
  }).title((ctx) => {
145
199
  if (ctx.args.numbers.length === 5) {
@@ -173,6 +227,7 @@ var platforma = BlockModel.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tab
173
227
  { type: "link", href: "/pl-splash-page", label: "PlSplashPage" },
174
228
  { type: "link", href: "/pl-file-input-page", label: "PlFileInputPage" },
175
229
  { type: "link", href: "/pl-error-boundary-page", label: "PlErrorBoundaryPage" },
230
+ { type: "link", href: "/pl-element-list-page", label: "PlElementList" },
176
231
  { type: "link", href: "/errors", label: "Errors" },
177
232
  { type: "link", href: "/text-fields", label: "PlTextField" },
178
233
  { type: "link", href: "/tabs", label: "PlTabs" },