@teamix/pro 1.2.12 → 1.2.13

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.
@@ -198,18 +198,20 @@ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
198
198
  }, buttonProps), buttonContent(children, icon, undefined, context));
199
199
  };
200
200
 
201
- function renderCommonActionButtonMenuItem(action, context) {
201
+ function renderCommonActionButtonMenuItem(action, key, context) {
202
202
  var menuBtn = action;
203
203
 
204
204
  if (menuBtn.actions && menuBtn.actions.length && menuBtn.disabled !== true) {
205
205
  return /*#__PURE__*/React.createElement(Menu.SubMenu, {
206
+ key: key,
206
207
  label: menuBtn.label || menuBtn.children
207
208
  }, menuBtn.actions.map(function (a, j) {
208
- return renderCommonActionButtonMenuItem(a, context);
209
+ return renderCommonActionButtonMenuItem(a, String(j), context);
209
210
  }));
210
211
  }
211
212
 
212
213
  return /*#__PURE__*/React.createElement(ProActionMenuButtonItem, {
214
+ key: key,
213
215
  action: action,
214
216
  context: context
215
217
  });
@@ -238,8 +240,8 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
238
240
  },
239
241
  type: type,
240
242
  label: buttonContent(label || children, icon, iconSize, context)
241
- }, others), actions.map(function (action) {
242
- return renderCommonActionButtonMenuItem(action, context);
243
+ }, others), actions.map(function (action, i) {
244
+ return renderCommonActionButtonMenuItem(action, String(i), context);
243
245
  }));
244
246
  }; // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
245
247
 
@@ -343,7 +345,9 @@ export function ProActionGroup(props) {
343
345
  })
344
346
  }, containerProps), formatedActions.map(function (actionBtn, i) {
345
347
  var isLastOne = i === formatedActions.length - 1;
346
- return /*#__PURE__*/React.createElement(React.Fragment, null, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/React.createElement(Divider, {
348
+ return /*#__PURE__*/React.createElement(React.Fragment, {
349
+ key: i
350
+ }, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/React.createElement(Divider, {
347
351
  direction: "ver"
348
352
  }));
349
353
  }));
@@ -35,39 +35,39 @@ declare const formilyReact: {
35
35
  <Decorator extends originalFormilyReact.JSXComponent, Component extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.ISchemaFieldProps<Decorator, Component, import("@formily/core").ObjectField<Decorator, Component>>): JSX.Element;
36
36
  displayName: string;
37
37
  Markup: {
38
- <Decorator_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaMarkupFieldProps<Components, Component_1, Decorator_1>): JSX.Element;
38
+ <Decorator_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaMarkupFieldProps<Components, Component_1, Decorator_1>): JSX.Element;
39
39
  displayName: string;
40
40
  };
41
41
  String: {
42
- <Decorator_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_2, Decorator_2>): JSX.Element;
42
+ <Decorator_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_2, Decorator_2>): JSX.Element;
43
43
  displayName: string;
44
44
  };
45
45
  Object: {
46
- <Decorator_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_3, Decorator_3>): JSX.Element;
46
+ <Decorator_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_3, Decorator_3>): JSX.Element;
47
47
  displayName: string;
48
48
  };
49
49
  Array: {
50
- <Decorator_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_4, Decorator_4>): JSX.Element;
50
+ <Decorator_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_4, Decorator_4>): JSX.Element;
51
51
  displayName: string;
52
52
  };
53
53
  Boolean: {
54
- <Decorator_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_5, Decorator_5>): JSX.Element;
54
+ <Decorator_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_5, Decorator_5>): JSX.Element;
55
55
  displayName: string;
56
56
  };
57
57
  Date: {
58
- <Decorator_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_6, Decorator_6>): JSX.Element;
58
+ <Decorator_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_6, Decorator_6>): JSX.Element;
59
59
  displayName: string;
60
60
  };
61
61
  DateTime: {
62
- <Decorator_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_7, Decorator_7>): JSX.Element;
62
+ <Decorator_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_7, Decorator_7>): JSX.Element;
63
63
  displayName: string;
64
64
  };
65
65
  Void: {
66
- <Decorator_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_8, Decorator_8>): JSX.Element;
66
+ <Decorator_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_8, Decorator_8>): JSX.Element;
67
67
  displayName: string;
