@acorex/components 7.9.0 → 7.10.0
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/common/lib/classes/datalist.class.d.ts +21 -0
- package/common/lib/classes/datasource.class.d.ts +31 -14
- package/data-table/index.d.ts +1 -0
- package/data-table/lib/data-table.component.d.ts +2 -2
- package/data-table/lib/data-table.module.d.ts +9 -7
- package/data-table/lib/data-table2.component.d.ts +37 -0
- package/drawer/lib/drawer.component.d.ts +2 -1
- package/esm2022/common/lib/classes/datalist.class.mjs +44 -2
- package/esm2022/common/lib/classes/datasource.class.mjs +18 -11
- package/esm2022/data-table/index.mjs +2 -1
- package/esm2022/data-table/lib/data-table.component.mjs +3 -4
- package/esm2022/data-table/lib/data-table.module.mjs +6 -4
- package/esm2022/data-table/lib/data-table2.component.mjs +118 -0
- package/esm2022/drawer/lib/drawer-container.component.mjs +1 -1
- package/esm2022/drawer/lib/drawer.component.mjs +8 -8
- package/esm2022/list/lib/list.component.mjs +5 -48
- package/esm2022/popup/lib/popup.interface.mjs +1 -1
- package/esm2022/popup/lib/popup.service.mjs +3 -1
- package/esm2022/progress-bar/lib/progress-bar.component.mjs +50 -5
- package/esm2022/select-box/lib/select-box.component.mjs +4 -5
- package/esm2022/selection-list/lib/selection-list.component.mjs +16 -4
- package/esm2022/uploader/lib/uploader-list.component.mjs +2 -2
- package/fesm2022/acorex-components-common.mjs +62 -12
- package/fesm2022/acorex-components-common.mjs.map +1 -1
- package/fesm2022/acorex-components-data-table.mjs +119 -9
- package/fesm2022/acorex-components-data-table.mjs.map +1 -1
- package/fesm2022/acorex-components-drawer.mjs +7 -7
- package/fesm2022/acorex-components-drawer.mjs.map +1 -1
- package/fesm2022/acorex-components-list.mjs +5 -48
- package/fesm2022/acorex-components-list.mjs.map +1 -1
- package/fesm2022/acorex-components-popup.mjs +2 -0
- package/fesm2022/acorex-components-popup.mjs.map +1 -1
- package/fesm2022/acorex-components-progress-bar.mjs +49 -4
- package/fesm2022/acorex-components-progress-bar.mjs.map +1 -1
- package/fesm2022/acorex-components-select-box.mjs +3 -4
- package/fesm2022/acorex-components-select-box.mjs.map +1 -1
- package/fesm2022/acorex-components-selection-list.mjs +15 -3
- package/fesm2022/acorex-components-selection-list.mjs.map +1 -1
- package/fesm2022/acorex-components-uploader.mjs +1 -1
- package/fesm2022/acorex-components-uploader.mjs.map +1 -1
- package/list/lib/list.component.d.ts +2 -22
- package/package.json +1 -1
- package/popup/lib/popup.interface.d.ts +3 -1
- package/progress-bar/lib/progress-bar.component.d.ts +12 -2
- package/select-box/lib/select-box.component.d.ts +4 -4
- package/selection-list/lib/selection-list.component.d.ts +4 -1
@@ -1,7 +1,8 @@
|
|
1
1
|
import { flatten, clone, filter, isEqual } from 'lodash-es';
|
2
2
|
import * as i0 from '@angular/core';
|
3
3
|
import { Injectable, Directive, Host, Self, Optional, Input, Inject, NgModule, inject, ChangeDetectorRef, ElementRef, ViewContainerRef, EventEmitter, Output } from '@angular/core';
|
4
|
-
import {
|
4
|
+
import { DataSource } from '@angular/cdk/collections';
|
5
|
+
import { Subscription, BehaviorSubject, debounceTime, distinctUntilChanged, Subject, fromEvent, noop, skip } from 'rxjs';
|
5
6
|
import { DOCUMENT } from '@angular/common';
|
6
7
|
import * as i1 from '@angular/platform-browser';
|
7
8
|
import { Observable } from 'rxjs/internal/Observable';
|
@@ -327,7 +328,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImpor
|
|
327
328
|
type: Injectable
|
328
329
|
}] });
|
329
330
|
|
330
|
-
class
|
331
|
+
class AXListDataSource extends DataSource {
|
332
|
+
/**
|
333
|
+
* @ignore
|
334
|
+
*/
|
335
|
+
constructor(config) {
|
336
|
+
super();
|
337
|
+
this.config = config;
|
338
|
+
this.debounceTime = 0;
|
339
|
+
this.subscription = new Subscription();
|
340
|
+
this.source = config.source;
|
341
|
+
if (config.debounceTime)
|
342
|
+
this.debounceTime = config.debounceTime;
|
343
|
+
//
|
344
|
+
this.dataStream = new BehaviorSubject(this.config.source.cachedItems);
|
345
|
+
this.source.onChanged.subscribe((data) => {
|
346
|
+
this.dataStream.next(data.cachedItems);
|
347
|
+
});
|
348
|
+
}
|
349
|
+
connect(collectionViewer) {
|
350
|
+
this.subscription.add(collectionViewer.viewChange
|
351
|
+
.pipe(debounceTime(this.debounceTime))
|
352
|
+
.pipe(distinctUntilChanged())
|
353
|
+
.subscribe((range) => {
|
354
|
+
const startPage = this.getPageForIndex(range.start);
|
355
|
+
const endPage = this.getPageForIndex(range.end - 1);
|
356
|
+
for (let i = startPage; i <= endPage; i++) {
|
357
|
+
this.source.setPage(i);
|
358
|
+
}
|
359
|
+
}));
|
360
|
+
return this.dataStream;
|
361
|
+
}
|
362
|
+
disconnect() {
|
363
|
+
this.subscription.unsubscribe();
|
364
|
+
}
|
365
|
+
getPageForIndex(index) {
|
366
|
+
return Math.floor(index / this.source.config.pageSize);
|
367
|
+
}
|
368
|
+
refresh() {
|
369
|
+
this.source.refresh();
|
370
|
+
}
|
371
|
+
}
|
372
|
+
|
373
|
+
class AXDataSource {
|
331
374
|
get totalCount() {
|
332
375
|
return this._totalCount;
|
333
376
|
}
|
@@ -396,13 +439,18 @@ class AXDateSource {
|
|
396
439
|
this.load();
|
397
440
|
}
|
398
441
|
}
|
399
|
-
filter(
|
400
|
-
this.
|
401
|
-
|
402
|
-
|
442
|
+
filter(value) {
|
443
|
+
this._query.filter = value;
|
444
|
+
}
|
445
|
+
sort(...value) {
|
446
|
+
this._query.sort = value;
|
447
|
+
}
|
448
|
+
clearFilter() {
|
449
|
+
this._query.filter = null;
|
403
450
|
}
|
404
451
|
reset() {
|
405
|
-
this._query.
|
452
|
+
this._query.filter = null;
|
453
|
+
this._query.sort = null;
|
406
454
|
this._query.skip = 0;
|
407
455
|
this._cachedItems = new Array(this.config.pageSize);
|
408
456
|
this.fetchedPages.clear();
|
@@ -410,9 +458,11 @@ class AXDateSource {
|
|
410
458
|
this._totalCount = 0;
|
411
459
|
}
|
412
460
|
refresh() {
|
413
|
-
const
|
461
|
+
const currentFilter = this._query.filter;
|
462
|
+
const currentSort = this._query.sort;
|
414
463
|
this.reset();
|
415
|
-
this._query.
|
464
|
+
this._query.filter = currentFilter;
|
465
|
+
this._query.sort = currentSort;
|
416
466
|
this.load();
|
417
467
|
}
|
418
468
|
find(key) {
|
@@ -427,7 +477,7 @@ function convertArrayToDataSource(items, options = { key: 'id', pageSize: 20 })
|
|
427
477
|
key: options.key,
|
428
478
|
pageSize: options.pageSize,
|
429
479
|
load: (e) => {
|
430
|
-
const result = e.
|
480
|
+
const result = e.filter ? filter(items, e.filter) : items;
|
431
481
|
return Promise.resolve({
|
432
482
|
items: result.slice(e.skip, e.skip + e.take),
|
433
483
|
total: result.length,
|
@@ -435,7 +485,7 @@ function convertArrayToDataSource(items, options = { key: 'id', pageSize: 20 })
|
|
435
485
|
},
|
436
486
|
byKey: (v) => Promise.resolve(items.find((c) => c[options.key] == v)),
|
437
487
|
};
|
438
|
-
return new
|
488
|
+
return new AXDataSource(config);
|
439
489
|
}
|
440
490
|
|
441
491
|
const AX_STYLE_COLOR_TYPES = ['primary', 'secondary', 'success', 'warning', 'danger', 'info', 'ghost'];
|
@@ -1595,5 +1645,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.6", ngImpor
|
|
1595
1645
|
* Generated bundle index. Do not edit.
|
1596
1646
|
*/
|
1597
1647
|
|
1598
|
-
export { AXAutoFocusDirective, AXButtonClickEvent, AXClearableComponent, AXClickEvent, AXClosbaleComponent, AXCommonModule, AXComponent, AXComponentCloseEvent, AXComponentClosedPromise, AXComponentClosing, AXComponentResult,
|
1648
|
+
export { AXAutoFocusDirective, AXButtonClickEvent, AXClearableComponent, AXClickEvent, AXClosbaleComponent, AXCommonModule, AXComponent, AXComponentCloseEvent, AXComponentClosedPromise, AXComponentClosing, AXComponentResult, AXDataSource, AXDomService, AXEvent, AXFocusEvent, AXFocusableComponent, AXHotkeyDirective, AXHotkeysService, AXHtmlEvent, AXInfiniteScrollerDirective, AXItemClickEvent, AXListDataSource, AXNgModelDelayedValueChangedDirective, AXOptionChangedEvent, AXPagedComponent, AXRangeChangedEvent, AXResponsiveDirective, AXRippleDirective, AXSearchableComponent, AXSelectionValueChangedEvent, AXValuableComponent, AXValueChangedEvent, AX_LOCATIONS, AX_PLACEMENT_BOTTOM, AX_PLACEMENT_BOTTOM_END, AX_PLACEMENT_BOTTOM_START, AX_PLACEMENT_END, AX_PLACEMENT_END_BOTTOM, AX_PLACEMENT_END_TOP, AX_PLACEMENT_MAP, AX_PLACEMENT_START, AX_PLACEMENT_START_BOTTOM, AX_PLACEMENT_START_TOP, AX_PLACEMENT_TOP, AX_PLACEMENT_TOP_END, AX_PLACEMENT_TOP_START, AX_STYLE_COLOR_TYPES, MXBaseComponent, MXButtonBaseComponent, MXColorComponent, MXColorLookComponent, MXInputBaseValueComponent, MXInteractiveComponent, MXLookComponent, MXSelectionValueComponent, MXValueComponent, TAB_META_KEY, convertArrayToDataSource, convertToPlacement };
|
1599
1649
|
//# sourceMappingURL=acorex-components-common.mjs.map
|