naive-ui 2.32.2 → 2.33.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/dist/index.js +425 -248
- package/dist/index.prod.js +2 -2
- package/es/_internal/select-menu/src/SelectOption.js +1 -2
- package/es/_utils/cssr/index.js +1 -1
- package/es/calendar/src/Calendar.js +2 -1
- package/es/card/src/Card.d.ts +24 -1
- package/es/card/src/Card.js +8 -4
- package/es/card/src/styles/index.cssr.js +17 -8
- package/es/card/styles/dark.js +3 -1
- package/es/card/styles/light.d.ts +2 -0
- package/es/card/styles/light.js +1 -1
- package/es/countdown/src/Countdown.js +0 -5
- package/es/data-table/src/DataTable.d.ts +10 -0
- package/es/data-table/src/HeaderButton/FilterButton.d.ts +1 -0
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +1 -0
- package/es/data-table/src/TableParts/Body.d.ts +1 -0
- package/es/data-table/src/TableParts/Cell.d.ts +2 -0
- package/es/data-table/src/TableParts/Header.d.ts +1 -0
- package/es/data-table/src/use-sorter.js +1 -1
- package/es/data-table/styles/light.d.ts +1 -0
- package/es/dialog/index.d.ts +1 -1
- package/es/dialog/index.js +1 -1
- package/es/dialog/src/DialogEnvironment.d.ts +3 -0
- package/es/dialog/src/DialogEnvironment.js +2 -2
- package/es/dialog/src/DialogProvider.d.ts +4 -0
- package/es/dialog/src/DialogProvider.js +2 -1
- package/es/dialog/src/composables.d.ts +4 -0
- package/es/dialog/src/composables.js +17 -0
- package/es/dialog/src/context.d.ts +2 -1
- package/es/dialog/src/context.js +1 -0
- package/es/form/src/FormItem.d.ts +1 -0
- package/es/form/src/FormItem.js +27 -18
- package/es/form/src/styles/form-item.cssr.js +41 -19
- package/es/form/src/utils.d.ts +1 -0
- package/es/form/src/utils.js +15 -10
- package/es/input/src/utils.js +1 -1
- package/es/locales/common/frFR.js +8 -11
- package/es/menu/src/Menu.d.ts +13 -0
- package/es/menu/src/Menu.js +7 -1
- package/es/modal/src/BodyWrapper.d.ts +2 -0
- package/es/modal/src/Modal.d.ts +18 -0
- package/es/modal/src/presetProps.d.ts +1 -1
- package/es/modal/styles/light.d.ts +2 -0
- package/es/pagination/src/Pagination.js +5 -1
- package/es/radio/src/Radio.d.ts +13 -32
- package/es/radio/src/Radio.js +7 -6
- package/es/radio/src/RadioButton.d.ts +6 -9
- package/es/radio/src/RadioButton.js +7 -11
- package/es/radio/src/RadioGroup.d.ts +17 -8
- package/es/radio/src/RadioGroup.js +2 -2
- package/es/radio/src/interface.d.ts +2 -2
- package/es/radio/src/styles/radio.cssr.js +4 -1
- package/es/radio/src/use-radio.d.ts +4 -32
- package/es/radio/src/use-radio.js +12 -10
- package/es/radio/styles/dark.js +1 -1
- package/es/radio/styles/light.d.ts +1 -0
- package/es/radio/styles/light.js +1 -1
- package/es/rate/src/Rate.d.ts +23 -14
- package/es/rate/src/Rate.js +32 -12
- package/es/rate/src/interface.d.ts +2 -0
- package/es/rate/src/interface.js +1 -0
- package/es/rate/src/styles/index.cssr.js +13 -13
- package/es/slider/src/Slider.d.ts +13 -0
- package/es/slider/src/Slider.js +6 -3
- package/es/theme-editor/src/MaximizeIcon.d.ts +1 -0
- package/es/theme-editor/src/MaximizeIcon.js +8 -0
- package/es/theme-editor/src/MinimizeIcon.d.ts +1 -0
- package/es/theme-editor/src/MinimizeIcon.js +8 -0
- package/es/theme-editor/src/ThemeEditor.d.ts +4 -0
- package/es/theme-editor/src/ThemeEditor.js +42 -18
- package/es/tree/src/styles/index.cssr.js +4 -3
- package/es/upload/src/interface.d.ts +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/select-menu/src/SelectOption.js +1 -2
- package/lib/_utils/cssr/index.js +2 -5
- package/lib/calendar/src/Calendar.js +2 -1
- package/lib/card/src/Card.d.ts +24 -1
- package/lib/card/src/Card.js +8 -4
- package/lib/card/src/styles/index.cssr.js +17 -8
- package/lib/card/styles/dark.js +3 -1
- package/lib/card/styles/light.d.ts +2 -0
- package/lib/card/styles/light.js +1 -1
- package/lib/countdown/src/Countdown.js +0 -5
- package/lib/data-table/src/DataTable.d.ts +10 -0
- package/lib/data-table/src/HeaderButton/FilterButton.d.ts +1 -0
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +1 -0
- package/lib/data-table/src/TableParts/Body.d.ts +1 -0
- package/lib/data-table/src/TableParts/Cell.d.ts +2 -0
- package/lib/data-table/src/TableParts/Header.d.ts +1 -0
- package/lib/data-table/src/use-sorter.js +1 -1
- package/lib/data-table/styles/light.d.ts +1 -0
- package/lib/dialog/index.d.ts +1 -1
- package/lib/dialog/index.js +4 -3
- package/lib/dialog/src/DialogEnvironment.d.ts +3 -0
- package/lib/dialog/src/DialogEnvironment.js +2 -2
- package/lib/dialog/src/DialogProvider.d.ts +4 -0
- package/lib/dialog/src/DialogProvider.js +1 -0
- package/lib/dialog/src/composables.d.ts +4 -0
- package/lib/dialog/src/{use-dialog.js → composables.js} +9 -1
- package/lib/dialog/src/context.d.ts +2 -1
- package/lib/dialog/src/context.js +2 -1
- package/lib/form/src/FormItem.d.ts +1 -0
- package/lib/form/src/FormItem.js +27 -18
- package/lib/form/src/styles/form-item.cssr.js +41 -19
- package/lib/form/src/utils.d.ts +1 -0
- package/lib/form/src/utils.js +15 -10
- package/lib/input/src/utils.js +1 -1
- package/lib/locales/common/frFR.js +8 -11
- package/lib/menu/src/Menu.d.ts +13 -0
- package/lib/menu/src/Menu.js +7 -1
- package/lib/modal/src/BodyWrapper.d.ts +2 -0
- package/lib/modal/src/Modal.d.ts +18 -0
- package/lib/modal/src/presetProps.d.ts +1 -1
- package/lib/modal/styles/light.d.ts +2 -0
- package/lib/pagination/src/Pagination.js +5 -1
- package/lib/radio/src/Radio.d.ts +13 -32
- package/lib/radio/src/Radio.js +7 -6
- package/lib/radio/src/RadioButton.d.ts +6 -9
- package/lib/radio/src/RadioButton.js +7 -14
- package/lib/radio/src/RadioGroup.d.ts +17 -8
- package/lib/radio/src/RadioGroup.js +2 -2
- package/lib/radio/src/interface.d.ts +2 -2
- package/lib/radio/src/styles/radio.cssr.js +4 -1
- package/lib/radio/src/use-radio.d.ts +4 -32
- package/lib/radio/src/use-radio.js +11 -9
- package/lib/radio/styles/dark.js +1 -1
- package/lib/radio/styles/light.d.ts +1 -0
- package/lib/radio/styles/light.js +1 -1
- package/lib/rate/src/Rate.d.ts +23 -14
- package/lib/rate/src/Rate.js +32 -12
- package/lib/rate/src/interface.d.ts +2 -0
- package/lib/rate/src/interface.js +2 -0
- package/lib/rate/src/styles/index.cssr.js +13 -13
- package/lib/slider/src/Slider.d.ts +13 -0
- package/lib/slider/src/Slider.js +6 -3
- package/lib/theme-editor/src/MaximizeIcon.d.ts +1 -0
- package/lib/theme-editor/src/MaximizeIcon.js +11 -0
- package/lib/theme-editor/src/MinimizeIcon.d.ts +1 -0
- package/lib/theme-editor/src/MinimizeIcon.js +11 -0
- package/lib/theme-editor/src/ThemeEditor.d.ts +4 -0
- package/lib/theme-editor/src/ThemeEditor.js +42 -18
- package/lib/tree/src/styles/index.cssr.js +4 -3
- package/lib/upload/src/interface.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +8 -7
- package/web-types.json +36 -5
- package/es/countdown/src/utils.d.ts +0 -0
- package/es/countdown/src/utils.js +0 -1
- package/es/dialog/src/use-dialog.d.ts +0 -2
- package/es/dialog/src/use-dialog.js +0 -10
- package/lib/countdown/src/utils.d.ts +0 -0
- package/lib/countdown/src/utils.js +0 -1
- package/lib/dialog/src/use-dialog.d.ts +0 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ExtractPublicPropTypes } from '../../_utils';
|
|
2
|
-
import
|
|
2
|
+
import { radioProps } from './use-radio';
|
|
3
3
|
export declare const radioButtonProps: {
|
|
4
4
|
readonly name: StringConstructor;
|
|
5
5
|
readonly value: {
|
|
6
|
-
readonly type: import("vue").PropType<string | number>;
|
|
6
|
+
readonly type: import("vue").PropType<string | number | boolean>;
|
|
7
7
|
readonly default: "on";
|
|
8
8
|
};
|
|
9
9
|
readonly checked: {
|
|
@@ -21,15 +21,14 @@ export declare const radioButtonProps: {
|
|
|
21
21
|
readonly 'onUpdate:checked': import("vue").PropType<import("../../_utils").MaybeArray<(value: boolean) => void> | undefined>;
|
|
22
22
|
readonly checkedValue: {
|
|
23
23
|
readonly type: import("vue").PropType<boolean | undefined>;
|
|
24
|
-
readonly validator: () => boolean;
|
|
25
24
|
readonly default: undefined;
|
|
26
25
|
};
|
|
27
26
|
};
|
|
28
|
-
export declare type RadioButtonProps = ExtractPublicPropTypes<typeof
|
|
27
|
+
export declare type RadioButtonProps = ExtractPublicPropTypes<typeof radioProps>;
|
|
29
28
|
declare const _default: import("vue").DefineComponent<{
|
|
30
29
|
readonly name: StringConstructor;
|
|
31
30
|
readonly value: {
|
|
32
|
-
readonly type: import("vue").PropType<string | number>;
|
|
31
|
+
readonly type: import("vue").PropType<string | number | boolean>;
|
|
33
32
|
readonly default: "on";
|
|
34
33
|
};
|
|
35
34
|
readonly checked: {
|
|
@@ -47,13 +46,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
47
46
|
readonly 'onUpdate:checked': import("vue").PropType<import("../../_utils").MaybeArray<(value: boolean) => void> | undefined>;
|
|
48
47
|
readonly checkedValue: {
|
|
49
48
|
readonly type: import("vue").PropType<boolean | undefined>;
|
|
50
|
-
readonly validator: () => boolean;
|
|
51
49
|
readonly default: undefined;
|
|
52
50
|
};
|
|
53
51
|
}, import("./use-radio").UseRadio, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
54
52
|
readonly name: StringConstructor;
|
|
55
53
|
readonly value: {
|
|
56
|
-
readonly type: import("vue").PropType<string | number>;
|
|
54
|
+
readonly type: import("vue").PropType<string | number | boolean>;
|
|
57
55
|
readonly default: "on";
|
|
58
56
|
};
|
|
59
57
|
readonly checked: {
|
|
@@ -71,11 +69,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
71
69
|
readonly 'onUpdate:checked': import("vue").PropType<import("../../_utils").MaybeArray<(value: boolean) => void> | undefined>;
|
|
72
70
|
readonly checkedValue: {
|
|
73
71
|
readonly type: import("vue").PropType<boolean | undefined>;
|
|
74
|
-
readonly validator: () => boolean;
|
|
75
72
|
readonly default: undefined;
|
|
76
73
|
};
|
|
77
74
|
}>>, {
|
|
78
|
-
readonly value: string | number;
|
|
75
|
+
readonly value: string | number | boolean;
|
|
79
76
|
readonly disabled: boolean | undefined;
|
|
80
77
|
readonly checked: boolean | undefined;
|
|
81
78
|
readonly defaultChecked: boolean;
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { h, defineComponent } from 'vue';
|
|
2
2
|
import { resolveWrappedSlot } from '../../_utils';
|
|
3
|
-
import
|
|
4
|
-
export const radioButtonProps =
|
|
3
|
+
import { setup, radioProps } from './use-radio';
|
|
4
|
+
export const radioButtonProps = radioProps;
|
|
5
5
|
export default defineComponent({
|
|
6
6
|
name: 'RadioButton',
|
|
7
|
-
props:
|
|
8
|
-
setup
|
|
9
|
-
return useRadio(props);
|
|
10
|
-
},
|
|
7
|
+
props: radioProps,
|
|
8
|
+
setup,
|
|
11
9
|
render() {
|
|
12
10
|
const { mergedClsPrefix } = this;
|
|
13
11
|
return (h("label", { class: [
|
|
14
12
|
`${mergedClsPrefix}-radio-button`,
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
[`${mergedClsPrefix}-radio-button--focus`]: this.focus
|
|
19
|
-
}
|
|
13
|
+
this.mergedDisabled && `${mergedClsPrefix}-radio-button--disabled`,
|
|
14
|
+
this.renderSafeChecked && `${mergedClsPrefix}-radio-button--checked`,
|
|
15
|
+
this.focus && [`${mergedClsPrefix}-radio-button--focus`]
|
|
20
16
|
] },
|
|
21
17
|
h("input", { ref: "inputRef", type: "radio", class: `${mergedClsPrefix}-radio-input`, value: this.value, name: this.mergedName, checked: this.renderSafeChecked, disabled: this.mergedDisabled, onChange: this.handleRadioInputChange, onFocus: this.handleRadioInputFocus, onBlur: this.handleRadioInputBlur }),
|
|
22
18
|
h("div", { class: `${mergedClsPrefix}-radio-button__state-border` }),
|
|
@@ -3,9 +3,9 @@ import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils';
|
|
|
3
3
|
import { OnUpdateValue } from './interface';
|
|
4
4
|
export declare const radioGroupProps: {
|
|
5
5
|
readonly name: StringConstructor;
|
|
6
|
-
readonly value: PropType<string | number | null>;
|
|
6
|
+
readonly value: PropType<string | number | boolean | null>;
|
|
7
7
|
readonly defaultValue: {
|
|
8
|
-
readonly type: PropType<string | number | null>;
|
|
8
|
+
readonly type: PropType<string | number | boolean | null>;
|
|
9
9
|
readonly default: null;
|
|
10
10
|
};
|
|
11
11
|
readonly size: PropType<"small" | "medium" | "large">;
|
|
@@ -30,6 +30,7 @@ export declare const radioGroupProps: {
|
|
|
30
30
|
boxShadowDisabled: string;
|
|
31
31
|
color: string;
|
|
32
32
|
colorDisabled: string;
|
|
33
|
+
colorActive: string;
|
|
33
34
|
textColor: string;
|
|
34
35
|
textColorDisabled: string;
|
|
35
36
|
dotColorActive: string;
|
|
@@ -67,6 +68,7 @@ export declare const radioGroupProps: {
|
|
|
67
68
|
boxShadowDisabled: string;
|
|
68
69
|
color: string;
|
|
69
70
|
colorDisabled: string;
|
|
71
|
+
colorActive: string;
|
|
70
72
|
textColor: string;
|
|
71
73
|
textColorDisabled: string;
|
|
72
74
|
dotColorActive: string;
|
|
@@ -104,6 +106,7 @@ export declare const radioGroupProps: {
|
|
|
104
106
|
boxShadowDisabled: string;
|
|
105
107
|
color: string;
|
|
106
108
|
colorDisabled: string;
|
|
109
|
+
colorActive: string;
|
|
107
110
|
textColor: string;
|
|
108
111
|
textColorDisabled: string;
|
|
109
112
|
dotColorActive: string;
|
|
@@ -130,9 +133,9 @@ export declare const radioGroupProps: {
|
|
|
130
133
|
export declare type RadioGroupProps = ExtractPublicPropTypes<typeof radioGroupProps>;
|
|
131
134
|
declare const _default: import("vue").DefineComponent<{
|
|
132
135
|
readonly name: StringConstructor;
|
|
133
|
-
readonly value: PropType<string | number | null>;
|
|
136
|
+
readonly value: PropType<string | number | boolean | null>;
|
|
134
137
|
readonly defaultValue: {
|
|
135
|
-
readonly type: PropType<string | number | null>;
|
|
138
|
+
readonly type: PropType<string | number | boolean | null>;
|
|
136
139
|
readonly default: null;
|
|
137
140
|
};
|
|
138
141
|
readonly size: PropType<"small" | "medium" | "large">;
|
|
@@ -157,6 +160,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
157
160
|
boxShadowDisabled: string;
|
|
158
161
|
color: string;
|
|
159
162
|
colorDisabled: string;
|
|
163
|
+
colorActive: string;
|
|
160
164
|
textColor: string;
|
|
161
165
|
textColorDisabled: string;
|
|
162
166
|
dotColorActive: string;
|
|
@@ -194,6 +198,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
194
198
|
boxShadowDisabled: string;
|
|
195
199
|
color: string;
|
|
196
200
|
colorDisabled: string;
|
|
201
|
+
colorActive: string;
|
|
197
202
|
textColor: string;
|
|
198
203
|
textColorDisabled: string;
|
|
199
204
|
dotColorActive: string;
|
|
@@ -231,6 +236,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
231
236
|
boxShadowDisabled: string;
|
|
232
237
|
color: string;
|
|
233
238
|
colorDisabled: string;
|
|
239
|
+
colorActive: string;
|
|
234
240
|
textColor: string;
|
|
235
241
|
textColorDisabled: string;
|
|
236
242
|
dotColorActive: string;
|
|
@@ -257,7 +263,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
257
263
|
selfElRef: import("vue").Ref<HTMLDivElement | null>;
|
|
258
264
|
rtlEnabled: import("vue").Ref<import("../../config-provider/src/internal-interface").RtlItem | undefined> | undefined;
|
|
259
265
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
260
|
-
mergedValue: import("vue").ComputedRef<string | number | null>;
|
|
266
|
+
mergedValue: import("vue").ComputedRef<string | number | boolean | null>;
|
|
261
267
|
handleFocusout: (e: FocusEvent) => void;
|
|
262
268
|
handleFocusin: (e: FocusEvent) => void;
|
|
263
269
|
cssVars: import("vue").ComputedRef<{
|
|
@@ -280,9 +286,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
280
286
|
onRender: (() => void) | undefined;
|
|
281
287
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
282
288
|
readonly name: StringConstructor;
|
|
283
|
-
readonly value: PropType<string | number | null>;
|
|
289
|
+
readonly value: PropType<string | number | boolean | null>;
|
|
284
290
|
readonly defaultValue: {
|
|
285
|
-
readonly type: PropType<string | number | null>;
|
|
291
|
+
readonly type: PropType<string | number | boolean | null>;
|
|
286
292
|
readonly default: null;
|
|
287
293
|
};
|
|
288
294
|
readonly size: PropType<"small" | "medium" | "large">;
|
|
@@ -307,6 +313,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
307
313
|
boxShadowDisabled: string;
|
|
308
314
|
color: string;
|
|
309
315
|
colorDisabled: string;
|
|
316
|
+
colorActive: string;
|
|
310
317
|
textColor: string;
|
|
311
318
|
textColorDisabled: string;
|
|
312
319
|
dotColorActive: string;
|
|
@@ -344,6 +351,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
344
351
|
boxShadowDisabled: string;
|
|
345
352
|
color: string;
|
|
346
353
|
colorDisabled: string;
|
|
354
|
+
colorActive: string;
|
|
347
355
|
textColor: string;
|
|
348
356
|
textColorDisabled: string;
|
|
349
357
|
dotColorActive: string;
|
|
@@ -381,6 +389,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
381
389
|
boxShadowDisabled: string;
|
|
382
390
|
color: string;
|
|
383
391
|
colorDisabled: string;
|
|
392
|
+
colorActive: string;
|
|
384
393
|
textColor: string;
|
|
385
394
|
textColorDisabled: string;
|
|
386
395
|
dotColorActive: string;
|
|
@@ -405,6 +414,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
405
414
|
}, any>>>;
|
|
406
415
|
}>>, {
|
|
407
416
|
readonly disabled: boolean | undefined;
|
|
408
|
-
readonly defaultValue: string | number | null;
|
|
417
|
+
readonly defaultValue: string | number | boolean | null;
|
|
409
418
|
}>;
|
|
410
419
|
export default _default;
|
|
@@ -63,8 +63,8 @@ function mapSlot(defaultSlot, value, clsPrefix) {
|
|
|
63
63
|
isButtonGroup
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
export const radioGroupProps = Object.assign(Object.assign({}, useTheme.props), { name: String, value: [String, Number], defaultValue: {
|
|
67
|
-
type: [String, Number],
|
|
66
|
+
export const radioGroupProps = Object.assign(Object.assign({}, useTheme.props), { name: String, value: [String, Number, Boolean], defaultValue: {
|
|
67
|
+
type: [String, Number, Boolean],
|
|
68
68
|
default: null
|
|
69
69
|
}, size: String, disabled: {
|
|
70
70
|
type: Boolean,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare type OnUpdateValue = (value: string & number) => void;
|
|
2
|
-
export declare type OnUpdateValueImpl = (value: string | number) => void;
|
|
1
|
+
export declare type OnUpdateValue = (value: string & number & boolean) => void;
|
|
2
|
+
export declare type OnUpdateValueImpl = (value: string | number | boolean) => void;
|
|
@@ -15,6 +15,7 @@ import { c, cE, cM, cNotM, cB } from '../../../_utils/cssr'; // vars:
|
|
|
15
15
|
// --n-text-color-disabled
|
|
16
16
|
// --n-label-padding
|
|
17
17
|
// --n-label-line-height
|
|
18
|
+
// --n-color-active
|
|
18
19
|
|
|
19
20
|
export default cB('radio', `
|
|
20
21
|
line-height: var(--n-label-line-height);
|
|
@@ -27,7 +28,9 @@ export default cB('radio', `
|
|
|
27
28
|
flex-wrap: nowrap;
|
|
28
29
|
font-size: var(--n-font-size);
|
|
29
30
|
word-break: break-word;
|
|
30
|
-
`, [cE('dot
|
|
31
|
+
`, [cM('checked', [cE('dot', `
|
|
32
|
+
background-color: var(--n-color-active);
|
|
33
|
+
`)]), cE('dot-wrapper', `
|
|
31
34
|
position: relative;
|
|
32
35
|
flex-shrink: 0;
|
|
33
36
|
flex-grow: 0;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ExtractPropTypes, PropType, Ref, ComputedRef } from 'vue';
|
|
2
2
|
import type { MaybeArray } from '../../_utils';
|
|
3
3
|
import { OnUpdateValue } from './interface';
|
|
4
|
-
declare const radioProps: {
|
|
4
|
+
export declare const radioProps: {
|
|
5
5
|
readonly name: StringConstructor;
|
|
6
6
|
readonly value: {
|
|
7
|
-
readonly type: PropType<string | number>;
|
|
7
|
+
readonly type: PropType<string | number | boolean>;
|
|
8
8
|
readonly default: "on";
|
|
9
9
|
};
|
|
10
10
|
readonly checked: {
|
|
@@ -22,14 +22,13 @@ declare const radioProps: {
|
|
|
22
22
|
readonly 'onUpdate:checked': PropType<MaybeArray<(value: boolean) => void> | undefined>;
|
|
23
23
|
readonly checkedValue: {
|
|
24
24
|
readonly type: PropType<boolean | undefined>;
|
|
25
|
-
readonly validator: () => boolean;
|
|
26
25
|
readonly default: undefined;
|
|
27
26
|
};
|
|
28
27
|
};
|
|
29
28
|
export interface RadioGroupInjection {
|
|
30
29
|
mergedClsPrefixRef: Ref<string>;
|
|
31
30
|
nameRef: Ref<string | undefined>;
|
|
32
|
-
valueRef: Ref<string | number | null>;
|
|
31
|
+
valueRef: Ref<string | number | boolean | null>;
|
|
33
32
|
mergedSizeRef: Ref<'small' | 'medium' | 'large'>;
|
|
34
33
|
disabledRef: Ref<boolean>;
|
|
35
34
|
doUpdateValue: OnUpdateValue;
|
|
@@ -50,32 +49,5 @@ export interface UseRadio {
|
|
|
50
49
|
handleRadioInputFocus: () => void;
|
|
51
50
|
}
|
|
52
51
|
declare function setup(props: ExtractPropTypes<typeof radioProps>): UseRadio;
|
|
53
|
-
declare namespace setup {
|
|
54
|
-
var props: {
|
|
55
|
-
readonly name: StringConstructor;
|
|
56
|
-
readonly value: {
|
|
57
|
-
readonly type: PropType<string | number>;
|
|
58
|
-
readonly default: "on";
|
|
59
|
-
};
|
|
60
|
-
readonly checked: {
|
|
61
|
-
readonly type: PropType<boolean | undefined>;
|
|
62
|
-
readonly default: undefined;
|
|
63
|
-
};
|
|
64
|
-
readonly defaultChecked: BooleanConstructor;
|
|
65
|
-
readonly disabled: {
|
|
66
|
-
readonly type: PropType<boolean | undefined>;
|
|
67
|
-
readonly default: undefined;
|
|
68
|
-
};
|
|
69
|
-
readonly label: StringConstructor;
|
|
70
|
-
readonly size: PropType<"small" | "medium" | "large">;
|
|
71
|
-
readonly onUpdateChecked: PropType<MaybeArray<(value: boolean) => void> | undefined>;
|
|
72
|
-
readonly 'onUpdate:checked': PropType<MaybeArray<(value: boolean) => void> | undefined>;
|
|
73
|
-
readonly checkedValue: {
|
|
74
|
-
readonly type: PropType<boolean | undefined>;
|
|
75
|
-
readonly validator: () => boolean;
|
|
76
|
-
readonly default: undefined;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
52
|
export declare type RadioProps = ExtractPropTypes<typeof radioProps>;
|
|
81
|
-
export
|
|
53
|
+
export { setup };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { inject, ref, toRef } from 'vue';
|
|
1
|
+
import { inject, ref, toRef, watchEffect } from 'vue';
|
|
2
2
|
import { useMemo, useMergedState } from 'vooks';
|
|
3
3
|
import { useConfig, useFormItem } from '../../_mixins';
|
|
4
|
-
import {
|
|
5
|
-
const radioProps = {
|
|
4
|
+
import { call, createInjectionKey, warnOnce } from '../../_utils';
|
|
5
|
+
export const radioProps = {
|
|
6
6
|
name: String,
|
|
7
7
|
value: {
|
|
8
|
-
type: [String, Number],
|
|
8
|
+
type: [String, Number, Boolean],
|
|
9
9
|
default: 'on'
|
|
10
10
|
},
|
|
11
11
|
checked: {
|
|
@@ -24,15 +24,18 @@ const radioProps = {
|
|
|
24
24
|
// deprecated
|
|
25
25
|
checkedValue: {
|
|
26
26
|
type: Boolean,
|
|
27
|
-
validator: () => {
|
|
28
|
-
warn('radio', '`checked-value` is deprecated, please use `checked` instead.');
|
|
29
|
-
return true;
|
|
30
|
-
},
|
|
31
27
|
default: undefined
|
|
32
28
|
}
|
|
33
29
|
};
|
|
34
30
|
export const radioGroupInjectionKey = createInjectionKey('n-radio-group');
|
|
35
31
|
function setup(props) {
|
|
32
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
33
|
+
watchEffect(() => {
|
|
34
|
+
if (props.checkedValue !== undefined) {
|
|
35
|
+
warnOnce('radio', '`checked-value` is deprecated, please use `checked` instead.');
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
36
39
|
const formItem = useFormItem(props, {
|
|
37
40
|
mergedSize(NFormItem) {
|
|
38
41
|
const { size } = props;
|
|
@@ -130,5 +133,4 @@ function setup(props) {
|
|
|
130
133
|
handleRadioInputFocus
|
|
131
134
|
};
|
|
132
135
|
}
|
|
133
|
-
setup
|
|
134
|
-
export default setup;
|
|
136
|
+
export { setup };
|
package/es/radio/styles/dark.js
CHANGED
|
@@ -8,7 +8,7 @@ const radioDark = {
|
|
|
8
8
|
const { borderColor, primaryColor, baseColor, textColorDisabled, inputColorDisabled, textColor2, opacityDisabled, borderRadius, fontSizeSmall, fontSizeMedium, fontSizeLarge, heightSmall, heightMedium, heightLarge, lineHeight } = vars;
|
|
9
9
|
return Object.assign(Object.assign({}, commonVariables), { labelLineHeight: lineHeight, buttonHeightSmall: heightSmall, buttonHeightMedium: heightMedium, buttonHeightLarge: heightLarge, fontSizeSmall,
|
|
10
10
|
fontSizeMedium,
|
|
11
|
-
fontSizeLarge, boxShadow: `inset 0 0 0 1px ${borderColor}`, boxShadowActive: `inset 0 0 0 1px ${primaryColor}`, boxShadowFocus: `inset 0 0 0 1px ${primaryColor}, 0 0 0 2px ${changeColor(primaryColor, { alpha: 0.3 })}`, boxShadowHover: `inset 0 0 0 1px ${primaryColor}`, boxShadowDisabled: `inset 0 0 0 1px ${borderColor}`, color: '#0000', colorDisabled: inputColorDisabled, textColor: textColor2, textColorDisabled, dotColorActive: primaryColor, dotColorDisabled: borderColor, buttonBorderColor: borderColor, buttonBorderColorActive: primaryColor, buttonBorderColorHover: primaryColor, buttonColor: '#0000', buttonColorActive: primaryColor, buttonTextColor: textColor2, buttonTextColorActive: baseColor, buttonTextColorHover: primaryColor, opacityDisabled, buttonBoxShadowFocus: `inset 0 0 0 1px ${primaryColor}, 0 0 0 2px ${changeColor(primaryColor, { alpha: 0.3 })}`, buttonBoxShadowHover: `inset 0 0 0 1px ${primaryColor}`, buttonBoxShadow: 'inset 0 0 0 1px #0000', buttonBorderRadius: borderRadius });
|
|
11
|
+
fontSizeLarge, boxShadow: `inset 0 0 0 1px ${borderColor}`, boxShadowActive: `inset 0 0 0 1px ${primaryColor}`, boxShadowFocus: `inset 0 0 0 1px ${primaryColor}, 0 0 0 2px ${changeColor(primaryColor, { alpha: 0.3 })}`, boxShadowHover: `inset 0 0 0 1px ${primaryColor}`, boxShadowDisabled: `inset 0 0 0 1px ${borderColor}`, color: '#0000', colorDisabled: inputColorDisabled, colorActive: '#0000', textColor: textColor2, textColorDisabled, dotColorActive: primaryColor, dotColorDisabled: borderColor, buttonBorderColor: borderColor, buttonBorderColorActive: primaryColor, buttonBorderColorHover: primaryColor, buttonColor: '#0000', buttonColorActive: primaryColor, buttonTextColor: textColor2, buttonTextColorActive: baseColor, buttonTextColorHover: primaryColor, opacityDisabled, buttonBoxShadowFocus: `inset 0 0 0 1px ${primaryColor}, 0 0 0 2px ${changeColor(primaryColor, { alpha: 0.3 })}`, buttonBoxShadowHover: `inset 0 0 0 1px ${primaryColor}`, buttonBoxShadow: 'inset 0 0 0 1px #0000', buttonBorderRadius: borderRadius });
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
export default radioDark;
|
package/es/radio/styles/light.js
CHANGED
|
@@ -5,7 +5,7 @@ const self = (vars) => {
|
|
|
5
5
|
const { borderColor, primaryColor, baseColor, textColorDisabled, inputColorDisabled, textColor2, opacityDisabled, borderRadius, fontSizeSmall, fontSizeMedium, fontSizeLarge, heightSmall, heightMedium, heightLarge, lineHeight } = vars;
|
|
6
6
|
return Object.assign(Object.assign({}, commonVariables), { labelLineHeight: lineHeight, buttonHeightSmall: heightSmall, buttonHeightMedium: heightMedium, buttonHeightLarge: heightLarge, fontSizeSmall,
|
|
7
7
|
fontSizeMedium,
|
|
8
|
-
fontSizeLarge, boxShadow: `inset 0 0 0 1px ${borderColor}`, boxShadowActive: `inset 0 0 0 1px ${primaryColor}`, boxShadowFocus: `inset 0 0 0 1px ${primaryColor}, 0 0 0 2px ${changeColor(primaryColor, { alpha: 0.2 })}`, boxShadowHover: `inset 0 0 0 1px ${primaryColor}`, boxShadowDisabled: `inset 0 0 0 1px ${borderColor}`, color: baseColor, colorDisabled: inputColorDisabled, textColor: textColor2, textColorDisabled, dotColorActive: primaryColor, dotColorDisabled: borderColor, buttonBorderColor: borderColor, buttonBorderColorActive: primaryColor, buttonBorderColorHover: borderColor, buttonColor: baseColor, buttonColorActive: baseColor, buttonTextColor: textColor2, buttonTextColorActive: primaryColor, buttonTextColorHover: primaryColor, opacityDisabled, buttonBoxShadowFocus: `inset 0 0 0 1px ${primaryColor}, 0 0 0 2px ${changeColor(primaryColor, { alpha: 0.3 })}`, buttonBoxShadowHover: 'inset 0 0 0 1px #0000', buttonBoxShadow: 'inset 0 0 0 1px #0000', buttonBorderRadius: borderRadius });
|
|
8
|
+
fontSizeLarge, boxShadow: `inset 0 0 0 1px ${borderColor}`, boxShadowActive: `inset 0 0 0 1px ${primaryColor}`, boxShadowFocus: `inset 0 0 0 1px ${primaryColor}, 0 0 0 2px ${changeColor(primaryColor, { alpha: 0.2 })}`, boxShadowHover: `inset 0 0 0 1px ${primaryColor}`, boxShadowDisabled: `inset 0 0 0 1px ${borderColor}`, color: baseColor, colorDisabled: inputColorDisabled, colorActive: '#0000', textColor: textColor2, textColorDisabled, dotColorActive: primaryColor, dotColorDisabled: borderColor, buttonBorderColor: borderColor, buttonBorderColorActive: primaryColor, buttonBorderColorHover: borderColor, buttonColor: baseColor, buttonColorActive: baseColor, buttonTextColor: textColor2, buttonTextColorActive: primaryColor, buttonTextColorHover: primaryColor, opacityDisabled, buttonBoxShadowFocus: `inset 0 0 0 1px ${primaryColor}, 0 0 0 2px ${changeColor(primaryColor, { alpha: 0.3 })}`, buttonBoxShadowHover: 'inset 0 0 0 1px #0000', buttonBoxShadow: 'inset 0 0 0 1px #0000', buttonBorderRadius: borderRadius });
|
|
9
9
|
};
|
|
10
10
|
const radioLight = {
|
|
11
11
|
name: 'Radio',
|
package/es/rate/src/Rate.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
2
|
import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils';
|
|
3
|
+
import type { RateOnUpdateValue } from './interface';
|
|
3
4
|
export declare const rateProps: {
|
|
4
5
|
readonly allowHalf: BooleanConstructor;
|
|
5
6
|
readonly count: {
|
|
@@ -8,17 +9,19 @@ export declare const rateProps: {
|
|
|
8
9
|
};
|
|
9
10
|
readonly value: NumberConstructor;
|
|
10
11
|
readonly defaultValue: {
|
|
11
|
-
readonly type:
|
|
12
|
-
readonly default:
|
|
12
|
+
readonly type: PropType<number | null>;
|
|
13
|
+
readonly default: null;
|
|
13
14
|
};
|
|
14
15
|
readonly readonly: BooleanConstructor;
|
|
15
16
|
readonly size: {
|
|
16
17
|
readonly type: PropType<number | "small" | "medium" | "large">;
|
|
17
18
|
readonly default: "medium";
|
|
18
19
|
};
|
|
20
|
+
readonly clearable: BooleanConstructor;
|
|
19
21
|
readonly color: StringConstructor;
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
22
|
+
readonly onClear: PropType<() => void>;
|
|
23
|
+
readonly 'onUpdate:value': PropType<MaybeArray<RateOnUpdateValue>>;
|
|
24
|
+
readonly onUpdateValue: PropType<MaybeArray<RateOnUpdateValue>>;
|
|
22
25
|
readonly theme: PropType<import("../../_mixins").Theme<"Rate", {
|
|
23
26
|
itemColor: string;
|
|
24
27
|
itemColorActive: string;
|
|
@@ -50,17 +53,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
50
53
|
};
|
|
51
54
|
readonly value: NumberConstructor;
|
|
52
55
|
readonly defaultValue: {
|
|
53
|
-
readonly type:
|
|
54
|
-
readonly default:
|
|
56
|
+
readonly type: PropType<number | null>;
|
|
57
|
+
readonly default: null;
|
|
55
58
|
};
|
|
56
59
|
readonly readonly: BooleanConstructor;
|
|
57
60
|
readonly size: {
|
|
58
61
|
readonly type: PropType<number | "small" | "medium" | "large">;
|
|
59
62
|
readonly default: "medium";
|
|
60
63
|
};
|
|
64
|
+
readonly clearable: BooleanConstructor;
|
|
61
65
|
readonly color: StringConstructor;
|
|
62
|
-
readonly
|
|
63
|
-
readonly
|
|
66
|
+
readonly onClear: PropType<() => void>;
|
|
67
|
+
readonly 'onUpdate:value': PropType<MaybeArray<RateOnUpdateValue>>;
|
|
68
|
+
readonly onUpdateValue: PropType<MaybeArray<RateOnUpdateValue>>;
|
|
64
69
|
readonly theme: PropType<import("../../_mixins").Theme<"Rate", {
|
|
65
70
|
itemColor: string;
|
|
66
71
|
itemColorActive: string;
|
|
@@ -84,11 +89,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
84
89
|
}, any>>>;
|
|
85
90
|
}, {
|
|
86
91
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
87
|
-
mergedValue: import("vue").ComputedRef<number>;
|
|
92
|
+
mergedValue: import("vue").ComputedRef<number | null>;
|
|
88
93
|
hoverIndex: import("vue").Ref<number | null>;
|
|
89
94
|
handleMouseMove: (index: number, e: MouseEvent) => void;
|
|
90
95
|
handleClick: (index: number, e: MouseEvent) => void;
|
|
91
96
|
handleMouseLeave: () => void;
|
|
97
|
+
handleMouseEnterSomeStar: () => void;
|
|
92
98
|
cssVars: import("vue").ComputedRef<{
|
|
93
99
|
'--n-bezier': string;
|
|
94
100
|
'--n-item-color': string;
|
|
@@ -105,17 +111,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
105
111
|
};
|
|
106
112
|
readonly value: NumberConstructor;
|
|
107
113
|
readonly defaultValue: {
|
|
108
|
-
readonly type:
|
|
109
|
-
readonly default:
|
|
114
|
+
readonly type: PropType<number | null>;
|
|
115
|
+
readonly default: null;
|
|
110
116
|
};
|
|
111
117
|
readonly readonly: BooleanConstructor;
|
|
112
118
|
readonly size: {
|
|
113
119
|
readonly type: PropType<number | "small" | "medium" | "large">;
|
|
114
120
|
readonly default: "medium";
|
|
115
121
|
};
|
|
122
|
+
readonly clearable: BooleanConstructor;
|
|
116
123
|
readonly color: StringConstructor;
|
|
117
|
-
readonly
|
|
118
|
-
readonly
|
|
124
|
+
readonly onClear: PropType<() => void>;
|
|
125
|
+
readonly 'onUpdate:value': PropType<MaybeArray<RateOnUpdateValue>>;
|
|
126
|
+
readonly onUpdateValue: PropType<MaybeArray<RateOnUpdateValue>>;
|
|
119
127
|
readonly theme: PropType<import("../../_mixins").Theme<"Rate", {
|
|
120
128
|
itemColor: string;
|
|
121
129
|
itemColorActive: string;
|
|
@@ -140,7 +148,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
140
148
|
}>>, {
|
|
141
149
|
readonly readonly: boolean;
|
|
142
150
|
readonly size: number | "small" | "medium" | "large";
|
|
143
|
-
readonly
|
|
151
|
+
readonly clearable: boolean;
|
|
152
|
+
readonly defaultValue: number | null;
|
|
144
153
|
readonly count: number;
|
|
145
154
|
readonly allowHalf: boolean;
|
|
146
155
|
}>;
|
package/es/rate/src/Rate.js
CHANGED
|
@@ -4,18 +4,18 @@ import { NBaseIcon } from '../../_internal';
|
|
|
4
4
|
import { useTheme, useFormItem, useConfig, useThemeClass } from '../../_mixins';
|
|
5
5
|
import { call, color2Class, createKey } from '../../_utils';
|
|
6
6
|
import { rateLight } from '../styles';
|
|
7
|
-
import style from './styles/index.cssr';
|
|
8
7
|
import StarIcon from './StarIcon';
|
|
8
|
+
import style from './styles/index.cssr';
|
|
9
9
|
export const rateProps = Object.assign(Object.assign({}, useTheme.props), { allowHalf: Boolean, count: {
|
|
10
10
|
type: Number,
|
|
11
11
|
default: 5
|
|
12
12
|
}, value: Number, defaultValue: {
|
|
13
13
|
type: Number,
|
|
14
|
-
default:
|
|
14
|
+
default: null
|
|
15
15
|
}, readonly: Boolean, size: {
|
|
16
16
|
type: [String, Number],
|
|
17
17
|
default: 'medium'
|
|
18
|
-
}, color: String, 'onUpdate:value': [Function, Array], onUpdateValue: [Function, Array] });
|
|
18
|
+
}, clearable: Boolean, color: String, onClear: Function, 'onUpdate:value': [Function, Array], onUpdateValue: [Function, Array] });
|
|
19
19
|
export default defineComponent({
|
|
20
20
|
name: 'Rate',
|
|
21
21
|
props: rateProps,
|
|
@@ -26,6 +26,7 @@ export default defineComponent({
|
|
|
26
26
|
const uncontrolledValueRef = ref(props.defaultValue);
|
|
27
27
|
const hoverIndexRef = ref(null);
|
|
28
28
|
const formItem = useFormItem(props);
|
|
29
|
+
const mergedValue = useMergedState(controlledValueRef, uncontrolledValueRef);
|
|
29
30
|
function doUpdateValue(value) {
|
|
30
31
|
const { 'onUpdate:value': _onUpdateValue, onUpdateValue } = props;
|
|
31
32
|
const { nTriggerFormChange, nTriggerFormInput } = formItem;
|
|
@@ -53,14 +54,31 @@ export default defineComponent({
|
|
|
53
54
|
return index + 1;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
57
|
+
let cleared = false;
|
|
56
58
|
function handleMouseMove(index, e) {
|
|
59
|
+
if (cleared)
|
|
60
|
+
return;
|
|
57
61
|
hoverIndexRef.value = getDerivedValue(index, e);
|
|
58
62
|
}
|
|
59
63
|
function handleMouseLeave() {
|
|
60
64
|
hoverIndexRef.value = null;
|
|
61
65
|
}
|
|
62
66
|
function handleClick(index, e) {
|
|
63
|
-
|
|
67
|
+
var _a;
|
|
68
|
+
const { clearable } = props;
|
|
69
|
+
const derivedValue = getDerivedValue(index, e);
|
|
70
|
+
if (clearable && derivedValue === mergedValue.value) {
|
|
71
|
+
cleared = true;
|
|
72
|
+
(_a = props.onClear) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
73
|
+
hoverIndexRef.value = null;
|
|
74
|
+
doUpdateValue(null);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
doUpdateValue(derivedValue);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function handleMouseEnterSomeStar() {
|
|
81
|
+
cleared = false;
|
|
64
82
|
}
|
|
65
83
|
const mergedSizeRef = computed(() => {
|
|
66
84
|
const { size } = props;
|
|
@@ -75,10 +93,11 @@ export default defineComponent({
|
|
|
75
93
|
const cssVarsRef = computed(() => {
|
|
76
94
|
const { common: { cubicBezierEaseInOut }, self } = themeRef.value;
|
|
77
95
|
const { itemColor, itemColorActive } = self;
|
|
96
|
+
const { color } = props;
|
|
78
97
|
return {
|
|
79
98
|
'--n-bezier': cubicBezierEaseInOut,
|
|
80
99
|
'--n-item-color': itemColor,
|
|
81
|
-
'--n-item-color-active':
|
|
100
|
+
'--n-item-color-active': color || itemColorActive,
|
|
82
101
|
'--n-item-size': mergedSizeRef.value
|
|
83
102
|
};
|
|
84
103
|
});
|
|
@@ -98,11 +117,12 @@ export default defineComponent({
|
|
|
98
117
|
: undefined;
|
|
99
118
|
return {
|
|
100
119
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
101
|
-
mergedValue
|
|
120
|
+
mergedValue,
|
|
102
121
|
hoverIndex: hoverIndexRef,
|
|
103
122
|
handleMouseMove,
|
|
104
123
|
handleClick,
|
|
105
124
|
handleMouseLeave,
|
|
125
|
+
handleMouseEnterSomeStar,
|
|
106
126
|
cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
|
|
107
127
|
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
108
128
|
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
@@ -119,17 +139,17 @@ export default defineComponent({
|
|
|
119
139
|
this.themeClass
|
|
120
140
|
], style: this.cssVars, onMouseleave: this.handleMouseLeave }, renderList(this.count, (_, index) => {
|
|
121
141
|
const icon = defaultSlot ? (defaultSlot()) : (h(NBaseIcon, { clsPrefix: mergedClsPrefix }, { default: () => StarIcon }));
|
|
122
|
-
const
|
|
142
|
+
const entireStarActive = hoverIndex !== null
|
|
123
143
|
? index + 1 <= hoverIndex
|
|
124
|
-
: index + 1 <= mergedValue;
|
|
144
|
+
: index + 1 <= (mergedValue || 0);
|
|
125
145
|
return (h("div", { key: index, class: [
|
|
126
146
|
`${mergedClsPrefix}-rate__item`,
|
|
127
|
-
|
|
147
|
+
entireStarActive && `${mergedClsPrefix}-rate__item--active`
|
|
128
148
|
], onClick: readonly
|
|
129
149
|
? undefined
|
|
130
150
|
: (e) => {
|
|
131
151
|
this.handleClick(index, e);
|
|
132
|
-
}, onMousemove: readonly
|
|
152
|
+
}, onMouseenter: this.handleMouseEnterSomeStar, onMousemove: readonly
|
|
133
153
|
? undefined
|
|
134
154
|
: (e) => {
|
|
135
155
|
this.handleMouseMove(index, e);
|
|
@@ -138,9 +158,9 @@ export default defineComponent({
|
|
|
138
158
|
this.allowHalf ? (h("div", { class: [
|
|
139
159
|
`${mergedClsPrefix}-rate__half`,
|
|
140
160
|
{
|
|
141
|
-
[`${mergedClsPrefix}-rate__half--active`]: !
|
|
161
|
+
[`${mergedClsPrefix}-rate__half--active`]: !entireStarActive && hoverIndex !== null
|
|
142
162
|
? index + 0.5 <= hoverIndex
|
|
143
|
-
: index + 0.5 <= mergedValue
|
|
163
|
+
: index + 0.5 <= (mergedValue || 0)
|
|
144
164
|
}
|
|
145
165
|
] }, icon)) : null));
|
|
146
166
|
})));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|