From 7a33369dc01195edf5da7b15f7b9f2d45aa94ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=8A=E6=B7=9E?= Date: Thu, 5 Dec 2024 20:37:37 +0800 Subject: [PATCH 1/9] fix(CascaderSelect): The value of the menuProps attribute is passed by props --- .../cascader-select/__docs__/index.en-us.md | 56 ++++++++--------- components/cascader-select/__docs__/index.md | 56 ++++++++--------- .../cascader-select/__tests__/index-spec.tsx | 8 +++ components/cascader-select/types.ts | 4 +- components/cascader/__docs__/index.en-us.md | 4 +- components/cascader/__docs__/index.md | 6 +- components/cascader/__tests__/index-spec.tsx | 61 +++++++++++++++++++ components/cascader/cascader.tsx | 41 +++++++++++-- components/cascader/types.ts | 18 +++++- 9 files changed, 187 insertions(+), 67 deletions(-) diff --git a/components/cascader-select/__docs__/index.en-us.md b/components/cascader-select/__docs__/index.en-us.md index 7181b1f8ad..2fdf285860 100644 --- a/components/cascader-select/__docs__/index.en-us.md +++ b/components/cascader-select/__docs__/index.en-us.md @@ -21,34 +21,34 @@ Inherits partial props from Cascader, support passing props to Cascader: dataSou checkStrictly, resultRender, expandedValue, defaultExpandedValue, expandTriggerType, onExpand, listStyle, listClassName, loadData, i temRender, immutable. Support passing props to Select: other Select props except those listed above and those listed below. -| Param | Description | Type | Default Value | Required | Supported Version | -| -------------------- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | -------- | ----------------- | -| size | Size | 'small' \| 'medium' \| 'large' | 'medium' | | - | -| disabled | Disabled | boolean | false | | - | -| hasArrow | HasArrow | boolean | true | | - | -| hasBorder | HasBorder | boolean | true | | - | -| hasClear | HasClear | boolean | false | | - | -| readOnly | ReadOnly, popup layer can be expanded but cannot be selected in read | boolean | - | | - | -| defaultValue | Default value(not controlled) | string \| Array\ | - | | - | -| value | Current value(controlled) | string \| Array\ | - | | - | -| onChange | Callback when selected value changes | (
value: string \| Array\ \| null,
data: CascaderDataItem \| Array\ \| null,
extra?: Extra
) => void | - | | - | -| changeOnSelect | Whether to call onChange as soon as selected, this property only works in single selection mode | boolean | false | | - | -| displayRender | Custom render function of selected result | (
label: Array\,
data: CascaderSelectDataItem
) => React.ReactNode | - | | - | -| showSearch | Show search box | boolean | false | | - | -| filter | Custom search function | (searchValue: string, path: CascaderSelectDataItem[]) => boolean | - | | - | -| onSearch | Callback when search value changes | (value: string) => void | - | | 1.23 | -| resultAutoWidth | Whether the search result list is the same width as the selection box | boolean | true | | - | -| notFoundContent | Content when no data | React.ReactNode | - | | - | -| header | Custom dropdown header | React.ReactNode | - | | - | -| footer | Custom dropdown footer | React.ReactNode | - | | - | -| defaultVisible | Visible by default | boolean | false | | - | -| visible | Current visible | boolean | - | | - | -| onVisibleChange | - | (visible: boolean, type?: CascaderSelectVisibleChangeType) => void | - | | - | -| popupProps | Props object passed to Popup | React.ComponentPropsWithRef\ | - | | - | -| isPreview | Whether it is in preview mode | boolean | false | | - | -| renderPreview | Custom preview | (
value: CascaderSelectDataItem \| CascaderSelectDataItem[],
props: CascaderSelectProps
) => React.ReactNode | - | | - | -| menuProps | Props object passed to Cascader | Omit\ | - | | - | -| autoClearSearchValue | Whether the current search will be cleared on selecting an item. Only applies when multiple is true | boolean | false | | - | +| Param | Description | Type | Default Value | Required | Supported Version | +| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | -------- | ----------------- | +| size | Size | 'small' \| 'medium' \| 'large' | 'medium' | | - | +| disabled | Disabled | boolean | false | | - | +| hasArrow | HasArrow | boolean | true | | - | +| hasBorder | HasBorder | boolean | true | | - | +| hasClear | HasClear | boolean | false | | - | +| readOnly | ReadOnly, popup layer can be expanded but cannot be selected in read | boolean | - | | - | +| defaultValue | Default value(not controlled) | string \| Array\ | - | | - | +| value | Current value(controlled) | string \| Array\ | - | | - | +| onChange | Callback when selected value changes | (
value: string \| Array\ \| null,
data: CascaderDataItem \| Array\ \| null,
extra?: Extra
) => void | - | | - | +| changeOnSelect | Whether to call onChange as soon as selected, this property only works in single selection mode | boolean | false | | - | +| displayRender | Custom render function of selected result | (
label: Array\,
data: CascaderSelectDataItem
) => React.ReactNode | - | | - | +| showSearch | Show search box | boolean | false | | - | +| filter | Custom search function | (searchValue: string, path: CascaderSelectDataItem[]) => boolean | - | | - | +| onSearch | Callback when search value changes | (value: string) => void | - | | 1.23 | +| resultAutoWidth | Whether the search result list is the same width as the selection box | boolean | true | | - | +| notFoundContent | Content when no data | React.ReactNode | - | | - | +| header | Custom dropdown header | React.ReactNode | - | | - | +| footer | Custom dropdown footer | React.ReactNode | - | | - | +| defaultVisible | Visible by default | boolean | false | | - | +| visible | Current visible | boolean | - | | - | +| onVisibleChange | - | (visible: boolean, type?: CascaderSelectVisibleChangeType) => void | - | | - | +| popupProps | Props object passed to Popup | React.ComponentPropsWithRef\ | - | | - | +| isPreview | Whether it is in preview mode | boolean | false | | - | +| renderPreview | Custom preview | (
value: CascaderSelectDataItem \| CascaderSelectDataItem[],
props: CascaderSelectProps
) => React.ReactNode | - | | - | +| menuProps | Props object passed to Cascader:The parameters focusedKey, onItemFocus, className, style, focusable, and isSelectIconRight are invalid. Additionally, onBlur is invalid when passed under the filter | Omit\ | - | | - | +| autoClearSearchValue | Whether the current search will be cleared on selecting an item. Only applies when multiple is true | boolean | false | | - | diff --git a/components/cascader-select/__docs__/index.md b/components/cascader-select/__docs__/index.md index dea6676207..960a60f7d9 100644 --- a/components/cascader-select/__docs__/index.md +++ b/components/cascader-select/__docs__/index.md @@ -21,34 +21,34 @@ checkStrictly, resultRender, expandedValue, defaultExpandedValue, expandTriggerType, onExpand, listStyle, listClassName, loadData, itemRender, immutable。支持透传给 Select 的包括除上面传给 Cascader 和下方单独列出的属性以外的其他全部属性。 -| 参数 | 说明 | 类型 | 默认值 | 是否必填 | 支持版本 | -| -------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | -------- | -| size | 选择框大小 | 'small' \| 'medium' \| 'large' | 'medium' | | - | -| disabled | 是否禁用 | boolean | false | | - | -| hasArrow | 是否有下拉箭头 | boolean | true | | - | -| hasBorder | 是否有边框 | boolean | true | | - | -| hasClear | 是否有清除按钮 | boolean | false | | - | -| readOnly | 是否只读,只读模式下可以展开弹层但不能选 | boolean | - | | - | -| defaultValue | (非受控)默认值 | string \| Array\ | - | | - | -| value | (受控)当前值 | string \| Array\ | - | | - | -| onChange | 选中值改变时触发的回调函数 | (
value: string \| Array\ \| null,
data: CascaderDataItem \| Array\ \| null,
extra?: Extra
) => void | - | | - | -| changeOnSelect | 是否选中即发生改变,该属性仅在单选模式下有效 | boolean | false | | - | -| displayRender | 选择框单选时展示结果的自定义渲染函数 | (
label: Array\,
data: CascaderSelectDataItem
) => React.ReactNode | - | | - | -| showSearch | 是否显示搜索框 | boolean | false | | - | -| filter | 自定义搜索函数 | (searchValue: string, path: CascaderSelectDataItem[]) => boolean | - | | - | -| onSearch | 当搜索框值变化时回调 | (value: string) => void | - | | 1.23 | -| resultAutoWidth | 搜索结果列表是否和选择框等宽 | boolean | true | | - | -| notFoundContent | 无数据时显示内容 | React.ReactNode | - | | - | -| header | 自定义下拉框头部 | React.ReactNode | - | | - | -| footer | 自定义下拉框底部 | React.ReactNode | - | | - | -| defaultVisible | 初始下拉框是否显示 | boolean | false | | - | -| visible | 当前下拉框是否显示 | boolean | - | | - | -| onVisibleChange | 下拉框显示或关闭时触发事件的回调函数 | (visible: boolean, type?: CascaderSelectVisibleChangeType) => void | - | | - | -| popupProps | 透传到 Popup 的属性对象 | React.ComponentPropsWithRef\ | - | | - | -| isPreview | 是否为预览态 | boolean | false | | - | -| renderPreview | 自定义预览态 | (
value: CascaderSelectDataItem \| CascaderSelectDataItem[],
props: CascaderSelectProps
) => React.ReactNode | - | | - | -| menuProps | 透传到 Cascader 的属性对象 | Omit\ | - | | - | -| autoClearSearchValue | 是否在选中项后清空搜索框,只在 multiple 为 true 时有效 | boolean | false | | - | +| 参数 | 说明 | 类型 | 默认值 | 是否必填 | 支持版本 | +| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | -------- | +| size | 选择框大小 | 'small' \| 'medium' \| 'large' | 'medium' | | - | +| disabled | 是否禁用 | boolean | false | | - | +| hasArrow | 是否有下拉箭头 | boolean | true | | - | +| hasBorder | 是否有边框 | boolean | true | | - | +| hasClear | 是否有清除按钮 | boolean | false | | - | +| readOnly | 是否只读,只读模式下可以展开弹层但不能选 | boolean | - | | - | +| defaultValue | (非受控)默认值 | string \| Array\ | - | | - | +| value | (受控)当前值 | string \| Array\ | - | | - | +| onChange | 选中值改变时触发的回调函数 | (
value: string \| Array\ \| null,
data: CascaderDataItem \| Array\ \| null,
extra?: Extra
) => void | - | | - | +| changeOnSelect | 是否选中即发生改变,该属性仅在单选模式下有效 | boolean | false | | - | +| displayRender | 选择框单选时展示结果的自定义渲染函数 | (
label: Array\,
data: CascaderSelectDataItem
) => React.ReactNode | - | | - | +| showSearch | 是否显示搜索框 | boolean | false | | - | +| filter | 自定义搜索函数 | (searchValue: string, path: CascaderSelectDataItem[]) => boolean | - | | - | +| onSearch | 当搜索框值变化时回调 | (value: string) => void | - | | 1.23 | +| resultAutoWidth | 搜索结果列表是否和选择框等宽 | boolean | true | | - | +| notFoundContent | 无数据时显示内容 | React.ReactNode | - | | - | +| header | 自定义下拉框头部 | React.ReactNode | - | | - | +| footer | 自定义下拉框底部 | React.ReactNode | - | | - | +| defaultVisible | 初始下拉框是否显示 | boolean | false | | - | +| visible | 当前下拉框是否显示 | boolean | - | | - | +| onVisibleChange | 下拉框显示或关闭时触发事件的回调函数 | (visible: boolean, type?: CascaderSelectVisibleChangeType) => void | - | | - | +| popupProps | 透传到 Popup 的属性对象 | React.ComponentPropsWithRef\ | - | | - | +| isPreview | 是否为预览态 | boolean | false | | - | +| renderPreview | 自定义预览态 | (
value: CascaderSelectDataItem \| CascaderSelectDataItem[],
props: CascaderSelectProps
) => React.ReactNode | - | | - | +| menuProps | 透传到 Cascader 的属性对象;focusedKey、onItemFocus、className、style、focusable、isSelectIconRight 传入无效,其中 onBlur 在 filter 下传入无效 | Omit\ | - | | - | +| autoClearSearchValue | 是否在选中项后清空搜索框,只在 multiple 为 true 时有效 | boolean | false | | - | diff --git a/components/cascader-select/__tests__/index-spec.tsx b/components/cascader-select/__tests__/index-spec.tsx index a80851ea2e..0ace606759 100644 --- a/components/cascader-select/__tests__/index-spec.tsx +++ b/components/cascader-select/__tests__/index-spec.tsx @@ -558,4 +558,12 @@ describe('CascaderSelect', () => { cy.get('.next-tag').invoke('text').should('eq', '西安'); cy.get('.next-select-trigger-search input').should('have.text', ''); }); + + it('should support The value of the menuProps attribute is passed by props, close #3852', () => { + cy.mount( + + ); + cy.get('.next-select').click(); + cy.get('.next-menu-item').first().should('have.class', 'test-list-cls'); + }); }); diff --git a/components/cascader-select/types.ts b/components/cascader-select/types.ts index 21ff107ece..4a8691e7fc 100644 --- a/components/cascader-select/types.ts +++ b/components/cascader-select/types.ts @@ -244,8 +244,8 @@ export interface CascaderSelectProps */ treeCheckable?: boolean; /** - * 透传到 Cascader 的属性对象 - * @en props object passed to Cascader + * 透传到 Cascader 的属性对象;focusedKey、onItemFocus、className、style、focusable、isSelectIconRight 传入无效,其中 onBlur 在 filter 下传入无效 + * @en props object passed to Cascader:The parameters focusedKey, onItemFocus, className, style, focusable, and isSelectIconRight are invalid. Additionally, onBlur is invalid when passed under the filter */ menuProps?: Omit; /** diff --git a/components/cascader/__docs__/index.en-us.md b/components/cascader/__docs__/index.en-us.md index ff0eaf2629..02ebf3ad11 100644 --- a/components/cascader/__docs__/index.en-us.md +++ b/components/cascader/__docs__/index.en-us.md @@ -47,7 +47,7 @@ ```typescript export type CascaderDataItem = { value: string; - label?: string; + label?: React.ReactNode; disabled?: boolean; checkboxDisabled?: boolean; children?: Array; @@ -64,7 +64,7 @@ export type CascaderDataItemWithPosInfo = CascaderDataItem & { * 位置信息 */ pos: string; - _source: CascaderDataItem; + _source?: CascaderDataItem; }; ``` diff --git a/components/cascader/__docs__/index.md b/components/cascader/__docs__/index.md index a86d4e3a43..329af9ba52 100644 --- a/components/cascader/__docs__/index.md +++ b/components/cascader/__docs__/index.md @@ -20,6 +20,8 @@ ### Cascader +Cascader 支持属性透传给 Menu,但会忽略 onSelect、value、onChange、defaultValue、focusedKey、onItemFocus、focusable、isSelectIconRight、onBlur 等和 Cascader 同名的属性 + | 参数 | 说明 | 类型 | 默认值 | 是否必填 | 支持版本 | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | -------- | -------- | | dataSource | 数据源 | Array\ | [] | | - | @@ -47,7 +49,7 @@ ```typescript export type CascaderDataItem = { value: string; - label?: string; + label?: React.ReactNode; disabled?: boolean; checkboxDisabled?: boolean; children?: Array; @@ -64,7 +66,7 @@ export type CascaderDataItemWithPosInfo = CascaderDataItem & { * 位置信息 */ pos: string; - _source: CascaderDataItem; + _source?: CascaderDataItem; }; ``` diff --git a/components/cascader/__tests__/index-spec.tsx b/components/cascader/__tests__/index-spec.tsx index b4f5ebe45c..32de243987 100644 --- a/components/cascader/__tests__/index-spec.tsx +++ b/components/cascader/__tests__/index-spec.tsx @@ -8,6 +8,7 @@ import React, { import cloneDeep from 'lodash.clonedeep'; import type { SinonSpy } from 'cypress/types/sinon'; import Cascader, { type CascaderDataItem, type CascaderProps } from '../index'; +import ConfigProvider from '../../config-provider'; import '../style'; function freeze(dataSource: NonNullable) { @@ -739,4 +740,64 @@ describe('Cascader', () => { 'rgb(255, 255, 255)' ); }); + + // Fix https://github.com/alibaba-fusion/next/issues/3852 + it('The Cascader component enforces isSelectIconRight to be false to prevent potential style conflicts that may arise when isSelectIconRight is set to true', () => { + const dataSource = [ + { + value: '2973', + label: '陕西', + children: [ + { + value: '2974', + label: '西安', + children: [ + { value: '2975', label: '西安市' }, + { value: '2976', label: '高陵县' }, + ], + }, + { + value: '2980', + label: '铜川', + children: [ + { value: '2981', label: '铜川市' }, + { value: '2982', label: '宜君县' }, + ], + }, + ], + }, + { + value: '3371', + label: '新疆', + children: [ + { + value: '3430', + label: '巴音郭楞蒙古自治州', + children: [ + { value: '3431', label: '库尔勒市' }, + { value: '3432', label: '和静县' }, + ], + }, + ], + }, + ]; + cy.mount( + + + + ); + findItem(0, 0) + .click({ force: true }) + .then(() => { + findItem(0, 0) + .find('.next-menu-icon-selected') + .should('not.have.class', 'next-menu-icon-right'); + }); + }); }); diff --git a/components/cascader/cascader.tsx b/components/cascader/cascader.tsx index 950dbec4f1..11ca70a267 100644 --- a/components/cascader/cascader.tsx +++ b/components/cascader/cascader.tsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { polyfill } from 'react-lifecycles-compat'; import cloneDeep from 'lodash.clonedeep'; import cx from 'classnames'; -import Menu, { type ItemProps, type CheckboxItemProps } from '../menu'; +import Menu, { type ItemProps, type CheckboxItemProps, type MenuProps } from '../menu'; import { func, obj, dom } from '../util'; import CascaderMenu from './menu'; import CascaderMenuItem from './item'; @@ -25,9 +25,11 @@ import type { P2n, V2n, } from './types'; +import { Menu as ViewMenu } from '../menu/view/menu'; +import ConfigProvider from '../config-provider'; const { bindCtx } = func; -const { pickOthers } = obj; +const { pickOthers, pickProps } = obj; const { addClass, removeClass, setStyle, getStyle } = dom; // 数据打平 @@ -109,6 +111,27 @@ const normalizeValue = (value: T): NormalizeValueReturns => { return [] as NormalizeValueReturns; }; +const getFormatMenuProps = (others: Record) => { + const targetProps = pickProps(ViewMenu.propTypes, others); + const targetMenuProps = pickOthers( + { + value: false, + onChange: false, + defaultValue: false, + focusedKey: false, + onItemFocus: false, + focusable: false, + onBlur: false, + ...ConfigProvider.propTypes, + }, + targetProps + ); + return { + ...targetMenuProps, + isSelectIconRight: false, + } as MenuProps; +}; + /** * Cascader */ @@ -631,11 +654,13 @@ class Cascader extends Component { listClassName, listStyle, itemRender, + ...others } = this.props; const { value, expandedValue, focusedValue } = this.state; return ( { } renderFilteredList() { - const { prefix, filteredListStyle, filteredPaths, focusable = false } = this.props; + const { + prefix, + filteredListStyle, + filteredPaths, + focusable = false, + ...others + } = this.props; const { focusedValue } = this.state; + return ( { searchValue, } = this.props; // FIXME 这样做风险比较大,propTypes 如果不全,就会出现一些 div 接收不了的参数传导到 div - const others = pickOthers(Cascader.propTypes, this.props); + const others = pickOthers({ ...Cascader.propTypes, ...ViewMenu.propTypes }, this.props); const { value } = this.state; if (rtl) { diff --git a/components/cascader/types.ts b/components/cascader/types.ts index 6b96cdef55..72f7b1f590 100644 --- a/components/cascader/types.ts +++ b/components/cascader/types.ts @@ -99,10 +99,26 @@ export interface CascaderMenuProps extends CommonProps, MenuProps { /** * @api Cascader + * @remarks + * Cascader 支持除 onSelect、value、onChange、defaultValue、focusedKey、onItemFocus、focusable、isSelectIconRight、onBlur 等和 Cascader 同名的属性透传给 Menu + * - + * Cascader supports passing through properties with the same names to Menu, such as onSelect, value, onChange, defaultValue, focusedKey, onItemFocus, focusable, isSelectIconRight, onBlur, etc. */ export interface CascaderProps extends Omit, - CommonProps { + CommonProps, + Omit< + MenuProps, + | 'value' + | 'onChange' + | 'onSelect' + | 'defaultValue' + | 'focusedKey' + | 'onItemFocus' + | 'focusable' + | 'isSelectIconRight' + | 'onBlur' + > { /** * 数据源 * @en data source From 936c429ae74a2568d835b5f4c57b7abd94a6194c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=8A=E6=B7=9E?= Date: Wed, 4 Dec 2024 22:29:42 +0800 Subject: [PATCH 2/9] fix(Collapse): Internal elements need to apply the radius configuration of external elements, close #3277 --- .gitignore | 3 + .../collapse/__docs__/adaptor/index.tsx | 3 +- components/collapse/__tests__/index-spec.tsx | 13 + ...border-radius and overflow hidden.snap.png | Bin 0 -> 5659 bytes components/collapse/main.scss | 1 + components/util/__tests__/common/snapshot.ts | 27 + cypress.config.ts | 8 +- cypress/support/component.ts | 6 +- package-lock.json | 822 +++++++++++++++++- package.json | 2 + 10 files changed, 877 insertions(+), 8 deletions(-) create mode 100644 components/collapse/__tests__/snapshots/__base__/index-spec.tsx/Collapse -- render -- should render with proper border-radius and overflow hidden.snap.png create mode 100644 components/util/__tests__/common/snapshot.ts diff --git a/.gitignore b/.gitignore index e5db750be6..fbcac157cc 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,6 @@ gemini-report/ *.log .DS_Store src/core-temp + +# tests snapshots diff +components/**/__tests__/snapshots/__diff__/** diff --git a/components/collapse/__docs__/adaptor/index.tsx b/components/collapse/__docs__/adaptor/index.tsx index d9389d6c26..f1b861ff51 100644 --- a/components/collapse/__docs__/adaptor/index.tsx +++ b/components/collapse/__docs__/adaptor/index.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { Collapse } from '@alifd/next'; import { Types, parseData, NodeType } from '@alifd/adaptor-helper'; +import type { INode } from '@alifd/adaptor-helper/types/parse-data'; interface AdaptorProps { state: string; @@ -34,7 +35,7 @@ export default { }, }), adaptor: ({ state, width, data, style = {}, ...others }: AdaptorProps) => { - const list = parseData(data).filter(node => NodeType.node === node.type); + const list = (parseData(data) as INode[]).filter(node => NodeType.node === node.type); const expandedKeys = [] as string[]; const children = list.map(({ state, value, children }, index) => { if (state === 'active') { diff --git a/components/collapse/__tests__/index-spec.tsx b/components/collapse/__tests__/index-spec.tsx index 808879f655..73cc7a4c03 100644 --- a/components/collapse/__tests__/index-spec.tsx +++ b/components/collapse/__tests__/index-spec.tsx @@ -1,9 +1,12 @@ import React, { type ReactElement } from 'react'; +import { CompareSnapshot } from '../../util/__tests__/common/snapshot'; import Collapse from '../index'; import '../style'; const Panel = Collapse.Panel; +const collapseCompareSnapshot = new CompareSnapshot({ componentName: 'collapse' }); + describe('Collapse', () => { describe('render', () => { it('[normal] Should render null', () => { @@ -60,6 +63,16 @@ describe('Collapse', () => { cy.get('.next-collapse').should('have.length', 1); cy.get('.next-collapse-panel').should('have.length', 2); }); + + it('should render with proper border-radius and overflow hidden', () => { + cy.mount( + + Pannel Content + Pannel Content + + ); + collapseCompareSnapshot.compare(cy.get('.next-collapse')); + }); }); describe('defaultExpandedKeys', () => { diff --git a/components/collapse/__tests__/snapshots/__base__/index-spec.tsx/Collapse -- render -- should render with proper border-radius and overflow hidden.snap.png b/components/collapse/__tests__/snapshots/__base__/index-spec.tsx/Collapse -- render -- should render with proper border-radius and overflow hidden.snap.png new file mode 100644 index 0000000000000000000000000000000000000000..2c37c2a6224f50cc081def37e94134efcb02d9b2 GIT binary patch literal 5659 zcmaKwc|4Te+rSe=nuH#j$&{^?iLo@+sO++ol%2*9#bir%%GzX%Ez4wk@F0mSnT%y* z8);$^p@wWBWF1)=%zMwzcs}p@$M3yA?wQ*;_nhlo=UmJ8I+$xFdWU$A@$T8P=a7NE zw%MLNoCCnKG0%SB)9&s^=$<`7V+Pun&HXv%n!*x#e+^eRXImjcW4*59+U>6E&OL~G?$u8-adyJm+tu@SNHN>~`= z%ou;Hj#nm6naDm$^WH1}_vbJ%ryO|e;k{D!DGed}?tMA7`?p}6uZ zx!R;_t@M{ClMjqxlrc`>VmuK3N>i|)#LngIi3AHSGa)F?p|fQoZQxij(4y1{n&!8t zSzY~8M@}Xmf*SDYJz8M=nv+ggkWSJ^Bp4R*Y((&f!`WK=(B}!~F9&{ZYaPtK=ApQ`1ay~RwD@H(TQ&I;`;hvr7@+mDgH-oTSR(qvNUZ>0%qV! zpcZ~E@w$hYaLJ#OyAn-{`Qfc%qB3E= zqp?%49Qjj%>&W>0(3|QzD&UxipVOTJ807&%i|e@*LtEbo2YK_WR}ZE+gzii0ba*5e zU9s{bIi9{j&1wB&5f+!5ZMC5&ZK2WmIMZv=%GURb#m1zA>}Z$s+G3RK<~iRIi`RJ# z4H3zv8d0_V_8}?#_BNE|umGN&eSw6z)5Harrl&i*GdmaCl{W=KHYC2hG?mBSe&IJ9 z5Hn1An?m$yY|RbyZ_78zcqrjp=eKZ&lKPg&D04QtIImo2su{O5^G8J3d+X4_V(FBp zA2ZZqgrrZ5N8arLCs3!X0>_n9rvFKXEVhINJrf~SfOiCMtN=zGbtMt7GO~F%rN1fSmz!ts;kRr zKM@i+l@pXo^Jq-YC6E|0(zn!GCp$ClF1Su5U6n!256X(~7!j(ZLaw9CZm2a+rc4AG z2IBryr>5saz=-jD6{QiZ>iy64n52`@Oi$^J;Ov%a7wQQF`kOw2hMfu+^lC@D50l~= zx9T!11ILHUeP?goDhqyEJD5H6%D&-gSJwrYedRN}f(!lK)>_3(!O>#M+}F;TFC{;J z*|v~)JLc7a7u@hJg5&a_19rr$Bv1J5XW)OAG1SFtZmW#tQrD^ zc9fJSgp2*7LemBU2KQLGC}2vsx!aJIrjNu$iPNSUsbTe73&iP3kDk7Vf3;NqX|$*a z-ST+B7>QW3V$3=miC6M$%3OM< ze+=5;fFZCvO$6}@Sm!B)|I$t$$dC8z)}hyIM@RK$1@wKb-&$oZ_vDb?C7n`|e{OAU zt<2m!Xt}hwrZVyDh6?Zup84u>>+|Q&&FHto7`f;wmrSi<^B=`$az>gDPO*aziXy+i z{ozl_(Yr>cz#ouLfGw;FlKnafLxSa@p(8h3kaB_x4Qn=mfq^gF^c6kZEXtg|*T>@F z$i2P}4S(F+zi%RBw|+IQySD4Ctgd_-8j70==&gS12fzDS4wSC3rTE=Hw{B;i{qkO2^?fZJ)=vQ+&p>Sqh}y}64M^m`l#%<+5jm; z1lT}VMRpLxmilXPHe75tc?1Ypa_KGnL|f6~2T$Q32<~P{D7nO~-@AWkElK|*1fvt1 zCXfDx`DGdwhKU-k$u=x#CQfCwPZ#Ahb(P5=+%2h({IxQhpzX-=o$uT(`paG&2|m(- z!bm1W!Qf;PHp-BAMNznIEo8q@b}%gYjA-msfOh_McC2%cLh4IpNuAE@oX6Vbg?-vJIsmZ38dMH`X!s3 zsX%9NL|C!W{v8FHh&H92x#i9uM**IpmuafBH&{F3JuJ@0JhS z-fJH?t6!4H}tYxXdTgcB1h*BkXKM=rWn`t={_z@Q-FZ<>PX6 z`a!glJcg~FX^J7RDia&oM*68H@zhI{zV6gmZMzaCaq2Mmtbm% zV64v0d;}5`W83ol?S;kzZbHw5@96Xdn>nt%ST9w0i(V0TnJrDX3lVMI+1`8aLOG1x z^n>40xZ3*A4SLAGE!QkBb*{;gM0bHjB1VEMSo2*ZQXd@69{l}#z!|{N%D;MshIZ!+ zRgDR;wtl`lCoNW21?(WDa+lE(t62ZR3Fz|O7A+(P0S(8YkFcW?OA?euR>pB6*@B)x z!{M!7Q0(}?`sGLeY9`91jEnOc;;FV4VvBcY!Ja&61l>?0v*A!Fe=#6$L# z?0tCwTd^y3RDqm#t8}zh0K{k=mkWnq+T9CT9?r2Puy1sT*Zz8nK@i8Yx7p17A)HCcLal&Kd5&_Lfu$5^)SCq*PdBL@okAT6@8LBaw0A@dv zcFyYt>sc3@kG+&;CglQQzh-k;y2gEbFIEm)a3&`>lNz>tvW)b{4fOjX;5EeMyL>;e z3e>TeC8Q5Z%)kSFGIcSs!K0?dHbAPIn>(HvynL>=VRfdYe)XGmDwCqMv#Rflt`f~o zrx?NCjUGjZRqJ0Q&(5Z+`btqXnb5dt-O0|n zbQK?&W?#GiuWu%FBQ`ByRnwv}g!a%xeM!5FxT zE96Eb5S3rqZv5p-yjaJ=79hb`);pb3aOs+S%veBuxhiXxMytyBQex2!ME|y{sq#LP z?k8%P8n+r&Bz#}jFH6r8T_7%*p{FUSL!I4vZ>#*f4+XD}a%1;XODga7=t`yVmX@MF zI(Vu8u&>aC@7UazmfYb4epTYe?ZEtVK@oxQZa+>*zsOLZXG|?r2L6`X(avcTo~m=- z6!!p?1f&NbNg1i?6wC;CNr2ij56U_&|3GcD)0o*A_qP#fw4R)82{TA&wx1bYdsxFi zr@C?b0wC|`=7vML--3OYhTHx$Th*M&$vZQ=QR?x`^%>b8Gq_%*tCbzqp_vicW2OBy>0| z=Z1+&3hOyHJLJx(^XJbGK4fHpQOZGNm1l-J*@4RkWa>R-*odfM{_+I=0WXaJ`G|aC zRLH7C-y>WOv?Po!a^|QWj7{`kXc+$7)1zglmG@YhXu+Spe{W(@;%&gESarb4TH4QQTBpD`dfVRXok02fAh1Z0rOil*w@lKUUb4K%IJ(O#HK{V!axO4SMV$j0IF0nXz= z!A>g{Ov|P`X&Z-re0fuI{7bbPadtk4g*~l#ZCCM#IqlV=#>UoW4_ng$v(Z6%*Z4{g z^|p(}QGiojF4c>7-Nuc>EqA`JO$FSXkr3b>UW0gcVeuyg4aiptY{ieojxjViS+LxZ z9N$J)&+9(B%hrFco&qKyM|M0Lv*l`Z>ZepHPsAPycojJNSc-_*7NS+KW&<$HbC!c{ zGa9GxE@92Bm?OnOzq<9nho&Dq2Y7yUm5=3;`|CI9Uo2DGEYsBk@ z8+8lJa;tm}nO^+OmG8X0xvzfZbL=adH7Ni`SyiVW$w#RajfS2x{tB}h4v7I`_BGb# zs@V`0n-6N{0xQ>7YC~Mht}8#zy%XFZHe}0{mHE@OXQP*(eD8cE6_rf?e*O9qt2`aY zX=bx-Eu=N(R6rs}-khM-;?{Hlop`C8cjwpdwR z^`3p}ap&EIe*5;~qU{5|WO;0)vlaB?CWZ7d;_!FshZNJQLZ9M9+3OMnAgXm~ci;1g+n^SBMFGaFLYtq9o!mDa__;U=95I;l#-JD^ z7+c|r?o6Ui9SGmUP8rlnF`oBR^f!b%fHf(DTAXMIz3K}$V1F%c9b;oejt(Hf@~o%1 z4eMCLHd+8krv!rVhY8+n3pNVD3Rt7iB=*Uma(qjqy5 zUQQUO^WmVoZk@pSlRkv+x(`B2LIBlYcE4GS%?&?#&Vu$noSQkF_yjnI@O%N~(?UsI zhRuAgQ;R{VwTc|$Y1t)@rLIaC;0gCa<5u%+0Dg&S@l3Z>YQBy>uZ@xc>Kt>on^(`%}jC-Zg|Gq9`DQxa`;bF+& zq05(m7ZeKxvBELeov=DLZajaW+VP#V7r^9`NrzhVB(uz38`O@q@%YOWteLBhq@q~!Dlf)a@2uy4!1c6O{* zz^sF-^D9U%sYM{w2$5if7-47tsJrc`2_S6d6D^o%ei0o1@w~#hZAg)LQaHyg;npUCmk{8e!w4a_|**TA^IZ-@qSGtO0;aEio(J0O<7| zDSm-Fa+eX`KekMbLW=<4=mmwgpPm7ZCq)44Lya;y3=!6Cq=t1maOk_oK*vP8?8@!% F{{i>, + nameOrOptions?: string | Options, + options?: Options + ) { + const commandOptions = typeof nameOrOptions === 'string' ? options : nameOrOptions; + const targetOptions = Object.assign( + { + customSnapshotsDir: this.customSnapshotsDir, + customDiffDir: this.customDiffDir, + }, + commandOptions + ); + const target = subject ? subject : cy; + return target.matchImageSnapshot(targetOptions); + } +} diff --git a/cypress.config.ts b/cypress.config.ts index d12c7a7e0d..1d08bfdc74 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,15 +1,17 @@ import { defineConfig } from 'cypress'; +import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin'; export default defineConfig({ component: { - setupNodeEvents(on) { + setupNodeEvents(on, config) { on('task', { - 'log': (message: string) => { + log: (message: string) => { // eslint-disable-next-line no-console console.log(message); return null; }, - }) + }); + addMatchImageSnapshotPlugin(on, config); }, devServer: { framework: 'react', diff --git a/cypress/support/component.ts b/cypress/support/component.ts index 41271444ac..8b9fd9a9a9 100644 --- a/cypress/support/component.ts +++ b/cypress/support/component.ts @@ -1,5 +1,6 @@ import { cloneElement, type ReactElement } from 'react'; import { mount, type MountReturn } from 'cypress/react'; +import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'; import './commands'; function rerender(tag: string, nextProps: Props) { @@ -14,7 +15,7 @@ function triggerInputChange(subject: JQuery, value: string) { window.HTMLInputElement.prototype, 'value' )?.set; - nativeInputValueSetter?.call(element, value) + nativeInputValueSetter?.call(element, value); element.dispatchEvent(new Event('input', { bubbles: true })); } @@ -29,6 +30,7 @@ declare global { } } +addMatchImageSnapshotCommand(); Cypress.Commands.add('mount', mount); Cypress.Commands.add('rerender', rerender); -Cypress.Commands.add('triggerInputChange', { prevSubject: 'element' }, triggerInputChange) +Cypress.Commands.add('triggerInputChange', { prevSubject: 'element' }, triggerInputChange); diff --git a/package-lock.json b/package-lock.json index f57023d3e0..912e2c1e31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@alifd/next", - "version": "1.27.23", + "version": "1.27.29", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@alifd/next", - "version": "1.27.23", + "version": "1.27.29", "license": "MIT", "dependencies": { "@alifd/field": "~2.0.3", @@ -50,6 +50,7 @@ "@types/chai": "^4.3.11", "@types/classnames": "^2.3.1", "@types/co": "^4.6.6", + "@types/cypress-image-snapshot": "^3.1.9", "@types/enzyme": "^3.10.14", "@types/fs-extra": "^5.1.0", "@types/glob": "^7.2.0", @@ -104,6 +105,7 @@ "css-loader": "^0.28.7", "css-split-webpack-plugin": "^0.2.5", "cypress": "^13.6.1", + "cypress-image-snapshot": "^4.0.1", "ejs": "^2.5.9", "enzyme": "^3.3.0", "enzyme-adapter-react-16": "~1.10.0", @@ -3500,6 +3502,12 @@ "integrity": "sha512-m46q2/3TSimTBeA710v73YosbYlEHbuF1mdIg0SGFtqb/lk1bgqF05dhg0KHUyhUQV2Z9vMnSa3MCw/utYHqPg==", "dev": true }, + "node_modules/@types/cypress-image-snapshot": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/@types/cypress-image-snapshot/-/cypress-image-snapshot-3.1.9.tgz", + "integrity": "sha512-vcFgB8AfuM0dtupCHAGgapUbjRNWmMDtpzzpXz5gexWOHW4y/n10XRi5/y5Xpi0Ztku+X4dnRVMqQa5IDcy3Ig==", + "dev": true + }, "node_modules/@types/enzyme": { "version": "3.10.18", "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.18.tgz", @@ -4160,6 +4168,15 @@ "vite": "^4.2.0 || ^5.0.0" } }, + "node_modules/@xmldom/xmldom": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", + "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/a-sync-waterfall": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", @@ -4472,6 +4489,139 @@ "node": ">=0.10.0" } }, + "node_modules/app-path": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/app-path/-/app-path-3.3.0.tgz", + "integrity": "sha512-EAgEXkdcxH1cgEePOSsmUtw9ItPl0KTxnh/pj9ZbhvbKbij9x0oX6PWpGnorDr0DS5AosLgoa5n3T/hZmKQpYA==", + "dev": true, + "dependencies": { + "execa": "^1.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/app-path/node_modules/cross-spawn": { + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", + "dev": true, + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/app-path/node_modules/execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "dependencies": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/app-path/node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/app-path/node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/app-path/node_modules/npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", + "dev": true, + "dependencies": { + "path-key": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/app-path/node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/app-path/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/app-path/node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "dev": true, + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/app-path/node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/app-path/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, "node_modules/append-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/append-buffer/-/append-buffer-1.0.2.tgz", @@ -10743,6 +10893,113 @@ "node": "^16.0.0 || ^18.0.0 || >=20.0.0" } }, + "node_modules/cypress-image-snapshot": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/cypress-image-snapshot/-/cypress-image-snapshot-4.0.1.tgz", + "integrity": "sha512-PBpnhX/XItlx3/DAk5ozsXQHUi72exybBNH5Mpqj1DVmjq+S5Jd9WE5CRa4q5q0zuMZb2V2VpXHth6MjFpgj9Q==", + "dev": true, + "dependencies": { + "chalk": "^2.4.1", + "fs-extra": "^7.0.1", + "glob": "^7.1.3", + "jest-image-snapshot": "4.2.0", + "pkg-dir": "^3.0.0", + "term-img": "^4.0.0" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "cypress": "^4.5.0" + } + }, + "node_modules/cypress-image-snapshot/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/cypress-image-snapshot/node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/cypress-image-snapshot/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/cypress-image-snapshot/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cypress-image-snapshot/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/cypress-image-snapshot/node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/cypress-image-snapshot/node_modules/pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/cypress/node_modules/@types/node": { "version": "18.19.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.3.tgz", @@ -15165,6 +15422,12 @@ "integrity": "sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg==", "dev": true }, + "node_modules/glur": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/glur/-/glur-1.1.2.tgz", + "integrity": "sha512-l+8esYHTKOx2G/Aao4lEQ0bnHWg4fWtJbVoZZT9Knxi01pB8C80BR85nONLFwkkQoFRCmXY+BUcGZN3yZ2QsRA==", + "dev": true + }, "node_modules/gonzales-pe": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-4.3.0.tgz", @@ -17619,6 +17882,19 @@ "set-function-name": "^2.0.1" } }, + "node_modules/iterm2-version": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/iterm2-version/-/iterm2-version-4.2.0.tgz", + "integrity": "sha512-IoiNVk4SMPu6uTcK+1nA5QaHNok2BMDLjSl5UomrOixe5g4GkylhPwuiGdw00ysSCrXAKNMfFTu+u/Lk5f6OLQ==", + "dev": true, + "dependencies": { + "app-path": "^3.2.0", + "plist": "^3.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/jest-diff": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", @@ -17751,6 +18027,93 @@ "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", "dev": true }, + "node_modules/jest-image-snapshot": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/jest-image-snapshot/-/jest-image-snapshot-4.2.0.tgz", + "integrity": "sha512-6aAqv2wtfOgxiJeBayBCqHo1zX+A12SUNNzo7rIxiXh6W6xYVu8QyHWkada8HeRi+QUTHddp0O0Xa6kmQr+xbQ==", + "dev": true, + "dependencies": { + "chalk": "^1.1.3", + "get-stdin": "^5.0.1", + "glur": "^1.1.2", + "lodash": "^4.17.4", + "mkdirp": "^0.5.1", + "pixelmatch": "^5.1.0", + "pngjs": "^3.4.0", + "rimraf": "^2.6.2", + "ssim.js": "^3.1.1" + }, + "engines": { + "node": ">= 10.14.2" + }, + "peerDependencies": { + "jest": ">=20 <=26" + } + }, + "node_modules/jest-image-snapshot/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jest-image-snapshot/node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jest-image-snapshot/node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jest-image-snapshot/node_modules/get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha512-jZV7n6jGE3Gt7fgSTJoz91Ak5MuTLwMwkoYdjxuJ/AmjIsE1UC03y/IWkZCQGEvVNS9qoRNwy5BCqxImv0FVeA==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/jest-image-snapshot/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jest-image-snapshot/node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/jest-validate": { "version": "23.6.0", "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-23.6.0.tgz", @@ -21166,6 +21529,12 @@ "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", "dev": true }, + "node_modules/nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, "node_modules/nise": { "version": "1.5.3", "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", @@ -22558,6 +22927,27 @@ "node": ">=0.10.0" } }, + "node_modules/pixelmatch": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-5.3.0.tgz", + "integrity": "sha512-o8mkY4E/+LNUf6LzX96ht6k6CEDi65k9G2rjMtBe9Oo+VPKSvl+0GKHuH/AlG+GA5LPG/i5hrekkxUc3s2HU+Q==", + "dev": true, + "dependencies": { + "pngjs": "^6.0.0" + }, + "bin": { + "pixelmatch": "bin/pixelmatch" + } + }, + "node_modules/pixelmatch/node_modules/pngjs": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", + "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==", + "dev": true, + "engines": { + "node": ">=12.13.0" + } + }, "node_modules/pkg-dir": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", @@ -22579,6 +22969,29 @@ "semver-compare": "^1.0.0" } }, + "node_modules/plist": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", + "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", + "dev": true, + "dependencies": { + "@xmldom/xmldom": "^0.8.8", + "base64-js": "^1.5.1", + "xmlbuilder": "^15.1.1" + }, + "engines": { + "node": ">=10.4.0" + } + }, + "node_modules/pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/portfinder": { "version": "1.0.32", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz", @@ -29854,6 +30267,12 @@ "node": ">=0.10.0" } }, + "node_modules/ssim.js": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/ssim.js/-/ssim.js-3.5.0.tgz", + "integrity": "sha512-Aj6Jl2z6oDmgYFFbQqK7fght19bXdOxY7Tj03nF+03M9gCBAjeIiO8/PlEGMfKDwYpw4q6iBqVq2YuREorGg/g==", + "dev": true + }, "node_modules/ssr-window": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ssr-window/-/ssr-window-3.0.0.tgz", @@ -31252,6 +31671,46 @@ "tcomb": "^3.0.0" } }, + "node_modules/term-img": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/term-img/-/term-img-4.1.0.tgz", + "integrity": "sha512-DFpBhaF5j+2f7kheKFc1ajsAUUDGOaNPpKPtiIMxlbfud6mvfFZuWGnTRpaujUa5J7yl6cIw/h6nyr4mSsENPg==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.1.0", + "iterm2-version": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/term-img/node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/term-img/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/term-size": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", @@ -35672,6 +36131,15 @@ "node": ">=8" } }, + "node_modules/xmlbuilder": { + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", + "dev": true, + "engines": { + "node": ">=8.0" + } + }, "node_modules/xmlhttprequest-ssl": { "version": "1.5.5", "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", @@ -38341,6 +38809,12 @@ "integrity": "sha512-m46q2/3TSimTBeA710v73YosbYlEHbuF1mdIg0SGFtqb/lk1bgqF05dhg0KHUyhUQV2Z9vMnSa3MCw/utYHqPg==", "dev": true }, + "@types/cypress-image-snapshot": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/@types/cypress-image-snapshot/-/cypress-image-snapshot-3.1.9.tgz", + "integrity": "sha512-vcFgB8AfuM0dtupCHAGgapUbjRNWmMDtpzzpXz5gexWOHW4y/n10XRi5/y5Xpi0Ztku+X4dnRVMqQa5IDcy3Ig==", + "dev": true + }, "@types/enzyme": { "version": "3.10.18", "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.18.tgz", @@ -38906,6 +39380,12 @@ "react-refresh": "^0.14.0" } }, + "@xmldom/xmldom": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", + "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", + "dev": true + }, "a-sync-waterfall": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", @@ -39147,6 +39627,105 @@ } } }, + "app-path": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/app-path/-/app-path-3.3.0.tgz", + "integrity": "sha512-EAgEXkdcxH1cgEePOSsmUtw9ItPl0KTxnh/pj9ZbhvbKbij9x0oX6PWpGnorDr0DS5AosLgoa5n3T/hZmKQpYA==", + "dev": true, + "requires": { + "execa": "^1.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "dev": true + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true + }, + "semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "dev": true + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "append-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/append-buffer/-/append-buffer-1.0.2.tgz", @@ -44479,6 +45058,85 @@ } } }, + "cypress-image-snapshot": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/cypress-image-snapshot/-/cypress-image-snapshot-4.0.1.tgz", + "integrity": "sha512-PBpnhX/XItlx3/DAk5ozsXQHUi72exybBNH5Mpqj1DVmjq+S5Jd9WE5CRa4q5q0zuMZb2V2VpXHth6MjFpgj9Q==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "fs-extra": "^7.0.1", + "glob": "^7.1.3", + "jest-image-snapshot": "4.2.0", + "pkg-dir": "^3.0.0", + "term-img": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + } + } + }, "d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", @@ -48023,6 +48681,12 @@ "integrity": "sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg==", "dev": true }, + "glur": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/glur/-/glur-1.1.2.tgz", + "integrity": "sha512-l+8esYHTKOx2G/Aao4lEQ0bnHWg4fWtJbVoZZT9Knxi01pB8C80BR85nONLFwkkQoFRCmXY+BUcGZN3yZ2QsRA==", + "dev": true + }, "gonzales-pe": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-4.3.0.tgz", @@ -49895,6 +50559,16 @@ "set-function-name": "^2.0.1" } }, + "iterm2-version": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/iterm2-version/-/iterm2-version-4.2.0.tgz", + "integrity": "sha512-IoiNVk4SMPu6uTcK+1nA5QaHNok2BMDLjSl5UomrOixe5g4GkylhPwuiGdw00ysSCrXAKNMfFTu+u/Lk5f6OLQ==", + "dev": true, + "requires": { + "app-path": "^3.2.0", + "plist": "^3.0.1" + } + }, "jest-diff": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", @@ -49995,6 +50669,71 @@ "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", "dev": true }, + "jest-image-snapshot": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/jest-image-snapshot/-/jest-image-snapshot-4.2.0.tgz", + "integrity": "sha512-6aAqv2wtfOgxiJeBayBCqHo1zX+A12SUNNzo7rIxiXh6W6xYVu8QyHWkada8HeRi+QUTHddp0O0Xa6kmQr+xbQ==", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "get-stdin": "^5.0.1", + "glur": "^1.1.2", + "lodash": "^4.17.4", + "mkdirp": "^0.5.1", + "pixelmatch": "^5.1.0", + "pngjs": "^3.4.0", + "rimraf": "^2.6.2", + "ssim.js": "^3.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha512-jZV7n6jGE3Gt7fgSTJoz91Ak5MuTLwMwkoYdjxuJ/AmjIsE1UC03y/IWkZCQGEvVNS9qoRNwy5BCqxImv0FVeA==", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true + } + } + }, "jest-validate": { "version": "23.6.0", "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-23.6.0.tgz", @@ -52819,6 +53558,12 @@ "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", "dev": true }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, "nise": { "version": "1.5.3", "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", @@ -53922,6 +54667,23 @@ "pinkie": "^2.0.0" } }, + "pixelmatch": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-5.3.0.tgz", + "integrity": "sha512-o8mkY4E/+LNUf6LzX96ht6k6CEDi65k9G2rjMtBe9Oo+VPKSvl+0GKHuH/AlG+GA5LPG/i5hrekkxUc3s2HU+Q==", + "dev": true, + "requires": { + "pngjs": "^6.0.0" + }, + "dependencies": { + "pngjs": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", + "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==", + "dev": true + } + } + }, "pkg-dir": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", @@ -53940,6 +54702,23 @@ "semver-compare": "^1.0.0" } }, + "plist": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", + "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", + "dev": true, + "requires": { + "@xmldom/xmldom": "^0.8.8", + "base64-js": "^1.5.1", + "xmlbuilder": "^15.1.1" + } + }, + "pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", + "dev": true + }, "portfinder": { "version": "1.0.32", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz", @@ -59941,6 +60720,12 @@ "tweetnacl": "~0.14.0" } }, + "ssim.js": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/ssim.js/-/ssim.js-3.5.0.tgz", + "integrity": "sha512-Aj6Jl2z6oDmgYFFbQqK7fght19bXdOxY7Tj03nF+03M9gCBAjeIiO8/PlEGMfKDwYpw4q6iBqVq2YuREorGg/g==", + "dev": true + }, "ssr-window": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ssr-window/-/ssr-window-3.0.0.tgz", @@ -61056,6 +61841,33 @@ "tcomb": "^3.0.0" } }, + "term-img": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/term-img/-/term-img-4.1.0.tgz", + "integrity": "sha512-DFpBhaF5j+2f7kheKFc1ajsAUUDGOaNPpKPtiIMxlbfud6mvfFZuWGnTRpaujUa5J7yl6cIw/h6nyr4mSsENPg==", + "dev": true, + "requires": { + "ansi-escapes": "^4.1.0", + "iterm2-version": "^4.1.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + } + }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true + } + } + }, "term-size": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", @@ -64570,6 +65382,12 @@ "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "dev": true }, + "xmlbuilder": { + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", + "dev": true + }, "xmlhttprequest-ssl": { "version": "1.5.5", "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", diff --git a/package.json b/package.json index c6414b7de1..7f3fcffc52 100644 --- a/package.json +++ b/package.json @@ -145,6 +145,7 @@ "@types/chai": "^4.3.11", "@types/classnames": "^2.3.1", "@types/co": "^4.6.6", + "@types/cypress-image-snapshot": "^3.1.9", "@types/enzyme": "^3.10.14", "@types/fs-extra": "^5.1.0", "@types/glob": "^7.2.0", @@ -199,6 +200,7 @@ "css-loader": "^0.28.7", "css-split-webpack-plugin": "^0.2.5", "cypress": "^13.6.1", + "cypress-image-snapshot": "^4.0.1", "ejs": "^2.5.9", "enzyme": "^3.3.0", "enzyme-adapter-react-16": "~1.10.0", From 3f5f81882963f8dbfb716c77a75622d001803b6e Mon Sep 17 00:00:00 2001 From: eternalsky Date: Wed, 27 Nov 2024 20:38:24 +0800 Subject: [PATCH 3/9] fix(Balloon): v2 default offset adjustment --- .../balloon/__tests__/balloon-v2-spec.tsx | 46 +++++++++++++++++++ components/balloon/balloon.tsx | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/components/balloon/__tests__/balloon-v2-spec.tsx b/components/balloon/__tests__/balloon-v2-spec.tsx index 731d769552..12884b7e9f 100644 --- a/components/balloon/__tests__/balloon-v2-spec.tsx +++ b/components/balloon/__tests__/balloon-v2-spec.tsx @@ -407,5 +407,51 @@ describe('Balloon v2', () => { ); cy.get('span').should('have.length', 1); }); + + it('default offset should be 12px', () => { + const trigger = ( +
+ trigger +
+ ); + cy.mount( + + trigger + + ).as('Demo'); + cy.get('.trigger').then($el => { + const triggerRect = $el[0].getBoundingClientRect(); + expect(Math.round(triggerRect.bottom + 12)).to.equal( + Math.round(document.querySelector('.next-balloon')!.getBoundingClientRect().top) + ); + }); + cy.rerender('Demo', { align: 't' }); + cy.get('.trigger').then($el => { + const triggerRect = $el[0].getBoundingClientRect(); + expect(Math.round(triggerRect.top - 12)).to.equal( + Math.round( + document.querySelector('.next-balloon')!.getBoundingClientRect().bottom + ) + ); + }); + cy.rerender('Demo', { align: 'l' }); + cy.get('.trigger').then($el => { + const triggerRect = $el[0].getBoundingClientRect(); + expect(Math.round(triggerRect.left - 12)).to.equal( + Math.round( + document.querySelector('.next-balloon')!.getBoundingClientRect().right + ) + ); + }); + cy.rerender('Demo', { align: 'r' }); + cy.get('.trigger').then($el => { + const triggerRect = $el[0].getBoundingClientRect(); + expect(Math.round(triggerRect.right + 12)).to.equal( + Math.round( + document.querySelector('.next-balloon')!.getBoundingClientRect().left + ) + ); + }); + }); }); }); diff --git a/components/balloon/balloon.tsx b/components/balloon/balloon.tsx index 298ebe959f..defb1aa488 100644 --- a/components/balloon/balloon.tsx +++ b/components/balloon/balloon.tsx @@ -356,7 +356,7 @@ class Balloon extends React.Component { Object.assign(otherProps, { placement: align, - placementOffset: placementOffset + 12, + placementOffset: placementOffset, v2: true, beforePosition: this.beforePosition, autoAdjust, From e74c30744907d3c4e712c90c28e31bdf972bd160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=8A=E6=B7=9E?= Date: Wed, 4 Dec 2024 13:57:40 +0800 Subject: [PATCH 4/9] refactor(ConfigProvider): static reference to moment --- components/config-provider/index.tsx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/components/config-provider/index.tsx b/components/config-provider/index.tsx index 3b5dc73dc7..4f57b1933a 100644 --- a/components/config-provider/index.tsx +++ b/components/config-provider/index.tsx @@ -1,6 +1,7 @@ import { Component, Children, type ReactNode } from 'react'; import PropTypes from 'prop-types'; import { polyfill } from 'react-lifecycles-compat'; +import moment from 'moment'; import getContextProps from './get-context-props'; import { config, @@ -25,16 +26,7 @@ import type { const childContextCache = new Cache(); -const setMomentLocale = async (locale?: { momentLocale?: string }) => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let moment: any; - try { - moment = await import('moment'); - if (moment && moment.default && moment.default.isMoment) moment = moment.default; - } catch (e) { - // ignore - } - +const setMomentLocale = (locale?: { momentLocale?: string }) => { if (moment && moment.locale && locale) { moment.locale(locale.momentLocale); } From fbda649d53fe8bdf080b5cea51e2841233afa34c Mon Sep 17 00:00:00 2001 From: caozhong1996 <836934184@qq.com> Date: Fri, 6 Dec 2024 10:27:03 +0800 Subject: [PATCH 5/9] fix(Badge): set alignment by use transform --- components/badge/__tests__/index-spec.tsx | 33 +++++++++++++++++++++++ components/badge/main.scss | 2 ++ 2 files changed, 35 insertions(+) diff --git a/components/badge/__tests__/index-spec.tsx b/components/badge/__tests__/index-spec.tsx index cbd2241ad9..cee67ab1fc 100644 --- a/components/badge/__tests__/index-spec.tsx +++ b/components/badge/__tests__/index-spec.tsx @@ -116,4 +116,37 @@ describe('Badge', () => { cy.mount(); cy.get('.next-badge-count.next-badge-scroll-number'); }); + + it('should on right when children is block', () => { + cy.mount( + +
+
+ ); + cy.get('.next-badge-count').then($el => { + $el.css({ + transition: 'none', + animation: 'none', + }); + }); + cy.get('.next-badge-count').then($el => { + const targetRect = $el[0].getBoundingClientRect(); + const badgeRect = document.querySelector('.next-badge')!.getBoundingClientRect(); + const position = { + left: Math.round(targetRect.left), + top: Math.round(targetRect.top), + }; + expect(position).to.deep.equal({ + left: Math.round(badgeRect.left + badgeRect.width - targetRect.width / 2), + top: Math.round(badgeRect.top - 4), + }); + }); + }); }); diff --git a/components/badge/main.scss b/components/badge/main.scss index cf74b31ca7..75aa0a5188 100644 --- a/components/badge/main.scss +++ b/components/badge/main.scss @@ -77,6 +77,8 @@ z-index: 10; overflow: hidden; transform-origin: left center; + transform: translateX(50%); + right: 0; } &-scroll-number-only { From af1c2e7943be7f40e197cac0cd0b9db3fd5d44b0 Mon Sep 17 00:00:00 2001 From: FairyYang <269291280@qq.com> Date: Fri, 6 Dec 2024 10:29:51 +0800 Subject: [PATCH 6/9] fix(Select): Fix select doc --- components/select/__docs__/index.en-us.md | 107 +++++++++++----------- components/select/__docs__/index.md | 107 +++++++++++----------- 2 files changed, 110 insertions(+), 104 deletions(-) diff --git a/components/select/__docs__/index.en-us.md b/components/select/__docs__/index.en-us.md index e85ed11d89..4c36d6f009 100644 --- a/components/select/__docs__/index.en-us.md +++ b/components/select/__docs__/index.en-us.md @@ -64,7 +64,7 @@ This is because the layer's animation of the overlay is implemented by `classNam | Param | Description | Type | Default Value | Required | Supported Version | | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | -------- | ----------------- | | size | Size | 'small' \| 'medium' \| 'large' | 'medium' | | - | -| children | Child elements, reference the demo for details | ReactElementWithTypeMark \| ReactElementWithTypeMark[] | - | | - | +| children | Child elements, reference the demo for details | React.ReactNode | - | | - | | name | Name | string | - | | - | | value | Current value, for controlled mode | DataSourceItem \| DataSourceItem[] | - | | - | | defaultValue | Initial default value | DataSourceItem \| DataSourceItem[] | - | | - | @@ -81,13 +81,13 @@ This is because the layer's animation of the overlay is implemented by `classNam | popupContainer | Popup mounting container | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | - | | popupClassName | Popup class name | string | - | | - | | popupStyle | Popup inline style | React.CSSProperties | - | | - | -| popupProps | Props added to the popup | PopupProps | - | | - | +| popupProps | Props added to the popup | React.ComponentPropsWithRef\ | - | | - | | followTrigger | Whether to follow the trigger scroll | boolean | - | | - | | popupContent | Custom popup content | React.ReactNode | - | | - | | menuProps | Menu property | MenuProps | - | | 1.18 | | filterLocal | Use local filtering, when the data source is remote, you need to close this item | boolean | true | | - | | filter | Local filtering method, return a Boolean value to determine whether to retain

**signature**:
**params**:
_key_: Search keyword
_item_: Render node item | (key: string \| number, item: ObjectItem) => boolean | - | | - | -| onToggleHighlightItem | Callback when pressing keyboard up and down keys to switch the menu highlight option | (highlightKey?: unknown, type?: HighlightChangeType) => void | - | | - | +| onToggleHighlightItem | Callback when pressing keyboard up and down keys to switch the menu highlight option | (
highlightKey?: string \| boolean \| NormalizedObjectItem \| null,
type?: HighlightChangeType
) => void | - | | - | | useVirtual | Whether to enable virtual scrolling mode | boolean | - | | - | | dataSource | Data source, can dynamically render child items | Array\ | - | | - | | itemRender | Render MenuItem content method

**signature**:
**params**:
_item_: item
_searchValue_: searchValue | (item: ObjectItem, searchValue: string \| undefined) => React.ReactNode | - | | - | @@ -97,6 +97,7 @@ This is because the layer's animation of the overlay is implemented by `classNam | hasBorder | Whether there is a border | boolean | - | | - | | hasArrow | Whether there is a drop | boolean | true | | - | | showSearch | Whether it can be searched after expansion (fixed in tag mode) | boolean | false | | - | +| autoClearSearchValue | Whether to clear the search box after selecting the selected item, only in mode multiple or tags is valid | boolean | true | | - | | onSearch | Callback when the search box value changes | (value: string, e: React.ChangeEvent\) => void | - | | - | | onSearchClear | Callback when the search box value is cleared | (actionType?: string) => void | - | | - | | hasSelectAll | Whether there is a full selection function in multi | boolean \| string | - | | - | @@ -126,42 +127,42 @@ This is because the layer's animation of the overlay is implemented by `classNam ### Select.AutoComplete -| Param | Description | Type | Default Value | Required | -| ---------------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------- | ------------- | -------- | -| size | Size | 'small' \| 'medium' \| 'large' | 'medium' | | -| value | Current value, for controlled mode | string \| number \| null | - | | -| defaultValue | Initial default value | string \| number | - | | -| placeholder | Placeholder when no value | string | - | | -| autoWidth | Whether the width of the drop | boolean | true | | -| label | Custom inline label | React.ReactNode | - | | -| hasClear | Whether to have a clear button (valid in single mode) | boolean | - | | -| state | Validation status | 'error' \| 'loading' \| 'success' \| 'warning' | - | | -| readOnly | Read | boolean | - | | -| disabled | Whether to disable the selector | boolean | - | | -| visible | Whether the pop | boolean | - | | -| defaultVisible | Whether the pop | boolean | - | | -| onVisibleChange | Callback when the pop | (visible: boolean, type?: VisibleChangeType) => void | - | | -| popupContainer | Popup mounting container | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | -| popupClassName | Popup class name | string | - | | -| popupStyle | Popup inline style | React.CSSProperties | - | | -| popupProps | Props added to the popup | PopupProps | - | | -| popupContent | Custom popup content | React.ReactNode | - | | -| followTrigger | Whether to follow the trigger scroll | boolean | - | | -| filterLocal | Use local filtering, when the data source is remote, you need to close this item | boolean | true | | -| filter | Local filtering method, return a Boolean value to determine whether to retain | (key: string \| number, item: ObjectItem) => boolean | - | | -| onToggleHighlightItem | Callback when pressing keyboard up and down keys to switch the menu highlight option | (highlightKey: unknown, ...args: unknown[]) => void | - | | -| useVirtual | Whether to enable virtual scrolling mode | boolean | - | | -| dataSource | Data source, can dynamically render child items | Array\ | - | | -| itemRender | Render MenuItem content | (item: ObjectItem) => React.ReactNode | - | | -| onChange | Callback when AutoComplete changes | (value: string, actionType: string, item?: ObjectItem) => void | - | | -| onKeyDown | - | (e: React.KeyboardEvent\) => void | - | | -| fillProps | The key to fill in the value of the selection box | string | 'value' | | -| autoHighlightFirstItem | Automatically highlight the first option | boolean | true | | -| highlightKey | Highlight key | string | - | | -| defaultHighlightKey | Default highlight key | string | - | | -| onFocus | Callback when AutoComplete gets focus | InputProps['onFocus'] | - | | -| children | Child elements, reference the demo for details | ReactElementWithTypeMark \| ReactElementWithTypeMark[] | - | | -| highlightHolder | Whether to display the current highlighted option as a placeholder | boolean | - | | +| Param | Description | Type | Default Value | Required | +| ---------------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- | ------------- | -------- | +| size | Size | 'small' \| 'medium' \| 'large' | 'medium' | | +| value | Current value, for controlled mode | string \| number \| null | - | | +| defaultValue | Initial default value | string \| number | - | | +| placeholder | Placeholder when no value | string | - | | +| autoWidth | Whether the width of the drop | boolean | true | | +| label | Custom inline label | React.ReactNode | - | | +| hasClear | Whether to have a clear button (valid in single mode) | boolean | - | | +| state | Validation status | 'error' \| 'loading' \| 'success' \| 'warning' | - | | +| readOnly | Read | boolean | - | | +| disabled | Whether to disable the selector | boolean | - | | +| visible | Whether the pop | boolean | - | | +| defaultVisible | Whether the pop | boolean | - | | +| onVisibleChange | Callback when the pop | (visible: boolean, type?: VisibleChangeType) => void | - | | +| popupContainer | Popup mounting container | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | +| popupClassName | Popup class name | string | - | | +| popupStyle | Popup inline style | React.CSSProperties | - | | +| popupProps | Props added to the popup | React.ComponentPropsWithRef\ | - | | +| popupContent | Custom popup content | React.ReactNode | - | | +| followTrigger | Whether to follow the trigger scroll | boolean | - | | +| filterLocal | Use local filtering, when the data source is remote, you need to close this item | boolean | true | | +| filter | Local filtering method, return a Boolean value to determine whether to retain | (key: string \| number, item: ObjectItem) => boolean | - | | +| onToggleHighlightItem | Callback when pressing keyboard up and down keys to switch the menu highlight option | (
highlightKey?: string \| boolean \| NormalizedObjectItem \| null,
type?: HighlightChangeType
) => void | - | | +| useVirtual | Whether to enable virtual scrolling mode | boolean | - | | +| dataSource | Data source, can dynamically render child items | Array\ | - | | +| itemRender | Render MenuItem content | (item: ObjectItem) => React.ReactNode | - | | +| onChange | Callback when AutoComplete changes | (value: string, actionType: string, item?: ObjectItem) => void | - | | +| onKeyDown | - | (e: React.KeyboardEvent\) => void | - | | +| fillProps | The key to fill in the value of the selection box | string | 'value' | | +| autoHighlightFirstItem | Automatically highlight the first option | boolean | true | | +| highlightKey | Highlight key | string | - | | +| defaultHighlightKey | Default highlight key | string | - | | +| onFocus | Callback when AutoComplete gets focus | InputProps['onFocus'] | - | | +| children | Child elements, reference the demo for details | React.ReactNode | - | | +| highlightHolder | Whether to display the current highlighted option as a placeholder | boolean | - | | ### Select.OptionGroup @@ -171,22 +172,24 @@ This is because the layer's animation of the overlay is implemented by `classNam ### Select.Option -| Param | Description | Type | Default Value | Required | -| -------- | ------------------ | ------------------------------------------------ | ------------- | -------- | -| value | Option value | string \| number \| boolean \| null \| undefined | - | yes | -| disabled | Whether to disable | boolean | - | | +| Param | Description | Type | Default Value | Required | +| -------- | ---------------------------------------------- | ------------------------------------------------ | ------------- | -------- | +| value | Option value | string \| number \| boolean \| null \| undefined | - | | +| key | Option value, priority is lower than value | React.Key | - | | +| disabled | Whether to disable | boolean | - | | +| label | Option label, priority is higher than children | React.ReactNode | - | | +| children | Option label | React.ReactNode | - | | ### ObjectItem -| Param | Description | Type | Default Value | Required | -| ----------- | ----------- | ------------------------------------------------ | ------------- | -------- | -| value | - | string \| number \| boolean \| null \| undefined | - | | -| label | - | string \| number \| boolean | - | | -| color | - | string | - | | -| disabled | - | boolean | - | | -| children | - | DataSourceItem[] | - | | -| title | - | string | - | | -| \_\_isAddon | - | boolean | - | | +| Param | Description | Type | Default Value | Required | +| -------- | ------------------------------------------------------------ | ------------------------------------------------ | ------------- | -------- | +| value | Option value | string \| number \| boolean \| null \| undefined | - | | +| label | Option label | React.ReactNode | - | | +| color | Option background color, optional values are the same as Tag | TagProps['color'] | - | | +| disabled | Option is disabled | boolean | - | | +| children | Sub | DataSourceItem[] | - | | +| title | Option title | string \| null | - | | ### DataSourceItem diff --git a/components/select/__docs__/index.md b/components/select/__docs__/index.md index 360cd1413b..386cdb4348 100644 --- a/components/select/__docs__/index.md +++ b/components/select/__docs__/index.md @@ -28,7 +28,7 @@ | 参数 | 说明 | 类型 | 默认值 | 是否必填 | 支持版本 | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | -------- | -------- | | size | 选择器尺寸 | 'small' \| 'medium' \| 'large' | 'medium' | | - | -| children | 子元素,详细使用方法参考 demo | ReactElementWithTypeMark \| ReactElementWithTypeMark[] | - | | - | +| children | 子元素,详细使用方法参考 demo | React.ReactNode | - | | - | | name | name | string | - | | - | | value | 当前值,用于受控模式 | DataSourceItem \| DataSourceItem[] | - | | - | | defaultValue | 初始的默认值 | DataSourceItem \| DataSourceItem[] | - | | - | @@ -45,13 +45,13 @@ | popupContainer | 弹层挂载的容器节点 | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | - | | popupClassName | 弹层的 className | string | - | | - | | popupStyle | 弹层的内联样式 | React.CSSProperties | - | | - | -| popupProps | 添加到弹层上的属性 | PopupProps | - | | - | +| popupProps | 添加到弹层上的属性 | React.ComponentPropsWithRef\ | - | | - | | followTrigger | 是否跟随 trigger 滚动 | boolean | - | | - | | popupContent | 自定义弹层的内容 | React.ReactNode | - | | - | | menuProps | 弹层菜单属性 | MenuProps | - | | 1.18 | | filterLocal | 是否使用本地过滤,在数据源为远程的时候需要关闭此项 | boolean | true | | - | | filter | 本地过滤方法,返回一个 Boolean 值确定是否保留

