raise-common-lib 0.0.1 → 0.0.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.
- package/bundles/raise-common-lib.umd.js +1130 -0
- package/bundles/raise-common-lib.umd.js.map +1 -0
- package/bundles/raise-common-lib.umd.min.js +16 -0
- package/bundles/raise-common-lib.umd.min.js.map +1 -0
- package/esm2015/lib/common-grid/index.component.js +716 -0
- package/esm2015/lib/constant/index.js +107 -0
- package/esm2015/lib/raise-common-lib.module.js +38 -0
- package/esm2015/public-api.js +11 -0
- package/esm2015/raise-common-lib.js +10 -0
- package/esm5/lib/common-grid/index.component.js +865 -0
- package/esm5/lib/constant/index.js +107 -0
- package/esm5/lib/raise-common-lib.module.js +42 -0
- package/esm5/public-api.js +11 -0
- package/esm5/raise-common-lib.js +10 -0
- package/fesm2015/raise-common-lib.js +766 -0
- package/fesm2015/raise-common-lib.js.map +1 -0
- package/fesm5/raise-common-lib.js +917 -0
- package/fesm5/raise-common-lib.js.map +1 -0
- package/lib/common-grid/index.component.d.ts +116 -0
- package/lib/constant/index.d.ts +54 -0
- package/lib/raise-common-lib.module.d.ts +2 -0
- package/package.json +17 -4
- package/{src/public-api.ts → public-api.d.ts} +2 -5
- package/raise-common-lib.d.ts +4 -0
- package/raise-common-lib.metadata.json +1 -0
- package/karma.conf.js +0 -32
- package/ng-package.json +0 -7
- package/src/lib/common-grid/grid-utils.ts +0 -26
- package/src/lib/common-grid/index.component.html +0 -80
- package/src/lib/common-grid/index.component.scss +0 -230
- package/src/lib/common-grid/index.component.ts +0 -420
- package/src/lib/constant/index.ts +0 -59
- package/src/lib/raise-common-lib.module.ts +0 -48
- package/tsconfig.lib.json +0 -26
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
|
@@ -0,0 +1,766 @@
|
|
|
1
|
+
import { EventEmitter, Component, ChangeDetectorRef, ViewChild, Input, Output, NgModule } from '@angular/core';
|
|
2
|
+
import { GridModule, PagerModule, GridAllModule, PageService, SortService, FilterService, ExcelExportService, EditService, ResizeService, ToolbarService, ColumnChooserService, AggregateService, ColumnMenuService, DetailRowService, SelectionService, GroupService } from '@syncfusion/ej2-angular-grids';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview added by tsickle
|
|
7
|
+
* Generated from: lib/common-grid/index.component.ts
|
|
8
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
9
|
+
*/
|
|
10
|
+
class CommonGridComponent {
|
|
11
|
+
/**
|
|
12
|
+
* @param {?} ref
|
|
13
|
+
*/
|
|
14
|
+
constructor(ref) {
|
|
15
|
+
this.ref = ref;
|
|
16
|
+
this.showCheckBox = true;
|
|
17
|
+
this.loaded = true;
|
|
18
|
+
this.hiddenLoaded = false;
|
|
19
|
+
this.authorized = true; // Dataset是否授权,未授权则显示权限错误提示
|
|
20
|
+
// Dataset是否授权,未授权则显示权限错误提示
|
|
21
|
+
// only use for local data pagination
|
|
22
|
+
this.selectedDiffKey = '';
|
|
23
|
+
this.gridHeight = '';
|
|
24
|
+
// 这玩意必填,不然filter columnChooser都会报错
|
|
25
|
+
this.gridId = 'grid';
|
|
26
|
+
this.resizeSettings = { mode: 'Auto' };
|
|
27
|
+
this.filterSettings = { type: 'Menu' };
|
|
28
|
+
this.fields = [];
|
|
29
|
+
this.dataSource = [];
|
|
30
|
+
this.allowPaging = true;
|
|
31
|
+
this.clipMode = 'EllipsisWithTooltip';
|
|
32
|
+
this.checkBoxWidth = 32; // col 数量过少的时候,check宽度会拉伸,这时候设置null
|
|
33
|
+
/**
|
|
34
|
+
* Sample: [
|
|
35
|
+
* {
|
|
36
|
+
* text: "Preview",
|
|
37
|
+
* target: ".e-content",
|
|
38
|
+
* id: "preview-icon",
|
|
39
|
+
* iconCss: "preview",
|
|
40
|
+
* },
|
|
41
|
+
* {
|
|
42
|
+
* text: "Download",
|
|
43
|
+
* target: ".e-content",
|
|
44
|
+
* id: "download-icon",
|
|
45
|
+
* iconCss: "download",
|
|
46
|
+
* }
|
|
47
|
+
* ]
|
|
48
|
+
* 用于定义row中 点击事件
|
|
49
|
+
*/
|
|
50
|
+
this.contextMenuItems = [];
|
|
51
|
+
// @Input() selectionSettings = { checkboxOnly: true, type: "Multiple" };
|
|
52
|
+
this.selectionSettings = {
|
|
53
|
+
type: 'Multiple',
|
|
54
|
+
// persistSelection: true,
|
|
55
|
+
checkboxOnly: true,
|
|
56
|
+
};
|
|
57
|
+
this.alwaysShowCheckbox = false;
|
|
58
|
+
this.disableSystemRow = false; // 禁用IsSytem = true的整行
|
|
59
|
+
// 禁用IsSytem = true的整行
|
|
60
|
+
this.recordDoubleClick = new EventEmitter();
|
|
61
|
+
this.actionComplete = new EventEmitter();
|
|
62
|
+
this.rowSelected = new EventEmitter();
|
|
63
|
+
this.rowDeselected = new EventEmitter();
|
|
64
|
+
this.onContextMenu = new EventEmitter();
|
|
65
|
+
this.actionHandler = new EventEmitter();
|
|
66
|
+
this.queryCellInfo = new EventEmitter();
|
|
67
|
+
this.recordClick = new EventEmitter();
|
|
68
|
+
this.actionBegin = new EventEmitter();
|
|
69
|
+
this.rowDataBound = new EventEmitter();
|
|
70
|
+
this.dataBound = new EventEmitter();
|
|
71
|
+
this.exportQueryCellInfo = new EventEmitter();
|
|
72
|
+
this.rowSelecting = new EventEmitter();
|
|
73
|
+
this.selectId = [];
|
|
74
|
+
this.startPaging = false;
|
|
75
|
+
this.indexList = [];
|
|
76
|
+
this.className = 'grid-loading';
|
|
77
|
+
this.translation = JSON.parse(localStorage.getItem('translation'));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @return {?}
|
|
81
|
+
*/
|
|
82
|
+
ngOnInit() {
|
|
83
|
+
if (this.hiddenLoaded)
|
|
84
|
+
this.className = '';
|
|
85
|
+
this.ref && this.ref.markForCheck();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @param {?} index
|
|
89
|
+
* @param {?} item
|
|
90
|
+
* @return {?}
|
|
91
|
+
*/
|
|
92
|
+
trackByFn(index, item) {
|
|
93
|
+
return index; // or a unique identifier in your object
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @param {?} changes
|
|
97
|
+
* @return {?}
|
|
98
|
+
*/
|
|
99
|
+
ngOnChanges(changes) {
|
|
100
|
+
if (changes.dataSource && changes.dataSource.currentValue) {
|
|
101
|
+
if (this.allowPaging &&
|
|
102
|
+
changes.dataSource.currentValue.length &&
|
|
103
|
+
!this.pageSettings) {
|
|
104
|
+
this.pageSettings =
|
|
105
|
+
changes.dataSource.currentValue.length > 9
|
|
106
|
+
? {
|
|
107
|
+
pageSizes: ['All', '25', '50', '100'],
|
|
108
|
+
pageSize: 50,
|
|
109
|
+
}
|
|
110
|
+
: null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @return {?}
|
|
116
|
+
*/
|
|
117
|
+
_load() {
|
|
118
|
+
if (!this.authorized) {
|
|
119
|
+
((/** @type {?} */ (this.grid.localeObj))).localeStrings.EmptyRecord =
|
|
120
|
+
this.translation.YOU_DO_NOT_HAVE_THE_DATASET_PERMISSION ||
|
|
121
|
+
"You don't have the dataset permission to view the record.";
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @param {?} args
|
|
126
|
+
* @return {?}
|
|
127
|
+
*/
|
|
128
|
+
_dataBound(args) {
|
|
129
|
+
// 整个组件加载完成时的回调函数
|
|
130
|
+
/** @type {?} */
|
|
131
|
+
var pagerContainer = document.querySelector('.e-pagercontainer');
|
|
132
|
+
if (pagerContainer) {
|
|
133
|
+
/** @type {?} */
|
|
134
|
+
var linkElements = pagerContainer.querySelectorAll('.e-link');
|
|
135
|
+
linkElements.forEach((/**
|
|
136
|
+
* @param {?} element
|
|
137
|
+
* @return {?}
|
|
138
|
+
*/
|
|
139
|
+
function (element) {
|
|
140
|
+
element.removeAttribute('href'); // SMP2-10310 删除分页器的href属性
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
if (this.selectedDiffKey) {
|
|
144
|
+
setTimeout((/**
|
|
145
|
+
* @return {?}
|
|
146
|
+
*/
|
|
147
|
+
() => {
|
|
148
|
+
this.chooseRecords();
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
this.dataBound.emit(args);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* @param {?} args
|
|
155
|
+
* @return {?}
|
|
156
|
+
*/
|
|
157
|
+
_exportQueryCellInfo(args) {
|
|
158
|
+
this.exportQueryCellInfo.emit(args);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @param {?} $event
|
|
162
|
+
* @return {?}
|
|
163
|
+
*/
|
|
164
|
+
_recordDoubleClick($event) {
|
|
165
|
+
this.recordDoubleClick.emit($event);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* [selectionSettings]="{ checkboxOnly: true }"
|
|
169
|
+
* [showCheckBox]="true"
|
|
170
|
+
* 控件使用时,必须配置上面两个属性,否则,全选会失效
|
|
171
|
+
* @param {?} $event
|
|
172
|
+
* @return {?}
|
|
173
|
+
*/
|
|
174
|
+
_rowSelected($event) {
|
|
175
|
+
if (this.selectedDiffKey) {
|
|
176
|
+
if ($event.isHeaderCheckboxClicked && Array.isArray($event.data)) {
|
|
177
|
+
if ($event.data && $event.data.length) {
|
|
178
|
+
$event.data.forEach((/**
|
|
179
|
+
* @param {?} item
|
|
180
|
+
* @return {?}
|
|
181
|
+
*/
|
|
182
|
+
(item) => {
|
|
183
|
+
item.isSelected = true;
|
|
184
|
+
this.selectId.push(item);
|
|
185
|
+
}));
|
|
186
|
+
this.dataSource.forEach((/**
|
|
187
|
+
* @param {?} data
|
|
188
|
+
* @return {?}
|
|
189
|
+
*/
|
|
190
|
+
(data) => {
|
|
191
|
+
$event.data.forEach((/**
|
|
192
|
+
* @param {?} _data
|
|
193
|
+
* @return {?}
|
|
194
|
+
*/
|
|
195
|
+
(_data) => {
|
|
196
|
+
if (_data[this.selectedDiffKey] === data[this.selectedDiffKey]) {
|
|
197
|
+
data.isSelected = true;
|
|
198
|
+
}
|
|
199
|
+
}));
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
$event.data.isSelected = true;
|
|
205
|
+
this.selectId.push($event.data);
|
|
206
|
+
this.dataSource.forEach((/**
|
|
207
|
+
* @param {?} data
|
|
208
|
+
* @return {?}
|
|
209
|
+
*/
|
|
210
|
+
(data) => {
|
|
211
|
+
if (data[this.selectedDiffKey] === $event.data[this.selectedDiffKey]) {
|
|
212
|
+
data.isSelected = true;
|
|
213
|
+
}
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
this.ref && this.ref.markForCheck();
|
|
217
|
+
}
|
|
218
|
+
this.rowSelected.emit($event);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @param {?} $event
|
|
222
|
+
* @return {?}
|
|
223
|
+
*/
|
|
224
|
+
_rowDeselected($event) {
|
|
225
|
+
if (this.selectedDiffKey) {
|
|
226
|
+
if (this.startPaging) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if ($event.isHeaderCheckboxClicked && Array.isArray($event.data)) {
|
|
230
|
+
$event.data.forEach((/**
|
|
231
|
+
* @param {?} item
|
|
232
|
+
* @return {?}
|
|
233
|
+
*/
|
|
234
|
+
(item) => {
|
|
235
|
+
item.isSelected = false;
|
|
236
|
+
}));
|
|
237
|
+
this.selectId = [];
|
|
238
|
+
this.dataSource.forEach((/**
|
|
239
|
+
* @param {?} data
|
|
240
|
+
* @return {?}
|
|
241
|
+
*/
|
|
242
|
+
(data) => {
|
|
243
|
+
$event.data.forEach((/**
|
|
244
|
+
* @param {?} _data
|
|
245
|
+
* @return {?}
|
|
246
|
+
*/
|
|
247
|
+
(_data) => {
|
|
248
|
+
if (_data[this.selectedDiffKey] === data[this.selectedDiffKey]) {
|
|
249
|
+
data.isSelected = false;
|
|
250
|
+
}
|
|
251
|
+
}));
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
$event.data.isSelected = false;
|
|
256
|
+
this.selectId = this.selectId.filter((/**
|
|
257
|
+
* @param {?} item
|
|
258
|
+
* @return {?}
|
|
259
|
+
*/
|
|
260
|
+
(item) => item[this.selectedDiffKey] !== $event.data[this.selectedDiffKey]));
|
|
261
|
+
this.dataSource.forEach((/**
|
|
262
|
+
* @param {?} data
|
|
263
|
+
* @return {?}
|
|
264
|
+
*/
|
|
265
|
+
(data) => {
|
|
266
|
+
if (data[this.selectedDiffKey] === $event.data[this.selectedDiffKey]) {
|
|
267
|
+
data.isSelected = false;
|
|
268
|
+
}
|
|
269
|
+
}));
|
|
270
|
+
}
|
|
271
|
+
this.ref && this.ref.markForCheck();
|
|
272
|
+
}
|
|
273
|
+
this.rowDeselected.emit($event);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* @param {?} args
|
|
277
|
+
* @return {?}
|
|
278
|
+
*/
|
|
279
|
+
_onContextMenu(args) {
|
|
280
|
+
this.onContextMenu.emit(args);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* @param {?} args
|
|
284
|
+
* @return {?}
|
|
285
|
+
*/
|
|
286
|
+
_actionBegin(args) {
|
|
287
|
+
if (this.selectedDiffKey &&
|
|
288
|
+
(args.requestType === 'paging' ||
|
|
289
|
+
args.requestType === 'searching' ||
|
|
290
|
+
args.requestType === 'filtering' ||
|
|
291
|
+
args.requestType === 'sorting')) {
|
|
292
|
+
this.startPaging = true;
|
|
293
|
+
}
|
|
294
|
+
this.actionBegin.emit(args);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* @param {?} keywords
|
|
298
|
+
* @return {?}
|
|
299
|
+
*/
|
|
300
|
+
search(keywords) {
|
|
301
|
+
this.grid.search(keywords);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* @param {?} indexList
|
|
305
|
+
* @return {?}
|
|
306
|
+
*/
|
|
307
|
+
selectRows(indexList) {
|
|
308
|
+
this.grid.selectRows(indexList);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* @param {?} index
|
|
312
|
+
* @return {?}
|
|
313
|
+
*/
|
|
314
|
+
selectRow(index) {
|
|
315
|
+
this.grid.selectRow(index);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* @return {?}
|
|
319
|
+
*/
|
|
320
|
+
getCurrentViewRecords() {
|
|
321
|
+
return this.grid.getCurrentViewRecords();
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* @param {?} $event
|
|
325
|
+
* @return {?}
|
|
326
|
+
*/
|
|
327
|
+
customiseCell($event) {
|
|
328
|
+
this.queryCellInfo.emit($event);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* @param {?=} args
|
|
332
|
+
* @return {?}
|
|
333
|
+
*/
|
|
334
|
+
contextMenuOpen(args) {
|
|
335
|
+
/** @type {?} */
|
|
336
|
+
const data = ((/** @type {?} */ (args))).rowInfo.rowData;
|
|
337
|
+
if (!data) {
|
|
338
|
+
args.cancel = true;
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
/** @type {?} */
|
|
342
|
+
let enableItems = [];
|
|
343
|
+
/** @type {?} */
|
|
344
|
+
let hideItems = [];
|
|
345
|
+
this.grid.contextMenuModule.contextMenu.refresh(); // 每次点击按钮弹窗前需再次初始化状态 否则不更新;
|
|
346
|
+
this.contextMenuItems.forEach((/**
|
|
347
|
+
* @param {?} item
|
|
348
|
+
* @return {?}
|
|
349
|
+
*/
|
|
350
|
+
(item) => {
|
|
351
|
+
// 用于处理部分按钮disabled的情况
|
|
352
|
+
if (item.disabled ||
|
|
353
|
+
(data.disableItem && data.disableItem.includes(item.iconCss))) {
|
|
354
|
+
enableItems.push(item.text);
|
|
355
|
+
// this.grid.contextMenuModule.contextMenu.enableItems(
|
|
356
|
+
// [item.text],
|
|
357
|
+
// false
|
|
358
|
+
// );
|
|
359
|
+
}
|
|
360
|
+
// 用于处理部分按钮需要hide的情况
|
|
361
|
+
if (item.isHide ||
|
|
362
|
+
(data.hideItem && data.hideItem.includes(item.iconCss))) {
|
|
363
|
+
hideItems.push(item.text);
|
|
364
|
+
// this.grid.contextMenuModule.contextMenu.hideItems(
|
|
365
|
+
// [item.text],
|
|
366
|
+
// false
|
|
367
|
+
// );
|
|
368
|
+
}
|
|
369
|
+
}));
|
|
370
|
+
this.grid.contextMenuModule.contextMenu.enableItems(enableItems, false);
|
|
371
|
+
this.grid.contextMenuModule.contextMenu.hideItems(hideItems, false);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* @param {?} $event
|
|
375
|
+
* @return {?}
|
|
376
|
+
*/
|
|
377
|
+
_actionHandler($event) {
|
|
378
|
+
if (this.selectedDiffKey &&
|
|
379
|
+
($event.requestType === 'paging' ||
|
|
380
|
+
$event.requestType === 'searching' ||
|
|
381
|
+
$event.requestType === 'filtering' ||
|
|
382
|
+
$event.requestType === 'sorting')) {
|
|
383
|
+
this.indexList = [];
|
|
384
|
+
setTimeout((/**
|
|
385
|
+
* @return {?}
|
|
386
|
+
*/
|
|
387
|
+
() => {
|
|
388
|
+
this.chooseRecords();
|
|
389
|
+
this.startPaging = false;
|
|
390
|
+
this.ref && this.ref.detectChanges();
|
|
391
|
+
this.ref && this.ref.markForCheck();
|
|
392
|
+
}));
|
|
393
|
+
}
|
|
394
|
+
this.actionHandler.emit($event);
|
|
395
|
+
this.actionComplete.emit($event);
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* @private
|
|
399
|
+
* @return {?}
|
|
400
|
+
*/
|
|
401
|
+
chooseRecords() {
|
|
402
|
+
this.indexList = [];
|
|
403
|
+
this.dataSource.forEach((/**
|
|
404
|
+
* @param {?} data
|
|
405
|
+
* @return {?}
|
|
406
|
+
*/
|
|
407
|
+
(data) => {
|
|
408
|
+
this.grid.getCurrentViewRecords().forEach((/**
|
|
409
|
+
* @param {?} row
|
|
410
|
+
* @param {?} i
|
|
411
|
+
* @return {?}
|
|
412
|
+
*/
|
|
413
|
+
(row, i) => {
|
|
414
|
+
if (row &&
|
|
415
|
+
data[this.selectedDiffKey] === row[this.selectedDiffKey] &&
|
|
416
|
+
data.isSelected) {
|
|
417
|
+
this.indexList.push(i);
|
|
418
|
+
}
|
|
419
|
+
}));
|
|
420
|
+
}));
|
|
421
|
+
this.grid.selectRows(this.indexList);
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* @param {?} $event
|
|
425
|
+
* @return {?}
|
|
426
|
+
*/
|
|
427
|
+
_recordClick($event) {
|
|
428
|
+
this.recordClick.emit($event);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* @return {?}
|
|
432
|
+
*/
|
|
433
|
+
refresh() {
|
|
434
|
+
this.grid.refresh();
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* @param {?} e
|
|
438
|
+
* @return {?}
|
|
439
|
+
*/
|
|
440
|
+
_rowSelecting(e) {
|
|
441
|
+
this.rowSelecting.emit(e);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* @return {?}
|
|
445
|
+
*/
|
|
446
|
+
refreshColumns() {
|
|
447
|
+
this.grid.refreshColumns();
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* @return {?}
|
|
451
|
+
*/
|
|
452
|
+
refreshHeader() {
|
|
453
|
+
this.grid.refreshHeader();
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* @param {?=} excelExportProperties
|
|
457
|
+
* @return {?}
|
|
458
|
+
*/
|
|
459
|
+
export(excelExportProperties) {
|
|
460
|
+
this.grid.excelExport(excelExportProperties);
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* @return {?}
|
|
464
|
+
*/
|
|
465
|
+
getSelectedRecords() {
|
|
466
|
+
return this.grid.getSelectedRecords();
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* @param {?} $event
|
|
470
|
+
* @return {?}
|
|
471
|
+
*/
|
|
472
|
+
_rowDataBound($event) {
|
|
473
|
+
if (this.disableSystemRow && $event.data && $event.data.IsSystem) {
|
|
474
|
+
$event.row.classList.add('e-disabled');
|
|
475
|
+
}
|
|
476
|
+
this.rowDataBound.emit($event);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* @return {?}
|
|
480
|
+
*/
|
|
481
|
+
clearSelection() {
|
|
482
|
+
this.grid.clearSelection();
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* @return {?}
|
|
486
|
+
*/
|
|
487
|
+
excelExport() {
|
|
488
|
+
this.grid.excelExport();
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* @return {?}
|
|
492
|
+
*/
|
|
493
|
+
addItem() {
|
|
494
|
+
this.grid.addRecord(Object.assign({}, this.defaultRecord, { isNew: true }), 0);
|
|
495
|
+
setTimeout((/**
|
|
496
|
+
* @return {?}
|
|
497
|
+
*/
|
|
498
|
+
() => {
|
|
499
|
+
this.grid.selectRow(0);
|
|
500
|
+
this.grid.startEdit();
|
|
501
|
+
}), 30);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* @return {?}
|
|
505
|
+
*/
|
|
506
|
+
saveItem() {
|
|
507
|
+
this.grid.endEdit();
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* @param {?} index
|
|
511
|
+
* @return {?}
|
|
512
|
+
*/
|
|
513
|
+
editItem(index) {
|
|
514
|
+
setTimeout((/**
|
|
515
|
+
* @return {?}
|
|
516
|
+
*/
|
|
517
|
+
() => {
|
|
518
|
+
this.grid.selectRow(Number(index));
|
|
519
|
+
this.grid.startEdit();
|
|
520
|
+
}), 30);
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* @param {?} index
|
|
524
|
+
* @return {?}
|
|
525
|
+
*/
|
|
526
|
+
deleteItem(index) {
|
|
527
|
+
this.grid.selectRow(Number(index));
|
|
528
|
+
/** @type {?} */
|
|
529
|
+
var selectedRecord = (/** @type {?} */ (this.grid.getSelectedRecords()[0]));
|
|
530
|
+
this.grid.deleteRecord((/** @type {?} */ (selectedRecord)));
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* @param {?} index
|
|
534
|
+
* @return {?}
|
|
535
|
+
*/
|
|
536
|
+
cancelItem(index) {
|
|
537
|
+
this.grid.closeEdit();
|
|
538
|
+
this.deleteItem(index);
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* @return {?}
|
|
542
|
+
*/
|
|
543
|
+
showLoading() {
|
|
544
|
+
this.className = 'grid-loading';
|
|
545
|
+
this.ref && this.ref.markForCheck();
|
|
546
|
+
this.ref && this.ref.detectChanges();
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* @return {?}
|
|
550
|
+
*/
|
|
551
|
+
hideLoading() {
|
|
552
|
+
this.className = '';
|
|
553
|
+
this.ref && this.ref.markForCheck();
|
|
554
|
+
this.ref && this.ref.detectChanges();
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
CommonGridComponent.decorators = [
|
|
558
|
+
{ type: Component, args: [{
|
|
559
|
+
selector: 'kt-common-grid',
|
|
560
|
+
template: "<ejs-grid\r\n\t#grid\r\n\t[id]=\"gridId\"\r\n\t[ngClass]=\"{\r\n\t\t'hide-Check-box': !alwaysShowCheckbox,\r\n\t\t'grid-loading': className === 'grid-loading'\r\n\t}\"\r\n\t[dataSource]=\"dataSource\"\r\n\t[allowPaging]=\"allowPaging && pageSettings\"\r\n\t[allowResizing]=\"true\"\r\n\t[pageSettings]=\"pageSettings\"\r\n\t[showColumnMenu]=\"true\"\r\n\t[allowSorting]=\"true\"\r\n\t[allowFiltering]=\"true\"\r\n\t[allowExcelExport]=\"true\"\r\n\t[filterSettings]=\"filterSettings\"\r\n\t[resizeSettings]=\"resizeSettings\"\r\n\t[allowSelection]=\"true\"\r\n\t[editSettings]=\"editSettings\"\r\n\t[childGrid]=\"childGrid\"\r\n\t[contextMenuItems]=\"\r\n\t\tdataSource && dataSource.length ? contextMenuItems : null\r\n\t\"\r\n\t[selectionSettings]=\"selectionSettings\"\r\n\t(recordClick)=\"_recordClick($event)\"\r\n\t(recordDoubleClick)=\"_recordDoubleClick($event)\"\r\n\t(actionBegin)=\"_actionBegin($event)\"\r\n\t(actionComplete)=\"_actionHandler($event)\"\r\n\t(rowSelected)=\"_rowSelected($event)\"\r\n\t(rowDeselected)=\"_rowDeselected($event)\"\r\n\tstyle=\"border: none\"\r\n\t(contextMenuClick)=\"_onContextMenu($event)\"\r\n\t(contextMenuOpen)=\"contextMenuOpen($event)\"\r\n\t(queryCellInfo)=\"customiseCell($event)\"\r\n\t(dataBound)=\"_dataBound($event)\"\r\n\t(rowDataBound)=\"_rowDataBound($event)\"\r\n\t(rowSelecting)=\"_rowSelecting($event)\"\r\n\t(excelQueryCellInfo)=\"_exportQueryCellInfo($event)\"\r\n\t(load)=\"_load()\"\r\n>\r\n\t<e-columns>\r\n\t\t<e-column\r\n\t\t\t*ngIf=\"showCheckBox\"\r\n\t\t\ttype=\"checkbox\"\r\n\t\t\t[width]=\"checkBoxWidth\"\r\n\t\t\t[showColumnMenu]=\"false\"\r\n\t\t></e-column>\r\n\t\t<e-column\r\n\t\t\t*ngFor=\"let item of fields; trackBy: trackByFn\"\r\n\t\t\t[field]=\"item.columnName\"\r\n\t\t\t[filter]=\"item.filter ? item.filter : { type: 'CheckBox' }\"\r\n\t\t\t[customAttributes]=\"\r\n\t\t\t\titem.colName === 'entityUserList' ||\r\n\t\t\t\titem.colName === 'kycProgress'\r\n\t\t\t\t\t? { class: 'hideColumnFilterClass' }\r\n\t\t\t\t\t: {}\r\n\t\t\t\"\r\n\t\t\t[headerText]=\"item.columnDisplayName\"\r\n\t\t\t[textAlign]=\"item.textAlign\"\r\n\t\t\t[showColumnMenu]=\"item.showColumnMenu === undefined ? true : false\"\r\n\t\t\t[allowFiltering]=\"item.allowFiltering === undefined ? true : false\"\r\n\t\t\t[allowSorting]=\"item.allowSorting === undefined ? true : false\"\r\n\t\t\t[editType]=\"item.editType\"\r\n\t\t\t[validationRules]=\"item.validationRules\"\r\n\t\t\t[type]=\"item.dataType\"\r\n\t\t\t[width]=\"item.width\"\r\n\t\t\t[minWidth]=\"item.minWidth\"\r\n\t\t\t[format]=\"item.format\"\r\n\t\t\t[visible]=\"item.visible\"\r\n\t\t\t[template]=\"item.showTemplate ? columnTemplate : undefined\"\r\n\t\t\t[clipMode]=\"\r\n\t\t\t\titem.clipMode\r\n\t\t\t\t\t? item.clipMode\r\n\t\t\t\t\t: clipMode || 'EllipsisWithTooltip'\r\n\t\t\t\"\r\n\t\t\t[sortComparer]=\"item.dateComparer\"\r\n\t\t>\r\n\t\t</e-column>\r\n\t</e-columns>\r\n</ejs-grid>\r\n",
|
|
561
|
+
styles: [".e-grid.e-gridhover tr[role=row]:hover .e-rowcell:not(.e-cellselectionbackground):not(.e-active):not(.e-updatedtd):not(.e-indentcell){background:rgba(31,123,255,.04)!important}.e-summaryrow .e-summarycell:nth-child(2){padding-left:0!important}.e-footerpadding{padding-right:0!important}.e-footerpadding .e-summaryrow{margin-right:5px!important}.e-footerpadding .e-summaryrow .e-indentcell{background-color:unset!important}kt-common-grid{display:flex;flex:1;height:100%}kt-common-grid .e-grid{height:100%}kt-common-grid .e-grid .e-headercontent{margin-right:0!important}.e-grid td.e-active{background:#edf5ff!important}.grid-tools{height:32px;min-height:32px;display:flex;align-items:center;justify-content:space-between;padding-left:7px}.grid-tools .right-opt-group{display:flex;align-items:center;margin-right:6px}.grid-tools .tools-button{border:none;font-family:Arial;font-size:12px;color:#43566c;background:0 0;display:flex;align-items:center;padding:0;margin-right:16px}.grid-tools .tools-button.disabled-button{pointer-events:none;opacity:.5}.grid-tools .tools-button img{margin-right:4px;height:16px!important;width:16px!important}.grid-tools .tools-button .tools-font{transform:translateY(1px);display:inline-block}.grid-tools .select-num{font-size:12px;color:#43566c;margin-right:24px;white-space:nowrap}.e-rowcell{padding:0 8px 0 12px}.e-rowcell.e-gridchkbox{padding:0 0 0 8px!important}.e-headercell{padding:0}.e-headercell:first-child.e-defaultcursor+.e-headercell .e-headercelldiv{padding-left:0}.e-headercell .e-headercelldiv{margin:0;padding:0 20px 0 12px}.e-headercell .e-headerchkcelldiv{padding:0 0 0 8px!important}.e-headercell .e-columnmenu{position:absolute;right:0;float:unset;margin:0;padding:0;top:8px}.e-headercell .e-sortfilterdiv{padding-top:11px}.e-headercell.e-rightalign .e-sortfilterdiv{padding-left:5px}.e-detailheadercell{height:28px!important}.e-grid{font-family:Arial!important;display:flex;flex-direction:column;flex:1;border:none;overflow:hidden}.e-grid .e-gridcontent{flex:1}.e-grid .e-content{overflow:scroll!important}.e-grid .e-content::-webkit-scrollbar{width:5px;height:5px;background:#fff;position:static;z-index:999;border-radius:10px}.e-grid .e-content::-webkit-scrollbar-thumb{background:#eaedf0;border-radius:10px}.e-grid .e-gridheader{margin-right:5px!important;padding-right:0!important;height:30px!important}.e-grid .e-content,.e-grid .e-gridcontent{display:flex;flex-direction:column;flex:1}.e-grid .e-columnheader,.e-grid .e-headercell,.e-grid .e-rhandler{height:28px!important}.e-grid .e-headertext{font-size:10px!important}.e-grid .e-headercell .e-columnmenu{color:#929dab}.e-grid .e-row{height:26px!important;line-height:26px!important}.e-grid .e-rowcell{font-size:11px!important;color:#43566c!important;padding-top:0;padding-bottom:0;padding-right:7px}.e-grid .e-rowcell .mat-icon-button{height:26px;width:26px;line-height:26px}.e-grid .e-rowcell:empty{height:26px!important}.e-grid .e-rowcell.e-gridchkbox+.e-rowcell{padding-left:0!important}.e-grid .e-gridpager{border:none}.e-grid .e-gridpager .e-gridcontent{transform:unset}.e-grid .e-summaryrow{height:24px!important}.e-grid .e-summaryrow .e-indentcell,.e-grid .e-summaryrow .e-summarycell{background-color:#fff;border:none;font-family:Arial;font-size:11px!important;font-weight:700;color:#43566c;padding:0 12px}.e-grid .e-row:last-child .e-rowcell{border-bottom:1px solid #dee2e6}"]
|
|
562
|
+
}] }
|
|
563
|
+
];
|
|
564
|
+
/** @nocollapse */
|
|
565
|
+
CommonGridComponent.ctorParameters = () => [
|
|
566
|
+
{ type: ChangeDetectorRef }
|
|
567
|
+
];
|
|
568
|
+
CommonGridComponent.propDecorators = {
|
|
569
|
+
grid: [{ type: ViewChild, args: ['grid', { static: false },] }],
|
|
570
|
+
showCheckBox: [{ type: Input }],
|
|
571
|
+
loaded: [{ type: Input }],
|
|
572
|
+
hiddenLoaded: [{ type: Input }],
|
|
573
|
+
authorized: [{ type: Input }],
|
|
574
|
+
selectedDiffKey: [{ type: Input }],
|
|
575
|
+
gridHeight: [{ type: Input }],
|
|
576
|
+
gridId: [{ type: Input }],
|
|
577
|
+
resizeSettings: [{ type: Input }],
|
|
578
|
+
filterSettings: [{ type: Input }],
|
|
579
|
+
template: [{ type: Input }],
|
|
580
|
+
fields: [{ type: Input }],
|
|
581
|
+
dataSource: [{ type: Input }],
|
|
582
|
+
editSettings: [{ type: Input }],
|
|
583
|
+
columnTemplate: [{ type: Input }],
|
|
584
|
+
pageSettings: [{ type: Input }],
|
|
585
|
+
allowPaging: [{ type: Input }],
|
|
586
|
+
clipMode: [{ type: Input }],
|
|
587
|
+
checkBoxWidth: [{ type: Input }],
|
|
588
|
+
childGrid: [{ type: Input }],
|
|
589
|
+
contextMenuItems: [{ type: Input }],
|
|
590
|
+
selectionSettings: [{ type: Input }],
|
|
591
|
+
alwaysShowCheckbox: [{ type: Input }],
|
|
592
|
+
defaultRecord: [{ type: Input }],
|
|
593
|
+
disableSystemRow: [{ type: Input }],
|
|
594
|
+
recordDoubleClick: [{ type: Output }],
|
|
595
|
+
actionComplete: [{ type: Output }],
|
|
596
|
+
rowSelected: [{ type: Output }],
|
|
597
|
+
rowDeselected: [{ type: Output }],
|
|
598
|
+
onContextMenu: [{ type: Output }],
|
|
599
|
+
actionHandler: [{ type: Output }],
|
|
600
|
+
queryCellInfo: [{ type: Output }],
|
|
601
|
+
recordClick: [{ type: Output }],
|
|
602
|
+
actionBegin: [{ type: Output }],
|
|
603
|
+
rowDataBound: [{ type: Output }],
|
|
604
|
+
dataBound: [{ type: Output }],
|
|
605
|
+
exportQueryCellInfo: [{ type: Output }],
|
|
606
|
+
rowSelecting: [{ type: Output }]
|
|
607
|
+
};
|
|
608
|
+
if (false) {
|
|
609
|
+
/** @type {?} */
|
|
610
|
+
CommonGridComponent.prototype.grid;
|
|
611
|
+
/** @type {?} */
|
|
612
|
+
CommonGridComponent.prototype.showCheckBox;
|
|
613
|
+
/** @type {?} */
|
|
614
|
+
CommonGridComponent.prototype.loaded;
|
|
615
|
+
/** @type {?} */
|
|
616
|
+
CommonGridComponent.prototype.hiddenLoaded;
|
|
617
|
+
/** @type {?} */
|
|
618
|
+
CommonGridComponent.prototype.authorized;
|
|
619
|
+
/** @type {?} */
|
|
620
|
+
CommonGridComponent.prototype.selectedDiffKey;
|
|
621
|
+
/** @type {?} */
|
|
622
|
+
CommonGridComponent.prototype.gridHeight;
|
|
623
|
+
/** @type {?} */
|
|
624
|
+
CommonGridComponent.prototype.gridId;
|
|
625
|
+
/** @type {?} */
|
|
626
|
+
CommonGridComponent.prototype.resizeSettings;
|
|
627
|
+
/** @type {?} */
|
|
628
|
+
CommonGridComponent.prototype.filterSettings;
|
|
629
|
+
/** @type {?} */
|
|
630
|
+
CommonGridComponent.prototype.template;
|
|
631
|
+
/** @type {?} */
|
|
632
|
+
CommonGridComponent.prototype.fields;
|
|
633
|
+
/** @type {?} */
|
|
634
|
+
CommonGridComponent.prototype.dataSource;
|
|
635
|
+
/** @type {?} */
|
|
636
|
+
CommonGridComponent.prototype.editSettings;
|
|
637
|
+
/** @type {?} */
|
|
638
|
+
CommonGridComponent.prototype.columnTemplate;
|
|
639
|
+
/** @type {?} */
|
|
640
|
+
CommonGridComponent.prototype.pageSettings;
|
|
641
|
+
/** @type {?} */
|
|
642
|
+
CommonGridComponent.prototype.allowPaging;
|
|
643
|
+
/** @type {?} */
|
|
644
|
+
CommonGridComponent.prototype.clipMode;
|
|
645
|
+
/** @type {?} */
|
|
646
|
+
CommonGridComponent.prototype.checkBoxWidth;
|
|
647
|
+
/** @type {?} */
|
|
648
|
+
CommonGridComponent.prototype.childGrid;
|
|
649
|
+
/**
|
|
650
|
+
* Sample: [
|
|
651
|
+
* {
|
|
652
|
+
* text: "Preview",
|
|
653
|
+
* target: ".e-content",
|
|
654
|
+
* id: "preview-icon",
|
|
655
|
+
* iconCss: "preview",
|
|
656
|
+
* },
|
|
657
|
+
* {
|
|
658
|
+
* text: "Download",
|
|
659
|
+
* target: ".e-content",
|
|
660
|
+
* id: "download-icon",
|
|
661
|
+
* iconCss: "download",
|
|
662
|
+
* }
|
|
663
|
+
* ]
|
|
664
|
+
* 用于定义row中 点击事件
|
|
665
|
+
* @type {?}
|
|
666
|
+
*/
|
|
667
|
+
CommonGridComponent.prototype.contextMenuItems;
|
|
668
|
+
/** @type {?} */
|
|
669
|
+
CommonGridComponent.prototype.selectionSettings;
|
|
670
|
+
/** @type {?} */
|
|
671
|
+
CommonGridComponent.prototype.alwaysShowCheckbox;
|
|
672
|
+
/** @type {?} */
|
|
673
|
+
CommonGridComponent.prototype.defaultRecord;
|
|
674
|
+
/** @type {?} */
|
|
675
|
+
CommonGridComponent.prototype.disableSystemRow;
|
|
676
|
+
/** @type {?} */
|
|
677
|
+
CommonGridComponent.prototype.recordDoubleClick;
|
|
678
|
+
/** @type {?} */
|
|
679
|
+
CommonGridComponent.prototype.actionComplete;
|
|
680
|
+
/** @type {?} */
|
|
681
|
+
CommonGridComponent.prototype.rowSelected;
|
|
682
|
+
/** @type {?} */
|
|
683
|
+
CommonGridComponent.prototype.rowDeselected;
|
|
684
|
+
/** @type {?} */
|
|
685
|
+
CommonGridComponent.prototype.onContextMenu;
|
|
686
|
+
/** @type {?} */
|
|
687
|
+
CommonGridComponent.prototype.actionHandler;
|
|
688
|
+
/** @type {?} */
|
|
689
|
+
CommonGridComponent.prototype.queryCellInfo;
|
|
690
|
+
/** @type {?} */
|
|
691
|
+
CommonGridComponent.prototype.recordClick;
|
|
692
|
+
/** @type {?} */
|
|
693
|
+
CommonGridComponent.prototype.actionBegin;
|
|
694
|
+
/** @type {?} */
|
|
695
|
+
CommonGridComponent.prototype.rowDataBound;
|
|
696
|
+
/** @type {?} */
|
|
697
|
+
CommonGridComponent.prototype.dataBound;
|
|
698
|
+
/** @type {?} */
|
|
699
|
+
CommonGridComponent.prototype.exportQueryCellInfo;
|
|
700
|
+
/** @type {?} */
|
|
701
|
+
CommonGridComponent.prototype.rowSelecting;
|
|
702
|
+
/** @type {?} */
|
|
703
|
+
CommonGridComponent.prototype.selectId;
|
|
704
|
+
/** @type {?} */
|
|
705
|
+
CommonGridComponent.prototype.startPaging;
|
|
706
|
+
/** @type {?} */
|
|
707
|
+
CommonGridComponent.prototype.indexList;
|
|
708
|
+
/** @type {?} */
|
|
709
|
+
CommonGridComponent.prototype.className;
|
|
710
|
+
/** @type {?} */
|
|
711
|
+
CommonGridComponent.prototype.translation;
|
|
712
|
+
/**
|
|
713
|
+
* @type {?}
|
|
714
|
+
* @private
|
|
715
|
+
*/
|
|
716
|
+
CommonGridComponent.prototype.ref;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* @fileoverview added by tsickle
|
|
721
|
+
* Generated from: lib/raise-common-lib.module.ts
|
|
722
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
723
|
+
*/
|
|
724
|
+
class RaiseCommonLibModule {
|
|
725
|
+
}
|
|
726
|
+
RaiseCommonLibModule.decorators = [
|
|
727
|
+
{ type: NgModule, args: [{
|
|
728
|
+
declarations: [
|
|
729
|
+
CommonGridComponent,
|
|
730
|
+
],
|
|
731
|
+
imports: [CommonModule, GridModule, PagerModule, GridAllModule],
|
|
732
|
+
providers: [
|
|
733
|
+
PageService,
|
|
734
|
+
SortService,
|
|
735
|
+
FilterService,
|
|
736
|
+
ExcelExportService,
|
|
737
|
+
EditService,
|
|
738
|
+
ResizeService,
|
|
739
|
+
ToolbarService,
|
|
740
|
+
ColumnChooserService,
|
|
741
|
+
AggregateService,
|
|
742
|
+
ColumnMenuService,
|
|
743
|
+
DetailRowService,
|
|
744
|
+
SelectionService,
|
|
745
|
+
GroupService,
|
|
746
|
+
],
|
|
747
|
+
exports: [
|
|
748
|
+
CommonGridComponent,
|
|
749
|
+
]
|
|
750
|
+
},] }
|
|
751
|
+
];
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* @fileoverview added by tsickle
|
|
755
|
+
* Generated from: public-api.ts
|
|
756
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
757
|
+
*/
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* @fileoverview added by tsickle
|
|
761
|
+
* Generated from: raise-common-lib.ts
|
|
762
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
763
|
+
*/
|
|
764
|
+
|
|
765
|
+
export { CommonGridComponent, RaiseCommonLibModule };
|
|
766
|
+
//# sourceMappingURL=raise-common-lib.js.map
|