@teamix/pro 1.1.36 → 1.1.40

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 (200) hide show
  1. package/README.md +14 -10
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +2555 -3791
  4. package/dist/pro.min.css +1 -1
  5. package/dist/pro.min.js +1 -1
  6. package/es/actions/dialog-form.d.ts +5 -5
  7. package/es/actions/dialog-form.js +1 -5
  8. package/es/actions/dialog.d.ts +12 -0
  9. package/es/actions/dialog.js +104 -27
  10. package/es/actions/index.d.ts +54 -47
  11. package/es/actions/index.js +28 -22
  12. package/es/actions/index.scss +48 -2
  13. package/es/actions/link.js +4 -2
  14. package/es/actions/request.d.ts +1 -1
  15. package/es/actions/request.js +2 -2
  16. package/es/card/index.d.ts +17 -5
  17. package/es/card/index.js +16 -11
  18. package/es/form/Components/ProField/index.d.ts +1 -161
  19. package/es/form/Components/ProField/index.js +34 -40
  20. package/es/form/Filter/index.js +2 -2
  21. package/es/form/ProForm/index.d.ts +2 -2
  22. package/es/form/ProForm/index.js +1 -6
  23. package/es/form/ProForm/index.scss +19 -1
  24. package/es/form/ProForm/useFieldRequest.d.ts +5 -0
  25. package/es/form/ProForm/useFieldRequest.js +26 -0
  26. package/es/form/SchemaForm/adapterDecorator.js +2 -2
  27. package/es/form/SchemaForm/index.d.ts +2 -2
  28. package/es/form/SchemaForm/index.js +12 -21
  29. package/es/form/SchemaForm/initializeArrayCards.d.ts +2 -2
  30. package/es/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
  31. package/es/form/SchemaForm/initializeArrayItems.d.ts +2 -2
  32. package/es/form/SchemaForm/initializeArrayTable.d.ts +2 -2
  33. package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
  34. package/es/form/SchemaForm/initializeDataSource.js +2 -2
  35. package/es/form/SchemaForm/initializeFormButton.d.ts +2 -2
  36. package/es/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
  37. package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  38. package/es/form/SchemaForm/initializeFormStep.d.ts +3 -3
  39. package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
  40. package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
  41. package/es/form/SchemaForm/initializeRequest.js +2 -2
  42. package/es/form/SchemaForm/initializeRules.js +44 -16
  43. package/es/form/SchemaForm/reactions.d.ts +5 -5
  44. package/es/form/SchemaForm/reactions.js +20 -18
  45. package/es/form/fieldTypeMap.d.ts +4 -0
  46. package/es/form/fieldTypeMap.js +41 -0
  47. package/es/form/index.d.ts +92 -4
  48. package/es/form/index.js +18 -5
  49. package/es/form/schemaNameMap.js +3 -0
  50. package/es/form/typing.d.ts +49 -26
  51. package/es/form/utils.d.ts +3 -1
  52. package/es/form/utils.js +38 -1
  53. package/es/form/warning.d.ts +2 -2
  54. package/es/index.d.ts +1 -1
  55. package/es/index.js +1 -1
  56. package/es/info/components/InfoGroup/index.js +73 -15
  57. package/es/info/components/InfoGroup/index.scss +45 -3
  58. package/es/info/components/InfoValueItem/index.js +9 -4
  59. package/es/info/components/InfoValueItem/index.scss +5 -1
  60. package/es/info/components/ProInfoItem/index.js +3 -3
  61. package/es/info/components/ProInfoItem/index.scss +1 -0
  62. package/es/info/components/baseInfo/index.d.ts +2 -3
  63. package/es/info/components/baseInfo/index.js +29 -10
  64. package/es/info/components/headerInfo/index.d.ts +2 -3
  65. package/es/info/components/tableInfo/index.d.ts +2 -3
  66. package/es/info/components/tableInfo/index.js +2 -2
  67. package/es/info/index.js +75 -51
  68. package/es/info/typing.d.ts +54 -36
  69. package/es/info/utils/index.d.ts +2 -2
  70. package/es/info/utils/utils.d.ts +1 -1
  71. package/es/nocode/pages/renderer.js +2 -2
  72. package/es/page-header/index.d.ts +42 -25
  73. package/es/page-header/index.js +56 -32
  74. package/es/page-header/index.scss +2 -1
  75. package/es/table/components/EmptyContent/index.d.ts +2 -0
  76. package/es/table/components/EmptyContent/index.js +11 -0
  77. package/es/table/components/Filter/index.d.ts +2 -2
  78. package/es/table/components/Filter/index.js +23 -10
  79. package/es/table/components/Filter/index.scss +1 -1
  80. package/es/table/components/Layout/index.js +2 -2
  81. package/es/table/components/QuickAction/index.d.ts +2 -2
  82. package/es/table/components/QuickAction/index.js +3 -3
  83. package/es/table/components/ToolBar/Fullscreen.js +1 -0
  84. package/es/table/index.js +76 -14
  85. package/es/table/index.scss +4 -0
  86. package/es/table/typing.d.ts +29 -14
  87. package/es/table/utils/columnRender.d.ts +3 -3
  88. package/es/table/utils/columnRender.js +2 -2
  89. package/es/table/utils/genProColumnToColumn.d.ts +2 -2
  90. package/es/table/utils/genProColumnToColumn.js +1 -1
  91. package/es/table/utils/index.js +33 -11
  92. package/es/templates/List/index.d.ts +2 -2
  93. package/es/utils/message.d.ts +3 -0
  94. package/es/utils/message.js +19 -0
  95. package/lib/actions/dialog-form.d.ts +5 -5
  96. package/lib/actions/dialog-form.js +1 -5
  97. package/lib/actions/dialog.d.ts +12 -0
  98. package/lib/actions/dialog.js +108 -26
  99. package/lib/actions/index.d.ts +54 -47
  100. package/lib/actions/index.js +37 -30
  101. package/lib/actions/index.scss +48 -2
  102. package/lib/actions/link.js +5 -2
  103. package/lib/actions/request.d.ts +1 -1
  104. package/lib/actions/request.js +2 -2
  105. package/lib/card/index.d.ts +17 -5
  106. package/lib/card/index.js +18 -12
  107. package/lib/form/Components/ProField/index.d.ts +1 -161
  108. package/lib/form/Components/ProField/index.js +32 -38
  109. package/lib/form/Filter/index.js +2 -2
  110. package/lib/form/ProForm/index.d.ts +2 -2
  111. package/lib/form/ProForm/index.js +1 -7
  112. package/lib/form/ProForm/index.scss +19 -1
  113. package/lib/form/ProForm/useFieldRequest.d.ts +5 -0
  114. package/lib/form/ProForm/useFieldRequest.js +37 -0
  115. package/lib/form/SchemaForm/adapterDecorator.js +4 -2
  116. package/lib/form/SchemaForm/index.d.ts +2 -2
  117. package/lib/form/SchemaForm/index.js +11 -22
  118. package/lib/form/SchemaForm/initializeArrayCards.d.ts +2 -2
  119. package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
  120. package/lib/form/SchemaForm/initializeArrayItems.d.ts +2 -2
  121. package/lib/form/SchemaForm/initializeArrayTable.d.ts +2 -2
  122. package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
  123. package/lib/form/SchemaForm/initializeDataSource.js +2 -2
  124. package/lib/form/SchemaForm/initializeFormButton.d.ts +2 -2
  125. package/lib/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
  126. package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  127. package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -3
  128. package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
  129. package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
  130. package/lib/form/SchemaForm/initializeRequest.js +1 -1
  131. package/lib/form/SchemaForm/initializeRules.js +41 -13
  132. package/lib/form/SchemaForm/reactions.d.ts +5 -5
  133. package/lib/form/SchemaForm/reactions.js +22 -20
  134. package/lib/form/fieldTypeMap.d.ts +4 -0
  135. package/lib/form/fieldTypeMap.js +48 -0
  136. package/lib/form/index.d.ts +92 -4
  137. package/lib/form/index.js +17 -31
  138. package/lib/form/schemaNameMap.js +3 -0
  139. package/lib/form/typing.d.ts +49 -26
  140. package/lib/form/utils.d.ts +3 -1
  141. package/lib/form/utils.js +43 -1
  142. package/lib/form/warning.d.ts +2 -2
  143. package/lib/index.d.ts +1 -1
  144. package/lib/index.js +1 -1
  145. package/lib/info/components/InfoGroup/index.js +76 -14
  146. package/lib/info/components/InfoGroup/index.scss +45 -3
  147. package/lib/info/components/InfoValueItem/index.js +8 -3
  148. package/lib/info/components/InfoValueItem/index.scss +5 -1
  149. package/lib/info/components/ProInfoItem/index.js +2 -2
  150. package/lib/info/components/ProInfoItem/index.scss +1 -0
  151. package/lib/info/components/baseInfo/index.d.ts +2 -3
  152. package/lib/info/components/baseInfo/index.js +29 -10
  153. package/lib/info/components/headerInfo/index.d.ts +2 -3
  154. package/lib/info/components/tableInfo/index.d.ts +2 -3
  155. package/lib/info/components/tableInfo/index.js +1 -1
  156. package/lib/info/index.js +73 -49
  157. package/lib/info/typing.d.ts +54 -36
  158. package/lib/info/utils/index.d.ts +2 -2
  159. package/lib/info/utils/utils.d.ts +1 -1
  160. package/lib/nocode/pages/renderer.js +1 -1
  161. package/lib/page-header/index.d.ts +42 -25
  162. package/lib/page-header/index.js +54 -30
  163. package/lib/page-header/index.scss +2 -1
  164. package/lib/table/components/EmptyContent/index.d.ts +2 -0
  165. package/lib/table/components/EmptyContent/index.js +25 -0
  166. package/lib/table/components/Filter/index.d.ts +2 -2
  167. package/lib/table/components/Filter/index.js +23 -10
  168. package/lib/table/components/Filter/index.scss +1 -1
  169. package/lib/table/components/Layout/index.js +1 -1
  170. package/lib/table/components/QuickAction/index.d.ts +2 -2
  171. package/lib/table/components/QuickAction/index.js +1 -1
  172. package/lib/table/components/ToolBar/Fullscreen.js +1 -0
  173. package/lib/table/index.js +77 -14
  174. package/lib/table/index.scss +4 -0
  175. package/lib/table/typing.d.ts +29 -14
  176. package/lib/table/utils/columnRender.d.ts +3 -3
  177. package/lib/table/utils/columnRender.js +1 -1
  178. package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
  179. package/lib/table/utils/genProColumnToColumn.js +2 -2
  180. package/lib/table/utils/index.js +33 -11
  181. package/lib/templates/List/index.d.ts +2 -2
  182. package/lib/utils/message.d.ts +3 -0
  183. package/lib/utils/message.js +32 -0
  184. package/package.json +4 -4
  185. package/es/form/Components/Search/index.d.ts +0 -11
  186. package/es/form/Components/Search/index.js +0 -89
  187. package/es/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
  188. package/es/form/SchemaForm/initializeArrayIcon.js +0 -62
  189. package/es/form/SchemaForm/initializeProField.d.ts +0 -5
  190. package/es/form/SchemaForm/initializeProField.js +0 -70
  191. package/es/info/utils/useInfoRequest.d.ts +0 -14
  192. package/es/info/utils/useInfoRequest.js +0 -76
  193. package/lib/form/Components/Search/index.d.ts +0 -11
  194. package/lib/form/Components/Search/index.js +0 -103
  195. package/lib/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
  196. package/lib/form/SchemaForm/initializeArrayIcon.js +0 -73
  197. package/lib/form/SchemaForm/initializeProField.d.ts +0 -5
  198. package/lib/form/SchemaForm/initializeProField.js +0 -77
  199. package/lib/info/utils/useInfoRequest.d.ts +0 -14
  200. package/lib/info/utils/useInfoRequest.js +0 -85
