ar-design 0.2.31 → 0.2.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/data-display/table/styles.css +3 -2
- package/dist/assets/css/components/feedback/popover/styles.css +6 -1
- package/dist/components/data-display/table/IProps.d.ts +9 -5
- package/dist/components/data-display/table/_index.js +1 -4
- package/dist/components/data-display/table/index.js +18 -4
- package/dist/components/feedback/popover/IProps.d.ts +1 -1
- package/package.json +1 -1
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
.ar-table > .header {
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-direction: row;
|
|
15
|
-
flex-wrap:
|
|
15
|
+
flex-wrap: nowrap;
|
|
16
16
|
justify-content: space-between;
|
|
17
|
-
align-items:
|
|
17
|
+
align-items: flex-start;
|
|
18
|
+
gap: 3.75rem;
|
|
18
19
|
padding: 1rem 1.5rem;
|
|
19
20
|
}
|
|
20
21
|
.ar-table > .header > .title {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
flex-direction: column;
|
|
12
12
|
background-color: var(--white);
|
|
13
13
|
width: 250px;
|
|
14
|
+
border: solid 1px var(--gray-200);
|
|
14
15
|
border-radius: var(--border-radius-sm);
|
|
15
16
|
box-shadow: 0 0 15px -2.5px rgba(var(--black-rgb), 0.1);
|
|
16
17
|
z-index: 1051;
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
.ar-popover > .title {
|
|
22
|
+
background-color: var(--gray-100);
|
|
21
23
|
padding: 0.5rem 1rem;
|
|
22
24
|
border-bottom: solid 1px var(--gray-200);
|
|
23
25
|
}
|
|
@@ -30,8 +32,10 @@
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
.ar-popover > .message {
|
|
35
|
+
position: relative;
|
|
33
36
|
padding: 0.5rem 1rem;
|
|
34
|
-
|
|
37
|
+
color: var(--gray-700);
|
|
38
|
+
font-size: 0.8rem;
|
|
35
39
|
text-wrap: wrap;
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -42,4 +46,5 @@
|
|
|
42
46
|
align-items: center;
|
|
43
47
|
gap: 0 0.5rem;
|
|
44
48
|
padding: 0.5rem 1rem;
|
|
49
|
+
border-top: solid 1px var(--gray-200);
|
|
45
50
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TableColumnType } from "../../../libs/types";
|
|
2
|
+
import { AllowedTypes, TableColumnType } from "../../../libs/types";
|
|
3
3
|
import { IChildren } from "../../../libs/types/IGlobalProps";
|
|
4
4
|
export type SearchedParam = {
|
|
5
5
|
[key: string]: string;
|
|
6
6
|
};
|
|
7
|
-
type
|
|
7
|
+
type ImportActionType = {
|
|
8
|
+
tooltip: string;
|
|
9
|
+
allowedTypes?: AllowedTypes[];
|
|
10
|
+
onClick: (formData: FormData | undefined, files: File[]) => void;
|
|
11
|
+
};
|
|
12
|
+
type CreateActionType = {
|
|
8
13
|
tooltip: string;
|
|
9
14
|
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
10
15
|
};
|
|
@@ -14,9 +19,8 @@ interface IProps<T> extends IChildren {
|
|
|
14
19
|
data: T[];
|
|
15
20
|
columns: TableColumnType<T>[];
|
|
16
21
|
actions?: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
filterClear?: ActionType;
|
|
22
|
+
import?: ImportActionType;
|
|
23
|
+
create?: CreateActionType;
|
|
20
24
|
};
|
|
21
25
|
selections?: (selectionItems: T[]) => void;
|
|
22
26
|
previousSelections?: T[];
|
|
@@ -275,10 +275,7 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
|
|
|
275
275
|
React.createElement("h5", null, description)),
|
|
276
276
|
React.createElement("div", { className: "actions" },
|
|
277
277
|
React.Children.count(children) > 0 && React.createElement("div", null, React.Children.map(children, (child) => child)),
|
|
278
|
-
actions && (React.createElement(React.Fragment, null,
|
|
279
|
-
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 })),
|
|
280
|
-
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 })),
|
|
281
|
-
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 }))))))),
|
|
278
|
+
actions && (React.createElement(React.Fragment, null, 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 }))))))),
|
|
282
279
|
React.createElement("div", { ref: _tableContent, className: "content", onScroll: handleScroll },
|
|
283
280
|
React.createElement("table", { ref: ref },
|
|
284
281
|
React.createElement("thead", null,
|
|
@@ -8,6 +8,7 @@ import React, { forwardRef, memo, useCallback, useEffect, useMemo, useRef, useSt
|
|
|
8
8
|
import Input from "../../form/input";
|
|
9
9
|
import Popover from "../../feedback/popover";
|
|
10
10
|
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
11
|
+
import Upload from "../../form/upload";
|
|
11
12
|
const Table = forwardRef(({ children, title, description, data, columns, actions, selections, previousSelections, searchedParams, pagination, config = { isSearchable: false }, }, ref) => {
|
|
12
13
|
// refs
|
|
13
14
|
const _tableWrapper = useRef(null);
|
|
@@ -22,6 +23,9 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
22
23
|
// states
|
|
23
24
|
const [selectAll, setSelectAll] = useState(false);
|
|
24
25
|
const [selectionItems, setSelectionItems] = useState([]);
|
|
26
|
+
// states -> File
|
|
27
|
+
const [files, setFiles] = useState([]);
|
|
28
|
+
const [formData, setFormData] = useState(undefined);
|
|
25
29
|
// states -> Search
|
|
26
30
|
const [searchedText, setSearchedText] = useState(undefined);
|
|
27
31
|
const [_searchedParams, setSearchedParams] = useState(undefined);
|
|
@@ -229,11 +233,21 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
229
233
|
(title || description || actions || React.Children.count(children) > 0) && (React.createElement("div", { className: "header" },
|
|
230
234
|
React.createElement("div", { className: "title" },
|
|
231
235
|
React.createElement("h3", null, title),
|
|
232
|
-
React.createElement("h5", null, description)),
|
|
236
|
+
description && React.createElement("h5", null, description)),
|
|
233
237
|
React.createElement("div", { className: "actions" }, actions && (React.createElement(React.Fragment, null,
|
|
234
|
-
actions.
|
|
235
|
-
|
|
236
|
-
|
|
238
|
+
actions.import && (React.createElement(Popover, { title: "\u0130\u00E7eri Aktar", message: "Se\u00E7ti\u011Finiz dosyalar\u0131 uygulamaya y\u00FCkleyebilirsiniz. Bu i\u015Flem, dosyalardaki verileri sistemimize aktar\u0131r ve verilerle i\u015Flem yapman\u0131za olanak tan\u0131r.", content: React.createElement(Upload, { text: "Belge Y\u00FCkleyin", allowedTypes: actions.import.allowedTypes, file: files, onChange: (formData, files) => {
|
|
239
|
+
setFormData(formData);
|
|
240
|
+
setFiles(files);
|
|
241
|
+
}, multiple: true }), onConfirm: (confirm) => {
|
|
242
|
+
if (!confirm) {
|
|
243
|
+
setFiles([]);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (actions.import && actions.import.onClick)
|
|
247
|
+
actions.import.onClick(formData, files);
|
|
248
|
+
}, config: { buttons: { okButton: "Yükle", cancelButton: "İptal" } }, windowBlur: true },
|
|
249
|
+
React.createElement(Button, { variant: "outlined", status: "success", icon: { element: React.createElement(ARIcon, { icon: "Import", size: 16 }) }, tooltip: { text: actions.import.tooltip, direction: "top" } }))),
|
|
250
|
+
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 }))))))),
|
|
237
251
|
React.createElement("div", { ref: _tableContent, className: "content", onScroll: handleScroll },
|
|
238
252
|
React.createElement("table", { ref: ref },
|
|
239
253
|
React.createElement("thead", null,
|