mmhglobal-dynamicform 2.41.4 → 2.42.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/README.md +8 -0
- package/esm2020/lib/services/zcomponent.service.mjs +22 -32
- package/esm2020/lib/zdatetime/dateParser.pipe.mjs +11 -11
- package/esm2020/lib/zdatetime/zdatetime.component.mjs +30 -14
- package/esm2020/lib/zreport/zreport.component.mjs +2 -2
- package/fesm2015/mmhglobal-dynamicform.mjs +61 -55
- package/fesm2015/mmhglobal-dynamicform.mjs.map +1 -1
- package/fesm2020/mmhglobal-dynamicform.mjs +61 -55
- package/fesm2020/mmhglobal-dynamicform.mjs.map +1 -1
- package/lib/services/zcomponent.service.d.ts +1 -3
- package/lib/zdatetime/dateParser.pipe.d.ts +1 -1
- package/lib/zdatetime/zdatetime.component.d.ts +5 -0
- package/package.json +1 -1
|
@@ -2376,37 +2376,27 @@ class ZComponentService {
|
|
|
2376
2376
|
}
|
|
2377
2377
|
return obsList;
|
|
2378
2378
|
}
|
|
2379
|
-
localizeDateTimeByIgnoringTimeZone(value,
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
}
|
|
2401
|
-
removeTimeZoneAndConvertToISOString(value) {
|
|
2402
|
-
const result = value.split('+')[0];
|
|
2403
|
-
return new Date(result.endsWith('Z') ? result : `${result}Z`).toISOString();
|
|
2404
|
-
}
|
|
2405
|
-
convertOffsetMinToHour(num) {
|
|
2406
|
-
num = -num;
|
|
2407
|
-
const prefix = num.toString().startsWith('-') ? '-' : '+';
|
|
2408
|
-
const result = `${(Math.abs(num) / 60).toString().padStart(2, '0')}:00`;
|
|
2409
|
-
return `${prefix}${result}`;
|
|
2379
|
+
localizeDateTimeByIgnoringTimeZone(value, field) {
|
|
2380
|
+
// Support both string and Date inputs
|
|
2381
|
+
const originalDate = value instanceof Date ? new Date(value.getTime()) : new Date(value);
|
|
2382
|
+
// Case 1: time / datetime fields → keep wall-clock time stable
|
|
2383
|
+
if (this.timePickerDateType.includes(field.Type)) {
|
|
2384
|
+
const adjusted = new Date(originalDate);
|
|
2385
|
+
const offsetMinutes = originalDate.getTimezoneOffset();
|
|
2386
|
+
adjusted.setMinutes(originalDate.getMinutes() - offsetMinutes);
|
|
2387
|
+
return adjusted;
|
|
2388
|
+
}
|
|
2389
|
+
// Case 2: month-only (zshortdate) → year+month, day fixed to 1
|
|
2390
|
+
if (field.Type === 'zshortdate') {
|
|
2391
|
+
return new Date(originalDate.getFullYear(), originalDate.getMonth(), 1, // day
|
|
2392
|
+
0, 0, 0, 0);
|
|
2393
|
+
}
|
|
2394
|
+
// Case 3: normal date-only → keep calendar date stable, ignore time
|
|
2395
|
+
const dateOnly = new Date(originalDate.getFullYear(), originalDate.getMonth(), originalDate.getDate(), 0, 0, 0, 0);
|
|
2396
|
+
const normalizedDate = new Date(dateOnly);
|
|
2397
|
+
const localOffsetMinutes = dateOnly.getTimezoneOffset();
|
|
2398
|
+
normalizedDate.setMinutes(dateOnly.getMinutes() - localOffsetMinutes);
|
|
2399
|
+
return normalizedDate;
|
|
2410
2400
|
}
|
|
2411
2401
|
//#endregion
|
|
2412
2402
|
decrementComponentCounterForField(field) {
|
|
@@ -3625,21 +3615,21 @@ class DateParserFilter {
|
|
|
3625
3615
|
constructor(componentService) {
|
|
3626
3616
|
this.componentService = componentService;
|
|
3627
3617
|
}
|
|
3628
|
-
transform(
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
return value;
|
|
3618
|
+
transform(rawValue, field) {
|
|
3619
|
+
if (!rawValue) {
|
|
3620
|
+
return null;
|
|
3632
3621
|
}
|
|
3633
|
-
// filter items array, items which match and return true will be
|
|
3634
|
-
// kept, false will be filtered out
|
|
3635
3622
|
try {
|
|
3636
|
-
|
|
3637
|
-
|
|
3623
|
+
// For "ignore timezone" fields, normalize via service
|
|
3624
|
+
if (field.IsIgnoreTimeZone) {
|
|
3625
|
+
return this.componentService.localizeDateTimeByIgnoringTimeZone(rawValue, field);
|
|
3638
3626
|
}
|
|
3639
|
-
|
|
3627
|
+
// Otherwise, just convert to Date
|
|
3628
|
+
const inputDate = new Date(rawValue);
|
|
3629
|
+
return inputDate;
|
|
3640
3630
|
}
|
|
3641
3631
|
catch (error) {
|
|
3642
|
-
console.log(
|
|
3632
|
+
console.log('DateParserFilter error:', error);
|
|
3643
3633
|
return null;
|
|
3644
3634
|
}
|
|
3645
3635
|
}
|
|
@@ -7252,12 +7242,13 @@ class ZdatetimeComponent extends InputFieldBase {
|
|
|
7252
7242
|
}
|
|
7253
7243
|
onChange(value) {
|
|
7254
7244
|
const formControl = this.form.controls[this.data.Value];
|
|
7255
|
-
const
|
|
7245
|
+
const dateValue = this.convertDateTimeValueToString(value);
|
|
7256
7246
|
if (formControl) {
|
|
7257
|
-
formControl.setValue(
|
|
7247
|
+
formControl.setValue(dateValue);
|
|
7258
7248
|
formControl.markAsTouched();
|
|
7259
7249
|
}
|
|
7260
|
-
|
|
7250
|
+
// Important: pass Date to base, not ISO string
|
|
7251
|
+
super.onChange(null, dateValue);
|
|
7261
7252
|
}
|
|
7262
7253
|
setMinAndMaxDateRange() {
|
|
7263
7254
|
const minDateGroupValue = ZComponentHelper.getGroupValue(this.data.MinDate, this.group);
|
|
@@ -7277,24 +7268,39 @@ class ZdatetimeComponent extends InputFieldBase {
|
|
|
7277
7268
|
}
|
|
7278
7269
|
}
|
|
7279
7270
|
convertDateTimeValueToString(value) {
|
|
7280
|
-
if (value
|
|
7271
|
+
if (value === undefined || value === null) {
|
|
7281
7272
|
return undefined;
|
|
7282
7273
|
}
|
|
7283
|
-
const
|
|
7274
|
+
const inputDate = new Date(value);
|
|
7275
|
+
// zshortdate → normalize to first day of month
|
|
7284
7276
|
if (this.data.Type === 'zshortdate') {
|
|
7285
|
-
|
|
7277
|
+
const monthStart = new Date(inputDate);
|
|
7278
|
+
monthStart.setDate(1);
|
|
7279
|
+
return monthStart;
|
|
7286
7280
|
}
|
|
7281
|
+
// Ignore timezone: keep same local wall-clock time regardless of browser TZ
|
|
7287
7282
|
if (this.data.IsIgnoreTimeZone) {
|
|
7288
|
-
|
|
7289
|
-
valueDate.setMinutes(valueDate.getMinutes() + (-timezoneOffSet));
|
|
7290
|
-
return valueDate.toISOString();
|
|
7283
|
+
return this.adjustForIgnoreTimeZone(inputDate);
|
|
7291
7284
|
}
|
|
7285
|
+
// For non-time types -> date-only
|
|
7292
7286
|
if (!['zuidatetime', 'ztime', 'zuitime'].includes(this.data.Type)) {
|
|
7293
|
-
return
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
return this.parseAnyValueToDate(value).toISOString();
|
|
7287
|
+
// Assuming these helpers already return Date
|
|
7288
|
+
const dateOnly = this.parseAnyValueToDateOnly(inputDate);
|
|
7289
|
+
return dateOnly;
|
|
7297
7290
|
}
|
|
7291
|
+
// For datetime/time types -> full datetime
|
|
7292
|
+
const dateTime = this.parseAnyValueToDate(inputDate);
|
|
7293
|
+
return dateTime;
|
|
7294
|
+
}
|
|
7295
|
+
/**
|
|
7296
|
+
* Adjusts a Date so that its wall-clock time stays the same
|
|
7297
|
+
* when ignoring the browser timezone.
|
|
7298
|
+
*/
|
|
7299
|
+
adjustForIgnoreTimeZone(date) {
|
|
7300
|
+
const adjustedDate = new Date(date);
|
|
7301
|
+
const timezoneOffsetMinutes = adjustedDate.getTimezoneOffset();
|
|
7302
|
+
adjustedDate.setMinutes(adjustedDate.getMinutes() - timezoneOffsetMinutes);
|
|
7303
|
+
return adjustedDate;
|
|
7298
7304
|
}
|
|
7299
7305
|
parseAnyValueToDate(value) {
|
|
7300
7306
|
return new Date(value instanceof Date ? value : new Date(value));
|
|
@@ -11854,7 +11860,7 @@ class ZreportComponent extends FieldBase {
|
|
|
11854
11860
|
this.onPrintBegin = this.printBegin.bind(this);
|
|
11855
11861
|
this.onPrintEnd = this.printEnd.bind(this);
|
|
11856
11862
|
super.initComponent().subscribe(() => {
|
|
11857
|
-
this.serviceUrl = this.resourceApiService.getURL(this.data.ResourceURL);
|
|
11863
|
+
this.serviceUrl = this.zcoreService.normalizeUrl(this.resourceApiService.getURL(this.data.ResourceURL));
|
|
11858
11864
|
if (!this.serviceUrl) {
|
|
11859
11865
|
console.log("resourceURL is empty.");
|
|
11860
11866
|
}
|