ar-design 0.3.2 → 0.3.4

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.
Files changed (39) hide show
  1. package/dist/assets/css/components/data-display/dnd/dnd.css +62 -40
  2. package/dist/assets/css/components/data-display/kanban-board/styles.css +68 -0
  3. package/dist/assets/css/components/data-display/table/styles.css +30 -0
  4. package/dist/assets/css/core/variants/borderless.css +10 -10
  5. package/dist/components/data-display/diagram/index.d.ts +2 -1
  6. package/dist/components/data-display/diagram/index.js +11 -3
  7. package/dist/components/data-display/dnd/IProps.d.ts +2 -1
  8. package/dist/components/data-display/dnd/index.d.ts +1 -1
  9. package/dist/components/data-display/dnd/index.js +55 -17
  10. package/dist/components/data-display/kanban-board/IProps.d.ts +5 -0
  11. package/dist/components/data-display/kanban-board/IProps.js +1 -0
  12. package/dist/components/data-display/kanban-board/index.d.ts +5 -0
  13. package/dist/components/data-display/kanban-board/index.js +71 -0
  14. package/dist/components/data-display/table/Editable.d.ts +9 -0
  15. package/dist/components/data-display/table/Editable.js +44 -0
  16. package/dist/components/data-display/table/IProps.d.ts +1 -0
  17. package/dist/components/data-display/table/index.js +8 -3
  18. package/dist/components/feedback/popup/index.js +2 -2
  19. package/dist/components/form/date-picker/Props.d.ts +2 -2
  20. package/dist/components/form/date-picker/index.js +2 -2
  21. package/dist/components/form/input-number/index.js +10 -3
  22. package/dist/components/form/upload/Buttons.js +2 -2
  23. package/dist/components/form/upload/Dropzone.js +1 -1
  24. package/dist/components/form/upload/List.js +1 -1
  25. package/dist/components/form/upload/index.js +2 -2
  26. package/dist/components/icons/Compiler.d.ts +2 -2
  27. package/dist/components/icons/Compiler.js +118 -124
  28. package/dist/components/icons/index.d.ts +1 -2
  29. package/dist/components/icons/index.js +2 -2
  30. package/dist/index.d.ts +2 -1
  31. package/dist/index.js +2 -1
  32. package/dist/libs/core/service/Api.d.ts +0 -3
  33. package/dist/libs/core/service/Api.js +0 -16
  34. package/dist/libs/core/service/index.d.ts +0 -1
  35. package/dist/libs/core/service/index.js +1 -1
  36. package/dist/libs/infrastructure/shared/Utils.d.ts +1 -2
  37. package/dist/libs/infrastructure/shared/Utils.js +2 -4
  38. package/dist/libs/types/index.d.ts +13 -2
  39. package/package.json +1 -1
@@ -15,6 +15,7 @@ import Select from "../../form/select";
15
15
  import Grid from "../grid-system";
16
16
  import THeadCell from "./THeadCell";
17
17
  import Tooltip from "../../feedback/tooltip";
18
+ import Editable from "./Editable";
18
19
  const filterOption = [
19
20
  { value: FilterOperator.Contains, text: "İçerir" },
20
21
  { value: FilterOperator.DoesNotContains, text: "İçermez" },
@@ -26,7 +27,7 @@ const filterOption = [
26
27
  { value: FilterOperator.NotBlank, text: "Boş değil" },
27
28
  ];
28
29
  const { Row, Column } = Grid;
29
- const Table = forwardRef(({ children, title, description, data, columns, actions, selections, previousSelections, searchedParams, pagination, config = { isSearchable: false }, }, ref) => {
30
+ const Table = forwardRef(({ children, title, description, data, columns, actions, selections, previousSelections, searchedParams, onEditable, pagination, config = { isSearchable: false }, }, ref) => {
30
31
  // refs
31
32
  const _tableWrapper = useRef(null);
32
33
  const _tableContent = useRef(null);
@@ -398,7 +399,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
398
399
  return (React.createElement("div", { key: `last-before-${i}`, style: { left: `${i + 0.65}rem` }, className: "last-before" }));
399
400
  }),
400
401
  React.createElement("div", { className: "before" }))),
401
- React.isValidElement(render) ? render : String(render),
402
+ React.isValidElement(render) ? (render) : c.editable && onEditable ? (React.createElement(Editable, { c: c, item: item, onEditable: onEditable })) : (render),
402
403
  config.isTreeView && cIndex === 0 && (React.createElement("div", { className: "after" },
403
404
  React.createElement("div", { className: "circle" }))))));
