@nutui/nutui-react-taro 1.3.12-beta.3 → 1.3.12
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/Audio.js +3 -3
- package/dist/esm/Calendar.js +2 -2
- package/dist/esm/Form/style/index.js +2 -0
- package/dist/esm/Form.js +5 -0
- package/dist/esm/FormItem/style/index.js +2 -0
- package/dist/esm/FormItem.js +8 -0
- package/dist/esm/PullToRefresh.js +2 -2
- package/dist/esm/Range.js +2 -2
- package/dist/esm/TextArea.js +2 -2
- package/dist/esm/{audio.taro-b4f71d1b.js → audio.taro-6920085d.js} +1 -1
- package/dist/esm/{calendar.taro-a1f1a7f8.js → calendar.taro-0a8cbd0c.js} +6 -1
- package/dist/esm/form.taro-e086758a.js +16 -0
- package/dist/esm/formitem-9f11e314.js +237 -0
- package/dist/esm/nutui-react.es.js +8 -5
- package/dist/esm/{pulltorefresh.taro-e66c78ad.js → pulltorefresh.taro-fe2fa54c.js} +0 -1
- package/dist/esm/{range.taro-4232e6a7.js → range.taro-4e5f8f31.js} +10 -7
- package/dist/esm/{textarea.taro-0a85b8a5.js → textarea.taro-e1bf7f4d.js} +2 -2
- 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/form.taro.d.ts +4 -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/index.taro.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/nutui.react.taro.d.ts +5 -1
- package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +2 -0
- package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +3 -1
- package/dist/esm/types/src/packages/range/range.d.ts +3 -0
- package/dist/esm/types/src/packages/range/range.taro.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 +1818 -419
- package/dist/nutui.react.umd.js +1813 -412
- 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/types/index.d.ts +234 -167
- package/dist/types/nutui.taro.react.build.ts +5 -1
- package/package.json +5 -2
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/Audio.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { A as Audio } from './audio.taro-
|
|
2
|
-
export { A as default } from './audio.taro-
|
|
1
|
+
import { A as Audio } from './audio.taro-6920085d.js';
|
|
2
|
+
export { A as default } from './audio.taro-6920085d.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '@tarojs/taro';
|
|
5
5
|
import './icon.taro-1d0d4fb7.js';
|
|
6
6
|
import './bem-893ad28d.js';
|
|
7
7
|
import '@bem-react/classname';
|
|
8
|
-
import './range.taro-
|
|
8
|
+
import './range.taro-4e5f8f31.js';
|
|
9
9
|
import './useTouch-a2ea68c6.js';
|
|
10
10
|
import './useClientRect-bf69d7b3.js';
|
|
11
11
|
import './toast.taro-86862dff.js';
|
package/dist/esm/Calendar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Calendar } from './calendar.taro-
|
|
2
|
-
export { C as default } from './calendar.taro-
|
|
1
|
+
import { C as Calendar } from './calendar.taro-0a8cbd0c.js';
|
|
2
|
+
export { C as default } from './calendar.taro-0a8cbd0c.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './popup.taro-33d0bbc8.js';
|
|
5
5
|
import 'react-dom';
|
package/dist/esm/Form.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { F as FormItem } from './formitem-9f11e314.js';
|
|
2
|
+
export { F as default } from './formitem-9f11e314.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'react-router-dom';
|
|
5
|
+
import './bem-893ad28d.js';
|
|
6
|
+
import '@bem-react/classname';
|
|
7
|
+
import './icon-8dc4de10.js';
|
|
8
|
+
import './typings-1c5f2628.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PullToRefresh } from './pulltorefresh.taro-
|
|
2
|
-
export { P as default } from './pulltorefresh.taro-
|
|
1
|
+
import { P as PullToRefresh } from './pulltorefresh.taro-fe2fa54c.js';
|
|
2
|
+
export { P as default } from './pulltorefresh.taro-fe2fa54c.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '@use-gesture/react';
|
|
5
5
|
import '@react-spring/web';
|
package/dist/esm/Range.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as Range } from './range.taro-
|
|
2
|
-
export { R as default } from './range.taro-
|
|
1
|
+
import { R as Range } from './range.taro-4e5f8f31.js';
|
|
2
|
+
export { R as default } from './range.taro-4e5f8f31.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './useTouch-a2ea68c6.js';
|
|
5
5
|
import './useClientRect-bf69d7b3.js';
|
package/dist/esm/TextArea.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TextArea } from './textarea.taro-
|
|
2
|
-
export { T as default } from './textarea.taro-
|
|
1
|
+
import { T as TextArea } from './textarea.taro-e1bf7f4d.js';
|
|
2
|
+
export { T as default } from './textarea.taro-e1bf7f4d.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './configprovider.taro-6c7b3056.js';
|
|
5
5
|
import './zh-CN-14165629.js';
|
|
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
import React__default, { useState, useRef } from 'react';
|
|
8
8
|
import Taro from '@tarojs/taro';
|
|
9
9
|
import { I as Icon } from './icon.taro-1d0d4fb7.js';
|
|
10
|
-
import { R as Range } from './range.taro-
|
|
10
|
+
import { R as Range } from './range.taro-4e5f8f31.js';
|
|
11
11
|
import { B as Button } from './button.taro-4ce133b9.js';
|
|
12
12
|
import { c as cn } from './bem-893ad28d.js';
|
|
13
13
|
import { u as useConfig } from './configprovider.taro-6c7b3056.js';
|
|
@@ -47,9 +47,14 @@ var Calendar = function Calendar(props) {
|
|
|
47
47
|
visible: visible,
|
|
48
48
|
position: "bottom",
|
|
49
49
|
round: true,
|
|
50
|
+
duration: 0.5,
|
|
50
51
|
closeable: true,
|
|
52
|
+
destroyOnClose: true,
|
|
51
53
|
onClickOverlay: closePopup,
|
|
52
|
-
onClickCloseIcon: closePopup
|
|
54
|
+
onClickCloseIcon: closePopup,
|
|
55
|
+
style: {
|
|
56
|
+
height: '85vh'
|
|
57
|
+
}
|
|
53
58
|
}, React__default.createElement(CalendarItem, {
|
|
54
59
|
type: type,
|
|
55
60
|
isAutoBackFill: isAutoBackFill,
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { u as useConfig } from './configprovider-3e87d67a.js';
|
|
6
|
+
var defaultProps = {};
|
|
7
|
+
var Form = function Form(props) {
|
|
8
|
+
useConfig();
|
|
9
|
+
_objectSpread(_objectSpread({}, defaultProps), props);
|
|
10
|
+
return React__default.createElement("div", {
|
|
11
|
+
className: "nut-form"
|
|
12
|
+
}, "Form");
|
|
13
|
+
};
|
|
14
|
+
Form.defaultProps = defaultProps;
|
|
15
|
+
Form.displayName = 'NutForm';
|
|
16
|
+
export { Form as F };
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
var _excluded = ["children", "click", "onClick", "title", "subTitle", "desc", "descTextAlign", "isLink", "icon", "roundRadius", "url", "to", "replace", "center", "size", "className", "iconSlot", "linkSlot", "iconClassPrefix", "iconFontClassName"];
|
|
10
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
import React__default, { createContext } from 'react';
|
|
15
|
+
import { useHistory } from 'react-router-dom';
|
|
16
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
17
|
+
import { I as Icon } from './icon-8dc4de10.js';
|
|
18
|
+
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
19
|
+
var FormItemContext = createContext({});
|
|
20
|
+
var defaultProps$1 = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
21
|
+
title: null,
|
|
22
|
+
subTitle: null,
|
|
23
|
+
desc: '',
|
|
24
|
+
descTextAlign: 'right',
|
|
25
|
+
isLink: false,
|
|
26
|
+
icon: '',
|
|
27
|
+
roundRadius: '6px',
|
|
28
|
+
url: '',
|
|
29
|
+
to: '',
|
|
30
|
+
replace: false,
|
|
31
|
+
center: false,
|
|
32
|
+
size: '',
|
|
33
|
+
className: '',
|
|
34
|
+
iconSlot: null,
|
|
35
|
+
linkSlot: null,
|
|
36
|
+
click: function click(event) {},
|
|
37
|
+
onClick: function onClick(event) {}
|
|
38
|
+
});
|
|
39
|
+
var Cell = function Cell(props) {
|
|
40
|
+
var _defaultProps$1$props = _objectSpread(_objectSpread({}, defaultProps$1), props),
|
|
41
|
+
children = _defaultProps$1$props.children,
|
|
42
|
+
click = _defaultProps$1$props.click,
|
|
43
|
+
onClick = _defaultProps$1$props.onClick,
|
|
44
|
+
title = _defaultProps$1$props.title,
|
|
45
|
+
subTitle = _defaultProps$1$props.subTitle,
|
|
46
|
+
desc = _defaultProps$1$props.desc,
|
|
47
|
+
descTextAlign = _defaultProps$1$props.descTextAlign,
|
|
48
|
+
isLink = _defaultProps$1$props.isLink,
|
|
49
|
+
icon = _defaultProps$1$props.icon,
|
|
50
|
+
roundRadius = _defaultProps$1$props.roundRadius,
|
|
51
|
+
url = _defaultProps$1$props.url,
|
|
52
|
+
to = _defaultProps$1$props.to,
|
|
53
|
+
replace = _defaultProps$1$props.replace,
|
|
54
|
+
center = _defaultProps$1$props.center,
|
|
55
|
+
size = _defaultProps$1$props.size,
|
|
56
|
+
className = _defaultProps$1$props.className,
|
|
57
|
+
iconSlot = _defaultProps$1$props.iconSlot,
|
|
58
|
+
linkSlot = _defaultProps$1$props.linkSlot,
|
|
59
|
+
iconClassPrefix = _defaultProps$1$props.iconClassPrefix,
|
|
60
|
+
iconFontClassName = _defaultProps$1$props.iconFontClassName,
|
|
61
|
+
rest = _objectWithoutProperties(_defaultProps$1$props, _excluded);
|
|
62
|
+
var b = cn('cell');
|
|
63
|
+
var history = useHistory();
|
|
64
|
+
var handleClick = function handleClick(event) {
|
|
65
|
+
click(event);
|
|
66
|
+
onClick(event);
|
|
67
|
+
if (to && history) {
|
|
68
|
+
history[replace ? 'replace' : 'push'](to);
|
|
69
|
+
} else if (url) {
|
|
70
|
+
replace ? window.location.replace(url) : window.location.href = url;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var baseStyle = {
|
|
74
|
+
borderRadius: Number.isNaN(Number(roundRadius)) ? String(roundRadius) : "".concat(roundRadius, "px")
|
|
75
|
+
};
|
|
76
|
+
var styles = title || subTitle || icon ? {} : {
|
|
77
|
+
textAlign: descTextAlign,
|
|
78
|
+
flex: 1
|
|
79
|
+
};
|
|
80
|
+
return React__default.createElement("div", _objectSpread({
|
|
81
|
+
className: "".concat(b({
|
|
82
|
+
clickable: !!(isLink || to),
|
|
83
|
+
center: center,
|
|
84
|
+
large: size === 'large'
|
|
85
|
+
}, [className]), " "),
|
|
86
|
+
onClick: function onClick(event) {
|
|
87
|
+
return handleClick(event);
|
|
88
|
+
},
|
|
89
|
+
style: baseStyle
|
|
90
|
+
}, rest), children || React__default.createElement(React__default.Fragment, null, icon || iconSlot ? React__default.createElement("div", {
|
|
91
|
+
className: b('icon')
|
|
92
|
+
}, iconSlot || (icon ? React__default.createElement(Icon, {
|
|
93
|
+
classPrefix: iconClassPrefix,
|
|
94
|
+
fontClassName: iconFontClassName,
|
|
95
|
+
name: icon,
|
|
96
|
+
className: "icon"
|
|
97
|
+
}) : null)) : null, title || subTitle ? React__default.createElement("div", {
|
|
98
|
+
className: "".concat(b('title'))
|
|
99
|
+
}, title ? React__default.createElement("div", {
|
|
100
|
+
className: b('maintitle')
|
|
101
|
+
}, title) : null, subTitle ? React__default.createElement("div", {
|
|
102
|
+
className: b('subtitle')
|
|
103
|
+
}, subTitle) : null) : null, desc ? React__default.createElement("div", {
|
|
104
|
+
className: b('value', {
|
|
105
|
+
alone: !title && !subTitle
|
|
106
|
+
}),
|
|
107
|
+
style: styles
|
|
108
|
+
}, desc) : null, !linkSlot && (isLink || to) ? React__default.createElement(Icon, {
|
|
109
|
+
classPrefix: iconClassPrefix,
|
|
110
|
+
fontClassName: iconFontClassName,
|
|
111
|
+
name: "right",
|
|
112
|
+
className: b('link')
|
|
113
|
+
}) : linkSlot));
|
|
114
|
+
};
|
|
115
|
+
Cell.defaultProps = defaultProps$1;
|
|
116
|
+
Cell.displayName = 'NutCell';
|
|
117
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
118
|
+
name: '',
|
|
119
|
+
label: '',
|
|
120
|
+
className: '',
|
|
121
|
+
rules: [{
|
|
122
|
+
required: false,
|
|
123
|
+
message: ''
|
|
124
|
+
}],
|
|
125
|
+
disabled: false,
|
|
126
|
+
labelWidth: 90,
|
|
127
|
+
errorMessageAlign: 'left',
|
|
128
|
+
showErrorLine: true,
|
|
129
|
+
showErrorMessage: true
|
|
130
|
+
});
|
|
131
|
+
var FormItem = /*#__PURE__*/function (_React__default$Compo) {
|
|
132
|
+
_inherits(FormItem, _React__default$Compo);
|
|
133
|
+
var _super = _createSuper(FormItem);
|
|
134
|
+
function FormItem() {
|
|
135
|
+
var _this;
|
|
136
|
+
_classCallCheck(this, FormItem);
|
|
137
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
138
|
+
args[_key] = arguments[_key];
|
|
139
|
+
}
|
|
140
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
141
|
+
_defineProperty(_assertThisInitialized(_this), "cancelRegister", void 0);
|
|
142
|
+
_defineProperty(_assertThisInitialized(_this), "getControlled", function (children) {
|
|
143
|
+
var _this$context = _this.context,
|
|
144
|
+
getFieldValue = _this$context.getFieldValue,
|
|
145
|
+
setFieldsValue = _this$context.setFieldsValue;
|
|
146
|
+
var name = _this.props.name;
|
|
147
|
+
var type = children.type.NAME;
|
|
148
|
+
return {
|
|
149
|
+
value: getFieldValue(name),
|
|
150
|
+
onChange: function onChange(event) {
|
|
151
|
+
var newValue = event;
|
|
152
|
+
switch (type) {
|
|
153
|
+
case 'checkbox':
|
|
154
|
+
newValue = event.target.value;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
setFieldsValue(_defineProperty({}, name, newValue));
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
_defineProperty(_assertThisInitialized(_this), "onStoreChange", function () {
|
|
162
|
+
_this.forceUpdate();
|
|
163
|
+
});
|
|
164
|
+
_defineProperty(_assertThisInitialized(_this), "renderLayout", function (childNode) {
|
|
165
|
+
var _this$context$errList, _this$context$errList2;
|
|
166
|
+
var _defaultProps$_this$p = _objectSpread(_objectSpread({}, defaultProps), _this.props),
|
|
167
|
+
label = _defaultProps$_this$p.label,
|
|
168
|
+
name = _defaultProps$_this$p.name,
|
|
169
|
+
_defaultProps$_this$p2 = _defaultProps$_this$p.rules,
|
|
170
|
+
rules = _defaultProps$_this$p2 === void 0 ? [{
|
|
171
|
+
required: false,
|
|
172
|
+
message: ''
|
|
173
|
+
}] : _defaultProps$_this$p2,
|
|
174
|
+
className = _defaultProps$_this$p.className,
|
|
175
|
+
labelWidth = _defaultProps$_this$p.labelWidth,
|
|
176
|
+
errorMessageAlign = _defaultProps$_this$p.errorMessageAlign,
|
|
177
|
+
showErrorLine = _defaultProps$_this$p.showErrorLine,
|
|
178
|
+
showErrorMessage = _defaultProps$_this$p.showErrorMessage;
|
|
179
|
+
var item = ((_this$context$errList = _this.context.errList) === null || _this$context$errList === void 0 ? void 0 : _this$context$errList.length) > 0 && ((_this$context$errList2 = _this.context.errList) === null || _this$context$errList2 === void 0 ? void 0 : _this$context$errList2.filter(function (item) {
|
|
180
|
+
return item.field === name;
|
|
181
|
+
}));
|
|
182
|
+
var starPositon = _this.context.starPositon;
|
|
183
|
+
var renderStar = rules.length > 0 && rules[0].required && React__default.createElement("i", {
|
|
184
|
+
className: "required"
|
|
185
|
+
});
|
|
186
|
+
var renderLabel = starPositon === 'Right' ? React__default.createElement(React__default.Fragment, null, label, renderStar) : React__default.createElement(React__default.Fragment, null, renderStar, label);
|
|
187
|
+
return React__default.createElement(Cell, {
|
|
188
|
+
className: "nut-form-item ".concat(className)
|
|
189
|
+
}, label ? React__default.createElement("div", {
|
|
190
|
+
className: "nut-cell__title nut-form-item__label",
|
|
191
|
+
style: {
|
|
192
|
+
width: _this.pxCheck(labelWidth)
|
|
193
|
+
}
|
|
194
|
+
}, renderLabel) : null, React__default.createElement("div", {
|
|
195
|
+
className: "nut-cell__value nut-form-item__body"
|
|
196
|
+
}, React__default.createElement("div", {
|
|
197
|
+
className: "nut-form-item__body__slots"
|
|
198
|
+
}, childNode), item.length > 0 && React__default.createElement("div", {
|
|
199
|
+
className: "nut-form-item__body__tips",
|
|
200
|
+
style: {
|
|
201
|
+
textAlign: errorMessageAlign
|
|
202
|
+
}
|
|
203
|
+
}, item[0].message)));
|
|
204
|
+
});
|
|
205
|
+
_defineProperty(_assertThisInitialized(_this), "pxCheck", function (value) {
|
|
206
|
+
return Number.isNaN(Number(value)) ? String(value) : "".concat(value, "px");
|
|
207
|
+
});
|
|
208
|
+
return _this;
|
|
209
|
+
}
|
|
210
|
+
_createClass(FormItem, [{
|
|
211
|
+
key: "componentDidMount",
|
|
212
|
+
value: function componentDidMount() {
|
|
213
|
+
// 注册组件实例到FormStore
|
|
214
|
+
this.cancelRegister = this.context.registerField(this);
|
|
215
|
+
}
|
|
216
|
+
}, {
|
|
217
|
+
key: "componentWillUnmount",
|
|
218
|
+
value: function componentWillUnmount() {
|
|
219
|
+
if (this.cancelRegister) {
|
|
220
|
+
this.cancelRegister();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// children添加value属性和onChange事件
|
|
224
|
+
}, {
|
|
225
|
+
key: "render",
|
|
226
|
+
value: function render() {
|
|
227
|
+
var children = this.props.children;
|
|
228
|
+
var c = Array.isArray(children) ? children[0] : children;
|
|
229
|
+
var returnChildNode = React__default.cloneElement(c, this.getControlled(c));
|
|
230
|
+
return this.renderLayout(returnChildNode);
|
|
231
|
+
}
|
|
232
|
+
}]);
|
|
233
|
+
return FormItem;
|
|
234
|
+
}(React__default.Component);
|
|
235
|
+
_defineProperty(FormItem, "defaultProps", defaultProps);
|
|
236
|
+
_defineProperty(FormItem, "contextType", FormItemContext);
|
|
237
|
+
export { FormItem as F };
|
|
@@ -26,8 +26,8 @@ export { S as SubSideNavBar } from './subsidenavbar.taro-4c80ad38.js';
|
|
|
26
26
|
export { S as SideNavBarItem } from './sidenavbaritem.taro-fee11d26.js';
|
|
27
27
|
export { M as Menu } from './menu.taro-4abed328.js';
|
|
28
28
|
export { M as MenuItem } from './menuitem.taro-bb55f482.js';
|
|
29
|
-
export { R as Range } from './range.taro-
|
|
30
|
-
export { C as Calendar } from './calendar.taro-
|
|
29
|
+
export { R as Range } from './range.taro-4e5f8f31.js';
|
|
30
|
+
export { C as Calendar } from './calendar.taro-0a8cbd0c.js';
|
|
31
31
|
export { C as Checkbox, a as CheckboxGroup } from './checkbox.taro-0bda9796.js';
|
|
32
32
|
export { D as DatePicker } from './datepicker.taro-9f8afe51.js';
|
|
33
33
|
export { I as InputNumber } from './inputnumber.taro-0a01f6e1.js';
|
|
@@ -37,11 +37,13 @@ export { R as Rate } from './rate.taro-10197384.js';
|
|
|
37
37
|
export { C as CalendarItem } from './calendaritem.taro-3a12e7f2.js';
|
|
38
38
|
export { P as Picker } from './picker.taro-f003b725.js';
|
|
39
39
|
export { S as ShortPassword } from './shortpassword.taro-2e96ca22.js';
|
|
40
|
-
export { T as TextArea } from './textarea.taro-
|
|
40
|
+
export { T as TextArea } from './textarea.taro-e1bf7f4d.js';
|
|
41
41
|
export { U as Uploader } from './uploader.taro-2e16bff6.js';
|
|
42
42
|
export { C as Cascader } from './cascader.taro-8c9891b4.js';
|
|
43
43
|
export { S as SearchBar } from './searchbar.taro-0d3c0081.js';
|
|
44
44
|
export { N as NumberKeyboard } from './numberkeyboard.taro-53c350b8.js';
|
|
45
|
+
export { F as Form } from './form.taro-e086758a.js';
|
|
46
|
+
export { F as FormItem } from './formitem-9f11e314.js';
|
|
45
47
|
export { A as ActionSheet } from './actionsheet.taro-360d8d34.js';
|
|
46
48
|
export { B as BackTop } from './backtop.taro-99107c30.js';
|
|
47
49
|
export { D as Drag } from './drag.taro-0717c783.js';
|
|
@@ -51,7 +53,7 @@ export { N as Notify } from './notify.taro-d9c48fae.js';
|
|
|
51
53
|
export { S as Switch } from './switch.taro-bae2dca0.js';
|
|
52
54
|
export { T as Toast } from './toast.taro-86862dff.js';
|
|
53
55
|
export { S as Swipe } from './swipe.taro-83bc248f.js';
|
|
54
|
-
export { P as PullToRefresh } from './pulltorefresh.taro-
|
|
56
|
+
export { P as PullToRefresh } from './pulltorefresh.taro-fe2fa54c.js';
|
|
55
57
|
export { C as CircleProgress } from './circleprogress.taro-3c89a157.js';
|
|
56
58
|
export { N as NoticeBar } from './noticebar.taro-4915fed3.js';
|
|
57
59
|
export { S as Steps } from './steps.taro-acf205a0.js';
|
|
@@ -74,7 +76,7 @@ export { V as VirtualList } from './virtuallist.taro-e3035825.js';
|
|
|
74
76
|
export { T as Table } from './table.taro-7ac89a6c.js';
|
|
75
77
|
export { V as Video } from './video-8a3518c5.js';
|
|
76
78
|
export { P as Progress } from './progress.taro-623bc807.js';
|
|
77
|
-
export { A as Audio } from './audio.taro-
|
|
79
|
+
export { A as Audio } from './audio.taro-6920085d.js';
|
|
78
80
|
export { I as ImagePreview } from './imagepreview.taro-69d47ab0.js';
|
|
79
81
|
export { A as Address } from './address.taro-8d642b4a.js';
|
|
80
82
|
export { B as Barrage } from './barrage.taro-d86c367a.js';
|
|
@@ -99,6 +101,7 @@ import './offsetContext-0e3d04b3.js';
|
|
|
99
101
|
import './useTouch-a2ea68c6.js';
|
|
100
102
|
import './useClientRect-bf69d7b3.js';
|
|
101
103
|
import './icon-8dc4de10.js';
|
|
104
|
+
import 'react-router-dom';
|
|
102
105
|
import '@use-gesture/react';
|
|
103
106
|
import '@react-spring/web';
|
|
104
107
|
import './UserContext-68f62e66.js';
|
|
@@ -272,7 +272,6 @@ var PullToRefresh = function PullToRefresh(p) {
|
|
|
272
272
|
} : false
|
|
273
273
|
});
|
|
274
274
|
var renderStatusText = function renderStatusText() {
|
|
275
|
-
console.log(props);
|
|
276
275
|
if (props.renderText) {
|
|
277
276
|
var _props$renderText;
|
|
278
277
|
return (_props$renderText = props.renderText) === null || _props$renderText === void 0 ? void 0 : _props$renderText.call(props, status);
|
|
@@ -43,7 +43,10 @@ var Range = function Range(props) {
|
|
|
43
43
|
dragEnd = _defaultProps$props.dragEnd,
|
|
44
44
|
onChange = _defaultProps$props.onChange,
|
|
45
45
|
onDragStart = _defaultProps$props.onDragStart,
|
|
46
|
-
onDragEnd = _defaultProps$props.onDragEnd
|
|
46
|
+
onDragEnd = _defaultProps$props.onDragEnd,
|
|
47
|
+
minDesc = _defaultProps$props.minDesc,
|
|
48
|
+
maxDesc = _defaultProps$props.maxDesc,
|
|
49
|
+
curValueDesc = _defaultProps$props.curValueDesc;
|
|
47
50
|
var _defaultProps$props2 = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
48
51
|
min = _defaultProps$props2.min,
|
|
49
52
|
max = _defaultProps$props2.max,
|
|
@@ -258,10 +261,10 @@ var Range = function Range(props) {
|
|
|
258
261
|
return getRectByTaro(root.current);
|
|
259
262
|
case 5:
|
|
260
263
|
rect = _context.sent;
|
|
261
|
-
delta = event.detail.x - rect.left;
|
|
264
|
+
delta = (event.detail.x ? event.detail.x : event.clientX) - rect.left;
|
|
262
265
|
total = rect.width;
|
|
263
266
|
if (vertical) {
|
|
264
|
-
delta = event.detail.y - rect.top;
|
|
267
|
+
delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
|
|
265
268
|
total = rect.height;
|
|
266
269
|
}
|
|
267
270
|
value = Number(min) + delta / total * scope();
|
|
@@ -369,7 +372,7 @@ var Range = function Range(props) {
|
|
|
369
372
|
className: "".concat(containerName)
|
|
370
373
|
}, !hiddenRange ? React__default.createElement("div", {
|
|
371
374
|
className: "min"
|
|
372
|
-
}, +min) : null, React__default.createElement("div", {
|
|
375
|
+
}, minDesc || +min) : null, React__default.createElement("div", {
|
|
373
376
|
ref: root,
|
|
374
377
|
style: wrapperStyle(),
|
|
375
378
|
className: "".concat(rangeName),
|
|
@@ -424,7 +427,7 @@ var Range = function Range(props) {
|
|
|
424
427
|
style: buttonStyle()
|
|
425
428
|
}, !hiddenTag ? React__default.createElement("div", {
|
|
426
429
|
className: "number"
|
|
427
|
-
}, curValue(index)) : null));
|
|
430
|
+
}, curValueDesc || curValue(index)) : null));
|
|
428
431
|
}) : React__default.createElement("div", {
|
|
429
432
|
role: "slider",
|
|
430
433
|
className: "nut-range-button-wrapper",
|
|
@@ -453,9 +456,9 @@ var Range = function Range(props) {
|
|
|
453
456
|
style: buttonStyle()
|
|
454
457
|
}, !hiddenTag ? React__default.createElement("div", {
|
|
455
458
|
className: "number"
|
|
456
|
-
}, curValue()) : null)))), !hiddenRange ? React__default.createElement("div", {
|
|
459
|
+
}, curValueDesc || curValue()) : null)))), !hiddenRange ? React__default.createElement("div", {
|
|
457
460
|
className: "max"
|
|
458
|
-
}, +max) : null, React__default.createElement(Toast, {
|
|
461
|
+
}, maxDesc || +max) : null, React__default.createElement(Toast, {
|
|
459
462
|
type: "text",
|
|
460
463
|
visible: show,
|
|
461
464
|
msg: toastMsg,
|
|
@@ -48,7 +48,7 @@ var TextArea = function TextArea(props) {
|
|
|
48
48
|
SetInputValue(initValue);
|
|
49
49
|
}, [defaultValue]);
|
|
50
50
|
var textChange = function textChange(event) {
|
|
51
|
-
var text = event.detail;
|
|
51
|
+
var text = event.detail ? event.detail : event.target;
|
|
52
52
|
if (maxlength && _toConsumableArray(text.value).length > Number(maxlength)) {
|
|
53
53
|
text.value = text.value.substring(0, Number(maxlength));
|
|
54
54
|
}
|
|
@@ -63,7 +63,7 @@ var TextArea = function TextArea(props) {
|
|
|
63
63
|
var textBlur = function textBlur(event) {
|
|
64
64
|
if (disabled) return;
|
|
65
65
|
if (readonly) return;
|
|
66
|
-
var text = event.detail;
|
|
66
|
+
var text = event.detail ? event.detail : event.target;
|
|
67
67
|
onChange && onChange(text.value, event);
|
|
68
68
|
onBlur && onBlur(event);
|
|
69
69
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import { IComponent } from '@/utils/typings';
|
|
3
|
+
import { FormItem } from '../formitem/formitem';
|
|
4
|
+
import { BaseForm } from './types';
|
|
5
|
+
export interface FormProps extends IComponent, BaseForm {
|
|
6
|
+
}
|
|
7
|
+
export declare const Form: FunctionComponent<Partial<FormProps> & React.HTMLAttributes<HTMLFormElement>> & {
|
|
8
|
+
Item: typeof FormItem;
|
|
9
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export interface BaseForm {
|
|
2
|
+
/**
|
|
3
|
+
* 经 Form.useForm() 创建的 form 控制实例,不提供时会自动创建
|
|
4
|
+
*/
|
|
5
|
+
form: any;
|
|
6
|
+
/**
|
|
7
|
+
* label的位置
|
|
8
|
+
* 可选值 top/left/right
|
|
9
|
+
*/
|
|
10
|
+
labelPosition: string | number;
|
|
11
|
+
/**
|
|
12
|
+
* 表单分组名称
|
|
13
|
+
*/
|
|
14
|
+
formGroupTitle: string;
|
|
15
|
+
starPositon: string;
|
|
16
|
+
/**
|
|
17
|
+
* 表单校验成功回调
|
|
18
|
+
*/
|
|
19
|
+
onFinish: (obj: object) => void;
|
|
20
|
+
/**
|
|
21
|
+
* 表单校验失败回调
|
|
22
|
+
*/
|
|
23
|
+
onFinishFailed: (value: []) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface FormItemRuleWithoutValidator {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
regex?: RegExp;
|
|
28
|
+
required?: boolean;
|
|
29
|
+
message?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface FormItemRule extends FormItemRuleWithoutValidator {
|
|
32
|
+
validator?: (value: any, ruleCfg: FormItemRuleWithoutValidator) => boolean | string | Promise<boolean | string>;
|
|
33
|
+
}
|
|
34
|
+
export interface BaseFormField {
|
|
35
|
+
/**
|
|
36
|
+
* 字段名
|
|
37
|
+
*/
|
|
38
|
+
name: string;
|
|
39
|
+
/**
|
|
40
|
+
* label 标签的文本
|
|
41
|
+
*/
|
|
42
|
+
label: string;
|
|
43
|
+
/**
|
|
44
|
+
* 校验规则,设置字段的校验逻辑
|
|
45
|
+
*/
|
|
46
|
+
rules: FormItemRule[];
|
|
47
|
+
/**
|
|
48
|
+
* 是否禁用表单项
|
|
49
|
+
*/
|
|
50
|
+
disabled: boolean;
|
|
51
|
+
}
|
|
52
|
+
export declare type StoreValue = string | number;
|
|
53
|
+
export declare type NamePath = string | number;
|
|
54
|
+
export interface Callbacks<Values = any> {
|
|
55
|
+
onValuesChange?: (values: Values) => void;
|
|
56
|
+
onFinish?: (values: Values) => void;
|
|
57
|
+
onFinishFailed?: (Values: Values) => void;
|
|
58
|
+
}
|
|
59
|
+
export interface Store {
|
|
60
|
+
[name: string]: StoreValue;
|
|
61
|
+
}
|
|
62
|
+
export interface FormInstance<Values = any> {
|
|
63
|
+
registerField: (entity: FieldEntity) => () => void;
|
|
64
|
+
getFieldValue: (name: NamePath) => StoreValue;
|
|
65
|
+
setFieldsValue: (value: any) => void;
|
|
66
|
+
resetFields: (fields?: NamePath[]) => void;
|
|
67
|
+
submit: () => void;
|
|
68
|
+
setCallback: (callbacks: Callbacks) => void;
|
|
69
|
+
}
|
|
70
|
+
export interface FieldEntity {
|
|
71
|
+
onStoreChange: () => void;
|
|
72
|
+
getNamePath: () => NamePath;
|
|
73
|
+
props: {
|
|
74
|
+
name: NamePath;
|
|
75
|
+
rules?: any[];
|
|
76
|
+
dependencies?: NamePath[];
|
|
77
|
+
initialValue?: any;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface IDescriptor {
|
|
81
|
+
[name: string]: string;
|
|
82
|
+
}
|