@fctc/sme-widget-ui 2.7.4 → 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 +172 -167
- package/dist/index.mjs +173 -168
- package/dist/widgets.css +1 -1
- package/dist/widgets.d.mts +1 -1
- package/dist/widgets.d.ts +1 -1
- package/dist/widgets.js +253 -248
- package/dist/widgets.mjs +245 -240
- package/package.json +1 -1
package/dist/widgets.js
CHANGED
|
@@ -14681,7 +14681,7 @@ var PopupFilter = ({
|
|
|
14681
14681
|
right: 0,
|
|
14682
14682
|
zIndex: 33
|
|
14683
14683
|
},
|
|
14684
|
-
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",
|
|
14685
14685
|
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
14686
14686
|
"div",
|
|
14687
14687
|
{
|
|
@@ -14786,8 +14786,191 @@ var PopupFilter = ({
|
|
|
14786
14786
|
// src/widgets/advanced/search/search-item/index.tsx
|
|
14787
14787
|
var import_react21 = require("react");
|
|
14788
14788
|
|
|
14789
|
-
// 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
|
|
14790
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");
|
|
14791
14974
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
14792
14975
|
var useClickOutside = ({
|
|
14793
14976
|
handler,
|
|
@@ -14796,8 +14979,8 @@ var useClickOutside = ({
|
|
|
14796
14979
|
// Default to empty array to avoid undefined errors
|
|
14797
14980
|
refs
|
|
14798
14981
|
}) => {
|
|
14799
|
-
const ref = (0,
|
|
14800
|
-
(0,
|
|
14982
|
+
const ref = (0, import_react19.useRef)(null);
|
|
14983
|
+
(0, import_react19.useEffect)(() => {
|
|
14801
14984
|
const listener = (event) => {
|
|
14802
14985
|
const { target } = event;
|
|
14803
14986
|
if (refs && refs?.length > 0 && refs?.some((r4) => r4.current?.contains(target))) {
|
|
@@ -14819,7 +15002,7 @@ var useClickOutside = ({
|
|
|
14819
15002
|
};
|
|
14820
15003
|
|
|
14821
15004
|
// src/hooks/use-get-file-infor.ts
|
|
14822
|
-
var
|
|
15005
|
+
var import_react20 = require("react");
|
|
14823
15006
|
function getFileName(source, mime) {
|
|
14824
15007
|
if (source instanceof File) return source.name;
|
|
14825
15008
|
if (typeof source === "string") {
|
|
@@ -14840,11 +15023,11 @@ function getFileName(source, mime) {
|
|
|
14840
15023
|
}
|
|
14841
15024
|
function useFileInfo(source, options2) {
|
|
14842
15025
|
const { readAs = "all" } = options2 ?? {};
|
|
14843
|
-
const [info, setInfo] = (0,
|
|
14844
|
-
const [loading, setLoading] = (0,
|
|
14845
|
-
const [error2, setError] = (0,
|
|
14846
|
-
const abortRef = (0,
|
|
14847
|
-
(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)(() => {
|
|
14848
15031
|
abortRef.current.aborted = false;
|
|
14849
15032
|
if (!source) {
|
|
14850
15033
|
setInfo(null);
|
|
@@ -15032,179 +15215,6 @@ function useFileInfo(source, options2) {
|
|
|
15032
15215
|
} };
|
|
15033
15216
|
}
|
|
15034
15217
|
|
|
15035
|
-
// src/widgets/advanced/search/tag-search/index.tsx
|
|
15036
|
-
var import_react20 = require("react");
|
|
15037
|
-
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
15038
|
-
var TagSearch = ({
|
|
15039
|
-
removeSearchItems,
|
|
15040
|
-
selectedTags,
|
|
15041
|
-
filterBy,
|
|
15042
|
-
setFilterBy,
|
|
15043
|
-
setGroupBy
|
|
15044
|
-
}) => {
|
|
15045
|
-
return selectedTags?.length > 0 && selectedTags?.map((tag, index4) => {
|
|
15046
|
-
if (tag?.values?.length > 0) {
|
|
15047
|
-
if (tag?.type !== "group_by") {
|
|
15048
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
15049
|
-
"div",
|
|
15050
|
-
{
|
|
15051
|
-
className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
15052
|
-
children: [
|
|
15053
|
-
/* @__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, {}) }),
|
|
15054
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "pl-2 align-middle text-[#495057] text-[14px]", children: tag.values.map((value, idx) => {
|
|
15055
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react20.Fragment, { children: [
|
|
15056
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: value }),
|
|
15057
|
-
idx < tag.values.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
|
|
15058
|
-
" ",
|
|
15059
|
-
instance.t("or"),
|
|
15060
|
-
" "
|
|
15061
|
-
] })
|
|
15062
|
-
] }, idx);
|
|
15063
|
-
}) }),
|
|
15064
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
15065
|
-
"button",
|
|
15066
|
-
{
|
|
15067
|
-
className: "px-2 text-sm font-bold",
|
|
15068
|
-
onClick: () => {
|
|
15069
|
-
typeof removeSearchItems === "function" && removeSearchItems(
|
|
15070
|
-
tag?.type === SearchType.FILTER ? `${SearchType.FILTER}_${tag?.name}` : tag?.name
|
|
15071
|
-
);
|
|
15072
|
-
if (tag?.type === SearchType.FILTER) {
|
|
15073
|
-
setFilterBy(
|
|
15074
|
-
filterBy?.map((item) => ({
|
|
15075
|
-
...item,
|
|
15076
|
-
active: false
|
|
15077
|
-
}))
|
|
15078
|
-
);
|
|
15079
|
-
}
|
|
15080
|
-
},
|
|
15081
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CloseIcon, { className: "size-4 cursor-pointer" })
|
|
15082
|
-
}
|
|
15083
|
-
)
|
|
15084
|
-
]
|
|
15085
|
-
},
|
|
15086
|
-
"selected-tag-" + index4
|
|
15087
|
-
);
|
|
15088
|
-
} else if (tag?.type === "group_by") {
|
|
15089
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
15090
|
-
"div",
|
|
15091
|
-
{
|
|
15092
|
-
className: "flex min-h-full overflow-hidden",
|
|
15093
|
-
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(
|
|
15094
|
-
(value, indexValue) => value?.strings?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
15095
|
-
"div",
|
|
15096
|
-
{
|
|
15097
|
-
className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
15098
|
-
children: [
|
|
15099
|
-
/* @__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, {}) }),
|
|
15100
|
-
value?.strings?.map((string, idx) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
15101
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: string }),
|
|
15102
|
-
idx < value?.strings.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
|
|
15103
|
-
" ",
|
|
15104
|
-
"> ",
|
|
15105
|
-
" "
|
|
15106
|
-
] })
|
|
15107
|
-
] })),
|
|
15108
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
15109
|
-
"button",
|
|
15110
|
-
{
|
|
15111
|
-
className: "pr-2 text-sm font-bold",
|
|
15112
|
-
onClick: () => {
|
|
15113
|
-
if (tag?.type === SearchType.GROUP) {
|
|
15114
|
-
typeof removeSearchItems === "function" && removeSearchItems(`${SearchType.GROUP}`);
|
|
15115
|
-
setGroupBy(
|
|
15116
|
-
(prev2) => prev2?.map((item) => ({
|
|
15117
|
-
...item,
|
|
15118
|
-
active: false
|
|
15119
|
-
}))
|
|
15120
|
-
);
|
|
15121
|
-
}
|
|
15122
|
-
},
|
|
15123
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CloseIcon, { className: "size-4 cursor-pointer" })
|
|
15124
|
-
}
|
|
15125
|
-
)
|
|
15126
|
-
]
|
|
15127
|
-
},
|
|
15128
|
-
`group-by-${index4}-${indexValue}`
|
|
15129
|
-
)
|
|
15130
|
-
) })
|
|
15131
|
-
},
|
|
15132
|
-
"selected-tag-" + index4
|
|
15133
|
-
);
|
|
15134
|
-
}
|
|
15135
|
-
}
|
|
15136
|
-
});
|
|
15137
|
-
};
|
|
15138
|
-
|
|
15139
|
-
// src/widgets/advanced/search/search-list/index.tsx
|
|
15140
|
-
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
15141
|
-
var SearchList = ({
|
|
15142
|
-
handleAddTagSearch,
|
|
15143
|
-
handleMouseEnter,
|
|
15144
|
-
handleMouseLeave,
|
|
15145
|
-
searchBy,
|
|
15146
|
-
searchString,
|
|
15147
|
-
hoveredIndexSearchList
|
|
15148
|
-
}) => {
|
|
15149
|
-
const { t: t3 } = useI18n();
|
|
15150
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
15151
|
-
"div",
|
|
15152
|
-
{
|
|
15153
|
-
style: {
|
|
15154
|
-
top: "calc(100% + 3px)"
|
|
15155
|
-
},
|
|
15156
|
-
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`,
|
|
15157
|
-
children: searchBy?.map((searchItem, index4) => {
|
|
15158
|
-
if (searchItem?.type === "date" || searchItem?.type === "datetime") {
|
|
15159
|
-
if (!validateAndParseDate(searchString, searchItem?.type === "datetime"))
|
|
15160
|
-
return;
|
|
15161
|
-
}
|
|
15162
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
15163
|
-
"button",
|
|
15164
|
-
{
|
|
15165
|
-
onClick: () => {
|
|
15166
|
-
typeof handleAddTagSearch === "function" && handleAddTagSearch({
|
|
15167
|
-
title: searchItem?.title,
|
|
15168
|
-
name: searchItem?.name,
|
|
15169
|
-
value: searchString,
|
|
15170
|
-
domain: searchItem?.filter_domain,
|
|
15171
|
-
operator: searchItem?.operator,
|
|
15172
|
-
type: SearchType.SEARCH,
|
|
15173
|
-
modelType: searchItem?.type,
|
|
15174
|
-
widget: searchItem?.widget,
|
|
15175
|
-
dataIndex: searchItem?.dataIndex
|
|
15176
|
-
});
|
|
15177
|
-
},
|
|
15178
|
-
onMouseEnter: () => typeof handleMouseEnter === "function" && handleMouseEnter(index4),
|
|
15179
|
-
onMouseLeave: () => typeof handleMouseLeave === "function" && handleMouseLeave(),
|
|
15180
|
-
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"}`,
|
|
15181
|
-
children: [
|
|
15182
|
-
t3("search"),
|
|
15183
|
-
" ",
|
|
15184
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "font-bold", children: searchItem?.title }),
|
|
15185
|
-
" ",
|
|
15186
|
-
t3("for"),
|
|
15187
|
-
":",
|
|
15188
|
-
" ",
|
|
15189
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
15190
|
-
"span",
|
|
15191
|
-
{
|
|
15192
|
-
style: {
|
|
15193
|
-
color: "var(--color-primary)"
|
|
15194
|
-
},
|
|
15195
|
-
className: "custom-input-result text-primary font-bold italic",
|
|
15196
|
-
children: searchString
|
|
15197
|
-
}
|
|
15198
|
-
)
|
|
15199
|
-
]
|
|
15200
|
-
},
|
|
15201
|
-
"header-" + index4 + 1
|
|
15202
|
-
);
|
|
15203
|
-
})
|
|
15204
|
-
}
|
|
15205
|
-
);
|
|
15206
|
-
};
|
|
15207
|
-
|
|
15208
15218
|
// src/widgets/advanced/search/search-item/index.tsx
|
|
15209
15219
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
15210
15220
|
var Search = ({
|
|
@@ -15229,7 +15239,11 @@ var Search = ({
|
|
|
15229
15239
|
selectedRowKeys,
|
|
15230
15240
|
domainSearch,
|
|
15231
15241
|
evalJSONContext,
|
|
15232
|
-
clearSearch
|
|
15242
|
+
clearSearch,
|
|
15243
|
+
onKeyDown,
|
|
15244
|
+
handleMouseEnter,
|
|
15245
|
+
handleMouseLeave,
|
|
15246
|
+
hoveredIndexSearchList
|
|
15233
15247
|
}) => {
|
|
15234
15248
|
const { t: t3 } = useI18n();
|
|
15235
15249
|
const [showPopupFilter, setShowPopupFilter] = (0, import_react21.useState)(false);
|
|
@@ -15266,9 +15280,8 @@ var Search = ({
|
|
|
15266
15280
|
const searchDefaults = Object.entries(context || {}).filter(
|
|
15267
15281
|
([key]) => key.startsWith("search_default_")
|
|
15268
15282
|
);
|
|
15269
|
-
const defaultGroupBy = context ? Object.entries(context).filter(([key]) => key.includes("group_by")) : [];
|
|
15270
15283
|
const hasGroupBy = viewData?.views?.search?.filters_by?.length > 0;
|
|
15271
|
-
if (searchDefaults.length === 0 && !hasGroupBy
|
|
15284
|
+
if (searchDefaults.length === 0 && !hasGroupBy) {
|
|
15272
15285
|
setIsReadyFormatDomain(true);
|
|
15273
15286
|
setDidInit(true);
|
|
15274
15287
|
return;
|
|
@@ -15289,23 +15302,7 @@ var Search = ({
|
|
|
15289
15302
|
}
|
|
15290
15303
|
return item;
|
|
15291
15304
|
});
|
|
15292
|
-
const updatedGroupBy = groupBy?.map((item) => {
|
|
15293
|
-
const defaultGroupByItem = defaultGroupBy.find(
|
|
15294
|
-
([_2, value]) => item?.context?.includes(value)
|
|
15295
|
-
);
|
|
15296
|
-
if (defaultGroupByItem && typeof handleAddTagSearch == "function") {
|
|
15297
|
-
handleAddTagSearch({
|
|
15298
|
-
name: item?.name,
|
|
15299
|
-
value: item?.string,
|
|
15300
|
-
type: SearchType.GROUP,
|
|
15301
|
-
context: JSON.parse(item?.context.replace(/'/g, '"'))
|
|
15302
|
-
});
|
|
15303
|
-
return { ...item, active: true };
|
|
15304
|
-
}
|
|
15305
|
-
return item;
|
|
15306
|
-
});
|
|
15307
15305
|
if (updatedFilter) setFilterBy(updatedFilter);
|
|
15308
|
-
if (updatedGroupBy) setGroupBy(updatedGroupBy);
|
|
15309
15306
|
if (hasGroupBy) {
|
|
15310
15307
|
viewData?.views?.search?.filters_by?.forEach((item, idx) => {
|
|
15311
15308
|
const groupCtx = evalJSONContext(item?.context);
|
|
@@ -15327,60 +15324,68 @@ var Search = ({
|
|
|
15327
15324
|
"div",
|
|
15328
15325
|
{
|
|
15329
15326
|
ref: popupFilterRef,
|
|
15330
|
-
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]`,
|
|
15331
15328
|
children: [
|
|
15332
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15353
|
-
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
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: [
|
|
15357
15375
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
15358
|
-
SearchList,
|
|
15359
|
-
{
|
|
15360
|
-
handleAddTagSearch,
|
|
15361
|
-
searchBy,
|
|
15362
|
-
searchString
|
|
15363
|
-
}
|
|
15364
|
-
)
|
|
15365
|
-
] }),
|
|
15366
|
-
showFiltersGroups && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
15367
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
15368
15376
|
"div",
|
|
15369
15377
|
{
|
|
15370
|
-
className: `flex h-full
|
|
15378
|
+
className: `flex h-full cursor-pointer items-center justify-center px-[10px] max-w-fit`,
|
|
15371
15379
|
onClick: (e3) => {
|
|
15372
15380
|
e3.stopPropagation();
|
|
15373
15381
|
setShowPopupFilter((prev2) => !prev2);
|
|
15374
15382
|
},
|
|
15375
|
-
children:
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
}
|
|
15382
|
-
)
|
|
15383
|
-
]
|
|
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
|
+
) })
|
|
15384
15389
|
}
|
|
15385
15390
|
),
|
|
15386
15391
|
showPopupFilter && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|