@@ -2,19 +2,19 @@
2
2
  * ProTable 类型定义
3
3
  */
4
4
  import { ColumnProps, TableProps } from '@alicloudfe/components/types/table';
5
- import { IProFieldType, IProFieldFormatterProps, IProFieldOptionItem } from '../field';
5
+ import { ProFieldType, ProFieldRenderProps, ProFieldDataSourceItem } from '../field';
6
6
  import { IFilterProps } from '../form';
7
- import { ActionGroupProps, IActionButton } from '../actions';
7
+ import { ActionGroupProps, ProActionButtonProps } from '../actions';
8
8
  import { PaginationProps } from '@alicloudfe/components/types/pagination';
9
9
  import { HeaderProps as ProTableHeaderProps } from '@teamix/utils';
10
10
  import { Method } from 'axios';
11
11
  import React from 'react';
12
12
  import type { Form as FormType } from '@formily/core';
13
- declare type IFieldRenderProps = keyof IProFieldFormatterProps;
13
+ declare type IFieldRenderProps = keyof ProFieldRenderProps;
14
14
  /** 列record函数 */
15
15
  declare type ProTableCellFunProp = (value: any, index: number, record: any) => any;
16
16
  declare type ITableCellRender = {
17
- [key in IFieldRenderProps]?: IProFieldFormatterProps[key] | ProTableCellFunProp;
17
+ [key in IFieldRenderProps]?: ProFieldRenderProps[key] | ProTableCellFunProp;
18
18
  } | ((...other: any) => React.ReactNode);
