@terraware/web-components 5.2.7-rc.2 → 5.2.7

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.
Files changed (44) hide show
  1. package/components/EditableTable/index.d.ts +3 -2
  2. package/components/EditableTable/index.d.ts.map +1 -1
  3. package/components/EditableTable/tableSettings.d.ts +5 -11
  4. package/components/EditableTable/tableSettings.d.ts.map +1 -1
  5. package/components/EditableTable/tableSettings.js +8 -41
  6. package/components/table/density.d.ts +1 -1
  7. package/index.d.ts +3 -7
  8. package/index.d.ts.map +1 -1
  9. package/index.js +1 -4
  10. package/license-report.html +1 -1
  11. package/package.json +1 -2
  12. package/strings/csv/en.csv +0 -37
  13. package/strings/csv/es.csv +0 -37
  14. package/strings/csv/fr.csv +0 -37
  15. package/strings/strings-en.d.ts +0 -37
  16. package/strings/strings-en.d.ts.map +1 -1
  17. package/strings/strings-en.js +1 -38
  18. package/strings/strings-es.d.ts +0 -37
  19. package/strings/strings-es.d.ts.map +1 -1
  20. package/strings/strings-es.js +1 -38
  21. package/strings/strings-fr.d.ts +0 -37
  22. package/strings/strings-fr.d.ts.map +1 -1
  23. package/strings/strings-fr.js +1 -38
  24. package/strings/strings-gx.d.ts +0 -37
  25. package/strings/strings-gx.d.ts.map +1 -1
  26. package/strings/strings-gx.js +1 -38
  27. package/components/EditableTableV2/ColumnDragging.d.ts +0 -23
  28. package/components/EditableTableV2/ColumnDragging.d.ts.map +0 -1
  29. package/components/EditableTableV2/ColumnDragging.js +0 -263
  30. package/components/EditableTableV2/EditableCellV2.d.ts +0 -10
  31. package/components/EditableTableV2/EditableCellV2.d.ts.map +0 -1
  32. package/components/EditableTableV2/EditableCellV2.js +0 -81
  33. package/components/EditableTableV2/ToolbarButtons.d.ts +0 -29
  34. package/components/EditableTableV2/ToolbarButtons.d.ts.map +0 -1
  35. package/components/EditableTableV2/ToolbarButtons.js +0 -84
  36. package/components/EditableTableV2/index.d.ts +0 -62
  37. package/components/EditableTableV2/index.d.ts.map +0 -1
  38. package/components/EditableTableV2/index.js +0 -1009
  39. package/components/EditableTableV2/pinning.d.ts +0 -8
  40. package/components/EditableTableV2/pinning.d.ts.map +0 -1
  41. package/components/EditableTableV2/pinning.js +0 -16
  42. package/components/EditableTableV2/types.d.ts +0 -89
  43. package/components/EditableTableV2/types.d.ts.map +0 -1
  44. package/components/EditableTableV2/types.js +0 -18
@@ -48,43 +48,6 @@ const strings = {
48
48
  UPLOAD_FILES: 'Subir archivos',
49
49
  UPLOAD_FILES_DESCRIPTION: 'Buscar o arrastrar y soltar archivos.',
50
50
  VR: 'RV',
51
- ZOOM: 'Acercar/alejar',
52
- TABLE_SAVE_ERROR: 'No se pudieron guardar los cambios. Por favor, inténtelo de nuevo.',
53
- TABLE_FILTER: 'Filtrar',
54
- TABLE_FILTER_BY: 'Filtrar por {column}',
55
- TABLE_MIN: 'Mínimo',
56
- TABLE_MAX: 'Máximo',
57
- TABLE_ALL: 'Todos',
58
- TABLE_SEARCH: 'Buscar',
59
- TABLE_COLUMNS: 'Columnas',
60
- TABLE_DRAG_COLUMN: 'Arrastrar columna',
61
- TABLE_MOVE: 'Mover',
62
- TABLE_MOVE_BACK: 'Mover columna hacia atrás',
63
- TABLE_MOVE_FORWARD: 'Mover columna hacia adelante',
64
- TABLE_PIN: 'Fijar columna',
65
- TABLE_UNPIN: 'Sin fijar',
66
- TABLE_PIN_LEFT: 'Anclar a la izquierda',
67
- TABLE_PIN_RIGHT: 'Anclar a la derecha',
68
- TABLE_NO_ROWS: 'No hay registros para mostrar',
69
- TABLE_ROWS_PER_PAGE: 'Filas por página',
70
- TABLE_NEXT_PAGE: 'Página siguiente',
71
- TABLE_PREVIOUS_PAGE: 'Página anterior',
72
- TABLE_FIRST_PAGE: 'Primera página',
73
- TABLE_LAST_PAGE: 'Última página',
74
- TABLE_HIDE_COLUMN: 'Ocultar columna {column}',
75
- TABLE_SHOW_ALL_COLUMNS: 'Mostrar todas las columnas',
76
- TABLE_COLUMN_ACTIONS: 'Acciones de columna',
77
- TABLE_SORT_ASCENDING: 'Ordenar por {column} ascendente',
78
- TABLE_SORT_DESCENDING: 'Ordenar por {column} descendente',
79
- TABLE_CLEAR_SORTING: 'Borrar orden',
80
- TABLE_CLEAR_FILTER: 'Borrar filtro',
81
- TABLE_FILTERED: 'Filtrado',
82
- TABLE_CLEAR_SEARCH: 'Borrar búsqueda',
83
- TABLE_HIDE_ALL: 'Ocultar todo',
84
- TABLE_SHOW_ALL: 'Mostrar todo',
85
- TABLE_TOGGLE_SEARCH: 'Mostrar/Ocultar búsqueda',
86
- TABLE_TOGGLE_FILTERS: 'Mostrar/Ocultar filtros',
87
- TABLE_TOGGLE_DENSITY: 'Cambiar densidad',
88
- TABLE_TOGGLE_FULLSCREEN: 'Cambiar a pantalla completa'
51
+ ZOOM: 'Acercar/alejar'
89
52
  };
