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.
@@ -0,0 +1,260 @@
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
+ import "antd/es/tag/style";
3
+ import _Tag from "antd/es/tag";
4
+ import "antd/es/input/style";
5
+ import _Input from "antd/es/input";
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; }
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; }
8
+ 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; }
9
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
10
+ 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); } }
11
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
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
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
15
+ 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); }
16
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
17
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
18
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
19
+ 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); }
20
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
+ /**
22
+ * Created by S.C. on 2019/11/16.
23
+ */
24
+ import React, { Component } from 'react';
25
+ var TextArea = _Input.TextArea;
26
+ var isIE = !!document.all;
27
+ var VarTemplate = /*#__PURE__*/function (_Component) {
28
+ function VarTemplate(props) {
29
+ var _this;
30
+ _classCallCheck(this, VarTemplate);
31
+ _this = _callSuper(this, VarTemplate, [props]);
32
+ _this.handleBlur = function (e) {
33
+ _this.getCurrentCursor();
34
+ };
35
+ _this.handleFocus = function (e) {
36
+ // console.log('获取焦点')
37
+ // this.$emit('focus', event)
38
+ };
39
+ _this.handleInputChange = function (e) {
40
+ var onChange = _this.props.onChange;
41
+ _this.getCurrentCursor();
42
+ _this.setState({
43
+ currentContent: e.target.value,
44
+ startNum: e.target.value.length,
45
+ endNum: e.target.value.length,
46
+ wordCount: e.target.value.length
47
+ });
48
+ if (onChange) onChange(e.target.value);
49
+ };
50
+ _this.setTagWords = function (key) {
51
+ var onChange = _this.props.onChange;
52
+ var _this$state = _this.state,
53
+ currentContent = _this$state.currentContent,
54
+ startNum = _this$state.startNum,
55
+ endNum = _this$state.endNum;
56
+ _this.setState({
57
+ currentContent: _this.insertContent(currentContent, key, startNum, endNum),
58
+ startNum: startNum + key.length,
59
+ // 光标起始位置累加
60
+ endNum: endNum + key.length,
61
+ // 光标起始位置累加
62
+ wordCount: _this.insertContent(currentContent, key, startNum, endNum).length
63
+ });
64
+ if (onChange) onChange(_this.insertContent(currentContent, key, startNum, endNum));
65
+ setTimeout(function () {
66
+ _this.moveToCursor(); // 重新定位光标
67
+ });
68
+ };
69
+ /**
70
+ * 指定位置插入标签占位符字符串,当光标有选中一段字符时,会将直接将其替换
71
+ * @param {str} 需要做插入的字符串
72
+ * @param {insertStr} 需要插入的字符串
73
+ * @param {start} 指定开始位置
74
+ * @param {end} 指定结束位置
75
+ * */
76
+ _this.insertContent = function (str, insertStr, start, end) {
77
+ if (start !== end) {
78
+ var _prevStr = str.substring(0, start);
79
+ var _nextStr = str.substring(end, str.length);
80
+ return _prevStr + insertStr + _nextStr;
81
+ }
82
+ var prevStr = str.substring(0, start);
83
+ var nextStr = str.substring(start, str.length);
84
+ return prevStr + insertStr + nextStr;
85
+ };
86
+ /**
87
+ * 获取当前(上一次)光标的位置
88
+ * @参考 http://blog.csdn.net/chadcao/article/details/6575927
89
+ * @TODO IE、火狐浏览器下未验证
90
+ */
91
+ _this.getCurrentCursor = function () {
92
+ var start = 0;
93
+ var end = 0;
94
+ var oTextarea = _this.content.querySelector('textarea'); // 获取textarea标签
95
+ if (isIE) {
96
+ // selection 当前激活选中区,即高亮文本块,和/或文当中用户可执行某些操作的其它元素。
97
+ // createRange 从当前文本选中区中创建 TextRange 对象,
98
+ // 或从控件选中区中创建 controlRange 集合。
99
+ var sTextRange = document.selection.createRange();
100
+ // 判断选中的是不是textarea对象
101
+ if (sTextRange.parentElement() === oTextarea) {
102
+ // 创建一个TextRange对象
103
+ var oTextRange = document.body.createTextRange();
104
+ // 移动文本范围以便范围的开始和结束位置能够完全包含给定元素的文本。
105
+ oTextRange.moveToElementText(oTextarea);
106
+ // 这里我们比较oTextRange和sTextRange的开头,的到选中区域的开头位置
107
+ for (start = 0; oTextRange.compareEndPoints('StartToStart', sTextRange) < 0; start++) {
108
+ oTextRange.moveStart('character', 1);
109
+ }
110
+ // 需要计算一下\n的数目(按字符移动的方式不计\n,所以这里加上)
111
+ for (var i = 0; i <= start; i++) {
112
+ if (oTextarea.value.charAt(i) === '\n') {
113
+ start++;
114
+ }
115
+ }
116
+ // 再计算一次结束的位置
117
+ oTextRange.moveToElementText(oTextarea);
118
+ for (end = 0; oTextRange.compareEndPoints('StartToEnd', sTextRange) < 0; end++) {
119
+ oTextRange.moveStart('character', 1);
120
+ }
121
+ for (var j = 0; j <= end; j++) {
122
+ if (oTextarea.value.charAt(j) === '\n') {
123
+ end++;
124
+ }
125
+ }
126
+ }
127
+ } else {
128
+ start = oTextarea.selectionStart;
129
+ end = oTextarea.selectionEnd;
130
+ }
131
+ _this.setState({
132
+ startNum: start,
133
+ endNum: end
134
+ });
135
+ };
136
+ /**
137
+ * 跳转到上一次光标的位置
138
+ * @参考 http://blog.csdn.net/chadcao/article/details/6575927
139
+ * @TODO IE、火狐浏览器下未验证
140
+ */
141
+ _this.moveToCursor = function () {
142
+ var _this$state2 = _this.state,
143
+ startNum = _this$state2.startNum,
144
+ endNum = _this$state2.endNum;
145
+ var oTextarea = _this.content.querySelector('textarea');
146
+ var start = startNum;
147
+ var end = endNum;
148
+ if (isNaN(start) || isNaN(end)) {
149
+ alert('位置输入错误');
150
+ }
151
+ if (isIE) {
152
+ var oTextRange = oTextarea.createTextRange();
153
+ var LStart = startNum;
154
+ var LEnd = endNum;
155
+ var _start = 0;
156
+ var _end = 0;
157
+ var value = oTextarea.value;
158
+ for (var i = 0; i < value.length && i < LStart; i++) {
159
+ var c = value.charAt(i);
160
+ if (c !== '\n') {
161
+ _start++;
162
+ }
163
+ }
164
+ for (var j = value.length - 1; j >= LEnd && j >= 0; j--) {
165
+ var _c = value.charAt(j);
166
+ if (_c !== '\n') {
167
+ _end++;
168
+ }
169
+ }
170
+ oTextRange.moveStart('character', _start);
171
+ oTextRange.moveEnd('character', -_end);
172
+ // oTextRange.collapse(true);
173
+ oTextRange.select();
174
+ oTextarea.focus();
175
+ } else {
176
+ oTextarea.select();
177
+ oTextarea.selectionStart = startNum;
178
+ oTextarea.selectionEnd = endNum;
179
+ }
180
+ };
181
+ var _value = props.value || '';
182
+ _this.state = {
183
+ currentContent: _value,
184
+ startNum: _value.length,
185
+ // 光标开始位置(当选中文本时)
186
+ endNum: _value.length,
187
+ // 光标结束位置(当选中文本时)
188
+ wordCount: _value.length // 输入框内的字符数总和(包含占位符所需要的长度)
189
+ };
190
+ _this.content = /*#__PURE__*/React.createRef();
191
+ return _this;
192
+ }
193
+ _inherits(VarTemplate, _Component);
194
+ return _createClass(VarTemplate, [{
195
+ key: "render",
196
+ value: function render() {
197
+ var _this2 = this;
198
+ var _this$props = this.props,
199
+ size = _this$props.size,
200
+ style = _this$props.style,
201
+ tags = _this$props.tags,
202
+ disabled = _this$props.disabled;
203
+ var _this$state3 = this.state,
204
+ currentContent = _this$state3.currentContent,
205
+ wordCount = _this$state3.wordCount;
206
+ return /*#__PURE__*/React.createElement("div", {
207
+ className: "vart-wrap",
208
+ style: style,
209
+ ref: function ref(cRef) {
210
+ _this2.content = cRef;
211
+ }
212
+ }, tags && Array.isArray(tags) && /*#__PURE__*/React.createElement("div", {
213
+ className: "vart-header"
214
+ }, tags.map(function (item) {
215
+ return /*#__PURE__*/React.createElement(_Tag, {
216
+ key: item.id,
217
+ onClick: function onClick() {
218
+ return !disabled && _this2.setTagWords(item.variableNameFormatted);
219
+ }
220
+ }, item.variableName);
221
+ })), /*#__PURE__*/React.createElement("div", {
222
+ className: "vart-input"
223
+ }, /*#__PURE__*/React.createElement(TextArea, {
224
+ type: "text",
225
+ size: size,
226
+ value: currentContent,
227
+ placeholder: "\u8BF7\u8F93\u5165",
228
+ onFocus: this.handleFocus,
229
+ onBlur: this.handleBlur,
230
+ onChange: function onChange(e) {
231
+ return _this2.handleInputChange(e);
232
+ },
233
+ disabled: disabled
234
+ })));
235
+ }
236
+ }], [{
237
+ key: "getDerivedStateFromProps",
238
+ value: function getDerivedStateFromProps(nextProps) {
239
+ // console.log('执行getDerivedStateFromProps', nextProps)
240
+ // Should be a controlled component.
241
+ // 如果 props 中的value属性发生变化,返回一个新的子状态对象
242
+ if ('value' in nextProps) {
243
+ // console.log('nextProps', nextProps, nextProps.value || {})
244
+ var nValue = nextProps.value || '';
245
+ return _objectSpread({
246
+ value: nValue,
247
+ currentContent: nValue,
248
+ startNum: nValue.length,
249
+ // 光标开始位置(当选中文本时)
250
+ endNum: nValue.length,
251
+ // 光标结束位置(当选中文本时)
252
+ wordCount: nValue.length
253
+ }, nextProps.value || {});
254
+ }
255
+ // 如果props没有变化,返回null或undefined ,不触发任何状态更新
256
+ return null;
257
+ }
258
+ }]);
259
+ }(Component);
260
+ export default VarTemplate;
@@ -28,12 +28,14 @@
28
28
 
