@forgeroute/ui 0.4.81 → 0.4.82
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/fesm2022/forgeroute-ui-offline.mjs +280 -25
- package/fesm2022/forgeroute-ui-offline.mjs.map +1 -1
- package/fesm2022/{forgeroute-ui-ui-labels.es-B48eQLyT.mjs → forgeroute-ui-ui-labels.es-DPY2FHcg.mjs} +27 -1
- package/fesm2022/{forgeroute-ui-ui-labels.es-B48eQLyT.mjs.map → forgeroute-ui-ui-labels.es-DPY2FHcg.mjs.map} +1 -1
- package/fesm2022/forgeroute-ui.mjs +69 -12
- package/fesm2022/forgeroute-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui-offline.d.ts +104 -5
- package/types/forgeroute-ui.d.ts +50 -24
|
@@ -1765,6 +1765,17 @@ const UI_DEFAULT_LABELS = {
|
|
|
1765
1765
|
"dataTable.deleteConfirm": "Delete this record? This cannot be undone.",
|
|
1766
1766
|
"dataTable.deleteFailed": "Failed to delete. Please try again.",
|
|
1767
1767
|
"dataTable.genericError": "Something went wrong. Please try again.",
|
|
1768
|
+
"dataTable.loadError.offline": "You're offline, so your {{ items }} can't be shown. Reconnect to the internet and try again.",
|
|
1769
|
+
"dataTable.loadError.noCopy": "You're offline, so your {{ items }} can't be shown. There is no saved copy of this view on this device. Reconnect to the internet and try again.",
|
|
1770
|
+
"dataTable.loadError.unreachable": "Your {{ items }} can't load because the app can't reach the server. Your internet may be down or the server may be having a problem. Check your connection and try again.",
|
|
1771
|
+
"dataTable.loadError.timeout": "Your {{ items }} are taking too long to load. Your connection may be slow. Wait a moment and try again.",
|
|
1772
|
+
"dataTable.loadError.session": "Your session has ended, so your {{ items }} can't load. Sign in again to continue.",
|
|
1773
|
+
"dataTable.loadError.forbidden": "You don't have permission to view {{ items }}. Ask an administrator for access.",
|
|
1774
|
+
"dataTable.loadError.server": "The server had a problem loading your {{ items }}. This is usually temporary. Try again in a few minutes.",
|
|
1775
|
+
"dataTable.loadError.other": "Your {{ items }} couldn't be loaded. Try again, and contact support if it keeps happening.",
|
|
1776
|
+
"dataTable.actionError.offline": "You're offline, so this change wasn't made. Reconnect to the internet and try again.",
|
|
1777
|
+
"dataTable.actionError.unreachable": "This change wasn't made because the app can't reach the server. Check your connection and try again.",
|
|
1778
|
+
"dataTable.actionError.timeout": "This is taking too long, and the change may not have been saved. Check the list before you try again.",
|
|
1768
1779
|
"dataTable.noneDeletable": "None of the selected rows can be deleted.",
|
|
1769
1780
|
"dataTable.whatWillHappen": "What will happen",
|
|
1770
1781
|
"dataTable.never": "Never",
|
|
@@ -1901,6 +1912,21 @@ const UI_DEFAULT_LABELS = {
|
|
|
1901
1912
|
"connection.result.syncStarted": "Sending your saved changes…",
|
|
1902
1913
|
"connection.result.discarded": "Discarded \"{{ label }}\".",
|
|
1903
1914
|
"connection.result.discardedAll": "Discarded all saved changes.",
|
|
1915
|
+
"connection.conflict.rowText": "This was changed by someone else after you saved it offline, so your change was not applied.",
|
|
1916
|
+
"connection.conflict.keepMine": "Keep my version",
|
|
1917
|
+
"connection.conflict.keepMineNamed": "Keep my version of {{ label }}",
|
|
1918
|
+
"connection.conflict.discard": "Discard my change",
|
|
1919
|
+
"connection.conflict.discardNamed": "Discard my change: {{ label }}",
|
|
1920
|
+
"connection.conflict.confirmTitle": "Keep my version?",
|
|
1921
|
+
"connection.conflict.confirmMessage": "Replace the newer version? Your change will overwrite what someone else saved. The other version is lost.",
|
|
1922
|
+
"connection.conflict.result.keeping": "Sending your version of \"{{ label }}\"…",
|
|
1923
|
+
"connection.conflict.error.disabled": "Keep my version is not turned on for this app.",
|
|
1924
|
+
"connection.conflict.error.notFound": "This saved change no longer exists.",
|
|
1925
|
+
"connection.conflict.error.notConflict": "This change is not waiting for your decision.",
|
|
1926
|
+
"connection.conflict.error.noStamp": "There is nothing to overwrite for this change.",
|
|
1927
|
+
"connection.conflict.result.sent": "Your version of \"{{ label }}\" was sent.",
|
|
1928
|
+
"connection.conflict.result.shortly": "Your version of \"{{ label }}\" will be sent shortly.",
|
|
1929
|
+
"connection.conflict.error.unknown": "Your version could not be sent yet. Your change is still saved on this device.",
|
|
1904
1930
|
"common.example": "e.g. {{ value }}",
|
|
1905
1931
|
"format.durationMinSec": "{{ m }}m {{ s }}s",
|
|
1906
1932
|
"format.durationSec": "{{ s }}s",
|
|
@@ -9033,6 +9059,37 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
9033
9059
|
}]
|
|
9034
9060
|
}
|
|
9035
9061
|
});
|
|
9062
|
+
const browserIsOnline = () => typeof navigator === "undefined" ? true : navigator.onLine !== false;
|
|
9063
|
+
function noAnswerKind(err, online) {
|
|
9064
|
+
const e = err;
|
|
9065
|
+
if (!e || typeof e !== "object") return null;
|
|
9066
|
+
if (e.timeout === true && e.status === 0) return "timeout";
|
|
9067
|
+
if (e.status === 0) return e.statusText === "Offline" ? "noCopy" : !online ? "offline" : "unreachable";
|
|
9068
|
+
return null;
|
|
9069
|
+
}
|
|
9070
|
+
function loadErrorKey(err, online = browserIsOnline()) {
|
|
9071
|
+
const none = noAnswerKind(err, online);
|
|
9072
|
+
if (none) return `dataTable.loadError.${none}`;
|
|
9073
|
+
const status = err?.status;
|
|
9074
|
+
if (status === 401) return "dataTable.loadError.session";
|
|
9075
|
+
if (status === 403) return "dataTable.loadError.forbidden";
|
|
9076
|
+
if (typeof status === "number" && status >= 500) return "dataTable.loadError.server";
|
|
9077
|
+
return "dataTable.loadError.other";
|
|
9078
|
+
}
|
|
9079
|
+
function actionErrorKey(err, online = browserIsOnline()) {
|
|
9080
|
+
const none = noAnswerKind(err, online);
|
|
9081
|
+
if (none === "offline" || none === "noCopy") return "dataTable.actionError.offline";
|
|
9082
|
+
if (none === "unreachable") return "dataTable.actionError.unreachable";
|
|
9083
|
+
if (none === "timeout") return "dataTable.actionError.timeout";
|
|
9084
|
+
return "dataTable.genericError";
|
|
9085
|
+
}
|
|
9086
|
+
function actionErrorText(err, translate) {
|
|
9087
|
+
const e = err;
|
|
9088
|
+
const server = e?.error?.message;
|
|
9089
|
+
if (typeof server === "string" && server.trim()) return server;
|
|
9090
|
+
if ((e?.offlineBlocked === true || e?.timeout === true) && typeof e.message === "string" && e.message.trim()) return e.message;
|
|
9091
|
+
return translate(actionErrorKey(err));
|
|
9092
|
+
}
|
|
9036
9093
|
function needsEscape(value) {
|
|
9037
9094
|
return value.includes(",") || value.includes("\\\\") || value.endsWith("\\");
|
|
9038
9095
|
}
|
|
@@ -14694,7 +14751,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
14694
14751
|
},
|
|
14695
14752
|
error: (err) => {
|
|
14696
14753
|
this._runningAction.set(null);
|
|
14697
|
-
this._toast.error(err
|
|
14754
|
+
this._toast.error(actionErrorText(err, (k) => this.labels.t(k)));
|
|
14698
14755
|
}
|
|
14699
14756
|
});
|
|
14700
14757
|
}
|
|
@@ -14734,14 +14791,14 @@ var DataTableComponent = class DataTableComponent {
|
|
|
14734
14791
|
});
|
|
14735
14792
|
}
|
|
14736
14793
|
async _downloadErrorMessage(err) {
|
|
14737
|
-
const fallback = this.labels.t("dataTable.genericError");
|
|
14738
14794
|
try {
|
|
14739
14795
|
const body = err?.error;
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
}
|
|
14796
|
+
if (body instanceof Blob) {
|
|
14797
|
+
const json = JSON.parse(await body.text());
|
|
14798
|
+
if (typeof json?.message === "string" && json.message.trim()) return json.message;
|
|
14799
|
+
}
|
|
14800
|
+
} catch {}
|
|
14801
|
+
return actionErrorText(err, (k) => this.labels.t(k));
|
|
14745
14802
|
}
|
|
14746
14803
|
onBulkActionClick(def) {
|
|
14747
14804
|
if (def.action && def.opensPanel) {
|
|
@@ -14810,7 +14867,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
14810
14867
|
},
|
|
14811
14868
|
error: (err) => {
|
|
14812
14869
|
this._deletingBulk.set(false);
|
|
14813
|
-
this._toast.error(err
|
|
14870
|
+
this._toast.error(actionErrorText(err, (k) => this.labels.t(k)));
|
|
14814
14871
|
}
|
|
14815
14872
|
});
|
|
14816
14873
|
});
|
|
@@ -14914,7 +14971,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
14914
14971
|
},
|
|
14915
14972
|
error: (err) => {
|
|
14916
14973
|
this._applyingBulk.set(false);
|
|
14917
|
-
this._toast.error(err
|
|
14974
|
+
this._toast.error(actionErrorText(err, (k) => this.labels.t(k)));
|
|
14918
14975
|
}
|
|
14919
14976
|
});
|
|
14920
14977
|
}
|
|
@@ -15417,8 +15474,8 @@ var DataTableComponent = class DataTableComponent {
|
|
|
15417
15474
|
if (this._activeTab()) params = params.set("filter", this._activeTab());
|
|
15418
15475
|
const cf = this._colFilterValues();
|
|
15419
15476
|
for (const [key, vals] of Object.entries(cf)) if (vals.length > 0) params = params.set(key, encodeFilterValues(vals));
|
|
15420
|
-
return this.http.get(`${this.config.baseUrl}${this.endpoint()}`, { params }).pipe(catchError(() => {
|
|
15421
|
-
this._error.set(this.labels.t(
|
|
15477
|
+
return this.http.get(`${this.config.baseUrl}${this.endpoint()}`, { params }).pipe(catchError((err) => {
|
|
15478
|
+
this._error.set(this.labels.t(loadErrorKey(err), { items: this._itemsWord() }));
|
|
15422
15479
|
this._loadFailed.set(true);
|
|
15423
15480
|
return of(null);
|
|
15424
15481
|
}));
|
|
@@ -66950,7 +67007,7 @@ const BUILT_IN_ENDONYMS = {
|
|
|
66950
67007
|
ko: "한국어",
|
|
66951
67008
|
ru: "Русский"
|
|
66952
67009
|
};
|
|
66953
|
-
const BUILT_IN_LOADERS = /* @__PURE__ */ new Map([["es", () => import("./forgeroute-ui-ui-labels.es-
|
|
67010
|
+
const BUILT_IN_LOADERS = /* @__PURE__ */ new Map([["es", () => import("./forgeroute-ui-ui-labels.es-DPY2FHcg.mjs").then((m) => m.UI_LABELS_ES)]]);
|
|
66954
67011
|
const normalizeTag = (tag) => tag.trim().toLowerCase().replace(/_/g, "-");
|
|
66955
67012
|
const baseOf = (tag) => normalizeTag(tag).split("-")[0];
|
|
66956
67013
|
const builtInLoader = (lang) => BUILT_IN_LOADERS.get(normalizeTag(lang)) ?? BUILT_IN_LOADERS.get(baseOf(lang));
|