@vtx/components 4.0.0-beta.8 → 4.0.0-beta.81

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 (196) hide show
  1. package/README.md +19 -19
  2. package/es/index.js +3 -0
  3. package/es/utils/components/LabelIconTip/index.js +7 -7
  4. package/es/utils/conversionMomentValue/index.js +25 -25
  5. package/es/utils/filterSpecialCharacters.js +53 -52
  6. package/es/utils/genCopyable/index.js +6 -6
  7. package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
  8. package/es/utils/hooks/useDebounceFn/index.js +4 -4
  9. package/es/utils/hooks/useDebounceValue/index.js +6 -6
  10. package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
  11. package/es/utils/hooks/useLatest/index.js +2 -2
  12. package/es/utils/hooks/useRefCallback/index.js +5 -5
  13. package/es/utils/index.js +1 -2
  14. package/es/utils/isBrowser/index.js +7 -7
  15. package/es/utils/isUrl/index.js +4 -4
  16. package/es/utils/merge/index.js +4 -4
  17. package/es/utils/nanoid/index.js +4 -4
  18. package/es/utils/omitBoolean/index.js +4 -4
  19. package/es/utils/parseValueToMoment/index.js +4 -4
  20. package/es/utils/proFieldParsingText/index.js +10 -10
  21. package/es/utils/transformKeySubmitValue/index.js +57 -57
  22. package/es/utils/useEditableArray/index.js +46 -46
  23. package/es/utils/useEditableMap/index.js +22 -22
  24. package/es/utils/useMediaQuery/index.js +5 -5
  25. package/es/vtx-combogrid/Combogrid.js +5 -4
  26. package/es/vtx-combogrid/index.js +7 -4
  27. package/es/vtx-datagrid/Store/Provide.js +106 -137
  28. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
  29. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  30. package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  31. package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  32. package/es/vtx-datagrid/columnState.js +91 -0
  33. package/es/vtx-datagrid/index.js +124 -32
  34. package/es/vtx-datagrid/mergeComponents.js +15 -0
  35. package/es/vtx-datagrid/renderColumnButtons.js +30 -11
  36. package/es/vtx-datagrid/style/index.js +102 -20
  37. package/es/vtx-datagrid/style/index.less +242 -242
  38. package/es/vtx-date-picker/QdatePicker.js +1 -1
  39. package/es/vtx-date-picker/style/index.less +39 -39
  40. package/es/vtx-descriptions/Descriptions.js +29 -0
  41. package/es/vtx-descriptions/index.js +3 -0
  42. package/es/vtx-descriptions/style/index.js +19 -0
  43. package/es/vtx-ellipsis-text/index.js +7 -2
  44. package/es/vtx-ellipsis-text/style/index.js +3 -1
  45. package/es/vtx-export/index.js +33 -33
  46. package/es/vtx-export-async/History.js +15 -7
  47. package/es/vtx-export-async/index.js +45 -15
  48. package/es/vtx-export-async/util.js +16 -5
  49. package/es/vtx-form-layout/Card.js +10 -10
  50. package/es/vtx-form-layout/Divider.js +1 -1
  51. package/es/vtx-form-layout/FormItem.js +16 -16
  52. package/es/vtx-form-layout/Pane.js +23 -12
  53. package/es/vtx-icon/index.js +54 -45
  54. package/es/vtx-icon/index.js1 +90 -0
  55. package/es/vtx-image/Preview.js +11 -6
  56. package/es/vtx-image/style/index.js +0 -1
  57. package/es/vtx-import/index.js +211 -70
  58. package/es/vtx-import/result.js +28 -26
  59. package/es/vtx-import/style/index.js +16 -1
  60. package/es/vtx-import2/Content.js +2 -1
  61. package/es/vtx-import2/index.js +30 -19
  62. package/es/vtx-import2/style/index.js +60 -9
  63. package/es/vtx-modal/index.js +11 -6
  64. package/es/vtx-page-layout/Basic.js +2 -2
  65. package/es/vtx-page-layout/TabLayout.js +6 -6
  66. package/es/vtx-page-layout/TableLayout.js +10 -10
  67. package/es/vtx-page-layout/TreeLayout.js +6 -6
  68. package/es/vtx-page-layout/container.js +2 -2
  69. package/es/vtx-page-layout/style/index.js +4 -2
  70. package/es/vtx-provider/index.js +37 -33
  71. package/es/vtx-provider/intl.js +9 -9
  72. package/es/vtx-provider/locale/en_US.js +57 -3
  73. package/es/vtx-provider/locale/zh_CN.js +57 -3
  74. package/es/vtx-provider/useStyle/index.js +17 -17
  75. package/es/vtx-search/index.js +13 -9
  76. package/es/vtx-search/style/index.js +2 -1
  77. package/es/vtx-select/index.js +102 -36
  78. package/es/vtx-select/style/index.js +11 -56
  79. package/es/vtx-signature/index.js +5 -4
  80. package/es/vtx-signature/style/index.js +1 -1
  81. package/es/vtx-split-pane/Resizer.js +0 -1
  82. package/es/vtx-split-pane/SplitPane.js +42 -34
  83. package/es/vtx-split-pane/style/index.js +8 -112
  84. package/es/vtx-time-picker/index.js +27 -1
  85. package/es/vtx-transfer/Transfer.js +29 -0
  86. package/es/vtx-transfer/index.js +3 -0
  87. package/es/vtx-transfer/style/index.js +19 -0
  88. package/es/vtx-transfer-select/TransferSelect.js +143 -0
  89. package/es/vtx-transfer-select/index.js +3 -0
  90. package/es/vtx-transfer-select/style/index.js +19 -0
  91. package/es/vtx-tree/index.js +98 -35
  92. package/es/vtx-tree-select/index.js +71 -105
  93. package/es/vtx-tree-select/style/index.js +9 -3
  94. package/es/vtx-upload/FilePreview.js +2 -1
  95. package/es/vtx-wang-editor/index.js +93 -39
  96. package/es/vtx-wang-editor/style/index.less +12 -12
  97. package/es/vtx-wang-editor/wangEditorUtil.js +4 -0
  98. package/lib/index.js +36 -0
  99. package/lib/utils/components/LabelIconTip/index.js +7 -7
  100. package/lib/utils/conversionMomentValue/index.js +25 -25
  101. package/lib/utils/filterSpecialCharacters.js +54 -52
  102. package/lib/utils/genCopyable/index.js +6 -6
  103. package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
  104. package/lib/utils/hooks/useDebounceFn/index.js +4 -4
  105. package/lib/utils/hooks/useDebounceValue/index.js +6 -6
  106. package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
  107. package/lib/utils/hooks/useLatest/index.js +2 -2
  108. package/lib/utils/hooks/useRefCallback/index.js +5 -5
  109. package/lib/utils/index.js +0 -7
  110. package/lib/utils/isBrowser/index.js +7 -7
  111. package/lib/utils/isUrl/index.js +4 -4
  112. package/lib/utils/merge/index.js +4 -4
  113. package/lib/utils/nanoid/index.js +4 -4
  114. package/lib/utils/omitBoolean/index.js +4 -4
  115. package/lib/utils/parseValueToMoment/index.js +4 -4
  116. package/lib/utils/proFieldParsingText/index.js +10 -10
  117. package/lib/utils/transformKeySubmitValue/index.js +57 -57
  118. package/lib/utils/useEditableArray/index.js +46 -46
  119. package/lib/utils/useEditableMap/index.js +22 -22
  120. package/lib/utils/useMediaQuery/index.js +5 -5
  121. package/lib/vtx-combogrid/Combogrid.js +5 -4
  122. package/lib/vtx-combogrid/index.js +7 -4
  123. package/lib/vtx-datagrid/Store/Provide.js +113 -143
  124. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
  125. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  126. package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  127. package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  128. package/lib/vtx-datagrid/columnState.js +100 -0
  129. package/lib/vtx-datagrid/index.js +124 -32
  130. package/lib/vtx-datagrid/mergeComponents.js +21 -0
  131. package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
  132. package/lib/vtx-datagrid/style/index.js +102 -20
  133. package/lib/vtx-datagrid/style/index.less +242 -242
  134. package/lib/vtx-date-picker/QdatePicker.js +1 -1
  135. package/lib/vtx-date-picker/style/index.less +39 -39
  136. package/lib/vtx-descriptions/Descriptions.js +38 -0
  137. package/lib/vtx-descriptions/index.js +15 -0
  138. package/lib/vtx-descriptions/style/index.js +25 -0
  139. package/lib/vtx-ellipsis-text/index.js +7 -2
  140. package/lib/vtx-ellipsis-text/style/index.js +3 -1
  141. package/lib/vtx-export/index.js +34 -34
  142. package/lib/vtx-export-async/History.js +14 -8
  143. package/lib/vtx-export-async/index.js +43 -13
  144. package/lib/vtx-export-async/util.js +16 -5
  145. package/lib/vtx-form-layout/Card.js +9 -9
  146. package/lib/vtx-form-layout/Divider.js +1 -1
  147. package/lib/vtx-form-layout/FormItem.js +16 -16
  148. package/lib/vtx-form-layout/Pane.js +22 -11
  149. package/lib/vtx-icon/index.js +54 -52
  150. package/lib/vtx-icon/index.js1 +90 -0
  151. package/lib/vtx-image/Preview.js +11 -6
  152. package/lib/vtx-image/style/index.js +0 -1
  153. package/lib/vtx-import/index.js +209 -71
  154. package/lib/vtx-import/result.js +29 -27
  155. package/lib/vtx-import/style/index.js +16 -1
  156. package/lib/vtx-import2/Content.js +2 -1
  157. package/lib/vtx-import2/index.js +29 -18
  158. package/lib/vtx-import2/style/index.js +60 -9
  159. package/lib/vtx-modal/index.js +11 -6
  160. package/lib/vtx-page-layout/Basic.js +2 -2
  161. package/lib/vtx-page-layout/TabLayout.js +6 -6
  162. package/lib/vtx-page-layout/TableLayout.js +10 -10
  163. package/lib/vtx-page-layout/TreeLayout.js +6 -6
  164. package/lib/vtx-page-layout/container.js +2 -2
  165. package/lib/vtx-page-layout/style/index.js +4 -2
  166. package/lib/vtx-provider/index.js +37 -33
  167. package/lib/vtx-provider/intl.js +9 -9
  168. package/lib/vtx-provider/locale/en_US.js +57 -3
  169. package/lib/vtx-provider/locale/zh_CN.js +57 -3
  170. package/lib/vtx-provider/useStyle/index.js +17 -17
  171. package/lib/vtx-search/index.js +13 -9
  172. package/lib/vtx-search/style/index.js +2 -1
  173. package/lib/vtx-select/index.js +104 -38
  174. package/lib/vtx-select/style/index.js +11 -56
  175. package/lib/vtx-signature/index.js +4 -3
  176. package/lib/vtx-signature/style/index.js +1 -1
  177. package/lib/vtx-split-pane/Resizer.js +0 -1
  178. package/lib/vtx-split-pane/SplitPane.js +40 -31
  179. package/lib/vtx-split-pane/style/index.js +8 -112
  180. package/lib/vtx-time-picker/index.js +27 -1
  181. package/lib/vtx-transfer/Transfer.js +38 -0
  182. package/lib/vtx-transfer/index.js +15 -0
  183. package/lib/vtx-transfer/style/index.js +25 -0
  184. package/lib/vtx-transfer-select/TransferSelect.js +151 -0
  185. package/lib/vtx-transfer-select/index.js +15 -0
  186. package/lib/vtx-transfer-select/style/index.js +25 -0
  187. package/lib/vtx-tree/index.js +96 -33
  188. package/lib/vtx-tree-select/index.js +71 -105
  189. package/lib/vtx-tree-select/style/index.js +9 -3
  190. package/lib/vtx-upload/FilePreview.js +2 -1
  191. package/lib/vtx-wang-editor/index.js +91 -37
  192. package/lib/vtx-wang-editor/style/index.less +12 -12
  193. package/lib/vtx-wang-editor/wangEditorUtil.js +4 -0
  194. package/package.json +240 -225
  195. package/es/utils/hooks/useFetchData/index.js +0 -82
  196. package/lib/utils/hooks/useFetchData/index.js +0 -89