29
29
  .spec-image-preview-next,
30
30
  .spec-image-preview-prev {
31
- background-color: rgba(0, 0, 0, 0.45);
31
+ background-color: rgba(255, 255, 255, 0.25);
32
32
  border-radius: 2px;
33
33
  color: #999;
34
+ //color: #333;
34
35
  cursor: pointer;
35
36
  display: block;
36
- font-size: 22px;
37
+ //font-size: 22px;
38
+ font-size: 30px;
37
39
  margin-top: -10px;
38
40
  padding: 8px 10px 9px;
39
41
  position: absolute;
@@ -51,6 +53,7 @@
51
53
 
52
54
  .spec-image-preview-next:hover:not(.disabled),
53
55
  .spec-image-preview-prev:hover:not(.disabled) {
56
+ background-color: rgba(255, 255, 255, 0.45);
54
57
  color: #fff;
55
58
  }
56
59
 
@@ -32,7 +32,8 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
32
32
  style = _Object$assign.style,
33
33
  _Object$assign$button = _Object$assign.buttonGroup,
34
34
  buttonGroup = _Object$assign$button === void 0 ? [] : _Object$assign$button,
35
- buttonGroupConfig = _Object$assign.buttonGroupConfig,
35
+ _Object$assign$button2 = _Object$assign.buttonGroupConfig,
36
+ buttonGroupConfig = _Object$assign$button2 === void 0 ? {} : _Object$assign$button2,
36
37
  min = _Object$assign.min,
37
38
  codes = _Object$assign.codes,
38
39
  permissionCodes = _Object$assign.permissionCodes,
@@ -201,15 +202,14 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
201
202
  };
