@fctc/sme-widget-ui 1.6.9 → 1.7.1

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
@@ -18573,6 +18573,7 @@ var ButtonField = (props) => {
18573
18573
  // src/widgets/basic/char-field/char.tsx
18574
18574
  var import_react38 = require("react");
18575
18575
  var import_jsx_runtime73 = require("react/jsx-runtime");
18576
+ var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
18576
18577
  var CharField = (props) => {
18577
18578
  const {
18578
18579
  name: name2,
@@ -18594,7 +18595,8 @@ var CharField = (props) => {
18594
18595
  isEditTable,
18595
18596
  isForm,
18596
18597
  value,
18597
- defaultValue
18598
+ defaultValue,
18599
+ options: options2
18598
18600
  } = props;
18599
18601
  if (!isForm && !isEditTable) {
18600
18602
  const propValue = value || defaultValue;
@@ -18633,13 +18635,32 @@ var CharField = (props) => {
18633
18635
  clearErrors(name2);
18634
18636
  }
18635
18637
  }, [value2, clearErrors, name2]);
18638
+ (0, import_react38.useEffect)(() => {
18639
+ if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
18640
+ const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
18641
+ const currentValue = methods?.getValues(name2);
18642
+ if (currentValue !== depValue) {
18643
+ methods?.setValue(name2, depValue, { shouldValidate: true });
18644
+ }
18645
+ }, [widget, formValues]);
18636
18646
  const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
18637
- const displayValue = (widget === "access_token" || widget === "refresh_token") && typeof realValue === "string" && !isDirty ? "*".repeat(realValue?.length) : widget === "private_secret_key" && formValues?.id && typeof formValues?.id === "number" && !isDirty && typeof realValue === "string" ? `${realValue?.slice(0, 4)}${realValue?.length > 4 ? "*".repeat(realValue?.length - 4) : ""}` : typeof realValue === "string" || typeof realValue === "number" ? String(realValue) : "";
18647
+ const displayValue = (0, import_react38.useMemo)(() => {
18648
+ if ((widget === "access_token" || widget === "refresh_token") && typeof realValue === "string" && !isDirty) {
18649
+ return "*".repeat(realValue.length);
18650
+ }
18651
+ if (widget === "private_secret_key" && formValues?.id && typeof formValues?.id === "number" && !isDirty && typeof realValue === "string") {
18652
+ return `${realValue.slice(0, 4)}${realValue.length > 4 ? "*".repeat(realValue.length - 4) : ""}`;
18653
+ }
18654
+ if (typeof realValue === "string" || typeof realValue === "number") {
18655
+ return String(realValue);
18656
+ }
18657
+ return "";
18658
+ }, [widget, formValues]);
18638
18659
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
18639
18660
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
18640
18661
  "input",
18641
18662
  {
18642
- value: displayValue,
18663
+ value: displayValue ?? "",
18643
18664
  onChange: (e3) => {
18644
18665
  const inputValue = e3.target.value;
18645
18666
  if (readonly) return;
@@ -33835,12 +33856,12 @@ var Many2ManyTagField = (props) => {
33835
33856
  placeholder: readonly ? "" : instance.t("choose_place"),
33836
33857
  classNames: isEditTable ? {
33837
33858
  valueContainer: () => "overflow-unset !px-0",
33838
- control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "!cursor-not-allowed" : ""}`,
33859
+ control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-max max-w-max !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? `!cursor-not-allowed ${filteredValue?.length === 0 && "no-values"}` : ""}`,
33839
33860
  dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
33840
33861
  clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
33841
33862
  } : {
33842
33863
  valueContainer: () => "overflow-unset !m-0 !p-0",
33843
- control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"}`,
33864
+ control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"} ${filteredValue?.length === 0 && "no-values"}`,
33844
33865
  singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
33845
33866
  input: () => "!m-0 !p-0",
33846
33867
  dropdownIndicator: () => "!m-0 !p-0"
@@ -33875,8 +33896,8 @@ var Many2ManyTagField = (props) => {
33875
33896
  menu: (base) => ({
33876
33897
  ...base,
33877
33898
  zIndex: 9999,
33878
- width: "300px",
33879
- minWidth: "300px",
33899
+ width: "auto",
33900
+ minWidth: "max-content",
33880
33901
  borderRadius: "10px"
33881
33902
  }),
33882
33903
  menuList: (base) => ({
@@ -33905,7 +33926,8 @@ var Many2ManyTagField = (props) => {
33905
33926
  }
33906
33927
  ),
33907
33928
  IndicatorSeparator: () => null,
33908
- DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(components.DropdownIndicator, { ...props2 })
33929
+ DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(components.DropdownIndicator, { ...props2 }),
33930
+ ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(components.ClearIndicator, { ...props2 })
33909
33931
  },
33910
33932
  required: !invisible && required
33911
33933
  }
@@ -34294,7 +34316,7 @@ var SelectDropdownField = (props) => {
34294
34316
  {
34295
34317
  ...commonProps,
34296
34318
  classNames: {
34297
- control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-[200px] max-w-[300px] rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
34319
+ control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-max max-w-max rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
34298
34320
  valueContainer: () => "!m-0 !p-0 ",
34299
34321
  singleValue: () => `!m-0`,
34300
34322
  input: () => "!m-0 !p-0",
@@ -34995,7 +35017,7 @@ var Many2OneField = (props) => {
34995
35017
  setDomainObject
34996
35018
  } = props;
34997
35019
  if (!isForm && !isEditTable) {
34998
- const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue.id : propValue;
35020
+ const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
34999
35021
  return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_jsx_runtime103.Fragment, { children: [
35000
35022
  allowShowDetail && renderDetail({
35001
35023
  idToolTip: String(name2) + Number(index4),
@@ -35009,7 +35031,7 @@ var Many2OneField = (props) => {
35009
35031
  className: "cursor-pointer",
35010
35032
  "data-tooltip-id": String(name2) + index4,
35011
35033
  id: name2,
35012
- children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue.display_name : propValue
35034
+ children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue
35013
35035
  }
35014
35036
  )
35015
35037
  ] });
@@ -35039,7 +35061,11 @@ var Many2OneField = (props) => {
35039
35061
  } : false
35040
35062
  },
35041
35063
  render: ({ field, fieldState: { error: error2 } }) => {
35042
- const currentValue = field?.value ? { value: field?.value?.id, label: field?.value?.display_name } : null;
35064
+ const currentValue = field?.value ? {
35065
+ value: field?.value?.id,
35066
+ label: field?.value?.display_name,
35067
+ ...field?.value ?? {}
35068
+ } : null;
35043
35069
  const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length > 0 ? options2.find(
35044
35070
  (option) => option.value === tempSelectedOption?.value
35045
35071
  ) : currentValue ? currentValue : null;
@@ -35055,7 +35081,7 @@ var Many2OneField = (props) => {
35055
35081
  menuShouldScrollIntoView: false,
35056
35082
  options: listOptions,
35057
35083
  classNames: {
35058
- control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-[200px] max-w-[300px] rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
35084
+ control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-max max-w-max rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
35059
35085
  valueContainer: () => "!m-0 !p-0 ",
35060
35086
  singleValue: () => `!m-0`,
35061
35087
  input: () => "!m-0 !p-0",
package/dist/index.mjs CHANGED
@@ -18450,8 +18450,9 @@ var ButtonField = (props) => {
18450
18450
  };
18451
18451
 
18452
18452
  // src/widgets/basic/char-field/char.tsx
18453
- import { useEffect as useEffect10 } from "react";
18453
+ import { useEffect as useEffect10, useMemo as useMemo4 } from "react";
18454
18454
  import { Fragment as Fragment17, jsx as jsx73, jsxs as jsxs48 } from "react/jsx-runtime";
18455
+ var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
18455
18456
  var CharField = (props) => {
18456
18457
  const {
18457
18458
  name: name2,
@@ -18473,7 +18474,8 @@ var CharField = (props) => {
18473
18474
  isEditTable,
18474
18475
  isForm,
18475
18476
  value,
18476
- defaultValue
18477
+ defaultValue,
18478
+ options: options2
18477
18479
  } = props;
18478
18480
  if (!isForm && !isEditTable) {
18479
18481
  const propValue = value || defaultValue;
@@ -18512,13 +18514,32 @@ var CharField = (props) => {
18512
18514
  clearErrors(name2);
18513
18515
  }
18514
18516
  }, [value2, clearErrors, name2]);
18517
+ useEffect10(() => {
18518
+ if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
18519
+ const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
18520
+ const currentValue = methods?.getValues(name2);
18521
+ if (currentValue !== depValue) {
18522
+ methods?.setValue(name2, depValue, { shouldValidate: true });
18523
+ }
18524
+ }, [widget, formValues]);
18515
18525
  const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
18516
- const displayValue = (widget === "access_token" || widget === "refresh_token") && typeof realValue === "string" && !isDirty ? "*".repeat(realValue?.length) : widget === "private_secret_key" && formValues?.id && typeof formValues?.id === "number" && !isDirty && typeof realValue === "string" ? `${realValue?.slice(0, 4)}${realValue?.length > 4 ? "*".repeat(realValue?.length - 4) : ""}` : typeof realValue === "string" || typeof realValue === "number" ? String(realValue) : "";
18526
+ const displayValue = useMemo4(() => {
18527
+ if ((widget === "access_token" || widget === "refresh_token") && typeof realValue === "string" && !isDirty) {
18528
+ return "*".repeat(realValue.length);
18529
+ }
18530
+ if (widget === "private_secret_key" && formValues?.id && typeof formValues?.id === "number" && !isDirty && typeof realValue === "string") {
18531
+ return `${realValue.slice(0, 4)}${realValue.length > 4 ? "*".repeat(realValue.length - 4) : ""}`;
18532
+ }
18533
+ if (typeof realValue === "string" || typeof realValue === "number") {
18534
+ return String(realValue);
18535
+ }
18536
+ return "";
18537
+ }, [widget, formValues]);
18517
18538
  return /* @__PURE__ */ jsxs48(Fragment17, { children: [
18518
18539
  /* @__PURE__ */ jsx73(
18519
18540
  "input",
18520
18541
  {
18521
- value: displayValue,
18542
+ value: displayValue ?? "",
18522
18543
  onChange: (e3) => {
18523
18544
  const inputValue = e3.target.value;
18524
18545
  if (readonly) return;
@@ -27764,7 +27785,7 @@ function _extends() {
27764
27785
 
27765
27786
  // node_modules/react-select/dist/react-select.esm.js
27766
27787
  import * as React14 from "react";
27767
- import { forwardRef as forwardRef5, useMemo as useMemo8 } from "react";
27788
+ import { forwardRef as forwardRef5, useMemo as useMemo9 } from "react";
27768
27789
 
27769
27790
  // node_modules/@babel/runtime/helpers/esm/classCallCheck.js
27770
27791
  function _classCallCheck(a2, n4) {
@@ -27872,7 +27893,7 @@ function _toConsumableArray(r4) {
27872
27893
 
27873
27894
  // node_modules/react-select/dist/Select-ef7c0426.esm.js
27874
27895
  import * as React13 from "react";
27875
- import { useMemo as useMemo7, Fragment as Fragment22, useRef as useRef14, useCallback as useCallback8, useEffect as useEffect15, Component as Component2 } from "react";
27896
+ import { useMemo as useMemo8, Fragment as Fragment22, useRef as useRef14, useCallback as useCallback8, useEffect as useEffect15, Component as Component2 } from "react";
27876
27897
 
27877
27898
  // node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
27878
27899
  import * as React11 from "react";
@@ -29204,7 +29225,7 @@ function _taggedTemplateLiteral(e3, t3) {
29204
29225
  }
29205
29226
 
29206
29227
  // node_modules/react-select/dist/index-641ee5b8.esm.js
29207
- import { useContext as useContext8, useRef as useRef13, useState as useState15, useMemo as useMemo6, useCallback as useCallback7, createContext as createContext4 } from "react";
29228
+ import { useContext as useContext8, useRef as useRef13, useState as useState15, useMemo as useMemo7, useCallback as useCallback7, createContext as createContext4 } from "react";
29208
29229
  import { createPortal as createPortal4 } from "react-dom";
29209
29230
 
29210
29231
  // node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
@@ -29657,7 +29678,7 @@ var MenuPortal = function MenuPortal2(props) {
29657
29678
  var menuPortalRef = useRef13(null);
29658
29679
  var cleanupRef = useRef13(null);
29659
29680
  var _useState5 = useState15(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
29660
- var portalPlacementContext = useMemo6(function() {
29681
+ var portalPlacementContext = useMemo7(function() {
29661
29682
  return {
29662
29683
  setPortalPlacement
29663
29684
  };
@@ -30363,10 +30384,10 @@ var LiveRegion = function LiveRegion2(props) {
30363
30384
  var ariaLiveMessages = selectProps.ariaLiveMessages, getOptionLabel4 = selectProps.getOptionLabel, inputValue = selectProps.inputValue, isMulti = selectProps.isMulti, isOptionDisabled3 = selectProps.isOptionDisabled, isSearchable = selectProps.isSearchable, menuIsOpen = selectProps.menuIsOpen, options2 = selectProps.options, screenReaderStatus2 = selectProps.screenReaderStatus, tabSelectsValue = selectProps.tabSelectsValue, isLoading = selectProps.isLoading;
30364
30385
  var ariaLabel = selectProps["aria-label"];
30365
30386
  var ariaLive = selectProps["aria-live"];
30366
- var messages = useMemo7(function() {
30387
+ var messages = useMemo8(function() {
30367
30388
  return _objectSpread2(_objectSpread2({}, defaultAriaLiveMessages), ariaLiveMessages || {});
30368
30389
  }, [ariaLiveMessages]);
30369
- var ariaSelected = useMemo7(function() {
30390
+ var ariaSelected = useMemo8(function() {
30370
30391
  var message2 = "";
30371
30392
  if (ariaSelection && messages.onChange) {
30372
30393
  var option = ariaSelection.option, selectedOptions = ariaSelection.options, removedValue = ariaSelection.removedValue, removedValues = ariaSelection.removedValues, value = ariaSelection.value;
@@ -30388,7 +30409,7 @@ var LiveRegion = function LiveRegion2(props) {
30388
30409
  }
30389
30410
  return message2;
30390
30411
  }, [ariaSelection, messages, isOptionDisabled3, selectValue, getOptionLabel4]);
30391
- var ariaFocused = useMemo7(function() {
30412
+ var ariaFocused = useMemo8(function() {
30392
30413
  var focusMsg = "";
30393
30414
  var focused = focusedOption || focusedValue;
30394
30415
  var isSelected = !!(focusedOption && selectValue && selectValue.includes(focusedOption));
@@ -30407,7 +30428,7 @@ var LiveRegion = function LiveRegion2(props) {
30407
30428
  }
30408
30429
  return focusMsg;
30409
30430
  }, [focusedOption, focusedValue, getOptionLabel4, isOptionDisabled3, messages, focusableOptions, selectValue, isAppleDevice2]);
30410
- var ariaResults = useMemo7(function() {
30431
+ var ariaResults = useMemo8(function() {
30411
30432
  var resultsMsg = "";
30412
30433
  if (menuIsOpen && options2.length && !isLoading && messages.onFilter) {
30413
30434
  var resultsMessage = screenReaderStatus2({
@@ -30421,7 +30442,7 @@ var LiveRegion = function LiveRegion2(props) {
30421
30442
  return resultsMsg;
30422
30443
  }, [focusableOptions, inputValue, menuIsOpen, messages, options2, screenReaderStatus2, isLoading]);
30423
30444
  var isInitialFocus = (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus";
30424
- var ariaGuidance = useMemo7(function() {
30445
+ var ariaGuidance = useMemo8(function() {
30425
30446
  var guidanceMsg = "";
30426
30447
  if (messages.guidance) {
30427
30448
  var context = focusedValue ? "value" : menuIsOpen ? "menu" : "input";
@@ -33519,7 +33540,7 @@ var ImageField = (props) => {
33519
33540
  };
33520
33541
 
33521
33542
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
33522
- import React16, { useEffect as useEffect20, useMemo as useMemo9 } from "react";
33543
+ import React16, { useEffect as useEffect20, useMemo as useMemo10 } from "react";
33523
33544
 
33524
33545
  // src/widgets/basic/information-field/information.tsx
33525
33546
  import { Fragment as Fragment27, jsx as jsx91, jsxs as jsxs60 } from "react/jsx-runtime";
@@ -33667,7 +33688,7 @@ var Many2ManyTagField = (props) => {
33667
33688
  clearErrors(name2);
33668
33689
  }
33669
33690
  }, [field.value]);
33670
- const filteredValue = useMemo9(() => {
33691
+ const filteredValue = useMemo10(() => {
33671
33692
  if (!Array.isArray(field?.value)) return null;
33672
33693
  const fieldValueMapped = field.value.map((v) => ({
33673
33694
  value: v?.id,
@@ -33714,12 +33735,12 @@ var Many2ManyTagField = (props) => {
33714
33735
  placeholder: readonly ? "" : instance.t("choose_place"),
33715
33736
  classNames: isEditTable ? {
33716
33737
  valueContainer: () => "overflow-unset !px-0",
33717
- control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "!cursor-not-allowed" : ""}`,
33738
+ control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-max max-w-max !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? `!cursor-not-allowed ${filteredValue?.length === 0 && "no-values"}` : ""}`,
33718
33739
  dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
33719
33740
  clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
33720
33741
  } : {
33721
33742
  valueContainer: () => "overflow-unset !m-0 !p-0",
33722
- control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"}`,
33743
+ control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"} ${filteredValue?.length === 0 && "no-values"}`,
33723
33744
  singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
33724
33745
  input: () => "!m-0 !p-0",
33725
33746
  dropdownIndicator: () => "!m-0 !p-0"
@@ -33754,8 +33775,8 @@ var Many2ManyTagField = (props) => {
33754
33775
  menu: (base) => ({
33755
33776
  ...base,
33756
33777
  zIndex: 9999,
33757
- width: "300px",
33758
- minWidth: "300px",
33778
+ width: "auto",
33779
+ minWidth: "max-content",
33759
33780
  borderRadius: "10px"
33760
33781
  }),
33761
33782
  menuList: (base) => ({
@@ -33784,7 +33805,8 @@ var Many2ManyTagField = (props) => {
33784
33805
  }
33785
33806
  ),
33786
33807
  IndicatorSeparator: () => null,
33787
- DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx92(components.DropdownIndicator, { ...props2 })
33808
+ DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx92(components.DropdownIndicator, { ...props2 }),
33809
+ ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx92(components.ClearIndicator, { ...props2 })
33788
33810
  },
33789
33811
  required: !invisible && required
33790
33812
  }
@@ -34173,7 +34195,7 @@ var SelectDropdownField = (props) => {
34173
34195
  {
34174
34196
  ...commonProps,
34175
34197
  classNames: {
34176
- control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-[200px] max-w-[300px] rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
34198
+ control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-max max-w-max rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
34177
34199
  valueContainer: () => "!m-0 !p-0 ",
34178
34200
  singleValue: () => `!m-0`,
34179
34201
  input: () => "!m-0 !p-0",
@@ -34874,7 +34896,7 @@ var Many2OneField = (props) => {
34874
34896
  setDomainObject
34875
34897
  } = props;
34876
34898
  if (!isForm && !isEditTable) {
34877
- const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue.id : propValue;
34899
+ const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
34878
34900
  return /* @__PURE__ */ jsxs71(Fragment31, { children: [
34879
34901
  allowShowDetail && renderDetail({
34880
34902
  idToolTip: String(name2) + Number(index4),
@@ -34888,7 +34910,7 @@ var Many2OneField = (props) => {
34888
34910
  className: "cursor-pointer",
34889
34911
  "data-tooltip-id": String(name2) + index4,
34890
34912
  id: name2,
34891
- children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue.display_name : propValue
34913
+ children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue
34892
34914
  }
34893
34915
  )
34894
34916
  ] });
@@ -34918,7 +34940,11 @@ var Many2OneField = (props) => {
34918
34940
  } : false
34919
34941
  },
34920
34942
  render: ({ field, fieldState: { error: error2 } }) => {
34921
- const currentValue = field?.value ? { value: field?.value?.id, label: field?.value?.display_name } : null;
34943
+ const currentValue = field?.value ? {
34944
+ value: field?.value?.id,
34945
+ label: field?.value?.display_name,
34946
+ ...field?.value ?? {}
34947
+ } : null;
34922
34948
  const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length > 0 ? options2.find(
34923
34949
  (option) => option.value === tempSelectedOption?.value
34924
34950
  ) : currentValue ? currentValue : null;
@@ -34934,7 +34960,7 @@ var Many2OneField = (props) => {
34934
34960
  menuShouldScrollIntoView: false,
34935
34961
  options: listOptions,
34936
34962
  classNames: {
34937
- control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-[200px] max-w-[300px] rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
34963
+ control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-max max-w-max rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
34938
34964
  valueContainer: () => "!m-0 !p-0 ",
34939
34965
  singleValue: () => `!m-0`,
34940
34966
  input: () => "!m-0 !p-0",
@@ -35118,11 +35144,11 @@ var StatusbarDurationField = (props) => {
35118
35144
  };
35119
35145
 
35120
35146
  // src/widgets/basic/status-bar-field/option/option.tsx
35121
- import { useMemo as useMemo10 } from "react";
35147
+ import { useMemo as useMemo11 } from "react";
35122
35148
  import { jsx as jsx107, jsxs as jsxs73 } from "react/jsx-runtime";
35123
35149
  var StatusBarOptionField = (props) => {
35124
35150
  const { selection, defaultValue } = props;
35125
- const memoizedStatusOptions = useMemo10(() => selection, [selection]);
35151
+ const memoizedStatusOptions = useMemo11(() => selection, [selection]);
35126
35152
  return /* @__PURE__ */ jsx107(
35127
35153
  "div",
35128
35154
  {
package/dist/types.d.mts CHANGED
@@ -29,6 +29,7 @@ interface IInputFieldProps {
29
29
  domain?: any;
30
30
  idForm?: boolean;
31
31
  widget?: string;
32
+ options?: any;
32
33
  }
33
34
  declare const loginSchema: z.ZodObject<{
34
35
  username: z.ZodString;
package/dist/types.d.ts CHANGED
@@ -29,6 +29,7 @@ interface IInputFieldProps {
29
29
  domain?: any;
30
30
  idForm?: boolean;
31
31
  widget?: string;
32
+ options?: any;
32
33
  }
33
34
  declare const loginSchema: z.ZodObject<{
34
35
  username: z.ZodString;
package/dist/widgets.js CHANGED
@@ -18197,6 +18197,7 @@ var ButtonField = (props) => {
18197
18197
  // src/widgets/basic/char-field/char.tsx
18198
18198
  var import_react38 = require("react");
18199
18199
  var import_jsx_runtime73 = require("react/jsx-runtime");
18200
+ var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
18200
18201
  var CharField = (props) => {
18201
18202
  const {
18202
18203
  name: name2,
@@ -18218,7 +18219,8 @@ var CharField = (props) => {
18218
18219
  isEditTable,
18219
18220
  isForm,
18220
18221
  value,
18221
- defaultValue
18222
+ defaultValue,
18223
+ options: options2
18222
18224
  } = props;
18223
18225
  if (!isForm && !isEditTable) {
18224
18226
  const propValue = value || defaultValue;
@@ -18257,13 +18259,32 @@ var CharField = (props) => {
18257
18259
  clearErrors(name2);
18258
18260
  }
18259
18261
  }, [value2, clearErrors, name2]);
18262
+ (0, import_react38.useEffect)(() => {
18263
+ if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
18264
+ const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
18265
+ const currentValue = methods?.getValues(name2);
18266
+ if (currentValue !== depValue) {
18267
+ methods?.setValue(name2, depValue, { shouldValidate: true });
18268
+ }
18269
+ }, [widget, formValues]);
18260
18270
  const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
18261
- const displayValue = (widget === "access_token" || widget === "refresh_token") && typeof realValue === "string" && !isDirty ? "*".repeat(realValue?.length) : widget === "private_secret_key" && formValues?.id && typeof formValues?.id === "number" && !isDirty && typeof realValue === "string" ? `${realValue?.slice(0, 4)}${realValue?.length > 4 ? "*".repeat(realValue?.length - 4) : ""}` : typeof realValue === "string" || typeof realValue === "number" ? String(realValue) : "";
18271
+ const displayValue = (0, import_react38.useMemo)(() => {
18272
+ if ((widget === "access_token" || widget === "refresh_token") && typeof realValue === "string" && !isDirty) {
18273
+ return "*".repeat(realValue.length);
18274
+ }
18275
+ if (widget === "private_secret_key" && formValues?.id && typeof formValues?.id === "number" && !isDirty && typeof realValue === "string") {
18276
+ return `${realValue.slice(0, 4)}${realValue.length > 4 ? "*".repeat(realValue.length - 4) : ""}`;
18277
+ }
18278
+ if (typeof realValue === "string" || typeof realValue === "number") {
18279
+ return String(realValue);
18280
+ }
18281
+ return "";
18282
+ }, [widget, formValues]);
18262
18283
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
18263
18284
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
18264
18285
  "input",
18265
18286
  {
18266
- value: displayValue,
18287
+ value: displayValue ?? "",
18267
18288
  onChange: (e3) => {
18268
18289
  const inputValue = e3.target.value;
18269
18290
  if (readonly) return;
@@ -33459,12 +33480,12 @@ var Many2ManyTagField = (props) => {
33459
33480
  placeholder: readonly ? "" : instance.t("choose_place"),
33460
33481
  classNames: isEditTable ? {
33461
33482
  valueContainer: () => "overflow-unset !px-0",
33462
- control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "!cursor-not-allowed" : ""}`,
33483
+ control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-max max-w-max !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? `!cursor-not-allowed ${filteredValue?.length === 0 && "no-values"}` : ""}`,
33463
33484
  dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
33464
33485
  clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
33465
33486
  } : {
33466
33487
  valueContainer: () => "overflow-unset !m-0 !p-0",
33467
- control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"}`,
33488
+ control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"} ${filteredValue?.length === 0 && "no-values"}`,
33468
33489
  singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
33469
33490
  input: () => "!m-0 !p-0",
33470
33491
  dropdownIndicator: () => "!m-0 !p-0"
@@ -33499,8 +33520,8 @@ var Many2ManyTagField = (props) => {
33499
33520
  menu: (base) => ({
33500
33521
  ...base,
33501
33522
  zIndex: 9999,
33502
- width: "300px",
33503
- minWidth: "300px",
33523
+ width: "auto",
33524
+ minWidth: "max-content",
33504
33525
  borderRadius: "10px"
33505
33526
  }),
33506
33527
  menuList: (base) => ({
@@ -33529,7 +33550,8 @@ var Many2ManyTagField = (props) => {
33529
33550
  }
33530
33551
  ),
33531
33552
  IndicatorSeparator: () => null,
33532
- DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(components.DropdownIndicator, { ...props2 })
33553
+ DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(components.DropdownIndicator, { ...props2 }),
33554
+ ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(components.ClearIndicator, { ...props2 })
33533
33555
  },
33534
33556
  required: !invisible && required
33535
33557
  }
@@ -33918,7 +33940,7 @@ var SelectDropdownField = (props) => {
33918
33940
  {
33919
33941
  ...commonProps,
33920
33942
  classNames: {
33921
- control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-[200px] max-w-[300px] rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
33943
+ control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-max max-w-max rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
33922
33944
  valueContainer: () => "!m-0 !p-0 ",
33923
33945
  singleValue: () => `!m-0`,
33924
33946
  input: () => "!m-0 !p-0",
@@ -34619,7 +34641,7 @@ var Many2OneField = (props) => {
34619
34641
  setDomainObject
34620
34642
  } = props;
34621
34643
  if (!isForm && !isEditTable) {
34622
- const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue.id : propValue;
34644
+ const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
34623
34645
  return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_jsx_runtime103.Fragment, { children: [
34624
34646
  allowShowDetail && renderDetail({
34625
34647
  idToolTip: String(name2) + Number(index4),
@@ -34633,7 +34655,7 @@ var Many2OneField = (props) => {
34633
34655
  className: "cursor-pointer",
34634
34656
  "data-tooltip-id": String(name2) + index4,
34635
34657
  id: name2,
34636
- children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue.display_name : propValue
34658
+ children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue
34637
34659
  }
34638
34660
  )
34639
34661
  ] });
@@ -34663,7 +34685,11 @@ var Many2OneField = (props) => {
34663
34685
  } : false
34664
34686
  },
34665
34687
  render: ({ field, fieldState: { error: error2 } }) => {
34666
- const currentValue = field?.value ? { value: field?.value?.id, label: field?.value?.display_name } : null;
34688
+ const currentValue = field?.value ? {
34689
+ value: field?.value?.id,
34690
+ label: field?.value?.display_name,
34691
+ ...field?.value ?? {}
34692
+ } : null;
34667
34693
  const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length > 0 ? options2.find(
34668
34694
  (option) => option.value === tempSelectedOption?.value
34669
34695
  ) : currentValue ? currentValue : null;
@@ -34679,7 +34705,7 @@ var Many2OneField = (props) => {
34679
34705
  menuShouldScrollIntoView: false,
34680
34706
  options: listOptions,
34681
34707
  classNames: {
34682
- control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-[200px] max-w-[300px] rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
34708
+ control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-max max-w-max rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
34683
34709
  valueContainer: () => "!m-0 !p-0 ",
34684
34710
  singleValue: () => `!m-0`,
34685
34711
  input: () => "!m-0 !p-0",
package/dist/widgets.mjs CHANGED
@@ -18132,8 +18132,9 @@ var ButtonField = (props) => {
18132
18132
  };
18133
18133
 
18134
18134
  // src/widgets/basic/char-field/char.tsx
18135
- import { useEffect as useEffect10 } from "react";
18135
+ import { useEffect as useEffect10, useMemo as useMemo4 } from "react";
18136
18136
  import { Fragment as Fragment17, jsx as jsx73, jsxs as jsxs48 } from "react/jsx-runtime";
18137
+ var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
18137
18138
  var CharField = (props) => {
18138
18139
  const {
18139
18140
  name: name2,
@@ -18155,7 +18156,8 @@ var CharField = (props) => {
18155
18156
  isEditTable,
18156
18157
  isForm,
18157
18158
  value,
18158
- defaultValue
18159
+ defaultValue,
18160
+ options: options2
18159
18161
  } = props;
18160
18162
  if (!isForm && !isEditTable) {
18161
18163
  const propValue = value || defaultValue;
@@ -18194,13 +18196,32 @@ var CharField = (props) => {
18194
18196
  clearErrors(name2);
18195
18197
  }
18196
18198
  }, [value2, clearErrors, name2]);
18199
+ useEffect10(() => {
18200
+ if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
18201
+ const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
18202
+ const currentValue = methods?.getValues(name2);
18203
+ if (currentValue !== depValue) {
18204
+ methods?.setValue(name2, depValue, { shouldValidate: true });
18205
+ }
18206
+ }, [widget, formValues]);
18197
18207
  const realValue = typeof value2 === "string" || typeof value2 === "number" ? String(value2) : "";
18198
- const displayValue = (widget === "access_token" || widget === "refresh_token") && typeof realValue === "string" && !isDirty ? "*".repeat(realValue?.length) : widget === "private_secret_key" && formValues?.id && typeof formValues?.id === "number" && !isDirty && typeof realValue === "string" ? `${realValue?.slice(0, 4)}${realValue?.length > 4 ? "*".repeat(realValue?.length - 4) : ""}` : typeof realValue === "string" || typeof realValue === "number" ? String(realValue) : "";
18208
+ const displayValue = useMemo4(() => {
18209
+ if ((widget === "access_token" || widget === "refresh_token") && typeof realValue === "string" && !isDirty) {
18210
+ return "*".repeat(realValue.length);
18211
+ }
18212
+ if (widget === "private_secret_key" && formValues?.id && typeof formValues?.id === "number" && !isDirty && typeof realValue === "string") {
18213
+ return `${realValue.slice(0, 4)}${realValue.length > 4 ? "*".repeat(realValue.length - 4) : ""}`;
18214
+ }
18215
+ if (typeof realValue === "string" || typeof realValue === "number") {
18216
+ return String(realValue);
18217
+ }
18218
+ return "";
18219
+ }, [widget, formValues]);
18199
18220
  return /* @__PURE__ */ jsxs48(Fragment17, { children: [
18200
18221
  /* @__PURE__ */ jsx73(
18201
18222
  "input",
18202
18223
  {
18203
- value: displayValue,
18224
+ value: displayValue ?? "",
18204
18225
  onChange: (e3) => {
18205
18226
  const inputValue = e3.target.value;
18206
18227
  if (readonly) return;
@@ -27446,7 +27467,7 @@ function _extends() {
27446
27467
 
27447
27468
  // node_modules/react-select/dist/react-select.esm.js
27448
27469
  import * as React14 from "react";
27449
- import { forwardRef as forwardRef5, useMemo as useMemo8 } from "react";
27470
+ import { forwardRef as forwardRef5, useMemo as useMemo9 } from "react";
27450
27471
 
27451
27472
  // node_modules/@babel/runtime/helpers/esm/classCallCheck.js
27452
27473
  function _classCallCheck(a2, n4) {
@@ -27554,7 +27575,7 @@ function _toConsumableArray(r4) {
27554
27575
 
27555
27576
  // node_modules/react-select/dist/Select-ef7c0426.esm.js
27556
27577
  import * as React13 from "react";
27557
- import { useMemo as useMemo7, Fragment as Fragment22, useRef as useRef14, useCallback as useCallback8, useEffect as useEffect15, Component as Component2 } from "react";
27578
+ import { useMemo as useMemo8, Fragment as Fragment22, useRef as useRef14, useCallback as useCallback8, useEffect as useEffect15, Component as Component2 } from "react";
27558
27579
 
27559
27580
  // node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
27560
27581
  import * as React11 from "react";
@@ -28886,7 +28907,7 @@ function _taggedTemplateLiteral(e3, t3) {
28886
28907
  }
28887
28908
 
28888
28909
  // node_modules/react-select/dist/index-641ee5b8.esm.js
28889
- import { useContext as useContext8, useRef as useRef13, useState as useState15, useMemo as useMemo6, useCallback as useCallback7, createContext as createContext4 } from "react";
28910
+ import { useContext as useContext8, useRef as useRef13, useState as useState15, useMemo as useMemo7, useCallback as useCallback7, createContext as createContext4 } from "react";
28890
28911
  import { createPortal as createPortal4 } from "react-dom";
28891
28912
 
28892
28913
  // node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
@@ -29339,7 +29360,7 @@ var MenuPortal = function MenuPortal2(props) {
29339
29360
  var menuPortalRef = useRef13(null);
29340
29361
  var cleanupRef = useRef13(null);
29341
29362
  var _useState5 = useState15(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
29342
- var portalPlacementContext = useMemo6(function() {
29363
+ var portalPlacementContext = useMemo7(function() {
29343
29364
  return {
29344
29365
  setPortalPlacement
29345
29366
  };
@@ -30045,10 +30066,10 @@ var LiveRegion = function LiveRegion2(props) {
30045
30066
  var ariaLiveMessages = selectProps.ariaLiveMessages, getOptionLabel4 = selectProps.getOptionLabel, inputValue = selectProps.inputValue, isMulti = selectProps.isMulti, isOptionDisabled3 = selectProps.isOptionDisabled, isSearchable = selectProps.isSearchable, menuIsOpen = selectProps.menuIsOpen, options2 = selectProps.options, screenReaderStatus2 = selectProps.screenReaderStatus, tabSelectsValue = selectProps.tabSelectsValue, isLoading = selectProps.isLoading;
30046
30067
  var ariaLabel = selectProps["aria-label"];
30047
30068
  var ariaLive = selectProps["aria-live"];
30048
- var messages = useMemo7(function() {
30069
+ var messages = useMemo8(function() {
30049
30070
  return _objectSpread2(_objectSpread2({}, defaultAriaLiveMessages), ariaLiveMessages || {});
30050
30071
  }, [ariaLiveMessages]);
30051
- var ariaSelected = useMemo7(function() {
30072
+ var ariaSelected = useMemo8(function() {
30052
30073
  var message2 = "";
30053
30074
  if (ariaSelection && messages.onChange) {
30054
30075
  var option = ariaSelection.option, selectedOptions = ariaSelection.options, removedValue = ariaSelection.removedValue, removedValues = ariaSelection.removedValues, value = ariaSelection.value;
@@ -30070,7 +30091,7 @@ var LiveRegion = function LiveRegion2(props) {
30070
30091
  }
30071
30092
  return message2;
30072
30093
  }, [ariaSelection, messages, isOptionDisabled3, selectValue, getOptionLabel4]);
30073
- var ariaFocused = useMemo7(function() {
30094
+ var ariaFocused = useMemo8(function() {
30074
30095
  var focusMsg = "";
30075
30096
  var focused = focusedOption || focusedValue;
30076
30097
  var isSelected = !!(focusedOption && selectValue && selectValue.includes(focusedOption));
@@ -30089,7 +30110,7 @@ var LiveRegion = function LiveRegion2(props) {
30089
30110
  }
30090
30111
  return focusMsg;
30091
30112
  }, [focusedOption, focusedValue, getOptionLabel4, isOptionDisabled3, messages, focusableOptions, selectValue, isAppleDevice2]);
30092
- var ariaResults = useMemo7(function() {
30113
+ var ariaResults = useMemo8(function() {
30093
30114
  var resultsMsg = "";
30094
30115
  if (menuIsOpen && options2.length && !isLoading && messages.onFilter) {
30095
30116
  var resultsMessage = screenReaderStatus2({
@@ -30103,7 +30124,7 @@ var LiveRegion = function LiveRegion2(props) {
30103
30124
  return resultsMsg;
30104
30125
  }, [focusableOptions, inputValue, menuIsOpen, messages, options2, screenReaderStatus2, isLoading]);
30105
30126
  var isInitialFocus = (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus";
30106
- var ariaGuidance = useMemo7(function() {
30127
+ var ariaGuidance = useMemo8(function() {
30107
30128
  var guidanceMsg = "";
30108
30129
  if (messages.guidance) {
30109
30130
  var context = focusedValue ? "value" : menuIsOpen ? "menu" : "input";
@@ -33201,7 +33222,7 @@ var ImageField = (props) => {
33201
33222
  };
33202
33223
 
33203
33224
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
33204
- import React16, { useEffect as useEffect20, useMemo as useMemo9 } from "react";
33225
+ import React16, { useEffect as useEffect20, useMemo as useMemo10 } from "react";
33205
33226
 
33206
33227
  // src/widgets/basic/information-field/information.tsx
33207
33228
  import { Fragment as Fragment27, jsx as jsx91, jsxs as jsxs60 } from "react/jsx-runtime";
@@ -33349,7 +33370,7 @@ var Many2ManyTagField = (props) => {
33349
33370
  clearErrors(name2);
33350
33371
  }
33351
33372
  }, [field.value]);
33352
- const filteredValue = useMemo9(() => {
33373
+ const filteredValue = useMemo10(() => {
33353
33374
  if (!Array.isArray(field?.value)) return null;
33354
33375
  const fieldValueMapped = field.value.map((v) => ({
33355
33376
  value: v?.id,
@@ -33396,12 +33417,12 @@ var Many2ManyTagField = (props) => {
33396
33417
  placeholder: readonly ? "" : instance.t("choose_place"),
33397
33418
  classNames: isEditTable ? {
33398
33419
  valueContainer: () => "overflow-unset !px-0",
33399
- control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "!cursor-not-allowed" : ""}`,
33420
+ control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-max max-w-max !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? `!cursor-not-allowed ${filteredValue?.length === 0 && "no-values"}` : ""}`,
33400
33421
  dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
33401
33422
  clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
33402
33423
  } : {
33403
33424
  valueContainer: () => "overflow-unset !m-0 !p-0",
33404
- control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"}`,
33425
+ control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"} ${filteredValue?.length === 0 && "no-values"}`,
33405
33426
  singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
33406
33427
  input: () => "!m-0 !p-0",
33407
33428
  dropdownIndicator: () => "!m-0 !p-0"
@@ -33436,8 +33457,8 @@ var Many2ManyTagField = (props) => {
33436
33457
  menu: (base) => ({
33437
33458
  ...base,
33438
33459
  zIndex: 9999,
33439
- width: "300px",
33440
- minWidth: "300px",
33460
+ width: "auto",
33461
+ minWidth: "max-content",
33441
33462
  borderRadius: "10px"
33442
33463
  }),
33443
33464
  menuList: (base) => ({
@@ -33466,7 +33487,8 @@ var Many2ManyTagField = (props) => {
33466
33487
  }
33467
33488
  ),
33468
33489
  IndicatorSeparator: () => null,
33469
- DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx92(components.DropdownIndicator, { ...props2 })
33490
+ DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx92(components.DropdownIndicator, { ...props2 }),
33491
+ ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx92(components.ClearIndicator, { ...props2 })
33470
33492
  },
33471
33493
  required: !invisible && required
33472
33494
  }
@@ -33855,7 +33877,7 @@ var SelectDropdownField = (props) => {
33855
33877
  {
33856
33878
  ...commonProps,
33857
33879
  classNames: {
33858
- control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-[200px] max-w-[300px] rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
33880
+ control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-max max-w-max rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
33859
33881
  valueContainer: () => "!m-0 !p-0 ",
33860
33882
  singleValue: () => `!m-0`,
33861
33883
  input: () => "!m-0 !p-0",
@@ -34556,7 +34578,7 @@ var Many2OneField = (props) => {
34556
34578
  setDomainObject
34557
34579
  } = props;
34558
34580
  if (!isForm && !isEditTable) {
34559
- const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue.id : propValue;
34581
+ const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
34560
34582
  return /* @__PURE__ */ jsxs71(Fragment31, { children: [
34561
34583
  allowShowDetail && renderDetail({
34562
34584
  idToolTip: String(name2) + Number(index4),
@@ -34570,7 +34592,7 @@ var Many2OneField = (props) => {
34570
34592
  className: "cursor-pointer",
34571
34593
  "data-tooltip-id": String(name2) + index4,
34572
34594
  id: name2,
34573
- children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue.display_name : propValue
34595
+ children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue
34574
34596
  }
34575
34597
  )
34576
34598
  ] });
@@ -34600,7 +34622,11 @@ var Many2OneField = (props) => {
34600
34622
  } : false
34601
34623
  },
34602
34624
  render: ({ field, fieldState: { error: error2 } }) => {
34603
- const currentValue = field?.value ? { value: field?.value?.id, label: field?.value?.display_name } : null;
34625
+ const currentValue = field?.value ? {
34626
+ value: field?.value?.id,
34627
+ label: field?.value?.display_name,
34628
+ ...field?.value ?? {}
34629
+ } : null;
34604
34630
  const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length > 0 ? options2.find(
34605
34631
  (option) => option.value === tempSelectedOption?.value
34606
34632
  ) : currentValue ? currentValue : null;
@@ -34616,7 +34642,7 @@ var Many2OneField = (props) => {
34616
34642
  menuShouldScrollIntoView: false,
34617
34643
  options: listOptions,
34618
34644
  classNames: {
34619
- control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-[200px] max-w-[300px] rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
34645
+ control: ({ isFocused }) => `w-full flex h-full ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-[10px] py-2 px-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isForm && (isFocused ? "border-[1px] border-primary !ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]")} ${readonly && "!cursor-not-allowed"} ${isEditTable && "md:!min-w-max max-w-max rounded-none border border-transparent border-b border-b-primary bg-transparent min-h-auto"}`,
34620
34646
  valueContainer: () => "!m-0 !p-0 ",
34621
34647
  singleValue: () => `!m-0`,
34622
34648
  input: () => "!m-0 !p-0",
@@ -34800,11 +34826,11 @@ var StatusbarDurationField = (props) => {
34800
34826
  };
34801
34827
 
34802
34828
  // src/widgets/basic/status-bar-field/option/option.tsx
34803
- import { useMemo as useMemo10 } from "react";
34829
+ import { useMemo as useMemo11 } from "react";
34804
34830
  import { jsx as jsx107, jsxs as jsxs73 } from "react/jsx-runtime";
34805
34831
  var StatusBarOptionField = (props) => {
34806
34832
  const { selection, defaultValue } = props;
34807
- const memoizedStatusOptions = useMemo10(() => selection, [selection]);
34833
+ const memoizedStatusOptions = useMemo11(() => selection, [selection]);
34808
34834
  return /* @__PURE__ */ jsx107(
34809
34835
  "div",
34810
34836
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/sme-widget-ui",
3
- "version": "1.6.9",
3
+ "version": "1.7.1",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",