@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.js CHANGED
@@ -17089,8 +17089,8 @@ var CopyLinkButtonField = (props) => {
17089
17089
  baseClassName
17090
17090
  } = props;
17091
17091
  const { t: t3 } = useI18n();
17092
- if (!isForm) {
17093
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "truncate max-w-[300px]", children: propValue && typeof propValue === "object" ? propValue.display_name : propValue });
17092
+ if (!isForm && !isEditTable) {
17093
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "truncate max-w-[300px]", children: maskingValue || (propValue && typeof propValue === "object" ? propValue.display_name : propValue) });
17094
17094
  }
17095
17095
  return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
17096
17096
  Controller,
@@ -31964,6 +31964,8 @@ var Many2ManyTagField = (props) => {
31964
31964
  required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
31965
31965
  },
31966
31966
  render: ({ field, fieldState: { error: error2 } }) => {
31967
+ const [menuOpen, setMenuOpen] = (0, import_react62.useState)(false);
31968
+ const [hover, setHover] = (0, import_react62.useState)(false);
31967
31969
  const { clearErrors } = methods;
31968
31970
  (0, import_react62.useEffect)(() => {
31969
31971
  if (field.value) {
@@ -31998,118 +32000,138 @@ var Many2ManyTagField = (props) => {
31998
32000
  });
31999
32001
  });
32000
32002
  };
