@sumaris-net/ngx-components 1.19.1 → 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 +292 -155
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +7 -0
- package/esm2015/src/app/admin/users/list/users.js +5 -1
- package/esm2015/src/app/core/auth/form/form-auth.js +26 -20
- package/esm2015/src/app/core/core.module.js +3 -1
- package/esm2015/src/app/core/form/form.class.js +27 -7
- package/esm2015/src/app/core/services/base-entity-service.class.js +6 -6
- 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/platforms.js +3 -3
- package/esm2015/src/app/shared/validator/validators.js +2 -2
- package/fesm2015/sumaris-net.ngx-components.js +203 -133
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +2 -2
- package/src/app/core/auth/form/form-auth.d.ts +1 -1
- package/src/app/core/form/form.class.d.ts +8 -1
- 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/src/assets/i18n/en-US.json +21 -2
- package/src/assets/i18n/en.json +19 -1
- package/src/assets/i18n/fr.json +2 -2
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -1080,13 +1080,13 @@ const ɵ0 = isIpad;
|
|
|
1080
1080
|
const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
|
|
1081
1081
|
const isAndroid = (win) => testUserAgent(win, /android|sink/i);
|
|
1082
1082
|
const isCordova = (win) => {
|
|
1083
|
-
if (_cache.cordova === undefined) {
|
|
1083
|
+
if (_cache.cordova === null || _cache.cordova === undefined) {
|
|
1084
1084
|
_cache.cordova = !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
|
|
1085
1085
|
}
|
|
1086
1086
|
return _cache.cordova;
|
|
1087
1087
|
};
|
|
1088
1088
|
const isMobile = (win) => {
|
|
1089
|
-
if (_cache.mobile === undefined) {
|
|
1089
|
+
if (_cache.mobile === null || _cache.mobile === undefined) {
|
|
1090
1090
|
_cache.mobile = isCordova(window)
|
|
1091
1091
|
|| isAndroid(win) || isIOS(window)
|
|
1092
1092
|
|| (isTouchUi(win) && !isWindows(win));
|
|
@@ -2908,7 +2908,7 @@ const moment$2 = momentImported;
|
|
|
2908
2908
|
// @dynamic
|
|
2909
2909
|
class SharedValidators {
|
|
2910
2910
|
static getDoubleRegexp(maxDecimals) {
|
|
2911
|
-
if (isNil(maxDecimals))
|
|
2911
|
+
if (isNil(maxDecimals) || maxDecimals === -1)
|
|
2912
2912
|
return this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS.NO_LIMIT;
|
|
2913
2913
|
if (maxDecimals < 0)
|
|
2914
2914
|
throw new Error(`Invalid maxDecimals value: ${maxDecimals}`);
|
|
@@ -9730,6 +9730,10 @@ class EntityUtils {
|
|
|
9730
9730
|
return isNotNil(obj.__typename) && (typeof obj.fromObject === 'function') && (typeof obj.asObject === 'function');
|
|
9731
9731
|
}
|
|
9732
9732
|
// Check that the object has a NOT nil attribute (ID by default)
|
|
9733
|
+
static isNotEntity(obj) {
|
|
9734
|
+
return isNil(obj.__typename) || (typeof obj.fromObject !== 'function') || (typeof obj.asObject !== 'function');
|
|
9735
|
+
}
|
|
9736
|
+
// Check that the object has a NOT nil attribute (ID by default)
|
|
9733
9737
|
static isNotEmpty(obj, checkedAttribute) {
|
|
9734
9738
|
return !!obj && obj[checkedAttribute] !== null && obj[checkedAttribute] !== undefined;
|
|
9735
9739
|
}
|
|
@@ -17139,12 +17143,32 @@ class AppForm {
|
|
|
17139
17143
|
cancel() {
|
|
17140
17144
|
this.onCancel.emit();
|
|
17141
17145
|
}
|
|
17142
|
-
|
|
17143
|
-
|
|
17144
|
-
|
|
17145
|
-
|
|
17146
|
-
|
|
17147
|
-
|
|
17146
|
+
/**
|
|
17147
|
+
*
|
|
17148
|
+
* @param event
|
|
17149
|
+
* @param opts allow to skip validation check, using {checkValid: false}
|
|
17150
|
+
*/
|
|
17151
|
+
doSubmit(event, opts) {
|
|
17152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17153
|
+
if (!this._form) {
|
|
17154
|
+
this.markAllAsTouched({ emitEvent: true });
|
|
17155
|
+
return;
|
|
17156
|
+
}
|
|
17157
|
+
// Check if valid (if not disabled)
|
|
17158
|
+
if ((!opts || opts.checkValid !== false) && !this._form.valid) {
|
|
17159
|
+
// Wait validation end
|
|
17160
|
+
yield AppFormUtils.waitWhilePending(this._form);
|
|
17161
|
+
// Form is invalid: exit (+ log if debug)
|
|
17162
|
+
if (this._form.invalid) {
|
|
17163
|
+
this.markAllAsTouched({ emitEvent: true });
|
|
17164
|
+
if (this.debug)
|
|
17165
|
+
AppFormUtils.logFormErrors(this._form);
|
|
17166
|
+
return;
|
|
17167
|
+
}
|
|
17168
|
+
}
|
|
17169
|
+
// Emit event
|
|
17170
|
+
this.onSubmit.emit(event);
|
|
17171
|
+
});
|
|
17148
17172
|
}
|
|
17149
17173
|
setForm(form) {
|
|
17150
17174
|
if (this._form !== form) {
|
|
@@ -18251,24 +18275,30 @@ class AuthForm extends AppForm {
|
|
|
18251
18275
|
this.onCancel.emit();
|
|
18252
18276
|
}
|
|
18253
18277
|
doSubmit(event) {
|
|
18254
|
-
|
|
18255
|
-
event
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18278
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18279
|
+
if (event) {
|
|
18280
|
+
event.preventDefault();
|
|
18281
|
+
event.stopPropagation();
|
|
18282
|
+
}
|
|
18283
|
+
if (this.loading)
|
|
18284
|
+
return;
|
|
18285
|
+
if (!this.form.valid) {
|
|
18286
|
+
yield AppFormUtils.waitWhilePending(this.form);
|
|
18287
|
+
if (this.form.invalid) {
|
|
18288
|
+
AppFormUtils.logFormErrors(this.form);
|
|
18289
|
+
return; // Skip if invalid
|
|
18290
|
+
}
|
|
18291
|
+
}
|
|
18292
|
+
this.markAsLoading();
|
|
18293
|
+
const data = this.form.value;
|
|
18294
|
+
this.showPwd = false; // Hide password
|
|
18295
|
+
this.error = null; // Reset error
|
|
18296
|
+
setTimeout(() => this.onSubmit.emit({
|
|
18297
|
+
username: data.username,
|
|
18298
|
+
password: data.password,
|
|
18299
|
+
offline: data.offline
|
|
18300
|
+
}));
|
|
18301
|
+
});
|
|
18272
18302
|
}
|
|
18273
18303
|
register() {
|
|
18274
18304
|
this.onCancel.emit();
|
|
@@ -20948,6 +20978,7 @@ CoreModule.decorators = [
|
|
|
20948
20978
|
CacheModule,
|
|
20949
20979
|
IonicStorageModule,
|
|
20950
20980
|
NgxJdenticonModule,
|
|
20981
|
+
TranslateModule.forChild(),
|
|
20951
20982
|
// Sub modules
|
|
20952
20983
|
AppGraphQLModule,
|
|
20953
20984
|
AppMenuModule
|
|
@@ -21203,18 +21234,18 @@ class BaseEntityService extends BaseGraphqlService {
|
|
|
21203
21234
|
(data || []);
|
|
21204
21235
|
if (debug)
|
|
21205
21236
|
console.debug(this._logPrefix + `${this._logTypeName} items loaded in ${Date.now() - now}ms`);
|
|
21206
|
-
const
|
|
21237
|
+
const result = {
|
|
21207
21238
|
data: entities,
|
|
21208
|
-
total
|
|
21239
|
+
total: total || entities.length
|
|
21209
21240
|
};
|
|
21210
21241
|
// Add fetch more capability, if total was fetched
|
|
21211
21242
|
if (withTotal) {
|
|
21212
21243
|
const nextOffset = (offset || 0) + entities.length;
|
|
21213
|
-
if (nextOffset <
|
|
21214
|
-
|
|
21244
|
+
if (nextOffset < result.total) {
|
|
21245
|
+
result.fetchMore = () => this.loadAll(nextOffset, size, sortBy, sortDirection, filter, opts);
|
|
21215
21246
|
}
|
|
21216
21247
|
}
|
|
21217
|
-
return
|
|
21248
|
+
return result;
|
|
21218
21249
|
});
|
|
21219
21250
|
}
|
|
21220
21251
|
countAll(filter, opts) {
|
|
@@ -21536,8 +21567,6 @@ class AppTableUtils {
|
|
|
21536
21567
|
}
|
|
21537
21568
|
}
|
|
21538
21569
|
|
|
21539
|
-
class AppTableDataSourceOptions {
|
|
21540
|
-
}
|
|
21541
21570
|
// @dynamic
|
|
21542
21571
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
21543
21572
|
class EntitiesTableDataSource extends TableDataSource {
|
|
@@ -21546,34 +21575,27 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
21546
21575
|
*
|
|
21547
21576
|
* @param dataService A service to load and save data
|
|
21548
21577
|
* @param dataType Type of data contained by the Table. If not specified, then `data` with at least one element must be specified.
|
|
21549
|
-
* @param environment
|
|
21550
21578
|
* @param validatorService Service that create instances of the FormGroup used to validate row fields.
|
|
21551
21579
|
* @param config Additional configuration for table.
|
|
21552
21580
|
*/
|
|
21553
21581
|
constructor(dataType, dataService, validatorService, config) {
|
|
21554
|
-
super([], dataType, validatorService, config);
|
|
21582
|
+
super([], dataType, validatorService, Object.assign({ dataServiceOptions: {}, debug: config && config.suppressErrors === false, keepOriginalDataAfterConfirm: false }, config));
|
|
21555
21583
|
this.dataService = dataService;
|
|
21556
21584
|
this._creating = false;
|
|
21557
21585
|
this._saving = false;
|
|
21558
|
-
this._useValidator = false;
|
|
21559
21586
|
this._stopWatching$ = new Subject();
|
|
21560
21587
|
this._editingRowCount = 0;
|
|
21561
21588
|
this._fetchMoreFn = null;
|
|
21562
21589
|
this.loadingSubject = new BehaviorSubject(undefined);
|
|
21563
|
-
this._options = Object.assign({ dataServiceOptions: {}, debug: config && config.suppressErrors === false, keepOriginalDataAfterConfirm: false }, config);
|
|
21564
|
-
this._useValidator = isNotNil(validatorService);
|
|
21565
21590
|
this._logTypeName = removeEnd((new dataType()).__typename || 'UnknownVO', 'VO');
|
|
21566
21591
|
// For DEV ONLY
|
|
21567
|
-
this._debug = this.
|
|
21592
|
+
this._debug = this.config.debug === true;
|
|
21568
21593
|
}
|
|
21569
21594
|
get serviceOptions() {
|
|
21570
|
-
return this.
|
|
21595
|
+
return this.config.dataServiceOptions;
|
|
21571
21596
|
}
|
|
21572
21597
|
set serviceOptions(value) {
|
|
21573
|
-
this.
|
|
21574
|
-
}
|
|
21575
|
-
get options() {
|
|
21576
|
-
return this._options;
|
|
21598
|
+
this.config.dataServiceOptions = value;
|
|
21577
21599
|
}
|
|
21578
21600
|
get loaded() {
|
|
21579
21601
|
return this.loadingSubject.value === false; // Should be false when undefined (initial state)
|
|
@@ -21581,12 +21603,11 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
21581
21603
|
get loading() {
|
|
21582
21604
|
return this.loadingSubject.value !== false; // Should be true when undefined (initial state)
|
|
21583
21605
|
}
|
|
21584
|
-
|
|
21606
|
+
disconnect(collectionViewer) {
|
|
21607
|
+
super.disconnect(collectionViewer);
|
|
21585
21608
|
this._stopWatching$.next();
|
|
21586
21609
|
this._stopWatching$.complete();
|
|
21587
|
-
this._stopWatching$.unsubscribe();
|
|
21588
21610
|
this.loadingSubject.complete();
|
|
21589
|
-
this.loadingSubject.unsubscribe();
|
|
21590
21611
|
}
|
|
21591
21612
|
watchAll(offset, size, sortBy, sortDirection, filter) {
|
|
21592
21613
|
this._stopWatching$.next();
|
|
@@ -21630,27 +21651,26 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
21630
21651
|
// Get all rows
|
|
21631
21652
|
const rows = yield this.getRows();
|
|
21632
21653
|
// Finish editing all rows
|
|
21633
|
-
const
|
|
21654
|
+
const confirmed = yield this.confirmRows(rows);
|
|
21634
21655
|
// Cannot finish some rows: error
|
|
21635
|
-
if (
|
|
21656
|
+
if (!confirmed) {
|
|
21636
21657
|
// log errors
|
|
21637
21658
|
if (this._debug)
|
|
21638
|
-
|
|
21659
|
+
this.getEditingRows(rows).forEach(row => AppTableUtils.logRowErrors(row, `[table-datasource] ${this._logTypeName} row #${row.id}`));
|
|
21639
21660
|
// Stop with an error
|
|
21640
21661
|
throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
21641
21662
|
}
|
|
21642
21663
|
this._editingRowCount = 0;
|
|
21643
21664
|
let data;
|
|
21644
21665
|
let dataToSave;
|
|
21645
|
-
if (this.
|
|
21666
|
+
if (!!this.validatorService) {
|
|
21646
21667
|
dataToSave = [];
|
|
21647
21668
|
data = rows.map(row => {
|
|
21648
|
-
const
|
|
21649
|
-
currentData.fromObject(row.currentData);
|
|
21669
|
+
const entity = this.toEntity(row.currentData);
|
|
21650
21670
|
// Filter to keep only dirty row
|
|
21651
21671
|
if (onlyDirtyRows && row.validator.dirty)
|
|
21652
|
-
dataToSave.push(
|
|
21653
|
-
return
|
|
21672
|
+
dataToSave.push(entity);
|
|
21673
|
+
return entity;
|
|
21654
21674
|
});
|
|
21655
21675
|
if (!onlyDirtyRows)
|
|
21656
21676
|
dataToSave = data;
|
|
@@ -21687,25 +21707,33 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
21687
21707
|
}
|
|
21688
21708
|
});
|
|
21689
21709
|
}
|
|
21690
|
-
|
|
21691
|
-
if (
|
|
21692
|
-
|
|
21693
|
-
|
|
21694
|
-
if (!opts || opts.emitEvent !== false) {
|
|
21695
|
-
this.markAsLoaded();
|
|
21710
|
+
getDataFromRows(rows, options = { originalData: false, toEntity: false }) {
|
|
21711
|
+
if (options.toEntity) {
|
|
21712
|
+
return super.getDataFromRows(rows, options)
|
|
21713
|
+
.map(data => this.toEntity(data));
|
|
21696
21714
|
}
|
|
21715
|
+
return super.getDataFromRows(rows, options);
|
|
21697
21716
|
}
|
|
21698
|
-
|
|
21699
|
-
|
|
21700
|
-
|
|
21701
|
-
|
|
21702
|
-
|
|
21703
|
-
|
|
21704
|
-
return
|
|
21717
|
+
toEntity(data) {
|
|
21718
|
+
if (EntityUtils.isNotEntity(data)) {
|
|
21719
|
+
const entity = new this.dataConstructor();
|
|
21720
|
+
entity.fromObject(data);
|
|
21721
|
+
return entity;
|
|
21722
|
+
}
|
|
21723
|
+
return data;
|
|
21705
21724
|
}
|
|
21706
|
-
|
|
21707
|
-
|
|
21708
|
-
|
|
21725
|
+
updateDatasource(data, opts = { emitEvent: true }) {
|
|
21726
|
+
const _super = Object.create(null, {
|
|
21727
|
+
updateDatasource: { get: () => super.updateDatasource }
|
|
21728
|
+
});
|
|
21729
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21730
|
+
if (this._debug)
|
|
21731
|
+
console.debug(`[table-datasource] Updating datasource with data:`, data);
|
|
21732
|
+
yield _super.updateDatasource.call(this, data, opts);
|
|
21733
|
+
if (opts.emitEvent) {
|
|
21734
|
+
this.markAsLoaded();
|
|
21735
|
+
}
|
|
21736
|
+
});
|
|
21709
21737
|
}
|
|
21710
21738
|
waitIdle(debounceTimeMs) {
|
|
21711
21739
|
return firstFalsePromise(this.loadingSubject
|
|
@@ -21714,34 +21742,60 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
21714
21742
|
));
|
|
21715
21743
|
}
|
|
21716
21744
|
confirmCreate(row) {
|
|
21717
|
-
|
|
21718
|
-
|
|
21719
|
-
|
|
21720
|
-
|
|
21721
|
-
|
|
21722
|
-
|
|
21723
|
-
|
|
21745
|
+
const _super = Object.create(null, {
|
|
21746
|
+
confirmCreate: { get: () => super.confirmCreate }
|
|
21747
|
+
});
|
|
21748
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21749
|
+
if (!(yield _super.confirmCreate.call(this, row)))
|
|
21750
|
+
return false;
|
|
21751
|
+
if (row.editing && row.validator) {
|
|
21752
|
+
console.warn('[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false');
|
|
21753
|
+
row.validator.disable({ onlySelf: true, emitEvent: false });
|
|
21754
|
+
}
|
|
21755
|
+
return true;
|
|
21756
|
+
});
|
|
21724
21757
|
}
|
|
21725
21758
|
confirmEdit(row) {
|
|
21726
|
-
|
|
21727
|
-
|
|
21728
|
-
|
|
21729
|
-
|
|
21730
|
-
|
|
21731
|
-
|
|
21732
|
-
|
|
21759
|
+
const _super = Object.create(null, {
|
|
21760
|
+
confirmEdit: { get: () => super.confirmEdit }
|
|
21761
|
+
});
|
|
21762
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21763
|
+
if (!(yield _super.confirmEdit.call(this, row)))
|
|
21764
|
+
return false;
|
|
21765
|
+
if (row.editing && row.validator) {
|
|
21766
|
+
console.warn('[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false');
|
|
21767
|
+
row.validator.disable({ onlySelf: true, emitEvent: false });
|
|
21768
|
+
}
|
|
21769
|
+
return true;
|
|
21770
|
+
});
|
|
21733
21771
|
}
|
|
21734
21772
|
startEdit(row) {
|
|
21735
|
-
|
|
21736
|
-
|
|
21737
|
-
|
|
21738
|
-
this
|
|
21773
|
+
const _super = Object.create(null, {
|
|
21774
|
+
startEdit: { get: () => super.startEdit }
|
|
21775
|
+
});
|
|
21776
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21777
|
+
if (row.editing)
|
|
21778
|
+
return; // Already editing
|
|
21779
|
+
if (this._debug)
|
|
21780
|
+
console.debug('[table-datasource] Start to edit row', row);
|
|
21781
|
+
const done = yield _super.startEdit.call(this, row);
|
|
21782
|
+
if (done)
|
|
21783
|
+
this._editingRowCount++;
|
|
21784
|
+
return done;
|
|
21785
|
+
});
|
|
21739
21786
|
}
|
|
21740
|
-
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
this
|
|
21787
|
+
cancel(row) {
|
|
21788
|
+
const _super = Object.create(null, {
|
|
21789
|
+
cancel: { get: () => super.cancel }
|
|
21790
|
+
});
|
|
21791
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21792
|
+
if (this._debug)
|
|
21793
|
+
console.debug('[table-datasource] Cancelling row', row);
|
|
21794
|
+
const done = yield _super.cancel.call(this, row);
|
|
21795
|
+
if (done)
|
|
21796
|
+
this._editingRowCount--;
|
|
21797
|
+
return done;
|
|
21798
|
+
});
|
|
21745
21799
|
}
|
|
21746
21800
|
handleError(error, message) {
|
|
21747
21801
|
const errorMsg = error && error.message || error;
|
|
@@ -21756,37 +21810,47 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
21756
21810
|
throw error;
|
|
21757
21811
|
}
|
|
21758
21812
|
delete(id) {
|
|
21759
|
-
|
|
21760
|
-
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21773
|
-
|
|
21813
|
+
const _super = Object.create(null, {
|
|
21814
|
+
delete: { get: () => super.delete }
|
|
21815
|
+
});
|
|
21816
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21817
|
+
// If new row: not need to propagate to the dataService
|
|
21818
|
+
if (id === -1) {
|
|
21819
|
+
return _super.delete.call(this, id);
|
|
21820
|
+
}
|
|
21821
|
+
const row = this.getRow(id);
|
|
21822
|
+
if (!row) {
|
|
21823
|
+
console.error(`[table-datasource] Row to delete with id=${id} not found`);
|
|
21824
|
+
return;
|
|
21825
|
+
}
|
|
21826
|
+
this.markAsLoading();
|
|
21827
|
+
try {
|
|
21828
|
+
yield this.dataService.deleteAll([row.currentData], this.serviceOptions);
|
|
21829
|
+
// Make sure row has been deleted (because GrapQHl cache remove can failed)
|
|
21830
|
+
yield sleep(300);
|
|
21774
21831
|
const present = this.getRow(id) === row;
|
|
21775
|
-
if (present)
|
|
21776
|
-
|
|
21777
|
-
|
|
21778
|
-
|
|
21832
|
+
if (present) {
|
|
21833
|
+
console.warn('[table-datasource] Force deletion of 1 row (Is service applying deletion to observable ?)');
|
|
21834
|
+
yield _super.delete.call(this, id);
|
|
21835
|
+
}
|
|
21836
|
+
}
|
|
21837
|
+
catch (err) {
|
|
21838
|
+
this.handleErrorPromise(err);
|
|
21839
|
+
}
|
|
21840
|
+
finally {
|
|
21841
|
+
this.markAsLoaded();
|
|
21842
|
+
}
|
|
21779
21843
|
});
|
|
21780
21844
|
}
|
|
21781
21845
|
deleteAll(rows) {
|
|
21782
21846
|
this.markAsLoading();
|
|
21783
|
-
const data =
|
|
21847
|
+
const data = this.getDataFromRows(rows);
|
|
21784
21848
|
const rowsById = rows.reduce((res, row) => {
|
|
21785
21849
|
res[row.id] = row;
|
|
21786
21850
|
return res;
|
|
21787
21851
|
}, {});
|
|
21788
21852
|
const self = this;
|
|
21789
|
-
const
|
|
21853
|
+
const inheritedDelete = super.delete;
|
|
21790
21854
|
return this.dataService.deleteAll(data, this.serviceOptions)
|
|
21791
21855
|
.catch(err => this.handleErrorPromise(err))
|
|
21792
21856
|
.then(() => {
|
|
@@ -21800,13 +21864,13 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
21800
21864
|
// Apply missing deletion
|
|
21801
21865
|
if (isNotEmptyArray(rowNotDeleted)) {
|
|
21802
21866
|
console.warn(`[table-datasource] Force deletion of ${rowNotDeleted.length} rows (Is service applying deletion to observable ?)`);
|
|
21803
|
-
rowNotDeleted.forEach(r =>
|
|
21867
|
+
rowNotDeleted.forEach(r => inheritedDelete.call(self, r.id));
|
|
21804
21868
|
}
|
|
21805
21869
|
this.loadingSubject.next(false);
|
|
21806
21870
|
});
|
|
21807
21871
|
}
|
|
21808
21872
|
getRows() {
|
|
21809
|
-
return
|
|
21873
|
+
return this.rowsSubject.toPromise();
|
|
21810
21874
|
}
|
|
21811
21875
|
asyncCreateNew(insertAt) {
|
|
21812
21876
|
const _super = Object.create(null, {
|
|
@@ -21818,8 +21882,8 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
21818
21882
|
this._creating = true;
|
|
21819
21883
|
_super.createNew.call(this, insertAt);
|
|
21820
21884
|
const row = this.getRow(-1);
|
|
21821
|
-
if (row && this.
|
|
21822
|
-
const res = this.
|
|
21885
|
+
if (row && this.config.onRowCreated) {
|
|
21886
|
+
const res = this.config.onRowCreated(row);
|
|
21823
21887
|
// If async function, wait the end before ending
|
|
21824
21888
|
if (res instanceof Promise) {
|
|
21825
21889
|
try {
|
|
@@ -21846,21 +21910,24 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
21846
21910
|
});
|
|
21847
21911
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21848
21912
|
if (!this._fetchMoreFn)
|
|
21849
|
-
return false;
|
|
21913
|
+
return false;
|
|
21850
21914
|
if (this._editingRowCount > 0) {
|
|
21851
21915
|
console.warn('Cannot fetch more because still editing row');
|
|
21852
21916
|
return;
|
|
21853
21917
|
}
|
|
21918
|
+
// Forget the fetchMore function, to avoid multiple call
|
|
21919
|
+
const fetchMoreFn = this._fetchMoreFn;
|
|
21920
|
+
this._fetchMoreFn = null;
|
|
21854
21921
|
// Fetch next page
|
|
21855
|
-
|
|
21856
|
-
const res = yield this._fetchMoreFn();
|
|
21922
|
+
const res = yield fetchMoreFn();
|
|
21857
21923
|
// Skip if empty (no more data)
|
|
21858
21924
|
if (isNotEmptyArray(res === null || res === void 0 ? void 0 : res.data))
|
|
21859
21925
|
return false;
|
|
21860
21926
|
// Update the data source
|
|
21927
|
+
// TODO review this, to keep existing rows, instead of creating new TableElement + validator !
|
|
21861
21928
|
const existingData = yield this.getData();
|
|
21862
|
-
_super.updateDatasource.call(this, existingData.concat(...res.data), opts);
|
|
21863
|
-
//
|
|
21929
|
+
yield _super.updateDatasource.call(this, existingData.concat(...res.data), opts);
|
|
21930
|
+
// Store next fetchMore function
|
|
21864
21931
|
this._fetchMoreFn = res.fetchMore;
|
|
21865
21932
|
return true;
|
|
21866
21933
|
});
|
|
@@ -21883,8 +21950,8 @@ EntitiesTableDataSource.decorators = [
|
|
|
21883
21950
|
EntitiesTableDataSource.ctorParameters = () => [
|
|
21884
21951
|
{ type: Function },
|
|
21885
21952
|
{ type: undefined },
|
|
21886
|
-
{ type:
|
|
21887
|
-
{ type:
|
|
21953
|
+
{ type: undefined },
|
|
21954
|
+
{ type: undefined }
|
|
21888
21955
|
];
|
|
21889
21956
|
|
|
21890
21957
|
const SETTINGS_DISPLAY_COLUMNS = 'displayColumns';
|
|
@@ -22276,7 +22343,6 @@ class AppTable {
|
|
|
22276
22343
|
}
|
|
22277
22344
|
}
|
|
22278
22345
|
ngOnDestroy() {
|
|
22279
|
-
var _a;
|
|
22280
22346
|
this._subscription.unsubscribe();
|
|
22281
22347
|
// Unsubscribe column value changes
|
|
22282
22348
|
Object.keys(this._cellValueChangesDefs).forEach(col => this.stopCellValueChanges(col, true));
|
|
@@ -22301,7 +22367,6 @@ class AppTable {
|
|
|
22301
22367
|
this.onError.unsubscribe();
|
|
22302
22368
|
this._destroy$.next();
|
|
22303
22369
|
this._destroy$.unsubscribe();
|
|
22304
|
-
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
|
|
22305
22370
|
}
|
|
22306
22371
|
updateView(res, opts) {
|
|
22307
22372
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -22343,7 +22408,7 @@ class AppTable {
|
|
|
22343
22408
|
this._dataSourceLoadingSubscription.unsubscribe();
|
|
22344
22409
|
this._subscription.remove(this._dataSourceLoadingSubscription);
|
|
22345
22410
|
}
|
|
22346
|
-
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.
|
|
22411
|
+
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
22347
22412
|
this._dataSource = null;
|
|
22348
22413
|
}
|
|
22349
22414
|
addColumnDef(column) {
|
|
@@ -22514,6 +22579,7 @@ class AppTable {
|
|
|
22514
22579
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
22515
22580
|
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;
|
|
22516
22581
|
const 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;
|
|
22582
|
+
// TODO: remove this, has it redundant with dataSource.confirmAllRows() called in dataSource.save()
|
|
22517
22583
|
if (!this.confirmEditCreate()) {
|
|
22518
22584
|
throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
22519
22585
|
}
|
|
@@ -23351,7 +23417,7 @@ class AppTable {
|
|
|
23351
23417
|
var _a, _b;
|
|
23352
23418
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23353
23419
|
// Mark row as pristine
|
|
23354
|
-
const markRowAsPristine = ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.
|
|
23420
|
+
const markRowAsPristine = ((_a = this.dataSource) === null || _a === void 0 ? void 0 : _a.config.keepOriginalDataAfterConfirm) === true;
|
|
23355
23421
|
if (markRowAsPristine) {
|
|
23356
23422
|
(_b = row.validator) === null || _b === void 0 ? void 0 : _b.markAsPristine();
|
|
23357
23423
|
// Check if table is now pristine
|
|
@@ -24760,7 +24826,7 @@ AppInMemoryTable.ctorParameters = () => [
|
|
|
24760
24826
|
{ type: Function },
|
|
24761
24827
|
{ type: InMemoryEntitiesService },
|
|
24762
24828
|
{ type: ValidatorService },
|
|
24763
|
-
{ type:
|
|
24829
|
+
{ type: undefined },
|
|
24764
24830
|
{ type: undefined }
|
|
24765
24831
|
];
|
|
24766
24832
|
AppInMemoryTable.propDecorators = {
|
|
@@ -25936,7 +26002,11 @@ class UsersPage extends AppTable {
|
|
|
25936
26002
|
switch (authTokenType) {
|
|
25937
26003
|
case "basic":
|
|
25938
26004
|
this.setShowColumn('pubkey', false, { emitEvent: false });
|
|
26005
|
+
this.setShowColumn('username', true, { emitEvent: false });
|
|
26006
|
+
this.setShowColumn('usernameExtranet', true, { emitEvent: false });
|
|
26007
|
+
break;
|
|
25939
26008
|
case "basic-and-token":
|
|
26009
|
+
this.setShowColumn('pubkey', true, { emitEvent: false });
|
|
25940
26010
|
this.setShowColumn('username', true, { emitEvent: false });
|
|
25941
26011
|
this.setShowColumn('usernameExtranet', true, { emitEvent: false });
|
|
25942
26012
|
break;
|
|
@@ -27467,5 +27537,5 @@ CoreTestingModule.decorators = [
|
|
|
27467
27537
|
* Generated bundle index. Do not edit.
|
|
27468
27538
|
*/
|
|
27469
27539
|
|
|
27470
|
-
export { APP_ABOUT_DEVELOPERS, APP_ABOUT_PARTNERS, APP_CONFIG_OPTIONS, APP_FORM_ERROR_I18N_KEYS, APP_GRAPHQL_TYPE_POLICIES, APP_HOME_BUTTONS, APP_LOCALES, APP_LOCAL_SETTINGS, APP_LOCAL_SETTINGS_OPTIONS, APP_LOCAL_STORAGE_TYPE_POLICIES, APP_MENU_ITEMS, APP_TESTING_PAGES, AboutModal, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AndroidOsEnvironment, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable,
|
|
27540
|
+
export { APP_ABOUT_DEVELOPERS, APP_ABOUT_PARTNERS, APP_CONFIG_OPTIONS, APP_FORM_ERROR_I18N_KEYS, APP_GRAPHQL_TYPE_POLICIES, APP_HOME_BUTTONS, APP_LOCALES, APP_LOCAL_SETTINGS, APP_LOCAL_SETTINGS_OPTIONS, APP_LOCAL_STORAGE_TYPE_POLICIES, APP_MENU_ITEMS, APP_TESTING_PAGES, AboutModal, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AndroidOsEnvironment, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableUtils, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CORE_TESTING_PAGES, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CoreTestingModule, CryptoService, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PLACEHOLDER_CHAR, DEFAULT_REQUIRED_COLUMNS, DateDiffDurationPipe, DateFormatPipe, DateFromNowPipe, DateTimeTestPage, DateUtils, Department, DepartmentToStringPipe, DragAndDropDirective, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, EvenPipe, FileResponse, FileService, FileSizePipe, FilesUtils, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, FormGetArrayPipe, FormGetControlPipe, FormGetGroupPipe, FormGetPipe, Fragments$1 as Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, JobUtils, KEYBOARD_HIDE_DELAY_MS, LAT_LONG_DEFAULT_MAX_DECIMALS, LAT_LONG_PATTERNS, LatLongFormatPipe, LatLongTestPage, LatitudeFormatPipe, LocalSettingsService, LongitudeFormatPipe, MINIFY_ENTITY_FOR_LOCAL_STORAGE, MINIFY_ENTITY_FOR_POD, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBadgeIconDirective, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialTestingModule, MathAbsPipe, MenuComponent, MenuItems, MenuService, Message, MessageFilter, MessageForm, MessageModal, MessageService, MessageTypeList, MessageTypes, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialFilter, ReferentialRef, ReferentialUtils, ReferentialValidatorService, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SHARED_MATERIAL_TESTING_PAGES, SHARED_TESTING_PAGES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedAsyncValidators, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBadgeIconModule, SharedMatBooleanModule, SharedMatChipsModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedTestsPage, SharedValidators, SocialErrorCodes, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrIncludesPipe, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, TableTestPage, TableTestingModule, TextForm, TextPopover, TextPopoverTestingModule, TextPopoverTestingPage, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UploadFile, UploadFileComponent, UploadFilePopover, UploadFileTestingModule, UploadFileTestingPage, UserEvent, UserEventFilter, UserEventFragments, UserEventService, UserEventTypes, UserEventsTable, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, fadeInAnimation, fadeInOutAnimation, filterFalse, filterNotNil, filterNumberInput, filterTrue, firstArrayValue, firstFalse, firstFalsePromise, firstNotNil, firstNotNilPromise, firstTrue, firstTruePromise, focusInput, focusNextInput, focusPreviousInput, formatLatitude, formatLongitude, fromDateISOString, fromScrollEndEvent, fromUnixMsTimestamp, fromUnixTimestamp, getCaretPosition, getColorContrast, getColorShade, getColorTint, getConnectionType, getControlFromPath, getFocusableInputElements, getFormErrors, getFormValueFromEntity, getProperty, getPropertyByPath, getPropertyByPathAsString, getRandomImage, hexToRgb, hexToRgbArray, isAndroid, isBlankString, isControlHasInput, isCordova, isEmptyArray, isIOS, isInputElement, isInstanceOf, isInt, isMobile, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilBoolean, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, isProgressEvent, isResponseEvent, isTouchUi, isWindows, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, matchMedia, matchUpperCase, mergeLoadResult, mixHex, moveInputCaretToSeparator, noTrailingSlash, notNilOrDefault, nullIfUndefined, parseLatitudeOrLongitude, propertiesPathComparator, propertyComparator, propertyPathComparator, referentialToString, referentialsToString, remove, removeAll, removeDiacritics, removeDuplicatesFromArray, removeEnd, removeValueInArray, replaceAll, resetCalculatedValue, resizeArray, rgbArrayToHex, rgbToHex, round, scrollFactory, selectInputContent, selectInputRange, setCalculatedValue, setTabIndex, sleep, slideInOutAnimation, slideUpDownAnimation, sort, splitById, splitByProperty, startsWithUpperCase, suggestFromArray, suggestFromStringArray, tabindexComparator, testUserAgent, toBoolean, toDateISOString, toDuration, toFloat, toInt, toNotNil, toNumber, trimEmptyToNull, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitForTrue, waitIdle, waitWhilePending, ɵ0, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, isFocusableElement as ɵc, RegisterForm as ɵd, AccountValidatorService as ɵe, RegisterModal as ɵf, UserSettingsValidatorService as ɵg, LocalSettingsValidatorService as ɵh, AppIconComponent as ɵi, DateTestPage as ɵj, NumpadTestPage as ɵk, MatBadgeIconTestPage as ɵl, ToastTestingModule as ɵm, ToastTestingPage as ɵn };
|
|
27471
27541
|
//# sourceMappingURL=sumaris-net.ngx-components.js.map
|