@sumaris-net/ngx-components 2.6.4-rc11 → 2.6.4-rc12
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/esm2020/src/app/shared/named-filter/named-filter.service.mjs +15 -36
- package/fesm2015/sumaris-net.ngx-components.mjs +14 -34
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +14 -35
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/named-filter/named-filter.service.d.ts +11 -28
|
@@ -23019,13 +23019,6 @@ let NamedFilter = class NamedFilter extends Entity {
|
|
|
23019
23019
|
throw e;
|
|
23020
23020
|
}
|
|
23021
23021
|
}
|
|
23022
|
-
asObject(opts) {
|
|
23023
|
-
const target = super.asObject(opts);
|
|
23024
|
-
if (opts?.minify) {
|
|
23025
|
-
target.content = JSON.stringify(this.content);
|
|
23026
|
-
}
|
|
23027
|
-
return target;
|
|
23028
|
-
}
|
|
23029
23022
|
};
|
|
23030
23023
|
NamedFilter = __decorate([
|
|
23031
23024
|
EntityClass({ typename: 'NamedFilterVO' })
|
|
@@ -23066,40 +23059,15 @@ class AbstractNamedFilterService extends BaseEntityService {
|
|
|
23066
23059
|
this.options = options;
|
|
23067
23060
|
this._logPrefix = '[named-filter-service] ';
|
|
23068
23061
|
}
|
|
23069
|
-
watchAll(offset, size, sortBy, sortDirection, filter, options) {
|
|
23070
|
-
// Always ask total
|
|
23071
|
-
options = {
|
|
23072
|
-
...options,
|
|
23073
|
-
withTotal: true
|
|
23074
|
-
};
|
|
23075
|
-
// Set query if content is wanted
|
|
23076
|
-
if (options?.withContent) {
|
|
23077
|
-
options.query = this.queries.loadAllWithContent;
|
|
23078
|
-
}
|
|
23079
|
-
return super.watchAll(offset, size, sortBy, sortDirection, filter, options);
|
|
23080
|
-
}
|
|
23081
|
-
async loadAll(offset, size, sortBy, sortDirection, filter, options) {
|
|
23082
|
-
// Always ask total
|
|
23083
|
-
options = {
|
|
23084
|
-
...options,
|
|
23085
|
-
withTotal: true
|
|
23086
|
-
};
|
|
23087
|
-
// Set query if content is wanted
|
|
23088
|
-
if (options?.withContent) {
|
|
23089
|
-
options.query = this.queries.loadAllWithContent;
|
|
23090
|
-
}
|
|
23091
|
-
return super.loadAll(offset, size, sortBy, sortDirection, filter, options);
|
|
23092
|
-
}
|
|
23093
23062
|
async suggest(value, filter) {
|
|
23094
23063
|
if (EntityUtils.isNotEmpty(value, 'id'))
|
|
23095
23064
|
return { data: [value] };
|
|
23096
23065
|
value = (typeof value === 'string' && value !== '*' && value) || undefined;
|
|
23097
|
-
return await this.loadAll(0, 1000, 'name', 'asc', this.
|
|
23066
|
+
return await this.loadAll(0, 1000, 'name', 'asc', this.asSuggestFilter(value, filter), {
|
|
23098
23067
|
withTotal: true,
|
|
23099
|
-
withContent: false
|
|
23100
23068
|
});
|
|
23101
23069
|
}
|
|
23102
|
-
|
|
23070
|
+
asSuggestFilter(searchText, filter) {
|
|
23103
23071
|
return {
|
|
23104
23072
|
...filter,
|
|
23105
23073
|
searchText
|
|
@@ -23107,10 +23075,21 @@ class AbstractNamedFilterService extends BaseEntityService {
|
|
|
23107
23075
|
}
|
|
23108
23076
|
asFilter(source) {
|
|
23109
23077
|
const filter = super.asFilter(source);
|
|
23110
|
-
|
|
23078
|
+
// Default filter on current user
|
|
23079
|
+
if (isNil(filter.recorderPersonId) && isNil(filter.recorderDepartmentId))
|
|
23111
23080
|
filter.recorderPersonId = this.account.person.id;
|
|
23112
23081
|
return filter;
|
|
23113
23082
|
}
|
|
23083
|
+
fillDefaultProperties(source) {
|
|
23084
|
+
super.fillDefaultProperties(source);
|
|
23085
|
+
// Default recorder
|
|
23086
|
+
if (isNil(source.recorderPersonId) && isNil(source.recorderDepartmentId))
|
|
23087
|
+
source.recorderPersonId = this.account.person.id;
|
|
23088
|
+
// Stringify content
|
|
23089
|
+
if (typeof source.content === 'object') {
|
|
23090
|
+
source.content = JSON.stringify(source.content);
|
|
23091
|
+
}
|
|
23092
|
+
}
|
|
23114
23093
|
}
|
|
23115
23094
|
AbstractNamedFilterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: AbstractNamedFilterService, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
23116
23095
|
AbstractNamedFilterService.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: AbstractNamedFilterService, usesInheritance: true, ngImport: i0 });
|