vueless 0.0.13 → 0.0.15
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/README.md +33 -152
- package/package.json +2 -5
- package/preset.tailwind/index.js +95 -0
- package/service.storybook/index.js +1 -1
- package/service.ui/index.js +1 -1
- package/ui.button/index.vue +16 -3
- package/ui.button-link/index.vue +6 -3
- package/ui.container-page/configs/default.config.js +1 -1
- package/ui.data-table-cell/configs/default.config.js +2 -2
- package/ui.dropdown-badge/index.vue +11 -1
- package/ui.dropdown-button/index.vue +14 -2
- package/ui.dropdown-link/index.vue +11 -1
- package/ui.form-calendar/configs/default.config.js +1 -1
- package/ui.form-checkbox/index.vue +1 -1
- package/ui.form-color-picker/index.vue +1 -1
- package/ui.form-date-picker-range/configs/default.config.js +4 -4
- package/ui.form-input/configs/default.config.js +1 -1
- package/ui.form-input/index.vue +5 -8
- package/ui.form-input-file/configs/default.config.js +1 -1
- package/ui.form-input-file/index.vue +4 -8
- package/ui.form-input-rating/configs/default.config.js +1 -1
- package/ui.form-input-rating/index.vue +3 -7
- package/ui.form-label/configs/default.config.js +2 -0
- package/ui.form-label/index.vue +3 -3
- package/ui.form-radio/index.vue +5 -3
- package/ui.form-radio-card/composables/attrs.composable.js +3 -1
- package/ui.form-radio-card/configs/default.config.js +8 -2
- package/ui.form-radio-card/index.vue +26 -40
- package/ui.form-select/configs/default.config.js +3 -3
- package/ui.form-select/index.vue +7 -18
- package/ui.form-switch/index.vue +1 -1
- package/ui.form-textarea/index.vue +2 -2
- package/ui.navigation-stepper/index.vue +1 -1
- package/ui.notify/index.vue +3 -3
- package/ui.other-loader-top/composables/attrs.composable.js +32 -0
- package/ui.other-loader-top/configs/default.config.js +20 -0
- package/ui.other-loader-top/constants/index.js +8 -0
- package/ui.other-loader-top/index.vue +230 -0
- package/ui.other-loader-top/services/loaderTop.service.js +31 -0
- package/ui.text-badge/index.vue +7 -0
- package/web-types.json +36 -132
- package/service.tailwind/index.js +0 -103
- package/ui.loader-top/components/TopProgress.vue +0 -277
- package/ui.loader-top/index.vue +0 -221
- /package/{ui.loader-top → ui.other-loader-top}/store/index.js +0 -0
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<transition :css="false" @beforeEnter="beforeEnter" @enter="enter" @afterEnter="afterEnter">
|
|
3
|
-
<div v-if="show" class="top-progress" :style="barStyle">
|
|
4
|
-
<div class="peg" :style="pegStyle"></div>
|
|
5
|
-
</div>
|
|
6
|
-
</transition>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
function clamp(n, min, max) {
|
|
11
|
-
if (n < min) {
|
|
12
|
-
return min;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (n > max) {
|
|
16
|
-
return max;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return n;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let queue = (() => {
|
|
23
|
-
let pending = [];
|
|
24
|
-
|
|
25
|
-
function next() {
|
|
26
|
-
let fn = pending.shift();
|
|
27
|
-
|
|
28
|
-
if (fn) {
|
|
29
|
-
fn(next);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return (fn) => {
|
|
34
|
-
pending.push(fn);
|
|
35
|
-
|
|
36
|
-
if (pending.length === 1) {
|
|
37
|
-
next();
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
|
|
42
|
-
export default {
|
|
43
|
-
name: "VueTopprogress",
|
|
44
|
-
|
|
45
|
-
props: {
|
|
46
|
-
speed: {
|
|
47
|
-
type: Number,
|
|
48
|
-
default: 150,
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
color: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: "#29d",
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
colorShadow: {
|
|
57
|
-
type: String,
|
|
58
|
-
default: "",
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
errorColor: {
|
|
62
|
-
type: String,
|
|
63
|
-
default: "#f44336",
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
trickle: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: true,
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
trickleSpeed: {
|
|
72
|
-
type: Number,
|
|
73
|
-
default: 100,
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
easing: {
|
|
77
|
-
type: String,
|
|
78
|
-
default: "linear",
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
height: {
|
|
82
|
-
type: Number,
|
|
83
|
-
default: 3,
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
minimum: {
|
|
87
|
-
type: Number,
|
|
88
|
-
default: 0.8,
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
maximum: {
|
|
92
|
-
type: Number,
|
|
93
|
-
default: 97.5,
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
zIndex: {
|
|
97
|
-
type: Number,
|
|
98
|
-
default: 9999,
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
data() {
|
|
103
|
-
return {
|
|
104
|
-
error: false,
|
|
105
|
-
show: false,
|
|
106
|
-
progress: 0,
|
|
107
|
-
opacity: 1,
|
|
108
|
-
status: null,
|
|
109
|
-
isPaused: false,
|
|
110
|
-
};
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
computed: {
|
|
114
|
-
progressColor() {
|
|
115
|
-
return this.error ? this.errorColor : this.color;
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
isStarted() {
|
|
119
|
-
return typeof this.status === "number";
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
boxShadow() {
|
|
123
|
-
return this.colorShadow || this.progressColor;
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
barStyle() {
|
|
127
|
-
return {
|
|
128
|
-
position: "fixed",
|
|
129
|
-
top: "0",
|
|
130
|
-
left: "0",
|
|
131
|
-
right: "0",
|
|
132
|
-
width: `${this.progress}%`,
|
|
133
|
-
height: `${this.height}px`,
|
|
134
|
-
backgroundColor: this.progressColor,
|
|
135
|
-
transition: `all ${this.speed}ms ${this.easing}`,
|
|
136
|
-
opacity: `${this.opacity}`,
|
|
137
|
-
zIndex: `${this.zIndex}`,
|
|
138
|
-
};
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
pegStyle() {
|
|
142
|
-
return {
|
|
143
|
-
display: "block",
|
|
144
|
-
position: "absolute",
|
|
145
|
-
right: "0",
|
|
146
|
-
width: "100px",
|
|
147
|
-
height: "100%",
|
|
148
|
-
opacity: this.progress ? "1" : "0",
|
|
149
|
-
boxShadow: `0 0 10px ${this.boxShadow}, 0 0 5px ${this.boxShadow}`,
|
|
150
|
-
transform: "rotate(3deg) translate(0px, -4px)",
|
|
151
|
-
};
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
methods: {
|
|
156
|
-
beforeEnter() {
|
|
157
|
-
this.opacity = 0;
|
|
158
|
-
this.progress = 0;
|
|
159
|
-
this.width = 0;
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
enter(el, done) {
|
|
163
|
-
this.opacity = 1;
|
|
164
|
-
done();
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
afterEnter() {
|
|
168
|
-
this._runStart();
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
_work() {
|
|
172
|
-
setTimeout(() => {
|
|
173
|
-
if (!this.isStarted || this.isPaused) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
this.increase();
|
|
178
|
-
this._work();
|
|
179
|
-
}, this.trickleSpeed);
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
_runStart() {
|
|
183
|
-
this.status = this.progress === 100 ? null : this.progress;
|
|
184
|
-
|
|
185
|
-
if (this.trickle) {
|
|
186
|
-
this._work();
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
start() {
|
|
191
|
-
this.isPaused = false;
|
|
192
|
-
|
|
193
|
-
if (this.show) {
|
|
194
|
-
this._runStart();
|
|
195
|
-
} else {
|
|
196
|
-
this.show = true;
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
set(amount) {
|
|
201
|
-
this.isPaused = false;
|
|
202
|
-
|
|
203
|
-
let o;
|
|
204
|
-
|
|
205
|
-
if (this.isStarted) {
|
|
206
|
-
o = amount < this.progress ? clamp(amount, 0, 100) : clamp(amount, this.minimum, 100);
|
|
207
|
-
} else {
|
|
208
|
-
o = 0;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
this.status = o === 100 ? null : o;
|
|
212
|
-
|
|
213
|
-
queue((next) => {
|
|
214
|
-
this.progress = o;
|
|
215
|
-
|
|
216
|
-
if (o === 100) {
|
|
217
|
-
setTimeout(() => {
|
|
218
|
-
this.opacity = 0;
|
|
219
|
-
setTimeout(() => {
|
|
220
|
-
this.show = false;
|
|
221
|
-
this.error = false;
|
|
222
|
-
next();
|
|
223
|
-
}, this.speed);
|
|
224
|
-
}, this.speed);
|
|
225
|
-
} else {
|
|
226
|
-
setTimeout(next, this.speed);
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
increase(amount) {
|
|
232
|
-
let o = this.progress;
|
|
233
|
-
|
|
234
|
-
if (o < 100 && typeof amount !== "number") {
|
|
235
|
-
if (o >= 0 && o < 25) {
|
|
236
|
-
amount = Math.random() * 3 + 3;
|
|
237
|
-
} else if (o >= 25 && o < 50) {
|
|
238
|
-
amount = Math.random() * 3;
|
|
239
|
-
} else if (o >= 50 && o < 85) {
|
|
240
|
-
amount = Math.random() * 2;
|
|
241
|
-
} else if (o >= 85 && o < 99) {
|
|
242
|
-
amount = 0.5;
|
|
243
|
-
} else {
|
|
244
|
-
amount = 0;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
this.set(clamp(o + amount, 0, this.maximum));
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
decrease(amount) {
|
|
252
|
-
if (this.progress === 0) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
this.increase(-amount);
|
|
257
|
-
},
|
|
258
|
-
|
|
259
|
-
done() {
|
|
260
|
-
this.set(100);
|
|
261
|
-
},
|
|
262
|
-
|
|
263
|
-
getProgress() {
|
|
264
|
-
return this.status ? this.progress : 0;
|
|
265
|
-
},
|
|
266
|
-
|
|
267
|
-
pause() {
|
|
268
|
-
this.isPaused = true;
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
fail() {
|
|
272
|
-
this.error = true;
|
|
273
|
-
this.done();
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
};
|
|
277
|
-
</script>
|
package/ui.loader-top/index.vue
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<TopProgress
|
|
3
|
-
ref="topProgress"
|
|
4
|
-
:color="loaderColor"
|
|
5
|
-
class="vueless-top-loader"
|
|
6
|
-
:class="topLoaderClasses"
|
|
7
|
-
/>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
import { mapGetters, mapMutations, mapState } from "vuex";
|
|
12
|
-
import { globalComponentConfig, isMobileApp } from "../service.ui";
|
|
13
|
-
|
|
14
|
-
import TopProgress from "./components/TopProgress.vue";
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
name: "ULoaderTop",
|
|
18
|
-
components: {
|
|
19
|
-
TopProgress,
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
props: {
|
|
23
|
-
/**
|
|
24
|
-
* The name of API resource (endpoint URI).
|
|
25
|
-
*/
|
|
26
|
-
resourceNames: {
|
|
27
|
-
type: [String, Array],
|
|
28
|
-
default: "",
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The z-list of the loader stripe.
|
|
33
|
-
* @values auto, 50, 100
|
|
34
|
-
*/
|
|
35
|
-
zIndex: {
|
|
36
|
-
type: String,
|
|
37
|
-
default: "auto",
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Loader position.
|
|
42
|
-
* @values fixed, absolute, relative
|
|
43
|
-
*/
|
|
44
|
-
position: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: "fixed",
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The color of the loader stripe.
|
|
51
|
-
* @values gray, red, orange, yellow, green, blue, violet, fuchsia
|
|
52
|
-
*/
|
|
53
|
-
color: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: globalComponentConfig.ULoaderTop?.color,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
computed: {
|
|
60
|
-
...mapState("loaderTop", ["loaderRequestQueue", "componentLoaderRequestQueue", "isLoading"]),
|
|
61
|
-
...mapGetters({ hexColor: globalComponentConfig.ULoaderTop?.colorGetter }),
|
|
62
|
-
|
|
63
|
-
loaderColor() {
|
|
64
|
-
const isExistHexColorGetter = globalComponentConfig.ULoaderTop?.colorGetter;
|
|
65
|
-
|
|
66
|
-
const color = isExistHexColorGetter ? this.hexColor : this.color;
|
|
67
|
-
//const colorSet = tailwindConfig.theme.colors[this.color];
|
|
68
|
-
//const colorNumber = 500;
|
|
69
|
-
|
|
70
|
-
const colorHexRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
71
|
-
const isColorHex = colorHexRegex.test(color);
|
|
72
|
-
|
|
73
|
-
// TODO: Remove comments after refactoring
|
|
74
|
-
// if (!isColorHex && !colorSet) {
|
|
75
|
-
// return "blue";
|
|
76
|
-
// }
|
|
77
|
-
|
|
78
|
-
return isColorHex ? color : "RoyalBlue";
|
|
79
|
-
|
|
80
|
-
//return isColorHex ? color : colorSet[colorNumber];
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
resourceNamesArray() {
|
|
84
|
-
return Array.isArray(this.resourceNames) ? [...this.resourceNames] : [this.resourceNames];
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
topLoaderClasses() {
|
|
88
|
-
const zIndex = {
|
|
89
|
-
auto: "vueless-top-loader-z-auto",
|
|
90
|
-
50: "vueless-top-loader-z-50",
|
|
91
|
-
100: "vueless-top-loader-z-100",
|
|
92
|
-
};
|
|
93
|
-
const position = `vueless-top-loader-position-${this.position}`;
|
|
94
|
-
const mobileApp = isMobileApp ? "vueless-top-loader-mobile-app" : "";
|
|
95
|
-
|
|
96
|
-
return [zIndex[this.zIndex], position, mobileApp];
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
watch: {
|
|
101
|
-
loaderRequestQueue: {
|
|
102
|
-
deep: true,
|
|
103
|
-
handler: "onChangeRequestsQuare",
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
isLoading: {
|
|
107
|
-
deep: true,
|
|
108
|
-
handler: "onChangeLoadingState",
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
created() {
|
|
113
|
-
if (this.resourceNames) {
|
|
114
|
-
this.SET_COMPONENT_REQUEST_QUEUE(this.resourceNamesArray);
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
beforeUnmount() {
|
|
119
|
-
if (this.resourceNames) {
|
|
120
|
-
this.REMOVE_COMPONENT_REQUEST_QUEUE();
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
methods: {
|
|
125
|
-
...mapMutations("loaderTop", ["SET_COMPONENT_REQUEST_QUEUE", "REMOVE_COMPONENT_REQUEST_QUEUE"]),
|
|
126
|
-
|
|
127
|
-
requestWithoutQuery(request) {
|
|
128
|
-
const [requestWithoutQuery] = request.split("?");
|
|
129
|
-
|
|
130
|
-
return requestWithoutQuery;
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
onChangeLoadingState() {
|
|
134
|
-
if (!this.$refs.topProgress) return;
|
|
135
|
-
|
|
136
|
-
if (
|
|
137
|
-
!this.resourceNames &&
|
|
138
|
-
this.$refs.topProgress.isStarted &&
|
|
139
|
-
this.$refs.topProgress.show &&
|
|
140
|
-
!this.isLoading
|
|
141
|
-
) {
|
|
142
|
-
this.$refs.topProgress.done();
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
onChangeRequestsQuare() {
|
|
147
|
-
if (!this.$refs.topProgress) return;
|
|
148
|
-
|
|
149
|
-
let isActiveRequests = false;
|
|
150
|
-
|
|
151
|
-
if (this.resourceNames) {
|
|
152
|
-
this.resourceNamesArray.forEach((item) => {
|
|
153
|
-
if (!isActiveRequests) {
|
|
154
|
-
const activeRequest = this.loaderRequestQueue.find(
|
|
155
|
-
(request) => this.requestWithoutQuery(request) === item,
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
isActiveRequests = !!activeRequest;
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
if (isActiveRequests && !this.$refs.topProgress.isStarted) {
|
|
163
|
-
this.$refs.topProgress.start();
|
|
164
|
-
} else if (
|
|
165
|
-
!isActiveRequests &&
|
|
166
|
-
this.$refs.topProgress.isStarted &&
|
|
167
|
-
this.$refs.topProgress.show
|
|
168
|
-
) {
|
|
169
|
-
this.$refs.topProgress.done();
|
|
170
|
-
}
|
|
171
|
-
} else {
|
|
172
|
-
this.loaderRequestQueue.forEach((item) => {
|
|
173
|
-
const activeRequest = this.componentLoaderRequestQueue.find(
|
|
174
|
-
(request) => request === this.requestWithoutQuery(item),
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
isActiveRequests = !activeRequest;
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
if (this.isLoading && isActiveRequests && !this.$refs.topProgress.isStarted) {
|
|
181
|
-
this.$refs.topProgress.start();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
</script>
|
|
188
|
-
|
|
189
|
-
<style lang="postcss" scoped>
|
|
190
|
-
.vueless-top-loader {
|
|
191
|
-
&-position {
|
|
192
|
-
&-fixed {
|
|
193
|
-
@apply !fixed;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
&-absolute {
|
|
197
|
-
@apply !absolute;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
&-z-auto {
|
|
202
|
-
@apply !z-auto;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
&-z-50 {
|
|
206
|
-
@apply !z-50;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
&-z-100 {
|
|
210
|
-
@apply !z-[100];
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
&-mobile-app {
|
|
214
|
-
@apply mt-safe-top mx-3 rounded max-w-[calc(100%-1.5rem)];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
&:deep(.peg) {
|
|
218
|
-
@apply !hidden;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
</style>
|
|
File without changes
|