@rangertechnologies/ngnxt 2.1.360 → 2.1.362
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.
|
@@ -819,6 +819,7 @@ class HijriDatepickerComponent {
|
|
|
819
819
|
}
|
|
820
820
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.20", ngImport: i0, type: HijriDatepickerComponent, deps: [{ token: DataService }], target: i0.ɵɵFactoryTarget.Component });
|
|
821
821
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.20", type: HijriDatepickerComponent, isStandalone: true, selector: "app-hijri-datepicker", inputs: { type: "type", value: "value", min: "min", max: "max", languageCode: "languageCode" }, outputs: { dateChange: "dateChange" }, providers: [
|
|
822
|
+
NgbCalendarIslamicUmalqura,
|
|
822
823
|
{ provide: NgbCalendar, useClass: NgbCalendarIslamicUmalqura },
|
|
823
824
|
{ provide: NgbDatepickerI18n, useClass: IslamicI18n }
|
|
824
825
|
], viewQueries: [{ propertyName: "datepickerRef", first: true, predicate: ["dp"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!-- SKS14AUG25 Date Picker -->\n@if (type === 'date' || type === 'datetime') {\n <div class=\"date-picker-wrapper\">\n <ngb-datepicker #dp [ngModel]=\"model\" (ngModelChange)=\"onDateChange($event)\"\n [minDate]=\"minDate\" [maxDate]=\"maxDate\"\n (navigate)=\"onNavigate()\" [firstDayOfWeek]=\"7\" [showWeekNumbers]=\"false\">\n </ngb-datepicker>\n </div>\n}\n\n<!-- SKS14AUG25 Month Picker -->\n@if (type === 'month') {\n <div class=\"month-picker\">\n <div class=\"select-group\">\n <label class=\"select-label\">{{languageCode === 'ar' ? '\u0627\u0644\u0633\u0646\u0629' : 'Year'}}</label>\n <select class=\"custom-select\" [(ngModel)]=\"model.year\" (change)=\"onMonthChange()\">\n @for (year of years; track year) {\n <option [value]=\"year\">\n {{ toArabicNumber(year) }}\n </option>\n }\n </select>\n </div>\n <div class=\"select-group\">\n <label class=\"select-label\">{{languageCode === 'ar' ? '\u0627\u0644\u0634\u0647\u0631' : 'Month'}}</label>\n <select class=\"custom-select\" [(ngModel)]=\"model.month\" (change)=\"onMonthChange()\">\n @for (month of months; track month; let i = $index) {\n <option [value]=\"i + 1\">\n {{ month }}\n </option>\n }\n </select>\n </div>\n </div>\n}\n\n<!-- SKS14AUG25 Time Picker -->\n@if (type === 'datetime') {\n <div class=\"time-picker\">\n <div class=\"time-section\">\n <div class=\"time-controls\">\n <div class=\"time-group\">\n <select class=\"time-select\" [(ngModel)]=\"hour\" (change)=\"onTimeChange()\">\n @for (h of hours; track h) {\n <option [value]=\"h\">\n {{ toArabicNumber(h.toString().padStart(2, '0')) }}\n </option>\n }\n </select>\n </div>\n <span class=\"time-separator\">:</span>\n <div class=\"time-group\">\n <select class=\"time-select\" [(ngModel)]=\"minute\" (change)=\"onTimeChange()\">\n @for (m of minutes; track m) {\n <option [value]=\"m\">\n {{ toArabicNumber(m.toString().padStart(2, '0')) }}\n </option>\n }\n </select>\n </div>\n </div>\n </div>\n </div>\n}", styles: [".date-picker-wrapper{display:flex;justify-content:center;margin-bottom:1rem}.month-picker{display:flex;gap:1rem;margin-bottom:1rem;flex-wrap:wrap}.select-group{flex:1;min-width:120px}.select-label{display:block;font-size:.875rem;font-weight:500;color:#374151;margin-bottom:.25rem}.custom-select{width:100%;padding:.5rem;border:1px solid #d1d5db;border-radius:8px;background-color:#fff;font-size:.875rem;transition:border-color .2s,box-shadow .2s}.custom-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.time-section{text-align:center}.time-controls{display:flex;align-items:center;justify-content:center;gap:.5rem}.time-group{display:flex;flex-direction:column;align-items:center;gap:.25rem}.time-select{width:70px;padding:.375rem .25rem;border:1px solid #d1d5db;border-radius:6px;background-color:#fff;font-size:.875rem;text-align:center;transition:border-color .2s,box-shadow .2s}.time-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.time-separator{font-size:1.25rem;font-weight:700;color:#374151;margin:0 .25rem}:host ::ng-deep ngb-datepicker{border:solid 1px #c9c6c6!important;border-radius:5px;box-shadow:none!important}:host ::ng-deep .ngb-dp-header{padding:5px;background-color:#fff!important;border-bottom:none!important;border-radius:5px!important}:host ::ng-deep .ngb-dp-content{padding:0 5px 5px}:host ::ng-deep .ngb-dp-day{border-radius:6px;margin:1px}:host ::ng-deep .ngb-dp-day .btn-light{border:none;background:transparent}:host ::ng-deep .ngb-dp-day .btn-light:hover{background-color:#f3f4f6}:host ::ng-deep .ngb-dp-day .btn-primary{background-color:#3b82f6;border-color:#3b82f6}:host ::ng-deep .ngb-dp-navigation-select select{border:1px solid #d1d5db;border-radius:6px;padding:.25rem .3rem;background-color:#fff}:host ::ng-deep .ngb-dp-navigation-select{gap:.2rem}:host ::ng-deep .ngb-dp-arrow-btn{margin:0!important}:host ::ng-deep .ngb-dp-arrow{flex:unset!important;width:auto!important;height:auto!important}:host ::ng-deep ngb-datepicker-navigation-select select{font-size:12px!important}:host ::ng-deep ngb-datepicker-month{font-size:12px!important}:host ::ng-deep ngb-datepicker-month div.small{font-size:100%!important}:host ::ng-deep .ngb-dp-weekday{margin-right:2.2px!important}:host ::ng-deep .ngb-dp-navigation-chevron{border-width:.1em .1em 0 0!important;color:gray!important}.ngb-dp-arrow-btn:focus,.ngb-dp-arrow-btn:focus-visible,.ngb-dp-arrow button:focus{outline:none!important;box-shadow:none!important}@media(max-width:480px){.month-picker{flex-direction:column}.time-controls{flex-wrap:wrap}}:host ::ng-deep :focus-visible{outline:none}\n"], dependencies: [{ kind: "ngmodule", type: NgbDatepickerModule }, { kind: "component", type: i1.NgbDatepicker, selector: "ngb-datepicker", inputs: ["contentTemplate", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "maxDate", "minDate", "navigation", "outsideDays", "showWeekNumbers", "startDate", "weekdays"], outputs: ["navigate", "dateSelect"], exportAs: ["ngbDatepicker"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
@@ -826,6 +827,7 @@ class HijriDatepickerComponent {
|
|
|
826
827
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.20", ngImport: i0, type: HijriDatepickerComponent, decorators: [{
|
|
827
828
|
type: Component,
|
|
828
829
|
args: [{ selector: 'app-hijri-datepicker', standalone: true, imports: [NgbDatepickerModule, FormsModule], providers: [
|
|
830
|
+
NgbCalendarIslamicUmalqura,
|
|
829
831
|
{ provide: NgbCalendar, useClass: NgbCalendarIslamicUmalqura },
|
|
830
832
|
{ provide: NgbDatepickerI18n, useClass: IslamicI18n }
|
|
831
833
|
], template: "<!-- SKS14AUG25 Date Picker -->\n@if (type === 'date' || type === 'datetime') {\n <div class=\"date-picker-wrapper\">\n <ngb-datepicker #dp [ngModel]=\"model\" (ngModelChange)=\"onDateChange($event)\"\n [minDate]=\"minDate\" [maxDate]=\"maxDate\"\n (navigate)=\"onNavigate()\" [firstDayOfWeek]=\"7\" [showWeekNumbers]=\"false\">\n </ngb-datepicker>\n </div>\n}\n\n<!-- SKS14AUG25 Month Picker -->\n@if (type === 'month') {\n <div class=\"month-picker\">\n <div class=\"select-group\">\n <label class=\"select-label\">{{languageCode === 'ar' ? '\u0627\u0644\u0633\u0646\u0629' : 'Year'}}</label>\n <select class=\"custom-select\" [(ngModel)]=\"model.year\" (change)=\"onMonthChange()\">\n @for (year of years; track year) {\n <option [value]=\"year\">\n {{ toArabicNumber(year) }}\n </option>\n }\n </select>\n </div>\n <div class=\"select-group\">\n <label class=\"select-label\">{{languageCode === 'ar' ? '\u0627\u0644\u0634\u0647\u0631' : 'Month'}}</label>\n <select class=\"custom-select\" [(ngModel)]=\"model.month\" (change)=\"onMonthChange()\">\n @for (month of months; track month; let i = $index) {\n <option [value]=\"i + 1\">\n {{ month }}\n </option>\n }\n </select>\n </div>\n </div>\n}\n\n<!-- SKS14AUG25 Time Picker -->\n@if (type === 'datetime') {\n <div class=\"time-picker\">\n <div class=\"time-section\">\n <div class=\"time-controls\">\n <div class=\"time-group\">\n <select class=\"time-select\" [(ngModel)]=\"hour\" (change)=\"onTimeChange()\">\n @for (h of hours; track h) {\n <option [value]=\"h\">\n {{ toArabicNumber(h.toString().padStart(2, '0')) }}\n </option>\n }\n </select>\n </div>\n <span class=\"time-separator\">:</span>\n <div class=\"time-group\">\n <select class=\"time-select\" [(ngModel)]=\"minute\" (change)=\"onTimeChange()\">\n @for (m of minutes; track m) {\n <option [value]=\"m\">\n {{ toArabicNumber(m.toString().padStart(2, '0')) }}\n </option>\n }\n </select>\n </div>\n </div>\n </div>\n </div>\n}", styles: [".date-picker-wrapper{display:flex;justify-content:center;margin-bottom:1rem}.month-picker{display:flex;gap:1rem;margin-bottom:1rem;flex-wrap:wrap}.select-group{flex:1;min-width:120px}.select-label{display:block;font-size:.875rem;font-weight:500;color:#374151;margin-bottom:.25rem}.custom-select{width:100%;padding:.5rem;border:1px solid #d1d5db;border-radius:8px;background-color:#fff;font-size:.875rem;transition:border-color .2s,box-shadow .2s}.custom-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.time-section{text-align:center}.time-controls{display:flex;align-items:center;justify-content:center;gap:.5rem}.time-group{display:flex;flex-direction:column;align-items:center;gap:.25rem}.time-select{width:70px;padding:.375rem .25rem;border:1px solid #d1d5db;border-radius:6px;background-color:#fff;font-size:.875rem;text-align:center;transition:border-color .2s,box-shadow .2s}.time-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.time-separator{font-size:1.25rem;font-weight:700;color:#374151;margin:0 .25rem}:host ::ng-deep ngb-datepicker{border:solid 1px #c9c6c6!important;border-radius:5px;box-shadow:none!important}:host ::ng-deep .ngb-dp-header{padding:5px;background-color:#fff!important;border-bottom:none!important;border-radius:5px!important}:host ::ng-deep .ngb-dp-content{padding:0 5px 5px}:host ::ng-deep .ngb-dp-day{border-radius:6px;margin:1px}:host ::ng-deep .ngb-dp-day .btn-light{border:none;background:transparent}:host ::ng-deep .ngb-dp-day .btn-light:hover{background-color:#f3f4f6}:host ::ng-deep .ngb-dp-day .btn-primary{background-color:#3b82f6;border-color:#3b82f6}:host ::ng-deep .ngb-dp-navigation-select select{border:1px solid #d1d5db;border-radius:6px;padding:.25rem .3rem;background-color:#fff}:host ::ng-deep .ngb-dp-navigation-select{gap:.2rem}:host ::ng-deep .ngb-dp-arrow-btn{margin:0!important}:host ::ng-deep .ngb-dp-arrow{flex:unset!important;width:auto!important;height:auto!important}:host ::ng-deep ngb-datepicker-navigation-select select{font-size:12px!important}:host ::ng-deep ngb-datepicker-month{font-size:12px!important}:host ::ng-deep ngb-datepicker-month div.small{font-size:100%!important}:host ::ng-deep .ngb-dp-weekday{margin-right:2.2px!important}:host ::ng-deep .ngb-dp-navigation-chevron{border-width:.1em .1em 0 0!important;color:gray!important}.ngb-dp-arrow-btn:focus,.ngb-dp-arrow-btn:focus-visible,.ngb-dp-arrow button:focus{outline:none!important;box-shadow:none!important}@media(max-width:480px){.month-picker{flex-direction:column}.time-controls{flex-wrap:wrap}}:host ::ng-deep :focus-visible{outline:none}\n"] }]
|
|
@@ -58961,6 +58963,8 @@ class QuestionbookComponent {
|
|
|
58961
58963
|
imageChangedEvent = null;
|
|
58962
58964
|
alignImage = 'center';
|
|
58963
58965
|
isImageHover = false;
|
|
58966
|
+
imageCache = {};
|
|
58967
|
+
inFlightImageRequests = {};
|
|
58964
58968
|
currencyOption;
|
|
58965
58969
|
processed = false;
|
|
58966
58970
|
hadleDropDownDependent = new EventEmitter();
|
|
@@ -59006,8 +59010,9 @@ class QuestionbookComponent {
|
|
|
59006
59010
|
input['isObject'] = apiObj?.isObject;
|
|
59007
59011
|
input['field'] = apiObj?.defaultField || apiObj?.field?.[0] || apiObj?.field || null;
|
|
59008
59012
|
if (ques.type === 'Image') {
|
|
59009
|
-
|
|
59010
|
-
ques.imageData
|
|
59013
|
+
await this.loadOrFetchImage(ques);
|
|
59014
|
+
input['valueObj'] = ques.imageData || ques.input || ques.orgImageData;
|
|
59015
|
+
ques.imageData = ques.imageData || ques.input || ques.orgImageData;
|
|
59011
59016
|
ques.orgImageData = ques.imageData;
|
|
59012
59017
|
}
|
|
59013
59018
|
else if (ques.type === 'Boolean') {
|
|
@@ -59098,6 +59103,9 @@ class QuestionbookComponent {
|
|
|
59098
59103
|
ques.input = [];
|
|
59099
59104
|
ques.input = value ?? (Array.isArray(ques.defaultValue) ? ques.defaultValue : []);
|
|
59100
59105
|
}
|
|
59106
|
+
else if (ques.type === 'Image') {
|
|
59107
|
+
ques.input = value ?? ques.defaultValue;
|
|
59108
|
+
}
|
|
59101
59109
|
else if (ques.type === "Boolean") { // SKS23JUN25 defaultly set value false
|
|
59102
59110
|
ques.input = typeof value !== 'undefined' ? value === true || value === 'true' : typeof ques.defaultValue !== 'undefined' ? ques.defaultValue === true || ques.defaultValue === 'true' : false;
|
|
59103
59111
|
}
|
|
@@ -59129,6 +59137,9 @@ class QuestionbookComponent {
|
|
|
59129
59137
|
// VD 23 Oct24 - file type changes
|
|
59130
59138
|
question['input'] = ques.input ?? (Array.isArray(ques.defaultValue) ? ques.defaultValue : []);
|
|
59131
59139
|
}
|
|
59140
|
+
else if (ques.type === 'Image') {
|
|
59141
|
+
question['input'] = ques.input || ques.defaultValue;
|
|
59142
|
+
}
|
|
59132
59143
|
else if (ques.type === "Boolean") { // SKS23JUN25 defaultly set value false
|
|
59133
59144
|
question['input'] = typeof ques.input !== 'undefined' ? ques.input === true || ques.input === 'true' : typeof ques.defaultValue !== 'undefined' ? ((ques.defaultValue === true && ques.defaultValue !== "" && ques.defaultValue !== "false") || ques.defaultValue === 'true') : false;
|
|
59134
59145
|
}
|
|
@@ -59372,6 +59383,9 @@ class QuestionbookComponent {
|
|
|
59372
59383
|
else if (ques.type === 'Icon') {
|
|
59373
59384
|
ques.input = event?.metadata?.name || event?.valueObj;
|
|
59374
59385
|
}
|
|
59386
|
+
else if (ques.type === 'Image') {
|
|
59387
|
+
ques.input = event?.valueObj || null;
|
|
59388
|
+
}
|
|
59375
59389
|
else {
|
|
59376
59390
|
ques.input = event?.valueObj;
|
|
59377
59391
|
}
|
|
@@ -59466,6 +59480,205 @@ class QuestionbookComponent {
|
|
|
59466
59480
|
reader.readAsDataURL(file);
|
|
59467
59481
|
});
|
|
59468
59482
|
}
|
|
59483
|
+
// SKS24AUG26 Load or fetch image when input is string ID/endpoint instead of direct base64
|
|
59484
|
+
async loadOrFetchImage(ques) {
|
|
59485
|
+
if (!ques)
|
|
59486
|
+
return;
|
|
59487
|
+
const rawVal = ques.input ?? ques.imageData ?? ques.orgImageData ?? ques.defaultValue;
|
|
59488
|
+
if (!rawVal) {
|
|
59489
|
+
ques.imageData = '';
|
|
59490
|
+
ques.orgImageData = '';
|
|
59491
|
+
return;
|
|
59492
|
+
}
|
|
59493
|
+
if (ques.subText && typeof ques.subText === 'string') {
|
|
59494
|
+
try {
|
|
59495
|
+
ques.subText = JSON.parse(ques.subText);
|
|
59496
|
+
}
|
|
59497
|
+
catch (e) {
|
|
59498
|
+
ques.subText = {};
|
|
59499
|
+
}
|
|
59500
|
+
}
|
|
59501
|
+
const subText = ques.subText || {};
|
|
59502
|
+
const endpoint = subText.endpoint;
|
|
59503
|
+
const queryParameter = subText.queryParameter;
|
|
59504
|
+
// SKS24AUG26 Check if rawVal is already a base64 data URL or HTTP/HTTPS/blob URL
|
|
59505
|
+
if (typeof rawVal === 'string') {
|
|
59506
|
+
const trimmed = rawVal.trim();
|
|
59507
|
+
if (trimmed.startsWith('data:image/') ||
|
|
59508
|
+
trimmed.startsWith('http://') ||
|
|
59509
|
+
trimmed.startsWith('https://') ||
|
|
59510
|
+
trimmed.startsWith('blob:')) {
|
|
59511
|
+
ques.imageData = trimmed;
|
|
59512
|
+
ques.orgImageData = trimmed;
|
|
59513
|
+
return;
|
|
59514
|
+
}
|
|
59515
|
+
if (this.isRawBase64(trimmed)) {
|
|
59516
|
+
ques.imageData = `data:image/png;base64,${trimmed}`;
|
|
59517
|
+
ques.orgImageData = ques.imageData;
|
|
59518
|
+
return;
|
|
59519
|
+
}
|
|
59520
|
+
}
|
|
59521
|
+
// SKS24AUG26 If endpoint is configured (referencing file element pattern)
|
|
59522
|
+
if (endpoint) {
|
|
59523
|
+
let paramValue = '';
|
|
59524
|
+
if (typeof rawVal === 'object' && rawVal !== null) {
|
|
59525
|
+
paramValue = queryParameter
|
|
59526
|
+
? (rawVal[queryParameter] || rawVal.id || rawVal.value || rawVal.name)
|
|
59527
|
+
: (rawVal.id || rawVal.value);
|
|
59528
|
+
}
|
|
59529
|
+
else {
|
|
59530
|
+
paramValue = String(rawVal);
|
|
59531
|
+
}
|
|
59532
|
+
if (paramValue) {
|
|
59533
|
+
let fullEndPoint = '';
|
|
59534
|
+
if (queryParameter) {
|
|
59535
|
+
const sep = endpoint.includes('?') ? '&' : '?';
|
|
59536
|
+
fullEndPoint = `${endpoint}${sep}${queryParameter}=${encodeURIComponent(paramValue)}`;
|
|
59537
|
+
}
|
|
59538
|
+
else {
|
|
59539
|
+
fullEndPoint = endpoint.endsWith('/')
|
|
59540
|
+
? `${endpoint}${encodeURIComponent(paramValue)}`
|
|
59541
|
+
: `${endpoint}${endpoint.includes('?') ? '&id=' : '?id='}${encodeURIComponent(paramValue)}`;
|
|
59542
|
+
}
|
|
59543
|
+
if (this.imageCache[fullEndPoint]) {
|
|
59544
|
+
ques.imageData = this.imageCache[fullEndPoint];
|
|
59545
|
+
ques.orgImageData = ques.imageData;
|
|
59546
|
+
this.cdr.markForCheck();
|
|
59547
|
+
return;
|
|
59548
|
+
}
|
|
59549
|
+
if (this.inFlightImageRequests[fullEndPoint]) {
|
|
59550
|
+
const inFlightResult = await this.inFlightImageRequests[fullEndPoint];
|
|
59551
|
+
if (inFlightResult) {
|
|
59552
|
+
ques.imageData = inFlightResult;
|
|
59553
|
+
ques.orgImageData = inFlightResult;
|
|
59554
|
+
this.cdr.markForCheck();
|
|
59555
|
+
}
|
|
59556
|
+
return;
|
|
59557
|
+
}
|
|
59558
|
+
this.inFlightImageRequests[fullEndPoint] = new Promise((resolve) => {
|
|
59559
|
+
this.dataService
|
|
59560
|
+
.apiResponse(fullEndPoint)
|
|
59561
|
+
.pipe(catchError((err) => {
|
|
59562
|
+
console.error('Error fetching image:', err);
|
|
59563
|
+
return of(null);
|
|
59564
|
+
}))
|
|
59565
|
+
.subscribe((apiResponse) => {
|
|
59566
|
+
if (apiResponse) {
|
|
59567
|
+
this.processImageApiResponse(apiResponse, ques, fullEndPoint, subText, resolve);
|
|
59568
|
+
}
|
|
59569
|
+
else {
|
|
59570
|
+
delete this.inFlightImageRequests[fullEndPoint];
|
|
59571
|
+
resolve('');
|
|
59572
|
+
}
|
|
59573
|
+
});
|
|
59574
|
+
});
|
|
59575
|
+
const result = await this.inFlightImageRequests[fullEndPoint];
|
|
59576
|
+
if (result) {
|
|
59577
|
+
ques.imageData = result;
|
|
59578
|
+
ques.orgImageData = result;
|
|
59579
|
+
this.cdr.markForCheck();
|
|
59580
|
+
}
|
|
59581
|
+
return;
|
|
59582
|
+
}
|
|
59583
|
+
}
|
|
59584
|
+
if (typeof rawVal === 'string') {
|
|
59585
|
+
ques.imageData = rawVal;
|
|
59586
|
+
ques.orgImageData = rawVal;
|
|
59587
|
+
}
|
|
59588
|
+
}
|
|
59589
|
+
processImageApiResponse(apiResponse, ques, cacheKey, subText, resolve) {
|
|
59590
|
+
if (!apiResponse) {
|
|
59591
|
+
if (cacheKey)
|
|
59592
|
+
delete this.inFlightImageRequests[cacheKey];
|
|
59593
|
+
if (resolve)
|
|
59594
|
+
resolve('');
|
|
59595
|
+
return;
|
|
59596
|
+
}
|
|
59597
|
+
// SKS24AUG26 Buffer content: { content: { data: [...] }, type: '...' }
|
|
59598
|
+
if (apiResponse?.content?.data && Array.isArray(apiResponse.content.data)) {
|
|
59599
|
+
const byteArray = new Uint8Array(apiResponse.content.data);
|
|
59600
|
+
const type = apiResponse.type || 'image/png';
|
|
59601
|
+
const blob = new Blob([byteArray], { type });
|
|
59602
|
+
const reader = new FileReader();
|
|
59603
|
+
reader.onloadend = () => {
|
|
59604
|
+
const base64Str = reader.result;
|
|
59605
|
+
if (cacheKey) {
|
|
59606
|
+
this.imageCache[cacheKey] = base64Str;
|
|
59607
|
+
delete this.inFlightImageRequests[cacheKey];
|
|
59608
|
+
}
|
|
59609
|
+
ques.imageData = base64Str;
|
|
59610
|
+
ques.orgImageData = base64Str;
|
|
59611
|
+
this.cdr.markForCheck();
|
|
59612
|
+
if (resolve)
|
|
59613
|
+
resolve(base64Str);
|
|
59614
|
+
};
|
|
59615
|
+
reader.readAsDataURL(blob);
|
|
59616
|
+
return;
|
|
59617
|
+
}
|
|
59618
|
+
let imageStr = '';
|
|
59619
|
+
if (typeof apiResponse === 'string') {
|
|
59620
|
+
imageStr = apiResponse;
|
|
59621
|
+
}
|
|
59622
|
+
else if (typeof apiResponse === 'object') {
|
|
59623
|
+
if (subText?.variable) {
|
|
59624
|
+
const extracted = this.dataService.getValue(apiResponse, subText.variable);
|
|
59625
|
+
if (extracted) {
|
|
59626
|
+
if (typeof extracted === 'string') {
|
|
59627
|
+
imageStr = extracted;
|
|
59628
|
+
}
|
|
59629
|
+
else if (extracted?.content?.data) {
|
|
59630
|
+
this.processImageApiResponse(extracted, ques, cacheKey, subText, resolve);
|
|
59631
|
+
return;
|
|
59632
|
+
}
|
|
59633
|
+
}
|
|
59634
|
+
}
|
|
59635
|
+
if (!imageStr) {
|
|
59636
|
+
imageStr =
|
|
59637
|
+
apiResponse.imageData ||
|
|
59638
|
+
apiResponse.base64 ||
|
|
59639
|
+
apiResponse.doc ||
|
|
59640
|
+
apiResponse.file ||
|
|
59641
|
+
apiResponse.url ||
|
|
59642
|
+
apiResponse.sas_url ||
|
|
59643
|
+
apiResponse.data ||
|
|
59644
|
+
'';
|
|
59645
|
+
}
|
|
59646
|
+
}
|
|
59647
|
+
if (imageStr && typeof imageStr === 'string') {
|
|
59648
|
+
const trimmed = imageStr.trim();
|
|
59649
|
+
if (trimmed.startsWith('data:image/') ||
|
|
59650
|
+
trimmed.startsWith('http://') ||
|
|
59651
|
+
trimmed.startsWith('https://') ||
|
|
59652
|
+
trimmed.startsWith('blob:')) {
|
|
59653
|
+
ques.imageData = trimmed;
|
|
59654
|
+
}
|
|
59655
|
+
else if (this.isRawBase64(trimmed)) {
|
|
59656
|
+
ques.imageData = `data:image/png;base64,${trimmed}`;
|
|
59657
|
+
}
|
|
59658
|
+
else {
|
|
59659
|
+
ques.imageData = trimmed;
|
|
59660
|
+
}
|
|
59661
|
+
ques.orgImageData = ques.imageData;
|
|
59662
|
+
if (cacheKey) {
|
|
59663
|
+
this.imageCache[cacheKey] = ques.imageData;
|
|
59664
|
+
delete this.inFlightImageRequests[cacheKey];
|
|
59665
|
+
}
|
|
59666
|
+
this.cdr.markForCheck();
|
|
59667
|
+
if (resolve)
|
|
59668
|
+
resolve(ques.imageData);
|
|
59669
|
+
}
|
|
59670
|
+
else {
|
|
59671
|
+
if (cacheKey)
|
|
59672
|
+
delete this.inFlightImageRequests[cacheKey];
|
|
59673
|
+
if (resolve)
|
|
59674
|
+
resolve('');
|
|
59675
|
+
}
|
|
59676
|
+
}
|
|
59677
|
+
isRawBase64(str) {
|
|
59678
|
+
if (!str || str.length < 50)
|
|
59679
|
+
return false;
|
|
59680
|
+
return /^[A-Za-z0-9+/=\r\n\s]+$/.test(str);
|
|
59681
|
+
}
|
|
59469
59682
|
async onImageEdit(ques) {
|
|
59470
59683
|
this.isImageEdit = true;
|
|
59471
59684
|
this.selectedImageElement = ques;
|
|
@@ -60426,7 +60639,7 @@ const VERSION = {
|
|
|
60426
60639
|
"semver": null,
|
|
60427
60640
|
"suffix": "ed0865a9-dirty",
|
|
60428
60641
|
"semverString": null,
|
|
60429
|
-
"version": "2.1.
|
|
60642
|
+
"version": "2.1.362"
|
|
60430
60643
|
};
|
|
60431
60644
|
/* tslint:enable */
|
|
60432
60645
|
|