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