@@ -130,6 +130,10 @@ var _default = exports.default = {
130
130
  operation: '导入',
131
131
  error: '上传失败',
132
132
  success: '上传成功',
133
+ rowNumber: '行号',
134
+ errorMessage: '错误说明',
135
+ selectFile: '选择文件',
136
+ noFileSelected: "未选择任何文件",
133
137
  downloadTemplate: '下载模板',
134
138
  pleaseSelectFile: '请选择需要上传的文件',
135
139
  upload: '上传',
@@ -187,9 +191,11 @@ var _default = exports.default = {
187
191
  download: '下载'
188
192
  },
189
193
  wangEditor: {
190
- imageInsertionFailed: '插入图片失败',
191
- videoInsertionFailed: '插入视频失败',
192
- attachmentInsertionFailed: '插入附件失败'
194
+ messageOverSizeText: '超过文件大小限制,最大文件大小为',
195
+ messageUploadFailText: '上传出错',
196
+ messageInsertImgFailText: '插入图片失败',
197
+ messageInsertVideoFailText: '插入视频失败',
198
+ messageInsertAttachmentFailText: '插入附件失败'
193
199
  },
194
200
  colorPicker: {
195
201
  primary: '主要',
@@ -203,5 +209,53 @@ var _default = exports.default = {
203
209
  basic: '基础颜色',
204
210
  // 基础色板
205
211
  chart: '图表颜色' // 图表专用色
212
+ },
213
+ envPuzzle: {
214
+ common: {
215
+ startTime: '开始时间',
216
+ endTime: '结束时间',
217
+ confirm: '确定',
218
+ prompt: '提示'
219
+ },
220
+ createModal: {
221
+ clear: '清空',
222
+ required: '{label}不能为空',
223
+ whitespace: '{label}不能只包含空白字符'
224
+ },
225
+ template: {
226
+ selectedPrefix: '已选择',
227
+ selectedSuffix: '项',
228
+ clearSelected: '清空',
229
+ deleteItemConfirm: '确定删除该项吗?',
230
+ deleteRowConfirm: '是否确认删除',
231
+ deleteSelectedConfirm: '确定删除选中的{count}条数据吗?',
232
+ exportSelectedRows: '导出选中行',
233
+ exportCurrentPage: '导出当前页',
234
+ exportAll: '导出全部',
235
+ exportAllFields: '导出全量字段',
236
+ exportingFile: '导出文件中...',
237
+ paginationTotal: '总共{total}条记录'
238
+ },
239
+ import: {
240
+ rowNumber: '行数',
241
+ errorMessage: '错误信息',
242
+ pleaseUploadFile: '请上传文件',
243
+ uploadFile: '上传文件'
244
+ },
245
+ map: {
246
+ goToMap: '去地图',
247
+ locate: '定位',
248
+ calibrate: '校正',
249
+ redraw: '重新绘制',
250
+ keywordPlaceholder: '请输入关键字',
251
+ invalidLayerOptions: 'data,options 不能为空或者是map对象没有'
252
+ },
253
+ upload: {
254
+ downloading: '下载中...',
255
+ pictureUnit: '张'
256
+ },
257
+ request: {
258
+ operationFailed: '操作失败'
259
+ }
206
260
  }
207
261
  };
@@ -16,23 +16,23 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
18
18
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
19
- /**
20
- * 把一个颜色设置一下透明度
21
- * @example (#fff, 0.5) => rgba(255, 255, 255, 0.5)
22
- * @param baseColor {string}
23
- * @param alpha {0-1}
24
- * @returns rgba {string}
19
+ /**
20
+ * 把一个颜色设置一下透明度
21
+ * @example (#fff, 0.5) => rgba(255, 255, 255, 0.5)
22
+ * @param baseColor {string}
23
+ * @param alpha {0-1}
24
+ * @returns rgba {string}
25
25
  */
26
26
  var setAlpha = exports.setAlpha = function setAlpha(baseColor, alpha) {
27
27
  return new _tinycolor.TinyColor(baseColor).setAlpha(alpha).toRgbString();
28
28
  };
29
29
 
30
- /**
31
- * 把一个颜色修改一些明度
32
- * @example (#000, 50) => #808080
33
- * @param baseColor {string}
34
- * @param brightness {0-100}
35
- * @returns hexColor {string}
30
+ /**
31
+ * 把一个颜色修改一些明度
32
+ * @example (#000, 50) => #808080
33
+ * @param baseColor {string}
34
+ * @param brightness {0-100}
35
+ * @returns hexColor {string}
36
36
  */
37
37
  var lighten = exports.lighten = function lighten(baseColor, brightness) {
38
38
  var instance = new _tinycolor.TinyColor(baseColor);
@@ -67,11 +67,11 @@ var operationUnit = exports.operationUnit = function operationUnit(token) {
67
67
  };
68
68
  };
69
69
 
70
- /**
71
- * 封装了一下 antd 的 useStyle
72
- * @param componentName {string} 组件的名字
73
- * @param styleFn {GenerateStyle} 生成样式的函数
74
- * @returns UseStyleResult
70
+ /**
71
+ * 封装了一下 antd 的 useStyle
72
+ * @param componentName {string} 组件的名字
73
+ * @param styleFn {GenerateStyle} 生成样式的函数
74
+ * @returns UseStyleResult
75
75
  */
76
76
  function useStyle(componentName, styleFn) {
77
77
  var _token$vtxComponentsC;
@@ -61,10 +61,6 @@ function VtxSearch(props) {
61
61
  isClearButton = _props$isClearButton === void 0 ? true : _props$isClearButton,
62
62
  _props$isMoreButton = props.isMoreButton,
63
63
  isMoreButton = _props$isMoreButton === void 0 ? true : _props$isMoreButton,
64
- _props$confirmText = props.confirmText,
65
- confirmText = _props$confirmText === void 0 ? intl.getMessage('tableForm.search', '查询') : _props$confirmText,
66
- _props$clearText = props.clearText,
67
- clearText = _props$clearText === void 0 ? intl.getMessage('tableForm.reset', '重置') : _props$clearText,
68
64
  onConfirm = props.onConfirm,
69
65
  onClear = props.onClear,
70
66
  renderButtons = props.renderButtons,
@@ -72,7 +68,15 @@ function VtxSearch(props) {
72
68
  showAll = _props$showAll === void 0 ? false : _props$showAll,
73
69
  onToggleShow = props.onToggleShow,
74
70
  _props$customEnumText = props.customEnumText,
75
- customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText;
71
+ customEnumText = _props$customEnumText === void 0 ? {
72
+ confirmText: intl.getMessage('tableForm.search', '查询'),
73
+ //确认按钮文本
74
+ clearText: intl.getMessage('tableForm.reset', '重置'),
75
+ //情况按钮文本
76
+ collapseText: intl.getMessage('tableForm.expand', '收起'),
77
+ //情况按钮文本
78
+ expandText: intl.getMessage('tableForm.collapsed', '展开') //情况按钮文本
79
+ } : _props$customEnumText;
76
80
  var vtxSearchRef = (0, _react.useRef)();
77
81
  var ref = (0, _react.useRef)();
78
82
  var size = (0, _useColSize.default)(vtxSearchRef);
@@ -302,7 +306,7 @@ function VtxSearch(props) {
302
306
  },
303
307
  type: "primary",
304
308
  onClick: onConfirm,
305
- children: confirmText
309
+ children: customEnumText.confirmText
306
310
  })
307
311
  }), isClearButton && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
