next-helios-fe 1.8.1 → 1.8.2
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
CHANGED
@@ -8,6 +8,7 @@ export interface SelectProps
|
|
8
8
|
menus: {
|
9
9
|
label: string;
|
10
10
|
value: string;
|
11
|
+
disabled?: boolean;
|
11
12
|
[key: string]: any;
|
12
13
|
}[];
|
13
14
|
label?: string;
|
@@ -144,24 +145,47 @@ export const Select: React.FC<SelectProps> = ({
|
|
144
145
|
<span className="px-4 py-1">No data found</span>
|
145
146
|
</div>
|
146
147
|
) : (
|
147
|
-
menus.map((item, index) =>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
148
|
+
menus.map((item, index) => {
|
149
|
+
if (tempValue === item.value) {
|
150
|
+
return (
|
151
|
+
<button
|
152
|
+
key={index}
|
153
|
+
type="button"
|
154
|
+
className="min-w-40 w-full my-0.5 px-4 py-2 rounded-md text-sm text-left hover:bg-secondary-light disabled:bg-primary-transparent disabled:text-primary"
|
155
|
+
disabled
|
156
|
+
onClick={() => {
|
157
|
+
setTempValue(item.value);
|
158
|
+
if (rest.onChange) {
|
159
|
+
rest.onChange({
|
160
|
+
target: { value: item.value } as HTMLSelectElement,
|
161
|
+
} as any);
|
162
|
+
}
|
163
|
+
}}
|
164
|
+
>
|
165
|
+
{item.label}
|
166
|
+
</button>
|
167
|
+
);
|
168
|
+
} else {
|
169
|
+
return (
|
170
|
+
<button
|
171
|
+
key={index}
|
172
|
+
type="button"
|
173
|
+
className="min-w-40 w-full my-0.5 px-4 py-2 rounded-md text-sm text-left hover:bg-secondary-light disabled:text-slate-400"
|
174
|
+
disabled={item.disabled}
|
175
|
+
onClick={() => {
|
176
|
+
setTempValue(item.value);
|
177
|
+
if (rest.onChange) {
|
178
|
+
rest.onChange({
|
179
|
+
target: { value: item.value } as HTMLSelectElement,
|
180
|
+
} as any);
|
181
|
+
}
|
182
|
+
}}
|
183
|
+
>
|
184
|
+
{item.label}
|
185
|
+
</button>
|
186
|
+
);
|
187
|
+
}
|
188
|
+
})
|
165
189
|
)}
|
166
190
|
</div>
|
167
191
|
</Dropdown>
|