vap1 0.4.2 → 0.4.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 (203) hide show
  1. package/_mixin.scss +89 -0
  2. package/components/Box/Box.d.ts +3 -3
  3. package/components/Box/Box.js +39 -30
  4. package/components/Box/SelectBar.d.ts +3 -3
  5. package/components/Lists/SList.d.ts +4 -5
  6. package/components/Lists/SList.js +1 -2
  7. package/components/SearchBar/ActionButtons.d.ts +4 -4
  8. package/components/SearchBar/ActionButtons.js +26 -3
  9. package/components/SearchBar/ByField.d.ts +1 -1
  10. package/components/SearchBar/ByField.js +2 -2
  11. package/components/SearchBar/ByKeyword.d.ts +2 -2
  12. package/components/SearchBar/ByKeyword.js +2 -2
  13. package/components/SearchBar/SearchField.d.ts +2 -2
  14. package/components/SearchBar/index.js +1 -1
  15. package/components/Tables/Components/ActionBar.d.ts +2 -3
  16. package/components/Tables/Components/Actions.d.ts +7 -7
  17. package/components/Tables/Components/Actions.js +4 -4
  18. package/components/Tables/Components/index.d.ts +6 -6
  19. package/components/Tables/TopTable.d.ts +2 -2
  20. package/components/Tables/TopTable.js +5 -19
  21. package/components/Tables/TopTableModal.d.ts +2 -2
  22. package/components/Tables/TopTableModal.js +1 -1
  23. package/components/Tables/Util.d.ts +5 -1
  24. package/components/Tables/Util.js +69 -2
  25. package/components/Tables/VTable.js +45 -74
  26. package/components/Tables/index.d.ts +5 -4
  27. package/components/TreeSelect/BaseTreeSelect.d.ts +3 -3
  28. package/components/TreeSelect/BaseTreeSelect.js +8 -5
  29. package/components/TreeSelect/DTreeSelect.d.ts +2 -2
  30. package/components/TreeSelect/DTreeSelect.js +1 -1
  31. package/components/TreeSelect/FTreeSelect.d.ts +2 -2
  32. package/components/TreeSelect/STreeSelect.d.ts +2 -2
  33. package/components/Trees/BaseTree.d.ts +2 -2
  34. package/components/Trees/COTree/COButton.js +1 -1
  35. package/components/Trees/COTree/COSelect.js +1 -1
  36. package/components/Trees/COTree/COTreeUtil.d.ts +2 -1
  37. package/components/Trees/COTree/COTreeUtil.js +1 -1
  38. package/components/Trees/DTree.d.ts +7 -0
  39. package/components/Trees/FTree.d.ts +2 -3
  40. package/components/Trees/STree.d.ts +2 -2
  41. package/components/UForm/FormWrapper.d.ts +2 -3
  42. package/components/UForm/UDescriptions.d.ts +2 -1
  43. package/components/UForm/UDescriptions.js +28 -5
  44. package/components/UForm/UForm.js +4 -4
  45. package/components/UForm/UFormModal.d.ts +2 -2
  46. package/components/UForm/UInfo.d.ts +2 -2
  47. package/components/UForm/UInfoModal.d.ts +2 -2
  48. package/components/UForm/UInfoModal.js +1 -1
  49. package/components/UForm/UModal.d.ts +2 -2
  50. package/components/UForm/_FieldType.d.ts +1 -1
  51. package/components/UForm/_FieldType.js +4 -0
  52. package/components/UForm/_input.d.ts +3 -3
  53. package/components/UForm/_input.js +2 -2
  54. package/components/UForm/_register.d.ts +2 -3
  55. package/components/UForm/index.d.ts +16 -13
  56. package/components/Upload/UploadFile.d.ts +2 -2
  57. package/components/Upload/UploadImage.d.ts +2 -2
  58. package/components/Upload/UploadImage.js +1 -1
  59. package/components/Upload/UploadModal.d.ts +4 -4
  60. package/components/Upload/UploadModal.js +2 -2
  61. package/components/Upload/useUpload.d.ts +2 -2
  62. package/components/Upload/useUpload.js +1 -1
  63. package/components/_RegisterUtil.d.ts +1 -1
  64. package/components/_RegisterUtil.js +2 -2
  65. package/components/_adapt/Alert.d.ts +2 -3
  66. package/components/_adapt/Button.d.ts +3 -4
  67. package/components/_adapt/Col.d.ts +8 -8
  68. package/components/_adapt/ColorPicker.js +2 -2
  69. package/components/_adapt/ConfigProvider.d.ts +3 -3
  70. package/components/_adapt/Drawer.d.ts +2 -3
  71. package/components/_adapt/Drawer.js +2 -2
  72. package/components/_adapt/FloatButton.d.ts +5 -5
  73. package/components/_adapt/Form.js +3 -3
  74. package/components/_adapt/Icon.d.ts +2 -1
  75. package/components/_adapt/Image.js +1 -1
  76. package/components/_adapt/Layout.d.ts +1 -2
  77. package/components/_adapt/Layout.js +1 -1
  78. package/components/_adapt/Menu.d.ts +5 -6
  79. package/components/_adapt/Menu.js +25 -2
  80. package/components/_adapt/Modal.d.ts +2 -1
  81. package/components/_adapt/Modal.js +1 -1
  82. package/components/_adapt/Progress.d.ts +3 -2
  83. package/components/_adapt/Progress.js +1 -1
  84. package/components/_adapt/Row.d.ts +2 -2
  85. package/components/_adapt/Select.js +1 -1
  86. package/components/_adapt/Slider.d.ts +7 -7
  87. package/components/_adapt/Space.d.ts +4 -3
  88. package/components/_adapt/Table.d.ts +5 -5
  89. package/components/_adapt/Tabs.d.ts +2 -3
  90. package/components/_adapt/Tag.js +25 -2
  91. package/components/_adapt/utils.js +10 -10
  92. package/components/_common/AutoComplete.d.ts +3 -3
  93. package/components/_common/CountUp.d.ts +3 -3
  94. package/components/_common/CountUp.js +1 -1
  95. package/components/_common/DateRange.d.ts +2 -2
  96. package/components/_common/HighLight.d.ts +2 -2
  97. package/components/_common/HighLight.js +1 -1
  98. package/components/_common/I18N.d.ts +2 -2
  99. package/components/_common/Loading.d.ts +3 -3
  100. package/components/_common/MonthRange.d.ts +2 -2
  101. package/components/_common/PromiseLabel.d.ts +4 -4
  102. package/components/_common/UTitle.d.ts +6 -5
  103. package/components/_common/UTitle.js +25 -2
  104. package/components/_common/Upagination.d.ts +2 -2
  105. package/deps/JsonView.d.ts +2 -2
  106. package/deps/JsonView.js +5 -2
  107. package/deps/app-audit/LookUp.d.ts +3 -3
  108. package/deps/app-audit/LookUp.js +2 -2
  109. package/deps/app-data/useSource.js +2 -2
  110. package/deps/echarts.d.ts +2 -2
  111. package/deps/editor/Article.d.ts +3 -3
  112. package/deps/editor/support/buttons/ImageButton.d.ts +2 -2
  113. package/deps/editor/support/buttons/ImageButton.js +1 -1
  114. package/deps/editor/tools/Button.d.ts +2 -2
  115. package/deps/editor/tools/Button.js +1 -1
  116. package/deps/editor/tools/ToolBar.d.ts +2 -2
  117. package/deps/editor/tools/_BlockButton.d.ts +2 -2
  118. package/deps/editor/tools/_InsertButton.d.ts +4 -4
  119. package/deps/editor/tools/_MarkButton.d.ts +2 -2
  120. package/deps/editor/tools/_TxtButton.d.ts +6 -6
  121. package/deps/editor/tools/_TxtButton.js +25 -5
  122. package/deps/editor/types.d.ts +2 -2
  123. package/deps/editor/utils/index.js +0 -5
  124. package/hooks/useApiBase.js +1 -1
  125. package/hooks/useApp.d.ts +4 -4
  126. package/hooks/useApp.js +1 -1
  127. package/hooks/useArray.js +5 -7
  128. package/hooks/useHover.d.ts +3 -3
  129. package/hooks/useHover.js +2 -25
  130. package/package.json +1 -1
  131. package/screen/Comment.d.ts +3 -3
  132. package/screen/EchartContent.js +2 -2
  133. package/screen/Page.d.ts +2 -2
  134. package/screen/render.d.ts +2 -2
  135. package/uform/FormEditor.d.ts +2 -2
  136. package/uform/FormEditor.js +3 -2
  137. package/uform/inputs/_date.js +1 -1
  138. package/uform/inputs/_input.js +1 -1
  139. package/uform/inputs/_select.js +1 -1
  140. package/uform/inputs/register.d.ts +2 -2
  141. package/uform/panel/Editor/GroupEditor.js +3 -3
  142. package/uform/panel/Editor/_GroupCollapse.js +3 -3
  143. package/uform/panel/Editor/_GroupDefault.js +24 -4
  144. package/uform/panel/Editor/_GroupStep.js +28 -5
  145. package/uform/panel/Editor/_GroupTab.js +25 -2
  146. package/uform/panel/Editor/index.js +1 -1
  147. package/uform/panel/Items/Fields.d.ts +2 -2
  148. package/uform/panel/Items/Fields.js +3 -1
  149. package/uform/panel/Items/InputSelector.d.ts +2 -2
  150. package/uform/panel/Items/InputSelector.js +2 -1
  151. package/uform/panel/Items/Inputs.d.ts +2 -1
  152. package/uform/panel/Items/Inputs.js +24 -4
  153. package/uform/panel/Propreties/CanvasProperties.js +25 -2
  154. package/uform/panel/Propreties/Component/FieldPlugin.d.ts +2 -2
  155. package/uform/panel/Propreties/Component/FieldPlugin.js +1 -1
  156. package/uform/panel/Propreties/Component/LinkAsyncFunction.d.ts +2 -2
  157. package/uform/panel/Propreties/Component/LinkAsyncFunction.js +1 -1
  158. package/uform/panel/Propreties/Component/LinkSyncFunction.d.ts +2 -2
  159. package/uform/panel/Propreties/Component/LinkSyncFunction.js +1 -1
  160. package/uform/panel/Propreties/Component/Links.js +1 -1
  161. package/uform/panel/Propreties/Component/OptionTable.js +25 -5
  162. package/uform/panel/Propreties/Component/RegexpModal.d.ts +2 -2
  163. package/uform/panel/Propreties/Component/Validate.js +1 -1
  164. package/uform/panel/Propreties/Component/ValidateAsyncFunction.d.ts +2 -2
  165. package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +25 -2
  166. package/uform/panel/Propreties/Component/ValidateSyncFunction.d.ts +2 -2
  167. package/uform/panel/Propreties/Component/ValidateSyncFunction.js +25 -2
  168. package/uform/panel/Propreties/FieldProperties.js +1 -1
  169. package/uform/panel/Propreties/_ItemAdvance.js +25 -2
  170. package/uform/panel/Propreties/_ItemBase.js +1 -1
  171. package/uform/panel/Propreties/_ItemLink.js +24 -4
  172. package/uform/panel/Propreties/_ItemValidate.js +24 -4
  173. package/uform/utils/Convert.js +9 -9
  174. package/utils/CacheUtil.d.ts +4 -4
  175. package/utils/CacheUtil.js +15 -15
  176. package/utils/Const.d.ts +3 -2
  177. package/utils/Const.js +26 -5
  178. package/utils/CustomApp.d.ts +3 -3
  179. package/utils/Format.js +2 -1
  180. package/utils/Renders/ApiGetRender.js +24 -19
  181. package/utils/Renders/ApiPostRender.js +2 -2
  182. package/utils/Renders/CondictionRender.d.ts +5 -0
  183. package/utils/Renders/CondictionRender.js +163 -0
  184. package/utils/Renders/DateRender.js +5 -5
  185. package/utils/Renders/DictRender.js +5 -6
  186. package/utils/Renders/FileRender.d.ts +2 -1
  187. package/utils/Renders/FileRender.js +5 -5
  188. package/utils/Renders/ListRender.js +10 -10
  189. package/utils/Renders/NumberRender.js +4 -4
  190. package/utils/Renders/StatusRender.js +2 -2
  191. package/utils/Renders/StringRender.js +4 -4
  192. package/utils/Renders/_DictBaseRender.d.ts +1 -1
  193. package/utils/Renders/_DictBaseRender.js +23 -23
  194. package/utils/Renders/_define.d.ts +16 -6
  195. package/utils/Renders/_define.js +9 -14
  196. package/utils/Renders/index.d.ts +1 -0
  197. package/utils/Renders/index.js +3 -1
  198. package/utils/StringUtil.d.ts +4 -4
  199. package/utils/StringUtil.js +15 -14
  200. package/utils/VAP.d.ts +4 -4
  201. package/utils/VAP.js +8 -40
  202. package/utils/i18n.d.ts +3 -3
  203. package/widget/index.d.ts +2 -2