90
53
  export { strings };
@@ -49,42 +49,5 @@ export declare const strings: {
49
49
  UPLOAD_FILES_DESCRIPTION: string;
50
50
  VR: string;
51
51
  ZOOM: string;
52
- TABLE_SAVE_ERROR: string;
53
- TABLE_FILTER: string;
54
- TABLE_FILTER_BY: string;
55
- TABLE_MIN: string;
56
- TABLE_MAX: string;
57
- TABLE_ALL: string;
58
- TABLE_SEARCH: string;
59
- TABLE_COLUMNS: string;
60
- TABLE_DRAG_COLUMN: string;
61
- TABLE_MOVE: string;
62
- TABLE_MOVE_BACK: string;
63
- TABLE_MOVE_FORWARD: string;
64
- TABLE_PIN: string;
65
- TABLE_UNPIN: string;
66
- TABLE_PIN_LEFT: string;
67
- TABLE_PIN_RIGHT: string;
68
- TABLE_NO_ROWS: string;
69
- TABLE_ROWS_PER_PAGE: string;
70
- TABLE_NEXT_PAGE: string;
71
- TABLE_PREVIOUS_PAGE: string;
72
- TABLE_FIRST_PAGE: string;
73
- TABLE_LAST_PAGE: string;
74
- TABLE_HIDE_COLUMN: string;
75
- TABLE_SHOW_ALL_COLUMNS: string;
76
- TABLE_COLUMN_ACTIONS: string;
77
- TABLE_SORT_ASCENDING: string;
78
- TABLE_SORT_DESCENDING: string;
79
- TABLE_CLEAR_SORTING: string;
80
- TABLE_CLEAR_FILTER: string;
81
- TABLE_FILTERED: string;
82
- TABLE_CLEAR_SEARCH: string;
83
- TABLE_HIDE_ALL: string;
84
- TABLE_SHOW_ALL: string;
85
- TABLE_TOGGLE_SEARCH: string;
86
- TABLE_TOGGLE_FILTERS: string;
87
- TABLE_TOGGLE_DENSITY: string;
88
- TABLE_TOGGLE_FULLSCREEN: string;
89
52
  };
90
53
  //# sourceMappingURL=strings-fr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"strings-fr.d.ts","sourceRoot":"","sources":["../../src/strings/strings-fr.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFnB,CAAC"}
