ar-design 0.3.13 → 0.3.15
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/form/upload/list.css +13 -3
- package/dist/components/data-display/table/Editable.js +7 -0
- package/dist/components/form/input-number/index.js +3 -3
- package/dist/components/form/upload/List.d.ts +2 -1
- package/dist/components/form/upload/List.js +15 -16
- package/dist/components/form/upload/Props.d.ts +1 -1
- package/dist/components/form/upload/index.js +5 -2
- package/dist/libs/core/service/Api.js +1 -0
- package/dist/libs/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
flex-wrap: nowrap;
|
|
6
|
-
gap:
|
|
6
|
+
gap: 0.75rem;
|
|
7
7
|
width: 100%;
|
|
8
8
|
height: 100%;
|
|
9
9
|
|
|
@@ -13,9 +13,16 @@
|
|
|
13
13
|
|
|
14
14
|
> ul {
|
|
15
15
|
display: flex;
|
|
16
|
-
flex-
|
|
16
|
+
flex-wrap: wrap;
|
|
17
17
|
gap: 0.75rem;
|
|
18
18
|
|
|
19
|
+
&.list {
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
}
|
|
22
|
+
&.grid {
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
> li {
|
|
20
27
|
position: relative;
|
|
21
28
|
display: flex;
|
|
@@ -39,7 +46,7 @@
|
|
|
39
46
|
border: solid 1px transparent;
|
|
40
47
|
}
|
|
41
48
|
&:hover::before {
|
|
42
|
-
background-color: rgba(var(--black-rgb), 0.
|
|
49
|
+
background-color: rgba(var(--black-rgb), 0.25);
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
&:has(> .error) {
|
|
@@ -116,6 +123,7 @@
|
|
|
116
123
|
color: var(--white);
|
|
117
124
|
font-size: 0.65rem;
|
|
118
125
|
font-weight: 700;
|
|
126
|
+
text-wrap: nowrap;
|
|
119
127
|
|
|
120
128
|
> .size-type {
|
|
121
129
|
background-color: rgba(var(--black-rgb), 0.5);
|
|
@@ -126,6 +134,7 @@
|
|
|
126
134
|
color: var(--primary);
|
|
127
135
|
font-size: 0.65rem;
|
|
128
136
|
font-weight: 700;
|
|
137
|
+
text-wrap: nowrap;
|
|
129
138
|
}
|
|
130
139
|
}
|
|
131
140
|
|
|
@@ -136,6 +145,7 @@
|
|
|
136
145
|
color: var(--black);
|
|
137
146
|
font-size: 0.65rem;
|
|
138
147
|
font-weight: 700;
|
|
148
|
+
text-wrap: nowrap;
|
|
139
149
|
}
|
|
140
150
|
}
|
|
141
151
|
}
|
|
@@ -3,6 +3,7 @@ import React, { useState } from "react";
|
|
|
3
3
|
import Input from "../../form/input";
|
|
4
4
|
import DatePicker from "../../form/date-picker";
|
|
5
5
|
import Select from "../../form/select";
|
|
6
|
+
import InputNumber from "../../form/input-number";
|
|
6
7
|
const Editable = function ({ c, item, index, onEditable }) {
|
|
7
8
|
const key = c.key;
|
|
8
9
|
const itemValue = item[c.key];
|
|
@@ -20,6 +21,12 @@ const Editable = function ({ c, item, index, onEditable }) {
|
|
|
20
21
|
setValue(value);
|
|
21
22
|
onEditable({ ...item, [key]: c.editable?.type === "number" ? Number(value) : value }, index);
|
|
22
23
|
} }));
|
|
24
|
+
case "input-number":
|
|
25
|
+
return (React.createElement(InputNumber, { variant: "borderless", name: c.key, value: value, onChange: (event) => {
|
|
26
|
+
const { value } = event.target;
|
|
27
|
+
setValue(value);
|
|
28
|
+
onEditable({ ...item, [key]: c.editable?.type === "number" ? Number(value) : value }, index);
|
|
29
|
+
} }));
|
|
23
30
|
case "date-picker":
|
|
24
31
|
return (React.createElement(DatePicker, { variant: "borderless", value: value, onChange: (value) => {
|
|
25
32
|
setValue(value);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import Input from "../input";
|
|
4
|
-
const InputNumber = ({ name, value, onChange, digits, placeholder, disabled }) => {
|
|
4
|
+
const InputNumber = ({ variant, color, name, value, onChange, digits, placeholder, validation, disabled, }) => {
|
|
5
5
|
// refs
|
|
6
6
|
const _firstLoad = useRef(false);
|
|
7
7
|
const _input = useRef(null);
|
|
@@ -77,11 +77,11 @@ const InputNumber = ({ name, value, onChange, digits, placeholder, disabled }) =
|
|
|
77
77
|
_firstLoad.current = true;
|
|
78
78
|
}
|
|
79
79
|
}, [value]);
|
|
80
|
-
return (React.createElement(Input, { ref: _input, name: name, value: _value ?? "", type: "text", inputMode: "decimal", onChange: (event) => {
|
|
80
|
+
return (React.createElement(Input, { ref: _input, name: name, variant: variant, color: color, value: _value ?? "", type: "text", inputMode: "decimal", onChange: (event) => {
|
|
81
81
|
// Disabled gelmesi durumunda işlem yapmasına izin verme...
|
|
82
82
|
if (disabled)
|
|
83
83
|
return;
|
|
84
84
|
handleChange(event);
|
|
85
|
-
}, onClick: handleClick, onKeyUp: handleKeyUp, placeholder: placeholder }));
|
|
85
|
+
}, onClick: handleClick, onKeyUp: handleKeyUp, placeholder: placeholder, validation: validation }));
|
|
86
86
|
};
|
|
87
87
|
export default InputNumber;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ValidationError } from ".";
|
|
3
3
|
interface IProps {
|
|
4
|
+
type: "list" | "grid";
|
|
4
5
|
selectedFiles: File[];
|
|
5
6
|
validationErrors?: ValidationError[];
|
|
6
7
|
handleFileToBase64: (file: File) => Promise<string>;
|
|
7
8
|
handleFileRemove: (fileToRemove: File) => void;
|
|
8
9
|
}
|
|
9
|
-
declare const _default: React.MemoExoticComponent<({ selectedFiles, validationErrors, handleFileToBase64, handleFileRemove }: IProps) => React.JSX.Element>;
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ type, selectedFiles, validationErrors, handleFileToBase64, handleFileRemove }: IProps) => React.JSX.Element>;
|
|
10
11
|
export default _default;
|
|
@@ -2,21 +2,20 @@ import React, { memo } from "react";
|
|
|
2
2
|
import { ARIcon } from "../../icons";
|
|
3
3
|
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
4
4
|
import Buttons from "./Buttons";
|
|
5
|
-
const List = ({ selectedFiles, validationErrors = [], handleFileToBase64, handleFileRemove }) => {
|
|
6
|
-
return (React.createElement(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
React.createElement("
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}))));
|
|
5
|
+
const List = ({ type, selectedFiles, validationErrors = [], handleFileToBase64, handleFileRemove }) => {
|
|
6
|
+
return (React.createElement("ul", { className: type }, selectedFiles.map((selectedFile) => {
|
|
7
|
+
const message = validationErrors.find((v) => v.fileName === selectedFile.name)?.message;
|
|
8
|
+
return (React.createElement("li", null,
|
|
9
|
+
message && (React.createElement("div", { className: "error" },
|
|
10
|
+
React.createElement(ARIcon, { icon: "ExclamationDiamond-Fill", fill: "var(--white)" }),
|
|
11
|
+
React.createElement("span", null, message))),
|
|
12
|
+
React.createElement(Buttons, { selectedFile: selectedFile, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }),
|
|
13
|
+
React.createElement("span", { className: "file-name" }, selectedFile.name),
|
|
14
|
+
React.createElement("div", null,
|
|
15
|
+
React.createElement("span", { className: "file-size" },
|
|
16
|
+
(selectedFile.size / 1024).toFixed(3),
|
|
17
|
+
React.createElement("span", { className: "size-type" }, "KB")),
|
|
18
|
+
React.createElement("span", { className: "file-type" }, Utils.GetFileTypeInformation(selectedFile.type).readableType))));
|
|
19
|
+
})));
|
|
21
20
|
};
|
|
22
21
|
export default memo(List);
|
|
@@ -147,13 +147,14 @@ const Upload = ({ text, files, onChange, allowedTypes, maxSize, type = "list", m
|
|
|
147
147
|
}, []);
|
|
148
148
|
switch (type) {
|
|
149
149
|
case "list":
|
|
150
|
+
case "grid":
|
|
150
151
|
return renderUploadFile({
|
|
151
152
|
children: (React.createElement(React.Fragment, null,
|
|
152
|
-
React.createElement(Button, { variant: "outlined", color: "gray", icon: { element: React.createElement(ARIcon, { icon: "CloudUpload-Fill" }) }, onClick: () => {
|
|
153
|
+
React.createElement(Button, { type: "button", variant: "outlined", color: "gray", icon: { element: React.createElement(ARIcon, { icon: "CloudUpload-Fill" }) }, onClick: () => {
|
|
153
154
|
if (_input.current)
|
|
154
155
|
_input.current.click();
|
|
155
156
|
} }, text && React.createElement("span", null, text)),
|
|
156
|
-
React.createElement(List, { selectedFiles: selectedFiles ?? [], validationErrors: validationErrors, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }))),
|
|
157
|
+
React.createElement(List, { type: type, selectedFiles: selectedFiles ?? [], validationErrors: validationErrors, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }))),
|
|
157
158
|
});
|
|
158
159
|
case "dropzone":
|
|
159
160
|
return renderUploadFile({
|
|
@@ -174,6 +175,8 @@ const Upload = ({ text, files, onChange, allowedTypes, maxSize, type = "list", m
|
|
|
174
175
|
"MB"))),
|
|
175
176
|
text && React.createElement("span", null, text)))))),
|
|
176
177
|
});
|
|
178
|
+
default:
|
|
179
|
+
return null;
|
|
177
180
|
}
|
|
178
181
|
};
|
|
179
182
|
export default Upload;
|
|
@@ -8,6 +8,7 @@ class Api {
|
|
|
8
8
|
this._host = values.host || (typeof window !== "undefined" ? window.location.origin : "");
|
|
9
9
|
this._core = values.core || "";
|
|
10
10
|
this._init = values.init;
|
|
11
|
+
this._token = values.token;
|
|
11
12
|
// Url
|
|
12
13
|
this._url = `${this._host}/${this._core ? this._core + "/" : ""}`;
|
|
13
14
|
}
|
|
@@ -33,7 +33,7 @@ export type TableColumnType<T> = {
|
|
|
33
33
|
filters?: Option[];
|
|
34
34
|
render?: (item: T) => React.ReactNode;
|
|
35
35
|
editable?: {
|
|
36
|
-
type: "string" | "number" | "date-picker" | "single-select" | "multiple-select";
|
|
36
|
+
type: "string" | "number" | "input-number" | "date-picker" | "single-select" | "multiple-select";
|
|
37
37
|
options?: Option[];
|
|
38
38
|
method?: () => void | Promise<void>;
|
|
39
39
|
};
|