@teamix/pro 1.3.13 → 1.3.16
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/pro.css +1 -1
- package/dist/pro.js +5531 -720
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/index.js +40 -4
- package/es/actions/index.scss +13 -0
- package/es/form/Filter/LightFilter.js +7 -5
- package/es/form/Filter/index.js +171 -55
- package/es/form/Filter/layout.scss +4 -0
- package/es/form/Filter/useBindUrl.d.ts +2 -0
- package/es/form/Filter/useBindUrl.js +118 -0
- package/es/form/ProForm/index.d.ts +2 -3
- package/es/form/ProForm/index.js +51 -10
- package/es/form/ProForm/index.scss +7 -0
- package/es/form/ProForm/useFieldSchema.d.ts +7 -0
- package/es/form/ProForm/useFieldSchema.js +109 -0
- package/es/form/SchemaForm/index.js +2 -38
- package/es/form/SchemaForm/initializeDataSource.d.ts +1 -2
- package/es/form/SchemaForm/initializeDataSource.js +14 -19
- package/es/form/SchemaForm/initializeRequest.js +25 -26
- package/es/form/SchemaForm/initializeRules.d.ts +2 -2
- package/es/form/SchemaForm/initializeRules.js +30 -23
- package/es/form/SchemaForm/initializeSelectTable.js +80 -6
- package/es/form/SchemaForm/reactions.d.ts +4 -4
- package/es/form/SchemaForm/reactions.js +30 -23
- package/es/form/typing.d.ts +16 -6
- package/es/form/utils.d.ts +16 -1
- package/es/form/utils.js +21 -2
- package/es/global.scss +45 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +3 -2
- package/es/page-header/index.d.ts +2 -0
- package/es/page-header/index.js +13 -3
- package/es/page-header/index.scss +8 -0
- package/es/table/components/Layout/index.scss +5 -5
- package/es/table/components/ToolBar/Fullscreen.d.ts +1 -1
- package/es/table/utils/pureColumnRender.d.ts +9 -0
- package/es/table/utils/pureColumnRender.js +201 -0
- package/es/table/utils/pureGenProColumnToColumn.d.ts +7 -0
- package/es/table/utils/pureGenProColumnToColumn.js +36 -0
- package/es/timeline/ProTimeLineItem/index.js +8 -5
- package/es/timeline/typing.d.ts +5 -0
- package/lib/actions/index.js +40 -4
- package/lib/actions/index.scss +13 -0
- package/lib/form/Filter/LightFilter.js +7 -6
- package/lib/form/Filter/index.js +172 -55
- package/lib/form/Filter/layout.scss +4 -0
- package/lib/form/Filter/useBindUrl.d.ts +2 -0
- package/lib/form/Filter/useBindUrl.js +129 -0
- package/lib/form/ProForm/index.d.ts +2 -3
- package/lib/form/ProForm/index.js +57 -9
- package/lib/form/ProForm/index.scss +7 -0
- package/lib/form/ProForm/useFieldSchema.d.ts +7 -0
- package/lib/form/ProForm/useFieldSchema.js +118 -0
- package/lib/form/SchemaForm/index.js +2 -45
- package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -2
- package/lib/form/SchemaForm/initializeDataSource.js +14 -19
- package/lib/form/SchemaForm/initializeRequest.js +26 -26
- package/lib/form/SchemaForm/initializeRules.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRules.js +30 -22
- package/lib/form/SchemaForm/initializeSelectTable.js +85 -6
- package/lib/form/SchemaForm/reactions.d.ts +4 -4
- package/lib/form/SchemaForm/reactions.js +30 -23
- package/lib/form/typing.d.ts +16 -6
- package/lib/form/utils.d.ts +16 -1
- package/lib/form/utils.js +23 -2
- package/lib/global.scss +45 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/page-header/index.d.ts +2 -0
- package/lib/page-header/index.js +12 -2
- package/lib/page-header/index.scss +8 -0
- package/lib/table/components/Layout/index.scss +5 -5
- package/lib/table/components/ToolBar/Fullscreen.d.ts +1 -1
- package/lib/table/utils/pureColumnRender.d.ts +9 -0
- package/lib/table/utils/pureColumnRender.js +215 -0
- package/lib/table/utils/pureGenProColumnToColumn.d.ts +7 -0
- package/lib/table/utils/pureGenProColumnToColumn.js +43 -0
- package/lib/timeline/ProTimeLineItem/index.js +8 -5
- package/lib/timeline/typing.d.ts +5 -0
- package/package.json +1 -1
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _utils = require("@teamix/utils");
|
9
9
|
|
10
|
+
var _utils2 = require("../utils");
|
11
|
+
|
12
|
+
var _excluded = ["validator"];
|
13
|
+
|
10
14
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
11
15
|
|
12
16
|
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."); }
|
@@ -25,30 +29,34 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
25
29
|
|
26
30
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
27
31
|
|
28
|
-
var
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
32
|
+
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; }
|
33
|
+
|
34
|
+
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; }
|
35
|
+
|
36
|
+
var initializeRule = function initializeRule(rule, suffix) {
|
37
|
+
var _ref = rule || {},
|
38
|
+
validator = _ref.validator,
|
39
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
40
|
+
|
41
|
+
var _initializeRequestExp = (0, _utils2.initializeRequestExpression)(validator, '$validator', suffix),
|
42
|
+
expression = _initializeRequestExp.expression,
|
43
|
+
scope = _initializeRequestExp.scope;
|
44
|
+
|
45
|
+
return expression ? {
|
46
|
+
scope: scope,
|
47
|
+
rules: _objectSpread({
|
48
|
+
validator: expression
|
49
|
+
}, rest)
|
50
|
+
} : {
|
51
|
+
scope: {},
|
52
|
+
rules: rule
|
47
53
|
};
|
54
|
+
};
|
48
55
|
|
56
|
+
var initializeRules = function initializeRules(rules, suffix) {
|
49
57
|
if ((0, _utils.isArr)(rules)) {
|
50
|
-
return rules.reduce(function (prev, current,
|
51
|
-
var result =
|
58
|
+
return rules.reduce(function (prev, current, index) {
|
59
|
+
var result = initializeRule(current, "".concat(suffix, "_").concat(index));
|
52
60
|
prev.rules = [].concat(_toConsumableArray(prev.rules), [result.rules]);
|
53
61
|
prev.scope = _objectSpread(_objectSpread({}, prev.scope), result.scope);
|
54
62
|
return prev;
|
@@ -58,7 +66,7 @@ var initializeRules = function initializeRules(rules, suffix) {
|
|
58
66
|
});
|
59
67
|
}
|
60
68
|
|
61
|
-
return
|
69
|
+
return initializeRule(rules, suffix);
|
62
70
|
};
|
63
71
|
|
64
72
|
var _default = initializeRules;
|
@@ -4,7 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
7
|
+
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
9
|
+
|
10
|
+
var _utils = require("@teamix/utils");
|
11
|
+
|
12
|
+
var _pureGenProColumnToColumn = _interopRequireDefault(require("../../table/utils/pureGenProColumnToColumn"));
|
13
|
+
|
14
|
+
var _excluded = ["name", "children", "props"];
|
15
|
+
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
17
|
|
9
18
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
10
19
|
|
@@ -16,25 +25,95 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
16
25
|
|
17
26
|
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; }
|
18
27
|
|
28
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
29
|
+
|
30
|
+
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."); }
|
31
|
+
|
32
|
+
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); }
|
33
|
+
|
34
|
+
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; }
|
35
|
+
|
36
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
37
|
+
|
38
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
39
|
+
|
40
|
+
/**
|
41
|
+
* 将可被 ProForm 识别的上下文转换为仅被 ProTable 识别的上下文
|
42
|
+
* @param value
|
43
|
+
* @returns
|
44
|
+
*/
|
45
|
+
var adapterContext = function adapterContext(value) {
|
46
|
+
if ((0, _utils.isStr)(value)) {
|
47
|
+
var contextReg = /^\{\{.*?\}\}$/;
|
48
|
+
|
49
|
+
if (contextReg.test(value)) {
|
50
|
+
return "\0".concat(value, "\0");
|
51
|
+
}
|
52
|
+
|
53
|
+
return value;
|
54
|
+
}
|
55
|
+
|
56
|
+
if ((0, _utils.isPlainObj)(value)) {
|
57
|
+
var temp = {};
|
58
|
+
Object.entries(value).forEach(function (_ref) {
|
59
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
60
|
+
key = _ref2[0],
|
61
|
+
val = _ref2[1];
|
62
|
+
|
63
|
+
temp[key] = adapterContext(val);
|
64
|
+
});
|
65
|
+
return temp;
|
66
|
+
}
|
67
|
+
|
68
|
+
if ((0, _utils.isArr)(value)) {
|
69
|
+
return value.map(function (item) {
|
70
|
+
return adapterContext(item);
|
71
|
+
});
|
72
|
+
}
|
73
|
+
|
74
|
+
return value;
|
75
|
+
};
|
76
|
+
|
19
77
|
var initializeTableColumn = function initializeTableColumn(item) {
|
20
78
|
var name = item.name,
|
21
|
-
title = item.title,
|
22
79
|
children = item.children,
|
80
|
+
props = item.props,
|
23
81
|
otherProps = _objectWithoutProperties(item, _excluded);
|
24
82
|
|
25
83
|
return {
|
26
84
|
name: name,
|
27
|
-
title: title,
|
28
85
|
component: 'SelectTable.Column',
|
29
|
-
children: children
|
30
|
-
|
86
|
+
children: children === null || children === void 0 ? void 0 : children.map(function (item) {
|
87
|
+
return initializeTableColumn(item);
|
88
|
+
}),
|
89
|
+
props: _objectSpread(_objectSpread({}, otherProps), props)
|
31
90
|
};
|
32
91
|
};
|
33
92
|
|
34
93
|
var initialize = function initialize(item) {
|
94
|
+
var _props$columns;
|
95
|
+
|
35
96
|
var _item$children = item.children,
|
36
|
-
children = _item$children === void 0 ? [] : _item$children
|
97
|
+
children = _item$children === void 0 ? [] : _item$children,
|
98
|
+
props = item.props;
|
99
|
+
var prefixCls = (0, _utils.usePrefixCls)('', {
|
100
|
+
prefix: 'teamix-pro-form-select-table-column-tree'
|
101
|
+
});
|
102
|
+
var columns = props === null || props === void 0 ? void 0 : (_props$columns = props.columns) === null || _props$columns === void 0 ? void 0 : _props$columns.map(function (value, index) {
|
103
|
+
var column = adapterContext(value);
|
104
|
+
|
105
|
+
if ((props === null || props === void 0 ? void 0 : props.isTree) && index === 0) {
|
106
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
107
|
+
className: (0, _classnames.default)(column.className, prefixCls)
|
108
|
+
});
|
109
|
+
}
|
110
|
+
|
111
|
+
return column;
|
112
|
+
});
|
37
113
|
return _objectSpread(_objectSpread({}, item), {}, {
|
114
|
+
props: _objectSpread(_objectSpread({}, props), {}, {
|
115
|
+
columns: columns && (0, _pureGenProColumnToColumn.default)(columns)
|
116
|
+
}),
|
38
117
|
children: children.map(function (item) {
|
39
118
|
return initializeTableColumn(item);
|
40
119
|
})
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ProFormRequestConfig } from '../typing';
|
2
|
-
declare const $request: (field: any, { extraConfig, ...
|
3
|
-
declare const $common: (services: any,
|
4
|
-
declare const $validator: (services: any,
|
5
|
-
declare const $dataSource: (services: any,
|
2
|
+
declare const $request: (field: any, context: any, { extraConfig, onComplete, ...rest }: ProFormRequestConfig, type: 'request' | 'validator' | 'dataSource') => Promise<unknown>;
|
3
|
+
declare const $common: (services: any, context: any, requestConfig: ProFormRequestConfig) => (field: any) => any;
|
4
|
+
declare const $validator: (services: any, context: any, requestConfig: ProFormRequestConfig) => (value: any, rules: any, { field }: any) => any;
|
5
|
+
declare const $dataSource: (services: any, context: any, requestConfig: ProFormRequestConfig) => (field: any) => any;
|
6
6
|
export { $request, $common, $dataSource, $validator };
|
@@ -7,7 +7,7 @@ exports.$validator = exports.$request = exports.$dataSource = exports.$common =
|
|
7
7
|
|
8
8
|
var _utils = require("@teamix/utils");
|
9
9
|
|
10
|
-
var _excluded = ["extraConfig"];
|
10
|
+
var _excluded = ["extraConfig", "onComplete"];
|
11
11
|
|
12
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
13
13
|
|
@@ -20,26 +20,28 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
20
20
|
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; }
|
21
21
|
|
22
22
|
// 配置请求
|
23
|
-
var $request = function $request(field,
|
23
|
+
var $request = function $request(field, context, _ref, type) {
|
24
24
|
var _field$data;
|
25
25
|
|
26
26
|
var extraConfig = _ref.extraConfig,
|
27
|
-
|
27
|
+
onComplete = _ref.onComplete,
|
28
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
28
29
|
|
30
|
+
var requestConfig = rest;
|
29
31
|
var params = requestConfig.params,
|
30
32
|
beforeRequest = requestConfig.beforeRequest,
|
31
33
|
formatResult = requestConfig.formatResult,
|
32
34
|
onSuccess = requestConfig.onSuccess;
|
33
|
-
var beforeRequestResult = (0, _utils.isFn)(beforeRequest) ? beforeRequest(field, context) : {};
|
34
|
-
/**
|
35
|
-
* 主动触发的请求刷新
|
36
|
-
*/
|
37
|
-
// 触发所有配置的请求
|
35
|
+
var beforeRequestResult = (0, _utils.isFn)(beforeRequest) ? beforeRequest(field, context) : {}; // 通过字段 data 的 refresh 主动触发的请求刷新
|
38
36
|
|
39
37
|
var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
|
40
|
-
var refreshResult = (0, _utils.isPlainObj)(refresh) ? refresh : {};
|
38
|
+
var refreshResult = (0, _utils.isPlainObj)(refresh) ? refresh : {}; // 合并请求参数
|
39
|
+
|
40
|
+
var mergedParams = _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult); // 执行通用数据请求
|
41
|
+
|
42
|
+
|
41
43
|
return (0, _utils.doCommonRequest)(_objectSpread(_objectSpread({}, requestConfig), {}, {
|
42
|
-
params:
|
44
|
+
params: mergedParams,
|
43
45
|
beforeRequest: function beforeRequest() {
|
44
46
|
return beforeRequestResult;
|
45
47
|
},
|
@@ -49,18 +51,21 @@ var $request = function $request(field, _ref, context, type) {
|
|
49
51
|
onSuccess: (0, _utils.isFn)(onSuccess) ? function (res) {
|
50
52
|
return onSuccess(res, field, context);
|
51
53
|
} : onSuccess
|
52
|
-
}), context)
|
54
|
+
}), _objectSpread(_objectSpread({}, context), {}, {
|
55
|
+
field: field,
|
56
|
+
params: mergedParams
|
57
|
+
}));
|
53
58
|
}; // 通用请求配置上下文
|
54
59
|
|
55
60
|
|
56
61
|
exports.$request = $request;
|
57
62
|
|
58
|
-
var $common = function $common(services,
|
63
|
+
var $common = function $common(services, context, requestConfig) {
|
59
64
|
return function (field) {
|
60
|
-
return services(field,
|
65
|
+
return services(field, context, requestConfig, 'request').then(function (res) {
|
61
66
|
var _requestConfig$onComp;
|
62
67
|
|
63
|
-
return (_requestConfig$onComp = requestConfig.onComplete) === null || _requestConfig$onComp === void 0 ? void 0 : _requestConfig$onComp.call(requestConfig, res, field, context);
|
68
|
+
return requestConfig === null || requestConfig === void 0 ? void 0 : (_requestConfig$onComp = requestConfig.onComplete) === null || _requestConfig$onComp === void 0 ? void 0 : _requestConfig$onComp.call(requestConfig, res, field, context);
|
64
69
|
});
|
65
70
|
};
|
66
71
|
}; // 配置校验
|
@@ -68,13 +73,15 @@ var $common = function $common(services, requestConfig, context) {
|
|
68
73
|
|
69
74
|
exports.$common = $common;
|
70
75
|
|
71
|
-
var $validator = function $validator(services,
|
76
|
+
var $validator = function $validator(services, context, requestConfig) {
|
72
77
|
return function (value, rules, _ref2) {
|
73
78
|
var field = _ref2.field;
|
74
|
-
return services(field,
|
75
|
-
|
76
|
-
|
77
|
-
|
79
|
+
return services(field, context, requestConfig, 'validator').then(function (res) {
|
80
|
+
if (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.onComplete) {
|
81
|
+
return requestConfig.onComplete(res, field, context);
|
82
|
+
} else {
|
83
|
+
return res;
|
84
|
+
}
|
78
85
|
});
|
79
86
|
};
|
80
87
|
}; // 配置DataSource
|
@@ -82,13 +89,13 @@ var $validator = function $validator(services, requestConfig, context) {
|
|
82
89
|
|
83
90
|
exports.$validator = $validator;
|
84
91
|
|
85
|
-
var $dataSource = function $dataSource(services,
|
92
|
+
var $dataSource = function $dataSource(services, context, requestConfig) {
|
86
93
|
return function (field) {
|
87
94
|
field.setState({
|
88
95
|
loading: true
|
89
96
|
});
|
90
|
-
return services(field,
|
91
|
-
var _requestConfig$extraC, _requestConfig$
|
97
|
+
return services(field, context, requestConfig, 'dataSource').then(function (res) {
|
98
|
+
var _requestConfig$extraC, _requestConfig$onComp2;
|
92
99
|
|
93
100
|
var isValueInDataSource = (0, _utils.getValueByValue)(res, field.value);
|
94
101
|
var clearResult = !isValueInDataSource && (requestConfig === null || requestConfig === void 0 ? void 0 : (_requestConfig$extraC = requestConfig.extraConfig) === null || _requestConfig$extraC === void 0 ? void 0 : _requestConfig$extraC.clearInvalidValue) !== false ? {
|
@@ -98,7 +105,7 @@ var $dataSource = function $dataSource(services, requestConfig, context) {
|
|
98
105
|
dataSource: res,
|
99
106
|
loading: false
|
100
107
|
}, clearResult));
|
101
|
-
return (_requestConfig$
|
108
|
+
return requestConfig === null || requestConfig === void 0 ? void 0 : (_requestConfig$onComp2 = requestConfig.onComplete) === null || _requestConfig$onComp2 === void 0 ? void 0 : _requestConfig$onComp2.call(requestConfig, res, field, context);
|
102
109
|
}).catch(function () {
|
103
110
|
field.setState({
|
104
111
|
loading: false
|
package/lib/form/typing.d.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import type { ReactNode } from 'react';
|
2
2
|
import type { IFormFeedback, Form as FormType, FieldPatternTypes } from '@formily/core';
|
3
3
|
import type { IFormLayoutProps } from '@teamix/formily';
|
4
|
-
import { CommonRequestConfig } from '@teamix/utils';
|
4
|
+
import type { CommonRequestConfig } from '@teamix/utils';
|
5
|
+
import type { UrlStateOptions } from '@teamix/hooks';
|
5
6
|
import React from 'react';
|
6
7
|
interface AnyObject {
|
7
8
|
[propName: string]: any;
|
@@ -18,12 +19,16 @@ declare type IBaseComponent = 'Input' | 'Password' | 'TextArea' | 'NumberPicker'
|
|
18
19
|
declare type IButtonComponent = 'Submit' | 'Reset';
|
19
20
|
declare type IComboComponent = 'ArrayCards' | 'ArrayCards.Addition' | 'ArrayCards.Remove' | 'ArrayCards.MoveUp' | 'ArrayCards.MoveDown' | 'ArrayCards.Index' | 'ArrayCollapse' | 'ArrayCollapse.CollapsePanel' | 'ArrayCollapse.Addition' | 'ArrayCollapse.Remove' | 'ArrayCollapse.MoveUp' | 'ArrayCollapse.MoveDown' | 'ArrayCollapse.Index' | 'ArrayTable' | 'ArrayTable.Column' | 'ArrayTable.SortHandle' | 'ArrayTable.Addition' | 'ArrayTable.Remove' | 'ArrayTable.MoveDown' | 'ArrayTable.MoveUp' | 'ArrayTable.Index' | 'ArrayItems' | 'ArrayItems.Item' | 'ArrayItems.SortHandle' | 'ArrayItems.Addition' | 'ArrayItems.Remove' | 'ArrayItems.MoveDown' | 'ArrayItems.MoveUp' | 'ArrayItems.Index' | 'Editable' | 'Editable.Popover' | 'Editable.Dialog' | 'Editable.Drawer';
|
20
21
|
declare type ILayoutComponent = 'FormFlex' | 'FormGrid' | 'FormGroup' | 'FormGroup.GroupPanel' | 'Search' | 'Search.SearchPanel' | 'FormTab' | 'FormTab.TabPane' | 'FormStep' | 'FormStep.StepPane' | 'FormCollapse' | 'FormCollapse.CollapsePanel' | 'FormButtonGroup' | 'FormDialog' | 'FormDrawer' | 'FormDialog.Footer' | 'FormDrawer.Footer';
|
21
|
-
export interface
|
22
|
+
export interface ProFormCommonRequestConfig extends CommonRequestConfig {
|
22
23
|
beforeRequest?: (field?: any, context?: any) => any;
|
23
24
|
formatResult?: (res?: any, field?: any, context?: any) => any;
|
24
25
|
onSuccess?: (res?: any, field?: any, context?: any) => any;
|
25
|
-
|
26
|
+
}
|
27
|
+
export interface ProFormRequestConfig extends Omit<ProFormCommonRequestConfig, 'url'> {
|
28
|
+
url?: string;
|
29
|
+
customRequest?: (field?: any, context?: any) => Promise<any>;
|
26
30
|
extraConfig?: AnyObject;
|
31
|
+
onComplete?: (res?: any, field?: any, context?: any) => any;
|
27
32
|
}
|
28
33
|
export interface ProFormSchemaItem {
|
29
34
|
type?: string;
|
@@ -56,7 +61,7 @@ export interface ProFormSchemaItem {
|
|
56
61
|
export declare type ProFormSchema = ProFormSchemaItem[];
|
57
62
|
export interface ProFormProps extends IFormLayoutProps {
|
58
63
|
form?: FormType | false;
|
59
|
-
schema
|
64
|
+
schema?: ProFormSchema;
|
60
65
|
scope?: any;
|
61
66
|
context?: any;
|
62
67
|
components?: {
|
@@ -64,7 +69,7 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
64
69
|
};
|
65
70
|
children?: React.ReactNode;
|
66
71
|
initialValues?: AnyObject;
|
67
|
-
initialRequest?:
|
72
|
+
initialRequest?: ProFormCommonRequestConfig;
|
68
73
|
previewTextPlaceholder?: ReactNode;
|
69
74
|
validateFirst?: boolean;
|
70
75
|
onChangeType?: 'form';
|
@@ -73,6 +78,9 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
73
78
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
74
79
|
onInitialComplete?: (form: FormType) => void;
|
75
80
|
}
|
81
|
+
export declare type ComposedProForm = React.FC<ProFormProps> & {
|
82
|
+
Field?: React.FC<any>;
|
83
|
+
};
|
76
84
|
export interface FilterProps extends ProFormProps {
|
77
85
|
form: FormType;
|
78
86
|
defaultFilterValue?: string;
|
@@ -117,8 +125,10 @@ export interface QueryFilterProps extends ProFormProps {
|
|
117
125
|
formRef?: React.MutableRefObject<any>;
|
118
126
|
/** onChange事件的防抖时间 */
|
119
127
|
filterDebounce?: number;
|
128
|
+
/** 绑定URL参数 */
|
129
|
+
bindUrl?: boolean | UrlStateOptions;
|
120
130
|
/** 表单初始化(含异步默认值)后回调函数 */
|
121
|
-
onInit?: (values: any) =>
|
131
|
+
onInit?: (values: any) => void;
|
122
132
|
/** 表单筛选回调函数 */
|
123
133
|
onFilter?: (values: any) => void;
|
124
134
|
/** 表单重置回调函数 */
|
package/lib/form/utils.d.ts
CHANGED
@@ -37,4 +37,19 @@ declare const mapSchemaName: (obj: any) => any;
|
|
37
37
|
* @returns 合并数组或合并其他值
|
38
38
|
*/
|
39
39
|
declare const mergeArrayValue: (arr: any[], v?: any) => any[];
|
40
|
-
|
40
|
+
/**
|
41
|
+
* 初始化请求配置为表达式
|
42
|
+
* @param config 请求配置
|
43
|
+
* @param suffix scope名称后缀
|
44
|
+
* @returns 表达式和scope上下文
|
45
|
+
*/
|
46
|
+
declare const initializeRequestExpression: (config?: any, mode?: string | undefined, suffix?: string | undefined) => {
|
47
|
+
expression: string;
|
48
|
+
scope: {
|
49
|
+
[x: string]: object;
|
50
|
+
};
|
51
|
+
} | {
|
52
|
+
expression?: undefined;
|
53
|
+
scope?: undefined;
|
54
|
+
};
|
55
|
+
export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getFieldName, mapSchemaName, initializeRequestExpression, };
|
package/lib/form/utils.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.mergeArrayValue = exports.mapStatus = exports.mapSize = exports.mapSchemaName = exports.mapMode = exports.mapDataSource = exports.getFieldName = void 0;
|
6
|
+
exports.mergeArrayValue = exports.mapStatus = exports.mapSize = exports.mapSchemaName = exports.mapMode = exports.mapDataSource = exports.initializeRequestExpression = exports.getFieldName = void 0;
|
7
7
|
|
8
8
|
var _core = require("@formily/core");
|
9
9
|
|
@@ -201,5 +201,26 @@ var mergeArrayValue = function mergeArrayValue(arr, v) {
|
|
201
201
|
|
202
202
|
return [].concat(_toConsumableArray(arr), [v]);
|
203
203
|
};
|
204
|
+
/**
|
205
|
+
* 初始化请求配置为表达式
|
206
|
+
* @param config 请求配置
|
207
|
+
* @param suffix scope名称后缀
|
208
|
+
* @returns 表达式和scope上下文
|
209
|
+
*/
|
210
|
+
|
211
|
+
|
212
|
+
exports.mergeArrayValue = mergeArrayValue;
|
213
|
+
|
214
|
+
var initializeRequestExpression = function initializeRequestExpression(config, mode, suffix) {
|
215
|
+
if ((0, _utils.isPlainObj)(config)) {
|
216
|
+
var requestConfigName = "$requestConfig_".concat(suffix);
|
217
|
+
return {
|
218
|
+
expression: "{{".concat(mode, "($request,context,").concat(requestConfigName, ")}}"),
|
219
|
+
scope: _defineProperty({}, requestConfigName, config)
|
220
|
+
};
|
221
|
+
}
|
222
|
+
|
223
|
+
return {};
|
224
|
+
};
|
204
225
|
|
205
|
-
exports.
|
226
|
+
exports.initializeRequestExpression = initializeRequestExpression;
|
package/lib/global.scss
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
// transition 切换主题优化,暂时先写到 pro 里,后面加到基础组件里
|
2
|
+
|
3
|
+
// table 行背景色
|
4
|
+
tr.next-table-row{
|
5
|
+
transition: color 0s;
|
6
|
+
}
|
7
|
+
|
8
|
+
// normal 按钮
|
9
|
+
button.next-btn.next-medium.next-btn-normal {
|
10
|
+
transition: color 0s;
|
11
|
+
}
|
12
|
+
|
13
|
+
// input 背景色
|
14
|
+
.next-input.next-medium {
|
15
|
+
transition: color 0s;
|
16
|
+
}
|
17
|
+
|
18
|
+
// radio 背景色
|
19
|
+
.next-radio-wrapper.checked .next-radio-inner:after {
|
20
|
+
transition: color 0s;
|
21
|
+
}
|
22
|
+
|
23
|
+
.next-radio-wrapper .next-radio-inner {
|
24
|
+
transition: color 0s;
|
25
|
+
}
|
26
|
+
|
27
|
+
// checkbox 背景色
|
28
|
+
.next-checkbox-wrapper .next-checkbox-inner {
|
29
|
+
transition: color 0s;
|
30
|
+
}
|
31
|
+
|
32
|
+
// 侧导背景色
|
33
|
+
.next-menu-item.next-nav-item {
|
34
|
+
transition: color 0s;
|
35
|
+
}
|
36
|
+
|
37
|
+
// 标签背景色
|
38
|
+
.next-tag {
|
39
|
+
transition: color 0s;
|
40
|
+
}
|
41
|
+
|
42
|
+
// 可关闭tag
|
43
|
+
.next-tag.next-tag.next-tag.next-tag-closable.next-tag-level-normal.next-tag-closable {
|
44
|
+
transition: color 0s;
|
45
|
+
}
|
package/lib/index.d.ts
CHANGED
@@ -13,6 +13,7 @@ import ProSidebar from './sidebar';
|
|
13
13
|
import { ProTimeline } from './timeline';
|
14
14
|
import * as nocode from './nocode';
|
15
15
|
import * as templates from './templates';
|
16
|
+
import './global.scss';
|
16
17
|
export * from './actions';
|
17
18
|
export * from './card';
|
18
19
|
export * from './field';
|
@@ -26,5 +27,5 @@ export * from './table';
|
|
26
27
|
export * from './sidebar';
|
27
28
|
export * from './utils';
|
28
29
|
export * from './timeline';
|
29
|
-
declare const version = "1.3.
|
30
|
+
declare const version = "1.3.16";
|
30
31
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -295,6 +295,8 @@ exports.templates = templates;
|
|
295
295
|
|
296
296
|
var _icon = _interopRequireDefault(require("@teamix/icon"));
|
297
297
|
|
298
|
+
require("./global.scss");
|
299
|
+
|
298
300
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
299
301
|
|
300
302
|
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); }
|
@@ -305,5 +307,5 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
305
307
|
// 设置图标源
|
306
308
|
_icon.default.setConfig(_utils.default.getTeamixIconConfig());
|
307
309
|
|
308
|
-
var version = '1.3.
|
310
|
+
var version = '1.3.16';
|
309
311
|
exports.version = version;
|
package/lib/page-header/index.js
CHANGED
@@ -27,7 +27,7 @@ require("./index.scss");
|
|
27
27
|
|
28
28
|
var _excluded = ["text", "children"],
|
29
29
|
_excluded2 = ["color", "title", "num", "className"],
|
30
|
-
_excluded3 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style", "tabs"];
|
30
|
+
_excluded3 = ["title", "titleTooltip", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style", "tabs"];
|
31
31
|
|
32
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
33
|
|
@@ -42,6 +42,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
42
42
|
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; }
|
43
43
|
|
44
44
|
var cls = (0, _utils.baseClass)('teamix-pro-page-header');
|
45
|
+
var Tooltip = _components.Balloon.Tooltip;
|
45
46
|
|
46
47
|
var renderNav = function renderNav(breadcrumbs) {
|
47
48
|
if (breadcrumbs && breadcrumbs.length) {
|
@@ -152,6 +153,7 @@ var renderTabs = function renderTabs(tabs) {
|
|
152
153
|
|
153
154
|
var ProPageHeader = function ProPageHeader(props) {
|
154
155
|
var title = props.title,
|
156
|
+
titleTooltip = props.titleTooltip,
|
155
157
|
description = props.description,
|
156
158
|
icon = props.icon,
|
157
159
|
iconColor = props.iconColor,
|
@@ -219,7 +221,15 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
219
221
|
size: "large"
|
220
222
|
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon)), /*#__PURE__*/_react.default.createElement("span", {
|
221
223
|
className: cls('title-name')
|
222
|
-
}, title
|
224
|
+
}, title, titleTooltip && /*#__PURE__*/_react.default.createElement(Tooltip, {
|
225
|
+
trigger: /*#__PURE__*/_react.default.createElement("span", {
|
226
|
+
className: cls('title-tooltip-icon')
|
227
|
+
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
228
|
+
type: "info-circle-line",
|
229
|
+
size: "xs"
|
230
|
+
})),
|
231
|
+
align: "t"
|
232
|
+
}, titleTooltip)), (0, _utils.renderTags)(tags, 'large'), renderTabs(tabs !== null && tabs !== void 0 ? tabs : {}));
|
223
233
|
};
|
224
234
|
|
225
235
|
return /*#__PURE__*/_react.default.createElement("header", _objectSpread({
|
@@ -43,6 +43,7 @@ $prefix: 'teamix-pro-page-header';
|
|
43
43
|
font-weight: 500;
|
44
44
|
align-items: center;
|
45
45
|
word-break: break-all;
|
46
|
+
color: var(--color-text1-4);
|
46
47
|
|
47
48
|
&-name {
|
48
49
|
white-space: nowrap;
|
@@ -50,6 +51,13 @@ $prefix: 'teamix-pro-page-header';
|
|
50
51
|
text-overflow: ellipsis;
|
51
52
|
}
|
52
53
|
|
54
|
+
&-tooltip-icon {
|
55
|
+
position: relative;
|
56
|
+
margin-left: 2px;
|
57
|
+
display: inline-flex;
|
58
|
+
top: -7px;
|
59
|
+
}
|
60
|
+
|
53
61
|
&-icon {
|
54
62
|
padding: var(--s-1, 4px);
|
55
63
|
}
|
@@ -32,11 +32,11 @@ $prefix: 'teamix-pro-table-layout';
|
|
32
32
|
&-filter-btn:not(:first-child) {
|
33
33
|
margin-left: 8px;
|
34
34
|
}
|
35
|
-
&-panel-filter {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}
|
35
|
+
// &-panel-filter {
|
36
|
+
// margin: 8px 0;
|
37
|
+
// padding: 16px;
|
38
|
+
// background: var(--panel-filter-bg, var(--color-fill1-2));
|
39
|
+
// }
|
40
40
|
&-main-action {
|
41
41
|
margin-bottom: 8px;
|
42
42
|
}
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
import './index.scss';
|
3
3
|
import { ProTableActionType } from '../../typing';
|
4
4
|
declare type ProTableFullScreenProps = {
|
5
|
-
children: React.ReactNode;
|
5
|
+
children: (isFullScreen: boolean) => React.ReactNode | React.ReactNode;
|
6
6
|
visible: boolean;
|
7
7
|
actionRef: React.MutableRefObject<ProTableActionType | undefined>;
|
8
8
|
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ProTableColumnProps } from '../typing';
|
2
|
+
/**
|
3
|
+
* 增加了 icon 的功能 render title
|
4
|
+
*/
|
5
|
+
export declare const renderColumnsTitle: (item: ProTableColumnProps) => JSX.Element;
|
6
|
+
/**
|
7
|
+
* 负责单元格的具体渲染
|
8
|
+
*/
|
9
|
+
export declare const renderCell: (value: any, item: ProTableColumnProps, index: number, record: any) => JSX.Element;
|