@antify/ui 2.5.7 → 3.1.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/dist/components/AntAccordion.vue +5 -6
- package/dist/components/AntAccordionItem.vue +5 -7
- package/dist/components/AntAlert.vue +53 -54
- package/dist/components/AntButton.vue +60 -62
- package/dist/components/AntCard.vue +10 -11
- package/dist/components/AntIcon.vue +8 -8
- package/dist/components/AntKeycap.vue +15 -15
- package/dist/components/AntListGroup.vue +10 -10
- package/dist/components/AntModal.vue +5 -5
- package/dist/components/AntPagination.vue +38 -40
- package/dist/components/AntSkeleton.vue +5 -25
- package/dist/components/AntToast.vue +6 -6
- package/dist/components/AntToaster.vue +42 -15
- package/dist/components/__stories/AntListGroup.stories.js +6 -9
- package/dist/components/__stories/AntListGroup.stories.mjs +6 -9
- package/dist/components/__stories/AntListGroupItem.stories.js +1 -1
- package/dist/components/__stories/AntListGroupItem.stories.mjs +1 -1
- package/dist/components/__stories/AntToaster.stories.js +2 -2
- package/dist/components/__stories/AntToaster.stories.mjs +2 -2
- package/dist/components/inputs/AntCheckbox.vue +8 -9
- package/dist/components/inputs/AntColorInput/AntColorInput.vue +5 -10
- package/dist/components/inputs/AntImageInput.vue +34 -36
- package/dist/components/inputs/AntRadio.vue +8 -9
- package/dist/components/inputs/AntSelect.vue +64 -63
- package/dist/components/inputs/AntSwitch.vue +26 -27
- package/dist/components/inputs/AntSwitcher.vue +12 -11
- package/dist/components/inputs/AntTagInput.vue +6 -10
- package/dist/components/inputs/AntTextarea.vue +5 -9
- package/dist/components/inputs/Elements/AntBaseInput.vue +60 -60
- package/dist/components/inputs/__stories/AntCheckbox.stories.js +41 -14
- package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +41 -14
- package/dist/components/table/AntTable.vue +11 -7
- package/dist/components/table/AntTableSkeleton.vue +5 -1
- package/dist/components/tabs/AntTabItem.vue +5 -7
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.js +11 -0
- package/dist/composables/index.mjs +1 -0
- package/dist/composables/useFlickerProtection.d.ts +22 -0
- package/dist/composables/useFlickerProtection.js +48 -0
- package/dist/composables/useFlickerProtection.mjs +48 -0
- package/dist/composables/useToaster.d.ts +1 -0
- package/dist/composables/useToaster.js +7 -4
- package/dist/composables/useToaster.mjs +7 -4
- package/package.json +1 -1
|
@@ -89,6 +89,7 @@ export const Summary = {
|
|
|
89
89
|
<AntFormGroup direction="row">
|
|
90
90
|
<AntCheckbox
|
|
91
91
|
v-model="offValue"
|
|
92
|
+
v-bind="args"
|
|
92
93
|
class="w-28"
|
|
93
94
|
:state="InputState.base"
|
|
94
95
|
label="Label"
|
|
@@ -97,6 +98,7 @@ export const Summary = {
|
|
|
97
98
|
/>
|
|
98
99
|
<AntCheckbox
|
|
99
100
|
v-model="offValue"
|
|
101
|
+
v-bind="args"
|
|
100
102
|
class="w-28"
|
|
101
103
|
:state="InputState.info"
|
|
102
104
|
label="Label"
|
|
@@ -105,6 +107,7 @@ export const Summary = {
|
|
|
105
107
|
/>
|
|
106
108
|
<AntCheckbox
|
|
107
109
|
v-model="offValue"
|
|
110
|
+
v-bind="args"
|
|
108
111
|
class="w-28"
|
|
109
112
|
:state="InputState.success"
|
|
110
113
|
label="Label"
|
|
@@ -113,6 +116,7 @@ export const Summary = {
|
|
|
113
116
|
/>
|
|
114
117
|
<AntCheckbox
|
|
115
118
|
v-model="offValue"
|
|
119
|
+
v-bind="args"
|
|
116
120
|
class="w-28"
|
|
117
121
|
:state="InputState.warning"
|
|
118
122
|
label="Label"
|
|
@@ -121,6 +125,7 @@ export const Summary = {
|
|
|
121
125
|
/>
|
|
122
126
|
<AntCheckbox
|
|
123
127
|
v-model="offValue"
|
|
128
|
+
v-bind="args"
|
|
124
129
|
class="w-28"
|
|
125
130
|
:state="InputState.danger"
|
|
126
131
|
label="Label"
|
|
@@ -133,6 +138,7 @@ export const Summary = {
|
|
|
133
138
|
<AntFormGroup direction="row">
|
|
134
139
|
<AntCheckbox
|
|
135
140
|
v-model="onValue"
|
|
141
|
+
v-bind="args"
|
|
136
142
|
class="w-28"
|
|
137
143
|
:state="InputState.base"
|
|
138
144
|
label="Label"
|
|
@@ -141,6 +147,7 @@ export const Summary = {
|
|
|
141
147
|
/>
|
|
142
148
|
<AntCheckbox
|
|
143
149
|
v-model="onValue"
|
|
150
|
+
v-bind="args"
|
|
144
151
|
class="w-28"
|
|
145
152
|
:state="InputState.info"
|
|
146
153
|
label="Label"
|
|
@@ -149,6 +156,7 @@ export const Summary = {
|
|
|
149
156
|
/>
|
|
150
157
|
<AntCheckbox
|
|
151
158
|
v-model="onValue"
|
|
159
|
+
v-bind="args"
|
|
152
160
|
class="w-28"
|
|
153
161
|
:state="InputState.success"
|
|
154
162
|
label="Label"
|
|
@@ -157,6 +165,7 @@ export const Summary = {
|
|
|
157
165
|
/>
|
|
158
166
|
<AntCheckbox
|
|
159
167
|
v-model="onValue"
|
|
168
|
+
v-bind="args"
|
|
160
169
|
class="w-28"
|
|
161
170
|
:state="InputState.warning"
|
|
162
171
|
label="Label"
|
|
@@ -165,6 +174,7 @@ export const Summary = {
|
|
|
165
174
|
/>
|
|
166
175
|
<AntCheckbox
|
|
167
176
|
v-model="onValue"
|
|
177
|
+
v-bind="args"
|
|
168
178
|
class="w-28"
|
|
169
179
|
:state="InputState.danger"
|
|
170
180
|
label="Label"
|
|
@@ -177,6 +187,7 @@ export const Summary = {
|
|
|
177
187
|
<AntFormGroup direction="row">
|
|
178
188
|
<AntCheckbox
|
|
179
189
|
v-model="offValue"
|
|
190
|
+
v-bind="args"
|
|
180
191
|
class="w-28"
|
|
181
192
|
:size="Size.lg"
|
|
182
193
|
label="Label"
|
|
@@ -184,6 +195,7 @@ export const Summary = {
|
|
|
184
195
|
/>
|
|
185
196
|
<AntCheckbox
|
|
186
197
|
v-model="onValue"
|
|
198
|
+
v-bind="args"
|
|
187
199
|
class="w-28"
|
|
188
200
|
:size="Size.lg"
|
|
189
201
|
label="Label"
|
|
@@ -191,6 +203,7 @@ export const Summary = {
|
|
|
191
203
|
/>
|
|
192
204
|
<AntCheckbox
|
|
193
205
|
v-model="offValue"
|
|
206
|
+
v-bind="args"
|
|
194
207
|
class="w-28"
|
|
195
208
|
:size="Size.md"
|
|
196
209
|
label="Label"
|
|
@@ -198,6 +211,7 @@ export const Summary = {
|
|
|
198
211
|
/>
|
|
199
212
|
<AntCheckbox
|
|
200
213
|
v-model="onValue"
|
|
214
|
+
v-bind="args"
|
|
201
215
|
class="w-28"
|
|
202
216
|
:size="Size.md"
|
|
203
217
|
label="Label"
|
|
@@ -205,6 +219,7 @@ export const Summary = {
|
|
|
205
219
|
/>
|
|
206
220
|
<AntCheckbox
|
|
207
221
|
v-model="offValue"
|
|
222
|
+
v-bind="args"
|
|
208
223
|
class="w-28"
|
|
209
224
|
:size="Size.sm"
|
|
210
225
|
label="Label"
|
|
@@ -212,6 +227,7 @@ export const Summary = {
|
|
|
212
227
|
/>
|
|
213
228
|
<AntCheckbox
|
|
214
229
|
v-model="onValue"
|
|
230
|
+
v-bind="args"
|
|
215
231
|
class="w-28"
|
|
216
232
|
:size="Size.sm"
|
|
217
233
|
label="Label"
|
|
@@ -219,6 +235,7 @@ export const Summary = {
|
|
|
219
235
|
/>
|
|
220
236
|
<AntCheckbox
|
|
221
237
|
v-model="offValue"
|
|
238
|
+
v-bind="args"
|
|
222
239
|
class="w-28"
|
|
223
240
|
:size="Size.xs"
|
|
224
241
|
label="Label"
|
|
@@ -226,6 +243,7 @@ export const Summary = {
|
|
|
226
243
|
/>
|
|
227
244
|
<AntCheckbox
|
|
228
245
|
v-model="onValue"
|
|
246
|
+
v-bind="args"
|
|
229
247
|
class="w-28"
|
|
230
248
|
:size="Size.xs"
|
|
231
249
|
label="Label"
|
|
@@ -233,6 +251,7 @@ export const Summary = {
|
|
|
233
251
|
/>
|
|
234
252
|
<AntCheckbox
|
|
235
253
|
v-model="offValue"
|
|
254
|
+
v-bind="args"
|
|
236
255
|
class="w-28"
|
|
237
256
|
:size="Size.xs2"
|
|
238
257
|
label="Label"
|
|
@@ -240,6 +259,7 @@ export const Summary = {
|
|
|
240
259
|
/>
|
|
241
260
|
<AntCheckbox
|
|
242
261
|
v-model="onValue"
|
|
262
|
+
v-bind="args"
|
|
243
263
|
class="w-28"
|
|
244
264
|
:size="Size.xs"
|
|
245
265
|
label="Label"
|
|
@@ -252,6 +272,7 @@ export const Summary = {
|
|
|
252
272
|
<AntFormGroup direction="row">
|
|
253
273
|
<AntCheckbox
|
|
254
274
|
v-model="offValue"
|
|
275
|
+
v-bind="args"
|
|
255
276
|
class="w-28"
|
|
256
277
|
label="Label"
|
|
257
278
|
description="Lorem ipsum dolor sit amet."
|
|
@@ -261,6 +282,7 @@ export const Summary = {
|
|
|
261
282
|
</AntCheckbox>
|
|
262
283
|
<AntCheckbox
|
|
263
284
|
v-model="onValue"
|
|
285
|
+
v-bind="args"
|
|
264
286
|
class="w-28"
|
|
265
287
|
label="Label"
|
|
266
288
|
description="Lorem ipsum dolor sit amet."
|
|
@@ -275,6 +297,7 @@ export const Summary = {
|
|
|
275
297
|
<AntFormGroup direction="row">
|
|
276
298
|
<AntCheckbox
|
|
277
299
|
v-model="offValue"
|
|
300
|
+
v-bind="args"
|
|
278
301
|
:readonly="true"
|
|
279
302
|
class="w-28"
|
|
280
303
|
label="Label"
|
|
@@ -284,6 +307,7 @@ export const Summary = {
|
|
|
284
307
|
</AntCheckbox>
|
|
285
308
|
<AntCheckbox
|
|
286
309
|
v-model="onValue"
|
|
310
|
+
v-bind="args"
|
|
287
311
|
:readonly="true"
|
|
288
312
|
class="w-28"
|
|
289
313
|
label="Label"
|
|
@@ -297,6 +321,7 @@ export const Summary = {
|
|
|
297
321
|
<AntFormGroupLabel>Skeleton</AntFormGroupLabel>
|
|
298
322
|
<AntCheckbox
|
|
299
323
|
v-model="offValue"
|
|
324
|
+
v-bind="args"
|
|
300
325
|
class="w-28"
|
|
301
326
|
label="Label"
|
|
302
327
|
description="Lorem ipsum dolor sit amet."
|
|
@@ -308,49 +333,50 @@ export const Summary = {
|
|
|
308
333
|
</AntFormGroup>
|
|
309
334
|
<AntFormGroupLabel>Plain</AntFormGroupLabel>
|
|
310
335
|
<AntFormGroup direction="row">
|
|
311
|
-
<AntCheckbox v-model="offValue"/>
|
|
312
|
-
<AntCheckbox v-model="onValue"/>
|
|
336
|
+
<AntCheckbox v-model="offValue" v-bind="args" />
|
|
337
|
+
<AntCheckbox v-model="onValue" v-bind="args" />
|
|
313
338
|
</AntFormGroup>
|
|
314
339
|
<AntFormGroupLabel>Label & label + value</AntFormGroupLabel>
|
|
315
340
|
<AntFormGroup direction="row">
|
|
316
|
-
<AntCheckbox v-model="offValue" label="Label"/>
|
|
317
|
-
<AntCheckbox v-model="onValue" label="Label"/>
|
|
318
|
-
<AntCheckbox v-model="offValue" label="Label">
|
|
341
|
+
<AntCheckbox v-model="offValue" v-bind="args" label="Label"/>
|
|
342
|
+
<AntCheckbox v-model="onValue" v-bind="args" label="Label"/>
|
|
343
|
+
<AntCheckbox v-model="offValue" v-bind="args" label="Label">
|
|
319
344
|
Value
|
|
320
345
|
</AntCheckbox>
|
|
321
|
-
<AntCheckbox v-model="onValue" label="Label">
|
|
346
|
+
<AntCheckbox v-model="onValue" v-bind="args" label="Label">
|
|
322
347
|
Value
|
|
323
348
|
</AntCheckbox>
|
|
324
349
|
</AntFormGroup>
|
|
325
350
|
<AntFormGroupLabel>Description & description + value</AntFormGroupLabel>
|
|
326
351
|
<AntFormGroup direction="row">
|
|
327
|
-
<AntCheckbox v-model="offValue" class="w-28" description="Lorem ipsum dolor sit amet"/>
|
|
328
|
-
<AntCheckbox v-model="onValue" class="w-28" description="Lorem ipsum dolor sit amet"/>
|
|
329
|
-
<AntCheckbox v-model="offValue" class="w-28" description="Lorem ipsum dolor sit amet">
|
|
352
|
+
<AntCheckbox v-model="offValue" v-bind="args" class="w-28" description="Lorem ipsum dolor sit amet"/>
|
|
353
|
+
<AntCheckbox v-model="onValue" v-bind="args" class="w-28" description="Lorem ipsum dolor sit amet"/>
|
|
354
|
+
<AntCheckbox v-model="offValue" v-bind="args" class="w-28" description="Lorem ipsum dolor sit amet">
|
|
330
355
|
Value
|
|
331
356
|
</AntCheckbox>
|
|
332
|
-
<AntCheckbox v-model="onValue" class="w-28" description="Lorem ipsum dolor sit amet">
|
|
357
|
+
<AntCheckbox v-model="onValue" v-bind="args" class="w-28" description="Lorem ipsum dolor sit amet">
|
|
333
358
|
Value
|
|
334
359
|
</AntCheckbox>
|
|
335
360
|
</AntFormGroup>
|
|
336
361
|
<AntFormGroupLabel>Content</AntFormGroupLabel>
|
|
337
362
|
<AntFormGroup direction="row">
|
|
338
|
-
<AntCheckbox v-model="offValue" class="w-28">
|
|
363
|
+
<AntCheckbox v-model="offValue" v-bind="args" class="w-28">
|
|
339
364
|
Value
|
|
340
365
|
</AntCheckbox>
|
|
341
|
-
<AntCheckbox v-model="onValue" class="w-28">
|
|
366
|
+
<AntCheckbox v-model="onValue" v-bind="args" class="w-28">
|
|
342
367
|
Value
|
|
343
368
|
</AntCheckbox>
|
|
344
369
|
</AntFormGroup>
|
|
345
370
|
<AntFormGroupLabel>Label & Description</AntFormGroupLabel>
|
|
346
371
|
<AntFormGroup direction="row">
|
|
347
|
-
<AntCheckbox v-model="offValue" class="w-28" description="Lorem ipsum dolor sit amet" label="Label"/>
|
|
348
|
-
<AntCheckbox v-model="onValue" class="w-28" description="Lorem ipsum dolor sit amet" label="Label"/>
|
|
372
|
+
<AntCheckbox v-model="offValue" v-bind="args" class="w-28" description="Lorem ipsum dolor sit amet" label="Label"/>
|
|
373
|
+
<AntCheckbox v-model="onValue" v-bind="args" class="w-28" description="Lorem ipsum dolor sit amet" label="Label"/>
|
|
349
374
|
</AntFormGroup>
|
|
350
375
|
<AntFormGroupLabel>Label & Description & Content</AntFormGroupLabel>
|
|
351
376
|
<AntFormGroup direction="row">
|
|
352
377
|
<AntCheckbox
|
|
353
378
|
v-model="offValue"
|
|
379
|
+
v-bind="args"
|
|
354
380
|
class="w-28"
|
|
355
381
|
description="Lorem ipsum dolor sit amet"
|
|
356
382
|
label="Label"
|
|
@@ -359,6 +385,7 @@ export const Summary = {
|
|
|
359
385
|
</AntCheckbox>
|
|
360
386
|
<AntCheckbox
|
|
361
387
|
v-model="onValue"
|
|
388
|
+
v-bind="args"
|
|
362
389
|
class="w-28"
|
|
363
390
|
description="Lorem ipsum dolor sit amet"
|
|
364
391
|
label="Label"
|
|
@@ -27,6 +27,9 @@ import {
|
|
|
27
27
|
import AntButton from '../AntButton.vue';
|
|
28
28
|
import AntIcon from '../AntIcon.vue';
|
|
29
29
|
import AntTableSkeleton from './AntTableSkeleton.vue';
|
|
30
|
+
import {
|
|
31
|
+
useFlickerProtection,
|
|
32
|
+
} from '../../composables/useFlickerProtection';
|
|
30
33
|
|
|
31
34
|
defineOptions({
|
|
32
35
|
inheritAttrs: false,
|
|
@@ -34,7 +37,6 @@ defineOptions({
|
|
|
34
37
|
|
|
35
38
|
const emits = defineEmits([
|
|
36
39
|
'update:modelValue',
|
|
37
|
-
'update:skeleton',
|
|
38
40
|
'update:selectedRow',
|
|
39
41
|
'rowClick',
|
|
40
42
|
'updateSort',
|
|
@@ -53,6 +55,7 @@ const props = withDefaults(defineProps<{
|
|
|
53
55
|
emptyStateText?: string;
|
|
54
56
|
collapseStrategy?: CollapseStrategy;
|
|
55
57
|
expandedRows?: boolean;
|
|
58
|
+
skeleton?: boolean;
|
|
56
59
|
}>(), {
|
|
57
60
|
rowKey: 'id',
|
|
58
61
|
loading: false,
|
|
@@ -63,11 +66,11 @@ const props = withDefaults(defineProps<{
|
|
|
63
66
|
emptyStateText: 'We couldn\'t find any entry',
|
|
64
67
|
collapseStrategy: CollapseStrategy.single,
|
|
65
68
|
expandedRows: false,
|
|
69
|
+
skeleton: false,
|
|
66
70
|
});
|
|
67
71
|
const slots = defineSlots();
|
|
68
72
|
const openItems = ref<number[]>([]);
|
|
69
73
|
const selected: Ref<Record<string, unknown> | undefined> = useVModel(props, 'selectedRow', emits);
|
|
70
|
-
const _loading: Ref<boolean> = useVModel(props, 'loading', emits);
|
|
71
74
|
const _showLightVersion = ref(props.showLightVersion);
|
|
72
75
|
const _headers = computed(() => {
|
|
73
76
|
// if (_showLightVersion.value) {
|
|
@@ -78,9 +81,10 @@ const _headers = computed(() => {
|
|
|
78
81
|
|
|
79
82
|
return props.headers;
|
|
80
83
|
});
|
|
84
|
+
const _skeleton = useFlickerProtection(computed(() => props.skeleton));
|
|
85
|
+
const _loading = useFlickerProtection(computed(() => props.loading));
|
|
81
86
|
|
|
82
87
|
const maxColSpan = computed(() => _headers.value.length + (hasSlotContent(slots['rowFirstCell']) ? 1 : 0) + (hasSlotContent(slots['rowLastCell']) ? 1 : 0));
|
|
83
|
-
const skeleton = computed(() => !props.data || props.data.length === 0 && _loading.value);
|
|
84
88
|
|
|
85
89
|
function sortTable(header: TableHeader, newDirection: AntTableSortDirection) {
|
|
86
90
|
// TODO:: Sorting is always done externally, here should only be a emit sort with header and direction.
|
|
@@ -180,7 +184,7 @@ onMounted(() => {
|
|
|
180
184
|
data-e2e="table"
|
|
181
185
|
>
|
|
182
186
|
<div
|
|
183
|
-
v-if="!
|
|
187
|
+
v-if="!_skeleton"
|
|
184
188
|
class="overflow-hidden h-full overflow-x-auto overflow-y-auto"
|
|
185
189
|
>
|
|
186
190
|
<table
|
|
@@ -307,7 +311,7 @@ onMounted(() => {
|
|
|
307
311
|
</template>
|
|
308
312
|
</template>
|
|
309
313
|
|
|
310
|
-
<tr v-if="data.length === 0
|
|
314
|
+
<tr v-if="data.length === 0">
|
|
311
315
|
<td
|
|
312
316
|
colspan="100"
|
|
313
317
|
class="w-full h-full py-2 text-center text-for-white-bg-font text-lg"
|
|
@@ -324,7 +328,7 @@ onMounted(() => {
|
|
|
324
328
|
</div>
|
|
325
329
|
|
|
326
330
|
<div
|
|
327
|
-
v-if="
|
|
331
|
+
v-if="_loading"
|
|
328
332
|
class="absolute w-full top-0 bottom-0 bg-base-300/50 flex items-center justify-center z-10"
|
|
329
333
|
>
|
|
330
334
|
<AntSpinner
|
|
@@ -334,7 +338,7 @@ onMounted(() => {
|
|
|
334
338
|
</div>
|
|
335
339
|
|
|
336
340
|
<AntTableSkeleton
|
|
337
|
-
|
|
341
|
+
:visible="_skeleton"
|
|
338
342
|
:headers="_headers"
|
|
339
343
|
:size="size"
|
|
340
344
|
:get-row-classes="getRowClasses"
|
|
@@ -7,6 +7,7 @@ import AntTh from './AntTh.vue';
|
|
|
7
7
|
import AntSkeleton from '../AntSkeleton.vue';
|
|
8
8
|
|
|
9
9
|
withDefaults(defineProps<{
|
|
10
|
+
visible: boolean;
|
|
10
11
|
headers: TableHeader[];
|
|
11
12
|
getRowClasses: (element: Record<string, unknown>, rowIndex: number) => {};
|
|
12
13
|
size?: AntTableSize;
|
|
@@ -20,7 +21,10 @@ withDefaults(defineProps<{
|
|
|
20
21
|
</script>
|
|
21
22
|
|
|
22
23
|
<template>
|
|
23
|
-
<div
|
|
24
|
+
<div
|
|
25
|
+
v-if="visible"
|
|
26
|
+
class="overflow-hidden h-full overflow-x-auto overflow-y-auto"
|
|
27
|
+
>
|
|
24
28
|
<table
|
|
25
29
|
class="min-w-full max-h-full relative"
|
|
26
30
|
>
|
|
@@ -122,14 +122,12 @@ const iconColor = computed(() => {
|
|
|
122
122
|
/>
|
|
123
123
|
</slot>
|
|
124
124
|
|
|
125
|
-
<
|
|
125
|
+
<AntSkeleton
|
|
126
|
+
:visible="skeleton"
|
|
127
|
+
rounded
|
|
128
|
+
>
|
|
126
129
|
<slot>{{ label }}</slot>
|
|
127
|
-
|
|
128
|
-
v-if="skeleton"
|
|
129
|
-
rounded
|
|
130
|
-
absolute
|
|
131
|
-
/>
|
|
132
|
-
</div>
|
|
130
|
+
</AntSkeleton>
|
|
133
131
|
|
|
134
132
|
<AntIcon
|
|
135
133
|
v-if="iconRight && showIcon"
|
|
@@ -13,4 +13,15 @@ Object.keys(_useToaster).forEach(function (key) {
|
|
|
13
13
|
return _useToaster[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
+
});
|
|
17
|
+
var _useFlickerProtection = require("./useFlickerProtection");
|
|
18
|
+
Object.keys(_useFlickerProtection).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _useFlickerProtection[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _useFlickerProtection[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
16
27
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Ref, type ComputedRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Add flicker protection to a ref or computed ref to ensure
|
|
4
|
+
* the value change is not too fast and does not cause flicker.
|
|
5
|
+
*
|
|
6
|
+
* [refToWatch = true]
|
|
7
|
+
* [visible = false] [if refToWatch = false -> Finish] [visible = true] [freeze now, ignore any change] [visible = refToWatch] [unlock]
|
|
8
|
+
* [------------------ flickerThreshold ------------------][------------------ minShowTime ------------------]
|
|
9
|
+
*
|
|
10
|
+
* This logic is separated into 4 phases:
|
|
11
|
+
* - null: The initial phase where the value is hidden.
|
|
12
|
+
* - threshold: The initial phase where the value is hidden and waits for flicker threshold time.
|
|
13
|
+
* If in this phase, refToWatch changes to false, the process get canceled.
|
|
14
|
+
* - minShowTime: The phase where the value is shown for a minimum time.
|
|
15
|
+
* - over: The final phase where the value is shown or hidden based on the refToWatch.
|
|
16
|
+
*
|
|
17
|
+
* @param refToWatch - The ref or computed ref to watch for changes.
|
|
18
|
+
* @param minShowTime - The minimum time (in ms) the value should remain visible.
|
|
19
|
+
* @param flickerThreshold - The threshold (in ms) to ignore rapid changes.
|
|
20
|
+
* @returns A ref that manages the visibility state with flicker protection.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useFlickerProtection: (refToWatch: Ref<boolean> | ComputedRef<boolean>, minShowTime?: number, flickerThreshold?: number) => Ref<boolean>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFlickerProtection = void 0;
|
|
7
|
+
var _vue = require("vue");
|
|
8
|
+
const useFlickerProtection = (refToWatch, minShowTime = 300, flickerThreshold = 50) => {
|
|
9
|
+
const visible = (0, _vue.ref)(refToWatch.value);
|
|
10
|
+
const phase = (0, _vue.ref)(null);
|
|
11
|
+
function startThresholdPhase() {
|
|
12
|
+
phase.value = "threshold";
|
|
13
|
+
visible.value = false;
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
if (refToWatch.value) {
|
|
16
|
+
startMinShowTimePhase();
|
|
17
|
+
}
|
|
18
|
+
}, flickerThreshold);
|
|
19
|
+
}
|
|
20
|
+
function startMinShowTimePhase() {
|
|
21
|
+
phase.value = "minShowTime";
|
|
22
|
+
visible.value = true;
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
visible.value = refToWatch.value;
|
|
25
|
+
phase.value = refToWatch.value ? "over" : null;
|
|
26
|
+
}, minShowTime);
|
|
27
|
+
}
|
|
28
|
+
(0, _vue.watch)(refToWatch, newValue => {
|
|
29
|
+
if (phase.value === "minShowTime") {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (phase.value === null && newValue) {
|
|
33
|
+
return startThresholdPhase();
|
|
34
|
+
}
|
|
35
|
+
if (phase.value === "threshold" && !newValue) {
|
|
36
|
+
phase.value = null;
|
|
37
|
+
return visible.value = false;
|
|
38
|
+
}
|
|
39
|
+
if (phase.value === "over" && !newValue) {
|
|
40
|
+
phase.value = null;
|
|
41
|
+
visible.value = false;
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
immediate: true
|
|
45
|
+
});
|
|
46
|
+
return visible;
|
|
47
|
+
};
|
|
48
|
+
exports.useFlickerProtection = useFlickerProtection;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ref,
|
|
3
|
+
watch
|
|
4
|
+
} from "vue";
|
|
5
|
+
export const useFlickerProtection = (refToWatch, minShowTime = 300, flickerThreshold = 50) => {
|
|
6
|
+
const visible = ref(refToWatch.value);
|
|
7
|
+
const phase = ref(null);
|
|
8
|
+
function startThresholdPhase() {
|
|
9
|
+
phase.value = "threshold";
|
|
10
|
+
visible.value = false;
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
if (refToWatch.value) {
|
|
13
|
+
startMinShowTimePhase();
|
|
14
|
+
}
|
|
15
|
+
}, flickerThreshold);
|
|
16
|
+
}
|
|
17
|
+
function startMinShowTimePhase() {
|
|
18
|
+
phase.value = "minShowTime";
|
|
19
|
+
visible.value = true;
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
visible.value = refToWatch.value;
|
|
22
|
+
phase.value = refToWatch.value ? "over" : null;
|
|
23
|
+
}, minShowTime);
|
|
24
|
+
}
|
|
25
|
+
watch(
|
|
26
|
+
refToWatch,
|
|
27
|
+
(newValue) => {
|
|
28
|
+
if (phase.value === "minShowTime") {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (phase.value === null && newValue) {
|
|
32
|
+
return startThresholdPhase();
|
|
33
|
+
}
|
|
34
|
+
if (phase.value === "threshold" && !newValue) {
|
|
35
|
+
phase.value = null;
|
|
36
|
+
return visible.value = false;
|
|
37
|
+
}
|
|
38
|
+
if (phase.value === "over" && !newValue) {
|
|
39
|
+
phase.value = null;
|
|
40
|
+
visible.value = false;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
immediate: true
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
return visible;
|
|
48
|
+
};
|
|
@@ -56,16 +56,19 @@ const useToaster = () => {
|
|
|
56
56
|
});
|
|
57
57
|
},
|
|
58
58
|
toastDeleted() {
|
|
59
|
-
this.toastSuccess("
|
|
59
|
+
this.toastSuccess("Gel\xF6scht");
|
|
60
60
|
},
|
|
61
61
|
toastCreated() {
|
|
62
|
-
this.toastSuccess("
|
|
62
|
+
this.toastSuccess("Gespeichert");
|
|
63
63
|
},
|
|
64
64
|
toastUpdated() {
|
|
65
|
-
this.toastSuccess("
|
|
65
|
+
this.toastSuccess("Gespeichert");
|
|
66
66
|
},
|
|
67
67
|
toastDuplicated() {
|
|
68
|
-
this.toastSuccess("
|
|
68
|
+
this.toastSuccess("Dupliziert");
|
|
69
|
+
},
|
|
70
|
+
toastInvalidFormInfo() {
|
|
71
|
+
this.toastInfo("Das Formular enth\xE4lt Fehler.\nBitte \xFCberpr\xFCfe alle Felder und behebe die Fehler.");
|
|
69
72
|
}
|
|
70
73
|
};
|
|
71
74
|
};
|
|
@@ -56,16 +56,19 @@ export const useToaster = () => {
|
|
|
56
56
|
});
|
|
57
57
|
},
|
|
58
58
|
toastDeleted() {
|
|
59
|
-
this.toastSuccess("
|
|
59
|
+
this.toastSuccess("Gel\xF6scht");
|
|
60
60
|
},
|
|
61
61
|
toastCreated() {
|
|
62
|
-
this.toastSuccess("
|
|
62
|
+
this.toastSuccess("Gespeichert");
|
|
63
63
|
},
|
|
64
64
|
toastUpdated() {
|
|
65
|
-
this.toastSuccess("
|
|
65
|
+
this.toastSuccess("Gespeichert");
|
|
66
66
|
},
|
|
67
67
|
toastDuplicated() {
|
|
68
|
-
this.toastSuccess("
|
|
68
|
+
this.toastSuccess("Dupliziert");
|
|
69
|
+
},
|
|
70
|
+
toastInvalidFormInfo() {
|
|
71
|
+
this.toastInfo("Das Formular enth\xE4lt Fehler.\nBitte \xFCberpr\xFCfe alle Felder und behebe die Fehler.");
|
|
69
72
|
}
|
|
70
73
|
};
|
|
71
74
|
};
|