@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.js CHANGED
@@ -17861,8 +17861,8 @@ var CopyLinkButtonField = (props) => {
17861
17861
  baseClassName
17862
17862
  } = props;
17863
17863
  const { t: t3 } = useI18n();
17864
- if (!isForm) {
17865
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "truncate max-w-[300px]", children: propValue && typeof propValue === "object" ? propValue.display_name : propValue });
17864
+ if (!isForm && !isEditTable) {
17865
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "truncate max-w-[300px]", children: maskingValue || (propValue && typeof propValue === "object" ? propValue.display_name : propValue) });
17866
17866
  }
17867
17867
  return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
17868
17868
  Controller,
@@ -32736,6 +32736,8 @@ var Many2ManyTagField = (props) => {
32736
32736
  required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
32737
32737
  },
32738
32738
  render: ({ field, fieldState: { error: error2 } }) => {
32739
+ const [menuOpen, setMenuOpen] = (0, import_react62.useState)(false);
32740
+ const [hover, setHover] = (0, import_react62.useState)(false);
32739
32741
  const { clearErrors } = methods;
32740
32742
  (0, import_react62.useEffect)(() => {
32741
32743
  if (field.value) {
@@ -32770,118 +32772,138 @@ var Many2ManyTagField = (props) => {
32770
32772
  });
32771
32773
  });
32772
32774
  };
