fan-standard-comp 3.2.3 → 3.2.5

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.
@@ -13,244 +13,264 @@ var _react = _interopRequireWildcard(require("react"));
13
13
  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); }
14
14
  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 && {}.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; }
15
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- 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; }
17
- 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; }
18
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
19
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
20
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
21
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
22
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
23
- 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); }
24
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
25
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
26
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
27
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
28
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
29
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
30
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } /**
31
- * Created by S.C. on 2019/11/16.
16
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
17
+ 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."); }
18
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
19
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
20
+ 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; } }
21
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /**
22
+ * Created by S.C. on 2024/10/10
32
23
  */
33
24
  var TextArea = _input.default.TextArea;
34
25
  var isIE = !!document.all;
35
- var VarTemplate = /*#__PURE__*/function (_Component) {
36
- function VarTemplate(props) {
37
- var _this;
38
- _classCallCheck(this, VarTemplate);
39
- _this = _callSuper(this, VarTemplate, [props]);
40
- _this.handleBlur = function (e) {
41
- _this.getCurrentCursor();
42
- };
43
- _this.handleFocus = function (e) {
44
- // console.log('获取焦点')
45
- // this.$emit('focus', event)
46
- };
47
- _this.handleInputChange = function (e) {
48
- var onChange = _this.props.onChange;
49
- _this.getCurrentCursor();
50
- _this.setState({
51
- currentContent: e.target.value,
52
- startNum: e.target.value.length,
53
- endNum: e.target.value.length,
54
- wordCount: e.target.value.length
55
- });
56
- if (onChange) onChange(e.target.value);
57
- };
58
- _this.setTagWords = function (key) {
59
- var onChange = _this.props.onChange;
60
- var _this$state = _this.state,
61
- currentContent = _this$state.currentContent,
62
- startNum = _this$state.startNum,
63
- endNum = _this$state.endNum;
64
- _this.setState({
65
- currentContent: _this.insertContent(currentContent, key, startNum, endNum),
66
- startNum: startNum + key.length,
67
- // 光标起始位置累加
68
- endNum: endNum + key.length,
69
- // 光标起始位置累加
70
- wordCount: _this.insertContent(currentContent, key, startNum, endNum).length
71
- });
72
- if (onChange) onChange(_this.insertContent(currentContent, key, startNum, endNum));
73
- setTimeout(function () {
74
- _this.moveToCursor(); // 重新定位光标
75
- });
76
- };
77
- /**
78
- * 指定位置插入标签占位符字符串,当光标有选中一段字符时,会将直接将其替换
79
- * @param {str} 需要做插入的字符串
80
- * @param {insertStr} 需要插入的字符串
81
- * @param {start} 指定开始位置
82
- * @param {end} 指定结束位置
83
- * */
84
- _this.insertContent = function (str, insertStr, start, end) {
85
- if (start !== end) {
86
- var _prevStr = str.substring(0, start);
87
- var _nextStr = str.substring(end, str.length);
88
- return _prevStr + insertStr + _nextStr;
89
- }
90
- var prevStr = str.substring(0, start);
91
- var nextStr = str.substring(start, str.length);
92
- return prevStr + insertStr + nextStr;
93
- };
94
- /**
95
- * 获取当前(上一次)光标的位置
96
- * @参考 http://blog.csdn.net/chadcao/article/details/6575927
97
- * @TODO IE、火狐浏览器下未验证
98
- */
99
- _this.getCurrentCursor = function () {
100
- var start = 0;
101
- var end = 0;
102
- var oTextarea = _this.content.querySelector('textarea'); // 获取textarea标签
103
- if (isIE) {
104
- // selection 当前激活选中区,即高亮文本块,和/或文当中用户可执行某些操作的其它元素。
105
- // createRange 从当前文本选中区中创建 TextRange 对象,
106
- // 或从控件选中区中创建 controlRange 集合。
107
- var sTextRange = document.selection.createRange();
108
- // 判断选中的是不是textarea对象
109
- if (sTextRange.parentElement() === oTextarea) {
110
- // 创建一个TextRange对象
111
- var oTextRange = document.body.createTextRange();
112
- // 移动文本范围以便范围的开始和结束位置能够完全包含给定元素的文本。
113
- oTextRange.moveToElementText(oTextarea);
114
- // 这里我们比较oTextRange和sTextRange的开头,的到选中区域的开头位置
115
- for (start = 0; oTextRange.compareEndPoints('StartToStart', sTextRange) < 0; start++) {
116
- oTextRange.moveStart('character', 1);
117
- }
118
- // 需要计算一下\n的数目(按字符移动的方式不计\n,所以这里加上)
119
- for (var i = 0; i <= start; i++) {
120
- if (oTextarea.value.charAt(i) === '\n') {
121
- start++;
122
- }
123
- }
124
- // 再计算一次结束的位置
125
- oTextRange.moveToElementText(oTextarea);
126
- for (end = 0; oTextRange.compareEndPoints('StartToEnd', sTextRange) < 0; end++) {
127
- oTextRange.moveStart('character', 1);
128
- }
129
- for (var j = 0; j <= end; j++) {
130
- if (oTextarea.value.charAt(j) === '\n') {
131
- end++;
132
- }
133
- }
26
+ var VarTemplate = function VarTemplate(props) {
27
+ var value = props.value,
28
+ size = props.size,
29
+ style = props.style,
30
+ tags = props.tags,
31
+ disabled = props.disabled,
32
+ fieldStatus = props.fieldStatus,
33
+ _props$tagsOptionName = props.tagsOptionName,
34
+ tagsOptionName = _props$tagsOptionName === void 0 ? {
35
+ key: 'key',
36
+ label: 'label',
37
+ value: 'value'
38
+ } : _props$tagsOptionName,
39
+ showCountTip = props.showCountTip,
40
+ onChange = props.onChange;
41
+ var contentRef = (0, _react.useRef)();
42
+ var _useState = (0, _react.useState)({
43
+ currentContent: '',
44
+ startNum: 0,
45
+ endNum: 0,
46
+ wordCount: 0
47
+ }),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ vartData = _useState2[0],
50
+ setVartData = _useState2[1];
51
+ var handleBlur = function handleBlur() {
52
+ getCurrentCursor();
53
+ };
54
+ var handleFocus = function handleFocus() {
55
+ // console.log('获取焦点', event)
56
+ };
57
+ var handleInputChange = function handleInputChange(e) {
58
+ var eValue = e === null || e === void 0 ? void 0 : e.target.value;
59
+ getCurrentCursor();
60
+ setVartData({
61
+ currentContent: eValue,
62
+ startNum: eValue.length,
63
+ endNum: eValue.length,
64
+ wordCount: eValue.length
65
+ });
66
+ if (onChange) onChange(eValue);
67
+ };
68
+ var setTagWords = (0, _react.useCallback)(function (key) {
69
+ var currentContent = vartData.currentContent,
70
+ startNum = vartData.startNum,
71
+ endNum = vartData.endNum;
72
+ setVartData({
73
+ currentContent: insertContent(currentContent, key, startNum, endNum),
74
+ startNum: startNum + key.length,
75
+ endNum: endNum + key.length,
76
+ wordCount: insertContent(currentContent, key, startNum, endNum).length
77
+ });
78
+ if (onChange) onChange(insertContent(currentContent, key, startNum, endNum));
79
+ setTimeout(function () {
80
+ moveToCursor(key.length); // 重新定位光标
81
+ });
82
+ }, [vartData]);
83
+ /**
84
+ * 指定位置插入标签占位符字符串,当光标有选中一段字符时,会将直接将其替换
85
+ * @param {str} 需要做插入的字符串
86
+ * @param {insertStr} 需要插入的字符串
87
+ * @param {start} 指定开始位置
88
+ * @param {end} 指定结束位置
89
+ * */
90
+ var insertContent = function insertContent(str, insertStr, start, end) {
91
+ if (start !== end) {
92
+ var _prevStr = str.substring(0, start);
93
+ var _nextStr = str.substring(end, str.length);
94
+ return _prevStr + insertStr + _nextStr;
95
+ }
96
+ var prevStr = str.substring(0, start);
97
+ var nextStr = str.substring(start, str.length);
98
+ return prevStr + insertStr + nextStr;
99
+ };
100
+ /**
101
+ * 获取当前(上一次)光标的位置
102
+ * @参考 http://blog.csdn.net/chadcao/article/details/6575927
103
+ * @TODO IE、火狐浏览器下未验证
104
+ */
105
+ var getCurrentCursor = (0, _react.useCallback)(function () {
106
+ var _a;
107
+ var start = 0;
108
+ var end = 0;
109
+ var oTextarea = (_a = contentRef === null || contentRef === void 0 ? void 0 : contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('textarea'); // 获取textarea标签
110
+ if (isIE) {
111
+ // selection 当前激活选中区,即高亮文本块,和/或文当中用户可执行某些操作的其它元素。
112
+ // createRange 从当前文本选中区中创建 TextRange 对象,
113
+ // 或从控件选中区中创建 controlRange 集合。
114
+ // @ts-ignore
115
+ var sTextRange = document.selection.createRange();
116
+ // 判断选中的是不是textarea对象
117
+ if (sTextRange.parentElement() === oTextarea) {
118
+ // 创建一个TextRange对象
119
+ // @ts-ignore
120
+ var oTextRange = document.body.createTextRange();
121
+ // 移动文本范围以便范围的开始和结束位置能够完全包含给定元素的文本。
122
+ oTextRange.moveToElementText(oTextarea);
123
+ // 这里我们比较oTextRange和sTextRange的开头,的到选中区域的开头位置
124
+ for (start = 0; oTextRange.compareEndPoints('StartToStart', sTextRange) < 0; start++) {
125
+ oTextRange.moveStart('character', 1);
134
126
  }
135
- } else {
136
- start = oTextarea.selectionStart;
137
- end = oTextarea.selectionEnd;
138
- }
139
- _this.setState({
140
- startNum: start,
141
- endNum: end
142
- });
143
- };
144
- /**
145
- * 跳转到上一次光标的位置
146
- * @参考 http://blog.csdn.net/chadcao/article/details/6575927
147
- * @TODO IE、火狐浏览器下未验证
148
- */
149
- _this.moveToCursor = function () {
150
- var _this$state2 = _this.state,
151
- startNum = _this$state2.startNum,
152
- endNum = _this$state2.endNum;
153
- var oTextarea = _this.content.querySelector('textarea');
154
- var start = startNum;
155
- var end = endNum;
156
- if (isNaN(start) || isNaN(end)) {
157
- alert('位置输入错误');
158
- }
159
- if (isIE) {
160
- var oTextRange = oTextarea.createTextRange();
161
- var LStart = startNum;
162
- var LEnd = endNum;
163
- var _start = 0;
164
- var _end = 0;
165
- var value = oTextarea.value;
166
- for (var i = 0; i < value.length && i < LStart; i++) {
167
- var c = value.charAt(i);
168
- if (c !== '\n') {
169
- _start++;
127
+ // 需要计算一下\n的数目(按字符移动的方式不计\n,所以这里加上)
128
+ for (var i = 0; i <= start; i++) {
129
+ if (oTextarea.value.charAt(i) === '\n') {
130
+ start++;
170
131
  }
171
132
  }
172
- for (var j = value.length - 1; j >= LEnd && j >= 0; j--) {
173
- var _c = value.charAt(j);
174
- if (_c !== '\n') {
175
- _end++;
133
+ // 再计算一次结束的位置
134
+ oTextRange.moveToElementText(oTextarea);
135
+ for (end = 0; oTextRange.compareEndPoints('StartToEnd', sTextRange) < 0; end++) {
136
+ oTextRange.moveStart('character', 1);
137
+ }
138
+ for (var j = 0; j <= end; j++) {
139
+ if (oTextarea.value.charAt(j) === '\n') {
140
+ end++;
176
141
  }
177
142
  }
178
- oTextRange.moveStart('character', _start);
179
- oTextRange.moveEnd('character', -_end);
180
- // oTextRange.collapse(true);
181
- oTextRange.select();
182
- oTextarea.focus();
183
- } else {
184
- oTextarea.select();
185
- oTextarea.selectionStart = startNum;
186
- oTextarea.selectionEnd = endNum;
187
143
  }
188
- };
189
- var _value = props.value || '';
190
- _this.state = {
191
- currentContent: _value,
192
- startNum: _value.length,
193
- // 光标开始位置(当选中文本时)
194
- endNum: _value.length,
195
- // 光标结束位置(当选中文本时)
196
- wordCount: _value.length // 输入框内的字符数总和(包含占位符所需要的长度)
197
- };
198
- _this.content = /*#__PURE__*/_react.default.createRef();
199
- return _this;
200
- }
201
- _inherits(VarTemplate, _Component);
202
- return _createClass(VarTemplate, [{
203
- key: "render",
204
- value: function render() {
205
- var _this2 = this;
206
- var _this$props = this.props,
207
- size = _this$props.size,
208
- style = _this$props.style,
209
- tags = _this$props.tags,
210
- disabled = _this$props.disabled;
211
- var _this$state3 = this.state,
212
- currentContent = _this$state3.currentContent,
213
- wordCount = _this$state3.wordCount;
214
- return /*#__PURE__*/_react.default.createElement("div", {
215
- className: "vart-wrap",
216
- style: style,
217
- ref: function ref(cRef) {
218
- _this2.content = cRef;
144
+ } else {
145
+ start = oTextarea.selectionStart;
146
+ end = oTextarea.selectionEnd;
147
+ }
148
+ setVartData(Object.assign(Object.assign({}, vartData), {
149
+ startNum: start,
150
+ endNum: end
151
+ }));
152
+ }, [vartData, value]);
153
+ /**
154
+ * 跳转到上一次光标的位置
155
+ * @参考 http://blog.csdn.net/chadcao/article/details/6575927
156
+ * @TODO IE、火狐浏览器下未验证
157
+ * @{params} {number} appendLength 当前切换的长度
158
+ */
159
+ var moveToCursor = (0, _react.useCallback)(function (insertLength) {
160
+ var _a;
161
+ var startNum = vartData.startNum,
162
+ endNum = vartData.endNum;
163
+ var oTextarea = (_a = contentRef === null || contentRef === void 0 ? void 0 : contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('textarea');
164
+ var start = startNum;
165
+ var end = endNum;
166
+ if (isNaN(start) || isNaN(end)) {
167
+ console.error('位置输入错误');
168
+ }
169
+ if (isIE) {
170
+ var oTextRange = oTextarea.createTextRange();
171
+ var LStart = startNum;
172
+ var LEnd = endNum;
173
+ var _start = 0;
174
+ var _end = 0;
175
+ var _value = oTextarea.value;
176
+ for (var i = 0; i < _value.length && i < LStart; i++) {
177
+ var c = _value.charAt(i);
178
+ if (c !== '\n') {
179
+ _start++;
219
180
  }
220
- }, tags && Array.isArray(tags) && /*#__PURE__*/_react.default.createElement("div", {
221
- className: "vart-header"
222
- }, tags.map(function (item) {
223
- return /*#__PURE__*/_react.default.createElement(_tag.default, {
224
- key: item.id,
225
- onClick: function onClick() {
226
- return !disabled && _this2.setTagWords(item.variableNameFormatted);
227
- }
228
- }, item.variableName);
229
- })), /*#__PURE__*/_react.default.createElement("div", {
230
- className: "vart-input"
231
- }, /*#__PURE__*/_react.default.createElement(TextArea, {
232
- type: "text",
233
- size: size,
234
- value: currentContent,
235
- placeholder: "\u8BF7\u8F93\u5165",
236
- onFocus: this.handleFocus,
237
- onBlur: this.handleBlur,
238
- onChange: function onChange(e) {
239
- return _this2.handleInputChange(e);
240
- },
241
- disabled: disabled
242
- })));
181
+ }
182
+ for (var j = _value.length - 1; j >= LEnd && j >= 0; j--) {
183
+ var _c = _value.charAt(j);
184
+ if (_c !== '\n') {
185
+ _end++;
186
+ }
187
+ }
188
+ oTextRange.moveStart('character', _start);
189
+ oTextRange.moveEnd('character', -_end);
190
+ // oTextRange.collapse(true);
191
+ oTextRange.select();
192
+ oTextarea.focus();
193
+ } else {
194
+ oTextarea.select();
195
+ oTextarea.focus();
196
+ // 判断如果是原来已经有选中(文本高亮),则插入文本后高亮的位置需要变成当前插入的文本
197
+ // startNum === endNum表示未选中过
198
+ // let aStartNum = startNum === endNum ? startNum + insertLength : startNum
199
+ // let aEndNum = startNum === endNum ? endNum + insertLength : startNum + insertLength
200
+ oTextarea.selectionStart = startNum + insertLength; // aStartNum
201
+ oTextarea.selectionEnd = startNum + insertLength; // aEndNum
202
+ // if (oTextarea.setSelectionRange) {
203
+ // setTimeout(() => {
204
+ // oTextarea.focus();
205
+ // oTextarea.setSelectionRange(aStartNum, aEndNum);
206
+ // }, 0);
207
+ // } else {
208
+ // oTextarea.selectionStart = aStartNum
209
+ // oTextarea.selectionEnd = aEndNum
210
+ // }
243
211
  }
244
- }], [{
245
- key: "getDerivedStateFromProps",
246
- value: function getDerivedStateFromProps(nextProps) {
247
- // console.log('执行getDerivedStateFromProps', nextProps)
248
- // Should be a controlled component.
249
- if ('value' in nextProps) {
250
- return _objectSpread({}, nextProps.value || {});
212
+ }, [vartData]);
213
+ (0, _react.useEffect)(function () {
214
+ setVartData({
215
+ currentContent: value || '',
216
+ startNum: (value === null || value === void 0 ? void 0 : value.length) || 0,
217
+ endNum: (value === null || value === void 0 ? void 0 : value.length) || 0,
218
+ wordCount: (value === null || value === void 0 ? void 0 : value.length) || 0 // 输入框内的字符数总和(包含占位符所需要的长度)
219
+ });
220
+ }, [value]);
221
+ // const setCursorPosition = (elemId, index) =>{
222
+ // const elem = document.getElementById(elemId);
223
+ // if (elem.setSelectionRange) {
224
+ // setTimeout(function() {
225
+ // elem.focus();
226
+ // elem.setSelectionRange(index, index);
227
+ // }, 0);
228
+ // } else if (elem.createTextRange) {
229
+ // const range = elem.createTextRange();
230
+ // range.collapse(true);
231
+ // range.moveEnd('character', index);
232
+ // range.moveStart('character', index);
233
+ // range.select();
234
+ // }
235
+ // }
236
+ return /*#__PURE__*/_react.default.createElement("div", {
237
+ className: "spec-vart-wrap",
238
+ style: style,
239
+ ref: contentRef
240
+ }, tags && Array.isArray(tags) && (/*#__PURE__*/_react.default.createElement("div", {
241
+ className: "spec-vart-header"
242
+ }, tags.map(function (item) {
243
+ return /*#__PURE__*/_react.default.createElement(_tag.default, {
244
+ style: {
245
+ marginBottom: '4px',
246
+ cursor: 'pointer'
247
+ },
248
+ key: item[(tagsOptionName === null || tagsOptionName === void 0 ? void 0 : tagsOptionName.key) || 'key'],
249
+ onClick: function onClick() {
250
+ return !(disabled || fieldStatus === 'disabled') && setTagWords(item[(tagsOptionName === null || tagsOptionName === void 0 ? void 0 : tagsOptionName.value) || 'value']);
251
251
  }
252
- return null;
252
+ }, item[(tagsOptionName === null || tagsOptionName === void 0 ? void 0 : tagsOptionName.label) || 'label']);
253
+ }))), /*#__PURE__*/_react.default.createElement("div", {
254
+ className: "spec-vart-input"
255
+ }, /*#__PURE__*/_react.default.createElement(TextArea
256
+ // type="text"
257
+ , {
258
+ // type="text"
259
+ size: size,
260
+ value: vartData.currentContent,
261
+ placeholder: "\u8BF7\u8F93\u5165",
262
+ onFocus: handleFocus,
263
+ onBlur: handleBlur,
264
+ onChange: function onChange(e) {
265
+ return handleInputChange(e);
266
+ },
267
+ disabled: disabled || fieldStatus === 'disabled'
268
+ })), showCountTip && /*#__PURE__*/_react.default.createElement("div", {
269
+ className: "spec-vart-desc",
270
+ style: {
271
+ marginTop: '4px',
272
+ fontSize: '12px'
253
273
  }
254
- }]);
255
- }(_react.Component);
274
+ }, " \u60A8\u5DF2\u5F55\u5165 ", /*#__PURE__*/_react.default.createElement("b", null, vartData.wordCount), " \u4E2A\u5B57"));
275
+ };
256
276
  var _default = exports.default = VarTemplate;