19
19
  declare type TDataService = {
20
20
  /** 翻页器总数 */
@@ -22,7 +22,7 @@ declare type TDataService = {
22
22
  /** 表格数据 */
23
23
  data?: any;
24
24
  };
25
- export declare type ProColumnProps = {
25
+ export declare type ProTableColumnProps = {
26
26
  /**
27
27
  * 会在 title 之后展示一个 icon,hover 之后提示一些信息
28
28
  */
@@ -32,7 +32,7 @@ export declare type ProColumnProps = {
32
32
  */
33
33
  tooltipIcon?: React.ReactNode;
34
34
  /** 对应 ProField 里面的 type */
35
- valueType?: IProFieldType;
35
+ valueType?: ProFieldType;
36
36
  /** 【列配置】是否默认隐藏列 */
37
37
  columnFilters?: boolean;
38
38
  /** 【列配置】是否禁用隐藏列 */
@@ -40,13 +40,15 @@ export declare type ProColumnProps = {
40
40
  /** 渲染单元格内容字段 */
41
41
  render?: ITableCellRender;
42
42
  /** 枚举值 */
43
- dataSource?: IProFieldOptionItem[] | ProTableCellFunProp;
43
+ dataSource?: ProFieldDataSourceItem[] | ProTableCellFunProp;
44
44
  /** 表头的过滤菜单项,当值为 true 时,自动使用 dataSource 生成 */
45
45
  filters?: boolean | ProTableColumnsFilterItemProps[];
46
46
  /** 表头的过滤菜单项过滤方式 single 单选 multiple 多选 */
47
47
  filtersMode?: 'single' | 'multiple';
48
48
  /** 表头的过滤菜单项在搜索之前的参数操作 */
49
49
  beforeFilter?: (rules: string[]) => string;
50
+ /** 表头的过滤菜单宽度 */
51
+ filtersWidth?: string | number;
50
52
  /** 操作组配置 */
51
53
  actionSchema?: ActionGroupProps;
52
54
  /** 指定列对应的字段,支持`a.b`形式的快速取值 和 数组取值 */
@@ -54,9 +56,10 @@ export declare type ProColumnProps = {
54
56
  /** 指定 valueType 为日期时间格式时,可以格式化日期时间 */
55
57
  format?: string;
56
58
  } & Omit<ColumnProps, 'filters' | 'dataIndex' | 'filtersMode'>;
59
+ export declare type ProColumnProps = ProTableColumnProps;
57
60
  export declare type ProTableProps = {
58
61
  /** ProColums 定义,取代 Table 的 columns */
59
- columns: ProColumnProps[];
62
+ columns: ProTableColumnProps[];
60
63
  /** 请求地址 */
61
64
  url?: string;
62
65
  /** 请求方法 */
@@ -161,7 +164,15 @@ export declare type ProTableActionType = {
161
164
  current?: number;
162
165
  /** 每页数据量 */
163
166
  pageSize?: number;
167
+ /** 翻页页数的请求参数名*/
168
+ targetPageKey?: string;
169
+ /** 翻页单页数量的请求参数名 */
170
+ targetPageSizeKey?: string;
164
171
  };
172
+ /** 重置翻页器为1,不发送请求 */
173
+ resetPage?: () => void;
174
+ /** 获取数据过滤区表单实例 */
175
+ dataFilterForm?: FormType;
165
176
  } & ProTableActionTypeMutations;
166
177
  /** action State 定义 */
167
178
  export declare type ProTableActionTypeMutations = {
@@ -175,6 +186,8 @@ export declare type ProTableActionTypeMutations = {
175
186
  off?: (...args: any) => void;
176
187
  /** 设置 列 过滤规则 */
177
188
  setFilterRules?: (rules: ProTableColumnsFilterRulesItem) => void;
189
+ /** 获取 列 过滤规则 */
190
+ getFilterRules?: () => object;
178
191
  /** 重新计算表格maxHeight高度 */
179
192
  resetTableMaxBodyHeight?: () => void;
180
193
  };
@@ -183,7 +196,7 @@ export declare type ProTableActionTypeState = {
183
196
  fullScreenState: boolean;
184
197
  filterRules: ProTableColumnsFilterRulesItem;
185
198
  };
186
- export declare type dataFilterProps = {
199
+ export declare type ProTableDataFilterProps = {
187
200
  /** 展示形式 */
188
201
  mode?: 'inline' | 'panel';
189
202
  /** mode='panel' 时是否默认展开 */
@@ -193,25 +206,27 @@ export declare type dataFilterProps = {
193
206
  /** 搜索时是否传入值为空字符串的参数,默认不传 */
194
207
  searchEmptyString?: boolean;
195
208
  } & IFilterProps;
209
+ export declare type dataFilterProps = ProTableDataFilterProps;
196
210
  export declare type ProTableTopAreaProps = {
197
211
  /** 标题区 */
198
212
  header?: ProTableHeaderProps;
199
213
  /** 主操作区 */
200
214
  mainAction?: ActionGroupProps | React.ReactNode;
201
215
  /** 工具栏区 */
202
- toolBar?: boolean | toolBarItem[];
216
+ toolBar?: boolean | ProTableToolBarItem[];
203
217
  /** 快捷操作区 */
204
- extra?: IActionButton | React.ReactNode | React.ReactNode[];
218
+ extra?: ProActionButtonProps | React.ReactNode | React.ReactNode[];
205
219
  /** 数据过滤区 */
206
- dataFilter?: dataFilterProps;
220
+ dataFilter?: ProTableDataFilterProps;
207
221
  /** 数据过滤区 form 表单模型 */
208
222
  dataFilterForm?: FormType;
209
223
  };
210
224
  /** 单个工具栏 */
211
- declare type toolBarItem = React.ReactNode | 'refresh' | 'density' | 'filterColumn' | 'fullscreen';
225
+ export declare type ProTableToolBarItem = React.ReactNode | 'refresh' | 'density' | 'filterColumn' | 'fullscreen';
226
+ export declare type toolBarItem = ProTableToolBarItem;
212
227
  export declare type ProTableLayoutProps = {
213
228
  actionRef: React.MutableRefObject<ProTableActionType | undefined>;
214
- columns?: ProColumnProps[];
229
+ columns?: ProTableColumnProps[];
215
230
  rowSelection?: innerRowSelectionType | rowSelectionType;
216
231
  } & ProTableTopAreaProps;
217
232
  /** columns 列过滤 */
@@ -2,12 +2,12 @@
2
2
  * 渲染列的逻辑函数
3
3
  */
4
4
  import React from 'react';
5
- import { ProColumnProps, ProTableActionType } from '../typing';
5
+ import { ProTableColumnProps, ProTableActionType } from '../typing';
6
6
  /**
7
7
  * 增加了 icon 的功能 render title
8
8
  */
9
- export declare const renderColumnsTitle: (item: ProColumnProps, actionRef: React.MutableRefObject<ProTableActionType | undefined>) => JSX.Element;
9
+ export declare const renderColumnsTitle: (item: ProTableColumnProps, actionRef: React.MutableRefObject<ProTableActionType | undefined>) => JSX.Element;
10
10
  /**
11
11
  * 负责单元格的具体渲染
12
12
  */
13
- export declare const renderCell: (value: any, item: ProColumnProps, index: number, record: any, actionRef: React.MutableRefObject<ProTableActionType | undefined>) => JSX.Element;
13
+ export declare const renderCell: (value: any, item: ProTableColumnProps, index: number, record: any, actionRef: React.MutableRefObject<ProTableActionType | undefined>) => JSX.Element;
@@ -29,7 +29,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
29
29
  */
30
30
  import React from 'react';
31
31
  import { getTargetValue, LabelIconTip } from '@teamix/utils';
32
- import { ActionGroup } from '../../actions';
32
+ import { ProActionGroup } from '../../actions';
33
33
  import ProField from '../../field';
34
34
  import Filter from '../components/Filter';
35
35
  /**
@@ -93,7 +93,7 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
93
93
  record: record,
94
94
  action: actionRef.current
95
95
  };
96
- return /*#__PURE__*/React.createElement(ActionGroup, _objectSpread(_objectSpread({
96
+ return /*#__PURE__*/React.createElement(ProActionGroup, _objectSpread(_objectSpread({
97
97
  type: "text"
98
98
  }, actionSchema), {}, {
99
99
  context: _objectSpread(_objectSpread({}, defaultContext), actionSchema.context)
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { ProColumnProps, ProTableActionType } from '../typing';
2
+ import { ProTableColumnProps, ProTableActionType } from '../typing';
3
3
  import { ColumnProps } from '@alicloudfe/components/types/table';
4
4
  /**
5
5
  * ProColumn => Column
6
6
  */
7
- export default function genProColumnToColumn(columns: ProColumnProps[],
7
+ export default function genProColumnToColumn(columns: ProTableColumnProps[],
8
8
  /** 是否渲染骨架屏 */
9
9
  showSkeleton: boolean, actionRef: React.MutableRefObject<ProTableActionType | undefined>): ColumnProps[];
@@ -12,7 +12,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
12
12
 
13
13
  import React from 'react';
14
14
  import { renderColumnsTitle, renderCell } from './columnRender';
15
- import { BaseSkeleton as Skeleton } from '../../skeleton';
15
+ import { ProSkeletonRaw as Skeleton } from '../../skeleton';
16
16
  /**
17
17
  * ProColumn => Column
18
18
  */
@@ -45,6 +45,28 @@ var mutations = {
45
45
  state.filterRules = rules;
46
46
  },
47
47
 
48
+ /**
49
+ * 获取筛选规则。为params
50
+ */
51
+ getFilterRules: function getFilterRules() {
52
+ var result = {};
53
+
54
+ if (state.filterRules) {
55
+ result = Object.entries(state.filterRules).map(function (_ref) {
56
+ var _ref2 = _slicedToArray(_ref, 2),
57
+ k = _ref2[0],
58
+ v = _ref2[1];
59
+
60
+ return _defineProperty({}, k, v.params);
61
+ }).reduce(function (acc, cur) {
62
+ acc = _objectSpread(_objectSpread({}, acc), cur);
63
+ return acc;
64
+ }, {});
65
+ }
66
+
67
+ return result;
68
+ },
69
+
48
70
  /**
49
71
  * 绑定监听函数
50
72
  * @param fun 监听函数
@@ -55,14 +77,14 @@ var mutations = {
55
77
  callback[state][name] = fun;
56
78
  },
57
79
  off: function off(name) {
58
- callback = Object.fromEntries(Object.entries(callback).map(function (_ref) {
59
- var _ref2 = _slicedToArray(_ref, 2),
60
- k = _ref2[0],
61
- v = _ref2[1];
80
+ callback = Object.fromEntries(Object.entries(callback).map(function (_ref4) {
81
+ var _ref5 = _slicedToArray(_ref4, 2),
82
+ k = _ref5[0],
83
+ v = _ref5[1];
62
84
 
63
- var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref3) {
64
- var _ref4 = _slicedToArray(_ref3, 1),
65
- k = _ref4[0];
85
+ var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref6) {
86
+ var _ref7 = _slicedToArray(_ref6, 1),
87
+ k = _ref7[0];
66
88
 
67
89
  return k !== name;
68
90
  }));
@@ -77,10 +99,10 @@ var useOn = function useOn(state) {
77
99
  }
78
100
 
79
101
  if (callback[state]) {
80
- Object.entries(callback[state]).forEach(function (_ref5) {
81
- var _ref6 = _slicedToArray(_ref5, 2),
82
- k = _ref6[0],
83
- v = _ref6[1];
102
+ Object.entries(callback[state]).forEach(function (_ref8) {
103
+ var _ref9 = _slicedToArray(_ref8, 2),
104
+ k = _ref9[0],
105
+ v = _ref9[1];
84
106
 
85
107
  if (v) {
86
108
  v === null || v === void 0 ? void 0 : v.apply(void 0, args);
@@ -1,8 +1,8 @@
1
1
  import { PageProps } from '../../page-container';
2
- import { PageHeaderProps } from '../../page-header';
2
+ import { ProPageHeaderProps } from '../../page-header';
3
3
  import { ProTableProps } from '../../table';
4
4
  export declare type ListPageProps = PageProps<{
5
- header: PageHeaderProps;
5
+ header: ProPageHeaderProps;
6
6
  content: ProTableProps;
7
7
  }>;
8
8
  export declare const ListPage: (props: ListPageProps) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { MessageProps } from '@alicloudfe/components/types/message';
2
+ export declare type ProMessageProps = MessageProps | string;
3
+ export declare const renderProMessage: (message: ProMessageProps) => JSX.Element;
@@ -0,0 +1,19 @@
1
+ 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; }
2
+
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
7
+ import React from 'react';
8
+ import { Message } from '@alicloudfe/components';
9
+ export var renderProMessage = function renderProMessage(message) {
10
+ if (typeof message === 'string') {
11
+ return /*#__PURE__*/React.createElement(Message, {
12
+ type: "notice"
13
+ }, message);
14
+ }
15
+
16
+ return /*#__PURE__*/React.createElement(Message, _objectSpread({
17
+ type: "notice"
18
+ }, message));
19
+ };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { IFormProps, IFormSchema } from '../form';
2
+ import { ProFormProps, ProFormSchema } from '../form';
3
3
  import { RequestAction } from './request';
4
4
  import { DialogAction } from './dialog';
5
5
  export interface DialogFormAction extends DialogAction {
@@ -10,11 +10,11 @@ export interface DialogFormAction extends DialogAction {
10
10
  /** 表单提交发送数据请求时,是否携带全部表单数据。默认携带 */
11
11
  useFieldValuesForRequest?: boolean;
12
12
  /**
13
- * @deprecated 建议使用 schema 配置 IFormProps 代替
13
+ * @deprecated 建议使用 schema 配置 ProFormProps 代替
14
14
  */
15
- formProps?: Omit<IFormProps, 'schema'>;
16
- /** 同时支持两种配置方式,如果想完整定制表单,可使用完整的表单配置项 IFormProps,否则可以只配置 IFormSchema */
17
- schema: IFormSchema | IFormProps;
15
+ formProps?: Omit<ProFormProps, 'schema'>;
16
+ /** 同时支持两种配置方式,如果想完整定制表单,可使用完整的表单配置项 ProFormProps,否则可以只配置 ProFormSchema */
17
+ schema: ProFormSchema | ProFormProps;
18
18
  }
19
19
  export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
20
20
  [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
@@ -23,7 +23,7 @@ var _request = require("./request");
23
23
  var _dialog = _interopRequireDefault(require("./dialog"));
24
24
 
25
25
  var _excluded = ["schema"],
26
- _excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "onCancel"];
26
+ _excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish"];
27
27
 
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
29
 
@@ -155,7 +155,6 @@ function useDialogFormAction(action, context) {
155
155
  _action$size = action.size,
156
156
  size = _action$size === void 0 ? 'small' : _action$size,
157
157
  _onFinish = action.onFinish,
158
- _onCancel = action.onCancel,
159
158
  others = _objectWithoutProperties(action, _excluded2);
160
159
 
161
160
  var formRef = (0, _react.useRef)();
@@ -191,9 +190,6 @@ function useDialogFormAction(action, context) {
191
190
  var _formRef$current;
192
191
 
193
192
  _onFinish && _onFinish((_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.values);
194
- },
195
- onCancel: function onCancel() {
196
- _onCancel && _onCancel();
197
193
  }
198
194
  }, others), context);
199
195
  }
@@ -1,14 +1,26 @@
1
1
  import React from 'react';
2
2
  import { QuickShowConfig } from '@alicloudfe/components/types/dialog';
3
3
  import { quickShowDrawerProps } from '@alicloudfe/components/types/drawer';
4
+ import { ProFormSchema, ProFormSchemaItem } from '../form';
5
+ import { ProMessageProps } from '../utils/message';
4
6
  import { RequestAction } from './request';
5
7
  export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShowConfig, 'onError' | 'type'>, Omit<quickShowDrawerProps, 'trigger' | 'animation' | 'height' | 'locale' | 'onOk' | 'onCancel' | 'onError'> {
8
+ /** 点击「确认按钮」后的数据请求地址,非必填,不填就不发请求 */
6
9
  url?: string;
10
+ /** 弹窗类型,支持普通弹窗和抽屉两种模式,默认为普通弹窗 */
7
11
  dialogType?: 'dialog' | 'drawer';
12
+ /** 弹窗快捷调用类型 */
8
13
  dialogQuickShowType?: 'alert' | 'confirm';
14
+ /** 弹窗消息类型 */
9
15
  messageType?: 'success' | 'warning' | 'error' | 'notice' | 'help' | 'loading';
16
+ /** 位于弹窗内容最上方的自定义内容区 */
10
17
  beforeContent?: React.ReactNode;
18
+ /** 位于弹窗内容上方的消息提示区 */
19
+ message?: ProMessageProps;
20
+ /** 位于弹窗内容下方的自定义内容区 */
11
21
  afterContent?: React.ReactNode;
22
+ /** 弹窗页脚描述区,位于按钮组的对面 */
23
+ footerDescription?: React.ReactNode | ProFormSchema | ProFormSchemaItem;
12
24
  }
13
25
  export declare function useDialogAction(action: DialogAction, context?: any): {
14
26
  [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
@@ -10,18 +10,27 @@ exports.useDialogAction = useDialogAction;
10
10
 
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
 
13
+ var _classnames = _interopRequireDefault(require("classnames"));
14
+
13
15
  var _reactRouterDom = require("react-router-dom");
14
16
 
15
17
  var _components = require("@alicloudfe/components");
16
18
 
17
19
  var _utils = require("@teamix/utils");
18
20
 
21
+ var _form = _interopRequireWildcard(require("../form"));
22
+
23
+ var _message = require("../utils/message");
24
+
19
25
  var _base = require("./base");
20
26
 
21
27
  var _request = require("./request");
22
28
 
23
29
  var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
24
- _excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent"];
30
+ _excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "overlayProps"],
31
+ _excluded3 = ["className"];
32
+
33
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
34
 
26
35
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
36
 
@@ -31,16 +40,16 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
31
40
 
32
41
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
33
42
 
34
- 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; }
35
-
36
- 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; }
37
-
38
43
  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; }
39
44
 
40
45
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
41
46
 
42
47
  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; }
43
48
 
49
+ 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; }
50
+
51
+ 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; }
52
+
44
53
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
45
54
 
46
55
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -59,6 +68,27 @@ function addContextForReactNode(content, context) {
59
68
  }
60
69
 
61
70
  return content;
71
+ }
72
+
73
+ var FooterForm = function FooterForm(props) {
74
+ var schema = props.schema,
75
+ context = props.context,
76
+ formRef = props.formRef;
77
+ var form = (0, _form.createForm)();
78
+ (0, _react.useEffect)(function () {
79
+ formRef.current = form;
80
+ }, []);
81
+ return /*#__PURE__*/_react.default.createElement(_form.default, {
82
+ layout: "inline",
83
+ feedbackLayout: "none",
84
+ form: form,
85
+ schema: (0, _utils.getTargetValue)(schema, context)
86
+ });
87
+ };
88
+
89
+ function getFooterAlignClass(isDrawer, align) {
90
+ var footerAlign = align ? align : isDrawer ? 'left' : 'right';
91
+ return "footer-align-".concat(footerAlign);
62
92
  } // 弹窗 -> 请求(点击确认,发送数据请求)
63
93
 
64
94
 
@@ -68,8 +98,10 @@ function useDialogAction(action, context) {
68
98
  loading = _useState2[0],
69
99
  setLoading = _useState2[1];
70
100
 
101
+ var footerDescriptionRef = (0, _react.useRef)();
71
102
  var history = (0, _reactRouterDom.useHistory)();
72
- return _objectSpread({}, (0, _base.eventHandler)(action, function () {
103
+
104
+ var onActionStart = function onActionStart() {
73
105
  var url = action.url,
74
106
  method = action.method,
75
107
  params = action.params,
@@ -98,19 +130,55 @@ function useDialogAction(action, context) {
98
130
  link = _getTargetValue.link,
99
131
  beforeContent = _getTargetValue.beforeContent,
100
132
  afterContent = _getTargetValue.afterContent,
101
- dialogOtherProps = _objectWithoutProperties(_getTargetValue, _excluded2);
133
+ message = _getTargetValue.message,
134
+ footerDescription = _getTargetValue.footerDescription,
135
+ footerAlign = _getTargetValue.footerAlign,
136
+ _getTargetValue$overl = _getTargetValue.overlayProps,
137
+ overlayProps = _getTargetValue$overl === void 0 ? {} : _getTargetValue$overl,
138
+ containerProps = _objectWithoutProperties(_getTargetValue, _excluded2);
102
139
 
103
- var dialogMethod = dialogType === 'drawer' ? _components.Drawer : _components.Dialog;
104
- var dialogProps = dialogType === 'drawer' ? {} : {
140
+ var isDrawer = dialogType === 'drawer';
141
+ var container = isDrawer ? _components.Drawer : _components.Dialog;
142
+
143
+ var overlayClassName = overlayProps.className,
144
+ overlayOtherProps = _objectWithoutProperties(overlayProps, _excluded3);
145
+
146
+ var dialogOnlyProps = {
105
147
  type: dialogQuickShowType,
106
148
  messageProps: {
107
149
  type: messageType
150
+ },
151
+ overlayProps: _objectSpread({
152
+ className: (0, _classnames.default)('teamix-pro-action-dialog', overlayClassName, {
153
+ 'has-footer-description': !!footerDescription
154
+ })
155
+ }, overlayOtherProps)
156
+ };
157
+ var containerOtherProps = isDrawer ? {} : dialogOnlyProps;
158
+
159
+ var renderDialogFooterDescription = function renderDialogFooterDescription(footer) {
160
+ if (footer instanceof Array || footer.component) {
161
+ var _schema = footer instanceof Array ? footer : [footer];
162
+
163
+ return /*#__PURE__*/_react.default.createElement(FooterForm, {
164
+ formRef: footerDescriptionRef,
165
+ context: context,
166
+ schema: [{
167
+ component: 'FormFlex',
168
+ children: _schema
169
+ }]
170
+ });
108
171
  }
172
+
173
+ return footer;
109
174
  };
110
175
 
111
176
  var onOk = function onOk() {
112
177
  return new Promise( /*#__PURE__*/function () {
113
178
  var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve) {
179
+ var _footerDescriptionRef;
180
+
181
+ var footerDescriptionValues, requestContext;
114
182
  return regeneratorRuntime.wrap(function _callee$(_context) {
115
183
  while (1) {
116
184
  switch (_context.prev = _context.next) {
@@ -130,29 +198,33 @@ function useDialogAction(action, context) {
130
198
 
131
199
  case 5:
132
200
  setLoading(true);
133
- _context.prev = 6;
134
- _context.next = 9;
135
- return (0, _request.doRequest)(action, context, history);
136
-
137
- case 9:
201
+ footerDescriptionValues = Object.assign({}, footerDescriptionRef === null || footerDescriptionRef === void 0 ? void 0 : (_footerDescriptionRef = footerDescriptionRef.current) === null || _footerDescriptionRef === void 0 ? void 0 : _footerDescriptionRef.values);
202
+ _context.prev = 7;
203
+ requestContext = Object.assign({
204
+ footer: footerDescriptionValues
205
+ }, context);
206
+ _context.next = 11;
207
+ return (0, _request.doRequest)(action, requestContext, history, footerDescriptionValues);
208
+
209
+ case 11:
138
210
  onFinish && onFinish();
139
211
  resolve(true);
140
- _context.next = 18;
212
+ _context.next = 20;
141
213
  break;
142
214
 
143
- case 13:
144
- _context.prev = 13;
145
- _context.t0 = _context["catch"](6);
215
+ case 15:
216
+ _context.prev = 15;
217
+ _context.t0 = _context["catch"](7);
146
218
  setLoading(false);
147
219
  resolve(false);
148
220
  return _context.abrupt("return");
149
221
 
150
- case 18:
222
+ case 20:
151
223
  case "end":
152
224
  return _context.stop();
153
225
  }
154
226
  }
155
- }, _callee, null, [[6, 13]]);
227
+ }, _callee, null, [[7, 15]]);
156
228
  }));
157
229
 
158
230
  return function (_x) {
@@ -176,19 +248,29 @@ function useDialogAction(action, context) {
176
248
  var dialogContent = Component ? /*#__PURE__*/_react.default.createElement(Component, _objectSpread({
177
249
  key: (0, _utils.uuid)()
178
250
  }, componentProps)) : addContextForReactNode(content, dialogContext);
179
- var ret = dialogMethod.show(_objectSpread(_objectSpread({
251
+
252
+ var quickShowProps = _objectSpread(_objectSpread({
180
253
  // @ts-ignore
181
254
  onOk: onOk,
182
255
  title: addContextForReactNode(title, dialogContext),
183
256
  content: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, beforeContent && /*#__PURE__*/_react.default.createElement("div", {
184
257
  className: "teamix-pro-dialog-before-content"
185
- }, beforeContent), dialogContent, afterContent && /*#__PURE__*/_react.default.createElement("div", {
258
+ }, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/_react.default.createElement("div", {
259
+ className: "teamix-pro-dialog-message"
260
+ }, (0, _message.renderProMessage)(message)), dialogContent, afterContent && /*#__PURE__*/_react.default.createElement("div", {
186
261
  className: "teamix-pro-dialog-after-content"
187
- }, afterContent)),
188
- closeable: !loading
189
- }, dialogProps), dialogOtherProps));
262
+ }, addContextForReactNode(afterContent, dialogContext)), footerDescription && /*#__PURE__*/_react.default.createElement("div", {
263
+ className: (0, _classnames.default)('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
264
+ }, renderDialogFooterDescription(footerDescription))),
265
+ closeable: !loading,
266
+ footerAlign: footerAlign
267
+ }, containerOtherProps), containerProps);
268
+
269
+ var ret = container.show(quickShowProps);
190
270
  store.hide = ret.hide;
191
- }));
271
+ };
272
+
273
+ return _objectSpread({}, (0, _base.eventHandler)(action, onActionStart));
192
274
  }
193
275
 
194
276
  var _default = useDialogAction;