@vtx/components 4.0.0-beta.9 → 4.0.0-beta.90

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 (188) 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 +6 -6
  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 +109 -140
  28. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
  29. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  30. package/es/vtx-datagrid/ToolBar/index.js +2 -1
  31. package/es/vtx-datagrid/ToolBar/style.js +6 -3
  32. package/es/vtx-datagrid/columnState.js +91 -0
  33. package/es/vtx-datagrid/index.js +134 -37
  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 +108 -18
  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 +2 -2
  44. package/es/vtx-ellipsis-text/style/index.js +3 -1
  45. package/es/vtx-export/index.js +33 -38
  46. package/es/vtx-export-async/History.js +15 -7
  47. package/es/vtx-export-async/index.js +18 -8
  48. package/es/vtx-export-async/util.js +16 -5
  49. package/es/vtx-form-layout/FormItem.js +16 -16
  50. package/es/vtx-form-layout/style/index.js +6 -4
  51. package/es/vtx-icon/index.js +54 -45
  52. package/es/vtx-icon/index.js1 +90 -0
  53. package/es/vtx-image/style/index.js +0 -1
  54. package/es/vtx-import/index.js +143 -42
  55. package/es/vtx-import/result.js +28 -26
  56. package/es/vtx-import/style/index.js +16 -1
  57. package/es/vtx-import2/Content.js +2 -1
  58. package/es/vtx-import2/index.js +29 -19
  59. package/es/vtx-import2/style/index.js +59 -8
  60. package/es/vtx-modal/index.js +11 -6
  61. package/es/vtx-modal/style/index.js +5 -2
  62. package/es/vtx-page-layout/Basic.js +2 -2
  63. package/es/vtx-page-layout/TabLayout.js +6 -6
  64. package/es/vtx-page-layout/TableLayout.js +10 -10
  65. package/es/vtx-page-layout/TreeLayout.js +6 -6
  66. package/es/vtx-page-layout/container.js +2 -2
  67. package/es/vtx-page-layout/style/index.js +4 -2
  68. package/es/vtx-provider/index.js +33 -31
  69. package/es/vtx-provider/intl.js +9 -9
  70. package/es/vtx-provider/locale/en_GB.js +1 -1
  71. package/es/vtx-provider/locale/en_US.js +58 -4
  72. package/es/vtx-provider/locale/zh_CN.js +57 -3
  73. package/es/vtx-provider/useStyle/index.js +17 -17
  74. package/es/vtx-search/index.js +30 -12
  75. package/es/vtx-search/style/index.js +6 -3
  76. package/es/vtx-select/index.js +123 -40
  77. package/es/vtx-select/style/index.js +11 -56
  78. package/es/vtx-split-pane/Resizer.js +0 -1
  79. package/es/vtx-split-pane/SplitPane.js +42 -34
  80. package/es/vtx-split-pane/style/index.js +8 -112
  81. package/es/vtx-time-picker/index.js +27 -1
  82. package/es/vtx-transfer/Transfer.js +29 -0
  83. package/es/vtx-transfer/index.js +3 -0
  84. package/es/vtx-transfer/style/index.js +19 -0
  85. package/es/vtx-transfer-select/TransferSelect.js +143 -0
  86. package/es/vtx-transfer-select/index.js +3 -0
  87. package/es/vtx-transfer-select/style/index.js +19 -0
  88. package/es/vtx-tree/index.js +27 -9
  89. package/es/vtx-tree-select/index.js +81 -110
  90. package/es/vtx-tree-select/style/index.js +9 -3
  91. package/es/vtx-upload/FilePreview.js +2 -1
  92. package/es/vtx-wang-editor/index.js +41 -32
  93. package/es/vtx-wang-editor/style/index.less +12 -12
  94. package/lib/index.js +36 -0
  95. package/lib/utils/components/LabelIconTip/index.js +7 -7
  96. package/lib/utils/conversionMomentValue/index.js +25 -25
  97. package/lib/utils/filterSpecialCharacters.js +6 -6
  98. package/lib/utils/genCopyable/index.js +6 -6
  99. package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
  100. package/lib/utils/hooks/useDebounceFn/index.js +4 -4
  101. package/lib/utils/hooks/useDebounceValue/index.js +6 -6
  102. package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
  103. package/lib/utils/hooks/useLatest/index.js +2 -2
  104. package/lib/utils/hooks/useRefCallback/index.js +5 -5
  105. package/lib/utils/index.js +0 -7
  106. package/lib/utils/isBrowser/index.js +7 -7
  107. package/lib/utils/isUrl/index.js +4 -4
  108. package/lib/utils/merge/index.js +4 -4
  109. package/lib/utils/nanoid/index.js +4 -4
  110. package/lib/utils/omitBoolean/index.js +4 -4
  111. package/lib/utils/parseValueToMoment/index.js +4 -4
  112. package/lib/utils/proFieldParsingText/index.js +10 -10
  113. package/lib/utils/transformKeySubmitValue/index.js +57 -57
  114. package/lib/utils/useEditableArray/index.js +46 -46
  115. package/lib/utils/useEditableMap/index.js +22 -22
  116. package/lib/utils/useMediaQuery/index.js +5 -5
  117. package/lib/vtx-combogrid/Combogrid.js +5 -4
  118. package/lib/vtx-combogrid/index.js +7 -4
  119. package/lib/vtx-datagrid/Store/Provide.js +112 -142
  120. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
  121. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  122. package/lib/vtx-datagrid/ToolBar/index.js +2 -1
  123. package/lib/vtx-datagrid/ToolBar/style.js +6 -3
  124. package/lib/vtx-datagrid/columnState.js +100 -0
  125. package/lib/vtx-datagrid/index.js +134 -37
  126. package/lib/vtx-datagrid/mergeComponents.js +21 -0
  127. package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
  128. package/lib/vtx-datagrid/style/index.js +108 -18
  129. package/lib/vtx-datagrid/style/index.less +242 -242
  130. package/lib/vtx-date-picker/QdatePicker.js +1 -1
  131. package/lib/vtx-date-picker/style/index.less +39 -39
  132. package/lib/vtx-descriptions/Descriptions.js +38 -0
  133. package/lib/vtx-descriptions/index.js +15 -0
  134. package/lib/vtx-descriptions/style/index.js +25 -0
  135. package/lib/vtx-ellipsis-text/index.js +2 -2
  136. package/lib/vtx-ellipsis-text/style/index.js +3 -1
  137. package/lib/vtx-export/index.js +34 -39
  138. package/lib/vtx-export-async/History.js +14 -8
  139. package/lib/vtx-export-async/index.js +18 -8
  140. package/lib/vtx-export-async/util.js +16 -5
  141. package/lib/vtx-form-layout/FormItem.js +16 -16
  142. package/lib/vtx-form-layout/style/index.js +6 -4
  143. package/lib/vtx-icon/index.js +54 -52
  144. package/lib/vtx-icon/index.js1 +90 -0
  145. package/lib/vtx-image/style/index.js +0 -1
  146. package/lib/vtx-import/index.js +141 -43
  147. package/lib/vtx-import/result.js +29 -27
  148. package/lib/vtx-import/style/index.js +16 -1
  149. package/lib/vtx-import2/Content.js +2 -1
  150. package/lib/vtx-import2/index.js +29 -19
  151. package/lib/vtx-import2/style/index.js +59 -8
  152. package/lib/vtx-modal/index.js +11 -6
  153. package/lib/vtx-modal/style/index.js +5 -2
  154. package/lib/vtx-page-layout/Basic.js +2 -2
  155. package/lib/vtx-page-layout/TabLayout.js +6 -6
  156. package/lib/vtx-page-layout/TableLayout.js +10 -10
  157. package/lib/vtx-page-layout/TreeLayout.js +6 -6
  158. package/lib/vtx-page-layout/container.js +2 -2
  159. package/lib/vtx-page-layout/style/index.js +4 -2
  160. package/lib/vtx-provider/index.js +33 -31
  161. package/lib/vtx-provider/intl.js +9 -9
  162. package/lib/vtx-provider/locale/en_GB.js +1 -1
  163. package/lib/vtx-provider/locale/en_US.js +58 -4
  164. package/lib/vtx-provider/locale/zh_CN.js +57 -3
  165. package/lib/vtx-provider/useStyle/index.js +17 -17
  166. package/lib/vtx-search/index.js +32 -12
  167. package/lib/vtx-search/style/index.js +6 -3
  168. package/lib/vtx-select/index.js +125 -42
  169. package/lib/vtx-select/style/index.js +11 -56
  170. package/lib/vtx-split-pane/Resizer.js +0 -1
  171. package/lib/vtx-split-pane/SplitPane.js +40 -31
  172. package/lib/vtx-split-pane/style/index.js +8 -112
  173. package/lib/vtx-time-picker/index.js +27 -1
  174. package/lib/vtx-transfer/Transfer.js +38 -0
  175. package/lib/vtx-transfer/index.js +15 -0
  176. package/lib/vtx-transfer/style/index.js +25 -0
  177. package/lib/vtx-transfer-select/TransferSelect.js +151 -0
  178. package/lib/vtx-transfer-select/index.js +15 -0
  179. package/lib/vtx-transfer-select/style/index.js +25 -0
  180. package/lib/vtx-tree/index.js +27 -9
  181. package/lib/vtx-tree-select/index.js +81 -112
  182. package/lib/vtx-tree-select/style/index.js +9 -3
  183. package/lib/vtx-upload/FilePreview.js +2 -1
  184. package/lib/vtx-wang-editor/index.js +39 -30
  185. package/lib/vtx-wang-editor/style/index.less +12 -12
  186. package/package.json +239 -238
  187. package/es/utils/hooks/useFetchData/index.js +0 -82
  188. package/lib/utils/hooks/useFetchData/index.js +0 -89