308
312
  "data-type": 'bt',
@@ -312,7 +316,7 @@ function VtxSearch(props) {
312
316
  width: '100%'
313
317
  },
314
318
  onClick: onClear,
315
- children: clearText
319
+ children: customEnumText.clearText
316
320
  })
317
321
  }), isMoreButton && grid.len > realColumn - 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
318
322
  "data-type": 'bt',
@@ -321,9 +325,9 @@ function VtxSearch(props) {
321
325
  },
322
326
  className: (0, _classnames.default)("".concat(_index.prefix, "-more"), hashId),
323
327
  children: showMore ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
324
- children: [(customEnumText === null || customEnumText === void 0 ? void 0 : customEnumText.collapseText) || '收起', /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.UpOutlined, {})]
328
+ children: [customEnumText.collapseText, /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.UpOutlined, {})]
325
329
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
326
- children: [(customEnumText === null || customEnumText === void 0 ? void 0 : customEnumText.expandText) || '展开', /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DownOutlined, {})]
330
+ children: [customEnumText.expandText, /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DownOutlined, {})]
327
331
  })
328
332
  })]
329
333
  })
@@ -23,7 +23,8 @@ var genVtxStyle = function genVtxStyle(token) {
23
23
  transitionDuration: token.toggleSpeed,
24
24
  transitionProperty: 'height',
25
25
  boxSizing: 'border-box',
26
- overflow: 'hidden'
26
+ overflow: 'hidden',
27
+ color: token.colorText
27
28
  }, "".concat(componentCls, "-element"), {}), "".concat(componentCls, "-label_v"), {
28
29
  overflow: 'hidden',
29
30
  lineHeight: 1,
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.default = exports.VtxSelect = void 0;
8
7
  var _antd = require("antd");
9
- var _classnames = _interopRequireDefault(require("classnames"));
8
+ var _classnames2 = _interopRequireDefault(require("classnames"));
10
9
  var _react = _interopRequireWildcard(require("react"));
11
10
  var _style = require("./style");
12
11
  var _icons = require("@ant-design/icons");
@@ -14,9 +13,12 @@ var _vtxIcon = _interopRequireDefault(require("../vtx-icon"));
14
13
  var _utils = require("../utils");
15
14
  var _vtxProvider = require("../vtx-provider");
16
15
  var _jsxRuntime = require("react/jsx-runtime");
16
+ var _excluded = ["value", "mode", "size", "onChange", "maxTagCount", "maxTagTextLength", "maxTagPlaceholder", "showAll", "selectStyle", "selectAll", "selectSearchAll", "defaultBindBodyToPopupContainer", "customEnumText", "showSearch", "optionFilterProp", "onSearch"],
17
+ _excluded2 = ["onSearch", "optionFilterProp"];
17
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
20
22
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
23
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
24
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -27,6 +29,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
27
29
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
28
30
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
29
31
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
32
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
33
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
30
34
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
31
35
  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."); }
32
36
  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); }
