vueless 0.0.377 → 0.0.379
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/ui.form-calendar/useAttrs.js +184 -350
- package/ui.form-checkbox/useAttrs.js +9 -27
- package/ui.form-checkbox-group/useAttrs.js +4 -25
- package/ui.form-color-picker/useAttrs.js +3 -26
- package/ui.form-date-picker/useAttrs.js +5 -31
- package/ui.form-date-picker-range/useAttrs.js +5 -31
- package/ui.form-select/useAttrs.js +40 -89
- package/ui.form-switch/useAttrs.js +7 -26
- package/ui.form-textarea/useAttrs.js +8 -26
- package/web-types.json +1 -1
package/package.json
CHANGED
|
@@ -1,375 +1,209 @@
|
|
|
1
|
-
import useUI from "../composables/useUI.js";
|
|
2
|
-
import { cva, cx } from "../utils/utilUI.js";
|
|
3
|
-
|
|
4
1
|
import { computed } from "vue";
|
|
2
|
+
import useUI from "../composables/useUI.js";
|
|
5
3
|
|
|
6
4
|
import defaultConfig from "./config.js";
|
|
7
5
|
|
|
8
6
|
export default function useAttrs(props) {
|
|
9
|
-
const { config,
|
|
7
|
+
const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
|
|
10
8
|
defaultConfig,
|
|
11
9
|
() => props.config,
|
|
12
10
|
);
|
|
13
|
-
const attrs = {};
|
|
14
11
|
|
|
15
|
-
const
|
|
12
|
+
const extendingKeys = [
|
|
16
13
|
"firstDateInRange",
|
|
17
14
|
"lastDateInRange",
|
|
18
15
|
"anotherMonthDate",
|
|
19
16
|
"activeDate",
|
|
20
17
|
"selectedDate",
|
|
21
18
|
"currentDate",
|
|
22
|
-
"currentDay",
|
|
23
|
-
"currentDayInRange",
|
|
24
|
-
"anotherMonthDay",
|
|
25
|
-
"firstDayInRange",
|
|
26
|
-
"anotherMonthFirstDayInRange",
|
|
27
|
-
"lastDayInRange",
|
|
28
|
-
"anotherMonthLastDayInRange",
|
|
29
|
-
"selectedDay",
|
|
30
|
-
"activeDay",
|
|
31
|
-
"dayInRange",
|
|
32
19
|
"edgeDateInRange",
|
|
33
20
|
"dateInRange",
|
|
34
|
-
"
|
|
35
|
-
"currentMonthInRange",
|
|
36
|
-
"lastMonthInRange",
|
|
37
|
-
"firstMonthInRange",
|
|
38
|
-
"singleMonthInRange",
|
|
39
|
-
"monthInRange",
|
|
40
|
-
"selectedMonth",
|
|
41
|
-
"activeMonth",
|
|
42
|
-
"currentYear",
|
|
43
|
-
"currentYearInRange",
|
|
44
|
-
"firstYearInRange",
|
|
45
|
-
"lastYearInRange",
|
|
46
|
-
"yearInRange",
|
|
47
|
-
"singleYearInRange",
|
|
48
|
-
"selectedYear",
|
|
49
|
-
"activeYear",
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
const timepickerInputKeys = [
|
|
53
|
-
"timepickerInputHours",
|
|
54
|
-
"timepickerInputMinutes",
|
|
55
|
-
"timepickerInputSeconds",
|
|
21
|
+
"timepickerInput",
|
|
56
22
|
];
|
|
57
23
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
238
|
-
...attrs.monthAttrs.value,
|
|
239
|
-
class: cx([
|
|
240
|
-
attrs.monthAttrs.value.class,
|
|
241
|
-
config.value.edgeDateInRange,
|
|
242
|
-
config.value.lastDateInRange,
|
|
243
|
-
config.value.lastMonthInRange,
|
|
244
|
-
]),
|
|
245
|
-
}));
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
if (key === "firstMonthInRange") {
|
|
249
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
250
|
-
...attrs.monthAttrs.value,
|
|
251
|
-
class: cx([
|
|
252
|
-
attrs.monthAttrs.value.class,
|
|
253
|
-
config.value.edgeDateInRange,
|
|
254
|
-
config.value.firstDateInRange,
|
|
255
|
-
config.value.firstMonthInRange,
|
|
256
|
-
]),
|
|
257
|
-
}));
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (key === "selectedMonth") {
|
|
261
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
262
|
-
...attrs.monthAttrs.value,
|
|
263
|
-
class: cx([
|
|
264
|
-
attrs.monthAttrs.value.class,
|
|
265
|
-
config.value.selectedDate,
|
|
266
|
-
config.value.selectedMonth,
|
|
267
|
-
]),
|
|
268
|
-
}));
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
if (key === "activeMonth") {
|
|
272
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
273
|
-
...attrs.monthAttrs.value,
|
|
274
|
-
class: cx([
|
|
275
|
-
attrs.monthAttrs.value.class,
|
|
276
|
-
config.value.activeDate,
|
|
277
|
-
config.value.activeMonth,
|
|
278
|
-
]),
|
|
279
|
-
}));
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (key === "currentYear") {
|
|
283
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
284
|
-
...attrs.yearAttrs.value,
|
|
285
|
-
class: cx([
|
|
286
|
-
attrs.yearAttrs.value.class,
|
|
287
|
-
config.value.currentDate,
|
|
288
|
-
config.value.currentYear,
|
|
289
|
-
]),
|
|
290
|
-
}));
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (key === "yearInRange") {
|
|
294
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
295
|
-
...attrs.yearAttrs.value,
|
|
296
|
-
class: cx([
|
|
297
|
-
attrs.yearAttrs.value.class,
|
|
298
|
-
config.value.dateInRange,
|
|
299
|
-
config.value.yearInRange,
|
|
300
|
-
]),
|
|
301
|
-
}));
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
if (key === "singleYearInRange") {
|
|
305
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
306
|
-
...attrs.yearAttrs.value,
|
|
307
|
-
class: cx([
|
|
308
|
-
attrs.yearAttrs.value.class,
|
|
309
|
-
config.value.dateInRange,
|
|
310
|
-
config.value.singleYearInRange,
|
|
311
|
-
]),
|
|
312
|
-
}));
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (key === "currentYearInRange") {
|
|
316
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
317
|
-
...attrs.yearAttrs.value,
|
|
318
|
-
class: cx([
|
|
319
|
-
attrs.yearAttrs.value.class,
|
|
320
|
-
config.value.currentDate,
|
|
321
|
-
config.value.dateInRange,
|
|
322
|
-
config.value.currentYearInRange,
|
|
323
|
-
]),
|
|
324
|
-
}));
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
if (key === "lastYearInRange") {
|
|
328
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
329
|
-
...attrs.yearAttrs.value,
|
|
330
|
-
class: cx([
|
|
331
|
-
attrs.yearAttrs.value.class,
|
|
332
|
-
config.value.edgeDateInRange,
|
|
333
|
-
config.value.lastDateInRange,
|
|
334
|
-
config.value.lastYearInRange,
|
|
335
|
-
]),
|
|
336
|
-
}));
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
if (key === "firstYearInRange") {
|
|
340
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
341
|
-
...attrs.yearAttrs.value,
|
|
342
|
-
class: cx([
|
|
343
|
-
attrs.yearAttrs.value.class,
|
|
344
|
-
config.value.edgeDateInRange,
|
|
345
|
-
config.value.firstDateInRange,
|
|
346
|
-
config.value.firstYearInRange,
|
|
347
|
-
]),
|
|
348
|
-
}));
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (key === "selectedYear") {
|
|
352
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
353
|
-
...attrs.yearAttrs.value,
|
|
354
|
-
class: cx([
|
|
355
|
-
attrs.yearAttrs.value.class,
|
|
356
|
-
config.value.selectedDate,
|
|
357
|
-
config.value.selectedYear,
|
|
358
|
-
]),
|
|
359
|
-
}));
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
if (key === "activeYear") {
|
|
363
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
364
|
-
...attrs.yearAttrs.value,
|
|
365
|
-
class: cx([attrs.yearAttrs.value.class, config.value.activeDate, config.value.activeYear]),
|
|
366
|
-
}));
|
|
367
|
-
}
|
|
368
|
-
}
|
|
24
|
+
const extendingKeysClasses = getExtendingKeysClasses([...extendingKeys, "day", "month", "year"]);
|
|
25
|
+
|
|
26
|
+
const keysAttrs = getKeysAttrs({}, extendingKeys, {
|
|
27
|
+
timepickerInputHours: {
|
|
28
|
+
base: computed(() => [extendingKeysClasses.timepickerInput.value]),
|
|
29
|
+
},
|
|
30
|
+
timepickerInputMinutes: {
|
|
31
|
+
base: computed(() => [extendingKeysClasses.timepickerInput.value]),
|
|
32
|
+
},
|
|
33
|
+
timepickerInputSeconds: {
|
|
34
|
+
base: computed(() => [extendingKeysClasses.timepickerInput.value]),
|
|
35
|
+
},
|
|
36
|
+
dayInRange: {
|
|
37
|
+
base: computed(() => [
|
|
38
|
+
extendingKeysClasses.day.value,
|
|
39
|
+
extendingKeysClasses.dateInRange.value,
|
|
40
|
+
]),
|
|
41
|
+
},
|
|
42
|
+
selectedDay: {
|
|
43
|
+
base: computed(() => [
|
|
44
|
+
extendingKeysClasses.day.value,
|
|
45
|
+
extendingKeysClasses.selectedDate.value,
|
|
46
|
+
]),
|
|
47
|
+
},
|
|
48
|
+
activeDay: {
|
|
49
|
+
base: computed(() => [extendingKeysClasses.day.value, extendingKeysClasses.activeDate.value]),
|
|
50
|
+
},
|
|
51
|
+
anotherMonthDay: {
|
|
52
|
+
base: computed(() => [
|
|
53
|
+
extendingKeysClasses.day.value,
|
|
54
|
+
extendingKeysClasses.anotherMonthDate.value,
|
|
55
|
+
]),
|
|
56
|
+
},
|
|
57
|
+
currentDay: {
|
|
58
|
+
base: computed(() => [
|
|
59
|
+
extendingKeysClasses.day.value,
|
|
60
|
+
extendingKeysClasses.currentDate.value,
|
|
61
|
+
]),
|
|
62
|
+
},
|
|
63
|
+
currentDayInRange: {
|
|
64
|
+
base: computed(() => [
|
|
65
|
+
extendingKeysClasses.day.value,
|
|
66
|
+
extendingKeysClasses.dateInRange.value,
|
|
67
|
+
extendingKeysClasses.currentDate.value,
|
|
68
|
+
]),
|
|
69
|
+
},
|
|
70
|
+
firstDayInRange: {
|
|
71
|
+
base: computed(() => [
|
|
72
|
+
extendingKeysClasses.day.value,
|
|
73
|
+
extendingKeysClasses.edgeDateInRange.value,
|
|
74
|
+
extendingKeysClasses.firstDateInRange.value,
|
|
75
|
+
]),
|
|
76
|
+
},
|
|
77
|
+
lastDayInRange: {
|
|
78
|
+
base: computed(() => [
|
|
79
|
+
extendingKeysClasses.day.value,
|
|
80
|
+
extendingKeysClasses.edgeDateInRange.value,
|
|
81
|
+
extendingKeysClasses.lastDateInRange.value,
|
|
82
|
+
]),
|
|
83
|
+
},
|
|
84
|
+
anotherMonthLastDayInRange: {
|
|
85
|
+
base: computed(() => [
|
|
86
|
+
extendingKeysClasses.day.value,
|
|
87
|
+
extendingKeysClasses.anotherMonthDay.value,
|
|
88
|
+
extendingKeysClasses.edgeDateInRange.value,
|
|
89
|
+
extendingKeysClasses.lastDateInRange.value,
|
|
90
|
+
]),
|
|
91
|
+
},
|
|
92
|
+
anotherMonthFirstDayInRange: {
|
|
93
|
+
base: computed(() => [
|
|
94
|
+
extendingKeysClasses.day.value,
|
|
95
|
+
extendingKeysClasses.anotherMonthDay.value,
|
|
96
|
+
extendingKeysClasses.edgeDateInRange.value,
|
|
97
|
+
extendingKeysClasses.firstDateInRange.value,
|
|
98
|
+
]),
|
|
99
|
+
},
|
|
100
|
+
currentMonth: {
|
|
101
|
+
base: computed(() => [
|
|
102
|
+
extendingKeysClasses.month.value,
|
|
103
|
+
extendingKeysClasses.currentDate.value,
|
|
104
|
+
]),
|
|
105
|
+
},
|
|
106
|
+
monthInRange: {
|
|
107
|
+
base: computed(() => [
|
|
108
|
+
extendingKeysClasses.month.value,
|
|
109
|
+
extendingKeysClasses.dateInRange.value,
|
|
110
|
+
]),
|
|
111
|
+
},
|
|
112
|
+
singleMonthInRange: {
|
|
113
|
+
base: computed(() => [
|
|
114
|
+
extendingKeysClasses.month.value,
|
|
115
|
+
extendingKeysClasses.dateInRange.value,
|
|
116
|
+
]),
|
|
117
|
+
},
|
|
118
|
+
currentMonthInRange: {
|
|
119
|
+
base: computed(() => [
|
|
120
|
+
extendingKeysClasses.month.value,
|
|
121
|
+
extendingKeysClasses.currentDate.value,
|
|
122
|
+
extendingKeysClasses.dateInRange.value,
|
|
123
|
+
]),
|
|
124
|
+
},
|
|
125
|
+
lastMonthInRange: {
|
|
126
|
+
base: computed(() => [
|
|
127
|
+
extendingKeysClasses.month.value,
|
|
128
|
+
extendingKeysClasses.edgeDateInRange.value,
|
|
129
|
+
extendingKeysClasses.lastDateInRange.value,
|
|
130
|
+
]),
|
|
131
|
+
},
|
|
132
|
+
firstMonthInRange: {
|
|
133
|
+
base: computed(() => [
|
|
134
|
+
extendingKeysClasses.month.value,
|
|
135
|
+
extendingKeysClasses.edgeDateInRange.value,
|
|
136
|
+
extendingKeysClasses.firstDateInRange.value,
|
|
137
|
+
]),
|
|
138
|
+
},
|
|
139
|
+
selectedMonth: {
|
|
140
|
+
base: computed(() => [
|
|
141
|
+
extendingKeysClasses.month.value,
|
|
142
|
+
extendingKeysClasses.selectedDate.value,
|
|
143
|
+
]),
|
|
144
|
+
},
|
|
145
|
+
activeMonth: {
|
|
146
|
+
base: computed(() => [
|
|
147
|
+
extendingKeysClasses.month.value,
|
|
148
|
+
extendingKeysClasses.activeDate.value,
|
|
149
|
+
]),
|
|
150
|
+
},
|
|
151
|
+
currentYear: {
|
|
152
|
+
base: computed(() => [
|
|
153
|
+
extendingKeysClasses.year.value,
|
|
154
|
+
extendingKeysClasses.currentDate.value,
|
|
155
|
+
]),
|
|
156
|
+
},
|
|
157
|
+
yearInRange: {
|
|
158
|
+
base: computed(() => [
|
|
159
|
+
extendingKeysClasses.year.value,
|
|
160
|
+
extendingKeysClasses.dateInRange.value,
|
|
161
|
+
]),
|
|
162
|
+
},
|
|
163
|
+
singleYearInRange: {
|
|
164
|
+
base: computed(() => [
|
|
165
|
+
extendingKeysClasses.year.value,
|
|
166
|
+
extendingKeysClasses.dateInRange.value,
|
|
167
|
+
]),
|
|
168
|
+
},
|
|
169
|
+
currentYearInRange: {
|
|
170
|
+
base: computed(() => [
|
|
171
|
+
extendingKeysClasses.year.value,
|
|
172
|
+
extendingKeysClasses.currentDate.value,
|
|
173
|
+
extendingKeysClasses.dateInRange.value,
|
|
174
|
+
]),
|
|
175
|
+
},
|
|
176
|
+
lastYearInRange: {
|
|
177
|
+
base: computed(() => [
|
|
178
|
+
extendingKeysClasses.year.value,
|
|
179
|
+
extendingKeysClasses.edgeDateInRange.value,
|
|
180
|
+
extendingKeysClasses.lastDateInRange.value,
|
|
181
|
+
]),
|
|
182
|
+
},
|
|
183
|
+
firstYearInRange: {
|
|
184
|
+
base: computed(() => [
|
|
185
|
+
extendingKeysClasses.year.value,
|
|
186
|
+
extendingKeysClasses.edgeDateInRange.value,
|
|
187
|
+
extendingKeysClasses.firstDateInRange.value,
|
|
188
|
+
]),
|
|
189
|
+
},
|
|
190
|
+
selectedYear: {
|
|
191
|
+
base: computed(() => [
|
|
192
|
+
extendingKeysClasses.year.value,
|
|
193
|
+
extendingKeysClasses.selectedDate.value,
|
|
194
|
+
]),
|
|
195
|
+
},
|
|
196
|
+
activeYear: {
|
|
197
|
+
base: computed(() => [
|
|
198
|
+
extendingKeysClasses.year.value,
|
|
199
|
+
extendingKeysClasses.activeDate.value,
|
|
200
|
+
]),
|
|
201
|
+
},
|
|
202
|
+
});
|
|
369
203
|
|
|
370
204
|
return {
|
|
371
|
-
...attrs,
|
|
372
205
|
config,
|
|
206
|
+
...keysAttrs,
|
|
373
207
|
hasSlotContent,
|
|
374
208
|
};
|
|
375
209
|
}
|
|
@@ -1,41 +1,23 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import useUI from "../composables/useUI.js";
|
|
3
|
-
import { cva } from "../utils/utilUI.js";
|
|
4
3
|
|
|
5
4
|
import defaultConfig from "./config.js";
|
|
6
5
|
|
|
7
6
|
export default function useAttrs(props, { checkboxColor, checkboxSize }) {
|
|
8
|
-
const { config,
|
|
9
|
-
defaultConfig,
|
|
10
|
-
() => props.config,
|
|
11
|
-
);
|
|
12
|
-
const attrs = {};
|
|
7
|
+
const { config, getKeysAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
const mutatedProps = computed(() => ({
|
|
10
|
+
color: checkboxColor.value,
|
|
11
|
+
size: checkboxSize.value,
|
|
12
|
+
label: Boolean(props.label),
|
|
13
|
+
error: Boolean(props.error),
|
|
14
|
+
}));
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
let value = config.value[key];
|
|
19
|
-
|
|
20
|
-
if (isCVA(value)) {
|
|
21
|
-
value = cva(value)({
|
|
22
|
-
...props,
|
|
23
|
-
size: checkboxSize.value,
|
|
24
|
-
label: Boolean(props.label),
|
|
25
|
-
error: Boolean(props.error),
|
|
26
|
-
color: getColor(checkboxColor.value),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return setColor(value, checkboxColor.value);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
34
|
-
}
|
|
16
|
+
const keysAttrs = getKeysAttrs(mutatedProps);
|
|
35
17
|
|
|
36
18
|
return {
|
|
37
|
-
...attrs,
|
|
38
19
|
config,
|
|
20
|
+
...keysAttrs,
|
|
39
21
|
hasSlotContent,
|
|
40
22
|
};
|
|
41
23
|
}
|
|
@@ -1,36 +1,15 @@
|
|
|
1
1
|
import useUI from "../composables/useUI.js";
|
|
2
|
-
|
|
3
|
-
import { cva } from "../utils/utilUI.js";
|
|
2
|
+
|
|
4
3
|
import defaultConfig from "./config.js";
|
|
5
4
|
|
|
6
5
|
export default function useAttrs(props) {
|
|
7
|
-
const { config,
|
|
8
|
-
defaultConfig,
|
|
9
|
-
() => props.config,
|
|
10
|
-
);
|
|
11
|
-
const attrs = {};
|
|
12
|
-
|
|
13
|
-
for (const key in defaultConfig) {
|
|
14
|
-
if (isSystemKey(key)) continue;
|
|
15
|
-
|
|
16
|
-
const classes = computed(() => {
|
|
17
|
-
let value = config.value[key];
|
|
18
|
-
|
|
19
|
-
if (isCVA(value)) {
|
|
20
|
-
value = cva(value)({
|
|
21
|
-
...props,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return value;
|
|
26
|
-
});
|
|
6
|
+
const { config, getKeysAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
|
|
27
7
|
|
|
28
|
-
|
|
29
|
-
}
|
|
8
|
+
const keysAttrs = getKeysAttrs();
|
|
30
9
|
|
|
31
10
|
return {
|
|
32
|
-
...attrs,
|
|
33
11
|
config,
|
|
12
|
+
...keysAttrs,
|
|
34
13
|
hasSlotContent,
|
|
35
14
|
};
|
|
36
15
|
}
|
|
@@ -1,38 +1,15 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
2
1
|
import useUI from "../composables/useUI.js";
|
|
3
|
-
import { cva } from "../utils/utilUI.js";
|
|
4
2
|
|
|
5
3
|
import defaultConfig from "./config.js";
|
|
6
4
|
|
|
7
5
|
export default function useAttrs(props) {
|
|
8
|
-
const { config,
|
|
9
|
-
defaultConfig,
|
|
10
|
-
() => props.config,
|
|
11
|
-
);
|
|
12
|
-
const attrs = {};
|
|
6
|
+
const { config, getKeysAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
|
|
13
7
|
|
|
14
|
-
|
|
15
|
-
if (isSystemKey(key)) continue;
|
|
16
|
-
|
|
17
|
-
const classes = computed(() => {
|
|
18
|
-
let value = config.value[key];
|
|
19
|
-
|
|
20
|
-
if (isCVA(value)) {
|
|
21
|
-
value = cva(value)({
|
|
22
|
-
...props,
|
|
23
|
-
color: getColor(props.color),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return setColor(value, props.color);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
31
|
-
}
|
|
8
|
+
const keysAttrs = getKeysAttrs();
|
|
32
9
|
|
|
33
10
|
return {
|
|
34
|
-
...attrs,
|
|
35
11
|
config,
|
|
12
|
+
...keysAttrs,
|
|
36
13
|
hasSlotContent,
|
|
37
14
|
};
|
|
38
15
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import useUI from "../composables/useUI.js";
|
|
2
2
|
import { cva } from "../utils/utilUI.js";
|
|
3
3
|
import { computed, watchEffect } from "vue";
|
|
4
|
+
import { merge } from "lodash-es";
|
|
4
5
|
|
|
5
6
|
import defaultConfig from "./config.js";
|
|
6
7
|
import { POSITION } from "../composables/useAutoPosition.js";
|
|
@@ -46,39 +47,12 @@ export default function useAttrs(props, { isShownCalendar, isTop, isRight }) {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
if (key === "calendar") {
|
|
49
|
-
|
|
50
|
-
// Watcher will not rewrite custom calendar locales
|
|
50
|
+
/* Merging DatePicker's i18n translations into Calendar's i18n translations. */
|
|
51
51
|
watchEffect(() => {
|
|
52
|
-
|
|
53
|
-
attrs[`${key}Attrs`].value.config = {};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (attrs[`${key}Attrs`].value.config.i18n || !props.config.i18n) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
attrs[`${key}Attrs`].value.config.i18n = {
|
|
61
|
-
...config.value.i18n,
|
|
62
|
-
weekdays: {
|
|
63
|
-
shorthand: { ...config.value.i18n.weekdays.shorthand },
|
|
64
|
-
longhand: { ...config.value.i18n.weekdays.longhand },
|
|
65
|
-
},
|
|
66
|
-
months: {
|
|
67
|
-
shorthand: { ...config.value.i18n.months.shorthand },
|
|
68
|
-
longhand: { ...config.value.i18n.months.longhand },
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
if (props.config.i18n.weekdays.userFormat) {
|
|
73
|
-
attrs[`${key}Attrs`].value.config.i18n.userFormat = {
|
|
74
|
-
...config.value.i18n.weekdays.userFormat,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
52
|
+
const calendarConfig = attrs[`${key}Attrs`].value.config || {};
|
|
77
53
|
|
|
78
|
-
if (props.config.i18n
|
|
79
|
-
attrs[`${key}Attrs`].value.config.i18n
|
|
80
|
-
...config.value.i18n.months.userFormat,
|
|
81
|
-
};
|
|
54
|
+
if (!calendarConfig.i18n || props.config.i18n) {
|
|
55
|
+
attrs[`${key}Attrs`].value.config.i18n = merge(calendarConfig.i18n, config.value.i18n);
|
|
82
56
|
}
|
|
83
57
|
});
|
|
84
58
|
}
|
|
@@ -2,6 +2,7 @@ import useUI from "../composables/useUI.js";
|
|
|
2
2
|
import { cx, cva } from "../utils/utilUI.js";
|
|
3
3
|
|
|
4
4
|
import { computed, watchEffect } from "vue";
|
|
5
|
+
import { merge } from "lodash-es";
|
|
5
6
|
|
|
6
7
|
import defaultConfig from "./config.js";
|
|
7
8
|
import { POSITION } from "../composables/useAutoPosition.js";
|
|
@@ -85,39 +86,12 @@ export default function useAttrs(props, { isShownMenu, isTop, isRight, isPeriod
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
if (key === "calendar") {
|
|
88
|
-
|
|
89
|
-
// Watcher will not rewrite custom calendar locales
|
|
89
|
+
/* Merging DatePickerRange's i18n translations into Calendar's i18n translations. */
|
|
90
90
|
watchEffect(() => {
|
|
91
|
-
|
|
92
|
-
attrs[`${key}Attrs`].value.config = {};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (attrs[`${key}Attrs`].value.config.i18n || !props.config.i18n) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
attrs[`${key}Attrs`].value.config.i18n = {
|
|
100
|
-
...config.value.i18n,
|
|
101
|
-
weekdays: {
|
|
102
|
-
shorthand: { ...config.value.i18n.weekdays.shorthand },
|
|
103
|
-
longhand: { ...config.value.i18n.weekdays.longhand },
|
|
104
|
-
},
|
|
105
|
-
months: {
|
|
106
|
-
shorthand: { ...config.value.i18n.months.shorthand },
|
|
107
|
-
longhand: { ...config.value.i18n.months.longhand },
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
if (props.config.i18n.weekdays.userFormat) {
|
|
112
|
-
attrs[`${key}Attrs`].value.config.i18n.userFormat = {
|
|
113
|
-
...config.value.i18n.weekdays.userFormat,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
91
|
+
const calendarConfig = attrs[`${key}Attrs`].value.config || {};
|
|
116
92
|
|
|
117
|
-
if (props.config.i18n
|
|
118
|
-
attrs[`${key}Attrs`].value.config.i18n
|
|
119
|
-
...config.value.i18n.months.userFormat,
|
|
120
|
-
};
|
|
93
|
+
if (!calendarConfig.i18n || props.config.i18n) {
|
|
94
|
+
attrs[`${key}Attrs`].value.config.i18n = merge(calendarConfig.i18n, config.value.i18n);
|
|
121
95
|
}
|
|
122
96
|
});
|
|
123
97
|
}
|
|
@@ -1,104 +1,55 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import useUI from "../composables/useUI.js";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
5
|
|
|
6
6
|
export default function useAttrs(props, { isTop, isOpen, selectedLabel: selectedLabelValue }) {
|
|
7
|
-
const { config,
|
|
7
|
+
const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
|
|
8
8
|
defaultConfig,
|
|
9
9
|
() => props.config,
|
|
10
10
|
);
|
|
11
|
-
const attrs = {};
|
|
12
|
-
|
|
13
|
-
const caretClasses = computed(() =>
|
|
14
|
-
cva(config.value.caret)({
|
|
15
|
-
...props,
|
|
16
|
-
error: Boolean(props.error),
|
|
17
|
-
label: Boolean(props.label),
|
|
18
|
-
}),
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
for (const key in defaultConfig) {
|
|
22
|
-
if (isSystemKey(key)) continue;
|
|
23
|
-
|
|
24
|
-
const classes = computed(() => {
|
|
25
|
-
let value = config.value[key];
|
|
26
|
-
|
|
27
|
-
if (isCVA(value)) {
|
|
28
|
-
value = cva(value)({
|
|
29
|
-
...props,
|
|
30
|
-
error: Boolean(props.error),
|
|
31
|
-
label: Boolean(props.label),
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return value;
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
39
|
-
|
|
40
|
-
if (key === "wrapper") {
|
|
41
|
-
const wrapperAttrs = attrs[`${key}Attrs`];
|
|
42
|
-
|
|
43
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
44
|
-
...wrapperAttrs.value,
|
|
45
|
-
class: cx([wrapperAttrs.value.class, isOpen.value && config.value.wrapperActive]),
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (key === "label") {
|
|
50
|
-
const labelAttrs = attrs[`${key}Attrs`];
|
|
51
|
-
|
|
52
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
53
|
-
...labelAttrs.value,
|
|
54
|
-
class: cx([
|
|
55
|
-
labelAttrs.value.class,
|
|
56
|
-
isOpen.value && config.value.labelWrapperActive,
|
|
57
|
-
isTop.value && config.value.labelWrapperTop,
|
|
58
|
-
]),
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (key === "toggle") {
|
|
63
|
-
const toggleAttrs = attrs[`${key}Attrs`];
|
|
64
|
-
|
|
65
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
66
|
-
...toggleAttrs.value,
|
|
67
|
-
class: cx([toggleAttrs.value.class, caretClasses.value]),
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
key === "toggle" ||
|
|
73
|
-
key === "clear" ||
|
|
74
|
-
key === "beforeCaret" ||
|
|
75
|
-
key === "afterCaret" ||
|
|
76
|
-
key === "rightIconWrapper"
|
|
77
|
-
) {
|
|
78
|
-
const keyAttrs = attrs[`${key}Attrs`];
|
|
79
|
-
|
|
80
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
81
|
-
...keyAttrs.value,
|
|
82
|
-
class: cx([keyAttrs.value.class, caretClasses.value]),
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (key === "search") {
|
|
87
|
-
const searchAttrs = attrs[`${key}Attrs`];
|
|
88
11
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
12
|
+
const mutatedProps = computed(() => ({
|
|
13
|
+
error: Boolean(props.error),
|
|
14
|
+
label: Boolean(props.label),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
const extendingKeys = ["caret", "wrapperActive", "labelWrapperActive", "labelWrapperTop"];
|
|
18
|
+
const extendingKeysClasses = getExtendingKeysClasses(extendingKeys);
|
|
19
|
+
|
|
20
|
+
const keysAttrs = getKeysAttrs(mutatedProps, extendingKeys, {
|
|
21
|
+
wrapper: {
|
|
22
|
+
extend: computed(() => [isOpen.value && extendingKeysClasses.wrapperActive.value]),
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
extend: computed(() => [
|
|
26
|
+
isOpen.value && extendingKeysClasses.labelWrapperActive.value,
|
|
27
|
+
isTop.value && extendingKeysClasses.labelWrapperTop.value,
|
|
28
|
+
]),
|
|
29
|
+
},
|
|
30
|
+
toggle: {
|
|
31
|
+
base: computed(() => [extendingKeysClasses.caret.value]),
|
|
32
|
+
},
|
|
33
|
+
clear: {
|
|
34
|
+
base: computed(() => [extendingKeysClasses.caret.value]),
|
|
35
|
+
},
|
|
36
|
+
beforeCaret: {
|
|
37
|
+
base: computed(() => [extendingKeysClasses.caret.value]),
|
|
38
|
+
},
|
|
39
|
+
afterCaret: {
|
|
40
|
+
base: computed(() => [extendingKeysClasses.caret.value]),
|
|
41
|
+
},
|
|
42
|
+
rightIconWrapper: {
|
|
43
|
+
base: computed(() => [extendingKeysClasses.caret.value]),
|
|
44
|
+
},
|
|
45
|
+
search: {
|
|
46
|
+
extend: computed(() => [Boolean(selectedLabelValue.value) && !isOpen.value && "w-0"]),
|
|
47
|
+
},
|
|
48
|
+
});
|
|
98
49
|
|
|
99
50
|
return {
|
|
100
|
-
...attrs,
|
|
101
51
|
config,
|
|
52
|
+
...keysAttrs,
|
|
102
53
|
hasSlotContent,
|
|
103
54
|
};
|
|
104
55
|
}
|
|
@@ -1,39 +1,20 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
1
2
|
import useUI from "../composables/useUI.js";
|
|
2
|
-
import { cva } from "../utils/utilUI.js";
|
|
3
3
|
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
|
-
import { computed } from "vue";
|
|
6
5
|
|
|
7
6
|
export default function useAttrs(props, { checked }) {
|
|
8
|
-
const { config,
|
|
9
|
-
defaultConfig,
|
|
10
|
-
() => props.config,
|
|
11
|
-
);
|
|
12
|
-
const attrs = {};
|
|
13
|
-
|
|
14
|
-
for (const key in defaultConfig) {
|
|
15
|
-
if (isSystemKey(key)) continue;
|
|
16
|
-
|
|
17
|
-
const classes = computed(() => {
|
|
18
|
-
let value = config.value[key];
|
|
19
|
-
|
|
20
|
-
if (isCVA(value)) {
|
|
21
|
-
value = cva(value)({
|
|
22
|
-
...props,
|
|
23
|
-
color: getColor(props.color),
|
|
24
|
-
checked: Boolean(checked.value),
|
|
25
|
-
});
|
|
26
|
-
}
|
|
7
|
+
const { config, getKeysAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
|
|
27
8
|
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
const mutatedProps = computed(() => ({
|
|
10
|
+
checked: Boolean(checked.value),
|
|
11
|
+
}));
|
|
30
12
|
|
|
31
|
-
|
|
32
|
-
}
|
|
13
|
+
const keysAttrs = getKeysAttrs(mutatedProps);
|
|
33
14
|
|
|
34
15
|
return {
|
|
35
|
-
...attrs,
|
|
36
16
|
config,
|
|
17
|
+
...keysAttrs,
|
|
37
18
|
hasSlotContent,
|
|
38
19
|
};
|
|
39
20
|
}
|
|
@@ -1,39 +1,21 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
1
2
|
import useUI from "../composables/useUI.js";
|
|
2
|
-
import { cva } from "../utils/utilUI.js";
|
|
3
3
|
|
|
4
4
|
import defaultConfig from "./config.js";
|
|
5
|
-
import { computed } from "vue";
|
|
6
5
|
|
|
7
6
|
export default function useAttrs(props) {
|
|
8
|
-
const { config,
|
|
9
|
-
defaultConfig,
|
|
10
|
-
() => props.config,
|
|
11
|
-
);
|
|
12
|
-
const attrs = {};
|
|
13
|
-
|
|
14
|
-
for (const key in defaultConfig) {
|
|
15
|
-
if (isSystemKey(key)) continue;
|
|
16
|
-
|
|
17
|
-
const classes = computed(() => {
|
|
18
|
-
let value = config.value[key];
|
|
19
|
-
|
|
20
|
-
if (isCVA(value)) {
|
|
21
|
-
value = cva(value)({
|
|
22
|
-
...props,
|
|
23
|
-
error: Boolean(props.error),
|
|
24
|
-
label: Boolean(props.label),
|
|
25
|
-
});
|
|
26
|
-
}
|
|
7
|
+
const { config, getKeysAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
|
|
27
8
|
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
const mutatedProps = computed(() => ({
|
|
10
|
+
error: Boolean(props.error),
|
|
11
|
+
label: Boolean(props.label),
|
|
12
|
+
}));
|
|
30
13
|
|
|
31
|
-
|
|
32
|
-
}
|
|
14
|
+
const keysAttrs = getKeysAttrs(mutatedProps);
|
|
33
15
|
|
|
34
16
|
return {
|
|
35
|
-
...attrs,
|
|
36
17
|
config,
|
|
18
|
+
...keysAttrs,
|
|
37
19
|
hasSlotContent,
|
|
38
20
|
};
|
|
39
21
|
}
|