@gravity-ui/dashkit 8.10.1 → 8.11.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.
@@ -78,18 +78,111 @@
78
78
  position: absolute;
79
79
  width: 20px;
80
80
  height: 20px;
81
- bottom: 0;
82
- right: 0;
83
- cursor: se-resize;
84
81
  z-index: 6;
85
82
  }
86
83
 
87
84
  .react-grid-item .react-resizable-handle::after {
88
85
  content: "";
89
86
  position: absolute;
90
- right: 3px;
91
- bottom: 3px;
92
87
  border: 4px solid transparent;
88
+ }
89
+
90
+ .react-grid-item .react-resizable-handle-s {
91
+ cursor: s-resize;
92
+ bottom: 0;
93
+ left: 50%;
94
+ transform: translateX(-50%) translateY(0);
95
+ }
96
+ .react-grid-item .react-resizable-handle-s::after {
97
+ bottom: -3px;
98
+ left: 4px;
99
+ border: 6px solid transparent;
100
+ border-top-color: rgba(0, 0, 0, 0.4);
101
+ }
102
+
103
+ .react-grid-item .react-resizable-handle-w {
104
+ cursor: w-resize;
105
+ top: 50%;
106
+ left: 0;
107
+ transform: translateX(0) translateY(-50%);
108
+ }
109
+ .react-grid-item .react-resizable-handle-w::after {
110
+ top: 4px;
111
+ left: -3px;
112
+ border: 6px solid transparent;
113
+ border-right-color: rgba(0, 0, 0, 0.4);
114
+ }
115
+
116
+ .react-grid-item .react-resizable-handle-e {
117
+ cursor: e-resize;
118
+ top: 50%;
119
+ right: 0;
120
+ transform: translateX(0) translateY(-50%);
121
+ }
122
+ .react-grid-item .react-resizable-handle-e::after {
123
+ top: 4px;
124
+ right: -3px;
125
+ border: 6px solid transparent;
126
+ border-left-color: rgba(0, 0, 0, 0.4);
127
+ }
128
+
129
+ .react-grid-item .react-resizable-handle-n {
130
+ cursor: n-resize;
131
+ top: 0;
132
+ left: 50%;
133
+ transform: translateX(-50%) translateY(0);
134
+ }
135
+ .react-grid-item .react-resizable-handle-n::after {
136
+ top: -3px;
137
+ left: 4px;
138
+ border: 6px solid transparent;
139
+ border-bottom-color: rgba(0, 0, 0, 0.4);
140
+ }
141
+
142
+ .react-grid-item .react-resizable-handle-sw {
143
+ cursor: sw-resize;
144
+ bottom: 0;
145
+ left: 0;
146
+ }
147
+ .react-grid-item .react-resizable-handle-sw::after {
148
+ bottom: 3px;
149
+ left: 3px;
150
+ border-left-color: rgba(0, 0, 0, 0.4);
151
+ border-bottom-color: rgba(0, 0, 0, 0.4);
152
+ }
153
+
154
+ .react-grid-item .react-resizable-handle-nw {
155
+ cursor: nw-resize;
156
+ top: 0;
157
+ left: 0;
158
+ }
159
+ .react-grid-item .react-resizable-handle-nw::after {
160
+ top: 3px;
161
+ left: 3px;
162
+ border-left-color: rgba(0, 0, 0, 0.4);
163
+ border-top-color: rgba(0, 0, 0, 0.4);
164
+ }
165
+
166
+ .react-grid-item .react-resizable-handle-se {
167
+ cursor: se-resize;
168
+ bottom: 0;
169
+ right: 0;
170
+ }
171
+ .react-grid-item .react-resizable-handle-se::after {
172
+ bottom: 3px;
173
+ right: 3px;
93
174
  border-right-color: rgba(0, 0, 0, 0.4);
94
175
  border-bottom-color: rgba(0, 0, 0, 0.4);
176
+ }
177
+
178
+ .react-grid-item .react-resizable-handle-ne {
179
+ cursor: ne-resize;
180
+ top: 0;
181
+ right: 0;
182
+ }
183
+ .react-grid-item .react-resizable-handle-ne::after {
184
+ top: 3px;
185
+ right: 3px;
186
+ border-right-color: rgba(0, 0, 0, 0.4);
187
+ border-top-color: rgba(0, 0, 0, 0.4);
95
188
  }
