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 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 />
... ...