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,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.radioGroupInjectionKey = void 0;
|
|
3
|
+
exports.setup = exports.radioGroupInjectionKey = exports.radioProps = void 0;
|
|
4
4
|
const vue_1 = require("vue");
|
|
5
5
|
const vooks_1 = require("vooks");
|
|
6
6
|
const _mixins_1 = require("../../_mixins");
|
|
7
7
|
const _utils_1 = require("../../_utils");
|
|
8
|
-
|
|
8
|
+
exports.radioProps = {
|
|
9
9
|
name: String,
|
|
10
10
|
value: {
|
|
11
|
-
type: [String, Number],
|
|
11
|
+
type: [String, Number, Boolean],
|
|
12
12
|
default: 'on'
|
|
13
13
|
},
|
|
14
14
|
checked: {
|
|
@@ -27,15 +27,18 @@ const radioProps = {
|
|
|
27
27
|
// deprecated
|
|
28
28
|
checkedValue: {
|
|
29
29
|
type: Boolean,
|
|
30
|
-
validator: () => {
|
|
31
|
-
(0, _utils_1.warn)('radio', '`checked-value` is deprecated, please use `checked` instead.');
|
|
32
|
-
return true;
|
|
33
|
-
},
|
|
34
30
|
default: undefined
|
|
35
31
|
}
|
|
36
32
|
};
|
|
37
33
|
exports.radioGroupInjectionKey = (0, _utils_1.createInjectionKey)('n-radio-group');
|
|
38
34
|
function setup(props) {
|
|
35
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
36
|
+
(0, vue_1.watchEffect)(() => {
|
|
37
|
+
if (props.checkedValue !== undefined) {
|
|
38
|
+
(0, _utils_1.warnOnce)('radio', '`checked-value` is deprecated, please use `checked` instead.');
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
39
42
|
const formItem = (0, _mixins_1.useFormItem)(props, {
|
|
40
43
|
mergedSize(NFormItem) {
|
|
41
44
|
const { size } = props;
|
|
@@ -133,5 +136,4 @@ function setup(props) {
|
|
|
133
136
|
handleRadioInputFocus
|
|
134
137
|
};
|
|
135
138
|
}
|
|
136
|
-
setup
|
|
137
|
-
exports.default = setup;
|
|
139
|
+
exports.setup = setup;
|
package/lib/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/lib/rate/src/Rate.js
CHANGED
|
@@ -10,18 +10,18 @@ const _internal_1 = require("../../_internal");
|
|
|
10
10
|
const _mixins_1 = require("../../_mixins");
|
|
11
11
|
const _utils_1 = require("../../_utils");
|
|
12
12
|
const styles_1 = require("../styles");
|
|
13
|
-
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
14
13
|
const StarIcon_1 = __importDefault(require("./StarIcon"));
|
|
14
|
+
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
15
15
|
exports.rateProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { allowHalf: Boolean, count: {
|
|
16
16
|
type: Number,
|
|
17
17
|
default: 5
|
|
18
18
|
}, value: Number, defaultValue: {
|
|
19
19
|
type: Number,
|
|
20
|
-
default:
|
|
20
|
+
default: null
|
|
21
21
|
}, readonly: Boolean, size: {
|
|
22
22
|
type: [String, Number],
|
|
23
23
|
default: 'medium'
|
|
24
|
-
}, color: String, 'onUpdate:value': [Function, Array], onUpdateValue: [Function, Array] });
|
|
24
|
+
}, clearable: Boolean, color: String, onClear: Function, 'onUpdate:value': [Function, Array], onUpdateValue: [Function, Array] });
|
|
25
25
|
exports.default = (0, vue_1.defineComponent)({
|
|
26
26
|
name: 'Rate',
|
|
27
27
|
props: exports.rateProps,
|
|
@@ -32,6 +32,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
32
32
|
const uncontrolledValueRef = (0, vue_1.ref)(props.defaultValue);
|
|
33
33
|
const hoverIndexRef = (0, vue_1.ref)(null);
|
|
34
34
|
const formItem = (0, _mixins_1.useFormItem)(props);
|
|
35
|
+
const mergedValue = (0, vooks_1.useMergedState)(controlledValueRef, uncontrolledValueRef);
|
|
35
36
|
function doUpdateValue(value) {
|
|
36
37
|
const { 'onUpdate:value': _onUpdateValue, onUpdateValue } = props;
|
|
37
38
|
const { nTriggerFormChange, nTriggerFormInput } = formItem;
|
|
@@ -59,14 +60,31 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
59
60
|
return index + 1;
|
|
60
61
|
}
|
|
61
62
|
}
|
|
63
|
+
let cleared = false;
|
|
62
64
|
function handleMouseMove(index, e) {
|
|
65
|
+
if (cleared)
|
|
66
|
+
return;
|
|
63
67
|
hoverIndexRef.value = getDerivedValue(index, e);
|
|
64
68
|
}
|
|
65
69
|
function handleMouseLeave() {
|
|
66
70
|
hoverIndexRef.value = null;
|
|
67
71
|
}
|
|
68
72
|
function handleClick(index, e) {
|
|
69
|
-
|
|
73
|
+
var _a;
|
|
74
|
+
const { clearable } = props;
|
|
75
|
+
const derivedValue = getDerivedValue(index, e);
|
|
76
|
+
if (clearable && derivedValue === mergedValue.value) {
|
|
77
|
+
cleared = true;
|
|
78
|
+
(_a = props.onClear) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
79
|
+
hoverIndexRef.value = null;
|
|
80
|
+
doUpdateValue(null);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
doUpdateValue(derivedValue);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function handleMouseEnterSomeStar() {
|
|
87
|
+
cleared = false;
|
|
70
88
|
}
|
|
71
89
|
const mergedSizeRef = (0, vue_1.computed)(() => {
|
|
72
90
|
const { size } = props;
|
|
@@ -81,10 +99,11 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
81
99
|
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
82
100
|
const { common: { cubicBezierEaseInOut }, self } = themeRef.value;
|
|
83
101
|
const { itemColor, itemColorActive } = self;
|
|
102
|
+
const { color } = props;
|
|
84
103
|
return {
|
|
85
104
|
'--n-bezier': cubicBezierEaseInOut,
|
|
86
105
|
'--n-item-color': itemColor,
|
|
87
|
-
'--n-item-color-active':
|
|
106
|
+
'--n-item-color-active': color || itemColorActive,
|
|
88
107
|
'--n-item-size': mergedSizeRef.value
|
|
89
108
|
};
|
|
90
109
|
});
|
|
@@ -104,11 +123,12 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
104
123
|
: undefined;
|
|
105
124
|
return {
|
|
106
125
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
107
|
-
mergedValue
|
|
126
|
+
mergedValue,
|
|
108
127
|
hoverIndex: hoverIndexRef,
|
|
109
128
|
handleMouseMove,
|
|
110
129
|
handleClick,
|
|
111
130
|
handleMouseLeave,
|
|
131
|
+
handleMouseEnterSomeStar,
|
|
112
132
|
cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
|
|
113
133
|
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
114
134
|
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
@@ -125,17 +145,17 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
125
145
|
this.themeClass
|
|
126
146
|
], style: this.cssVars, onMouseleave: this.handleMouseLeave }, (0, vue_1.renderList)(this.count, (_, index) => {
|
|
127
147
|
const icon = defaultSlot ? (defaultSlot()) : ((0, vue_1.h)(_internal_1.NBaseIcon, { clsPrefix: mergedClsPrefix }, { default: () => StarIcon_1.default }));
|
|
128
|
-
const
|
|
148
|
+
const entireStarActive = hoverIndex !== null
|
|
129
149
|
? index + 1 <= hoverIndex
|
|
130
|
-
: index + 1 <= mergedValue;
|
|
150
|
+
: index + 1 <= (mergedValue || 0);
|
|
131
151
|
return ((0, vue_1.h)("div", { key: index, class: [
|
|
132
152
|
`${mergedClsPrefix}-rate__item`,
|
|
133
|
-
|
|
153
|
+
entireStarActive && `${mergedClsPrefix}-rate__item--active`
|
|
134
154
|
], onClick: readonly
|
|
135
155
|
? undefined
|
|
136
156
|
: (e) => {
|
|
137
157
|
this.handleClick(index, e);
|
|
138
|
-
}, onMousemove: readonly
|
|
158
|
+
}, onMouseenter: this.handleMouseEnterSomeStar, onMousemove: readonly
|
|
139
159
|
? undefined
|
|
140
160
|
: (e) => {
|
|
141
161
|
this.handleMouseMove(index, e);
|
|
@@ -144,9 +164,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
144
164
|
this.allowHalf ? ((0, vue_1.h)("div", { class: [
|
|
145
165
|
`${mergedClsPrefix}-rate__half`,
|
|
146
166
|
{
|
|
147
|
-
[`${mergedClsPrefix}-rate__half--active`]: !
|
|
167
|
+
[`${mergedClsPrefix}-rate__half--active`]: !entireStarActive && hoverIndex !== null
|
|
148
168
|
? index + 0.5 <= hoverIndex
|
|
149
|
-
: index + 0.5 <= mergedValue
|
|
169
|
+
: index + 0.5 <= (mergedValue || 0)
|
|
150
170
|
}
|
|
151
171
|
] }, icon)) : null));
|
|
152
172
|
})));
|
|
@@ -26,17 +26,17 @@ exports.default = (0, cssr_1.cB)('rate', {
|
|
|
26
26
|
transform: scale(1);
|
|
27
27
|
font-size: var(--n-item-size);
|
|
28
28
|
color: var(--n-item-color);
|
|
29
|
-
`, [(0, cssr_1.c)('&:not(:first-child)',
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
`, [(0, cssr_1.c)('&:not(:first-child)', `
|
|
30
|
+
margin-left: 6px;
|
|
31
|
+
`), (0, cssr_1.cM)('active', `
|
|
32
|
+
color: var(--n-item-color-active);
|
|
33
|
+
`)]), (0, cssr_1.cNotM)('readonly', `
|
|
34
34
|
cursor: pointer;
|
|
35
|
-
`, [(0, cssr_1.cE)('item', [(0, cssr_1.c)('&:hover',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
`, [(0, cssr_1.cE)('item', [(0, cssr_1.c)('&:hover', `
|
|
36
|
+
transform: scale(1.05);
|
|
37
|
+
`), (0, cssr_1.c)('&:active', `
|
|
38
|
+
transform: scale(0.96);
|
|
39
|
+
`)])]), (0, cssr_1.cE)('half', `
|
|
40
40
|
display: flex;
|
|
41
41
|
transition: inherit;
|
|
42
42
|
position: absolute;
|
|
@@ -46,6 +46,6 @@ exports.default = (0, cssr_1.cB)('rate', {
|
|
|
46
46
|
width: 50%;
|
|
47
47
|
overflow: hidden;
|
|
48
48
|
color: rgba(255, 255, 255, 0);
|
|
49
|
-
`, [(0, cssr_1.cM)('active',
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
`, [(0, cssr_1.cM)('active', `
|
|
50
|
+
color: var(--n-item-color-active);
|
|
51
|
+
`)])]);
|
|
@@ -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/lib/slider/src/Slider.js
CHANGED
|
@@ -21,7 +21,10 @@ exports.sliderProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props),
|
|
|
21
21
|
}, marks: Object, disabled: {
|
|
22
22
|
type: Boolean,
|
|
23
23
|
default: undefined
|
|
24
|
-
}, formatTooltip: Function,
|
|
24
|
+
}, formatTooltip: Function, keyboard: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true
|
|
27
|
+
}, min: {
|
|
25
28
|
type: Number,
|
|
26
29
|
default: 0
|
|
27
30
|
}, max: {
|
|
@@ -262,7 +265,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
262
265
|
return Number(newValue.toFixed(precisionRef.value));
|
|
263
266
|
}
|
|
264
267
|
function getClosestMark(currentValue, markValues = markValuesRef.value, buffer) {
|
|
265
|
-
if (!markValues ||
|
|
268
|
+
if (!(markValues === null || markValues === void 0 ? void 0 : markValues.length))
|
|
266
269
|
return null;
|
|
267
270
|
let closestMark = null;
|
|
268
271
|
let index = -1;
|
|
@@ -302,7 +305,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
302
305
|
}
|
|
303
306
|
// dom event handle
|
|
304
307
|
function handleRailKeyDown(e) {
|
|
305
|
-
if (mergedDisabledRef.value)
|
|
308
|
+
if (mergedDisabledRef.value || !props.keyboard)
|
|
306
309
|
return;
|
|
307
310
|
const { vertical, reverse } = props;
|
|
308
311
|
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;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const vue_1 = require("vue");
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
|
+
const ionicons5_1 = require("@vicons/ionicons5");
|
|
5
6
|
const context_1 = require("../../config-provider/src/context");
|
|
6
7
|
const light_1 = require("../../themes/light");
|
|
7
8
|
const config_provider_1 = require("../../config-provider");
|
|
@@ -16,6 +17,7 @@ const button_1 = require("../../button");
|
|
|
16
17
|
const color_picker_1 = require("../../color-picker");
|
|
17
18
|
const empty_1 = require("../../empty");
|
|
18
19
|
const _utils_1 = require("../../_utils");
|
|
20
|
+
const icon_1 = require("../../icon");
|
|
19
21
|
const ColorWandIcon = ((0, vue_1.h)("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: { width: '1em', height: '1em', color: 'currentColor' } },
|
|
20
22
|
(0, vue_1.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" }),
|
|
21
23
|
(0, vue_1.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" }),
|
|
@@ -33,6 +35,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
33
35
|
name: 'ThemeEditor',
|
|
34
36
|
inheritAttrs: false,
|
|
35
37
|
setup() {
|
|
38
|
+
const isOpen = (0, vue_1.ref)(false);
|
|
36
39
|
const fileInputRef = (0, vue_1.ref)(null);
|
|
37
40
|
const NConfigProvider = (0, vue_1.inject)(context_1.configProviderInjectionKey, null);
|
|
38
41
|
const theme = (0, vue_1.computed)(() => {
|
|
@@ -93,6 +96,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
93
96
|
return;
|
|
94
97
|
fileInput.click();
|
|
95
98
|
}
|
|
99
|
+
function handleOpen() {
|
|
100
|
+
isOpen.value = !isOpen.value;
|
|
101
|
+
}
|
|
96
102
|
function handleInputFileChange() {
|
|
97
103
|
const { value: fileInput } = fileInputRef;
|
|
98
104
|
if (!fileInput)
|
|
@@ -145,7 +151,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
145
151
|
handleClearAllClick,
|
|
146
152
|
handleExportClick,
|
|
147
153
|
handleImportClick,
|
|
148
|
-
handleInputFileChange
|
|
154
|
+
handleInputFileChange,
|
|
155
|
+
handleOpen,
|
|
156
|
+
isOpen
|
|
149
157
|
};
|
|
150
158
|
},
|
|
151
159
|
render() {
|
|
@@ -154,7 +162,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
154
162
|
var _a, _b;
|
|
155
163
|
return [
|
|
156
164
|
(0, vue_1.h)(popover_1.NPopover, { scrollable: true, arrowPointToCenter: true, trigger: "manual", show: this.showPanel, displayDirective: "show", placement: "top-end", style: {
|
|
157
|
-
width: '288px',
|
|
165
|
+
width: this.isOpen ? 'calc(100vw - 80px)' : '288px',
|
|
158
166
|
height: 'calc(100vh - 200px)',
|
|
159
167
|
padding: 0
|
|
160
168
|
} }, {
|
|
@@ -195,11 +203,15 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
195
203
|
}, onChange: this.handleInputFileChange }),
|
|
196
204
|
(0, vue_1.h)(space_1.NSpace, { vertical: true }, {
|
|
197
205
|
default: () => ((0, vue_1.h)(vue_1.Fragment, null,
|
|
198
|
-
(0, vue_1.h)("
|
|
206
|
+
(0, vue_1.h)(space_1.NSpace, { align: "center", justify: "space-between", style: {
|
|
199
207
|
marginBottom: '8px',
|
|
200
208
|
fontSize: '18px',
|
|
201
209
|
fontWeight: 500
|
|
202
|
-
} },
|
|
210
|
+
} },
|
|
211
|
+
(0, vue_1.h)("span", null, this.locale.title),
|
|
212
|
+
(0, vue_1.h)(button_1.NButton, { onClick: this.handleOpen, strong: true, secondary: true, circle: true, type: this.isOpen ? 'success' : undefined }, {
|
|
213
|
+
icon: () => ((0, vue_1.h)(icon_1.NIcon, { size: "18", component: ionicons5_1.Open }))
|
|
214
|
+
})),
|
|
203
215
|
this.locale.filterCompName,
|
|
204
216
|
(0, vue_1.h)(input_1.NInput, { onChange: () => {
|
|
205
217
|
this.compNamePattern = this.tempCompNamePattern;
|
|
@@ -264,15 +276,18 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
264
276
|
filteredItemsCount += 1;
|
|
265
277
|
return ((0, vue_1.h)(collapse_1.NCollapseItem, { title: themeKey, name: themeKey }, {
|
|
266
278
|
default: () => {
|
|
267
|
-
return ((0, vue_1.h)(space_1.NSpace, {
|
|
279
|
+
return ((0, vue_1.h)(space_1.NSpace, { size: [32, 16] }, {
|
|
268
280
|
default: () => varKeys.map((varKey) => {
|
|
269
281
|
var _a, _b, _c, _d;
|
|
270
|
-
return
|
|
282
|
+
return ((0, vue_1.h)("div", { style: {
|
|
283
|
+
minWidth: '246px'
|
|
284
|
+
} },
|
|
271
285
|
(0, vue_1.h)("div", { key: `${varKey}Label`, style: {
|
|
272
286
|
wordBreak: 'break-word'
|
|
273
287
|
} }, varKey),
|
|
274
288
|
showColorPicker(varKey) ? ((0, vue_1.h)(color_picker_1.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]) ||
|
|
275
|
-
componentTheme[varKey], onComplete: this
|
|
289
|
+
componentTheme[varKey], onComplete: this
|
|
290
|
+
.applyTempOverrides, onUpdateValue: (value) => {
|
|
276
291
|
this.setTempOverrides(themeKey, varKey, value);
|
|
277
292
|
} }, {
|
|
278
293
|
action: () => {
|
|
@@ -287,10 +302,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
287
302
|
.restore
|
|
288
303
|
}));
|
|
289
304
|
}
|
|
290
|
-
})) : ((0, vue_1.h)(input_1.NInput, { key: varKey, onChange: this
|
|
305
|
+
})) : ((0, vue_1.h)(input_1.NInput, { key: varKey, onChange: this
|
|
306
|
+
.applyTempOverrides, onUpdateValue: (value) => {
|
|
291
307
|
this.setTempOverrides(themeKey, varKey, value);
|
|
292
|
-
}, value: ((_d = (_c = this.tempOverrides) === null || _c === void 0 ? void 0 : _c[themeKey]) === null || _d === void 0 ? void 0 : _d[varKey]) || '', placeholder: componentTheme[varKey] }))
|
|
293
|
-
];
|
|
308
|
+
}, value: ((_d = (_c = this.tempOverrides) === null || _c === void 0 ? void 0 : _c[themeKey]) === null || _d === void 0 ? void 0 : _d[varKey]) || '', placeholder: componentTheme[varKey] }))));
|
|
294
309
|
})
|
|
295
310
|
}));
|
|
296
311
|
}
|
|
@@ -54,8 +54,8 @@ exports.default = (0, cssr_1.cB)('tree', `
|
|
|
54
54
|
`)]), (0, cssr_1.cNotM)('disabled', [(0, cssr_1.cM)('clickable', [(0, cssr_1.cB)('tree-node-content', `
|
|
55
55
|
cursor: pointer;
|
|
56
56
|
`)])])]), (0, cssr_1.cM)('block-node', [(0, cssr_1.cB)('tree-node-content', `
|
|
57
|
-
flex
|
|
58
|
-
|
|
57
|
+
flex: 1;
|
|
58
|
+
min-width: 0;
|
|
59
59
|
`)]), (0, cssr_1.cNotM)('block-line', [(0, cssr_1.cB)('tree-node', [(0, cssr_1.cNotM)('disabled', [(0, cssr_1.cB)('tree-node-content', [(0, cssr_1.c)('&:hover', {
|
|
60
60
|
backgroundColor: 'var(--n-node-color-hover)'
|
|
61
61
|
})]), (0, cssr_1.cM)('selectable', [(0, cssr_1.cB)('tree-node-content', [(0, cssr_1.c)('&:active', {
|
|
@@ -140,7 +140,8 @@ exports.default = (0, cssr_1.cB)('tree', `
|
|
|
140
140
|
`), (0, cssr_1.cE)('text', `
|
|
141
141
|
border-bottom: 1px solid #0000;
|
|
142
142
|
transition: border-color .3s var(--n-bezier);
|
|
143
|
-
flex-grow:1;
|
|
143
|
+
flex-grow: 1;
|
|
144
|
+
max-width: 100%;
|
|
144
145
|
`), (0, cssr_1.cE)('suffix', `
|
|
145
146
|
display: inline-flex;
|
|
146
147
|
`)]), (0, cssr_1.cE)('empty', 'margin: auto;')]);
|
package/lib/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/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "naive-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.33.0",
|
|
4
4
|
"description": "A Vue 3 Component Library. Fairly Complete, Theme Customizable, Uses TypeScript, Fast",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
"fast-glob": "^3.2.11",
|
|
95
95
|
"fs-extra": "^10.0.1",
|
|
96
96
|
"husky": "^8.0.1",
|
|
97
|
-
"inquirer": "^
|
|
97
|
+
"inquirer": "^9.1.0",
|
|
98
98
|
"jest": "^28.0.3",
|
|
99
99
|
"jest-canvas-mock": "^2.3.1",
|
|
100
|
-
"jest-environment-jsdom": "^
|
|
100
|
+
"jest-environment-jsdom": "^29.0.0",
|
|
101
101
|
"lint-staged": "^13.0.3",
|
|
102
102
|
"lyla": "^0.6.8",
|
|
103
103
|
"marked": "^4.0.13",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"ts-jest": "^28.0.1",
|
|
111
111
|
"typescript": "~4.6.3",
|
|
112
112
|
"vfonts": "^0.1.0",
|
|
113
|
-
"vite": "3.0.
|
|
113
|
+
"vite": "3.0.9",
|
|
114
114
|
"vue": "^3.2.36",
|
|
115
115
|
"vue-router": "^4.0.14",
|
|
116
116
|
"vue-tsc": "^0.40.1"
|