@@ -11,6 +11,11 @@ export default class MobileLayout extends React.PureComponent<any, any, any> {
11
11
  adjustWidgetLayout: (index: any, { needSetDefault }: {
12
12
  needSetDefault: any;
13
13
  }) => void;
14
+ onMountChange: (isMounted: any) => void;
15
+ _inited: boolean | undefined;
16
+ onBeforeLoad: () => () => void;
17
+ _isAsyncItem: boolean | undefined;
18
+ onLoad: () => void;
14
19
  render(): JSX.Element;
15
20
  }
16
21
  import React from 'react';
@@ -27,6 +27,33 @@ class MobileLayout extends react_1.default.PureComponent {
27
27
  });
28
28
  }
29
29
  };
30
+ this.onMountChange = (isMounted) => {
31
+ var _a, _b, _c, _d, _e, _f;
32
+ if (isMounted) {
33
+ this._inited = true;
34
+ (_b = (_a = this.context).onItemMountChange) === null || _b === void 0 ? void 0 : _b.call(_a, this.props.item, {
35
+ isAsync: this._isAsyncItem,
36
+ isMounted: isMounted,
37
+ });
38
+ if (!this._isAsyncItem) {
39
+ (_d = (_c = this.context).onItemRender) === null || _d === void 0 ? void 0 : _d.call(_c, this.props.item);
40
+ }
41
+ }
42
+ else {
43
+ (_f = (_e = this.context).onItemMountChange) === null || _f === void 0 ? void 0 : _f.call(_e, this.props.item, {
44
+ isAsync: this._isAsyncItem,
45
+ isMounted: isMounted,
46
+ });
47
+ }
48
+ };
49
+ this.onBeforeLoad = () => {
50
+ this._isAsyncItem = true;
51
+ return this.onLoad;
52
+ };
53
+ this.onLoad = () => {
54
+ var _a, _b;
55
+ (_b = (_a = this.context).onItemRender) === null || _b === void 0 ? void 0 : _b.call(_a, this.props.item);
56
+ };
30
57
  }
31
58
  componentDidUpdate(prevProps, prevState) {
32
59
  if (prevState.activeTabId !== this.context.config.id) {
@@ -46,7 +73,7 @@ class MobileLayout extends react_1.default.PureComponent {
46
73
  return (react_1.default.createElement("div", { className: b('item', { autoheight: isItemWithActiveAutoheight }), key: item.id },
47
74
  react_1.default.createElement(Item_1.default, { id: item.id, item: item, layout: layout, shouldItemUpdate: false, adjustWidgetLayout: this.adjustWidgetLayout.bind(this, index), forwardedPluginRef: (pluginRef) => {
48
75
  this.pluginsRefs[index] = pluginRef;
49
- } })));
76
+ }, onMountChange: this.onMountChange, onBeforeLoad: this.onBeforeLoad })));
50
77
  })));
51
78
  }
52
79
  }
