@cat-of-summer/st-script 1.4.1 → 1.4.2
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
CHANGED
|
@@ -24,6 +24,7 @@ const ICON = '<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke
|
|
|
24
24
|
// Календарь: поле с маской ДД.ММ.ГГГГ (или два — для диапазона), кнопка и всплывающая сетка
|
|
25
25
|
// месяца; inline — только сетка с кнопками "Сбросить" и "Выбрать". В форму уходит ISO из
|
|
26
26
|
// скрытых полей: name — одиночная дата, name_from и name_to — диапазон.
|
|
27
|
+
// Разметка — template ниже; разметка внутри <st-app> её заменяет (свой шаблон в проекте).
|
|
27
28
|
// Регистрация — App.create(datepicker); Mask входит в бандл, App — нет.
|
|
28
29
|
export default {
|
|
29
30
|
app: 'datepicker',
|
|
@@ -62,33 +63,32 @@ export default {
|
|
|
62
63
|
return this.year ? title(this.year, this.month) : '';
|
|
63
64
|
},
|
|
64
65
|
|
|
66
|
+
// Корень — сам <st-app app="datepicker">: стили — от [app="datepicker"], модификаторы — на элементах.
|
|
65
67
|
template: `
|
|
66
|
-
<div class="
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
<div class="datepicker__field" #class="{ 'datepicker__field--invalid': invalid }" #show="!inline">
|
|
69
|
+
<input class="datepicker__input" datepicker-from type="text" inputmode="numeric" autocomplete="off" id="{{ inputId }}" required="{{ required }}">
|
|
70
|
+
<span class="datepicker__dash" #show="range" aria-hidden="true">—</span>
|
|
71
|
+
<input class="datepicker__input" datepicker-to type="text" inputmode="numeric" autocomplete="off" aria-label="Конец периода" #show="range" required="{{ required && range }}">
|
|
72
|
+
<button class="datepicker__toggle" type="button" aria-label="Открыть календарь" aria-haspopup="dialog" aria-expanded="{{ is_open }}" @click="toggle()">${ICON}</button>
|
|
73
|
+
</div>
|
|
74
|
+
<input type="hidden" datepicker-value="from" name="{{ name ? (range ? name + '_from' : name) : '' }}">
|
|
75
|
+
<input type="hidden" datepicker-value="to" name="{{ name && range ? name + '_to' : '' }}" disabled="{{ !range }}">
|
|
76
|
+
<div class="datepicker__popup" #class="{ 'datepicker__popup--inline': inline }" role="dialog" aria-label="Выбор даты" hidden="{{ !inline && !is_open }}">
|
|
77
|
+
<div class="datepicker__nav">
|
|
78
|
+
<button class="datepicker__prev" type="button" aria-label="Предыдущий месяц" @click="go(-1)">‹</button>
|
|
79
|
+
<span class="datepicker__caption" aria-live="polite">{{ caption }}</span>
|
|
80
|
+
<button class="datepicker__next" type="button" aria-label="Следующий месяц" @click="go(1)">›</button>
|
|
72
81
|
</div>
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
<button class="datepicker__day" type="button" #for="cell in days" #key="$index"
|
|
84
|
-
#class="{ 'datepicker__day--other': cell.other, 'datepicker__day--today': cell.today, 'datepicker__day--selected': cell.selected, 'datepicker__day--in-range': cell.in_range, 'datepicker__day--range-from': cell.range_from, 'datepicker__day--range-to': cell.range_to }"
|
|
85
|
-
disabled="{{ cell.disabled }}" aria-pressed="{{ cell.selected }}" aria-label="{{ cell.label }}"
|
|
86
|
-
@click="pick(cell.iso)">{{ cell.day }}</button>
|
|
87
|
-
</div>
|
|
88
|
-
<div class="datepicker__buttons" #show="inline">
|
|
89
|
-
<button class="datepicker__reset" type="button" @click="clear()">Сбросить</button>
|
|
90
|
-
<button class="datepicker__apply" type="button" @click="apply()">Выбрать</button>
|
|
91
|
-
</div>
|
|
82
|
+
<div class="datepicker__grid">
|
|
83
|
+
<span class="datepicker__weekday" aria-hidden="true" #for="day in weekdays">{{ day }}</span>
|
|
84
|
+
<button class="datepicker__day" type="button" #for="cell in days" #key="$index"
|
|
85
|
+
#class="{ 'datepicker__day--other': cell.other, 'datepicker__day--today': cell.today, 'datepicker__day--selected': cell.selected, 'datepicker__day--in-range': cell.in_range, 'datepicker__day--range-from': cell.range_from, 'datepicker__day--range-to': cell.range_to }"
|
|
86
|
+
disabled="{{ cell.disabled }}" aria-pressed="{{ cell.selected }}" aria-label="{{ cell.label }}"
|
|
87
|
+
@click="pick(cell.iso)">{{ cell.day }}</button>
|
|
88
|
+
</div>
|
|
89
|
+
<div class="datepicker__buttons" #show="inline">
|
|
90
|
+
<button class="datepicker__reset" type="button" @click="clear()">Сбросить</button>
|
|
91
|
+
<button class="datepicker__apply" type="button" @click="apply()">Выбрать</button>
|
|
92
92
|
</div>
|
|
93
93
|
</div>`,
|
|
94
94
|
|