vueless 0.0.320 → 0.0.322
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 +1 -1
- package/preset.tailwind.js +1 -1
- package/ui.dropdown-badge/configs/default.config.js +4 -4
- package/ui.dropdown-badge/index.vue +4 -4
- package/ui.dropdown-button/configs/default.config.js +4 -4
- package/ui.dropdown-button/index.vue +4 -4
- package/ui.dropdown-link/configs/default.config.js +4 -4
- package/ui.dropdown-link/index.vue +4 -4
- package/ui.form-calendar/components/DayView.vue +6 -7
- package/ui.form-calendar/components/MonthView.vue +60 -5
- package/ui.form-calendar/components/YearView.vue +53 -5
- package/ui.form-calendar/configs/default.config.js +5 -4
- package/ui.form-calendar/index.vue +5 -1
- package/ui.form-date-picker-range/configs/default.config.js +12 -4
- package/ui.form-date-picker-range/index.vue +64 -7
- package/ui.loader/configs/default.config.js +0 -1
- package/ui.text-alert/configs/default.config.js +2 -2
- package/ui.text-alert/index.vue +14 -14
- package/ui.text-badge/configs/default.config.js +1 -1
- package/ui.text-badge/index.vue +8 -8
- package/ui.text-empty/configs/default.config.js +1 -1
- package/ui.text-empty/index.vue +4 -4
- package/ui.text-file/configs/default.config.js +3 -15
- package/ui.text-file/index.vue +10 -7
- package/ui.text-files/configs/default.config.js +3 -3
- package/ui.text-files/index.vue +27 -20
- package/ui.text-header/configs/default.config.js +3 -9
- package/ui.text-header/index.stories.js +3 -6
- package/ui.text-header/index.vue +6 -15
- package/ui.text-money/configs/default.config.js +9 -14
- package/ui.text-money/index.stories.js +0 -3
- package/ui.text-money/index.vue +66 -64
- package/ui.text-notify/configs/default.config.js +1 -0
- package/web-types.json +130 -113
package/package.json
CHANGED
package/preset.tailwind.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* Hide `/index.js` from import in Tailwind config. */
|
|
2
|
-
export { vuelessPreset } from "./preset.tailwind/index.js";
|
|
2
|
+
export { vuelessPreset, vuelessContent } from "./preset.tailwind/index.js";
|
|
@@ -7,11 +7,11 @@ export default /*tw*/ {
|
|
|
7
7
|
component: "{UDropdownList}",
|
|
8
8
|
base: "w-fit",
|
|
9
9
|
variants: {
|
|
10
|
-
|
|
10
|
+
yPosition: {
|
|
11
11
|
top: "bottom-6 mb-6",
|
|
12
12
|
bottom: "top-3 mt-6",
|
|
13
13
|
},
|
|
14
|
-
|
|
14
|
+
xPosition: {
|
|
15
15
|
left: "left-0",
|
|
16
16
|
right: "right-0",
|
|
17
17
|
},
|
|
@@ -23,8 +23,8 @@ export default /*tw*/ {
|
|
|
23
23
|
variant: "primary",
|
|
24
24
|
labelKey: "label",
|
|
25
25
|
valueKey: "id",
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
yPosition: "bottom",
|
|
27
|
+
xPosition: "left",
|
|
28
28
|
round: false,
|
|
29
29
|
noIcon: false,
|
|
30
30
|
/* icons */
|
|
@@ -161,18 +161,18 @@ const props = defineProps({
|
|
|
161
161
|
* The position of dropdown list on the y-axis.
|
|
162
162
|
* @values top, bottom
|
|
163
163
|
*/
|
|
164
|
-
|
|
164
|
+
yPosition: {
|
|
165
165
|
type: String,
|
|
166
|
-
default: getDefault(defaultConfig, UDropdownBadge).
|
|
166
|
+
default: getDefault(defaultConfig, UDropdownBadge).yPosition,
|
|
167
167
|
},
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
170
|
* The position of dropdown list on the x-axis.
|
|
171
171
|
* @values left, right
|
|
172
172
|
*/
|
|
173
|
-
|
|
173
|
+
xPosition: {
|
|
174
174
|
type: String,
|
|
175
|
-
default: getDefault(defaultConfig, UDropdownBadge).
|
|
175
|
+
default: getDefault(defaultConfig, UDropdownBadge).xPosition,
|
|
176
176
|
},
|
|
177
177
|
|
|
178
178
|
/**
|
|
@@ -6,11 +6,11 @@ export default /*tw*/ {
|
|
|
6
6
|
dropdownList: {
|
|
7
7
|
base: "{UDropdownList} w-fit",
|
|
8
8
|
variants: {
|
|
9
|
-
|
|
9
|
+
yPosition: {
|
|
10
10
|
top: "bottom-full mb-2",
|
|
11
11
|
bottom: "top-full mt-2",
|
|
12
12
|
},
|
|
13
|
-
|
|
13
|
+
xPosition: {
|
|
14
14
|
left: "left-0",
|
|
15
15
|
right: "right-0",
|
|
16
16
|
},
|
|
@@ -22,8 +22,8 @@ export default /*tw*/ {
|
|
|
22
22
|
variant: "primary",
|
|
23
23
|
labelKey: "label",
|
|
24
24
|
valueKey: "id",
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
yPosition: "bottom",
|
|
26
|
+
xPosition: "left",
|
|
27
27
|
filled: false,
|
|
28
28
|
round: false,
|
|
29
29
|
square: false,
|
|
@@ -187,18 +187,18 @@ const props = defineProps({
|
|
|
187
187
|
* The position of dropdown list on the y-axis.
|
|
188
188
|
* @values top, bottom
|
|
189
189
|
*/
|
|
190
|
-
|
|
190
|
+
yPosition: {
|
|
191
191
|
type: String,
|
|
192
|
-
default: getDefault(defaultConfig, UDropdownButton).
|
|
192
|
+
default: getDefault(defaultConfig, UDropdownButton).yPosition,
|
|
193
193
|
},
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
196
|
* The position of dropdown list on the x-axis.
|
|
197
197
|
* @values left, right
|
|
198
198
|
*/
|
|
199
|
-
|
|
199
|
+
xPosition: {
|
|
200
200
|
type: String,
|
|
201
|
-
default: getDefault(defaultConfig, UDropdownButton).
|
|
201
|
+
default: getDefault(defaultConfig, UDropdownButton).xPosition,
|
|
202
202
|
},
|
|
203
203
|
|
|
204
204
|
/**
|
|
@@ -6,11 +6,11 @@ export default /*tw*/ {
|
|
|
6
6
|
dropdownList: {
|
|
7
7
|
base: "{UDropdownList} w-fit",
|
|
8
8
|
variants: {
|
|
9
|
-
|
|
9
|
+
yPosition: {
|
|
10
10
|
top: "bottom-6 mb-4",
|
|
11
11
|
bottom: "top-3 mt-4",
|
|
12
12
|
},
|
|
13
|
-
|
|
13
|
+
xPosition: {
|
|
14
14
|
left: "left-0",
|
|
15
15
|
right: "right-0",
|
|
16
16
|
},
|
|
@@ -21,8 +21,8 @@ export default /*tw*/ {
|
|
|
21
21
|
size: "md",
|
|
22
22
|
labelKey: "label",
|
|
23
23
|
valueKey: "id",
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
yPosition: "bottom",
|
|
25
|
+
xPosition: "left",
|
|
26
26
|
underlined: undefined,
|
|
27
27
|
dashed: true,
|
|
28
28
|
noRing: true,
|
|
@@ -180,18 +180,18 @@ const props = defineProps({
|
|
|
180
180
|
* The position of dropdown list on the y-axis.
|
|
181
181
|
* @values top, bottom
|
|
182
182
|
*/
|
|
183
|
-
|
|
183
|
+
yPosition: {
|
|
184
184
|
type: String,
|
|
185
|
-
default: getDefault(defaultConfig, UDropdownLink).
|
|
185
|
+
default: getDefault(defaultConfig, UDropdownLink).yPosition,
|
|
186
186
|
},
|
|
187
187
|
|
|
188
188
|
/**
|
|
189
189
|
* The position of dropdown list on the x-axis.
|
|
190
190
|
* @values left, right
|
|
191
191
|
*/
|
|
192
|
-
|
|
192
|
+
xPosition: {
|
|
193
193
|
type: String,
|
|
194
|
-
default: getDefault(defaultConfig, UDropdownLink).
|
|
194
|
+
default: getDefault(defaultConfig, UDropdownLink).xPosition,
|
|
195
195
|
},
|
|
196
196
|
|
|
197
197
|
/**
|
|
@@ -99,9 +99,6 @@ const {
|
|
|
99
99
|
currentDayAttrs,
|
|
100
100
|
anotherMonthDayAttrs,
|
|
101
101
|
dayAttrs,
|
|
102
|
-
inRangeFirstDayAttrs,
|
|
103
|
-
inRangeLastDayAttrs,
|
|
104
|
-
inRangeDayAttrs,
|
|
105
102
|
} = useAttrs(props);
|
|
106
103
|
|
|
107
104
|
const localSelectedDate = computed(() => {
|
|
@@ -227,25 +224,27 @@ function getDayClasses(day) {
|
|
|
227
224
|
(!isSelectedDay(day) && !isSelectedToDay(day)) || props.selectedDate === null;
|
|
228
225
|
|
|
229
226
|
if (isToday(day) && isNotSelectedDate) {
|
|
230
|
-
return cx([isDayInRange &&
|
|
227
|
+
return cx([isDayInRange && props.config.inRangeDate, currentDayAttrs.value.class]);
|
|
231
228
|
}
|
|
232
229
|
|
|
233
230
|
if (props.range && isSelectedDay(day)) {
|
|
234
231
|
return cx([
|
|
235
232
|
isAnotherMothDay(day, activeMonthDate.value) && anotherMonthDayAttrs.value.class,
|
|
236
|
-
|
|
233
|
+
props.config.inRangeEdgeDate,
|
|
234
|
+
props.config.inRangeFirstDate,
|
|
237
235
|
]);
|
|
238
236
|
}
|
|
239
237
|
|
|
240
238
|
if (props.range && isSelectedToDay(day)) {
|
|
241
239
|
return cx([
|
|
242
240
|
isAnotherMothDay(day, activeMonthDate.value) && anotherMonthDayAttrs.value.class,
|
|
243
|
-
|
|
241
|
+
props.config.inRangeEdgeDate,
|
|
242
|
+
props.config.inRangeLastDate,
|
|
244
243
|
]);
|
|
245
244
|
}
|
|
246
245
|
|
|
247
246
|
if (isDayInRange) {
|
|
248
|
-
return
|
|
247
|
+
return props.config.inRangeDate;
|
|
249
248
|
}
|
|
250
249
|
|
|
251
250
|
if (isSelectedDay(day)) {
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
<script setup>
|
|
19
19
|
import { computed } from "vue";
|
|
20
|
+
|
|
20
21
|
import { formatDate, dateIsOutOfRange } from "../services/calendar.service";
|
|
21
22
|
import { isSameMonth, getDateWithoutTime, isCurrentMoth } from "../services/date.service";
|
|
23
|
+
import { cx } from "../../service.ui";
|
|
22
24
|
|
|
23
25
|
import useAttrs from "../composables/attrs.composable";
|
|
24
26
|
|
|
@@ -32,6 +34,11 @@ const props = defineProps({
|
|
|
32
34
|
required: true,
|
|
33
35
|
},
|
|
34
36
|
|
|
37
|
+
selectedDateTo: {
|
|
38
|
+
type: [Date, null],
|
|
39
|
+
default: undefined,
|
|
40
|
+
},
|
|
41
|
+
|
|
35
42
|
activeDate: {
|
|
36
43
|
type: [Date, null],
|
|
37
44
|
required: true,
|
|
@@ -49,7 +56,12 @@ const props = defineProps({
|
|
|
49
56
|
|
|
50
57
|
dateFormat: {
|
|
51
58
|
type: String,
|
|
52
|
-
|
|
59
|
+
default: undefined,
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
range: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
53
65
|
},
|
|
54
66
|
|
|
55
67
|
maxDate: {
|
|
@@ -101,26 +113,69 @@ function getMonth(monthNumber) {
|
|
|
101
113
|
}
|
|
102
114
|
|
|
103
115
|
function getMonthClasses(month) {
|
|
116
|
+
const isMonthInRange =
|
|
117
|
+
props.range &&
|
|
118
|
+
localSelectedDate.value &&
|
|
119
|
+
props.selectedDateTo &&
|
|
120
|
+
!dateIsOutOfRange(
|
|
121
|
+
month,
|
|
122
|
+
props.selectedDate,
|
|
123
|
+
props.selectedDateTo,
|
|
124
|
+
props.locale,
|
|
125
|
+
props.dateFormat,
|
|
126
|
+
);
|
|
127
|
+
|
|
104
128
|
const isNotSelectedDate =
|
|
105
129
|
(!isSelectedMonth(month) && !isSelectedMonth(month)) || props.selectedDate === null;
|
|
106
130
|
|
|
131
|
+
const isMoreThenOneMonthRange =
|
|
132
|
+
props.selectedDateTo && isMoreThanOneMonthDiff(props.selectedDate, props.selectedDateTo);
|
|
133
|
+
|
|
107
134
|
if (isCurrentMoth(month) && isNotSelectedDate) {
|
|
108
|
-
return [currentMothAttrs.value.class];
|
|
135
|
+
return cx([currentMothAttrs.value.class, isMonthInRange && props.config.inRangeDate]);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (props.range && isSelectedMonth(month) && isMoreThenOneMonthRange) {
|
|
139
|
+
return cx([props.config.inRangeEdgeDate, props.config.inRangeFirstDate]);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (props.range && isSelectedToMonth(month) && isMoreThenOneMonthRange) {
|
|
143
|
+
return cx([props.config.inRangeEdgeDate, props.config.inRangeLastDate]);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (props.range && isSelectedMonth(month) && !isMoreThenOneMonthRange) {
|
|
147
|
+
return cx([props.config.inRangeDate, "rounded-dynamic"]);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (isMonthInRange) {
|
|
151
|
+
return props.config.inRangeDate;
|
|
109
152
|
}
|
|
110
153
|
|
|
111
154
|
if (isSelectedMonth(month)) {
|
|
112
|
-
return
|
|
155
|
+
return selectedMonthAttrs.value.class;
|
|
113
156
|
}
|
|
114
157
|
|
|
115
|
-
if (isSameMonth(props.activeMonth, month)) {
|
|
116
|
-
return
|
|
158
|
+
if (isSameMonth(props.activeMonth, month) && !props.range) {
|
|
159
|
+
return activeMonthAttrs.value.class;
|
|
117
160
|
}
|
|
118
161
|
}
|
|
119
162
|
|
|
163
|
+
function isMoreThanOneMonthDiff(date, dateTo) {
|
|
164
|
+
const yearDiff = Math.abs(dateTo.getFullYear() - date.getFullYear());
|
|
165
|
+
const monthDiff = Math.abs(dateTo.getMonth() - date.getMonth());
|
|
166
|
+
const dayDiff = Math.abs(dateTo.getDate() - date.getDate());
|
|
167
|
+
|
|
168
|
+
return yearDiff > 0 || monthDiff > 1 || (monthDiff === 1 && dayDiff > 0);
|
|
169
|
+
}
|
|
170
|
+
|
|
120
171
|
function isSelectedMonth(month) {
|
|
121
172
|
return isSameMonth(month, localSelectedDate.value);
|
|
122
173
|
}
|
|
123
174
|
|
|
175
|
+
function isSelectedToMonth(month) {
|
|
176
|
+
return isSameMonth(month, props.selectedDateTo);
|
|
177
|
+
}
|
|
178
|
+
|
|
124
179
|
function onClickMonth(month) {
|
|
125
180
|
emit("input", month);
|
|
126
181
|
}
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
<script setup>
|
|
19
19
|
import { computed } from "vue";
|
|
20
|
+
|
|
20
21
|
import { formatDate, getYearsRange, dateIsOutOfRange } from "../services/calendar.service";
|
|
21
22
|
import { isSameMonth, getDateWithoutTime, isCurrentYear } from "../services/date.service";
|
|
23
|
+
import { cx } from "../../service.ui";
|
|
22
24
|
|
|
23
25
|
import useAttrs from "../composables/attrs.composable";
|
|
24
26
|
|
|
@@ -32,6 +34,11 @@ const props = defineProps({
|
|
|
32
34
|
required: true,
|
|
33
35
|
},
|
|
34
36
|
|
|
37
|
+
selectedDateTo: {
|
|
38
|
+
type: [Date, null],
|
|
39
|
+
default: undefined,
|
|
40
|
+
},
|
|
41
|
+
|
|
35
42
|
activeDate: {
|
|
36
43
|
type: [Date, null],
|
|
37
44
|
required: true,
|
|
@@ -49,7 +56,12 @@ const props = defineProps({
|
|
|
49
56
|
|
|
50
57
|
dateFormat: {
|
|
51
58
|
type: String,
|
|
52
|
-
|
|
59
|
+
default: undefined,
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
range: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
53
65
|
},
|
|
54
66
|
|
|
55
67
|
maxDate: {
|
|
@@ -105,19 +117,55 @@ function getYear(year) {
|
|
|
105
117
|
}
|
|
106
118
|
|
|
107
119
|
function getYearClasses(year) {
|
|
120
|
+
const isYearInRange =
|
|
121
|
+
props.range &&
|
|
122
|
+
localSelectedDate.value &&
|
|
123
|
+
props.selectedDateTo &&
|
|
124
|
+
!dateIsOutOfRange(
|
|
125
|
+
year,
|
|
126
|
+
props.selectedDate,
|
|
127
|
+
props.selectedDateTo,
|
|
128
|
+
props.locale,
|
|
129
|
+
props.dateFormat,
|
|
130
|
+
);
|
|
131
|
+
|
|
108
132
|
const isNotSelectedDate =
|
|
109
133
|
(!isSelectedMonth(year) && !isSelectedMonth(year)) || props.selectedDate === null;
|
|
110
134
|
|
|
135
|
+
const isMoreThanOneYearRange =
|
|
136
|
+
props.selectedDateTo &&
|
|
137
|
+
props.selectedDateTo.getFullYear() - props.selectedDate.getFullYear() > 1;
|
|
138
|
+
|
|
139
|
+
const isFirstYear = year.getFullYear() === props.selectedDate.getFullYear();
|
|
140
|
+
const isLastYear =
|
|
141
|
+
props.selectedDateTo && year.getFullYear() === props.selectedDateTo.getFullYear();
|
|
142
|
+
|
|
111
143
|
if (isCurrentYear(year) && isNotSelectedDate) {
|
|
112
|
-
return [currentYearAttrs.value.class];
|
|
144
|
+
return cx([currentYearAttrs.value.class, isYearInRange && props.config.inRangeDate]);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (props.range && isFirstYear && isMoreThanOneYearRange) {
|
|
148
|
+
return cx([props.config.inRangeEdgeDate, props.config.inRangeFirstDate]);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (props.range && isLastYear && isMoreThanOneYearRange) {
|
|
152
|
+
return cx([props.config.inRangeEdgeDate, props.config.inRangeLastDate]);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (props.range && isFirstYear && !isMoreThanOneYearRange) {
|
|
156
|
+
return cx([props.config.inRangeDate, "rounded-dynamic"]);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (isYearInRange) {
|
|
160
|
+
return props.config.inRangeDate;
|
|
113
161
|
}
|
|
114
162
|
|
|
115
163
|
if (isSelectedMonth(year)) {
|
|
116
|
-
return
|
|
164
|
+
return selectedYearAttrs.value.class;
|
|
117
165
|
}
|
|
118
166
|
|
|
119
|
-
if (isSameMonth(props.activeMonth, year)) {
|
|
120
|
-
return
|
|
167
|
+
if (isSameMonth(props.activeMonth, year) && !props.range) {
|
|
168
|
+
return activeYearAttrs.value.class;
|
|
121
169
|
}
|
|
122
170
|
}
|
|
123
171
|
|
|
@@ -17,15 +17,16 @@ export default /*tw*/ {
|
|
|
17
17
|
days: "grid grid-cols-7",
|
|
18
18
|
day: "mx-auto size-8 rounded-dynamic text-sm hover:bg-brand-100 hover:text-brand-600 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
19
19
|
activeDay: "bg-brand-100 hover:bg-brand-100",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
inRangeDate: "bg-brand-100 text-brand-900 hover:!bg-brand-200 rounded-none",
|
|
21
|
+
inRangeEdgeDate: "rounded-dynamic bg-brand-200 text-brand-900 hover:bg-brand-200",
|
|
22
|
+
inRangeFirstDate: "rounded-r-none",
|
|
23
|
+
inRangeLastDate: "rounded-l-none",
|
|
23
24
|
selectedDay: "bg-brand-600 text-white hover:bg-brand-600 hover:text-white",
|
|
24
25
|
currentDay: "hover:bg-brand-100 border-2 border-brand-600",
|
|
25
26
|
anotherMonthDay: "hover:bg-brand-100 text-gray-400",
|
|
26
27
|
monthView: "grid grid-cols-4 items-center justify-center",
|
|
27
28
|
month: "{UButton} mx-auto flex h-12 w-full rounded-dynamic",
|
|
28
|
-
selectedMonth: "bg-brand-
|
|
29
|
+
selectedMonth: "bg-brand-600 hover:bg-brand-900 text-white",
|
|
29
30
|
activeMonth: "bg-brand-100",
|
|
30
31
|
currentMoth: "border-2 border-brand-900",
|
|
31
32
|
yearView: "grid grid-cols-4 items-center justify-center",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
no-ring
|
|
12
12
|
size="sm"
|
|
13
13
|
variant="thirdary"
|
|
14
|
-
:right-icon="isCurrentView.day
|
|
14
|
+
:right-icon="isCurrentView.day ? config.defaults.viewSwitchIcon : undefined"
|
|
15
15
|
v-bind="viewSwitchButtonAttrs"
|
|
16
16
|
@mousedown.prevent.capture
|
|
17
17
|
@click="onClickViewSwitch"
|
|
@@ -69,6 +69,8 @@
|
|
|
69
69
|
<MonthView
|
|
70
70
|
v-if="isCurrentView.month"
|
|
71
71
|
:selected-date="selectedDate"
|
|
72
|
+
:selected-date-to="selectedDateTo"
|
|
73
|
+
:range="range"
|
|
72
74
|
:active-month="activeMonth"
|
|
73
75
|
:active-date="activeDate"
|
|
74
76
|
:min-date="minDate"
|
|
@@ -82,6 +84,8 @@
|
|
|
82
84
|
<YearView
|
|
83
85
|
v-if="isCurrentView.year"
|
|
84
86
|
:selected-date="selectedDate"
|
|
87
|
+
:selected-date-to="selectedDateTo"
|
|
88
|
+
:range="range"
|
|
85
89
|
:active-month="activeMonth"
|
|
86
90
|
:active-date="activeDate"
|
|
87
91
|
:min-date="minDate"
|
|
@@ -44,20 +44,28 @@ export default /*tw*/ {
|
|
|
44
44
|
periodDateYearList: "grid grid-cols-3 grid-rows-1 gap-0.5",
|
|
45
45
|
periodDateQuarterList: "",
|
|
46
46
|
periodDate: "w-full",
|
|
47
|
+
periodDateInRange: "bg-brand-100 text-brand-900 hover:!bg-brand-200 rounded-none",
|
|
48
|
+
edgePeriodDate: "rounded-dynamic bg-brand-200 text-brand-900 hover:bg-brand-200",
|
|
49
|
+
firstPeriodGridDate: "rounded-r-none",
|
|
50
|
+
lastPeriodGridDate: "rounded-l-none",
|
|
51
|
+
firstPeriodListDate: "rounded-b-none",
|
|
52
|
+
lastPeriodListDate: "rounded-t-none",
|
|
47
53
|
periodDateActive: "bg-gray-100",
|
|
48
|
-
rangeInputWrapper: "flex mt-4 -space-x-px",
|
|
54
|
+
rangeInputWrapper: "flex mt-4 -space-x-px group/range-input-wrapper",
|
|
55
|
+
rangeInputFirst: "group/range-input-first",
|
|
56
|
+
rangeInputLast: "group/range-input-last",
|
|
49
57
|
rangeInput: {
|
|
50
58
|
component: "{UInput}",
|
|
51
59
|
label: {
|
|
52
60
|
component: "{ULabel}",
|
|
53
|
-
wrapper: "
|
|
61
|
+
wrapper: "w-full hover:z-10 focus:z-10",
|
|
54
62
|
description: "hidden",
|
|
55
63
|
},
|
|
56
64
|
block: `
|
|
57
65
|
focus-within:z-10 focus-within:ring-0
|
|
58
|
-
group-
|
|
66
|
+
group-[]/range-input-first:rounded-r-none group-[]/range-input-last:rounded-l-none
|
|
59
67
|
`,
|
|
60
|
-
input: "group-
|
|
68
|
+
input: "group-[]/range-input-first:rounded-r-none group-[]/range-input-last:rounded-l-none",
|
|
61
69
|
},
|
|
62
70
|
inputRangeError: "text-xs font-normal leading-none mt-2 text-center text-red-500",
|
|
63
71
|
calendar: {
|
|
@@ -163,13 +163,13 @@
|
|
|
163
163
|
|
|
164
164
|
<div v-bind="periodDateListAttrs(getPeriodDateListClasses())">
|
|
165
165
|
<UButton
|
|
166
|
-
v-for="date in periodDateList"
|
|
166
|
+
v-for="(date, index) in periodDateList"
|
|
167
167
|
:key="date.title"
|
|
168
168
|
no-ring
|
|
169
169
|
size="sm"
|
|
170
170
|
variant="thirdary"
|
|
171
171
|
:disabled="isDatePeriodOutOfRange(date)"
|
|
172
|
-
v-bind="periodDateAttrs(getPeriodDateClasses(date))"
|
|
172
|
+
v-bind="periodDateAttrs(getPeriodDateClasses(date, index))"
|
|
173
173
|
:label="String(date.title)"
|
|
174
174
|
@click="selectDate(date), toggleMenu()"
|
|
175
175
|
/>
|
|
@@ -183,6 +183,7 @@
|
|
|
183
183
|
:error="inputRangeFromError"
|
|
184
184
|
size="md"
|
|
185
185
|
v-bind="rangeInputAttrs"
|
|
186
|
+
:class="cx([rangeInputAttrs.class, config.rangeInputFirst])"
|
|
186
187
|
:name="rangeInputName"
|
|
187
188
|
@input="onInputRangeInput($event, INPUT_RANGE_TYPE.start)"
|
|
188
189
|
/>
|
|
@@ -193,6 +194,7 @@
|
|
|
193
194
|
:error="inputRangeToError"
|
|
194
195
|
size="md"
|
|
195
196
|
v-bind="rangeInputAttrs"
|
|
197
|
+
:class="cx([rangeInputAttrs.class, config.rangeInputLast])"
|
|
196
198
|
:name="rangeInputName"
|
|
197
199
|
@input="onInputRangeInput($event, INPUT_RANGE_TYPE.end)"
|
|
198
200
|
/>
|
|
@@ -229,7 +231,7 @@ import { LOCALE_TYPE } from "../ui.form-calendar/constants";
|
|
|
229
231
|
|
|
230
232
|
import vClickOutside from "../directive.clickOutside";
|
|
231
233
|
|
|
232
|
-
import { getRandomId, getDefault } from "../service.ui";
|
|
234
|
+
import { getRandomId, getDefault, cx } from "../service.ui";
|
|
233
235
|
|
|
234
236
|
import {
|
|
235
237
|
addDays,
|
|
@@ -811,8 +813,6 @@ function onClickPeriodButton(periodName) {
|
|
|
811
813
|
|
|
812
814
|
period.value = PERIOD.year;
|
|
813
815
|
}
|
|
814
|
-
|
|
815
|
-
selectDate(periodDateList.value.at(0));
|
|
816
816
|
}
|
|
817
817
|
|
|
818
818
|
function onClickOwnRange() {
|
|
@@ -862,7 +862,7 @@ function onClickShiftDatesList(action) {
|
|
|
862
862
|
|
|
863
863
|
if (isPeriod.value.week) {
|
|
864
864
|
activeDate.value = addMonths(activeDate.value, defaultRange);
|
|
865
|
-
periodDateList.value = getWeekDateList(activeDate.value,
|
|
865
|
+
periodDateList.value = getWeekDateList(activeDate.value, locale.value.months.shorthand);
|
|
866
866
|
}
|
|
867
867
|
|
|
868
868
|
if (isPeriod.value.month) {
|
|
@@ -885,7 +885,64 @@ function getPeriodButtonsClasses(periodName) {
|
|
|
885
885
|
return period.value === periodName ? config.value.periodButtonActive : "";
|
|
886
886
|
}
|
|
887
887
|
|
|
888
|
-
function getPeriodDateClasses(date) {
|
|
888
|
+
function getPeriodDateClasses(date, index) {
|
|
889
|
+
const localStart = new Date(localValue.value.from);
|
|
890
|
+
const localEnd = new Date(localValue.value.to);
|
|
891
|
+
const isListType = isPeriod.value.quarter || isPeriod.value.week;
|
|
892
|
+
const firstInRangeClasses = cx([
|
|
893
|
+
config.value.edgePeriodDate,
|
|
894
|
+
isListType ? config.value.firstPeriodListDate : config.value.firstPeriodGridDate,
|
|
895
|
+
]);
|
|
896
|
+
const lastInRangeClasses = cx([
|
|
897
|
+
config.value.edgePeriodDate,
|
|
898
|
+
isListType ? config.value.lastPeriodListDate : config.value.lastPeriodGridDate,
|
|
899
|
+
]);
|
|
900
|
+
|
|
901
|
+
if (isPeriod.value.year) {
|
|
902
|
+
localStart.setMonth(0, 1);
|
|
903
|
+
localEnd.setMonth(11, 31);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
localStart.setHours(0, 0, 0, 0);
|
|
907
|
+
localEnd.setHours(23, 59, 59, 999);
|
|
908
|
+
|
|
909
|
+
const startDateInRangeIndex = periodDateList.value.findIndex((periodDate) => {
|
|
910
|
+
return localStart <= periodDate.endRange && localStart >= periodDate.startRange;
|
|
911
|
+
});
|
|
912
|
+
|
|
913
|
+
const endDateInRangeIndex = periodDateList.value.findIndex((periodDate) => {
|
|
914
|
+
return localEnd >= periodDate.startRange && localEnd <= periodDate.endRange;
|
|
915
|
+
});
|
|
916
|
+
|
|
917
|
+
let isInRange = index >= startDateInRangeIndex && index <= endDateInRangeIndex;
|
|
918
|
+
|
|
919
|
+
if (!~startDateInRangeIndex || !~endDateInRangeIndex) {
|
|
920
|
+
isInRange =
|
|
921
|
+
(index >= startDateInRangeIndex && startDateInRangeIndex > -1) ||
|
|
922
|
+
(index <= endDateInRangeIndex && endDateInRangeIndex > -1);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
if (
|
|
926
|
+
!~startDateInRangeIndex &&
|
|
927
|
+
periodDateList.value.at(0).startRange > localStart &&
|
|
928
|
+
!~endDateInRangeIndex &&
|
|
929
|
+
periodDateList.value.at(0).endRange < localEnd
|
|
930
|
+
) {
|
|
931
|
+
isInRange = true;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const isSingleItem =
|
|
935
|
+
startDateInRangeIndex === endDateInRangeIndex && ~endDateInRangeIndex && ~startDateInRangeIndex;
|
|
936
|
+
|
|
937
|
+
if (isInRange) {
|
|
938
|
+
return cx([
|
|
939
|
+
config.value.periodDateInRange,
|
|
940
|
+
startDateInRangeIndex === index && firstInRangeClasses,
|
|
941
|
+
endDateInRangeIndex === index && lastInRangeClasses,
|
|
942
|
+
isSingleItem && "rounded-dynamic",
|
|
943
|
+
]);
|
|
944
|
+
}
|
|
945
|
+
|
|
889
946
|
return localValue.value.from === date.startRange ? config.value.periodDateActive : "";
|
|
890
947
|
}
|
|
891
948
|
|
|
@@ -26,10 +26,9 @@ export default /*tw*/ {
|
|
|
26
26
|
{ color: "grayscale", variant: "thirdary", bordered: true, class: "border-gray-200" },
|
|
27
27
|
],
|
|
28
28
|
},
|
|
29
|
-
text: "{UText}",
|
|
30
29
|
body: "flex items-start justify-between",
|
|
30
|
+
contentWrapper: "flex gap-2",
|
|
31
31
|
content: "",
|
|
32
|
-
innerWrapper: "flex gap-2",
|
|
33
32
|
title: {
|
|
34
33
|
base: "font-bold leading-tight",
|
|
35
34
|
variants: {
|
|
@@ -42,6 +41,7 @@ export default /*tw*/ {
|
|
|
42
41
|
},
|
|
43
42
|
},
|
|
44
43
|
description: "",
|
|
44
|
+
text: "{UText}",
|
|
45
45
|
closeButton: "{UButton}",
|
|
46
46
|
closeIcon: "{UIcon}",
|
|
47
47
|
defaults: {
|