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