@ztocwst/rc-pro-materials 0.2.3 → 0.2.4
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +2 -2
- package/build/lowcode/render/default/view.js +13 -13
- package/build/lowcode/view.js +10 -10
- package/dist/SCM_Comps.js +21 -13
- package/dist/SCM_Comps.js.map +1 -1
- package/es/components/z-config-provider/configProvider.js +39 -3
- package/es/utils/props/common.d.ts +6 -0
- package/es/utils/props/common.js +17 -0
- package/lib/components/z-config-provider/configProvider.js +38 -2
- package/lib/utils/props/common.d.ts +6 -0
- package/lib/utils/props/common.js +20 -2
- package/package.json +3 -3
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
var _excluded = ["children"],
|
|
4
|
-
_excluded2 = ["authBtns", "singleWarehouseConfig", "singleFactoryConfig"];
|
|
4
|
+
_excluded2 = ["authBtns", "singleWarehouseConfig", "singleFactoryConfig", "asyncSelect", "form", "ossConfig", "print", "tableOptions", "tplOptions"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { RcConfigProvider } from '@ztocwst/rc-pro';
|
|
7
|
-
import { processRequestConfig } from "../../utils/props/common";
|
|
7
|
+
import { processEmptyObject, processRequestConfig } from "../../utils/props/common";
|
|
8
8
|
var ZConfigProvider = function ZConfigProvider(_ref) {
|
|
9
|
+
var _asyncSelect$fieldNam, _asyncSelect$pager, _form$footer, _print$printer, _tableOptions$paginat, _tableOptions$sortNam;
|
|
9
10
|
var children = _ref.children,
|
|
10
11
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
11
12
|
var _rest$authBtns = rest.authBtns,
|
|
12
13
|
authBtns = _rest$authBtns === void 0 ? [] : _rest$authBtns,
|
|
13
14
|
singleWarehouseConfig = rest.singleWarehouseConfig,
|
|
14
15
|
singleFactoryConfig = rest.singleFactoryConfig,
|
|
16
|
+
asyncSelect = rest.asyncSelect,
|
|
17
|
+
form = rest.form,
|
|
18
|
+
ossConfig = rest.ossConfig,
|
|
19
|
+
print = rest.print,
|
|
20
|
+
tableOptions = rest.tableOptions,
|
|
21
|
+
tplOptions = rest.tplOptions,
|
|
15
22
|
restProps = _objectWithoutPropertiesLoose(rest, _excluded2);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* 过滤空对象,如果对象中的值都是undefined,整个对象赋值 undefined
|
|
27
|
+
* asyncSelect 中的 fieldNames、pager 对象
|
|
28
|
+
* form 中的 footer对象
|
|
29
|
+
* ossConfig 对象
|
|
30
|
+
* print 中的 printer
|
|
31
|
+
* tableOptions 中的 pagination、sortNames
|
|
32
|
+
* tplOptions 对象
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
|
|
16
36
|
var props = _extends({
|
|
17
37
|
authBtns: authBtns === null || authBtns === void 0 ? void 0 : authBtns.map(function (e) {
|
|
18
38
|
return _extends({}, e, {
|
|
@@ -24,7 +44,23 @@ var ZConfigProvider = function ZConfigProvider(_ref) {
|
|
|
24
44
|
} : {}),
|
|
25
45
|
singleFactoryConfig: _extends({}, singleFactoryConfig, singleFactoryConfig !== null && singleFactoryConfig !== void 0 && singleFactoryConfig.requestConfig ? {
|
|
26
46
|
requestConfig: processRequestConfig(singleFactoryConfig === null || singleFactoryConfig === void 0 ? void 0 : singleFactoryConfig.requestConfig)
|
|
27
|
-
} : {})
|
|
47
|
+
} : {}),
|
|
48
|
+
asyncSelect: _extends({}, asyncSelect, {
|
|
49
|
+
fieldNames: processEmptyObject((_asyncSelect$fieldNam = asyncSelect === null || asyncSelect === void 0 ? void 0 : asyncSelect.fieldNames) !== null && _asyncSelect$fieldNam !== void 0 ? _asyncSelect$fieldNam : {}),
|
|
50
|
+
pager: processEmptyObject((_asyncSelect$pager = asyncSelect === null || asyncSelect === void 0 ? void 0 : asyncSelect.pager) !== null && _asyncSelect$pager !== void 0 ? _asyncSelect$pager : {})
|
|
51
|
+
}),
|
|
52
|
+
form: _extends({}, form, {
|
|
53
|
+
footer: processEmptyObject((_form$footer = form === null || form === void 0 ? void 0 : form.footer) !== null && _form$footer !== void 0 ? _form$footer : {})
|
|
54
|
+
}),
|
|
55
|
+
ossConfig: processEmptyObject(ossConfig !== null && ossConfig !== void 0 ? ossConfig : {}),
|
|
56
|
+
print: _extends({}, print, {
|
|
57
|
+
printer: processEmptyObject((_print$printer = print === null || print === void 0 ? void 0 : print.printer) !== null && _print$printer !== void 0 ? _print$printer : {})
|
|
58
|
+
}),
|
|
59
|
+
tableOptions: _extends({}, tableOptions, {
|
|
60
|
+
pagination: processEmptyObject((_tableOptions$paginat = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.pagination) !== null && _tableOptions$paginat !== void 0 ? _tableOptions$paginat : {}),
|
|
61
|
+
sortNames: processEmptyObject((_tableOptions$sortNam = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.sortNames) !== null && _tableOptions$sortNam !== void 0 ? _tableOptions$sortNam : {})
|
|
62
|
+
}),
|
|
63
|
+
tplOptions: processEmptyObject(tplOptions !== null && tplOptions !== void 0 ? tplOptions : {})
|
|
28
64
|
}, restProps);
|
|
29
65
|
console.log(props, 'configProvider');
|
|
30
66
|
return /*#__PURE__*/React.createElement(RcConfigProvider, props, children);
|
package/es/utils/props/common.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
var _excluded = ["singleWarehouse"];
|
|
4
|
+
import _ from 'lodash';
|
|
4
5
|
export var processRequestConfig = function processRequestConfig(props) {
|
|
5
6
|
var _props$headers;
|
|
6
7
|
var singleWarehouse = props.singleWarehouse,
|
|
@@ -10,4 +11,20 @@ export var processRequestConfig = function processRequestConfig(props) {
|
|
|
10
11
|
singleWarehouse: true
|
|
11
12
|
} : {})
|
|
12
13
|
} : {});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 根据对象是否为空判断返回值
|
|
18
|
+
* @param obj
|
|
19
|
+
* @returns undefined | obj
|
|
20
|
+
*/
|
|
21
|
+
export var processEmptyObject = function processEmptyObject(obj) {
|
|
22
|
+
if (obj === void 0) {
|
|
23
|
+
obj = {};
|
|
24
|
+
}
|
|
25
|
+
// 判断对象是否为空
|
|
26
|
+
var empty = _ === null || _ === void 0 ? void 0 : _.isEmpty(_ === null || _ === void 0 ? void 0 : _.pickBy(obj, function (value) {
|
|
27
|
+
return value !== null && value !== undefined;
|
|
28
|
+
}));
|
|
29
|
+
return empty ? undefined : obj;
|
|
13
30
|
};
|
|
@@ -9,17 +9,37 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _rcPro = require("@ztocwst/rc-pro");
|
|
10
10
|
var _common = require("../../utils/props/common");
|
|
11
11
|
var _excluded = ["children"],
|
|
12
|
-
_excluded2 = ["authBtns", "singleWarehouseConfig", "singleFactoryConfig"];
|
|
12
|
+
_excluded2 = ["authBtns", "singleWarehouseConfig", "singleFactoryConfig", "asyncSelect", "form", "ossConfig", "print", "tableOptions", "tplOptions"];
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
15
|
var ZConfigProvider = function ZConfigProvider(_ref) {
|
|
16
|
+
var _asyncSelect$fieldNam, _asyncSelect$pager, _form$footer, _print$printer, _tableOptions$paginat, _tableOptions$sortNam;
|
|
16
17
|
var children = _ref.children,
|
|
17
18
|
rest = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
18
19
|
var _rest$authBtns = rest.authBtns,
|
|
19
20
|
authBtns = _rest$authBtns === void 0 ? [] : _rest$authBtns,
|
|
20
21
|
singleWarehouseConfig = rest.singleWarehouseConfig,
|
|
21
22
|
singleFactoryConfig = rest.singleFactoryConfig,
|
|
23
|
+
asyncSelect = rest.asyncSelect,
|
|
24
|
+
form = rest.form,
|
|
25
|
+
ossConfig = rest.ossConfig,
|
|
26
|
+
print = rest.print,
|
|
27
|
+
tableOptions = rest.tableOptions,
|
|
28
|
+
tplOptions = rest.tplOptions,
|
|
22
29
|
restProps = (0, _objectWithoutPropertiesLoose2["default"])(rest, _excluded2);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* 过滤空对象,如果对象中的值都是undefined,整个对象赋值 undefined
|
|
34
|
+
* asyncSelect 中的 fieldNames、pager 对象
|
|
35
|
+
* form 中的 footer对象
|
|
36
|
+
* ossConfig 对象
|
|
37
|
+
* print 中的 printer
|
|
38
|
+
* tableOptions 中的 pagination、sortNames
|
|
39
|
+
* tplOptions 对象
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
|
|
23
43
|
var props = (0, _extends2["default"])({
|
|
24
44
|
authBtns: authBtns === null || authBtns === void 0 ? void 0 : authBtns.map(function (e) {
|
|
25
45
|
return (0, _extends2["default"])({}, e, {
|
|
@@ -31,7 +51,23 @@ var ZConfigProvider = function ZConfigProvider(_ref) {
|
|
|
31
51
|
} : {}),
|
|
32
52
|
singleFactoryConfig: (0, _extends2["default"])({}, singleFactoryConfig, singleFactoryConfig !== null && singleFactoryConfig !== void 0 && singleFactoryConfig.requestConfig ? {
|
|
33
53
|
requestConfig: (0, _common.processRequestConfig)(singleFactoryConfig === null || singleFactoryConfig === void 0 ? void 0 : singleFactoryConfig.requestConfig)
|
|
34
|
-
} : {})
|
|
54
|
+
} : {}),
|
|
55
|
+
asyncSelect: (0, _extends2["default"])({}, asyncSelect, {
|
|
56
|
+
fieldNames: (0, _common.processEmptyObject)((_asyncSelect$fieldNam = asyncSelect === null || asyncSelect === void 0 ? void 0 : asyncSelect.fieldNames) !== null && _asyncSelect$fieldNam !== void 0 ? _asyncSelect$fieldNam : {}),
|
|
57
|
+
pager: (0, _common.processEmptyObject)((_asyncSelect$pager = asyncSelect === null || asyncSelect === void 0 ? void 0 : asyncSelect.pager) !== null && _asyncSelect$pager !== void 0 ? _asyncSelect$pager : {})
|
|
58
|
+
}),
|
|
59
|
+
form: (0, _extends2["default"])({}, form, {
|
|
60
|
+
footer: (0, _common.processEmptyObject)((_form$footer = form === null || form === void 0 ? void 0 : form.footer) !== null && _form$footer !== void 0 ? _form$footer : {})
|
|
61
|
+
}),
|
|
62
|
+
ossConfig: (0, _common.processEmptyObject)(ossConfig !== null && ossConfig !== void 0 ? ossConfig : {}),
|
|
63
|
+
print: (0, _extends2["default"])({}, print, {
|
|
64
|
+
printer: (0, _common.processEmptyObject)((_print$printer = print === null || print === void 0 ? void 0 : print.printer) !== null && _print$printer !== void 0 ? _print$printer : {})
|
|
65
|
+
}),
|
|
66
|
+
tableOptions: (0, _extends2["default"])({}, tableOptions, {
|
|
67
|
+
pagination: (0, _common.processEmptyObject)((_tableOptions$paginat = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.pagination) !== null && _tableOptions$paginat !== void 0 ? _tableOptions$paginat : {}),
|
|
68
|
+
sortNames: (0, _common.processEmptyObject)((_tableOptions$sortNam = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.sortNames) !== null && _tableOptions$sortNam !== void 0 ? _tableOptions$sortNam : {})
|
|
69
|
+
}),
|
|
70
|
+
tplOptions: (0, _common.processEmptyObject)(tplOptions !== null && tplOptions !== void 0 ? tplOptions : {})
|
|
35
71
|
}, restProps);
|
|
36
72
|
console.log(props, 'configProvider');
|
|
37
73
|
return /*#__PURE__*/React.createElement(_rcPro.RcConfigProvider, props, children);
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.processRequestConfig = void 0;
|
|
5
|
+
exports.processRequestConfig = exports.processEmptyObject = void 0;
|
|
6
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
7
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
9
|
var _excluded = ["singleWarehouse"];
|
|
9
10
|
var processRequestConfig = function processRequestConfig(props) {
|
|
10
11
|
var _props$headers;
|
|
@@ -16,4 +17,21 @@ var processRequestConfig = function processRequestConfig(props) {
|
|
|
16
17
|
} : {})
|
|
17
18
|
} : {});
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 根据对象是否为空判断返回值
|
|
23
|
+
* @param obj
|
|
24
|
+
* @returns undefined | obj
|
|
25
|
+
*/
|
|
26
|
+
exports.processRequestConfig = processRequestConfig;
|
|
27
|
+
var processEmptyObject = function processEmptyObject(obj) {
|
|
28
|
+
if (obj === void 0) {
|
|
29
|
+
obj = {};
|
|
30
|
+
}
|
|
31
|
+
// 判断对象是否为空
|
|
32
|
+
var empty = _lodash["default"] === null || _lodash["default"] === void 0 ? void 0 : _lodash["default"].isEmpty(_lodash["default"] === null || _lodash["default"] === void 0 ? void 0 : _lodash["default"].pickBy(obj, function (value) {
|
|
33
|
+
return value !== null && value !== undefined;
|
|
34
|
+
}));
|
|
35
|
+
return empty ? undefined : obj;
|
|
36
|
+
};
|
|
37
|
+
exports.processEmptyObject = processEmptyObject;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ztocwst/rc-pro-materials",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "@ztocwst/rc-pro-materials",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
},
|
|
87
87
|
"componentConfig": {
|
|
88
88
|
"isComponentLibrary": true,
|
|
89
|
-
"materialSchema": "https://npm.onmicrosoft.cn/@ztocwst/rc-pro-materials@0.2.
|
|
89
|
+
"materialSchema": "https://npm.onmicrosoft.cn/@ztocwst/rc-pro-materials@0.2.4/build/lowcode/assets-prod.json"
|
|
90
90
|
},
|
|
91
|
-
"homepage": "https://unpkg.com/@ztocwst/rc-pro-materials@0.2.
|
|
91
|
+
"homepage": "https://unpkg.com/@ztocwst/rc-pro-materials@0.2.4/build/index.html",
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"registry": "https://registry.npmjs.org/",
|
|
94
94
|
"access": "public"
|