@power-xa/m-ui 0.0.4 → 0.0.6
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/README.md +12 -1
- package/dist/CreatorEdit/index.d.ts +1 -0
- package/dist/CreatorEdit/index.js +16 -1
- package/dist/Popup/index.d.ts +8 -1
- package/dist/Popup/index.js +29 -4
- package/dist/Popup/index.less +32 -0
- package/dist/ProForm/Controls/List/index.d.ts +4 -1
- package/dist/ProForm/Controls/List/index.js +24 -13
- package/dist/ProForm/Controls/Select/index.d.ts +8 -2
- package/dist/ProForm/Controls/Select/index.js +16 -21
- package/dist/ProForm/Controls/Select/index.less +2 -29
- package/dist/ProForm/Controls/Upload/index.d.ts +7 -1
- package/dist/ProForm/Controls/Upload/index.js +49 -19
- package/dist/ProForm/Form/index.js +29 -19
- package/dist/ProForm/Group/index.js +6 -6
- package/dist/ProForm/index.d.ts +2 -0
- package/dist/ProForm/index.js +2 -0
- package/dist/ProList/index.d.ts +3 -0
- package/dist/ProList/index.js +58 -7
- package/dist/Tabs/index.d.ts +3 -3
- package/dist/Tabs/index.js +16 -3
- package/dist/services/FileController/index.d.ts +5 -0
- package/dist/services/FileController/index.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,4 +23,15 @@
|
|
|
23
23
|
# 0.0.4
|
|
24
24
|
1.Tabs修改(子组件内容更新后未重新渲染)
|
|
25
25
|
2.PageContainer增加footer属性,可自定义底部内容
|
|
26
|
-
3.Filter Children属性修改
|
|
26
|
+
3.Filter Children属性修改
|
|
27
|
+
|
|
28
|
+
# 0.0.5
|
|
29
|
+
ProFormUpload/ProList 增加文件预览
|
|
30
|
+
|
|
31
|
+
# 0.0.6
|
|
32
|
+
1.CreatorEdit 增加 companyUserId 参数
|
|
33
|
+
2.Popup 组件增加默认头部,可自定义头部内容
|
|
34
|
+
3.ProFormField 组件暴露
|
|
35
|
+
4.ProFormList组件优化
|
|
36
|
+
5.ProFormSelect 内部Popup增加扩展内容
|
|
37
|
+
6.Tabs组件增加ref属性,可通过ref刷新指定Tab
|
|
@@ -12,6 +12,7 @@ import { FileController } from "../services";
|
|
|
12
12
|
import "./index.less";
|
|
13
13
|
var CreatorEdit = function CreatorEdit(_ref) {
|
|
14
14
|
var id = _ref.id,
|
|
15
|
+
companyUserId = _ref.companyUserId,
|
|
15
16
|
memberId = _ref.memberId,
|
|
16
17
|
name = _ref.name,
|
|
17
18
|
avatar = _ref.avatar,
|
|
@@ -33,6 +34,11 @@ var CreatorEdit = function CreatorEdit(_ref) {
|
|
|
33
34
|
getUserAvatar();
|
|
34
35
|
}
|
|
35
36
|
}, [avatar, id]);
|
|
37
|
+
useEffect(function () {
|
|
38
|
+
if (!avatar && companyUserId) {
|
|
39
|
+
getCompanyUserAvatar();
|
|
40
|
+
}
|
|
41
|
+
}, [avatar, companyUserId]);
|
|
36
42
|
var getUserAvatar = useCallback(function () {
|
|
37
43
|
FileController.getUserAvatar({
|
|
38
44
|
ids: [id]
|
|
@@ -42,6 +48,15 @@ var CreatorEdit = function CreatorEdit(_ref) {
|
|
|
42
48
|
}
|
|
43
49
|
});
|
|
44
50
|
}, [id]);
|
|
51
|
+
var getCompanyUserAvatar = useCallback(function () {
|
|
52
|
+
FileController.getCompanyUserAvatar({
|
|
53
|
+
ids: [companyUserId]
|
|
54
|
+
}).then(function (result) {
|
|
55
|
+
if (result.code === 200) {
|
|
56
|
+
setImageUrl(result.data[0] || (src === null || src === void 0 ? void 0 : src.resource) + "/images/default/avatar.svg");
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}, [companyUserId]);
|
|
45
60
|
var getProjectMemberAvatar = useCallback(function () {
|
|
46
61
|
FileController.getProjectMemberAvatar({
|
|
47
62
|
ids: [memberId]
|
|
@@ -53,7 +68,7 @@ var CreatorEdit = function CreatorEdit(_ref) {
|
|
|
53
68
|
}, [memberId]);
|
|
54
69
|
return /*#__PURE__*/React.createElement(View, {
|
|
55
70
|
className: "p-creator-edit-container",
|
|
56
|
-
key: id || memberId
|
|
71
|
+
key: id || memberId || companyUserId
|
|
57
72
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
58
73
|
src: imageUrl,
|
|
59
74
|
className: "avatar"
|
package/dist/Popup/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC, ReactElement } from "react";
|
|
1
|
+
import { FC, ReactElement, ReactNode } from "react";
|
|
2
2
|
import "./index.less";
|
|
3
3
|
type PopupProps = {
|
|
4
4
|
open?: boolean;
|
|
@@ -8,6 +8,13 @@ type PopupProps = {
|
|
|
8
8
|
onOpenChange: () => void;
|
|
9
9
|
}) => ReactElement) | ReactElement;
|
|
10
10
|
height?: number;
|
|
11
|
+
header?: {
|
|
12
|
+
title?: string;
|
|
13
|
+
extra?: {
|
|
14
|
+
left?: ReactNode;
|
|
15
|
+
right?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
} | false;
|
|
11
18
|
};
|
|
12
19
|
declare const Popup: FC<PopupProps>;
|
|
13
20
|
export default Popup;
|
package/dist/Popup/index.js
CHANGED
|
@@ -6,15 +6,17 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import React, { useEffect, useState } from "react";
|
|
8
8
|
import { getWindowInfo } from "@tarojs/taro";
|
|
9
|
-
import { RootPortal, View } from "@tarojs/components";
|
|
9
|
+
import { RootPortal, Text, View } from "@tarojs/components";
|
|
10
10
|
import "./index.less";
|
|
11
11
|
var Popup = function Popup(_ref) {
|
|
12
|
+
var _header$extra, _header$extra2;
|
|
12
13
|
var open = _ref.open,
|
|
13
14
|
onOpenChange = _ref.onOpenChange,
|
|
14
15
|
rootClassName = _ref.rootClassName,
|
|
15
16
|
children = _ref.children,
|
|
16
17
|
_ref$height = _ref.height,
|
|
17
|
-
height = _ref$height === void 0 ? 85 : _ref$height
|
|
18
|
+
height = _ref$height === void 0 ? 85 : _ref$height,
|
|
19
|
+
header = _ref.header;
|
|
18
20
|
var _getWindowInfo = getWindowInfo(),
|
|
19
21
|
safeArea = _getWindowInfo.safeArea;
|
|
20
22
|
var _ref2 = safeArea,
|
|
@@ -45,7 +47,12 @@ var Popup = function Popup(_ref) {
|
|
|
45
47
|
useEffect(function () {
|
|
46
48
|
setTransform(show ? "translateY(".concat(100 - height, "vh)") : "translateY(100vh)");
|
|
47
49
|
}, [show]);
|
|
48
|
-
return /*#__PURE__*/React.createElement(RootPortal,
|
|
50
|
+
return /*#__PURE__*/React.createElement(RootPortal, {
|
|
51
|
+
style: {
|
|
52
|
+
display: open ? "block" : "none",
|
|
53
|
+
position: "fixed"
|
|
54
|
+
}
|
|
55
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
49
56
|
className: "p-popup-mask ".concat(rootClassName),
|
|
50
57
|
style: {
|
|
51
58
|
display: open ? "block" : "none"
|
|
@@ -63,7 +70,25 @@ var Popup = function Popup(_ref) {
|
|
|
63
70
|
onClick: function onClick(e) {
|
|
64
71
|
return e.stopPropagation();
|
|
65
72
|
}
|
|
66
|
-
},
|
|
73
|
+
}, header && /*#__PURE__*/React.createElement(View, {
|
|
74
|
+
className: "p-popup-header"
|
|
75
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
76
|
+
className: "p-popup-header-extra left",
|
|
77
|
+
onTap: function onTap() {
|
|
78
|
+
return setShow(false);
|
|
79
|
+
}
|
|
80
|
+
}, ((_header$extra = header.extra) === null || _header$extra === void 0 ? void 0 : _header$extra.left) || /*#__PURE__*/React.createElement(View, {
|
|
81
|
+
className: "iconfont icon-icon-psp-guanbi"
|
|
82
|
+
})), header.title && /*#__PURE__*/React.createElement(Text, {
|
|
83
|
+
className: "p-popup-header-title"
|
|
84
|
+
}, header.title), /*#__PURE__*/React.createElement(View, {
|
|
85
|
+
className: "p-popup-header-extra right",
|
|
86
|
+
onTap: function onTap() {
|
|
87
|
+
return setShow(false);
|
|
88
|
+
}
|
|
89
|
+
}, ((_header$extra2 = header.extra) === null || _header$extra2 === void 0 ? void 0 : _header$extra2.right) || /*#__PURE__*/React.createElement(View, {
|
|
90
|
+
className: "iconfont "
|
|
91
|
+
}))), typeof children === "function" ? children === null || children === void 0 ? void 0 : children({
|
|
67
92
|
onOpenChange: function onOpenChange() {
|
|
68
93
|
return setShow(false);
|
|
69
94
|
}
|
package/dist/Popup/index.less
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import "@power-xa/m-ui/dist/assets/less/mixins.less";
|
|
2
|
+
|
|
1
3
|
.p-popup-mask {
|
|
2
4
|
position: fixed;
|
|
3
5
|
top: 0;
|
|
@@ -19,5 +21,35 @@
|
|
|
19
21
|
flex-direction: column;
|
|
20
22
|
box-sizing: border-box;
|
|
21
23
|
border-radius: 32px 32px 0 0;
|
|
24
|
+
|
|
25
|
+
.p-popup-header {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
padding: 34px 32px;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
|
|
31
|
+
.p-popup-header-extra {
|
|
32
|
+
flex: 1;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
|
|
36
|
+
.iconfont {
|
|
37
|
+
font-size: 24px;
|
|
38
|
+
color: #333437;
|
|
39
|
+
padding: 8px 12px;
|
|
40
|
+
width: max-content;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.right {
|
|
44
|
+
justify-content: flex-end;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.p-popup-header-title {
|
|
49
|
+
flex: 5;
|
|
50
|
+
text-align: center;
|
|
51
|
+
.font(32, #333437, Regular, 500)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
22
54
|
}
|
|
23
55
|
}
|
|
@@ -9,10 +9,13 @@ type ProFormListProps = ProFormAPI.ProFormItemProps & {
|
|
|
9
9
|
extra?: ReactElement;
|
|
10
10
|
children?: (record: {
|
|
11
11
|
[key: string]: any;
|
|
12
|
-
}, option: OptionType) => ReactElement;
|
|
12
|
+
}, option: OptionType, index?: number) => ReactElement;
|
|
13
13
|
record?: {
|
|
14
14
|
[key: string]: any;
|
|
15
15
|
};
|
|
16
|
+
onAdd?: (value: {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}[], add: () => void) => void;
|
|
16
19
|
listProps?: ProListProps & {
|
|
17
20
|
onAdd?: (onChange: (value: {
|
|
18
21
|
[key: string]: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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"];
|
|
2
|
+
var _excluded = ["extra", "children", "listProps", "record", "onAdd"];
|
|
3
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
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
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; }
|
|
@@ -19,31 +19,35 @@ var ProFormList = function ProFormList(_ref) {
|
|
|
19
19
|
children = _ref.children,
|
|
20
20
|
listProps = _ref.listProps,
|
|
21
21
|
record = _ref.record,
|
|
22
|
+
onAdd = _ref.onAdd,
|
|
22
23
|
fieldProps = _objectWithoutProperties(_ref, _excluded);
|
|
23
24
|
var disabled = fieldProps.disabled,
|
|
24
25
|
_fieldProps$value = fieldProps.value,
|
|
25
26
|
value = _fieldProps$value === void 0 ? [] : _fieldProps$value,
|
|
26
27
|
onChange = fieldProps.onChange;
|
|
27
28
|
var renderListContent = useCallback(function (element, index) {
|
|
28
|
-
var _element$props, _element$
|
|
29
|
-
if (
|
|
29
|
+
var _element$props, _element$props3;
|
|
30
|
+
if (!element) return null;
|
|
31
|
+
if (element !== null && element !== void 0 && (_element$props = element.props) !== null && _element$props !== void 0 && _element$props.name) {
|
|
30
32
|
return /*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread({}, element.props), {}, {
|
|
31
33
|
disabled: fieldProps.disabled || element.props.disabled,
|
|
32
34
|
value: getObjectPathValue(element.props.name, value[index]),
|
|
33
35
|
onChange: function onChange(result) {
|
|
34
|
-
|
|
36
|
+
var _element$props$onChan, _element$props2;
|
|
37
|
+
(_element$props$onChan = (_element$props2 = element.props).onChange) === null || _element$props$onChan === void 0 || _element$props$onChan.call(_element$props2, result);
|
|
38
|
+
setObjectPathValue(element.props.name, result, value[index]);
|
|
35
39
|
}
|
|
36
40
|
}));
|
|
37
41
|
}
|
|
38
|
-
if ((_element$
|
|
39
|
-
return /*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread({}, element), {}, {
|
|
42
|
+
if (element !== null && element !== void 0 && (_element$props3 = element.props) !== null && _element$props3 !== void 0 && _element$props3.children) {
|
|
43
|
+
return /*#__PURE__*/cloneElement(element, _objectSpread(_objectSpread({}, element.props), {}, {
|
|
40
44
|
children: Array.from(element.props.children).map(function (item) {
|
|
41
45
|
return renderListContent(item, index);
|
|
42
46
|
})
|
|
43
47
|
}));
|
|
44
48
|
}
|
|
45
49
|
return element;
|
|
46
|
-
}, [value]);
|
|
50
|
+
}, [value, disabled]);
|
|
47
51
|
var getShowEdit = useCallback(function (value) {
|
|
48
52
|
var _listProps$meta;
|
|
49
53
|
if (typeof (listProps === null || listProps === void 0 || (_listProps$meta = listProps.meta) === null || _listProps$meta === void 0 ? void 0 : _listProps$meta.footer) !== "boolean") {
|
|
@@ -63,8 +67,15 @@ var ProFormList = function ProFormList(_ref) {
|
|
|
63
67
|
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
68
|
return onChange === null || onChange === void 0 ? void 0 : onChange(data instanceof Array ? data : value.concat([data]));
|
|
65
69
|
}, value);
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
if (onAdd) {
|
|
71
|
+
onAdd === null || onAdd === void 0 || onAdd(value, function () {
|
|
72
|
+
value.push(_objectSpread({}, record));
|
|
73
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
value.push(_objectSpread({}, record));
|
|
77
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
78
|
+
}
|
|
68
79
|
}
|
|
69
80
|
}, extra || /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
70
81
|
className: "iconfont icon-icon-psp-xinjian"
|
|
@@ -73,8 +84,8 @@ var ProFormList = function ProFormList(_ref) {
|
|
|
73
84
|
}, "\u6DFB\u52A0")))
|
|
74
85
|
}), children ? /*#__PURE__*/React.createElement(View, {
|
|
75
86
|
className: "p-pro-form-item-list-container"
|
|
76
|
-
}, value.map(function (_, i) {
|
|
77
|
-
var element = children(
|
|
87
|
+
}, value && value.length ? value.map(function (_, i) {
|
|
88
|
+
var element = children(_, {
|
|
78
89
|
add: function add() {
|
|
79
90
|
value.push(_objectSpread({}, record));
|
|
80
91
|
onChange === null || onChange === void 0 || onChange(value);
|
|
@@ -83,12 +94,12 @@ var ProFormList = function ProFormList(_ref) {
|
|
|
83
94
|
value.splice(i, 1);
|
|
84
95
|
onChange === null || onChange === void 0 || onChange(value);
|
|
85
96
|
}
|
|
86
|
-
});
|
|
97
|
+
}, i);
|
|
87
98
|
return /*#__PURE__*/React.createElement(View, {
|
|
88
99
|
key: getUUID(),
|
|
89
100
|
className: "p-pro-form-item-list-content"
|
|
90
101
|
}, renderListContent(element, i));
|
|
91
|
-
})) : listProps ? /*#__PURE__*/React.createElement(ProList, _extends({}, listProps, {
|
|
102
|
+
}) : null) : listProps ? /*#__PURE__*/React.createElement(ProList, _extends({}, listProps, {
|
|
92
103
|
dataSources: value || [],
|
|
93
104
|
scrollable: false,
|
|
94
105
|
className: "p-pro-list-view-container",
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
2
|
import "./index.less";
|
|
3
|
-
|
|
3
|
+
type ProFormSelectProps = ProFormAPI.ProFormItemProps & {
|
|
4
|
+
popupExtra?: {
|
|
5
|
+
top?: ReactNode;
|
|
6
|
+
bottom?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
declare const ProFormSelect: FC<ProFormSelectProps>;
|
|
4
10
|
export default ProFormSelect;
|
|
@@ -42,7 +42,8 @@ var ProFormSelect = function ProFormSelect(props) {
|
|
|
42
42
|
projectId = props.projectId,
|
|
43
43
|
companyId = props.companyId,
|
|
44
44
|
source = props.source,
|
|
45
|
-
disabled = props.disabled
|
|
45
|
+
disabled = props.disabled,
|
|
46
|
+
popupExtra = props.popupExtra;
|
|
46
47
|
var _useState = useState([]),
|
|
47
48
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
49
|
options = _useState2[0],
|
|
@@ -204,27 +205,21 @@ var ProFormSelect = function ProFormSelect(props) {
|
|
|
204
205
|
onOpenChange: function onOpenChange(open) {
|
|
205
206
|
return setOpen(open);
|
|
206
207
|
},
|
|
207
|
-
rootClassName: "p-pro-form-item-select-popup-container"
|
|
208
|
+
rootClassName: "p-pro-form-item-select-popup-container",
|
|
209
|
+
header: {
|
|
210
|
+
title: label,
|
|
211
|
+
extra: {
|
|
212
|
+
right: multiple && /*#__PURE__*/React.createElement(Text, {
|
|
213
|
+
className: "text",
|
|
214
|
+
onClick: function onClick() {
|
|
215
|
+
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(value);
|
|
216
|
+
}
|
|
217
|
+
}, "\u786E\u5B9A")
|
|
218
|
+
}
|
|
219
|
+
}
|
|
208
220
|
}, function (_ref) {
|
|
209
221
|
var onOpenChange = _ref.onOpenChange;
|
|
210
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(
|
|
211
|
-
className: "p-pro-form-item-select-popup-header"
|
|
212
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
213
|
-
className: "extra-content left"
|
|
214
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
215
|
-
className: "iconfont icon-icon-psp-guanbi",
|
|
216
|
-
onTap: onOpenChange
|
|
217
|
-
})), /*#__PURE__*/React.createElement(Text, {
|
|
218
|
-
className: "title"
|
|
219
|
-
}, label), /*#__PURE__*/React.createElement(View, {
|
|
220
|
-
className: "extra-content right"
|
|
221
|
-
}, multiple && /*#__PURE__*/React.createElement(Text, {
|
|
222
|
-
className: "text",
|
|
223
|
-
onClick: function onClick() {
|
|
224
|
-
onOpenChange();
|
|
225
|
-
_onChange === null || _onChange === void 0 || _onChange(value);
|
|
226
|
-
}
|
|
227
|
-
}, "\u786E\u5B9A"))), /*#__PURE__*/React.createElement(SearchInput, {
|
|
222
|
+
return /*#__PURE__*/React.createElement(Fragment, null, popupExtra === null || popupExtra === void 0 ? void 0 : popupExtra.top, /*#__PURE__*/React.createElement(SearchInput, {
|
|
228
223
|
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",
|
|
229
224
|
onSearch: function onSearch(value) {
|
|
230
225
|
var _props$options2;
|
|
@@ -267,7 +262,7 @@ var ProFormSelect = function ProFormSelect(props) {
|
|
|
267
262
|
className: "error-view"
|
|
268
263
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
269
264
|
className: "text"
|
|
270
|
-
}, "\u6682\u65E0\u6570\u636E"))));
|
|
265
|
+
}, "\u6682\u65E0\u6570\u636E"))), popupExtra === null || popupExtra === void 0 ? void 0 : popupExtra.bottom);
|
|
271
266
|
}));
|
|
272
267
|
};
|
|
273
268
|
export default ProFormSelect;
|
|
@@ -44,38 +44,11 @@
|
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.p-
|
|
48
|
-
|
|
49
|
-
align-items: center;
|
|
50
|
-
justify-content: space-between;
|
|
51
|
-
padding: 34px 32px;
|
|
52
|
-
box-sizing: border-box;
|
|
53
|
-
|
|
54
|
-
.extra-content {
|
|
55
|
-
flex: 1;
|
|
56
|
-
display: flex;
|
|
57
|
-
align-items: center;
|
|
58
|
-
|
|
59
|
-
.iconfont {
|
|
60
|
-
font-size: 24px;
|
|
61
|
-
color: #333437;
|
|
62
|
-
padding: 8px 12px;
|
|
63
|
-
width: max-content;
|
|
64
|
-
}
|
|
65
|
-
|
|
47
|
+
.p-popup-header {
|
|
48
|
+
.p-popup-header-extra.right {
|
|
66
49
|
.text {
|
|
67
50
|
.font(28, #333437)
|
|
68
51
|
}
|
|
69
|
-
|
|
70
|
-
&.right {
|
|
71
|
-
justify-content: flex-end;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.title {
|
|
76
|
-
flex: 5;
|
|
77
|
-
text-align: center;
|
|
78
|
-
.font(32, #333437, Regular, 500)
|
|
79
52
|
}
|
|
80
53
|
}
|
|
81
54
|
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import "./index.less";
|
|
3
|
-
|
|
3
|
+
type ProFormUploadProps = ProFormAPI.ProFormItemProps & {
|
|
4
|
+
module?: string;
|
|
5
|
+
userId?: string;
|
|
6
|
+
userName?: string;
|
|
7
|
+
readonly?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const ProFormUpload: FC<ProFormUploadProps>;
|
|
4
10
|
export default ProFormUpload;
|
|
@@ -16,7 +16,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
16
16
|
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; } }
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
18
|
import React, { Fragment, useCallback, useEffect, useRef, useState } from "react";
|
|
19
|
-
import { chooseImage, chooseVideo, chooseMessageFile, uploadFile, previewImage } from "@tarojs/taro";
|
|
19
|
+
import { chooseImage, chooseVideo, chooseMessageFile, uploadFile, previewImage, navigateTo } from "@tarojs/taro";
|
|
20
20
|
import { Image, Text, View } from "@tarojs/components";
|
|
21
21
|
import { clipFileUrl, getFileType, getUUID, Grid, Popup } from "../../..";
|
|
22
22
|
import { useConfig } from "../../../ConfigProvider";
|
|
@@ -29,7 +29,8 @@ var ProFormUpload = function ProFormUpload(props) {
|
|
|
29
29
|
disabled = props.disabled,
|
|
30
30
|
_props$value = props.value,
|
|
31
31
|
value = _props$value === void 0 ? [] : _props$value,
|
|
32
|
-
onChange = props.onChange
|
|
32
|
+
onChange = props.onChange,
|
|
33
|
+
maxLength = props.maxLength;
|
|
33
34
|
var _useConfig = useConfig(),
|
|
34
35
|
src = _useConfig.src;
|
|
35
36
|
var _useState = useState(false),
|
|
@@ -63,9 +64,9 @@ var ProFormUpload = function ProFormUpload(props) {
|
|
|
63
64
|
fileList.filter(function (item) {
|
|
64
65
|
return item.percent === 0;
|
|
65
66
|
}).forEach(function (item) {
|
|
66
|
-
upload(item.fullUri, item.fileName);
|
|
67
|
+
return upload(item.fullUri, item.fileName);
|
|
67
68
|
});
|
|
68
|
-
} else {
|
|
69
|
+
} else if (fileList.length) {
|
|
69
70
|
onChange === null || onChange === void 0 || onChange(fileList);
|
|
70
71
|
}
|
|
71
72
|
}, [fileList]);
|
|
@@ -114,7 +115,7 @@ var ProFormUpload = function ProFormUpload(props) {
|
|
|
114
115
|
sourceType: ["camera"],
|
|
115
116
|
success: function success(result) {
|
|
116
117
|
if (result.tempFiles.length) {
|
|
117
|
-
|
|
118
|
+
setFileRefList(result.tempFiles.map(function (item) {
|
|
118
119
|
return {
|
|
119
120
|
percent: 0,
|
|
120
121
|
fullUri: item.path,
|
|
@@ -123,19 +124,18 @@ var ProFormUpload = function ProFormUpload(props) {
|
|
|
123
124
|
})
|
|
124
125
|
};
|
|
125
126
|
}));
|
|
126
|
-
setFileList(fileRef.current);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
}, [url, fileList]);
|
|
131
131
|
var chooseImageAlbum = useCallback(function () {
|
|
132
132
|
chooseImage({
|
|
133
|
-
count: 9,
|
|
133
|
+
count: maxLength || 9,
|
|
134
134
|
sourceType: ["album"],
|
|
135
135
|
sizeType: ['original', 'compressed'],
|
|
136
136
|
success: function success(result) {
|
|
137
137
|
if (result.tempFiles.length) {
|
|
138
|
-
|
|
138
|
+
setFileRefList(result.tempFiles.map(function (item) {
|
|
139
139
|
return {
|
|
140
140
|
percent: 0,
|
|
141
141
|
fullUri: item.path,
|
|
@@ -144,24 +144,22 @@ var ProFormUpload = function ProFormUpload(props) {
|
|
|
144
144
|
})
|
|
145
145
|
};
|
|
146
146
|
}));
|
|
147
|
-
setFileList(fileRef.current);
|
|
148
147
|
}
|
|
149
148
|
}
|
|
150
149
|
});
|
|
151
|
-
}, [url, fileList]);
|
|
150
|
+
}, [url, fileList, maxLength]);
|
|
152
151
|
var takeVideo = useCallback(function () {
|
|
153
152
|
chooseVideo({
|
|
154
153
|
sourceType: ["camera"],
|
|
155
154
|
success: function success(result) {
|
|
156
155
|
if (result.tempFilePath) {
|
|
157
|
-
|
|
156
|
+
setFileRefList([{
|
|
158
157
|
fullUri: result.tempFilePath,
|
|
159
158
|
percent: 0,
|
|
160
159
|
fileType: getFileType({
|
|
161
160
|
name: result.tempFilePath
|
|
162
161
|
})
|
|
163
162
|
}]);
|
|
164
|
-
setFileList(fileRef.current);
|
|
165
163
|
}
|
|
166
164
|
}
|
|
167
165
|
});
|
|
@@ -171,24 +169,23 @@ var ProFormUpload = function ProFormUpload(props) {
|
|
|
171
169
|
sourceType: ["album"],
|
|
172
170
|
success: function success(result) {
|
|
173
171
|
if (result.tempFilePath) {
|
|
174
|
-
|
|
172
|
+
setFileRefList([{
|
|
175
173
|
fullUri: result.tempFilePath,
|
|
176
174
|
percent: 0,
|
|
177
175
|
fileType: getFileType({
|
|
178
176
|
name: result.tempFilePath
|
|
179
177
|
})
|
|
180
178
|
}]);
|
|
181
|
-
setFileList(fileRef.current);
|
|
182
179
|
}
|
|
183
180
|
}
|
|
184
181
|
});
|
|
185
182
|
}, [url, fileList]);
|
|
186
183
|
var chooseFile = useCallback(function () {
|
|
187
184
|
chooseMessageFile({
|
|
188
|
-
count: 9,
|
|
185
|
+
count: maxLength || 9,
|
|
189
186
|
success: function success(result) {
|
|
190
187
|
if (result.tempFiles.length) {
|
|
191
|
-
|
|
188
|
+
setFileRefList(result.tempFiles.map(function (item) {
|
|
192
189
|
return {
|
|
193
190
|
fileName: item.name,
|
|
194
191
|
fullUri: item.path,
|
|
@@ -199,11 +196,16 @@ var ProFormUpload = function ProFormUpload(props) {
|
|
|
199
196
|
})
|
|
200
197
|
};
|
|
201
198
|
}));
|
|
202
|
-
setFileList(fileRef.current);
|
|
203
199
|
}
|
|
204
200
|
}
|
|
205
201
|
});
|
|
206
|
-
}, [url, fileList]);
|
|
202
|
+
}, [url, fileList, maxLength]);
|
|
203
|
+
var setFileRefList = useCallback(function (result) {
|
|
204
|
+
var list = _toConsumableArray(fileList).concat(result);
|
|
205
|
+
if (maxLength && list.length > maxLength) list = list.splice(list.length - maxLength);
|
|
206
|
+
fileRef.current = list;
|
|
207
|
+
setFileList(fileRef.current);
|
|
208
|
+
}, [fileList, maxLength]);
|
|
207
209
|
var upload = useCallback(function (fileUrl, fileName) {
|
|
208
210
|
var ext = fileUrl.substring(fileUrl.lastIndexOf("."));
|
|
209
211
|
FileController.getOSSConfig(src === null || src === void 0 ? void 0 : src.oss, ext).then(function (result) {
|
|
@@ -308,7 +310,35 @@ var ProFormUpload = function ProFormUpload(props) {
|
|
|
308
310
|
return /*#__PURE__*/React.createElement(View, {
|
|
309
311
|
className: "p-pro-form-item-file",
|
|
310
312
|
key: "file-" + index,
|
|
311
|
-
onTap: function onTap() {
|
|
313
|
+
onTap: function onTap() {
|
|
314
|
+
if (item.fileType === "Pic") {
|
|
315
|
+
previewImage({
|
|
316
|
+
urls: fileList.filter(function (item) {
|
|
317
|
+
return item.fileType === "Pic";
|
|
318
|
+
}).map(function (item) {
|
|
319
|
+
return item.fullUri;
|
|
320
|
+
}),
|
|
321
|
+
current: item.fullUri
|
|
322
|
+
});
|
|
323
|
+
} else {
|
|
324
|
+
navigateTo({
|
|
325
|
+
url: "/screens/common/preview/index",
|
|
326
|
+
success: function success(result) {
|
|
327
|
+
result.eventChannel.emit("getPreviewParams", {
|
|
328
|
+
fileId: item.id,
|
|
329
|
+
fileName: item.fileName,
|
|
330
|
+
fileType: item.fileType,
|
|
331
|
+
fileUri: item.uri,
|
|
332
|
+
fullUrl: item.fullUri,
|
|
333
|
+
module: props.module,
|
|
334
|
+
userId: props.userId,
|
|
335
|
+
userName: props.userName,
|
|
336
|
+
readonly: props.readonly || true
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
312
342
|
}, item.fileType === "Pic" && item.fullUri ? /*#__PURE__*/React.createElement(Image, {
|
|
313
343
|
src: item.fullUri,
|
|
314
344
|
className: "image",
|
|
@@ -46,47 +46,56 @@ var ProForm = function ProForm(_ref, ref) {
|
|
|
46
46
|
};
|
|
47
47
|
});
|
|
48
48
|
var getProFormListControlsList = useCallback(function (el, name, i, list) {
|
|
49
|
-
if (el.props) {
|
|
50
|
-
|
|
49
|
+
if (el !== null && el !== void 0 && el.props) {
|
|
50
|
+
var _el$props;
|
|
51
|
+
if ((_el$props = el.props) !== null && _el$props !== void 0 && _el$props.name) {
|
|
52
|
+
var _el$props2;
|
|
51
53
|
list.push( /*#__PURE__*/cloneElement(el, _objectSpread(_objectSpread({}, el.props), {}, {
|
|
52
|
-
value: getObjectPathValue(el.props.name, form[name][i])
|
|
54
|
+
value: getObjectPathValue((_el$props2 = el.props) === null || _el$props2 === void 0 ? void 0 : _el$props2.name, form[name][i])
|
|
53
55
|
})));
|
|
54
56
|
} else {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
var _el$props3;
|
|
58
|
+
if (((_el$props3 = el.props) === null || _el$props3 === void 0 ? void 0 : _el$props3.children) instanceof Array) {
|
|
59
|
+
var _el$props4;
|
|
60
|
+
(_el$props4 = el.props) === null || _el$props4 === void 0 || _el$props4.children.map(function (item) {
|
|
57
61
|
return getProFormListControlsList(item, name, i, list);
|
|
58
62
|
});
|
|
59
63
|
} else {
|
|
60
|
-
|
|
64
|
+
var _el$props5;
|
|
65
|
+
getProFormListControlsList((_el$props5 = el.props) === null || _el$props5 === void 0 ? void 0 : _el$props5.children, name, i, list);
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
}, [form]);
|
|
65
70
|
var getControlsList = useCallback(function (list) {
|
|
66
71
|
return list.map(function (item) {
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
var _item$props, _item$props12, _item$props13, _item$props14;
|
|
73
|
+
if ((_item$props = item.props) !== null && _item$props !== void 0 && _item$props.children) {
|
|
74
|
+
var _item$props2, _item$props3, _item$props4, _item$props9, _item$props10, _item$props11;
|
|
75
|
+
if (((_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.children) instanceof Array) return getControlsList((_item$props3 = item.props) === null || _item$props3 === void 0 ? void 0 : _item$props3.children.map(function (e) {
|
|
76
|
+
var _e$props;
|
|
69
77
|
return /*#__PURE__*/cloneElement(e, _objectSpread(_objectSpread({}, e.props), {}, {
|
|
70
|
-
value: getObjectPathValue(e.props.name, form)
|
|
78
|
+
value: getObjectPathValue((_e$props = e.props) === null || _e$props === void 0 ? void 0 : _e$props.name, form)
|
|
71
79
|
}));
|
|
72
80
|
}));
|
|
73
|
-
if (item.props.children instanceof Function) {
|
|
74
|
-
var _form$item$props$name;
|
|
81
|
+
if (((_item$props4 = item.props) === null || _item$props4 === void 0 ? void 0 : _item$props4.children) instanceof Function) {
|
|
82
|
+
var _form$item$props$name, _item$props5, _item$props8;
|
|
75
83
|
var _list = [];
|
|
76
|
-
(_form$item$props$name = form[item.props.name]) === null || _form$item$props$name === void 0 || _form$item$props$name.map(function (e, i) {
|
|
77
|
-
|
|
84
|
+
(_form$item$props$name = form[(_item$props5 = item.props) === null || _item$props5 === void 0 ? void 0 : _item$props5.name]) === null || _form$item$props$name === void 0 || _form$item$props$name.map(function (e, i) {
|
|
85
|
+
var _item$props6, _item$props7;
|
|
86
|
+
return getProFormListControlsList((_item$props6 = item.props) === null || _item$props6 === void 0 ? void 0 : _item$props6.children({}, {}, i), (_item$props7 = item.props) === null || _item$props7 === void 0 ? void 0 : _item$props7.name, i, _list);
|
|
78
87
|
});
|
|
79
88
|
return getControlsList([/*#__PURE__*/cloneElement(item, _objectSpread(_objectSpread({}, item.props), {}, {
|
|
80
89
|
children: null,
|
|
81
|
-
value: getObjectPathValue(item.props.name, form)
|
|
90
|
+
value: getObjectPathValue((_item$props8 = item.props) === null || _item$props8 === void 0 ? void 0 : _item$props8.name, form)
|
|
82
91
|
}))].concat(_list));
|
|
83
92
|
}
|
|
84
|
-
return getControlsList([/*#__PURE__*/cloneElement(item.props.children, _objectSpread(_objectSpread({}, item.props.children.props), {}, {
|
|
85
|
-
value: getObjectPathValue(item.props.name, form)
|
|
93
|
+
return getControlsList([/*#__PURE__*/cloneElement((_item$props9 = item.props) === null || _item$props9 === void 0 ? void 0 : _item$props9.children, _objectSpread(_objectSpread({}, (_item$props10 = item.props) === null || _item$props10 === void 0 ? void 0 : _item$props10.children.props), {}, {
|
|
94
|
+
value: getObjectPathValue((_item$props11 = item.props) === null || _item$props11 === void 0 ? void 0 : _item$props11.name, form)
|
|
86
95
|
}))]);
|
|
87
96
|
}
|
|
88
97
|
return /*#__PURE__*/cloneElement(item, _objectSpread(_objectSpread({}, item.props), {}, {
|
|
89
|
-
value: [undefined, null].includes(item.props.value) ? getObjectPathValue(item.props.name, form) : item.props.value
|
|
98
|
+
value: [undefined, null].includes((_item$props12 = item.props) === null || _item$props12 === void 0 ? void 0 : _item$props12.value) ? getObjectPathValue((_item$props13 = item.props) === null || _item$props13 === void 0 ? void 0 : _item$props13.name, form) : (_item$props14 = item.props) === null || _item$props14 === void 0 ? void 0 : _item$props14.value
|
|
90
99
|
}));
|
|
91
100
|
}).flat();
|
|
92
101
|
}, [form]);
|
|
@@ -168,13 +177,14 @@ var ProForm = function ProForm(_ref, ref) {
|
|
|
168
177
|
Promise.all([validFormRequired(formList), validFormRegExp(formList)]).then(function () {
|
|
169
178
|
return onOk === null || onOk === void 0 ? void 0 : onOk(form);
|
|
170
179
|
});
|
|
171
|
-
}, [form]);
|
|
180
|
+
}, [form, children]);
|
|
172
181
|
var renderContent = useCallback(function () {
|
|
173
182
|
var elementList = children instanceof Array ? children : [children];
|
|
174
183
|
return elementList.map(function (e, i) {
|
|
184
|
+
var _e$props2;
|
|
175
185
|
return /*#__PURE__*/cloneElement(e, _objectSpread(_objectSpread({}, e.props), {}, {
|
|
176
186
|
key: 'p-pro-form-group-' + i,
|
|
177
|
-
disabled: disabled || e.props.disabled,
|
|
187
|
+
disabled: disabled || ((_e$props2 = e.props) === null || _e$props2 === void 0 ? void 0 : _e$props2.disabled),
|
|
178
188
|
form: form,
|
|
179
189
|
onChange: function onChange(key, value) {
|
|
180
190
|
return setForm(function (form) {
|
|
@@ -6,7 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
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); }
|
|
7
7
|
import React, { cloneElement, useCallback } from "react";
|
|
8
8
|
import { Text, View } from "@tarojs/components";
|
|
9
|
-
import { getListAssignField, getObjectPathValue } from "../..";
|
|
9
|
+
import { getListAssignField, getObjectPathValue, getUUID } from "../..";
|
|
10
10
|
import "./index.less";
|
|
11
11
|
var ProFormGroup = function ProFormGroup(_ref) {
|
|
12
12
|
var className = _ref.className,
|
|
@@ -20,7 +20,7 @@ var ProFormGroup = function ProFormGroup(_ref) {
|
|
|
20
20
|
var elementList = children instanceof Array ? children : [children];
|
|
21
21
|
return elementList.map(function (e, i) {
|
|
22
22
|
return /*#__PURE__*/cloneElement(e, _objectSpread(_objectSpread({}, e.props), {}, {
|
|
23
|
-
key: e.props.name,
|
|
23
|
+
key: e.props.name || getUUID(),
|
|
24
24
|
className: "".concat(e.props["className"], " ").concat(i === elementList.length - 1 ? 'p-pro-form-item-last' : ""),
|
|
25
25
|
disabled: disabled || e.props.disabled,
|
|
26
26
|
hidden: hidden || e.props.hidden,
|
|
@@ -38,10 +38,10 @@ var ProFormGroup = function ProFormGroup(_ref) {
|
|
|
38
38
|
}, [form, children, disabled, hidden]);
|
|
39
39
|
return /*#__PURE__*/React.createElement(View, {
|
|
40
40
|
className: "p-pro-form-group-container ".concat(className, " ").concat(hidden ? 'hidden' : '')
|
|
41
|
-
}, renderContent(), tag && (form === null || form === void 0 ? void 0 : form[tag.dataIndex]) && /*#__PURE__*/React.createElement(View, {
|
|
41
|
+
}, renderContent(), tag && ![undefined, null].includes(form === null || form === void 0 ? void 0 : form[tag.dataIndex]) && /*#__PURE__*/React.createElement(View, {
|
|
42
42
|
className: "p-pro-form-group-tag ".concat(tag.className || ""),
|
|
43
43
|
style: _objectSpread(_objectSpread({}, tag.position), {}, {
|
|
44
|
-
backgroundColor: getListAssignField(form[tag.dataIndex], tag.map, {
|
|
44
|
+
backgroundColor: getListAssignField(form === null || form === void 0 ? void 0 : form[tag.dataIndex], tag.map, {
|
|
45
45
|
value: "value",
|
|
46
46
|
label: "background"
|
|
47
47
|
})
|
|
@@ -49,11 +49,11 @@ var ProFormGroup = function ProFormGroup(_ref) {
|
|
|
49
49
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
50
50
|
className: "p-pro-form-group-tag-text",
|
|
51
51
|
style: {
|
|
52
|
-
color: getListAssignField(form[tag.dataIndex], tag.map, {
|
|
52
|
+
color: getListAssignField(form === null || form === void 0 ? void 0 : form[tag.dataIndex], tag.map, {
|
|
53
53
|
value: "value",
|
|
54
54
|
label: "color"
|
|
55
55
|
})
|
|
56
56
|
}
|
|
57
|
-
}, getListAssignField(form[tag.dataIndex], tag.map))));
|
|
57
|
+
}, getListAssignField(form === null || form === void 0 ? void 0 : form[tag.dataIndex], tag.map))));
|
|
58
58
|
};
|
|
59
59
|
export default ProFormGroup;
|
package/dist/ProForm/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import OriginProForm from "./Form";
|
|
2
2
|
import ProFormGroup from "./Group";
|
|
3
|
+
import ProFormField from "./Field";
|
|
3
4
|
type ProFormType = typeof OriginProForm & {
|
|
4
5
|
Group: typeof ProFormGroup;
|
|
6
|
+
Field: typeof ProFormField;
|
|
5
7
|
};
|
|
6
8
|
declare const ProForm: ProFormType;
|
|
7
9
|
export default ProForm;
|
package/dist/ProForm/index.js
CHANGED
package/dist/ProList/index.d.ts
CHANGED
package/dist/ProList/index.js
CHANGED
|
@@ -11,6 +11,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11
11
|
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; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
13
|
import React, { forwardRef, Fragment, useCallback, useEffect, useImperativeHandle, useState } from "react";
|
|
14
|
+
import { previewImage, navigateTo } from "@tarojs/taro";
|
|
14
15
|
import { Image, ScrollView, Swiper, SwiperItem, Text, View } from "@tarojs/components";
|
|
15
16
|
import { getListAssignField, getSimplifyDay, Skeleton } from "./..";
|
|
16
17
|
import { useDebounceEffect } from "ahooks";
|
|
@@ -192,7 +193,7 @@ var ProList = function ProList(_ref, ref) {
|
|
|
192
193
|
}, []);
|
|
193
194
|
var renderListContent = useCallback(function () {
|
|
194
195
|
return list.map(function (item, index) {
|
|
195
|
-
var _meta$tag3, _meta$tag4, _meta$tag5, _meta$fileList5, _meta$fileList$render, _meta$fileList6, _meta$fileList7, _item$meta$fileList$d, _meta$title3, _meta$
|
|
196
|
+
var _meta$tag3, _meta$tag4, _meta$tag5, _meta$fileList5, _meta$fileList$render, _meta$fileList6, _meta$fileList7, _item$meta$fileList$d, _meta$title3, _meta$fileList9, _meta$title4, _meta$fileList10, _meta$subTitle3, _meta$subTitle4, _meta$fileList11, _meta$fileList$render2, _meta$fileList12, _meta$fileList13, _meta$footer$creator, _meta$footer$creator2, _meta$footer$creator3, _meta$footer$extra$re, _meta$footer$extra, _meta$footer$extra2;
|
|
196
197
|
var dom = /*#__PURE__*/React.createElement(View, {
|
|
197
198
|
className: "p-pro-list-card-container ".concat(rowClassName),
|
|
198
199
|
onTap: onItem === null || onItem === void 0 ? void 0 : onItem(item).onTap
|
|
@@ -228,12 +229,26 @@ var ProList = function ProList(_ref, ref) {
|
|
|
228
229
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
229
230
|
src: file.fullUri,
|
|
230
231
|
className: "p-pro-list-card-title-swiper-image",
|
|
231
|
-
mode: "aspectFill"
|
|
232
|
+
mode: "aspectFill",
|
|
233
|
+
onTap: function onTap(e) {
|
|
234
|
+
var _meta$fileList8;
|
|
235
|
+
e.stopPropagation();
|
|
236
|
+
if ((_meta$fileList8 = meta.fileList) !== null && _meta$fileList8 !== void 0 && _meta$fileList8.dataIndex) {
|
|
237
|
+
previewImage({
|
|
238
|
+
urls: item[meta.fileList.dataIndex].filter(function (item) {
|
|
239
|
+
return item.fileType === "Pic";
|
|
240
|
+
}).map(function (item) {
|
|
241
|
+
return item.fullUri;
|
|
242
|
+
}),
|
|
243
|
+
current: file.fullUri
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
232
247
|
}));
|
|
233
248
|
}))), meta !== null && meta !== void 0 && (_meta$title3 = meta.title) !== null && _meta$title3 !== void 0 && _meta$title3.render ? /*#__PURE__*/React.createElement(View, {
|
|
234
|
-
className: "p-pro-list-card-title-text ".concat(((_meta$fileList8 = meta.fileList) === null || _meta$fileList8 === void 0 ? void 0 : _meta$fileList8.type) === 'swiper' && item[meta.fileList.dataIndex] ? 'p-pro-list-card-title-swiper-text' : '')
|
|
235
|
-
}, meta.title.render(item[meta.title.dataIndex], item, index)) : (meta === null || meta === void 0 || (_meta$title4 = meta.title) === null || _meta$title4 === void 0 ? void 0 : _meta$title4.dataIndex) && /*#__PURE__*/React.createElement(Text, {
|
|
236
249
|
className: "p-pro-list-card-title-text ".concat(((_meta$fileList9 = meta.fileList) === null || _meta$fileList9 === void 0 ? void 0 : _meta$fileList9.type) === 'swiper' && item[meta.fileList.dataIndex] ? 'p-pro-list-card-title-swiper-text' : '')
|
|
250
|
+
}, meta.title.render(item[meta.title.dataIndex], item, index)) : (meta === null || meta === void 0 || (_meta$title4 = meta.title) === null || _meta$title4 === void 0 ? void 0 : _meta$title4.dataIndex) && /*#__PURE__*/React.createElement(Text, {
|
|
251
|
+
className: "p-pro-list-card-title-text ".concat(((_meta$fileList10 = meta.fileList) === null || _meta$fileList10 === void 0 ? void 0 : _meta$fileList10.type) === 'swiper' && item[meta.fileList.dataIndex] ? 'p-pro-list-card-title-swiper-text' : '')
|
|
237
252
|
}, item[meta.title.dataIndex])), meta !== null && meta !== void 0 && (_meta$subTitle3 = meta.subTitle) !== null && _meta$subTitle3 !== void 0 && _meta$subTitle3.render ? meta.subTitle.render(item[meta.subTitle.dataIndex], item, index) : (meta === null || meta === void 0 || (_meta$subTitle4 = meta.subTitle) === null || _meta$subTitle4 === void 0 ? void 0 : _meta$subTitle4.dataIndex) && /*#__PURE__*/React.createElement(Text, {
|
|
238
253
|
className: "p-pro-list-card-sub-title"
|
|
239
254
|
}, item[meta.subTitle.dataIndex]), (meta === null || meta === void 0 ? void 0 : meta.description) && /*#__PURE__*/React.createElement(View, {
|
|
@@ -256,7 +271,7 @@ var ProList = function ProList(_ref, ref) {
|
|
|
256
271
|
key: d.dataIndex + '-value-' + i
|
|
257
272
|
}, item[d.dataIndex] || "-");
|
|
258
273
|
}))), /* 文件列表 */
|
|
259
|
-
(meta === null || meta === void 0 || (_meta$
|
|
274
|
+
(meta === null || meta === void 0 || (_meta$fileList11 = meta.fileList) === null || _meta$fileList11 === void 0 ? void 0 : _meta$fileList11.type) == "list" && (meta.fileList.render ? (_meta$fileList$render2 = (_meta$fileList12 = meta.fileList).render) === null || _meta$fileList$render2 === void 0 ? void 0 : _meta$fileList$render2.call(_meta$fileList12, item[meta.fileList.dataIndex], item, index) : (meta === null || meta === void 0 || (_meta$fileList13 = meta.fileList) === null || _meta$fileList13 === void 0 ? void 0 : _meta$fileList13.dataIndex) && item[meta.fileList.dataIndex] && /*#__PURE__*/React.createElement(Fragment, null, item[meta.fileList.dataIndex].filter(function (item) {
|
|
260
275
|
return item.fileType === "Pic";
|
|
261
276
|
}).length ? /*#__PURE__*/React.createElement(View, {
|
|
262
277
|
className: "p-pro-list-card-image-list"
|
|
@@ -267,7 +282,21 @@ var ProList = function ProList(_ref, ref) {
|
|
|
267
282
|
key: file.id,
|
|
268
283
|
src: file.fullUri,
|
|
269
284
|
className: "p-pro-list-card-image",
|
|
270
|
-
mode: "aspectFill"
|
|
285
|
+
mode: "aspectFill",
|
|
286
|
+
onTap: function onTap(e) {
|
|
287
|
+
var _meta$fileList14;
|
|
288
|
+
e.stopPropagation();
|
|
289
|
+
if ((_meta$fileList14 = meta.fileList) !== null && _meta$fileList14 !== void 0 && _meta$fileList14.dataIndex) {
|
|
290
|
+
previewImage({
|
|
291
|
+
urls: item[meta.fileList.dataIndex].filter(function (item) {
|
|
292
|
+
return item.fileType === "Pic";
|
|
293
|
+
}).map(function (item) {
|
|
294
|
+
return item.fullUri;
|
|
295
|
+
}),
|
|
296
|
+
current: file.fullUri
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
271
300
|
});
|
|
272
301
|
})) : null, item[meta.fileList.dataIndex].filter(function (item) {
|
|
273
302
|
return item.fileType !== "Pic";
|
|
@@ -278,7 +307,29 @@ var ProList = function ProList(_ref, ref) {
|
|
|
278
307
|
}).map(function (file) {
|
|
279
308
|
return /*#__PURE__*/React.createElement(View, {
|
|
280
309
|
className: "p-pro-list-card-file",
|
|
281
|
-
key: file.id
|
|
310
|
+
key: file.id,
|
|
311
|
+
onTap: function onTap(e) {
|
|
312
|
+
var _meta$fileList15;
|
|
313
|
+
e.stopPropagation();
|
|
314
|
+
if ((_meta$fileList15 = meta.fileList) !== null && _meta$fileList15 !== void 0 && _meta$fileList15.dataIndex) {
|
|
315
|
+
navigateTo({
|
|
316
|
+
url: "/screens/common/preview/index",
|
|
317
|
+
success: function success(result) {
|
|
318
|
+
var _meta$fileList16, _meta$fileList17, _meta$fileList18;
|
|
319
|
+
result.eventChannel.emit("getPreviewParams", {
|
|
320
|
+
fileId: file.id,
|
|
321
|
+
fileName: file.fileName,
|
|
322
|
+
fileType: file.fileType,
|
|
323
|
+
fileUri: file.uri,
|
|
324
|
+
module: (_meta$fileList16 = meta.fileList) === null || _meta$fileList16 === void 0 ? void 0 : _meta$fileList16.module,
|
|
325
|
+
userId: (_meta$fileList17 = meta.fileList) === null || _meta$fileList17 === void 0 ? void 0 : _meta$fileList17.userId,
|
|
326
|
+
userName: (_meta$fileList18 = meta.fileList) === null || _meta$fileList18 === void 0 ? void 0 : _meta$fileList18.userName,
|
|
327
|
+
readonly: true
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
282
333
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
283
334
|
className: "p-pro-list-card-file-image",
|
|
284
335
|
src: "https://dev.p3china.com:7700/psp.web.dev/resources/images/document/icon/".concat(file.fileType.toLowerCase(), ".svg"),
|
package/dist/Tabs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
2
|
import "./index.less";
|
|
3
3
|
type TabItemProps = {
|
|
4
4
|
label: string;
|
|
@@ -22,5 +22,5 @@ type TabsProps = {
|
|
|
22
22
|
isCardList?: boolean;
|
|
23
23
|
centered?: boolean;
|
|
24
24
|
};
|
|
25
|
-
declare const
|
|
26
|
-
export default
|
|
25
|
+
declare const _default: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<unknown>>;
|
|
26
|
+
export default _default;
|
package/dist/Tabs/index.js
CHANGED
|
@@ -14,11 +14,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
14
14
|
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; }
|
|
15
15
|
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; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
import React, { useCallback, useEffect, useState, cloneElement, isValidElement } from "react";
|
|
17
|
+
import React, { useCallback, useEffect, useState, cloneElement, isValidElement, useImperativeHandle, forwardRef } from "react";
|
|
18
18
|
import { ScrollView, Swiper, SwiperItem, Text, View } from "@tarojs/components";
|
|
19
19
|
import { createSelectorQuery } from "@tarojs/taro";
|
|
20
20
|
import "./index.less";
|
|
21
|
-
var Tabs = function Tabs(_ref) {
|
|
21
|
+
var Tabs = function Tabs(_ref, ref) {
|
|
22
22
|
var _items$, _tabsList$find2;
|
|
23
23
|
var items = _ref.items,
|
|
24
24
|
onChange = _ref.onChange,
|
|
@@ -83,6 +83,19 @@ var Tabs = function Tabs(_ref) {
|
|
|
83
83
|
getIndicatorPosition();
|
|
84
84
|
}
|
|
85
85
|
}, [selectKey, parentLeft]);
|
|
86
|
+
useImperativeHandle(ref, function () {
|
|
87
|
+
return {
|
|
88
|
+
onRefresh: function onRefresh(keys) {
|
|
89
|
+
keys.forEach(function (item) {
|
|
90
|
+
var tab = tabsList.find(function (tab) {
|
|
91
|
+
return tab.key === item;
|
|
92
|
+
});
|
|
93
|
+
if (tab !== null && tab !== void 0 && tab.init) tab.init = false;
|
|
94
|
+
});
|
|
95
|
+
setTabsList(_toConsumableArray(tabsList));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
});
|
|
86
99
|
var getParentPosition = useCallback(function () {
|
|
87
100
|
var query = createSelectorQuery();
|
|
88
101
|
query.select("#p-tabs-nav-list-scroll").boundingClientRect(function (rect) {
|
|
@@ -190,4 +203,4 @@ var Tabs = function Tabs(_ref) {
|
|
|
190
203
|
return item.key === selectKey;
|
|
191
204
|
})) === null || _tabsList$find2 === void 0 ? void 0 : _tabsList$find2.children));
|
|
192
205
|
};
|
|
193
|
-
export default Tabs;
|
|
206
|
+
export default /*#__PURE__*/forwardRef(Tabs);
|
|
@@ -3,6 +3,11 @@ export declare const getUserAvatar: (params: {
|
|
|
3
3
|
}, options?: {
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
} | undefined) => Promise<ServiceAPI.Response<string[]>>;
|
|
6
|
+
export declare const getCompanyUserAvatar: (params: {
|
|
7
|
+
ids: string[];
|
|
8
|
+
}, options?: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
} | undefined) => Promise<ServiceAPI.Response<string[]>>;
|
|
6
11
|
export declare const getProjectMemberAvatar: (params: {
|
|
7
12
|
ids: string[];
|
|
8
13
|
}, options?: {
|
|
@@ -17,6 +17,12 @@ export var getUserAvatar = function getUserAvatar(params, options) {
|
|
|
17
17
|
data: _toConsumableArray(params.ids)
|
|
18
18
|
}, options || {}));
|
|
19
19
|
};
|
|
20
|
+
export var getCompanyUserAvatar = function getCompanyUserAvatar(params, options) {
|
|
21
|
+
return request("/service-company/org/user/batch/avatar", _objectSpread({
|
|
22
|
+
method: "POST",
|
|
23
|
+
data: _toConsumableArray(params.ids)
|
|
24
|
+
}, options || {}));
|
|
25
|
+
};
|
|
20
26
|
export var getProjectMemberAvatar = function getProjectMemberAvatar(params, options) {
|
|
21
27
|
return request("/service-project/org/member/batch/avatar", _objectSpread({
|
|
22
28
|
method: "POST",
|