404
405
  };
@@ -581,7 +582,11 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
581
582
  element: (React.createElement(ARIcon, { viewBox: "0 0 16 16", size: 24, icon: "Filter", fill: "var(--dark)", strokeWidth: 0 })),
582
583
  } }))))));
583
584
  })))),
584
- React.createElement("tbody", null, getData.map((item, index) => (React.createElement(React.Fragment, { key: index }, renderRow(item, index, 1))))))),
585
+ React.createElement("tbody", null, getData.length > 0 ? (getData.map((item, index) => React.createElement(React.Fragment, { key: index }, renderRow(item, index, 1)))) : (React.createElement("tr", null,
586
+ React.createElement("td", { colSpan: columns.length },
587
+ React.createElement("div", { className: "no-item" },
588
+ React.createElement(ARIcon, { icon: "Inbox-Fill", fill: "var(--gray-300)", size: 64, style: { position: "relative", zIndex: 1 } }),
589
+ React.createElement("span", null, "No Data")))))))),
585
590
  React.createElement(FilterPopup, { tableContent: _tableContent, coordinate: filterButtonCoordinate, buttons: _filterButton }, filterPopupContent),
586
591
  pagination && pagination.totalRecords > pagination.perPage && (React.createElement("div", { className: "footer" },
587
592
  React.createElement("span", null,
@@ -34,11 +34,11 @@ const Popup = ({ title, message, status, isOpen, buttons }) => {
34
34
  case "success":
35
35
  return React.createElement(ARIcon, { icon: "CheckAll", fill: "var(--white)", size: 64 });
36
36
  case "warning":
37
- return React.createElement(ARIcon, { variant: "fill", icon: "ExclamationDiamond", fill: "var(--white)", size: 48 });
37
+ return React.createElement(ARIcon, { icon: "ExclamationDiamond-Fill", fill: "var(--white)", size: 48 });
38
38
  case "information":
39
39
  return "information";
40
40
  case "error":
41
- return React.createElement(ARIcon, { variant: "fill", icon: "XCircle", fill: "var(--white)", size: 48 });
41
+ return React.createElement(ARIcon, { icon: "XCircle-Fill", fill: "var(--white)", size: 48 });
42
42
  default:
43
43
  return "light";
44
44
  }
@@ -1,4 +1,4 @@
1
- import { IBorder, ISize, IStatus, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
1
+ import { IBorder, IColors, ISize, IStatus, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
2
2
  type Props = {
3
3
  /**
4
4
  * Bileşenin başlığı veya etiket metnidir.
@@ -37,5 +37,5 @@ type Props = {
37
37
  * ```
38
38
  */
39
39
  onChange: (value: string) => void;
40
- } & IVariant & IStatus & IBorder & ISize & IValidation & Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "onChange" | "size" | "color">;
40
+ } & IVariant & IColors & IStatus & IBorder & ISize & IValidation & Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "onChange" | "size" | "color">;
41
41
  export default Props;
@@ -21,7 +21,7 @@ const months = [
21
21
  { value: 10, text: "Kasım" },
22
22
  { value: 11, text: "Aralık" },
23
23
  ];
24
- const DatePicker = ({ onChange, isClock, validation, ...attributes }) => {
24
+ const DatePicker = ({ variant, color, onChange, isClock, validation, ...attributes }) => {
25
25
  // refs
26
26
  const _arCalendar = useRef(null);
27
27
  const _arClock = useRef(null);
@@ -249,7 +249,7 @@ const DatePicker = ({ onChange, isClock, validation, ...attributes }) => {
249
249
  attributes.placeholder && attributes.placeholder.length > 0 && (React.createElement("label", null,
250
250
  validation ? "* " : "",
251
251
  attributes.placeholder)),
252
- React.createElement(Input, { ref: _beginDate, ...attributes, value: DATE.ParseValue(String(attributes.value), isClock), type: isClock ? "datetime-local" : "date", onKeyDown: (event) => {
252
+ React.createElement(Input, { ref: _beginDate, variant: variant, color: color, ...attributes, value: DATE.ParseValue(String(attributes.value), isClock), type: isClock ? "datetime-local" : "date", onKeyDown: (event) => {
253
253
  if (event.code === "Space")
254
254
  event.preventDefault();
255
255
  else if (event.code === "Enter")
@@ -3,6 +3,7 @@ import React, { useEffect, useMemo, useRef, useState } from "react";
3
3
  import Input from "../input";
4
4
  const InputNumber = ({ ...attributes }) => {
5
5
  // refs
6
+ const _firstLoad = useRef(false);
6
7
  const _input = useRef(null);
7
8
  const _caretPosition = useRef(null);
8
9
  const _isInputTouch = useRef(false);
@@ -61,10 +62,16 @@ const InputNumber = ({ ...attributes }) => {
61
62
  }, []);
62
63
  // useEffects
63
64
  useEffect(() => {
64
- if (attributes.value !== undefined)
65
- setValue(attributes.value ?? "");
65
+ if (_firstLoad.current)
66
+ return;
67
+ if (attributes.value !== undefined && attributes.value !== "") {
68
+ const isDecimals = String(attributes.value).includes(",");
69
+ let formatted = formatter(isDecimals).format(parseFloat(String(attributes.value)));
70
+ setValue(formatted == "NaN" ? "" : formatted);
71
+ _firstLoad.current = true;
72
+ }
66
73
  }, [attributes.value]);
67
- return (React.createElement(Input, { ref: _input, ...attributes, value: value ?? attributes.value, onChange: (event) => {
74
+ return (React.createElement(Input, { ref: _input, ...attributes, value: value ?? attributes.value ?? "", onChange: (event) => {
68
75
  // Disabled gelmesi durumunda işlem yapmasına izin verme...
69
76
  if (attributes.disabled)
70
77
  return;
@@ -13,13 +13,13 @@ const Buttons = ({ selectedFile, handleFileToBase64, handleFileRemove }) => {
13
13
  a.click();
14
14
  window.URL.revokeObjectURL(url);
15
15
  } }),
16
- selectedFile.type.includes("image") && (React.createElement(Button, { variant: "borderless", color: "blue", type: "button", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "Eye", fill: "currentColor" }) }, onClick: async (e) => {
16
+ selectedFile.type.includes("image") && (React.createElement(Button, { variant: "borderless", color: "blue", type: "button", icon: { element: React.createElement(ARIcon, { icon: "Eye-Fill", fill: "currentColor" }) }, onClick: async (e) => {
17
17
  e.stopPropagation();
18
18
  const base64 = await handleFileToBase64(selectedFile);
19
19
  const newTab = window.open();
20
20
  newTab?.document.write(`<img src="${base64}" title="${selectedFile.name}" alt="${selectedFile.name}" />`);
21
21
  } })),
22
- React.createElement(Button, { variant: "borderless", color: "red", type: "button", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "Trash", fill: "currentColor" }) }, onClick: (e) => {
22
+ React.createElement(Button, { variant: "borderless", color: "red", type: "button", icon: { element: React.createElement(ARIcon, { icon: "Trash-Fill", fill: "currentColor" }) }, onClick: (e) => {
23
23
  e.stopPropagation();
24
24
  handleFileRemove(selectedFile);
25
25
  } }))));
@@ -21,7 +21,7 @@ const Dropzone = ({ selectedFiles, validationErrors = [], handleFileToBase64, ha
21
21
  handleSelectFile(file);
22
22
  } },
23
23
  message && (React.createElement("div", { className: "error" },
24
- React.createElement(ARIcon, { variant: "fill", icon: "ExclamationDiamond", fill: "var(--white)" }),
24
+ React.createElement(ARIcon, { icon: "ExclamationDiamond-Fill", fill: "var(--white)" }),
25
25
  React.createElement("span", null, message))),
26
26
  React.createElement(Buttons, { selectedFile: file, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }),
27
27
  file.type.includes("image") ? (React.createElement("img", { src: base64 })) : (React.createElement(ARIcon, { icon: fileInfo.icon ?? "Document", fill: "var(--white)", size: 32 }))));
@@ -8,7 +8,7 @@ const List = ({ selectedFiles, validationErrors = [], handleFileToBase64, handle
8
8
  const message = validationErrors.find((v) => v.fileName === selectedFile.name)?.message;
9
9
  return (React.createElement("li", null,
10
10
  message && (React.createElement("div", { className: "error" },
11
- React.createElement(ARIcon, { variant: "fill", icon: "ExclamationDiamond", fill: "var(--white)" }),
11
+ React.createElement(ARIcon, { icon: "ExclamationDiamond-Fill", fill: "var(--white)" }),
12
12
  React.createElement("span", null, message))),
13
13
  React.createElement(Buttons, { selectedFile: selectedFile, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }),
14
14
  React.createElement("span", { className: "file-name" }, selectedFile.name),
@@ -197,7 +197,7 @@ const Upload = ({ text, file, onChange, allowedTypes, maxSize, type = "list", mu
197
197
  case "list":
198
198
  return renderUploadFile({
199
199
  children: (React.createElement(React.Fragment, null,
200
- React.createElement(Button, { variant: "outlined", color: "gray", icon: { element: React.createElement(ARIcon, { variant: "fill", icon: "CloudUpload" }) }, onClick: () => {
200
+ React.createElement(Button, { variant: "outlined", color: "gray", icon: { element: React.createElement(ARIcon, { icon: "CloudUpload-Fill" }) }, onClick: () => {
201
201
  if (_input.current)
202
202
  _input.current.click();
203
203
  } }, text && React.createElement("span", null, text)),
@@ -213,7 +213,7 @@ const Upload = ({ text, file, onChange, allowedTypes, maxSize, type = "list", mu
213
213
  React.createElement(Dropzone, { selectedFiles: selectedFiles.length === 0 && selectedFile ? [selectedFile] : selectedFiles, validationErrors: validationErrors, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }),
214
214
  !selectedFile && selectedFiles.length === 0 && (React.createElement(React.Fragment, null,
215
215
  React.createElement("div", { className: "upload" },
216
- React.createElement(ARIcon, { variant: "fill", icon: "CloudUpload", size: 32 }),
216
+ React.createElement(ARIcon, { icon: "CloudUpload-Fill", size: 32 }),
217
217
  React.createElement("div", { className: "properies" },
218
218
  allowedTypes && (React.createElement("div", { className: "allow-types" }, allowedTypes?.map((allowedType) => allowedType.split("/")[1].toLocaleUpperCase()).join(", "))),
219
219
  maxSize && React.createElement("div", { className: "max-size" },
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { Icons, IconVariants } from "../../libs/types";
2
+ import { Icons } from "../../libs/types";
3
3
  declare class Icon {
4
4
  private _stroke?;
5
5
  private _strokeWidth?;
6
6
  constructor(stroke?: string, strokeWidth?: number);
7
- Compiler: (variant: IconVariants, icon: Icons) => React.JSX.Element | null;
7
+ Compiler: (icon: Icons) => React.JSX.Element | null;
8
8
  }
9
9
  export default Icon;