vueless 0.0.175 → 0.0.177
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 +2 -2
- package/ui.data-table/components/TableRow.vue +170 -0
- package/ui.data-table/composables/attrs.composable.js +30 -11
- package/ui.data-table/configs/default.config.js +27 -8
- package/ui.data-table/index.stories.js +106 -16
- package/ui.data-table/index.vue +49 -166
- package/ui.data-table/services/table.service.js +49 -9
- package/ui.dropdown-list/configs/default.config.js +2 -2
- package/ui.form-checkbox/configs/default.config.js +3 -2
- package/ui.form-checkbox/index.vue +3 -1
- package/ui.form-input/configs/default.config.js +3 -3
- package/ui.form-label/configs/default.config.js +31 -25
- package/ui.form-label/index.vue +3 -13
- package/ui.form-radio/configs/default.config.js +3 -0
- package/ui.form-radio/index.vue +1 -1
- package/ui.form-select/configs/default.config.js +8 -8
- package/ui.form-select/index.vue +13 -3
- package/ui.form-textarea/configs/default.config.js +10 -13
- package/ui.loader-rendering/Docs.mdx +2 -1
- package/ui.loader-rendering/index.stories.js +20 -15
- package/ui.loader-top/Docs.mdx +40 -8
- package/ui.loader-top/composables/useLoaderTop.js +10 -23
- package/ui.loader-top/index.stories.js +28 -23
- package/ui.loader-top/index.vue +21 -21
- package/web-types.json +100 -134
- package/ui.form-radio-card/Docs.mdx +0 -16
- package/ui.form-radio-card/composables/attrs.composable.js +0 -37
- package/ui.form-radio-card/configs/default.config.js +0 -31
- package/ui.form-radio-card/constants/index.js +0 -5
- package/ui.form-radio-card/index.stories.js +0 -152
- package/ui.form-radio-card/index.vue +0 -142
- package/ui.form-radio-card/services/variant.service.js +0 -15
|
@@ -9,9 +9,9 @@ export default /*tw*/ {
|
|
|
9
9
|
`,
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
12
|
-
sm: "pt-2 pb-
|
|
13
|
-
md: "pt-2.5 pb-
|
|
14
|
-
lg: "pt-3 pb-
|
|
12
|
+
sm: "pt-2 pb-1.5",
|
|
13
|
+
md: "pt-2.5 pb-1.5",
|
|
14
|
+
lg: "pt-3 pb-2",
|
|
15
15
|
},
|
|
16
16
|
error: {
|
|
17
17
|
true: `
|
|
@@ -27,9 +27,9 @@ export default /*tw*/ {
|
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
compoundVariants: [
|
|
30
|
-
{ labelAlign: "topInside", label: true, size: "sm", class: "pt-
|
|
31
|
-
{ labelAlign: "topInside", label: true, size: "md", class: "pt-
|
|
32
|
-
{ labelAlign: "topInside", label: true, size: "lg", class: "pt-
|
|
30
|
+
{ labelAlign: "topInside", label: true, size: "sm", class: "pt-5" },
|
|
31
|
+
{ labelAlign: "topInside", label: true, size: "md", class: "pt-6" },
|
|
32
|
+
{ labelAlign: "topInside", label: true, size: "lg", class: "pt-7" },
|
|
33
33
|
],
|
|
34
34
|
},
|
|
35
35
|
innerWrapper: {
|
|
@@ -48,8 +48,8 @@ export default /*tw*/ {
|
|
|
48
48
|
base: "flex items-center mt-0",
|
|
49
49
|
compoundVariants: [
|
|
50
50
|
{ labelAlign: "topInside", size: "sm", label: true, class: "-mt-3" },
|
|
51
|
-
{ labelAlign: "topInside", size: "md", label: true, class: "-mt-
|
|
52
|
-
{ labelAlign: "topInside", size: "lg", label: true, class: "-mt-
|
|
51
|
+
{ labelAlign: "topInside", size: "md", label: true, class: "-mt-3" },
|
|
52
|
+
{ labelAlign: "topInside", size: "lg", label: true, class: "-mt-4" },
|
|
53
53
|
],
|
|
54
54
|
},
|
|
55
55
|
beforeCaretSlot: "",
|
package/ui.form-select/index.vue
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
internal
|
|
42
42
|
interactive
|
|
43
43
|
color="gray"
|
|
44
|
-
:size="
|
|
44
|
+
:size="iconSize"
|
|
45
45
|
:name="config.toggleIconName"
|
|
46
46
|
v-bind="toggleIconAttrs"
|
|
47
47
|
/>
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
internal
|
|
61
61
|
interactive
|
|
62
62
|
color="gray"
|
|
63
|
-
:size="
|
|
63
|
+
:size="iconSize"
|
|
64
64
|
:name="config.clearIconName"
|
|
65
65
|
v-bind="clearIconAttrs"
|
|
66
66
|
@mousedown="removeElement"
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
internal
|
|
94
94
|
interactive
|
|
95
95
|
color="gray"
|
|
96
|
-
:size="
|
|
96
|
+
:size="iconSize"
|
|
97
97
|
:name="config.removeItemIconName"
|
|
98
98
|
v-bind="removeItemIconAttrs"
|
|
99
99
|
@mousedown="removeElement(item)"
|
|
@@ -503,6 +503,16 @@ const {
|
|
|
503
503
|
const i18nGlobal = tm(USelect);
|
|
504
504
|
const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props.config.i18n));
|
|
505
505
|
|
|
506
|
+
const iconSize = computed(() => {
|
|
507
|
+
const sizes = {
|
|
508
|
+
sm: "sm",
|
|
509
|
+
md: "md",
|
|
510
|
+
lg: "md",
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
return sizes[props.size];
|
|
514
|
+
});
|
|
515
|
+
|
|
506
516
|
const inputPlaceholder = computed(() => {
|
|
507
517
|
const message = currentLocale.value.addMore;
|
|
508
518
|
|
|
@@ -4,10 +4,10 @@ export default /*tw*/ {
|
|
|
4
4
|
rightSlot: "flex items-center justify-center h-full w-11 absolute right-0",
|
|
5
5
|
textareaWrapper: {
|
|
6
6
|
base: `
|
|
7
|
-
transition duration-100 ease-in-out focus-within:outline-none
|
|
8
|
-
border-solid border-gray-300
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
transition duration-100 ease-in-out focus-within:outline-none
|
|
8
|
+
rounded-lg border border-solid border-gray-300 ring-0 cursor-text bg-white pr-4
|
|
9
|
+
hover:border-gray-400 pl-4 hover:focus-within:border-gray-500
|
|
10
|
+
focus-within:border-gray-500 focus-within:ring-4 focus-within:ring-gray-600/[.15]
|
|
11
11
|
`,
|
|
12
12
|
variants: {
|
|
13
13
|
error: {
|
|
@@ -24,18 +24,15 @@ export default /*tw*/ {
|
|
|
24
24
|
true: "ring-0 border-gray-300 focus-within:ring-0 focus-within:border-brand-300",
|
|
25
25
|
},
|
|
26
26
|
size: {
|
|
27
|
-
sm: "
|
|
28
|
-
md: "
|
|
29
|
-
lg: "
|
|
27
|
+
sm: "pt-2 pb-2",
|
|
28
|
+
md: "pt-2.5 pb-2.5",
|
|
29
|
+
lg: "pt-3 pb-3",
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
compoundVariants: [
|
|
33
|
-
{ labelAlign: "
|
|
34
|
-
{ labelAlign: "
|
|
35
|
-
{ labelAlign: "
|
|
36
|
-
{ labelAlign: "topInside", label: false, class: "pt-2" },
|
|
37
|
-
{ labelAlign: "topInside", label: false, class: "pt-2.5" },
|
|
38
|
-
{ labelAlign: "topInside", label: false, class: "pt-3" },
|
|
33
|
+
{ labelAlign: "topInside", label: true, class: "pt-5 pb-1.5" },
|
|
34
|
+
{ labelAlign: "topInside", label: true, class: "pt-6 pb-1.5" },
|
|
35
|
+
{ labelAlign: "topInside", label: true, class: "pt-7 pb-2" },
|
|
39
36
|
],
|
|
40
37
|
},
|
|
41
38
|
textarea: {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source
|
|
1
|
+
import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
|
|
2
2
|
import { getSource } from "../service.storybook";
|
|
3
3
|
|
|
4
4
|
import * as stories from "./index.stories";
|
|
5
|
+
import defaultConfig from "./configs/default.config?raw"
|
|
5
6
|
|
|
6
7
|
<Meta of={stories} />
|
|
7
8
|
<Title of={stories} />
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ULoaderRendering from "../ui.loader-rendering";
|
|
2
2
|
import UButton from "../ui.button";
|
|
3
|
+
import UGroup from "../ui.container-group";
|
|
3
4
|
|
|
4
5
|
import { useLoaderRendering } from "./composables/useLoaderRendering";
|
|
5
6
|
|
|
@@ -10,11 +11,18 @@ import { getArgTypes } from "../service.storybook";
|
|
|
10
11
|
*/
|
|
11
12
|
export default {
|
|
12
13
|
id: "9030",
|
|
13
|
-
title: "Loaders and Skeletons / Loader
|
|
14
|
+
title: "Loaders and Skeletons / Loader Rendering",
|
|
14
15
|
component: ULoaderRendering,
|
|
15
16
|
argTypes: {
|
|
16
17
|
...getArgTypes(ULoaderRendering.name),
|
|
17
18
|
},
|
|
19
|
+
parameters: {
|
|
20
|
+
docs: {
|
|
21
|
+
story: {
|
|
22
|
+
height: "420px",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
18
26
|
};
|
|
19
27
|
|
|
20
28
|
const DefaultTemplate = (args) => ({
|
|
@@ -23,32 +31,29 @@ const DefaultTemplate = (args) => ({
|
|
|
23
31
|
return { args };
|
|
24
32
|
},
|
|
25
33
|
template: `
|
|
26
|
-
<
|
|
27
|
-
<ULoaderRendering v-bind="args" class="!static !w-full" />
|
|
28
|
-
</div>
|
|
34
|
+
<ULoaderRendering v-bind="args" class="w-full h-full" />
|
|
29
35
|
`,
|
|
30
36
|
});
|
|
31
37
|
|
|
32
38
|
const LoadingTemplate = (args) => ({
|
|
33
|
-
components: { ULoaderRendering, UButton },
|
|
39
|
+
components: { ULoaderRendering, UButton, UGroup },
|
|
34
40
|
setup() {
|
|
35
|
-
const {
|
|
41
|
+
const { loaderRenderingOn, loaderRenderingOff, isLoading } = useLoaderRendering();
|
|
36
42
|
|
|
37
|
-
return { args,
|
|
43
|
+
return { args, loaderRenderingOn, loaderRenderingOff, isLoading };
|
|
38
44
|
},
|
|
39
45
|
methods: {
|
|
40
46
|
toggleLoading() {
|
|
41
|
-
this.
|
|
47
|
+
this.isLoading ? this.loaderRenderingOff() : this.loaderRenderingOn();
|
|
42
48
|
},
|
|
43
49
|
},
|
|
44
50
|
template: `
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
`,
|
|
51
|
+
<UGroup align="center" class="pb-4">
|
|
52
|
+
<UButton label="Toggle loading" size="sm" @click="toggleLoading"/>
|
|
53
|
+
</UGroup>
|
|
54
|
+
|
|
55
|
+
<ULoaderRendering v-bind="args" class="!static w-full h-96" />
|
|
56
|
+
`,
|
|
52
57
|
});
|
|
53
58
|
|
|
54
59
|
export const Default = DefaultTemplate.bind({});
|
package/ui.loader-top/Docs.mdx
CHANGED
|
@@ -12,25 +12,57 @@ import defaultConfig from "./configs/default.config?raw"
|
|
|
12
12
|
<Controls of={stories.Default} />
|
|
13
13
|
<Stories of={stories} />
|
|
14
14
|
|
|
15
|
-
##
|
|
16
|
-
|
|
15
|
+
## Using loader
|
|
16
|
+
To control the loader state in Vue components use `useLoaderTop` composable.
|
|
17
|
+
|
|
18
|
+
The loader uses queue of resources and will be shown until at least one item is present in a queue.
|
|
17
19
|
|
|
18
20
|
<Source code={`
|
|
19
21
|
import { useLoaderTop } from "vueless";
|
|
20
22
|
|
|
21
23
|
const {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
isLoading,
|
|
25
|
+
loaderTopOn,
|
|
26
|
+
loaderTopOff,
|
|
27
|
+
requestQueue,
|
|
28
|
+
componentRequestQueue,
|
|
29
|
+
setComponentRequestQueue,
|
|
30
|
+
removeComponentRequestQueue
|
|
26
31
|
} = useLoaderTop();
|
|
32
|
+
|
|
33
|
+
// get loader state
|
|
34
|
+
console.log(isLoading.value);
|
|
35
|
+
|
|
36
|
+
// show loader (add resource into queue)
|
|
37
|
+
loaderTopOn("/transactions");
|
|
38
|
+
|
|
39
|
+
// hide loader (remove resource from queue)
|
|
40
|
+
loaderTopOff("/transactions");
|
|
41
|
+
|
|
42
|
+
// get current resource array
|
|
43
|
+
console.log(requestQueue.value);
|
|
44
|
+
|
|
45
|
+
// get current resource array for component relayed loaders (UTable)
|
|
46
|
+
console.log(componentRequestQueue.value);
|
|
47
|
+
|
|
48
|
+
// add resource into component related loader queue
|
|
49
|
+
setComponentRequestQueue("/transactions");
|
|
50
|
+
|
|
51
|
+
// remove resource from component related loader queue
|
|
52
|
+
removeComponentRequestQueue("/transactions");
|
|
27
53
|
`} language="jsx" dark />
|
|
28
54
|
|
|
29
|
-
##
|
|
30
|
-
|
|
55
|
+
## Using loader outside Vue components
|
|
56
|
+
To control the loader state outside Vue components, use the following methods.
|
|
31
57
|
|
|
32
58
|
<Source code={`
|
|
33
59
|
import { loaderTopOn, loaderTopOff } from "vueless";
|
|
60
|
+
|
|
61
|
+
// show loader
|
|
62
|
+
loaderTopOn("/transactions");
|
|
63
|
+
|
|
64
|
+
// hide loader
|
|
65
|
+
loaderTopOff("/transactions");
|
|
34
66
|
`} language="jsx" dark />
|
|
35
67
|
|
|
36
68
|
## Default config
|
|
@@ -4,54 +4,41 @@ export const LoaderTopSymbol = Symbol.for("vueless:loader-top");
|
|
|
4
4
|
|
|
5
5
|
const isLoading = ref(true);
|
|
6
6
|
const requestQueue = ref([]);
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const componentLoaderRequestQueue = ref([]);
|
|
7
|
+
const requestTimeout = ref(0);
|
|
8
|
+
const componentRequestQueue = ref([]);
|
|
10
9
|
|
|
11
10
|
function loaderTopOn(url) {
|
|
12
|
-
|
|
11
|
+
requestQueue.value.push(url);
|
|
13
12
|
isLoading.value = true;
|
|
14
13
|
|
|
15
|
-
clearTimeout(
|
|
14
|
+
clearTimeout(requestTimeout.value);
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
function loaderTopOff(url) {
|
|
19
|
-
|
|
18
|
+
requestQueue.value = url ? requestQueue.value.filter((item) => item !== url) : [];
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
if (!
|
|
20
|
+
requestTimeout.value = setTimeout(() => {
|
|
21
|
+
if (!requestQueue.value.length) {
|
|
23
22
|
isLoading.value = false;
|
|
24
23
|
}
|
|
25
24
|
}, 50);
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
function addRequestUrl(url) {
|
|
29
|
-
requestQueue.value.push(url);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function removeRequestUrl(url) {
|
|
33
|
-
requestQueue.value = requestQueue.value.filter((item) => item !== url);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
27
|
function setComponentRequestQueue(requests) {
|
|
37
|
-
|
|
28
|
+
componentRequestQueue.value = [...componentRequestQueue.value, ...requests];
|
|
38
29
|
}
|
|
39
30
|
|
|
40
31
|
function removeComponentRequestQueue() {
|
|
41
|
-
|
|
32
|
+
componentRequestQueue.value = [];
|
|
42
33
|
}
|
|
43
34
|
|
|
44
35
|
export function createLoaderTop() {
|
|
45
36
|
return {
|
|
46
37
|
isLoading: readonly(isLoading),
|
|
47
38
|
requestQueue: readonly(requestQueue),
|
|
48
|
-
|
|
49
|
-
loaderRequestTimeout: readonly(loaderRequestTimeout),
|
|
50
|
-
componentLoaderRequestQueue: readonly(componentLoaderRequestQueue),
|
|
39
|
+
componentRequestQueue: readonly(componentRequestQueue),
|
|
51
40
|
loaderTopOn,
|
|
52
41
|
loaderTopOff,
|
|
53
|
-
addRequestUrl,
|
|
54
|
-
removeRequestUrl,
|
|
55
42
|
setComponentRequestQueue,
|
|
56
43
|
removeComponentRequestQueue,
|
|
57
44
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import ULoaderTop from "../ui.loader-top";
|
|
2
2
|
import UButton from "../ui.button";
|
|
3
|
+
import URow from "../ui.container-row";
|
|
4
|
+
import UGroup from "../ui.container-group";
|
|
5
|
+
import UBadge from "../ui.text-badge";
|
|
3
6
|
|
|
4
7
|
import { useLoaderTop } from "./composables/useLoaderTop";
|
|
5
8
|
import { loaderTopOff, loaderTopOn } from "./services/loaderTop.service";
|
|
@@ -11,7 +14,7 @@ import { getArgTypes } from "../service.storybook";
|
|
|
11
14
|
*/
|
|
12
15
|
export default {
|
|
13
16
|
id: "9020",
|
|
14
|
-
title: "Loaders and Skeletons / Loader
|
|
17
|
+
title: "Loaders and Skeletons / Loader Top",
|
|
15
18
|
component: ULoaderTop,
|
|
16
19
|
argTypes: {
|
|
17
20
|
...getArgTypes(ULoaderTop.name),
|
|
@@ -19,26 +22,24 @@ export default {
|
|
|
19
22
|
};
|
|
20
23
|
|
|
21
24
|
const DefaultTemplate = (args) => ({
|
|
22
|
-
components: { ULoaderTop, UButton },
|
|
25
|
+
components: { ULoaderTop, UButton, URow },
|
|
23
26
|
setup() {
|
|
24
27
|
const { loaderTopOn, loaderTopOff } = useLoaderTop();
|
|
25
28
|
|
|
26
29
|
return { args, loaderTopOn, loaderTopOff };
|
|
27
30
|
},
|
|
28
31
|
template: `
|
|
29
|
-
<
|
|
30
|
-
<ULoaderTop color="blue" v-bind="args" resource-names="https://api.publicapis.org/entries"/>
|
|
32
|
+
<ULoaderTop color="blue" v-bind="args" resources="https://api.publicapis.org/entries"/>
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
</div>
|
|
34
|
+
<URow gap="sm">
|
|
35
|
+
<UButton label="On" size="sm" @click="loaderTopOn('https://api.publicapis.org/entries')" />
|
|
36
|
+
<UButton label="Off" size="sm" @click="loaderTopOff('https://api.publicapis.org/entries')" />
|
|
37
|
+
</URow>
|
|
37
38
|
`,
|
|
38
39
|
});
|
|
39
40
|
|
|
40
41
|
const ColorsTemplate = (args, { argTypes } = {}) => ({
|
|
41
|
-
components: { ULoaderTop, UButton },
|
|
42
|
+
components: { ULoaderTop, UButton, UGroup, URow, UBadge },
|
|
42
43
|
setup() {
|
|
43
44
|
return {
|
|
44
45
|
args,
|
|
@@ -48,19 +49,23 @@ const ColorsTemplate = (args, { argTypes } = {}) => ({
|
|
|
48
49
|
};
|
|
49
50
|
},
|
|
50
51
|
template: `
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
<UGroup>
|
|
53
|
+
<URow gap="sm" class="pb-4">
|
|
54
|
+
<UButton label="On" size="sm" @click="loaderTopOn('https://api.publicapis.org/images')" />
|
|
55
|
+
<UButton label="Off" size="sm" @click="loaderTopOff('https://api.publicapis.org/images')" />
|
|
56
|
+
</URow>
|
|
57
|
+
|
|
58
|
+
<URow align="center" v-for="(color, index) in colors" :key="index">
|
|
59
|
+
<UBadge :label="color" :color="color" />
|
|
60
|
+
<ULoaderTop
|
|
61
|
+
resources="https://api.publicapis.org/images"
|
|
62
|
+
class="static"
|
|
63
|
+
:color="color"
|
|
64
|
+
v-bind="args"
|
|
65
|
+
/>
|
|
66
|
+
</URow>
|
|
67
|
+
|
|
68
|
+
</UGroup>
|
|
64
69
|
`,
|
|
65
70
|
});
|
|
66
71
|
|
package/ui.loader-top/index.vue
CHANGED
|
@@ -19,14 +19,6 @@ import { useAttrs } from "./composables/attrs.composable";
|
|
|
19
19
|
defineOptions({ name: "ULoaderTop", inheritAttrs: false });
|
|
20
20
|
|
|
21
21
|
const props = defineProps({
|
|
22
|
-
/**
|
|
23
|
-
* The name of API resource (endpoint URI).
|
|
24
|
-
*/
|
|
25
|
-
resourceNames: {
|
|
26
|
-
type: [String, Array],
|
|
27
|
-
default: "",
|
|
28
|
-
},
|
|
29
|
-
|
|
30
22
|
/**
|
|
31
23
|
* The color of the loader stripe.
|
|
32
24
|
* @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose, white
|
|
@@ -35,6 +27,14 @@ const props = defineProps({
|
|
|
35
27
|
type: String,
|
|
36
28
|
default: UIService.get(defaultConfig, ULoaderTop).default.color,
|
|
37
29
|
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* API resource names (endpoint URIs).
|
|
33
|
+
*/
|
|
34
|
+
resources: {
|
|
35
|
+
type: [String, Array],
|
|
36
|
+
default: "",
|
|
37
|
+
},
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
const error = ref(false);
|
|
@@ -44,13 +44,13 @@ const opacity = ref(1);
|
|
|
44
44
|
const status = ref(null);
|
|
45
45
|
|
|
46
46
|
const {
|
|
47
|
-
loaderRequestQueue,
|
|
48
47
|
isLoading,
|
|
49
|
-
|
|
48
|
+
requestQueue,
|
|
49
|
+
loaderTopOn,
|
|
50
|
+
loaderTopOff,
|
|
51
|
+
loaderRequestQueue,
|
|
50
52
|
setComponentRequestQueue,
|
|
51
53
|
removeComponentRequestQueue,
|
|
52
|
-
loaderTopOff,
|
|
53
|
-
loaderTopOn,
|
|
54
54
|
} = useLoaderTop();
|
|
55
55
|
const { progressAttrs } = useAttrs(props, { error, isMobileApp });
|
|
56
56
|
|
|
@@ -66,13 +66,13 @@ const barStyle = computed(() => {
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
const resourceNamesArray = computed(() => {
|
|
69
|
-
return Array.isArray(props.
|
|
69
|
+
return Array.isArray(props.resources) ? [...props.resources] : [props.resources];
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
watch(
|
|
72
|
+
watch(requestQueue, onChangeRequestsQueue, { deep: true });
|
|
73
73
|
watch(isLoading, onChangeLoadingState, { deep: true });
|
|
74
74
|
|
|
75
|
-
if (props.
|
|
75
|
+
if (props.resources) {
|
|
76
76
|
setComponentRequestQueue(resourceNamesArray.value);
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -82,7 +82,7 @@ onMounted(() => {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
onBeforeUnmount(() => {
|
|
85
|
-
if (props.
|
|
85
|
+
if (props.resources) {
|
|
86
86
|
removeComponentRequestQueue();
|
|
87
87
|
}
|
|
88
88
|
});
|
|
@@ -107,7 +107,7 @@ function requestWithoutQuery(request) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
function onChangeLoadingState() {
|
|
110
|
-
if (!props.
|
|
110
|
+
if (!props.resources && isStarted.value && show.value && !isLoading.value) {
|
|
111
111
|
done();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -115,10 +115,10 @@ function onChangeLoadingState() {
|
|
|
115
115
|
function onChangeRequestsQueue() {
|
|
116
116
|
let isActiveRequests = false;
|
|
117
117
|
|
|
118
|
-
if (props.
|
|
118
|
+
if (props.resources) {
|
|
119
119
|
resourceNamesArray.value.forEach((item) => {
|
|
120
120
|
if (!isActiveRequests) {
|
|
121
|
-
const activeRequest =
|
|
121
|
+
const activeRequest = requestQueue.value.find(
|
|
122
122
|
(request) => requestWithoutQuery(request) === item,
|
|
123
123
|
);
|
|
124
124
|
|
|
@@ -132,8 +132,8 @@ function onChangeRequestsQueue() {
|
|
|
132
132
|
done();
|
|
133
133
|
}
|
|
134
134
|
} else {
|
|
135
|
-
|
|
136
|
-
const activeRequest =
|
|
135
|
+
requestQueue.value.forEach((item) => {
|
|
136
|
+
const activeRequest = loaderRequestQueue.value.find(
|
|
137
137
|
(request) => request === requestWithoutQuery(item),
|
|
138
138
|
);
|
|
139
139
|
|