@platforma-sdk/ui-vue 1.11.7 → 1.12.0
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 +14 -0
- package/dist/lib.js +2825 -2787
- package/dist/lib.umd.cjs +22 -22
- package/dist/src/components/BlockLayout.vue.d.ts.map +1 -1
- package/dist/src/components/BlockLoader.vue.d.ts +7 -0
- package/dist/src/components/BlockLoader.vue.d.ts.map +1 -0
- package/dist/src/types.d.ts +17 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/assets/block.scss +53 -0
- package/src/components/BlockLayout.vue +4 -0
- package/src/components/BlockLoader.vue +28 -0
- package/src/types.ts +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/ui-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/lib.umd.cjs",
|
|
6
6
|
"module": "dist/lib.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@ag-grid-enterprise/side-bar": "^32.3.3",
|
|
39
39
|
"@ag-grid-enterprise/column-tool-panel": "^32.3.3",
|
|
40
40
|
"@milaboratories/uikit": "^2.2.11",
|
|
41
|
-
"@platforma-sdk/model": "^1.
|
|
41
|
+
"@platforma-sdk/model": "^1.12.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@faker-js/faker": "^8.4.1",
|
package/src/assets/block.scss
CHANGED
|
@@ -43,6 +43,45 @@
|
|
|
43
43
|
padding: 0;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
&__loader {
|
|
47
|
+
height: 4px;
|
|
48
|
+
background-color: transparent;
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 0;
|
|
51
|
+
right: 0;
|
|
52
|
+
left: 0;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
&:before {
|
|
55
|
+
content: "";
|
|
56
|
+
position: absolute;
|
|
57
|
+
left: -50%;
|
|
58
|
+
height: 4px;
|
|
59
|
+
width: 33%;
|
|
60
|
+
background-color: var(--border-color-focus);
|
|
61
|
+
animation: loader-animation 1.3s linear infinite;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&__progress {
|
|
66
|
+
--progress-width: 0%;
|
|
67
|
+
height: 4px;
|
|
68
|
+
background-color: transparent;
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 0;
|
|
71
|
+
right: 0;
|
|
72
|
+
left: 0;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
&:before {
|
|
75
|
+
content: "";
|
|
76
|
+
position: absolute;
|
|
77
|
+
left: 0;
|
|
78
|
+
height: 4px;
|
|
79
|
+
width: var(--progress-width);
|
|
80
|
+
background-color: var(--border-color-focus);
|
|
81
|
+
will-change: width;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
46
85
|
&__error {
|
|
47
86
|
background: var(--txt-error);
|
|
48
87
|
color: #fff;
|
|
@@ -69,4 +108,18 @@
|
|
|
69
108
|
overflow: auto;
|
|
70
109
|
}
|
|
71
110
|
}
|
|
111
|
+
|
|
112
|
+
@keyframes loader-animation {
|
|
113
|
+
0% {
|
|
114
|
+
left: -40%;
|
|
115
|
+
}
|
|
116
|
+
50% {
|
|
117
|
+
left: 20%;
|
|
118
|
+
width: 38%;
|
|
119
|
+
}
|
|
120
|
+
100% {
|
|
121
|
+
left: 100%;
|
|
122
|
+
width: 50%;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
72
125
|
}
|
|
@@ -6,6 +6,7 @@ import { useSdkPlugin } from '../defineApp';
|
|
|
6
6
|
import NotFound from './NotFound.vue';
|
|
7
7
|
import LoaderPage from './LoaderPage.vue';
|
|
8
8
|
import { PlAppErrorNotificationAlert } from './PlAppErrorNotificationAlert';
|
|
9
|
+
import BlockLoader from './BlockLoader.vue';
|
|
9
10
|
|
|
10
11
|
const sdk = useSdkPlugin();
|
|
11
12
|
|
|
@@ -35,10 +36,13 @@ const app = computed(() => (sdk.loaded ? sdk.useApp() : undefined));
|
|
|
35
36
|
const errors = computed(() => (app.value ? app.value.model.outputErrors : {}));
|
|
36
37
|
|
|
37
38
|
const showErrorsNotification = computed(() => app.value?.showErrorsNotification ?? true);
|
|
39
|
+
|
|
40
|
+
const progress = computed(() => app.value?.progress?.());
|
|
38
41
|
</script>
|
|
39
42
|
|
|
40
43
|
<template>
|
|
41
44
|
<div class="block block__layout">
|
|
45
|
+
<BlockLoader :value="progress" />
|
|
42
46
|
<div v-if="sdk.error">{{ sdk.error }}</div>
|
|
43
47
|
<LoaderPage v-else-if="!sdk.loaded">Loading...</LoaderPage>
|
|
44
48
|
<component :is="CurrentView" v-else-if="CurrentView" :key="href" />
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
value: boolean | number | undefined;
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const isLoader = computed(() => typeof props.value === 'boolean' && props.value);
|
|
9
|
+
|
|
10
|
+
const progressWidth = computed(() => {
|
|
11
|
+
const value = props.value;
|
|
12
|
+
|
|
13
|
+
if (typeof value === 'number') {
|
|
14
|
+
if (value >= 1) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (value * 100).toFixed(2) + '%';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return undefined;
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div v-if="isLoader" class="block__loader" />
|
|
27
|
+
<div v-else-if="progressWidth !== undefined" class="block__progress" :style="{ '--progress-width': progressWidth }" />
|
|
28
|
+
</template>
|
package/src/types.ts
CHANGED
|
@@ -63,7 +63,24 @@ export type AppSettings = {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
export type ExtendSettings<Href extends `/${string}` = `/${string}`> = {
|
|
66
|
+
/**
|
|
67
|
+
* Displays a loader on top of the block.
|
|
68
|
+
* - If `true`: Shows an infinite loader.
|
|
69
|
+
* - If a number (0 <= n < 1): Displays a progress bar representing completion percentage.
|
|
70
|
+
* - If a number (n > 1): Hides the progress bar.
|
|
71
|
+
* - If `undefined`: No loader is displayed.
|
|
72
|
+
*/
|
|
73
|
+
progress?: () => number | boolean | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Enables or disables a notification box for error messages.
|
|
76
|
+
* - If `true`: A notification box appears when there are errors in the outputs.
|
|
77
|
+
* - If `false`: No notification box is shown.
|
|
78
|
+
*/
|
|
66
79
|
showErrorsNotification?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Maps application routes to their respective components.
|
|
82
|
+
* TODO: Consider moving route initialization logic to a dedicated method.
|
|
83
|
+
*/
|
|
67
84
|
routes: Routes<Href>;
|
|
68
85
|
};
|
|
69
86
|
|