fan-standard-comp 3.1.9 → 3.2.0

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 (176) hide show
  1. package/Readme.md +35 -0
  2. package/dist/fan-standard-comp.umd.js +15 -10
  3. package/es/ButtonGroup/ButtonList.js +0 -3
  4. package/es/ButtonGroup/ButtonMenu.js +0 -3
  5. package/es/ButtonGroup/PopConfirmTitle.js +5 -15
  6. package/es/ButtonGroup/index.d.ts +2 -0
  7. package/es/ButtonGroup/index.js +223 -193
  8. package/es/ButtonGroup/style/index.less +1 -1
  9. package/es/DragContent/DragBar.js +2 -6
  10. package/es/DragContent/index.js +44 -75
  11. package/es/FormComp/ChunkUploader/api.js +6 -10
  12. package/es/FormComp/ChunkUploader/index.js +105 -171
  13. package/es/FormComp/ChunkUploader/lib.js +4 -17
  14. package/es/FormComp/ChunkUploader/upload-queue.class.js +10 -45
  15. package/es/FormComp/ChunkUploader/worker.js +0 -3
  16. package/es/FormComp/EditButton/index.js +24 -49
  17. package/es/FormComp/FieldComponent/ReUpload.js +18 -38
  18. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +37 -75
  19. package/es/FormComp/FieldComponent/TitleNode.js +1 -3
  20. package/es/FormComp/FieldComponent/index.js +38 -74
  21. package/es/FormComp/FieldComponent/setReadonlyValues.js +34 -63
  22. package/es/FormComp/FieldComponent/style/index.less +6 -0
  23. package/es/FormComp/RenderItemGroup/index.js +46 -74
  24. package/es/FormComp/Uploader/index.js +36 -77
  25. package/es/FormComp/Uploader/util.js +0 -6
  26. package/es/FormComp/VarTemplate/index.js +58 -96
  27. package/es/NavLeafScroll/index.js +172 -154
  28. package/es/NavLeafScroll/style/index.less +33 -1
  29. package/es/RefactorTree/index.js +36 -53
  30. package/es/RefactorTree/indexTreeNode.js +35 -68
  31. package/es/RefactorTree/util.js +9 -43
  32. package/es/SpecIcon/fonts/iconfont.js +7 -12
  33. package/es/SpecIcon/index.js +16 -25
  34. package/es/SplitterLayout/Pane.js +2 -5
  35. package/es/SplitterLayout/index.js +20 -70
  36. package/es/StandardContent/SplitterLayout/Pane.js +6 -10
  37. package/es/StandardContent/SplitterLayout/index.js +12 -63
  38. package/es/StandardContent/SubfieldContent.js +12 -14
  39. package/es/StandardContent/WrapperContent.js +8 -10
  40. package/es/StandardDragModal/ChangeStandardModal.d.ts +44 -0
  41. package/es/StandardDragModal/ChangeStandardModal.js +493 -0
  42. package/es/StandardDragModal/DraggableModal.d.ts +7 -0
  43. package/es/StandardDragModal/DraggableModal.js +31 -0
  44. package/es/StandardDragModal/DraggableModalContext.d.ts +9 -0
  45. package/es/StandardDragModal/DraggableModalContext.js +5 -0
  46. package/es/StandardDragModal/DraggableModalInner.d.ts +16 -0
  47. package/es/StandardDragModal/DraggableModalInner.js +114 -0
  48. package/es/StandardDragModal/DraggableModalProvider.d.ts +4 -0
  49. package/es/StandardDragModal/DraggableModalProvider.js +40 -0
  50. package/es/StandardDragModal/Modal.d.ts +11 -0
  51. package/es/StandardDragModal/Modal.js +24 -0
  52. package/es/StandardDragModal/ResizeHandle.d.ts +2 -0
  53. package/es/StandardDragModal/ResizeHandle.js +8 -0
  54. package/es/StandardDragModal/clamp.d.ts +1 -0
  55. package/es/StandardDragModal/clamp.js +3 -0
  56. package/es/StandardDragModal/draggableModalReducer.d.ts +66 -0
  57. package/es/StandardDragModal/draggableModalReducer.js +157 -0
  58. package/es/StandardDragModal/getWindowSize.d.ts +4 -0
  59. package/es/StandardDragModal/getWindowSize.js +6 -0
  60. package/es/StandardDragModal/index.d.ts +3 -11
  61. package/es/StandardDragModal/index.js +3 -30
  62. package/es/StandardDragModal/index.less +65 -0
  63. package/es/StandardDragModal/useDrag.d.ts +5 -0
  64. package/es/StandardDragModal/useDrag.js +66 -0
  65. package/es/StandardDragModal/usePrevious.d.ts +1 -0
  66. package/es/StandardDragModal/usePrevious.js +8 -0
  67. package/es/StandardDragModal/useResize.d.ts +7 -0
  68. package/es/StandardDragModal/useResize.js +74 -0
  69. package/es/StandardFilter/index.d.ts +1 -0
  70. package/es/StandardFilter/index.js +32 -70
  71. package/es/StandardForm/ActionList.js +5 -7
  72. package/es/StandardForm/StepForm.js +50 -71
  73. package/es/StandardForm/TabForm.js +58 -70
  74. package/es/StandardForm/index.js +37 -56
  75. package/es/StandardModal/UpdateFormRef.js +1 -4
  76. package/es/StandardModal/index.d.ts +0 -1
  77. package/es/StandardModal/index.js +115 -159
  78. package/es/StandardPanel/index.js +19 -35
  79. package/es/StandardTable/index.js +20 -30
  80. package/es/components/IconNode/index.js +0 -4
  81. package/es/index.d.ts +1 -0
  82. package/es/index.js +15 -14
  83. package/es/utils/ValueFormat.js +0 -9
  84. package/es/utils/dictSelectUtil.js +153 -0
  85. package/es/utils/filterPermission.js +16 -34
  86. package/es/utils/getParentNodes.js +24 -47
  87. package/es/utils/index.js +2 -1
  88. package/lib/ButtonGroup/ButtonList.js +1 -13
  89. package/lib/ButtonGroup/ButtonMenu.js +1 -8
  90. package/lib/ButtonGroup/PopConfirmTitle.js +3 -16
  91. package/lib/ButtonGroup/index.d.ts +2 -0
  92. package/lib/ButtonGroup/index.js +226 -216
  93. package/lib/ButtonGroup/style/index.less +1 -1
  94. package/lib/DragContent/DragBar.js +2 -10
  95. package/lib/DragContent/index.js +47 -85
  96. package/lib/FormComp/ChunkUploader/api.js +6 -15
  97. package/lib/FormComp/ChunkUploader/index.js +107 -185
  98. package/lib/FormComp/ChunkUploader/lib.js +8 -27
  99. package/lib/FormComp/ChunkUploader/upload-queue.class.js +10 -46
  100. package/lib/FormComp/ChunkUploader/worker.js +1 -5
  101. package/lib/FormComp/EditButton/index.js +26 -60
  102. package/lib/FormComp/FieldComponent/ReUpload.js +21 -50
  103. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +39 -90
  104. package/lib/FormComp/FieldComponent/TitleNode.js +1 -5
  105. package/lib/FormComp/FieldComponent/index.js +38 -110
  106. package/lib/FormComp/FieldComponent/setReadonlyValues.js +37 -79
  107. package/lib/FormComp/FieldComponent/style/index.less +6 -0
  108. package/lib/FormComp/RenderItemGroup/index.js +46 -87
  109. package/lib/FormComp/Uploader/index.js +38 -95
  110. package/lib/FormComp/Uploader/util.js +1 -9
  111. package/lib/FormComp/VarTemplate/index.js +62 -106
  112. package/lib/FormComp/index.js +0 -2
  113. package/lib/NavLeafScroll/index.js +174 -165
  114. package/lib/NavLeafScroll/style/index.less +33 -1
  115. package/lib/RefactorTree/index.js +36 -67
  116. package/lib/RefactorTree/indexTreeNode.js +37 -83
  117. package/lib/RefactorTree/util.js +11 -45
  118. package/lib/SpecIcon/fonts/iconfont.js +7 -12
  119. package/lib/SpecIcon/index.js +16 -30
  120. package/lib/SplitterLayout/Pane.js +0 -7
  121. package/lib/SplitterLayout/index.js +18 -72
  122. package/lib/StandardContent/SplitterLayout/Pane.js +6 -14
  123. package/lib/StandardContent/SplitterLayout/index.js +12 -68
  124. package/lib/StandardContent/SubfieldContent.js +12 -21
  125. package/lib/StandardContent/WrapperContent.js +8 -16
  126. package/lib/StandardDragModal/ChangeStandardModal.d.ts +44 -0
  127. package/lib/StandardDragModal/ChangeStandardModal.js +502 -0
  128. package/lib/StandardDragModal/DraggableModal.d.ts +7 -0
  129. package/lib/StandardDragModal/DraggableModal.js +40 -0
  130. package/lib/StandardDragModal/DraggableModalContext.d.ts +9 -0
  131. package/lib/StandardDragModal/DraggableModalContext.js +15 -0
  132. package/lib/StandardDragModal/DraggableModalInner.d.ts +16 -0
  133. package/lib/StandardDragModal/DraggableModalInner.js +124 -0
  134. package/lib/StandardDragModal/DraggableModalProvider.d.ts +4 -0
  135. package/lib/StandardDragModal/DraggableModalProvider.js +48 -0
  136. package/lib/StandardDragModal/Modal.d.ts +11 -0
  137. package/lib/StandardDragModal/Modal.js +32 -0
  138. package/lib/StandardDragModal/ResizeHandle.d.ts +2 -0
  139. package/lib/StandardDragModal/ResizeHandle.js +18 -0
  140. package/lib/StandardDragModal/clamp.d.ts +1 -0
  141. package/lib/StandardDragModal/clamp.js +10 -0
  142. package/lib/StandardDragModal/draggableModalReducer.d.ts +66 -0
  143. package/lib/StandardDragModal/draggableModalReducer.js +167 -0
  144. package/lib/StandardDragModal/getWindowSize.d.ts +4 -0
  145. package/lib/StandardDragModal/getWindowSize.js +13 -0
  146. package/lib/StandardDragModal/index.d.ts +3 -11
  147. package/lib/StandardDragModal/index.js +33 -38
  148. package/lib/StandardDragModal/index.less +65 -0
  149. package/lib/StandardDragModal/useDrag.d.ts +5 -0
  150. package/lib/StandardDragModal/useDrag.js +73 -0
  151. package/lib/StandardDragModal/usePrevious.d.ts +1 -0
  152. package/lib/StandardDragModal/usePrevious.js +15 -0
  153. package/lib/StandardDragModal/useResize.d.ts +7 -0
  154. package/lib/StandardDragModal/useResize.js +81 -0
  155. package/lib/StandardFilter/index.d.ts +1 -0
  156. package/lib/StandardFilter/index.js +30 -78
  157. package/lib/StandardForm/ActionList.js +5 -12
  158. package/lib/StandardForm/StepForm.js +52 -90
  159. package/lib/StandardForm/TabForm.js +61 -88
  160. package/lib/StandardForm/index.js +40 -75
  161. package/lib/StandardModal/UpdateFormRef.js +4 -12
  162. package/lib/StandardModal/index.d.ts +0 -1
  163. package/lib/StandardModal/index.js +117 -184
  164. package/lib/StandardPanel/index.js +22 -48
  165. package/lib/StandardTable/index.js +20 -39
  166. package/lib/components/IconNode/index.js +0 -7
  167. package/lib/components/index.js +0 -2
  168. package/lib/data/index.js +4 -7
  169. package/lib/index.d.ts +1 -0
  170. package/lib/index.js +50 -68
  171. package/lib/utils/ValueFormat.js +0 -10
  172. package/lib/utils/dictSelectUtil.js +161 -0
  173. package/lib/utils/filterPermission.js +15 -39
  174. package/lib/utils/getParentNodes.js +25 -52
  175. package/lib/utils/index.js +24 -9
  176. package/package.json +6 -5
