vueless 0.0.655 → 0.0.657
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
CHANGED
package/package.json
CHANGED
package/ui.form-label/ULabel.vue
CHANGED
|
@@ -3,6 +3,7 @@ import { computed, ref } from "vue";
|
|
|
3
3
|
|
|
4
4
|
import useUI from "../composables/useUI.ts";
|
|
5
5
|
import { getDefaults } from "../utils/ui.ts";
|
|
6
|
+
import { hasSlotContent } from "../utils/helper.ts";
|
|
6
7
|
|
|
7
8
|
import defaultConfig from "./config.ts";
|
|
8
9
|
import { COMPONENT_NAME, PLACEMENT } from "./constants.ts";
|
|
@@ -87,8 +88,14 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
|
|
|
87
88
|
</div>
|
|
88
89
|
|
|
89
90
|
<!-- `v-bind` isn't assigned, because the div is system -->
|
|
90
|
-
<div v-if="label || error || description">
|
|
91
|
-
<label
|
|
91
|
+
<div v-if="label || hasSlotContent($slots['label']) || error || description">
|
|
92
|
+
<label
|
|
93
|
+
v-if="label || hasSlotContent($slots['label'])"
|
|
94
|
+
ref="labelRef"
|
|
95
|
+
:for="props.for"
|
|
96
|
+
v-bind="labelAttrs"
|
|
97
|
+
:data-test="`${dataTest}-label`"
|
|
98
|
+
>
|
|
92
99
|
<!--
|
|
93
100
|
@slot Use this to add custom content instead of the label.
|
|
94
101
|
@binding {string} label
|
|
@@ -113,7 +120,13 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
|
|
|
113
120
|
</div>
|
|
114
121
|
|
|
115
122
|
<div v-else v-bind="wrapperAttrs">
|
|
116
|
-
<label
|
|
123
|
+
<label
|
|
124
|
+
v-if="label || hasSlotContent($slots['label'])"
|
|
125
|
+
v-bind="labelAttrs"
|
|
126
|
+
ref="labelRef"
|
|
127
|
+
:for="props.for"
|
|
128
|
+
:data-test="`${dataTest}-label`"
|
|
129
|
+
>
|
|
117
130
|
<!--
|
|
118
131
|
@slot Use this to add custom content instead of the label.
|
|
119
132
|
@binding {string} label
|
|
@@ -61,7 +61,7 @@ const slots = useSlots();
|
|
|
61
61
|
const elementId = props.id || useId();
|
|
62
62
|
|
|
63
63
|
const textareaRef = ref<HTMLTextAreaElement | null>(null);
|
|
64
|
-
const labelComponentRef = ref<
|
|
64
|
+
const labelComponentRef = ref<InstanceType<typeof ULabel> | null>(null);
|
|
65
65
|
const leftSlotWrapperRef = ref<HTMLElement | null>(null);
|
|
66
66
|
const wrapperRef = ref<HTMLElement | null>(null);
|
|
67
67
|
|
|
@@ -214,7 +214,9 @@ async function findComponentColors(componentName, files, vuelessConfigFiles) {
|
|
|
214
214
|
const fileContent = await readFile(file, "utf-8");
|
|
215
215
|
const isDefaultConfig = isDefaultComponentConfig(file, componentName);
|
|
216
216
|
const componentRegExp = new RegExp(`<${componentName}[^>]+>`, "g");
|
|
217
|
+
const componentExtendExp = new RegExp(`{${componentName}}`, "g");
|
|
217
218
|
const matchedComponent = fileContent.match(componentRegExp);
|
|
219
|
+
const matchedExtendComponent = fileContent.match(componentExtendExp);
|
|
218
220
|
|
|
219
221
|
if (!isComponentExists) {
|
|
220
222
|
isComponentExists = Boolean(matchedComponent);
|
|
@@ -228,6 +230,14 @@ async function findComponentColors(componentName, files, vuelessConfigFiles) {
|
|
|
228
230
|
});
|
|
229
231
|
}
|
|
230
232
|
|
|
233
|
+
if (matchedExtendComponent) {
|
|
234
|
+
const objectColors = objectColorRegExp.exec(fileContent) || [];
|
|
235
|
+
|
|
236
|
+
objectColors.forEach((color) => {
|
|
237
|
+
if (color) colors.add(color);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
231
241
|
/* Collect color from U[Component] */
|
|
232
242
|
matchedComponent?.forEach((match) => {
|
|
233
243
|
const [, singleColor] = singleColorRegExp.exec(match) || [];
|