ar-design 0.2.23 → 0.2.25
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.
|
@@ -220,7 +220,10 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
220
220
|
React.createElement("div", { className: "title" },
|
|
221
221
|
React.createElement("h3", null, title),
|
|
222
222
|
React.createElement("h5", null, description)),
|
|
223
|
-
React.createElement("div", null
|
|
223
|
+
React.createElement("div", { className: "actions" }, actions && (React.createElement(React.Fragment, null,
|
|
224
|
+
actions.create && (React.createElement(Button, { variant: "outlined", status: "dark", icon: { element: React.createElement(ARIcon, { icon: "Add", size: 16 }) }, tooltip: { text: actions.create.tooltip, direction: "top" }, onClick: actions.create.onClick })),
|
|
225
|
+
actions.import && (React.createElement(Button, { variant: "outlined", status: "dark", icon: { element: React.createElement(ARIcon, { icon: "Import", size: 16 }) }, tooltip: { text: actions.import.tooltip, direction: "top" }, onClick: actions.import.onClick })),
|
|
226
|
+
actions.filterClear && (React.createElement(Button, { variant: "outlined", status: "dark", icon: { element: React.createElement(ARIcon, { icon: "Trash", size: 16 }) }, tooltip: { text: actions.filterClear.tooltip, direction: "top" }, onClick: actions.filterClear.onClick }))))))),
|
|
224
227
|
React.createElement("div", { ref: _tableContent, className: "content", onScroll: handleScroll },
|
|
225
228
|
React.createElement("table", { ref: ref },
|
|
226
229
|
React.createElement("thead", null,
|
|
@@ -250,7 +253,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
250
253
|
className: `${_className.map((c) => c).join(" ")}`,
|
|
251
254
|
}), ...(c.config?.width
|
|
252
255
|
? {
|
|
253
|
-
style: { minWidth: c.config.width },
|
|
256
|
+
style: { minWidth: c.config.width, maxWidth: c.config.width },
|
|
254
257
|
}
|
|
255
258
|
: // : { style: { maxWidth: thWidths[cIndex], minWidth: thWidths[cIndex] } })}
|
|
256
259
|
{ style: {} }), ...(c.config?.sticky && {
|
|
@@ -315,7 +318,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
315
318
|
className: `${_className.map((c) => c).join(" ")}`,
|
|
316
319
|
}), ...(c.config?.width
|
|
317
320
|
? {
|
|
318
|
-
style: { minWidth: c.config.width },
|
|
321
|
+
style: { minWidth: c.config.width, maxWidth: c.config.width },
|
|
319
322
|
}
|
|
320
323
|
: // : {
|
|
321
324
|
// style: { maxWidth: thWidths[cIndex], minWidth: thWidths[cIndex] },
|
|
@@ -342,5 +345,6 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
342
345
|
} })))));
|
|
343
346
|
});
|
|
344
347
|
export default memo(Table, (prevProps, nextProps) => {
|
|
345
|
-
return JSON.stringify(prevProps.data) === JSON.stringify(nextProps.data)
|
|
348
|
+
return (JSON.stringify(prevProps.data) === JSON.stringify(nextProps.data) &&
|
|
349
|
+
JSON.stringify(prevProps.columns) === JSON.stringify(nextProps.columns));
|
|
346
350
|
});
|
|
@@ -28,15 +28,18 @@ const Popover = ({ children, title, message, content, onConfirm, windowBlur, con
|
|
|
28
28
|
const popoverRect = _arPopover.current.getBoundingClientRect();
|
|
29
29
|
const elementRect = _arPopoverElement.current.getBoundingClientRect();
|
|
30
30
|
if (elementRect) {
|
|
31
|
-
const
|
|
31
|
+
const screenCenterX = window.innerWidth / 2;
|
|
32
|
+
const screenCenterY = window.innerHeight / 2;
|
|
32
33
|
const sx = window.scrollX || document.documentElement.scrollLeft;
|
|
33
34
|
const sy = window.scrollY || document.documentElement.scrollTop;
|
|
34
35
|
_arPopover.current.style.visibility = "visible";
|
|
35
36
|
_arPopover.current.style.opacity = "1";
|
|
36
|
-
_arPopover.current.style.top = `${(elementRect.top >
|
|
37
|
+
_arPopover.current.style.top = `${(elementRect.top > screenCenterY
|
|
37
38
|
? elementRect.top - popoverRect.height + elementRect.height
|
|
38
39
|
: elementRect.top) + sy}px`;
|
|
39
|
-
_arPopover.current.style.left = `${elementRect.left
|
|
40
|
+
_arPopover.current.style.left = `${(elementRect.left > screenCenterX
|
|
41
|
+
? elementRect.right - (elementRect.width + 7.5) - popoverRect.width
|
|
42
|
+
: elementRect.left + elementRect.width + 7.5) + sx}px`;
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
};
|
|
@@ -8,7 +8,7 @@ const Switch = ({ label, status = "primary", border = { radius: "pill" }, ...att
|
|
|
8
8
|
const _switchClassName = ["ar-switch"];
|
|
9
9
|
// states
|
|
10
10
|
const [checked, setChecked] = useState(attributes.checked ?? false);
|
|
11
|
-
_switchClassName.push(...Utils.GetClassName("filled", checked ? status : "light", border, undefined, undefined, attributes.className));
|
|
11
|
+
_switchClassName.push(...Utils.GetClassName("filled", attributes.checked ? status : "light", border, undefined, undefined, attributes.className));
|
|
12
12
|
// useEffects
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
setChecked(attributes.checked ?? false);
|