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

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 (135) hide show
  1. package/es/index.js +3 -0
  2. package/es/utils/filterSpecialCharacters.js +47 -46
  3. package/es/utils/index.js +1 -2
  4. package/es/vtx-combogrid/Combogrid.js +5 -4
  5. package/es/vtx-combogrid/index.js +7 -4
  6. package/es/vtx-datagrid/Store/Provide.js +106 -137
  7. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -3
  8. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  9. package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  10. package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  11. package/es/vtx-datagrid/columnState.js +91 -0
  12. package/es/vtx-datagrid/index.js +124 -32
  13. package/es/vtx-datagrid/mergeComponents.js +15 -0
  14. package/es/vtx-datagrid/renderColumnButtons.js +30 -11
  15. package/es/vtx-datagrid/style/index.js +102 -20
  16. package/es/vtx-date-picker/QdatePicker.js +1 -1
  17. package/es/vtx-descriptions/Descriptions.js +29 -0
  18. package/es/vtx-descriptions/index.js +3 -0
  19. package/es/vtx-descriptions/style/index.js +19 -0
  20. package/es/vtx-ellipsis-text/index.js +7 -2
  21. package/es/vtx-ellipsis-text/style/index.js +3 -1
  22. package/es/vtx-export/index.js +25 -25
  23. package/es/vtx-export-async/History.js +11 -3
  24. package/es/vtx-export-async/index.js +45 -15
  25. package/es/vtx-export-async/util.js +16 -5
  26. package/es/vtx-form-layout/Card.js +10 -10
  27. package/es/vtx-form-layout/Divider.js +1 -1
  28. package/es/vtx-form-layout/FormItem.js +16 -16
  29. package/es/vtx-form-layout/Pane.js +23 -12
  30. package/es/vtx-icon/index.js +54 -45
  31. package/es/vtx-icon/index.js1 +90 -0
  32. package/es/vtx-image/Preview.js +11 -6
  33. package/es/vtx-image/style/index.js +0 -1
  34. package/es/vtx-import/index.js +207 -65
  35. package/es/vtx-import/result.js +28 -26
  36. package/es/vtx-import/style/index.js +16 -1
  37. package/es/vtx-import2/Content.js +2 -1
  38. package/es/vtx-import2/index.js +30 -19
  39. package/es/vtx-import2/style/index.js +60 -9
  40. package/es/vtx-modal/index.js +9 -4
  41. package/es/vtx-page-layout/style/index.js +4 -2
  42. package/es/vtx-provider/index.js +7 -3
  43. package/es/vtx-provider/locale/en_US.js +57 -3
  44. package/es/vtx-provider/locale/zh_CN.js +57 -3
  45. package/es/vtx-search/index.js +13 -9
  46. package/es/vtx-search/style/index.js +2 -1
  47. package/es/vtx-select/index.js +102 -36
  48. package/es/vtx-select/style/index.js +11 -56
  49. package/es/vtx-signature/index.js +5 -4
  50. package/es/vtx-signature/style/index.js +1 -1
  51. package/es/vtx-split-pane/Resizer.js +0 -1
  52. package/es/vtx-split-pane/SplitPane.js +42 -34
  53. package/es/vtx-split-pane/style/index.js +8 -112
  54. package/es/vtx-time-picker/index.js +27 -1
  55. package/es/vtx-transfer/Transfer.js +29 -0
  56. package/es/vtx-transfer/index.js +3 -0
  57. package/es/vtx-transfer/style/index.js +19 -0
  58. package/es/vtx-transfer-select/TransferSelect.js +143 -0
  59. package/es/vtx-transfer-select/index.js +3 -0
  60. package/es/vtx-transfer-select/style/index.js +19 -0
  61. package/es/vtx-tree/index.js +98 -35
  62. package/es/vtx-tree-select/index.js +71 -105
  63. package/es/vtx-tree-select/style/index.js +9 -3
  64. package/es/vtx-upload/FilePreview.js +2 -1
  65. package/es/vtx-wang-editor/index.js +93 -39
  66. package/es/vtx-wang-editor/wangEditorUtil.js +4 -0
  67. package/lib/index.js +36 -0
  68. package/lib/utils/filterSpecialCharacters.js +48 -46
  69. package/lib/utils/index.js +0 -7
  70. package/lib/vtx-combogrid/Combogrid.js +5 -4
  71. package/lib/vtx-combogrid/index.js +7 -4
  72. package/lib/vtx-datagrid/Store/Provide.js +113 -143
  73. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -3
  74. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  75. package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  76. package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  77. package/lib/vtx-datagrid/columnState.js +100 -0
  78. package/lib/vtx-datagrid/index.js +124 -32
  79. package/lib/vtx-datagrid/mergeComponents.js +21 -0
  80. package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
  81. package/lib/vtx-datagrid/style/index.js +102 -20
  82. package/lib/vtx-date-picker/QdatePicker.js +1 -1
  83. package/lib/vtx-descriptions/Descriptions.js +38 -0
  84. package/lib/vtx-descriptions/index.js +15 -0
  85. package/lib/vtx-descriptions/style/index.js +25 -0
  86. package/lib/vtx-ellipsis-text/index.js +7 -2
  87. package/lib/vtx-ellipsis-text/style/index.js +3 -1
  88. package/lib/vtx-export/index.js +26 -26
  89. package/lib/vtx-export-async/History.js +11 -3
  90. package/lib/vtx-export-async/index.js +43 -13
  91. package/lib/vtx-export-async/util.js +16 -5
  92. package/lib/vtx-form-layout/Card.js +9 -9
  93. package/lib/vtx-form-layout/Divider.js +1 -1
  94. package/lib/vtx-form-layout/FormItem.js +16 -16
  95. package/lib/vtx-form-layout/Pane.js +22 -11
  96. package/lib/vtx-icon/index.js +54 -52
  97. package/lib/vtx-icon/index.js1 +90 -0
  98. package/lib/vtx-image/Preview.js +11 -6
  99. package/lib/vtx-image/style/index.js +0 -1
  100. package/lib/vtx-import/index.js +205 -63
  101. package/lib/vtx-import/result.js +29 -27
  102. package/lib/vtx-import/style/index.js +16 -1
  103. package/lib/vtx-import2/Content.js +2 -1
  104. package/lib/vtx-import2/index.js +29 -18
  105. package/lib/vtx-import2/style/index.js +60 -9
  106. package/lib/vtx-modal/index.js +9 -4
  107. package/lib/vtx-page-layout/style/index.js +4 -2
  108. package/lib/vtx-provider/index.js +7 -3
  109. package/lib/vtx-provider/locale/en_US.js +57 -3
  110. package/lib/vtx-provider/locale/zh_CN.js +57 -3
  111. package/lib/vtx-search/index.js +13 -9
  112. package/lib/vtx-search/style/index.js +2 -1
  113. package/lib/vtx-select/index.js +104 -38
  114. package/lib/vtx-select/style/index.js +11 -56
  115. package/lib/vtx-signature/index.js +4 -3
  116. package/lib/vtx-signature/style/index.js +1 -1
  117. package/lib/vtx-split-pane/Resizer.js +0 -1
  118. package/lib/vtx-split-pane/SplitPane.js +40 -31
  119. package/lib/vtx-split-pane/style/index.js +8 -112
  120. package/lib/vtx-time-picker/index.js +27 -1
  121. package/lib/vtx-transfer/Transfer.js +38 -0
  122. package/lib/vtx-transfer/index.js +15 -0
  123. package/lib/vtx-transfer/style/index.js +25 -0
  124. package/lib/vtx-transfer-select/TransferSelect.js +151 -0
  125. package/lib/vtx-transfer-select/index.js +15 -0
  126. package/lib/vtx-transfer-select/style/index.js +25 -0
  127. package/lib/vtx-tree/index.js +96 -33
  128. package/lib/vtx-tree-select/index.js +71 -105
  129. package/lib/vtx-tree-select/style/index.js +9 -3
  130. package/lib/vtx-upload/FilePreview.js +2 -1
  131. package/lib/vtx-wang-editor/index.js +91 -37
  132. package/lib/vtx-wang-editor/wangEditorUtil.js +4 -0
  133. package/package.json +47 -32
  134. package/es/utils/hooks/useFetchData/index.js +0 -82
  135. package/lib/utils/hooks/useFetchData/index.js +0 -89