68
68
  };
69
69
  Number: {
70
- <Decorator_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_9, Decorator_9>): JSX.Element;
70
+ <Decorator_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_9, Decorator_9>): JSX.Element;
71
71
  displayName: string;
72
72
  };
73
73
  };
package/es/index.d.ts CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
21
21
  export * from './page-header';
22
22
  export * from './skeleton';
23
23
  export * from './table';
24
- declare const version = "1.2.11";
24
+ declare const version = "1.2.12";
25
25
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -27,7 +27,7 @@ export * from './page-header';
27
27
  export * from './skeleton';
28
28
  export * from './table'; // export * from './sidebar';
29
29
 
30
- var version = '1.2.11';
30
+ var version = '1.2.12';
31
31
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
32
32
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
33
33
  hooks, nocode, templates, utils };
@@ -21,7 +21,9 @@ var ProInfoItem = function ProInfoItem(prop) {
21
21
  wrapperCol = baseInfoLayout.wrapperCol;
22
22
  return /*#__PURE__*/React.createElement("div", {
23
23
  className: cls()
24
- }, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
24
+ }, /*#__PURE__*/React.createElement(Row, {
25
+ gutter: 10
26
+ }, /*#__PURE__*/React.createElement(Col, {
25
27
  span: labelCol === null || labelCol === void 0 ? void 0 : labelCol.span,
26
28
  className: cls('label')
27
29
  }, /*#__PURE__*/React.createElement(Ellipsis, {
@@ -1,7 +1,7 @@
1
1
  import { PageProps } from '../../page-container';
2
- import { PageMap, PageType } from '.';
2
+ import { PageMap } from '.';
3
3
  export interface PageRendererProps<T = any> extends PageProps<T> {
4
- type?: PageType;
4
+ type?: any;
5
5
  error?: any;
6
6
  title?: string;
7
7
  pageMap?: PageMap;
package/es/table/index.js CHANGED
@@ -349,7 +349,11 @@ var ProTable = function ProTable(props) {
349
349
  }
350
350
  }, [propsActionRef]);
351
351
  useEffect(function () {
352
- setFilteredColumns(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : []));
352
+ var _actionRef$current, _actionRef$current$se;
353
+
354
+ var columns = processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : []);
355
+ setFilteredColumns(columns);
356
+ (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setState) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, 'filterColumns', columns);
353
357
  }, [propsColumns]); // 绑定 Actions
354
358
 
355
359
  useActionType(actionRef, {
@@ -363,7 +367,11 @@ var ProTable = function ProTable(props) {
363
367
  return state;
364
368
  },
365
369
  setColumn: function setColumn(newColumns) {
366
- setFilteredColumns(processColumns(newColumns));
370
+ var _actionRef$current2, _actionRef$current2$s;
371
+
372
+ var columns = processColumns(newColumns);
373
+ setFilteredColumns(columns);
374
+ (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, 'filterColumns', columns);
367
375
  },
368
376
  setSize: function setSize(mode) {
369
377
  _setSize(mode);
@@ -377,11 +385,11 @@ var ProTable = function ProTable(props) {
377
385
  }
378
386
  },
379
387
  reset: function reset() {
380
- var _actionRef$current, _actionRef$current$se;
388
+ var _actionRef$current3, _actionRef$current3$s;
381
389
 
382
390
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
383
391
 
384
- (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setFilterRules) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, {});
392
+ (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setFilterRules) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, {});
385
393
  dataFilterForm.reset();
386
394
  setCurrentPage(1);
387
395
 
@@ -492,7 +500,7 @@ var ProTable = function ProTable(props) {
492
500
  }); // 请求函数
493
501
 
494
502
  function _request(params, noLoading) {
495
- var _actionRef$current$ge, _actionRef$current2, _actionRef$current2$g, _objectSpread2;
503
+ var _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
496
504
 
497
505
  // 如果没有传 url 且没有 customRequest,直接返回
498
506
  if (!url && !customRequest) {
@@ -507,7 +515,7 @@ var ProTable = function ProTable(props) {
507
515
 
508
516
  var dataFilterParams = toJS(dataFilterForm.values); // 列过滤请求参数
509
517
 
510
- var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$g = _actionRef$current2.getFilterRules) === null || _actionRef$current2$g === void 0 ? void 0 : _actionRef$current2$g.call(_actionRef$current2)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
518
+ var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$g = _actionRef$current4.getFilterRules) === null || _actionRef$current4$g === void 0 ? void 0 : _actionRef$current4$g.call(_actionRef$current4)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
511
519
 
512
520
  var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params));