@@ -34,6 +38,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
34
38
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
35
39
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
36
40
  var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
41
+ var _props$options;
37
42
  var intl = (0, _vtxProvider.useIntl)();
38
43
  var _useState = (0, _react.useState)(0),
39
44
  _useState2 = _slicedToArray(_useState, 2),
@@ -66,16 +71,25 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
66
71
  _props$defaultBindBod = props.defaultBindBodyToPopupContainer,
67
72
  defaultBindBodyToPopupContainer = _props$defaultBindBod === void 0 ? true : _props$defaultBindBod,
68
73
  _props$customEnumText = props.customEnumText,
69
- customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText;
74
+ customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText,
75
+ showSearch = props.showSearch,
76
+ optionFilterProp = props.optionFilterProp,
77
+ _onSearch = props.onSearch,
78
+ rest = _objectWithoutProperties(props, _excluded);
70
79
  var TextEnum = _objectSpread({
71
80
  selectAllText: intl.getMessage('select.selectAll', '全选'),
72
81
  defaultPlaceholderText: intl.getMessage('tableForm.selectPlaceholder', '请选择'),
73
82
  emptyDescriptionText: intl.getMessage('select.empty', '暂无数据')
74
83
  }, customEnumText);
84
+ var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
85
+ getPrefixCls = _useContext.getPrefixCls;
86
+ var prefixCls = getPrefixCls('select', props.prefixCls);
87
+ var _useStyle = (0, _style.useStyle)(prefixCls),
88
+ wrapSSR = _useStyle.wrapSSR,
89
+ hashId = _useStyle.hashId;
75
90
  (0, _react.useEffect)(function () {
76
91
  if ((mode === 'multiple' || mode === 'tags') && elRef.current) {
77
92
  var element = elRef.current;
78
-
79
93
  // 立即设置一次
80
94
  setPopWidth(element.clientWidth);
81
95
 
@@ -100,21 +114,51 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
100
114
  };
101
115
  }
102
116
  }, [mode]);
