@gravity-ui/dashkit 10.4.3 → 10.5.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.
Files changed (41) hide show
  1. package/README.md +3 -1
  2. package/build/cjs/components/ActionPanel/ActionPanel.css +53 -24
  3. package/build/cjs/components/ActionPanel/ActionPanel.js +27 -1
  4. package/build/cjs/components/ActionPanel/ActionPanel.js.map +1 -1
  5. package/build/cjs/components/DashKitDnDWrapper/DashKitDnDWrapper.js +4 -2
  6. package/build/cjs/components/DashKitDnDWrapper/DashKitDnDWrapper.js.map +1 -1
  7. package/build/cjs/components/GridItem/GridItem.css +4 -2
  8. package/build/cjs/components/GridLayout/ReactGridLayout.d.ts +2 -1
  9. package/build/cjs/components/GridLayout/ReactGridLayout.js +19 -15
  10. package/build/cjs/components/GridLayout/ReactGridLayout.js.map +1 -1
  11. package/build/cjs/components/GridLayout/__tests__/passive-resize.test.js +14 -25
  12. package/build/cjs/components/GridLayout/__tests__/passive-resize.test.js.map +1 -1
  13. package/build/cjs/context/DashKitDnDContext.d.ts +1 -1
  14. package/build/cjs/context/DashKitDnDContext.js.map +1 -1
  15. package/build/cjs/hooks/__tests__/useDnDItemProps.test.d.ts +2 -0
  16. package/build/cjs/hooks/__tests__/useDnDItemProps.test.js +45 -0
  17. package/build/cjs/hooks/__tests__/useDnDItemProps.test.js.map +1 -0
  18. package/build/cjs/hooks/useDnDItemProps.js +1 -1
  19. package/build/cjs/hooks/useDnDItemProps.js.map +1 -1
  20. package/build/cjs/package.json +1 -1
  21. package/build/docs/INDEX.md +3 -1
  22. package/build/esm/components/ActionPanel/ActionPanel.css +53 -24
  23. package/build/esm/components/ActionPanel/ActionPanel.js +27 -1
  24. package/build/esm/components/ActionPanel/ActionPanel.js.map +1 -1
  25. package/build/esm/components/DashKitDnDWrapper/DashKitDnDWrapper.js +4 -2
  26. package/build/esm/components/DashKitDnDWrapper/DashKitDnDWrapper.js.map +1 -1
  27. package/build/esm/components/GridItem/GridItem.css +4 -2
  28. package/build/esm/components/GridLayout/ReactGridLayout.d.ts +2 -1
  29. package/build/esm/components/GridLayout/ReactGridLayout.js +19 -15
  30. package/build/esm/components/GridLayout/ReactGridLayout.js.map +1 -1
  31. package/build/esm/components/GridLayout/__tests__/passive-resize.test.js +14 -25
  32. package/build/esm/components/GridLayout/__tests__/passive-resize.test.js.map +1 -1
  33. package/build/esm/context/DashKitDnDContext.d.ts +1 -1
  34. package/build/esm/context/DashKitDnDContext.js.map +1 -1
  35. package/build/esm/hooks/__tests__/useDnDItemProps.test.d.ts +2 -0
  36. package/build/esm/hooks/__tests__/useDnDItemProps.test.js +42 -0
  37. package/build/esm/hooks/__tests__/useDnDItemProps.test.js.map +1 -0
  38. package/build/esm/hooks/useDnDItemProps.js +1 -1
  39. package/build/esm/hooks/useDnDItemProps.js.map +1 -1
  40. package/build/esm/package.json +1 -1
  41. package/package.json +1 -1
package/README.md CHANGED
@@ -487,7 +487,7 @@ interface DashKitDnDWrapperProps {
487
487
  }
