vap1 0.2.3 → 0.2.4

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 (268) hide show
  1. package/components/Box/Box.js +75 -42
  2. package/components/Box/SelectBar.js +51 -24
  3. package/components/Box/_register.d.ts +4 -0
  4. package/components/Box/_register.js +10 -8
  5. package/components/Box/index.js +1 -1
  6. package/components/Lists/SList.js +76 -48
  7. package/components/SearchBar/ActionButtons.js +75 -42
  8. package/components/SearchBar/ByField.js +80 -52
  9. package/components/SearchBar/ByKeyword.js +44 -17
  10. package/components/SearchBar/SearchField.js +8 -8
  11. package/components/SearchBar/SearchTags.js +4 -4
  12. package/components/SearchBar/_register.js +9 -8
  13. package/components/SearchBar/index.js +22 -11
  14. package/components/Tables/ApiTable.d.ts +1 -1
  15. package/components/Tables/ApiTable.js +19 -8
  16. package/components/Tables/ApiTableModal.d.ts +1 -1
  17. package/components/Tables/ApiTableModal.js +40 -13
  18. package/components/Tables/Components/ActionBar.js +53 -26
  19. package/components/Tables/Components/Actions.js +40 -29
  20. package/components/Tables/Components/Summary.js +2 -2
  21. package/components/Tables/Components/index.js +3 -3
  22. package/components/Tables/STable.js +21 -10
  23. package/components/Tables/TopTable.d.ts +3 -2
  24. package/components/Tables/TopTable.js +64 -37
  25. package/components/Tables/TopTableModal.js +21 -10
  26. package/components/Tables/Util.d.ts +2 -2
  27. package/components/Tables/Util.js +11 -9
  28. package/components/Tables/VTable.d.ts +2 -2
  29. package/components/Tables/VTable.js +137 -65
  30. package/components/Tables/index.d.ts +7 -2
  31. package/components/Tables/index.js +5 -5
  32. package/components/TreeSelect/BaseTreeSelect.js +81 -45
  33. package/components/TreeSelect/DTreeSelect.js +191 -66
  34. package/components/TreeSelect/FTreeSelect.js +67 -20
  35. package/components/TreeSelect/STreeSelect.js +22 -11
  36. package/components/Trees/ActionTree.js +562 -431
  37. package/components/Trees/BaseTree.js +85 -38
  38. package/components/Trees/COTree/COButton.js +48 -21
  39. package/components/Trees/COTree/COSelect.js +31 -20
  40. package/components/Trees/COTree/COTree.js +223 -107
  41. package/components/Trees/COTree/COTreeUtil.js +160 -115
  42. package/components/Trees/DTree.js +139 -68
  43. package/components/Trees/FTree.js +76 -29
  44. package/components/Trees/STree.js +59 -23
  45. package/components/UForm/FormWrapper.js +70 -53
  46. package/components/UForm/UDescriptions.js +38 -38
  47. package/components/UForm/UForm.js +240 -135
  48. package/components/UForm/UFormModal.js +99 -44
  49. package/components/UForm/UInfo.js +33 -22
  50. package/components/UForm/UInfoModal.js +31 -20
  51. package/components/UForm/UModal.js +40 -13
  52. package/components/UForm/_FormUtils.js +29 -18
  53. package/components/UForm/_input.js +75 -39
  54. package/components/UForm/_register.js +11 -9
  55. package/components/Upload/UploadFile.js +38 -11
  56. package/components/Upload/UploadImage.js +50 -23
  57. package/components/Upload/UploadModal.js +149 -84
  58. package/components/Upload/useUpload.js +35 -19
  59. package/components/_RegisterUtil.js +20 -8
  60. package/components/_adapt/Alert.js +20 -9
  61. package/components/_adapt/Breadcrumb.js +18 -7
  62. package/components/_adapt/Button.js +24 -13
  63. package/components/_adapt/Col.js +34 -23
  64. package/components/_adapt/Collapse.js +21 -10
  65. package/components/_adapt/ColorPicker.js +55 -28
  66. package/components/_adapt/ConfigProvider.js +14 -3
  67. package/components/_adapt/Drawer.js +18 -7
  68. package/components/_adapt/Dropdown.js +23 -12
  69. package/components/_adapt/FloatButton.js +21 -10
  70. package/components/_adapt/Icon.js +18 -7
  71. package/components/_adapt/Input.js +17 -6
  72. package/components/_adapt/InputNumber.js +16 -5
  73. package/components/_adapt/Layout.js +84 -28
  74. package/components/_adapt/Menu.js +28 -17
  75. package/components/_adapt/Modal.js +72 -25
  76. package/components/_adapt/Pagination.js +14 -3
  77. package/components/_adapt/Popconfirm.js +17 -6
  78. package/components/_adapt/Popover.js +17 -6
  79. package/components/_adapt/Progress.js +42 -11
  80. package/components/_adapt/Radio.js +21 -10
  81. package/components/_adapt/Row.js +18 -7
  82. package/components/_adapt/Select.js +54 -43
  83. package/components/_adapt/Slider.js +1 -1
  84. package/components/_adapt/Space.js +2 -2
  85. package/components/_adapt/Table.js +16 -5
  86. package/components/_adapt/Tabs.js +17 -6
  87. package/components/_adapt/Tag.js +19 -8
  88. package/components/_adapt/Tooltip.js +15 -4
  89. package/components/_adapt/TreeSelect.js +18 -7
  90. package/components/_adapt/notification.js +1 -1
  91. package/components/_adapt/todo/Image.js +2 -2
  92. package/components/_adapt/todo/NotEffectOnV15.js +1 -1
  93. package/components/_adapt/todo/Segmented.js +2 -2
  94. package/components/_adapt/utils.js +28 -8
  95. package/components/_common/AutoComplete.js +101 -34
  96. package/components/_common/CountUp.js +30 -14
  97. package/components/_common/DateRange.js +36 -20
  98. package/components/_common/HighLight.js +22 -6
  99. package/components/_common/I18N.js +27 -2
  100. package/components/_common/Loading.js +25 -9
  101. package/components/_common/MonthRange.js +26 -26
  102. package/components/_common/PromiseLabel.js +68 -15
  103. package/components/_common/Role.js +2 -2
  104. package/components/_common/Upagination.js +45 -34
  105. package/components/_setup/Const.js +2 -2
  106. package/components/_setup/I18N/enUS.js +2 -2
  107. package/components/_setup/I18N/zhCN.js +3 -3
  108. package/components/_setup/I18N/zhHK.js +2 -2
  109. package/components/_setup/ICON/IconTypes.js +2 -2
  110. package/components/_setup/SearchField/SearchFieldAdvance.js +22 -11
  111. package/components/_setup/SearchField/SearchFieldDate.js +114 -77
  112. package/components/_setup/SearchField/SearchFieldInput.js +21 -10
  113. package/components/_setup/SearchField/SearchFieldSelect.js +55 -44
  114. package/components/_setup/SearchField/SearchFieldTree.js +63 -52
  115. package/components/_setup/SelectBar/SelectList.js +21 -10
  116. package/components/_setup/SelectBar/SelectTree.js +17 -6
  117. package/components/_setup/UForm/UFormAdvanceInput.js +105 -78
  118. package/components/_setup/UForm/UFormCOTree.js +21 -10
  119. package/components/_setup/UForm/UFormCrontab.js +51 -35
  120. package/components/_setup/UForm/UFormDate.js +158 -122
  121. package/components/_setup/UForm/UFormInput.js +110 -73
  122. package/components/_setup/UForm/UFormJSON.js +95 -57
  123. package/components/_setup/UForm/UFormJSONTable.js +79 -41
  124. package/components/_setup/UForm/UFormOrg.js +112 -48
  125. package/components/_setup/UForm/UFormRole.js +31 -20
  126. package/components/_setup/UForm/UFormSelect.js +106 -79
  127. package/components/_setup/UForm/UFormTree.js +52 -41
  128. package/components/_setup/UForm/UFormUpload.js +62 -34
  129. package/components/_setup/UForm/_utils.js +9 -9
  130. package/deps/JsonView.js +18 -7
  131. package/deps/SpringBoot.js +1 -1
  132. package/deps/SpringCloud.js +4 -4
  133. package/deps/_editor/advance/_Image.js +33 -20
  134. package/deps/_editor/base/Element.js +28 -17
  135. package/deps/_editor/base/Leaf.js +18 -7
  136. package/deps/_editor/base/Support.js +4 -4
  137. package/deps/_editor/i18n.js +1 -1
  138. package/deps/_editor/tools/Button.js +31 -19
  139. package/deps/_editor/tools/ToolBar.js +3 -3
  140. package/deps/_editor/tools/_BlockButton.js +49 -27
  141. package/deps/_editor/tools/_InsertButton.js +32 -28
  142. package/deps/_editor/tools/_MarkButton.js +15 -14
  143. package/deps/_editor/tools/_TxtButton.js +90 -58
  144. package/deps/api-audit.js +1 -1
  145. package/deps/echarts.js +58 -17
  146. package/deps/editor.js +52 -26
  147. package/deps/registerEditor.js +18 -7
  148. package/hooks/_list.js +1 -1
  149. package/hooks/useAjax.js +43 -19
  150. package/hooks/useAjaxAction.js +57 -20
  151. package/hooks/useAjaxQuery.js +121 -51
  152. package/hooks/useApi.js +35 -8
  153. package/hooks/useApiBase.js +291 -184
  154. package/hooks/useApiGlobal.js +40 -13
  155. package/hooks/useApp.js +4 -4
  156. package/hooks/useArray.js +114 -52
  157. package/hooks/useDefault.js +19 -3
  158. package/hooks/useDoLoad.js +25 -9
  159. package/hooks/useEffectFunction.js +4 -3
  160. package/hooks/useEffectOnce.js +5 -5
  161. package/hooks/useError.js +21 -5
  162. package/hooks/useFirstMountState.js +3 -3
  163. package/hooks/useGenkey.js +7 -7
  164. package/hooks/useGetSet.js +9 -9
  165. package/hooks/useGlobal.js +58 -29
  166. package/hooks/useHover.js +25 -9
  167. package/hooks/useMemoPromise.js +62 -22
  168. package/hooks/useModals.js +71 -36
  169. package/hooks/useMountedState.js +6 -6
  170. package/hooks/useOpenState.js +26 -10
  171. package/hooks/usePromise.js +15 -13
  172. package/hooks/useQueue.js +35 -8
  173. package/hooks/useSetState.js +25 -8
  174. package/hooks/useStateList.js +30 -18
  175. package/hooks/useSyncExternalStore.js +31 -15
  176. package/hooks/useToggle.js +6 -3
  177. package/hooks/useUnmountPromise.js +11 -11
  178. package/hooks/useUpdate.js +20 -4
  179. package/hooks/useUpdateEffect.js +5 -5
  180. package/login/Base65.js +15 -14
  181. package/login/Password.js +91 -38
  182. package/login/SM4.js +50 -49
  183. package/login/cems/index.js +2 -2
  184. package/login/jit/index.js +16 -71
  185. package/login/jit/pnxclient.js +6 -4
  186. package/login/vap/index.js +1 -1
  187. package/login/xrtx/index.js +2 -2
  188. package/package.json +1 -1
  189. package/screen/Comment.js +16 -5
  190. package/screen/Page.js +14 -14
  191. package/screen/render.js +2 -2
  192. package/uform/FormEditor.js +43 -26
  193. package/uform/FormViewer.js +30 -19
  194. package/uform/hooks/useEditor.js +83 -47
  195. package/uform/hooks/useForm.js +2 -2
  196. package/uform/index.js +10 -10
  197. package/uform/inputs/_advance.js +12 -12
  198. package/uform/inputs/_date.js +63 -52
  199. package/uform/inputs/_input.js +49 -38
  200. package/uform/inputs/_select.js +53 -42
  201. package/uform/inputs/_specific.js +33 -22
  202. package/uform/inputs/index.js +5 -5
  203. package/uform/inputs/register.js +14 -14
  204. package/uform/panel/Editor/GroupEditor.js +31 -31
  205. package/uform/panel/Editor/ListEditor.js +22 -22
  206. package/uform/panel/Editor/_FieldItems.js +16 -16
  207. package/uform/panel/Editor/_GroupCollapse.js +9 -9
  208. package/uform/panel/Editor/_GroupDefault.js +9 -9
  209. package/uform/panel/Editor/_GroupStep.js +18 -18
  210. package/uform/panel/Editor/_GroupTab.js +16 -16
  211. package/uform/panel/Editor/index.js +17 -17
  212. package/uform/panel/Items/index.js +22 -11
  213. package/uform/panel/Propreties/CanvasProperties.js +14 -14
  214. package/uform/panel/Propreties/Component/FieldPlugin.js +5 -5
  215. package/uform/panel/Propreties/Component/LinkAsyncFunction.js +22 -47
  216. package/uform/panel/Propreties/Component/LinkSyncFunction.js +20 -43
  217. package/uform/panel/Propreties/Component/Links.js +40 -29
  218. package/uform/panel/Propreties/Component/OptionTable.js +97 -52
  219. package/uform/panel/Propreties/Component/RegexpModal.js +11 -11
  220. package/uform/panel/Propreties/Component/Validate.js +35 -24
  221. package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +13 -24
  222. package/uform/panel/Propreties/Component/ValidateSyncFunction.js +15 -38
  223. package/uform/panel/Propreties/FieldOptions.js +78 -44
  224. package/uform/panel/Propreties/FieldProperties.js +47 -20
  225. package/uform/panel/Propreties/GroupProperties.js +9 -9
  226. package/uform/panel/Propreties/_ItemAdvance.js +37 -26
  227. package/uform/panel/Propreties/_ItemBase.js +30 -19
  228. package/uform/panel/Propreties/_ItemLink.js +20 -9
  229. package/uform/panel/Propreties/_ItemValidate.js +33 -22
  230. package/uform/plugins/index.js +7 -7
  231. package/uform/utils/Convert.js +137 -94
  232. package/uform/utils/SchemaConvert.js +43 -68
  233. package/uform/utils/arr.js +103 -75
  234. package/utils/Ajax.d.ts +1 -11
  235. package/utils/Ajax.js +154 -68
  236. package/utils/ArrayUtil.js +14 -12
  237. package/utils/CacheUtil.js +19 -13
  238. package/utils/Const.js +13 -13
  239. package/utils/CustomApp.js +15 -10
  240. package/utils/EventUtil.js +78 -14
  241. package/utils/Format.js +59 -38
  242. package/utils/Global.js +8 -8
  243. package/utils/Logger.js +56 -11
  244. package/utils/PageUtil.d.ts +12 -6
  245. package/utils/PageUtil.js +105 -35
  246. package/utils/Renders/ApiGetRender.js +187 -100
  247. package/utils/Renders/ApiPostRender.js +123 -69
  248. package/utils/Renders/DateRender.js +9 -9
  249. package/utils/Renders/DictRender.js +82 -55
  250. package/utils/Renders/FileRender.js +34 -12
  251. package/utils/Renders/ListRender.js +21 -21
  252. package/utils/Renders/NumberRender.js +14 -13
  253. package/utils/Renders/StatusRender.js +20 -20
  254. package/utils/Renders/StringRender.js +17 -17
  255. package/utils/Renders/_define.d.ts +2 -2
  256. package/utils/Renders/_define.js +7 -7
  257. package/utils/StringUtil.js +98 -67
  258. package/utils/TreeUtil.js +71 -20
  259. package/utils/VAP.js +14 -14
  260. package/utils/XHR.js +27 -11
  261. package/utils/_AjaxUtil.d.ts +10 -0
  262. package/utils/_AjaxUtil.js +35 -12
  263. package/utils/_Support.js +26 -26
  264. package/utils/i18n.js +78 -44
  265. package/utils/index.d.ts +9 -1
  266. package/utils/index.js +34 -5
  267. package/utils/screenful.js +82 -29
  268. package/widget/index.js +4 -4
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -22,24 +33,40 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
33
  __setModuleDefault(result, mod);
