@fctc/sme-widget-ui 1.0.1 → 1.0.3
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 +70 -36
- package/dist/index.mjs +103 -69
- package/dist/widgets.d.mts +8 -4
- package/dist/widgets.d.ts +8 -4
- package/dist/widgets.js +70 -36
- package/dist/widgets.mjs +105 -71
- 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
|
|
@@ -33925,14 +33948,12 @@ var Many2ManyField = (props) => {
|
|
|
33925
33948
|
page,
|
|
33926
33949
|
rows,
|
|
33927
33950
|
columns,
|
|
33928
|
-
typeTable,
|
|
33929
33951
|
renderField,
|
|
33930
33952
|
isDataLoading,
|
|
33931
33953
|
relation,
|
|
33932
33954
|
onToggleColumnOptional,
|
|
33933
33955
|
isDataFetched,
|
|
33934
33956
|
isPlaceholderData,
|
|
33935
|
-
isCheckBox,
|
|
33936
33957
|
optionsObject,
|
|
33937
33958
|
onChoose,
|
|
33938
33959
|
onAddNew,
|
|
@@ -33946,7 +33967,13 @@ var Many2ManyField = (props) => {
|
|
|
33946
33967
|
evalJSONContext,
|
|
33947
33968
|
searchController,
|
|
33948
33969
|
viewData,
|
|
33949
|
-
setDomain
|
|
33970
|
+
setDomain,
|
|
33971
|
+
isDisplayCheckbox,
|
|
33972
|
+
checkedAll,
|
|
33973
|
+
handleCheckBoxAll,
|
|
33974
|
+
selectedRowKeysRef,
|
|
33975
|
+
typeTable,
|
|
33976
|
+
setSelectedRowKeys
|
|
33950
33977
|
} = props;
|
|
33951
33978
|
const {
|
|
33952
33979
|
context,
|
|
@@ -33960,7 +33987,8 @@ var Many2ManyField = (props) => {
|
|
|
33960
33987
|
searchString,
|
|
33961
33988
|
selectedTags,
|
|
33962
33989
|
setFilterBy,
|
|
33963
|
-
setGroupBy
|
|
33990
|
+
setGroupBy,
|
|
33991
|
+
clearSearch
|
|
33964
33992
|
} = searchController;
|
|
33965
33993
|
return (0, import_react_dom8.createPortal)(
|
|
33966
33994
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[9999]", children: [
|
|
@@ -33985,8 +34013,6 @@ var Many2ManyField = (props) => {
|
|
|
33985
34013
|
groupBy,
|
|
33986
34014
|
showFiltersGroups: true,
|
|
33987
34015
|
setGroupBy,
|
|
33988
|
-
setSelectedRowKeys: (keys) => {
|
|
33989
|
-
},
|
|
33990
34016
|
setDomainList: setDomain,
|
|
33991
34017
|
setPage: (pages) => {
|
|
33992
34018
|
setPage?.(pages);
|
|
@@ -33996,12 +34022,14 @@ var Many2ManyField = (props) => {
|
|
|
33996
34022
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
33997
34023
|
)?.map((col) => ({ ...col.field })) ?? []
|
|
33998
34024
|
],
|
|
34025
|
+
setSelectedRowKeys,
|
|
33999
34026
|
viewData,
|
|
34000
34027
|
context,
|
|
34001
34028
|
selectedRowKeys,
|
|
34002
34029
|
aid,
|
|
34003
34030
|
domainSearch,
|
|
34004
|
-
evalJSONContext
|
|
34031
|
+
evalJSONContext,
|
|
34032
|
+
clearSearch
|
|
34005
34033
|
}
|
|
34006
34034
|
) }),
|
|
34007
34035
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -34039,7 +34067,9 @@ var Many2ManyField = (props) => {
|
|
|
34039
34067
|
{
|
|
34040
34068
|
columns,
|
|
34041
34069
|
onToggleColumnOptional,
|
|
34042
|
-
isDisplayCheckbox
|
|
34070
|
+
isDisplayCheckbox,
|
|
34071
|
+
checkedAll,
|
|
34072
|
+
handleCheckBoxAll
|
|
34043
34073
|
}
|
|
34044
34074
|
),
|
|
34045
34075
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -34048,7 +34078,7 @@ var Many2ManyField = (props) => {
|
|
|
34048
34078
|
columns,
|
|
34049
34079
|
rows,
|
|
34050
34080
|
rootField,
|
|
34051
|
-
isDisplayCheckbox
|
|
34081
|
+
isDisplayCheckbox,
|
|
34052
34082
|
model: relation,
|
|
34053
34083
|
renderField: ({
|
|
34054
34084
|
row,
|
|
@@ -34069,7 +34099,11 @@ var Many2ManyField = (props) => {
|
|
|
34069
34099
|
},
|
|
34070
34100
|
onRemoveRow: null,
|
|
34071
34101
|
onAddRow,
|
|
34072
|
-
onClickRow
|
|
34102
|
+
onClickRow,
|
|
34103
|
+
typeTable,
|
|
34104
|
+
selectedRowKeysRef,
|
|
34105
|
+
selectedRowKeys,
|
|
34106
|
+
setSelectedRowKeys
|
|
34073
34107
|
}
|
|
34074
34108
|
)
|
|
34075
34109
|
]
|
|
@@ -34080,7 +34114,7 @@ var Many2ManyField = (props) => {
|
|
|
34080
34114
|
}
|
|
34081
34115
|
) }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LayerLoading, {}),
|
|
34082
34116
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-2 mt-auto", children: [
|
|
34083
|
-
|
|
34117
|
+
isDisplayCheckbox && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
34084
34118
|
"button",
|
|
34085
34119
|
{
|
|
34086
34120
|
disabled: selectedRowKeys?.length === 0,
|