@fctc/sme-widget-ui 3.10.5 → 3.10.7

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
@@ -17734,8 +17734,8 @@ var CopyLinkButtonField = (props) => {
17734
17734
  baseClassName
17735
17735
  } = props;
17736
17736
  const { t: t3 } = useI18n();
17737
- if (!isForm) {
17738
- return /* @__PURE__ */ jsx84("div", { className: "truncate max-w-[300px]", children: propValue && typeof propValue === "object" ? propValue.display_name : propValue });
17737
+ if (!isForm && !isEditTable) {
17738
+ return /* @__PURE__ */ jsx84("div", { className: "truncate max-w-[300px]", children: maskingValue || (propValue && typeof propValue === "object" ? propValue.display_name : propValue) });
17739
17739
  }
17740
17740
  return /* @__PURE__ */ jsx84(
17741
17741
  Controller,
@@ -32466,7 +32466,7 @@ var ImageField = (props) => {
32466
32466
  };
32467
32467
 
32468
32468
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
32469
- import React17, { useEffect as useEffect21, useMemo as useMemo11 } from "react";
32469
+ import React17, { useEffect as useEffect21, useMemo as useMemo11, useState as useState21 } from "react";
32470
32470
 
32471
32471
  // src/widgets/basic/information-field/information.tsx
32472
32472
  import { Fragment as Fragment28, jsx as jsx98, jsxs as jsxs64 } from "react/jsx-runtime";
@@ -32609,6 +32609,8 @@ var Many2ManyTagField = (props) => {
32609
32609
  required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
32610
32610
  },
32611
32611
  render: ({ field, fieldState: { error: error2 } }) => {
32612
+ const [menuOpen, setMenuOpen] = useState21(false);
32613
+ const [hover, setHover] = useState21(false);
32612
32614
  const { clearErrors } = methods;
32613
32615
  useEffect21(() => {
32614
32616
  if (field.value) {
@@ -32643,118 +32645,138 @@ var Many2ManyTagField = (props) => {
32643
32645
  });
32644
32646
  });
32645
32647
  };
32646
- return /* @__PURE__ */ jsxs65("div", { className: "group h-full", children: [
32647
- /* @__PURE__ */ jsx99(
32648
- StateManagedSelect$1,
32649
- {
32650
- options: options2,
32651
- noOptionsMessage: () => t3(isFetching ? "loading" : "no-available"),
32652
- isMulti: true,
32653
- isDisabled: readonly,
32654
- isSearchable: true,
32655
- isClearable: true,
32656
- menuShouldScrollIntoView: false,
32657
- menuPortalTarget: typeof window !== "undefined" ? document.body : null,
32658
- value: filteredValue,
32659
- onChange: handleChange,
32660
- onMenuClose: () => {
32661
- const filteredDomain = [...domainObject ?? []]?.filter(
32662
- (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
32663
- ) || [];
32664
- setInputValue("");
32665
- setDomainObject(filteredDomain);
32666
- },
32667
- onMenuOpen: fetchMoreOptions,
32668
- menuPlacement: "auto",
32669
- placeholder,
32670
- classNames: isEditTable ? {
32671
- valueContainer: () => "overflow-unset !px-0",
32672
- control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32673
- dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
32674
- clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
32675
- } : {
32676
- valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
32677
- control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32678
- singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
32679
- input: () => "!m-0 !p-0",
32680
- dropdownIndicator: () => "!m-0 !p-0"
32681
- },
32682
- styles: {
32683
- container: (base) => ({
32684
- ...base,
32685
- height: "100%"
32686
- }),
32687
- control: () => ({
32688
- maxWidth: isEditTable ? "max-content" : "100%",
32689
- minWidth: isEditTable ? "max-content" : "100%",
32690
- background: isEditTable ? "transparent" : "initial"
32691
- }),
32692
- multiValue: (provided, state) => {
32693
- const { color, id } = state?.data ?? {};
32694
- const bgColor = color !== null ? COLORS[color]?.color : COLORS[id]?.color;
32695
- return {
32696
- ...provided,
32697
- display: "flex",
32698
- backgroundColor: bgColor || "rgba(230.1375, 221.3625, 221.3625, 1)",
32699
- borderRadius: "16px",
32700
- color: "black",
32701
- fontWeight: "600"
32702
- };
32703
- },
32704
- multiValueRemove: (provided) => ({
32705
- ...provided,
32706
- backgroundColor: "transparent !important",
32707
- color: "black !important"
32708
- }),
32709
- option: (provided, { isFocused, isSelected }) => ({
32710
- ...provided,
32711
- backgroundColor: isSelected || isFocused ? "rgba(66,66,66,0.08)" : "#FFF",
32712
- color: isSelected ? "white" : "",
32713
- cursor: "pointer",
32714
- transition: "all 0.2s ease",
32715
- borderRadius: "8px"
32716
- }),
32717
- menu: (base) => ({
32718
- ...base,
32719
- zIndex: 9999,
32720
- width: "100%",
32721
- minWidth: "max-content",
32722
- borderRadius: "10px"
32723
- }),
32724
- menuList: (base) => ({
32725
- ...base,
32726
- padding: "4px"
32727
- })
32728
- },
32729
- components: isUser ? {
32730
- MultiValue: (multiValueProps) => /* @__PURE__ */ jsx99(
32731
- CustomMultiValue,
32732
- {
32733
- ...multiValueProps,
32734
- stringToColor
32735
- }
32736
- ),
32737
- IndicatorSeparator: () => null
32738
- } : {
32739
- MenuList: (menuListProps) => /* @__PURE__ */ jsx99(
32740
- CustomMenuList,
32741
- {
32742
- ...menuListProps,
32743
- selectProps: {
32744
- ...menuListProps.selectProps,
32745
- setIsShowModalMany2Many
32746
- }
32747
- }
32748
- ),
32749
- IndicatorSeparator: () => null,
32750
- DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx99(components.DropdownIndicator, { ...props2 }),
32751
- ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx99(components.ClearIndicator, { ...props2 })
32752
- },
32753
- required: !invisible && required
32754
- }
32755
- ),
32756
- !isEditTable && error2 && /* @__PURE__ */ jsx99("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32757
- ] });
32648
+ return /* @__PURE__ */ jsxs65(
32649
+ "div",
32650
+ {
32651
+ className: "group h-full",
32652
+ onMouseEnter: () => setHover(true),
32653
+ onMouseLeave: () => setHover(false),
32654
+ children: [
32655
+ /* @__PURE__ */ jsx99(
32656
+ StateManagedSelect$1,
32657
+ {
32658
+ options: options2,
32659
+ noOptionsMessage: () => t3(isFetching ? "loading" : "no-available"),
32660
+ isMulti: true,
32661
+ isDisabled: readonly,
32662
+ isSearchable: true,
32663
+ isClearable: menuOpen,
32664
+ menuShouldScrollIntoView: false,
32665
+ menuPortalTarget: typeof window !== "undefined" ? document.body : null,
32666
+ value: filteredValue,
32667
+ onChange: handleChange,
32668
+ onMenuClose: () => {
32669
+ const filteredDomain = [...domainObject ?? []]?.filter(
32670
+ (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
32671
+ ) || [];
32672
+ setInputValue("");
32673
+ setDomainObject(filteredDomain);
32674
+ setMenuOpen(false);
32675
+ },
32676
+ onMenuOpen: () => {
32677
+ fetchMoreOptions();
32678
+ setMenuOpen(true);
32679
+ },
32680
+ onBlur: () => {
32681
+ setHover(false);
32682
+ },
32683
+ menuPlacement: "auto",
32684
+ placeholder,
32685
+ classNames: isEditTable ? {
32686
+ valueContainer: () => "overflow-unset !px-0",
32687
+ control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32688
+ dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
32689
+ clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
32690
+ } : {
32691
+ valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
32692
+ control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32693
+ singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
32694
+ input: () => "!m-0 !p-0",
32695
+ dropdownIndicator: () => "!m-0 !p-0"
32696
+ },
32697
+ styles: {
32698
+ container: (base) => ({
32699
+ ...base,
32700
+ height: "100%"
32701
+ }),
32702
+ control: () => ({
32703
+ maxWidth: isEditTable ? "max-content" : "100%",
32704
+ minWidth: isEditTable ? "max-content" : "100%",
32705
+ background: isEditTable ? "transparent" : "initial"
32706
+ }),
32707
+ multiValue: (provided, state) => {
32708
+ const { color, id } = state?.data ?? {};
32709
+ const bgColor = color !== null ? COLORS[color]?.color : COLORS[id]?.color;
32710
+ return {
32711
+ ...provided,
32712
+ display: "flex",
32713
+ backgroundColor: bgColor || "rgba(230.1375, 221.3625, 221.3625, 1)",
32714
+ borderRadius: "16px",
32715
+ color: "black",
32716
+ fontWeight: "600"
32717
+ };
32718
+ },
32719
+ multiValueRemove: (provided) => ({
32720
+ ...provided,
32721
+ backgroundColor: "transparent !important",
32722
+ color: "black !important"
32723
+ }),
32724
+ option: (provided, { isFocused, isSelected }) => ({
32725
+ ...provided,
32726
+ backgroundColor: isSelected || isFocused ? "rgba(66,66,66,0.08)" : "#FFF",
32727
+ color: isSelected ? "white" : "",
32728
+ cursor: "pointer",
32729
+ transition: "all 0.2s ease",
32730
+ borderRadius: "8px"
32731
+ }),
32732
+ menu: (base) => ({
32733
+ ...base,
32734
+ zIndex: 9999,
32735
+ width: "100%",
32736
+ minWidth: "max-content",
32737
+ borderRadius: "10px"
32738
+ }),
32739
+ menuList: (base) => ({
32740
+ ...base,
32741
+ padding: "4px"
32742
+ }),
32743
+ dropdownIndicator: (base) => ({
32744
+ ...base,
32745
+ padding: "0",
32746
+ display: hover ? "flex" : "none"
32747
+ })
32748
+ },
32749
+ components: isUser ? {
32750
+ MultiValue: (multiValueProps) => /* @__PURE__ */ jsx99(
32751
+ CustomMultiValue,
32752
+ {
32753
+ ...multiValueProps,
32754
+ stringToColor
32755
+ }
32756
+ ),
32757
+ IndicatorSeparator: () => null
32758
+ } : {
32759
+ MenuList: (menuListProps) => /* @__PURE__ */ jsx99(
32760
+ CustomMenuList,
32761
+ {
32762
+ ...menuListProps,
32763
+ selectProps: {
32764
+ ...menuListProps.selectProps,
32765
+ setIsShowModalMany2Many
32766
+ }
32767
+ }
32768
+ ),
32769
+ IndicatorSeparator: () => null,
32770
+ DropdownIndicator: (props2) => readonly || menuOpen ? null : /* @__PURE__ */ jsx99(components.DropdownIndicator, { ...props2 }),
32771
+ ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx99(components.ClearIndicator, { ...props2 })
32772
+ },
32773
+ required: !invisible && required
32774
+ }
32775
+ ),
32776
+ !isEditTable && error2 && /* @__PURE__ */ jsx99("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32777
+ ]
32778
+ }
32779
+ );
32758
32780
  }
32759
32781
  }
32760
32782
  );
@@ -32867,7 +32889,7 @@ var PaidBadgedField = () => {
32867
32889
  };
32868
32890
 
32869
32891
  // src/widgets/basic/priority-field/rating-star.tsx
32870
- import React18, { useEffect as useEffect23, useState as useState21 } from "react";
32892
+ import React18, { useEffect as useEffect23, useState as useState22 } from "react";
32871
32893
  import { jsx as jsx102, jsxs as jsxs67 } from "react/jsx-runtime";
32872
32894
  var RatingStarField = (props) => {
32873
32895
  const {
@@ -32877,8 +32899,8 @@ var RatingStarField = (props) => {
32877
32899
  onSelectPriority,
32878
32900
  id
32879
32901
  } = props;
32880
- const [rating, setRating] = useState21(defaultValue);
32881
- const [hover, setHover] = useState21(0);
32902
+ const [rating, setRating] = useState22(defaultValue);
32903
+ const [hover, setHover] = useState22(0);
32882
32904
  useEffect23(() => {
32883
32905
  setRating(defaultValue);
32884
32906
  }, [defaultValue]);
@@ -33078,6 +33100,7 @@ var RemainingDaysField = (props) => {
33078
33100
  };
33079
33101
 
33080
33102
  // src/widgets/basic/select-dropdown-field/select-dropdown.tsx
33103
+ import { useState as useState23 } from "react";
33081
33104
  import { Fragment as Fragment30, jsx as jsx106, jsxs as jsxs70 } from "react/jsx-runtime";
33082
33105
  var SelectDropdownField = (props) => {
33083
33106
  const { t: t3 } = useI18n();
@@ -33112,6 +33135,8 @@ var SelectDropdownField = (props) => {
33112
33135
  required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
33113
33136
  },
33114
33137
  render: ({ field, fieldState: { error: error2 } }) => {
33138
+ const [menuOpen, setMenuOpen] = useState23(false);
33139
+ const [hover, setHover] = useState23(false);
33115
33140
  const defaultValue = options2.find(
33116
33141
  (option) => option.value === value
33117
33142
  );
@@ -33122,13 +33147,23 @@ var SelectDropdownField = (props) => {
33122
33147
  placeholder: readonly ? "" : placeholder || t3("choose_place"),
33123
33148
  isSearchable: !readonly,
33124
33149
  isDisabled: readonly,
33150
+ isClearable: menuOpen,
33125
33151
  menuPlacement: "auto",
33126
33152
  onChange: (selectedOption) => {
33127
33153
  field.onChange(selectedOption.value);
33128
33154
  onChange2 && onChange2(name ?? "", selectedOption.value);
33129
33155
  },
33130
33156
  value: defaultValue || null,
33131
- required: !invisible && required
33157
+ required: !invisible && required,
33158
+ onMenuOpen: () => {
33159
+ setMenuOpen(true);
33160
+ },
33161
+ onMenuClose: () => {
33162
+ setMenuOpen(false);
33163
+ },
33164
+ onBlur: () => {
33165
+ setHover(false);
33166
+ }
33132
33167
  };
33133
33168
  return /* @__PURE__ */ jsxs70(Fragment30, { children: [
33134
33169
  /* @__PURE__ */ jsx106("div", { className: `group ${isEditTable ? "h-full" : ""}`, children: /* @__PURE__ */ jsx106(
@@ -33183,12 +33218,17 @@ var SelectDropdownField = (props) => {
33183
33218
  menuList: (base) => ({
33184
33219
  ...base,
33185
33220
  padding: "4px"
33221
+ }),
33222
+ dropdownIndicator: (base) => ({
33223
+ ...base,
33224
+ padding: "0",
33225
+ display: hover ? "flex" : "none"
33186
33226
  })
33187
33227
  },
33188
33228
  menuPortalTarget: typeof window !== "undefined" ? document.body : null,
33189
33229
  components: {
33190
33230
  IndicatorSeparator: () => null,
33191
- DropdownIndicator: (props2) => readonly || !isEditTable ? null : /* @__PURE__ */ jsx106(components.DropdownIndicator, { ...props2 })
33231
+ DropdownIndicator: (props2) => readonly || !isEditTable || menuOpen ? null : /* @__PURE__ */ jsx106(components.DropdownIndicator, { ...props2 })
33192
33232
  },
33193
33233
  noOptionsMessage: () => t3("no-available")
33194
33234
  }
@@ -33314,7 +33354,7 @@ var ToggleButtonField = (props) => {
33314
33354
  };
33315
33355
 
33316
33356
  // src/widgets/basic/integer-field/integer.tsx
33317
- import { useEffect as useEffect25, useRef as useRef18, useState as useState22 } from "react";
33357
+ import { useEffect as useEffect25, useRef as useRef18, useState as useState24 } from "react";
33318
33358
  import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs72 } from "react/jsx-runtime";
33319
33359
  var IntegerField = (props) => {
33320
33360
  const {
@@ -33354,7 +33394,7 @@ var IntegerField = (props) => {
33354
33394
  const isDirtyRef = useRef18(false);
33355
33395
  const inputRef = useRef18(null);
33356
33396
  const lastCommittedValueRef = useRef18(null);
33357
- const [inputValue, setInputValue] = useState22(
33397
+ const [inputValue, setInputValue] = useState24(
33358
33398
  value2 !== void 0 && value2 !== null ? String(value2) : ""
33359
33399
  );
33360
33400
  useEffect25(() => {
@@ -33723,7 +33763,7 @@ var Many2ManyField = (props) => {
33723
33763
  };
33724
33764
 
33725
33765
  // src/widgets/basic/many2one-field/many2one.tsx
33726
- import React19, { useEffect as useEffect27, useState as useState23 } from "react";
33766
+ import React19, { useEffect as useEffect27, useState as useState25 } from "react";
33727
33767
  import { Fragment as Fragment32, jsx as jsx112, jsxs as jsxs75 } from "react/jsx-runtime";
33728
33768
  var CustomMenuList2 = (props) => {
33729
33769
  const { t: t3 } = useI18n();
@@ -33820,8 +33860,8 @@ var Many2OneField = (props) => {
33820
33860
  } : false
33821
33861
  },
33822
33862
  render: ({ field, fieldState: { error: error2 } }) => {
33823
- const [menuOpen, setMenuOpen] = useState23(false);
33824
- const [hover, setHover] = useState23(false);
33863
+ const [menuOpen, setMenuOpen] = useState25(false);
33864
+ const [hover, setHover] = useState25(false);
33825
33865
  const currentValue = field?.value ? {
33826
33866
  value: field?.value?.id,
33827
33867
  label: field?.value?.display_name,