**签名**:
**参数**:
_key_: 搜索关键字
_item_: 渲染节点的 item | (key: string \| number, item: ObjectItem) => boolean | - | | - | -| onToggleHighlightItem | 键盘上下键切换菜单高亮选项的回调 | (highlightKey?: unknown, type?: HighlightChangeType) => void | - | | - | +| onToggleHighlightItem | 键盘上下键切换菜单高亮选项的回调 | (
highlightKey?: string \| boolean \| NormalizedObjectItem \| null,
type?: HighlightChangeType
) => void | - | | - | | useVirtual | 是否开启虚拟滚动模式 | boolean | - | | - | | dataSource | 传入的数据源,可以动态渲染子项 | Array\ | - | | - | | itemRender | 渲染 MenuItem 内容的方法

**签名**:
**参数**:
_item_: 渲染节点的 item
_searchValue_: 搜索关键字(如果开启搜索) | (item: ObjectItem, searchValue: string \| undefined) => React.ReactNode | - | | - | @@ -61,6 +61,7 @@ | hasBorder | 是否有边框 | boolean | - | | - | | hasArrow | 是否有下拉箭头 | boolean | true | | - | | showSearch | 展开后是否能搜索(tag 模式下固定为 true) | boolean | false | | - | +| autoClearSearchValue | 是否在选中项后清空搜索框,只在 mode 为 multiple 或 tags 时有效 | boolean | true | | - | | onSearch | 当搜索框值变化时回调 | (value: string, e: React.ChangeEvent\) => void | - | | - | | onSearchClear | 当搜索框值被清空时候的回调 | (actionType?: string) => void | - | | - | | hasSelectAll | 多选模式下是否有全选功能 | boolean \| string | - | | - | @@ -90,42 +91,42 @@ ### Select.AutoComplete -| 参数 | 说明 | 类型 | 默认值 | 是否必填 | -| ---------------------- | -------------------------------------------------- | --------------------------------------------------------------- | -------- | -------- | -| size | 选择器尺寸 | 'small' \| 'medium' \| 'large' | 'medium' | | -| value | 当前值,用于受控模式 | string \| number \| null | - | | -| defaultValue | 初始化的默认值 | string \| number | - | | -| placeholder | 没有值的时候的占位符 | string | - | | -| autoWidth | 下拉菜单的宽度是否与选择器保持统一 | boolean | true | | -| label | 自定义内联 label | React.ReactNode | - | | -| hasClear | 是否有清除按钮(单选模式有效) | boolean | - | | -| state | 校验状态 | 'error' \| 'loading' \| 'success' \| 'warning' | - | | -| readOnly | 是否只读,只读模式下可以展开弹层但不能选 | boolean | - | | -| disabled | 是否禁用选择器 | boolean | - | | -| visible | 当前弹层是否显示 | boolean | - | | -| defaultVisible | 弹层初始化是否显示 | boolean | - | | -| onVisibleChange | 弹层显示或隐藏时触发的回调 | (visible: boolean, type?: VisibleChangeType) => void | - | | -| popupContainer | 弹层挂载的容器节点 | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | -| popupClassName | 弹层的 className | string | - | | -| popupStyle | 弹层的内联样式 | React.CSSProperties | - | | -| popupProps | 添加到弹层上的属性 | PopupProps | - | | -| popupContent | 自定义弹层的内容 | React.ReactNode | - | | -| followTrigger | 是否跟随 trigger 滚动 | boolean | - | | -| filterLocal | 是否使用本地过滤,在数据源为远程的时候需要关闭此项 | boolean | true | | -| filter | 本地过滤方法,返回一个 Boolean 值确定是否保留 | (key: string \| number, item: ObjectItem) => boolean | - | | -| onToggleHighlightItem | 键盘上下键切换菜单高亮选项的回调 | (highlightKey: unknown, ...args: unknown[]) => void | - | | -| useVirtual | 是否开启虚拟滚动模式 | boolean | - | | -| dataSource | 传入的数据源,可以动态渲染子项 | Array\ | - | | -| itemRender | 渲染 MenuItem 内容的方法 | (item: ObjectItem) => React.ReactNode | - | | -| onChange | AutoComplete 发生改变时触发的回调 | (value: string, actionType: string, item?: ObjectItem) => void | - | | -| onKeyDown | - | (e: React.KeyboardEvent\) => void | - | | -| fillProps | 填充到选择框里的值的 key | string | 'value' | | -| autoHighlightFirstItem | 自动高亮第一个选项 | boolean | true | | -| highlightKey | 高亮 key | string | - | | -| defaultHighlightKey | 默认高亮 key | string | - | | -| onFocus | AutoComplete 获得焦点时的回调 | InputProps['onFocus'] | - | | -| children | 子元素,详细使用方法参考 demo | ReactElementWithTypeMark \| ReactElementWithTypeMark[] | - | | -| highlightHolder | 是否将当前高亮的选项作为 placeholder | boolean | - | | +| 参数 | 说明 | 类型 | 默认值 | 是否必填 | +| ---------------------- | -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -------- | -------- | +| size | 选择器尺寸 | 'small' \| 'medium' \| 'large' | 'medium' | | +| value | 当前值,用于受控模式 | string \| number \| null | - | | +| defaultValue | 初始化的默认值 | string \| number | - | | +| placeholder | 没有值的时候的占位符 | string | - | | +| autoWidth | 下拉菜单的宽度是否与选择器保持统一 | boolean | true | | +| label | 自定义内联 label | React.ReactNode | - | | +| hasClear | 是否有清除按钮(单选模式有效) | boolean | - | | +| state | 校验状态 | 'error' \| 'loading' \| 'success' \| 'warning' | - | | +| readOnly | 是否只读,只读模式下可以展开弹层但不能选 | boolean | - | | +| disabled | 是否禁用选择器 | boolean | - | | +| visible | 当前弹层是否显示 | boolean | - | | +| defaultVisible | 弹层初始化是否显示 | boolean | - | | +| onVisibleChange | 弹层显示或隐藏时触发的回调 | (visible: boolean, type?: VisibleChangeType) => void | - | | +| popupContainer | 弹层挂载的容器节点 | string \| HTMLElement \| ((target: HTMLElement) => HTMLElement) | - | | +| popupClassName | 弹层的 className | string | - | | +| popupStyle | 弹层的内联样式 | React.CSSProperties | - | | +| popupProps | 添加到弹层上的属性 | React.ComponentPropsWithRef\ | - | | +| popupContent | 自定义弹层的内容 | React.ReactNode | - | | +| followTrigger | 是否跟随 trigger 滚动 | boolean | - | | +| filterLocal | 是否使用本地过滤,在数据源为远程的时候需要关闭此项 | boolean | true | | +| filter | 本地过滤方法,返回一个 Boolean 值确定是否保留 | (key: string \| number, item: ObjectItem) => boolean | - | | +| onToggleHighlightItem | 键盘上下键切换菜单高亮选项的回调 | (
highlightKey?: string \| boolean \| NormalizedObjectItem \| null,
type?: HighlightChangeType
) => void | - | | +| useVirtual | 是否开启虚拟滚动模式 | boolean | - | | +| dataSource | 传入的数据源,可以动态渲染子项 | Array\ | - | | +| itemRender | 渲染 MenuItem 内容的方法 | (item: ObjectItem) => React.ReactNode | - | | +| onChange | AutoComplete 发生改变时触发的回调 | (value: string, actionType: string, item?: ObjectItem) => void | - | | +| onKeyDown | - | (e: React.KeyboardEvent\) => void | - | | +| fillProps | 填充到选择框里的值的 key | string | 'value' | | +| autoHighlightFirstItem | 自动高亮第一个选项 | boolean | true | | +| highlightKey | 高亮 key | string | - | | +| defaultHighlightKey | 默认高亮 key | string | - | | +| onFocus | AutoComplete 获得焦点时的回调 | InputProps['onFocus'] | - | | +| children | 子元素,详细使用方法参考 demo | React.ReactNode | - | | +| highlightHolder | 是否将当前高亮的选项作为 placeholder | boolean | - | | ### Select.OptionGroup @@ -135,22 +136,24 @@ ### Select.Option -| 参数 | 说明 | 类型 | 默认值 | 是否必填 | -| -------- | -------- | ------------------------------------------------ | ------ | -------- | -| value | 选项值 | string \| number \| boolean \| null \| undefined | - | 是 | -| disabled | 是否禁用 | boolean | - | | +| 参数 | 说明 | 类型 | 默认值 | 是否必填 | +| -------- | ----------------------------- | ------------------------------------------------ | ------ | -------- | +| value | 选项值 | string \| number \| boolean \| null \| undefined | - | | +| key | 选项值,优先级低于 value | React.Key | - | | +| disabled | 是否禁用 | boolean | - | | +| label | 选项标签,优先级高于 children | React.ReactNode | - | | +| children | 选项标签 | React.ReactNode | - | | ### ObjectItem -| 参数 | 说明 | 类型 | 默认值 | 是否必填 | -| ----------- | ---- | ------------------------------------------------ | ------ | -------- | -| value | - | string \| number \| boolean \| null \| undefined | - | | -| label | - | string \| number \| boolean | - | | -| color | - | string | - | | -| disabled | - | boolean | - | | -| children | - | DataSourceItem[] | - | | -| title | - | string | - | | -| \_\_isAddon | - | boolean | - | | +| 参数 | 说明 | 类型 | 默认值 | 是否必填 | +| -------- | ------------------------ | ------------------------------------------------ | ------ | -------- | +| value | 选项值 | string \| number \| boolean \| null \| undefined | - | | +| label | 选项标签 | React.ReactNode | - | | +| color | 选项背景色,可选值同 Tag | TagProps['color'] | - | | +| disabled | 选项是否禁用 | boolean | - | | +| children | 子选项 | DataSourceItem[] | - | | +| title | 选项标题 | string \| null | - | | ### DataSourceItem From 97602785374fe6bdedfb8f5a97639b85d0fc32d2 Mon Sep 17 00:00:00 2001 From: mwb-27 <545879066@qq.com> Date: Fri, 6 Dec 2024 11:30:12 +0800 Subject: [PATCH 7/9] fix(DatePicker2): support defaultValue & value for quarter, close #3006 --- .../date-picker2/__tests__/index-spec.js | 57 +++++++++++++++++++ components/date-picker2/picker.jsx | 9 ++- components/util/func.ts | 31 +++++++++- package-lock.json | 12 ++-- 4 files changed, 100 insertions(+), 9 deletions(-) diff --git a/components/date-picker2/__tests__/index-spec.js b/components/date-picker2/__tests__/index-spec.js index 93e5989378..97b9ddd513 100644 --- a/components/date-picker2/__tests__/index-spec.js +++ b/components/date-picker2/__tests__/index-spec.js @@ -1257,6 +1257,63 @@ describe('Picker', () => { findInput().simulate('keydown', { keyCode: KEYCODE.ENTER }); assert(getStrValue(wrapper) === '12/02/2020'); }); + + // fix https://github.com/alibaba-fusion/next/issues/3006 + it('Support defaultValue & value for quarter', () => { + let defaultValueList = [ + [ + { in: '2021-Q2', out: '2021-Q2' }, + { in: '2021-Q3', out: '2021-Q3' }, + ], + [ + { in: '2021-4-1', out: '2021-Q2' }, + { in: '2021-8-1', out: '2021-Q3' }, + ], + ]; + defaultValueList.forEach(defaultValue => { + const inValue = defaultValue.map(item => item.in); + const outValue = defaultValue.map(item => item.out); + wrapper = mount(); + assert.deepEqual(getStrValue(), outValue); + }); + + defaultValueList = [ + { in: '2021-Q3', out: '2021-Q3' }, + { in: '2021-7-1', out: '2021-Q3' }, + ]; + defaultValueList.forEach(defaultValue => { + const { in: inValue, out: outValue } = defaultValue; + wrapper = mount(); + assert(getStrValue() === outValue); + }); + + let valueList = [ + [ + { in: '2021-Q2', out: '2021-Q2' }, + { in: '2021-Q3', out: '2021-Q3' }, + ], + [ + { in: '2021-4-1', out: '2021-Q2' }, + { in: '2021-8-1', out: '2021-Q3' }, + ], + ]; + valueList.forEach(value => { + const inValue = value.map(item => item.in); + const outValue = value.map(item => item.out); + wrapper = mount(); + assert.deepEqual(getStrValue(), outValue); + }); + + valueList = [ + { in: '2021-Q3', out: '2021-Q3' }, + { in: '2021-7-1', out: '2021-Q3' }, + ]; + valueList.forEach(value => { + const { in: inValue, out: outValue } = value; + wrapper = mount(); + assert(getStrValue() === outValue); + }); + }); }); }); diff --git a/components/date-picker2/picker.jsx b/components/date-picker2/picker.jsx index 049f8158d7..234d6228af 100644 --- a/components/date-picker2/picker.jsx +++ b/components/date-picker2/picker.jsx @@ -14,6 +14,7 @@ import DateInput from './panels/date-input'; import DatePanel from './panels/date-panel'; import RangePanel from './panels/range-panel'; import FooterPanel from './panels/footer-panel'; +import { getValueWithDayjs } from '../util/func'; const { Popup } = Overlay; const { pickProps, pickOthers } = obj; @@ -175,7 +176,9 @@ class Picker extends React.Component { } if ('value' in props) { - const value = isRange ? checkRangeDate(props.value, state.inputType, disabled) : checkDate(props.value); + let value = getValueWithDayjs(props.value, format); + + value = isRange ? checkRangeDate(value, state.inputType, disabled) : checkDate(value); if (isValueChanged(value, state.preValue)) { newState = { @@ -220,12 +223,14 @@ class Picker extends React.Component { */ getInitValue = () => { const { props } = this; - const { type, value, defaultValue } = props; + const { type, value, defaultValue, format } = props; let val = type === DATE_PICKER_TYPE.RANGE ? [null, null] : null; val = 'value' in props ? value : 'defaultValue' in props ? defaultValue : val; + val = getValueWithDayjs(val, format); + return this.checkValue(val); }; diff --git a/components/util/func.ts b/components/util/func.ts index 467ec8c96e..50ad3f6257 100644 --- a/components/util/func.ts +++ b/components/util/func.ts @@ -1,7 +1,6 @@ import type { ConfigType, OptionType, Dayjs } from 'dayjs'; import { isPromise } from './object'; import datejs from './date'; - export interface AnyFunction { (...args: unknown[]): Result; } @@ -198,3 +197,33 @@ export function checkRangeDate( return [begin, end]; } + +/** + * 字符型日期转为dayjs类型 + */ +export function getValueWithDayjs( + val: ConfigType | ConfigType[], + format: OptionType +): Array | Dayjs | null { + let date; + + if (Array.isArray(val)) { + date = val.map(v => { + return checkValueWithDayjs(v, format); + }); + } else { + date = checkValueWithDayjs(val, format); + } + return date; +} + +/** + * 将字符型转为dayjs类型,dayjs(x)解析无效时使用dayjs(x,format)再次解析。兼容YYYY-[Q]Q 季度类字符串 + */ +export function checkValueWithDayjs(val: ConfigType, format: OptionType): Dayjs | null { + let date = checkDate(val); + if (!date) { + date = checkDate(val, format); + } + return date; +} diff --git a/package-lock.json b/package-lock.json index 912e2c1e31..198edad293 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11184,9 +11184,9 @@ } }, "node_modules/dayjs": { - "version": "1.11.10", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", - "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==" }, "node_modules/debug": { "version": "4.3.4", @@ -45181,9 +45181,9 @@ "dev": true }, "dayjs": { - "version": "1.11.10", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", - "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==" }, "debug": { "version": "4.3.4", From 84eb9767d644c7280c73deb2a3198c58a70d17ad Mon Sep 17 00:00:00 2001 From: zyliang96 <1542607968@qq.com> Date: Fri, 6 Dec 2024 13:47:10 +0800 Subject: [PATCH 8/9] chore(*): Release-1.27.30 --- CHANGELOG.md | 18 ++++++++++++++++++ LATESTLOG.md | 14 ++++++++++++-- index.js | 2 +- package.json | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8563151c6..9044fd4f83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Change Log +## [1.27.30](https://github.com/alibaba-fusion/next/compare/1.27.28...1.27.30) (2024-12-06) + + +### Bug Fixes + +* **Badge:** set alignment by use transform ([fbda649](https://github.com/alibaba-fusion/next/commit/fbda649d53fe8bdf080b5cea51e2841233afa34c)) +* **Balloon:** v2 default offset adjustment ([3f5f818](https://github.com/alibaba-fusion/next/commit/3f5f81882963f8dbfb716c77a75622d001803b6e)) +* **CascaderSelect:** The value of the menuProps attribute is passed by props ([7a33369](https://github.com/alibaba-fusion/next/commit/7a33369dc01195edf5da7b15f7b9f2d45aa94ceb)) +* **Collapse:** Internal elements need to apply the radius configuration of external elements, close [#3277](https://github.com/alibaba-fusion/next/issues/3277) ([936c429](https://github.com/alibaba-fusion/next/commit/936c429ae74a2568d835b5f4c57b7abd94a6194c)) +* **DatePicker2:** support defaultValue & value for quarter, close [#3006](https://github.com/alibaba-fusion/next/issues/3006) ([9760278](https://github.com/alibaba-fusion/next/commit/97602785374fe6bdedfb8f5a97639b85d0fc32d2)) +* **Select:** Fix select doc ([af1c2e7](https://github.com/alibaba-fusion/next/commit/af1c2e7943be7f40e197cac0cd0b9db3fd5d44b0)) + + +### Code Refactoring + +* **ConfigProvider:** static reference to moment ([e74c307](https://github.com/alibaba-fusion/next/commit/e74c30744907d3c4e712c90c28e31bdf972bd160)) + + ## [1.27.29](https://github.com/alibaba-fusion/next/compare/1.27.28...1.27.29) (2024-11-12) diff --git a/LATESTLOG.md b/LATESTLOG.md index c4303f8b90..855b9bd4e4 100644 --- a/LATESTLOG.md +++ b/LATESTLOG.md @@ -1,9 +1,19 @@ # Latest Log -## [1.27.29](https://github.com/alibaba-fusion/next/compare/1.27.28...1.27.29) (2024-11-12) +## [1.27.30](https://github.com/alibaba-fusion/next/compare/1.27.28...1.27.30) (2024-12-06) ### Bug Fixes -* **Slider:** correct typo and improve types definition ([9d4f0f7](https://github.com/alibaba-fusion/next/commit/9d4f0f79efb48e0ab657862bef17d0b3040e6709)) +* **Badge:** set alignment by use transform ([fbda649](https://github.com/alibaba-fusion/next/commit/fbda649d53fe8bdf080b5cea51e2841233afa34c)) +* **Balloon:** v2 default offset adjustment ([3f5f818](https://github.com/alibaba-fusion/next/commit/3f5f81882963f8dbfb716c77a75622d001803b6e)) +* **CascaderSelect:** The value of the menuProps attribute is passed by props ([7a33369](https://github.com/alibaba-fusion/next/commit/7a33369dc01195edf5da7b15f7b9f2d45aa94ceb)) +* **Collapse:** Internal elements need to apply the radius configuration of external elements, close [#3277](https://github.com/alibaba-fusion/next/issues/3277) ([936c429](https://github.com/alibaba-fusion/next/commit/936c429ae74a2568d835b5f4c57b7abd94a6194c)) +* **DatePicker2:** support defaultValue & value for quarter, close [#3006](https://github.com/alibaba-fusion/next/issues/3006) ([9760278](https://github.com/alibaba-fusion/next/commit/97602785374fe6bdedfb8f5a97639b85d0fc32d2)) +* **Select:** Fix select doc ([af1c2e7](https://github.com/alibaba-fusion/next/commit/af1c2e7943be7f40e197cac0cd0b9db3fd5d44b0)) + + +### Code Refactoring + +* **ConfigProvider:** static reference to moment ([e74c307](https://github.com/alibaba-fusion/next/commit/e74c30744907d3c4e712c90c28e31bdf972bd160)) diff --git a/index.js b/index.js index e31ef5cca4..4e3e358f47 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ var next = require('./lib/index.js'); -next.version = '1.27.29'; +next.version = '1.27.30'; module.exports = next; diff --git a/package.json b/package.json index 7f3fcffc52..628502a465 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@alifd/next", - "version": "1.27.29", + "version": "1.27.30", "description": "A configurable component library for web built on React.", "keywords": [ "fusion", From 9469cb3362c24c722a789c931066baff73c2c699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E6=A6=95=E6=B4=B2?= <347628416@qq.com> Date: Tue, 10 Dec 2024 16:37:46 +0800 Subject: [PATCH 9/9] fix(NumberPicker): The hackChrome function lacks the conditional processing for precision being 0 #4998 --- components/number-picker/number-picker.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/number-picker/number-picker.tsx b/components/number-picker/number-picker.tsx index 2a45c6a8fa..8216f6696c 100644 --- a/components/number-picker/number-picker.tsx +++ b/components/number-picker/number-picker.tsx @@ -452,6 +452,8 @@ class NumberPicker extends React.Component const precision = this.getPrecision(); if (precision > 0) { return Number(Number(value).toFixed(precision)); + } else if (precision === 0) { + return Math.floor(value); } return value; }