vueless 0.0.736 → 0.0.738
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/composables/useUI.ts +14 -25
- package/package.json +1 -1
- package/types.ts +1 -3
- package/ui.data-table/UTable.vue +1 -1
- package/ui.data-table/config.ts +1 -1
package/composables/useUI.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
STRATEGY_TYPE,
|
|
7
7
|
CVA_CONFIG_KEY,
|
|
8
8
|
SYSTEM_CONFIG_KEY,
|
|
9
|
-
|
|
9
|
+
DEFAULT_BASE_CLASSES,
|
|
10
10
|
EXTENDS_PATTERN_REG_EXP,
|
|
11
11
|
NESTED_COMPONENT_PATTERN_REG_EXP,
|
|
12
12
|
} from "../constants.js";
|
|
@@ -72,8 +72,8 @@ export default function useUI<T>(
|
|
|
72
72
|
function getClasses(key: string, mutatedProps?: MutatedProps) {
|
|
73
73
|
return computed(() => {
|
|
74
74
|
const mutatedPropsValue = toValue(mutatedProps);
|
|
75
|
-
const color = (toValue(mutatedProps || {}).color || props.color) as BrandColors;
|
|
76
75
|
const value = (config.value as ComponentConfigFull<T>)[key];
|
|
76
|
+
const color = (toValue(mutatedProps || {}).color || props.color) as BrandColors;
|
|
77
77
|
|
|
78
78
|
let classes = "";
|
|
79
79
|
|
|
@@ -89,12 +89,6 @@ export default function useUI<T>(
|
|
|
89
89
|
classes = value;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
if (key === (topLevelClassKey || firstClassKey)) {
|
|
93
|
-
classes = cx([classes]);
|
|
94
|
-
// TODO: It will be fixed soon
|
|
95
|
-
//classes = cx([DEFAULT_BASE_CLASSES, vuelessConfig.baseClasses, classes]);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
92
|
classes = classes.replaceAll(EXTENDS_PATTERN_REG_EXP, "");
|
|
99
93
|
|
|
100
94
|
return color && !getNestedComponent(value) ? setColor(classes, color) : classes;
|
|
@@ -122,7 +116,8 @@ export default function useUI<T>(
|
|
|
122
116
|
* Get an element attributes for a given key.
|
|
123
117
|
*/
|
|
124
118
|
function getAttrs(configKey: string, classes: ComputedRef<string>) {
|
|
125
|
-
const
|
|
119
|
+
const isTopLevelKey = (topLevelClassKey || firstClassKey) === configKey;
|
|
120
|
+
const vuelessAttrs = ref({} as KeyAttrs);
|
|
126
121
|
|
|
127
122
|
const attrs = useAttrs() as KeyAttrs;
|
|
128
123
|
|
|
@@ -141,7 +136,6 @@ export default function useUI<T>(
|
|
|
141
136
|
}
|
|
142
137
|
|
|
143
138
|
const isDev = isCSR && import.meta.env?.DEV;
|
|
144
|
-
const isTopLevelKey = (topLevelClassKey || firstClassKey) === configKey;
|
|
145
139
|
|
|
146
140
|
const extendsClasses = getExtendsClasses(configKey);
|
|
147
141
|
const extendsKeyConfig = getExtendsKeyConfig(configKey);
|
|
@@ -151,8 +145,6 @@ export default function useUI<T>(
|
|
|
151
145
|
|
|
152
146
|
const commonAttrs: KeyAttrs = {
|
|
153
147
|
...(isTopLevelKey ? attrs : {}),
|
|
154
|
-
"data-vl-root": isTopLevelKey || null,
|
|
155
|
-
"data-vl-child": attrs["data-vl-child"] ? null : true,
|
|
156
148
|
"vl-component": isDev ? attrs["vl-component"] || componentName || null : null,
|
|
157
149
|
"vl-key": isDev ? attrs["vl-key"] || configKey || null : null,
|
|
158
150
|
"vl-child-component": isDev && attrs["vl-component"] ? nestedComponent : null,
|
|
@@ -162,21 +154,9 @@ export default function useUI<T>(
|
|
|
162
154
|
/* Delete value key to prevent v-model overwrite. */
|
|
163
155
|
delete commonAttrs.value;
|
|
164
156
|
|
|
165
|
-
let topLevelClasses;
|
|
166
|
-
|
|
167
|
-
if (!commonAttrs["data-vl-child"] && !attrs["data-vl-root"]) {
|
|
168
|
-
topLevelClasses = commonAttrs.class || "";
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// console.log(configKey, isTopLevelKey, commonAttrs["data-vl-child"], attrs["data-vl-root"]);
|
|
172
|
-
|
|
173
|
-
if (isTopLevelKey) {
|
|
174
|
-
topLevelClasses = attrs.class;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
157
|
vuelessAttrs.value = {
|
|
178
158
|
...commonAttrs,
|
|
179
|
-
class: cx([...extendsClasses, toValue(classes),
|
|
159
|
+
class: cx([...extendsClasses, toValue(classes), commonAttrs.class]),
|
|
180
160
|
config: getMergedConfig({
|
|
181
161
|
defaultConfig: extendsKeyConfig,
|
|
182
162
|
globalConfig: keyConfig,
|
|
@@ -254,6 +234,15 @@ export default function useUI<T>(
|
|
|
254
234
|
return defaults;
|
|
255
235
|
}
|
|
256
236
|
|
|
237
|
+
// Injecting global base classes.
|
|
238
|
+
if (isTopLevelKey) {
|
|
239
|
+
vuelessAttrs.value.class = cx([
|
|
240
|
+
DEFAULT_BASE_CLASSES,
|
|
241
|
+
vuelessConfig.baseClasses,
|
|
242
|
+
vuelessAttrs.value.class,
|
|
243
|
+
]);
|
|
244
|
+
}
|
|
245
|
+
|
|
257
246
|
return vuelessAttrs;
|
|
258
247
|
}
|
|
259
248
|
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -310,13 +310,11 @@ export type KeyAttrsWithConfig<T> = {
|
|
|
310
310
|
} & KeyAttrs;
|
|
311
311
|
|
|
312
312
|
export interface KeyAttrs extends VueAttrs {
|
|
313
|
-
"data-vl-root"?: boolean | null;
|
|
314
|
-
"data-vl-child"?: boolean | null;
|
|
315
313
|
"vl-component"?: string | null;
|
|
316
314
|
"vl-key"?: string | null;
|
|
317
315
|
"vl-child-component"?: string | null;
|
|
318
316
|
"vl-child-key"?: string | null;
|
|
319
|
-
[key: string]: string | boolean | undefined | null;
|
|
317
|
+
[key: string]: string | boolean | unknown | undefined | null;
|
|
320
318
|
}
|
|
321
319
|
|
|
322
320
|
export interface VueAttrs {
|
package/ui.data-table/UTable.vue
CHANGED
|
@@ -357,7 +357,7 @@ function isShownDateDivider(rowIndex: number) {
|
|
|
357
357
|
const isPrevSameDate = prevItem?.rowDate === currentItem?.rowDate;
|
|
358
358
|
const isNextSameDate = nextItem?.rowDate === currentItem?.rowDate;
|
|
359
359
|
|
|
360
|
-
return isPrevSameDate &&
|
|
360
|
+
return !isPrevSameDate && isNextSameDate && props.dateDivider;
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
function onClickRow(row: Row) {
|