@olenbetong/appframe-core 1.3.7 → 2.0.0
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/dist/esm/af.common.js +204 -304
- package/dist/esm/af.common.legacy.js +206 -307
- package/dist/esm/af.common.legacy.min.js +3 -3
- package/dist/esm/af.common.legacy.min.js.map +4 -4
- package/dist/esm/af.common.min.js +5 -5
- package/dist/esm/af.common.min.js.map +4 -4
- package/dist/iife/af.common.js +204 -304
- package/dist/iife/af.common.legacy.js +206 -307
- package/dist/iife/af.common.legacy.min.js +3 -3
- package/dist/iife/af.common.legacy.min.js.map +4 -4
- package/dist/iife/af.common.min.js +5 -5
- package/dist/iife/af.common.min.js.map +4 -4
- package/es/UserSession.d.ts +5 -1
- package/es/UserSession.js +5 -1
- package/es/index.d.ts +31 -3
- package/es/index.js +3 -4
- package/package.json +2 -2
- package/src/UserSession.ts +5 -1
- package/src/index.ts +36 -3
- package/es/exportDataObject.d.ts +0 -73
- package/es/exportDataObject.js +0 -61
- package/es/formDataToObject.d.ts +0 -26
- package/es/formDataToObject.js +0 -73
- package/src/exportDataObject.ts +0 -110
- package/src/formDataToObject.ts +0 -80
- package/src/global.d.ts +0 -56
package/dist/esm/af.common.js
CHANGED
|
@@ -39,223 +39,6 @@ function mitt_default(n) {
|
|
|
39
39
|
} };
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// src/downloadBlob.ts
|
|
43
|
-
function downloadBlob(blob, fileName) {
|
|
44
|
-
return new Promise(function(resolve, reject) {
|
|
45
|
-
try {
|
|
46
|
-
const url = URL.createObjectURL(blob);
|
|
47
|
-
const parent = document.body;
|
|
48
|
-
const anchor = document.createElement("a");
|
|
49
|
-
anchor.setAttribute("download", fileName);
|
|
50
|
-
anchor.href = url;
|
|
51
|
-
parent.append(anchor);
|
|
52
|
-
anchor.click();
|
|
53
|
-
parent.removeChild(anchor);
|
|
54
|
-
setTimeout(function() {
|
|
55
|
-
URL.revokeObjectURL(url);
|
|
56
|
-
resolve();
|
|
57
|
-
}, 250);
|
|
58
|
-
} catch (ex) {
|
|
59
|
-
reject(ex);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// src/downloadRequest.ts
|
|
65
|
-
async function downloadRequest(request, { fileName, signal, onProgress }) {
|
|
66
|
-
function reportProgress(progress) {
|
|
67
|
-
if (typeof onProgress === "function") {
|
|
68
|
-
onProgress({ ...progress });
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
let bytesReceived = 0;
|
|
72
|
-
reportProgress({ status: "requested" });
|
|
73
|
-
try {
|
|
74
|
-
let response = await fetch(request);
|
|
75
|
-
if (!response.ok || !response.body) {
|
|
76
|
-
if (response.headers.get("content-type")?.includes("application/json")) {
|
|
77
|
-
let data = await response.json();
|
|
78
|
-
if (data.error) {
|
|
79
|
-
throw new Error(data.error);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
throw new Error(`${response.status} ${response.statusText}`);
|
|
83
|
-
}
|
|
84
|
-
try {
|
|
85
|
-
const reader = response.body.getReader();
|
|
86
|
-
const stream = new ReadableStream({
|
|
87
|
-
start: function(controller) {
|
|
88
|
-
function pump() {
|
|
89
|
-
return reader.read().then(function(read) {
|
|
90
|
-
if (read.done) {
|
|
91
|
-
controller.close();
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
bytesReceived += read.value.length;
|
|
95
|
-
reportProgress({ bytesReceived, status: "downloading" });
|
|
96
|
-
controller.enqueue(read.value);
|
|
97
|
-
return pump();
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return pump();
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
response = new Response(stream);
|
|
104
|
-
} catch (error) {
|
|
105
|
-
console.warn("Failed to replace response stream to log download progress.");
|
|
106
|
-
}
|
|
107
|
-
const blob = await response.blob();
|
|
108
|
-
reportProgress({ bytesReceived, status: "downloaded" });
|
|
109
|
-
await downloadBlob(blob, fileName);
|
|
110
|
-
reportProgress({ bytesReceived, status: "completed" });
|
|
111
|
-
} catch (err) {
|
|
112
|
-
if (signal?.aborted) {
|
|
113
|
-
reportProgress({ status: "cancelled" });
|
|
114
|
-
} else {
|
|
115
|
-
reportProgress({ error: err.message, status: "error" });
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// src/exportDataObject.ts
|
|
121
|
-
function exportOptionsFromDataObject(dataObject, specifiedOptions) {
|
|
122
|
-
return {
|
|
123
|
-
columns: dataObject.getFields().map((field) => ({ name: field.name })),
|
|
124
|
-
distinctRows: dataObject.getParameter("distinctRows"),
|
|
125
|
-
filterObject: dataObject.getParameter("filterObject"),
|
|
126
|
-
filterString: dataObject.getParameter("filterString"),
|
|
127
|
-
maxRecords: dataObject.getParameter("maxRecords"),
|
|
128
|
-
sortOrder: dataObject.getParameter("sortOrder"),
|
|
129
|
-
whereClause: dataObject.getParameter("whereClause"),
|
|
130
|
-
whereObject: dataObject.getParameter("whereObject"),
|
|
131
|
-
...specifiedOptions
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
var defaultOptions = {
|
|
135
|
-
columns: [],
|
|
136
|
-
distinctRows: false,
|
|
137
|
-
filterObject: null,
|
|
138
|
-
filterString: "",
|
|
139
|
-
maxRecords: -1,
|
|
140
|
-
sortOrder: [],
|
|
141
|
-
whereClause: "",
|
|
142
|
-
whereObject: null
|
|
143
|
-
};
|
|
144
|
-
function getDataObjectReportRequest(params) {
|
|
145
|
-
const { articleId, dataObject, format, options } = params;
|
|
146
|
-
const reportOptions = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
|
|
147
|
-
const body = "data=" + encodeURIComponent(JSON.stringify(reportOptions));
|
|
148
|
-
const requestUrl = `/api/data-object/export/${articleId}/${dataObject}/${format}`;
|
|
149
|
-
const controller = params.controller ?? new AbortController();
|
|
150
|
-
return {
|
|
151
|
-
controller,
|
|
152
|
-
request: new Request(requestUrl, {
|
|
153
|
-
body,
|
|
154
|
-
credentials: "same-origin",
|
|
155
|
-
headers: {
|
|
156
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
157
|
-
},
|
|
158
|
-
method: "POST",
|
|
159
|
-
signal: controller.signal
|
|
160
|
-
})
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function openDataObjectReport(params) {
|
|
164
|
-
const { dataObject, fileName, format } = params;
|
|
165
|
-
const { request } = getDataObjectReportRequest(params);
|
|
166
|
-
return downloadRequest(request, {
|
|
167
|
-
fileName: `${fileName || dataObject}.${format}`
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// src/has.ts
|
|
172
|
-
function has(obj, key2) {
|
|
173
|
-
return Object.prototype.hasOwnProperty.call(obj, key2);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// src/parseFunc.ts
|
|
177
|
-
var funcRegex = /^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;
|
|
178
|
-
function parseFunc(func) {
|
|
179
|
-
var match = func.toString().match(funcRegex);
|
|
180
|
-
if (match === null) {
|
|
181
|
-
throw new TypeError("Unable to parse function!");
|
|
182
|
-
}
|
|
183
|
-
return { name: match[1], args: match[2].split(","), body: match[3] };
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// src/Namespace.ts
|
|
187
|
-
function Namespace() {
|
|
188
|
-
}
|
|
189
|
-
Namespace.prototype = /* @__PURE__ */ Object.create(null);
|
|
190
|
-
var Namespace_default = Namespace;
|
|
191
|
-
|
|
192
|
-
// src/requireNamespace.ts
|
|
193
|
-
function requireNamespace(root, namespace) {
|
|
194
|
-
if (typeof root === "object") {
|
|
195
|
-
if (typeof namespace === "string") {
|
|
196
|
-
let path = namespace.split(".");
|
|
197
|
-
return requireNamespace(root, path);
|
|
198
|
-
} else if (Array.isArray(namespace)) {
|
|
199
|
-
let current = root;
|
|
200
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
201
|
-
current = current[namespace[i]] = current[namespace[i]] || new Namespace_default();
|
|
202
|
-
}
|
|
203
|
-
return current;
|
|
204
|
-
} else {
|
|
205
|
-
throw new TypeError("Invalid type of parameter 'namespace'");
|
|
206
|
-
}
|
|
207
|
-
} else {
|
|
208
|
-
throw new TypeError("Invalid type of parameter 'root'");
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// src/warn.ts
|
|
213
|
-
function warn(message, fallbackToAlert) {
|
|
214
|
-
console.warn(message);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// src/expose.ts
|
|
218
|
-
function expose(name, value) {
|
|
219
|
-
if (arguments.length !== 2) {
|
|
220
|
-
throw new Error("Incorrect number of arguments passed to the expose function!");
|
|
221
|
-
}
|
|
222
|
-
if (Array.isArray(value)) {
|
|
223
|
-
for (let func of value) {
|
|
224
|
-
const { name: funcName } = parseFunc(func);
|
|
225
|
-
if (funcName) {
|
|
226
|
-
expose(name, func);
|
|
227
|
-
} else {
|
|
228
|
-
throw new Error(
|
|
229
|
-
"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
} else {
|
|
234
|
-
let keyName;
|
|
235
|
-
let namespace;
|
|
236
|
-
if (typeof value === "function") {
|
|
237
|
-
keyName = parseFunc(value).name;
|
|
238
|
-
}
|
|
239
|
-
if (typeof name === "string") {
|
|
240
|
-
let pathParts = name.split(".");
|
|
241
|
-
if (!keyName) {
|
|
242
|
-
keyName = pathParts[pathParts.length - 1];
|
|
243
|
-
pathParts = pathParts.slice(0, pathParts.length - 1);
|
|
244
|
-
}
|
|
245
|
-
namespace = requireNamespace(window, pathParts);
|
|
246
|
-
} else if (keyName && (typeof name === "object" || typeof name === "function")) {
|
|
247
|
-
namespace = name;
|
|
248
|
-
} else {
|
|
249
|
-
throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");
|
|
250
|
-
}
|
|
251
|
-
if (has(namespace, keyName)) {
|
|
252
|
-
warn([name, keyName].join(".") + " is already defined!");
|
|
253
|
-
} else {
|
|
254
|
-
namespace[keyName] = value;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
42
|
// src/getLocalizedString.ts
|
|
260
43
|
async function getLocalizedStringAsync(string) {
|
|
261
44
|
try {
|
|
@@ -377,48 +160,6 @@ function getLocalizedString(string) {
|
|
|
377
160
|
return localized;
|
|
378
161
|
}
|
|
379
162
|
|
|
380
|
-
// src/localStorage.ts
|
|
381
|
-
function getLocalKey(key2) {
|
|
382
|
-
return [af?.article?.id || "", "common", key2].join(".");
|
|
383
|
-
}
|
|
384
|
-
var LocalStorage = class {
|
|
385
|
-
isPersisted() {
|
|
386
|
-
return true;
|
|
387
|
-
}
|
|
388
|
-
getLocalStorageKey(key2, global) {
|
|
389
|
-
return global ? ["common", key2].join(".") : getLocalKey(key2);
|
|
390
|
-
}
|
|
391
|
-
get(key2, defaultValue, global) {
|
|
392
|
-
const lsKey = this.getLocalStorageKey(key2, global);
|
|
393
|
-
const value = localStorage.getItem(lsKey);
|
|
394
|
-
return value !== null ? JSON.parse(value) : defaultValue;
|
|
395
|
-
}
|
|
396
|
-
set(key2, value, global) {
|
|
397
|
-
localStorage.setItem(
|
|
398
|
-
this.getLocalStorageKey(key2, global),
|
|
399
|
-
JSON.stringify(value)
|
|
400
|
-
);
|
|
401
|
-
}
|
|
402
|
-
remove(key2, global) {
|
|
403
|
-
const lsKey = this.getLocalStorageKey(key2, global);
|
|
404
|
-
if (localStorage.getItem(lsKey) !== null) {
|
|
405
|
-
localStorage.removeItem(lsKey);
|
|
406
|
-
return true;
|
|
407
|
-
} else {
|
|
408
|
-
return false;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
clear() {
|
|
412
|
-
const baseKey = getLocalKey("");
|
|
413
|
-
for (let key2 in localStorage) {
|
|
414
|
-
if (key2.slice(0, baseKey.length) === baseKey) {
|
|
415
|
-
localStorage.removeItem(key2);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
var localStorage_default = new LocalStorage();
|
|
421
|
-
|
|
422
163
|
// src/SessionHandler.ts
|
|
423
164
|
var _SessionHandler = class {
|
|
424
165
|
constructor() {
|
|
@@ -568,61 +309,226 @@ var UserSession = class extends SessionHandler {
|
|
|
568
309
|
constructor(userData) {
|
|
569
310
|
super();
|
|
570
311
|
this.decimalSeparator = ".";
|
|
312
|
+
this.domain = "OB";
|
|
571
313
|
this.groupSeparator = null;
|
|
572
314
|
this.shortDateFormat = "dd.MM.yyyy";
|
|
573
|
-
this.login =
|
|
315
|
+
this.login = "";
|
|
574
316
|
this.isDeveloper = false;
|
|
317
|
+
this.culture = "en-GB";
|
|
318
|
+
this.uiculture = "en-GB";
|
|
319
|
+
this.expired = () => null;
|
|
575
320
|
this.formats = {};
|
|
576
321
|
Object.assign(this, userData);
|
|
577
322
|
}
|
|
578
323
|
};
|
|
579
324
|
|
|
580
|
-
// src/
|
|
581
|
-
function
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
325
|
+
// src/downloadBlob.ts
|
|
326
|
+
function downloadBlob(blob, fileName) {
|
|
327
|
+
return new Promise(function(resolve, reject) {
|
|
328
|
+
try {
|
|
329
|
+
const url = URL.createObjectURL(blob);
|
|
330
|
+
const parent = document.body;
|
|
331
|
+
const anchor = document.createElement("a");
|
|
332
|
+
anchor.setAttribute("download", fileName);
|
|
333
|
+
anchor.href = url;
|
|
334
|
+
parent.append(anchor);
|
|
335
|
+
anchor.click();
|
|
336
|
+
parent.removeChild(anchor);
|
|
337
|
+
setTimeout(function() {
|
|
338
|
+
URL.revokeObjectURL(url);
|
|
339
|
+
resolve();
|
|
340
|
+
}, 250);
|
|
341
|
+
} catch (ex) {
|
|
342
|
+
reject(ex);
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// src/downloadRequest.ts
|
|
348
|
+
async function downloadRequest(request, { fileName, signal, onProgress }) {
|
|
349
|
+
function reportProgress(progress) {
|
|
350
|
+
if (typeof onProgress === "function") {
|
|
351
|
+
onProgress({ ...progress });
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
let bytesReceived = 0;
|
|
355
|
+
reportProgress({ status: "requested" });
|
|
356
|
+
try {
|
|
357
|
+
let response = await fetch(request);
|
|
358
|
+
if (!response.ok || !response.body) {
|
|
359
|
+
if (response.headers.get("content-type")?.includes("application/json")) {
|
|
360
|
+
let data = await response.json();
|
|
361
|
+
if (data.error) {
|
|
362
|
+
throw new Error(data.error);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
throw new Error(`${response.status} ${response.statusText}`);
|
|
366
|
+
}
|
|
367
|
+
try {
|
|
368
|
+
const reader = response.body.getReader();
|
|
369
|
+
const stream = new ReadableStream({
|
|
370
|
+
start: function(controller) {
|
|
371
|
+
function pump() {
|
|
372
|
+
return reader.read().then(function(read) {
|
|
373
|
+
if (read.done) {
|
|
374
|
+
controller.close();
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
bytesReceived += read.value.length;
|
|
378
|
+
reportProgress({ bytesReceived, status: "downloading" });
|
|
379
|
+
controller.enqueue(read.value);
|
|
380
|
+
return pump();
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
return pump();
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
response = new Response(stream);
|
|
387
|
+
} catch (error) {
|
|
388
|
+
console.warn("Failed to replace response stream to log download progress.");
|
|
389
|
+
}
|
|
390
|
+
const blob = await response.blob();
|
|
391
|
+
reportProgress({ bytesReceived, status: "downloaded" });
|
|
392
|
+
await downloadBlob(blob, fileName);
|
|
393
|
+
reportProgress({ bytesReceived, status: "completed" });
|
|
394
|
+
} catch (err) {
|
|
395
|
+
if (signal?.aborted) {
|
|
396
|
+
reportProgress({ status: "cancelled" });
|
|
397
|
+
} else {
|
|
398
|
+
reportProgress({ error: err.message, status: "error" });
|
|
399
|
+
}
|
|
594
400
|
}
|
|
595
|
-
return value;
|
|
596
401
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
402
|
+
|
|
403
|
+
// src/has.ts
|
|
404
|
+
function has(obj, key2) {
|
|
405
|
+
return Object.prototype.hasOwnProperty.call(obj, key2);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// src/parseFunc.ts
|
|
409
|
+
var funcRegex = /^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;
|
|
410
|
+
function parseFunc(func) {
|
|
411
|
+
var match = func.toString().match(funcRegex);
|
|
412
|
+
if (match === null) {
|
|
413
|
+
throw new TypeError("Unable to parse function!");
|
|
414
|
+
}
|
|
415
|
+
return { name: match[1], args: match[2].split(","), body: match[3] };
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// src/Namespace.ts
|
|
419
|
+
function Namespace() {
|
|
420
|
+
}
|
|
421
|
+
Namespace.prototype = /* @__PURE__ */ Object.create(null);
|
|
422
|
+
var Namespace_default = Namespace;
|
|
423
|
+
|
|
424
|
+
// src/requireNamespace.ts
|
|
425
|
+
function requireNamespace(root, namespace) {
|
|
426
|
+
if (typeof root === "object") {
|
|
427
|
+
if (typeof namespace === "string") {
|
|
428
|
+
let path = namespace.split(".");
|
|
429
|
+
return requireNamespace(root, path);
|
|
430
|
+
} else if (Array.isArray(namespace)) {
|
|
431
|
+
let current = root;
|
|
432
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
433
|
+
current = current[namespace[i]] = current[namespace[i]] || new Namespace_default();
|
|
609
434
|
}
|
|
435
|
+
return current;
|
|
610
436
|
} else {
|
|
611
|
-
|
|
437
|
+
throw new TypeError("Invalid type of parameter 'namespace'");
|
|
612
438
|
}
|
|
439
|
+
} else {
|
|
440
|
+
throw new TypeError("Invalid type of parameter 'root'");
|
|
613
441
|
}
|
|
614
|
-
return result;
|
|
615
442
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
443
|
+
|
|
444
|
+
// src/warn.ts
|
|
445
|
+
function warn(message, fallbackToAlert) {
|
|
446
|
+
console.warn(message);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// src/expose.ts
|
|
450
|
+
function expose(name, value) {
|
|
451
|
+
if (arguments.length !== 2) {
|
|
452
|
+
throw new Error("Incorrect number of arguments passed to the expose function!");
|
|
453
|
+
}
|
|
454
|
+
if (Array.isArray(value)) {
|
|
455
|
+
for (let func of value) {
|
|
456
|
+
const { name: funcName } = parseFunc(func);
|
|
457
|
+
if (funcName) {
|
|
458
|
+
expose(name, func);
|
|
459
|
+
} else {
|
|
460
|
+
throw new Error(
|
|
461
|
+
"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
} else {
|
|
466
|
+
let keyName;
|
|
467
|
+
let namespace;
|
|
468
|
+
if (typeof value === "function") {
|
|
469
|
+
keyName = parseFunc(value).name;
|
|
470
|
+
}
|
|
471
|
+
if (typeof name === "string") {
|
|
472
|
+
let pathParts = name.split(".");
|
|
473
|
+
if (!keyName) {
|
|
474
|
+
keyName = pathParts[pathParts.length - 1];
|
|
475
|
+
pathParts = pathParts.slice(0, pathParts.length - 1);
|
|
476
|
+
}
|
|
477
|
+
namespace = requireNamespace(window, pathParts);
|
|
478
|
+
} else if (keyName && (typeof name === "object" || typeof name === "function")) {
|
|
479
|
+
namespace = name;
|
|
480
|
+
} else {
|
|
481
|
+
throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");
|
|
482
|
+
}
|
|
483
|
+
if (has(namespace, keyName)) {
|
|
484
|
+
warn([name, keyName].join(".") + " is already defined!");
|
|
485
|
+
} else {
|
|
486
|
+
namespace[keyName] = value;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
620
489
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
return
|
|
490
|
+
|
|
491
|
+
// src/localStorage.ts
|
|
492
|
+
function getLocalKey(key2) {
|
|
493
|
+
return [af?.article?.id || "", "common", key2].join(".");
|
|
625
494
|
}
|
|
495
|
+
var LocalStorage = class {
|
|
496
|
+
isPersisted() {
|
|
497
|
+
return true;
|
|
498
|
+
}
|
|
499
|
+
getLocalStorageKey(key2, global) {
|
|
500
|
+
return global ? ["common", key2].join(".") : getLocalKey(key2);
|
|
501
|
+
}
|
|
502
|
+
get(key2, defaultValue, global) {
|
|
503
|
+
const lsKey = this.getLocalStorageKey(key2, global);
|
|
504
|
+
const value = localStorage.getItem(lsKey);
|
|
505
|
+
return value !== null ? JSON.parse(value) : defaultValue;
|
|
506
|
+
}
|
|
507
|
+
set(key2, value, global) {
|
|
508
|
+
localStorage.setItem(
|
|
509
|
+
this.getLocalStorageKey(key2, global),
|
|
510
|
+
JSON.stringify(value)
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
remove(key2, global) {
|
|
514
|
+
const lsKey = this.getLocalStorageKey(key2, global);
|
|
515
|
+
if (localStorage.getItem(lsKey) !== null) {
|
|
516
|
+
localStorage.removeItem(lsKey);
|
|
517
|
+
return true;
|
|
518
|
+
} else {
|
|
519
|
+
return false;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
clear() {
|
|
523
|
+
const baseKey = getLocalKey("");
|
|
524
|
+
for (let key2 in localStorage) {
|
|
525
|
+
if (key2.slice(0, baseKey.length) === baseKey) {
|
|
526
|
+
localStorage.removeItem(key2);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
var localStorage_default = new LocalStorage();
|
|
626
532
|
|
|
627
533
|
// src/settings.ts
|
|
628
534
|
function getKey(article) {
|
|
@@ -653,24 +559,18 @@ function saveSettings(setting, value, article) {
|
|
|
653
559
|
}
|
|
654
560
|
|
|
655
561
|
// src/index.ts
|
|
656
|
-
var version = "
|
|
562
|
+
var version = "2.0.0";
|
|
657
563
|
export {
|
|
658
564
|
SessionHandler,
|
|
659
565
|
UserSession,
|
|
660
566
|
downloadBlob,
|
|
661
567
|
downloadRequest,
|
|
662
|
-
exportOptionsFromDataObject,
|
|
663
568
|
expose,
|
|
664
|
-
formDataToDataObjectRecord,
|
|
665
|
-
formDataToObject,
|
|
666
|
-
formDataToProcedureParameters,
|
|
667
|
-
getDataObjectReportRequest,
|
|
668
569
|
getLocalizedString,
|
|
669
570
|
getSettings,
|
|
670
571
|
has,
|
|
671
572
|
localStorage_default as localStorage,
|
|
672
573
|
mitt_default as mitt,
|
|
673
|
-
openDataObjectReport,
|
|
674
574
|
saveSettings,
|
|
675
575
|
version
|
|
676
576
|
};
|