@teamix/pro 1.2.14 → 1.2.18
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 +538 -260
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog.js +3 -1
- package/es/actions/index.d.ts +2 -0
- package/es/actions/index.js +28 -14
- package/es/card/index.d.ts +4 -1
- package/es/card/index.js +8 -2
- package/es/card/index.scss +4 -0
- package/es/form/Components/LightFilter/index.js +1 -2
- package/es/form/Filter/index.js +2 -2
- package/es/form/Filter/index2.js +124 -128
- package/es/form/Filter/index2.scss +1 -1
- package/es/form/ProForm/index.js +1 -0
- package/es/form/ProForm/useFieldRequest.js +1 -8
- package/es/form/SchemaForm/index.js +4 -2
- package/es/form/SchemaForm/reactions.js +2 -6
- package/es/form/typing.d.ts +6 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/nocode/configurators/ProTable.js +1 -0
- package/es/page-header/index.js +2 -11
- package/es/table/components/Filter/index.js +42 -16
- package/es/table/components/ToolBar/FilterColumnIcon.js +52 -17
- package/es/table/components/ToolBar/index.scss +1 -0
- package/es/table/index.js +29 -2
- package/es/table/typing.d.ts +9 -2
- package/es/table/utils/columnRender.js +27 -6
- package/es/table/utils/index.js +7 -1
- package/es/utils/message.d.ts +1 -1
- package/es/utils/message.js +7 -7
- package/lib/actions/dialog.js +3 -1
- package/lib/actions/index.d.ts +2 -0
- package/lib/actions/index.js +28 -14
- package/lib/card/index.d.ts +4 -1
- package/lib/card/index.js +9 -2
- package/lib/card/index.scss +4 -0
- package/lib/form/Components/LightFilter/index.js +1 -2
- package/lib/form/Filter/index.js +2 -2
- package/lib/form/Filter/index2.js +124 -128
- package/lib/form/Filter/index2.scss +1 -1
- package/lib/form/ProForm/index.js +1 -0
- package/lib/form/ProForm/useFieldRequest.js +1 -9
- package/lib/form/SchemaForm/index.js +4 -2
- package/lib/form/SchemaForm/reactions.js +1 -5
- package/lib/form/typing.d.ts +6 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/nocode/configurators/ProTable.js +1 -0
- package/lib/page-header/index.js +3 -12
- package/lib/table/components/Filter/index.js +42 -16
- package/lib/table/components/ToolBar/FilterColumnIcon.js +52 -17
- package/lib/table/components/ToolBar/index.scss +1 -0
- package/lib/table/index.js +29 -2
- package/lib/table/typing.d.ts +9 -2
- package/lib/table/utils/columnRender.js +27 -6
- package/lib/table/utils/index.js +7 -1
- package/lib/utils/message.d.ts +1 -1
- package/lib/utils/message.js +7 -7
- package/package.json +1 -1
@@ -223,7 +223,9 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
223
223
|
rules: defaultRules,
|
224
224
|
reactions: defaultReactions,
|
225
225
|
dataSource: defaultDataSource,
|
226
|
-
data: data
|
226
|
+
data: data || {
|
227
|
+
placeholder: true
|
228
|
+
}
|
227
229
|
})); // 递归子组件
|
228
230
|
|
229
231
|
var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
|
@@ -242,7 +244,7 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
242
244
|
type: 'object',
|
243
245
|
properties: formatSchema(schema)
|
244
246
|
};
|
245
|
-
}, []); // console.log(proFormSchema);
|
247
|
+
}, [schema]); // console.log(proFormSchema);
|
246
248
|
|
247
249
|
return /*#__PURE__*/React.createElement(SchemaField, {
|
248
250
|
schema: proFormSchema,
|
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
4
4
|
|
5
5
|
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; }
|
6
6
|
|
7
|
-
import { isFn, isPlainObj, doCommonRequest } from '@teamix/utils'; // 配置请求
|
7
|
+
import { isFn, isPlainObj, doCommonRequest, getValueByValue } from '@teamix/utils'; // 配置请求
|
8
8
|
|
9
9
|
var $request = function $request(requestConfig) {
|
10
10
|
return function (field, context) {
|
@@ -54,11 +54,7 @@ var $dataSource = function $dataSource(services, onComplete, context) {
|
|
54
54
|
readOnly: true
|
55
55
|
});
|
56
56
|
return services(field, context).then(function (res) {
|
57
|
-
var
|
58
|
-
|
59
|
-
var isValueInDataSource = res === null || res === void 0 ? void 0 : (_res$map = res.map(function (v) {
|
60
|
-
return v.value;
|
61
|
-
})) === null || _res$map === void 0 ? void 0 : _res$map.includes(field.value);
|
57
|
+
var isValueInDataSource = getValueByValue(res, field.value);
|
62
58
|
var clearValue = isValueInDataSource ? {} : {
|
63
59
|
value: undefined
|
64
60
|
};
|
package/es/form/typing.d.ts
CHANGED
@@ -65,6 +65,12 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
65
65
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
66
66
|
}
|
67
67
|
export interface QueryFilterProps extends ProFormProps {
|
68
|
+
/**
|
69
|
+
* @deprecated triggerType已弃用
|
70
|
+
*/
|
71
|
+
triggerType?: 'keydown' | 'change' | 'submit';
|
72
|
+
mode?: 'inline' | 'panel';
|
73
|
+
expand?: boolean;
|
68
74
|
addonBefore?: ReactNode;
|
69
75
|
addonAfter?: ReactNode;
|
70
76
|
onFilter?: (values: any) => void;
|
package/es/index.d.ts
CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
|
|
21
21
|
export * from './page-header';
|
22
22
|
export * from './skeleton';
|
23
23
|
export * from './table';
|
24
|
-
declare const version = "1.2.
|
24
|
+
declare const version = "1.2.17";
|
25
25
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -27,7 +27,7 @@ export * from './page-header';
|
|
27
27
|
export * from './skeleton';
|
28
28
|
export * from './table'; // export * from './sidebar';
|
29
29
|
|
30
|
-
var version = '1.2.
|
30
|
+
var version = '1.2.17';
|
31
31
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
32
32
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
|
33
33
|
hooks, nocode, templates, utils };
|
package/es/page-header/index.js
CHANGED
@@ -17,7 +17,7 @@ import { useHistory } from 'react-router-dom';
|
|
17
17
|
import classnames from 'classnames';
|
18
18
|
import TeamixIcon from '@teamix/icon';
|
19
19
|
import { Breadcrumb } from '@alicloudfe/components';
|
20
|
-
import { baseClass, goToLink, renderTags } from '@teamix/utils';
|
20
|
+
import { baseClass, goToLink, renderTags, isPresetColor, getColorClassName, getBackgroundColorClassName } from '@teamix/utils';
|
21
21
|
import { ProActionGroup } from '../actions';
|
22
22
|
import { ProSkeletonRaw } from '../skeleton';
|
23
23
|
import ProInfo from '../info';
|
@@ -63,21 +63,12 @@ var renderActionGroup = function renderActionGroup(group, defaultProps) {
|
|
63
63
|
return group;
|
64
64
|
};
|
65
65
|
|
66
|
-
var isPresetColor = function isPresetColor(color) {
|
67
|
-
if (!color) {
|
68
|
-
return false;
|
69
|
-
}
|
70
|
-
|
71
|
-
var PRESET_COLOR_REG = /blue|green|orange|red|yellow/;
|
72
|
-
return PRESET_COLOR_REG.test(color);
|
73
|
-
};
|
74
|
-
|
75
66
|
var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgroundType) {
|
76
67
|
var _classnames;
|
77
68
|
|
78
69
|
var isColorPresetColor = isPresetColor(color);
|
79
70
|
var isBgColorPresetColor = isPresetColor(backgroundColor);
|
80
|
-
var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(
|
71
|
+
var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(getColorClassName(color)), isColorPresetColor), _defineProperty(_classnames, "".concat(getBackgroundColorClassName(backgroundColor)), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
|
81
72
|
var styleColor = isColorPresetColor ? undefined : color;
|
82
73
|
var styleBgColor = isBgColorPresetColor ? undefined : backgroundColor;
|
83
74
|
var style = {
|
@@ -140,7 +140,7 @@ var Filter = function Filter(props) {
|
|
140
140
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
141
141
|
trigger: /*#__PURE__*/React.createElement(TeamixIcon, {
|
142
142
|
size: "small",
|
143
|
-
type:
|
143
|
+
type: selected.length > 0 && visible === false ? 'filter-fill' : 'filter-line',
|
144
144
|
className: cls({
|
145
145
|
icon: true,
|
146
146
|
'icon-selected': selected.length > 0
|
@@ -149,6 +149,8 @@ var Filter = function Filter(props) {
|
|
149
149
|
setVisible(!visible);
|
150
150
|
}
|
151
151
|
}),
|
152
|
+
//@ts-ignore
|
153
|
+
v2: true,
|
152
154
|
triggerType: ['click'],
|
153
155
|
align: "tl bl",
|
154
156
|
visible: visible,
|
@@ -171,7 +173,7 @@ var Filter = function Filter(props) {
|
|
171
173
|
btn: true
|
172
174
|
}),
|
173
175
|
onClick: function onClick() {
|
174
|
-
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$
|
176
|
+
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s;
|
175
177
|
|
176
178
|
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.filterDataSource) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2, column.dataIndex); // 先获取此列的param
|
177
179
|
|
@@ -199,24 +201,30 @@ var Filter = function Filter(props) {
|
|
199
201
|
return null;
|
200
202
|
})), [[column.dataIndex, param]]).filter(function (item) {
|
201
203
|
return item && (item === null || item === void 0 ? void 0 : item[1]);
|
202
|
-
}));
|
203
|
-
var targetPageKey = 'currentPage';
|
204
|
-
var pageInfo = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : _actionRef$current4.pageInfo;
|
204
|
+
})); // 再设置所有的列筛选状态
|
205
205
|
|
206
|
-
|
207
|
-
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
208
|
-
} // 再设置所有的列筛选状态
|
209
|
-
|
210
|
-
|
211
|
-
(_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$s = _actionRef$current5.setFilterRules) === null || _actionRef$current5$s === void 0 ? void 0 : _actionRef$current5$s.call(_actionRef$current5, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
206
|
+
(_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
212
207
|
rules: selected,
|
213
208
|
params: param
|
214
|
-
})));
|
209
|
+
})));
|
210
|
+
|
211
|
+
if (selected.length > 0) {
|
212
|
+
var _actionRef$current5, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$c;
|
213
|
+
|
214
|
+
var targetPageKey = 'currentPage';
|
215
|
+
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
216
|
+
|
217
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
218
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
219
|
+
} // 发送请求
|
220
|
+
|
221
|
+
|
222
|
+
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$r = _actionRef$current6.request) === null || _actionRef$current6$r === void 0 ? void 0 : _actionRef$current6$r.call(_actionRef$current6, _objectSpread(_objectSpread({}, params), {}, _defineProperty({}, targetPageKey, 1)));
|
223
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7); // 清空表格选择
|
215
224
|
|
216
|
-
|
217
|
-
|
225
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
226
|
+
}
|
218
227
|
|
219
|
-
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
220
228
|
setVisible(false);
|
221
229
|
}
|
222
230
|
}, getMessage('ok')), /*#__PURE__*/React.createElement(Button, {
|
@@ -234,7 +242,25 @@ var Filter = function Filter(props) {
|
|
234
242
|
rules: [],
|
235
243
|
params: ''
|
236
244
|
})));
|
237
|
-
(_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.filterDataSource) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, column.dataIndex);
|
245
|
+
(_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.filterDataSource) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, column.dataIndex);
|
246
|
+
|
247
|
+
if (selected.length > 0) {
|
248
|
+
var _actionRef$current12, _actionRef$current13, _actionRef$current13$, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$;
|
249
|
+
|
250
|
+
var targetPageKey = 'currentPage';
|
251
|
+
var pageInfo = (_actionRef$current12 = actionRef.current) === null || _actionRef$current12 === void 0 ? void 0 : _actionRef$current12.pageInfo;
|
252
|
+
|
253
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
254
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
255
|
+
} // 发送请求
|
256
|
+
|
257
|
+
|
258
|
+
(_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : (_actionRef$current13$ = _actionRef$current13.request) === null || _actionRef$current13$ === void 0 ? void 0 : _actionRef$current13$.call(_actionRef$current13, _defineProperty({}, targetPageKey, 1));
|
259
|
+
(_actionRef$current14 = actionRef.current) === null || _actionRef$current14 === void 0 ? void 0 : (_actionRef$current14$ = _actionRef$current14.resetPage) === null || _actionRef$current14$ === void 0 ? void 0 : _actionRef$current14$.call(_actionRef$current14); // 清空表格选择
|
260
|
+
|
261
|
+
(_actionRef$current15 = actionRef.current) === null || _actionRef$current15 === void 0 ? void 0 : (_actionRef$current15$ = _actionRef$current15.clearRowSelection) === null || _actionRef$current15$ === void 0 ? void 0 : _actionRef$current15$.call(_actionRef$current15);
|
262
|
+
} // setVisible(!visible);
|
263
|
+
|
238
264
|
}
|
239
265
|
}, getMessage('reset'))))));
|
240
266
|
};
|
@@ -1,3 +1,11 @@
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
+
|
3
|
+
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."); }
|
4
|
+
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
6
|
+
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
8
|
+
|
1
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
10
|
|
3
11
|
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."); }
|
@@ -121,10 +129,23 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
121
129
|
|
122
130
|
|
123
131
|
var moveUp = function moveUp(e, dataIndex) {
|
132
|
+
var _newColumns$filter, _newColumns$filter2;
|
133
|
+
|
124
134
|
e.stopPropagation();
|
125
|
-
var keyNewColumns = cloneDeep(newColumns)
|
126
|
-
|
127
|
-
|
135
|
+
var keyNewColumns = cloneDeep(newColumns).filter(function (_ref) {
|
136
|
+
var lock = _ref.lock;
|
137
|
+
return !lock;
|
138
|
+
});
|
139
|
+
var headLock = cloneDeep((_newColumns$filter = newColumns.filter(function (_ref2) {
|
140
|
+
var lock = _ref2.lock;
|
141
|
+
return lock === true || lock === 'left';
|
142
|
+
})) !== null && _newColumns$filter !== void 0 ? _newColumns$filter : []);
|
143
|
+
var tailLock = cloneDeep((_newColumns$filter2 = newColumns.filter(function (_ref3) {
|
144
|
+
var lock = _ref3.lock;
|
145
|
+
return lock === 'right';
|
146
|
+
})) !== null && _newColumns$filter2 !== void 0 ? _newColumns$filter2 : []);
|
147
|
+
var index = keyNewColumns.findIndex(function (_ref4) {
|
148
|
+
var index = _ref4.dataIndex;
|
128
149
|
return index === dataIndex;
|
129
150
|
});
|
130
151
|
|
@@ -134,15 +155,28 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
134
155
|
keyNewColumns.push(keyNewColumns.shift());
|
135
156
|
}
|
136
157
|
|
137
|
-
notifyTableRender(keyNewColumns);
|
158
|
+
notifyTableRender([].concat(_toConsumableArray(headLock), _toConsumableArray(keyNewColumns), _toConsumableArray(tailLock)));
|
138
159
|
}; // 向下
|
139
160
|
|
140
161
|
|
141
162
|
var moveDown = function moveDown(e, dataIndex) {
|
163
|
+
var _newColumns$filter3, _newColumns$filter4;
|
164
|
+
|
142
165
|
e.stopPropagation();
|
143
|
-
var keyNewColumns = cloneDeep(newColumns)
|
144
|
-
|
145
|
-
|
166
|
+
var keyNewColumns = cloneDeep(newColumns).filter(function (_ref5) {
|
167
|
+
var lock = _ref5.lock;
|
168
|
+
return !lock;
|
169
|
+
});
|
170
|
+
var headLock = cloneDeep((_newColumns$filter3 = newColumns.filter(function (_ref6) {
|
171
|
+
var lock = _ref6.lock;
|
172
|
+
return lock === true || lock === 'left';
|
173
|
+
})) !== null && _newColumns$filter3 !== void 0 ? _newColumns$filter3 : []);
|
174
|
+
var tailLock = cloneDeep((_newColumns$filter4 = newColumns.filter(function (_ref7) {
|
175
|
+
var lock = _ref7.lock;
|
176
|
+
return lock === 'right';
|
177
|
+
})) !== null && _newColumns$filter4 !== void 0 ? _newColumns$filter4 : []);
|
178
|
+
var index = keyNewColumns.findIndex(function (_ref8) {
|
179
|
+
var index = _ref8.dataIndex;
|
146
180
|
return index === dataIndex;
|
147
181
|
});
|
148
182
|
|
@@ -152,7 +186,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
152
186
|
keyNewColumns.unshift(keyNewColumns.splice(index, 1)[0]);
|
153
187
|
}
|
154
188
|
|
155
|
-
notifyTableRender(keyNewColumns);
|
189
|
+
notifyTableRender([].concat(_toConsumableArray(headLock), _toConsumableArray(keyNewColumns), _toConsumableArray(tailLock)));
|
156
190
|
}; // 通知表格渲染
|
157
191
|
|
158
192
|
|
@@ -220,23 +254,24 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
220
254
|
type: "primary"
|
221
255
|
}, getMessage('reset'))), /*#__PURE__*/React.createElement(Menu.Divider, {
|
222
256
|
key: "divider"
|
223
|
-
}), newColumns.map(function (
|
257
|
+
}), newColumns.map(function (_ref9, index) {
|
224
258
|
var _newColumns$find;
|
225
259
|
|
226
|
-
var dataIndex =
|
227
|
-
title =
|
228
|
-
columnFiltersDisabled =
|
260
|
+
var dataIndex = _ref9.dataIndex,
|
261
|
+
title = _ref9.title,
|
262
|
+
columnFiltersDisabled = _ref9.columnFiltersDisabled,
|
263
|
+
lock = _ref9.lock;
|
229
264
|
return /*#__PURE__*/React.createElement(CheckboxItem, {
|
230
265
|
key: index,
|
231
|
-
checked: (_newColumns$find = newColumns.find(function (
|
232
|
-
var key =
|
266
|
+
checked: (_newColumns$find = newColumns.find(function (_ref10) {
|
267
|
+
var key = _ref10.dataIndex;
|
233
268
|
return key === dataIndex;
|
234
269
|
})) === null || _newColumns$find === void 0 ? void 0 : _newColumns$find.columnFilters,
|
235
270
|
onChange: function onChange(check) {
|
236
271
|
return onChangeColumns(check, dataIndex);
|
237
272
|
},
|
238
273
|
disabled: columnFiltersDisabled
|
239
|
-
}, title, /*#__PURE__*/React.createElement("div", {
|
274
|
+
}, title, !lock && /*#__PURE__*/React.createElement("div", {
|
240
275
|
className: cls({
|
241
276
|
sort: true
|
242
277
|
})
|
@@ -293,8 +328,8 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
293
328
|
key: index,
|
294
329
|
className: cls('col')
|
295
330
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
296
|
-
checked: (_newColumns$find2 = newColumns.find(function (
|
297
|
-
var key =
|
331
|
+
checked: (_newColumns$find2 = newColumns.find(function (_ref11) {
|
332
|
+
var key = _ref11.dataIndex;
|
298
333
|
return key === dataIndex;
|
299
334
|
})) === null || _newColumns$find2 === void 0 ? void 0 : _newColumns$find2.columnFilters,
|
300
335
|
onChange: function onChange(check) {
|
package/es/table/index.js
CHANGED
@@ -381,6 +381,15 @@ var ProTable = function ProTable(props) {
|
|
381
381
|
},
|
382
382
|
request: function request(params) {
|
383
383
|
if (dataFilterForm.validate()) {
|
384
|
+
// 如果请求中还有翻页相关信息,需要自动设置到指定页
|
385
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
|
386
|
+
setCurrentPage(params[targetPageKey]);
|
387
|
+
}
|
388
|
+
|
389
|
+
if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
|
390
|
+
setPageSize(params[targetPageSizeKey]);
|
391
|
+
}
|
392
|
+
|
384
393
|
_request(params);
|
385
394
|
}
|
386
395
|
},
|
@@ -398,6 +407,7 @@ var ProTable = function ProTable(props) {
|
|
398
407
|
resetPage: function resetPage() {
|
399
408
|
setCurrentPage(1);
|
400
409
|
},
|
410
|
+
rowSelection: rowSelection,
|
401
411
|
clearRowSelection: function clearRowSelection() {
|
402
412
|
rowSelectionHook.setSelectedRowKeys([]);
|
403
413
|
rowSelectionHook.setSelectedRecords([]);
|
@@ -410,6 +420,7 @@ var ProTable = function ProTable(props) {
|
|
410
420
|
targetPageSizeKey: targetPageSizeKey,
|
411
421
|
pageSize: pageSize
|
412
422
|
},
|
423
|
+
data: data,
|
413
424
|
dataFilterForm: dataFilterForm,
|
414
425
|
resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
|
415
426
|
getHeaderHeight().then(function (height) {
|
@@ -564,7 +575,11 @@ var ProTable = function ProTable(props) {
|
|
564
575
|
}
|
565
576
|
|
566
577
|
useEffect(function () {
|
567
|
-
|
578
|
+
var _actionRef$current5, _actionRef$current5$i;
|
579
|
+
|
580
|
+
// 初始化 state 状态
|
581
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$i = _actionRef$current5.initState) === null || _actionRef$current5$i === void 0 ? void 0 : _actionRef$current5$i.call(_actionRef$current5); // 监听 浏览器变化 更吸底状态
|
582
|
+
|
568
583
|
if (footerSuction) {
|
569
584
|
getFooterSuctionState();
|
570
585
|
|
@@ -585,6 +600,8 @@ var ProTable = function ProTable(props) {
|
|
585
600
|
if (window.onresize) {
|
586
601
|
window.onresize = null;
|
587
602
|
}
|
603
|
+
|
604
|
+
actionRef.current = undefined;
|
588
605
|
};
|
589
606
|
}, []);
|
590
607
|
|
@@ -602,6 +619,10 @@ var ProTable = function ProTable(props) {
|
|
602
619
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
|
603
620
|
|
604
621
|
if (dataFilterForm.validate()) {
|
622
|
+
var _actionRef$current6, _actionRef$current6$c;
|
623
|
+
|
624
|
+
// 搜索变化时,暂时先清空选择
|
625
|
+
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
|
605
626
|
setCurrentPage(1); // const { mode, schema } = propsDataFilter as ProTableDataFilterProps;
|
606
627
|
// TODO: 针对 inline 模式下的 search 组件做一下处理,如果空值切换下拉的时候不触发请求
|
607
628
|
// if (mode === 'inline') {
|
@@ -698,15 +719,21 @@ var ProTable = function ProTable(props) {
|
|
698
719
|
|
699
720
|
var renderFooter = function renderFooter() {
|
700
721
|
function onChangePagination(currentPage) {
|
722
|
+
var _actionRef$current7, _actionRef$current7$c;
|
723
|
+
|
701
724
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
725
|
+
// 翻页暂时先清空选择
|
726
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
702
727
|
setCurrentPage(currentPage);
|
703
728
|
|
704
729
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
705
730
|
}
|
706
731
|
|
707
732
|
function onChangePaginationSize(currentPageSize) {
|
708
|
-
var _request5;
|
733
|
+
var _actionRef$current8, _actionRef$current8$c, _request5;
|
709
734
|
|
735
|
+
// 翻页暂时先清空选择
|
736
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
710
737
|
setPageSize(currentPageSize);
|
711
738
|
setCurrentPage(1);
|
712
739
|
|
package/es/table/typing.d.ts
CHANGED
@@ -129,6 +129,7 @@ export declare type rowSelectionType = {
|
|
129
129
|
onSelect?: (selected: boolean, record: any, records: Array<any>) => void;
|
130
130
|
onSelectAll?: (selected: boolean, records: Array<any>) => void;
|
131
131
|
selectedRowKeys?: Array<any>;
|
132
|
+
selectedRecords?: any[];
|
132
133
|
mode?: 'single' | 'multiple';
|
133
134
|
titleProps?: () => any;
|
134
135
|
columnProps?: () => any;
|
@@ -154,6 +155,8 @@ export declare type ProTableActionType = {
|
|
154
155
|
request?: (params?: any) => void;
|
155
156
|
/** 重置表格 */
|
156
157
|
reset?: () => void;
|
158
|
+
/** 表格选择相关属性 */
|
159
|
+
rowSelection?: innerRowSelectionType | rowSelectionType;
|
157
160
|
/** 清空表格选择 */
|
158
161
|
clearRowSelection?: () => void;
|
159
162
|
/** 过滤 DataSource */
|
@@ -175,13 +178,17 @@ export declare type ProTableActionType = {
|
|
175
178
|
resetPage?: () => void;
|
176
179
|
/** 获取数据过滤区表单实例 */
|
177
180
|
dataFilterForm?: FormType;
|
181
|
+
/** 表格当前的数据 */
|
182
|
+
data?: any[];
|
178
183
|
} & ProTableActionTypeMutations;
|
179
184
|
/** action State 定义 */
|
180
185
|
export declare type ProTableActionTypeMutations = {
|
181
|
-
/** 获取state状态 */
|
186
|
+
/** 获取state 状态 */
|
182
187
|
getState?: () => ProTableActionTypeState;
|
183
|
-
/** 设置state状态 */
|
188
|
+
/** 设置state 状态 */
|
184
189
|
setState?: (key: string, value: any) => void;
|
190
|
+
/** 初始化 state 状态 */
|
191
|
+
initState?: () => void;
|
185
192
|
/** 设置全屏状态 */
|
186
193
|
setFullScreenState?: (state: boolean) => void;
|
187
194
|
/** 绑定state监听事件 */
|
@@ -40,10 +40,10 @@ export var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
|
|
40
40
|
var filterMode = item.filterMode,
|
41
41
|
filters = item.filters,
|
42
42
|
dataIndex = item.dataIndex,
|
43
|
-
dataSource = item.dataSource;
|
43
|
+
dataSource = item.dataSource; // 为列过滤添加状态标题
|
44
44
|
|
45
|
-
var
|
46
|
-
if (filterMode !== 'multiple') {
|
45
|
+
var getItemLabel = function getItemLabel() {
|
46
|
+
if (filters && filterMode !== 'multiple') {
|
47
47
|
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2;
|
48
48
|
|
49
49
|
var selectedItem = (_actionRef$current$ge = (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge2 = _actionRef$current.getState) === null || _actionRef$current$ge2 === void 0 ? void 0 : _actionRef$current$ge2.call(_actionRef$current).filterRules) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
|
@@ -66,16 +66,37 @@ export var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
|
|
66
66
|
|
67
67
|
return item.value === ((_selectedItem$dataInd2 = selectedItem[dataIndex]) === null || _selectedItem$dataInd2 === void 0 ? void 0 : _selectedItem$dataInd2.params);
|
68
68
|
})) === null || _targetFilters$find === void 0 ? void 0 : _targetFilters$find.label;
|
69
|
-
|
69
|
+
var value = "".concat(item.title, " (").concat(label, ")");
|
70
|
+
return /*#__PURE__*/React.createElement(ProField, {
|
71
|
+
style: {
|
72
|
+
display: 'inline-flex'
|
73
|
+
},
|
74
|
+
value: value,
|
75
|
+
type: "text",
|
76
|
+
render: {
|
77
|
+
ellipsis: true,
|
78
|
+
color: 'var(--table-th-color,#848484)'
|
79
|
+
}
|
80
|
+
});
|
70
81
|
}
|
71
82
|
}
|
72
83
|
}
|
73
84
|
|
74
|
-
return
|
85
|
+
return /*#__PURE__*/React.createElement(ProField, {
|
86
|
+
style: {
|
87
|
+
display: 'inline-flex'
|
88
|
+
},
|
89
|
+
value: item.title,
|
90
|
+
type: "text",
|
91
|
+
render: {
|
92
|
+
ellipsis: true,
|
93
|
+
color: 'var(--table-th-color,#848484)'
|
94
|
+
}
|
95
|
+
});
|
75
96
|
};
|
76
97
|
|
77
98
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelIconTip, {
|
78
|
-
label:
|
99
|
+
label: item.title,
|
79
100
|
tooltip: item.tooltip,
|
80
101
|
icon: item.tooltipIcon
|
81
102
|
}), item.filters && /*#__PURE__*/React.createElement(Filter, {
|
package/es/table/utils/index.js
CHANGED
@@ -22,7 +22,10 @@ var state = {
|
|
22
22
|
fullScreenState: false,
|
23
23
|
filterRules: {},
|
24
24
|
filterColumns: []
|
25
|
-
};
|
25
|
+
};
|
26
|
+
|
27
|
+
var _initState = cloneDeepLodash(state); // 组件内全局监听事件
|
28
|
+
|
26
29
|
|
27
30
|
var callback = {
|
28
31
|
fullScreenState: {}
|
@@ -40,6 +43,9 @@ var mutations = {
|
|
40
43
|
mutations[key] = value;
|
41
44
|
}
|
42
45
|
},
|
46
|
+
initState: function initState() {
|
47
|
+
state = cloneDeepLodash(_initState);
|
48
|
+
},
|
43
49
|
filterColumns: state.filterColumns,
|
44
50
|
setFullScreenState: function setFullScreenState(fullScreenState) {
|
45
51
|
state.fullScreenState = fullScreenState;
|
package/es/utils/message.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
import { MessageProps } from '@alicloudfe/components/types/message';
|
2
2
|
export declare type ProMessageProps = MessageProps | string;
|
3
|
-
export declare const renderProMessage: (message
|
3
|
+
export declare const renderProMessage: (message?: ProMessageProps | undefined, defaultProps?: MessageProps | undefined) => JSX.Element | null;
|
package/es/utils/message.js
CHANGED
@@ -6,14 +6,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
6
6
|
|
7
7
|
import React from 'react';
|
8
8
|
import { Message } from '@alicloudfe/components';
|
9
|
-
export var renderProMessage = function renderProMessage(message) {
|
9
|
+
export var renderProMessage = function renderProMessage(message, defaultProps) {
|
10
|
+
if (!message) {
|
11
|
+
return null;
|
12
|
+
}
|
13
|
+
|
10
14
|
if (typeof message === 'string') {
|
11
|
-
return /*#__PURE__*/React.createElement(Message, {
|
12
|
-
type: "notice"
|
13
|
-
}, message);
|
15
|
+
return /*#__PURE__*/React.createElement(Message, _objectSpread({}, defaultProps), message);
|
14
16
|
}
|
15
17
|
|
16
|
-
return /*#__PURE__*/React.createElement(Message, _objectSpread({
|
17
|
-
type: "notice"
|
18
|
-
}, message));
|
18
|
+
return /*#__PURE__*/React.createElement(Message, _objectSpread(_objectSpread({}, defaultProps), message));
|
19
19
|
};
|
package/lib/actions/dialog.js
CHANGED
@@ -251,7 +251,9 @@ function useDialogAction(action, actionContext) {
|
|
251
251
|
className: "teamix-pro-dialog-before-content"
|
252
252
|
}, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/_react.default.createElement("div", {
|
253
253
|
className: "teamix-pro-dialog-message"
|
254
|
-
}, (0, _message.renderProMessage)(message
|
254
|
+
}, (0, _message.renderProMessage)(message, {
|
255
|
+
type: 'notice'
|
256
|
+
})), dialogContent, afterContent && /*#__PURE__*/_react.default.createElement("div", {
|
255
257
|
className: "teamix-pro-dialog-after-content"
|
256
258
|
}, addContextForReactNode(afterContent, dialogContext)), footerDescription && /*#__PURE__*/_react.default.createElement("div", {
|
257
259
|
className: (0, _classnames.default)('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
package/lib/actions/index.d.ts
CHANGED
@@ -24,6 +24,7 @@ export declare type ProActionConfig = ({
|
|
24
24
|
export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
|
25
25
|
export declare function useAction(config?: ProActionConfig, context?: any): any;
|
26
26
|
export interface ProActionButtonProps extends ButtonProps {
|
27
|
+
key?: string | number;
|
27
28
|
config?: ProActionConfig;
|
28
29
|
visible?: any;
|
29
30
|
disabled?: any;
|
@@ -33,6 +34,7 @@ export interface ProActionButtonProps extends ButtonProps {
|
|
33
34
|
}
|
34
35
|
export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
|
35
36
|
export interface ProActionMenuButtonProps extends MenuButtonProps {
|
37
|
+
key?: string | number;
|
36
38
|
actions: ProActionProps[];
|
37
39
|
visible?: any;
|
38
40
|
icon?: string;
|