Commit e39af7e099bdc55dd3659aa4d03752a1d88769f1

Authored by 陈洋
1 parent 475c5592

feat: 排序添加 禁用操作

1 --- 1 ---
2 -title: 组件 2 +nav:
  3 + path: /component
  4 + title: 组件
  5 + order: 1
  6 +group:
  7 + path: /sort
  8 + title: 排序
  9 + order: 0
3 --- 10 ---
4 11
5 ### 排序规则 12 ### 排序规则
@@ -18,7 +18,7 @@ interface OptionItemProps { @@ -18,7 +18,7 @@ interface OptionItemProps {
18 code: string | number; 18 code: string | number;
19 extract?: { 19 extract?: {
20 widget?: string; 20 widget?: string;
21 - } 21 + };
22 } 22 }
23 23
24 interface SortItemProps { 24 interface SortItemProps {
@@ -44,6 +44,7 @@ interface QxSortConditionProps { @@ -44,6 +44,7 @@ interface QxSortConditionProps {
44 optionList: OptionItemProps[]; 44 optionList: OptionItemProps[];
45 sortList?: SortItemProps[]; 45 sortList?: SortItemProps[];
46 extraClassName?: string; // 定义额外 标签类名 覆盖排序原有样式 46 extraClassName?: string; // 定义额外 标签类名 覆盖排序原有样式
  47 + disabled?: boolean; // 是否整体禁用
47 } 48 }
48 49
49 const defaultSortList = [ 50 const defaultSortList = [
@@ -176,6 +177,7 @@ export const QxSortCondition: React.FC<QxSortConditionProps> = (props) => { @@ -176,6 +177,7 @@ export const QxSortCondition: React.FC<QxSortConditionProps> = (props) => {
176 > 177 >
177 {columns && ( 178 {columns && (
178 <Select 179 <Select
  180 + disabled={props?.disabled}
179 defaultValue={v.key} 181 defaultValue={v.key}
180 getPopupContainer={(triggerNode) => triggerNode} 182 getPopupContainer={(triggerNode) => triggerNode}
181 value={v.key} 183 value={v.key}
@@ -209,6 +211,7 @@ export const QxSortCondition: React.FC<QxSortConditionProps> = (props) => { @@ -209,6 +211,7 @@ export const QxSortCondition: React.FC<QxSortConditionProps> = (props) => {
209 </Select> 211 </Select>
210 )} 212 )}
211 <Select 213 <Select
  214 + disabled={props?.disabled}
212 defaultValue={String(v.asc)} 215 defaultValue={String(v.asc)}
213 getPopupContainer={(triggerNode) => triggerNode} 216 getPopupContainer={(triggerNode) => triggerNode}
214 value={String(v.asc)} 217 value={String(v.asc)}
@@ -238,7 +241,7 @@ export const QxSortCondition: React.FC<QxSortConditionProps> = (props) => { @@ -238,7 +241,7 @@ export const QxSortCondition: React.FC<QxSortConditionProps> = (props) => {
238 className={'operate-button'} 241 className={'operate-button'}
239 size="small" 242 size="small"
240 icon={<QxBaseIcon type={'qx-icon-minus'} />} 243 icon={<QxBaseIcon type={'qx-icon-minus'} />}
241 - disabled={sorts.length <= 1} 244 + disabled={props?.disabled || sorts.length <= 1}
242 onClick={() => removeSort(k)} 245 onClick={() => removeSort(k)}
243 /> 246 />
244 <Button 247 <Button
@@ -246,8 +249,8 @@ export const QxSortCondition: React.FC<QxSortConditionProps> = (props) => { @@ -246,8 +249,8 @@ export const QxSortCondition: React.FC<QxSortConditionProps> = (props) => {
246 size="small" 249 size="small"
247 icon={<QxBaseIcon type={'qx-icon-plus'} />} 250 icon={<QxBaseIcon type={'qx-icon-plus'} />}
248 disabled={ 251 disabled={
249 - sorts.length >=  
250 - ((columns || []).length > 3 ? 3 : (columns || []).length) 252 + props?.disabled || (sorts.length >=
  253 + ((columns || []).length > 3 ? 3 : (columns || []).length))
251 } 254 }
252 onClick={addSort} 255 onClick={addSort}
253 /> 256 />