karsten-design-system 2.0.15 → 2.0.17
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/index.js
CHANGED
|
@@ -4499,13 +4499,13 @@ function Paginator({ rowsPerPageOptions = [10, 20, 30, 50, 100], onRowsPerPageCh
|
|
|
4499
4499
|
});
|
|
4500
4500
|
},
|
|
4501
4501
|
RowsPerPageDropdown: (options) => {
|
|
4502
|
-
return (jsxs("div", { className: "flex items-center gap-3 ml-4", children: [jsx("span", { className: "text-sm font-roboto text-
|
|
4502
|
+
return (jsxs("div", { className: "flex items-center gap-3 ml-4", children: [jsx("span", { className: "text-sm font-roboto text-primary dark:text-light-500", children: lang.rowsPerPage }), jsx(RowsPerPageDropdown, { value: options.value, options: rowsPerPageOptions, onChange: (e) => {
|
|
4503
4503
|
options.onChange(e);
|
|
4504
4504
|
const customEvent = e;
|
|
4505
4505
|
if (onRowsPerPageChange && customEvent.rows !== options.value) {
|
|
4506
4506
|
onRowsPerPageChange(customEvent.rows);
|
|
4507
4507
|
}
|
|
4508
|
-
} }), jsxs("span", { className: "text-sm font-roboto text-
|
|
4508
|
+
} }), jsxs("span", { className: "text-sm font-roboto text-primary dark:text-light-500", children: [lang.total, " ", formatNumber(props.totalRecords)] })] }));
|
|
4509
4509
|
},
|
|
4510
4510
|
};
|
|
4511
4511
|
return (jsx(Paginator$1, { ...props, template: template, className: "bg-light-500 dark:bg-dark-100" }));
|
|
@@ -4769,7 +4769,7 @@ const getFromLocalStorage = (localStorageKey, key) => {
|
|
|
4769
4769
|
return {};
|
|
4770
4770
|
}
|
|
4771
4771
|
};
|
|
4772
|
-
function Table({ columns, data, totalRecords, actions = [], actionsHeaderClassName = '', actionsColumnsClassName = '', rowsPerPage = 10, onPageChange, onRowsPerPageChange, isPaginated = true, isLoading = false, onFilterChange, onSortChange, actionLabel = 'AÇÕES', systemLanguage = 'pt', isShowCustomizeColumns = false, onApplyColumns, isPermanentFilterEnabled = false, localStorageKey, isExpandable = false, subTableColumns, subTableDataKey = 'subItems', subTableActions = [], subTableActionLabel = 'Ações', subTableActionsHeaderClassName = 'text-right', subTableActionsColumnsClassName = '', }) {
|
|
4772
|
+
function Table({ columns, data, totalRecords, actions = [], actionsHeaderClassName = '', actionsColumnsClassName = '', rowsPerPage = 10, onPageChange, onRowsPerPageChange, isPaginated = true, isLoading = false, onFilterChange, onSortChange, actionLabel = 'AÇÕES', systemLanguage = 'pt', isShowCustomizeColumns = false, onApplyColumns, isPermanentFilterEnabled = false, localStorageKey, isExpandable = false, canExpand, subTableColumns, subTableDataKey = 'subItems', subTableActions = [], subTableActionLabel = 'Ações', subTableActionsHeaderClassName = 'text-right', subTableActionsColumnsClassName = '', }) {
|
|
4773
4773
|
const [sortDirection, setSortDirection] = useState({});
|
|
4774
4774
|
const [sortedData, setSortedData] = useState(data);
|
|
4775
4775
|
const [currentPage, setCurrentPage] = useState(1);
|
|
@@ -5161,12 +5161,13 @@ function Table({ columns, data, totalRecords, actions = [], actionsHeaderClassNa
|
|
|
5161
5161
|
(actions.length > 0 ? 1 : 0) +
|
|
5162
5162
|
(isExpandable ? 1 : 0), className: "p-6 text-center bg-gray-50 dark:bg-dark-200", children: jsx("div", { className: "py-2 px-4 flex justify-center items-center gap-2", children: jsx(Spinner, { size: "lg" }) }) }) })) : sortedData.length > 0 ? (sortedData.map((row, index) => {
|
|
5163
5163
|
const isExpanded = expandedRows.has(index);
|
|
5164
|
+
const rowCanExpand = canExpand ? canExpand(row) : true;
|
|
5164
5165
|
const subData = isExpandable && subTableDataKey && row[subTableDataKey]
|
|
5165
5166
|
? row[subTableDataKey]
|
|
5166
5167
|
: [];
|
|
5167
5168
|
return (jsxs(Fragment$1, { children: [jsxs("tr", { className: clsx(index % 2 === 0
|
|
5168
5169
|
? 'bg-light-300 dark:bg-dark-500'
|
|
5169
|
-
: 'bg-light-500 dark:bg-dark-100', 'text-primary text-base dark:text-light-500'), children: [isExpandable && (jsx("td", { className: "text-center", children: jsx("button", { onClick: () => toggleRow(index), "aria-label": isExpanded ? 'Recolher linha' : 'Expandir linha', className: "hover:opacity-75 transition-opacity", children: jsx("i", { className: clsx('pi text-sm cursor-pointer', isExpanded ? 'pi-angle-down' : 'pi-angle-right') }) }) })), visibleColumns.map((column) => {
|
|
5170
|
+
: 'bg-light-500 dark:bg-dark-100', 'text-primary text-base dark:text-light-500'), children: [isExpandable && (jsx("td", { className: "text-center", children: rowCanExpand ? (jsx("button", { onClick: () => toggleRow(index), "aria-label": isExpanded ? 'Recolher linha' : 'Expandir linha', className: "hover:opacity-75 transition-opacity", children: jsx("i", { className: clsx('pi text-sm cursor-pointer', isExpanded ? 'pi-angle-down' : 'pi-angle-right') }) })) : (jsx("span", { className: "inline-block w-4" })) })), visibleColumns.map((column) => {
|
|
5170
5171
|
const value = getNestedValue(row, column.dataIndex);
|
|
5171
5172
|
return (jsx("td", { className: clsx('p-2 text-sm text-left', typeof column.style === 'function'
|
|
5172
5173
|
? column.style(getNestedValue(row, column.dataIndex), row)
|
|
@@ -5195,6 +5196,7 @@ function Table({ columns, data, totalRecords, actions = [], actionsHeaderClassNa
|
|
|
5195
5196
|
}, "aria-label": action?.ariaLabel || action.label, role: "button", children: jsx(Tooltip, { text: action?.label, children: icon }) }, idx));
|
|
5196
5197
|
}) }) }))] }, `main-${index}`), isExpandable &&
|
|
5197
5198
|
isExpanded &&
|
|
5199
|
+
rowCanExpand &&
|
|
5198
5200
|
subTableColumns &&
|
|
5199
5201
|
subTableDataKey && (jsx("tr", { className: clsx(index % 2 === 0
|
|
5200
5202
|
? 'bg-light-300 dark:bg-dark-500'
|