ar-design 0.2.44 → 0.2.45

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.
@@ -8,20 +8,23 @@
8
8
  display: flex;
9
9
  flex-direction: row;
10
10
  gap: 0.25rem;
11
+ margin-top: -1px;
12
+ border: solid 1px transparent;
13
+ border-left-color: var(--gray-300);
14
+ border-right-color: var(--gray-300);
15
+ border-bottom-color: var(--gray-300);
11
16
  }
12
17
  .ar-text-editor > iframe {
13
18
  width: 100%;
14
- border-bottom: none;
15
19
  border-bottom-left-radius: 0 !important;
16
20
  border-bottom-right-radius: 0 !important;
17
21
  }
18
22
  .ar-text-editor > .resize {
19
23
  position: relative;
20
- background-color: var(--gray-200);
24
+ background-color: var(--gray-100);
21
25
  width: 100%;
22
26
  height: 1.5rem;
23
27
  border: solid 1px transparent;
24
- border-top-color: var(--gray-400);
25
28
  border-left-color: var(--gray-300);
26
29
  border-right-color: var(--gray-300);
27
30
  border-bottom-color: var(--gray-300);
@@ -36,7 +39,7 @@
36
39
  left: 50%;
37
40
  transform: translate(-50%, -50%);
38
41
  background-color: var(--gray-500);
39
- width: 2rem;
42
+ width: 1.5rem;
40
43
  height: 0.1rem;
41
44
  box-shadow: 0px -5px 0 0px var(--gray-500), 0px 5px 0 0px var(--gray-500);
42
45
  }
@@ -7,6 +7,8 @@ export type SearchedParam = {
7
7
  type ImportActionType = {
8
8
  tooltip: string;
9
9
  allowedTypes?: AllowedTypes[];
10
+ prefixItem?: React.ReactNode;
11
+ suffixItem?: React.ReactNode;
10
12
  onClick: (formData: FormData | undefined, files: File[]) => void;
11
13
  };
12
14
  type CreateActionType = {
@@ -28,7 +30,7 @@ interface IProps<T> extends IChildren {
28
30
  pagination?: {
29
31
  totalRecords: number;
30
32
  perPage: number;
31
- onChange: (currentPage: number) => void;
33
+ onChange?: (currentPage: number) => void;
32
34
  };
33
35
  config?: {
34
36
  isServerSide?: boolean;
@@ -52,7 +52,7 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
52
52
  filterCleaner: () => {
53
53
  if (config.isServerSide) {
54
54
  setSearchedParams({});
55
- pagination && pagination.onChange(1);
55
+ // pagination && pagination.onChange(1);
56
56
  }
57
57
  else {
58
58
  setSearchedText({});
@@ -133,7 +133,7 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
133
133
  _searchTimeOut.current = setTimeout(() => {
134
134
  setSearchedParams((prev) => ({ ...prev, [event.target.name]: event.target.value }));
135
135
  setCurrentPage(1);
136
- pagination && pagination.onChange(1);
136
+ // pagination && pagination.onChange(1);
137
137
  }, 750);
138
138
  }
139
139
  else {
@@ -234,7 +234,7 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
234
234
  setSearchedText(checkboxSelectedParams);
235
235
  }
236
236
  setCurrentPage(1);
237
- pagination && pagination.onChange(1);
237
+ // pagination && pagination.onChange(1);
238
238
  // Filters...
239
239
  // setSelectedfilterCheckboxItems((prev) => {
240
240
  // debugger;
@@ -401,7 +401,7 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
401
401
  pagination?.perPage ?? getData().length,
402
402
  " agreement")),
403
403
  React.createElement(Pagination, { totalRecords: pagination.totalRecords, currentPage: currentPage, perPage: pagination.perPage, onChange: (currentPage) => {
404
- config.isServerSide && pagination.onChange(currentPage);
404
+ // config.isServerSide && pagination.onChange(currentPage);
405
405
  setCurrentPage(currentPage);
406
406
  } })))));
407
407
  });
@@ -113,7 +113,8 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
113
113
  clearTimeout(_searchTimeOut.current);
114
114
  _searchTimeOut.current = setTimeout(() => {
115
115
  setSearchedParams((prev) => ({ ...prev, [event.target.name]: event.target.value }));
116
- pagination && pagination.onChange(1);
116
+ if (pagination && pagination.onChange)
117
+ pagination.onChange(1);
117
118
  }, 750);
118
119
  }
119
120
  else {
@@ -287,7 +288,8 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
287
288
  setSearchedText((prev) => ({ ...prev, ...checkboxSelectedParams }));
288
289
  }
289
290
  setCurrentPage(1);
290
- pagination && pagination.onChange(1);
291
+ if (pagination && pagination.onChange)
292
+ pagination.onChange(1);
291
293
  }, [checkboxSelectedParams]);
