@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
package/es/actions/dialog.js
CHANGED
@@ -226,7 +226,9 @@ export function useDialogAction(action, actionContext) {
|
|
226
226
|
className: "teamix-pro-dialog-before-content"
|
227
227
|
}, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/React.createElement("div", {
|
228
228
|
className: "teamix-pro-dialog-message"
|
229
|
-
}, renderProMessage(message
|
229
|
+
}, renderProMessage(message, {
|
230
|
+
type: 'notice'
|
231
|
+
})), dialogContent, afterContent && /*#__PURE__*/React.createElement("div", {
|
230
232
|
className: "teamix-pro-dialog-after-content"
|
231
233
|
}, addContextForReactNode(afterContent, dialogContext)), footerDescription && /*#__PURE__*/React.createElement("div", {
|
232
234
|
className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
package/es/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;
|
package/es/actions/index.js
CHANGED
@@ -3,8 +3,8 @@ var _excluded = ["type"],
|
|
3
3
|
_excluded3 = ["loading"],
|
4
4
|
_excluded4 = ["icon", "iconSize", "label", "actions", "children", "context", "type"],
|
5
5
|
_excluded5 = ["context", "text"],
|
6
|
-
_excluded6 = ["actions"],
|
7
|
-
_excluded7 = ["config"],
|
6
|
+
_excluded6 = ["key", "actions"],
|
7
|
+
_excluded7 = ["key", "config"],
|
8
8
|
_excluded8 = ["type", "divider", "max", "moreText", "context", "actions", "className"];
|
9
9
|
|
10
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
@@ -205,8 +205,8 @@ function renderCommonActionButtonMenuItem(action, key, context) {
|
|
205
205
|
return /*#__PURE__*/React.createElement(Menu.SubMenu, {
|
206
206
|
key: key,
|
207
207
|
label: menuBtn.label || menuBtn.children
|
208
|
-
}, menuBtn.actions.map(function (a
|
209
|
-
return renderCommonActionButtonMenuItem(a,
|
208
|
+
}, menuBtn.actions.map(function (a) {
|
209
|
+
return renderCommonActionButtonMenuItem(a, a.key, context);
|
210
210
|
}));
|
211
211
|
}
|
212
212
|
|
@@ -241,7 +241,7 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
241
241
|
type: type,
|
242
242
|
label: buttonContent(label || children, icon, iconSize, context)
|
243
243
|
}, others), actions.map(function (action, i) {
|
244
|
-
return renderCommonActionButtonMenuItem(action,
|
244
|
+
return renderCommonActionButtonMenuItem(action, action.key || i, context);
|
245
245
|
}));
|
246
246
|
}; // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
|
247
247
|
|
@@ -252,7 +252,9 @@ function formatGroupActions(actions, max, moreConfig) {
|
|
252
252
|
return actions;
|
253
253
|
}
|
254
254
|
|
255
|
-
return [].concat(_toConsumableArray(actions.slice(0, MAX - 1)), [_objectSpread(_objectSpread({
|
255
|
+
return [].concat(_toConsumableArray(actions.slice(0, MAX - 1)), [_objectSpread(_objectSpread({
|
256
|
+
key: '__teamix_pro_action_group_more_btn'
|
257
|
+
}, moreConfig), {}, {
|
256
258
|
actions: actions.slice(MAX - 1)
|
257
259
|
})]);
|
258
260
|
} // 渲染一个 button 或者 menu button
|
@@ -298,22 +300,34 @@ function getDefaultMoreButton(type, moreText) {
|
|
298
300
|
|
299
301
|
var MAX_ACTTIONS = 4;
|
300
302
|
|
301
|
-
function
|
303
|
+
function getKey(index, key) {
|
304
|
+
if (key !== undefined) {
|
305
|
+
return key;
|
306
|
+
}
|
307
|
+
|
308
|
+
return "__teamix_pro_action_key_".concat(index);
|
309
|
+
}
|
310
|
+
|
311
|
+
function getActionConfig(action, index, context) {
|
302
312
|
if (action.actions) {
|
303
|
-
var
|
313
|
+
var _key = action.key,
|
314
|
+
actions = action.actions,
|
304
315
|
_others = _objectWithoutProperties(action, _excluded6);
|
305
316
|
|
306
317
|
return _objectSpread({
|
307
|
-
|
308
|
-
|
318
|
+
key: getKey(index, _key),
|
319
|
+
actions: actions.map(function (a, j) {
|
320
|
+
return getActionConfig(a, j, context);
|
309
321
|
})
|
310
322
|
}, getTargetValue(_others, context));
|
311
323
|
}
|
312
324
|
|
313
|
-
var
|
325
|
+
var key = action.key,
|
326
|
+
config = action.config,
|
314
327
|
others = _objectWithoutProperties(action, _excluded7);
|
315
328
|
|
316
329
|
return _objectSpread({
|
330
|
+
key: getKey(index, key),
|
317
331
|
config: config
|
318
332
|
}, getTargetValue(others, context));
|
319
333
|
}
|
@@ -333,8 +347,8 @@ export function ProActionGroup(props) {
|
|
333
347
|
containerProps = _objectWithoutProperties(props, _excluded8);
|
334
348
|
|
335
349
|
var isTypeText = type === 'text';
|
336
|
-
var filteredActions = actions.map(function (action) {
|
337
|
-
return getActionConfig(action, context);
|
350
|
+
var filteredActions = actions.map(function (action, index) {
|
351
|
+
return getActionConfig(action, index, context);
|
338
352
|
}).filter(function (action) {
|
339
353
|
return action.visible !== false;
|
340
354
|
});
|
@@ -346,7 +360,7 @@ export function ProActionGroup(props) {
|
|
346
360
|
}, containerProps), formatedActions.map(function (actionBtn, i) {
|
347
361
|
var isLastOne = i === formatedActions.length - 1;
|
348
362
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
349
|
-
key:
|
363
|
+
key: actionBtn.key
|
350
364
|
}, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/React.createElement(Divider, {
|
351
365
|
direction: "ver"
|
352
366
|
}));
|
package/es/card/index.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ProTagItem } from '@teamix/utils';
|
3
|
+
import { ProMessageProps } from '../utils/message';
|
3
4
|
import { ProActionGroupProps } from '../actions';
|
4
5
|
import './index.scss';
|
5
6
|
export * from './card-container';
|
@@ -24,6 +25,8 @@ export interface ProCardProps extends Omit<React.HTMLAttributes<HTMLElement>, 't
|
|
24
25
|
actions?: React.ReactNode | ProActionGroupProps;
|
25
26
|
/** 卡片背景图 */
|
26
27
|
image?: string;
|
28
|
+
/** 位于弹窗内容上方的消息提示区 */
|
29
|
+
message?: ProMessageProps;
|
27
30
|
/** 卡片标题下方是否有分割线 */
|
28
31
|
divider?: boolean;
|
29
32
|
/**
|
@@ -87,7 +90,7 @@ export declare const ProCard: {
|
|
87
90
|
Selectable: {
|
88
91
|
(props: import("./selectable").ProCardSelectableProps): JSX.Element;
|
89
92
|
defaultProps: {
|
90
|
-
hoveredShadow: boolean;
|
93
|
+
hoveredShadow: boolean; /** 标签组 */
|
91
94
|
};
|
92
95
|
isProCard: boolean;
|
93
96
|
};
|
package/es/card/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
var _excluded = ["context"],
|
2
|
-
_excluded2 = ["children", "title", "subTitle", "tooltip", "tooltipIcon", "tags", "description", "extra", "actions", "style", "className", "image", "hoveredShadow", "divider", "bordered", "compacted", "centered", "loading", "empty", "borderColor", "backgroundColor", "contentClassName", "contentStyle", "direction", "wrap", "spacing", "split", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "context"];
|
2
|
+
_excluded2 = ["children", "title", "subTitle", "tooltip", "tooltipIcon", "tags", "description", "extra", "actions", "message", "style", "className", "image", "hoveredShadow", "divider", "bordered", "compacted", "centered", "loading", "empty", "borderColor", "backgroundColor", "contentClassName", "contentStyle", "direction", "wrap", "spacing", "split", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "context"];
|
3
3
|
|
4
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
5
5
|
|
@@ -29,6 +29,7 @@ import Result from '@teamix/result';
|
|
29
29
|
import { Card as BasicCard, Balloon } from '@alicloudfe/components';
|
30
30
|
import TeamixIcon from '@teamix/icon';
|
31
31
|
import { baseClass, getMessage, renderTags } from '@teamix/utils';
|
32
|
+
import { renderProMessage } from '../utils/message';
|
32
33
|
import { ProSkeletonRaw } from '../skeleton';
|
33
34
|
import { ProActionGroup } from '../actions';
|
34
35
|
import { formatSpacing, getColClassAndStyle } from './utils';
|
@@ -80,6 +81,7 @@ export var ProCard = function ProCard(props) {
|
|
80
81
|
description = props.description,
|
81
82
|
extra = props.extra,
|
82
83
|
actions = props.actions,
|
84
|
+
message = props.message,
|
83
85
|
style = props.style,
|
84
86
|
className = props.className,
|
85
87
|
image = props.image,
|
@@ -249,7 +251,11 @@ export var ProCard = function ProCard(props) {
|
|
249
251
|
style: {
|
250
252
|
padding: '50px 0 60px'
|
251
253
|
}
|
252
|
-
})), !empty &&
|
254
|
+
})), !empty && /*#__PURE__*/React.createElement(React.Fragment, null, message && /*#__PURE__*/React.createElement("div", {
|
255
|
+
className: cls('content-message')
|
256
|
+
}, renderProMessage(message, {
|
257
|
+
type: 'notice'
|
258
|
+
})), childrenModified))));
|
253
259
|
};
|
254
260
|
ProCard.defaultProps = {
|
255
261
|
bordered: true,
|
package/es/card/index.scss
CHANGED
@@ -30,8 +30,7 @@ var useMain = function useMain(active) {
|
|
30
30
|
var main = [];
|
31
31
|
schema.mapProperties(function (schema, name) {
|
32
32
|
// console.log(schema.required); // 添加 *
|
33
|
-
console.log(schema);
|
34
|
-
|
33
|
+
// console.log(schema);
|
35
34
|
if (schema.name === active) {
|
36
35
|
main.push({
|
37
36
|
name: name,
|
package/es/form/Filter/index.js
CHANGED
@@ -75,7 +75,7 @@ var SimpleFilter = /*#__PURE__*/memo(function (props) {
|
|
75
75
|
}
|
76
76
|
}])
|
77
77
|
}];
|
78
|
-
}, []);
|
78
|
+
}, [schema, triggerType]);
|
79
79
|
var eventProps = getEventProps(triggerType, onFilter);
|
80
80
|
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread({
|
81
81
|
feedbackLayout: "popover",
|
@@ -152,7 +152,7 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
152
152
|
}]
|
153
153
|
}])
|
154
154
|
}];
|
155
|
-
}, []);
|
155
|
+
}, [schema, onReset, triggerType]);
|
156
156
|
var getTeamixLayout = useMemo(function () {
|
157
157
|
return {
|
158
158
|
breakpoints: [990],
|
package/es/form/Filter/index2.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
var _excluded = ["schema", "
|
2
|
-
_excluded2 = ["schema", "
|
3
|
-
_excluded3 = ["
|
1
|
+
var _excluded = ["schema", "onChange", "onSubmit"],
|
2
|
+
_excluded2 = ["form", "schema", "onSubmit", "onChange"],
|
3
|
+
_excluded3 = ["schema", "onSubmit", "onChange", "onReset", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol"],
|
4
|
+
_excluded4 = ["addonAfter", "addonBefore", "onFilter", "mode", "expand"];
|
4
5
|
|
5
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
6
7
|
|
@@ -22,16 +23,16 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
22
23
|
|
23
24
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
24
25
|
|
25
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
26
|
-
|
27
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
28
|
-
|
29
26
|
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; }
|
30
27
|
|
31
28
|
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; }
|
32
29
|
|
33
30
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
34
31
|
|
32
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
33
|
+
|
34
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
35
|
+
|
35
36
|
import React, { memo, useCallback, useMemo, useState, useEffect } from 'react';
|
36
37
|
import cls from 'classnames';
|
37
38
|
import { Tag, Button, Badge } from '@alicloudfe/components';
|
@@ -44,42 +45,14 @@ import fieldTypeMap from '../fieldTypeMap';
|
|
44
45
|
import { getFormDisplayValues } from '../ProForm/useFormDisplayValues';
|
45
46
|
import { mergeArrayValue } from '../utils';
|
46
47
|
import './index2.scss';
|
47
|
-
|
48
|
-
var getEventProps = function getEventProps(triggerType, onFilter) {
|
49
|
-
var keydownEvent = {
|
50
|
-
onSubmit: onFilter
|
51
|
-
};
|
52
|
-
var changeEvent = {
|
53
|
-
onChange: onFilter
|
54
|
-
};
|
55
|
-
var eventMap = {
|
56
|
-
keydown: keydownEvent,
|
57
|
-
change: _objectSpread(_objectSpread({}, keydownEvent), changeEvent),
|
58
|
-
submit: keydownEvent
|
59
|
-
};
|
60
|
-
return eventMap[triggerType];
|
61
|
-
};
|
62
|
-
|
63
|
-
var schemaTemp = [{
|
64
|
-
name: 'taskName',
|
65
|
-
title: '实例名称',
|
66
|
-
component: 'Input',
|
67
|
-
required: true,
|
68
|
-
props: {
|
69
|
-
style: {
|
70
|
-
width: 180
|
71
|
-
},
|
72
|
-
placeholder: '请输入'
|
73
|
-
}
|
74
|
-
}];
|
75
48
|
/**
|
76
49
|
* 简单筛选
|
77
50
|
*/
|
78
51
|
|
79
52
|
var SimpleFilter = /*#__PURE__*/memo(function (props) {
|
80
53
|
var schema = props.schema,
|
81
|
-
|
82
|
-
|
54
|
+
onChange = props.onChange,
|
55
|
+
onSubmit = props.onSubmit,
|
83
56
|
otherProps = _objectWithoutProperties(props, _excluded);
|
84
57
|
|
85
58
|
var prefixCls = usePrefixCls('', {
|
@@ -91,48 +64,87 @@ var SimpleFilter = /*#__PURE__*/memo(function (props) {
|
|
91
64
|
props: {
|
92
65
|
size: 8
|
93
66
|
},
|
94
|
-
children:
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
display: 'none'
|
101
|
-
})
|
67
|
+
children: schema
|
68
|
+
}, {
|
69
|
+
component: 'Submit',
|
70
|
+
props: {
|
71
|
+
style: {
|
72
|
+
display: 'none'
|
102
73
|
}
|
103
|
-
}
|
74
|
+
}
|
104
75
|
}];
|
105
|
-
}, []);
|
106
|
-
|
107
|
-
|
76
|
+
}, [schema]);
|
77
|
+
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread({}, otherProps), {}, {
|
78
|
+
className: cls(prefixCls, props.className),
|
79
|
+
schema: simpleSchema,
|
108
80
|
feedbackLayout: "popover",
|
109
81
|
breakpoints: [],
|
110
|
-
inset: true
|
111
|
-
|
82
|
+
inset: true,
|
83
|
+
onSubmit: onSubmit,
|
84
|
+
onChange: onChange
|
85
|
+
}));
|
86
|
+
});
|
87
|
+
/**
|
88
|
+
* 轻量筛选
|
89
|
+
*/
|
90
|
+
|
91
|
+
var LightFilter = /*#__PURE__*/memo(function (props) {
|
92
|
+
var form = props.form,
|
93
|
+
schema = props.schema,
|
94
|
+
onSubmit = props.onSubmit,
|
95
|
+
onChange = props.onChange,
|
96
|
+
otherProps = _objectWithoutProperties(props, _excluded2);
|
97
|
+
|
98
|
+
var prefixCls = usePrefixCls('', {
|
99
|
+
prefix: 'teamix-pro-form-query-filter-light'
|
100
|
+
});
|
101
|
+
var LightSchema = useMemo(function () {
|
102
|
+
return [{
|
103
|
+
component: 'LightFilter',
|
104
|
+
children: schema
|
105
|
+
}, {
|
106
|
+
component: 'Submit',
|
107
|
+
props: {
|
108
|
+
style: {
|
109
|
+
display: 'none'
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}];
|
113
|
+
}, [schema]); // useEffect(() => {
|
114
|
+
// form.addEffects('onChange', () => {
|
115
|
+
// onFieldValueChange('',(field:any) => {
|
116
|
+
// console.log(field.value);
|
117
|
+
// });
|
118
|
+
// });
|
119
|
+
// }, [form, onChange]);
|
120
|
+
|
121
|
+
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread({}, otherProps), {}, {
|
122
|
+
form: form,
|
112
123
|
className: cls(prefixCls, props.className),
|
113
|
-
schema:
|
124
|
+
schema: LightSchema,
|
125
|
+
feedbackLayout: "popover",
|
126
|
+
breakpoints: [],
|
127
|
+
bordered: false,
|
128
|
+
onSubmit: onSubmit,
|
129
|
+
onChange: onChange
|
114
130
|
}));
|
115
131
|
});
|
116
|
-
SimpleFilter.defaultProps = {
|
117
|
-
triggerType: 'change'
|
118
|
-
};
|
119
132
|
/**
|
120
133
|
* 高级筛选
|
121
134
|
*/
|
122
135
|
|
123
136
|
var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
124
|
-
var form = useMemo(function () {
|
125
|
-
return (props === null || props === void 0 ? void 0 : props.form) || createForm();
|
126
|
-
}, []);
|
127
137
|
var schema = props.schema,
|
128
|
-
|
129
|
-
|
138
|
+
onSubmit = props.onSubmit,
|
139
|
+
onChange = props.onChange,
|
130
140
|
onReset = props.onReset,
|
131
141
|
layout = props.layout,
|
132
142
|
labelAlign = props.labelAlign,
|
133
143
|
wrapperAlign = props.wrapperAlign,
|
134
144
|
labelCol = props.labelCol,
|
135
|
-
wrapperCol = props.wrapperCol
|
145
|
+
wrapperCol = props.wrapperCol,
|
146
|
+
otherProps = _objectWithoutProperties(props, _excluded3);
|
147
|
+
|
136
148
|
var prefixCls = usePrefixCls('', {
|
137
149
|
prefix: 'teamix-pro-form-query-filter-advanced'
|
138
150
|
});
|
@@ -160,26 +172,21 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
160
172
|
component: 'Reset',
|
161
173
|
props: {
|
162
174
|
onResetValidateSuccess: onReset,
|
163
|
-
style: _objectSpread({}, triggerType === 'submit' ? {} : {
|
164
|
-
marginRight: -16
|
165
|
-
}),
|
166
175
|
children: getMessage('reset')
|
167
176
|
}
|
168
177
|
}, {
|
169
178
|
component: 'Submit',
|
170
179
|
props: {
|
171
|
-
style:
|
180
|
+
style: {
|
172
181
|
marginRight: -8
|
173
|
-
}
|
174
|
-
display: 'none'
|
175
|
-
}),
|
182
|
+
},
|
176
183
|
children: getMessage('search')
|
177
184
|
}
|
178
185
|
}]
|
179
186
|
}]
|
180
187
|
}])
|
181
188
|
}];
|
182
|
-
}, []);
|
189
|
+
}, [schema, onReset]);
|
183
190
|
var getTeamixLayout = useMemo(function () {
|
184
191
|
return {
|
185
192
|
breakpoints: [990],
|
@@ -190,61 +197,39 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
190
197
|
wrapperCol: mergeArrayValue([24], wrapperCol)
|
191
198
|
};
|
192
199
|
}, [layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
193
|
-
|
194
|
-
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
195
|
-
feedbackLayout: "popover"
|
196
|
-
}, props), eventProps), getTeamixLayout), {}, {
|
197
|
-
form: form,
|
200
|
+
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread({
|
198
201
|
className: cls(prefixCls, props.className),
|
199
202
|
schema: gridSchema,
|
200
|
-
|
203
|
+
feedbackLayout: "popover"
|
204
|
+
}, otherProps), getTeamixLayout), {}, {
|
205
|
+
onSubmit: onSubmit
|
201
206
|
}));
|
202
207
|
});
|
203
208
|
AdvancedFilter.defaultProps = {
|
204
|
-
triggerType: 'change',
|
205
209
|
layout: 'horizontal',
|
206
210
|
labelAlign: 'right',
|
207
211
|
labelCol: 6,
|
208
212
|
wrapperCol: 18
|
209
213
|
};
|
210
214
|
/**
|
211
|
-
*
|
215
|
+
* 查询筛选
|
212
216
|
*/
|
213
217
|
|
214
|
-
var
|
215
|
-
var
|
216
|
-
|
218
|
+
var QueryFilter = /*#__PURE__*/memo(function (props) {
|
219
|
+
var addonAfter = props.addonAfter,
|
220
|
+
addonBefore = props.addonBefore,
|
217
221
|
onFilter = props.onFilter,
|
218
|
-
|
222
|
+
mode = props.mode,
|
223
|
+
expand = props.expand,
|
224
|
+
otherProps = _objectWithoutProperties(props, _excluded4);
|
219
225
|
|
220
|
-
var
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
component: 'LightFilter',
|
226
|
-
children: schema
|
227
|
-
}];
|
228
|
-
}, [schema]);
|
229
|
-
var eventProps = getEventProps(triggerType, onFilter);
|
230
|
-
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread({
|
231
|
-
feedbackLayout: "popover",
|
232
|
-
breakpoints: [],
|
233
|
-
bordered: false
|
234
|
-
}, otherProps), eventProps), {}, {
|
235
|
-
className: cls(prefixCls, props.className),
|
236
|
-
schema: LightSchema
|
237
|
-
}));
|
238
|
-
});
|
239
|
-
LightFilter.defaultProps = {
|
240
|
-
triggerType: 'change'
|
241
|
-
};
|
242
|
-
/**
|
243
|
-
* 查询筛选
|
244
|
-
*/
|
226
|
+
var form = useMemo(function () {
|
227
|
+
return props.form || createForm({
|
228
|
+
validateFirst: true
|
229
|
+
});
|
230
|
+
}, []);
|
245
231
|
|
246
|
-
var
|
247
|
-
var _useState = useState(true),
|
232
|
+
var _useState = useState(expand),
|
248
233
|
_useState2 = _slicedToArray(_useState, 2),
|
249
234
|
advancedFilterVisible = _useState2[0],
|
250
235
|
setAdvancedFilterVisible = _useState2[1];
|
@@ -254,17 +239,6 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
254
239
|
tagDataSource = _useState4[0],
|
255
240
|
setTagDataSource = _useState4[1];
|
256
241
|
|
257
|
-
var outerForm = props.form,
|
258
|
-
addonAfter = props.addonAfter,
|
259
|
-
addonBefore = props.addonBefore,
|
260
|
-
onFilter = props.onFilter,
|
261
|
-
otherProps = _objectWithoutProperties(props, _excluded3);
|
262
|
-
|
263
|
-
var form = useMemo(function () {
|
264
|
-
return outerForm || createForm({
|
265
|
-
validateFirst: true
|
266
|
-
});
|
267
|
-
}, []);
|
268
242
|
var prefixCls = usePrefixCls('', {
|
269
243
|
prefix: 'teamix-pro-form-query-filter'
|
270
244
|
}); // 展开收起高级筛选
|
@@ -293,9 +267,20 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
293
267
|
}).filter(function (item) {
|
294
268
|
return isSignificative(item.value);
|
295
269
|
});
|
296
|
-
}, []); //
|
270
|
+
}, []); // 表单值提交
|
271
|
+
|
272
|
+
var onFormSubmit = useCallback(function (values) {
|
273
|
+
setTagDataSource(getTagDataSource(form));
|
274
|
+
onFilter && onFilter(values);
|
275
|
+
}, []); // 轻量表单onChange
|
276
|
+
|
277
|
+
var onLightValueChange = useCallback(function (values) {
|
278
|
+
form.reset();
|
279
|
+
setTagDataSource(getTagDataSource(form));
|
280
|
+
onFilter && onFilter(values);
|
281
|
+
}, [form]); // 简单表单onChange
|
297
282
|
|
298
|
-
var
|
283
|
+
var onSimpleValueChange = useCallback(function (values) {
|
299
284
|
setTagDataSource(getTagDataSource(form));
|
300
285
|
onFilter && onFilter(values);
|
301
286
|
}, []); // 关闭标签清空表单字段值
|
@@ -315,11 +300,12 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
315
300
|
className: "".concat(prefixCls, "-left")
|
316
301
|
}, addonBefore ? /*#__PURE__*/React.createElement("div", {
|
317
302
|
className: "".concat(prefixCls, "-addonBefore")
|
318
|
-
}, addonBefore) : null, /*#__PURE__*/React.createElement("div", {
|
319
|
-
className: "".concat(prefixCls, "-
|
303
|
+
}, addonBefore) : null, mode === 'panel' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
304
|
+
className: "".concat(prefixCls, "-inline-form")
|
320
305
|
}, /*#__PURE__*/React.createElement(LightFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
321
306
|
form: form,
|
322
|
-
onFilter:
|
307
|
+
onFilter: onLightValueChange,
|
308
|
+
onSubmit: onFormSubmit
|
323
309
|
}))), /*#__PURE__*/React.createElement("div", {
|
324
310
|
className: "".concat(prefixCls, "-toggle")
|
325
311
|
}, /*#__PURE__*/React.createElement(Badge, {
|
@@ -336,9 +322,15 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
336
322
|
type: "up-line"
|
337
323
|
}) : /*#__PURE__*/React.createElement(TeamixIcon, {
|
338
324
|
type: "filter-line"
|
339
|
-
}), getMessage('advancedFilter')))))
|
325
|
+
}), getMessage('advancedFilter'))))) : /*#__PURE__*/React.createElement("div", {
|
326
|
+
className: "".concat(prefixCls, "-inline-form")
|
327
|
+
}, /*#__PURE__*/React.createElement(SimpleFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
328
|
+
form: form,
|
329
|
+
onFilter: onSimpleValueChange,
|
330
|
+
onSubmit: onFormSubmit
|
331
|
+
})))), addonAfter ? /*#__PURE__*/React.createElement("div", {
|
340
332
|
className: "".concat(prefixCls, "-addonAfter")
|
341
|
-
}, addonAfter) : null), /*#__PURE__*/React.createElement("div", {
|
333
|
+
}, addonAfter) : null), mode === 'panel' ? /*#__PURE__*/React.createElement("div", {
|
342
334
|
className: "".concat(prefixCls, "-panel")
|
343
335
|
}, /*#__PURE__*/React.createElement("div", {
|
344
336
|
className: cls("".concat(prefixCls, "-tag"), advancedFilterVisible ? "".concat(prefixCls, "-tag-hidden") : '')
|
@@ -364,7 +356,11 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
364
356
|
className: cls("".concat(prefixCls, "-advanced-wrap"), !advancedFilterVisible ? "".concat(prefixCls, "-advanced-wrap-hidden") : '')
|
365
357
|
}, /*#__PURE__*/React.createElement(AdvancedFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
|
366
358
|
form: form,
|
367
|
-
|
368
|
-
})))));
|
359
|
+
onSubmit: onFormSubmit
|
360
|
+
})))) : null);
|
369
361
|
});
|
362
|
+
QueryFilter.defaultProps = {
|
363
|
+
mode: 'inline',
|
364
|
+
expand: false
|
365
|
+
};
|
370
366
|
export { QueryFilter };
|
package/es/form/ProForm/index.js
CHANGED
@@ -78,6 +78,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
78
78
|
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]); // 添加onChange
|
79
79
|
|
80
80
|
useEffect(function () {
|
81
|
+
form.removeEffects('onChange');
|
81
82
|
form.addEffects('onChange', function () {
|
82
83
|
onFormValuesChange(function (form) {
|
83
84
|
if (onChange) {
|
@@ -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 {
|