mis-crystal-design-system 18.1.4-signal → 18.1.4
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/datepicker_v2/tz-dp-container/tz-dp-container.component.d.ts +4 -0
- package/daterangepicker_v2/tz-drp-container/tz-drp-container.component.d.ts +14 -5
- package/esm2022/checkbox/checkbox.component.mjs +4 -4
- package/esm2022/chip/chip.component.mjs +4 -4
- package/esm2022/datepicker_v2/tz-datepicker.directive.mjs +2 -34
- package/esm2022/datepicker_v2/tz-dp-container/tz-dp-container.component.mjs +87 -32
- package/esm2022/daterangepicker_v2/tz-daterangepicker.directive.mjs +6 -3
- package/esm2022/daterangepicker_v2/tz-drp-container/tz-drp-container.component.mjs +324 -142
- package/esm2022/drawer/drawer-body/drawer-body.component.mjs +4 -4
- package/esm2022/fab/fab.component.mjs +4 -4
- package/esm2022/filter/filter-panel/filter-panel.component.mjs +28 -27
- package/esm2022/input/mis-input.component.mjs +3 -11
- package/esm2022/loader/loader.component.mjs +13 -7
- package/esm2022/modal/module-wrapper/module-wrapper.component.mjs +4 -4
- package/esm2022/multi-select-dropdown/multi-select-dropdown.component.mjs +10 -5
- package/esm2022/phone-input/phone-input.component.mjs +4 -4
- package/esm2022/radio-button/radio-button.component.mjs +4 -4
- package/esm2022/ske-loader/ske-loader.component.mjs +4 -4
- package/esm2022/slider/slider.component.mjs +4 -4
- package/esm2022/snackbar/snackbar/snackbar.component.mjs +4 -4
- package/esm2022/specificdatepicker/tz-sdp-container/tz-sdp-container.component.mjs +23 -19
- package/esm2022/switch/switch.component.mjs +2 -4
- package/esm2022/table/sub-table/sub-table.component.mjs +18 -5
- package/esm2022/table/table.component.mjs +184 -95
- package/esm2022/table/table.module.mjs +7 -5
- package/esm2022/toast/toast.component.mjs +4 -4
- package/esm2022/tooltip/tooltip-container/tooltip.component.mjs +4 -4
- package/esm2022/virtual-scroll/virtual-scroll.component.mjs +4 -4
- package/fesm2022/mis-crystal-design-system-checkbox.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-checkbox.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-chip.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-chip.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-datepicker_v2.mjs +87 -64
- package/fesm2022/mis-crystal-design-system-datepicker_v2.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-daterangepicker_v2.mjs +328 -143
- package/fesm2022/mis-crystal-design-system-daterangepicker_v2.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-drawer.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-drawer.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-fab.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-fab.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-filter.mjs +27 -26
- package/fesm2022/mis-crystal-design-system-filter.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-input.mjs +2 -10
- package/fesm2022/mis-crystal-design-system-input.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-loader.mjs +12 -6
- package/fesm2022/mis-crystal-design-system-loader.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-modal.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-modal.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-multi-select-dropdown.mjs +9 -4
- package/fesm2022/mis-crystal-design-system-multi-select-dropdown.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-phone-input.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-phone-input.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-radio-button.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-radio-button.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-ske-loader.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-ske-loader.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-slider.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-slider.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-snackbar.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-snackbar.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-specificdatepicker.mjs +22 -18
- package/fesm2022/mis-crystal-design-system-specificdatepicker.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-switch.mjs +1 -3
- package/fesm2022/mis-crystal-design-system-switch.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-table.mjs +205 -102
- package/fesm2022/mis-crystal-design-system-table.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-toast.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-toast.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-tooltip.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-tooltip.mjs.map +1 -1
- package/fesm2022/mis-crystal-design-system-virtual-scroll.mjs +3 -3
- package/fesm2022/mis-crystal-design-system-virtual-scroll.mjs.map +1 -1
- package/filter/filter-panel/filter-panel.component.d.ts +1 -1
- package/input/mis-input.component.scss +2 -3
- package/loader/loader.component.d.ts +7 -1
- package/package.json +19 -19
- package/specificdatepicker/tz-sdp-container/tz-sdp-container.component.d.ts +2 -2
- package/table/table.component.d.ts +12 -1
- package/table/table.module.d.ts +2 -1
|
@@ -276,6 +276,57 @@ dayjs.extend(customParseFormat);
|
|
|
276
276
|
dayjs.extend(isSameOrAfter);
|
|
277
277
|
dayjs.extend(isSameOrBefore);
|
|
278
278
|
class TzDpContainerComponent {
|
|
279
|
+
/**
|
|
280
|
+
* Parse date string using configured format with fallback
|
|
281
|
+
*/
|
|
282
|
+
parseDateWithMultipleFormats(dateString) {
|
|
283
|
+
if (!dateString || dateString === 'Invalid Date' || dateString === 'undefined' || dateString === 'null') {
|
|
284
|
+
return dayjs('invalid');
|
|
285
|
+
}
|
|
286
|
+
// First try the configured format
|
|
287
|
+
const configuredFormat = this.data?.dpConfig?.format;
|
|
288
|
+
if (configuredFormat) {
|
|
289
|
+
try {
|
|
290
|
+
const parsed = this.parseZoneInstance(dateString, configuredFormat);
|
|
291
|
+
if (parsed.isValid()) {
|
|
292
|
+
return parsed;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
// Continue to fallback formats
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Fallback to common formats if configured format fails
|
|
300
|
+
const fallbackFormats = [
|
|
301
|
+
'DD/MMM/YYYY',
|
|
302
|
+
'DD/MM/YYYY',
|
|
303
|
+
'DD-MMM-YYYY',
|
|
304
|
+
'DD-MM-YYYY',
|
|
305
|
+
'YYYY-MM-DD'
|
|
306
|
+
];
|
|
307
|
+
for (const format of fallbackFormats) {
|
|
308
|
+
try {
|
|
309
|
+
const parsed = this.parseZoneInstance(dateString, format);
|
|
310
|
+
if (parsed.isValid()) {
|
|
311
|
+
return parsed;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
// Continue to next format
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// If all formats fail, try parsing without format (let dayjs guess)
|
|
319
|
+
try {
|
|
320
|
+
const parsed = this.parseZoneInstance(dateString);
|
|
321
|
+
if (parsed.isValid()) {
|
|
322
|
+
return parsed;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
console.warn('Failed to parse date with any format:', dateString, error);
|
|
327
|
+
}
|
|
328
|
+
return dayjs('invalid');
|
|
329
|
+
}
|
|
279
330
|
constructor(data, toast) {
|
|
280
331
|
this.toast = toast;
|
|
281
332
|
this.parseZoneInstance = (...args) => {
|
|
@@ -514,7 +565,7 @@ class TzDpContainerComponent {
|
|
|
514
565
|
currentDateInstance() {
|
|
515
566
|
try {
|
|
516
567
|
if (this.data.date) {
|
|
517
|
-
const selectedDate =
|
|
568
|
+
const selectedDate = this.parseDateWithMultipleFormats(this.data.date);
|
|
518
569
|
if (selectedDate.isValid()) {
|
|
519
570
|
this.selectedYearSignal.set(selectedDate.year());
|
|
520
571
|
this.currentYearNumberSignal.set(selectedDate.year());
|
|
@@ -621,7 +672,7 @@ class TzDpContainerComponent {
|
|
|
621
672
|
let maxDate = null;
|
|
622
673
|
if (this.data.dpConfig.minDate) {
|
|
623
674
|
try {
|
|
624
|
-
minDate = this.
|
|
675
|
+
minDate = this.parseDateWithMultipleFormats(this.data.dpConfig.minDate);
|
|
625
676
|
}
|
|
626
677
|
catch (error) {
|
|
627
678
|
// Silently handle min date parsing error
|
|
@@ -629,7 +680,7 @@ class TzDpContainerComponent {
|
|
|
629
680
|
}
|
|
630
681
|
if (this.data.dpConfig.maxDate) {
|
|
631
682
|
try {
|
|
632
|
-
maxDate = this.
|
|
683
|
+
maxDate = this.parseDateWithMultipleFormats(this.data.dpConfig.maxDate);
|
|
633
684
|
}
|
|
634
685
|
catch (error) {
|
|
635
686
|
// Silently handle max date parsing error
|
|
@@ -647,38 +698,42 @@ class TzDpContainerComponent {
|
|
|
647
698
|
isDisabledDay = maxDate.isBefore(date, "day");
|
|
648
699
|
}
|
|
649
700
|
const currentDateInstance = this.parseZoneInstance().year(currentYearNumber).month(month).date(currentDate);
|
|
650
|
-
|
|
701
|
+
// Only mark as current day if it's not disabled
|
|
702
|
+
const isCurrentDay = !isDisabledDay && currentDateInstance.format(this.data.dpConfig.format) === dayjs().format(this.data.dpConfig.format);
|
|
651
703
|
let isSelectedDay = false;
|
|
652
|
-
//
|
|
653
|
-
if (
|
|
654
|
-
|
|
655
|
-
this.localSelectedDateSignal()
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
if
|
|
663
|
-
|
|
664
|
-
if (
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
// For date-only format, compare the date parts only
|
|
670
|
-
const selectedDate = this.parseZoneInstance(this.data.date, this.data.dpConfig.format);
|
|
671
|
-
if (selectedDate.isValid()) {
|
|
672
|
-
isSelectedDay = selectedDate.isSame(currentDateInstance, 'day');
|
|
704
|
+
// Only set selected day if the date is not disabled
|
|
705
|
+
if (!isDisabledDay) {
|
|
706
|
+
// Prioritize current selection over previously applied date
|
|
707
|
+
if (this.localSelectedDateSignal() &&
|
|
708
|
+
this.localSelectedDateSignal().date === currentDate &&
|
|
709
|
+
this.localSelectedDateSignal().month === month &&
|
|
710
|
+
this.localSelectedDateSignal().year === currentYearNumber) {
|
|
711
|
+
isSelectedDay = true;
|
|
712
|
+
}
|
|
713
|
+
else if (this.data.date && !this.localSelectedDateSignal()) {
|
|
714
|
+
// Only check previously applied date if no current selection
|
|
715
|
+
try {
|
|
716
|
+
if (this.data.dpConfig.enableTime) {
|
|
717
|
+
const selectedDate = this.parseDateWithMultipleFormats(this.data.date);
|
|
718
|
+
if (selectedDate.isValid()) {
|
|
719
|
+
isSelectedDay = selectedDate.isSame(currentDateInstance, 'day');
|
|
720
|
+
}
|
|
673
721
|
}
|
|
674
722
|
else {
|
|
675
|
-
//
|
|
676
|
-
|
|
723
|
+
// For date-only format, compare the date parts only
|
|
724
|
+
const selectedDate = this.parseDateWithMultipleFormats(this.data.date);
|
|
725
|
+
if (selectedDate.isValid()) {
|
|
726
|
+
isSelectedDay = selectedDate.isSame(currentDateInstance, 'day');
|
|
727
|
+
}
|
|
728
|
+
else {
|
|
729
|
+
// Fallback to string comparison if parsing fails
|
|
730
|
+
isSelectedDay = dateString === this.data.date;
|
|
731
|
+
}
|
|
677
732
|
}
|
|
678
733
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
734
|
+
catch (error) {
|
|
735
|
+
// Silently handle date comparison error
|
|
736
|
+
}
|
|
682
737
|
}
|
|
683
738
|
}
|
|
684
739
|
dates.push({
|
|
@@ -768,7 +823,7 @@ class TzDpContainerComponent {
|
|
|
768
823
|
// Force calendar re-render to show highlighting
|
|
769
824
|
this.currentMonthDatesSignal.set(this.generateDates(this.currentMonthNumberSignal(), this.currentYearNumberSignal()));
|
|
770
825
|
// Automatically apply when neither time nor apply button is enabled, otherwise wait for user action
|
|
771
|
-
if (!this.data.dpConfig.
|
|
826
|
+
if (!this.data.dpConfig.showApplyButton && !this.data.dpConfig.enableTime) {
|
|
772
827
|
this.applyDate(day);
|
|
773
828
|
}
|
|
774
829
|
}
|
|
@@ -972,40 +1027,8 @@ class TzDatepickerDirective {
|
|
|
972
1027
|
this.close();
|
|
973
1028
|
}
|
|
974
1029
|
}, { allowSignalWrites: true });
|
|
975
|
-
// Effect to sync selectedDate with input value
|
|
976
|
-
effect(() => {
|
|
977
|
-
const date = this.selectedDate();
|
|
978
|
-
const element = this.element.nativeElement;
|
|
979
|
-
// Clear the value if date is empty/null/undefined
|
|
980
|
-
if (!date) {
|
|
981
|
-
element.value = '';
|
|
982
|
-
if (this.control?.control) {
|
|
983
|
-
this.control.control.setValue('', { emitEvent: false });
|
|
984
|
-
}
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
// Set the value and trigger input event to ensure mis-input updates
|
|
988
|
-
element.value = date;
|
|
989
|
-
element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
990
|
-
if (this.control?.control) {
|
|
991
|
-
this.control.control.setValue(date, { emitEvent: false });
|
|
992
|
-
}
|
|
993
|
-
});
|
|
994
|
-
}
|
|
995
|
-
ngOnInit() {
|
|
996
|
-
// Handle initial value
|
|
997
|
-
const element = this.element.nativeElement;
|
|
998
|
-
const initialValue = element.value || this.selectedDate();
|
|
999
|
-
if (initialValue) {
|
|
1000
|
-
// Set initial value and trigger input event
|
|
1001
|
-
element.value = initialValue;
|
|
1002
|
-
element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1003
|
-
// Update control if available
|
|
1004
|
-
if (this.control?.control) {
|
|
1005
|
-
this.control.control.setValue(initialValue, { emitEvent: false });
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
1030
|
}
|
|
1031
|
+
ngOnInit() { }
|
|
1009
1032
|
toggleDatePicker() {
|
|
1010
1033
|
if (this.isOpen()) {
|
|
1011
1034
|
this.close();
|