@teamix/pro 1.2.16 → 1.2.20

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.
Files changed (86) hide show
  1. package/dist/212.js +49 -49
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +2147 -686
  4. package/dist/pro.min.css +1 -1
  5. package/dist/pro.min.js +1 -1
  6. package/es/actions/base.d.ts +2 -1
  7. package/es/actions/base.js +1 -1
  8. package/es/actions/danger-pop-confirm.d.ts +5 -0
  9. package/es/actions/danger-pop-confirm.js +10 -0
  10. package/es/actions/dialog.d.ts +1 -1
  11. package/es/actions/dialog.js +34 -36
  12. package/es/actions/index.d.ts +5 -0
  13. package/es/actions/index.js +38 -14
  14. package/es/actions/pop-confirm.d.ts +9 -0
  15. package/es/actions/pop-confirm.js +9 -0
  16. package/es/form/Components/LightFilter/componentMap.d.ts +2 -1
  17. package/es/form/Components/LightFilter/componentMap.js +2 -1
  18. package/es/form/Components/LightFilter/index.d.ts +1 -0
  19. package/es/form/Components/LightFilter/index.js +19 -13
  20. package/es/form/Components/LightFilter/index.scss +14 -4
  21. package/es/form/Filter/AdvancedFilter.d.ts +7 -0
  22. package/es/form/Filter/AdvancedFilter.js +113 -0
  23. package/es/form/Filter/LightFilter.d.ts +7 -0
  24. package/es/form/Filter/LightFilter.js +79 -0
  25. package/es/form/Filter/SimpleFilter.d.ts +7 -0
  26. package/es/form/Filter/SimpleFilter.js +74 -0
  27. package/es/form/Filter/index2.js +288 -235
  28. package/es/form/Filter/index2.scss +3 -0
  29. package/es/form/ProForm/index.js +11 -8
  30. package/es/form/ProForm/index.scss +3 -0
  31. package/es/form/ProForm/useFieldRequest.js +1 -8
  32. package/es/form/SchemaForm/index.js +3 -1
  33. package/es/form/typing.d.ts +11 -2
  34. package/es/index.d.ts +1 -1
  35. package/es/index.js +1 -1
  36. package/es/nocode/configurators/ProTable.js +1 -0
  37. package/es/table/components/Filter/index.js +42 -16
  38. package/es/table/components/Pagination/index.d.ts +3 -0
  39. package/es/table/components/Pagination/index.js +82 -0
  40. package/es/table/components/ToolBar/FilterColumnIcon.js +18 -5
  41. package/es/table/components/ToolBar/index.scss +8 -2
  42. package/es/table/index.js +71 -18
  43. package/es/table/index.scss +7 -1
  44. package/es/table/typing.d.ts +5 -0
  45. package/es/table/utils/columnRender.js +1 -1
  46. package/lib/actions/base.d.ts +2 -1
  47. package/lib/actions/base.js +1 -1
  48. package/lib/actions/danger-pop-confirm.d.ts +5 -0
  49. package/lib/actions/danger-pop-confirm.js +22 -0
  50. package/lib/actions/dialog.d.ts +1 -1
  51. package/lib/actions/dialog.js +35 -36
  52. package/lib/actions/index.d.ts +5 -0
  53. package/lib/actions/index.js +40 -14
  54. package/lib/actions/pop-confirm.d.ts +9 -0
  55. package/lib/actions/pop-confirm.js +23 -0
  56. package/lib/form/Components/LightFilter/componentMap.d.ts +2 -1
  57. package/lib/form/Components/LightFilter/componentMap.js +4 -3
  58. package/lib/form/Components/LightFilter/index.d.ts +1 -0
  59. package/lib/form/Components/LightFilter/index.js +18 -12
  60. package/lib/form/Components/LightFilter/index.scss +14 -4
  61. package/lib/form/Filter/AdvancedFilter.d.ts +7 -0
  62. package/lib/form/Filter/AdvancedFilter.js +133 -0
  63. package/lib/form/Filter/LightFilter.d.ts +7 -0
  64. package/lib/form/Filter/LightFilter.js +99 -0
  65. package/lib/form/Filter/SimpleFilter.d.ts +7 -0
  66. package/lib/form/Filter/SimpleFilter.js +93 -0
  67. package/lib/form/Filter/index2.js +290 -234
  68. package/lib/form/Filter/index2.scss +3 -0
  69. package/lib/form/ProForm/index.js +11 -7
  70. package/lib/form/ProForm/index.scss +3 -0
  71. package/lib/form/ProForm/useFieldRequest.js +1 -9
  72. package/lib/form/SchemaForm/index.js +3 -1
  73. package/lib/form/typing.d.ts +11 -2
  74. package/lib/index.d.ts +1 -1
  75. package/lib/index.js +1 -1
  76. package/lib/nocode/configurators/ProTable.js +1 -0
  77. package/lib/table/components/Filter/index.js +42 -16
  78. package/lib/table/components/Pagination/index.d.ts +3 -0
  79. package/lib/table/components/Pagination/index.js +95 -0
  80. package/lib/table/components/ToolBar/FilterColumnIcon.js +18 -5
  81. package/lib/table/components/ToolBar/index.scss +8 -2
  82. package/lib/table/index.js +69 -17
  83. package/lib/table/index.scss +7 -1
  84. package/lib/table/typing.d.ts +5 -0
  85. package/lib/table/utils/columnRender.js +1 -1
  86. package/package.json +3 -3
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { MaybePromise } from '@teamix/utils';
2
3
  export interface BaseAction {
3
4
  /** 事件触发方式,默认是 onClick */
@@ -17,7 +18,7 @@ export interface BaseAction {
17
18
  /** 事件开始执行完毕的回调函数 */
18
19
  onFinish?: (params?: any) => any;
19
20
  }
20
- export declare function eventHandler(action: BaseAction, actionContext: any, onTrigger: (context: any) => void): {
21
+ export declare function eventHandler(action: BaseAction, actionContext: any, onTrigger: (context: any, e: React.MouseEvent<HTMLElement>) => void): {
21
22
  [x: string]: (e: React.MouseEvent<HTMLElement>) => Promise<void>;
22
23
  };
23
24
  export default eventHandler;
@@ -56,7 +56,7 @@ export function eventHandler(action, actionContext, onTrigger) {
56
56
  return _context.abrupt("return");
57
57
 
58
58
  case 14:
59
- onTrigger(Object.assign({}, beforeActionContext, actionContext));
59
+ onTrigger(Object.assign({}, beforeActionContext, actionContext), e);
60
60
  (_action$onTrigger = action.onTrigger) === null || _action$onTrigger === void 0 ? void 0 : _action$onTrigger.call(action);
61
61
 
62
62
  case 16:
@@ -0,0 +1,5 @@
1
+ import { PopConfirmAction } from './pop-confirm';
2
+ export declare function useDangerPopConfirmAction(action: PopConfirmAction, context?: any): {
3
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
4
+ };
5
+ export default useDangerPopConfirmAction;
@@ -0,0 +1,10 @@
1
+ import { deepMerge } from '@teamix/utils';
2
+ import { useDialogAction } from './dialog';
3
+ export function useDangerPopConfirmAction(action, context) {
4
+ return useDialogAction(deepMerge({
5
+ dialogType: 'pop',
6
+ popType: 'danger',
7
+ align: 'br'
8
+ }, action), context);
9
+ }
10
+ export default useDangerPopConfirmAction;
@@ -8,7 +8,7 @@ export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShow
8
8
  /** 点击「确认按钮」后的数据请求地址,非必填,不填就不发请求 */
9
9
  url?: string;
10
10
  /** 弹窗类型,支持普通弹窗和抽屉两种模式,默认为普通弹窗 */
11
- dialogType?: 'dialog' | 'drawer';
11
+ dialogType?: 'dialog' | 'drawer' | 'pop';
12
12
  /** 弹窗快捷调用类型 */
13
13
  dialogQuickShowType?: 'alert' | 'confirm';
14
14
  /** 弹窗消息类型 */
@@ -1,5 +1,5 @@
1
1
  var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
2
- _excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
2
+ _excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
3
3
 
4
4
  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; }
5
5
 
@@ -31,6 +31,7 @@ import React, { useState, useEffect, useRef } from 'react';
31
31
  import classnames from 'classnames';
32
32
  import { useHistory } from 'react-router-dom';
33
33
  import { Dialog, Drawer } from '@alicloudfe/components';
34
+ import PopConfirm from '@teamix/pop-confirm';
34
35
  import { getTargetValue, uuid, goToLink, getMessage } from '@teamix/utils';
35
36
  import ProForm, { createForm } from '../form';
36
37
  import { renderProMessage } from '../utils/message';
@@ -77,7 +78,9 @@ export function useDialogAction(action, actionContext) {
77
78
  var footerDescriptionRef = useRef();
78
79
  var history = useHistory();
79
80
 
80
- var onActionStart = function onActionStart(context) {
81
+ var onActionStart = function onActionStart(context, e) {
82
+ var _objectSpread2;
83
+
81
84
  var url = action.url,
82
85
  method = action.method,
83
86
  params = action.params,
@@ -101,6 +104,7 @@ export function useDialogAction(action, actionContext) {
101
104
  dialogQuickShowType = _getTargetValue.dialogQuickShowType,
102
105
  _getTargetValue$messa = _getTargetValue.messageType,
103
106
  messageType = _getTargetValue$messa === void 0 ? 'notice' : _getTargetValue$messa,
107
+ popType = _getTargetValue.popType,
104
108
  beforeRequest = _getTargetValue.beforeRequest,
105
109
  onTrigger = _getTargetValue.onTrigger,
106
110
  link = _getTargetValue.link,
@@ -110,20 +114,25 @@ export function useDialogAction(action, actionContext) {
110
114
  footerDescription = _getTargetValue.footerDescription,
111
115
  footerAlign = _getTargetValue.footerAlign,
112
116
  className = _getTargetValue.className,
113
- containerProps = _objectWithoutProperties(_getTargetValue, _excluded2);
117
+ containerOtherProps = _objectWithoutProperties(_getTargetValue, _excluded2);
114
118
 
115
119
  var isDrawer = dialogType === 'drawer';
116
- var container = isDrawer ? Drawer : Dialog;
117
- var dialogOnlyProps = {
120
+ var isPop = dialogType === 'pop';
121
+ var container = isDrawer ? Drawer : isPop ? PopConfirm : Dialog;
122
+ var containerProps = isDrawer ? {
123
+ okText: getMessage('ok'),
124
+ cancelText: getMessage('cancel'),
125
+ closeable: !loading
126
+ } : isPop ? {
127
+ type: popType,
128
+ trigger: e.currentTarget
129
+ } : {
118
130
  type: dialogQuickShowType,
119
131
  messageProps: {
120
132
  type: messageType
121
- }
133
+ },
134
+ closeable: !loading
122
135
  };
123
- var containerOtherProps = isDrawer ? {
124
- okText: getMessage('ok'),
125
- cancelText: getMessage('cancel')
126
- } : dialogOnlyProps;
127
136
 
128
137
  var renderDialogFooterDescription = function renderDialogFooterDescription(footer) {
129
138
  if (footer instanceof Array || footer.component) {
@@ -152,15 +161,12 @@ export function useDialogAction(action, actionContext) {
152
161
  while (1) {
153
162
  switch (_context.prev = _context.next) {
154
163
  case 0:
155
- if (url) {
164
+ if (!link) {
156
165
  _context.next = 5;
157
166
  break;
158
167
  }
159
168
 
160
- if (link) {
161
- goToLink(link, history);
162
- }
163
-
169
+ goToLink(link, history);
164
170
  onFinish && onFinish();
165
171
  resolve(true);
166
172
  return _context.abrupt("return");
@@ -218,27 +224,19 @@ export function useDialogAction(action, actionContext) {
218
224
  key: uuid()
219
225
  }, addContext(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
220
226
 
221
- var quickShowProps = _objectSpread(_objectSpread({
222
- // @ts-ignore
223
- onOk: onOk,
224
- title: addContextForReactNode(title, dialogContext),
225
- content: /*#__PURE__*/React.createElement(React.Fragment, null, beforeContent && /*#__PURE__*/React.createElement("div", {
226
- className: "teamix-pro-dialog-before-content"
227
- }, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/React.createElement("div", {
228
- className: "teamix-pro-dialog-message"
229
- }, renderProMessage(message, {
230
- type: 'notice'
231
- })), dialogContent, afterContent && /*#__PURE__*/React.createElement("div", {
232
- className: "teamix-pro-dialog-after-content"
233
- }, addContextForReactNode(afterContent, dialogContext)), footerDescription && /*#__PURE__*/React.createElement("div", {
234
- className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
235
- }, renderDialogFooterDescription(footerDescription))),
236
- closeable: !loading,
237
- footerAlign: footerAlign,
238
- className: classnames('teamix-pro-action-dialog', {
239
- 'has-footer-description': !!footerDescription
240
- })
241
- }, containerOtherProps), containerProps);
227
+ var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), onOk), _defineProperty(_objectSpread2, "title", addContextForReactNode(title, dialogContext)), _defineProperty(_objectSpread2, "content", /*#__PURE__*/React.createElement(React.Fragment, null, beforeContent && /*#__PURE__*/React.createElement("div", {
228
+ className: "teamix-pro-dialog-before-content"
229
+ }, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/React.createElement("div", {
230
+ className: "teamix-pro-dialog-message"
231
+ }, renderProMessage(message, {
232
+ type: 'notice'
233
+ })), dialogContent, afterContent && /*#__PURE__*/React.createElement("div", {
234
+ className: "teamix-pro-dialog-after-content"
235
+ }, addContextForReactNode(afterContent, dialogContext)), !isPop && footerDescription && /*#__PURE__*/React.createElement("div", {
236
+ className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
237
+ }, renderDialogFooterDescription(footerDescription)))), _defineProperty(_objectSpread2, "footerAlign", footerAlign), _defineProperty(_objectSpread2, "className", classnames('teamix-pro-action-dialog', {
238
+ 'has-footer-description': !!footerDescription
239
+ })), _objectSpread2), containerProps), containerOtherProps);
242
240
 
243
241
  var ret = container.show(quickShowProps);
244
242
  store.hide = ret.hide;
@@ -7,6 +7,7 @@ import { DialogAction } from './dialog';
7
7
  import { DialogFormAction } from './dialog-form';
8
8
  import { DialogTableAction } from './dialog-table';
9
9
  import { DialogInfoAction } from './dialog-info';
10
+ import { PopConfirmAction } from './pop-confirm';
10
11
  import './index.scss';
11
12
  export declare type ProActionConfig = ({
12
13
  type: 'dialog-form' | 'drawer-form';
@@ -15,6 +16,8 @@ export declare type ProActionConfig = ({
15
16
  } & DialogTableAction) | ({
16
17
  type: 'dialog-info' | 'drawer-info';
17
18
  } & DialogInfoAction) | ({
19
+ type: 'pop-confirm' | 'danger-pop-confirm';
20
+ } & PopConfirmAction) | ({
18
21
  type: 'dialog' | 'drawer' | 'confirm' | 'danger-confirm' | 'notice' | 'error';
19
22
  } & DialogAction) | ({
20
23
  type: 'request';
@@ -24,6 +27,7 @@ export declare type ProActionConfig = ({
24
27
  export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
25
28
  export declare function useAction(config?: ProActionConfig, context?: any): any;
26
29
  export interface ProActionButtonProps extends ButtonProps {
30
+ key?: string | number;
27
31
  config?: ProActionConfig;
28
32
  visible?: any;
29
33
  disabled?: any;
@@ -33,6 +37,7 @@ export interface ProActionButtonProps extends ButtonProps {
33
37
  }
34
38
  export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
35
39
  export interface ProActionMenuButtonProps extends MenuButtonProps {
40
+ key?: string | number;
36
41
  actions: ProActionProps[];
37
42
  visible?: any;
38
43
  icon?: string;
@@ -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(); }
@@ -48,6 +48,8 @@ import { useDrawerAction } from './drawer';
48
48
  import { useDrawerFormAction } from './drawer-form';
49
49
  import { useDrawerTableAction } from './drawer-table';
50
50
  import { useDrawerInfoAction } from './drawer-info';
51
+ import { usePopConfirmAction } from './pop-confirm';
52
+ import { useDangerPopConfirmAction } from './danger-pop-confirm';
51
53
  import './index.scss';
52
54
  var RegistedActions = new Map();
53
55
  export function registerActionHandler(id, extendActionId, defaultConfig) {
@@ -120,6 +122,14 @@ export function useAction(config, context) {
120
122
  return useDrawerInfoAction(others, context);
121
123
  }
122
124
 
125
+ if (type === 'pop-confirm') {
126
+ return usePopConfirmAction(others, context);
127
+ }
128
+
129
+ if (type === 'danger-pop-confirm') {
130
+ return useDangerPopConfirmAction(others, context);
131
+ }
132
+
123
133
  var registedAction = RegistedActions.get(type);
124
134
 
125
135
  if (!registedAction) {
@@ -205,8 +215,8 @@ function renderCommonActionButtonMenuItem(action, key, context) {
205
215
  return /*#__PURE__*/React.createElement(Menu.SubMenu, {
206
216
  key: key,
207
217
  label: menuBtn.label || menuBtn.children
208
- }, menuBtn.actions.map(function (a, j) {
209
- return renderCommonActionButtonMenuItem(a, String(j), context);
218
+ }, menuBtn.actions.map(function (a) {
219
+ return renderCommonActionButtonMenuItem(a, a.key, context);
210
220
  }));
211
221
  }
212
222
 
@@ -241,7 +251,7 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
241
251
  type: type,
242
252
  label: buttonContent(label || children, icon, iconSize, context)
243
253
  }, others), actions.map(function (action, i) {
244
- return renderCommonActionButtonMenuItem(action, String(i), context);
254
+ return renderCommonActionButtonMenuItem(action, action.key || i, context);
245
255
  }));
246
256
  }; // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
247
257
 
@@ -252,7 +262,9 @@ function formatGroupActions(actions, max, moreConfig) {
252
262
  return actions;
253
263
  }
254
264
 
255
- return [].concat(_toConsumableArray(actions.slice(0, MAX - 1)), [_objectSpread(_objectSpread({}, moreConfig), {}, {
265
+ return [].concat(_toConsumableArray(actions.slice(0, MAX - 1)), [_objectSpread(_objectSpread({
266
+ key: '__teamix_pro_action_group_more_btn'
267
+ }, moreConfig), {}, {
256
268
  actions: actions.slice(MAX - 1)
257
269
  })]);
258
270
  } // 渲染一个 button 或者 menu button
@@ -298,22 +310,34 @@ function getDefaultMoreButton(type, moreText) {
298
310
 
299
311
  var MAX_ACTTIONS = 4;
300
312
 
301
- function getActionConfig(action, context) {
313
+ function getKey(index, key) {
314
+ if (key !== undefined) {
315
+ return key;
316
+ }
317
+
318
+ return "__teamix_pro_action_key_".concat(index);
319
+ }
320
+
321
+ function getActionConfig(action, index, context) {
302
322
  if (action.actions) {
303
- var actions = action.actions,
323
+ var _key = action.key,
324
+ actions = action.actions,
304
325
  _others = _objectWithoutProperties(action, _excluded6);
305
326
 
306
327
  return _objectSpread({
307
- actions: actions.map(function (a) {
308
- return getActionConfig(a, context);
328
+ key: getKey(index, _key),
329
+ actions: actions.map(function (a, j) {
330
+ return getActionConfig(a, j, context);
309
331
  })
310
332
  }, getTargetValue(_others, context));
311
333
  }
312
334
 
313
- var config = action.config,
335
+ var key = action.key,
336
+ config = action.config,
314
337
  others = _objectWithoutProperties(action, _excluded7);
315
338
 
316
339
  return _objectSpread({
340
+ key: getKey(index, key),
317
341
  config: config
318
342
  }, getTargetValue(others, context));
319
343
  }
@@ -333,8 +357,8 @@ export function ProActionGroup(props) {
333
357
  containerProps = _objectWithoutProperties(props, _excluded8);
334
358
 
335
359
  var isTypeText = type === 'text';
336
- var filteredActions = actions.map(function (action) {
337
- return getActionConfig(action, context);
360
+ var filteredActions = actions.map(function (action, index) {
361
+ return getActionConfig(action, index, context);
338
362
  }).filter(function (action) {
339
363
  return action.visible !== false;
340
364
  });
@@ -346,7 +370,7 @@ export function ProActionGroup(props) {
346
370
  }, containerProps), formatedActions.map(function (actionBtn, i) {
347
371
  var isLastOne = i === formatedActions.length - 1;
348
372
  return /*#__PURE__*/React.createElement(React.Fragment, {
349
- key: i
373
+ key: actionBtn.key
350
374
  }, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/React.createElement(Divider, {
351
375
  direction: "ver"
352
376
  }));
@@ -0,0 +1,9 @@
1
+ import { IPopConfirmProps } from '@teamix/pop-confirm';
2
+ import { DialogAction } from './dialog';
3
+ export declare type PopConfirmAction = DialogAction & Omit<IPopConfirmProps, 'type' | 'trigger'> & {
4
+ popType?: IPopConfirmProps['type'];
5
+ };
6
+ export declare function usePopConfirmAction(action: PopConfirmAction, context?: any): {
7
+ [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
8
+ };
9
+ export default usePopConfirmAction;
@@ -0,0 +1,9 @@
1
+ import { deepMerge } from '@teamix/utils';
2
+ import useDialogAction from './dialog';
3
+ export function usePopConfirmAction(action, context) {
4
+ return useDialogAction(deepMerge({
5
+ dialogType: 'pop',
6
+ align: 'br'
7
+ }, action), context);
8
+ }
9
+ export default usePopConfirmAction;
@@ -1,2 +1,3 @@
1
1
  declare const componentMap: any;
2
- export default componentMap;
2
+ declare const inputCategory: any[];
3
+ export { componentMap, inputCategory };
@@ -2,4 +2,5 @@ var componentMap = {
2
2
  Radio: 'Select',
3
3
  Checkbox: 'Select'
4
4
  };
5
- export default componentMap;
5
+ var inputCategory = ['Input', 'Password', 'TextArea', 'NumberPicker', 'Percent', 'Money'];
6
+ export { componentMap, inputCategory };
@@ -8,6 +8,7 @@ import './index.scss';
8
8
  interface ILightFiter {
9
9
  size?: 'small' | 'medium' | 'large';
10
10
  defaultFilterValue?: string;
11
+ onFilterChange?: (schema?: any) => any;
11
12
  filterProps?: SelectProps;
12
13
  buttonProps?: ButtonProps;
13
14
  }
@@ -16,13 +16,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
16
16
 
17
17
  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; }
18
18
 
19
- import React, { useState } from 'react';
20
- import { useField, observer, useFieldSchema, RecursionField } from '@formily/react';
19
+ import React, { useState, useCallback } from 'react';
20
+ import { observer, useFieldSchema, RecursionField } from '@formily/react';
21
21
  import { Select, Button } from '@alicloudfe/components';
22
22
  import TeamixIcon from '@teamix/icon';
23
23
  import cls from 'classnames';
24
24
  import { usePrefixCls } from '@teamix/utils';
25
- import componentMap from './componentMap';
25
+ import { componentMap, inputCategory } from './componentMap';
26
26
  import './index.scss'; // 主激活区内容
27
27
 
28
28
  var useMain = function useMain(active) {
@@ -30,7 +30,6 @@ 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
  if (schema.name === active) {
35
34
  main.push({
36
35
  name: name,
@@ -55,16 +54,21 @@ var useFilterItems = function useFilterItems() {
55
54
  });
56
55
  });
57
56
  return filterItems;
57
+ }; // 是否输入框类型的组件
58
+
59
+
60
+ var isInputCategory = function isInputCategory(currentSchema) {
61
+ var component = currentSchema === null || currentSchema === void 0 ? void 0 : currentSchema['x-component'];
62
+ return inputCategory.includes(component);
58
63
  };
59
64
 
60
65
  var LightFilter = observer(function (props) {
61
- var _filterItems$;
66
+ var _filterItems$, _main$;
62
67
 
63
- var field = useField();
64
- var schema = useFieldSchema();
65
68
  var filterItems = useFilterItems();
66
69
  var size = props.size,
67
70
  defaultFilterValue = props.defaultFilterValue,
71
+ onFilterChange = props.onFilterChange,
68
72
  filterProps = props.filterProps,
69
73
  buttonProps = props.buttonProps;
70
74
 
@@ -74,6 +78,7 @@ var LightFilter = observer(function (props) {
74
78
  setActive = _useState2[1];
75
79
 
76
80
  var main = useMain(active);
81
+ var currentSchema = (_main$ = main[0]) === null || _main$ === void 0 ? void 0 : _main$.schema;
77
82
  var defaultCls = usePrefixCls();
78
83
  var prefixCls = usePrefixCls('', {
79
84
  prefix: 'teamix-pro-form-light-filter'
@@ -84,20 +89,21 @@ var LightFilter = observer(function (props) {
84
89
  return /*#__PURE__*/React.createElement(RecursionField, {
85
90
  key: key,
86
91
  name: name,
87
- schema: schema,
88
- filterProperties: function filterProperties(schema) {
89
- return true;
90
- }
92
+ schema: schema
91
93
  });
92
94
  });
95
+ var onSelectChange = useCallback(function (value) {
96
+ setActive(value);
97
+ onFilterChange && onFilterChange(value);
98
+ }, [onFilterChange]);
93
99
  return /*#__PURE__*/React.createElement("span", {
94
- className: cls(prefixCls, "".concat(defaultCls).concat(size))
100
+ className: cls(prefixCls, "".concat(defaultCls).concat(size), isInputCategory(currentSchema) ? "".concat(prefixCls, "-input-category") : '')
95
101
  }, /*#__PURE__*/React.createElement("span", {
96
102
  className: "".concat(prefixCls, "-main")
97
103
  }, /*#__PURE__*/React.createElement(Select, _objectSpread(_objectSpread({}, filterProps), {}, {
98
104
  className: cls("".concat(prefixCls, "-select"), filterProps === null || filterProps === void 0 ? void 0 : filterProps.className),
99
105
  dataSource: filterItems,
100
- onChange: setActive,
106
+ onChange: onSelectChange,
101
107
  value: active
102
108
  })), content), /*#__PURE__*/React.createElement("span", {
103
109
  className: "".concat(prefixCls, "-addonAfter")
@@ -18,10 +18,7 @@ $light-filter: #{teamix-pro-form}-light-filter;
18
18
  box-sizing: border-box;
19
19
  border: var(--search-normal-normal-border-width, 1px) solid
20
20
  var(--color-line1-2, #d9d9d9);
21
- border-right: 0;
22
21
  border-radius: var(--search-normal-corner, 2px);
23
- border-top-right-radius: 0;
24
- border-bottom-right-radius: 0;
25
22
  // 表单项选择
26
23
  .#{$light-filter}-select {
27
24
  min-width: auto;
@@ -30,7 +27,7 @@ $light-filter: #{teamix-pro-form}-light-filter;
30
27
  border: 0;
31
28
  box-shadow: none;
32
29
  .#{$css-prefix}input-text-field {
33
- padding-right: 0;
30
+ padding-right: 4px;
34
31
  }
35
32
  }
36
33
  .#{$css-prefix}input {
@@ -44,6 +41,7 @@ $light-filter: #{teamix-pro-form}-light-filter;
44
41
 
45
42
  // 按钮后缀
46
43
  .#{$light-filter}-addonAfter {
44
+ display: none;
47
45
  .#{$css-prefix}btn {
48
46
  border-top-left-radius: 0;
49
47
  border-bottom-left-radius: 0;
@@ -54,6 +52,18 @@ $light-filter: #{teamix-pro-form}-light-filter;
54
52
  }
55
53
  }
56
54
 
55
+ // LightFilter输入类
56
+ .#{$light-filter}-input-category {
57
+ .#{$light-filter}-main {
58
+ border-right: 0;
59
+ border-top-right-radius: 0;
60
+ border-bottom-right-radius: 0;
61
+ }
62
+ .#{$light-filter}-addonAfter {
63
+ display: block;
64
+ }
65
+ }
66
+
57
67
  // LightFilter无边框
58
68
  .#{$form-item-cls}-bordered-none {
59
69
  .#{$form-item-cls}-control {
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { FilterProps } from '../typing';
3
+ /**
4
+ * 高级筛选
5
+ */
6
+ declare const AdvancedFilter: React.FC<FilterProps>;
7
+ export default AdvancedFilter;
@@ -0,0 +1,113 @@
1
+ var _excluded = ["schema", "onSubmit", "onReset", "onResetClick", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol"];
2
+
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
+
5
+ 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; }
6
+
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
+
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 _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
+
15
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
16
+
17
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
18
+
19
+ 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; }
20
+
21
+ 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; }
22
+
23
+ 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; }
24
+
25
+ import React, { memo, useMemo } from 'react';
26
+ import cls from 'classnames';
27
+ import { usePrefixCls, getMessage } from '@teamix/utils';
28
+ import ProForm from '../ProForm';
29
+ import { mergeArrayValue } from '../utils';
30
+ /**
31
+ * 高级筛选
32
+ */
33
+
34
+ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
35
+ var schema = props.schema,
36
+ onSubmit = props.onSubmit,
37
+ onReset = props.onReset,
38
+ onResetClick = props.onResetClick,
39
+ layout = props.layout,
40
+ labelAlign = props.labelAlign,
41
+ wrapperAlign = props.wrapperAlign,
42
+ labelCol = props.labelCol,
43
+ wrapperCol = props.wrapperCol,
44
+ otherProps = _objectWithoutProperties(props, _excluded);
45
+
46
+ var prefixCls = usePrefixCls('', {
47
+ prefix: 'teamix-pro-form-query-filter-advanced'
48
+ });
49
+ var gridSchema = useMemo(function () {
50
+ return [{
51
+ name: 'FormGrid',
52
+ component: 'FormGrid',
53
+ props: {
54
+ breakpoints: [480, 720, 990, 1200, Infinity],
55
+ maxColumns: [1, 2, 3, 3, 4],
56
+ columnGap: 16,
57
+ rowGap: 12
58
+ },
59
+ children: [].concat(_toConsumableArray(schema), [{
60
+ component: 'FormGrid.GridColumn',
61
+ props: {
62
+ gridSpan: -1
63
+ },
64
+ children: [{
65
+ component: 'FormButtonGroup',
66
+ props: {
67
+ align: 'right'
68
+ },
69
+ children: [{
70
+ component: 'Reset',
71
+ props: {
72
+ onResetValidateSuccess: onReset,
73
+ onClick: onResetClick,
74
+ children: getMessage('reset')
75
+ }
76
+ }, {
77
+ component: 'Submit',
78
+ props: {
79
+ style: {
80
+ marginRight: -8
81
+ },
82
+ children: getMessage('search')
83
+ }
84
+ }]
85
+ }]
86
+ }])
87
+ }];
88
+ }, [schema, onReset, onResetClick]);
89
+ var getTeamixLayout = useMemo(function () {
90
+ return {
91
+ breakpoints: [990],
92
+ layout: mergeArrayValue(['vertical'], layout),
93
+ labelAlign: mergeArrayValue(['left'], labelAlign),
94
+ wrapperAlign: mergeArrayValue(['left'], wrapperAlign),
95
+ labelCol: mergeArrayValue([24], labelCol),
96
+ wrapperCol: mergeArrayValue([24], wrapperCol)
97
+ };
98
+ }, [layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
99
+ return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread({
100
+ className: cls(prefixCls, props.className),
101
+ schema: gridSchema,
102
+ feedbackLayout: "popover"
103
+ }, otherProps), getTeamixLayout), {}, {
104
+ onSubmit: onSubmit
105
+ }));
106
+ });
107
+ AdvancedFilter.defaultProps = {
108
+ layout: 'horizontal',
109
+ labelAlign: 'right',
110
+ labelCol: 6,
111
+ wrapperCol: 18
112
+ };
113
+ export default AdvancedFilter;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { FilterProps } from '../typing';
3
+ /**
4
+ * 轻量筛选
5
+ */
6
+ declare const LightFilter: React.FC<FilterProps>;
7
+ export default LightFilter;