@teamix/pro 1.2.24 → 1.2.29
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/212.js +129 -129
- package/dist/pro.css +1 -1
- package/dist/pro.js +18112 -15660
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +2 -0
- package/es/actions/dialog.js +1 -1
- package/es/actions/index.d.ts +12 -9
- package/es/actions/index.js +56 -15
- package/es/actions/index.scss +12 -1
- package/es/form/Filter/AdvancedFilter.js +1 -1
- package/es/form/Filter/Layout.d.ts +5 -0
- package/es/form/Filter/Layout.js +82 -0
- package/es/form/Filter/SimpleFilter.js +30 -6
- package/es/form/Filter/index2.d.ts +2 -1
- package/es/form/Filter/index2.js +97 -116
- package/es/form/Filter/index2.scss +16 -45
- package/es/form/Filter/layout.scss +36 -0
- package/es/form/Filter/useSpecialProps.d.ts +6 -0
- package/es/form/Filter/useSpecialProps.js +37 -0
- package/es/form/ProForm/customComponent.d.ts +3 -0
- package/es/form/ProForm/customComponent.js +20 -0
- package/es/form/ProForm/index.scss +5 -6
- package/es/form/ProForm/useFormDisplayValues.js +14 -24
- package/es/form/SchemaForm/adapterType.js +1 -0
- package/es/form/SchemaForm/index.js +8 -6
- package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.d.ts +1 -1
- package/es/form/SchemaForm/initializeRules.js +3 -3
- package/es/form/fieldTypeMap.js +2 -1
- package/es/form/index.d.ts +4 -2
- package/es/form/index.js +4 -2
- package/es/form/typing.d.ts +16 -1
- package/es/form/utils.d.ts +2 -2
- package/es/form/utils.js +2 -2
- package/es/index.d.ts +5 -2
- package/es/index.js +6 -3
- package/es/info/index.scss +1 -1
- package/es/nocode/pages/renderer.js +1 -1
- package/es/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/HozStepItem/index.js +235 -0
- package/es/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/es/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/VerStepItem/index.js +295 -0
- package/es/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/es/step/ProStepItem/index.d.ts +4 -0
- package/es/step/ProStepItem/index.js +57 -0
- package/es/step/index.d.ts +9 -0
- package/es/step/index.js +101 -0
- package/es/step/typing.d.ts +96 -0
- package/es/step/typing.js +1 -0
- package/es/table/components/Filter/index.js +2 -17
- package/es/table/components/Layout/index.js +63 -167
- package/es/table/components/Layout/index.scss +4 -3
- package/es/table/components/Pagination/index.js +1 -0
- package/es/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/es/table/components/ToolBar/Fullscreen.js +21 -11
- package/es/table/index.js +89 -103
- package/es/table/typing.d.ts +14 -3
- package/es/table/utils/columnRender.js +21 -3
- package/es/table/utils/index.d.ts +7 -0
- package/es/table/utils/index.js +36 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/lib/actions/dialog.js +1 -1
- package/lib/actions/index.d.ts +12 -9
- package/lib/actions/index.js +56 -15
- package/lib/actions/index.scss +12 -1
- package/lib/form/Filter/AdvancedFilter.js +1 -1
- package/lib/form/Filter/Layout.d.ts +5 -0
- package/lib/form/Filter/Layout.js +102 -0
- package/lib/form/Filter/SimpleFilter.js +29 -4
- package/lib/form/Filter/index2.d.ts +2 -1
- package/lib/form/Filter/index2.js +101 -114
- package/lib/form/Filter/index2.scss +16 -45
- package/lib/form/Filter/layout.scss +36 -0
- package/lib/form/Filter/useSpecialProps.d.ts +6 -0
- package/lib/form/Filter/useSpecialProps.js +46 -0
- package/lib/form/ProForm/customComponent.d.ts +3 -0
- package/lib/form/ProForm/customComponent.js +28 -0
- package/lib/form/ProForm/index.scss +5 -6
- package/lib/form/ProForm/useFormDisplayValues.js +17 -24
- package/lib/form/SchemaForm/adapterType.js +1 -0
- package/lib/form/SchemaForm/index.js +8 -6
- package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRequest.js +2 -2
- package/lib/form/SchemaForm/initializeRules.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRules.js +3 -3
- package/lib/form/fieldTypeMap.js +2 -1
- package/lib/form/index.d.ts +4 -2
- package/lib/form/index.js +19 -1
- package/lib/form/typing.d.ts +16 -1
- package/lib/form/utils.d.ts +2 -2
- package/lib/form/utils.js +2 -2
- package/lib/index.d.ts +5 -2
- package/lib/index.js +35 -3
- package/lib/info/index.scss +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.js +258 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.js +315 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/lib/step/ProStepItem/index.d.ts +4 -0
- package/lib/step/ProStepItem/index.js +69 -0
- package/lib/step/index.d.ts +9 -0
- package/lib/step/index.js +124 -0
- package/lib/step/typing.d.ts +96 -0
- package/lib/step/typing.js +5 -0
- package/lib/table/components/Filter/index.js +2 -17
- package/lib/table/components/Layout/index.js +61 -167
- package/lib/table/components/Layout/index.scss +4 -3
- package/lib/table/components/Pagination/index.js +1 -0
- package/lib/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/lib/table/components/ToolBar/Fullscreen.js +22 -11
- package/lib/table/index.js +85 -100
- package/lib/table/typing.d.ts +14 -3
- package/lib/table/utils/columnRender.js +21 -3
- package/lib/table/utils/index.d.ts +7 -0
- package/lib/table/utils/index.js +38 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/package.json +4 -4
package/es/form/Filter/index2.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["addonAfter", "addonBefore", "
|
1
|
+
var _excluded = ["addonAfter", "addonBefore", "mode", "expand", "formRef", "defaultFilterValue", "filterDebounce", "onFilter", "onInit", "onReset", "onExpand"];
|
2
2
|
|
3
3
|
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; }
|
4
4
|
|
@@ -6,6 +6,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
6
6
|
|
7
7
|
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; }
|
8
8
|
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
10
|
+
|
11
|
+
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."); }
|
12
|
+
|
13
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
14
|
+
|
15
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
16
|
+
|
9
17
|
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); } }
|
10
18
|
|
11
19
|
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); }); }; }
|
@@ -28,68 +36,36 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
28
36
|
|
29
37
|
import React, { memo, useCallback, useMemo, useState, useRef, useEffect } from 'react';
|
30
38
|
import cls from 'classnames';
|
31
|
-
import
|
32
|
-
import
|
39
|
+
import debounce from 'lodash.debounce';
|
40
|
+
import { Tag } from '@alicloudfe/components';
|
33
41
|
import { createForm, onFormReact, onFormInputChange } from '@formily/core';
|
34
42
|
import { toJS } from '@formily/reactive';
|
35
|
-
import { usePrefixCls,
|
43
|
+
import { usePrefixCls, isSignificative, isNum } from '@teamix/utils';
|
36
44
|
import ProField from '../../field/index';
|
37
45
|
import fieldTypeMap from '../fieldTypeMap';
|
38
46
|
import { getFormDisplayValues } from '../ProForm/useFormDisplayValues';
|
39
47
|
import SimpleFilter from './SimpleFilter';
|
40
48
|
import LightFilter from './LightFilter';
|
41
49
|
import AdvancedFilter from './AdvancedFilter';
|
42
|
-
import
|
43
|
-
import './
|
44
|
-
|
45
|
-
var getSpecialProps = function getSpecialProps(props) {
|
46
|
-
var initialValues = props.initialValues,
|
47
|
-
initialRequest = props.initialRequest;
|
48
|
-
var hasDefault = !!initialValues;
|
49
|
-
var hasAsyncDefault = !!initialRequest;
|
50
|
-
var hasRequired = false;
|
51
|
-
|
52
|
-
var hasDefaultOrRule = function hasDefaultOrRule(schema) {
|
53
|
-
schema.forEach(function (item) {
|
54
|
-
var value = item.default,
|
55
|
-
required = item.required,
|
56
|
-
rules = item.rules,
|
57
|
-
request = item.request,
|
58
|
-
dataSource = item.dataSource,
|
59
|
-
children = item.children;
|
60
|
-
hasDefault = hasDefault || isSignificative(value);
|
61
|
-
hasRequired = hasRequired || required || !!rules;
|
62
|
-
hasAsyncDefault = hasAsyncDefault || !!request || // 如果dataSource是异步且default取自dataSource
|
63
|
-
!!(isPlainObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
|
64
|
-
|
65
|
-
if (children === null || children === void 0 ? void 0 : children.length) {
|
66
|
-
hasDefaultOrRule(children);
|
67
|
-
}
|
68
|
-
});
|
69
|
-
};
|
70
|
-
|
71
|
-
hasDefaultOrRule(props.schema);
|
72
|
-
return {
|
73
|
-
hasDefault: hasDefault,
|
74
|
-
hasAsyncDefault: hasAsyncDefault,
|
75
|
-
hasRequired: hasRequired
|
76
|
-
};
|
77
|
-
};
|
50
|
+
import { QueryFilterLayout } from './Layout';
|
51
|
+
import useSpecialProps from './useSpecialProps';
|
52
|
+
import './index2.scss';
|
78
53
|
/**
|
79
54
|
* 查询筛选
|
80
55
|
*/
|
81
56
|
|
82
|
-
|
83
57
|
var QueryFilter = /*#__PURE__*/memo(function (props) {
|
84
58
|
var addonAfter = props.addonAfter,
|
85
59
|
addonBefore = props.addonBefore,
|
86
|
-
onFilter = props.onFilter,
|
87
|
-
onInit = props.onInit,
|
88
|
-
onReset = props.onReset,
|
89
60
|
mode = props.mode,
|
90
61
|
expand = props.expand,
|
91
62
|
formRef = props.formRef,
|
92
63
|
defaultFilterValue = props.defaultFilterValue,
|
64
|
+
filterDebounce = props.filterDebounce,
|
65
|
+
onFilter = props.onFilter,
|
66
|
+
onInit = props.onInit,
|
67
|
+
onReset = props.onReset,
|
68
|
+
onExpand = props.onExpand,
|
93
69
|
otherProps = _objectWithoutProperties(props, _excluded); // 表单默认值初始化回调
|
94
70
|
|
95
71
|
|
@@ -176,10 +152,10 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
176
152
|
advanced: advancedForm
|
177
153
|
};
|
178
154
|
|
179
|
-
var
|
180
|
-
hasDefault =
|
181
|
-
hasAsyncDefault =
|
182
|
-
hasRequired =
|
155
|
+
var _useSpecialProps = useSpecialProps(props),
|
156
|
+
hasDefault = _useSpecialProps.hasDefault,
|
157
|
+
hasAsyncDefault = _useSpecialProps.hasAsyncDefault,
|
158
|
+
hasRequired = _useSpecialProps.hasRequired;
|
183
159
|
|
184
160
|
var hasDefaultOrRequired = hasDefault || hasAsyncDefault || hasRequired;
|
185
161
|
|
@@ -205,22 +181,40 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
205
181
|
|
206
182
|
var getFilterDisplayValues = useCallback(function (form) {
|
207
183
|
var displayValues = getFormDisplayValues(form);
|
208
|
-
|
184
|
+
var originalData = Object.entries(displayValues);
|
185
|
+
var filterData = [];
|
186
|
+
originalData.forEach(function (_ref2) {
|
209
187
|
var _data$displayValue;
|
210
188
|
|
211
189
|
var _ref3 = _slicedToArray(_ref2, 2),
|
212
190
|
key = _ref3[0],
|
213
191
|
data = _ref3[1];
|
214
192
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
193
|
+
var value = (_data$displayValue = data.displayValue) !== null && _data$displayValue !== void 0 ? _data$displayValue : data.value;
|
194
|
+
var component = data.component;
|
195
|
+
|
196
|
+
if (component === 'SelectGroup') {
|
197
|
+
var _data$value;
|
198
|
+
|
199
|
+
(_data$value = data.value) === null || _data$value === void 0 ? void 0 : _data$value.forEach(function (item, index) {
|
200
|
+
filterData.push({
|
201
|
+
key: key,
|
202
|
+
type: fieldTypeMap['MultipleSelect'],
|
203
|
+
label: item.key,
|
204
|
+
value: item.value,
|
205
|
+
index: index
|
206
|
+
});
|
207
|
+
});
|
208
|
+
} else if (isSignificative(value)) {
|
209
|
+
filterData.push({
|
210
|
+
key: key,
|
211
|
+
type: fieldTypeMap[component] || 'text',
|
212
|
+
label: data.title,
|
213
|
+
value: value
|
214
|
+
});
|
215
|
+
}
|
223
216
|
});
|
217
|
+
return filterData;
|
224
218
|
}, []); // 设置标签数据
|
225
219
|
|
226
220
|
var configTag = useCallback(function () {
|
@@ -241,6 +235,7 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
241
235
|
}
|
242
236
|
|
243
237
|
setAdvancedFilterVisible(result);
|
238
|
+
onExpand === null || onExpand === void 0 ? void 0 : onExpand(result);
|
244
239
|
}, [advancedFilterVisible, configTag, currentForm.current]); // 简单搜索Filter
|
245
240
|
|
246
241
|
var onSimpleFilter = useCallback( /*#__PURE__*/function () {
|
@@ -325,8 +320,15 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
325
320
|
lightForm.reset();
|
326
321
|
}, [onReset]); // 关闭标签清空表单字段值
|
327
322
|
|
328
|
-
var onTagClose = useCallback(function (key) {
|
329
|
-
|
323
|
+
var onTagClose = useCallback(function (key, index) {
|
324
|
+
var newValue = undefined;
|
325
|
+
|
326
|
+
if (isNum(index)) {
|
327
|
+
newValue = _toConsumableArray(advancedForm.getValuesIn(key));
|
328
|
+
newValue.splice(index, 1);
|
329
|
+
}
|
330
|
+
|
331
|
+
advancedForm.setValuesIn(key, newValue);
|
330
332
|
configFilterItem(advancedForm);
|
331
333
|
configTag();
|
332
334
|
onFilter && onFilter(toJS(advancedForm.values));
|
@@ -341,57 +343,44 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
341
343
|
useEffect(function () {
|
342
344
|
setCurrentForm(currentForm.current);
|
343
345
|
}, []);
|
344
|
-
return /*#__PURE__*/React.createElement(
|
345
|
-
className: cls(prefixCls, props.className)
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
}, addonBefore ? /*#__PURE__*/React.createElement("div", {
|
351
|
-
className: "".concat(prefixCls, "-addonBefore")
|
352
|
-
}, addonBefore) : null, mode === 'panel' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
353
|
-
className: cls("".concat(prefixCls, "-inline-form"), hasDefaultOrRequired ? "".concat(prefixCls, "-inline-form-hidden") : '')
|
354
|
-
}, /*#__PURE__*/React.createElement(LightFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
355
|
-
defaultFilterValue: defaultFilterValue,
|
356
|
-
form: lightForm,
|
357
|
-
onChange: debounce(onLightFilter, 300)
|
358
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
359
|
-
className: "".concat(prefixCls, "-toggle")
|
360
|
-
}, /*#__PURE__*/React.createElement(Badge, {
|
346
|
+
return /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
347
|
+
className: cls(prefixCls, props.className),
|
348
|
+
addonBefore: addonBefore,
|
349
|
+
addonAfter: addonAfter,
|
350
|
+
expand: advancedFilterVisible,
|
351
|
+
onExpand: toggleAdvancedFilter,
|
361
352
|
count: tagDataSource.length,
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
}, /*#__PURE__*/React.createElement("div", {
|
385
|
-
className: cls("".concat(prefixCls, "-tag"), advancedFilterVisible ? "".concat(prefixCls, "-tag-hidden") : '')
|
386
|
-
}, /*#__PURE__*/React.createElement(Tag.Group, null, tagDataSource.map(function (_ref7) {
|
353
|
+
inlineContent: mode === 'panel' ? /*#__PURE__*/React.createElement("div", {
|
354
|
+
className: cls("".concat(prefixCls, "-inline"), hasDefaultOrRequired ? "".concat(prefixCls, "-inline-hidden") : '')
|
355
|
+
}, /*#__PURE__*/React.createElement(LightFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
356
|
+
defaultFilterValue: defaultFilterValue,
|
357
|
+
form: lightForm,
|
358
|
+
onChange: debounce(onLightFilter, filterDebounce)
|
359
|
+
}))) : /*#__PURE__*/React.createElement("div", {
|
360
|
+
className: "".concat(prefixCls, "-inline")
|
361
|
+
}, /*#__PURE__*/React.createElement(SimpleFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
362
|
+
form: simpleForm,
|
363
|
+
onChange: debounce(onSimpleFilter, filterDebounce),
|
364
|
+
onSubmit: onSimpleFilter
|
365
|
+
}))),
|
366
|
+
panelContent: mode === 'panel' ? /*#__PURE__*/React.createElement(AdvancedFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
367
|
+
initialRequest: otherProps.initialRequest ? _objectSpread(_objectSpread({}, otherProps.initialRequest), {}, {
|
368
|
+
onComplete: onInitialRequestComplete
|
369
|
+
}) : undefined,
|
370
|
+
form: advancedForm,
|
371
|
+
onSubmit: onAdvancedFilter,
|
372
|
+
onReset: onAdvancedReset
|
373
|
+
})) : null
|
374
|
+
}, mode === 'panel' && !advancedFilterVisible ? /*#__PURE__*/React.createElement(Tag.Group, null, tagDataSource.map(function (_ref7) {
|
387
375
|
var key = _ref7.key,
|
388
376
|
label = _ref7.label,
|
389
377
|
value = _ref7.value,
|
390
|
-
type = _ref7.type
|
378
|
+
type = _ref7.type,
|
379
|
+
index = _ref7.index;
|
391
380
|
return /*#__PURE__*/React.createElement(Tag.Closeable, {
|
392
|
-
key: key,
|
381
|
+
key: isNum(index) ? key + label : key,
|
393
382
|
afterClose: function afterClose() {
|
394
|
-
return onTagClose(key);
|
383
|
+
return onTagClose(key, index);
|
395
384
|
}
|
396
385
|
}, /*#__PURE__*/React.createElement("span", {
|
397
386
|
className: "".concat(prefixCls, "-tag-title")
|
@@ -401,19 +390,11 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
401
390
|
type: type,
|
402
391
|
value: value
|
403
392
|
})));
|
404
|
-
}))
|
405
|
-
className: cls("".concat(prefixCls, "-advanced-wrap"), !advancedFilterVisible ? "".concat(prefixCls, "-advanced-wrap-hidden") : '')
|
406
|
-
}, /*#__PURE__*/React.createElement(AdvancedFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
407
|
-
initialRequest: otherProps.initialRequest ? _objectSpread(_objectSpread({}, otherProps.initialRequest), {}, {
|
408
|
-
onComplete: onInitialRequestComplete
|
409
|
-
}) : undefined,
|
410
|
-
form: advancedForm,
|
411
|
-
onSubmit: onAdvancedFilter,
|
412
|
-
onReset: onAdvancedReset
|
413
|
-
})))) : null);
|
393
|
+
})) : null);
|
414
394
|
});
|
415
395
|
QueryFilter.defaultProps = {
|
416
396
|
mode: 'inline',
|
417
|
-
expand: false
|
397
|
+
expand: false,
|
398
|
+
filterDebounce: 300
|
418
399
|
};
|
419
|
-
export { QueryFilter };
|
400
|
+
export { QueryFilter, QueryFilterLayout };
|
@@ -4,31 +4,12 @@ $query-filter: #{$teamix-pro-form}-query-filter;
|
|
4
4
|
|
5
5
|
.#{$query-filter} {
|
6
6
|
.#{$query-filter}-inline {
|
7
|
-
display: flex;
|
8
|
-
justify-content: space-between;
|
9
|
-
}
|
10
|
-
.#{$query-filter}-left {
|
11
|
-
display: flex;
|
12
|
-
}
|
13
|
-
.#{$query-filter}-addonBefore {
|
14
|
-
flex: 0 1 auto;
|
15
|
-
margin-right: 8px;
|
16
|
-
}
|
17
|
-
.#{$query-filter}-inline-form {
|
18
|
-
flex: 0 0 auto;
|
19
7
|
margin-right: 8px;
|
20
8
|
margin-bottom: 8px;
|
21
9
|
}
|
22
|
-
.#{$query-filter}-inline-
|
10
|
+
.#{$query-filter}-inline-hidden {
|
23
11
|
display: none;
|
24
12
|
}
|
25
|
-
.#{$query-filter}-toggle {
|
26
|
-
margin-bottom: 8px;
|
27
|
-
}
|
28
|
-
.#{$query-filter}-addonAfter {
|
29
|
-
flex: 0 1 auto;
|
30
|
-
margin-left: 8px;
|
31
|
-
}
|
32
13
|
.#{$query-filter}-tag-title {
|
33
14
|
margin-right: 12px;
|
34
15
|
color: var(--color-text1-8, #848484);
|
@@ -42,34 +23,24 @@ $query-filter: #{$teamix-pro-form}-query-filter;
|
|
42
23
|
}
|
43
24
|
}
|
44
25
|
}
|
45
|
-
|
46
|
-
display: none;
|
47
|
-
}
|
48
|
-
.#{$query-filter}-advanced-wrap {
|
49
|
-
padding: 16px;
|
50
|
-
background-color: var(--color-fill1-2, #f7f7f7);
|
51
|
-
}
|
52
|
-
.#{$query-filter}-advanced-wrap-hidden {
|
53
|
-
display: none;
|
54
|
-
}
|
26
|
+
}
|
55
27
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
}
|
28
|
+
.#{$query-filter}-advanced {
|
29
|
+
.#{$css-prefix}formily-button-group {
|
30
|
+
margin-top: 0;
|
60
31
|
}
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
32
|
+
}
|
33
|
+
.#{$query-filter}-advanced,
|
34
|
+
.#{$query-filter}-simple,
|
35
|
+
.#{$query-filter}-light {
|
36
|
+
.#{$form-item-cls}-feedback-layout-popover {
|
37
|
+
margin-bottom: 0;
|
38
|
+
}
|
39
|
+
.#{$css-prefix}date-picker2-input {
|
40
|
+
.#{$css-prefix}input {
|
41
|
+
width: inherit;
|
42
|
+
input {
|
69
43
|
width: inherit;
|
70
|
-
input {
|
71
|
-
width: inherit;
|
72
|
-
}
|
73
44
|
}
|
74
45
|
}
|
75
46
|
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
@import '../global.scss';
|
2
|
+
|
3
|
+
$query-filter-layout: #{$teamix-pro-form}-query-filter-layout;
|
4
|
+
|
5
|
+
.theme-hybridcloud-dark {
|
6
|
+
--panel-filter-bg: #1f1f1f;
|
7
|
+
}
|
8
|
+
|
9
|
+
.#{$query-filter-layout} {
|
10
|
+
.#{$query-filter-layout}-inline {
|
11
|
+
display: flex;
|
12
|
+
justify-content: space-between;
|
13
|
+
}
|
14
|
+
.#{$query-filter-layout}-left {
|
15
|
+
display: flex;
|
16
|
+
}
|
17
|
+
.#{$query-filter-layout}-addonBefore {
|
18
|
+
flex: 0 1 auto;
|
19
|
+
margin-right: 8px;
|
20
|
+
}
|
21
|
+
.#{$query-filter-layout}-toggle {
|
22
|
+
margin-bottom: 8px;
|
23
|
+
}
|
24
|
+
.#{$query-filter-layout}-addonAfter {
|
25
|
+
flex: 0 1 auto;
|
26
|
+
margin-left: 8px;
|
27
|
+
}
|
28
|
+
.#{$query-filter-layout}-panel {
|
29
|
+
margin-bottom: 8px;
|
30
|
+
padding: 16px;
|
31
|
+
background-color: var(--panel-filter-bg, var(--color-fill1-2));
|
32
|
+
}
|
33
|
+
.#{$query-filter-layout}-panel-hidden {
|
34
|
+
display: none;
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { isSignificative, isStr, isPlainObj } from '@teamix/utils'; // 获取Schema是否包含默认值、异步默认值、必选校验等
|
2
|
+
|
3
|
+
var useSpecialProps = function useSpecialProps(props) {
|
4
|
+
var initialValues = props.initialValues,
|
5
|
+
initialRequest = props.initialRequest;
|
6
|
+
var hasDefault = !!initialValues;
|
7
|
+
var hasAsyncDefault = !!initialRequest;
|
8
|
+
var hasRequired = false;
|
9
|
+
|
10
|
+
var hasDefaultOrRule = function hasDefaultOrRule(schema) {
|
11
|
+
schema.forEach(function (item) {
|
12
|
+
var value = item.default,
|
13
|
+
required = item.required,
|
14
|
+
rules = item.rules,
|
15
|
+
request = item.request,
|
16
|
+
dataSource = item.dataSource,
|
17
|
+
children = item.children;
|
18
|
+
hasDefault = hasDefault || isSignificative(value);
|
19
|
+
hasRequired = hasRequired || required || !!rules;
|
20
|
+
hasAsyncDefault = hasAsyncDefault || !!request || // 如果dataSource是异步且default取自dataSource
|
21
|
+
!!(isPlainObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
|
22
|
+
|
23
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
24
|
+
hasDefaultOrRule(children);
|
25
|
+
}
|
26
|
+
});
|
27
|
+
};
|
28
|
+
|
29
|
+
hasDefaultOrRule(props.schema);
|
30
|
+
return {
|
31
|
+
hasDefault: hasDefault,
|
32
|
+
hasAsyncDefault: hasAsyncDefault,
|
33
|
+
hasRequired: hasRequired
|
34
|
+
};
|
35
|
+
};
|
36
|
+
|
37
|
+
export default useSpecialProps;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
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; }
|
2
|
+
|
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
|
+
|
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
|
+
|
7
|
+
import { connect, mapProps } from '@formily/react';
|
8
|
+
import { toJS } from '@formily/reactive';
|
9
|
+
|
10
|
+
var customComponent = function customComponent(component) {
|
11
|
+
return connect(component, mapProps(function (props, field) {
|
12
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
13
|
+
field: field,
|
14
|
+
form: field.form,
|
15
|
+
values: toJS(field.form.values)
|
16
|
+
});
|
17
|
+
}));
|
18
|
+
};
|
19
|
+
|
20
|
+
export { customComponent };
|
@@ -186,18 +186,17 @@
|
|
186
186
|
}
|
187
187
|
|
188
188
|
// 数组类组件添加按钮
|
189
|
-
.#{$form-array}-base-addition {
|
189
|
+
.#{$css-prefix}btn.#{$form-array}-base-addition {
|
190
|
+
border-style: dashed;
|
190
191
|
.#{$css-prefix}formily-icon {
|
191
192
|
margin-right: 4px;
|
192
193
|
}
|
193
194
|
}
|
194
195
|
// 数组类ArrayItem Icon 居中
|
195
196
|
.#{$form-array}-items-item-inner {
|
196
|
-
|
197
|
-
> .#{$css-prefix}
|
198
|
-
|
199
|
-
margin-top: 9px;
|
200
|
-
}
|
197
|
+
.#{$css-prefix}space-item {
|
198
|
+
> .#{$css-prefix}formily-icon {
|
199
|
+
margin-top: 9px;
|
201
200
|
}
|
202
201
|
}
|
203
202
|
}
|
@@ -13,6 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
13
|
import { useForm } from '@formily/react';
|
14
14
|
import { toJS } from '@formily/reactive';
|
15
15
|
import { isArr, isPlainObj, isSignificative, getValueByValue } from '@teamix/utils';
|
16
|
+
import fieldTypeMap from '../fieldTypeMap';
|
16
17
|
/**
|
17
18
|
* 获取表单值的可显示值
|
18
19
|
* @returns 如果某字段有dataSource,则返回value对应label
|
@@ -36,30 +37,17 @@ var getDisplayValues = function getDisplayValues(form, values) {
|
|
36
37
|
|
37
38
|
var getAddress = function getAddress(path) {
|
38
39
|
return form.indexes[path];
|
39
|
-
}; //
|
40
|
+
}; // 当前field
|
40
41
|
|
41
42
|
|
42
|
-
var
|
43
|
-
return !isPlainObj(value) && !isArr(value) && !getAddress(connectPath(path));
|
44
|
-
};
|
45
|
-
|
46
|
-
var isLayoutValue = function isLayoutValue(object) {
|
47
|
-
var _Object$entries$ = _slicedToArray(Object.entries(object)[0], 2),
|
48
|
-
key = _Object$entries$[0],
|
49
|
-
value = _Object$entries$[1];
|
50
|
-
|
51
|
-
return !isFieldValue(value, key);
|
52
|
-
};
|
53
|
-
|
54
|
-
var isArrayValue = function isArrayValue(array) {
|
55
|
-
return !isFieldValue(array[0], 0);
|
56
|
-
}; // 判断值的类型,递归获取每个值在该结构中的完整路径
|
43
|
+
var field = form.query(getAddress(prefix)).take(); // 是否真实字段值(自定义组件、布局组件、自增数组组件为非真实字段)
|
57
44
|
|
45
|
+
var isFieldValue = Object.keys(fieldTypeMap).includes(field === null || field === void 0 ? void 0 : field.component[0]); // 判断值的类型,递归获取每个值在该结构中的完整路径
|
58
46
|
|
59
47
|
if (!isSignificative(values)) {
|
60
48
|
displayValues = {};
|
61
|
-
} else if (isPlainObj(values) &&
|
62
|
-
//
|
49
|
+
} else if (isPlainObj(values) && !isFieldValue) {
|
50
|
+
// 如果值是布局对象的值
|
63
51
|
displayValues = {};
|
64
52
|
Object.entries(values).forEach(function (_ref) {
|
65
53
|
var _ref2 = _slicedToArray(_ref, 2),
|
@@ -68,8 +56,10 @@ var getDisplayValues = function getDisplayValues(form, values) {
|
|
68
56
|
|
69
57
|
displayValues[key] = getDisplayValues(form, value, connectPath(key));
|
70
58
|
});
|
71
|
-
} else if (isArr(values) &&
|
72
|
-
//
|
59
|
+
} else if (isArr(values) && !isFieldValue) {
|
60
|
+
// 如果值是自增数组的值
|
61
|
+
// ArrayItems为字符串数组时,由于form.indexes中对应address为最后一个组件,无法正常获取displayName
|
62
|
+
// 例如:arrayItemsString.0: "arrayItemsString.0.ArrayItemsRemove"
|
73
63
|
displayValues = [];
|
74
64
|
values.map(function (value, index) {
|
75
65
|
displayValues[index] = getDisplayValues(form, value, connectPath(index));
|
@@ -78,14 +68,14 @@ var getDisplayValues = function getDisplayValues(form, values) {
|
|
78
68
|
var _values$value;
|
79
69
|
|
80
70
|
// 通过值的完整路径获取字段address(从form实例的indexes中),然后获取该字段的value在该字段dataSource中对应的label
|
81
|
-
var
|
82
|
-
var realValue = (_values$value = values === null || values === void 0 ? void 0 : values.value) !== null && _values$value !== void 0 ? _values$value : values; // 针对单个字段的值是对象
|
71
|
+
var realValue = (_values$value = values === null || values === void 0 ? void 0 : values.value) !== null && _values$value !== void 0 ? _values$value : values; // 针对单个字段的值是对象,例如Select的useDetailValue
|
83
72
|
|
73
|
+
var displayValue = getValueByValue(field === null || field === void 0 ? void 0 : field.dataSource, realValue);
|
84
74
|
displayValues = {
|
85
75
|
title: field === null || field === void 0 ? void 0 : field.title,
|
86
76
|
component: field === null || field === void 0 ? void 0 : field.component[0],
|
87
|
-
value:
|
88
|
-
displayValue:
|
77
|
+
value: values,
|
78
|
+
displayValue: displayValue
|
89
79
|
};
|
90
80
|
}
|
91
81
|
|
@@ -106,8 +106,10 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
106
106
|
}, [scope]); // 格式化 schema
|
107
107
|
|
108
108
|
var formatSchema = useCallback(function (schema) {
|
109
|
+
var suffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
109
110
|
var schemaProperties = {};
|
110
111
|
schema === null || schema === void 0 ? void 0 : schema.forEach(function (item, index) {
|
112
|
+
suffix = "".concat(suffix).concat(index);
|
111
113
|
var newItem = warning(item);
|
112
114
|
var _newItem = newItem,
|
113
115
|
originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
|
@@ -171,7 +173,7 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
171
173
|
component = _newItem2.component,
|
172
174
|
type = _newItem2.type,
|
173
175
|
_newItem2$name = _newItem2.name,
|
174
|
-
name = _newItem2$name === void 0 ? getFieldName(component === null || component === void 0 ? void 0 : component.replace(/\./g, ''),
|
176
|
+
name = _newItem2$name === void 0 ? getFieldName(component === null || component === void 0 ? void 0 : component.replace(/\./g, ''), suffix) : _newItem2$name,
|
175
177
|
decorator = _newItem2.decorator,
|
176
178
|
decoratorProps = _newItem2.decoratorProps,
|
177
179
|
dataSource = _newItem2.dataSource,
|
@@ -196,18 +198,18 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
196
198
|
var defaultDecoratorProps = _objectSpread(_objectSpread({}, tooltipProps), decoratorProps); // 初始化request
|
197
199
|
|
198
200
|
|
199
|
-
var _initializeRequest = initializeRequest(request,
|
201
|
+
var _initializeRequest = initializeRequest(request, suffix),
|
200
202
|
requestReactions = _initializeRequest.reactions,
|
201
203
|
requestScope = _initializeRequest.scope; // 初始化dataSource
|
202
204
|
|
203
205
|
|
204
|
-
var _initializeDataSource = initializeDataSource(dataSource,
|
206
|
+
var _initializeDataSource = initializeDataSource(dataSource, suffix),
|
205
207
|
defaultDataSource = _initializeDataSource.dataSource,
|
206
208
|
dataSourceReactions = _initializeDataSource.reactions,
|
207
209
|
dataSourceScope = _initializeDataSource.scope; // 初始化rules
|
208
210
|
|
209
211
|
|
210
|
-
var _initializeRules = initializeRules(rules,
|
212
|
+
var _initializeRules = initializeRules(rules, suffix),
|
211
213
|
defaultRules = _initializeRules.rules,
|
212
214
|
rulesScope = _initializeRules.scope; // 合并reactions,初始化reactions
|
213
215
|
|
@@ -235,11 +237,11 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
235
237
|
})); // 递归子组件
|
236
238
|
|
237
239
|
var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
|
238
|
-
properties: formatSchema(children)
|
240
|
+
properties: formatSchema(children, suffix)
|
239
241
|
} : {}; // 递归items(类似子组件,会先由各initialize方法格式化为固定形式,type不同不统一处理)
|
240
242
|
// 例如:[{ name: 'items', type: 'object', children: items }]
|
241
243
|
|
242
|
-
var recursiveItems = items ? formatSchema([items]) : {}; // 配置组件属性
|
244
|
+
var recursiveItems = items ? formatSchema([items], suffix) : {}; // 配置组件属性
|
243
245
|
|
244
246
|
schemaProperties[name] = _objectSpread(_objectSpread(_objectSpread({}, formatParam), recursiveProperties), recursiveItems);
|
245
247
|
});
|