raise-common-lib 0.0.248 → 0.0.249
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/README.md +57 -57
- package/bundles/raise-common-lib.umd.js +1937 -12
- package/bundles/raise-common-lib.umd.js.map +1 -1
- package/bundles/raise-common-lib.umd.min.js +1 -1
- package/bundles/raise-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/common-grid/index.component.js +210 -8
- package/esm2015/lib/date-tree-filter/date-tree-filter-popover/index.component.js +761 -0
- package/esm2015/lib/date-tree-filter/date-tree-filter.helper.js +679 -0
- package/esm2015/lib/raise-common-lib.module.js +4 -1
- package/esm2015/public-api.js +3 -1
- package/esm2015/raise-common-lib.js +2 -2
- package/esm5/lib/common-grid/index.component.js +244 -8
- package/esm5/lib/date-tree-filter/date-tree-filter-popover/index.component.js +902 -0
- package/esm5/lib/date-tree-filter/date-tree-filter.helper.js +787 -0
- package/esm5/lib/raise-common-lib.module.js +4 -1
- package/esm5/public-api.js +3 -1
- package/esm5/raise-common-lib.js +2 -2
- package/fesm2015/raise-common-lib.js +1649 -9
- package/fesm2015/raise-common-lib.js.map +1 -1
- package/fesm5/raise-common-lib.js +1931 -10
- package/fesm5/raise-common-lib.js.map +1 -1
- package/lib/common-grid/index.component.d.ts +30 -1
- package/lib/date-tree-filter/date-tree-filter-popover/index.component.d.ts +46 -0
- package/lib/date-tree-filter/date-tree-filter.helper.d.ts +54 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/raise-common-lib.metadata.json +1 -1
- package/src/assets/img/arrow_right.svg +4 -4
- package/src/assets/img/calendar-disabled.svg +6 -6
- package/src/assets/img/calendar.svg +6 -6
- package/src/assets/img/calendar_arrow_left.svg +3 -3
- package/src/assets/img/calendar_arrow_right.svg +3 -3
- package/src/assets/img/checked-vector.svg +3 -3
- package/src/assets/img/dialog-close.svg +4 -4
- package/src/assets/img/dialog-grow.svg +6 -6
- package/src/assets/img/dialog-shrink.svg +6 -6
- package/src/assets/img/plus.svg +4 -4
- package/src/assets/img/raise_logo_main_new.svg +27 -27
- package/src/assets/img/search.svg +4 -4
- package/src/assets/img/shrink-icon.svg +6 -6
- package/src/assets/img/time-disabled.svg +4 -4
- package/src/assets/img/time.svg +4 -4
- package/src/assets/img/toolbar-action-addFolder.svg +17 -17
- package/src/assets/img/toolbar-action-calculator.svg +11 -11
- package/src/assets/img/toolbar-action-collapse.svg +7 -7
- package/src/assets/img/toolbar-action-combine.svg +4 -4
- package/src/assets/img/toolbar-action-edit.svg +4 -4
- package/src/assets/img/toolbar-action-expand.svg +7 -7
- package/src/assets/img/toolbar-action-folderMove.svg +8 -8
- package/src/assets/img/toolbar-action-lock.svg +6 -6
- package/src/assets/img/toolbar-action-preview.svg +7 -7
- package/src/assets/img/toolbar-action-publish.svg +5 -5
- package/src/assets/img/toolbar-action-reminders.svg +10 -10
- package/src/assets/img/toolbar-action-rename.svg +7 -7
- package/src/assets/img/toolbar-action-saveSequence.svg +5 -5
- package/src/assets/img/toolbar-action-send-file.svg +5 -5
- package/src/assets/img/toolbar-action-settle.svg +7 -7
- package/src/assets/img/toolbar-action-share.svg +5 -5
- package/src/assets/img/toolbar-action-submitForApproval.svg +4 -4
- package/src/assets/img/toolbar-action-sync.svg +4 -4
- package/src/assets/img/toolbar-action-template.svg +6 -6
- package/src/assets/img/toolbar-action-workflow.svg +9 -9
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { EventEmitter, Component, ChangeDetectorRef, ViewChild, Input, Output, HostBinding, Injectable, ɵɵdefineInjectable, Inject, ɵɵinject, ContentChild,
|
|
1
|
+
import { EventEmitter, Component, ChangeDetectorRef, ViewChild, Input, Output, ElementRef, HostListener, HostBinding, Injectable, ɵɵdefineInjectable, Inject, ɵɵinject, ContentChild, ComponentFactoryResolver, ViewContainerRef, ViewChildren, InjectionToken, Optional, ChangeDetectionStrategy, ViewEncapsulation, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
2
2
|
import { GridComponent, ExcelExportService, ColumnChooserService, VirtualScrollService, FilterService, ResizeService, GridModule, PagerModule, GridAllModule, PageService, RowDDService, SortService, EditService, ToolbarService as ToolbarService$1, AggregateService, ColumnMenuService, DetailRowService, SelectionService, GroupService } from '@syncfusion/ej2-angular-grids';
|
|
3
3
|
import { times, debounce as debounce$1, forEach, throttle, find, cloneDeep, startsWith, filter as filter$1, meanBy, sumBy, minBy, maxBy, sortBy, uniqBy, differenceWith, mean } from 'lodash';
|
|
4
|
+
import moment from 'moment';
|
|
4
5
|
import { __awaiter, __decorate, __metadata } from 'tslib';
|
|
5
6
|
import { Subject, BehaviorSubject, Observable } from 'rxjs';
|
|
6
7
|
import { MAT_SNACK_BAR_DATA, MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
|
@@ -14,7 +15,6 @@ import { HttpClient, HttpHeaders, HttpClientModule } from '@angular/common/http'
|
|
|
14
15
|
import { setCulture, L10n, addClass, enableRipple, Browser, createElement } from '@syncfusion/ej2-base';
|
|
15
16
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
16
17
|
import { Query, DataUtil } from '@syncfusion/ej2-data';
|
|
17
|
-
import moment from 'moment';
|
|
18
18
|
import CircularJSON from 'circular-json';
|
|
19
19
|
import { MAT_DATE_FORMATS } from '@angular/material/core';
|
|
20
20
|
import { DashboardLayoutModule } from '@syncfusion/ej2-angular-layouts';
|
|
@@ -77,6 +77,684 @@ function getTranslation() {
|
|
|
77
77
|
return {};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* @fileoverview added by tsickle
|
|
82
|
+
* Generated from: lib/date-tree-filter/date-tree-filter.helper.ts
|
|
83
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
84
|
+
*/
|
|
85
|
+
/**
|
|
86
|
+
* @record
|
|
87
|
+
*/
|
|
88
|
+
function DateTreeFilterSetupOptions() { }
|
|
89
|
+
if (false) {
|
|
90
|
+
/** @type {?} */
|
|
91
|
+
DateTreeFilterSetupOptions.prototype.rows;
|
|
92
|
+
/** @type {?} */
|
|
93
|
+
DateTreeFilterSetupOptions.prototype.fields;
|
|
94
|
+
/** @type {?} */
|
|
95
|
+
DateTreeFilterSetupOptions.prototype.hints;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @record
|
|
99
|
+
*/
|
|
100
|
+
function DateTreeFilterHelperOptions() { }
|
|
101
|
+
if (false) {
|
|
102
|
+
/** @type {?} */
|
|
103
|
+
DateTreeFilterHelperOptions.prototype.getTranslation;
|
|
104
|
+
/** @type {?} */
|
|
105
|
+
DateTreeFilterHelperOptions.prototype.getPopoverElement;
|
|
106
|
+
/** @type {?} */
|
|
107
|
+
DateTreeFilterHelperOptions.prototype.getGridElement;
|
|
108
|
+
/** @type {?} */
|
|
109
|
+
DateTreeFilterHelperOptions.prototype.applyRows;
|
|
110
|
+
/** @type {?|undefined} */
|
|
111
|
+
DateTreeFilterHelperOptions.prototype.parseDateValue;
|
|
112
|
+
/** @type {?|undefined} */
|
|
113
|
+
DateTreeFilterHelperOptions.prototype.dateFormats;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @record
|
|
117
|
+
*/
|
|
118
|
+
function RsCommonGridDateTreeFactoryHost() { }
|
|
119
|
+
if (false) {
|
|
120
|
+
/** @type {?} */
|
|
121
|
+
RsCommonGridDateTreeFactoryHost.prototype.translation;
|
|
122
|
+
/** @type {?} */
|
|
123
|
+
RsCommonGridDateTreeFactoryHost.prototype.dateTreePopoverRef;
|
|
124
|
+
/** @type {?} */
|
|
125
|
+
RsCommonGridDateTreeFactoryHost.prototype.grid;
|
|
126
|
+
}
|
|
127
|
+
/** @type {?} */
|
|
128
|
+
const DATE_TREE_DEFAULT_DATE_FORMATS = [
|
|
129
|
+
"YYYY-MM-DD",
|
|
130
|
+
"MM/DD/YYYY",
|
|
131
|
+
"DD/MM/YYYY",
|
|
132
|
+
"YYYY/MM/DD",
|
|
133
|
+
"DD-MMM-YYYY",
|
|
134
|
+
"MMM DD, YYYY",
|
|
135
|
+
];
|
|
136
|
+
class DateTreeFilterHelper {
|
|
137
|
+
/**
|
|
138
|
+
* @param {?} options
|
|
139
|
+
*/
|
|
140
|
+
constructor(options) {
|
|
141
|
+
this.popoverVisible = false;
|
|
142
|
+
this.popoverField = "";
|
|
143
|
+
this.popoverStyle = {};
|
|
144
|
+
this.selectedByField = {};
|
|
145
|
+
this.fieldLabelMap = {};
|
|
146
|
+
this.dateFields = [];
|
|
147
|
+
this.sourceRows = [];
|
|
148
|
+
this.defaultDateFormats = [
|
|
149
|
+
"YYYY-MM-DD",
|
|
150
|
+
"MM/DD/YYYY",
|
|
151
|
+
"DD/MM/YYYY",
|
|
152
|
+
"YYYY/MM/DD",
|
|
153
|
+
"DD-MMM-YYYY",
|
|
154
|
+
"DD-MMM-YYYY hh:mm A",
|
|
155
|
+
"MMM DD, YYYY",
|
|
156
|
+
moment.ISO_8601,
|
|
157
|
+
];
|
|
158
|
+
this.options = options;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @param {?} config
|
|
162
|
+
* @return {?}
|
|
163
|
+
*/
|
|
164
|
+
setup(config) {
|
|
165
|
+
/** @type {?} */
|
|
166
|
+
var rows = config && config.rows ? config.rows : [];
|
|
167
|
+
/** @type {?} */
|
|
168
|
+
var fields = config && config.fields ? config.fields : [];
|
|
169
|
+
/** @type {?} */
|
|
170
|
+
var hints = config && config.hints ? config.hints : [];
|
|
171
|
+
this.sourceRows = rows;
|
|
172
|
+
this.dateFields = this.resolveDateTreeFieldsByHints(fields, hints);
|
|
173
|
+
this.fieldLabelMap = {};
|
|
174
|
+
(fields || []).forEach((/**
|
|
175
|
+
* @param {?} item
|
|
176
|
+
* @return {?}
|
|
177
|
+
*/
|
|
178
|
+
(item) => {
|
|
179
|
+
if (!item || !item.columnName) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
this.fieldLabelMap[item.columnName] =
|
|
183
|
+
item.columnDisplayName || item.columnName;
|
|
184
|
+
}));
|
|
185
|
+
this.apply();
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* @param {?} args
|
|
189
|
+
* @return {?}
|
|
190
|
+
*/
|
|
191
|
+
handleGridActionBegin(args) {
|
|
192
|
+
/** @type {?} */
|
|
193
|
+
var requestType = this.getRequestType(args);
|
|
194
|
+
if (requestType === "filterchoicerequest" ||
|
|
195
|
+
requestType === "filtersearchbegin") {
|
|
196
|
+
args.filterChoiceCount = 15000;
|
|
197
|
+
}
|
|
198
|
+
if (requestType !== "filterbeforeopen") {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
/** @type {?} */
|
|
202
|
+
var columnName = this.resolveActionColumnName(args);
|
|
203
|
+
if (!this.isDateTreeField(columnName)) {
|
|
204
|
+
this.close();
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
args.cancel = true;
|
|
208
|
+
this.open(columnName);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* @param {?} selectionMap
|
|
212
|
+
* @return {?}
|
|
213
|
+
*/
|
|
214
|
+
updateSelection(selectionMap) {
|
|
215
|
+
this.selectedByField = selectionMap || {};
|
|
216
|
+
this.apply();
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* @return {?}
|
|
220
|
+
*/
|
|
221
|
+
close() {
|
|
222
|
+
if (!this.popoverVisible) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
this.popoverVisible = false;
|
|
226
|
+
this.popoverField = "";
|
|
227
|
+
this.popoverStyle = {};
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* @param {?} event
|
|
231
|
+
* @return {?}
|
|
232
|
+
*/
|
|
233
|
+
handleDocumentMouseDown(event) {
|
|
234
|
+
if (!this.popoverVisible) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
/** @type {?} */
|
|
238
|
+
var target = (/** @type {?} */ (event.target));
|
|
239
|
+
if (!target) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (this.isInsidePopover(target) || this.isDateFilterMenuItem(target)) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
this.close();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* @param {?} event
|
|
249
|
+
* @return {?}
|
|
250
|
+
*/
|
|
251
|
+
handleDocumentMouseOver(event) {
|
|
252
|
+
if (!this.popoverVisible) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
/** @type {?} */
|
|
256
|
+
var target = (/** @type {?} */ (event.target));
|
|
257
|
+
if (!target) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (this.isInsidePopover(target)) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
/** @type {?} */
|
|
264
|
+
var menuItem = (/** @type {?} */ (target.closest(".e-menu-item")));
|
|
265
|
+
if (menuItem) {
|
|
266
|
+
if (!this.isDateFilterMenuItem(menuItem)) {
|
|
267
|
+
this.close();
|
|
268
|
+
}
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
/** @type {?} */
|
|
272
|
+
var otherFilterTarget = (/** @type {?} */ (target.closest(".e-filtermenudiv, .e-headercell .e-columnmenu, .e-columnmenu, .e-contextmenu")));
|
|
273
|
+
if (otherFilterTarget && !this.isDateFilterMenuItem(otherFilterTarget)) {
|
|
274
|
+
this.close();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* @return {?}
|
|
279
|
+
*/
|
|
280
|
+
updatePosition() {
|
|
281
|
+
if (!this.popoverVisible) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
/** @type {?} */
|
|
285
|
+
var anchor = this.findDateFilterAnchorElement();
|
|
286
|
+
if (anchor) {
|
|
287
|
+
/** @type {?} */
|
|
288
|
+
var rect = anchor.getBoundingClientRect();
|
|
289
|
+
/** @type {?} */
|
|
290
|
+
var viewportWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
291
|
+
/** @type {?} */
|
|
292
|
+
var viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
293
|
+
/** @type {?} */
|
|
294
|
+
var popoverElement = this.options.getPopoverElement
|
|
295
|
+
? this.options.getPopoverElement()
|
|
296
|
+
: null;
|
|
297
|
+
/** @type {?} */
|
|
298
|
+
var popoverWidth = popoverElement && popoverElement.offsetWidth
|
|
299
|
+
? popoverElement.offsetWidth
|
|
300
|
+
: 300;
|
|
301
|
+
/** @type {?} */
|
|
302
|
+
var popoverHeight = popoverElement && popoverElement.offsetHeight
|
|
303
|
+
? popoverElement.offsetHeight
|
|
304
|
+
: 420;
|
|
305
|
+
/** @type {?} */
|
|
306
|
+
var edgeGap = 8;
|
|
307
|
+
/** @type {?} */
|
|
308
|
+
var anchorGap = 8;
|
|
309
|
+
/** @type {?} */
|
|
310
|
+
var top = rect.top - 6;
|
|
311
|
+
/** @type {?} */
|
|
312
|
+
var left = rect.right + anchorGap;
|
|
313
|
+
if (left + popoverWidth > viewportWidth - edgeGap) {
|
|
314
|
+
left = rect.left - popoverWidth - anchorGap;
|
|
315
|
+
}
|
|
316
|
+
if (left < edgeGap) {
|
|
317
|
+
left = edgeGap;
|
|
318
|
+
}
|
|
319
|
+
if (left + popoverWidth > viewportWidth - edgeGap) {
|
|
320
|
+
left = Math.max(edgeGap, viewportWidth - popoverWidth - edgeGap);
|
|
321
|
+
}
|
|
322
|
+
if (top + popoverHeight > viewportHeight - edgeGap) {
|
|
323
|
+
top = Math.max(edgeGap, viewportHeight - popoverHeight - edgeGap);
|
|
324
|
+
}
|
|
325
|
+
this.popoverStyle = {
|
|
326
|
+
position: "fixed",
|
|
327
|
+
left: left + "px",
|
|
328
|
+
top: top + "px",
|
|
329
|
+
};
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
/** @type {?} */
|
|
333
|
+
var gridElement = this.options.getGridElement
|
|
334
|
+
? this.options.getGridElement()
|
|
335
|
+
: null;
|
|
336
|
+
if (gridElement && gridElement.getBoundingClientRect) {
|
|
337
|
+
/** @type {?} */
|
|
338
|
+
var fallbackRect = gridElement.getBoundingClientRect();
|
|
339
|
+
this.popoverStyle = {
|
|
340
|
+
position: "fixed",
|
|
341
|
+
left: Math.max(8, fallbackRect.right - 312) + "px",
|
|
342
|
+
top: Math.max(8, fallbackRect.top + 8) + "px",
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* @private
|
|
348
|
+
* @param {?} field
|
|
349
|
+
* @return {?}
|
|
350
|
+
*/
|
|
351
|
+
open(field) {
|
|
352
|
+
this.popoverField = field;
|
|
353
|
+
this.popoverVisible = true;
|
|
354
|
+
this.updatePosition();
|
|
355
|
+
setTimeout((/**
|
|
356
|
+
* @return {?}
|
|
357
|
+
*/
|
|
358
|
+
() => this.updatePosition()), 50);
|
|
359
|
+
setTimeout((/**
|
|
360
|
+
* @return {?}
|
|
361
|
+
*/
|
|
362
|
+
() => this.updatePosition()), 150);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* @private
|
|
366
|
+
* @return {?}
|
|
367
|
+
*/
|
|
368
|
+
apply() {
|
|
369
|
+
/** @type {?} */
|
|
370
|
+
var filteredRows = this.filterRowsBySelectedDateTree(this.sourceRows || []);
|
|
371
|
+
this.options.applyRows(filteredRows);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* @private
|
|
375
|
+
* @param {?} args
|
|
376
|
+
* @return {?}
|
|
377
|
+
*/
|
|
378
|
+
getRequestType(args) {
|
|
379
|
+
if (!args || !args.requestType) {
|
|
380
|
+
return "";
|
|
381
|
+
}
|
|
382
|
+
return String(args.requestType).trim().toLowerCase();
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* @private
|
|
386
|
+
* @param {?} args
|
|
387
|
+
* @return {?}
|
|
388
|
+
*/
|
|
389
|
+
resolveActionColumnName(args) {
|
|
390
|
+
if (!args) {
|
|
391
|
+
return "";
|
|
392
|
+
}
|
|
393
|
+
return (args.columnName ||
|
|
394
|
+
args.field ||
|
|
395
|
+
args.currentFilteringColumn ||
|
|
396
|
+
(args.column && (args.column.field || args.column.columnName)) ||
|
|
397
|
+
"");
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* @private
|
|
401
|
+
* @param {?} fields
|
|
402
|
+
* @param {?} hints
|
|
403
|
+
* @return {?}
|
|
404
|
+
*/
|
|
405
|
+
resolveDateTreeFieldsByHints(fields, hints) {
|
|
406
|
+
/** @type {?} */
|
|
407
|
+
var normalizedHints = (hints || [])
|
|
408
|
+
.filter((/**
|
|
409
|
+
* @param {?} item
|
|
410
|
+
* @return {?}
|
|
411
|
+
*/
|
|
412
|
+
(item) => !!item))
|
|
413
|
+
.map((/**
|
|
414
|
+
* @param {?} item
|
|
415
|
+
* @return {?}
|
|
416
|
+
*/
|
|
417
|
+
(item) => String(item).trim().toLowerCase()));
|
|
418
|
+
if (!fields || !fields.length || !normalizedHints.length) {
|
|
419
|
+
return [];
|
|
420
|
+
}
|
|
421
|
+
return fields
|
|
422
|
+
.filter((/**
|
|
423
|
+
* @param {?} item
|
|
424
|
+
* @return {?}
|
|
425
|
+
*/
|
|
426
|
+
(item) => {
|
|
427
|
+
if (!item || !item.columnName) {
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
/** @type {?} */
|
|
431
|
+
var columnName = String(item.columnName || "").toLowerCase();
|
|
432
|
+
/** @type {?} */
|
|
433
|
+
var displayName = String(item.columnDisplayName || "").toLowerCase();
|
|
434
|
+
return normalizedHints.some((/**
|
|
435
|
+
* @param {?} hint
|
|
436
|
+
* @return {?}
|
|
437
|
+
*/
|
|
438
|
+
(hint) => {
|
|
439
|
+
return (columnName === hint ||
|
|
440
|
+
displayName === hint ||
|
|
441
|
+
(hint.length >= 3 &&
|
|
442
|
+
(columnName.indexOf(hint) > -1 ||
|
|
443
|
+
displayName.indexOf(hint) > -1)));
|
|
444
|
+
}));
|
|
445
|
+
}))
|
|
446
|
+
.map((/**
|
|
447
|
+
* @param {?} item
|
|
448
|
+
* @return {?}
|
|
449
|
+
*/
|
|
450
|
+
(item) => item.columnName));
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* @private
|
|
454
|
+
* @param {?} field
|
|
455
|
+
* @return {?}
|
|
456
|
+
*/
|
|
457
|
+
isDateTreeField(field) {
|
|
458
|
+
return this.dateFields.indexOf(field) > -1;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* @private
|
|
462
|
+
* @param {?} field
|
|
463
|
+
* @return {?}
|
|
464
|
+
*/
|
|
465
|
+
getFieldDaySelectionMap(field) {
|
|
466
|
+
if (!this.selectedByField[field]) {
|
|
467
|
+
this.selectedByField[field] = {};
|
|
468
|
+
}
|
|
469
|
+
return this.selectedByField[field];
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* @private
|
|
473
|
+
* @param {?} rows
|
|
474
|
+
* @param {?=} excludeField
|
|
475
|
+
* @return {?}
|
|
476
|
+
*/
|
|
477
|
+
filterRowsBySelectedDateTree(rows, excludeField) {
|
|
478
|
+
/** @type {?} */
|
|
479
|
+
var filteredRows = rows ? rows.slice() : [];
|
|
480
|
+
this.dateFields.forEach((/**
|
|
481
|
+
* @param {?} field
|
|
482
|
+
* @return {?}
|
|
483
|
+
*/
|
|
484
|
+
(field) => {
|
|
485
|
+
if (excludeField && field === excludeField) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
/** @type {?} */
|
|
489
|
+
var selectedMap = this.getFieldDaySelectionMap(field);
|
|
490
|
+
/** @type {?} */
|
|
491
|
+
var selectedKeys = Object.keys(selectedMap);
|
|
492
|
+
if (!selectedKeys.length) {
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
filteredRows = filteredRows.filter((/**
|
|
496
|
+
* @param {?} row
|
|
497
|
+
* @return {?}
|
|
498
|
+
*/
|
|
499
|
+
(row) => {
|
|
500
|
+
/** @type {?} */
|
|
501
|
+
var dayKey = this.getDayKeyByRowValue(row[field]);
|
|
502
|
+
return dayKey ? !!selectedMap[dayKey] : false;
|
|
503
|
+
}));
|
|
504
|
+
}));
|
|
505
|
+
return filteredRows;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* @private
|
|
509
|
+
* @param {?} value
|
|
510
|
+
* @return {?}
|
|
511
|
+
*/
|
|
512
|
+
getDayKeyByRowValue(value) {
|
|
513
|
+
/** @type {?} */
|
|
514
|
+
var date = this.parseDateValue(value);
|
|
515
|
+
if (!date) {
|
|
516
|
+
return "";
|
|
517
|
+
}
|
|
518
|
+
return this.toDayKey(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* @private
|
|
522
|
+
* @param {?} value
|
|
523
|
+
* @return {?}
|
|
524
|
+
*/
|
|
525
|
+
parseDateValue(value) {
|
|
526
|
+
if (this.options.parseDateValue) {
|
|
527
|
+
return this.options.parseDateValue(value);
|
|
528
|
+
}
|
|
529
|
+
if (!value) {
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
if (value instanceof Date) {
|
|
533
|
+
return value;
|
|
534
|
+
}
|
|
535
|
+
/** @type {?} */
|
|
536
|
+
var formats = this.options && this.options.dateFormats && this.options.dateFormats.length
|
|
537
|
+
? this.options.dateFormats
|
|
538
|
+
: this.defaultDateFormats;
|
|
539
|
+
/** @type {?} */
|
|
540
|
+
var parsed = moment(value, formats, true);
|
|
541
|
+
if (parsed.isValid()) {
|
|
542
|
+
return parsed.toDate();
|
|
543
|
+
}
|
|
544
|
+
/** @type {?} */
|
|
545
|
+
var fallback = new Date(value);
|
|
546
|
+
return isNaN(fallback.getTime()) ? null : fallback;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* @private
|
|
550
|
+
* @param {?} year
|
|
551
|
+
* @param {?} month
|
|
552
|
+
* @param {?} day
|
|
553
|
+
* @return {?}
|
|
554
|
+
*/
|
|
555
|
+
toDayKey(year, month, day) {
|
|
556
|
+
return year + "-" + this.pad2(month) + "-" + this.pad2(day);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* @private
|
|
560
|
+
* @param {?} value
|
|
561
|
+
* @return {?}
|
|
562
|
+
*/
|
|
563
|
+
pad2(value) {
|
|
564
|
+
return value < 10 ? "0" + value : String(value);
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* @private
|
|
568
|
+
* @param {?} target
|
|
569
|
+
* @return {?}
|
|
570
|
+
*/
|
|
571
|
+
isInsidePopover(target) {
|
|
572
|
+
/** @type {?} */
|
|
573
|
+
var popoverElement = this.options.getPopoverElement
|
|
574
|
+
? this.options.getPopoverElement()
|
|
575
|
+
: null;
|
|
576
|
+
if (!target || !popoverElement) {
|
|
577
|
+
return false;
|
|
578
|
+
}
|
|
579
|
+
return popoverElement.contains(target);
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* @private
|
|
583
|
+
* @param {?} element
|
|
584
|
+
* @return {?}
|
|
585
|
+
*/
|
|
586
|
+
isDateFilterMenuItem(element) {
|
|
587
|
+
if (!element) {
|
|
588
|
+
return false;
|
|
589
|
+
}
|
|
590
|
+
/** @type {?} */
|
|
591
|
+
var menuItem = (/** @type {?} */ (element.closest(".e-menu-item")));
|
|
592
|
+
if (!menuItem) {
|
|
593
|
+
return false;
|
|
594
|
+
}
|
|
595
|
+
/** @type {?} */
|
|
596
|
+
var text = (menuItem.textContent || "").trim().toLowerCase();
|
|
597
|
+
/** @type {?} */
|
|
598
|
+
var translation = this.options.getTranslation
|
|
599
|
+
? this.options.getTranslation()
|
|
600
|
+
: null;
|
|
601
|
+
/** @type {?} */
|
|
602
|
+
var filterText = String((translation && translation.FILTER) || "filter")
|
|
603
|
+
.trim()
|
|
604
|
+
.toLowerCase();
|
|
605
|
+
if (!text) {
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
if (text.indexOf(filterText) > -1 || text.indexOf("filter") > -1) {
|
|
609
|
+
return true;
|
|
610
|
+
}
|
|
611
|
+
/** @type {?} */
|
|
612
|
+
var cls = (menuItem.className || "").toLowerCase();
|
|
613
|
+
return cls.indexOf("filter") > -1;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* @private
|
|
617
|
+
* @return {?}
|
|
618
|
+
*/
|
|
619
|
+
findDateFilterAnchorElement() {
|
|
620
|
+
/** @type {?} */
|
|
621
|
+
var menuContainers = (/** @type {?} */ (Array.from(document.querySelectorAll(".e-columnmenu, .e-contextmenu"))));
|
|
622
|
+
/** @type {?} */
|
|
623
|
+
var visibleContainers = menuContainers.filter((/**
|
|
624
|
+
* @param {?} container
|
|
625
|
+
* @return {?}
|
|
626
|
+
*/
|
|
627
|
+
(container) => {
|
|
628
|
+
if (!container || !container.getBoundingClientRect) {
|
|
629
|
+
return false;
|
|
630
|
+
}
|
|
631
|
+
/** @type {?} */
|
|
632
|
+
var rect = container.getBoundingClientRect();
|
|
633
|
+
if (rect.width <= 0 || rect.height <= 0) {
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
/** @type {?} */
|
|
637
|
+
var style = window.getComputedStyle(container);
|
|
638
|
+
if (!style || style.display === "none" || style.visibility === "hidden") {
|
|
639
|
+
return false;
|
|
640
|
+
}
|
|
641
|
+
return true;
|
|
642
|
+
}));
|
|
643
|
+
if (!visibleContainers.length) {
|
|
644
|
+
return null;
|
|
645
|
+
}
|
|
646
|
+
/** @type {?} */
|
|
647
|
+
var currentContainer = visibleContainers[visibleContainers.length - 1];
|
|
648
|
+
/** @type {?} */
|
|
649
|
+
var menuItems = (/** @type {?} */ (Array.from(currentContainer.querySelectorAll(".e-menu-item"))));
|
|
650
|
+
/** @type {?} */
|
|
651
|
+
var visibleFilterItems = menuItems.filter((/**
|
|
652
|
+
* @param {?} item
|
|
653
|
+
* @return {?}
|
|
654
|
+
*/
|
|
655
|
+
(item) => {
|
|
656
|
+
if (!this.isDateFilterMenuItem(item)) {
|
|
657
|
+
return false;
|
|
658
|
+
}
|
|
659
|
+
if (!item.getBoundingClientRect) {
|
|
660
|
+
return false;
|
|
661
|
+
}
|
|
662
|
+
/** @type {?} */
|
|
663
|
+
var rect = item.getBoundingClientRect();
|
|
664
|
+
return rect.width > 0 && rect.height > 0;
|
|
665
|
+
}));
|
|
666
|
+
if (!visibleFilterItems.length) {
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
669
|
+
/** @type {?} */
|
|
670
|
+
var focusedItem = visibleFilterItems.find((/**
|
|
671
|
+
* @param {?} item
|
|
672
|
+
* @return {?}
|
|
673
|
+
*/
|
|
674
|
+
(item) => {
|
|
675
|
+
return (item.classList.contains("e-focused") ||
|
|
676
|
+
item.classList.contains("e-selected") ||
|
|
677
|
+
item.classList.contains("e-hover"));
|
|
678
|
+
}));
|
|
679
|
+
return focusedItem || visibleFilterItems[visibleFilterItems.length - 1];
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
if (false) {
|
|
683
|
+
/** @type {?} */
|
|
684
|
+
DateTreeFilterHelper.prototype.popoverVisible;
|
|
685
|
+
/** @type {?} */
|
|
686
|
+
DateTreeFilterHelper.prototype.popoverField;
|
|
687
|
+
/** @type {?} */
|
|
688
|
+
DateTreeFilterHelper.prototype.popoverStyle;
|
|
689
|
+
/** @type {?} */
|
|
690
|
+
DateTreeFilterHelper.prototype.selectedByField;
|
|
691
|
+
/** @type {?} */
|
|
692
|
+
DateTreeFilterHelper.prototype.fieldLabelMap;
|
|
693
|
+
/** @type {?} */
|
|
694
|
+
DateTreeFilterHelper.prototype.dateFields;
|
|
695
|
+
/**
|
|
696
|
+
* @type {?}
|
|
697
|
+
* @private
|
|
698
|
+
*/
|
|
699
|
+
DateTreeFilterHelper.prototype.sourceRows;
|
|
700
|
+
/**
|
|
701
|
+
* @type {?}
|
|
702
|
+
* @private
|
|
703
|
+
*/
|
|
704
|
+
DateTreeFilterHelper.prototype.options;
|
|
705
|
+
/**
|
|
706
|
+
* @type {?}
|
|
707
|
+
* @private
|
|
708
|
+
*/
|
|
709
|
+
DateTreeFilterHelper.prototype.defaultDateFormats;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* @param {?} host
|
|
713
|
+
* @return {?}
|
|
714
|
+
*/
|
|
715
|
+
function resolveGridElement(host) {
|
|
716
|
+
if (!host || !host.grid) {
|
|
717
|
+
return null;
|
|
718
|
+
}
|
|
719
|
+
/** @type {?} */
|
|
720
|
+
var gridRef = host.grid;
|
|
721
|
+
if (gridRef.grid && gridRef.grid.element) {
|
|
722
|
+
return gridRef.grid.element;
|
|
723
|
+
}
|
|
724
|
+
if (gridRef.element) {
|
|
725
|
+
return gridRef.element;
|
|
726
|
+
}
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* @param {?} host
|
|
731
|
+
* @param {?} applyRows
|
|
732
|
+
* @param {?=} dateFormats
|
|
733
|
+
* @return {?}
|
|
734
|
+
*/
|
|
735
|
+
function createRsCommonGridDateTreeHelper(host, applyRows, dateFormats) {
|
|
736
|
+
return new DateTreeFilterHelper({
|
|
737
|
+
getTranslation: (/**
|
|
738
|
+
* @return {?}
|
|
739
|
+
*/
|
|
740
|
+
() => (host ? host.translation : null)),
|
|
741
|
+
getPopoverElement: (/**
|
|
742
|
+
* @return {?}
|
|
743
|
+
*/
|
|
744
|
+
() => host && host.dateTreePopoverRef
|
|
745
|
+
? host.dateTreePopoverRef.nativeElement
|
|
746
|
+
: null),
|
|
747
|
+
getGridElement: (/**
|
|
748
|
+
* @return {?}
|
|
749
|
+
*/
|
|
750
|
+
() => resolveGridElement(host)),
|
|
751
|
+
applyRows: applyRows,
|
|
752
|
+
dateFormats: dateFormats && dateFormats.length
|
|
753
|
+
? dateFormats
|
|
754
|
+
: DATE_TREE_DEFAULT_DATE_FORMATS,
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
|
|
80
758
|
/**
|
|
81
759
|
* @fileoverview added by tsickle
|
|
82
760
|
* Generated from: lib/common-grid/index.component.ts
|
|
@@ -133,6 +811,23 @@ class CommonGridComponent {
|
|
|
133
811
|
this.alwaysShowCheckbox = false;
|
|
134
812
|
this.disableSystemRow = false; // 禁用IsSytem = true的整行
|
|
135
813
|
// 禁用IsSytem = true的整行
|
|
814
|
+
/**
|
|
815
|
+
* 开启日期树筛选(默认关闭,不影响现有页面)
|
|
816
|
+
*/
|
|
817
|
+
this.enableDateTreeFilter = false;
|
|
818
|
+
/**
|
|
819
|
+
* 参与日期树筛选的列名或 hint,如 ['CreatedOn', 'ModifiedOn']
|
|
820
|
+
*/
|
|
821
|
+
this.dateTreeFilterFields = [];
|
|
822
|
+
/**
|
|
823
|
+
* 未筛选原始数据(可选)。
|
|
824
|
+
* 不传时由组件在 dataSource 变更时自动快照;传则由页面自行维护 raw。
|
|
825
|
+
*/
|
|
826
|
+
this.dateTreeSourceRows = null;
|
|
827
|
+
/**
|
|
828
|
+
* 内聚模式下仍向页面同步筛选结果(默认 false,一般无需绑定)
|
|
829
|
+
*/
|
|
830
|
+
this.dateTreeEmitFilteredRows = false;
|
|
136
831
|
this.recordDoubleClick = new EventEmitter();
|
|
137
832
|
this.actionComplete = new EventEmitter();
|
|
138
833
|
this.rowSelected = new EventEmitter();
|
|
@@ -150,6 +845,16 @@ class CommonGridComponent {
|
|
|
150
845
|
this.rowDrop = new EventEmitter();
|
|
151
846
|
this.rowDrag = new EventEmitter();
|
|
152
847
|
this.rowDragStart = new EventEmitter();
|
|
848
|
+
/**
|
|
849
|
+
* 日期树筛选后的行数据(可选,复杂页面与 dateTreeSourceRows 搭配使用)
|
|
850
|
+
*/
|
|
851
|
+
this.dateTreeFilteredRows = new EventEmitter();
|
|
852
|
+
/**
|
|
853
|
+
* 内聚模式:表格实际绑定的数据
|
|
854
|
+
*/
|
|
855
|
+
this.dateTreeDisplayRows = [];
|
|
856
|
+
this.dateTreeRawRows = [];
|
|
857
|
+
this.dateTreeApplyingFilter = false;
|
|
153
858
|
this.selectId = [];
|
|
154
859
|
this.startPaging = false;
|
|
155
860
|
this.indexList = [];
|
|
@@ -174,6 +879,11 @@ class CommonGridComponent {
|
|
|
174
879
|
return list;
|
|
175
880
|
});
|
|
176
881
|
this.translation = getTranslation();
|
|
882
|
+
this.dateTreeHelper = createRsCommonGridDateTreeHelper(this, (/**
|
|
883
|
+
* @param {?} rows
|
|
884
|
+
* @return {?}
|
|
885
|
+
*/
|
|
886
|
+
(rows) => this.onDateTreeRowsApplied(rows)));
|
|
177
887
|
}
|
|
178
888
|
/**
|
|
179
889
|
* @return {?}
|
|
@@ -193,17 +903,41 @@ class CommonGridComponent {
|
|
|
193
903
|
trackByFn(index, item) {
|
|
194
904
|
return index; // or a unique identifier in your object
|
|
195
905
|
}
|
|
906
|
+
/**
|
|
907
|
+
* ejs-grid 绑定数据源:内聚模式用内部展示数据,否则用 dataSource
|
|
908
|
+
* @return {?}
|
|
909
|
+
*/
|
|
910
|
+
get gridBindDataSource() {
|
|
911
|
+
if (this.enableDateTreeFilter && this.dateTreeSourceRows == null) {
|
|
912
|
+
return this.dateTreeDisplayRows;
|
|
913
|
+
}
|
|
914
|
+
return this.dataSource;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* 日期树 popover 用的全量数据
|
|
918
|
+
* @return {?}
|
|
919
|
+
*/
|
|
920
|
+
get dateTreePopoverSourceRows() {
|
|
921
|
+
if (this.dateTreeSourceRows != null) {
|
|
922
|
+
return this.dateTreeSourceRows;
|
|
923
|
+
}
|
|
924
|
+
return this.dateTreeRawRows;
|
|
925
|
+
}
|
|
196
926
|
/**
|
|
197
927
|
* @param {?} changes
|
|
198
928
|
* @return {?}
|
|
199
929
|
*/
|
|
200
930
|
ngOnChanges(changes) {
|
|
201
|
-
|
|
931
|
+
/** @type {?} */
|
|
932
|
+
var bindRows = changes.dataSource && changes.dataSource.currentValue
|
|
933
|
+
? changes.dataSource.currentValue
|
|
934
|
+
: null;
|
|
935
|
+
if (bindRows) {
|
|
202
936
|
if (this.allowPaging &&
|
|
203
|
-
|
|
937
|
+
bindRows.length &&
|
|
204
938
|
!this.pageSettings) {
|
|
205
939
|
this.pageSettings =
|
|
206
|
-
|
|
940
|
+
bindRows.length > 9
|
|
207
941
|
? {
|
|
208
942
|
pageSizes: ["All", "25", "50", "100"],
|
|
209
943
|
pageSize: 50,
|
|
@@ -211,6 +945,95 @@ class CommonGridComponent {
|
|
|
211
945
|
: null;
|
|
212
946
|
}
|
|
213
947
|
}
|
|
948
|
+
if (this.enableDateTreeFilter &&
|
|
949
|
+
this.dateTreeSourceRows == null &&
|
|
950
|
+
changes.dataSource &&
|
|
951
|
+
!this.dateTreeApplyingFilter) {
|
|
952
|
+
this.captureDateTreeRawFromDataSource(changes.dataSource.currentValue);
|
|
953
|
+
}
|
|
954
|
+
if (changes.enableDateTreeFilter && changes.enableDateTreeFilter.currentValue) {
|
|
955
|
+
this.captureDateTreeRawFromDataSource(this.dataSource);
|
|
956
|
+
}
|
|
957
|
+
if (changes.enableDateTreeFilter && !changes.enableDateTreeFilter.currentValue) {
|
|
958
|
+
this.dateTreeHelper && this.dateTreeHelper.close();
|
|
959
|
+
this.dateTreeDisplayRows = [];
|
|
960
|
+
this.dateTreeRawRows = [];
|
|
961
|
+
}
|
|
962
|
+
if (this.enableDateTreeFilter &&
|
|
963
|
+
(changes.enableDateTreeFilter ||
|
|
964
|
+
changes.dateTreeFilterFields ||
|
|
965
|
+
changes.dateTreeSourceRows ||
|
|
966
|
+
changes.fields ||
|
|
967
|
+
changes.dataSource)) {
|
|
968
|
+
this.refreshDateTreeFilter();
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* @private
|
|
973
|
+
* @param {?} rows
|
|
974
|
+
* @return {?}
|
|
975
|
+
*/
|
|
976
|
+
captureDateTreeRawFromDataSource(rows) {
|
|
977
|
+
this.dateTreeRawRows = rows ? rows.slice() : [];
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* @param {?} event
|
|
981
|
+
* @return {?}
|
|
982
|
+
*/
|
|
983
|
+
onDocumentMouseDown(event) {
|
|
984
|
+
if (this.enableDateTreeFilter && this.dateTreeHelper) {
|
|
985
|
+
this.dateTreeHelper.handleDocumentMouseDown(event);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* @param {?} event
|
|
990
|
+
* @return {?}
|
|
991
|
+
*/
|
|
992
|
+
onDocumentMouseOver(event) {
|
|
993
|
+
if (this.enableDateTreeFilter && this.dateTreeHelper) {
|
|
994
|
+
this.dateTreeHelper.handleDocumentMouseOver(event);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* @private
|
|
999
|
+
* @return {?}
|
|
1000
|
+
*/
|
|
1001
|
+
refreshDateTreeFilter() {
|
|
1002
|
+
if (!this.enableDateTreeFilter || !this.dateTreeHelper) {
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
/** @type {?} */
|
|
1006
|
+
var rows = this.dateTreeSourceRows != null
|
|
1007
|
+
? this.dateTreeSourceRows
|
|
1008
|
+
: this.dateTreeRawRows || [];
|
|
1009
|
+
this.dateTreeHelper.setup({
|
|
1010
|
+
rows: rows,
|
|
1011
|
+
fields: this.fields || [],
|
|
1012
|
+
hints: this.dateTreeFilterFields || [],
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* @private
|
|
1017
|
+
* @param {?} rows
|
|
1018
|
+
* @return {?}
|
|
1019
|
+
*/
|
|
1020
|
+
onDateTreeRowsApplied(rows) {
|
|
1021
|
+
/** @type {?} */
|
|
1022
|
+
var result = rows || [];
|
|
1023
|
+
this.dateTreeApplyingFilter = true;
|
|
1024
|
+
if (this.enableDateTreeFilter && this.dateTreeSourceRows == null) {
|
|
1025
|
+
this.dateTreeDisplayRows = result;
|
|
1026
|
+
}
|
|
1027
|
+
if (this.dateTreeSourceRows != null || this.dateTreeEmitFilteredRows) {
|
|
1028
|
+
this.dateTreeFilteredRows.emit(result);
|
|
1029
|
+
}
|
|
1030
|
+
this.ref && this.ref.markForCheck();
|
|
1031
|
+
setTimeout((/**
|
|
1032
|
+
* @return {?}
|
|
1033
|
+
*/
|
|
1034
|
+
() => {
|
|
1035
|
+
this.dateTreeApplyingFilter = false;
|
|
1036
|
+
}), 0);
|
|
214
1037
|
}
|
|
215
1038
|
/**
|
|
216
1039
|
* @return {?}
|
|
@@ -413,7 +1236,10 @@ class CommonGridComponent {
|
|
|
413
1236
|
args.requestType === "sorting")) {
|
|
414
1237
|
this.startPaging = true;
|
|
415
1238
|
}
|
|
416
|
-
if (
|
|
1239
|
+
if (this.enableDateTreeFilter && this.dateTreeHelper) {
|
|
1240
|
+
this.dateTreeHelper.handleGridActionBegin(args);
|
|
1241
|
+
}
|
|
1242
|
+
else if (args.requestType == "filterchoicerequest" ||
|
|
417
1243
|
args.requestType === "filtersearchbegin") {
|
|
418
1244
|
args.filterChoiceCount = 15000;
|
|
419
1245
|
}
|
|
@@ -690,7 +1516,7 @@ class CommonGridComponent {
|
|
|
690
1516
|
CommonGridComponent.decorators = [
|
|
691
1517
|
{ type: Component, args: [{
|
|
692
1518
|
selector: "rs-common-grid",
|
|
693
|
-
template: "<ejs-grid\r\n #grid\r\n [id]=\"gridId\"\r\n [ngClass]=\"{\r\n 'hide-Check-box': !alwaysShowCheckbox,\r\n 'grid-loading': className === 'grid-loading'\r\n }\"\r\n [dataSource]=\"
|
|
1519
|
+
template: "<rs-date-tree-filter-popover\r\n *ngIf=\"enableDateTreeFilter && dateTreeHelper && dateTreeHelper.popoverVisible\"\r\n #dateTreePopoverRef\r\n [ngStyle]=\"dateTreeHelper.popoverStyle\"\r\n [field]=\"dateTreeHelper.popoverField\"\r\n [translation]=\"translation\"\r\n [sourceRows]=\"dateTreePopoverSourceRows\"\r\n [dateFields]=\"dateTreeHelper.dateFields\"\r\n [selectedByField]=\"dateTreeHelper.selectedByField\"\r\n [fieldLabelMap]=\"dateTreeHelper.fieldLabelMap\"\r\n (apply)=\"dateTreeHelper.updateSelection($event)\"\r\n (close)=\"dateTreeHelper.close()\"\r\n></rs-date-tree-filter-popover>\r\n<ejs-grid\r\n #grid\r\n [id]=\"gridId\"\r\n [ngClass]=\"{\r\n 'hide-Check-box': !alwaysShowCheckbox,\r\n 'grid-loading': className === 'grid-loading'\r\n }\"\r\n [dataSource]=\"gridBindDataSource\"\r\n [allowPaging]=\"allowPaging && pageSettings\"\r\n [allowResizing]=\"true\"\r\n [pageSettings]=\"pageSettings\"\r\n [showColumnMenu]=\"true\"\r\n [allowSorting]=\"true\"\r\n [allowFiltering]=\"true\"\r\n [allowExcelExport]=\"true\"\r\n [allowRowDragAndDrop]=\"allowRowDragAndDrop\"\r\n [filterSettings]=\"filterSettings\"\r\n [resizeSettings]=\"resizeSettings\"\r\n [allowSelection]=\"true\"\r\n [editSettings]=\"editSettings\"\r\n [childGrid]=\"childGrid\"\r\n [contextMenuItems]=\"gridBindDataSource && gridBindDataSource.length ? contextMenuItems : null\"\r\n [selectionSettings]=\"selectionSettings\"\r\n (recordClick)=\"_recordClick($event)\"\r\n (recordDoubleClick)=\"_recordDoubleClick($event)\"\r\n (actionBegin)=\"_actionBegin($event)\"\r\n (actionComplete)=\"_actionHandler($event)\"\r\n (rowSelected)=\"_rowSelected($event)\"\r\n (rowDeselecting)=\"_rowDeselecting($event)\"\r\n (rowDeselected)=\"_rowDeselected($event)\"\r\n style=\"border: none\"\r\n (contextMenuClick)=\"_onContextMenu($event)\"\r\n (contextMenuOpen)=\"contextMenuOpen($event)\"\r\n (queryCellInfo)=\"customiseCell($event)\"\r\n (dataBound)=\"_dataBound($event)\"\r\n (rowDataBound)=\"_rowDataBound($event)\"\r\n (rowSelecting)=\"_rowSelecting($event)\"\r\n (excelQueryCellInfo)=\"_exportQueryCellInfo($event)\"\r\n (rowDrop)=\"onRowDrop($event)\"\r\n (rowDragStart)=\"_rowDragStart($event)\"\r\n (rowDrag)=\"_rowDrag($event)\"\r\n (load)=\"_load()\"\r\n [frozenColumns]=\"frozenColumns\"\r\n [columnChooserSettings]=\"columnChooserSettings\"\r\n>\r\n <e-columns>\r\n <e-column\r\n *ngIf=\"showCheckBox\"\r\n type=\"checkbox\"\r\n [width]=\"checkBoxWidth\"\r\n [minWidth]=\"checkBoxWidth\"\r\n [showColumnMenu]=\"false\"\r\n [allowResizing]=\"false\"\r\n ></e-column>\r\n <e-column\r\n *ngFor=\"let item of fields; trackBy: trackByFn; let last = last\"\r\n [field]=\"item.columnName\"\r\n [filter]=\"item.filter ? item.filter : { type: 'CheckBox' }\"\r\n [customAttributes]=\"\r\n item.colName === 'entityUserList' || item.colName === 'kycProgress'\r\n ? { class: 'hideColumnFilterClass' }\r\n : {}\r\n \"\r\n [headerText]=\"item.columnDisplayName\"\r\n [textAlign]=\"item.textAlign\"\r\n [showColumnMenu]=\"item.showColumnMenu === undefined ? true : false\"\r\n [allowFiltering]=\"item.allowFiltering === undefined ? true : false\"\r\n [allowSorting]=\"item.allowSorting === undefined ? true : false\"\r\n [showInColumnChooser]=\"\r\n item.showInColumnChooser === undefined ? true : item.showInColumnChooser\r\n \"\r\n [editType]=\"item.editType\"\r\n [validationRules]=\"item.validationRules\"\r\n [type]=\"item.dataType || 'string'\"\r\n [width]=\"item.width\"\r\n [minWidth]=\"item.minWidth\"\r\n [format]=\"item.format\"\r\n [visible]=\"item.visible\"\r\n [template]=\"item.showTemplate ? columnTemplate : undefined\"\r\n [clipMode]=\"\r\n item.clipMode ? item.clipMode : clipMode || 'EllipsisWithTooltip'\r\n \"\r\n [sortComparer]=\"item.dateComparer || null\"\r\n [allowResizing]=\"!last\"\r\n [headerTemplate]=\"item.showHeaderTemplate ? headerTemplate : undefined\"\r\n [isPrimaryKey]=\"item?.isPrimaryKey ? true : false\"\r\n >\r\n </e-column>\r\n </e-columns>\r\n</ejs-grid>\r\n",
|
|
694
1520
|
styles: [""]
|
|
695
1521
|
}] }
|
|
696
1522
|
];
|
|
@@ -728,6 +1554,10 @@ CommonGridComponent.propDecorators = {
|
|
|
728
1554
|
alwaysShowCheckbox: [{ type: Input }],
|
|
729
1555
|
defaultRecord: [{ type: Input }],
|
|
730
1556
|
disableSystemRow: [{ type: Input }],
|
|
1557
|
+
enableDateTreeFilter: [{ type: Input }],
|
|
1558
|
+
dateTreeFilterFields: [{ type: Input }],
|
|
1559
|
+
dateTreeSourceRows: [{ type: Input }],
|
|
1560
|
+
dateTreeEmitFilteredRows: [{ type: Input }],
|
|
731
1561
|
recordDoubleClick: [{ type: Output }],
|
|
732
1562
|
actionComplete: [{ type: Output }],
|
|
733
1563
|
rowSelected: [{ type: Output }],
|
|
@@ -744,7 +1574,11 @@ CommonGridComponent.propDecorators = {
|
|
|
744
1574
|
rowSelecting: [{ type: Output }],
|
|
745
1575
|
rowDrop: [{ type: Output }],
|
|
746
1576
|
rowDrag: [{ type: Output }],
|
|
747
|
-
rowDragStart: [{ type: Output }]
|
|
1577
|
+
rowDragStart: [{ type: Output }],
|
|
1578
|
+
dateTreeFilteredRows: [{ type: Output }],
|
|
1579
|
+
dateTreePopoverRef: [{ type: ViewChild, args: ["dateTreePopoverRef", { read: ElementRef, static: false },] }],
|
|
1580
|
+
onDocumentMouseDown: [{ type: HostListener, args: ["document:mousedown", ["$event"],] }],
|
|
1581
|
+
onDocumentMouseOver: [{ type: HostListener, args: ["document:mouseover", ["$event"],] }]
|
|
748
1582
|
};
|
|
749
1583
|
if (false) {
|
|
750
1584
|
/** @type {?} */
|
|
@@ -822,6 +1656,27 @@ if (false) {
|
|
|
822
1656
|
CommonGridComponent.prototype.defaultRecord;
|
|
823
1657
|
/** @type {?} */
|
|
824
1658
|
CommonGridComponent.prototype.disableSystemRow;
|
|
1659
|
+
/**
|
|
1660
|
+
* 开启日期树筛选(默认关闭,不影响现有页面)
|
|
1661
|
+
* @type {?}
|
|
1662
|
+
*/
|
|
1663
|
+
CommonGridComponent.prototype.enableDateTreeFilter;
|
|
1664
|
+
/**
|
|
1665
|
+
* 参与日期树筛选的列名或 hint,如 ['CreatedOn', 'ModifiedOn']
|
|
1666
|
+
* @type {?}
|
|
1667
|
+
*/
|
|
1668
|
+
CommonGridComponent.prototype.dateTreeFilterFields;
|
|
1669
|
+
/**
|
|
1670
|
+
* 未筛选原始数据(可选)。
|
|
1671
|
+
* 不传时由组件在 dataSource 变更时自动快照;传则由页面自行维护 raw。
|
|
1672
|
+
* @type {?}
|
|
1673
|
+
*/
|
|
1674
|
+
CommonGridComponent.prototype.dateTreeSourceRows;
|
|
1675
|
+
/**
|
|
1676
|
+
* 内聚模式下仍向页面同步筛选结果(默认 false,一般无需绑定)
|
|
1677
|
+
* @type {?}
|
|
1678
|
+
*/
|
|
1679
|
+
CommonGridComponent.prototype.dateTreeEmitFilteredRows;
|
|
825
1680
|
/** @type {?} */
|
|
826
1681
|
CommonGridComponent.prototype.recordDoubleClick;
|
|
827
1682
|
/** @type {?} */
|
|
@@ -856,6 +1711,30 @@ if (false) {
|
|
|
856
1711
|
CommonGridComponent.prototype.rowDrag;
|
|
857
1712
|
/** @type {?} */
|
|
858
1713
|
CommonGridComponent.prototype.rowDragStart;
|
|
1714
|
+
/**
|
|
1715
|
+
* 日期树筛选后的行数据(可选,复杂页面与 dateTreeSourceRows 搭配使用)
|
|
1716
|
+
* @type {?}
|
|
1717
|
+
*/
|
|
1718
|
+
CommonGridComponent.prototype.dateTreeFilteredRows;
|
|
1719
|
+
/** @type {?} */
|
|
1720
|
+
CommonGridComponent.prototype.dateTreePopoverRef;
|
|
1721
|
+
/** @type {?} */
|
|
1722
|
+
CommonGridComponent.prototype.dateTreeHelper;
|
|
1723
|
+
/**
|
|
1724
|
+
* 内聚模式:表格实际绑定的数据
|
|
1725
|
+
* @type {?}
|
|
1726
|
+
*/
|
|
1727
|
+
CommonGridComponent.prototype.dateTreeDisplayRows;
|
|
1728
|
+
/**
|
|
1729
|
+
* @type {?}
|
|
1730
|
+
* @private
|
|
1731
|
+
*/
|
|
1732
|
+
CommonGridComponent.prototype.dateTreeRawRows;
|
|
1733
|
+
/**
|
|
1734
|
+
* @type {?}
|
|
1735
|
+
* @private
|
|
1736
|
+
*/
|
|
1737
|
+
CommonGridComponent.prototype.dateTreeApplyingFilter;
|
|
859
1738
|
/** @type {?} */
|
|
860
1739
|
CommonGridComponent.prototype.selectId;
|
|
861
1740
|
/** @type {?} */
|
|
@@ -989,6 +1868,765 @@ if (false) {
|
|
|
989
1868
|
GridActionItemComponent.prototype.ImageType;
|
|
990
1869
|
}
|
|
991
1870
|
|
|
1871
|
+
/**
|
|
1872
|
+
* @fileoverview added by tsickle
|
|
1873
|
+
* Generated from: lib/date-tree-filter/date-tree-filter-popover/index.component.ts
|
|
1874
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1875
|
+
*/
|
|
1876
|
+
class DateTreeFilterPopoverComponent {
|
|
1877
|
+
constructor() {
|
|
1878
|
+
this.field = "";
|
|
1879
|
+
this.sourceRows = [];
|
|
1880
|
+
this.dateFields = [];
|
|
1881
|
+
this.selectedByField = {};
|
|
1882
|
+
this.fieldLabelMap = {};
|
|
1883
|
+
this.apply = new EventEmitter();
|
|
1884
|
+
this.close = new EventEmitter();
|
|
1885
|
+
this.keyword = "";
|
|
1886
|
+
this.years = [];
|
|
1887
|
+
this.expandStateByField = {};
|
|
1888
|
+
this.workingSelectedByField = {};
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* @param {?} changes
|
|
1892
|
+
* @return {?}
|
|
1893
|
+
*/
|
|
1894
|
+
ngOnChanges(changes) {
|
|
1895
|
+
if (changes.field ||
|
|
1896
|
+
changes.sourceRows ||
|
|
1897
|
+
changes.selectedByField ||
|
|
1898
|
+
changes.dateFields) {
|
|
1899
|
+
this.keyword = "";
|
|
1900
|
+
this.workingSelectedByField = this.cloneSelectionMap(this.selectedByField);
|
|
1901
|
+
this.rebuildTree();
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* @return {?}
|
|
1906
|
+
*/
|
|
1907
|
+
closePopover() {
|
|
1908
|
+
this.close.emit();
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* @param {?} value
|
|
1912
|
+
* @return {?}
|
|
1913
|
+
*/
|
|
1914
|
+
onKeywordChange(value) {
|
|
1915
|
+
this.keyword = value || "";
|
|
1916
|
+
}
|
|
1917
|
+
/**
|
|
1918
|
+
* @return {?}
|
|
1919
|
+
*/
|
|
1920
|
+
getVisibleYears() {
|
|
1921
|
+
/** @type {?} */
|
|
1922
|
+
const searchText = (this.keyword || "").trim().toLowerCase();
|
|
1923
|
+
if (!searchText) {
|
|
1924
|
+
return this.years;
|
|
1925
|
+
}
|
|
1926
|
+
return this.years
|
|
1927
|
+
.map((/**
|
|
1928
|
+
* @param {?} yearNode
|
|
1929
|
+
* @return {?}
|
|
1930
|
+
*/
|
|
1931
|
+
(yearNode) => {
|
|
1932
|
+
/** @type {?} */
|
|
1933
|
+
const yearMatched = String(yearNode.year).toLowerCase().indexOf(searchText) > -1;
|
|
1934
|
+
/** @type {?} */
|
|
1935
|
+
const months = yearNode.months
|
|
1936
|
+
.map((/**
|
|
1937
|
+
* @param {?} monthNode
|
|
1938
|
+
* @return {?}
|
|
1939
|
+
*/
|
|
1940
|
+
(monthNode) => {
|
|
1941
|
+
/** @type {?} */
|
|
1942
|
+
const monthMatched = String(monthNode.label)
|
|
1943
|
+
.toLowerCase()
|
|
1944
|
+
.indexOf(searchText) > -1;
|
|
1945
|
+
/** @type {?} */
|
|
1946
|
+
const days = monthNode.days.filter((/**
|
|
1947
|
+
* @param {?} dayNode
|
|
1948
|
+
* @return {?}
|
|
1949
|
+
*/
|
|
1950
|
+
(dayNode) => {
|
|
1951
|
+
return (String(dayNode.label)
|
|
1952
|
+
.toLowerCase()
|
|
1953
|
+
.indexOf(searchText) > -1);
|
|
1954
|
+
}));
|
|
1955
|
+
if (yearMatched || monthMatched) {
|
|
1956
|
+
return monthNode;
|
|
1957
|
+
}
|
|
1958
|
+
return Object.assign({}, monthNode, { days: days });
|
|
1959
|
+
}))
|
|
1960
|
+
.filter((/**
|
|
1961
|
+
* @param {?} monthNode
|
|
1962
|
+
* @return {?}
|
|
1963
|
+
*/
|
|
1964
|
+
(monthNode) => monthNode.days.length > 0));
|
|
1965
|
+
if (yearMatched) {
|
|
1966
|
+
return yearNode;
|
|
1967
|
+
}
|
|
1968
|
+
return Object.assign({}, yearNode, { months: months });
|
|
1969
|
+
}))
|
|
1970
|
+
.filter((/**
|
|
1971
|
+
* @param {?} yearNode
|
|
1972
|
+
* @return {?}
|
|
1973
|
+
*/
|
|
1974
|
+
(yearNode) => yearNode.months.length > 0));
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
* @param {?} yearNode
|
|
1978
|
+
* @return {?}
|
|
1979
|
+
*/
|
|
1980
|
+
toggleYearExpanded(yearNode) {
|
|
1981
|
+
/** @type {?} */
|
|
1982
|
+
const state = this.getOrCreateExpandState(this.field);
|
|
1983
|
+
state.years[yearNode.key] = !state.years[yearNode.key];
|
|
1984
|
+
yearNode.expanded = !!state.years[yearNode.key];
|
|
1985
|
+
}
|
|
1986
|
+
/**
|
|
1987
|
+
* @param {?} monthNode
|
|
1988
|
+
* @return {?}
|
|
1989
|
+
*/
|
|
1990
|
+
toggleMonthExpanded(monthNode) {
|
|
1991
|
+
/** @type {?} */
|
|
1992
|
+
const state = this.getOrCreateExpandState(this.field);
|
|
1993
|
+
state.months[monthNode.key] = !state.months[monthNode.key];
|
|
1994
|
+
monthNode.expanded = !!state.months[monthNode.key];
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* @return {?}
|
|
1998
|
+
*/
|
|
1999
|
+
isAllChecked() {
|
|
2000
|
+
/** @type {?} */
|
|
2001
|
+
const selectedMap = this.getFieldDaySelectionMap(this.field);
|
|
2002
|
+
/** @type {?} */
|
|
2003
|
+
const enabledDayKeys = this.getEnabledDayKeysInCurrentField();
|
|
2004
|
+
if (!enabledDayKeys.length) {
|
|
2005
|
+
return false;
|
|
2006
|
+
}
|
|
2007
|
+
return enabledDayKeys.every((/**
|
|
2008
|
+
* @param {?} key
|
|
2009
|
+
* @return {?}
|
|
2010
|
+
*/
|
|
2011
|
+
(key) => !!selectedMap[key]));
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* @return {?}
|
|
2015
|
+
*/
|
|
2016
|
+
isAllIndeterminate() {
|
|
2017
|
+
/** @type {?} */
|
|
2018
|
+
const selectedMap = this.getFieldDaySelectionMap(this.field);
|
|
2019
|
+
/** @type {?} */
|
|
2020
|
+
const enabledDayKeys = this.getEnabledDayKeysInCurrentField();
|
|
2021
|
+
if (!enabledDayKeys.length) {
|
|
2022
|
+
return false;
|
|
2023
|
+
}
|
|
2024
|
+
/** @type {?} */
|
|
2025
|
+
const selectedCount = enabledDayKeys.filter((/**
|
|
2026
|
+
* @param {?} key
|
|
2027
|
+
* @return {?}
|
|
2028
|
+
*/
|
|
2029
|
+
(key) => !!selectedMap[key]))
|
|
2030
|
+
.length;
|
|
2031
|
+
return selectedCount > 0 && selectedCount < enabledDayKeys.length;
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* @param {?} checked
|
|
2035
|
+
* @return {?}
|
|
2036
|
+
*/
|
|
2037
|
+
toggleAllDays(checked) {
|
|
2038
|
+
/** @type {?} */
|
|
2039
|
+
const selectedMap = this.getFieldDaySelectionMap(this.field);
|
|
2040
|
+
/** @type {?} */
|
|
2041
|
+
const enabledDayKeys = this.getEnabledDayKeysInCurrentField();
|
|
2042
|
+
enabledDayKeys.forEach((/**
|
|
2043
|
+
* @param {?} key
|
|
2044
|
+
* @return {?}
|
|
2045
|
+
*/
|
|
2046
|
+
(key) => {
|
|
2047
|
+
if (checked) {
|
|
2048
|
+
selectedMap[key] = true;
|
|
2049
|
+
}
|
|
2050
|
+
else {
|
|
2051
|
+
delete selectedMap[key];
|
|
2052
|
+
}
|
|
2053
|
+
}));
|
|
2054
|
+
}
|
|
2055
|
+
/**
|
|
2056
|
+
* @param {?} dayNode
|
|
2057
|
+
* @return {?}
|
|
2058
|
+
*/
|
|
2059
|
+
isDayChecked(dayNode) {
|
|
2060
|
+
/** @type {?} */
|
|
2061
|
+
const selectedMap = this.getFieldDaySelectionMap(this.field);
|
|
2062
|
+
return !!selectedMap[dayNode.key];
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* @param {?} dayNode
|
|
2066
|
+
* @param {?} checked
|
|
2067
|
+
* @return {?}
|
|
2068
|
+
*/
|
|
2069
|
+
toggleDay(dayNode, checked) {
|
|
2070
|
+
if (dayNode.disabled) {
|
|
2071
|
+
return;
|
|
2072
|
+
}
|
|
2073
|
+
/** @type {?} */
|
|
2074
|
+
const selectedMap = this.getFieldDaySelectionMap(this.field);
|
|
2075
|
+
if (checked) {
|
|
2076
|
+
selectedMap[dayNode.key] = true;
|
|
2077
|
+
}
|
|
2078
|
+
else {
|
|
2079
|
+
delete selectedMap[dayNode.key];
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* @param {?} monthNode
|
|
2084
|
+
* @return {?}
|
|
2085
|
+
*/
|
|
2086
|
+
isMonthDisabled(monthNode) {
|
|
2087
|
+
return monthNode.days.every((/**
|
|
2088
|
+
* @param {?} dayNode
|
|
2089
|
+
* @return {?}
|
|
2090
|
+
*/
|
|
2091
|
+
(dayNode) => dayNode.disabled));
|
|
2092
|
+
}
|
|
2093
|
+
/**
|
|
2094
|
+
* @param {?} monthNode
|
|
2095
|
+
* @return {?}
|
|
2096
|
+
*/
|
|
2097
|
+
isMonthChecked(monthNode) {
|
|
2098
|
+
if (this.isMonthDisabled(monthNode)) {
|
|
2099
|
+
return false;
|
|
2100
|
+
}
|
|
2101
|
+
/** @type {?} */
|
|
2102
|
+
const selectedMap = this.getFieldDaySelectionMap(this.field);
|
|
2103
|
+
/** @type {?} */
|
|
2104
|
+
const enabledDays = monthNode.days.filter((/**
|
|
2105
|
+
* @param {?} dayNode
|
|
2106
|
+
* @return {?}
|
|
2107
|
+
*/
|
|
2108
|
+
(dayNode) => !dayNode.disabled));
|
|
2109
|
+
return enabledDays.every((/**
|
|
2110
|
+
* @param {?} dayNode
|
|
2111
|
+
* @return {?}
|
|
2112
|
+
*/
|
|
2113
|
+
(dayNode) => !!selectedMap[dayNode.key]));
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* @param {?} monthNode
|
|
2117
|
+
* @return {?}
|
|
2118
|
+
*/
|
|
2119
|
+
isMonthIndeterminate(monthNode) {
|
|
2120
|
+
if (this.isMonthDisabled(monthNode)) {
|
|
2121
|
+
return false;
|
|
2122
|
+
}
|
|
2123
|
+
/** @type {?} */
|
|
2124
|
+
const selectedMap = this.getFieldDaySelectionMap(this.field);
|
|
2125
|
+
/** @type {?} */
|
|
2126
|
+
const enabledDays = monthNode.days.filter((/**
|
|
2127
|
+
* @param {?} dayNode
|
|
2128
|
+
* @return {?}
|
|
2129
|
+
*/
|
|
2130
|
+
(dayNode) => !dayNode.disabled));
|
|
2131
|
+
/** @type {?} */
|
|
2132
|
+
const selectedCount = enabledDays.filter((/**
|
|
2133
|
+
* @param {?} dayNode
|
|
2134
|
+
* @return {?}
|
|
2135
|
+
*/
|
|
2136
|
+
(dayNode) => {
|
|
2137
|
+
return !!selectedMap[dayNode.key];
|
|
2138
|
+
})).length;
|
|
2139
|
+
return selectedCount > 0 && selectedCount < enabledDays.length;
|
|
2140
|
+
}
|
|
2141
|
+
/**
|
|
2142
|
+
* @param {?} monthNode
|
|
2143
|
+
* @param {?} checked
|
|
2144
|
+
* @return {?}
|
|
2145
|
+
*/
|
|
2146
|
+
toggleMonth(monthNode, checked) {
|
|
2147
|
+
if (this.isMonthDisabled(monthNode)) {
|
|
2148
|
+
return;
|
|
2149
|
+
}
|
|
2150
|
+
/** @type {?} */
|
|
2151
|
+
const selectedMap = this.getFieldDaySelectionMap(this.field);
|
|
2152
|
+
monthNode.days.forEach((/**
|
|
2153
|
+
* @param {?} dayNode
|
|
2154
|
+
* @return {?}
|
|
2155
|
+
*/
|
|
2156
|
+
(dayNode) => {
|
|
2157
|
+
if (dayNode.disabled) {
|
|
2158
|
+
return;
|
|
2159
|
+
}
|
|
2160
|
+
if (checked) {
|
|
2161
|
+
selectedMap[dayNode.key] = true;
|
|
2162
|
+
}
|
|
2163
|
+
else {
|
|
2164
|
+
delete selectedMap[dayNode.key];
|
|
2165
|
+
}
|
|
2166
|
+
}));
|
|
2167
|
+
}
|
|
2168
|
+
/**
|
|
2169
|
+
* @param {?} yearNode
|
|
2170
|
+
* @return {?}
|
|
2171
|
+
*/
|
|
2172
|
+
isYearDisabled(yearNode) {
|
|
2173
|
+
return yearNode.months.every((/**
|
|
2174
|
+
* @param {?} monthNode
|
|
2175
|
+
* @return {?}
|
|
2176
|
+
*/
|
|
2177
|
+
(monthNode) => this.isMonthDisabled(monthNode)));
|
|
2178
|
+
}
|
|
2179
|
+
/**
|
|
2180
|
+
* @param {?} yearNode
|
|
2181
|
+
* @return {?}
|
|
2182
|
+
*/
|
|
2183
|
+
isYearChecked(yearNode) {
|
|
2184
|
+
if (this.isYearDisabled(yearNode)) {
|
|
2185
|
+
return false;
|
|
2186
|
+
}
|
|
2187
|
+
/** @type {?} */
|
|
2188
|
+
const enabledMonths = yearNode.months.filter((/**
|
|
2189
|
+
* @param {?} monthNode
|
|
2190
|
+
* @return {?}
|
|
2191
|
+
*/
|
|
2192
|
+
(monthNode) => !this.isMonthDisabled(monthNode)));
|
|
2193
|
+
return enabledMonths.every((/**
|
|
2194
|
+
* @param {?} monthNode
|
|
2195
|
+
* @return {?}
|
|
2196
|
+
*/
|
|
2197
|
+
(monthNode) => this.isMonthChecked(monthNode)));
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2200
|
+
* @param {?} yearNode
|
|
2201
|
+
* @return {?}
|
|
2202
|
+
*/
|
|
2203
|
+
isYearIndeterminate(yearNode) {
|
|
2204
|
+
if (this.isYearDisabled(yearNode)) {
|
|
2205
|
+
return false;
|
|
2206
|
+
}
|
|
2207
|
+
/** @type {?} */
|
|
2208
|
+
const selectedMap = this.getFieldDaySelectionMap(this.field);
|
|
2209
|
+
/** @type {?} */
|
|
2210
|
+
const enabledDays = [];
|
|
2211
|
+
yearNode.months.forEach((/**
|
|
2212
|
+
* @param {?} monthNode
|
|
2213
|
+
* @return {?}
|
|
2214
|
+
*/
|
|
2215
|
+
(monthNode) => {
|
|
2216
|
+
monthNode.days.forEach((/**
|
|
2217
|
+
* @param {?} dayNode
|
|
2218
|
+
* @return {?}
|
|
2219
|
+
*/
|
|
2220
|
+
(dayNode) => {
|
|
2221
|
+
if (!dayNode.disabled) {
|
|
2222
|
+
enabledDays.push(dayNode.key);
|
|
2223
|
+
}
|
|
2224
|
+
}));
|
|
2225
|
+
}));
|
|
2226
|
+
/** @type {?} */
|
|
2227
|
+
const selectedCount = enabledDays.filter((/**
|
|
2228
|
+
* @param {?} key
|
|
2229
|
+
* @return {?}
|
|
2230
|
+
*/
|
|
2231
|
+
(key) => !!selectedMap[key])).length;
|
|
2232
|
+
return selectedCount > 0 && selectedCount < enabledDays.length;
|
|
2233
|
+
}
|
|
2234
|
+
/**
|
|
2235
|
+
* @param {?} yearNode
|
|
2236
|
+
* @param {?} checked
|
|
2237
|
+
* @return {?}
|
|
2238
|
+
*/
|
|
2239
|
+
toggleYear(yearNode, checked) {
|
|
2240
|
+
if (this.isYearDisabled(yearNode)) {
|
|
2241
|
+
return;
|
|
2242
|
+
}
|
|
2243
|
+
yearNode.months.forEach((/**
|
|
2244
|
+
* @param {?} monthNode
|
|
2245
|
+
* @return {?}
|
|
2246
|
+
*/
|
|
2247
|
+
(monthNode) => {
|
|
2248
|
+
this.toggleMonth(monthNode, checked);
|
|
2249
|
+
}));
|
|
2250
|
+
}
|
|
2251
|
+
/**
|
|
2252
|
+
* @return {?}
|
|
2253
|
+
*/
|
|
2254
|
+
clearSelection() {
|
|
2255
|
+
if (this.field) {
|
|
2256
|
+
this.workingSelectedByField[this.field] = {};
|
|
2257
|
+
}
|
|
2258
|
+
this.apply.emit(this.cloneSelectionMap(this.workingSelectedByField));
|
|
2259
|
+
this.rebuildTree();
|
|
2260
|
+
}
|
|
2261
|
+
/**
|
|
2262
|
+
* @return {?}
|
|
2263
|
+
*/
|
|
2264
|
+
applySelection() {
|
|
2265
|
+
this.apply.emit(this.cloneSelectionMap(this.workingSelectedByField));
|
|
2266
|
+
this.closePopover();
|
|
2267
|
+
}
|
|
2268
|
+
/**
|
|
2269
|
+
* @private
|
|
2270
|
+
* @return {?}
|
|
2271
|
+
*/
|
|
2272
|
+
rebuildTree() {
|
|
2273
|
+
if (!this.field) {
|
|
2274
|
+
this.years = [];
|
|
2275
|
+
return;
|
|
2276
|
+
}
|
|
2277
|
+
/** @type {?} */
|
|
2278
|
+
const sourceRows = this.sourceRows || [];
|
|
2279
|
+
/** @type {?} */
|
|
2280
|
+
const rowsByOtherFilters = this.filterRowsBySelectedDateTree(sourceRows, this.field);
|
|
2281
|
+
/** @type {?} */
|
|
2282
|
+
const availableDayKeyMap = {};
|
|
2283
|
+
rowsByOtherFilters.forEach((/**
|
|
2284
|
+
* @param {?} row
|
|
2285
|
+
* @return {?}
|
|
2286
|
+
*/
|
|
2287
|
+
(row) => {
|
|
2288
|
+
/** @type {?} */
|
|
2289
|
+
const dayKey = this.getDayKeyByRowValue(row[this.field]);
|
|
2290
|
+
if (dayKey) {
|
|
2291
|
+
availableDayKeyMap[dayKey] = true;
|
|
2292
|
+
}
|
|
2293
|
+
}));
|
|
2294
|
+
/** @type {?} */
|
|
2295
|
+
const groupedMap = {};
|
|
2296
|
+
sourceRows.forEach((/**
|
|
2297
|
+
* @param {?} row
|
|
2298
|
+
* @return {?}
|
|
2299
|
+
*/
|
|
2300
|
+
(row) => {
|
|
2301
|
+
/** @type {?} */
|
|
2302
|
+
const date = this.parseDateValue(row[this.field]);
|
|
2303
|
+
if (!date) {
|
|
2304
|
+
return;
|
|
2305
|
+
}
|
|
2306
|
+
/** @type {?} */
|
|
2307
|
+
const year = date.getFullYear();
|
|
2308
|
+
/** @type {?} */
|
|
2309
|
+
const month = date.getMonth() + 1;
|
|
2310
|
+
/** @type {?} */
|
|
2311
|
+
const day = date.getDate();
|
|
2312
|
+
if (!groupedMap[year]) {
|
|
2313
|
+
groupedMap[year] = {};
|
|
2314
|
+
}
|
|
2315
|
+
if (!groupedMap[year][month]) {
|
|
2316
|
+
groupedMap[year][month] = {};
|
|
2317
|
+
}
|
|
2318
|
+
if (!groupedMap[year][month][day]) {
|
|
2319
|
+
groupedMap[year][month][day] = 0;
|
|
2320
|
+
}
|
|
2321
|
+
groupedMap[year][month][day] += 1;
|
|
2322
|
+
}));
|
|
2323
|
+
/** @type {?} */
|
|
2324
|
+
const expandState = this.getOrCreateExpandState(this.field);
|
|
2325
|
+
this.years = Object.keys(groupedMap)
|
|
2326
|
+
.map((/**
|
|
2327
|
+
* @param {?} key
|
|
2328
|
+
* @return {?}
|
|
2329
|
+
*/
|
|
2330
|
+
(key) => Number(key)))
|
|
2331
|
+
.sort((/**
|
|
2332
|
+
* @param {?} a
|
|
2333
|
+
* @param {?} b
|
|
2334
|
+
* @return {?}
|
|
2335
|
+
*/
|
|
2336
|
+
(a, b) => b - a))
|
|
2337
|
+
.map((/**
|
|
2338
|
+
* @param {?} year
|
|
2339
|
+
* @return {?}
|
|
2340
|
+
*/
|
|
2341
|
+
(year) => {
|
|
2342
|
+
/** @type {?} */
|
|
2343
|
+
const months = Object.keys(groupedMap[year])
|
|
2344
|
+
.map((/**
|
|
2345
|
+
* @param {?} key
|
|
2346
|
+
* @return {?}
|
|
2347
|
+
*/
|
|
2348
|
+
(key) => Number(key)))
|
|
2349
|
+
.sort((/**
|
|
2350
|
+
* @param {?} a
|
|
2351
|
+
* @param {?} b
|
|
2352
|
+
* @return {?}
|
|
2353
|
+
*/
|
|
2354
|
+
(a, b) => a - b))
|
|
2355
|
+
.map((/**
|
|
2356
|
+
* @param {?} month
|
|
2357
|
+
* @return {?}
|
|
2358
|
+
*/
|
|
2359
|
+
(month) => {
|
|
2360
|
+
/** @type {?} */
|
|
2361
|
+
const monthKey = year + "-" + this.pad2(month);
|
|
2362
|
+
if (expandState.months[monthKey] === undefined) {
|
|
2363
|
+
expandState.months[monthKey] = true;
|
|
2364
|
+
}
|
|
2365
|
+
/** @type {?} */
|
|
2366
|
+
const days = Object.keys(groupedMap[year][month])
|
|
2367
|
+
.map((/**
|
|
2368
|
+
* @param {?} key
|
|
2369
|
+
* @return {?}
|
|
2370
|
+
*/
|
|
2371
|
+
(key) => Number(key)))
|
|
2372
|
+
.sort((/**
|
|
2373
|
+
* @param {?} a
|
|
2374
|
+
* @param {?} b
|
|
2375
|
+
* @return {?}
|
|
2376
|
+
*/
|
|
2377
|
+
(a, b) => a - b))
|
|
2378
|
+
.map((/**
|
|
2379
|
+
* @param {?} day
|
|
2380
|
+
* @return {?}
|
|
2381
|
+
*/
|
|
2382
|
+
(day) => {
|
|
2383
|
+
/** @type {?} */
|
|
2384
|
+
const dayKey = this.toDayKey(year, month, day);
|
|
2385
|
+
/** @type {?} */
|
|
2386
|
+
const dayDate = new Date(year, month - 1, day);
|
|
2387
|
+
return {
|
|
2388
|
+
key: dayKey,
|
|
2389
|
+
day: day,
|
|
2390
|
+
label: moment(dayDate).format("D MMM YYYY"),
|
|
2391
|
+
count: groupedMap[year][month][day],
|
|
2392
|
+
disabled: !availableDayKeyMap[dayKey],
|
|
2393
|
+
};
|
|
2394
|
+
}));
|
|
2395
|
+
return {
|
|
2396
|
+
key: monthKey,
|
|
2397
|
+
month: month,
|
|
2398
|
+
label: moment()
|
|
2399
|
+
.month(month - 1)
|
|
2400
|
+
.format("MMM"),
|
|
2401
|
+
expanded: !!expandState.months[monthKey],
|
|
2402
|
+
days: days,
|
|
2403
|
+
};
|
|
2404
|
+
}));
|
|
2405
|
+
/** @type {?} */
|
|
2406
|
+
const yearKey = String(year);
|
|
2407
|
+
if (expandState.years[yearKey] === undefined) {
|
|
2408
|
+
expandState.years[yearKey] = true;
|
|
2409
|
+
}
|
|
2410
|
+
return {
|
|
2411
|
+
key: yearKey,
|
|
2412
|
+
year: year,
|
|
2413
|
+
expanded: !!expandState.years[yearKey],
|
|
2414
|
+
months: months,
|
|
2415
|
+
};
|
|
2416
|
+
}));
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* @private
|
|
2420
|
+
* @param {?} rows
|
|
2421
|
+
* @param {?=} excludeField
|
|
2422
|
+
* @return {?}
|
|
2423
|
+
*/
|
|
2424
|
+
filterRowsBySelectedDateTree(rows, excludeField) {
|
|
2425
|
+
/** @type {?} */
|
|
2426
|
+
let filteredRows = rows ? rows.slice() : [];
|
|
2427
|
+
(this.dateFields || []).forEach((/**
|
|
2428
|
+
* @param {?} field
|
|
2429
|
+
* @return {?}
|
|
2430
|
+
*/
|
|
2431
|
+
(field) => {
|
|
2432
|
+
if (excludeField && field === excludeField) {
|
|
2433
|
+
return;
|
|
2434
|
+
}
|
|
2435
|
+
/** @type {?} */
|
|
2436
|
+
const selectedMap = this.getFieldDaySelectionMap(field);
|
|
2437
|
+
/** @type {?} */
|
|
2438
|
+
const selectedKeys = Object.keys(selectedMap);
|
|
2439
|
+
if (!selectedKeys.length) {
|
|
2440
|
+
return;
|
|
2441
|
+
}
|
|
2442
|
+
filteredRows = filteredRows.filter((/**
|
|
2443
|
+
* @param {?} row
|
|
2444
|
+
* @return {?}
|
|
2445
|
+
*/
|
|
2446
|
+
(row) => {
|
|
2447
|
+
/** @type {?} */
|
|
2448
|
+
const dayKey = this.getDayKeyByRowValue(row[field]);
|
|
2449
|
+
return dayKey ? !!selectedMap[dayKey] : false;
|
|
2450
|
+
}));
|
|
2451
|
+
}));
|
|
2452
|
+
return filteredRows;
|
|
2453
|
+
}
|
|
2454
|
+
/**
|
|
2455
|
+
* @private
|
|
2456
|
+
* @param {?} value
|
|
2457
|
+
* @return {?}
|
|
2458
|
+
*/
|
|
2459
|
+
parseDateValue(value) {
|
|
2460
|
+
if (!value) {
|
|
2461
|
+
return null;
|
|
2462
|
+
}
|
|
2463
|
+
if (value instanceof Date) {
|
|
2464
|
+
return value;
|
|
2465
|
+
}
|
|
2466
|
+
/** @type {?} */
|
|
2467
|
+
const parsed = moment(value, [
|
|
2468
|
+
"YYYY-MM-DD",
|
|
2469
|
+
"MM/DD/YYYY",
|
|
2470
|
+
"DD/MM/YYYY",
|
|
2471
|
+
"YYYY/MM/DD",
|
|
2472
|
+
"DD-MMM-YYYY",
|
|
2473
|
+
"MMM DD, YYYY",
|
|
2474
|
+
moment.ISO_8601,
|
|
2475
|
+
], true);
|
|
2476
|
+
if (parsed.isValid()) {
|
|
2477
|
+
return parsed.toDate();
|
|
2478
|
+
}
|
|
2479
|
+
/** @type {?} */
|
|
2480
|
+
const fallback = new Date(value);
|
|
2481
|
+
return isNaN(fallback.getTime()) ? null : fallback;
|
|
2482
|
+
}
|
|
2483
|
+
/**
|
|
2484
|
+
* @private
|
|
2485
|
+
* @param {?} field
|
|
2486
|
+
* @return {?}
|
|
2487
|
+
*/
|
|
2488
|
+
getOrCreateExpandState(field) {
|
|
2489
|
+
if (!this.expandStateByField[field]) {
|
|
2490
|
+
this.expandStateByField[field] = { years: {}, months: {} };
|
|
2491
|
+
}
|
|
2492
|
+
return this.expandStateByField[field];
|
|
2493
|
+
}
|
|
2494
|
+
/**
|
|
2495
|
+
* @private
|
|
2496
|
+
* @param {?} field
|
|
2497
|
+
* @return {?}
|
|
2498
|
+
*/
|
|
2499
|
+
getFieldDaySelectionMap(field) {
|
|
2500
|
+
if (!this.workingSelectedByField[field]) {
|
|
2501
|
+
this.workingSelectedByField[field] = {};
|
|
2502
|
+
}
|
|
2503
|
+
return this.workingSelectedByField[field];
|
|
2504
|
+
}
|
|
2505
|
+
/**
|
|
2506
|
+
* @private
|
|
2507
|
+
* @param {?} year
|
|
2508
|
+
* @param {?} month
|
|
2509
|
+
* @param {?} day
|
|
2510
|
+
* @return {?}
|
|
2511
|
+
*/
|
|
2512
|
+
toDayKey(year, month, day) {
|
|
2513
|
+
return year + "-" + this.pad2(month) + "-" + this.pad2(day);
|
|
2514
|
+
}
|
|
2515
|
+
/**
|
|
2516
|
+
* @private
|
|
2517
|
+
* @param {?} value
|
|
2518
|
+
* @return {?}
|
|
2519
|
+
*/
|
|
2520
|
+
pad2(value) {
|
|
2521
|
+
return value < 10 ? "0" + value : String(value);
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* @private
|
|
2525
|
+
* @param {?} value
|
|
2526
|
+
* @return {?}
|
|
2527
|
+
*/
|
|
2528
|
+
getDayKeyByRowValue(value) {
|
|
2529
|
+
/** @type {?} */
|
|
2530
|
+
const date = this.parseDateValue(value);
|
|
2531
|
+
if (!date) {
|
|
2532
|
+
return "";
|
|
2533
|
+
}
|
|
2534
|
+
return this.toDayKey(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
2535
|
+
}
|
|
2536
|
+
/**
|
|
2537
|
+
* @private
|
|
2538
|
+
* @return {?}
|
|
2539
|
+
*/
|
|
2540
|
+
getEnabledDayKeysInCurrentField() {
|
|
2541
|
+
/** @type {?} */
|
|
2542
|
+
const keys = [];
|
|
2543
|
+
this.years.forEach((/**
|
|
2544
|
+
* @param {?} yearNode
|
|
2545
|
+
* @return {?}
|
|
2546
|
+
*/
|
|
2547
|
+
(yearNode) => {
|
|
2548
|
+
yearNode.months.forEach((/**
|
|
2549
|
+
* @param {?} monthNode
|
|
2550
|
+
* @return {?}
|
|
2551
|
+
*/
|
|
2552
|
+
(monthNode) => {
|
|
2553
|
+
monthNode.days.forEach((/**
|
|
2554
|
+
* @param {?} dayNode
|
|
2555
|
+
* @return {?}
|
|
2556
|
+
*/
|
|
2557
|
+
(dayNode) => {
|
|
2558
|
+
if (!dayNode.disabled) {
|
|
2559
|
+
keys.push(dayNode.key);
|
|
2560
|
+
}
|
|
2561
|
+
}));
|
|
2562
|
+
}));
|
|
2563
|
+
}));
|
|
2564
|
+
return keys;
|
|
2565
|
+
}
|
|
2566
|
+
/**
|
|
2567
|
+
* @private
|
|
2568
|
+
* @param {?} source
|
|
2569
|
+
* @return {?}
|
|
2570
|
+
*/
|
|
2571
|
+
cloneSelectionMap(source) {
|
|
2572
|
+
try {
|
|
2573
|
+
return source ? JSON.parse(JSON.stringify(source)) : {};
|
|
2574
|
+
}
|
|
2575
|
+
catch (e) {
|
|
2576
|
+
return {};
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
DateTreeFilterPopoverComponent.decorators = [
|
|
2581
|
+
{ type: Component, args: [{
|
|
2582
|
+
selector: "rs-date-tree-filter-popover",
|
|
2583
|
+
template: "<div class=\"date-tree-filter-popover\">\r\n <div class=\"popover-search\">\r\n <span class=\"search-icon\"><img src=\"/assets/img/search.svg\" alt=\"\" /></span>\r\n <input\r\n type=\"text\"\r\n [placeholder]=\"translation.SEARCH || '.SEARCH'\"\r\n [value]=\"keyword\"\r\n (input)=\"onKeywordChange($event.target.value)\"\r\n />\r\n </div>\r\n\r\n <div class=\"popover-tree\">\r\n <label class=\"tree-row all-row\">\r\n <input\r\n type=\"checkbox\"\r\n [checked]=\"isAllChecked()\"\r\n [indeterminate]=\"isAllIndeterminate()\"\r\n (change)=\"toggleAllDays($event.target.checked)\"\r\n />\r\n <span class=\"row-label\">{{ translation.ALL || '.ALL' }}</span>\r\n </label>\r\n\r\n <div class=\"year-block\" *ngFor=\"let yearNode of getVisibleYears()\">\r\n <div class=\"tree-row\">\r\n <button\r\n type=\"button\"\r\n class=\"tree-toggle-btn\"\r\n (click)=\"toggleYearExpanded(yearNode); $event.stopPropagation()\"\r\n >\r\n <span class=\"tree-arrow\" [ngClass]=\"{ expanded: yearNode.expanded }\"></span>\r\n </button>\r\n <input\r\n type=\"checkbox\"\r\n [disabled]=\"isYearDisabled(yearNode)\"\r\n [checked]=\"isYearChecked(yearNode)\"\r\n [indeterminate]=\"isYearIndeterminate(yearNode)\"\r\n (change)=\"toggleYear(yearNode, $event.target.checked)\"\r\n />\r\n <span class=\"row-label\">{{ yearNode.year }}</span>\r\n </div>\r\n\r\n <div class=\"month-block\" *ngIf=\"yearNode.expanded\">\r\n <div class=\"month-item\" *ngFor=\"let monthNode of yearNode.months\">\r\n <div class=\"tree-row\">\r\n <button\r\n type=\"button\"\r\n class=\"tree-toggle-btn\"\r\n (click)=\"toggleMonthExpanded(monthNode); $event.stopPropagation()\"\r\n >\r\n <span class=\"tree-arrow\" [ngClass]=\"{ expanded: monthNode.expanded }\"></span>\r\n </button>\r\n <input\r\n type=\"checkbox\"\r\n [disabled]=\"isMonthDisabled(monthNode)\"\r\n [checked]=\"isMonthChecked(monthNode)\"\r\n [indeterminate]=\"isMonthIndeterminate(monthNode)\"\r\n (change)=\"toggleMonth(monthNode, $event.target.checked)\"\r\n />\r\n <span class=\"row-label\">{{ monthNode.label }}</span>\r\n </div>\r\n\r\n <div class=\"day-block\" *ngIf=\"monthNode.expanded\">\r\n <label\r\n class=\"tree-row day-row\"\r\n *ngFor=\"let dayNode of monthNode.days\"\r\n [ngClass]=\"{ disabled: dayNode.disabled }\"\r\n >\r\n <span class=\"tree-toggle-spacer\"></span>\r\n <input\r\n type=\"checkbox\"\r\n [disabled]=\"dayNode.disabled\"\r\n [checked]=\"isDayChecked(dayNode)\"\r\n (change)=\"toggleDay(dayNode, $event.target.checked)\"\r\n />\r\n <span class=\"row-label\">{{ dayNode.label }}</span>\r\n </label>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"popover-footer\">\r\n <button type=\"button\" (click)=\"clearSelection()\">\r\n {{ translation.CLEAR || '.CLEAR' }}\r\n </button>\r\n <button type=\"button\" class=\"primary-btn\" (click)=\"applySelection()\">\r\n {{ translation.APPLY || '.APPLY' }}\r\n </button>\r\n </div>\r\n</div>\r\n",
|
|
2584
|
+
styles: [":host{position:fixed;left:12px;top:12px;z-index:20;width:300px}.date-tree-filter-popover{background:#fff;border:1px solid #eaedf0;border-radius:10px;box-shadow:0 0 4px rgba(0,0,0,.25);padding:4px 8px;display:flex;flex-direction:column;color:#44566c;font-family:Arial}.popover-search{position:relative;padding:4px 0 8px}.popover-search .search-icon{position:absolute;left:10px;top:10px;color:#929dab;font-size:12px;line-height:12px}.popover-search input{width:100%;height:28px;border:1px solid #eaedf0;border-radius:16px;padding:0 10px 0 28px;outline:0;font-size:12px;color:#44566c}.popover-tree{max-height:320px;overflow:auto;padding-right:2px}.tree-row{display:flex;align-items:center;min-height:24px;font-size:11px;line-height:14px;color:#44566c}.tree-row input[type=checkbox]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:14px;height:14px;margin:0 6px 0 0;box-sizing:border-box;border:1px solid #d8d8d8;border-radius:3px;background-color:#fff;cursor:pointer;vertical-align:middle;flex-shrink:0}.tree-row input[type=checkbox]:checked{border-color:#1f7bff;background-color:#1f7bff;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 9 9' fill='none'%3E%3Cpath d='M0.5 4.31818L3 7.5L5.75 4L8.5 0.5' stroke='white' stroke-linecap='round'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:center;background-size:9px 9px}.tree-row input[type=checkbox]:indeterminate{border-color:#1f7bff;background-color:#1f7bff;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 9 9' fill='none'%3E%3Cpath d='M1.5 4.5H7.5' stroke='white' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:center;background-size:9px 9px}.tree-row input[type=checkbox]:disabled{cursor:not-allowed;opacity:.5}.all-row{padding-left:20px;margin-bottom:2px}.year-block{margin-bottom:2px}.month-block{padding-left:20px}.day-block{padding-left:24px}.tree-toggle-btn{width:16px;height:16px;padding:0;margin-right:4px;border:none;background:0 0;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.tree-arrow{display:inline-block;width:6px;height:6px;border-right:1px solid #6c7c90;border-bottom:1px solid #6c7c90;transform:rotate(-45deg);transition:transform .15s}.tree-arrow.expanded{transform:rotate(45deg)}.tree-toggle-spacer{width:20px;display:inline-block}.row-label{color:#44566c}.day-row.disabled .row-label{color:#adb5bd}.popover-footer{margin-top:8px;padding:12px 0 8px;border-top:1px solid #eaedf0;display:flex;justify-content:flex-end;gap:12px}.popover-footer button{min-width:56px;height:26px;padding:0 8px;border-radius:4px;border:1px solid #dbe1e7;background:#fff;font-size:11px;color:#44566c;cursor:pointer}.popover-footer .primary-btn{background:#1364b3;border-color:#1364b3;color:#fff}"]
|
|
2585
|
+
}] }
|
|
2586
|
+
];
|
|
2587
|
+
DateTreeFilterPopoverComponent.propDecorators = {
|
|
2588
|
+
field: [{ type: Input }],
|
|
2589
|
+
translation: [{ type: Input }],
|
|
2590
|
+
sourceRows: [{ type: Input }],
|
|
2591
|
+
dateFields: [{ type: Input }],
|
|
2592
|
+
selectedByField: [{ type: Input }],
|
|
2593
|
+
fieldLabelMap: [{ type: Input }],
|
|
2594
|
+
apply: [{ type: Output }],
|
|
2595
|
+
close: [{ type: Output }]
|
|
2596
|
+
};
|
|
2597
|
+
if (false) {
|
|
2598
|
+
/** @type {?} */
|
|
2599
|
+
DateTreeFilterPopoverComponent.prototype.field;
|
|
2600
|
+
/** @type {?} */
|
|
2601
|
+
DateTreeFilterPopoverComponent.prototype.translation;
|
|
2602
|
+
/** @type {?} */
|
|
2603
|
+
DateTreeFilterPopoverComponent.prototype.sourceRows;
|
|
2604
|
+
/** @type {?} */
|
|
2605
|
+
DateTreeFilterPopoverComponent.prototype.dateFields;
|
|
2606
|
+
/** @type {?} */
|
|
2607
|
+
DateTreeFilterPopoverComponent.prototype.selectedByField;
|
|
2608
|
+
/** @type {?} */
|
|
2609
|
+
DateTreeFilterPopoverComponent.prototype.fieldLabelMap;
|
|
2610
|
+
/** @type {?} */
|
|
2611
|
+
DateTreeFilterPopoverComponent.prototype.apply;
|
|
2612
|
+
/** @type {?} */
|
|
2613
|
+
DateTreeFilterPopoverComponent.prototype.close;
|
|
2614
|
+
/** @type {?} */
|
|
2615
|
+
DateTreeFilterPopoverComponent.prototype.keyword;
|
|
2616
|
+
/** @type {?} */
|
|
2617
|
+
DateTreeFilterPopoverComponent.prototype.years;
|
|
2618
|
+
/**
|
|
2619
|
+
* @type {?}
|
|
2620
|
+
* @private
|
|
2621
|
+
*/
|
|
2622
|
+
DateTreeFilterPopoverComponent.prototype.expandStateByField;
|
|
2623
|
+
/**
|
|
2624
|
+
* @type {?}
|
|
2625
|
+
* @private
|
|
2626
|
+
*/
|
|
2627
|
+
DateTreeFilterPopoverComponent.prototype.workingSelectedByField;
|
|
2628
|
+
}
|
|
2629
|
+
|
|
992
2630
|
/**
|
|
993
2631
|
* @fileoverview added by tsickle
|
|
994
2632
|
* Generated from: lib/float-box/index.component.ts
|
|
@@ -49370,6 +51008,7 @@ RaiseCommonLibModule.decorators = [
|
|
|
49370
51008
|
CommonGridComponent,
|
|
49371
51009
|
GridActionComponent,
|
|
49372
51010
|
GridActionItemComponent,
|
|
51011
|
+
DateTreeFilterPopoverComponent,
|
|
49373
51012
|
FloatBoxComponent,
|
|
49374
51013
|
RsPageListComponent,
|
|
49375
51014
|
RsPageTabComponent,
|
|
@@ -49556,6 +51195,7 @@ RaiseCommonLibModule.decorators = [
|
|
|
49556
51195
|
CommonGridComponent,
|
|
49557
51196
|
GridActionComponent,
|
|
49558
51197
|
GridActionItemComponent,
|
|
51198
|
+
DateTreeFilterPopoverComponent,
|
|
49559
51199
|
FloatBoxComponent,
|
|
49560
51200
|
RsPageListComponent,
|
|
49561
51201
|
RsPageTabComponent,
|
|
@@ -49620,5 +51260,5 @@ RaiseCommonLibModule.decorators = [
|
|
|
49620
51260
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
49621
51261
|
*/
|
|
49622
51262
|
|
|
49623
|
-
export { API_SERVICE_TOKEN, CheckboxGroupComponent, CommonDialogComponent, CommonFunctionService, CommonGridComponent, DefaultDrawerConfig, DialogService, DrawerComponent, DrawerFormComponent, DrawerService, EmailPattern, EncryptedInputComponent, FloatBoxComponent, GridActionComponent, GridActionItemComponent, GridBoxComponent, IconLoaderService, KeepAliveService, MainContainerComponent, MessageType, MultiTabComponent, PBF_TOKEN, PaneGroupNewComponent, ROLE_SERVICE_TOKEN, RSAsideComponent, RSFooterComponent, RSHeaderComponent, RSNavCardGroupComponent, RSStepperComponent, RSToolbarComponent, RadioGroupComponent, RaiseCommonLibModule, RsCommentaryComponent, RsPageListComponent, RsPageTabComponent, SearchInputComponent, SmartPopupComponent, StaticResourceService, SwitchInputComponent, TagInputComponent, ToolbarItemComponent, TranslationService, TruncatedTextToggleComponent, filterShowSection, Debounce as ɵa, DashboardService as ɵb, ApiList as ɵc, DashboardPorletsService as ɵd, debounce as ɵe, RichtexteditorComponent as ɵf, ConfirmSelectComponent as ɵg, NewActionNotificationComponent as ɵh, CommonDeleteComponent as ɵi, SidebarIconlistNewComponent as ɵj, EmptyIconPromptComponent as ɵk, GadgetTableComponent as ɵl, GadgetPivotComponent as ɵm, GadgetPivotChartComponent as ɵn, GadgetTransposeComponent as ɵo, PortletTypeNewComponent as ɵp, FieldFilterComponent as ɵq, FieldFormatComponent as ɵr, DataMartNewComponent as ɵs, BarChartsComponent as ɵt, PaneDownloadComponent as ɵu };
|
|
51263
|
+
export { API_SERVICE_TOKEN, CheckboxGroupComponent, CommonDialogComponent, CommonFunctionService, CommonGridComponent, DATE_TREE_DEFAULT_DATE_FORMATS, DateTreeFilterHelper, DateTreeFilterPopoverComponent, DefaultDrawerConfig, DialogService, DrawerComponent, DrawerFormComponent, DrawerService, EmailPattern, EncryptedInputComponent, FloatBoxComponent, GridActionComponent, GridActionItemComponent, GridBoxComponent, IconLoaderService, KeepAliveService, MainContainerComponent, MessageType, MultiTabComponent, PBF_TOKEN, PaneGroupNewComponent, ROLE_SERVICE_TOKEN, RSAsideComponent, RSFooterComponent, RSHeaderComponent, RSNavCardGroupComponent, RSStepperComponent, RSToolbarComponent, RadioGroupComponent, RaiseCommonLibModule, RsCommentaryComponent, RsPageListComponent, RsPageTabComponent, SearchInputComponent, SmartPopupComponent, StaticResourceService, SwitchInputComponent, TagInputComponent, ToolbarItemComponent, TranslationService, TruncatedTextToggleComponent, createRsCommonGridDateTreeHelper, filterShowSection, Debounce as ɵa, DashboardService as ɵb, ApiList as ɵc, DashboardPorletsService as ɵd, debounce as ɵe, RichtexteditorComponent as ɵf, ConfirmSelectComponent as ɵg, NewActionNotificationComponent as ɵh, CommonDeleteComponent as ɵi, SidebarIconlistNewComponent as ɵj, EmptyIconPromptComponent as ɵk, GadgetTableComponent as ɵl, GadgetPivotComponent as ɵm, GadgetPivotChartComponent as ɵn, GadgetTransposeComponent as ɵo, PortletTypeNewComponent as ɵp, FieldFilterComponent as ɵq, FieldFormatComponent as ɵr, DataMartNewComponent as ɵs, BarChartsComponent as ɵt, PaneDownloadComponent as ɵu };
|
|
49624
51264
|
//# sourceMappingURL=raise-common-lib.js.map
|