@platforma-sdk/ui-vue 1.30.7 → 1.30.13
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/CHANGELOG.md +21 -0
- package/dist/lib.js +3500 -3484
- package/dist/lib.js.map +1 -1
- package/dist/lib.umd.cjs +13 -13
- package/dist/lib.umd.cjs.map +1 -1
- package/dist/src/AgGridVue/useAgGridOptions.d.ts +16 -2
- package/dist/src/AgGridVue/useAgGridOptions.d.ts.map +1 -1
- package/dist/src/components/PlAgDataTable/sources/table-source.d.ts.map +1 -1
- package/dist/src/plugins/Monetization/MonetizationSidebar.vue.d.ts.map +1 -1
- package/dist/src/plugins/Monetization/useInfo.d.ts +2 -2
- package/dist/src/plugins/Monetization/validation.d.ts +10 -10
- package/dist/src/plugins/Monetization/validation.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/AgGridVue/useAgGridOptions.ts +43 -16
- package/src/components/PlAgDataTable/sources/table-source-v2.ts +1 -1
- package/src/components/PlAgDataTable/sources/table-source.ts +6 -4
- package/src/plugins/Monetization/MonetizationSidebar.vue +7 -1
- package/src/plugins/Monetization/useInfo.ts +5 -5
- package/src/plugins/Monetization/validation.ts +1 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/ui-vue",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/lib.umd.cjs",
|
|
6
6
|
"module": "dist/lib.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"ag-grid-enterprise": "^33.0.4",
|
|
25
25
|
"ag-grid-vue3": "^33.0.4",
|
|
26
26
|
"@milaboratories/uikit": "^2.2.72",
|
|
27
|
-
"@platforma-sdk/model": "^1.30.
|
|
27
|
+
"@platforma-sdk/model": "^1.30.11"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@faker-js/faker": "^9.2.0",
|
|
@@ -15,7 +15,7 @@ import { PlAgChartHistogramCell } from '../components/PlAgChartHistogramCell';
|
|
|
15
15
|
import type { ImportFileHandle } from '@platforma-sdk/model';
|
|
16
16
|
import type { ImportProgress } from '@platforma-sdk/model';
|
|
17
17
|
import { PlAgCellStatusTag } from '../components/PlAgCellStatusTag';
|
|
18
|
-
interface GridOptionsExtended<TData = any> extends Omit<GridOptions<TData>, 'columnDefs'> {
|
|
18
|
+
interface GridOptionsExtended<TData = any> extends Omit<GridOptions<TData>, 'columnDefs' | 'loadingOverlayComponentParams'> {
|
|
19
19
|
/**
|
|
20
20
|
* Array of Column / Column Group definitions.
|
|
21
21
|
*/
|
|
@@ -24,6 +24,10 @@ interface GridOptionsExtended<TData = any> extends Omit<GridOptions<TData>, 'col
|
|
|
24
24
|
* Show row numbers column
|
|
25
25
|
*/
|
|
26
26
|
rowNumbersColumn?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Loading overlay text
|
|
29
|
+
*/
|
|
30
|
+
loadingText?: string;
|
|
27
31
|
/**
|
|
28
32
|
* Not ready overlay (No datasource). Takes priority over "loading"
|
|
29
33
|
*/
|
|
@@ -40,6 +44,10 @@ interface GridOptionsExtended<TData = any> extends Omit<GridOptions<TData>, 'col
|
|
|
40
44
|
* Override standard 'Empty' text for the "no rows" overlay
|
|
41
45
|
*/
|
|
42
46
|
noRowsText?: string;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Use loading, notReady, loadingText, loadingOverlayType instead
|
|
49
|
+
*/
|
|
50
|
+
loadingOverlayComponentParams?: never;
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
// @TODO (super simple builder for now)
|
|
@@ -75,6 +83,16 @@ class Builder<TData> {
|
|
|
75
83
|
return this;
|
|
76
84
|
}
|
|
77
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Set loading overlay custom text (default is "Loading")
|
|
88
|
+
* @param loadingText
|
|
89
|
+
* @returns this
|
|
90
|
+
*/
|
|
91
|
+
public setLoadingText(loadingText?: string) {
|
|
92
|
+
this.#options.loadingText = loadingText;
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
|
|
78
96
|
/**
|
|
79
97
|
* Show "not ready overlay
|
|
80
98
|
* @param notReady
|
|
@@ -272,7 +290,7 @@ export function useAgGridOptions<TData>(
|
|
|
272
290
|
) {
|
|
273
291
|
const gridApi = shallowRef<GridApi>();
|
|
274
292
|
|
|
275
|
-
const
|
|
293
|
+
const extOptions = computed<GridOptionsExtended>(() => {
|
|
276
294
|
const def: GridOptionsExtended<TData> = {
|
|
277
295
|
theme: AgGridTheme,
|
|
278
296
|
loadingOverlayComponent: PlAgOverlayLoading,
|
|
@@ -301,17 +319,12 @@ export function useAgGridOptions<TData>(
|
|
|
301
319
|
};
|
|
302
320
|
}
|
|
303
321
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
// @TODO
|
|
307
|
-
if (options.loading) {
|
|
308
|
-
options.loadingOverlayComponentParams = {
|
|
309
|
-
notReady: options.notReady,
|
|
310
|
-
notReadyText: options.notReadyText,
|
|
311
|
-
overlayType: options.loadingOverlayType,
|
|
312
|
-
} satisfies PlAgOverlayLoadingParams;
|
|
322
|
+
if ('loadingOverlayComponentParams' in options) {
|
|
323
|
+
console.warn('useAgGridOptions: remove loadingOverlayComponentParams from options, use loading, notReady, loadingText, loadingOverlayType instead');
|
|
313
324
|
}
|
|
314
325
|
|
|
326
|
+
options.loading = options.notReady || options.loading;
|
|
327
|
+
|
|
315
328
|
options.columnDefs = options.columnDefs?.map((it) => createAgGridColDef(it));
|
|
316
329
|
|
|
317
330
|
// Register all special components
|
|
@@ -325,21 +338,35 @@ export function useAgGridOptions<TData>(
|
|
|
325
338
|
return options;
|
|
326
339
|
});
|
|
327
340
|
|
|
328
|
-
|
|
341
|
+
const gridOptions = computed<GridOptions>(() => {
|
|
342
|
+
const options = extOptions.value;
|
|
343
|
+
|
|
344
|
+
return {
|
|
345
|
+
...options,
|
|
346
|
+
loadingOverlayComponentParams: {
|
|
347
|
+
notReady: options.notReady,
|
|
348
|
+
notReadyText: options.notReadyText,
|
|
349
|
+
overlayType: options.loadingOverlayType,
|
|
350
|
+
} satisfies PlAgOverlayLoadingParams,
|
|
351
|
+
};
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
whenever(() => extOptions.value.rowNumbersColumn, () => {
|
|
329
355
|
if (gridApi.value) {
|
|
330
356
|
autoSizeRowNumberColumn(gridApi.value);
|
|
331
357
|
}
|
|
332
358
|
});
|
|
333
359
|
|
|
334
360
|
watch([
|
|
335
|
-
() =>
|
|
336
|
-
() =>
|
|
361
|
+
() => extOptions.value.notReady,
|
|
362
|
+
() => extOptions.value.loading,
|
|
337
363
|
], ([notReady, loading]) => {
|
|
338
364
|
const loadingOverlayComponentParams = {
|
|
339
365
|
notReady,
|
|
340
366
|
// we probably don't need to update the parameters below
|
|
341
|
-
notReadyText:
|
|
342
|
-
overlayType:
|
|
367
|
+
notReadyText: extOptions.value.notReadyText,
|
|
368
|
+
overlayType: extOptions.value.loadingOverlayType,
|
|
369
|
+
loadingText: extOptions.value.loadingText,
|
|
343
370
|
} satisfies PlAgOverlayLoadingParams;
|
|
344
371
|
|
|
345
372
|
// Hack to apply loadingOverlayComponentParams
|
|
@@ -129,8 +129,8 @@ export async function updatePFrameGridOptions(
|
|
|
129
129
|
|
|
130
130
|
const fields = [...indices];
|
|
131
131
|
|
|
132
|
-
const firstColumnIdx = indices.findIndex((i) => specs[i].type === 'column');
|
|
133
132
|
// process label columns
|
|
133
|
+
const firstColumnIdx = indices.findIndex((i) => specs[i].type === 'column');
|
|
134
134
|
for (let i = indices.length - 1; i >= firstColumnIdx; --i) {
|
|
135
135
|
const idx = indices[i];
|
|
136
136
|
if (!isLabelColumn(specs[idx])) continue;
|
|
@@ -105,16 +105,18 @@ export async function updatePFrameGridOptions(
|
|
|
105
105
|
const hColumns = getHeterogeneousColumns(specs, indices);
|
|
106
106
|
|
|
107
107
|
// process label columns
|
|
108
|
-
|
|
108
|
+
const firstColumnIdx = indices.findIndex((i) => specs[i].type === 'column');
|
|
109
|
+
for (let i = indices.length - 1; i >= firstColumnIdx; --i) {
|
|
109
110
|
const idx = indices[i];
|
|
110
111
|
if (!isLabelColumn(specs[idx])) continue;
|
|
111
112
|
|
|
112
113
|
// axis of labels
|
|
113
114
|
const axisId = getAxisId((specs[idx].spec as PColumnSpec).axesSpec[0]);
|
|
114
115
|
const axisIdx = indices.findIndex((idx) => lodash.isEqual(specs[idx].id, axisId));
|
|
115
|
-
if (axisIdx
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
if (axisIdx !== -1) {
|
|
117
|
+
indices[axisIdx] = idx;
|
|
118
|
+
} else {
|
|
119
|
+
console.warn(`multiple label columns match axisId: ${JSON.stringify(axisId)}`);
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
// replace in h-columns
|
|
@@ -52,14 +52,20 @@ const options = computed(() => {
|
|
|
52
52
|
|
|
53
53
|
const statusText = computed(() => {
|
|
54
54
|
switch (status.value) {
|
|
55
|
+
case 'active':
|
|
56
|
+
return '';
|
|
55
57
|
case 'limits_exceeded':
|
|
56
58
|
return 'Usage limits exceeded for the current billing period.';
|
|
57
59
|
case 'payment_required':
|
|
58
60
|
return 'Payment required to continue using the service.';
|
|
59
61
|
case 'select-tariff':
|
|
60
62
|
return 'Select a subscription plan in the Scientist Cabinet.';
|
|
63
|
+
case 'inactive':
|
|
64
|
+
return 'Not found billing period.';
|
|
65
|
+
case 'awaiting':
|
|
66
|
+
return 'Waiting for monetization information';
|
|
61
67
|
default:
|
|
62
|
-
return '';
|
|
68
|
+
return 'Unknown status: ' + status.value;
|
|
63
69
|
}
|
|
64
70
|
});
|
|
65
71
|
|
|
@@ -10,9 +10,11 @@ export function useInfo() {
|
|
|
10
10
|
|
|
11
11
|
const hasMonetization = computed(() => '__mnzDate' in (app.value?.model?.args as Record<string, unknown>));
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const parsed = computed(() => Response.safeParse(app.value?.model.outputs['__mnzInfo']));
|
|
14
14
|
|
|
15
|
-
const currentInfo = computed<Response | undefined>(() =>
|
|
15
|
+
const currentInfo = computed<Response | undefined>(() => parsed.value?.data);
|
|
16
|
+
|
|
17
|
+
const error = computed(() => parsed.value?.error ?? info.value?.response?.error);
|
|
16
18
|
|
|
17
19
|
const info = ref<Response | undefined>(undefined);
|
|
18
20
|
|
|
@@ -20,8 +22,6 @@ export function useInfo() {
|
|
|
20
22
|
|
|
21
23
|
const version = ref(0);
|
|
22
24
|
|
|
23
|
-
const error = computed(() => mnzInfo.value?.error ?? info.value?.response?.error);
|
|
24
|
-
|
|
25
25
|
watch([currentInfo], ([i]) => {
|
|
26
26
|
if (i) {
|
|
27
27
|
info.value = i;
|
|
@@ -38,7 +38,7 @@ export function useInfo() {
|
|
|
38
38
|
|
|
39
39
|
const canRun = computed(() => !!result.value?.canRun);
|
|
40
40
|
|
|
41
|
-
const status = computed(() => result.value?.status);
|
|
41
|
+
const status = computed(() => currentInfo.value ? result.value?.status : 'awaiting');
|
|
42
42
|
|
|
43
43
|
const customerEmail = computed(() => result.value?.customerEmail);
|
|
44
44
|
|
|
@@ -28,12 +28,7 @@ const DryRunResult = z.object({
|
|
|
28
28
|
productName: z.string().default('Unknown product'),
|
|
29
29
|
customerEmail: z.string().optional(),
|
|
30
30
|
canRun: z.boolean(),
|
|
31
|
-
status: z.
|
|
32
|
-
z.literal('select-tariff'),
|
|
33
|
-
z.literal('active'),
|
|
34
|
-
z.literal('payment_required'),
|
|
35
|
-
z.literal('limits_exceeded'),
|
|
36
|
-
]),
|
|
31
|
+
status: z.string(), // 'select-tariff', 'active', 'payment_required', 'limits_exceeded', 'inactive', 'unknown',
|
|
37
32
|
mnz: z.object({
|
|
38
33
|
type: MonetizationType.optional(),
|
|
39
34
|
endOfBillingPeriod: z.string().nullable().optional(),
|