@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/widgets.mjs CHANGED
@@ -14721,7 +14721,190 @@ var PopupFilter = ({
14721
14721
  };
14722
14722
 
14723
14723
  // src/widgets/advanced/search/search-item/index.tsx
14724
- import { useEffect as useEffect7, useState as useState5 } from "react";
14724
+ import { useState as useState5, useEffect as useEffect7 } from "react";
14725
+
14726
+ // src/widgets/advanced/search/search-list/index.tsx
14727
+ import { jsx as jsx63, jsxs as jsxs39 } from "react/jsx-runtime";
14728
+ var SearchList = ({
14729
+ handleAddTagSearch,
14730
+ handleMouseEnter,
14731
+ handleMouseLeave,
14732
+ searchBy,
14733
+ searchString,
14734
+ hoveredIndexSearchList
14735
+ }) => {
14736
+ const { t: t3 } = useI18n();
14737
+ return /* @__PURE__ */ jsx63(
14738
+ "div",
14739
+ {
14740
+ style: {
14741
+ position: "absolute",
14742
+ top: "calc(100% + 5px)",
14743
+ left: 0,
14744
+ right: 0,
14745
+ zIndex: 31
14746
+ },
14747
+ className: `${searchString === "" ? "hidden" : "block"} w-full overflow-x-auto rounded-[0.25rem] border-none bg-white shadow-lg`,
14748
+ children: searchBy?.map((searchItem, index4) => {
14749
+ if (searchItem?.type === "date" || searchItem?.type === "datetime") {
14750
+ if (!validateAndParseDate(searchString, searchItem?.type === "datetime"))
14751
+ return;
14752
+ }
14753
+ return /* @__PURE__ */ jsxs39(
14754
+ "button",
14755
+ {
14756
+ onClick: () => {
14757
+ typeof handleAddTagSearch === "function" && handleAddTagSearch({
14758
+ title: searchItem?.title,
14759
+ name: searchItem?.name,
14760
+ value: searchString,
14761
+ domain: searchItem?.filter_domain,
14762
+ operator: searchItem?.operator,
14763
+ type: SearchType.SEARCH,
14764
+ modelType: searchItem?.type,
14765
+ widget: searchItem?.widget,
14766
+ dataIndex: searchItem?.dataIndex
14767
+ });
14768
+ },
14769
+ onMouseEnter: () => typeof handleMouseEnter === "function" && handleMouseEnter(index4),
14770
+ onMouseLeave: () => typeof handleMouseLeave === "function" && handleMouseLeave(),
14771
+ style: {
14772
+ display: "block",
14773
+ width: "100%",
14774
+ cursor: "pointer",
14775
+ whiteSpace: "nowrap",
14776
+ padding: "2px 12px",
14777
+ paddingTop: "4px",
14778
+ paddingBottom: "4px",
14779
+ textAlign: "left",
14780
+ transitionDuration: "0ms",
14781
+ backgroundColor: hoveredIndexSearchList === index4 ? "rgba(0,0,0,0.08)" : "white",
14782
+ fontSize: "14px"
14783
+ },
14784
+ children: [
14785
+ t3("search"),
14786
+ " ",
14787
+ /* @__PURE__ */ jsx63("span", { className: "font-bold", children: searchItem?.title }),
14788
+ " ",
14789
+ t3("for"),
14790
+ ":",
14791
+ " ",
14792
+ /* @__PURE__ */ jsx63("span", { className: "custom-input-result text-primary font-bold italic", children: searchString })
14793
+ ]
14794
+ },
14795
+ "header-" + index4 + 1
14796
+ );
14797
+ })
14798
+ }
14799
+ );
14800
+ };
14801
+
14802
+ // src/widgets/advanced/search/tag-search/index.tsx
14803
+ import { Fragment as Fragment8 } from "react";
14804
+ import { Fragment as Fragment9, jsx as jsx64, jsxs as jsxs40 } from "react/jsx-runtime";
14805
+ var TagSearch = ({
14806
+ removeSearchItems,
14807
+ selectedTags,
14808
+ filterBy,
14809
+ setFilterBy
14810
+ }) => {
14811
+ const { t: t3 } = useI18n();
14812
+ return selectedTags?.length > 0 && selectedTags?.map((tag, index4) => {
14813
+ if (tag?.values?.length > 0) {
14814
+ if (tag?.type !== "group_by") {
14815
+ return /* @__PURE__ */ jsxs40(
14816
+ "div",
14817
+ {
14818
+ className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
14819
+ children: [
14820
+ /* @__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, {}) }),
14821
+ /* @__PURE__ */ jsx64(
14822
+ "div",
14823
+ {
14824
+ style: {
14825
+ paddingLeft: "8px"
14826
+ },
14827
+ className: "align-middle text-[#495057] text-[14px]",
14828
+ children: tag.values.map((value, idx) => {
14829
+ return /* @__PURE__ */ jsxs40(Fragment8, { children: [
14830
+ /* @__PURE__ */ jsx64("span", { children: value }),
14831
+ idx < tag.values.length - 1 && /* @__PURE__ */ jsxs40("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
14832
+ " ",
14833
+ t3("or"),
14834
+ " "
14835
+ ] })
14836
+ ] }, idx);
14837
+ })
14838
+ }
14839
+ ),
14840
+ /* @__PURE__ */ jsx64(
14841
+ "button",
14842
+ {
14843
+ className: "px-2 text-sm font-bold",
14844
+ onClick: () => {
14845
+ typeof removeSearchItems === "function" && removeSearchItems(
14846
+ tag?.type === SearchType.FILTER ? `${SearchType.FILTER}_${tag?.name}` : tag?.name
14847
+ );
14848
+ if (tag?.type === SearchType.FILTER) {
14849
+ setFilterBy(
14850
+ filterBy?.map((item) => ({
14851
+ ...item,
14852
+ active: false
14853
+ }))
14854
+ );
14855
+ }
14856
+ },
14857
+ children: /* @__PURE__ */ jsx64(CloseIcon, { className: "size-4 cursor-pointer" })
14858
+ }
14859
+ )
14860
+ ]
14861
+ },
14862
+ "selected-tag-" + index4
14863
+ );
14864
+ } else if (tag?.type === "group_by") {
14865
+ return /* @__PURE__ */ jsx64(
14866
+ "div",
14867
+ {
14868
+ className: "flex min-h-full overflow-hidden",
14869
+ 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(
14870
+ (value, indexValue) => value?.strings?.length > 0 && /* @__PURE__ */ jsxs40(
14871
+ "div",
14872
+ {
14873
+ className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
14874
+ children: [
14875
+ /* @__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, {}) }),
14876
+ value?.strings?.map((string, idx) => /* @__PURE__ */ jsxs40(Fragment9, { children: [
14877
+ /* @__PURE__ */ jsx64("span", { children: string }),
14878
+ idx < value?.strings.length - 1 && /* @__PURE__ */ jsxs40("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
14879
+ " ",
14880
+ "> ",
14881
+ " "
14882
+ ] })
14883
+ ] })),
14884
+ /* @__PURE__ */ jsx64(
14885
+ "button",
14886
+ {
14887
+ className: "pr-2 text-sm font-bold",
14888
+ onClick: () => {
14889
+ if (tag?.type === SearchType.GROUP) {
14890
+ typeof removeSearchItems === "function" && removeSearchItems(`${SearchType.GROUP}`);
14891
+ }
14892
+ },
14893
+ children: /* @__PURE__ */ jsx64(CloseIcon, { className: "size-4 cursor-pointer" })
14894
+ }
14895
+ )
14896
+ ]
14897
+ },
14898
+ `group-by-${index4}-${indexValue}`
14899
+ )
14900
+ ) })
14901
+ },
14902
+ "selected-tag-" + index4
14903
+ );
14904
+ }
14905
+ }
14906
+ });
14907
+ };
14725
14908
 
