fan-standard-comp 3.1.4 → 3.1.6

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 (244) hide show
  1. package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +173 -0
  2. package/dist/fan-standard-comp.umd.js +597 -0
  3. package/dist/fonts/iconfont.eot +0 -0
  4. package/dist/fonts/iconfont.ttf +0 -0
  5. package/dist/fonts/iconfont.woff +0 -0
  6. package/es/ButtonGroup/ButtonList.d.ts +2 -0
  7. package/es/ButtonGroup/ButtonList.js +37 -0
  8. package/es/ButtonGroup/ButtonMenu.d.ts +2 -0
  9. package/es/ButtonGroup/ButtonMenu.js +38 -0
  10. package/es/ButtonGroup/PopConfirmTitle.d.ts +9 -0
  11. package/es/ButtonGroup/PopConfirmTitle.js +37 -0
  12. package/es/ButtonGroup/index.d.ts +30 -0
  13. package/es/ButtonGroup/index.js +374 -0
  14. package/es/ButtonGroup/style/index.less +36 -0
  15. package/es/DragContent/DragBar.js +21 -0
  16. package/es/DragContent/index.d.ts +14 -0
  17. package/es/DragContent/index.js +173 -0
  18. package/es/DragContent/index.less +44 -0
  19. package/es/FormComp/ChunkUploader/api.js +76 -0
  20. package/es/FormComp/ChunkUploader/index.js +391 -0
  21. package/es/FormComp/ChunkUploader/lib.js +96 -0
  22. package/es/FormComp/ChunkUploader/style/style.less +3 -0
  23. package/es/FormComp/ChunkUploader/upload-queue.class.js +167 -0
  24. package/es/FormComp/ChunkUploader/worker.js +23 -0
  25. package/es/FormComp/EditButton/index.d.ts +26 -0
  26. package/es/FormComp/EditButton/index.js +140 -0
  27. package/es/FormComp/FieldComponent/ReUpload.d.ts +3 -0
  28. package/es/FormComp/FieldComponent/ReUpload.js +131 -0
  29. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +251 -0
  30. package/es/FormComp/FieldComponent/TitleNode.d.ts +6 -0
  31. package/es/FormComp/FieldComponent/TitleNode.js +9 -0
  32. package/es/FormComp/FieldComponent/index.d.ts +38 -0
  33. package/es/FormComp/FieldComponent/index.js +413 -0
  34. package/es/FormComp/FieldComponent/setReadonlyValues.js +236 -0
  35. package/es/FormComp/FieldComponent/style/index.less +120 -0
  36. package/es/FormComp/RenderItemGroup/index.d.ts +37 -0
  37. package/es/FormComp/RenderItemGroup/index.js +234 -0
  38. package/es/FormComp/Uploader/index.d.ts +21 -0
  39. package/es/FormComp/Uploader/index.js +277 -0
  40. package/es/FormComp/Uploader/style/index.less +14 -0
  41. package/es/FormComp/Uploader/util.d.ts +8 -0
  42. package/es/FormComp/Uploader/util.js +38 -0
  43. package/es/FormComp/VarTemplate/index.js +293 -0
  44. package/es/FormComp/index.d.ts +1 -0
  45. package/es/FormComp/index.js +1 -0
  46. package/es/NavLeafScroll/index.js +379 -0
  47. package/es/NavLeafScroll/style/index.less +119 -0
  48. package/es/RefactorTree/data.d.ts +7 -0
  49. package/es/RefactorTree/index.d.ts +40 -0
  50. package/es/RefactorTree/index.js +167 -0
  51. package/es/RefactorTree/indexTreeNode.d.ts +39 -0
  52. package/es/RefactorTree/indexTreeNode.js +237 -0
  53. package/es/RefactorTree/style/index.d.ts +1 -0
  54. package/es/RefactorTree/style/index.js +1 -0
  55. package/es/RefactorTree/style/index.less +22 -0
  56. package/es/RefactorTree/util.d.ts +42 -0
  57. package/es/RefactorTree/util.js +187 -0
  58. package/es/SpecIcon/fonts/demo.css +539 -0
  59. package/es/SpecIcon/fonts/demo_index.html +1315 -0
  60. package/es/SpecIcon/fonts/iconfont.css +211 -0
  61. package/es/SpecIcon/fonts/iconfont.eot +0 -0
  62. package/es/SpecIcon/fonts/iconfont.js +41 -0
  63. package/es/SpecIcon/fonts/iconfont.json +352 -0
  64. package/es/SpecIcon/fonts/iconfont.svg +173 -0
  65. package/es/SpecIcon/fonts/iconfont.ttf +0 -0
  66. package/es/SpecIcon/fonts/iconfont.woff +0 -0
  67. package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
  68. package/es/SpecIcon/index.d.ts +17 -0
  69. package/es/SpecIcon/index.js +77 -0
  70. package/es/SpecIcon/style/iconfont.less +213 -0
  71. package/es/SpecIcon/style/index.less +98 -0
  72. package/es/SplitterLayout/Pane.d.ts +13 -0
  73. package/es/SplitterLayout/Pane.js +36 -0
  74. package/es/SplitterLayout/index.js +375 -0
  75. package/es/SplitterLayout/index.less +58 -0
  76. package/es/StandardContent/SplitterLayout/Pane.js +50 -0
  77. package/es/StandardContent/SplitterLayout/index.js +374 -0
  78. package/es/StandardContent/SplitterLayout/index.less +58 -0
  79. package/es/StandardContent/SubfieldContent.d.ts +17 -0
  80. package/es/StandardContent/SubfieldContent.js +41 -0
  81. package/es/StandardContent/WrapperContent.d.ts +13 -0
  82. package/es/StandardContent/WrapperContent.js +29 -0
  83. package/es/StandardContent/data.d.ts +101 -0
  84. package/es/StandardContent/style/index.less +80 -0
  85. package/es/StandardDragModal/index.d.ts +11 -0
  86. package/es/StandardDragModal/index.js +30 -0
  87. package/es/StandardFilter/index.d.ts +35 -0
  88. package/es/StandardFilter/index.js +253 -0
  89. package/es/StandardFilter/style/index.less +62 -0
  90. package/es/StandardForm/ActionList.js +44 -0
  91. package/es/StandardForm/StepForm.d.ts +19 -0
  92. package/es/StandardForm/StepForm.js +267 -0
  93. package/es/StandardForm/TabForm.d.ts +19 -0
  94. package/es/StandardForm/TabForm.js +122 -0
  95. package/es/StandardForm/index.d.ts +32 -0
  96. package/es/StandardForm/index.js +170 -0
  97. package/es/StandardForm/style/index.less +58 -0
  98. package/es/StandardModal/UpdateFormRef.js +18 -0
  99. package/es/StandardModal/index.d.ts +44 -0
  100. package/es/StandardModal/index.js +495 -0
  101. package/es/StandardModal/style/index.less +50 -0
  102. package/es/StandardPanel/index.d.ts +28 -0
  103. package/es/StandardPanel/index.js +134 -0
  104. package/es/StandardPanel/style/index.less +135 -0
  105. package/es/StandardTable/index.d.ts +22 -0
  106. package/es/StandardTable/index.js +126 -0
  107. package/es/StandardTable/style/index.d.ts +1 -0
  108. package/es/StandardTable/style/index.js +1 -0
  109. package/es/StandardTable/style/index.less +206 -0
  110. package/es/components/IconNode/index.d.ts +16 -0
  111. package/es/components/IconNode/index.js +28 -0
  112. package/es/components/index.d.ts +2 -0
  113. package/es/components/index.js +2 -0
  114. package/es/data/func.code.js +112 -0
  115. package/es/data/general.config.js +172 -0
  116. package/es/data/index.js +3 -0
  117. package/es/index.d.ts +24 -0
  118. package/es/index.js +31 -0
  119. package/es/styles/index.less +0 -0
  120. package/es/theme/spec-variable.less +48 -0
  121. package/es/utils/ValueFormat.js +50 -0
  122. package/es/utils/filterPermission.js +111 -0
  123. package/es/utils/getParentNodes.js +215 -0
  124. package/es/utils/index.js +3 -0
  125. package/lib/ButtonGroup/ButtonList.d.ts +2 -0
  126. package/lib/ButtonGroup/ButtonList.js +55 -0
  127. package/lib/ButtonGroup/ButtonMenu.d.ts +2 -0
  128. package/lib/ButtonGroup/ButtonMenu.js +51 -0
  129. package/lib/ButtonGroup/PopConfirmTitle.d.ts +9 -0
  130. package/lib/ButtonGroup/PopConfirmTitle.js +48 -0
  131. package/lib/ButtonGroup/index.d.ts +30 -0
  132. package/lib/ButtonGroup/index.js +405 -0
  133. package/lib/ButtonGroup/style/index.less +36 -0
  134. package/lib/DragContent/DragBar.js +33 -0
  135. package/lib/DragContent/index.d.ts +14 -0
  136. package/lib/DragContent/index.js +191 -0
  137. package/lib/DragContent/index.less +44 -0
  138. package/lib/FormComp/ChunkUploader/api.js +89 -0
  139. package/lib/FormComp/ChunkUploader/index.js +410 -0
  140. package/lib/FormComp/ChunkUploader/lib.js +113 -0
  141. package/lib/FormComp/ChunkUploader/style/style.less +3 -0
  142. package/lib/FormComp/ChunkUploader/upload-queue.class.js +174 -0
  143. package/lib/FormComp/ChunkUploader/worker.js +28 -0
  144. package/lib/FormComp/EditButton/index.d.ts +26 -0
  145. package/lib/FormComp/EditButton/index.js +159 -0
  146. package/lib/FormComp/FieldComponent/ReUpload.d.ts +3 -0
  147. package/lib/FormComp/FieldComponent/ReUpload.js +151 -0
  148. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +274 -0
  149. package/lib/FormComp/FieldComponent/TitleNode.d.ts +6 -0
  150. package/lib/FormComp/FieldComponent/TitleNode.js +19 -0
  151. package/lib/FormComp/FieldComponent/index.d.ts +38 -0
  152. package/lib/FormComp/FieldComponent/index.js +457 -0
  153. package/lib/FormComp/FieldComponent/setReadonlyValues.js +263 -0
  154. package/lib/FormComp/FieldComponent/style/index.less +120 -0
  155. package/lib/FormComp/RenderItemGroup/index.d.ts +37 -0
  156. package/lib/FormComp/RenderItemGroup/index.js +255 -0
  157. package/lib/FormComp/Uploader/index.d.ts +21 -0
  158. package/lib/FormComp/Uploader/index.js +303 -0
  159. package/lib/FormComp/Uploader/style/index.less +14 -0
  160. package/lib/FormComp/Uploader/util.d.ts +8 -0
  161. package/lib/FormComp/Uploader/util.js +47 -0
  162. package/lib/FormComp/VarTemplate/index.js +308 -0
  163. package/lib/FormComp/index.d.ts +1 -0
  164. package/lib/FormComp/index.js +15 -0
  165. package/lib/NavLeafScroll/index.js +397 -0
  166. package/lib/NavLeafScroll/style/index.less +119 -0
  167. package/lib/RefactorTree/data.d.ts +7 -0
  168. package/lib/RefactorTree/index.d.ts +40 -0
  169. package/lib/RefactorTree/index.js +190 -0
  170. package/lib/RefactorTree/indexTreeNode.d.ts +39 -0
  171. package/lib/RefactorTree/indexTreeNode.js +260 -0
  172. package/lib/RefactorTree/style/index.d.ts +1 -0
  173. package/lib/RefactorTree/style/index.js +3 -0
  174. package/lib/RefactorTree/style/index.less +22 -0
  175. package/lib/RefactorTree/util.d.ts +42 -0
  176. package/lib/RefactorTree/util.js +195 -0
  177. package/lib/SpecIcon/fonts/demo.css +539 -0
  178. package/lib/SpecIcon/fonts/demo_index.html +1315 -0
  179. package/lib/SpecIcon/fonts/iconfont.css +211 -0
  180. package/lib/SpecIcon/fonts/iconfont.eot +0 -0
  181. package/lib/SpecIcon/fonts/iconfont.js +43 -0
  182. package/lib/SpecIcon/fonts/iconfont.json +352 -0
  183. package/lib/SpecIcon/fonts/iconfont.svg +173 -0
  184. package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
  185. package/lib/SpecIcon/fonts/iconfont.woff +0 -0
  186. package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
  187. package/lib/SpecIcon/index.d.ts +17 -0
  188. package/lib/SpecIcon/index.js +90 -0
  189. package/lib/SpecIcon/style/iconfont.less +213 -0
  190. package/lib/SpecIcon/style/index.less +98 -0
  191. package/lib/SplitterLayout/Pane.d.ts +13 -0
  192. package/lib/SplitterLayout/Pane.js +48 -0
  193. package/lib/SplitterLayout/index.js +386 -0
  194. package/lib/SplitterLayout/index.less +58 -0
  195. package/lib/StandardContent/SplitterLayout/Pane.js +62 -0
  196. package/lib/StandardContent/SplitterLayout/index.js +387 -0
  197. package/lib/StandardContent/SplitterLayout/index.less +58 -0
  198. package/lib/StandardContent/SubfieldContent.d.ts +17 -0
  199. package/lib/StandardContent/SubfieldContent.js +56 -0
  200. package/lib/StandardContent/WrapperContent.d.ts +13 -0
  201. package/lib/StandardContent/WrapperContent.js +43 -0
  202. package/lib/StandardContent/data.d.ts +101 -0
  203. package/lib/StandardContent/style/index.less +80 -0
  204. package/lib/StandardDragModal/index.d.ts +11 -0
  205. package/lib/StandardDragModal/index.js +43 -0
  206. package/lib/StandardFilter/index.d.ts +35 -0
  207. package/lib/StandardFilter/index.js +272 -0
  208. package/lib/StandardFilter/style/index.less +62 -0
  209. package/lib/StandardForm/ActionList.js +57 -0
  210. package/lib/StandardForm/StepForm.d.ts +19 -0
  211. package/lib/StandardForm/StepForm.js +295 -0
  212. package/lib/StandardForm/TabForm.d.ts +19 -0
  213. package/lib/StandardForm/TabForm.js +148 -0
  214. package/lib/StandardForm/index.d.ts +32 -0
  215. package/lib/StandardForm/index.js +197 -0
  216. package/lib/StandardForm/style/index.less +58 -0
  217. package/lib/StandardModal/UpdateFormRef.js +32 -0
  218. package/lib/StandardModal/index.d.ts +44 -0
  219. package/lib/StandardModal/index.js +525 -0
  220. package/lib/StandardModal/style/index.less +50 -0
  221. package/lib/StandardPanel/index.d.ts +28 -0
  222. package/lib/StandardPanel/index.js +155 -0
  223. package/lib/StandardPanel/style/index.less +135 -0
  224. package/lib/StandardTable/index.d.ts +22 -0
  225. package/lib/StandardTable/index.js +143 -0
  226. package/lib/StandardTable/style/index.d.ts +1 -0
  227. package/lib/StandardTable/style/index.js +3 -0
  228. package/lib/StandardTable/style/index.less +206 -0
  229. package/lib/components/IconNode/index.d.ts +16 -0
  230. package/lib/components/IconNode/index.js +39 -0
  231. package/lib/components/index.d.ts +2 -0
  232. package/lib/components/index.js +15 -0
  233. package/lib/data/func.code.js +119 -0
  234. package/lib/data/general.config.js +179 -0
  235. package/lib/data/index.js +23 -0
  236. package/lib/index.d.ts +24 -0
  237. package/lib/index.js +236 -0
  238. package/lib/styles/index.less +0 -0
  239. package/lib/theme/spec-variable.less +48 -0
  240. package/lib/utils/ValueFormat.js +58 -0
  241. package/lib/utils/filterPermission.js +127 -0
  242. package/lib/utils/getParentNodes.js +226 -0
  243. package/lib/utils/index.js +35 -0
  244. package/package.json +1 -1