1
+ {"version":3,"file":"strings-fr.d.ts","sourceRoot":"","sources":["../../src/strings/strings-fr.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDnB,CAAC"}
@@ -48,43 +48,6 @@ const strings = {
48
48
  UPLOAD_FILES: 'Téléverser des fichiers',
49
49
  UPLOAD_FILES_DESCRIPTION: 'Parcourir ou glisser-déposer des fichiers.',
50
50
  VR: 'RV',
51
- ZOOM: 'Zoom',
52
- TABLE_SAVE_ERROR: 'Impossible d’enregistrer les modifications. Veuillez réessayer.',
53
- TABLE_FILTER: 'Filtrer',
54
- TABLE_FILTER_BY: 'Filtrer par {column}',
55
- TABLE_MIN: 'Minimum',
56
- TABLE_MAX: 'Maximum',
57
- TABLE_ALL: 'Tout',
58
- TABLE_SEARCH: 'Rechercher',
59
- TABLE_COLUMNS: 'Colonnes',
60
- TABLE_DRAG_COLUMN: 'Déplacer la colonne',
61
- TABLE_MOVE: 'Déplacer',
62
- TABLE_MOVE_BACK: 'Déplacer la colonne vers l’arrière',
63
- TABLE_MOVE_FORWARD: 'Déplacer la colonne vers l’avant',
64
- TABLE_PIN: 'Épingler la colonne',
65
- TABLE_UNPIN: 'Désépinglée',
66
- TABLE_PIN_LEFT: 'Épingler à gauche',
67
- TABLE_PIN_RIGHT: 'Épingler à droite',
68
- TABLE_NO_ROWS: 'Aucun enregistrement à afficher',
69
- TABLE_ROWS_PER_PAGE: 'Lignes par page',
70
- TABLE_NEXT_PAGE: 'Page suivante',
71
- TABLE_PREVIOUS_PAGE: 'Page précédente',
72
- TABLE_FIRST_PAGE: 'Première page',
73
- TABLE_LAST_PAGE: 'Dernière page',
74
- TABLE_HIDE_COLUMN: 'Masquer la colonne {column}',
75
- TABLE_SHOW_ALL_COLUMNS: 'Afficher toutes les colonnes',
76
- TABLE_COLUMN_ACTIONS: 'Actions de colonne',
77
- TABLE_SORT_ASCENDING: 'Trier par {column} croissant',
78
- TABLE_SORT_DESCENDING: 'Trier par {column} décroissant',
79
- TABLE_CLEAR_SORTING: 'Effacer le tri',
80
- TABLE_CLEAR_FILTER: 'Effacer le filtre',
81
- TABLE_FILTERED: 'Filtré',
82
- TABLE_CLEAR_SEARCH: 'Effacer la recherche',
83
- TABLE_HIDE_ALL: 'Tout masquer',
84
- TABLE_SHOW_ALL: 'Tout afficher',
85
- TABLE_TOGGLE_SEARCH: 'Afficher/Masquer la recherche',
86
- TABLE_TOGGLE_FILTERS: 'Afficher/Masquer les filtres',
87
- TABLE_TOGGLE_DENSITY: 'Changer la densité',
88
- TABLE_TOGGLE_FULLSCREEN: 'Basculer en plein écran'
51
+ ZOOM: 'Zoom'
89
52
  };
90
53
  export { strings };
@@ -49,42 +49,5 @@ export declare const strings: {
49
49
  UPLOAD_FILES_DESCRIPTION: string;
50
50
  VR: string;
51
51
  ZOOM: string;
52
- TABLE_SAVE_ERROR: string;
53
- TABLE_FILTER: string;
54
- TABLE_FILTER_BY: string;
55
- TABLE_MIN: string;
56
- TABLE_MAX: string;
57
- TABLE_ALL: string;
58
- TABLE_SEARCH: string;
59
- TABLE_COLUMNS: string;
60
- TABLE_DRAG_COLUMN: string;
61
- TABLE_MOVE: string;
62
- TABLE_MOVE_BACK: string;
63
- TABLE_MOVE_FORWARD: string;
64
- TABLE_PIN: string;
65
- TABLE_UNPIN: string;
66
- TABLE_PIN_LEFT: string;
67
- TABLE_PIN_RIGHT: string;
68
- TABLE_NO_ROWS: string;
69
- TABLE_ROWS_PER_PAGE: string;
70
- TABLE_NEXT_PAGE: string;
71
- TABLE_PREVIOUS_PAGE: string;
72
- TABLE_FIRST_PAGE: string;
73
- TABLE_LAST_PAGE: string;
74
- TABLE_HIDE_COLUMN: string;
75
- TABLE_SHOW_ALL_COLUMNS: string;
76
- TABLE_COLUMN_ACTIONS: string;
77
- TABLE_SORT_ASCENDING: string;
78
- TABLE_SORT_DESCENDING: string;
79
- TABLE_CLEAR_SORTING: string;
80
- TABLE_CLEAR_FILTER: string;
81
- TABLE_FILTERED: string;
82
- TABLE_CLEAR_SEARCH: string;
83
- TABLE_HIDE_ALL: string;
84
- TABLE_SHOW_ALL: string;
85
- TABLE_TOGGLE_SEARCH: string;
86
- TABLE_TOGGLE_FILTERS: string;
87
- TABLE_TOGGLE_DENSITY: string;
88
- TABLE_TOGGLE_FULLSCREEN: string;
89
52
  };
90
53
  //# sourceMappingURL=strings-gx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"strings-gx.d.ts","sourceRoot":"","sources":["../../src/strings/strings-gx.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFnB,CAAC"}
1
+ {"version":3,"file":"strings-gx.d.ts","sourceRoot":"","sources":["../../src/strings/strings-gx.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDnB,CAAC"}
@@ -48,43 +48,6 @@ const strings = {
48
48
  UPLOAD_FILES: 'RmlsZXM VXBsb2Fk',
49
49
  UPLOAD_FILES_DESCRIPTION: 'ZmlsZXMu ZHJvcA YW5k ZHJhZw b3I QnJvd3Nl',
50
50
  VR: 'VlI',
51
- ZOOM: 'Wm9vbQ',
52
- TABLE_SAVE_ERROR: 'YWdhaW4u dHJ5 UGxlYXNl Y2hhbmdlcy4 c2F2ZQ dG8 VW5hYmxl',
53
- TABLE_FILTER: 'RmlsdGVy',
54
- TABLE_FILTER_BY: '{column} Ynk RmlsdGVy',
55
- TABLE_MIN: 'TWluaW11bQ',
56
- TABLE_MAX: 'TWF4aW11bQ',
57
- TABLE_ALL: 'QWxs',
58
- TABLE_SEARCH: 'U2VhcmNo',
59
- TABLE_COLUMNS: 'Q29sdW1ucw',
60
- TABLE_DRAG_COLUMN: 'Y29sdW1u RHJhZw',
61
- TABLE_MOVE: 'TW92ZQ',
62
- TABLE_MOVE_BACK: 'YmFja3dhcmQ Y29sdW1u TW92ZQ',
63
- TABLE_MOVE_FORWARD: 'Zm9yd2FyZA Y29sdW1u TW92ZQ',
64
- TABLE_PIN: 'Y29sdW1u UGlu',
65
- TABLE_UNPIN: 'VW5waW5uZWQ',
66
- TABLE_PIN_LEFT: 'bGVmdA dG8 UGlu',
67
- TABLE_PIN_RIGHT: 'cmlnaHQ dG8 UGlu',
68
- TABLE_NO_ROWS: 'ZGlzcGxheQ dG8 cmVjb3Jkcw Tm8',
69
- TABLE_ROWS_PER_PAGE: 'cGFnZQ cGVy Um93cw',
70
- TABLE_NEXT_PAGE: 'cGFnZQ TmV4dA',
71
- TABLE_PREVIOUS_PAGE: 'cGFnZQ UHJldmlvdXM',
72
- TABLE_FIRST_PAGE: 'cGFnZQ Rmlyc3Q',
73
- TABLE_LAST_PAGE: 'cGFnZQ TGFzdA',
74
- TABLE_HIDE_COLUMN: 'Y29sdW1u {column} SGlkZQ',
75
- TABLE_SHOW_ALL_COLUMNS: 'Y29sdW1ucw YWxs U2hvdw',
76
- TABLE_COLUMN_ACTIONS: 'YWN0aW9ucw Q29sdW1u',
77
- TABLE_SORT_ASCENDING: 'YXNjZW5kaW5n {column} Ynk U29ydA',
78
- TABLE_SORT_DESCENDING: 'ZGVzY2VuZGluZw {column} Ynk U29ydA',
79
- TABLE_CLEAR_SORTING: 'c29ydGluZw Q2xlYXI',
80
- TABLE_CLEAR_FILTER: 'ZmlsdGVy Q2xlYXI',
81
- TABLE_FILTERED: 'RmlsdGVyZWQ',
82
- TABLE_CLEAR_SEARCH: 'c2VhcmNo Q2xlYXI',
83
- TABLE_HIDE_ALL: 'YWxs SGlkZQ',
84
- TABLE_SHOW_ALL: 'YWxs U2hvdw',
85
- TABLE_TOGGLE_SEARCH: 'c2VhcmNo U2hvdy9IaWRl',
86
- TABLE_TOGGLE_FILTERS: 'ZmlsdGVycw U2hvdy9IaWRl',
87
- TABLE_TOGGLE_DENSITY: 'ZGVuc2l0eQ VG9nZ2xl',
88
- TABLE_TOGGLE_FULLSCREEN: 'c2NyZWVu ZnVsbA VG9nZ2xl'
51
+ ZOOM: 'Wm9vbQ'
89
52
  };
90
53
  export { strings };
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import { DragEndEvent } from '@dnd-kit/core';
3
- import { MenuItemProps, MenuProps, TableCellProps, TableContainerProps } from '@mui/material';
4
- type DragContextProps = {
5
- ids: string[];
6
- onDragEnd: (event: DragEndEvent) => void;
7
- };
8
- export declare const ColumnDragMenu: ({ ids, onDragEnd, ...props }: DragContextProps & Omit<MenuProps, "onDragEnd">) => React.JSX.Element;
9
- export declare const ColumnDragTableContainer: ({ ids, onDragEnd, ...props }: DragContextProps & Omit<TableContainerProps, "onDragEnd">) => React.JSX.Element;
10
- export declare const ColumnDragHandle: () => React.ReactNode;
11
- type ColumnDragProps = {
12
- id: string;
13
- label: string;
14
- enabled: boolean;
15
- };
16
- export declare const DraggableColumnHeader: ({ id, label, enabled, ...props }: ColumnDragProps & TableCellProps) => React.JSX.Element;
17
- export declare const ColumnDragBodyCell: ({ columnId, lastRow, ...props }: TableCellProps & {
18
- columnId: string;
19
- lastRow: boolean;
20
- }) => React.JSX.Element;
21
- export declare const DraggableColumnItem: ({ id, label, enabled, ...props }: ColumnDragProps & MenuItemProps) => React.JSX.Element;
22
- export {};
23
- //# sourceMappingURL=ColumnDragging.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ColumnDragging.d.ts","sourceRoot":"","sources":["../../../src/components/EditableTableV2/ColumnDragging.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8E,MAAM,OAAO,CAAC;AAEnG,OAAO,EAGL,YAAY,EASb,MAAM,eAAe,CAAC;AAGvB,OAAO,EAKL,aAAa,EACb,SAAS,EAET,cAAc,EAEd,mBAAmB,EAGpB,MAAM,eAAe,CAAC;AAIvB,KAAK,gBAAgB,GAAG;IAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;CAAE,CAAC;AAgGpF,eAAO,MAAM,cAAc,GAAI,8BAA8B,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,sBAI3G,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,8BAItC,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,sBAI3D,CAAC;AAGF,eAAO,MAAM,gBAAgB,uBAAsC,CAAC;AAqBpE,KAAK,eAAe,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAsDF,eAAO,MAAM,qBAAqB,GAAI,kCAAkC,eAAe,GAAG,cAAc,sBAQvG,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,iCAIhC,cAAc,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,sBAGzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,kCAAkC,eAAe,GAAG,aAAa,sBAWpG,CAAC"}
@@ -1,263 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { createContext, useCallback, useContext, useRef, useState } from "react";
3
- import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, closestCenter, useDndContext, useSensor, useSensors } from "@dnd-kit/core";
4
- import { SortableContext, useSortable } from "@dnd-kit/sortable";
5
- import { DragHandle } from "@mui/icons-material";
6
- import { Box, IconButton, Menu, MenuItem, TableCell, TableContainer, Tooltip, useTheme } from "@mui/material";
7
- import { useStrings } from "../../strings/index.js";
8
- const columnKeyboardCoordinates = (event, { currentCoordinates, context })=>{
9
- const { active, over, collisionRect, droppableRects, droppableContainers } = context;
10
- const items = active?.data.current?.sortable?.items;
11
- if (!active || !collisionRect || !items) return;
12
- if (![
13
- 'ArrowRight',
14
- 'ArrowDown',
15
- 'ArrowLeft',
16
- 'ArrowUp'
17
- ].includes(event.code)) return;
18
- event.preventDefault();
19
- const currentId = over?.id ?? active.id;
20
- const current = droppableRects.get(currentId);
21
- if (!current) return;
22
- const index = items.indexOf(String(currentId));
23
- const nextId = [
24
- items[index - 1],
25
- items[index + 1]
26
- ].find((id)=>{
27
- const rect = droppableRects.get(id);
28
- if (!rect || droppableContainers.get(id)?.disabled) return false;
29
- return 'ArrowRight' === event.code ? rect.left > current.left : 'ArrowLeft' === event.code ? rect.left < current.left : 'ArrowDown' === event.code ? rect.top > current.top : rect.top < current.top;
30
- });
31
- const next = nextId ? droppableRects.get(nextId) : void 0;
32
- if (!next) return;
33
- return {
34
- x: currentCoordinates.x + next.left + next.width / 2 - collisionRect.left - collisionRect.width / 2,
35
- y: currentCoordinates.y + next.top + next.height / 2 - collisionRect.top - collisionRect.height / 2
36
- };
37
- };
38
- const ColumnDragContext = ({ ids, onDragEnd, children })=>{
39
- const [overlay, setOverlay] = useState(null);
40
- const sensors = useSensors(useSensor(PointerSensor, {
41
- activationConstraint: {
42
- distance: 5
43
- }
44
- }), useSensor(KeyboardSensor, {
45
- coordinateGetter: columnKeyboardCoordinates
46
- }));
47
- return /*#__PURE__*/ jsxs(DndContext, {
48
- sensors: sensors,
49
- collisionDetection: closestCenter,
50
- measuring: {
51
- dragOverlay: {
52
- measure: (node)=>overlay?.rect ?? node.getBoundingClientRect()
53
- }
54
- },
55
- onDragStart: ({ active })=>{
56
- const element = active.data.current?.getDragElement();
57
- if (element) {
58
- const { width, height, top, left, right, bottom } = element.getBoundingClientRect();
59
- const rect = {
60
- width,
61
- height,
62
- top,
63
- left,
64
- right,
65
- bottom
66
- };
67
- const html = 'TH' === element.tagName ? `<table style="border-collapse:collapse;width:${rect.width}px"><thead><tr>${element.outerHTML}</tr></thead></table>` : `<ul style="margin:0;padding:0;list-style:none">${element.outerHTML}</ul>`;
68
- setOverlay({
69
- html,
70
- rect
71
- });
72
- }
73
- },
74
- onDragCancel: ()=>setOverlay(null),
75
- onDragEnd: (event)=>{
76
- setOverlay(null);
77
- onDragEnd(event);
78
- },
79
- children: [
80
- /*#__PURE__*/ jsx(SortableContext, {
81
- items: ids,
82
- children: children
83
- }),
84
- /*#__PURE__*/ jsx(DragOverlay, {
85
- dropAnimation: null,
86
- zIndex: 1500,
87
- children: overlay && /*#__PURE__*/ jsx(Box, {
88
- "aria-hidden": true,
89
- "data-testid": "column-drag-overlay",
90
- sx: {
91
- width: overlay.rect.width,
92
- height: overlay.rect.height,
93
- opacity: 0.65,
94
- bgcolor: 'background.paper',
95
- pointerEvents: 'none'
96
- },
97
- dangerouslySetInnerHTML: {
98
- __html: overlay.html
99
- }
100
- })
101
- })
102
- ]
103
- });
104
- };
105
- const ColumnDragMenuContent = (props)=>{
106
- const { active } = useDndContext();
107
- return /*#__PURE__*/ jsx(Menu, {
108
- ...props,
109
- disableEscapeKeyDown: !!active || props.disableEscapeKeyDown
110
- });
111
- };
112
- const ColumnDragMenu = ({ ids, onDragEnd, ...props })=>/*#__PURE__*/ jsx(ColumnDragContext, {
113
- ids: ids,
114
- onDragEnd: onDragEnd,
115
- children: /*#__PURE__*/ jsx(ColumnDragMenuContent, {
116
- ...props
117
- })
118
- });
119
- const ColumnDragTableContainer = ({ ids, onDragEnd, ...props })=>/*#__PURE__*/ jsx(ColumnDragContext, {
120
- ids: ids,
121
- onDragEnd: onDragEnd,
122
- children: /*#__PURE__*/ jsx(TableContainer, {
123
- ...props
124
- })
125
- });
126
- const DragHandleContext = /*#__PURE__*/ createContext(null);
127
- const ColumnDragHandle = ()=>useContext(DragHandleContext);
128
- const useColumnDragBorders = (id, edge)=>{
129
- const { active, over } = useDndContext();
130
- const theme = useTheme();
131
- const isDragging = active?.id === id;
132
- const isOver = over?.id === id;
133
- if (!isDragging && !isOver) return {};
134
- const border = isDragging ? `1px dashed ${theme.palette.grey[500]}` : `2px dashed ${theme.palette.primary.main}`;
135
- return {
136
- borderLeft: border,
137
- borderRight: border,
138
- ...'top' === edge && {
139
- borderTop: border
140
- },
141
- ...'bottom' === edge && {
142
- borderBottom: border
143
- },
144
- opacity: 0.5,
145
- ...isDragging && {
146
- zIndex: 2
147
- }
148
- };
149
- };
150
- const useColumnDrag = ({ id, label, enabled }, activeOutlineWidth = 1)=>{
151
- const strings = useStrings();
152
- const theme = useTheme();
153
- const element = useRef(null);
154
- const { setNodeRef, setActivatorNodeRef, attributes, listeners, isDragging, isOver } = useSortable({
155
- id,
156
- disabled: !enabled,
157
- data: {
158
- getDragElement: ()=>element.current
159
- }
160
- });
161
- const ref = useCallback((node)=>{
162
- element.current = node;
163
- setNodeRef(node);
164
- }, [
165
- setNodeRef
166
- ]);
167
- const dragStyles = {
168
- outline: isDragging ? `${activeOutlineWidth}px dashed ${theme.palette.grey[500]}` : isOver ? `2px dashed ${theme.palette.primary.main}` : void 0,
169
- outlineOffset: '-2px'
170
- };
171
- const handle = enabled && /*#__PURE__*/ jsx(Tooltip, {
172
- title: strings.TABLE_MOVE,
173
- placement: "top",
174
- children: /*#__PURE__*/ jsx(IconButton, {
175
- size: "small",
176
- disableRipple: true,
177
- ref: setActivatorNodeRef,
178
- ...attributes,
179
- ...listeners,
180
- "aria-label": `${strings.TABLE_DRAG_COLUMN}: ${label}`,
181
- sx: {
182
- touchAction: 'none',
183
- cursor: 'grab',
184
- '&:active': {
185
- cursor: 'grabbing'
186
- },
187
- '&:hover': {
188
- backgroundColor: 'transparent',
189
- opacity: 1
190
- },
191
- m: '0 -0.1rem',
192
- opacity: 0.5,
193
- p: '2px',
194
- transition: 'all 150ms ease-in-out'
195
- },
196
- onClick: (event)=>event.stopPropagation(),
197
- children: /*#__PURE__*/ jsx(DragHandle, {})
198
- })
199
- });
200
- return {
201
- ref,
202
- handle,
203
- dragStyles,
204
- isDragging
205
- };
206
- };
207
- const DraggableColumnHeader = ({ id, label, enabled, ...props })=>{
208
- const { ref, handle } = useColumnDrag({
209
- id,
210
- label,
211
- enabled
212
- });
213
- const borders = useColumnDragBorders(id, 'top');
214
- return /*#__PURE__*/ jsx(DragHandleContext.Provider, {
215
- value: handle,
216
- children: /*#__PURE__*/ jsx(TableCell, {
217
- ...props,
218
- ref: ref,
219
- sx: [
220
- ...Array.isArray(props.sx) ? props.sx : [
221
- props.sx
222
- ],
223
- borders
224
- ]
225
- })
226
- });
227
- };
228
- const ColumnDragBodyCell = ({ columnId, lastRow, ...props })=>{
229
- const borders = useColumnDragBorders(columnId, lastRow ? 'bottom' : void 0);
230
- return /*#__PURE__*/ jsx(TableCell, {
231
- ...props,
232
- sx: [
233
- ...Array.isArray(props.sx) ? props.sx : [
234
- props.sx
235
- ],
236
- borders
237
- ]
238
- });
239
- };
240
- const DraggableColumnItem = ({ id, label, enabled, ...props })=>{
241
- const { ref, handle, dragStyles, isDragging } = useColumnDrag({
242
- id,
243
- label,
244
- enabled
245
- }, 2);
246
- return /*#__PURE__*/ jsx(DragHandleContext.Provider, {
247
- value: handle,
248
- children: /*#__PURE__*/ jsx(MenuItem, {
249
- ...props,
250
- ref: ref,
251
- sx: [
252
- ...Array.isArray(props.sx) ? props.sx : [
253
- props.sx
254
- ],
255
- dragStyles,
256
- {
257
- opacity: isDragging ? 0.5 : 1
258
- }
259
- ]
260
- })
261
- });
262
- };
263
- export { ColumnDragBodyCell, ColumnDragHandle, ColumnDragMenu, ColumnDragTableContainer, DraggableColumnHeader, DraggableColumnItem };
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { EditableTableCellV2, EditableTableColumnV2 } from './types';
3
- type Props<TData extends object> = {
4
- cell: EditableTableCellV2<TData>;
5
- column: EditableTableColumnV2<TData>;
6
- onClose: () => void;
7
- };
8
- declare const EditableCellV2: <TData extends object>({ cell, column, onClose }: Props<TData>) => React.JSX.Element;
9
- export default EditableCellV2;
10
- //# sourceMappingURL=EditableCellV2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditableCellV2.d.ts","sourceRoot":"","sources":["../../../src/components/EditableTableV2/EditableCellV2.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAKhD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErE,KAAK,KAAK,CAAC,KAAK,SAAS,MAAM,IAAI;IACjC,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACjC,MAAM,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,KAAK,SAAS,MAAM,EAAE,2BAA2B,KAAK,CAAC,KAAK,CAAC,sBA0EpF,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,81 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef, useState } from "react";
3
- import { Alert, Box, MenuItem, TextField } from "@mui/material";
4
- import { useStrings } from "../../strings/index.js";
5
- const EditableCellV2 = ({ cell, column, onClose })=>{
6
- const strings = useStrings();
7
- const [value, setValue] = useState(()=>cell.getValue() ?? '');
8
- const [isSaving, setIsSaving] = useState(false);
9
- const [failed, setFailed] = useState(false);
10
- const finished = useRef(false);
11
- const config = column.editConfig;
12
- const cancel = ()=>{
13
- if (!isSaving) {
14
- finished.current = true;
15
- onClose();
16
- }
17
- };
18
- const save = async (nextValue)=>{
19
- if (finished.current) return;
20
- finished.current = true;
21
- setIsSaving(true);
22
- setFailed(false);
23
- try {
24
- await config?.onSave?.(cell.row.original, nextValue, column.id);
25
- onClose();
26
- } catch {
27
- finished.current = false;
28
- setFailed(true);
29
- } finally{
30
- setIsSaving(false);
31
- }
32
- };
33
- return /*#__PURE__*/ jsxs(Box, {
34
- onClick: (event)=>event.stopPropagation(),
35
- onDoubleClick: (event)=>event.stopPropagation(),
36
- children: [
37
- config?.editVariant === 'custom' && config.customEditComponent ? config.customEditComponent({
38
- ...cell.getContext(),
39
- save,
40
- cancel,
41
- isSaving
42
- }) : /*#__PURE__*/ jsx(TextField, {
43
- autoFocus: true,
44
- fullWidth: true,
45
- size: "small",
46
- select: config?.editVariant === 'select',
47
- value: value,
48
- disabled: isSaving,
49
- error: failed,
50
- slotProps: {
51
- htmlInput: {
52
- 'aria-label': column.header
53
- }
54
- },
55
- onChange: (event)=>setValue(event.target.value),
56
- onBlur: ()=>void save(value),
57
- onKeyDown: (event)=>{
58
- event.stopPropagation();
59
- if (event.nativeEvent.isComposing || 229 === event.nativeEvent.keyCode) return;
60
- if ('Enter' === event.key && config?.editVariant !== 'select') {
61
- event.preventDefault();
62
- save(value);
63
- } else if ('Escape' === event.key) {
64
- event.preventDefault();
65
- cancel();
66
- }
67
- },
68
- children: config?.editVariant === 'select' && config.selectOptions?.map((option)=>/*#__PURE__*/ jsx(MenuItem, {
69
- value: option.value,
70
- children: option.label
71
- }, option.value))
72
- }),
73
- failed && /*#__PURE__*/ jsx(Alert, {
74
- severity: "error",
75
- children: strings.TABLE_SAVE_ERROR
76
- })
77
- ]
78
- });
79
- };
80
- const EditableTableV2_EditableCellV2 = EditableCellV2;
81
- export default EditableTableV2_EditableCellV2;
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import { BoxProps } from '@mui/material';
3
- import { EditableTableInstanceV2 } from './types';
4
- type ToolbarState = {
5
- table: object;
6
- globalFilterVisible: boolean;
7
- columnFiltersVisible: boolean;
8
- density: number;
9
- fullScreen: boolean;
10
- toggleGlobalFilter: () => void;
11
- toggleColumnFilters: () => void;
12
- toggleDensity: () => void;
13
- toggleFullScreen: () => void;
14
- openColumns: (anchor: HTMLElement) => void;
15
- registerColumnsButton: () => () => void;
16
- };
17
- export declare const EditableTableToolbarRoot: ({ value, ...props }: BoxProps & {
18
- value: ToolbarState;
19
- }) => React.JSX.Element;
20
- type ButtonProps<TData extends object> = {
21
- table: EditableTableInstanceV2<TData>;
22
- };
23
- export declare const EditableTableToggleGlobalFilterButtonV2: <TData extends object>(props: ButtonProps<TData>) => React.JSX.Element;
24
- export declare const EditableTableToggleFiltersButtonV2: <TData extends object>(props: ButtonProps<TData>) => React.JSX.Element;
25
- export declare const EditableTableShowHideColumnsButtonV2: <TData extends object>(props: ButtonProps<TData>) => React.JSX.Element;
26
- export declare const EditableTableToggleDensePaddingButtonV2: <TData extends object>(props: ButtonProps<TData>) => React.JSX.Element;
27
- export declare const EditableTableToggleFullScreenButtonV2: <TData extends object>(props: ButtonProps<TData>) => React.JSX.Element;
28
- export {};
29
- //# sourceMappingURL=ToolbarButtons.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToolbarButtons.d.ts","sourceRoot":"","sources":["../../../src/components/EditableTableV2/ToolbarButtons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAcpE,OAAO,EAAO,QAAQ,EAAuB,MAAM,eAAe,CAAC;AAGnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAElD,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,qBAAqB,EAAE,MAAM,MAAM,IAAI,CAAC;CACzC,CAAC;AAIF,eAAO,MAAM,wBAAwB,GAAI,qBAAqB,QAAQ,GAAG;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,sBAI/F,CAAC;AAEF,KAAK,WAAW,CAAC,KAAK,SAAS,MAAM,IAAI;IAAE,KAAK,EAAE,uBAAuB,CAAC,KAAK,CAAC,CAAA;CAAE,CAAC;AA2DnF,eAAO,MAAM,uCAAuC,GAAI,KAAK,SAAS,MAAM,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,sBAEtG,CAAC;AACF,eAAO,MAAM,kCAAkC,GAAI,KAAK,SAAS,MAAM,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,sBAEjG,CAAC;AACF,eAAO,MAAM,oCAAoC,GAAI,KAAK,SAAS,MAAM,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,sBAEnG,CAAC;AACF,eAAO,MAAM,uCAAuC,GAAI,KAAK,SAAS,MAAM,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,sBAEtG,CAAC;AACF,eAAO,MAAM,qCAAqC,GAAI,KAAK,SAAS,MAAM,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,sBAEpG,CAAC"}