32001
- return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "group h-full", children: [
32002
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32003
- StateManagedSelect$1,
32004
- {
32005
- options: options2,
32006
- noOptionsMessage: () => t3(isFetching ? "loading" : "no-available"),
32007
- isMulti: true,
32008
- isDisabled: readonly,
32009
- isSearchable: true,
32010
- isClearable: true,
32011
- menuShouldScrollIntoView: false,
32012
- menuPortalTarget: typeof window !== "undefined" ? document.body : null,
32013
- value: filteredValue,
32014
- onChange: handleChange,
32015
- onMenuClose: () => {
32016
- const filteredDomain = [...domainObject ?? []]?.filter(
32017
- (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
32018
- ) || [];
32019
- setInputValue("");
32020
- setDomainObject(filteredDomain);
32021
- },
32022
- onMenuOpen: fetchMoreOptions,
32023
- menuPlacement: "auto",
32024
- placeholder,
32025
- classNames: isEditTable ? {
32026
- valueContainer: () => "overflow-unset !px-0",
32027
- control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32028
- dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
32029
- clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
32030
- } : {
32031
- valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
32032
- control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32033
- singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
32034
- input: () => "!m-0 !p-0",
32035
- dropdownIndicator: () => "!m-0 !p-0"
32036
- },
32037
- styles: {
32038
- container: (base) => ({
32039
- ...base,
32040
- height: "100%"
32041
- }),
32042
- control: () => ({
32043
- maxWidth: isEditTable ? "max-content" : "100%",
32044
- minWidth: isEditTable ? "max-content" : "100%",
32045
- background: isEditTable ? "transparent" : "initial"
32046
- }),
32047
- multiValue: (provided, state) => {
32048
- const { color, id } = state?.data ?? {};
32049
- const bgColor = color !== null ? COLORS[color]?.color : COLORS[id]?.color;
32050
- return {
32051
- ...provided,
32052
- display: "flex",
32053
- backgroundColor: bgColor || "rgba(230.1375, 221.3625, 221.3625, 1)",
32054
- borderRadius: "16px",
32055
- color: "black",
32056
- fontWeight: "600"
32057
- };
32058
- },
32059
- multiValueRemove: (provided) => ({
32060
- ...provided,
32061
- backgroundColor: "transparent !important",
32062
- color: "black !important"
32063
- }),
32064
- option: (provided, { isFocused, isSelected }) => ({
32065
- ...provided,
32066
- backgroundColor: isSelected || isFocused ? "rgba(66,66,66,0.08)" : "#FFF",
32067
- color: isSelected ? "white" : "",
32068
- cursor: "pointer",
32069
- transition: "all 0.2s ease",
32070
- borderRadius: "8px"
32071
- }),
32072
- menu: (base) => ({
32073
- ...base,
32074
- zIndex: 9999,
32075
- width: "100%",
32076
- minWidth: "max-content",
32077
- borderRadius: "10px"
32078
- }),
32079
- menuList: (base) => ({
32080
- ...base,
32081
- padding: "4px"
32082
- })
32083
- },
32084
- components: isUser ? {
32085
- MultiValue: (multiValueProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32086
- CustomMultiValue,
32087
- {
32088
- ...multiValueProps,
32089
- stringToColor
32090
- }
32091
- ),
32092
- IndicatorSeparator: () => null
32093
- } : {
32094
- MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32095
- CustomMenuList,
32096
- {
32097
- ...menuListProps,
32098
- selectProps: {
32099
- ...menuListProps.selectProps,
32100
- setIsShowModalMany2Many
32101
- }
32102
- }
32103
- ),
32104
- IndicatorSeparator: () => null,
32105
- DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.DropdownIndicator, { ...props2 }),
32106
- ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.ClearIndicator, { ...props2 })
32107
- },
32108
- required: !invisible && required
32109
- }
32110
- ),
32111
- !isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32112
- ] });
32003
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
32004
+ "div",
32005
+ {
32006
+ className: "group h-full",
32007
+ onMouseEnter: () => setHover(true),
32008
+ onMouseLeave: () => setHover(false),
32009
+ children: [
32010
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32011
+ StateManagedSelect$1,
32012
+ {
32013
+ options: options2,
32014
+ noOptionsMessage: () => t3(isFetching ? "loading" : "no-available"),
32015
+ isMulti: true,
32016
+ isDisabled: readonly,
32017
+ isSearchable: true,
32018
+ isClearable: menuOpen,
32019
+ menuShouldScrollIntoView: false,
32020
+ menuPortalTarget: typeof window !== "undefined" ? document.body : null,
32021
+ value: filteredValue,
32022
+ onChange: handleChange,
32023
+ onMenuClose: () => {
32024
+ const filteredDomain = [...domainObject ?? []]?.filter(
32025
+ (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
32026
+ ) || [];
32027
+ setInputValue("");
32028
+ setDomainObject(filteredDomain);
32029
+ setMenuOpen(false);
32030
+ },
32031
+ onMenuOpen: () => {
32032
+ fetchMoreOptions();
32033
+ setMenuOpen(true);
32034
+ },
32035
+ onBlur: () => {
32036
+ setHover(false);
32037
+ },
32038
+ menuPlacement: "auto",
32039
+ placeholder,
32040
+ classNames: isEditTable ? {
32041
+ valueContainer: () => "overflow-unset !px-0",
32042
+ control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32043
+ dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
32044
+ clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
32045
+ } : {
32046
+ valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
32047
+ control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32048
+ singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
32049
+ input: () => "!m-0 !p-0",
32050
+ dropdownIndicator: () => "!m-0 !p-0"
32051
+ },
32052
+ styles: {
32053
+ container: (base) => ({
32054
+ ...base,
32055
+ height: "100%"
32056
+ }),
32057
+ control: () => ({
32058
+ maxWidth: isEditTable ? "max-content" : "100%",
32059
+ minWidth: isEditTable ? "max-content" : "100%",
32060
+ background: isEditTable ? "transparent" : "initial"
32061
+ }),
32062
+ multiValue: (provided, state) => {
32063
+ const { color, id } = state?.data ?? {};
32064
+ const bgColor = color !== null ? COLORS[color]?.color : COLORS[id]?.color;
32065
+ return {
32066
+ ...provided,
32067
+ display: "flex",
32068
+ backgroundColor: bgColor || "rgba(230.1375, 221.3625, 221.3625, 1)",
32069
+ borderRadius: "16px",
32070
+ color: "black",
32071
+ fontWeight: "600"
32072
+ };
32073
+ },
32074
+ multiValueRemove: (provided) => ({
32075
+ ...provided,
32076
+ backgroundColor: "transparent !important",
32077
+ color: "black !important"
32078
+ }),
32079
+ option: (provided, { isFocused, isSelected }) => ({
32080
+ ...provided,
32081
+ backgroundColor: isSelected || isFocused ? "rgba(66,66,66,0.08)" : "#FFF",
32082
+ color: isSelected ? "white" : "",
32083
+ cursor: "pointer",
32084
+ transition: "all 0.2s ease",
32085
+ borderRadius: "8px"
32086
+ }),
32087
+ menu: (base) => ({
32088
+ ...base,
32089
+ zIndex: 9999,
32090
+ width: "100%",
32091
+ minWidth: "max-content",
32092
+ borderRadius: "10px"
32093
+ }),
32094
+ menuList: (base) => ({
32095
+ ...base,
32096
+ padding: "4px"
32097
+ }),
32098
+ dropdownIndicator: (base) => ({
32099
+ ...base,
32100
+ padding: "0",
32101
+ display: hover ? "flex" : "none"
32102
+ })
32103
+ },
32104
+ components: isUser ? {
32105
+ MultiValue: (multiValueProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32106
+ CustomMultiValue,
32107
+ {
32108
+ ...multiValueProps,
32109
+ stringToColor
32110
+ }
32111
+ ),
32112
+ IndicatorSeparator: () => null
32113
+ } : {
32114
+ MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32115
+ CustomMenuList,
32116
+ {
32117
+ ...menuListProps,
32118
+ selectProps: {
32119
+ ...menuListProps.selectProps,
32120
+ setIsShowModalMany2Many
32121
+ }
32122
+ }
32123
+ ),
32124
+ IndicatorSeparator: () => null,
32125
+ DropdownIndicator: (props2) => readonly || menuOpen ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.DropdownIndicator, { ...props2 }),
32126
+ ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.ClearIndicator, { ...props2 })
32127
+ },
32128
+ required: !invisible && required
32129
+ }
32130
+ ),
32131
+ !isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32132
+ ]
32133
+ }
32134
+ );
32113
32135
  }
