@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/widgets.mjs CHANGED
@@ -30959,12 +30959,13 @@ var DateField = (props) => {
30959
30959
  }
30960
30960
  if (showTime) {
30961
30961
  const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
30962
+ field.onChange(adjustedDate.format(formatDateParse));
30962
30963
  handleOnchange && handleOnchange(name ?? "", formattedDate);
30963
30964
  } else {
30964
30965
  const formattedDateWithoutTime = adjustedDate.format(formatDateParse);
30966
+ field.onChange(adjustedDate.format(formatDateParse));
30965
30967
  handleOnchange && handleOnchange(name ?? "", formattedDateWithoutTime);
30966
30968
  }
30967
- field.onChange(adjustedDate.format(formatDateParse));
30968
30969
  clearErrors(name);
30969
30970
  } else {
30970
30971
  field.onChange(null);
@@ -31757,7 +31758,7 @@ var ImageField = (props) => {
31757
31758
  };
31758
31759
 
31759
31760
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
31760
- import React17, { useEffect as useEffect21, useMemo as useMemo11 } from "react";
31761
+ import React17, { useEffect as useEffect21, useMemo as useMemo11, useState as useState21 } from "react";
31761
31762
 
31762
31763
  // src/widgets/basic/information-field/information.tsx
31763
31764
  import { Fragment as Fragment28, jsx as jsx98, jsxs as jsxs64 } from "react/jsx-runtime";
@@ -31900,6 +31901,8 @@ var Many2ManyTagField = (props) => {
31900
31901
  required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
31901
31902
  },
31902
31903
  render: ({ field, fieldState: { error: error2 } }) => {
31904
+ const [menuOpen, setMenuOpen] = useState21(false);
31905
+ const [hover, setHover] = useState21(false);
31903
31906
  const { clearErrors } = methods;
31904
31907
  useEffect21(() => {
31905
31908
  if (field.value) {
@@ -31934,118 +31937,138 @@ var Many2ManyTagField = (props) => {
31934
31937
  });
31935
31938
  });
31936
31939
  };
31937
- return /* @__PURE__ */ jsxs65("div", { className: "group h-full", children: [
31938
- /* @__PURE__ */ jsx99(
31939
- StateManagedSelect$1,
31940
- {
31941
- options: options2,
31942
- noOptionsMessage: () => t3(isFetching ? "loading" : "no-available"),
31943
- isMulti: true,
31944
- isDisabled: readonly,
31945
- isSearchable: true,
31946
- isClearable: true,
31947
- menuShouldScrollIntoView: false,
31948
- menuPortalTarget: typeof window !== "undefined" ? document.body : null,
31949
- value: filteredValue,
31950
- onChange: handleChange,
31951
- onMenuClose: () => {
31952
- const filteredDomain = [...domainObject ?? []]?.filter(
31953
- (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
31954
- ) || [];
31955
- setInputValue("");
31956
- setDomainObject(filteredDomain);
31957
- },
31958
- onMenuOpen: fetchMoreOptions,
31959
- menuPlacement: "auto",
31960
- placeholder,
31961
- classNames: isEditTable ? {
31962
- valueContainer: () => "overflow-unset !px-0",
31963
- control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
31964
- dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
31965
- clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
31966
- } : {
31967
- valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
31968
- control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
31969
- singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
31970
- input: () => "!m-0 !p-0",
31971
- dropdownIndicator: () => "!m-0 !p-0"
31972
- },
31973
- styles: {
31974
- container: (base) => ({
31975
- ...base,
31976
- height: "100%"
31977
- }),
31978
- control: () => ({
31979
- maxWidth: isEditTable ? "max-content" : "100%",
31980
- minWidth: isEditTable ? "max-content" : "100%",
31981
- background: isEditTable ? "transparent" : "initial"
31982
- }),
31983
- multiValue: (provided, state) => {
31984
- const { color, id } = state?.data ?? {};
31985
- const bgColor = color !== null ? COLORS[color]?.color : COLORS[id]?.color;
31986
- return {
31987
- ...provided,
31988
- display: "flex",
31989
- backgroundColor: bgColor || "rgba(230.1375, 221.3625, 221.3625, 1)",
31990
- borderRadius: "16px",
31991
- color: "black",
31992
- fontWeight: "600"
31993
- };
31994
- },
31995
- multiValueRemove: (provided) => ({
31996
- ...provided,
31997
- backgroundColor: "transparent !important",
31998
- color: "black !important"
31999
- }),
32000
- option: (provided, { isFocused, isSelected }) => ({
32001
- ...provided,
32002
- backgroundColor: isSelected || isFocused ? "rgba(66,66,66,0.08)" : "#FFF",
32003
- color: isSelected ? "white" : "",
32004
- cursor: "pointer",
32005
- transition: "all 0.2s ease",
32006
- borderRadius: "8px"
32007
- }),
32008
- menu: (base) => ({
32009
- ...base,
32010
- zIndex: 9999,
32011
- width: "100%",
32012
- minWidth: "max-content",
32013
- borderRadius: "10px"
32014
- }),
32015
- menuList: (base) => ({
32016
- ...base,
32017
- padding: "4px"
32018
- })
32019
- },
32020
- components: isUser ? {
32021
- MultiValue: (multiValueProps) => /* @__PURE__ */ jsx99(
32022
- CustomMultiValue,
32023
- {
32024
- ...multiValueProps,
32025
- stringToColor
32026
- }
32027
- ),
32028
- IndicatorSeparator: () => null
32029
- } : {
32030
- MenuList: (menuListProps) => /* @__PURE__ */ jsx99(
32031
- CustomMenuList,
32032
- {
32033
- ...menuListProps,
32034
- selectProps: {
32035
- ...menuListProps.selectProps,
32036
- setIsShowModalMany2Many
32037
- }
32038
- }
32039
- ),
32040
- IndicatorSeparator: () => null,
32041
- DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx99(components.DropdownIndicator, { ...props2 }),
32042
- ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx99(components.ClearIndicator, { ...props2 })
32043
- },
32044
- required: !invisible && required
32045
- }
32046
- ),
32047
- !isEditTable && error2 && /* @__PURE__ */ jsx99("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32048
- ] });
31940
+ return /* @__PURE__ */ jsxs65(
31941
+ "div",
31942
+ {
31943
+ className: "group h-full",
31944
+ onMouseEnter: () => setHover(true),
31945
+ onMouseLeave: () => setHover(false),
31946
+ children: [
31947
+ /* @__PURE__ */ jsx99(
31948
+ StateManagedSelect$1,
31949
+ {
31950
+ options: options2,
31951
+ noOptionsMessage: () => t3(isFetching ? "loading" : "no-available"),
31952
+ isMulti: true,
31953
+ isDisabled: readonly,
31954
+ isSearchable: true,
31955
+ isClearable: menuOpen,
31956
+ menuShouldScrollIntoView: false,
31957
+ menuPortalTarget: typeof window !== "undefined" ? document.body : null,
31958
+ value: filteredValue,
31959
+ onChange: handleChange,
31960
+ onMenuClose: () => {
31961
+ const filteredDomain = [...domainObject ?? []]?.filter(
31962
+ (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
31963
+ ) || [];
31964
+ setInputValue("");
31965
+ setDomainObject(filteredDomain);
31966
+ setMenuOpen(false);
31967
+ },
31968
+ onMenuOpen: () => {
31969
+ fetchMoreOptions();
31970
+ setMenuOpen(true);
31971
+ },
31972
+ onBlur: () => {
31973
+ setHover(false);
31974
+ },
31975
+ menuPlacement: "auto",
31976
+ placeholder,
31977
+ classNames: isEditTable ? {
31978
+ valueContainer: () => "overflow-unset !px-0",
31979
+ control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
31980
+ dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
31981
+ clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
31982
+ } : {
31983
+ valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
31984
+ control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
31985
+ singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
31986
+ input: () => "!m-0 !p-0",
31987
+ dropdownIndicator: () => "!m-0 !p-0"
31988
+ },
31989
+ styles: {
31990
+ container: (base) => ({
31991
+ ...base,
31992
+ height: "100%"
31993
+ }),
31994
+ control: () => ({
31995
+ maxWidth: isEditTable ? "max-content" : "100%",
31996
+ minWidth: isEditTable ? "max-content" : "100%",
31997
+ background: isEditTable ? "transparent" : "initial"
31998
+ }),
31999
+ multiValue: (provided, state) => {
32000
+ const { color, id } = state?.data ?? {};
32001
+ const bgColor = color !== null ? COLORS[color]?.color : COLORS[id]?.color;
32002
+ return {
32003
+ ...provided,
32004
+ display: "flex",
32005
+ backgroundColor: bgColor || "rgba(230.1375, 221.3625, 221.3625, 1)",
32006
+ borderRadius: "16px",
32007
+ color: "black",
32008
+ fontWeight: "600"
32009
+ };
32010
+ },
32011
+ multiValueRemove: (provided) => ({
32012
+ ...provided,
32013
+ backgroundColor: "transparent !important",
32014
+ color: "black !important"
32015
+ }),
32016
+ option: (provided, { isFocused, isSelected }) => ({
32017
+ ...provided,
32018
+ backgroundColor: isSelected || isFocused ? "rgba(66,66,66,0.08)" : "#FFF",
32019
+ color: isSelected ? "white" : "",
32020
+ cursor: "pointer",
32021
+ transition: "all 0.2s ease",
32022
+ borderRadius: "8px"
32023
+ }),
32024
+ menu: (base) => ({
32025
+ ...base,
32026
+ zIndex: 9999,
32027
+ width: "100%",
32028
+ minWidth: "max-content",
32029
+ borderRadius: "10px"
32030
+ }),
32031
+ menuList: (base) => ({
32032
+ ...base,
32033
+ padding: "4px"
32034
+ }),
32035
+ dropdownIndicator: (base) => ({
32036
+ ...base,
32037
+ padding: "0",
32038
+ display: hover ? "flex" : "none"
32039
+ })
32040
+ },
32041
+ components: isUser ? {
32042
+ MultiValue: (multiValueProps) => /* @__PURE__ */ jsx99(
32043
+ CustomMultiValue,
32044
+ {
32045
+ ...multiValueProps,
32046
+ stringToColor
32047
+ }
32048
+ ),
32049
+ IndicatorSeparator: () => null
32050
+ } : {
32051
+ MenuList: (menuListProps) => /* @__PURE__ */ jsx99(
32052
+ CustomMenuList,
32053
+ {
32054
+ ...menuListProps,
32055
+ selectProps: {
32056
+ ...menuListProps.selectProps,
32057
+ setIsShowModalMany2Many
32058
+ }
32059
+ }
32060
+ ),
32061
+ IndicatorSeparator: () => null,
32062
+ DropdownIndicator: (props2) => readonly || menuOpen ? null : /* @__PURE__ */ jsx99(components.DropdownIndicator, { ...props2 }),
32063
+ ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx99(components.ClearIndicator, { ...props2 })
32064
+ },
32065
+ required: !invisible && required
32066
+ }
32067
+ ),
32068
+ !isEditTable && error2 && /* @__PURE__ */ jsx99("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32069
+ ]
32070
+ }
32071
+ );
32049
32072
  }
32050
32073
  }
32051
32074
  );
@@ -32158,7 +32181,7 @@ var PaidBadgedField = () => {
32158
32181
  };
32159
32182
 
32160
32183
  // src/widgets/basic/priority-field/rating-star.tsx
32161
- import React18, { useEffect as useEffect23, useState as useState21 } from "react";
32184
+ import React18, { useEffect as useEffect23, useState as useState22 } from "react";
32162
32185
  import { jsx as jsx102, jsxs as jsxs67 } from "react/jsx-runtime";
32163
32186
  var RatingStarField = (props) => {
32164
32187
  const {
@@ -32168,8 +32191,8 @@ var RatingStarField = (props) => {
32168
32191
  onSelectPriority,
32169
32192
  id
32170
32193
  } = props;
32171
- const [rating, setRating] = useState21(defaultValue);
32172
- const [hover, setHover] = useState21(0);
32194
+ const [rating, setRating] = useState22(defaultValue);
32195
+ const [hover, setHover] = useState22(0);
32173
32196
  useEffect23(() => {
32174
32197
  setRating(defaultValue);
32175
32198
  }, [defaultValue]);
@@ -32369,6 +32392,7 @@ var RemainingDaysField = (props) => {
32369
32392
  };
32370
32393
 
32371
32394
  // src/widgets/basic/select-dropdown-field/select-dropdown.tsx
32395
+ import { useState as useState23 } from "react";
32372
32396
  import { Fragment as Fragment30, jsx as jsx106, jsxs as jsxs70 } from "react/jsx-runtime";
32373
32397
  var SelectDropdownField = (props) => {
32374
32398
  const { t: t3 } = useI18n();
@@ -32403,6 +32427,8 @@ var SelectDropdownField = (props) => {
32403
32427
  required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
32404
32428
  },
32405
32429
  render: ({ field, fieldState: { error: error2 } }) => {
32430
+ const [menuOpen, setMenuOpen] = useState23(false);
32431
+ const [hover, setHover] = useState23(false);
32406
32432
  const defaultValue = options2.find(
32407
32433
  (option) => option.value === value
32408
32434
  );
@@ -32413,13 +32439,23 @@ var SelectDropdownField = (props) => {
32413
32439
  placeholder: readonly ? "" : placeholder || t3("choose_place"),
32414
32440
  isSearchable: !readonly,
32415
32441
  isDisabled: readonly,
32442
+ isClearable: menuOpen,
32416
32443
  menuPlacement: "auto",
32417
32444
  onChange: (selectedOption) => {
32418
32445
  field.onChange(selectedOption.value);
32419
32446
  onChange2 && onChange2(name ?? "", selectedOption.value);
32420
32447
  },
32421
32448
  value: defaultValue || null,
32422
- required: !invisible && required
32449
+ required: !invisible && required,
32450
+ onMenuOpen: () => {
32451
+ setMenuOpen(true);
32452
+ },
32453
+ onMenuClose: () => {
32454
+ setMenuOpen(false);
32455
+ },
32456
+ onBlur: () => {
32457
+ setHover(false);
32458
+ }
32423
32459
  };
32424
32460
  return /* @__PURE__ */ jsxs70(Fragment30, { children: [
32425
32461
  /* @__PURE__ */ jsx106("div", { className: `group ${isEditTable ? "h-full" : ""}`, children: /* @__PURE__ */ jsx106(
@@ -32474,12 +32510,17 @@ var SelectDropdownField = (props) => {
32474
32510
  menuList: (base) => ({
32475
32511
  ...base,
32476
32512
  padding: "4px"
32513
+ }),
32514
+ dropdownIndicator: (base) => ({
32515
+ ...base,
32516
+ padding: "0",
32517
+ display: hover ? "flex" : "none"
32477
32518
  })
32478
32519
  },
32479
32520
  menuPortalTarget: typeof window !== "undefined" ? document.body : null,
32480
32521
  components: {
32481
32522
  IndicatorSeparator: () => null,
32482
- DropdownIndicator: (props2) => readonly || !isEditTable ? null : /* @__PURE__ */ jsx106(components.DropdownIndicator, { ...props2 })
32523
+ DropdownIndicator: (props2) => readonly || !isEditTable || menuOpen ? null : /* @__PURE__ */ jsx106(components.DropdownIndicator, { ...props2 })
32483
32524
  },
32484
32525
  noOptionsMessage: () => t3("no-available")
32485
32526
  }
@@ -32605,7 +32646,7 @@ var ToggleButtonField = (props) => {
32605
32646
  };
32606
32647
 
32607
32648
  // src/widgets/basic/integer-field/integer.tsx
32608
- import { useEffect as useEffect25, useRef as useRef18, useState as useState22 } from "react";
32649
+ import { useEffect as useEffect25, useRef as useRef18, useState as useState24 } from "react";
32609
32650
  import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs72 } from "react/jsx-runtime";
32610
32651
  var IntegerField = (props) => {
32611
32652
  const {
@@ -32645,7 +32686,7 @@ var IntegerField = (props) => {
32645
32686
  const isDirtyRef = useRef18(false);
32646
32687
  const inputRef = useRef18(null);
32647
32688
  const lastCommittedValueRef = useRef18(null);
32648
- const [inputValue, setInputValue] = useState22(
32689
+ const [inputValue, setInputValue] = useState24(
32649
32690
  value2 !== void 0 && value2 !== null ? String(value2) : ""
32650
32691
  );
32651
32692
  useEffect25(() => {
@@ -33014,7 +33055,7 @@ var Many2ManyField = (props) => {
33014
33055
  };
33015
33056
 
33016
33057
  // src/widgets/basic/many2one-field/many2one.tsx
33017
- import React19, { useEffect as useEffect27, useState as useState23 } from "react";
33058
+ import React19, { useEffect as useEffect27, useState as useState25 } from "react";
33018
33059
  import { Fragment as Fragment32, jsx as jsx112, jsxs as jsxs75 } from "react/jsx-runtime";
33019
33060
  var CustomMenuList2 = (props) => {
33020
33061
  const { t: t3 } = useI18n();
@@ -33111,8 +33152,8 @@ var Many2OneField = (props) => {
33111
33152
  } : false
33112
33153
  },
33113
33154
  render: ({ field, fieldState: { error: error2 } }) => {
33114
- const [menuOpen, setMenuOpen] = useState23(false);
33115
- const [hover, setHover] = useState23(false);
33155
+ const [menuOpen, setMenuOpen] = useState25(false);
33156
+ const [hover, setHover] = useState25(false);
33116
33157
  const currentValue = field?.value ? {
33117
33158
  value: field?.value?.id,
33118
33159
  label: field?.value?.display_name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/sme-widget-ui",
3
- "version": "3.10.4",
3
+ "version": "3.10.6",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",