23
34
  return result;
24
35
  };
36
+ var __read = (this && this.__read) || function (o, n) {
37
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
38
+ if (!m) return o;
39
+ var i = m.call(o), r, ar = [], e;
40
+ try {
41
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
42
+ }
43
+ catch (error) { e = { error: error }; }
44
+ finally {
45
+ try {
46
+ if (r && !r.done && (m = i["return"])) m.call(i);
47
+ }
48
+ finally { if (e) throw e.error; }
49
+ }
50
+ return ar;
51
+ };
25
52
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
53
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
54
  };
28
55
  Object.defineProperty(exports, "__esModule", { value: true });
29
56
  exports.TopTable = void 0;
30
- const lodash_1 = __importDefault(require("lodash"));
31
- const react_1 = __importStar(require("react"));
32
- const Table_1 = require("../_adapt/Table");
33
- const utils_1 = require("../../utils");
34
- const Util_1 = require("./Util");
35
- const VTable_1 = require("./VTable");
36
- const TopTable = props => {
57
+ var lodash_1 = __importDefault(require("lodash"));
58
+ var react_1 = __importStar(require("react"));
59
+ var Table_1 = require("../_adapt/Table");
60
+ var utils_1 = require("../../utils");
61
+ var Util_1 = require("./Util");
62
+ var VTable_1 = require("./VTable");
63
+ var TopTable = function (props) {
37
64
  var _a;
38
- const [columns, setColumns] = (0, react_1.useState)([]);
39
- const tableRef = (0, react_1.useRef)(null);
40
- let isQuerying = false;
41
- let rowKey = 'id';
42
- let list = [];
65
+ var _b = __read((0, react_1.useState)([]), 2), columns = _b[0], setColumns = _b[1];
66
+ var tableRef = (0, react_1.useRef)(null);
67
+ var isQuerying = false;
68
+ var rowKey = 'id';
69
+ var list = [];
43
70
  if (props.list) {
44
71
  list = props.list.slice(0);
45
72
  }
@@ -60,22 +87,22 @@ const TopTable = props => {
60
87
  }
61
88
  if (props.rowKey)
62
89
  rowKey = props.rowKey;
63
- const [scroll, setScroll] = (0, react_1.useState)(undefined);
64
- const [selected, setSelected] = (0, react_1.useState)(null);
65
- (0, react_1.useEffect)(() => {
66
- let cols = [];
90
+ var _c = __read((0, react_1.useState)(undefined), 2), scroll = _c[0], setScroll = _c[1];
91
+ var _d = __read((0, react_1.useState)(null), 2), selected = _d[0], setSelected = _d[1];
92
+ (0, react_1.useEffect)(function () {
93
+ var cols = [];
67
94
  if (props.showIndex !== false) {
68
95
  cols.push((0, Util_1.getIdxColumn)({ current: 0 }, props.showIndex, true));
69
96
  }
70
- props.columns.map(col => {
97
+ props.columns.map(function (col) {
71
98
  if (col.roleCode) {
72
99
  if (!utils_1.PageUtil.hasRole(col.roleCode)) {
73
100
  return;
74
101
  }
75
102
  }
76
103
  if (col.ik) {
77
- let title = utils_1.i18n.txt(col.ik);
78
- cols.push(Object.assign(Object.assign({}, col), { title: title == '' ? col.title : title }));
104
+ var title = utils_1.i18n.txt(col.ik);
105
+ cols.push(__assign(__assign({}, col), { title: title == '' ? col.title : title }));
79
106
  }
80
107
  else {
81
108
  cols.push(col);
@@ -83,7 +110,7 @@ const TopTable = props => {
83
110
  });
84
111
  setColumns(cols);
85
112
  }, [props.columns]);
86
- const onRowSelect = (0, react_1.useCallback)((data) => {
113
+ var onRowSelect = (0, react_1.useCallback)(function (data) {
87
114
  if (selected == null || data[rowKey] != selected[rowKey]) {
88
115
  setSelected(data);
89
116
  props.onRowSelect(data);
@@ -94,15 +121,15 @@ const TopTable = props => {
94
121
  setSelected(null);
95
122
  props.onRowSelect(null);
96
123
  }, [selected]);
97
- const resizePid = (0, react_1.useRef)(null);
98
- const resize = () => {
124
+ var resizePid = (0, react_1.useRef)(null);
125
+ var resize = function () {
99
126
  if (props.scroll === null)
100
127
  return;
101
128
  clearTimeout(resizePid.current);
102
- resizePid.current = setTimeout(() => {
103
- const thead = (0, VTable_1.getHeightByTagName)(tableRef.current, 'thead') || 40;
129
+ resizePid.current = setTimeout(function () {
130
+ var thead = (0, VTable_1.getHeightByTagName)(tableRef.current, 'thead') || 40;
104
131
  tableRef.current.style.display = 'none';
105
- let height = tableRef.current.parentElement.getBoundingClientRect().height;
132
+ var height = tableRef.current.parentElement.getBoundingClientRect().height;
106
133
  if (height == 0) {
107
134
  setScroll(undefined);
108
135
  }
@@ -112,34 +139,34 @@ const TopTable = props => {
112
139
  tableRef.current.style.display = 'block';
113
140
  }, 50);
114
141
  };
115
- (0, react_1.useEffect)(() => {
142
+ (0, react_1.useEffect)(function () {
116
143
  resize();
117
144
  window.addEventListener('resize', resize, false);
118
- return () => window.removeEventListener('resize', resize);
145
+ return function () { return window.removeEventListener('resize', resize); };
119
146
  }, []);
120
- (0, react_1.useEffect)(() => {
147
+ (0, react_1.useEffect)(function () {
121
148
  if (lodash_1.default.isArray(list) && list.length && props.mustSelect && props.onRowSelect) {
122
149
  setSelected(list[0]);
123
150
  props.onRowSelect(list[0]);
124
151
  }
125
152
  }, [props.list, (_a = props.model) === null || _a === void 0 ? void 0 : _a.list]);
126
- const tableProps = {
153
+ var tableProps = {
127
154
  tableLayout: 'fixed',
128
- rowKey,
155
+ rowKey: rowKey,
129
156
  size: utils_1.GLOBAL.CONFIG.TABLE.SIZE,
130
157
  showSorterTooltip: false,
131
158
  pagination: false,
132
159
  };
133
160
  if (lodash_1.default.isFunction(props.onRowSelect)) {
134
- tableProps.onRow = row => ({
135
- onClick: (event) => {
136
- utils_1.PageUtil.stopEvent(event, () => onRowSelect(row));
161
+ tableProps.onRow = function (row) { return ({
162
+ onClick: function (event) {
163
+ utils_1.PageUtil.stopEvent(event, function () { return onRowSelect(row); });
137
164
  }
138
- });
165
+ }); };
139
166
  }
140
167
  return react_1.default.createElement("div", { ref: tableRef, className: 'c-table-top-container' },
141
- react_1.default.createElement(Table_1.Table, Object.assign({}, tableProps, props, { rowClassName: (record, i) => {
142
- let clazz = [];
168
+ react_1.default.createElement(Table_1.Table, __assign({}, tableProps, props, { rowClassName: function (record, i) {
169
+ var clazz = [];
143
170
  if (i <= 3)
144
171
  clazz.push('c-table-top-' + i);
145
172
  if (lodash_1.default.isFunction(props.onRowSelect)) {
@@ -147,7 +174,7 @@ const TopTable = props => {
147
174
  clazz.push('ant-table-row-selected');
148
175
  }
149
176
  else {
150
- clazz.push('c-table-top-cursor');
177
+ clazz.push('c-table-cursor');
151
178
  }
152
179
  }
153
180
  return clazz.join(' ');
@@ -1,20 +1,31 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
17
  exports.TopTableModal = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const Modal_1 = require("../_adapt/Modal");
10
- const TopTable_1 = require("./TopTable");
11
- const TOP_TABLE_PROPERTIES = [
18
+ var react_1 = __importDefault(require("react"));
19
+ var lodash_1 = __importDefault(require("lodash"));
20
+ var Modal_1 = require("../_adapt/Modal");
21
+ var TopTable_1 = require("./TopTable");
22
+ var TOP_TABLE_PROPERTIES = [
12
23
  'mode', 'columns', 'showIndex', 'rowKey', 'autoLoad', 'model', 'list', 'ajaxQuery', 'mustSelect', 'onRowSelect'
13
24
  ];
14
- const TopTableModal = props => {
15
- const modalProps = lodash_1.default.omit(props, TOP_TABLE_PROPERTIES);
16
- const tableProps = lodash_1.default.pick(props, TOP_TABLE_PROPERTIES);
17
- return react_1.default.createElement(Modal_1.Modal, Object.assign({}, modalProps),
18
- react_1.default.createElement(TopTable_1.TopTable, Object.assign({}, tableProps)));
25
+ var TopTableModal = function (props) {
26
+ var modalProps = lodash_1.default.omit(props, TOP_TABLE_PROPERTIES);
27
+ var tableProps = lodash_1.default.pick(props, TOP_TABLE_PROPERTIES);
28
+ return react_1.default.createElement(Modal_1.Modal, __assign({}, modalProps),
29
+ react_1.default.createElement(TopTable_1.TopTable, __assign({}, tableProps)));
19
30
  };
20
31
  exports.TopTableModal = TopTableModal;
@@ -1,3 +1,3 @@
1
1
  import type { MutableRefObject } from 'react';
2
- import type { TableColumn } from './index';
3
- export declare const getIdxColumn: (ref: MutableRefObject<number>, showIndex?: string, isRank?: boolean) => TableColumn;
2
+ import type { ColumnProps } from 'antd/es/table/interface';
3
+ export declare const getIdxColumn: (ref: MutableRefObject<number>, showIndex?: string, isRank?: boolean) => ColumnProps<any>;
@@ -4,12 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getIdxColumn = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const utils_1 = require("../../utils");
9
- const Const_1 = require("../_setup/Const");
10
- const getIdxColumn = (ref, showIndex = null, isRank = false) => {
11
- const idxRender = (x, y, i) => ref.current + i + 1;
12
- let title;
7
+ var lodash_1 = __importDefault(require("lodash"));
8
+ var utils_1 = require("../../utils");
9
+ var Const_1 = require("../_setup/Const");
10
+ var getIdxColumn = function (ref, showIndex, isRank) {
11
+ if (showIndex === void 0) { showIndex = null; }
12
+ if (isRank === void 0) { isRank = false; }
13
+ var idxRender = function (x, y, i) { return ref.current + i + 1; };
14
+ var title;
13
15
  if (lodash_1.default.isString(showIndex)) {
14
16
  if (utils_1.i18n.hasKey(showIndex)) {
15
17
  title = utils_1.i18n.txt(showIndex);
@@ -21,7 +23,7 @@ const getIdxColumn = (ref, showIndex = null, isRank = false) => {
21
23
  else {
22
24
  title = utils_1.i18n.txt(isRank ? Const_1.V.TXT_RANK : Const_1.V.TXT_IDX);
23
25
  }
24
- let width = 48;
26
+ var width = 48;
25
27
  if (ref.current < 1000) {
26
28
  width = 48;
27
29
  }
@@ -33,8 +35,8 @@ const getIdxColumn = (ref, showIndex = null, isRank = false) => {
33
35
  }
34
36
  return {
35
37
  className: '_index',
36
- title,
37
- width,
38
+ title: title,
39
+ width: width,
38
40
  render: idxRender
39
41
  };
40
42
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { BaseTableProps, TableColumn } from './index';
2
+ import type { BaseTableProps, TableCol } from './index';
3
3
  import type { ListModel } from '../../hooks/_list';
4
4
  import type { PlainObject, Key } from '../../basetype';
5
5
  export type VTableRef = {
@@ -15,7 +15,7 @@ export type VTableProps = BaseTableProps & {
15
15
  };
16
16
  export declare const VTable: React.ForwardRefExoticComponent<import("./index").TableDefine & {
17
17
  mode?: import("../Box/Box").BoxMode;
18
- columns: TableColumn[];
18
+ columns: TableCol[];
19
19
  showIndex?: string | false;
20
20
  rowKey?: string;
21
21
  select?: true | "DEFAULT" | "QUERY";
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -22,85 +33,122 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
33
  __setModuleDefault(result, mod);
23
34
  return result;
24
35
  };
36
+ var __read = (this && this.__read) || function (o, n) {
37
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
38
+ if (!m) return o;
39
+ var i = m.call(o), r, ar = [], e;
40
+ try {
41
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
42
+ }
43
+ catch (error) { e = { error: error }; }
44
+ finally {
45
+ try {
46
+ if (r && !r.done && (m = i["return"])) m.call(i);
47
+ }
48
+ finally { if (e) throw e.error; }
49
+ }
50
+ return ar;
51
+ };
52
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
53
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
54
+ if (ar || !(i in from)) {
55
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
56
+ ar[i] = from[i];
57
+ }
58
+ }
59
+ return to.concat(ar || Array.prototype.slice.call(from));
60
+ };
25
61
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
62
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
63
  };
28
64
  Object.defineProperty(exports, "__esModule", { value: true });
29
65
  exports.VTable = exports.getHeightByTagName = void 0;
30
- const lodash_1 = __importDefault(require("lodash"));
31
- const react_1 = __importStar(require("react"));
32
- const Table_1 = require("../_adapt/Table");
33
- const antd_1 = require("antd");
34
- const ActionBar_1 = require("./Components/ActionBar");
35
- const utils_1 = require("../../utils");
36
- const Util_1 = require("./Util");
37
- const HighLight_1 = require("../_common/HighLight");
38
- const hooks_1 = require("../../hooks");
39
- const Box_1 = require("../Box/Box");
66
+ var lodash_1 = __importDefault(require("lodash"));
67
+ var react_1 = __importStar(require("react"));
68
+ var Table_1 = require("../_adapt/Table");
69
+ var antd_1 = require("antd");
70
+ var ActionBar_1 = require("./Components/ActionBar");
71
+ var utils_1 = require("../../utils");
72
+ var Util_1 = require("./Util");
73
+ var HighLight_1 = require("../_common/HighLight");
74
+ var hooks_1 = require("../../hooks");
75
+ var Box_1 = require("../Box/Box");
40
76
  ;
41
- const getHeightByTagName = (root, tagName) => {
77
+ var getHeightByTagName = function (root, tagName) {
42
78
  if (root == null)
43
79
  return 0;
44
- let els = root.getElementsByTagName(tagName);
80
+ var els = root.getElementsByTagName(tagName);
45
81
  if (els.length) {
46
82
  return els[0].getBoundingClientRect().height;
47
83
  }
48
84
  return 0;
49
85
  };
50
86
  exports.getHeightByTagName = getHeightByTagName;
51
- const _VTable = (0, react_1.forwardRef)((props, ref) => {
52
- const update = (0, hooks_1.useUpdate)();
53
- const { state, root, resize } = (0, Box_1.useBox)();
87
+ var _VTable = (0, react_1.forwardRef)(function (props, ref) {
88
+ var update = (0, hooks_1.useUpdate)();
89
+ var _a = (0, Box_1.useBox)(), state = _a.state, root = _a.root, resize = _a.resize;
54
90
  // const [scroll, setScroll] = useState<TableProps<PlainObject>['scroll']>(undefined);
55
- const { rowKey, list, isQuerying, pageNo, pageSize, orderBy, query, total } = props.model;
56
- let start = (0, react_1.useRef)(0);
57
- const tableProps = {};
58
- (0, react_1.useEffect)(() => {
91
+ var _b = props.model, rowKey = _b.rowKey, list = _b.list, isQuerying = _b.isQuerying, pageNo = _b.pageNo, pageSize = _b.pageSize, orderBy = _b.orderBy, query = _b.query, total = _b.total;
92
+ var start = (0, react_1.useRef)(0);
93
+ var tableProps = {};
94
+ (0, react_1.useEffect)(function () {
59
95
  var _a;
96
+ var _b;
60
97
  if (state.selected == null)
61
98
  return;
62
- if (lodash_1.default.isFunction((_a = props.selectBar) === null || _a === void 0 ? void 0 : _a.onSelect)) {
63
- let param = props.selectBar.onSelect(...state.selected);
64
- query(Object.assign(Object.assign({}, props.default), param));
99
+ if (lodash_1.default.isFunction((_b = props.selectBar) === null || _b === void 0 ? void 0 : _b.onSelect)) {
100
+ var param = (_a = props.selectBar).onSelect.apply(_a, __spreadArray([], __read(state.selected), false));
101
+ query(__assign(__assign({}, props.default), param));
65
102
  }
66
103
  }, [state.selected]);
67
104
  // 更新页数
68
- (0, react_1.useLayoutEffect)(() => {
105
+ (0, react_1.useLayoutEffect)(function () {
69
106
  start.current = pageSize * (pageNo - 1);
70
107
  // @ts-ignore
71
108
  if (props.model.mode == 'static')
72
109
  update();
73
110
  }, [pageSize, pageNo]);
74
- // 计算 clolum
75
- const columns = (0, react_1.useMemo)(() => {
76
- let cols = [];
111
+ // 计算 clolum 及 高亮keyword
112
+ var columns = (0, react_1.useMemo)(function () {
113
+ var cols = [];
77
114
  if (props.showIndex !== false)
78
115
  cols.push((0, Util_1.getIdxColumn)(start, props.showIndex));
79
- let HighKeys = new Set();
116
+ var HighKeys = new Set();
80
117
  if (!utils_1.GLOBAL.CONFIG.SEARCHBAR.DISABLE_KEYWORD && lodash_1.default.has(props, 'searchBar.keyword')) {
81
118
  if (lodash_1.default.isObject(props.searchBar.keyword)) {
82
- (props.searchBar.keyword.highlight || []).map(key => HighKeys.add(key));
119
+ (props.searchBar.keyword.highlight || []).map(function (key) { return HighKeys.add(key); });
83
120
  }
84
121
  else {
85
- props.columns.map(col => {
86
- if (lodash_1.default.isString(col.dataIndex))
87
- HighKeys.add(col.dataIndex);
122
+ props.columns.map(function (col) {
123
+ // @ts-ignore
124
+ var isGroup = lodash_1.default.has(col, 'children') && lodash_1.default.isArray(col.children);
125
+ if (isGroup) {
126
+ col.children.map((function (item) {
127
+ if (lodash_1.default.isString(item.dataIndex))
128
+ HighKeys.add(item.dataIndex);
129
+ }));
130
+ }
131
+ else {
132
+ var dataIndex = col.dataIndex;
133
+ if (lodash_1.default.isString(dataIndex))
134
+ HighKeys.add(dataIndex);
135
+ }
88
136
  });
89
137
  }
90
138
  }
91
- props.columns.map(col => {
139
+ var convertCol = function (col) {
92
140
  if (col.roleCode && !utils_1.PageUtil.hasRole(col.roleCode))
93
- return;
94
- let item = Object.assign({}, col);
141
+ return null;
142
+ var item = __assign({}, col);
95
143
  if (col.ik) {
96
- let title = utils_1.i18n.txt(col.ik);
144
+ var title = utils_1.i18n.txt(col.ik);
97
145
  item.title = title == '' ? item.title : title;
98
146
  }
99
147
  if (HighKeys.has(item.dataIndex) && item.render == null) {
100
- item.render = (record) => {
148
+ item.render = function (record) {
101
149
  if (!lodash_1.default.isString(record))
102
150
  return record;
103
- let keyword = '';
151
+ var keyword = '';
104
152
  if (record && keyword) {
105
153
  return react_1.default.createElement(HighLight_1.HighLight, { text: record, keyword: keyword });
106
154
  }
@@ -110,7 +158,7 @@ const _VTable = (0, react_1.forwardRef)((props, ref) => {
110
158
  if (!lodash_1.default.has(item, 'ellipsis'))
111
159
  item.ellipsis = true;
112
160
  if (!lodash_1.default.has(item, 'width') && lodash_1.default.isString(item.title)) {
113
- let clz = item.title.length + (item.sorter ? 2 : 0);
161
+ var clz = item.title.length + (item.sorter ? 2 : 0);
114
162
  if (col.className) {
115
163
  item.className = 'c-table-col-' + clz + ' ' + col.className;
116
164
  }
@@ -118,14 +166,35 @@ const _VTable = (0, react_1.forwardRef)((props, ref) => {
118
166
  item.className = 'c-table-col-' + clz;
119
167
  }
120
168
  }
121
- cols.push(item);
169
+ return item;
170
+ };
171
+ props.columns.map(function (col) {
172
+ // @ts-ignore
173
+ var isGroup = lodash_1.default.has(col, 'children') && lodash_1.default.isArray(col.children);
174
+ if (isGroup) {
175
+ var column_1 = __assign(__assign({}, lodash_1.default.pick(col, ['width', 'align'])), { children: [], title: col.title, className: 'c-table-header-group' });
176
+ if (col.className)
177
+ column_1.className = "c-table-header-group ".concat(col.className);
178
+ col.children.map((function (item) {
179
+ var subCol = convertCol(item);
180
+ if (subCol != null)
181
+ column_1.children.push(subCol);
182
+ }));
183
+ if (column_1.children.length > 0)
184
+ cols.push(column_1);
185
+ }
186
+ else {
187
+ var column = convertCol(col);
188
+ if (column != null)
189
+ cols.push(column);
190
+ }
122
191
  });
123
192
  return cols;
124
193
  }, [props.columns]);
125
- (0, react_1.useLayoutEffect)(() => {
194
+ (0, react_1.useLayoutEffect)(function () {
126
195
  resize();
127
196
  }, [columns]);
128
- (0, react_1.useEffect)(() => {
197
+ (0, react_1.useEffect)(function () {
129
198
  if (props.autoLoad === false)
130
199
  return;
131
200
  // @ts-ignore
@@ -150,48 +219,51 @@ const _VTable = (0, react_1.forwardRef)((props, ref) => {
150
219
  // // }, 2);
151
220
  // }, [state?.height]);
152
221
  // @ts-ignore
153
- const effectKey = props.model.effect;
154
- (0, react_1.useEffect)(() => {
222
+ var effectKey = props.model.effect;
223
+ (0, react_1.useEffect)(function () {
155
224
  if (effectKey == null)
156
225
  return;
157
- let effectRow = effectKey;
226
+ var effectRow = effectKey;
158
227
  if (lodash_1.default.isString(effectKey) && lodash_1.default.startsWith(effectKey, '_'))
159
228
  effectRow = effectRow.substring(1);
160
- const trs = root.current.getElementsByClassName('ant-table-row');
161
- let size = trs.length;
229
+ var trs = root.current.getElementsByClassName('ant-table-row');
230
+ var size = trs.length;
162
231
  if (size <= 0)
163
232
  return;
164
- for (let i = 0; i < size; i++) {
165
- let tr = trs.item(i);
166
- let key = tr.getAttribute('data-row-key');
233
+ var _loop_1 = function (i) {
234
+ var tr = trs.item(i);
235
+ var key = tr.getAttribute('data-row-key');
167
236
  if (key == effectRow) {
168
237
  if (tr.classList.contains('c-table-high')) {
169
238
  tr.classList.remove('c-table-high');
170
239
  }
171
- setTimeout(() => tr.classList.add('c-table-high'), 2);
240
+ setTimeout(function () { return tr.classList.add('c-table-high'); }, 2);
172
241
  }
242
+ };
243
+ for (var i = 0; i < size; i++) {
244
+ _loop_1(i);
173
245
  }
174
246
  }, [effectKey]);
175
247
  if (props.select) {
176
248
  tableProps.rowSelection = {
177
249
  selectedRowKeys: ref.current.selected[0],
178
- onChange: (selectedRowKeys, selectedObjects) => {
250
+ onChange: function (selectedRowKeys, selectedObjects) {
179
251
  ref.current.selected = [selectedRowKeys, selectedObjects];
180
252
  ref.current.onSelected();
181
253
  update();
182
254
  },
183
- getCheckboxProps: record => {
255
+ getCheckboxProps: function (record) {
184
256
  if (!lodash_1.default.has(record, rowKey))
185
257
  return { disabled: true };
186
258
  return { disabled: false };
187
259
  },
188
260
  };
189
261
  }
190
- return react_1.default.createElement(Table_1.Table, Object.assign({ rowKey: props.rowKey || rowKey,
262
+ return react_1.default.createElement(Table_1.Table, __assign({ rowKey: props.rowKey || rowKey,
191
263
  // scroll={scroll}
192
264
  // tableLayout="fixed"
193
265
  // showSorterTooltip={false}
194
- size: utils_1.GLOBAL.CONFIG.TABLE.SIZE, locale: { emptyText: react_1.default.createElement(antd_1.Empty, { style: { marginTop: 24 } }) } }, props, tableProps, { className: utils_1.StringUtil.className(['c-table'], props.className), pagination: false, columns: columns, dataSource: list, loading: isQuerying, onChange: (x, y, field) => {
266
+ size: utils_1.GLOBAL.CONFIG.TABLE.SIZE, locale: { emptyText: react_1.default.createElement(antd_1.Empty, { style: { marginTop: 24 } }) } }, props, tableProps, { className: utils_1.StringUtil.className(['c-table'], props.className), pagination: false, columns: columns, dataSource: list, loading: isQuerying, onChange: function (x, y, field) {
195
267
  if (field.column) {
196
268
  orderBy(field.field, field.order == 'ascend' ? 'asc' : 'desc');
197
269
  }
@@ -200,25 +272,25 @@ const _VTable = (0, react_1.forwardRef)((props, ref) => {
200
272
  }
201
273
  } }));
202
274
  });
203
- exports.VTable = (0, react_1.forwardRef)((props, ref) => {
204
- const { isQuerying, pageNo, pageSize, total, totalAcc, param, pageTo, query, cost } = props.model;
275
+ exports.VTable = (0, react_1.forwardRef)(function (props, ref) {
276
+ var _a = props.model, isQuerying = _a.isQuerying, pageNo = _a.pageNo, pageSize = _a.pageSize, total = _a.total, totalAcc = _a.totalAcc, param = _a.param, pageTo = _a.pageTo, query = _a.query, cost = _a.cost;
205
277
  // 通过 ref 方式交互,后续扩展方法实现定制联页选择
206
- const selectedRef = (0, react_1.useRef)({ selected: [[], []], onSelected: () => { }, });
278
+ var selectedRef = (0, react_1.useRef)({ selected: [[], []], onSelected: function () { }, });
207
279
  // 对外提供getSelected方法获取当前选择的数据
208
- (0, react_1.useImperativeHandle)(ref, () => {
280
+ (0, react_1.useImperativeHandle)(ref, function () {
209
281
  return {
210
- getSelected() {
282
+ getSelected: function () {
211
283
  return selectedRef.current.selected;
212
284
  },
213
- getParams: () => {
285
+ getParams: function () {
214
286
  return props.model.param;
215
287
  }
216
288
  };
217
289
  }, [param]);
218
- let boxProps = lodash_1.default.pick(props, ['selectBar', 'style', 'className', 'default', 'mode']);
290
+ var boxProps = lodash_1.default.pick(props, ['selectBar', 'style', 'className', 'default', 'mode']);
219
291
  if (props.searchBar) {
220
- boxProps.searchBar = Object.assign(Object.assign({}, props.searchBar), { disabled: isQuerying, onSearch: (data) => {
221
- let queryParam = lodash_1.default.extend({}, param, data);
292
+ boxProps.searchBar = __assign(__assign({}, props.searchBar), { disabled: isQuerying, onSearch: function (data) {
293
+ var queryParam = lodash_1.default.extend({}, param, data);
222
294
  query(queryParam, true);
223
295
  selectedRef.current.selected = [[], []];
224
296
  selectedRef.current.onSelected();
@@ -253,6 +325,6 @@ exports.VTable = (0, react_1.forwardRef)((props, ref) => {
253
325
  }
254
326
  }
255
327
  }
256
- return react_1.default.createElement(Box_1.Box, Object.assign({}, boxProps),
257
- react_1.default.createElement(_VTable, Object.assign({}, lodash_1.default.omit(props, ['className', 'style']), { ref: selectedRef })));
328
+ return react_1.default.createElement(Box_1.Box, __assign({}, boxProps),
329
+ react_1.default.createElement(_VTable, __assign({}, lodash_1.default.omit(props, ['className', 'style']), { ref: selectedRef })));
258
330
  });
@@ -8,7 +8,12 @@ import type { TableActionButton } from './Components/ActionBar';
8
8
  import type { PlainObject, BaseItem, ApiModel } from '../../basetype';
9
9
  import type { BoxMode } from '../Box/Box';
10
10
  import type { SelectBarProps } from '../Box/SelectBar';
11
- export type TableColumn = BaseItem & ColumnProps<PlainObject>;
11
+ export type TableColumn = BaseItem & Omit<ColumnProps<any>, 'children'>;
12
+ export type TableColumnGroup = Pick<TableColumn, 'className' | 'width' | 'align'> & {
13
+ title: string;
14
+ children: TableColumn[];
15
+ };
16
+ export type TableCol = TableColumn | TableColumnGroup;
12
17
  /**
13
18
  * 说明:为保持各应用 一致性 与 简单性
14
19
  * 所有VAP组装 Table 排除一些自定义属性
@@ -19,7 +24,7 @@ export type BaseTableProps = TableDefine & {
19
24
  /**
20
25
  * 列
21
26
  */
22
- columns: TableColumn[];
27
+ columns: TableCol[];
23
28
  /**
24
29
  * 序号字段
25
30
  * 1. 不传 :显示序号 , 支持国际化