its_ui_vite 1.1.3 → 1.1.4
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 +16 -3
- package/src/components/CDatepicker.vue +110 -35
- package/src/components/CSelect.vue +12 -4
- package/src/pages/index.vue +5 -2
- package/src/stories/CAlert.stories.js +66 -0
- package/src/stories/CButton.stories.js +105 -0
- package/src/stories/CCheckbox.stories.js +112 -0
- package/src/stories/CCheckbox2.stories.js +102 -0
- package/src/stories/CDatepicker.stories.js +147 -0
- package/src/stories/CDropdown.stories.js +161 -0
- package/src/stories/CIcon.stories.js +54 -0
- package/src/stories/CInput.stories.js +102 -0
- package/src/stories/CInput2.stories.js +104 -0
- package/src/stories/CInput2Select.stories.js +208 -0
- package/src/stories/CPopup.stories.js +62 -0
- package/src/stories/CScroll.stories.js +66 -0
- package/src/stories/CSelect.stories.js +150 -0
- package/src/stories/CTabs.stories.js +83 -0
- package/src/stories/CTooltip.stories.js +172 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "its_ui_vite",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"main": "./src/libIndex.js",
|
|
5
5
|
"module": "./src/libIndex.js",
|
|
6
6
|
"files": [
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
"dev": "vite",
|
|
18
18
|
"build": "vite build",
|
|
19
19
|
"preview": "vite preview",
|
|
20
|
-
"icons": "node ./icon.js"
|
|
20
|
+
"icons": "node ./icon.js",
|
|
21
|
+
"storybook": "storybook dev -p 6006",
|
|
22
|
+
"build-storybook": "storybook build"
|
|
21
23
|
},
|
|
22
24
|
"dependencies": {
|
|
23
25
|
"compression": "^1.7.4",
|
|
@@ -31,7 +33,18 @@
|
|
|
31
33
|
"devDependencies": {
|
|
32
34
|
"@vitejs/plugin-vue": "^4.6.2",
|
|
33
35
|
"sass": "^1.69.5",
|
|
34
|
-
"vite": "^5.0.8"
|
|
36
|
+
"vite": "^5.0.8",
|
|
37
|
+
"storybook": "^10.2.8",
|
|
38
|
+
"@storybook/vue3-vite": "^10.2.8",
|
|
39
|
+
"@chromatic-com/storybook": "^5.0.1",
|
|
40
|
+
"@storybook/addon-vitest": "^10.2.8",
|
|
41
|
+
"@storybook/addon-a11y": "^10.2.8",
|
|
42
|
+
"@storybook/addon-docs": "^10.2.8",
|
|
43
|
+
"@storybook/addon-onboarding": "^10.2.8",
|
|
44
|
+
"vitest": "^4.0.18",
|
|
45
|
+
"playwright": "^1.58.2",
|
|
46
|
+
"@vitest/browser-playwright": "^4.0.18",
|
|
47
|
+
"@vitest/coverage-v8": "^4.0.18"
|
|
35
48
|
},
|
|
36
49
|
"peerDependencies": {
|
|
37
50
|
"sass": ">=1"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
@click="setIsOpen(!isOpenPicker)"
|
|
12
12
|
>
|
|
13
13
|
<CInput
|
|
14
|
-
class="c-datepicker__inp"
|
|
14
|
+
:class="['c-datepicker__inp', { 'empty-date': isEmptyDate }]"
|
|
15
15
|
size="sm"
|
|
16
16
|
:width="width"
|
|
17
17
|
:placeholder="datePlaceholder"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<div
|
|
38
38
|
v-if="showTime"
|
|
39
39
|
ref="time"
|
|
40
|
-
:class="['c-datepicker__time_wrap', { open: isOpenTime }]"
|
|
40
|
+
:class="['c-datepicker__time_wrap', { open: isOpenTime, 'empty-date': isEmptyDate }]"
|
|
41
41
|
>
|
|
42
42
|
<div
|
|
43
43
|
class="c-datepicker__time_inps"
|
|
@@ -176,14 +176,14 @@
|
|
|
176
176
|
class="c-datepicker__action_btn"
|
|
177
177
|
variant="outlined"
|
|
178
178
|
size="md"
|
|
179
|
-
@click="
|
|
179
|
+
@click="cancelDate"
|
|
180
180
|
>
|
|
181
181
|
{{ text.cancel }}
|
|
182
182
|
</CButton>
|
|
183
183
|
<CButton
|
|
184
184
|
class="c-datepicker__action_btn"
|
|
185
185
|
size="md"
|
|
186
|
-
:disabled="
|
|
186
|
+
:disabled="isDisableDate"
|
|
187
187
|
@click="setDate"
|
|
188
188
|
>
|
|
189
189
|
{{ text.accept }}
|
|
@@ -210,7 +210,8 @@ import { computed, ref, watch, onMounted, onUnmounted, Teleport } from 'vue';
|
|
|
210
210
|
|
|
211
211
|
type TProps = {
|
|
212
212
|
date?: string,
|
|
213
|
-
|
|
213
|
+
emptyDate?: boolean,
|
|
214
|
+
showTime?: boolean,
|
|
214
215
|
color?: 'green' | 'green2',
|
|
215
216
|
locale?: 'rus' | 'usa' | 'tur' | 'spa',
|
|
216
217
|
max?: string,
|
|
@@ -224,6 +225,7 @@ type TProps = {
|
|
|
224
225
|
const props = withDefaults(defineProps<TProps>(), {
|
|
225
226
|
locale: 'rus',
|
|
226
227
|
color: 'green',
|
|
228
|
+
emptyDate: false,
|
|
227
229
|
showTime: true,
|
|
228
230
|
isOpen: false,
|
|
229
231
|
width: '100%',
|
|
@@ -240,6 +242,7 @@ type TMonthDay = {
|
|
|
240
242
|
type TSelectOption = {
|
|
241
243
|
text: string,
|
|
242
244
|
value: number,
|
|
245
|
+
disable?: boolean,
|
|
243
246
|
}
|
|
244
247
|
|
|
245
248
|
const transition = 200;
|
|
@@ -264,6 +267,8 @@ let oldDateISO = ref<any>(defaultDate.toISO())
|
|
|
264
267
|
let activeDate = ref<any>(defaultDate);
|
|
265
268
|
let activeMonth = ref<number>(defaultDate.month);
|
|
266
269
|
let activeYear = ref<number>(defaultDate.year);
|
|
270
|
+
let isEmptyDate = ref<boolean>(false);
|
|
271
|
+
let isDisableDate = ref<boolean>(false);
|
|
267
272
|
|
|
268
273
|
let modelMonth: any = ref([]);
|
|
269
274
|
let modelYear: any = ref([]);
|
|
@@ -292,27 +297,7 @@ const TracingElement = addTracingElement(root, handlePicker);
|
|
|
292
297
|
const TracingTime = addTracingElement(time, handleTime);
|
|
293
298
|
|
|
294
299
|
onMounted(() => {
|
|
295
|
-
|
|
296
|
-
if (typeof props.date === 'string') {
|
|
297
|
-
activeDate.value = DateTime.fromISO(props.date)
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
if (!activeDate.value?.isValid) {
|
|
301
|
-
activeDate.value = defaultDate
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const currentDate = activeDate.value.toISO();
|
|
306
|
-
|
|
307
|
-
oldDateISO.value = currentDate;
|
|
308
|
-
|
|
309
|
-
activeMonth.value = activeDate.value.month;
|
|
310
|
-
activeYear.value = activeDate.value.year;
|
|
311
|
-
|
|
312
|
-
fillMonthDays(currentDate);
|
|
313
|
-
|
|
314
|
-
setTime('hour', activeDate.value.toFormat('HH'));
|
|
315
|
-
setTime('minute', activeDate.value.toFormat('mm'));
|
|
300
|
+
isEmptyDate.value = props.emptyDate && !props.date;
|
|
316
301
|
|
|
317
302
|
TracingElement.addListeners();
|
|
318
303
|
TracingTime.addListeners();
|
|
@@ -322,6 +307,15 @@ onMounted(() => {
|
|
|
322
307
|
fullscreenEvents.forEach((eventName) => {
|
|
323
308
|
document.addEventListener(eventName, setTeleportTo);
|
|
324
309
|
});
|
|
310
|
+
|
|
311
|
+
if (isEmptyDate.value) {
|
|
312
|
+
isDisableDate.value = true;
|
|
313
|
+
|
|
314
|
+
setTime('hour', '00');
|
|
315
|
+
setTime('minute', '00');
|
|
316
|
+
} else {
|
|
317
|
+
initDate(props.date)
|
|
318
|
+
}
|
|
325
319
|
});
|
|
326
320
|
|
|
327
321
|
onUnmounted(() => {
|
|
@@ -347,6 +341,7 @@ const text = computed(() => {
|
|
|
347
341
|
daysOfWeek: ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'],
|
|
348
342
|
months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
|
|
349
343
|
cancel: 'Отмена',
|
|
344
|
+
emptyDate: 'дд.мм.гггг',
|
|
350
345
|
accept: 'OK',
|
|
351
346
|
},
|
|
352
347
|
|
|
@@ -354,6 +349,7 @@ const text = computed(() => {
|
|
|
354
349
|
daysOfWeek: [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ],
|
|
355
350
|
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
356
351
|
cancel: 'Cancel',
|
|
352
|
+
emptyDate: 'dd.mm.yyyy',
|
|
357
353
|
accept: 'OK',
|
|
358
354
|
},
|
|
359
355
|
|
|
@@ -361,6 +357,7 @@ const text = computed(() => {
|
|
|
361
357
|
daysOfWeek: [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ],
|
|
362
358
|
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
363
359
|
cancel: 'Cancel',
|
|
360
|
+
emptyDate: 'dd.mm.yyyy',
|
|
364
361
|
accept: 'OK',
|
|
365
362
|
},
|
|
366
363
|
|
|
@@ -368,6 +365,7 @@ const text = computed(() => {
|
|
|
368
365
|
daysOfWeek: [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ],
|
|
369
366
|
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
370
367
|
cancel: 'Cancel',
|
|
368
|
+
emptyDate: 'dd.mm.aaaa',
|
|
371
369
|
accept: 'OK',
|
|
372
370
|
},
|
|
373
371
|
};
|
|
@@ -376,17 +374,31 @@ const text = computed(() => {
|
|
|
376
374
|
});
|
|
377
375
|
|
|
378
376
|
const datePlaceholder = computed(() => {
|
|
379
|
-
|
|
377
|
+
if (isEmptyDate.value) return text.value.emptyDate
|
|
378
|
+
|
|
379
|
+
const currentDateISO = activeDate.value.toISO()
|
|
380
380
|
return DateTime.fromISO(currentDateISO).setLocale(props.locale).toFormat('dd LLLL yyyy')
|
|
381
381
|
});
|
|
382
382
|
|
|
383
383
|
const monthsOption = computed(() => {
|
|
384
384
|
let options: TSelectOption[] = [];
|
|
385
385
|
|
|
386
|
+
const maxDateStr = props?.max || '';
|
|
387
|
+
const minDateStr = props?.min || '';
|
|
388
|
+
const maxDate = DateTime.fromISO(maxDateStr);
|
|
389
|
+
const minDate = DateTime.fromISO(minDateStr);
|
|
390
|
+
|
|
386
391
|
text.value.months.forEach((item, index) => {
|
|
392
|
+
const monthIndex = index + 1;
|
|
393
|
+
|
|
394
|
+
const isMaxMonth = activeDate.value.year === maxDate.year && monthIndex > maxDate.month;
|
|
395
|
+
const isMinMonth = activeDate.value.year === minDate.year && monthIndex < minDate.month;
|
|
396
|
+
const isDisable = isMaxMonth || isMinMonth;
|
|
397
|
+
|
|
387
398
|
options.push({
|
|
388
399
|
text: item,
|
|
389
|
-
value:
|
|
400
|
+
value: monthIndex,
|
|
401
|
+
disable: isDisable,
|
|
390
402
|
});
|
|
391
403
|
});
|
|
392
404
|
|
|
@@ -396,14 +408,22 @@ const monthsOption = computed(() => {
|
|
|
396
408
|
const yearOption = computed(() => {
|
|
397
409
|
let options: TSelectOption[] = [];
|
|
398
410
|
|
|
411
|
+
const maxDateStr = props?.max || '';
|
|
412
|
+
const minDateStr = props?.min || '';
|
|
413
|
+
const maxDate = DateTime.fromISO(maxDateStr);
|
|
414
|
+
const minDate = DateTime.fromISO(minDateStr);
|
|
415
|
+
|
|
399
416
|
const range = 10;
|
|
400
|
-
const minYear =
|
|
401
|
-
const maxYear =
|
|
417
|
+
const minYear = defaultDate.year - range;
|
|
418
|
+
const maxYear = defaultDate.year + range;
|
|
402
419
|
|
|
403
420
|
for(let i = minYear; i < maxYear; i++) {
|
|
421
|
+
const isDisable = i > maxDate.year || i < minDate.year;
|
|
422
|
+
|
|
404
423
|
options.push({
|
|
405
424
|
text: String(i),
|
|
406
425
|
value: i,
|
|
426
|
+
disable: isDisable,
|
|
407
427
|
})
|
|
408
428
|
}
|
|
409
429
|
|
|
@@ -441,6 +461,10 @@ const minuteOptions = computed(() => {
|
|
|
441
461
|
});
|
|
442
462
|
|
|
443
463
|
watch(() => isOpenPicker.value, (newValue) => {
|
|
464
|
+
if (isEmptyDate.value) {
|
|
465
|
+
isDisableDate.value = true;
|
|
466
|
+
}
|
|
467
|
+
|
|
444
468
|
emit('update:isOpen', newValue);
|
|
445
469
|
})
|
|
446
470
|
|
|
@@ -476,6 +500,24 @@ function handlePicker(positionInfo?: any) {
|
|
|
476
500
|
setIsOpen(false);
|
|
477
501
|
}
|
|
478
502
|
|
|
503
|
+
function initDate(date?: string) {
|
|
504
|
+
const currentDate = DateTime.fromISO(date || '');
|
|
505
|
+
|
|
506
|
+
activeDate.value = currentDate.isValid ? currentDate : defaultDate;
|
|
507
|
+
|
|
508
|
+
const currentDateISO = activeDate.value.toISO();
|
|
509
|
+
|
|
510
|
+
oldDateISO.value = currentDateISO;
|
|
511
|
+
|
|
512
|
+
activeMonth.value = activeDate.value.month;
|
|
513
|
+
activeYear.value = activeDate.value.year;
|
|
514
|
+
|
|
515
|
+
fillMonthDays(currentDateISO);
|
|
516
|
+
|
|
517
|
+
setTime('hour', activeDate.value.toFormat('HH'));
|
|
518
|
+
setTime('minute', activeDate.value.toFormat('mm'));
|
|
519
|
+
}
|
|
520
|
+
|
|
479
521
|
function handleClickPicker(evt: MouseEvent) {
|
|
480
522
|
const target = (evt.target as HTMLElement);
|
|
481
523
|
const classesArr = [
|
|
@@ -598,8 +640,10 @@ function setTime(name: 'hour' | 'minute', value: string) {
|
|
|
598
640
|
|
|
599
641
|
const format = name === 'hour' ? 'HH' : 'mm';
|
|
600
642
|
|
|
601
|
-
const
|
|
602
|
-
const
|
|
643
|
+
const maxDateStr = props?.max || '';
|
|
644
|
+
const minDateStr = props?.min || '';
|
|
645
|
+
const maxDate = DateTime.fromISO(maxDateStr);
|
|
646
|
+
const minDate = DateTime.fromISO(minDateStr);
|
|
603
647
|
|
|
604
648
|
// max Day
|
|
605
649
|
const isMismatchMaxDay = maxDate.isValid && (maxDate.day === activeDate.value.day && maxDate.month === activeDate.value.month && maxDate.year === activeDate.value.year);
|
|
@@ -627,9 +671,10 @@ function getTimeStr(value: number | string) {
|
|
|
627
671
|
}
|
|
628
672
|
|
|
629
673
|
function isDisableTime(name: 'hour' | 'minute', value: number) {
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
|
|
674
|
+
const maxDateStr = props?.max || '';
|
|
675
|
+
const minDateStr = props?.min || '';
|
|
676
|
+
const maxDate = DateTime.fromISO(maxDateStr);
|
|
677
|
+
const minDate = DateTime.fromISO(minDateStr);
|
|
633
678
|
|
|
634
679
|
// max Day
|
|
635
680
|
const isMismatchMaxDay = maxDate.day !== activeDate.value.day || maxDate.month !== activeDate.value.month || maxDate.year !== activeDate.value.year;
|
|
@@ -667,6 +712,8 @@ function setOldDate(value: boolean) {
|
|
|
667
712
|
if (value) {
|
|
668
713
|
oldDateISO.value = activeDate.value.toISO()
|
|
669
714
|
} else {
|
|
715
|
+
if (isEmptyDate.value && !isDisableDate.value) return;
|
|
716
|
+
|
|
670
717
|
activeDate.value = DateTime.fromISO(oldDateISO.value);
|
|
671
718
|
activeMonth.value = activeDate.value.month;
|
|
672
719
|
activeYear.value = activeDate.value.year;
|
|
@@ -677,12 +724,23 @@ function setOldDate(value: boolean) {
|
|
|
677
724
|
}
|
|
678
725
|
|
|
679
726
|
function setDate() {
|
|
727
|
+
isDisableDate.value = false;
|
|
728
|
+
isEmptyDate.value = false;
|
|
729
|
+
|
|
680
730
|
setTime('hour', activeDate.value.toFormat('HH'));
|
|
681
731
|
setTime('minute', activeDate.value.toFormat('mm'));
|
|
682
732
|
|
|
683
733
|
dispatchEmit();
|
|
684
734
|
}
|
|
685
735
|
|
|
736
|
+
function cancelDate() {
|
|
737
|
+
if (isEmptyDate.value) {
|
|
738
|
+
isDisableDate.value = false;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
setIsOpen(false);
|
|
742
|
+
}
|
|
743
|
+
|
|
686
744
|
function dispatchEmit() {
|
|
687
745
|
const currentDateISO = activeDate.value.toISO();
|
|
688
746
|
setIsOpen(false);
|
|
@@ -695,6 +753,7 @@ function dispatchEmit() {
|
|
|
695
753
|
function setActiveDay(ISO: string) {
|
|
696
754
|
if (isDisableDay(ISO)) return;
|
|
697
755
|
|
|
756
|
+
isDisableDate.value = false;
|
|
698
757
|
const currentDate = DateTime.fromISO(ISO);
|
|
699
758
|
|
|
700
759
|
const currentActiveDate = DateTime.fromISO(activeDate.value.toISO()).set({
|
|
@@ -727,11 +786,15 @@ function setSelect(dateName: 'month' | 'year', value: number) {
|
|
|
727
786
|
activeDate.value = DateTime.fromISO(currentISO).set({ month: activeMonth.value, year: activeYear.value });
|
|
728
787
|
const currentDate = activeDate.value.toISO();
|
|
729
788
|
|
|
789
|
+
isDisableDate.value = isDisableDay(currentDate)
|
|
790
|
+
|
|
730
791
|
monthDays.value = [];
|
|
731
792
|
fillMonthDays(currentDate);
|
|
732
793
|
}
|
|
733
794
|
|
|
734
795
|
function isActiveDay(ISO: string): boolean {
|
|
796
|
+
if (isDisableDate.value) return false;
|
|
797
|
+
|
|
735
798
|
const currentDate = DateTime.fromISO(ISO);
|
|
736
799
|
|
|
737
800
|
return activeDate.value.year === currentDate.year && activeDate.value.month === currentDate.month && activeDate.value.day === currentDate.day
|
|
@@ -781,6 +844,10 @@ $timeWidth: 54px;
|
|
|
781
844
|
|
|
782
845
|
&__inp {
|
|
783
846
|
|
|
847
|
+
&.empty-date .c-input::placeholder {
|
|
848
|
+
color: var(--green-medium);
|
|
849
|
+
}
|
|
850
|
+
|
|
784
851
|
.c-input {
|
|
785
852
|
padding: 7px 10px;
|
|
786
853
|
}
|
|
@@ -885,6 +952,14 @@ $timeWidth: 54px;
|
|
|
885
952
|
&:hover {
|
|
886
953
|
border: 1px solid var(--green-light);
|
|
887
954
|
}
|
|
955
|
+
|
|
956
|
+
&.empty-date {
|
|
957
|
+
pointer-events: none;
|
|
958
|
+
|
|
959
|
+
.c-datepicker__time_inps {
|
|
960
|
+
color: var(--green-medium);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
888
963
|
}
|
|
889
964
|
}
|
|
890
965
|
}
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
v-for="item in foundOptions"
|
|
52
52
|
:key="item.value"
|
|
53
53
|
@click="debounceEvent(item, $event)"
|
|
54
|
-
:class="classes.optionBtn"
|
|
54
|
+
:class="[classes.optionBtn, { disable: item.disable }]"
|
|
55
55
|
>
|
|
56
56
|
<component
|
|
57
57
|
:class="classes.option"
|
|
@@ -91,6 +91,7 @@ type TOption = {
|
|
|
91
91
|
text?: string,
|
|
92
92
|
value?: any,
|
|
93
93
|
id?: any,
|
|
94
|
+
disable?: boolean,
|
|
94
95
|
[key: string]: any,
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -317,14 +318,15 @@ function getCheckboxProp(option: TOption) {
|
|
|
317
318
|
if (!isMultiple.value) return {}
|
|
318
319
|
return {
|
|
319
320
|
size: 'sm',
|
|
320
|
-
modelValue: isChecked,
|
|
321
|
+
modelValue: !option.disable && isChecked,
|
|
322
|
+
disable: option.disable,
|
|
321
323
|
}
|
|
322
324
|
}
|
|
323
325
|
|
|
324
326
|
function setAllOption(evt: MouseEvent) {
|
|
325
327
|
const target = (evt.target as HTMLElement);
|
|
326
328
|
const list = target.closest(`.${classes.list}`);
|
|
327
|
-
const inputs = (list!.querySelectorAll<HTMLInputElement>(`.${classes.optionBtn} input`));
|
|
329
|
+
const inputs = (list!.querySelectorAll<HTMLInputElement>(`.${classes.optionBtn}:not(.disable) input`));
|
|
328
330
|
const inputsChecked = list!.querySelectorAll(`.${classes.optionBtn}:not(:first-child) input:checked`);
|
|
329
331
|
const selectAllInput = inputs[0];
|
|
330
332
|
|
|
@@ -337,7 +339,8 @@ function setAllOption(evt: MouseEvent) {
|
|
|
337
339
|
});
|
|
338
340
|
|
|
339
341
|
props.options.forEach((option) => {
|
|
340
|
-
|
|
342
|
+
const isAdd = selectAllInput.checked && !option.disable;
|
|
343
|
+
activeOptions.value[isAdd ? 'add' : 'delete'](option);
|
|
341
344
|
});
|
|
342
345
|
} else {
|
|
343
346
|
selectAllInput.checked = isOneNotChecked;
|
|
@@ -550,6 +553,11 @@ defineExpose({
|
|
|
550
553
|
background: var(--green-dark);
|
|
551
554
|
}
|
|
552
555
|
|
|
556
|
+
&.disable {
|
|
557
|
+
opacity: 0.5;
|
|
558
|
+
pointer-events: none;
|
|
559
|
+
}
|
|
560
|
+
|
|
553
561
|
.c-checkbox__wrap {
|
|
554
562
|
min-height: var(--option-height);
|
|
555
563
|
|
package/src/pages/index.vue
CHANGED
|
@@ -843,11 +843,14 @@
|
|
|
843
843
|
<div class="table__item" style="display: flex; flex-direction: column;">
|
|
844
844
|
<CDatepicker
|
|
845
845
|
date="2025-10-10T00:00:00.000+03:00"
|
|
846
|
-
max="
|
|
847
|
-
min="
|
|
846
|
+
max="2026-10-10T04:04:00.000+03:00"
|
|
847
|
+
min="2024-02-07T01:01:00.000+03:00"
|
|
848
848
|
@change_cdatepicker="(e) => console.log(e)"
|
|
849
849
|
/>
|
|
850
850
|
</div>
|
|
851
|
+
<div class="table__item">
|
|
852
|
+
<CDatepicker :empty-date="true" @change_cdatepicker="(e) => console.log(e)" />
|
|
853
|
+
</div>
|
|
851
854
|
</div>
|
|
852
855
|
<!-- ./col -->
|
|
853
856
|
</div>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import CAlert from '../components/CAlert.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/CAlert',
|
|
5
|
+
component: CAlert,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
variant: {
|
|
9
|
+
control: 'select',
|
|
10
|
+
options: ['notification', 'success', 'error'],
|
|
11
|
+
},
|
|
12
|
+
liveTime: { control: 'number' },
|
|
13
|
+
width: { control: 'text' },
|
|
14
|
+
text: { control: 'text' },
|
|
15
|
+
default: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'Slot content',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
variant: 'notification',
|
|
22
|
+
liveTime: 10000,
|
|
23
|
+
width: 'auto',
|
|
24
|
+
default: 'Время ожидания сервером истекло. Повторите попытку позже или обратитесь к администратору',
|
|
25
|
+
},
|
|
26
|
+
render: (args) => ({
|
|
27
|
+
components: { CAlert },
|
|
28
|
+
setup() { return { args }; },
|
|
29
|
+
template: `<CAlert v-bind="args">{{ args.default }}</CAlert>`,
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Notification = {};
|
|
34
|
+
|
|
35
|
+
export const Success = {
|
|
36
|
+
args: {
|
|
37
|
+
variant: 'success',
|
|
38
|
+
default: 'Очередь успешно отправлена',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Error = {
|
|
43
|
+
args: {
|
|
44
|
+
variant: 'error',
|
|
45
|
+
default: 'Ошибка соединения. Обратитесь к администратору',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const AllVariants = {
|
|
50
|
+
render: () => ({
|
|
51
|
+
components: { CAlert },
|
|
52
|
+
template: `
|
|
53
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
54
|
+
<CAlert variant="notification">
|
|
55
|
+
Время ожидания сервером истекло. Повторите попытку позже
|
|
56
|
+
</CAlert>
|
|
57
|
+
<CAlert variant="success">
|
|
58
|
+
Очередь успешно отправлена
|
|
59
|
+
</CAlert>
|
|
60
|
+
<CAlert variant="error">
|
|
61
|
+
Ошибка соединения. Обратитесь к администратору
|
|
62
|
+
</CAlert>
|
|
63
|
+
</div>
|
|
64
|
+
`,
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import CButton from '../components/CButton.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/CButton',
|
|
5
|
+
component: CButton,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
size: {
|
|
9
|
+
control: 'select',
|
|
10
|
+
options: ['lg', 'md', 'sm'],
|
|
11
|
+
},
|
|
12
|
+
variant: {
|
|
13
|
+
control: 'select',
|
|
14
|
+
options: ['tonal', 'outlined', 'text', 'nav_item'],
|
|
15
|
+
},
|
|
16
|
+
color: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: ['green', 'black'],
|
|
19
|
+
},
|
|
20
|
+
disabled: { control: 'boolean' },
|
|
21
|
+
loading: { control: 'boolean' },
|
|
22
|
+
active: { control: 'boolean' },
|
|
23
|
+
default: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Slot content',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
args: {
|
|
29
|
+
size: 'lg',
|
|
30
|
+
variant: 'tonal',
|
|
31
|
+
color: 'green',
|
|
32
|
+
disabled: false,
|
|
33
|
+
loading: false,
|
|
34
|
+
active: false,
|
|
35
|
+
default: 'Button',
|
|
36
|
+
},
|
|
37
|
+
render: (args) => ({
|
|
38
|
+
components: { CButton },
|
|
39
|
+
setup() { return { args }; },
|
|
40
|
+
template: `<CButton v-bind="args">{{ args.default }}</CButton>`,
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const Tonal = {};
|
|
45
|
+
|
|
46
|
+
export const Outlined = {
|
|
47
|
+
args: { variant: 'outlined', default: 'Outlined' },
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const Text = {
|
|
51
|
+
args: { variant: 'text', default: 'Text' },
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const NavItem = {
|
|
55
|
+
args: { variant: 'nav_item', default: 'Nav Item' },
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const Black = {
|
|
59
|
+
args: { color: 'black', default: 'Black' },
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Disabled = {
|
|
63
|
+
args: { disabled: true, default: 'Disabled' },
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const Loading = {
|
|
67
|
+
args: { loading: true, default: 'Loading' },
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const SizeMedium = {
|
|
71
|
+
args: { size: 'md', default: 'Medium' },
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const SizeSmall = {
|
|
75
|
+
args: { size: 'sm', default: 'Small' },
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const AllVariants = {
|
|
79
|
+
render: () => ({
|
|
80
|
+
components: { CButton },
|
|
81
|
+
template: `
|
|
82
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; align-items: center;">
|
|
83
|
+
<CButton>Tonal</CButton>
|
|
84
|
+
<CButton variant="outlined">Outlined</CButton>
|
|
85
|
+
<CButton variant="text">Text</CButton>
|
|
86
|
+
<CButton color="black">Black</CButton>
|
|
87
|
+
<CButton :disabled="true">Disabled</CButton>
|
|
88
|
+
<CButton :loading="true">Loading</CButton>
|
|
89
|
+
</div>
|
|
90
|
+
`,
|
|
91
|
+
}),
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const AllSizes = {
|
|
95
|
+
render: () => ({
|
|
96
|
+
components: { CButton },
|
|
97
|
+
template: `
|
|
98
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; align-items: center;">
|
|
99
|
+
<CButton size="lg">Large</CButton>
|
|
100
|
+
<CButton size="md">Medium</CButton>
|
|
101
|
+
<CButton size="sm">Small</CButton>
|
|
102
|
+
</div>
|
|
103
|
+
`,
|
|
104
|
+
}),
|
|
105
|
+
};
|