@@ -1,6 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["multiple", "treeData", "placeholder", "treeCheckable", "disabled", "style"],
3
- _excluded2 = ["children"];
2
+ var _excluded = ["multiple", "treeData", "placeholder", "treeCheckable", "disabled", "style", "fieldNames", "onChange", "labelInValue"];
4
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
4
  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."); }
6
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -10,6 +9,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
10
9
  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; }
11
10
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
11
  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); }
12
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
13
13
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
14
  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."); }
15
15
  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); }
@@ -38,7 +38,18 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
38
38
  _ref$disabled = _ref.disabled,
39
39
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
40
40
  style = _ref.style,
41
+ _ref$fieldNames = _ref.fieldNames,
42
+ fieldNames = _ref$fieldNames === void 0 ? {
43
+ label: "title",
44
+ value: "value",
45
+ key: "value",
46
+ children: 'children'
47
+ } : _ref$fieldNames,
48
+ onChange = _ref.onChange,
49
+ labelInValue = _ref.labelInValue,
41
50
  props = _objectWithoutProperties(_ref, _excluded);
51
+ // checkable 状态下节点选择完全受控(父子节点选中状态不再关联),会使得 labelInValue 强制为 true
52
+ var _labelInValue = treeCheckable && props.treeCheckStrictly ? true : labelInValue;
42
53
  var intl = useIntl();