@@ -7,24 +7,21 @@ import React from 'react';
7
7
  import classNames from 'classnames';
8
8
  import ButtonGroup from '../ButtonGroup/index';
9
9
  import './style/index.less';
10
-
11
10
  var StandardTable = function StandardTable(props) {
12
11
  // const ref= React.createRef<Card>();
13
12
  var _props$data = props.data,
14
- data = _props$data === void 0 ? {} : _props$data,
15
- rowKey = props.rowKey,
16
- rowSelection = props.rowSelection,
17
- columns = props.columns,
18
- hideOrderNumber = props.hideOrderNumber,
19
- _props$orderNumber = props.orderNumber,
20
- orderNumber = _props$orderNumber === void 0 ? {} : _props$orderNumber,
21
- className = props.className,
22
- emptyText = props.emptyText,
23
- codes = props.codes,
24
- permissionCodes = props.permissionCodes,
25
- rest = __rest(props, ["data", "rowKey", "rowSelection", "columns", "hideOrderNumber", "orderNumber", "className", "emptyText", "codes", "permissionCodes"]); // 加上类型修复 TS:2322 报警
26
-
27
-
13
+ data = _props$data === void 0 ? {} : _props$data,
14
+ rowKey = props.rowKey,
15
+ rowSelection = props.rowSelection,
16
+ columns = props.columns,
17
+ hideOrderNumber = props.hideOrderNumber,
18
+ _props$orderNumber = props.orderNumber,
19
+ orderNumber = _props$orderNumber === void 0 ? {} : _props$orderNumber,
20
+ className = props.className,
21
+ emptyText = props.emptyText,
22
+ codes = props.codes,
23
+ permissionCodes = props.permissionCodes,
24
+ rest = __rest(props, ["data", "rowKey", "rowSelection", "columns", "hideOrderNumber", "orderNumber", "className", "emptyText", "codes", "permissionCodes"]); // 加上类型修复 TS:2322 报警
28
25
  var resetColumns = [Object.assign({
29
26
  width: 58,
30
27
  align: 'center',
@@ -37,8 +34,8 @@ var StandardTable = function StandardTable(props) {
37
34
  }
38
35
  }, orderNumber)];
39
36
  var _data$list = data.list,
40
- list = _data$list === void 0 ? [] : _data$list,
41
- pagination = data.pagination;
37
+ list = _data$list === void 0 ? [] : _data$list,
38
+ pagination = data.pagination;
42
39
  var paginationProps = Object.assign({
43
40
  // showQuickJumper: true,
44
41
  className: 'spec-pagination',
@@ -48,27 +45,24 @@ var StandardTable = function StandardTable(props) {
48
45
  return "".concat(range[0], "-").concat(range[1], "\u6761 \u5171").concat(total, "\u6761");
49
46
  }
50
47
  }, pagination);
51
-
52
48
  if (columns) {
53
49
  columns.map(function (colItem) {
54
50
  if (colItem.type === 'action') {
55
51
  colItem.width = colItem.width || (colItem.buttonGroup.length > 1 ? 120 : 80);
56
52
  colItem.align = 'center';
57
53
  colItem.title = colItem.title || '操作';
58
- colItem.key = 'control'; // colItem.fixed = colItem.fixed || 'right'
59
-
54
+ colItem.key = 'control';
55
+ // colItem.fixed = colItem.fixed || 'right'
60
56
  colItem.render = function (text, record, rowIndex) {
61
57
  // 按钮列表组
62
58
  var renderTableButtonGroup = function renderTableButtonGroup(buttonGroup) {
63
59
  if (!buttonGroup) return '-';
64
60
  var recombinationGroup = []; // 重组数据
65
61
  // 类型为数组
66
-
67
- if (Array.isArray(buttonGroup)) recombinationGroup = buttonGroup; // 类型为方法
68
-
62
+ if (Array.isArray(buttonGroup)) recombinationGroup = buttonGroup;
63
+ // 类型为方法
69
64
  if (typeof buttonGroup === 'function') recombinationGroup = buttonGroup(text, record, rowIndex); // 方法返回数组结构
70
65
  // 判断是否是数组且长度大于0时 ?{如下结构渲染} : {按buttonGroup返回的node渲染}
71
-
72
66
  if (Array.isArray(buttonGroup) || typeof buttonGroup === 'function') {
73
67
  if (recombinationGroup.length === 0) return '-';
74
68
  return /*#__PURE__*/React.createElement(ButtonGroup, {
@@ -81,13 +75,13 @@ var StandardTable = function StandardTable(props) {
81
75
  text: text,
82
76
  record: record,
83
77
  rowIndex: rowIndex
84
- }
78
+ },
79
+ dropdownConfig: colItem.buttonGroupConfig || {}
85
80
  });
86
81
  } else {
87
82
  return buttonGroup;
88
83
  }
89
84
  };
90
-
91
85
  return /*#__PURE__*/React.createElement(React.Fragment, null, renderTableButtonGroup(colItem.buttonGroup));
92
86
  };
93
87
  } else if (!colItem.render) {
@@ -95,15 +89,12 @@ var StandardTable = function StandardTable(props) {
95
89
  colItem.render = function (text, record, rowIndex) {
96
90
  return text || text === 0 ? text : '-';
97
91
  };
98
-
99
92
  return colItem;
100
93
  }
101
-
102
94
  return colItem;
103
95
  });
104
96
  resetColumns = hideOrderNumber ? columns : resetColumns.concat(columns);
105
97
  }
106
-
107
98
  return /*#__PURE__*/React.createElement(_Card, {
108
99
  className: classNames('standard-table', className),
109
100
  bordered: false
@@ -122,5 +113,4 @@ var StandardTable = function StandardTable(props) {
122
113
  }
123
114
  }, rest)));
