axidio-styleguide-library1-v2 0.3.5 → 0.3.6

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.
@@ -7952,42 +7952,42 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
7952
7952
  formatXLabelText(d, data, metaData, subgroups, self, isMobile) {
7953
7953
  // Check if we're on mobile or tablet
7954
7954
  const isSmallScreen = window.innerWidth < 992; // Less than 992px (mobile or tablet)
7955
+ // Helper to extract and format week number
7956
+ const extractWeekNumber = (text) => {
7957
+ const match = text.match(/(?:week|wk|w)\s*(\d+)/i);
7958
+ return match ? `W${match[1]}` : null;
7959
+ };
7960
+ // Helper to extract date part
7961
+ const extractDate = (text) => {
7962
+ const match = text.match(/\d{2}[-\/]\d{2}[-\/]\d{2,4}/);
7963
+ return match ? match[0] : null;
7964
+ };
7955
7965
  // Check if label contains both date and week information
7956
7966
  const hasDateAndTime = (text) => {
7957
- const dateMatch = /\d{2,4}[-\/]\d{1,2}[-\/]\d{1,4}/.test(text) || !isNaN(Date.parse(text));
7958
- const weekMatch = /week|wk|w\d+/i.test(text);
7967
+ const dateMatch = /\d{2,4}[-\/]\d{1,2}[-\/]\d{1,4}/.test(text);
7968
+ const weekMatch = /(?:week|wk|w)\s*\d+/i.test(text);
7959
7969
  return { isDate: dateMatch, isWeek: weekMatch };
7960
7970
  };
7961
7971
  const labelInfo = hasDateAndTime(d);
7962
- // When label contains both date and week, show it as-is (no trimming)
7963
- if (isSmallScreen && labelInfo.isDate && labelInfo.isWeek) {
7964
- return d;
7965
- }
7966
- // Mobile handling: format date and week on separate lines
7972
+ // Mobile handling: format date and week parts
7967
7973
  if (isMobile) {
7968
7974
  // If header is hidden (compact mobile)
7969
7975
  if (!self.isHeaderVisible) {
7970
- const labelInfo = hasDateAndTime(d);
7971
- // Extract week number if present
7972
- const getWeekNumber = (text) => {
7973
- const match = text.match(/(?:week|wk|w)\s*(\d+)/i);
7974
- return match ? `W${match[1]}` : null;
7975
- };
7976
- // If it has both date and week, split them
7976
+ // If it has both date and week, format appropriately
7977
7977
  if (labelInfo.isDate && labelInfo.isWeek) {
7978
- const datePart = d.match(/\d{2}[-\/]\d{2}[-\/]\d{2,4}/)?.[0] || '';
7979
- const weekPart = getWeekNumber(d);
7980
- if (weekPart) {
7978
+ const datePart = extractDate(d);
7979
+ const weekPart = extractWeekNumber(d);
7980
+ if (datePart && weekPart) {
7981
7981
  return `${datePart}\n${weekPart}`;
7982
7982
  }
7983
7983
  }
7984
7984
  // If it's just a date, return it unchanged
7985
7985
  if (labelInfo.isDate) {
7986
- return d;
7986
+ return extractDate(d) || d;
7987
7987
  }
7988
- // If it has just week number, format it
7988
+ // If it has just week number, format it as W##
7989
7989
  if (labelInfo.isWeek) {
7990
- const weekPart = getWeekNumber(d);
7990
+ const weekPart = extractWeekNumber(d);
7991
7991
  if (weekPart) {
7992
7992
  return weekPart;
7993
7993
  }