osl-base-extended 12.5.0 → 12.7.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.
|
@@ -410,12 +410,20 @@ class Httpbase {
|
|
|
410
410
|
async getConfig() {
|
|
411
411
|
return this.get('getConfig');
|
|
412
412
|
}
|
|
413
|
+
getPublicIP() {
|
|
414
|
+
return this.http.get('https://api.ipify.org?format=json');
|
|
415
|
+
}
|
|
413
416
|
// ─── Internals ────────────────────────────────────────────────────────────────
|
|
414
|
-
getHeaders() {
|
|
417
|
+
async getHeaders() {
|
|
418
|
+
let userIp = "";
|
|
415
419
|
const token = localStorage.getItem('token');
|
|
420
|
+
await this.getPublicIP().subscribe(res => {
|
|
421
|
+
userIp = res?.ip;
|
|
422
|
+
});
|
|
416
423
|
return new HttpHeaders({
|
|
417
424
|
'Content-Type': 'application/json',
|
|
418
425
|
Authorization: token ? `Bearer ${token}` : '',
|
|
426
|
+
'ip-address': userIp
|
|
419
427
|
});
|
|
420
428
|
}
|
|
421
429
|
getUploadHeaders() {
|
|
@@ -480,7 +488,7 @@ class Httpbase {
|
|
|
480
488
|
const res = await firstValueFrom(this.http
|
|
481
489
|
.post(this.getEndPoint(methodName), body, {
|
|
482
490
|
observe: 'response',
|
|
483
|
-
headers: this.getHeaders(),
|
|
491
|
+
headers: await this.getHeaders(),
|
|
484
492
|
params: this.buildParams(params || []),
|
|
485
493
|
})
|
|
486
494
|
.pipe(timeout(30000)));
|
|
@@ -495,7 +503,7 @@ class Httpbase {
|
|
|
495
503
|
const res = await firstValueFrom(this.http
|
|
496
504
|
.get(this.getEndPoint(methodName), {
|
|
497
505
|
observe: 'response',
|
|
498
|
-
headers: this.getHeaders(),
|
|
506
|
+
headers: await this.getHeaders(),
|
|
499
507
|
params: this.buildParams(params || []),
|
|
500
508
|
})
|
|
501
509
|
.pipe(timeout(30000)));
|
|
@@ -510,7 +518,7 @@ class Httpbase {
|
|
|
510
518
|
const res = await firstValueFrom(this.http
|
|
511
519
|
.put(this.getEndPoint(methodName), body, {
|
|
512
520
|
observe: 'response',
|
|
513
|
-
headers: this.getHeaders(),
|
|
521
|
+
headers: await this.getHeaders(),
|
|
514
522
|
params: this.buildParams(params || []),
|
|
515
523
|
})
|
|
516
524
|
.pipe(timeout(30000)));
|
|
@@ -525,7 +533,7 @@ class Httpbase {
|
|
|
525
533
|
const res = await firstValueFrom(this.http
|
|
526
534
|
.patch(this.getEndPoint(methodName), body, {
|
|
527
535
|
observe: 'response',
|
|
528
|
-
headers: this.getHeaders(),
|
|
536
|
+
headers: await this.getHeaders(),
|
|
529
537
|
})
|
|
530
538
|
.pipe(timeout(30000)));
|
|
531
539
|
return this.handleSuccess(res.status, res.body, res.headers);
|
|
@@ -539,7 +547,7 @@ class Httpbase {
|
|
|
539
547
|
const res = await firstValueFrom(this.http
|
|
540
548
|
.delete(this.getEndPoint(methodName), {
|
|
541
549
|
observe: 'response',
|
|
542
|
-
headers: this.getHeaders(),
|
|
550
|
+
headers: await this.getHeaders(),
|
|
543
551
|
params: this.buildParams(params || []),
|
|
544
552
|
})
|
|
545
553
|
.pipe(timeout(30000)));
|
|
@@ -554,7 +562,7 @@ class Httpbase {
|
|
|
554
562
|
const res = await firstValueFrom(this.http
|
|
555
563
|
.get(this.getEndPoint(methodName), {
|
|
556
564
|
observe: 'response',
|
|
557
|
-
headers: this.getHeaders(),
|
|
565
|
+
headers: await this.getHeaders(),
|
|
558
566
|
params: this.buildParams(params || []),
|
|
559
567
|
responseType: 'blob',
|
|
560
568
|
})
|
|
@@ -4472,14 +4480,18 @@ class OslFormGrid {
|
|
|
4472
4480
|
if (!col.formElem?.change)
|
|
4473
4481
|
return;
|
|
4474
4482
|
const elem = col.formElem;
|
|
4483
|
+
// Autocomplete's live options live in the per-row cache (see getAutocompleteDatasource),
|
|
4484
|
+
// not elem.datasource — that field is only ever the static config list and is never
|
|
4485
|
+
// written to per-row, so API search results would never be found there.
|
|
4486
|
+
const list = elem.elementType === 'autocomplete' ? this.getAutocompleteDatasource(row, col) : elem.datasource;
|
|
4475
4487
|
let selectedObj = undefined;
|
|
4476
|
-
if (
|
|
4488
|
+
if (list) {
|
|
4477
4489
|
if (Array.isArray(value)) {
|
|
4478
|
-
selectedObj = value.map(v =>
|
|
4490
|
+
selectedObj = value.map(v => list.find(item => (elem.valueField ? item[elem.valueField] : item) === v) ?? null);
|
|
4479
4491
|
}
|
|
4480
4492
|
else if (value !== null && value !== undefined) {
|
|
4481
4493
|
selectedObj =
|
|
4482
|
-
|
|
4494
|
+
list.find(item => (elem.valueField ? item[elem.valueField] : item) === value) ?? null;
|
|
4483
4495
|
}
|
|
4484
4496
|
else {
|
|
4485
4497
|
selectedObj = null;
|