vueless 0.0.498 → 0.0.500
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/UCalendar.vue +8 -2
- package/utils/node/mergeConfigs.js +42 -11
- package/web-types.json +1 -1
package/package.json
CHANGED
|
@@ -340,7 +340,7 @@ const unwatchInit = watch(
|
|
|
340
340
|
() => {
|
|
341
341
|
if (isInit) unwatchInit();
|
|
342
342
|
|
|
343
|
-
if (selectedDate.value && isTimepickerEnabled.value && isInputRefs.value) {
|
|
343
|
+
if (selectedDate.value && isTimepickerEnabled.value && isInputRefs.value && props.timepicker) {
|
|
344
344
|
hoursRef.value!.value = String(selectedDate.value.getHours()).padStart(2, "0");
|
|
345
345
|
minutesRef.value!.value = String(selectedDate.value.getMinutes()).padStart(2, "0");
|
|
346
346
|
secondsRef.value!.value = String(selectedDate.value.getSeconds()).padStart(2, "0");
|
|
@@ -349,8 +349,14 @@ const unwatchInit = watch(
|
|
|
349
349
|
|
|
350
350
|
isInit = true;
|
|
351
351
|
}
|
|
352
|
+
|
|
353
|
+
if (selectedDate.value) {
|
|
354
|
+
emit("userDateChange", userFormattedDate.value);
|
|
355
|
+
|
|
356
|
+
isInit = true;
|
|
357
|
+
}
|
|
352
358
|
},
|
|
353
|
-
{ deep: true },
|
|
359
|
+
{ deep: true, immediate: true },
|
|
354
360
|
);
|
|
355
361
|
|
|
356
362
|
function getCurrentValueType(value: DateValue): DateValue {
|
|
@@ -131,10 +131,11 @@ export function createMergeConfigs(cx) {
|
|
|
131
131
|
console.error("CompoundVariants should be an array.");
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
const
|
|
135
|
-
const
|
|
134
|
+
const defaultCompoundVariants = expandCompoundVariants(defaultConfig.compoundVariants);
|
|
135
|
+
const globalCompoundVariants = expandCompoundVariants(globalConfig.compoundVariants);
|
|
136
|
+
const propsCompoundVariants = expandCompoundVariants(propsConfig.compoundVariants);
|
|
136
137
|
|
|
137
|
-
const config =
|
|
138
|
+
const config = defaultCompoundVariants?.map((defaultConfigItem) => {
|
|
138
139
|
/**
|
|
139
140
|
* Compare two objects by keys for match.
|
|
140
141
|
*/
|
|
@@ -151,25 +152,27 @@ export function createMergeConfigs(cx) {
|
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
/**
|
|
154
|
-
* Find the same compound variant item in custom config if
|
|
155
|
+
* Find the same compound variant item in custom config if existed.
|
|
155
156
|
*/
|
|
156
157
|
function findItem(config = []) {
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
config = cloneDeep(config);
|
|
159
|
+
|
|
160
|
+
const globalConfigUniqueItemIndex = globalCompoundVariants.findIndex(isSameItem);
|
|
161
|
+
const propsConfigUniqueItemIndex = propsCompoundVariants.findIndex(isSameItem);
|
|
159
162
|
|
|
160
163
|
if (~globalConfigUniqueItemIndex) {
|
|
161
|
-
|
|
164
|
+
globalCompoundVariants.splice(globalConfigUniqueItemIndex, 1);
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
if (~propsConfigUniqueItemIndex) {
|
|
165
|
-
|
|
168
|
+
propsCompoundVariants.splice(propsConfigUniqueItemIndex, 1);
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
return config.find(isSameItem);
|
|
169
172
|
}
|
|
170
173
|
|
|
171
|
-
const globalConfigItem = findItem(
|
|
172
|
-
const propsConfigItem = findItem(
|
|
174
|
+
const globalConfigItem = findItem(globalCompoundVariants);
|
|
175
|
+
const propsConfigItem = findItem(propsCompoundVariants);
|
|
173
176
|
|
|
174
177
|
return globalConfigItem || propsConfigItem
|
|
175
178
|
? {
|
|
@@ -181,7 +184,35 @@ export function createMergeConfigs(cx) {
|
|
|
181
184
|
: defaultConfigItem;
|
|
182
185
|
});
|
|
183
186
|
|
|
184
|
-
return [...(config || []), ...
|
|
187
|
+
return [...(config || []), ...globalCompoundVariants, ...propsCompoundVariants];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Convert compound variants with arrays in values into compound variants with primitives.
|
|
192
|
+
*/
|
|
193
|
+
function expandCompoundVariants(compoundVariants) {
|
|
194
|
+
compoundVariants = cloneDeep(compoundVariants || []);
|
|
195
|
+
|
|
196
|
+
function expand(compoundVariant) {
|
|
197
|
+
const keysWithArray = Object.keys(compoundVariant).filter((key) =>
|
|
198
|
+
Array.isArray(compoundVariant[key]),
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
if (!keysWithArray.length) {
|
|
202
|
+
return [compoundVariant];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const [firstKey] = keysWithArray;
|
|
206
|
+
const expandedArray = compoundVariant[firstKey].map((value) => ({
|
|
207
|
+
...compoundVariant,
|
|
208
|
+
[firstKey]: value,
|
|
209
|
+
}));
|
|
210
|
+
|
|
211
|
+
// Recursively expand the remaining array keys
|
|
212
|
+
return expandedArray.flatMap((expandedCompoundVariant) => expand(expandedCompoundVariant));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return compoundVariants.flatMap(expand);
|
|
185
216
|
}
|
|
186
217
|
|
|
187
218
|
return mergeConfigs;
|