@teamix/pro 1.2.15 → 1.2.19
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 +832 -320
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/base.d.ts +2 -1
- package/es/actions/base.js +1 -1
- package/es/actions/danger-pop-confirm.d.ts +5 -0
- package/es/actions/danger-pop-confirm.js +10 -0
- package/es/actions/dialog.d.ts +1 -1
- package/es/actions/dialog.js +32 -31
- package/es/actions/index.d.ts +5 -0
- package/es/actions/index.js +38 -14
- package/es/actions/pop-confirm.d.ts +9 -0
- package/es/actions/pop-confirm.js +9 -0
- package/es/form/Components/LightFilter/componentMap.d.ts +2 -1
- package/es/form/Components/LightFilter/componentMap.js +2 -1
- package/es/form/Components/LightFilter/index.d.ts +1 -0
- package/es/form/Components/LightFilter/index.js +19 -14
- package/es/form/Components/LightFilter/index.scss +13 -3
- package/es/form/Filter/index.js +2 -2
- package/es/form/Filter/index2.js +157 -50
- package/es/form/Filter/index2.scss +3 -0
- package/es/form/ProForm/index.js +4 -2
- package/es/form/ProForm/useFieldRequest.js +1 -8
- package/es/form/SchemaForm/index.js +4 -2
- package/es/form/typing.d.ts +5 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/nocode/configurators/ProTable.js +1 -0
- package/es/table/components/Filter/index.js +42 -16
- package/es/table/components/ToolBar/FilterColumnIcon.js +1 -1
- package/es/table/index.js +61 -13
- package/es/table/typing.d.ts +5 -0
- package/es/table/utils/columnRender.js +1 -1
- package/lib/actions/base.d.ts +2 -1
- package/lib/actions/base.js +1 -1
- package/lib/actions/danger-pop-confirm.d.ts +5 -0
- package/lib/actions/danger-pop-confirm.js +22 -0
- package/lib/actions/dialog.d.ts +1 -1
- package/lib/actions/dialog.js +33 -31
- package/lib/actions/index.d.ts +5 -0
- package/lib/actions/index.js +40 -14
- package/lib/actions/pop-confirm.d.ts +9 -0
- package/lib/actions/pop-confirm.js +23 -0
- package/lib/form/Components/LightFilter/componentMap.d.ts +2 -1
- package/lib/form/Components/LightFilter/componentMap.js +4 -3
- package/lib/form/Components/LightFilter/index.d.ts +1 -0
- package/lib/form/Components/LightFilter/index.js +18 -13
- package/lib/form/Components/LightFilter/index.scss +13 -3
- package/lib/form/Filter/index.js +2 -2
- package/lib/form/Filter/index2.js +157 -49
- package/lib/form/Filter/index2.scss +3 -0
- package/lib/form/ProForm/index.js +5 -2
- package/lib/form/ProForm/useFieldRequest.js +1 -9
- package/lib/form/SchemaForm/index.js +4 -2
- package/lib/form/typing.d.ts +5 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/nocode/configurators/ProTable.js +1 -0
- package/lib/table/components/Filter/index.js +42 -16
- package/lib/table/components/ToolBar/FilterColumnIcon.js +1 -1
- package/lib/table/index.js +61 -13
- package/lib/table/typing.d.ts +5 -0
- package/lib/table/utils/columnRender.js +1 -1
- package/package.json +2 -2
package/es/form/Filter/index2.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
var _excluded = ["schema", "onChange", "onSubmit"],
|
2
2
|
_excluded2 = ["form", "schema", "onSubmit", "onChange"],
|
3
|
-
_excluded3 = ["schema", "onSubmit", "
|
4
|
-
_excluded4 = ["addonAfter", "addonBefore", "onFilter", "mode", "expand"];
|
3
|
+
_excluded3 = ["schema", "onSubmit", "onReset", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol"],
|
4
|
+
_excluded4 = ["addonAfter", "addonBefore", "onFilter", "onInit", "onReset", "mode", "expand"];
|
5
|
+
|
6
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
7
|
+
|
8
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
5
9
|
|
6
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
7
11
|
|
@@ -38,7 +42,8 @@ import cls from 'classnames';
|
|
38
42
|
import { Tag, Button, Badge } from '@alicloudfe/components';
|
39
43
|
import TeamixIcon from '@teamix/icon';
|
40
44
|
import { createForm } from '@formily/core';
|
41
|
-
import {
|
45
|
+
import { toJS } from '@formily/reactive';
|
46
|
+
import { usePrefixCls, getMessage, isSignificative, isStr, isPlainObj } from '@teamix/utils';
|
42
47
|
import ProField from '../../field/index';
|
43
48
|
import ProForm from '../ProForm';
|
44
49
|
import fieldTypeMap from '../fieldTypeMap';
|
@@ -98,9 +103,17 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
98
103
|
var prefixCls = usePrefixCls('', {
|
99
104
|
prefix: 'teamix-pro-form-query-filter-light'
|
100
105
|
});
|
106
|
+
var onBtnClick = useCallback(function () {
|
107
|
+
onChange && onChange(toJS(form.values));
|
108
|
+
}, [form]);
|
101
109
|
var LightSchema = useMemo(function () {
|
102
110
|
return [{
|
103
111
|
component: 'LightFilter',
|
112
|
+
props: {
|
113
|
+
buttonProps: {
|
114
|
+
onClick: onBtnClick
|
115
|
+
}
|
116
|
+
},
|
104
117
|
children: schema
|
105
118
|
}, {
|
106
119
|
component: 'Submit',
|
@@ -110,19 +123,12 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
110
123
|
}
|
111
124
|
}
|
112
125
|
}];
|
113
|
-
}, [schema]);
|
114
|
-
// form.addEffects('onChange', () => {
|
115
|
-
// onFieldValueChange('',(field:any) => {
|
116
|
-
// console.log(field.value);
|
117
|
-
// });
|
118
|
-
// });
|
119
|
-
// }, [form, onChange]);
|
120
|
-
|
126
|
+
}, [schema, onBtnClick]);
|
121
127
|
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread({}, otherProps), {}, {
|
122
128
|
form: form,
|
123
129
|
className: cls(prefixCls, props.className),
|
124
130
|
schema: LightSchema,
|
125
|
-
feedbackLayout: "
|
131
|
+
feedbackLayout: "none",
|
126
132
|
breakpoints: [],
|
127
133
|
bordered: false,
|
128
134
|
onSubmit: onSubmit,
|
@@ -136,7 +142,6 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
136
142
|
var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
137
143
|
var schema = props.schema,
|
138
144
|
onSubmit = props.onSubmit,
|
139
|
-
onChange = props.onChange,
|
140
145
|
onReset = props.onReset,
|
141
146
|
layout = props.layout,
|
142
147
|
labelAlign = props.labelAlign,
|
@@ -211,25 +216,79 @@ AdvancedFilter.defaultProps = {
|
|
211
216
|
labelCol: 6,
|
212
217
|
wrapperCol: 18
|
213
218
|
};
|
219
|
+
|
220
|
+
var getSpecialProps = function getSpecialProps(props) {
|
221
|
+
var initialValues = props.initialValues,
|
222
|
+
initialRequest = props.initialRequest;
|
223
|
+
var hasDefault = !!initialValues;
|
224
|
+
var hasAsyncDefault = !!initialRequest;
|
225
|
+
var hasRequired = false;
|
226
|
+
|
227
|
+
var hasDefaultOrRule = function hasDefaultOrRule(schema) {
|
228
|
+
schema.forEach(function (item) {
|
229
|
+
var value = item.default,
|
230
|
+
required = item.required,
|
231
|
+
rules = item.rules,
|
232
|
+
request = item.request,
|
233
|
+
dataSource = item.dataSource,
|
234
|
+
children = item.children;
|
235
|
+
hasDefault = hasDefault || isSignificative(value);
|
236
|
+
hasRequired = hasRequired || required || !!rules;
|
237
|
+
hasAsyncDefault = hasAsyncDefault || !!request || // 如果dataSource是异步且default取自dataSource
|
238
|
+
!!(isPlainObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
|
239
|
+
|
240
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
241
|
+
hasDefaultOrRule(children);
|
242
|
+
}
|
243
|
+
});
|
244
|
+
};
|
245
|
+
|
246
|
+
hasDefaultOrRule(props.schema);
|
247
|
+
return {
|
248
|
+
hasDefault: hasDefault,
|
249
|
+
hasAsyncDefault: hasAsyncDefault,
|
250
|
+
hasRequired: hasRequired
|
251
|
+
};
|
252
|
+
};
|
214
253
|
/**
|
215
254
|
* 查询筛选
|
216
255
|
*/
|
217
256
|
|
257
|
+
|
218
258
|
var QueryFilter = /*#__PURE__*/memo(function (props) {
|
219
259
|
var addonAfter = props.addonAfter,
|
220
260
|
addonBefore = props.addonBefore,
|
221
261
|
onFilter = props.onFilter,
|
262
|
+
onInit = props.onInit,
|
263
|
+
onReset = props.onReset,
|
222
264
|
mode = props.mode,
|
223
265
|
expand = props.expand,
|
224
266
|
otherProps = _objectWithoutProperties(props, _excluded4);
|
225
267
|
|
226
|
-
var
|
227
|
-
return
|
268
|
+
var simpleForm = useMemo(function () {
|
269
|
+
return createForm({
|
270
|
+
validateFirst: true
|
271
|
+
});
|
272
|
+
}, []);
|
273
|
+
var lightForm = useMemo(function () {
|
274
|
+
return createForm({
|
275
|
+
validateFirst: true
|
276
|
+
});
|
277
|
+
}, []);
|
278
|
+
var advancedForm = useMemo(function () {
|
279
|
+
return createForm({
|
228
280
|
validateFirst: true
|
229
281
|
});
|
230
282
|
}, []);
|
231
283
|
|
232
|
-
var
|
284
|
+
var _getSpecialProps = getSpecialProps(props),
|
285
|
+
hasDefault = _getSpecialProps.hasDefault,
|
286
|
+
hasAsyncDefault = _getSpecialProps.hasAsyncDefault,
|
287
|
+
hasRequired = _getSpecialProps.hasRequired;
|
288
|
+
|
289
|
+
var hasDefaultOrRequired = hasDefault || hasAsyncDefault || hasRequired;
|
290
|
+
|
291
|
+
var _useState = useState(!!expand || hasDefaultOrRequired),
|
233
292
|
_useState2 = _slicedToArray(_useState, 2),
|
234
293
|
advancedFilterVisible = _useState2[0],
|
235
294
|
setAdvancedFilterVisible = _useState2[1];
|
@@ -241,7 +300,8 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
241
300
|
|
242
301
|
var prefixCls = usePrefixCls('', {
|
243
302
|
prefix: 'teamix-pro-form-query-filter'
|
244
|
-
});
|
303
|
+
});
|
304
|
+
var currentForm = mode === 'panel' ? advancedFilterVisible ? 'advanced' : 'light' : 'simple'; // 展开收起高级筛选
|
245
305
|
|
246
306
|
var toggleAdvancedFilter = useCallback(function () {
|
247
307
|
setAdvancedFilterVisible(function (visible) {
|
@@ -267,31 +327,78 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
267
327
|
}).filter(function (item) {
|
268
328
|
return isSignificative(item.value);
|
269
329
|
});
|
270
|
-
}, []); //
|
271
|
-
|
272
|
-
var
|
273
|
-
setTagDataSource(getTagDataSource(
|
274
|
-
|
275
|
-
|
330
|
+
}, []); // 设置标签数据
|
331
|
+
|
332
|
+
var configTag = useCallback(function () {
|
333
|
+
setTagDataSource(getTagDataSource(advancedForm));
|
334
|
+
}, []); // 简单搜索Filter
|
335
|
+
|
336
|
+
var onSimpleFilter = useCallback(function (values) {
|
337
|
+
if (currentForm === 'simple') {
|
338
|
+
onFilter && onFilter(values);
|
339
|
+
}
|
340
|
+
}, [onFilter, currentForm]); // 轻量搜索Filter
|
341
|
+
|
342
|
+
var onLightFilter = useCallback( /*#__PURE__*/function () {
|
343
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(values) {
|
344
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
345
|
+
while (1) {
|
346
|
+
switch (_context.prev = _context.next) {
|
347
|
+
case 0:
|
348
|
+
if (!(currentForm === 'light')) {
|
349
|
+
_context.next = 5;
|
350
|
+
break;
|
351
|
+
}
|
352
|
+
|
353
|
+
onFilter && onFilter(values);
|
354
|
+
_context.next = 4;
|
355
|
+
return advancedForm.reset();
|
356
|
+
|
357
|
+
case 4:
|
358
|
+
configTag();
|
359
|
+
|
360
|
+
case 5:
|
361
|
+
case "end":
|
362
|
+
return _context.stop();
|
363
|
+
}
|
364
|
+
}
|
365
|
+
}, _callee);
|
366
|
+
}));
|
276
367
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
}, [form]); // 简单表单onChange
|
368
|
+
return function (_x) {
|
369
|
+
return _ref3.apply(this, arguments);
|
370
|
+
};
|
371
|
+
}(), [onFilter, currentForm]); // 高级搜索Filter
|
282
372
|
|
283
|
-
var
|
284
|
-
|
285
|
-
|
286
|
-
|
373
|
+
var onAdvancedFilter = useCallback(function (values) {
|
374
|
+
if (currentForm === 'advanced') {
|
375
|
+
onFilter && onFilter(values);
|
376
|
+
configTag();
|
377
|
+
lightForm.reset();
|
378
|
+
}
|
379
|
+
}, [onFilter, currentForm]); // 关闭标签清空表单字段值
|
287
380
|
|
288
381
|
var onTagClose = useCallback(function (key) {
|
289
|
-
|
290
|
-
|
382
|
+
advancedForm.setValuesIn(key, undefined);
|
383
|
+
setTagDataSource(getTagDataSource(advancedForm));
|
384
|
+
}, []); // 判断表单是否有校验和默认值
|
291
385
|
|
292
386
|
useEffect(function () {
|
293
|
-
|
294
|
-
}, []);
|
387
|
+
if (hasDefault || hasAsyncDefault || hasRequired) {}
|
388
|
+
}, [hasDefault, hasAsyncDefault, hasRequired]); // 设置默认值标签数据
|
389
|
+
|
390
|
+
useEffect(function () {// onInit
|
391
|
+
// if (mode === 'panel') {
|
392
|
+
// if (expand) {
|
393
|
+
// onInit && onInit(toJS(advancedForm.values));
|
394
|
+
// } else {
|
395
|
+
// onInit && onInit(toJS(lightForm.values));
|
396
|
+
// }
|
397
|
+
// configTag();
|
398
|
+
// } else {
|
399
|
+
// onInit && onInit(toJS(simpleForm.values));
|
400
|
+
// }
|
401
|
+
}, [mode]);
|
295
402
|
return /*#__PURE__*/React.createElement("div", {
|
296
403
|
className: cls(prefixCls, props.className)
|
297
404
|
}, /*#__PURE__*/React.createElement("div", {
|
@@ -301,11 +408,11 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
301
408
|
}, addonBefore ? /*#__PURE__*/React.createElement("div", {
|
302
409
|
className: "".concat(prefixCls, "-addonBefore")
|
303
410
|
}, addonBefore) : null, mode === 'panel' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
304
|
-
className: "".concat(prefixCls, "-inline-form")
|
411
|
+
className: cls("".concat(prefixCls, "-inline-form"), hasAsyncDefault ? "".concat(prefixCls, "-inline-form-hidden") : '')
|
305
412
|
}, /*#__PURE__*/React.createElement(LightFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
306
|
-
form:
|
307
|
-
|
308
|
-
onSubmit:
|
413
|
+
form: lightForm,
|
414
|
+
onChange: onLightFilter,
|
415
|
+
onSubmit: onLightFilter
|
309
416
|
}))), /*#__PURE__*/React.createElement("div", {
|
310
417
|
className: "".concat(prefixCls, "-toggle")
|
311
418
|
}, /*#__PURE__*/React.createElement(Badge, {
|
@@ -325,20 +432,20 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
325
432
|
}), getMessage('advancedFilter'))))) : /*#__PURE__*/React.createElement("div", {
|
326
433
|
className: "".concat(prefixCls, "-inline-form")
|
327
434
|
}, /*#__PURE__*/React.createElement(SimpleFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
328
|
-
form:
|
329
|
-
|
330
|
-
onSubmit:
|
435
|
+
form: simpleForm,
|
436
|
+
onChange: onSimpleFilter,
|
437
|
+
onSubmit: onSimpleFilter
|
331
438
|
})))), addonAfter ? /*#__PURE__*/React.createElement("div", {
|
332
439
|
className: "".concat(prefixCls, "-addonAfter")
|
333
440
|
}, addonAfter) : null), mode === 'panel' ? /*#__PURE__*/React.createElement("div", {
|
334
441
|
className: "".concat(prefixCls, "-panel")
|
335
442
|
}, /*#__PURE__*/React.createElement("div", {
|
336
443
|
className: cls("".concat(prefixCls, "-tag"), advancedFilterVisible ? "".concat(prefixCls, "-tag-hidden") : '')
|
337
|
-
}, /*#__PURE__*/React.createElement(Tag.Group, null, tagDataSource.map(function (
|
338
|
-
var key =
|
339
|
-
label =
|
340
|
-
value =
|
341
|
-
type =
|
444
|
+
}, /*#__PURE__*/React.createElement(Tag.Group, null, tagDataSource.map(function (_ref4) {
|
445
|
+
var key = _ref4.key,
|
446
|
+
label = _ref4.label,
|
447
|
+
value = _ref4.value,
|
448
|
+
type = _ref4.type;
|
342
449
|
return /*#__PURE__*/React.createElement(Tag.Closeable, {
|
343
450
|
key: key,
|
344
451
|
afterClose: function afterClose() {
|
@@ -355,8 +462,8 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
355
462
|
}))), /*#__PURE__*/React.createElement("div", {
|
356
463
|
className: cls("".concat(prefixCls, "-advanced-wrap"), !advancedFilterVisible ? "".concat(prefixCls, "-advanced-wrap-hidden") : '')
|
357
464
|
}, /*#__PURE__*/React.createElement(AdvancedFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
358
|
-
form:
|
359
|
-
onSubmit:
|
465
|
+
form: advancedForm,
|
466
|
+
onSubmit: onAdvancedFilter
|
360
467
|
})))) : null);
|
361
468
|
});
|
362
469
|
QueryFilter.defaultProps = {
|
package/es/form/ProForm/index.js
CHANGED
@@ -21,6 +21,7 @@ import { mergeArrayValue } from '../utils';
|
|
21
21
|
import useAutoSubmit from './useAutoSubmit';
|
22
22
|
import useInitialRequest from './useInitialRequest';
|
23
23
|
import validateLocale from '../locales/validate';
|
24
|
+
import debounce from 'lodash.debounce';
|
24
25
|
import './index.scss';
|
25
26
|
registerValidateLocale(validateLocale);
|
26
27
|
var ProForm = /*#__PURE__*/memo(function (_ref) {
|
@@ -78,12 +79,13 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
78
79
|
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]); // 添加onChange
|
79
80
|
|
80
81
|
useEffect(function () {
|
82
|
+
form.removeEffects('onChange');
|
81
83
|
form.addEffects('onChange', function () {
|
82
|
-
onFormValuesChange(function (form) {
|
84
|
+
onFormValuesChange(debounce(function (form) {
|
83
85
|
if (onChange) {
|
84
86
|
onChange(toJS(form.values));
|
85
87
|
}
|
86
|
-
});
|
88
|
+
}, 300));
|
87
89
|
});
|
88
90
|
}, [form, onChange]); // 配置表单默认值
|
89
91
|
|
@@ -5,18 +5,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
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
7
|
import { useField } from '@formily/react';
|
8
|
-
import { isPlainObj } from '@teamix/utils';
|
9
8
|
export default (function () {
|
10
9
|
var field = useField();
|
11
10
|
|
12
11
|
var refresh = function refresh() {
|
13
|
-
|
14
|
-
field.data = {
|
15
|
-
refresh: {}
|
16
|
-
};
|
17
|
-
} else {
|
18
|
-
field.data.refresh = _objectSpread({}, field.data.refresh);
|
19
|
-
}
|
12
|
+
field.data.refresh = _objectSpread({}, field.data.refresh);
|
20
13
|
};
|
21
14
|
|
22
15
|
return {
|
@@ -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,
|
package/es/form/typing.d.ts
CHANGED
@@ -64,6 +64,10 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
64
64
|
onSubmit?: ((values: any) => any) | CommonRequestConfig;
|
65
65
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
66
66
|
}
|
67
|
+
export interface FilterProps extends ProFormProps {
|
68
|
+
form: FormType;
|
69
|
+
onReset?: (payload?: any) => void;
|
70
|
+
}
|
67
71
|
export interface QueryFilterProps extends ProFormProps {
|
68
72
|
/**
|
69
73
|
* @deprecated triggerType已弃用
|
@@ -73,6 +77,7 @@ export interface QueryFilterProps extends ProFormProps {
|
|
73
77
|
expand?: boolean;
|
74
78
|
addonBefore?: ReactNode;
|
75
79
|
addonAfter?: ReactNode;
|
80
|
+
onInit?: (values: any) => void;
|
76
81
|
onFilter?: (values: any) => void;
|
77
82
|
onReset?: (payload?: any) => void;
|
78
83
|
}
|
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.18";
|
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.18';
|
31
31
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
32
32
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
|
33
33
|
hooks, nocode, templates, utils };
|
@@ -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
|
};
|