fan-standard-comp 3.2.4 → 3.2.6

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,268 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ require("antd/es/tag/style");
9
+ var _tag = _interopRequireDefault(require("antd/es/tag"));
10
+ require("antd/es/input/style");
11
+ var _input = _interopRequireDefault(require("antd/es/input"));
12
+ var _react = _interopRequireWildcard(require("react"));
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
+ 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
+ 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.
32
+ */
33
+ var TextArea = _input.default.TextArea;
34
+ 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
+ }
134
+ }
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++;
170
+ }
171
+ }
172
+ for (var j = value.length - 1; j >= LEnd && j >= 0; j--) {
173
+ var _c = value.charAt(j);
174
+ if (_c !== '\n') {
175
+ _end++;
176
+ }
177
+ }
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
+ }
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;
219
+ }
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
+ })));
243
+ }
244
+ }], [{
245
+ key: "getDerivedStateFromProps",
246
+ value: function getDerivedStateFromProps(nextProps) {
247
+ // console.log('执行getDerivedStateFromProps', nextProps)
248
+ // Should be a controlled component.
249
+ // 如果 props 中的value属性发生变化,返回一个新的子状态对象
250
+ if ('value' in nextProps) {
251
+ // console.log('nextProps', nextProps, nextProps.value || {})
252
+ var nValue = nextProps.value || '';
253
+ return _objectSpread({
254
+ value: nValue,
255
+ currentContent: nValue,
256
+ startNum: nValue.length,
257
+ // 光标开始位置(当选中文本时)
258
+ endNum: nValue.length,
259
+ // 光标结束位置(当选中文本时)
260
+ wordCount: nValue.length
261
+ }, nextProps.value || {});
262
+ }
263
+ // 如果props没有变化,返回null或undefined ,不触发任何状态更新
264
+ return null;
265
+ }
266
+ }]);
267
+ }(_react.Component);
268
+ var _default = exports.default = VarTemplate;
@@ -54,7 +54,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
54
54
  // const isEnough = wrapHeight % baseItemHeight === 0; // 剩余的是否足够容纳一个单元格
55
55
  var isInsideEnoughWidth = navList.length * baseItemWidth <= _this.mainWrap.current.clientWidth;
56
56
  var wrapWidth = _this.mainWrap.current.clientWidth - (isInsideEnoughWidth ? 0 : 30 * 2);
57
- console.log('this.mainWrap.current.clientWidth', _this.mainWrap.current.clientWidth, wrapWidth, isInsideEnoughWidth);
57
+ // console.log('this.mainWrap.current.clientWidth', this.mainWrap.current.clientWidth, wrapWidth, isInsideEnoughWidth)
58
58
  var floorWidth = _this.leafNav.current.clientWidth; // 所有楼层占用的宽度