14726
14909
  // src/hooks/use-click-outside.ts
14727
14910
  import { useEffect as useEffect5, useRef as useRef3 } from "react";
@@ -14969,179 +15152,6 @@ function useFileInfo(source, options2) {
14969
15152
  } };
14970
15153
  }
14971
15154
 
14972
- // src/widgets/advanced/search/tag-search/index.tsx
14973
- import { Fragment as Fragment8 } from "react";
14974
- import { Fragment as Fragment9, jsx as jsx63, jsxs as jsxs39 } from "react/jsx-runtime";
14975
- var TagSearch = ({
14976
- removeSearchItems,
14977
- selectedTags,
14978
- filterBy,
14979
- setFilterBy,
14980
- setGroupBy
14981
- }) => {
14982
- return selectedTags?.length > 0 && selectedTags?.map((tag, index4) => {
14983
- if (tag?.values?.length > 0) {
14984
- if (tag?.type !== "group_by") {
14985
- return /* @__PURE__ */ jsxs39(
14986
- "div",
14987
- {
14988
- className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
14989
- children: [
14990
- /* @__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, {}) }),
14991
- /* @__PURE__ */ jsx63("div", { className: "pl-2 align-middle text-[#495057] text-[14px]", children: tag.values.map((value, idx) => {
14992
- return /* @__PURE__ */ jsxs39(Fragment8, { children: [
14993
- /* @__PURE__ */ jsx63("span", { children: value }),
14994
- idx < tag.values.length - 1 && /* @__PURE__ */ jsxs39("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
14995
- " ",
14996
- instance.t("or"),
14997
- " "
14998
- ] })
14999
- ] }, idx);
15000
- }) }),
15001
- /* @__PURE__ */ jsx63(
15002
- "button",
15003
- {
15004
- className: "px-2 text-sm font-bold",
15005
- onClick: () => {
15006
- typeof removeSearchItems === "function" && removeSearchItems(
15007
- tag?.type === SearchType.FILTER ? `${SearchType.FILTER}_${tag?.name}` : tag?.name
15008
- );
15009
- if (tag?.type === SearchType.FILTER) {
15010
- setFilterBy(
15011
- filterBy?.map((item) => ({
15012
- ...item,
15013
- active: false
15014
- }))
15015
- );
15016
- }
15017
- },
15018
- children: /* @__PURE__ */ jsx63(CloseIcon, { className: "size-4 cursor-pointer" })
15019
- }
15020
- )
15021
- ]
15022
- },
15023
- "selected-tag-" + index4
15024
- );
15025
- } else if (tag?.type === "group_by") {
15026
- return /* @__PURE__ */ jsx63(
15027
- "div",
15028
- {
15029
- className: "flex min-h-full overflow-hidden",
15030
- 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(
15031
- (value, indexValue) => value?.strings?.length > 0 && /* @__PURE__ */ jsxs39(
15032
- "div",
15033
- {
15034
- className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
15035
- children: [
15036
- /* @__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, {}) }),
15037
- value?.strings?.map((string, idx) => /* @__PURE__ */ jsxs39(Fragment9, { children: [
15038
- /* @__PURE__ */ jsx63("span", { children: string }),
15039
- idx < value?.strings.length - 1 && /* @__PURE__ */ jsxs39("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
15040
- " ",
15041
- "> ",
15042
- " "
15043
- ] })
15044
- ] })),
15045
- /* @__PURE__ */ jsx63(
15046
- "button",
15047
- {
15048
- className: "pr-2 text-sm font-bold",
15049
- onClick: () => {
15050
- if (tag?.type === SearchType.GROUP) {
15051
- typeof removeSearchItems === "function" && removeSearchItems(`${SearchType.GROUP}`);
15052
- setGroupBy(
15053
- (prev2) => prev2?.map((item) => ({
15054
- ...item,
15055
- active: false
15056
- }))
15057
- );
15058
- }
15059
- },
15060
- children: /* @__PURE__ */ jsx63(CloseIcon, { className: "size-4 cursor-pointer" })
15061
- }
15062
- )
15063
- ]
15064
- },
15065
- `group-by-${index4}-${indexValue}`
15066
- )
15067
- ) })
15068
- },
15069
- "selected-tag-" + index4
15070
- );
15071
- }
15072
- }
15073
- });
15074
- };
15075
-
15076
- // src/widgets/advanced/search/search-list/index.tsx
15077
- import { jsx as jsx64, jsxs as jsxs40 } from "react/jsx-runtime";
15078
- var SearchList = ({
15079
- handleAddTagSearch,
15080
- handleMouseEnter,
15081
- handleMouseLeave,
15082
- searchBy,
15083
- searchString,
15084
- hoveredIndexSearchList
15085
- }) => {
15086
- const { t: t3 } = useI18n();
15087
- return /* @__PURE__ */ jsx64(
15088
- "div",
15089
- {
15090
- style: {
15091
- top: "calc(100% + 3px)"
15092
- },
15093
- 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`,
15094
- children: searchBy?.map((searchItem, index4) => {
15095
- if (searchItem?.type === "date" || searchItem?.type === "datetime") {
15096
- if (!validateAndParseDate(searchString, searchItem?.type === "datetime"))
15097
- return;
15098
- }
15099
- return /* @__PURE__ */ jsxs40(
15100
- "button",
15101
- {
15102
- onClick: () => {
15103
- typeof handleAddTagSearch === "function" && handleAddTagSearch({
15104
- title: searchItem?.title,
15105
- name: searchItem?.name,
15106
- value: searchString,
15107
- domain: searchItem?.filter_domain,
15108
- operator: searchItem?.operator,
15109
- type: SearchType.SEARCH,
15110
- modelType: searchItem?.type,
15111
- widget: searchItem?.widget,
15112
- dataIndex: searchItem?.dataIndex
15113
- });
15114
- },
15115
- onMouseEnter: () => typeof handleMouseEnter === "function" && handleMouseEnter(index4),
15116
- onMouseLeave: () => typeof handleMouseLeave === "function" && handleMouseLeave(),
15117
- 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"}`,
15118
- children: [
15119
- t3("search"),
15120
- " ",
15121
- /* @__PURE__ */ jsx64("span", { className: "font-bold", children: searchItem?.title }),
15122
- " ",
15123
- t3("for"),
15124
- ":",
15125
- " ",
15126
- /* @__PURE__ */ jsx64(
15127
- "span",
15128
- {
15129
- style: {
15130
- color: "var(--color-primary)"
15131
- },
15132
- className: "custom-input-result text-primary font-bold italic",
15133
- children: searchString
15134
- }
15135
- )
15136
- ]
15137
- },
15138
- "header-" + index4 + 1
15139
- );
15140
- })
15141
- }
15142
- );
15143
- };
15144
-
15145
15155
  // src/widgets/advanced/search/search-item/index.tsx