@@ -5,21 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = exports.VtxTreeSelect = void 0;
8
- var _antd = require("antd");
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
8
  var _icons = require("@ant-design/icons");
9
+ var _ahooks = require("ahooks");
10
+ var _antd = require("antd");
12
11
  var _classnames = _interopRequireDefault(require("classnames"));
13
12
  var _pull = _interopRequireDefault(require("lodash-es/pull"));
14
- var _index = require("./style/index");
15
- var _ahooks = require("ahooks");
13
+ var _propTypes = _interopRequireDefault(require("prop-types"));
14
+ var _react = require("react");
15
+ var _vtxIcon = _interopRequireDefault(require("../vtx-icon"));
16
16
  var _vtxProvider = require("../vtx-provider");
17
+ var _index = require("./style/index");
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
- var _excluded = ["multiple", "treeData", "placeholder", "treeCheckable", "disabled", "style"],
19
- _excluded2 = ["children"];
19
+ var _excluded = ["multiple", "treeData", "placeholder", "treeCheckable", "disabled", "style", "fieldNames", "onChange", "labelInValue"];
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
- 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); }
22
- 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; }
23
21
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
24
22
  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."); }
25
23
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -29,6 +27,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
29
27
  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; }
30
28
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
31
29
  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); }
30
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
32
31
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
32
  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."); }
