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