@nutui/nutui-react 1.3.9 → 1.3.10-beta.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/CHANGELOG.md +36 -0
- package/dist/esm/Button.js +3 -1
- package/dist/esm/Checkbox.js +7 -121
- package/dist/esm/CheckboxGroup.js +36 -4
- package/dist/esm/Input.js +11 -4
- package/dist/esm/Menu.js +3 -2
- package/dist/esm/MenuItem.js +1 -2
- package/dist/esm/NoticeBar.js +12 -16
- package/dist/esm/Price.js +20 -23
- package/dist/esm/Radio.js +6 -115
- package/dist/esm/RadioGroup.js +36 -6
- package/dist/esm/TabbarItem.js +6 -5
- package/dist/esm/Tag.js +6 -4
- package/dist/esm/checkbox-255983fc.js +121 -0
- package/dist/esm/radio-cf953c7a.js +118 -0
- package/dist/esm/types/src/packages/checkbox/checkbox.d.ts +6 -1
- package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.d.ts +2 -0
- package/dist/esm/types/src/packages/checkboxgroup/type.d.ts +6 -0
- package/dist/esm/types/src/packages/input/input.d.ts +1 -0
- package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +91 -0
- package/dist/esm/types/src/packages/price/price.d.ts +2 -0
- package/dist/esm/types/src/packages/radiogroup/radiogroup.d.ts +2 -0
- package/dist/esm/types/src/packages/radiogroup/type.d.ts +7 -0
- package/dist/esm/types/src/packages/tabbaritem/tabbaritem.d.ts +1 -1
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/nutui.react.es.js +162 -83
- package/dist/nutui.react.umd.js +162 -83
- package/dist/packages/badge/badge.scss +10 -10
- package/dist/packages/button/button.scss +3 -3
- package/dist/packages/cell/cell.scss +1 -4
- package/dist/packages/cellgroup/cellgroup.scss +8 -0
- package/dist/packages/countdown/countdown.scss +1 -1
- package/dist/packages/infiniteloading/infiniteloading.scss +1 -1
- package/dist/packages/inputnumber/inputnumber.scss +3 -3
- package/dist/packages/noticebar/noticebar.scss +3 -0
- package/dist/packages/price/price.scss +27 -11
- package/dist/packages/radio/radio.scss +8 -7
- package/dist/packages/shortpassword/shortpassword.scss +4 -4
- package/dist/packages/skeleton/skeleton.scss +1 -1
- package/dist/packages/swiper/swiper.scss +4 -4
- package/dist/packages/switch/switch.scss +8 -8
- package/dist/packages/timepannel/timepannel.scss +3 -3
- package/dist/packages/timeselect/timeselect.scss +4 -4
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/variables.scss +573 -248
- package/dist/types/index.d.ts +19 -3
- package/package.json +1 -1
- package/dist/esm/context-aa058329.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
# v1.3.10
|
|
2
|
+
`2022-11-09`
|
|
3
|
+
|
|
4
|
+
* :bug: fix: tabbarItem组件自定义名称统一为className字段 (#434) @cuicuiworld
|
|
5
|
+
* :bug: fix: checkbox 内部类型可选 (#430) @oasis-cloud
|
|
6
|
+
* :bug: fix: noticebar 关闭事件优化,小程序样式优化 (#424) @vickyYe
|
|
7
|
+
* :bug: fix: 取消mixin样式文件引入 (#428) @libin0824
|
|
8
|
+
* :bug: fix(button): add space between icon and text (#418) @Kwan
|
|
9
|
+
* :bug: fix: cell 组件 icon marign 设置错误 (#423) @oasis-cloud
|
|
10
|
+
* :bug: fix: cell组件删除冗余样式 (#401) @irisSong
|
|
11
|
+
* :bug: fix: 变量提取、暗黑模式适配:cellgroup、demo主样式 (#404) @xiaoyatong
|
|
12
|
+
* :sparkles: feat: tag组件添加自定义className和style属性 (#435) @cuicuiworld
|
|
13
|
+
* :sparkles: feat: Address 增加Elevator Taro 适配 (#400) @yangxiaolu1993
|
|
14
|
+
* :sparkles: feat: CheckboxGroup支持options设置子元素 (#425) @cuicuiworld
|
|
15
|
+
* :sparkles: feat: price组件新增自定义大中小尺寸、自定义符号展示在价格前或后、支持没有小数 (#429) @irisSong
|
|
16
|
+
* :sparkles: feat: input组件支持name属性 (#427) @simpleStyle
|
|
17
|
+
* :sparkles: feat: 增加issue-helper入口 (#421) @Ymm0008
|
|
18
|
+
* :sparkles: feat: 单选按钮组支持options设置子元素 (#374) @cuicuiworld
|
|
19
|
+
* 📖 docs: tabs 文档中的粘性布局文案修改 (#403) @oasis-cloud
|
|
20
|
+
* 📖 docs: radio和checkbox文档优化 (#431) @oasis-cloud
|
|
21
|
+
* 📖 docs: 修复部分演示组件的文案显示问题 (#419) @Kwan
|
|
22
|
+
|
|
23
|
+
# v1.3.9
|
|
24
|
+
`2022-11-02`
|
|
25
|
+
|
|
26
|
+
* :bug: fix: cellgroup组件自定义名称统一为className字段 (#399) @irisSong
|
|
27
|
+
* :bug: fix: GridItem缺少onClick事件;DatePicker修改onChange名 (#394) @yangxiaolu1993
|
|
28
|
+
* :bug: fix: 支持css粘性布局,引起的左右布局bug修复 (#393) @leiyu0932
|
|
29
|
+
* :bug: fix: button 自定义 style 重复生效 (#391) @oasis-cloud
|
|
30
|
+
* :sparkles: chore: 生成多语言用到的 key (#390) @oasis-cloud
|
|
31
|
+
* :bug: fix: 修复cellgroup组件描述判断错误问题 (#389) @irisSong
|
|
32
|
+
* :bug: fix: sass 变量增加 !default (#387) @oasis-cloud
|
|
33
|
+
* :sparkles: docs: icon 大小展示按照从小到大顺序 (#386) @oasis-cloud
|
|
34
|
+
* :bug: fix: elevator组件taro版本适配完成 (#372) @irisSong
|
|
35
|
+
* :sparkles: feat: backtop 组件适配 taro (#376) @vickyYe
|
|
36
|
+
|
|
1
37
|
# v1.3.8
|
|
2
38
|
`2022-10-26`
|
|
3
39
|
|
package/dist/esm/Button.js
CHANGED
|
@@ -94,7 +94,9 @@ var Button = function Button(props) {
|
|
|
94
94
|
classPrefix: iconClassPrefix,
|
|
95
95
|
fontClassName: iconFontClassName,
|
|
96
96
|
name: icon
|
|
97
|
-
}) : '',
|
|
97
|
+
}) : '', React__default.createElement("div", {
|
|
98
|
+
className: "text"
|
|
99
|
+
}, children)));
|
|
98
100
|
};
|
|
99
101
|
Button.defaultProps = defaultProps;
|
|
100
102
|
Button.displayName = 'NutButton';
|
package/dist/esm/Checkbox.js
CHANGED
|
@@ -1,122 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import React__default, { useState, useEffect } from 'react';
|
|
8
|
-
import Icon from './Icon.js';
|
|
9
|
-
import CheckboxGroup from './CheckboxGroup.js';
|
|
10
|
-
import { c as cn } from './bem-893ad28d.js';
|
|
11
|
-
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
1
|
+
import { C as Checkbox } from './checkbox-255983fc.js';
|
|
2
|
+
export { C as default } from './checkbox-255983fc.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import './Icon.js';
|
|
5
|
+
import './CheckboxGroup.js';
|
|
6
|
+
import './bem-893ad28d.js';
|
|
12
7
|
import '@bem-react/classname';
|
|
13
|
-
|
|
14
|
-
checked: false,
|
|
15
|
-
disabled: false,
|
|
16
|
-
textPosition: 'right',
|
|
17
|
-
iconSize: 18,
|
|
18
|
-
iconName: 'check-normal',
|
|
19
|
-
iconActiveName: 'checked',
|
|
20
|
-
iconClassPrefix: 'nut-icon',
|
|
21
|
-
iconFontClassName: 'nutui-iconfont',
|
|
22
|
-
iconIndeterminateName: 'check-disabled',
|
|
23
|
-
onChange: function onChange(state, label) {}
|
|
24
|
-
});
|
|
25
|
-
var Checkbox = function Checkbox(props) {
|
|
26
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
27
|
-
children = _defaultProps$props.children;
|
|
28
|
-
var b = cn('checkbox');
|
|
29
|
-
var iconName = props.iconName,
|
|
30
|
-
iconSize = props.iconSize,
|
|
31
|
-
label = props.label,
|
|
32
|
-
className = props.className,
|
|
33
|
-
textPosition = props.textPosition,
|
|
34
|
-
iconActiveName = props.iconActiveName,
|
|
35
|
-
checked = props.checked,
|
|
36
|
-
disabled = props.disabled,
|
|
37
|
-
onChange = props.onChange,
|
|
38
|
-
indeterminate = props.indeterminate,
|
|
39
|
-
iconClassPrefix = props.iconClassPrefix,
|
|
40
|
-
iconFontClassName = props.iconFontClassName,
|
|
41
|
-
iconIndeterminateName = props.iconIndeterminateName,
|
|
42
|
-
getParentVals = props.getParentVals,
|
|
43
|
-
max = props.max,
|
|
44
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
45
|
-
var _useState = useState(checked),
|
|
46
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
-
innerChecked = _useState2[0],
|
|
48
|
-
setInnerChecked = _useState2[1];
|
|
49
|
-
var _useState3 = useState(disabled),
|
|
50
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
|
-
innerDisabled = _useState4[0],
|
|
52
|
-
setDisabled = _useState4[1];
|
|
53
|
-
var _useState5 = useState(indeterminate),
|
|
54
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
55
|
-
_indeterminate = _useState6[0],
|
|
56
|
-
setIndeterminate = _useState6[1];
|
|
57
|
-
useEffect(function () {
|
|
58
|
-
setInnerChecked(checked);
|
|
59
|
-
setDisabled(disabled);
|
|
60
|
-
}, [disabled, checked]);
|
|
61
|
-
useEffect(function () {
|
|
62
|
-
setIndeterminate(indeterminate);
|
|
63
|
-
}, [indeterminate]);
|
|
64
|
-
var getIconName = function getIconName() {
|
|
65
|
-
if (!innerChecked) {
|
|
66
|
-
return iconName;
|
|
67
|
-
}
|
|
68
|
-
if (_indeterminate) {
|
|
69
|
-
return iconIndeterminateName;
|
|
70
|
-
}
|
|
71
|
-
return iconActiveName;
|
|
72
|
-
};
|
|
73
|
-
var renderIcon = function renderIcon() {
|
|
74
|
-
return React__default.createElement(Icon, {
|
|
75
|
-
classPrefix: iconClassPrefix,
|
|
76
|
-
fontClassName: iconFontClassName,
|
|
77
|
-
name: getIconName(),
|
|
78
|
-
size: iconSize,
|
|
79
|
-
className: color()
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
var color = function color() {
|
|
83
|
-
if (innerDisabled) {
|
|
84
|
-
return 'nut-checkbox__icon--disable';
|
|
85
|
-
}
|
|
86
|
-
if (innerChecked) {
|
|
87
|
-
if (_indeterminate) {
|
|
88
|
-
return 'nut-checkbox__icon--indeterminate';
|
|
89
|
-
}
|
|
90
|
-
return 'nut-checkbox__icon';
|
|
91
|
-
}
|
|
92
|
-
return 'nut-checkbox__icon--unchecked';
|
|
93
|
-
// return !innerDisabled ? (!innerChecked ? '#d6d6d6' : '#fa2c19') : '#f5f5f5'
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
var renderLabel = function renderLabel() {
|
|
97
|
-
return React__default.createElement("span", {
|
|
98
|
-
className: "".concat(b('label', {
|
|
99
|
-
disabled: innerDisabled
|
|
100
|
-
}), " ")
|
|
101
|
-
}, children || label);
|
|
102
|
-
};
|
|
103
|
-
var handleClick = function handleClick() {
|
|
104
|
-
if (!disabled) {
|
|
105
|
-
var latest = !innerChecked;
|
|
106
|
-
if (max !== undefined && latest && getParentVals().length >= max) return;
|
|
107
|
-
onChange && onChange(latest, label || children);
|
|
108
|
-
setInnerChecked(latest);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
return React__default.createElement("div", _objectSpread(_objectSpread({
|
|
112
|
-
className: "".concat(b({
|
|
113
|
-
reverse: textPosition === 'left'
|
|
114
|
-
}), " ").concat(className || '')
|
|
115
|
-
}, rest), {}, {
|
|
116
|
-
onClick: handleClick
|
|
117
|
-
}), renderIcon(), renderLabel());
|
|
118
|
-
};
|
|
119
|
-
Checkbox.defaultProps = defaultProps;
|
|
120
|
-
Checkbox.displayName = 'NutCheckBox';
|
|
121
|
-
Checkbox.Group = CheckboxGroup;
|
|
122
|
-
export { Checkbox as default };
|
|
8
|
+
import './typings-1c5f2628.js';
|
|
@@ -2,17 +2,23 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
-
var _excluded = ["className", "disabled", "onChange", "checkedValue", "max"]
|
|
5
|
+
var _excluded = ["className", "disabled", "onChange", "checkedValue", "max", "options"],
|
|
6
|
+
_excluded2 = ["label", "value", "disabled", "onChange"];
|
|
6
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
-
import React__default, { useState, useImperativeHandle, useEffect } from 'react';
|
|
9
|
+
import React__default, { useState, useImperativeHandle, useEffect, useCallback } from 'react';
|
|
9
10
|
import { c as cn } from './bem-893ad28d.js';
|
|
11
|
+
import { C as Checkbox } from './checkbox-255983fc.js';
|
|
10
12
|
import '@bem-react/classname';
|
|
13
|
+
import './Icon.js';
|
|
14
|
+
import './CheckboxGroup.js';
|
|
15
|
+
import './typings-1c5f2628.js';
|
|
11
16
|
var defaultProps = {
|
|
12
17
|
disabled: false,
|
|
13
18
|
checkedValue: [],
|
|
14
19
|
max: undefined,
|
|
15
|
-
onChange: function onChange(value) {}
|
|
20
|
+
onChange: function onChange(value) {},
|
|
21
|
+
options: []
|
|
16
22
|
};
|
|
17
23
|
var CheckboxGroup = React__default.forwardRef(function (props, ref) {
|
|
18
24
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
@@ -23,6 +29,7 @@ var CheckboxGroup = React__default.forwardRef(function (props, ref) {
|
|
|
23
29
|
onChange = props.onChange,
|
|
24
30
|
checkedValue = props.checkedValue,
|
|
25
31
|
max = props.max,
|
|
32
|
+
options = props.options,
|
|
26
33
|
rest = _objectWithoutProperties(props, _excluded);
|
|
27
34
|
var _useState = useState(disabled),
|
|
28
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -83,6 +90,10 @@ var CheckboxGroup = React__default.forwardRef(function (props, ref) {
|
|
|
83
90
|
if (!innerValue) return false;
|
|
84
91
|
return (innerValue === null || innerValue === void 0 ? void 0 : innerValue.indexOf(child.props.label || child.children)) > -1;
|
|
85
92
|
}
|
|
93
|
+
function validateChecked(value) {
|
|
94
|
+
if (innerValue === null) return false;
|
|
95
|
+
return innerValue === value;
|
|
96
|
+
}
|
|
86
97
|
function getParentVals() {
|
|
87
98
|
return innerValue;
|
|
88
99
|
}
|
|
@@ -101,9 +112,30 @@ var CheckboxGroup = React__default.forwardRef(function (props, ref) {
|
|
|
101
112
|
});
|
|
102
113
|
});
|
|
103
114
|
}
|
|
115
|
+
var renderOptionsChildren = useCallback(function () {
|
|
116
|
+
return options === null || options === void 0 ? void 0 : options.map(function (_ref) {
|
|
117
|
+
var label = _ref.label,
|
|
118
|
+
value = _ref.value,
|
|
119
|
+
disabled = _ref.disabled,
|
|
120
|
+
onChange = _ref.onChange,
|
|
121
|
+
rest = _objectWithoutProperties(_ref, _excluded2);
|
|
122
|
+
var childChecked = validateChecked(value);
|
|
123
|
+
return React__default.createElement(Checkbox, _objectSpread(_objectSpread({
|
|
124
|
+
key: value === null || value === void 0 ? void 0 : value.toString(),
|
|
125
|
+
children: label,
|
|
126
|
+
label: value,
|
|
127
|
+
disabled: innerDisabled ? true : disabled,
|
|
128
|
+
onChange: handleChildChange
|
|
129
|
+
}, rest), {}, {
|
|
130
|
+
max: max,
|
|
131
|
+
getParentVals: getParentVals,
|
|
132
|
+
checked: childChecked
|
|
133
|
+
}));
|
|
134
|
+
});
|
|
135
|
+
}, [innerValue]);
|
|
104
136
|
return React__default.createElement("div", _objectSpread({
|
|
105
137
|
className: "".concat(b(), " ").concat(className || '')
|
|
106
|
-
}, rest), cloneChildren());
|
|
138
|
+
}, rest), options !== null && options !== void 0 && options.length ? renderOptionsChildren() : cloneChildren());
|
|
107
139
|
});
|
|
108
140
|
CheckboxGroup.defaultProps = defaultProps;
|
|
109
141
|
CheckboxGroup.displayName = 'NutCheckboxGroup';
|
package/dist/esm/Input.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["children", "type", "defaultValue", "placeholder", "label", "labelClass", "labelWidth", "labelAlign", "colon", "inputAlign", "center", "required", "disabled", "readonly", "error", "maxlength", "leftIcon", "leftIconSize", "rightIcon", "rightIconSize", "clearable", "clearIcon", "clearSize", "border", "formatTrigger", "rules", "errorMessage", "errorMessageAlign", "showWordLimit", "autofocus", "style", "className", "rows", "slotButton", "slotInput", "onChange", "onBlur", "onFocus", "onClear", "formatter", "keypress", "onClickInput", "onClickLeftIcon", "onClickRightIcon", "onClick", "change", "blur", "focus", "clear", "clickInput", "clickLeftIcon", "clickRightIcon", "click", "iconClassPrefix", "iconFontClassName"];
|
|
4
|
+
var _excluded = ["children", "type", "name", "defaultValue", "placeholder", "label", "labelClass", "labelWidth", "labelAlign", "colon", "inputAlign", "center", "required", "disabled", "readonly", "error", "maxlength", "leftIcon", "leftIconSize", "rightIcon", "rightIconSize", "clearable", "clearIcon", "clearSize", "border", "formatTrigger", "rules", "errorMessage", "errorMessageAlign", "showWordLimit", "autofocus", "style", "className", "rows", "slotButton", "slotInput", "onChange", "onBlur", "onFocus", "onClear", "formatter", "keypress", "onClickInput", "onClickLeftIcon", "onClickRightIcon", "onClick", "change", "blur", "focus", "clear", "clickInput", "clickLeftIcon", "clickRightIcon", "click", "iconClassPrefix", "iconFontClassName"];
|
|
5
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
-
import React__default, { useState, useRef, useLayoutEffect, useEffect, useCallback } from 'react';
|
|
7
|
+
import React__default, { forwardRef, useState, useRef, useLayoutEffect, useEffect, useImperativeHandle, useCallback } from 'react';
|
|
8
8
|
import Icon from './Icon.js';
|
|
9
9
|
import { useConfig } from './ConfigProvider.js';
|
|
10
10
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
@@ -36,6 +36,7 @@ function formatNumber(value) {
|
|
|
36
36
|
}
|
|
37
37
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
38
38
|
type: 'text',
|
|
39
|
+
name: '',
|
|
39
40
|
defaultValue: '',
|
|
40
41
|
placeholder: '',
|
|
41
42
|
label: '',
|
|
@@ -68,12 +69,13 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
68
69
|
slotButton: null,
|
|
69
70
|
slotInput: null
|
|
70
71
|
});
|
|
71
|
-
var Input = function
|
|
72
|
+
var Input = forwardRef(function (props, ref) {
|
|
72
73
|
var _useConfig = useConfig(),
|
|
73
74
|
locale = _useConfig.locale;
|
|
74
75
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
75
76
|
children = _defaultProps$props.children,
|
|
76
77
|
type = _defaultProps$props.type,
|
|
78
|
+
name = _defaultProps$props.name,
|
|
77
79
|
defaultValue = _defaultProps$props.defaultValue,
|
|
78
80
|
placeholder = _defaultProps$props.placeholder,
|
|
79
81
|
label = _defaultProps$props.label,
|
|
@@ -160,6 +162,9 @@ var Input = function Input(props) {
|
|
|
160
162
|
resetValidation();
|
|
161
163
|
}
|
|
162
164
|
}, [inputValue]);
|
|
165
|
+
useImperativeHandle(ref, function () {
|
|
166
|
+
return inputRef.current;
|
|
167
|
+
});
|
|
163
168
|
var inputClass = useCallback(function () {
|
|
164
169
|
var prefixCls = 'nut-input';
|
|
165
170
|
return [prefixCls, "".concat(center ? 'center' : ''), "".concat(disabled ? "".concat(prefixCls, "-disabled") : ''), "".concat(required ? "".concat(prefixCls, "-required") : ''), "".concat(error ? "".concat(prefixCls, "-error") : ''), "".concat(border ? "".concat(prefixCls, "-border") : '')].filter(Boolean).join(' ');
|
|
@@ -293,6 +298,7 @@ var Input = function Input(props) {
|
|
|
293
298
|
handleClickInput(e);
|
|
294
299
|
}
|
|
295
300
|
}, type === 'textarea' ? React__default.createElement("textarea", {
|
|
301
|
+
name: name,
|
|
296
302
|
className: "input-text",
|
|
297
303
|
ref: inputRef,
|
|
298
304
|
style: {
|
|
@@ -315,6 +321,7 @@ var Input = function Input(props) {
|
|
|
315
321
|
handleInput(e);
|
|
316
322
|
}
|
|
317
323
|
}) : React__default.createElement("input", {
|
|
324
|
+
name: name,
|
|
318
325
|
className: "input-text",
|
|
319
326
|
ref: inputRef,
|
|
320
327
|
style: {
|
|
@@ -367,7 +374,7 @@ var Input = function Input(props) {
|
|
|
367
374
|
textAlign: errorMessageAlign
|
|
368
375
|
}
|
|
369
376
|
}, errorMessage) : null)));
|
|
370
|
-
};
|
|
377
|
+
});
|
|
371
378
|
Input.defaultProps = defaultProps;
|
|
372
379
|
Input.displayName = 'NutInput';
|
|
373
380
|
export { Input as default };
|
package/dist/esm/Menu.js
CHANGED
|
@@ -110,7 +110,8 @@ var Menu = function Menu(props) {
|
|
|
110
110
|
title = _child$props.title,
|
|
111
111
|
value = _child$props.value,
|
|
112
112
|
direction = _child$props.direction,
|
|
113
|
-
options = _child$props.options
|
|
113
|
+
options = _child$props.options,
|
|
114
|
+
className = _child$props.className;
|
|
114
115
|
var currentTitle = options === null || options === void 0 ? void 0 : options.filter(function (option) {
|
|
115
116
|
return option.value === value;
|
|
116
117
|
});
|
|
@@ -124,7 +125,7 @@ var Menu = function Menu(props) {
|
|
|
124
125
|
className: "nut-menu__item ".concat(classNames({
|
|
125
126
|
active: itemShow[index],
|
|
126
127
|
disabled: disabled
|
|
127
|
-
})),
|
|
128
|
+
}), " ").concat(className),
|
|
128
129
|
style: {
|
|
129
130
|
color: itemShow[index] ? activeColor : ''
|
|
130
131
|
},
|
package/dist/esm/MenuItem.js
CHANGED
|
@@ -29,7 +29,6 @@ var MenuItem = function MenuItem(props) {
|
|
|
29
29
|
useConfig();
|
|
30
30
|
var mergedProps = _objectSpread(_objectSpread({}, defaultProps), props);
|
|
31
31
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
32
|
-
className = _defaultProps$props.className,
|
|
33
32
|
style = _defaultProps$props.style,
|
|
34
33
|
options = _defaultProps$props.options,
|
|
35
34
|
value = _defaultProps$props.value,
|
|
@@ -121,7 +120,7 @@ var MenuItem = function MenuItem(props) {
|
|
|
121
120
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
122
121
|
className: "placeholder-element ".concat(classNames({
|
|
123
122
|
up: direction === 'up'
|
|
124
|
-
})
|
|
123
|
+
})),
|
|
125
124
|
style: placeholderStyle(),
|
|
126
125
|
onClick: function onClick() {
|
|
127
126
|
return parent.toggleItemShow(orderKey);
|
package/dist/esm/NoticeBar.js
CHANGED
|
@@ -219,13 +219,11 @@ var NoticeBar = function NoticeBar(props) {
|
|
|
219
219
|
/**
|
|
220
220
|
* 点击滚动单元
|
|
221
221
|
*/
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
close && close(scrollList[0]);
|
|
228
|
-
onClose && onClose(scrollList[0]);
|
|
222
|
+
var handleClickIcon = function handleClickIcon(event) {
|
|
223
|
+
event.stopPropagation();
|
|
224
|
+
SetShowNoticeBar(!closeMode);
|
|
225
|
+
close && close(event);
|
|
226
|
+
onClose && onClose(event);
|
|
229
227
|
};
|
|
230
228
|
var iconShow = function iconShow() {
|
|
231
229
|
if (leftIcon === 'close') {
|
|
@@ -303,9 +301,10 @@ var NoticeBar = function NoticeBar(props) {
|
|
|
303
301
|
fontClassName: iconFontClassName,
|
|
304
302
|
name: rightIcon || 'close',
|
|
305
303
|
color: color
|
|
306
|
-
})) : null) : null, scrollList.current.length > 0 && direction === 'vertical' ? React__default.createElement("div", {
|
|
304
|
+
})) : null) : null, showNoticeBar && scrollList.current.length > 0 && direction === 'vertical' ? React__default.createElement("div", {
|
|
307
305
|
className: "nut-noticebar-vertical",
|
|
308
|
-
style: barStyle
|
|
306
|
+
style: barStyle,
|
|
307
|
+
onClick: handleClick
|
|
309
308
|
}, children ? React__default.createElement("div", {
|
|
310
309
|
className: "horseLamp_list",
|
|
311
310
|
style: horseLampStyle
|
|
@@ -322,21 +321,18 @@ var NoticeBar = function NoticeBar(props) {
|
|
|
322
321
|
style: {
|
|
323
322
|
height: height
|
|
324
323
|
},
|
|
325
|
-
key: index
|
|
326
|
-
onClick: function onClick() {
|
|
327
|
-
go(item);
|
|
328
|
-
}
|
|
324
|
+
key: index
|
|
329
325
|
}, item)
|
|
330
326
|
);
|
|
331
327
|
})), React__default.createElement("div", {
|
|
332
328
|
className: "go",
|
|
333
|
-
onClick: function onClick() {
|
|
334
|
-
handleClickIcon();
|
|
329
|
+
onClick: function onClick(e) {
|
|
330
|
+
handleClickIcon(e);
|
|
335
331
|
}
|
|
336
332
|
}, rightIcon || (closeMode ? React__default.createElement(Icon, {
|
|
337
333
|
classPrefix: iconClassPrefix,
|
|
338
334
|
fontClassName: iconFontClassName,
|
|
339
|
-
name:
|
|
335
|
+
name: rightIcon || 'close',
|
|
340
336
|
color: color,
|
|
341
337
|
size: "11px"
|
|
342
338
|
}) : null))) : null);
|
package/dist/esm/Price.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["price", "needSymbol", "symbol", "decimalDigits", "thousands", "className"];
|
|
3
|
+
var _excluded = ["price", "needSymbol", "symbol", "decimalDigits", "thousands", "position", "size", "className"];
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
import React__default from 'react';
|
|
@@ -12,6 +12,8 @@ var defaultProps = {
|
|
|
12
12
|
symbol: '¥',
|
|
13
13
|
decimalDigits: 2,
|
|
14
14
|
thousands: false,
|
|
15
|
+
position: 'before',
|
|
16
|
+
size: 'large',
|
|
15
17
|
className: ''
|
|
16
18
|
};
|
|
17
19
|
var Price = function Price(props) {
|
|
@@ -21,22 +23,14 @@ var Price = function Price(props) {
|
|
|
21
23
|
symbol = _defaultProps$props.symbol,
|
|
22
24
|
decimalDigits = _defaultProps$props.decimalDigits,
|
|
23
25
|
thousands = _defaultProps$props.thousands,
|
|
26
|
+
position = _defaultProps$props.position,
|
|
27
|
+
size = _defaultProps$props.size,
|
|
24
28
|
className = _defaultProps$props.className,
|
|
25
29
|
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
26
30
|
var b = cn('price');
|
|
27
|
-
var replaceSpecialChar = function replaceSpecialChar(symbol) {
|
|
28
|
-
var desSymbol = symbol;
|
|
29
|
-
desSymbol = symbol.replace(/"/g, '"');
|
|
30
|
-
desSymbol = symbol.replace(/&/g, '&');
|
|
31
|
-
desSymbol = symbol.replace(/</g, '<');
|
|
32
|
-
desSymbol = symbol.replace(/>/g, '>');
|
|
33
|
-
desSymbol = symbol.replace(/ /g, ' ');
|
|
34
|
-
desSymbol = symbol.replace(/¥/g, '¥');
|
|
35
|
-
return desSymbol;
|
|
36
|
-
};
|
|
37
31
|
var showSymbol = function showSymbol() {
|
|
38
32
|
return {
|
|
39
|
-
__html:
|
|
33
|
+
__html: needSymbol ? symbol : ''
|
|
40
34
|
};
|
|
41
35
|
};
|
|
42
36
|
var checkPoint = function checkPoint(price) {
|
|
@@ -63,7 +57,7 @@ var Price = function Price(props) {
|
|
|
63
57
|
}
|
|
64
58
|
if (checkPoint(decimalNum)) {
|
|
65
59
|
decimalNum = Number(decimalNum).toFixed(decimalDigits);
|
|
66
|
-
decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1];
|
|
60
|
+
decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1] || 0;
|
|
67
61
|
} else {
|
|
68
62
|
decimalNum = 0;
|
|
69
63
|
}
|
|
@@ -71,18 +65,21 @@ var Price = function Price(props) {
|
|
|
71
65
|
var resultFixed = Number(result).toFixed(decimalDigits);
|
|
72
66
|
return String(resultFixed).substring(2, resultFixed.length);
|
|
73
67
|
};
|
|
68
|
+
var renderSymbol = function renderSymbol() {
|
|
69
|
+
return React__default.createElement("div", {
|
|
70
|
+
className: "".concat(b('symbol'), " ").concat(b("symbol-".concat(size))),
|
|
71
|
+
dangerouslySetInnerHTML: showSymbol()
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
74
|
return React__default.createElement("div", _objectSpread({
|
|
75
75
|
className: "".concat(b(), " ").concat(className)
|
|
76
|
-
}, rest), needSymbol ? React__default.createElement("div", {
|
|
77
|
-
className: "".concat(b('
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, "."), React__default.createElement("div", {
|
|
84
|
-
className: "".concat(b('small'))
|
|
85
|
-
}, formatDecimal(price)));
|
|
76
|
+
}, rest), needSymbol && position === 'before' ? renderSymbol() : null, React__default.createElement("div", {
|
|
77
|
+
className: "".concat(b('integer'), " ").concat(b("integer-".concat(size)))
|
|
78
|
+
}, formatThousands(price)), decimalDigits !== 0 ? React__default.createElement("div", {
|
|
79
|
+
className: "".concat(b('decimal'), " ").concat(b("decimal-".concat(size)))
|
|
80
|
+
}, ".") : null, React__default.createElement("div", {
|
|
81
|
+
className: "".concat(b('decimal'), " ").concat(b("decimal-".concat(size)))
|
|
82
|
+
}, formatDecimal(price)), needSymbol && position === 'after' ? renderSymbol() : null);
|
|
86
83
|
};
|
|
87
84
|
Price.defaultProps = defaultProps;
|
|
88
85
|
Price.displayName = 'NutPrice';
|
package/dist/esm/Radio.js
CHANGED
|
@@ -1,115 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import React__default, { useState, useContext, useEffect } from 'react';
|
|
8
|
-
import Icon from './Icon.js';
|
|
9
|
-
import { R as RadioContext } from './context-aa058329.js';
|
|
10
|
-
import RadioGroup from './RadioGroup.js';
|
|
11
|
-
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
12
|
-
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
13
|
-
className: '',
|
|
14
|
-
style: {},
|
|
15
|
-
disabled: false,
|
|
16
|
-
checked: false,
|
|
17
|
-
shape: 'round',
|
|
18
|
-
value: '',
|
|
19
|
-
textPosition: 'right',
|
|
20
|
-
iconName: 'check-normal',
|
|
21
|
-
iconActiveName: 'check-checked',
|
|
22
|
-
iconSize: 18,
|
|
23
|
-
onChange: function onChange(e) {}
|
|
24
|
-
});
|
|
25
|
-
var Radio = function Radio(props) {
|
|
26
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
27
|
-
children = _defaultProps$props.children;
|
|
28
|
-
var className = props.className,
|
|
29
|
-
disabled = props.disabled,
|
|
30
|
-
checked = props.checked,
|
|
31
|
-
shape = props.shape,
|
|
32
|
-
textPosition = props.textPosition,
|
|
33
|
-
value = props.value,
|
|
34
|
-
iconName = props.iconName,
|
|
35
|
-
iconActiveName = props.iconActiveName,
|
|
36
|
-
iconSize = props.iconSize,
|
|
37
|
-
onChange = props.onChange,
|
|
38
|
-
iconClassPrefix = props.iconClassPrefix,
|
|
39
|
-
iconFontClassName = props.iconFontClassName,
|
|
40
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
41
|
-
var componentName = 'nut-radio';
|
|
42
|
-
var _useState = useState(checked),
|
|
43
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
-
checkedStatement = _useState2[0],
|
|
45
|
-
setCheckedStatement = _useState2[1];
|
|
46
|
-
var _useState3 = useState(value),
|
|
47
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
-
valueStatement = _useState4[0],
|
|
49
|
-
setValueStatement = _useState4[1];
|
|
50
|
-
var _useState5 = useState(disabled),
|
|
51
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
-
disabledStatement = _useState6[0],
|
|
53
|
-
setDisabledStatement = _useState6[1];
|
|
54
|
-
var context = useContext(RadioContext);
|
|
55
|
-
useEffect(function () {
|
|
56
|
-
setDisabledStatement(disabled);
|
|
57
|
-
setValueStatement(value);
|
|
58
|
-
setCheckedStatement(checked);
|
|
59
|
-
}, [disabled, value, checked]);
|
|
60
|
-
var renderLabel = function renderLabel() {
|
|
61
|
-
return React__default.createElement("div", {
|
|
62
|
-
className: "".concat(componentName, "__label ").concat(disabledStatement ? "".concat(componentName, "__label--disabled") : '')
|
|
63
|
-
}, children);
|
|
64
|
-
};
|
|
65
|
-
var renderButton = function renderButton() {
|
|
66
|
-
return React__default.createElement("div", {
|
|
67
|
-
className: "".concat(componentName, "__button ").concat(checkedStatement && "".concat(componentName, "__button--active"), " ").concat(disabledStatement ? "".concat(componentName, "__button--disabled") : '')
|
|
68
|
-
}, children);
|
|
69
|
-
};
|
|
70
|
-
var color = function color() {
|
|
71
|
-
if (disabledStatement) {
|
|
72
|
-
return 'nut-radio__icon--disable';
|
|
73
|
-
}
|
|
74
|
-
if (checkedStatement) {
|
|
75
|
-
return 'nut-radio__icon';
|
|
76
|
-
}
|
|
77
|
-
return 'nut-radio__icon--unchecked';
|
|
78
|
-
};
|
|
79
|
-
var renderIcon = function renderIcon() {
|
|
80
|
-
var iconName = props.iconName,
|
|
81
|
-
iconSize = props.iconSize,
|
|
82
|
-
iconActiveName = props.iconActiveName;
|
|
83
|
-
return React__default.createElement(Icon, {
|
|
84
|
-
classPrefix: iconClassPrefix,
|
|
85
|
-
fontClassName: iconFontClassName,
|
|
86
|
-
name: checkedStatement ? iconActiveName : iconName,
|
|
87
|
-
size: iconSize,
|
|
88
|
-
className: color()
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
var renderRadioItem = function renderRadioItem() {
|
|
92
|
-
if (shape === 'button') {
|
|
93
|
-
return renderButton();
|
|
94
|
-
}
|
|
95
|
-
if (reverseState) {
|
|
96
|
-
return React__default.createElement(React__default.Fragment, null, renderLabel(), renderIcon());
|
|
97
|
-
}
|
|
98
|
-
return React__default.createElement(React__default.Fragment, null, renderIcon(), renderLabel());
|
|
99
|
-
};
|
|
100
|
-
var handleClick = function handleClick(e) {
|
|
101
|
-
if (disabledStatement || checkedStatement) return;
|
|
102
|
-
setCheckedStatement(!checkedStatement);
|
|
103
|
-
onChange && onChange(e);
|
|
104
|
-
context && context.onChange(valueStatement);
|
|
105
|
-
};
|
|
106
|
-
var reverseState = textPosition === 'left';
|
|
107
|
-
return React__default.createElement("div", _objectSpread({
|
|
108
|
-
className: "nut-radio ".concat(className),
|
|
109
|
-
onClick: handleClick
|
|
110
|
-
}, rest), renderRadioItem());
|
|
111
|
-
};
|
|
112
|
-
Radio.defaultProps = defaultProps;
|
|
113
|
-
Radio.displayName = 'NutRadio';
|
|
114
|
-
Radio.RadioGroup = RadioGroup;
|
|
115
|
-
export { Radio as default };
|
|
1
|
+
import { R as Radio } from './radio-cf953c7a.js';
|
|
2
|
+
export { R as default } from './radio-cf953c7a.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import './Icon.js';
|
|
5
|
+
import './RadioGroup.js';
|
|
6
|
+
import './typings-1c5f2628.js';
|