124
115
  };
125
-
126
116
  export default StandardTable;
@@ -1,10 +1,8 @@
1
1
  import SpecIcon from "../../SpecIcon/index";
2
2
  import React from "react";
3
-
4
3
  var IconNode = function IconNode(props) {
5
4
  var icon = props.icon;
6
5
  if (!icon) return null;
7
-
8
6
  if (typeof icon === 'string') {
9
7
  var iconArr = icon.split(',');
10
8
  return /*#__PURE__*/React.createElement(SpecIcon, {
@@ -13,7 +11,6 @@ var IconNode = function IconNode(props) {
13
11
  name: iconArr.length > 1 ? iconArr[1] : icon
14
12
  });
15
13
  }
16
-
17
14
  if (Array.isArray(icon) && icon.length > 1) {
18
15
  // @ts-ignore
19
16
  return /*#__PURE__*/React.createElement(SpecIcon, {
@@ -24,5 +21,4 @@ var IconNode = function IconNode(props) {
24
21
 
25
22
  return /*#__PURE__*/React.createElement(React.Fragment, null, icon);
26
23
  };
27
-
28
24
  export default IconNode;
package/es/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { default as StepForm } from './StandardForm/StepForm';
8
8
  export { default as TabForm } from './StandardForm/TabForm';
9
9
  export { default as StandardFilter } from './StandardFilter';
10
10
  export { default as StandardModal } from './StandardModal';
11
+ export { default as StandardDragModal } from './StandardDragModal/Modal';
11
12
  export { default as Uploader } from './FormComp/Uploader';
12
13
  export { default as EditButton } from './FormComp/EditButton';
13
14
  export { default as FieldComponent } from './FormComp/FieldComponent';
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { default as SpecIcon } from './SpecIcon';
2
2
  export { default as ButtonGroup } from './ButtonGroup';
3
- export { default as RefactorTree } from './RefactorTree'; // 通用组件
4
-
3
+ export { default as RefactorTree } from './RefactorTree';
4
+ // 通用组件
5
5
  export { default as StandardPanel } from './StandardPanel';
6
6
  export { default as StandardTable } from './StandardTable';
7
7
  export { default as StandardForm } from './StandardForm';
@@ -9,23 +9,24 @@ export { default as StepForm } from './StandardForm/StepForm';
9
9
  export { default as TabForm } from './StandardForm/TabForm';
10
10
  export { default as StandardFilter } from './StandardFilter';
11
11
  export { default as StandardModal } from './StandardModal';
12
+ export { default as StandardDragModal } from './StandardDragModal/Modal';
12
13
  export { default as Uploader } from './FormComp/Uploader';
13
- export { default as EditButton } from './FormComp/EditButton'; // 基础控件
14
-
14
+ export { default as EditButton } from './FormComp/EditButton';
15
+ // 基础控件
15
16
  export { default as FieldComponent } from './FormComp/FieldComponent';
16
- export { default as Field } from './FormComp/FieldComponent'; // 表单组
17
-
17
+ export { default as Field } from './FormComp/FieldComponent';
18
+ // 表单组
18
19
  export { default as RenderItemGroup } from './FormComp/RenderItemGroup';
19
- export { default as ItemGroup } from './FormComp/RenderItemGroup'; // 页面内容结构
20
-
20
+ export { default as ItemGroup } from './FormComp/RenderItemGroup';
21
+ // 页面内容结构
21
22
  export { default as SubfieldContent } from './StandardContent/SubfieldContent';
22
23
  export { default as WrapperContent } from './StandardContent/WrapperContent';
23
24
  export { default as DragContent } from './DragContent';
24
- export { default as SplitterLayout } from './StandardContent/SplitterLayout'; // 其他
25
-
25
+ export { default as SplitterLayout } from './StandardContent/SplitterLayout';
26
+ // 其他
26
27
  export { default as NavLeafScroll } from './NavLeafScroll';
27
- export * from './components'; // 工具类
28
-
29
- export * from './utils'; // 数据类
30
-
28
+ export * from './components';
29
+ // 工具类
30
+ export * from './utils';
31
+ // 数据类
31
32
  export * from './data';
@@ -6,45 +6,36 @@
6
6
  var UtilValueFormat = function UtilValueFormat(fieldsValue, formItemGroup) {
7
7
  formItemGroup && formItemGroup.forEach(function (item) {
8
8
  var _item$protoConfig, _fieldsValue$item$fil, _item$protoConfig2, _fieldsValue$item$fil2, _item$protoConfig3, _fieldsValue$item$fil3, _item$protoConfig4;
9
-
10
9
  if (!fieldsValue[item.filedName]) return;
11
-
12
10
  switch (item.type) {
13
11
  case 'datePicker':
14
12
  case 'dateTimePicker':
15
13
  case 'rangePicker':
16
14
  case 'rangeTimePicker':
17
15
  var pickerFormatNew;
18
-
19
16
  if (item === null || item === void 0 ? void 0 : (_item$protoConfig = item.protoConfig) === null || _item$protoConfig === void 0 ? void 0 : _item$protoConfig.picker) {
20
17
  switch (item.protoConfig.picker) {
21
18
  case 'week':
22
19
  pickerFormatNew = 'YYYY-wo';
23
20
  break;
24
-
25
21
  case 'month':
26
22
  pickerFormatNew = 'MM月';
27
23
  break;
28
-
29
24
  case 'year':
30
25
  pickerFormatNew = 'YYYY';
31
26
  break;
32
-
33
27
  default:
34
28
  break;
35
29
  }
36
30
  } else {
37
31
  pickerFormatNew = item.type === 'datePicker' || item.type === 'rangePicker' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss';
38
32
  }
39
-
40
33
  fieldsValue[item.filedName] = item.type === 'datePicker' || item.type === 'dateTimePicker' ? (_fieldsValue$item$fil = fieldsValue[item.filedName]) === null || _fieldsValue$item$fil === void 0 ? void 0 : _fieldsValue$item$fil.format((item === null || item === void 0 ? void 0 : (_item$protoConfig2 = item.protoConfig) === null || _item$protoConfig2 === void 0 ? void 0 : _item$protoConfig2.format) || pickerFormatNew) : [(_fieldsValue$item$fil2 = fieldsValue[item.filedName][0]) === null || _fieldsValue$item$fil2 === void 0 ? void 0 : _fieldsValue$item$fil2.format((item === null || item === void 0 ? void 0 : (_item$protoConfig3 = item.protoConfig) === null || _item$protoConfig3 === void 0 ? void 0 : _item$protoConfig3.format) || pickerFormatNew), (_fieldsValue$item$fil3 = fieldsValue[item.filedName][1]) === null || _fieldsValue$item$fil3 === void 0 ? void 0 : _fieldsValue$item$fil3.format((item === null || item === void 0 ? void 0 : (_item$protoConfig4 = item.protoConfig) === null || _item$protoConfig4 === void 0 ? void 0 : _item$protoConfig4.format) || pickerFormatNew)];
41
34
  break;
42
-
43
35
  default:
44
36
  break;
45
37
  }
46
38
  });
47
39
  return fieldsValue;
48
40
  };
49
-
50
41
  export default UtilValueFormat;
@@ -0,0 +1,153 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8
+ 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); }
9
+ 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; }
10
+ /**
11
+ * 字典 取值数据
12
+ * author: shomychen
13
+ * date: 2022.12.30
14
+ */
15
+
16
+ /**
17
+ * 字典值替换文本通用方法
18
+ * @param {Array} dictOptions 字典数组
19
+ * @param {String} text 字典值(多个可以用,隔开)
20
+ * @param {Object} optionName 指定字段值(默认 { value: 'value', label: 'label' })
21
+ *
22
+ * @return String
23
+ */
24
+ export function filterDictText(dictOptions, text) {
25
+ var optionName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
26
+ value: 'value',
27
+ label: 'label'
28
+ };
29
+ // -- 字典翻译 text 允许逗号分隔 ---
30
+ var dictOptionName = optionName || {
31
+ value: 'value',
32
+ label: 'label'
33
+ };
34
+ if (text != null && Array.isArray(dictOptions)) {
35
+ var result = [];
36
+ // 允许多个逗号分隔,允许传数组对象
37
+ var splitText;
38
+ if (Array.isArray(text)) {
39
+ splitText = text;
40
+ } else {
41
+ splitText = text.toString().trim().split(',');
42
+ }
43
+ var _iterator = _createForOfIteratorHelper(splitText),
44
+ _step;
45
+ try {
46
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
47
+ var txt = _step.value;
48
+ var dictText = txt;
49
+ var _iterator2 = _createForOfIteratorHelper(dictOptions),
50
+ _step2;
51
+ try {
52
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
53
+ var dictItem = _step2.value;
54
+ if (txt.toString() === dictItem[dictOptionName.value || 'value'].toString()) {
55
+ dictText = dictItem[dictOptionName.label || 'label'] || dictItem.text || dictItem.title;
56
+ break;
57
+ }
58
+ }
59
+ } catch (err) {
60
+ _iterator2.e(err);
61
+ } finally {
62
+ _iterator2.f();
63
+ }
64
+ result.push(dictText);
65
+ }
66
+ } catch (err) {
67
+ _iterator.e(err);
68
+ } finally {
69
+ _iterator.f();
70
+ }
71
+ return result.join(',');
72
+ }
73
+ return text;
74
+ // -- 字典翻译 text 允许逗号分隔 ---
75
+ }
76
+
77
+ /**
78
+ * 字典值替换文本通用方法(多选)
79
+ * @param {Array} dictOptions 字典数组
80
+ * @param {String, Array} text 字典值(多个可以用,隔开或者是数组格式)
81
+ * @param {Object} optionName 指定字段值(默认 { value: 'value', label: 'label' })
82
+ *
83
+ * @return String
84
+ */
85
+
86
+ export function filterMultiDictText(dictOptions, text) {
87
+ var optionName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
88
+ value: 'value',
89
+ label: 'label'
90
+ };
91
+ // js “!text” 认为0为空,所以做提前处理
92
+ var dictOptionName = optionName || {
93
+ value: 'value',
94
+ label: 'label'
95
+ };
96
+ if (text === 0 || text === '0') {
97
+ if (dictOptions) {
98
+ var _iterator3 = _createForOfIteratorHelper(dictOptions),
99
+ _step3;
100
+ try {
101
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
102
+ var dictItem = _step3.value;
103
+ if (text == dictItem[dictOptionName.value || 'value']) {
104
+ return dictItem[dictOptionName.label || 'label'] || dictItem.text || dictItem.title;
105
+ }
106
+ }
107
+ } catch (err) {
108
+ _iterator3.e(err);
109
+ } finally {
110
+ _iterator3.f();
111
+ }
112
+ }
113
+ }
114
+ if (!text || text == 'null' || !dictOptions || dictOptions.length == 0) {
115
+ return "";
116
+ }
117
+ var re = "";
118
+ text = text.toString();
119
+ var arr = text.split(",");
120
+ dictOptions.forEach(function (option) {
121
+ if (option) {
122
+ for (var i = 0; i < arr.length; i++) {
123
+ if (arr[i] === option[dictOptionName.value || 'value']) {
124
+ re += (option[dictOptionName.label || 'label'] || option.text || option.title) + ",";
125
+ break;
126
+ }
127
+ }
128
+ }
129
+ });
130
+ if (re == "") {
131
+ return text;
132
+ }
133
+ return re.substring(0, re.length - 1);
134
+ }
135
+
136
+ /**
137
+ * 转换数据字典value为整型
138
+ * @param {Array} dictOptions 字典数组
139
+ *
140
+ * @return Array
141
+ * */
142
+
143
+ export function transformDictValue(dictOptions) {
144
+ if (Array.isArray(dictOptions)) {
145
+ return dictOptions.map(function (option) {
146
+ return _objectSpread(_objectSpread({}, option), {}, {
147
+ value: Number(option.value)
148
+ });
149
+ });
150
+ } else {
151
+ return dictOptions;
152
+ }
153
+ }
@@ -1,90 +1,76 @@
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
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
8
-
9
- import _ from "lodash"; // 按钮方法
10
-
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
5
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
7
+ import _ from "lodash";
8
+ // 按钮方法
11
9
  var btnClickFunc = function btnClickFunc(fn) {
12
10
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
13
11
  if (!fn) return null;
14
12
  var paramsArr = [];
15
-
16
13
  if (_typeof(params) === 'object') {
17
14
  Object.keys(params).map(function (item) {
18
15
  paramsArr.push(params[item]);
19
16
  });
20
17
  }
21
-
22
18
  if (typeof fn === 'function') {
23
19
  return fn.apply(void 0, paramsArr); // 表格列返回的是方法
24
20
  }
25
21
 
26
22
  return fn;
27
- }; // 按钮是否禁用
28
-
29
-
23
+ };
24
+ // 按钮是否禁用
30
25
  var btnIsDisabled = function btnIsDisabled(isDisabled) {
31
26
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
32
27
  if (!isDisabled) return false;
33
28
  var paramsArr = [];
34
-
35
29
  if (_typeof(params) === 'object') {
36
30
  Object.keys(params).map(function (item) {
37
31
  paramsArr.push(params[item]);
38
32
  });
39
33
  }
40
-
41
34
  if (typeof isDisabled === 'function') {
42
35
  return isDisabled.apply(void 0, paramsArr); // 表格列返回的是方法
43
36
  }
44
37
 
45
38
  return isDisabled;
46
- }; // 按钮是否隐藏
47
-
48
-
39
+ };
40
+ // 按钮是否隐藏
49
41
  var btnIsHide = function btnIsHide(isHide) {
50
42
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
51
43
  if (!isHide) return false;
52
44
  var paramsArr = [];
53
-
54
45
  if (_typeof(params) === 'object') {
55
46
  Object.keys(params).map(function (item) {
56
47
  paramsArr.push(params[item]);
57
48
  });
58
49
  }
59
-
60
50
  if (typeof isHide === 'function') {
61
51
  return isHide.apply(void 0, paramsArr); // 表格列返回的是方法
62
52
  }
63
53
 
64
54
  return isHide;
65
- }; // 重新组合数据(排除不包含在permissionCodes内及isHide数据
66
-
67
-
55
+ };
56
+ // 重新组合数据(排除不包含在permissionCodes内及isHide数据
68
57
  var removeNoPermission = function removeNoPermission(array, permissionCodes, codes, params) {
69
58
  return Array.isArray(array) && array.filter(function (item) {
70
59
  if (item.children) {
71
60
  item.children = removeNoPermission(item.children, permissionCodes, codes, params);
72
61
  if (item.children.length === 0) return false; // 如果子集合过滤为空时,不返当前数据
73
- } // permissionCodes未定义,则直接返回不进行过滤
74
-
75
-
62
+ }
63
+ // permissionCodes未定义,则直接返回不进行过滤
76
64
  if (item.hasOwnProperty('code') && permissionCodes) {
77
65
  // if (!permissionCodes) return true // permissionCodes未定义,则直接返回不进行过滤
78
66
  // 判断是否包含 'code'字段,如果包含则先过滤有在 permissionCodes内的(permissionCodes数组为0时,也不返回数据)
79
67
  // 并用是不隐藏的条件
80
68
  return permissionCodes.length !== 0 && permissionCodes.includes(item.code) && !btnIsHide(item.isHide, params);
81
69
  }
82
-
83
70
  if (item.hasOwnProperty('isHide')) {
84
71
  // 判断是否包含 'isHide'字段,如果包含则先过滤 isHide 为false
85
72
  return !btnIsHide(item.isHide, params);
86
73
  }
87
-
88
74
  return true;
89
75
  }).map(function (resultItem) {
90
76
  // 与codes进行对比,相应的 code匹配以对应的name,icon,code返回
@@ -93,19 +79,15 @@ var removeNoPermission = function removeNoPermission(array, permissionCodes, cod
93
79
  var matchIndex = _.findIndex(codes, function (btnItem) {
94
80
  return btnItem.code === resultItem.code;
95
81
  });
96
-
97
82
  if (matchIndex !== -1) {
98
83
  var _codes$matchIndex;
99
-
100
84
  // 如果有配置code,则使用func.code.js里面配置的名称
101
85
  resultItem = _objectSpread(_objectSpread(_objectSpread({}, resultItem), codes[matchIndex]), {}, {
102
86
  icon: resultItem.icon || ((_codes$matchIndex = codes[matchIndex]) === null || _codes$matchIndex === void 0 ? void 0 : _codes$matchIndex.icon)
103
87
  });
104
88
  }
105
89
  }
106
-
107
90
  return resultItem;
108
91
  });
109
92
  };
110
-
111
93
  export { removeNoPermission, btnIsHide, btnIsDisabled, btnClickFunc };