@gravity-ui/dashkit 8.24.0 → 8.24.2
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/build/cjs/plugins/Title/Title.d.ts +3 -1
- package/build/cjs/plugins/Title/Title.js +18 -15
- package/build/cjs/plugins/Title/constants.d.ts +1 -1
- package/build/cjs/plugins/Title/constants.js +1 -1
- package/build/esm/plugins/Title/Title.d.ts +3 -1
- package/build/esm/plugins/Title/Title.js +16 -14
- package/build/esm/plugins/Title/constants.d.ts +1 -1
- package/build/esm/plugins/Title/constants.js +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,8 @@ export interface PluginTitleProps extends PluginWidgetProps {
|
|
|
8
8
|
showInTOC: boolean;
|
|
9
9
|
} & PluginWidgetProps['data'];
|
|
10
10
|
}
|
|
11
|
-
export declare
|
|
11
|
+
export declare class PluginTitle extends React.Component<PluginTitleProps> {
|
|
12
|
+
render(): JSX.Element;
|
|
13
|
+
}
|
|
12
14
|
declare const plugin: Plugin<PluginTitleProps>;
|
|
13
15
|
export default plugin;
|
|
@@ -8,25 +8,28 @@ const constants_1 = require("../constants");
|
|
|
8
8
|
const constants_2 = require("./constants");
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
10
|
const b = (0, cn_1.cn)('dashkit-plugin-title');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
?
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
11
|
+
class PluginTitle extends react_1.default.Component {
|
|
12
|
+
render() {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const { data } = this.props;
|
|
15
|
+
const text = data.text ? data.text : '';
|
|
16
|
+
const size = (0, utils_1.isCustomSize)(data.size) ? false : data.size;
|
|
17
|
+
const styles = (0, utils_1.isCustomSize)(data.size) && ((_a = data.size) === null || _a === void 0 ? void 0 : _a.fontSize)
|
|
18
|
+
? {
|
|
19
|
+
fontSize: data.size.fontSize,
|
|
20
|
+
lineHeight: (_b = data.size.lineHeight) !== null && _b !== void 0 ? _b : constants_2.RECCOMMENDED_LINE_HEIGHT_MULTIPLIER,
|
|
21
|
+
}
|
|
22
|
+
: undefined;
|
|
23
|
+
const id = data.showInTOC && text ? encodeURIComponent(text) : undefined;
|
|
24
|
+
return (react_1.default.createElement("div", { id: id, style: styles, className: b({ size }), [constants_1.PLUGIN_ROOT_ATTR_NAME]: 'title' }, text));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.PluginTitle = PluginTitle;
|
|
25
28
|
const plugin = {
|
|
26
29
|
type: 'title',
|
|
27
30
|
defaultLayout: { w: 36, h: 2 },
|
|
28
31
|
renderer(props, forwardedRef) {
|
|
29
|
-
return react_1.default.createElement(
|
|
32
|
+
return react_1.default.createElement(PluginTitle, Object.assign({}, props, { ref: forwardedRef }));
|
|
30
33
|
},
|
|
31
34
|
};
|
|
32
35
|
exports.default = plugin;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PluginTitleSize, TitleFontParams } from './types';
|
|
2
2
|
export declare const TITLE_DEFAULT_SIZES: Record<PluginTitleSize, TitleFontParams>;
|
|
3
|
-
export declare const RECCOMMENDED_LINE_HEIGHT_MULTIPLIER = 1.
|
|
3
|
+
export declare const RECCOMMENDED_LINE_HEIGHT_MULTIPLIER = 1.1;
|
|
@@ -9,6 +9,8 @@ export interface PluginTitleProps extends PluginWidgetProps {
|
|
|
9
9
|
showInTOC: boolean;
|
|
10
10
|
} & PluginWidgetProps['data'];
|
|
11
11
|
}
|
|
12
|
-
export declare
|
|
12
|
+
export declare class PluginTitle extends React.Component<PluginTitleProps> {
|
|
13
|
+
render(): JSX.Element;
|
|
14
|
+
}
|
|
13
15
|
declare const plugin: Plugin<PluginTitleProps>;
|
|
14
16
|
export default plugin;
|
|
@@ -5,20 +5,22 @@ import { RECCOMMENDED_LINE_HEIGHT_MULTIPLIER } from './constants';
|
|
|
5
5
|
import { isCustomSize } from './utils';
|
|
6
6
|
import './Title.css';
|
|
7
7
|
const b = cn('dashkit-plugin-title');
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
?
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
8
|
+
export class PluginTitle extends React.Component {
|
|
9
|
+
render() {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const { data } = this.props;
|
|
12
|
+
const text = data.text ? data.text : '';
|
|
13
|
+
const size = isCustomSize(data.size) ? false : data.size;
|
|
14
|
+
const styles = isCustomSize(data.size) && ((_a = data.size) === null || _a === void 0 ? void 0 : _a.fontSize)
|
|
15
|
+
? {
|
|
16
|
+
fontSize: data.size.fontSize,
|
|
17
|
+
lineHeight: (_b = data.size.lineHeight) !== null && _b !== void 0 ? _b : RECCOMMENDED_LINE_HEIGHT_MULTIPLIER,
|
|
18
|
+
}
|
|
19
|
+
: undefined;
|
|
20
|
+
const id = data.showInTOC && text ? encodeURIComponent(text) : undefined;
|
|
21
|
+
return (React.createElement("div", { id: id, style: styles, className: b({ size }), [PLUGIN_ROOT_ATTR_NAME]: 'title' }, text));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
22
24
|
const plugin = {
|
|
23
25
|
type: 'title',
|
|
24
26
|
defaultLayout: { w: 36, h: 2 },
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PluginTitleSize, TitleFontParams } from './types';
|
|
2
2
|
export declare const TITLE_DEFAULT_SIZES: Record<PluginTitleSize, TitleFontParams>;
|
|
3
|
-
export declare const RECCOMMENDED_LINE_HEIGHT_MULTIPLIER = 1.
|
|
3
|
+
export declare const RECCOMMENDED_LINE_HEIGHT_MULTIPLIER = 1.1;
|