diff --git a/CHANGELOG.md b/CHANGELOG.md index f450a1c01..b577119d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,44 @@ # 更新日志 +## 2.13.0 + +- 修复 `` 行高不正确问题 [#1061](https://github.com/XiaoMi/hiui/issues/1061) +- 修复 `` 在单选情况下受控时清空报错的问题 [#1070](https://github.com/XiaoMi/hiui/issues/1070) +- 修复 `` 受控模式的异步多选,默认选项消失的问题 [#1047](https://github.com/XiaoMi/hiui/issues/1047) +- 修复 `
` validate 验证不通过回调函数没有调用的问题 [#1059](https://github.com/XiaoMi/hiui/issues/1059) +- 修复 `` 校验不通过时的样式问题 [#1042](https://github.com/XiaoMi/hiui/issues/1042) [#1036](https://github.com/XiaoMi/hiui/issues/1036) +- 修复 `` 高度不正确问题 [#1053](https://github.com/XiaoMi/hiui/issues/1053) +- 修复 `` 同时展开多个的问题 [#1066](https://github.com/XiaoMi/hiui/issues/1066) +- 修复 ``、`` 白色背景的问题 [#1049](https://github.com/XiaoMi/hiui/issues/1049) +- 修复 `` 上传过程中 maxCount 不起作用的问题 [#1032](https://github.com/XiaoMi/hiui/issues/1032) +- 修复 `` 拖拽上传时,tips 展示不正确的问题 [#1041](https://github.com/XiaoMi/hiui/issues/1041) +- 修复 `` 点击每月 31 号,输入框显示异常的问题 [#1039](https://github.com/XiaoMi/hiui/issues/1039) +- 修复 `` 在 type 为 date 时执行了农历方法的问题 [#1050](https://github.com/XiaoMi/hiui/issues/1050) +- 修复 `` 切换月异常的问题 [#1079](https://github.com/XiaoMi/hiui/issues/1079) +- 修复 ` { diff --git a/components/upload/style/index.scss b/components/upload/style/index.scss index 0be4d348f..2b4027bfe 100644 --- a/components/upload/style/index.scss +++ b/components/upload/style/index.scss @@ -308,6 +308,35 @@ } } + &--photo { + .hi-upload__item--small { + width: 80px; + height: 80px; + line-height: 80px; + + .hi-upload__thumb { + max-width: 80px; + max-height: 80px; + } + } + + .hi-upload__item--large { + width: 200px; + height: 200px; + line-height: 200px; + + .hi-upload__thumb { + max-width: 200px; + max-height: 200px; + } + } + } + + &__thumb { + max-width: 140px; + max-height: 140px; + } + &--avatar { .hi-upload__item--upload { width: 80px; @@ -363,10 +392,7 @@ z-index: 2; } - &__thumb { - max-width: 140px; - max-height: 140px; - } + &--picture-card { .hi-upload__upstatus { diff --git a/components/upload/upload-legacy/Upload.js b/components/upload/upload-legacy/Upload.js index e6e71d264..b2360087a 100644 --- a/components/upload/upload-legacy/Upload.js +++ b/components/upload/upload-legacy/Upload.js @@ -49,7 +49,7 @@ class Upload extends Component { fileType = 'zip' break case 'doc': - case 'dcox': + case 'docx': fileType = 'word' break case 'pdf': diff --git a/components/watermark/index.js b/components/watermark/index.js index 27630142c..239e8a3bc 100644 --- a/components/watermark/index.js +++ b/components/watermark/index.js @@ -29,7 +29,7 @@ Watermark.propTypes = { width: PropTypes.number, height: PropTypes.number, textAlign: PropTypes.string, - font: PropTypes.string, + font: PropTypes.number, color: PropTypes.string, content: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), rotate: PropTypes.number, @@ -37,15 +37,15 @@ Watermark.propTypes = { logo: PropTypes.string, grayLogo: PropTypes.bool, isAutoWrap: PropTypes.bool, - textOverflowEffect: PropTypes.oneOfType(['zoom', 'cut']) + textOverflowEffect: PropTypes.oneOf(['zoom', 'cut']) } Watermark.defaultProps = { id: null, density: 'default', textAlign: 'left', - font: '16px microsoft yahei', - color: 'rgba(128, 128, 128, 0.2)', + font: 14, + color: 'rgba(148, 148, 148, 0.2)', content: '请勿外传', rotate: -30, zIndex: 1000, diff --git a/components/watermark/watermark.js b/components/watermark/watermark.js index 2fbc78adc..0a5669f22 100644 --- a/components/watermark/watermark.js +++ b/components/watermark/watermark.js @@ -1,8 +1,8 @@ const defaultOptions = { id: null, textAlign: 'left', - font: '16px microsoft yahei', - color: 'rgba(128, 128, 128, 0.2)', + font: 'normal normal lighter 28px -apple-system,BlinkMacSystemFont,"Helvetica Neue",Helvetica,Arial,"Microsoft Yahei","Hiragino Sans GB","Heiti SC","WenQuanYi Micro Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"', + color: 'rgba(148, 148, 148, 0.2)', content: '请勿外传', rotate: -30, zIndex: 1000, @@ -48,22 +48,23 @@ const drawText = (ctx, options) => { height, textOverflowEffect, content: text, + font, isAutoWrap, logo } = options let oldBaseLine = ctx.textBaseline let x = 0 - let y = 0 + let y = 16 ctx.textBaseline = 'hanging' /** * LOGO 固定宽高: 32 * 32 * 内容区域为 画布宽度 - 48 (预留左右各24的 padding) * 如含 LOGO ,文字的起始 X 坐标为: 24(padding-left) + 32(logo size) + 4(logo 与 text 间距) */ - let lineHeight = parseInt(ctx.font) // ctx.font必须以'XXpx'开头 + let lineHeight = parseInt(font * 2) // ctx.font必须以'XXpx'开头 if (logo) { - x += 32 - _w -= 32 + x += 64 + _w -= 64 } const lines = parseTextData(ctx, text, width, isAutoWrap) @@ -73,11 +74,11 @@ const drawText = (ctx, options) => { for (let line of lines) { let lineX if (ctx.textAlign === 'center') { - lineX = x + width / 2 + 4 + lineX = x + width + 40 } else if (ctx.textAlign === 'right') { - lineX = x + width + 4 + lineX = x + width + 40 } else { - lineX = x + 4 + lineX = x + 40 } if (textOverflowEffect === 'zoom') { const size = parseInt(Math.sqrt((_w * _w + height * height) / 2)) @@ -95,29 +96,31 @@ const drawLogo = (ctx, logo, cb) => { img.src = logo img.onload = () => { ctx.globalAlpha = 0.2 - ctx.drawImage(img, 0, ctx.canvas.height / 2 - 16, 32, 32) + ctx.drawImage(img, 32, ctx.canvas.height / 2 - 16, 64, 64) cb() } } const toImage = (canvas, key, container, options) => { - var base64Url = canvas.toDataURL() + const base64Url = canvas.toDataURL() + const { opacity = 1 } = options const _top = (options._top || 0) + 'px' const __wm = document.querySelector(`.${key}`) const watermarkDiv = __wm || document.createElement('div') const styleStr = ` position:absolute; top:${_top}; - left:0; - bottom:0; - width:100%; - height:100%; + left:-50%; + top:-50%; + width:200%; + height:200%; + transform:scale(0.5); z-index:${options.zIndex}; pointer-events:none; background-repeat:repeat; visibility:visible !important; display: block !important; - opacity: 1 !important; + opacity: ${opacity} !important; background-image:url('${base64Url}'); ${options.grayLogo ? '-webkit-filter: grayscale(100%);-moz-filter: grayscale(100%);-ms-filter: grayscale(100%);-o-filter: grayscale(100%);filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);_filter:none;' : ''} ` @@ -149,13 +152,13 @@ const WaterMarker = (container, args) => { const _container = container || document.body const {density} = args let _markSize = { - width: 210, - height: 180 + width: 420, + height: 270 } if (['low', 'high'].includes(density)) { _markSize = { - width: density === 'low' ? 240 : 180, - height: density === 'low' ? 210 : 150 + width: density === 'low' ? 540 : 360, + height: density === 'low' ? 410 : 210 } } const options = Object.assign({}, defaultOptions, _markSize, args) @@ -178,10 +181,9 @@ const WaterMarker = (container, args) => { var ctx = canvas.getContext('2d') canvas.setAttribute('width', width + 'px') canvas.setAttribute('height', height + 'px') - ctx.textAlign = textAlign ctx.textBaseline = textBaseline - ctx.font = font + ctx.font = `normal normal lighter ${Number(font * 2)}px -apple-system,BlinkMacSystemFont,"Helvetica Neue",Helvetica,Arial,"Microsoft Yahei","Hiragino Sans GB","Heiti SC","WenQuanYi Micro Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"` ctx.fillStyle = color ctx.translate(width / 2, height / 2) ctx.rotate(Math.PI / 180 * rotate) diff --git a/docs/demo/collapse/section-accordion.jsx b/docs/demo/collapse/section-accordion.jsx index 34fce843a..00bb0eefb 100644 --- a/docs/demo/collapse/section-accordion.jsx +++ b/docs/demo/collapse/section-accordion.jsx @@ -7,7 +7,7 @@ const desc = '一次仅展开一个面板,有效减少垂直空间的占用' const code = [ { code: `import React from 'react' -import Checkbox from '@hi-ui/hiui/es/checkbox'\n +import Collapse from '@hi-ui/hiui/es/collapse'\n class Demo extends React.Component { render(){ return( diff --git a/docs/demo/collapse/section-basic.jsx b/docs/demo/collapse/section-basic.jsx index a4eb3b126..91b80b134 100644 --- a/docs/demo/collapse/section-basic.jsx +++ b/docs/demo/collapse/section-basic.jsx @@ -7,7 +7,7 @@ const desc = '可以同时展开多个面板,对垂直空间没有特别限制 const code = [ { code: `import React from 'react' -import Checkbox from '@hi-ui/hiui/es/checkbox'\n +import Collapse from '@hi-ui/hiui/es/collapse'\n class Demo extends React.Component { render(){ return( diff --git a/docs/demo/date-picker/section-fast-check.jsx b/docs/demo/date-picker/section-fast-check.jsx index 28e8f5e8d..e50ed7c29 100644 --- a/docs/demo/date-picker/section-fast-check.jsx +++ b/docs/demo/date-picker/section-fast-check.jsx @@ -10,7 +10,7 @@ class Demo extends React.Component { return ( {console.log('onChange', date, dateStr)}} /> ) diff --git a/docs/demo/date-picker/section-scope.jsx b/docs/demo/date-picker/section-scope.jsx index 90714229b..d378c291a 100644 --- a/docs/demo/date-picker/section-scope.jsx +++ b/docs/demo/date-picker/section-scope.jsx @@ -37,15 +37,14 @@ class Demo extends React.Component { constructor() { super() this.state = { - rangeDate: {start: new Date(), end: new Date()} // 或 rangeDate: new Date() + rangeDate: {start: new Date('2020'), end: new Date('2030')} // 或 rangeDate: new Date() } } render () { return (
{console.log('onChange', date, dateStr)}} /> @@ -62,15 +61,14 @@ class Demo extends React.Component { constructor() { super() this.state = { - rangeDate: {start: new Date(), end: new Date()} // 或 rangeDate: new Date() + rangeDate: {start: new Date(2020, 9), end: new Date(2030, 10)} // 或 rangeDate: new Date() } } render () { return (
{console.log('onChange', date, dateStr)}} /> diff --git a/docs/demo/form/section-check.jsx b/docs/demo/form/section-check.jsx index 9fa15d46a..6207a127e 100644 --- a/docs/demo/form/section-check.jsx +++ b/docs/demo/form/section-check.jsx @@ -5,6 +5,9 @@ import Input from '../../../components/input' import Grid from '../../../components/grid' import Radio from '../../../components/radio' import Button from '../../../components/button' +import Select from '../../../components/select' +import Cascader from '../../../components/cascader' +import DatePicker from '../../../components/date-picker' const prefix = 'form-check' const desc = '表单项内容的格式、逻辑有特殊要求' const code = `import React from 'react' @@ -120,7 +123,7 @@ class Demo extends React.Component { const DemoCloseable = () => ( diff --git a/docs/demo/stepper/section-icon.jsx b/docs/demo/stepper/section-icon.jsx index 615a3ab40..0c76ffa80 100644 --- a/docs/demo/stepper/section-icon.jsx +++ b/docs/demo/stepper/section-icon.jsx @@ -15,15 +15,15 @@ class Demo extends React.Component { const list = [ { title: '账号信息', - icon: , + icon: 'user', }, { title: '邮箱激活', - icon: + icon: 'time' }, { title: '信息登记', - icon: + icon: 'list' }, ] @@ -46,15 +46,15 @@ class Demo extends React.Component { const list = [ { title: '账号信息', - icon: , + icon: 'user', }, { title: '邮箱激活', - icon: + icon: 'time' }, { title: '信息登记', - icon: + icon: 'list' }, ] diff --git a/docs/demo/timeline/section-basic.jsx b/docs/demo/timeline/section-basic.jsx index bc1e5a1ce..15b3eec4c 100644 --- a/docs/demo/timeline/section-basic.jsx +++ b/docs/demo/timeline/section-basic.jsx @@ -6,6 +6,7 @@ import Form from '../../../components/form' import Input from '../../../components/input' import Radio from '../../../components/radio' import Button from '../../../components/button' +import Icon from '../../../components/icon' const prefix = 'timeline-basic' const desc = '以时间为第一维度,展示该时间点的事务、日程、任务或记录' const code = `import React from 'react' @@ -108,8 +109,8 @@ class Demo extends React.Component { extraTime: '03-10' }] }] - - } + + } return (
@@ -140,6 +141,11 @@ class Demo extends React.Component { }` const DemoBasic = () => ( - + ) export default DemoBasic diff --git a/docs/demo/timeline/section-cross.jsx b/docs/demo/timeline/section-cross.jsx index 4e60acb95..98732dcb0 100644 --- a/docs/demo/timeline/section-cross.jsx +++ b/docs/demo/timeline/section-cross.jsx @@ -10,55 +10,26 @@ import Timeline from '@hi-ui/hiui/es/timeline'\n class Demo extends React.Component { render () { const data = [{ - groupTitle: '上午', - children: [{ - title: 'Title - 1', - content: 'Here are some descriptions', - timestamp: '9:00', - extraTime: '02-25' - }, { - title: 'Title 1-2', - content: 'Here are some descriptions', - timestamp: '10:00', - extraTime: '02-25' - }] - }, { - groupTitle: '下午', - children: [{ - title: 'Title 2-1', - content: 'Here are some descriptions', - timestamp: '12:00', - extraTime: '02-25', - folding: true, - children: [{ - title: 'Sub 1', - content: 'Here are some descriptions' - }, { - title: 'Sub 2', - content: 'Here are some descriptions' - }] - }, { - icon: , - title: 'Title 2-2', - content: 'Here are some descriptions', - timestamp: '14:00', - extraTime: '02-25' - }] - }, { - groupTitle: 'Group 3', - children: [{ - title: 'Title 3-1', - content: 'Here are some descriptions', - timestamp: '16:00', - extraTime: '11-25', - extraTime: '02-25' - }, { - title: 'Title 3-2', - content: 'Here are some descriptions', - timestamp: '18:00', - extraTime: '02-25' - }] - }] + title: '信息部全员财务培训需求收集', + content: '为使信息部同事更好的研发、运维和服务财务部的需求和工作,财务部计划给信息部同事提供财务相关的培训', + timestamp: '10:00', + extraTime: '02-23' + }, { + title: '信息部全员财务培训需求收集', + content: '为使信息部同事更好的研发、运维和服务财务部的需求和工作,财务部计划给信息部同事提供财务相关的培训', + timestamp: '10:00', + extraTime: '02-27' + }, { + title: '信息部全员财务培训需求收集', + content: '为使信息部同事更好的研发、运维和服务财务部的需求和工作,财务部计划给信息部同事提供财务相关的培训', + timestamp: '12:00', + extraTime: '03-02' + }, { + title: '信息部全员财务培训需求收集', + content: '为使信息部同事更好的研发、运维和服务财务部的需求和工作,财务部计划给信息部同事提供财务相关的培训', + timestamp: '11:00', + extraTime: '03-10' + }] return (
diff --git a/docs/demo/timeline/section-info.jsx b/docs/demo/timeline/section-info.jsx index c26357348..ffd1e4f6f 100644 --- a/docs/demo/timeline/section-info.jsx +++ b/docs/demo/timeline/section-info.jsx @@ -1,6 +1,7 @@ import React from 'react' import DocViewer from '../../../libs/doc-viewer' import Timeline from '../../../components/timeline' +import Icon from '../../../components/icon' const prefix = 'timeline-info' const desc = '在一段时间范围里,信息流向增长,数量庞大,必要时可收起部分' const code = `import React from 'react' @@ -40,11 +41,6 @@ class Demo extends React.Component { }` const DemoInfo = () => ( - + ) export default DemoInfo diff --git a/docs/demo/tree/section-drag.jsx b/docs/demo/tree/section-drag.jsx index ebd205c4e..a1190501f 100644 --- a/docs/demo/tree/section-drag.jsx +++ b/docs/demo/tree/section-drag.jsx @@ -49,6 +49,9 @@ class Demo extends React.Component { onDragStart = {(dragNode)=> { console.log(dragNode) }} + onDrop = {(dragNode, dropNode, data, level)=> { + console.log(dragNode,dropNode,data, level) + }} onDropEnd = {(dragNode,dropNode)=> { console.log(dragNode,dropNode) }} diff --git a/docs/demo/tree/section-edit.jsx b/docs/demo/tree/section-edit.jsx index d7dee11d2..f33e0707c 100644 --- a/docs/demo/tree/section-edit.jsx +++ b/docs/demo/tree/section-edit.jsx @@ -1,6 +1,7 @@ import React from 'react' import DocViewer from '../../../libs/doc-viewer' import Tree from '../../../components/tree' +import Notification from '../../../components/notification' const prefix = 'tree-edit' const desc = '通过树的节点进行新增、删除、编辑等操作' const rightOptions = ['基础', '自定义菜单'] @@ -49,9 +50,18 @@ class Demo extends React.Component { apperance="line" editable={true} data={this.state.treeData} + onBeforeSave={(saveNode, data, level) => { + console.log(saveNode, data,level) + return true + }} onSave={(saveNode, data) => { + console.log(saveNode, data) }} + onBeforeDelete={(deleteNode, data, level) => { + console.log(deleteNode, data,level) + return true + }} onDelete={(deleteNode, data) => { console.log(deleteNode, data) }} @@ -88,17 +98,29 @@ class Demo extends React.Component { return (
{ - console.log(saveNode, data) + onSave={(saveNode, data, level) => { + if (level === 0) { + Notification.open({ + title:'保存失败', + type:'error' + }) + return false + } else { + return true + } + console.log(saveNode, data,level) + }} + onDelete={(deleteNode, data) => { console.log(deleteNode, data) }} - contextMenu={(currentItemData) => { + contextMenu={(currentItemData, level) => { if (currentItemData.customData === 'Y') { return [{ type: 'addChildNode' @@ -141,7 +163,7 @@ class Demo extends React.Component { const DemoEdit = () => ( { const _fileList = fileList.concat({ name: files[0].name, - fileType: 'img', + fileType: files[0].name.slice(files[0].name.lastIndexOf('.') + 1).toLowerCase(), uploadState: 'success' }) this.setState({ diff --git a/docs/demo/watermark/section-base.jsx b/docs/demo/watermark/section-base.jsx index 72ad8a86d..f724f6471 100755 --- a/docs/demo/watermark/section-base.jsx +++ b/docs/demo/watermark/section-base.jsx @@ -5,19 +5,23 @@ import logo from '../../../site/static/img/logo.png' const prefix = 'watermark-base' const desc = '' const code = `import React from 'react' -import Watermark from '@hi-ui/hiui/es/Watermark'\n +import logo from '本地图片路径或者base64' +import Watermark from '@hi-ui/hiui/es/watermark'\n class Demo extends React.Component { constructor(props) { super(props) - this.options = {logo: logo, content: ['HIUI', '做中台,就用 HIUI'],density:'high'} + this.options = { + logo: logo, // 本地图片路径或者base64 + content: ['HIUI', '做中台,就用 HIUI'], + } } render () { return ( -
) @@ -25,10 +29,6 @@ class Demo extends React.Component { }` const DemoBase = () => ( - ) + +) export default DemoBase diff --git a/docs/zh-CN/components/button.mdx b/docs/zh-CN/components/button.mdx index a93678da9..2c6d0e7b0 100755 --- a/docs/zh-CN/components/button.mdx +++ b/docs/zh-CN/components/button.mdx @@ -56,6 +56,7 @@ import DemoGroup from '../../demo/button/section-group.jsx' | ---------- | --------------------------------------------- | ----------------------- | --------------------------------------------------------- | --------- | | type | 设置按钮类型 | string | 'primary' \| 'line' \| 'success' \| 'danger' \| 'default' | 'default' | | appearance | 设置按钮外观 | string | 'link' \| 'button' | 'button' | +| disabled | 设置按钮是否禁用 | boolean | true \| false | false | | size | 设置按钮尺寸 | string | 'large' \| 'default' \| 'small' | 'default' | | icon | 设置按钮图标 | string | 详见 [``](/hiui/zh-CN/docs/icon) 组件 ︎ | - | | href | 设置按钮链接,设置后将用 a 标签渲染按钮 | string | ︎ | - | diff --git a/docs/zh-CN/components/cascader.mdx b/docs/zh-CN/components/cascader.mdx index cdfe3e795..42fb00841 100644 --- a/docs/zh-CN/components/cascader.mdx +++ b/docs/zh-CN/components/cascader.mdx @@ -41,6 +41,7 @@ import { Badge } from '@libs' | displayRender | 自定义选择后展示的内容 | (value: string[]) => string | - | - | | style | 自定义样式 | object | - | - | | onChange | 选择后的回调 | (value: string[]) => void | - | - | +| trigger | 展开下一级的触发方式 | string | 'hover' \| 'click' | 'click' | ## Type diff --git a/docs/zh-CN/components/changelog.mdx b/docs/zh-CN/components/changelog.mdx index f450a1c01..b577119d4 100644 --- a/docs/zh-CN/components/changelog.mdx +++ b/docs/zh-CN/components/changelog.mdx @@ -1,5 +1,44 @@ # 更新日志 +## 2.13.0 + +- 修复 `` 行高不正确问题 [#1061](https://github.com/XiaoMi/hiui/issues/1061) +- 修复 `` 在单选情况下受控时清空报错的问题 [#1070](https://github.com/XiaoMi/hiui/issues/1070) +- 修复 `` 受控模式的异步多选,默认选项消失的问题 [#1047](https://github.com/XiaoMi/hiui/issues/1047) +- 修复 `` validate 验证不通过回调函数没有调用的问题 [#1059](https://github.com/XiaoMi/hiui/issues/1059) +- 修复 `` 校验不通过时的样式问题 [#1042](https://github.com/XiaoMi/hiui/issues/1042) [#1036](https://github.com/XiaoMi/hiui/issues/1036) +- 修复 `` 高度不正确问题 [#1053](https://github.com/XiaoMi/hiui/issues/1053) +- 修复 `` 同时展开多个的问题 [#1066](https://github.com/XiaoMi/hiui/issues/1066) +- 修复 ``、`` 白色背景的问题 [#1049](https://github.com/XiaoMi/hiui/issues/1049) +- 修复 `` 上传过程中 maxCount 不起作用的问题 [#1032](https://github.com/XiaoMi/hiui/issues/1032) +- 修复 `` 拖拽上传时,tips 展示不正确的问题 [#1041](https://github.com/XiaoMi/hiui/issues/1041) +- 修复 `` 点击每月 31 号,输入框显示异常的问题 [#1039](https://github.com/XiaoMi/hiui/issues/1039) +- 修复 `` 在 type 为 date 时执行了农历方法的问题 [#1050](https://github.com/XiaoMi/hiui/issues/1050) +- 修复 `` 切换月异常的问题 [#1079](https://github.com/XiaoMi/hiui/issues/1079) +- 修复 `