@milaboratories/milaboratories.ui-examples.model 1.4.9 → 1.4.11

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.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -8,20 +8,21 @@
8
8
  "types": "dist/index.d.ts",
9
9
  "dependencies": {
10
10
  "zod": "~3.23.8",
11
- "@platforma-sdk/model": "1.53.10"
11
+ "@platforma-sdk/model": "1.53.13"
12
12
  },
13
13
  "devDependencies": {
14
- "eslint": "^9.25.1",
15
14
  "typescript": "~5.6.3",
16
- "@platforma-sdk/eslint-config": "1.2.0",
17
- "@platforma-sdk/block-tools": "2.6.42",
15
+ "@milaboratories/ts-builder": "1.2.5",
18
16
  "@milaboratories/ts-configs": "1.2.0",
19
- "@milaboratories/ts-builder": "1.2.4",
20
- "@milaboratories/build-configs": "1.4.0"
17
+ "@platforma-sdk/block-tools": "2.6.45",
18
+ "@milaboratories/build-configs": "1.4.1"
21
19
  },
22
20
  "scripts": {
23
21
  "build": "ts-builder build --target block-model && block-tools build-model",
24
- "type-check": "ts-builder types --target block-model",
25
- "lint": "eslint ."
22
+ "check": "ts-builder check --target block-model",
23
+ "formatter:check": "ts-builder formatter --check",
24
+ "linter:check": "ts-builder linter --check",
25
+ "types:check": "ts-builder type-check --target block-model",
26
+ "fmt": "ts-builder format"
26
27
  }
27
28
  }
package/src/index.ts CHANGED
@@ -7,7 +7,7 @@ import type {
7
7
  PlDataTableSheet,
8
8
  PlDataTableStateV2,
9
9
  PObjectId,
10
- } from '@platforma-sdk/model';
10
+ } from "@platforma-sdk/model";
11
11
  import {
12
12
  Annotation,
13
13
  BlockModel,
@@ -16,8 +16,8 @@ import {
16
16
  PColumnName,
17
17
  stringifyJson,
18
18
  ValueType,
19
- } from '@platforma-sdk/model';
20
- import { z } from 'zod';
19
+ } from "@platforma-sdk/model";
20
+ import { z } from "zod";
21
21
 
22
22
  export const ImportFileHandleSchema = z
23
23
  .string()
@@ -68,13 +68,13 @@ export type UiState = {
68
68
  }[];
69
69
  };
70
70
 
71
- export const platforma = BlockModel.create('Heavy')
71
+ export const platforma = BlockModel.create("Heavy")
72
72
 
73
73
  .withArgs<BlockArgs>({ numbers: [1, 2, 3, 4], handles: [] })
74
74
 
