@ammarkhalidfarooq/dashboard-package 0.6.32 → 0.6.34

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/dist/index.es.js CHANGED
@@ -932,6 +932,7 @@ var Dashboard = function Dashboard(_ref) {
932
932
  numberOfDays = _ref$numberOfDays === void 0 ? 1 : _ref$numberOfDays,
933
933
  _ref$activeFilters = _ref.activeFilters,
934
934
  activeFilters = _ref$activeFilters === void 0 ? [] : _ref$activeFilters;
935
+ console.log("activeFilters chart", activeFilters);
935
936
  return /*#__PURE__*/jsx(ThemeProvider, {
936
937
  theme: theme,
937
938
  children: /*#__PURE__*/jsx(Suspense, {
@@ -2120,7 +2121,7 @@ var PageHeader = function PageHeader(_ref9) {
2120
2121
  },
2121
2122
  children: ["Page ", page, " of 2"]
2122
2123
  })]
2123
- }), activeFilters && /*#__PURE__*/jsxs("div", {
2124
+ }), !!"".concat(activeFilters || "").trim() && /*#__PURE__*/jsxs("div", {
2124
2125
  style: {
2125
2126
  marginTop: 7,
2126
2127
  display: "inline-flex",
@@ -2191,11 +2192,26 @@ var ExportPdfLayout = /*#__PURE__*/React.forwardRef(function (_ref1, ref) {
2191
2192
  minute: "2-digit"
2192
2193
  }) + " GMT";
2193
2194
  var dateLabel = dateName;
2194
- var formattedActiveFilters = Array.isArray(activeFilters) ? activeFilters.filter(function (item) {
2195
- return item && item.value !== undefined && item.value !== null && "".concat(item.value).trim();
2196
- }).map(function (item) {
2197
- return "".concat(item.label || item.id, ": ").concat(item.value);
2198
- }).join(" | ") : "";
2195
+ var normalizeFiltersText = function normalizeFiltersText(filtersInput) {
2196
+ if (Array.isArray(filtersInput)) {
2197
+ var fromObjects = filtersInput.filter(function (item) {
2198
+ return item && item.value !== undefined && item.value !== null && "".concat(item.value).trim();
2199
+ }).map(function (item) {
2200
+ return "".concat(item.label || item.id || "Filter", ": ").concat(item.value);
2201
+ }).join(" | ").trim();
2202
+ if (fromObjects) return fromObjects;
2203
+ var fromStrings = filtersInput.map(function (item) {
2204
+ return typeof item === "string" ? item.trim() : "";
2205
+ }).filter(Boolean).join(" | ").trim();
2206
+ if (fromStrings) return fromStrings;
2207
+ }
2208
+ if (typeof filtersInput === "string") {
2209
+ var str = filtersInput.trim();
2210
+ if (str) return str;
2211
+ }
2212
+ return "";
2213
+ };
2214
+ var formattedActiveFilters = normalizeFiltersText(activeFilters) || normalizeFiltersText(getActiveFilterChips(apiData));
2199
2215
  var report = buildReportData(apiData, dateName);
2200
2216
  var hero = report.hero,
2201
2217
  metrics = report.metrics,