@@ -9,10 +9,9 @@ export interface AddConfigItem extends Omit<ConfigItem, 'id' | 'namespace'> {
9
9
  export type SetConfigItem = ConfigItem | AddConfigItem;
10
10
  export type SetItemOptions = {
11
11
  excludeIds?: string[];
12
- };
13
- export type SetNewItemOptions = SetItemOptions & {
14
12
  updateLayout?: ConfigLayout[];
15
13
  };
14
+ export type SetNewItemOptions = SetItemOptions;
16
15
  export interface DashkitGroupRenderProps {
17
16
  config: Config;
18
17
  editMode: boolean;
@@ -78,18 +78,111 @@
78
78
  position: absolute;
79
79
  width: 20px;
80
80
  height: 20px;
81
- bottom: 0;
82
- right: 0;
83
- cursor: se-resize;
84
81
  z-index: 6;
85
82
  }
86
83
 
87
84
  .react-grid-item .react-resizable-handle::after {
88
85
  content: "";
89
86
  position: absolute;
90
- right: 3px;
91
- bottom: 3px;
92
87
  border: 4px solid transparent;
88
+ }
89
+
90
+ .react-grid-item .react-resizable-handle-s {
91
+ cursor: s-resize;
92
+ bottom: 0;
93
+ left: 50%;
94
+ transform: translateX(-50%) translateY(0);
95
+ }
96
+ .react-grid-item .react-resizable-handle-s::after {
97
+ bottom: -3px;
98
+ left: 4px;
99
+ border: 6px solid transparent;
100
+ border-top-color: rgba(0, 0, 0, 0.4);
101
+ }
102
+
103
+ .react-grid-item .react-resizable-handle-w {
104
+ cursor: w-resize;
105
+ top: 50%;
106
+ left: 0;
107
+ transform: translateX(0) translateY(-50%);
108
+ }
109
+ .react-grid-item .react-resizable-handle-w::after {
110
+ top: 4px;
111
+ left: -3px;
112
+ border: 6px solid transparent;
113
+ border-right-color: rgba(0, 0, 0, 0.4);
114
+ }
115
+
116
+ .react-grid-item .react-resizable-handle-e {
117
+ cursor: e-resize;
118
+ top: 50%;
119
+ right: 0;
120
+ transform: translateX(0) translateY(-50%);
121
+ }
122
+ .react-grid-item .react-resizable-handle-e::after {
123
+ top: 4px;
124
+ right: -3px;
125
+ border: 6px solid transparent;
126
+ border-left-color: rgba(0, 0, 0, 0.4);
127
+ }
128
+
129
+ .react-grid-item .react-resizable-handle-n {
130
+ cursor: n-resize;
131
+ top: 0;
132
+ left: 50%;
133
+ transform: translateX(-50%) translateY(0);
134
+ }
135
+ .react-grid-item .react-resizable-handle-n::after {
136
+ top: -3px;
137
+ left: 4px;
138
+ border: 6px solid transparent;
139
+ border-bottom-color: rgba(0, 0, 0, 0.4);
140
+ }
141
+
142
+ .react-grid-item .react-resizable-handle-sw {
143
+ cursor: sw-resize;
144
+ bottom: 0;
145
+ left: 0;
146
+ }
147
+ .react-grid-item .react-resizable-handle-sw::after {
148
+ bottom: 3px;
149
+ left: 3px;
150
+ border-left-color: rgba(0, 0, 0, 0.4);
151
+ border-bottom-color: rgba(0, 0, 0, 0.4);
152
+ }
153
+
154
+ .react-grid-item .react-resizable-handle-nw {
155
+ cursor: nw-resize;
156
+ top: 0;
157
+ left: 0;
158
+ }
159
+ .react-grid-item .react-resizable-handle-nw::after {
160
+ top: 3px;
161
+ left: 3px;
162
+ border-left-color: rgba(0, 0, 0, 0.4);
163
+ border-top-color: rgba(0, 0, 0, 0.4);
164
+ }
165
+
166
+ .react-grid-item .react-resizable-handle-se {
167
+ cursor: se-resize;
168
+ bottom: 0;
169
+ right: 0;
170
+ }
171
+ .react-grid-item .react-resizable-handle-se::after {
172
+ bottom: 3px;
173
+ right: 3px;
93
174
  border-right-color: rgba(0, 0, 0, 0.4);
94
175
  border-bottom-color: rgba(0, 0, 0, 0.4);
176
+ }
177
+
178
+ .react-grid-item .react-resizable-handle-ne {
179
+ cursor: ne-resize;
180
+ top: 0;
181
+ right: 0;
182
+ }
183
+ .react-grid-item .react-resizable-handle-ne::after {
184
+ top: 3px;
185
+ right: 3px;
186
+ border-right-color: rgba(0, 0, 0, 0.4);
187
+ border-top-color: rgba(0, 0, 0, 0.4);
95
188
  }
@@ -11,6 +11,11 @@ export default class MobileLayout extends React.PureComponent<any, any, any> {
11
11
  adjustWidgetLayout: (index: any, { needSetDefault }: {
12
12
  needSetDefault: any;
13
13
  }) => void;
14
+ onMountChange: (isMounted: any) => void;
15
+ _inited: boolean | undefined;
16
+ onBeforeLoad: () => () => void;
17
+ _isAsyncItem: boolean | undefined;
18
+ onLoad: () => void;
14
19
  render(): JSX.Element;
15
20
  }
16
21
  import React from 'react';
@@ -25,6 +25,33 @@ class MobileLayout extends React.PureComponent {
25
25
  });
