ar-design 0.2.35 → 0.2.37
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/components/data-display/table/_index.js +3 -1
- package/dist/components/data-display/table/index.js +3 -1
- package/dist/components/form/text-editor/IProps.d.ts +1 -0
- package/dist/components/form/text-editor/index.d.ts +2 -2
- package/dist/components/form/text-editor/index.js +27 -18
- package/dist/libs/core/application/hooks/index.js +1 -3
- package/dist/libs/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -334,7 +334,9 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
|
|
|
334
334
|
React.createElement("div", null, c.filters.map((filter, fIndex) => {
|
|
335
335
|
const name = typeof c.key !== "object" ? String(c.key) : String(c.key.field);
|
|
336
336
|
return (React.createElement("div", null,
|
|
337
|
-
React.createElement(Checkbox, { ref: (element) => (_filterCheckboxItems.current[fIndex] = element), label: filter.text, name: name, status: "primary",
|
|
337
|
+
React.createElement(Checkbox, { ref: (element) => (_filterCheckboxItems.current[fIndex] = element), label: filter.text, name: name, status: "primary",
|
|
338
|
+
// value={filter.value}
|
|
339
|
+
checked: checkboxSelectedParams?.[name]?.includes(String(filter.value)), onChange: async (event) => await handleCheckboxChange(event) })));
|
|
338
340
|
}))), windowBlur: true },
|
|
339
341
|
React.createElement(Button, { variant: "borderless", icon: { element: React.createElement(ARIcon, { icon: "Filter", stroke: "var(--primary)", size: 16 }) } }))))));
|
|
340
342
|
})))),
|
|
@@ -369,7 +369,9 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
|
|
|
369
369
|
c.filters && (React.createElement(Popover, { content: React.createElement("div", null, c.filters.map((filter, fIndex) => {
|
|
370
370
|
const name = typeof c.key !== "object" ? String(c.key) : String(c.key.field);
|
|
371
371
|
return (React.createElement("div", null,
|
|
372
|
-
React.createElement(Checkbox, { ref: (element) => (_filterCheckboxItems.current[fIndex] = element), label: filter.text, name: name, status: "primary",
|
|
372
|
+
React.createElement(Checkbox, { ref: (element) => (_filterCheckboxItems.current[fIndex] = element), label: filter.text, name: name, status: "primary",
|
|
373
|
+
// value={filter.value}
|
|
374
|
+
checked: checkboxSelectedParams?.[name]?.includes(String(filter.value)), onChange: async (event) => await handleCheckboxChange(event) })));
|
|
373
375
|
})), windowBlur: true },
|
|
374
376
|
React.createElement(Button, { variant: "borderless", icon: { element: React.createElement(ARIcon, { icon: "Filter", stroke: "var(--primary)", size: 16 }) } })))))));
|
|
375
377
|
})))),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
3
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
4
|
-
import Button from "../button";
|
|
5
|
-
import { ARIcon } from "../../icons";
|
|
6
2
|
import "../../../assets/css/components/form/text-editor/styles.css";
|
|
7
|
-
|
|
3
|
+
import { ARIcon } from "../../icons";
|
|
4
|
+
import Button from "../button";
|
|
5
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
6
|
+
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
7
|
+
const TextEditor = ({ name, value, onChange, placeholder, height, multilang, validation }) => {
|
|
8
8
|
// refs
|
|
9
9
|
const _container = useRef(null);
|
|
10
10
|
const _arIframe = useRef(null);
|
|
@@ -64,8 +64,10 @@ const TextEditor = ({ name, value, onChange, placeholder, height, validation })
|
|
|
64
64
|
if (selection && selection.rangeCount > 0)
|
|
65
65
|
range = selection.getRangeAt(0);
|
|
66
66
|
// Eğer içeriği kendimiz değiştirmedikse ve gelen value farklıysa, içeriği güncelle
|
|
67
|
-
if (iframeDocument.body.innerHTML !== value)
|
|
68
|
-
iframeDocument.body.innerHTML = value || `<p>${placeholder ?? ""}</p>`;
|
|
67
|
+
if (iframeDocument.body.innerHTML !== value) {
|
|
68
|
+
// iframeDocument.body.innerHTML = value || `<p>${placeholder ?? ""}</p>`;
|
|
69
|
+
iframeDocument.body.innerHTML = value ?? "";
|
|
70
|
+
}
|
|
69
71
|
// Cursor (caret) konumunu geri yükle
|
|
70
72
|
if (range) {
|
|
71
73
|
selection?.removeAllRanges();
|
|
@@ -76,25 +78,27 @@ const TextEditor = ({ name, value, onChange, placeholder, height, validation })
|
|
|
76
78
|
// Iframe yüklendikten sonra çalışacaktır.
|
|
77
79
|
if (!iframe)
|
|
78
80
|
return;
|
|
79
|
-
const
|
|
80
|
-
if (!
|
|
81
|
-
return;
|
|
81
|
+
const _iframeDocument = iframe.contentDocument || iframe.contentWindow?.document;
|
|
82
|
+
if (!_iframeDocument)
|
|
83
|
+
return;
|
|
84
|
+
setIframeDocument(_iframeDocument);
|
|
85
|
+
_iframeDocument.designMode = "on";
|
|
82
86
|
// Herhangi bir değişikliği izlemek için MutationObserver kullan
|
|
83
87
|
const observer = new MutationObserver((mutationsList) => {
|
|
84
88
|
mutationsList.forEach(() => {
|
|
85
|
-
|
|
89
|
+
_iframeDocument?.body.innerHTML === "<br>"
|
|
90
|
+
? onChangeRef.current(undefined)
|
|
91
|
+
: onChangeRef.current(_iframeDocument.body.innerHTML);
|
|
86
92
|
});
|
|
87
93
|
});
|
|
88
|
-
setIframeDocument(iframeDocument);
|
|
89
|
-
iframeDocument.designMode = "on";
|
|
90
94
|
// Observer'ı body üzerinde başlat
|
|
91
|
-
observer.observe(
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
observer.observe(_iframeDocument.body, { childList: true, subtree: true, characterData: true, attributes: true });
|
|
96
|
+
_iframeDocument.body.addEventListener("focus", handleFocus);
|
|
97
|
+
_iframeDocument.body.addEventListener("blur", handleBlur);
|
|
94
98
|
return () => {
|
|
95
99
|
observer.disconnect();
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
_iframeDocument?.body.removeEventListener("focus", handleFocus);
|
|
101
|
+
_iframeDocument?.body.removeEventListener("blur", handleBlur);
|
|
98
102
|
};
|
|
99
103
|
}, [iframe]);
|
|
100
104
|
useEffect(() => {
|
|
@@ -108,6 +112,11 @@ const TextEditor = ({ name, value, onChange, placeholder, height, validation })
|
|
|
108
112
|
}
|
|
109
113
|
};
|
|
110
114
|
}, []);
|
|
115
|
+
const onChangeRef = useRef(onChange);
|
|
116
|
+
// onChange değiştiğinde ref'i güncelle
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
onChangeRef.current = onChange;
|
|
119
|
+
}, [onChange]);
|
|
111
120
|
return (React.createElement("div", { ref: _container, className: "ar-text-editor" },
|
|
112
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: {
|
|
113
122
|
text: tooltip,
|
|
@@ -88,10 +88,8 @@ export const useValidation = function (data, params, step) {
|
|
|
88
88
|
paramsShape(param, currentData);
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
|
-
if (!value)
|
|
92
|
-
return;
|
|
93
91
|
// Subkey sadece bir seviye ise, doğrudan kullanılır.
|
|
94
|
-
paramsShape(param, value[param.subkey]);
|
|
92
|
+
paramsShape(param, value?.[param.subkey]);
|
|
95
93
|
}
|
|
96
94
|
}
|
|
97
95
|
else {
|