34
33
  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); }
@@ -45,7 +44,18 @@ var VtxTreeSelect = exports.VtxTreeSelect = function VtxTreeSelect(_ref) {
45
44
  _ref$disabled = _ref.disabled,
46
45
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
47
46
  style = _ref.style,
47
+ _ref$fieldNames = _ref.fieldNames,
48
+ fieldNames = _ref$fieldNames === void 0 ? {
49
+ label: 'title',
50
+ value: 'value',
51
+ key: 'value',
52
+ children: 'children'
53
+ } : _ref$fieldNames,
54
+ onChange = _ref.onChange,
55
+ labelInValue = _ref.labelInValue,
48
56
  props = _objectWithoutProperties(_ref, _excluded);
57
+ // checkable 状态下节点选择完全受控(父子节点选中状态不再关联),会使得 labelInValue 强制为 true
58
+ var _labelInValue = treeCheckable && props.treeCheckStrictly ? true : labelInValue;
49
59
  var intl = (0, _vtxProvider.useIntl)();
50
60
  var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
51
61
  getPrefixCls = _useContext.getPrefixCls;
@@ -71,11 +81,9 @@ var VtxTreeSelect = exports.VtxTreeSelect = function VtxTreeSelect(_ref) {
71
81
  }
72
82
  (function genNodes(nodes) {
73
83
  nodes.map(function (item) {
74
- var children = item.children,
75
- rest = _objectWithoutProperties(item, _excluded2);
76
- keyNodesMapping[item.value || item.key] = _objectSpread(_objectSpread({}, rest), {}, {
77
- id: item.value || item.key
78
- });
84
+ var rest = Object.assign({}, (_objectDestructuringEmpty(item), item));
85
+ var children = item[fieldNames.children];
86
+ keyNodesMapping[item[fieldNames.value]] = _objectSpread(_objectSpread({}, rest), {}, _defineProperty(_defineProperty({}, fieldNames.value, item[fieldNames.value]), fieldNames.label, item[fieldNames.label]));
79
87
  if (Array.isArray(children) && children.length > 0) {
80
88
  genNodes(children);
81
89
  }
@@ -84,19 +92,17 @@ var VtxTreeSelect = exports.VtxTreeSelect = function VtxTreeSelect(_ref) {
84
92
  return keyNodesMapping;
85
93
  }, [treeData]);
86
94
  var clear = function clear() {
87
- var _props$onChange;
88
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, [], [], {});
95
+ onChangeTreeSelect === null || onChangeTreeSelect === void 0 || onChangeTreeSelect([], [], {});
89
96
  };
90
97
  var clearKey = function clearKey(id) {
91
- var _props$onChange2;
92
98
  var newValue = _toConsumableArray(props.value);
93
99
  (0, _pull.default)(newValue, id);
94
100
  var label = newValue.map(function (item) {
95
- return keyNodesMapping[item].title;
101
+ return keyNodesMapping[item[fieldNames.label]];
96
102
  });
97
- (_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 || _props$onChange2.call(props, newValue, label, {});
103
+ onChangeTreeSelect === null || onChangeTreeSelect === void 0 || onChangeTreeSelect(newValue, label, {});
98
104
  };
99
- var selectedNodes = (0, _react.useMemo)(function () {
105
+ var getSelectedNodes = function getSelectedNodes(value) {
100
106
  var value_arr = function (val) {
101
107
  if (Array.isArray(val)) {
102
108
  return val;
@@ -105,90 +111,29 @@ var VtxTreeSelect = exports.VtxTreeSelect = function VtxTreeSelect(_ref) {
105
111
  } else {
106
112
  return [];
107
113
  }
108
- }(props.value);
114
+ }(value);
109
115
  var selectedNodes = value_arr.filter(function (k) {
110
- return k in keyNodesMapping;
116
+ if (_labelInValue) {
117
+ return k.value in keyNodesMapping;
118
+ } else {
119
+ return k in keyNodesMapping;
120
+ }
111
121
  }).map(function (item) {
112
- return {
113
- id: item,
114
- name: keyNodesMapping[item].title
115
- };
122
+ if (_labelInValue) {
123
+ return _objectSpread({}, keyNodesMapping[item.value]);
124
+ }
125
+ return _objectSpread({}, keyNodesMapping[item]);
116
126
  });
117
127
  return selectedNodes;
128
+ };
129
+ var selectedNodes = (0, _react.useMemo)(function () {
130
+ return getSelectedNodes(props.value);
118
131
  }, [props.value, keyNodesMapping]);
119
132
  (0, _react.useEffect)(function () {
120
133
  if (size !== null && size !== void 0 && size.width) {
121
134
  setPopWidth(size === null || size === void 0 ? void 0 : size.width);
122
135
  }
123
136
  }, [size === null || size === void 0 ? void 0 : size.width]);
124
-
125
- // let suffixIconObj = {};
126
- // if (multiple || treeCheckable) {
127
- // suffixIconObj.suffixIcon = (
128
- // <Popover
129
- // content={
130
- // <>
131
- // <div
132
- // className={classnames(`${prefixCls}-count-head`, hashId,)}
133
-
134
- // >
135
- // <span>已选择:{selectedNodes.length}</span>
136
- // <span
137
- // className={classnames(
138
- // selectedNodes.length > 0 && !disabled
139
- // ? 'clear-count'
140
- // : 'disabled-count',
141
- // )}
142
- // onClick={e => {
143
- // if (!disabled) {
144
- // e.stopPropagation();
145
- // clear();
146
- // }
147
- // }}
148
- // >
149
- // 清空已选项
150
- // </span>
151
- // </div>
152
- // {selectedNodes.length > 0 ? (
153
- // selectedNodes.map(item => (
154
- // <Tag
155
- // key={`tab-${item.id}`}
156
- // closable={!disabled}
157
- // onClose={e => {
158
- // e.stopPropagation();
159
- // clearKey(item.id);
160
- // }}
161
- // style={{ marginBottom: '5px' }}
162
- // >
163
- // {item.name && item.name.length > 20
164
- // ? `${item.name.slice(0, 20)}...`
165
- // : item.name}
166
- // </Tag>
167
- // ))
168
- // ) : (
169
- // <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
170
- // )}
171
- // </>
172
- // }
173
- // placement="bottomRight"
174
- // trigger="click"
175
- // // overlayStyle={{ width: popWidth }}
176
- // styles={{ root: { width: popWidth } }}
177
- // >
178
- // <Button
179
- // className={classnames(`${prefixCls}-count`, hashId,)}
180
-
181
- // icon={<MoreOutlined />}
182
- // size="default"
183
- // onClick={e => {
184
- // console.log('click', e)
185
- // e.stopPropagation();
186
- // }}
187
- // />
188
- // </Popover>
189
- // );
190
- // }
191
-
192
137
  var popoverContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
193
138
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
194
139
  className: (0, _classnames.default)("".concat(prefixCls, "-count-head"), hashId),
@@ -204,22 +149,33 @@ var VtxTreeSelect = exports.VtxTreeSelect = function VtxTreeSelect(_ref) {
204
149
  },
205
150
  children: intl.getMessage('treeSelect.clearSelectedItems', '清空已选项')
206
151
  })]
207
- }), selectedNodes.length > 0 ? selectedNodes.map(function (item) {
208
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tag, {
209
- closable: !disabled,
210
- onClose: function onClose(e) {
211
- e.stopPropagation();
212
- clearKey(item.id);
213
- },
214
- style: {
215
- marginBottom: 5
216
- },
217
- children: item.name.length > 20 ? "".concat(item.name.slice(0, 20), "...") : item.name
218
- }, "tab-".concat(item.id));
219
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Empty, {
220
- image: _antd.Empty.PRESENTED_IMAGE_SIMPLE
152
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
153
+ className: (0, _classnames.default)("".concat(prefixCls, "-all-list"), hashId),
154
+ children: selectedNodes.length > 0 ? selectedNodes.map(function (item) {
155
+ var _item$fieldNames$labe;
156
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tag, {
157
+ closable: !disabled,
158
+ onClose: function onClose(e) {
159
+ e.stopPropagation();
160
+ clearKey(item[fieldNames.value]);
161
+ },
162
+ styles: {
163
+ root: {
164
+ marginBottom: 5,
165
+ marginRight: 5
166
+ }
167
+ },
168
+ 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]
169
+ }, "tab-".concat(item[fieldNames.value]));
170
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Empty, {
171
+ image: _antd.Empty.PRESENTED_IMAGE_SIMPLE
172
+ })
221
173
  })]
