easy3wui 1.5.84 → 1.5.85

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.
@@ -2,6 +2,10 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
 
5
+ var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
6
+
7
+ var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
8
+
5
9
  var _extends2 = require('babel-runtime/helpers/extends');
6
10
 
7
11
  var _extends3 = _interopRequireDefault(_extends2);
@@ -56,6 +60,12 @@ var _tooltip2 = _interopRequireDefault(_tooltip);
56
60
 
57
61
  require('antd/lib/tooltip/style');
58
62
 
63
+ var _icon = require('antd/lib/icon');
64
+
65
+ var _icon2 = _interopRequireDefault(_icon);
66
+
67
+ require('antd/lib/icon/style');
68
+
59
69
  var _numeral = require('numeral');
60
70
 
61
71
  var _numeral2 = _interopRequireDefault(_numeral);
@@ -118,7 +128,10 @@ var Easy3wGridPageM = function (_Component) {
118
128
  that.setState({ pagination: { offset: 1, limit: 10 } });
119
129
  }
120
130
  };
131
+ // #region 获取表头
132
+
121
133
 
134
+ // #endregion 获取表头
122
135
  Easy3wGridPageM.prototype.render = function render() {
123
136
  var _this2 = this;
124
137
 
@@ -169,77 +182,75 @@ var Easy3wGridPageM = function (_Component) {
169
182
  var printFlag = printArr[1] === printValue;
170
183
  var hasFormParentClass = this.myRef.current && this.myRef.current.closest('.e3wFormPageWrap'); // 是否处于表单页面
171
184
  var paginationProps = false; // 默认不分页
172
- var recursion = function recursion(arr) {
173
- arr.forEach(function (item) {
174
- var columnsType = item.type;
175
- // const { title } = item;
176
- // if (!(printFlag || hasFormParentClass) && title && typeof title === 'string' && title.length > 6) {
177
- // item.title = <Tooltip placement="topLeft" title={title}>{title.substring(0, 6)}...</Tooltip>;
178
- // }
179
- switch (columnsType) {
180
- case 'shortText':
181
- item.className = 'e3wGridShortText';break;
182
- case 'longText':
183
- item.className = 'e3wGridLongText';break;
184
- case 'number':
185
- item.className = 'e3wGridNumber';break;
186
- case 'maxText':
187
- item.className = 'e3wMaxText';break;
188
- case 'numeralFormat':
189
- item.className = 'e3wGridNumber';break;
190
- default:
191
- item.className = 'e3wGridShortText';
192
- break;
193
- }
194
- if (item.children) {
195
- recursion(item.children);
196
- }
197
- });
198
- };
199
- var recursionT = function recursionT(arr) {
200
- arr.forEach(function (item) {
201
- if (!item.render) {
202
- item.render = function (text) {
203
- var globalData = _this2.props.globalData;
204
-
205
- var _ref = globalData || {},
206
- dataDesensitizationEyeFlag = _ref.dataDesensitizationEyeFlag;
207
-
208
- var strTextNew = _comonConfig.dataDesensitizationFlag ? dataDesensitizationEyeFlag ? text : (0, _easy3wui.Easy3wGetDesensitization)(text) : text;
209
- if (strTextNew && strTextNew.length * 14 > 160) {
210
- return _react2['default'].createElement(
211
- _tooltip2['default'],
212
- { placement: 'topLeft', title: strTextNew, style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
213
- strTextNew
214
- );
215
- } else {
216
- return strTextNew;
217
- }
218
- };
219
- if (item.type === 'numeralFormat') {
220
- item.render = function (text) {
221
- return _react2['default'].createElement(
222
- _tooltip2['default'],
223
- { placement: 'topLeft', title: _this2.numeralFormat(text), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
224
- _this2.numeralFormat(text)
225
- );
226
- };
227
- }
228
- }if (item.fixed) {
229
- item.className = 'e3wText';
230
- item.minWidth = 5;
231
- }
232
- if (item.children) {
233
- recursionT(item.children);
234
- }
235
- });
236
- };
237
- recursion(columns);
238
- if (dataList) {
239
- if (dataList.length > 0) {
240
- recursionT(columns);
241
- }
242
- }
185
+ // const recursion = (arr) => {
186
+ // arr.forEach((item) => {
187
+ // const columnsType = item.type;
188
+ // // const { title } = item;
189
+ // // if (!(printFlag || hasFormParentClass) && title && typeof title === 'string' && title.length > 6) {
190
+ // // item.title = <Tooltip placement="topLeft" title={title}>{title.substring(0, 6)}...</Tooltip>;
191
+ // // }
192
+ // switch (columnsType) {
193
+ // case 'shortText':
194
+ // item.className = 'e3wGridShortText'; break;
195
+ // case 'longText':
196
+ // item.className = 'e3wGridLongText'; break;
197
+ // case 'number':
198
+ // item.className = 'e3wGridNumber'; break;
199
+ // case 'maxText':
200
+ // item.className = 'e3wMaxText'; break;
201
+ // case 'numeralFormat':
202
+ // item.className = 'e3wGridNumber'; break;
203
+ // default:
204
+ // item.className = 'e3wGridShortText';
205
+ // break;
206
+ // }
207
+ // if (item.children) {
208
+ // recursion(item.children);
209
+ // }
210
+ // });
211
+ // };
212
+ // const recursionT = (arr) => {
213
+ // arr.forEach((item) => {
214
+ // if (!item.render) {
215
+ // item.render = (text) => {
216
+ // const { globalData } = this.props;
217
+ // const { dataDesensitizationEyeFlag } = globalData || {};
218
+ // const strTextNew = dataDesensitizationFlag ? (dataDesensitizationEyeFlag ? text : Easy3wGetDesensitization(text)) : text;
219
+ // if (strTextNew && strTextNew.length * 14 > 160) {
220
+ // return (
221
+ // <Tooltip placement="topLeft" title={strTextNew} style={{ whiteSpace: 'pre-wrap', wordWrap: 'break-word' }}>
222
+ // {strTextNew}
223
+ // </Tooltip>
224
+ // );
225
+ // } else {
226
+ // return strTextNew;
227
+ // }
228
+ // };
229
+ // if (item.type === 'numeralFormat') {
230
+ // item.render = (text) => {
231
+ // return (
232
+ // <Tooltip placement="topLeft" title={this.numeralFormat(text)} style={{ whiteSpace: 'pre-wrap', wordWrap: 'break-word' }}>
233
+ // {this.numeralFormat(text)}
234
+ // </Tooltip>
235
+ // );
236
+ // };
237
+ // }
238
+ // } if (item.fixed) {
239
+ // item.className = 'e3wText';
240
+ // item.minWidth = 5;
241
+ // }
242
+ // if (item.children) {
243
+ // recursionT(item.children);
244
+ // }
245
+ // });
246
+ // };
247
+ // recursion(columns);
248
+ // if (dataList) {
249
+ // if (dataList.length > 0) {
250
+ // recursionT(columns);
251
+ // }
252
+ // }
253
+ var myColumns = this.getColumns(columns);
243
254
  var rowSelection = null;
244
255
  if (checkType) {
245
256
  // 若需选择框
@@ -266,7 +277,6 @@ var Easy3wGridPageM = function (_Component) {
266
277
  }
267
278
  };
268
279
  }
269
- var myColumns = columns;
270
280
  // 处理分页 start
271
281
  if (needPaginationFlag || handleSearchNew) {
272
282
  var defaultCurrent = paginationInfo ? paginationInfo.offset : 1;
@@ -286,8 +296,8 @@ var Easy3wGridPageM = function (_Component) {
286
296
  pageSizeOptions: ['10', '20', '30', '40', '50', '100']
287
297
  };
288
298
  if (autoAddNumber) {
289
- if (columns.length > 0) {
290
- var fixed = columns[0].fixed;
299
+ if (myColumns.length > 0) {
300
+ var fixed = myColumns[0].fixed;
291
301
 
292
302
  myColumns = [{
293
303
  title: '序号',
@@ -303,7 +313,7 @@ var Easy3wGridPageM = function (_Component) {
303
313
  ' '
304
314
  );
305
315
  }
306
- }].concat(columns);
316
+ }].concat(myColumns);
307
317
  }
308
318
  }
309
319
  }
@@ -690,6 +700,182 @@ var _initialiseProps = function _initialiseProps() {
690
700
  handleSearchNew(paginationInfo, formVal);
691
701
  }
692
702
  };
