@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
package/dist/index.js
CHANGED
|
@@ -15,13 +15,16 @@ export { default as ConfigProvider } from "./ConfigProvider";
|
|
|
15
15
|
export { default as CreatorEdit } from "./CreatorEdit";
|
|
16
16
|
export { default as Empty } from "./Empty";
|
|
17
17
|
export { default as ActionSheet } from "./ActionSheet";
|
|
18
|
+
export { default as DatePicker } from "./DatePicker";
|
|
19
|
+
export { default as Filter } from "./Filter";
|
|
20
|
+
export { default as SearchInput } from "./SearchInput";
|
|
18
21
|
|
|
19
22
|
/* Form相关 */
|
|
20
23
|
export { default as ProForm } from "./ProForm";
|
|
21
|
-
export { default as ProFormText } from "./ProForm/
|
|
22
|
-
export { default as ProFormTextArea } from "./ProForm/
|
|
23
|
-
export { default as ProFormDate } from "./ProForm/
|
|
24
|
-
export { default as ProFormUpload } from "./ProForm/
|
|
25
|
-
export { default as ProFormSelect } from "./ProForm/
|
|
26
|
-
export { default as ProFormList } from "./ProForm/
|
|
27
|
-
export { getQueryParams, getListAssignField, dateFormat, getSimplifyDay, getUUID, getFileExt, getFileType, clipFileUrl } from "./utils/tools";
|
|
24
|
+
export { default as ProFormText } from "./ProForm/Controls/Text";
|
|
25
|
+
export { default as ProFormTextArea } from "./ProForm/Controls/TextArea";
|
|
26
|
+
export { default as ProFormDate } from "./ProForm/Controls/Date";
|
|
27
|
+
export { default as ProFormUpload } from "./ProForm/Controls/Upload";
|
|
28
|
+
export { default as ProFormSelect } from "./ProForm/Controls/Select";
|
|
29
|
+
export { default as ProFormList } from "./ProForm/Controls/List";
|
|
30
|
+
export { getQueryParams, getListAssignField, dateFormat, getSimplifyDay, getUUID, getFileExt, getFileType, clipFileUrl, getObjectPathValue, setObjectPathValue } from "./utils/tools";
|
package/dist/request/index.js
CHANGED
package/dist/utils/tools.d.ts
CHANGED
|
@@ -30,4 +30,14 @@ declare const getFileExt: (file: {
|
|
|
30
30
|
fileName?: string;
|
|
31
31
|
}) => string;
|
|
32
32
|
declare const clipFileUrl: (uri: string, ext?: string) => string;
|
|
33
|
-
|
|
33
|
+
declare const getObjectPathValue: (path: string[] | string, obj: {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}) => any;
|
|
36
|
+
declare const setObjectPathValue: (path: string[] | string, value: {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
}, obj: {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}) => {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
} | undefined;
|
|
43
|
+
export { getListAssignField, getQueryParams, getUUID, dateFormat, getSimplifyDay, getFileType, getFileExt, clipFileUrl, getObjectPathValue, setObjectPathValue };
|
package/dist/utils/tools.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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); }
|
|
1
2
|
/*
|
|
2
3
|
* 根据value获取指定list中指定fieId字段值
|
|
3
4
|
* @param: value(string/boolean/number类型,需匹配的值), list(any[]类型,指定遍历的list), fieId(非必传,string类型,根据值匹配获取的对应JSON中的字段值)
|
|
@@ -12,17 +13,17 @@ var getQueryParams = function getQueryParams(params, allowEmpty) {
|
|
|
12
13
|
var encode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
13
14
|
var query = "?";
|
|
14
15
|
if (allowEmpty) {
|
|
15
|
-
for (var
|
|
16
|
-
query = query +
|
|
16
|
+
for (var _key in params) {
|
|
17
|
+
query = query + _key + "=" + params[_key] + "&";
|
|
17
18
|
}
|
|
18
19
|
} else {
|
|
19
|
-
for (var
|
|
20
|
-
var value = encode ? encodeURIComponent(params[
|
|
21
|
-
if (typeof params[
|
|
22
|
-
query = query +
|
|
20
|
+
for (var _key2 in params) {
|
|
21
|
+
var value = encode ? encodeURIComponent(params[_key2]) : params[_key2];
|
|
22
|
+
if (typeof params[_key2] === "boolean") {
|
|
23
|
+
query = query + _key2 + "=" + params[_key2] + "&";
|
|
23
24
|
}
|
|
24
|
-
if (typeof params[
|
|
25
|
-
query = query +
|
|
25
|
+
if (typeof params[_key2] !== "boolean" && params[_key2]) {
|
|
26
|
+
query = query + _key2 + "=" + value + "&";
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -228,4 +229,37 @@ var clipFileUrl = function clipFileUrl(uri, ext) {
|
|
|
228
229
|
}
|
|
229
230
|
return uri;
|
|
230
231
|
};
|
|
231
|
-
|
|
232
|
+
|
|
233
|
+
/* 获取对象指定层级Key */
|
|
234
|
+
var getObjectPathValue = function getObjectPathValue(path, obj) {
|
|
235
|
+
if (!obj || _typeof(obj) !== "object") return undefined;
|
|
236
|
+
if (!path) return undefined;
|
|
237
|
+
if (typeof path === "string") return obj[path];
|
|
238
|
+
if (!(path !== null && path !== void 0 && path.length)) return undefined;
|
|
239
|
+
var result = path.reduce(function (e, i) {
|
|
240
|
+
if (e === null || _typeof(e) !== "object") return undefined;
|
|
241
|
+
return e[i];
|
|
242
|
+
}, obj);
|
|
243
|
+
return result;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/* 获取对象指定层级Key */
|
|
247
|
+
var setObjectPathValue = function setObjectPathValue(path, value, obj) {
|
|
248
|
+
if (!obj || _typeof(obj) !== "object") return;
|
|
249
|
+
if (!path) return;
|
|
250
|
+
if (typeof path === "string") return obj[path] = value;
|
|
251
|
+
if (!(path !== null && path !== void 0 && path.length)) return undefined;
|
|
252
|
+
var current = obj;
|
|
253
|
+
for (var i = 0; i < path.length - 1; i++) {
|
|
254
|
+
var _key3 = path[i];
|
|
255
|
+
if (current[_key3] == null) {
|
|
256
|
+
current[_key3] = {};
|
|
257
|
+
} else if (_typeof(current[_key3]) !== 'object') {
|
|
258
|
+
current[_key3] = {};
|
|
259
|
+
}
|
|
260
|
+
current = current[_key3];
|
|
261
|
+
}
|
|
262
|
+
var key = path[path.length - 1];
|
|
263
|
+
current[key] = value;
|
|
264
|
+
};
|
|
265
|
+
export { getListAssignField, getQueryParams, getUUID, dateFormat, getSimplifyDay, getFileType, getFileExt, clipFileUrl, getObjectPathValue, setObjectPathValue };
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { FC, ReactElement } from "react";
|
|
2
|
-
import { ProListProps } from "../../../ProList";
|
|
3
|
-
import "./index.less";
|
|
4
|
-
type ProFormListProps = ProFormAPI.ProFormItemProps & ProListProps & {
|
|
5
|
-
extra?: ReactElement;
|
|
6
|
-
onAdd?: (onChange: (value: {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}) => void, value: {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}[]) => void;
|
|
11
|
-
onEdit?: (record: {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
}, onChange: (value: {
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
}) => void) => void;
|
|
16
|
-
onItem?: (data: {
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
}) => ({
|
|
19
|
-
onTap?: () => void;
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
declare const ProFormList: FC<ProFormListProps>;
|
|
23
|
-
export default ProFormList;
|
|
@@ -1,77 +0,0 @@
|
|
|
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
|
-
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); }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
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; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
-
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); }
|
|
8
|
-
import React, { Fragment } from "react";
|
|
9
|
-
import { Text, View } from "@tarojs/components";
|
|
10
|
-
import { ProList } from "../../..";
|
|
11
|
-
import ProFormField from "../../Field";
|
|
12
|
-
import "./index.less";
|
|
13
|
-
var ProFormList = function ProFormList(props) {
|
|
14
|
-
var extra = props.extra,
|
|
15
|
-
onAdd = props.onAdd,
|
|
16
|
-
onEdit = props.onEdit,
|
|
17
|
-
_props$value = props.value,
|
|
18
|
-
value = _props$value === void 0 ? [] : _props$value,
|
|
19
|
-
onChange = props.onChange,
|
|
20
|
-
meta = props.meta,
|
|
21
|
-
disabled = props.disabled,
|
|
22
|
-
onItem = props.onItem;
|
|
23
|
-
return /*#__PURE__*/React.createElement(ProFormField, _extends({}, props, {
|
|
24
|
-
layout: "vertical",
|
|
25
|
-
className: "p-pro-form-item-list",
|
|
26
|
-
extra: !disabled && /*#__PURE__*/React.createElement(View, {
|
|
27
|
-
className: "p-pro-form-item-header-button",
|
|
28
|
-
onTap: function onTap() {
|
|
29
|
-
return onAdd === null || onAdd === void 0 ? void 0 : onAdd(function (data) {
|
|
30
|
-
console.log(data, value);
|
|
31
|
-
onChange === null || onChange === void 0 || onChange(data instanceof Array ? data : value.concat([data]));
|
|
32
|
-
}, value);
|
|
33
|
-
}
|
|
34
|
-
}, extra || /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
35
|
-
className: "iconfont icon-icon-psp-xinjian"
|
|
36
|
-
}), /*#__PURE__*/React.createElement(Text, {
|
|
37
|
-
className: "text"
|
|
38
|
-
}, "\u6DFB\u52A0")))
|
|
39
|
-
}), /*#__PURE__*/React.createElement(ProList, {
|
|
40
|
-
dataSources: value || [],
|
|
41
|
-
scrollable: false,
|
|
42
|
-
meta: _objectSpread(_objectSpread({}, meta), {}, {
|
|
43
|
-
footer: !disabled && {
|
|
44
|
-
extra: {
|
|
45
|
-
dataIndex: "id",
|
|
46
|
-
render: function render(_, item, index) {
|
|
47
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
48
|
-
className: "option-group"
|
|
49
|
-
}, !_ && /*#__PURE__*/React.createElement(View, {
|
|
50
|
-
className: "option-button",
|
|
51
|
-
onTap: function onTap(e) {
|
|
52
|
-
e.stopPropagation();
|
|
53
|
-
onEdit === null || onEdit === void 0 || onEdit(item, function (data) {
|
|
54
|
-
value.splice(index, 1, data);
|
|
55
|
-
onChange === null || onChange === void 0 || onChange(value);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
59
|
-
className: "text"
|
|
60
|
-
}, "\u7F16\u8F91")), /*#__PURE__*/React.createElement(View, {
|
|
61
|
-
className: "option-button",
|
|
62
|
-
onTap: function onTap(e) {
|
|
63
|
-
e.stopPropagation();
|
|
64
|
-
value.splice(index, 1);
|
|
65
|
-
onChange === null || onChange === void 0 || onChange(value);
|
|
66
|
-
}
|
|
67
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
68
|
-
className: "text danger"
|
|
69
|
-
}, "\u5220\u9664")));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
onItem: onItem
|
|
75
|
-
}));
|
|
76
|
-
};
|
|
77
|
-
export default ProFormList;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Input, Text } from "@tarojs/components";
|
|
3
|
-
import ProFormField from "../../Field";
|
|
4
|
-
import "./index.less";
|
|
5
|
-
var ProFormText = function ProFormText(props) {
|
|
6
|
-
var _props$placeholder = props.placeholder,
|
|
7
|
-
placeholder = _props$placeholder === void 0 ? "请输入" : _props$placeholder,
|
|
8
|
-
onChange = props.onChange,
|
|
9
|
-
_props$maxLength = props.maxLength,
|
|
10
|
-
maxLength = _props$maxLength === void 0 ? -1 : _props$maxLength,
|
|
11
|
-
_props$inputType = props.inputType,
|
|
12
|
-
inputType = _props$inputType === void 0 ? "text" : _props$inputType,
|
|
13
|
-
disabled = props.disabled,
|
|
14
|
-
value = props.value;
|
|
15
|
-
return /*#__PURE__*/React.createElement(ProFormField, props, disabled ? /*#__PURE__*/React.createElement(Text, {
|
|
16
|
-
className: "p-pro-form-item-control-disabled"
|
|
17
|
-
}, value || "-") : /*#__PURE__*/React.createElement(Input, {
|
|
18
|
-
placeholder: placeholder,
|
|
19
|
-
className: "p-pro-form-item-input",
|
|
20
|
-
placeholderClass: "p-pro-form-item-placeholder",
|
|
21
|
-
onInput: function onInput(e) {
|
|
22
|
-
return onChange === null || onChange === void 0 ? void 0 : onChange(e.detail.value);
|
|
23
|
-
},
|
|
24
|
-
maxlength: maxLength,
|
|
25
|
-
type: inputType,
|
|
26
|
-
value: value
|
|
27
|
-
}));
|
|
28
|
-
};
|
|
29
|
-
export default ProFormText;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|