32773
- return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "group h-full", children: [
32774
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32775
- StateManagedSelect$1,
32776
- {
32777
- options: options2,
32778
- noOptionsMessage: () => t3(isFetching ? "loading" : "no-available"),
32779
- isMulti: true,
32780
- isDisabled: readonly,
32781
- isSearchable: true,
32782
- isClearable: true,
32783
- menuShouldScrollIntoView: false,
32784
- menuPortalTarget: typeof window !== "undefined" ? document.body : null,
32785
- value: filteredValue,
32786
- onChange: handleChange,
32787
- onMenuClose: () => {
32788
- const filteredDomain = [...domainObject ?? []]?.filter(
32789
- (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
32790
- ) || [];
32791
- setInputValue("");
32792
- setDomainObject(filteredDomain);
32793
- },
32794
- onMenuOpen: fetchMoreOptions,
32795
- menuPlacement: "auto",
32796
- placeholder,
32797
- classNames: isEditTable ? {
32798
- valueContainer: () => "overflow-unset !px-0",
32799
- control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32800
- dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
32801
- clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
32802
- } : {
32803
- valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
32804
- control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32805
- singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
32806
- input: () => "!m-0 !p-0",
32807
- dropdownIndicator: () => "!m-0 !p-0"
32808
- },
32809
- styles: {
32810
- container: (base) => ({
32811
- ...base,
32812
- height: "100%"
32813
- }),
32814
- control: () => ({
32815
- maxWidth: isEditTable ? "max-content" : "100%",
32816
- minWidth: isEditTable ? "max-content" : "100%",
32817
- background: isEditTable ? "transparent" : "initial"
32818
- }),
32819
- multiValue: (provided, state) => {
32820
- const { color, id } = state?.data ?? {};
32821
- const bgColor = color !== null ? COLORS[color]?.color : COLORS[id]?.color;
32822
- return {
32823
- ...provided,
32824
- display: "flex",
32825
- backgroundColor: bgColor || "rgba(230.1375, 221.3625, 221.3625, 1)",
32826
- borderRadius: "16px",
32827
- color: "black",
32828
- fontWeight: "600"
32829
- };
32830
- },
32831
- multiValueRemove: (provided) => ({
32832
- ...provided,
32833
- backgroundColor: "transparent !important",
32834
- color: "black !important"
32835
- }),
32836
- option: (provided, { isFocused, isSelected }) => ({
32837
- ...provided,
32838
- backgroundColor: isSelected || isFocused ? "rgba(66,66,66,0.08)" : "#FFF",
32839
- color: isSelected ? "white" : "",
32840
- cursor: "pointer",
32841
- transition: "all 0.2s ease",
32842
- borderRadius: "8px"
32843
- }),
32844
- menu: (base) => ({
32845
- ...base,
32846
- zIndex: 9999,
32847
- width: "100%",
32848
- minWidth: "max-content",
32849
- borderRadius: "10px"
32850
- }),
32851
- menuList: (base) => ({
32852
- ...base,
32853
- padding: "4px"
32854
- })
32855
- },
32856
- components: isUser ? {
32857
- MultiValue: (multiValueProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32858
- CustomMultiValue,
32859
- {
32860
- ...multiValueProps,
32861
- stringToColor
32862
- }
32863
- ),
32864
- IndicatorSeparator: () => null
32865
- } : {
32866
- MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32867
- CustomMenuList,
32868
- {
32869
- ...menuListProps,
32870
- selectProps: {
32871
- ...menuListProps.selectProps,
32872
- setIsShowModalMany2Many
32873
- }
32874
- }
32875
- ),
32876
- IndicatorSeparator: () => null,
32877
- DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.DropdownIndicator, { ...props2 }),
32878
- ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.ClearIndicator, { ...props2 })
32879
- },
32880
- required: !invisible && required
32881
- }
32882
- ),
32883
- !isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32884
- ] });
32775
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
32776
+ "div",
32777
+ {
32778
+ className: "group h-full",
32779
+ onMouseEnter: () => setHover(true),
32780
+ onMouseLeave: () => setHover(false),
32781
+ children: [
32782
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32783
+ StateManagedSelect$1,
32784
+ {
32785
+ options: options2,
32786
+ noOptionsMessage: () => t3(isFetching ? "loading" : "no-available"),
32787
+ isMulti: true,
32788
+ isDisabled: readonly,
32789
+ isSearchable: true,
32790
+ isClearable: menuOpen,
32791
+ menuShouldScrollIntoView: false,
32792
+ menuPortalTarget: typeof window !== "undefined" ? document.body : null,
32793
+ value: filteredValue,
32794
+ onChange: handleChange,
32795
+ onMenuClose: () => {
32796
+ const filteredDomain = [...domainObject ?? []]?.filter(
32797
+ (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
32798
+ ) || [];
32799
+ setInputValue("");
32800
+ setDomainObject(filteredDomain);
32801
+ setMenuOpen(false);
32802
+ },
32803
+ onMenuOpen: () => {
32804
+ fetchMoreOptions();
32805
+ setMenuOpen(true);
32806
+ },
32807
+ onBlur: () => {
32808
+ setHover(false);
32809
+ },
32810
+ menuPlacement: "auto",
32811
+ placeholder,
32812
+ classNames: isEditTable ? {
32813
+ valueContainer: () => "overflow-unset !px-0",
32814
+ control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32815
+ dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
32816
+ clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
32817
+ } : {
32818
+ valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
32819
+ control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
32820
+ singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
32821
+ input: () => "!m-0 !p-0",
32822
+ dropdownIndicator: () => "!m-0 !p-0"
32823
+ },
32824
+ styles: {
32825
+ container: (base) => ({
32826
+ ...base,
32827
+ height: "100%"
32828
+ }),
32829
+ control: () => ({
32830
+ maxWidth: isEditTable ? "max-content" : "100%",
32831
+ minWidth: isEditTable ? "max-content" : "100%",
32832
+ background: isEditTable ? "transparent" : "initial"
32833
+ }),
32834
+ multiValue: (provided, state) => {
32835
+ const { color, id } = state?.data ?? {};
32836
+ const bgColor = color !== null ? COLORS[color]?.color : COLORS[id]?.color;
32837
+ return {
32838
+ ...provided,
32839
+ display: "flex",
32840
+ backgroundColor: bgColor || "rgba(230.1375, 221.3625, 221.3625, 1)",
32841
+ borderRadius: "16px",
32842
+ color: "black",
32843
+ fontWeight: "600"
32844
+ };
32845
+ },
32846
+ multiValueRemove: (provided) => ({
32847
+ ...provided,
32848
+ backgroundColor: "transparent !important",
32849
+ color: "black !important"
32850
+ }),
32851
+ option: (provided, { isFocused, isSelected }) => ({
32852
+ ...provided,
32853
+ backgroundColor: isSelected || isFocused ? "rgba(66,66,66,0.08)" : "#FFF",
32854
+ color: isSelected ? "white" : "",
32855
+ cursor: "pointer",
32856
+ transition: "all 0.2s ease",
32857
+ borderRadius: "8px"
32858
+ }),
32859
+ menu: (base) => ({
32860
+ ...base,
32861
+ zIndex: 9999,
32862
+ width: "100%",
32863
+ minWidth: "max-content",
32864
+ borderRadius: "10px"
32865
+ }),
32866
+ menuList: (base) => ({
32867
+ ...base,
32868
+ padding: "4px"
32869
+ }),
32870
+ dropdownIndicator: (base) => ({
32871
+ ...base,
32872
+ padding: "0",
32873
+ display: hover ? "flex" : "none"
32874
+ })
32875
+ },
32876
+ components: isUser ? {
32877
+ MultiValue: (multiValueProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32878
+ CustomMultiValue,
32879
+ {
32880
+ ...multiValueProps,
32881
+ stringToColor
32882
+ }
32883
+ ),
32884
+ IndicatorSeparator: () => null
32885
+ } : {
32886
+ MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
32887
+ CustomMenuList,
32888
+ {
32889
+ ...menuListProps,
32890
+ selectProps: {
32891
+ ...menuListProps.selectProps,
32892
+ setIsShowModalMany2Many
32893
+ }
32894
+ }
32895
+ ),
32896
+ IndicatorSeparator: () => null,
32897
+ DropdownIndicator: (props2) => readonly || menuOpen ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.DropdownIndicator, { ...props2 }),
32898
+ ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.ClearIndicator, { ...props2 })
32899
+ },
32900
+ required: !invisible && required
32901
+ }
32902
+ ),
32903
+ !isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
32904
+ ]
32905
+ }
32906
+ );
32885
32907
  }
