@databrainhq/plugin 0.9.13 → 0.9.14

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
@@ -2533,14 +2533,13 @@ const floatingCreateButtonIcon = "_floatingCreateButtonIcon_12kmo_399";
2533
2533
  const floatingButton = "_floatingButton_12kmo_407";
2534
2534
  const staticContainer = "_staticContainer_12kmo_415";
2535
2535
  const floatingContainer = "_floatingContainer_12kmo_423";
2536
- const filterButton = "_filterButton_12kmo_439";
2536
+ const filterButton$1 = "_filterButton_12kmo_439";
2537
2537
  const filterText$1 = "_filterText_12kmo_447";
2538
- const filterLength = "_filterLength_12kmo_455";
2538
+ const filterLength$1 = "_filterLength_12kmo_455";
2539
2539
  var styles$M = {
2540
2540
  container: container$i,
2541
2541
  "static": "_static_12kmo_415",
2542
2542
  fixed,
2543
- "ml-[40px]": "_ml-[40px]_12kmo_1",
2544
2543
  inline,
2545
2544
  flex,
2546
2545
  table: table$3,
@@ -2549,7 +2548,6 @@ var styles$M = {
2549
2548
  hidden,
2550
2549
  "h-[10%]": "_h-[10%]_12kmo_1",
2551
2550
  "w-full": "_w-full_12kmo_1",
2552
- "w-[400px]": "_w-[400px]_12kmo_1",
2553
2551
  transform,
2554
2552
  resize,
2555
2553
  truncate,
@@ -2573,9 +2571,9 @@ var styles$M = {
2573
2571
  floatingButton,
2574
2572
  staticContainer,
2575
2573
  floatingContainer,
2576
- filterButton,
2574
+ filterButton: filterButton$1,
2577
2575
  filterText: filterText$1,
2578
- filterLength,
2576
+ filterLength: filterLength$1,
2579
2577
  "hover:cursor-pointer": "_hover:cursor-pointer_12kmo_1",
2580
2578
  "hover:cursor-text": "_hover:cursor-text_12kmo_1",
2581
2579
  "disabled:cursor-text": "_disabled:cursor-text_12kmo_1",
@@ -6488,27 +6486,99 @@ const TextAreaField = ({
6488
6486
  })]
6489
6487
  });
6490
6488
  };
6491
- const group$1 = "_group_13otg_1";
6492
- const button$8 = "_button_13otg_9";
6493
- const checkbox = "_checkbox_13otg_17";
6494
- const enabled = "_enabled_13otg_43";
6495
- const notenabled = "_notenabled_13otg_59";
6496
- const label$4 = "_label_13otg_75";
6497
- const labelActive = "_labelActive_13otg_83";
6498
- const labelInactive = "_labelInactive_13otg_91";
6489
+ const Switch = ({
6490
+ name,
6491
+ styles: styles2,
6492
+ placeholder,
6493
+ enabled: enabled2
6494
+ }) => {
6495
+ return /* @__PURE__ */ jsxs("label", {
6496
+ htmlFor: name,
6497
+ className: `${styles2.button}`,
6498
+ children: [Array.isArray(placeholder) && /* @__PURE__ */ jsxs(Fragment, {
6499
+ children: [/* @__PURE__ */ jsx("span", {
6500
+ className: ` ${styles2.label} ${!enabled2 ? styles2.labelActive : styles2.labelInactive}`,
6501
+ children: placeholder[0]
6502
+ }), /* @__PURE__ */ jsx("span", {
6503
+ className: ` ${styles2.switch} ${enabled2 ? styles2.enabled : styles2.notenabled}`
6504
+ }), /* @__PURE__ */ jsx("span", {
6505
+ className: ` ${styles2.label} ${enabled2 ? styles2.labelActive : styles2.labelInactive}`,
6506
+ children: placeholder[1]
6507
+ })]
6508
+ }), typeof placeholder === "string" && /* @__PURE__ */ jsxs(Fragment, {
6509
+ children: [/* @__PURE__ */ jsx("span", {
6510
+ className: ` ${styles2.switch} ${enabled2 ? styles2.enabled : styles2.notenabled}`
6511
+ }), /* @__PURE__ */ jsx("span", {
6512
+ className: ` ${styles2.label} ${enabled2 ? styles2.labelActive : styles2.labelInactive}`,
6513
+ children: placeholder
6514
+ })]
6515
+ }), !Array.isArray(placeholder) && typeof placeholder !== "string" && /* @__PURE__ */ jsx("span", {
6516
+ className: ` ${styles2.switch} ${enabled2 ? styles2.enabled : styles2.notenabled}`
6517
+ })]
6518
+ });
6519
+ };
6520
+ const group$1 = "_group_2xttg_1";
6521
+ const button$8 = "_button_2xttg_9";
6522
+ const toggleWidth = "_toggleWidth_2xttg_15";
6523
+ const checkbox = "_checkbox_2xttg_23";
6524
+ const enabled = "_enabled_2xttg_49";
6525
+ const notenabled = "_notenabled_2xttg_65";
6526
+ const toggle = "_toggle_2xttg_15";
6527
+ const label$4 = "_label_2xttg_89";
6528
+ const labelActive = "_labelActive_2xttg_97";
6529
+ const labelInactive = "_labelInactive_2xttg_105";
6530
+ const toggleInactive = "_toggleInactive_2xttg_113";
6499
6531
  var styles$B = {
6500
6532
  group: group$1,
6501
6533
  button: button$8,
6534
+ toggleWidth,
6502
6535
  checkbox,
6503
- "switch": "_switch_13otg_25",
6536
+ "switch": "_switch_2xttg_31",
6504
6537
  enabled,
6505
6538
  notenabled,
6539
+ toggle,
6506
6540
  label: label$4,
6507
6541
  labelActive,
6508
- labelInactive
6542
+ labelInactive,
6543
+ toggleInactive
6544
+ };
6545
+ const Toggle = ({
6546
+ name,
6547
+ styles: styles2,
6548
+ placeholder,
6549
+ enabled: enabled2
6550
+ }) => {
6551
+ return /* @__PURE__ */ jsxs("label", {
6552
+ htmlFor: name,
6553
+ className: `${styles2.button} ${styles2.toggleWidth}`,
6554
+ children: [Array.isArray(placeholder) && /* @__PURE__ */ jsxs(Fragment, {
6555
+ children: [/* @__PURE__ */ jsx("span", {
6556
+ className: ` ${styles2.label} ${enabled2 && styles2.toggleInactive}`,
6557
+ children: placeholder[0]
6558
+ }), /* @__PURE__ */ jsx("span", {
6559
+ className: ` ${styles2.switch} ${styles2.toggle} ${enabled2 ? styles2.enabled : styles2.notenabled}
6560
+ `
6561
+ }), /* @__PURE__ */ jsx("span", {
6562
+ className: ` ${styles2.label} ${enabled2 || styles2.toggleInactive}`,
6563
+ children: placeholder[1]
6564
+ })]
6565
+ }), typeof placeholder === "string" && /* @__PURE__ */ jsxs(Fragment, {
6566
+ children: [/* @__PURE__ */ jsx("span", {
6567
+ className: ` ${styles2.switch} ${styles2.toggle} ${enabled2 ? styles2.enabled : styles2.notenabled}
6568
+ `
6569
+ }), /* @__PURE__ */ jsx("span", {
6570
+ className: ` ${styles2.label} ${enabled2 || styles2.labelInactive}`,
6571
+ children: placeholder
6572
+ })]
6573
+ }), !Array.isArray(placeholder) && typeof placeholder !== "string" && /* @__PURE__ */ jsx("span", {
6574
+ className: ` ${styles2.switch} ${styles2.toggle} ${enabled2 ? styles2.enabled : styles2.notenabled}
6575
+ `
6576
+ })]
6577
+ });
6509
6578
  };
