@gravity-ui/dashkit 6.9.0 → 7.1.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.
- package/README.md +21 -35
- package/build/cjs/components/DashKit/DashKit.d.ts +2 -2
- package/build/cjs/components/DashKit/DashKit.js +1 -1
- package/build/cjs/components/DashKitView/DashKitView.js +2 -2
- package/build/cjs/components/GridItem/GridItem.css +2 -8
- package/build/cjs/components/GridItem/GridItem.d.ts +1 -1
- package/build/cjs/components/GridItem/GridItem.js +1 -1
- package/build/cjs/components/GridLayout/GridLayout.d.ts +1 -1
- package/build/cjs/components/GridLayout/GridLayout.js +3 -3
- package/build/cjs/components/Item/Item.css +2 -8
- package/build/cjs/components/Item/Item.d.ts +1 -0
- package/build/cjs/components/MobileLayout/MobileLayout.d.ts +1 -1
- package/build/cjs/components/MobileLayout/MobileLayout.js +2 -2
- package/build/cjs/components/OverlayControls/OverlayControls.d.ts +2 -2
- package/build/cjs/components/OverlayControls/OverlayControls.js +14 -13
- package/build/cjs/context/DashKitContext.d.ts +1 -1
- package/build/cjs/hocs/prepareItem.d.ts +1 -0
- package/build/cjs/hocs/prepareItem.js +1 -1
- package/build/cjs/hocs/withContext.js +2 -2
- package/build/cjs/i18n/index.d.ts +1 -4
- package/build/cjs/i18n/index.js +2 -13
- package/build/cjs/plugins/Text/Text.d.ts +1 -1
- package/build/cjs/plugins/Text/Text.js +3 -3
- package/build/cjs/plugins/Title/Title.d.ts +1 -1
- package/build/cjs/shared/modules/helpers.js +1 -1
- package/build/cjs/shared/units/datalens/index.d.ts +1 -1
- package/build/cjs/shared/units/datalens/index.js +1 -1
- package/build/cjs/typings/common.d.ts +1 -1
- package/build/cjs/typings/plugin.d.ts +2 -2
- package/build/cjs/utils/index.d.ts +0 -1
- package/build/cjs/utils/index.js +0 -1
- package/build/cjs/utils/register-manager.d.ts +1 -1
- package/build/cjs/utils/update-manager.js +4 -2
- package/build/esm/components/DashKit/DashKit.d.ts +2 -2
- package/build/esm/components/DashKit/DashKit.js +1 -1
- package/build/esm/components/DashKitView/DashKitView.js +2 -2
- package/build/esm/components/GridItem/GridItem.css +2 -8
- package/build/esm/components/GridItem/GridItem.d.ts +1 -1
- package/build/esm/components/GridItem/GridItem.js +2 -2
- package/build/esm/components/GridLayout/GridLayout.d.ts +1 -1
- package/build/esm/components/GridLayout/GridLayout.js +4 -3
- package/build/esm/components/Item/Item.css +2 -8
- package/build/esm/components/Item/Item.d.ts +1 -0
- package/build/esm/components/MobileLayout/MobileLayout.d.ts +1 -1
- package/build/esm/components/MobileLayout/MobileLayout.js +3 -2
- package/build/esm/components/OverlayControls/OverlayControls.d.ts +2 -2
- package/build/esm/components/OverlayControls/OverlayControls.js +6 -5
- package/build/esm/context/DashKitContext.d.ts +1 -1
- package/build/esm/hocs/prepareItem.d.ts +1 -0
- package/build/esm/hocs/prepareItem.js +1 -1
- package/build/esm/hocs/withContext.js +2 -2
- package/build/esm/i18n/index.d.ts +1 -4
- package/build/esm/i18n/index.js +2 -13
- package/build/esm/plugins/Text/Text.d.ts +1 -1
- package/build/esm/plugins/Text/Text.js +2 -2
- package/build/esm/plugins/Title/Title.d.ts +1 -1
- package/build/esm/shared/modules/__tests__/uniq-id.test.js +1 -1
- package/build/esm/shared/modules/helpers.js +1 -1
- package/build/esm/shared/units/datalens/index.d.ts +1 -1
- package/build/esm/shared/units/datalens/index.js +1 -1
- package/build/esm/typings/common.d.ts +1 -1
- package/build/esm/typings/plugin.d.ts +2 -2
- package/build/esm/utils/index.d.ts +0 -1
- package/build/esm/utils/index.js +0 -1
- package/build/esm/utils/register-manager.d.ts +1 -1
- package/build/esm/utils/update-manager.js +4 -2
- package/package.json +23 -18
- package/build/cjs/utils/configure.d.ts +0 -9
- package/build/cjs/utils/configure.js +0 -21
- package/build/cjs/utils/i18n.d.ts +0 -7
- package/build/cjs/utils/i18n.js +0 -13
- package/build/esm/utils/configure.d.ts +0 -9
- package/build/esm/utils/configure.js +0 -15
- package/build/esm/utils/i18n.d.ts +0 -7
- package/build/esm/utils/i18n.js +0 -9
package/README.md
CHANGED
|
@@ -57,24 +57,12 @@ interface DashKitProps {
|
|
|
57
57
|
|
|
58
58
|
Before using `DashKit` as a react component, it must be configured.
|
|
59
59
|
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
Used for setting the language of DashKit provided ui elements. Currently the languages supported are: ru, en.
|
|
60
|
+
- set language
|
|
63
61
|
|
|
64
62
|
```js
|
|
65
|
-
import {
|
|
66
|
-
|
|
67
|
-
setLang('en');
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**From version 3.0.0 the language must be set separately for each DashKit and Gravity-ui instances**
|
|
63
|
+
import {configure, Lang} from '@gravity-ui/uikit';
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
import {setLang} from '@gravity-ui/dashkit';
|
|
74
|
-
import {configure as uiKitConfigure, Lang as UILang} from '@gravity-ui/uikit';
|
|
75
|
-
|
|
76
|
-
setLang('en');
|
|
77
|
-
uiKitConfigure({lang: lang as UILang});
|
|
65
|
+
configure({lang: Lang.En});
|
|
78
66
|
```
|
|
79
67
|
|
|
80
68
|
- DashKit.setSettings
|
|
@@ -97,7 +85,7 @@ Before using `DashKit` as a react component, it must be configured.
|
|
|
97
85
|
|
|
98
86
|
```js
|
|
99
87
|
import {DashKit} from '@gravity-ui/dashkit';
|
|
100
|
-
import {pluginTitle, pluginText}
|
|
88
|
+
import {pluginTitle, pluginText} from '@gravity-ui/dashkit';
|
|
101
89
|
|
|
102
90
|
DashKit.registerPlugins(
|
|
103
91
|
pluginTitle,
|
|
@@ -328,7 +316,7 @@ DashKit.setSettings({menu: [] as Array<MenuItem>});
|
|
|
328
316
|
### CSS API
|
|
329
317
|
|
|
330
318
|
| Name | Description |
|
|
331
|
-
|
|
319
|
+
| :--------------------------------------------- | :-------------------- |
|
|
332
320
|
| Action panel variables | |
|
|
333
321
|
| `--dashkit-action-panel-color` | Background color |
|
|
334
322
|
| `--dashkit-action-panel-border-color` | Border color |
|
|
@@ -351,17 +339,16 @@ DashKit.setSettings({menu: [] as Array<MenuItem>});
|
|
|
351
339
|
|
|
352
340
|
#### Usage example
|
|
353
341
|
|
|
354
|
-
|
|
355
342
|
```css
|
|
356
343
|
.custom-theme-wrapper {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
344
|
+
--dashkit-grid-item-edit-opacit: 1;
|
|
345
|
+
--dashkit-overlay-color: var(--g-color-base-float);
|
|
346
|
+
--dashkit-overlay-border-color: var(--g-color-base-float);
|
|
347
|
+
--dashkit-overlay-opacity: 0.5;
|
|
348
|
+
|
|
349
|
+
--dashkit-action-panel-border-color: var(--g-color-line-info);
|
|
350
|
+
--dashkit-action-panel-color: var(--g-color-base-float-accent);
|
|
351
|
+
--dashkit-action-panel-border-radius: var(--g-border-radius-xxl);
|
|
365
352
|
}
|
|
366
353
|
```
|
|
367
354
|
|
|
@@ -369,19 +356,18 @@ DashKit.setSettings({menu: [] as Array<MenuItem>});
|
|
|
369
356
|
// ....
|
|
370
357
|
|
|
371
358
|
const CustomThemeWrapper = (props: {
|
|
372
|
-
|
|
373
|
-
|
|
359
|
+
dashkitProps: DashkitProps;
|
|
360
|
+
actionPanelProps: ActionPanelProps;
|
|
374
361
|
}) => {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
362
|
+
return (
|
|
363
|
+
<div className="custom-theme-wrapper">
|
|
364
|
+
<Dashkit {...props.dashkitProps} />
|
|
365
|
+
<ActionPanel {...props.actionPanelProps} />
|
|
366
|
+
</div>
|
|
367
|
+
);
|
|
381
368
|
};
|
|
382
369
|
```
|
|
383
370
|
|
|
384
|
-
|
|
385
371
|
## Development
|
|
386
372
|
|
|
387
373
|
### Build & watch
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Config, ConfigItem, GlobalParams, ItemsStateAndParams } from '../../shared';
|
|
3
|
+
import { ContextProps, Plugin, SetConfigItem, SetItemOptions, Settings, SettingsProps } from '../../typings';
|
|
2
4
|
import GridLayout from '../GridLayout/GridLayout';
|
|
3
|
-
import { SetConfigItem, Settings, SettingsProps, ContextProps, Plugin, SetItemOptions } from '../../typings';
|
|
4
|
-
import { GlobalParams, Config, ConfigItem, ItemsStateAndParams } from '../../shared';
|
|
5
5
|
import { OverlayControlItem } from '../OverlayControls/OverlayControls';
|
|
6
6
|
interface DashKitGeneralProps {
|
|
7
7
|
config: Config;
|
|
@@ -4,9 +4,9 @@ exports.DashKit = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
7
8
|
const utils_1 = require("../../utils");
|
|
8
9
|
const DashKitView_1 = tslib_1.__importDefault(require("../DashKitView/DashKitView"));
|
|
9
|
-
const constants_1 = require("../../constants");
|
|
10
10
|
const registerManager = new utils_1.RegisterManager();
|
|
11
11
|
class DashKit extends react_1.default.PureComponent {
|
|
12
12
|
constructor() {
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const DashKitContext_1 = require("../../context/DashKitContext");
|
|
6
|
-
const GridLayout_1 = tslib_1.__importDefault(require("../GridLayout/GridLayout"));
|
|
7
|
-
const MobileLayout_1 = tslib_1.__importDefault(require("../MobileLayout/MobileLayout"));
|
|
8
6
|
const withContext_1 = require("../../hocs/withContext");
|
|
9
7
|
const useCalcLayout_1 = require("../../hooks/useCalcLayout");
|
|
10
8
|
const cn_1 = require("../../utils/cn");
|
|
9
|
+
const GridLayout_1 = tslib_1.__importDefault(require("../GridLayout/GridLayout"));
|
|
10
|
+
const MobileLayout_1 = tslib_1.__importDefault(require("../MobileLayout/MobileLayout"));
|
|
11
11
|
const b = (0, cn_1.cn)('dashkit');
|
|
12
12
|
function DashKitView(props) {
|
|
13
13
|
const context = react_1.default.useContext(DashKitContext_1.DashKitContext);
|
|
@@ -10,10 +10,7 @@
|
|
|
10
10
|
3px
|
|
11
11
|
);
|
|
12
12
|
position: absolute;
|
|
13
|
-
|
|
14
|
-
bottom: 0;
|
|
15
|
-
left: 0;
|
|
16
|
-
right: 0;
|
|
13
|
+
inset: 0;
|
|
17
14
|
border-radius: var(--_-dashkit-overlay-border-radius);
|
|
18
15
|
background-color: var(--_-dashkit-overlay-color);
|
|
19
16
|
border: solid 1px var(--_-dashkit-overlay-border-color);
|
|
@@ -26,10 +23,7 @@
|
|
|
26
23
|
);
|
|
27
24
|
--_-dashkit-grid-item-edit-opacity: var(--dashkit-grid-item-edit-opacity, 0.5);
|
|
28
25
|
position: absolute;
|
|
29
|
-
|
|
30
|
-
bottom: 0;
|
|
31
|
-
left: 0;
|
|
32
|
-
right: 0;
|
|
26
|
+
inset: 0;
|
|
33
27
|
border-radius: var(--_-dashkit-grid-item-border-radius);
|
|
34
28
|
}
|
|
35
29
|
.dashkit-grid-item__item_editMode {
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const prop_types_1 = tslib_1.__importDefault(require("prop-types"));
|
|
6
|
-
const Item_1 = tslib_1.__importDefault(require("../Item/Item"));
|
|
7
6
|
const DashKitContext_1 = require("../../context/DashKitContext");
|
|
8
7
|
const cn_1 = require("../../utils/cn");
|
|
8
|
+
const Item_1 = tslib_1.__importDefault(require("../Item/Item"));
|
|
9
9
|
const OverlayControls_1 = tslib_1.__importDefault(require("../OverlayControls/OverlayControls"));
|
|
10
10
|
const b = (0, cn_1.cn)('dashkit-grid-item');
|
|
11
11
|
class GridItem extends react_1.default.PureComponent {
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const react_grid_layout_1 = tslib_1.__importStar(require("react-grid-layout"));
|
|
6
|
-
const GridItem_1 = tslib_1.__importDefault(require("../GridItem/GridItem"));
|
|
7
|
-
const DashKitContext_1 = require("../../context/DashKitContext");
|
|
8
6
|
const constants_1 = require("../../constants");
|
|
7
|
+
const DashKitContext_1 = require("../../context/DashKitContext");
|
|
8
|
+
const GridItem_1 = tslib_1.__importDefault(require("../GridItem/GridItem"));
|
|
9
9
|
const Layout = (0, react_grid_layout_1.WidthProvider)(react_grid_layout_1.default); // eslint-disable-line new-cap
|
|
10
10
|
class GridLayout extends react_1.default.PureComponent {
|
|
11
11
|
constructor(props, context) {
|
|
@@ -83,5 +83,5 @@ class GridLayout extends react_1.default.PureComponent {
|
|
|
83
83
|
})));
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
exports.default = GridLayout;
|
|
87
86
|
GridLayout.contextType = DashKitContext_1.DashKitContext;
|
|
87
|
+
exports.default = GridLayout;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
.dashkit-item__renderer {
|
|
2
2
|
position: absolute;
|
|
3
|
-
|
|
4
|
-
bottom: 0;
|
|
5
|
-
left: 0;
|
|
6
|
-
right: 0;
|
|
3
|
+
inset: 0;
|
|
7
4
|
}
|
|
8
5
|
.dashkit-item__loader {
|
|
9
6
|
position: absolute;
|
|
10
|
-
|
|
11
|
-
bottom: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
right: 0;
|
|
7
|
+
inset: 0;
|
|
14
8
|
display: flex;
|
|
15
9
|
align-items: center;
|
|
16
10
|
justify-content: center;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
-
const Item_1 = tslib_1.__importDefault(require("../Item/Item"));
|
|
6
5
|
const DashKitContext_1 = require("../../context/DashKitContext");
|
|
7
6
|
const cn_1 = require("../../utils/cn");
|
|
7
|
+
const Item_1 = tslib_1.__importDefault(require("../Item/Item"));
|
|
8
8
|
const helpers_1 = require("./helpers");
|
|
9
9
|
const b = (0, cn_1.cn)('dashkit-mobile-layout');
|
|
10
10
|
class MobileLayout extends react_1.default.PureComponent {
|
|
@@ -50,5 +50,5 @@ class MobileLayout extends react_1.default.PureComponent {
|
|
|
50
50
|
})));
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
exports.default = MobileLayout;
|
|
54
53
|
MobileLayout.contextType = DashKitContext_1.DashKitContext;
|
|
54
|
+
exports.default = MobileLayout;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ButtonSize, ButtonView, IconProps, MenuItemProps } from '@gravity-ui/uikit';
|
|
3
|
+
import { Config, ConfigItem, ItemState, PluginBase, StringParams } from '../../shared';
|
|
4
4
|
import type { RegisterManager } from '../../utils/register-manager';
|
|
5
5
|
export declare enum OverlayControlsPosition {
|
|
6
6
|
TopRight = "top_right",
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OverlayControlsPosition = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const i18n_1 = tslib_1.__importDefault(require("../../i18n"));
|
|
7
|
-
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
8
|
-
const DashKitContext_1 = require("../../context/DashKitContext");
|
|
9
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
+
const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
10
8
|
const constants_1 = require("../../constants");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
9
|
+
const DashKitContext_1 = require("../../context/DashKitContext");
|
|
10
|
+
const i18n_1 = require("../../i18n");
|
|
13
11
|
const CloseIcon_1 = require("../../icons/CloseIcon");
|
|
12
|
+
const CogIcon_1 = require("../../icons/CogIcon");
|
|
13
|
+
const DotsIcon_1 = require("../../icons/DotsIcon");
|
|
14
14
|
const cn_1 = require("../../utils/cn");
|
|
15
15
|
const b = (0, cn_1.cn)(constants_1.OVERLAY_CONTROLS_CLASS_NAME);
|
|
16
16
|
var OverlayControlsPosition;
|
|
@@ -19,7 +19,7 @@ var OverlayControlsPosition;
|
|
|
19
19
|
OverlayControlsPosition["TopLeft"] = "top_left";
|
|
20
20
|
OverlayControlsPosition["BottomRight"] = "bottom_right";
|
|
21
21
|
OverlayControlsPosition["BottomLeft"] = "bottom_left";
|
|
22
|
-
})(OverlayControlsPosition
|
|
22
|
+
})(OverlayControlsPosition || (exports.OverlayControlsPosition = OverlayControlsPosition = {}));
|
|
23
23
|
const DEFAULT_DROPDOWN_MENU = [constants_1.MenuItems.Copy, constants_1.MenuItems.Delete];
|
|
24
24
|
class OverlayControls extends react_1.default.Component {
|
|
25
25
|
constructor() {
|
|
@@ -99,13 +99,13 @@ class OverlayControls extends react_1.default.Component {
|
|
|
99
99
|
case constants_1.MenuItems.Copy: {
|
|
100
100
|
return {
|
|
101
101
|
action: this.onCopyItem,
|
|
102
|
-
text: (0, i18n_1.
|
|
102
|
+
text: (0, i18n_1.i18n)('label_copy'),
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
case constants_1.MenuItems.Delete: {
|
|
106
106
|
return {
|
|
107
107
|
action: this.onRemoveItem,
|
|
108
|
-
text: (0, i18n_1.
|
|
108
|
+
text: (0, i18n_1.i18n)('label_delete'),
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
case constants_1.MenuItems.Settings: {
|
|
@@ -115,7 +115,7 @@ class OverlayControls extends react_1.default.Component {
|
|
|
115
115
|
}
|
|
116
116
|
return {
|
|
117
117
|
action: this.onEditItem,
|
|
118
|
-
text: (0, i18n_1.
|
|
118
|
+
text: (0, i18n_1.i18n)('label_settings'),
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -125,7 +125,7 @@ class OverlayControls extends react_1.default.Component {
|
|
|
125
125
|
const { view, size } = this.props;
|
|
126
126
|
const customLeftControls = this.getCustomLeftOverlayControls();
|
|
127
127
|
const hasCustomOverlayLeftControls = Boolean(customLeftControls.length);
|
|
128
|
-
const defaultControl = (react_1.default.createElement(uikit_1.Button, { view: view, size: size, title: (0, i18n_1.
|
|
128
|
+
const defaultControl = (react_1.default.createElement(uikit_1.Button, { view: view, size: size, title: (0, i18n_1.i18n)('label_settings'), pin: "round-brick", onClick: this.onEditItem, qa: "dashkit-overlay-control-settings" },
|
|
129
129
|
react_1.default.createElement(uikit_1.Icon, { data: CogIcon_1.CogIcon, size: "24" })));
|
|
130
130
|
const controls = hasCustomOverlayLeftControls
|
|
131
131
|
? customLeftControls.map((item, index, items) => this.renderControlsItem(item, index, items.length + 1))
|
|
@@ -141,7 +141,7 @@ class OverlayControls extends react_1.default.Component {
|
|
|
141
141
|
const { view, size } = this.props;
|
|
142
142
|
const { registerManager } = this.context;
|
|
143
143
|
const withMenu = Array.isArray(registerManager.settings.menu) && registerManager.settings.menu.length;
|
|
144
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, withMenu ? (this.renderDropdownMenu()) : (react_1.default.createElement(uikit_1.Button, { view: view, size: size, title: (0, i18n_1.
|
|
144
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, withMenu ? (this.renderDropdownMenu()) : (react_1.default.createElement(uikit_1.Button, { view: view, size: size, title: (0, i18n_1.i18n)('label_delete'), pin: "brick-round", onClick: this.onRemoveItem, qa: "dashkit-overlay-control-menu" },
|
|
145
145
|
react_1.default.createElement(uikit_1.Icon, { data: CloseIcon_1.CloseIcon, size: "12" })))));
|
|
146
146
|
}
|
|
147
147
|
isDefaultMenu(menu) {
|
|
@@ -174,7 +174,8 @@ class OverlayControls extends react_1.default.Component {
|
|
|
174
174
|
? () => itemHandler(configItem, itemParams, itemState)
|
|
175
175
|
: ((_a = this.getDropDownMenuItemConfig(item.id)) === null || _a === void 0 ? void 0 : _a.action) || (() => { });
|
|
176
176
|
return {
|
|
177
|
-
|
|
177
|
+
// @ts-expect-error
|
|
178
|
+
text: item.title || (0, i18n_1.i18n)(item.id),
|
|
178
179
|
icon: item.icon,
|
|
179
180
|
action: itemAction,
|
|
180
181
|
className: item.className,
|
|
@@ -203,7 +204,7 @@ class OverlayControls extends react_1.default.Component {
|
|
|
203
204
|
getCustomControlsWithWidgets() {
|
|
204
205
|
// Добавляем контрол удаления виджета по умолчанию
|
|
205
206
|
const deleteControl = {
|
|
206
|
-
title: (0, i18n_1.
|
|
207
|
+
title: (0, i18n_1.i18n)('label_delete'),
|
|
207
208
|
icon: CloseIcon_1.CloseIcon,
|
|
208
209
|
iconSize: 12,
|
|
209
210
|
handler: this.onRemoveItem,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const DashKitContext: React.Context<any>;
|
|
2
|
-
import React from
|
|
2
|
+
import React from 'react';
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.prepareItem = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const DashKitContext_1 = require("../context/DashKitContext");
|
|
7
6
|
const prop_types_1 = tslib_1.__importDefault(require("prop-types"));
|
|
7
|
+
const DashKitContext_1 = require("../context/DashKitContext");
|
|
8
8
|
function prepareItem(Component) {
|
|
9
9
|
var _a;
|
|
10
10
|
return _a = class PrepareItem extends react_1.default.Component {
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.withContext = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
|
|
6
7
|
const DashKitContext_1 = require("../context/DashKitContext");
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
8
|
const shared_1 = require("../shared");
|
|
9
|
-
const
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
10
|
function useMemoStateContext(props) {
|
|
11
11
|
// так как мы не хотим хранить параметры виджета с активированной автовысотой в сторе и на сервере, актуальный
|
|
12
12
|
// (видимый юзером в конкретный момент времени) лэйаут (массив объектов с данными о ширине, высоте,
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const i18n: I18N;
|
|
3
|
-
declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
4
|
-
export default _default;
|
|
1
|
+
export declare const i18n: (key: "button_retry" | "label_render-markdown-error" | "label_settings" | "label_copy" | "label_delete" | "label_error", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
package/build/cjs/i18n/index.js
CHANGED
|
@@ -2,18 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.i18n = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const i18n_1 = require("@gravity-ui/i18n");
|
|
6
|
-
const configure_1 = require("../utils/configure");
|
|
5
|
+
const i18n_1 = require("@gravity-ui/uikit/i18n");
|
|
7
6
|
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
8
7
|
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
9
|
-
exports.i18n =
|
|
10
|
-
const COMPONENT = 'dashkit';
|
|
11
|
-
exports.i18n.registerKeyset('en', COMPONENT, en_json_1.default);
|
|
12
|
-
exports.i18n.registerKeyset('ru', COMPONENT, ru_json_1.default);
|
|
13
|
-
exports.i18n.setLang((0, configure_1.getConfig)().lang || 'en');
|
|
14
|
-
(0, configure_1.subscribeConfigure)((config) => {
|
|
15
|
-
if (config.lang) {
|
|
16
|
-
exports.i18n.setLang(config.lang);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.default = exports.i18n.keyset(COMPONENT);
|
|
8
|
+
exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, 'dashkit');
|
|
@@ -4,7 +4,7 @@ exports.PluginText = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
-
const i18n_1 =
|
|
7
|
+
const i18n_1 = require("../../i18n");
|
|
8
8
|
const cn_1 = require("../../utils/cn");
|
|
9
9
|
// need to set markdown styles separately
|
|
10
10
|
// for instance can use yfm-transform
|
|
@@ -65,9 +65,9 @@ class PluginText extends react_1.default.PureComponent {
|
|
|
65
65
|
}
|
|
66
66
|
renderError() {
|
|
67
67
|
return (react_1.default.createElement("div", { className: b({ error: true }) },
|
|
68
|
-
react_1.default.createElement("div", { className: b('error') }, (0, i18n_1.
|
|
68
|
+
react_1.default.createElement("div", { className: b('error') }, (0, i18n_1.i18n)('label_render-markdown-error')),
|
|
69
69
|
react_1.default.createElement("br", null),
|
|
70
|
-
react_1.default.createElement(uikit_1.Button, { view: "action", size: "m", onClick: this.onRetryClick }, (0, i18n_1.
|
|
70
|
+
react_1.default.createElement(uikit_1.Button, { view: "action", size: "m", onClick: this.onRetryClick }, (0, i18n_1.i18n)('button_retry')),
|
|
71
71
|
react_1.default.createElement("br", null)));
|
|
72
72
|
}
|
|
73
73
|
renderText() {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hasActionParams = exports.hasActionParam = exports.transformParamsToActionParams = exports.pickExceptActionParamsFromParams = exports.pickActionParamsFromParams = exports.deleteFromQueue = exports.addGroupToQueue = exports.addToQueue = exports.getInitialItemsStateAndParamsMeta = exports.mergeParamsWithAliases = exports.getMapItemsIgnores = exports.resolveItemInnerId = exports.formQueueData = exports.isItemWithGroup = exports.isItemWithTabs = exports.getCurrentVersion = exports.getItemsStateAndParamsMeta = exports.prerenderItems = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const keyBy_1 = tslib_1.__importDefault(require("lodash/keyBy"));
|
|
6
5
|
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
7
6
|
const invert_1 = tslib_1.__importDefault(require("lodash/invert"));
|
|
8
7
|
const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
8
|
+
const keyBy_1 = tslib_1.__importDefault(require("lodash/keyBy"));
|
|
9
9
|
const pick_1 = tslib_1.__importDefault(require("lodash/pick"));
|
|
10
10
|
const constants_1 = require("../constants");
|
|
11
11
|
function getNormalizedPlugins(plugins) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetItemsParamsArg } from '../../modules';
|
|
2
|
-
import {
|
|
2
|
+
import { ItemsStateAndParamsBase, PluginBase } from '../../types';
|
|
3
3
|
export declare const pluginControlBaseDL: PluginBase;
|
|
4
4
|
export declare const pluginWidgetBaseDL: PluginBase;
|
|
5
5
|
export declare function getItemsStateAndParamsDL(data: Omit<GetItemsParamsArg, 'plugins'>): ItemsStateAndParamsBase;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getItemsStateAndParamsDL = exports.pluginWidgetBaseDL = exports.pluginControlBaseDL = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
6
|
-
const modules_1 = require("../../modules");
|
|
7
6
|
const constants_1 = require("../../constants");
|
|
7
|
+
const modules_1 = require("../../modules");
|
|
8
8
|
exports.pluginControlBaseDL = {
|
|
9
9
|
type: 'control',
|
|
10
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { ReactGridLayoutProps } from 'react-grid-layout';
|
|
1
2
|
import { OverlayCustomControlItem } from '../components/OverlayControls/OverlayControls';
|
|
2
3
|
import { MenuItems } from '../constants';
|
|
3
|
-
import type { ReactGridLayoutProps } from 'react-grid-layout';
|
|
4
4
|
export interface Settings {
|
|
5
5
|
gridLayout?: ReactGridLayoutProps;
|
|
6
6
|
theme?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ContextProps, SettingsProps, WidgetLayout } from './common';
|
|
3
|
-
import { ConfigItem, ItemState, ItemStateAndParams, ItemStateAndParamsChangeOptions, PluginBase, StringParams } from '../shared';
|
|
4
2
|
import type { ReactGridLayoutProps } from 'react-grid-layout';
|
|
3
|
+
import { ConfigItem, ItemState, ItemStateAndParams, ItemStateAndParamsChangeOptions, PluginBase, StringParams } from '../shared';
|
|
4
|
+
import { ContextProps, SettingsProps, WidgetLayout } from './common';
|
|
5
5
|
export interface PluginWidgetProps<T = StringParams> {
|
|
6
6
|
id: string;
|
|
7
7
|
editMode: boolean;
|
package/build/cjs/utils/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./i18n"), exports);
|
|
5
4
|
tslib_1.__exportStar(require("./register-manager"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./update-manager"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Plugin, PluginDefaultLayout, Settings } from '../typings';
|
|
2
1
|
import type { ReactGridLayoutProps } from 'react-grid-layout';
|
|
2
|
+
import { Plugin, PluginDefaultLayout, Settings } from '../typings';
|
|
3
3
|
interface RegisterManagerDefaultLayout {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
@@ -5,8 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const immutability_helper_1 = tslib_1.__importStar(require("immutability-helper"));
|
|
6
6
|
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
7
7
|
const pick_1 = tslib_1.__importDefault(require("lodash/pick"));
|
|
8
|
-
const shared_1 = require("../shared");
|
|
9
8
|
const constants_1 = require("../constants");
|
|
9
|
+
const shared_1 = require("../shared");
|
|
10
10
|
const get_new_id_1 = require("./get-new-id");
|
|
11
11
|
(0, immutability_helper_1.extend)('$auto', (value, object) => (object ? (0, immutability_helper_1.default)(object, value) : (0, immutability_helper_1.default)({}, value)));
|
|
12
12
|
function removeItemVersion1({ id, config, itemsStateAndParams }) {
|
|
@@ -34,7 +34,9 @@ function removeItemVersion1({ id, config, itemsStateAndParams }) {
|
|
|
34
34
|
const item = config.items.find((configItem) => configItem.id === key);
|
|
35
35
|
if (params && item) {
|
|
36
36
|
const { namespace } = item;
|
|
37
|
-
const currentUniqParamsKeys = namespace === removeItem.namespace
|
|
37
|
+
const currentUniqParamsKeys = namespace === removeItem.namespace
|
|
38
|
+
? uniqNamespaceParamsKeys
|
|
39
|
+
: uniqParamsKeys;
|
|
38
40
|
const resultParams = (0, omit_1.default)(params, currentUniqParamsKeys);
|
|
39
41
|
if (Object.keys(params).length !== Object.keys(resultParams).length) {
|
|
40
42
|
acc[key] = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Config, ConfigItem, GlobalParams, ItemsStateAndParams } from '../../shared';
|
|
3
|
+
import { ContextProps, Plugin, SetConfigItem, SetItemOptions, Settings, SettingsProps } from '../../typings';
|
|
2
4
|
import GridLayout from '../GridLayout/GridLayout';
|
|
3
|
-
import { SetConfigItem, Settings, SettingsProps, ContextProps, Plugin, SetItemOptions } from '../../typings';
|
|
4
|
-
import { GlobalParams, Config, ConfigItem, ItemsStateAndParams } from '../../shared';
|
|
5
5
|
import { OverlayControlItem } from '../OverlayControls/OverlayControls';
|
|
6
6
|
interface DashKitGeneralProps {
|
|
7
7
|
config: Config;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import noop from 'lodash/noop';
|
|
3
|
+
import { DEFAULT_NAMESPACE } from '../../constants';
|
|
3
4
|
import { RegisterManager, UpdateManager } from '../../utils';
|
|
4
5
|
import DashKitView from '../DashKitView/DashKitView';
|
|
5
|
-
import { DEFAULT_NAMESPACE } from '../../constants';
|
|
6
6
|
const registerManager = new RegisterManager();
|
|
7
7
|
export class DashKit extends React.PureComponent {
|
|
8
8
|
constructor() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DashKitContext } from '../../context/DashKitContext';
|
|
3
|
-
import GridLayout from '../GridLayout/GridLayout';
|
|
4
|
-
import MobileLayout from '../MobileLayout/MobileLayout';
|
|
5
3
|
import { withContext } from '../../hocs/withContext';
|
|
6
4
|
import { useCalcPropsLayout } from '../../hooks/useCalcLayout';
|
|
7
5
|
import { cn } from '../../utils/cn';
|
|
6
|
+
import GridLayout from '../GridLayout/GridLayout';
|
|
7
|
+
import MobileLayout from '../MobileLayout/MobileLayout';
|
|
8
8
|
import './DashKitView.css';
|
|
9
9
|
const b = cn('dashkit');
|
|
10
10
|
function DashKitView(props) {
|
|
@@ -10,10 +10,7 @@
|
|
|
10
10
|
3px
|
|
11
11
|
);
|
|
12
12
|
position: absolute;
|
|
13
|
-
|
|
14
|
-
bottom: 0;
|
|
15
|
-
left: 0;
|
|
16
|
-
right: 0;
|
|
13
|
+
inset: 0;
|
|
17
14
|
border-radius: var(--_-dashkit-overlay-border-radius);
|
|
18
15
|
background-color: var(--_-dashkit-overlay-color);
|
|
19
16
|
border: solid 1px var(--_-dashkit-overlay-border-color);
|
|
@@ -26,10 +23,7 @@
|
|
|
26
23
|
);
|
|
27
24
|
--_-dashkit-grid-item-edit-opacity: var(--dashkit-grid-item-edit-opacity, 0.5);
|
|
28
25
|
position: absolute;
|
|
29
|
-
|
|
30
|
-
bottom: 0;
|
|
31
|
-
left: 0;
|
|
32
|
-
right: 0;
|
|
26
|
+
inset: 0;
|
|
33
27
|
border-radius: var(--_-dashkit-grid-item-border-radius);
|
|
34
28
|
}
|
|
35
29
|
.dashkit-grid-item__item_editMode {
|