@power-xa/m-ui 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionSheet/index.less +2 -1
- package/dist/Button/index.js +1 -1
- package/dist/CreatorEdit/index.js +2 -1
- package/dist/DatePicker/index.d.ts +13 -0
- package/dist/DatePicker/index.js +150 -0
- package/dist/DatePicker/index.less +35 -0
- package/dist/Filter/index.d.ts +13 -0
- package/dist/Filter/index.js +77 -0
- package/dist/Filter/index.less +78 -0
- package/dist/FloatButton/index.js +24 -19
- package/dist/Popup/index.js +8 -1
- package/dist/Popup/index.less +1 -0
- package/dist/ProForm/{controls → Controls}/Date/index.js +23 -8
- package/dist/ProForm/Controls/List/index.d.ts +30 -0
- package/dist/ProForm/Controls/List/index.js +130 -0
- package/dist/ProForm/{controls → Controls}/List/index.less +31 -0
- package/dist/ProForm/{controls → Controls}/Select/index.js +23 -13
- package/dist/ProForm/{controls → Controls}/Select/index.less +6 -0
- package/dist/ProForm/Controls/Text/index.js +45 -0
- package/dist/ProForm/{controls → Controls}/TextArea/index.js +14 -4
- package/dist/ProForm/{controls → Controls}/Upload/index.js +5 -1
- package/dist/ProForm/Field/index.d.ts +2 -1
- package/dist/ProForm/Field/index.js +1 -1
- package/dist/ProForm/Field/index.less +2 -0
- package/dist/ProForm/Form/index.d.ts +6 -6
- package/dist/ProForm/Form/index.js +154 -57
- package/dist/ProForm/Group/index.js +31 -45
- package/dist/ProForm/index.d.ts +0 -2
- package/dist/ProForm/typings.d.ts +18 -16
- package/dist/ProList/index.d.ts +1 -1
- package/dist/ProList/index.js +36 -14
- package/dist/SearchInput/index.d.ts +9 -0
- package/dist/SearchInput/index.js +22 -0
- package/dist/SearchInput/index.less +29 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.js +10 -7
- package/dist/request/index.js +1 -1
- package/dist/utils/tools.d.ts +11 -1
- package/dist/utils/tools.js +43 -9
- package/package.json +1 -1
- package/dist/ProForm/controls/List/index.d.ts +0 -23
- package/dist/ProForm/controls/List/index.js +0 -77
- package/dist/ProForm/controls/Text/index.js +0 -29
- /package/dist/ProForm/{controls → Controls}/Date/index.d.ts +0 -0
- /package/dist/ProForm/{controls → Controls}/Select/index.d.ts +0 -0
- /package/dist/ProForm/{controls → Controls}/Text/index.d.ts +0 -0
- /package/dist/ProForm/{controls → Controls}/Text/index.less +0 -0
- /package/dist/ProForm/{controls → Controls}/TextArea/index.d.ts +0 -0
- /package/dist/ProForm/{controls → Controls}/TextArea/index.less +0 -0
- /package/dist/ProForm/{controls → Controls}/Upload/index.d.ts +0 -0
- /package/dist/ProForm/{controls → Controls}/Upload/index.less +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["extra", "children", "listProps", "record"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
import React, { cloneElement, Fragment, useCallback } from "react";
|
|
12
|
+
import { Text, View } from "@tarojs/components";
|
|
13
|
+
import { getUUID, ProList, getObjectPathValue, setObjectPathValue } from "../../..";
|
|
14
|
+
import ProFormField from "../../Field";
|
|
15
|
+
import "./index.less";
|
|
16
|
+
var ProFormList = function ProFormList(_ref) {
|
|
17
|
+
var _listProps$meta3, _listProps$meta4;
|
|
18
|
+
var extra = _ref.extra,
|
|
19
|
+
children = _ref.children,
|
|
20
|
+
listProps = _ref.listProps,
|
|
21
|
+
record = _ref.record,
|
|
22
|
+
fieldProps = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
var disabled = fieldProps.disabled,
|
|
24
|
+
_fieldProps$value = fieldProps.value,
|
|
25
|
+
value = _fieldProps$value === void 0 ? [] : _fieldProps$value,
|
|
26
|
+
onChange = fieldProps.onChange;
|
|
27
|
+
var renderListContent = useCallback(function (element, index) {
|
|
28
|
+
var _element$props, _element$props2;
|
|
29
|
+
if ((_element$props = element.props) !== null && _element$props !== void 0 && _element$props.name) {
|
|
30
|
+
return /*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread({}, element.props), {}, {
|
|
31
|
+
disabled: fieldProps.disabled || element.props.disabled,
|
|
32
|
+
value: getObjectPathValue(element.props.name, value[index]),
|
|
33
|
+
onChange: function onChange(result) {
|
|
34
|
+
return setObjectPathValue(element.props.name, result, value[index]);
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
if ((_element$props2 = element.props) !== null && _element$props2 !== void 0 && _element$props2.children) {
|
|
39
|
+
return /*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread({}, element), {}, {
|
|
40
|
+
children: Array.from(element.props.children).map(function (item) {
|
|
41
|
+
return renderListContent(item, index);
|
|
42
|
+
})
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
return element;
|
|
46
|
+
}, [value]);
|
|
47
|
+
var getShowEdit = useCallback(function (value) {
|
|
48
|
+
var _listProps$meta;
|
|
49
|
+
if (typeof (listProps === null || listProps === void 0 || (_listProps$meta = listProps.meta) === null || _listProps$meta === void 0 ? void 0 : _listProps$meta.footer) !== "boolean") {
|
|
50
|
+
var _listProps$meta2;
|
|
51
|
+
if (listProps !== null && listProps !== void 0 && (_listProps$meta2 = listProps.meta) !== null && _listProps$meta2 !== void 0 && (_listProps$meta2 = _listProps$meta2.footer) !== null && _listProps$meta2 !== void 0 && (_listProps$meta2 = _listProps$meta2.extra) !== null && _listProps$meta2 !== void 0 && _listProps$meta2.dataIndex) return !value;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}, []);
|
|
56
|
+
return /*#__PURE__*/React.createElement(ProFormField, _extends({}, fieldProps, {
|
|
57
|
+
layout: "vertical",
|
|
58
|
+
className: "p-pro-form-item-list",
|
|
59
|
+
extra: !disabled && /*#__PURE__*/React.createElement(View, {
|
|
60
|
+
className: "p-pro-form-item-header-button",
|
|
61
|
+
onTap: function onTap() {
|
|
62
|
+
var _listProps$onAdd;
|
|
63
|
+
if (listProps !== null && listProps !== void 0 && listProps.onAdd) return listProps === null || listProps === void 0 || (_listProps$onAdd = listProps.onAdd) === null || _listProps$onAdd === void 0 ? void 0 : _listProps$onAdd.call(listProps, function (data) {
|
|
64
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(data instanceof Array ? data : value.concat([data]));
|
|
65
|
+
}, value);
|
|
66
|
+
value.push(_objectSpread({}, record));
|
|
67
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
68
|
+
}
|
|
69
|
+
}, extra || /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
70
|
+
className: "iconfont icon-icon-psp-xinjian"
|
|
71
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
72
|
+
className: "text"
|
|
73
|
+
}, "\u6DFB\u52A0")))
|
|
74
|
+
}), children ? /*#__PURE__*/React.createElement(View, {
|
|
75
|
+
className: "p-pro-form-item-list-container"
|
|
76
|
+
}, value.map(function (_, i) {
|
|
77
|
+
var element = children(value, {
|
|
78
|
+
add: function add() {
|
|
79
|
+
value.push(_objectSpread({}, record));
|
|
80
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
81
|
+
},
|
|
82
|
+
remove: function remove() {
|
|
83
|
+
value.splice(i, 1);
|
|
84
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
88
|
+
key: getUUID(),
|
|
89
|
+
className: "p-pro-form-item-list-content"
|
|
90
|
+
}, renderListContent(element, i));
|
|
91
|
+
})) : listProps ? /*#__PURE__*/React.createElement(ProList, _extends({}, listProps, {
|
|
92
|
+
dataSources: value || [],
|
|
93
|
+
scrollable: false,
|
|
94
|
+
className: "p-pro-list-view-container",
|
|
95
|
+
meta: _objectSpread(_objectSpread({}, listProps.meta), {}, {
|
|
96
|
+
footer: !disabled && {
|
|
97
|
+
extra: {
|
|
98
|
+
dataIndex: typeof ((_listProps$meta3 = listProps.meta) === null || _listProps$meta3 === void 0 ? void 0 : _listProps$meta3.footer) !== "boolean" ? (_listProps$meta4 = listProps.meta) === null || _listProps$meta4 === void 0 || (_listProps$meta4 = _listProps$meta4.footer) === null || _listProps$meta4 === void 0 || (_listProps$meta4 = _listProps$meta4.extra) === null || _listProps$meta4 === void 0 ? void 0 : _listProps$meta4.dataIndex : "",
|
|
99
|
+
render: function render(_, item, index) {
|
|
100
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
101
|
+
className: "option-group"
|
|
102
|
+
}, getShowEdit(_) && /*#__PURE__*/React.createElement(View, {
|
|
103
|
+
className: "option-button",
|
|
104
|
+
onTap: function onTap(e) {
|
|
105
|
+
var _listProps$onEdit;
|
|
106
|
+
e.stopPropagation();
|
|
107
|
+
listProps === null || listProps === void 0 || (_listProps$onEdit = listProps.onEdit) === null || _listProps$onEdit === void 0 || _listProps$onEdit.call(listProps, item, function (data) {
|
|
108
|
+
value.splice(index, 1, data);
|
|
109
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
113
|
+
className: "text"
|
|
114
|
+
}, "\u7F16\u8F91")), /*#__PURE__*/React.createElement(View, {
|
|
115
|
+
className: "option-button",
|
|
116
|
+
onTap: function onTap(e) {
|
|
117
|
+
e.stopPropagation();
|
|
118
|
+
value.splice(index, 1);
|
|
119
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
120
|
+
}
|
|
121
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
122
|
+
className: "text danger"
|
|
123
|
+
}, "\u5220\u9664")));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
})) : /*#__PURE__*/React.createElement(View, null));
|
|
129
|
+
};
|
|
130
|
+
export default ProFormList;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@import "@power-xa/m-ui/dist/assets/less/mixins.less";
|
|
2
2
|
|
|
3
3
|
.p-pro-form-item-list {
|
|
4
|
+
|
|
4
5
|
.p-pro-form-item-header-button {
|
|
5
6
|
display: flex;
|
|
6
7
|
align-items: center;
|
|
@@ -17,6 +18,36 @@
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
.p-pro-form-item-list-container {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: 20px;
|
|
25
|
+
|
|
26
|
+
.p-pro-form-item-list-content {
|
|
27
|
+
background: #F6F7F9;
|
|
28
|
+
border-radius: 16px;
|
|
29
|
+
padding: 24px;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
|
|
32
|
+
.p-pro-form-item {
|
|
33
|
+
margin: 0;
|
|
34
|
+
padding: 12px 24px;
|
|
35
|
+
border-radius: 16px;
|
|
36
|
+
border: none;
|
|
37
|
+
|
|
38
|
+
.p-pro-form-item-control {
|
|
39
|
+
.p-pro-form-item-input {
|
|
40
|
+
text-align: left;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.p-pro-form-item-placeholder {
|
|
44
|
+
text-align: left;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
20
51
|
.p-pro-list-view-container {
|
|
21
52
|
.p-pro-list-card-container {
|
|
22
53
|
padding: 0 0 30px;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
6
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
9
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -18,7 +18,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
18
18
|
import React, { Fragment, useCallback, useEffect, useState } from "react";
|
|
19
19
|
import { navigateTo } from "@tarojs/taro";
|
|
20
20
|
import { ScrollView, Text, View } from "@tarojs/components";
|
|
21
|
-
import { getListAssignField, Popup } from "../../..";
|
|
21
|
+
import { getListAssignField, Popup, SearchInput } from "../../..";
|
|
22
22
|
import ProFormField from "../../Field";
|
|
23
23
|
import "./index.less";
|
|
24
24
|
var ProFormSelect = function ProFormSelect(props) {
|
|
@@ -93,7 +93,7 @@ var ProFormSelect = function ProFormSelect(props) {
|
|
|
93
93
|
url: "/screens/common/select/recent/index",
|
|
94
94
|
success: function success(result) {
|
|
95
95
|
result.eventChannel.emit("getRecentParams", _objectSpread(_objectSpread({}, props), {}, {
|
|
96
|
-
value: value,
|
|
96
|
+
value: value ? _toConsumableArray(value) : [],
|
|
97
97
|
onChange: function onChange(result) {
|
|
98
98
|
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(result);
|
|
99
99
|
}
|
|
@@ -105,7 +105,7 @@ var ProFormSelect = function ProFormSelect(props) {
|
|
|
105
105
|
url: "/screens/common/select/".concat(companyId ? 'company' : "project", "/index"),
|
|
106
106
|
success: function success(result) {
|
|
107
107
|
result.eventChannel.emit("getSelectParams", _objectSpread(_objectSpread({}, props), {}, {
|
|
108
|
-
value: value,
|
|
108
|
+
value: value ? _toConsumableArray(value) : [],
|
|
109
109
|
onChange: function onChange(result) {
|
|
110
110
|
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(result);
|
|
111
111
|
}
|
|
@@ -158,16 +158,17 @@ var ProFormSelect = function ProFormSelect(props) {
|
|
|
158
158
|
onTap: function onTap() {
|
|
159
159
|
if (disabled) return false;
|
|
160
160
|
if (multiple) {
|
|
161
|
-
|
|
161
|
+
var v = value || [];
|
|
162
|
+
if (v.some(function (v) {
|
|
162
163
|
return v === item[fieldNames.value];
|
|
163
164
|
})) {
|
|
164
|
-
|
|
165
|
+
v.splice(v.findIndex(function (v) {
|
|
165
166
|
return v === item[fieldNames.value];
|
|
166
167
|
}), 1);
|
|
167
168
|
} else {
|
|
168
|
-
|
|
169
|
+
v.push(item[fieldNames.value]);
|
|
169
170
|
}
|
|
170
|
-
setValue(_toConsumableArray(
|
|
171
|
+
setValue(_toConsumableArray(v));
|
|
171
172
|
} else {
|
|
172
173
|
_onChange === null || _onChange === void 0 || _onChange(item[fieldNames.value]);
|
|
173
174
|
}
|
|
@@ -223,7 +224,15 @@ var ProFormSelect = function ProFormSelect(props) {
|
|
|
223
224
|
onOpenChange();
|
|
224
225
|
_onChange === null || _onChange === void 0 || _onChange(value);
|
|
225
226
|
}
|
|
226
|
-
}, "\u786E\u5B9A"))), /*#__PURE__*/React.createElement(
|
|
227
|
+
}, "\u786E\u5B9A"))), /*#__PURE__*/React.createElement(SearchInput, {
|
|
228
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",
|
|
229
|
+
onSearch: function onSearch(value) {
|
|
230
|
+
var _props$options2;
|
|
231
|
+
return setOptions(((_props$options2 = props.options) === null || _props$options2 === void 0 ? void 0 : _props$options2.filter(function (item) {
|
|
232
|
+
return item[fieldNames.label].indexOf(value) >= 0;
|
|
233
|
+
})) || []);
|
|
234
|
+
}
|
|
235
|
+
}), /*#__PURE__*/React.createElement(ScrollView, {
|
|
227
236
|
className: "p-pro-form-item-select-popup-content",
|
|
228
237
|
showScrollbar: false,
|
|
229
238
|
scrollY: true,
|
|
@@ -235,16 +244,17 @@ var ProFormSelect = function ProFormSelect(props) {
|
|
|
235
244
|
key: 'option-' + item[fieldNames.value],
|
|
236
245
|
onTap: function onTap() {
|
|
237
246
|
if (multiple) {
|
|
238
|
-
|
|
247
|
+
var v = value || [];
|
|
248
|
+
if (v.some(function (v) {
|
|
239
249
|
return v === item[fieldNames.value];
|
|
240
250
|
})) {
|
|
241
|
-
|
|
251
|
+
v.splice(v.findIndex(function (v) {
|
|
242
252
|
return v === item[fieldNames.value];
|
|
243
253
|
}), 1);
|
|
244
254
|
} else {
|
|
245
|
-
|
|
255
|
+
v.push(item[fieldNames.value]);
|
|
246
256
|
}
|
|
247
|
-
setValue(_toConsumableArray(
|
|
257
|
+
setValue(_toConsumableArray(v));
|
|
248
258
|
} else {
|
|
249
259
|
onOpenChange();
|
|
250
260
|
_onChange === null || _onChange === void 0 || _onChange(item[fieldNames.value]);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useState } from "react";
|
|
8
|
+
import { Input, Text } from "@tarojs/components";
|
|
9
|
+
import ProFormField from "../../Field";
|
|
10
|
+
import "./index.less";
|
|
11
|
+
var ProFormText = function ProFormText(props) {
|
|
12
|
+
var _props$placeholder = props.placeholder,
|
|
13
|
+
placeholder = _props$placeholder === void 0 ? "请输入" : _props$placeholder,
|
|
14
|
+
onChange = props.onChange,
|
|
15
|
+
_props$maxLength = props.maxLength,
|
|
16
|
+
maxLength = _props$maxLength === void 0 ? -1 : _props$maxLength,
|
|
17
|
+
_props$inputType = props.inputType,
|
|
18
|
+
inputType = _props$inputType === void 0 ? "text" : _props$inputType,
|
|
19
|
+
disabled = props.disabled,
|
|
20
|
+
value = props.value;
|
|
21
|
+
var _useState = useState(value),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
inputValue = _useState2[0],
|
|
24
|
+
setInputValue = _useState2[1];
|
|
25
|
+
useEffect(function () {
|
|
26
|
+
if (value !== inputValue) setInputValue(value);
|
|
27
|
+
}, [value]);
|
|
28
|
+
return /*#__PURE__*/React.createElement(ProFormField, props, disabled ? /*#__PURE__*/React.createElement(Text, {
|
|
29
|
+
className: "p-pro-form-item-control-disabled"
|
|
30
|
+
}, value || "-") : /*#__PURE__*/React.createElement(Input, {
|
|
31
|
+
placeholder: placeholder,
|
|
32
|
+
className: "p-pro-form-item-input",
|
|
33
|
+
placeholderClass: "p-pro-form-item-placeholder",
|
|
34
|
+
onInput: function onInput(e) {
|
|
35
|
+
return setInputValue(e.detail.value);
|
|
36
|
+
},
|
|
37
|
+
maxlength: maxLength,
|
|
38
|
+
type: inputType,
|
|
39
|
+
value: inputValue,
|
|
40
|
+
onBlur: function onBlur() {
|
|
41
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
export default ProFormText;
|
|
@@ -5,7 +5,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
5
5
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
6
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
-
import React, { Fragment, useState } from "react";
|
|
8
|
+
import React, { Fragment, useEffect, useState } from "react";
|
|
9
9
|
import { Text, Textarea, View } from "@tarojs/components";
|
|
10
10
|
import ProFormField from "../../Field";
|
|
11
11
|
import "./index.less";
|
|
@@ -22,19 +22,29 @@ var ProFormTextArea = function ProFormTextArea(props) {
|
|
|
22
22
|
_useState2 = _slicedToArray(_useState, 2),
|
|
23
23
|
show = _useState2[0],
|
|
24
24
|
setShow = _useState2[1];
|
|
25
|
+
var _useState3 = useState(value),
|
|
26
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
27
|
+
inputValue = _useState4[0],
|
|
28
|
+
setInputValue = _useState4[1];
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
if (value !== inputValue) setInputValue(value);
|
|
31
|
+
}, [value]);
|
|
25
32
|
return /*#__PURE__*/React.createElement(ProFormField, _extends({}, props, {
|
|
26
33
|
layout: "vertical"
|
|
27
34
|
}), disabled ? /*#__PURE__*/React.createElement(Text, {
|
|
28
35
|
className: "p-pro-form-item-control-disabled"
|
|
29
36
|
}, value || "-") : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Textarea, {
|
|
30
|
-
value:
|
|
37
|
+
value: inputValue,
|
|
31
38
|
placeholder: placeholder,
|
|
32
39
|
className: "p-pro-form-item-textarea",
|
|
33
40
|
placeholderClass: "p-pro-form-item-placeholder",
|
|
34
41
|
onInput: function onInput(e) {
|
|
35
|
-
return
|
|
42
|
+
return setInputValue(e.detail.value);
|
|
36
43
|
},
|
|
37
|
-
maxlength: maxLength
|
|
44
|
+
maxlength: maxLength,
|
|
45
|
+
onBlur: function onBlur() {
|
|
46
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
|
|
47
|
+
}
|
|
38
48
|
}), recommend && /*#__PURE__*/React.createElement(View, {
|
|
39
49
|
className: "p-pro-form-item-textarea-recommend-container"
|
|
40
50
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -44,7 +44,11 @@ var ProFormUpload = function ProFormUpload(props) {
|
|
|
44
44
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
45
45
|
url = _useState6[0],
|
|
46
46
|
setUrl = _useState6[1];
|
|
47
|
-
var _useState7 = useState(value
|
|
47
|
+
var _useState7 = useState(value ? value.map(function (item) {
|
|
48
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
49
|
+
percent: 100
|
|
50
|
+
});
|
|
51
|
+
}) : []),
|
|
48
52
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
49
53
|
fileList = _useState8[0],
|
|
50
54
|
setFileList = _useState8[1];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { FC, ReactElement } from "react";
|
|
1
|
+
import { FC, ReactElement, ReactNode } from "react";
|
|
2
2
|
import "./index.less";
|
|
3
3
|
type ProFormFieldProps = ProFormAPI.ProFormItemProps & {
|
|
4
|
+
label?: string | ReactNode;
|
|
4
5
|
extra?: ReactElement | false;
|
|
5
6
|
children: ReactElement;
|
|
6
7
|
};
|
|
@@ -24,7 +24,7 @@ var ProFormField = function ProFormField(props) {
|
|
|
24
24
|
return r.required;
|
|
25
25
|
})) && /*#__PURE__*/React.createElement(Text, {
|
|
26
26
|
className: "p-pro-form-item-label-required"
|
|
27
|
-
}, "*"), /*#__PURE__*/React.createElement(
|
|
27
|
+
}, "*"), /*#__PURE__*/React.createElement(View, {
|
|
28
28
|
className: "p-pro-form-item-label-text"
|
|
29
29
|
}, label)), extra), /*#__PURE__*/React.createElement(View, {
|
|
30
30
|
className: "p-pro-form-item-control"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
import "./index.less";
|
|
3
|
-
|
|
4
|
-
children
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export default
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<ProFormAPI.ProFormProps & {
|
|
4
|
+
children: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
|
|
5
|
+
footer?: React.ReactNode;
|
|
6
|
+
} & React.RefAttributes<unknown>>;
|
|
7
|
+
export default _default;
|