32886
32908
  }
32887
32909
  );
@@ -33205,6 +33227,7 @@ var RemainingDaysField = (props) => {
33205
33227
  };
33206
33228
 
33207
33229
  // src/widgets/basic/select-dropdown-field/select-dropdown.tsx
33230
+ var import_react66 = require("react");
33208
33231
  var import_jsx_runtime104 = require("react/jsx-runtime");
33209
33232
  var SelectDropdownField = (props) => {
33210
33233
  const { t: t3 } = useI18n();
@@ -33239,6 +33262,8 @@ var SelectDropdownField = (props) => {
33239
33262
  required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
33240
33263
  },
33241
33264
  render: ({ field, fieldState: { error: error2 } }) => {
33265
+ const [menuOpen, setMenuOpen] = (0, import_react66.useState)(false);
33266
+ const [hover, setHover] = (0, import_react66.useState)(false);
33242
33267
  const defaultValue = options2.find(
33243
33268
  (option) => option.value === value
33244
33269
  );
@@ -33249,13 +33274,23 @@ var SelectDropdownField = (props) => {
33249
33274
  placeholder: readonly ? "" : placeholder || t3("choose_place"),
33250
33275
  isSearchable: !readonly,
33251
33276
  isDisabled: readonly,
33277
+ isClearable: menuOpen,
33252
33278
  menuPlacement: "auto",
33253
33279
  onChange: (selectedOption) => {
33254
33280
  field.onChange(selectedOption.value);
33255
33281
  onChange2 && onChange2(name ?? "", selectedOption.value);
33256
33282
  },
33257
33283
  value: defaultValue || null,
33258
- required: !invisible && required
33284
+ required: !invisible && required,
33285
+ onMenuOpen: () => {
33286
+ setMenuOpen(true);
33287
+ },
33288
+ onMenuClose: () => {
33289
+ setMenuOpen(false);
33290
+ },
33291
+ onBlur: () => {
33292
+ setHover(false);
33293
+ }
33259
33294
  };
33260
33295
  return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(import_jsx_runtime104.Fragment, { children: [
33261
33296
  /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: `group ${isEditTable ? "h-full" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
@@ -33310,12 +33345,17 @@ var SelectDropdownField = (props) => {
33310
33345
  menuList: (base) => ({
33311
33346
  ...base,
33312
33347
  padding: "4px"
33348
+ }),
33349
+ dropdownIndicator: (base) => ({
33350
+ ...base,
33351
+ padding: "0",
33352
+ display: hover ? "flex" : "none"
33313
33353
  })
33314
33354
  },
33315
33355
  menuPortalTarget: typeof window !== "undefined" ? document.body : null,
33316
33356
  components: {
33317
33357
  IndicatorSeparator: () => null,
33318
- DropdownIndicator: (props2) => readonly || !isEditTable ? null : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(components.DropdownIndicator, { ...props2 })
33358
+ DropdownIndicator: (props2) => readonly || !isEditTable || menuOpen ? null : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(components.DropdownIndicator, { ...props2 })
33319
33359
  },
33320
33360
  noOptionsMessage: () => t3("no-available")
33321
33361
  }
@@ -33441,7 +33481,7 @@ var ToggleButtonField = (props) => {
33441
33481
  };
33442
33482
 
33443
33483
  // src/widgets/basic/integer-field/integer.tsx
33444
- var import_react66 = require("react");
33484
+ var import_react67 = require("react");
33445
33485
  var import_jsx_runtime107 = require("react/jsx-runtime");
33446
33486
  var IntegerField = (props) => {
33447
33487
  const {
@@ -33478,13 +33518,13 @@ var IntegerField = (props) => {
33478
33518
  fieldState: { error: error2 }
33479
33519
  }) => {
33480
33520
  const { setError, clearErrors } = methods;
33481
- const isDirtyRef = (0, import_react66.useRef)(false);
33482
- const inputRef = (0, import_react66.useRef)(null);
33483
- const lastCommittedValueRef = (0, import_react66.useRef)(null);
33484
- const [inputValue, setInputValue] = (0, import_react66.useState)(
33521
+ const isDirtyRef = (0, import_react67.useRef)(false);
33522
+ const inputRef = (0, import_react67.useRef)(null);
33523
+ const lastCommittedValueRef = (0, import_react67.useRef)(null);
33524
+ const [inputValue, setInputValue] = (0, import_react67.useState)(
33485
33525
  value2 !== void 0 && value2 !== null ? String(value2) : ""
33486
33526
  );
33487
- (0, import_react66.useEffect)(() => {
33527
+ (0, import_react67.useEffect)(() => {
33488
33528
  if (value2 !== void 0 && value2 !== null) {
33489
33529
  setInputValue(String(value2));
33490
33530
  clearErrors(name);
@@ -33640,7 +33680,7 @@ var StatusDropdownField = (props) => {
33640
33680
 
33641
33681
  // src/widgets/basic/many2many-field/many2many.tsx
33642
33682
  var import_react_dom8 = require("react-dom");
33643
- var import_react67 = require("react");
33683
+ var import_react68 = require("react");
33644
33684
  var import_jsx_runtime109 = require("react/jsx-runtime");
33645
33685
  var Many2ManyField = (props) => {
33646
33686
  const { t: t3 } = useI18n();
@@ -33695,7 +33735,7 @@ var Many2ManyField = (props) => {
33695
33735
  setGroupBy,
33696
33736
  clearSearch
33697
33737
  } = searchController;
33698
- (0, import_react67.useEffect)(() => {
33738
+ (0, import_react68.useEffect)(() => {
33699
33739
  const groupItems = Array.isArray(selectedTags) ? selectedTags.filter((item) => item.type === "group_by") : [];
33700
33740
  if (groupItems?.length > 0) {
33701
33741
  typeof setPageLimit === "function" && setPageLimit(80);
@@ -33850,13 +33890,13 @@ var Many2ManyField = (props) => {
33850
33890
  };
33851
33891
 
33852
33892
  // src/widgets/basic/many2one-field/many2one.tsx
33853
- var import_react68 = __toESM(require("react"));
33893
+ var import_react69 = __toESM(require("react"));
33854
33894
  var import_jsx_runtime110 = require("react/jsx-runtime");
33855
33895
  var CustomMenuList2 = (props) => {
33856
33896
  const { t: t3 } = useI18n();
33857
33897
  const { options: options2, children, selectProps } = props;
33858
33898
  const { setIsShowModalMany2Many, searchable } = selectProps;
33859
- const limitedChildren = import_react68.default.Children.toArray(children).slice(0, 10);
33899
+ const limitedChildren = import_react69.default.Children.toArray(children).slice(0, 10);
33860
33900
  return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(components.MenuList, { ...props, className: "z-[99]", children: [
33861
33901
  limitedChildren,
33862
33902
  options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
@@ -33947,8 +33987,8 @@ var Many2OneField = (props) => {
33947
33987
  } : false
33948
33988
  },
33949
33989
  render: ({ field, fieldState: { error: error2 } }) => {
33950
- const [menuOpen, setMenuOpen] = (0, import_react68.useState)(false);
33951
- const [hover, setHover] = (0, import_react68.useState)(false);
33990
+ const [menuOpen, setMenuOpen] = (0, import_react69.useState)(false);
33991
+ const [hover, setHover] = (0, import_react69.useState)(false);
33952
33992
  const currentValue = field?.value ? {
33953
33993
  value: field?.value?.id,
33954
33994
  label: field?.value?.display_name,
@@ -33957,7 +33997,7 @@ var Many2OneField = (props) => {
33957
33997
  const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length ? options2.find(
33958
33998
  (o3) => o3?.value === tempSelectedOption.value
33959
33999
  ) ?? currentValue : currentValue ?? null;
33960
- (0, import_react68.useEffect)(() => {
34000
+ (0, import_react69.useEffect)(() => {
33961
34001
  if (error2 && selectedOption) {
33962
34002
  methods?.clearErrors(name);
33963
34003
  }
@@ -34182,11 +34222,11 @@ var StatusbarDurationField = (props) => {
34182
34222
  };
34183
34223
 
34184
34224
  // src/widgets/basic/status-bar-field/option/option.tsx
34185
- var import_react69 = require("react");
34225
+ var import_react70 = require("react");
34186
34226
  var import_jsx_runtime112 = require("react/jsx-runtime");
34187
34227
  var StatusBarOptionField = (props) => {
34188
34228
  const { selection, defaultValue } = props;
34189
- const memoizedStatusOptions = (0, import_react69.useMemo)(() => selection, [selection]);
34229
+ const memoizedStatusOptions = (0, import_react70.useMemo)(() => selection, [selection]);
34190
34230
  const indexInProgress = memoizedStatusOptions?.findIndex(
34191
34231
  (option) => option?.[0] === defaultValue
34192
34232
  );