ar-design 0.4.41 → 0.4.43
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/kanban-board/IProps.d.ts +19 -17
- package/dist/components/data-display/kanban-board/filter/DateFilters.d.ts +5 -3
- package/dist/components/data-display/kanban-board/filter/DateFilters.js +6 -3
- package/dist/components/data-display/kanban-board/filter/SelectFilters.d.ts +6 -4
- package/dist/components/data-display/kanban-board/filter/SelectFilters.js +8 -5
- package/dist/components/data-display/kanban-board/filter/index.d.ts +4 -2
- package/dist/components/data-display/kanban-board/filter/index.js +8 -5
- package/dist/components/data-display/kanban-board/index.d.ts +1 -1
- package/dist/components/data-display/kanban-board/index.js +41 -6
- package/dist/components/data-display/table/IProps.d.ts +7 -4
- package/dist/components/data-display/table/PropertiesPopup.d.ts +1 -1
- package/dist/components/data-display/table/THeadCell.d.ts +1 -1
- package/dist/components/data-display/table/body/Editable.d.ts +3 -4
- package/dist/components/data-display/table/body/Editable.js +3 -2
- package/dist/components/data-display/table/body/TBody.d.ts +1 -1
- package/dist/components/data-display/table/body/TBody.js +1 -1
- package/dist/components/data-display/table/header/ActionButtons.d.ts +8 -1
- package/dist/components/data-display/table/header/ActionButtons.js +7 -2
- package/dist/components/data-display/table/header/Header.d.ts +8 -2
- package/dist/components/data-display/table/header/Header.js +2 -2
- package/dist/components/data-display/table/index.js +17 -1
- package/dist/libs/core/application/hooks/useTranslation.d.ts +2 -1
- package/dist/libs/core/application/hooks/useTranslation.js +4 -2
- package/dist/libs/core/application/locales/kanban-board/IKanbanBoardLocale.d.ts +5 -0
- package/dist/libs/core/application/locales/kanban-board/IKanbanBoardLocale.js +1 -0
- package/dist/libs/core/application/locales/kanban-board/en.d.ts +3 -0
- package/dist/libs/core/application/locales/kanban-board/en.js +5 -0
- package/dist/libs/core/application/locales/kanban-board/tr.d.ts +3 -0
- package/dist/libs/core/application/locales/kanban-board/tr.js +5 -0
- package/package.json +1 -1
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { KanbanBoardColumnType } from "../../../libs/types";
|
|
2
|
-
|
|
2
|
+
export type Config<T extends object> = {
|
|
3
|
+
locale?: Intl.LocalesArgument;
|
|
4
|
+
safeAreaOffset?: {
|
|
5
|
+
top?: number;
|
|
6
|
+
right?: number;
|
|
7
|
+
bottom?: number;
|
|
8
|
+
left?: number;
|
|
9
|
+
};
|
|
10
|
+
filter?: {
|
|
11
|
+
search?: (item: T, value: string) => boolean;
|
|
12
|
+
keys: (item: T) => {
|
|
13
|
+
name: string;
|
|
14
|
+
key: string;
|
|
15
|
+
type: "select" | "date";
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
interface IProps<T extends object, TColumnProperties> {
|
|
3
20
|
trackBy: (item: T) => string;
|
|
4
21
|
columns: KanbanBoardColumnType<T, TColumnProperties>[];
|
|
5
22
|
onChange?: (item: T, columnKey: string, columnProperties: TColumnProperties, hoverIndex: number) => void;
|
|
6
|
-
config?:
|
|
7
|
-
safeAreaOffset?: {
|
|
8
|
-
top?: number;
|
|
9
|
-
right?: number;
|
|
10
|
-
bottom?: number;
|
|
11
|
-
left?: number;
|
|
12
|
-
};
|
|
13
|
-
filter?: {
|
|
14
|
-
search?: (item: T, value: string) => boolean;
|
|
15
|
-
keys: (item: T) => {
|
|
16
|
-
name: string;
|
|
17
|
-
key: string;
|
|
18
|
-
type: "select" | "date";
|
|
19
|
-
}[];
|
|
20
|
-
};
|
|
21
|
-
};
|
|
23
|
+
config?: Config<T>;
|
|
22
24
|
}
|
|
23
25
|
export default IProps;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Dispatch, JSX, SetStateAction } from "react";
|
|
2
|
+
import { Config } from "../IProps";
|
|
3
|
+
interface IProps<T extends object> {
|
|
3
4
|
states: {
|
|
4
5
|
dateFilters: {
|
|
5
6
|
get: Record<string, {
|
|
@@ -18,6 +19,7 @@ interface IProps {
|
|
|
18
19
|
methods: {
|
|
19
20
|
open: (name: string | null) => void;
|
|
20
21
|
};
|
|
22
|
+
config?: Config<T>;
|
|
21
23
|
}
|
|
22
|
-
declare const _default:
|
|
24
|
+
declare const _default: <T extends object>(props: IProps<T>) => JSX.Element;
|
|
23
25
|
export default _default;
|
|
@@ -4,8 +4,11 @@ import { ARIcon } from "../../../icons";
|
|
|
4
4
|
import Grid from "../../grid-system";
|
|
5
5
|
import Button from "../../../form/button";
|
|
6
6
|
import Divider from "../../divider";
|
|
7
|
+
import { useTranslation } from "../../../../libs/core/application/hooks";
|
|
7
8
|
const { Row, Column, Box } = Grid;
|
|
8
|
-
|
|
9
|
+
function DateFilters({ states, methods, config }) {
|
|
10
|
+
// hooks
|
|
11
|
+
const { t } = useTranslation(String(config?.locale ?? "tr"));
|
|
9
12
|
return Object.entries(states.dateFilters.get).map(([name, range], index) => {
|
|
10
13
|
const isEqualsName = states.openName.get === name;
|
|
11
14
|
const className = [];
|
|
@@ -46,7 +49,7 @@ const DateFilters = ({ states, methods }) => {
|
|
|
46
49
|
...prev,
|
|
47
50
|
[name]: { from: null, to: null },
|
|
48
51
|
}));
|
|
49
|
-
} }, "Clear")))))));
|
|
52
|
+
} }, t("KanbanBoard.Search.Button.Clear.Text"))))))));
|
|
50
53
|
});
|
|
51
|
-
}
|
|
54
|
+
}
|
|
52
55
|
export default memo(DateFilters);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Dispatch, JSX, SetStateAction } from "react";
|
|
2
|
+
import { Config } from "../IProps";
|
|
3
|
+
interface IProps<T extends object> {
|
|
3
4
|
states: {
|
|
4
5
|
selectFilters: {
|
|
5
6
|
get: {
|
|
@@ -20,6 +21,7 @@ interface IProps {
|
|
|
20
21
|
methods: {
|
|
21
22
|
open: (name: string | null) => void;
|
|
22
23
|
};
|
|
24
|
+
config?: Config<T>;
|
|
23
25
|
}
|
|
24
|
-
declare const
|
|
25
|
-
export default
|
|
26
|
+
declare const _default: <T extends object>(props: IProps<T>) => JSX.Element;
|
|
27
|
+
export default _default;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { memo } from "react";
|
|
2
2
|
import { ARIcon } from "../../../icons";
|
|
3
3
|
import Checkbox from "../../../form/checkbox";
|
|
4
4
|
import Grid from "../../grid-system";
|
|
5
5
|
import Button from "../../../form/button";
|
|
6
6
|
import Divider from "../../divider";
|
|
7
|
+
import { useTranslation } from "../../../../libs/core/application/hooks";
|
|
7
8
|
const { Box } = Grid;
|
|
8
|
-
|
|
9
|
+
function SelectFilters({ states, methods, config }) {
|
|
10
|
+
// hooks
|
|
11
|
+
const { t } = useTranslation(String(config?.locale ?? "tr"));
|
|
9
12
|
return Object.entries(states.selectFilters.get).map(([name, values], index) => {
|
|
10
13
|
const isEqualsName = states.openName.get === name;
|
|
11
14
|
const className = [];
|
|
@@ -34,7 +37,7 @@ const SelectFilters = ({ states, methods }) => {
|
|
|
34
37
|
delete next[name];
|
|
35
38
|
return next;
|
|
36
39
|
});
|
|
37
|
-
} }, "Clear"))))));
|
|
40
|
+
} }, t("KanbanBoard.Search.Button.Clear.Text")))))));
|
|
38
41
|
});
|
|
39
|
-
}
|
|
40
|
-
export default SelectFilters;
|
|
42
|
+
}
|
|
43
|
+
export default memo(SelectFilters);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from "react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
3
|
+
import { Config } from "../IProps";
|
|
4
|
+
interface IProps<T extends object> {
|
|
4
5
|
states: {
|
|
5
6
|
search: {
|
|
6
7
|
get: string;
|
|
@@ -29,6 +30,7 @@ interface IProps {
|
|
|
29
30
|
set: Dispatch<SetStateAction<Record<string, Set<string | null>>>>;
|
|
30
31
|
};
|
|
31
32
|
};
|
|
33
|
+
config?: Config<T>;
|
|
32
34
|
}
|
|
33
|
-
declare
|
|
35
|
+
declare function Filter<T extends object>({ states, config }: IProps<T>): React.JSX.Element;
|
|
34
36
|
export default Filter;
|
|
@@ -4,13 +4,16 @@ import DateFilters from "./DateFilters";
|
|
|
4
4
|
import SelectFilters from "./SelectFilters";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import Input from "../../../form/input";
|
|
7
|
-
|
|
7
|
+
import { useTranslation } from "../../../../libs/core/application/hooks";
|
|
8
|
+
function Filter({ states, config }) {
|
|
8
9
|
// states
|
|
9
10
|
const [openName, setOpenName] = useState(null);
|
|
11
|
+
// hooks
|
|
12
|
+
const { t } = useTranslation(String(config?.locale ?? "tr"));
|
|
10
13
|
// methods
|
|
11
14
|
const handleOpen = (name) => setOpenName(openName === name ? null : name);
|
|
12
15
|
return (React.createElement("div", { className: "filters" },
|
|
13
|
-
React.createElement(Input, { variant: "borderless", placeholder: "
|
|
16
|
+
React.createElement(Input, { variant: "borderless", placeholder: t("KanbanBoard.Search.Input.Placeholder"), onChange: (event) => states.search.set(event.target.value.toLocaleLowerCase()) }),
|
|
14
17
|
React.createElement("ul", null,
|
|
15
18
|
React.createElement(DateFilters, { states: {
|
|
16
19
|
dateFilters: {
|
|
@@ -20,7 +23,7 @@ const Filter = ({ states }) => {
|
|
|
20
23
|
openName: { get: openName },
|
|
21
24
|
}, methods: {
|
|
22
25
|
open: handleOpen,
|
|
23
|
-
} }),
|
|
26
|
+
}, config: config }),
|
|
24
27
|
React.createElement(SelectFilters, { states: {
|
|
25
28
|
selectFilters: {
|
|
26
29
|
get: states.selectFilters.get,
|
|
@@ -31,6 +34,6 @@ const Filter = ({ states }) => {
|
|
|
31
34
|
set: states.selectedFilters.set,
|
|
32
35
|
},
|
|
33
36
|
openName: { get: openName },
|
|
34
|
-
}, methods: { open: handleOpen } }))));
|
|
35
|
-
}
|
|
37
|
+
}, methods: { open: handleOpen }, config: config }))));
|
|
38
|
+
}
|
|
36
39
|
export default Filter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import IProps from "./IProps";
|
|
3
3
|
import "../../../assets/css/components/data-display/kanban-board/styles.css";
|
|
4
|
-
declare const KanbanBoard: <T, TColumnProperties>({ trackBy, columns, onChange, config, }: IProps<T, TColumnProperties>) => React.JSX.Element;
|
|
4
|
+
declare const KanbanBoard: <T extends object, TColumnProperties>({ trackBy, columns, onChange, config, }: IProps<T, TColumnProperties>) => React.JSX.Element;
|
|
5
5
|
export default KanbanBoard;
|
|
@@ -7,6 +7,7 @@ import Filter from "./filter";
|
|
|
7
7
|
const KanbanBoard = function ({ trackBy, columns, onChange, config, }) {
|
|
8
8
|
// refs
|
|
9
9
|
const _kanbanWrapper = useRef(null);
|
|
10
|
+
const _kanbanItems = useRef({});
|
|
10
11
|
const _hoverItemIndex = useRef(null);
|
|
11
12
|
const _scrollInterval = useRef(null);
|
|
12
13
|
const _scrollAnimationFrame = useRef(null);
|
|
@@ -169,13 +170,23 @@ const KanbanBoard = function ({ trackBy, columns, onChange, config, }) {
|
|
|
169
170
|
...col,
|
|
170
171
|
items: [...col.items],
|
|
171
172
|
}));
|
|
173
|
+
let firstMatchedId = null;
|
|
172
174
|
// Search varsa...
|
|
173
175
|
if (config?.filter?.search && search?.trim()) {
|
|
174
176
|
const q = search.trim();
|
|
175
|
-
nextData = nextData.map((col) =>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
nextData = nextData.map((col) => {
|
|
178
|
+
const filteredItems = col.items.filter((item) => {
|
|
179
|
+
const isMatch = config.filter.search(item, q);
|
|
180
|
+
if (isMatch && !firstMatchedId)
|
|
181
|
+
firstMatchedId = trackBy(item);
|
|
182
|
+
return isMatch;
|
|
183
|
+
});
|
|
184
|
+
return { ...col, items: filteredItems };
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
if (config?.filter?.search)
|
|
189
|
+
config.filter.search({}, "");
|
|
179
190
|
}
|
|
180
191
|
// Select ve Date varsa...
|
|
181
192
|
nextData = nextData.map((col) => ({
|
|
@@ -209,6 +220,26 @@ const KanbanBoard = function ({ trackBy, columns, onChange, config, }) {
|
|
|
209
220
|
}),
|
|
210
221
|
}));
|
|
211
222
|
setData(nextData);
|
|
223
|
+
// Focus / Scroll Control
|
|
224
|
+
if (search?.trim() && firstMatchedId) {
|
|
225
|
+
const element = _kanbanItems.current[firstMatchedId];
|
|
226
|
+
const container = _kanbanWrapper.current;
|
|
227
|
+
if (element && container) {
|
|
228
|
+
const elementRect = element.getBoundingClientRect();
|
|
229
|
+
const containerRect = container.getBoundingClientRect();
|
|
230
|
+
// Senin hesaplaman: Mevcut scroll + elemanın container'a göre konumu - ofset değerlerin
|
|
231
|
+
const scrollLeft = container.scrollLeft + (elementRect.left - containerRect.left) - 17.5;
|
|
232
|
+
const scrollTop = container.scrollTop + (elementRect.top - containerRect.top) - 100;
|
|
233
|
+
container.scrollTo({
|
|
234
|
+
left: scrollLeft,
|
|
235
|
+
top: scrollTop,
|
|
236
|
+
behavior: "smooth",
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else if (!search?.trim() && _kanbanWrapper.current) {
|
|
241
|
+
_kanbanWrapper.current.scrollTo({ top: 0, left: 0, behavior: "smooth" });
|
|
242
|
+
}
|
|
212
243
|
}, [columns, search, selectedFilters, dateFilters]);
|
|
213
244
|
return (React.createElement(React.Fragment, null,
|
|
214
245
|
config?.filter && (React.createElement(Filter, { states: {
|
|
@@ -228,7 +259,7 @@ const KanbanBoard = function ({ trackBy, columns, onChange, config, }) {
|
|
|
228
259
|
get: selectedFilters,
|
|
229
260
|
set: setSelectedFilters,
|
|
230
261
|
},
|
|
231
|
-
} })),
|
|
262
|
+
}, config: config })),
|
|
232
263
|
React.createElement("div", { ref: _kanbanWrapper, className: "ar-kanban-board", style: {
|
|
233
264
|
height: `calc(100dvh - (${_kanbanWrapper.current?.getBoundingClientRect().top}px + ${config?.safeAreaOffset?.bottom ?? 0}px))`,
|
|
234
265
|
}, onDragOver: handleBoardDragOver, onDragEnd: stopScrolling, onDrop: stopScrolling },
|
|
@@ -248,7 +279,11 @@ const KanbanBoard = function ({ trackBy, columns, onChange, config, }) {
|
|
|
248
279
|
React.createElement("div", { className: "columns" }, data.map((board, index) => (React.createElement("div", { key: index, className: "column", onDrop: handleDrop(board.key) },
|
|
249
280
|
React.createElement("div", { className: "items", onDragOver: handleItemsDragOver, onDragLeave: handleItemsDragLeave, onDrop: handleItemsDrop },
|
|
250
281
|
React.createElement(DnD, { key: board.key, data: board.items, renderItem: (item, dndIndex) => {
|
|
251
|
-
return (React.createElement("div", { key: dndIndex,
|
|
282
|
+
return (React.createElement("div", { key: dndIndex, ref: (el) => {
|
|
283
|
+
if (!el)
|
|
284
|
+
return;
|
|
285
|
+
_kanbanItems.current[trackBy(item)] = el;
|
|
286
|
+
}, className: "item", onDragOver: (event) => {
|
|
252
287
|
event.preventDefault();
|
|
253
288
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
254
289
|
const mouseY = event.clientY;
|
|
@@ -20,7 +20,7 @@ export type Sort<T> = {
|
|
|
20
20
|
export type SearchedParam = {
|
|
21
21
|
[key: string]: FilterValue | FilterValue[];
|
|
22
22
|
};
|
|
23
|
-
export type Config<T> = {
|
|
23
|
+
export type Config<T extends object> = {
|
|
24
24
|
locale?: Intl.LocalesArgument;
|
|
25
25
|
isServerSide?: boolean;
|
|
26
26
|
isProperties?: boolean;
|
|
@@ -34,14 +34,17 @@ export type Config<T> = {
|
|
|
34
34
|
button?: boolean;
|
|
35
35
|
render?: {
|
|
36
36
|
styles: React.CSSProperties;
|
|
37
|
-
element: (item:
|
|
37
|
+
element: (item: T[]) => React.JSX.Element;
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
dnd?: {
|
|
41
41
|
renderItem: React.JSX.Element;
|
|
42
42
|
};
|
|
43
43
|
isTreeView?: boolean;
|
|
44
|
-
validation?:
|
|
44
|
+
validation?: {
|
|
45
|
+
errors: Errors<T>;
|
|
46
|
+
getChangeData?: (items: T[]) => void;
|
|
47
|
+
};
|
|
45
48
|
};
|
|
46
49
|
type ImportActionType = {
|
|
47
50
|
tooltip: string;
|
|
@@ -70,7 +73,7 @@ type DeleteActionType = {
|
|
|
70
73
|
message?: string;
|
|
71
74
|
onClick: () => void;
|
|
72
75
|
};
|
|
73
|
-
interface IProps<T> extends IChildren {
|
|
76
|
+
interface IProps<T extends object> extends IChildren {
|
|
74
77
|
trackBy?: (item: T) => string;
|
|
75
78
|
title?: string;
|
|
76
79
|
description?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
2
2
|
import { TableColumnType } from "../../../libs/types";
|
|
3
3
|
import { Config, Sort } from "./IProps";
|
|
4
|
-
interface IProps<T> {
|
|
4
|
+
interface IProps<T extends object> {
|
|
5
5
|
refs: {
|
|
6
6
|
tableContent: MutableRefObject<HTMLDivElement | null>;
|
|
7
7
|
buttons: MutableRefObject<(HTMLSpanElement | null)[]>;
|
|
@@ -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, methods, columns, config, }: {
|
|
4
|
+
declare const MemoizedTHeadCell: <T extends object>({ refs, states, methods, columns, config, }: {
|
|
5
5
|
refs: {
|
|
6
6
|
propertiesButton: React.MutableRefObject<(HTMLSpanElement | null)[]>;
|
|
7
7
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { TableColumnType } from "../../../../libs/types";
|
|
3
3
|
import { Config } from "../IProps";
|
|
4
|
-
interface IProps<T> {
|
|
4
|
+
interface IProps<T extends object> {
|
|
5
5
|
c: TableColumnType<T>;
|
|
6
6
|
item: T;
|
|
7
7
|
trackByValue: string;
|
|
8
8
|
onEditable: (item: T, trackByValue: string, currentKey?: keyof T | null) => void;
|
|
9
|
-
validation?: Errors<T>;
|
|
10
9
|
config: Config<T>;
|
|
11
10
|
}
|
|
12
|
-
declare const Editable: <T>({ c, item, trackByValue, onEditable,
|
|
11
|
+
declare const Editable: <T extends object>({ c, item, trackByValue, onEditable, config }: IProps<T>) => React.JSX.Element | null;
|
|
13
12
|
export default Editable;
|
|
@@ -4,7 +4,7 @@ import Input from "../../../form/input";
|
|
|
4
4
|
import DatePicker from "../../../form/date-picker";
|
|
5
5
|
import Select from "../../../form/select";
|
|
6
6
|
import { ExtractKey } from "../Helpers";
|
|
7
|
-
const Editable = function ({ c, item, trackByValue, onEditable,
|
|
7
|
+
const Editable = function ({ c, item, trackByValue, onEditable, config }) {
|
|
8
8
|
// variables
|
|
9
9
|
const key = c.key;
|
|
10
10
|
const itemValue = item[c.key];
|
|
@@ -12,7 +12,8 @@ const Editable = function ({ c, item, trackByValue, onEditable, validation, conf
|
|
|
12
12
|
const selectItems = Array.isArray(itemValue)
|
|
13
13
|
? c.editable?.options?.filter((x) => itemValue.includes(x.value))
|
|
14
14
|
: [];
|
|
15
|
-
const
|
|
15
|
+
const validation = config.validation;
|
|
16
|
+
const _vText = validation?.errors?.[`${c.key}_${trackByValue}`];
|
|
16
17
|
// states
|
|
17
18
|
const [_value, setValue] = useState(itemValue);
|
|
18
19
|
// useEffects
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { Dispatch, SetStateAction } from "react";
|
|
2
2
|
import { TableColumnType } from "../../../../libs/types";
|
|
3
3
|
import { Config } from "../IProps";
|
|
4
|
-
interface IProps<T> {
|
|
4
|
+
interface IProps<T extends object> {
|
|
5
5
|
data: T[];
|
|
6
6
|
columns: TableColumnType<T>[];
|
|
7
7
|
refs: {
|
|
@@ -99,7 +99,7 @@ function TBody({ data, columns, refs, methods, states, config }) {
|
|
|
99
99
|
return (React.createElement("div", { key: `last-before-${i}`, style: { left: `${i + 0.65}rem` }, className: "last-before" }));
|
|
100
100
|
}),
|
|
101
101
|
React.createElement("div", { className: "before" }))),
|
|
102
|
-
React.isValidElement(render) ? (render) : column.editable && methods.onEditable ? (React.createElement(Editable, { c: column, item: item, trackByValue: methods.trackBy?.(item) ?? "", onEditable: methods.onEditable,
|
|
102
|
+
React.isValidElement(render) ? (render) : column.editable && methods.onEditable ? (React.createElement(Editable, { c: column, item: item, trackByValue: methods.trackBy?.(item) ?? "", onEditable: methods.onEditable, config: config })) : (React.createElement("span", null, render)),
|
|
103
103
|
config.isTreeView && cIndex === 0 && (React.createElement("div", { className: "after" },
|
|
104
104
|
React.createElement("div", { className: "circle" }))))));
|
|
105
105
|
};
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
1
2
|
import { Actions } from "../IProps";
|
|
2
3
|
import React from "react";
|
|
3
4
|
interface IProps {
|
|
5
|
+
states: {
|
|
6
|
+
createTrigger: {
|
|
7
|
+
get: boolean;
|
|
8
|
+
set: Dispatch<SetStateAction<boolean>>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
4
11
|
actions: Actions;
|
|
5
12
|
}
|
|
6
|
-
declare const _default: React.MemoExoticComponent<({ actions }: IProps) => React.JSX.Element>;
|
|
13
|
+
declare const _default: React.MemoExoticComponent<({ states, actions }: IProps) => React.JSX.Element>;
|
|
7
14
|
export default _default;
|
|
@@ -7,7 +7,7 @@ import Tooltip from "../../../feedback/tooltip";
|
|
|
7
7
|
import Button from "../../../form/button";
|
|
8
8
|
import { ARIcon } from "../../../icons";
|
|
9
9
|
const { Row, Column } = Grid;
|
|
10
|
-
const ActionButtons = ({ actions }) => {
|
|
10
|
+
const ActionButtons = ({ states, actions }) => {
|
|
11
11
|
// states
|
|
12
12
|
const [files, setFiles] = useState([]);
|
|
13
13
|
const [formData, setFormData] = useState(undefined);
|
|
@@ -46,7 +46,12 @@ const ActionButtons = ({ actions }) => {
|
|
|
46
46
|
React.createElement(Tooltip, { text: actions.export.tooltip },
|
|
47
47
|
React.createElement(Button, { variant: "outlined", color: "blue", icon: { element: React.createElement(ARIcon, { icon: "Download", fill: "currentcolor" }) } })))),
|
|
48
48
|
actions.create && (React.createElement(Tooltip, { text: actions.create.tooltip },
|
|
49
|
-
React.createElement(Button, { variant: "outlined", color: "green", icon: { element: React.createElement(ARIcon, { icon: "Add", size: 24 }) }, onClick:
|
|
49
|
+
React.createElement(Button, { variant: "outlined", color: "green", icon: { element: React.createElement(ARIcon, { icon: "Add", size: 24 }) }, onClick: (event) => {
|
|
50
|
+
if (!actions.create)
|
|
51
|
+
return;
|
|
52
|
+
actions.create.onClick(event);
|
|
53
|
+
states.createTrigger.set((prev) => !prev);
|
|
54
|
+
} }))),
|
|
50
55
|
actions.delete && (React.createElement(Popover, { title: actions.delete.title ?? "Siliniyor", message: actions.delete.message ??
|
|
51
56
|
"Seçtiğiniz verileri uygulamadan silebilirsiniz. Bu işlem, verilerin sistemimizden tamamen kaldırılmasını sağlar ve bu verilerle artık işlem yapılamaz.", onConfirm: (confirm) => {
|
|
52
57
|
if (!confirm)
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { Dispatch, SetStateAction } from "react";
|
|
2
2
|
import { Actions } from "../IProps";
|
|
3
3
|
interface IProps {
|
|
4
|
+
states: {
|
|
5
|
+
createTrigger: {
|
|
6
|
+
get: boolean;
|
|
7
|
+
set: Dispatch<SetStateAction<boolean>>;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
4
10
|
title?: string;
|
|
5
11
|
description?: string;
|
|
6
12
|
actions?: Actions;
|
|
7
13
|
}
|
|
8
|
-
declare const _default: React.MemoExoticComponent<({ title, description, actions }: IProps) => React.JSX.Element>;
|
|
14
|
+
declare const _default: React.MemoExoticComponent<({ states, title, description, actions }: IProps) => React.JSX.Element>;
|
|
9
15
|
export default _default;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { memo } from "react";
|
|
2
2
|
import ActionButtons from "./ActionButtons";
|
|
3
|
-
const Header = ({ title, description, actions }) => {
|
|
3
|
+
const Header = ({ states, title, description, actions }) => {
|
|
4
4
|
return (React.createElement("div", { className: "header" },
|
|
5
5
|
React.createElement("div", { className: "title" },
|
|
6
6
|
React.createElement("h4", null, title),
|
|
7
7
|
description && React.createElement("h5", null, description)),
|
|
8
|
-
actions && React.createElement(ActionButtons, { actions: actions })));
|
|
8
|
+
actions && React.createElement(ActionButtons, { states: states, actions: actions })));
|
|
9
9
|
};
|
|
10
10
|
export default memo(Header);
|
|
@@ -49,6 +49,8 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
49
49
|
// states
|
|
50
50
|
const [selectAll, setSelectAll] = useState(false);
|
|
51
51
|
const [showSubitems, setShowSubitems] = useState({});
|
|
52
|
+
// states -> Action Buttons
|
|
53
|
+
const [createTrigger, setCreateTrigger] = useState(false);
|
|
52
54
|
// states -> Search
|
|
53
55
|
const [searchedText, setSearchedText] = useState(null);
|
|
54
56
|
const [_searchedParams, setSearchedParams] = useState(null);
|
|
@@ -566,9 +568,23 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
566
568
|
setCurrentPage(1);
|
|
567
569
|
setTimeout(() => handleScroll(), 0);
|
|
568
570
|
}, [selectedPerPage]);
|
|
571
|
+
useEffect(() => {
|
|
572
|
+
if (typeof selections !== "function" && config.validation) {
|
|
573
|
+
const updatedData = data.map((item) => {
|
|
574
|
+
if (!("trackByValue" in item) && trackBy) {
|
|
575
|
+
return { ...item, trackByValue: trackBy(item) };
|
|
576
|
+
}
|
|
577
|
+
return item;
|
|
578
|
+
});
|
|
579
|
+
config.validation?.getChangeData?.(updatedData);
|
|
580
|
+
}
|
|
581
|
+
}, [createTrigger]);
|
|
569
582
|
useEffect(() => {
|
|
570
583
|
setIsMobile(window.innerWidth <= 768);
|
|
571
584
|
window.addEventListener("resize", handleResize);
|
|
585
|
+
if (typeof selections !== "function" && config.validation) {
|
|
586
|
+
config.validation.getChangeData?.(data.map((d) => ({ ...d, trackByValue: trackBy?.(d) })) ?? []);
|
|
587
|
+
}
|
|
572
588
|
return () => {
|
|
573
589
|
window.removeEventListener("resize", handleResize);
|
|
574
590
|
};
|
|
@@ -584,7 +600,7 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
584
600
|
{ value: FilterOperator.NotBlank, text: t("Table.Filters.Where.Input.Item.8.Text") },
|
|
585
601
|
];
|
|
586
602
|
return (React.createElement("div", { ref: _tableWrapper, className: _tableClassName.map((c) => c).join(" ") },
|
|
587
|
-
(title || description || actions || React.Children.count(children) > 0) && (React.createElement(Header, { title: title, description: description, actions: actions })),
|
|
603
|
+
(title || description || actions || React.Children.count(children) > 0) && (React.createElement(Header, { states: { createTrigger: { get: createTrigger, set: setCreateTrigger } }, title: title, description: description, actions: actions })),
|
|
588
604
|
React.createElement("div", { ref: _tableContent, className: "content", onScroll: handleScroll },
|
|
589
605
|
React.createElement("table", { ref: _innerRef },
|
|
590
606
|
React.createElement("thead", null,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { INotificationLocale } from "../locales";
|
|
2
|
+
import IKanbanBoardLocale from "../locales/kanban-board/IKanbanBoardLocale";
|
|
2
3
|
import ITableLocale from "../locales/table/ITableLocale";
|
|
3
4
|
type LocaleMap = Record<string, Record<string, any>>;
|
|
4
5
|
declare const useTranslation: <TBaseLocale>(currentLanguage: string | undefined, translations?: LocaleMap) => {
|
|
5
|
-
t: (key: Extract<keyof TBaseLocale | keyof ITableLocale | keyof INotificationLocale, string>, ...args: any[]) => string;
|
|
6
|
+
t: (key: Extract<keyof TBaseLocale | keyof ITableLocale | keyof IKanbanBoardLocale | keyof INotificationLocale, string>, ...args: any[]) => string;
|
|
6
7
|
currentLanguage: string | undefined;
|
|
7
8
|
};
|
|
8
9
|
export default useTranslation;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import Utils from "../../../infrastructure/shared/Utils";
|
|
2
2
|
import { NotificationEN, NotificationTR } from "../locales";
|
|
3
|
+
import KanbanBoardEN from "../locales/kanban-board/en";
|
|
4
|
+
import KanbanBoardTR from "../locales/kanban-board/tr";
|
|
3
5
|
import TableEN from "../locales/table/en";
|
|
4
6
|
import TableTR from "../locales/table/tr";
|
|
5
7
|
const useTranslation = function (currentLanguage, translations = {}) {
|
|
6
8
|
const merged = {};
|
|
7
9
|
const ExtraLocales = {
|
|
8
|
-
tr: { ...TableTR, ...NotificationTR },
|
|
9
|
-
en: { ...TableEN, ...NotificationEN },
|
|
10
|
+
tr: { ...TableTR, ...KanbanBoardTR, ...NotificationTR },
|
|
11
|
+
en: { ...TableEN, ...KanbanBoardEN, ...NotificationEN },
|
|
10
12
|
};
|
|
11
13
|
const allLanguages = new Set([...Object.keys(translations), ...Object.keys(ExtraLocales)]);
|
|
12
14
|
allLanguages.forEach((lang) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|