dlt-for-react 1.1.3 → 1.1.4

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 (187) hide show
  1. package/README.md +4 -0
  2. package/lib/index.js +7 -1
  3. package/lib/layouts/Top/index.js +1 -1
  4. package/lib/layouts/layout/index.js +77 -31
  5. package/lib/layouts/mixTop/index.js +3 -3
  6. package/lib/utils/createUuid.js +31 -11
  7. package/lib/utils/getLoginUser.js +1 -1
  8. package/lib/utils/getSize.js +11 -2
  9. package/lib/utils/index.js +35 -2
  10. package/package.json +1 -1
  11. package/lib/components/Button/index.js +0 -79
  12. package/lib/components/NHAuditPanel/config/Axios.js +0 -263
  13. package/lib/components/NHAuditPanel/config/api.js +0 -479
  14. package/lib/components/NHAuditPanel/config/data.js +0 -156
  15. package/lib/components/NHAuditPanel/config/typeMap.js +0 -1234
  16. package/lib/components/NHAuditPanel/config/uiValidate.js +0 -92
  17. package/lib/components/NHAuditPanel/index.js +0 -413
  18. package/lib/components/NHAuditPanel/node.js +0 -619
  19. package/lib/components/NHCascader/index.js +0 -355
  20. package/lib/components/NHCheckboxGroup/index.js +0 -135
  21. package/lib/components/NHDynamicFormShow/baseInfo/index.js +0 -194
  22. package/lib/components/NHDynamicFormShow/custom/index.js +0 -553
  23. package/lib/components/NHDynamicFormShow/customModule/common/CommonMethod.js +0 -43
  24. package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/EditForm.js +0 -1113
  25. package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/index.js +0 -263
  26. package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/EditForm.js +0 -880
  27. package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/index.js +0 -171
  28. package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/EditForm.js +0 -865
  29. package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/index.js +0 -138
  30. package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/EditForm.js +0 -571
  31. package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/index.js +0 -147
  32. package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/EditForm.js +0 -474
  33. package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/index.js +0 -139
  34. package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/EditForm.js +0 -506
  35. package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/index.js +0 -143
  36. package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/EditForm.js +0 -1074
  37. package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/index.js +0 -172
  38. package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/EditForm.js +0 -927
  39. package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/index.js +0 -195
  40. package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/EditForm.js +0 -1064
  41. package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/index.js +0 -183
  42. package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/EditForm.js +0 -763
  43. package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/index.js +0 -137
  44. package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/EditForm.js +0 -819
  45. package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/index.js +0 -137
  46. package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/EditForm.js +0 -700
  47. package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/index.js +0 -162
  48. package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/EditForm.js +0 -743
  49. package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/index.js +0 -177
  50. package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/EditForm.js +0 -848
  51. package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/index.js +0 -138
  52. package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/EditForm.js +0 -777
  53. package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/index.js +0 -161
  54. package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/EditForm.js +0 -706
  55. package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/index.js +0 -130
  56. package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/cfjcEditForm.js +0 -413
  57. package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/index.js +0 -135
  58. package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/EditForm.js +0 -1013
  59. package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/index.js +0 -175
  60. package/lib/components/NHDynamicFormShow/customModule/jjrlx/EditForm.js +0 -1345
  61. package/lib/components/NHDynamicFormShow/customModule/jjrlx/index.js +0 -274
  62. package/lib/components/NHDynamicFormShow/customModule/jxj/EditForm.js +0 -669
  63. package/lib/components/NHDynamicFormShow/customModule/jxj/index.js +0 -134
  64. package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/EditForm.js +0 -378
  65. package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/index.js +0 -120
  66. package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/EditForm.js +0 -638
  67. package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/index.js +0 -133
  68. package/lib/components/NHDynamicFormShow/customModule/qgzx/EditForm.js +0 -965
  69. package/lib/components/NHDynamicFormShow/customModule/qgzx/index.js +0 -237
  70. package/lib/components/NHDynamicFormShow/customModule/qjgl/EditForm.js +0 -823
  71. package/lib/components/NHDynamicFormShow/customModule/qjgl/index.js +0 -188
  72. package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/EditForm.js +0 -401
  73. package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/index.js +0 -472
  74. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/EditForm.js +0 -304
  75. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHCascader/index.js +0 -375
  76. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/RadioGroup.js +0 -118
  77. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/index.js +0 -62
  78. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/input-const.js +0 -55
  79. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/render.js +0 -1238
  80. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/index.js +0 -375
  81. package/lib/components/NHDynamicFormShow/customModule/rych/collective/EditForm.js +0 -554
  82. package/lib/components/NHDynamicFormShow/customModule/rych/collective/index.js +0 -130
  83. package/lib/components/NHDynamicFormShow/customModule/rych/personal/EditForm.js +0 -542
  84. package/lib/components/NHDynamicFormShow/customModule/rych/personal/index.js +0 -133
  85. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/EditForm.js +0 -575
  86. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/index.js +0 -130
  87. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/EditForm.js +0 -563
  88. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/index.js +0 -133
  89. package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/EditForm.js +0 -745
  90. package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/index.js +0 -164
  91. package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/EditForm.js +0 -587
  92. package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/index.js +0 -143
  93. package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/EditForm.js +0 -743
  94. package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/index.js +0 -172
  95. package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/EditForm.js +0 -1410
  96. package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/index.js +0 -274
  97. package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/EditForm.js +0 -755
  98. package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/index.js +0 -130
  99. package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/EditForm.js +0 -814
  100. package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/index.js +0 -188
  101. package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/EditForm.js +0 -769
  102. package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/index.js +0 -130
  103. package/lib/components/NHDynamicFormShow/customModule/whgcrych/EditForm.js +0 -1004
  104. package/lib/components/NHDynamicFormShow/customModule/whgcrych/index.js +0 -126
  105. package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/EditForm.js +0 -503
  106. package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/index.js +0 -149
  107. package/lib/components/NHDynamicFormShow/customModule/whtlyhk/EditForm.js +0 -379
  108. package/lib/components/NHDynamicFormShow/customModule/whtlyhk/index.js +0 -148
  109. package/lib/components/NHDynamicFormShow/customModule/whtlzxj/EditForm.js +0 -748
  110. package/lib/components/NHDynamicFormShow/customModule/whtlzxj/index.js +0 -135
  111. package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/EditForm.js +0 -762
  112. package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/index.js +0 -134
  113. package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/cfjcEditForm.js +0 -682
  114. package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/index.js +0 -135
  115. package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/index.js +0 -152
  116. package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/wjsbEditForm.js +0 -783
  117. package/lib/components/NHDynamicFormShow/customModule/zxj/EditForm.js +0 -764
  118. package/lib/components/NHDynamicFormShow/customModule/zxj/index.js +0 -138
  119. package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/cfjcEditForm.js +0 -677
  120. package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/index.js +0 -138
  121. package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/EditForm.js +0 -1173
  122. package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/index.js +0 -242
  123. package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistForm.js +0 -862
  124. package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistIndex.js +0 -201
  125. package/lib/components/NHDynamicFormShow/customModule/zzsd/stuinfo/messageInfo.js +0 -196
  126. package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/index.js +0 -167
  127. package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/wjsbEditForm.js +0 -1096
  128. package/lib/components/NHDynamicFormShow/index.js +0 -647
  129. package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/cardItem/index.js +0 -279
  130. package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/index.js +0 -206
  131. package/lib/components/NHDynamicFormShow/oneOnMany/index.js +0 -419
  132. package/lib/components/NHDynamicFormShow/oneOnOne/EditForm.js +0 -401
  133. package/lib/components/NHDynamicFormShow/oneOnOne/index.js +0 -271
  134. package/lib/components/NHImagePicker/index.js +0 -554
  135. package/lib/components/NHInputPicker/RadioGroup.js +0 -118
  136. package/lib/components/NHInputPicker/index.js +0 -62
  137. package/lib/components/NHInputPicker/input-const.js +0 -55
  138. package/lib/components/NHInputPicker/render.js +0 -1271
  139. package/lib/components/NHListView/index.js +0 -374
  140. package/lib/components/NHMapGeolocation/index.js +0 -537
  141. package/lib/components/NHMapGeolocation/initMap/initGdMap.js +0 -104
  142. package/lib/components/NHMapGeolocation/initMap/initTencentMap.js +0 -138
  143. package/lib/components/NHMapGeolocation/style.js +0 -51
  144. package/lib/components/NHMultiSelect/index.js +0 -272
  145. package/lib/components/NHRadioGroup/index.js +0 -118
  146. package/lib/components/NHSelect/index.js +0 -364
  147. package/lib/components/NHTreeMenu/index.js +0 -126
  148. package/lib/components/NHTreeMenu/treeNode.js +0 -164
  149. package/lib/components/StuSelector/index.js +0 -611
  150. package/lib/layouts/KyInputPicker/edit-page.js +0 -585
  151. package/lib/layouts/KyInputPicker/index.js +0 -220
  152. package/lib/layouts/KyInputPicker/input-const.js +0 -134
  153. package/lib/layouts/KyInputPicker/render.js +0 -2477
  154. package/lib/layouts/KyInputPicker/setting-checkbox.js +0 -850
  155. package/lib/layouts/KyInputPicker/setting-datepicker.js +0 -430
  156. package/lib/layouts/KyInputPicker/setting-datetimepicker.js +0 -443
  157. package/lib/layouts/KyInputPicker/setting-input.js +0 -555
  158. package/lib/layouts/KyInputPicker/setting-inputNumber.js +0 -612
  159. package/lib/layouts/KyInputPicker/setting-monthpicker.js +0 -434
  160. package/lib/layouts/KyInputPicker/setting-multiSelect.js +0 -532
  161. package/lib/layouts/KyInputPicker/setting-nhcascader.js +0 -584
  162. package/lib/layouts/KyInputPicker/setting-old-upload.js +0 -428
  163. package/lib/layouts/KyInputPicker/setting-radio.js +0 -468
  164. package/lib/layouts/KyInputPicker/setting-rangepicker.js +0 -466
  165. package/lib/layouts/KyInputPicker/setting-select.js +0 -534
  166. package/lib/layouts/KyInputPicker/setting-stu-selector.js +0 -507
  167. package/lib/layouts/KyInputPicker/setting-switch.js +0 -274
  168. package/lib/layouts/KyInputPicker/setting-tea-selector.js +0 -507
  169. package/lib/layouts/KyInputPicker/setting-textarea.js +0 -619
  170. package/lib/layouts/KyInputPicker/setting-timepicker.js +0 -437
  171. package/lib/layouts/KyInputPicker/setting-upload.js +0 -766
  172. package/lib/layouts/KyModal/buildTitle.js +0 -81
  173. package/lib/layouts/KyModal/dragM.js +0 -127
  174. package/lib/layouts/KyModal/index.js +0 -321
  175. package/lib/layouts/KyPreview/index.js +0 -219
  176. package/lib/layouts/KyUpload/index.js +0 -1155
  177. package/lib/utils/browserJudge.js +0 -33
  178. package/lib/utils/dynamicLoadCss.js +0 -14
  179. package/lib/utils/dynamicLoadJs.js +0 -21
  180. package/lib/utils/getStyle.js +0 -26
  181. package/lib/utils/getSuitHeight.js +0 -49
  182. package/lib/utils/hasAuth.js +0 -11
  183. package/lib/utils/loadJS.js +0 -40
  184. /package/lib/layouts/{login → Login}/index-pre.js +0 -0
  185. /package/lib/layouts/{login → Login}/index.js +0 -0
  186. /package/lib/layouts/{login → Login}/login.js +0 -0
  187. /package/lib/layouts/{login → Login}/lyPassword.js +0 -0