75
75
  .withUiState<UiState>({
76
76
  dataTableV2: {
77
- sourceId: 'source_1',
77
+ sourceId: "source_1",
78
78
  numRows: 200,
79
79
  state: createPlDataTableStateV2(),
80
80
  },
@@ -84,71 +84,71 @@ export const platforma = BlockModel.create('Heavy')
84
84
 
85
85
  .argsValid((ctx) => {
86
86
  if (ctx.args.numbers.length === 5) {
87
- throw new Error('argsValid: test error');
87
+ throw new Error("argsValid: test error");
88
88
  }
89
89
 
90
90
  return ctx.args.numbers.length > 0;
91
91
  })
92
92
 
93
- .output('numbers', (ctx) => ctx.outputs?.resolve('numbers')?.getDataAsJson<number[]>())
93
+ .output("numbers", (ctx) => ctx.outputs?.resolve("numbers")?.getDataAsJson<number[]>())
94
94
 
95
- .output('progresses', (ctx) => {
96
- const m = ctx.outputs?.resolve('progresses');
95
+ .output("progresses", (ctx) => {
96
+ const m = ctx.outputs?.resolve("progresses");
97
97
  const progresses = m?.mapFields((name, val) => [name, val?.getImportProgress()] as const);
98
98
  return Object.fromEntries(progresses ?? []);
99
99
  })
100
100
 
101
- .output('ptV2Sheets', (ctx) => {
101
+ .output("ptV2Sheets", (ctx) => {
102
102
  const rowCount = ctx.uiState.dataTableV2.numRows ?? 0;
103
103
  const sheets = [
104
104
  {
105
105
  axis: {
106
106
  type: ValueType.Int,
107
- name: 'part',
107
+ name: "part",
108
108
  annotations: {
109
- [Annotation.Label]: 'Partitioned axis',
109
+ [Annotation.Label]: "Partitioned axis",
110
110
  [Annotation.DiscreteValues]: stringifyJson([0, 1]),
111
111
  } satisfies Annotation,
112
112
  },
113
113
  options: [
114
- { value: 0, label: 'Partition 1' },
115
- { value: 1, label: 'Partition 2' },
114
+ { value: 0, label: "Partition 1" },
115
+ { value: 1, label: "Partition 2" },
116
116
  ],
117
117
  } satisfies PlDataTableSheet,
118
118
  ];
119
119
  return rowCount > 0 ? sheets : [];
120
120
  })
121
121
 
122
- .outputWithStatus('ptV2', (ctx) => {
122
+ .outputWithStatus("ptV2", (ctx) => {
123
123
  const rowCount = ctx.uiState.dataTableV2.numRows ?? 0;
124
124
  const makePartitionId = (rowCount: number, i: number) => Math.floor((2 * i) / (rowCount + 1));
125
125
  const columns: PColumn<PColumnValues>[] = [
126
126
  {
127
- id: 'column1' as PObjectId,
127
+ id: "column1" as PObjectId,
128
128
  spec: {
129
- kind: 'PColumn',
129
+ kind: "PColumn",
130
130
  valueType: ValueType.String,
131
- name: 'example',
131
+ name: "example",
132
132
  annotations: {
133
- [Annotation.Label]: 'String column',
134
- [Annotation.DiscreteValues]: stringifyJson(['up', 'down']),
133
+ [Annotation.Label]: "String column",
134
+ [Annotation.DiscreteValues]: stringifyJson(["up", "down"]),
135
135
  [Annotation.Table.OrderPriority]: stringifyJson(101),
136
- [Annotation.Description]: 'String column description',
136
+ [Annotation.Description]: "String column description",
137
137
  } satisfies Annotation,
138
138
  axesSpec: [
139
139
  {
140
140
  type: ValueType.Int,
141
- name: 'part',
141
+ name: "part",
142
142
  annotations: {
143
- [Annotation.Label]: 'Partitioned axis',
143
+ [Annotation.Label]: "Partitioned axis",
144
144
  [Annotation.DiscreteValues]: stringifyJson([0, 1]),
145
145
  } satisfies Annotation,
146
146
  },
147
147
  {
148
148
  type: ValueType.Int,
149
- name: 'index',
149
+ name: "index",
150
150
  annotations: {
151
- [Annotation.Label]: 'Int axis',
151
+ [Annotation.Label]: "Int axis",
152
152
  } satisfies Annotation,
153
153
  },
154
154
  ],
@@ -162,31 +162,31 @@ export const platforma = BlockModel.create('Heavy')
162
162
  }),
163
163
  },
164
164
  {
165
- id: 'column2' as PObjectId,
165
+ id: "column2" as PObjectId,
166
166
  spec: {
167
- kind: 'PColumn',
167
+ kind: "PColumn",
168
168
  valueType: ValueType.Float,
169
- name: 'value',
169
+ name: "value",
170
170
  annotations: {
171
- [Annotation.Label]: 'Float column',
172
- [Annotation.Table.Visibility]: 'optional',
171
+ [Annotation.Label]: "Float column",
172
+ [Annotation.Table.Visibility]: "optional",
173
173
  [Annotation.Table.OrderPriority]: stringifyJson(100),
174
- [Annotation.Description]: 'Float column description',
174
+ [Annotation.Description]: "Float column description",
175
175
  } satisfies Annotation,
176
176
  axesSpec: [
177
177
  {
178
178
  type: ValueType.Int,
179
- name: 'part',
179
+ name: "part",
180
180
  annotations: {
181
- [Annotation.Label]: 'Partitioned axis',
181
+ [Annotation.Label]: "Partitioned axis",
182
182
  [Annotation.DiscreteValues]: stringifyJson([0, 1]),
183
183
  } satisfies Annotation,
184
184
  },
185
185
  {
186
186
  type: ValueType.Int,
187
- name: 'index',
187
+ name: "index",
188
188
  annotations: {
189
- [Annotation.Label]: 'Int axis',
189
+ [Annotation.Label]: "Int axis",
190
190
  } satisfies Annotation,
191
191
  },
192
192
  ],
@@ -200,20 +200,20 @@ export const platforma = BlockModel.create('Heavy')
200
200
  }),
201
201
  },
202
202
  {
203
- id: 'labelColumn' as PObjectId,
203
+ id: "labelColumn" as PObjectId,
204
204
  spec: {
205
- kind: 'PColumn',
205
+ kind: "PColumn",
206
206
  valueType: ValueType.Int,
207
207
  name: PColumnName.Label,
208
208
  annotations: {
209
- [Annotation.Label]: 'Int axis labels',
209
+ [Annotation.Label]: "Int axis labels",
210
210
  } satisfies Annotation,
211
211
  axesSpec: [
212
212
  {
213
213
  type: ValueType.Int,
214
- name: 'index',
214
+ name: "index",
215
215
  annotations: {
216
- [Annotation.Label]: 'Int axis',
216
+ [Annotation.Label]: "Int axis",
217
217
  } satisfies Annotation,
218
218
  },
219
219
  ],
@@ -227,29 +227,29 @@ export const platforma = BlockModel.create('Heavy')
227
227
  }),
228
228
  },
229
229
  {
230
- id: 'linkerColumn' as PObjectId,
230
+ id: "linkerColumn" as PObjectId,
231
231
  spec: {
232
- kind: 'PColumn',
232
+ kind: "PColumn",
233
233
  valueType: ValueType.Int,
234
- name: 'linker',
234
+ name: "linker",
235
235
  annotations: {
236
- [Annotation.Label]: 'Index axis linker',
236
+ [Annotation.Label]: "Index axis linker",
237
237
  [Annotation.IsLinkerColumn]: stringifyJson(true),
238
- [Annotation.Table.Visibility]: 'hidden',
238
+ [Annotation.Table.Visibility]: "hidden",
239
239
  } satisfies Annotation,
240
240
  axesSpec: [
241
241
  {
242
242
  type: ValueType.Int,
243
- name: 'index',
243
+ name: "index",
244
244
  annotations: {
245
- [Annotation.Label]: 'Int axis',
245
+ [Annotation.Label]: "Int axis",
246
246
  } satisfies Annotation,
247
247
  },
248
248
  {
249
249
  type: ValueType.Int,
250
- name: 'linkedIndex',
250
+ name: "linkedIndex",
251
251
  annotations: {
252
- [Annotation.Label]: 'Linked int axis',
252
+ [Annotation.Label]: "Linked int axis",
253
253
  } satisfies Annotation,
254
254
  },
255
255
  ],
@@ -267,20 +267,20 @@ export const platforma = BlockModel.create('Heavy')
267
267
  columns.push({
268
268
  id: `alphabeticalColumn${j}` as PObjectId,
269
269
  spec: {
270
- kind: 'PColumn',
270
+ kind: "PColumn",
271
271
  valueType: ValueType.String,
272
- name: 'value',
272
+ name: "value",
273
273
  annotations: {
274
274
  [Annotation.Label]: `Alphabetical column ${j}`,
275
- [Annotation.Table.Visibility]: 'optional',
275
+ [Annotation.Table.Visibility]: "optional",
276
276
  [Annotation.Table.OrderPriority]: stringifyJson(10 - j),
277
277
  } satisfies Annotation,
278
278
  axesSpec: [
279
279
  {
280
280
  type: ValueType.Int,
281
- name: 'linkedIndex',
281
+ name: "linkedIndex",
282
282
  annotations: {
283
- [Annotation.Label]: 'Linked int axis',
283
+ [Annotation.Label]: "Linked int axis",
284
284
  } satisfies Annotation,
285
285
  },
286
286
  ],
@@ -294,80 +294,72 @@ export const platforma = BlockModel.create('Heavy')
294
294
  }),
295
295
  });
296
296
  }
297
- return createPlDataTableV2(
298
- ctx,
299
- columns,
300
- ctx.uiState.dataTableV2.state,
301
- );
297
+ return createPlDataTableV2(ctx, columns, ctx.uiState.dataTableV2.state);
302
298
  })
303
299
 
304
300
  .title((ctx) => {
305
301
  if (ctx.args.numbers.length === 5) {
306
- throw new Error('block title: test error');
302
+ throw new Error("block title: test error");
307
303
  }
308
304
 
309
- return 'Ui Examples';
305
+ return "Ui Examples";
310
306
  })
311
307
 
312
308
  .sections((ctx) => {
313
309
  const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it) => ({
314
- type: 'link' as const,
310
+ type: "link" as const,
315
311
  href: `/section?id=${it.id}` as const,
316
312
  label: it.label,
317
313
  }));
318
314
 
319
- if (dynamicSections.some((it) => it.label === 'Error')) {
320
- throw new Error('sections: test error');
315
+ if (dynamicSections.some((it) => it.label === "Error")) {
316
+ throw new Error("sections: test error");
321
317
  }
322
318
 
323
319
  return [
324
- { type: 'link', href: '/loaders', label: 'Loaders' },
325
- { type: 'link', href: '/', label: 'Icons/Masks' },
326
- { type: 'link', href: '/state', label: 'State' },
327
- { type: 'link', href: '/layout', label: 'Layout' },
328
- { type: 'link', href: '/form-components', label: 'Form Components' },
329
- { type: 'link', href: '/log-view', label: 'PlLogView' },
330
- { type: 'link', href: '/modals', label: 'Modals' },
331
- { type: 'link', href: '/select-files', label: 'Select Files' },
332
- { type: 'link', href: '/inject-env', label: 'Inject env' },
333
- { type: 'link', href: '/use-watch-fetch', label: 'useWatchFetch' },
334
- { type: 'link', href: '/typography', label: 'Typography' },
335
- { type: 'link', href: '/ag-grid-vue', label: 'AgGridVue' },
336
- { type: 'link', href: '/ag-grid-vue-with-builder', label: 'AgGridVue with builder' },
337
- { type: 'link', href: '/pl-annotations', label: 'PlAnnotations' },
338
- { type: 'link', href: '/pl-ag-data-table-v2', label: 'PlAgDataTableV2' },
339
- { type: 'link', href: '/pl-splash-page', label: 'PlSplashPage' },
340
- { type: 'link', href: '/pl-file-input-page', label: 'PlFileInputPage' },
341
- { type: 'link', href: '/pl-number-field-page', label: 'PlNumberFieldPage' },
342
- { type: 'link', href: '/pl-error-boundary-page', label: 'PlErrorBoundaryPage' },
343
- { type: 'link', href: '/pl-element-list-page', label: 'PlElementList' },
344
- { type: 'link', href: '/text-fields', label: 'PlTextField' },
345
- { type: 'link', href: '/tabs', label: 'PlTabs' },
346
- { type: 'link', href: '/pl-autocomplete', label: 'PlAutocomplete' },
347
- { type: 'link', href: '/radio', label: 'PlRadio' },
348
- { type: 'link', href: '/stacked-bar', label: 'PlChartStackedBar' },
349
- { type: 'link', href: '/histogram', label: 'PlChartHistogram' },
350
- { type: 'link', href: '/buttons', label: 'ButtonsPage' },
351
- { type: 'link', href: '/errors', label: 'Errors' },
352
- { type: 'link', href: '/downloads', label: 'Downloads' },
353
- { type: 'link', href: '/notifications', label: 'Notifications' },
354
- { type: 'link', href: '/drafts', label: 'Drafts' },
355
- { type: 'link', href: '/pl-autocomplete', label: 'PlAutocomplete' },
356
- { type: 'link', href: '/pl-autocomplete-multi', label: 'PlAutocompleteMulti' },
357
- { type: 'link', href: '/radio', label: 'PlRadio' },
358
- { type: 'link', href: '/advanced-filter', label: 'PlAdvancedFilter' },
320
+ { type: "link", href: "/loaders", label: "Loaders" },
321
+ { type: "link", href: "/", label: "Icons/Masks" },
322
+ { type: "link", href: "/state", label: "State" },
323
+ { type: "link", href: "/layout", label: "Layout" },
324
+ { type: "link", href: "/form-components", label: "Form Components" },
325
+ { type: "link", href: "/log-view", label: "PlLogView" },
326
+ { type: "link", href: "/modals", label: "Modals" },
327
+ { type: "link", href: "/select-files", label: "Select Files" },
328
+ { type: "link", href: "/inject-env", label: "Inject env" },
329
+ { type: "link", href: "/use-watch-fetch", label: "useWatchFetch" },
330
+ { type: "link", href: "/typography", label: "Typography" },
331
+ { type: "link", href: "/ag-grid-vue", label: "AgGridVue" },
332
+ { type: "link", href: "/ag-grid-vue-with-builder", label: "AgGridVue with builder" },
333
+ { type: "link", href: "/pl-annotations", label: "PlAnnotations" },
334
+ { type: "link", href: "/pl-ag-data-table-v2", label: "PlAgDataTableV2" },
335
+ { type: "link", href: "/pl-splash-page", label: "PlSplashPage" },
336
+ { type: "link", href: "/pl-file-input-page", label: "PlFileInputPage" },
337
+ { type: "link", href: "/pl-number-field-page", label: "PlNumberFieldPage" },
338
+ { type: "link", href: "/pl-error-boundary-page", label: "PlErrorBoundaryPage" },
339
+ { type: "link", href: "/pl-element-list-page", label: "PlElementList" },
340
+ { type: "link", href: "/text-fields", label: "PlTextField" },
341
+ { type: "link", href: "/tabs", label: "PlTabs" },
342
+ { type: "link", href: "/pl-autocomplete", label: "PlAutocomplete" },
343
+ { type: "link", href: "/radio", label: "PlRadio" },
344
+ { type: "link", href: "/stacked-bar", label: "PlChartStackedBar" },
345
+ { type: "link", href: "/histogram", label: "PlChartHistogram" },
346
+ { type: "link", href: "/buttons", label: "ButtonsPage" },
347
+ { type: "link", href: "/errors", label: "Errors" },
348
+ { type: "link", href: "/downloads", label: "Downloads" },
349
+ { type: "link", href: "/notifications", label: "Notifications" },
350
+ { type: "link", href: "/drafts", label: "Drafts" },
351
+ { type: "link", href: "/pl-autocomplete", label: "PlAutocomplete" },
352
+ { type: "link", href: "/pl-autocomplete-multi", label: "PlAutocompleteMulti" },
353
+ { type: "link", href: "/radio", label: "PlRadio" },
354
+ { type: "link", href: "/advanced-filter", label: "PlAdvancedFilter" },
359
355
  ...(dynamicSections.length
360
- ? [
361
- { type: 'delimiter' },
362
- ...dynamicSections,
363
- { type: 'delimiter' },
364
- ] as const
356
+ ? ([{ type: "delimiter" }, ...dynamicSections, { type: "delimiter" }] as const)
365
357
  : []),
366
358
  {
367
- type: 'link',
368
- href: '/add-section',
369
- appearance: 'add-section',
370
- label: 'New Dynamic section',
359
+ type: "link",
360
+ href: "/add-section",
361
+ appearance: "add-section",
362
+ label: "New Dynamic section",
371
363
  },
372
364
  ];
373
365
  })
package/tsconfig.json CHANGED
@@ -1,12 +1,5 @@
1
1
  {
2
2
  "extends": "@milaboratories/ts-configs/block/model",
3
- "include": [
4
- "src/**/*"
5
- ],
6
- "exclude": [
7
- "node_modules",
8
- "dist",
9
- "**/*.test.ts",
10
- "**/*.spec.ts"
11
- ]
12
- }
3
+ "include": ["src/**/*"],
4
+ "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
5
+ }
@@ -1,5 +0,0 @@
1
-  WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
-
3
- > @milaboratories/milaboratories.ui-examples.model@1.4.9 lint /home/runner/_work/platforma/platforma/etc/blocks/ui-examples/model
4
- > eslint .
5
-
package/eslint.config.mjs DELETED
@@ -1,7 +0,0 @@
1
- import { model } from '@platforma-sdk/eslint-config';
2
-
3
- /** @type {import('eslint').Linter.Config[]} */
4
- export default [
5
- { ignores: ['*.d.ts', 'vite.config.mts', '**/dist'] },
6
- ...model,
7
- ];