hrm_ui_lib 2.0.3 → 2.1.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.
- package/assets/styles/styles.css +525 -0
- package/assets/styles/styles.scss +3 -1
- package/components/Alert/Alert.js +1 -1
- package/components/Alert/index.js +1 -1
- package/components/Avatar/Avatar.js +1 -1
- package/components/Avatar/AvatarGroup.js +1 -1
- package/components/Avatar/index.js +1 -1
- package/components/Button/Button.js +1 -1
- package/components/Button/index.js +1 -1
- package/components/Checkbox/Checkbox.js +1 -1
- package/components/Checkbox/index.js +1 -1
- package/components/Copy/Copy.js +1 -1
- package/components/Copy/index.js +1 -1
- package/components/Counter/Counter.js +1 -1
- package/components/Counter/index.js +1 -1
- package/components/DatePicker/CustomHeader/CustomHeader.js +1 -1
- package/components/DatePicker/RangeDatePicker/RangeDatePicker.js +1 -1
- package/components/DatePicker/RangeDatePicker/RangeDatePickerDesktop.js +1 -1
- package/components/DatePicker/RangeDatePicker/RangeDatePickerMobile.js +1 -1
- package/components/DatePicker/RangeDatePicker/index.js +1 -1
- package/components/DatePicker/SimpleDatePicker/SimpleDatePicker.js +1 -1
- package/components/DatePicker/SimpleDatePicker/SimpleDatePickerDesktop.js +1 -1
- package/components/DatePicker/SimpleDatePicker/SimpleDatePickerMobile.js +1 -1
- package/components/DatePicker/SimpleDatePicker/index.js +1 -1
- package/components/DatePicker/TimePicker/MobileModalContent.js +1 -1
- package/components/DatePicker/TimePicker/TimePicker.js +1 -1
- package/components/DatePicker/TimePicker/TimePickerDesktop.js +1 -1
- package/components/DatePicker/TimePicker/TimePickerMobile.js +1 -1
- package/components/DatePicker/TimePicker/index.js +1 -1
- package/components/DatePicker/index.js +1 -1
- package/components/Empty/Empty.js +1 -1
- package/components/Empty/index.js +1 -1
- package/components/FileUpload/DropzoneFileUpload/DropzoneFileUpload.js +1 -1
- package/components/FileUpload/DropzoneFileUpload/ErrorItem.js +1 -1
- package/components/FileUpload/DropzoneFileUpload/PreviewItem.js +1 -1
- package/components/FileUpload/DropzoneFileUpload/helpers.js +1 -1
- package/components/FileUpload/DropzoneFileUpload/index.js +1 -1
- package/components/FileUpload/FileUpload.js +1 -1
- package/components/FileUpload/UploadItems.js +1 -1
- package/components/FileUpload/index.js +1 -1
- package/components/FormContainer/FormContainer.js +1 -1
- package/components/FormContainer/index.js +1 -1
- package/components/FormField/FormField.js +1 -1
- package/components/FormField/index.js +1 -1
- package/components/Input/Input.js +1 -1
- package/components/Input/index.js +1 -1
- package/components/Menu/Menu.js +1 -1
- package/components/Menu/NestedMenu.js +1 -1
- package/components/Menu/index.js +1 -1
- package/components/Modal/Modal.js +1 -1
- package/components/Modal/ModalConfirmation.js +1 -1
- package/components/Modal/ModalContent.js +1 -1
- package/components/Modal/index.js +1 -1
- package/components/More/More.js +1 -1
- package/components/More/index.js +1 -1
- package/components/Popover/Popover.js +1 -1
- package/components/Popover/PopoverMobile.js +1 -1
- package/components/Popover/index.js +1 -1
- package/components/Radio/RadioGroup.js +1 -1
- package/components/Radio/index.js +1 -1
- package/components/SVGIcons/IconChevronDoubleLeft.d.ts +4 -0
- package/components/SVGIcons/IconChevronDoubleLeft.js +29 -0
- package/components/SVGIcons/IconChevronDoubleRight.d.ts +4 -0
- package/components/SVGIcons/IconChevronDoubleRight.js +29 -0
- package/components/SVGIcons/index.d.ts +2 -0
- package/components/SVGIcons/index.js +2 -0
- package/components/Select/ButtonSelect/ButtonSelect.js +1 -1
- package/components/Select/FilterSelect/FilterDropdown.js +1 -1
- package/components/Select/FilterSelect/FilterGroupDropdown.js +1 -1
- package/components/Select/FilterSelect/FilterSelect.js +1 -1
- package/components/Select/MultiSelect/MobileWrapper.js +1 -1
- package/components/Select/MultiSelect/MultiBase/MultiBase.js +1 -1
- package/components/Select/MultiSelect/MultiSelect.js +1 -1
- package/components/Select/MultiSelect/MultiSelectGrouped/MultiSelectGrouped.js +1 -1
- package/components/Select/MultiSelect/MultiSelectWithTabs/MultiSelectWithTabs.js +1 -1
- package/components/Select/MultiSelect/OptionsWrapper.js +1 -1
- package/components/Select/NestedSelect/NestedSelect.js +1 -1
- package/components/Select/Select/Select.js +1 -1
- package/components/Select/Select/SelectDesktop/index.js +1 -1
- package/components/Select/Select/SelectMobile/MobileTopContent.js +1 -1
- package/components/Select/Select/SelectMobile/index.js +1 -1
- package/components/Select/SharedComponents/Actions.js +1 -1
- package/components/Select/SharedComponents/ButtonSelectWrapper/ButtonSelectWrapper.js +1 -1
- package/components/Select/SharedComponents/ContentTop.js +1 -1
- package/components/Select/SharedComponents/Footer.js +1 -1
- package/components/Select/SharedComponents/InputSelectWrapper/InputSelectWrapper.js +1 -1
- package/components/Select/SharedComponents/index.js +1 -1
- package/components/Select/index.js +1 -1
- package/components/SideSheet/Footer/Footer.js +1 -1
- package/components/SideSheet/SideSheet.js +1 -1
- package/components/SideSheet/index.js +1 -1
- package/components/Snackbar/Snackbar.js +1 -1
- package/components/Snackbar/index.js +1 -1
- package/components/Switcher/Switcher.js +1 -1
- package/components/Switcher/index.js +1 -1
- package/components/Table/Header.js +1 -1
- package/components/Table/IndeterminateCheckbox.js +1 -1
- package/components/Table/Row.js +1 -1
- package/components/Table/Table.js +1 -1
- package/components/Table/index.js +1 -1
- package/components/Table/utils.js +1 -1
- package/components/TableV2/AdvancedPagination.d.ts +8 -0
- package/components/TableV2/AdvancedPagination.js +271 -0
- package/components/TableV2/ColumnHeader.d.ts +9 -0
- package/components/TableV2/ColumnHeader.js +64 -0
- package/components/TableV2/ColumnSettings.d.ts +9 -0
- package/components/TableV2/ColumnSettings.js +164 -0
- package/components/TableV2/IndeterminateCheckbox.d.ts +13 -0
- package/components/TableV2/IndeterminateCheckbox.js +87 -0
- package/components/TableV2/Table.d.ts +3 -0
- package/components/TableV2/Table.js +319 -0
- package/components/TableV2/constants/index.d.ts +6 -0
- package/components/TableV2/constants/index.js +23 -0
- package/components/TableV2/hooks/useTableColumnSettings.d.ts +2 -0
- package/components/TableV2/hooks/useTableColumnSettings.js +20 -0
- package/components/TableV2/hooks/useTableControl.d.ts +11 -0
- package/components/TableV2/hooks/useTableControl.js +303 -0
- package/components/TableV2/index.d.ts +3 -0
- package/components/TableV2/index.js +131 -0
- package/components/TableV2/loadTableSettings.d.ts +2 -0
- package/components/TableV2/loadTableSettings.js +18 -0
- package/components/TableV2/types.d.ts +70 -0
- package/components/TableV2/types.js +1 -0
- package/components/Textarea/Textarea.js +1 -1
- package/components/Textarea/index.js +1 -1
- package/helperComponents/GoToWebPage/GoToWebPage.js +1 -1
- package/helperComponents/OptionItem/OptionItem.js +1 -1
- package/helperComponents/OptionItem/index.js +1 -1
- package/helperComponents/index.js +1 -1
- package/helpers/check-authorization.js +1 -1
- package/helpers/index.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +16 -1
- package/package.json +5 -1
- /package/{Alert-V_kH4Snn.js → Alert-BslI0aA0.js} +0 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import { useReactTable, getPaginationRowModel, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
|
|
5
|
+
import { useSensors, useSensor, MouseSensor, TouchSensor } from '@dnd-kit/core';
|
|
6
|
+
import React, { useState, useMemo, useEffect } from 'react';
|
|
7
|
+
import { IndeterminateCheckbox } from '../IndeterminateCheckbox.js';
|
|
8
|
+
import { arrayMove } from '@dnd-kit/sortable';
|
|
9
|
+
import { loadTableSettings } from '../loadTableSettings.js';
|
|
10
|
+
import { useTableColumnSettings } from './useTableColumnSettings.js';
|
|
11
|
+
import { STORAGE_TYPE, TABLE_NAME_PREFIX } from '../constants/index.js';
|
|
12
|
+
import '../../../Alert-BslI0aA0.js';
|
|
13
|
+
import '@babel/runtime/helpers/extends';
|
|
14
|
+
import '../../Alert/consts.js';
|
|
15
|
+
import 'classnames';
|
|
16
|
+
import '../../Text/Text.js';
|
|
17
|
+
import '../../../utils/helpers.js';
|
|
18
|
+
import 'dayjs';
|
|
19
|
+
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
20
|
+
import '../../../helperComponents/Loader/Loader.js';
|
|
21
|
+
import '../../../consts/index.js';
|
|
22
|
+
import '../../../type/file-upload.js';
|
|
23
|
+
import '../../../hooks/useScreenSize.js';
|
|
24
|
+
import 'react-hook-form';
|
|
25
|
+
import 'react-dropzone';
|
|
26
|
+
import '../../SVGIcons/IconUpload.js';
|
|
27
|
+
import '../../FileUpload/types.js';
|
|
28
|
+
import '../../../helpers/format-date.js';
|
|
29
|
+
import '../../../helpers/locale.js';
|
|
30
|
+
import '../../../type/locale.js';
|
|
31
|
+
import '../../../helpers/storage.js';
|
|
32
|
+
import 'react-toastify';
|
|
33
|
+
import '../../../hooks/useGetIsMobile.js';
|
|
34
|
+
import 'framer-motion';
|
|
35
|
+
import '../../../helperComponents/AnimatePresenceWrapper/AnimatePresenceWrapper.js';
|
|
36
|
+
import '../../../hooks/useOnOutsideClick.js';
|
|
37
|
+
import '../../../hooks/useHideBodyScroll.js';
|
|
38
|
+
import '../../SVGIcons/IconDismiss.js';
|
|
39
|
+
import '../../Tooltip/types.js';
|
|
40
|
+
import '../../Tooltip/Tooltip.js';
|
|
41
|
+
import '../../../hooks/useGetTooltipStyles.js';
|
|
42
|
+
import '../../../hooks/useGetElemSizes.js';
|
|
43
|
+
import '../../../hooks/useGetElemPositions.js';
|
|
44
|
+
import '../../../hooks/useGetTooltipPosition.js';
|
|
45
|
+
import '../../../hooks/useHideOnScroll.js';
|
|
46
|
+
import 'react-syntax-highlighter';
|
|
47
|
+
import '../../Link/Link.js';
|
|
48
|
+
import '../../Popover/PopoverDesktop.js';
|
|
49
|
+
import '../../SVGIcons/IconInfo.js';
|
|
50
|
+
import '../../../helperComponents/IconDynamicComponent/IconDynamicComponent.js';
|
|
51
|
+
import '../../../helperComponents/IconDynamicComponent/constants.js';
|
|
52
|
+
import '@babel/runtime/helpers/typeof';
|
|
53
|
+
import '../../SVGIcons/IconDismissFilled.js';
|
|
54
|
+
import '../../SVGIcons/IconDelete.js';
|
|
55
|
+
import '../../FileUpload/DropzoneFileUpload/FilePreview.js';
|
|
56
|
+
import '../../Progress/Progress.js';
|
|
57
|
+
import '../../SVGIcons/IconArrowDownloadFilled.js';
|
|
58
|
+
import '../../../helpers/download-file.js';
|
|
59
|
+
import '../../Button/consts.js';
|
|
60
|
+
|
|
61
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
62
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
63
|
+
function useTableControl(_ref) {
|
|
64
|
+
var _savedSettings$column, _savedSettings$column2;
|
|
65
|
+
var withSelect = _ref.withSelect,
|
|
66
|
+
columns = _ref.columns,
|
|
67
|
+
data = _ref.data,
|
|
68
|
+
tableSettings = _ref.tableSettings,
|
|
69
|
+
_ref$totalCount = _ref.totalCount,
|
|
70
|
+
totalCount = _ref$totalCount === void 0 ? 0 : _ref$totalCount,
|
|
71
|
+
_ref$defaultPageSize = _ref.defaultPageSize,
|
|
72
|
+
defaultPageSize = _ref$defaultPageSize === void 0 ? 10 : _ref$defaultPageSize,
|
|
73
|
+
_ref$defaultPageIndex = _ref.defaultPageIndex,
|
|
74
|
+
defaultPageIndex = _ref$defaultPageIndex === void 0 ? 0 : _ref$defaultPageIndex,
|
|
75
|
+
_ref$defaultHiddenCol = _ref.defaultHiddenColumns,
|
|
76
|
+
defaultHiddenColumns = _ref$defaultHiddenCol === void 0 ? [] : _ref$defaultHiddenCol,
|
|
77
|
+
onSortChange = _ref.onSortChange,
|
|
78
|
+
onRowSelection = _ref.onRowSelection,
|
|
79
|
+
onColumnSizing = _ref.onColumnSizing,
|
|
80
|
+
onPaginationChange = _ref.onPaginationChange;
|
|
81
|
+
var shouldPersistToStorage = (tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.persistColumnSettings) === STORAGE_TYPE.LOCAL;
|
|
82
|
+
var shouldEmitExternal = (tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.persistColumnSettings) === STORAGE_TYPE.EXTERNAL;
|
|
83
|
+
var tableName = "".concat(TABLE_NAME_PREFIX, "-").concat(tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.tableName);
|
|
84
|
+
var savedSettings = shouldPersistToStorage && tableName ? loadTableSettings(tableName) : {
|
|
85
|
+
columnVisibility: {},
|
|
86
|
+
columnSizing: {},
|
|
87
|
+
columnOrder: []
|
|
88
|
+
};
|
|
89
|
+
var _useState = useState(null),
|
|
90
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
91
|
+
activeId = _useState2[0],
|
|
92
|
+
setActiveId = _useState2[1];
|
|
93
|
+
var _useState3 = useState([]),
|
|
94
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
95
|
+
sorting = _useState4[0],
|
|
96
|
+
setSorting = _useState4[1];
|
|
97
|
+
var _useState5 = useState({}),
|
|
98
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
99
|
+
rowSelection = _useState6[0],
|
|
100
|
+
setRowSelection = _useState6[1];
|
|
101
|
+
var _useState7 = useState((_savedSettings$column = savedSettings.columnSizing) !== null && _savedSettings$column !== void 0 ? _savedSettings$column : {}),
|
|
102
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
103
|
+
columnSizing = _useState8[0],
|
|
104
|
+
setColumnSizing = _useState8[1];
|
|
105
|
+
var _useState9 = useState(_objectSpread(_objectSpread({}, defaultHiddenColumns.reduce(function (acc, key) {
|
|
106
|
+
acc[key] = false;
|
|
107
|
+
return acc;
|
|
108
|
+
}, {})), savedSettings.columnVisibility)),
|
|
109
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
110
|
+
columnVisibility = _useState0[0],
|
|
111
|
+
setColumnVisibility = _useState0[1];
|
|
112
|
+
var _useState1 = useState({
|
|
113
|
+
pageIndex: defaultPageIndex,
|
|
114
|
+
pageSize: defaultPageSize
|
|
115
|
+
}),
|
|
116
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
117
|
+
pagination = _useState10[0],
|
|
118
|
+
setPagination = _useState10[1];
|
|
119
|
+
var memoizedColumns = useMemo(function () {
|
|
120
|
+
var columnsList = _toConsumableArray(columns).map(function (col) {
|
|
121
|
+
if (col.id === 'actions') {
|
|
122
|
+
return _objectSpread(_objectSpread({}, col), {}, {
|
|
123
|
+
enableColumnDragging: false,
|
|
124
|
+
enableSorting: false,
|
|
125
|
+
enableResizing: false,
|
|
126
|
+
enableHiding: false
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return col;
|
|
130
|
+
});
|
|
131
|
+
if (withSelect) {
|
|
132
|
+
columnsList.unshift({
|
|
133
|
+
id: 'select',
|
|
134
|
+
enableHiding: false,
|
|
135
|
+
enableColumnDragging: false,
|
|
136
|
+
enablePinning: true,
|
|
137
|
+
header: function header(_ref2) {
|
|
138
|
+
var table = _ref2.table;
|
|
139
|
+
return /*#__PURE__*/React.createElement(IndeterminateCheckbox, {
|
|
140
|
+
checked: table.getIsAllRowsSelected(),
|
|
141
|
+
indeterminate: table.getIsSomeRowsSelected(),
|
|
142
|
+
onChange: table.getToggleAllRowsSelectedHandler()
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
cell: function cell(_ref3) {
|
|
146
|
+
var row = _ref3.row;
|
|
147
|
+
return /*#__PURE__*/React.createElement(IndeterminateCheckbox, {
|
|
148
|
+
checked: row.getIsSelected(),
|
|
149
|
+
disabled: !row.getCanSelect(),
|
|
150
|
+
indeterminate: row.getIsSomeSelected(),
|
|
151
|
+
onChange: row.getToggleSelectedHandler()
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return columnsList;
|
|
157
|
+
}, [columns]);
|
|
158
|
+
var _useState11 = useState((_savedSettings$column2 = savedSettings.columnOrder) !== null && _savedSettings$column2 !== void 0 && _savedSettings$column2.length && savedSettings.columnOrder.length === memoizedColumns.length ? savedSettings.columnOrder : memoizedColumns.map(function (column) {
|
|
159
|
+
return column.id;
|
|
160
|
+
})),
|
|
161
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
162
|
+
columnOrder = _useState12[0],
|
|
163
|
+
setColumnOrder = _useState12[1];
|
|
164
|
+
var reorderedColumns = columnOrder.map(function (columnId) {
|
|
165
|
+
return memoizedColumns.find(function (col) {
|
|
166
|
+
return col.id === columnId;
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
var handleSortingChange = function handleSortingChange(updaterOrValue) {
|
|
170
|
+
var newSorting = typeof updaterOrValue === 'function' ? updaterOrValue(sorting) : updaterOrValue;
|
|
171
|
+
setSorting(newSorting);
|
|
172
|
+
var sortingEvent = newSorting.map(function (sort) {
|
|
173
|
+
var _sort$id;
|
|
174
|
+
return {
|
|
175
|
+
column: (_sort$id = sort.id) !== null && _sort$id !== void 0 ? _sort$id : '',
|
|
176
|
+
direction: sort.desc ? 'desc' : sort.id ? 'asc' : false,
|
|
177
|
+
timestamp: Date.now()
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
onSortChange === null || onSortChange === void 0 || onSortChange(sortingEvent);
|
|
181
|
+
};
|
|
182
|
+
var handleRowSelect = function handleRowSelect(updaterOrValue) {
|
|
183
|
+
var newSelectionRow = typeof updaterOrValue === 'function' ? updaterOrValue(rowSelection) : updaterOrValue;
|
|
184
|
+
setRowSelection(newSelectionRow);
|
|
185
|
+
onRowSelection === null || onRowSelection === void 0 || onRowSelection(newSelectionRow);
|
|
186
|
+
};
|
|
187
|
+
var handleColumnSizingChange = function handleColumnSizingChange(updaterOrValue) {
|
|
188
|
+
var newColumnSizing = typeof updaterOrValue === 'function' ? updaterOrValue(columnSizing) : updaterOrValue;
|
|
189
|
+
setColumnSizing(newColumnSizing);
|
|
190
|
+
onColumnSizing === null || onColumnSizing === void 0 || onColumnSizing(newColumnSizing);
|
|
191
|
+
};
|
|
192
|
+
var handlePaginationChange = function handlePaginationChange(updaterOrValue) {
|
|
193
|
+
var newPagination = typeof updaterOrValue === 'function' ? updaterOrValue(pagination) : updaterOrValue;
|
|
194
|
+
setPagination(newPagination);
|
|
195
|
+
onPaginationChange === null || onPaginationChange === void 0 || onPaginationChange(newPagination);
|
|
196
|
+
};
|
|
197
|
+
var hiddenColumns = defaultHiddenColumns === null || defaultHiddenColumns === void 0 ? void 0 : defaultHiddenColumns.reduce(function (acc, key) {
|
|
198
|
+
acc[key] = false;
|
|
199
|
+
return acc;
|
|
200
|
+
}, {});
|
|
201
|
+
var table = useReactTable({
|
|
202
|
+
data: data,
|
|
203
|
+
columns: reorderedColumns,
|
|
204
|
+
pageCount: Math.ceil(totalCount / pagination.pageSize),
|
|
205
|
+
state: {
|
|
206
|
+
sorting: sorting,
|
|
207
|
+
pagination: pagination,
|
|
208
|
+
columnOrder: columnOrder,
|
|
209
|
+
columnSizing: columnSizing,
|
|
210
|
+
rowSelection: rowSelection,
|
|
211
|
+
columnVisibility: _objectSpread(_objectSpread({}, hiddenColumns), columnVisibility),
|
|
212
|
+
columnPinning: {
|
|
213
|
+
left: ['select'],
|
|
214
|
+
right: ['actions']
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
defaultColumn: {
|
|
218
|
+
minSize: 200,
|
|
219
|
+
size: 150,
|
|
220
|
+
maxSize: 400
|
|
221
|
+
},
|
|
222
|
+
onPaginationChange: handlePaginationChange,
|
|
223
|
+
onColumnSizingChange: handleColumnSizingChange,
|
|
224
|
+
onSortingChange: handleSortingChange,
|
|
225
|
+
onRowSelectionChange: handleRowSelect,
|
|
226
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
227
|
+
getCoreRowModel: getCoreRowModel(),
|
|
228
|
+
getSortedRowModel: getSortedRowModel(),
|
|
229
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
230
|
+
columnResizeMode: 'onChange',
|
|
231
|
+
manualSorting: !!onSortChange,
|
|
232
|
+
manualPagination: !!onPaginationChange,
|
|
233
|
+
enableRowSelection: true,
|
|
234
|
+
enableColumnResizing: true,
|
|
235
|
+
isMultiSortEvent: function isMultiSortEvent() {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
useTableColumnSettings(table, tableName, shouldPersistToStorage);
|
|
240
|
+
var sensors = useSensors(useSensor(MouseSensor, {
|
|
241
|
+
activationConstraint: {
|
|
242
|
+
distance: 8
|
|
243
|
+
}
|
|
244
|
+
}), useSensor(TouchSensor, {
|
|
245
|
+
activationConstraint: {
|
|
246
|
+
delay: 200,
|
|
247
|
+
tolerance: 5
|
|
248
|
+
}
|
|
249
|
+
}));
|
|
250
|
+
var handleDragStart = function handleDragStart(event) {
|
|
251
|
+
setActiveId(event.active.id);
|
|
252
|
+
document.body.classList.add('select-none');
|
|
253
|
+
};
|
|
254
|
+
var handleDragEnd = function handleDragEnd(event) {
|
|
255
|
+
var active = event.active,
|
|
256
|
+
over = event.over;
|
|
257
|
+
if (over && active.id !== over.id) {
|
|
258
|
+
var oldIndex = columnOrder.indexOf(active.id);
|
|
259
|
+
var newIndex = columnOrder.indexOf(over.id);
|
|
260
|
+
var oldColumn = reorderedColumns[newIndex];
|
|
261
|
+
if ((oldColumn === null || oldColumn === void 0 ? void 0 : oldColumn.enableColumnDragging) === false) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
var newColumnOrder = arrayMove(columnOrder, oldIndex, newIndex);
|
|
265
|
+
setColumnOrder(newColumnOrder);
|
|
266
|
+
}
|
|
267
|
+
setActiveId(null);
|
|
268
|
+
document.body.classList.remove('select-none');
|
|
269
|
+
};
|
|
270
|
+
var handleDragCancel = function handleDragCancel() {
|
|
271
|
+
setActiveId(null);
|
|
272
|
+
document.body.classList.remove('select-none');
|
|
273
|
+
};
|
|
274
|
+
var activeHeader = activeId ? table.getHeaderGroups()[0].headers.find(function (header) {
|
|
275
|
+
return header.id === activeId;
|
|
276
|
+
}) : null;
|
|
277
|
+
useEffect(function () {
|
|
278
|
+
var settings = {
|
|
279
|
+
columnVisibility: columnVisibility,
|
|
280
|
+
columnOrder: columnOrder,
|
|
281
|
+
columnSizing: columnSizing
|
|
282
|
+
};
|
|
283
|
+
if (shouldPersistToStorage && tableSettings.tableName) {
|
|
284
|
+
var serialized = JSON.stringify(settings);
|
|
285
|
+
localStorage.setItem(tableName, serialized);
|
|
286
|
+
}
|
|
287
|
+
if (shouldEmitExternal) {
|
|
288
|
+
var _tableSettings$onColu;
|
|
289
|
+
tableSettings === null || tableSettings === void 0 || (_tableSettings$onColu = tableSettings.onColumnSettingsChange) === null || _tableSettings$onColu === void 0 || _tableSettings$onColu.call(tableSettings, settings);
|
|
290
|
+
}
|
|
291
|
+
}, [columnVisibility, columnOrder, columnSizing]);
|
|
292
|
+
return {
|
|
293
|
+
table: table,
|
|
294
|
+
activeHeader: activeHeader,
|
|
295
|
+
sensors: sensors,
|
|
296
|
+
memoizedColumns: memoizedColumns,
|
|
297
|
+
handleDragCancel: handleDragCancel,
|
|
298
|
+
handleDragEnd: handleDragEnd,
|
|
299
|
+
handleDragStart: handleDragStart
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export { useTableControl };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export { Table as TableV2 } from './Table.js';
|
|
2
|
+
export { ColumnSettings } from './ColumnSettings.js';
|
|
3
|
+
export { AdvancedPagination } from './AdvancedPagination.js';
|
|
4
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
5
|
+
import '@babel/runtime/helpers/toConsumableArray';
|
|
6
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
7
|
+
import 'react';
|
|
8
|
+
import '@tanstack/react-table';
|
|
9
|
+
import '@dnd-kit/core';
|
|
10
|
+
import '@dnd-kit/sortable';
|
|
11
|
+
import './ColumnHeader.js';
|
|
12
|
+
import '@babel/runtime/helpers/extends';
|
|
13
|
+
import '../SVGIcons/IconArrowDown.js';
|
|
14
|
+
import 'classnames';
|
|
15
|
+
import '../SVGIcons/IconArrowSort.js';
|
|
16
|
+
import '../SVGIcons/IconArrowUp.js';
|
|
17
|
+
import '../Text/Text.js';
|
|
18
|
+
import '../../utils/helpers.js';
|
|
19
|
+
import 'dayjs';
|
|
20
|
+
import 'react-loading-skeleton';
|
|
21
|
+
import './hooks/useTableControl.js';
|
|
22
|
+
import './IndeterminateCheckbox.js';
|
|
23
|
+
import '../../Alert-BslI0aA0.js';
|
|
24
|
+
import '../Alert/consts.js';
|
|
25
|
+
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
26
|
+
import '../../helperComponents/Loader/Loader.js';
|
|
27
|
+
import '../../consts/index.js';
|
|
28
|
+
import '../../type/file-upload.js';
|
|
29
|
+
import '../../hooks/useScreenSize.js';
|
|
30
|
+
import 'react-hook-form';
|
|
31
|
+
import 'react-dropzone';
|
|
32
|
+
import '../SVGIcons/IconUpload.js';
|
|
33
|
+
import '../FileUpload/types.js';
|
|
34
|
+
import '../../helpers/format-date.js';
|
|
35
|
+
import '../../helpers/locale.js';
|
|
36
|
+
import '../../type/locale.js';
|
|
37
|
+
import '../../helpers/storage.js';
|
|
38
|
+
import 'react-toastify';
|
|
39
|
+
import '../../hooks/useGetIsMobile.js';
|
|
40
|
+
import 'framer-motion';
|
|
41
|
+
import '../../helperComponents/AnimatePresenceWrapper/AnimatePresenceWrapper.js';
|
|
42
|
+
import '../../hooks/useOnOutsideClick.js';
|
|
43
|
+
import '../../hooks/useHideBodyScroll.js';
|
|
44
|
+
import '../SVGIcons/IconDismiss.js';
|
|
45
|
+
import '../Tooltip/types.js';
|
|
46
|
+
import '../Tooltip/Tooltip.js';
|
|
47
|
+
import '../../hooks/useGetTooltipStyles.js';
|
|
48
|
+
import '../../hooks/useGetElemSizes.js';
|
|
49
|
+
import '../../hooks/useGetElemPositions.js';
|
|
50
|
+
import '../../hooks/useGetTooltipPosition.js';
|
|
51
|
+
import '../../hooks/useHideOnScroll.js';
|
|
52
|
+
import 'react-syntax-highlighter';
|
|
53
|
+
import '../Link/Link.js';
|
|
54
|
+
import '../Popover/PopoverDesktop.js';
|
|
55
|
+
import '../SVGIcons/IconInfo.js';
|
|
56
|
+
import '../../helperComponents/IconDynamicComponent/IconDynamicComponent.js';
|
|
57
|
+
import '../../helperComponents/IconDynamicComponent/constants.js';
|
|
58
|
+
import '@babel/runtime/helpers/typeof';
|
|
59
|
+
import '../SVGIcons/IconDismissFilled.js';
|
|
60
|
+
import '../SVGIcons/IconDelete.js';
|
|
61
|
+
import '../FileUpload/DropzoneFileUpload/FilePreview.js';
|
|
62
|
+
import '../Progress/Progress.js';
|
|
63
|
+
import '../SVGIcons/IconArrowDownloadFilled.js';
|
|
64
|
+
import '../../helpers/download-file.js';
|
|
65
|
+
import '../Button/consts.js';
|
|
66
|
+
import './loadTableSettings.js';
|
|
67
|
+
import './hooks/useTableColumnSettings.js';
|
|
68
|
+
import './constants/index.js';
|
|
69
|
+
import '../Empty/Empty.js';
|
|
70
|
+
import '../Image/Image.js';
|
|
71
|
+
import '../SVGIcons/IconChevronDown.js';
|
|
72
|
+
import '../SVGIcons/IconChevronUp.js';
|
|
73
|
+
import '../SVGIcons/IconSettings.js';
|
|
74
|
+
import '../Switcher/Switcher.js';
|
|
75
|
+
import '../../helperComponents/Label/Label.js';
|
|
76
|
+
import '../SVGIcons/IconCheckmark.js';
|
|
77
|
+
import '../Menu/Menu.js';
|
|
78
|
+
import 'react-dom';
|
|
79
|
+
import '../../helperComponents/OptionItem/OptionItem.js';
|
|
80
|
+
import '../Avatar/Avatar.js';
|
|
81
|
+
import '../FileUpload/FileUpload.js';
|
|
82
|
+
import '../FileUpload/UploadItems.js';
|
|
83
|
+
import '../../hooks/useFormProps.js';
|
|
84
|
+
import '../../context/types.js';
|
|
85
|
+
import '../../helperComponents/ErrorMessage/ErrorMessage.js';
|
|
86
|
+
import '../SVGIcons/IconEditFilled.js';
|
|
87
|
+
import '../SVGIcons/IconEdit.js';
|
|
88
|
+
import '../SVGIcons/IconAttach.js';
|
|
89
|
+
import '../Collapse/CollapseGroup/CollapseGroup.js';
|
|
90
|
+
import '../Collapse/CollapseItem/CollapseItem.js';
|
|
91
|
+
import '../SVGIcons/IconChevronRight.js';
|
|
92
|
+
import '../Divider/Divider.js';
|
|
93
|
+
import '../Input/Input.js';
|
|
94
|
+
import 'react-input-mask';
|
|
95
|
+
import 'react-number-format';
|
|
96
|
+
import '../SVGIcons/IconCheckmarkCircleFilled.js';
|
|
97
|
+
import '../Select/Select/Select.js';
|
|
98
|
+
import '../Select/Select/SelectDesktop/index.js';
|
|
99
|
+
import 'react-window';
|
|
100
|
+
import '../../hooks/useGetHasBottomSpace.js';
|
|
101
|
+
import '../../hooks/useChangePositionsOnScroll.js';
|
|
102
|
+
import '../Select/SharedComponents/ContentTop.js';
|
|
103
|
+
import '../Select/SharedComponents/Actions.js';
|
|
104
|
+
import '../SVGIcons/IconMore.js';
|
|
105
|
+
import '../SVGIcons/IconSearchFilled.js';
|
|
106
|
+
import '../SVGIcons/IconSelectAllOff.js';
|
|
107
|
+
import '../SVGIcons/IconChevronLeft.js';
|
|
108
|
+
import '../Select/SharedComponents/Loading.js';
|
|
109
|
+
import '../Select/constants.js';
|
|
110
|
+
import '../Select/Select/helpers.js';
|
|
111
|
+
import '../Select/Select/SelectMobile/index.js';
|
|
112
|
+
import '../Select/Select/SelectMobile/MobileTopContent.js';
|
|
113
|
+
import '../Select/localization.js';
|
|
114
|
+
import '../Select/MultiSelect/MultiSelect.js';
|
|
115
|
+
import '../Select/MultiSelect/OptionsWrapper.js';
|
|
116
|
+
import '../Select/MultiSelect/MultiSelectGrouped/MultiSelectGrouped.js';
|
|
117
|
+
import '../SVGIcons/IconCaretUpFilled.js';
|
|
118
|
+
import '../SVGIcons/IconCaretDownFilled.js';
|
|
119
|
+
import '../Select/MultiSelect/MultiBase/MultiBase.js';
|
|
120
|
+
import '../Select/MultiSelect/MultiSelectWithTabs/MultiSelectWithTabs.js';
|
|
121
|
+
import '../Tab/Tab.js';
|
|
122
|
+
import '../Tab/TabItem.js';
|
|
123
|
+
import '../Badge/Badge.js';
|
|
124
|
+
import '../Select/SharedComponents/Footer.js';
|
|
125
|
+
import '../Select/SharedComponents/InputSelectWrapper/InputSelectWrapper.js';
|
|
126
|
+
import '../Select/MultiSelect/MobileWrapper.js';
|
|
127
|
+
import '../Select/MultiSelect/DesktopWrapper.js';
|
|
128
|
+
import '../Select/SharedComponents/ButtonSelectWrapper/ButtonSelectWrapper.js';
|
|
129
|
+
import '../Select/SharedComponents/ButtonSelectWrapper/Button/Button.js';
|
|
130
|
+
import '../SVGIcons/IconChevronDoubleLeft.js';
|
|
131
|
+
import '../SVGIcons/IconChevronDoubleRight.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var loadTableSettings = function loadTableSettings(tableKey) {
|
|
2
|
+
try {
|
|
3
|
+
var raw = localStorage.getItem(tableKey);
|
|
4
|
+
return raw ? JSON.parse(raw) : {
|
|
5
|
+
columnOrder: [],
|
|
6
|
+
columnSizing: {},
|
|
7
|
+
columnVisibility: {}
|
|
8
|
+
};
|
|
9
|
+
} catch (_unused) {
|
|
10
|
+
return {
|
|
11
|
+
columnOrder: [],
|
|
12
|
+
columnSizing: {},
|
|
13
|
+
columnVisibility: {}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { loadTableSettings };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ColumnDef, ColumnSizingState, PaginationState, RowSelectionState, Table, Row } from '@tanstack/react-table';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export type TTable<TData> = Table<TData>;
|
|
4
|
+
export type TRowSelectionState = RowSelectionState;
|
|
5
|
+
export type TColumnSizingState = ColumnSizingState;
|
|
6
|
+
export type TPaginationState = PaginationState;
|
|
7
|
+
export type TPersistColumnSettings = 'localStorage' | 'external';
|
|
8
|
+
export type TTableProps<TData> = {
|
|
9
|
+
data: (TData & {
|
|
10
|
+
subRows?: TData[];
|
|
11
|
+
})[];
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
columns: ColumnDef<TData>[];
|
|
14
|
+
wi?: boolean;
|
|
15
|
+
isActionsVisible?: boolean;
|
|
16
|
+
totalCount?: number;
|
|
17
|
+
hasError?: boolean;
|
|
18
|
+
emptyTitle?: string;
|
|
19
|
+
emptySubTitle?: string;
|
|
20
|
+
emptyIllustration?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
withSelect?: boolean;
|
|
23
|
+
withBorder?: boolean;
|
|
24
|
+
customHeader?: ReactNode;
|
|
25
|
+
defaultPageIndex?: number;
|
|
26
|
+
defaultPageSize?: number;
|
|
27
|
+
defaultHiddenColumns?: string[];
|
|
28
|
+
collapsibleRows?: boolean;
|
|
29
|
+
tableSettings?: {
|
|
30
|
+
tableName: string;
|
|
31
|
+
persistColumnSettings?: TPersistColumnSettings;
|
|
32
|
+
onColumnSettingsChange?: (settings: ColumnSettings) => void;
|
|
33
|
+
};
|
|
34
|
+
renderExpandedContent?: (row: Row<TData>) => ReactNode;
|
|
35
|
+
renderHeader?: (table: TTable<TData>) => ReactNode;
|
|
36
|
+
renderFooter?: (table: Table<TData>) => ReactNode;
|
|
37
|
+
onRowClick?: (row: Row<TData>) => void;
|
|
38
|
+
onSortChange?: (state: SortingUpdateEvent[]) => void;
|
|
39
|
+
onRowSelection?: (state: TRowSelectionState) => void;
|
|
40
|
+
onColumnSizing?: (state: TColumnSizingState) => void;
|
|
41
|
+
onPaginationChange?: (state: TPaginationState) => void;
|
|
42
|
+
};
|
|
43
|
+
export type Column<TData> = ColumnDef<TData> & {
|
|
44
|
+
enableColumnDragging?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type SortingUpdateEvent = {
|
|
47
|
+
column: string;
|
|
48
|
+
direction: 'asc' | 'desc' | false;
|
|
49
|
+
timestamp: number;
|
|
50
|
+
};
|
|
51
|
+
export interface ICellProps<TData> {
|
|
52
|
+
row: Row<TData>;
|
|
53
|
+
}
|
|
54
|
+
export interface IHeaderProps<TData> {
|
|
55
|
+
table: Table<TData>;
|
|
56
|
+
}
|
|
57
|
+
export interface TableData {
|
|
58
|
+
subRows: TableData[];
|
|
59
|
+
[key: string]: unknown;
|
|
60
|
+
}
|
|
61
|
+
export interface ExpandColumnProps<TData> {
|
|
62
|
+
row: Row<TData>;
|
|
63
|
+
expandedRows: Set<string>;
|
|
64
|
+
onToggle: (rowId: string) => void;
|
|
65
|
+
}
|
|
66
|
+
export interface ColumnSettings {
|
|
67
|
+
columnVisibility: Record<string, boolean>;
|
|
68
|
+
columnOrder: string[];
|
|
69
|
+
columnSizing: Record<string, number>;
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -12,7 +12,7 @@ import '../../consts/index.js';
|
|
|
12
12
|
import 'dayjs';
|
|
13
13
|
import '../../hooks/useScreenSize.js';
|
|
14
14
|
import 'react-hook-form';
|
|
15
|
-
import '../../Alert-
|
|
15
|
+
import '../../Alert-BslI0aA0.js';
|
|
16
16
|
import 'react-syntax-highlighter';
|
|
17
17
|
import { IconCheckmarkCircleFilled } from '../SVGIcons/IconCheckmarkCircleFilled.js';
|
|
18
18
|
import '../../utils/helpers.js';
|
|
@@ -17,7 +17,7 @@ import '../../consts/index.js';
|
|
|
17
17
|
import '../../type/file-upload.js';
|
|
18
18
|
import '../../hooks/useScreenSize.js';
|
|
19
19
|
import 'react-hook-form';
|
|
20
|
-
import '../../Alert-
|
|
20
|
+
import '../../Alert-BslI0aA0.js';
|
|
21
21
|
import '../Alert/consts.js';
|
|
22
22
|
import '../../helperComponents/Loader/Loader.js';
|
|
23
23
|
import 'react-dropzone';
|
|
@@ -6,7 +6,7 @@ import 'classnames';
|
|
|
6
6
|
import '../../utils/helpers.js';
|
|
7
7
|
import 'dayjs';
|
|
8
8
|
import '../../components/Image/Image.js';
|
|
9
|
-
import '../../Alert-
|
|
9
|
+
import '../../Alert-BslI0aA0.js';
|
|
10
10
|
import '../../components/Alert/consts.js';
|
|
11
11
|
import '@babel/runtime/helpers/defineProperty';
|
|
12
12
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -9,7 +9,7 @@ import '../../hooks/useScreenSize.js';
|
|
|
9
9
|
import '@babel/runtime/helpers/slicedToArray';
|
|
10
10
|
import 'react-hook-form';
|
|
11
11
|
import '@babel/runtime/helpers/defineProperty';
|
|
12
|
-
import { C as Checkbox } from '../../Alert-
|
|
12
|
+
import { C as Checkbox } from '../../Alert-BslI0aA0.js';
|
|
13
13
|
import { IconCheckmark } from '../../components/SVGIcons/IconCheckmark.js';
|
|
14
14
|
import '../../components/FileUpload/FileUpload.js';
|
|
15
15
|
import '@babel/runtime/helpers/toConsumableArray';
|
|
@@ -7,7 +7,7 @@ import '@babel/runtime/helpers/slicedToArray';
|
|
|
7
7
|
import '../../components/FileUpload/FileUpload.js';
|
|
8
8
|
import '@babel/runtime/helpers/toConsumableArray';
|
|
9
9
|
import '../../components/FileUpload/types.js';
|
|
10
|
-
import '../../Alert-
|
|
10
|
+
import '../../Alert-BslI0aA0.js';
|
|
11
11
|
import '../../components/Alert/consts.js';
|
|
12
12
|
import '../../components/Text/Text.js';
|
|
13
13
|
import '../../utils/helpers.js';
|
|
@@ -15,7 +15,7 @@ import '@babel/runtime/helpers/slicedToArray';
|
|
|
15
15
|
import '../components/FileUpload/FileUpload.js';
|
|
16
16
|
import '@babel/runtime/helpers/toConsumableArray';
|
|
17
17
|
import '../components/FileUpload/types.js';
|
|
18
|
-
import '../Alert-
|
|
18
|
+
import '../Alert-BslI0aA0.js';
|
|
19
19
|
import '../components/Alert/consts.js';
|
|
20
20
|
import '@babel/runtime/helpers/defineProperty';
|
|
21
21
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -10,7 +10,7 @@ import '../components/Text/Text.js';
|
|
|
10
10
|
import 'classnames';
|
|
11
11
|
import '../utils/helpers.js';
|
|
12
12
|
import 'dayjs';
|
|
13
|
-
import '../Alert-
|
|
13
|
+
import '../Alert-BslI0aA0.js';
|
|
14
14
|
import '../components/Alert/consts.js';
|
|
15
15
|
import '@babel/runtime/helpers/defineProperty';
|
|
16
16
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
package/helpers/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import 'react-toastify';
|
|
|
14
14
|
import '../components/Text/Text.js';
|
|
15
15
|
import 'classnames';
|
|
16
16
|
import '../utils/helpers.js';
|
|
17
|
-
import '../Alert-
|
|
17
|
+
import '../Alert-BslI0aA0.js';
|
|
18
18
|
import '../components/Alert/consts.js';
|
|
19
19
|
import '@babel/runtime/helpers/defineProperty';
|
|
20
20
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
package/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export * from './components/Stepper';
|
|
|
36
36
|
export * from './components/Switcher';
|
|
37
37
|
export * from './components/Tab';
|
|
38
38
|
export * from './components/Table';
|
|
39
|
+
export * from './components/TableV2';
|
|
39
40
|
export * from './components/Text';
|
|
40
41
|
export * from './components/Textarea';
|
|
41
42
|
export * from './components/Tooltip';
|