@@ -1,374 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _listView = require('antd-mobile/lib/list-view');
8
-
9
- var _listView2 = _interopRequireDefault(_listView);
10
-
11
- var _searchBar = require('antd-mobile/lib/search-bar');
12
-
13
- var _searchBar2 = _interopRequireDefault(_searchBar);
14
-
15
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
16
-
17
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
18
-
19
- require('antd-mobile/lib/list-view/style/css');
20
-
21
- require('antd-mobile/lib/search-bar/style/css');
22
-
23
- var _react = require('react');
24
-
25
- var _react2 = _interopRequireDefault(_react);
26
-
27
- var _NHFetch = require('../../utils/NHFetch');
28
-
29
- var _NHFetch2 = _interopRequireDefault(_NHFetch);
30
-
31
- var _getLoginUser = require('../../utils/getLoginUser');
32
-
33
- var _getLoginUser2 = _interopRequireDefault(_getLoginUser);
34
-
35
- var _propTypes = require('prop-types');
36
-
37
- var _propTypes2 = _interopRequireDefault(_propTypes);
38
-
39
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40
-
41
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
42
-
43
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44
-
45
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
46
-
47
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
48
-
49
- /**
50
- * 基于ant design mobile 的ListView封装,与antd-mobile同名的属性基本与其保持一致,可以参考其文档
51
- * ListView文档:https://mobile.ant.design/components/list-view-cn/
52
- * 注意事项:
53
- * 1.useBodyScroll跟height必须存在一个,否则无法展示
54
- */
55
- var NHListView = function (_React$Component) {
56
- _inherits(NHListView, _React$Component);
57
-
58
- function NHListView(props) {
59
- _classCallCheck(this, NHListView);
60
-
61
- var _this = _possibleConstructorReturn(this, (NHListView.__proto__ || Object.getPrototypeOf(NHListView)).call(this, props));
62
-
63
- _this.encodeSql = function (params) {
64
- for (var key in params) {
65
- if (key.toUpperCase().startsWith('SQL_') && params[key]) {
66
- // params[key] = encode(params[key]);
67
- params[key] = params[key];
68
- } else if (key.toUpperCase().startsWith('G_') && params[key]) {
69
- params[key] = _this.encodeSql(params[key]);
70
- }
71
- }
72
- return params;
73
- };
74
-
75
- _this.getFilterParams = function () {
76
- var pagination = _this.state.pageData; //分页的参数
77
- var filters = _this.state.filters; //多选过滤的数据
78
- var sorter = _this.state.sorter; //过滤的数据
79
- var searchTextMap = _this.state.searchTextMap; //字段上搜索栏的值
80
- var searchParams = _this.state.searchParams; //传递过来的查询参数
81
- var sqlParams = _this.props.sqlParams; //在sql语句中的参数
82
- var initParams = _this.props.initParams; //初始化参数
83
- var rangeFilter = _this.props.rangeFilter; //是否根据职务范围过滤
84
- var rangeFilterList = _this.props.rangeFilterList; // 自定义职务过滤列表
85
- if (!searchParams) {
86
- searchParams = {};
87
- }
88
- //对里面可能存在的参数值为sql语句进行处理
89
- searchParams = _this.encodeSql(searchParams);
90
- sqlParams = _this.encodeSql(sqlParams);
91
- initParams = _this.encodeSql(initParams);
92
-
93
- var params = {
94
- pagination: pagination,
95
- filters: filters,
96
- sorter: sorter,
97
- searchTextMap: searchTextMap,
98
- searchParams: searchParams,
99
- sqlParams: sqlParams,
100
- initParams: initParams,
101
- sign: _this.props.sign
102
- };
103
-
104
- // 如果启用职位范围过滤
105
- if (rangeFilter) {
106
- var userId = (0, _getLoginUser2.default)() ? (0, _getLoginUser2.default)().userId : '';
107
- params.rangeFilter = { id: userId };
108
- }
109
- if (rangeFilterList) {
110
- params.rangeFilterList = rangeFilterList;
111
- }
112
- return params;
113
- };
114
-
115
- _this.readTableData = function () {
116
- var params = _this.getFilterParams();
117
- _this.setState({ isLoading: true });
118
- var baseUrl = _this.props.baseUrl;
119
- var url = _this.props.url ? _this.props.url : (baseUrl ? baseUrl : window.baseUrl) + "/proData/gridList";
120
- (0, _NHFetch2.default)(url, "POST", params).then(function (res) {
121
- if (res) {
122
- var data = [].concat(_toConsumableArray(_this.state.data), _toConsumableArray(res.data.list));
123
- var hasMore = res.data.pageCount > res.data.pageNum;
124
- _this.setState({
125
- data: data,
126
- dataSource: _this.state.dataSource.cloneWithRows(data),
127
- pageCount: res.data.pageCount,
128
- pageData: {
129
- total: res.data.total,
130
- pageSize: _this.state.pageData.pageSize,
131
- page: _this.state.pageData.page
132
- },
133
- hasMore: hasMore
134
- });
135
- }
136
- _this.setState({ isLoading: false });
137
- }).catch(function (res) {
138
- _this.setState({ isLoading: false });
139
- return res;
140
- });
141
- };
142
-
143
- _this.onEndReached = function (event) {
144
- if (_this.state.isLoading || !_this.state.hasMore) {
145
- return;
146
- }
147
- _this.setState({ isLoading: true });
148
- // 如果传了sign,获取sign对应的查询数据
149
- if (_this.props.sign) {
150
- _this.setState({
151
- pageData: _extends({}, _this.state.pageData, {
152
- page: _this.state.pageData.page + 1
153
- })
154
- }, _this.readTableData);
155
- } else if (_this.props.dataSource) {
156
- // 如果没有sign且存在dataSource,使用DataSource
157
- if (typeof _this.props.onEndReached === 'function') {
158
- _this.props.onEndReached(event, function () {
159
- return _this.setState({ isLoading: false });
160
- });
161
- }
162
- } else {
163
- throw new Error('must be exist sign or dataSource in NHListView');
164
- }
165
- };
166
-
167
- _this.handleSeachBarChange = function (val) {
168
- var commonSearchFields = _this.props.commonSearchFields || [];
169
- var searchFieldsStr = commonSearchFields.map(function (item) {
170
- return item.toUpperCase();
171
- }).join(',');
172
- var searchParams = {};
173
- if (val && val.trim() !== '') {
174
- searchParams[searchFieldsStr] = val;
175
- }
176
- _this.setState({
177
- searchText: val,
178
- searchParams: searchParams
179
- });
180
- };
181
-
182
- _this.onSearch = function () {
183
- if (_this.props.sign) {
184
- _this.setState({
185
- pageData: _extends({}, _this.state.pageData, {
186
- page: 1
187
- }),
188
- data: []
189
- }, _this.readTableData);
190
- } else if (_this.props.dataSource) {
191
- // 如果没有sign且存在dataSource,使用DataSource
192
- if (typeof _this.props.onSearch === 'function') {
193
- _this.props.onSearch(_this.state.searchText, function () {
194
- return _this.setState({ isLoading: false });
195
- });
196
- }
197
- } else {
198
- throw new Error('must be exist sign or dataSource in NHListView');
199
- }
200
- };
201
-
202
- _this.handleSearchClear = function () {
203
- _this.setState({
204
- searchParams: {}
205
- }, _this.onSearch);
206
- };
207
-
208
- _this.getSeatchBar = function () {
209
- if (!_this.props.searchBarVisible) {
210
- return null;
211
- }
212
- return _react2.default.createElement(
213
- 'div',
214
- null,
215
- _react2.default.createElement(_searchBar2.default, {
216
- placeholder: '\u8BF7\u8F93\u5165\u67E5\u8BE2\u6761\u4EF6',
217
- onChange: _this.handleSeachBarChange,
218
- onSubmit: _this.onSearch,
219
- onClear: _this.handleSearchClear
220
- })
221
- );
222
- };
223
-
224
- var dataSource = new _listView2.default.DataSource({
225
- rowHasChanged: function rowHasChanged(row1, row2) {
226
- return row1 !== row2;
227
- }
228
- });
229
-
230
- _this.state = {
231
- dataSource: dataSource,
232
- isLoading: true,
233
- pageData: { //分页设置的是三个参数
234
- total: 0,
235
- pageSize: props.pageSize, //当前页默认多少条数据
236
- page: 1
237
- },
238
- data: [],
239
- hasMore: true
240
- };
241
- return _this;
242
- }
243
-
244
- _createClass(NHListView, [{
245
- key: 'componentDidMount',
246
- value: function componentDidMount() {
247
- if (this.props.searchBarVisible && this.props.sign && (!this.props.commonSearchFields || this.props.commonSearchFields.length <= 0)) {
248
- throw new Error('searchBarVisible and commonSearchFields should exist at the same time when use sign mod');
249
- }
250
- // 根据sign加载数据
251
- if (this.props.sign) {
252
- this.readTableData();
253
- } else if (this.props.dataSource) {
254
- // 使用本地数据
255
- this.setState({
256
- dataSource: this.state.dataSource.cloneWithRows(this.props.dataSource)
257
- });
258
- } else {
259
- // sign与DataSource都不存在,抛出异常
260
- throw new Error('must be exist sign or dataSource in NHListView');
261
- }
262
- }
263
- }, {
264
- key: 'componentWillReceiveProps',
265
- value: function componentWillReceiveProps(nextProps) {
266
- if (nextProps.dataSource !== this.props.dataSource) {
267
- this.setState({
268
- dataSource: this.state.dataSource.cloneWithRows(nextProps.dataSource),
269
- isLoading: false
270
- });
271
- }
272
- }
273
-
274
- // 所有数据已经渲染完,需要获取新的数据
275
-
276
- // 搜索栏变化
277
-
278
- // 搜索操作
279
-
280
- // 搜索栏清空
281
-
282
- }, {
283
- key: 'render',
284
- value: function render() {
285
- var _this2 = this;
286
-
287
- var _props = this.props,
288
- renderRow = _props.renderRow,
289
- renderSeparator = _props.renderSeparator,
290
- scrollRenderAheadDistance = _props.scrollRenderAheadDistance,
291
- onEndReachedThreshold = _props.onEndReachedThreshold,
292
- onScroll = _props.onScroll,
293
- renderHeader = _props.renderHeader,
294
- useBodyScroll = _props.useBodyScroll,
295
- height = _props.height,
296
- searchBarVisible = _props.searchBarVisible;
297
-
298
- var styles = {};
299
- if (!useBodyScroll && height) {
300
- styles.height = height;
301
- styles.overflow = 'auto';
302
- }
303
- return _react2.default.createElement(
304
- 'div',
305
- null,
306
- this.getSeatchBar(),
307
- _react2.default.createElement(_listView2.default, {
308
- ref: function ref(el) {
309
- return _this2.lv = el;
310
- },
311
- dataSource: this.state.dataSource,
312
- renderHeader: renderHeader,
313
- renderFooter: function renderFooter() {
314
- return _react2.default.createElement(
315
- 'div',
316
- { style: { padding: 30, textAlign: 'center' } },
317
- _this2.state.isLoading ? '加载中...' : _this2.state.hasMore ? '加载完成' : '已经到底了'
318
- );
319
- },
320
- renderRow: renderRow,
321
- renderSeparator: renderSeparator,
322
- className: 'am-list',
323
- style: styles,
324
- pageSize: 4,
325
- useBodyScroll: useBodyScroll,
326
- onScroll: onScroll,
327
- scrollRenderAheadDistance: scrollRenderAheadDistance,
328
- onEndReached: this.onEndReached,
329
- onEndReachedThreshold: onEndReachedThreshold
330
- })
331
- );
332
- }
333
- }]);
334
-
335
- return NHListView;
336
- }(_react2.default.Component);
337
-
338
- NHListView.defaultProps = {
339
- renderSeparator: function renderSeparator(sectionID, rowID) {
340
- return _react2.default.createElement('div', {
341
- key: sectionID + '-' + rowID,
342
- style: {
343
- backgroundColor: '#F5F5F9',
344
- height: 8,
345
- borderTop: '1px solid #ECECED',
346
- borderBottom: '1px solid #ECECED'
347
- }
348
- });
349
- }, // 默认的分割渲染
350
- scrollRenderAheadDistance: 500, // 当一个行接近屏幕范围多少像素之内的时候,就开始渲染这一行
351
- onEndReachedThreshold: 10, // 调用onEndReached之前的临界值,单位是像素
352
- pageSize: 20, // 每次查询数据时的条数
353
- useBodyScroll: false, // 使用body作为滚动容器
354
- searchBarVisible: false // 是否显示搜索栏
355
- };
356
- exports.default = NHListView;
357
-
358
-
359
- NHListView.protoTypes = {
360
- sign: _propTypes2.default.string, // 数据源标志
361
- baseUrl: _propTypes2.default.string, // 服务前缀url
362
- url: _propTypes2.default.string, // 数据源接口url,默认为: baseUrl + "/proData/gridList"
363
- renderHeader: _propTypes2.default.func, // 渲染头部,() => renderable
364
- renderSeparator: _propTypes2.default.func, // 渲染分隔区域,(sectionID, rowID, adjacentRowHighlighted) => renderable
365
- renderRow: _propTypes2.default.func, // 渲染每一行,(rowData, sectionID, rowID, highlightRow) => renderable
366
- onEndReached: _propTypes2.default.func, // 所有数据都已经渲染完成触发,sign状态下无效,(event?) => {}
367
- onScroll: _propTypes2.default.func, // 滚动时触发的函数,e => {}
368
- scrollRenderAheadDistance: _propTypes2.default.number, // 当一个行接近屏幕范围多少像素之内的时候,就开始渲染这一行
369
- onEndReachedThreshold: _propTypes2.default.number, // 调用onEndReached之前的临界值,单位是像素
370
- pageSize: _propTypes2.default.number, // 每次获取数据时的条数
371
- commonSearchFields: _propTypes2.default.array, // 通用搜索的字段名称
372
- searchBarVisible: _propTypes2.default.bool, // 是否显示搜索栏
373
- onSearch: _propTypes2.default.func // dataSource作为数据源时通过这个方法通知外部进行搜索过滤
374
- };