package/_mixin.scss ADDED
@@ -0,0 +1,89 @@
1
+ @use "sass:math";
2
+ @use "sass:map";
3
+ @use 'sass:list';
4
+ @use "sass:string";
5
+
6
+ /**
7
+ * 本文件提供一些常用的 sass 工具。
8
+ 目前仅提供一个 @mixin : field-width : Table Column 列宽度稳定器。
9
+ 支持 3-4 个参数 ($font-setting, $field-name, $min, $max)
10
+ */
11
+
12
+ /***
13
+ 宽度设置说明:
14
+ 正常(紧凑皮肤系列)版本,每个 汉字 12px 每个数字约 7.2px , 每个英文字母约 7.8px
15
+ 暗色系皮肤 +1px
16
+ 说明,以最小字数 = MIN(标题,内容),例如,标题为 ”性别“,内容只可能是 一个字,时,以两个字为最小字数
17
+ */
18
+
19
+ @function classNames($fileds) {
20
+ $clazz: '';
21
+
22
+ @each $field in $fileds {
23
+ $clazz: "#{$clazz},.table-col-#{$field}"
24
+ }
25
+
26
+ @return string.slice($clazz, 2);
27
+
28
+ }
29
+
30
+
31
+ @function columnBaseWidth($font, $count) {
32
+ $charWidth: map.get($font, "char");
33
+ $letterWidth: map.get($font, "letter");
34
+ $numberWidth: map.get($font, "number");
35
+ $paddingWidth: map.get($font, "padding");
36
+
37
+ $charCount: 0;
38
+ $letterCount: 0;
39
+ $numberCount: 0;
40
+
41
+ @if map-has-key($count , "char") {
42
+ $charCount: map.get($count, "char");
43
+ }
44
+
45
+ @if map-has-key($count , "letter") {
46
+ $letterCount: map.get($count, "letter");
47
+ }
48
+
49
+ @if map-has-key($count , "number") {
50
+ $numberCount: map.get($count, "number");
51
+ }
52
+
53
+ @return ($charCount * $charWidth)+($numberCount * $numberWidth)+($letterCount * $letterWidth)+$paddingWidth;
54
+ }
55
+
56
+ @function columnDefine($count) {
57
+ @if type-of($count)=='map' {
58
+ @return $count;
59
+ }
60
+ @return (char :$count, number: 0, letter :0)
61
+ }
62
+
63
+
64
+ @mixin field-width($font, $field, $min, $max : null) {
65
+ $clazz : "";
66
+ $minWidth : columnBaseWidth($font, columnDefine($min));
67
+
68
+ @if type-of($field)=="list" {
69
+ $clazz : classNames($field);
70
+ }
71
+
72
+ @else {
73
+ $clazz: ".table-col-#{$field}";
74
+ }
75
+
76
+ #{$clazz} {
77
+ min-width: math.ceil($minWidth + 6px);
78
+
79
+ @if type-of($max) !='null' {
80
+ max-width: columnBaseWidth($font, columnDefine($max));
81
+ }
82
+
83
+ &.c-table-col-has-sorter {
84
+ min-width: math.ceil($minWidth + 18px);
85
+ }
86
+ }
87
+
88
+ }
89
+
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { MutableRefObject } from 'react';
2
+ import type { MutableRefObject, ReactNode, CSSProperties } from 'react';
3
3
  import type { SelectBarProps } from './SelectBar';
