@bchr/bchr-front-lib 0.5.9 → 0.5.10
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.
- package/lib/base/BaseAppUtils.js +10 -2
- package/lib/base/layout/FormRefInput.js +248 -0
- package/lib/base/layout/GridSelectModal.js +507 -0
- package/lib/base/layout/InputRefAddonBtn.js +300 -0
- package/lib/base/layout/KendoGridCellRenders.js +1170 -0
- package/lib/base/layout/RefInput.js +262 -0
- package/lib/base/utils/TableDataProcessors.js +103 -0
- package/lib/services/KendoGridAPI.js +392 -0
- package/lib/services/http.js +605 -0
- package/package.json +1 -1
- package/src/base/BaseAppUtils.js +10 -1
- package/src/base/layout/FormRefInput.js +144 -0
- package/src/base/layout/GridSelectModal.js +329 -0
- package/src/base/layout/InputRefAddonBtn.js +120 -0
- package/src/base/layout/KendoGridCellRenders.js +790 -0
- package/src/base/layout/RefInput.js +148 -0
- package/src/base/utils/TableDataProcessors.js +87 -0
- package/src/services/KendoGridAPI.js +298 -0
- package/src/services/http.js +611 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _antd = require("antd");
|
|
11
|
+
|
|
12
|
+
var _kendoReactGrid = require("@progress/kendo-react-grid");
|
|
13
|
+
|
|
14
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
15
|
+
|
|
16
|
+
var _kendoDataQuery = require("@progress/kendo-data-query");
|
|
17
|
+
|
|
18
|
+
var _KendoGridCellRenders = require("./KendoGridCellRenders");
|
|
19
|
+
|
|
20
|
+
var _Values = _interopRequireDefault(require("../utils/Values"));
|
|
21
|
+
|
|
22
|
+
var _TableDataProcessors = require("../utils/TableDataProcessors");
|
|
23
|
+
|
|
24
|
+
var _BaseAppUtils = require("../BaseAppUtils");
|
|
25
|
+
|
|
26
|
+
var _http = _interopRequireDefault(require("../../services/http"));
|
|
27
|
+
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
+
|
|
30
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
31
|
+
|
|
32
|
+
function _extends() { _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; }; return _extends.apply(this, arguments); }
|
|
33
|
+
|
|
34
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
35
|
+
|
|
36
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
37
|
+
|
|
38
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
39
|
+
|
|
40
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
+
|
|
42
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
43
|
+
|
|
44
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
45
|
+
|
|
46
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
47
|
+
|
|
48
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
49
|
+
|
|
50
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
51
|
+
|
|
52
|
+
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); } }
|
|
53
|
+
|
|
54
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
55
|
+
|
|
56
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
57
|
+
|
|
58
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
59
|
+
|
|
60
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
61
|
+
|
|
62
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
63
|
+
|
|
64
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
65
|
+
|
|
66
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
67
|
+
|
|
68
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
69
|
+
|
|
70
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
71
|
+
|
|
72
|
+
var GridSelectModal = /*#__PURE__*/function (_React$Component) {
|
|
73
|
+
_inherits(GridSelectModal, _React$Component);
|
|
74
|
+
|
|
75
|
+
var _super = _createSuper(GridSelectModal);
|
|
76
|
+
|
|
77
|
+
function GridSelectModal(props) {
|
|
78
|
+
var _this;
|
|
79
|
+
|
|
80
|
+
_classCallCheck(this, GridSelectModal);
|
|
81
|
+
|
|
82
|
+
_this = _super.call(this, props);
|
|
83
|
+
|
|
84
|
+
_defineProperty(_assertThisInitialized(_this), "onGridSelectModalOk", function () {
|
|
85
|
+
var onOk = _this.props.onOk;
|
|
86
|
+
var gridSelectedData = _this.state.gridSelectedData;
|
|
87
|
+
|
|
88
|
+
if (onOk && typeof onOk === 'function') {
|
|
89
|
+
onOk(gridSelectedData);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
_defineProperty(_assertThisInitialized(_this), "onGridHeaderSelectionChange", function (e) {
|
|
94
|
+
var _this$state = _this.state,
|
|
95
|
+
checkedAll = _this$state.checkedAll,
|
|
96
|
+
gridSelectedData = _this$state.gridSelectedData;
|
|
97
|
+
var checked = !!e.target.checked;
|
|
98
|
+
var gridData = _this.state.gridData;
|
|
99
|
+
|
|
100
|
+
if (gridData && gridData.length > 0) {
|
|
101
|
+
gridData.forEach(function (dataItem) {
|
|
102
|
+
return dataItem.selected = checked;
|
|
103
|
+
});
|
|
104
|
+
gridSelectedData = _toConsumableArray(gridData.filter(function (dataItem) {
|
|
105
|
+
return dataItem.selected;
|
|
106
|
+
}));
|
|
107
|
+
checkedAll = gridData.length === gridSelectedData.length;
|
|
108
|
+
} else {
|
|
109
|
+
checkedAll = true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
_this.setState({
|
|
113
|
+
gridData: gridData,
|
|
114
|
+
gridSelectedData: gridSelectedData,
|
|
115
|
+
checkedAll: checkedAll,
|
|
116
|
+
checkedIndeterminate: false
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
_defineProperty(_assertThisInitialized(_this), "onGridRowSelectionChange", function (e) {
|
|
121
|
+
var _this$state2 = _this.state,
|
|
122
|
+
checkedAll = _this$state2.checkedAll,
|
|
123
|
+
checkedIndeterminate = _this$state2.checkedIndeterminate,
|
|
124
|
+
gridSelectedData = _this$state2.gridSelectedData;
|
|
125
|
+
var selectedRowData = e.dataItem;
|
|
126
|
+
selectedRowData.selected = !selectedRowData.selected;
|
|
127
|
+
var gridData = _this.state.gridData;
|
|
128
|
+
|
|
129
|
+
if (gridData && gridData.length > 0) {
|
|
130
|
+
gridData.forEach(function (dataItem) {
|
|
131
|
+
if (dataItem.pk === selectedRowData.pk) {
|
|
132
|
+
dataItem.selected = selectedRowData.selected;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
gridSelectedData = _toConsumableArray(gridData.filter(function (dataItem) {
|
|
136
|
+
return dataItem.selected;
|
|
137
|
+
}));
|
|
138
|
+
checkedAll = gridData.length === gridSelectedData.length;
|
|
139
|
+
checkedIndeterminate = gridSelectedData.length && gridData.length !== gridSelectedData.length;
|
|
140
|
+
} else {
|
|
141
|
+
checkedAll = false;
|
|
142
|
+
checkedIndeterminate = false;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
_this.setState({
|
|
146
|
+
gridData: gridData,
|
|
147
|
+
gridSelectedData: gridSelectedData,
|
|
148
|
+
checkedAll: checkedAll,
|
|
149
|
+
checkedIndeterminate: checkedIndeterminate
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
_defineProperty(_assertThisInitialized(_this), "buildGridColumns", function (gridColumns) {
|
|
154
|
+
if (!gridColumns || !gridColumns.length) {
|
|
155
|
+
return /*#__PURE__*/_react["default"].createElement(_antd.Empty, {
|
|
156
|
+
image: /*#__PURE__*/_react["default"].createElement("span", {
|
|
157
|
+
className: "iconfont icon-personal-empty"
|
|
158
|
+
}),
|
|
159
|
+
description: "暂无数据"
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return gridColumns.map(function (column) {
|
|
164
|
+
if (column.show) {
|
|
165
|
+
return /*#__PURE__*/_react["default"].createElement(_kendoReactGrid.GridColumn, {
|
|
166
|
+
key: "grid_select_modal_column_".concat(column.code),
|
|
167
|
+
className: 'text-center',
|
|
168
|
+
headerClassName: 'text-center',
|
|
169
|
+
width: column.width,
|
|
170
|
+
title: column.name,
|
|
171
|
+
field: column.code
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return null;
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
var refUIConfig = props.refUIConfig,
|
|
180
|
+
refCode = props.refCode;
|
|
181
|
+
_this.state = {
|
|
182
|
+
visible: false,
|
|
183
|
+
loading: true,
|
|
184
|
+
gridColumns: refUIConfig === null || refUIConfig === void 0 ? void 0 : refUIConfig.gridColumns,
|
|
185
|
+
gridData: [],
|
|
186
|
+
total: 0,
|
|
187
|
+
gridSelectedData: [],
|
|
188
|
+
checkedAll: false,
|
|
189
|
+
checkedIndeterminate: false,
|
|
190
|
+
gridOperator: {
|
|
191
|
+
skip: 0,
|
|
192
|
+
take: 20
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
_this.showModal = _this.showModal.bind(_assertThisInitialized(_this));
|
|
196
|
+
_this.hideModal = _this.hideModal.bind(_assertThisInitialized(_this));
|
|
197
|
+
_this.queryRefData = _this.queryRefData.bind(_assertThisInitialized(_this));
|
|
198
|
+
return _this;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
_createClass(GridSelectModal, [{
|
|
202
|
+
key: "componentDidMount",
|
|
203
|
+
value: function componentDidMount() {
|
|
204
|
+
this.queryRefData();
|
|
205
|
+
}
|
|
206
|
+
}, {
|
|
207
|
+
key: "queryRefData",
|
|
208
|
+
value: function () {
|
|
209
|
+
var _queryRefData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
210
|
+
var _this$props, refCode, isNotData, customGridData, refUIConfig, gridOperator, pageQueryParameters, result, gridData, total;
|
|
211
|
+
|
|
212
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
213
|
+
while (1) {
|
|
214
|
+
switch (_context.prev = _context.next) {
|
|
215
|
+
case 0:
|
|
216
|
+
_context.prev = 0;
|
|
217
|
+
_this$props = this.props, refCode = _this$props.refCode, isNotData = _this$props.isNotData, customGridData = _this$props.customGridData, refUIConfig = _this$props.refUIConfig;
|
|
218
|
+
gridOperator = this.state.gridOperator;
|
|
219
|
+
|
|
220
|
+
if (!isNotData) {
|
|
221
|
+
_context.next = 7;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
this.setState({
|
|
226
|
+
gridData: customGridData || []
|
|
227
|
+
});
|
|
228
|
+
_context.next = 13;
|
|
229
|
+
break;
|
|
230
|
+
|
|
231
|
+
case 7:
|
|
232
|
+
pageQueryParameters = (0, _TableDataProcessors.buildQueryParameters)(gridOperator);
|
|
233
|
+
_context.next = 10;
|
|
234
|
+
return _http["default"].postJSON('queryRefData?ref_code=' + refCode, pageQueryParameters);
|
|
235
|
+
|
|
236
|
+
case 10:
|
|
237
|
+
result = _context.sent;
|
|
238
|
+
|
|
239
|
+
if (refUIConfig.pageable) {
|
|
240
|
+
gridData = result.data || [];
|
|
241
|
+
total = result.total || 0;
|
|
242
|
+
} else {
|
|
243
|
+
gridData = result || [];
|
|
244
|
+
total = result.length;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
this.setState({
|
|
248
|
+
gridData: gridData,
|
|
249
|
+
total: total
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
case 13:
|
|
253
|
+
_context.next = 18;
|
|
254
|
+
break;
|
|
255
|
+
|
|
256
|
+
case 15:
|
|
257
|
+
_context.prev = 15;
|
|
258
|
+
_context.t0 = _context["catch"](0);
|
|
259
|
+
this.dealAjaxException(_context.t0);
|
|
260
|
+
|
|
261
|
+
case 18:
|
|
262
|
+
_context.prev = 18;
|
|
263
|
+
this.setState({
|
|
264
|
+
loading: false
|
|
265
|
+
});
|
|
266
|
+
return _context.finish(18);
|
|
267
|
+
|
|
268
|
+
case 21:
|
|
269
|
+
case "end":
|
|
270
|
+
return _context.stop();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}, _callee, this, [[0, 15, 18, 21]]);
|
|
274
|
+
}));
|
|
275
|
+
|
|
276
|
+
function queryRefData() {
|
|
277
|
+
return _queryRefData.apply(this, arguments);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return queryRefData;
|
|
281
|
+
}()
|
|
282
|
+
}, {
|
|
283
|
+
key: "showModal",
|
|
284
|
+
value: function showModal() {
|
|
285
|
+
this.setState({
|
|
286
|
+
visible: true
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}, {
|
|
290
|
+
key: "hideModal",
|
|
291
|
+
value: function hideModal() {
|
|
292
|
+
this.setState({
|
|
293
|
+
visible: false
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}, {
|
|
297
|
+
key: "onDataStateChange",
|
|
298
|
+
value: function onDataStateChange(e) {
|
|
299
|
+
var _this2 = this;
|
|
300
|
+
|
|
301
|
+
var refUIConfig = this.props.refUIConfig;
|
|
302
|
+
var _this$state3 = this.state,
|
|
303
|
+
gridData = _this$state3.gridData,
|
|
304
|
+
total = _this$state3.total,
|
|
305
|
+
loading = _this$state3.loading;
|
|
306
|
+
var pageable = refUIConfig === null || refUIConfig === void 0 ? void 0 : refUIConfig.pageable;
|
|
307
|
+
|
|
308
|
+
if (pageable) {
|
|
309
|
+
gridData = [];
|
|
310
|
+
total = 0;
|
|
311
|
+
loading = true;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
this.setState({
|
|
315
|
+
gridData: gridData,
|
|
316
|
+
total: total,
|
|
317
|
+
loading: loading,
|
|
318
|
+
gridOperator: e.dataState
|
|
319
|
+
}, function () {
|
|
320
|
+
if (refUIConfig.pageable) {
|
|
321
|
+
_this2.queryRefData();
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}, {
|
|
326
|
+
key: "onRadioGridRowSelectionChange",
|
|
327
|
+
value: function onRadioGridRowSelectionChange(state, e) {
|
|
328
|
+
var _this3 = this;
|
|
329
|
+
|
|
330
|
+
var event = null;
|
|
331
|
+
var gridSelectedData = [];
|
|
332
|
+
|
|
333
|
+
if (_lodash["default"].isObject(state)) {
|
|
334
|
+
event = state;
|
|
335
|
+
} else {
|
|
336
|
+
event = e;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
var selectedRowData = event.dataItem;
|
|
340
|
+
selectedRowData.selected = !selectedRowData.selected;
|
|
341
|
+
var gridData = this.state.gridData;
|
|
342
|
+
|
|
343
|
+
if (gridData && gridData.length > 0) {
|
|
344
|
+
gridData.forEach(function (dataItem) {
|
|
345
|
+
dataItem.selected = dataItem.pk === selectedRowData.pk;
|
|
346
|
+
});
|
|
347
|
+
gridSelectedData = _toConsumableArray(gridData.filter(function (dataItem) {
|
|
348
|
+
return dataItem.selected;
|
|
349
|
+
}));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
this.setState({
|
|
353
|
+
gridData: gridData,
|
|
354
|
+
gridSelectedData: gridSelectedData
|
|
355
|
+
}, function () {
|
|
356
|
+
if (state && !_lodash["default"].isObject(state)) {
|
|
357
|
+
var onOk = _this3.props.onOk;
|
|
358
|
+
|
|
359
|
+
if (onOk && typeof onOk === 'function') {
|
|
360
|
+
onOk(gridSelectedData);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}, {
|
|
366
|
+
key: "render",
|
|
367
|
+
value: function render() {
|
|
368
|
+
var _this4 = this;
|
|
369
|
+
|
|
370
|
+
var _this$props2 = this.props,
|
|
371
|
+
refUIConfig = _this$props2.refUIConfig,
|
|
372
|
+
className = _this$props2.className,
|
|
373
|
+
multiple = _this$props2.multiple,
|
|
374
|
+
title = _this$props2.title,
|
|
375
|
+
children = _this$props2.children,
|
|
376
|
+
visible = _this$props2.visible,
|
|
377
|
+
onCancel = _this$props2.onCancel;
|
|
378
|
+
var _this$state4 = this.state,
|
|
379
|
+
loading = _this$state4.loading,
|
|
380
|
+
checkedAll = _this$state4.checkedAll,
|
|
381
|
+
checkedIndeterminate = _this$state4.checkedIndeterminate,
|
|
382
|
+
gridData = _this$state4.gridData,
|
|
383
|
+
total = _this$state4.total,
|
|
384
|
+
gridOperator = _this$state4.gridOperator,
|
|
385
|
+
gridColumns = _this$state4.gridColumns;
|
|
386
|
+
var modalTitle = refUIConfig === null || refUIConfig === void 0 ? void 0 : refUIConfig.refTitle;
|
|
387
|
+
|
|
388
|
+
if (_Values["default"].isNotBlankString(title)) {
|
|
389
|
+
modalTitle = title;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (_Values["default"].isBlankString(modalTitle)) {
|
|
393
|
+
modalTitle = "请选择";
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
var pageable = refUIConfig === null || refUIConfig === void 0 ? void 0 : refUIConfig.pageable;
|
|
397
|
+
|
|
398
|
+
if (pageable) {
|
|
399
|
+
pageable = {
|
|
400
|
+
pageSizes: [20, 50, 100, 200],
|
|
401
|
+
type: 'numeric'
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
var _this$props3 = this.props,
|
|
406
|
+
_this$props3$width = _this$props3.width,
|
|
407
|
+
width = _this$props3$width === void 0 ? 600 : _this$props3$width,
|
|
408
|
+
_this$props3$height = _this$props3.height,
|
|
409
|
+
height = _this$props3$height === void 0 ? 300 : _this$props3$height;
|
|
410
|
+
return /*#__PURE__*/_react["default"].createElement(_antd.Modal, {
|
|
411
|
+
className: "grid-select-modal ".concat(className || ''),
|
|
412
|
+
title: modalTitle,
|
|
413
|
+
visible: visible,
|
|
414
|
+
width: width,
|
|
415
|
+
height: height + 102,
|
|
416
|
+
style: {
|
|
417
|
+
minHeight: "".concat(height + 102, "px")
|
|
418
|
+
},
|
|
419
|
+
onOk: this.onGridSelectModalOk,
|
|
420
|
+
onCancel: onCancel
|
|
421
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
422
|
+
className: "grid-select-content",
|
|
423
|
+
style: {
|
|
424
|
+
height: "".concat(height, "px")
|
|
425
|
+
}
|
|
426
|
+
}, /*#__PURE__*/_react["default"].createElement(_antd.Spin, {
|
|
427
|
+
spinning: loading,
|
|
428
|
+
tip: _BaseAppUtils.loadingTips.loading
|
|
429
|
+
}, /*#__PURE__*/_react["default"].createElement(_kendoReactGrid.Grid, _extends({
|
|
430
|
+
data: pageable ? gridData : (0, _kendoDataQuery.process)(gridData, {
|
|
431
|
+
filter: gridOperator.filter
|
|
432
|
+
})
|
|
433
|
+
}, pageable ? gridOperator : {
|
|
434
|
+
filter: gridOperator.filter
|
|
435
|
+
}, {
|
|
436
|
+
filterable: true,
|
|
437
|
+
pageable: pageable,
|
|
438
|
+
sortable: true,
|
|
439
|
+
resizable: true,
|
|
440
|
+
reorderable: false,
|
|
441
|
+
total: total,
|
|
442
|
+
selectable: {
|
|
443
|
+
mode: "single"
|
|
444
|
+
},
|
|
445
|
+
selectedField: "selected",
|
|
446
|
+
onDataStateChange: this.onDataStateChange.bind(this),
|
|
447
|
+
onRowClick: this.onRadioGridRowSelectionChange.bind(this),
|
|
448
|
+
onRowDoubleClick: this.onRadioGridRowSelectionChange.bind(this, true)
|
|
449
|
+
}), /*#__PURE__*/_react["default"].createElement(_kendoReactGrid.GridColumn, {
|
|
450
|
+
field: "selected",
|
|
451
|
+
className: 'text-center',
|
|
452
|
+
title: "选择",
|
|
453
|
+
width: "60px",
|
|
454
|
+
headerClassName: "text-center",
|
|
455
|
+
locked: true,
|
|
456
|
+
headerCell: function headerCell(props) {
|
|
457
|
+
if (multiple) {
|
|
458
|
+
return /*#__PURE__*/_react["default"].createElement(_antd.Checkbox.Group, null, /*#__PURE__*/_react["default"].createElement(_antd.Checkbox, {
|
|
459
|
+
defaultChecked: false,
|
|
460
|
+
checked: checkedAll,
|
|
461
|
+
indeterminate: checkedIndeterminate,
|
|
462
|
+
onChange: _this4.onGridHeaderSelectionChange.bind(_this4)
|
|
463
|
+
}));
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
return /*#__PURE__*/_react["default"].createElement("span", null, "\u9009\u62E9");
|
|
467
|
+
},
|
|
468
|
+
filterCell: _KendoGridCellRenders.KendoGridFilterCellRender,
|
|
469
|
+
cell: function cell(props) {
|
|
470
|
+
var className = props.className,
|
|
471
|
+
dataItem = props.dataItem,
|
|
472
|
+
style = props.style;
|
|
473
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
474
|
+
className: className,
|
|
475
|
+
style: style
|
|
476
|
+
}, !multiple && /*#__PURE__*/_react["default"].createElement(_antd.Radio, {
|
|
477
|
+
checked: dataItem.selected,
|
|
478
|
+
onChange: _this4.onRadioGridRowSelectionChange.bind(_this4, props)
|
|
479
|
+
}), multiple && /*#__PURE__*/_react["default"].createElement(_antd.Checkbox, {
|
|
480
|
+
checked: dataItem.selected,
|
|
481
|
+
onChange: _this4.onGridRowSelectionChange.bind(_this4, props)
|
|
482
|
+
}));
|
|
483
|
+
}
|
|
484
|
+
}), /*#__PURE__*/_react["default"].createElement(_kendoReactGrid.GridColumn, {
|
|
485
|
+
headerClassName: "text-center",
|
|
486
|
+
title: "\u5E8F\u53F7",
|
|
487
|
+
editable: false,
|
|
488
|
+
filterable: false,
|
|
489
|
+
locked: true,
|
|
490
|
+
className: "text-center",
|
|
491
|
+
width: "60px",
|
|
492
|
+
cell: _KendoGridCellRenders.KendoGridRowNumberCellRender
|
|
493
|
+
}), this.buildGridColumns(gridColumns), /*#__PURE__*/_react["default"].createElement(_kendoReactGrid.GridColumn, {
|
|
494
|
+
headerClassName: "text-center",
|
|
495
|
+
title: "",
|
|
496
|
+
filterable: false,
|
|
497
|
+
editable: false,
|
|
498
|
+
className: "text-center"
|
|
499
|
+
})))), children);
|
|
500
|
+
}
|
|
501
|
+
}]);
|
|
502
|
+
|
|
503
|
+
return GridSelectModal;
|
|
504
|
+
}(_react["default"].Component);
|
|
505
|
+
|
|
506
|
+
var _default = GridSelectModal;
|
|
507
|
+
exports["default"] = _default;
|