32114
32136
  }
32115
32137
  );
@@ -32433,6 +32455,7 @@ var RemainingDaysField = (props) => {
32433
32455
  };
32434
32456
 
32435
32457
  // src/widgets/basic/select-dropdown-field/select-dropdown.tsx
32458
+ var import_react66 = require("react");
32436
32459
  var import_jsx_runtime104 = require("react/jsx-runtime");
32437
32460
  var SelectDropdownField = (props) => {
32438
32461
  const { t: t3 } = useI18n();
@@ -32467,6 +32490,8 @@ var SelectDropdownField = (props) => {
32467
32490
  required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
32468
32491
  },
32469
32492
  render: ({ field, fieldState: { error: error2 } }) => {
32493
+ const [menuOpen, setMenuOpen] = (0, import_react66.useState)(false);
32494
+ const [hover, setHover] = (0, import_react66.useState)(false);
32470
32495
  const defaultValue = options2.find(
32471
32496
  (option) => option.value === value
32472
32497
  );
@@ -32477,13 +32502,23 @@ var SelectDropdownField = (props) => {
32477
32502
  placeholder: readonly ? "" : placeholder || t3("choose_place"),
32478
32503
  isSearchable: !readonly,
32479
32504
  isDisabled: readonly,
32505
+ isClearable: menuOpen,
32480
32506
  menuPlacement: "auto",
32481
32507
  onChange: (selectedOption) => {
32482
32508
  field.onChange(selectedOption.value);
32483
32509
  onChange2 && onChange2(name ?? "", selectedOption.value);
32484
32510
  },
32485
32511
  value: defaultValue || null,
32486
- required: !invisible && required
32512
+ required: !invisible && required,
32513
+ onMenuOpen: () => {
32514
+ setMenuOpen(true);
32515
+ },
32516
+ onMenuClose: () => {
32517
+ setMenuOpen(false);
32518
+ },
32519
+ onBlur: () => {
32520
+ setHover(false);
32521
+ }
32487
32522
  };
32488
32523
  return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(import_jsx_runtime104.Fragment, { children: [
32489
32524
  /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: `group ${isEditTable ? "h-full" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
@@ -32538,12 +32573,17 @@ var SelectDropdownField = (props) => {
32538
32573
  menuList: (base) => ({
32539
32574
  ...base,
32540
32575
  padding: "4px"
32576
+ }),
32577
+ dropdownIndicator: (base) => ({
32578
+ ...base,
32579
+ padding: "0",
32580
+ display: hover ? "flex" : "none"
32541
32581
  })
32542
32582
  },
32543
32583
  menuPortalTarget: typeof window !== "undefined" ? document.body : null,
32544
32584
  components: {
32545
32585
  IndicatorSeparator: () => null,
32546
- DropdownIndicator: (props2) => readonly || !isEditTable ? null : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(components.DropdownIndicator, { ...props2 })
32586
+ DropdownIndicator: (props2) => readonly || !isEditTable || menuOpen ? null : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(components.DropdownIndicator, { ...props2 })
32547
32587
  },
32548
32588
  noOptionsMessage: () => t3("no-available")
32549
32589
  }
@@ -32669,7 +32709,7 @@ var ToggleButtonField = (props) => {
32669
32709
  };
32670
32710
 
32671
32711
  // src/widgets/basic/integer-field/integer.tsx
32672
- var import_react66 = require("react");
32712
+ var import_react67 = require("react");
32673
32713
  var import_jsx_runtime107 = require("react/jsx-runtime");
32674
32714
  var IntegerField = (props) => {
32675
32715
  const {
@@ -32706,13 +32746,13 @@ var IntegerField = (props) => {
32706
32746
  fieldState: { error: error2 }
32707
32747
  }) => {
32708
32748
  const { setError, clearErrors } = methods;
32709
- const isDirtyRef = (0, import_react66.useRef)(false);
32710
- const inputRef = (0, import_react66.useRef)(null);
32711
- const lastCommittedValueRef = (0, import_react66.useRef)(null);
32712
- const [inputValue, setInputValue] = (0, import_react66.useState)(
32749
+ const isDirtyRef = (0, import_react67.useRef)(false);
32750
+ const inputRef = (0, import_react67.useRef)(null);
32751
+ const lastCommittedValueRef = (0, import_react67.useRef)(null);
32752
+ const [inputValue, setInputValue] = (0, import_react67.useState)(
32713
32753
  value2 !== void 0 && value2 !== null ? String(value2) : ""
32714
32754
  );
32715
- (0, import_react66.useEffect)(() => {
32755
+ (0, import_react67.useEffect)(() => {
32716
32756
  if (value2 !== void 0 && value2 !== null) {
32717
32757
  setInputValue(String(value2));
32718
32758
  clearErrors(name);
@@ -32868,7 +32908,7 @@ var StatusDropdownField = (props) => {
32868
32908
 
32869
32909
  // src/widgets/basic/many2many-field/many2many.tsx
32870
32910
  var import_react_dom8 = require("react-dom");
32871
- var import_react67 = require("react");
32911
+ var import_react68 = require("react");
32872
32912
  var import_jsx_runtime109 = require("react/jsx-runtime");
32873
32913
  var Many2ManyField = (props) => {
32874
32914
  const { t: t3 } = useI18n();
@@ -32923,7 +32963,7 @@ var Many2ManyField = (props) => {
32923
32963
  setGroupBy,
32924
32964
  clearSearch
32925
32965
  } = searchController;
32926
- (0, import_react67.useEffect)(() => {
32966
+ (0, import_react68.useEffect)(() => {
32927
32967
  const groupItems = Array.isArray(selectedTags) ? selectedTags.filter((item) => item.type === "group_by") : [];
32928
32968
  if (groupItems?.length > 0) {
32929
32969
  typeof setPageLimit === "function" && setPageLimit(80);
@@ -33078,13 +33118,13 @@ var Many2ManyField = (props) => {
33078
33118
  };
33079
33119
 
33080
33120
  // src/widgets/basic/many2one-field/many2one.tsx
33081
- var import_react68 = __toESM(require("react"));
33121
+ var import_react69 = __toESM(require("react"));
33082
33122
  var import_jsx_runtime110 = require("react/jsx-runtime");
33083
33123
  var CustomMenuList2 = (props) => {
33084
33124
  const { t: t3 } = useI18n();
33085
33125
  const { options: options2, children, selectProps } = props;
33086
33126
  const { setIsShowModalMany2Many, searchable } = selectProps;
33087
- const limitedChildren = import_react68.default.Children.toArray(children).slice(0, 10);
33127
+ const limitedChildren = import_react69.default.Children.toArray(children).slice(0, 10);
33088
33128
  return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(components.MenuList, { ...props, className: "z-[99]", children: [
33089
33129
  limitedChildren,
33090
33130
  options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
@@ -33175,8 +33215,8 @@ var Many2OneField = (props) => {
33175
33215
  } : false
33176
33216
  },
33177
33217
  render: ({ field, fieldState: { error: error2 } }) => {
33178
- const [menuOpen, setMenuOpen] = (0, import_react68.useState)(false);
33179
- const [hover, setHover] = (0, import_react68.useState)(false);
33218
+ const [menuOpen, setMenuOpen] = (0, import_react69.useState)(false);
33219
+ const [hover, setHover] = (0, import_react69.useState)(false);
33180
33220
  const currentValue = field?.value ? {
33181
33221
  value: field?.value?.id,
33182
33222
  label: field?.value?.display_name,
@@ -33185,7 +33225,7 @@ var Many2OneField = (props) => {
33185
33225
  const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length ? options2.find(
33186
33226
  (o3) => o3?.value === tempSelectedOption.value
33187
33227
  ) ?? currentValue : currentValue ?? null;
33188
- (0, import_react68.useEffect)(() => {
33228
+ (0, import_react69.useEffect)(() => {
33189
33229
  if (error2 && selectedOption) {
33190
33230
  methods?.clearErrors(name);
33191
33231
  }
@@ -33410,11 +33450,11 @@ var StatusbarDurationField = (props) => {
33410
33450
  };
33411
33451
 
33412
33452
  // src/widgets/basic/status-bar-field/option/option.tsx
33413
- var import_react69 = require("react");
33453
+ var import_react70 = require("react");
33414
33454
  var import_jsx_runtime112 = require("react/jsx-runtime");
33415
33455
  var StatusBarOptionField = (props) => {
33416
33456
  const { selection, defaultValue } = props;
33417
- const memoizedStatusOptions = (0, import_react69.useMemo)(() => selection, [selection]);
33457
+ const memoizedStatusOptions = (0, import_react70.useMemo)(() => selection, [selection]);
33418
33458
  const indexInProgress = memoizedStatusOptions?.findIndex(
33419
33459
  (option) => option?.[0] === defaultValue
33420
33460
  );