albinasoft-ui-package 1.0.37 → 1.0.39

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.
@@ -15,6 +15,7 @@ interface CustomAutocompleteInputProps {
15
15
  tooltip?: string;
16
16
  className?: string;
17
17
  style?: React.CSSProperties;
18
+ lang?: string;
18
19
  fetchOptions: (query: string) => string[];
19
20
  onSelect: (value: string) => void;
20
21
  }
@@ -65,11 +65,11 @@ var react_bootstrap_1 = require("react-bootstrap");
65
65
  require("../assets/css/custom-autocomplete-input.css");
66
66
  var CustomInput_1 = __importStar(require("./CustomInput"));
67
67
  var CustomAutocompleteInput = function (_a) {
68
- var id = _a.id, name = _a.name, label = _a.label, value = _a.value, placeholder = _a.placeholder, _b = _a.required, required = _b === void 0 ? false : _b, description = _a.description, errorMessage = _a.errorMessage, conditionalErrorVisible = _a.conditionalErrorVisible, conditionalErrorMessage = _a.conditionalErrorMessage, _c = _a.disabled, disabled = _c === void 0 ? false : _c, tooltip = _a.tooltip, _d = _a.className, className = _d === void 0 ? '' : _d, style = _a.style, fetchOptions = _a.fetchOptions, onSelect = _a.onSelect;
69
- var _e = (0, react_1.useState)(value || ''), inputValue = _e[0], setInputValue = _e[1];
70
- var _f = (0, react_1.useState)(null), selectedValue = _f[0], setSelectedValue = _f[1];
71
- var _g = (0, react_1.useState)([]), options = _g[0], setOptions = _g[1];
72
- var _h = (0, react_1.useState)(false), isDropdownVisible = _h[0], setIsDropdownVisible = _h[1];
68
+ var id = _a.id, name = _a.name, label = _a.label, value = _a.value, placeholder = _a.placeholder, _b = _a.required, required = _b === void 0 ? false : _b, description = _a.description, errorMessage = _a.errorMessage, conditionalErrorVisible = _a.conditionalErrorVisible, conditionalErrorMessage = _a.conditionalErrorMessage, _c = _a.disabled, disabled = _c === void 0 ? false : _c, tooltip = _a.tooltip, _d = _a.className, className = _d === void 0 ? '' : _d, style = _a.style, _e = _a.lang, lang = _e === void 0 ? 'tr-TR' : _e, fetchOptions = _a.fetchOptions, onSelect = _a.onSelect;
69
+ var _f = (0, react_1.useState)(value || ''), inputValue = _f[0], setInputValue = _f[1];
70
+ var _g = (0, react_1.useState)(null), selectedValue = _g[0], setSelectedValue = _g[1];
71
+ var _h = (0, react_1.useState)([]), options = _h[0], setOptions = _h[1];
72
+ var _j = (0, react_1.useState)(false), isDropdownVisible = _j[0], setIsDropdownVisible = _j[1];
73
73
  var dropdownRef = (0, react_1.useRef)(null);
74
74
  // Input değiştiğinde fetchOptions çağır
75
75
  var handleInputChange = function (e) { return __awaiter(void 0, void 0, void 0, function () {
@@ -130,11 +130,24 @@ var CustomAutocompleteInput = function (_a) {
130
130
  // };
131
131
  }, []);
132
132
  var highlightMatch = function (option, query) {
133
- // Kullanıcı girişini regex için güvenli hale getir
134
- var escapedQuery = query.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
135
- var regex = new RegExp("(".concat(escapedQuery, ")"), 'gi');
136
- var highlighted = option.replace(regex, '<mark>$1</mark>');
137
- return highlighted;
133
+ if (!query)
134
+ return option;
135
+ var collator = new Intl.Collator(lang, { sensitivity: 'accent' });
136
+ var startIndex = -1;
137
+ for (var i = 0; i <= option.length - query.length; i++) {
138
+ var substring = option.substring(i, i + query.length);
139
+ if (collator.compare(substring, query) === 0) {
140
+ startIndex = i;
141
+ break;
142
+ }
143
+ }
144
+ if (startIndex === -1) {
145
+ return option;
146
+ }
147
+ var beforeMatch = option.slice(0, startIndex);
148
+ var match = option.slice(startIndex, startIndex + query.length);
149
+ var afterMatch = option.slice(startIndex + query.length);
150
+ return "".concat(beforeMatch, "<mark>").concat(match, "</mark>").concat(afterMatch);
138
151
  };
139
152
  return (react_1.default.createElement("div", { className: "autocomplete-container ".concat(className), style: style },
140
153
  react_1.default.createElement("div", { className: "form-group" },
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { TableColumn } from 'react-data-table-component';
3
+ import './CustomDataTable.css';
4
+ interface DataTableProps {
5
+ columns: TableColumn<any>[];
6
+ data: any[];
7
+ loading?: boolean;
8
+ paginationPerPage?: number;
9
+ paginationTotalRows?: number;
10
+ selectableRows?: boolean;
11
+ paginationServer?: boolean;
12
+ addPagination?: boolean;
13
+ noDataComponent?: string;
14
+ fixedHeaderScrollHeight?: string;
15
+ handleRowSelected?: (selected: {
16
+ allSelected: boolean;
17
+ selectedCount: number;
18
+ selectedRows: any[];
19
+ }) => void;
20
+ handlePageChange?: (page: number) => void;
21
+ conditionalRowStyles?: any[];
22
+ }
23
+ interface DataTableHandle {
24
+ validate: () => boolean;
25
+ showError: () => void;
26
+ hideError: () => void;
27
+ getValue: () => string | string[];
28
+ setValue: (value: string | string[]) => void;
29
+ }
30
+ declare const CustomDataTable: React.ForwardRefExoticComponent<DataTableProps & React.RefAttributes<DataTableHandle>>;
31
+ export default CustomDataTable;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
26
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
27
+ if (ar || !(i in from)) {
28
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
29
+ ar[i] = from[i];
30
+ }
31
+ }
32
+ return to.concat(ar || Array.prototype.slice.call(from));
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ var react_1 = __importStar(require("react"));
39
+ var react_data_table_component_1 = __importDefault(require("react-data-table-component"));
40
+ var LangTranslations_1 = require("../LangComponents/LangTranslations");
41
+ var LanguageContext_1 = require("../LangComponents/LanguageContext");
42
+ require("./CustomDataTable.css");
43
+ var CustomDataTable = (0, react_1.forwardRef)(function (_a, ref) {
44
+ var _b = _a.columns, columns = _b === void 0 ? [] : _b, _c = _a.data, data = _c === void 0 ? [] : _c, _d = _a.loading, loading = _d === void 0 ? false : _d, _e = _a.paginationPerPage, paginationPerPage = _e === void 0 ? 20 : _e, paginationTotalRows = _a.paginationTotalRows, _f = _a.fixedHeaderScrollHeight, fixedHeaderScrollHeight = _f === void 0 ? "500px" : _f, _g = _a.selectableRows, selectableRows = _g === void 0 ? false : _g, _h = _a.paginationServer, paginationServer = _h === void 0 ? false : _h, _j = _a.addPagination, addPagination = _j === void 0 ? true : _j, handleRowSelected = _a.handleRowSelected, handlePageChange = _a.handlePageChange, _k = _a.conditionalRowStyles, conditionalRowStyles = _k === void 0 ? [] : _k, noDataComponent = _a.noDataComponent;
45
+ var lang = (0, LanguageContext_1.useLanguage)().lang;
46
+ var _l = (0, react_1.useState)([]), selectedRows = _l[0], setSelectedRows = _l[1];
47
+ // Expose methods to parent via ref
48
+ (0, react_1.useImperativeHandle)(ref, function () { return ({
49
+ validate: function () { return selectedRows.length > 0; },
50
+ showError: function () {
51
+ console.error('Validation error: No rows selected!');
52
+ },
53
+ hideError: function () {
54
+ console.log('Error hidden');
55
+ },
56
+ getValue: function () { return selectedRows; },
57
+ setValue: function (value) {
58
+ if (typeof value === 'string') {
59
+ setSelectedRows([value]); // Tek bir string ise diziye çevirip ata
60
+ }
61
+ else {
62
+ setSelectedRows(value); // Zaten bir string[] ise direkt ata
63
+ }
64
+ },
65
+ }); });
66
+ // Default conditionalRowStyles to highlight selected rows
67
+ var defaultConditionalRowStyles = [
68
+ {
69
+ when: function (row) { return selectedRows.includes(row); },
70
+ style: {
71
+ backgroundColor: 'rgba(63, 195, 128, 0.9)',
72
+ color: 'white',
73
+ '&:hover': {
74
+ cursor: 'pointer',
75
+ },
76
+ },
77
+ },
78
+ ];
79
+ var mergedConditionalRowStyles = __spreadArray(__spreadArray([], defaultConditionalRowStyles, true), conditionalRowStyles, true);
80
+ var paginationOptions = {
81
+ rowsPerPageText: (0, LangTranslations_1.getTranslation)('Sayfadaki veri sayısı', lang) || 'Sayfa başına veri sayısı',
82
+ rangeSeparatorText: ' - ',
83
+ selectAllRowsItem: true,
84
+ selectAllRowsItemText: (0, LangTranslations_1.getTranslation)('Tümü', lang) || 'Tümü',
85
+ };
86
+ return (react_1.default.createElement("div", { className: "data-table-wrapper" },
87
+ react_1.default.createElement(react_data_table_component_1.default, { columns: columns, data: data, pagination: addPagination, paginationPerPage: paginationPerPage, paginationRowsPerPageOptions: [paginationPerPage, paginationPerPage * 2, paginationPerPage * 3], paginationTotalRows: paginationTotalRows, paginationServer: paginationServer, onChangePage: handlePageChange, highlightOnHover: true, pointerOnHover: true, fixedHeader: true, fixedHeaderScrollHeight: fixedHeaderScrollHeight, progressPending: loading, progressComponent: react_1.default.createElement("div", { className: "loading-container" },
88
+ react_1.default.createElement("div", { className: "loading-spinner" })), noDataComponent: react_1.default.createElement("div", null, noDataComponent !== null && noDataComponent !== void 0 ? noDataComponent : (0, LangTranslations_1.getTranslation)('noDataFound', lang)), selectableRows: selectableRows, onSelectedRowsChange: function (selected) {
89
+ setSelectedRows(selected.selectedRows);
90
+ if (handleRowSelected)
91
+ handleRowSelected(selected);
92
+ }, conditionalRowStyles: mergedConditionalRowStyles, paginationComponentOptions: paginationOptions })));
93
+ });
94
+ exports.default = CustomDataTable;
@@ -142,7 +142,7 @@ var CustomText = function (_a) {
142
142
  var urlRegex = /(https?:\/\/[^\s]+|www\.[^\s]+)/g; // URL'leri algılayan RegEx
143
143
  var parts = text.split(urlRegex);
144
144
  return parts.map(function (part, index) {
145
- return urlRegex.test(part) ? (react_1.default.createElement("a", { key: index, href: part.startsWith('http') ? part : "https://".concat(part), target: "_blank", rel: "noopener noreferrer" },
145
+ return urlRegex.test(part) ? (react_1.default.createElement("a", { key: index, href: part.startsWith('http') ? part : "https://".concat(part), target: "_blank", rel: "noopener noreferrer", style: { wordBreak: 'break-all' } },
146
146
  linkText || part.replace(/https?:\/\/|www\.|\/$/g, ''),
147
147
  " ")) : (part);
148
148
  });
@@ -52,9 +52,9 @@ var CustomTimeline = function (_a) {
52
52
  element.description && (react_1.default.createElement("div", { className: "mb-3" },
53
53
  react_1.default.createElement(CustomText_1.default, { value: element.description, textType: CustomText_1.TextType.PARAGRAPH, fontSize: CustomText_1.FontSize.XS, lineHeight: CustomText_1.LineHeight.XXS }))),
54
54
  element.additionalInfos &&
55
- element.additionalInfos.map(function (info, infoIndex) { return (react_1.default.createElement("div", { key: infoIndex, className: "alert alert-secondary d-flex align-items-center", style: { width: "fit-content" } },
56
- react_1.default.createElement(fa_1.FaInfoCircle, { size: 50 }),
57
- react_1.default.createElement("div", { className: "ms-3" },
55
+ element.additionalInfos.map(function (info, infoIndex) { return (react_1.default.createElement("div", { key: infoIndex, className: "alert alert-secondary align-items-center flex-wrap" },
56
+ react_1.default.createElement(fa_1.FaInfoCircle, { size: 30, className: "flex-shrink-0" }),
57
+ react_1.default.createElement("div", { className: "ms-3 flex-grow-1" },
58
58
  react_1.default.createElement(CustomText_1.default, { value: info.time, textType: CustomText_1.TextType.PARAGRAPH, fontSize: CustomText_1.FontSize.XXS, lineHeight: CustomText_1.LineHeight.M, italic: true }),
59
59
  react_1.default.createElement(CustomText_1.default, { value: info.description, textType: CustomText_1.TextType.PARAGRAPH, fontSize: CustomText_1.FontSize.XS, lineHeight: CustomText_1.LineHeight.XXS })))); }))); }))));
60
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "albinasoft-ui-package",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {