@fctc/sme-widget-ui 1.6.1 → 1.6.2
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 +125 -133
- package/dist/index.mjs +126 -134
- package/dist/widgets.js +125 -133
- package/dist/widgets.mjs +126 -134
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34646,7 +34646,6 @@ var Many2OneField = (props) => {
|
|
|
34646
34646
|
required,
|
|
34647
34647
|
string,
|
|
34648
34648
|
//return
|
|
34649
|
-
menuList,
|
|
34650
34649
|
allowShowDetail,
|
|
34651
34650
|
index: index4,
|
|
34652
34651
|
contextObject,
|
|
@@ -34661,30 +34660,15 @@ var Many2OneField = (props) => {
|
|
|
34661
34660
|
setInputValue,
|
|
34662
34661
|
setDomainObject
|
|
34663
34662
|
} = props;
|
|
34664
|
-
const actionId = (0, import_react64.useMemo)(
|
|
34665
|
-
() => menuList?.flatMap(
|
|
34666
|
-
(item) => item?.child_id.filter(
|
|
34667
|
-
(childItem) => childItem?.is_display && childItem?.action?.res_model === relation
|
|
34668
|
-
)
|
|
34669
|
-
)?.[0]?.action?.id,
|
|
34670
|
-
[menuList, relation]
|
|
34671
|
-
);
|
|
34672
34663
|
if (!isForm && !isEditTable) {
|
|
34673
34664
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue.id : propValue;
|
|
34674
34665
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_jsx_runtime102.Fragment, { children: [
|
|
34675
|
-
allowShowDetail &&
|
|
34676
|
-
|
|
34677
|
-
|
|
34678
|
-
|
|
34679
|
-
|
|
34680
|
-
|
|
34681
|
-
model: relation,
|
|
34682
|
-
aid: actionId,
|
|
34683
|
-
context: contextObject,
|
|
34684
|
-
place: "top-start",
|
|
34685
|
-
renderDetail
|
|
34686
|
-
}
|
|
34687
|
-
),
|
|
34666
|
+
allowShowDetail && renderDetail({
|
|
34667
|
+
idToolTip: String(name2) + Number(index4),
|
|
34668
|
+
model: relation,
|
|
34669
|
+
context: contextObject,
|
|
34670
|
+
idForm: id
|
|
34671
|
+
}),
|
|
34688
34672
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34689
34673
|
"span",
|
|
34690
34674
|
{
|
|
@@ -34696,119 +34680,127 @@ var Many2OneField = (props) => {
|
|
|
34696
34680
|
)
|
|
34697
34681
|
] });
|
|
34698
34682
|
}
|
|
34699
|
-
return /* @__PURE__ */ (0, import_jsx_runtime102.
|
|
34700
|
-
|
|
34701
|
-
|
|
34702
|
-
|
|
34703
|
-
|
|
34704
|
-
|
|
34705
|
-
|
|
34706
|
-
|
|
34707
|
-
|
|
34708
|
-
|
|
34709
|
-
|
|
34710
|
-
|
|
34711
|
-
|
|
34712
|
-
|
|
34713
|
-
|
|
34714
|
-
|
|
34715
|
-
|
|
34716
|
-
|
|
34717
|
-
|
|
34718
|
-
|
|
34719
|
-
|
|
34720
|
-
|
|
34721
|
-
|
|
34722
|
-
|
|
34723
|
-
|
|
34724
|
-
}
|
|
34725
|
-
|
|
34726
|
-
|
|
34727
|
-
|
|
34728
|
-
|
|
34729
|
-
{
|
|
34730
|
-
|
|
34731
|
-
options: options2,
|
|
34732
|
-
classNames: {
|
|
34733
|
-
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"}`,
|
|
34734
|
-
valueContainer: () => "!m-0 !p-0 ",
|
|
34735
|
-
singleValue: () => `!m-0`,
|
|
34736
|
-
input: () => "!m-0 !p-0",
|
|
34737
|
-
dropdownIndicator: () => `m-0 p-0`,
|
|
34738
|
-
clearIndicator: () => `m-0 p-0'`,
|
|
34739
|
-
menu: () => "z-[99]"
|
|
34740
|
-
},
|
|
34741
|
-
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
34742
|
-
onMenuOpen: fetchMoreOptions,
|
|
34743
|
-
onMenuClose: () => {
|
|
34744
|
-
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
34745
|
-
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
34746
|
-
) || [];
|
|
34747
|
-
setInputValue("");
|
|
34748
|
-
setDomainObject(filteredDomain);
|
|
34749
|
-
},
|
|
34750
|
-
onChange: handleSelectChange,
|
|
34751
|
-
onInputChange: (newValue, { action }) => {
|
|
34752
|
-
if (action === "input-change") {
|
|
34753
|
-
setInputValue(newValue);
|
|
34754
|
-
}
|
|
34755
|
-
},
|
|
34756
|
-
value: selectedOption,
|
|
34757
|
-
isSearchable: true,
|
|
34758
|
-
isClearable: true,
|
|
34759
|
-
menuPlacement: "auto",
|
|
34760
|
-
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
34761
|
-
styles: {
|
|
34762
|
-
control: () => ({}),
|
|
34763
|
-
container: (base) => ({
|
|
34764
|
-
...base,
|
|
34765
|
-
height: "100%"
|
|
34766
|
-
}),
|
|
34767
|
-
clearIndicator: (base) => ({
|
|
34768
|
-
...base,
|
|
34769
|
-
padding: "0"
|
|
34770
|
-
}),
|
|
34771
|
-
valueContainer: (base) => ({
|
|
34772
|
-
...base,
|
|
34773
|
-
padding: "0",
|
|
34774
|
-
margin: "0"
|
|
34775
|
-
}),
|
|
34776
|
-
menuPortal: (base) => ({
|
|
34777
|
-
...base,
|
|
34778
|
-
zIndex: 999
|
|
34779
|
-
}),
|
|
34780
|
-
menu: (base) => ({
|
|
34781
|
-
...base,
|
|
34782
|
-
zIndex: 999,
|
|
34783
|
-
width: isEditTable ? "auto" : "100%",
|
|
34784
|
-
minWidth: isEditTable ? "200px" : "100%"
|
|
34785
|
-
})
|
|
34786
|
-
},
|
|
34787
|
-
components: {
|
|
34788
|
-
MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34789
|
-
CustomMenuList2,
|
|
34790
|
-
{
|
|
34791
|
-
...menuListProps,
|
|
34792
|
-
selectProps: {
|
|
34793
|
-
...menuListProps.selectProps,
|
|
34794
|
-
setIsShowModalMany2Many
|
|
34795
|
-
}
|
|
34796
|
-
}
|
|
34797
|
-
),
|
|
34798
|
-
IndicatorSeparator: () => null,
|
|
34799
|
-
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(components.DropdownIndicator, { ...props2 })
|
|
34800
|
-
},
|
|
34801
|
-
isDisabled: readonly,
|
|
34802
|
-
noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available")
|
|
34683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_jsx_runtime102.Fragment, { children: [
|
|
34684
|
+
allowShowDetail && renderDetail({
|
|
34685
|
+
idToolTip: String(name2),
|
|
34686
|
+
model: relation,
|
|
34687
|
+
context: contextObject,
|
|
34688
|
+
idForm: methods?.getValues(name2)?.id || methods?.getValues(name2)
|
|
34689
|
+
}),
|
|
34690
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34691
|
+
"div",
|
|
34692
|
+
{
|
|
34693
|
+
id: name2,
|
|
34694
|
+
"data-tooltip-id": name2,
|
|
34695
|
+
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
34696
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34697
|
+
Controller,
|
|
34698
|
+
{
|
|
34699
|
+
name: name2 ?? "",
|
|
34700
|
+
control: methods?.control,
|
|
34701
|
+
rules: {
|
|
34702
|
+
required: required ? {
|
|
34703
|
+
value: true,
|
|
34704
|
+
message: `${string} ${instance.t("must_required")}`
|
|
34705
|
+
} : false
|
|
34706
|
+
},
|
|
34707
|
+
render: ({ field, fieldState: { error: error2 } }) => {
|
|
34708
|
+
const currentValue = field?.value ? { value: field?.value?.id, label: field?.value?.display_name } : null;
|
|
34709
|
+
const selectedOption = tempSelectedOption && options2?.length > 0 ? options2.find(
|
|
34710
|
+
(option) => option.value === tempSelectedOption?.value
|
|
34711
|
+
) : currentValue ? currentValue : null;
|
|
34712
|
+
(0, import_react64.useEffect)(() => {
|
|
34713
|
+
if (error2 && selectedOption) {
|
|
34714
|
+
methods?.clearErrors(name2);
|
|
34803
34715
|
}
|
|
34804
|
-
)
|
|
34805
|
-
|
|
34806
|
-
|
|
34716
|
+
}, [selectedOption]);
|
|
34717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "h-full", children: [
|
|
34718
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34719
|
+
StateManagedSelect$1,
|
|
34720
|
+
{
|
|
34721
|
+
menuShouldScrollIntoView: false,
|
|
34722
|
+
options: options2,
|
|
34723
|
+
classNames: {
|
|
34724
|
+
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"}`,
|
|
34725
|
+
valueContainer: () => "!m-0 !p-0 ",
|
|
34726
|
+
singleValue: () => `!m-0`,
|
|
34727
|
+
input: () => "!m-0 !p-0",
|
|
34728
|
+
dropdownIndicator: () => `m-0 p-0`,
|
|
34729
|
+
clearIndicator: () => `m-0 p-0'`,
|
|
34730
|
+
menu: () => "z-[99]"
|
|
34731
|
+
},
|
|
34732
|
+
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
34733
|
+
onMenuOpen: fetchMoreOptions,
|
|
34734
|
+
onMenuClose: () => {
|
|
34735
|
+
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
34736
|
+
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
34737
|
+
) || [];
|
|
34738
|
+
setInputValue("");
|
|
34739
|
+
setDomainObject(filteredDomain);
|
|
34740
|
+
},
|
|
34741
|
+
onChange: handleSelectChange,
|
|
34742
|
+
onInputChange: (newValue, { action }) => {
|
|
34743
|
+
if (action === "input-change") {
|
|
34744
|
+
setInputValue(newValue);
|
|
34745
|
+
}
|
|
34746
|
+
},
|
|
34747
|
+
value: selectedOption,
|
|
34748
|
+
isSearchable: true,
|
|
34749
|
+
isClearable: true,
|
|
34750
|
+
menuPlacement: "auto",
|
|
34751
|
+
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
34752
|
+
styles: {
|
|
34753
|
+
control: () => ({}),
|
|
34754
|
+
container: (base) => ({
|
|
34755
|
+
...base,
|
|
34756
|
+
height: "100%"
|
|
34757
|
+
}),
|
|
34758
|
+
clearIndicator: (base) => ({
|
|
34759
|
+
...base,
|
|
34760
|
+
padding: "0"
|
|
34761
|
+
}),
|
|
34762
|
+
valueContainer: (base) => ({
|
|
34763
|
+
...base,
|
|
34764
|
+
padding: "0",
|
|
34765
|
+
margin: "0"
|
|
34766
|
+
}),
|
|
34767
|
+
menuPortal: (base) => ({
|
|
34768
|
+
...base,
|
|
34769
|
+
zIndex: 999
|
|
34770
|
+
}),
|
|
34771
|
+
menu: (base) => ({
|
|
34772
|
+
...base,
|
|
34773
|
+
zIndex: 999,
|
|
34774
|
+
width: isEditTable ? "auto" : "100%",
|
|
34775
|
+
minWidth: isEditTable ? "200px" : "100%"
|
|
34776
|
+
})
|
|
34777
|
+
},
|
|
34778
|
+
components: {
|
|
34779
|
+
MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34780
|
+
CustomMenuList2,
|
|
34781
|
+
{
|
|
34782
|
+
...menuListProps,
|
|
34783
|
+
selectProps: {
|
|
34784
|
+
...menuListProps.selectProps,
|
|
34785
|
+
setIsShowModalMany2Many
|
|
34786
|
+
}
|
|
34787
|
+
}
|
|
34788
|
+
),
|
|
34789
|
+
IndicatorSeparator: () => null,
|
|
34790
|
+
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(components.DropdownIndicator, { ...props2 })
|
|
34791
|
+
},
|
|
34792
|
+
isDisabled: readonly,
|
|
34793
|
+
noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available")
|
|
34794
|
+
}
|
|
34795
|
+
),
|
|
34796
|
+
!isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
34797
|
+
] });
|
|
34798
|
+
}
|
|
34807
34799
|
}
|
|
34808
|
-
|
|
34809
|
-
|
|
34810
|
-
|
|
34811
|
-
|
|
34800
|
+
)
|
|
34801
|
+
}
|
|
34802
|
+
)
|
|
34803
|
+
] });
|
|
34812
34804
|
};
|
|
34813
34805
|
|
|
34814
34806
|
// src/widgets/basic/status-bar-field/duration/duration.tsx
|
package/dist/index.mjs
CHANGED
|
@@ -34493,7 +34493,7 @@ var Many2ManyField = (props) => {
|
|
|
34493
34493
|
};
|
|
34494
34494
|
|
|
34495
34495
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
34496
|
-
import React18, { useEffect as useEffect25
|
|
34496
|
+
import React18, { useEffect as useEffect25 } from "react";
|
|
34497
34497
|
import { Fragment as Fragment30, jsx as jsx104, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
34498
34498
|
var CustomMenuList2 = (props) => {
|
|
34499
34499
|
const { options: options2, children, selectProps } = props;
|
|
@@ -34527,7 +34527,6 @@ var Many2OneField = (props) => {
|
|
|
34527
34527
|
required,
|
|
34528
34528
|
string,
|
|
34529
34529
|
//return
|
|
34530
|
-
menuList,
|
|
34531
34530
|
allowShowDetail,
|
|
34532
34531
|
index: index4,
|
|
34533
34532
|
contextObject,
|
|
@@ -34542,30 +34541,15 @@ var Many2OneField = (props) => {
|
|
|
34542
34541
|
setInputValue,
|
|
34543
34542
|
setDomainObject
|
|
34544
34543
|
} = props;
|
|
34545
|
-
const actionId = useMemo10(
|
|
34546
|
-
() => menuList?.flatMap(
|
|
34547
|
-
(item) => item?.child_id.filter(
|
|
34548
|
-
(childItem) => childItem?.is_display && childItem?.action?.res_model === relation
|
|
34549
|
-
)
|
|
34550
|
-
)?.[0]?.action?.id,
|
|
34551
|
-
[menuList, relation]
|
|
34552
|
-
);
|
|
34553
34544
|
if (!isForm && !isEditTable) {
|
|
34554
34545
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue.id : propValue;
|
|
34555
34546
|
return /* @__PURE__ */ jsxs72(Fragment30, { children: [
|
|
34556
|
-
allowShowDetail &&
|
|
34557
|
-
|
|
34558
|
-
|
|
34559
|
-
|
|
34560
|
-
|
|
34561
|
-
|
|
34562
|
-
model: relation,
|
|
34563
|
-
aid: actionId,
|
|
34564
|
-
context: contextObject,
|
|
34565
|
-
place: "top-start",
|
|
34566
|
-
renderDetail
|
|
34567
|
-
}
|
|
34568
|
-
),
|
|
34547
|
+
allowShowDetail && renderDetail({
|
|
34548
|
+
idToolTip: String(name2) + Number(index4),
|
|
34549
|
+
model: relation,
|
|
34550
|
+
context: contextObject,
|
|
34551
|
+
idForm: id
|
|
34552
|
+
}),
|
|
34569
34553
|
/* @__PURE__ */ jsx104(
|
|
34570
34554
|
"span",
|
|
34571
34555
|
{
|
|
@@ -34577,119 +34561,127 @@ var Many2OneField = (props) => {
|
|
|
34577
34561
|
)
|
|
34578
34562
|
] });
|
|
34579
34563
|
}
|
|
34580
|
-
return /* @__PURE__ */
|
|
34581
|
-
|
|
34582
|
-
|
|
34583
|
-
|
|
34584
|
-
|
|
34585
|
-
|
|
34586
|
-
|
|
34587
|
-
|
|
34588
|
-
|
|
34589
|
-
|
|
34590
|
-
|
|
34591
|
-
|
|
34592
|
-
|
|
34593
|
-
|
|
34594
|
-
|
|
34595
|
-
|
|
34596
|
-
|
|
34597
|
-
|
|
34598
|
-
|
|
34599
|
-
|
|
34600
|
-
|
|
34601
|
-
|
|
34602
|
-
|
|
34603
|
-
|
|
34604
|
-
|
|
34605
|
-
}
|
|
34606
|
-
|
|
34607
|
-
|
|
34608
|
-
|
|
34609
|
-
|
|
34610
|
-
{
|
|
34611
|
-
|
|
34612
|
-
options: options2,
|
|
34613
|
-
classNames: {
|
|
34614
|
-
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"}`,
|
|
34615
|
-
valueContainer: () => "!m-0 !p-0 ",
|
|
34616
|
-
singleValue: () => `!m-0`,
|
|
34617
|
-
input: () => "!m-0 !p-0",
|
|
34618
|
-
dropdownIndicator: () => `m-0 p-0`,
|
|
34619
|
-
clearIndicator: () => `m-0 p-0'`,
|
|
34620
|
-
menu: () => "z-[99]"
|
|
34621
|
-
},
|
|
34622
|
-
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
34623
|
-
onMenuOpen: fetchMoreOptions,
|
|
34624
|
-
onMenuClose: () => {
|
|
34625
|
-
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
34626
|
-
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
34627
|
-
) || [];
|
|
34628
|
-
setInputValue("");
|
|
34629
|
-
setDomainObject(filteredDomain);
|
|
34630
|
-
},
|
|
34631
|
-
onChange: handleSelectChange,
|
|
34632
|
-
onInputChange: (newValue, { action }) => {
|
|
34633
|
-
if (action === "input-change") {
|
|
34634
|
-
setInputValue(newValue);
|
|
34635
|
-
}
|
|
34636
|
-
},
|
|
34637
|
-
value: selectedOption,
|
|
34638
|
-
isSearchable: true,
|
|
34639
|
-
isClearable: true,
|
|
34640
|
-
menuPlacement: "auto",
|
|
34641
|
-
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
34642
|
-
styles: {
|
|
34643
|
-
control: () => ({}),
|
|
34644
|
-
container: (base) => ({
|
|
34645
|
-
...base,
|
|
34646
|
-
height: "100%"
|
|
34647
|
-
}),
|
|
34648
|
-
clearIndicator: (base) => ({
|
|
34649
|
-
...base,
|
|
34650
|
-
padding: "0"
|
|
34651
|
-
}),
|
|
34652
|
-
valueContainer: (base) => ({
|
|
34653
|
-
...base,
|
|
34654
|
-
padding: "0",
|
|
34655
|
-
margin: "0"
|
|
34656
|
-
}),
|
|
34657
|
-
menuPortal: (base) => ({
|
|
34658
|
-
...base,
|
|
34659
|
-
zIndex: 999
|
|
34660
|
-
}),
|
|
34661
|
-
menu: (base) => ({
|
|
34662
|
-
...base,
|
|
34663
|
-
zIndex: 999,
|
|
34664
|
-
width: isEditTable ? "auto" : "100%",
|
|
34665
|
-
minWidth: isEditTable ? "200px" : "100%"
|
|
34666
|
-
})
|
|
34667
|
-
},
|
|
34668
|
-
components: {
|
|
34669
|
-
MenuList: (menuListProps) => /* @__PURE__ */ jsx104(
|
|
34670
|
-
CustomMenuList2,
|
|
34671
|
-
{
|
|
34672
|
-
...menuListProps,
|
|
34673
|
-
selectProps: {
|
|
34674
|
-
...menuListProps.selectProps,
|
|
34675
|
-
setIsShowModalMany2Many
|
|
34676
|
-
}
|
|
34677
|
-
}
|
|
34678
|
-
),
|
|
34679
|
-
IndicatorSeparator: () => null,
|
|
34680
|
-
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx104(components.DropdownIndicator, { ...props2 })
|
|
34681
|
-
},
|
|
34682
|
-
isDisabled: readonly,
|
|
34683
|
-
noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available")
|
|
34564
|
+
return /* @__PURE__ */ jsxs72(Fragment30, { children: [
|
|
34565
|
+
allowShowDetail && renderDetail({
|
|
34566
|
+
idToolTip: String(name2),
|
|
34567
|
+
model: relation,
|
|
34568
|
+
context: contextObject,
|
|
34569
|
+
idForm: methods?.getValues(name2)?.id || methods?.getValues(name2)
|
|
34570
|
+
}),
|
|
34571
|
+
/* @__PURE__ */ jsx104(
|
|
34572
|
+
"div",
|
|
34573
|
+
{
|
|
34574
|
+
id: name2,
|
|
34575
|
+
"data-tooltip-id": name2,
|
|
34576
|
+
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
34577
|
+
children: /* @__PURE__ */ jsx104(
|
|
34578
|
+
Controller,
|
|
34579
|
+
{
|
|
34580
|
+
name: name2 ?? "",
|
|
34581
|
+
control: methods?.control,
|
|
34582
|
+
rules: {
|
|
34583
|
+
required: required ? {
|
|
34584
|
+
value: true,
|
|
34585
|
+
message: `${string} ${instance.t("must_required")}`
|
|
34586
|
+
} : false
|
|
34587
|
+
},
|
|
34588
|
+
render: ({ field, fieldState: { error: error2 } }) => {
|
|
34589
|
+
const currentValue = field?.value ? { value: field?.value?.id, label: field?.value?.display_name } : null;
|
|
34590
|
+
const selectedOption = tempSelectedOption && options2?.length > 0 ? options2.find(
|
|
34591
|
+
(option) => option.value === tempSelectedOption?.value
|
|
34592
|
+
) : currentValue ? currentValue : null;
|
|
34593
|
+
useEffect25(() => {
|
|
34594
|
+
if (error2 && selectedOption) {
|
|
34595
|
+
methods?.clearErrors(name2);
|
|
34684
34596
|
}
|
|
34685
|
-
)
|
|
34686
|
-
|
|
34687
|
-
|
|
34597
|
+
}, [selectedOption]);
|
|
34598
|
+
return /* @__PURE__ */ jsxs72("div", { className: "h-full", children: [
|
|
34599
|
+
/* @__PURE__ */ jsx104(
|
|
34600
|
+
StateManagedSelect$1,
|
|
34601
|
+
{
|
|
34602
|
+
menuShouldScrollIntoView: false,
|
|
34603
|
+
options: options2,
|
|
34604
|
+
classNames: {
|
|
34605
|
+
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"}`,
|
|
34606
|
+
valueContainer: () => "!m-0 !p-0 ",
|
|
34607
|
+
singleValue: () => `!m-0`,
|
|
34608
|
+
input: () => "!m-0 !p-0",
|
|
34609
|
+
dropdownIndicator: () => `m-0 p-0`,
|
|
34610
|
+
clearIndicator: () => `m-0 p-0'`,
|
|
34611
|
+
menu: () => "z-[99]"
|
|
34612
|
+
},
|
|
34613
|
+
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
34614
|
+
onMenuOpen: fetchMoreOptions,
|
|
34615
|
+
onMenuClose: () => {
|
|
34616
|
+
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
34617
|
+
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
34618
|
+
) || [];
|
|
34619
|
+
setInputValue("");
|
|
34620
|
+
setDomainObject(filteredDomain);
|
|
34621
|
+
},
|
|
34622
|
+
onChange: handleSelectChange,
|
|
34623
|
+
onInputChange: (newValue, { action }) => {
|
|
34624
|
+
if (action === "input-change") {
|
|
34625
|
+
setInputValue(newValue);
|
|
34626
|
+
}
|
|
34627
|
+
},
|
|
34628
|
+
value: selectedOption,
|
|
34629
|
+
isSearchable: true,
|
|
34630
|
+
isClearable: true,
|
|
34631
|
+
menuPlacement: "auto",
|
|
34632
|
+
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
34633
|
+
styles: {
|
|
34634
|
+
control: () => ({}),
|
|
34635
|
+
container: (base) => ({
|
|
34636
|
+
...base,
|
|
34637
|
+
height: "100%"
|
|
34638
|
+
}),
|
|
34639
|
+
clearIndicator: (base) => ({
|
|
34640
|
+
...base,
|
|
34641
|
+
padding: "0"
|
|
34642
|
+
}),
|
|
34643
|
+
valueContainer: (base) => ({
|
|
34644
|
+
...base,
|
|
34645
|
+
padding: "0",
|
|
34646
|
+
margin: "0"
|
|
34647
|
+
}),
|
|
34648
|
+
menuPortal: (base) => ({
|
|
34649
|
+
...base,
|
|
34650
|
+
zIndex: 999
|
|
34651
|
+
}),
|
|
34652
|
+
menu: (base) => ({
|
|
34653
|
+
...base,
|
|
34654
|
+
zIndex: 999,
|
|
34655
|
+
width: isEditTable ? "auto" : "100%",
|
|
34656
|
+
minWidth: isEditTable ? "200px" : "100%"
|
|
34657
|
+
})
|
|
34658
|
+
},
|
|
34659
|
+
components: {
|
|
34660
|
+
MenuList: (menuListProps) => /* @__PURE__ */ jsx104(
|
|
34661
|
+
CustomMenuList2,
|
|
34662
|
+
{
|
|
34663
|
+
...menuListProps,
|
|
34664
|
+
selectProps: {
|
|
34665
|
+
...menuListProps.selectProps,
|
|
34666
|
+
setIsShowModalMany2Many
|
|
34667
|
+
}
|
|
34668
|
+
}
|
|
34669
|
+
),
|
|
34670
|
+
IndicatorSeparator: () => null,
|
|
34671
|
+
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx104(components.DropdownIndicator, { ...props2 })
|
|
34672
|
+
},
|
|
34673
|
+
isDisabled: readonly,
|
|
34674
|
+
noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available")
|
|
34675
|
+
}
|
|
34676
|
+
),
|
|
34677
|
+
!isEditTable && error2 && /* @__PURE__ */ jsx104("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
34678
|
+
] });
|
|
34679
|
+
}
|
|
34688
34680
|
}
|
|
34689
|
-
|
|
34690
|
-
|
|
34691
|
-
|
|
34692
|
-
|
|
34681
|
+
)
|
|
34682
|
+
}
|
|
34683
|
+
)
|
|
34684
|
+
] });
|
|
34693
34685
|
};
|
|
34694
34686
|
|
|
34695
34687
|
// src/widgets/basic/status-bar-field/duration/duration.tsx
|
package/dist/widgets.js
CHANGED
|
@@ -34272,7 +34272,6 @@ var Many2OneField = (props) => {
|
|
|
34272
34272
|
required,
|
|
34273
34273
|
string,
|
|
34274
34274
|
//return
|
|
34275
|
-
menuList,
|
|
34276
34275
|
allowShowDetail,
|
|
34277
34276
|
index: index4,
|
|
34278
34277
|
contextObject,
|
|
@@ -34287,30 +34286,15 @@ var Many2OneField = (props) => {
|
|
|
34287
34286
|
setInputValue,
|
|
34288
34287
|
setDomainObject
|
|
34289
34288
|
} = props;
|
|
34290
|
-
const actionId = (0, import_react64.useMemo)(
|
|
34291
|
-
() => menuList?.flatMap(
|
|
34292
|
-
(item) => item?.child_id.filter(
|
|
34293
|
-
(childItem) => childItem?.is_display && childItem?.action?.res_model === relation
|
|
34294
|
-
)
|
|
34295
|
-
)?.[0]?.action?.id,
|
|
34296
|
-
[menuList, relation]
|
|
34297
|
-
);
|
|
34298
34289
|
if (!isForm && !isEditTable) {
|
|
34299
34290
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue.id : propValue;
|
|
34300
34291
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_jsx_runtime102.Fragment, { children: [
|
|
34301
|
-
allowShowDetail &&
|
|
34302
|
-
|
|
34303
|
-
|
|
34304
|
-
|
|
34305
|
-
|
|
34306
|
-
|
|
34307
|
-
model: relation,
|
|
34308
|
-
aid: actionId,
|
|
34309
|
-
context: contextObject,
|
|
34310
|
-
place: "top-start",
|
|
34311
|
-
renderDetail
|
|
34312
|
-
}
|
|
34313
|
-
),
|
|
34292
|
+
allowShowDetail && renderDetail({
|
|
34293
|
+
idToolTip: String(name2) + Number(index4),
|
|
34294
|
+
model: relation,
|
|
34295
|
+
context: contextObject,
|
|
34296
|
+
idForm: id
|
|
34297
|
+
}),
|
|
34314
34298
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34315
34299
|
"span",
|
|
34316
34300
|
{
|
|
@@ -34322,119 +34306,127 @@ var Many2OneField = (props) => {
|
|
|
34322
34306
|
)
|
|
34323
34307
|
] });
|
|
34324
34308
|
}
|
|
34325
|
-
return /* @__PURE__ */ (0, import_jsx_runtime102.
|
|
34326
|
-
|
|
34327
|
-
|
|
34328
|
-
|
|
34329
|
-
|
|
34330
|
-
|
|
34331
|
-
|
|
34332
|
-
|
|
34333
|
-
|
|
34334
|
-
|
|
34335
|
-
|
|
34336
|
-
|
|
34337
|
-
|
|
34338
|
-
|
|
34339
|
-
|
|
34340
|
-
|
|
34341
|
-
|
|
34342
|
-
|
|
34343
|
-
|
|
34344
|
-
|
|
34345
|
-
|
|
34346
|
-
|
|
34347
|
-
|
|
34348
|
-
|
|
34349
|
-
|
|
34350
|
-
}
|
|
34351
|
-
|
|
34352
|
-
|
|
34353
|
-
|
|
34354
|
-
|
|
34355
|
-
{
|
|
34356
|
-
|
|
34357
|
-
options: options2,
|
|
34358
|
-
classNames: {
|
|
34359
|
-
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"}`,
|
|
34360
|
-
valueContainer: () => "!m-0 !p-0 ",
|
|
34361
|
-
singleValue: () => `!m-0`,
|
|
34362
|
-
input: () => "!m-0 !p-0",
|
|
34363
|
-
dropdownIndicator: () => `m-0 p-0`,
|
|
34364
|
-
clearIndicator: () => `m-0 p-0'`,
|
|
34365
|
-
menu: () => "z-[99]"
|
|
34366
|
-
},
|
|
34367
|
-
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
34368
|
-
onMenuOpen: fetchMoreOptions,
|
|
34369
|
-
onMenuClose: () => {
|
|
34370
|
-
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
34371
|
-
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
34372
|
-
) || [];
|
|
34373
|
-
setInputValue("");
|
|
34374
|
-
setDomainObject(filteredDomain);
|
|
34375
|
-
},
|
|
34376
|
-
onChange: handleSelectChange,
|
|
34377
|
-
onInputChange: (newValue, { action }) => {
|
|
34378
|
-
if (action === "input-change") {
|
|
34379
|
-
setInputValue(newValue);
|
|
34380
|
-
}
|
|
34381
|
-
},
|
|
34382
|
-
value: selectedOption,
|
|
34383
|
-
isSearchable: true,
|
|
34384
|
-
isClearable: true,
|
|
34385
|
-
menuPlacement: "auto",
|
|
34386
|
-
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
34387
|
-
styles: {
|
|
34388
|
-
control: () => ({}),
|
|
34389
|
-
container: (base) => ({
|
|
34390
|
-
...base,
|
|
34391
|
-
height: "100%"
|
|
34392
|
-
}),
|
|
34393
|
-
clearIndicator: (base) => ({
|
|
34394
|
-
...base,
|
|
34395
|
-
padding: "0"
|
|
34396
|
-
}),
|
|
34397
|
-
valueContainer: (base) => ({
|
|
34398
|
-
...base,
|
|
34399
|
-
padding: "0",
|
|
34400
|
-
margin: "0"
|
|
34401
|
-
}),
|
|
34402
|
-
menuPortal: (base) => ({
|
|
34403
|
-
...base,
|
|
34404
|
-
zIndex: 999
|
|
34405
|
-
}),
|
|
34406
|
-
menu: (base) => ({
|
|
34407
|
-
...base,
|
|
34408
|
-
zIndex: 999,
|
|
34409
|
-
width: isEditTable ? "auto" : "100%",
|
|
34410
|
-
minWidth: isEditTable ? "200px" : "100%"
|
|
34411
|
-
})
|
|
34412
|
-
},
|
|
34413
|
-
components: {
|
|
34414
|
-
MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34415
|
-
CustomMenuList2,
|
|
34416
|
-
{
|
|
34417
|
-
...menuListProps,
|
|
34418
|
-
selectProps: {
|
|
34419
|
-
...menuListProps.selectProps,
|
|
34420
|
-
setIsShowModalMany2Many
|
|
34421
|
-
}
|
|
34422
|
-
}
|
|
34423
|
-
),
|
|
34424
|
-
IndicatorSeparator: () => null,
|
|
34425
|
-
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(components.DropdownIndicator, { ...props2 })
|
|
34426
|
-
},
|
|
34427
|
-
isDisabled: readonly,
|
|
34428
|
-
noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available")
|
|
34309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_jsx_runtime102.Fragment, { children: [
|
|
34310
|
+
allowShowDetail && renderDetail({
|
|
34311
|
+
idToolTip: String(name2),
|
|
34312
|
+
model: relation,
|
|
34313
|
+
context: contextObject,
|
|
34314
|
+
idForm: methods?.getValues(name2)?.id || methods?.getValues(name2)
|
|
34315
|
+
}),
|
|
34316
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34317
|
+
"div",
|
|
34318
|
+
{
|
|
34319
|
+
id: name2,
|
|
34320
|
+
"data-tooltip-id": name2,
|
|
34321
|
+
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
34322
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34323
|
+
Controller,
|
|
34324
|
+
{
|
|
34325
|
+
name: name2 ?? "",
|
|
34326
|
+
control: methods?.control,
|
|
34327
|
+
rules: {
|
|
34328
|
+
required: required ? {
|
|
34329
|
+
value: true,
|
|
34330
|
+
message: `${string} ${instance.t("must_required")}`
|
|
34331
|
+
} : false
|
|
34332
|
+
},
|
|
34333
|
+
render: ({ field, fieldState: { error: error2 } }) => {
|
|
34334
|
+
const currentValue = field?.value ? { value: field?.value?.id, label: field?.value?.display_name } : null;
|
|
34335
|
+
const selectedOption = tempSelectedOption && options2?.length > 0 ? options2.find(
|
|
34336
|
+
(option) => option.value === tempSelectedOption?.value
|
|
34337
|
+
) : currentValue ? currentValue : null;
|
|
34338
|
+
(0, import_react64.useEffect)(() => {
|
|
34339
|
+
if (error2 && selectedOption) {
|
|
34340
|
+
methods?.clearErrors(name2);
|
|
34429
34341
|
}
|
|
34430
|
-
)
|
|
34431
|
-
|
|
34432
|
-
|
|
34342
|
+
}, [selectedOption]);
|
|
34343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "h-full", children: [
|
|
34344
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34345
|
+
StateManagedSelect$1,
|
|
34346
|
+
{
|
|
34347
|
+
menuShouldScrollIntoView: false,
|
|
34348
|
+
options: options2,
|
|
34349
|
+
classNames: {
|
|
34350
|
+
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"}`,
|
|
34351
|
+
valueContainer: () => "!m-0 !p-0 ",
|
|
34352
|
+
singleValue: () => `!m-0`,
|
|
34353
|
+
input: () => "!m-0 !p-0",
|
|
34354
|
+
dropdownIndicator: () => `m-0 p-0`,
|
|
34355
|
+
clearIndicator: () => `m-0 p-0'`,
|
|
34356
|
+
menu: () => "z-[99]"
|
|
34357
|
+
},
|
|
34358
|
+
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
34359
|
+
onMenuOpen: fetchMoreOptions,
|
|
34360
|
+
onMenuClose: () => {
|
|
34361
|
+
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
34362
|
+
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
34363
|
+
) || [];
|
|
34364
|
+
setInputValue("");
|
|
34365
|
+
setDomainObject(filteredDomain);
|
|
34366
|
+
},
|
|
34367
|
+
onChange: handleSelectChange,
|
|
34368
|
+
onInputChange: (newValue, { action }) => {
|
|
34369
|
+
if (action === "input-change") {
|
|
34370
|
+
setInputValue(newValue);
|
|
34371
|
+
}
|
|
34372
|
+
},
|
|
34373
|
+
value: selectedOption,
|
|
34374
|
+
isSearchable: true,
|
|
34375
|
+
isClearable: true,
|
|
34376
|
+
menuPlacement: "auto",
|
|
34377
|
+
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
34378
|
+
styles: {
|
|
34379
|
+
control: () => ({}),
|
|
34380
|
+
container: (base) => ({
|
|
34381
|
+
...base,
|
|
34382
|
+
height: "100%"
|
|
34383
|
+
}),
|
|
34384
|
+
clearIndicator: (base) => ({
|
|
34385
|
+
...base,
|
|
34386
|
+
padding: "0"
|
|
34387
|
+
}),
|
|
34388
|
+
valueContainer: (base) => ({
|
|
34389
|
+
...base,
|
|
34390
|
+
padding: "0",
|
|
34391
|
+
margin: "0"
|
|
34392
|
+
}),
|
|
34393
|
+
menuPortal: (base) => ({
|
|
34394
|
+
...base,
|
|
34395
|
+
zIndex: 999
|
|
34396
|
+
}),
|
|
34397
|
+
menu: (base) => ({
|
|
34398
|
+
...base,
|
|
34399
|
+
zIndex: 999,
|
|
34400
|
+
width: isEditTable ? "auto" : "100%",
|
|
34401
|
+
minWidth: isEditTable ? "200px" : "100%"
|
|
34402
|
+
})
|
|
34403
|
+
},
|
|
34404
|
+
components: {
|
|
34405
|
+
MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34406
|
+
CustomMenuList2,
|
|
34407
|
+
{
|
|
34408
|
+
...menuListProps,
|
|
34409
|
+
selectProps: {
|
|
34410
|
+
...menuListProps.selectProps,
|
|
34411
|
+
setIsShowModalMany2Many
|
|
34412
|
+
}
|
|
34413
|
+
}
|
|
34414
|
+
),
|
|
34415
|
+
IndicatorSeparator: () => null,
|
|
34416
|
+
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(components.DropdownIndicator, { ...props2 })
|
|
34417
|
+
},
|
|
34418
|
+
isDisabled: readonly,
|
|
34419
|
+
noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available")
|
|
34420
|
+
}
|
|
34421
|
+
),
|
|
34422
|
+
!isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
34423
|
+
] });
|
|
34424
|
+
}
|
|
34433
34425
|
}
|
|
34434
|
-
|
|
34435
|
-
|
|
34436
|
-
|
|
34437
|
-
|
|
34426
|
+
)
|
|
34427
|
+
}
|
|
34428
|
+
)
|
|
34429
|
+
] });
|
|
34438
34430
|
};
|
|
34439
34431
|
|
|
34440
34432
|
// src/widgets/basic/status-bar-field/duration/duration.tsx
|
package/dist/widgets.mjs
CHANGED
|
@@ -34175,7 +34175,7 @@ var Many2ManyField = (props) => {
|
|
|
34175
34175
|
};
|
|
34176
34176
|
|
|
34177
34177
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
34178
|
-
import React18, { useEffect as useEffect25
|
|
34178
|
+
import React18, { useEffect as useEffect25 } from "react";
|
|
34179
34179
|
import { Fragment as Fragment30, jsx as jsx104, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
34180
34180
|
var CustomMenuList2 = (props) => {
|
|
34181
34181
|
const { options: options2, children, selectProps } = props;
|
|
@@ -34209,7 +34209,6 @@ var Many2OneField = (props) => {
|
|
|
34209
34209
|
required,
|
|
34210
34210
|
string,
|
|
34211
34211
|
//return
|
|
34212
|
-
menuList,
|
|
34213
34212
|
allowShowDetail,
|
|
34214
34213
|
index: index4,
|
|
34215
34214
|
contextObject,
|
|
@@ -34224,30 +34223,15 @@ var Many2OneField = (props) => {
|
|
|
34224
34223
|
setInputValue,
|
|
34225
34224
|
setDomainObject
|
|
34226
34225
|
} = props;
|
|
34227
|
-
const actionId = useMemo10(
|
|
34228
|
-
() => menuList?.flatMap(
|
|
34229
|
-
(item) => item?.child_id.filter(
|
|
34230
|
-
(childItem) => childItem?.is_display && childItem?.action?.res_model === relation
|
|
34231
|
-
)
|
|
34232
|
-
)?.[0]?.action?.id,
|
|
34233
|
-
[menuList, relation]
|
|
34234
|
-
);
|
|
34235
34226
|
if (!isForm && !isEditTable) {
|
|
34236
34227
|
const id = propValue && typeof propValue === "object" && "id" in propValue ? propValue.id : propValue;
|
|
34237
34228
|
return /* @__PURE__ */ jsxs72(Fragment30, { children: [
|
|
34238
|
-
allowShowDetail &&
|
|
34239
|
-
|
|
34240
|
-
|
|
34241
|
-
|
|
34242
|
-
|
|
34243
|
-
|
|
34244
|
-
model: relation,
|
|
34245
|
-
aid: actionId,
|
|
34246
|
-
context: contextObject,
|
|
34247
|
-
place: "top-start",
|
|
34248
|
-
renderDetail
|
|
34249
|
-
}
|
|
34250
|
-
),
|
|
34229
|
+
allowShowDetail && renderDetail({
|
|
34230
|
+
idToolTip: String(name2) + Number(index4),
|
|
34231
|
+
model: relation,
|
|
34232
|
+
context: contextObject,
|
|
34233
|
+
idForm: id
|
|
34234
|
+
}),
|
|
34251
34235
|
/* @__PURE__ */ jsx104(
|
|
34252
34236
|
"span",
|
|
34253
34237
|
{
|
|
@@ -34259,119 +34243,127 @@ var Many2OneField = (props) => {
|
|
|
34259
34243
|
)
|
|
34260
34244
|
] });
|
|
34261
34245
|
}
|
|
34262
|
-
return /* @__PURE__ */
|
|
34263
|
-
|
|
34264
|
-
|
|
34265
|
-
|
|
34266
|
-
|
|
34267
|
-
|
|
34268
|
-
|
|
34269
|
-
|
|
34270
|
-
|
|
34271
|
-
|
|
34272
|
-
|
|
34273
|
-
|
|
34274
|
-
|
|
34275
|
-
|
|
34276
|
-
|
|
34277
|
-
|
|
34278
|
-
|
|
34279
|
-
|
|
34280
|
-
|
|
34281
|
-
|
|
34282
|
-
|
|
34283
|
-
|
|
34284
|
-
|
|
34285
|
-
|
|
34286
|
-
|
|
34287
|
-
}
|
|
34288
|
-
|
|
34289
|
-
|
|
34290
|
-
|
|
34291
|
-
|
|
34292
|
-
{
|
|
34293
|
-
|
|
34294
|
-
options: options2,
|
|
34295
|
-
classNames: {
|
|
34296
|
-
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"}`,
|
|
34297
|
-
valueContainer: () => "!m-0 !p-0 ",
|
|
34298
|
-
singleValue: () => `!m-0`,
|
|
34299
|
-
input: () => "!m-0 !p-0",
|
|
34300
|
-
dropdownIndicator: () => `m-0 p-0`,
|
|
34301
|
-
clearIndicator: () => `m-0 p-0'`,
|
|
34302
|
-
menu: () => "z-[99]"
|
|
34303
|
-
},
|
|
34304
|
-
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
34305
|
-
onMenuOpen: fetchMoreOptions,
|
|
34306
|
-
onMenuClose: () => {
|
|
34307
|
-
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
34308
|
-
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
34309
|
-
) || [];
|
|
34310
|
-
setInputValue("");
|
|
34311
|
-
setDomainObject(filteredDomain);
|
|
34312
|
-
},
|
|
34313
|
-
onChange: handleSelectChange,
|
|
34314
|
-
onInputChange: (newValue, { action }) => {
|
|
34315
|
-
if (action === "input-change") {
|
|
34316
|
-
setInputValue(newValue);
|
|
34317
|
-
}
|
|
34318
|
-
},
|
|
34319
|
-
value: selectedOption,
|
|
34320
|
-
isSearchable: true,
|
|
34321
|
-
isClearable: true,
|
|
34322
|
-
menuPlacement: "auto",
|
|
34323
|
-
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
34324
|
-
styles: {
|
|
34325
|
-
control: () => ({}),
|
|
34326
|
-
container: (base) => ({
|
|
34327
|
-
...base,
|
|
34328
|
-
height: "100%"
|
|
34329
|
-
}),
|
|
34330
|
-
clearIndicator: (base) => ({
|
|
34331
|
-
...base,
|
|
34332
|
-
padding: "0"
|
|
34333
|
-
}),
|
|
34334
|
-
valueContainer: (base) => ({
|
|
34335
|
-
...base,
|
|
34336
|
-
padding: "0",
|
|
34337
|
-
margin: "0"
|
|
34338
|
-
}),
|
|
34339
|
-
menuPortal: (base) => ({
|
|
34340
|
-
...base,
|
|
34341
|
-
zIndex: 999
|
|
34342
|
-
}),
|
|
34343
|
-
menu: (base) => ({
|
|
34344
|
-
...base,
|
|
34345
|
-
zIndex: 999,
|
|
34346
|
-
width: isEditTable ? "auto" : "100%",
|
|
34347
|
-
minWidth: isEditTable ? "200px" : "100%"
|
|
34348
|
-
})
|
|
34349
|
-
},
|
|
34350
|
-
components: {
|
|
34351
|
-
MenuList: (menuListProps) => /* @__PURE__ */ jsx104(
|
|
34352
|
-
CustomMenuList2,
|
|
34353
|
-
{
|
|
34354
|
-
...menuListProps,
|
|
34355
|
-
selectProps: {
|
|
34356
|
-
...menuListProps.selectProps,
|
|
34357
|
-
setIsShowModalMany2Many
|
|
34358
|
-
}
|
|
34359
|
-
}
|
|
34360
|
-
),
|
|
34361
|
-
IndicatorSeparator: () => null,
|
|
34362
|
-
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx104(components.DropdownIndicator, { ...props2 })
|
|
34363
|
-
},
|
|
34364
|
-
isDisabled: readonly,
|
|
34365
|
-
noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available")
|
|
34246
|
+
return /* @__PURE__ */ jsxs72(Fragment30, { children: [
|
|
34247
|
+
allowShowDetail && renderDetail({
|
|
34248
|
+
idToolTip: String(name2),
|
|
34249
|
+
model: relation,
|
|
34250
|
+
context: contextObject,
|
|
34251
|
+
idForm: methods?.getValues(name2)?.id || methods?.getValues(name2)
|
|
34252
|
+
}),
|
|
34253
|
+
/* @__PURE__ */ jsx104(
|
|
34254
|
+
"div",
|
|
34255
|
+
{
|
|
34256
|
+
id: name2,
|
|
34257
|
+
"data-tooltip-id": name2,
|
|
34258
|
+
className: `inline-block w-full h-full ${readonly && "cursor-not-allowed"}`,
|
|
34259
|
+
children: /* @__PURE__ */ jsx104(
|
|
34260
|
+
Controller,
|
|
34261
|
+
{
|
|
34262
|
+
name: name2 ?? "",
|
|
34263
|
+
control: methods?.control,
|
|
34264
|
+
rules: {
|
|
34265
|
+
required: required ? {
|
|
34266
|
+
value: true,
|
|
34267
|
+
message: `${string} ${instance.t("must_required")}`
|
|
34268
|
+
} : false
|
|
34269
|
+
},
|
|
34270
|
+
render: ({ field, fieldState: { error: error2 } }) => {
|
|
34271
|
+
const currentValue = field?.value ? { value: field?.value?.id, label: field?.value?.display_name } : null;
|
|
34272
|
+
const selectedOption = tempSelectedOption && options2?.length > 0 ? options2.find(
|
|
34273
|
+
(option) => option.value === tempSelectedOption?.value
|
|
34274
|
+
) : currentValue ? currentValue : null;
|
|
34275
|
+
useEffect25(() => {
|
|
34276
|
+
if (error2 && selectedOption) {
|
|
34277
|
+
methods?.clearErrors(name2);
|
|
34366
34278
|
}
|
|
34367
|
-
)
|
|
34368
|
-
|
|
34369
|
-
|
|
34279
|
+
}, [selectedOption]);
|
|
34280
|
+
return /* @__PURE__ */ jsxs72("div", { className: "h-full", children: [
|
|
34281
|
+
/* @__PURE__ */ jsx104(
|
|
34282
|
+
StateManagedSelect$1,
|
|
34283
|
+
{
|
|
34284
|
+
menuShouldScrollIntoView: false,
|
|
34285
|
+
options: options2,
|
|
34286
|
+
classNames: {
|
|
34287
|
+
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"}`,
|
|
34288
|
+
valueContainer: () => "!m-0 !p-0 ",
|
|
34289
|
+
singleValue: () => `!m-0`,
|
|
34290
|
+
input: () => "!m-0 !p-0",
|
|
34291
|
+
dropdownIndicator: () => `m-0 p-0`,
|
|
34292
|
+
clearIndicator: () => `m-0 p-0'`,
|
|
34293
|
+
menu: () => "z-[99]"
|
|
34294
|
+
},
|
|
34295
|
+
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
34296
|
+
onMenuOpen: fetchMoreOptions,
|
|
34297
|
+
onMenuClose: () => {
|
|
34298
|
+
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
34299
|
+
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
34300
|
+
) || [];
|
|
34301
|
+
setInputValue("");
|
|
34302
|
+
setDomainObject(filteredDomain);
|
|
34303
|
+
},
|
|
34304
|
+
onChange: handleSelectChange,
|
|
34305
|
+
onInputChange: (newValue, { action }) => {
|
|
34306
|
+
if (action === "input-change") {
|
|
34307
|
+
setInputValue(newValue);
|
|
34308
|
+
}
|
|
34309
|
+
},
|
|
34310
|
+
value: selectedOption,
|
|
34311
|
+
isSearchable: true,
|
|
34312
|
+
isClearable: true,
|
|
34313
|
+
menuPlacement: "auto",
|
|
34314
|
+
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
34315
|
+
styles: {
|
|
34316
|
+
control: () => ({}),
|
|
34317
|
+
container: (base) => ({
|
|
34318
|
+
...base,
|
|
34319
|
+
height: "100%"
|
|
34320
|
+
}),
|
|
34321
|
+
clearIndicator: (base) => ({
|
|
34322
|
+
...base,
|
|
34323
|
+
padding: "0"
|
|
34324
|
+
}),
|
|
34325
|
+
valueContainer: (base) => ({
|
|
34326
|
+
...base,
|
|
34327
|
+
padding: "0",
|
|
34328
|
+
margin: "0"
|
|
34329
|
+
}),
|
|
34330
|
+
menuPortal: (base) => ({
|
|
34331
|
+
...base,
|
|
34332
|
+
zIndex: 999
|
|
34333
|
+
}),
|
|
34334
|
+
menu: (base) => ({
|
|
34335
|
+
...base,
|
|
34336
|
+
zIndex: 999,
|
|
34337
|
+
width: isEditTable ? "auto" : "100%",
|
|
34338
|
+
minWidth: isEditTable ? "200px" : "100%"
|
|
34339
|
+
})
|
|
34340
|
+
},
|
|
34341
|
+
components: {
|
|
34342
|
+
MenuList: (menuListProps) => /* @__PURE__ */ jsx104(
|
|
34343
|
+
CustomMenuList2,
|
|
34344
|
+
{
|
|
34345
|
+
...menuListProps,
|
|
34346
|
+
selectProps: {
|
|
34347
|
+
...menuListProps.selectProps,
|
|
34348
|
+
setIsShowModalMany2Many
|
|
34349
|
+
}
|
|
34350
|
+
}
|
|
34351
|
+
),
|
|
34352
|
+
IndicatorSeparator: () => null,
|
|
34353
|
+
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx104(components.DropdownIndicator, { ...props2 })
|
|
34354
|
+
},
|
|
34355
|
+
isDisabled: readonly,
|
|
34356
|
+
noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available")
|
|
34357
|
+
}
|
|
34358
|
+
),
|
|
34359
|
+
!isEditTable && error2 && /* @__PURE__ */ jsx104("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
34360
|
+
] });
|
|
34361
|
+
}
|
|
34370
34362
|
}
|
|
34371
|
-
|
|
34372
|
-
|
|
34373
|
-
|
|
34374
|
-
|
|
34363
|
+
)
|
|
34364
|
+
}
|
|
34365
|
+
)
|
|
34366
|
+
] });
|
|
34375
34367
|
};
|
|
34376
34368
|
|
|
34377
34369
|
// src/widgets/basic/status-bar-field/duration/duration.tsx
|