26
26
  }
27
27
  };
28
+ this.onMountChange = (isMounted) => {
29
+ var _a, _b, _c, _d, _e, _f;
30
+ if (isMounted) {
31
+ this._inited = true;
32
+ (_b = (_a = this.context).onItemMountChange) === null || _b === void 0 ? void 0 : _b.call(_a, this.props.item, {
33
+ isAsync: this._isAsyncItem,
34
+ isMounted: isMounted,
35
+ });
36
+ if (!this._isAsyncItem) {
37
+ (_d = (_c = this.context).onItemRender) === null || _d === void 0 ? void 0 : _d.call(_c, this.props.item);
38
+ }
39
+ }
40
+ else {
41
+ (_f = (_e = this.context).onItemMountChange) === null || _f === void 0 ? void 0 : _f.call(_e, this.props.item, {
42
+ isAsync: this._isAsyncItem,
43
+ isMounted: isMounted,
44
+ });
45
+ }
46
+ };
47
+ this.onBeforeLoad = () => {
48
+ this._isAsyncItem = true;
49
+ return this.onLoad;
50
+ };
51
+ this.onLoad = () => {
52
+ var _a, _b;
53
+ (_b = (_a = this.context).onItemRender) === null || _b === void 0 ? void 0 : _b.call(_a, this.props.item);
54
+ };
28
55
  }
29
56
  componentDidUpdate(prevProps, prevState) {
30
57
  if (prevState.activeTabId !== this.context.config.id) {
@@ -44,7 +71,7 @@ class MobileLayout extends React.PureComponent {
44
71
  return (React.createElement("div", { className: b('item', { autoheight: isItemWithActiveAutoheight }), key: item.id },
45
72
  React.createElement(Item, { id: item.id, item: item, layout: layout, shouldItemUpdate: false, adjustWidgetLayout: this.adjustWidgetLayout.bind(this, index), forwardedPluginRef: (pluginRef) => {
46
73
  this.pluginsRefs[index] = pluginRef;
47
- } })));
74
+ }, onMountChange: this.onMountChange, onBeforeLoad: this.onBeforeLoad })));
48
75
  })));
49
76
  }
50
77
  }
@@ -9,10 +9,9 @@ export interface AddConfigItem extends Omit<ConfigItem, 'id' | 'namespace'> {
9
9
  export type SetConfigItem = ConfigItem | AddConfigItem;
10
10
  export type SetItemOptions = {
11
11
  excludeIds?: string[];
12
- };
13
- export type SetNewItemOptions = SetItemOptions & {
14
12
  updateLayout?: ConfigLayout[];
15
13
  };
14
+ export type SetNewItemOptions = SetItemOptions;
16
15
  export interface DashkitGroupRenderProps {
17
16
  config: Config;
18
17
  editMode: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "8.10.1",
3
+ "version": "8.11.0",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {