@spteck/react-controls-v2 2.0.2 → 2.0.4
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/components/DataGridV2/DataGridV2.d.ts.map +1 -1
- package/dist/components/DataGridV2/useDataGridV2Styles.d.ts +2 -0
- package/dist/components/DataGridV2/useDataGridV2Styles.d.ts.map +1 -0
- package/dist/components/appDashboard/AppDashboard.d.ts.map +1 -1
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8589,6 +8589,23 @@ const DataGrid = (props) => {
|
|
|
8589
8589
|
}
|
|
8590
8590
|
) });
|
|
8591
8591
|
};
|
|
8592
|
+
const scrollbarClassName = css$1({
|
|
8593
|
+
"&::-webkit-scrollbar": {
|
|
8594
|
+
width: "5px",
|
|
8595
|
+
height: "5px"
|
|
8596
|
+
},
|
|
8597
|
+
"&::-webkit-scrollbar-track": {
|
|
8598
|
+
background: tokens.colorNeutralBackground4,
|
|
8599
|
+
borderRadius: tokens.borderRadiusMedium
|
|
8600
|
+
},
|
|
8601
|
+
"&::-webkit-scrollbar-thumb": {
|
|
8602
|
+
background: tokens.colorBrandBackground,
|
|
8603
|
+
borderRadius: tokens.borderRadiusMedium
|
|
8604
|
+
},
|
|
8605
|
+
"&::-webkit-scrollbar-thumb:hover": {
|
|
8606
|
+
background: tokens.colorBrandBackgroundHover
|
|
8607
|
+
}
|
|
8608
|
+
});
|
|
8592
8609
|
const DataGridV2 = React.forwardRef((props, ref) => {
|
|
8593
8610
|
const {
|
|
8594
8611
|
columns,
|
|
@@ -8766,7 +8783,7 @@ const DataGridV2 = React.forwardRef((props, ref) => {
|
|
|
8766
8783
|
() => ({ overflowX: "auto", overflowY: "hidden", position: "relative" }),
|
|
8767
8784
|
[]
|
|
8768
8785
|
);
|
|
8769
|
-
return /* @__PURE__ */ jsxs$1("div", { style: hostStyle, children: [
|
|
8786
|
+
return /* @__PURE__ */ jsxs$1("div", { style: hostStyle, className: scrollbarClassName, children: [
|
|
8770
8787
|
isLoadingData && /* @__PURE__ */ jsx$2("div", { style: { display: "flex", gap: 8, alignItems: "center", padding: 8 }, children: React.isValidElement(isLoadingDataMessage) ? isLoadingDataMessage : /* @__PURE__ */ jsxs$1(Spinner, { size: "extra-tiny", children: [
|
|
8771
8788
|
" ",
|
|
8772
8789
|
isLoadingDataMessage ?? "Loading data...",
|
|
@@ -8800,8 +8817,7 @@ const DataGridV2 = React.forwardRef((props, ref) => {
|
|
|
8800
8817
|
listProps: {
|
|
8801
8818
|
onItemsRendered: handleItemsRendered
|
|
8802
8819
|
},
|
|
8803
|
-
className:
|
|
8804
|
-
style: dataGridBodyStyles,
|
|
8820
|
+
className: mergeClasses(scrollbarClassName),
|
|
8805
8821
|
children: (row, style) => (() => {
|
|
8806
8822
|
const item = row.item;
|
|
8807
8823
|
const idx = itemIndexMap.get(item) ?? items.indexOf(item);
|
|
@@ -26825,8 +26841,7 @@ const useDashboardStyles = () => {
|
|
|
26825
26841
|
minHeight: "280px"
|
|
26826
26842
|
}),
|
|
26827
26843
|
cardDescription: css$1({
|
|
26828
|
-
color: `${tokens.colorNeutralForeground2}
|
|
26829
|
-
marginTop: "4px"
|
|
26844
|
+
color: `${tokens.colorNeutralForeground2}`
|
|
26830
26845
|
}),
|
|
26831
26846
|
cardWrapper: css$1({
|
|
26832
26847
|
position: "relative",
|
|
@@ -26864,20 +26879,26 @@ const AppDashboard = ({
|
|
|
26864
26879
|
const layoutCacheKey = `${cacheKeyPrefix}-layout-settings`;
|
|
26865
26880
|
const orderCacheKey = `${cacheKeyPrefix}-card-order`;
|
|
26866
26881
|
const { getCachedData, setCachedData } = useIndexedDBCache();
|
|
26867
|
-
const getData = (key) => getCachedData(key);
|
|
26868
|
-
const setData = (
|
|
26882
|
+
const getData = useCallback((key) => getCachedData(key), [getCachedData]);
|
|
26883
|
+
const setData = useCallback(
|
|
26884
|
+
(key, value) => setCachedData(key, value, CACHE_EXPIRATION_DAYS * 24 * 60),
|
|
26885
|
+
[setCachedData]
|
|
26886
|
+
);
|
|
26869
26887
|
const {
|
|
26870
26888
|
getCachedData: getOrderCachedData,
|
|
26871
26889
|
setCachedData: setOrderCachedData
|
|
26872
26890
|
} = useIndexedDBCache();
|
|
26873
|
-
const getOrderData = (key) => getOrderCachedData(key);
|
|
26874
|
-
const setOrderData = (
|
|
26891
|
+
const getOrderData = useCallback((key) => getOrderCachedData(key), [getOrderCachedData]);
|
|
26892
|
+
const setOrderData = useCallback(
|
|
26893
|
+
(key, value) => setOrderCachedData(key, value, CACHE_EXPIRATION_DAYS * 24 * 60),
|
|
26894
|
+
[setOrderCachedData]
|
|
26895
|
+
);
|
|
26875
26896
|
const [cardContainers, setCardContainers] = useState([]);
|
|
26876
26897
|
const [sizes, setSizes] = useState({});
|
|
26877
26898
|
const dragItem = useRef(null);
|
|
26878
26899
|
const dragOverItem = useRef(null);
|
|
26879
26900
|
const containerRef = useRef(null);
|
|
26880
|
-
|
|
26901
|
+
useEffect(() => {
|
|
26881
26902
|
const initializeData = async () => {
|
|
26882
26903
|
try {
|
|
26883
26904
|
let orderedCards = cards;
|
|
@@ -26929,10 +26950,10 @@ const AppDashboard = ({
|
|
|
26929
26950
|
setSizes(fallbackSizes);
|
|
26930
26951
|
}
|
|
26931
26952
|
};
|
|
26932
|
-
initializeData();
|
|
26933
|
-
}, [cards, enableCache, layoutCacheKey, orderCacheKey]);
|
|
26953
|
+
void initializeData();
|
|
26954
|
+
}, [cards, enableCache, layoutCacheKey, orderCacheKey, getData, getOrderData]);
|
|
26934
26955
|
useEffect(() => {
|
|
26935
|
-
if (!enableCache) return;
|
|
26956
|
+
if (!enableCache || Object.keys(sizes).length === 0) return;
|
|
26936
26957
|
const saveSizesToCache = async () => {
|
|
26937
26958
|
try {
|
|
26938
26959
|
await setData(layoutCacheKey, sizes);
|
|
@@ -26940,12 +26961,10 @@ const AppDashboard = ({
|
|
|
26940
26961
|
console.warn("Failed to save dashboard layout to cache:", error);
|
|
26941
26962
|
}
|
|
26942
26963
|
};
|
|
26943
|
-
|
|
26944
|
-
saveSizesToCache();
|
|
26945
|
-
}
|
|
26964
|
+
void saveSizesToCache();
|
|
26946
26965
|
}, [sizes, enableCache, layoutCacheKey, setData]);
|
|
26947
26966
|
useEffect(() => {
|
|
26948
|
-
if (!enableCache) return;
|
|
26967
|
+
if (!enableCache || cardContainers.length === 0) return;
|
|
26949
26968
|
const saveOrderToCache = async () => {
|
|
26950
26969
|
try {
|
|
26951
26970
|
const cardOrder = cardContainers.map((card) => card.id);
|
|
@@ -26954,9 +26973,7 @@ const AppDashboard = ({
|
|
|
26954
26973
|
console.warn("Failed to save dashboard order to cache:", error);
|
|
26955
26974
|
}
|
|
26956
26975
|
};
|
|
26957
|
-
|
|
26958
|
-
saveOrderToCache();
|
|
26959
|
-
}
|
|
26976
|
+
void saveOrderToCache();
|
|
26960
26977
|
}, [cardContainers, enableCache, orderCacheKey, setOrderData]);
|
|
26961
26978
|
useEffect(() => {
|
|
26962
26979
|
if (containerWidth <= MINIMUM_DASHBOARD_WIDTH) {
|
|
@@ -27029,21 +27046,16 @@ const AppDashboard = ({
|
|
|
27029
27046
|
return cardContainers.map((cardContainer, idx) => {
|
|
27030
27047
|
var _a3, _b2, _c2, _d2;
|
|
27031
27048
|
const shouldShowZoom = cardContainer.showZoom !== false && showZoom;
|
|
27032
|
-
|
|
27033
|
-
|
|
27034
|
-
|
|
27035
|
-
|
|
27036
|
-
|
|
27037
|
-
|
|
27038
|
-
|
|
27039
|
-
|
|
27040
|
-
|
|
27041
|
-
|
|
27042
|
-
IsOpen: false,
|
|
27043
|
-
onChange: (v) => handleZoomSelect(cardContainer.id, v)
|
|
27044
|
-
}
|
|
27045
|
-
);
|
|
27046
|
-
}
|
|
27049
|
+
const headerAction = cardContainer.headerAction || (shouldShowZoom ? /* @__PURE__ */ jsx$2(
|
|
27050
|
+
SelectZoom,
|
|
27051
|
+
{
|
|
27052
|
+
values: sizes[cardContainer.id] || defaultColsAndRowSpanBasedOnNumberColumns[cardContainer.id] || { spanCols: 1, spanRows: 1 },
|
|
27053
|
+
maxCols: maxZoom,
|
|
27054
|
+
maxRows: maxSpanRows,
|
|
27055
|
+
IsOpen: false,
|
|
27056
|
+
onChange: (v) => handleZoomSelect(cardContainer.id, v)
|
|
27057
|
+
}
|
|
27058
|
+
) : void 0);
|
|
27047
27059
|
return /* @__PURE__ */ jsx$2(
|
|
27048
27060
|
"div",
|
|
27049
27061
|
{
|
|
@@ -27062,7 +27074,7 @@ const AppDashboard = ({
|
|
|
27062
27074
|
/* @__PURE__ */ jsx$2(
|
|
27063
27075
|
CardHeader,
|
|
27064
27076
|
{
|
|
27065
|
-
header: /* @__PURE__ */ jsxs$1("
|
|
27077
|
+
header: /* @__PURE__ */ jsxs$1(StackV2, { gap: "0px", children: [
|
|
27066
27078
|
/* @__PURE__ */ jsx$2(Text, { weight: "semibold", size: 400, children: cardContainer.cardTitle }),
|
|
27067
27079
|
cardContainer.cardDescription && /* @__PURE__ */ jsx$2(Text, { className: styles2.cardDescription, size: 200, children: cardContainer.cardDescription })
|
|
27068
27080
|
] }),
|