513
521
 
@@ -594,7 +602,10 @@ var ProTable = function ProTable(props) {
594
602
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
595
603
 
596
604
  if (dataFilterForm.validate()) {
597
- setCurrentPage(1);
605
+ setCurrentPage(1); // const { mode, schema } = propsDataFilter as ProTableDataFilterProps;
606
+ // TODO: 针对 inline 模式下的 search 组件做一下处理,如果空值切换下拉的时候不触发请求
607
+ // if (mode === 'inline') {
608
+ // }
598
609
 
599
610
  _request(_defineProperty({}, targetPageKey, 1));
600
611
  }
@@ -180,6 +180,8 @@ export declare type ProTableActionType = {
180
180
  export declare type ProTableActionTypeMutations = {
181
181
  /** 获取state状态 */
182
182
  getState?: () => ProTableActionTypeState;
183
+ /** 设置state状态 */
184
+ setState?: (key: string, value: any) => void;
183
185
  /** 设置全屏状态 */
184
186
  setFullScreenState?: (state: boolean) => void;
185
187
  /** 绑定state监听事件 */
@@ -192,11 +194,15 @@ export declare type ProTableActionTypeMutations = {
192
194
  getFilterRules?: () => object;
193
195
  /** 重新计算表格maxHeight高度 */
194
196
  resetTableMaxBodyHeight?: () => void;
197
+ /** 列筛选规则 */
198
+ filterColumns?: any[];
195
199
  };
196
200
  /** action Mutations 定义 */
197
201
  export declare type ProTableActionTypeState = {
198
202
  fullScreenState: boolean;
199
203
  filterRules: ProTableColumnsFilterRulesItem;
204
+ filterColumns: ProTableColumnProps[];
205
+ [key: string]: any;
200
206
  };
201
207
  export declare type ProTableDataFilterProps = {
202
208
  /** 展示形式 */
@@ -37,8 +37,45 @@ import Filter from '../components/Filter';
37
37
  */
38
38
 
39
39
  export var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
40
+ var filterMode = item.filterMode,
41
+ filters = item.filters,
42
+ dataIndex = item.dataIndex,
43
+ dataSource = item.dataSource;
44
+
45
+ var getItemLable = function getItemLable() {
46
+ if (filterMode !== 'multiple') {
47
+ var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2;
48
+
49
+ var selectedItem = (_actionRef$current$ge = (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge2 = _actionRef$current.getState) === null || _actionRef$current$ge2 === void 0 ? void 0 : _actionRef$current$ge2.call(_actionRef$current).filterRules) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
50
+
51
+ if (Object.keys(selectedItem).length > 0) {
52
+ var _selectedItem$dataInd;
53
+
54
+ if ((_selectedItem$dataInd = selectedItem[dataIndex]) === null || _selectedItem$dataInd === void 0 ? void 0 : _selectedItem$dataInd.params) {
55
+ var _targetFilters$find;
56
+
57
+ // 找到对应的 label
58
+ var targetFilters = filters !== null && filters !== void 0 ? filters : [];
59
+
60
+ if (filters === true) {
61
+ targetFilters = dataSource !== null && dataSource !== void 0 ? dataSource : [];
62
+ }
63
+
64
+ var label = (_targetFilters$find = targetFilters.find(function (item) {
65
+ var _selectedItem$dataInd2;
66
+
67
+ return item.value === ((_selectedItem$dataInd2 = selectedItem[dataIndex]) === null || _selectedItem$dataInd2 === void 0 ? void 0 : _selectedItem$dataInd2.params);
68
+ })) === null || _targetFilters$find === void 0 ? void 0 : _targetFilters$find.label;
69
+ return "".concat(item.title, " (").concat(label, ")");
70
+ }
71
+ }
72
+ }
73
+
74
+ return item.title;
75
+ };
76
+
40
77
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelIconTip, {
41
- label: item.title,
78
+ label: getItemLable(),
42
79
  tooltip: item.tooltip,
43
80
  icon: item.tooltipIcon
44
81
  }), item.filters && /*#__PURE__*/React.createElement(Filter, {
@@ -20,7 +20,8 @@ import cloneDeepLodash from 'lodash.clonedeep'; // 组件内全局状态
20
20
 
21
21
  var state = {
22
22
  fullScreenState: false,
23
- filterRules: {}
23
+ filterRules: {},
24
+ filterColumns: []
24
25
  }; // 组件内全局监听事件
25
26
 
26
27
  var callback = {
@@ -31,6 +32,15 @@ var mutations = {
31
32
  getState: function getState() {
32
33
  return state;
33
34
  },
35
+ setState: function setState(key, value) {
36
+ state[key] = value;
37
+ useOn(key, value);
38
+
39
+ if (mutations.hasOwnProperty(key)) {
40
+ mutations[key] = value;
41
+ }
42
+ },
43
+ filterColumns: state.filterColumns,
34
44
  setFullScreenState: function setFullScreenState(fullScreenState) {
35
45
  state.fullScreenState = fullScreenState;
36
46
  useOn('fullScreenState', fullScreenState);
@@ -74,6 +84,10 @@ var mutations = {
74
84
  * @param name 监听名(作为销毁唯一id使用)
75
85
  */
76
86
  on: function on(fun, state, name) {
87
+ if (!callback[state]) {
88
+ callback[state] = {};
89
+ }
90
+
77
91
  callback[state][name] = fun;
78
92
  },
79
93
  off: function off(name) {
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
2
3
  import './index.scss';
3
4
  export declare type ProTagItem = (TagProps | (CloseableProps & {
@@ -8,4 +9,7 @@ export declare type ProTagItem = (TagProps | (CloseableProps & {
8
9
  */
9
10
  text?: string;
10
11
  };
11
- export declare const renderTags: (tags?: ProTagItem[] | undefined, size?: "small" | "large" | "medium" | undefined) => JSX.Element | null;
12
+ export declare type ProTagProps = ProTagItem[] | ProTagItem | React.ReactNode | React.ReactNode[];
13
+ /** 全局注册 tag 配置 */
14
+ export declare type GlobalTagProps = ProTagItem[];
15
+ export declare const renderTags: (tags?: ProTagProps, size?: "small" | "medium" | "large" | undefined) => JSX.Element | null;
@@ -1,4 +1,4 @@
1
- var _excluded = ["text", "children", "closable"];
1
+ var _excluded = ["text", "children", "closable", "color"];
2
2
 
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
4
 
@@ -10,41 +10,85 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
10
10
 
11
11
  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; }
12
12
 
13
- import React from 'react';
13
+ import React, { isValidElement } from 'react';
14
14
  import { Tag } from '@alicloudfe/components';
15
- import { baseClass } from '@teamix/utils';
15
+ import { baseClass, getTagColor, getGlobalConfig } from '../../../../../utils/src';
16
16
  import './index.scss';
17
17
  var cls = baseClass('teamix-pro-tags');
18
18
  export var renderTags = function renderTags(tags, size) {
19
- if (!tags || !tags.length) {
19
+ if (!tags || Array.isArray(tags) && !tags.length) {
20
20
  return null;
21
- }
21
+ } // 获取全局 tag
22
22
 
23
- return /*#__PURE__*/React.createElement(Tag.Group, {
24
- className: cls('')
25
- }, tags.map(function (tag, i) {
23
+
24
+ var getGlobalTag = function getGlobalTag() {
25
+ var globalTag = getGlobalConfig('tag'); // GlobalTagNodePropsItem 类型
26
+
27
+ if (globalTag) {
28
+ var globalTagMap = new Map(globalTag.map(function (item) {
29
+ return [item.color, item];
30
+ }));
31
+ return globalTagMap;
32
+ }
33
+
34
+ return null;
35
+ }; // 渲染单个 tag
36
+
37
+
38
+ var renderTag = function renderTag(item, index) {
26
39
  // @ts-ignore
27
- var text = tag.text,
28
- children = tag.children,
29
- closable = tag.closable,
30
- others = _objectWithoutProperties(tag, _excluded);
40
+ var text = item.text,
41
+ children = item.children,
42
+ closable = item.closable,
43
+ colorProps = item.color,
44
+ others = _objectWithoutProperties(item, _excluded);
45
+
46
+ var color = getTagColor(colorProps !== null && colorProps !== void 0 ? colorProps : '', 'tag');
47
+ var otherProps = {};
48
+ var globalTagMap = getGlobalTag();
49
+
50
+ if (globalTagMap && globalTagMap.get(color)) {
51
+ var _globalTagMap$get;
52
+
53
+ otherProps = (_globalTagMap$get = globalTagMap.get(color)) !== null && _globalTagMap$get !== void 0 ? _globalTagMap$get : {};
54
+ }
31
55
 
32
56
  if (closable) {
33
- return /*#__PURE__*/React.createElement(Tag.Closeable, _objectSpread({
34
- key: i,
57
+ return /*#__PURE__*/React.createElement(Tag.Closeable, _objectSpread(_objectSpread({
58
+ key: index,
35
59
  size: size,
36
60
  style: {
37
61
  marginBottom: 0
38
- }
39
- }, others), text || children);
62
+ },
63
+ color: color
64
+ }, otherProps), others), text || children);
40
65
  }
41
66
 
42
- return /*#__PURE__*/React.createElement(Tag, _objectSpread({
43
- key: i,
67
+ return /*#__PURE__*/React.createElement(Tag, _objectSpread(_objectSpread({
68
+ key: index,
44
69
  size: size,
45
70
  style: {
46
71
  marginBottom: 0
47
- }
48
- }, others), text || children);
72
+ },
73
+ color: color
74
+ }, otherProps), others), text || children);
75
+ };
76
+
77
+ if (!Array.isArray(tags)) {
78
+ if ( /*#__PURE__*/isValidElement(tags)) {
79
+ return tags;
80
+ }
81
+
82
+ return renderTag(tags, 0);
83
+ }
84
+
85
+ return /*#__PURE__*/React.createElement(Tag.Group, {
86
+ className: cls('')
87
+ }, tags.map(function (tag, i) {
88
+ if ( /*#__PURE__*/isValidElement(tags)) {
89
+ return tags;
90
+ }
91
+
92
+ return renderTag(tag, i);
49
93
  }));
50
94
  };
@@ -235,18 +235,20 @@ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
235
235
  }, buttonProps), buttonContent(children, icon, undefined, context));
236
236
  };
237
237
 
238
- function renderCommonActionButtonMenuItem(action, context) {
238
+ function renderCommonActionButtonMenuItem(action, key, context) {
239
239
  var menuBtn = action;
240
240
 
241
241
  if (menuBtn.actions && menuBtn.actions.length && menuBtn.disabled !== true) {
242
242
  return /*#__PURE__*/_react.default.createElement(_components.Menu.SubMenu, {
243
+ key: key,
243
244
  label: menuBtn.label || menuBtn.children
244
245
  }, menuBtn.actions.map(function (a, j) {
245
- return renderCommonActionButtonMenuItem(a, context);
246
+ return renderCommonActionButtonMenuItem(a, String(j), context);
246
247
  }));
247
248
  }
248
249
 
249
250
  return /*#__PURE__*/_react.default.createElement(ProActionMenuButtonItem, {
251
+ key: key,
250
252
  action: action,
251
253
  context: context
252
254
  });
@@ -275,8 +277,8 @@ var ProActionMenuButton = function ProActionMenuButton(props) {
275
277
  },
276
278
  type: type,
277
279
  label: buttonContent(label || children, icon, iconSize, context)
278
- }, others), actions.map(function (action) {
279
- return renderCommonActionButtonMenuItem(action, context);
280
+ }, others), actions.map(function (action, i) {
281
+ return renderCommonActionButtonMenuItem(action, String(i), context);
280
282
  }));
281
283
  }; // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
282
284
 
@@ -383,7 +385,9 @@ function ProActionGroup(props) {
383
385
  })
384
386
  }, containerProps), formatedActions.map(function (actionBtn, i) {
385
387
  var isLastOne = i === formatedActions.length - 1;
386
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/_react.default.createElement(_components.Divider, {
388
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
389
+ key: i
390
+ }, renderCommonActionButton(actionBtn, context, isTypeText), isTypeText && divider && !isLastOne && /*#__PURE__*/_react.default.createElement(_components.Divider, {
387
391
  direction: "ver"
388
392
  }));
389
393
  }));
@@ -35,39 +35,39 @@ declare const formilyReact: {
35
35
  <Decorator extends originalFormilyReact.JSXComponent, Component extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.ISchemaFieldProps<Decorator, Component, import("@formily/core").ObjectField<Decorator, Component>>): JSX.Element;
36
36
  displayName: string;
37
37
  Markup: {
38
- <Decorator_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaMarkupFieldProps<Components, Component_1, Decorator_1>): JSX.Element;
38
+ <Decorator_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaMarkupFieldProps<Components, Component_1, Decorator_1>): JSX.Element;
39
39
  displayName: string;
40
40
  };
41
41
  String: {
42
- <Decorator_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_2, Decorator_2>): JSX.Element;
42
+ <Decorator_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_2, Decorator_2>): JSX.Element;
43
43
  displayName: string;
44
44
  };
45
45
  Object: {
46
- <Decorator_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_3, Decorator_3>): JSX.Element;
46
+ <Decorator_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_3, Decorator_3>): JSX.Element;
47
47
  displayName: string;