59
59
  if (type === 'horizontal') {
60
60
  // 判断有效区域与单元格高度:若小于,则直接使用单元格高度,否则将内容区高度去除不足一个单元格高度
@@ -293,7 +293,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
293
293
  floorWidth = _this$state3$floorRel.floorWidth,
294
294
  stepSize = _this$state3.stepSize;
295
295
  if (type === 'horizontal') {}
296
- if (JSON.stringify(navList) !== JSON.stringify(prevProps.navList) || (type === 'horizontal' ? baseItemWidth !== prevProps.baseItemWidth : baseItemHeight !== prevProps.baseItemHeight) || align !== prevProps.align) {
296
+ if (navList !== prevProps.navList || (type === 'horizontal' ? baseItemWidth !== prevProps.baseItemWidth : baseItemHeight !== prevProps.baseItemHeight) || align !== prevProps.align) {
297
297
  this.initFloorValues();
298
298
  }
299
299
  if (forbidScroll !== prevProps.forbidScroll) {
@@ -72,10 +72,10 @@ var RefactorTree = function RefactorTree(props) {
72
72
  e.selectedNodes.map(function (item) {
73
73
  return multiSelectedData.push(item);
74
74
  }); // 多选条件下,当前选中所有节点数据
75
- onSelect && onSelect(key, {
75
+ onSelect && onSelect(key, Object.assign({
76
76
  currentData: currentData,
77
77
  multiData: multiSelectedData
78
- }, e);
78
+ }, e), e);
79
79
  };
80
80
  var handleToCheckTreeNode = function handleToCheckTreeNode(keys, e) {
81
81
  var currentData = e.node;
@@ -41,7 +41,8 @@ var StandardFilter = /*#__PURE__*/_react.default.forwardRef(function (props, ref
41
41
  style = _Object$assign.style,
42
42
  _Object$assign$button = _Object$assign.buttonGroup,
43
43
  buttonGroup = _Object$assign$button === void 0 ? [] : _Object$assign$button,
44
- buttonGroupConfig = _Object$assign.buttonGroupConfig,
44
+ _Object$assign$button2 = _Object$assign.buttonGroupConfig,
45
+ buttonGroupConfig = _Object$assign$button2 === void 0 ? {} : _Object$assign$button2,
45
46
  min = _Object$assign.min,
46
47
  codes = _Object$assign.codes,
47
48
  permissionCodes = _Object$assign.permissionCodes,
@@ -53,8 +54,11 @@ var StandardFilter = /*#__PURE__*/_react.default.forwardRef(function (props, ref
53
54
  cancelButtonProps = _Object$assign$cancel === void 0 ? {} : _Object$assign$cancel,
54
55
  filterButtonColSpan = _Object$assign.filterButtonColSpan,
55
56
  filterButtonConfig = _Object$assign.filterButtonConfig,
56
- formLayout = _Object$assign.formLayout,
57
+ _Object$assign$formLa = _Object$assign.formLayout,
58
+ formLayout = _Object$assign$formLa === void 0 ? 'inline' : _Object$assign$formLa,
57
59
  gridLayout = _Object$assign.gridLayout,
60
+ _Object$assign$button3 = _Object$assign.buttonGroupPlacement,
61
+ buttonGroupPlacement = _Object$assign$button3 === void 0 ? 'left' : _Object$assign$button3,
58
62
  filterFormStyle = _Object$assign.filterFormStyle,
59
63
  filterBtnsStyle = _Object$assign.filterBtnsStyle,
60
64
  _Object$assign$colon = _Object$assign.colon,
@@ -210,15 +214,14 @@ var StandardFilter = /*#__PURE__*/_react.default.forwardRef(function (props, ref
210
214
  };
211
215
  var renderButtonGroup = function renderButtonGroup() {
212
216
  return buttonGroup && buttonGroup.length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
213
- className: "filter-btns ",
217
+ className: "filter-btns filter-btns-".concat(gridLayout, " filter-btns-").concat(gridLayout, "-").concat(buttonGroupPlacement),
214
218
  style: filterBtnsStyle
215
- }, /*#__PURE__*/_react.default.createElement(_index.default, {
219
+ }, /*#__PURE__*/_react.default.createElement(_index.default, Object.assign({
216
220
  options: buttonGroup,
217
221
  min: min,
218
222
  codes: codes,
219
- permissionCodes: permissionCodes,
220
- dropdownConfig: buttonGroupConfig
221
- })) : null;
223
+ permissionCodes: permissionCodes
224
+ }, buttonGroupConfig))) : null;
222
225
  };
223
226
  return /*#__PURE__*/_react.default.createElement(_form.default, {
224
227
  name: 'standard-filter-form-' + guid(),
@@ -32,7 +32,14 @@
32
32
  width: 100%;
33
33
  text-align: left;
34
34
 
35
+ &.filter-btns-horizontal-right {
36
+ .spec-button-group {
37
+ text-align: right;
38
+ //justify-content: end;
39
+ }
40
+ }
35
41
  .spec-button-group {
42
+ display: block;
36
43
  padding-left: 0;
37
44
  padding-top: @padding-md;
38
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fan-standard-comp",
3
- "version": "3.2.4",
3
+ "version": "3.2.6",
4
4
  "description": "FZ standard-comp,basic of antd4.0 and custom component.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -21,7 +21,8 @@
21
21
  "package:build:publish": "father-build && webpack && npm version patch && npm publish",
22
22
  "package:build:no-dist:publish": "father-build && npm version patch && npm publish",
23
23
  "build:package:to-rgz": "npm run package:build && node copyPackage.js && npm run package-to-tgz",
24
- "package-to-tgz": "tar -czf fan-standard-comp-3.2.3-beta.1.tgz package"
24
+ "package-to-tgz": "tar -czf fan-standard-comp-3.2.6.tgz package",
25
+ "doc-to-tgz": "tar -czf doc-v3.zip doc-v3"
25
26
  },
26
27
  "author": "shomychen",
27
28
  "license": "ISC",
@@ -51,5 +52,8 @@
51
52
  "react-html-parser": "^2.0.2",
52
53
  "style-loader": "1.3.0",
53
54
  "webpack": "4.44.1"
55
+ },
56
+ "engines": {
57
+ "node": "=16.0.0"
54
58
  }
55
59
  }