Skip to content

Commit e05cd61

Browse files
authored
refactor: remove useless dom structrue (#710)
* test: update snapshot * test: update snapshot
1 parent ba2748b commit e05cd61

File tree

4 files changed

+4241
-4279
lines changed

4 files changed

+4241
-4279
lines changed

assets/index.less

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,11 @@
278278
// }
279279
}
280280

281-
&-column-holder {
282-
display: flex;
283-
flex-direction: column;
284-
text-align: center;
285-
}
281+
// &-column-holder {
282+
// display: flex;
283+
// flex-direction: column;
284+
// text-align: center;
285+
// }
286286

287287
&-column-title {
288288
font-size: 14px;

src/PickerPanel/TimePanel/TimePanelBody/TimeColumn.tsx

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -89,44 +89,42 @@ export default function TimeColumn<DateType extends object>(props: TimeUnitColum
8989
const columnPrefixCls = `${panelPrefixCls}-column`;
9090

9191
return (
92-
<div className={`${columnPrefixCls}-holder`} data-type={type}>
93-
<ul className={columnPrefixCls} ref={ulRef} onScroll={onInternalScroll}>
94-
{units.map(({ label, value: unitValue, disabled }) => {
95-
const inner = <div className={`${cellPrefixCls}-inner`}>{label}</div>;
96-
97-
return (
98-
<li
99-
key={unitValue}
100-
className={classNames(cellPrefixCls, {
101-
[`${cellPrefixCls}-selected`]: value === unitValue,
102-
[`${cellPrefixCls}-disabled`]: disabled,
103-
})}
104-
onClick={() => {
105-
if (!disabled) {
106-
onChange(unitValue);
107-
}
108-
}}
109-
onDoubleClick={() => {
110-
if (!disabled && onDblClick) {
111-
onDblClick();
112-
}
113-
}}
114-
data-value={unitValue}
115-
>
116-
{cellRender
117-
? cellRender(unitValue, {
118-
prefixCls,
119-
originNode: inner,
120-
today: now,
121-
type: 'time',
122-
subType: type,
123-
locale,
124-
})
125-
: inner}
126-
</li>
127-
);
128-
})}
129-
</ul>
130-
</div>
92+
<ul className={columnPrefixCls} ref={ulRef} data-type={type} onScroll={onInternalScroll}>
93+
{units.map(({ label, value: unitValue, disabled }) => {
94+
const inner = <div className={`${cellPrefixCls}-inner`}>{label}</div>;
95+
96+
return (
97+
<li
98+
key={unitValue}
99+
className={classNames(cellPrefixCls, {
100+
[`${cellPrefixCls}-selected`]: value === unitValue,
101+
[`${cellPrefixCls}-disabled`]: disabled,
102+
})}
103+
onClick={() => {
104+
if (!disabled) {
105+
onChange(unitValue);
106+
}
107+
}}
108+
onDoubleClick={() => {
109+
if (!disabled && onDblClick) {
110+
onDblClick();
111+
}
112+
}}
113+
data-value={unitValue}
114+
>
115+
{cellRender
116+
? cellRender(unitValue, {
117+
prefixCls,
118+
originNode: inner,
119+
today: now,
120+
type: 'time',
121+
subType: type,
122+
locale,
123+
})
124+
: inner}
125+
</li>
126+
);
127+
})}
128+
</ul>
131129
);
132130
}

0 commit comments

Comments
 (0)