@ercioko/meblotex-api 0.2.7 → 0.2.9

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.
@@ -23,7 +23,7 @@ export declare const createApi: (host: string) => {
23
23
  web_login: Endpoint<unknown>;
24
24
  web_logout: Endpoint<unknown>;
25
25
  nowe_zamowienie_cecha_wartosc: Endpoint<unknown>;
26
- new_order_element_bundle: Endpoint<unknown>;
26
+ new_order_element_set: Endpoint<unknown>;
27
27
  nowe_zamowienie_towar: Endpoint<unknown>;
28
28
  nowe_zamowienie_towar_atrybut: Endpoint<unknown>;
29
29
  nowe_zamowienie_towar_atrybut2: Endpoint<unknown>;
@@ -53,7 +53,7 @@ var createApi = function (host) { return ({
53
53
  web_login: new Endpoint_1.default('web_auth/login', host),
54
54
  web_logout: new Endpoint_1.default('web_auth/logout', host),
55
55
  nowe_zamowienie_cecha_wartosc: new Endpoint_1.default('nowe_zamowienie/cecha_wartosc', host),
56
- new_order_element_bundle: new Endpoint_1.default('new_order_element/bundle', host),
56
+ new_order_element_set: new Endpoint_1.default('new_order_element/set', host),
57
57
  nowe_zamowienie_towar: new Endpoint_1.default('nowe_zamowienie/towar', host),
58
58
  nowe_zamowienie_towar_atrybut: new Endpoint_1.default('nowe_zamowienie/towar_atrybut', host),
59
59
  nowe_zamowienie_towar_atrybut2: new Endpoint_1.default('nowe_zamowienie/towar_atrybut2', host),
@@ -98,12 +98,6 @@ export type TowarAtrybutRoot = TowarAtrybutResponseElement & {
98
98
  features?: TowarAtrybutRoots;
99
99
  children?: TowarAtrybutRoots;
100
100
  };
101
- export type BundleResponse = BundleResponseElement[];
102
- export type BundleResponseElement = {
103
- id_towar: number;
104
- nazwa: string;
105
- wartosc_opis: string;
106
- };
107
101
  export type TowarAtrybutRoots = TowarAtrybutRoot[];
108
102
  export type UseFeatureValues = {
109
103
  cecha_predefiniowana1: NoweZamowienieCechaWartosc[];
@@ -24,5 +24,5 @@ type Props<DataType = DataRow> = {
24
24
  responsive?: boolean;
25
25
  deleteMessage?: (record: DataType) => string;
26
26
  };
27
- declare function Table<DataType extends object = DataRow>(props: Props<DataType>): React.JSX.Element;
28
- export default Table;
27
+ declare function BaseTable<DataType extends object = DataRow>({ style, columns: providedColumns, filters, actions, loadPage, onDelete, added, dataSource, withCheckbox, checked, setChecked, selected, loadingDataSource, floatingActions, suspend, pinned, useData, responsive, deleteMessage, idKey, }: Props<DataType>): JSX.Element;
28
+ export default BaseTable;
@@ -50,7 +50,7 @@ exports.MARGIN_FOR_SPINNER = void 0;
50
50
  var antd_1 = require("antd");
51
51
  var react_1 = __importStar(require("react"));
52
52
  var react_redux_1 = require("react-redux");
53
- var react_virtualized_1 = require("react-virtualized");
53
+ var react_window_1 = require("react-window");
54
54
  var config_1 = __importDefault(require("../../config"));
55
55
  var Spinner_1 = __importDefault(require("./Spinner"));
56
56
  var useGetRowCheckbox_1 = __importDefault(require("./hooks/useGetRowCheckbox"));
@@ -64,7 +64,6 @@ var useResizeColumns_1 = __importDefault(require("./hooks/useResizeColumns"));
64
64
  var useLoadDataSource_1 = __importDefault(require("./hooks/useLoadDataSource"));
65
65
  var areProvidedColumnsDifferent_1 = __importDefault(require("./areProvidedColumnsDifferent"));
66
66
  var useFetchPage_1 = __importDefault(require("./hooks/useFetchPage"));
67
- var FloatingActions_1 = __importDefault(require("./FloatingActions"));
68
67
  var DataTableWrapper_1 = __importDefault(require("./DataTableWrapper"));
69
68
  var styles_1 = require("./styles");
70
69
  var usePageSize_1 = require("./hooks/usePageSize");
@@ -153,14 +152,11 @@ function BaseTable(_a) {
153
152
  updatedColumns = getColumnsWithActions(updatedColumns);
154
153
  }
155
154
  if (withCheckbox || (!floatingActions && actions && actions.width)) {
156
- // if (JSON.stringify(updatedColumns) !== JSON.stringify(columns)) {
157
155
  setColumns(updatedColumns);
158
- // }
159
156
  }
160
157
  }, [
161
158
  getColumnsWithCheckbox,
162
159
  getColumnsWithActions,
163
- // columns,
164
160
  withCheckbox,
165
161
  actions,
166
162
  floatingActions,
@@ -246,85 +242,32 @@ function BaseTable(_a) {
246
242
  pageSize: pageSize,
247
243
  loadPage: loadPage,
248
244
  });
249
- var hide = (0, react_1.useCallback)(function (e) {
250
- if (!actionsFor) {
251
- return;
252
- }
253
- if (e) {
254
- e.stopPropagation();
255
- }
256
- setActionsFor(undefined);
257
- setActionsDimensions(__assign(__assign({}, actionsDimensions), { width: 0, transition: '' }));
258
- }, [actionsFor, actionsDimensions]);
259
- var scrolled = (0, react_1.useCallback)(function (_a) {
260
- var scrollTop = _a.scrollTop, clientHeight = _a.clientHeight;
261
- if (actionsFor) {
262
- hide();
263
- }
264
- if (dataSource !== undefined || loading || data.length === total) {
265
- return;
266
- }
267
- var page = Math.ceil((data.length - ((pinned === null || pinned === void 0 ? void 0 : pinned.length) || 0)) / pageSize());
268
- if (scrollTop < clientHeight * (page - 1)) {
269
- return;
270
- }
271
- fetchPage(page);
272
- }, [
273
- fetchPage,
274
- actionsFor,
275
- dataSource,
276
- data,
277
- loading,
278
- total,
279
- pageSize,
280
- hide,
281
- pinned === null || pinned === void 0 ? void 0 : pinned.length,
282
- ]);
283
245
  (0, react_1.useEffect)(function () {
284
246
  if (loadPage !== undefined) {
285
247
  fetchPage(0);
286
248
  }
287
249
  }, [order]);
288
250
  (0, react_1.useEffect)(function () {
289
- window.addEventListener('click', hide);
290
- return function () { return window.removeEventListener('click', hide); };
291
- }, [hide, actionsFor, actionsDimensions]);
292
- var actionHover = (0, react_1.useCallback)(function () {
293
- if (Array.isArray(floatingButtons)) {
294
- setActionsDimensions(__assign(__assign({}, actionsDimensions), { width: floatingButtons.length * 24 +
295
- (floatingButtons.length - 1) * 28 +
296
- (actions.delete ? 53 : 0) +
297
- 98 +
298
- (actions.additionalWidth || 0), transition: 'width 150ms ease-in-out' }));
299
- }
300
- }, [actionsDimensions, floatingButtons, actions]);
301
- var actionLeave = (0, react_1.useCallback)(function () {
302
- if (Array.isArray(floatingButtons) && actionsFor) {
303
- setActionsDimensions(__assign(__assign({}, actionsDimensions), { width: floatingButtons.length * 24 +
304
- (floatingButtons.length - 1) * 28 +
305
- (actions.delete ? 53 : 0) +
306
- 74 }));
307
- }
308
- }, [actionsFor, actionsDimensions, floatingButtons, actions]);
309
- var isVisibleCellRenderer = (0, react_1.useCallback)(function (_a) {
310
- var columnIndex = _a.columnIndex, key = _a.key, rowIndex = _a.rowIndex, cellStyle = _a.style, isVisible = _a.isVisible, isScrolling = _a.isScrolling;
311
- if (isVisible) {
312
- return (react_1.default.createElement(CellRenderer, { isVisible: isVisible, columnIndex: columnIndex, key: key, rowKey: key, rowIndex: rowIndex, isScrolling: isScrolling, style: cellStyle }));
251
+ if (grid.current) {
252
+ grid.current.resetAfterIndices({
253
+ columnIndex: 0,
254
+ rowIndex: 0,
255
+ shouldForceUpdate: true,
256
+ });
313
257
  }
314
- return null;
315
- }, [CellRenderer]);
316
- return (react_1.default.createElement(styles_1.DataTable, { style: style, className: "data-table", ref: main },
317
- ((actions === null || actions === void 0 ? void 0 : actions.both) || floatingActions) && actions ? (react_1.default.createElement(FloatingActions_1.default, { actionsDimensions: actionsDimensions, actionsFor: actionsFor, floatingButtons: floatingButtons, actionHover: actionHover, actionLeave: actionLeave, hide: hide, actions: actions })) : undefined,
318
- react_1.default.createElement(DataTableWrapper_1.default, null,
319
- react_1.default.createElement(styles_1.StyledTable, { className: "table", ref: table }, data && (react_1.default.createElement(react_virtualized_1.MultiGrid, { cellRenderer: isVisibleCellRenderer, height: listHeight, width: listWidth, columnWidth: function (_a) {
320
- var index = _a.index;
321
- return columns[index].width;
322
- }, rowHeight: rowSize, fixedRowCount: 1, columnCount: columns.length, rowCount: data.length + 1, overscanRowCount: 22, styleBottomLeftGrid: { outline: 'none' }, styleBottomRightGrid: { outline: 'none' }, onScroll: scrolled, ref: grid }))),
323
- data && loading ? react_1.default.createElement(Spinner_1.default, null) : undefined),
324
- !data ? (react_1.default.createElement("div", { className: "data-table-no-data" }, loading ? react_1.default.createElement(antd_1.Spin, null) : react_1.default.createElement(antd_1.Empty, { description: "Brak danych" }))) : undefined));
325
- }
326
- function Table(props) {
258
+ }, [data, columns]);
259
+ if (loadingDataSource) {
260
+ return react_1.default.createElement(Spinner_1.default, null);
261
+ }
262
+ var getItemKey = function (_a) {
263
+ var columnIndex = _a.columnIndex, rowIndex = _a.rowIndex;
264
+ var cellIndex = rowIndex * columns.length + columnIndex;
265
+ return cellIndex;
266
+ };
267
+ var getColumnWidth = (0, react_1.useCallback)(function (index) { return columns[index].width; }, [columns]);
327
268
  return (react_1.default.createElement(OrderProvider_1.OrderProvider, null,
328
- react_1.default.createElement(BaseTable, __assign({}, props))));
269
+ react_1.default.createElement(DataTableWrapper_1.default, null, data.length ? (react_1.default.createElement(styles_1.StyledTable, { ref: main, style: style },
270
+ react_1.default.createElement(styles_1.DataTable, { ref: table, role: "table", "aria-rowcount": total, "aria-colcount": columns.length },
271
+ react_1.default.createElement(react_window_1.VariableSizeGrid, { columnCount: columns.length, columnWidth: getColumnWidth, height: listHeight, rowCount: total || 0, rowHeight: function () { return rowSize; }, width: listWidth, itemKey: getItemKey, ref: grid }, CellRenderer)))) : (react_1.default.createElement(antd_1.Empty, { description: "No Data" })))));
329
272
  }
