Skip to content

Commit

Permalink
Merge branch 'master' of github.com:alibaba-fusion/next into feat/1.26
Browse files Browse the repository at this point in the history
  • Loading branch information
lakerswgq committed Jun 27, 2022
2 parents 88147bd + 05b389e commit d39a374
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 44 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Change Log

## [1.25.44](https://github.com/alibaba-fusion/next/compare/1.25.43...1.25.44) (2022-06-21)


### Bug Fixes

* **Table:** table d.ts add wordBreak props ([#3960](https://github.com/alibaba-fusion/next/issues/3960)) ([5163641](https://github.com/alibaba-fusion/next/commit/5163641))
* **Tree:** not calculate all checked value when checkedStrategy is child ([#3961](https://github.com/alibaba-fusion/next/issues/3961)) ([5e2c577](https://github.com/alibaba-fusion/next/commit/5e2c577))
* **TreeSelect:** support turn off local filter, close [#3939](https://github.com/alibaba-fusion/next/issues/3939) ([#3959](https://github.com/alibaba-fusion/next/issues/3959)) ([6f6b3f1](https://github.com/alibaba-fusion/next/commit/6f6b3f1))




## [1.25.43](https://github.com/alibaba-fusion/next/compare/1.25.42...1.25.43) (2022-06-16)


### Bug Fixes

* **Form:** fix onSubmit types ([#3955](https://github.com/alibaba-fusion/next/issues/3955)) ([99ff66f](https://github.com/alibaba-fusion/next/commit/99ff66f))




## [1.25.42](https://github.com/alibaba-fusion/next/compare/1.25.41...1.25.42) (2022-06-14)


Expand Down
14 changes: 4 additions & 10 deletions LATESTLOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
# Latest Log

## [1.25.42](https://github.com/alibaba-fusion/next/compare/1.25.41...1.25.42) (2022-06-14)
## [1.25.44](https://github.com/alibaba-fusion/next/compare/1.25.43...1.25.44) (2022-06-21)


### Bug Fixes

* **Menu:** focuseKey type contain obj, close [#3929](https://github.com/alibaba-fusion/next/issues/3929) ([086937b](https://github.com/alibaba-fusion/next/commit/086937b))
* **Slider:** add pauseOnHover on d.ts ([#3950](https://github.com/alibaba-fusion/next/issues/3950)) ([fc8d20f](https://github.com/alibaba-fusion/next/commit/fc8d20f))
* **TreeSelect:** calculate all checked value only when treeCheckedStrategy=all, close[#3936](https://github.com/alibaba-fusion/next/issues/3936) ([35ff149](https://github.com/alibaba-fusion/next/commit/35ff149))
* **TreeSelect:** fix treeCheckedStrategy issue ([2558ce7](https://github.com/alibaba-fusion/next/commit/2558ce7))


### Features

* **Form:** new api errorMessageName for replace validate name fix [#3937](https://github.com/alibaba-fusion/next/issues/3937) ([ed0915d](https://github.com/alibaba-fusion/next/commit/ed0915d))
* **Table:** table d.ts add wordBreak props ([#3960](https://github.com/alibaba-fusion/next/issues/3960)) ([5163641](https://github.com/alibaba-fusion/next/commit/5163641))
* **Tree:** not calculate all checked value when checkedStrategy is child ([#3961](https://github.com/alibaba-fusion/next/issues/3961)) ([5e2c577](https://github.com/alibaba-fusion/next/commit/5e2c577))
* **TreeSelect:** support turn off local filter, close [#3939](https://github.com/alibaba-fusion/next/issues/3939) ([#3959](https://github.com/alibaba-fusion/next/issues/3959)) ([6f6b3f1](https://github.com/alibaba-fusion/next/commit/6f6b3f1))


2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ Or clone locally:

Use [Dingtalk App](https://www.dingtalk.com/en) scan the Qrcode to join in _Dingtalk Group_ :

<img alt="Join the chat at dingtalk" src="https://img.alicdn.com/tfs/TB1r2GoU6DpK1RjSZFrXXa78VXa-620-818.png" width="300">
<img alt="Join the chat at dingtalk" src="https://img.alicdn.com/imgextra/i4/O1CN01tU6PeE1EIj4H0LvpC_!!6000000000329-0-tps-859-1184.jpg" width="300">
2 changes: 1 addition & 1 deletion README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ babel 配置:

扫码*钉钉群* 加入即刻交流与反馈:

<img alt="Join the chat at dingtalk" src="https://img.alicdn.com/tfs/TB1r2GoU6DpK1RjSZFrXXa78VXa-620-818.png" width="300">
<img alt="Join the chat at dingtalk" src="https://img.alicdn.com/imgextra/i4/O1CN01tU6PeE1EIj4H0LvpC_!!6000000000329-0-tps-859-1184.jpg" width="300">
1 change: 1 addition & 0 deletions docs/tree-select/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
| tagInline | 是否一行显示,仅在 multiple 和 treeCheckable 为 true 时生效 | Boolean | false | 1.25 |
| maxTagPlaceholder | 隐藏多余 tag 时显示的内容,在 tagInline 生效时起作用<br/><br/>**签名**:<br/>Function(selectedValues: Array, totalValues: Array) => reactNode<br/>**参数**:<br/>_selectedValues_: {Array} 当前已选中的元素<br/>_totalValues_: {Array} 总待选元素<br/>**返回值**:<br/>{reactNode} null<br/> | Function | - | 1.25 |
| showSearch | 是否显示搜索框 | Boolean | false | |
| filterLocal | 是否使用本地过滤,在数据源为远程的时候需要关闭此项 | Boolean | true | |
| onSearch | 在搜索框中输入时触发的回调函数<br/><br/>**签名**:<br/>Function(keyword: String) => void<br/>**参数**:<br/>_keyword_: {String} 输入的关键字 | Function | () => {} | |
| notFoundContent | 无数据时显示内容 | ReactNode | 'Not Found' | |
| multiple | 是否支持多选 | Boolean | false | |
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var next = require('./lib/index.js');

next.version = '1.25.42';
next.version = '1.25.44';

module.exports = next;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alifd/next",
"version": "1.25.42",
"version": "1.25.44",
"description": "A configurable component library for web built on React.",
"keywords": [
"fusion",
Expand Down
8 changes: 7 additions & 1 deletion src/tree-select/tree-select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ class TreeSelect extends Component {
* 是否显示搜索框
*/
showSearch: PropTypes.bool,
/**
* 是否使用本地过滤,在数据源为远程的时候需要关闭此项
*/
filterLocal: PropTypes.bool,
/**
* 在搜索框中输入时触发的回调函数
* @param {String} keyword 输入的关键字
Expand Down Expand Up @@ -314,6 +318,7 @@ class TreeSelect extends Component {
onChange: noop,
tagInline: false,
showSearch: false,
filterLocal: true,
onSearch: noop,
onSearchClear: noop,
notFoundContent: 'Not Found',
Expand Down Expand Up @@ -766,6 +771,7 @@ class TreeSelect extends Component {
treeLoadData,
treeProps: customTreeProps = {},
showSearch,
filterLocal,
dataSource,
children,
readOnly,
Expand Down Expand Up @@ -812,7 +818,7 @@ class TreeSelect extends Component {

let notFound = false;
let newChildren;
if (showSearch && searchedValue) {
if (filterLocal && showSearch && searchedValue) {
treeProps.expandedKeys = expandedKeys;
treeProps.autoExpandParent = autoExpandParent;
treeProps.onExpand = this.handleExpand;
Expand Down
9 changes: 7 additions & 2 deletions src/tree/view/tree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const getCheckedKeys = (props, willReceiveProps, _k2n, _p2n) => {
checkedKeys = [];
}

const { checkStrictly } = props; // TODO TEST
const { checkStrictly, checkedStrategy } = props; // TODO TEST
if (checkStrictly) {
if (isPlainObject(checkedKeys)) {
const { checked, indeterminate } = checkedKeys;
Expand All @@ -142,7 +142,11 @@ const getCheckedKeys = (props, willReceiveProps, _k2n, _p2n) => {

checkedKeys = checkedKeys.filter(key => !!_k2n[key]);
} else {
checkedKeys = getAllCheckedKeys(checkedKeys, _k2n, _p2n);
if (checkedStrategy !== 'child') {
// checkedStrategy 为 child 时不需要计算所有可选值
checkedKeys = getAllCheckedKeys(checkedKeys, _k2n, _p2n);
}

checkedKeys = checkedKeys.filter(key => !!_k2n[key]);

indeterminateKeys = getIndeterminateKeys(checkedKeys, props.checkStrictly, _k2n, _p2n);
Expand Down Expand Up @@ -889,6 +893,7 @@ class Tree extends Component {
}

let newCheckedKeys;

switch (checkedStrategy) {
case 'parent':
newCheckedKeys = filterChildKey(checkedKeys, _k2n, _p2n);
Expand Down
22 changes: 22 additions & 0 deletions test/tree-select/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,28 @@ describe('TreeSelect', () => {
assert(document.querySelector('.next-tree-select-not-found').textContent.trim() === 'Not Found');
});

it('should turn off local search when filterLocal is false', () => {
wrapper = mount(
<TreeSelect
defaultVisible
filterLocal={false}
treeDefaultExpandAll
dataSource={dataSource}
showSearch
style={{ width: 200 }}
useVirtual
treeProps={{
style: { maxHeight: '100px', overflow: 'auto' },
}}
/>
)

wrapper.find('.next-select-trigger-search input').simulate('change', { target: { value: '外套' } });
wrapper.update();

assertDataAndNodes(dataSource);
})

it('fix issues use isPreview when value is empty', () => {
wrapper = mount(<TreeSelect isPreview dataSource={dataSource} />);
assert(wrapper.find('.next-form-preview').instance().textContent === '');
Expand Down
36 changes: 9 additions & 27 deletions types/form/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ type SpanOffset = {
span?: string | number;
offset?: string | number;
[propName: string]: any;
}
};

export interface ItemProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
/**
* 表单名
*/
* 表单名
*/
name?: string;

/**
Expand Down Expand Up @@ -90,7 +90,7 @@ export interface ItemProps extends React.HTMLAttributes<HTMLElement>, CommonProp
/**
* 是否禁用
*/
disabled?: boolean;
disabled?: boolean;

/**
* [表单校验] 不能为空
Expand Down Expand Up @@ -274,15 +274,7 @@ export interface SubmitProps extends HTMLAttributesWeak, CommonProps {
/**
* 按钮中 Icon 的尺寸,用于替代 Icon 的默认大小
*/
iconSize?:
| 'xxs'
| 'xs'
| 'small'
| 'medium'
| 'large'
| 'xl'
| 'xxl'
| 'xxxl';
iconSize?: 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl';

/**
* 当 component = 'button' 时,设置 button 标签的 type 值
Expand Down Expand Up @@ -355,17 +347,7 @@ export interface ResetProps extends HTMLAttributesWeak, CommonProps {
/**
* 按钮中 Icon 的尺寸,用于替代 Icon 的默认大小
*/
iconSize?:
| number
| 'xxs'
| 'xs'
| 'small'
| 'medium'
| 'large'
| 'xl'
| 'xxl'
| 'xxxl'
| 'inherit';
iconSize?: number | 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' | 'inherit';

/**
* 当 component = 'button' 时,设置 button 标签的 type 值
Expand Down Expand Up @@ -498,7 +480,7 @@ export interface FormProps extends HTMLAttributesWeak, CommonProps {
/**
* form内有 `htmlType="submit"` 的元素的时候会触发
*/
onSubmit?: () => void;
onSubmit?: React.FormEventHandler<HTMLFormElement>;

/**
* 子元素
Expand All @@ -513,7 +495,7 @@ export interface FormProps extends HTMLAttributesWeak, CommonProps {
/**
* 是否禁用
*/
disabled?: boolean;
disabled?: boolean;

/**
* 自定义内联样式
Expand Down Expand Up @@ -547,7 +529,7 @@ export interface FormProps extends HTMLAttributesWeak, CommonProps {
/**
* 是否使用 label 替换校验信息的 name 字段
*/
useLabelForErrorMessage?: boolean
useLabelForErrorMessage?: boolean;
}

export default class Form extends React.Component<FormProps, any> {
Expand Down
5 changes: 5 additions & 0 deletions types/table/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ export interface ColumnProps extends HTMLAttributesWeak, CommonProps {
* header cell 横跨的格数,设置为0表示不出现此 th
*/
colSpan?: number;

/**
* 设置该列单元格的word-break样式,对于id类、中文类适合用all,对于英文句子适合用word
*/
wordBreak?: 'all' | 'word';
}

export class Column extends React.Component<ColumnProps, any> {}
Expand Down
5 changes: 5 additions & 0 deletions types/tree-select/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ export interface TreeSelectProps extends HTMLAttributesWeak, CommonProps {
* 是否开启虚拟滚动
*/
useVirtual?: boolean;

/**
* 是否关闭本地搜索
*/
filterLocal?: boolean;

immutable?: boolean;
}
Expand Down

0 comments on commit d39a374

Please sign in to comment.