@milaboratories/milaboratories.ui-examples.model 1.1.30 → 1.1.32

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/milaboratories.ui-examples.model",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
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.25.0"
11
+ "@platforma-sdk/model": "1.26.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.5.28"
17
+ "@platforma-sdk/block-tools": "2.5.29"
18
18
  },
19
19
  "tsup": {
20
20
  "entry": [
package/src/index.ts CHANGED
@@ -5,13 +5,22 @@ import type {
5
5
  PlTableFiltersModel,
6
6
  PColumn,
7
7
  PColumnValues,
8
- PObjectId } from '@platforma-sdk/model';
8
+ PObjectId,
9
+ ImportFileHandle
10
+ } from '@platforma-sdk/model';
9
11
  import {
10
12
  BlockModel,
11
13
  createPlDataTable,
12
14
  } from '@platforma-sdk/model';
13
15
  import { z } from 'zod';
14
16
 
17
+ export const ImportFileHandleSchema = z
18
+ .string()
19
+ .optional()
20
+ .refine<ImportFileHandle | undefined>(
21
+ ((_a) => true) as (arg: string | undefined) => arg is ImportFileHandle | undefined,
22
+ );
23
+
15
24
  export function* range(from: number, to: number, step = 1) {
16
25
  for (let i = from; i < to; i += step) {
17
26
  yield i;
@@ -34,6 +43,7 @@ export function times<R>(n: number, cb: (i: number) => R): R[] {
34
43
  export const $BlockArgs = z.object({
35
44
  tableNumRows: z.number().default(100),
36
45
  numbers: z.array(z.coerce.number()),
46
+ handles: z.array(ImportFileHandleSchema),
37
47
  });
38
48
 
39
49
  export type BlockArgs = z.infer<typeof $BlockArgs>;
@@ -53,7 +63,7 @@ export type UiState = {
53
63
 
54
64
  export const platforma = BlockModel.create('Heavy')
55
65
 
56
- .withArgs<BlockArgs>({ numbers: [1, 2, 3, 4], tableNumRows: 100 })
66
+ .withArgs<BlockArgs>({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] })
57
67
 
58
68
  .withUiState<UiState>({ dataTableState: undefined, dynamicSections: [] })
59
69
 
@@ -67,6 +77,12 @@ export const platforma = BlockModel.create('Heavy')
67
77
 
68
78
  .output('numbers', (ctx) => ctx.outputs?.resolve('numbers')?.getDataAsJson<number[]>())
69
79
 
80
+ .output('progresses', (ctx) => {
81
+ const m = ctx.outputs?.resolve('progresses');
82
+ const progresses = m?.mapFields((name, val) => [name, val?.getImportProgress()] as const);
83
+ return Object.fromEntries(progresses ?? []);
84
+ })
85
+
70
86
  .output('pt', (ctx) => {
71
87
  if (!ctx.uiState?.dataTableState?.tableState.pTableParams?.filters) return undefined;
72
88
 
@@ -154,6 +170,7 @@ export const platforma = BlockModel.create('Heavy')
154
170
  { type: 'link', href: '/use-watch-fetch', label: 'useWatchFetch' },
155
171
  { type: 'link', href: '/typography', label: 'Typography' },
156
172
  { type: 'link', href: '/ag-grid-vue', label: 'AgGridVue' },
173
+ { type: 'link', href: '/ag-grid-vue-with-builder', label: 'AgGridVue with builder' },
157
174
  { type: 'link', href: '/pl-ag-data-table', label: 'PlAgDataTable' },
158
175
  { type: 'link', href: '/pl-splash-page', label: 'PlSplashPage' },
159
176
  { type: 'link', href: '/errors', label: 'Errors' },