@sumaris-net/ngx-components 2.2.1-rc8 → 2.2.1-rc9
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/doc/changelog.md +1 -1
- package/esm2020/src/app/core/services/base-entity-service.class.mjs +21 -12
- package/esm2020/src/app/shared/material/chips/material.chips.mjs +5 -4
- package/esm2020/src/app/shared/services/entity-service.class.mjs +1 -1
- package/fesm2015/sumaris-net.ngx-components.mjs +22 -28
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +23 -14
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/base-entity-service.class.d.ts +7 -21
- package/src/app/shared/services/entity-service.class.d.ts +20 -10
|
@@ -8727,10 +8727,10 @@ class MatChipsField {
|
|
|
8727
8727
|
return this.formControl.value || [];
|
|
8728
8728
|
}
|
|
8729
8729
|
get disabled() {
|
|
8730
|
-
return this.readonly || this.formControl
|
|
8730
|
+
return this.readonly || this.formControl?.disabled || false;
|
|
8731
8731
|
}
|
|
8732
8732
|
get enabled() {
|
|
8733
|
-
return !this.readonly && this.formControl
|
|
8733
|
+
return !this.readonly && this.formControl?.enabled || false;
|
|
8734
8734
|
}
|
|
8735
8735
|
get loading() {
|
|
8736
8736
|
return isNil(this.$filteredItems.value);
|
|
@@ -8775,7 +8775,7 @@ class MatChipsField {
|
|
|
8775
8775
|
this.displayColumnNames = this.displayAttributes.map((attr, index) => this.displayColumnNames && this.displayColumnNames[index] ||
|
|
8776
8776
|
(this.i18nPrefix + changeCaseToUnderscore(attr).toUpperCase()));
|
|
8777
8777
|
this.mobile = toBoolean(this.mobile, false);
|
|
8778
|
-
this.equals = this.equals ||
|
|
8778
|
+
this.equals = this.equals || MatAutocompleteFieldUtils.defaultEquals;
|
|
8779
8779
|
const classList = this.classList?.split(' ');
|
|
8780
8780
|
this.panelWidth = this.panelWidth || (classList && ((classList.includes('min-width-medium') && '300px')
|
|
8781
8781
|
|| (classList.includes('min-width-large') && '400px')
|
|
@@ -24577,10 +24577,11 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
24577
24577
|
watch(id, opts) {
|
|
24578
24578
|
if (this._debug)
|
|
24579
24579
|
console.debug(this._logPrefix + `Watching ${this._logTypeName} {${id}}...`);
|
|
24580
|
+
const variables = opts?.variables || { id };
|
|
24580
24581
|
const query = opts && opts.query || this.queries.load;
|
|
24581
24582
|
return this.graphql.watchQuery({
|
|
24582
24583
|
query,
|
|
24583
|
-
variables
|
|
24584
|
+
variables,
|
|
24584
24585
|
fetchPolicy: opts && opts.fetchPolicy || undefined,
|
|
24585
24586
|
error: { code: ErrorCodes.LOAD_DATA_ERROR, message: 'REFERENTIAL.ERROR.LOAD_DATA_ERROR' }
|
|
24586
24587
|
})
|
|
@@ -24591,10 +24592,11 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
24591
24592
|
async load(id, opts) {
|
|
24592
24593
|
if (this._debug)
|
|
24593
24594
|
console.debug(this._logPrefix + `Loading ${this._logTypeName} {${id}}...`);
|
|
24594
|
-
const
|
|
24595
|
+
const variables = opts?.variables || { id };
|
|
24596
|
+
const query = opts?.query || this.queries.load;
|
|
24595
24597
|
const { data } = await this.graphql.query({
|
|
24596
24598
|
query,
|
|
24597
|
-
variables
|
|
24599
|
+
variables,
|
|
24598
24600
|
fetchPolicy: opts && opts.fetchPolicy || undefined,
|
|
24599
24601
|
error: { code: ErrorCodes.LOAD_DATA_ERROR, message: 'REFERENTIAL.ERROR.LOAD_DATA_ERROR' }
|
|
24600
24602
|
});
|
|
@@ -24606,6 +24608,7 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
24606
24608
|
watchAll(offset, size, sortBy, sortDirection, filter, opts) {
|
|
24607
24609
|
filter = this.asFilter(filter);
|
|
24608
24610
|
const variables = {
|
|
24611
|
+
...(opts?.variables || {}),
|
|
24609
24612
|
offset: offset || 0,
|
|
24610
24613
|
size: size || 100,
|
|
24611
24614
|
sortBy: sortBy || this.defaultSortBy,
|
|
@@ -24620,12 +24623,13 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
24620
24623
|
// Or get loadAll or loadAllWithTotal query
|
|
24621
24624
|
|| (withTotal ? this.queries.loadAllWithTotal : this.queries.loadAll);
|
|
24622
24625
|
return this.mutableWatchQuery({
|
|
24623
|
-
queryName: withTotal ? 'LoadAllWithTotal' : 'LoadAll',
|
|
24624
24626
|
query,
|
|
24627
|
+
variables,
|
|
24628
|
+
// Force cached mutable query
|
|
24629
|
+
queryName: withTotal ? 'LoadAllWithTotal' : 'LoadAll',
|
|
24625
24630
|
arrayFieldName: 'data',
|
|
24626
24631
|
totalFieldName: withTotal ? 'total' : undefined,
|
|
24627
24632
|
insertFilterFn: filter && filter.asFilterFn(),
|
|
24628
|
-
variables,
|
|
24629
24633
|
error: { code: ErrorCodes.LOAD_DATA_ERROR, message: 'REFERENTIAL.ERROR.LOAD_DATA_ERROR' },
|
|
24630
24634
|
fetchPolicy: opts && opts.fetchPolicy || undefined
|
|
24631
24635
|
})
|
|
@@ -24645,6 +24649,7 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
24645
24649
|
const debug = this._debug && (!opts || opts.debug !== false);
|
|
24646
24650
|
filter = this.asFilter(filter);
|
|
24647
24651
|
const variables = {
|
|
24652
|
+
...(opts?.variables || {}),
|
|
24648
24653
|
offset: offset || 0,
|
|
24649
24654
|
size: size || 100,
|
|
24650
24655
|
sortBy: sortBy || 'id',
|
|
@@ -24655,7 +24660,8 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
24655
24660
|
if (debug)
|
|
24656
24661
|
console.debug(this._logPrefix + `Loading ${this._logTypeName}...`, variables);
|
|
24657
24662
|
const withTotal = (!opts || opts.withTotal !== false) && this.queries.loadAllWithTotal && true;
|
|
24658
|
-
|
|
24663
|
+
// use given query
|
|
24664
|
+
const query = opts?.query
|
|
24659
24665
|
// Or get loadAll or loadAllWithTotal query
|
|
24660
24666
|
|| (withTotal ? this.queries.loadAllWithTotal : this.queries.loadAll);
|
|
24661
24667
|
const { data, total } = await this.graphql.query({
|
|
@@ -24684,7 +24690,7 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
24684
24690
|
}
|
|
24685
24691
|
async countAll(filter, opts) {
|
|
24686
24692
|
// If no countAll query
|
|
24687
|
-
if (!this.queries.countAll) {
|
|
24693
|
+
if (!this.queries.countAll && !opts?.query) {
|
|
24688
24694
|
// Fail if no loadAll (cannot count)
|
|
24689
24695
|
if (!this.queries.loadAllWithTotal)
|
|
24690
24696
|
throw new Error('Not implemented');
|
|
@@ -24692,11 +24698,14 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
24692
24698
|
return (await this.loadAll(0, 1, null, null, filter, { withTotal: true }))?.total || 0;
|
|
24693
24699
|
}
|
|
24694
24700
|
filter = this.asFilter(filter);
|
|
24701
|
+
const variables = {
|
|
24702
|
+
...(opts?.variables || {}),
|
|
24703
|
+
filter: filter && filter.asPodObject()
|
|
24704
|
+
};
|
|
24705
|
+
const query = opts?.query || this.queries.countAll;
|
|
24695
24706
|
const res = await this.graphql.query({
|
|
24696
|
-
query
|
|
24697
|
-
variables
|
|
24698
|
-
filter: filter && filter.asPodObject()
|
|
24699
|
-
},
|
|
24707
|
+
query,
|
|
24708
|
+
variables,
|
|
24700
24709
|
error: { code: ErrorCodes.LOAD_DATA_ERROR, message: 'ERROR.COUNT_DATA_ERROR' },
|
|
24701
24710
|
fetchPolicy: opts && opts.fetchPolicy || 'network-only'
|
|
24702
24711
|
});
|