`;
-exports[`Renderer:select table with labelField & valueField 2`] = `Object {}`;
+exports[`Renderer:select table with labelField & valueField 2`] = `
+Object {
+ "a": "zhugeliang,libai",
+}
+`;
exports[`Renderer:select tree 1`] = `
diff --git a/scss/components/form/_selection.scss b/scss/components/form/_selection.scss
index 2c59639bd..158aac2de 100644
--- a/scss/components/form/_selection.scss
+++ b/scss/components/form/_selection.scss
@@ -46,7 +46,6 @@
user-select: none;
padding: var(--gap-xs) 0;
-
&-group > &-itemLabel {
padding: var(--gap-xs) var(--gap-base);
color: var(--FileControl-icon-color);
@@ -78,10 +77,10 @@
&:hover {
background: var(--Tree-item-onHover-bg);
-
- i {
- border: 1px solid var(--menu-active-color);
- }
+
+ i {
+ border: 1px solid var(--menu-active-color);
+ }
}
&.is-disabled {
@@ -117,6 +116,10 @@
border-top: var(--Table-borderWidth) solid var(--Table-borderColor);
}
+ .#{$ns}Table-table > tbody > tr {
+ cursor: pointer;
+ }
+
.#{$ns}Table-table > thead > tr > th,
.#{$ns}Table-table > tbody > tr > td {
font-size: var(--fontSizeSm);
@@ -347,4 +350,4 @@
float: right;
cursor: pointer;
}
-}
\ No newline at end of file
+}
diff --git a/scss/themes/cxd.scss b/scss/themes/cxd.scss
index d9974ad44..74673649a 100644
--- a/scss/themes/cxd.scss
+++ b/scss/themes/cxd.scss
@@ -124,8 +124,6 @@
}
}
-
-
.#{$ns}Toast {
.#{$ns}Toast-icon {
margin-right: #{px2rem(8px)};
diff --git a/src/components/ResultTableList.tsx b/src/components/ResultTableList.tsx
index 23325b4d3..823adb65e 100644
--- a/src/components/ResultTableList.tsx
+++ b/src/components/ResultTableList.tsx
@@ -43,7 +43,10 @@ export interface ResultTableSelectionState {
searchTableOptions: Options;
}
-export class BaseResultTableSelection extends BaseSelection {
+export class BaseResultTableSelection extends BaseSelection<
+ ResultTableSelectionProps,
+ ResultTableSelectionState
+> {
static defaultProps = {
...BaseSelection.defaultProps,
cellRender: (
@@ -55,25 +58,21 @@ export class BaseResultTableSelection extends BaseSelection {resolveVariable(column.name, option)},
+ ) => {resolveVariable(column.name, option)}
};
state: ResultTableSelectionState = {
tableOptions: [],
searching: false,
searchTableOptions: []
- }
+ };
static getDerivedStateFromProps(props: ResultTableSelectionProps) {
- const {
- options,
- value,
- option2value,
- } = props;
+ const {options, value, option2value} = props;
const valueArray = BaseSelection.value2array(value, options, option2value);
return {
tableOptions: valueArray
- }
+ };
}
@autobind
@@ -117,15 +116,16 @@ export class BaseResultTableSelection extends BaseSelection onSearch?.(inputValue, item));
+ const searchOptions = ((value || []) as Options).filter(item =>
+ onSearch?.(inputValue, item)
+ );
this.setState({
searching: true,
searchTableOptions: searchOptions
});
}
-
+
@autobind
clearSearch() {
this.setState({
@@ -152,9 +152,7 @@ export class BaseResultTableSelection extends BaseSelection
- {
- Array.isArray(value) && value.length ?
- (
+ {Array.isArray(value) && value.length ? (
- {raw}
- {
- ) => {
- e.stopPropagation();
- this.handleCloseItem(option);
- }}
- >
-
-
- }
- >)
+ <>
+ {raw}
+ {
+ ) => {
+ e.stopPropagation();
+ this.handleCloseItem(option);
+ }}
+ >
+
+
+ }
+ >
+ );
}
return raw;
}}
/>
- )
- : ({__(placeholder)} )
- }
+ ) : (
+ {__(placeholder)}
+ )}
);
}
@@ -211,7 +211,6 @@ export class BaseResultTableSelection extends BaseSelection
{title ? {title} : null}
diff --git a/src/components/TableSelection.tsx b/src/components/TableSelection.tsx
index 1ee350841..bce5d38f3 100644
--- a/src/components/TableSelection.tsx
+++ b/src/components/TableSelection.tsx
@@ -5,9 +5,12 @@ import {uncontrollable} from 'uncontrollable';
import Checkbox from './Checkbox';
import {Option} from './Select';
import {resolveVariable} from '../utils/tpl-builtin';
+import {noop} from '../utils/helper';
import {localeable} from '../locale';
export interface TableSelectionProps extends BaseSelectionProps {
+ /** 是否为结果渲染列表 */
+ resultMode?: boolean;
columns: Array<{
name: string;
label: string;
@@ -108,7 +111,8 @@ export class TableSelection extends BaseSelection {
multiple,
option2value,
translate: __,
- itemClassName
+ itemClassName,
+ resultMode
} = this.props;
const columns = this.getColumns();
let valueArray = BaseSelection.value2array(value, options, option2value);
@@ -122,6 +126,12 @@ export class TableSelection extends BaseSelection {
return (
e.defaultPrevented || this.toggleOption(option)
+ }
className={cx(
itemClassName,
option.className,
@@ -130,18 +140,15 @@ export class TableSelection extends BaseSelection {
)}
>
{multiple ? (
- {
e.stopPropagation();
this.toggleOption(option);
}}
>
-
+
|
) : null}
{columns.map((column, colIndex) => (
@@ -183,4 +190,4 @@ export default themeable(
value: 'onChange'
})
)
-);
\ No newline at end of file
+);
|