202
203
  var renderButtonGroup = function renderButtonGroup() {
203
204
  return buttonGroup && buttonGroup.length > 0 ? /*#__PURE__*/React.createElement("div", {
204
- className: "filter-btns ",
205
+ className: "filter-btns filter-btns-".concat(gridLayout),
205
206
  style: filterBtnsStyle
206
- }, /*#__PURE__*/React.createElement(ButtonGroup, {
207
+ }, /*#__PURE__*/React.createElement(ButtonGroup, Object.assign({
207
208
  options: buttonGroup,
208
209
  min: min,
209
210
  codes: codes,
210
- permissionCodes: permissionCodes,
211
- dropdownConfig: buttonGroupConfig
212
- })) : null;
211
+ permissionCodes: permissionCodes
212
+ }, buttonGroupConfig))) : null;
213
213
  };
214
214
  return /*#__PURE__*/React.createElement(_Form, {
215
215
  name: 'standard-filter-form-' + guid(),
@@ -33,6 +33,7 @@
33
33
  text-align: left;
34
34
 
35
35
  .spec-button-group {
36
+ display: block;
36
37
  padding-left: 0;
37
38
  padding-top: @padding-md;
38
39
 
@@ -29,6 +29,8 @@ interface ButtonGroupProps {
29
29
  dropdownConfig?: Object;
30
30
  moreText?: string;
31
31
  moreIcon?: React.ReactNode | string | number;
32
+ className?: string;
33
+ style?: object;
32
34
  }
33
35
  declare const ButtonGroup: (props: ButtonGroupProps) => React.JSX.Element;
34
36
  export default ButtonGroup;
@@ -51,7 +51,9 @@ var ButtonGroup = function ButtonGroup(props) {
51
51
  dropdownConfig = _props$dropdownConfig === void 0 ? {} : _props$dropdownConfig,
52
52
  _props$moreText = props.moreText,
53
53
  moreText = _props$moreText === void 0 ? '更多' : _props$moreText,
54
- moreIcon = props.moreIcon;
54
+ moreIcon = props.moreIcon,
55
+ className = props.className,
56
+ style = props.style;
55
57
  var _props$options = props.options,
56
58
  options = _props$options === void 0 ? [] : _props$options,
57
59
  _props$min = props.min,
@@ -326,7 +328,8 @@ var ButtonGroup = function ButtonGroup(props) {
326
328
  var forGroup = resetList.slice(0, min - 1);
327
329
  var forDrop = resetList.slice(min - 1);
328
330
  return /*#__PURE__*/_react.default.createElement("span", {
329
- className: "spec-button-group"
331
+ className: "spec-button-group ".concat(className || ''),
332
+ style: style
330
333
  }, forGroup.map(function (item, index) {
331
334
  return index < min - 1 ? renderDisplayButton(item, index) : null;
332
335
  }), type === 'button' ? /*#__PURE__*/_react.default.createElement(_dropdown.default, Object.assign({
@@ -375,7 +378,8 @@ var ButtonGroup = function ButtonGroup(props) {
375
378
  }, moreText || '更多', moreIcon || /*#__PURE__*/_react.default.createElement(_icons.DownOutlined, null)))));
376
379
  }
377
380
  return /*#__PURE__*/_react.default.createElement("span", {
378
- className: "spec-button-group"
381
+ className: "spec-button-group ".concat(className || ''),
382
+ style: style
379
383
  }, resetList.map(function (item, index) {
380
384
  return renderDisplayButton(item, index);
381
385
  }));
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Created by S.C. on 2024/10/10
3
+ */
4
+ import React from 'react';
5
+ interface VarTemplateProps {
6
+ style?: Object;
7
+ tags: any[];
8
+ showCountTip?: boolean;
9
+ [k: string]: any;
10
+ }
11
+ declare const VarTemplate: (props: VarTemplateProps) => React.JSX.Element;
12
+ export default VarTemplate;