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
|
@@ -2357,37 +2357,27 @@ class ZComponentService {
|
|
|
2357
2357
|
}
|
|
2358
2358
|
return obsList;
|
|
2359
2359
|
}
|
|
2360
|
-
localizeDateTimeByIgnoringTimeZone(value,
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
}
|
|
2382
|
-
removeTimeZoneAndConvertToISOString(value) {
|
|
2383
|
-
const result = value.split('+')[0];
|
|
2384
|
-
return new Date(result.endsWith('Z') ? result : `${result}Z`).toISOString();
|
|
2385
|
-
}
|
|
2386
|
-
convertOffsetMinToHour(num) {
|
|
2387
|
-
num = -num;
|
|
2388
|
-
const prefix = num.toString().startsWith('-') ? '-' : '+';
|
|
2389
|
-
const result = `${(Math.abs(num) / 60).toString().padStart(2, '0')}:00`;
|
|
2390
|
-
return `${prefix}${result}`;
|
|
2360
|
+
localizeDateTimeByIgnoringTimeZone(value, field) {
|
|
2361
|
+
// Support both string and Date inputs
|
|
2362
|
+
const originalDate = value instanceof Date ? new Date(value.getTime()) : new Date(value);
|
|
2363
|
+
// Case 1: time / datetime fields → keep wall-clock time stable
|
|
2364
|
+
if (this.timePickerDateType.includes(field.Type)) {
|
|
2365
|
+
const adjusted = new Date(originalDate);
|
|
2366
|
+
const offsetMinutes = originalDate.getTimezoneOffset();
|
|
2367
|
+
adjusted.setMinutes(originalDate.getMinutes() - offsetMinutes);
|
|
2368
|
+
return adjusted;
|
|
2369
|
+
}
|
|
2370
|
+
// Case 2: month-only (zshortdate) → year+month, day fixed to 1
|
|
2371
|
+
if (field.Type === 'zshortdate') {
|
|
2372
|
+
return new Date(originalDate.getFullYear(), originalDate.getMonth(), 1, // day
|
|
2373
|
+
0, 0, 0, 0);
|
|
2374
|
+
}
|
|
2375
|
+
// Case 3: normal date-only → keep calendar date stable, ignore time
|
|
2376
|
+
const dateOnly = new Date(originalDate.getFullYear(), originalDate.getMonth(), originalDate.getDate(), 0, 0, 0, 0);
|
|
2377
|
+
const normalizedDate = new Date(dateOnly);
|
|
2378
|
+
const localOffsetMinutes = dateOnly.getTimezoneOffset();
|
|
2379
|
+
normalizedDate.setMinutes(dateOnly.getMinutes() - localOffsetMinutes);
|
|
2380
|
+
return normalizedDate;
|
|
2391
2381
|
}
|
|
2392
2382
|
//#endregion
|
|
2393
2383
|
decrementComponentCounterForField(field) {
|
|
@@ -3598,21 +3588,21 @@ class DateParserFilter {
|
|
|
3598
3588
|
constructor(componentService) {
|
|
3599
3589
|
this.componentService = componentService;
|
|
3600
3590
|
}
|
|
3601
|
-
transform(
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
return value;
|
|
3591
|
+
transform(rawValue, field) {
|
|
3592
|
+
if (!rawValue) {
|
|
3593
|
+
return null;
|
|
3605
3594
|
}
|
|
3606
|
-
// filter items array, items which match and return true will be
|
|
3607
|
-
// kept, false will be filtered out
|
|
3608
3595
|
try {
|
|
3609
|
-
|
|
3610
|
-
|
|
3596
|
+
// For "ignore timezone" fields, normalize via service
|
|
3597
|
+
if (field.IsIgnoreTimeZone) {
|
|
3598
|
+
return this.componentService.localizeDateTimeByIgnoringTimeZone(rawValue, field);
|
|
3611
3599
|
}
|
|
3612
|
-
|
|
3600
|
+
// Otherwise, just convert to Date
|
|
3601
|
+
const inputDate = new Date(rawValue);
|
|
3602
|
+
return inputDate;
|
|
3613
3603
|
}
|
|
3614
3604
|
catch (error) {
|
|
3615
|
-
console.log(
|
|
3605
|
+
console.log('DateParserFilter error:', error);
|
|
3616
3606
|
return null;
|
|
3617
3607
|
}
|
|
3618
3608
|
}
|
|
@@ -7214,12 +7204,13 @@ class ZdatetimeComponent extends InputFieldBase {
|
|
|
7214
7204
|
}
|
|
7215
7205
|
onChange(value) {
|
|
7216
7206
|
const formControl = this.form.controls[this.data.Value];
|
|
7217
|
-
const
|
|
7207
|
+
const dateValue = this.convertDateTimeValueToString(value);
|
|
7218
7208
|
if (formControl) {
|
|
7219
|
-
formControl.setValue(
|
|
7209
|
+
formControl.setValue(dateValue);
|
|
7220
7210
|
formControl.markAsTouched();
|
|
7221
7211
|
}
|
|
7222
|
-
|
|
7212
|
+
// Important: pass Date to base, not ISO string
|
|
7213
|
+
super.onChange(null, dateValue);
|
|
7223
7214
|
}
|
|
7224
7215
|
setMinAndMaxDateRange() {
|
|
7225
7216
|
const minDateGroupValue = ZComponentHelper.getGroupValue(this.data.MinDate, this.group);
|
|
@@ -7239,24 +7230,39 @@ class ZdatetimeComponent extends InputFieldBase {
|
|
|
7239
7230
|
}
|
|
7240
7231
|
}
|
|
7241
7232
|
convertDateTimeValueToString(value) {
|
|
7242
|
-
if (value
|
|
7233
|
+
if (value === undefined || value === null) {
|
|
7243
7234
|
return undefined;
|
|
7244
7235
|
}
|
|
7245
|
-
const
|
|
7236
|
+
const inputDate = new Date(value);
|
|
7237
|
+
// zshortdate → normalize to first day of month
|
|
7246
7238
|
if (this.data.Type === 'zshortdate') {
|
|
7247
|
-
|
|
7239
|
+
const monthStart = new Date(inputDate);
|
|
7240
|
+
monthStart.setDate(1);
|
|
7241
|
+
return monthStart;
|
|
7248
7242
|
}
|
|
7243
|
+
// Ignore timezone: keep same local wall-clock time regardless of browser TZ
|
|
7249
7244
|
if (this.data.IsIgnoreTimeZone) {
|
|
7250
|
-
|
|
7251
|
-
valueDate.setMinutes(valueDate.getMinutes() + (-timezoneOffSet));
|
|
7252
|
-
return valueDate.toISOString();
|
|
7245
|
+
return this.adjustForIgnoreTimeZone(inputDate);
|
|
7253
7246
|
}
|
|
7247
|
+
// For non-time types -> date-only
|
|
7254
7248
|
if (!['zuidatetime', 'ztime', 'zuitime'].includes(this.data.Type)) {
|
|
7255
|
-
return
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
return this.parseAnyValueToDate(value).toISOString();
|
|
7249
|
+
// Assuming these helpers already return Date
|
|
7250
|
+
const dateOnly = this.parseAnyValueToDateOnly(inputDate);
|
|
7251
|
+
return dateOnly;
|
|
7259
7252
|
}
|
|
7253
|
+
// For datetime/time types -> full datetime
|
|
7254
|
+
const dateTime = this.parseAnyValueToDate(inputDate);
|
|
7255
|
+
return dateTime;
|
|
7256
|
+
}
|
|
7257
|
+
/**
|
|
7258
|
+
* Adjusts a Date so that its wall-clock time stays the same
|
|
7259
|
+
* when ignoring the browser timezone.
|
|
7260
|
+
*/
|
|
7261
|
+
adjustForIgnoreTimeZone(date) {
|
|
7262
|
+
const adjustedDate = new Date(date);
|
|
7263
|
+
const timezoneOffsetMinutes = adjustedDate.getTimezoneOffset();
|
|
7264
|
+
adjustedDate.setMinutes(adjustedDate.getMinutes() - timezoneOffsetMinutes);
|
|
7265
|
+
return adjustedDate;
|
|
7260
7266
|
}
|
|
7261
7267
|
parseAnyValueToDate(value) {
|
|
7262
7268
|
return new Date(value instanceof Date ? value : new Date(value));
|
|
@@ -11809,7 +11815,7 @@ class ZreportComponent extends FieldBase {
|
|
|
11809
11815
|
this.onPrintBegin = this.printBegin.bind(this);
|
|
11810
11816
|
this.onPrintEnd = this.printEnd.bind(this);
|
|
11811
11817
|
super.initComponent().subscribe(() => {
|
|
11812
|
-
this.serviceUrl = this.resourceApiService.getURL(this.data.ResourceURL);
|
|
11818
|
+
this.serviceUrl = this.zcoreService.normalizeUrl(this.resourceApiService.getURL(this.data.ResourceURL));
|
|
11813
11819
|
if (!this.serviceUrl) {
|
|
11814
11820
|
console.log("resourceURL is empty.");
|
|
11815
11821
|
}
|