488
488
  ```
489
489
 
490
- - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64
490
+ - **dragImageSrc**: Optional custom drag image. By default, the dragged ActionPanel item is shown as the preview.
491
491
  - **onDragStart**: Callback called when element is dragged from ActionPanel
492
492
  - **onDragEnd**: Callback called when element dropped or drag canceled
493
493
 
@@ -550,7 +550,9 @@ const onDrop = (dropProps: ItemDropProps) => {
550
550
  | `--dashkit-action-panel-item-color` | Backgroud color |
551
551
  | `--dashkit-action-panel-item-text-color` | Text color |
552
552
  | `--dashkit-action-panel-item-color-hover` | Hover backgroud color |
553
+ | `--dashkit-action-panel-item-color-dragging` | Drag background color |
553
554
  | `--dashkit-action-panel-item-text-color-hover` | Hover text color |
555
+ | `--dashkit-action-panel-item-text-color-dragging` | Drag text color |
554
556
  | Overlay variables | |
555
557
  | `--dashkit-overlay-border-color` | Border color |
556
558
  | `--dashkit-overlay-color` | Background color |
@@ -1,20 +1,25 @@
1
1
  .dashkit-action-panel {
2
- --_--dashkit-action-panel-color: var(--dashkit-action-panel-color, var(--g-color-base-float));
3
- --_--dashkit-action-panel-border-color: var(
4
- --dashkit-action-panel-border-color,
5
- var(--g-color-base-brand)
2
+ --_--dashkit-action-panel-color: var(
3
+ --dashkit-action-panel-color,
4
+ var(--g-color-base-float-heavy)
6
5
  );
6
+ --_--dashkit-action-panel-border-color: var(--dashkit-action-panel-border-color, transparent);
7
7
  --_--dashkit-action-panel-border-radius: var(
8
8
  --dashkit-action-panel-border-radius,
9
- var(--g-border-radius-xl)
9
+ var(--g-border-radius-2xl, 16px)
10
10
  );
11
11
  background-color: var(--_--dashkit-action-panel-color);
12
+ backdrop-filter: blur(18px);
12
13
  position: fixed;
13
14
  bottom: 20px;
14
15
  display: flex;
16
+ width: max-content;
17
+ max-width: calc(100vw - 40px);
18
+ overflow-x: auto;
15
19
  border-radius: var(--_--dashkit-action-panel-border-radius);
16
- border: 2px solid var(--_--dashkit-action-panel-border-color);
17
- padding: 8px;
20
+ outline: 2px solid var(--_--dashkit-action-panel-border-color);
21
+ outline-offset: -2px;
22
+ padding: 6px;
18
23
  gap: 0;
19
24
  left: 50%;
20
25
  transform: translateX(-50%) translateY(0);
@@ -40,46 +45,70 @@
40
45
  --_--dashkit-action-panel-item-color: var(--dashkit-action-panel-item-color, transparent);
41
46
  --_--dashkit-action-panel-item-text-color: var(
42
47
  --dashkit-action-panel-item-text-color,
43
- var(--g-color-text-primary)
48
+ var(--g-color-text-light-primary)
44
49
  );
45
50
  --_--dashkit-action-panel-item-color-hover: var(
46
51
  --dashkit-action-panel-item-color-hover,
47
- var(--g-color-base-simple-hover)
52
+ var(--g-color-base-light-simple-hover)
53
+ );
54
+ --_--dashkit-action-panel-item-color-dragging: var(
55
+ --dashkit-action-panel-item-color-dragging,
56
+ var(--g-color-base-float-heavy)
48
57
  );
49
58
  --_--dashkit-action-panel-item-text-color-hover: var(
50
59
  --dashkit-action-panel-item-text-color-hover,
51
- var(--g-color-text-primary)
60
+ var(--g-color-text-light-primary)
52
61
  );
53
- height: 68px;
54
- width: 98px;
62
+ min-height: 40px;
63
+ max-width: 200px;
64
+ flex: 0 0 auto;
55
65
  display: flex;
56
- flex-direction: column;
66
+ gap: 4px;
57
67
  justify-content: center;
58
68
  align-items: center;
59
- transition: 300ms color ease-in-out, 300ms background-color ease-in-out;
60
- border-radius: 6px;
61
- padding: 0 12px;
69
+ border-radius: var(--g-border-radius-xl);
70
+ padding: 0 16px;
62
71
  box-sizing: border-box;
63
72
  white-space: nowrap;
64
- overflow: hidden;
65
73
  background-color: var(--_--dashkit-action-panel-item-color);
66
74
  color: var(--_--dashkit-action-panel-item-text-color);
67
- will-change: color, backgroung-color;
68
- }
69
- .dashkit-action-panel__item:hover {
70
75
  cursor: pointer;
76
+ }
77
+ .dashkit-action-panel__item:hover, .dashkit-action-panel__item:focus-visible {
71
78
  background-color: var(--_--dashkit-action-panel-item-color-hover);
72
79
  color: var(--_--dashkit-action-panel-item-text-color-hover);
73
80
  }
81
+ .dashkit-action-panel__item_draggable {
82
+ transform: translate(0, 0);
83
+ cursor: grab;
84
+ }
85
+ .dashkit-action-panel__item_draggable:hover, .dashkit-action-panel__item_draggable:active {
86
+ transform: translateY(-2px);
87
+ box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15);
88
+ }
89
+ .dashkit-action-panel__item_draggable:active {
90
+ cursor: grabbing;
91
+ }
92
+ .dashkit-action-panel__item_dragging, .dashkit-action-panel__item_dragging:hover {
93
+ transform: translate(0, 0);
94
+ background-color: var(--_--dashkit-action-panel-item-color-dragging);
95
+ color: var(--dashkit-action-panel-item-text-color-dragging, var(--g-color-text-light-primary));
96
+ }
97
+ .dashkit-action-panel__item_dragging-source-disabled, .dashkit-action-panel__item_dragging-source-disabled:hover {
98
+ opacity: 0.5;
99
+ box-shadow: none;
100
+ }
74
101
  .dashkit-action-panel__icon {
75
- margin-bottom: 4px;
102
+ display: flex;
103
+ flex: 0 0 auto;
104
+ align-items: center;
105
+ justify-content: center;
76
106
  }
77
107
  .dashkit-action-panel__title {
78
- font-size: 13px;
108
+ min-width: 0;
109
+ font-size: 12px;
79
110
  font-weight: 400;
80
111
  line-height: 16px;
81
- max-width: 100%;
82
- white-space: nowrap;
83
112
  overflow: hidden;
84
113
  text-overflow: ellipsis;
85
114
  }
@@ -10,7 +10,33 @@ require("./ActionPanel.css");
10
10
  const b = (0, cn_1.cn)('dashkit-action-panel');
11
11
  const ActionPanelItemContainer = ({ item }) => {
12
12
  const dndProps = (0, useDnDItemProps_1.useDnDItemProps)(item);
13
- return (react_1.default.createElement("div", Object.assign({ role: "button", className: b('item', { draggable: Boolean(dndProps) }, item.className), onClick: item.onClick, "data-qa": item.qa }, dndProps),
13
+ const draggingClassName = `${b('item')}_dragging`;
14
+ const disabledSourceClassName = `${b('item')}_dragging-source-disabled`;
15
+ const disableSourceTimer = react_1.default.useRef(null);
16
+ react_1.default.useEffect(() => () => {
17
+ if (disableSourceTimer.current !== null) {
18
+ clearTimeout(disableSourceTimer.current);
19
+ }
20
+ }, []);
21
+ const onDragStart = (event) => {
22
+ const source = event.currentTarget;
23
+ source.classList.add(draggingClassName);
24
+ dndProps === null || dndProps === void 0 ? void 0 : dndProps.onDragStart(event);
25
+ // The native drag image captures the solid item before the panel source is disabled.
26
+ disableSourceTimer.current = setTimeout(() => {
27
+ source.classList.add(disabledSourceClassName);
28
+ disableSourceTimer.current = null;
29
+ }, 0);
30
+ };
31
+ const onDragEnd = (event) => {
32
+ if (disableSourceTimer.current !== null) {
33
+ clearTimeout(disableSourceTimer.current);
34
+ disableSourceTimer.current = null;
35
+ }
36
+ event.currentTarget.classList.remove(draggingClassName, disabledSourceClassName);
37
+ dndProps === null || dndProps === void 0 ? void 0 : dndProps.onDragEnd(event);
38
+ };
39
+ return (react_1.default.createElement("div", Object.assign({ role: "button", className: b('item', { draggable: Boolean(dndProps) }, item.className), onClick: item.onClick, "data-qa": item.qa }, dndProps, { onDragStart: dndProps ? onDragStart : undefined, onDragEnd: dndProps ? onDragEnd : undefined }),
14
40
  react_1.default.createElement("div", { className: b('icon') }, item.icon),
15
41
  react_1.default.createElement("div", { className: b('title'), title: item.title }, item.title)));
16
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ActionPanel.js","sourceRoot":"../../../../src","sources":["components/ActionPanel/ActionPanel.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,mEAAqD;AAErD,oEAA4D;AAC5D,0CAAkC;AAIlC,6BAA4B;AAE5B,MAAM,CAAC,GAAG,IAAA,OAAE,EAAC,sBAAsB,CAAC,CAAC;AAE9B,MAAM,wBAAwB,GAAG,CAAC,EAAC,IAAI,EAA0B,EAAE,EAAE;IACxE,MAAM,QAAQ,GAAG,IAAA,iCAAe,EAAC,IAAI,CAAC,CAAC;IAEvC,OAAO,CACH,qDACI,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAC,EAAE,IAAI,CAAC,SAAS,CAAC,EACpE,OAAO,EAAE,IAAI,CAAC,OAAO,aACZ,IAAI,CAAC,EAAE,IACZ,QAAQ;QAEZ,uCAAK,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,IAAG,IAAI,CAAC,IAAI,CAAO;QAC5C,uCAAK,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IACxC,IAAI,CAAC,KAAK,CACT,CACJ,CACT,CAAC;AACN,CAAC,CAAC;AAjBW,QAAA,wBAAwB,4BAiBnC;AAEK,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;;IACnD,MAAM,UAAU,GAAG,MAAA,KAAK,CAAC,OAAO,mCAAI,KAAK,CAAC;IAC1C,MAAM,UAAU,GAAG,MAAA,KAAK,CAAC,eAAe,mCAAI,KAAK,CAAC;IAClD,MAAM,OAAO,GAAG,eAAK,CAAC,MAAM,CAAwB,IAAI,CAAC,CAAC;IAE1D,MAAM,OAAO,GAAG,CACZ,uCAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IACjD,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAiB,EAAE,EAAE;YAArB,EAAC,MAAM,OAAU,EAAL,IAAI,sBAAhB,UAAiB,CAAD;QAC9B,MAAM,GAAG,GAAG,mBAAmB,IAAI,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,QAAQ,GAAG,8BAAC,gCAAwB,IAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,GAAI,CAAC;QAEpE,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,iCAAK,IAAI,KAAE,GAAG,EAAE,QAAQ,IAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IAChE,CAAC,CAAC,CACA,CACT,CAAC;IAEF,IAAI,UAAU,EAAE,CAAC;QACb,OAAO,CACH,8BAAC,sCAAa,IACV,EAAE,EAAE,CAAC,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,EACnB,OAAO,EAAE,GAAG,EACZ,aAAa,UAEZ,OAAO,CACI,CACnB,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;IACvC,CAAC;AACL,CAAC,CAAC;AA/BW,QAAA,WAAW,eA+BtB","sourcesContent":["import React from 'react';\n\nimport {CSSTransition} from 'react-transition-group';\n\nimport {useDnDItemProps} from '../../hooks/useDnDItemProps';\nimport {cn} from '../../utils/cn';\n\nimport {ActionPanelItem, ActionPanelProps} from './types';\n\nimport './ActionPanel.scss';\n\nconst b = cn('dashkit-action-panel');\n\nexport const ActionPanelItemContainer = ({item}: {item: ActionPanelItem}) => {\n const dndProps = useDnDItemProps(item);\n\n return (\n <div\n role=\"button\"\n className={b('item', {draggable: Boolean(dndProps)}, item.className)}\n onClick={item.onClick}\n data-qa={item.qa}\n {...dndProps}\n >\n <div className={b('icon')}>{item.icon}</div>\n <div className={b('title')} title={item.title}>\n {item.title}\n </div>\n </div>\n );\n};\n\nexport const ActionPanel = (props: ActionPanelProps) => {\n const isDisabled = props.disable ?? false;\n const isAnimated = props.toggleAnimation ?? false;\n const nodeRef = React.useRef<HTMLDivElement | null>(null);\n\n const content = (\n <div ref={nodeRef} className={b(null, props.className)}>\n {props.items.map(({wrapTo, ...item}) => {\n const key = `dk-action-panel-${item.id}`;\n const children = <ActionPanelItemContainer key={key} item={item} />;\n\n return wrapTo ? wrapTo({...item, key, children}) : children;\n })}\n </div>\n );\n\n if (isAnimated) {\n return (\n <CSSTransition\n in={!isDisabled}\n nodeRef={nodeRef}\n classNames={b(null)}\n timeout={300}\n unmountOnExit\n >\n {content}\n </CSSTransition>\n );\n } else {\n return isDisabled ? null : content;\n }\n};\n"]}
1
+ {"version":3,"file":"ActionPanel.js","sourceRoot":"../../../../src","sources":["components/ActionPanel/ActionPanel.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,mEAAqD;AAErD,oEAA4D;AAC5D,0CAAkC;AAIlC,6BAA4B;AAE5B,MAAM,CAAC,GAAG,IAAA,OAAE,EAAC,sBAAsB,CAAC,CAAC;AAE9B,MAAM,wBAAwB,GAAG,CAAC,EAAC,IAAI,EAA0B,EAAE,EAAE;IACxE,MAAM,QAAQ,GAAG,IAAA,iCAAe,EAAC,IAAI,CAAC,CAAC;IACvC,MAAM,iBAAiB,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;IAClD,MAAM,uBAAuB,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,2BAA2B,CAAC;IACxE,MAAM,kBAAkB,GAAG,eAAK,CAAC,MAAM,CAAuC,IAAI,CAAC,CAAC;IAEpF,eAAK,CAAC,SAAS,CACX,GAAG,EAAE,CAAC,GAAG,EAAE;Q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AC,CACA,CACT,CAAC;IAEF,IAAI,UAAU,EAAE,CAAC;QACb,OAAO,CACH,8BAAC,sCAAa,IACV,EAAE,EAAE,CAAC,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,EACnB,OAAO,EAAE,GAAG,EACZ,aAAa,UAEZ,OAAO,CACI,CACnB,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;IACvC,CAAC;AACL,CAAC,CAAC;AA/BW,QAAA,WAAW,eA+BtB","sourcesContent":["import React from 'react';\n\nimport {CSSTransition} from 'react-transition-group';\n\nimport {useDnDItemProps} from '../../hooks/useDnDItemProps';\nimport {cn} from '../../utils/cn';\n\nimport {ActionPanelItem, ActionPanelProps} from './types';\n\nimport './ActionPanel.scss';\n\nconst b = cn('dashkit-action-panel');\n\nexport const ActionPanelItemContainer = ({item}: {item: ActionPanelItem}) => {\n const dndProps = useDnDItemProps(item);\n const draggingClassName = `${b('item')}_dragging`;\n const disabledSourceClassName = `${b('item')}_dragging-source-disabled`;\n const disableSourceTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n React.useEffect(\n () => () => {\n if (disableSourceTimer.current !== null) {\n clearTimeout(disableSourceTimer.current);\n }\n },\n [],\n );\n\n const onDragStart = (event: React.DragEvent<HTMLDivElement>) => {\n const source = event.currentTarget;\n source.classList.add(draggingClassName);\n dndProps?.onDragStart(event);\n // The native drag image captures the solid item before the panel source is disabled.\n disableSourceTimer.current = setTimeout(() => {\n source.classList.add(disabledSourceClassName);\n disableSourceTimer.current = null;\n }, 0);\n };\n\n const onDragEnd = (event: React.DragEvent<HTMLDivElement>) => {\n if (disableSourceTimer.current !== null) {\n clearTimeout(disableSourceTimer.current);\n disableSourceTimer.current = null;\n }\n event.currentTarget.classList.remove(draggingClassName, disabledSourceClassName);\n dndProps?.onDragEnd(event);\n };\n\n return (\n <div\n role=\"button\"\n className={b('item', {draggable: Boolean(dndProps)}, item.className)}\n onClick={item.onClick}\n data-qa={item.qa}\n {...dndProps}\n onDragStart={dndProps ? onDragStart : undefined}\n onDragEnd={dndProps ? onDragEnd : undefined}\n >\n <div className={b('icon')}>{item.icon}</div>\n <div className={b('title')} title={item.title}>\n {item.title}\n </div>\n </div>\n );\n};\n\nexport const ActionPanel = (props: ActionPanelProps) => {\n const isDisabled = props.disable ?? false;\n const isAnimated = props.toggleAnimation ?? false;\n const nodeRef = React.useRef<HTMLDivElement | null>(null);\n\n const content = (\n <div ref={nodeRef} className={b(null, props.className)}>\n {props.items.map(({wrapTo, ...item}) => {\n const key = `dk-action-panel-${item.id}`;\n const children = <ActionPanelItemContainer key={key} item={item} />;\n\n return wrapTo ? wrapTo({...item, key, children}) : children;\n })}\n </div>\n );\n\n if (isAnimated) {\n return (\n <CSSTransition\n in={!isDisabled}\n nodeRef={nodeRef}\n classNames={b(null)}\n timeout={300}\n unmountOnExit\n >\n {content}\n </CSSTransition>\n );\n } else {\n return isDisabled ? null : content;\n }\n};\n"]}
@@ -4,12 +4,14 @@ exports.DashKitDnDWrapper = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const context_1 = require("../../context/index.js");
7
- const defaultImageSrc = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
8
7
  const DashKitDnDWrapper = (props) => {
9
8
  const [dragProps, setDragProps] = react_1.default.useState(null);
10
9
  const dragImagePreview = react_1.default.useMemo(() => {
10
+ if (!props.dragImageSrc) {
11
+ return null;
12
+ }
11
13
  const img = new Image();
12
- img.src = props.dragImageSrc || defaultImageSrc;
14
+ img.src = props.dragImageSrc;
13
15
  return img;
14
16
  }, [props.dragImageSrc]);
15
17
  const onDragStartProp = props.onDragStart;
@@ -1 +1 @@
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T,gBAAgB;YAChB,WAAW;YACX,SAAS;YACT,cAAc,EAAE,KAAK,CAAC,cAAc;SACvC,CAAC;IACN,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAEhF,OAAO,CACH,8BAAC,2BAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IAC1C,KAAK,CAAC,QAAQ,CACU,CAChC,CAAC;AACN,CAAC,CAAC;AA1CW,QAAA,iBAAiB,qBA0C5B","sourcesContent":["import React from 'react';\n\nimport {DashKitDnDContext} from '../../context';\nimport type {DraggedOverItem, ItemDragProps} from '../../shared';\n\ntype DashKitDnDWrapperProps = {\n dragImageSrc?: string;\n onDropDragOver?: (\n draggedItem: DraggedOverItem,\n sharedItem: DraggedOverItem | null,\n ) => void | boolean;\n onDragStart?: (dragProps: ItemDragProps) => void;\n onDragEnd?: () => void;\n children: React.ReactElement;\n};\n\nconst defaultImageSrc =\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';\n\nexport const DashKitDnDWrapper: React.FC<DashKitDnDWrapperProps> = (props) => {\n const [dragProps, setDragProps] = React.useState<ItemDragProps | null>(null);\n\n const dragImagePreview = React.useMemo(() => {\n const img = new Image();\n img.src = props.dragImageSrc || defaultImageSrc;\n return img;\n }, [props.dragImageSrc]);\n\n const onDragStartProp = props.onDragStart;\n const onDragStart = React.useCallback(\n (_: React.DragEvent<Element>, itemDragProps: ItemDragProps) => {\n setDragProps(itemDragProps);\n onDragStartProp?.(itemDragProps);\n },\n [setDragProps, onDragStartProp],\n );\n\n const onDragEndProp = props.onDragEnd;\n const onDragEnd = React.useCallback(\n (_: React.DragEvent<Element>) => {\n setDragProps(null);\n onDragEndProp?.();\n },\n [setDragProps, onDragEndProp],\n );\n\n const contextValue = React.useMemo(() => {\n return {\n dragProps,\n dragImagePreview,\n onDragStart,\n onDragEnd,\n onDropDragOver: props.onDropDragOver,\n };\n }, [dragProps, dragImagePreview, onDragStart, onDragEnd, props.onDropDragOver]);\n\n return (\n <DashKitDnDContext.Provider value={contextValue}>\n {props.children}\n </DashKitDnDContext.Provider>\n );\n};\n"]}
1
+ {"version":3,"file":"DashKitDnDWrapper.js","sourceRoot":"../../../../src","sources":["components/DashKitDnDWrapper/DashKitDnDWrapper.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,oDAAgD;AAczC,MAAM,iBAAiB,GAAqC,CAAC,KAAK,EAAE,EAAE;IACzE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAuB,IAAI,CAAC,CAAC;IAE7E,MAAM,gBAAgB,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC;QAC7B,OAAO,GAAG,CAAC;IACf,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IAEzB,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC;IAC1C,MAAM,WAAW,GAAG,eAAK,CAAC,WAAW,CACjC,CAAC,CAA2B,EAAE,aAA4B,EAAE,EAAE;QAC1D,YAAY,CAAC,aAAa,CAAC,CAAC;QAC5B,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAG,aAAa,CAAC,CAAC;IACrC,CAAC,EACD,CAAC,YAAY,EAAE,eAAe,CAAC,CAClC,CAAC;IAEF,MAAM,aAAa,GAAG,KAAK,CAAC,SAAS,CAAC;IACtC,MAAM,SAAS,GAAG,eAAK,CAAC,WAAW,CAC/B,CAAC,CAA2B,EAAE,EAAE;QAC5B,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,aAAa,aAAb,aAAa,uBAAb,aAAa,EAAI,CAAC;IACtB,CAAC,EACD,CAAC,YAAY,EAAE,aAAa,CAAC,CAChC,CAAC;IAEF,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACpC,OAAO;YACH,SAAS;YACT,gBAAgB;YAChB,WAAW;YACX,SAAS;YACT,cAAc,EAAE,KAAK,CAAC,cAAc;SACvC,CAAC;IACN,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAEhF,OAAO,CACH,8BAAC,2BAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IAC1C,KAAK,CAAC,QAAQ,CACU,CAChC,CAAC;AACN,CAAC,CAAC;AA9CW,QAAA,iBAAiB,qBA8C5B","sourcesContent":["import React from 'react';\n\nimport {DashKitDnDContext} from '../../context';\nimport type {DraggedOverItem, ItemDragProps} from '../../shared';\n\ntype DashKitDnDWrapperProps = {\n dragImageSrc?: string;\n onDropDragOver?: (\n draggedItem: DraggedOverItem,\n sharedItem: DraggedOverItem | null,\n ) => void | boolean;\n onDragStart?: (dragProps: ItemDragProps) => void;\n onDragEnd?: () => void;\n children: React.ReactElement;\n};\n\nexport const DashKitDnDWrapper: React.FC<DashKitDnDWrapperProps> = (props) => {\n const [dragProps, setDragProps] = React.useState<ItemDragProps | null>(null);\n\n const dragImagePreview = React.useMemo(() => {\n if (!props.dragImageSrc) {\n return null;\n }\n\n const img = new Image();\n img.src = props.dragImageSrc;\n return img;\n }, [props.dragImageSrc]);\n\n const onDragStartProp = props.onDragStart;\n const onDragStart = React.useCallback(\n (_: React.DragEvent<Element>, itemDragProps: ItemDragProps) => {\n setDragProps(itemDragProps);\n onDragStartProp?.(itemDragProps);\n },\n [setDragProps, onDragStartProp],\n );\n\n const onDragEndProp = props.onDragEnd;\n const onDragEnd = React.useCallback(\n (_: React.DragEvent<Element>) => {\n setDragProps(null);\n onDragEndProp?.();\n },\n [setDragProps, onDragEndProp],\n );\n\n const contextValue = React.useMemo(() => {\n return {\n dragProps,\n dragImagePreview,\n onDragStart,\n onDragEnd,\n onDropDragOver: props.onDropDragOver,\n };\n }, [dragProps, dragImagePreview, onDragStart, onDragEnd, props.onDropDragOver]);\n\n return (\n <DashKitDnDContext.Provider value={contextValue}>\n {props.children}\n </DashKitDnDContext.Provider>\n );\n};\n"]}
@@ -45,6 +45,7 @@
45
45
  }
46
46
 
47
47
  .react-grid-item.dropping {
48
+ opacity: 0;
48
49
  user-select: none;
49
50
  pointer-events: none;
50
51
  touch-action: none;
@@ -79,9 +80,10 @@
79
80
  }
80
81
 
81
82
  .react-grid-item.react-grid-placeholder {
82
- --_-dashkit-placeholder-color: var(--dashkit-placeholder-color, #fc0);
83
- --_-dashkit-placeholder-opacity: var(--dashkit-placeholder-opacity, 0.2);
83
+ --_-dashkit-placeholder-color: var(--dashkit-placeholder-color, var(--g-color-base-brand));
84
+ --_-dashkit-placeholder-opacity: var(--dashkit-placeholder-opacity, 0.1);
84
85
  background: var(--_-dashkit-placeholder-color);
86
+ border-radius: var(--dashkit-grid-item-border-radius, 3px);
85
87
  opacity: var(--_-dashkit-placeholder-opacity);
86
88
  transition-duration: 100ms;
87
89
  z-index: 2;
@@ -38,7 +38,7 @@ declare class PassiveWidthProvider extends React.Component<PassiveWidthProviderP
38
38
  private gridItems;
39
39
  private lastAppliedWidth?;
40
40
  private resizeObserver?;
41
- private settledWidthCommitFrame?;
41
+ private settledWidthCommitTimer?;
42
42
  private isComponentMounted;
43
43
  componentDidMount(): void;
44
44
  componentDidUpdate(): void;
@@ -48,6 +48,7 @@ declare class PassiveWidthProvider extends React.Component<PassiveWidthProviderP
48
48
  private updateGridItems;
49
49
  private handlePointerDown;
50
50
  private syncSettledWidth;
51
+ private cancelSettledWidthCommit;
51
52
  private scheduleSettledWidthCommit;
52
53
  private syncElement;
53
54
  private observeElement;
@@ -9,6 +9,7 @@ const react_grid_layout_1 = tslib_1.__importStar(require("react-grid-layout"));
9
9
  const resize_observer_polyfill_1 = tslib_1.__importDefault(require("resize-observer-polyfill"));
10
10
  const constants_1 = require("../../constants/index.js");
11
11
  const GRID_LAYOUT_CLASS_NAME = 'react-grid-layout';
12
+ const SETTLED_WIDTH_COMMIT_DELAY = 150;
12
13
  const isRefObject = (value) => {
13
14
  return (typeof value === 'object' &&
14
15
  value !== null &&
@@ -398,6 +399,7 @@ class PassiveWidthProvider extends react_1.default.Component {
398
399
  if (!this.props.isDraggable && !this.props.isResizable) {
399
400
  return;
400
401
  }
402
+ this.cancelSettledWidthCommit();
401
403
  (0, react_dom_1.flushSync)(() => {
402
404
  this.setState((state) => ({
403
405
  interactionRevision: state.interactionRevision + 1,
@@ -406,6 +408,7 @@ class PassiveWidthProvider extends react_1.default.Component {
406
408
  });
407
409
  };
408
410
  this.syncSettledWidth = () => {
411
+ this.cancelSettledWidthCommit();
409
412
  if (this.state.settledWidth === this.widthRef.current) {
410
413
  return;
411
414
  }
@@ -413,18 +416,22 @@ class PassiveWidthProvider extends react_1.default.Component {
413
416
  this.setState({ settledWidth: this.widthRef.current });
414
417
  });
415
418
  };
416
- this.scheduleSettledWidthCommit = () => {
417
- if (this.settledWidthCommitFrame !== undefined) {
418
- window.cancelAnimationFrame(this.settledWidthCommitFrame);
419
+ this.cancelSettledWidthCommit = () => {
420
+ if (this.settledWidthCommitTimer === undefined) {
421
+ return;
419
422
  }
420
- this.settledWidthCommitFrame = window.requestAnimationFrame(() => {
421
- this.settledWidthCommitFrame = window.requestAnimationFrame(() => {
422
- this.settledWidthCommitFrame = undefined;
423
- if (this.state.settledWidth !== this.widthRef.current) {
424
- this.setState({ settledWidth: this.widthRef.current });
425
- }
426
- });
427
- });
423
+ window.clearTimeout(this.settledWidthCommitTimer);
424
+ this.settledWidthCommitTimer = undefined;
425
+ };
426
+ this.scheduleSettledWidthCommit = () => {
427
+ this.cancelSettledWidthCommit();
428
+ // DOM grid items update in ResizeObserver; React reconciles only after resizing settles.
429
+ this.settledWidthCommitTimer = window.setTimeout(() => {
430
+ this.settledWidthCommitTimer = undefined;
431
+ if (this.isComponentMounted && this.state.settledWidth !== this.widthRef.current) {
432
+ this.setState({ settledWidth: this.widthRef.current });
433
+ }
434
+ }, SETTLED_WIDTH_COMMIT_DELAY);
428
435
  };
429
436
  this.syncElement = () => {
430
437
  var _a;
@@ -474,10 +481,7 @@ class PassiveWidthProvider extends react_1.default.Component {
474
481
  this.isComponentMounted = false;
475
482
  (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
476
483
  this.resizeObserver = undefined;
477
- if (this.settledWidthCommitFrame !== undefined) {
478
- window.cancelAnimationFrame(this.settledWidthCommitFrame);
479
- this.settledWidthCommitFrame = undefined;
480
- }
484
+ this.cancelSettledWidthCommit();
481
485
  (_b = this.element) === null || _b === void 0 ? void 0 : _b.removeEventListener('pointerdown', this.handlePointerDown, true);
482
486
  this.element = null;
483
487
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ReactGridLayout.js","sourceRoot":"../../../../src","sources":["components/GridLayout/ReactGridLayout.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,yCAAoC;AAEpC,+DAA+D;AAC/D,+EAAyD;AACzD,gGAA8D;AAE9D,wDAAgF;AAEhF,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAEnD,MAAM,WAAW,GAAG,CAChB,KAAgC,EACQ,EAAE;IAC1C,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CACpC,CAAC;AACN,CAAC,CAAC;AAsCF,MAAM,gBAAgB,GAAG,CAAC,EACtB,IAAI,EACJ,gBAAgB,EAChB,MAAM,EACN,KAAK,EACL,CAAC,EACD,CAAC,E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CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,IAAI,CAAC,uBAAuB,KAAK,SAAS,EAAE,CAAC;YAC7C,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YAC1D,IAAI,CAAC,uBAAuB,GAAG,SAAS,CAAC;QAC7C,CAAC;QACD,MAAA,IAAI,CAAC,OAAO,0CAAE,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,MAAM;QACF,MAAM,KAAiC,IAAI,CAAC,KAAK,EAA3C,EAAC,kBAAkB,OAAwB,EAAnB,KAAK,sBAA7B,sBAA8B,CAAa,CAAC;QAElD,IAAI,kBAAkB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YAC9C,OAAO,CACH,uCACI,SAAS,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC9E,GAAG,EAAE,IAAI,CAAC,UAAU,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,GACpB,CACL,CAAC;QACN,CAAC;QAED,OAAO,CACH,8BAAC,cAAc,oBACP,KAAK,IACT,QAAQ,EAAE,IAAI,CAAC,UAAU,EACzB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EACvC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,IAChC,CACL,CAAC;IACN,CAAC;CA4IJ;AAEY,QAAA,MAAM,GAAG,oBAAoB,CAAC","sourcesContent":["import React from 'react';\n\nimport {flushSync} from 'react-dom';\nimport type {Layout as RGLLayout} from 'react-grid-layout';\n// @ts-expect-error - utils is not exported in type definitions\nimport ReactGridLayout, {utils} from 'react-grid-layout';\nimport ResizeObserverPolyfill from 'resize-observer-polyfill';\n\nimport {DROPPING_ELEMENT_CLASS_NAME, OVERLAY_CLASS_NAME} from '../../constants';\n\nconst GRID_LAYOUT_CLASS_NAME = 'react-grid-layout';\n\nconst isRefObject = (\n value: React.Ref<HTMLDivElement>,\n): value is React.RefObject<HTMLDivElement> => {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'current' in value &&\n typeof value.current === 'object'\n );\n};\n\ntype SharedDragPosition = {\n offsetX: number;\n offsetY: number;\n};\n\ntype DragOverLayoutProps = ReactGridLayout.ReactGridLayoutProps & {\n innerRef?: React.Ref<HTMLDivElement>;\n isDragCaptured?: boolean;\n dragStateRef?: React.MutableRefObject<{isDragging: boolean; sourceGroup: string | null}>;\n sharedDragPositionRef?: React.MutableRefObject<SharedDragPosition | null>;\n group?: string;\n onDragTargetRestore?: () => void;\n transformScaleRef?: React.MutableRefObject<number>;\n groupResetRegistryRef?: React.MutableRefObject<Map<string, () => void>>;\n externalLayoutRevision?: number;\n onBeforeDragOver?: () => void;\n};\n\ntype DragOverLayoutState = {\n layout: RGLLayout[];\n activeDrag: RGLLayout | null;\n};\n\ntype RGLLayoutWithPlaceholder = RGLLayout & {placeholder?: boolean};\n\ntype PassiveWidthProviderProps = DragOverLayoutProps & {\n measureBeforeMount?: boolean;\n};\n\ntype OnDragMethod = (\n i: string,\n x: number,\n y: number,\n sintEv: {e: Event; node: HTMLElement},\n) => void;\n\nconst getGridItemStyle = ({\n cols,\n containerPadding,\n margin,\n width,\n x,\n y,\n w,\n h,\n rowHeight,\n useCSSTransforms,\n}: {\n cols: number;\n containerPadding: [number, number];\n h: number;\n margin: [number, number];\n rowHeight: number;\n useCSSTransforms: boolean;\n w: number;\n width: number;\n x: number;\n y: number;\n}) => {\n const [marginX, marginY] = margin;\n const [paddingX, paddingY] = containerPadding;\n const columnWidth = (width - marginX * (cols - 1) - paddingX * 2) / cols;\n const position = {\n height: Math.round(rowHeight * h + marginY * (h - 1)),\n left: Math.round((columnWidth + marginX) * x + paddingX),\n top: Math.round(paddingY + (rowHeight + marginY) * y),\n width: Math.round(columnWidth * w + marginX * (w - 1)),\n };\n\n return useCSSTransforms\n ? {...utils.setTransform(position), left: '', top: ''}\n : {\n ...utils.setTopLeft(position),\n MozTransform: '',\n OTransform: '',\n WebkitTransform: '',\n msTransform: '',\n transform: '',\n };\n};\n\nclass DragOverLayout extends ReactGridLayout {\n // @ts-expect-error - TypeScript doesn't allow direct property redeclaration in extending classes. We need to narrow the props type from ReactGridLayoutProps to DragOverLayoutProps for type safety in our custom methods\n props: DragOverLayoutProps;\n // @ts-expect-error - TypeScript doesn't allow direct property redeclaration in extending classes. State is initialized by parent constructor\n state: DragOverLayoutState;\n\n parentOnDrag: OnDragMethod;\n parentOnDragStop: OnDragMethod;\n parentOnDragOver: (e: MouseEvent) => false | void;\n _savedDraggedOutLayout: RGLLayout[] | null = null;\n // Suppresses onLayoutMaybeChanged during imperative layout restore actions.\n // Without this flag, our setState would trigger onLayoutChange back to the consumer\n // that just initiated the action, causing a spurious 'change' event.\n _isRestoringExternalLayout = false;\n private readonly gridItemChildren = new WeakMap<\n React.ReactElement,\n {child: React.ReactElement; metadata: Record<string, string>}\n >();\n\n constructor(props: DragOverLayoutProps, context?: unknown) {\n super(props, context);\n\n // @ts-expect-error - onDrag is a protected method in parent class\n this.parentOnDrag = this.onDrag;\n // @ts-expect-error - assigning custom method to parent's onDrag\n this.onDrag = this.extendedOnDrag;\n\n // @ts-expect-error - onDragStop is a protected method in parent class\n this.parentOnDragStop = this.onDragStop;\n // @ts-expect-error - assigning custom method to parent's onDragStop\n this.onDragStop = this.extendedOnDragStop;\n // @ts-expect-error - onDragOver is a protected method in parent class\n this.parentOnDragOver = this.onDragOver;\n // @ts-expect-error - assigning custom method to parent's onDragOver\n this.onDragOver = this.extendedOnDragOver;\n }\n\n componentDidMount(): void {\n super.componentDidMount?.();\n\n if (this.props.group !== undefined) {\n this.props.groupResetRegistryRef?.current.set(\n this.props.group,\n this.resetExternalPlaceholder,\n );\n }\n\n // If cursor is moved out of the window there is a bug\n // which leaves placeholder element in grid, this action needed to reset this state\n window.addEventListener('dragend', this.resetExternalPlaceholder);\n const innerElement = this.getInnerElement();\n\n if (innerElement) {\n innerElement.addEventListener('mouseup', this.mouseUpHandler);\n innerElement.addEventListener('mouseenter', this.mouseEnterHandler);\n innerElement.addEventListener('mouseleave', this.mouseLeaveHandler);\n innerElement.addEventListener('mousemove', this.mouseMoveHandler);\n }\n }\n\n componentDidUpdate(prevProps: DragOverLayoutProps, prevState: DragOverLayoutState): void {\n const revisionChanged =\n prevProps.externalLayoutRevision !== this.props.externalLayoutRevision;\n\n if (revisionChanged && this.props.layout) {\n const newLayout = utils.synchronizeLayoutWithChildren(\n this.props.layout,\n this.props.children,\n this.props.cols,\n utils.compactType(this.props),\n this.props.allowOverlap,\n );\n\n this._isRestoringExternalLayout = true;\n // Override both layout and propsLayout so getDerivedStateFromProps\n // doesn't revert our update on the next render cycle.\n this.setState(\n {\n layout: newLayout,\n propsLayout: this.props.layout,\n } as unknown as DragOverLayoutState,\n () => {\n this._isRestoringExternalLayout = false;\n },\n );\n // RGL's shouldComponentUpdate only tracks activeDrag/mounted/droppingPosition — not\n // state.layout. So setState({layout}) alone is silently ignored (no re-render).\n // forceUpdate bypasses SCU and is batched with the setState above, producing a\n // single render cycle with the merged state that includes the restored layout.\n this.forceUpdate();\n // Don't call super here: restoring is an external action, not a user drag/resize.\n // onLayoutMaybeChanged is suppressed via _isRestoringExternalLayout.\n return;\n }\n\n // Maintain parent behavior for all non-restore cycles (drag, resize, etc.).\n super.componentDidUpdate?.(prevProps, prevState);\n }\n\n onLayoutMaybeChanged(newLayout: RGLLayout[], oldLayout: RGLLayout[]): void {\n if (this._isRestoringExternalLayout) {\n return;\n }\n // @ts-expect-error — onLayoutMaybeChanged is not in ReactGridLayout's public types\n super.onLayoutMaybeChanged(newLayout, oldLayout);\n }\n\n componentWillUnmount(): void {\n if (this.props.group !== undefined) {\n this.props.groupResetRegistryRef?.current.delete(this.props.group);\n }\n\n window.removeEventListener('dragend', this.resetExternalPlaceholder);\n const innerElement = this.getInnerElement();\n\n if (innerElement) {\n innerElement.removeEventListener('mouseup', this.mouseUpHandler);\n innerElement.removeEventListener('mouseenter', this.mouseEnterHandler);\n innerElement.removeEventListener('mouseleave', this.mouseLeaveHandler);\n innerElement.removeEventListener('mousemove', this.mouseMoveHandler);\n }\n }\n\n // react-grid-layout doens't calculate it's height when last element is removed\n // and just keeps the previous value\n // so for autosize to work in that case we are resetting it's height value\n containerHeight(): string | undefined {\n if (this.props.autoSize && this.state.layout.length === 0) {\n return;\n }\n\n // eslint-disable-next-line consistent-return\n // @ts-expect-error - containerHeight is a protected method in parent class\n return super.containerHeight();\n }\n\n // innerRef is passed by WithProvider without this wrapper there are only\n // * findDOMNode - deprecated\n // * rewrite whole ReactGridLayout.render method\n // so in that case don't try to use this class on it's own\n // or pass innerRef: React.MutableRef as it's not optional prop\n getInnerElement(): HTMLDivElement | null {\n const {innerRef} = this.props;\n\n return innerRef && isRefObject(innerRef) && innerRef.current ? innerRef.current : null;\n }\n\n // Reset placeholder when item dragged from outside\n resetExternalPlaceholder = (): void => {\n // @ts-expect-error - dragEnterCounter is an internal property of parent class\n if (this.dragEnterCounter) {\n // @ts-expect-error - dragEnterCounter is an internal property of parent class\n this.dragEnterCounter = 0;\n // @ts-expect-error - removeDroppingPlaceholder is a protected method in parent class\n this.removeDroppingPlaceholder();\n }\n };\n\n // Hide placeholder when element is dragged out\n hideLocalPlaceholder = (i: string): RGLLayout[] => {\n const {layout} = this.state;\n const {cols} = this.props;\n const savedLayout = layout.map((item) => ({...item}));\n\n let hiddenElement: RGLLayout | undefined;\n const newLayout = utils.compact(\n layout.filter((item) => {\n if (item.i === i) {\n hiddenElement = item;\n return false;\n }\n\n return true;\n }),\n utils.compactType(this.props),\n cols,\n );\n\n if (hiddenElement) {\n newLayout.push(hiddenElement);\n }\n\n this.setState({\n activeDrag: null,\n layout: newLayout,\n });\n\n return savedLayout;\n };\n\n extendedOnDrag = (\n i: string,\n x: number,\n y: number,\n sintEv: {e: Event; node: HTMLElement},\n ): void => {\n if (this.props.isDragCaptured) {\n if (!this._savedDraggedOutLayout) {\n this._savedDraggedOutLayout = this.hideLocalPlaceholder(i);\n }\n\n return;\n }\n\n this._savedDraggedOutLayout = null;\n // parent onDrag will show new placeholder again\n this.parentOnDrag(i, x, y, sintEv);\n };\n\n extendedOnDragStop = (\n i: string,\n x: number,\n y: number,\n sintEv: {e: Event; node: HTMLElement},\n ): void => {\n // Restoring layout if item was dropped outside of the grid\n if (this._savedDraggedOutLayout) {\n const savedLayout = this._savedDraggedOutLayout;\n const l = utils.getLayoutItem(savedLayout, i);\n\n // Create placeholder (display only)\n const placeholder: RGLLayoutWithPlaceholder = {\n w: l.w,\n h: l.h,\n x: l.x,\n y: l.y,\n placeholder: true,\n i: i,\n };\n\n this.setState(\n {\n layout: savedLayout,\n activeDrag: placeholder,\n },\n () => {\n this.parentOnDragStop(i, x, y, sintEv);\n },\n );\n\n this._savedDraggedOutLayout = null;\n } else {\n this.parentOnDragStop(i, x, y, sintEv);\n }\n };\n\n extendedOnDragOver = (e: MouseEvent): false | void => {\n this.props.onBeforeDragOver?.();\n return this.parentOnDragOver(e);\n };\n\n isSharedDragTarget = (): boolean => {\n const drag = this.props.dragStateRef?.current;\n return Boolean(drag?.isDragging);\n };\n\n // Proxy mouse events -> drag methods for dnd between groups\n mouseEnterHandler = (e: MouseEvent): void => {\n if (this.isSharedDragTarget()) {\n // @ts-expect-error - onDragEnter is a protected method in parent class\n this.onDragEnter(e);\n } else if (this.props.isDragCaptured) {\n this.props.onDragTargetRestore?.();\n }\n };\n\n mouseLeaveHandler = (e: MouseEvent): void => {\n if (this.isSharedDragTarget()) {\n // @ts-expect-error - onDragLeave is a protected method in parent class\n this.onDragLeave(e);\n this.props.onDragTargetRestore?.();\n }\n };\n\n mouseMoveHandler = (e: MouseEvent): void => {\n if (\n this.isSharedDragTarget() &&\n this.props.group !== this.props.dragStateRef?.current.sourceGroup\n ) {\n if (!(e as MouseEvent & {nativeEvent?: MouseEvent}).nativeEvent) {\n // Emulate nativeEvent for firefox\n const target = this.getInnerElement() || (e.target as HTMLElement);\n\n (e as MouseEvent & {nativeEvent: Partial<MouseEvent>}).nativeEvent = {\n clientX: e.clientX,\n clientY: e.clientY,\n target,\n };\n }\n\n // @ts-expect-error - onDragOver is a protected method in parent class\n this.onDragOver(e);\n }\n };\n\n mouseUpHandler = (e: MouseEvent): void => {\n if (this.isSharedDragTarget()) {\n e.preventDefault();\n const {droppingItem} = this.props;\n const {layout} = this.state;\n const item = layout.find((l) => l.i === droppingItem?.i);\n\n // reset dragEnter counter on drop for all registered groups\n this.props.groupResetRegistryRef?.current.forEach((reset) => reset());\n\n if (item) {\n this.props.onDrop?.(layout, item, e);\n }\n }\n };\n\n calculateDroppingPosition(itemProps: {\n containerWidth: number;\n cols: number;\n w: number;\n h: number;\n rowHeight: number;\n margin: [number, number];\n transformScale: number;\n droppingPosition: {left: number; top: number};\n }): {left: number; top: number} {\n const {containerWidth, cols, w, h, rowHeight, margin, transformScale, droppingPosition} =\n itemProps;\n const sharedDragPosition = this.props.sharedDragPositionRef?.current;\n\n let offsetX: number, offsetY: number;\n\n if (sharedDragPosition) {\n offsetX = sharedDragPosition.offsetX;\n offsetY = sharedDragPosition.offsetY;\n } else {\n offsetX = (((containerWidth / cols) * w) / 2 || 0) * transformScale;\n offsetY = ((h * rowHeight + (h - 1) * margin[1]) / 2 || 0) * transformScale;\n }\n\n return {\n ...droppingPosition,\n left: droppingPosition.left - offsetX,\n top: droppingPosition.top - offsetY,\n };\n }\n\n // Drop item from outside gets 0,0 droppingPosition\n // centering cursor on newly creted grid item\n // And cause grid-layout using it's own GridItem to make it look\n // like overlay adding className\n processGridItem(\n child: React.ReactElement,\n isDroppingItem?: boolean,\n ): React.ReactElement | undefined {\n // @ts-expect-error - processGridItem is a protected method in parent class\n const gridItem = super.processGridItem?.(child, isDroppingItem);\n\n if (!gridItem) {\n return gridItem;\n }\n\n const {cols, containerPadding, h, margin, rowHeight, useCSSTransforms, w, x, y} =\n gridItem.props;\n const [marginX, marginY] = margin;\n const [paddingX, paddingY] = containerPadding;\n const gridItemMetadata: Record<string, string> = {\n 'data-dashkit-grid-cols': String(cols),\n 'data-dashkit-grid-h': String(h),\n 'data-dashkit-grid-margin-x': String(marginX),\n 'data-dashkit-grid-margin-y': String(marginY),\n 'data-dashkit-grid-padding-x': String(paddingX),\n 'data-dashkit-grid-padding-y': String(paddingY),\n 'data-dashkit-grid-row-height': String(rowHeight),\n 'data-dashkit-grid-use-css-transforms': String(useCSSTransforms),\n 'data-dashkit-grid-w': String(w),\n 'data-dashkit-grid-x': String(x),\n 'data-dashkit-grid-y': String(y),\n };\n // Lazy proxy for transformScaleRef so react-draggable reads fresh scale without re-render.\n const {transformScaleRef} = this.props;\n const lazyScale = transformScaleRef\n ? ({valueOf: () => transformScaleRef.current} as unknown as number)\n : undefined;\n\n if (isDroppingItem) {\n // React.cloneElement is just cleaner then copy-paste whole processGridItem method\n return React.cloneElement(gridItem, {\n ...(lazyScale !== undefined && {transformScale: lazyScale}),\n // hiding preview if dragging shared item\n style: this.isSharedDragTarget()\n ? {...gridItem.props.style, opacity: 0}\n : gridItem.props.style,\n className: `${OVERLAY_CLASS_NAME} ${DROPPING_ELEMENT_CLASS_NAME}`,\n droppingPosition: this.calculateDroppingPosition(gridItem.props),\n });\n }\n\n const gridChild = gridItem.props.children as React.ReactElement<Record<string, string>>;\n const cachedGridItemChild = this.gridItemChildren.get(gridChild);\n const gridItemChild =\n cachedGridItemChild &&\n Object.keys(gridItemMetadata).every(\n (key) => cachedGridItemChild.metadata[key] === gridItemMetadata[key],\n )\n ? cachedGridItemChild.child\n : React.cloneElement(gridChild, gridItemMetadata);\n\n if (gridItemChild !== cachedGridItemChild?.child) {\n this.gridItemChildren.set(gridChild, {\n child: gridItemChild,\n metadata: gridItemMetadata,\n });\n }\n\n if (lazyScale !== undefined) {\n return React.cloneElement(gridItem, {\n children: gridItemChild,\n transformScale: lazyScale,\n });\n }\n\n return React.cloneElement(gridItem, {children: gridItemChild});\n }\n}\n\nclass PassiveWidthProvider extends React.Component<\n PassiveWidthProviderProps,\n {interactionRevision: number; isMounted: boolean; settledWidth: number}\n> {\n state = {interactionRevision: 0, isMounted: false, settledWidth: 1280};\n\n private element: HTMLDivElement | null = null;\n private readonly elementRef = React.createRef<HTMLDivElement>();\n private readonly widthRef = {current: 1280};\n private gridItems: HTMLElement[] = [];\n private lastAppliedWidth?: number;\n private resizeObserver?: ResizeObserver;\n private settledWidthCommitFrame?: number;\n private isComponentMounted = false;\n\n componentDidMount() {\n this.isComponentMounted = true;\n this.syncElement();\n this.setState({isMounted: true, settledWidth: this.widthRef.current});\n }\n\n componentDidUpdate() {\n this.syncElement();\n this.cacheGridItems();\n this.updateGridItems(this.widthRef.current);\n }\n\n componentWillUnmount() {\n this.isComponentMounted = false;\n this.resizeObserver?.disconnect();\n this.resizeObserver = undefined;\n if (this.settledWidthCommitFrame !== undefined) {\n window.cancelAnimationFrame(this.settledWidthCommitFrame);\n this.settledWidthCommitFrame = undefined;\n }\n this.element?.removeEventListener('pointerdown', this.handlePointerDown, true);\n this.element = null;\n }\n\n render() {\n const {measureBeforeMount, ...props} = this.props;\n\n if (measureBeforeMount && !this.state.isMounted) {\n return (\n <div\n className={[props.className, GRID_LAYOUT_CLASS_NAME].filter(Boolean).join(' ')}\n ref={this.elementRef}\n style={props.style}\n />\n );\n }\n\n return (\n <DragOverLayout\n {...props}\n innerRef={this.elementRef}\n onBeforeDragOver={this.syncSettledWidth}\n width={this.state.settledWidth}\n />\n );\n }\n\n private cacheGridItems = () => {\n const node = this.element;\n this.gridItems = node\n ? Array.from(node.children).filter(\n (child): child is HTMLElement =>\n child instanceof HTMLElement &&\n child.matches('.react-grid-item[data-dashkit-grid-cols]'),\n )\n : [];\n this.lastAppliedWidth = undefined;\n };\n\n private updateGridItems = (width: number) => {\n if (width === this.lastAppliedWidth) {\n return;\n }\n this.lastAppliedWidth = width;\n\n this.gridItems.forEach((item) => {\n if (\n item.classList.contains('react-draggable-dragging') ||\n item.classList.contains('resizing')\n ) {\n return;\n }\n\n const {dataset, style} = item;\n const cols = Number(dataset.dashkitGridCols);\n const x = Number(dataset.dashkitGridX);\n const y = Number(dataset.dashkitGridY);\n const w = Number(dataset.dashkitGridW);\n const h = Number(dataset.dashkitGridH);\n const marginX = Number(dataset.dashkitGridMarginX);\n const marginY = Number(dataset.dashkitGridMarginY);\n const paddingX = Number(dataset.dashkitGridPaddingX);\n const paddingY = Number(dataset.dashkitGridPaddingY);\n const rowHeight = Number(dataset.dashkitGridRowHeight);\n const useCSSTransforms = dataset.dashkitGridUseCssTransforms === 'true';\n\n if (\n [cols, x, y, w, h, marginX, marginY, paddingX, paddingY, rowHeight].some(\n (value) => !Number.isFinite(value),\n )\n ) {\n return;\n }\n\n Object.assign(\n style,\n getGridItemStyle({\n cols,\n containerPadding: [paddingX, paddingY],\n h,\n margin: [marginX, marginY],\n rowHeight,\n useCSSTransforms,\n w,\n width,\n x,\n y,\n }),\n );\n });\n };\n\n private handlePointerDown = () => {\n if (!this.props.isDraggable && !this.props.isResizable) {\n return;\n }\n\n flushSync(() => {\n this.setState((state) => ({\n interactionRevision: state.interactionRevision + 1,\n settledWidth: this.widthRef.current,\n }));\n });\n };\n\n private syncSettledWidth = () => {\n if (this.state.settledWidth === this.widthRef.current) {\n return;\n }\n\n flushSync(() => {\n this.setState({settledWidth: this.widthRef.current});\n });\n };\n\n private scheduleSettledWidthCommit = () => {\n if (this.settledWidthCommitFrame !== undefined) {\n window.cancelAnimationFrame(this.settledWidthCommitFrame);\n }\n this.settledWidthCommitFrame = window.requestAnimationFrame(() => {\n this.settledWidthCommitFrame = window.requestAnimationFrame(() => {\n this.settledWidthCommitFrame = undefined;\n if (this.state.settledWidth !== this.widthRef.current) {\n this.setState({settledWidth: this.widthRef.current});\n }\n });\n });\n };\n\n private syncElement = () => {\n const node = this.elementRef.current;\n if (node === this.element) {\n return;\n }\n\n if (this.element) {\n this.resizeObserver?.unobserve(this.element);\n this.element.removeEventListener('pointerdown', this.handlePointerDown, true);\n }\n\n this.element = node;\n if (node && this.isComponentMounted) {\n this.observeElement(node);\n }\n };\n\n private observeElement = (node: HTMLDivElement) => {\n this.widthRef.current = node.clientWidth;\n this.cacheGridItems();\n this.updateGridItems(this.widthRef.current);\n node.addEventListener('pointerdown', this.handlePointerDown, true);\n this.resizeObserver ??= new (\n typeof ResizeObserver === 'function' ? ResizeObserver : ResizeObserverPolyfill\n )((entries: ResizeObserverEntry[]) => {\n const entry = entries.find((currentEntry) => currentEntry.target === this.element);\n if (!entry) {\n return;\n }\n\n this.widthRef.current = entry.contentRect.width;\n this.updateGridItems(this.widthRef.current);\n this.scheduleSettledWidthCommit();\n });\n this.resizeObserver.observe(node);\n };\n}\n\nexport const Layout = PassiveWidthProvider;\n"]}
1
+ {"version":3,"file":"ReactGridLayout.js","sourceRoot":"../../../../src","sources":["components/GridLayout/ReactGridLayout.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,yCAAoC;AAEpC,+DAA+D;AAC/D,+EAAyD;AACzD,gGAA8D;AAE9D,wDAAgF;AAEhF,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AACnD,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAEvC,MAAM,WAAW,GAAG,CAChB,KAAgC,EACQ,EAAE;IAC1C,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CACpC,CAAC;AACN,CAAC,CAAC;AAsCF,MAAM,gBAAgB,GAAG,CAAC,EACtB,IAAI,EACJ,gBAAgB,EAChB,MAAM,EACN,KAAK,EACL,CAAC,EACD,CAAC,EACD,CAAC,EACD,CAAC,EACD,SAAS,EACT,gBAAgB,GAYnB,EAAE,EAAE;IACD,MAAM,CAAC,OAAO,EAAE,OAAO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AAK,CAAC;QAChC,MAAA,IAAI,CAAC,cAAc,0CAAE,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAChC,MAAA,IAAI,CAAC,OAAO,0CAAE,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,MAAM;QACF,MAAM,KAAiC,IAAI,CAAC,KAAK,EAA3C,EAAC,kBAAkB,OAAwB,EAAnB,KAAK,sBAA7B,sBAA8B,CAAa,CAAC;QAElD,IAAI,kBAAkB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YAC9C,OAAO,CACH,uCACI,SAAS,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC9E,GAAG,EAAE,IAAI,CAAC,UAAU,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,GACpB,CACL,CAAC;QACN,CAAC;QAED,OAAO,CACH,8BAAC,cAAc,oBACP,KAAK,IACT,QAAQ,EAAE,IAAI,CAAC,UAAU,EACzB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EACvC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,IAChC,CACL,CAAC;IACN,CAAC;CAmJJ;AAEY,QAAA,MAAM,GAAG,oBAAoB,CAAC","sourcesContent":["import React from 'react';\n\nimport {flushSync} from 'react-dom';\nimport type {Layout as RGLLayout} from 'react-grid-layout';\n// @ts-expect-error - utils is not exported in type definitions\nimport ReactGridLayout, {utils} from 'react-grid-layout';\nimport ResizeObserverPolyfill from 'resize-observer-polyfill';\n\nimport {DROPPING_ELEMENT_CLASS_NAME, OVERLAY_CLASS_NAME} from '../../constants';\n\nconst GRID_LAYOUT_CLASS_NAME = 'react-grid-layout';\nconst SETTLED_WIDTH_COMMIT_DELAY = 150;\n\nconst isRefObject = (\n value: React.Ref<HTMLDivElement>,\n): value is React.RefObject<HTMLDivElement> => {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'current' in value &&\n typeof value.current === 'object'\n );\n};\n\ntype SharedDragPosition = {\n offsetX: number;\n offsetY: number;\n};\n\ntype DragOverLayoutProps = ReactGridLayout.ReactGridLayoutProps & {\n innerRef?: React.Ref<HTMLDivElement>;\n isDragCaptured?: boolean;\n dragStateRef?: React.MutableRefObject<{isDragging: boolean; sourceGroup: string | null}>;\n sharedDragPositionRef?: React.MutableRefObject<SharedDragPosition | null>;\n group?: string;\n onDragTargetRestore?: () => void;\n transformScaleRef?: React.MutableRefObject<number>;\n groupResetRegistryRef?: React.MutableRefObject<Map<string, () => void>>;\n externalLayoutRevision?: number;\n onBeforeDragOver?: () => void;\n};\n\ntype DragOverLayoutState = {\n layout: RGLLayout[];\n activeDrag: RGLLayout | null;\n};\n\ntype RGLLayoutWithPlaceholder = RGLLayout & {placeholder?: boolean};\n\ntype PassiveWidthProviderProps = DragOverLayoutProps & {\n measureBeforeMount?: boolean;\n};\n\ntype OnDragMethod = (\n i: string,\n x: number,\n y: number,\n sintEv: {e: Event; node: HTMLElement},\n) => void;\n\nconst getGridItemStyle = ({\n cols,\n containerPadding,\n margin,\n width,\n x,\n y,\n w,\n h,\n rowHeight,\n useCSSTransforms,\n}: {\n cols: number;\n containerPadding: [number, number];\n h: number;\n margin: [number, number];\n rowHeight: number;\n useCSSTransforms: boolean;\n w: number;\n width: number;\n x: number;\n y: number;\n}) => {\n const [marginX, marginY] = margin;\n const [paddingX, paddingY] = containerPadding;\n const columnWidth = (width - marginX * (cols - 1) - paddingX * 2) / cols;\n const position = {\n height: Math.round(rowHeight * h + marginY * (h - 1)),\n left: Math.round((columnWidth + marginX) * x + paddingX),\n top: Math.round(paddingY + (rowHeight + marginY) * y),\n width: Math.round(columnWidth * w + marginX * (w - 1)),\n };\n\n return useCSSTransforms\n ? {...utils.setTransform(position), left: '', top: ''}\n : {\n ...utils.setTopLeft(position),\n MozTransform: '',\n OTransform: '',\n WebkitTransform: '',\n msTransform: '',\n transform: '',\n };\n};\n\nclass DragOverLayout extends ReactGridLayout {\n // @ts-expect-error - TypeScript doesn't allow direct property redeclaration in extending classes. We need to narrow the props type from ReactGridLayoutProps to DragOverLayoutProps for type safety in our custom methods\n props: DragOverLayoutProps;\n // @ts-expect-error - TypeScript doesn't allow direct property redeclaration in extending classes. State is initialized by parent constructor\n state: DragOverLayoutState;\n\n parentOnDrag: OnDragMethod;\n parentOnDragStop: OnDragMethod;\n parentOnDragOver: (e: MouseEvent) => false | void;\n _savedDraggedOutLayout: RGLLayout[] | null = null;\n // Suppresses onLayoutMaybeChanged during imperative layout restore actions.\n // Without this flag, our setState would trigger onLayoutChange back to the consumer\n // that just initiated the action, causing a spurious 'change' event.\n _isRestoringExternalLayout = false;\n private readonly gridItemChildren = new WeakMap<\n React.ReactElement,\n {child: React.ReactElement; metadata: Record<string, string>}\n >();\n\n constructor(props: DragOverLayoutProps, context?: unknown) {\n super(props, context);\n\n // @ts-expect-error - onDrag is a protected method in parent class\n this.parentOnDrag = this.onDrag;\n // @ts-expect-error - assigning custom method to parent's onDrag\n this.onDrag = this.extendedOnDrag;\n\n // @ts-expect-error - onDragStop is a protected method in parent class\n this.parentOnDragStop = this.onDragStop;\n // @ts-expect-error - assigning custom method to parent's onDragStop\n this.onDragStop = this.extendedOnDragStop;\n // @ts-expect-error - onDragOver is a protected method in parent class\n this.parentOnDragOver = this.onDragOver;\n // @ts-expect-error - assigning custom method to parent's onDragOver\n this.onDragOver = this.extendedOnDragOver;\n }\n\n componentDidMount(): void {\n super.componentDidMount?.();\n\n if (this.props.group !== undefined) {\n this.props.groupResetRegistryRef?.current.set(\n this.props.group,\n this.resetExternalPlaceholder,\n );\n }\n\n // If cursor is moved out of the window there is a bug\n // which leaves placeholder element in grid, this action needed to reset this state\n window.addEventListener('dragend', this.resetExternalPlaceholder);\n const innerElement = this.getInnerElement();\n\n if (innerElement) {\n innerElement.addEventListener('mouseup', this.mouseUpHandler);\n innerElement.addEventListener('mouseenter', this.mouseEnterHandler);\n innerElement.addEventListener('mouseleave', this.mouseLeaveHandler);\n innerElement.addEventListener('mousemove', this.mouseMoveHandler);\n }\n }\n\n componentDidUpdate(prevProps: DragOverLayoutProps, prevState: DragOverLayoutState): void {\n const revisionChanged =\n prevProps.externalLayoutRevision !== this.props.externalLayoutRevision;\n\n if (revisionChanged && this.props.layout) {\n const newLayout = utils.synchronizeLayoutWithChildren(\n this.props.layout,\n this.props.children,\n this.props.cols,\n utils.compactType(this.props),\n this.props.allowOverlap,\n );\n\n this._isRestoringExternalLayout = true;\n // Override both layout and propsLayout so getDerivedStateFromProps\n // doesn't revert our update on the next render cycle.\n this.setState(\n {\n layout: newLayout,\n propsLayout: this.props.layout,\n } as unknown as DragOverLayoutState,\n () => {\n this._isRestoringExternalLayout = false;\n },\n );\n // RGL's shouldComponentUpdate only tracks activeDrag/mounted/droppingPosition — not\n // state.layout. So setState({layout}) alone is silently ignored (no re-render).\n // forceUpdate bypasses SCU and is batched with the setState above, producing a\n // single render cycle with the merged state that includes the restored layout.\n this.forceUpdate();\n // Don't call super here: restoring is an external action, not a user drag/resize.\n // onLayoutMaybeChanged is suppressed via _isRestoringExternalLayout.\n return;\n }\n\n // Maintain parent behavior for all non-restore cycles (drag, resize, etc.).\n super.componentDidUpdate?.(prevProps, prevState);\n }\n\n onLayoutMaybeChanged(newLayout: RGLLayout[], oldLayout: RGLLayout[]): void {\n if (this._isRestoringExternalLayout) {\n return;\n }\n // @ts-expect-error — onLayoutMaybeChanged is not in ReactGridLayout's public types\n super.onLayoutMaybeChanged(newLayout, oldLayout);\n }\n\n componentWillUnmount(): void {\n if (this.props.group !== undefined) {\n this.props.groupResetRegistryRef?.current.delete(this.props.group);\n }\n\n window.removeEventListener('dragend', this.resetExternalPlaceholder);\n const innerElement = this.getInnerElement();\n\n if (innerElement) {\n innerElement.removeEventListener('mouseup', this.mouseUpHandler);\n innerElement.removeEventListener('mouseenter', this.mouseEnterHandler);\n innerElement.removeEventListener('mouseleave', this.mouseLeaveHandler);\n innerElement.removeEventListener('mousemove', this.mouseMoveHandler);\n }\n }\n\n // react-grid-layout doens't calculate it's height when last element is removed\n // and just keeps the previous value\n // so for autosize to work in that case we are resetting it's height value\n containerHeight(): string | undefined {\n if (this.props.autoSize && this.state.layout.length === 0) {\n return;\n }\n\n // eslint-disable-next-line consistent-return\n // @ts-expect-error - containerHeight is a protected method in parent class\n return super.containerHeight();\n }\n\n // innerRef is passed by WithProvider without this wrapper there are only\n // * findDOMNode - deprecated\n // * rewrite whole ReactGridLayout.render method\n // so in that case don't try to use this class on it's own\n // or pass innerRef: React.MutableRef as it's not optional prop\n getInnerElement(): HTMLDivElement | null {\n const {innerRef} = this.props;\n\n return innerRef && isRefObject(innerRef) && innerRef.current ? innerRef.current : null;\n }\n\n // Reset placeholder when item dragged from outside\n resetExternalPlaceholder = (): void => {\n // @ts-expect-error - dragEnterCounter is an internal property of parent class\n if (this.dragEnterCounter) {\n // @ts-expect-error - dragEnterCounter is an internal property of parent class\n this.dragEnterCounter = 0;\n // @ts-expect-error - removeDroppingPlaceholder is a protected method in parent class\n this.removeDroppingPlaceholder();\n }\n };\n\n // Hide placeholder when element is dragged out\n hideLocalPlaceholder = (i: string): RGLLayout[] => {\n const {layout} = this.state;\n const {cols} = this.props;\n const savedLayout = layout.map((item) => ({...item}));\n\n let hiddenElement: RGLLayout | undefined;\n const newLayout = utils.compact(\n layout.filter((item) => {\n if (item.i === i) {\n hiddenElement = item;\n return false;\n }\n\n return true;\n }),\n utils.compactType(this.props),\n cols,\n );\n\n if (hiddenElement) {\n newLayout.push(hiddenElement);\n }\n\n this.setState({\n activeDrag: null,\n layout: newLayout,\n });\n\n return savedLayout;\n };\n\n extendedOnDrag = (\n i: string,\n x: number,\n y: number,\n sintEv: {e: Event; node: HTMLElement},\n ): void => {\n if (this.props.isDragCaptured) {\n if (!this._savedDraggedOutLayout) {\n this._savedDraggedOutLayout = this.hideLocalPlaceholder(i);\n }\n\n return;\n }\n\n this._savedDraggedOutLayout = null;\n // parent onDrag will show new placeholder again\n this.parentOnDrag(i, x, y, sintEv);\n };\n\n extendedOnDragStop = (\n i: string,\n x: number,\n y: number,\n sintEv: {e: Event; node: HTMLElement},\n ): void => {\n // Restoring layout if item was dropped outside of the grid\n if (this._savedDraggedOutLayout) {\n const savedLayout = this._savedDraggedOutLayout;\n const l = utils.getLayoutItem(savedLayout, i);\n\n // Create placeholder (display only)\n const placeholder: RGLLayoutWithPlaceholder = {\n w: l.w,\n h: l.h,\n x: l.x,\n y: l.y,\n placeholder: true,\n i: i,\n };\n\n this.setState(\n {\n layout: savedLayout,\n activeDrag: placeholder,\n },\n () => {\n this.parentOnDragStop(i, x, y, sintEv);\n },\n );\n\n this._savedDraggedOutLayout = null;\n } else {\n this.parentOnDragStop(i, x, y, sintEv);\n }\n };\n\n extendedOnDragOver = (e: MouseEvent): false | void => {\n this.props.onBeforeDragOver?.();\n return this.parentOnDragOver(e);\n };\n\n isSharedDragTarget = (): boolean => {\n const drag = this.props.dragStateRef?.current;\n return Boolean(drag?.isDragging);\n };\n\n // Proxy mouse events -> drag methods for dnd between groups\n mouseEnterHandler = (e: MouseEvent): void => {\n if (this.isSharedDragTarget()) {\n // @ts-expect-error - onDragEnter is a protected method in parent class\n this.onDragEnter(e);\n } else if (this.props.isDragCaptured) {\n this.props.onDragTargetRestore?.();\n }\n };\n\n mouseLeaveHandler = (e: MouseEvent): void => {\n if (this.isSharedDragTarget()) {\n // @ts-expect-error - onDragLeave is a protected method in parent class\n this.onDragLeave(e);\n this.props.onDragTargetRestore?.();\n }\n };\n\n mouseMoveHandler = (e: MouseEvent): void => {\n if (\n this.isSharedDragTarget() &&\n this.props.group !== this.props.dragStateRef?.current.sourceGroup\n ) {\n if (!(e as MouseEvent & {nativeEvent?: MouseEvent}).nativeEvent) {\n // Emulate nativeEvent for firefox\n const target = this.getInnerElement() || (e.target as HTMLElement);\n\n (e as MouseEvent & {nativeEvent: Partial<MouseEvent>}).nativeEvent = {\n clientX: e.clientX,\n clientY: e.clientY,\n target,\n };\n }\n\n // @ts-expect-error - onDragOver is a protected method in parent class\n this.onDragOver(e);\n }\n };\n\n mouseUpHandler = (e: MouseEvent): void => {\n if (this.isSharedDragTarget()) {\n e.preventDefault();\n const {droppingItem} = this.props;\n const {layout} = this.state;\n const item = layout.find((l) => l.i === droppingItem?.i);\n\n // reset dragEnter counter on drop for all registered groups\n this.props.groupResetRegistryRef?.current.forEach((reset) => reset());\n\n if (item) {\n this.props.onDrop?.(layout, item, e);\n }\n }\n };\n\n calculateDroppingPosition(itemProps: {\n containerWidth: number;\n cols: number;\n w: number;\n h: number;\n rowHeight: number;\n margin: [number, number];\n transformScale: number;\n droppingPosition: {left: number; top: number};\n }): {left: number; top: number} {\n const {containerWidth, cols, w, h, rowHeight, margin, transformScale, droppingPosition} =\n itemProps;\n const sharedDragPosition = this.props.sharedDragPositionRef?.current;\n\n let offsetX: number, offsetY: number;\n\n if (sharedDragPosition) {\n offsetX = sharedDragPosition.offsetX;\n offsetY = sharedDragPosition.offsetY;\n } else {\n offsetX = (((containerWidth / cols) * w) / 2 || 0) * transformScale;\n offsetY = ((h * rowHeight + (h - 1) * margin[1]) / 2 || 0) * transformScale;\n }\n\n return {\n ...droppingPosition,\n left: droppingPosition.left - offsetX,\n top: droppingPosition.top - offsetY,\n };\n }\n\n // Drop item from outside gets 0,0 droppingPosition\n // centering cursor on newly creted grid item\n // And cause grid-layout using it's own GridItem to make it look\n // like overlay adding className\n processGridItem(\n child: React.ReactElement,\n isDroppingItem?: boolean,\n ): React.ReactElement | undefined {\n // @ts-expect-error - processGridItem is a protected method in parent class\n const gridItem = super.processGridItem?.(child, isDroppingItem);\n\n if (!gridItem) {\n return gridItem;\n }\n\n const {cols, containerPadding, h, margin, rowHeight, useCSSTransforms, w, x, y} =\n gridItem.props;\n const [marginX, marginY] = margin;\n const [paddingX, paddingY] = containerPadding;\n const gridItemMetadata: Record<string, string> = {\n 'data-dashkit-grid-cols': String(cols),\n 'data-dashkit-grid-h': String(h),\n 'data-dashkit-grid-margin-x': String(marginX),\n 'data-dashkit-grid-margin-y': String(marginY),\n 'data-dashkit-grid-padding-x': String(paddingX),\n 'data-dashkit-grid-padding-y': String(paddingY),\n 'data-dashkit-grid-row-height': String(rowHeight),\n 'data-dashkit-grid-use-css-transforms': String(useCSSTransforms),\n 'data-dashkit-grid-w': String(w),\n 'data-dashkit-grid-x': String(x),\n 'data-dashkit-grid-y': String(y),\n };\n // Lazy proxy for transformScaleRef so react-draggable reads fresh scale without re-render.\n const {transformScaleRef} = this.props;\n const lazyScale = transformScaleRef\n ? ({valueOf: () => transformScaleRef.current} as unknown as number)\n : undefined;\n\n if (isDroppingItem) {\n // React.cloneElement is just cleaner then copy-paste whole processGridItem method\n return React.cloneElement(gridItem, {\n ...(lazyScale !== undefined && {transformScale: lazyScale}),\n // hiding preview if dragging shared item\n style: this.isSharedDragTarget()\n ? {...gridItem.props.style, opacity: 0}\n : gridItem.props.style,\n className: `${OVERLAY_CLASS_NAME} ${DROPPING_ELEMENT_CLASS_NAME}`,\n droppingPosition: this.calculateDroppingPosition(gridItem.props),\n });\n }\n\n const gridChild = gridItem.props.children as React.ReactElement<Record<string, string>>;\n const cachedGridItemChild = this.gridItemChildren.get(gridChild);\n const gridItemChild =\n cachedGridItemChild &&\n Object.keys(gridItemMetadata).every(\n (key) => cachedGridItemChild.metadata[key] === gridItemMetadata[key],\n )\n ? cachedGridItemChild.child\n : React.cloneElement(gridChild, gridItemMetadata);\n\n if (gridItemChild !== cachedGridItemChild?.child) {\n this.gridItemChildren.set(gridChild, {\n child: gridItemChild,\n metadata: gridItemMetadata,\n });\n }\n\n if (lazyScale !== undefined) {\n return React.cloneElement(gridItem, {\n children: gridItemChild,\n transformScale: lazyScale,\n });\n }\n\n return React.cloneElement(gridItem, {children: gridItemChild});\n }\n}\n\nclass PassiveWidthProvider extends React.Component<\n PassiveWidthProviderProps,\n {interactionRevision: number; isMounted: boolean; settledWidth: number}\n> {\n state = {interactionRevision: 0, isMounted: false, settledWidth: 1280};\n\n private element: HTMLDivElement | null = null;\n private readonly elementRef = React.createRef<HTMLDivElement>();\n private readonly widthRef = {current: 1280};\n private gridItems: HTMLElement[] = [];\n private lastAppliedWidth?: number;\n private resizeObserver?: ResizeObserver;\n private settledWidthCommitTimer?: number;\n private isComponentMounted = false;\n\n componentDidMount() {\n this.isComponentMounted = true;\n this.syncElement();\n this.setState({isMounted: true, settledWidth: this.widthRef.current});\n }\n\n componentDidUpdate() {\n this.syncElement();\n this.cacheGridItems();\n this.updateGridItems(this.widthRef.current);\n }\n\n componentWillUnmount() {\n this.isComponentMounted = false;\n this.resizeObserver?.disconnect();\n this.resizeObserver = undefined;\n this.cancelSettledWidthCommit();\n this.element?.removeEventListener('pointerdown', this.handlePointerDown, true);\n this.element = null;\n }\n\n render() {\n const {measureBeforeMount, ...props} = this.props;\n\n if (measureBeforeMount && !this.state.isMounted) {\n return (\n <div\n className={[props.className, GRID_LAYOUT_CLASS_NAME].filter(Boolean).join(' ')}\n ref={this.elementRef}\n style={props.style}\n />\n );\n }\n\n return (\n <DragOverLayout\n {...props}\n innerRef={this.elementRef}\n onBeforeDragOver={this.syncSettledWidth}\n width={this.state.settledWidth}\n />\n );\n }\n\n private cacheGridItems = () => {\n const node = this.element;\n this.gridItems = node\n ? Array.from(node.children).filter(\n (child): child is HTMLElement =>\n child instanceof HTMLElement &&\n child.matches('.react-grid-item[data-dashkit-grid-cols]'),\n )\n : [];\n this.lastAppliedWidth = undefined;\n };\n\n private updateGridItems = (width: number) => {\n if (width === this.lastAppliedWidth) {\n return;\n }\n this.lastAppliedWidth = width;\n\n this.gridItems.forEach((item) => {\n if (\n item.classList.contains('react-draggable-dragging') ||\n item.classList.contains('resizing')\n ) {\n return;\n }\n\n const {dataset, style} = item;\n const cols = Number(dataset.dashkitGridCols);\n const x = Number(dataset.dashkitGridX);\n const y = Number(dataset.dashkitGridY);\n const w = Number(dataset.dashkitGridW);\n const h = Number(dataset.dashkitGridH);\n const marginX = Number(dataset.dashkitGridMarginX);\n const marginY = Number(dataset.dashkitGridMarginY);\n const paddingX = Number(dataset.dashkitGridPaddingX);\n const paddingY = Number(dataset.dashkitGridPaddingY);\n const rowHeight = Number(dataset.dashkitGridRowHeight);\n const useCSSTransforms = dataset.dashkitGridUseCssTransforms === 'true';\n\n if (\n [cols, x, y, w, h, marginX, marginY, paddingX, paddingY, rowHeight].some(\n (value) => !Number.isFinite(value),\n )\n ) {\n return;\n }\n\n Object.assign(\n style,\n getGridItemStyle({\n cols,\n containerPadding: [paddingX, paddingY],\n h,\n margin: [marginX, marginY],\n rowHeight,\n useCSSTransforms,\n w,\n width,\n x,\n y,\n }),\n );\n });\n };\n\n private handlePointerDown = () => {\n if (!this.props.isDraggable && !this.props.isResizable) {\n return;\n }\n\n this.cancelSettledWidthCommit();\n flushSync(() => {\n this.setState((state) => ({\n interactionRevision: state.interactionRevision + 1,\n settledWidth: this.widthRef.current,\n }));\n });\n };\n\n private syncSettledWidth = () => {\n this.cancelSettledWidthCommit();\n if (this.state.settledWidth === this.widthRef.current) {\n return;\n }\n\n flushSync(() => {\n this.setState({settledWidth: this.widthRef.current});\n });\n };\n\n private cancelSettledWidthCommit = () => {\n if (this.settledWidthCommitTimer === undefined) {\n return;\n }\n window.clearTimeout(this.settledWidthCommitTimer);\n this.settledWidthCommitTimer = undefined;\n };\n\n private scheduleSettledWidthCommit = () => {\n this.cancelSettledWidthCommit();\n // DOM grid items update in ResizeObserver; React reconciles only after resizing settles.\n this.settledWidthCommitTimer = window.setTimeout(() => {\n this.settledWidthCommitTimer = undefined;\n if (this.isComponentMounted && this.state.settledWidth !== this.widthRef.current) {\n this.setState({settledWidth: this.widthRef.current});\n }\n }, SETTLED_WIDTH_COMMIT_DELAY);\n };\n\n private syncElement = () => {\n const node = this.elementRef.current;\n if (node === this.element) {\n return;\n }\n\n if (this.element) {\n this.resizeObserver?.unobserve(this.element);\n this.element.removeEventListener('pointerdown', this.handlePointerDown, true);\n }\n\n this.element = node;\n if (node && this.isComponentMounted) {\n this.observeElement(node);\n }\n };\n\n private observeElement = (node: HTMLDivElement) => {\n this.widthRef.current = node.clientWidth;\n this.cacheGridItems();\n this.updateGridItems(this.widthRef.current);\n node.addEventListener('pointerdown', this.handlePointerDown, true);\n this.resizeObserver ??= new (\n typeof ResizeObserver === 'function' ? ResizeObserver : ResizeObserverPolyfill\n )((entries: ResizeObserverEntry[]) => {\n const entry = entries.find((currentEntry) => currentEntry.target === this.element);\n if (!entry) {\n return;\n }\n\n this.widthRef.current = entry.contentRect.width;\n this.updateGridItems(this.widthRef.current);\n this.scheduleSettledWidthCommit();\n });\n this.resizeObserver.observe(node);\n };\n}\n\nexport const Layout = PassiveWidthProvider;\n"]}