Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 选择组件样式问题 #28

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,18 @@ const Internal = (props: ColorRangeSelectorProps) => {

return (
<Select.Option key={colorList.toString()} value={colorList.toString()}>
<div className={`${prefixCls}__selection-item`}>
{colorList.map((color) => (
<span
key={color}
className={`${prefixCls}__selection-item-color`}
style={{
backgroundColor: color,
height: '22px',
width: `${100 / colorList.length}%`,
}}
/>
))}
</div>
{colorList.map((color) => (
<span
key={color}
className={`${prefixCls}__selection-item-color`}
style={{
backgroundColor: color,
height: '22px',
width: `${100 / colorList.length}%`,
display: 'inline-block',
}}
/>
))}
</Select.Option>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ export default genStyleHook('color-range-selector', (token) => {
[componentCls]: {
maxWidth: 260,

[`${antCls}-select-selection-item`]: {
span: {
marginTop: 10,
},
},

[`${componentCls}__selection-item`]: {
display: 'flex',
alignItems: 'center',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
/* eslint-disable react/no-array-index-key */
import { usePrefixCls } from '@formily/antd-v5/esm/__builtins__';
import type { SelectProps } from 'antd';
import { Select } from 'antd';
import cls from 'classnames';
import React from 'react';
import { POSITION } from './contants';
import useStyle from './style';

const PositionSelect: React.FC<SelectProps> = (props) => {
const { options, ...prop } = props;
const prefixCls = usePrefixCls('formily-position-select');
const [wrapSSR, hashId] = useStyle(prefixCls);

return wrapSSR(
<Select {...prop} popupClassName={cls(`${prefixCls}`, hashId)}>
{(options ?? POSITION).map((item, index) => {
return (
<Select.Option value={item.value} key={index}>
<div className={cls(`${prefixCls}-item`, hashId)}>
<span>{item.label}</span>
</div>
</Select.Option>
);
})}
</Select>,
);
return <Select {...prop} options={options ?? POSITION} />;
};

export default PositionSelect;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,12 @@ const InternalSelect: React.FC<SelectProps<string, FieldSelectOptionType>> = (pr
{options?.map((item, index) => {
return (
<Select.Option value={item.value} key={index}>
<div className={cls(`${prefixCls}-item`, hashId)}>
{isUndefined(item.type) ? (
<Tag>未知</Tag>
) : (
<Tag color={item.typeColor}>{isUndefined(item.typeName) ? item.type : item.typeName}</Tag>
)}
<span title={item.label}>{item.label}</span>
</div>
{isUndefined(item.type) ? (
<Tag>未知</Tag>
) : (
<Tag color={item.typeColor}>{isUndefined(item.typeName) ? item.type : item.typeName}</Tag>
)}
<span title={item.label}>{item.label}</span>
</Select.Option>
);
})}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { genStyleHook } from '@formily/antd-v5/esm/__builtins__';

export default genStyleHook('field-select', (token) => {
const { componentCls, controlItemBgActive, controlItemBgHover, colorTextDescription } = token;
const { componentCls, controlItemBgActive, controlItemBgHover } = token;

return {
[componentCls]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,17 @@ const InternalRibbonSelect = (props: RibbonSelectProps) => {
const colorList = colorReverse ? [...item].reverse() : item;
return (
<Select.Option key={index} value={index}>
<div className={`${prefixCls}__selection-item`}>
{colorList.map((color) => (
<span
key={color}
style={{
backgroundColor: color,
height: '24px',
width: `${100 / colorList.length}%`,
}}
/>
))}
</div>
{colorList.map((color) => (
<span
key={color}
style={{
backgroundColor: color,
height: '24px',
width: `${100 / colorList.length}%`,
display: 'inline-block',
}}
/>
))}
</Select.Option>
);
})}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { genStyleHook } from '@formily/antd-v5/esm/__builtins__';

export default genStyleHook('ribbon-select', (token) => {
const { componentCls } = token;
const { componentCls, antCls } = token;

return {
[componentCls]: {
[`${componentCls}__selection-item`]: {
display: 'flex',
alignItems: 'center',
height: '100%',
[`${antCls}-select-selection-item`]: {
span: {
marginTop: 10,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nedd fix

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
},
},
};
Expand Down
Loading