slick-table 1.1.16 → 1.1.18

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 (82) hide show
  1. package/dist/index.cjs.js +85 -85
  2. package/dist/index.es.js +4648 -4583
  3. package/dist/types/entities/popup-summary/index.d.ts +0 -1
  4. package/dist/types/entities/popup-summary/index.d.ts.map +1 -1
  5. package/dist/types/entities/popup-summary/lib/getTotals.d.ts.map +1 -1
  6. package/dist/types/entities/popup-summary/model/index.d.ts +0 -1
  7. package/dist/types/entities/popup-summary/model/index.d.ts.map +1 -1
  8. package/dist/types/entities/popup-summary/model/types/ITotal.d.ts +5 -0
  9. package/dist/types/entities/popup-summary/model/types/ITotal.d.ts.map +1 -1
  10. package/dist/types/entities/popup-summary/ui/PopupSummary.d.ts.map +1 -1
  11. package/dist/types/entities/popup-summary/ui/PopupSummary.style.d.ts +13 -0
  12. package/dist/types/entities/popup-summary/ui/PopupSummary.style.d.ts.map +1 -0
  13. package/dist/types/entities/popup-summary/ui/TotalByColumn/TotalByColumn.d.ts +2 -0
  14. package/dist/types/entities/popup-summary/ui/TotalByColumn/TotalByColumn.d.ts.map +1 -1
  15. package/dist/types/entities/popup-summary/ui/TotalByColumn/TotalByColumn.style.d.ts.map +1 -1
  16. package/dist/types/entities/popup-summary/ui/styles/StyledDialogContentText.d.ts +4 -0
  17. package/dist/types/entities/popup-summary/ui/styles/StyledDialogContentText.d.ts.map +1 -0
  18. package/dist/types/entities/popup-summary/ui/styles/index.d.ts +2 -0
  19. package/dist/types/entities/popup-summary/ui/styles/index.d.ts.map +1 -0
  20. package/dist/types/features/column-filters/ui/ButtonReset/ButtonReset.style.d.ts +1 -1
  21. package/dist/types/features/context-menu/ui/ButtonSummary/ButtonSummary.d.ts.map +1 -1
  22. package/dist/types/features/header-context-menu/ui/Item/Item.style.d.ts +1 -1
  23. package/dist/types/index.d.ts +1 -1
  24. package/dist/types/index.d.ts.map +1 -1
  25. package/dist/types/shared/lib/slickgrid/index.d.ts +1 -1
  26. package/dist/types/shared/lib/slickgrid/index.d.ts.map +1 -1
  27. package/dist/types/shared/lib/slickgrid/lib/hotKeys/hotKeysOpenSummary.d.ts +3 -0
  28. package/dist/types/shared/lib/slickgrid/lib/hotKeys/hotKeysOpenSummary.d.ts.map +1 -0
  29. package/dist/types/shared/lib/slickgrid/lib/hotKeys/index.d.ts +1 -0
  30. package/dist/types/shared/lib/slickgrid/lib/hotKeys/index.d.ts.map +1 -1
  31. package/dist/types/shared/lib/slickgrid/lib/index.d.ts +1 -1
  32. package/dist/types/shared/lib/slickgrid/lib/index.d.ts.map +1 -1
  33. package/dist/types/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/WithSummary.d.ts +7 -0
  34. package/dist/types/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/WithSummary.d.ts.map +1 -0
  35. package/dist/types/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/index.d.ts +1 -0
  36. package/dist/types/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/index.d.ts.map +1 -1
  37. package/dist/types/shared/lib/slickgrid/model/SlickTable/hotKeys/index.d.ts +1 -1
  38. package/dist/types/shared/lib/slickgrid/model/SlickTable/hotKeys/index.d.ts.map +1 -1
  39. package/dist/types/shared/lib/slickgrid/model/SlickTable/index.d.ts +1 -1
  40. package/dist/types/shared/lib/slickgrid/model/SlickTable/index.d.ts.map +1 -1
  41. package/dist/types/shared/lib/slickgrid/model/events/eventSummary.d.ts +13 -0
  42. package/dist/types/shared/lib/slickgrid/model/events/eventSummary.d.ts.map +1 -0
  43. package/dist/types/shared/lib/slickgrid/model/events/index.d.ts +1 -0
  44. package/dist/types/shared/lib/slickgrid/model/events/index.d.ts.map +1 -1
  45. package/dist/types/shared/lib/slickgrid/model/index.d.ts +2 -2
  46. package/dist/types/shared/lib/slickgrid/model/index.d.ts.map +1 -1
  47. package/dist/types/shared/model/enums/EKeyCode.d.ts +1 -0
  48. package/dist/types/shared/model/enums/EKeyCode.d.ts.map +1 -1
  49. package/dist/types/shared/ui/ContextSelect/ContextSelect.style.d.ts +1 -1
  50. package/package.json +1 -1
  51. package/src/app/styles/icons.scss +16 -0
  52. package/src/app/styles/mixins.scss +12 -0
  53. package/src/entities/popup-summary/index.ts +0 -1
  54. package/src/entities/popup-summary/lib/getTotals.ts +16 -1
  55. package/src/entities/popup-summary/model/index.ts +0 -1
  56. package/src/entities/popup-summary/model/types/ITotal.ts +23 -1
  57. package/src/entities/popup-summary/ui/PopupSummary.style.ts +21 -0
  58. package/src/entities/popup-summary/ui/PopupSummary.tsx +24 -24
  59. package/src/entities/popup-summary/ui/TotalByColumn/TotalByColumn.style.ts +3 -0
  60. package/src/entities/popup-summary/ui/TotalByColumn/TotalByColumn.tsx +13 -4
  61. package/src/entities/popup-summary/ui/styles/StyledDialogContentText.ts +7 -0
  62. package/src/entities/popup-summary/ui/styles/index.ts +1 -0
  63. package/src/features/context-menu/ui/ButtonSummary/ButtonSummary.tsx +2 -4
  64. package/src/index.scss +2 -1
  65. package/src/index.ts +2 -0
  66. package/src/shared/lib/slickgrid/index.ts +2 -0
  67. package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysOpenSummary.ts +7 -0
  68. package/src/shared/lib/slickgrid/lib/hotKeys/index.ts +1 -0
  69. package/src/shared/lib/slickgrid/lib/index.ts +1 -0
  70. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/WithSummary.ts +28 -0
  71. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/index.ts +1 -0
  72. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/index.ts +1 -0
  73. package/src/shared/lib/slickgrid/model/SlickTable/index.ts +1 -0
  74. package/src/{entities/popup-summary/model/event → shared/lib/slickgrid/model/events}/eventSummary.ts +9 -0
  75. package/src/shared/lib/slickgrid/model/events/index.ts +1 -0
  76. package/src/shared/lib/slickgrid/model/index.ts +6 -1
  77. package/src/shared/model/enums/EKeyCode.ts +1 -0
  78. package/dist/types/entities/popup-summary/model/event/eventSummary.d.ts +0 -9
  79. package/dist/types/entities/popup-summary/model/event/eventSummary.d.ts.map +0 -1
  80. package/dist/types/entities/popup-summary/model/event/index.d.ts +0 -2
  81. package/dist/types/entities/popup-summary/model/event/index.d.ts.map +0 -1
  82. package/src/entities/popup-summary/model/event/index.ts +0 -1