43
54
  var _useContext = useContext(VtxProvider),
44
55
  getPrefixCls = _useContext.getPrefixCls;
@@ -64,11 +75,9 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
64
75
  }
65
76
  (function genNodes(nodes) {
66
77
  nodes.map(function (item) {
67
- var children = item.children,
68
- rest = _objectWithoutProperties(item, _excluded2);
69
- keyNodesMapping[item.value || item.key] = _objectSpread(_objectSpread({}, rest), {}, {
70
- id: item.value || item.key
71
- });
78
+ var rest = Object.assign({}, (_objectDestructuringEmpty(item), item));
79
+ var children = item[fieldNames.children];
80
+ keyNodesMapping[item[fieldNames.value]] = _objectSpread(_objectSpread({}, rest), {}, _defineProperty(_defineProperty({}, fieldNames.value, item[fieldNames.value]), fieldNames.label, item[fieldNames.label]));
72
81
  if (Array.isArray(children) && children.length > 0) {
73
82
  genNodes(children);
74
83
  }
@@ -77,19 +86,17 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
77
86
  return keyNodesMapping;
78
87
  }, [treeData]);
79
88
  var clear = function clear() {
80
- var _props$onChange;
81
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, [], [], {});
89
+ onChangeTreeSelect === null || onChangeTreeSelect === void 0 || onChangeTreeSelect([], [], {});
82
90
  };
83
91
  var clearKey = function clearKey(id) {
84
- var _props$onChange2;
85
92
  var newValue = _toConsumableArray(props.value);
86
93
  pull(newValue, id);
87
94
  var label = newValue.map(function (item) {
88
- return keyNodesMapping[item].title;
95
+ return keyNodesMapping[item[fieldNames.label]];
89
96
  });
90
- (_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 || _props$onChange2.call(props, newValue, label, {});
97
+ onChangeTreeSelect === null || onChangeTreeSelect === void 0 || onChangeTreeSelect(newValue, label, {});
91
98
  };
92
- var selectedNodes = useMemo(function () {
99
+ var getSelectedNodes = function getSelectedNodes(value) {
93
100
  var value_arr = function (val) {
94
101
  if (Array.isArray(val)) {
95
102
  return val;
@@ -98,90 +105,29 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
98
105
  } else {
99
106
  return [];
100
107
  }
101
- }(props.value);
108
+ }(value);
102
109
  var selectedNodes = value_arr.filter(function (k) {
103
- return k in keyNodesMapping;
110
+ if (_labelInValue) {
111
+ return k.value in keyNodesMapping;
112
+ } else {
113
+ return k in keyNodesMapping;
114
+ }
104
115
  }).map(function (item) {
105
- return {
106
- id: item,
107
- name: keyNodesMapping[item].title
108
- };
116
+ if (_labelInValue) {
117
+ return _objectSpread({}, keyNodesMapping[item.value]);
118
+ }
119
+ return _objectSpread({}, keyNodesMapping[item]);
109
120
  });
110
121
  return selectedNodes;
122
+ };
123
+ var selectedNodes = useMemo(function () {
124
+ return getSelectedNodes(props.value);
111
125
  }, [props.value, keyNodesMapping]);
112
126
  useEffect(function () {
113
127
  if (size !== null && size !== void 0 && size.width) {
114
128
  setPopWidth(size === null || size === void 0 ? void 0 : size.width);
115
129
  }
116
130
  }, [size === null || size === void 0 ? void 0 : size.width]);
117
-
118
- // let suffixIconObj = {};
119
- // if (multiple || treeCheckable) {
120
- // suffixIconObj.suffixIcon = (
121
- // <Popover
122
- // content={
123
- // <>
124
- // <div
125
- // className={classnames(`${prefixCls}-count-head`, hashId,)}
126
-
127
- // >
128
- // <span>已选择:{selectedNodes.length}</span>
129
- // <span
130
- // className={classnames(
131
- // selectedNodes.length > 0 && !disabled
132
- // ? 'clear-count'
133
- // : 'disabled-count',
134
- // )}
135
- // onClick={e => {
136
- // if (!disabled) {
137
- // e.stopPropagation();
138
- // clear();
139
- // }
140
- // }}
141
- // >
142
- // 清空已选项
143
- // </span>
144
- // </div>
145
- // {selectedNodes.length > 0 ? (
146
- // selectedNodes.map(item => (
147
- // <Tag
148
- // key={`tab-${item.id}`}
149
- // closable={!disabled}
150
- // onClose={e => {
151
- // e.stopPropagation();
152
- // clearKey(item.id);
153
- // }}
154
- // style={{ marginBottom: '5px' }}
155
- // >
156
- // {item.name && item.name.length > 20
157
- // ? `${item.name.slice(0, 20)}...`
158
- // : item.name}
159
- // </Tag>
160
- // ))
161
- // ) : (
162
- // <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
163
- // )}
164
- // </>
165
- // }
166
- // placement="bottomRight"
167
- // trigger="click"
168
- // // overlayStyle={{ width: popWidth }}
169
- // styles={{ root: { width: popWidth } }}
170
- // >
171
- // <Button
172
- // className={classnames(`${prefixCls}-count`, hashId,)}
173
-
174
- // icon={<MoreOutlined />}
175
- // size="default"
176
- // onClick={e => {
177
- // console.log('click', e)
178
- // e.stopPropagation();
179
- // }}
180
- // />
181
- // </Popover>
182
- // );
183
- // }
184
-
185
131
  var popoverContent = /*#__PURE__*/_jsxs(_Fragment, {
186
132
  children: [/*#__PURE__*/_jsxs("div", {
187
133
  className: classnames("".concat(prefixCls, "-count-head"), hashId),
@@ -197,22 +143,33 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
197
143
  },
198
144
  children: intl.getMessage('treeSelect.clearSelectedItems', '清空已选项')
199
145
  })]
200
- }), selectedNodes.length > 0 ? selectedNodes.map(function (item) {
201
- return /*#__PURE__*/_jsx(Tag, {
202
- closable: !disabled,
203
- onClose: function onClose(e) {
204
- e.stopPropagation();
205
- clearKey(item.id);
206
- },
207
- style: {
208
- marginBottom: 5
209
- },
210
- children: item.name.length > 20 ? "".concat(item.name.slice(0, 20), "...") : item.name
211
- }, "tab-".concat(item.id));
212
- }) : /*#__PURE__*/_jsx(Empty, {
213
- image: Empty.PRESENTED_IMAGE_SIMPLE
146
+ }), /*#__PURE__*/_jsx("div", {
147
+ className: classnames("".concat(prefixCls, "-all-list"), hashId),
148
+ children: selectedNodes.length > 0 ? selectedNodes.map(function (item) {
149
+ var _item$fieldNames$labe;
150
+ return /*#__PURE__*/_jsx(Tag, {
151
+ closable: !disabled,
152
+ onClose: function onClose(e) {
153
+ e.stopPropagation();
154
+ clearKey(item[fieldNames.value]);
155
+ },
156
+ styles: {
157
+ root: {
158
+ marginBottom: 5,
159
+ marginRight: 5
160
+ }
161
+ },
162
+ children: ((_item$fieldNames$labe = item[fieldNames.label]) === null || _item$fieldNames$labe === void 0 ? void 0 : _item$fieldNames$labe.length) > 20 ? "".concat(item[fieldNames.label].slice(0, 20), "...") : item[fieldNames.label]
163
+ }, "tab-".concat(item[fieldNames.value]));
164
+ }) : /*#__PURE__*/_jsx(Empty, {
165
+ image: Empty.PRESENTED_IMAGE_SIMPLE
166
+ })
214
167
  })]
215
168
  });
