@recursyve/nice-data-filter-kit 16.1.0 → 16.1.2
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/esm2022/lib/components/nice-filter-view/directives/mat-paginator.mjs +5 -1
- package/esm2022/lib/directive/selectable-list/model/selectable-list-options.model.mjs +1 -1
- package/esm2022/lib/directive/selectable-list/selectable-list-checkbox.directive.mjs +25 -1
- package/esm2022/lib/directive/selectable-list/selectable-list.directive.mjs +2 -1
- package/esm2022/lib/directive/selectable-list/store/selectable-list-state.query.mjs +4 -1
- package/esm2022/lib/directive/selectable-list/store/selectable-list-state.service.mjs +12 -7
- package/esm2022/lib/directive/selectable-list/store/selectable-list.service.mjs +15 -10
- package/esm2022/lib/directive/selectable-list/store/selectable-list.state.mjs +1 -1
- package/fesm2022/recursyve-nice-data-filter-kit.mjs +56 -14
- package/fesm2022/recursyve-nice-data-filter-kit.mjs.map +1 -1
- package/lib/components/nice-filter-view/directives/mat-paginator.d.ts +1 -0
- package/lib/directive/selectable-list/model/selectable-list-options.model.d.ts +2 -0
- package/lib/directive/selectable-list/store/selectable-list-state.query.d.ts +1 -0
- package/lib/directive/selectable-list/store/selectable-list-state.service.d.ts +6 -5
- package/lib/directive/selectable-list/store/selectable-list.service.d.ts +4 -4
- package/lib/directive/selectable-list/store/selectable-list.state.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4217,6 +4217,9 @@ class NiceSelectableListStateQuery extends QueryEntity {
|
|
|
4217
4217
|
constructor(store) {
|
|
4218
4218
|
super(store);
|
|
4219
4219
|
}
|
|
4220
|
+
selectAllSelected() {
|
|
4221
|
+
return this.select("allSelected");
|
|
4222
|
+
}
|
|
4220
4223
|
selectActiveViewIndex() {
|
|
4221
4224
|
return this.select(({ ids, active }) => {
|
|
4222
4225
|
const index = ids.indexOf(active);
|
|
@@ -4243,20 +4246,25 @@ class NiceSelectableListStateQuery extends QueryEntity {
|
|
|
4243
4246
|
|
|
4244
4247
|
class NiceSelectableListStateService {
|
|
4245
4248
|
get idKey() {
|
|
4246
|
-
return this.
|
|
4249
|
+
return this._options?.idKey ?? "id";
|
|
4247
4250
|
}
|
|
4248
4251
|
get preloadedWindow() {
|
|
4249
|
-
return this.
|
|
4252
|
+
return this._options?.preloadWindow ?? 2;
|
|
4250
4253
|
}
|
|
4251
4254
|
get queryParamsDisabled() {
|
|
4252
|
-
return this.
|
|
4255
|
+
return this._options?.disableQueryParams ?? false;
|
|
4256
|
+
}
|
|
4257
|
+
get selectAllBehaviour() {
|
|
4258
|
+
return this._options?.selectAllBehaviour ?? null;
|
|
4253
4259
|
}
|
|
4254
|
-
constructor(store,
|
|
4260
|
+
constructor(store, router, preloadService, options) {
|
|
4255
4261
|
this.store = store;
|
|
4256
|
-
this.route = route;
|
|
4257
4262
|
this.router = router;
|
|
4258
4263
|
this.preloadService = preloadService;
|
|
4259
|
-
this.
|
|
4264
|
+
this._options = options;
|
|
4265
|
+
}
|
|
4266
|
+
setOptions(options) {
|
|
4267
|
+
this._options = options;
|
|
4260
4268
|
}
|
|
4261
4269
|
setActive(entity) {
|
|
4262
4270
|
this.store.setActive(entity[this.idKey]);
|
|
@@ -4456,11 +4464,11 @@ class NiceSelectableListStateService {
|
|
|
4456
4464
|
}
|
|
4457
4465
|
|
|
4458
4466
|
class NiceSelectableListService {
|
|
4459
|
-
constructor(providers,
|
|
4467
|
+
constructor(providers, router) {
|
|
4460
4468
|
this.providers = providers;
|
|
4461
|
-
this.route = route;
|
|
4462
4469
|
this.router = router;
|
|
4463
4470
|
this.stores = new Map();
|
|
4471
|
+
this.services = new Map();
|
|
4464
4472
|
}
|
|
4465
4473
|
createState(name, options) {
|
|
4466
4474
|
const store = new EntityStore({ allSelected: false, unselectedEntity: [] }, { name, idKey: options?.idKey });
|
|
@@ -4474,12 +4482,17 @@ class NiceSelectableListService {
|
|
|
4474
4482
|
}
|
|
4475
4483
|
withState(stateName, options) {
|
|
4476
4484
|
const provider = this.providers?.find((p) => p.state === stateName);
|
|
4477
|
-
const
|
|
4478
|
-
if (
|
|
4479
|
-
|
|
4485
|
+
const service = this.services.get(stateName);
|
|
4486
|
+
if (service) {
|
|
4487
|
+
if (options) {
|
|
4488
|
+
service.setOptions(options);
|
|
4489
|
+
}
|
|
4490
|
+
return service;
|
|
4480
4491
|
}
|
|
4481
4492
|
const newState = this.createState(stateName, options);
|
|
4482
|
-
|
|
4493
|
+
const newService = new NiceSelectableListStateService(newState.store, this.router, provider, options);
|
|
4494
|
+
this.services.set(stateName, newService);
|
|
4495
|
+
return newService;
|
|
4483
4496
|
}
|
|
4484
4497
|
query(stateName) {
|
|
4485
4498
|
const state = this.getState(stateName);
|
|
@@ -4488,7 +4501,7 @@ class NiceSelectableListService {
|
|
|
4488
4501
|
}
|
|
4489
4502
|
return state.query;
|
|
4490
4503
|
}
|
|
4491
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceSelectableListService, deps: [{ token: NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER, optional: true }, { token: i2.
|
|
4504
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceSelectableListService, deps: [{ token: NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER, optional: true }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4492
4505
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceSelectableListService, providedIn: "root" }); }
|
|
4493
4506
|
}
|
|
4494
4507
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.5", ngImport: i0, type: NiceSelectableListService, decorators: [{
|
|
@@ -4499,7 +4512,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.5", ngImpor
|
|
|
4499
4512
|
}, {
|
|
4500
4513
|
type: Inject,
|
|
4501
4514
|
args: [NICE_PRELOAD_SELECTED_ENTITIES_PROVIDER]
|
|
4502
|
-
}] }, { type: i2.
|
|
4515
|
+
}] }, { type: i2.Router }]; } });
|
|
4503
4516
|
|
|
4504
4517
|
class NiceFilterExportButtonsComponent {
|
|
4505
4518
|
constructor(icons, exportsSettings, niceFilterViewQuery, selectableListService, query, service, bottomSheet) {
|
|
@@ -4820,9 +4833,13 @@ class NiceFilterMatPaginatorPaginationDirective extends NiceNestedFilterView {
|
|
|
4820
4833
|
constructor(paginator) {
|
|
4821
4834
|
super();
|
|
4822
4835
|
this.paginator = paginator;
|
|
4836
|
+
this.defaultPageSizeOptions = [10, 25, 50, 100];
|
|
4823
4837
|
}
|
|
4824
4838
|
ngOnInit() {
|
|
4825
4839
|
super.ngOnInit();
|
|
4840
|
+
if (!this.paginator.pageSizeOptions.length) {
|
|
4841
|
+
this.paginator.pageSizeOptions = this.defaultPageSizeOptions;
|
|
4842
|
+
}
|
|
4826
4843
|
this.filterViewQuery.selectFilterResult().pipe(takeUntil(this.unsubscribeAll$)).subscribe((res) => {
|
|
4827
4844
|
if (!res) {
|
|
4828
4845
|
return;
|
|
@@ -5014,6 +5031,19 @@ class NiceSelectableListCheckboxDirective {
|
|
|
5014
5031
|
this.checkbox.checked = false;
|
|
5015
5032
|
}
|
|
5016
5033
|
});
|
|
5034
|
+
this.selectableListStateQuery.selectAllSelected().pipe(takeUntil(this.unsubscribeAll$)).subscribe((allSelected) => {
|
|
5035
|
+
const selectAllBehaviour = this.selectableListStateService.selectAllBehaviour;
|
|
5036
|
+
if (allSelected) {
|
|
5037
|
+
this.selectableListStateService.selectEntity(this.selectableEntity);
|
|
5038
|
+
if (selectAllBehaviour === "lock") {
|
|
5039
|
+
this.checkbox.disabled = true;
|
|
5040
|
+
}
|
|
5041
|
+
}
|
|
5042
|
+
else {
|
|
5043
|
+
this.selectableListStateService.unselectEntity(this.selectableEntity);
|
|
5044
|
+
this.checkbox.disabled = false;
|
|
5045
|
+
}
|
|
5046
|
+
});
|
|
5017
5047
|
}
|
|
5018
5048
|
handleSelectPage() {
|
|
5019
5049
|
this.selectableListStateQuery.selectCount().subscribe(() => this.updateCheckboxState());
|
|
@@ -5026,6 +5056,17 @@ class NiceSelectableListCheckboxDirective {
|
|
|
5026
5056
|
checkbox.checkbox.change.emit({ checked: value.checked, source: checkbox.checkbox });
|
|
5027
5057
|
}
|
|
5028
5058
|
});
|
|
5059
|
+
this.selectableListStateQuery.selectAllSelected().pipe(takeUntil(this.unsubscribeAll$)).subscribe((allSelected) => {
|
|
5060
|
+
const selectAllBehaviour = this.selectableListStateService.selectAllBehaviour;
|
|
5061
|
+
if (allSelected) {
|
|
5062
|
+
if (selectAllBehaviour === "lock") {
|
|
5063
|
+
this.checkbox.disabled = true;
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
5066
|
+
else {
|
|
5067
|
+
this.checkbox.disabled = false;
|
|
5068
|
+
}
|
|
5069
|
+
});
|
|
5029
5070
|
}
|
|
5030
5071
|
updateCheckboxState() {
|
|
5031
5072
|
const count = this.selectableListStateQuery.getCount();
|
|
@@ -5112,6 +5153,7 @@ class NiceSelectableListDirective {
|
|
|
5112
5153
|
ngOnChanges(changes) {
|
|
5113
5154
|
if ("options" in changes) {
|
|
5114
5155
|
this.service.setOptions(this.options);
|
|
5156
|
+
this.stateService?.setOptions(this.options);
|
|
5115
5157
|
}
|
|
5116
5158
|
if ("state" in changes) {
|
|
5117
5159
|
this.service.setState(this.state);
|