@pdg/react-admin-layout 1.0.3 → 1.0.4

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.
@@ -1,7 +1,9 @@
1
- import React, { ReactNode } from 'react';
1
+ import React from 'react';
2
2
  export interface TitleProps {
3
- title: ReactNode;
4
- headTitle?: ReactNode;
3
+ title: string;
4
+ icon?: string;
5
+ headTitle?: string;
6
+ headIcon?: string;
5
7
  }
6
8
  declare const Title: React.FC<TitleProps>;
7
9
  export default Title;
package/dist/index.esm.js CHANGED
@@ -7457,10 +7457,16 @@ styleInject(css_248z);var SideMenu = function (_a) {
7457
7457
  React.createElement(Toolbar, null, logo)),
7458
7458
  list && React.createElement(SideMenuList, { list: list, onClick: onClick })));
7459
7459
  };var Title = function (_a) {
7460
- var title = _a.title, headTitle = _a.headTitle;
7460
+ var title = _a.title, icon = _a.icon, headTitle = _a.headTitle, headIcon = _a.headIcon;
7461
7461
  return (React.createElement(Box, { style: { position: 'relative' } },
7462
- headTitle && (React.createElement(Typography, { style: { marginBottom: -4, opacity: 0.5 }, sx: { fontSize: 11, display: { xs: 'none', sm: 'block' } } }, headTitle)),
7463
- title));
7462
+ headTitle && (React.createElement(Box, { sx: { display: { xs: 'none', sm: 'flex' }, alignItems: 'center', opacity: 0.5 } },
7463
+ headIcon && (React.createElement(Box, { style: { marginRight: 4, lineHeight: 0 } },
7464
+ React.createElement(Icon, { fontSize: 'small', style: { fontSize: 15 } }, headIcon.replace(/[A-Z]/g, function (letter, idx) { return "".concat(idx > 0 ? '_' : '').concat(letter.toLowerCase()); })))),
7465
+ React.createElement(Typography, { style: { fontSize: 11 } }, headTitle))),
7466
+ React.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
7467
+ icon && (React.createElement("div", { style: { flexShrink: 0, display: 'inline-flex', marginRight: 5 } },
7468
+ React.createElement(Icon, { fontSize: 'small' }, icon.replace(/[A-Z]/g, function (letter, idx) { return "".concat(idx > 0 ? '_' : '').concat(letter.toLowerCase()); })))),
7469
+ React.createElement("div", null, title))));
7464
7470
  };var sideMenuWidth = 220;
7465
7471
  var DefaultLayout = function (_a) {
7466
7472
  var children = _a.children, logo = _a.logo, menu = _a.menu, appBarControl = _a.appBarControl, onMenuClick = _a.onMenuClick;
@@ -7488,13 +7494,7 @@ var DefaultLayout = function (_a) {
7488
7494
  if (menuTitles) {
7489
7495
  var titleData = menuTitles[location.pathname];
7490
7496
  if (titleData) {
7491
- setTitle(React.createElement(Title, { title: React.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
7492
- titleData.icon && (React.createElement("div", { style: { flexShrink: 0, display: 'inline-flex', verticalAlign: 'bottom', marginRight: 5 } },
7493
- React.createElement(Icon, { fontSize: 'small' }, titleData.icon.replace(/[A-Z]/g, function (letter, idx) { return "".concat(idx > 0 ? '_' : '').concat(letter.toLowerCase()); })))),
7494
- React.createElement("div", null, titleData.name)), headTitle: titleData.parentName ? (React.createElement("div", { style: { display: 'flex', alignItems: 'center', marginBottom: 3 } },
7495
- titleData.parentIcon && (React.createElement("div", { style: { flexShrink: 0, display: 'inline-flex', verticalAlign: 'bottom', marginRight: 3 } },
7496
- React.createElement(Icon, { fontSize: 'small' }, titleData.parentIcon.replace(/[A-Z]/g, function (letter, idx) { return "".concat(idx > 0 ? '_' : '').concat(letter.toLowerCase()); })))),
7497
- React.createElement("div", null, titleData.parentName))) : null }));
7497
+ setTitle(React.createElement(Title, { title: titleData.name, icon: titleData.icon, headTitle: titleData.parentName, headIcon: titleData.parentIcon }));
7498
7498
  }
7499
7499
  else {
7500
7500
  setTitle(undefined);