mis-crystal-design-system 18.1.5-signal → 18.1.5

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.
Files changed (87) hide show
  1. package/async-search-dropdown/async-dropdown.component.d.ts +44 -3
  2. package/datepicker_v2/tz-dp-container/tz-dp-container.component.d.ts +4 -0
  3. package/daterangepicker_v2/tz-drp-container/tz-drp-container.component.d.ts +14 -5
  4. package/esm2022/async-search-dropdown/async-dropdown.component.mjs +147 -37
  5. package/esm2022/checkbox/checkbox.component.mjs +4 -4
  6. package/esm2022/chip/chip.component.mjs +4 -4
  7. package/esm2022/datepicker_v2/tz-datepicker.directive.mjs +2 -34
  8. package/esm2022/datepicker_v2/tz-dp-container/tz-dp-container.component.mjs +87 -32
  9. package/esm2022/daterangepicker_v2/tz-daterangepicker.directive.mjs +6 -3
  10. package/esm2022/daterangepicker_v2/tz-drp-container/tz-drp-container.component.mjs +324 -142
  11. package/esm2022/drawer/drawer-body/drawer-body.component.mjs +4 -4
  12. package/esm2022/fab/fab.component.mjs +4 -4
  13. package/esm2022/filter/filter-panel/filter-panel.component.mjs +28 -27
  14. package/esm2022/input/mis-input.component.mjs +3 -11
  15. package/esm2022/loader/loader.component.mjs +13 -7
  16. package/esm2022/modal/module-wrapper/module-wrapper.component.mjs +4 -4
  17. package/esm2022/multi-select-dropdown/multi-select-dropdown.component.mjs +10 -5
  18. package/esm2022/phone-input/phone-input.component.mjs +4 -4
  19. package/esm2022/radio-button/radio-button.component.mjs +4 -4
  20. package/esm2022/ske-loader/ske-loader.component.mjs +4 -4
  21. package/esm2022/slider/slider.component.mjs +4 -4
  22. package/esm2022/snackbar/snackbar/snackbar.component.mjs +4 -4
  23. package/esm2022/specificdatepicker/tz-sdp-container/tz-sdp-container.component.mjs +23 -19
  24. package/esm2022/table/sort-icons.directive.mjs +24 -5
  25. package/esm2022/table/sub-table/sub-table.component.mjs +18 -5
  26. package/esm2022/table/table.component.mjs +236 -101
  27. package/esm2022/table/table.module.mjs +7 -5
  28. package/esm2022/timepicker/timepicker.component.mjs +26 -5
  29. package/esm2022/timerangepicker/timerangepicker.component.mjs +22 -16
  30. package/esm2022/toast/toast.component.mjs +4 -4
  31. package/esm2022/tooltip/tooltip-container/tooltip.component.mjs +4 -4
  32. package/esm2022/virtual-scroll/virtual-scroll.component.mjs +4 -4
  33. package/fesm2022/mis-crystal-design-system-async-search-dropdown.mjs +146 -36
  34. package/fesm2022/mis-crystal-design-system-async-search-dropdown.mjs.map +1 -1
  35. package/fesm2022/mis-crystal-design-system-checkbox.mjs +3 -3
  36. package/fesm2022/mis-crystal-design-system-checkbox.mjs.map +1 -1
  37. package/fesm2022/mis-crystal-design-system-chip.mjs +3 -3
  38. package/fesm2022/mis-crystal-design-system-chip.mjs.map +1 -1
  39. package/fesm2022/mis-crystal-design-system-datepicker_v2.mjs +87 -64
  40. package/fesm2022/mis-crystal-design-system-datepicker_v2.mjs.map +1 -1
  41. package/fesm2022/mis-crystal-design-system-daterangepicker_v2.mjs +328 -143
  42. package/fesm2022/mis-crystal-design-system-daterangepicker_v2.mjs.map +1 -1
  43. package/fesm2022/mis-crystal-design-system-drawer.mjs +3 -3
  44. package/fesm2022/mis-crystal-design-system-drawer.mjs.map +1 -1
  45. package/fesm2022/mis-crystal-design-system-fab.mjs +3 -3
  46. package/fesm2022/mis-crystal-design-system-fab.mjs.map +1 -1
  47. package/fesm2022/mis-crystal-design-system-filter.mjs +27 -26
  48. package/fesm2022/mis-crystal-design-system-filter.mjs.map +1 -1
  49. package/fesm2022/mis-crystal-design-system-input.mjs +2 -10
  50. package/fesm2022/mis-crystal-design-system-input.mjs.map +1 -1
  51. package/fesm2022/mis-crystal-design-system-loader.mjs +12 -6
  52. package/fesm2022/mis-crystal-design-system-loader.mjs.map +1 -1
  53. package/fesm2022/mis-crystal-design-system-modal.mjs +3 -3
  54. package/fesm2022/mis-crystal-design-system-modal.mjs.map +1 -1
  55. package/fesm2022/mis-crystal-design-system-multi-select-dropdown.mjs +9 -4
  56. package/fesm2022/mis-crystal-design-system-multi-select-dropdown.mjs.map +1 -1
  57. package/fesm2022/mis-crystal-design-system-phone-input.mjs +3 -3
  58. package/fesm2022/mis-crystal-design-system-phone-input.mjs.map +1 -1
  59. package/fesm2022/mis-crystal-design-system-radio-button.mjs +3 -3
  60. package/fesm2022/mis-crystal-design-system-radio-button.mjs.map +1 -1
  61. package/fesm2022/mis-crystal-design-system-ske-loader.mjs +3 -3
  62. package/fesm2022/mis-crystal-design-system-ske-loader.mjs.map +1 -1
  63. package/fesm2022/mis-crystal-design-system-slider.mjs +3 -3
  64. package/fesm2022/mis-crystal-design-system-slider.mjs.map +1 -1
  65. package/fesm2022/mis-crystal-design-system-snackbar.mjs +3 -3
  66. package/fesm2022/mis-crystal-design-system-snackbar.mjs.map +1 -1
  67. package/fesm2022/mis-crystal-design-system-specificdatepicker.mjs +22 -18
  68. package/fesm2022/mis-crystal-design-system-specificdatepicker.mjs.map +1 -1
  69. package/fesm2022/mis-crystal-design-system-table.mjs +279 -111
  70. package/fesm2022/mis-crystal-design-system-table.mjs.map +1 -1
  71. package/fesm2022/mis-crystal-design-system-timepicker.mjs +25 -4
  72. package/fesm2022/mis-crystal-design-system-timepicker.mjs.map +1 -1
  73. package/fesm2022/mis-crystal-design-system-timerangepicker.mjs +21 -15
  74. package/fesm2022/mis-crystal-design-system-timerangepicker.mjs.map +1 -1
  75. package/fesm2022/mis-crystal-design-system-toast.mjs +3 -3
  76. package/fesm2022/mis-crystal-design-system-toast.mjs.map +1 -1
  77. package/fesm2022/mis-crystal-design-system-tooltip.mjs +3 -3
  78. package/fesm2022/mis-crystal-design-system-tooltip.mjs.map +1 -1
  79. package/fesm2022/mis-crystal-design-system-virtual-scroll.mjs +3 -3
  80. package/fesm2022/mis-crystal-design-system-virtual-scroll.mjs.map +1 -1
  81. package/filter/filter-panel/filter-panel.component.d.ts +1 -1
  82. package/input/mis-input.component.scss +2 -3
  83. package/loader/loader.component.d.ts +7 -1
  84. package/package.json +17 -17
  85. package/specificdatepicker/tz-sdp-container/tz-sdp-container.component.d.ts +2 -2
  86. package/table/table.component.d.ts +14 -1
  87. 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 = dayjs(this.data.date, this.data.dpConfig.format);
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.parseZoneInstance(this.data.dpConfig.minDate, this.data.dpConfig.format);
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.parseZoneInstance(this.data.dpConfig.maxDate, this.data.dpConfig.format);
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
- const isCurrentDay = currentDateInstance.format(this.data.dpConfig.format) === dayjs().format(this.data.dpConfig.format);
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
- // Prioritize current selection over previously applied date
653
- if (this.localSelectedDateSignal() &&
654
- this.localSelectedDateSignal().date === currentDate &&
655
- this.localSelectedDateSignal().month === month &&
656
- this.localSelectedDateSignal().year === currentYearNumber) {
657
- isSelectedDay = true;
658
- }
659
- else if (this.data.date && !this.localSelectedDateSignal()) {
660
- // Only check previously applied date if no current selection
661
- try {
662
- if (this.data.dpConfig.enableTime) {
663
- const selectedDate = this.parseZoneInstance(this.data.date, this.data.dpConfig.format);
664
- if (selectedDate.isValid()) {
665
- isSelectedDay = selectedDate.isSame(currentDateInstance, 'day');
666
- }
667
- }
668
- else {
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
- // Fallback to string comparison if parsing fails
676
- isSelectedDay = dateString === this.data.date;
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
- catch (error) {
681
- // Silently handle date comparison error
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.enableTime && !this.data.dpConfig.showApplyButton) {
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();