6510
6579
  const ToggleButton = ({
6511
6580
  enabled: enabled2,
6581
+ variant = "switch",
6512
6582
  onChange,
6513
6583
  label: label2,
6514
6584
  className = "",
@@ -6532,18 +6602,16 @@ const ToggleButton = ({
6532
6602
  target
6533
6603
  }) => onChange == null ? void 0 : onChange(target.checked),
6534
6604
  className: styles$B.checkbox
6535
- }), /* @__PURE__ */ jsxs("label", {
6536
- htmlFor: name,
6537
- className: styles$B.button,
6538
- children: [/* @__PURE__ */ jsx("span", {
6539
- className: `${styles$B.switch} ${enabled2 ? styles$B.enabled : styles$B.notenabled}`
6540
- }), placeholder ? /* @__PURE__ */ jsx("span", {
6541
- className: `
6542
- ${styles$B.label}
6543
- ${enabled2 ? styles$B.labelActive : styles$B.labelInactive}
6544
- `,
6545
- children: placeholder
6546
- }) : null]
6605
+ }), variant === "toggle" && /* @__PURE__ */ jsx(Toggle, {
6606
+ name,
6607
+ styles: styles$B,
6608
+ placeholder,
6609
+ enabled: enabled2
6610
+ }), variant === "switch" && /* @__PURE__ */ jsx(Switch, {
6611
+ name,
6612
+ styles: styles$B,
6613
+ placeholder,
6614
+ enabled: enabled2
6547
6615
  })]
6548
6616
  });
6549
6617
  };
@@ -86704,38 +86772,41 @@ const FilterField = ({
86704
86772
  })
86705
86773
  });
86706
86774
  };
86707
- const container$9 = "_container_550f5_1";
86708
- const form$1 = "_form_550f5_7";
86709
- const filterHeader = "_filterHeader_550f5_13";
86710
- const titleContent = "_titleContent_550f5_19";
86711
- const title = "_title_550f5_19";
86712
- const buttons = "_buttons_550f5_31";
86713
- const apply = "_apply_550f5_37";
86714
- const applyIcon = "_applyIcon_550f5_43";
86715
- const reset = "_reset_550f5_49";
86716
- const filterFields = "_filterFields_550f5_55";
86717
- const AddFilter$1 = "_AddFilter_550f5_61";
86718
- const filterDropdown$1 = "_filterDropdown_550f5_67";
86719
- const filters = "_filters_550f5_73";
86720
- const filterItem = "_filterItem_550f5_79";
86721
- const filterItemOperator = "_filterItemOperator_550f5_85";
86722
- const remove = "_remove_550f5_91";
86723
- const filterCol = "_filterCol_550f5_97";
86724
- const filterText = "_filterText_550f5_103";
86725
- const smallText = "_smallText_550f5_109";
86726
- const numberField = "_numberField_550f5_117";
86727
- const numberFieldWrapper = "_numberFieldWrapper_550f5_125";
86728
- const numberFieldLabel = "_numberFieldLabel_550f5_133";
86729
- const numberFieldLabelText = "_numberFieldLabelText_550f5_141";
86730
- const numberFieldLabelSelectText = "_numberFieldLabelSelectText_550f5_149";
86731
- const numberFieldButtonClass = "_numberFieldButtonClass_550f5_157";
86732
- const numberFieldLabelMenuClass = "_numberFieldLabelMenuClass_550f5_165";
86733
- const checkedOption$1 = "_checkedOption_550f5_173";
86734
- const option = "_option_550f5_181";
86735
- const addFilterMenu = "_addFilterMenu_550f5_189";
86736
- const appliedFilterTag = "_appliedFilterTag_550f5_197";
86737
- const appliedfilters = "_appliedfilters_550f5_205";
86738
- const textBold = "_textBold_550f5_213";
86775
+ const container$9 = "_container_158ok_1";
86776
+ const form$1 = "_form_158ok_7";
86777
+ const filterHeader = "_filterHeader_158ok_13";
86778
+ const titleContent = "_titleContent_158ok_19";
86779
+ const title = "_title_158ok_19";
86780
+ const buttons = "_buttons_158ok_31";
86781
+ const apply = "_apply_158ok_37";
86782
+ const applyIcon = "_applyIcon_158ok_43";
86783
+ const reset = "_reset_158ok_49";
86784
+ const filterFields = "_filterFields_158ok_55";
86785
+ const AddFilter$1 = "_AddFilter_158ok_61";
86786
+ const filterDropdown$1 = "_filterDropdown_158ok_67";
86787
+ const filters = "_filters_158ok_73";
86788
+ const filterItem = "_filterItem_158ok_79";
86789
+ const filterItemOperator = "_filterItemOperator_158ok_85";
86790
+ const remove = "_remove_158ok_91";
86791
+ const filterCol = "_filterCol_158ok_97";
86792
+ const filterText = "_filterText_158ok_103";
86793
+ const smallText = "_smallText_158ok_109";
86794
+ const numberField = "_numberField_158ok_117";
86795
+ const numberFieldWrapper = "_numberFieldWrapper_158ok_125";
86796
+ const numberFieldLabel = "_numberFieldLabel_158ok_133";
86797
+ const numberFieldLabelText = "_numberFieldLabelText_158ok_141";
86798
+ const numberFieldLabelSelectText = "_numberFieldLabelSelectText_158ok_149";
86799
+ const numberFieldButtonClass = "_numberFieldButtonClass_158ok_157";
86800
+ const numberFieldLabelMenuClass = "_numberFieldLabelMenuClass_158ok_165";
86801
+ const checkedOption$1 = "_checkedOption_158ok_173";
86802
+ const option = "_option_158ok_181";
86803
+ const addFilterMenu = "_addFilterMenu_158ok_189";
86804
+ const appliedFilterTag = "_appliedFilterTag_158ok_197";
86805
+ const appliedfilters = "_appliedfilters_158ok_205";
86806
+ const textBold = "_textBold_158ok_213";
86807
+ const filterButton = "_filterButton_158ok_221";
86808
+ const filterBtnText = "_filterBtnText_158ok_229";
86809
+ const filterLength = "_filterLength_158ok_237";
86739
86810
  var styles$s = {
86740
86811
  container: container$9,
86741
86812
  form: form$1,
@@ -86768,7 +86839,10 @@ var styles$s = {
86768
86839
  addFilterMenu,
86769
86840
  appliedFilterTag,
86770
86841
  appliedfilters,
86771
- textBold
86842
+ textBold,
86843
+ filterButton,
86844
+ filterBtnText,
86845
+ filterLength
86772
86846
  };
86773
86847
  const NumberFilterField = ({
86774
86848
  setAppliedFilters,
@@ -86903,6 +86977,48 @@ const AddFilter = ({
86903
86977
  })
86904
86978
  });
86905
86979
  };