330
- exports.default = Table;
273
+ exports.default = BaseTable;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Actions, DataRow, TableColumn } from '../../../app_types';
3
3
  import { ResizeColumnType } from './useGetResizeColumn';
4
+ import { GridChildComponentProps } from 'react-window';
4
5
  type Props<DataType = DataRow> = {
5
6
  idKey?: keyof DataType;
6
7
  columns: TableColumn<DataType>[];
@@ -14,12 +15,5 @@ type Props<DataType = DataRow> = {
14
15
  selected: number | DataType;
15
16
  checked: number[];
16
17
  };
17
- export default function useGetCellRenderer<DataType extends object>({ columns, data, actions, resizeCol, setHoveredRow, hoveredRow, selected, checked, idKey, }: Props<DataType>): ({ columnIndex, rowIndex, rowKey, style, isScrolling, isVisible }: {
18
- columnIndex: any;
19
- rowIndex: any;
20
- rowKey: any;
21
- style: any;
22
- isScrolling: any;
23
- isVisible: any;
24
- }) => React.JSX.Element;
18
+ export default function useGetCellRenderer<DataType extends object>({ columns, data, actions, resizeCol, setHoveredRow, hoveredRow, selected, checked, idKey, }: Props<DataType>): ({ columnIndex, rowIndex, style, isScrolling }: GridChildComponentProps) => React.JSX.Element;
25
19
  export {};
@@ -115,7 +115,7 @@ function useGetCellRenderer(_a) {
115
115
  // [setHoveredRow]
116
116
  // );
117
117
  // const blurRow = useCallback(() => setHoveredRow(), []);
118
- var columnIndex = _a.columnIndex, rowIndex = _a.rowIndex, rowKey = _a.rowKey, style = _a.style, isScrolling = _a.isScrolling, isVisible = _a.isVisible;
118
+ var columnIndex = _a.columnIndex, rowIndex = _a.rowIndex, style = _a.style, isScrolling = _a.isScrolling;
119
119
  var colCfg = columns[columnIndex];
120
120
  var value;
121
121
  var row = data[rowIndex - 1];
@@ -123,7 +123,7 @@ function useGetCellRenderer(_a) {
123
123
  value = rowIndex !== 0 ? row[colCfg.key] : undefined;
124
124
  }
125
125
  if (rowIndex === 0) {
126
- return (react_1.default.createElement(styles_1.TableHeader, { key: rowKey, style: __assign(__assign({}, style), { display: 'flex', alignItems: 'center' }), className: "td th", onClick: function () { return sortByColumn(colCfg); } },
126
+ return (react_1.default.createElement(styles_1.TableHeader, { style: __assign(__assign({}, style), { display: 'flex', alignItems: 'center' }), className: "td th", onClick: function () { return sortByColumn(colCfg); } },
127
127
  react_1.default.createElement("div", { className: "text-nowrap w-100".concat(colCfg.resized ? ' resized' : '') }, colCfg.title),
128
128
  react_1.default.createElement(react_draggable_1.default, { axis: "x", defaultClassName: "DragHandle", defaultClassNameDragging: "DragHandleActive", onDrag: function (e, _a) {
129
129
  var deltaX = _a.deltaX;
@@ -149,9 +149,7 @@ function useGetCellRenderer(_a) {
149
149
  return (react_1.default.createElement(styles_1.TableData
150
150
  // onMouseOver={hoverRow(rowIndex)} // TODO: is it useful?
151
151
  // onMouseLeave={blurRow}
152
- , __assign({ "$align": colCfg.align, role: "button", key: rowKey, style: __assign(__assign({}, style), { cursor: clickable ? 'pointer' : undefined, backgroundColor: getBackgroundColor(rowIndex), color: (actions === null || actions === void 0 ? void 0 : actions.onRowClick) && hoveredRow === rowIndex
153
- ? 'black'
154
- : undefined }) }, divProps, { className: "tr td ".concat((rowIndex - 1) % 2 === 0 ? 'td-light' : ''), onClick: clickable ? handleOnClick(rowIndex) : null }), content));
152
+ , __assign({ "$align": colCfg.align, role: "button", style: __assign(__assign({}, style), { cursor: clickable ? 'pointer' : undefined, backgroundColor: getBackgroundColor(rowIndex), color: (actions === null || actions === void 0 ? void 0 : actions.onRowClick) && hoveredRow === rowIndex ? 'black' : undefined }) }, divProps, { className: "tr td ".concat((rowIndex - 1) % 2 === 0 ? 'td-light' : ''), onClick: clickable ? handleOnClick(rowIndex) : null }), content));
155
153
  }, [
156
154
  columns,
157
155
  data,
@@ -22,7 +22,7 @@ export var createApi = function(host) {
22
22
  web_login: new Endpoint('web_auth/login', host),
23
23
  web_logout: new Endpoint('web_auth/logout', host),
24
24
  nowe_zamowienie_cecha_wartosc: new Endpoint('nowe_zamowienie/cecha_wartosc', host),
25
- new_order_element_bundle: new Endpoint('new_order_element/bundle', host),
25
+ new_order_element_set: new Endpoint('new_order_element/set', host),
26
26
  nowe_zamowienie_towar: new Endpoint('nowe_zamowienie/towar', host),
27
27
  nowe_zamowienie_towar_atrybut: new Endpoint('nowe_zamowienie/towar_atrybut', host),
28
28
  nowe_zamowienie_towar_atrybut2: new Endpoint('nowe_zamowienie/towar_atrybut2', host),
@@ -112,10 +112,10 @@ function _unsupported_iterable_to_array(o, minLen) {
112
112
  if (n === "Map" || n === "Set") return Array.from(n);
113
113
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
114
114
  }
115
- import { Spin, Empty } from 'antd';
115
+ import { Empty } from 'antd';
116
116
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
117
117
  import { useSelector } from 'react-redux';
118
- import { MultiGrid } from 'react-virtualized';
118
+ import { VariableSizeGrid as Grid } from 'react-window';
119
119
  import config from '../../config';
120
120
  import Spinner from './Spinner';
121
121
  import useGetRowCheckbox from './hooks/useGetRowCheckbox';
@@ -129,7 +129,6 @@ import useResizeColumns from './hooks/useResizeColumns';
129
129
  import useLoadDataSource from './hooks/useLoadDataSource';
130
130
  import areProvidedColumnsDifferent from './areProvidedColumnsDifferent';
131
131
  import useFetchPage from './hooks/useFetchPage';
132
- import FloatingActions from './FloatingActions';
133
132
  import DataTableWrapper from './DataTableWrapper';
134
133
  import { DataTable, StyledTable } from './styles';
135
134
  import { usePageSize } from './hooks/usePageSize';
@@ -233,14 +232,11 @@ function BaseTable(param) {
233
232
  updatedColumns = getColumnsWithActions(updatedColumns);
234
233
  }
235
234
  if (withCheckbox || !floatingActions && actions && actions.width) {
236
- // if (JSON.stringify(updatedColumns) !== JSON.stringify(columns)) {
237
235
  setColumns(updatedColumns);
238
- // }
239
236
  }
240
237
  }, [
241
238
  getColumnsWithCheckbox,
242
239
  getColumnsWithActions,
243
- // columns,
244
240
  withCheckbox,
245
241
  actions,
246
242
  floatingActions
@@ -352,46 +348,6 @@ function BaseTable(param) {
352
348
  pageSize: pageSize,
353
349
  loadPage: loadPage
354
350
  });
355
- var hide = useCallback(function(e) {
356
- if (!actionsFor) {
357
- return;
358
- }
359
- if (e) {
360
- e.stopPropagation();
361
- }
362
- setActionsFor(undefined);
363
- setActionsDimensions(_object_spread_props(_object_spread({}, actionsDimensions), {
364
- width: 0,
365
- transition: ''
366
- }));
367
- }, [
368
- actionsFor,
369
- actionsDimensions
370
- ]);
371
- var scrolled = useCallback(function(param) {
372
- var scrollTop = param.scrollTop, clientHeight = param.clientHeight;
373
- if (actionsFor) {
374
- hide();
375
- }
376
- if (dataSource !== undefined || loading || data.length === total) {
377
- return;
378
- }
379
- var page = Math.ceil((data.length - ((pinned === null || pinned === void 0 ? void 0 : pinned.length) || 0)) / pageSize());
380
- if (scrollTop < clientHeight * (page - 1)) {
381
- return;
382
- }
383
- fetchPage(page);
384
- }, [
385
- fetchPage,
386
- actionsFor,
387
- dataSource,
388
- data,
389
- loading,
390
- total,
391
- pageSize,
392
- hide,
393
- pinned === null || pinned === void 0 ? void 0 : pinned.length
394
- ]);
395
351
  useEffect(function() {
396
352
  if (loadPage !== undefined) {
397
353
  fetchPage(0);
@@ -400,99 +356,51 @@ function BaseTable(param) {
400
356
  order
401
357
  ]);
402
358
  useEffect(function() {
403
- window.addEventListener('click', hide);
404
- return function() {
405
- return window.removeEventListener('click', hide);
406
- };
407
- }, [
408
- hide,
409
- actionsFor,
410
- actionsDimensions
411
- ]);
412
- var actionHover = useCallback(function() {
413
- if (Array.isArray(floatingButtons)) {
414
- setActionsDimensions(_object_spread_props(_object_spread({}, actionsDimensions), {
415
- width: floatingButtons.length * 24 + (floatingButtons.length - 1) * 28 + (actions.delete ? 53 : 0) + 98 + (actions.additionalWidth || 0),
416
- transition: 'width 150ms ease-in-out'
417
- }));
418
- }
419
- }, [
420
- actionsDimensions,
421
- floatingButtons,
422
- actions
423
- ]);
424
- var actionLeave = useCallback(function() {
425
- if (Array.isArray(floatingButtons) && actionsFor) {
426
- setActionsDimensions(_object_spread_props(_object_spread({}, actionsDimensions), {
427
- width: floatingButtons.length * 24 + (floatingButtons.length - 1) * 28 + (actions.delete ? 53 : 0) + 74
428
- }));
359
+ if (grid.current) {
360
+ grid.current.resetAfterIndices({
361
+ columnIndex: 0,
362
+ rowIndex: 0,
363
+ shouldForceUpdate: true
364
+ });
429
365
  }
430
366
  }, [
431
- actionsFor,
432
- actionsDimensions,
433
- floatingButtons,
434
- actions
367
+ data,
368
+ columns
435
369
  ]);
436
- var isVisibleCellRenderer = useCallback(function(param) {
437
- var columnIndex = param.columnIndex, key = param.key, rowIndex = param.rowIndex, cellStyle = param.style, isVisible = param.isVisible, isScrolling = param.isScrolling;
438
- if (isVisible) {
439
- return /*#__PURE__*/ React.createElement(CellRenderer, {
440
- isVisible: isVisible,
441
- columnIndex: columnIndex,
442
- key: key,
443
- rowKey: key,
444
- rowIndex: rowIndex,
445
- isScrolling: isScrolling,
446
- style: cellStyle
447
- });
448
- }
449
- return null;
370
+ if (loadingDataSource) {
371
+ return /*#__PURE__*/ React.createElement(Spinner, null);
372
+ }
373
+ var getItemKey = function(param) {
374
+ var columnIndex = param.columnIndex, rowIndex = param.rowIndex;
375
+ var cellIndex = rowIndex * columns.length + columnIndex;
376
+ return cellIndex;
377
+ };
378
+ var getColumnWidth = useCallback(function(index) {
379
+ return columns[index].width;
450
380
  }, [
451
- CellRenderer
381
+ columns
452
382
  ]);
453
- return /*#__PURE__*/ React.createElement(DataTable, {
454
- style: style,
455
- className: "data-table",
456
- ref: main
457
- }, ((actions === null || actions === void 0 ? void 0 : actions.both) || floatingActions) && actions ? /*#__PURE__*/ React.createElement(FloatingActions, {
458
- actionsDimensions: actionsDimensions,
459
- actionsFor: actionsFor,
460
- floatingButtons: floatingButtons,
461
- actionHover: actionHover,
462
- actionLeave: actionLeave,
463
- hide: hide,
464
- actions: actions
465
- }) : undefined, /*#__PURE__*/ React.createElement(DataTableWrapper, null, /*#__PURE__*/ React.createElement(StyledTable, {
466
- className: "table",
467
- ref: table
468
- }, data && /*#__PURE__*/ React.createElement(MultiGrid, {
469
- cellRenderer: isVisibleCellRenderer,
470
- height: listHeight,
471
- width: listWidth,
472
- columnWidth: function(param) {
473
- var index = param.index;
474
- return columns[index].width;
475
- },
476
- rowHeight: rowSize,
477
- fixedRowCount: 1,
383
+ return /*#__PURE__*/ React.createElement(OrderProvider, null, /*#__PURE__*/ React.createElement(DataTableWrapper, null, data.length ? /*#__PURE__*/ React.createElement(StyledTable, {
384
+ ref: main,
385
+ style: style
386
+ }, /*#__PURE__*/ React.createElement(DataTable, {
387
+ ref: table,
388
+ role: "table",
389
+ "aria-rowcount": total,
390
+ "aria-colcount": columns.length
391
+ }, /*#__PURE__*/ React.createElement(Grid, {
478
392
  columnCount: columns.length,
479
- rowCount: data.length + 1,
480
- overscanRowCount: 22,
481
- styleBottomLeftGrid: {
482
- outline: 'none'
483
- },
484
- styleBottomRightGrid: {
485
- outline: 'none'
393
+ columnWidth: getColumnWidth,
394
+ height: listHeight,
395
+ rowCount: total || 0,
396
+ rowHeight: function() {
397
+ return rowSize;
486
398
  },
487
- onScroll: scrolled,
399
+ width: listWidth,
400
+ itemKey: getItemKey,
488
401
  ref: grid
489
- })), data && loading ? /*#__PURE__*/ React.createElement(Spinner, null) : undefined), !data ? /*#__PURE__*/ React.createElement("div", {
490
- className: "data-table-no-data"
491
- }, loading ? /*#__PURE__*/ React.createElement(Spin, null) : /*#__PURE__*/ React.createElement(Empty, {
492
- description: "Brak danych"
493
- })) : undefined);
494
- }
495
- function Table(props) {
496
- return /*#__PURE__*/ React.createElement(OrderProvider, null, /*#__PURE__*/ React.createElement(BaseTable, props));
402
+ }, CellRenderer))) : /*#__PURE__*/ React.createElement(Empty, {
403
+ description: "No Data"
404
+ })));
497
405
  }
498
- export default Table;
406
+ export default BaseTable;
@@ -143,7 +143,7 @@ export default function useGetCellRenderer(param) {
143
143
  data
144
144
  ]);
145
145
  return useCallback(function(param) {
146
- var columnIndex = param.columnIndex, rowIndex = param.rowIndex, rowKey = param.rowKey, style = param.style, isScrolling = param.isScrolling, isVisible = param.isVisible;
146
+ var columnIndex = param.columnIndex, rowIndex = param.rowIndex, style = param.style, isScrolling = param.isScrolling;
147
147
  // const hoverRow = useCallback(
148
148
  // (rowIndex) => () => {
149
149
  // setHoveredRow(rowIndex);
@@ -159,7 +159,6 @@ export default function useGetCellRenderer(param) {
159
159
  }
160
160
  if (rowIndex === 0) {
161
161
  return /*#__PURE__*/ React.createElement(TableHeader, {
162
- key: rowKey,
163
162
  style: _object_spread_props(_object_spread({}, style), {
164
163
  display: 'flex',
165
164
  alignItems: 'center'
@@ -207,7 +206,6 @@ export default function useGetCellRenderer(param) {
207
206
  // onMouseLeave={blurRow}
208
207
  $align: colCfg.align,
209
208
  role: "button",
210
- key: rowKey,
211
209
  style: _object_spread_props(_object_spread({}, style), {
212
210
  cursor: clickable ? 'pointer' : undefined,
213
211
  backgroundColor: getBackgroundColor(rowIndex),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ercioko/meblotex-api",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Shared modules for Meblotex app",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",
@@ -23,7 +23,9 @@
23
23
  "url": "https://github.com/erykdziedzic/meblotex-api/issues"
24
24
  },
25
25
  "homepage": "https://github.com/erykdziedzic/meblotex-api#readme",
26
- "files": ["./dist"],
26
+ "files": [
27
+ "./dist"
28
+ ],
27
29
  "peerDependencies": {
28
30
  "react": "^18.3.1",
29
31
  "react-dom": "^18.3.1",
@@ -33,13 +35,14 @@
33
35
  "dependencies": {
34
36
  "antd": "^5.19.4",
35
37
  "react-draggable": "^4.4.6",
36
- "react-virtualized": "^9.22.5"
38
+ "react-window": "^1.8.10"
37
39
  },
38
40
  "devDependencies": {
39
41
  "@babel/core": "^7.25.2",
40
42
  "@swc/cli": "^0.4.0",
41
43
  "@swc/core": "^1.7.3",
42
44
  "@types/react": "^18.3.3",
45
+ "@types/react-window": "^1.8.8",
43
46
  "@types/styled-components": "^5.1.34",
44
47
  "eslint": "^8.57.0",
45
48
  "eslint-config-prettier": "^8.10.0",