@nutui/nutui-react 1.3.11-beta.0 → 1.3.12-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 +13 -0
- package/dist/esm/Cell.js +7 -108
- package/dist/esm/CellGroup.js +4 -34
- package/dist/esm/Form/style/index.js +2 -0
- package/dist/esm/Form.js +188 -0
- package/dist/esm/FormItem/style/index.js +2 -0
- package/dist/esm/FormItem.js +9 -0
- package/dist/esm/Range.js +8 -5
- package/dist/esm/TextArea.js +7 -8
- package/dist/esm/cell-c8781626.js +108 -0
- package/dist/esm/cellgroup-3402f96c.js +34 -0
- package/dist/esm/formitem-46d4aca3.js +136 -0
- package/dist/esm/nutui-react.es.js +2 -0
- package/dist/esm/types/src/packages/form/demo.d.ts +3 -0
- package/dist/esm/types/src/packages/form/form.d.ts +9 -0
- package/dist/esm/types/src/packages/form/index.d.ts +2 -0
- package/dist/esm/types/src/packages/form/index.taro.d.ts +2 -0
- package/dist/esm/types/src/packages/form/types.d.ts +82 -0
- package/dist/esm/types/src/packages/form/useForm.d.ts +2 -0
- package/dist/esm/types/src/packages/formitem/formitem.d.ts +30 -0
- package/dist/esm/types/src/packages/formitem/formitemcontext.d.ts +6 -0
- package/dist/esm/types/src/packages/formitem/index.d.ts +2 -0
- package/dist/esm/types/src/packages/formitem/types.d.ts +82 -0
- package/dist/esm/types/src/packages/formitem/useForm.d.ts +2 -0
- package/dist/esm/types/src/packages/nutui.react.build.d.ts +3 -1
- package/dist/esm/types/src/packages/nutui.react.d.ts +5 -1
- package/dist/esm/types/src/packages/nutui.react.scss.d.ts +2 -0
- package/dist/esm/types/src/packages/range/range.d.ts +3 -0
- 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 +1785 -480
- package/dist/nutui.react.umd.js +1821 -514
- package/dist/packages/checkbox/checkbox.scss +1 -1
- package/dist/packages/form/form.scss +27 -0
- package/dist/packages/formitem/formitem.scss +87 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +2 -0
- package/dist/styles/variables.scss +77 -26
- package/dist/types/index.d.ts +94 -1
- package/dist/types/nutui.react.build.ts +5 -1
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# v1.3.12
|
|
2
|
+
`2022-11-23`
|
|
3
|
+
|
|
4
|
+
* :bug: fix: children 无数据时不展示cell,应在顶层判断 (#482) @xiaoyatong
|
|
5
|
+
* :sparkles: chore: pulltorefresh 删除取用 console (#480) @oasis-cloud
|
|
6
|
+
* :bug: fix: taro:h5启动时textare组件change时间获取数据报错问题修复 (#479) @vickyYe
|
|
7
|
+
* :sparkles: feat: add form (#470) @xiaoyatong
|
|
8
|
+
* :bug: fix: taro 包不需要依赖 react-router-dom (#475) @oasis-cloud
|
|
9
|
+
* :bug: fix: calendar taro中Popup组件与h5中属性不一致问题 (#468) @Phyzait
|
|
10
|
+
* :bug: fix: Cell组件当children为空数组时不渲染Cell组件问题 (#466) @cuicuiworld
|
|
11
|
+
* :sparkles: feat: range组件新增描述属性 (#471) @simpleStyle
|
|
12
|
+
* :bug: fix: textarea组件字数统计不准确问题修改,兼容emoji (#467) @vickyYe
|
|
13
|
+
|
|
1
14
|
# v1.3.11
|
|
2
15
|
`2022-11-16`
|
|
3
16
|
|
package/dist/esm/Cell.js
CHANGED
|
@@ -1,109 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import React__default from 'react';
|
|
7
|
-
import { useHistory } from 'react-router-dom';
|
|
8
|
-
import { c as cn } from './bem-893ad28d.js';
|
|
9
|
-
import Icon from './Icon.js';
|
|
10
|
-
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
1
|
+
import { C as Cell } from './cell-c8781626.js';
|
|
2
|
+
export { C as default } from './cell-c8781626.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'react-router-dom';
|
|
5
|
+
import './bem-893ad28d.js';
|
|
11
6
|
import '@bem-react/classname';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
subTitle: null,
|
|
15
|
-
desc: '',
|
|
16
|
-
descTextAlign: 'right',
|
|
17
|
-
isLink: false,
|
|
18
|
-
icon: '',
|
|
19
|
-
roundRadius: '6px',
|
|
20
|
-
url: '',
|
|
21
|
-
to: '',
|
|
22
|
-
replace: false,
|
|
23
|
-
center: false,
|
|
24
|
-
size: '',
|
|
25
|
-
className: '',
|
|
26
|
-
iconSlot: null,
|
|
27
|
-
linkSlot: null,
|
|
28
|
-
click: function click(event) {},
|
|
29
|
-
onClick: function onClick(event) {}
|
|
30
|
-
});
|
|
31
|
-
var Cell = function Cell(props) {
|
|
32
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
33
|
-
children = _defaultProps$props.children,
|
|
34
|
-
click = _defaultProps$props.click,
|
|
35
|
-
onClick = _defaultProps$props.onClick,
|
|
36
|
-
title = _defaultProps$props.title,
|
|
37
|
-
subTitle = _defaultProps$props.subTitle,
|
|
38
|
-
desc = _defaultProps$props.desc,
|
|
39
|
-
descTextAlign = _defaultProps$props.descTextAlign,
|
|
40
|
-
isLink = _defaultProps$props.isLink,
|
|
41
|
-
icon = _defaultProps$props.icon,
|
|
42
|
-
roundRadius = _defaultProps$props.roundRadius,
|
|
43
|
-
url = _defaultProps$props.url,
|
|
44
|
-
to = _defaultProps$props.to,
|
|
45
|
-
replace = _defaultProps$props.replace,
|
|
46
|
-
center = _defaultProps$props.center,
|
|
47
|
-
size = _defaultProps$props.size,
|
|
48
|
-
className = _defaultProps$props.className,
|
|
49
|
-
iconSlot = _defaultProps$props.iconSlot,
|
|
50
|
-
linkSlot = _defaultProps$props.linkSlot,
|
|
51
|
-
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
52
|
-
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
53
|
-
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
54
|
-
var b = cn('cell');
|
|
55
|
-
var history = useHistory();
|
|
56
|
-
var handleClick = function handleClick(event) {
|
|
57
|
-
click(event);
|
|
58
|
-
onClick(event);
|
|
59
|
-
if (to && history) {
|
|
60
|
-
history[replace ? 'replace' : 'push'](to);
|
|
61
|
-
} else if (url) {
|
|
62
|
-
replace ? window.location.replace(url) : window.location.href = url;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var baseStyle = {
|
|
66
|
-
borderRadius: Number.isNaN(Number(roundRadius)) ? String(roundRadius) : "".concat(roundRadius, "px")
|
|
67
|
-
};
|
|
68
|
-
var styles = title || subTitle || icon ? {} : {
|
|
69
|
-
textAlign: descTextAlign,
|
|
70
|
-
flex: 1
|
|
71
|
-
};
|
|
72
|
-
return React__default.createElement("div", _objectSpread({
|
|
73
|
-
className: "".concat(b({
|
|
74
|
-
clickable: !!(isLink || to),
|
|
75
|
-
center: center,
|
|
76
|
-
large: size === 'large'
|
|
77
|
-
}, [className]), " "),
|
|
78
|
-
onClick: function onClick(event) {
|
|
79
|
-
return handleClick(event);
|
|
80
|
-
},
|
|
81
|
-
style: baseStyle
|
|
82
|
-
}, rest), children || React__default.createElement(React__default.Fragment, null, icon || iconSlot ? React__default.createElement("div", {
|
|
83
|
-
className: b('icon')
|
|
84
|
-
}, iconSlot || (icon ? React__default.createElement(Icon, {
|
|
85
|
-
classPrefix: iconClassPrefix,
|
|
86
|
-
fontClassName: iconFontClassName,
|
|
87
|
-
name: icon,
|
|
88
|
-
className: "icon"
|
|
89
|
-
}) : null)) : null, title || subTitle ? React__default.createElement("div", {
|
|
90
|
-
className: "".concat(b('title'))
|
|
91
|
-
}, title ? React__default.createElement("div", {
|
|
92
|
-
className: b('maintitle')
|
|
93
|
-
}, title) : null, subTitle ? React__default.createElement("div", {
|
|
94
|
-
className: b('subtitle')
|
|
95
|
-
}, subTitle) : null) : null, desc ? React__default.createElement("div", {
|
|
96
|
-
className: b('value', {
|
|
97
|
-
alone: !title && !subTitle
|
|
98
|
-
}),
|
|
99
|
-
style: styles
|
|
100
|
-
}, desc) : null, !linkSlot && (isLink || to) ? React__default.createElement(Icon, {
|
|
101
|
-
classPrefix: iconClassPrefix,
|
|
102
|
-
fontClassName: iconFontClassName,
|
|
103
|
-
name: "right",
|
|
104
|
-
className: b('link')
|
|
105
|
-
}) : linkSlot));
|
|
106
|
-
};
|
|
107
|
-
Cell.defaultProps = defaultProps;
|
|
108
|
-
Cell.displayName = 'NutCell';
|
|
109
|
-
export { Cell as default };
|
|
7
|
+
import './Icon.js';
|
|
8
|
+
import './typings-1c5f2628.js';
|
package/dist/esm/CellGroup.js
CHANGED
|
@@ -1,35 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import { c as cn } from './bem-893ad28d.js';
|
|
1
|
+
import { C as CellGroup } from './cellgroup-3402f96c.js';
|
|
2
|
+
export { C as default } from './cellgroup-3402f96c.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import './bem-893ad28d.js';
|
|
6
5
|
import '@bem-react/classname';
|
|
7
|
-
var defaultProps = {
|
|
8
|
-
title: '',
|
|
9
|
-
desc: '',
|
|
10
|
-
className: '',
|
|
11
|
-
titleSlot: null,
|
|
12
|
-
descSlot: null
|
|
13
|
-
};
|
|
14
|
-
var CellGroup = function CellGroup(props) {
|
|
15
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
16
|
-
children = _defaultProps$props.children,
|
|
17
|
-
className = _defaultProps$props.className,
|
|
18
|
-
title = _defaultProps$props.title,
|
|
19
|
-
desc = _defaultProps$props.desc,
|
|
20
|
-
titleSlot = _defaultProps$props.titleSlot,
|
|
21
|
-
descSlot = _defaultProps$props.descSlot;
|
|
22
|
-
var b = cn('cell-group');
|
|
23
|
-
return React__default.createElement("div", {
|
|
24
|
-
className: b(null, [className])
|
|
25
|
-
}, titleSlot || React__default.createElement(React__default.Fragment, null, title ? React__default.createElement("div", {
|
|
26
|
-
className: b('title')
|
|
27
|
-
}, title) : null), descSlot || React__default.createElement(React__default.Fragment, null, desc ? React__default.createElement("div", {
|
|
28
|
-
className: b('desc')
|
|
29
|
-
}, desc) : null), React__default.createElement("div", {
|
|
30
|
-
className: b('wrap')
|
|
31
|
-
}, children));
|
|
32
|
-
};
|
|
33
|
-
CellGroup.defaultProps = defaultProps;
|
|
34
|
-
CellGroup.displayName = 'NutCellGroup';
|
|
35
|
-
export { CellGroup as default };
|
package/dist/esm/Form.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
+
var _excluded = ["children", "onFinish", "onFinishFailed", "labelPosition", "starPositon"];
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
import React__default, { useRef } from 'react';
|
|
11
|
+
import { C as CellGroup } from './cellgroup-3402f96c.js';
|
|
12
|
+
import { F as FormItemContext, a as FormItem } from './formitem-46d4aca3.js';
|
|
13
|
+
import Schema from 'async-validator';
|
|
14
|
+
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
15
|
+
import './bem-893ad28d.js';
|
|
16
|
+
import '@bem-react/classname';
|
|
17
|
+
import './cell-c8781626.js';
|
|
18
|
+
import 'react-router-dom';
|
|
19
|
+
import './Icon.js';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 用于存储表单的数据
|
|
23
|
+
*/
|
|
24
|
+
var FormStore = /*#__PURE__*/_createClass(
|
|
25
|
+
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
26
|
+
// 所有的组件实例
|
|
27
|
+
// 成功和失败的回调
|
|
28
|
+
|
|
29
|
+
function FormStore() {
|
|
30
|
+
var _this = this;
|
|
31
|
+
_classCallCheck(this, FormStore);
|
|
32
|
+
_defineProperty(this, "store", {});
|
|
33
|
+
_defineProperty(this, "fieldEntities", []);
|
|
34
|
+
_defineProperty(this, "callbacks", {});
|
|
35
|
+
_defineProperty(this, "errList", []);
|
|
36
|
+
_defineProperty(this, "registerField", function (field) {
|
|
37
|
+
_this.fieldEntities.push(field);
|
|
38
|
+
return function () {
|
|
39
|
+
_this.fieldEntities = _this.fieldEntities.filter(function (item) {
|
|
40
|
+
return item != field;
|
|
41
|
+
});
|
|
42
|
+
delete _this.store[field.props.name];
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
_defineProperty(this, "getFieldValue", function (name) {
|
|
46
|
+
return _this.store[name];
|
|
47
|
+
});
|
|
48
|
+
_defineProperty(this, "setFieldsValue", function (newStore) {
|
|
49
|
+
_this.store = _objectSpread(_objectSpread({}, _this.store), newStore);
|
|
50
|
+
_this.fieldEntities.forEach(function (enetity) {
|
|
51
|
+
var name = enetity.props.name;
|
|
52
|
+
Object.keys(newStore).forEach(function (key) {
|
|
53
|
+
if (key === name) {
|
|
54
|
+
enetity.onStoreChange();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
_defineProperty(this, "validate", function () {
|
|
60
|
+
var err = [];
|
|
61
|
+
_this.errList.length = 0;
|
|
62
|
+
_this.fieldEntities.forEach(function (entity) {
|
|
63
|
+
var _entity$props = entity.props,
|
|
64
|
+
name = _entity$props.name,
|
|
65
|
+
_entity$props$rules = _entity$props.rules,
|
|
66
|
+
rules = _entity$props$rules === void 0 ? [] : _entity$props$rules;
|
|
67
|
+
var descriptor = {};
|
|
68
|
+
if (rules.length) {
|
|
69
|
+
// 多条校验规则
|
|
70
|
+
if (rules.length > 1) {
|
|
71
|
+
descriptor[name] = [];
|
|
72
|
+
rules.map(function (v) {
|
|
73
|
+
descriptor[name].push(v);
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
descriptor[name] = rules[0];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
var validator = new Schema(descriptor);
|
|
80
|
+
validator.validate(_defineProperty({}, name, _this.store[name]), function (errors) {
|
|
81
|
+
if (errors) {
|
|
82
|
+
var _this$errList;
|
|
83
|
+
err.push.apply(err, _toConsumableArray(errors));
|
|
84
|
+
(_this$errList = _this.errList).push.apply(_this$errList, _toConsumableArray(errors));
|
|
85
|
+
// 表单项更新
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
entity.onStoreChange();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
return err;
|
|
92
|
+
});
|
|
93
|
+
_defineProperty(this, "setCallback", function (callback) {
|
|
94
|
+
_this.callbacks = _objectSpread(_objectSpread({}, _this.callbacks), callback);
|
|
95
|
+
});
|
|
96
|
+
_defineProperty(this, "submit", function () {
|
|
97
|
+
var err = _this.validate();
|
|
98
|
+
if (err.length === 0) {
|
|
99
|
+
var _this$callbacks$onFin, _this$callbacks;
|
|
100
|
+
(_this$callbacks$onFin = (_this$callbacks = _this.callbacks).onFinish) === null || _this$callbacks$onFin === void 0 ? void 0 : _this$callbacks$onFin.call(_this$callbacks, _this.store);
|
|
101
|
+
} else if (err.length > 0) {
|
|
102
|
+
var _this$callbacks$onFin2, _this$callbacks2;
|
|
103
|
+
(_this$callbacks$onFin2 = (_this$callbacks2 = _this.callbacks).onFinishFailed) === null || _this$callbacks$onFin2 === void 0 ? void 0 : _this$callbacks$onFin2.call(_this$callbacks2, err);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
_defineProperty(this, "resetFields", function () {});
|
|
107
|
+
_defineProperty(this, "getForm", function () {
|
|
108
|
+
return {
|
|
109
|
+
setCallback: _this.setCallback,
|
|
110
|
+
registerField: _this.registerField,
|
|
111
|
+
getFieldValue: _this.getFieldValue,
|
|
112
|
+
setFieldsValue: _this.setFieldsValue,
|
|
113
|
+
submit: _this.submit,
|
|
114
|
+
store: _this.store,
|
|
115
|
+
errList: _this.errList,
|
|
116
|
+
fieldEntities: _this.fieldEntities
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
this.callbacks = {
|
|
120
|
+
onFinish: function onFinish(value) {},
|
|
121
|
+
onFinishFailed: function onFinishFailed() {}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 注册组件实例
|
|
126
|
+
* @param field
|
|
127
|
+
*/);
|
|
128
|
+
|
|
129
|
+
var useForm = function useForm(form) {
|
|
130
|
+
var formRef = useRef();
|
|
131
|
+
if (!formRef.current) {
|
|
132
|
+
if (form) {
|
|
133
|
+
formRef.current = form;
|
|
134
|
+
} else {
|
|
135
|
+
var formStore = new FormStore();
|
|
136
|
+
formRef.current = formStore.getForm();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return [formRef.current];
|
|
140
|
+
};
|
|
141
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
142
|
+
className: '',
|
|
143
|
+
style: undefined,
|
|
144
|
+
form: {},
|
|
145
|
+
labelPosition: 'Right',
|
|
146
|
+
formGroupTitle: '',
|
|
147
|
+
onFinish: function onFinish(obj) {},
|
|
148
|
+
onFinishFailed: function onFinishFailed(value) {},
|
|
149
|
+
starPositon: 'Left'
|
|
150
|
+
});
|
|
151
|
+
var PositionInfo = {
|
|
152
|
+
Top: 'form-layout-top',
|
|
153
|
+
Left: 'form-layout-left',
|
|
154
|
+
Right: 'form-layout-right'
|
|
155
|
+
};
|
|
156
|
+
var Form = function Form(props) {
|
|
157
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
158
|
+
children = _defaultProps$props.children,
|
|
159
|
+
onFinish = _defaultProps$props.onFinish,
|
|
160
|
+
onFinishFailed = _defaultProps$props.onFinishFailed,
|
|
161
|
+
labelPosition = _defaultProps$props.labelPosition,
|
|
162
|
+
starPositon = _defaultProps$props.starPositon,
|
|
163
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
164
|
+
var _useForm = useForm(),
|
|
165
|
+
_useForm2 = _slicedToArray(_useForm, 1),
|
|
166
|
+
formInstance = _useForm2[0];
|
|
167
|
+
formInstance.starPositon = starPositon;
|
|
168
|
+
var setCallback = formInstance.setCallback,
|
|
169
|
+
submit = formInstance.submit;
|
|
170
|
+
setCallback({
|
|
171
|
+
onFinish: onFinish,
|
|
172
|
+
onFinishFailed: onFinishFailed
|
|
173
|
+
});
|
|
174
|
+
return React__default.createElement("form", {
|
|
175
|
+
className: "nut-form ".concat(PositionInfo[labelPosition], " ").concat(props.className),
|
|
176
|
+
style: props.style,
|
|
177
|
+
onSubmit: function onSubmit(e) {
|
|
178
|
+
e.preventDefault();
|
|
179
|
+
submit();
|
|
180
|
+
}
|
|
181
|
+
}, React__default.createElement(CellGroup, null, React__default.createElement(FormItemContext.Provider, {
|
|
182
|
+
value: formInstance
|
|
183
|
+
}, children)));
|
|
184
|
+
};
|
|
185
|
+
Form.defaultProps = defaultProps;
|
|
186
|
+
Form.displayName = 'NutForm';
|
|
187
|
+
Form.Item = FormItem;
|
|
188
|
+
export { Form as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { a as FormItem } from './formitem-46d4aca3.js';
|
|
2
|
+
export { a as default } from './formitem-46d4aca3.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import './cell-c8781626.js';
|
|
5
|
+
import 'react-router-dom';
|
|
6
|
+
import './bem-893ad28d.js';
|
|
7
|
+
import '@bem-react/classname';
|
|
8
|
+
import './Icon.js';
|
|
9
|
+
import './typings-1c5f2628.js';
|
package/dist/esm/Range.js
CHANGED
|
@@ -41,7 +41,10 @@ var Range = function Range(props) {
|
|
|
41
41
|
dragEnd = _defaultProps$props.dragEnd,
|
|
42
42
|
onChange = _defaultProps$props.onChange,
|
|
43
43
|
onDragStart = _defaultProps$props.onDragStart,
|
|
44
|
-
onDragEnd = _defaultProps$props.onDragEnd
|
|
44
|
+
onDragEnd = _defaultProps$props.onDragEnd,
|
|
45
|
+
minDesc = _defaultProps$props.minDesc,
|
|
46
|
+
maxDesc = _defaultProps$props.maxDesc,
|
|
47
|
+
curValueDesc = _defaultProps$props.curValueDesc;
|
|
45
48
|
var _defaultProps$props2 = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
46
49
|
min = _defaultProps$props2.min,
|
|
47
50
|
max = _defaultProps$props2.max,
|
|
@@ -313,7 +316,7 @@ var Range = function Range(props) {
|
|
|
313
316
|
className: "".concat(containerName)
|
|
314
317
|
}, !hiddenRange ? React__default.createElement("div", {
|
|
315
318
|
className: "min"
|
|
316
|
-
}, +min) : null, React__default.createElement("div", {
|
|
319
|
+
}, minDesc || +min) : null, React__default.createElement("div", {
|
|
317
320
|
ref: root,
|
|
318
321
|
style: wrapperStyle(),
|
|
319
322
|
className: "".concat(rangeName),
|
|
@@ -368,7 +371,7 @@ var Range = function Range(props) {
|
|
|
368
371
|
style: buttonStyle()
|
|
369
372
|
}, !hiddenTag ? React__default.createElement("div", {
|
|
370
373
|
className: "number"
|
|
371
|
-
}, curValue(index)) : null));
|
|
374
|
+
}, curValueDesc || curValue(index)) : null));
|
|
372
375
|
}) : React__default.createElement("div", {
|
|
373
376
|
role: "slider",
|
|
374
377
|
className: "nut-range-button-wrapper",
|
|
@@ -397,9 +400,9 @@ var Range = function Range(props) {
|
|
|
397
400
|
style: buttonStyle()
|
|
398
401
|
}, !hiddenTag ? React__default.createElement("div", {
|
|
399
402
|
className: "number"
|
|
400
|
-
}, curValue()) : null)))), !hiddenRange ? React__default.createElement("div", {
|
|
403
|
+
}, curValueDesc || curValue()) : null)))), !hiddenRange ? React__default.createElement("div", {
|
|
401
404
|
className: "max"
|
|
402
|
-
}, +max) : null);
|
|
405
|
+
}, maxDesc || +max) : null);
|
|
403
406
|
};
|
|
404
407
|
Range.defaultProps = defaultProps;
|
|
405
408
|
Range.displayName = 'NutRange';
|
package/dist/esm/TextArea.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
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; }
|
|
@@ -43,13 +44,11 @@ var TextArea = function TextArea(props) {
|
|
|
43
44
|
SetInputValue = _useState2[1];
|
|
44
45
|
var textareaRef = useRef(null);
|
|
45
46
|
useEffect(function () {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
initValue = initValue.substring(0, Number(maxlength));
|
|
50
|
-
}
|
|
51
|
-
SetInputValue(initValue);
|
|
47
|
+
var initValue = defaultValue;
|
|
48
|
+
if (initValue && maxlength && _toConsumableArray(initValue).length > Number(maxlength)) {
|
|
49
|
+
initValue = initValue.substring(0, Number(maxlength));
|
|
52
50
|
}
|
|
51
|
+
SetInputValue(initValue);
|
|
53
52
|
if (autosize) {
|
|
54
53
|
setTimeout(function () {
|
|
55
54
|
setContentHeight();
|
|
@@ -85,7 +84,7 @@ var TextArea = function TextArea(props) {
|
|
|
85
84
|
};
|
|
86
85
|
var textChange = function textChange(event) {
|
|
87
86
|
var text = event.target;
|
|
88
|
-
if (maxlength && text.value.length > Number(maxlength)) {
|
|
87
|
+
if (maxlength && _toConsumableArray(text.value).length > Number(maxlength)) {
|
|
89
88
|
text.value = text.value.substring(0, Number(maxlength));
|
|
90
89
|
}
|
|
91
90
|
SetInputValue(text.value);
|
|
@@ -131,7 +130,7 @@ var TextArea = function TextArea(props) {
|
|
|
131
130
|
placeholder: placeholder || locale.placeholder
|
|
132
131
|
}), limitshow ? React__default.createElement("div", {
|
|
133
132
|
className: textareaBem('limit')
|
|
134
|
-
}, inputValue.length, "/", maxlength < 0 ? 0 : maxlength) : null);
|
|
133
|
+
}, _toConsumableArray(inputValue).length, "/", maxlength < 0 ? 0 : maxlength) : null);
|
|
135
134
|
};
|
|
136
135
|
TextArea.defaultProps = defaultProps;
|
|
137
136
|
TextArea.displayName = 'NutTextArea';
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
var _excluded = ["children", "click", "onClick", "title", "subTitle", "desc", "descTextAlign", "isLink", "icon", "roundRadius", "url", "to", "replace", "center", "size", "className", "iconSlot", "linkSlot", "iconClassPrefix", "iconFontClassName"];
|
|
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
|
+
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
|
+
import React__default from 'react';
|
|
7
|
+
import { useHistory } from 'react-router-dom';
|
|
8
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
9
|
+
import Icon from './Icon.js';
|
|
10
|
+
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
11
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
12
|
+
title: null,
|
|
13
|
+
subTitle: null,
|
|
14
|
+
desc: '',
|
|
15
|
+
descTextAlign: 'right',
|
|
16
|
+
isLink: false,
|
|
17
|
+
icon: '',
|
|
18
|
+
roundRadius: '6px',
|
|
19
|
+
url: '',
|
|
20
|
+
to: '',
|
|
21
|
+
replace: false,
|
|
22
|
+
center: false,
|
|
23
|
+
size: '',
|
|
24
|
+
className: '',
|
|
25
|
+
iconSlot: null,
|
|
26
|
+
linkSlot: null,
|
|
27
|
+
click: function click(event) {},
|
|
28
|
+
onClick: function onClick(event) {}
|
|
29
|
+
});
|
|
30
|
+
var Cell = function Cell(props) {
|
|
31
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
32
|
+
children = _defaultProps$props.children,
|
|
33
|
+
click = _defaultProps$props.click,
|
|
34
|
+
onClick = _defaultProps$props.onClick,
|
|
35
|
+
title = _defaultProps$props.title,
|
|
36
|
+
subTitle = _defaultProps$props.subTitle,
|
|
37
|
+
desc = _defaultProps$props.desc,
|
|
38
|
+
descTextAlign = _defaultProps$props.descTextAlign,
|
|
39
|
+
isLink = _defaultProps$props.isLink,
|
|
40
|
+
icon = _defaultProps$props.icon,
|
|
41
|
+
roundRadius = _defaultProps$props.roundRadius,
|
|
42
|
+
url = _defaultProps$props.url,
|
|
43
|
+
to = _defaultProps$props.to,
|
|
44
|
+
replace = _defaultProps$props.replace,
|
|
45
|
+
center = _defaultProps$props.center,
|
|
46
|
+
size = _defaultProps$props.size,
|
|
47
|
+
className = _defaultProps$props.className,
|
|
48
|
+
iconSlot = _defaultProps$props.iconSlot,
|
|
49
|
+
linkSlot = _defaultProps$props.linkSlot,
|
|
50
|
+
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
51
|
+
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
52
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
53
|
+
var b = cn('cell');
|
|
54
|
+
var history = useHistory();
|
|
55
|
+
var handleClick = function handleClick(event) {
|
|
56
|
+
click(event);
|
|
57
|
+
onClick(event);
|
|
58
|
+
if (to && history) {
|
|
59
|
+
history[replace ? 'replace' : 'push'](to);
|
|
60
|
+
} else if (url) {
|
|
61
|
+
replace ? window.location.replace(url) : window.location.href = url;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var baseStyle = {
|
|
65
|
+
borderRadius: Number.isNaN(Number(roundRadius)) ? String(roundRadius) : "".concat(roundRadius, "px")
|
|
66
|
+
};
|
|
67
|
+
var styles = title || subTitle || icon ? {} : {
|
|
68
|
+
textAlign: descTextAlign,
|
|
69
|
+
flex: 1
|
|
70
|
+
};
|
|
71
|
+
return React__default.createElement("div", _objectSpread({
|
|
72
|
+
className: "".concat(b({
|
|
73
|
+
clickable: !!(isLink || to),
|
|
74
|
+
center: center,
|
|
75
|
+
large: size === 'large'
|
|
76
|
+
}, [className]), " "),
|
|
77
|
+
onClick: function onClick(event) {
|
|
78
|
+
return handleClick(event);
|
|
79
|
+
},
|
|
80
|
+
style: baseStyle
|
|
81
|
+
}, rest), children || React__default.createElement(React__default.Fragment, null, icon || iconSlot ? React__default.createElement("div", {
|
|
82
|
+
className: b('icon')
|
|
83
|
+
}, iconSlot || (icon ? React__default.createElement(Icon, {
|
|
84
|
+
classPrefix: iconClassPrefix,
|
|
85
|
+
fontClassName: iconFontClassName,
|
|
86
|
+
name: icon,
|
|
87
|
+
className: "icon"
|
|
88
|
+
}) : null)) : null, title || subTitle ? React__default.createElement("div", {
|
|
89
|
+
className: "".concat(b('title'))
|
|
90
|
+
}, title ? React__default.createElement("div", {
|
|
91
|
+
className: b('maintitle')
|
|
92
|
+
}, title) : null, subTitle ? React__default.createElement("div", {
|
|
93
|
+
className: b('subtitle')
|
|
94
|
+
}, subTitle) : null) : null, desc ? React__default.createElement("div", {
|
|
95
|
+
className: b('value', {
|
|
96
|
+
alone: !title && !subTitle
|
|
97
|
+
}),
|
|
98
|
+
style: styles
|
|
99
|
+
}, desc) : null, !linkSlot && (isLink || to) ? React__default.createElement(Icon, {
|
|
100
|
+
classPrefix: iconClassPrefix,
|
|
101
|
+
fontClassName: iconFontClassName,
|
|
102
|
+
name: "right",
|
|
103
|
+
className: b('link')
|
|
104
|
+
}) : linkSlot));
|
|
105
|
+
};
|
|
106
|
+
Cell.defaultProps = defaultProps;
|
|
107
|
+
Cell.displayName = 'NutCell';
|
|
108
|
+
export { Cell as C };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
import React__default from 'react';
|
|
5
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
6
|
+
var defaultProps = {
|
|
7
|
+
title: '',
|
|
8
|
+
desc: '',
|
|
9
|
+
className: '',
|
|
10
|
+
titleSlot: null,
|
|
11
|
+
descSlot: null
|
|
12
|
+
};
|
|
13
|
+
var CellGroup = function CellGroup(props) {
|
|
14
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
15
|
+
children = _defaultProps$props.children,
|
|
16
|
+
className = _defaultProps$props.className,
|
|
17
|
+
title = _defaultProps$props.title,
|
|
18
|
+
desc = _defaultProps$props.desc,
|
|
19
|
+
titleSlot = _defaultProps$props.titleSlot,
|
|
20
|
+
descSlot = _defaultProps$props.descSlot;
|
|
21
|
+
var b = cn('cell-group');
|
|
22
|
+
return React__default.createElement("div", {
|
|
23
|
+
className: b(null, [className])
|
|
24
|
+
}, titleSlot || React__default.createElement(React__default.Fragment, null, title ? React__default.createElement("div", {
|
|
25
|
+
className: b('title')
|
|
26
|
+
}, title) : null), descSlot || React__default.createElement(React__default.Fragment, null, desc ? React__default.createElement("div", {
|
|
27
|
+
className: b('desc')
|
|
28
|
+
}, desc) : null), React__default.createElement("div", {
|
|
29
|
+
className: b('wrap')
|
|
30
|
+
}, children));
|
|
31
|
+
};
|
|
32
|
+
CellGroup.defaultProps = defaultProps;
|
|
33
|
+
CellGroup.displayName = 'NutCellGroup';
|
|
34
|
+
export { CellGroup as C };
|