@smartsoft001/crud-shell-angular 1.1.734 → 1.1.738
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/{esm2015/index.js → esm2020/index.mjs} +0 -0
- package/{esm2015/lib/+state/crud.actions.js → esm2020/lib/+state/crud.actions.mjs} +0 -0
- package/esm2020/lib/+state/crud.effects.mjs +182 -0
- package/esm2020/lib/+state/crud.facade.mjs +88 -0
- package/esm2020/lib/+state/crud.reducer.mjs +212 -0
- package/{esm2015/lib/+state/crud.selectors.js → esm2020/lib/+state/crud.selectors.mjs} +0 -0
- package/esm2020/lib/components/components.module.mjs +109 -0
- package/esm2020/lib/components/export/export.component.mjs +47 -0
- package/esm2020/lib/components/filter/base/base.component.mjs +140 -0
- package/esm2020/lib/components/filter/check/check.component.mjs +36 -0
- package/esm2020/lib/components/filter/date/date.component.mjs +41 -0
- package/esm2020/lib/components/filter/date-with-edit/date-with-edit.component.mjs +44 -0
- package/esm2020/lib/components/filter/filter.component.mjs +29 -0
- package/esm2020/lib/components/filter/flag/flag.component.mjs +16 -0
- package/{esm2015/lib/components/filter/index.js → esm2020/lib/components/filter/index.mjs} +0 -0
- package/esm2020/lib/components/filter/int/int.component.mjs +33 -0
- package/esm2020/lib/components/filter/radio/radio.component.mjs +16 -0
- package/esm2020/lib/components/filter/text/text.component.mjs +16 -0
- package/esm2020/lib/components/filters/filters.component.mjs +111 -0
- package/esm2020/lib/components/filters-config/filters-config.component.mjs +37 -0
- package/esm2020/lib/components/group/group.component.mjs +54 -0
- package/{esm2015/lib/components/index.js → esm2020/lib/components/index.mjs} +0 -0
- package/esm2020/lib/components/multiselect/multiselect.component.mjs +68 -0
- package/esm2020/lib/crud-full.module.mjs +105 -0
- package/esm2020/lib/crud.config.mjs +17 -0
- package/esm2020/lib/crud.module.mjs +107 -0
- package/esm2020/lib/factories/list-pagination/list-pagination.factory.mjs +69 -0
- package/{esm2015/lib/models/index.js → esm2020/lib/models/index.mjs} +0 -0
- package/{esm2015/lib/models/interfaces.js → esm2020/lib/models/interfaces.mjs} +0 -0
- package/esm2020/lib/pages/index.mjs +7 -0
- package/esm2020/lib/pages/item/base/base.component.mjs +44 -0
- package/esm2020/lib/pages/item/item.component.mjs +393 -0
- package/esm2020/lib/pages/item/standard/standard.component.mjs +15 -0
- package/esm2020/lib/pages/list/base/base.component.mjs +23 -0
- package/esm2020/lib/pages/list/list.component.mjs +343 -0
- package/esm2020/lib/pages/list/standard/standard.component.mjs +34 -0
- package/esm2020/lib/pipes/form-options/form-options.pipe.mjs +55 -0
- package/{esm2015/lib/pipes/index.js → esm2020/lib/pipes/index.mjs} +0 -0
- package/esm2020/lib/pipes/pipes.module.mjs +20 -0
- package/{esm2015/lib/providers/model-possibilities/model-possibilities.provider.js → esm2020/lib/providers/model-possibilities/model-possibilities.provider.mjs} +0 -0
- package/esm2020/lib/services/crud/crud.service.mjs +138 -0
- package/esm2020/lib/services/list-group/list-group.service.mjs +60 -0
- package/esm2020/lib/services/page/page.service.mjs +41 -0
- package/{esm2015/lib/services/search/search.service.js → esm2020/lib/services/search/search.service.mjs} +9 -8
- package/esm2020/lib/services/socket/socket.service.mjs +17 -0
- package/esm2020/smartsoft001-crud-shell-angular.mjs +5 -0
- package/fesm2015/smartsoft001-crud-shell-angular.mjs +2568 -0
- package/fesm2015/smartsoft001-crud-shell-angular.mjs.map +1 -0
- package/fesm2020/smartsoft001-crud-shell-angular.mjs +2728 -0
- package/fesm2020/smartsoft001-crud-shell-angular.mjs.map +1 -0
- package/lib/+state/crud.effects.d.ts +3 -0
- package/lib/+state/crud.effects.d.ts.map +1 -1
- package/lib/+state/crud.facade.d.ts +3 -0
- package/lib/+state/crud.facade.d.ts.map +1 -1
- package/lib/components/components.module.d.ts +22 -0
- package/lib/components/components.module.d.ts.map +1 -1
- package/lib/components/export/export.component.d.ts +3 -0
- package/lib/components/export/export.component.d.ts.map +1 -1
- package/lib/components/filter/base/base.component.d.ts +3 -0
- package/lib/components/filter/base/base.component.d.ts.map +1 -1
- package/lib/components/filter/check/check.component.d.ts +3 -0
- package/lib/components/filter/check/check.component.d.ts.map +1 -1
- package/lib/components/filter/date/date.component.d.ts +3 -0
- package/lib/components/filter/date/date.component.d.ts.map +1 -1
- package/lib/components/filter/date-with-edit/date-with-edit.component.d.ts +4 -1
- package/lib/components/filter/date-with-edit/date-with-edit.component.d.ts.map +1 -1
- package/lib/components/filter/filter.component.d.ts +3 -0
- package/lib/components/filter/filter.component.d.ts.map +1 -1
- package/lib/components/filter/flag/flag.component.d.ts +3 -0
- package/lib/components/filter/flag/flag.component.d.ts.map +1 -1
- package/lib/components/filter/int/int.component.d.ts +3 -0
- package/lib/components/filter/int/int.component.d.ts.map +1 -1
- package/lib/components/filter/radio/radio.component.d.ts +3 -0
- package/lib/components/filter/radio/radio.component.d.ts.map +1 -1
- package/lib/components/filter/text/text.component.d.ts +3 -0
- package/lib/components/filter/text/text.component.d.ts.map +1 -1
- package/lib/components/filters/filters.component.d.ts +3 -0
- package/lib/components/filters/filters.component.d.ts.map +1 -1
- package/lib/components/filters-config/filters-config.component.d.ts +3 -0
- package/lib/components/filters-config/filters-config.component.d.ts.map +1 -1
- package/lib/components/group/group.component.d.ts +3 -0
- package/lib/components/group/group.component.d.ts.map +1 -1
- package/lib/components/multiselect/multiselect.component.d.ts +3 -0
- package/lib/components/multiselect/multiselect.component.d.ts.map +1 -1
- package/lib/crud-full.module.d.ts +20 -0
- package/lib/crud-full.module.d.ts.map +1 -1
- package/lib/crud.config.d.ts +5 -0
- package/lib/crud.config.d.ts.map +1 -1
- package/lib/crud.module.d.ts +13 -0
- package/lib/crud.module.d.ts.map +1 -1
- package/lib/factories/list-pagination/list-pagination.factory.d.ts +3 -0
- package/lib/factories/list-pagination/list-pagination.factory.d.ts.map +1 -1
- package/lib/pages/index.d.ts +5 -1
- package/lib/pages/index.d.ts.map +1 -1
- package/lib/pages/item/base/base.component.d.ts +3 -0
- package/lib/pages/item/base/base.component.d.ts.map +1 -1
- package/lib/pages/item/item.component.d.ts +3 -0
- package/lib/pages/item/item.component.d.ts.map +1 -1
- package/lib/pages/item/standard/standard.component.d.ts +3 -0
- package/lib/pages/item/standard/standard.component.d.ts.map +1 -1
- package/lib/pages/list/base/base.component.d.ts +3 -0
- package/lib/pages/list/base/base.component.d.ts.map +1 -1
- package/lib/pages/list/list.component.d.ts +3 -0
- package/lib/pages/list/list.component.d.ts.map +1 -1
- package/lib/pages/list/standard/standard.component.d.ts +3 -0
- package/lib/pages/list/standard/standard.component.d.ts.map +1 -1
- package/lib/pipes/form-options/form-options.pipe.d.ts +3 -0
- package/lib/pipes/form-options/form-options.pipe.d.ts.map +1 -1
- package/lib/pipes/pipes.module.d.ts +5 -0
- package/lib/pipes/pipes.module.d.ts.map +1 -1
- package/lib/services/crud/crud.service.d.ts +3 -0
- package/lib/services/crud/crud.service.d.ts.map +1 -1
- package/lib/services/list-group/list-group.service.d.ts +3 -0
- package/lib/services/list-group/list-group.service.d.ts.map +1 -1
- package/lib/services/page/page.service.d.ts +3 -0
- package/lib/services/page/page.service.d.ts.map +1 -1
- package/lib/services/search/search.service.d.ts +3 -0
- package/lib/services/search/search.service.d.ts.map +1 -1
- package/lib/services/socket/socket.service.d.ts +5 -0
- package/lib/services/socket/socket.service.d.ts.map +1 -1
- package/package.json +39 -26
- package/smartsoft001-crud-shell-angular.d.ts +1 -17
- package/smartsoft001-crud-shell-angular.d.ts.map +1 -1
- package/bundles/smartsoft001-crud-shell-angular.umd.js +0 -3332
- package/bundles/smartsoft001-crud-shell-angular.umd.js.map +0 -1
- package/esm2015/lib/+state/crud.effects.js +0 -178
- package/esm2015/lib/+state/crud.facade.js +0 -92
- package/esm2015/lib/+state/crud.reducer.js +0 -92
- package/esm2015/lib/components/components.module.js +0 -65
- package/esm2015/lib/components/export/export.component.js +0 -55
- package/esm2015/lib/components/filter/base/base.component.js +0 -144
- package/esm2015/lib/components/filter/check/check.component.js +0 -34
- package/esm2015/lib/components/filter/date/date.component.js +0 -42
- package/esm2015/lib/components/filter/date-with-edit/date-with-edit.component.js +0 -43
- package/esm2015/lib/components/filter/filter.component.js +0 -30
- package/esm2015/lib/components/filter/flag/flag.component.js +0 -13
- package/esm2015/lib/components/filter/int/int.component.js +0 -31
- package/esm2015/lib/components/filter/radio/radio.component.js +0 -13
- package/esm2015/lib/components/filter/text/text.component.js +0 -13
- package/esm2015/lib/components/filters/filters.component.js +0 -124
- package/esm2015/lib/components/filters-config/filters-config.component.js +0 -46
- package/esm2015/lib/components/group/group.component.js +0 -65
- package/esm2015/lib/components/multiselect/multiselect.component.js +0 -74
- package/esm2015/lib/crud-full.module.js +0 -83
- package/esm2015/lib/crud.config.js +0 -14
- package/esm2015/lib/crud.module.js +0 -84
- package/esm2015/lib/factories/list-pagination/list-pagination.factory.js +0 -73
- package/esm2015/lib/pages/index.js +0 -3
- package/esm2015/lib/pages/item/base/base.component.js +0 -44
- package/esm2015/lib/pages/item/item.component.js +0 -383
- package/esm2015/lib/pages/item/standard/standard.component.js +0 -13
- package/esm2015/lib/pages/list/base/base.component.js +0 -30
- package/esm2015/lib/pages/list/list.component.js +0 -319
- package/esm2015/lib/pages/list/standard/standard.component.js +0 -39
- package/esm2015/lib/pipes/form-options/form-options.pipe.js +0 -56
- package/esm2015/lib/pipes/pipes.module.js +0 -16
- package/esm2015/lib/services/crud/crud.service.js +0 -143
- package/esm2015/lib/services/list-group/list-group.service.js +0 -61
- package/esm2015/lib/services/page/page.service.js +0 -48
- package/esm2015/lib/services/socket/socket.service.js +0 -14
- package/esm2015/smartsoft001-crud-shell-angular.js +0 -22
- package/fesm2015/smartsoft001-crud-shell-angular.js +0 -2676
- package/fesm2015/smartsoft001-crud-shell-angular.js.map +0 -1
- package/lib/+state/crud.effects.ngfactory.d.ts.map +0 -1
- package/lib/+state/crud.facade.ngfactory.d.ts.map +0 -1
- package/lib/components/components.module.ngfactory.d.ts.map +0 -1
- package/lib/components/export/export.component.ngfactory.d.ts.map +0 -1
- package/lib/components/export/export.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/filter/check/check.component.ngfactory.d.ts.map +0 -1
- package/lib/components/filter/check/check.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/filter/date/date.component.ngfactory.d.ts.map +0 -1
- package/lib/components/filter/date/date.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/filter/date-with-edit/date-with-edit.component.ngfactory.d.ts.map +0 -1
- package/lib/components/filter/date-with-edit/date-with-edit.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/filter/filter.component.ngfactory.d.ts.map +0 -1
- package/lib/components/filter/filter.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/filter/flag/flag.component.ngfactory.d.ts.map +0 -1
- package/lib/components/filter/flag/flag.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/filter/int/int.component.ngfactory.d.ts.map +0 -1
- package/lib/components/filter/int/int.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/filter/radio/radio.component.ngfactory.d.ts.map +0 -1
- package/lib/components/filter/radio/radio.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/filter/text/text.component.ngfactory.d.ts.map +0 -1
- package/lib/components/filter/text/text.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/filters/filters.component.ngfactory.d.ts.map +0 -1
- package/lib/components/filters/filters.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/filters-config/filters-config.component.ngfactory.d.ts.map +0 -1
- package/lib/components/filters-config/filters-config.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/group/group.component.ngfactory.d.ts.map +0 -1
- package/lib/components/group/group.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/components/multiselect/multiselect.component.ngfactory.d.ts.map +0 -1
- package/lib/components/multiselect/multiselect.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/crud-full.module.ngfactory.d.ts.map +0 -1
- package/lib/crud.config.ngfactory.d.ts.map +0 -1
- package/lib/crud.module.ngfactory.d.ts.map +0 -1
- package/lib/factories/list-pagination/list-pagination.factory.ngfactory.d.ts.map +0 -1
- package/lib/pages/item/item.component.ngfactory.d.ts.map +0 -1
- package/lib/pages/item/standard/standard.component.ngfactory.d.ts.map +0 -1
- package/lib/pages/item/standard/standard.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/pages/list/list.component.ngfactory.d.ts.map +0 -1
- package/lib/pages/list/standard/standard.component.ngfactory.d.ts.map +0 -1
- package/lib/pages/list/standard/standard.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/lib/pipes/form-options/form-options.pipe.ngfactory.d.ts.map +0 -1
- package/lib/pipes/pipes.module.ngfactory.d.ts.map +0 -1
- package/lib/services/crud/crud.service.ngfactory.d.ts.map +0 -1
- package/lib/services/list-group/list-group.service.ngfactory.d.ts.map +0 -1
- package/lib/services/page/page.service.ngfactory.d.ts.map +0 -1
- package/lib/services/search/search.service.ngfactory.d.ts.map +0 -1
- package/lib/services/socket/socket.service.ngfactory.d.ts.map +0 -1
- package/smartsoft001-crud-shell-angular.metadata.json +0 -1
|
@@ -0,0 +1,2728 @@
|
|
|
1
|
+
import * as i1 from '@ngrx/store';
|
|
2
|
+
import { createFeatureSelector, createSelector, select as select$1, StoreModule } from '@ngrx/store';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Injectable, Component, InjectionToken, Directive, Optional, Inject, Input, ViewChild, Pipe, NgModule, ViewContainerRef, QueryList, TemplateRef, ViewChildren, EventEmitter, Output } from '@angular/core';
|
|
5
|
+
import * as i3 from '@smartsoft001/angular';
|
|
6
|
+
import { NgrxStoreService, BaseComponent as BaseComponent$1, SharedModule, PaginationMode, CreateDynamicComponent, ListMode, DynamicContentDirective, FormComponent, NgrxSharedModule, FILE_SERVICE_CONFIG } from '@smartsoft001/angular';
|
|
7
|
+
import { map, tap, first, catchError } from 'rxjs/operators';
|
|
8
|
+
import { FieldType, getModelOptions, getModelFieldsWithOptions } from '@smartsoft001/models';
|
|
9
|
+
import * as i1$1 from '@ionic/angular';
|
|
10
|
+
import { IonDatetime, IonContent } from '@ionic/angular';
|
|
11
|
+
import * as moment from 'moment';
|
|
12
|
+
import { __decorate, __metadata } from 'tslib';
|
|
13
|
+
import { Debounce, debounce } from 'lodash-decorators';
|
|
14
|
+
import * as i2 from '@angular/forms';
|
|
15
|
+
import { FormsModule, FormControl, FormGroup, FormArray } from '@angular/forms';
|
|
16
|
+
import * as i3$1 from '@angular/common';
|
|
17
|
+
import { CommonModule } from '@angular/common';
|
|
18
|
+
import * as i4 from '@ngx-translate/core';
|
|
19
|
+
import { Subscription, combineLatest, forkJoin, of, BehaviorSubject } from 'rxjs';
|
|
20
|
+
import { GuidService } from '@smartsoft001/utils';
|
|
21
|
+
import * as _ from 'lodash';
|
|
22
|
+
import * as i2$1 from '@angular/common/http';
|
|
23
|
+
import 'reflect-metadata';
|
|
24
|
+
import * as i1$2 from '@angular/router';
|
|
25
|
+
import { RouterModule } from '@angular/router';
|
|
26
|
+
|
|
27
|
+
const getCrudState = (entity) => createFeatureSelector(entity);
|
|
28
|
+
const getCrudSelected = (entity) => createSelector(getCrudState(entity), (state) => state.selected);
|
|
29
|
+
const getCrudMultiSelected = (entity) => createSelector(getCrudState(entity), (state) => state.multiSelected);
|
|
30
|
+
const getCrudList = (entity) => createSelector(getCrudState(entity), (state) => state.list);
|
|
31
|
+
const getCrudTotalCount = (entity) => createSelector(getCrudState(entity), (state) => state.totalCount);
|
|
32
|
+
const getCrudLinks = (entity) => createSelector(getCrudState(entity), (state) => state.links);
|
|
33
|
+
const getCrudLoaded = (entity) => createSelector(getCrudState(entity), (state) => state.loaded);
|
|
34
|
+
const getCrudFilter = (entity) => createSelector(getCrudState(entity), (state) => state.filter);
|
|
35
|
+
const getCrudError = (entity) => createSelector(getCrudState(entity), (state) => state.error);
|
|
36
|
+
|
|
37
|
+
class CrudConfig {
|
|
38
|
+
}
|
|
39
|
+
/** @nocollapse */ /** @nocollapse */ CrudConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
40
|
+
/** @nocollapse */ /** @nocollapse */ CrudConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudConfig });
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudConfig, decorators: [{
|
|
42
|
+
type: Injectable
|
|
43
|
+
}] });
|
|
44
|
+
class CrudFullConfig extends CrudConfig {
|
|
45
|
+
}
|
|
46
|
+
/** @nocollapse */ /** @nocollapse */ CrudFullConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudFullConfig, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
47
|
+
/** @nocollapse */ /** @nocollapse */ CrudFullConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudFullConfig });
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudFullConfig, decorators: [{
|
|
49
|
+
type: Injectable
|
|
50
|
+
}] });
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
* Create
|
|
54
|
+
*/
|
|
55
|
+
const create = function (entity, item) {
|
|
56
|
+
return {
|
|
57
|
+
type: `[${entity}] Create`,
|
|
58
|
+
item
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const createSuccess = function (entity, item) {
|
|
62
|
+
return {
|
|
63
|
+
type: `[${entity}] Create Success`,
|
|
64
|
+
item
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const createFailure = function (entity, item, error) {
|
|
68
|
+
return {
|
|
69
|
+
type: `[${entity}] Create Failure`,
|
|
70
|
+
item,
|
|
71
|
+
error
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/*
|
|
75
|
+
* Create many
|
|
76
|
+
*/
|
|
77
|
+
const createMany = function (entity, data) {
|
|
78
|
+
return {
|
|
79
|
+
type: `[${entity}] Create Many`,
|
|
80
|
+
data
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const createManySuccess = function (entity, data) {
|
|
84
|
+
return {
|
|
85
|
+
type: `[${entity}] Create Many Success`,
|
|
86
|
+
data
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
const createManyFailure = function (entity, data, error) {
|
|
90
|
+
return {
|
|
91
|
+
type: `[${entity}] Create Many Failure`,
|
|
92
|
+
data,
|
|
93
|
+
error
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
/*
|
|
97
|
+
* Read
|
|
98
|
+
*/
|
|
99
|
+
const read = function (entity, filter = null) {
|
|
100
|
+
return {
|
|
101
|
+
type: `[${entity}] Read`,
|
|
102
|
+
filter
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
const readSuccess = function (entity, filter, result) {
|
|
106
|
+
return {
|
|
107
|
+
type: `[${entity}] Read Success`,
|
|
108
|
+
result,
|
|
109
|
+
filter
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
const readFailure = function (entity, filter, error) {
|
|
113
|
+
return {
|
|
114
|
+
type: `[${entity}] Read Failure`,
|
|
115
|
+
filter,
|
|
116
|
+
error
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
/*
|
|
120
|
+
* Export
|
|
121
|
+
*/
|
|
122
|
+
const exportList = function (entity, filter = null, format) {
|
|
123
|
+
return {
|
|
124
|
+
type: `[${entity}] Export`,
|
|
125
|
+
filter,
|
|
126
|
+
format
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
const exportListSuccess = function (entity, filter) {
|
|
130
|
+
return {
|
|
131
|
+
type: `[${entity}] Export Success`,
|
|
132
|
+
filter
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
const exportListFailure = function (entity, filter, error) {
|
|
136
|
+
return {
|
|
137
|
+
type: `[${entity}] Export Failure`,
|
|
138
|
+
filter,
|
|
139
|
+
error
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
/*
|
|
143
|
+
* Select
|
|
144
|
+
*/
|
|
145
|
+
const select = function (entity, id) {
|
|
146
|
+
return {
|
|
147
|
+
type: `[${entity}] Select`,
|
|
148
|
+
id
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
const selectSuccess = function (entity, id, item) {
|
|
152
|
+
return {
|
|
153
|
+
type: `[${entity}] Select Success`,
|
|
154
|
+
id,
|
|
155
|
+
item
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
const selectFailure = function (entity, id, error) {
|
|
159
|
+
return {
|
|
160
|
+
type: `[${entity}] Select Failure`,
|
|
161
|
+
id,
|
|
162
|
+
error
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
const unselect = function (entity) {
|
|
166
|
+
return {
|
|
167
|
+
type: `[${entity}] Unselect`
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
/*
|
|
171
|
+
* MultiSelect
|
|
172
|
+
*/
|
|
173
|
+
const multiSelect = function (entity, items) {
|
|
174
|
+
return {
|
|
175
|
+
type: `[${entity}] MultiSelect`,
|
|
176
|
+
items
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
/*
|
|
180
|
+
* Update
|
|
181
|
+
*/
|
|
182
|
+
const update = function (entity, item) {
|
|
183
|
+
return {
|
|
184
|
+
type: `[${entity}] Update`,
|
|
185
|
+
item
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
const updateSuccess = function (entity, item) {
|
|
189
|
+
return {
|
|
190
|
+
type: `[${entity}] Update Success`,
|
|
191
|
+
item
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
const updateFailure = function (entity, item, error) {
|
|
195
|
+
return {
|
|
196
|
+
type: `[${entity}] Update Failure`,
|
|
197
|
+
item,
|
|
198
|
+
error
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
/*
|
|
202
|
+
* Update partial
|
|
203
|
+
*/
|
|
204
|
+
const updatePartial = function (entity, item) {
|
|
205
|
+
return {
|
|
206
|
+
type: `[${entity}] Update partial`,
|
|
207
|
+
item
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
const updatePartialSuccess = function (entity, item) {
|
|
211
|
+
return {
|
|
212
|
+
type: `[${entity}] Update partial Success`,
|
|
213
|
+
item
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
const updatePartialFailure = function (entity, item, error) {
|
|
217
|
+
return {
|
|
218
|
+
type: `[${entity}] Update partial Failure`,
|
|
219
|
+
item,
|
|
220
|
+
error
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
/*
|
|
224
|
+
* Update partial many
|
|
225
|
+
*/
|
|
226
|
+
const updatePartialMany = function (entity, items) {
|
|
227
|
+
return {
|
|
228
|
+
type: `[${entity}] Update partial many`,
|
|
229
|
+
items
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
const updatePartialManySuccess = function (entity, items) {
|
|
233
|
+
return {
|
|
234
|
+
type: `[${entity}] Update partial many Success`,
|
|
235
|
+
items
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
const updatePartialManyFailure = function (entity, items, error) {
|
|
239
|
+
return {
|
|
240
|
+
type: `[${entity}] Update partial many Failure`,
|
|
241
|
+
items,
|
|
242
|
+
error
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
/*
|
|
246
|
+
* Delete
|
|
247
|
+
*/
|
|
248
|
+
const deleteItem = function (entity, id) {
|
|
249
|
+
return {
|
|
250
|
+
type: `[${entity}] Delete`,
|
|
251
|
+
id
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
const deleteSuccess = function (entity, id) {
|
|
255
|
+
return {
|
|
256
|
+
type: `[${entity}] Delete Success`,
|
|
257
|
+
id
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
const deleteFailure = function (entity, id, error) {
|
|
261
|
+
return {
|
|
262
|
+
type: `[${entity}] Delete Failure`,
|
|
263
|
+
id,
|
|
264
|
+
error
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
class CrudFacade {
|
|
269
|
+
constructor(store, config) {
|
|
270
|
+
this.store = store;
|
|
271
|
+
this.config = config;
|
|
272
|
+
this.loaded$ = this.store.pipe(select$1(getCrudLoaded(this.config.entity)));
|
|
273
|
+
this.loading$ = this.store.pipe(select$1(getCrudLoaded(this.config.entity)), map(l => !l));
|
|
274
|
+
this.selected$ = this.store.pipe(select$1(getCrudSelected(this.config.entity)), tap(s => {
|
|
275
|
+
this.selected = s;
|
|
276
|
+
}));
|
|
277
|
+
this.multiSelected$ = this.store.pipe(select$1(getCrudMultiSelected(this.config.entity)), tap(s => {
|
|
278
|
+
this.multiSelected = s;
|
|
279
|
+
}));
|
|
280
|
+
this.list$ = this.store.pipe(select$1(getCrudList(this.config.entity)), tap(l => {
|
|
281
|
+
this.list = l;
|
|
282
|
+
}));
|
|
283
|
+
this.filter$ = this.store.pipe(select$1(getCrudFilter(this.config.entity)), tap(f => {
|
|
284
|
+
this.filter = f;
|
|
285
|
+
}));
|
|
286
|
+
this.totalCount$ = this.store.pipe(select$1(getCrudTotalCount(this.config.entity)));
|
|
287
|
+
this.links$ = this.store.pipe(select$1(getCrudLinks(this.config.entity)));
|
|
288
|
+
this.error$ = this.store.pipe(select$1(getCrudError(this.config.entity)));
|
|
289
|
+
if (NgrxStoreService.store) {
|
|
290
|
+
this.store = NgrxStoreService.store;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
create(item) {
|
|
294
|
+
this.store.dispatch(create(this.config.entity, item));
|
|
295
|
+
}
|
|
296
|
+
createMany(items, options) {
|
|
297
|
+
this.store.dispatch(createMany(this.config.entity, { items, options }));
|
|
298
|
+
}
|
|
299
|
+
read(filter = null) {
|
|
300
|
+
let baseQuery = [];
|
|
301
|
+
if (this.config.baseQuery) {
|
|
302
|
+
baseQuery = this.config.baseQuery;
|
|
303
|
+
}
|
|
304
|
+
const fullFilter = {
|
|
305
|
+
...(filter ? filter : {}),
|
|
306
|
+
query: filter && filter.query ? filter.query : baseQuery
|
|
307
|
+
};
|
|
308
|
+
this.store.dispatch(read(this.config.entity, fullFilter));
|
|
309
|
+
}
|
|
310
|
+
select(id) {
|
|
311
|
+
this.store.dispatch(select(this.config.entity, id));
|
|
312
|
+
}
|
|
313
|
+
unselect() {
|
|
314
|
+
this.store.dispatch(unselect(this.config.entity));
|
|
315
|
+
}
|
|
316
|
+
multiSelect(items) {
|
|
317
|
+
this.store.dispatch(multiSelect(this.config.entity, items));
|
|
318
|
+
}
|
|
319
|
+
update(item) {
|
|
320
|
+
this.getStore().dispatch(update(this.config.entity, item));
|
|
321
|
+
}
|
|
322
|
+
export(filter = null, format = null) {
|
|
323
|
+
this.getStore().dispatch(exportList(this.config.entity, filter, format));
|
|
324
|
+
}
|
|
325
|
+
updatePartial(item) {
|
|
326
|
+
this.getStore().dispatch(updatePartial(this.config.entity, item));
|
|
327
|
+
}
|
|
328
|
+
updatePartialMany(items) {
|
|
329
|
+
this.getStore().dispatch(updatePartialMany(this.config.entity, items));
|
|
330
|
+
}
|
|
331
|
+
delete(id) {
|
|
332
|
+
this.getStore().dispatch(deleteItem(this.config.entity, id));
|
|
333
|
+
}
|
|
334
|
+
getStore() {
|
|
335
|
+
if (NgrxStoreService.store)
|
|
336
|
+
return NgrxStoreService.store;
|
|
337
|
+
return this.store;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
/** @nocollapse */ /** @nocollapse */ CrudFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudFacade, deps: [{ token: i1.Store }, { token: CrudConfig }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
341
|
+
/** @nocollapse */ /** @nocollapse */ CrudFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudFacade });
|
|
342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudFacade, decorators: [{
|
|
343
|
+
type: Injectable
|
|
344
|
+
}], ctorParameters: function () { return [{ type: i1.Store }, { type: CrudConfig }]; } });
|
|
345
|
+
|
|
346
|
+
class ExportComponent extends BaseComponent$1 {
|
|
347
|
+
constructor(facade, popoverService, styleService, elementRef) {
|
|
348
|
+
super();
|
|
349
|
+
this.facade = facade;
|
|
350
|
+
this.popoverService = popoverService;
|
|
351
|
+
this.styleService = styleService;
|
|
352
|
+
this.elementRef = elementRef;
|
|
353
|
+
this.buttonExportCsvOptions = this.initButtonExportOptions('csv');
|
|
354
|
+
this.buttonExportXlsxOptions = this.initButtonExportOptions('xlsx');
|
|
355
|
+
this.loading$ = this.facade.loading$;
|
|
356
|
+
}
|
|
357
|
+
ngOnInit() {
|
|
358
|
+
this.styleService.init(this.elementRef);
|
|
359
|
+
}
|
|
360
|
+
initButtonExportOptions(format) {
|
|
361
|
+
return {
|
|
362
|
+
click: () => {
|
|
363
|
+
this.facade.export({
|
|
364
|
+
...this.facade.filter,
|
|
365
|
+
offset: null,
|
|
366
|
+
limit: null
|
|
367
|
+
}, format);
|
|
368
|
+
const subscription = this.facade.loaded$.subscribe(val => {
|
|
369
|
+
if (!val)
|
|
370
|
+
return;
|
|
371
|
+
this.popoverService.close();
|
|
372
|
+
subscription.unsubscribe();
|
|
373
|
+
});
|
|
374
|
+
},
|
|
375
|
+
loading$: this.facade.loading$,
|
|
376
|
+
expand: 'block'
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
/** @nocollapse */ /** @nocollapse */ ExportComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ExportComponent, deps: [{ token: CrudFacade }, { token: i3.PopoverService }, { token: i3.StyleService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
381
|
+
/** @nocollapse */ /** @nocollapse */ ExportComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: ExportComponent, selector: "smart-crud-export", usesInheritance: true, ngImport: i0, template: "<div class=\"smart-content\">\n <p>\n <smart-button [options]=\"buttonExportCsvOptions\">CSV</smart-button>\n </p>\n <p>\n <smart-button [options]=\"buttonExportXlsxOptions\">XLSX</smart-button>\n </p>\n</div>", styles: [".smart-content{padding:1.2rem}.smart-content p{margin:.6rem 0}.smart-content smart-button{width:100%;display:block}\n"], components: [{ type: i3.ButtonComponent, selector: "smart-button", inputs: ["options", "disabled"] }] });
|
|
382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ExportComponent, decorators: [{
|
|
383
|
+
type: Component,
|
|
384
|
+
args: [{ selector: 'smart-crud-export', template: "<div class=\"smart-content\">\n <p>\n <smart-button [options]=\"buttonExportCsvOptions\">CSV</smart-button>\n </p>\n <p>\n <smart-button [options]=\"buttonExportXlsxOptions\">XLSX</smart-button>\n </p>\n</div>", styles: [".smart-content{padding:1.2rem}.smart-content p{margin:.6rem 0}.smart-content smart-button{width:100%;display:block}\n"] }]
|
|
385
|
+
}], ctorParameters: function () { return [{ type: CrudFacade }, { type: i3.PopoverService }, { type: i3.StyleService }, { type: i0.ElementRef }]; } });
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* @deprecated - please, use IModelPossibilitiesProvider from @smartsoft001/angular
|
|
389
|
+
*/
|
|
390
|
+
class ICrudModelPossibilitiesProvider {
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* @deprecated - please, use MODEL_POSSIBILITIES_PROVIDER from @smartsoft001/angular
|
|
394
|
+
*/
|
|
395
|
+
const CRUD_MODEL_POSSIBILITIES_PROVIDER = new InjectionToken("CRUD_MODEL_POSSIBILITIES_PROVIDER");
|
|
396
|
+
|
|
397
|
+
class BaseComponent {
|
|
398
|
+
constructor(facade, config, modelPossibilitiesProvider) {
|
|
399
|
+
this.facade = facade;
|
|
400
|
+
this.config = config;
|
|
401
|
+
this.modelPossibilitiesProvider = modelPossibilitiesProvider;
|
|
402
|
+
}
|
|
403
|
+
get value() {
|
|
404
|
+
if (this.isArrayType()) {
|
|
405
|
+
return this.filter.query
|
|
406
|
+
.filter((q) => q.key === this.item.key && q.type === this.item.type)
|
|
407
|
+
.map(q => q.value);
|
|
408
|
+
}
|
|
409
|
+
const query = this.filter.query.find((q) => q.key === this.item.key && q.type === this.item.type);
|
|
410
|
+
return query?.value;
|
|
411
|
+
}
|
|
412
|
+
set value(val) {
|
|
413
|
+
this.refresh(val);
|
|
414
|
+
}
|
|
415
|
+
get minValue() {
|
|
416
|
+
if (this.isArrayType()) {
|
|
417
|
+
return this.filter.query
|
|
418
|
+
.filter((q) => q.key === this.item.key && q.type === ">=")
|
|
419
|
+
.map(q => q.value);
|
|
420
|
+
}
|
|
421
|
+
const query = this.filter.query.find((q) => q.key === this.item.key && q.type === ">=");
|
|
422
|
+
return query?.value;
|
|
423
|
+
}
|
|
424
|
+
set minValue(val) {
|
|
425
|
+
this.refresh(val, ">=");
|
|
426
|
+
}
|
|
427
|
+
get maxValue() {
|
|
428
|
+
if (this.isArrayType()) {
|
|
429
|
+
return this.filter.query
|
|
430
|
+
.filter((q) => q.key === this.item.key && q.type === "<=")
|
|
431
|
+
.map(q => q.value);
|
|
432
|
+
}
|
|
433
|
+
const query = this.filter.query.find((q) => q.key === this.item.key && q.type === "<=");
|
|
434
|
+
return query?.value;
|
|
435
|
+
}
|
|
436
|
+
set maxValue(val) {
|
|
437
|
+
this.refresh(val, "<=");
|
|
438
|
+
}
|
|
439
|
+
refresh(val, type = null) {
|
|
440
|
+
if (!type)
|
|
441
|
+
type = this.item.type;
|
|
442
|
+
if (this.isArrayType()) {
|
|
443
|
+
this.refreshForArray(val, type);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
let query = this.filter.query.find((q) => q.key === this.item.key && q.type === type);
|
|
447
|
+
if (val === null || val === undefined || val === '') {
|
|
448
|
+
const index = this.filter.query.indexOf(query);
|
|
449
|
+
if (index > -1) {
|
|
450
|
+
this.filter.query.splice(index, 1);
|
|
451
|
+
}
|
|
452
|
+
this.facade.read(this.filter);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (!query) {
|
|
456
|
+
query = {
|
|
457
|
+
key: this.item.key,
|
|
458
|
+
type: type,
|
|
459
|
+
value: null,
|
|
460
|
+
};
|
|
461
|
+
this.filter.query.push(query);
|
|
462
|
+
}
|
|
463
|
+
query.value = val;
|
|
464
|
+
query.label = this.item.label;
|
|
465
|
+
this.facade.read(this.filter);
|
|
466
|
+
}
|
|
467
|
+
ngOnInit() {
|
|
468
|
+
this.initPossibilities();
|
|
469
|
+
}
|
|
470
|
+
initPossibilities() {
|
|
471
|
+
let possibilities = this.item.possibilities$;
|
|
472
|
+
if (this.modelPossibilitiesProvider) {
|
|
473
|
+
const possibilitiesFromProvider = this.modelPossibilitiesProvider.get(this.config.type);
|
|
474
|
+
if (possibilitiesFromProvider && possibilitiesFromProvider[this.item.key])
|
|
475
|
+
possibilities = possibilitiesFromProvider[this.item.key];
|
|
476
|
+
}
|
|
477
|
+
this.possibilities$ = possibilities;
|
|
478
|
+
}
|
|
479
|
+
isArrayType() {
|
|
480
|
+
return (this.item?.fieldType === FieldType.check);
|
|
481
|
+
}
|
|
482
|
+
refreshForArray(vals, type) {
|
|
483
|
+
const queries = this.filter.query.filter((q) => q.key === this.item.key && q.type === type);
|
|
484
|
+
queries.forEach(query => {
|
|
485
|
+
const index = this.filter.query.indexOf(query);
|
|
486
|
+
if (index > -1) {
|
|
487
|
+
this.filter.query.splice(index, 1);
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
if (vals === null || vals === undefined || !vals.length) {
|
|
491
|
+
this.facade.read(this.filter);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
vals.forEach(val => {
|
|
495
|
+
const query = {
|
|
496
|
+
key: this.item.key,
|
|
497
|
+
type: type,
|
|
498
|
+
value: val,
|
|
499
|
+
};
|
|
500
|
+
this.filter.query.push(query);
|
|
501
|
+
});
|
|
502
|
+
this.facade.read(this.filter);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
/** @nocollapse */ /** @nocollapse */ BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: BaseComponent, deps: [{ token: CrudFacade }, { token: CrudConfig }, { token: CRUD_MODEL_POSSIBILITIES_PROVIDER, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
506
|
+
/** @nocollapse */ /** @nocollapse */ BaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.7", type: BaseComponent, inputs: { item: "item", filter: "filter" }, ngImport: i0 });
|
|
507
|
+
__decorate([
|
|
508
|
+
Debounce(500),
|
|
509
|
+
__metadata("design:type", Function),
|
|
510
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
511
|
+
__metadata("design:returntype", void 0)
|
|
512
|
+
], BaseComponent.prototype, "refresh", null);
|
|
513
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: BaseComponent, decorators: [{
|
|
514
|
+
type: Directive
|
|
515
|
+
}], ctorParameters: function () { return [{ type: CrudFacade }, { type: CrudConfig }, { type: ICrudModelPossibilitiesProvider, decorators: [{
|
|
516
|
+
type: Optional
|
|
517
|
+
}, {
|
|
518
|
+
type: Inject,
|
|
519
|
+
args: [CRUD_MODEL_POSSIBILITIES_PROVIDER]
|
|
520
|
+
}] }]; }, propDecorators: { item: [{
|
|
521
|
+
type: Input
|
|
522
|
+
}], filter: [{
|
|
523
|
+
type: Input
|
|
524
|
+
}], refresh: [] } });
|
|
525
|
+
|
|
526
|
+
class FilterDateComponent extends BaseComponent {
|
|
527
|
+
get allowAdvanced() {
|
|
528
|
+
return this.item?.type === '=';
|
|
529
|
+
}
|
|
530
|
+
set customValue(val) {
|
|
531
|
+
const momentDate = moment(val);
|
|
532
|
+
this.value = val?.length >= 10 && momentDate.isValid() ? momentDate.format('YYYY-MM-DD') : val;
|
|
533
|
+
}
|
|
534
|
+
get customValue() {
|
|
535
|
+
return this.value;
|
|
536
|
+
}
|
|
537
|
+
set customMinValue(val) {
|
|
538
|
+
const momentDate = moment(val);
|
|
539
|
+
this.minValue = val?.length >= 10 && momentDate.isValid() ? momentDate.format('YYYY-MM-DD') : val;
|
|
540
|
+
}
|
|
541
|
+
get customMinValue() {
|
|
542
|
+
return this.minValue;
|
|
543
|
+
}
|
|
544
|
+
set customMaxValue(val) {
|
|
545
|
+
const momentDate = moment(val);
|
|
546
|
+
this.maxValue = val?.length >= 10 && momentDate.isValid() ? momentDate.format('YYYY-MM-DD') : val;
|
|
547
|
+
}
|
|
548
|
+
get customMaxValue() {
|
|
549
|
+
return this.maxValue;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
/** @nocollapse */ /** @nocollapse */ FilterDateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterDateComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
553
|
+
/** @nocollapse */ /** @nocollapse */ FilterDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: FilterDateComponent, selector: "smart-crud-filter-date", usesInheritance: true, ngImport: i0, template: "<ion-row>\n <ion-col>\n <ion-label position=\"floating\">\n {{ item.label | translate }}\n </ion-label>\n <ion-datetime displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"></ion-datetime>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"], components: [{ type: i1$1.IonRow, selector: "ion-row" }, { type: i1$1.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { type: i1$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { type: i1$1.IonDatetime, selector: "ion-datetime", inputs: ["cancelText", "clearText", "color", "dayValues", "disabled", "doneText", "firstDayOfWeek", "hourCycle", "hourValues", "locale", "max", "min", "minuteValues", "mode", "monthValues", "name", "presentation", "readonly", "showClearButton", "showDefaultButtons", "showDefaultTimeLabel", "showDefaultTitle", "size", "value", "yearValues"] }, { type: i1$1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { type: i1$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }], directives: [{ type: i1$1.SelectValueAccessor, selector: "ion-range, ion-select, ion-radio-group, ion-segment, ion-datetime" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i4.TranslatePipe } });
|
|
554
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterDateComponent, decorators: [{
|
|
555
|
+
type: Component,
|
|
556
|
+
args: [{ selector: 'smart-crud-filter-date', template: "<ion-row>\n <ion-col>\n <ion-label position=\"floating\">\n {{ item.label | translate }}\n </ion-label>\n <ion-datetime displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"></ion-datetime>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"] }]
|
|
557
|
+
}] });
|
|
558
|
+
|
|
559
|
+
class FilterDateWithEditComponent extends FilterDateComponent {
|
|
560
|
+
constructor() {
|
|
561
|
+
super(...arguments);
|
|
562
|
+
this._subscriptions = new Subscription();
|
|
563
|
+
this.advanced = false;
|
|
564
|
+
this.id = GuidService.create();
|
|
565
|
+
}
|
|
566
|
+
ngOnInit() {
|
|
567
|
+
super.ngOnInit();
|
|
568
|
+
if (this.dateTimePicker) {
|
|
569
|
+
this._subscriptions.add(this.dateTimePicker.ionChange.subscribe((val) => {
|
|
570
|
+
this.customValue = val.detail.value;
|
|
571
|
+
}));
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
console.error('dateTimePicker not found!');
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
ngOnDestroy() {
|
|
578
|
+
if (this._subscriptions) {
|
|
579
|
+
this._subscriptions.unsubscribe();
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
/** @nocollapse */ /** @nocollapse */ FilterDateWithEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterDateWithEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
584
|
+
/** @nocollapse */ /** @nocollapse */ FilterDateWithEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: FilterDateWithEditComponent, selector: "smart-crud-filter-date-with-edit", viewQueries: [{ propertyName: "dateTimePicker", first: true, predicate: IonDatetime, descendants: true, read: IonDatetime }], usesInheritance: true, ngImport: i0, template: "<ion-row>\n <ion-col>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n\n <ion-input placeholder=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n </ion-col>\n <ion-col size=\"auto\">\n <ion-button id=\"open-date-input-{{ id }}\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"calendar-outline\"></ion-icon>\n <ion-popover trigger=\"open-date-input-{{ id }}\" show-backdrop=\"false\">\n <ng-template>\n <ion-datetime displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"\n presentation=\"date\"\n ></ion-datetime>\n </ng-template>\n </ion-popover>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"allowAdvanced\">\n <ion-button (click)=\"advanced = !advanced\" class=\"squere-button\" [disabled]=\"minValue || maxValue\">\n <ion-icon *ngIf=\"!advanced\" slot=\"icon-only\" name=\"settings-outline\"></ion-icon>\n <ion-icon *ngIf=\"advanced\" slot=\"icon-only\" name=\"settings\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>\n<ion-row *ngIf=\"(advanced || minValue || maxValue) && allowAdvanced\">\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'from' | translate }}\n </ion-label>\n <ion-input placeholder=\"YYYY-MM-DD\"\n [(ngModel)]=\"customMinValue\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"customMinValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '>=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'to' | translate }}\n </ion-label>\n <ion-input placeholder=\"YYYY-MM-DD\"\n [(ngModel)]=\"customMaxValue\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"customMaxValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '<=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"], components: [{ type: i1$1.IonRow, selector: "ion-row" }, { type: i1$1.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { type: i1$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { type: i1$1.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "debounce", "disabled", "enterkeyhint", "inputmode", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "size", "spellcheck", "step", "type", "value"] }, { type: i1$1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { type: i1$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { type: i1$1.IonPopover, selector: "ion-popover", inputs: ["alignment", "animated", "arrow", "backdropDismiss", "cssClass", "dismissOnSelect", "enterAnimation", "event", "isOpen", "keyboardClose", "leaveAnimation", "mode", "showBackdrop", "translucent", "trigger", "triggerAction", "reference", "size", "side"] }, { type: i1$1.IonDatetime, selector: "ion-datetime", inputs: ["cancelText", "clearText", "color", "dayValues", "disabled", "doneText", "firstDayOfWeek", "hourCycle", "hourValues", "locale", "max", "min", "minuteValues", "mode", "monthValues", "name", "presentation", "readonly", "showClearButton", "showDefaultButtons", "showDefaultTimeLabel", "showDefaultTitle", "size", "value", "yearValues"] }, { type: i1$1.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }], directives: [{ type: i1$1.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i1$1.SelectValueAccessor, selector: "ion-range, ion-select, ion-radio-group, ion-segment, ion-datetime" }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i4.TranslatePipe } });
|
|
585
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterDateWithEditComponent, decorators: [{
|
|
586
|
+
type: Component,
|
|
587
|
+
args: [{ selector: 'smart-crud-filter-date-with-edit', template: "<ion-row>\n <ion-col>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n\n <ion-input placeholder=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n </ion-col>\n <ion-col size=\"auto\">\n <ion-button id=\"open-date-input-{{ id }}\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"calendar-outline\"></ion-icon>\n <ion-popover trigger=\"open-date-input-{{ id }}\" show-backdrop=\"false\">\n <ng-template>\n <ion-datetime displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"\n presentation=\"date\"\n ></ion-datetime>\n </ng-template>\n </ion-popover>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"allowAdvanced\">\n <ion-button (click)=\"advanced = !advanced\" class=\"squere-button\" [disabled]=\"minValue || maxValue\">\n <ion-icon *ngIf=\"!advanced\" slot=\"icon-only\" name=\"settings-outline\"></ion-icon>\n <ion-icon *ngIf=\"advanced\" slot=\"icon-only\" name=\"settings\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>\n<ion-row *ngIf=\"(advanced || minValue || maxValue) && allowAdvanced\">\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'from' | translate }}\n </ion-label>\n <ion-input placeholder=\"YYYY-MM-DD\"\n [(ngModel)]=\"customMinValue\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"customMinValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '>=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'to' | translate }}\n </ion-label>\n <ion-input placeholder=\"YYYY-MM-DD\"\n [(ngModel)]=\"customMaxValue\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"customMaxValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '<=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"] }]
|
|
588
|
+
}], propDecorators: { dateTimePicker: [{
|
|
589
|
+
type: ViewChild,
|
|
590
|
+
args: [IonDatetime, { read: IonDatetime, static: false }]
|
|
591
|
+
}] } });
|
|
592
|
+
|
|
593
|
+
class FilterRadioComponent extends BaseComponent {
|
|
594
|
+
}
|
|
595
|
+
/** @nocollapse */ /** @nocollapse */ FilterRadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterRadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
596
|
+
/** @nocollapse */ /** @nocollapse */ FilterRadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: FilterRadioComponent, selector: "smart-crud-filter-radio", usesInheritance: true, ngImport: i0, template: "<ion-row>\n <ion-col>\n <ion-radio-group [(ngModel)]=\"value\">\n <ion-item-divider>\n <ion-icon slot=\"start\" name=\"filter-outline\"></ion-icon>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-button *ngIf=\"value\" slot=\"end\" color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-item-divider>\n\n <ion-item *ngFor=\"let item of possibilities$ | async\">\n <ion-label>{{ item.text | translate }}</ion-label>\n <ion-radio [value]=\"item.id\"></ion-radio>\n </ion-item>\n </ion-radio-group>\n </ion-col>\n <!-- <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col> -->\n</ion-row>", styles: [":host{width:100%;margin-bottom:1.2rem}:host ion-radio{margin-right:2.4rem}:host ion-item-divider{font-weight:300;--padding-end: .8rem;font-size:1.2rem;--ion-background-color: linear-gradient(90deg, transparent, var(--ion-color-light))}:host ion-item-divider ion-icon{margin-right:1.6rem;font-size:1.6rem;--color: var(--ion-color-primary)}:host ion-item-divider ion-label{--padding: var(--smart-button-padding-left)/2 var(--smart-button-padding-top)/2 var(--smart-button-padding-right)/2 var(--smart-button-padding-bottom)/2}:host ion-item-divider .squere-button{margin:0;font-size:18px;height:36px;width:36px;padding:0;--padding-start: .2em;--padding-end: .2em}:host ion-item-divider .squere-button ion-icon{margin:0;padding:0}\n"], components: [{ type: i1$1.IonRow, selector: "ion-row" }, { type: i1$1.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { type: i1$1.IonRadioGroup, selector: "ion-radio-group", inputs: ["allowEmptySelection", "name", "value"] }, { type: i1$1.IonItemDivider, selector: "ion-item-divider", inputs: ["color", "mode", "sticky"] }, { type: i1$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { type: i1$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { type: i1$1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { type: i1$1.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { type: i1$1.IonRadio, selector: "ion-radio", inputs: ["color", "disabled", "mode", "name", "value"] }], directives: [{ type: i1$1.SelectValueAccessor, selector: "ion-range, ion-select, ion-radio-group, ion-segment, ion-datetime" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$1.RadioValueAccessor, selector: "ion-radio" }], pipes: { "translate": i4.TranslatePipe, "async": i3$1.AsyncPipe } });
|
|
597
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterRadioComponent, decorators: [{
|
|
598
|
+
type: Component,
|
|
599
|
+
args: [{ selector: 'smart-crud-filter-radio', template: "<ion-row>\n <ion-col>\n <ion-radio-group [(ngModel)]=\"value\">\n <ion-item-divider>\n <ion-icon slot=\"start\" name=\"filter-outline\"></ion-icon>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-button *ngIf=\"value\" slot=\"end\" color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-item-divider>\n\n <ion-item *ngFor=\"let item of possibilities$ | async\">\n <ion-label>{{ item.text | translate }}</ion-label>\n <ion-radio [value]=\"item.id\"></ion-radio>\n </ion-item>\n </ion-radio-group>\n </ion-col>\n <!-- <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col> -->\n</ion-row>", styles: [":host{width:100%;margin-bottom:1.2rem}:host ion-radio{margin-right:2.4rem}:host ion-item-divider{font-weight:300;--padding-end: .8rem;font-size:1.2rem;--ion-background-color: linear-gradient(90deg, transparent, var(--ion-color-light))}:host ion-item-divider ion-icon{margin-right:1.6rem;font-size:1.6rem;--color: var(--ion-color-primary)}:host ion-item-divider ion-label{--padding: var(--smart-button-padding-left)/2 var(--smart-button-padding-top)/2 var(--smart-button-padding-right)/2 var(--smart-button-padding-bottom)/2}:host ion-item-divider .squere-button{margin:0;font-size:18px;height:36px;width:36px;padding:0;--padding-start: .2em;--padding-end: .2em}:host ion-item-divider .squere-button ion-icon{margin:0;padding:0}\n"] }]
|
|
600
|
+
}] });
|
|
601
|
+
|
|
602
|
+
class FilterCheckComponent extends BaseComponent {
|
|
603
|
+
ngAfterContentInit() {
|
|
604
|
+
this.list$ = combineLatest([this.possibilities$, this.facade.filter$]).pipe((map(([possibilities]) => {
|
|
605
|
+
return possibilities.map(pos => ({
|
|
606
|
+
value: pos,
|
|
607
|
+
isCheck: this.value.some(r => r === pos.id)
|
|
608
|
+
}));
|
|
609
|
+
})));
|
|
610
|
+
}
|
|
611
|
+
onCheckChange(checked, entry) {
|
|
612
|
+
if (checked && !this.value.some(r => r === entry.value.id)) {
|
|
613
|
+
this.value = [
|
|
614
|
+
...this.value,
|
|
615
|
+
entry.value.id
|
|
616
|
+
];
|
|
617
|
+
}
|
|
618
|
+
if (!checked && this.value.some(r => r === entry.value.id)) {
|
|
619
|
+
this.value = this.value.filter(r => r !== entry.value.id);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
/** @nocollapse */ /** @nocollapse */ FilterCheckComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterCheckComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
624
|
+
/** @nocollapse */ /** @nocollapse */ FilterCheckComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: FilterCheckComponent, selector: "smart-crud-filter-check", usesInheritance: true, ngImport: i0, template: "<ion-row>\n <ion-col>\n <ion-item-divider>\n <ion-icon slot=\"start\" name=\"filter-outline\"></ion-icon>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-button *ngIf=\"value && value.length\" slot=\"end\" color=\"danger\" (click)=\"refresh([])\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-item-divider>\n <ion-item *ngFor=\"let entry of list$ | async\">\n <ion-label>{{entry.value.text | translate}}</ion-label>\n <ion-checkbox slot=\"end\" [checked]=\"entry.isCheck\" (ionChange)=\"onCheckChange($event.detail.checked, entry)\"></ion-checkbox>\n </ion-item>\n </ion-col>\n <!-- <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col> -->\n</ion-row>", styles: [":host{width:100%;margin-bottom:1.2rem}:host ion-radio{margin-right:2.4rem}:host ion-item-divider{font-weight:300;--padding-end: .8rem;font-size:1.2rem;--ion-background-color: linear-gradient(90deg, transparent, var(--ion-color-light))}:host ion-item-divider ion-icon{margin-right:1.6rem;font-size:1.6rem;--color: var(--ion-color-primary)}:host ion-item-divider ion-label{--padding: var(--smart-button-padding-left)/2 var(--smart-button-padding-top)/2 var(--smart-button-padding-right)/2 var(--smart-button-padding-bottom)/2}:host ion-item-divider .squere-button{margin:0;font-size:18px;height:36px;width:36px;padding:0;--padding-start: .2em;--padding-end: .2em}:host ion-item-divider .squere-button ion-icon{margin:0;padding:0}\n"], components: [{ type: i1$1.IonRow, selector: "ion-row" }, { type: i1$1.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { type: i1$1.IonItemDivider, selector: "ion-item-divider", inputs: ["color", "mode", "sticky"] }, { type: i1$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { type: i1$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { type: i1$1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { type: i1$1.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { type: i1$1.IonCheckbox, selector: "ion-checkbox", inputs: ["checked", "color", "disabled", "indeterminate", "mode", "name", "value"] }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$1.BooleanValueAccessor, selector: "ion-checkbox,ion-toggle" }], pipes: { "translate": i4.TranslatePipe, "async": i3$1.AsyncPipe } });
|
|
625
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterCheckComponent, decorators: [{
|
|
626
|
+
type: Component,
|
|
627
|
+
args: [{ selector: 'smart-crud-filter-check', template: "<ion-row>\n <ion-col>\n <ion-item-divider>\n <ion-icon slot=\"start\" name=\"filter-outline\"></ion-icon>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-button *ngIf=\"value && value.length\" slot=\"end\" color=\"danger\" (click)=\"refresh([])\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-item-divider>\n <ion-item *ngFor=\"let entry of list$ | async\">\n <ion-label>{{entry.value.text | translate}}</ion-label>\n <ion-checkbox slot=\"end\" [checked]=\"entry.isCheck\" (ionChange)=\"onCheckChange($event.detail.checked, entry)\"></ion-checkbox>\n </ion-item>\n </ion-col>\n <!-- <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col> -->\n</ion-row>", styles: [":host{width:100%;margin-bottom:1.2rem}:host ion-radio{margin-right:2.4rem}:host ion-item-divider{font-weight:300;--padding-end: .8rem;font-size:1.2rem;--ion-background-color: linear-gradient(90deg, transparent, var(--ion-color-light))}:host ion-item-divider ion-icon{margin-right:1.6rem;font-size:1.6rem;--color: var(--ion-color-primary)}:host ion-item-divider ion-label{--padding: var(--smart-button-padding-left)/2 var(--smart-button-padding-top)/2 var(--smart-button-padding-right)/2 var(--smart-button-padding-bottom)/2}:host ion-item-divider .squere-button{margin:0;font-size:18px;height:36px;width:36px;padding:0;--padding-start: .2em;--padding-end: .2em}:host ion-item-divider .squere-button ion-icon{margin:0;padding:0}\n"] }]
|
|
628
|
+
}] });
|
|
629
|
+
|
|
630
|
+
class FilterFlagComponent extends BaseComponent {
|
|
631
|
+
}
|
|
632
|
+
/** @nocollapse */ /** @nocollapse */ FilterFlagComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterFlagComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
633
|
+
/** @nocollapse */ /** @nocollapse */ FilterFlagComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: FilterFlagComponent, selector: "smart-crud-filter-flag", usesInheritance: true, ngImport: i0, template: "<ion-row>\n <ion-col>\n <div class=\"flag-container\">\n <ion-label position=\"static\">\n {{ item.label | translate }}\n </ion-label>\n <ion-checkbox [(ngModel)]=\"value\" slot=\"end\"></ion-checkbox>\n </div>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>", styles: [":host{width:100%}:host .flag-container{width:100%;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;padding:0 1.2rem 0 0}:host .flag-container ion-label{--color: var(--smart-color-dark);vertical-align:middle;padding:1.6rem 0}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"], components: [{ type: i1$1.IonRow, selector: "ion-row" }, { type: i1$1.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { type: i1$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { type: i1$1.IonCheckbox, selector: "ion-checkbox", inputs: ["checked", "color", "disabled", "indeterminate", "mode", "name", "value"] }, { type: i1$1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { type: i1$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }], directives: [{ type: i1$1.BooleanValueAccessor, selector: "ion-checkbox,ion-toggle" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i4.TranslatePipe } });
|
|
634
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterFlagComponent, decorators: [{
|
|
635
|
+
type: Component,
|
|
636
|
+
args: [{ selector: 'smart-crud-filter-flag', template: "<ion-row>\n <ion-col>\n <div class=\"flag-container\">\n <ion-label position=\"static\">\n {{ item.label | translate }}\n </ion-label>\n <ion-checkbox [(ngModel)]=\"value\" slot=\"end\"></ion-checkbox>\n </div>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>", styles: [":host{width:100%}:host .flag-container{width:100%;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;padding:0 1.2rem 0 0}:host .flag-container ion-label{--color: var(--smart-color-dark);vertical-align:middle;padding:1.6rem 0}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"] }]
|
|
637
|
+
}] });
|
|
638
|
+
|
|
639
|
+
class FilterIntComponent extends BaseComponent {
|
|
640
|
+
constructor() {
|
|
641
|
+
super(...arguments);
|
|
642
|
+
this._subscriptions = new Subscription();
|
|
643
|
+
this.advanced = false;
|
|
644
|
+
}
|
|
645
|
+
get allowAdvanced() {
|
|
646
|
+
return this.item?.type === '=';
|
|
647
|
+
}
|
|
648
|
+
ngOnInit() {
|
|
649
|
+
super.ngOnInit();
|
|
650
|
+
}
|
|
651
|
+
ngOnDestroy() {
|
|
652
|
+
if (this._subscriptions) {
|
|
653
|
+
this._subscriptions.unsubscribe();
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
/** @nocollapse */ /** @nocollapse */ FilterIntComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterIntComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
658
|
+
/** @nocollapse */ /** @nocollapse */ FilterIntComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: FilterIntComponent, selector: "smart-crud-filter-int", usesInheritance: true, ngImport: i0, template: "<ion-row>\n <ion-col>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"value\" type=\"number\" step=\"1\"></ion-input>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"allowAdvanced\">\n <ion-button (click)=\"advanced = !advanced\" class=\"squere-button\" [disabled]=\"minValue || maxValue\">\n <ion-icon *ngIf=\"!advanced\" slot=\"icon-only\" name=\"settings-outline\"></ion-icon>\n <ion-icon *ngIf=\"advanced\" slot=\"icon-only\" name=\"settings\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>\n<ion-row *ngIf=\"(advanced || minValue || maxValue) && allowAdvanced\">\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'from' | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"minValue\" type=\"number\" step=\"1\"></ion-input>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"minValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '>=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'to' | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"maxValue\" type=\"number\" step=\"1\"></ion-input>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"maxValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '<=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"], components: [{ type: i1$1.IonRow, selector: "ion-row" }, { type: i1$1.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { type: i1$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { type: i1$1.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "debounce", "disabled", "enterkeyhint", "inputmode", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "size", "spellcheck", "step", "type", "value"] }, { type: i1$1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { type: i1$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { type: i1$1.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }], directives: [{ type: i1$1.NumericValueAccessor, selector: "ion-input[type=number]" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i4.TranslatePipe } });
|
|
659
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterIntComponent, decorators: [{
|
|
660
|
+
type: Component,
|
|
661
|
+
args: [{ selector: 'smart-crud-filter-int', template: "<ion-row>\n <ion-col>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"value\" type=\"number\" step=\"1\"></ion-input>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"allowAdvanced\">\n <ion-button (click)=\"advanced = !advanced\" class=\"squere-button\" [disabled]=\"minValue || maxValue\">\n <ion-icon *ngIf=\"!advanced\" slot=\"icon-only\" name=\"settings-outline\"></ion-icon>\n <ion-icon *ngIf=\"advanced\" slot=\"icon-only\" name=\"settings\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>\n<ion-row *ngIf=\"(advanced || minValue || maxValue) && allowAdvanced\">\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'from' | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"minValue\" type=\"number\" step=\"1\"></ion-input>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"minValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '>=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'to' | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"maxValue\" type=\"number\" step=\"1\"></ion-input>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"maxValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '<=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"] }]
|
|
662
|
+
}] });
|
|
663
|
+
|
|
664
|
+
class FilterTextComponent extends BaseComponent {
|
|
665
|
+
}
|
|
666
|
+
/** @nocollapse */ /** @nocollapse */ FilterTextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
667
|
+
/** @nocollapse */ /** @nocollapse */ FilterTextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: FilterTextComponent, selector: "smart-crud-filter-text", usesInheritance: true, ngImport: i0, template: "<ion-row>\n <ion-col>\n <ion-label position=\"floating\">\n {{ item.label | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"value\"></ion-input>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"], components: [{ type: i1$1.IonRow, selector: "ion-row" }, { type: i1$1.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { type: i1$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { type: i1$1.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "debounce", "disabled", "enterkeyhint", "inputmode", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "size", "spellcheck", "step", "type", "value"] }, { type: i1$1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { type: i1$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }], directives: [{ type: i1$1.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i4.TranslatePipe } });
|
|
668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterTextComponent, decorators: [{
|
|
669
|
+
type: Component,
|
|
670
|
+
args: [{ selector: 'smart-crud-filter-text', template: "<ion-row>\n <ion-col>\n <ion-label position=\"floating\">\n {{ item.label | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"value\"></ion-input>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"] }]
|
|
671
|
+
}] });
|
|
672
|
+
|
|
673
|
+
class FilterComponent {
|
|
674
|
+
constructor() {
|
|
675
|
+
this.FieldType = FieldType;
|
|
676
|
+
}
|
|
677
|
+
ngOnInit() { }
|
|
678
|
+
}
|
|
679
|
+
/** @nocollapse */ /** @nocollapse */ FilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
680
|
+
/** @nocollapse */ /** @nocollapse */ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: FilterComponent, selector: "smart-crud-filter", inputs: { item: "item", filter: "filter" }, ngImport: i0, template: "<ion-item [ngSwitch]=\"item.fieldType\">\n <smart-crud-filter-date\n *ngSwitchCase=\"FieldType.date\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-date>\n\n <smart-crud-filter-date-with-edit\n *ngSwitchCase=\"FieldType.dateWithEdit\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-date-with-edit>\n\n <smart-crud-filter-radio\n *ngSwitchCase=\"FieldType.radio\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-radio>\n\n <smart-crud-filter-check\n *ngSwitchCase=\"FieldType.check\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-check>\n\n <smart-crud-filter-flag\n *ngSwitchCase=\"FieldType.flag\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-flag>\n\n <smart-crud-filter-int\n *ngSwitchCase=\"FieldType.int\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-int>\n\n <smart-crud-filter-text\n *ngSwitchDefault\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-text>\n</ion-item>\n", styles: [""], components: [{ type: i1$1.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { type: FilterDateComponent, selector: "smart-crud-filter-date" }, { type: FilterDateWithEditComponent, selector: "smart-crud-filter-date-with-edit" }, { type: FilterRadioComponent, selector: "smart-crud-filter-radio" }, { type: FilterCheckComponent, selector: "smart-crud-filter-check" }, { type: FilterFlagComponent, selector: "smart-crud-filter-flag" }, { type: FilterIntComponent, selector: "smart-crud-filter-int" }, { type: FilterTextComponent, selector: "smart-crud-filter-text" }], directives: [{ type: i3$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }] });
|
|
681
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FilterComponent, decorators: [{
|
|
682
|
+
type: Component,
|
|
683
|
+
args: [{ selector: "smart-crud-filter", template: "<ion-item [ngSwitch]=\"item.fieldType\">\n <smart-crud-filter-date\n *ngSwitchCase=\"FieldType.date\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-date>\n\n <smart-crud-filter-date-with-edit\n *ngSwitchCase=\"FieldType.dateWithEdit\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-date-with-edit>\n\n <smart-crud-filter-radio\n *ngSwitchCase=\"FieldType.radio\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-radio>\n\n <smart-crud-filter-check\n *ngSwitchCase=\"FieldType.check\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-check>\n\n <smart-crud-filter-flag\n *ngSwitchCase=\"FieldType.flag\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-flag>\n\n <smart-crud-filter-int\n *ngSwitchCase=\"FieldType.int\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-int>\n\n <smart-crud-filter-text\n *ngSwitchDefault\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-text>\n</ion-item>\n", styles: [""] }]
|
|
684
|
+
}], ctorParameters: function () { return []; }, propDecorators: { item: [{
|
|
685
|
+
type: Input
|
|
686
|
+
}], filter: [{
|
|
687
|
+
type: Input
|
|
688
|
+
}] } });
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* This component is only to use in crud module
|
|
692
|
+
* @requires CrudModule
|
|
693
|
+
* @example
|
|
694
|
+
*
|
|
695
|
+
* html: <smart-crud-filters></smart-crud-filters>
|
|
696
|
+
*
|
|
697
|
+
* use on the model:
|
|
698
|
+
* @Model({
|
|
699
|
+
titleKey: 'body',
|
|
700
|
+
filters: [
|
|
701
|
+
{
|
|
702
|
+
label: 'testNegation',
|
|
703
|
+
key: 'body',
|
|
704
|
+
type: '!=',
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
label: 'fromDate',
|
|
708
|
+
key: 'createDate',
|
|
709
|
+
type: '<=',
|
|
710
|
+
fieldType: FieldType.dateWithEdit
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
label: 'select',
|
|
714
|
+
key: 'type',
|
|
715
|
+
type: '=',
|
|
716
|
+
fieldType: FieldType.radio,
|
|
717
|
+
possibilities$: of([
|
|
718
|
+
{
|
|
719
|
+
id: 1, text: 'Test 1'
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
id: 2, text: 'Test 2'
|
|
723
|
+
}
|
|
724
|
+
])
|
|
725
|
+
}
|
|
726
|
+
]
|
|
727
|
+
})
|
|
728
|
+
*
|
|
729
|
+
* use on the field (list.filter property):
|
|
730
|
+
* @Field({
|
|
731
|
+
create: modifyMetdata,
|
|
732
|
+
update: {
|
|
733
|
+
...modifyMetdata,
|
|
734
|
+
multi: true
|
|
735
|
+
},
|
|
736
|
+
type: FieldType.longText,
|
|
737
|
+
details: true,
|
|
738
|
+
list: {
|
|
739
|
+
order: 2,
|
|
740
|
+
filter: true
|
|
741
|
+
}
|
|
742
|
+
})
|
|
743
|
+
body: string;
|
|
744
|
+
*/
|
|
745
|
+
class FiltersComponent {
|
|
746
|
+
constructor(menuService, config, facade, styleService, elementRef) {
|
|
747
|
+
this.menuService = menuService;
|
|
748
|
+
this.config = config;
|
|
749
|
+
this.facade = facade;
|
|
750
|
+
this.styleService = styleService;
|
|
751
|
+
this.elementRef = elementRef;
|
|
752
|
+
}
|
|
753
|
+
async onClose() {
|
|
754
|
+
await this.menuService.closeEnd();
|
|
755
|
+
}
|
|
756
|
+
ngOnInit() {
|
|
757
|
+
this.styleService.init(this.elementRef);
|
|
758
|
+
const modelFilters = getModelOptions(this.config.type).filters;
|
|
759
|
+
this.list = [
|
|
760
|
+
...(modelFilters ? modelFilters.map(item => {
|
|
761
|
+
if (!item.label) {
|
|
762
|
+
item.label = 'MODEL.' + item.key;
|
|
763
|
+
}
|
|
764
|
+
return item;
|
|
765
|
+
}) : []),
|
|
766
|
+
...getModelFieldsWithOptions(new this.config.type())
|
|
767
|
+
.filter(item => item.options?.list?.filter)
|
|
768
|
+
.map(item => ({
|
|
769
|
+
key: item.key,
|
|
770
|
+
type: item.options.type === FieldType.text || item.options.type === FieldType.longText
|
|
771
|
+
? '~=' : '=',
|
|
772
|
+
label: 'MODEL.' + item.key,
|
|
773
|
+
fieldType: item.options.type
|
|
774
|
+
}))
|
|
775
|
+
];
|
|
776
|
+
this.filter$ = this.facade.filter$;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
/** @nocollapse */ /** @nocollapse */ FiltersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FiltersComponent, deps: [{ token: i3.MenuService }, { token: CrudConfig }, { token: CrudFacade }, { token: i3.StyleService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
780
|
+
/** @nocollapse */ /** @nocollapse */ FiltersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: FiltersComponent, selector: "smart-crud-filters", inputs: { hideMenu: "hideMenu" }, ngImport: i0, template: "<ion-header [hidden]=\"hideMenu\">\n <ion-toolbar>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"onClose()\">\n <ion-icon slot=\"icon-only\" name=\"close\"> </ion-icon>\n </ion-button>\n </ion-buttons>\n <ion-title>{{ 'filters' | translate }}</ion-title>\n </ion-toolbar>\n</ion-header>\n<div class=\"filter-content\">\n <ng-container *ngIf=\"filter$ | async; let filter\">\n <ng-container *ngFor=\"let item of list\">\n <smart-crud-filter [item]=\"item\" [filter]=\"filter\"></smart-crud-filter>\n </ng-container>\n </ng-container>\n <div class=\"menu-bottom-space\">\n \n </div>\n</div>", styles: [":host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}ion-modal :host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}ion-modal :host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}}@media only screen and (max-width: 420px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}ion-modal :host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}}:host ion-toolbar.ios{height:4.6rem;--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}@media only screen and (max-width: 420px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}@media only screen and (max-width: 420px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}:host ion-toolbar.ios.toolbar-searchbar ion-buttons{height:var(--smart-button-height);margin:.4rem}:host ion-toolbar ion-menu-button{color:var(--ion-color-light)}:host ion-toolbar ion-buttons.ios{height:var(--smart-button-height);margin:0}:host .filter-content{display:block;overflow:auto;overflow-x:hidden}:host .menu-bottom-space{height:75px}\n"], components: [{ type: i1$1.IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { type: i1$1.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { type: i1$1.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { type: i1$1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { type: i1$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { type: i1$1.IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { type: FilterComponent, selector: "smart-crud-filter", inputs: ["item", "filter"] }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i4.TranslatePipe, "async": i3$1.AsyncPipe } });
|
|
781
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FiltersComponent, decorators: [{
|
|
782
|
+
type: Component,
|
|
783
|
+
args: [{ selector: 'smart-crud-filters', template: "<ion-header [hidden]=\"hideMenu\">\n <ion-toolbar>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"onClose()\">\n <ion-icon slot=\"icon-only\" name=\"close\"> </ion-icon>\n </ion-button>\n </ion-buttons>\n <ion-title>{{ 'filters' | translate }}</ion-title>\n </ion-toolbar>\n</ion-header>\n<div class=\"filter-content\">\n <ng-container *ngIf=\"filter$ | async; let filter\">\n <ng-container *ngFor=\"let item of list\">\n <smart-crud-filter [item]=\"item\" [filter]=\"filter\"></smart-crud-filter>\n </ng-container>\n </ng-container>\n <div class=\"menu-bottom-space\">\n \n </div>\n</div>", styles: [":host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}ion-modal :host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}ion-modal :host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}}@media only screen and (max-width: 420px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}ion-modal :host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}}:host ion-toolbar.ios{height:4.6rem;--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}@media only screen and (max-width: 420px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}@media only screen and (max-width: 420px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}:host ion-toolbar.ios.toolbar-searchbar ion-buttons{height:var(--smart-button-height);margin:.4rem}:host ion-toolbar ion-menu-button{color:var(--ion-color-light)}:host ion-toolbar ion-buttons.ios{height:var(--smart-button-height);margin:0}:host .filter-content{display:block;overflow:auto;overflow-x:hidden}:host .menu-bottom-space{height:75px}\n"] }]
|
|
784
|
+
}], ctorParameters: function () { return [{ type: i3.MenuService }, { type: CrudConfig }, { type: CrudFacade }, { type: i3.StyleService }, { type: i0.ElementRef }]; }, propDecorators: { hideMenu: [{
|
|
785
|
+
type: Input
|
|
786
|
+
}] } });
|
|
787
|
+
|
|
788
|
+
class FiltersConfigComponent {
|
|
789
|
+
constructor(facade, styleService, elementRef) {
|
|
790
|
+
this.facade = facade;
|
|
791
|
+
this.styleService = styleService;
|
|
792
|
+
this.elementRef = elementRef;
|
|
793
|
+
}
|
|
794
|
+
onRemoveQuery(item) {
|
|
795
|
+
const index = this.facade.filter.query.indexOf(item);
|
|
796
|
+
if (index > -1) {
|
|
797
|
+
this.facade.filter.query.splice(index, 1);
|
|
798
|
+
}
|
|
799
|
+
this.facade.read(this.facade.filter);
|
|
800
|
+
}
|
|
801
|
+
ngOnInit() {
|
|
802
|
+
this.styleService.init(this.elementRef);
|
|
803
|
+
this.query$ = this.facade.filter$.pipe(map(filter => {
|
|
804
|
+
return filter?.query?.filter(i => !i.hidden);
|
|
805
|
+
}));
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
/** @nocollapse */ /** @nocollapse */ FiltersConfigComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FiltersConfigComponent, deps: [{ token: CrudFacade }, { token: i3.StyleService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
809
|
+
/** @nocollapse */ /** @nocollapse */ FiltersConfigComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: FiltersConfigComponent, selector: "smart-crud-filters-config", ngImport: i0, template: " <ng-container *ngIf=\"query$ | async; let query\">\n <ion-toolbar *ngIf=\"query?.length\">\n <ion-chip *ngFor=\"let item of query\" (click)=\"onRemoveQuery(item)\" color=\"medium\" outline=\"true\">\n <ion-icon name=\"filter-circle-outline\" color=\"primary\"></ion-icon>\n <ion-label>{{ 'MODEL.' + item.key | translate }} {{ item.type }} {{ item.value | translate }}</ion-label>\n <ion-icon name=\"close\" color=\"danger\"></ion-icon>\n </ion-chip>\n </ion-toolbar>\n</ng-container>", styles: [":host ion-label{font-size:calc(var(--default-font-size) - 2px)}\n"], components: [{ type: i1$1.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { type: i1$1.IonChip, selector: "ion-chip", inputs: ["color", "disabled", "mode", "outline"] }, { type: i1$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { type: i1$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i3$1.AsyncPipe, "translate": i4.TranslatePipe } });
|
|
810
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FiltersConfigComponent, decorators: [{
|
|
811
|
+
type: Component,
|
|
812
|
+
args: [{ selector: 'smart-crud-filters-config', template: " <ng-container *ngIf=\"query$ | async; let query\">\n <ion-toolbar *ngIf=\"query?.length\">\n <ion-chip *ngFor=\"let item of query\" (click)=\"onRemoveQuery(item)\" color=\"medium\" outline=\"true\">\n <ion-icon name=\"filter-circle-outline\" color=\"primary\"></ion-icon>\n <ion-label>{{ 'MODEL.' + item.key | translate }} {{ item.type }} {{ item.value | translate }}</ion-label>\n <ion-icon name=\"close\" color=\"danger\"></ion-icon>\n </ion-chip>\n </ion-toolbar>\n</ng-container>", styles: [":host ion-label{font-size:calc(var(--default-font-size) - 2px)}\n"] }]
|
|
813
|
+
}], ctorParameters: function () { return [{ type: CrudFacade }, { type: i3.StyleService }, { type: i0.ElementRef }]; } });
|
|
814
|
+
|
|
815
|
+
class FormOptionsPipe {
|
|
816
|
+
constructor(modelPossibilitiesProvider) {
|
|
817
|
+
this.modelPossibilitiesProvider = modelPossibilitiesProvider;
|
|
818
|
+
}
|
|
819
|
+
transform(item, mode, type, uniqueProvider, inputComponents) {
|
|
820
|
+
if (!mode || !type)
|
|
821
|
+
return null;
|
|
822
|
+
let possibilities = {};
|
|
823
|
+
if (type && this.modelPossibilitiesProvider) {
|
|
824
|
+
possibilities = this.modelPossibilitiesProvider.get(type);
|
|
825
|
+
}
|
|
826
|
+
if (mode === "create") {
|
|
827
|
+
return {
|
|
828
|
+
mode: "create",
|
|
829
|
+
possibilities,
|
|
830
|
+
inputComponents,
|
|
831
|
+
uniqueProvider,
|
|
832
|
+
model: new type(),
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
const model = new type();
|
|
837
|
+
if (item) {
|
|
838
|
+
Object.keys(item).forEach((key) => {
|
|
839
|
+
model[key] = item[key];
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
return {
|
|
843
|
+
mode: mode,
|
|
844
|
+
uniqueProvider,
|
|
845
|
+
possibilities: possibilities,
|
|
846
|
+
inputComponents,
|
|
847
|
+
model: model,
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
/** @nocollapse */ /** @nocollapse */ FormOptionsPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FormOptionsPipe, deps: [{ token: CRUD_MODEL_POSSIBILITIES_PROVIDER, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
853
|
+
/** @nocollapse */ /** @nocollapse */ FormOptionsPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FormOptionsPipe, name: "smartFormOptions" });
|
|
854
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: FormOptionsPipe, decorators: [{
|
|
855
|
+
type: Pipe,
|
|
856
|
+
args: [{
|
|
857
|
+
name: "smartFormOptions",
|
|
858
|
+
}]
|
|
859
|
+
}], ctorParameters: function () { return [{ type: ICrudModelPossibilitiesProvider, decorators: [{
|
|
860
|
+
type: Optional
|
|
861
|
+
}, {
|
|
862
|
+
type: Inject,
|
|
863
|
+
args: [CRUD_MODEL_POSSIBILITIES_PROVIDER]
|
|
864
|
+
}] }]; } });
|
|
865
|
+
|
|
866
|
+
class MultiselectComponent {
|
|
867
|
+
constructor(facade, config, menuService) {
|
|
868
|
+
this.facade = facade;
|
|
869
|
+
this.config = config;
|
|
870
|
+
this.menuService = menuService;
|
|
871
|
+
this.buttonOptions = {
|
|
872
|
+
click: async () => {
|
|
873
|
+
const result = this._list.map(item => {
|
|
874
|
+
return {
|
|
875
|
+
...this._changes,
|
|
876
|
+
id: item.id
|
|
877
|
+
};
|
|
878
|
+
});
|
|
879
|
+
this.facade.updatePartialMany(result);
|
|
880
|
+
await this.menuService.closeEnd();
|
|
881
|
+
},
|
|
882
|
+
confirm: true
|
|
883
|
+
};
|
|
884
|
+
this.list$ = this.facade.multiSelected$.pipe(tap(list => {
|
|
885
|
+
this.lock = true;
|
|
886
|
+
const model = new this.config.type();
|
|
887
|
+
const fieldsWithOptions = getModelFieldsWithOptions(model)
|
|
888
|
+
.filter(f => f.options.update?.multi);
|
|
889
|
+
fieldsWithOptions.forEach(({ key }) => {
|
|
890
|
+
const uniques = _.uniq(list.map(i => i[key]));
|
|
891
|
+
if (uniques.length === 1) {
|
|
892
|
+
model[key] = uniques[0];
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
this.item = model;
|
|
896
|
+
}));
|
|
897
|
+
}
|
|
898
|
+
async onClose() {
|
|
899
|
+
await this.menuService.closeEnd();
|
|
900
|
+
}
|
|
901
|
+
onPartialChange(changes, list) {
|
|
902
|
+
this.lock = false;
|
|
903
|
+
this._list = list;
|
|
904
|
+
this._changes = changes;
|
|
905
|
+
}
|
|
906
|
+
onValidChange(valid) {
|
|
907
|
+
this.valid = valid;
|
|
908
|
+
}
|
|
909
|
+
ngOnInit() {
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
/** @nocollapse */ /** @nocollapse */ MultiselectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: MultiselectComponent, deps: [{ token: CrudFacade }, { token: CrudConfig }, { token: i3.MenuService }], target: i0.ɵɵFactoryTarget.Component });
|
|
913
|
+
/** @nocollapse */ /** @nocollapse */ MultiselectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: MultiselectComponent, selector: "smart-crud-multiselect", ngImport: i0, template: "<ng-container *ngIf=\"list$ | async; let list\">\n <ion-header>\n <ion-toolbar>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"onClose()\">\n <ion-icon slot=\"icon-only\" name=\"close\"> </ion-icon>\n </ion-button>\n </ion-buttons>\n <ion-title>{{ 'selected' | translate }}: {{ list?.length }}</ion-title>\n </ion-toolbar>\n </ion-header>\n\n <div *ngIf=\"item\">\n <smart-form [options]=\"item | smartFormOptions : 'multiUpdate' : config.type\" (valuePartialChange)=\"onPartialChange($event, list)\" (validChange)=\"onValidChange($event)\"></smart-form>\n\n <smart-button style=\"float: right\" [disabled]=\"lock || !valid\" [options]=\"buttonOptions\">{{ 'change' | translate }}</smart-button>\n </div>\n</ng-container>", styles: [":host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}}@media only screen and (max-width: 420px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}}:host ion-toolbar.ios{height:4.6rem;--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}@media only screen and (max-width: 420px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}@media only screen and (max-width: 420px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}:host ion-toolbar ion-menu-button{color:var(--ion-color-light)}:host ion-toolbar ion-buttons.ios{height:var(--smart-button-height);margin:0}\n"], components: [{ type: i1$1.IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { type: i1$1.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { type: i1$1.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { type: i1$1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { type: i1$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { type: i1$1.IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { type: i3.FormComponent, selector: "smart-form", inputs: ["options"], outputs: ["invokeSubmit", "valueChange", "valuePartialChange", "validChange"] }, { type: i3.ButtonComponent, selector: "smart-button", inputs: ["options", "disabled"] }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3$1.AsyncPipe, "translate": i4.TranslatePipe, "smartFormOptions": FormOptionsPipe } });
|
|
914
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: MultiselectComponent, decorators: [{
|
|
915
|
+
type: Component,
|
|
916
|
+
args: [{ selector: 'smart-crud-multiselect', template: "<ng-container *ngIf=\"list$ | async; let list\">\n <ion-header>\n <ion-toolbar>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"onClose()\">\n <ion-icon slot=\"icon-only\" name=\"close\"> </ion-icon>\n </ion-button>\n </ion-buttons>\n <ion-title>{{ 'selected' | translate }}: {{ list?.length }}</ion-title>\n </ion-toolbar>\n </ion-header>\n\n <div *ngIf=\"item\">\n <smart-form [options]=\"item | smartFormOptions : 'multiUpdate' : config.type\" (valuePartialChange)=\"onPartialChange($event, list)\" (validChange)=\"onValidChange($event)\"></smart-form>\n\n <smart-button style=\"float: right\" [disabled]=\"lock || !valid\" [options]=\"buttonOptions\">{{ 'change' | translate }}</smart-button>\n </div>\n</ng-container>", styles: [":host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}}@media only screen and (max-width: 420px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}}:host ion-toolbar.ios{height:4.6rem;--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}@media only screen and (max-width: 420px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}@media only screen and (max-width: 420px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}:host ion-toolbar ion-menu-button{color:var(--ion-color-light)}:host ion-toolbar ion-buttons.ios{height:var(--smart-button-height);margin:0}\n"] }]
|
|
917
|
+
}], ctorParameters: function () { return [{ type: CrudFacade }, { type: CrudConfig }, { type: i3.MenuService }]; } });
|
|
918
|
+
|
|
919
|
+
class CrudListGroupService {
|
|
920
|
+
constructor(facade) {
|
|
921
|
+
this.facade = facade;
|
|
922
|
+
this._destroyed = [];
|
|
923
|
+
}
|
|
924
|
+
change(val, item, groups, force) {
|
|
925
|
+
if (val || force) {
|
|
926
|
+
item.changed = true;
|
|
927
|
+
let current = this.facade.filter.query.find(q => q.key === item.key && q.type === '=');
|
|
928
|
+
if (!current) {
|
|
929
|
+
current = {
|
|
930
|
+
key: item.key,
|
|
931
|
+
type: "=",
|
|
932
|
+
value: null
|
|
933
|
+
};
|
|
934
|
+
this.facade.filter.query.push(current);
|
|
935
|
+
}
|
|
936
|
+
current.value = item.value;
|
|
937
|
+
current.hidden = true;
|
|
938
|
+
this.facade.read({
|
|
939
|
+
...this.facade.filter,
|
|
940
|
+
offset: 0
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
destroy(groups) {
|
|
945
|
+
this._destroyed = [
|
|
946
|
+
...(this._destroyed ? this._destroyed : []),
|
|
947
|
+
...groups.filter(g => g.changed)
|
|
948
|
+
];
|
|
949
|
+
this.refresh();
|
|
950
|
+
}
|
|
951
|
+
refresh() {
|
|
952
|
+
const list = this._destroyed;
|
|
953
|
+
this._destroyed = [];
|
|
954
|
+
const newQuery = this.facade.filter.query.filter(q => !list.some(i => q.key === i.key));
|
|
955
|
+
this.facade.read({
|
|
956
|
+
...this.facade.filter,
|
|
957
|
+
query: newQuery,
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
/** @nocollapse */ /** @nocollapse */ CrudListGroupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudListGroupService, deps: [{ token: CrudFacade }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
962
|
+
/** @nocollapse */ /** @nocollapse */ CrudListGroupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudListGroupService });
|
|
963
|
+
__decorate([
|
|
964
|
+
debounce(250),
|
|
965
|
+
__metadata("design:type", Function),
|
|
966
|
+
__metadata("design:paramtypes", []),
|
|
967
|
+
__metadata("design:returntype", void 0)
|
|
968
|
+
], CrudListGroupService.prototype, "refresh", null);
|
|
969
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudListGroupService, decorators: [{
|
|
970
|
+
type: Injectable
|
|
971
|
+
}], ctorParameters: function () { return [{ type: CrudFacade }]; }, propDecorators: { refresh: [] } });
|
|
972
|
+
|
|
973
|
+
class GroupComponent extends BaseComponent$1 {
|
|
974
|
+
constructor(styleService, elementRef, facade, cd, groupService) {
|
|
975
|
+
super();
|
|
976
|
+
this.styleService = styleService;
|
|
977
|
+
this.elementRef = elementRef;
|
|
978
|
+
this.facade = facade;
|
|
979
|
+
this.cd = cd;
|
|
980
|
+
this.groupService = groupService;
|
|
981
|
+
}
|
|
982
|
+
change(val, item, force = false) {
|
|
983
|
+
this.groups.filter(i => i.value !== item.value || i.key !== item.key).forEach(i => {
|
|
984
|
+
i.show = false;
|
|
985
|
+
});
|
|
986
|
+
this.groupService.change(val, item, this.groups, force);
|
|
987
|
+
if (val) {
|
|
988
|
+
setTimeout(() => {
|
|
989
|
+
item.show = val;
|
|
990
|
+
this.cd.detectChanges();
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
else {
|
|
994
|
+
item.show = val;
|
|
995
|
+
this.cd.detectChanges();
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
ngOnInit() {
|
|
999
|
+
this.styleService.init(this.elementRef);
|
|
1000
|
+
}
|
|
1001
|
+
ngOnDestroy() {
|
|
1002
|
+
this.groupService.destroy(this.groups);
|
|
1003
|
+
super.ngOnDestroy();
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
/** @nocollapse */ /** @nocollapse */ GroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: GroupComponent, deps: [{ token: i3.StyleService }, { token: i0.ElementRef }, { token: CrudFacade }, { token: i0.ChangeDetectorRef }, { token: CrudListGroupService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1007
|
+
/** @nocollapse */ /** @nocollapse */ GroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: GroupComponent, selector: "smart-crud-group", inputs: { groups: "groups", listOptions: "listOptions" }, usesInheritance: true, ngImport: i0, template: "<smart-accordion *ngFor=\"let item of groups\" [(show)]=\"item.show\" (showChange)=\"change($event, item)\">\n <smart-accordion-header [ngClass]=\"{ 'accordion-show': item.show }\">{{ item.text | translate }}</smart-accordion-header>\n <smart-accordion-body>\n <smart-list *ngIf=\"item.show && !item.children && listOptions\" [options]=\"listOptions\"></smart-list>\n <div *ngIf=\"item.children\" style=\"margin-left: 50px\">\n <smart-crud-group [groups]=\"item.children\" [listOptions]=\"listOptions\"></smart-crud-group>\n </div>\n </smart-accordion-body>\n</smart-accordion>\n<br/><br/><br/>", styles: [".accordion-show{font-weight:bolder}\n"], components: [{ type: i3.AccordionComponent, selector: "smart-accordion", inputs: ["show"], outputs: ["showChange"] }, { type: i3.AccordionHeaderComponent, selector: "smart-accordion-header" }, { type: i3.AccordionBodyComponent, selector: "smart-accordion-body" }, { type: i3.ListComponent, selector: "smart-list", inputs: ["options"] }, { type: GroupComponent, selector: "smart-crud-group", inputs: ["groups", "listOptions"] }], directives: [{ type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i4.TranslatePipe } });
|
|
1008
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: GroupComponent, decorators: [{
|
|
1009
|
+
type: Component,
|
|
1010
|
+
args: [{ selector: 'smart-crud-group', template: "<smart-accordion *ngFor=\"let item of groups\" [(show)]=\"item.show\" (showChange)=\"change($event, item)\">\n <smart-accordion-header [ngClass]=\"{ 'accordion-show': item.show }\">{{ item.text | translate }}</smart-accordion-header>\n <smart-accordion-body>\n <smart-list *ngIf=\"item.show && !item.children && listOptions\" [options]=\"listOptions\"></smart-list>\n <div *ngIf=\"item.children\" style=\"margin-left: 50px\">\n <smart-crud-group [groups]=\"item.children\" [listOptions]=\"listOptions\"></smart-crud-group>\n </div>\n </smart-accordion-body>\n</smart-accordion>\n<br/><br/><br/>", styles: [".accordion-show{font-weight:bolder}\n"] }]
|
|
1011
|
+
}], ctorParameters: function () { return [{ type: i3.StyleService }, { type: i0.ElementRef }, { type: CrudFacade }, { type: i0.ChangeDetectorRef }, { type: CrudListGroupService }]; }, propDecorators: { groups: [{
|
|
1012
|
+
type: Input
|
|
1013
|
+
}], listOptions: [{
|
|
1014
|
+
type: Input
|
|
1015
|
+
}] } });
|
|
1016
|
+
|
|
1017
|
+
class SocketService {
|
|
1018
|
+
}
|
|
1019
|
+
/** @nocollapse */ /** @nocollapse */ SocketService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SocketService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1020
|
+
/** @nocollapse */ /** @nocollapse */ SocketService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SocketService });
|
|
1021
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SocketService, decorators: [{
|
|
1022
|
+
type: Injectable
|
|
1023
|
+
}] });
|
|
1024
|
+
class NotSocketService {
|
|
1025
|
+
}
|
|
1026
|
+
/** @nocollapse */ /** @nocollapse */ NotSocketService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: NotSocketService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1027
|
+
/** @nocollapse */ /** @nocollapse */ NotSocketService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: NotSocketService });
|
|
1028
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: NotSocketService, decorators: [{
|
|
1029
|
+
type: Injectable
|
|
1030
|
+
}] });
|
|
1031
|
+
|
|
1032
|
+
class CrudPipesModule {
|
|
1033
|
+
}
|
|
1034
|
+
/** @nocollapse */ /** @nocollapse */ CrudPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1035
|
+
/** @nocollapse */ /** @nocollapse */ CrudPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudPipesModule, declarations: [FormOptionsPipe], exports: [FormOptionsPipe] });
|
|
1036
|
+
/** @nocollapse */ /** @nocollapse */ CrudPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudPipesModule });
|
|
1037
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudPipesModule, decorators: [{
|
|
1038
|
+
type: NgModule,
|
|
1039
|
+
args: [{
|
|
1040
|
+
declarations: [
|
|
1041
|
+
FormOptionsPipe
|
|
1042
|
+
],
|
|
1043
|
+
exports: [
|
|
1044
|
+
FormOptionsPipe
|
|
1045
|
+
]
|
|
1046
|
+
}]
|
|
1047
|
+
}] });
|
|
1048
|
+
|
|
1049
|
+
class CrudService {
|
|
1050
|
+
constructor(config, http, socket) {
|
|
1051
|
+
this.config = config;
|
|
1052
|
+
this.http = http;
|
|
1053
|
+
this.socket = socket;
|
|
1054
|
+
this._formatMap = {
|
|
1055
|
+
csv: "text/csv",
|
|
1056
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
// changes(criteria: { id?: string } = {}): Observable<ItemChangedData> {
|
|
1060
|
+
// this.socket.emit("changes", criteria);
|
|
1061
|
+
// return this.socket.fromEvent("changes");
|
|
1062
|
+
// }
|
|
1063
|
+
// TODO : Location is null
|
|
1064
|
+
create(item) {
|
|
1065
|
+
return this.http
|
|
1066
|
+
.post(this.config.apiUrl, item, { observe: "response" })
|
|
1067
|
+
.pipe(map((response) => {
|
|
1068
|
+
const location = response.headers["Location"];
|
|
1069
|
+
if (!location)
|
|
1070
|
+
return null;
|
|
1071
|
+
const array = location.split("/");
|
|
1072
|
+
return array[array.length - 1];
|
|
1073
|
+
}));
|
|
1074
|
+
}
|
|
1075
|
+
createMany(items, options) {
|
|
1076
|
+
return this.http.post(this.config.apiUrl + "/bulk?mode=" + options.mode, items);
|
|
1077
|
+
}
|
|
1078
|
+
getById(id) {
|
|
1079
|
+
return this.http.get(this.config.apiUrl + "/" + id);
|
|
1080
|
+
}
|
|
1081
|
+
getList(filter = null) {
|
|
1082
|
+
return this.http.get(this.config.apiUrl + this.getQuery(filter));
|
|
1083
|
+
}
|
|
1084
|
+
exportList(filter = null, format) {
|
|
1085
|
+
if (!format) {
|
|
1086
|
+
format = "csv";
|
|
1087
|
+
}
|
|
1088
|
+
if (format === "xlsx") {
|
|
1089
|
+
return this.http
|
|
1090
|
+
.get(this.config.apiUrl + this.getQuery(filter), {
|
|
1091
|
+
headers: {
|
|
1092
|
+
"Content-Type": this._formatMap[format],
|
|
1093
|
+
},
|
|
1094
|
+
observe: "response",
|
|
1095
|
+
reportProgress: false,
|
|
1096
|
+
responseType: "blob",
|
|
1097
|
+
})
|
|
1098
|
+
.pipe(map((res) => {
|
|
1099
|
+
const downloadLink = document.createElement("a");
|
|
1100
|
+
const blob = res.body;
|
|
1101
|
+
const url = URL.createObjectURL(blob);
|
|
1102
|
+
downloadLink.href = url;
|
|
1103
|
+
downloadLink.download = "data." + format;
|
|
1104
|
+
document.body.appendChild(downloadLink);
|
|
1105
|
+
downloadLink.click();
|
|
1106
|
+
document.body.removeChild(downloadLink);
|
|
1107
|
+
}));
|
|
1108
|
+
}
|
|
1109
|
+
return this.http
|
|
1110
|
+
.get(this.config.apiUrl + this.getQuery(filter), {
|
|
1111
|
+
headers: {
|
|
1112
|
+
"Content-Type": this._formatMap[format],
|
|
1113
|
+
},
|
|
1114
|
+
responseType: "text",
|
|
1115
|
+
})
|
|
1116
|
+
.pipe(map((res) => {
|
|
1117
|
+
const downloadLink = document.createElement("a");
|
|
1118
|
+
const blob = new Blob(["\ufeff", res]);
|
|
1119
|
+
const url = URL.createObjectURL(blob);
|
|
1120
|
+
downloadLink.href = url;
|
|
1121
|
+
downloadLink.download = "data." + format;
|
|
1122
|
+
document.body.appendChild(downloadLink);
|
|
1123
|
+
downloadLink.click();
|
|
1124
|
+
document.body.removeChild(downloadLink);
|
|
1125
|
+
}));
|
|
1126
|
+
}
|
|
1127
|
+
update(item) {
|
|
1128
|
+
return this.http.put(this.config.apiUrl + "/" + item.id, item);
|
|
1129
|
+
}
|
|
1130
|
+
updatePartial(item) {
|
|
1131
|
+
return this.http.patch(this.config.apiUrl + "/" + item.id, item);
|
|
1132
|
+
}
|
|
1133
|
+
updatePartialMany(items) {
|
|
1134
|
+
return forkJoin(items.map(item => {
|
|
1135
|
+
return this.updatePartial(item);
|
|
1136
|
+
}));
|
|
1137
|
+
}
|
|
1138
|
+
delete(id) {
|
|
1139
|
+
return this.http.delete(this.config.apiUrl + "/" + id);
|
|
1140
|
+
}
|
|
1141
|
+
getQuery(filter) {
|
|
1142
|
+
let query = "";
|
|
1143
|
+
if (filter && filter.searchText) {
|
|
1144
|
+
query += "&$search=" + filter.searchText;
|
|
1145
|
+
}
|
|
1146
|
+
if (filter && filter.limit) {
|
|
1147
|
+
query += `&limit=${filter.limit}&offset=${filter.offset ? filter.offset : 0}`;
|
|
1148
|
+
}
|
|
1149
|
+
if (filter && filter.sortBy) {
|
|
1150
|
+
query += `&sort=${(filter.sortDesc ? "-" : "") + filter.sortBy}`;
|
|
1151
|
+
}
|
|
1152
|
+
if (filter && filter.query) {
|
|
1153
|
+
filter.query.forEach((q) => {
|
|
1154
|
+
if (q.value
|
|
1155
|
+
&& (typeof q.value === 'string')
|
|
1156
|
+
&& q.value.match(/^-?\d+$/)
|
|
1157
|
+
&& q.value[0] !== "'"
|
|
1158
|
+
&& q.value[0] !== '"') {
|
|
1159
|
+
query += "&" + q.key + q.type + `'${q.value}'`;
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
query += "&" + q.key + q.type + q.value;
|
|
1163
|
+
}
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
return query ? "?" + query.replace("&", "") : "";
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
/** @nocollapse */ /** @nocollapse */ CrudService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudService, deps: [{ token: CrudConfig }, { token: i2$1.HttpClient }, { token: SocketService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1170
|
+
/** @nocollapse */ /** @nocollapse */ CrudService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudService });
|
|
1171
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudService, decorators: [{
|
|
1172
|
+
type: Injectable
|
|
1173
|
+
}], ctorParameters: function () { return [{ type: CrudConfig }, { type: i2$1.HttpClient }, { type: SocketService, decorators: [{
|
|
1174
|
+
type: Optional
|
|
1175
|
+
}] }]; } });
|
|
1176
|
+
|
|
1177
|
+
class CrudEffects {
|
|
1178
|
+
constructor(actions$, service, config, store, state) {
|
|
1179
|
+
this.actions$ = actions$;
|
|
1180
|
+
this.service = service;
|
|
1181
|
+
this.config = config;
|
|
1182
|
+
this.store = store;
|
|
1183
|
+
this.state = state;
|
|
1184
|
+
}
|
|
1185
|
+
init() {
|
|
1186
|
+
const metadata = Reflect.getMetadata(this.config.entity, CrudEffects);
|
|
1187
|
+
if (metadata)
|
|
1188
|
+
return;
|
|
1189
|
+
Reflect.defineMetadata(this.config.entity, true, CrudEffects);
|
|
1190
|
+
this.actions$.subscribe((action) => {
|
|
1191
|
+
switch (action.type) {
|
|
1192
|
+
case `[${this.config.entity}] Create`:
|
|
1193
|
+
this.service
|
|
1194
|
+
.create(action.item)
|
|
1195
|
+
.pipe(tap(() => this.store.dispatch(createSuccess(this.config.entity, action.item))), catchError((error) => {
|
|
1196
|
+
this.store.dispatch(createFailure(this.config.entity, action.item, error));
|
|
1197
|
+
return of();
|
|
1198
|
+
}))
|
|
1199
|
+
.subscribe();
|
|
1200
|
+
break;
|
|
1201
|
+
case `[${this.config.entity}] Create Success`:
|
|
1202
|
+
const createState = this.state.getValue()[this.config.entity];
|
|
1203
|
+
this.store.dispatch(read(this.config.entity, createState.filter ? { ...createState.filter, offset: 0 } : null));
|
|
1204
|
+
break;
|
|
1205
|
+
case `[${this.config.entity}] Create Many`:
|
|
1206
|
+
this.service
|
|
1207
|
+
.createMany(action.data.items, action.data.options)
|
|
1208
|
+
.pipe(tap(() => this.store.dispatch(createManySuccess(this.config.entity, {
|
|
1209
|
+
items: action.data.items,
|
|
1210
|
+
options: action.data.options,
|
|
1211
|
+
}))), catchError((error) => {
|
|
1212
|
+
this.store.dispatch(createManyFailure(this.config.entity, {
|
|
1213
|
+
items: action.data.items,
|
|
1214
|
+
options: action.data.options,
|
|
1215
|
+
}, error));
|
|
1216
|
+
return of();
|
|
1217
|
+
}))
|
|
1218
|
+
.subscribe();
|
|
1219
|
+
break;
|
|
1220
|
+
case `[${this.config.entity}] Create Many Success`:
|
|
1221
|
+
const createManyState = this.state.getValue()[this.config.entity];
|
|
1222
|
+
this.store.dispatch(read(this.config.entity, createManyState.filter
|
|
1223
|
+
? { ...createManyState.filter, offset: 0 }
|
|
1224
|
+
: null));
|
|
1225
|
+
break;
|
|
1226
|
+
case `[${this.config.entity}] Read`:
|
|
1227
|
+
this.service
|
|
1228
|
+
.getList(action.filter)
|
|
1229
|
+
.pipe(tap((result) => this.store.dispatch(readSuccess(this.config.entity, action.filter, result))), catchError((error) => {
|
|
1230
|
+
this.store.dispatch(readFailure(this.config.entity, action.filter, error));
|
|
1231
|
+
return of();
|
|
1232
|
+
}))
|
|
1233
|
+
.subscribe();
|
|
1234
|
+
break;
|
|
1235
|
+
case `[${this.config.entity}] Export`:
|
|
1236
|
+
this.service
|
|
1237
|
+
.exportList(action.filter, action.format)
|
|
1238
|
+
.pipe(tap((result) => this.store.dispatch(exportListSuccess(this.config.entity, action.filter))), catchError((error) => {
|
|
1239
|
+
this.store.dispatch(exportListFailure(this.config.entity, action.filter, error));
|
|
1240
|
+
return of();
|
|
1241
|
+
}))
|
|
1242
|
+
.subscribe();
|
|
1243
|
+
break;
|
|
1244
|
+
case `[${this.config.entity}] Select`:
|
|
1245
|
+
this.service
|
|
1246
|
+
.getById(action.id)
|
|
1247
|
+
.pipe(tap((result) => this.store.dispatch(selectSuccess(this.config.entity, action.id, result))), catchError((error) => {
|
|
1248
|
+
this.store.dispatch(selectFailure(this.config.entity, action.id, error));
|
|
1249
|
+
return of();
|
|
1250
|
+
}))
|
|
1251
|
+
.subscribe();
|
|
1252
|
+
break;
|
|
1253
|
+
case `[${this.config.entity}] Update`:
|
|
1254
|
+
this.service
|
|
1255
|
+
.updatePartial(action.item)
|
|
1256
|
+
.pipe(tap(() => this.store.dispatch(updateSuccess(this.config.entity, action.item))), catchError((error) => {
|
|
1257
|
+
this.store.dispatch(updateFailure(this.config.entity, action.item, error));
|
|
1258
|
+
this.store.dispatch(read(this.config.entity));
|
|
1259
|
+
return of();
|
|
1260
|
+
}))
|
|
1261
|
+
.subscribe();
|
|
1262
|
+
break;
|
|
1263
|
+
case `[${this.config.entity}] Update Success`:
|
|
1264
|
+
this.store
|
|
1265
|
+
.pipe(select$1(getCrudFilter(this.config.entity)), first())
|
|
1266
|
+
.subscribe((filter) => {
|
|
1267
|
+
this.store.dispatch(read(this.config.entity, {
|
|
1268
|
+
...filter,
|
|
1269
|
+
offset: 0,
|
|
1270
|
+
}));
|
|
1271
|
+
this.store.dispatch(select(this.config.entity, action.item.id));
|
|
1272
|
+
});
|
|
1273
|
+
break;
|
|
1274
|
+
case `[${this.config.entity}] Update partial`:
|
|
1275
|
+
this.service
|
|
1276
|
+
.updatePartial(action.item)
|
|
1277
|
+
.pipe(tap(() => this.store.dispatch(updatePartialSuccess(this.config.entity, action.item))), catchError((error) => {
|
|
1278
|
+
this.store.dispatch(updatePartialFailure(this.config.entity, action.item, error));
|
|
1279
|
+
this.store.dispatch(read(this.config.entity));
|
|
1280
|
+
return of();
|
|
1281
|
+
}))
|
|
1282
|
+
.subscribe();
|
|
1283
|
+
break;
|
|
1284
|
+
case `[${this.config.entity}] Update partial Success`:
|
|
1285
|
+
this.store
|
|
1286
|
+
.pipe(select$1(getCrudFilter(this.config.entity)), first())
|
|
1287
|
+
.subscribe((filter) => {
|
|
1288
|
+
this.store.dispatch(read(this.config.entity, {
|
|
1289
|
+
...filter,
|
|
1290
|
+
offset: 0,
|
|
1291
|
+
}));
|
|
1292
|
+
this.store.dispatch(select(this.config.entity, action.item.id));
|
|
1293
|
+
});
|
|
1294
|
+
break;
|
|
1295
|
+
case `[${this.config.entity}] Update partial many`:
|
|
1296
|
+
this.service
|
|
1297
|
+
.updatePartialMany(action.items)
|
|
1298
|
+
.pipe(tap(() => this.store.dispatch(updatePartialManySuccess(this.config.entity, action.items))), catchError((error) => {
|
|
1299
|
+
this.store.dispatch(updatePartialManyFailure(this.config.entity, action.items, error));
|
|
1300
|
+
this.store.dispatch(read(this.config.entity));
|
|
1301
|
+
return of();
|
|
1302
|
+
}))
|
|
1303
|
+
.subscribe();
|
|
1304
|
+
break;
|
|
1305
|
+
case `[${this.config.entity}] Update partial many Success`:
|
|
1306
|
+
this.store
|
|
1307
|
+
.pipe(select$1(getCrudFilter(this.config.entity)), first())
|
|
1308
|
+
.subscribe((filter) => {
|
|
1309
|
+
this.store.dispatch(read(this.config.entity, {
|
|
1310
|
+
...filter,
|
|
1311
|
+
offset: 0,
|
|
1312
|
+
}));
|
|
1313
|
+
});
|
|
1314
|
+
break;
|
|
1315
|
+
case `[${this.config.entity}] Delete`:
|
|
1316
|
+
this.service
|
|
1317
|
+
.delete(action.id)
|
|
1318
|
+
.pipe(tap(() => this.store.dispatch(deleteSuccess(this.config.entity, action.id))), catchError((error) => {
|
|
1319
|
+
this.store.dispatch(deleteFailure(this.config.entity, action.id, error));
|
|
1320
|
+
return of();
|
|
1321
|
+
}))
|
|
1322
|
+
.subscribe();
|
|
1323
|
+
break;
|
|
1324
|
+
case `[${this.config.entity}] Delete Success`:
|
|
1325
|
+
this.store
|
|
1326
|
+
.pipe(select$1(getCrudFilter(this.config.entity)), first())
|
|
1327
|
+
.subscribe((filter) => {
|
|
1328
|
+
this.store.dispatch(read(this.config.entity, {
|
|
1329
|
+
...filter,
|
|
1330
|
+
offset: 0,
|
|
1331
|
+
}));
|
|
1332
|
+
});
|
|
1333
|
+
break;
|
|
1334
|
+
default:
|
|
1335
|
+
break;
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
/** @nocollapse */ /** @nocollapse */ CrudEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudEffects, deps: [{ token: i1.ActionsSubject }, { token: CrudService }, { token: CrudConfig }, { token: i1.Store }, { token: i1.State }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1341
|
+
/** @nocollapse */ /** @nocollapse */ CrudEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudEffects });
|
|
1342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudEffects, decorators: [{
|
|
1343
|
+
type: Injectable
|
|
1344
|
+
}], ctorParameters: function () { return [{ type: i1.ActionsSubject }, { type: CrudService }, { type: CrudConfig }, { type: i1.Store }, { type: i1.State }]; } });
|
|
1345
|
+
|
|
1346
|
+
class CrudListPaginationFactory {
|
|
1347
|
+
constructor(facade) {
|
|
1348
|
+
this.facade = facade;
|
|
1349
|
+
}
|
|
1350
|
+
async create(options) {
|
|
1351
|
+
return {
|
|
1352
|
+
mode: options.mode,
|
|
1353
|
+
limit: options.limit,
|
|
1354
|
+
loadNextPage: () => {
|
|
1355
|
+
if (!options.provider.getLinks() || !options.provider.getLinks().next)
|
|
1356
|
+
return Promise.resolve(false);
|
|
1357
|
+
return new Promise((res) => {
|
|
1358
|
+
const sub = this.facade.loaded$.subscribe((l) => {
|
|
1359
|
+
if (l) {
|
|
1360
|
+
// if (sub && !sub.closed) sub.unsubscribe();
|
|
1361
|
+
setTimeout(() => {
|
|
1362
|
+
res(options.provider.getLinks() &&
|
|
1363
|
+
options.provider.getLinks().next);
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
});
|
|
1367
|
+
this.facade.read({
|
|
1368
|
+
...options.provider.getFilter(),
|
|
1369
|
+
offset: options.provider.getFilter().offset +
|
|
1370
|
+
options.provider.getFilter().limit,
|
|
1371
|
+
});
|
|
1372
|
+
});
|
|
1373
|
+
},
|
|
1374
|
+
loadPrevPage: () => {
|
|
1375
|
+
if (!options.provider.getLinks() || !options.provider.getLinks().prev)
|
|
1376
|
+
return Promise.resolve(false);
|
|
1377
|
+
return new Promise((res) => {
|
|
1378
|
+
const sub = this.facade.loaded$.subscribe((l) => {
|
|
1379
|
+
if (l) {
|
|
1380
|
+
// if (sub && !sub.closed) sub.unsubscribe();
|
|
1381
|
+
setTimeout(() => {
|
|
1382
|
+
res(options.provider.getLinks() &&
|
|
1383
|
+
options.provider.getLinks().prev);
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
this.facade.read({
|
|
1388
|
+
...options.provider.getFilter(),
|
|
1389
|
+
offset: options.provider.getFilter().offset -
|
|
1390
|
+
options.provider.getFilter().limit,
|
|
1391
|
+
});
|
|
1392
|
+
});
|
|
1393
|
+
},
|
|
1394
|
+
page$: this.facade.filter$.pipe(map((f) => {
|
|
1395
|
+
return f?.limit ? f.offset / f.limit + 1 : 0;
|
|
1396
|
+
})),
|
|
1397
|
+
totalPages$: combineLatest(this.facade.filter$, this.facade.totalCount$).pipe(map(([filter, totalCount]) => {
|
|
1398
|
+
return filter?.limit ? Math.ceil(totalCount / filter.limit) : 0;
|
|
1399
|
+
})),
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
/** @nocollapse */ /** @nocollapse */ CrudListPaginationFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudListPaginationFactory, deps: [{ token: CrudFacade }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1404
|
+
/** @nocollapse */ /** @nocollapse */ CrudListPaginationFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudListPaginationFactory });
|
|
1405
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudListPaginationFactory, decorators: [{
|
|
1406
|
+
type: Injectable
|
|
1407
|
+
}], ctorParameters: function () { return [{ type: CrudFacade }]; } });
|
|
1408
|
+
|
|
1409
|
+
const COMPONENTS = [
|
|
1410
|
+
ExportComponent,
|
|
1411
|
+
FilterComponent,
|
|
1412
|
+
FilterTextComponent,
|
|
1413
|
+
FiltersConfigComponent,
|
|
1414
|
+
FilterDateComponent,
|
|
1415
|
+
FilterDateWithEditComponent,
|
|
1416
|
+
FilterRadioComponent,
|
|
1417
|
+
FiltersComponent,
|
|
1418
|
+
FilterFlagComponent,
|
|
1419
|
+
FilterCheckComponent,
|
|
1420
|
+
FilterIntComponent,
|
|
1421
|
+
MultiselectComponent,
|
|
1422
|
+
GroupComponent
|
|
1423
|
+
];
|
|
1424
|
+
class CrudComponentsModule {
|
|
1425
|
+
}
|
|
1426
|
+
/** @nocollapse */ /** @nocollapse */ CrudComponentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1427
|
+
/** @nocollapse */ /** @nocollapse */ CrudComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudComponentsModule, declarations: [ExportComponent,
|
|
1428
|
+
FilterComponent,
|
|
1429
|
+
FilterTextComponent,
|
|
1430
|
+
FiltersConfigComponent,
|
|
1431
|
+
FilterDateComponent,
|
|
1432
|
+
FilterDateWithEditComponent,
|
|
1433
|
+
FilterRadioComponent,
|
|
1434
|
+
FiltersComponent,
|
|
1435
|
+
FilterFlagComponent,
|
|
1436
|
+
FilterCheckComponent,
|
|
1437
|
+
FilterIntComponent,
|
|
1438
|
+
MultiselectComponent,
|
|
1439
|
+
GroupComponent], imports: [
|
|
1440
|
+
//AuthSharedModule,
|
|
1441
|
+
StoreModule,
|
|
1442
|
+
SharedModule,
|
|
1443
|
+
CrudPipesModule,
|
|
1444
|
+
FormsModule,
|
|
1445
|
+
CommonModule], exports: [CrudPipesModule, ExportComponent,
|
|
1446
|
+
FilterComponent,
|
|
1447
|
+
FilterTextComponent,
|
|
1448
|
+
FiltersConfigComponent,
|
|
1449
|
+
FilterDateComponent,
|
|
1450
|
+
FilterDateWithEditComponent,
|
|
1451
|
+
FilterRadioComponent,
|
|
1452
|
+
FiltersComponent,
|
|
1453
|
+
FilterFlagComponent,
|
|
1454
|
+
FilterCheckComponent,
|
|
1455
|
+
FilterIntComponent,
|
|
1456
|
+
MultiselectComponent,
|
|
1457
|
+
GroupComponent] });
|
|
1458
|
+
/** @nocollapse */ /** @nocollapse */ CrudComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudComponentsModule, providers: [
|
|
1459
|
+
CrudService,
|
|
1460
|
+
CrudEffects,
|
|
1461
|
+
CrudFacade,
|
|
1462
|
+
SocketService,
|
|
1463
|
+
CrudListPaginationFactory,
|
|
1464
|
+
], imports: [[
|
|
1465
|
+
//AuthSharedModule,
|
|
1466
|
+
StoreModule,
|
|
1467
|
+
SharedModule,
|
|
1468
|
+
CrudPipesModule,
|
|
1469
|
+
FormsModule,
|
|
1470
|
+
CommonModule
|
|
1471
|
+
], CrudPipesModule] });
|
|
1472
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudComponentsModule, decorators: [{
|
|
1473
|
+
type: NgModule,
|
|
1474
|
+
args: [{
|
|
1475
|
+
declarations: [
|
|
1476
|
+
...COMPONENTS
|
|
1477
|
+
],
|
|
1478
|
+
imports: [
|
|
1479
|
+
//AuthSharedModule,
|
|
1480
|
+
StoreModule,
|
|
1481
|
+
SharedModule,
|
|
1482
|
+
CrudPipesModule,
|
|
1483
|
+
FormsModule,
|
|
1484
|
+
CommonModule
|
|
1485
|
+
],
|
|
1486
|
+
exports: [
|
|
1487
|
+
CrudPipesModule,
|
|
1488
|
+
...COMPONENTS
|
|
1489
|
+
],
|
|
1490
|
+
providers: [
|
|
1491
|
+
CrudService,
|
|
1492
|
+
CrudEffects,
|
|
1493
|
+
CrudFacade,
|
|
1494
|
+
SocketService,
|
|
1495
|
+
CrudListPaginationFactory,
|
|
1496
|
+
]
|
|
1497
|
+
}]
|
|
1498
|
+
}] });
|
|
1499
|
+
|
|
1500
|
+
const initialState = {
|
|
1501
|
+
loaded: false
|
|
1502
|
+
};
|
|
1503
|
+
const crudReducer = (state = initialState, action, entity) => {
|
|
1504
|
+
switch (action.type) {
|
|
1505
|
+
case `[${entity}] Create`:
|
|
1506
|
+
return {
|
|
1507
|
+
...state,
|
|
1508
|
+
loaded: false,
|
|
1509
|
+
error: null
|
|
1510
|
+
};
|
|
1511
|
+
case `[${entity}] Create Success`:
|
|
1512
|
+
return {
|
|
1513
|
+
...state,
|
|
1514
|
+
loaded: true,
|
|
1515
|
+
error: null
|
|
1516
|
+
};
|
|
1517
|
+
case `[${entity}] Create Failure`:
|
|
1518
|
+
return {
|
|
1519
|
+
...state,
|
|
1520
|
+
loaded: true,
|
|
1521
|
+
error: action.error
|
|
1522
|
+
};
|
|
1523
|
+
case `[${entity}] Create Many`:
|
|
1524
|
+
return {
|
|
1525
|
+
...state,
|
|
1526
|
+
loaded: false,
|
|
1527
|
+
error: null
|
|
1528
|
+
};
|
|
1529
|
+
case `[${entity}] Create Many Success`:
|
|
1530
|
+
return {
|
|
1531
|
+
...state,
|
|
1532
|
+
loaded: true,
|
|
1533
|
+
error: null
|
|
1534
|
+
};
|
|
1535
|
+
case `[${entity}] Create Many Failure`:
|
|
1536
|
+
return {
|
|
1537
|
+
...state,
|
|
1538
|
+
loaded: true,
|
|
1539
|
+
error: action.error
|
|
1540
|
+
};
|
|
1541
|
+
case `[${entity}] Export`:
|
|
1542
|
+
return {
|
|
1543
|
+
...state,
|
|
1544
|
+
loaded: false
|
|
1545
|
+
};
|
|
1546
|
+
case `[${entity}] Export Success`:
|
|
1547
|
+
return {
|
|
1548
|
+
...state,
|
|
1549
|
+
loaded: true
|
|
1550
|
+
};
|
|
1551
|
+
case `[${entity}] Export Failure`:
|
|
1552
|
+
return {
|
|
1553
|
+
...state,
|
|
1554
|
+
loaded: true
|
|
1555
|
+
};
|
|
1556
|
+
case `[${entity}] Read`:
|
|
1557
|
+
return {
|
|
1558
|
+
...state,
|
|
1559
|
+
loaded: false,
|
|
1560
|
+
filter: action.filter,
|
|
1561
|
+
error: null,
|
|
1562
|
+
totalCount: null,
|
|
1563
|
+
links: null,
|
|
1564
|
+
};
|
|
1565
|
+
case `[${entity}] Read Success`:
|
|
1566
|
+
let list = [];
|
|
1567
|
+
if (action.filter
|
|
1568
|
+
&& action.filter.offset
|
|
1569
|
+
&& state.list
|
|
1570
|
+
&& action.filter.paginationMode !== PaginationMode.singlePage) {
|
|
1571
|
+
state.list.forEach(i => {
|
|
1572
|
+
list.push(i);
|
|
1573
|
+
});
|
|
1574
|
+
list = [
|
|
1575
|
+
...list,
|
|
1576
|
+
...action.result.data
|
|
1577
|
+
];
|
|
1578
|
+
}
|
|
1579
|
+
else {
|
|
1580
|
+
list = action.result.data;
|
|
1581
|
+
}
|
|
1582
|
+
return {
|
|
1583
|
+
...state,
|
|
1584
|
+
loaded: true,
|
|
1585
|
+
list,
|
|
1586
|
+
totalCount: action.result.totalCount,
|
|
1587
|
+
links: action.result.links,
|
|
1588
|
+
error: null
|
|
1589
|
+
};
|
|
1590
|
+
case `[${entity}] Read Failure`:
|
|
1591
|
+
return {
|
|
1592
|
+
...state,
|
|
1593
|
+
loaded: true,
|
|
1594
|
+
error: action.error
|
|
1595
|
+
};
|
|
1596
|
+
case `[${entity}] Select`:
|
|
1597
|
+
return {
|
|
1598
|
+
...state,
|
|
1599
|
+
loaded: false,
|
|
1600
|
+
selected: null,
|
|
1601
|
+
error: null
|
|
1602
|
+
};
|
|
1603
|
+
case `[${entity}] Select Success`:
|
|
1604
|
+
return {
|
|
1605
|
+
...state,
|
|
1606
|
+
loaded: true,
|
|
1607
|
+
selected: action.item,
|
|
1608
|
+
error: null
|
|
1609
|
+
};
|
|
1610
|
+
case `[${entity}] Select Failure`:
|
|
1611
|
+
return {
|
|
1612
|
+
...state,
|
|
1613
|
+
loaded: true,
|
|
1614
|
+
error: action.error
|
|
1615
|
+
};
|
|
1616
|
+
case `[${entity}] MultiSelect`:
|
|
1617
|
+
return {
|
|
1618
|
+
...state,
|
|
1619
|
+
multiSelected: [...action.items]
|
|
1620
|
+
};
|
|
1621
|
+
case `[${entity}] Unselect`:
|
|
1622
|
+
return {
|
|
1623
|
+
...state,
|
|
1624
|
+
loaded: true,
|
|
1625
|
+
selected: null,
|
|
1626
|
+
error: null
|
|
1627
|
+
};
|
|
1628
|
+
case `[${entity}] Update`:
|
|
1629
|
+
return {
|
|
1630
|
+
...state,
|
|
1631
|
+
loaded: false,
|
|
1632
|
+
error: null
|
|
1633
|
+
};
|
|
1634
|
+
case `[${entity}] Update Success`:
|
|
1635
|
+
return {
|
|
1636
|
+
...state,
|
|
1637
|
+
loaded: true,
|
|
1638
|
+
error: null
|
|
1639
|
+
};
|
|
1640
|
+
case `[${entity}] Update Failure`:
|
|
1641
|
+
return {
|
|
1642
|
+
...state,
|
|
1643
|
+
loaded: true,
|
|
1644
|
+
error: action.error
|
|
1645
|
+
};
|
|
1646
|
+
case `[${entity}] Update partial`:
|
|
1647
|
+
return {
|
|
1648
|
+
...state,
|
|
1649
|
+
loaded: false,
|
|
1650
|
+
error: null
|
|
1651
|
+
};
|
|
1652
|
+
case `[${entity}] Update partial Success`:
|
|
1653
|
+
return {
|
|
1654
|
+
...state,
|
|
1655
|
+
loaded: true,
|
|
1656
|
+
error: null
|
|
1657
|
+
};
|
|
1658
|
+
case `[${entity}] Update partial Failure`:
|
|
1659
|
+
return {
|
|
1660
|
+
...state,
|
|
1661
|
+
loaded: true,
|
|
1662
|
+
error: action.error
|
|
1663
|
+
};
|
|
1664
|
+
case `[${entity}] Update partial many`:
|
|
1665
|
+
return {
|
|
1666
|
+
...state,
|
|
1667
|
+
loaded: false,
|
|
1668
|
+
error: null
|
|
1669
|
+
};
|
|
1670
|
+
case `[${entity}] Update partial many Success`:
|
|
1671
|
+
return {
|
|
1672
|
+
...state,
|
|
1673
|
+
multiSelected: [],
|
|
1674
|
+
loaded: true,
|
|
1675
|
+
error: null
|
|
1676
|
+
};
|
|
1677
|
+
case `[${entity}] Update partial many Failure`:
|
|
1678
|
+
return {
|
|
1679
|
+
...state,
|
|
1680
|
+
loaded: true,
|
|
1681
|
+
error: action.error
|
|
1682
|
+
};
|
|
1683
|
+
case `[${entity}] Delete`:
|
|
1684
|
+
return {
|
|
1685
|
+
...state,
|
|
1686
|
+
loaded: false,
|
|
1687
|
+
error: null
|
|
1688
|
+
};
|
|
1689
|
+
case `[${entity}] Delete Success`:
|
|
1690
|
+
return {
|
|
1691
|
+
...state,
|
|
1692
|
+
loaded: true,
|
|
1693
|
+
error: null
|
|
1694
|
+
};
|
|
1695
|
+
case `[${entity}] Delete Failure`:
|
|
1696
|
+
return {
|
|
1697
|
+
...state,
|
|
1698
|
+
loaded: true,
|
|
1699
|
+
error: action.error
|
|
1700
|
+
};
|
|
1701
|
+
default:
|
|
1702
|
+
return state;
|
|
1703
|
+
}
|
|
1704
|
+
};
|
|
1705
|
+
function getReducer(entity) {
|
|
1706
|
+
return (state, action) => {
|
|
1707
|
+
return crudReducer(state, action, entity);
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
class PageService {
|
|
1712
|
+
constructor(authService, config) {
|
|
1713
|
+
this.authService = authService;
|
|
1714
|
+
this.config = config;
|
|
1715
|
+
}
|
|
1716
|
+
checkPermissions() {
|
|
1717
|
+
const val = this.config;
|
|
1718
|
+
const modelOptions = getModelOptions(val.type);
|
|
1719
|
+
if (val.add &&
|
|
1720
|
+
modelOptions.create &&
|
|
1721
|
+
modelOptions.create.permissions &&
|
|
1722
|
+
!this.authService.expectPermissions(modelOptions.create.permissions)) {
|
|
1723
|
+
val.add = false;
|
|
1724
|
+
}
|
|
1725
|
+
if (val.edit &&
|
|
1726
|
+
modelOptions.update &&
|
|
1727
|
+
modelOptions.update.permissions &&
|
|
1728
|
+
!this.authService.expectPermissions(modelOptions.update.permissions)) {
|
|
1729
|
+
val.edit = false;
|
|
1730
|
+
}
|
|
1731
|
+
if (val.remove &&
|
|
1732
|
+
modelOptions.remove &&
|
|
1733
|
+
modelOptions.remove.permissions &&
|
|
1734
|
+
!this.authService.expectPermissions(modelOptions.remove.permissions)) {
|
|
1735
|
+
val.remove = false;
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
/** @nocollapse */ /** @nocollapse */ PageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: PageService, deps: [{ token: i3.AuthService }, { token: CrudFullConfig }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1740
|
+
/** @nocollapse */ /** @nocollapse */ PageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: PageService });
|
|
1741
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: PageService, decorators: [{
|
|
1742
|
+
type: Injectable
|
|
1743
|
+
}], ctorParameters: function () { return [{ type: i3.AuthService }, { type: CrudFullConfig }]; } });
|
|
1744
|
+
|
|
1745
|
+
class CrudSearchService {
|
|
1746
|
+
constructor() {
|
|
1747
|
+
this._filterSource = new BehaviorSubject(null);
|
|
1748
|
+
this._enabledSource = new BehaviorSubject(false);
|
|
1749
|
+
this.enabled$ = this._enabledSource.asObservable();
|
|
1750
|
+
this.filter$ = combineLatest([
|
|
1751
|
+
this._filterSource.asObservable(), this.enabled$
|
|
1752
|
+
]).pipe(map(([filter, enabled]) => {
|
|
1753
|
+
if (!enabled)
|
|
1754
|
+
return {};
|
|
1755
|
+
return filter;
|
|
1756
|
+
}));
|
|
1757
|
+
}
|
|
1758
|
+
get filter() {
|
|
1759
|
+
if (!this._enabledSource.value)
|
|
1760
|
+
return {};
|
|
1761
|
+
return this._filterSource.value;
|
|
1762
|
+
}
|
|
1763
|
+
get enabled() {
|
|
1764
|
+
return this._enabledSource.value;
|
|
1765
|
+
}
|
|
1766
|
+
setFilter(val) {
|
|
1767
|
+
this._filterSource.next(val);
|
|
1768
|
+
}
|
|
1769
|
+
setEnabled(val) {
|
|
1770
|
+
this._enabledSource.next(val);
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
/** @nocollapse */ /** @nocollapse */ CrudSearchService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudSearchService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1774
|
+
/** @nocollapse */ /** @nocollapse */ CrudSearchService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudSearchService, providedIn: 'root' });
|
|
1775
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudSearchService, decorators: [{
|
|
1776
|
+
type: Injectable,
|
|
1777
|
+
args: [{
|
|
1778
|
+
providedIn: 'root'
|
|
1779
|
+
}]
|
|
1780
|
+
}] });
|
|
1781
|
+
|
|
1782
|
+
class CrudListPageBaseComponent extends BaseComponent$1 {
|
|
1783
|
+
constructor(config) {
|
|
1784
|
+
super();
|
|
1785
|
+
this.config = config;
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
CrudListPageBaseComponent.smartType = "crud-list-page";
|
|
1789
|
+
/** @nocollapse */ /** @nocollapse */ CrudListPageBaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudListPageBaseComponent, deps: [{ token: CrudFullConfig }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1790
|
+
/** @nocollapse */ /** @nocollapse */ CrudListPageBaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.7", type: CrudListPageBaseComponent, inputs: { listOptions: "listOptions" }, viewQueries: [{ propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0 });
|
|
1791
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudListPageBaseComponent, decorators: [{
|
|
1792
|
+
type: Directive
|
|
1793
|
+
}], ctorParameters: function () { return [{ type: CrudFullConfig }]; }, propDecorators: { contentTpl: [{
|
|
1794
|
+
type: ViewChild,
|
|
1795
|
+
args: ["contentTpl", { read: ViewContainerRef, static: true }]
|
|
1796
|
+
}], listOptions: [{
|
|
1797
|
+
type: Input
|
|
1798
|
+
}] } });
|
|
1799
|
+
|
|
1800
|
+
class ListStandardComponent extends CrudListPageBaseComponent {
|
|
1801
|
+
constructor(facade, config) {
|
|
1802
|
+
super(config);
|
|
1803
|
+
this.facade = facade;
|
|
1804
|
+
this.config = config;
|
|
1805
|
+
this.isSearch$ = this.facade.filter$.pipe(map(filter => {
|
|
1806
|
+
return !!filter?.searchText;
|
|
1807
|
+
}));
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
/** @nocollapse */ /** @nocollapse */ ListStandardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ListStandardComponent, deps: [{ token: CrudFacade }, { token: CrudFullConfig }], target: i0.ɵɵFactoryTarget.Component });
|
|
1811
|
+
/** @nocollapse */ /** @nocollapse */ ListStandardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: ListStandardComponent, selector: "smart-crud-list-standard-page", providers: [
|
|
1812
|
+
CrudListGroupService
|
|
1813
|
+
], usesInheritance: true, ngImport: i0, template: "<smart-crud-filters-config></smart-crud-filters-config>\n<smart-list *ngIf=\"listOptions\"\n [hidden]=\"!(!config.list?.groups || (isSearch$ | async))\"\n [options]=\"listOptions\"\n></smart-list>\n<smart-crud-group *ngIf=\"config.list?.groups && !(isSearch$ | async)\"\n [groups]=\"config.list?.groups\"\n [listOptions]=\"listOptions\"\n>\n</smart-crud-group>", styles: [""], components: [{ type: FiltersConfigComponent, selector: "smart-crud-filters-config" }, { type: i3.ListComponent, selector: "smart-list", inputs: ["options"] }, { type: GroupComponent, selector: "smart-crud-group", inputs: ["groups", "listOptions"] }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3$1.AsyncPipe } });
|
|
1814
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ListStandardComponent, decorators: [{
|
|
1815
|
+
type: Component,
|
|
1816
|
+
args: [{ selector: "smart-crud-list-standard-page", providers: [
|
|
1817
|
+
CrudListGroupService
|
|
1818
|
+
], template: "<smart-crud-filters-config></smart-crud-filters-config>\n<smart-list *ngIf=\"listOptions\"\n [hidden]=\"!(!config.list?.groups || (isSearch$ | async))\"\n [options]=\"listOptions\"\n></smart-list>\n<smart-crud-group *ngIf=\"config.list?.groups && !(isSearch$ | async)\"\n [groups]=\"config.list?.groups\"\n [listOptions]=\"listOptions\"\n>\n</smart-crud-group>", styles: [""] }]
|
|
1819
|
+
}], ctorParameters: function () { return [{ type: CrudFacade }, { type: CrudFullConfig }]; } });
|
|
1820
|
+
|
|
1821
|
+
class ListComponent extends CreateDynamicComponent('crud-list-page') {
|
|
1822
|
+
constructor(facade, router, dynamicComponentLoader, injector, cd, menuService, hardwareService, paginationFacade, styleService, elementRef, pageService, config, searchService, moduleRef, componentFactoryResolver) {
|
|
1823
|
+
super(cd, moduleRef, componentFactoryResolver);
|
|
1824
|
+
this.facade = facade;
|
|
1825
|
+
this.router = router;
|
|
1826
|
+
this.dynamicComponentLoader = dynamicComponentLoader;
|
|
1827
|
+
this.injector = injector;
|
|
1828
|
+
this.cd = cd;
|
|
1829
|
+
this.menuService = menuService;
|
|
1830
|
+
this.hardwareService = hardwareService;
|
|
1831
|
+
this.paginationFacade = paginationFacade;
|
|
1832
|
+
this.styleService = styleService;
|
|
1833
|
+
this.elementRef = elementRef;
|
|
1834
|
+
this.pageService = pageService;
|
|
1835
|
+
this.config = config;
|
|
1836
|
+
this.searchService = searchService;
|
|
1837
|
+
this.moduleRef = moduleRef;
|
|
1838
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
1839
|
+
this.filter$ = this.facade.filter$.pipe(tap((filter) => {
|
|
1840
|
+
this.filter = filter;
|
|
1841
|
+
}));
|
|
1842
|
+
this.dynamicContents = new QueryList();
|
|
1843
|
+
this.facade.links$.pipe(this.takeUntilDestroy).subscribe((links) => {
|
|
1844
|
+
this.links = links;
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
refreshProperties() {
|
|
1848
|
+
this.baseInstance.listOptions = this.listOptions;
|
|
1849
|
+
}
|
|
1850
|
+
async ngOnInit() {
|
|
1851
|
+
await this.pageService.checkPermissions();
|
|
1852
|
+
let newFilter = null;
|
|
1853
|
+
if (this.config.list?.resetQuery === 'beforeInit') {
|
|
1854
|
+
newFilter = {
|
|
1855
|
+
query: this.config.baseQuery ? [...this.config.baseQuery] : [],
|
|
1856
|
+
paginationMode: this.config.list.paginationMode,
|
|
1857
|
+
limit: this.config.pagination ? this.config.pagination.limit : null,
|
|
1858
|
+
offset: this.config.pagination ? 0 : null,
|
|
1859
|
+
sortBy: this.config.sort ? this.config.sort["default"] : null,
|
|
1860
|
+
sortDesc: this.config.sort ? this.config.sort["defaultDesc"] : null,
|
|
1861
|
+
...this.searchService.filter
|
|
1862
|
+
};
|
|
1863
|
+
}
|
|
1864
|
+
else if (this.filter) {
|
|
1865
|
+
newFilter = this.filter;
|
|
1866
|
+
}
|
|
1867
|
+
else {
|
|
1868
|
+
newFilter = {
|
|
1869
|
+
paginationMode: this.config.list.paginationMode,
|
|
1870
|
+
limit: this.searchService.filter?.limit ? this.searchService.filter.limit : this.config.pagination
|
|
1871
|
+
? this.config.pagination.limit : null,
|
|
1872
|
+
offset: this.searchService.filter?.offset || this.searchService.filter?.offset === 0
|
|
1873
|
+
? this.searchService.filter.offset : this.config.pagination ? 0 : null,
|
|
1874
|
+
sortBy: this.searchService.filter?.sortBy ? this.searchService.filter.sortBy : this.config.sort
|
|
1875
|
+
? this.config.sort["default"] : null,
|
|
1876
|
+
sortDesc: this.searchService.filter?.sortDesc ? this.searchService.filter.sortDesc : this.config.sort
|
|
1877
|
+
? this.config.sort["defaultDesc"] : null,
|
|
1878
|
+
query: this.config.baseQuery ? [...this.config.baseQuery] : [],
|
|
1879
|
+
...this.searchService.filter
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
this.facade.read(newFilter);
|
|
1883
|
+
const endButtons = this.getEndButtons();
|
|
1884
|
+
this.pageOptions = {
|
|
1885
|
+
title: this.config.title,
|
|
1886
|
+
search: this.config.search
|
|
1887
|
+
? {
|
|
1888
|
+
text$: this.filter$.pipe(map((f) => (f ? f.searchText : null))),
|
|
1889
|
+
set: (txt) => {
|
|
1890
|
+
if (txt !== this.filter.searchText)
|
|
1891
|
+
this.facade.read({
|
|
1892
|
+
...this.filter,
|
|
1893
|
+
searchText: txt,
|
|
1894
|
+
offset: 0,
|
|
1895
|
+
});
|
|
1896
|
+
},
|
|
1897
|
+
}
|
|
1898
|
+
: null,
|
|
1899
|
+
endButtons: endButtons,
|
|
1900
|
+
};
|
|
1901
|
+
const compiledComponents = await this.dynamicComponentLoader.getComponentsWithFactories({
|
|
1902
|
+
components: [
|
|
1903
|
+
...(this.config.details &&
|
|
1904
|
+
this.config.details["components"] &&
|
|
1905
|
+
this.config.details["components"].top
|
|
1906
|
+
? [this.config.details["components"].top]
|
|
1907
|
+
: []),
|
|
1908
|
+
...(this.config.details &&
|
|
1909
|
+
this.config.details["components"] &&
|
|
1910
|
+
this.config.details["components"].bottom
|
|
1911
|
+
? [this.config.details["components"].bottom]
|
|
1912
|
+
: []),
|
|
1913
|
+
...(this.config.list &&
|
|
1914
|
+
this.config.list["components"] &&
|
|
1915
|
+
this.config.list["components"].top
|
|
1916
|
+
? [this.config.list["components"].top]
|
|
1917
|
+
: []),
|
|
1918
|
+
],
|
|
1919
|
+
});
|
|
1920
|
+
this.listOptions = {
|
|
1921
|
+
provider: {
|
|
1922
|
+
getData: (filter) => {
|
|
1923
|
+
const global = {
|
|
1924
|
+
...this.filter,
|
|
1925
|
+
...filter,
|
|
1926
|
+
};
|
|
1927
|
+
this.facade.read(global);
|
|
1928
|
+
},
|
|
1929
|
+
onChangeMultiSelected: async (list) => {
|
|
1930
|
+
if (list.length && !this.menuService.openedEnd) {
|
|
1931
|
+
await this.menuService.openEnd({
|
|
1932
|
+
injector: this.injector,
|
|
1933
|
+
component: MultiselectComponent,
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
else if (!list.length && this.menuService.openedEnd) {
|
|
1937
|
+
await this.menuService.closeEnd();
|
|
1938
|
+
}
|
|
1939
|
+
this.facade.multiSelect(list);
|
|
1940
|
+
},
|
|
1941
|
+
list$: this.facade.list$,
|
|
1942
|
+
loading$: this.facade.loaded$.pipe(map((l) => !l)),
|
|
1943
|
+
},
|
|
1944
|
+
cellPipe: this.config.list ? this.config.list.cellPipe : null,
|
|
1945
|
+
mode: this.config.list?.mode,
|
|
1946
|
+
type: this.config.type,
|
|
1947
|
+
details: this.config.details
|
|
1948
|
+
? {
|
|
1949
|
+
provider: {
|
|
1950
|
+
getData: (id) => {
|
|
1951
|
+
this.facade.select(id);
|
|
1952
|
+
},
|
|
1953
|
+
clearData: () => {
|
|
1954
|
+
this.facade.unselect();
|
|
1955
|
+
},
|
|
1956
|
+
item$: this.facade.selected$,
|
|
1957
|
+
loading$: this.facade.loaded$.pipe(map((l) => !l)),
|
|
1958
|
+
},
|
|
1959
|
+
componentFactories: {
|
|
1960
|
+
top: this.config.details &&
|
|
1961
|
+
this.config.details["components"] &&
|
|
1962
|
+
this.config.details["components"].top
|
|
1963
|
+
? compiledComponents.find((cc) => cc.component === this.config.details["components"].top).factory
|
|
1964
|
+
: null,
|
|
1965
|
+
bottom: this.config.details &&
|
|
1966
|
+
this.config.details["components"] &&
|
|
1967
|
+
this.config.details["components"].bottom
|
|
1968
|
+
? compiledComponents.find((cc) => cc.component ===
|
|
1969
|
+
this.config.details["components"].bottom).factory
|
|
1970
|
+
: null,
|
|
1971
|
+
},
|
|
1972
|
+
}
|
|
1973
|
+
: null,
|
|
1974
|
+
item: !!this.config.edit || this.config.details
|
|
1975
|
+
? {
|
|
1976
|
+
options: {
|
|
1977
|
+
routingPrefix: "/" + this.router.routerState.snapshot.url + "/",
|
|
1978
|
+
edit: !!this.config.edit,
|
|
1979
|
+
},
|
|
1980
|
+
}
|
|
1981
|
+
: null,
|
|
1982
|
+
remove: this.config.remove
|
|
1983
|
+
? {
|
|
1984
|
+
provider: {
|
|
1985
|
+
invoke: (id) => this.facade.delete(id),
|
|
1986
|
+
},
|
|
1987
|
+
}
|
|
1988
|
+
: null,
|
|
1989
|
+
pagination: await this.paginationFacade.create({
|
|
1990
|
+
mode: this.config.list.paginationMode,
|
|
1991
|
+
limit: this.config.pagination.limit,
|
|
1992
|
+
provider: {
|
|
1993
|
+
getFilter: () => {
|
|
1994
|
+
return this.filter;
|
|
1995
|
+
},
|
|
1996
|
+
getLinks: () => this.links,
|
|
1997
|
+
},
|
|
1998
|
+
}),
|
|
1999
|
+
sort: this.config.sort,
|
|
2000
|
+
};
|
|
2001
|
+
this.cd.detectChanges();
|
|
2002
|
+
this.initCloseMenu();
|
|
2003
|
+
this.initTopComponent(compiledComponents);
|
|
2004
|
+
this.refreshDynamicInstance();
|
|
2005
|
+
}
|
|
2006
|
+
initCloseMenu() {
|
|
2007
|
+
this.router.events.pipe(this.takeUntilDestroy).subscribe(async () => {
|
|
2008
|
+
await this.clear();
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
async clear() {
|
|
2012
|
+
await this.menuService.closeEnd();
|
|
2013
|
+
this.listOptions = {
|
|
2014
|
+
...this.listOptions,
|
|
2015
|
+
select: null,
|
|
2016
|
+
};
|
|
2017
|
+
this.facade.multiSelect([]);
|
|
2018
|
+
}
|
|
2019
|
+
getEndButtons() {
|
|
2020
|
+
const fieldsWithOptions = getModelFieldsWithOptions(new this.config.type());
|
|
2021
|
+
const modelOptions = getModelOptions(this.config.type);
|
|
2022
|
+
const showFilters = fieldsWithOptions.some((x) => x.options?.list?.filter) || modelOptions?.filters?.length;
|
|
2023
|
+
const showMultiEdit = this.config.edit &&
|
|
2024
|
+
fieldsWithOptions.some((x) => x.options?.update?.multi) &&
|
|
2025
|
+
!this.hardwareService.isMobile &&
|
|
2026
|
+
(!this.config?.list?.mode ||
|
|
2027
|
+
this.config?.list?.mode === ListMode.desktop);
|
|
2028
|
+
return [
|
|
2029
|
+
...(showMultiEdit
|
|
2030
|
+
? [
|
|
2031
|
+
{
|
|
2032
|
+
icon: "checkbox-outline",
|
|
2033
|
+
text: "multi",
|
|
2034
|
+
handler: async () => {
|
|
2035
|
+
this.listOptions = {
|
|
2036
|
+
...this.listOptions,
|
|
2037
|
+
select: this.listOptions.select === "multi" ? null : "multi",
|
|
2038
|
+
};
|
|
2039
|
+
this.facade.multiSelect([]);
|
|
2040
|
+
if (this.menuService.openedEnd)
|
|
2041
|
+
await this.menuService.closeEnd();
|
|
2042
|
+
this.cd.detectChanges();
|
|
2043
|
+
},
|
|
2044
|
+
},
|
|
2045
|
+
]
|
|
2046
|
+
: []),
|
|
2047
|
+
...(showFilters
|
|
2048
|
+
? [
|
|
2049
|
+
{
|
|
2050
|
+
icon: "filter-outline",
|
|
2051
|
+
text: "filters",
|
|
2052
|
+
handler: async () => {
|
|
2053
|
+
await this.menuService.openEnd({
|
|
2054
|
+
injector: this.injector,
|
|
2055
|
+
component: FiltersComponent,
|
|
2056
|
+
});
|
|
2057
|
+
},
|
|
2058
|
+
},
|
|
2059
|
+
]
|
|
2060
|
+
: []),
|
|
2061
|
+
...(this.config.add
|
|
2062
|
+
? [
|
|
2063
|
+
{
|
|
2064
|
+
icon: "add",
|
|
2065
|
+
text: "add",
|
|
2066
|
+
handler: () => {
|
|
2067
|
+
this.router.navigate([
|
|
2068
|
+
"/" + this.router.routerState.snapshot.url + "/add",
|
|
2069
|
+
]);
|
|
2070
|
+
},
|
|
2071
|
+
},
|
|
2072
|
+
]
|
|
2073
|
+
: []),
|
|
2074
|
+
...(this.config.export
|
|
2075
|
+
? [
|
|
2076
|
+
{
|
|
2077
|
+
text: "export",
|
|
2078
|
+
icon: "download-outline",
|
|
2079
|
+
type: "popover",
|
|
2080
|
+
component: ExportComponent,
|
|
2081
|
+
},
|
|
2082
|
+
]
|
|
2083
|
+
: []),
|
|
2084
|
+
...(this.config.buttons ? this.config.buttons : []),
|
|
2085
|
+
];
|
|
2086
|
+
}
|
|
2087
|
+
initTopComponent(compiledComponents) {
|
|
2088
|
+
const factory = this.config.list &&
|
|
2089
|
+
this.config.list["components"] &&
|
|
2090
|
+
this.config.list["components"].top
|
|
2091
|
+
? compiledComponents.find((cc) => cc.component === this.config.list["components"].top).factory
|
|
2092
|
+
: null;
|
|
2093
|
+
setTimeout(() => {
|
|
2094
|
+
if (factory && !this.topTpl.get(0)) {
|
|
2095
|
+
this.topTpl.createComponent(factory);
|
|
2096
|
+
}
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
/** @nocollapse */ /** @nocollapse */ ListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ListComponent, deps: [{ token: CrudFacade }, { token: i1$2.Router }, { token: i3.DynamicComponentLoader }, { token: i0.Injector }, { token: i0.ChangeDetectorRef }, { token: i3.MenuService }, { token: i3.HardwareService }, { token: CrudListPaginationFactory }, { token: i3.StyleService }, { token: i0.ElementRef }, { token: PageService }, { token: CrudFullConfig }, { token: CrudSearchService }, { token: i0.NgModuleRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
|
|
2101
|
+
/** @nocollapse */ /** @nocollapse */ ListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: ListComponent, selector: "smart-crud-list-page", viewQueries: [{ propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, read: ViewContainerRef }, { propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, read: TemplateRef }, { propertyName: "dynamicContents", predicate: DynamicContentDirective, descendants: true, read: DynamicContentDirective }], usesInheritance: true, ngImport: i0, template: `
|
|
2102
|
+
<smart-page [options]="pageOptions" *ngIf="filter$ | async">
|
|
2103
|
+
<div #topTpl></div>
|
|
2104
|
+
<smart-crud-list-standard-page *ngIf="template === 'default'" [listOptions]="listOptions">
|
|
2105
|
+
<ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
|
|
2106
|
+
</smart-crud-list-standard-page>
|
|
2107
|
+
<ng-template #contentTpl>
|
|
2108
|
+
<ng-content></ng-content>
|
|
2109
|
+
</ng-template>
|
|
2110
|
+
<div class="dynamic-content"></div>
|
|
2111
|
+
</smart-page>
|
|
2112
|
+
`, isInline: true, components: [{ type: i3.PageComponent, selector: "smart-page", inputs: ["options"] }, { type: ListStandardComponent, selector: "smart-crud-list-standard-page" }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.DynamicContentDirective, selector: ".dynamic-content" }], pipes: { "async": i3$1.AsyncPipe } });
|
|
2113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ListComponent, decorators: [{
|
|
2114
|
+
type: Component,
|
|
2115
|
+
args: [{
|
|
2116
|
+
selector: "smart-crud-list-page",
|
|
2117
|
+
template: `
|
|
2118
|
+
<smart-page [options]="pageOptions" *ngIf="filter$ | async">
|
|
2119
|
+
<div #topTpl></div>
|
|
2120
|
+
<smart-crud-list-standard-page *ngIf="template === 'default'" [listOptions]="listOptions">
|
|
2121
|
+
<ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
|
|
2122
|
+
</smart-crud-list-standard-page>
|
|
2123
|
+
<ng-template #contentTpl>
|
|
2124
|
+
<ng-content></ng-content>
|
|
2125
|
+
</ng-template>
|
|
2126
|
+
<div class="dynamic-content"></div>
|
|
2127
|
+
</smart-page>
|
|
2128
|
+
`
|
|
2129
|
+
}]
|
|
2130
|
+
}], ctorParameters: function () { return [{ type: CrudFacade }, { type: i1$2.Router }, { type: i3.DynamicComponentLoader }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: i3.MenuService }, { type: i3.HardwareService }, { type: CrudListPaginationFactory }, { type: i3.StyleService }, { type: i0.ElementRef }, { type: PageService }, { type: CrudFullConfig }, { type: CrudSearchService }, { type: i0.NgModuleRef }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { topTpl: [{
|
|
2131
|
+
type: ViewChild,
|
|
2132
|
+
args: ["topTpl", { read: ViewContainerRef, static: false }]
|
|
2133
|
+
}], contentTpl: [{
|
|
2134
|
+
type: ViewChild,
|
|
2135
|
+
args: ["contentTpl", { read: TemplateRef, static: false }]
|
|
2136
|
+
}], dynamicContents: [{
|
|
2137
|
+
type: ViewChildren,
|
|
2138
|
+
args: [DynamicContentDirective, { read: DynamicContentDirective }]
|
|
2139
|
+
}] } });
|
|
2140
|
+
|
|
2141
|
+
class CrudItemPageBaseComponent extends BaseComponent$1 {
|
|
2142
|
+
constructor(config, facade) {
|
|
2143
|
+
super();
|
|
2144
|
+
this.config = config;
|
|
2145
|
+
this.facade = facade;
|
|
2146
|
+
this.formComponents = new QueryList();
|
|
2147
|
+
this.onPartialChange = new EventEmitter();
|
|
2148
|
+
this.onChange = new EventEmitter();
|
|
2149
|
+
this.onValidChange = new EventEmitter();
|
|
2150
|
+
this.selected$ = facade.selected$;
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
CrudItemPageBaseComponent.smartType = "crud-item-page";
|
|
2154
|
+
/** @nocollapse */ /** @nocollapse */ CrudItemPageBaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudItemPageBaseComponent, deps: [{ token: CrudFullConfig }, { token: CrudFacade }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2155
|
+
/** @nocollapse */ /** @nocollapse */ CrudItemPageBaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.7", type: CrudItemPageBaseComponent, inputs: { detailsOptions: "detailsOptions", mode: "mode", uniqueProvider: "uniqueProvider" }, outputs: { onPartialChange: "onPartialChange", onChange: "onChange", onValidChange: "onValidChange" }, viewQueries: [{ propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "formComponents", predicate: FormComponent, descendants: true, read: FormComponent }], usesInheritance: true, ngImport: i0 });
|
|
2156
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudItemPageBaseComponent, decorators: [{
|
|
2157
|
+
type: Directive
|
|
2158
|
+
}], ctorParameters: function () { return [{ type: CrudFullConfig }, { type: CrudFacade }]; }, propDecorators: { contentTpl: [{
|
|
2159
|
+
type: ViewChild,
|
|
2160
|
+
args: ["contentTpl", { read: ViewContainerRef, static: true }]
|
|
2161
|
+
}], formComponents: [{
|
|
2162
|
+
type: ViewChildren,
|
|
2163
|
+
args: [FormComponent, { read: FormComponent }]
|
|
2164
|
+
}], detailsOptions: [{
|
|
2165
|
+
type: Input
|
|
2166
|
+
}], mode: [{
|
|
2167
|
+
type: Input
|
|
2168
|
+
}], uniqueProvider: [{
|
|
2169
|
+
type: Input
|
|
2170
|
+
}], onPartialChange: [{
|
|
2171
|
+
type: Output
|
|
2172
|
+
}], onChange: [{
|
|
2173
|
+
type: Output
|
|
2174
|
+
}], onValidChange: [{
|
|
2175
|
+
type: Output
|
|
2176
|
+
}] } });
|
|
2177
|
+
|
|
2178
|
+
class ItemStandardComponent extends CrudItemPageBaseComponent {
|
|
2179
|
+
}
|
|
2180
|
+
/** @nocollapse */ /** @nocollapse */ ItemStandardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ItemStandardComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2181
|
+
/** @nocollapse */ /** @nocollapse */ ItemStandardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: ItemStandardComponent, selector: "smart-crud-item-standard-page", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"mode === 'details'; else editTpl\">\n <smart-details *ngIf=\"detailsOptions\" [options]='detailsOptions'></smart-details>\n</ng-container>\n\n<ng-template #editTpl>\n <smart-form\n [options]=\"\n (selected$ | async)\n | smartFormOptions : mode:config?.type:uniqueProvider : config.inputComponents\n \"\n (valuePartialChange)=\"onPartialChange.emit($event)\"\n (valueChange)=\"onChange.emit($event)\"\n (validChange)=\"onValidChange.emit($event)\"\n ></smart-form>\n</ng-template>\n\n<br/><br/>", styles: [""], components: [{ type: i3.DetailsComponent, selector: "smart-details", inputs: ["options"] }, { type: i3.FormComponent, selector: "smart-form", inputs: ["options"], outputs: ["invokeSubmit", "valueChange", "valuePartialChange", "validChange"] }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "smartFormOptions": FormOptionsPipe, "async": i3$1.AsyncPipe } });
|
|
2182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ItemStandardComponent, decorators: [{
|
|
2183
|
+
type: Component,
|
|
2184
|
+
args: [{ selector: "smart-crud-item-standard-page", template: "<ng-container *ngIf=\"mode === 'details'; else editTpl\">\n <smart-details *ngIf=\"detailsOptions\" [options]='detailsOptions'></smart-details>\n</ng-container>\n\n<ng-template #editTpl>\n <smart-form\n [options]=\"\n (selected$ | async)\n | smartFormOptions : mode:config?.type:uniqueProvider : config.inputComponents\n \"\n (valuePartialChange)=\"onPartialChange.emit($event)\"\n (valueChange)=\"onChange.emit($event)\"\n (validChange)=\"onValidChange.emit($event)\"\n ></smart-form>\n</ng-template>\n\n<br/><br/>", styles: [""] }]
|
|
2185
|
+
}] });
|
|
2186
|
+
|
|
2187
|
+
class ItemComponent extends CreateDynamicComponent('crud-item-page') {
|
|
2188
|
+
constructor(router, activeRoute, facade, service, route, dynamicComponentLoader, translateService, config, location, cd, authService, styleService, elementRef, toastService, pageService, moduleRef, componentFactoryResolver, detailsService) {
|
|
2189
|
+
super(cd, moduleRef, componentFactoryResolver);
|
|
2190
|
+
this.router = router;
|
|
2191
|
+
this.activeRoute = activeRoute;
|
|
2192
|
+
this.facade = facade;
|
|
2193
|
+
this.service = service;
|
|
2194
|
+
this.route = route;
|
|
2195
|
+
this.dynamicComponentLoader = dynamicComponentLoader;
|
|
2196
|
+
this.translateService = translateService;
|
|
2197
|
+
this.config = config;
|
|
2198
|
+
this.location = location;
|
|
2199
|
+
this.cd = cd;
|
|
2200
|
+
this.styleService = styleService;
|
|
2201
|
+
this.elementRef = elementRef;
|
|
2202
|
+
this.toastService = toastService;
|
|
2203
|
+
this.pageService = pageService;
|
|
2204
|
+
this.moduleRef = moduleRef;
|
|
2205
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
2206
|
+
this.detailsService = detailsService;
|
|
2207
|
+
this.pageOptions = {
|
|
2208
|
+
title: "",
|
|
2209
|
+
showBackButton: true,
|
|
2210
|
+
hideMenuButton: true,
|
|
2211
|
+
};
|
|
2212
|
+
this.formValid = false;
|
|
2213
|
+
this.standardComponents = new QueryList();
|
|
2214
|
+
this.dynamicContents = new QueryList();
|
|
2215
|
+
this.selected$ = this.facade.selected$;
|
|
2216
|
+
}
|
|
2217
|
+
set mode(val) {
|
|
2218
|
+
this._mode = val;
|
|
2219
|
+
this.refreshDynamicInstance();
|
|
2220
|
+
}
|
|
2221
|
+
get mode() {
|
|
2222
|
+
return this._mode;
|
|
2223
|
+
}
|
|
2224
|
+
refreshProperties() {
|
|
2225
|
+
this.baseInstance.detailsOptions = this.detailsOptions;
|
|
2226
|
+
this.baseInstance.mode = this.mode;
|
|
2227
|
+
this.baseInstance.uniqueProvider = this.uniqueProvider;
|
|
2228
|
+
this.baseInstance.onPartialChange.pipe(this.takeUntilDestroy).subscribe(val => this.onPartialChange(val));
|
|
2229
|
+
this.baseInstance.onChange.pipe(this.takeUntilDestroy).subscribe(val => this.onChange(val));
|
|
2230
|
+
this.baseInstance.onValidChange.pipe(this.takeUntilDestroy).subscribe(val => this.onValidChange(val));
|
|
2231
|
+
}
|
|
2232
|
+
async ngOnInit() {
|
|
2233
|
+
this.detailsService.init();
|
|
2234
|
+
this.styleService.init(this.elementRef);
|
|
2235
|
+
this.pageService.checkPermissions();
|
|
2236
|
+
if (this.router.routerState.snapshot.url.endsWith("/add")) {
|
|
2237
|
+
this.mode = "create";
|
|
2238
|
+
await this.generateComponents('add');
|
|
2239
|
+
}
|
|
2240
|
+
else {
|
|
2241
|
+
this.mode = this.config.details ? "details" : "update";
|
|
2242
|
+
if (this.mode === 'update') {
|
|
2243
|
+
await this.generateComponents('edit');
|
|
2244
|
+
}
|
|
2245
|
+
this.activeRoute.params
|
|
2246
|
+
.pipe(this.takeUntilDestroy)
|
|
2247
|
+
.subscribe(({ id }) => {
|
|
2248
|
+
this.facade.select(id);
|
|
2249
|
+
this.id = id;
|
|
2250
|
+
});
|
|
2251
|
+
this.activeRoute.queryParams
|
|
2252
|
+
.pipe(this.takeUntilDestroy)
|
|
2253
|
+
.subscribe(({ edit }) => {
|
|
2254
|
+
if (edit) {
|
|
2255
|
+
this.mode = "update";
|
|
2256
|
+
this.generateComponents('edit');
|
|
2257
|
+
}
|
|
2258
|
+
});
|
|
2259
|
+
}
|
|
2260
|
+
this.uniqueProvider = async (values) => {
|
|
2261
|
+
const filter = {
|
|
2262
|
+
query: [],
|
|
2263
|
+
};
|
|
2264
|
+
Object.keys(values).forEach((key) => {
|
|
2265
|
+
filter.query.push({
|
|
2266
|
+
key: key,
|
|
2267
|
+
value: values[key],
|
|
2268
|
+
type: "=",
|
|
2269
|
+
});
|
|
2270
|
+
});
|
|
2271
|
+
if (this.id) {
|
|
2272
|
+
filter.query.push({
|
|
2273
|
+
key: "id",
|
|
2274
|
+
value: this.id,
|
|
2275
|
+
type: "!=",
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
const { totalCount } = await this.service.getList(filter).toPromise();
|
|
2279
|
+
return !totalCount;
|
|
2280
|
+
};
|
|
2281
|
+
if (this.config.details) {
|
|
2282
|
+
const compiledComponents = await this.dynamicComponentLoader.getComponentsWithFactories({
|
|
2283
|
+
components: [
|
|
2284
|
+
...(this.config.details &&
|
|
2285
|
+
this.config.details["components"] &&
|
|
2286
|
+
this.config.details["components"].top
|
|
2287
|
+
? [this.config.details["components"].top]
|
|
2288
|
+
: []),
|
|
2289
|
+
...(this.config.details &&
|
|
2290
|
+
this.config.details["components"] &&
|
|
2291
|
+
this.config.details["components"].bottom
|
|
2292
|
+
? [this.config.details["components"].bottom]
|
|
2293
|
+
: []),
|
|
2294
|
+
],
|
|
2295
|
+
});
|
|
2296
|
+
this.detailsOptions = {
|
|
2297
|
+
type: this.config.type,
|
|
2298
|
+
item$: this.facade.selected$,
|
|
2299
|
+
cellPipe: this.config.details ? this.config.details.cellPipe : null,
|
|
2300
|
+
componentFactories: {
|
|
2301
|
+
top: this.config.details &&
|
|
2302
|
+
this.config.details["components"] &&
|
|
2303
|
+
this.config.details["components"].top
|
|
2304
|
+
? compiledComponents.find((cc) => cc.component === this.config.details["components"].top).factory
|
|
2305
|
+
: null,
|
|
2306
|
+
bottom: this.config.details &&
|
|
2307
|
+
this.config.details["components"] &&
|
|
2308
|
+
this.config.details["components"].bottom
|
|
2309
|
+
? compiledComponents.find((cc) => cc.component === this.config.details["components"].bottom).factory
|
|
2310
|
+
: null,
|
|
2311
|
+
},
|
|
2312
|
+
};
|
|
2313
|
+
}
|
|
2314
|
+
this.initPageOptions();
|
|
2315
|
+
this.facade.selected$.pipe(this.takeUntilDestroy).subscribe(item => {
|
|
2316
|
+
this.item = item;
|
|
2317
|
+
this.initPageOptions();
|
|
2318
|
+
this.cd.detectChanges();
|
|
2319
|
+
});
|
|
2320
|
+
this.refreshDynamicInstance();
|
|
2321
|
+
}
|
|
2322
|
+
async generateComponents(mode) {
|
|
2323
|
+
const compiledComponents = await this.dynamicComponentLoader.getComponentsWithFactories({
|
|
2324
|
+
components: [
|
|
2325
|
+
...(this.config[mode] &&
|
|
2326
|
+
this.config[mode]["components"] &&
|
|
2327
|
+
this.config[mode]["components"].top
|
|
2328
|
+
? [this.config[mode]["components"].top]
|
|
2329
|
+
: []),
|
|
2330
|
+
...(this.config[mode] &&
|
|
2331
|
+
this.config[mode]["components"] &&
|
|
2332
|
+
this.config[mode]["components"].bottom
|
|
2333
|
+
? [this.config[mode]["components"].bottom]
|
|
2334
|
+
: []),
|
|
2335
|
+
],
|
|
2336
|
+
});
|
|
2337
|
+
const topComponentFactory = compiledComponents.find((cc) => cc.component === this.config[mode]["components"]?.top)?.factory;
|
|
2338
|
+
const bottomComponentFactory = compiledComponents.find((cc) => cc.component === this.config[mode]["components"]?.bottom)?.factory;
|
|
2339
|
+
if (!this.topTpl.get(0) && topComponentFactory) {
|
|
2340
|
+
this.topTpl.createComponent(topComponentFactory);
|
|
2341
|
+
}
|
|
2342
|
+
if (!this.bottomTpl.get(0) && bottomComponentFactory) {
|
|
2343
|
+
this.bottomTpl.createComponent(bottomComponentFactory);
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
onPartialChange(val) {
|
|
2347
|
+
this.formPartialValue = val;
|
|
2348
|
+
}
|
|
2349
|
+
onChange(val) {
|
|
2350
|
+
this.formValue = val;
|
|
2351
|
+
}
|
|
2352
|
+
onValidChange(val) {
|
|
2353
|
+
this.formValid = val;
|
|
2354
|
+
}
|
|
2355
|
+
initPageOptions() {
|
|
2356
|
+
this.pageOptions = {
|
|
2357
|
+
...this.pageOptions,
|
|
2358
|
+
title: this.getTitle(),
|
|
2359
|
+
endButtons: this.getButtons(),
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2362
|
+
getButtons() {
|
|
2363
|
+
switch (this.mode) {
|
|
2364
|
+
case "create":
|
|
2365
|
+
return [
|
|
2366
|
+
{
|
|
2367
|
+
icon: "add",
|
|
2368
|
+
text: "add",
|
|
2369
|
+
handler: () => {
|
|
2370
|
+
if (this.checkFirstInvalid()) {
|
|
2371
|
+
return;
|
|
2372
|
+
}
|
|
2373
|
+
this.facade.create(this.formValue);
|
|
2374
|
+
this.location.back();
|
|
2375
|
+
},
|
|
2376
|
+
},
|
|
2377
|
+
];
|
|
2378
|
+
case "update":
|
|
2379
|
+
return [
|
|
2380
|
+
...(this.config.details
|
|
2381
|
+
? [
|
|
2382
|
+
{
|
|
2383
|
+
icon: "close",
|
|
2384
|
+
text: "cancel",
|
|
2385
|
+
handler: () => {
|
|
2386
|
+
this.mode = "details";
|
|
2387
|
+
this.initPageOptions();
|
|
2388
|
+
this.topTpl.clear();
|
|
2389
|
+
this.bottomTpl.clear();
|
|
2390
|
+
},
|
|
2391
|
+
disabled$: new BehaviorSubject(false),
|
|
2392
|
+
},
|
|
2393
|
+
]
|
|
2394
|
+
: []),
|
|
2395
|
+
{
|
|
2396
|
+
icon: "save",
|
|
2397
|
+
text: "save",
|
|
2398
|
+
handler: () => {
|
|
2399
|
+
if (this.checkFirstInvalid()) {
|
|
2400
|
+
return;
|
|
2401
|
+
}
|
|
2402
|
+
this.formPartialValue.id = this.id;
|
|
2403
|
+
this.facade.updatePartial(this.formPartialValue);
|
|
2404
|
+
if (this.config.details) {
|
|
2405
|
+
this.mode = "details";
|
|
2406
|
+
this.initPageOptions();
|
|
2407
|
+
}
|
|
2408
|
+
else {
|
|
2409
|
+
this.location.back();
|
|
2410
|
+
}
|
|
2411
|
+
},
|
|
2412
|
+
},
|
|
2413
|
+
];
|
|
2414
|
+
case "details":
|
|
2415
|
+
return this.config.edit
|
|
2416
|
+
? [
|
|
2417
|
+
{
|
|
2418
|
+
icon: "create",
|
|
2419
|
+
text: "edit",
|
|
2420
|
+
handler: () => {
|
|
2421
|
+
this.mode = "update";
|
|
2422
|
+
this.generateComponents('edit');
|
|
2423
|
+
this.initPageOptions();
|
|
2424
|
+
},
|
|
2425
|
+
disabled$: new BehaviorSubject(false),
|
|
2426
|
+
},
|
|
2427
|
+
]
|
|
2428
|
+
: [];
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
getTitle() {
|
|
2432
|
+
const options = getModelOptions(this.config.type);
|
|
2433
|
+
const prefix = options.titleKey && this.item ? this.removeParagraph(this.item[options.titleKey]) + ' - ' : '';
|
|
2434
|
+
switch (this.mode) {
|
|
2435
|
+
case "create":
|
|
2436
|
+
return "add";
|
|
2437
|
+
case "update":
|
|
2438
|
+
return prefix + this.translateService.instant("change");
|
|
2439
|
+
case "details":
|
|
2440
|
+
return prefix + this.translateService.instant("details");
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
removeParagraph(val) {
|
|
2444
|
+
if (!val || val.indexOf('<p>') !== 0)
|
|
2445
|
+
return val;
|
|
2446
|
+
const div = document.createElement("div");
|
|
2447
|
+
div.innerHTML = val;
|
|
2448
|
+
const item = div.querySelectorAll("p").item(0);
|
|
2449
|
+
return item.innerHTML;
|
|
2450
|
+
}
|
|
2451
|
+
checkFirstInvalid() {
|
|
2452
|
+
this.cd.detectChanges();
|
|
2453
|
+
const form = this.template === 'default'
|
|
2454
|
+
? this.standardComponents.first.formComponents.first.form
|
|
2455
|
+
: this.baseInstance.formComponents.first.form;
|
|
2456
|
+
this.cd.detectChanges();
|
|
2457
|
+
if (form.valid)
|
|
2458
|
+
return false;
|
|
2459
|
+
const invalidFields = [];
|
|
2460
|
+
this.getInvalidFields(form, invalidFields, '');
|
|
2461
|
+
this.toastService.info({
|
|
2462
|
+
title: this.translateService.instant('INPUT.ERRORS.requires'),
|
|
2463
|
+
message: invalidFields.slice(0, 3).join('<br/>')
|
|
2464
|
+
});
|
|
2465
|
+
return true;
|
|
2466
|
+
}
|
|
2467
|
+
getInvalidFields(control, invalidFields, baseField, key = null) {
|
|
2468
|
+
if (control.valid)
|
|
2469
|
+
return;
|
|
2470
|
+
const field = key ? baseField + ' > ' + this.translateService.instant('MODEL.' + key) : baseField;
|
|
2471
|
+
if (control.errors?.customMessage) {
|
|
2472
|
+
invalidFields.push(field + ` (${control.errors.customMessage})`);
|
|
2473
|
+
return;
|
|
2474
|
+
}
|
|
2475
|
+
if (control instanceof FormControl) {
|
|
2476
|
+
invalidFields.push(field);
|
|
2477
|
+
}
|
|
2478
|
+
if (control instanceof FormGroup) {
|
|
2479
|
+
Object.keys(control.controls).forEach(groupKey => {
|
|
2480
|
+
this.getInvalidFields(control.controls[groupKey], invalidFields, field, groupKey);
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
if (control instanceof FormArray) {
|
|
2484
|
+
control.controls.forEach((c, index) => {
|
|
2485
|
+
this.getInvalidFields(c, invalidFields, field + `(${index + 1})`);
|
|
2486
|
+
});
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
/** @nocollapse */ /** @nocollapse */ ItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ItemComponent, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: CrudFacade }, { token: CrudService }, { token: i1$2.ActivatedRoute }, { token: i3.DynamicComponentLoader }, { token: i4.TranslateService }, { token: CrudFullConfig }, { token: i3$1.Location }, { token: i0.ChangeDetectorRef }, { token: i3.AuthService }, { token: i3.StyleService }, { token: i0.ElementRef }, { token: i3.ToastService }, { token: PageService }, { token: i0.NgModuleRef }, { token: i0.ComponentFactoryResolver }, { token: i3.DetailsService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2491
|
+
/** @nocollapse */ /** @nocollapse */ ItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: ItemComponent, selector: "smart-crud-item-page", viewQueries: [{ propertyName: "content", first: true, predicate: IonContent, descendants: true, static: true }, { propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, read: TemplateRef }, { propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "bottomTpl", first: true, predicate: ["bottomTpl"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "standardComponents", predicate: ItemStandardComponent, descendants: true, read: ItemStandardComponent }, { propertyName: "dynamicContents", predicate: DynamicContentDirective, descendants: true, read: DynamicContentDirective }], usesInheritance: true, ngImport: i0, template: `
|
|
2492
|
+
<smart-page [options]="pageOptions">
|
|
2493
|
+
<div #topTpl class="top-content"></div>
|
|
2494
|
+
<smart-crud-item-standard-page *ngIf="template === 'default'"
|
|
2495
|
+
[detailsOptions]="detailsOptions"
|
|
2496
|
+
[mode]="mode"
|
|
2497
|
+
[uniqueProvider]="uniqueProvider"
|
|
2498
|
+
(onPartialChange)="onPartialChange($event)"
|
|
2499
|
+
(onChange)="onChange($event)"
|
|
2500
|
+
(onValidChange)="onValidChange($event)"
|
|
2501
|
+
>
|
|
2502
|
+
<ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
|
|
2503
|
+
</smart-crud-item-standard-page>
|
|
2504
|
+
<ng-template #contentTpl>
|
|
2505
|
+
<ng-content></ng-content>
|
|
2506
|
+
</ng-template>
|
|
2507
|
+
<div class="dynamic-content"></div>
|
|
2508
|
+
<div #bottomTpl class="bottom-content"></div>
|
|
2509
|
+
</smart-page>
|
|
2510
|
+
`, isInline: true, components: [{ type: i3.PageComponent, selector: "smart-page", inputs: ["options"] }, { type: ItemStandardComponent, selector: "smart-crud-item-standard-page" }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.DynamicContentDirective, selector: ".dynamic-content" }] });
|
|
2511
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: ItemComponent, decorators: [{
|
|
2512
|
+
type: Component,
|
|
2513
|
+
args: [{
|
|
2514
|
+
selector: "smart-crud-item-page",
|
|
2515
|
+
template: `
|
|
2516
|
+
<smart-page [options]="pageOptions">
|
|
2517
|
+
<div #topTpl class="top-content"></div>
|
|
2518
|
+
<smart-crud-item-standard-page *ngIf="template === 'default'"
|
|
2519
|
+
[detailsOptions]="detailsOptions"
|
|
2520
|
+
[mode]="mode"
|
|
2521
|
+
[uniqueProvider]="uniqueProvider"
|
|
2522
|
+
(onPartialChange)="onPartialChange($event)"
|
|
2523
|
+
(onChange)="onChange($event)"
|
|
2524
|
+
(onValidChange)="onValidChange($event)"
|
|
2525
|
+
>
|
|
2526
|
+
<ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
|
|
2527
|
+
</smart-crud-item-standard-page>
|
|
2528
|
+
<ng-template #contentTpl>
|
|
2529
|
+
<ng-content></ng-content>
|
|
2530
|
+
</ng-template>
|
|
2531
|
+
<div class="dynamic-content"></div>
|
|
2532
|
+
<div #bottomTpl class="bottom-content"></div>
|
|
2533
|
+
</smart-page>
|
|
2534
|
+
`
|
|
2535
|
+
}]
|
|
2536
|
+
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: CrudFacade }, { type: CrudService }, { type: i1$2.ActivatedRoute }, { type: i3.DynamicComponentLoader }, { type: i4.TranslateService }, { type: CrudFullConfig }, { type: i3$1.Location }, { type: i0.ChangeDetectorRef }, { type: i3.AuthService }, { type: i3.StyleService }, { type: i0.ElementRef }, { type: i3.ToastService }, { type: PageService }, { type: i0.NgModuleRef }, { type: i0.ComponentFactoryResolver }, { type: i3.DetailsService }]; }, propDecorators: { standardComponents: [{
|
|
2537
|
+
type: ViewChildren,
|
|
2538
|
+
args: [ItemStandardComponent, { read: ItemStandardComponent }]
|
|
2539
|
+
}], content: [{
|
|
2540
|
+
type: ViewChild,
|
|
2541
|
+
args: [IonContent, { static: true }]
|
|
2542
|
+
}], contentTpl: [{
|
|
2543
|
+
type: ViewChild,
|
|
2544
|
+
args: ["contentTpl", { read: TemplateRef, static: false }]
|
|
2545
|
+
}], topTpl: [{
|
|
2546
|
+
type: ViewChild,
|
|
2547
|
+
args: ["topTpl", { read: ViewContainerRef, static: true }]
|
|
2548
|
+
}], bottomTpl: [{
|
|
2549
|
+
type: ViewChild,
|
|
2550
|
+
args: ["bottomTpl", { read: ViewContainerRef, static: true }]
|
|
2551
|
+
}], dynamicContents: [{
|
|
2552
|
+
type: ViewChildren,
|
|
2553
|
+
args: [DynamicContentDirective, { read: DynamicContentDirective }]
|
|
2554
|
+
}] } });
|
|
2555
|
+
|
|
2556
|
+
const PAGES = [
|
|
2557
|
+
ItemComponent,
|
|
2558
|
+
ListComponent,
|
|
2559
|
+
ListStandardComponent,
|
|
2560
|
+
ItemStandardComponent
|
|
2561
|
+
];
|
|
2562
|
+
class CrudFullModule {
|
|
2563
|
+
constructor(store, config, effects) {
|
|
2564
|
+
NgrxStoreService.addReducer(config.entity, config.reducerFactory
|
|
2565
|
+
? config.reducerFactory()
|
|
2566
|
+
: getReducer(config.entity));
|
|
2567
|
+
effects.init();
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
/** @nocollapse */ /** @nocollapse */ CrudFullModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudFullModule, deps: [{ token: i1.Store }, { token: CrudConfig }, { token: CrudEffects }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2571
|
+
/** @nocollapse */ /** @nocollapse */ CrudFullModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudFullModule, declarations: [ItemComponent,
|
|
2572
|
+
ListComponent,
|
|
2573
|
+
ListStandardComponent,
|
|
2574
|
+
ItemStandardComponent], imports: [StoreModule,
|
|
2575
|
+
SharedModule,
|
|
2576
|
+
CrudPipesModule, i1$2.RouterModule, FormsModule,
|
|
2577
|
+
CommonModule,
|
|
2578
|
+
CrudComponentsModule], exports: [ItemComponent,
|
|
2579
|
+
ListComponent,
|
|
2580
|
+
ListStandardComponent,
|
|
2581
|
+
ItemStandardComponent, CrudComponentsModule] });
|
|
2582
|
+
/** @nocollapse */ /** @nocollapse */ CrudFullModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudFullModule, providers: [
|
|
2583
|
+
CrudService,
|
|
2584
|
+
CrudListGroupService,
|
|
2585
|
+
PageService,
|
|
2586
|
+
CrudEffects,
|
|
2587
|
+
CrudFacade,
|
|
2588
|
+
CrudListPaginationFactory,
|
|
2589
|
+
], imports: [[
|
|
2590
|
+
StoreModule,
|
|
2591
|
+
SharedModule,
|
|
2592
|
+
CrudPipesModule,
|
|
2593
|
+
RouterModule.forChild([
|
|
2594
|
+
{ path: '', component: ListComponent },
|
|
2595
|
+
{ path: 'add', component: ItemComponent },
|
|
2596
|
+
{ path: ':id', component: ItemComponent }
|
|
2597
|
+
]),
|
|
2598
|
+
FormsModule,
|
|
2599
|
+
CommonModule,
|
|
2600
|
+
CrudComponentsModule
|
|
2601
|
+
], CrudComponentsModule] });
|
|
2602
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudFullModule, decorators: [{
|
|
2603
|
+
type: NgModule,
|
|
2604
|
+
args: [{
|
|
2605
|
+
declarations: [
|
|
2606
|
+
...PAGES
|
|
2607
|
+
],
|
|
2608
|
+
imports: [
|
|
2609
|
+
StoreModule,
|
|
2610
|
+
SharedModule,
|
|
2611
|
+
CrudPipesModule,
|
|
2612
|
+
RouterModule.forChild([
|
|
2613
|
+
{ path: '', component: ListComponent },
|
|
2614
|
+
{ path: 'add', component: ItemComponent },
|
|
2615
|
+
{ path: ':id', component: ItemComponent }
|
|
2616
|
+
]),
|
|
2617
|
+
FormsModule,
|
|
2618
|
+
CommonModule,
|
|
2619
|
+
CrudComponentsModule
|
|
2620
|
+
],
|
|
2621
|
+
exports: [
|
|
2622
|
+
...PAGES,
|
|
2623
|
+
CrudComponentsModule
|
|
2624
|
+
],
|
|
2625
|
+
providers: [
|
|
2626
|
+
CrudService,
|
|
2627
|
+
CrudListGroupService,
|
|
2628
|
+
PageService,
|
|
2629
|
+
CrudEffects,
|
|
2630
|
+
CrudFacade,
|
|
2631
|
+
CrudListPaginationFactory,
|
|
2632
|
+
]
|
|
2633
|
+
}]
|
|
2634
|
+
}], ctorParameters: function () { return [{ type: i1.Store }, { type: CrudConfig }, { type: CrudEffects }]; } });
|
|
2635
|
+
|
|
2636
|
+
class CrudCoreModule {
|
|
2637
|
+
constructor(config, effects) {
|
|
2638
|
+
NgrxStoreService.addReducer(config.entity, config.reducerFactory
|
|
2639
|
+
? config.reducerFactory()
|
|
2640
|
+
: getReducer(config.entity));
|
|
2641
|
+
effects.init();
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
/** @nocollapse */ /** @nocollapse */ CrudCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudCoreModule, deps: [{ token: CrudConfig }, { token: CrudEffects }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2645
|
+
/** @nocollapse */ /** @nocollapse */ CrudCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudCoreModule, imports: [
|
|
2646
|
+
//AuthSharedModule,
|
|
2647
|
+
StoreModule,
|
|
2648
|
+
SharedModule,
|
|
2649
|
+
CrudPipesModule,
|
|
2650
|
+
FormsModule,
|
|
2651
|
+
CommonModule,
|
|
2652
|
+
CrudComponentsModule,
|
|
2653
|
+
NgrxSharedModule], exports: [CrudComponentsModule] });
|
|
2654
|
+
/** @nocollapse */ /** @nocollapse */ CrudCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudCoreModule, providers: [
|
|
2655
|
+
CrudService,
|
|
2656
|
+
CrudListGroupService,
|
|
2657
|
+
PageService,
|
|
2658
|
+
CrudEffects,
|
|
2659
|
+
CrudFacade,
|
|
2660
|
+
SocketService,
|
|
2661
|
+
CrudListPaginationFactory,
|
|
2662
|
+
], imports: [[
|
|
2663
|
+
//AuthSharedModule,
|
|
2664
|
+
StoreModule,
|
|
2665
|
+
SharedModule,
|
|
2666
|
+
CrudPipesModule,
|
|
2667
|
+
FormsModule,
|
|
2668
|
+
CommonModule,
|
|
2669
|
+
CrudComponentsModule,
|
|
2670
|
+
NgrxSharedModule,
|
|
2671
|
+
], CrudComponentsModule] });
|
|
2672
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudCoreModule, decorators: [{
|
|
2673
|
+
type: NgModule,
|
|
2674
|
+
args: [{
|
|
2675
|
+
imports: [
|
|
2676
|
+
//AuthSharedModule,
|
|
2677
|
+
StoreModule,
|
|
2678
|
+
SharedModule,
|
|
2679
|
+
CrudPipesModule,
|
|
2680
|
+
FormsModule,
|
|
2681
|
+
CommonModule,
|
|
2682
|
+
CrudComponentsModule,
|
|
2683
|
+
NgrxSharedModule,
|
|
2684
|
+
],
|
|
2685
|
+
exports: [CrudComponentsModule],
|
|
2686
|
+
providers: [
|
|
2687
|
+
CrudService,
|
|
2688
|
+
CrudListGroupService,
|
|
2689
|
+
PageService,
|
|
2690
|
+
CrudEffects,
|
|
2691
|
+
CrudFacade,
|
|
2692
|
+
SocketService,
|
|
2693
|
+
CrudListPaginationFactory,
|
|
2694
|
+
],
|
|
2695
|
+
}]
|
|
2696
|
+
}], ctorParameters: function () { return [{ type: CrudConfig }, { type: CrudEffects }]; } });
|
|
2697
|
+
class CrudModule {
|
|
2698
|
+
static forFeature(options) {
|
|
2699
|
+
return {
|
|
2700
|
+
ngModule: options.routing ? CrudFullModule : CrudCoreModule,
|
|
2701
|
+
providers: [
|
|
2702
|
+
{ provide: CrudConfig, useValue: options.config },
|
|
2703
|
+
{ provide: CrudFullConfig, useValue: options.config },
|
|
2704
|
+
{
|
|
2705
|
+
provide: FILE_SERVICE_CONFIG,
|
|
2706
|
+
useValue: { apiUrl: options.config.apiUrl },
|
|
2707
|
+
},
|
|
2708
|
+
...(options.socket
|
|
2709
|
+
? [SocketService]
|
|
2710
|
+
: [{ provide: SocketService, useClass: NotSocketService }]),
|
|
2711
|
+
],
|
|
2712
|
+
};
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
/** @nocollapse */ /** @nocollapse */ CrudModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2716
|
+
/** @nocollapse */ /** @nocollapse */ CrudModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudModule });
|
|
2717
|
+
/** @nocollapse */ /** @nocollapse */ CrudModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudModule });
|
|
2718
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CrudModule, decorators: [{
|
|
2719
|
+
type: NgModule,
|
|
2720
|
+
args: [{}]
|
|
2721
|
+
}] });
|
|
2722
|
+
|
|
2723
|
+
/**
|
|
2724
|
+
* Generated bundle index. Do not edit.
|
|
2725
|
+
*/
|
|
2726
|
+
|
|
2727
|
+
export { CRUD_MODEL_POSSIBILITIES_PROVIDER, CrudComponentsModule, CrudConfig, CrudCoreModule, CrudEffects, CrudFacade, CrudFullConfig, CrudFullModule, CrudItemPageBaseComponent, CrudListPageBaseComponent, CrudListPaginationFactory, CrudModule, CrudPipesModule, CrudSearchService, CrudService, ExportComponent, FilterCheckComponent, FilterComponent, FilterDateComponent, FilterDateWithEditComponent, FilterFlagComponent, FilterIntComponent, FilterRadioComponent, FilterTextComponent, FiltersComponent, FiltersConfigComponent, FormOptionsPipe, GroupComponent, ICrudModelPossibilitiesProvider, ItemComponent, ItemStandardComponent, ListComponent, ListStandardComponent, MultiselectComponent, PAGES, PageService, create, createFailure, createMany, createManyFailure, createManySuccess, createSuccess, deleteFailure, deleteItem, deleteSuccess, exportList, exportListFailure, exportListSuccess, getCrudError, getCrudFilter, getCrudLinks, getCrudList, getCrudLoaded, getCrudMultiSelected, getCrudSelected, getCrudState, getCrudTotalCount, getReducer, initialState, multiSelect, read, readFailure, readSuccess, select, selectFailure, selectSuccess, unselect, update, updateFailure, updatePartial, updatePartialFailure, updatePartialMany, updatePartialManyFailure, updatePartialManySuccess, updatePartialSuccess, updateSuccess };
|
|
2728
|
+
//# sourceMappingURL=smartsoft001-crud-shell-angular.mjs.map
|