@sumaris-net/ngx-components 1.19.3 → 1.20.0-rc1
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/bundles/sumaris-net.ngx-components.umd.js +214 -122
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +1 -0
- package/esm2015/src/app/admin/users/list/users.js +5 -1
- package/esm2015/src/app/core/core.module.js +3 -1
- package/esm2015/src/app/core/services/model/entity.model.js +5 -1
- package/esm2015/src/app/core/table/entities-table-datasource.class.js +136 -99
- package/esm2015/src/app/core/table/memory-table.class.js +3 -3
- package/esm2015/src/app/core/table/table.class.js +4 -5
- package/esm2015/src/app/shared/validator/validators.js +2 -2
- package/fesm2015/sumaris-net.ngx-components.js +146 -102
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +2 -2
- package/src/app/core/services/model/entity.model.d.ts +1 -0
- package/src/app/core/table/entities-table-datasource.class.d.ts +20 -26
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -3363,7 +3363,7 @@
|
|
|
3363
3363
|
function SharedValidators() {
|
|
3364
3364
|
}
|
|
3365
3365
|
SharedValidators.getDoubleRegexp = function (maxDecimals) {
|
|
3366
|
-
if (isNil(maxDecimals))
|
|
3366
|
+
if (isNil(maxDecimals) || maxDecimals === -1)
|
|
3367
3367
|
return this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS.NO_LIMIT;
|
|
3368
3368
|
if (maxDecimals < 0)
|
|
3369
3369
|
throw new Error("Invalid maxDecimals value: " + maxDecimals);
|
|
@@ -10919,6 +10919,10 @@
|
|
|
10919
10919
|
return isNotNil(obj.__typename) && (typeof obj.fromObject === 'function') && (typeof obj.asObject === 'function');
|
|
10920
10920
|
};
|
|
10921
10921
|
// Check that the object has a NOT nil attribute (ID by default)
|
|
10922
|
+
EntityUtils.isNotEntity = function (obj) {
|
|
10923
|
+
return isNil(obj.__typename) || (typeof obj.fromObject !== 'function') || (typeof obj.asObject !== 'function');
|
|
10924
|
+
};
|
|
10925
|
+
// Check that the object has a NOT nil attribute (ID by default)
|
|
10922
10926
|
EntityUtils.isNotEmpty = function (obj, checkedAttribute) {
|
|
10923
10927
|
return !!obj && obj[checkedAttribute] !== null && obj[checkedAttribute] !== undefined;
|
|
10924
10928
|
};
|
|
@@ -24221,6 +24225,7 @@
|
|
|
24221
24225
|
ionicCache.CacheModule,
|
|
24222
24226
|
i3$2.IonicStorageModule,
|
|
24223
24227
|
ngxJdenticon.NgxJdenticonModule,
|
|
24228
|
+
i1$2.TranslateModule.forChild(),
|
|
24224
24229
|
// Sub modules
|
|
24225
24230
|
AppGraphQLModule,
|
|
24226
24231
|
AppMenuModule
|
|
@@ -24906,11 +24911,6 @@
|
|
|
24906
24911
|
return AppTableUtils;
|
|
24907
24912
|
}());
|
|
24908
24913
|
|
|
24909
|
-
var AppTableDataSourceOptions = /** @class */ (function () {
|
|
24910
|
-
function AppTableDataSourceOptions() {
|
|
24911
|
-
}
|
|
24912
|
-
return AppTableDataSourceOptions;
|
|
24913
|
-
}());
|
|
24914
24914
|
// @dynamic
|
|
24915
24915
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
24916
24916
|
var EntitiesTableDataSource = /** @class */ (function (_super_1) {
|
|
@@ -24920,40 +24920,29 @@
|
|
|
24920
24920
|
*
|
|
24921
24921
|
* @param dataService A service to load and save data
|
|
24922
24922
|
* @param dataType Type of data contained by the Table. If not specified, then `data` with at least one element must be specified.
|
|
24923
|
-
* @param environment
|
|
24924
24923
|
* @param validatorService Service that create instances of the FormGroup used to validate row fields.
|
|
24925
24924
|
* @param config Additional configuration for table.
|
|
24926
24925
|
*/
|
|
24927
24926
|
function EntitiesTableDataSource(dataType, dataService, validatorService, config) {
|
|
24928
|
-
var _this = _super_1.call(this, [], dataType, validatorService, config) || this;
|
|
24927
|
+
var _this = _super_1.call(this, [], dataType, validatorService, Object.assign({ dataServiceOptions: {}, debug: config && config.suppressErrors === false, keepOriginalDataAfterConfirm: false }, config)) || this;
|
|
24929
24928
|
_this.dataService = dataService;
|
|
24930
24929
|
_this._creating = false;
|
|
24931
24930
|
_this._saving = false;
|
|
24932
|
-
_this._useValidator = false;
|
|
24933
24931
|
_this._stopWatching$ = new rxjs.Subject();
|
|
24934
24932
|
_this._editingRowCount = 0;
|
|
24935
24933
|
_this._fetchMoreFn = null;
|
|
24936
24934
|
_this.loadingSubject = new rxjs.BehaviorSubject(undefined);
|
|
24937
|
-
_this._options = Object.assign({ dataServiceOptions: {}, debug: config && config.suppressErrors === false, keepOriginalDataAfterConfirm: false }, config);
|
|
24938
|
-
_this._useValidator = isNotNil(validatorService);
|
|
24939
24935
|
_this._logTypeName = removeEnd((new dataType()).__typename || 'UnknownVO', 'VO');
|
|
24940
24936
|
// For DEV ONLY
|
|
24941
|
-
_this._debug = _this.
|
|
24937
|
+
_this._debug = _this.config.debug === true;
|
|
24942
24938
|
return _this;
|
|
24943
24939
|
}
|
|
24944
24940
|
Object.defineProperty(EntitiesTableDataSource.prototype, "serviceOptions", {
|
|
24945
24941
|
get: function () {
|
|
24946
|
-
return this.
|
|
24942
|
+
return this.config.dataServiceOptions;
|
|
24947
24943
|
},
|
|
24948
24944
|
set: function (value) {
|
|
24949
|
-
this.
|
|
24950
|
-
},
|
|
24951
|
-
enumerable: false,
|
|
24952
|
-
configurable: true
|
|
24953
|
-
});
|
|
24954
|
-
Object.defineProperty(EntitiesTableDataSource.prototype, "options", {
|
|
24955
|
-
get: function () {
|
|
24956
|
-
return this._options;
|
|
24945
|
+
this.config.dataServiceOptions = value;
|
|
24957
24946
|
},
|
|
24958
24947
|
enumerable: false,
|
|
24959
24948
|
configurable: true
|
|
@@ -24972,12 +24961,11 @@
|
|
|
24972
24961
|
enumerable: false,
|
|
24973
24962
|
configurable: true
|
|
24974
24963
|
});
|
|
24975
|
-
EntitiesTableDataSource.prototype.
|
|
24964
|
+
EntitiesTableDataSource.prototype.disconnect = function (collectionViewer) {
|
|
24965
|
+
_super_1.prototype.disconnect.call(this, collectionViewer);
|
|
24976
24966
|
this._stopWatching$.next();
|
|
24977
24967
|
this._stopWatching$.complete();
|
|
24978
|
-
this._stopWatching$.unsubscribe();
|
|
24979
24968
|
this.loadingSubject.complete();
|
|
24980
|
-
this.loadingSubject.unsubscribe();
|
|
24981
24969
|
};
|
|
24982
24970
|
EntitiesTableDataSource.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter) {
|
|
24983
24971
|
var _this = this;
|
|
@@ -25004,7 +24992,7 @@
|
|
|
25004
24992
|
};
|
|
25005
24993
|
EntitiesTableDataSource.prototype.save = function () {
|
|
25006
24994
|
return __awaiter(this, void 0, void 0, function () {
|
|
25007
|
-
var onlyDirtyRows, rows,
|
|
24995
|
+
var onlyDirtyRows, rows, confirmed, data, dataToSave_1, error_1;
|
|
25008
24996
|
var _this = this;
|
|
25009
24997
|
return __generator(this, function (_a) {
|
|
25010
24998
|
switch (_a.label) {
|
|
@@ -25023,32 +25011,33 @@
|
|
|
25023
25011
|
onlyDirtyRows = toBoolean(this.serviceOptions.saveOnlyDirtyRows, false);
|
|
25024
25012
|
_a.label = 1;
|
|
25025
25013
|
case 1:
|
|
25026
|
-
_a.trys.push([1,
|
|
25014
|
+
_a.trys.push([1, 5, 6, 7]);
|
|
25027
25015
|
if (this._debug)
|
|
25028
25016
|
console.debug("[table-datasource] Saving " + this._logTypeName + " rows... {onlyDirty: " + onlyDirtyRows + "}");
|
|
25029
25017
|
return [4 /*yield*/, this.getRows()];
|
|
25030
25018
|
case 2:
|
|
25031
25019
|
rows = _a.sent();
|
|
25032
|
-
|
|
25020
|
+
return [4 /*yield*/, this.confirmRows(rows)];
|
|
25021
|
+
case 3:
|
|
25022
|
+
confirmed = _a.sent();
|
|
25033
25023
|
// Cannot finish some rows: error
|
|
25034
|
-
if (
|
|
25024
|
+
if (!confirmed) {
|
|
25035
25025
|
// log errors
|
|
25036
25026
|
if (this._debug)
|
|
25037
|
-
|
|
25027
|
+
this.getEditingRows(rows).forEach(function (row) { return AppTableUtils.logRowErrors(row, "[table-datasource] " + _this._logTypeName + " row #" + row.id); });
|
|
25038
25028
|
// Stop with an error
|
|
25039
25029
|
throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
25040
25030
|
}
|
|
25041
25031
|
this._editingRowCount = 0;
|
|
25042
25032
|
data = void 0;
|
|
25043
|
-
if (this.
|
|
25033
|
+
if (!!this.validatorService) {
|
|
25044
25034
|
dataToSave_1 = [];
|
|
25045
25035
|
data = rows.map(function (row) {
|
|
25046
|
-
var
|
|
25047
|
-
currentData.fromObject(row.currentData);
|
|
25036
|
+
var entity = _this.toEntity(row.currentData);
|
|
25048
25037
|
// Filter to keep only dirty row
|
|
25049
25038
|
if (onlyDirtyRows && row.validator.dirty)
|
|
25050
|
-
dataToSave_1.push(
|
|
25051
|
-
return
|
|
25039
|
+
dataToSave_1.push(entity);
|
|
25040
|
+
return entity;
|
|
25052
25041
|
});
|
|
25053
25042
|
if (!onlyDirtyRows)
|
|
25054
25043
|
dataToSave_1 = data;
|
|
@@ -25068,46 +25057,65 @@
|
|
|
25068
25057
|
if (this._debug)
|
|
25069
25058
|
console.debug("[table-datasource] Asking service to save this " + this._logTypeName + " data:", dataToSave_1);
|
|
25070
25059
|
return [4 /*yield*/, this.dataService.saveAll(dataToSave_1, this.serviceOptions)];
|
|
25071
|
-
case
|
|
25060
|
+
case 4:
|
|
25072
25061
|
_a.sent();
|
|
25073
25062
|
if (this._debug)
|
|
25074
25063
|
console.debug("[table-datasource] Saving " + this._logTypeName + " data [OK]");
|
|
25075
25064
|
// LP 23/03/2021: update datasource is necessary but can be changed to a refetch() on QueryRef (must be created and registered in GraphqlService.watchQuery)
|
|
25076
25065
|
this.updateDatasource(data, { emitEvent: false });
|
|
25077
25066
|
return [2 /*return*/, true];
|
|
25078
|
-
case
|
|
25067
|
+
case 5:
|
|
25079
25068
|
error_1 = _a.sent();
|
|
25080
25069
|
if (this._debug)
|
|
25081
25070
|
console.error('[table-datasource] Error while saving: ' + error_1 && error_1.message || error_1);
|
|
25082
25071
|
throw error_1;
|
|
25083
|
-
case
|
|
25072
|
+
case 6:
|
|
25084
25073
|
this._saving = false;
|
|
25085
25074
|
this.markAsLoaded();
|
|
25086
25075
|
return [7 /*endfinally*/];
|
|
25087
|
-
case
|
|
25076
|
+
case 7: return [2 /*return*/];
|
|
25088
25077
|
}
|
|
25089
25078
|
});
|
|
25090
25079
|
});
|
|
25091
25080
|
};
|
|
25092
|
-
EntitiesTableDataSource.prototype.
|
|
25093
|
-
|
|
25094
|
-
|
|
25095
|
-
|
|
25096
|
-
|
|
25097
|
-
|
|
25081
|
+
EntitiesTableDataSource.prototype.getDataFromRows = function (rows, options) {
|
|
25082
|
+
var _this = this;
|
|
25083
|
+
if (options === void 0) { options = { originalData: false, toEntity: false }; }
|
|
25084
|
+
if (options.toEntity) {
|
|
25085
|
+
return _super_1.prototype.getDataFromRows.call(this, rows, options)
|
|
25086
|
+
.map(function (data) { return _this.toEntity(data); });
|
|
25098
25087
|
}
|
|
25088
|
+
return _super_1.prototype.getDataFromRows.call(this, rows, options);
|
|
25099
25089
|
};
|
|
25100
|
-
|
|
25101
|
-
|
|
25102
|
-
|
|
25103
|
-
|
|
25104
|
-
|
|
25105
|
-
|
|
25106
|
-
return
|
|
25090
|
+
EntitiesTableDataSource.prototype.toEntity = function (data) {
|
|
25091
|
+
if (EntityUtils.isNotEntity(data)) {
|
|
25092
|
+
var entity = new this.dataConstructor();
|
|
25093
|
+
entity.fromObject(data);
|
|
25094
|
+
return entity;
|
|
25095
|
+
}
|
|
25096
|
+
return data;
|
|
25107
25097
|
};
|
|
25108
|
-
EntitiesTableDataSource.prototype.
|
|
25109
|
-
|
|
25110
|
-
|
|
25098
|
+
EntitiesTableDataSource.prototype.updateDatasource = function (data, opts) {
|
|
25099
|
+
if (opts === void 0) { opts = { emitEvent: true }; }
|
|
25100
|
+
var _super = Object.create(null, {
|
|
25101
|
+
updateDatasource: { get: function () { return _super_1.prototype.updateDatasource; } }
|
|
25102
|
+
});
|
|
25103
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25104
|
+
return __generator(this, function (_a) {
|
|
25105
|
+
switch (_a.label) {
|
|
25106
|
+
case 0:
|
|
25107
|
+
if (this._debug)
|
|
25108
|
+
console.debug("[table-datasource] Updating datasource with data:", data);
|
|
25109
|
+
return [4 /*yield*/, _super.updateDatasource.call(this, data, opts)];
|
|
25110
|
+
case 1:
|
|
25111
|
+
_a.sent();
|
|
25112
|
+
if (opts.emitEvent) {
|
|
25113
|
+
this.markAsLoaded();
|
|
25114
|
+
}
|
|
25115
|
+
return [2 /*return*/];
|
|
25116
|
+
}
|
|
25117
|
+
});
|
|
25118
|
+
});
|
|
25111
25119
|
};
|
|
25112
25120
|
EntitiesTableDataSource.prototype.waitIdle = function (debounceTimeMs) {
|
|
25113
25121
|
return firstFalsePromise(this.loadingSubject
|
|
@@ -25116,34 +25124,88 @@
|
|
|
25116
25124
|
));
|
|
25117
25125
|
};
|
|
25118
25126
|
EntitiesTableDataSource.prototype.confirmCreate = function (row) {
|
|
25119
|
-
|
|
25120
|
-
return
|
|
25121
|
-
|
|
25122
|
-
|
|
25123
|
-
|
|
25124
|
-
|
|
25125
|
-
|
|
25127
|
+
var _super = Object.create(null, {
|
|
25128
|
+
confirmCreate: { get: function () { return _super_1.prototype.confirmCreate; } }
|
|
25129
|
+
});
|
|
25130
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25131
|
+
return __generator(this, function (_a) {
|
|
25132
|
+
switch (_a.label) {
|
|
25133
|
+
case 0: return [4 /*yield*/, _super.confirmCreate.call(this, row)];
|
|
25134
|
+
case 1:
|
|
25135
|
+
if (!(_a.sent()))
|
|
25136
|
+
return [2 /*return*/, false];
|
|
25137
|
+
if (row.editing && row.validator) {
|
|
25138
|
+
console.warn('[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false');
|
|
25139
|
+
row.validator.disable({ onlySelf: true, emitEvent: false });
|
|
25140
|
+
}
|
|
25141
|
+
return [2 /*return*/, true];
|
|
25142
|
+
}
|
|
25143
|
+
});
|
|
25144
|
+
});
|
|
25126
25145
|
};
|
|
25127
25146
|
EntitiesTableDataSource.prototype.confirmEdit = function (row) {
|
|
25128
|
-
|
|
25129
|
-
return
|
|
25130
|
-
|
|
25131
|
-
|
|
25132
|
-
|
|
25133
|
-
|
|
25134
|
-
|
|
25147
|
+
var _super = Object.create(null, {
|
|
25148
|
+
confirmEdit: { get: function () { return _super_1.prototype.confirmEdit; } }
|
|
25149
|
+
});
|
|
25150
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25151
|
+
return __generator(this, function (_a) {
|
|
25152
|
+
switch (_a.label) {
|
|
25153
|
+
case 0: return [4 /*yield*/, _super.confirmEdit.call(this, row)];
|
|
25154
|
+
case 1:
|
|
25155
|
+
if (!(_a.sent()))
|
|
25156
|
+
return [2 /*return*/, false];
|
|
25157
|
+
if (row.editing && row.validator) {
|
|
25158
|
+
console.warn('[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false');
|
|
25159
|
+
row.validator.disable({ onlySelf: true, emitEvent: false });
|
|
25160
|
+
}
|
|
25161
|
+
return [2 /*return*/, true];
|
|
25162
|
+
}
|
|
25163
|
+
});
|
|
25164
|
+
});
|
|
25135
25165
|
};
|
|
25136
25166
|
EntitiesTableDataSource.prototype.startEdit = function (row) {
|
|
25137
|
-
|
|
25138
|
-
|
|
25139
|
-
|
|
25140
|
-
this
|
|
25167
|
+
var _super = Object.create(null, {
|
|
25168
|
+
startEdit: { get: function () { return _super_1.prototype.startEdit; } }
|
|
25169
|
+
});
|
|
25170
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25171
|
+
var done;
|
|
25172
|
+
return __generator(this, function (_a) {
|
|
25173
|
+
switch (_a.label) {
|
|
25174
|
+
case 0:
|
|
25175
|
+
if (row.editing)
|
|
25176
|
+
return [2 /*return*/]; // Already editing
|
|
25177
|
+
if (this._debug)
|
|
25178
|
+
console.debug('[table-datasource] Start to edit row', row);
|
|
25179
|
+
return [4 /*yield*/, _super.startEdit.call(this, row)];
|
|
25180
|
+
case 1:
|
|
25181
|
+
done = _a.sent();
|
|
25182
|
+
if (done)
|
|
25183
|
+
this._editingRowCount++;
|
|
25184
|
+
return [2 /*return*/, done];
|
|
25185
|
+
}
|
|
25186
|
+
});
|
|
25187
|
+
});
|
|
25141
25188
|
};
|
|
25142
|
-
EntitiesTableDataSource.prototype.
|
|
25143
|
-
|
|
25144
|
-
|
|
25145
|
-
|
|
25146
|
-
this
|
|
25189
|
+
EntitiesTableDataSource.prototype.cancel = function (row) {
|
|
25190
|
+
var _super = Object.create(null, {
|
|
25191
|
+
cancel: { get: function () { return _super_1.prototype.cancel; } }
|
|
25192
|
+
});
|
|
25193
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25194
|
+
var done;
|
|
25195
|
+
return __generator(this, function (_a) {
|
|
25196
|
+
switch (_a.label) {
|
|
25197
|
+
case 0:
|
|
25198
|
+
if (this._debug)
|
|
25199
|
+
console.debug('[table-datasource] Cancelling row', row);
|
|
25200
|
+
return [4 /*yield*/, _super.cancel.call(this, row)];
|
|
25201
|
+
case 1:
|
|
25202
|
+
done = _a.sent();
|
|
25203
|
+
if (done)
|
|
25204
|
+
this._editingRowCount--;
|
|
25205
|
+
return [2 /*return*/, done];
|
|
25206
|
+
}
|
|
25207
|
+
});
|
|
25208
|
+
});
|
|
25147
25209
|
};
|
|
25148
25210
|
EntitiesTableDataSource.prototype.handleError = function (error, message) {
|
|
25149
25211
|
var errorMsg = error && error.message || error;
|
|
@@ -25158,39 +25220,65 @@
|
|
|
25158
25220
|
throw error;
|
|
25159
25221
|
};
|
|
25160
25222
|
EntitiesTableDataSource.prototype.delete = function (id) {
|
|
25161
|
-
var
|
|
25162
|
-
|
|
25163
|
-
|
|
25164
|
-
|
|
25165
|
-
|
|
25166
|
-
|
|
25167
|
-
|
|
25168
|
-
|
|
25169
|
-
|
|
25170
|
-
|
|
25171
|
-
|
|
25172
|
-
|
|
25173
|
-
|
|
25174
|
-
|
|
25175
|
-
|
|
25176
|
-
|
|
25177
|
-
|
|
25178
|
-
|
|
25179
|
-
|
|
25180
|
-
|
|
25181
|
-
|
|
25223
|
+
var _super = Object.create(null, {
|
|
25224
|
+
delete: { get: function () { return _super_1.prototype.delete; } }
|
|
25225
|
+
});
|
|
25226
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25227
|
+
var row, present, err_1;
|
|
25228
|
+
return __generator(this, function (_a) {
|
|
25229
|
+
switch (_a.label) {
|
|
25230
|
+
case 0:
|
|
25231
|
+
// If new row: not need to propagate to the dataService
|
|
25232
|
+
if (id === -1) {
|
|
25233
|
+
return [2 /*return*/, _super.delete.call(this, id)];
|
|
25234
|
+
}
|
|
25235
|
+
row = this.getRow(id);
|
|
25236
|
+
if (!row) {
|
|
25237
|
+
console.error("[table-datasource] Row to delete with id=" + id + " not found");
|
|
25238
|
+
return [2 /*return*/];
|
|
25239
|
+
}
|
|
25240
|
+
this.markAsLoading();
|
|
25241
|
+
_a.label = 1;
|
|
25242
|
+
case 1:
|
|
25243
|
+
_a.trys.push([1, 6, 7, 8]);
|
|
25244
|
+
return [4 /*yield*/, this.dataService.deleteAll([row.currentData], this.serviceOptions)];
|
|
25245
|
+
case 2:
|
|
25246
|
+
_a.sent();
|
|
25247
|
+
// Make sure row has been deleted (because GrapQHl cache remove can failed)
|
|
25248
|
+
return [4 /*yield*/, sleep(300)];
|
|
25249
|
+
case 3:
|
|
25250
|
+
// Make sure row has been deleted (because GrapQHl cache remove can failed)
|
|
25251
|
+
_a.sent();
|
|
25252
|
+
present = this.getRow(id) === row;
|
|
25253
|
+
if (!present) return [3 /*break*/, 5];
|
|
25254
|
+
console.warn('[table-datasource] Force deletion of 1 row (Is service applying deletion to observable ?)');
|
|
25255
|
+
return [4 /*yield*/, _super.delete.call(this, id)];
|
|
25256
|
+
case 4:
|
|
25257
|
+
_a.sent();
|
|
25258
|
+
_a.label = 5;
|
|
25259
|
+
case 5: return [3 /*break*/, 8];
|
|
25260
|
+
case 6:
|
|
25261
|
+
err_1 = _a.sent();
|
|
25262
|
+
this.handleErrorPromise(err_1);
|
|
25263
|
+
return [3 /*break*/, 8];
|
|
25264
|
+
case 7:
|
|
25265
|
+
this.markAsLoaded();
|
|
25266
|
+
return [7 /*endfinally*/];
|
|
25267
|
+
case 8: return [2 /*return*/];
|
|
25268
|
+
}
|
|
25269
|
+
});
|
|
25182
25270
|
});
|
|
25183
25271
|
};
|
|
25184
25272
|
EntitiesTableDataSource.prototype.deleteAll = function (rows) {
|
|
25185
25273
|
var _this = this;
|
|
25186
25274
|
this.markAsLoading();
|
|
25187
|
-
var data =
|
|
25275
|
+
var data = this.getDataFromRows(rows);
|
|
25188
25276
|
var rowsById = rows.reduce(function (res, row) {
|
|
25189
25277
|
res[row.id] = row;
|
|
25190
25278
|
return res;
|
|
25191
25279
|
}, {});
|
|
25192
25280
|
var self = this;
|
|
25193
|
-
var
|
|
25281
|
+
var inheritedDelete = _super_1.prototype.delete;
|
|
25194
25282
|
return this.dataService.deleteAll(data, this.serviceOptions)
|
|
25195
25283
|
.catch(function (err) { return _this.handleErrorPromise(err); })
|
|
25196
25284
|
.then(function () {
|
|
@@ -25204,20 +25292,20 @@
|
|
|
25204
25292
|
// Apply missing deletion
|
|
25205
25293
|
if (isNotEmptyArray(rowNotDeleted)) {
|
|
25206
25294
|
console.warn("[table-datasource] Force deletion of " + rowNotDeleted.length + " rows (Is service applying deletion to observable ?)");
|
|
25207
|
-
rowNotDeleted.forEach(function (r) { return
|
|
25295
|
+
rowNotDeleted.forEach(function (r) { return inheritedDelete.call(self, r.id); });
|
|
25208
25296
|
}
|
|
25209
25297
|
_this.loadingSubject.next(false);
|
|
25210
25298
|
});
|
|
25211
25299
|
};
|
|
25212
25300
|
EntitiesTableDataSource.prototype.getRows = function () {
|
|
25213
|
-
return
|
|
25301
|
+
return this.rowsSubject.toPromise();
|
|
25214
25302
|
};
|
|
25215
25303
|
EntitiesTableDataSource.prototype.asyncCreateNew = function (insertAt) {
|
|
25216
25304
|
var _super = Object.create(null, {
|
|
25217
25305
|
createNew: { get: function () { return _super_1.prototype.createNew; } }
|
|
25218
25306
|
});
|
|
25219
25307
|
return __awaiter(this, void 0, void 0, function () {
|
|
25220
|
-
var row, res,
|
|
25308
|
+
var row, res, err_2;
|
|
25221
25309
|
return __generator(this, function (_a) {
|
|
25222
25310
|
switch (_a.label) {
|
|
25223
25311
|
case 0:
|
|
@@ -25226,8 +25314,8 @@
|
|
|
25226
25314
|
this._creating = true;
|
|
25227
25315
|
_super.createNew.call(this, insertAt);
|
|
25228
25316
|
row = this.getRow(-1);
|
|
25229
|
-
if (!(row && this.
|
|
25230
|
-
res = this.
|
|
25317
|
+
if (!(row && this.config.onRowCreated)) return [3 /*break*/, 4];
|
|
25318
|
+
res = this.config.onRowCreated(row);
|
|
25231
25319
|
if (!(res instanceof Promise)) return [3 /*break*/, 4];
|
|
25232
25320
|
_a.label = 1;
|
|
25233
25321
|
case 1:
|
|
@@ -25237,8 +25325,8 @@
|
|
|
25237
25325
|
_a.sent();
|
|
25238
25326
|
return [3 /*break*/, 4];
|
|
25239
25327
|
case 3:
|
|
25240
|
-
|
|
25241
|
-
console.error(
|
|
25328
|
+
err_2 = _a.sent();
|
|
25329
|
+
console.error(err_2 && err_2.message || err_2, err_2);
|
|
25242
25330
|
return [3 /*break*/, 4];
|
|
25243
25331
|
case 4:
|
|
25244
25332
|
this._editingRowCount++;
|
|
@@ -25266,19 +25354,19 @@
|
|
|
25266
25354
|
updateDatasource: { get: function () { return _super_1.prototype.updateDatasource; } }
|
|
25267
25355
|
});
|
|
25268
25356
|
return __awaiter(this, void 0, void 0, function () {
|
|
25269
|
-
var res, existingData;
|
|
25357
|
+
var fetchMoreFn, res, existingData;
|
|
25270
25358
|
return __generator(this, function (_a) {
|
|
25271
25359
|
switch (_a.label) {
|
|
25272
25360
|
case 0:
|
|
25273
25361
|
if (!this._fetchMoreFn)
|
|
25274
|
-
return [2 /*return*/, false];
|
|
25362
|
+
return [2 /*return*/, false];
|
|
25275
25363
|
if (this._editingRowCount > 0) {
|
|
25276
25364
|
console.warn('Cannot fetch more because still editing row');
|
|
25277
25365
|
return [2 /*return*/];
|
|
25278
25366
|
}
|
|
25279
|
-
|
|
25280
|
-
this._fetchMoreFn = null;
|
|
25281
|
-
return [4 /*yield*/,
|
|
25367
|
+
fetchMoreFn = this._fetchMoreFn;
|
|
25368
|
+
this._fetchMoreFn = null;
|
|
25369
|
+
return [4 /*yield*/, fetchMoreFn()];
|
|
25282
25370
|
case 1:
|
|
25283
25371
|
res = _a.sent();
|
|
25284
25372
|
// Skip if empty (no more data)
|
|
@@ -25287,8 +25375,10 @@
|
|
|
25287
25375
|
return [4 /*yield*/, this.getData()];
|
|
25288
25376
|
case 2:
|
|
25289
25377
|
existingData = _a.sent();
|
|
25290
|
-
_super.updateDatasource.call(this, existingData.concat.apply(existingData, __spread(res.data)), opts);
|
|
25291
|
-
|
|
25378
|
+
return [4 /*yield*/, _super.updateDatasource.call(this, existingData.concat.apply(existingData, __spread(res.data)), opts)];
|
|
25379
|
+
case 3:
|
|
25380
|
+
_a.sent();
|
|
25381
|
+
// Store next fetchMore function
|
|
25292
25382
|
this._fetchMoreFn = res.fetchMore;
|
|
25293
25383
|
return [2 /*return*/, true];
|
|
25294
25384
|
}
|
|
@@ -25314,8 +25404,8 @@
|
|
|
25314
25404
|
EntitiesTableDataSource.ctorParameters = function () { return [
|
|
25315
25405
|
{ type: Function },
|
|
25316
25406
|
{ type: undefined },
|
|
25317
|
-
{ type:
|
|
25318
|
-
{ type:
|
|
25407
|
+
{ type: undefined },
|
|
25408
|
+
{ type: undefined }
|
|
25319
25409
|
]; };
|
|
25320
25410
|
|
|
25321
25411
|
var SETTINGS_DISPLAY_COLUMNS = 'displayColumns';
|
|
@@ -25806,7 +25896,6 @@
|
|
|
25806
25896
|
};
|
|
25807
25897
|
AppTable.prototype.ngOnDestroy = function () {
|
|
25808
25898
|
var _this = this;
|
|
25809
|
-
var _a;
|
|
25810
25899
|
this._subscription.unsubscribe();
|
|
25811
25900
|
// Unsubscribe column value changes
|
|
25812
25901
|
Object.keys(this._cellValueChangesDefs).forEach(function (col) { return _this.stopCellValueChanges(col, true); });
|
|
@@ -25831,7 +25920,6 @@
|
|
|
25831
25920
|
this.onError.unsubscribe();
|
|
25832
25921
|
this._destroy$.next();
|
|
25833
25922
|
this._destroy$.unsubscribe();
|
|
25834
|
-
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
|
|
25835
25923
|
};
|
|
25836
25924
|
AppTable.prototype.updateView = function (res, opts) {
|
|
25837
25925
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -25876,7 +25964,7 @@
|
|
|
25876
25964
|
this._dataSourceLoadingSubscription.unsubscribe();
|
|
25877
25965
|
this._subscription.remove(this._dataSourceLoadingSubscription);
|
|
25878
25966
|
}
|
|
25879
|
-
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.
|
|
25967
|
+
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
25880
25968
|
this._dataSource = null;
|
|
25881
25969
|
};
|
|
25882
25970
|
AppTable.prototype.addColumnDef = function (column) {
|
|
@@ -26062,6 +26150,7 @@
|
|
|
26062
26150
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
26063
26151
|
this.previouslyEditedRowId = opts.keepEditing ? ((((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) ? this.editedRow.id : undefined) || ((_b = this.singleSelectedRow) === null || _b === void 0 ? void 0 : _b.id)) : undefined;
|
|
26064
26152
|
previouslyEditedData = opts.keepEditing ? (isNotNil(this.previouslyEditedRowId) && ((_c = this.editedRow) === null || _c === void 0 ? void 0 : _c.currentData) || ((_d = this.singleSelectedRow) === null || _d === void 0 ? void 0 : _d.currentData)) : undefined;
|
|
26153
|
+
// TODO: remove this, has it redundant with dataSource.confirmAllRows() called in dataSource.save()
|
|
26065
26154
|
if (!this.confirmEditCreate()) {
|
|
26066
26155
|
throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
26067
26156
|
}
|
|
@@ -27076,7 +27165,7 @@
|
|
|
27076
27165
|
return __generator(this, function (_e) {
|
|
27077
27166
|
switch (_e.label) {
|
|
27078
27167
|
case 0:
|
|
27079
|
-
markRowAsPristine = ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.
|
|
27168
|
+
markRowAsPristine = ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.config.keepOriginalDataAfterConfirm) === true;
|
|
27080
27169
|
if (!markRowAsPristine) return [3 /*break*/, 2];
|
|
27081
27170
|
(_b = row.validator) === null || _b === void 0 ? void 0 : _b.markAsPristine();
|
|
27082
27171
|
if (!(!opts || opts.onlySelf !== true)) return [3 /*break*/, 2];
|
|
@@ -28819,7 +28908,7 @@
|
|
|
28819
28908
|
{ type: Function },
|
|
28820
28909
|
{ type: InMemoryEntitiesService },
|
|
28821
28910
|
{ type: ngxMaterialTable.ValidatorService },
|
|
28822
|
-
{ type:
|
|
28911
|
+
{ type: undefined },
|
|
28823
28912
|
{ type: undefined }
|
|
28824
28913
|
]; };
|
|
28825
28914
|
AppInMemoryTable.propDecorators = {
|
|
@@ -30080,7 +30169,11 @@
|
|
|
30080
30169
|
switch (authTokenType) {
|
|
30081
30170
|
case "basic":
|
|
30082
30171
|
_this.setShowColumn('pubkey', false, { emitEvent: false });
|
|
30172
|
+
_this.setShowColumn('username', true, { emitEvent: false });
|
|
30173
|
+
_this.setShowColumn('usernameExtranet', true, { emitEvent: false });
|
|
30174
|
+
break;
|
|
30083
30175
|
case "basic-and-token":
|
|
30176
|
+
_this.setShowColumn('pubkey', true, { emitEvent: false });
|
|
30084
30177
|
_this.setShowColumn('username', true, { emitEvent: false });
|
|
30085
30178
|
_this.setShowColumn('usernameExtranet', true, { emitEvent: false });
|
|
30086
30179
|
break;
|
|
@@ -31834,7 +31927,6 @@
|
|
|
31834
31927
|
exports.AppTabEditor = AppTabEditor;
|
|
31835
31928
|
exports.AppTabEditorOptions = AppTabEditorOptions;
|
|
31836
31929
|
exports.AppTable = AppTable;
|
|
31837
|
-
exports.AppTableDataSourceOptions = AppTableDataSourceOptions;
|
|
31838
31930
|
exports.AppTableUtils = AppTableUtils;
|
|
31839
31931
|
exports.AppValidatorService = AppValidatorService;
|
|
31840
31932
|
exports.AppendToInputDirective = AppendToInputDirective;
|