@v-c/rate 0.0.1 → 1.0.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/Rate.cjs +22 -19
- package/dist/Rate.d.ts +1 -1
- package/dist/Rate.js +1 -1
- package/dist/Star.cjs +7 -4
- package/dist/index.cjs +4 -1
- package/dist/index.d.ts +1 -0
- package/dist/useRefs.cjs +6 -3
- package/dist/util.cjs +1 -0
- package/package.json +2 -2
package/dist/Rate.cjs
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
const require_Star = require("./Star.cjs");
|
|
4
7
|
const require_useRefs = require("./useRefs.cjs");
|
|
5
8
|
const require_util = require("./util.cjs");
|
|
6
9
|
let vue = require("vue");
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
let
|
|
10
|
+
let _v_c_util = require("@v-c/util");
|
|
11
|
+
let _v_c_util_dist_hooks_useMergedState = require("@v-c/util/dist/hooks/useMergedState");
|
|
12
|
+
_v_c_util_dist_hooks_useMergedState = require_rolldown_runtime.__toESM(_v_c_util_dist_hooks_useMergedState);
|
|
13
|
+
let _v_c_util_dist_KeyCode = require("@v-c/util/dist/KeyCode");
|
|
14
|
+
_v_c_util_dist_KeyCode = require_rolldown_runtime.__toESM(_v_c_util_dist_KeyCode);
|
|
15
|
+
let _v_c_util_dist_pickAttrs = require("@v-c/util/dist/pickAttrs");
|
|
16
|
+
_v_c_util_dist_pickAttrs = require_rolldown_runtime.__toESM(_v_c_util_dist_pickAttrs);
|
|
17
|
+
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
15
18
|
var defaults = {
|
|
16
19
|
prefixCls: "vc-rate",
|
|
17
20
|
count: 5,
|
|
@@ -35,8 +38,8 @@ var Rate_default = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, exp
|
|
|
35
38
|
focus: triggerFocus,
|
|
36
39
|
blur: triggerBlur
|
|
37
40
|
});
|
|
38
|
-
const [state, setStateValue] = (0,
|
|
39
|
-
const [cleanedValue, setCleanedValue] = (0,
|
|
41
|
+
const [state, setStateValue] = (0, _v_c_util_dist_hooks_useMergedState.default)(props.defaultValue || 0, { value: (0, vue.computed)(() => props.value) });
|
|
42
|
+
const [cleanedValue, setCleanedValue] = (0, _v_c_util_dist_hooks_useMergedState.default)(null);
|
|
40
43
|
const getStarValue = (index, x) => {
|
|
41
44
|
const { direction, allowHalf } = props;
|
|
42
45
|
const reverse = direction === "rtl";
|
|
@@ -97,16 +100,16 @@ var Rate_default = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, exp
|
|
|
97
100
|
const reverse = direction === "rtl";
|
|
98
101
|
const step = allowHalf ? .5 : 1;
|
|
99
102
|
if (keyboard) {
|
|
100
|
-
if (keyCode ===
|
|
103
|
+
if (keyCode === _v_c_util_dist_KeyCode.default.RIGHT && value < count && !reverse) {
|
|
101
104
|
changeValue(value + step);
|
|
102
105
|
event.preventDefault();
|
|
103
|
-
} else if (keyCode ===
|
|
106
|
+
} else if (keyCode === _v_c_util_dist_KeyCode.default.LEFT && value > 0 && !reverse) {
|
|
104
107
|
changeValue(value - step);
|
|
105
108
|
event.preventDefault();
|
|
106
|
-
} else if (keyCode ===
|
|
109
|
+
} else if (keyCode === _v_c_util_dist_KeyCode.default.RIGHT && value > 0 && reverse) {
|
|
107
110
|
changeValue(value - step);
|
|
108
111
|
event.preventDefault();
|
|
109
|
-
} else if (keyCode ===
|
|
112
|
+
} else if (keyCode === _v_c_util_dist_KeyCode.default.LEFT && value < count && reverse) {
|
|
110
113
|
changeValue(value + step);
|
|
111
114
|
event.preventDefault();
|
|
112
115
|
}
|
|
@@ -118,9 +121,9 @@ var Rate_default = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, exp
|
|
|
118
121
|
if (autoFocus && !disabled) triggerFocus();
|
|
119
122
|
});
|
|
120
123
|
return () => {
|
|
121
|
-
const { count, allowHalf, disabled, prefixCls, direction, character, characterRender, tabIndex
|
|
122
|
-
const { className, style, restAttrs } = (0,
|
|
123
|
-
const classString = (0,
|
|
124
|
+
const { count, allowHalf, disabled, prefixCls, direction, character, characterRender, tabIndex, ...restProps } = props;
|
|
125
|
+
const { className, style, restAttrs } = (0, _v_c_util_dist_props_util.getAttrStyleAndClass)(attrs);
|
|
126
|
+
const classString = (0, _v_c_util.clsx)(prefixCls, className, {
|
|
124
127
|
[`${prefixCls}-disabled`]: disabled,
|
|
125
128
|
[`${prefixCls}-rtl`]: direction === "rtl"
|
|
126
129
|
});
|
|
@@ -149,7 +152,7 @@ var Rate_default = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, exp
|
|
|
149
152
|
"onBlur": disabled ? null : onInternalBlur,
|
|
150
153
|
"onKeydown": disabled ? null : onInternalKeyDown,
|
|
151
154
|
"ref": rateRef
|
|
152
|
-
}, (0,
|
|
155
|
+
}, (0, _v_c_util_dist_pickAttrs.default)(restAttrs, {
|
|
153
156
|
aria: true,
|
|
154
157
|
data: true,
|
|
155
158
|
attr: true
|
package/dist/Rate.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface RateProps extends Pick<StarProps, 'count' | 'character' | 'char
|
|
|
7
7
|
'value'?: number;
|
|
8
8
|
'allowClear'?: boolean;
|
|
9
9
|
'keyboard'?: boolean;
|
|
10
|
-
'direction'?:
|
|
10
|
+
'direction'?: Direction;
|
|
11
11
|
'tabIndex'?: number | string;
|
|
12
12
|
'autoFocus'?: boolean;
|
|
13
13
|
'onHoverChange'?: (value: number) => void;
|
package/dist/Rate.js
CHANGED
|
@@ -113,7 +113,7 @@ var Rate_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }) =>
|
|
|
113
113
|
if (autoFocus && !disabled) triggerFocus();
|
|
114
114
|
});
|
|
115
115
|
return () => {
|
|
116
|
-
const { count, allowHalf, disabled, prefixCls, direction, character, characterRender, tabIndex
|
|
116
|
+
const { count, allowHalf, disabled, prefixCls, direction, character, characterRender, tabIndex, ...restProps } = props;
|
|
117
117
|
const { className, style, restAttrs } = getAttrStyleAndClass(attrs);
|
|
118
118
|
const classString = clsx(prefixCls, className, {
|
|
119
119
|
[`${prefixCls}-disabled`]: disabled,
|
package/dist/Star.cjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
let vue = require("vue");
|
|
4
|
-
let
|
|
5
|
-
|
|
7
|
+
let _v_c_util_dist_KeyCode = require("@v-c/util/dist/KeyCode");
|
|
8
|
+
_v_c_util_dist_KeyCode = require_rolldown_runtime.__toESM(_v_c_util_dist_KeyCode);
|
|
6
9
|
var Star_default = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
7
10
|
const onHover = (e) => {
|
|
8
11
|
const { index } = props;
|
|
@@ -14,7 +17,7 @@ var Star_default = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
|
14
17
|
};
|
|
15
18
|
const onKeyDown = (e) => {
|
|
16
19
|
const { index } = props;
|
|
17
|
-
if (e.keyCode ===
|
|
20
|
+
if (e.keyCode === _v_c_util_dist_KeyCode.default.ENTER) props?.onClick?.(e, index);
|
|
18
21
|
};
|
|
19
22
|
const cls = (0, vue.computed)(() => {
|
|
20
23
|
const { prefixCls, index, value, allowHalf, focused } = props;
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_Rate = require("./Rate.cjs");
|
|
3
6
|
var src_default = require_Rate.default;
|
|
4
7
|
exports.default = src_default;
|
package/dist/index.d.ts
CHANGED
package/dist/useRefs.cjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
let vue = require("vue");
|
|
4
|
-
let
|
|
7
|
+
let _v_c_util_dist_Dom_findDOMNode = require("@v-c/util/dist/Dom/findDOMNode");
|
|
5
8
|
function useRefs() {
|
|
6
9
|
const refs = (0, vue.ref)(/* @__PURE__ */ new Map());
|
|
7
10
|
const setRef = (key) => (el) => {
|
|
8
|
-
refs.value.set(key, (0,
|
|
11
|
+
refs.value.set(key, (0, _v_c_util_dist_Dom_findDOMNode.getDOM)(el));
|
|
9
12
|
};
|
|
10
13
|
(0, vue.onBeforeUpdate)(() => {
|
|
11
14
|
refs.value = /* @__PURE__ */ new Map();
|
package/dist/util.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/rate",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"vue": "^3.0.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@v-c/util": "^1.0.
|
|
26
|
+
"@v-c/util": "^1.0.9"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "vite build",
|