@fctc/sme-widget-ui 2.7.4 → 2.7.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.
package/dist/index.mjs CHANGED
@@ -15654,38 +15654,123 @@ var PopupFilter = ({
15654
15654
  };
15655
15655
 
15656
15656
  // src/widgets/advanced/search/search-item/index.tsx
15657
- import { useEffect as useEffect7, useState as useState5 } from "react";
15657
+ import { useState as useState5, useEffect as useEffect7 } from "react";
15658
+
15659
+ // src/widgets/advanced/search/search-list/index.tsx
15660
+ import { jsx as jsx63, jsxs as jsxs39 } from "react/jsx-runtime";
15661
+ var SearchList = ({
15662
+ handleAddTagSearch,
15663
+ handleMouseEnter,
15664
+ handleMouseLeave,
15665
+ searchBy,
15666
+ searchString,
15667
+ hoveredIndexSearchList
15668
+ }) => {
15669
+ const { t: t3 } = useI18n();
15670
+ return /* @__PURE__ */ jsx63(
15671
+ "div",
15672
+ {
15673
+ style: {
15674
+ position: "absolute",
15675
+ top: "calc(100% + 5px)",
15676
+ left: 0,
15677
+ right: 0,
15678
+ zIndex: 31
15679
+ },
15680
+ className: `${searchString === "" ? "hidden" : "block"} w-full overflow-x-auto rounded-[0.25rem] border-none bg-white shadow-lg`,
15681
+ children: searchBy?.map((searchItem, index4) => {
15682
+ if (searchItem?.type === "date" || searchItem?.type === "datetime") {
15683
+ if (!validateAndParseDate(searchString, searchItem?.type === "datetime"))
15684
+ return;
15685
+ }
15686
+ return /* @__PURE__ */ jsxs39(
15687
+ "button",
15688
+ {
15689
+ onClick: () => {
15690
+ typeof handleAddTagSearch === "function" && handleAddTagSearch({
15691
+ title: searchItem?.title,
15692
+ name: searchItem?.name,
15693
+ value: searchString,
15694
+ domain: searchItem?.filter_domain,
15695
+ operator: searchItem?.operator,
15696
+ type: SearchType.SEARCH,
15697
+ modelType: searchItem?.type,
15698
+ widget: searchItem?.widget,
15699
+ dataIndex: searchItem?.dataIndex
15700
+ });
15701
+ },
15702
+ onMouseEnter: () => typeof handleMouseEnter === "function" && handleMouseEnter(index4),
15703
+ onMouseLeave: () => typeof handleMouseLeave === "function" && handleMouseLeave(),
15704
+ style: {
15705
+ display: "block",
15706
+ width: "100%",
15707
+ cursor: "pointer",
15708
+ whiteSpace: "nowrap",
15709
+ padding: "2px 12px",
15710
+ paddingTop: "4px",
15711
+ paddingBottom: "4px",
15712
+ textAlign: "left",
15713
+ transitionDuration: "0ms",
15714
+ backgroundColor: hoveredIndexSearchList === index4 ? "rgba(0,0,0,0.08)" : "white",
15715
+ fontSize: "14px"
15716
+ },
15717
+ children: [
15718
+ t3("search"),
15719
+ " ",
15720
+ /* @__PURE__ */ jsx63("span", { className: "font-bold", children: searchItem?.title }),
15721
+ " ",
15722
+ t3("for"),
15723
+ ":",
15724
+ " ",
15725
+ /* @__PURE__ */ jsx63("span", { className: "custom-input-result text-primary font-bold italic", children: searchString })
15726
+ ]
15727
+ },
15728
+ "header-" + index4 + 1
15729
+ );
15730
+ })
15731
+ }
15732
+ );
15733
+ };
15658
15734
 
15659
15735
  // src/widgets/advanced/search/tag-search/index.tsx
15660
15736
  import { Fragment as Fragment8 } from "react";
15661
- import { Fragment as Fragment9, jsx as jsx63, jsxs as jsxs39 } from "react/jsx-runtime";
15737
+ import { Fragment as Fragment9, jsx as jsx64, jsxs as jsxs40 } from "react/jsx-runtime";
15662
15738
  var TagSearch = ({
15663
15739
  removeSearchItems,
15664
15740
  selectedTags,
15665
15741
  filterBy,
15666
- setFilterBy,
15667
- setGroupBy
15742
+ setFilterBy
15668
15743
  }) => {
15744
+ const { t: t3 } = useI18n();
15669
15745
  return selectedTags?.length > 0 && selectedTags?.map((tag, index4) => {
15670
15746
  if (tag?.values?.length > 0) {
15671
15747
  if (tag?.type !== "group_by") {
15672
- return /* @__PURE__ */ jsxs39(
15748
+ return /* @__PURE__ */ jsxs40(
15673
15749
  "div",
15674
15750
  {
15675
15751
  className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
15676
15752
  children: [
15677
- /* @__PURE__ */ jsx63("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.type === SearchType.SEARCH ? tag?.title : /* @__PURE__ */ jsx63(FilterIcon, {}) }),
15678
- /* @__PURE__ */ jsx63("div", { className: "pl-2 align-middle text-[#495057] text-[14px]", children: tag.values.map((value, idx) => {
15679
- return /* @__PURE__ */ jsxs39(Fragment8, { children: [
15680
- /* @__PURE__ */ jsx63("span", { children: value }),
15681
- idx < tag.values.length - 1 && /* @__PURE__ */ jsxs39("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
15682
- " ",
15683
- instance.t("or"),
15684
- " "
15685
- ] })
15686
- ] }, idx);
15687
- }) }),
15688
- /* @__PURE__ */ jsx63(
15753
+ /* @__PURE__ */ jsx64("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.type === SearchType.SEARCH ? tag?.title : /* @__PURE__ */ jsx64(FilterIcon, {}) }),
15754
+ /* @__PURE__ */ jsx64(
15755
+ "div",
15756
+ {
15757
+ style: {
15758
+ paddingLeft: "8px"
15759
+ },
15760
+ className: "align-middle text-[#495057] text-[14px]",
15761
+ children: tag.values.map((value, idx) => {
15762
+ return /* @__PURE__ */ jsxs40(Fragment8, { children: [
15763
+ /* @__PURE__ */ jsx64("span", { children: value }),
15764
+ idx < tag.values.length - 1 && /* @__PURE__ */ jsxs40("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
15765
+ " ",
15766
+ t3("or"),
15767
+ " "
15768
+ ] })
15769
+ ] }, idx);
15770
+ })
15771
+ }
15772
+ ),
15773
+ /* @__PURE__ */ jsx64(
15689
15774
  "button",
15690
15775
  {
15691
15776
  className: "px-2 text-sm font-bold",
@@ -15702,7 +15787,7 @@ var TagSearch = ({
15702
15787
  );
15703
15788
  }
15704
15789
  },
15705
- children: /* @__PURE__ */ jsx63(CloseIcon, { className: "size-4 cursor-pointer" })
15790
+ children: /* @__PURE__ */ jsx64(CloseIcon, { className: "size-4 cursor-pointer" })
15706
15791
  }
15707
15792
  )
15708
15793
  ]
@@ -15710,41 +15795,35 @@ var TagSearch = ({
15710
15795
  "selected-tag-" + index4
15711
15796
  );
15712
15797
  } else if (tag?.type === "group_by") {
15713
- return /* @__PURE__ */ jsx63(
15798
+ return /* @__PURE__ */ jsx64(
15714
15799
  "div",
15715
15800
  {
15716
15801
  className: "flex min-h-full overflow-hidden",
15717
- children: /* @__PURE__ */ jsx63("div", { className: "flex flex-wrap items-center gap-2 align-middle text-[#495057] text-[14px]", children: tag?.values?.length > 0 && tag?.values.map(
15718
- (value, indexValue) => value?.strings?.length > 0 && /* @__PURE__ */ jsxs39(
15802
+ children: /* @__PURE__ */ jsx64("div", { className: "flex flex-wrap items-center gap-2 align-middle text-[#495057] text-[14px]", children: tag?.values?.length > 0 && tag?.values.map(
15803
+ (value, indexValue) => value?.strings?.length > 0 && /* @__PURE__ */ jsxs40(
15719
15804
  "div",
15720
15805
  {
15721
15806
  className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
15722
15807
  children: [
15723
- /* @__PURE__ */ jsx63("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: /* @__PURE__ */ jsx63(GroupByIcon, {}) }),
15724
- value?.strings?.map((string, idx) => /* @__PURE__ */ jsxs39(Fragment9, { children: [
15725
- /* @__PURE__ */ jsx63("span", { children: string }),
15726
- idx < value?.strings.length - 1 && /* @__PURE__ */ jsxs39("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
15808
+ /* @__PURE__ */ jsx64("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: /* @__PURE__ */ jsx64(GroupByIcon, {}) }),
15809
+ value?.strings?.map((string, idx) => /* @__PURE__ */ jsxs40(Fragment9, { children: [
15810
+ /* @__PURE__ */ jsx64("span", { children: string }),
15811
+ idx < value?.strings.length - 1 && /* @__PURE__ */ jsxs40("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
15727
15812
  " ",
15728
15813
  "> ",
15729
15814
  " "
15730
15815
  ] })
15731
15816
  ] })),
15732
- /* @__PURE__ */ jsx63(
15817
+ /* @__PURE__ */ jsx64(
15733
15818
  "button",
15734
15819
  {
15735
15820
  className: "pr-2 text-sm font-bold",
15736
15821
  onClick: () => {
15737
15822
  if (tag?.type === SearchType.GROUP) {
15738
15823
  typeof removeSearchItems === "function" && removeSearchItems(`${SearchType.GROUP}`);
15739
- setGroupBy(
15740
- (prev2) => prev2?.map((item) => ({
15741
- ...item,
15742
- active: false
15743
- }))
15744
- );
15745
15824
  }
15746
15825
  },
15747
- children: /* @__PURE__ */ jsx63(CloseIcon, { className: "size-4 cursor-pointer" })
15826
+ children: /* @__PURE__ */ jsx64(CloseIcon, { className: "size-4 cursor-pointer" })
15748
15827
  }
15749
15828
  )
15750
15829
  ]
@@ -15760,75 +15839,6 @@ var TagSearch = ({
15760
15839
  });
15761
15840
  };
15762
15841
 
15763
- // src/widgets/advanced/search/search-list/index.tsx
15764
- import { jsx as jsx64, jsxs as jsxs40 } from "react/jsx-runtime";
15765
- var SearchList = ({
15766
- handleAddTagSearch,
15767
- handleMouseEnter,
15768
- handleMouseLeave,
15769
- searchBy,
15770
- searchString,
15771
- hoveredIndexSearchList
15772
- }) => {
15773
- const { t: t3 } = useI18n();
15774
- return /* @__PURE__ */ jsx64(
15775
- "div",
15776
- {
15777
- style: {
15778
- top: "calc(100% + 3px)"
15779
- },
15780
- className: `${searchString === "" ? "hidden" : "block"} absolute left-0 right-0 top-[calc(100%_+_3px)] z-[31] w-full overflow-x-auto rounded-[0.25rem] border-none bg-white shadow-lg`,
15781
- children: searchBy?.map((searchItem, index4) => {
15782
- if (searchItem?.type === "date" || searchItem?.type === "datetime") {
15783
- if (!validateAndParseDate(searchString, searchItem?.type === "datetime"))
15784
- return;
15785
- }
15786
- return /* @__PURE__ */ jsxs40(
15787
- "button",
15788
- {
15789
- onClick: () => {
15790
- typeof handleAddTagSearch === "function" && handleAddTagSearch({
15791
- title: searchItem?.title,
15792
- name: searchItem?.name,
15793
- value: searchString,
15794
- domain: searchItem?.filter_domain,
15795
- operator: searchItem?.operator,
15796
- type: SearchType.SEARCH,
15797
- modelType: searchItem?.type,
15798
- widget: searchItem?.widget,
15799
- dataIndex: searchItem?.dataIndex
15800
- });
15801
- },
15802
- onMouseEnter: () => typeof handleMouseEnter === "function" && handleMouseEnter(index4),
15803
- onMouseLeave: () => typeof handleMouseLeave === "function" && handleMouseLeave(),
15804
- className: `block w-full cursor-pointer whitespace-nowrap p-2 px-3 py-1 text-left !duration-0 hover:!bg-[rgba(0,0,0,0.08)] hover:text-inherit text-sm ${hoveredIndexSearchList === index4 ? "bg-[rgba(0,0,0,0.08)]" : "bg-white"}`,
15805
- children: [
15806
- t3("search"),
15807
- " ",
15808
- /* @__PURE__ */ jsx64("span", { className: "font-bold", children: searchItem?.title }),
15809
- " ",
15810
- t3("for"),
15811
- ":",
15812
- " ",
15813
- /* @__PURE__ */ jsx64(
15814
- "span",
15815
- {
15816
- style: {
15817
- color: "var(--color-primary)"
15818
- },
15819
- className: "custom-input-result text-primary font-bold italic",
15820
- children: searchString
15821
- }
15822
- )
15823
- ]
15824
- },
15825
- "header-" + index4 + 1
15826
- );
15827
- })
15828
- }
15829
- );
15830
- };
15831
-
15832
15842
  // src/widgets/advanced/search/search-item/index.tsx
15833
15843
  import { Fragment as Fragment10, jsx as jsx65, jsxs as jsxs41 } from "react/jsx-runtime";
15834
15844
  var Search = ({
@@ -15853,7 +15863,11 @@ var Search = ({
15853
15863
  selectedRowKeys,
15854
15864
  domainSearch,
15855
15865
  evalJSONContext,
15856
- clearSearch
15866
+ clearSearch,
15867
+ onKeyDown,
15868
+ handleMouseEnter,
15869
+ handleMouseLeave,
15870
+ hoveredIndexSearchList
15857
15871
  }) => {
15858
15872
  const { t: t3 } = useI18n();
15859
15873
  const [showPopupFilter, setShowPopupFilter] = useState5(false);
@@ -15951,60 +15965,68 @@ var Search = ({
15951
15965
  "div",
15952
15966
  {
15953
15967
  ref: popupFilterRef,
15954
- className: `search gap-[8px] p-2 items-center flex !order-3 xl:!order-2 bg-white custom-search-input relative flex-1 xl:min-w-[480px] xl:flex-1 rounded-[10px] shadow-[0px_1px_3px_rgba(16,24,40,0.1),0px_1px_2px_rgba(16,24,40,0.06)] min-h-[40px] border border-[var(--stroke-default)]`,
15968
+ className: `search ${selectedRowKeys?.length <= 0 ? "flex" : "hidden"} bg-white custom-search-input py-[8px] px-[16px] relative items-center w-full flex-1 xl:flex-1 rounded-[10px] bg-grey-100 shadow-[0px_1px_3px_rgba(16,24,40,0.1),0px_1px_2px_rgba(16,24,40,0.06)] min-h-[40px] border border-[#F2F2F2]`,
15955
15969
  children: [
15956
- /* @__PURE__ */ jsx65("div", { className: "size-5", children: /* @__PURE__ */ jsx65(SearchIcon, {}) }),
15957
- /* @__PURE__ */ jsxs41("div", { className: "flex flex-1 flex-wrap items-center gap-[8px]", children: [
15958
- /* @__PURE__ */ jsx65(
15959
- TagSearch,
15960
- {
15961
- removeSearchItems,
15962
- selectedTags,
15963
- filterBy,
15964
- setFilterBy,
15965
- setGroupBy
15966
- }
15967
- ),
15968
- /* @__PURE__ */ jsx65(
15969
- "input",
15970
- {
15971
- value: searchString,
15972
- className: "h-5 w-fit flex-1 border-none bg-transparent outline-none min-w-[50px] text-sm",
15973
- placeholder: t3("search..."),
15974
- onChange: (e3) => {
15975
- onSearchString(e3.target.value);
15976
- setShowPopupFilter(false);
15977
- },
15978
- onKeyUp: (e3) => e3.preventDefault()
15979
- }
15980
- ),
15970
+ /* @__PURE__ */ jsxs41(
15971
+ "div",
15972
+ {
15973
+ className: `relative flex md:min-w-[400px] max-w-full items-center gap-[8px] w-full ${(showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && "border-r border-[rgba(242,242,242,1)]"}`,
15974
+ children: [
15975
+ /* @__PURE__ */ jsx65("div", { className: "min-h-5 min-w-5", children: /* @__PURE__ */ jsx65(SearchIcon, {}) }),
15976
+ /* @__PURE__ */ jsxs41("div", { className: "flex flex-1 flex-wrap items-center gap-[8px]", children: [
15977
+ /* @__PURE__ */ jsx65(
15978
+ TagSearch,
15979
+ {
15980
+ removeSearchItems,
15981
+ selectedTags,
15982
+ filterBy,
15983
+ setFilterBy
15984
+ }
15985
+ ),
15986
+ /* @__PURE__ */ jsx65(
15987
+ "input",
15988
+ {
15989
+ value: searchString,
15990
+ className: "min-h-[25px] w-fit flex-1 border-none bg-transparent outline-none min-w-[50px] text-sm",
15991
+ placeholder: t3("search..."),
15992
+ onChange: (e3) => {
15993
+ onSearchString(e3.target.value);
15994
+ setShowPopupFilter(false);
15995
+ },
15996
+ onKeyDown,
15997
+ onKeyUp: (e3) => e3.preventDefault()
15998
+ }
15999
+ ),
16000
+ /* @__PURE__ */ jsx65(
16001
+ SearchList,
16002
+ {
16003
+ handleAddTagSearch,
16004
+ searchBy,
16005
+ searchString,
16006
+ handleMouseEnter,
16007
+ handleMouseLeave,
16008
+ hoveredIndexSearchList
16009
+ }
16010
+ )
16011
+ ] })
16012
+ ]
16013
+ }
16014
+ ),
16015
+ (showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && /* @__PURE__ */ jsxs41(Fragment10, { children: [
15981
16016
  /* @__PURE__ */ jsx65(
15982
- SearchList,
15983
- {
15984
- handleAddTagSearch,
15985
- searchBy,
15986
- searchString
15987
- }
15988
- )
15989
- ] }),
15990
- showFiltersGroups && /* @__PURE__ */ jsxs41(Fragment10, { children: [
15991
- /* @__PURE__ */ jsxs41(
15992
16017
  "div",
15993
16018
  {
15994
- className: `flex h-full gap-2 cursor-pointer items-center justify-center max-w-fit`,
16019
+ className: `flex h-full cursor-pointer items-center justify-center px-[10px] max-w-fit`,
15995
16020
  onClick: (e3) => {
15996
16021
  e3.stopPropagation();
15997
16022
  setShowPopupFilter((prev2) => !prev2);
15998
16023
  },
15999
- children: [
16000
- /* @__PURE__ */ jsx65("div", { className: "w-[1px] h-[28px] bg-[var(--stroke-default)]" }),
16001
- /* @__PURE__ */ jsx65(
16002
- ChevronBottomIcon,
16003
- {
16004
- className: `h-5 w-5 min-w-fit transition-all ${showPopupFilter ? "rotate-180 " : ""}`
16005
- }
16006
- )
16007
- ]
16024
+ children: /* @__PURE__ */ jsx65("button", { className: "w-max cursor-pointer", children: /* @__PURE__ */ jsx65(
16025
+ ChevronBottomIcon,
16026
+ {
16027
+ className: `h-5 w-5 min-w-fit transition-all ${showPopupFilter ? "rotate-180 " : ""}`
16028
+ }
16029
+ ) })
16008
16030
  }
16009
16031
  ),
16010
16032
  showPopupFilter && /* @__PURE__ */ jsx65(
package/dist/widgets.css CHANGED
@@ -1,10 +1,10 @@
1
1
  @charset "UTF-8";
2
+ @import "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap";
2
3
 
3
4
  /* src/index.css */
4
5
  @tailwind base;
5
6
  @tailwind components;
6
7
  @tailwind utilities;
7
- @import url(https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap);
8
8
  * {
9
9
  font-family: "Inter", sans-serif;
10
10
  }
@@ -136,7 +136,7 @@ declare const EmptyTable: () => JSX.Element;
136
136
 
137
137
  declare const Login: React__default.FC<LoginProps>;
138
138
 
139
- declare const Search: ({ removeSearchItems, selectedTags, filterBy, setFilterBy, searchString, onSearchString, handleAddTagSearch, searchBy, groupBy, showFiltersGroups, setGroupBy, setSelectedRowKeys, setDomainList, setPage, fieldsList, viewData, context, aid, selectedRowKeys, domainSearch, evalJSONContext, clearSearch, }: any) => JSX.Element;
139
+ declare const Search: ({ removeSearchItems, selectedTags, filterBy, setFilterBy, searchString, onSearchString, handleAddTagSearch, searchBy, groupBy, showFiltersGroups, setGroupBy, setSelectedRowKeys, setDomainList, setPage, fieldsList, viewData, context, aid, selectedRowKeys, domainSearch, evalJSONContext, clearSearch, onKeyDown, handleMouseEnter, handleMouseLeave, hoveredIndexSearchList, }: any) => JSX.Element;
140
140
 
141
141
  interface IActiveBadgeProps extends IInputFieldProps {
142
142
  type: any;
package/dist/widgets.d.ts CHANGED
@@ -136,7 +136,7 @@ declare const EmptyTable: () => JSX.Element;
136
136
 
137
137
  declare const Login: React__default.FC<LoginProps>;
138
138
 
139
- declare const Search: ({ removeSearchItems, selectedTags, filterBy, setFilterBy, searchString, onSearchString, handleAddTagSearch, searchBy, groupBy, showFiltersGroups, setGroupBy, setSelectedRowKeys, setDomainList, setPage, fieldsList, viewData, context, aid, selectedRowKeys, domainSearch, evalJSONContext, clearSearch, }: any) => JSX.Element;
139
+ declare const Search: ({ removeSearchItems, selectedTags, filterBy, setFilterBy, searchString, onSearchString, handleAddTagSearch, searchBy, groupBy, showFiltersGroups, setGroupBy, setSelectedRowKeys, setDomainList, setPage, fieldsList, viewData, context, aid, selectedRowKeys, domainSearch, evalJSONContext, clearSearch, onKeyDown, handleMouseEnter, handleMouseLeave, hoveredIndexSearchList, }: any) => JSX.Element;
140
140
 
141
141
  interface IActiveBadgeProps extends IInputFieldProps {
142
142
  type: any;