@fctc/sme-widget-ui 1.6.8 → 1.7.0
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 +36 -10
- package/dist/index.mjs +50 -24
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/widgets.js +36 -10
- package/dist/widgets.mjs +50 -24
- package/package.json +1 -1
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 = (
|
|
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;
|
|
@@ -33976,9 +33997,6 @@ var MonetaryField = (props) => {
|
|
|
33976
33997
|
clearErrors(name2);
|
|
33977
33998
|
}
|
|
33978
33999
|
}, [value2]);
|
|
33979
|
-
const baseClasses = `w-full min-h-[44px] ring-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden field-sizing-content`;
|
|
33980
|
-
const editableClass = isEditTable ? `${error2 ? "hover:border-b-[1px] hover:border-b-[#de4747]" : "hover:border-b-[1px] hover:border-b-primary"} outline-0 hover:!outline-none` : `focus:ring-0 focus:!outline-none focus:border-[1px] focus:border-primary outline-0 bg-[#f7f7f7] border border-[#f7f7f7] rounded-[10px]`;
|
|
33981
|
-
const readonlyClass = readonly ? "!cursor-not-allowed border-transparent text-[#5c5a5a]" : "!cursor-pointer border-[#f7f7f7] text-[#525866]";
|
|
33982
34000
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
33983
34001
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
33984
34002
|
"input",
|
|
@@ -34011,7 +34029,11 @@ var MonetaryField = (props) => {
|
|
|
34011
34029
|
placeholder: placeholder ?? `${i18n_default.t("choose_place")} ${string}`,
|
|
34012
34030
|
required: !invisible && required,
|
|
34013
34031
|
style: invisible ? { display: "none" } : {},
|
|
34014
|
-
className:
|
|
34032
|
+
className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
|
|
34033
|
+
${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
|
|
34034
|
+
${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
|
|
34035
|
+
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
|
|
34036
|
+
`
|
|
34015
34037
|
}
|
|
34016
34038
|
),
|
|
34017
34039
|
!isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
@@ -34994,7 +35016,7 @@ var Many2OneField = (props) => {
|
|
|
34994
35016
|
setDomainObject
|
|
34995
35017
|
} = props;
|
|
34996
35018
|
if (!isForm && !isEditTable) {
|
|
34997
|
-
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue
|
|
35019
|
+
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
34998
35020
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_jsx_runtime103.Fragment, { children: [
|
|
34999
35021
|
allowShowDetail && renderDetail({
|
|
35000
35022
|
idToolTip: String(name2) + Number(index4),
|
|
@@ -35008,7 +35030,7 @@ var Many2OneField = (props) => {
|
|
|
35008
35030
|
className: "cursor-pointer",
|
|
35009
35031
|
"data-tooltip-id": String(name2) + index4,
|
|
35010
35032
|
id: name2,
|
|
35011
|
-
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue
|
|
35033
|
+
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue
|
|
35012
35034
|
}
|
|
35013
35035
|
)
|
|
35014
35036
|
] });
|
|
@@ -35038,7 +35060,11 @@ var Many2OneField = (props) => {
|
|
|
35038
35060
|
} : false
|
|
35039
35061
|
},
|
|
35040
35062
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
35041
|
-
const currentValue = field?.value ? {
|
|
35063
|
+
const currentValue = field?.value ? {
|
|
35064
|
+
value: field?.value?.id,
|
|
35065
|
+
label: field?.value?.display_name,
|
|
35066
|
+
...field?.value ?? {}
|
|
35067
|
+
} : null;
|
|
35042
35068
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length > 0 ? options2.find(
|
|
35043
35069
|
(option) => option.value === tempSelectedOption?.value
|
|
35044
35070
|
) : currentValue ? currentValue : null;
|
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 = (
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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 =
|
|
30387
|
+
var messages = useMemo8(function() {
|
|
30367
30388
|
return _objectSpread2(_objectSpread2({}, defaultAriaLiveMessages), ariaLiveMessages || {});
|
|
30368
30389
|
}, [ariaLiveMessages]);
|
|
30369
|
-
var ariaSelected =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
|
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 =
|
|
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,
|
|
@@ -33855,9 +33876,6 @@ var MonetaryField = (props) => {
|
|
|
33855
33876
|
clearErrors(name2);
|
|
33856
33877
|
}
|
|
33857
33878
|
}, [value2]);
|
|
33858
|
-
const baseClasses = `w-full min-h-[44px] ring-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden field-sizing-content`;
|
|
33859
|
-
const editableClass = isEditTable ? `${error2 ? "hover:border-b-[1px] hover:border-b-[#de4747]" : "hover:border-b-[1px] hover:border-b-primary"} outline-0 hover:!outline-none` : `focus:ring-0 focus:!outline-none focus:border-[1px] focus:border-primary outline-0 bg-[#f7f7f7] border border-[#f7f7f7] rounded-[10px]`;
|
|
33860
|
-
const readonlyClass = readonly ? "!cursor-not-allowed border-transparent text-[#5c5a5a]" : "!cursor-pointer border-[#f7f7f7] text-[#525866]";
|
|
33861
33879
|
return /* @__PURE__ */ jsxs62(Fragment28, { children: [
|
|
33862
33880
|
/* @__PURE__ */ jsx93(
|
|
33863
33881
|
"input",
|
|
@@ -33890,7 +33908,11 @@ var MonetaryField = (props) => {
|
|
|
33890
33908
|
placeholder: placeholder ?? `${i18n_default.t("choose_place")} ${string}`,
|
|
33891
33909
|
required: !invisible && required,
|
|
33892
33910
|
style: invisible ? { display: "none" } : {},
|
|
33893
|
-
className:
|
|
33911
|
+
className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
|
|
33912
|
+
${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
|
|
33913
|
+
${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
|
|
33914
|
+
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
|
|
33915
|
+
`
|
|
33894
33916
|
}
|
|
33895
33917
|
),
|
|
33896
33918
|
!isEditTable && error2 && /* @__PURE__ */ jsx93("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
@@ -34873,7 +34895,7 @@ var Many2OneField = (props) => {
|
|
|
34873
34895
|
setDomainObject
|
|
34874
34896
|
} = props;
|
|
34875
34897
|
if (!isForm && !isEditTable) {
|
|
34876
|
-
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue
|
|
34898
|
+
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
34877
34899
|
return /* @__PURE__ */ jsxs71(Fragment31, { children: [
|
|
34878
34900
|
allowShowDetail && renderDetail({
|
|
34879
34901
|
idToolTip: String(name2) + Number(index4),
|
|
@@ -34887,7 +34909,7 @@ var Many2OneField = (props) => {
|
|
|
34887
34909
|
className: "cursor-pointer",
|
|
34888
34910
|
"data-tooltip-id": String(name2) + index4,
|
|
34889
34911
|
id: name2,
|
|
34890
|
-
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue
|
|
34912
|
+
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue
|
|
34891
34913
|
}
|
|
34892
34914
|
)
|
|
34893
34915
|
] });
|
|
@@ -34917,7 +34939,11 @@ var Many2OneField = (props) => {
|
|
|
34917
34939
|
} : false
|
|
34918
34940
|
},
|
|
34919
34941
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
34920
|
-
const currentValue = field?.value ? {
|
|
34942
|
+
const currentValue = field?.value ? {
|
|
34943
|
+
value: field?.value?.id,
|
|
34944
|
+
label: field?.value?.display_name,
|
|
34945
|
+
...field?.value ?? {}
|
|
34946
|
+
} : null;
|
|
34921
34947
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length > 0 ? options2.find(
|
|
34922
34948
|
(option) => option.value === tempSelectedOption?.value
|
|
34923
34949
|
) : currentValue ? currentValue : null;
|
|
@@ -35117,11 +35143,11 @@ var StatusbarDurationField = (props) => {
|
|
|
35117
35143
|
};
|
|
35118
35144
|
|
|
35119
35145
|
// src/widgets/basic/status-bar-field/option/option.tsx
|
|
35120
|
-
import { useMemo as
|
|
35146
|
+
import { useMemo as useMemo11 } from "react";
|
|
35121
35147
|
import { jsx as jsx107, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
35122
35148
|
var StatusBarOptionField = (props) => {
|
|
35123
35149
|
const { selection, defaultValue } = props;
|
|
35124
|
-
const memoizedStatusOptions =
|
|
35150
|
+
const memoizedStatusOptions = useMemo11(() => selection, [selection]);
|
|
35125
35151
|
return /* @__PURE__ */ jsx107(
|
|
35126
35152
|
"div",
|
|
35127
35153
|
{
|
package/dist/types.d.mts
CHANGED
package/dist/types.d.ts
CHANGED
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 = (
|
|
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;
|
|
@@ -33600,9 +33621,6 @@ var MonetaryField = (props) => {
|
|
|
33600
33621
|
clearErrors(name2);
|
|
33601
33622
|
}
|
|
33602
33623
|
}, [value2]);
|
|
33603
|
-
const baseClasses = `w-full min-h-[44px] ring-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden field-sizing-content`;
|
|
33604
|
-
const editableClass = isEditTable ? `${error2 ? "hover:border-b-[1px] hover:border-b-[#de4747]" : "hover:border-b-[1px] hover:border-b-primary"} outline-0 hover:!outline-none` : `focus:ring-0 focus:!outline-none focus:border-[1px] focus:border-primary outline-0 bg-[#f7f7f7] border border-[#f7f7f7] rounded-[10px]`;
|
|
33605
|
-
const readonlyClass = readonly ? "!cursor-not-allowed border-transparent text-[#5c5a5a]" : "!cursor-pointer border-[#f7f7f7] text-[#525866]";
|
|
33606
33624
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
33607
33625
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
33608
33626
|
"input",
|
|
@@ -33635,7 +33653,11 @@ var MonetaryField = (props) => {
|
|
|
33635
33653
|
placeholder: placeholder ?? `${i18n_default.t("choose_place")} ${string}`,
|
|
33636
33654
|
required: !invisible && required,
|
|
33637
33655
|
style: invisible ? { display: "none" } : {},
|
|
33638
|
-
className:
|
|
33656
|
+
className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
|
|
33657
|
+
${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
|
|
33658
|
+
${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
|
|
33659
|
+
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
|
|
33660
|
+
`
|
|
33639
33661
|
}
|
|
33640
33662
|
),
|
|
33641
33663
|
!isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
@@ -34618,7 +34640,7 @@ var Many2OneField = (props) => {
|
|
|
34618
34640
|
setDomainObject
|
|
34619
34641
|
} = props;
|
|
34620
34642
|
if (!isForm && !isEditTable) {
|
|
34621
|
-
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue
|
|
34643
|
+
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
34622
34644
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_jsx_runtime103.Fragment, { children: [
|
|
34623
34645
|
allowShowDetail && renderDetail({
|
|
34624
34646
|
idToolTip: String(name2) + Number(index4),
|
|
@@ -34632,7 +34654,7 @@ var Many2OneField = (props) => {
|
|
|
34632
34654
|
className: "cursor-pointer",
|
|
34633
34655
|
"data-tooltip-id": String(name2) + index4,
|
|
34634
34656
|
id: name2,
|
|
34635
|
-
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue
|
|
34657
|
+
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue
|
|
34636
34658
|
}
|
|
34637
34659
|
)
|
|
34638
34660
|
] });
|
|
@@ -34662,7 +34684,11 @@ var Many2OneField = (props) => {
|
|
|
34662
34684
|
} : false
|
|
34663
34685
|
},
|
|
34664
34686
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
34665
|
-
const currentValue = field?.value ? {
|
|
34687
|
+
const currentValue = field?.value ? {
|
|
34688
|
+
value: field?.value?.id,
|
|
34689
|
+
label: field?.value?.display_name,
|
|
34690
|
+
...field?.value ?? {}
|
|
34691
|
+
} : null;
|
|
34666
34692
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length > 0 ? options2.find(
|
|
34667
34693
|
(option) => option.value === tempSelectedOption?.value
|
|
34668
34694
|
) : currentValue ? currentValue : null;
|
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 = (
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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 =
|
|
30069
|
+
var messages = useMemo8(function() {
|
|
30049
30070
|
return _objectSpread2(_objectSpread2({}, defaultAriaLiveMessages), ariaLiveMessages || {});
|
|
30050
30071
|
}, [ariaLiveMessages]);
|
|
30051
|
-
var ariaSelected =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
|
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 =
|
|
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,
|
|
@@ -33537,9 +33558,6 @@ var MonetaryField = (props) => {
|
|
|
33537
33558
|
clearErrors(name2);
|
|
33538
33559
|
}
|
|
33539
33560
|
}, [value2]);
|
|
33540
|
-
const baseClasses = `w-full min-h-[44px] ring-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden field-sizing-content`;
|
|
33541
|
-
const editableClass = isEditTable ? `${error2 ? "hover:border-b-[1px] hover:border-b-[#de4747]" : "hover:border-b-[1px] hover:border-b-primary"} outline-0 hover:!outline-none` : `focus:ring-0 focus:!outline-none focus:border-[1px] focus:border-primary outline-0 bg-[#f7f7f7] border border-[#f7f7f7] rounded-[10px]`;
|
|
33542
|
-
const readonlyClass = readonly ? "!cursor-not-allowed border-transparent text-[#5c5a5a]" : "!cursor-pointer border-[#f7f7f7] text-[#525866]";
|
|
33543
33561
|
return /* @__PURE__ */ jsxs62(Fragment28, { children: [
|
|
33544
33562
|
/* @__PURE__ */ jsx93(
|
|
33545
33563
|
"input",
|
|
@@ -33572,7 +33590,11 @@ var MonetaryField = (props) => {
|
|
|
33572
33590
|
placeholder: placeholder ?? `${i18n_default.t("choose_place")} ${string}`,
|
|
33573
33591
|
required: !invisible && required,
|
|
33574
33592
|
style: invisible ? { display: "none" } : {},
|
|
33575
|
-
className:
|
|
33593
|
+
className: `w-full h-full ring-0 focus:ring-0 focus:!outline-none outline-0 px-3 py-[12px] text-sm font-normal gap-2 opacity-100 leading-[1.5] resize-none overflow-hidden
|
|
33594
|
+
${readonly ? "cursor-not-allowed border border-[rgba(66,66,66,0.12)] text-[#5c5a5a]" : "cursor-pointer border border-[rgba(66,66,66,0.12)] text-[#525866]"}
|
|
33595
|
+
${!isEditTable ? isForm ? "bg-white border-input-primary rounded-[10px]" : "" : `border-transparent bg-transparent ${readonly ? "" : "border-b-primary"}`}
|
|
33596
|
+
${error2 && isEditTable && "focus:border-b-[1px] focus:border-[#de4747] hover:border-b-[1px] hover:border-[#de4747]"}
|
|
33597
|
+
`
|
|
33576
33598
|
}
|
|
33577
33599
|
),
|
|
33578
33600
|
!isEditTable && error2 && /* @__PURE__ */ jsx93("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
@@ -34555,7 +34577,7 @@ var Many2OneField = (props) => {
|
|
|
34555
34577
|
setDomainObject
|
|
34556
34578
|
} = props;
|
|
34557
34579
|
if (!isForm && !isEditTable) {
|
|
34558
|
-
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue
|
|
34580
|
+
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue?.id : propValue;
|
|
34559
34581
|
return /* @__PURE__ */ jsxs71(Fragment31, { children: [
|
|
34560
34582
|
allowShowDetail && renderDetail({
|
|
34561
34583
|
idToolTip: String(name2) + Number(index4),
|
|
@@ -34569,7 +34591,7 @@ var Many2OneField = (props) => {
|
|
|
34569
34591
|
className: "cursor-pointer",
|
|
34570
34592
|
"data-tooltip-id": String(name2) + index4,
|
|
34571
34593
|
id: name2,
|
|
34572
|
-
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue
|
|
34594
|
+
children: propValue && typeof propValue === "object" && "display_name" in propValue ? propValue?.display_name : propValue
|
|
34573
34595
|
}
|
|
34574
34596
|
)
|
|
34575
34597
|
] });
|
|
@@ -34599,7 +34621,11 @@ var Many2OneField = (props) => {
|
|
|
34599
34621
|
} : false
|
|
34600
34622
|
},
|
|
34601
34623
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
34602
|
-
const currentValue = field?.value ? {
|
|
34624
|
+
const currentValue = field?.value ? {
|
|
34625
|
+
value: field?.value?.id,
|
|
34626
|
+
label: field?.value?.display_name,
|
|
34627
|
+
...field?.value ?? {}
|
|
34628
|
+
} : null;
|
|
34603
34629
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length > 0 ? options2.find(
|
|
34604
34630
|
(option) => option.value === tempSelectedOption?.value
|
|
34605
34631
|
) : currentValue ? currentValue : null;
|
|
@@ -34799,11 +34825,11 @@ var StatusbarDurationField = (props) => {
|
|
|
34799
34825
|
};
|
|
34800
34826
|
|
|
34801
34827
|
// src/widgets/basic/status-bar-field/option/option.tsx
|
|
34802
|
-
import { useMemo as
|
|
34828
|
+
import { useMemo as useMemo11 } from "react";
|
|
34803
34829
|
import { jsx as jsx107, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
34804
34830
|
var StatusBarOptionField = (props) => {
|
|
34805
34831
|
const { selection, defaultValue } = props;
|
|
34806
|
-
const memoizedStatusOptions =
|
|
34832
|
+
const memoizedStatusOptions = useMemo11(() => selection, [selection]);
|
|
34807
34833
|
return /* @__PURE__ */ jsx107(
|
|
34808
34834
|
"div",
|
|
34809
34835
|
{
|