sevago-library 1.3.19 → 1.4.0
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/CHANGELOG.md +6 -0
- package/dist/index.cjs.js +95 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +96 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/elements/filters/filter-slider/filter-slider.component.d.ts +24 -0
- package/dist/src/components/elements/filters/filter-slider/filter-slider.component.stories.d.ts +8 -0
- package/dist/src/components/elements/filters/index.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -68785,7 +68785,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
68785
68785
|
const TextFieldDateTimeElement = ({
|
|
68786
68786
|
name,
|
|
68787
68787
|
label = "",
|
|
68788
|
-
iconLabel = "
|
|
68788
|
+
iconLabel = "",
|
|
68789
68789
|
icon = "calendar_today",
|
|
68790
68790
|
error = "",
|
|
68791
68791
|
value = null,
|
|
@@ -75949,6 +75949,99 @@ const AdvancedOperatorFilterDialog = ({
|
|
|
75949
75949
|
}
|
|
75950
75950
|
);
|
|
75951
75951
|
};
|
|
75952
|
+
const FilterSlider = ({
|
|
75953
|
+
children,
|
|
75954
|
+
onApply,
|
|
75955
|
+
onReset,
|
|
75956
|
+
initialFilters = {},
|
|
75957
|
+
sx = {},
|
|
75958
|
+
ignoredKeysInCount = []
|
|
75959
|
+
}) => {
|
|
75960
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
75961
|
+
const [filters, setFilters] = React.useState(initialFilters);
|
|
75962
|
+
const [tempFilters, setTempFilters] = React.useState(initialFilters);
|
|
75963
|
+
const activeFilterCount = Object.entries(filters).filter(([key, value]) => {
|
|
75964
|
+
if (ignoredKeysInCount.includes(key)) return false;
|
|
75965
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
75966
|
+
return value !== null && value !== void 0 && value !== "";
|
|
75967
|
+
}).length;
|
|
75968
|
+
React.useEffect(() => {
|
|
75969
|
+
if (isOpen) {
|
|
75970
|
+
setTempFilters({ ...filters });
|
|
75971
|
+
}
|
|
75972
|
+
}, [filters, isOpen]);
|
|
75973
|
+
const handleFilterChange = (key, value) => {
|
|
75974
|
+
setTempFilters((prev) => ({
|
|
75975
|
+
...prev,
|
|
75976
|
+
[key]: value
|
|
75977
|
+
}));
|
|
75978
|
+
};
|
|
75979
|
+
const handleApply = () => {
|
|
75980
|
+
setFilters(tempFilters);
|
|
75981
|
+
onApply == null ? void 0 : onApply(tempFilters);
|
|
75982
|
+
setIsOpen(false);
|
|
75983
|
+
};
|
|
75984
|
+
const handleReset = () => {
|
|
75985
|
+
setTempFilters({});
|
|
75986
|
+
setFilters({});
|
|
75987
|
+
onReset == null ? void 0 : onReset();
|
|
75988
|
+
setIsOpen(false);
|
|
75989
|
+
};
|
|
75990
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
75991
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
75992
|
+
ButtonElement,
|
|
75993
|
+
{
|
|
75994
|
+
sx: {
|
|
75995
|
+
...sx,
|
|
75996
|
+
color: activeFilterCount > 0 ? PRIMARY[500] : PRIMARY[500],
|
|
75997
|
+
minWidth: "auto",
|
|
75998
|
+
p: PADDING_LAYOUT_HEADER
|
|
75999
|
+
},
|
|
76000
|
+
startIcon: "filter_list_alt",
|
|
76001
|
+
variant: "outlined",
|
|
76002
|
+
onClick: () => setIsOpen(true),
|
|
76003
|
+
content: `Bộ lọc${activeFilterCount > 0 ? ` (${activeFilterCount})` : ""}`
|
|
76004
|
+
}
|
|
76005
|
+
),
|
|
76006
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
76007
|
+
material.Drawer,
|
|
76008
|
+
{
|
|
76009
|
+
anchor: "right",
|
|
76010
|
+
open: isOpen,
|
|
76011
|
+
onClose: () => setIsOpen(false),
|
|
76012
|
+
sx: {
|
|
76013
|
+
"& .MuiDrawer-paper": {
|
|
76014
|
+
width: 320,
|
|
76015
|
+
padding: PADDING_GAP_LAYOUT
|
|
76016
|
+
}
|
|
76017
|
+
},
|
|
76018
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(system.Stack, { sx: { height: "100%" }, children: [
|
|
76019
|
+
/* @__PURE__ */ jsxRuntime.jsxs(StackRowAlignCenterJustBetween, { sx: { gap: 0 }, children: [
|
|
76020
|
+
/* @__PURE__ */ jsxRuntime.jsx(TypographyOneLine, { content: "Bộ lọc", sx: { ...TYPOGRAPHY.textLg.semiBold } }),
|
|
76021
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: () => setIsOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(IconElement, { icon: "close" }) })
|
|
76022
|
+
] }),
|
|
76023
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
76024
|
+
system.Stack,
|
|
76025
|
+
{
|
|
76026
|
+
sx: {
|
|
76027
|
+
flex: 1,
|
|
76028
|
+
gap: PADDING_GAP_ITEM,
|
|
76029
|
+
overflowY: "auto",
|
|
76030
|
+
scrollbarWidth: "none",
|
|
76031
|
+
"&::-webkit-scrollbar": { display: "none" }
|
|
76032
|
+
},
|
|
76033
|
+
children: children({ filters, tempFilters, setFilter: handleFilterChange, setTempFilters })
|
|
76034
|
+
}
|
|
76035
|
+
),
|
|
76036
|
+
/* @__PURE__ */ jsxRuntime.jsxs(StackRowJustEnd, { sx: { gap: PADDING_GAP_ITEM }, children: [
|
|
76037
|
+
/* @__PURE__ */ jsxRuntime.jsx(ButtonElement, { variant: "outlined", onClick: handleReset, content: "Đặt lại" }),
|
|
76038
|
+
/* @__PURE__ */ jsxRuntime.jsx(ButtonElement, { variant: "contained", onClick: handleApply, content: "Cập nhật" })
|
|
76039
|
+
] })
|
|
76040
|
+
] })
|
|
76041
|
+
}
|
|
76042
|
+
)
|
|
76043
|
+
] });
|
|
76044
|
+
};
|
|
75952
76045
|
const ListIconContentElement = ({
|
|
75953
76046
|
titleNode,
|
|
75954
76047
|
list,
|
|
@@ -79084,6 +79177,7 @@ exports.Environment = Environment;
|
|
|
79084
79177
|
exports.FIELD_WIDTH = FIELD_WIDTH;
|
|
79085
79178
|
exports.FULL_OPERATOR_OPTIONS = FULL_OPERATOR_OPTIONS;
|
|
79086
79179
|
exports.FilterOperator = FilterOperator;
|
|
79180
|
+
exports.FilterSlider = FilterSlider;
|
|
79087
79181
|
exports.GROUP_ICONS = GROUP_ICONS;
|
|
79088
79182
|
exports.HttpStatusSpecial = HttpStatusSpecial;
|
|
79089
79183
|
exports.ICONS = ICONS;
|