@sydsoft/base 1.38.0 → 1.40.0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isDev } from
|
|
1
|
+
import { isDev } from '../baseFunctions';
|
|
2
2
|
var keys = [3, 5, 8, 11, 15, 22];
|
|
3
3
|
export var encData = function (data) {
|
|
4
4
|
try {
|
|
@@ -11,8 +11,8 @@ export var encData = function (data) {
|
|
|
11
11
|
return newData_1;
|
|
12
12
|
}
|
|
13
13
|
catch (e) {
|
|
14
|
-
isDev && console.log(
|
|
15
|
-
return
|
|
14
|
+
isDev && console.log('ERROR => encData =>', e);
|
|
15
|
+
return '';
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
export var decData = function (data) {
|
|
@@ -32,7 +32,7 @@ export var decData = function (data) {
|
|
|
32
32
|
return JSON.parse(utf8DecodedString);
|
|
33
33
|
}
|
|
34
34
|
catch (e) {
|
|
35
|
-
isDev && console.log(
|
|
36
|
-
return
|
|
35
|
+
isDev && console.log('ERROR => decData =>', e);
|
|
36
|
+
return '';
|
|
37
37
|
}
|
|
38
38
|
};
|
|
@@ -7,17 +7,17 @@ import { Icon } from '../icon';
|
|
|
7
7
|
import { Button } from './Button';
|
|
8
8
|
import styles from './styles/SearchableInput.module.css';
|
|
9
9
|
var Component = function (_a, forwardedRef) {
|
|
10
|
-
var _b = _a.autoCompleteList, autoCompleteList = _b === void 0 ? [] : _b, _c = _a.isDataFromApi, isDataFromApi = _c === void 0 ? false : _c, onText = _a.onText, onSelect = _a.onSelect, onLoad = _a.onLoad, onChange = _a.onChange, _d = _a.newCreate, newCreate = _d === void 0 ? false : _d, name = _a.name, value = _a.value, itemComponent = _a.itemComponent, inputRef = _a.inputRef, _e = _a.valueKey, valueKey = _e === void 0 ? 'value' : _e, _f = _a.labelKey, labelKey = _f === void 0 ? 'label' : _f, placeholder = _a.placeholder, endAdornment = _a.endAdornment, style = _a.style, disabled = _a.disabled, parentInputValue = _a.parentInputValue, _g = _a.listPositionRelative, listPositionRelative = _g === void 0 ? false : _g, other = __rest(_a, ["autoCompleteList", "isDataFromApi", "onText", "onSelect", "onLoad", "onChange", "newCreate", "name", "value", "itemComponent", "inputRef", "valueKey", "labelKey", "placeholder", "endAdornment", "style", "disabled", "parentInputValue", "listPositionRelative"]);
|
|
10
|
+
var _b = _a.autoCompleteList, autoCompleteList = _b === void 0 ? [] : _b, _c = _a.isDataFromApi, isDataFromApi = _c === void 0 ? false : _c, onText = _a.onText, onSelect = _a.onSelect, onLoad = _a.onLoad, onChange = _a.onChange, _d = _a.newCreate, newCreate = _d === void 0 ? false : _d, name = _a.name, value = _a.value, itemComponent = _a.itemComponent, inputRef = _a.inputRef, _e = _a.valueKey, valueKey = _e === void 0 ? 'value' : _e, _f = _a.labelKey, labelKey = _f === void 0 ? 'label' : _f, placeholder = _a.placeholder, endAdornment = _a.endAdornment, style = _a.style, disabled = _a.disabled, parentInputValue = _a.parentInputValue, _g = _a.listPositionRelative, listPositionRelative = _g === void 0 ? false : _g, _h = _a.loadingMessage, loadingMessage = _h === void 0 ? 'Lütfen bekleyiniz...' : _h, _j = _a.notFoundMessage, notFoundMessage = _j === void 0 ? 'Kayıt bulunamadı...' : _j, other = __rest(_a, ["autoCompleteList", "isDataFromApi", "onText", "onSelect", "onLoad", "onChange", "newCreate", "name", "value", "itemComponent", "inputRef", "valueKey", "labelKey", "placeholder", "endAdornment", "style", "disabled", "parentInputValue", "listPositionRelative", "loadingMessage", "notFoundMessage"]);
|
|
11
11
|
var refMain = useRef(null);
|
|
12
12
|
var refInput = useRef(null);
|
|
13
13
|
var refComponentInput = useRef(null);
|
|
14
14
|
var refList = useRef(null);
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
15
|
+
var _k = useState([]), data = _k[0], setData = _k[1];
|
|
16
|
+
var _l = useState(''), text = _l[0], setText = _l[1]; //Inputta görünen
|
|
17
|
+
var _m = useState(''), filter = _m[0], setFilter = _m[1]; // Filtrelemeye tabi tutulan
|
|
18
|
+
var _o = useState(false), open = _o[0], setOpen = _o[1];
|
|
19
|
+
var _p = useState(isDataFromApi && autoCompleteList.length === 0), loading = _p[0], setLoading = _p[1];
|
|
20
|
+
var _q = useState({ created: false }), newItemCreate = _q[0], setNewItemCreate = _q[1];
|
|
21
21
|
useImperativeHandle(forwardedRef, function () { return ({
|
|
22
22
|
open: function () {
|
|
23
23
|
setOpen(true);
|
|
@@ -314,7 +314,7 @@ var Component = function (_a, forwardedRef) {
|
|
|
314
314
|
}
|
|
315
315
|
setScrollPosition();
|
|
316
316
|
};
|
|
317
|
-
return (_jsxs("div", { ref: refMain, className: styles.searchableInputComponent, onKeyDown: onKeyDown, style: style, children: [_jsx(Input, __assign({}, other, { name: name, value: text, inputRef: refInput, componentRef: refComponentInput, onFocus: function () { return setOpen(true); }, onChange: Change, endAdornment: !disabled && (_jsxs("div", { style: { marginRight: 5 }, tabIndex: -1, children: [_jsx(Button, { title: 'Temizle', tabIndex: -1, hidden: !(text && text.length > 0), onClick: function () { return clear(true, true); }, onlyIcon: _jsx(Icon, { name: 'close', style: { color: '#444' } }) }), endAdornment, _jsx(Button, { tabIndex: -1, hidden: !(data.length > 0), onClick: function () { return setOpen(!open); }, onlyIcon: _jsx(Icon, { name: open ? 'keyboard_arrow_up' : 'keyboard_arrow_down', style: { color: '#444' } }) })] })), placeholder: loading ? 'Lütfen bekleyiniz...' : placeholder, loading: loading, disabled: disabled, propsInput: __assign(__assign({}, other === null || other === void 0 ? void 0 : other.propsInput), { autoComplete: 'off' }) })), open && (_jsx("div", { className: 'listDiv', "data-relative": listPositionRelative, children: _jsxs("ul", { ref: refList, className: "list ".concat(open ? 'open' : ''), children: [(filteredData.length === 0 || loading) && _jsx("div", { className: "message ".concat(loading ? 'loading' : ''), children: loading ?
|
|
317
|
+
return (_jsxs("div", { ref: refMain, className: styles.searchableInputComponent, onKeyDown: onKeyDown, style: style, children: [_jsx(Input, __assign({}, other, { name: name, value: text, inputRef: refInput, componentRef: refComponentInput, onFocus: function () { return setOpen(true); }, onChange: Change, endAdornment: !disabled && (_jsxs("div", { style: { marginRight: 5 }, tabIndex: -1, children: [_jsx(Button, { title: 'Temizle', tabIndex: -1, hidden: !(text && text.length > 0), onClick: function () { return clear(true, true); }, onlyIcon: _jsx(Icon, { name: 'close', style: { color: '#444' } }) }), endAdornment, _jsx(Button, { tabIndex: -1, hidden: !(data.length > 0), onClick: function () { return setOpen(!open); }, onlyIcon: _jsx(Icon, { name: open ? 'keyboard_arrow_up' : 'keyboard_arrow_down', style: { color: '#444' } }) })] })), placeholder: loading ? 'Lütfen bekleyiniz...' : placeholder, loading: loading, disabled: disabled, propsInput: __assign(__assign({}, other === null || other === void 0 ? void 0 : other.propsInput), { autoComplete: 'off' }) })), open && (_jsx("div", { className: 'listDiv', "data-relative": listPositionRelative, children: _jsxs("ul", { ref: refList, className: "list ".concat(open ? 'open' : ''), children: [(filteredData.length === 0 || loading) && _jsx("div", { className: "message ".concat(loading ? 'loading' : ''), children: loading ? loadingMessage : notFoundMessage }), filteredData.map(function (item, key) {
|
|
318
318
|
var itemValue = item[valueKey];
|
|
319
319
|
var itemLabel = item[labelKey];
|
|
320
320
|
return (_jsxs("li", { className: "item ".concat(itemValue === value ? 'active' : ''), "data-value": itemValue, "data-label": itemLabel, onClick: function () { return setValue(item, false); }, children: [item.create && _jsx("span", { className: 'newCreate', children: "Yeni Olu\u015Ftur: " }), itemComponent ? itemComponent(item) : itemLabel] }, key));
|