@platforma-sdk/ui-vue 1.4.8 → 1.4.9
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 +7 -0
- package/dist/lib.js +3922 -3918
- package/dist/lib.umd.cjs +59 -59
- package/dist/src/aggrid.d.ts +1 -1
- package/dist/src/aggrid.d.ts.map +1 -1
- package/dist/src/createModel.d.ts.map +1 -1
- package/dist/src/lib.d.ts +1 -0
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/aggrid.ts +5 -2
- package/src/createModel.ts +18 -14
- package/src/defineApp.ts +2 -2
- package/src/lib.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/ui-vue",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/lib.umd.cjs",
|
|
6
6
|
"module": "dist/lib.js",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"@platforma-sdk/model": "^1.2.32"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@ag-grid-community/client-side-row-model": "^32.2.
|
|
29
|
-
"@ag-grid-community/core": "^32.2.
|
|
30
|
-
"@ag-grid-community/infinite-row-model": "^32.2.
|
|
31
|
-
"@ag-grid-community/styles": "^32.2.
|
|
32
|
-
"@ag-grid-community/vue3": "^32.2.
|
|
33
|
-
"@ag-grid-enterprise/core": "^32.2.
|
|
34
|
-
"@ag-grid-enterprise/clipboard": "^32.2.
|
|
35
|
-
"@ag-grid-enterprise/range-selection": "^32.2.
|
|
28
|
+
"@ag-grid-community/client-side-row-model": "^32.2.2",
|
|
29
|
+
"@ag-grid-community/core": "^32.2.2",
|
|
30
|
+
"@ag-grid-community/infinite-row-model": "^32.2.2",
|
|
31
|
+
"@ag-grid-community/styles": "^32.2.2",
|
|
32
|
+
"@ag-grid-community/vue3": "^32.2.2",
|
|
33
|
+
"@ag-grid-enterprise/core": "^32.2.2",
|
|
34
|
+
"@ag-grid-enterprise/clipboard": "^32.2.2",
|
|
35
|
+
"@ag-grid-enterprise/range-selection": "^32.2.2",
|
|
36
36
|
"@faker-js/faker": "^8.4.0",
|
|
37
37
|
"@types/lodash": "^4.17.7",
|
|
38
38
|
"@types/node": "~20.16.5",
|
package/src/aggrid.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { getEnvironmentValue } from '@platforma-sdk/model';
|
|
2
2
|
import { LicenseManager } from '@ag-grid-enterprise/core';
|
|
3
3
|
|
|
4
|
-
export function
|
|
4
|
+
export function activateAgGrid() {
|
|
5
5
|
const agGridLicense = getEnvironmentValue('AGGRID_LICENSE');
|
|
6
|
-
if (agGridLicense)
|
|
6
|
+
if (agGridLicense) {
|
|
7
|
+
LicenseManager.setLicenseKey(agGridLicense);
|
|
8
|
+
console.log('AGGrid Activated');
|
|
9
|
+
}
|
|
7
10
|
}
|
package/src/createModel.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { reactive, computed, ref, watch, unref } from 'vue';
|
|
2
2
|
import type { ZodError } from 'zod';
|
|
3
3
|
import type { ModelOptions, Model } from './types';
|
|
4
|
-
import {
|
|
4
|
+
import { deepClone } from '@milaboratories/helpers';
|
|
5
5
|
import { isJsonEqual } from './utils';
|
|
6
6
|
|
|
7
7
|
const identity = <T, V = T>(v: T): V => v as unknown as V;
|
|
@@ -33,22 +33,26 @@ export function createModel<M, V = unknown>(options: ModelOptions<M, V>): Model<
|
|
|
33
33
|
|
|
34
34
|
const error = ref<Error | undefined>();
|
|
35
35
|
|
|
36
|
-
const local = ref<M>();
|
|
36
|
+
const local = ref<{ model: M }>();
|
|
37
|
+
|
|
38
|
+
const setSource = (v: M) => {
|
|
39
|
+
local.value = {
|
|
40
|
+
model: deepClone(v),
|
|
41
|
+
};
|
|
42
|
+
};
|
|
37
43
|
|
|
38
44
|
watch(
|
|
39
45
|
() => options.get(),
|
|
40
|
-
(v) =>
|
|
41
|
-
local.value = deepClone(v);
|
|
42
|
-
},
|
|
46
|
+
(v) => setSource(v),
|
|
43
47
|
{ immediate: true },
|
|
44
48
|
);
|
|
45
49
|
|
|
46
50
|
const save = () => {
|
|
47
|
-
options.onSave(validate(deepClone(local.value)));
|
|
51
|
+
options.onSave(validate(deepClone(local.value?.model)));
|
|
48
52
|
};
|
|
49
53
|
|
|
50
54
|
const revert = () => {
|
|
51
|
-
|
|
55
|
+
setSource(options.get());
|
|
52
56
|
error.value = undefined;
|
|
53
57
|
};
|
|
54
58
|
|
|
@@ -75,19 +79,19 @@ export function createModel<M, V = unknown>(options: ModelOptions<M, V>): Model<
|
|
|
75
79
|
|
|
76
80
|
const model = computed<M>({
|
|
77
81
|
get: () => {
|
|
78
|
-
return local.value as M;
|
|
82
|
+
return local.value?.model as M;
|
|
79
83
|
},
|
|
80
84
|
set(v) {
|
|
81
|
-
|
|
85
|
+
setSource(v);
|
|
82
86
|
setValue(v);
|
|
83
87
|
},
|
|
84
88
|
});
|
|
85
89
|
|
|
86
90
|
watch(
|
|
87
91
|
local,
|
|
88
|
-
(v) => {
|
|
89
|
-
if (
|
|
90
|
-
setValue(v
|
|
92
|
+
(v, old) => {
|
|
93
|
+
if (v && v === old) {
|
|
94
|
+
setValue(v.model);
|
|
91
95
|
}
|
|
92
96
|
},
|
|
93
97
|
{ deep: true },
|
|
@@ -96,13 +100,13 @@ export function createModel<M, V = unknown>(options: ModelOptions<M, V>): Model<
|
|
|
96
100
|
const valid = computed(() => !error.value);
|
|
97
101
|
|
|
98
102
|
const isChanged = computed(() => {
|
|
99
|
-
return !
|
|
103
|
+
return !isJsonEqual(options.get(), unref(local)); // @TODO, can be slow
|
|
100
104
|
});
|
|
101
105
|
|
|
102
106
|
const errorString = computed(() => (error.value ? error.value.message : ''));
|
|
103
107
|
|
|
104
108
|
return reactive({
|
|
105
|
-
model
|
|
109
|
+
model,
|
|
106
110
|
valid,
|
|
107
111
|
isChanged,
|
|
108
112
|
error,
|
package/src/defineApp.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Component, Reactive } from 'vue';
|
|
|
4
4
|
import { inject, markRaw, reactive } from 'vue';
|
|
5
5
|
import { createApp, type BaseApp } from './internal/createApp';
|
|
6
6
|
import type { LocalState, Routes } from './types';
|
|
7
|
-
import {
|
|
7
|
+
import { activateAgGrid } from './aggrid';
|
|
8
8
|
|
|
9
9
|
const pluginKey = Symbol('sdk-vue');
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ export function defineApp<
|
|
|
22
22
|
>(platforma: Platforma<Args, Outputs, UiState, Href>, extendApp: (app: BaseApp<Args, Outputs, UiState, Href>) => Local) {
|
|
23
23
|
let app: undefined | App<Args, Outputs, UiState, Href, Local> = undefined;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
activateAgGrid();
|
|
26
26
|
|
|
27
27
|
const loadApp = () => {
|
|
28
28
|
platforma
|