86980
+ const AppliedFilter = ({
86981
+ appliedFilter,
86982
+ setAppliedFilters,
86983
+ onChangeFilters
86984
+ }) => {
86985
+ return /* @__PURE__ */ jsx("div", {
86986
+ className: styles$s.appliedfilters,
86987
+ children: appliedFilter.map((filter2) => /* @__PURE__ */ jsxs("div", {
86988
+ className: styles$s.appliedFilterTag,
86989
+ children: [/* @__PURE__ */ jsx(Text, {
86990
+ variant: "p",
86991
+ styleClass: "font-14",
86992
+ className: styles$s.textBold,
86993
+ children: filter2.column
86994
+ }), /* @__PURE__ */ jsx(Text, {
86995
+ variant: "p",
86996
+ styleClass: "font-14",
86997
+ children: "is"
86998
+ }), filter2.as !== "string" && filter2.as !== "boolean" && filter2.as !== "default" && /* @__PURE__ */ jsx(Text, {
86999
+ variant: "p",
87000
+ styleClass: "font-14",
87001
+ children: "between"
87002
+ }), /* @__PURE__ */ jsx(Text, {
87003
+ variant: "p",
87004
+ styleClass: "font-14",
87005
+ className: styles$s.textBold,
87006
+ children: Array.isArray(filter2.value) ? filter2.as === "string" ? filter2.value.join(", ") : filter2.value.join(" & ") : typeof filter2.value === "string" && filter2.as === "number" ? filter2.value.replace("AND", "&") : typeof filter2.value === "string" && filter2.as === "date" ? filter2.value.split(" ").slice(2).join(" ").replace("AND", "&") : filter2.value
87007
+ }), /* @__PURE__ */ jsx(Button, {
87008
+ variant: "secondary",
87009
+ type: "button",
87010
+ onClick: () => {
87011
+ setAppliedFilters((prev) => prev.filter((a4) => a4.column !== filter2.column));
87012
+ const filterColumns = appliedFilter.filter((c3) => c3.column !== filter2.column);
87013
+ onChangeFilters(filterColumns);
87014
+ },
87015
+ children: /* @__PURE__ */ jsx(Icons, {
87016
+ name: "close-icon"
87017
+ })
87018
+ })]
87019
+ }))
87020
+ });
87021
+ };
86906
87022
  const groupArray = (array, key) => {
86907
87023
  return array.reduce((acc, item) => {
86908
87024
  const group2 = item[key];
@@ -95464,21 +95580,22 @@ const GlobalFilters = ({
95464
95580
  onApply,
95465
95581
  companyId,
95466
95582
  renderAdditionalHeaderContent,
95467
- externalDashboardId,
95468
- appliedfilters: appliedfilters2,
95469
- setAppliedFilters
95583
+ externalDashboardId
95470
95584
  }) => {
95585
+ const [appliedfilters2, setAppliedFilters] = useState([]);
95586
+ const globalFilterRef = useRef(null);
95471
95587
  const [filterList, setFilterList] = useState([]);
95472
95588
  const resetFilters = () => {
95589
+ var _a2;
95473
95590
  setAppliedFilters([]);
95474
95591
  onApply({
95475
95592
  tableName: "",
95476
95593
  filters: []
95477
95594
  });
95595
+ (_a2 = globalFilterRef.current) == null ? void 0 : _a2.click();
95478
95596
  };
95479
- const handleSubmit = (e3) => {
95480
- e3.preventDefault();
95481
- const filterColumns = appliedfilters2.map((field2) => {
95597
+ const onChangeFilters = (updatedFilters) => {
95598
+ const filterColumns = updatedFilters.map((field2) => {
95482
95599
  const col = {
95483
95600
  column: field2.column,
95484
95601
  operator: field2.operator,
@@ -95501,6 +95618,12 @@ const GlobalFilters = ({
95501
95618
  filters: filterColumns
95502
95619
  });
95503
95620
  };
95621
+ const handleSubmit = (e3) => {
95622
+ var _a2;
95623
+ e3.preventDefault();
95624
+ onChangeFilters(appliedfilters2);
95625
+ (_a2 = globalFilterRef.current) == null ? void 0 : _a2.click();
95626
+ };
95504
95627
  const getSelectedOption = useCallback((col, type3) => {
95505
95628
  var _a2;
95506
95629
  const colValue = ((_a2 = appliedfilters2.find((filter2) => filter2.column === col)) == null ? void 0 : _a2.value) || "";
@@ -95547,148 +95670,183 @@ const GlobalFilters = ({
95547
95670
  useEffect(() => {
95548
95671
  if (filters2[0].columns.length) {
95549
95672
  setFilterList(filters2[0].columns.filter((col) => col.isDefault));
95673
+ } else {
95674
+ setAppliedFilters([]);
95675
+ onApply({
95676
+ tableName: filters2[0].tableName,
95677
+ filters: []
95678
+ });
95550
95679
  }
95551
95680
  }, [filters2]);
95681
+ useEffect(() => {
95682
+ setAppliedFilters([]);
95683
+ onApply({
95684
+ tableName: filters2[0].tableName,
95685
+ filters: []
95686
+ });
95687
+ }, [externalDashboardId]);
95552
95688
  return /* @__PURE__ */ jsx(Fragment, {
95553
- children: (data == null ? void 0 : data.companyIntegrations.length) && !isLoading && /* @__PURE__ */ jsx("div", {
95554
- className: styles$s.container,
95555
- children: /* @__PURE__ */ jsxs("form", {
95556
- className: styles$s.form,
95557
- onSubmit: handleSubmit,
95558
- onReset: resetFilters,
95559
- children: [/* @__PURE__ */ jsx("div", {
95560
- className: styles$s.filterHeader,
95561
- children: /* @__PURE__ */ jsxs("div", {
95562
- className: styles$s.titleContent,
95563
- children: [/* @__PURE__ */ jsx(Text, {
95564
- variant: "p",
95565
- styleClass: "primary",
95566
- className: styles$s.title,
95567
- children: "Filters"
95568
- }), renderAdditionalHeaderContent ? renderAdditionalHeaderContent() : null]
95569
- })
95570
- }), /* @__PURE__ */ jsx("div", {
95571
- className: styles$s.filterFields,
95572
- children: filterList.map((col) => {
95573
- var _a2, _b2;
95574
- return /* @__PURE__ */ jsx(Fragment, {
95689
+ children: (data == null ? void 0 : data.companyIntegrations.length) && !isLoading && /* @__PURE__ */ jsxs(Fragment, {
95690
+ children: [/* @__PURE__ */ jsx(PopoverMenu, {
95691
+ button: /* @__PURE__ */ jsxs("div", {
95692
+ className: styles$s.filterButton,
95693
+ ref: globalFilterRef,
95694
+ children: [/* @__PURE__ */ jsxs("div", {
95695
+ className: styles$s.filterBtnText,
95696
+ children: [/* @__PURE__ */ jsx(Icons, {
95697
+ name: "filter-icon"
95698
+ }), " Filters"]
95699
+ }), appliedfilters2.length === 0 ? null : /* @__PURE__ */ jsx("span", {
95700
+ className: styles$s.filterLength,
95701
+ children: appliedfilters2.length
95702
+ })]
95703
+ }),
95704
+ position: "bottom-left",
95705
+ children: /* @__PURE__ */ jsx("div", {
95706
+ className: styles$s.container,
95707
+ children: /* @__PURE__ */ jsxs("form", {
95708
+ className: styles$s.form,
95709
+ onSubmit: handleSubmit,
95710
+ onReset: resetFilters,
95711
+ children: [/* @__PURE__ */ jsx("div", {
95712
+ className: styles$s.filterHeader,
95575
95713
  children: /* @__PURE__ */ jsxs("div", {
95576
- className: styles$s.filterDropdown,
95577
- children: [col.as === "date" && /* @__PURE__ */ jsx(Fragment, {
95578
- children: /* @__PURE__ */ jsx(DateRangePicker, {
95579
- label: col.label || col.name,
95580
- defaultValues: (_a2 = appliedfilters2.find((filter2) => filter2.column === col.name)) == null ? void 0 : _a2.defaultValues,
95581
- onChange: (option2) => {
95582
- if (option2)
95583
- setAppliedFilters((prev) => {
95584
- const isTimeStamp = col.as.toLowerCase() !== "date";
95585
- const value = getTimeFilterValue({
95586
- timeGrainValue: option2.value,
95587
- isTimeStamp,
95588
- col: getColumnString(col.name),
95589
- database: integrationName
95590
- });
95591
- const field2 = {
95592
- column: col.name,
95593
- operator: "=",
95594
- value,
95595
- as: col.as,
95596
- defaultValues: option2
95597
- };
95598
- const index2 = prev.findIndex((f2) => f2.column === col.name);
95599
- if (index2 === -1)
95600
- return [...prev, field2];
95601
- const updated = [...prev];
95602
- updated[index2] = field2;
95603
- return updated;
95604
- });
95605
- }
95714
+ className: styles$s.titleContent,
95715
+ children: [/* @__PURE__ */ jsx(Text, {
95716
+ variant: "p",
95717
+ styleClass: "primary",
95718
+ className: styles$s.title,
95719
+ children: "Filters"
95720
+ }), renderAdditionalHeaderContent ? renderAdditionalHeaderContent() : null]
95721
+ })
95722
+ }), /* @__PURE__ */ jsx("div", {
95723
+ className: styles$s.filterFields,
95724
+ children: filterList.map((col) => {
95725
+ var _a2, _b2;
95726
+ return /* @__PURE__ */ jsx(Fragment, {
95727
+ children: /* @__PURE__ */ jsxs("div", {
95728
+ className: styles$s.filterDropdown,
95729
+ children: [col.as === "date" && /* @__PURE__ */ jsx(Fragment, {
95730
+ children: /* @__PURE__ */ jsx(DateRangePicker, {
95731
+ label: col.label || col.name,
95732
+ defaultValues: (_a2 = appliedfilters2.find((filter2) => filter2.column === col.name)) == null ? void 0 : _a2.defaultValues,
95733
+ onChange: (option2) => {
95734
+ if (option2)
95735
+ setAppliedFilters((prev) => {
95736
+ const isTimeStamp = col.as.toLowerCase() !== "date";
95737
+ const value = getTimeFilterValue({
95738
+ timeGrainValue: option2.value,
95739
+ isTimeStamp,
95740
+ col: getColumnString(col.name),
95741
+ database: integrationName
95742
+ });
95743
+ const field2 = {
95744
+ column: col.name,
95745
+ operator: "=",
95746
+ value,
95747
+ as: col.as,
95748
+ defaultValues: option2
95749
+ };
95750
+ const index2 = prev.findIndex((f2) => f2.column === col.name);
95751
+ if (index2 === -1)
95752
+ return [...prev, field2];
95753
+ const updated = [...prev];
95754
+ updated[index2] = field2;
95755
+ return updated;
95756
+ });
95757
+ }
95758
+ })
95759
+ }), col.as === "number" && /* @__PURE__ */ jsx(NumberFilterField, {
95760
+ setAppliedFilters,
95761
+ column: col,
95762
+ defaultValues: (_b2 = appliedfilters2.find((filter2) => filter2.column === col.name)) == null ? void 0 : _b2.defaultValues
95763
+ }), col.as === "string" && /* @__PURE__ */ jsx(MultiFilterDropdown, {
95764
+ filter: {
95765
+ tableName: filters2[0].tableName,
95766
+ columnName: col.name
95767
+ },
95768
+ companyId,
95769
+ selectedOptions: getSelectedOption(col.name, "string") || [],
95770
+ autoSelected: false,
95771
+ onChange: (options2) => setAppliedFilters((prev) => {
95772
+ const field2 = {
95773
+ column: col.name,
95774
+ operator: "IN",
95775
+ value: options2.map((v4) => v4.value),
95776
+ as: col.as
95777
+ };
95778
+ const index2 = prev.findIndex((f2) => f2.column === col.name);
95779
+ if (index2 === -1)
95780
+ return [...prev, field2];
95781
+ const updated = [...prev];
95782
+ updated[index2] = field2;
95783
+ return updated;
95784
+ }),
95785
+ isSearchEnabled: true,
95786
+ integrationId,
95787
+ integrationName,
95788
+ label: col.label || col.name
95789
+ }), col.as === "default" || col.as === "boolean" ? /* @__PURE__ */ jsx(FilterDropDown, {
95790
+ filter: {
95791
+ tableName: filters2[0].tableName,
95792
+ columnName: col.name
95793
+ },
95794
+ companyId,
95795
+ selectedOption: getSelectedOption(col.name, "boolean"),
95796
+ autoSelected: false,
95797
+ onChange: (option2) => setAppliedFilters((prev) => {
95798
+ const field2 = {
95799
+ column: col.name,
95800
+ operator: "=",
95801
+ value: option2.value,
95802
+ as: col.as
95803
+ };
95804
+ const index2 = prev.findIndex((f2) => f2.column === col.name);
95805
+ if (index2 === -1)
95806
+ return [...prev, field2];
95807
+ const updated = [...prev];
95808
+ updated[index2] = field2;
95809
+ return updated;
95810
+ }),
95811
+ isSearchEnabled: true,
95812
+ integrationId,
95813
+ integrationName,
95814
+ label: col.label || col.name
95815
+ }) : null]
95606
95816
  })
95607
- }), col.as === "number" && /* @__PURE__ */ jsx(NumberFilterField, {
95608
- setAppliedFilters,
95609
- column: col,
95610
- defaultValues: (_b2 = appliedfilters2.find((filter2) => filter2.column === col.name)) == null ? void 0 : _b2.defaultValues
95611
- }), col.as === "string" && /* @__PURE__ */ jsx(MultiFilterDropdown, {
95612
- filter: {
95613
- tableName: filters2[0].tableName,
95614
- columnName: col.name
95615
- },
95616
- companyId,
95617
- selectedOptions: getSelectedOption(col.name, "string") || [],
95618
- autoSelected: false,
95619
- onChange: (options2) => setAppliedFilters((prev) => {
95620
- const field2 = {
95621
- column: col.name,
95622
- operator: "IN",
95623
- value: options2.map((v4) => v4.value),
95624
- as: col.as
95625
- };
95626
- const index2 = prev.findIndex((f2) => f2.column === col.name);
95627
- if (index2 === -1)
95628
- return [...prev, field2];
95629
- const updated = [...prev];
95630
- updated[index2] = field2;
95631
- return updated;
95632
- }),
95633
- isSearchEnabled: true,
95634
- integrationId,
95635
- integrationName,
95636
- label: col.label || col.name
95637
- }), col.as === "default" || col.as === "boolean" ? /* @__PURE__ */ jsx(FilterDropDown, {
95638
- filter: {
95639
- tableName: filters2[0].tableName,
95640
- columnName: col.name
95641
- },
95642
- companyId,
95643
- selectedOption: getSelectedOption(col.name, "boolean"),
95644
- autoSelected: false,
95645
- onChange: (option2) => setAppliedFilters((prev) => {
95646
- const field2 = {
95647
- column: col.name,
95648
- operator: "=",
95649
- value: option2.value,
95650
- as: col.as
95651
- };
95652
- const index2 = prev.findIndex((f2) => f2.column === col.name);
95653
- if (index2 === -1)
95654
- return [...prev, field2];
95655
- const updated = [...prev];
95656
- updated[index2] = field2;
95657
- return updated;
95658
- }),
95659
- isSearchEnabled: true,
95660
- integrationId,
95661
- integrationName,
95662
- label: col.label || col.name
95663
- }) : null]
95817
+ });
95664
95818
  })
95665
- });
95666
- })
95667
- }), /* @__PURE__ */ jsx("div", {
95668
- className: styles$s.AddFilter,
95669
- children: /* @__PURE__ */ jsx(AddFilter, {
95670
- columnList: filters2[0].columns.filter((col) => !col.isDefault),
95671
- setFilterList,
95672
- filterList
95819
+ }), /* @__PURE__ */ jsx("div", {
95820
+ className: styles$s.AddFilter,
95821
+ children: /* @__PURE__ */ jsx(AddFilter, {
95822
+ columnList: filters2[0].columns.filter((col) => !col.isDefault),
95823
+ setFilterList,
95824
+ filterList
95825
+ })
95826
+ }), /* @__PURE__ */ jsxs("div", {
95827
+ className: styles$s.buttons,
95828
+ children: [/* @__PURE__ */ jsxs(Button, {
95829
+ type: "reset",
95830
+ variant: "secondary",
95831
+ className: styles$s.reset,
95832
+ children: [/* @__PURE__ */ jsx(Icons, {
95833
+ name: "reset-icon",
95834
+ className: styles$s.applyIcon
95835
+ }), " ", "Reset Filters"]
95836
+ }), /* @__PURE__ */ jsx(Button, {
95837
+ type: "submit",
95838
+ variant: "primary",
95839
+ className: styles$s.apply,
95840
+ children: "Apply"
95841
+ })]
95842
+ })]
95673
95843
  })
95674
- }), /* @__PURE__ */ jsxs("div", {
95675
- className: styles$s.buttons,
95676
- children: [/* @__PURE__ */ jsxs(Button, {
95677
- type: "reset",
95678
- variant: "secondary",
95679
- className: styles$s.reset,
95680
- children: [/* @__PURE__ */ jsx(Icons, {
95681
- name: "reset-icon",
95682
- className: styles$s.applyIcon
95683
- }), " Reset Filters"]
95684
- }), /* @__PURE__ */ jsx(Button, {
95685
- type: "submit",
95686
- variant: "primary",
95687
- className: styles$s.apply,
95688
- children: "Apply"
95689
- })]
95690
- })]
95691
- })
95844
+ })
95845
+ }), /* @__PURE__ */ jsx(AppliedFilter, {
95846
+ appliedFilter: appliedfilters2,
95847
+ setAppliedFilters,
95848
+ onChangeFilters: (updatedFilters) => onChangeFilters(updatedFilters)
95849
+ })]
95692
95850
  })
95693
95851
  });
95694
95852
  };
@@ -130166,60 +130324,60 @@ var styles$b = {
130166
130324
  "alt-container": "_alt-container_170un_49",
130167
130325
  fullscreen: fullscreen$2
130168
130326
  };
130169
- const cardContainer = "_cardContainer_pprak_1";
130170
- const listHeader = "_listHeader_pprak_9";
130171
- const metricName = "_metricName_pprak_17";
130172
- const metricTitle = "_metricTitle_pprak_25";
130173
- const metricDescription = "_metricDescription_pprak_33";
130174
- const popup = "_popup_pprak_41";
130175
- const metricFilter$1 = "_metricFilter_pprak_49";
130176
- const popupIcon = "_popupIcon_pprak_57";
130177
- const popupMenu = "_popupMenu_pprak_65";
130178
- const popupItem = "_popupItem_pprak_73";
130179
- const popupItemIcon = "_popupItemIcon_pprak_81";
130180
- const csvBtn = "_csvBtn_pprak_89";
130181
- const deleteBtn = "_deleteBtn_pprak_97";
130182
- const metricData = "_metricData_pprak_105";
130183
- const metricTable = "_metricTable_pprak_113";
130184
- const singleValueData = "_singleValueData_pprak_121";
130185
- const singleValue = "_singleValue_pprak_121";
130186
- const noData = "_noData_pprak_137";
130187
- const noDataContent = "_noDataContent_pprak_145";
130188
- const noDataText = "_noDataText_pprak_153";
130189
- const loading$1 = "_loading_pprak_161";
130190
- const features = "_features_pprak_169";
130191
- const fullscreen$1 = "_fullscreen_pprak_177";
130192
- const deleteModal = "_deleteModal_pprak_185";
130193
- const cancelBtn = "_cancelBtn_pprak_193";
130194
- const warningIcon = "_warningIcon_pprak_201";
130195
- const downloadCsv = "_downloadCsv_pprak_209";
130196
- const downloadCsvWrapper = "_downloadCsvWrapper_pprak_217";
130197
- const downloadCsvHeader = "_downloadCsvHeader_pprak_225";
130198
- const downloadCsvFooter = "_downloadCsvFooter_pprak_233";
130199
- const downloadCsvCancelBtn = "_downloadCsvCancelBtn_pprak_241";
130200
- const downloadCsvDisableBtn = "_downloadCsvDisableBtn_pprak_247";
130201
- const downloadCsvNote = "_downloadCsvNote_pprak_253";
130202
- const downloadCsvExpiredNote = "_downloadCsvExpiredNote_pprak_261";
130203
- const downloadCsvNoteText = "_downloadCsvNoteText_pprak_267";
130204
- const downloadCsvSuccessNote = "_downloadCsvSuccessNote_pprak_273";
130205
- const downloadCsvSuccessText = "_downloadCsvSuccessText_pprak_279";
130206
- const downloadUrlTimeline = "_downloadUrlTimeline_pprak_301";
130207
- const timeLineItem = "_timeLineItem_pprak_309";
130208
- const timeLineActiveIcon = "_timeLineActiveIcon_pprak_317";
130209
- const timeLineIcon = "_timeLineIcon_pprak_325";
130210
- const timeLineItemline = "_timeLineItemline_pprak_333";
130211
- const downloadCsvLoading = "_downloadCsvLoading_pprak_341";
130212
- const downloadCsvLoadingIcon = "_downloadCsvLoadingIcon_pprak_349";
130213
- const downloadCsvLoadingText = "_downloadCsvLoadingText_pprak_357";
130214
- const timeLineCheckedIcon = "_timeLineCheckedIcon_pprak_365";
130215
- const timeLineCheckedIconWrapper = "_timeLineCheckedIconWrapper_pprak_373";
130216
- const downloadCsvBackBtnWrapper = "_downloadCsvBackBtnWrapper_pprak_381";
130217
- const downloadCsvBackBtnText = "_downloadCsvBackBtnText_pprak_389";
130218
- const downloadCsvHeaderText = "_downloadCsvHeaderText_pprak_411";
130219
- const downloadCsvTabContainer = "_downloadCsvTabContainer_pprak_419";
130220
- const downloadCsvActiveTab = "_downloadCsvActiveTab_pprak_427";
130221
- const downloadCsvTab = "_downloadCsvTab_pprak_419";
130222
- const downloadCsvActiveTabText = "_downloadCsvActiveTabText_pprak_443";
130327
+ const cardContainer = "_cardContainer_sacr7_1";
130328
+ const listHeader = "_listHeader_sacr7_9";
130329
+ const metricName = "_metricName_sacr7_17";
130330
+ const metricTitle = "_metricTitle_sacr7_25";
130331
+ const metricDescription = "_metricDescription_sacr7_33";
130332
+ const popup = "_popup_sacr7_41";
130333
+ const metricFilter$1 = "_metricFilter_sacr7_49";
130334
+ const popupIcon = "_popupIcon_sacr7_57";
130335
+ const popupMenu = "_popupMenu_sacr7_65";
130336
+ const popupItem = "_popupItem_sacr7_73";
130337
+ const popupItemIcon = "_popupItemIcon_sacr7_81";
130338
+ const csvBtn = "_csvBtn_sacr7_89";
130339
+ const deleteBtn = "_deleteBtn_sacr7_97";
130340
+ const metricData = "_metricData_sacr7_105";
130341
+ const metricTable = "_metricTable_sacr7_113";
130342
+ const singleValueData = "_singleValueData_sacr7_121";
130343
+ const singleValue = "_singleValue_sacr7_121";
130344
+ const noData = "_noData_sacr7_137";
130345
+ const noDataContent = "_noDataContent_sacr7_145";
130346
+ const noDataText = "_noDataText_sacr7_153";
130347
+ const loading$1 = "_loading_sacr7_161";
130348
+ const features = "_features_sacr7_169";
130349
+ const fullscreen$1 = "_fullscreen_sacr7_177";
130350
+ const deleteModal = "_deleteModal_sacr7_185";
130351
+ const cancelBtn = "_cancelBtn_sacr7_193";
130352
+ const warningIcon = "_warningIcon_sacr7_201";
130353
+ const downloadCsv = "_downloadCsv_sacr7_209";
130354
+ const downloadCsvWrapper = "_downloadCsvWrapper_sacr7_217";
130355
+ const downloadCsvHeader = "_downloadCsvHeader_sacr7_225";
130356
+ const downloadCsvFooter = "_downloadCsvFooter_sacr7_233";
130357
+ const downloadCsvCancelBtn = "_downloadCsvCancelBtn_sacr7_241";
130358
+ const downloadCsvDisableBtn = "_downloadCsvDisableBtn_sacr7_247";
130359
+ const downloadCsvNote = "_downloadCsvNote_sacr7_253";
130360
+ const downloadCsvExpiredNote = "_downloadCsvExpiredNote_sacr7_261";
130361
+ const downloadCsvNoteText = "_downloadCsvNoteText_sacr7_267";
130362
+ const downloadCsvSuccessNote = "_downloadCsvSuccessNote_sacr7_273";
130363
+ const downloadCsvSuccessText = "_downloadCsvSuccessText_sacr7_279";
130364
+ const downloadUrlTimeline = "_downloadUrlTimeline_sacr7_301";
130365
+ const timeLineItem = "_timeLineItem_sacr7_309";
130366
+ const timeLineActiveIcon = "_timeLineActiveIcon_sacr7_317";
130367
+ const timeLineIcon = "_timeLineIcon_sacr7_325";
130368
+ const timeLineItemline = "_timeLineItemline_sacr7_333";
130369
+ const downloadCsvLoading = "_downloadCsvLoading_sacr7_341";
130370
+ const downloadCsvLoadingIcon = "_downloadCsvLoadingIcon_sacr7_349";
130371
+ const downloadCsvLoadingText = "_downloadCsvLoadingText_sacr7_357";
130372
+ const timeLineCheckedIcon = "_timeLineCheckedIcon_sacr7_365";
130373
+ const timeLineCheckedIconWrapper = "_timeLineCheckedIconWrapper_sacr7_373";
130374
+ const downloadCsvBackBtnWrapper = "_downloadCsvBackBtnWrapper_sacr7_381";
130375
+ const downloadCsvBackBtnText = "_downloadCsvBackBtnText_sacr7_389";
130376
+ const downloadCsvHeaderText = "_downloadCsvHeaderText_sacr7_411";
130377
+ const downloadCsvTabContainer = "_downloadCsvTabContainer_sacr7_419";
130378
+ const downloadCsvActiveTab = "_downloadCsvActiveTab_sacr7_427";
130379
+ const downloadCsvTab = "_downloadCsvTab_sacr7_419";
130380
+ const downloadCsvActiveTabText = "_downloadCsvActiveTabText_sacr7_443";
130223
130381
  var styles$a = {
130224
130382
  cardContainer,
130225
130383
  listHeader,
@@ -130258,8 +130416,8 @@ var styles$a = {
130258
130416
  downloadCsvNoteText,
130259
130417
  downloadCsvSuccessNote,
130260
130418
  downloadCsvSuccessText,
130261
- "tab-border-bottom": "_tab-border-bottom_pprak_285",
130262
- "download-info-text": "_download-info-text_pprak_293",
130419
+ "tab-border-bottom": "_tab-border-bottom_sacr7_285",
130420
+ "download-info-text": "_download-info-text_sacr7_293",
130263
130421
  downloadUrlTimeline,
130264
130422
  timeLineItem,
130265
130423
  timeLineActiveIcon,
@@ -132613,65 +132771,6 @@ const MetricTable = ({
132613
132771
  })]
132614
132772
  });
132615
132773
  };
132616
- const AppliedFilter = ({
132617
- appliedFilter,
132618
- setAppliedFilters,
132619
- onRemove
132620
- }) => {
132621
- return /* @__PURE__ */ jsx("div", {
132622
- className: styles$s.appliedfilters,
132623
- children: appliedFilter.map((filter2) => /* @__PURE__ */ jsxs("div", {
132624
- className: styles$s.appliedFilterTag,
132625
- children: [/* @__PURE__ */ jsx(Text, {
132626
- variant: "p",
132627
- styleClass: "font-14",
132628
- className: styles$s.textBold,
132629
- children: filter2.column
132630
- }), /* @__PURE__ */ jsx(Text, {
132631
- variant: "p",
132632
- styleClass: "font-14",
132633
- children: "is"
132634
- }), filter2.as !== "string" && filter2.as !== "boolean" && filter2.as !== "default" && /* @__PURE__ */ jsx(Text, {
132635
- variant: "p",
132636
- styleClass: "font-14",
132637
- children: "between"
132638
- }), /* @__PURE__ */ jsx(Text, {
132639
- variant: "p",
132640
- styleClass: "font-14",
132641
- className: styles$s.textBold,
132642
- children: Array.isArray(filter2.value) ? filter2.as === "string" ? filter2.value.join(", ") : filter2.value.join(" & ") : typeof filter2.value === "string" && filter2.as === "number" ? filter2.value.replace("AND", "&") : typeof filter2.value === "string" && filter2.as === "date" ? filter2.value.split(" ").slice(2).join(" ").replace("AND", "&") : filter2.value
132643
- }), /* @__PURE__ */ jsx(Button, {
132644
- variant: "secondary",
132645
- type: "button",
132646
- onClick: () => {
132647
- setAppliedFilters((prev) => prev.filter((a4) => a4.column !== filter2.column));
132648
- const filterColumns = appliedFilter.filter((c3) => c3.column !== filter2.column).map((field2) => {
132649
- const col = {
132650
- column: field2.column,
132651
- operator: field2.operator,
132652
- as: field2.as
132653
- };
132654
- const formattedValue = field2.as === "date" || field2.as === "number" ? field2.value : getFormattedFilterValue({
132655
- operator: field2.operator,
132656
- value: field2.value
132657
- });
132658
- if (formattedValue != null) {
132659
- Object.assign(col, {
132660
- ...col,
132661
- value: formattedValue
132662
- });
132663
- }
132664
- return col;
132665
- });
132666
- onRemove(filterColumns);
132667
- },
132668
- children: /* @__PURE__ */ jsx(Icons, {
132669
- name: "close-icon"
132670
- })
132671
- })]
132672
- }))
132673
- });
132674
- };
132675
132774
  var index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
132676
132775
  __proto__: null,
132677
132776
  Button,
@@ -133329,7 +133428,6 @@ const EmbeddedDashboard = e__default.memo(({
133329
133428
  data,
133330
133429
  isLoading
133331
133430
  } = useDashboardContext();
133332
- const [appliedfilters2, setAppliedFilters] = useState([]);
133333
133431
  const [isShowMetricCreateModal, setShowMetricCreateModal] = useState(false);
133334
133432
  const [globalFilters, setGlobalFilters] = useState({
133335
133433
  tableName: "",
@@ -133351,7 +133449,6 @@ const EmbeddedDashboard = e__default.memo(({
133351
133449
  return [adminThemeData == null ? void 0 : adminThemeData.themes[0], colors2];
133352
133450
  }, [adminThemeData == null ? void 0 : adminThemeData.themes[0]]);
133353
133451
  useApplyAdminTheme(adminTheme);
133354
- const globalFilterRef = useRef(null);
133355
133452
  return /* @__PURE__ */ jsx(Fragment, {
133356
133453
  children: /* @__PURE__ */ jsxs("div", {
133357
133454
  className: styles$M["embedDashboard-container"],
@@ -133392,46 +133489,13 @@ const EmbeddedDashboard = e__default.memo(({
133392
133489
  })]
133393
133490
  }), /* @__PURE__ */ jsxs("div", {
133394
133491
  className: styles$M["embedDashboard-wrapper"],
133395
- children: [data.externalDashboard.filters.length ? /* @__PURE__ */ jsxs(Fragment, {
133396
- children: [/* @__PURE__ */ jsx(PopoverMenu, {
133397
- button: /* @__PURE__ */ jsxs("div", {
133398
- className: styles$M.filterButton,
133399
- ref: globalFilterRef,
133400
- children: [/* @__PURE__ */ jsxs("div", {
133401
- className: styles$M.filterText,
133402
- children: [/* @__PURE__ */ jsx(Icons, {
133403
- name: "filter-icon"
133404
- }), " Filters"]
133405
- }), appliedfilters2.length === 0 ? /* @__PURE__ */ jsx("div", {}) : /* @__PURE__ */ jsx("span", {
133406
- className: styles$M.filterLength,
133407
- children: appliedfilters2.length
133408
- })]
133409
- }),
133410
- menuClass: "w-[400px] ml-[40px]",
133411
- position: "bottom-left",
133412
- children: /* @__PURE__ */ jsx(GlobalFilters, {
133413
- companyId: data.companyId,
133414
- externalDashboardId: data.externalDashboard.id,
133415
- filters: data.externalDashboard.filters,
133416
- onApply: (values) => {
133417
- var _a3;
133418
- setGlobalFilters(values);
133419
- (_a3 = globalFilterRef.current) == null ? void 0 : _a3.click();
133420
- },
133421
- appliedfilters: appliedfilters2,
133422
- setAppliedFilters
133423
- })
133424
- }), /* @__PURE__ */ jsx(AppliedFilter, {
133425
- appliedFilter: appliedfilters2,
133426
- setAppliedFilters,
133427
- onRemove: (filters2) => {
133428
- var _a3, _b3;
133429
- return setGlobalFilters({
133430
- tableName: (_b3 = (_a3 = data.externalDashboard) == null ? void 0 : _a3.filters) == null ? void 0 : _b3[0].tableName,
133431
- filters: filters2
133432
- });
133433
- }
133434
- })]
133492
+ children: [data.externalDashboard.filters.length ? /* @__PURE__ */ jsx(GlobalFilters, {
133493
+ companyId: data.companyId,
133494
+ externalDashboardId: data.externalDashboard.id,
133495
+ filters: data.externalDashboard.filters,
133496
+ onApply: (values) => {
133497
+ setGlobalFilters(values);
133498
+ }
133435
133499
  }) : null, /* @__PURE__ */ jsx(ExternalMetricList, {
133436
133500
  client: data.clientId,
133437
133501
  isLiveMode: data.isLiveMode,