ar-design 0.4.28 → 0.4.30
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/data-display/calendar/Body.d.ts +4 -3
- package/dist/components/data-display/calendar/Body.js +2 -2
- package/dist/components/data-display/calendar/IProps.d.ts +3 -2
- package/dist/components/data-display/calendar/index.d.ts +4 -1
- package/dist/components/data-display/calendar/index.js +2 -2
- package/dist/components/data-display/calendar/views/Week.d.ts +4 -3
- package/dist/components/data-display/calendar/views/Week.js +4 -18
- package/dist/components/data-display/table/index.js +2 -2
- package/dist/libs/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "../../../libs/types";
|
|
3
3
|
import { CalendarEvent } from "./IProps";
|
|
4
|
-
interface IProps {
|
|
5
|
-
data: CalendarEvent[];
|
|
4
|
+
interface IProps<T> {
|
|
5
|
+
data: (T & CalendarEvent)[];
|
|
6
|
+
renderItem: (item: T, index: number) => React.JSX.Element;
|
|
6
7
|
states: {
|
|
7
8
|
currentDate: {
|
|
8
9
|
get: Date;
|
|
@@ -17,5 +18,5 @@ interface IProps {
|
|
|
17
18
|
locale?: Intl.LocalesArgument;
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
|
-
declare const Body: ({ data, states, config }: IProps) => React.JSX.Element;
|
|
21
|
+
declare const Body: <T>({ data, renderItem, states, config }: IProps<T>) => React.JSX.Element;
|
|
21
22
|
export default Body;
|
|
@@ -2,11 +2,11 @@ import React from "react";
|
|
|
2
2
|
import Day from "./views/Day";
|
|
3
3
|
import Week from "./views/Week";
|
|
4
4
|
import Month from "./views/Month";
|
|
5
|
-
const Body = ({ data, states, config })
|
|
5
|
+
const Body = function ({ data, renderItem, states, config }) {
|
|
6
6
|
if (states.view.get === "Day")
|
|
7
7
|
return React.createElement(Day, null);
|
|
8
8
|
else if (states.view.get === "Week")
|
|
9
|
-
return React.createElement(Week, { data: data, states: { currentDate: states.currentDate }, config: config });
|
|
9
|
+
return React.createElement(Week, { data: data, renderItem: renderItem, states: { currentDate: states.currentDate }, config: config });
|
|
10
10
|
else if (states.view.get === "Month")
|
|
11
11
|
return React.createElement(Month, null);
|
|
12
12
|
return React.createElement(React.Fragment, null, "...");
|
|
@@ -2,8 +2,9 @@ export type CalendarEvent = {
|
|
|
2
2
|
start: Date;
|
|
3
3
|
end: Date;
|
|
4
4
|
};
|
|
5
|
-
interface IProps {
|
|
6
|
-
data: CalendarEvent[];
|
|
5
|
+
interface IProps<T> {
|
|
6
|
+
data: (T & CalendarEvent)[];
|
|
7
|
+
renderItem: (item: T, index: number) => React.JSX.Element;
|
|
7
8
|
config?: {
|
|
8
9
|
locale?: Intl.LocalesArgument;
|
|
9
10
|
weekStartsOn?: number;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import IProps from "./IProps";
|
|
3
3
|
import "../../../assets/css/components/data-display/calendar/styles.css";
|
|
4
|
-
declare const Calendar:
|
|
4
|
+
declare const Calendar: {
|
|
5
|
+
<T>({ data, renderItem, config }: IProps<T>): React.JSX.Element;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
5
8
|
export default Calendar;
|
|
@@ -3,7 +3,7 @@ import React, { useState } from "react";
|
|
|
3
3
|
import Body from "./Body";
|
|
4
4
|
import Header from "./Header";
|
|
5
5
|
import "../../../assets/css/components/data-display/calendar/styles.css";
|
|
6
|
-
const Calendar = ({ data, config })
|
|
6
|
+
const Calendar = function ({ data, renderItem, config }) {
|
|
7
7
|
// states
|
|
8
8
|
const [currentDate, setCurrentDate] = useState(new Date());
|
|
9
9
|
const [view, setView] = useState("Week");
|
|
@@ -15,7 +15,7 @@ const Calendar = ({ data, config }) => {
|
|
|
15
15
|
set: setView,
|
|
16
16
|
},
|
|
17
17
|
}, config: config }),
|
|
18
|
-
React.createElement(Body, { data: data, states: {
|
|
18
|
+
React.createElement(Body, { data: data, renderItem: renderItem, states: {
|
|
19
19
|
currentDate: { get: currentDate, set: setCurrentDate },
|
|
20
20
|
view: {
|
|
21
21
|
get: view,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CalendarEvent } from "../IProps";
|
|
3
|
-
interface IProps {
|
|
4
|
-
data: CalendarEvent[];
|
|
3
|
+
interface IProps<T> {
|
|
4
|
+
data: (T & CalendarEvent)[];
|
|
5
|
+
renderItem: (item: T, index: number) => React.JSX.Element;
|
|
5
6
|
states: {
|
|
6
7
|
currentDate: {
|
|
7
8
|
get: Date;
|
|
@@ -13,5 +14,5 @@ interface IProps {
|
|
|
13
14
|
weekStartsOn?: number;
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
|
-
declare const Week: ({ data, states, config }: IProps) => React.JSX.Element;
|
|
17
|
+
declare const Week: <T>({ data, renderItem, states, config }: IProps<T>) => React.JSX.Element;
|
|
17
18
|
export default Week;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
const Week = ({ data, states, config })
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
const Week = function ({ data, renderItem, states, config }) {
|
|
3
3
|
const startHour = 0;
|
|
4
4
|
const endHour = 24;
|
|
5
5
|
const hours = endHour - startHour;
|
|
6
6
|
const cellHeight = 60;
|
|
7
|
-
const [events, setEvents] = useState([]);
|
|
8
7
|
const weekDays = useMemo(() => getWeekDays(states.currentDate.get, config?.weekStartsOn ?? 1), [states.currentDate.get, config?.weekStartsOn]);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
setEvents(data);
|
|
11
|
-
}, [data]);
|
|
12
8
|
return (React.createElement("div", { className: "ar-calendar-week-view" },
|
|
13
9
|
React.createElement("div", { className: "head" }, weekDays.map((day) => (React.createElement("div", { key: day.toISOString(), className: "item", style: { flex: 1, textAlign: "center" } },
|
|
14
10
|
React.createElement("span", { className: "day-name" }, day.toLocaleString(config?.locale ?? "tr", { weekday: "short" }).toUpperCase()),
|
|
@@ -20,7 +16,7 @@ const Week = ({ data, states, config }) => {
|
|
|
20
16
|
":00"))))),
|
|
21
17
|
React.createElement("div", { role: "grid", className: "grid" },
|
|
22
18
|
Array.from({ length: hours }).map((_, rowIndex) => (React.createElement("div", { key: rowIndex, className: "row" }, weekDays.map((_, colIndex) => (React.createElement("div", { key: colIndex, className: "cell" })))))),
|
|
23
|
-
React.createElement("div", { className: "events-layer" },
|
|
19
|
+
React.createElement("div", { className: "events-layer" }, data.flatMap((event, eventIdx) => {
|
|
24
20
|
const eventColor = getColor(eventIdx);
|
|
25
21
|
// Her etkinlik için haftanın günlerini gezip, o güne düşen parçayı hesaplıyoruz
|
|
26
22
|
return weekDays.map((day, dayIndex) => {
|
|
@@ -53,17 +49,7 @@ const Week = ({ data, states, config }) => {
|
|
|
53
49
|
: isContinuingTomorrow
|
|
54
50
|
? "var(--border-radius-sm) var(--border-radius-sm) 0 0"
|
|
55
51
|
: "var(--border-radius-sm)",
|
|
56
|
-
} }, !isContinuedFromYesterday && (
|
|
57
|
-
React.createElement("div", { className: "event-content" },
|
|
58
|
-
event.start.toLocaleTimeString(config?.locale ?? "tr-TR", {
|
|
59
|
-
hour: "2-digit",
|
|
60
|
-
minute: "2-digit",
|
|
61
|
-
}),
|
|
62
|
-
" - ",
|
|
63
|
-
event.end.toLocaleTimeString(config?.locale ?? "tr-TR", {
|
|
64
|
-
hour: "2-digit",
|
|
65
|
-
minute: "2-digit",
|
|
66
|
-
}))))));
|
|
52
|
+
} }, !isContinuedFromYesterday && renderItem(event, eventIdx)));
|
|
67
53
|
}
|
|
68
54
|
return null;
|
|
69
55
|
});
|
|
@@ -646,10 +646,10 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
646
646
|
dataType = "string";
|
|
647
647
|
setFilterButtonCoordinate({ x: coordinateX, y: coordinateY });
|
|
648
648
|
setFilterCurrentColumn(c);
|
|
649
|
-
setFilterCurrentDataType(dataType);
|
|
649
|
+
setFilterCurrentDataType(c.filterDataType ?? dataType);
|
|
650
650
|
setFilterCurrentIndex(cIndex);
|
|
651
651
|
setOpenFilter(true);
|
|
652
|
-
handleFilterPopupContent(c, dataType, cIndex);
|
|
652
|
+
handleFilterPopupContent(c, c.filterDataType ?? dataType, cIndex);
|
|
653
653
|
} },
|
|
654
654
|
React.createElement(Button, { variant: "borderless", icon: {
|
|
655
655
|
element: React.createElement(ARIcon, { size: 24, icon: "Filter", fill: "var(--dark)", strokeWidth: 0 }),
|
|
@@ -32,6 +32,7 @@ export type TableColumnType<T> = {
|
|
|
32
32
|
nestedKey: string;
|
|
33
33
|
};
|
|
34
34
|
filters?: Option[];
|
|
35
|
+
filterDataType?: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
35
36
|
render?: (item: T) => React.ReactNode;
|
|
36
37
|
editable?: {
|
|
37
38
|
type: "string" | "number" | "decimal" | "input-formatted-decimal" | "date-picker" | "single-select" | "multiple-select";
|