15146
15156
  import { Fragment as Fragment10, jsx as jsx65, jsxs as jsxs41 } from "react/jsx-runtime";
15147
15157
  var Search = ({
@@ -15166,7 +15176,11 @@ var Search = ({
15166
15176
  selectedRowKeys,
15167
15177
  domainSearch,
15168
15178
  evalJSONContext,
15169
- clearSearch
15179
+ clearSearch,
15180
+ onKeyDown,
15181
+ handleMouseEnter,
15182
+ handleMouseLeave,
15183
+ hoveredIndexSearchList
15170
15184
  }) => {
15171
15185
  const { t: t3 } = useI18n();
15172
15186
  const [showPopupFilter, setShowPopupFilter] = useState5(false);
@@ -15264,60 +15278,68 @@ var Search = ({
15264
15278
  "div",
15265
15279
  {
15266
15280
  ref: popupFilterRef,
15267
- 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)]`,
15281
+ 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]`,
15268
15282
  children: [
15269
- /* @__PURE__ */ jsx65("div", { className: "size-5", children: /* @__PURE__ */ jsx65(SearchIcon, {}) }),
15270
- /* @__PURE__ */ jsxs41("div", { className: "flex flex-1 flex-wrap items-center gap-[8px]", children: [
15271
- /* @__PURE__ */ jsx65(
15272
- TagSearch,
15273
- {
15274
- removeSearchItems,
15275
- selectedTags,
15276
- filterBy,
15277
- setFilterBy,
15278
- setGroupBy
15279
- }
15280
- ),
15281
- /* @__PURE__ */ jsx65(
15282
- "input",
15283
- {
15284
- value: searchString,
15285
- className: "h-5 w-fit flex-1 border-none bg-transparent outline-none min-w-[50px] text-sm",
15286
- placeholder: t3("search..."),
15287
- onChange: (e3) => {
15288
- onSearchString(e3.target.value);
15289
- setShowPopupFilter(false);
15290
- },
15291
- onKeyUp: (e3) => e3.preventDefault()
15292
- }
15293
- ),
15283
+ /* @__PURE__ */ jsxs41(
15284
+ "div",
15285
+ {
15286
+ 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)]"}`,
15287
+ children: [
15288
+ /* @__PURE__ */ jsx65("div", { className: "min-h-5 min-w-5", children: /* @__PURE__ */ jsx65(SearchIcon, {}) }),
15289
+ /* @__PURE__ */ jsxs41("div", { className: "flex flex-1 flex-wrap items-center gap-[8px]", children: [
15290
+ /* @__PURE__ */ jsx65(
15291
+ TagSearch,
15292
+ {
15293
+ removeSearchItems,
15294
+ selectedTags,
15295
+ filterBy,
15296
+ setFilterBy
15297
+ }
15298
+ ),
15299
+ /* @__PURE__ */ jsx65(
15300
+ "input",
15301
+ {
15302
+ value: searchString,
15303
+ className: "min-h-[25px] w-fit flex-1 border-none bg-transparent outline-none min-w-[50px] text-sm",
15304
+ placeholder: t3("search..."),
15305
+ onChange: (e3) => {
15306
+ onSearchString(e3.target.value);
15307
+ setShowPopupFilter(false);
15308
+ },
15309
+ onKeyDown,
15310
+ onKeyUp: (e3) => e3.preventDefault()
15311
+ }
15312
+ ),
15313
+ /* @__PURE__ */ jsx65(
15314
+ SearchList,
15315
+ {
15316
+ handleAddTagSearch,
15317
+ searchBy,
15318
+ searchString,
15319
+ handleMouseEnter,
15320
+ handleMouseLeave,
15321
+ hoveredIndexSearchList
15322
+ }
15323
+ )
15324
+ ] })
15325
+ ]
15326
+ }
15327
+ ),
15328
+ (showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && /* @__PURE__ */ jsxs41(Fragment10, { children: [
15294
15329
  /* @__PURE__ */ jsx65(
15295
- SearchList,
15296
- {
15297
- handleAddTagSearch,
15298
- searchBy,
15299
- searchString
15300
- }
15301
- )
15302
- ] }),
15303
- showFiltersGroups && /* @__PURE__ */ jsxs41(Fragment10, { children: [
15304
- /* @__PURE__ */ jsxs41(
15305
15330
  "div",
15306
15331
  {
15307
- className: `flex h-full gap-2 cursor-pointer items-center justify-center max-w-fit`,
15332
+ className: `flex h-full cursor-pointer items-center justify-center px-[10px] max-w-fit`,
15308
15333
  onClick: (e3) => {
15309
15334
  e3.stopPropagation();
15310
15335
  setShowPopupFilter((prev2) => !prev2);
15311
15336
  },
15312
- children: [
15313
- /* @__PURE__ */ jsx65("div", { className: "w-[1px] h-[28px] bg-[var(--stroke-default)]" }),
15314
- /* @__PURE__ */ jsx65(
15315
- ChevronBottomIcon,
15316
- {
15317
- className: `h-5 w-5 min-w-fit transition-all ${showPopupFilter ? "rotate-180 " : ""}`
15318
- }
15319
- )
15320
- ]
15337
+ children: /* @__PURE__ */ jsx65("button", { className: "w-max cursor-pointer", children: /* @__PURE__ */ jsx65(
15338
+ ChevronBottomIcon,
15339
+ {
15340
+ className: `h-5 w-5 min-w-fit transition-all ${showPopupFilter ? "rotate-180 " : ""}`
15341
+ }
15342
+ ) })
15321
15343
  }
15322
15344
  ),
15323
15345
  showPopupFilter && /* @__PURE__ */ jsx65(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/sme-widget-ui",
3
- "version": "2.7.4",
3
+ "version": "2.7.6",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",