@teamix/pro 1.5.46 → 1.5.48-beta.1
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.js +221 -50
- package/dist/pro.min.js +1 -1
- package/es/form/Components/SelectTable2/index.d.ts +1 -0
- package/es/form/Filter/useBindUrl.js +55 -35
- package/es/form/ProForm/index.d.ts +2 -2
- package/es/form/ProForm/index.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/page-header/index.js +2 -2
- package/es/sidebar/utils/index.d.ts +1 -1
- package/es/table/components/Filter/index.js +3 -1
- package/es/table/index.js +5 -2
- package/es/table/typing.d.ts +2 -0
- package/es/utils/aspect.d.ts +2 -0
- package/es/utils/aspect.js +63 -0
- package/lib/form/Components/SelectTable2/index.d.ts +1 -0
- package/lib/form/Filter/useBindUrl.js +55 -35
- package/lib/form/ProForm/index.d.ts +2 -2
- package/lib/form/ProForm/index.js +2 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/page-header/index.js +1 -1
- package/lib/sidebar/utils/index.d.ts +1 -1
- package/lib/table/components/Filter/index.js +3 -1
- package/lib/table/index.js +5 -2
- package/lib/table/typing.d.ts +2 -0
- package/lib/utils/aspect.d.ts +2 -0
- package/lib/utils/aspect.js +70 -0
- package/package.json +1 -1
@@ -93,5 +93,6 @@ declare const SelectTable2: React.ForwardRefExoticComponent<Partial<{
|
|
93
93
|
columnProps?: (() => any) | undefined;
|
94
94
|
titleAddons?: (() => any) | undefined;
|
95
95
|
}) | undefined;
|
96
|
+
key?: React.Key | null | undefined;
|
96
97
|
} & Omit<import("@alifd/next/types/table").TableProps, "rowSelection" | "columns"> & import("../../../table").ProTableTopAreaProps> & React.RefAttributes<unknown>>;
|
97
98
|
export default SelectTable2;
|
@@ -27,7 +27,7 @@ export default function useBindUrl(bindUrl, functions, formRef) {
|
|
27
27
|
var field = form === null || form === void 0 ? void 0 : (_form$query = form.query(key)) === null || _form$query === void 0 ? void 0 : _form$query.take();
|
28
28
|
var component = field === null || field === void 0 ? void 0 : field.component;
|
29
29
|
if (component instanceof Array && component[0] === 'SelectGroup') {
|
30
|
-
newValues[key] = value.map(function (_ref3) {
|
30
|
+
newValues[key] = (value !== null && value !== void 0 ? value : []).map(function (_ref3) {
|
31
31
|
var key = _ref3.key,
|
32
32
|
value = _ref3.value;
|
33
33
|
return key && value ? "".concat(key, "||").concat(value === null || value === void 0 ? void 0 : value.join('|')) : '';
|
@@ -35,21 +35,50 @@ export default function useBindUrl(bindUrl, functions, formRef) {
|
|
35
35
|
}
|
36
36
|
});
|
37
37
|
return beforeStringify ? beforeStringify(newValues) : newValues;
|
38
|
+
},
|
39
|
+
beforeParse: function beforeParse(values) {
|
40
|
+
var _Object$entries2;
|
41
|
+
var beforeParse = options.beforeParse;
|
42
|
+
var newValues = _objectSpread({}, values);
|
43
|
+
(_Object$entries2 = Object.entries(values)) === null || _Object$entries2 === void 0 ? void 0 : _Object$entries2.forEach(function (_ref4) {
|
44
|
+
var _form$query2;
|
45
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
46
|
+
key = _ref5[0],
|
47
|
+
value = _ref5[1];
|
48
|
+
var form = formRef.current;
|
49
|
+
var field = form === null || form === void 0 ? void 0 : (_form$query2 = form.query(key)) === null || _form$query2 === void 0 ? void 0 : _form$query2.take();
|
50
|
+
var component = field === null || field === void 0 ? void 0 : field.component;
|
51
|
+
if (component instanceof Array && component[0] === 'SelectGroup') {
|
52
|
+
newValues[key] = (value !== null && value !== void 0 ? value : []).map(function (item) {
|
53
|
+
var _item$split = item === null || item === void 0 ? void 0 : item.split('||'),
|
54
|
+
_item$split2 = _slicedToArray(_item$split, 2),
|
55
|
+
key = _item$split2[0],
|
56
|
+
value = _item$split2[1];
|
57
|
+
return {
|
58
|
+
key: key,
|
59
|
+
value: value === null || value === void 0 ? void 0 : value.split('|')
|
60
|
+
};
|
61
|
+
});
|
62
|
+
}
|
63
|
+
});
|
64
|
+
return beforeParse ? beforeParse(newValues) : newValues;
|
38
65
|
}
|
39
66
|
}) : options;
|
40
67
|
};
|
41
68
|
// 通过 useUrlState 获取 url 上的参数和 url 配置方法
|
42
|
-
var
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
69
|
+
var _ref6 = bindUrl ? useUrlState(undefined, _objectSpread(_objectSpread({}, initializeBindUrl(isPlainObj(bindUrl) ? bindUrl : {})), {}, {
|
70
|
+
navigateMode: 'replace'
|
71
|
+
})) : [],
|
72
|
+
_ref7 = _slicedToArray(_ref6, 4),
|
73
|
+
urlState = _ref7[0],
|
74
|
+
setUrlState = _ref7[1],
|
75
|
+
queryFromUrl = _ref7[2],
|
76
|
+
stringify = _ref7[3];
|
48
77
|
// 输出配置url参数的函数
|
49
|
-
var initializedFunctions = Object.entries(functions).reduce(function (prev,
|
50
|
-
var
|
51
|
-
listenerKey =
|
52
|
-
originalFunction =
|
78
|
+
var initializedFunctions = Object.entries(functions).reduce(function (prev, _ref8) {
|
79
|
+
var _ref9 = _slicedToArray(_ref8, 2),
|
80
|
+
listenerKey = _ref9[0],
|
81
|
+
originalFunction = _ref9[1];
|
53
82
|
prev[listenerKey] = function (values) {
|
54
83
|
originalFunction === null || originalFunction === void 0 ? void 0 : originalFunction(values);
|
55
84
|
if (bindUrl) {
|
@@ -64,11 +93,7 @@ export default function useBindUrl(bindUrl, functions, formRef) {
|
|
64
93
|
// { a: [undefined, undefined], b: undefined, c: [], d: null, e: ''} 会生成 'd=&e='
|
65
94
|
// 类似地,{ a: [''], b: [null], c: [undefined] } 会生成 'a=&b='。更不用说还有非默认配置的情况
|
66
95
|
// 想要避免这种 hazard,我们必须使用钩子内部导出的、经过柯里化的 stringify 来判断生成的字符串是否无变化。
|
67
|
-
if (stringify({
|
68
|
-
v: newValue
|
69
|
-
}) !== stringify({
|
70
|
-
v: oldValue
|
71
|
-
})) {
|
96
|
+
if (stringify(_defineProperty({}, paramName, newValue)) !== stringify(_defineProperty({}, paramName, oldValue))) {
|
72
97
|
hasStringifiedDiff = true;
|
73
98
|
break;
|
74
99
|
} else if (oldValue !== newValue) {
|
@@ -89,30 +114,25 @@ export default function useBindUrl(bindUrl, functions, formRef) {
|
|
89
114
|
// 使用 url 参数配置 QueryFilter 默认值(移除非表单值,兼容数组数据,兼容 SelectGroup 组件)
|
90
115
|
var setValuesByUrlState = function setValuesByUrlState(form) {
|
91
116
|
if (urlState) {
|
92
|
-
var _Object$
|
93
|
-
(_Object$
|
94
|
-
var _form$
|
95
|
-
var
|
96
|
-
key =
|
97
|
-
value =
|
98
|
-
var field = (_form$
|
117
|
+
var _Object$entries3;
|
118
|
+
(_Object$entries3 = Object.entries(urlState)) === null || _Object$entries3 === void 0 ? void 0 : _Object$entries3.forEach(function (_ref10) {
|
119
|
+
var _form$query3;
|
120
|
+
var _ref11 = _slicedToArray(_ref10, 2),
|
121
|
+
key = _ref11[0],
|
122
|
+
value = _ref11[1];
|
123
|
+
var field = (_form$query3 = form.query(key)) === null || _form$query3 === void 0 ? void 0 : _form$query3.take();
|
99
124
|
if (field) {
|
100
125
|
var newValue = value;
|
101
126
|
if (field.displayName === 'ArrayField') {
|
102
127
|
newValue = [].concat(isUsable(newValue) ? newValue : []);
|
103
128
|
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
key: key,
|
112
|
-
value: value === null || value === void 0 ? void 0 : value.split('|')
|
113
|
-
};
|
114
|
-
});
|
115
|
-
}
|
129
|
+
// 这部分应该挪到上面的 beforeParse 里面做,beforeParse 和 beforeStringify 应该是互逆的
|
130
|
+
// if (field.component[0] === 'SelectGroup') {
|
131
|
+
// newValue = newValue.map((item: any) => {
|
132
|
+
// const [key, value] = item?.split('||');
|
133
|
+
// return { key, value: value?.split('|') };
|
134
|
+
// });
|
135
|
+
// }
|
116
136
|
form.setValuesIn(key, newValue);
|
117
137
|
}
|
118
138
|
});
|
package/es/form/ProForm/index.js
CHANGED
@@ -24,6 +24,7 @@ import validateLocale from '../locales/validate';
|
|
24
24
|
import './index.scss';
|
25
25
|
import FormItem2 from '../Components/FormItem2';
|
26
26
|
import SelectTable2 from '../Components/SelectTable2';
|
27
|
+
import { ProComponentAspect } from '../../utils/aspect';
|
27
28
|
registerValidateLocale(validateLocale);
|
28
29
|
var formilyComponents = {
|
29
30
|
FormLayout: FormLayout,
|
@@ -151,4 +152,4 @@ ProForm.defaultProps = {
|
|
151
152
|
breakpoints: true,
|
152
153
|
labelAlign: 'left'
|
153
154
|
};
|
154
|
-
export default ProForm;
|
155
|
+
export default ProComponentAspect(ProForm, 'ProForm');
|
package/es/index.d.ts
CHANGED
@@ -30,5 +30,5 @@ export * from './sidebar';
|
|
30
30
|
export * from './utils';
|
31
31
|
export * from './timeline';
|
32
32
|
export * from './image';
|
33
|
-
declare const version = "1.5.
|
33
|
+
declare const version = "1.5.48-beta.1";
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
package/es/page-header/index.js
CHANGED
@@ -8,7 +8,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
8
8
|
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; }
|
9
9
|
import React from 'react';
|
10
10
|
// import { useHistory } from 'react-router-dom';
|
11
|
-
import {
|
11
|
+
import { useReactHistory } from '@teamix/utils';
|
12
12
|
import classnames from 'classnames';
|
13
13
|
import TeamixIcon from '@teamix/icon';
|
14
14
|
import { Breadcrumb, Balloon } from '@alicloudfe/components';
|
@@ -132,7 +132,7 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
132
132
|
style = props.style,
|
133
133
|
tabs = props.tabs,
|
134
134
|
others = _objectWithoutProperties(props, _excluded3);
|
135
|
-
var history =
|
135
|
+
var history = useReactHistory();
|
136
136
|
var backgroundImage = image ? "url('".concat(image, "')") : undefined;
|
137
137
|
var showList = function showList(list) {
|
138
138
|
var _list$actions;
|
@@ -152,7 +152,7 @@ export declare function getTreeNodeProps(item: ProSidebarDataSourceItem): {
|
|
152
152
|
'aria-colindex'?: number | undefined;
|
153
153
|
'aria-colspan'?: number | undefined;
|
154
154
|
'aria-controls'?: string | undefined;
|
155
|
-
'aria-current'?: boolean | "date" | "time" | "page" | "false" | "true" | "step" |
|
155
|
+
'aria-current'?: boolean | "location" | "date" | "time" | "page" | "false" | "true" | "step" | undefined;
|
156
156
|
'aria-describedby'?: string | undefined;
|
157
157
|
'aria-details'?: string | undefined;
|
158
158
|
'aria-disabled'?: (boolean | "false" | "true") | undefined;
|
@@ -33,7 +33,9 @@ var Filter = function Filter(props) {
|
|
33
33
|
filtersWidth = _column$filtersWidth === void 0 ? 130 : _column$filtersWidth,
|
34
34
|
_column$defaultFilter = column.defaultFilterSelectedKeys,
|
35
35
|
defaultFilterSelectedKeys = _column$defaultFilter === void 0 ? [] : _column$defaultFilter;
|
36
|
-
var _ref = bindUrl ? useUrlState(
|
36
|
+
var _ref = bindUrl ? useUrlState({}, {
|
37
|
+
navigateMode: 'replace'
|
38
|
+
}) : [],
|
37
39
|
_ref2 = _slicedToArray(_ref, 2),
|
38
40
|
urlState = _ref2[0],
|
39
41
|
setUrlState = _ref2[1];
|
package/es/table/index.js
CHANGED
@@ -135,7 +135,9 @@ var ProTable = function ProTable(props) {
|
|
135
135
|
var targetPageKey = pageKey || globalPageKey;
|
136
136
|
var targetPageSizeKey = pageSizeKey || globalPageSizeKey;
|
137
137
|
var targetFormatSort = formatSort || globalFormatSort;
|
138
|
-
var _ref = bindUrl ? useUrlState(
|
138
|
+
var _ref = bindUrl ? useUrlState({}, {
|
139
|
+
navigateMode: 'replace'
|
140
|
+
}) : [],
|
139
141
|
_ref2 = _slicedToArray(_ref, 2),
|
140
142
|
urlState = _ref2[0],
|
141
143
|
setUrlState = _ref2[1];
|
@@ -1199,7 +1201,8 @@ var ProTable = function ProTable(props) {
|
|
1199
1201
|
}, [fullscreenState, fixedTableBody, footerSuction, footerSuctionState]);
|
1200
1202
|
return /*#__PURE__*/React.createElement(FullScreen, {
|
1201
1203
|
visible: fullscreenState,
|
1202
|
-
actionRef: actionRef
|
1204
|
+
actionRef: actionRef,
|
1205
|
+
key: props.key
|
1203
1206
|
}, function (isFullScreen) {
|
1204
1207
|
return /*#__PURE__*/React.createElement("div", {
|
1205
1208
|
className: cls({
|
package/es/table/typing.d.ts
CHANGED
@@ -189,6 +189,8 @@ export declare type ProTableProps = {
|
|
189
189
|
/** 使用超大数据模式 **/
|
190
190
|
useMaxData?: boolean;
|
191
191
|
rowSelection?: rowSelectionType;
|
192
|
+
/** React Key **/
|
193
|
+
key?: React.Key | null;
|
192
194
|
} & Omit<TableProps, 'columns' | 'rowSelection'> & ProTableTopAreaProps;
|
193
195
|
export declare type rowSelectionType = {
|
194
196
|
getProps?: (record: any, index: number) => any;
|
@@ -0,0 +1,63 @@
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
2
|
+
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; }
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
4
|
+
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; }
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
8
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
9
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
10
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
11
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
12
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
13
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
15
|
+
import React from 'react';
|
16
|
+
export function ProComponentAspect(WrapComponent, componentName) {
|
17
|
+
return /*#__PURE__*/function (_React$Component) {
|
18
|
+
_inherits(ProComponent, _React$Component);
|
19
|
+
var _super = _createSuper(ProComponent);
|
20
|
+
function ProComponent() {
|
21
|
+
var _this;
|
22
|
+
_classCallCheck(this, ProComponent);
|
23
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
24
|
+
args[_key] = arguments[_key];
|
25
|
+
}
|
26
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
27
|
+
_this.state = {
|
28
|
+
name: 'alien'
|
29
|
+
};
|
30
|
+
return _this;
|
31
|
+
}
|
32
|
+
_createClass(ProComponent, [{
|
33
|
+
key: "componentDidMount",
|
34
|
+
value: function componentDidMount() {
|
35
|
+
// @ts-ignore
|
36
|
+
if (!!window.ProComponentBeforeAspect) {
|
37
|
+
// @ts-ignore
|
38
|
+
if (window.ProComponentBeforeAspectDebugger) {
|
39
|
+
console.log('HOC', componentName);
|
40
|
+
console.log('Props', this.props);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}, {
|
45
|
+
key: "render",
|
46
|
+
value: function render() {
|
47
|
+
// @ts-ignore
|
48
|
+
if (window.ProComponentBeforeAspect) {
|
49
|
+
var _window$ProComponentB, _window;
|
50
|
+
// @ts-ignore
|
51
|
+
var props = (_window$ProComponentB = (_window = window).ProComponentBeforeAspect) === null || _window$ProComponentB === void 0 ? void 0 : _window$ProComponentB.call(_window, componentName, this.props);
|
52
|
+
// @ts-ignore
|
53
|
+
if (window.ProComponentBeforeAspectDebugger) {
|
54
|
+
console.log('NewProps', props);
|
55
|
+
}
|
56
|
+
return /*#__PURE__*/React.createElement(WrapComponent, _objectSpread({}, props));
|
57
|
+
}
|
58
|
+
return /*#__PURE__*/React.createElement(WrapComponent, _objectSpread({}, this.props));
|
59
|
+
}
|
60
|
+
}]);
|
61
|
+
return ProComponent;
|
62
|
+
}(React.Component);
|
63
|
+
}
|
@@ -93,5 +93,6 @@ declare const SelectTable2: React.ForwardRefExoticComponent<Partial<{
|
|
93
93
|
columnProps?: (() => any) | undefined;
|
94
94
|
titleAddons?: (() => any) | undefined;
|
95
95
|
}) | undefined;
|
96
|
+
key?: React.Key | null | undefined;
|
96
97
|
} & Omit<import("@alifd/next/types/table").TableProps, "rowSelection" | "columns"> & import("../../../table").ProTableTopAreaProps> & React.RefAttributes<unknown>>;
|
97
98
|
export default SelectTable2;
|
@@ -33,7 +33,7 @@ function useBindUrl(bindUrl, functions, formRef) {
|
|
33
33
|
var field = form === null || form === void 0 ? void 0 : (_form$query = form.query(key)) === null || _form$query === void 0 ? void 0 : _form$query.take();
|
34
34
|
var component = field === null || field === void 0 ? void 0 : field.component;
|
35
35
|
if (component instanceof Array && component[0] === 'SelectGroup') {
|
36
|
-
newValues[key] = value.map(function (_ref3) {
|
36
|
+
newValues[key] = (value !== null && value !== void 0 ? value : []).map(function (_ref3) {
|
37
37
|
var key = _ref3.key,
|
38
38
|
value = _ref3.value;
|
39
39
|
return key && value ? "".concat(key, "||").concat(value === null || value === void 0 ? void 0 : value.join('|')) : '';
|
@@ -41,21 +41,50 @@ function useBindUrl(bindUrl, functions, formRef) {
|
|
41
41
|
}
|
42
42
|
});
|
43
43
|
return beforeStringify ? beforeStringify(newValues) : newValues;
|
44
|
+
},
|
45
|
+
beforeParse: function beforeParse(values) {
|
46
|
+
var _Object$entries2;
|
47
|
+
var beforeParse = options.beforeParse;
|
48
|
+
var newValues = _objectSpread({}, values);
|
49
|
+
(_Object$entries2 = Object.entries(values)) === null || _Object$entries2 === void 0 ? void 0 : _Object$entries2.forEach(function (_ref4) {
|
50
|
+
var _form$query2;
|
51
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
52
|
+
key = _ref5[0],
|
53
|
+
value = _ref5[1];
|
54
|
+
var form = formRef.current;
|
55
|
+
var field = form === null || form === void 0 ? void 0 : (_form$query2 = form.query(key)) === null || _form$query2 === void 0 ? void 0 : _form$query2.take();
|
56
|
+
var component = field === null || field === void 0 ? void 0 : field.component;
|
57
|
+
if (component instanceof Array && component[0] === 'SelectGroup') {
|
58
|
+
newValues[key] = (value !== null && value !== void 0 ? value : []).map(function (item) {
|
59
|
+
var _item$split = item === null || item === void 0 ? void 0 : item.split('||'),
|
60
|
+
_item$split2 = _slicedToArray(_item$split, 2),
|
61
|
+
key = _item$split2[0],
|
62
|
+
value = _item$split2[1];
|
63
|
+
return {
|
64
|
+
key: key,
|
65
|
+
value: value === null || value === void 0 ? void 0 : value.split('|')
|
66
|
+
};
|
67
|
+
});
|
68
|
+
}
|
69
|
+
});
|
70
|
+
return beforeParse ? beforeParse(newValues) : newValues;
|
44
71
|
}
|
45
72
|
}) : options;
|
46
73
|
};
|
47
74
|
// 通过 useUrlState 获取 url 上的参数和 url 配置方法
|
48
|
-
var
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
75
|
+
var _ref6 = bindUrl ? (0, _hooks.useUrlState)(undefined, _objectSpread(_objectSpread({}, initializeBindUrl((0, _utils.isPlainObj)(bindUrl) ? bindUrl : {})), {}, {
|
76
|
+
navigateMode: 'replace'
|
77
|
+
})) : [],
|
78
|
+
_ref7 = _slicedToArray(_ref6, 4),
|
79
|
+
urlState = _ref7[0],
|
80
|
+
setUrlState = _ref7[1],
|
81
|
+
queryFromUrl = _ref7[2],
|
82
|
+
stringify = _ref7[3];
|
54
83
|
// 输出配置url参数的函数
|
55
|
-
var initializedFunctions = Object.entries(functions).reduce(function (prev,
|
56
|
-
var
|
57
|
-
listenerKey =
|
58
|
-
originalFunction =
|
84
|
+
var initializedFunctions = Object.entries(functions).reduce(function (prev, _ref8) {
|
85
|
+
var _ref9 = _slicedToArray(_ref8, 2),
|
86
|
+
listenerKey = _ref9[0],
|
87
|
+
originalFunction = _ref9[1];
|
59
88
|
prev[listenerKey] = function (values) {
|
60
89
|
originalFunction === null || originalFunction === void 0 ? void 0 : originalFunction(values);
|
61
90
|
if (bindUrl) {
|
@@ -70,11 +99,7 @@ function useBindUrl(bindUrl, functions, formRef) {
|
|
70
99
|
// { a: [undefined, undefined], b: undefined, c: [], d: null, e: ''} 会生成 'd=&e='
|
71
100
|
// 类似地,{ a: [''], b: [null], c: [undefined] } 会生成 'a=&b='。更不用说还有非默认配置的情况
|
72
101
|
// 想要避免这种 hazard,我们必须使用钩子内部导出的、经过柯里化的 stringify 来判断生成的字符串是否无变化。
|
73
|
-
if (stringify({
|
74
|
-
v: newValue
|
75
|
-
}) !== stringify({
|
76
|
-
v: oldValue
|
77
|
-
})) {
|
102
|
+
if (stringify(_defineProperty({}, paramName, newValue)) !== stringify(_defineProperty({}, paramName, oldValue))) {
|
78
103
|
hasStringifiedDiff = true;
|
79
104
|
break;
|
80
105
|
} else if (oldValue !== newValue) {
|
@@ -95,30 +120,25 @@ function useBindUrl(bindUrl, functions, formRef) {
|
|
95
120
|
// 使用 url 参数配置 QueryFilter 默认值(移除非表单值,兼容数组数据,兼容 SelectGroup 组件)
|
96
121
|
var setValuesByUrlState = function setValuesByUrlState(form) {
|
97
122
|
if (urlState) {
|
98
|
-
var _Object$
|
99
|
-
(_Object$
|
100
|
-
var _form$
|
101
|
-
var
|
102
|
-
key =
|
103
|
-
value =
|
104
|
-
var field = (_form$
|
123
|
+
var _Object$entries3;
|
124
|
+
(_Object$entries3 = Object.entries(urlState)) === null || _Object$entries3 === void 0 ? void 0 : _Object$entries3.forEach(function (_ref10) {
|
125
|
+
var _form$query3;
|
126
|
+
var _ref11 = _slicedToArray(_ref10, 2),
|
127
|
+
key = _ref11[0],
|
128
|
+
value = _ref11[1];
|
129
|
+
var field = (_form$query3 = form.query(key)) === null || _form$query3 === void 0 ? void 0 : _form$query3.take();
|
105
130
|
if (field) {
|
106
131
|
var newValue = value;
|
107
132
|
if (field.displayName === 'ArrayField') {
|
108
133
|
newValue = [].concat((0, _utils.isUsable)(newValue) ? newValue : []);
|
109
134
|
}
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
key: key,
|
118
|
-
value: value === null || value === void 0 ? void 0 : value.split('|')
|
119
|
-
};
|
120
|
-
});
|
121
|
-
}
|
135
|
+
// 这部分应该挪到上面的 beforeParse 里面做,beforeParse 和 beforeStringify 应该是互逆的
|
136
|
+
// if (field.component[0] === 'SelectGroup') {
|
137
|
+
// newValue = newValue.map((item: any) => {
|
138
|
+
// const [key, value] = item?.split('||');
|
139
|
+
// return { key, value: value?.split('|') };
|
140
|
+
// });
|
141
|
+
// }
|
122
142
|
form.setValuesIn(key, newValue);
|
123
143
|
}
|
124
144
|
});
|
@@ -25,6 +25,7 @@ var _validate = _interopRequireDefault(require("../locales/validate"));
|
|
25
25
|
require("./index.scss");
|
26
26
|
var _FormItem = _interopRequireDefault(require("../Components/FormItem2"));
|
27
27
|
var _SelectTable = _interopRequireDefault(require("../Components/SelectTable2"));
|
28
|
+
var _aspect = require("../../utils/aspect");
|
28
29
|
var _excluded = ["form", "initialValues", "initialRequest", "scope", "context", "components", "onChange", "onChangeType", "onSubmit", "onSubmitFailed", "onInitialComplete", "className", "validateFirst", "schema", "children"];
|
29
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
30
31
|
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); }
|
@@ -161,5 +162,5 @@ ProForm.defaultProps = {
|
|
161
162
|
breakpoints: true,
|
162
163
|
labelAlign: 'left'
|
163
164
|
};
|
164
|
-
var _default = ProForm;
|
165
|
+
var _default = (0, _aspect.ProComponentAspect)(ProForm, 'ProForm');
|
165
166
|
exports.default = _default;
|
package/lib/index.d.ts
CHANGED
@@ -30,5 +30,5 @@ export * from './sidebar';
|
|
30
30
|
export * from './utils';
|
31
31
|
export * from './timeline';
|
32
32
|
export * from './image';
|
33
|
-
declare const version = "1.5.
|
33
|
+
declare const version = "1.5.48-beta.1";
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -299,7 +299,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
299
299
|
if (!((_window = window) === null || _window === void 0 ? void 0 : _window.TEAMIXPRO_WITHOUT_ICON)) {
|
300
300
|
_icon.default.setConfig(_utils.default.getTeamixIconConfig());
|
301
301
|
}
|
302
|
-
var version = '1.5.
|
302
|
+
var version = '1.5.48-beta.1';
|
303
303
|
// By TeamixTest
|
304
304
|
exports.version = version;
|
305
305
|
window.postMessage({
|
package/lib/page-header/index.js
CHANGED
@@ -137,7 +137,7 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
137
137
|
style = props.style,
|
138
138
|
tabs = props.tabs,
|
139
139
|
others = _objectWithoutProperties(props, _excluded3);
|
140
|
-
var history = (0, _utils.
|
140
|
+
var history = (0, _utils.useReactHistory)();
|
141
141
|
var backgroundImage = image ? "url('".concat(image, "')") : undefined;
|
142
142
|
var showList = function showList(list) {
|
143
143
|
var _list$actions;
|
@@ -152,7 +152,7 @@ export declare function getTreeNodeProps(item: ProSidebarDataSourceItem): {
|
|
152
152
|
'aria-colindex'?: number | undefined;
|
153
153
|
'aria-colspan'?: number | undefined;
|
154
154
|
'aria-controls'?: string | undefined;
|
155
|
-
'aria-current'?: boolean | "date" | "time" | "page" | "false" | "true" | "step" |
|
155
|
+
'aria-current'?: boolean | "location" | "date" | "time" | "page" | "false" | "true" | "step" | undefined;
|
156
156
|
'aria-describedby'?: string | undefined;
|
157
157
|
'aria-details'?: string | undefined;
|
158
158
|
'aria-disabled'?: (boolean | "false" | "true") | undefined;
|
@@ -42,7 +42,9 @@ var Filter = function Filter(props) {
|
|
42
42
|
filtersWidth = _column$filtersWidth === void 0 ? 130 : _column$filtersWidth,
|
43
43
|
_column$defaultFilter = column.defaultFilterSelectedKeys,
|
44
44
|
defaultFilterSelectedKeys = _column$defaultFilter === void 0 ? [] : _column$defaultFilter;
|
45
|
-
var _ref = bindUrl ? (0, _hooks.useUrlState)(
|
45
|
+
var _ref = bindUrl ? (0, _hooks.useUrlState)({}, {
|
46
|
+
navigateMode: 'replace'
|
47
|
+
}) : [],
|
46
48
|
_ref2 = _slicedToArray(_ref, 2),
|
47
49
|
urlState = _ref2[0],
|
48
50
|
setUrlState = _ref2[1];
|
package/lib/table/index.js
CHANGED
@@ -156,7 +156,9 @@ var ProTable = function ProTable(props) {
|
|
156
156
|
var targetPageKey = pageKey || globalPageKey;
|
157
157
|
var targetPageSizeKey = pageSizeKey || globalPageSizeKey;
|
158
158
|
var targetFormatSort = formatSort || globalFormatSort;
|
159
|
-
var _ref = bindUrl ? (0, _hooks.useUrlState)(
|
159
|
+
var _ref = bindUrl ? (0, _hooks.useUrlState)({}, {
|
160
|
+
navigateMode: 'replace'
|
161
|
+
}) : [],
|
160
162
|
_ref2 = _slicedToArray(_ref, 2),
|
161
163
|
urlState = _ref2[0],
|
162
164
|
setUrlState = _ref2[1];
|
@@ -1220,7 +1222,8 @@ var ProTable = function ProTable(props) {
|
|
1220
1222
|
}, [fullscreenState, fixedTableBody, footerSuction, footerSuctionState]);
|
1221
1223
|
return /*#__PURE__*/_react.default.createElement(_Fullscreen.default, {
|
1222
1224
|
visible: fullscreenState,
|
1223
|
-
actionRef: actionRef
|
1225
|
+
actionRef: actionRef,
|
1226
|
+
key: props.key
|
1224
1227
|
}, function (isFullScreen) {
|
1225
1228
|
return /*#__PURE__*/_react.default.createElement("div", {
|
1226
1229
|
className: cls({
|
package/lib/table/typing.d.ts
CHANGED
@@ -189,6 +189,8 @@ export declare type ProTableProps = {
|
|
189
189
|
/** 使用超大数据模式 **/
|
190
190
|
useMaxData?: boolean;
|
191
191
|
rowSelection?: rowSelectionType;
|
192
|
+
/** React Key **/
|
193
|
+
key?: React.Key | null;
|
192
194
|
} & Omit<TableProps, 'columns' | 'rowSelection'> & ProTableTopAreaProps;
|
193
195
|
export declare type rowSelectionType = {
|
194
196
|
getProps?: (record: any, index: number) => any;
|