@fctc/sme-widget-ui 2.7.3 → 2.7.5
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.css +1 -1
- package/dist/index.js +176 -168
- package/dist/index.mjs +177 -169
- package/dist/widgets.css +1 -1
- package/dist/widgets.d.mts +1 -1
- package/dist/widgets.d.ts +1 -1
- package/dist/widgets.js +257 -249
- package/dist/widgets.mjs +249 -241
- package/package.json +1 -1
package/dist/widgets.js
CHANGED
|
@@ -14381,9 +14381,12 @@ var Button = React2.forwardRef(
|
|
|
14381
14381
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14382
14382
|
"button",
|
|
14383
14383
|
{
|
|
14384
|
+
style: {
|
|
14385
|
+
background: "#008F3C"
|
|
14386
|
+
},
|
|
14384
14387
|
className: `${`inline-flex items-center justify-center rounded-md text-sm font-medium
|
|
14385
14388
|
transition-all duration-200 focus-visible:outline-none focus-visible:ring-1
|
|
14386
|
-
disabled:pointer-events-none disabled:opacity-50 px-8 py-3 border
|
|
14389
|
+
disabled:pointer-events-none disabled:opacity-50 px-8 py-3 border text-white
|
|
14387
14390
|
${isLoading ? "bg-opacity-50 cursor-not-allowed" : "hover:bg-opacity-75 active:scale-95 cursor-pointer"}`} ${className}`,
|
|
14388
14391
|
ref,
|
|
14389
14392
|
type,
|
|
@@ -14678,7 +14681,7 @@ var PopupFilter = ({
|
|
|
14678
14681
|
right: 0,
|
|
14679
14682
|
zIndex: 33
|
|
14680
14683
|
},
|
|
14681
|
-
className: "popup-filter w-full overflow-x-auto rounded-lg border
|
|
14684
|
+
className: "popup-filter w-full overflow-x-auto rounded-lg border bg-white border-none shadow-xl",
|
|
14682
14685
|
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
14683
14686
|
"div",
|
|
14684
14687
|
{
|
|
@@ -14783,8 +14786,191 @@ var PopupFilter = ({
|
|
|
14783
14786
|
// src/widgets/advanced/search/search-item/index.tsx
|
|
14784
14787
|
var import_react21 = require("react");
|
|
14785
14788
|
|
|
14786
|
-
// src/
|
|
14789
|
+
// src/widgets/advanced/search/search-list/index.tsx
|
|
14790
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
14791
|
+
var SearchList = ({
|
|
14792
|
+
handleAddTagSearch,
|
|
14793
|
+
handleMouseEnter,
|
|
14794
|
+
handleMouseLeave,
|
|
14795
|
+
searchBy,
|
|
14796
|
+
searchString,
|
|
14797
|
+
hoveredIndexSearchList
|
|
14798
|
+
}) => {
|
|
14799
|
+
const { t: t3 } = useI18n();
|
|
14800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
14801
|
+
"div",
|
|
14802
|
+
{
|
|
14803
|
+
style: {
|
|
14804
|
+
position: "absolute",
|
|
14805
|
+
top: "calc(100% + 5px)",
|
|
14806
|
+
left: 0,
|
|
14807
|
+
right: 0,
|
|
14808
|
+
zIndex: 31
|
|
14809
|
+
},
|
|
14810
|
+
className: `${searchString === "" ? "hidden" : "block"} w-full overflow-x-auto rounded-[0.25rem] border-none bg-white shadow-lg`,
|
|
14811
|
+
children: searchBy?.map((searchItem, index4) => {
|
|
14812
|
+
if (searchItem?.type === "date" || searchItem?.type === "datetime") {
|
|
14813
|
+
if (!validateAndParseDate(searchString, searchItem?.type === "datetime"))
|
|
14814
|
+
return;
|
|
14815
|
+
}
|
|
14816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
14817
|
+
"button",
|
|
14818
|
+
{
|
|
14819
|
+
onClick: () => {
|
|
14820
|
+
typeof handleAddTagSearch === "function" && handleAddTagSearch({
|
|
14821
|
+
title: searchItem?.title,
|
|
14822
|
+
name: searchItem?.name,
|
|
14823
|
+
value: searchString,
|
|
14824
|
+
domain: searchItem?.filter_domain,
|
|
14825
|
+
operator: searchItem?.operator,
|
|
14826
|
+
type: SearchType.SEARCH,
|
|
14827
|
+
modelType: searchItem?.type,
|
|
14828
|
+
widget: searchItem?.widget,
|
|
14829
|
+
dataIndex: searchItem?.dataIndex
|
|
14830
|
+
});
|
|
14831
|
+
},
|
|
14832
|
+
onMouseEnter: () => typeof handleMouseEnter === "function" && handleMouseEnter(index4),
|
|
14833
|
+
onMouseLeave: () => typeof handleMouseLeave === "function" && handleMouseLeave(),
|
|
14834
|
+
style: {
|
|
14835
|
+
display: "block",
|
|
14836
|
+
width: "100%",
|
|
14837
|
+
cursor: "pointer",
|
|
14838
|
+
whiteSpace: "nowrap",
|
|
14839
|
+
padding: "2px 12px",
|
|
14840
|
+
paddingTop: "4px",
|
|
14841
|
+
paddingBottom: "4px",
|
|
14842
|
+
textAlign: "left",
|
|
14843
|
+
transitionDuration: "0ms",
|
|
14844
|
+
backgroundColor: hoveredIndexSearchList === index4 ? "rgba(0,0,0,0.08)" : "white",
|
|
14845
|
+
fontSize: "14px"
|
|
14846
|
+
},
|
|
14847
|
+
children: [
|
|
14848
|
+
t3("search"),
|
|
14849
|
+
" ",
|
|
14850
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "font-bold", children: searchItem?.title }),
|
|
14851
|
+
" ",
|
|
14852
|
+
t3("for"),
|
|
14853
|
+
":",
|
|
14854
|
+
" ",
|
|
14855
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "custom-input-result text-primary font-bold italic", children: searchString })
|
|
14856
|
+
]
|
|
14857
|
+
},
|
|
14858
|
+
"header-" + index4 + 1
|
|
14859
|
+
);
|
|
14860
|
+
})
|
|
14861
|
+
}
|
|
14862
|
+
);
|
|
14863
|
+
};
|
|
14864
|
+
|
|
14865
|
+
// src/widgets/advanced/search/tag-search/index.tsx
|
|
14787
14866
|
var import_react18 = require("react");
|
|
14867
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
14868
|
+
var TagSearch = ({
|
|
14869
|
+
removeSearchItems,
|
|
14870
|
+
selectedTags,
|
|
14871
|
+
filterBy,
|
|
14872
|
+
setFilterBy
|
|
14873
|
+
}) => {
|
|
14874
|
+
const { t: t3 } = useI18n();
|
|
14875
|
+
return selectedTags?.length > 0 && selectedTags?.map((tag, index4) => {
|
|
14876
|
+
if (tag?.values?.length > 0) {
|
|
14877
|
+
if (tag?.type !== "group_by") {
|
|
14878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
14879
|
+
"div",
|
|
14880
|
+
{
|
|
14881
|
+
className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
14882
|
+
children: [
|
|
14883
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.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_runtime64.jsx)(FilterIcon, {}) }),
|
|
14884
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
14885
|
+
"div",
|
|
14886
|
+
{
|
|
14887
|
+
style: {
|
|
14888
|
+
paddingLeft: "8px"
|
|
14889
|
+
},
|
|
14890
|
+
className: "align-middle text-[#495057] text-[14px]",
|
|
14891
|
+
children: tag.values.map((value, idx) => {
|
|
14892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_react18.Fragment, { children: [
|
|
14893
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { children: value }),
|
|
14894
|
+
idx < tag.values.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
|
|
14895
|
+
" ",
|
|
14896
|
+
t3("or"),
|
|
14897
|
+
" "
|
|
14898
|
+
] })
|
|
14899
|
+
] }, idx);
|
|
14900
|
+
})
|
|
14901
|
+
}
|
|
14902
|
+
),
|
|
14903
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
14904
|
+
"button",
|
|
14905
|
+
{
|
|
14906
|
+
className: "px-2 text-sm font-bold",
|
|
14907
|
+
onClick: () => {
|
|
14908
|
+
typeof removeSearchItems === "function" && removeSearchItems(
|
|
14909
|
+
tag?.type === SearchType.FILTER ? `${SearchType.FILTER}_${tag?.name}` : tag?.name
|
|
14910
|
+
);
|
|
14911
|
+
if (tag?.type === SearchType.FILTER) {
|
|
14912
|
+
setFilterBy(
|
|
14913
|
+
filterBy?.map((item) => ({
|
|
14914
|
+
...item,
|
|
14915
|
+
active: false
|
|
14916
|
+
}))
|
|
14917
|
+
);
|
|
14918
|
+
}
|
|
14919
|
+
},
|
|
14920
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(CloseIcon, { className: "size-4 cursor-pointer" })
|
|
14921
|
+
}
|
|
14922
|
+
)
|
|
14923
|
+
]
|
|
14924
|
+
},
|
|
14925
|
+
"selected-tag-" + index4
|
|
14926
|
+
);
|
|
14927
|
+
} else if (tag?.type === "group_by") {
|
|
14928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
14929
|
+
"div",
|
|
14930
|
+
{
|
|
14931
|
+
className: "flex min-h-full overflow-hidden",
|
|
14932
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "flex flex-wrap items-center gap-2 align-middle text-[#495057] text-[14px]", children: tag?.values?.length > 0 && tag?.values.map(
|
|
14933
|
+
(value, indexValue) => value?.strings?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
14934
|
+
"div",
|
|
14935
|
+
{
|
|
14936
|
+
className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
14937
|
+
children: [
|
|
14938
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.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_runtime64.jsx)(GroupByIcon, {}) }),
|
|
14939
|
+
value?.strings?.map((string, idx) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
14940
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { children: string }),
|
|
14941
|
+
idx < value?.strings.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
|
|
14942
|
+
" ",
|
|
14943
|
+
"> ",
|
|
14944
|
+
" "
|
|
14945
|
+
] })
|
|
14946
|
+
] })),
|
|
14947
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
14948
|
+
"button",
|
|
14949
|
+
{
|
|
14950
|
+
className: "pr-2 text-sm font-bold",
|
|
14951
|
+
onClick: () => {
|
|
14952
|
+
if (tag?.type === SearchType.GROUP) {
|
|
14953
|
+
typeof removeSearchItems === "function" && removeSearchItems(`${SearchType.GROUP}`);
|
|
14954
|
+
}
|
|
14955
|
+
},
|
|
14956
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(CloseIcon, { className: "size-4 cursor-pointer" })
|
|
14957
|
+
}
|
|
14958
|
+
)
|
|
14959
|
+
]
|
|
14960
|
+
},
|
|
14961
|
+
`group-by-${index4}-${indexValue}`
|
|
14962
|
+
)
|
|
14963
|
+
) })
|
|
14964
|
+
},
|
|
14965
|
+
"selected-tag-" + index4
|
|
14966
|
+
);
|
|
14967
|
+
}
|
|
14968
|
+
}
|
|
14969
|
+
});
|
|
14970
|
+
};
|
|
14971
|
+
|
|
14972
|
+
// src/hooks/use-click-outside.ts
|
|
14973
|
+
var import_react19 = require("react");
|
|
14788
14974
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
14789
14975
|
var useClickOutside = ({
|
|
14790
14976
|
handler,
|
|
@@ -14793,8 +14979,8 @@ var useClickOutside = ({
|
|
|
14793
14979
|
// Default to empty array to avoid undefined errors
|
|
14794
14980
|
refs
|
|
14795
14981
|
}) => {
|
|
14796
|
-
const ref = (0,
|
|
14797
|
-
(0,
|
|
14982
|
+
const ref = (0, import_react19.useRef)(null);
|
|
14983
|
+
(0, import_react19.useEffect)(() => {
|
|
14798
14984
|
const listener = (event) => {
|
|
14799
14985
|
const { target } = event;
|
|
14800
14986
|
if (refs && refs?.length > 0 && refs?.some((r4) => r4.current?.contains(target))) {
|
|
@@ -14816,7 +15002,7 @@ var useClickOutside = ({
|
|
|
14816
15002
|
};
|
|
14817
15003
|
|
|
14818
15004
|
// src/hooks/use-get-file-infor.ts
|
|
14819
|
-
var
|
|
15005
|
+
var import_react20 = require("react");
|
|
14820
15006
|
function getFileName(source, mime) {
|
|
14821
15007
|
if (source instanceof File) return source.name;
|
|
14822
15008
|
if (typeof source === "string") {
|
|
@@ -14837,11 +15023,11 @@ function getFileName(source, mime) {
|
|
|
14837
15023
|
}
|
|
14838
15024
|
function useFileInfo(source, options2) {
|
|
14839
15025
|
const { readAs = "all" } = options2 ?? {};
|
|
14840
|
-
const [info, setInfo] = (0,
|
|
14841
|
-
const [loading, setLoading] = (0,
|
|
14842
|
-
const [error2, setError] = (0,
|
|
14843
|
-
const abortRef = (0,
|
|
14844
|
-
(0,
|
|
15026
|
+
const [info, setInfo] = (0, import_react20.useState)(null);
|
|
15027
|
+
const [loading, setLoading] = (0, import_react20.useState)(false);
|
|
15028
|
+
const [error2, setError] = (0, import_react20.useState)(null);
|
|
15029
|
+
const abortRef = (0, import_react20.useRef)({ aborted: false });
|
|
15030
|
+
(0, import_react20.useEffect)(() => {
|
|
14845
15031
|
abortRef.current.aborted = false;
|
|
14846
15032
|
if (!source) {
|
|
14847
15033
|
setInfo(null);
|
|
@@ -15029,179 +15215,6 @@ function useFileInfo(source, options2) {
|
|
|
15029
15215
|
} };
|
|
15030
15216
|
}
|
|
15031
15217
|
|
|
15032
|
-
// src/widgets/advanced/search/tag-search/index.tsx
|
|
15033
|
-
var import_react20 = require("react");
|
|
15034
|
-
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
15035
|
-
var TagSearch = ({
|
|
15036
|
-
removeSearchItems,
|
|
15037
|
-
selectedTags,
|
|
15038
|
-
filterBy,
|
|
15039
|
-
setFilterBy,
|
|
15040
|
-
setGroupBy
|
|
15041
|
-
}) => {
|
|
15042
|
-
return selectedTags?.length > 0 && selectedTags?.map((tag, index4) => {
|
|
15043
|
-
if (tag?.values?.length > 0) {
|
|
15044
|
-
if (tag?.type !== "group_by") {
|
|
15045
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
15046
|
-
"div",
|
|
15047
|
-
{
|
|
15048
|
-
className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
15049
|
-
children: [
|
|
15050
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.jsx)(FilterIcon, {}) }),
|
|
15051
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "pl-2 align-middle text-[#495057] text-[14px]", children: tag.values.map((value, idx) => {
|
|
15052
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react20.Fragment, { children: [
|
|
15053
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: value }),
|
|
15054
|
-
idx < tag.values.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
|
|
15055
|
-
" ",
|
|
15056
|
-
instance.t("or"),
|
|
15057
|
-
" "
|
|
15058
|
-
] })
|
|
15059
|
-
] }, idx);
|
|
15060
|
-
}) }),
|
|
15061
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
15062
|
-
"button",
|
|
15063
|
-
{
|
|
15064
|
-
className: "px-2 text-sm font-bold",
|
|
15065
|
-
onClick: () => {
|
|
15066
|
-
typeof removeSearchItems === "function" && removeSearchItems(
|
|
15067
|
-
tag?.type === SearchType.FILTER ? `${SearchType.FILTER}_${tag?.name}` : tag?.name
|
|
15068
|
-
);
|
|
15069
|
-
if (tag?.type === SearchType.FILTER) {
|
|
15070
|
-
setFilterBy(
|
|
15071
|
-
filterBy?.map((item) => ({
|
|
15072
|
-
...item,
|
|
15073
|
-
active: false
|
|
15074
|
-
}))
|
|
15075
|
-
);
|
|
15076
|
-
}
|
|
15077
|
-
},
|
|
15078
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CloseIcon, { className: "size-4 cursor-pointer" })
|
|
15079
|
-
}
|
|
15080
|
-
)
|
|
15081
|
-
]
|
|
15082
|
-
},
|
|
15083
|
-
"selected-tag-" + index4
|
|
15084
|
-
);
|
|
15085
|
-
} else if (tag?.type === "group_by") {
|
|
15086
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
15087
|
-
"div",
|
|
15088
|
-
{
|
|
15089
|
-
className: "flex min-h-full overflow-hidden",
|
|
15090
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "flex flex-wrap items-center gap-2 align-middle text-[#495057] text-[14px]", children: tag?.values?.length > 0 && tag?.values.map(
|
|
15091
|
-
(value, indexValue) => value?.strings?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
15092
|
-
"div",
|
|
15093
|
-
{
|
|
15094
|
-
className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
15095
|
-
children: [
|
|
15096
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.jsx)(GroupByIcon, {}) }),
|
|
15097
|
-
value?.strings?.map((string, idx) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
15098
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: string }),
|
|
15099
|
-
idx < value?.strings.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
|
|
15100
|
-
" ",
|
|
15101
|
-
"> ",
|
|
15102
|
-
" "
|
|
15103
|
-
] })
|
|
15104
|
-
] })),
|
|
15105
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
15106
|
-
"button",
|
|
15107
|
-
{
|
|
15108
|
-
className: "pr-2 text-sm font-bold",
|
|
15109
|
-
onClick: () => {
|
|
15110
|
-
if (tag?.type === SearchType.GROUP) {
|
|
15111
|
-
typeof removeSearchItems === "function" && removeSearchItems(`${SearchType.GROUP}`);
|
|
15112
|
-
setGroupBy(
|
|
15113
|
-
(prev2) => prev2?.map((item) => ({
|
|
15114
|
-
...item,
|
|
15115
|
-
active: false
|
|
15116
|
-
}))
|
|
15117
|
-
);
|
|
15118
|
-
}
|
|
15119
|
-
},
|
|
15120
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CloseIcon, { className: "size-4 cursor-pointer" })
|
|
15121
|
-
}
|
|
15122
|
-
)
|
|
15123
|
-
]
|
|
15124
|
-
},
|
|
15125
|
-
`group-by-${index4}-${indexValue}`
|
|
15126
|
-
)
|
|
15127
|
-
) })
|
|
15128
|
-
},
|
|
15129
|
-
"selected-tag-" + index4
|
|
15130
|
-
);
|
|
15131
|
-
}
|
|
15132
|
-
}
|
|
15133
|
-
});
|
|
15134
|
-
};
|
|
15135
|
-
|
|
15136
|
-
// src/widgets/advanced/search/search-list/index.tsx
|
|
15137
|
-
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
15138
|
-
var SearchList = ({
|
|
15139
|
-
handleAddTagSearch,
|
|
15140
|
-
handleMouseEnter,
|
|
15141
|
-
handleMouseLeave,
|
|
15142
|
-
searchBy,
|
|
15143
|
-
searchString,
|
|
15144
|
-
hoveredIndexSearchList
|
|
15145
|
-
}) => {
|
|
15146
|
-
const { t: t3 } = useI18n();
|
|
15147
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
15148
|
-
"div",
|
|
15149
|
-
{
|
|
15150
|
-
style: {
|
|
15151
|
-
top: "calc(100% + 3px)"
|
|
15152
|
-
},
|
|
15153
|
-
className: `${searchString === "" ? "hidden" : "block"} absolute left-0 right-0 top-[calc(100%_+_3px)] z-[31] w-full overflow-x-auto rounded-[0.25rem] border-none bg-white shadow-lg`,
|
|
15154
|
-
children: searchBy?.map((searchItem, index4) => {
|
|
15155
|
-
if (searchItem?.type === "date" || searchItem?.type === "datetime") {
|
|
15156
|
-
if (!validateAndParseDate(searchString, searchItem?.type === "datetime"))
|
|
15157
|
-
return;
|
|
15158
|
-
}
|
|
15159
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
15160
|
-
"button",
|
|
15161
|
-
{
|
|
15162
|
-
onClick: () => {
|
|
15163
|
-
typeof handleAddTagSearch === "function" && handleAddTagSearch({
|
|
15164
|
-
title: searchItem?.title,
|
|
15165
|
-
name: searchItem?.name,
|
|
15166
|
-
value: searchString,
|
|
15167
|
-
domain: searchItem?.filter_domain,
|
|
15168
|
-
operator: searchItem?.operator,
|
|
15169
|
-
type: SearchType.SEARCH,
|
|
15170
|
-
modelType: searchItem?.type,
|
|
15171
|
-
widget: searchItem?.widget,
|
|
15172
|
-
dataIndex: searchItem?.dataIndex
|
|
15173
|
-
});
|
|
15174
|
-
},
|
|
15175
|
-
onMouseEnter: () => typeof handleMouseEnter === "function" && handleMouseEnter(index4),
|
|
15176
|
-
onMouseLeave: () => typeof handleMouseLeave === "function" && handleMouseLeave(),
|
|
15177
|
-
className: `block w-full cursor-pointer whitespace-nowrap p-2 px-3 py-1 text-left !duration-0 hover:!bg-[rgba(0,0,0,0.08)] hover:text-inherit text-sm ${hoveredIndexSearchList === index4 ? "bg-[rgba(0,0,0,0.08)]" : "bg-white"}`,
|
|
15178
|
-
children: [
|
|
15179
|
-
t3("search"),
|
|
15180
|
-
" ",
|
|
15181
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "font-bold", children: searchItem?.title }),
|
|
15182
|
-
" ",
|
|
15183
|
-
t3("for"),
|
|
15184
|
-
":",
|
|
15185
|
-
" ",
|
|
15186
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
15187
|
-
"span",
|
|
15188
|
-
{
|
|
15189
|
-
style: {
|
|
15190
|
-
color: "var(--color-primary)"
|
|
15191
|
-
},
|
|
15192
|
-
className: "custom-input-result text-primary font-bold italic",
|
|
15193
|
-
children: searchString
|
|
15194
|
-
}
|
|
15195
|
-
)
|
|
15196
|
-
]
|
|
15197
|
-
},
|
|
15198
|
-
"header-" + index4 + 1
|
|
15199
|
-
);
|
|
15200
|
-
})
|
|
15201
|
-
}
|
|
15202
|
-
);
|
|
15203
|
-
};
|
|
15204
|
-
|
|
15205
15218
|
// src/widgets/advanced/search/search-item/index.tsx
|
|
15206
15219
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
15207
15220
|
var Search = ({
|
|
@@ -15226,7 +15239,11 @@ var Search = ({
|
|
|
15226
15239
|
selectedRowKeys,
|
|
15227
15240
|
domainSearch,
|
|
15228
15241
|
evalJSONContext,
|
|
15229
|
-
clearSearch
|
|
15242
|
+
clearSearch,
|
|
15243
|
+
onKeyDown,
|
|
15244
|
+
handleMouseEnter,
|
|
15245
|
+
handleMouseLeave,
|
|
15246
|
+
hoveredIndexSearchList
|
|
15230
15247
|
}) => {
|
|
15231
15248
|
const { t: t3 } = useI18n();
|
|
15232
15249
|
const [showPopupFilter, setShowPopupFilter] = (0, import_react21.useState)(false);
|
|
@@ -15263,9 +15280,8 @@ var Search = ({
|
|
|
15263
15280
|
const searchDefaults = Object.entries(context || {}).filter(
|
|
15264
15281
|
([key]) => key.startsWith("search_default_")
|
|
15265
15282
|
);
|
|
15266
|
-
const defaultGroupBy = context ? Object.entries(context).filter(([key]) => key.includes("group_by")) : [];
|
|
15267
15283
|
const hasGroupBy = viewData?.views?.search?.filters_by?.length > 0;
|
|
15268
|
-
if (searchDefaults.length === 0 && !hasGroupBy
|
|
15284
|
+
if (searchDefaults.length === 0 && !hasGroupBy) {
|
|
15269
15285
|
setIsReadyFormatDomain(true);
|
|
15270
15286
|
setDidInit(true);
|
|
15271
15287
|
return;
|
|
@@ -15286,23 +15302,7 @@ var Search = ({
|
|
|
15286
15302
|
}
|
|
15287
15303
|
return item;
|
|
15288
15304
|
});
|
|
15289
|
-
const updatedGroupBy = groupBy?.map((item) => {
|
|
15290
|
-
const defaultGroupByItem = defaultGroupBy.find(
|
|
15291
|
-
([_2, value]) => item?.context?.includes(value)
|
|
15292
|
-
);
|
|
15293
|
-
if (defaultGroupByItem && typeof handleAddTagSearch == "function") {
|
|
15294
|
-
handleAddTagSearch({
|
|
15295
|
-
name: item?.name,
|
|
15296
|
-
value: item?.string,
|
|
15297
|
-
type: SearchType.GROUP,
|
|
15298
|
-
context: JSON.parse(item?.context.replace(/'/g, '"'))
|
|
15299
|
-
});
|
|
15300
|
-
return { ...item, active: true };
|
|
15301
|
-
}
|
|
15302
|
-
return item;
|
|
15303
|
-
});
|
|
15304
15305
|
if (updatedFilter) setFilterBy(updatedFilter);
|
|
15305
|
-
if (updatedGroupBy) setGroupBy(updatedGroupBy);
|
|
15306
15306
|
if (hasGroupBy) {
|
|
15307
15307
|
viewData?.views?.search?.filters_by?.forEach((item, idx) => {
|
|
15308
15308
|
const groupCtx = evalJSONContext(item?.context);
|
|
@@ -15324,60 +15324,68 @@ var Search = ({
|
|
|
15324
15324
|
"div",
|
|
15325
15325
|
{
|
|
15326
15326
|
ref: popupFilterRef,
|
|
15327
|
-
className: `search
|
|
15327
|
+
className: `search ${selectedRowKeys?.length <= 0 ? "flex" : "hidden"} bg-white custom-search-input py-[8px] px-[16px] relative items-center w-full flex-1 xl:flex-1 rounded-[10px] bg-grey-100 shadow-[0px_1px_3px_rgba(16,24,40,0.1),0px_1px_2px_rgba(16,24,40,0.06)] min-h-[40px] border border-[#F2F2F2]`,
|
|
15328
15328
|
children: [
|
|
15329
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15353
|
-
|
|
15329
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
15330
|
+
"div",
|
|
15331
|
+
{
|
|
15332
|
+
className: `relative flex md:min-w-[400px] max-w-full items-center gap-[8px] w-full ${(showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && "border-r border-[rgba(242,242,242,1)]"}`,
|
|
15333
|
+
children: [
|
|
15334
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "min-h-5 min-w-5", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SearchIcon, {}) }),
|
|
15335
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-1 flex-wrap items-center gap-[8px]", children: [
|
|
15336
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
15337
|
+
TagSearch,
|
|
15338
|
+
{
|
|
15339
|
+
removeSearchItems,
|
|
15340
|
+
selectedTags,
|
|
15341
|
+
filterBy,
|
|
15342
|
+
setFilterBy
|
|
15343
|
+
}
|
|
15344
|
+
),
|
|
15345
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
15346
|
+
"input",
|
|
15347
|
+
{
|
|
15348
|
+
value: searchString,
|
|
15349
|
+
className: "min-h-[25px] w-fit flex-1 border-none bg-transparent outline-none min-w-[50px] text-sm",
|
|
15350
|
+
placeholder: t3("search..."),
|
|
15351
|
+
onChange: (e3) => {
|
|
15352
|
+
onSearchString(e3.target.value);
|
|
15353
|
+
setShowPopupFilter(false);
|
|
15354
|
+
},
|
|
15355
|
+
onKeyDown,
|
|
15356
|
+
onKeyUp: (e3) => e3.preventDefault()
|
|
15357
|
+
}
|
|
15358
|
+
),
|
|
15359
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
15360
|
+
SearchList,
|
|
15361
|
+
{
|
|
15362
|
+
handleAddTagSearch,
|
|
15363
|
+
searchBy,
|
|
15364
|
+
searchString,
|
|
15365
|
+
handleMouseEnter,
|
|
15366
|
+
handleMouseLeave,
|
|
15367
|
+
hoveredIndexSearchList
|
|
15368
|
+
}
|
|
15369
|
+
)
|
|
15370
|
+
] })
|
|
15371
|
+
]
|
|
15372
|
+
}
|
|
15373
|
+
),
|
|
15374
|
+
(showFiltersGroups || filterBy?.length > 0 || groupBy?.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
15354
15375
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
15355
|
-
SearchList,
|
|
15356
|
-
{
|
|
15357
|
-
handleAddTagSearch,
|
|
15358
|
-
searchBy,
|
|
15359
|
-
searchString
|
|
15360
|
-
}
|
|
15361
|
-
)
|
|
15362
|
-
] }),
|
|
15363
|
-
showFiltersGroups && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
15364
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
15365
15376
|
"div",
|
|
15366
15377
|
{
|
|
15367
|
-
className: `flex h-full
|
|
15378
|
+
className: `flex h-full cursor-pointer items-center justify-center px-[10px] max-w-fit`,
|
|
15368
15379
|
onClick: (e3) => {
|
|
15369
15380
|
e3.stopPropagation();
|
|
15370
15381
|
setShowPopupFilter((prev2) => !prev2);
|
|
15371
15382
|
},
|
|
15372
|
-
children:
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
}
|
|
15379
|
-
)
|
|
15380
|
-
]
|
|
15383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { className: "w-max cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
15384
|
+
ChevronBottomIcon,
|
|
15385
|
+
{
|
|
15386
|
+
className: `h-5 w-5 min-w-fit transition-all ${showPopupFilter ? "rotate-180 " : ""}`
|
|
15387
|
+
}
|
|
15388
|
+
) })
|
|
15381
15389
|
}
|
|
15382
15390
|
),
|
|
15383
15391
|
showPopupFilter && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|