292
294
  useEffect(() => {
293
295
  if (!selections)
@@ -307,10 +309,13 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
307
309
  React.createElement("h3", null, title),
308
310
  description && React.createElement("h5", null, description)),
309
311
  React.createElement("div", { className: "actions" }, actions && (React.createElement(React.Fragment, null,
310
- 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) => {
311
- setFormData(formData);
312
- setFiles(files);
313
- }, multiple: true }), onConfirm: (confirm) => {
312
+ 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(React.Fragment, null,
313
+ actions.import.prefixItem,
314
+ React.createElement(Upload, { text: "Belge Y\u00FCkleyin", allowedTypes: actions.import.allowedTypes, file: files, onChange: (formData, files) => {
315
+ setFormData(formData);
316
+ setFiles(files);
317
+ }, multiple: true }),
318
+ actions.import.suffixItem), onConfirm: (confirm) => {
314
319
  if (!confirm) {
315
320
  setFiles([]);
316
321
  return;
@@ -391,7 +396,8 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
391
396
  pagination?.perPage ?? getData.length,
392
397
  " agreement")),
393
398
  React.createElement(Pagination, { totalRecords: config.isServerSide ? pagination.totalRecords : totalRecords ?? 0, currentPage: currentPage, perPage: pagination.perPage, onChange: (currentPage) => {
394
- config.isServerSide && pagination.onChange(currentPage);
399
+ if (config.isServerSide && pagination && pagination.onChange)
400
+ pagination.onChange(currentPage);
395
401
  setCurrentPage(currentPage);
396
402
  } })))));
397
403
  });
@@ -8,6 +8,8 @@ const TextEditor = ({ name, value, onChange, placeholder, height, multilang, val
8
8
  // refs
9
9
  const _container = useRef(null);
10
10
  const _arIframe = useRef(null);
11
+ const _onChange = useRef(onChange);
12
+ const _onChangeTimeOut = useRef(null);
11
13
  // states
12
14
  const [iframe, setIframe] = useState(null);
13
15
  const [iframeDocument, setIframeDocument] = useState(undefined);
@@ -74,6 +76,10 @@ const TextEditor = ({ name, value, onChange, placeholder, height, multilang, val
74
76
  selection?.addRange(range);
75
77
  }
76
78
  }, [value, iframeDocument]);
79
+ useEffect(() => {
80
+ // onChange değiştiğinde ref'i güncelle
81
+ _onChange.current = onChange;
82
+ }, [onChange]);
77
83
  useEffect(() => {
78
84
  // Iframe yüklendikten sonra çalışacaktır.
79
85
  if (!iframe)
@@ -85,11 +91,15 @@ const TextEditor = ({ name, value, onChange, placeholder, height, multilang, val
85
91
  _iframeDocument.designMode = "on";
86
92
  // Herhangi bir değişikliği izlemek için MutationObserver kullan
87
93
  const observer = new MutationObserver((mutationsList) => {
88
- mutationsList.forEach(() => {
89
- _iframeDocument?.body.innerHTML === "<br>"
90
- ? onChangeRef.current(undefined)
91
- : onChangeRef.current(_iframeDocument.body.innerHTML);
92
- });
94
+ if (_onChangeTimeOut.current)
95
+ clearTimeout(_onChangeTimeOut.current);
96
+ _onChangeTimeOut.current = setTimeout(() => {
97
+ mutationsList.forEach(() => {
98
+ _iframeDocument?.body.innerHTML === "<br>"
99
+ ? _onChange.current(undefined)
100
+ : _onChange.current(_iframeDocument.body.innerHTML);
101
+ });
102
+ }, 750);
93
103
  });
94
104
  // Observer'ı body üzerinde başlat
95
105
  observer.observe(_iframeDocument.body, { childList: true, subtree: true, characterData: true, attributes: true });
@@ -112,16 +122,11 @@ const TextEditor = ({ name, value, onChange, placeholder, height, multilang, val
112
122
  }
113
123
  };
114
124
  }, []);
115
- const onChangeRef = useRef(onChange);
116
- // onChange değiştiğinde ref'i güncelle
117
- useEffect(() => {
118
- onChangeRef.current = onChange;
119
- }, [onChange]);
120
125
  return (React.createElement("div", { ref: _container, className: "ar-text-editor" },
121
- React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }) => (React.createElement(Button, { key: command, type: "button", variant: "borderless", status: "secondary", icon: { element: React.createElement(ARIcon, { icon: icon, size: 18, fill: "var(--gray-700)" }) }, tooltip: {
126
+ React.createElement("iframe", { ref: _arIframe, name: name, className: _iframeClassName.map((c) => c).join(" "), height: height }),
127
+ React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }) => (React.createElement(Button, { key: command, type: "button", variant: "borderless", status: "secondary", border: { radius: "none" }, icon: { element: React.createElement(ARIcon, { icon: icon, size: 18, fill: "var(--gray-700)" }) }, tooltip: {
122
128
  text: tooltip,
123
129
  }, onClick: () => execCommand(command) })))),
124
- React.createElement("iframe", { ref: _arIframe, name: name, className: _iframeClassName.map((c) => c).join(" "), height: height }),
125
130
  React.createElement("div", { className: "resize", onMouseDown: handleMouseDown }),
126
131
  validation?.text && React.createElement("span", { className: "validation" }, validation.text)));
127
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.44",
3
+ "version": "0.2.45",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",