cabloy 5.1.92 → 5.1.93
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/zova/pnpm-lock.yaml
CHANGED
package/zova/src/suite/cabloy-basic/modules/basic-select/src/component/select/controller.tsx
CHANGED
|
@@ -39,9 +39,26 @@ export class ControllerSelect extends BeanControllerBase {
|
|
|
39
39
|
controllerRef,
|
|
40
40
|
onChange,
|
|
41
41
|
onBlur,
|
|
42
|
+
style,
|
|
42
43
|
'onUpdate:modelValue': _onUpdateModelValue,
|
|
43
44
|
...props
|
|
44
45
|
} = this.$props as any;
|
|
46
|
+
const selectBackgroundColor = style?.backgroundColor ?? 'var(--color-base-100)';
|
|
47
|
+
const selectColor = style?.color ?? 'var(--color-base-content)';
|
|
48
|
+
const optionStyle = {
|
|
49
|
+
backgroundColor: selectBackgroundColor,
|
|
50
|
+
color: selectColor,
|
|
51
|
+
};
|
|
52
|
+
const placeholderOptionStyle = {
|
|
53
|
+
backgroundColor: selectBackgroundColor,
|
|
54
|
+
color: `color-mix(in oklch, ${selectColor} 60%, transparent)`,
|
|
55
|
+
};
|
|
56
|
+
const selectStyle = {
|
|
57
|
+
...style,
|
|
58
|
+
colorScheme: this.$theme.dark ? 'dark' : 'light',
|
|
59
|
+
backgroundColor: selectBackgroundColor,
|
|
60
|
+
color: selectColor,
|
|
61
|
+
};
|
|
45
62
|
const domOptions: VNode[] = [];
|
|
46
63
|
const modelValueDom = isNil(this.modelValue) ? '' : String(this.modelValue);
|
|
47
64
|
if (items) {
|
|
@@ -50,7 +67,12 @@ export class ControllerSelect extends BeanControllerBase {
|
|
|
50
67
|
const value = item[itemValue];
|
|
51
68
|
const valueDom = isNil(value) ? '' : String(value);
|
|
52
69
|
domOptions.push(
|
|
53
|
-
<option
|
|
70
|
+
<option
|
|
71
|
+
key={valueDom}
|
|
72
|
+
value={valueDom}
|
|
73
|
+
selected={modelValueDom === valueDom}
|
|
74
|
+
style={optionStyle}
|
|
75
|
+
>
|
|
54
76
|
{title}
|
|
55
77
|
</option>,
|
|
56
78
|
);
|
|
@@ -59,6 +81,7 @@ export class ControllerSelect extends BeanControllerBase {
|
|
|
59
81
|
return (
|
|
60
82
|
<select
|
|
61
83
|
{...props}
|
|
84
|
+
style={selectStyle}
|
|
62
85
|
onChange={(e: Event) => {
|
|
63
86
|
const selectedValue = (e.target as HTMLSelectElement).value;
|
|
64
87
|
const item = items?.find(item => {
|
|
@@ -75,7 +98,7 @@ export class ControllerSelect extends BeanControllerBase {
|
|
|
75
98
|
}}
|
|
76
99
|
>
|
|
77
100
|
{!!placeholder && (
|
|
78
|
-
<option disabled={true} selected={isNil(this.modelValue)}>
|
|
101
|
+
<option disabled={true} selected={isNil(this.modelValue)} style={placeholderOptionStyle}>
|
|
79
102
|
{placeholder}
|
|
80
103
|
</option>
|
|
81
104
|
)}
|