@sumaris-net/ngx-components 2.6.4-rc11 → 2.6.4-rc13
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 +17 -37
- package/fesm2015/sumaris-net.ngx-components.mjs +16 -35
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +16 -36
- 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 +13 -30
|
@@ -23007,6 +23007,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
23007
23007
|
|
|
23008
23008
|
let NamedFilter = class NamedFilter extends Entity {
|
|
23009
23009
|
fromObject(source, opts) {
|
|
23010
|
+
super.fromObject(source, opts);
|
|
23010
23011
|
this.name = source.name;
|
|
23011
23012
|
this.entityName = source.entityName;
|
|
23012
23013
|
this.recorderPersonId = source.recorderPersonId;
|
|
@@ -23015,17 +23016,10 @@ let NamedFilter = class NamedFilter extends Entity {
|
|
|
23015
23016
|
this.content = typeof source?.content === 'string' ? JSON.parse(source?.content) : source?.content || undefined;
|
|
23016
23017
|
}
|
|
23017
23018
|
catch (e) {
|
|
23018
|
-
console.error(
|
|
23019
|
+
console.error(`[named-filter] can't parse content json`, source);
|
|
23019
23020
|
throw e;
|
|
23020
23021
|
}
|
|
23021
23022
|
}
|
|
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
23023
|
};
|
|
23030
23024
|
NamedFilter = __decorate([
|
|
23031
23025
|
EntityClass({ typename: 'NamedFilterVO' })
|
|
@@ -23066,40 +23060,15 @@ class AbstractNamedFilterService extends BaseEntityService {
|
|
|
23066
23060
|
this.options = options;
|
|
23067
23061
|
this._logPrefix = '[named-filter-service] ';
|
|
23068
23062
|
}
|
|
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
23063
|
async suggest(value, filter) {
|
|
23094
23064
|
if (EntityUtils.isNotEmpty(value, 'id'))
|
|
23095
23065
|
return { data: [value] };
|
|
23096
23066
|
value = (typeof value === 'string' && value !== '*' && value) || undefined;
|
|
23097
|
-
return await this.loadAll(0, 1000, 'name', 'asc', this.
|
|
23067
|
+
return await this.loadAll(0, 1000, 'name', 'asc', this.asSuggestFilter(value, filter), {
|
|
23098
23068
|
withTotal: true,
|
|
23099
|
-
withContent: false
|
|
23100
23069
|
});
|
|
23101
23070
|
}
|
|
23102
|
-
|
|
23071
|
+
asSuggestFilter(searchText, filter) {
|
|
23103
23072
|
return {
|
|
23104
23073
|
...filter,
|
|
23105
23074
|
searchText
|
|
@@ -23107,10 +23076,21 @@ class AbstractNamedFilterService extends BaseEntityService {
|
|
|
23107
23076
|
}
|
|
23108
23077
|
asFilter(source) {
|
|
23109
23078
|
const filter = super.asFilter(source);
|
|
23110
|
-
|
|
23079
|
+
// Default filter on current user
|
|
23080
|
+
if (isNil(filter.recorderPersonId) && isNil(filter.recorderDepartmentId))
|
|
23111
23081
|
filter.recorderPersonId = this.account.person.id;
|
|
23112
23082
|
return filter;
|
|
23113
23083
|
}
|
|
23084
|
+
fillDefaultProperties(source) {
|
|
23085
|
+
super.fillDefaultProperties(source);
|
|
23086
|
+
// Default recorder
|
|
23087
|
+
if (isNil(source.recorderPersonId) && isNil(source.recorderDepartmentId))
|
|
23088
|
+
source.recorderPersonId = this.account.person.id;
|
|
23089
|
+
// Stringify content
|
|
23090
|
+
if (typeof source.content === 'object') {
|
|
23091
|
+
source.content = JSON.stringify(source.content);
|
|
23092
|
+
}
|
|
23093
|
+
}
|
|
23114
23094
|
}
|
|
23115
23095
|
AbstractNamedFilterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: AbstractNamedFilterService, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
23116
23096
|
AbstractNamedFilterService.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: AbstractNamedFilterService, usesInheritance: true, ngImport: i0 });
|