@rangertechnologies/ngnxt 2.1.313-beta.1 → 2.1.313-beta.3
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/rangertechnologies-ngnxt.mjs +66 -37
- package/fesm2022/rangertechnologies-ngnxt.mjs.map +1 -1
- package/lib/pipe/NxtDate.pipe.d.ts +2 -1
- package/lib/services/pdf-designer/pdf-designer.service.d.ts +0 -1
- package/package.json +1 -1
- package/rangertechnologies-ngnxt-2.1.313-beta.3.tgz +0 -0
- package/rangertechnologies-ngnxt-2.1.313-beta.1.tgz +0 -0
|
@@ -8,8 +8,6 @@ import { QuillEditorComponent } from 'ngx-quill';
|
|
|
8
8
|
import Quill from 'quill';
|
|
9
9
|
import { Mention } from 'quill-mention';
|
|
10
10
|
import ImageResizor from 'quill-image-resizor';
|
|
11
|
-
import moment from 'moment-hijri';
|
|
12
|
-
import 'moment/min/moment-with-locales';
|
|
13
11
|
import * as i1 from '@ng-bootstrap/ng-bootstrap';
|
|
14
12
|
import { NgbDatepickerI18n, NgbDatepickerModule, NgbCalendar, NgbCalendarIslamicUmalqura } from '@ng-bootstrap/ng-bootstrap';
|
|
15
13
|
import * as i1$1 from '@angular/common/http';
|
|
@@ -67,20 +65,27 @@ class ErrorWrapper {
|
|
|
67
65
|
errorDetails;
|
|
68
66
|
}
|
|
69
67
|
|
|
68
|
+
// import moment from 'moment-hijri';
|
|
69
|
+
// import 'moment/locale/ar-sa';
|
|
70
|
+
// import 'moment/locale/en-gb';
|
|
70
71
|
class NxtDatePipe {
|
|
71
72
|
transform(value, typeOrFormat, languageCode = 'en', dateFormatType = 'gregorian') {
|
|
72
73
|
if (!value)
|
|
73
74
|
return '';
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const date = dateFormatType === 'hijri'
|
|
77
|
-
? moment(value, 'YYYY-MM-DDTHH:mm', true)
|
|
78
|
-
: moment(value);
|
|
79
|
-
if (!date.isValid())
|
|
75
|
+
const isDate = value;
|
|
76
|
+
if (!isDate.isValid()) {
|
|
80
77
|
return '';
|
|
78
|
+
}
|
|
79
|
+
const locale = languageCode === 'ar' ? 'ar-SA' : 'en';
|
|
80
|
+
// SKS29OCT25 Parse input date depending on Hijri or Gregorian
|
|
81
|
+
const date = dateFormatType === 'hijri'
|
|
82
|
+
? value
|
|
83
|
+
: value;
|
|
84
|
+
// SKS29OCT25 Detect if first arg is a type or a format
|
|
81
85
|
const isKnownType = ['date', 'datetime', 'month', 'time'].includes(typeOrFormat || '');
|
|
82
86
|
const type = isKnownType ? typeOrFormat : undefined;
|
|
83
87
|
const formatArg = !isKnownType ? typeOrFormat : undefined;
|
|
88
|
+
// SKS29OCT25 Step 1: Default format based on type
|
|
84
89
|
let format = '';
|
|
85
90
|
switch (type) {
|
|
86
91
|
case 'date':
|
|
@@ -96,33 +101,50 @@ class NxtDatePipe {
|
|
|
96
101
|
format = 'HH:mm';
|
|
97
102
|
break;
|
|
98
103
|
default:
|
|
104
|
+
// SKS29OCT25 Step 2: Angular-like or custom format
|
|
99
105
|
format = this.mapAngularFormat(formatArg || 'medium', dateFormatType);
|
|
100
106
|
}
|
|
101
107
|
let output = date.format(format);
|
|
108
|
+
// SKS14AUG25 Convert to Arabic numerals if needed
|
|
102
109
|
if (languageCode === 'ar') {
|
|
103
110
|
output = this.toArabicNumbers(output);
|
|
104
111
|
}
|
|
105
112
|
return output;
|
|
106
113
|
}
|
|
114
|
+
/** SKS29OCT25 Map Angular-style date aliases to Moment formats */
|
|
107
115
|
mapAngularFormat(format, dateFormatType) {
|
|
108
116
|
const isHijri = dateFormatType === 'hijri';
|
|
109
117
|
switch (format) {
|
|
110
|
-
case 'short':
|
|
111
|
-
|
|
112
|
-
case '
|
|
113
|
-
|
|
114
|
-
case '
|
|
115
|
-
|
|
116
|
-
case '
|
|
117
|
-
|
|
118
|
-
case '
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
case 'short':
|
|
119
|
+
return isHijri ? 'iDD/iMM/iYYYY HH:mm' : 'DD/MM/YYYY HH:mm';
|
|
120
|
+
case 'medium':
|
|
121
|
+
return isHijri ? 'iMMM iDD, iYYYY, hh:mm:ss A' : 'MMM DD, YYYY, hh:mm:ss A';
|
|
122
|
+
case 'long':
|
|
123
|
+
return isHijri ? 'iMMMM iDD, iYYYY, hh:mm:ss A' : 'MMMM DD, YYYY, hh:mm:ss A';
|
|
124
|
+
case 'full':
|
|
125
|
+
return isHijri ? 'dddd, iMMMM iDD, iYYYY, hh:mm:ss A' : 'dddd, MMMM DD, YYYY, hh:mm:ss A';
|
|
126
|
+
case 'shortDate':
|
|
127
|
+
return isHijri ? 'iDD/iMM/iYYYY' : 'DD/MM/YYYY';
|
|
128
|
+
case 'mediumDate':
|
|
129
|
+
return isHijri ? 'iMMM iDD, iYYYY' : 'MMM DD, YYYY';
|
|
130
|
+
case 'longDate':
|
|
131
|
+
return isHijri ? 'iMMMM iDD, iYYYY' : 'MMMM DD, YYYY';
|
|
132
|
+
case 'fullDate':
|
|
133
|
+
return isHijri ? 'dddd, iMMMM iDD, iYYYY' : 'dddd, MMMM DD, YYYY';
|
|
134
|
+
case 'shortTime':
|
|
135
|
+
return 'hh:mm A';
|
|
136
|
+
case 'mediumTime':
|
|
137
|
+
return 'hh:mm:ss A';
|
|
138
|
+
case 'mm:ss':
|
|
139
|
+
return 'mm:ss';
|
|
140
|
+
default:
|
|
141
|
+
return format; // Custom Moment-style format
|
|
121
142
|
}
|
|
122
143
|
}
|
|
144
|
+
/** SKS29OCT25 Convert digits to Arabic numerals */
|
|
123
145
|
toArabicNumbers(input) {
|
|
124
|
-
const
|
|
125
|
-
return input.replace(/\d/g, d =>
|
|
146
|
+
const easternArabicNumerals = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
|
|
147
|
+
return input.replace(/\d/g, d => easternArabicNumerals[+d]);
|
|
126
148
|
}
|
|
127
149
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NxtDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
128
150
|
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NxtDatePipe, isStandalone: true, name: "NxtDate" });
|
|
@@ -359,6 +381,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
359
381
|
args: ['dp', { static: false }]
|
|
360
382
|
}] } });
|
|
361
383
|
|
|
384
|
+
// import moment from 'moment-hijri';
|
|
362
385
|
class DataService {
|
|
363
386
|
http;
|
|
364
387
|
apiUrl;
|
|
@@ -472,15 +495,15 @@ class DataService {
|
|
|
472
495
|
let hijriMoment;
|
|
473
496
|
if (typeof date === 'string') {
|
|
474
497
|
//SKS7AUG25 Handle string input
|
|
475
|
-
hijriMoment =
|
|
498
|
+
hijriMoment = date;
|
|
476
499
|
}
|
|
477
500
|
else if (date instanceof Date) {
|
|
478
501
|
//SKS7AUG25 Handle native Date object
|
|
479
|
-
hijriMoment =
|
|
502
|
+
hijriMoment = date;
|
|
480
503
|
}
|
|
481
504
|
else {
|
|
482
505
|
// Fallback (e.g., moment object passed directly)
|
|
483
|
-
hijriMoment =
|
|
506
|
+
hijriMoment = date;
|
|
484
507
|
}
|
|
485
508
|
if (!hijriMoment?.isValid())
|
|
486
509
|
return null;
|
|
@@ -515,7 +538,7 @@ class DataService {
|
|
|
515
538
|
// SKS7AUG25 en numaral to hijri en numaral object
|
|
516
539
|
formatToGregorianString(date, type) {
|
|
517
540
|
const dateStr = `${date.year}-${date.month}-${date.day || 1}`; // Use day=1 if not provided
|
|
518
|
-
const hijriMoment =
|
|
541
|
+
const hijriMoment = dateStr;
|
|
519
542
|
if (date.time && type !== 'month') {
|
|
520
543
|
const [hours, minutes] = date.time.split(':').map(Number);
|
|
521
544
|
hijriMoment.set({ hour: hours, minute: minutes });
|
|
@@ -58429,7 +58452,7 @@ const VERSION = {
|
|
|
58429
58452
|
"semver": null,
|
|
58430
58453
|
"suffix": "68a4eb8b-dirty",
|
|
58431
58454
|
"semverString": null,
|
|
58432
|
-
"version": "2.1.313-beta.
|
|
58455
|
+
"version": "2.1.313-beta.3"
|
|
58433
58456
|
};
|
|
58434
58457
|
/* tslint:enable */
|
|
58435
58458
|
|
|
@@ -58720,7 +58743,7 @@ class PdfDesignerService {
|
|
|
58720
58743
|
}
|
|
58721
58744
|
}
|
|
58722
58745
|
intializeBook(pdf) {
|
|
58723
|
-
// - Get the unique id in the pdf
|
|
58746
|
+
// - Get the unique id in the pdf
|
|
58724
58747
|
this.unique_id = Object.keys(pdf)[0];
|
|
58725
58748
|
let tempbook = pdf[this.unique_id];
|
|
58726
58749
|
// SKS28MAR25 update nested pdf QuestionsMap
|
|
@@ -58760,7 +58783,7 @@ class PdfDesignerService {
|
|
|
58760
58783
|
'title': 'Untitled',
|
|
58761
58784
|
};
|
|
58762
58785
|
}
|
|
58763
|
-
// AP 26FEB25 - clear the form elements
|
|
58786
|
+
// AP 26FEB25 - clear the form elements
|
|
58764
58787
|
clearElements() {
|
|
58765
58788
|
this.pdfElements = [];
|
|
58766
58789
|
this.pdfElementsSubject.next([...this.pdfElements]);
|
|
@@ -59323,20 +59346,22 @@ class PdfDesignerService {
|
|
|
59323
59346
|
this.selectedElementSubject.next({ index: eleIndex });
|
|
59324
59347
|
}
|
|
59325
59348
|
}
|
|
59326
|
-
// SKS12SEP25 date translate function
|
|
59349
|
+
// SKS12SEP25 date translate function
|
|
59327
59350
|
dateTransform(value, type, languageCode, dateFormatType) {
|
|
59328
59351
|
if (!value)
|
|
59329
59352
|
return '';
|
|
59353
|
+
// SKS14AUG25 Case 1: Time only → just convert numbers if Arabic
|
|
59330
59354
|
if (type === 'time') {
|
|
59331
59355
|
return languageCode === 'ar' ? this.toArabicNumbers(value) : value;
|
|
59332
59356
|
}
|
|
59333
|
-
|
|
59334
|
-
|
|
59335
|
-
|
|
59336
|
-
|
|
59337
|
-
|
|
59338
|
-
|
|
59339
|
-
|
|
59357
|
+
// SKS14AUG25 Case 2: Other date types → parse and format
|
|
59358
|
+
let date;
|
|
59359
|
+
if (dateFormatType === 'hijri') {
|
|
59360
|
+
date = value;
|
|
59361
|
+
}
|
|
59362
|
+
else {
|
|
59363
|
+
date = value;
|
|
59364
|
+
}
|
|
59340
59365
|
let format = '';
|
|
59341
59366
|
switch (type) {
|
|
59342
59367
|
case 'date':
|
|
@@ -59350,7 +59375,11 @@ class PdfDesignerService {
|
|
|
59350
59375
|
break;
|
|
59351
59376
|
}
|
|
59352
59377
|
let output = date.format(format);
|
|
59353
|
-
|
|
59378
|
+
// SKS14AUG25 Convert to Arabic numerals if needed
|
|
59379
|
+
if (languageCode === 'ar') {
|
|
59380
|
+
output = this.toArabicNumbers(output);
|
|
59381
|
+
}
|
|
59382
|
+
return output;
|
|
59354
59383
|
}
|
|
59355
59384
|
toArabicNumbers(input) {
|
|
59356
59385
|
const easternArabicNumerals = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
|