103
- var newChildren = props.children ? Array.isArray(props.children) ? props.children : [props.children] : [];
117
+ var newChildren = props.children ? _react.default.Children.toArray(props.children) : ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.map(function (v) {
118
+ return _objectSpread(_objectSpread({}, v), {}, {
119
+ key: v.value,
120
+ props: _objectSpread(_objectSpread({}, v), {}, {
121
+ children: v.label
122
+ })
123
+ });
124
+ })) || [];
125
+ var getOptionValue = function getOptionValue(item) {
126
+ var _ref, _itemProps$value;
127
+ var itemProps = (item === null || item === void 0 ? void 0 : item.props) || {};
128
+ return (_ref = (_itemProps$value = itemProps.value) !== null && _itemProps$value !== void 0 ? _itemProps$value : item.value) !== null && _ref !== void 0 ? _ref : item.key;
129
+ };
130
+ var getOptionLabel = function getOptionLabel(item) {
131
+ var _ref2, _itemProps$children;
132
+ var itemProps = (item === null || item === void 0 ? void 0 : item.props) || {};
133
+ return (_ref2 = (_itemProps$children = itemProps.children) !== null && _itemProps$children !== void 0 ? _itemProps$children : itemProps.label) !== null && _ref2 !== void 0 ? _ref2 : item.label;
134
+ };
135
+ var getSelectedValue = function getSelectedValue(item) {
136
+ if ((0, _utils.isObject)(item)) {
137
+ var _item$value;
138
+ return (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.key;
139
+ }
140
+ return item;
141
+ };
142
+ var normalizedOptions = newChildren.map(function (item) {
143
+ return {
144
+ value: getOptionValue(item),
145
+ label: getOptionLabel(item),
146
+ raw: item
147
+ };
148
+ });
104
149
  var getContent = function getContent() {
105
150
  var child = {};
106
- newChildren.forEach(function (item) {
107
- var _item$props;
108
- child[item.key] = item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.children;
151
+ normalizedOptions.forEach(function (item) {
152
+ child[item.value] = item.label;
109
153
  });
110
154
  var getChildren = function getChildren() {
111
155
  var child = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
112
156
  var value = arguments.length > 1 ? arguments[1] : undefined;
113
- var key = (0, _utils.isObject)(value) ? value.key : value;
157
+ var key = getSelectedValue(value);
114
158
  return child[key] || '';
115
159
  };
116
160
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
117
- className: "vtx-all-list",
161
+ className: (0, _classnames2.default)("".concat(prefixCls, "-all-list"), hashId),
118
162
  children: Array.isArray(value) && value.length ? value.map(function (item, index) {
119
163
  var name = getChildren(child, item);
120
164
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tag, {
@@ -126,10 +170,13 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
126
170
  e.preventDefault();
127
171
  var valueClone = _toConsumableArray(value);
128
172
  valueClone.splice(index, 1);
129
- var options = newChildren.filter(function (ite) {
130
- return valueClone.includes(ite.props.value);
173
+ var selectedValueSet = new Set(valueClone.map(getSelectedValue));
174
+ var options = normalizedOptions.filter(function (ite) {
175
+ return selectedValueSet.has(ite.value);
176
+ }).map(function (ite) {
177
+ return ite.raw;
131
178
  });
132
- _onChange(valueClone, options);
179
+ _onChange && _onChange(valueClone, options);
133
180
  },
134
181
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
135
182
  title: name,
@@ -142,16 +189,45 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
142
189
  })
143
190
  });
144
191
  };
145
- var newProps = _objectSpread(_objectSpread({
146
- showSearch: true,
147
- optionFilterProp: 'children',
192
+ var defaultOptionFilterProp = ['label', 'children'];
193
+ var handleSearch = function handleSearch(value) {
194
+ setSearchValue(value ? String(value).toLowerCase() : '');
195
+ _onSearch && _onSearch(value);
196
+ };
197
+ var getSearchProps = function getSearchProps() {
198
+ if (showSearch && _typeof(showSearch) === 'object') {
199
+ var showSearchOnSearch = showSearch.onSearch,
200
+ showSearchOptionFilterProp = showSearch.optionFilterProp,
201
+ searchConfig = _objectWithoutProperties(showSearch, _excluded2);
202
+ return {
203
+ showSearch: _objectSpread(_objectSpread({}, searchConfig), {}, {
204
+ optionFilterProp: showSearchOptionFilterProp || optionFilterProp || defaultOptionFilterProp,
205
+ onSearch: function onSearch(value) {
206
+ setSearchValue(value ? String(value).toLowerCase() : '');
207
+ showSearchOnSearch && showSearchOnSearch(value);
208
+ _onSearch && _onSearch(value);
209
+ }
210
+ })
211
+ };
212
+ }
213
+ return {
214
+ showSearch: showSearch === undefined ? true : showSearch,
215
+ optionFilterProp: optionFilterProp || defaultOptionFilterProp
216
+ };
217
+ };
218
+ var newProps = _objectSpread(_objectSpread(_objectSpread({}, getSearchProps()), {}, {
148
219
  placeholder: TextEnum.defaultPlaceholderText,
149
- allowClear: true
150
- }, props), {}, {
151
- onSearch: function onSearch(value) {
152
- setSearchValue(value ? String(value).toLowerCase() : '');
153
- props.onSearch && props.onSearch(value);
154
- },
220
+ allowClear: true,
221
+ value: value,
222
+ mode: mode,
223
+ size: size,
224
+ //同步button大小
225
+ onChange: _onChange,
226
+ maxTagCount: maxTagCount,
227
+ maxTagTextLength: maxTagTextLength,
228
+ maxTagPlaceholder: maxTagPlaceholder
229
+ }, rest), {}, {
230
+ onSearch: handleSearch,
155
231
  onBlur: function onBlur(e) {
156
232
  setSearchValue('');
157
233
  props.onBlur && props.onBlur(e);
@@ -180,7 +256,7 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
180
256
  if (e.target.checked) {
181
257
  var tempChildren = newChildren.filter(function (item) {
182
258
  if (selectSearchAll && searchValue) {
183
- return String(item.props.children).toLowerCase().indexOf(searchValue) > -1;
259
+ return String(getOptionLabel(item)).toLowerCase().indexOf(searchValue) > -1;
184
260
  }
185
261
  return true;
186
262
  });
@@ -188,13 +264,13 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
188
264
  if (props.labelInValue) {
189
265
  keys = tempChildren.map(function (item) {
190
266
  return {
191
- label: item.props.children,
192
- value: item.key
267
+ label: getOptionLabel(item),
268
+ value: getOptionValue(item)
193
269
  };
194
270
  });
195
271
  } else {
196
272
  keys = tempChildren.map(function (item) {
197
- return item.key;
273
+ return getOptionValue(item);
198
274
  });
199
275
  }
200
276
  _onChange && _onChange(keys, tempChildren);
@@ -214,21 +290,11 @@ var VtxSelect = exports.VtxSelect = /*#__PURE__*/(0, _react.forwardRef)(function
214
290
  });
215
291
  }
216
292
  }
217
- var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
218
- getPrefixCls = _useContext.getPrefixCls;
219
- var prefixCls = getPrefixCls('select', props.prefixCls);
220
- var _useStyle = (0, _style.useStyle)(prefixCls),
221
- wrapSSR = _useStyle.wrapSSR,
222
- hashId = _useStyle.hashId;
223
293
  return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
224
- className: (0, _classnames.default)(prefixCls, hashId, {
225
- 'vtx-multi-select': mode == 'multiple' || mode == 'tags'
226
- }),
294
+ className: (0, _classnames2.default)(prefixCls, hashId, _defineProperty({}, "".concat(prefixCls, "-multi"), mode == 'multiple' || mode == 'tags')),
227
295
  id: elId.current,
228
296
  ref: elRef,
229
- style: _objectSpread(_objectSpread({}, props.style), {}, {
230
- paddingRight: (mode == 'multiple' || mode == 'tags') && showAll ? 32 : 0
231
- }),
297
+ style: _objectSpread({}, props.style),
232
298
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Space.Compact, {
233
299
  style: {
234
300
  width: '100%'
@@ -13,66 +13,21 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
13
13
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
14
  var genVtxSelectStyle = function genVtxSelectStyle(token) {
15
15
  var componentCls = token.componentCls;
16
- return _defineProperty(_defineProperty({}, componentCls, {
17
- backgroundColor: 'transparent',
18
- position: 'relative',
19
- display: 'inline-block',
20
- width: '100%',
21
- '.vtx-select-count': {
22
- position: 'absolute',
23
- top: '0',
24
- verticalAlign: 'top'
25
- },
26
- '.vtx-all-list': {
27
- position: 'absolute',
28
- zIndex: 999,
29
- boxSizing: 'border-box',
30
- width: '100%',
31
- padding: '5px',
32
- boxShadow: '0 2px 8px #d9d9d9',
33
- backgroundColor: 'red !important'
34
- },
35
- '.ant-select-selection--multiple': {
36
- maxHeight: '32px',
37
- overflow: 'hidden'
38
- }
39
- }), '.vtx-multi-select', {
40
- position: 'relative',
41
- display: 'inline-block',
42
- width: '100%',
43
- maxHeight: '32px !important',
44
- boxSizing: 'border-box',
45
- '.vtx-select-count': {
46
- position: 'absolute',
47
- top: 0,
48
- right: 0,
49
- verticalAlign: 'top',
50
- borderLeft: 'none',
51
- borderTopLeftRadius: 0,
52
- 'border-bottom-left-radius': 0
53
- },
54
- '.vtx-all-list': {
55
- position: 'absolute',
56
- zIndex: 999,
57
- boxSizing: 'border-box',
58
- width: '100%',
59
- padding: '5px',
60
- boxShadow: '0 2px 8px #d9d9d9'
61
- },
62
- '.ant-select-selector': {
63
- 'border-top-right-radius': 0,
64
- 'border-bottom-right-radius': 0,
65
- maxHeight: '32px !important',
66
- overflow: 'hidden'
67
- },
68
- '.ant-select-selection--multiple': {
69
- maxHeight: '32px',
70
- overflow: 'hidden'
16
+ return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty({
17
+ width: "100%"
18
+ }, '.ant-select', {
19
+ overflow: "hidden"
20
+ })), "".concat(componentCls, "-multi"), {
21
+ ".ant-select-content": {
22
+ flexWrap: "nowrap"
71
23
  }
24
+ }), "".concat(componentCls, "-all-list"), {
25
+ maxHeight: 300,
26
+ overflowY: "auto"
72
27
  });
73
28
  };
74
29
  function useStyle(prefixCls) {
75
- return (0, _vtxProvider.useStyle)('VtxSelect', function (token) {
30
+ return (0, _vtxProvider.useStyle)('', function (token) {
76
31
  var vtxSelectToken = _objectSpread(_objectSpread({}, token), {}, {
77
32
  componentCls: ".".concat(prefixCls)
78
33
  });
@@ -53,7 +53,7 @@ var VtxSignature = exports.VtxSignature = /*#__PURE__*/(0, _react.forwardRef)(fu
53
53
  clear();
54
54
  }
55
55
  }
56
- (0, _react.useEffect)(function () {
56
+ (0, _react.useLayoutEffect)(function () {
57
57
  signaturePad.current = new _signature_pad.default(canvasRef.current, {
58
58
  dotSize: dotSize,
59
59
  minWidth: minWidth,
@@ -74,7 +74,9 @@ var VtxSignature = exports.VtxSignature = /*#__PURE__*/(0, _react.forwardRef)(fu
74
74
  _onEnd && _onEnd();
75
75
  }
76
76
  });
77
- resizeCanvas();
77
+ setTimeout(function () {
78
+ resizeCanvas();
79
+ }, 0);
78
80
  window.addEventListener('resize', (0, _debounce.default)(resizeCanvas, 150));
79
81
  return function () {
80
82
  window.removeEventListener('resize', (0, _debounce.default)(resizeCanvas, 150));
@@ -91,7 +93,6 @@ var VtxSignature = exports.VtxSignature = /*#__PURE__*/(0, _react.forwardRef)(fu
91
93
  };
92
94
  return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
93
95
  className: (0, _classnames.default)(prefixCls, hashId),
94
- ref: ref,
95
96
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
96
97
  className: (0, _classnames.default)("".concat(prefixCls, "--body")),
97
98
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("canvas", {
@@ -17,7 +17,7 @@ var genVtxSignatureStyle = function genVtxSignatureStyle(token) {
17
17
  position: 'relative',
18
18
  display: 'flex',
19
19
  flexDirection: 'column',
20
- height: '300px',
20
+ height: 300,
21
21
  padding: '16px',
22
22
  backgroundColor: token.colorBgBase,
23
23
  border: "1px solid ".concat(token.colorBorder),
@@ -48,5 +48,4 @@ function Resizer(props) {
48
48
  }));
49
49
  }
50
50
  Resizer.propTypes = {};
51
- Resizer.defaultProps = {};
52
51
  var _default = exports.default = Resizer;