222
174
  });
175
+ var onChangeTreeSelect = function onChangeTreeSelect(value, label, extra) {
176
+ extra.list = getSelectedNodes(value);
177
+ onChange === null || onChange === void 0 || onChange(value, label, extra);
178
+ };
223
179
  return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
224
180
  ref: ref,
225
181
  style: style,
@@ -228,14 +184,20 @@ var VtxTreeSelect = exports.VtxTreeSelect = function VtxTreeSelect(_ref) {
228
184
  style: {
229
185
  width: '100%'
230
186
  },
231
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.TreeSelect, _objectSpread({
232
- showSearch: true,
187
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.TreeSelect, _objectSpread(_objectSpread({
188
+ showSearch: {
189
+ treeNodeFilterProp: fieldNames.label
190
+ },
233
191
  placeholder: placeholder,
234
192
  treeData: treeData,
235
193
  treeLine: {
236
194
  showLeafIcon: false
237
195
  },
238
196
  switcherIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DownOutlined, {}),
197
+ suffixIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vtxIcon.default, {
198
+ type: "downOutlined",
199
+ fileType: "svg"
200
+ }),
239
201
  multiple: multiple,
240
202
  treeCheckable: treeCheckable,
241
203
  className: (0, _classnames.default)("".concat(prefixCls, " ").concat(props.prefixCls), hashId),
@@ -252,8 +214,15 @@ var VtxTreeSelect = exports.VtxTreeSelect = function VtxTreeSelect(_ref) {
252
214
  popup: (0, _classnames.default)("".concat(prefixCls, "-popup"), hashId)
253
215
  },
254
216
  maxTagCount: "responsive",
255
- treeDefaultExpandAll: true
256
- }, props)), (multiple || treeCheckable) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Popover, {
217
+ treeDefaultExpandAll: true,
218
+ fieldNames: fieldNames,
219
+ labelInValue: _labelInValue,
220
+ disabled: disabled
221
+ }, props), {}, {
222
+ onChange: function onChange(value, label, extra) {
223
+ return onChangeTreeSelect(value, label, extra, selectedNodes);
224
+ }
225
+ })), (multiple || treeCheckable) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Popover, {
257
226
  open: popOpen,
258
227
  onOpenChange: setPopOpen,
259
228
  placement: "bottomRight",
@@ -13,7 +13,7 @@ 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 genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
15
15
  var componentCls = token.componentCls;
16
- return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-popover', {
16
+ return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-popover', {
17
17
  minWidth: '200px',
18
18
  height: '300px',
19
19
  overflow: 'auto',
@@ -34,14 +34,16 @@ var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
34
34
  color: '@input-placeholder-color'
35
35
  }), '&-count', {
36
36
  marginRight: '-12px'
37
- })), "".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', {
37
+ })), "".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', {
38
38
  color: '#1890ff'