@@ -1,9 +1,12 @@
1
1
  import { Tooltip } from "@mui/material";
2
2
  import { FC, useState } from "react";
3
+ import { FormatterResultWithHtml, FormatterResultWithText } from "slickgrid";
4
+
5
+ import { StyledDialogContentText } from "../styles";
3
6
 
4
7
  import Styled from "./TotalByColumn.style";
5
8
 
6
- export const TotalByColumn: FC<IProps> = ({ label, total }) => {
9
+ export const TotalByColumn: FC<IProps> = ({ label, total, totalFormatted }) => {
7
10
  const [open, setOpen] = useState(false);
8
11
 
9
12
  function copyToClipboard() {
@@ -15,8 +18,8 @@ export const TotalByColumn: FC<IProps> = ({ label, total }) => {
15
18
  }
16
19
 
17
20
  return (
18
- <Styled.DialogContentText>
19
- <Styled.Text>{`- total ${label}: ${total}`}</Styled.Text>
21
+ <StyledDialogContentText>
22
+ <Styled.Text>{`total ${label}: ${totalFormatted}`}</Styled.Text>
20
23
  {open ? (
21
24
  <Styled.Icon className={"sgi sgi-check"}></Styled.Icon>
22
25
  ) : (
@@ -27,11 +30,17 @@ export const TotalByColumn: FC<IProps> = ({ label, total }) => {
27
30
  />
28
31
  </Tooltip>
29
32
  )}
30
- </Styled.DialogContentText>
33
+ </StyledDialogContentText>
31
34
  );
32
35
  };
33
36
 
34
37
  interface IProps {
35
38
  label: string;
36
39
  total: number;
40
+ totalFormatted:
41
+ | string
42
+ | HTMLElement
43
+ | DocumentFragment
44
+ | FormatterResultWithHtml
45
+ | FormatterResultWithText;
37
46
  }
@@ -0,0 +1,7 @@
1
+ import { DialogContentText, styled } from "@mui/material";
2
+
3
+ export const StyledDialogContentText = styled(DialogContentText)({
4
+ alignItems: "center",
5
+ color: "#1E456F",
6
+ display: "flex",
7
+ });
@@ -0,0 +1 @@
1
+ export { StyledDialogContentText } from "./StyledDialogContentText";
@@ -1,8 +1,6 @@
1
1
  import { Dispatch, FC, SetStateAction } from "react";
2
2
 
3
- import { eventContextMenu } from "shared/lib/slickgrid";
4
-
5
- import { eventSummary } from "entities/popup-summary";
3
+ import { eventContextMenu, eventSummary } from "shared/lib/slickgrid";
6
4
 
7
5
  import Styled from "../ContextMenu.style";
8
6
 
@@ -14,7 +12,7 @@ export const ButtonSummary: FC<IProps> = ({ setIsOpened }) => {
14
12
  function openSummary() {
15
13
  if (!table) return;
16
14
  setIsOpened(false);
17
- eventContextMenu.table = table;
15
+ eventSummary.table = table;
18
16
  eventSummary.open = true;
19
17
  }
20
18
 
package/src/index.scss CHANGED
@@ -1,2 +1,3 @@
1
1
  @use './app/styles/slickgrid' as *;
2
- @use './app/styles/global' as *;
2
+ @use './app/styles/global' as *;
3
+ @use './app/styles/icons' as *;
package/src/index.ts CHANGED
@@ -19,6 +19,8 @@ export {
19
19
  SlickTable,
20
20
  SlickgridTable,
21
21
  TotalCalculator,
22
+ WithSummary,
23
+ WithoutHotKeys,
22
24
  columnIsEdited,
23
25
  columnCheckboxSelector,
24
26
  commitCurrentEdit,
@@ -60,9 +60,11 @@ export {
60
60
  RedoUndoOnly,
61
61
  SlickTable,
62
62
  WithConfirmationOfDeletion,
63
+ WithSummary,
63
64
  WithoutHotKeys,
64
65
  eventContextMenu,
65
66
  eventHeaderContextMenu,
67
+ eventSummary,
66
68
  } from "./model";
67
69
  export {
68
70
  SlickgridTable,
@@ -0,0 +1,7 @@
1
+ import { OnKeyDownEventArgs, SlickEventData } from "slickgrid";
2
+
3
+ import { EKeyCode } from "shared/model/enums";
4
+
5
+ export function hotKeysOpenSummary(event: SlickEventData<OnKeyDownEventArgs>) {
6
+ return event.altKey && event.keyCode === EKeyCode.KeyS;
7
+ }
@@ -1,5 +1,6 @@
1
1
  export { hotKeysCopy } from "./hotKeysCopy";
2
2
  export { hotKeysDelete } from "./hotKeysDelete";
3
+ export { hotKeysOpenSummary } from "./hotKeysOpenSummary";
3
4
  export { hotKeysRedo } from "./hotKeysRedo";
4
5
  export { hotKeysReverse } from "./hotKeysReverse";
5
6
  export { hotKeysUndo } from "./hotKeysUndo";
@@ -15,6 +15,7 @@ export {
15
15
  export {
16
16
  hotKeysCopy,
17
17
  hotKeysDelete,
18
+ hotKeysOpenSummary,
18
19
  hotKeysRedo,
19
20
  hotKeysReverse,
20
21
  hotKeysUndo,
@@ -0,0 +1,28 @@
1
+ import { OnKeyDownEventArgs, SlickEventData } from "slickgrid";
2
+
3
+ import { eventSummary } from "shared/lib/slickgrid";
4
+ import { ISlickTable } from "shared/model/types";
5
+
6
+ import { hotKeysOpenSummary } from "../../../../lib";
7
+ import { HotKeysDecorator } from "./HotKeysDecorator";
8
+
9
+ export class WithSummary extends HotKeysDecorator {
10
+ public handleKeyboardEvent(
11
+ event: SlickEventData<OnKeyDownEventArgs>,
12
+ table: ISlickTable,
13
+ ): void {
14
+ if (!table.isActive) return;
15
+ if (hotKeysOpenSummary(event)) {
16
+ if (!table.summaryColumnIds.length) return;
17
+ const grid = table.grid;
18
+ if (!grid) return;
19
+ if (grid.getSelectedRows().length < 2) return;
20
+ event.preventDefault();
21
+ event.stopImmediatePropagation();
22
+ eventSummary.table = table;
23
+ eventSummary.open = true;
24
+ } else {
25
+ super.handleKeyboardEvent.call(this, event, table);
26
+ }
27
+ }
28
+ }
@@ -2,3 +2,4 @@ export { HotKeysDecorator } from "./HotKeysDecorator";
2
2
  export { PreventCopying } from "./PreventCopying";
3
3
  export { RedoUndoOnly } from "./RedoUndoOnly";
4
4
  export { WithConfirmationOfDeletion } from "./WithConfirmationOfDeletion";
5
+ export { WithSummary } from "./WithSummary";
@@ -5,4 +5,5 @@ export {
5
5
  PreventCopying,
6
6
  RedoUndoOnly,
7
7
  WithConfirmationOfDeletion,
8
+ WithSummary,
8
9
  } from "./decorators";
@@ -6,6 +6,7 @@ export {
6
6
  PreventCopying,
7
7
  RedoUndoOnly,
8
8
  WithConfirmationOfDeletion,
9
+ WithSummary,
9
10
  WithoutHotKeys,
10
11
  } from "./hotKeys";
11
12
  export {
@@ -1,7 +1,9 @@
1
1
  import { AnEvent } from "shared/lib/an-event";
2
+ import { ISlickTable } from "shared/model/types";
2
3
 
3
4
  class EventSummary extends AnEvent {
4
5
  private _open = false;
6
+ private _table: ISlickTable | undefined;
5
7
 
6
8
  get open() {
7
9
  return this._open;
@@ -10,6 +12,13 @@ class EventSummary extends AnEvent {
10
12
  this._open = open;
11
13
  this.notify();
12
14
  }
15
+
16
+ get table() {
17
+ return this._table;
18
+ }
19
+ set table(table) {
20
+ this._table = table;
21
+ }
13
22
  }
14
23
 
15
24
  export const eventSummary = new EventSummary();
@@ -1,2 +1,3 @@
1
1
  export { eventContextMenu } from "./eventContextMenu";
2
2
  export { eventHeaderContextMenu } from "./eventHeaderContextMenu";
3
+ export { eventSummary } from "./eventSummary";
@@ -14,6 +14,11 @@ export {
14
14
  RedoUndoOnly,
15
15
  SlickTable,
16
16
  WithConfirmationOfDeletion,
17
+ WithSummary,
17
18
  WithoutHotKeys,
18
19
  } from "./SlickTable";
19
- export { eventContextMenu, eventHeaderContextMenu } from "./events";
20
+ export {
21
+ eventContextMenu,
22
+ eventHeaderContextMenu,
23
+ eventSummary,
24
+ } from "./events";
@@ -3,6 +3,7 @@ export enum EKeyCode {
3
3
  "KeyDel" = 46,
4
4
  "KeyEnter" = 13,
5
5
  "KeyR" = 82,
6
+ "KeyS" = 83,
6
7
  "KeyY" = 89,
7
8
  "KeyZ" = 90,
8
9
  }
@@ -1,9 +0,0 @@
1
- import { AnEvent } from '../../../../shared/lib/an-event';
2
- declare class EventSummary extends AnEvent {
3
- private _open;
4
- get open(): boolean;
5
- set open(open: boolean);
6
- }
7
- export declare const eventSummary: EventSummary;
8
- export {};
9
- //# sourceMappingURL=eventSummary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eventSummary.d.ts","sourceRoot":"","sources":["../../../../../../src/entities/popup-summary/model/event/eventSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,cAAM,YAAa,SAAQ,OAAO;IACjC,OAAO,CAAC,KAAK,CAAS;IAEtB,IAAI,IAAI,YAEP;IACD,IAAI,IAAI,CAAC,IAAI,SAAA,EAGZ;CACD;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { eventSummary } from './eventSummary';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/entities/popup-summary/model/event/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1 +0,0 @@
1
- export { eventSummary } from "./eventSummary";