@@ -0,0 +1,525 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ require("antd/es/modal/style");
9
+
10
+ var _modal = _interopRequireDefault(require("antd/es/modal"));
11
+
12
+ require("antd/es/row/style");
13
+
14
+ var _row = _interopRequireDefault(require("antd/es/row"));
15
+
16
+ require("antd/es/button/style");
17
+
18
+ var _button = _interopRequireDefault(require("antd/es/button"));
19
+
20
+ require("antd/es/form/style");
21
+
22
+ var _form = _interopRequireDefault(require("antd/es/form"));
23
+
24
+ var _tslib = require("tslib");
25
+
26
+ var _react = _interopRequireWildcard(require("react"));
27
+
28
+ var _data = require("../data");
29
+
30
+ var _RenderItemGroup = _interopRequireDefault(require("../FormComp/RenderItemGroup"));
31
+
32
+ var _ValueFormat = _interopRequireDefault(require("../utils/ValueFormat.js"));
33
+
34
+ var _IconNode = _interopRequireDefault(require("../components/IconNode"));
35
+
36
+ var _TabForm = _interopRequireDefault(require("../StandardForm/TabForm"));
37
+
38
+ var _StepForm = _interopRequireDefault(require("../StandardForm/StepForm"));
39
+
40
+ var _ActionList = _interopRequireDefault(require("../StandardForm/ActionList.js"));
41
+
42
+ require("./style/index.less");
43
+
44
+ var _antDesignDraggableModal = require("ant-design-draggable-modal");
45
+
46
+ require("ant-design-draggable-modal/dist/index.css");
47
+
48
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
49
+
50
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
51
+
52
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
53
+
54
+ 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); }
55
+
56
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
57
+
58
+ 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
+
60
+ 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); }
61
+
62
+ 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; }
63
+
64
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
65
+
66
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
67
+
68
+ var StandardModal = function StandardModal(props) {
69
+ var children = props.children,
70
+ className = props.className,
71
+ style = props.style,
72
+ _props$size = props.size,
73
+ size = _props$size === void 0 ? 'md' : _props$size,
74
+ type = props.type,
75
+ formItemGroup = props.formItemGroup,
76
+ title = props.title,
77
+ visible = props.visible,
78
+ formPrefix = props.formPrefix,
79
+ formPostfix = props.formPostfix,
80
+ initialValues = props.initialValues,
81
+ hideRequiredMark = props.hideRequiredMark,
82
+ bodyStyle = props.bodyStyle,
83
+ footer = props.footer,
84
+ footerButtonGroup = props.footerButtonGroup,
85
+ hideFooter = props.hideFooter,
86
+ _getFormFields = props.getFormFields,
87
+ _props$fieldStatus = props.fieldStatus,
88
+ fieldStatus = _props$fieldStatus === void 0 ? 'default' : _props$fieldStatus,
89
+ _props$formLayout = props.formLayout,
90
+ formLayout = _props$formLayout === void 0 ? 'horizontal' : _props$formLayout,
91
+ tabsConfig = props.tabsConfig,
92
+ stepsConfig = props.stepsConfig,
93
+ displayLayout = props.displayLayout,
94
+ _props$dragAble = props.dragAble,
95
+ dragAble = _props$dragAble === void 0 ? false : _props$dragAble,
96
+ otherProps = (0, _tslib.__rest)(props, ["children", "className", "style", "size", "type", "formItemGroup", "title", "visible", "formPrefix", "formPostfix", "initialValues", "hideRequiredMark", "bodyStyle", "footer", "footerButtonGroup", "hideFooter", "getFormFields", "fieldStatus", "formLayout", "tabsConfig", "stepsConfig", "displayLayout", "dragAble"]);
97
+
98
+ var _Form$useForm = _form.default.useForm(),
99
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
100
+ modalForm = _Form$useForm2[0];
101
+
102
+ var _useState = (0, _react.useState)(),
103
+ _useState2 = _slicedToArray(_useState, 2),
104
+ modalFormRef = _useState2[0],
105
+ setModalFormRef = _useState2[1]; // <---- set the ref when Form Rendered
106
+
107
+
108
+ var _useState3 = (0, _react.useState)(0),
109
+ _useState4 = _slicedToArray(_useState3, 2),
110
+ bodyMaxHeight = _useState4[0],
111
+ setBodyMaxHeight = _useState4[1]; // setTabFormChild
112
+
113
+
114
+ var _useState5 = (0, _react.useState)(),
115
+ _useState6 = _slicedToArray(_useState5, 2),
116
+ formChild = _useState6[0],
117
+ setFormChild = _useState6[1]; // <---- set the ref when Form Rendered
118
+ // 按钮栏是否有显示(默认显示)
119
+
120
+
121
+ var hasFooterBar = (0, _react.useMemo)(function () {
122
+ var _a, _b, _c, _d, _e;
123
+
124
+ var openLog = false;
125
+
126
+ if (type === 'tabForm' || type === 'stepForm') {
127
+ if (type === 'tabForm') {
128
+ var activeTabInfo = formItemGroup.find(function (fItem) {
129
+ return fItem.key === (tabsConfig === null || tabsConfig === void 0 ? void 0 : tabsConfig.activeKey);
130
+ });
131
+ openLog && console.log('rule 0-1', ((_a = activeTabInfo === null || activeTabInfo === void 0 ? void 0 : activeTabInfo.actions) === null || _a === void 0 ? void 0 : _a.length) > 0);
132
+ return ((_b = activeTabInfo === null || activeTabInfo === void 0 ? void 0 : activeTabInfo.actions) === null || _b === void 0 ? void 0 : _b.length) > 0;
133
+ }
134
+
135
+ if (type === 'stepForm') {
136
+ var currentStepInfo = formItemGroup[stepsConfig.current];
137
+ openLog && console.log('rule 0-2', ((_c = currentStepInfo === null || currentStepInfo === void 0 ? void 0 : currentStepInfo.actions) === null || _c === void 0 ? void 0 : _c.length) > 0);
138
+ return ((_d = currentStepInfo === null || currentStepInfo === void 0 ? void 0 : currentStepInfo.actions) === null || _d === void 0 ? void 0 : _d.length) > 0;
139
+ }
140
+
141
+ return true;
142
+ } else {
143
+ if (hideFooter) {
144
+ openLog && console.log('rule 1');
145
+ return false;
146
+ }
147
+
148
+ if (fieldStatus && fieldStatus !== 'default') {
149
+ openLog && console.log('rule 2');
150
+ return false;
151
+ }
152
+
153
+ if (props.hasOwnProperty('footerButtonGroup') && footerButtonGroup) {
154
+ if (Array.isArray(footerButtonGroup) && footerButtonGroup.length === 0) {
155
+ openLog && console.log('rule 4'); // 返回为空数组不占用按钮栏
156
+
157
+ return false;
158
+ } else if (typeof footerButtonGroup === 'function' && (!footerButtonGroup() || ((_e = footerButtonGroup()) === null || _e === void 0 ? void 0 : _e.length) === 0)) {
159
+ openLog && console.log('rule 5'); // 配置类型为Function且返回值为null或者返回数组长度为0时,不显示按钮栏
160
+
161
+ return false;
162
+ }
163
+
164
+ openLog && console.log('rule 3');
165
+ return true;
166
+ } else if (footerButtonGroup === false) {
167
+ openLog && console.log('rule 7'); // 显示
168
+
169
+ return true;
170
+ }
171
+
172
+ if (props.hasOwnProperty('footer') && !footer) {
173
+ openLog && console.log('rule 8');
174
+ return false;
175
+ }
176
+
177
+ openLog && console.log('rule 9');
178
+ return true;
179
+ }
180
+ }, [fieldStatus, hideFooter, footer, footerButtonGroup, type, tabsConfig, stepsConfig, formItemGroup]); // 设置限制弹窗高度
181
+
182
+ var initBodyMaxHeight = function initBodyMaxHeight() {
183
+ var title = props.title;
184
+ var bodyHeight = document.body.offsetHeight;
185
+ var baseReduce = 150 + 32; // 默认需要减去的高度(上下空白间距150及内部内容间距16*2
186
+ // console.log('弹窗是否有按钮:', hasFooterBar ? '是' : '否')
187
+
188
+ setBodyMaxHeight("".concat(bodyHeight - (title ? 55 : 0) - (hasFooterBar ? 55 : 0) - baseReduce, "px")); // setBodyMaxHeight(`${bodyHeight - (title ? 55 : 0) - ((footer || footerButtonGroup) ? 55 : 0) - baseReduce +
189
+ // ((fieldStatus && fieldStatus !== 'default' && !footerButtonGroup) || hideFooter ? 55 : 0)}px`)
190
+ }; // fill Form when modal open 此处可解决获取 Form.useForm warning
191
+
192
+
193
+ (0, _react.useEffect)(function () {
194
+ if (visible && modalFormRef) {
195
+ // <---- check ref before use the form instance
196
+ if (initialValues && _typeof(initialValues) === 'object') {
197
+ initialValues && modalForm.setFieldsValue(Object.assign({}, initialValues));
198
+ forceUpdateForm();
199
+ }
200
+ } // if (!visible && modalFormRef) {
201
+ // clearAllFieldsValue() // 清空表单传参数
202
+ // }
203
+
204
+ }, [modalFormRef, visible]);
205
+ (0, _react.useEffect)(function () {
206
+ if (visible) {
207
+ initBodyMaxHeight(); // 让resize事件触发 initBodyMaxHeight
208
+
209
+ window.addEventListener('resize', initBodyMaxHeight);
210
+ } else {
211
+ window.removeEventListener('resize', initBodyMaxHeight);
212
+ }
213
+ }, [fieldStatus, title, visible, hideFooter, footer, footerButtonGroup]);
214
+
215
+ var handleSubmit = function handleSubmit() {
216
+ var type = props.type,
217
+ formItemGroup = props.formItemGroup,
218
+ onSubmit = props.onSubmit;
219
+
220
+ if (type === 'form') {
221
+ modalForm.validateFields().then(function (values) {
222
+ if (Object.prototype.hasOwnProperty.call(values, 'false')) {
223
+ delete values.false; // 自定义结构会莫名的出来一个false字段
224
+ }
225
+
226
+ var resultValues = (0, _ValueFormat.default)(values, formItemGroup);
227
+
228
+ if (onSubmit) {
229
+ onSubmit(Object.assign({}, resultValues));
230
+ }
231
+ }).catch(function () {
232
+ // 定位到第一条表单异常的
233
+ var errorCollection = Array.prototype.slice.call(document.getElementsByClassName('ant-form-item-has-error'));
234
+
235
+ if (errorCollection[0] && errorCollection[0].getElementsByTagName('input')) {
236
+ Array.prototype.slice.call(errorCollection[0].getElementsByTagName('input'))[0].focus();
237
+ } // console.error('表单填写有误', errorInfo, '第一条数据',errorInfo.errorFields[0].name[0])
238
+
239
+ });
240
+ } else if (type === 'stepForm' || type === 'tabForm') {
241
+ // onSubmit && onSubmit()
242
+ formChild.validateFields().then(function (values) {
243
+ // console.log(values)
244
+ if (Object.prototype.hasOwnProperty.call(values, 'false')) {
245
+ delete values.false; // 自定义结构会莫名的出来一个false字段
246
+ }
247
+
248
+ var resultValues = (0, _ValueFormat.default)(values, formItemGroup);
249
+
250
+ if (onSubmit) {
251
+ onSubmit(Object.assign({}, resultValues));
252
+ }
253
+ }).catch(function () {
254
+ // 定位到第一条表单异常的
255
+ var errorCollection = Array.prototype.slice.call(document.getElementsByClassName('ant-form-item-has-error'));
256
+
257
+ if (errorCollection[0] && errorCollection[0].getElementsByTagName('input')) {
258
+ Array.prototype.slice.call(errorCollection[0].getElementsByTagName('input'))[0].focus();
259
+ } // console.error('表单填写有误', errorInfo, '第一条数据',errorInfo.errorFields[0].name[0])
260
+
261
+ });
262
+ } else {
263
+ // 没有表单数组 formItemGroup 配置
264
+ onSubmit && onSubmit();
265
+ }
266
+ }; // 重置所有表单
267
+
268
+
269
+ var clearAllFieldsValue = function clearAllFieldsValue() {
270
+ // let allFields = {}
271
+ // Object.keys(modalForm.getFieldsValue()).map((item) => allFields[item] = undefined)
272
+ // modalForm.setFieldsValue(allFields) // 直接清空表单的赋值(initialValues传值如果没有前后赋值没有全部带上所有字段,则会默认又使用之前的部分未传参字段)
273
+ modalForm.resetFields(); // 直接使用这个无效
274
+ };
275
+
276
+ var onAfterClose = function onAfterClose() {
277
+ var afterClose = props.afterClose;
278
+ if (type === 'form') clearAllFieldsValue();
279
+ if (afterClose) afterClose();
280
+ };
281
+
282
+ var handleCancel = function handleCancel() {
283
+ var onCancel = props.onCancel;
284
+ if (onCancel) onCancel();
285
+ }; // 强制更新表单值,用于赋初始化实例值
286
+
287
+
288
+ var forceUpdateForm = function forceUpdateForm() {
289
+ _getFormFields && _getFormFields(modalForm.getFieldsValue() || {}, modalForm);
290
+ };
291
+
292
+ var renderFormItemGroup = function renderFormItemGroup() {
293
+ var fieldStatus = props.fieldStatus,
294
+ formItemGroup = props.formItemGroup,
295
+ _props$size2 = props.size,
296
+ size = _props$size2 === void 0 ? 'md' : _props$size2;
297
+
298
+ if (Array.isArray(formItemGroup)) {
299
+ return /*#__PURE__*/_react.default.createElement(_RenderItemGroup.default, {
300
+ size: size,
301
+ layout: formLayout,
302
+ doUpdateFormFields: function doUpdateFormFields() {
303
+ return forceUpdateForm();
304
+ },
305
+ displayLayout: displayLayout,
306
+ itemGroup: formItemGroup,
307
+ fieldStatus: fieldStatus,
308
+ form: modalForm
309
+ });
310
+ }
311
+
312
+ return formItemGroup;
313
+ };
314
+
315
+ var handleStepType = function handleStepType(type, extraFunc) {
316
+ var current = stepsConfig.current;
317
+
318
+ switch (type) {
319
+ case 'submit':
320
+ case 'next':
321
+ // 获取当前步骤的表单配置下有 rules 的控件进行校验(自定义的控件则自己有业务层面处理添加校验)
322
+ // console.log('执行下一步骤,需要优先进行校验')
323
+ var currentFields = formItemGroup[current].fields;
324
+ var validatorGroup = currentFields && Array.isArray(currentFields) ? currentFields.map(function (fItem) {
325
+ return fItem.rules ? fItem.filedName : null;
326
+ }) : [];
327
+ formChild.validateFields(validatorGroup).then(function () {
328
+ // if (stepClick) stepClick(type, formChild, values);
329
+ extraFunc();
330
+ }).catch(function () {// console.log('表单校验不通过 ', errorFields.map(err => err))
331
+ });
332
+ break;
333
+
334
+ case 'prev':
335
+ // if (stepClick) stepClick(type, formChild);
336
+ extraFunc();
337
+ break;
338
+
339
+ case 'cancel':
340
+ // if (stepClick) stepClick(type, formChild);
341
+ extraFunc();
342
+ break;
343
+
344
+ default:
345
+ // extraFunc()
346
+ break;
347
+ }
348
+ };
349
+
350
+ var renderButtonGroup = function renderButtonGroup() {
351
+ var footerButtonGroup = props.footerButtonGroup,
352
+ confirmLoading = props.confirmLoading,
353
+ cancelText = props.cancelText,
354
+ confirmText = props.confirmText,
355
+ okText = props.okText,
356
+ okButtonProps = props.okButtonProps,
357
+ confirmButtonProps = props.confirmButtonProps,
358
+ cancelButtonProps = props.cancelButtonProps;
359
+
360
+ if (footerButtonGroup) {
361
+ if (Array.isArray(footerButtonGroup)) {
362
+ if (footerButtonGroup.length === 0) return null; // <div>按钮组合配置为空</div>
363
+
364
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, footerButtonGroup.map(function (item) {
365
+ if (_typeof(item) === 'object') {
366
+ if (item.isHide) return null;
367
+ var name = item.name,
368
+ _type = item.type,
369
+ icon = item.icon,
370
+ ghost = item.ghost,
371
+ disabled = item.disabled,
372
+ loading = item.loading,
373
+ fn = item.fn,
374
+ others = (0, _tslib.__rest)(item, ["name", "type", "icon", "ghost", "disabled", "loading", "fn"]);
375
+ return /*#__PURE__*/_react.default.createElement(_button.default, Object.assign({
376
+ key: name,
377
+ type: _type || 'primary',
378
+ icon: /*#__PURE__*/_react.default.createElement(_IconNode.default, {
379
+ icon: icon
380
+ }),
381
+ ghost: ghost,
382
+ disabled: disabled,
383
+ loading: loading,
384
+ onClick: fn ? function (e) {
385
+ return fn(item, modalForm, props, e);
386
+ } : null
387
+ }, others), name);
388
+ } else {
389
+ return item; // 如果是DOM,则直接渲染
390
+ }
391
+ }));
392
+ }
393
+
394
+ if (typeof footerButtonGroup === 'function') {
395
+ return footerButtonGroup(modalForm, props);
396
+ }
397
+
398
+ return footerButtonGroup;
399
+ }
400
+
401
+ if (footer) return footer;
402
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_button.default, Object.assign({
403
+ key: "submit",
404
+ type: "primary",
405
+ loading: confirmLoading,
406
+ onClick: handleSubmit
407
+ }, confirmButtonProps, okButtonProps), confirmText || okText || '确定'), /*#__PURE__*/_react.default.createElement(_button.default, Object.assign({
408
+ key: "back",
409
+ onClick: handleCancel
410
+ }, cancelButtonProps), cancelText || '取消'));
411
+ };
412
+
413
+ var renderFooter = function renderFooter() {
414
+ var _a, _b;
415
+
416
+ if (type === 'stepForm') {
417
+ var currentStepInfo = formItemGroup[stepsConfig.current];
418
+ return ((_a = currentStepInfo === null || currentStepInfo === void 0 ? void 0 : currentStepInfo.actions) === null || _a === void 0 ? void 0 : _a.length) > 0 ? /*#__PURE__*/_react.default.createElement(_ActionList.default, {
419
+ list: currentStepInfo.actions || [],
420
+ onStep: handleStepType,
421
+ form: formChild,
422
+ other: props
423
+ }) : null;
424
+ }
425
+
426
+ if (type === 'tabForm') {
427
+ var activeTabInfo = formItemGroup.find(function (fItem) {
428
+ return fItem.key === (tabsConfig === null || tabsConfig === void 0 ? void 0 : tabsConfig.activeKey);
429
+ });
430
+ return ((_b = activeTabInfo === null || activeTabInfo === void 0 ? void 0 : activeTabInfo.actions) === null || _b === void 0 ? void 0 : _b.length) > 0 ? /*#__PURE__*/_react.default.createElement(_ActionList.default, {
431
+ list: activeTabInfo.actions || [],
432
+ form: formChild,
433
+ other: props
434
+ }) : null;
435
+ }
436
+
437
+ return hasFooterBar ? renderButtonGroup() : null;
438
+ }; // 内容渲染
439
+
440
+
441
+ var renderChildrenNodes = function renderChildrenNodes() {
442
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children, type === 'form' && /*#__PURE__*/_react.default.createElement(_form.default, {
443
+ layout: formLayout,
444
+ ref: setModalFormRef,
445
+ form: modalForm,
446
+ onFinish: handleSubmit,
447
+ hideRequiredMark: fieldStatus === 'viewOnly' || hideRequiredMark,
448
+ // initialValues={{ ...initialValues }}
449
+ scrollToFirstError: true,
450
+ className: "modalForm"
451
+ }, formPrefix && /*#__PURE__*/_react.default.createElement(_row.default, null, formPrefix(modalForm, props, forceUpdateForm)), formItemGroup ? renderFormItemGroup() : null, formPostfix && /*#__PURE__*/_react.default.createElement(_row.default, null, formPostfix(modalForm, props, forceUpdateForm), " ")), type === 'tabForm' && /*#__PURE__*/_react.default.createElement(_TabForm.default, {
452
+ grid: size,
453
+ layout: formLayout,
454
+ fieldStatus: fieldStatus,
455
+ actionHide: true,
456
+ // @ts-ignore
457
+ getFormFields: function getFormFields(fields, form) {
458
+ setFormChild(form);
459
+ _getFormFields && _getFormFields(fields, form);
460
+ },
461
+ formItemGroup: formItemGroup,
462
+ tabsConfig: tabsConfig,
463
+ onSubmit: handleSubmit,
464
+ initialValues: Object.assign({}, initialValues),
465
+ displayLayout: displayLayout
466
+ }), type === 'stepForm' && /*#__PURE__*/_react.default.createElement(_StepForm.default, {
467
+ grid: size,
468
+ layout: formLayout,
469
+ fieldStatus: fieldStatus,
470
+ actionHide: true,
471
+ // @ts-ignore
472
+ getFormFields: function getFormFields(fields, form) {
473
+ setFormChild(form);
474
+ _getFormFields && _getFormFields(fields, form);
475
+ },
476
+ formItemGroup: formItemGroup,
477
+ stepsConfig: stepsConfig,
478
+ onSubmit: handleSubmit,
479
+ initialValues: Object.assign({}, initialValues),
480
+ displayLayout: displayLayout
481
+ }));
482
+ }; // 可拖动及缩放
483
+
484
+
485
+ if (dragAble) {
486
+ return /*#__PURE__*/_react.default.createElement(_antDesignDraggableModal.DraggableModalProvider, null, /*#__PURE__*/_react.default.createElement(_antDesignDraggableModal.DraggableModal, Object.assign({
487
+ destroyOnClose: true,
488
+ initialWidth: otherProps.width || _data.general.modalSize[size].width,
489
+ initialHeight: otherProps.height,
490
+ zIndex: 1001
491
+ }, otherProps, {
492
+ visible: visible,
493
+ className: "standardModal ".concat(className || '', " ").concat(fieldStatus === 'viewOnly' ? 'is-view' : ''),
494
+ onCancel: handleCancel,
495
+ afterClose: onAfterClose,
496
+ onOk: handleSubmit,
497
+ title: title,
498
+ footer: renderFooter()
499
+ }), renderChildrenNodes()));
500
+ }
501
+
502
+ return /*#__PURE__*/_react.default.createElement(_modal.default, Object.assign({
503
+ destroyOnClose: true,
504
+ maskClosable: false,
505
+ width: _data.general.modalSize[size].width
506
+ }, otherProps, {
507
+ visible: visible,
508
+ title: title,
509
+ footer: renderFooter(),
510
+ className: "standardModal ".concat(className || '', " ").concat(fieldStatus === 'viewOnly' ? 'is-view' : ''),
511
+ style: Object.assign({
512
+ top: '80px'
513
+ }, style),
514
+ bodyStyle: Object.assign({
515
+ maxHeight: bodyMaxHeight,
516
+ overflowY: 'scroll'
517
+ }, bodyStyle),
518
+ onCancel: handleCancel,
519
+ afterClose: onAfterClose,
520
+ onOk: handleSubmit
521
+ }), renderChildrenNodes());
522
+ };
523
+
524
+ var _default = StandardModal;
525
+ exports.default = _default;
@@ -0,0 +1,50 @@
1
+ @root-entry-name: default;
2
+ @import (reference) '~antd/es/style/themes/index';
3
+
4
+ .standardModal {
5
+ .ant-modal-body {
6
+ &::-webkit-scrollbar-track-piece {
7
+ background: fade(#c1c1c1, 10%);
8
+ }
9
+ &::-webkit-scrollbar {
10
+ width: 6px;
11
+ height: 6px;
12
+ }
13
+ &::-webkit-scrollbar-thumb {
14
+ background: fade(#c1c1c1, 50%);
15
+ border-radius: 20px;
16
+ }
17
+ }
18
+ .modalForm{
19
+ &.ant-form-horizontal .ant-form-item-label {
20
+ white-space: inherit;
21
+ > label {
22
+ min-height: @input-height-base;
23
+ height: auto;
24
+ &.ant-form-item-required::before {
25
+ margin-right: 2px;
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+
32
+ .modalPanelTitle {
33
+ height: 32px;
34
+ margin: 0 0 @padding-md 0;
35
+ padding-bottom: @padding-xs;
36
+ color: @text-color;
37
+ font-size: @font-size-base + 1;
38
+ font-weight: bold;
39
+ line-height: 32px;
40
+ border-bottom: 1px solid @border-color-base;
41
+ }
42
+ .ant-form-item.form-item-view-only {
43
+ margin-bottom: 0;
44
+ .ant-form-item-control-input{
45
+ color: @text-color-secondary;
46
+ }
47
+ }
48
+ .ant-picker-range-separator {
49
+ padding: 0 2px;
50
+ }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import './style/index.less';
3
+ interface StandardPanelProps {
4
+ children?: React.ReactNode;
5
+ style?: React.CSSProperties;
6
+ className?: string;
7
+ height?: number;
8
+ title?: any;
9
+ badges?: badgesListProps[];
10
+ cateConfig?: GroupListProps;
11
+ buttonConfig?: GroupListProps;
12
+ type?: string;
13
+ postfix?: React.ReactNode;
14
+ }
15
+ interface GroupListProps {
16
+ activeKey?: string;
17
+ list?: string[] | any;
18
+ onChange?: (value: any, data: any) => void;
19
+ className?: string;
20
+ size?: any;
21
+ }
22
+ interface badgesListProps {
23
+ value?: string;
24
+ label?: string[] | any;
25
+ color?: string;
26
+ }
27
+ declare const StandardPanel: (props: StandardPanelProps) => JSX.Element;
28
+ export default StandardPanel;