48
48
  };
49
49
  Array: {
50
- <Decorator_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_4, Decorator_4>): JSX.Element;
50
+ <Decorator_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_4, Decorator_4>): JSX.Element;
51
51
  displayName: string;
52
52
  };
53
53
  Boolean: {
54
- <Decorator_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_5, Decorator_5>): JSX.Element;
54
+ <Decorator_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_5, Decorator_5>): JSX.Element;
55
55
  displayName: string;
56
56
  };
57
57
  Date: {
58
- <Decorator_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_6, Decorator_6>): JSX.Element;
58
+ <Decorator_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_6, Decorator_6>): JSX.Element;
59
59
  displayName: string;
60
60
  };
61
61
  DateTime: {
62
- <Decorator_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_7, Decorator_7>): JSX.Element;
62
+ <Decorator_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_7, Decorator_7>): JSX.Element;
63
63
  displayName: string;
64
64
  };
65
65
  Void: {
66
- <Decorator_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_8, Decorator_8>): JSX.Element;
66
+ <Decorator_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_8, Decorator_8>): JSX.Element;
67
67
  displayName: string;
68
68
  };
69
69
  Number: {
70
- <Decorator_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_9, Decorator_9>): JSX.Element;
70
+ <Decorator_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>, Component_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "propTypes" | "contextTypes" | "defaultProps" | "displayName">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_9, Decorator_9>): JSX.Element;
71
71
  displayName: string;
