From ec108c7964ff02f66021a1ca7ffa2b0cc6fa15dd Mon Sep 17 00:00:00 2001 From: GongFlying <150640661+gzcqqqqqqqq1@users.noreply.github.com> Date: Tue, 28 Apr 2026 17:36:01 +0800 Subject: [PATCH 1/2] update base ui --- src/AsyncUserSelect/index.css | 63 +++++++++++++--- src/AsyncUserSelect/index.js | 41 +++++++---- src/DTableCustomizeSelect/index.css | 29 ++++++-- .../utils/filter-item-utils.js | 4 +- .../widgets/collaborator-filter/index.js | 2 +- .../widgets/filter-list/index.css | 4 +- src/DTableGroupSelect/index.css | 73 +++++++++++++++++-- src/DTableGroupSelect/index.js | 2 +- src/DTableGroupSelect/select-option-group.css | 25 +++---- src/DTableGroupSelect/select-option-group.js | 21 +++++- src/DTableSelect/index.js | 10 +-- src/DTableSelect/utils.js | 62 ++++++++++++++-- src/SelectOptionGroup/index.css | 36 ++++++--- src/SelectOptionGroup/index.js | 41 +++++++++-- 14 files changed, 322 insertions(+), 91 deletions(-) diff --git a/src/AsyncUserSelect/index.css b/src/AsyncUserSelect/index.css index 997109e4..46bd8a54 100644 --- a/src/AsyncUserSelect/index.css +++ b/src/AsyncUserSelect/index.css @@ -3,6 +3,7 @@ height: auto !important; min-height: 38px; max-width: calc(100% - 10px); + padding: 0.4375rem 1rem 0.4375rem 0.5rem; } .dtable-ui-selected-users-container .dtable-ui-user-select-placeholder { @@ -12,40 +13,57 @@ .dtable-ui-user-select-popover .popover { width: 385px; max-width: 385px; + border-radius: 4px; + fill: #FFFFFF 100%; + background-color: #FFFFFF; + border: 1px solid #EEEEEE; + border-radius: 4px; + box-shadow: 0px 6px 14px rgba(0, 0, 0, 0.1); } .dtable-ui-user-select-container { position: relative; } -.dtable-ui-user-select-container .dtable-ui-user-search-container { - padding: 10px 10px 0 10px; -} - .dtable-ui-user-select-container .dtable-ui-user-search-container input { - height: 28px; + height: 32px; } .dtable-ui-user-select-container .dtable-ui-user-list-container { min-height: 160px; max-height: 200px; - margin: 10px 0; + padding: 8px !important; overflow: auto; + position: relative; +} + +.dtable-ui-user-select-container .form-control { + border: none; + border-bottom: 1px solid rgb(0 40 100 / 12%) !important; + border-radius: 4px 4px 0 0; + padding: .375rem 1rem !important; +} + +.dtable-ui-user-select-container .form-control:focus { + border-color: transparent !important; + border-bottom: 1px solid rgb(0 40 100 / 12%) !important; + box-shadow: none !important; } .dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container { display: flex; align-items: center; justify-content: space-between; - height: 30px; - padding: 0 10px; + height: 32px; + padding: 0 8px; font-size: 14px; cursor: pointer; + border-radius: 4px; } .dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container:hover, .dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container-highlight { - background: #f5f5f5; + background-color: rgba(0, 0, 0, 0.04); cursor: pointer; } @@ -61,16 +79,33 @@ background: transparent; } -.dtable-ui-user-list-container .dtable-ui-collaborator-check-icon .dtable-icon-check-mark { - color: #798d99; +.dtable-ui-user-list-container .dtable-ui-collaborator-check-icon .dtable-icon-check { + color: #666666; + font-size: 14px; +} + +.dtable-ui-user-select-container .dtable-ui-user-search-container .search-clear-btn { + position: absolute; + top: 5px; + right: 10px; + height: 22px; + line-height: 22px; + width: 28px; + text-align: center; + color: #999; + cursor: pointer; +} + +.dtable-ui-user-select-container .dtable-ui-user-search-container .search-clear-btn .dtable-icon-x { font-size: 12px; + color: #999999; } /* user-item */ .dtable-ui-user-item { display: inline-flex; align-items: center; - margin: 2px 10px 2px 0; + margin: 2px 4px 2px 0; padding: 0 8px 0 2px; height: 20px; font-size: 13px; @@ -120,3 +155,7 @@ color: #666666; cursor: pointer; } + +.dtable-ui-selected-users-container .dtable-ui-users-input { + padding-right: 37px; +} diff --git a/src/AsyncUserSelect/index.js b/src/AsyncUserSelect/index.js index 989b9ba4..d8f46346 100644 --- a/src/AsyncUserSelect/index.js +++ b/src/AsyncUserSelect/index.js @@ -191,20 +191,22 @@ const AsyncUserSelect = ({ className, emptyPlaceholder = '', searchPlaceholder = <>
- {selectedUsers.map((user, index) => { - return ( - - ); - })} - {selectedUsers.length === 0 && ( -
- {emptyPlaceholder || getLocale('Search_users')} -
- )} +
+ {selectedUsers.map((user, index) => { + return ( + + ); + })} + {selectedUsers.length === 0 && ( +
+ {emptyPlaceholder || getLocale('Search_users')} +
+ )} +
{selectorRef.current && ( + {searchValue && ( +
onSearchValueChanged('')} + title={getLocale('Clear_search_text')} + > + +
+ )}
{searchedUsers.length > 0 && ( @@ -239,7 +250,7 @@ const AsyncUserSelect = ({ className, emptyPlaceholder = '', searchPlaceholder = {selectedUsers.find(u => u.email === user.email) && (
- +
)}
diff --git a/src/DTableCustomizeSelect/index.css b/src/DTableCustomizeSelect/index.css index c425303e..bd68e391 100644 --- a/src/DTableCustomizeSelect/index.css +++ b/src/DTableCustomizeSelect/index.css @@ -4,7 +4,7 @@ .dtable-select.custom-select { display: flex; - padding: 0 10px; + padding: 0 16px; border-radius: 3px; align-items: center; justify-content: space-between; @@ -39,14 +39,10 @@ .dtable-select .dtable-icon-down3 { display: inline-block; font-size: 12px; - color: #999; + color: #666666; transition: all 0.1s; } -.dtable-select .dtable-icon-down3:hover { - color: #555; -} - .dtable-select .selected-option { display: flex; flex: 1; @@ -98,3 +94,24 @@ font-size: 14px; white-space: nowrap; } + +.option-group .option-group-selector-multiple-select .option-group-search, +.option-group .option-group-selector-single-select .option-group-search { + padding: 0 0 8px 0 !important; +} + +.option-group-selector-multiple-select .form-control, +.option-group-selector-single-select .form-control { + border: none; + border-bottom: 1px solid rgb(0 40 100 / 12%) !important; + border-radius: 4px 4px 0 0; + padding: .375rem .5rem !important; + height: 32px; +} + +.option-group-selector-multiple-select .form-control:focus, +.option-group-selector-single-select .form-control:focus { + border-color: transparent !important; + border-bottom: 1px solid rgb(0 40 100 / 12%) !important; + box-shadow: none !important; +} diff --git a/src/DTableFiltersPopover/utils/filter-item-utils.js b/src/DTableFiltersPopover/utils/filter-item-utils.js index 3f7c3fe0..42a7316e 100644 --- a/src/DTableFiltersPopover/utils/filter-item-utils.js +++ b/src/DTableFiltersPopover/utils/filter-item-utils.js @@ -72,7 +72,7 @@ class FilterItemUtils {
{option.name}
- {selectedOption?.id === option.id && } + {selectedOption?.id === option.id && }
) @@ -86,7 +86,7 @@ class FilterItemUtils {
{option.name}
- {filterTerm.indexOf(option.id) > -1 && } + {filterTerm.indexOf(option.id) > -1 && }
) diff --git a/src/DTableFiltersPopover/widgets/collaborator-filter/index.js b/src/DTableFiltersPopover/widgets/collaborator-filter/index.js index d9efc883..f84ab1c8 100644 --- a/src/DTableFiltersPopover/widgets/collaborator-filter/index.js +++ b/src/DTableFiltersPopover/widgets/collaborator-filter/index.js @@ -51,7 +51,7 @@ class CollaboratorFilter extends Component {
- {isSelected && } + {isSelected && }
diff --git a/src/DTableFiltersPopover/widgets/filter-list/index.css b/src/DTableFiltersPopover/widgets/filter-list/index.css index 0b076a0c..39412c41 100644 --- a/src/DTableFiltersPopover/widgets/filter-list/index.css +++ b/src/DTableFiltersPopover/widgets/filter-list/index.css @@ -205,7 +205,7 @@ .option-group-dtable-ui-collaborator-selector .option:hover, .option-group-dtable-ui-collaborator-selector .option.option-active { color: #212529; - background-color: #f7f7f7; + background-color: #f5f5f5; } .dtable-ui-filters-list .dtable-ui-multiple-select-selector .option.option-active .select-option-name, @@ -333,7 +333,7 @@ display: inline-flex; align-items: center; height: 20px; - margin-right: 10px; + margin-right: 4px; padding: 0 8px 0 2px; font-size: 13px; border-radius: 10px; diff --git a/src/DTableGroupSelect/index.css b/src/DTableGroupSelect/index.css index 142f671c..ab1667eb 100644 --- a/src/DTableGroupSelect/index.css +++ b/src/DTableGroupSelect/index.css @@ -4,7 +4,7 @@ .group-select.custom-select { display: flex; - padding: 5px 10px; + padding: 7px 8px !important; border-radius: 3px; align-items: center; justify-content: space-between; @@ -79,18 +79,81 @@ } .group-select .selected-option-show .selected-option-item { - background-color: rgb(240, 240, 240); - border-radius: 16px; + background-color: #F7F7F5; + border-radius: 4px !important; display: flex; align-items: center; + height: 24px; } .group-select .selected-option-show .selected-option-item .selected-option-item-name { - font-size: 13px; + font-size: 14px !important; color: #212529; + margin-left: 6px; + margin-right: 8px } .group-select .selected-option-show .selected-option-item .dtable-icon-x { cursor: pointer; - color: rgb(103, 103, 103); + color: #666666; + font-size: 12px; + margin-right: 6px; +} + +.seatable-group-select .option-group-search { + padding: 0 !important; +} + +.seatable-group-select .form-control { + border: none; + border-bottom: 1px solid rgb(0 40 100 / 12%) !important; + border-radius: 4px 4px 0 0; + padding: .375rem 1rem !important; + height: 32px; +} + +.seatable-group-select .form-control:focus { + border-color: transparent !important; + border-bottom: 1px solid rgb(0 40 100 / 12%) !important; + box-shadow: none !important; +} + +.option-group-content .dtable-icon-check { + color: #666666; + font-size: 14px; + margin-left: 16px; +} + +.option-group-content .label-check-icon { + width: 30px; +} + +.seatable-group-select .clear-search-text { + position: absolute; + display: inline-block; + height: 12px; + width: 12px; + line-height: 12px; + top: 10px !important; + right: 18px; +} + +.seatable-group-select .seatable-icon-btn:not(.disabled):hover { + background-color:#FFFFFF; +} + +.option-group-dtable-filter-select-column .seatable-icon-btn { + height: 12px !important; + width: 12px !important; + font-size: 12px !important; +} + +.option-group-dtable-filter-select-column .clear-search-text { + position: absolute; + display: inline-block; + height: 12px; + width: 12px; + line-height: 12px; + top: 12px; + right: 18px; } diff --git a/src/DTableGroupSelect/index.js b/src/DTableGroupSelect/index.js index 03437265..6f31aeee 100644 --- a/src/DTableGroupSelect/index.js +++ b/src/DTableGroupSelect/index.js @@ -75,7 +75,7 @@ class DTableGroupSelect extends Component { {selectedOptions.length > 0 ? {selectedOptions.map(item => - + {item.name} { this.props.onDeleteOption(item); }}> diff --git a/src/DTableGroupSelect/select-option-group.css b/src/DTableGroupSelect/select-option-group.css index 90f53cc9..555b279e 100644 --- a/src/DTableGroupSelect/select-option-group.css +++ b/src/DTableGroupSelect/select-option-group.css @@ -2,7 +2,6 @@ display: block; width: 100%; line-height: 24px; - padding: 6px 10px; clear: both; font-weight: 400; text-align: inherit; @@ -14,26 +13,26 @@ display: flex; align-items: center; justify-content: space-between; + padding: 0.25rem 8px; } -.group-selector .option .dtable-icon-check-mark { - font-size: 12px; - color: #798d99; +.group-selector .option .dtable-icon-check{ + font-size: 14px; + color: #666666; + height: 14px !important; + display: flex; + align-items: center; + justify-content: center; } .group-selector .option.option-active { - background-color: #20a0ff; - color: #fff; + background-color: #f5f5f5; + color: #212529; cursor: pointer; } -.group-selector .option.option-active .dtable-icon-check-mark, -.group-selector .option.option-active .select-option-name { - color: #fff !important; -} - -.group-selector .option .select-option-name .single-select-option { - margin: 0 0 0 12px; +.group-selector .option.option-active .dtable-icon-check-mark { + color: #666666 !important; } .group-selector .option .select-option-name .multiple-select-option { diff --git a/src/DTableGroupSelect/select-option-group.js b/src/DTableGroupSelect/select-option-group.js index 2fd83a94..3dd85ec3 100644 --- a/src/DTableGroupSelect/select-option-group.js +++ b/src/DTableGroupSelect/select-option-group.js @@ -4,6 +4,8 @@ import classnames from 'classnames'; import DTableSearchInput from '../DTableSearchInput'; import Option from './option'; import KeyCodes from '../SelectOptionGroup/KeyCodes'; +import IconButton from '../IconButton'; +import { getLocale } from '../lang'; import './select-option-group.css'; @@ -153,7 +155,7 @@ class SelectOptionGroup extends Component { disableHover={this.state.disableHover} >
{option.label}
- {isSelected && } + {isSelected && } ); }); @@ -170,24 +172,35 @@ class SelectOptionGroup extends Component { style = { position: 'fixed', left: position.x, - top: position.y + position.height, + top: position.y + position.height + 4, minWidth: position.width, opacity: 0, }; } return (
this.optionGroupRef = ref} style={style} onMouseDown={this.onMouseDown} > -
+
{ + return ( + + + + ); + }, + }} />
this.optionGroupContentRef = ref}> diff --git a/src/DTableSelect/index.js b/src/DTableSelect/index.js index 357b439e..e15e3041 100644 --- a/src/DTableSelect/index.js +++ b/src/DTableSelect/index.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import Select from 'react-select'; -import { MenuSelectStyle, DropdownIndicator, ClearIndicator, MenuList, Option } from './utils'; +import { MenuSelectStyle, DropdownIndicator, ClearIndicator, MenuList, Option, processOptionsWithClear, createHandleChange } from './utils'; export default class DTableSelect extends React.Component { @@ -44,19 +44,19 @@ export default class DTableSelect extends React.Component { render() { const { options, onChange, value, isSearchable, placeholder, isMulti, menuPosition, isClearable, noOptionsMessage, classNamePrefix, style, innerRef, isDisabled, form, customFilterOption, autoFocus, className } = this.props; + const processedOptions = processOptionsWithClear(options, isClearable); return ( { return options; }; -const handleSelectChange = (selectedOption, actionMeta, onChangeCallback) => { - if (selectedOption && selectedOption.value === '__clear__') { +const handleSelectChange = (selectedOption, actionMeta, onChangeCallback, isMulti) => { + if (isMulti && Array.isArray(selectedOption)) { + const hasClear = selectedOption && selectedOption.some(opt => opt && opt.value === '__clear__'); + if (hasClear) { + onChangeCallback([], { ...actionMeta, action: 'clear' }); + return; + } + } else if (selectedOption && selectedOption.value === '__clear__') { onChangeCallback(null, { ...actionMeta, action: 'clear' }); - } else { - onChangeCallback(selectedOption, actionMeta); + return; } + + onChangeCallback(selectedOption, actionMeta); }; -const createHandleChange = (onChange) => { +const createHandleChange = (onChange, isMulti) => { return (selectedOption, actionMeta) => { - handleSelectChange(selectedOption, actionMeta, onChange); + handleSelectChange(selectedOption, actionMeta, onChange, isMulti); }; }; diff --git a/src/SelectOptionGroup/index.css b/src/SelectOptionGroup/index.css index b86d3b24..3ac91146 100644 --- a/src/SelectOptionGroup/index.css +++ b/src/SelectOptionGroup/index.css @@ -41,6 +41,7 @@ flex: 1; max-height: 252px; overflow-y: auto; + padding: 8px; } .option-group .option-group-top { @@ -51,7 +52,7 @@ display: block; width: 100%; line-height: 24px; - padding: 0.25rem 10px; + padding: 0.25rem 8px; clear: both; font-weight: 400; text-align: inherit; @@ -60,30 +61,40 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + border-radius: 4px; } -.option.option-active { - background-color: #f5f5f5; - color: #212529; - cursor: pointer; +.option-group .option-group-search .form-control { + border: none; + border-bottom: 1px solid rgb(0 40 100 / 12%) !important; + border-radius: 4px 4px 0 0; + padding: .375rem 1rem !important; + height: 32px; } -.option:hover .header-icon .dtable-font, -.option:hover .header-icon .multicolor-icon, -.option.option-active .select-option-name { - color: #fff; +.option-group .option-group-search .form-control:focus { + border-color: transparent !important; + border-bottom: 1px solid rgb(0 40 100 / 12%) !important; + box-shadow: none !important; } -.option.option-active .header-icon .dtable-font, -.option.option-active .header-icon .multicolor-icon { - color: #fff; + +.option-group-content .label-check-icon { + margin-left: 16px; } -.option:not(.option-active):hover .header-icon .dtable-font, -.option:not(.option-active):hover .header-icon .multicolor-icon { - color: #aaa; +.option-group-content .dtable-icon-check { + font-size: 14px !important; + color: #666666; } +.option.option-active { + background-color: #f5f5f5; + color: #212529; + cursor: pointer; +} + + .option .select-option-name .multiple-select-option { margin: 0; } diff --git a/src/SelectOptionGroup/index.js b/src/SelectOptionGroup/index.js index ee82226d..197c5b46 100644 --- a/src/SelectOptionGroup/index.js +++ b/src/SelectOptionGroup/index.js @@ -5,8 +5,6 @@ import PropTypes from 'prop-types'; import DTableSearchInput from '../DTableSearchInput'; import KeyCodes from './KeyCodes'; import ClickOutside from '../ClickOutside'; -import IconButton from '../IconButton'; -import { getLocale } from '../lang'; import './index.css'; @@ -226,11 +224,7 @@ class SelectOptionGroup extends Component { isClearable={true} components={{ ClearIndicator: (props) => { - return ( - - - - ); + return { e.stopPropagation(); e.nativeEvent.stopImmediatePropagation(); props.clearValue(); }}/>; }, }} />