169
+ var onChangeTreeSelect = function onChangeTreeSelect(value, label, extra) {
170
+ extra.list = getSelectedNodes(value);
171
+ onChange === null || onChange === void 0 || onChange(value, label, extra);
172
+ };
216
173
  return wrapSSR( /*#__PURE__*/_jsx("div", {
217
174
  ref: ref,
218
175
  style: style,
@@ -221,8 +178,10 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
221
178
  style: {
222
179
  width: '100%'
223
180
  },
224
- children: [/*#__PURE__*/_jsx(TreeSelect, _objectSpread({
225
- showSearch: true,
181
+ children: [/*#__PURE__*/_jsx(TreeSelect, _objectSpread(_objectSpread({
182
+ showSearch: {
183
+ treeNodeFilterProp: fieldNames.label
184
+ },
226
185
  placeholder: placeholder,
227
186
  treeData: treeData,
228
187
  treeLine: {
@@ -245,8 +204,15 @@ var VtxTreeSelect = function VtxTreeSelect(_ref) {
245
204
  popup: classnames("".concat(prefixCls, "-popup"), hashId)
246
205
  },
247
206
  maxTagCount: "responsive",
248
- treeDefaultExpandAll: true
249
- }, props)), (multiple || treeCheckable) && /*#__PURE__*/_jsx(Popover, {
207
+ treeDefaultExpandAll: true,
208
+ fieldNames: fieldNames,
209
+ labelInValue: _labelInValue,
210
+ disabled: disabled
211
+ }, props), {}, {
212
+ onChange: function onChange(value, label, extra) {
213
+ return onChangeTreeSelect(value, label, extra, selectedNodes);
214
+ }
215
+ })), (multiple || treeCheckable) && /*#__PURE__*/_jsx(Popover, {
250
216
  open: popOpen,
251
217
  onOpenChange: setPopOpen,
252
218
  placement: "bottomRight",
@@ -7,7 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import { useStyle as useAntdStyle } from "../../vtx-provider";
8
8
  var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
9
9
  var componentCls = token.componentCls;
10
- return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-popover', {
10
+ return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-popover', {
11
11
  minWidth: '200px',
12
12
  height: '300px',
13
13
  overflow: 'auto',
@@ -28,14 +28,16 @@ var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
28
28
  color: '@input-placeholder-color'
29
29
  }), '&-count', {
30
30
  marginRight: '-12px'
31
- })), "".concat(componentCls, "-popup"), _defineProperty({}, '&', _defineProperty(_defineProperty({}, '.ant-select-tree .ant-select-tree-treenode:not(.ant-select-tree .ant-select-tree-treenode-disabled).filter-node .ant-select-tree-title', {
31
+ })), "".concat(componentCls, "-popup"), _defineProperty({}, '&', _defineProperty(_defineProperty(_defineProperty({}, '.ant-select-tree .ant-select-tree-treenode:not(.ant-select-tree .ant-select-tree-treenode-disabled).filter-node .ant-select-tree-title', {
32
32
  color: '#1890ff'
33
33
  }), '.ant-select-tree .ant-select-tree-node-content-wrapper .ant-select-tree-node-selected', {
34
34
  backgroundColor: '#e6f7ff'
35
+ }), '.ant-select-tree .ant-select-tree-list-holder-inner .ant-select-tree-treenode .ant-select-tree-node-content-wrapper', {
36
+ flex: 1
35
37
  }))), "".concat(componentCls, "-count-head"), {
36
38
  display: 'flex',
37
39
  justifyContent: 'space-between',
38
- marginBottom: '5px',
40
+ marginBottom: 5,
39
41
  '.disabled-count': {
40
42
  color: '#aaa',
41
43
  cursor: 'not-allowed'
@@ -45,6 +47,9 @@ var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
45
47
  }, '&:hover', {
46
48
  color: '#40a9ff'
47
49
  })
50
+ }), "".concat(componentCls, "-all-list"), {
51
+ maxHeight: 300,
52
+ overflowY: "auto"
48
53
  }), "".concat(componentCls, "-outer"), {
49
54
  position: 'relative',
50
55
  display: 'inline-flex',
@@ -57,6 +62,7 @@ var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
57
62
  color: token.colorTextDescription,
58
63
  display: 'inline-flex',
59
64
  alignItems: 'center',
65
+ width: token.controlHeight,
60
66
  '&:hover': {
61
67
  color: token.colorPrimary
62
68
  }
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
10
10
  // import { volume, playbackRate } from 'xgplayer/dist/controls';
11
11
  import { Modal, Button } from 'antd';
12
12
  import { VtxProvider, useIntl } from "../vtx-provider";
13
+ import VtxModal from "../vtx-modal";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
16
  function Preview(props) {
@@ -77,7 +78,7 @@ function Preview(props) {
77
78
  timer && clearTimeout(timer);
78
79
  onCancel();
79
80
  };
80
- return /*#__PURE__*/_jsxs(Modal, _objectSpread(_objectSpread({}, modalProps), {}, {
81
+ return /*#__PURE__*/_jsxs(VtxModal, _objectSpread(_objectSpread({}, modalProps), {}, {
81
82
  children: [type == 'file' ? /*#__PURE__*/_jsx("iframe", {
82
83
  src: url,
83
84
  style: {
@@ -1,13 +1,13 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["value", "onChange", "downloadUrl", "uploadUrl", "placeholder", "maxFileSize", "maxNumberOfFiles", "height", "status", "enableSanitization"];
2
+ var _excluded = ["value", "onChange", "downloadUrl", "uploadUrl", "placeholder", "maxFileSize", "defaultMaxFileSize", "maxNumberOfFiles", "height", "status", "enableSanitization", "toolConfig", "editConfig"];
3
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
4
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
3
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
8
  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; }
6
9
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
10
  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); }
8
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
9
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
10
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
11
11
  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; }
12
12
  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; }
13
13
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -17,13 +17,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
17
17
  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; } }
18
18
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
19
  /*eslint-disable*/
20
- import React, { forwardRef, useState, useEffect, useContext, useCallback } from 'react';
20
+ import React, { forwardRef, useState, useEffect, useContext, useCallback, useRef } from 'react';
21
21
  import PropTypes from 'prop-types';
22
22
  import { Editor, Toolbar } from '@wangeditor/editor-for-react';
23
23
  import attachmentModule from '@wangeditor/plugin-upload-attachment';
24
- import { Boot } from '@wangeditor/editor';
24
+ import { i18nChangeLanguage, Boot } from '@wangeditor/editor';
25
+ import getToken from "../utils/getToken";
26
+ import { message } from 'antd';
25
27
  import { withEmptyHtml, findAllImgSrcsFromHtml, extractImageDataFromRtf, replaceImagesFileSourceWithInlineRepresentation, replaceAllSpanFontSize, sanitizeHtml } from "./wangEditorUtil";
26
- import { ConfigProvider } from 'antd';
27
28
  import cls from 'classnames';
28
29
  import { useStyle } from "./style/index";
29
30
  import { FormItemInputContext } from 'antd/es/form/context';
@@ -44,7 +45,6 @@ var VtxWangEditor = function VtxWangEditor(props) {
44
45
  var _useStyle = useStyle(prefixCls),
45
46
  wrapSSR = _useStyle.wrapSSR,
46
47
  hashId = _useStyle.hashId;
47
-
48
48
  // 添加加载状态管理
49
49
  var _useState = useState(false),
50
50
  _useState2 = _slicedToArray(_useState, 2),
@@ -61,6 +61,7 @@ var VtxWangEditor = function VtxWangEditor(props) {
61
61
  setError(error.message);
62
62
  // 可以在这里添加错误上报逻辑
63
63
  }, []);
64
+ var valueRef = useRef();
64
65
  var _React$useContext = React.useContext(FormItemInputContext),
65
66
  contextStatus = _React$useContext.status,
66
67
  hasFeedback = _React$useContext.hasFeedback,
@@ -76,6 +77,8 @@ var VtxWangEditor = function VtxWangEditor(props) {
76
77
  placeholder = _props$placeholder === void 0 ? '' : _props$placeholder,
77
78
  _props$maxFileSize = props.maxFileSize,
78
79
  maxFileSize = _props$maxFileSize === void 0 ? 5 * 1024 * 1024 : _props$maxFileSize,
80
+ _props$defaultMaxFile = props.defaultMaxFileSize,
81
+ defaultMaxFileSize = _props$defaultMaxFile === void 0 ? 1024 * 1024 * 1024 : _props$defaultMaxFile,
79
82
  _props$maxNumberOfFil = props.maxNumberOfFiles,
80
83
  maxNumberOfFiles = _props$maxNumberOfFil === void 0 ? 5 : _props$maxNumberOfFil,
81
84
  _props$height = props.height,
@@ -83,22 +86,45 @@ var VtxWangEditor = function VtxWangEditor(props) {
83
86
  customStatus = props.status,
84
87
  _props$enableSanitiza = props.enableSanitization,
85
88
  enableSanitization = _props$enableSanitiza === void 0 ? true : _props$enableSanitiza,
89
+ _props$toolConfig = props.toolConfig,
90
+ toolConfig = _props$toolConfig === void 0 ? {} : _props$toolConfig,
91
+ _props$editConfig = props.editConfig,
92
+ editConfig = _props$editConfig === void 0 ? {} : _props$editConfig,
86
93
  rest = _objectWithoutProperties(props, _excluded);
94
+ var language = props !== null && props !== void 0 && props.language || (intl === null || intl === void 0 ? void 0 : intl.locale) == 'en_US' ? 'en' : 'zh-CN' || 'zh-CN'; // en || zh-CN
95
+ var TextEnum = _objectSpread({
96
+ messageOverSizeText: intl.getMessage('wangEditor.messageOverSizeText', '超过文件大小限制,最大文件大小为'),
97
+ messageUploadFailText: intl.getMessage('wangEditor.imageUploadFailed', '上传出错'),
98
+ messageInsertImgFailText: intl.getMessage('wangEditor.imageUploadFailed', '插入图片失败'),
99
+ messageInsertVideoFailText: intl.getMessage('wangEditor.imageUploadFailed', '插入视频失败'),
100
+ messageInsertAttachmentFailText: ('wangEditor.imageUploadFailed', '插入附件失败')
101
+ }, props.customEnumText);
87
102
  var mergedStatus = getMergedStatus(contextStatus, customStatus);
88
103
  var _useState5 = useState(null),
89
104
  _useState6 = _slicedToArray(_useState5, 2),
90
105
  editor = _useState6[0],
91
106
  setEditor = _useState6[1];
107
+ useEffect(function () {
108
+ if (language) {
109
+ console.log('language', language);
110
+ i18nChangeLanguage(language);
111
+ }
112
+ }, [language]);
92
113
 
93
114
  // 及时销毁 editor ,重要!
94
115
  useEffect(function () {
95
116
  return function () {
117
+ window.REGISTRY_UPLOAD_FILE = false;
118
+ if (editor == null) return;
96
119
  if (editor) {
97
120
  editor.destroy();
98
121
  setEditor(null);
99
122
  }
100
123
  };
101
124
  }, []);
125
+ useEffect(function () {
126
+ valueRef.current = value;
127
+ }, [value]);
102
128
 
103
129
  // 修改安全的粘贴处理函数
104
130
  var handleSafePaste = useCallback( /*#__PURE__*/function () {
@@ -221,10 +247,14 @@ var VtxWangEditor = function VtxWangEditor(props) {
221
247
  var newValue = editor.getHtml() || undefined;
222
248
  // 对输出内容也进行安全过滤
223
249
  var processedValue = enableSanitization && newValue !== undefined ? sanitizeHtml(newValue) : newValue;
224
- console.log('编辑器内容变化,处理前内容:', newValue);
225
- console.log('编辑器内容变化,处理后内容:', processedValue);
226
- if (processedValue !== value) {
227
- onChange(processedValue);
250
+ // console.log('编辑器内容变化,处理前内容:', newValue);
251
+ // console.log('编辑器内容变化,处理后内容:', processedValue);
252
+ if (processedValue !== valueRef.current) {
253
+ if (processedValue === undefined) {
254
+ onChange('');
255
+ } else {
256
+ onChange(processedValue);
257
+ }
228
258
  }
229
259
  } catch (error) {
230
260
  handleError(new Error('编辑器内容处理失败: ' + error.message));
@@ -232,21 +262,33 @@ var VtxWangEditor = function VtxWangEditor(props) {
232
262
  }, [value, onChange, enableSanitization, handleError]);
233
263
 
234
264
  // 编辑器配置
235
- var editorConfig = {
265
+ var editorConfig = _objectSpread(_objectSpread({}, editConfig), {}, {
236
266
  MENU_CONF: {
237
267
  // 插入图片
238
268
  uploadImage: {
239
269
  server: uploadUrl,
240
- maxFileSize: maxFileSize,
270
+ maxFileSize: defaultMaxFileSize,
241
271
  maxNumberOfFiles: maxNumberOfFiles,
242
- // 添加错误处理
243
- onError: function onError(file, err, res) {
244
- handleError(new Error(intl.getMessage('wangEditor.imageUploadFailed', '图片上传失败')));
272
+ headers: {
273
+ access_token: getToken(),
274
+ Authorization: 'Bearer ' + getToken()
245
275
  },
246
276
  // onSuccess(file, res) {},
277
+ onBeforeUpload: function onBeforeUpload(file) {
278
+ for (var key in file) {
279
+ if (file[key].size > maxFileSize) {
280
+ message.warn("".concat(TextEnum.messageOverSizeText).concat(maxFileSize / 1024 / 1024, "M"));
281
+ // return { [key]: false };
282
+ return {};
283
+ }
284
+ }
285
+ return file;
286
+ },
287
+ onError: function onError(file, err, res) {
288
+ console.log("".concat(file.name, " ").concat(TextEnum.messageUploadFailText), err, res);
289
+ },
247
290
  customInsert: function customInsert(res, insertFn) {
248
291
  try {
249
- console.log(res, insertFn);
250
292
  // res 即服务端的返回结果
251
293
  // 从 res 中找到 url alt href ,然后插入图片
252
294
  if (res.result == 0) {
@@ -254,7 +296,7 @@ var VtxWangEditor = function VtxWangEditor(props) {
254
296
  insertFn("".concat(downloadUrl).concat(item.id), item.fileName);
255
297
  });
256
298
  } else {
257
- throw new Error(intl.getMessage('wangEditor.imageInsertionFailed', '插入图片失败'));
299
+ throw new Error("".concat(TextEnum.messageInsertImgFailText));
258
300
  }
259
301
  } catch (error) {
260
302
  handleError(error);
@@ -264,8 +306,24 @@ var VtxWangEditor = function VtxWangEditor(props) {
264
306
  // 插入视频
265
307
  uploadVideo: {
266
308
  server: uploadUrl,
309
+ maxFileSize: defaultMaxFileSize,
310
+ headers: {
311
+ access_token: getToken(),
312
+ Authorization: 'Bearer ' + getToken()
313
+ },
267
314
  onError: function onError(file, err, res) {
268
- handleError(new Error(intl.getMessage('wangEditor.videoUploadFailed', '视频上传失败')));
315
+ console.log("".concat(file.name, " ").concat(TextEnum.messageUploadFailText), err, res);
316
+ },
317
+ onBeforeUpload: function onBeforeUpload(file) {
318
+ for (var key in file) {
319
+ if (file[key].size > maxFileSize) {
320
+ message.warn("".concat(TextEnum.messageOverSizeText).concat(maxFileSize / 1024 / 1024, "M"));
321
+
322
+ // return { [key]: false };
323
+ return {};
324
+ }
325
+ }
326
+ return file;
269
327
  },
270
328
  // onSuccess(file, res) {},
271
329
  // 上传成功后,用户自定义插入文件
@@ -276,7 +334,7 @@ var VtxWangEditor = function VtxWangEditor(props) {
276
334
  insertFn("".concat(downloadUrl).concat(item.id), item.fileName);
277
335
  });
278
336
  } else {
279
- throw new Error(intl.getMessage('wangEditor.videoInsertionFailed', '插入视频失败'));
337
+ throw new Error("".concat(TextEnum.messageInsertVideoFailText));
280
338
  }
281
339
  } catch (error) {
282
340
  handleError(error);
@@ -286,8 +344,12 @@ var VtxWangEditor = function VtxWangEditor(props) {
286
344
  // 插入附件
287
345
  uploadAttachment: {
288
346
  server: uploadUrl,
347
+ headers: {
348
+ access_token: getToken(),
349
+ Authorization: 'Bearer ' + getToken()
350
+ },
289
351
  onError: function onError(file, err, res) {
290
- handleError(new Error(intl.getMessage('wangEditor.attachmentUploadFailed', '附件上传失败')));
352
+ console.log("".concat(file.name, " ").concat(TextEnum.messageUploadFailText), err, res);
291
353
  },
292
354
  // onSuccess(file, res) {},
293
355
  // 上传成功后,用户自定义插入文件
@@ -295,11 +357,10 @@ var VtxWangEditor = function VtxWangEditor(props) {
295
357
  try {
296
358
  if (res.result == 0) {
297
359
  res.data.map(function (item) {
298
- console.log('插入附件:', item, insertFn);
299
360
  insertFn(item.fileName, "".concat(downloadUrl).concat(item.id));
300
361
  });
301
362
  } else {
302
- throw new Error(intl.getMessage('wangEditor.attachmentInsertionFailed', '插入附件失败'));
363
+ throw new Error("".concat(TextEnum.messageInsertAttachmentFailText));
303
364
  }
304
365
  } catch (error) {
305
366
  handleError(error);
@@ -316,16 +377,17 @@ var VtxWangEditor = function VtxWangEditor(props) {
316
377
  },
317
378
  // 使用安全的粘贴处理函数
318
379
  customPaste: handleSafePaste
319
- };
380
+ });
320
381
  // 工具栏配置
321
- var toolbarConfig = {
382
+ var toolbarConfig = _objectSpread(_objectSpread({}, toolConfig), {}, {
383
+ // 自定义工具栏
322
384
  insertKeys: {
323
385
  // 自定义插入的位置
324
386
  index: 24,
325
387
  // “上传附件”菜单
326
388
  keys: ['uploadAttachment']
327
389
  }
328
- };
390
+ });
329
391
  return /*#__PURE__*/_jsxs("div", {
330
392
  className: cls(prefixCls, getStatusClassNames(prefixCls, mergedStatus, hasFeedback), props.prefixCls),
331
393
  children: [/*#__PURE__*/_jsx(Toolbar, {
@@ -338,7 +400,10 @@ var VtxWangEditor = function VtxWangEditor(props) {
338
400
  onCreated: setEditor,
339
401
  onChange: handleEditorChange,
340
402
  mode: "default",
341
- className: cls("".concat(prefixCls, "-content"), hashId)
403
+ className: cls("".concat(prefixCls, "-content"), hashId),
404
+ style: {
405
+ height: height
406
+ }
342
407
  }, rest))]
343
408
  });
344
409
  };
@@ -356,15 +421,4 @@ VtxWangEditor.propTypes = {
356
421
  status: PropTypes.string,
357
422
  prefixCls: PropTypes.string,
358
423
  enableSanitization: PropTypes.bool // 是否启用HTML过滤
359
- };
360
-
361
- // 添加默认属性
362
- VtxWangEditor.defaultProps = {
363
- enableSanitization: true,
364
- maxFileSize: 5 * 1024 * 1024,
365
- maxNumberOfFiles: 5,
366
- height: 350,
367
- placeholder: '',
368
- downloadUrl: '/cloudFile/common/downloadFile?id=',
369
- uploadUrl: '/cloudFile/common/uploadFile'
370
424
  };