Browse Source

Merge branch 'main' into release

chore: fix conflict
zhangyumei.0319 3 years ago
parent
commit
b9d18cb940

+ 2 - 0
content/start/changelog/index-en-US.md

@@ -33,6 +33,8 @@ Version:Major.Minor.Patch
 - 【Feat】
     - `InputNumber` adds A11y keyboard and focus adaptation. which supports holding shift and up and down arrows at the same time in the input box to adjust a larger number range [#205](https://github.com/DouyinFE/semi-design/issues/205)
     - `Checkbox` add A11y keyboard and focus adaptation  [#205](https://github.com/DouyinFE/semi-design/issues/205)
+    - TagInput Click prefix, suffix to automatically focus to the internal Input [#874](https://github.com/DouyinFE/semi-design/issues/874) [@yykoypj](https://github.com/yykoypj)
+    - Form.TagInput supports labelPosition: 'inset' inline label [#874](https://github.com/DouyinFE/semi-design/issues/874) [@yykoypj](https://github.com/yykoypj)
 - 【Fix】
     - Fixed the problem that when Select filter and showClear are true, when clicking the clear icon, only onClear is triggered, but onSearch is not triggered, and after clearing the search item through the clear icon, the candidate Option list is not reset  [#867](https://github.com/DouyinFE/semi-design/issues/867)
     - Fix the problem that onSearch is not triggered when Select filter is true, lose focus, and input input is reset automatically  [#867](https://github.com/DouyinFE/semi-design/issues/867)

+ 2 - 0
content/start/changelog/index.md

@@ -32,6 +32,8 @@ Semi 版本号遵循**Semver**规范(主版本号-次版本号-修订版本号
 - 【Feat】
     - InputNumber 新增 A11y 键盘适配。支持在输入框同时按住 shift 和上下箭头调整较大的数字范围
     - Checkbox 新增 A11y 键盘和焦点适配 [#205](https://github.com/DouyinFE/semi-design/issues/205)
+    - TagInput 点击 prefix、suffix 自动聚焦至内部 Input [#874](https://github.com/DouyinFE/semi-design/issues/874) [@yykoypj](https://github.com/yykoypj)
+    - Form.TagInput 支持 labelPosition: 'inset' 内嵌标签 [#874](https://github.com/DouyinFE/semi-design/issues/874) [@yykoypj](https://github.com/yykoypj)
 - 【Fix】
     - 修复 Select filter 、showClear 为 true 时,点击 clear icon时,只触发 onClear,未触发 onSearch 的问题及通过 clear icon 清除搜索项后,未重置候选Option列表的问题  [#867](https://github.com/DouyinFE/semi-design/issues/867)
     - 修复 Select filter 为true,失去焦点,input 输入被自动重置时,未触发 onSearch 的问题  [#867](https://github.com/DouyinFE/semi-design/issues/867)

+ 7 - 0
cypress/integration/cascader.spec.js

@@ -115,4 +115,11 @@ describe('cascader', () => {
         cy.get('input').should('have.value', 'yazhou not exist');
     });
    
+    it('multiple onChangeWithObject value=undefined', () => {
+        cy.visit('http://127.0.0.1:6006/iframe.html?id=cascader--undefined-value-while-mutiple-and-on-change-with-object&args=&viewMode=story');
+        cy.get('.semi-cascader-selection-placeholder').contains('请选择所在地区');
+        cy.get('.semi-cascader').click();
+        cy.get('.semi-checkbox').eq(0).click();
+        cy.get('.semi-tag-content').contains('亚洲');
+    })
 });

+ 20 - 0
packages/semi-foundation/overflowList/foundation.ts

@@ -16,6 +16,8 @@ class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
         super({ ...adapter });
     }
 
+    previousY = undefined;
+
     isScrollMode = (): boolean => {
         const { renderMode } = this.getProps();
         return renderMode === 'scroll';
@@ -47,6 +49,24 @@ class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
             res[itemKey] = entry;
             visibleState.set(itemKey, visible);
         });
+        let someItemVisible = false;
+        for (const value of visibleState.values()) {
+            if (value) {
+                someItemVisible = true;
+                break;
+            }
+        }
+        // Any item is visible, indicating that the List is visible
+        const wholeListVisible = someItemVisible;
+        // If scrolling in the vertical direction makes the List invisible, no processing is required. 
+        // If this.previousY is undefined, it means that the List is mounted for the first time and will not be processed.
+        const [entry1] = entries;
+        const currentY = entry1.boundingClientRect.y;
+        if (!wholeListVisible && this.previousY !== undefined && currentY !== this.previousY) {
+            this.previousY = currentY;
+            return;
+        }
+        this.previousY = currentY;
         this._adapter.updateVisibleState(visibleState);
         this._adapter.notifyIntersect(res);
     }

+ 0 - 20
packages/semi-foundation/tree/tree.scss

@@ -3,26 +3,6 @@
 $module: #{$prefix}-tree;
 
 .#{$module} {
-    box-sizing: border-box;
-    border-radius: $radius-tree;
-    border: 1px solid $color-tree_default-border-default;
-    height: $height-tree_default;
-    line-height: $height-tree_default;
-    font-weight: $font-tree_default-fontWeight;
-    background-color: $color-tree_default-bg-default;
-    display: inline-block;
-    vertical-align: middle;
-    position: relative;
-    cursor: pointer;
-
-    &:hover {
-        background-color: $color-tree_default-bg-hover;
-    }
-
-    &-focus {
-        border: $width-tree_focus-border solid $color-tree_default-border-focus;
-        outline: 0;
-    }
 
     &-search-wrapper {
         padding: $spacing-tree_search_wrapper-paddingY $spacing-tree_search_wrapper-paddingX;

+ 0 - 18
packages/semi-foundation/tree/variables.scss

@@ -1,10 +1,3 @@
-$color-tree_default-bg-default: var(--semi-color-fill-0); // 树背景颜色 - 默认
-$color-tree_default-border-default: transparent; // 树描边颜色 - 默认
-$color-tree_default-icon-default: var(--semi-color-text-2); // 树图标颜色 - 默认
-$color-tree_default-bg-hover: var(--semi-color-fill-1); // 树背景颜色 - 悬停
-
-$color-tree_default-border-focus: var(--semi-color-focus-border); // 树描边颜色 - 按下
-
 $color-tree_option-text-default: var(--semi-color-text-0); // 树选项文字颜色
 $color-tree_option-icon-default: var(--semi-color-text-2); // 树选项图标颜色
 
@@ -19,13 +12,9 @@ $color-tree_option_loading-icon-default: var(--semi-color-primary); // 树选项
 
 $color-tree_option_draggable_insert-border-default: var(--semi-color-primary); // 树选项加载 spin 颜色
 
-$height-tree_default: $height-control-default; // 树选项高度 - 默认
-
-$font-tree_default-fontWeight: $font-weight-regular; // 树选项文本字重 - 默认
 $font-tree_option_hightlight-fontWeight: $font-weight-bold; // 树选项高亮文本字重
 $color-tree_option_hightlight-text: var(--semi-color-primary); // 树选项高亮文本颜色
 
-$radius-tree: var(--semi-border-radius-small); // 树整体圆角
 $radius-tree_checkbox_addon: var(--semi-border-radius-small); // 多选树 checkbox 圆角
 
 $spacing-tree_search_wrapper-paddingX: 12px; // 树搜索框水平内边距
@@ -41,14 +30,7 @@ $spacing-tree_icon-marginRight: 8px; // 树选项图标右侧外边距
 $spacing-tree_label_withIcon-marginRight: 8px; // 树选项图标右侧外边距
 $spacing-tree_option_draggable-paddingY: 3px; // 可拖拽的树选项垂直内边距
 $spacing-tree_option_draggable-paddingX: 0; // 可拖拽的树选项水平内边距
-$spacing-tree_spinIcon-paddingY: 4px; // 树选项加载 spin 垂直内边距 (已废弃)
-$spacing-tree_spinIcon-paddingX: 0; // 树选项加载 spin 水平内边距 (已废弃)
 
-$width-tree-border: 1px; // 树选项描边宽度
-$width-tree_arrow: 32px; // 树选项箭头宽度
 $width-tree_emptyIcon: $width-icon-small; // 树选项空图标宽度
 $width-tree_spinIcon: $width-icon-small; // 树选项加载 spin 宽度
-$width-tree_focus-border: $border-thickness-control-focus; // 树选中态描边宽度
-$width-tree_option:  230px; // 树选项宽度
-$width-tree_search_wrapper-border: 1px; // 树搜索框容器描边宽度
 $width-tree_option_draggable-border: 2px; // 可拖拽的树标示线宽度

+ 21 - 0
packages/semi-ui/cascader/_story/cascader.stories.js

@@ -1276,6 +1276,27 @@ export const OnChangeWithObject = () => (
   </>
 );
 
+export const undefinedValueWhileMutipleAndOnChangeWithObject = () => {
+  const [value, setValue] = useState(undefined);
+  
+  return (
+    <>
+      <div>多选 + onChangeWithObject + value 为 undefined</div>
+      <Cascader
+        multiple
+        onChangeWithObject
+        style={{ width: 300 }}
+        treeData={treeData2}
+        placeholder="请选择所在地区"
+        value={value}
+        onChange={(v)=>{
+          setValue(v);
+        }}
+      />
+    </>
+  )
+}
+
 export const LeafOnly = () => {
   const [value, setValue] = useState([])
   return (