39
39
  }), '.ant-select-tree .ant-select-tree-node-content-wrapper .ant-select-tree-node-selected', {
40
40
  backgroundColor: '#e6f7ff'
41
+ }), '.ant-select-tree .ant-select-tree-list-holder-inner .ant-select-tree-treenode .ant-select-tree-node-content-wrapper', {
42
+ flex: 1
41
43
  }))), "".concat(componentCls, "-count-head"), {
42
44
  display: 'flex',
43
45
  justifyContent: 'space-between',
44
- marginBottom: '5px',
46
+ marginBottom: 5,
45
47
  '.disabled-count': {
46
48
  color: '#aaa',
47
49
  cursor: 'not-allowed'
@@ -51,6 +53,9 @@ var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
51
53
  }, '&:hover', {
52
54
  color: '#40a9ff'
53
55
  })
56
+ }), "".concat(componentCls, "-all-list"), {
57
+ maxHeight: 300,
58
+ overflowY: "auto"
54
59
  }), "".concat(componentCls, "-outer"), {
55
60
  position: 'relative',
56
61
  display: 'inline-flex',
@@ -63,6 +68,7 @@ var genVtxTreeSelectStyle = function genVtxTreeSelectStyle(token) {
63
68
  color: token.colorTextDescription,
64
69
  display: 'inline-flex',
65
70
  alignItems: 'center',
71
+ width: token.controlHeight,
66
72
  '&:hover': {
67
73
  color: token.colorPrimary
68
74
  }
@@ -8,6 +8,7 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _antd = require("antd");
10
10
  var _vtxProvider = require("../vtx-provider");
11
+ var _vtxModal = _interopRequireDefault(require("../vtx-modal"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14
  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); }
@@ -82,7 +83,7 @@ function Preview(props) {
82
83
  timer && clearTimeout(timer);
83
84
  onCancel();
84
85
  };
85
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Modal, _objectSpread(_objectSpread({}, modalProps), {}, {
86
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_vtxModal.default, _objectSpread(_objectSpread({}, modalProps), {}, {
86
87
  children: [type == 'file' ? /*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
87
88
  src: url,
88
89
  style: {
@@ -11,8 +11,8 @@ var _editorForReact = require("@wangeditor/editor-for-react");
11
11
  var _pluginUploadAttachment = _interopRequireDefault(require("@wangeditor/plugin-upload-attachment"));
12
12
  var _editor = require("@wangeditor/editor");
13
13
  var _getToken = _interopRequireDefault(require("../utils/getToken"));
14
- var _wangEditorUtil = require("./wangEditorUtil");
15
14
  var _antd = require("antd");
15
+ var _wangEditorUtil = require("./wangEditorUtil");
16
16
  var _classnames = _interopRequireDefault(require("classnames"));
17
17
  var _index = require("./style/index");
18
18
  var _context2 = require("antd/es/form/context");
@@ -23,14 +23,14 @@ var _excluded = ["value", "onChange", "downloadUrl", "uploadUrl", "placeholder",
23
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
24
  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); }
25
25
  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; }
26
+ 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; }
27
+ 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); } }
28
+ 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); }); }; }
26
29
  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; }
27
30
  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; }
28
31
  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; }
29
32
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
30
33
  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); }
31
- 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; }
32
- 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); } }
33
- 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); }); }; }
34
34
  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; }
35
35
  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; }
36
36
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -50,7 +50,6 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
50
50
  var _useStyle = (0, _index.useStyle)(prefixCls),
51
51
  wrapSSR = _useStyle.wrapSSR,
52
52
  hashId = _useStyle.hashId;
53
-
54
53
  // 添加加载状态管理
55
54
  var _useState = (0, _react.useState)(false),
56
55
  _useState2 = _slicedToArray(_useState, 2),
@@ -67,6 +66,7 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
67
66
  setError(error.message);
68
67
  // 可以在这里添加错误上报逻辑
69
68
  }, []);
69
+ var valueRef = (0, _react.useRef)();
70
70
  var _React$useContext = _react.default.useContext(_context2.FormItemInputContext),
71
71
  contextStatus = _React$useContext.status,
72
72
  hasFeedback = _React$useContext.hasFeedback,
@@ -96,11 +96,25 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
96
96
  _props$editConfig = props.editConfig,
97
97
  editConfig = _props$editConfig === void 0 ? {} : _props$editConfig,
98
98
  rest = _objectWithoutProperties(props, _excluded);
99
+ 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
100
+ var TextEnum = _objectSpread({
101
+ messageOverSizeText: intl.getMessage('wangEditor.messageOverSizeText', '超过文件大小限制,最大文件大小为'),
102
+ messageUploadFailText: intl.getMessage('wangEditor.imageUploadFailed', '上传出错'),
103
+ messageInsertImgFailText: intl.getMessage('wangEditor.imageUploadFailed', '插入图片失败'),
104
+ messageInsertVideoFailText: intl.getMessage('wangEditor.imageUploadFailed', '插入视频失败'),
105
+ messageInsertAttachmentFailText: ('wangEditor.imageUploadFailed', '插入附件失败')
106
+ }, props.customEnumText);
99
107
  var mergedStatus = (0, _statusUtils.getMergedStatus)(contextStatus, customStatus);
100
108
  var _useState5 = (0, _react.useState)(null),
101
109
  _useState6 = _slicedToArray(_useState5, 2),
102
110
  editor = _useState6[0],
103
111
  setEditor = _useState6[1];
112
+ (0, _react.useEffect)(function () {
113
+ if (language) {
114
+ console.log('language', language);
115
+ (0, _editor.i18nChangeLanguage)(language);
116
+ }
117
+ }, [language]);
104
118
 
105
119
  // 及时销毁 editor ,重要!
106
120
  (0, _react.useEffect)(function () {
@@ -113,6 +127,9 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
113
127
  }
114
128
  };
115
129
  }, []);
130
+ (0, _react.useEffect)(function () {
131
+ valueRef.current = value;
132
+ }, [value]);
116
133
 
117
134
  // 修改安全的粘贴处理函数
118
135
  var handleSafePaste = (0, _react.useCallback)( /*#__PURE__*/function () {
@@ -235,10 +252,14 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
235
252
  var newValue = editor.getHtml() || undefined;
236
253
  // 对输出内容也进行安全过滤
237
254
  var processedValue = enableSanitization && newValue !== undefined ? (0, _wangEditorUtil.sanitizeHtml)(newValue) : newValue;
238
- console.log('编辑器内容变化,处理前内容:', newValue);
239
- console.log('编辑器内容变化,处理后内容:', processedValue);
240
- if (processedValue !== value) {
241
- onChange(processedValue);
255
+ // console.log('编辑器内容变化,处理前内容:', newValue);
256
+ // console.log('编辑器内容变化,处理后内容:', processedValue);
257
+ if (processedValue !== valueRef.current) {
258
+ if (processedValue === undefined) {
259
+ onChange('');
260
+ } else {
261
+ onChange(processedValue);
262
+ }
242
263
  }
243
264
  } catch (error) {
244
265
  handleError(new Error('编辑器内容处理失败: ' + error.message));
@@ -261,7 +282,7 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
261
282
  onBeforeUpload: function onBeforeUpload(file) {
262
283
  for (var key in file) {
263
284
  if (file[key].size > maxFileSize) {
264
- message.warn("\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236\uFF0C\u6700\u5927\u6587\u4EF6\u5927\u5C0F\u4E3A".concat(maxFileSize / 1024 / 1024, "M"));
285
+ _antd.message.warn("".concat(TextEnum.messageOverSizeText).concat(maxFileSize / 1024 / 1024, "M"));
265
286
  // return { [key]: false };
266
287
  return {};
267
288
  }
@@ -269,11 +290,10 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
269
290
  return file;
270
291
  },
271
292
  onError: function onError(file, err, res) {
272
- handleError(new Error(intl.getMessage('wangEditor.imageUploadFailed', '图片上传失败')));
293
+ console.log("".concat(file.name, " ").concat(TextEnum.messageUploadFailText), err, res);
273
294
  },
274
295
  customInsert: function customInsert(res, insertFn) {
275
296
  try {
276
- console.log(res, insertFn);
277
297
  // res 即服务端的返回结果
278
298
  // 从 res 中找到 url alt href ,然后插入图片
279
299
  if (res.result == 0) {
@@ -281,7 +301,7 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
281
301
  insertFn("".concat(downloadUrl).concat(item.id), item.fileName);
282
302
  });
283
303
  } else {
284
- throw new Error(intl.getMessage('wangEditor.imageInsertionFailed', '插入图片失败'));
304
+ throw new Error("".concat(TextEnum.messageInsertImgFailText));
285
305
  }
286
306
  } catch (error) {
287
307
  handleError(error);
@@ -297,12 +317,13 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
297
317
  Authorization: 'Bearer ' + (0, _getToken.default)()
298
318
  },
299
319
  onError: function onError(file, err, res) {
300
- handleError(new Error(intl.getMessage('wangEditor.videoUploadFailed', '视频上传失败')));
320
+ console.log("".concat(file.name, " ").concat(TextEnum.messageUploadFailText), err, res);
301
321
  },
302
322
  onBeforeUpload: function onBeforeUpload(file) {
303
323
  for (var key in file) {
304
324
  if (file[key].size > maxFileSize) {
305
- message.warn("\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236\uFF0C\u6700\u5927\u6587\u4EF6\u5927\u5C0F\u4E3A".concat(maxFileSize / 1024 / 1024, "M"));
325
+ _antd.message.warn("".concat(TextEnum.messageOverSizeText).concat(maxFileSize / 1024 / 1024, "M"));
326
+
306
327
  // return { [key]: false };
307
328
  return {};
308
329
  }
@@ -318,7 +339,7 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
318
339
  insertFn("".concat(downloadUrl).concat(item.id), item.fileName);
319
340
  });
320
341
  } else {
321
- throw new Error(intl.getMessage('wangEditor.videoInsertionFailed', '插入视频失败'));
342
+ throw new Error("".concat(TextEnum.messageInsertVideoFailText));
322
343
  }
323
344
  } catch (error) {
324
345
  handleError(error);
@@ -333,7 +354,7 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
333
354
  Authorization: 'Bearer ' + (0, _getToken.default)()
334
355
  },
335
356
  onError: function onError(file, err, res) {
336
- handleError(new Error(intl.getMessage('wangEditor.attachmentUploadFailed', '附件上传失败')));
357
+ console.log("".concat(file.name, " ").concat(TextEnum.messageUploadFailText), err, res);
337
358
  },
338
359
  // onSuccess(file, res) {},
339
360
  // 上传成功后,用户自定义插入文件
@@ -341,11 +362,10 @@ var VtxWangEditor = exports.VtxWangEditor = function VtxWangEditor(props) {
341
362
  try {
342
363
  if (res.result == 0) {
343
364
  res.data.map(function (item) {
344
- console.log('插入附件:', item, insertFn);
345
365
  insertFn(item.fileName, "".concat(downloadUrl).concat(item.id));
346
366
  });
347
367
  } else {
348
- throw new Error(intl.getMessage('wangEditor.attachmentInsertionFailed', '插入附件失败'));
368
+ throw new Error("".concat(TextEnum.messageInsertAttachmentFailText));
349
369
  }
350
370
  } catch (error) {
351
371
  handleError(error);
@@ -405,15 +425,4 @@ VtxWangEditor.propTypes = {
405
425
  status: _propTypes.default.string,
406
426
  prefixCls: _propTypes.default.string,
407
427
  enableSanitization: _propTypes.default.bool // 是否启用HTML过滤
408
- };
409
-
410
- // 添加默认属性
411
- VtxWangEditor.defaultProps = {
412
- enableSanitization: true,
413
- maxFileSize: 5 * 1024 * 1024,
414
- maxNumberOfFiles: 5,
415
- height: 350,
416
- placeholder: '',
417
- downloadUrl: '/cloudFile/common/downloadFile?id=',
418
- uploadUrl: '/cloudFile/common/uploadFile'
419
428
  };
@@ -1,12 +1,12 @@
1
-
2
-
3
- .vtx-wang-editor {
4
- border: @border-width-base @border-style-base @border-color-base;
5
- &.w-e-full-screen-container {
6
- z-index: 999999;
7
- }
8
- &-content {
9
- height: 350px;
10
- border-top: @border-width-base @border-style-base @border-color-base;
11
- }
12
- }
1
+
2
+
3
+ .vtx-wang-editor {
4
+ border: @border-width-base @border-style-base @border-color-base;
5
+ &.w-e-full-screen-container {
6
+ z-index: 999999;
7
+ }
8
+ &-content {
9
+ height: 350px;
10
+ border-top: @border-width-base @border-style-base @border-color-base;
11
+ }
12
+ }