703
+
704
+ this.getColumns = function (columns) {
705
+ var dataList = _this3.props.dataList;
706
+
707
+ var myColumns = [];
708
+ columns.map(function (item) {
709
+ var itemNew = (0, _extends3['default'])({}, item);
710
+ var columnsType = item.type;
711
+ switch (columnsType) {
712
+ case 'shortText':
713
+ itemNew.className = 'e3wGridShortText';break;
714
+ case 'longText':
715
+ itemNew.className = 'e3wGridLongText';break;
716
+ case 'number':
717
+ itemNew.className = 'e3wGridNumber';break;
718
+ case 'maxText':
719
+ itemNew.className = 'e3wMaxText';break;
720
+ case 'numeralFormat':
721
+ itemNew.className = 'e3wGridNumber';break;
722
+ default:
723
+ itemNew.className = 'e3wGridShortText';
724
+ break;
725
+ }
726
+ if (item.children) {
727
+ itemNew.children = _this3.getColumns(item.children);
728
+ }
729
+ if (dataList && dataList.length) {
730
+ if (!item.render) {
731
+ itemNew.render = function (text) {
732
+ var globalData = _this3.props.globalData;
733
+
734
+ var _ref = globalData || {},
735
+ dataDesensitizationEyeFlag = _ref.dataDesensitizationEyeFlag;
736
+
737
+ var strTextNew = _comonConfig.dataDesensitizationFlag ? dataDesensitizationEyeFlag ? text : (0, _easy3wui.Easy3wGetDesensitization)(text) : text;
738
+ if (strTextNew && strTextNew.length * 14 > 160) {
739
+ return _react2['default'].createElement(
740
+ _tooltip2['default'],
741
+ { placement: 'topLeft', title: strTextNew, style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
742
+ strTextNew
743
+ );
744
+ } else {
745
+ return strTextNew;
746
+ }
747
+ };
748
+ if (item.type === 'numeralFormat') {
749
+ itemNew.render = function (text) {
750
+ return _react2['default'].createElement(
751
+ _tooltip2['default'],
752
+ { placement: 'topLeft', title: _this3.numeralFormat(text), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
753
+ _this3.numeralFormat(text)
754
+ );
755
+ };
756
+ }
757
+ }if (item.fixed) {
758
+ itemNew.className = 'e3wText';
759
+ itemNew.minWidth = 5;
760
+ }
761
+ }
762
+ var e3wFieldCfg = _this3.props.e3wFieldCfg;
763
+ var dataIndex = item.dataIndex;
764
+ var required = item.required,
765
+ title = item.title,
766
+ helpInfo = item.helpInfo;
767
+
768
+ var objCfg = e3wFieldCfg && e3wFieldCfg[dataIndex] && e3wFieldCfg[dataIndex] instanceof Object ? e3wFieldCfg[dataIndex] : null;
769
+ if (objCfg) {
770
+ var fieldSName = objCfg.fieldSName,
771
+ fieldDesc = objCfg.fieldDesc,
772
+ fieldHelpInfo = objCfg.fieldHelpInfo,
773
+ fieldReqFlag = objCfg.fieldReqFlag,
774
+ fieldDspFlag = objCfg.fieldDspFlag;
775
+
776
+ if (fieldDspFlag === '0') {
777
+ return item;
778
+ } else {
779
+ required = fieldReqFlag === '0' ? false : fieldReqFlag === '1' ? true : required;
780
+ if (fieldSName) {
781
+ title = fieldSName;
782
+ }
783
+ helpInfo = fieldHelpInfo || helpInfo;
784
+ if (helpInfo) {
785
+ var needHelpFlag = true;
786
+ if (title && title instanceof Object) {
787
+ var _title = title,
788
+ props = _title.props;
789
+
790
+ var _ref2 = props || {},
791
+ placement = _ref2.placement,
792
+ titleT = _ref2.title,
793
+ children = _ref2.children,
794
+ restProps = (0, _objectWithoutProperties3['default'])(_ref2, ['placement', 'title', 'children']);
795
+
796
+ if (placement && titleT && children) {
797
+ // 创建新的Tooltip组件,继承现有props,更新title
798
+ title = _react2['default'].createElement(
799
+ _tooltip2['default'],
800
+ (0, _extends3['default'])({}, restProps, {
801
+ title: _react2['default'].createElement(
802
+ 'span',
803
+ { style: { whiteSpace: 'pre-wrap' } },
804
+ helpInfo
805
+ )
806
+ }),
807
+ children
808
+ );
809
+ needHelpFlag = false;
810
+ }
811
+ }
812
+ if (needHelpFlag) {
813
+ title = _react2['default'].createElement(
814
+ _tooltip2['default'],
815
+ {
816
+ placement: 'top',
817
+ title: _react2['default'].createElement(
818
+ 'span',
819
+ { style: { whiteSpace: 'pre-wrap' } },
820
+ helpInfo
821
+ )
822
+ },
823
+ title,
824
+ _react2['default'].createElement(_icon2['default'], { type: 'question-circle' })
825
+ );
826
+ }
827
+ }
828
+ if (required) {
829
+ title = _react2['default'].createElement(
830
+ 'span',
831
+ null,
832
+ _react2['default'].createElement(
833
+ 'span',
834
+ { style: { color: 'red' } },
835
+ '*'
836
+ ),
837
+ title
838
+ );
839
+ }
840
+ }
841
+ itemNew.title = title;
842
+ // } else {
843
+ } else {
844
+ if (helpInfo) {
845
+ title = _react2['default'].createElement(
846
+ _tooltip2['default'],
847
+ {
848
+ placement: 'top',
849
+ title: _react2['default'].createElement(
850
+ 'span',
851
+ { style: { whiteSpace: 'pre-wrap' } },
852
+ helpInfo
853
+ )
854
+ },
855
+ title,
856
+ _react2['default'].createElement(_icon2['default'], { type: 'question-circle' })
857
+ );
858
+ }
859
+ if (required) {
860
+ // required, title: titlec, helpInfo
861
+ title = _react2['default'].createElement(
862
+ 'span',
863
+ null,
864
+ _react2['default'].createElement(
865
+ 'span',
866
+ { style: { color: 'red' } },
867
+ '*'
868
+ ),
869
+ title
870
+ );
871
+ }
872
+ itemNew.title = title;
873
+ }
874
+ myColumns.push(itemNew);
875
+ return item;
876
+ });
877
+ return myColumns;
878
+ };
693
879
  };
694
880
 
695
881
  exports['default'] = Easy3wGridPageM;