naive-ui 2.32.2 → 2.33.0
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 +40930 -2060
- 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/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/use-sorter.js +1 -1
- 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 +28 -18
- package/es/form/src/styles/form-item.cssr.js +31 -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 +6 -32
- package/es/radio/src/Radio.js +5 -5
- package/es/radio/src/RadioButton.d.ts +6 -9
- package/es/radio/src/RadioButton.js +7 -11
- package/es/radio/src/RadioGroup.d.ts +8 -8
- package/es/radio/src/RadioGroup.js +2 -2
- package/es/radio/src/interface.d.ts +2 -2
- package/es/radio/src/use-radio.d.ts +4 -32
- package/es/radio/src/use-radio.js +12 -10
- 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/ThemeEditor.d.ts +4 -0
- package/es/theme-editor/src/ThemeEditor.js +25 -10
- package/es/tree/src/styles/index.cssr.js +4 -3
- 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/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/use-sorter.js +1 -1
- 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 +28 -18
- package/lib/form/src/styles/form-item.cssr.js +31 -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 +6 -32
- package/lib/radio/src/Radio.js +5 -5
- package/lib/radio/src/RadioButton.d.ts +6 -9
- package/lib/radio/src/RadioButton.js +7 -14
- package/lib/radio/src/RadioGroup.d.ts +8 -8
- package/lib/radio/src/RadioGroup.js +2 -2
- package/lib/radio/src/interface.d.ts +2 -2
- package/lib/radio/src/use-radio.d.ts +4 -32
- package/lib/radio/src/use-radio.js +11 -9
- 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/ThemeEditor.d.ts +4 -0
- package/lib/theme-editor/src/ThemeEditor.js +25 -10
- package/lib/tree/src/styles/index.cssr.js +4 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +4 -4
- 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,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/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 {};
|
|
@@ -19,17 +19,17 @@ export default cB('rate', {
|
|
|
19
19
|
transform: scale(1);
|
|
20
20
|
font-size: var(--n-item-size);
|
|
21
21
|
color: var(--n-item-color);
|
|
22
|
-
`, [c('&:not(:first-child)',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
`, [c('&:not(:first-child)', `
|
|
23
|
+
margin-left: 6px;
|
|
24
|
+
`), cM('active', `
|
|
25
|
+
color: var(--n-item-color-active);
|
|
26
|
+
`)]), cNotM('readonly', `
|
|
27
27
|
cursor: pointer;
|
|
28
|
-
`, [cE('item', [c('&:hover',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
`, [cE('item', [c('&:hover', `
|
|
29
|
+
transform: scale(1.05);
|
|
30
|
+
`), c('&:active', `
|
|
31
|
+
transform: scale(0.96);
|
|
32
|
+
`)])]), cE('half', `
|
|
33
33
|
display: flex;
|
|
34
34
|
transition: inherit;
|
|
35
35
|
position: absolute;
|
|
@@ -39,6 +39,6 @@ export default cB('rate', {
|
|
|
39
39
|
width: 50%;
|
|
40
40
|
overflow: hidden;
|
|
41
41
|
color: rgba(255, 255, 255, 0);
|
|
42
|
-
`, [cM('active',
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
`, [cM('active', `
|
|
43
|
+
color: var(--n-item-color-active);
|
|
44
|
+
`)])]);
|
|
@@ -21,6 +21,10 @@ export declare const sliderProps: {
|
|
|
21
21
|
readonly default: undefined;
|
|
22
22
|
};
|
|
23
23
|
readonly formatTooltip: PropType<(value: number) => string | number>;
|
|
24
|
+
readonly keyboard: {
|
|
25
|
+
readonly type: BooleanConstructor;
|
|
26
|
+
readonly default: true;
|
|
27
|
+
};
|
|
24
28
|
readonly min: {
|
|
25
29
|
readonly type: NumberConstructor;
|
|
26
30
|
readonly default: 0;
|
|
@@ -152,6 +156,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
152
156
|
readonly default: undefined;
|
|
153
157
|
};
|
|
154
158
|
readonly formatTooltip: PropType<(value: number) => string | number>;
|
|
159
|
+
readonly keyboard: {
|
|
160
|
+
readonly type: BooleanConstructor;
|
|
161
|
+
readonly default: true;
|
|
162
|
+
};
|
|
155
163
|
readonly min: {
|
|
156
164
|
readonly type: NumberConstructor;
|
|
157
165
|
readonly default: 0;
|
|
@@ -357,6 +365,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
357
365
|
readonly default: undefined;
|
|
358
366
|
};
|
|
359
367
|
readonly formatTooltip: PropType<(value: number) => string | number>;
|
|
368
|
+
readonly keyboard: {
|
|
369
|
+
readonly type: BooleanConstructor;
|
|
370
|
+
readonly default: true;
|
|
371
|
+
};
|
|
360
372
|
readonly min: {
|
|
361
373
|
readonly type: NumberConstructor;
|
|
362
374
|
readonly default: 0;
|
|
@@ -482,6 +494,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
482
494
|
readonly min: number;
|
|
483
495
|
readonly to: string | boolean | HTMLElement;
|
|
484
496
|
readonly defaultValue: number | number[];
|
|
497
|
+
readonly keyboard: boolean;
|
|
485
498
|
readonly showTooltip: boolean | undefined;
|
|
486
499
|
}>;
|
|
487
500
|
export default _default;
|
package/es/slider/src/Slider.js
CHANGED
|
@@ -15,7 +15,10 @@ export const sliderProps = Object.assign(Object.assign({}, useTheme.props), { to
|
|
|
15
15
|
}, marks: Object, disabled: {
|
|
16
16
|
type: Boolean,
|
|
17
17
|
default: undefined
|
|
18
|
-
}, formatTooltip: Function,
|
|
18
|
+
}, formatTooltip: Function, keyboard: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
}, min: {
|
|
19
22
|
type: Number,
|
|
20
23
|
default: 0
|
|
21
24
|
}, max: {
|
|
@@ -256,7 +259,7 @@ export default defineComponent({
|
|
|
256
259
|
return Number(newValue.toFixed(precisionRef.value));
|
|
257
260
|
}
|
|
258
261
|
function getClosestMark(currentValue, markValues = markValuesRef.value, buffer) {
|
|
259
|
-
if (!markValues ||
|
|
262
|
+
if (!(markValues === null || markValues === void 0 ? void 0 : markValues.length))
|
|
260
263
|
return null;
|
|
261
264
|
let closestMark = null;
|
|
262
265
|
let index = -1;
|
|
@@ -296,7 +299,7 @@ export default defineComponent({
|
|
|
296
299
|
}
|
|
297
300
|
// dom event handle
|
|
298
301
|
function handleRailKeyDown(e) {
|
|
299
|
-
if (mergedDisabledRef.value)
|
|
302
|
+
if (mergedDisabledRef.value || !props.keyboard)
|
|
300
303
|
return;
|
|
301
304
|
const { vertical, reverse } = props;
|
|
302
305
|
switch (e.key) {
|
|
@@ -130,5 +130,9 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
130
130
|
handleExportClick: () => void;
|
|
131
131
|
handleImportClick: () => void;
|
|
132
132
|
handleInputFileChange: () => void;
|
|
133
|
+
handleOpen: () => void;
|
|
134
|
+
isOpen: import("vue").Ref<{
|
|
135
|
+
valueOf: () => boolean;
|
|
136
|
+
}>;
|
|
133
137
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
134
138
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { h, computed, defineComponent, ref, Fragment, toRaw, watch, inject } from 'vue';
|
|
2
2
|
import { cloneDeep, merge } from 'lodash-es';
|
|
3
|
+
import { Open } from '@vicons/ionicons5';
|
|
3
4
|
import { configProviderInjectionKey } from '../../config-provider/src/context';
|
|
4
5
|
import { lightTheme } from '../../themes/light';
|
|
5
6
|
import { NConfigProvider } from '../../config-provider';
|
|
@@ -14,6 +15,7 @@ import { NButton } from '../../button';
|
|
|
14
15
|
import { NColorPicker } from '../../color-picker';
|
|
15
16
|
import { NEmpty } from '../../empty';
|
|
16
17
|
import { lockHtmlScrollRightCompensationRef } from '../../_utils';
|
|
18
|
+
import { NIcon } from '../../icon';
|
|
17
19
|
const ColorWandIcon = (h("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: { width: '1em', height: '1em', color: 'currentColor' } },
|
|
18
20
|
h("path", { d: "M13.5 1C13.7761 1 14 1.22386 14 1.5V2H14.5C14.7761 2 15 2.22386 15 2.5C15 2.77614 14.7761 3 14.5 3H14V3.5C14 3.77614 13.7761 4 13.5 4C13.2239 4 13 3.77614 13 3.5V3H12.5C12.2239 3 12 2.77614 12 2.5C12 2.22386 12.2239 2 12.5 2H13V1.5C13 1.22386 13.2239 1 13.5 1Z", fill: "currentColor" }),
|
|
19
21
|
h("path", { d: "M3.5 3C3.77615 3 4 3.22386 4 3.5V4H4.5C4.77615 4 5 4.22386 5 4.5C5 4.77614 4.77615 5 4.5 5H4V5.5C4 5.77614 3.77615 6 3.5 6C3.22386 6 3 5.77614 3 5.5V5H2.5C2.22386 5 2 4.77614 2 4.5C2 4.22386 2.22386 4 2.5 4H3V3.5C3 3.22386 3.22386 3 3.5 3Z", fill: "currentColor" }),
|
|
@@ -31,6 +33,7 @@ export default defineComponent({
|
|
|
31
33
|
name: 'ThemeEditor',
|
|
32
34
|
inheritAttrs: false,
|
|
33
35
|
setup() {
|
|
36
|
+
const isOpen = ref(false);
|
|
34
37
|
const fileInputRef = ref(null);
|
|
35
38
|
const NConfigProvider = inject(configProviderInjectionKey, null);
|
|
36
39
|
const theme = computed(() => {
|
|
@@ -91,6 +94,9 @@ export default defineComponent({
|
|
|
91
94
|
return;
|
|
92
95
|
fileInput.click();
|
|
93
96
|
}
|
|
97
|
+
function handleOpen() {
|
|
98
|
+
isOpen.value = !isOpen.value;
|
|
99
|
+
}
|
|
94
100
|
function handleInputFileChange() {
|
|
95
101
|
const { value: fileInput } = fileInputRef;
|
|
96
102
|
if (!fileInput)
|
|
@@ -143,7 +149,9 @@ export default defineComponent({
|
|
|
143
149
|
handleClearAllClick,
|
|
144
150
|
handleExportClick,
|
|
145
151
|
handleImportClick,
|
|
146
|
-
handleInputFileChange
|
|
152
|
+
handleInputFileChange,
|
|
153
|
+
handleOpen,
|
|
154
|
+
isOpen
|
|
147
155
|
};
|
|
148
156
|
},
|
|
149
157
|
render() {
|
|
@@ -152,7 +160,7 @@ export default defineComponent({
|
|
|
152
160
|
var _a, _b;
|
|
153
161
|
return [
|
|
154
162
|
h(NPopover, { scrollable: true, arrowPointToCenter: true, trigger: "manual", show: this.showPanel, displayDirective: "show", placement: "top-end", style: {
|
|
155
|
-
width: '288px',
|
|
163
|
+
width: this.isOpen ? 'calc(100vw - 80px)' : '288px',
|
|
156
164
|
height: 'calc(100vh - 200px)',
|
|
157
165
|
padding: 0
|
|
158
166
|
} }, {
|
|
@@ -193,11 +201,15 @@ export default defineComponent({
|
|
|
193
201
|
}, onChange: this.handleInputFileChange }),
|
|
194
202
|
h(NSpace, { vertical: true }, {
|
|
195
203
|
default: () => (h(Fragment, null,
|
|
196
|
-
h("
|
|
204
|
+
h(NSpace, { align: "center", justify: "space-between", style: {
|
|
197
205
|
marginBottom: '8px',
|
|
198
206
|
fontSize: '18px',
|
|
199
207
|
fontWeight: 500
|
|
200
|
-
} },
|
|
208
|
+
} },
|
|
209
|
+
h("span", null, this.locale.title),
|
|
210
|
+
h(NButton, { onClick: this.handleOpen, strong: true, secondary: true, circle: true, type: this.isOpen ? 'success' : undefined }, {
|
|
211
|
+
icon: () => (h(NIcon, { size: "18", component: Open }))
|
|
212
|
+
})),
|
|
201
213
|
this.locale.filterCompName,
|
|
202
214
|
h(NInput, { onChange: () => {
|
|
203
215
|
this.compNamePattern = this.tempCompNamePattern;
|
|
@@ -262,15 +274,18 @@ export default defineComponent({
|
|
|
262
274
|
filteredItemsCount += 1;
|
|
263
275
|
return (h(NCollapseItem, { title: themeKey, name: themeKey }, {
|
|
264
276
|
default: () => {
|
|
265
|
-
return (h(NSpace, {
|
|
277
|
+
return (h(NSpace, { size: [32, 16] }, {
|
|
266
278
|
default: () => varKeys.map((varKey) => {
|
|
267
279
|
var _a, _b, _c, _d;
|
|
268
|
-
return
|
|
280
|
+
return (h("div", { style: {
|
|
281
|
+
minWidth: '246px'
|
|
282
|
+
} },
|
|
269
283
|
h("div", { key: `${varKey}Label`, style: {
|
|
270
284
|
wordBreak: 'break-word'
|
|
271
285
|
} }, varKey),
|
|
272
286
|
showColorPicker(varKey) ? (h(NColorPicker, { key: varKey, modes: ['rgb', 'hex'], value: ((_b = (_a = this.tempOverrides) === null || _a === void 0 ? void 0 : _a[themeKey]) === null || _b === void 0 ? void 0 : _b[varKey]) ||
|
|
273
|
-
componentTheme[varKey], onComplete: this
|
|
287
|
+
componentTheme[varKey], onComplete: this
|
|
288
|
+
.applyTempOverrides, onUpdateValue: (value) => {
|
|
274
289
|
this.setTempOverrides(themeKey, varKey, value);
|
|
275
290
|
} }, {
|
|
276
291
|
action: () => {
|
|
@@ -285,10 +300,10 @@ export default defineComponent({
|
|
|
285
300
|
.restore
|
|
286
301
|
}));
|
|
287
302
|
}
|
|
288
|
-
})) : (h(NInput, { key: varKey, onChange: this
|
|
303
|
+
})) : (h(NInput, { key: varKey, onChange: this
|
|
304
|
+
.applyTempOverrides, onUpdateValue: (value) => {
|
|
289
305
|
this.setTempOverrides(themeKey, varKey, value);
|
|
290
|
-
}, value: ((_d = (_c = this.tempOverrides) === null || _c === void 0 ? void 0 : _c[themeKey]) === null || _d === void 0 ? void 0 : _d[varKey]) || '', placeholder: componentTheme[varKey] }))
|
|
291
|
-
];
|
|
306
|
+
}, value: ((_d = (_c = this.tempOverrides) === null || _c === void 0 ? void 0 : _c[themeKey]) === null || _d === void 0 ? void 0 : _d[varKey]) || '', placeholder: componentTheme[varKey] }))));
|
|
292
307
|
})
|
|
293
308
|
}));
|
|
294
309
|
}
|
|
@@ -45,8 +45,8 @@ export default cB('tree', `
|
|
|
45
45
|
`)]), cNotM('disabled', [cM('clickable', [cB('tree-node-content', `
|
|
46
46
|
cursor: pointer;
|
|
47
47
|
`)])])]), cM('block-node', [cB('tree-node-content', `
|
|
48
|
-
flex
|
|
49
|
-
|
|
48
|
+
flex: 1;
|
|
49
|
+
min-width: 0;
|
|
50
50
|
`)]), cNotM('block-line', [cB('tree-node', [cNotM('disabled', [cB('tree-node-content', [c('&:hover', {
|
|
51
51
|
backgroundColor: 'var(--n-node-color-hover)'
|
|
52
52
|
})]), cM('selectable', [cB('tree-node-content', [c('&:active', {
|
|
@@ -131,7 +131,8 @@ export default cB('tree', `
|
|
|
131
131
|
`), cE('text', `
|
|
132
132
|
border-bottom: 1px solid #0000;
|
|
133
133
|
transition: border-color .3s var(--n-bezier);
|
|
134
|
-
flex-grow:1;
|
|
134
|
+
flex-grow: 1;
|
|
135
|
+
max-width: 100%;
|
|
135
136
|
`), cE('suffix', `
|
|
136
137
|
display: inline-flex;
|
|
137
138
|
`)]), cE('empty', 'margin: auto;')]);
|
package/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.
|
|
1
|
+
declare const _default: "2.33.0";
|
|
2
2
|
export default _default;
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '2.
|
|
1
|
+
export default '2.33.0';
|
|
@@ -6,11 +6,10 @@ const _utils_1 = require("../../../_utils");
|
|
|
6
6
|
const icons_1 = require("../../icons");
|
|
7
7
|
const icon_1 = require("../../icon");
|
|
8
8
|
const interface_1 = require("./interface");
|
|
9
|
-
const checkMarkIcon = (0, vue_1.h)(icons_1.CheckmarkIcon);
|
|
10
9
|
function renderCheckMark(show, clsPrefix) {
|
|
11
10
|
return ((0, vue_1.h)(vue_1.Transition, { name: "fade-in-scale-up-transition" }, {
|
|
12
11
|
default: () => show ? ((0, vue_1.h)(icon_1.NBaseIcon, { clsPrefix: clsPrefix, class: `${clsPrefix}-base-select-option__check` }, {
|
|
13
|
-
default: () =>
|
|
12
|
+
default: () => (0, vue_1.h)(icons_1.CheckmarkIcon)
|
|
14
13
|
})) : null
|
|
15
14
|
}));
|
|
16
15
|
}
|
package/lib/_utils/cssr/index.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.createKey = exports.find = exports.namespace = exports.prefix = exports.asModal = exports.insidePopover = exports.insideModal = exports.cCB = exports.cNotM = exports.cM = exports.cE = exports.cB = exports.c = void 0;
|
|
7
4
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
8
5
|
const css_render_1 = require("css-render");
|
|
9
|
-
const plugin_bem_1 =
|
|
6
|
+
const plugin_bem_1 = require("@css-render/plugin-bem");
|
|
10
7
|
const namespace = 'n';
|
|
11
8
|
exports.namespace = namespace;
|
|
12
9
|
const prefix = `.${namespace}-`;
|
|
@@ -14,7 +11,7 @@ exports.prefix = prefix;
|
|
|
14
11
|
const elementPrefix = '__';
|
|
15
12
|
const modifierPrefix = '--';
|
|
16
13
|
const cssr = (0, css_render_1.CssRender)();
|
|
17
|
-
const plugin = (0, plugin_bem_1.
|
|
14
|
+
const plugin = (0, plugin_bem_1.plugin)({
|
|
18
15
|
blockPrefix: prefix,
|
|
19
16
|
elementPrefix,
|
|
20
17
|
modifierPrefix
|