ar-design 0.2.30 → 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.
@@ -12,9 +12,10 @@
12
12
  .ar-table > .header {
13
13
  display: flex;
14
14
  flex-direction: row;
15
- flex-wrap: wrap;
15
+ flex-wrap: nowrap;
16
16
  justify-content: space-between;
17
- align-items: center;
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
- font-size: 0.85rem;
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
  }
@@ -11,6 +11,8 @@
11
11
  box-sizing: border-box;
12
12
  }
13
13
  .ar-layout > aside.ar-aside.left {
14
+ position: sticky;
15
+ top: 0;
14
16
  display: flex;
15
17
  flex-direction: column;
16
18
  border-right: solid 1px var(--gray-200);
@@ -19,6 +21,11 @@
19
21
  display: flex;
20
22
  align-items: center;
21
23
  }
24
+ .ar-layout > aside.ar-aside.left > footer {
25
+ position: fixed;
26
+ bottom: 1rem;
27
+ }
28
+
22
29
  .ar-layout > aside.ar-aside.right {
23
30
  }
24
31
 
@@ -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 ActionType = {
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
- create?: ActionType;
18
- import?: ActionType;
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.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 })),
235
- 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 })),
236
- 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 }))))))),
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,
@@ -8,7 +8,7 @@ interface IProps extends IChildren {
8
8
  config?: {
9
9
  buttons: {
10
10
  okButton: string;
11
- cancelButton: string;
11
+ cancelButton?: string;
12
12
  };
13
13
  };
14
14
  }
@@ -11,8 +11,8 @@ const Checkbox = forwardRef(({ label, size = "normal", status, border = { radius
11
11
  _checkboxClassName.push(...Utils.GetClassName("filled", checked ? status : "light", border, size, undefined, attributes.className));
12
12
  // useEffects
13
13
  useEffect(() => {
14
- setChecked(attributes.checked ?? false);
15
- }, [attributes.checked]);
14
+ setChecked(attributes.checked ?? attributes.defaultChecked ?? false);
15
+ }, [attributes.checked, attributes.defaultChecked]);
16
16
  return (React.createElement("div", { className: "ar-checkbox-wrapper" },
17
17
  React.createElement("label", null,
18
18
  React.createElement("input", { ref: ref, type: "checkbox", ...attributes, size: 0, onChange: (event) => {
@@ -8,6 +8,7 @@ export interface IHeaderProps {
8
8
  export interface ILSiderProps {
9
9
  image?: React.ReactElement<SVGElement | HTMLImageElement>;
10
10
  text?: string | React.JSX.Element;
11
+ footer?: string;
11
12
  }
12
13
  export interface IMainProps extends IChildren {
13
14
  }
@@ -2,7 +2,8 @@
2
2
  import React from "react";
3
3
  import { useLayout } from "../../libs/core/application/hooks";
4
4
  import Title from "../data-display/typography/title/Title";
5
- const LSider = ({ image, text }) => {
5
+ import Paragraph from "../data-display/typography/paragraph/Paragraph";
6
+ const LSider = ({ image, text, footer }) => {
6
7
  // hooks
7
8
  const { config } = useLayout();
8
9
  const sider = config.layout.sider.left;
@@ -12,7 +13,9 @@ const LSider = ({ image, text }) => {
12
13
  React.createElement("div", { className: "logo" },
13
14
  image,
14
15
  React.createElement(Title, { Level: "h4", align: "center" }, text)),
15
- React.createElement("div", null, sider.element)));
16
+ React.createElement("div", null, sider.element),
17
+ footer && (React.createElement("footer", null,
18
+ React.createElement(Paragraph, { size: "small" }, footer)))));
16
19
  };
17
20
  LSider.displayName = "Layout.LSider";
18
21
  export default LSider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.30",
3
+ "version": "0.2.32",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",