@fctc/sme-widget-ui 1.0.1 → 1.0.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 +52 -27
- package/dist/index.mjs +85 -60
- package/dist/widgets.d.mts +2 -2
- package/dist/widgets.d.ts +2 -2
- package/dist/widgets.js +52 -27
- package/dist/widgets.mjs +87 -62
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12523,7 +12523,10 @@ var TableFilter = ({ columns, onToggleColumnOptional }) => {
|
|
|
12523
12523
|
"div",
|
|
12524
12524
|
{
|
|
12525
12525
|
ref: filterRef,
|
|
12526
|
-
|
|
12526
|
+
style: {
|
|
12527
|
+
transform: "translateY(-50%)"
|
|
12528
|
+
},
|
|
12529
|
+
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[10px] ms-auto z-[32] bg-[#eff1f2]",
|
|
12527
12530
|
children: [
|
|
12528
12531
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12529
12532
|
"button",
|
|
@@ -12729,7 +12732,11 @@ var TableHead = (props) => {
|
|
|
12729
12732
|
columns && Array.isArray(columns) && columns?.some((column2) => column2?.optional) && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12730
12733
|
"th",
|
|
12731
12734
|
{
|
|
12732
|
-
|
|
12735
|
+
style: {
|
|
12736
|
+
minWidth: "40px",
|
|
12737
|
+
right: 0
|
|
12738
|
+
},
|
|
12739
|
+
className: `column whitespace-nowrap text-left p-3 text-sm font-medium capitalize text-[#121212] min-w-[40px] sticky right-[0px] bg-[#eff1f2]`,
|
|
12733
12740
|
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12734
12741
|
TableFilter,
|
|
12735
12742
|
{
|
|
@@ -14875,10 +14882,8 @@ var PopupFilter = ({
|
|
|
14875
14882
|
return;
|
|
14876
14883
|
}
|
|
14877
14884
|
typeof handleAddTagSearch === "function" && handleAddTagSearch({
|
|
14878
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FilterIcon, {}),
|
|
14879
14885
|
name: item?.name,
|
|
14880
14886
|
value: item?.string ?? item?.help,
|
|
14881
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FilterIcon, {}),
|
|
14882
14887
|
domain: item?.domain,
|
|
14883
14888
|
groupIndex: item?.group_index,
|
|
14884
14889
|
type: SearchType.FILTER
|
|
@@ -14917,10 +14922,8 @@ var PopupFilter = ({
|
|
|
14917
14922
|
return;
|
|
14918
14923
|
}
|
|
14919
14924
|
typeof handleAddTagSearch === "function" && handleAddTagSearch({
|
|
14920
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(GroupByIcon, {}),
|
|
14921
14925
|
name: item?.name,
|
|
14922
14926
|
value: item?.string,
|
|
14923
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(GroupByIcon, {}),
|
|
14924
14927
|
type: SearchType.GROUP,
|
|
14925
14928
|
context: JSON.parse(item?.context.replace(/'/g, '"')),
|
|
14926
14929
|
active: !isExist,
|
|
@@ -14963,7 +14966,7 @@ var TagSearch = ({
|
|
|
14963
14966
|
{
|
|
14964
14967
|
className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
14965
14968
|
children: [
|
|
14966
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.title }),
|
|
14969
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.type === SearchType.SEARCH ? tag?.title : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(FilterIcon, {}) }),
|
|
14967
14970
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "pl-2 align-middle text-[#495057] text-[14px]", children: tag.values.map((value, idx) => {
|
|
14968
14971
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_react17.Fragment, { children: [
|
|
14969
14972
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: value }),
|
|
@@ -15009,7 +15012,7 @@ var TagSearch = ({
|
|
|
15009
15012
|
{
|
|
15010
15013
|
className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
15011
15014
|
children: [
|
|
15012
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children:
|
|
15015
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(GroupByIcon, {}) }),
|
|
15013
15016
|
value?.strings?.map((string, idx) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15014
15017
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: string }),
|
|
15015
15018
|
idx < value?.strings.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
|
|
@@ -15122,7 +15125,8 @@ var Search = ({
|
|
|
15122
15125
|
aid,
|
|
15123
15126
|
selectedRowKeys,
|
|
15124
15127
|
domainSearch,
|
|
15125
|
-
evalJSONContext
|
|
15128
|
+
evalJSONContext,
|
|
15129
|
+
clearSearch
|
|
15126
15130
|
}) => {
|
|
15127
15131
|
const [showPopupFilter, setShowPopupFilter] = (0, import_react18.useState)(false);
|
|
15128
15132
|
const popupFilterRef = useClickOutside({
|
|
@@ -15142,6 +15146,13 @@ var Search = ({
|
|
|
15142
15146
|
}
|
|
15143
15147
|
}
|
|
15144
15148
|
}, [selectedTags, isReadyFormatDomain]);
|
|
15149
|
+
(0, import_react18.useEffect)(() => {
|
|
15150
|
+
return () => {
|
|
15151
|
+
clearSearch();
|
|
15152
|
+
setDidInit(false);
|
|
15153
|
+
setIsReadyFormatDomain(false);
|
|
15154
|
+
};
|
|
15155
|
+
}, [viewData]);
|
|
15145
15156
|
(0, import_react18.useEffect)(() => {
|
|
15146
15157
|
if (didInit || selectedTags?.length > 0) return;
|
|
15147
15158
|
const searchDefaults = Object.entries(context || {}).filter(
|
|
@@ -17713,13 +17724,14 @@ var ButtonSelectFiles = ({
|
|
|
17713
17724
|
const MAX_TOTAL_SIZE = 50 * 1024 * 1024;
|
|
17714
17725
|
const { mutate: onUploadImage, isPending } = useUploadImage();
|
|
17715
17726
|
const { mutate: onUploadFile } = useUploadFile();
|
|
17716
|
-
const handleUploadImage = async ({
|
|
17727
|
+
const handleUploadImage = async ({ formData }) => {
|
|
17728
|
+
console.log("data", formData);
|
|
17717
17729
|
if (widget !== "many2many_binary") {
|
|
17718
17730
|
onUploadImage(
|
|
17719
|
-
{
|
|
17731
|
+
{ formData },
|
|
17720
17732
|
{
|
|
17721
|
-
onSuccess: (
|
|
17722
|
-
const formatData =
|
|
17733
|
+
onSuccess: (data) => {
|
|
17734
|
+
const formatData = data?.data?.["ir.attachment"]?.[0];
|
|
17723
17735
|
const files = [...selectedFiles, formatData];
|
|
17724
17736
|
setSelectedFiles(files);
|
|
17725
17737
|
y2.success(instance.t("upload_success"));
|
|
@@ -17731,10 +17743,10 @@ var ButtonSelectFiles = ({
|
|
|
17731
17743
|
);
|
|
17732
17744
|
} else {
|
|
17733
17745
|
onUploadFile(
|
|
17734
|
-
{
|
|
17746
|
+
{ formData },
|
|
17735
17747
|
{
|
|
17736
|
-
onSuccess: (
|
|
17737
|
-
const formatData =
|
|
17748
|
+
onSuccess: (data) => {
|
|
17749
|
+
const formatData = data?.data?.["ir.attachment"]?.[0];
|
|
17738
17750
|
const files = [...selectedFiles, formatData];
|
|
17739
17751
|
setSelectedFiles(files);
|
|
17740
17752
|
y2.success(i18n_default.t("upload_success"));
|
|
@@ -17777,10 +17789,10 @@ var ButtonSelectFiles = ({
|
|
|
17777
17789
|
setUploadError(false);
|
|
17778
17790
|
const formData = new FormData();
|
|
17779
17791
|
formData.append("ufile", file);
|
|
17780
|
-
formData.append("thread_model", model);
|
|
17792
|
+
formData.append("thread_model", String(model));
|
|
17781
17793
|
formData.append("thread_id", Number(id));
|
|
17782
17794
|
formData.append("is_pending", true);
|
|
17783
|
-
await handleUploadImage({
|
|
17795
|
+
await handleUploadImage({ formData });
|
|
17784
17796
|
}
|
|
17785
17797
|
};
|
|
17786
17798
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
@@ -33014,9 +33026,6 @@ var import_react58 = require("react");
|
|
|
33014
33026
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
33015
33027
|
var InfomationField = (props) => {
|
|
33016
33028
|
const { value, isForm = false, showName = true, stringToColor } = props;
|
|
33017
|
-
if (isForm) {
|
|
33018
|
-
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { children: "abc" });
|
|
33019
|
-
}
|
|
33020
33029
|
if (!value || Array.isArray(value) && value.length === 0) {
|
|
33021
33030
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, {});
|
|
33022
33031
|
}
|
|
@@ -33047,7 +33056,7 @@ var InfomationField = (props) => {
|
|
|
33047
33056
|
|
|
33048
33057
|
// src/widgets/basic/many2many-tags-field/many2many-tags.tsx
|
|
33049
33058
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
33050
|
-
var CustomMultiValue = (props) => {
|
|
33059
|
+
var CustomMultiValue = ({ stringToColor, ...props }) => {
|
|
33051
33060
|
const { selectProps, data, menuList } = props;
|
|
33052
33061
|
const { relation } = selectProps;
|
|
33053
33062
|
const actionId = menuList?.flatMap(
|
|
@@ -33064,7 +33073,8 @@ var CustomMultiValue = (props) => {
|
|
|
33064
33073
|
relation,
|
|
33065
33074
|
isForm: false,
|
|
33066
33075
|
aid: actionId?.id,
|
|
33067
|
-
avatarSrc: data?.image_256
|
|
33076
|
+
avatarSrc: data?.image_256,
|
|
33077
|
+
stringToColor
|
|
33068
33078
|
}
|
|
33069
33079
|
),
|
|
33070
33080
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "capitalize", children: data?.label ?? data?.display_name }),
|
|
@@ -33109,7 +33119,14 @@ var Many2ManyTagField = (props) => {
|
|
|
33109
33119
|
value: item.id,
|
|
33110
33120
|
label: item.name ?? item.display_name
|
|
33111
33121
|
})) : [];
|
|
33112
|
-
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
33122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
33123
|
+
InfomationField,
|
|
33124
|
+
{
|
|
33125
|
+
value: optionValue || null,
|
|
33126
|
+
isForm,
|
|
33127
|
+
stringToColor
|
|
33128
|
+
}
|
|
33129
|
+
);
|
|
33113
33130
|
}
|
|
33114
33131
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
33115
33132
|
Controller,
|
|
@@ -33194,7 +33211,13 @@ var Many2ManyTagField = (props) => {
|
|
|
33194
33211
|
})
|
|
33195
33212
|
},
|
|
33196
33213
|
components: isUser ? {
|
|
33197
|
-
MultiValue:
|
|
33214
|
+
MultiValue: (multiValueProps) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
33215
|
+
CustomMultiValue,
|
|
33216
|
+
{
|
|
33217
|
+
...multiValueProps,
|
|
33218
|
+
stringToColor
|
|
33219
|
+
}
|
|
33220
|
+
),
|
|
33198
33221
|
IndicatorSeparator: () => null
|
|
33199
33222
|
} : {
|
|
33200
33223
|
IndicatorSeparator: () => null
|
|
@@ -33960,7 +33983,8 @@ var Many2ManyField = (props) => {
|
|
|
33960
33983
|
searchString,
|
|
33961
33984
|
selectedTags,
|
|
33962
33985
|
setFilterBy,
|
|
33963
|
-
setGroupBy
|
|
33986
|
+
setGroupBy,
|
|
33987
|
+
clearSearch
|
|
33964
33988
|
} = searchController;
|
|
33965
33989
|
return (0, import_react_dom8.createPortal)(
|
|
33966
33990
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[9999]", children: [
|
|
@@ -34001,7 +34025,8 @@ var Many2ManyField = (props) => {
|
|
|
34001
34025
|
selectedRowKeys,
|
|
34002
34026
|
aid,
|
|
34003
34027
|
domainSearch,
|
|
34004
|
-
evalJSONContext
|
|
34028
|
+
evalJSONContext,
|
|
34029
|
+
clearSearch
|
|
34005
34030
|
}
|
|
34006
34031
|
) }),
|
|
34007
34032
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
package/dist/index.mjs
CHANGED
|
@@ -12366,13 +12366,13 @@ var TableBody = (props) => {
|
|
|
12366
12366
|
};
|
|
12367
12367
|
|
|
12368
12368
|
// src/widgets/advanced/table/table-filter.tsx
|
|
12369
|
-
import { useEffect as useEffect4, useRef as
|
|
12369
|
+
import { useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
|
|
12370
12370
|
import { createPortal } from "react-dom";
|
|
12371
12371
|
import { jsx as jsx43, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
12372
12372
|
var TableFilter = ({ columns, onToggleColumnOptional }) => {
|
|
12373
12373
|
const [openTableFilter, setOpenTableFilter] = useState3();
|
|
12374
12374
|
const [filterPosition, setFilterPosition] = useState3(null);
|
|
12375
|
-
const filterPopupRef =
|
|
12375
|
+
const filterPopupRef = useRef4(null);
|
|
12376
12376
|
const filterRef = useClickOutside({
|
|
12377
12377
|
handler: () => {
|
|
12378
12378
|
if (openTableFilter) {
|
|
@@ -12404,7 +12404,10 @@ var TableFilter = ({ columns, onToggleColumnOptional }) => {
|
|
|
12404
12404
|
"div",
|
|
12405
12405
|
{
|
|
12406
12406
|
ref: filterRef,
|
|
12407
|
-
|
|
12407
|
+
style: {
|
|
12408
|
+
transform: "translateY(-50%)"
|
|
12409
|
+
},
|
|
12410
|
+
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[10px] ms-auto z-[32] bg-[#eff1f2]",
|
|
12408
12411
|
children: [
|
|
12409
12412
|
/* @__PURE__ */ jsx43(
|
|
12410
12413
|
"button",
|
|
@@ -12610,7 +12613,11 @@ var TableHead = (props) => {
|
|
|
12610
12613
|
columns && Array.isArray(columns) && columns?.some((column2) => column2?.optional) && /* @__PURE__ */ jsx45(
|
|
12611
12614
|
"th",
|
|
12612
12615
|
{
|
|
12613
|
-
|
|
12616
|
+
style: {
|
|
12617
|
+
minWidth: "40px",
|
|
12618
|
+
right: 0
|
|
12619
|
+
},
|
|
12620
|
+
className: `column whitespace-nowrap text-left p-3 text-sm font-medium capitalize text-[#121212] min-w-[40px] sticky right-[0px] bg-[#eff1f2]`,
|
|
12614
12621
|
children: /* @__PURE__ */ jsx45(
|
|
12615
12622
|
TableFilter,
|
|
12616
12623
|
{
|
|
@@ -14756,10 +14763,8 @@ var PopupFilter = ({
|
|
|
14756
14763
|
return;
|
|
14757
14764
|
}
|
|
14758
14765
|
typeof handleAddTagSearch === "function" && handleAddTagSearch({
|
|
14759
|
-
title: /* @__PURE__ */ jsx54(FilterIcon, {}),
|
|
14760
14766
|
name: item?.name,
|
|
14761
14767
|
value: item?.string ?? item?.help,
|
|
14762
|
-
icon: /* @__PURE__ */ jsx54(FilterIcon, {}),
|
|
14763
14768
|
domain: item?.domain,
|
|
14764
14769
|
groupIndex: item?.group_index,
|
|
14765
14770
|
type: SearchType.FILTER
|
|
@@ -14798,10 +14803,8 @@ var PopupFilter = ({
|
|
|
14798
14803
|
return;
|
|
14799
14804
|
}
|
|
14800
14805
|
typeof handleAddTagSearch === "function" && handleAddTagSearch({
|
|
14801
|
-
title: /* @__PURE__ */ jsx54(GroupByIcon, {}),
|
|
14802
14806
|
name: item?.name,
|
|
14803
14807
|
value: item?.string,
|
|
14804
|
-
icon: /* @__PURE__ */ jsx54(GroupByIcon, {}),
|
|
14805
14808
|
type: SearchType.GROUP,
|
|
14806
14809
|
context: JSON.parse(item?.context.replace(/'/g, '"')),
|
|
14807
14810
|
active: !isExist,
|
|
@@ -14844,7 +14847,7 @@ var TagSearch = ({
|
|
|
14844
14847
|
{
|
|
14845
14848
|
className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
14846
14849
|
children: [
|
|
14847
|
-
/* @__PURE__ */ jsx55("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.title }),
|
|
14850
|
+
/* @__PURE__ */ jsx55("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.type === SearchType.SEARCH ? tag?.title : /* @__PURE__ */ jsx55(FilterIcon, {}) }),
|
|
14848
14851
|
/* @__PURE__ */ jsx55("div", { className: "pl-2 align-middle text-[#495057] text-[14px]", children: tag.values.map((value, idx) => {
|
|
14849
14852
|
return /* @__PURE__ */ jsxs37(Fragment7, { children: [
|
|
14850
14853
|
/* @__PURE__ */ jsx55("span", { children: value }),
|
|
@@ -14890,7 +14893,7 @@ var TagSearch = ({
|
|
|
14890
14893
|
{
|
|
14891
14894
|
className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
14892
14895
|
children: [
|
|
14893
|
-
/* @__PURE__ */ jsx55("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children:
|
|
14896
|
+
/* @__PURE__ */ jsx55("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: /* @__PURE__ */ jsx55(GroupByIcon, {}) }),
|
|
14894
14897
|
value?.strings?.map((string, idx) => /* @__PURE__ */ jsxs37(Fragment8, { children: [
|
|
14895
14898
|
/* @__PURE__ */ jsx55("span", { children: string }),
|
|
14896
14899
|
idx < value?.strings.length - 1 && /* @__PURE__ */ jsxs37("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
|
|
@@ -15003,7 +15006,8 @@ var Search = ({
|
|
|
15003
15006
|
aid,
|
|
15004
15007
|
selectedRowKeys,
|
|
15005
15008
|
domainSearch,
|
|
15006
|
-
evalJSONContext
|
|
15009
|
+
evalJSONContext,
|
|
15010
|
+
clearSearch
|
|
15007
15011
|
}) => {
|
|
15008
15012
|
const [showPopupFilter, setShowPopupFilter] = useState5(false);
|
|
15009
15013
|
const popupFilterRef = useClickOutside({
|
|
@@ -15023,6 +15027,13 @@ var Search = ({
|
|
|
15023
15027
|
}
|
|
15024
15028
|
}
|
|
15025
15029
|
}, [selectedTags, isReadyFormatDomain]);
|
|
15030
|
+
useEffect6(() => {
|
|
15031
|
+
return () => {
|
|
15032
|
+
clearSearch();
|
|
15033
|
+
setDidInit(false);
|
|
15034
|
+
setIsReadyFormatDomain(false);
|
|
15035
|
+
};
|
|
15036
|
+
}, [viewData]);
|
|
15026
15037
|
useEffect6(() => {
|
|
15027
15038
|
if (didInit || selectedTags?.length > 0) return;
|
|
15028
15039
|
const searchDefaults = Object.entries(context || {}).filter(
|
|
@@ -17211,11 +17222,11 @@ var LoadingSmall = () => {
|
|
|
17211
17222
|
};
|
|
17212
17223
|
|
|
17213
17224
|
// src/widgets/common/video-player.tsx
|
|
17214
|
-
import { useRef as
|
|
17225
|
+
import { useRef as useRef5, useState as useState9 } from "react";
|
|
17215
17226
|
import { jsx as jsx64, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
17216
17227
|
var VideoPlayer = ({ src }) => {
|
|
17217
17228
|
const [isPlaying, setIsPlaying] = useState9(false);
|
|
17218
|
-
const videoRef =
|
|
17229
|
+
const videoRef = useRef5(null);
|
|
17219
17230
|
const handlePlayPause = () => {
|
|
17220
17231
|
if (videoRef.current) {
|
|
17221
17232
|
if (isPlaying) {
|
|
@@ -17594,13 +17605,14 @@ var ButtonSelectFiles = ({
|
|
|
17594
17605
|
const MAX_TOTAL_SIZE = 50 * 1024 * 1024;
|
|
17595
17606
|
const { mutate: onUploadImage, isPending } = useUploadImage();
|
|
17596
17607
|
const { mutate: onUploadFile } = useUploadFile();
|
|
17597
|
-
const handleUploadImage = async ({
|
|
17608
|
+
const handleUploadImage = async ({ formData }) => {
|
|
17609
|
+
console.log("data", formData);
|
|
17598
17610
|
if (widget !== "many2many_binary") {
|
|
17599
17611
|
onUploadImage(
|
|
17600
|
-
{
|
|
17612
|
+
{ formData },
|
|
17601
17613
|
{
|
|
17602
|
-
onSuccess: (
|
|
17603
|
-
const formatData =
|
|
17614
|
+
onSuccess: (data) => {
|
|
17615
|
+
const formatData = data?.data?.["ir.attachment"]?.[0];
|
|
17604
17616
|
const files = [...selectedFiles, formatData];
|
|
17605
17617
|
setSelectedFiles(files);
|
|
17606
17618
|
y2.success(instance.t("upload_success"));
|
|
@@ -17612,10 +17624,10 @@ var ButtonSelectFiles = ({
|
|
|
17612
17624
|
);
|
|
17613
17625
|
} else {
|
|
17614
17626
|
onUploadFile(
|
|
17615
|
-
{
|
|
17627
|
+
{ formData },
|
|
17616
17628
|
{
|
|
17617
|
-
onSuccess: (
|
|
17618
|
-
const formatData =
|
|
17629
|
+
onSuccess: (data) => {
|
|
17630
|
+
const formatData = data?.data?.["ir.attachment"]?.[0];
|
|
17619
17631
|
const files = [...selectedFiles, formatData];
|
|
17620
17632
|
setSelectedFiles(files);
|
|
17621
17633
|
y2.success(i18n_default.t("upload_success"));
|
|
@@ -17658,10 +17670,10 @@ var ButtonSelectFiles = ({
|
|
|
17658
17670
|
setUploadError(false);
|
|
17659
17671
|
const formData = new FormData();
|
|
17660
17672
|
formData.append("ufile", file);
|
|
17661
|
-
formData.append("thread_model", model);
|
|
17673
|
+
formData.append("thread_model", String(model));
|
|
17662
17674
|
formData.append("thread_id", Number(id));
|
|
17663
17675
|
formData.append("is_pending", true);
|
|
17664
|
-
await handleUploadImage({
|
|
17676
|
+
await handleUploadImage({ formData });
|
|
17665
17677
|
}
|
|
17666
17678
|
};
|
|
17667
17679
|
return /* @__PURE__ */ jsxs46(Fragment13, { children: [
|
|
@@ -18107,7 +18119,7 @@ var CheckboxField = (props) => {
|
|
|
18107
18119
|
};
|
|
18108
18120
|
|
|
18109
18121
|
// src/widgets/basic/color-field/color-wrapper.tsx
|
|
18110
|
-
import { useEffect as useEffect10, useRef as
|
|
18122
|
+
import { useEffect as useEffect10, useRef as useRef6, useState as useState10 } from "react";
|
|
18111
18123
|
import { Fragment as Fragment17, jsx as jsx73, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
18112
18124
|
var ColorWrapper = (props) => {
|
|
18113
18125
|
const {
|
|
@@ -18117,7 +18129,7 @@ var ColorWrapper = (props) => {
|
|
|
18117
18129
|
} = props;
|
|
18118
18130
|
const [selectedColor, setSelectedColor] = useState10(colors2[defaultColor]);
|
|
18119
18131
|
const [showFullColors, setIsShowFullColor] = useState10(false);
|
|
18120
|
-
const pickColorsRef =
|
|
18132
|
+
const pickColorsRef = useRef6(null);
|
|
18121
18133
|
useEffect10(() => {
|
|
18122
18134
|
setSelectedColor(colors2[defaultColor]);
|
|
18123
18135
|
}, [defaultColor]);
|
|
@@ -18318,7 +18330,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
18318
18330
|
import { forwardRef as forwardRef6, useEffect as useEffect15 } from "react";
|
|
18319
18331
|
|
|
18320
18332
|
// node_modules/react-datepicker/dist/index.es.js
|
|
18321
|
-
import React9, { useRef as
|
|
18333
|
+
import React9, { useRef as useRef10, useCallback as useCallback5, useEffect as useEffect13, cloneElement as cloneElement3, Component, createRef, createElement as createElement5 } from "react";
|
|
18322
18334
|
|
|
18323
18335
|
// node_modules/date-fns/constants.js
|
|
18324
18336
|
var daysInYear = 365.2425;
|
|
@@ -22888,8 +22900,8 @@ var CalendarContainer = function(_a2) {
|
|
|
22888
22900
|
return React9.createElement("div", { className, role: "dialog", "aria-label": ariaLabel, "aria-modal": "true" }, children);
|
|
22889
22901
|
};
|
|
22890
22902
|
var useDetectClickOutside = function(onClickOutside, ignoreClass) {
|
|
22891
|
-
var ref =
|
|
22892
|
-
var onClickOutsideRef =
|
|
22903
|
+
var ref = useRef10(null);
|
|
22904
|
+
var onClickOutsideRef = useRef10(onClickOutside);
|
|
22893
22905
|
onClickOutsideRef.current = onClickOutside;
|
|
22894
22906
|
var handleClickOutside = useCallback5(function(event) {
|
|
22895
22907
|
var _a2;
|
|
@@ -26143,7 +26155,7 @@ function withFloating(Component3) {
|
|
|
26143
26155
|
var WithFloating = function(props) {
|
|
26144
26156
|
var _a2;
|
|
26145
26157
|
var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
|
|
26146
|
-
var arrowRef =
|
|
26158
|
+
var arrowRef = useRef10(null);
|
|
26147
26159
|
var floatingProps = useFloating2(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
|
|
26148
26160
|
flip3({ padding: 15 }),
|
|
26149
26161
|
offset3(10),
|
|
@@ -27322,7 +27334,7 @@ function _toConsumableArray(r4) {
|
|
|
27322
27334
|
|
|
27323
27335
|
// node_modules/react-select/dist/Select-ef7c0426.esm.js
|
|
27324
27336
|
import * as React13 from "react";
|
|
27325
|
-
import { useMemo as useMemo7, Fragment as Fragment21, useRef as
|
|
27337
|
+
import { useMemo as useMemo7, Fragment as Fragment21, useRef as useRef13, useCallback as useCallback8, useEffect as useEffect14, Component as Component2 } from "react";
|
|
27326
27338
|
|
|
27327
27339
|
// node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
|
|
27328
27340
|
import * as React11 from "react";
|
|
@@ -28654,7 +28666,7 @@ function _taggedTemplateLiteral(e3, t3) {
|
|
|
28654
28666
|
}
|
|
28655
28667
|
|
|
28656
28668
|
// node_modules/react-select/dist/index-641ee5b8.esm.js
|
|
28657
|
-
import { useContext as useContext8, useRef as
|
|
28669
|
+
import { useContext as useContext8, useRef as useRef12, useState as useState14, useMemo as useMemo6, useCallback as useCallback7, createContext as createContext4 } from "react";
|
|
28658
28670
|
import { createPortal as createPortal4 } from "react-dom";
|
|
28659
28671
|
|
|
28660
28672
|
// node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
|
|
@@ -29000,7 +29012,7 @@ var PortalPlacementContext = /* @__PURE__ */ createContext4(null);
|
|
|
29000
29012
|
var MenuPlacer = function MenuPlacer2(props) {
|
|
29001
29013
|
var children = props.children, minMenuHeight = props.minMenuHeight, maxMenuHeight = props.maxMenuHeight, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition, menuShouldScrollIntoView = props.menuShouldScrollIntoView, theme = props.theme;
|
|
29002
29014
|
var _ref3 = useContext8(PortalPlacementContext) || {}, setPortalPlacement = _ref3.setPortalPlacement;
|
|
29003
|
-
var ref =
|
|
29015
|
+
var ref = useRef12(null);
|
|
29004
29016
|
var _useState = useState14(maxMenuHeight), _useState2 = _slicedToArray(_useState, 2), maxHeight = _useState2[0], setMaxHeight = _useState2[1];
|
|
29005
29017
|
var _useState3 = useState14(null), _useState4 = _slicedToArray(_useState3, 2), placement = _useState4[0], setPlacement = _useState4[1];
|
|
29006
29018
|
var controlHeight2 = theme.spacing.controlHeight;
|
|
@@ -29104,8 +29116,8 @@ var menuPortalCSS = function menuPortalCSS2(_ref8) {
|
|
|
29104
29116
|
};
|
|
29105
29117
|
var MenuPortal = function MenuPortal2(props) {
|
|
29106
29118
|
var appendTo = props.appendTo, children = props.children, controlElement = props.controlElement, innerProps = props.innerProps, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition;
|
|
29107
|
-
var menuPortalRef =
|
|
29108
|
-
var cleanupRef =
|
|
29119
|
+
var menuPortalRef = useRef12(null);
|
|
29120
|
+
var cleanupRef = useRef12(null);
|
|
29109
29121
|
var _useState5 = useState14(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
|
|
29110
29122
|
var portalPlacementContext = useMemo6(function() {
|
|
29111
29123
|
return {
|
|
@@ -30243,10 +30255,10 @@ var cancelScroll = function cancelScroll2(event) {
|
|
|
30243
30255
|
};
|
|
30244
30256
|
function useScrollCapture(_ref3) {
|
|
30245
30257
|
var isEnabled = _ref3.isEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave;
|
|
30246
|
-
var isBottom =
|
|
30247
|
-
var isTop =
|
|
30248
|
-
var touchStart =
|
|
30249
|
-
var scrollTarget =
|
|
30258
|
+
var isBottom = useRef13(false);
|
|
30259
|
+
var isTop = useRef13(false);
|
|
30260
|
+
var touchStart = useRef13(0);
|
|
30261
|
+
var scrollTarget = useRef13(null);
|
|
30250
30262
|
var handleEventDelta = useCallback8(function(event, delta) {
|
|
30251
30263
|
if (scrollTarget.current === null) return;
|
|
30252
30264
|
var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight;
|
|
@@ -30353,8 +30365,8 @@ var listenerOptions = {
|
|
|
30353
30365
|
};
|
|
30354
30366
|
function useScrollLock(_ref3) {
|
|
30355
30367
|
var isEnabled = _ref3.isEnabled, _ref$accountForScroll = _ref3.accountForScrollbars, accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
|
|
30356
|
-
var originalStyles =
|
|
30357
|
-
var scrollTarget =
|
|
30368
|
+
var originalStyles = useRef13({});
|
|
30369
|
+
var scrollTarget = useRef13(null);
|
|
30358
30370
|
var addScrollLock = useCallback8(function(touchScrollTarget) {
|
|
30359
30371
|
if (!canUseDOM) return;
|
|
30360
30372
|
var target = document.body;
|
|
@@ -32478,11 +32490,11 @@ var FeeField = (props) => {
|
|
|
32478
32490
|
};
|
|
32479
32491
|
|
|
32480
32492
|
// src/widgets/basic/file-upload-field/file-upload.tsx
|
|
32481
|
-
import { useEffect as useEffect16, useRef as
|
|
32493
|
+
import { useEffect as useEffect16, useRef as useRef14, useState as useState16 } from "react";
|
|
32482
32494
|
import { jsx as jsx84, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
32483
32495
|
var FileUploadField = (props) => {
|
|
32484
32496
|
const { name: name2, methods, isForm, model, required, idForm, widget, useUploadImage, useUploadFile, useGetImage, isBase64File } = props;
|
|
32485
|
-
const fileInputRef =
|
|
32497
|
+
const fileInputRef = useRef14(null);
|
|
32486
32498
|
const [selectedFiles, setSelectedFiles] = useState16([]);
|
|
32487
32499
|
const [uploadError, setUploadError] = useState16();
|
|
32488
32500
|
return /* @__PURE__ */ jsx84(
|
|
@@ -32543,7 +32555,7 @@ var FileUploadField = (props) => {
|
|
|
32543
32555
|
};
|
|
32544
32556
|
|
|
32545
32557
|
// src/widgets/basic/float-field/float.tsx
|
|
32546
|
-
import { useEffect as useEffect17, useRef as
|
|
32558
|
+
import { useEffect as useEffect17, useRef as useRef15, useState as useState17 } from "react";
|
|
32547
32559
|
import { Fragment as Fragment24, jsx as jsx85, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
32548
32560
|
var FloatField = (props) => {
|
|
32549
32561
|
const {
|
|
@@ -32584,9 +32596,9 @@ var FloatField = (props) => {
|
|
|
32584
32596
|
setInputValue("");
|
|
32585
32597
|
}
|
|
32586
32598
|
}, [value, name2, clearErrors]);
|
|
32587
|
-
const isDirtyRef =
|
|
32588
|
-
const inputRef =
|
|
32589
|
-
const lastCommittedValueRef =
|
|
32599
|
+
const isDirtyRef = useRef15(false);
|
|
32600
|
+
const inputRef = useRef15(null);
|
|
32601
|
+
const lastCommittedValueRef = useRef15(null);
|
|
32590
32602
|
const handleInputChange = (e3) => {
|
|
32591
32603
|
const newValue = e3.target.value;
|
|
32592
32604
|
const valueWithoutCommas = newValue.replace(/,/g, "");
|
|
@@ -32816,7 +32828,7 @@ var FloatTimeField = (props) => {
|
|
|
32816
32828
|
};
|
|
32817
32829
|
|
|
32818
32830
|
// src/widgets/basic/html-field/html.tsx
|
|
32819
|
-
import { useEffect as useEffect18, useRef as
|
|
32831
|
+
import { useEffect as useEffect18, useRef as useRef16 } from "react";
|
|
32820
32832
|
import { jsx as jsx87 } from "react/jsx-runtime";
|
|
32821
32833
|
var HtmlField = (props) => {
|
|
32822
32834
|
const {
|
|
@@ -32828,7 +32840,7 @@ var HtmlField = (props) => {
|
|
|
32828
32840
|
onChange: onChange2,
|
|
32829
32841
|
value
|
|
32830
32842
|
} = props;
|
|
32831
|
-
const divRef =
|
|
32843
|
+
const divRef = useRef16(null);
|
|
32832
32844
|
if (!isForm) {
|
|
32833
32845
|
return /* @__PURE__ */ jsx87("div", { dangerouslySetInnerHTML: { __html: value || defaultValue || "" } });
|
|
32834
32846
|
}
|
|
@@ -32895,9 +32907,6 @@ import { useEffect as useEffect19 } from "react";
|
|
|
32895
32907
|
import { Fragment as Fragment26, jsx as jsx89, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
32896
32908
|
var InfomationField = (props) => {
|
|
32897
32909
|
const { value, isForm = false, showName = true, stringToColor } = props;
|
|
32898
|
-
if (isForm) {
|
|
32899
|
-
return /* @__PURE__ */ jsx89("div", { children: "abc" });
|
|
32900
|
-
}
|
|
32901
32910
|
if (!value || Array.isArray(value) && value.length === 0) {
|
|
32902
32911
|
return /* @__PURE__ */ jsx89(Fragment26, {});
|
|
32903
32912
|
}
|
|
@@ -32928,7 +32937,7 @@ var InfomationField = (props) => {
|
|
|
32928
32937
|
|
|
32929
32938
|
// src/widgets/basic/many2many-tags-field/many2many-tags.tsx
|
|
32930
32939
|
import { jsx as jsx90, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
32931
|
-
var CustomMultiValue = (props) => {
|
|
32940
|
+
var CustomMultiValue = ({ stringToColor, ...props }) => {
|
|
32932
32941
|
const { selectProps, data, menuList } = props;
|
|
32933
32942
|
const { relation } = selectProps;
|
|
32934
32943
|
const actionId = menuList?.flatMap(
|
|
@@ -32945,7 +32954,8 @@ var CustomMultiValue = (props) => {
|
|
|
32945
32954
|
relation,
|
|
32946
32955
|
isForm: false,
|
|
32947
32956
|
aid: actionId?.id,
|
|
32948
|
-
avatarSrc: data?.image_256
|
|
32957
|
+
avatarSrc: data?.image_256,
|
|
32958
|
+
stringToColor
|
|
32949
32959
|
}
|
|
32950
32960
|
),
|
|
32951
32961
|
/* @__PURE__ */ jsx90("span", { className: "capitalize", children: data?.label ?? data?.display_name }),
|
|
@@ -32990,7 +33000,14 @@ var Many2ManyTagField = (props) => {
|
|
|
32990
33000
|
value: item.id,
|
|
32991
33001
|
label: item.name ?? item.display_name
|
|
32992
33002
|
})) : [];
|
|
32993
|
-
return /* @__PURE__ */ jsx90(
|
|
33003
|
+
return /* @__PURE__ */ jsx90(
|
|
33004
|
+
InfomationField,
|
|
33005
|
+
{
|
|
33006
|
+
value: optionValue || null,
|
|
33007
|
+
isForm,
|
|
33008
|
+
stringToColor
|
|
33009
|
+
}
|
|
33010
|
+
);
|
|
32994
33011
|
}
|
|
32995
33012
|
return /* @__PURE__ */ jsx90(
|
|
32996
33013
|
Controller,
|
|
@@ -33075,7 +33092,13 @@ var Many2ManyTagField = (props) => {
|
|
|
33075
33092
|
})
|
|
33076
33093
|
},
|
|
33077
33094
|
components: isUser ? {
|
|
33078
|
-
MultiValue:
|
|
33095
|
+
MultiValue: (multiValueProps) => /* @__PURE__ */ jsx90(
|
|
33096
|
+
CustomMultiValue,
|
|
33097
|
+
{
|
|
33098
|
+
...multiValueProps,
|
|
33099
|
+
stringToColor
|
|
33100
|
+
}
|
|
33101
|
+
),
|
|
33079
33102
|
IndicatorSeparator: () => null
|
|
33080
33103
|
} : {
|
|
33081
33104
|
IndicatorSeparator: () => null
|
|
@@ -33599,7 +33622,7 @@ var ToggleButtonField = (props) => {
|
|
|
33599
33622
|
};
|
|
33600
33623
|
|
|
33601
33624
|
// src/widgets/basic/integer-field/integer.tsx
|
|
33602
|
-
import { useEffect as useEffect23, useRef as
|
|
33625
|
+
import { useEffect as useEffect23, useRef as useRef17, useState as useState20 } from "react";
|
|
33603
33626
|
import { Fragment as Fragment29, jsx as jsx100, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
33604
33627
|
var IntegerField = (props) => {
|
|
33605
33628
|
const {
|
|
@@ -33634,9 +33657,9 @@ var IntegerField = (props) => {
|
|
|
33634
33657
|
fieldState: { error: error2 }
|
|
33635
33658
|
}) => {
|
|
33636
33659
|
const { setError, clearErrors } = methods;
|
|
33637
|
-
const isDirtyRef =
|
|
33638
|
-
const inputRef =
|
|
33639
|
-
const lastCommittedValueRef =
|
|
33660
|
+
const isDirtyRef = useRef17(false);
|
|
33661
|
+
const inputRef = useRef17(null);
|
|
33662
|
+
const lastCommittedValueRef = useRef17(null);
|
|
33640
33663
|
const [inputValue, setInputValue] = useState20(
|
|
33641
33664
|
value2 !== void 0 && value2 !== null ? String(value2) : ""
|
|
33642
33665
|
);
|
|
@@ -33841,7 +33864,8 @@ var Many2ManyField = (props) => {
|
|
|
33841
33864
|
searchString,
|
|
33842
33865
|
selectedTags,
|
|
33843
33866
|
setFilterBy,
|
|
33844
|
-
setGroupBy
|
|
33867
|
+
setGroupBy,
|
|
33868
|
+
clearSearch
|
|
33845
33869
|
} = searchController;
|
|
33846
33870
|
return createPortal5(
|
|
33847
33871
|
/* @__PURE__ */ jsxs72("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[9999]", children: [
|
|
@@ -33882,7 +33906,8 @@ var Many2ManyField = (props) => {
|
|
|
33882
33906
|
selectedRowKeys,
|
|
33883
33907
|
aid,
|
|
33884
33908
|
domainSearch,
|
|
33885
|
-
evalJSONContext
|
|
33909
|
+
evalJSONContext,
|
|
33910
|
+
clearSearch
|
|
33886
33911
|
}
|
|
33887
33912
|
) }),
|
|
33888
33913
|
/* @__PURE__ */ jsx102(
|
package/dist/widgets.d.mts
CHANGED
|
@@ -66,7 +66,7 @@ declare const Row: (props: any) => JSX.Element;
|
|
|
66
66
|
|
|
67
67
|
declare const Login: React__default.FC<LoginProps>;
|
|
68
68
|
|
|
69
|
-
declare const Search: ({ removeSearchItems, selectedTags, filterBy, setFilterBy, searchString, onSearchString, handleAddTagSearch, searchBy, groupBy, showFiltersGroups, setGroupBy, setSelectedRowKeys, setDomainList, setPage, fieldsList, viewData, context, aid, selectedRowKeys, domainSearch, evalJSONContext, }: any) => JSX.Element;
|
|
69
|
+
declare const Search: ({ removeSearchItems, selectedTags, filterBy, setFilterBy, searchString, onSearchString, handleAddTagSearch, searchBy, groupBy, showFiltersGroups, setGroupBy, setSelectedRowKeys, setDomainList, setPage, fieldsList, viewData, context, aid, selectedRowKeys, domainSearch, evalJSONContext, clearSearch, }: any) => JSX.Element;
|
|
70
70
|
|
|
71
71
|
interface IActiveBadgeProps extends IInputFieldProps {
|
|
72
72
|
type: any;
|
|
@@ -425,7 +425,7 @@ declare const LoadingSmall: () => JSX.Element;
|
|
|
425
425
|
|
|
426
426
|
declare const RenderFiles: ({ selectedFiles, setSelectedFiles, useGetImage }: any) => JSX.Element;
|
|
427
427
|
|
|
428
|
-
declare const ButtonSelectFiles: ({ fileInputRef, selectedFiles, setSelectedFiles, setUploadError, model, id, widget, useUploadImage, useUploadFile }: any) => JSX.Element;
|
|
428
|
+
declare const ButtonSelectFiles: ({ fileInputRef, selectedFiles, setSelectedFiles, setUploadError, model, id, widget, useUploadImage, useUploadFile, }: any) => JSX.Element;
|
|
429
429
|
|
|
430
430
|
interface VideoPlayerProps {
|
|
431
431
|
src: string;
|