@sumaris-net/ngx-components 1.19.3 → 1.20.0-rc3
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 +420 -245
- 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 +4 -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 +193 -131
- package/esm2015/src/app/core/table/memory-table.class.js +3 -3
- package/esm2015/src/app/core/table/table.class.js +95 -91
- package/esm2015/src/app/shared/validator/validators.js +2 -2
- package/fesm2015/sumaris-net.ngx-components.js +294 -220
- 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 +25 -28
- package/src/app/core/table/table.class.d.ts +2 -2
- 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,92 +25220,166 @@
|
|
|
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
|
-
var
|
|
25186
|
-
|
|
25187
|
-
|
|
25188
|
-
|
|
25189
|
-
|
|
25190
|
-
|
|
25191
|
-
|
|
25192
|
-
|
|
25193
|
-
|
|
25194
|
-
|
|
25195
|
-
|
|
25196
|
-
|
|
25197
|
-
|
|
25198
|
-
|
|
25199
|
-
|
|
25200
|
-
|
|
25201
|
-
|
|
25202
|
-
|
|
25203
|
-
|
|
25204
|
-
|
|
25205
|
-
|
|
25206
|
-
|
|
25207
|
-
|
|
25208
|
-
|
|
25209
|
-
|
|
25273
|
+
var _super = Object.create(null, {
|
|
25274
|
+
delete: { get: function () { return _super_1.prototype.delete; } }
|
|
25275
|
+
});
|
|
25276
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25277
|
+
var data, rowsById, self, rowNotDeleted, err_2;
|
|
25278
|
+
var _this = this;
|
|
25279
|
+
return __generator(this, function (_a) {
|
|
25280
|
+
switch (_a.label) {
|
|
25281
|
+
case 0:
|
|
25282
|
+
this.markAsLoading();
|
|
25283
|
+
data = this.getDataFromRows(rows);
|
|
25284
|
+
rowsById = rows.reduce(function (res, row) {
|
|
25285
|
+
res[row.id] = row;
|
|
25286
|
+
return res;
|
|
25287
|
+
}, {});
|
|
25288
|
+
self = this;
|
|
25289
|
+
_a.label = 1;
|
|
25290
|
+
case 1:
|
|
25291
|
+
_a.trys.push([1, 5, 6, 7]);
|
|
25292
|
+
return [4 /*yield*/, this.dataService.deleteAll(data, this.serviceOptions)];
|
|
25293
|
+
case 2:
|
|
25294
|
+
_a.sent();
|
|
25295
|
+
rowNotDeleted = Object.getOwnPropertyNames(rowsById).reduce(function (res, id) {
|
|
25296
|
+
var row = rowsById[id];
|
|
25297
|
+
var present = self.getRow(+id) === row;
|
|
25298
|
+
return present ? res.concat(row) : res;
|
|
25299
|
+
}, []).sort(function (a, b) { return a.id > b.id ? -1 : 1; });
|
|
25300
|
+
if (!isNotEmptyArray(rowNotDeleted)) return [3 /*break*/, 4];
|
|
25301
|
+
console.warn("[table-datasource] Force deletion of " + rowNotDeleted.length + " rows (Is service applying deletion to observable ?)");
|
|
25302
|
+
return [4 /*yield*/, Promise.all(rowNotDeleted.map(function (r) { return _super.delete.call(_this, r.id); }))];
|
|
25303
|
+
case 3:
|
|
25304
|
+
_a.sent();
|
|
25305
|
+
_a.label = 4;
|
|
25306
|
+
case 4: return [3 /*break*/, 7];
|
|
25307
|
+
case 5:
|
|
25308
|
+
err_2 = _a.sent();
|
|
25309
|
+
this.handleErrorPromise(err_2);
|
|
25310
|
+
return [3 /*break*/, 7];
|
|
25311
|
+
case 6:
|
|
25312
|
+
this.markAsLoaded();
|
|
25313
|
+
return [7 /*endfinally*/];
|
|
25314
|
+
case 7: return [2 /*return*/];
|
|
25315
|
+
}
|
|
25316
|
+
});
|
|
25210
25317
|
});
|
|
25211
25318
|
};
|
|
25212
25319
|
EntitiesTableDataSource.prototype.getRows = function () {
|
|
25213
|
-
return
|
|
25320
|
+
return this.rowsSubject.toPromise();
|
|
25214
25321
|
};
|
|
25215
|
-
EntitiesTableDataSource.prototype.
|
|
25322
|
+
EntitiesTableDataSource.prototype.createNew = function (insertAt) {
|
|
25216
25323
|
var _super = Object.create(null, {
|
|
25217
25324
|
createNew: { get: function () { return _super_1.prototype.createNew; } }
|
|
25218
25325
|
});
|
|
25219
25326
|
return __awaiter(this, void 0, void 0, function () {
|
|
25220
|
-
var
|
|
25327
|
+
var done, row, err_3;
|
|
25221
25328
|
return __generator(this, function (_a) {
|
|
25222
25329
|
switch (_a.label) {
|
|
25223
25330
|
case 0:
|
|
25224
25331
|
if (this._creating)
|
|
25225
25332
|
return [2 /*return*/]; // Avoid multiple call (should never occur)
|
|
25226
25333
|
this._creating = true;
|
|
25227
|
-
_super.createNew.call(this, insertAt);
|
|
25228
|
-
row = this.getRow(-1);
|
|
25229
|
-
if (!(row && this._options && this._options.onRowCreated)) return [3 /*break*/, 4];
|
|
25230
|
-
res = this._options.onRowCreated(row);
|
|
25231
|
-
if (!(res instanceof Promise)) return [3 /*break*/, 4];
|
|
25232
|
-
_a.label = 1;
|
|
25334
|
+
return [4 /*yield*/, _super.createNew.call(this, insertAt)];
|
|
25233
25335
|
case 1:
|
|
25234
|
-
_a.
|
|
25235
|
-
return [
|
|
25336
|
+
done = _a.sent();
|
|
25337
|
+
if (!(done && this.config.onRowCreated)) return [3 /*break*/, 5];
|
|
25338
|
+
row = this.getRow(-1);
|
|
25339
|
+
_a.label = 2;
|
|
25236
25340
|
case 2:
|
|
25237
|
-
_a.
|
|
25238
|
-
return [
|
|
25341
|
+
_a.trys.push([2, 4, , 5]);
|
|
25342
|
+
return [4 /*yield*/, this.config.onRowCreated(row)];
|
|
25239
25343
|
case 3:
|
|
25240
|
-
|
|
25241
|
-
|
|
25242
|
-
return [3 /*break*/, 4];
|
|
25344
|
+
_a.sent();
|
|
25345
|
+
return [3 /*break*/, 5];
|
|
25243
25346
|
case 4:
|
|
25244
|
-
|
|
25347
|
+
err_3 = _a.sent();
|
|
25348
|
+
console.error(err_3 && err_3.message || err_3, err_3);
|
|
25349
|
+
return [3 /*break*/, 5];
|
|
25350
|
+
case 5:
|
|
25351
|
+
if (done)
|
|
25352
|
+
this._editingRowCount++;
|
|
25245
25353
|
this._creating = false;
|
|
25246
|
-
return [2 /*return
|
|
25354
|
+
return [2 /*return*/, done];
|
|
25355
|
+
}
|
|
25356
|
+
});
|
|
25357
|
+
});
|
|
25358
|
+
};
|
|
25359
|
+
EntitiesTableDataSource.prototype.createRowValidator = function () {
|
|
25360
|
+
var _super = Object.create(null, {
|
|
25361
|
+
createRowValidator: { get: function () { return _super_1.prototype.createRowValidator; } }
|
|
25362
|
+
});
|
|
25363
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
25364
|
+
var validator, err_4;
|
|
25365
|
+
return __generator(this, function (_a) {
|
|
25366
|
+
switch (_a.label) {
|
|
25367
|
+
case 0: return [4 /*yield*/, _super.createRowValidator.call(this)];
|
|
25368
|
+
case 1:
|
|
25369
|
+
validator = _a.sent();
|
|
25370
|
+
if (!(validator && this.config.onRowValidator)) return [3 /*break*/, 5];
|
|
25371
|
+
_a.label = 2;
|
|
25372
|
+
case 2:
|
|
25373
|
+
_a.trys.push([2, 4, , 5]);
|
|
25374
|
+
return [4 /*yield*/, this.config.onRowValidator(validator)];
|
|
25375
|
+
case 3:
|
|
25376
|
+
_a.sent();
|
|
25377
|
+
return [3 /*break*/, 5];
|
|
25378
|
+
case 4:
|
|
25379
|
+
err_4 = _a.sent();
|
|
25380
|
+
console.error(err_4 && err_4.message || err_4, err_4);
|
|
25381
|
+
return [3 /*break*/, 5];
|
|
25382
|
+
case 5: return [2 /*return*/, validator];
|
|
25247
25383
|
}
|
|
25248
25384
|
});
|
|
25249
25385
|
});
|
|
@@ -25266,19 +25402,19 @@
|
|
|
25266
25402
|
updateDatasource: { get: function () { return _super_1.prototype.updateDatasource; } }
|
|
25267
25403
|
});
|
|
25268
25404
|
return __awaiter(this, void 0, void 0, function () {
|
|
25269
|
-
var res, existingData;
|
|
25405
|
+
var fetchMoreFn, res, existingData;
|
|
25270
25406
|
return __generator(this, function (_a) {
|
|
25271
25407
|
switch (_a.label) {
|
|
25272
25408
|
case 0:
|
|
25273
25409
|
if (!this._fetchMoreFn)
|
|
25274
|
-
return [2 /*return*/, false];
|
|
25410
|
+
return [2 /*return*/, false];
|
|
25275
25411
|
if (this._editingRowCount > 0) {
|
|
25276
25412
|
console.warn('Cannot fetch more because still editing row');
|
|
25277
25413
|
return [2 /*return*/];
|
|
25278
25414
|
}
|
|
25279
|
-
|
|
25280
|
-
this._fetchMoreFn = null;
|
|
25281
|
-
return [4 /*yield*/,
|
|
25415
|
+
fetchMoreFn = this._fetchMoreFn;
|
|
25416
|
+
this._fetchMoreFn = null;
|
|
25417
|
+
return [4 /*yield*/, fetchMoreFn()];
|
|
25282
25418
|
case 1:
|
|
25283
25419
|
res = _a.sent();
|
|
25284
25420
|
// Skip if empty (no more data)
|
|
@@ -25287,8 +25423,10 @@
|
|
|
25287
25423
|
return [4 /*yield*/, this.getData()];
|
|
25288
25424
|
case 2:
|
|
25289
25425
|
existingData = _a.sent();
|
|
25290
|
-
_super.updateDatasource.call(this, existingData.concat.apply(existingData, __spread(res.data)), opts);
|
|
25291
|
-
|
|
25426
|
+
return [4 /*yield*/, _super.updateDatasource.call(this, existingData.concat.apply(existingData, __spread(res.data)), opts)];
|
|
25427
|
+
case 3:
|
|
25428
|
+
_a.sent();
|
|
25429
|
+
// Store next fetchMore function
|
|
25292
25430
|
this._fetchMoreFn = res.fetchMore;
|
|
25293
25431
|
return [2 /*return*/, true];
|
|
25294
25432
|
}
|
|
@@ -25314,8 +25452,8 @@
|
|
|
25314
25452
|
EntitiesTableDataSource.ctorParameters = function () { return [
|
|
25315
25453
|
{ type: Function },
|
|
25316
25454
|
{ type: undefined },
|
|
25317
|
-
{ type:
|
|
25318
|
-
{ type:
|
|
25455
|
+
{ type: undefined },
|
|
25456
|
+
{ type: undefined }
|
|
25319
25457
|
]; };
|
|
25320
25458
|
|
|
25321
25459
|
var SETTINGS_DISPLAY_COLUMNS = 'displayColumns';
|
|
@@ -25806,7 +25944,6 @@
|
|
|
25806
25944
|
};
|
|
25807
25945
|
AppTable.prototype.ngOnDestroy = function () {
|
|
25808
25946
|
var _this = this;
|
|
25809
|
-
var _a;
|
|
25810
25947
|
this._subscription.unsubscribe();
|
|
25811
25948
|
// Unsubscribe column value changes
|
|
25812
25949
|
Object.keys(this._cellValueChangesDefs).forEach(function (col) { return _this.stopCellValueChanges(col, true); });
|
|
@@ -25831,7 +25968,6 @@
|
|
|
25831
25968
|
this.onError.unsubscribe();
|
|
25832
25969
|
this._destroy$.next();
|
|
25833
25970
|
this._destroy$.unsubscribe();
|
|
25834
|
-
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
|
|
25835
25971
|
};
|
|
25836
25972
|
AppTable.prototype.updateView = function (res, opts) {
|
|
25837
25973
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -25876,7 +26012,7 @@
|
|
|
25876
26012
|
this._dataSourceLoadingSubscription.unsubscribe();
|
|
25877
26013
|
this._subscription.remove(this._dataSourceLoadingSubscription);
|
|
25878
26014
|
}
|
|
25879
|
-
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.
|
|
26015
|
+
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
25880
26016
|
this._dataSource = null;
|
|
25881
26017
|
};
|
|
25882
26018
|
AppTable.prototype.addColumnDef = function (column) {
|
|
@@ -25933,13 +26069,23 @@
|
|
|
25933
26069
|
return true;
|
|
25934
26070
|
};
|
|
25935
26071
|
AppTable.prototype.confirmAndForward = function (event, row) {
|
|
25936
|
-
|
|
25937
|
-
|
|
25938
|
-
return
|
|
25939
|
-
|
|
25940
|
-
|
|
25941
|
-
|
|
25942
|
-
|
|
26072
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
26073
|
+
var done;
|
|
26074
|
+
return __generator(this, function (_e) {
|
|
26075
|
+
switch (_e.label) {
|
|
26076
|
+
case 0:
|
|
26077
|
+
row = row || this.editedRow;
|
|
26078
|
+
return [4 /*yield*/, this.confirmEditCreate(event, row)];
|
|
26079
|
+
case 1:
|
|
26080
|
+
done = _e.sent();
|
|
26081
|
+
if (done) {
|
|
26082
|
+
// Edit next row
|
|
26083
|
+
this.editRowById(event, row.id + 1, { focusColumn: this.firstUserColumn });
|
|
26084
|
+
}
|
|
26085
|
+
return [2 /*return*/, done];
|
|
26086
|
+
}
|
|
26087
|
+
});
|
|
26088
|
+
});
|
|
25943
26089
|
};
|
|
25944
26090
|
AppTable.prototype.editRowById = function (event, id, opts) {
|
|
25945
26091
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -25970,50 +26116,52 @@
|
|
|
25970
26116
|
* @param row
|
|
25971
26117
|
*/
|
|
25972
26118
|
AppTable.prototype.confirmEditCreate = function (event, row) {
|
|
25973
|
-
var _this = this;
|
|
25974
26119
|
var _a;
|
|
25975
|
-
|
|
25976
|
-
|
|
25977
|
-
return
|
|
25978
|
-
|
|
25979
|
-
|
|
25980
|
-
|
|
25981
|
-
|
|
25982
|
-
|
|
25983
|
-
|
|
25984
|
-
|
|
25985
|
-
|
|
25986
|
-
|
|
25987
|
-
|
|
25988
|
-
|
|
25989
|
-
|
|
25990
|
-
|
|
25991
|
-
|
|
25992
|
-
|
|
25993
|
-
|
|
25994
|
-
|
|
25995
|
-
|
|
25996
|
-
|
|
25997
|
-
|
|
25998
|
-
|
|
25999
|
-
|
|
26000
|
-
|
|
26001
|
-
|
|
26002
|
-
|
|
26003
|
-
|
|
26004
|
-
|
|
26005
|
-
|
|
26006
|
-
|
|
26007
|
-
|
|
26008
|
-
|
|
26009
|
-
|
|
26010
|
-
|
|
26011
|
-
|
|
26012
|
-
|
|
26013
|
-
|
|
26014
|
-
|
|
26015
|
-
|
|
26016
|
-
|
|
26120
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
26121
|
+
var done, error;
|
|
26122
|
+
return __generator(this, function (_e) {
|
|
26123
|
+
switch (_e.label) {
|
|
26124
|
+
case 0:
|
|
26125
|
+
row = row || this.editedRow;
|
|
26126
|
+
if (!row || !row.editing)
|
|
26127
|
+
return [2 /*return*/, true]; // no row to confirm
|
|
26128
|
+
// Stop event
|
|
26129
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
26130
|
+
return [4 /*yield*/, row.confirmEditCreate()];
|
|
26131
|
+
case 1:
|
|
26132
|
+
done = _e.sent();
|
|
26133
|
+
if (done) {
|
|
26134
|
+
// If edit finished, forget edited row
|
|
26135
|
+
if (row === this.editedRow) {
|
|
26136
|
+
this.editedRow = undefined;
|
|
26137
|
+
}
|
|
26138
|
+
// Mark table as dirty (if row is dirty)
|
|
26139
|
+
if ((_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty) {
|
|
26140
|
+
this.markAsDirty({ emitEvent: false /* because of resetError() */ });
|
|
26141
|
+
}
|
|
26142
|
+
// Clear error
|
|
26143
|
+
this.resetError();
|
|
26144
|
+
// Emit the confirm event
|
|
26145
|
+
this.onConfirmEditCreateRow.next(row);
|
|
26146
|
+
}
|
|
26147
|
+
else if (row.validator) {
|
|
26148
|
+
// NOT confirmed = row has error
|
|
26149
|
+
if (this.debug) {
|
|
26150
|
+
console.warn('[table] Cannot confirm row, because invalid');
|
|
26151
|
+
AppFormUtils.logFormErrors(row.validator, '[table] ');
|
|
26152
|
+
}
|
|
26153
|
+
// fix: mark all controls as touched to show errors
|
|
26154
|
+
row.validator.markAllAsTouched();
|
|
26155
|
+
// Compute row error, and propagate to table's error
|
|
26156
|
+
if (this.propagateRowError) {
|
|
26157
|
+
error = this.getRowError(row);
|
|
26158
|
+
this.setError(error);
|
|
26159
|
+
}
|
|
26160
|
+
}
|
|
26161
|
+
return [2 /*return*/, done];
|
|
26162
|
+
}
|
|
26163
|
+
});
|
|
26164
|
+
});
|
|
26017
26165
|
};
|
|
26018
26166
|
AppTable.prototype.cancelOrDelete = function (event, row, opts) {
|
|
26019
26167
|
// Delete new row
|
|
@@ -26062,6 +26210,7 @@
|
|
|
26062
26210
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
26063
26211
|
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
26212
|
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;
|
|
26213
|
+
// TODO: remove this, has it redundant with dataSource.confirmAllRows() called in dataSource.save()
|
|
26065
26214
|
if (!this.confirmEditCreate()) {
|
|
26066
26215
|
throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
26067
26216
|
}
|
|
@@ -26872,13 +27021,16 @@
|
|
|
26872
27021
|
};
|
|
26873
27022
|
AppTable.prototype.addRowToTable = function (insertAt) {
|
|
26874
27023
|
return __awaiter(this, void 0, void 0, function () {
|
|
27024
|
+
var done;
|
|
26875
27025
|
return __generator(this, function (_e) {
|
|
26876
27026
|
switch (_e.label) {
|
|
26877
27027
|
case 0:
|
|
26878
27028
|
this.focusFirstColumn = true;
|
|
26879
|
-
return [4 /*yield*/, this._dataSource.
|
|
27029
|
+
return [4 /*yield*/, this._dataSource.createNew(insertAt)];
|
|
26880
27030
|
case 1:
|
|
26881
|
-
_e.sent();
|
|
27031
|
+
done = _e.sent();
|
|
27032
|
+
if (!done)
|
|
27033
|
+
return [2 /*return*/, undefined];
|
|
26882
27034
|
this.editedRow = this._dataSource.getRow(-1);
|
|
26883
27035
|
// Emit start editing event
|
|
26884
27036
|
this.onStartEditingRow.emit(this.editedRow);
|
|
@@ -27020,54 +27172,74 @@
|
|
|
27020
27172
|
}
|
|
27021
27173
|
};
|
|
27022
27174
|
AppTable.prototype.deleteNewRow = function (event, row) {
|
|
27023
|
-
|
|
27024
|
-
|
|
27025
|
-
|
|
27026
|
-
|
|
27027
|
-
|
|
27028
|
-
|
|
27029
|
-
|
|
27030
|
-
|
|
27031
|
-
|
|
27032
|
-
|
|
27175
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27176
|
+
var done;
|
|
27177
|
+
return __generator(this, function (_e) {
|
|
27178
|
+
switch (_e.label) {
|
|
27179
|
+
case 0:
|
|
27180
|
+
if (row.id !== -1)
|
|
27181
|
+
throw new Error('Row must have id = -1');
|
|
27182
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
27183
|
+
this.selection.clear();
|
|
27184
|
+
this.editedRow = undefined; // unselect row
|
|
27185
|
+
return [4 /*yield*/, this._dataSource.cancelOrDelete(row)];
|
|
27186
|
+
case 1:
|
|
27187
|
+
done = _e.sent();
|
|
27188
|
+
if (done) {
|
|
27189
|
+
this.onCancelOrDeleteRow.next(row);
|
|
27190
|
+
this.resetError();
|
|
27191
|
+
this.totalRowCount--;
|
|
27192
|
+
this.visibleRowCount--;
|
|
27193
|
+
}
|
|
27194
|
+
return [2 /*return*/, done];
|
|
27195
|
+
}
|
|
27196
|
+
});
|
|
27197
|
+
});
|
|
27033
27198
|
};
|
|
27034
27199
|
AppTable.prototype.deleteExistingRow = function (event, row, opts) {
|
|
27035
27200
|
// Make sure row will be cancelled, and NOT deleted
|
|
27036
27201
|
if (row.id === -1)
|
|
27037
27202
|
throw new Error('Row must have an id');
|
|
27038
27203
|
if (event === null || event === void 0 ? void 0 : event.defaultPrevented)
|
|
27039
|
-
return
|
|
27204
|
+
return Promise.resolve(false); // SKip
|
|
27040
27205
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
27041
|
-
this.deleteRow(null, row, opts);
|
|
27206
|
+
return this.deleteRow(null, row, opts);
|
|
27042
27207
|
};
|
|
27043
27208
|
AppTable.prototype.cancelExistingRow = function (event, row, opts) {
|
|
27044
|
-
var _this = this;
|
|
27045
27209
|
var _a;
|
|
27046
|
-
|
|
27047
|
-
|
|
27048
|
-
|
|
27049
|
-
|
|
27050
|
-
|
|
27051
|
-
|
|
27052
|
-
|
|
27053
|
-
|
|
27054
|
-
|
|
27055
|
-
|
|
27056
|
-
|
|
27057
|
-
|
|
27210
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27211
|
+
var confirmed, confirm, keepEditing;
|
|
27212
|
+
return __generator(this, function (_e) {
|
|
27213
|
+
switch (_e.label) {
|
|
27214
|
+
case 0:
|
|
27215
|
+
// Make sure row will be cancelled, and NOT deleted
|
|
27216
|
+
if (row.id === -1 || !row.editing)
|
|
27217
|
+
throw new Error('Row cannot be canceling, but only deleting');
|
|
27218
|
+
confirmed = (!opts || opts.interactive !== false);
|
|
27219
|
+
if (!(!confirmed && ((_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty) && (this.confirmBeforeCancel || this.onBeforeCancelRows.observers.length > 0))) return [3 /*break*/, 2];
|
|
27220
|
+
event.stopPropagation();
|
|
27221
|
+
return [4 /*yield*/, this.canCancelRows([row], opts)];
|
|
27222
|
+
case 1:
|
|
27223
|
+
confirm = _e.sent();
|
|
27224
|
+
// If not confirmed: stop
|
|
27225
|
+
if (!confirm)
|
|
27226
|
+
return [2 /*return*/, false];
|
|
27227
|
+
_e.label = 2;
|
|
27228
|
+
case 2:
|
|
27229
|
+
keepEditing = row.editing && (!opts || opts.keepEditing !== false);
|
|
27230
|
+
this.editedRow = undefined; // unselect row
|
|
27231
|
+
this._dataSource.cancelOrDelete(row);
|
|
27232
|
+
this.onCancelOrDeleteRow.next(row);
|
|
27233
|
+
// Mark row as pristine
|
|
27234
|
+
this.checkIfRowPristine(row);
|
|
27235
|
+
// Restore editing state
|
|
27236
|
+
if (keepEditing) {
|
|
27237
|
+
this.editRow(undefined, row);
|
|
27238
|
+
}
|
|
27239
|
+
return [2 /*return*/, true];
|
|
27240
|
+
}
|
|
27058
27241
|
});
|
|
27059
|
-
|
|
27060
|
-
}
|
|
27061
|
-
var keepEditing = row.editing && (!opts || opts.keepEditing !== false);
|
|
27062
|
-
this.editedRow = undefined; // unselect row
|
|
27063
|
-
this._dataSource.cancelOrDelete(row);
|
|
27064
|
-
this.onCancelOrDeleteRow.next(row);
|
|
27065
|
-
// Mark row as pristine
|
|
27066
|
-
this.checkIfRowPristine(row);
|
|
27067
|
-
// Restore editing state
|
|
27068
|
-
if (keepEditing) {
|
|
27069
|
-
this.editRow(undefined, row);
|
|
27070
|
-
}
|
|
27242
|
+
});
|
|
27071
27243
|
};
|
|
27072
27244
|
AppTable.prototype.checkIfRowPristine = function (row, opts) {
|
|
27073
27245
|
var _a, _b;
|
|
@@ -27076,7 +27248,7 @@
|
|
|
27076
27248
|
return __generator(this, function (_e) {
|
|
27077
27249
|
switch (_e.label) {
|
|
27078
27250
|
case 0:
|
|
27079
|
-
markRowAsPristine = ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.
|
|
27251
|
+
markRowAsPristine = ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.config.keepOriginalDataAfterConfirm) === true;
|
|
27080
27252
|
if (!markRowAsPristine) return [3 /*break*/, 2];
|
|
27081
27253
|
(_b = row.validator) === null || _b === void 0 ? void 0 : _b.markAsPristine();
|
|
27082
27254
|
if (!(!opts || opts.onlySelf !== true)) return [3 /*break*/, 2];
|
|
@@ -28819,7 +28991,7 @@
|
|
|
28819
28991
|
{ type: Function },
|
|
28820
28992
|
{ type: InMemoryEntitiesService },
|
|
28821
28993
|
{ type: ngxMaterialTable.ValidatorService },
|
|
28822
|
-
{ type:
|
|
28994
|
+
{ type: undefined },
|
|
28823
28995
|
{ type: undefined }
|
|
28824
28996
|
]; };
|
|
28825
28997
|
AppInMemoryTable.propDecorators = {
|
|
@@ -30080,7 +30252,11 @@
|
|
|
30080
30252
|
switch (authTokenType) {
|
|
30081
30253
|
case "basic":
|
|
30082
30254
|
_this.setShowColumn('pubkey', false, { emitEvent: false });
|
|
30255
|
+
_this.setShowColumn('username', true, { emitEvent: false });
|
|
30256
|
+
_this.setShowColumn('usernameExtranet', true, { emitEvent: false });
|
|
30257
|
+
break;
|
|
30083
30258
|
case "basic-and-token":
|
|
30259
|
+
_this.setShowColumn('pubkey', true, { emitEvent: false });
|
|
30084
30260
|
_this.setShowColumn('username', true, { emitEvent: false });
|
|
30085
30261
|
_this.setShowColumn('usernameExtranet', true, { emitEvent: false });
|
|
30086
30262
|
break;
|
|
@@ -31834,7 +32010,6 @@
|
|
|
31834
32010
|
exports.AppTabEditor = AppTabEditor;
|
|
31835
32011
|
exports.AppTabEditorOptions = AppTabEditorOptions;
|
|
31836
32012
|
exports.AppTable = AppTable;
|
|
31837
|
-
exports.AppTableDataSourceOptions = AppTableDataSourceOptions;
|
|
31838
32013
|
exports.AppTableUtils = AppTableUtils;
|
|
31839
32014
|
exports.AppValidatorService = AppValidatorService;
|
|
31840
32015
|
exports.AppendToInputDirective = AppendToInputDirective;
|