72
72
  };
73
73
  };
package/lib/index.d.ts CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
21
21
  export * from './page-header';
22
22
  export * from './skeleton';
23
23
  export * from './table';
24
- declare const version = "1.2.11";
24
+ declare const version = "1.2.12";
25
25
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
package/lib/index.js CHANGED
@@ -253,5 +253,5 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
253
253
  _icon.default.setConfig(_utils.default.getTeamixIconConfig());
254
254
 
255
255
  // export * from './sidebar';
256
- var version = '1.2.11';
256
+ var version = '1.2.12';
257
257
  exports.version = version;
@@ -35,7 +35,9 @@ var ProInfoItem = function ProInfoItem(prop) {
35
35
  wrapperCol = baseInfoLayout.wrapperCol;
36
36
  return /*#__PURE__*/_react.default.createElement("div", {
37
37
  className: cls()
38
- }, /*#__PURE__*/_react.default.createElement(Row, null, /*#__PURE__*/_react.default.createElement(Col, {
38
+ }, /*#__PURE__*/_react.default.createElement(Row, {
39
+ gutter: 10
40
+ }, /*#__PURE__*/_react.default.createElement(Col, {
39
41
  span: labelCol === null || labelCol === void 0 ? void 0 : labelCol.span,
40
42
  className: cls('label')
41
43
  }, /*#__PURE__*/_react.default.createElement(_utils.Ellipsis, {
@@ -1,7 +1,7 @@
1
1
  import { PageProps } from '../../page-container';
2
- import { PageMap, PageType } from '.';
2
+ import { PageMap } from '.';
3
3
  export interface PageRendererProps<T = any> extends PageProps<T> {
4
- type?: PageType;
4
+ type?: any;
5
5
  error?: any;
6
6
  title?: string;
7
7
  pageMap?: PageMap;