ar-design 0.4.31 → 0.4.32
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/assets/css/components/navigation/menu/styles.css +19 -1
- package/dist/components/data-display/table/PropertiesPopup.d.ts +4 -1
- package/dist/components/data-display/table/PropertiesPopup.js +18 -14
- package/dist/components/data-display/table/THeadCell.d.ts +4 -1
- package/dist/components/data-display/table/THeadCell.js +4 -2
- package/dist/components/data-display/table/index.js +11 -5
- package/package.json +1 -1
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
> ul {
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
9
|
+
gap: 1rem;
|
|
9
10
|
padding: 0;
|
|
10
11
|
margin: 0;
|
|
11
12
|
list-style: none;
|
|
12
13
|
|
|
13
14
|
li {
|
|
14
15
|
list-style: none;
|
|
16
|
+
height: 2rem;
|
|
15
17
|
|
|
16
18
|
> ul.submenu {
|
|
17
19
|
display: grid;
|
|
@@ -19,7 +21,10 @@
|
|
|
19
21
|
margin-left: 1.5rem;
|
|
20
22
|
opacity: 0;
|
|
21
23
|
transform: translateY(-4px);
|
|
22
|
-
transition:
|
|
24
|
+
transition:
|
|
25
|
+
grid-template-rows 250ms ease,
|
|
26
|
+
opacity 200ms ease,
|
|
27
|
+
transform 200ms ease;
|
|
23
28
|
overflow: hidden;
|
|
24
29
|
|
|
25
30
|
> .submenu-inner {
|
|
@@ -40,6 +45,8 @@
|
|
|
40
45
|
display: flex;
|
|
41
46
|
align-items: center;
|
|
42
47
|
gap: 0.5rem;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: inherit;
|
|
43
50
|
padding: 0.3rem;
|
|
44
51
|
white-space: nowrap;
|
|
45
52
|
cursor: pointer;
|
|
@@ -85,6 +92,17 @@
|
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
|
|
95
|
+
> .item {
|
|
96
|
+
width: 100%;
|
|
97
|
+
height: inherit;
|
|
98
|
+
|
|
99
|
+
> * {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
height: inherit;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
88
106
|
> .angel-down {
|
|
89
107
|
position: absolute;
|
|
90
108
|
right: 0.5rem;
|
|
@@ -17,11 +17,14 @@ interface IProps<T> {
|
|
|
17
17
|
currentColumn: TableColumnType<T> | null;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
+
methods: {
|
|
21
|
+
handleScroll: () => void;
|
|
22
|
+
};
|
|
20
23
|
coordinate: {
|
|
21
24
|
x: number;
|
|
22
25
|
y: number;
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
|
-
declare function PropertiesPopup<T extends object>({ refs, states, coordinate }: IProps<T>): false | React.ReactPortal;
|
|
28
|
+
declare function PropertiesPopup<T extends object>({ refs, states, methods, coordinate }: IProps<T>): false | React.ReactPortal;
|
|
26
29
|
declare const _default: typeof PropertiesPopup;
|
|
27
30
|
export default _default;
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import React, { memo,
|
|
2
|
+
import React, { memo, useEffect, useMemo, useRef } from "react";
|
|
3
3
|
import ReactDOM from "react-dom";
|
|
4
4
|
import { ARIcon } from "../../icons";
|
|
5
5
|
import { ExtractKey } from "./Helpers";
|
|
6
|
-
function PropertiesPopup({ refs, states, coordinate }) {
|
|
6
|
+
function PropertiesPopup({ refs, states, methods, coordinate }) {
|
|
7
7
|
// refs
|
|
8
8
|
const _arTablePropertiesPopup = useRef(null);
|
|
9
9
|
// methods
|
|
10
|
-
const handleClickOutSide =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
}, []);
|
|
10
|
+
const handleClickOutSide = (event) => {
|
|
11
|
+
const target = event.target;
|
|
12
|
+
const clickedInsidePopup = _arTablePropertiesPopup.current && _arTablePropertiesPopup.current.contains(target);
|
|
13
|
+
const isOneOfButtons = target.closest('[data-properties-button="true"]');
|
|
14
|
+
if (!clickedInsidePopup && !isOneOfButtons)
|
|
15
|
+
handleClose();
|
|
16
|
+
};
|
|
19
17
|
const handleSort = useMemo(() => {
|
|
20
18
|
return (columnKey, direction) => {
|
|
21
19
|
if (!columnKey)
|
|
@@ -31,10 +29,16 @@ function PropertiesPopup({ refs, states, coordinate }) {
|
|
|
31
29
|
const handleKeys = (event) => {
|
|
32
30
|
const key = event.key;
|
|
33
31
|
if (key === "Escape")
|
|
34
|
-
|
|
32
|
+
handleClose();
|
|
33
|
+
};
|
|
34
|
+
const handleOpen = () => {
|
|
35
|
+
states.open.set(true);
|
|
36
|
+
methods.handleScroll();
|
|
37
|
+
};
|
|
38
|
+
const handleClose = () => {
|
|
39
|
+
states.open.set(false);
|
|
40
|
+
methods.handleScroll();
|
|
35
41
|
};
|
|
36
|
-
const handleOpen = () => states.open.set(true);
|
|
37
|
-
const handleClose = () => states.open.set(false);
|
|
38
42
|
// useEffects
|
|
39
43
|
useEffect(() => {
|
|
40
44
|
refs.buttons.current.map((button) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { Dispatch, SetStateAction } from "react";
|
|
2
2
|
import { TableColumnType } from "../../../libs/types";
|
|
3
3
|
import { Config, Sort } from "./IProps";
|
|
4
|
-
declare const MemoizedTHeadCell: <T>({ refs, states, columns, config, }: {
|
|
4
|
+
declare const MemoizedTHeadCell: <T>({ refs, states, methods, columns, config, }: {
|
|
5
5
|
refs: {
|
|
6
6
|
propertiesButton: React.MutableRefObject<(HTMLSpanElement | null)[]>;
|
|
7
7
|
};
|
|
@@ -24,6 +24,9 @@ declare const MemoizedTHeadCell: <T>({ refs, states, columns, config, }: {
|
|
|
24
24
|
}>>;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
+
methods: {
|
|
28
|
+
handleScroll: () => void;
|
|
29
|
+
};
|
|
27
30
|
columns: TableColumnType<T>[];
|
|
28
31
|
config: Config<T>;
|
|
29
32
|
}) => React.JSX.Element;
|
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
|
2
2
|
import Button from "../../form/button";
|
|
3
3
|
import { ARIcon } from "../../icons";
|
|
4
4
|
import { ExtractKey } from "./Helpers";
|
|
5
|
-
const MemoizedTHeadCell = function ({ refs, states, columns, config, }) {
|
|
5
|
+
const MemoizedTHeadCell = function ({ refs, states, methods, columns, config, }) {
|
|
6
6
|
return (React.createElement(React.Fragment, null, columns.map((c, cIndex) => {
|
|
7
7
|
const { isProperties = true } = c.config ?? {};
|
|
8
8
|
const _direction = states.sort.get.find((s) => s.key === c.key)?.direction;
|
|
@@ -30,7 +30,8 @@ const MemoizedTHeadCell = function ({ refs, states, columns, config, }) {
|
|
|
30
30
|
_direction === "asc" && React.createElement(ARIcon, { icon: "ArrowUp" }),
|
|
31
31
|
_direction === "desc" && React.createElement(ARIcon, { icon: "ArrowDown" }))),
|
|
32
32
|
c.title),
|
|
33
|
-
config.isProperties && isProperties && (React.createElement("span", { ref: (element) => (refs.propertiesButton.current[cIndex] = element), className: "properties-field", onClick: (event) => {
|
|
33
|
+
config.isProperties && isProperties && (React.createElement("span", { ref: (element) => (refs.propertiesButton.current[cIndex] = element), className: "properties-field", "data-properties-button": "true", onClick: (event) => {
|
|
34
|
+
event.preventDefault();
|
|
34
35
|
event.stopPropagation();
|
|
35
36
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
36
37
|
const screenCenterX = window.innerWidth / 2;
|
|
@@ -49,6 +50,7 @@ const MemoizedTHeadCell = function ({ refs, states, columns, config, }) {
|
|
|
49
50
|
return prev;
|
|
50
51
|
});
|
|
51
52
|
states.open.set(true);
|
|
53
|
+
methods.handleScroll();
|
|
52
54
|
} },
|
|
53
55
|
React.createElement(Button, { variant: "borderless", icon: {
|
|
54
56
|
element: React.createElement(ARIcon, { size: 16, icon: "ThreeDotsVertical", fill: "var(--dark)", strokeWidth: 0 }),
|
|
@@ -380,6 +380,7 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
380
380
|
const indexOfFirstRow = indexOfLastRow - selectedPerPage;
|
|
381
381
|
_data = _data.slice(indexOfFirstRow, indexOfLastRow);
|
|
382
382
|
}
|
|
383
|
+
handleScroll();
|
|
383
384
|
return _data;
|
|
384
385
|
}, [data, searchedText, currentPage, selectedPerPage, sortConfig, config.isServerSide]);
|
|
385
386
|
// useEffects
|
|
@@ -559,7 +560,6 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
559
560
|
_tBody.current.ondragover = null;
|
|
560
561
|
};
|
|
561
562
|
}, [data]);
|
|
562
|
-
useLayoutEffect(() => handleScroll(), [data]);
|
|
563
563
|
useLayoutEffect(() => {
|
|
564
564
|
if (!pagination?.currentPage)
|
|
565
565
|
return;
|
|
@@ -603,7 +603,7 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
603
603
|
sort: { get: sortConfig, set: setSortConfig },
|
|
604
604
|
sortCurrentColumn: { set: setSortCurrentColumn },
|
|
605
605
|
propertiesButtonCoordinate: { set: setPropertiesButtonCoordinate },
|
|
606
|
-
}, columns: columns, config: config })),
|
|
606
|
+
}, methods: { handleScroll }, columns: columns, config: config })),
|
|
607
607
|
config?.isSearchable && (React.createElement("tr", { key: "isSearchable" },
|
|
608
608
|
selections && (React.createElement("th", { key: `column-selections`, className: "selection-col sticky-left", "data-sticky-position": "left" })),
|
|
609
609
|
columns.map((c, cIndex) => {
|
|
@@ -624,9 +624,14 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
624
624
|
className: `${_className.map((c) => c).join(" ")}`,
|
|
625
625
|
}), ...(c.config?.sticky && {
|
|
626
626
|
"data-sticky-position": c.config.sticky,
|
|
627
|
-
}) }, c.key && (React.createElement("div", { className: "filter-field" }, c.filterDataType === "date" ? (React.createElement(DatePicker, { value: (config.isServerSide ? ssrValue : csrValue) ?? "", name: key,
|
|
628
|
-
|
|
627
|
+
}) }, c.key && (React.createElement("div", { className: "filter-field" }, c.filterDataType === "date" ? (React.createElement(DatePicker, { value: (config.isServerSide ? ssrValue : csrValue) ?? "", name: key, onClick: () => {
|
|
628
|
+
handleScroll();
|
|
629
|
+
}, onChange: (value) => handleSearch(key, value, c.filterDataType), style: { height: "2rem" }, config: { isClock: true, isFooterButton: true, locale: config.locale }, disabled: !c.key || !!c.filters })) : (React.createElement(React.Fragment, null,
|
|
630
|
+
React.createElement(Input, { ref: (element) => (_searchTextInputs.current[cIndex] = element), variant: c.key && !c.filters ? "outlined" : "filled", style: { height: "2rem" }, value: (config.isServerSide ? ssrValue : csrValue) ?? "", name: key, onClick: () => {
|
|
631
|
+
handleScroll();
|
|
632
|
+
}, onInput: (event) => handleSearch(event.currentTarget.name, event.currentTarget.value), disabled: !c.key || !!c.filters }),
|
|
629
633
|
React.createElement("span", { ref: (element) => (_filterButton.current[cIndex] = element), onClick: (event) => {
|
|
634
|
+
event.preventDefault();
|
|
630
635
|
event.stopPropagation();
|
|
631
636
|
// Temizlik...
|
|
632
637
|
setFilterPopupOptionSearchText("");
|
|
@@ -648,6 +653,7 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
648
653
|
setFilterCurrentIndex(cIndex);
|
|
649
654
|
setOpenFilter(true);
|
|
650
655
|
handleFilterPopupContent(c, c.filterDataType ?? dataType, cIndex);
|
|
656
|
+
handleScroll();
|
|
651
657
|
} },
|
|
652
658
|
React.createElement(Button, { variant: "borderless", icon: {
|
|
653
659
|
element: React.createElement(ARIcon, { size: 24, icon: "Filter", fill: "var(--dark)", strokeWidth: 0 }),
|
|
@@ -676,7 +682,7 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
676
682
|
}, states: {
|
|
677
683
|
open: { get: openProperties, set: setOpenProperties },
|
|
678
684
|
sort: { get: sortConfig, set: setSortConfig, currentColumn: sortCurrentColumn },
|
|
679
|
-
}, coordinate: propertiesButtonCoordinate })),
|
|
685
|
+
}, methods: { handleScroll }, coordinate: propertiesButtonCoordinate })),
|
|
680
686
|
React.createElement("div", { className: "footer" },
|
|
681
687
|
React.createElement("span", null, isMobile ? (React.createElement(React.Fragment, null,
|
|
682
688
|
React.createElement("strong", null,
|