4
4
  import type { SearchBarProps } from '../SearchBar';
5
5
  import type { ActButton } from '../SearchBar/ActionButtons';
@@ -78,7 +78,7 @@ export type BoxProps = {
78
78
  /**
79
79
  * 自定义 className
80
80
  */
81
- style?: React.CSSProperties;
81
+ style?: CSSProperties;
82
82
  /**
83
83
  * 展示模式
84
84
  */
@@ -94,7 +94,7 @@ export type BoxProps = {
94
94
  /**
95
95
  * 操作区域
96
96
  */
97
- actionBar?: (ActButton[]) | React.ReactNode;
97
+ actionBar?: (ActButton[]) | ReactNode;
98
98
  /**
99
99
  * 分页区域
100
100
  */
@@ -94,36 +94,45 @@ exports.Box = (0, react_1.forwardRef)(function (props, ref) {
94
94
  var rootRef = (0, react_1.useRef)(null);
95
95
  var contextRef = (0, react_1.useRef)(null);
96
96
  var selectRef = (0, react_1.useRef)(null);
97
- var className = ['c-box'];
98
- if (props.nobg)
99
- className.push('c-box-nobg');
100
- var style = __assign({}, props.style);
101
- className.push(props.mode ? ('c-box-' + props.mode) : 'c-box-common');
102
- if (props.mode == 'inner') {
103
- if (rootRef.current == null) {
104
- // style.height = 0;
105
- style.display = 'none';
106
- }
107
- else {
108
- var container = utils_1.PageUtil.getParentByClassName(rootRef.current.parentElement, 'c-box');
109
- style.height = Math.floor(container.parentElement.getBoundingClientRect().height);
110
- }
111
- }
112
- else if (props.mode == 'fixed') {
113
- if (app != null) {
114
- style.height = app.theme.contentHeight;
97
+ var mode = (0, react_1.useMemo)(function () {
98
+ return props.mode || 'common';
99
+ }, [props.mode]);
100
+ var className = (0, react_1.useMemo)(function () {
101
+ var clazz = ['c-box'];
102
+ clazz.push('c-box-nobg');
103
+ clazz.push('c-box-' + mode);
104
+ if (props.className)
105
+ clazz.push(props.className);
106
+ return clazz.join(' ');
107
+ }, [props.className, props.nobg, mode]);
108
+ var style = (0, react_1.useMemo)(function () {
109
+ var css = __assign({}, props.style);
110
+ if (mode == 'inner') {
111
+ if (rootRef.current == null) {
112
+ css.display = 'none';
113
+ }
114
+ else {
115
+ var container = utils_1.PageUtil.getParentByClassName(rootRef.current.parentElement, 'c-box');
116
+ css.height = Math.floor(container.parentElement.getBoundingClientRect().height);
117
+ }
115
118
  }
116
- else {
117
- style.height = '100%';
119
+ else if (mode == 'fixed') {
120
+ if (app != null) {
121
+ css.height = app.theme.contentHeight;
122
+ }
123
+ else {
124
+ css.height = '100%';
125
+ }
118
126
  }
119
- }
127
+ return css;
128
+ }, [props.style, mode, state === null || state === void 0 ? void 0 : state.height]);
120
129
  (0, react_1.useEffect)(function () {
121
130
  if (state && state.height && contextRef && contextRef.current) {
122
131
  contextRef.current.style.height = (state.height + 'px');
123
132
  }
124
133
  }, [state === null || state === void 0 ? void 0 : state.height]);
125
- var resize = function () {
126
- if (props.mode == undefined || props.mode == 'common' || app == null) {
134
+ var resize = (0, react_1.useCallback)(function () {
135
+ if (mode == 'common' || app == null) {
127
136
  if (state === null)
128
137
  setState({});
129
138
  return;
@@ -134,7 +143,7 @@ exports.Box = (0, react_1.forwardRef)(function (props, ref) {
134
143
  return;
135
144
  document.body.classList.add('v-resizing');
136
145
  var total = el.getBoundingClientRect().height;
137
- if (props.mode == 'inner') {
146
+ if (mode == 'inner') {
138
147
  total = el.parentElement.parentElement.getBoundingClientRect().height;
139
148
  }
140
149
  var children = el.children;
@@ -147,15 +156,15 @@ exports.Box = (0, react_1.forwardRef)(function (props, ref) {
147
156
  total -= child.getBoundingClientRect().height;
148
157
  }
149
158
  }
150
- setState({ height: Math.floor(total) });
151
159
  document.body.classList.remove('v-resizing');
152
- };
153
- (0, react_1.useEffect)(function () { setTimeout(resize, 2); }, [app === null || app === void 0 ? void 0 : app.theme.contentHeight]);
154
- (0, react_1.useImperativeHandle)(ref, function () { return ({ resize: resize }); }, []);
160
+ setState({ height: Math.floor(total) });
161
+ }, [mode]);
162
+ (0, react_1.useEffect)(function () { setTimeout(resize, 120); }, [app === null || app === void 0 ? void 0 : app.theme.contentHeight]); // 1.5 版本:延时 120ms
163
+ (0, react_1.useImperativeHandle)(ref, function () { return ({ resize: resize }); }, [mode]);
155
164
  (0, react_1.useLayoutEffect)(function () {
156
165
  setTimeout(resize, 5);
157
166
  }, []);
158
- return react_1.default.createElement(Layout_1.Layout, { id: domId, className: utils_1.StringUtil.className(className, props.className), style: style, ref: _layoutRef },
167
+ return react_1.default.createElement(Layout_1.Layout, { id: domId, className: className, style: style, ref: _layoutRef },
159
168
  props.selectBar && (0, _register_1.getSelectBar)(props.selectBar.type) != null && react_1.default.createElement(SelectBar_1.SelectBar, __assign({}, props.selectBar, { ref: props.selectBar.selectRef ? props.selectBar.selectRef : selectRef, onSelect: function () {
160
169
  var args = [];
161
170
  for (var _a = 0; _a < arguments.length; _a++) {
@@ -178,7 +187,7 @@ exports.Box = (0, react_1.forwardRef)(function (props, ref) {
178
187
  } },
179
188
  (props.searchBar ||
180
189
  (props.actionBar && ((lodash_1.default.isArray(props.actionBar) && props.actionBar.length > 0)
181
- || (!lodash_1.default.isArray(props.actionBar) && react_1.default.isValidElement(props.actionBar))))) && react_1.default.createElement(SearchBar_1.SearchBar, __assign({}, props.searchBar, { default: props.default, className: HEIGHT_OMIT, onExpand: function (isExpand) {
190
+ || (!lodash_1.default.isArray(props.actionBar) && (0, react_1.isValidElement)(props.actionBar))))) && react_1.default.createElement(SearchBar_1.SearchBar, __assign({}, props.searchBar, { default: props.default, className: HEIGHT_OMIT, onExpand: function (isExpand) {
182
191
  resize();
183
192
  if (lodash_1.default.isFunction(props.searchBar.onExpand)) {
184
193
  props.searchBar.onExpand(isExpand);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { ComponentType } from 'react';
2
+ import type { ComponentType, MutableRefObject, ReactNode } from 'react';
3
3
  import type { Key, BaseItem, PlainObject } from '../../basetype';
4
4
  import type { STreeProps } from '../Trees/STree';
5
5
  import type { DTreeProps } from '../Trees/DTree';
@@ -21,7 +21,7 @@ type SelectBarAction = BaseItem & {
21
21
  /**
22
22
  * 如需二次确定,传提示消息
23
23
  */
24
- confirm?: React.ReactNode;
24
+ confirm?: ReactNode;
25
25
  };
26
26
  type _BoxSelectBarProps = BaseItem & {
27
27
  /**
@@ -63,7 +63,7 @@ type _BoxSelectBarProps = BaseItem & {
63
63
  /**
64
64
  * 选择区映射,用于一些特殊场景
65
65
  */
66
- selectRef?: React.MutableRefObject<any>;
66
+ selectRef?: MutableRefObject<any>;
67
67
  };
68
68
  /**
69
69
  * 说明: 内置 stree/dtree/ftree 三种树类型,和 list 类型
@@ -1,10 +1,9 @@
1
- import React from 'react';
1
+ import type { FC, CSSProperties, ReactNode } from 'react';
2
2
  import type { PlainObject, Key } from '../../basetype';
3
- import type { ReactNode } from 'react';
4
3
  import type { IconProps } from '../_adapt/Icon';
5
4
  type ItemRenderFunction = (record: PlainObject, searchValue?: string) => ReactNode;
6
5
  export type SListProps = {
7
- style?: React.CSSProperties;
6
+ style?: CSSProperties;
8
7
  className?: string;
9
8
  /**
10
9
  * key 字段,默认为ID
@@ -38,7 +37,7 @@ export type SListProps = {
38
37
  *
39
38
  */
40
39
  renders?: {
41
- icon?: (record: PlainObject, searchValue?: string) => IconProps | string | React.ReactNode;
40
+ icon?: (record: PlainObject, searchValue?: string) => IconProps | string | ReactNode;
42
41
  title: ItemRenderFunction;
43
42
  value?: ItemRenderFunction;
44
43
  action?: ItemRenderFunction;
@@ -56,5 +55,5 @@ export type SListProps = {
56
55
  */
57
56
  mustSelect?: true | ((list: PlainObject[]) => PlainObject);
58
57
  };
59
- export declare const SList: React.FC<SListProps>;
58
+ export declare const SList: FC<SListProps>;
60
59
  export {};
@@ -78,7 +78,7 @@ var ItemIcon = function (props) {
78
78
  }
79
79
  return react_1.default.createElement(Icon_1.Icon, __assign({}, props_1));
80
80
  }
81
- if (react_1.default.isValidElement(value)) {
81
+ if ((0, react_1.isValidElement)(value)) {
82
82
  return value;
83
83
  }
84
84
  return utils_1.Const.NONE;
@@ -113,7 +113,6 @@ var buildRenderByField = function (props) {
113
113
  valueField && react_1.default.createElement("span", { className: 'v-select-list-item-value' }, item[valueField]));
114
114
  };
115
115
  };
116
- // export const SList: React.FC<SListPorps> = memo((props) => {
117
116
  exports.SList = (0, react_1.memo)(function (props) {
118
117
  var searchValue = props.searchValue, onSelect = props.onSelect, keyField = props.keyField;
119
118
  var _a = __read((0, react_1.useState)((lodash_1.default.has(props, 'list') && lodash_1.default.isArray(props.list)) ? props.list : []), 2), list = _a[0], setList = _a[1];
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type { FC, ReactNode } from 'react';
2
2
  import type { ButtonType } from '../_adapt/_Antd5';
3
3
  import type { ButtonProps } from '../_adapt/Button';
4
4
  import type { ButtonSize } from 'antd/es/button';
@@ -6,7 +6,7 @@ export type ActButton = {
6
6
  /**
7
7
  * Icon 图标
8
8
  */
9
- icon?: string | React.ReactNode;
9
+ icon?: string | ReactNode;
10
10
  /**
11
11
  * 按钮样式类型
12
12
  */
@@ -26,7 +26,7 @@ export type ActButton = {
26
26
  /**
27
27
  * 提示信息
28
28
  */
29
- confirm?: string | ((props?: any) => string | React.ReactNode);
29
+ confirm?: string | ((props?: any) => string | ReactNode);
30
30
  /**
31
31
  * 自定义的按钮属性
32
32
  */
@@ -44,7 +44,7 @@ export type ActButton = {
44
44
  */
45
45
  children?: ActButton[];
46
46
  };
47
- export declare const ActionButtons: React.FC<{
47
+ export declare const ActionButtons: FC<{
48
48
  buttons: (ActButton | null | false)[];
49
49
  size?: ButtonSize;
50
50
  }>;
@@ -10,6 +10,29 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
13
36
  var __values = (this && this.__values) || function(o) {
14
37
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
15
38
  if (m) return m.call(o);
@@ -26,7 +49,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
49
  };
27
50
  Object.defineProperty(exports, "__esModule", { value: true });
28
51
  exports.ActionButtons = void 0;
29
- var react_1 = __importDefault(require("react"));
52
+ var react_1 = __importStar(require("react"));
30
53
  var lodash_1 = __importDefault(require("lodash"));
31
54
  var Popconfirm_1 = require("../_adapt/Popconfirm");
32
55
  var Icon_1 = require("../_adapt/Icon");
@@ -96,7 +119,7 @@ var ActionButtons = function (props) {
96
119
  var e_1, _a;
97
120
  var _b;
98
121
  if (((_b = props.buttons) === null || _b === void 0 ? void 0 : _b.length) <= 0)
99
- return react_1.default.createElement(react_1.default.Fragment, null);
122
+ return utils_1.Const.NONE;
100
123
  var groups = [[]];
101
124
  try {
102
125
  for (var _c = __values(props.buttons), _d = _c.next(); !_d.done; _d = _c.next()) {
@@ -124,6 +147,6 @@ var ActionButtons = function (props) {
124
147
  var groupProps = {};
125
148
  if (props.size)
126
149
  groupProps.size = props.size;
127
- return react_1.default.createElement(react_1.default.Fragment, null, groups.map(function (group, gi) { return react_1.default.createElement(Button_1.Button.Group, __assign({ key: gi }, groupProps), group.map(function (btn, bi) { return react_1.default.createElement(ActionButton, __assign({ key: bi }, btn)); })); }));
150
+ return react_1.default.createElement(react_1.Fragment, null, groups.map(function (group, gi) { return react_1.default.createElement(Button_1.Button.Group, __assign({ key: gi }, groupProps), group.map(function (btn, bi) { return react_1.default.createElement(ActionButton, __assign({ key: bi }, btn)); })); }));
128
151
  };
129
152
  exports.ActionButtons = ActionButtons;
@@ -1,5 +1,5 @@
1
- import type { SearchBarByFieldProps } from './index';
2
1
  import type { FC, RefAttributes, ForwardRefExoticComponent } from 'react';
2
+ import type { SearchBarByFieldProps } from './index';
3
3
  /**
4
4
  * 仅内容使用
5
5
  */
@@ -191,7 +191,7 @@ exports.InnerSearchBarByField = (0, react_1.forwardRef)(function (props, ref) {
191
191
  var btnRender = function (rowSize, isExpand) {
192
192
  if (props.hideAction || isExpand || isAwaysExpand)
193
193
  return utils_1.Const.NONE;
194
- return react_1.default.createElement(react_1.default.Fragment, null,
194
+ return react_1.default.createElement(react_1.Fragment, null,
195
195
  react_1.default.createElement(Button_1.Button, { disabled: props.disabled, icon: 'search', type: "primary", onClick: function (e) { return utils_1.PageUtil.stopEvent(e, search); } }),
196
196
  react_1.default.createElement(Button_1.Button, { disabled: props.disabled, icon: 'redo', onClick: function (e) { return utils_1.PageUtil.stopEvent(e, clear); } }),
197
197
  rowSize > 1 && !utils_1.GLOBAL.CONFIG.SEARCHBAR.USE_MODAL && react_1.default.createElement(Button_1.Button, { disabled: props.disabled, icon: 'filter', onClick: function (e) { return utils_1.PageUtil.stopEvent(e, function () { return setIsExpand(true); }); } }),
@@ -234,7 +234,7 @@ exports.InnerSearchBarByField = (0, react_1.forwardRef)(function (props, ref) {
234
234
  }, [layout.rows]);
235
235
  if (layout == null)
236
236
  return react_1.default.createElement("div", { className: 'c-searchbar-fields' });
237
- return react_1.default.createElement("div", { className: 'c-searchbar-fields', style: fieldsStyle }, layout.rows.length && react_1.default.createElement(react_1.default.Fragment, null,
237
+ return react_1.default.createElement("div", { className: 'c-searchbar-fields', style: fieldsStyle }, layout.rows.length && react_1.default.createElement(react_1.Fragment, null,
238
238
  layout.isOutSide ? react_1.default.createElement("div", { className: "c-searchbar-outgroup c-searchbar-fixgroup" },
239
239
  rowRender(layout.rows[0]),
240
240
  btnRender(layout.rows.length, isExpand)) : react_1.default.createElement(antd_1.Input.Group, { compact: true, className: "c-searchbar-fixgroup" },
@@ -1,3 +1,3 @@
1
- import React from 'react';
1
+ import type { FC } from 'react';
2
2
  import type { SearchBarProps } from './index';
3
- export declare const SearchBarByKeyword: React.FC<SearchBarProps>;
3
+ export declare const SearchBarByKeyword: FC<SearchBarProps>;
@@ -81,9 +81,9 @@ var SearchBarByKeyword = function (props) {
81
81
  }, [open]);
82
82
  var suffixProps = {};
83
83
  if (props.fields && props.fields.length) {
84
- suffixProps.suffix = react_1.default.createElement(react_1.default.Fragment, null,
84
+ suffixProps.suffix = react_1.default.createElement(react_1.Fragment, null,
85
85
  react_1.default.createElement("span", { ref: spanRef, onClick: function () { return setOpen(true); }, style: { pointerEvents: props.disabled ? 'none' : 'unset' }, className: 'vicon vicon-menu', title: utils_1.i18n.txt(_i18n_1.V.INPUT_SEARCH_ADVANCE) }, "\u00A0"),
86
- react_1.default.createElement(Popover_1.Popover, { open: open, onOpenChange: setOpen, trigger: "click", placement: "bottom", content: react_1.default.createElement(react_1.default.Fragment, null,
86
+ react_1.default.createElement(Popover_1.Popover, { open: open, onOpenChange: setOpen, trigger: "click", placement: "bottom", content: react_1.default.createElement(react_1.Fragment, null,
87
87
  react_1.default.createElement("h3", null, utils_1.i18n.txt(_i18n_1.V.INPUT_SEARCH_ADVANCE)),
88
88
  react_1.default.createElement("div", { className: 'c-searchbar' },
89
89
  react_1.default.createElement(ByField_1.InnerSearchBarByField, __assign({}, props, { ref: barRef, __innerExpand: true, __innerOutside: true, __innnerPopup: true, onSearch: function (param) {
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
1
  import { SearchFieldComponent } from './_register';
2
+ import type { FC } from 'react';
3
3
  import type { Field } from './index';
4
- export type FieldInput = React.FC<{
4
+ export type FieldInput = FC<{
5
5
  SearchField: SearchFieldComponent;
6
6
  disabled: boolean;
7
7
  field: Field;
@@ -31,7 +31,7 @@ var _SearchBar = function (props) {
31
31
  react_1.default.createElement(ByKeyword_1.SearchBarByKeyword, __assign({}, props)),
32
32
  react_1.default.createElement("div", { className: 'c-searchbar-actions' }, props.children));
33
33
  if (!lodash_1.default.has(props, 'children'))
34
- return react_1.default.createElement(react_1.default.Fragment, null);
34
+ return utils_1.Const.NONE;
35
35
  return react_1.default.createElement("div", { className: utils_1.StringUtil.className(clazz, props.className) },
36
36
  react_1.default.createElement("div", { className: 'c-searchbar-fields' }),
37
37
  react_1.default.createElement("div", { className: 'c-searchbar-actions' }, props.children));
@@ -1,7 +1,6 @@
1
- import React from 'react';
1
+ import type { FC, MutableRefObject } from 'react';
2
2
  import type { Key, PlainObject } from '../../../basetype';
3
3
  import type { ActButton } from '../../SearchBar/ActionButtons';
4
- import type { MutableRefObject } from 'react';
5
4
  export type TableAction = (ids?: Key[], objs?: PlainObject[], param?: PlainObject) => void;
6
5
  /**
7
6
  * VTable Button 区域点击后的方法,支持三个参数
@@ -32,7 +31,7 @@ type TableActionBar = {
32
31
  queryParam: PlainObject;
33
32
  selectedRef: MutableRefObject<SelectFunction>;
34
33
  };
35
- export declare const ActionBar: React.FC<TableActionBar>;
34
+ export declare const ActionBar: FC<TableActionBar>;
36
35
  /**
37
36
  * 通用添加按钮
38
37
  */
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type { FC, ReactNode } from 'react';
2
2
  import type { TableColumn } from '../index';
3
3
  import type { BaseItem } from '../../../basetype';
4
4
  /**
@@ -38,10 +38,10 @@ export type CustomAcitonProps = ActionPorps & {
38
38
  /**
39
39
  * 自定义操作的二次确认提示
40
40
  */
41
- confrim?: React.ReactNode;
41
+ confrim?: ReactNode;
42
42
  };
43
- export declare const INFO: React.FC<ActionPorps>;
44
- export declare const EDIT: React.FC<ActionPorps>;
45
- export declare const DELETE: React.FC<ActionPorps>;
46
- export declare const ACTION: React.FC<CustomAcitonProps>;
47
- export declare const COL_OPERACTION: (props: TableColumn | ((value: any, record: any, index: number) => React.ReactNode)) => TableColumn;
43
+ export declare const INFO: FC<ActionPorps>;
44
+ export declare const EDIT: FC<ActionPorps>;
45
+ export declare const DELETE: FC<ActionPorps>;
46
+ export declare const ACTION: FC<CustomAcitonProps>;
47
+ export declare const COL_OPERACTION: (props: TableColumn | ((value: any, record: any, index: number) => ReactNode)) => TableColumn;
@@ -28,7 +28,7 @@ var DEFAULT_CLASS = {
28
28
  };
29
29
  var INFO = function (props) {
30
30
  if (props.roleCode && !utils_1.PageUtil.hasRole(props.roleCode))
31
- return react_1.default.createElement(react_1.default.Fragment, null);
31
+ return utils_1.Const.NONE;
32
32
  var title = utils_1.i18n.getText(props.ik, props.title, _i18n_1.V.BTN_INFO);
33
33
  return react_1.default.createElement("span", { className: DEFAULT_CLASS.INFO, onClick: function (evt) { return utils_1.PageUtil.stopEvent(evt, props.onClick); }, title: "".concat(title, " ").concat(props.name || '') },
34
34
  react_1.default.createElement(Icon_1.Icon, { type: 'search' }),
@@ -37,7 +37,7 @@ var INFO = function (props) {
37
37
  exports.INFO = INFO;
38
38
  var EDIT = function (props) {
39
39
  if (props.roleCode && !utils_1.PageUtil.hasRole(props.roleCode))
40
- return react_1.default.createElement(react_1.default.Fragment, null);
40
+ return utils_1.Const.NONE;
41
41
  var title = utils_1.i18n.getText(props.ik, props.title, _i18n_1.V.ACT_UPDATE);
42
42
  return react_1.default.createElement("span", { className: DEFAULT_CLASS.EDIT, onClick: function (evt) { return utils_1.PageUtil.stopEvent(evt, props.onClick); }, title: "".concat(title, " ").concat(props.name || '') },
43
43
  react_1.default.createElement(Icon_1.Icon, { type: 'edit' }),
@@ -46,7 +46,7 @@ var EDIT = function (props) {
46
46
  exports.EDIT = EDIT;
47
47
  var DELETE = function (props) {
48
48
  if (props.roleCode && !utils_1.PageUtil.hasRole(props.roleCode))
49
- return react_1.default.createElement(react_1.default.Fragment, null);
49
+ return utils_1.Const.NONE;
50
50
  var title = utils_1.i18n.getText(props.ik, props.title, _i18n_1.V.ACT_DELETE);
51
51
  var popTitle = utils_1.i18n.txt(_i18n_1.V.ACT_DELETE_CONFIRM, props.name || '');
52
52
  return react_1.default.createElement(Popconfirm_1.Popconfirm, { onConfirm: function (e) { return utils_1.PageUtil.stopEvent(e, function () { return props.onClick(); }); }, placement: "right", title: react_1.default.createElement("span", null, popTitle), overlayClassName: 'c-table-action-confirm' },
@@ -57,7 +57,7 @@ var DELETE = function (props) {
57
57
  exports.DELETE = DELETE;
58
58
  var ACTION = function (props) {
59
59
  if (props.roleCode && !utils_1.PageUtil.hasRole(props.roleCode))
60
- return react_1.default.createElement(react_1.default.Fragment, null);
60
+ return utils_1.Const.NONE;
61
61
  var title = utils_1.i18n.getText(props.ik, props.title);
62
62
  var className = lodash_1.default.has(DEFAULT_CLASS, props.type) ? DEFAULT_CLASS[props.type] : DEFAULT_CLASS.EDIT;
63
63
  if (!lodash_1.default.has(props, 'confrim')) {
@@ -1,14 +1,14 @@
1
- /// <reference types="react" />
1
+ import type { FC, ReactNode } from 'react';
2
2
  import type { TableColumn } from '../index';
3
3
  import type { ActionPorps, CustomAcitonProps } from './Actions';
4
4
  import type { TableAction, TableActionButton } from './ActionBar';
5
5
  export declare const defineTable: (table: TableDefined) => void;
6
6
  export type TableDefined = {
7
- INFO: React.FC<ActionPorps>;
8
- EDIT: React.FC<ActionPorps>;
9
- DELETE: React.FC<ActionPorps>;
10
- ACTION: React.FC<CustomAcitonProps>;
11
- COL_OPERACTION: (props: TableColumn | ((value: any, record: any, index: number) => React.ReactNode)) => TableColumn;
7
+ INFO: FC<ActionPorps>;
8
+ EDIT: FC<ActionPorps>;
9
+ DELETE: FC<ActionPorps>;
10
+ ACTION: FC<CustomAcitonProps>;
11
+ COL_OPERACTION: (props: TableColumn | ((value: any, record: any, index: number) => ReactNode)) => TableColumn;
12
12
  BUTTON_ADD: (onClick: TableAction, props?: Partial<TableActionButton>) => TableActionButton;
13
13
  BUTTON_DELETE: (onClick: TableAction, props?: Partial<TableActionButton>) => TableActionButton;
14
14
  BUTTON_IMPORT: (onClick: TableAction, props?: Partial<TableActionButton>) => TableActionButton;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type { FC } from 'react';
2
2
  import type { BaseTableProps, TableColumn } from './index';
3
3
  import type { PlainObject } from '../../basetype';
4
4
  import type { ListModel } from '../../hooks/_list';
@@ -22,4 +22,4 @@ export type TopTableProps = Omit<BaseTableProps, 'mode' | 'columns' | 'select' |
22
22
  onRowSelect?: (row: PlainObject) => void;
23
23
  columns: TableColumn[];
24
24
  };
25
- export declare const TopTable: React.FC<TopTableProps>;
25
+ export declare const TopTable: FC<TopTableProps>;
@@ -90,25 +90,7 @@ var TopTable = function (props) {
90
90
  var _c = __read((0, react_1.useState)(undefined), 2), scroll = _c[0], setScroll = _c[1];
91
91
  var _d = __read((0, react_1.useState)(null), 2), selected = _d[0], setSelected = _d[1];
92
92
  (0, react_1.useEffect)(function () {
93
- var cols = [];
94
- if (props.showIndex !== false) {
95
- cols.push((0, Util_1.getIdxColumn)({ current: 0 }, props.showIndex, true));
96
- }
97
- props.columns.map(function (col) {
98
- if (col.roleCode) {
99
- if (!utils_1.PageUtil.hasRole(col.roleCode)) {
100
- return;
101
- }
102
- }
103
- if (col.ik) {
104
- var title = utils_1.i18n.txt(col.ik);
105
- cols.push(__assign(__assign({}, col), { title: title == '' ? col.title : title }));
106
- }
107
- else {
108
- cols.push(col);
109
- }
110
- });
111
- setColumns(cols);
93
+ setColumns((0, Util_1.convertColumns)(props, { ref: { current: 0 }, isRank: true }));
112
94
  }, [props.columns]);
113
95
  var onRowSelect = (0, react_1.useCallback)(function (data) {
114
96
  if (selected == null || data[rowKey] != selected[rowKey]) {
@@ -127,6 +109,9 @@ var TopTable = function (props) {
127
109
  return;
128
110
  clearTimeout(resizePid.current);
129
111
  resizePid.current = setTimeout(function () {
112
+ if (tableRef.current == null)
113
+ return;
114
+ clearTimeout(resizePid.current);
130
115
  var thead = (0, VTable_1.getHeightByTagName)(tableRef.current, 'thead') || 40;
131
116
  tableRef.current.style.display = 'none';
132
117
  var height = tableRef.current.parentElement.getBoundingClientRect().height;
@@ -164,6 +149,7 @@ var TopTable = function (props) {
164
149
  }
165
150
  }); };
166
151
  }
152
+ console.log(scroll);
167
153
  return react_1.default.createElement("div", { ref: tableRef, className: 'c-table-top-container' },
168
154
  react_1.default.createElement(Table_1.Table, __assign({}, tableProps, props, { rowClassName: function (record, i) {
169
155
  var clazz = [];
@@ -1,5 +1,5 @@
1
- import React from "react";
1
+ import type { FC } from 'react';
2
2
  import type { ModalProps } from '../_adapt/Modal';
3
3
  import type { TopTableProps } from './TopTable';
4
4
  export type TopTableModalProps = TopTableProps & ModalProps;
5
- export declare const TopTableModal: React.FC<TopTableModalProps>;
5
+ export declare const TopTableModal: FC<TopTableModalProps>;
@@ -25,7 +25,7 @@ var TOP_TABLE_PROPERTIES = [
25
25
  var TopTableModal = function (props) {
26
26
  var modalProps = lodash_1.default.omit(props, TOP_TABLE_PROPERTIES);
27
27
  var tableProps = lodash_1.default.pick(props, TOP_TABLE_PROPERTIES);
28
- return react_1.default.createElement(Modal_1.Modal, __assign({}, modalProps),
28
+ return react_1.default.createElement(Modal_1.Modal, __assign({ footer: null }, modalProps),
29
29
  react_1.default.createElement(TopTable_1.TopTable, __assign({}, tableProps)));
30
30
  };
31
31
  exports.TopTableModal = TopTableModal;
@@ -1,3 +1,7 @@
1
1
  import type { MutableRefObject } from 'react';
2
+ import type { BaseTableProps } from './index';
2
3
  import type { ColumnProps } from 'antd/es/table/interface';
3
- export declare const getIdxColumn: (ref: MutableRefObject<number>, showIndex?: string, isRank?: boolean) => ColumnProps<any>;
4
+ export declare const convertColumns: (props: BaseTableProps, rank: {
5
+ ref: MutableRefObject<number>;
6
+ isRank?: boolean;
7
+ }) => ColumnProps<any>[];