@sumaris-net/ngx-components 1.15.7 → 1.15.10
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 +47 -19
- 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/core/form/entity-editor.class.js +27 -15
- package/esm2015/src/app/core/services/base-entity-service.class.js +2 -1
- package/esm2015/src/app/core/services/base-graphql-service.class.js +7 -3
- package/esm2015/src/app/core/services/network.service.js +3 -3
- package/esm2015/src/app/core/services/platform.service.js +12 -2
- package/fesm2015/sumaris-net.ngx-components.js +46 -20
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/base-entity-service.class.d.ts +2 -1
- package/src/app/core/services/platform.service.d.ts +4 -0
- package/src/assets/i18n/en-US.json +3 -0
- package/src/assets/i18n/en.json +3 -0
- package/src/assets/i18n/fr.json +3 -2
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -12314,7 +12314,7 @@
|
|
|
12314
12314
|
_this.onNetworkStatusChanges = new rxjs.BehaviorSubject(null);
|
|
12315
12315
|
_this.onResetNetworkCache = new i0.EventEmitter(true);
|
|
12316
12316
|
_this._listeners = {};
|
|
12317
|
-
_this._mobile = _this.
|
|
12317
|
+
_this._mobile = _this.settings.mobile;
|
|
12318
12318
|
if (_this._mobile) {
|
|
12319
12319
|
_this._timerRefreshPeriod = NetworkRefreshTimerPeriod.MOBILE;
|
|
12320
12320
|
_this._timerRefreshCondition = function () { return _this.online; }; // Check only when online, and stop when offline
|
|
@@ -12744,7 +12744,7 @@
|
|
|
12744
12744
|
return __generator(this, function (_c) {
|
|
12745
12745
|
switch (_c.label) {
|
|
12746
12746
|
case 0:
|
|
12747
|
-
console.info('[network] Starting network...'
|
|
12747
|
+
console.info('[network] Starting network...');
|
|
12748
12748
|
_b = this._startingPeer;
|
|
12749
12749
|
if (_b) return [3 /*break*/, 2];
|
|
12750
12750
|
return [4 /*yield*/, this.restoreLocally()];
|
|
@@ -15746,7 +15746,9 @@
|
|
|
15746
15746
|
return this._mutableWatchQueries.filter(function (q) { return q.id.startsWith(opts.queryName + '|'); });
|
|
15747
15747
|
}
|
|
15748
15748
|
if (opts.queryNames) {
|
|
15749
|
-
return opts.queryNames.
|
|
15749
|
+
return opts.queryNames.map(function (queryName) { return _this._mutableWatchQueries.filter(function (q) { return q.id.startsWith(queryName + '|'); }); })
|
|
15750
|
+
// flatMap
|
|
15751
|
+
.reduce(function (res, array) { return res.concat.apply(res, __spread(array)); }, []);
|
|
15750
15752
|
}
|
|
15751
15753
|
// Search by query
|
|
15752
15754
|
if (opts.query) {
|
|
@@ -15755,7 +15757,9 @@
|
|
|
15755
15757
|
if (opts.queries) {
|
|
15756
15758
|
return opts.queries
|
|
15757
15759
|
.filter(isNotNil)
|
|
15758
|
-
.
|
|
15760
|
+
.map(function (query) { return _this._mutableWatchQueries.filter(function (q) { return q.query === query; }); })
|
|
15761
|
+
// flatMap
|
|
15762
|
+
.reduce(function (res, array) { return res.concat.apply(res, __spread(array)); }, []);
|
|
15759
15763
|
}
|
|
15760
15764
|
throw Error('Invalid options: only one property must be set');
|
|
15761
15765
|
};
|
|
@@ -17751,6 +17755,10 @@
|
|
|
17751
17755
|
var templateObject_1$3, templateObject_2$3, templateObject_3$2, templateObject_4$2, templateObject_5$1;
|
|
17752
17756
|
|
|
17753
17757
|
var moment$3 = momentImported__namespace;
|
|
17758
|
+
var AndroidOsEnvironment = Object.freeze({
|
|
17759
|
+
DIRECTORY_DOWNLOADS: 'Download',
|
|
17760
|
+
DIRECTORY_DOWNLOADS_OLD: 'Downloads',
|
|
17761
|
+
});
|
|
17754
17762
|
var PlatformService = /** @class */ (function (_super) {
|
|
17755
17763
|
__extends(PlatformService, _super);
|
|
17756
17764
|
function PlatformService(platform, cdkPlatform, toastController, translate, dateAdapter, entitiesStorage, settings, networkService, accountService, configService, cache, storage, audioProvider, environment, statusBar, keyboard, splashScreen, browser, downloader) {
|
|
@@ -17947,7 +17955,7 @@
|
|
|
17947
17955
|
var location$ = this._downloadingJobs.get(request.uri);
|
|
17948
17956
|
if (location$)
|
|
17949
17957
|
return location$;
|
|
17950
|
-
request = Object.assign(Object.assign({ visibleInDownloadsUi: true, notificationVisibility: ngx$6.NotificationVisibility.VisibleNotifyCompleted, title: request.title || request.filename }, request), { destinationInExternalPublicDir: Object.assign({ dirType:
|
|
17958
|
+
request = Object.assign(Object.assign({ visibleInDownloadsUi: true, notificationVisibility: ngx$6.NotificationVisibility.VisibleNotifyCompleted, title: request.title || request.filename }, request), { destinationInExternalPublicDir: Object.assign({ dirType: AndroidOsEnvironment.DIRECTORY_DOWNLOADS, subPath: request.filename || request.title || '' }, request.destinationInExternalPublicDir) });
|
|
17951
17959
|
console.debug('[platform] Downloading, using request: ' + JSON.stringify(request));
|
|
17952
17960
|
// Start download
|
|
17953
17961
|
location$ = rxjs.from(this.downloader.download(request));
|
|
@@ -17960,9 +17968,15 @@
|
|
|
17960
17968
|
_this._downloadingJobs.delete(request.uri);
|
|
17961
17969
|
return location;
|
|
17962
17970
|
}), operators.catchError(function (err) {
|
|
17971
|
+
var _a;
|
|
17963
17972
|
console.error('[platform] Unable to download: ' + (err && err.message || err));
|
|
17964
17973
|
// Forget the request
|
|
17965
17974
|
_this._downloadingJobs.delete(request.uri);
|
|
17975
|
+
// Retry with another location - issue in older Android version
|
|
17976
|
+
if (((_a = request.destinationInExternalPublicDir) === null || _a === void 0 ? void 0 : _a.dirType) === AndroidOsEnvironment.DIRECTORY_DOWNLOADS) {
|
|
17977
|
+
request.destinationInExternalPublicDir.dirType = AndroidOsEnvironment.DIRECTORY_DOWNLOADS_OLD;
|
|
17978
|
+
return _this.download(request);
|
|
17979
|
+
}
|
|
17966
17980
|
throw err;
|
|
17967
17981
|
}));
|
|
17968
17982
|
}
|
|
@@ -24610,6 +24624,7 @@
|
|
|
24610
24624
|
console.debug(this._logPrefix + ("[WS] Listening for changes on " + this._logTypeName + " {" + id + "}..."));
|
|
24611
24625
|
return this.graphql.subscribe({
|
|
24612
24626
|
query: opts && opts.query || this.subscriptions.listenChanges,
|
|
24627
|
+
fetchPolicy: opts && opts.fetchPolicy || 'no-cache',
|
|
24613
24628
|
variables: variables,
|
|
24614
24629
|
error: {
|
|
24615
24630
|
code: ErrorCodes$2.SUBSCRIBE_DATA_ERROR,
|
|
@@ -27948,23 +27963,31 @@
|
|
|
27948
27963
|
AppEntityEditor.prototype.startListenRemoteChanges = function () {
|
|
27949
27964
|
var _this = this;
|
|
27950
27965
|
// Skip if disable, or already listening
|
|
27951
|
-
if (this._listenChangesSubscription || !this._enableListenChanges
|
|
27966
|
+
if (this._listenChangesSubscription || !this._enableListenChanges)
|
|
27967
|
+
return;
|
|
27968
|
+
// Skip if new or local data
|
|
27969
|
+
if (this.isNewData || EntityUtils.isLocal(this.data))
|
|
27952
27970
|
return;
|
|
27953
27971
|
// Listen for changes on server
|
|
27954
|
-
this._listenChangesSubscription = this.listenChanges(this.data.id, {
|
|
27972
|
+
this._listenChangesSubscription = this.listenChanges(this.data.id, {
|
|
27973
|
+
interval: this._listenIntervalInSeconds
|
|
27974
|
+
})
|
|
27955
27975
|
.pipe(operators.filter(isNotNil))
|
|
27956
27976
|
.subscribe(function (data) {
|
|
27957
|
-
|
|
27958
|
-
|
|
27959
|
-
|
|
27960
|
-
|
|
27961
|
-
|
|
27962
|
-
|
|
27963
|
-
|
|
27964
|
-
|
|
27965
|
-
|
|
27966
|
-
|
|
27967
|
-
|
|
27977
|
+
var isNewer = momentImported.isMoment(data.updateDate) && data.updateDate.isAfter(_this.data.updateDate);
|
|
27978
|
+
if (!isNewer)
|
|
27979
|
+
return; // Skip
|
|
27980
|
+
// Editor has no changes: reload
|
|
27981
|
+
if (!_this.dirty) {
|
|
27982
|
+
if (_this.debug)
|
|
27983
|
+
console.debug("[data-editor] Changes detected on server, at {" + data.updateDate + "}: reloading page...");
|
|
27984
|
+
_this.reload();
|
|
27985
|
+
}
|
|
27986
|
+
// Cannot reload: alert the user
|
|
27987
|
+
else {
|
|
27988
|
+
if (_this.debug)
|
|
27989
|
+
console.debug("[data-editor] Changes detected on server, at {" + data.updateDate + "}, but page is dirty: skip reloading.");
|
|
27990
|
+
_this.showToast({ message: 'ERROR.DATA_UPDATE_DATE_CHANGED', type: 'warning', showCloseButton: true });
|
|
27968
27991
|
}
|
|
27969
27992
|
});
|
|
27970
27993
|
this._listenChangesSubscription.add(function () { return _this._listenChangesSubscription = null; });
|
|
@@ -28503,7 +28526,11 @@
|
|
|
28503
28526
|
return parentUrl;
|
|
28504
28527
|
};
|
|
28505
28528
|
AppEntityEditor.prototype.listenChanges = function (id, opts) {
|
|
28506
|
-
return this.dataService.listenChanges(this.data.id,
|
|
28529
|
+
return this.dataService.listenChanges(this.data.id, Object.assign({
|
|
28530
|
+
// Make sure to skip cache, because NOT the full graph will be fetched by subscription
|
|
28531
|
+
// When a changes occur, we call reload() to force refetching the full graph
|
|
28532
|
+
fetchPolicy: 'no-cache'
|
|
28533
|
+
}, opts));
|
|
28507
28534
|
};
|
|
28508
28535
|
AppEntityEditor.prototype.markForCheck = function () {
|
|
28509
28536
|
this.cd.markForCheck();
|
|
@@ -31226,6 +31253,7 @@
|
|
|
31226
31253
|
exports.AdminModule = AdminModule;
|
|
31227
31254
|
exports.AdminRoutingModule = AdminRoutingModule;
|
|
31228
31255
|
exports.Alerts = Alerts;
|
|
31256
|
+
exports.AndroidOsEnvironment = AndroidOsEnvironment;
|
|
31229
31257
|
exports.AppEditor = AppEditor;
|
|
31230
31258
|
exports.AppEditorOptions = AppEditorOptions;
|
|
31231
31259
|
exports.AppEntityEditor = AppEntityEditor;
|