bee-menus
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -19,2 +19,6 @@ 'use strict'; | ||
var _domScrollIntoView = require('dom-scroll-into-view'); | ||
var _domScrollIntoView2 = _interopRequireDefault(_domScrollIntoView); | ||
var _classnames = require('classnames'); | ||
@@ -520,3 +524,3 @@ | ||
}, function () { | ||
scrollIntoView(ReactDOM.findDOMNode(activeItem), ReactDOM.findDOMNode(_this2), { | ||
(0, _domScrollIntoView2["default"])(ReactDOM.findDOMNode(activeItem), ReactDOM.findDOMNode(_this2), { | ||
onlyScrollIfNeeded: true | ||
@@ -523,0 +527,0 @@ }); |
@@ -0,3 +1,23 @@ | ||
<a name="1.0.8"></a> | ||
## [1.0.8](https://github.com/tinper-bee/menus/compare/v1.0.7...v1.0.8) (2018-11-13) | ||
<a name="1.0.7"></a> | ||
## [1.0.7](https://github.com/tinper-bee/menus/compare/v1.0.6...v1.0.7) (2018-08-16) | ||
<a name="1.0.6"></a> | ||
## [1.0.6](https://github.com/tinper-bee/menus/compare/v1.0.5...v1.0.6) (2018-08-16) | ||
### Bug Fixes | ||
* 修改示例 ([584ba2c](https://github.com/tinper-bee/menus/commit/584ba2c)) | ||
<a name="1.0.5"></a> | ||
## 1.0.5 (2018-01-05) | ||
## [1.0.5](https://github.com/tinper-bee/menus/compare/ea9c386...v1.0.5) (2018-01-05) | ||
@@ -4,0 +24,0 @@ |
@@ -13,3 +13,3 @@ import {Col, Row} from 'bee-layout'; | ||
var Demo1 = require("./demolist/Demo1");var Demo2 = require("./demolist/Demo2");var Demo3 = require("./demolist/Demo3");var Demo4 = require("./demolist/Demo4");var Demo5 = require("./demolist/Demo5");var DemoArray = [{"example":<Demo1 />,"title":" 横向Menu纯菜单导航","code":"/**\n * @title 横向Menu纯菜单导航\n * @description 更简洁,更方便\n */\n\nimport React, { Component } from 'react';\nimport { Menu } from 'tinper-bee';\n\nconst SubMenu = Menu.SubMenu;\nconst MenuItemGroup = Menu.ItemGroup;\n\n\nclass Demo1 extends Component {\n constructor(props, context) {\n super(props, context);\n this.state = {\n current: 'mail'\n }\n }\n\n handleClick = (e) => {\n this.setState({\n current: e.key,\n });\n }\n\n render() {\n return (\n <Menu onClick={this.handleClick}\n selectedKeys={[this.state.current]}\n mode=\"horizontal\"\n >\n <Menu.Item key=\"mail\" attribute={{'type': 'mail'}}>\n 组织 1\n </Menu.Item>\n <Menu.Item key=\"app\" disabled>\n 组织 2\n </Menu.Item>\n <SubMenu title={<span>组织 1 - 子</span>}>\n <MenuItemGroup title=\"组 1\">\n <Menu.Item key=\"setting:1\">选项 1</Menu.Item>\n <Menu.Item key=\"setting:2\">选项 2</Menu.Item>\n </MenuItemGroup>\n <MenuItemGroup title=\"组 2\">\n <Menu.Item key=\"setting:3\">选项 3</Menu.Item>\n <Menu.Item key=\"setting:4\">选项 4</Menu.Item>\n </MenuItemGroup>\n </SubMenu>\n </Menu>\n )\n }\n}\n\n","desc":" 更简洁,更方便"},{"example":<Demo2 />,"title":" 竖向Menu基础样式","code":"/**\n * @title 竖向Menu基础样式\n * @description 子菜单竖向显示,可折叠。\n */\n\nimport React, { Component } from 'react';\nimport { Menu } from 'tinper-bee';\n\nconst SubMenu = Menu.SubMenu;\nconst MenuItemGroup = Menu.ItemGroup;\n\n\nclass Demo2 extends Component {\n constructor(props, context) {\n super(props, context);\n this.state = {\n current: 1\n }\n }\n\n handleClick = (e) => {\n\n this.setState({\n current: e.key,\n });\n }\n\n render() {\n return (\n <Menu theme=\"dark\" onClick={this.handleClick} style={{ width: 240 }} defaultOpenKeys={['demo3sub1']} selectedKeys={[this.state.current]} mode=\"inline\">\n <SubMenu key=\"demo3sub1\" title={<span><span>组织 1</span></span>}>\n <MenuItemGroup title=\"组 1\">\n <Menu.Item key=\"1\">选项 1</Menu.Item>\n <Menu.Item key=\"2\">选项 2</Menu.Item>\n </MenuItemGroup>\n <MenuItemGroup title=\"组 2\">\n <Menu.Item key=\"3\">选项 3</Menu.Item>\n <Menu.Item key=\"4\">选项 4</Menu.Item>\n </MenuItemGroup>\n </SubMenu>\n <SubMenu key=\"demo3sub2\" title={<span><span>组织 2</span></span>}>\n <Menu.Item key=\"5\">选项 5</Menu.Item>\n <Menu.Item key=\"6\">选项 6</Menu.Item>\n <SubMenu key=\"demo3sub3\" title=\"子项\">\n <Menu.Item key=\"7\">选项 7</Menu.Item>\n <Menu.Item key=\"8\">选项 8</Menu.Item>\n </SubMenu>\n </SubMenu>\n <SubMenu key=\"demo3sub4\" title={<span><span>组织 3</span></span>}>\n <Menu.Item key=\"9\">选项 9</Menu.Item>\n <Menu.Item key=\"10\">选项 10</Menu.Item>\n <Menu.Item key=\"11\">选项 11</Menu.Item>\n <Menu.Item key=\"12\">选项 12</Menu.Item>\n </SubMenu>\n </Menu>\n )\n }\n}\n\n","desc":" 子菜单竖向显示,可折叠。"},{"example":<Demo3 />,"title":" 竖向手风琴Menu","code":"/**\n * @title 竖向手风琴Menu\n * @description 菜单展开是手风琴形式。\n */\n\n\nimport React, { Component } from 'react';\nimport { Menu } from 'tinper-bee';\n\nconst SubMenu = Menu.SubMenu;\n\n\nclass Demo3 extends Component {\n constructor(props, context) {\n super(props, context);\n this.state = {\n current: '1',\n openKeys: []\n }\n }\n handleClick = (e) => {\n console.log('Clicked: ', e);\n this.setState({current: e.key});\n }\n onOpenChange = (openKeys) => {\n const state = this.state;\n\n const latestOpenKey = this.myfilter(openKeys,state.openKeys);\n const latestCloseKey = this.myfilter(state.openKeys,openKeys);\n\n let nextOpenKeys = [];\n if (latestOpenKey) {\n nextOpenKeys = this.getAncestorKeys(latestOpenKey).concat(latestOpenKey);\n }\n if (latestCloseKey) {\n nextOpenKeys = this.getAncestorKeys(latestCloseKey);\n }\n this.setState({openKeys: nextOpenKeys});\n }\n\n //IE下 array.find()方法不可用\n myfilter = (arr1,arr2) => {\n if(arr2.length === 0 || !arr2) {\n return arr1[0];\n }\n\n for(var i=0;i<arr1.length;i++)\n {\n if(arr2.indexOf(arr1[i].toString()) === -1)\n {\n return arr1[i];\n } \n }\n return false;\n }\n\n getAncestorKeys = (key) => {\n const map = {\n sub3: ['sub2'],\n };\n return map[key] || [];\n }\n\n render() {\n return (\n <Menu\n mode=\"inline\"\n openKeys={this.state.openKeys}\n selectedKeys={[this.state.current]}\n style={{ width: 240 }}\n onOpenChange={this.onOpenChange}\n onClick={this.handleClick}>\n <SubMenu key=\"sub1\" title={<span><span>组织 1</span></span>}>\n <Menu.Item key=\"1\">选项 1</Menu.Item>\n <Menu.Item key=\"2\">选项 2</Menu.Item>\n <Menu.Item key=\"3\">选项 3</Menu.Item>\n <Menu.Item key=\"4\">选项 4</Menu.Item>\n </SubMenu>\n <SubMenu key=\"sub2\" title={<span><span>组织 2</span></span>}>\n <Menu.Item key=\"5\">选项 5</Menu.Item>\n <Menu.Item key=\"6\">选项 6</Menu.Item>\n <SubMenu key=\"sub3\" title=\"子项\">\n <Menu.Item key=\"7\">选项 7</Menu.Item>\n <Menu.Item key=\"8\">选项 8</Menu.Item>\n </SubMenu>\n </SubMenu>\n <SubMenu key=\"sub4\" title={<span><span>组织 3</span></span>}>\n <Menu.Item key=\"9\">选项 9</Menu.Item>\n <Menu.Item key=\"10\">选项 10</Menu.Item>\n <Menu.Item key=\"11\">选项 11</Menu.Item>\n <Menu.Item key=\"12\">选项 12</Menu.Item>\n </SubMenu>\n </Menu>\n )\n }\n}\n\n","desc":" 菜单展开是手风琴形式。"},{"example":<Demo4 />,"title":" 子菜单呼出形式Menu","code":"/**\n * @title 子菜单呼出形式Menu\n * @description 子菜单在右侧呼出形式显示。\n */\n\nimport React, { Component } from 'react';\nimport { Menu } from 'tinper-bee';\n\nconst SubMenu = Menu.SubMenu;\nconst MenuItemGroup = Menu.ItemGroup;\n\n\n\nclass Demo4 extends Component {\n\n handleClick = (e) => {\n console.log('click', e);\n }\n render() {\n return (\n <Menu onClick={this.handleClick} style={{ width: 240 }} mode=\"vertical\">\n <SubMenu key=\"sub1\" title={<span><span>组织 1</span></span>}>\n <MenuItemGroup title=\"Item 1\">\n <Menu.Item key=\"1\">选项 1</Menu.Item>\n <Menu.Item key=\"2\">选项 2</Menu.Item>\n </MenuItemGroup>\n <MenuItemGroup title=\"Iteom 2\">\n <Menu.Item key=\"3\">选项 3</Menu.Item>\n <Menu.Item key=\"4\">选项 4</Menu.Item>\n </MenuItemGroup>\n </SubMenu>\n <SubMenu key=\"sub2\" title={<span><span>组织 2</span></span>}>\n <Menu.Item key=\"5\">选项 5</Menu.Item>\n <Menu.Item key=\"6\">选项 6</Menu.Item>\n <SubMenu key=\"sub3\" title=\"Submenu\">\n <Menu.Item key=\"7\">选项 7</Menu.Item>\n <Menu.Item key=\"8\">选项 8</Menu.Item>\n </SubMenu>\n </SubMenu>\n <SubMenu key=\"sub4\" title={<span><span>组织 3</span></span>}>\n <Menu.Item key=\"9\">选项 9</Menu.Item>\n <Menu.Item key=\"10\">选项 10</Menu.Item>\n <Menu.Item key=\"11\">选项 11</Menu.Item>\n <Menu.Item key=\"12\">选项 12</Menu.Item>\n </SubMenu>\n </Menu>\n )\n }\n}\n\n","desc":" 子菜单在右侧呼出形式显示。"},{"example":<Demo5 />,"title":" Navbar和Menus的组合","code":"/**\n * @title Navbar和Menus的组合\n * @description 示例采取navbar与menus的组合,达到一种PC端常用的复合导航菜单。导航添加了常用的搜索表单消息提醒等组件。\n *\n */\n\nimport React, { Component } from 'react';\nimport { Menu, Navbar, Icon, Badge, FormControl } from 'tinper-bee';\n\n\n\nconst SubMenu = Menu.SubMenu;\nconst MenuItemGroup = Menu.ItemGroup;\nconst MenuToggle = Menu.MenuToggle;\nconst SideContainer = Menu.SideContainer;\n\nconst NavItem = Navbar.NavItem;\nconst Header = Navbar.Header;\nconst Brand = Navbar.Brand;\nconst Nav = Navbar.Nav;\n\n\nclass Demo5 extends Component {\n constructor(props, context) {\n super(props, context);\n this.state = {\n expanded: false,\n current: 1,\n searchValue:\"Search\"\n }\n }\n\n onToggle = (value) => {\n this.setState({expanded: value});\n }\n\n handleClick = (e) => {\n console.log('click ', e);\n this.setState({\n current: e.key\n });\n }\n\n onChange = (e) => {\n this.setState({searchValue:e});\n }\n\n render() {\n return (\n <div id=\"demo5\">\n <Navbar expanded={this.state.expanded} onToggle={this.onToggle}>\n <MenuToggle show/>\n <Header>\n <Brand>\n <a href=\"#\"><img style={{width:140}} src=\"http://design.yyuap.com/logos/logox.png\"/></a>\n </Brand>\n </Header>\n\n <Nav pullRight>\n <NavItem eventKey={1}>\n <FormControl\n type=\"text\"\n placeholder=\"Search\"\n onChange={this.onChange}\n value={this.state.searchValue}\n />\n </NavItem>\n <NavItem eventKey={2}>\n <Badge dataBadge=\"4\" colors=\"warning\">\n <Icon\n type=\"uf-bell\"\n />\n </Badge>\n </NavItem>\n <NavItem eventKey={3}>\n <Icon type=\"uf-bubble-o\" />\n </NavItem>\n <Menu mode=\"horizontal\" className=\"dropdown\">\n <SubMenu title={<span>刘认华<Icon type=\"uf-triangle-down\" /></span>}>\n <Menu.Item key=\"setting:1\">选项 1</Menu.Item>\n <Menu.Item key=\"setting:2\">选项 2</Menu.Item>\n <Menu.Item key=\"setting:3\">选项 3</Menu.Item>\n <Menu.Item key=\"setting:4\">选项 4</Menu.Item>\n </SubMenu>\n </Menu>\n </Nav>\n </Navbar>\n <SideContainer\n onToggle={this.onToggle}\n expanded={this.state.expanded}>\n <Menu onClick={this.handleClick}\n style={{ width: 240 }}\n defaultOpenKeys={['demo3sub1']}\n selectedKeys={[this.state.current]}\n mode=\"inline\"\n >\n <SubMenu key=\"demo3sub1\" title={<span><span>组织 1</span></span>}>\n <MenuItemGroup title=\"组 1\">\n <Menu.Item key=\"1\">选项 1</Menu.Item>\n <Menu.Item key=\"2\">选项 2</Menu.Item>\n </MenuItemGroup>\n <MenuItemGroup title=\"组 2\">\n <Menu.Item key=\"3\">选项 3</Menu.Item>\n <Menu.Item key=\"4\">选项 4</Menu.Item>\n </MenuItemGroup>\n </SubMenu>\n <SubMenu key=\"demo3sub2\" title={<span><span>组织 2</span></span>}>\n <Menu.Item key=\"5\">选项 5</Menu.Item>\n <Menu.Item key=\"6\">选项 6</Menu.Item>\n <SubMenu key=\"demo3sub3\" title=\"子项\">\n <Menu.Item key=\"7\">选项 7</Menu.Item>\n <Menu.Item key=\"8\">选项 8</Menu.Item>\n </SubMenu>\n </SubMenu>\n <SubMenu key=\"demo3sub4\" title={<span><span>组织 3</span></span>}>\n <Menu.Item key=\"9\">选项 9</Menu.Item>\n <Menu.Item key=\"10\">选项 10</Menu.Item>\n <Menu.Item key=\"11\">选项 11</Menu.Item>\n <Menu.Item key=\"12\">选项 12</Menu.Item>\n </SubMenu>\n </Menu>\n </SideContainer>\n </div>\n )\n }\n}\n\n","desc":" 示例采取navbar与menus的组合,达到一种PC端常用的复合导航菜单。导航添加了常用的搜索表单消息提醒等组件。"}] | ||
var Demo1 = require("./demolist/Demo1");var Demo2 = require("./demolist/Demo2");var Demo3 = require("./demolist/Demo3");var Demo4 = require("./demolist/Demo4");var Demo5 = require("./demolist/Demo5");var Demo6 = require("./demolist/Demo6");var DemoArray = [{"example":<Demo1 />,"title":" 横向Menu纯菜单导航","code":"/**\n * @title 横向Menu纯菜单导航\n * @description 更简洁,更方便\n */\n\nimport React, { Component } from 'react';\nimport { Menu } from 'tinper-bee';\n\nconst SubMenu = Menu.SubMenu;\nconst MenuItemGroup = Menu.ItemGroup;\n\n\nclass Demo1 extends Component {\n constructor(props, context) {\n super(props, context);\n this.state = {\n current: 'mail'\n }\n }\n\n handleClick = (e) => {\n this.setState({\n current: e.key,\n });\n }\n\n render() {\n return (\n <Menu onClick={this.handleClick}\n selectedKeys={[this.state.current]}\n mode=\"horizontal\"\n >\n <Menu.Item key=\"mail\" attribute={{'type': 'mail'}}>\n 组织 1\n </Menu.Item>\n <Menu.Item key=\"app\" disabled>\n 组织 2\n </Menu.Item>\n <SubMenu title={<span>组织 1 - 子</span>}>\n <MenuItemGroup title=\"组 1\">\n <Menu.Item key=\"setting:1\">选项 1</Menu.Item>\n <Menu.Item key=\"setting:2\">选项 2</Menu.Item>\n </MenuItemGroup>\n <MenuItemGroup title=\"组 2\">\n <Menu.Item key=\"setting:3\">选项 3</Menu.Item>\n <Menu.Item key=\"setting:4\">选项 4</Menu.Item>\n </MenuItemGroup>\n </SubMenu>\n </Menu>\n )\n }\n}\n\n","desc":" 更简洁,更方便"},{"example":<Demo2 />,"title":" 竖向Menu基础样式","code":"/**\n * @title 竖向Menu基础样式\n * @description 子菜单竖向显示,可折叠。\n */\n\nimport React, { Component } from 'react';\nimport { Menu } from 'tinper-bee';\n\nconst SubMenu = Menu.SubMenu;\nconst MenuItemGroup = Menu.ItemGroup;\n\n\nclass Demo2 extends Component {\n constructor(props, context) {\n super(props, context);\n this.state = {\n current: 1\n }\n }\n\n handleClick = (e) => {\n\n this.setState({\n current: e.key,\n });\n }\n\n render() {\n return (\n <Menu theme=\"dark\" onClick={this.handleClick} style={{ width: 240 }} defaultOpenKeys={['demo3sub1']} selectedKeys={[this.state.current]} mode=\"inline\">\n <SubMenu key=\"demo3sub1\" title={<span><span>组织 1</span></span>}>\n <MenuItemGroup title=\"组 1\">\n <Menu.Item key=\"1\">选项 1</Menu.Item>\n <Menu.Item key=\"2\">选项 2</Menu.Item>\n </MenuItemGroup>\n <MenuItemGroup title=\"组 2\">\n <Menu.Item key=\"3\">选项 3</Menu.Item>\n <Menu.Item key=\"4\">选项 4</Menu.Item>\n </MenuItemGroup>\n </SubMenu>\n <SubMenu key=\"demo3sub2\" title={<span><span>组织 2</span></span>}>\n <Menu.Item key=\"5\">选项 5</Menu.Item>\n <Menu.Item key=\"6\">选项 6</Menu.Item>\n <SubMenu key=\"demo3sub3\" title=\"子项\">\n <Menu.Item key=\"7\">选项 7</Menu.Item>\n <Menu.Item key=\"8\">选项 8</Menu.Item>\n </SubMenu>\n </SubMenu>\n <SubMenu key=\"demo3sub4\" title={<span><span>组织 3</span></span>}>\n <Menu.Item key=\"9\">选项 9</Menu.Item>\n <Menu.Item key=\"10\">选项 10</Menu.Item>\n <Menu.Item key=\"11\">选项 11</Menu.Item>\n <Menu.Item key=\"12\">选项 12</Menu.Item>\n </SubMenu>\n </Menu>\n )\n }\n}\n\n","desc":" 子菜单竖向显示,可折叠。"},{"example":<Demo3 />,"title":" 竖向手风琴Menu","code":"/**\n * @title 竖向手风琴Menu\n * @description 菜单展开是手风琴形式。\n */\n\n\nimport React, { Component } from 'react';\nimport { Menu } from 'tinper-bee';\n\nconst SubMenu = Menu.SubMenu;\n\n\nclass Demo3 extends Component {\n constructor(props, context) {\n super(props, context);\n this.state = {\n current: '1',\n openKeys: []\n }\n }\n handleClick = (e) => {\n console.log('Clicked: ', e);\n this.setState({current: e.key});\n }\n onOpenChange = (openKeys) => {\n const state = this.state;\n\n const latestOpenKey = this.myfilter(openKeys,state.openKeys);\n const latestCloseKey = this.myfilter(state.openKeys,openKeys);\n\n let nextOpenKeys = [];\n if (latestOpenKey) {\n nextOpenKeys = this.getAncestorKeys(latestOpenKey).concat(latestOpenKey);\n }\n if (latestCloseKey) {\n nextOpenKeys = this.getAncestorKeys(latestCloseKey);\n }\n this.setState({openKeys: nextOpenKeys});\n }\n\n //IE下 array.find()方法不可用\n myfilter = (arr1,arr2) => {\n if(arr2.length === 0 || !arr2) {\n return arr1[0];\n }\n\n for(var i=0;i<arr1.length;i++)\n {\n if(arr2.indexOf(arr1[i].toString()) === -1)\n {\n return arr1[i];\n } \n }\n return false;\n }\n\n getAncestorKeys = (key) => {\n const map = {\n sub3: ['sub2'],\n };\n return map[key] || [];\n }\n\n render() {\n return (\n <Menu\n mode=\"inline\"\n openKeys={this.state.openKeys}\n selectedKeys={[this.state.current]}\n style={{ width: 240 }}\n onOpenChange={this.onOpenChange}\n onClick={this.handleClick}>\n <SubMenu key=\"sub1\" title={<span><span>组织 1</span></span>}>\n <Menu.Item key=\"1\">选项 1</Menu.Item>\n <Menu.Item key=\"2\">选项 2</Menu.Item>\n <Menu.Item key=\"3\">选项 3</Menu.Item>\n <Menu.Item key=\"4\">选项 4</Menu.Item>\n </SubMenu>\n <SubMenu key=\"sub2\" title={<span><span>组织 2</span></span>}>\n <Menu.Item key=\"5\">选项 5</Menu.Item>\n <Menu.Item key=\"6\">选项 6</Menu.Item>\n <SubMenu key=\"sub3\" title=\"子项\">\n <Menu.Item key=\"7\">选项 7</Menu.Item>\n <Menu.Item key=\"8\">选项 8</Menu.Item>\n </SubMenu>\n </SubMenu>\n <SubMenu key=\"sub4\" title={<span><span>组织 3</span></span>}>\n <Menu.Item key=\"9\">选项 9</Menu.Item>\n <Menu.Item key=\"10\">选项 10</Menu.Item>\n <Menu.Item key=\"11\">选项 11</Menu.Item>\n <Menu.Item key=\"12\">选项 12</Menu.Item>\n </SubMenu>\n </Menu>\n )\n }\n}\n\n","desc":" 菜单展开是手风琴形式。"},{"example":<Demo4 />,"title":" 子菜单呼出形式Menu","code":"/**\n * @title 子菜单呼出形式Menu\n * @description 子菜单在右侧呼出形式显示。\n */\n\nimport React, { Component } from 'react';\nimport { Menu } from 'tinper-bee';\n\nconst SubMenu = Menu.SubMenu;\nconst MenuItemGroup = Menu.ItemGroup;\n\n\n\nclass Demo4 extends Component {\n\n handleClick = (e) => {\n console.log('click', e);\n }\n render() {\n return (\n <Menu onClick={this.handleClick} style={{ width: 240 }} mode=\"vertical\">\n <SubMenu key=\"sub1\" title={<span><span>组织 1</span></span>}>\n <MenuItemGroup title=\"Item 1\">\n <Menu.Item key=\"1\">选项 1</Menu.Item>\n <Menu.Item key=\"2\">选项 2</Menu.Item>\n </MenuItemGroup>\n <MenuItemGroup title=\"Iteom 2\">\n <Menu.Item key=\"3\">选项 3</Menu.Item>\n <Menu.Item key=\"4\">选项 4</Menu.Item>\n </MenuItemGroup>\n </SubMenu>\n <SubMenu key=\"sub2\" title={<span><span>组织 2</span></span>}>\n <Menu.Item key=\"5\">选项 5</Menu.Item>\n <Menu.Item key=\"6\">选项 6</Menu.Item>\n <SubMenu key=\"sub3\" title=\"Submenu\">\n <Menu.Item key=\"7\">选项 7</Menu.Item>\n <Menu.Item key=\"8\">选项 8</Menu.Item>\n </SubMenu>\n </SubMenu>\n <SubMenu key=\"sub4\" title={<span><span>组织 3</span></span>}>\n <Menu.Item key=\"9\">选项 9</Menu.Item>\n <Menu.Item key=\"10\">选项 10</Menu.Item>\n <Menu.Item key=\"11\">选项 11</Menu.Item>\n <Menu.Item key=\"12\">选项 12</Menu.Item>\n </SubMenu>\n </Menu>\n )\n }\n}\n\n","desc":" 子菜单在右侧呼出形式显示。"},{"example":<Demo5 />,"title":" Navbar和Menus的组合","code":"/**\n * @title Navbar和Menus的组合\n * @description 示例采取navbar与menus的组合,达到一种PC端常用的复合导航菜单。导航添加了常用的搜索表单消息提醒等组件。\n *\n */\n\nimport React, { Component } from 'react';\nimport { Menu, Navbar, Icon, Badge, FormControl } from 'tinper-bee';\n\n\n\nconst SubMenu = Menu.SubMenu;\nconst MenuItemGroup = Menu.ItemGroup;\nconst MenuToggle = Menu.MenuToggle;\nconst SideContainer = Menu.SideContainer;\n\nconst NavItem = Navbar.NavItem;\nconst Header = Navbar.Header;\nconst Brand = Navbar.Brand;\nconst Nav = Navbar.Nav;\n\n\nclass Demo5 extends Component {\n constructor(props, context) {\n super(props, context);\n this.state = {\n expanded: false,\n current: 1,\n searchValue:\"Search\"\n }\n }\n\n onToggle = (value) => {\n this.setState({expanded: value});\n }\n\n handleClick = (e) => {\n console.log('click ', e);\n this.setState({\n current: e.key\n });\n }\n\n onChange = (e) => {\n this.setState({searchValue:e});\n }\n\n render() {\n return (\n <div id=\"demo5\">\n <Navbar expanded={this.state.expanded} onToggle={this.onToggle}>\n <MenuToggle show/>\n <Header>\n <Brand>\n <a href=\"#\"><img style={{width:140}} src=\"http://design.yyuap.com/logos/logox.png\"/></a>\n </Brand>\n </Header>\n\n <Nav pullRight>\n <NavItem eventKey={1}>\n <FormControl\n type=\"text\"\n placeholder=\"Search\"\n onChange={this.onChange}\n value={this.state.searchValue}\n />\n </NavItem>\n <NavItem eventKey={2}>\n <Badge dataBadge=\"4\" colors=\"warning\">\n <Icon\n type=\"uf-bell\"\n />\n </Badge>\n </NavItem>\n <NavItem eventKey={3}>\n <Icon type=\"uf-bubble-o\" />\n </NavItem>\n <Menu mode=\"horizontal\" className=\"dropdown\">\n <SubMenu title={<span>刘认华<Icon type=\"uf-triangle-down\" /></span>}>\n <Menu.Item key=\"setting:1\">选项 1</Menu.Item>\n <Menu.Item key=\"setting:2\">选项 2</Menu.Item>\n <Menu.Item key=\"setting:3\">选项 3</Menu.Item>\n <Menu.Item key=\"setting:4\">选项 4</Menu.Item>\n </SubMenu>\n </Menu>\n </Nav>\n </Navbar>\n <SideContainer\n onToggle={this.onToggle}\n expanded={this.state.expanded}>\n <Menu onClick={this.handleClick}\n style={{ width: 240 }}\n defaultOpenKeys={['demo3sub1']}\n selectedKeys={[this.state.current]}\n mode=\"inline\"\n >\n <SubMenu key=\"demo3sub1\" title={<span><span>组织 1</span></span>}>\n <MenuItemGroup title=\"组 1\">\n <Menu.Item key=\"1\">选项 1</Menu.Item>\n <Menu.Item key=\"2\">选项 2</Menu.Item>\n </MenuItemGroup>\n <MenuItemGroup title=\"组 2\">\n <Menu.Item key=\"3\">选项 3</Menu.Item>\n <Menu.Item key=\"4\">选项 4</Menu.Item>\n </MenuItemGroup>\n </SubMenu>\n <SubMenu key=\"demo3sub2\" title={<span><span>组织 2</span></span>}>\n <Menu.Item key=\"5\">选项 5</Menu.Item>\n <Menu.Item key=\"6\">选项 6</Menu.Item>\n <SubMenu key=\"demo3sub3\" title=\"子项\">\n <Menu.Item key=\"7\">选项 7</Menu.Item>\n <Menu.Item key=\"8\">选项 8</Menu.Item>\n </SubMenu>\n </SubMenu>\n <SubMenu key=\"demo3sub4\" title={<span><span>组织 3</span></span>}>\n <Menu.Item key=\"9\">选项 9</Menu.Item>\n <Menu.Item key=\"10\">选项 10</Menu.Item>\n <Menu.Item key=\"11\">选项 11</Menu.Item>\n <Menu.Item key=\"12\">选项 12</Menu.Item>\n </SubMenu>\n </Menu>\n </SideContainer>\n </div>\n )\n }\n}\n\n","desc":" 示例采取navbar与menus的组合,达到一种PC端常用的复合导航菜单。导航添加了常用的搜索表单消息提醒等组件。"},{"example":<Demo6 />,"title":" 基础下拉菜单","code":"/**\n * @title 基础下拉菜单\n * @description 如何获取选中对象自定义对象和数据\n *\n */\nimport React, { Component } from 'react';\nimport { Menu } from 'tinper-bee';\n\nconst SubMenu = Menu.SubMenu;\nconst MenuItemGroup = Menu.ItemGroup;\n\nclass Demo6 extends Component {\n constructor(props, context) {\n super(props, context);\n this.state = {\n current: 1\n }\n }\n\n handleClick = (e) => {\n\n this.setState({\n current: e.key,\n });\n }\n \n /**\n * 获取当前选中行的item对象。\n * @param {*} value \n */\n onSelect({item,key,selectedKeys}){ \n console.log(`${key} selected`); //获取key\n let currentObject = {};\n currentObject.value = item.props.children; //获取选中对象的数据\n currentObject.key = item.props.eventKey;\n console.log(currentObject); \n }\n\n render() {\n return (\n <Menu theme=\"dark\" onClick={this.handleClick} style={{ width: 240 }} defaultOpenKeys={['demo3sub1']} selectedKeys={[this.state.current]} mode=\"inline\" onSelect={this.onSelect.bind(this)}>\n <SubMenu key=\"demo3sub1\" title={<span><span>组织 1</span></span>}>\n <MenuItemGroup title=\"组 1\">\n <Menu.Item key=\"1\">选项 1</Menu.Item>\n <Menu.Item key=\"2\">选项 2</Menu.Item>\n </MenuItemGroup>\n <MenuItemGroup title=\"组 2\">\n <Menu.Item key=\"3\">选项 3</Menu.Item>\n <Menu.Item key=\"4\">选项 4</Menu.Item>\n </MenuItemGroup>\n </SubMenu>\n <SubMenu key=\"demo3sub2\" title={<span><span>组织 2</span></span>}>\n <Menu.Item key=\"5\">选项 5</Menu.Item>\n <Menu.Item key=\"6\">选项 6</Menu.Item>\n <SubMenu key=\"demo3sub3\" title=\"子项\">\n <Menu.Item key=\"7\">选项 7</Menu.Item>\n <Menu.Item key=\"8\">选项 8</Menu.Item>\n </SubMenu>\n </SubMenu>\n <SubMenu key=\"demo3sub4\" title={<span><span>组织 3</span></span>}>\n <Menu.Item key=\"9\">选项 9</Menu.Item>\n <Menu.Item key=\"10\">选项 10</Menu.Item>\n <Menu.Item key=\"11\">选项 11</Menu.Item>\n <Menu.Item key=\"12\">选项 12</Menu.Item>\n </SubMenu>\n </Menu>\n )\n }\n}\n\n","desc":" 如何获取选中对象自定义对象和数据"}] | ||
@@ -16,0 +16,0 @@ |
{ | ||
"name": "bee-menus", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "menus ui component for react", | ||
@@ -39,2 +39,3 @@ "keywords": [ | ||
"classnames": "^2.2.5", | ||
"dom-scroll-into-view": "^1.2.1", | ||
"tinper-bee-core": "latest" | ||
@@ -41,0 +42,0 @@ }, |
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { noop,getKeyFromChildrenIndex, loopMenuItem } from './util'; | ||
import scrollIntoView from 'dom-scroll-into-view'; | ||
import classnames from 'classnames'; | ||
@@ -5,0 +6,0 @@ import DOMWrap from './DOMWrap'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2093979
57
23499
8
7
1
+ Addeddom-scroll-into-view@^1.2.1
+ Addeddom-scroll-into-view@1.2.1(transitive)