dtable-ui-component 6.0.110-tru.2 → 6.0.110-tru.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/DTableCustomizeSelect/index.css +4 -0
- package/lib/DTableSelect/index.js +110 -14
- package/lib/DTableSelect/select-dropdown-indicator/index.css +12 -0
- package/lib/DTableSelect/select-dropdown-indicator/index.js +21 -0
- package/lib/DTableSelect/user-select.css +3 -50
- package/package.json +1 -1
- package/lib/DTableSelect/utils.js +0 -244
|
@@ -1,14 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
8
11
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactSelect =
|
|
10
|
-
var
|
|
12
|
+
var _reactSelect = _interopRequireWildcard(require("react-select"));
|
|
13
|
+
var _selectDropdownIndicator = _interopRequireDefault(require("./select-dropdown-indicator"));
|
|
14
|
+
var _DTableIcon = _interopRequireDefault(require("../DTableIcon"));
|
|
11
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const _excluded = ["innerProps"],
|
|
17
|
+
_excluded2 = ["children"];
|
|
18
|
+
const DropdownIndicator = props => {
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.DropdownIndicator, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
20
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectDropdownIndicator.default, {})
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
const ClearIndicator = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
innerProps
|
|
26
|
+
} = _ref,
|
|
27
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
28
|
+
const onMouseDown = e => {
|
|
29
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
30
|
+
innerProps.onMouseDown(e);
|
|
31
|
+
};
|
|
32
|
+
props.innerProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, innerProps), {}, {
|
|
33
|
+
onMouseDown
|
|
34
|
+
});
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.ClearIndicator, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
36
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
37
|
+
className: "d-flex align-items-center",
|
|
38
|
+
style: {
|
|
39
|
+
marginLeft: '-2px'
|
|
40
|
+
},
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
|
|
43
|
+
symbol: "close",
|
|
44
|
+
style: {
|
|
45
|
+
width: '12px',
|
|
46
|
+
height: '12px'
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
const MenuList = props => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
53
|
+
onClick: e => e.nativeEvent.stopImmediatePropagation(),
|
|
54
|
+
onMouseDown: e => e.nativeEvent.stopImmediatePropagation(),
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.MenuList, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
56
|
+
children: props.children
|
|
57
|
+
}))
|
|
58
|
+
});
|
|
59
|
+
const Option = props => {
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
61
|
+
style: props.data.style,
|
|
62
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.Option, (0, _objectSpread2.default)({}, props))
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const ValueContainer = _ref2 => {
|
|
66
|
+
var _props$selectProps$va;
|
|
67
|
+
let {
|
|
68
|
+
children
|
|
69
|
+
} = _ref2,
|
|
70
|
+
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
71
|
+
// Do not show '--'
|
|
72
|
+
const isClearOption = ((_props$selectProps$va = props.selectProps.value) === null || _props$selectProps$va === void 0 ? void 0 : _props$selectProps$va.value) === null;
|
|
73
|
+
if (isClearOption) {
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.ValueContainer, (0, _objectSpread2.default)({}, props));
|
|
75
|
+
}
|
|
76
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.ValueContainer, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
77
|
+
className: "seatable-select-value-container",
|
|
78
|
+
children: children
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
12
81
|
class DTableSelect extends _react.default.Component {
|
|
13
82
|
render() {
|
|
14
83
|
const {
|
|
@@ -30,23 +99,52 @@ class DTableSelect extends _react.default.Component {
|
|
|
30
99
|
autoFocus,
|
|
31
100
|
className
|
|
32
101
|
} = this.props;
|
|
33
|
-
|
|
102
|
+
if (isClearable) {
|
|
103
|
+
if (value && value.label !== '--' && options[0].label !== '--') {
|
|
104
|
+
options.unshift({
|
|
105
|
+
value: null,
|
|
106
|
+
label: '--'
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (value && value.label === '--' && options[0].label === '--') {
|
|
110
|
+
options.shift();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const optionsWithCheck = options.map(option => {
|
|
114
|
+
const isSelected = value && value.value === option.value;
|
|
115
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, option), {}, {
|
|
116
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
117
|
+
className: "d-flex align-items-center justify-content-between",
|
|
118
|
+
children: [option.label, isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
|
|
119
|
+
symbol: "check",
|
|
120
|
+
style: {
|
|
121
|
+
width: '12px',
|
|
122
|
+
height: '12px'
|
|
123
|
+
}
|
|
124
|
+
})]
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
});
|
|
34
128
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
|
|
35
129
|
value: value,
|
|
36
|
-
|
|
37
|
-
|
|
130
|
+
isDisabled: isDisabled,
|
|
131
|
+
ref: innerRef,
|
|
132
|
+
onChange: onChange,
|
|
133
|
+
options: optionsWithCheck,
|
|
38
134
|
isMulti: isMulti,
|
|
39
|
-
isClearable: false,
|
|
40
135
|
className: className,
|
|
41
136
|
classNamePrefix: classNamePrefix,
|
|
42
|
-
styles: style
|
|
137
|
+
styles: style,
|
|
43
138
|
components: {
|
|
44
|
-
Option
|
|
45
|
-
DropdownIndicator
|
|
46
|
-
MenuList
|
|
139
|
+
Option,
|
|
140
|
+
DropdownIndicator,
|
|
141
|
+
MenuList,
|
|
142
|
+
ClearIndicator,
|
|
143
|
+
ValueContainer
|
|
47
144
|
},
|
|
48
145
|
placeholder: placeholder,
|
|
49
146
|
isSearchable: isSearchable,
|
|
147
|
+
isClearable: false,
|
|
50
148
|
menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
|
|
51
149
|
,
|
|
52
150
|
menuShouldScrollIntoView: true,
|
|
@@ -54,11 +152,9 @@ class DTableSelect extends _react.default.Component {
|
|
|
54
152
|
captureMenuScroll: false,
|
|
55
153
|
hideSelectedOptions: false,
|
|
56
154
|
noOptionsMessage: noOptionsMessage,
|
|
57
|
-
isDisabled: isDisabled,
|
|
58
|
-
ref: innerRef,
|
|
59
155
|
filterOption: customFilterOption,
|
|
60
|
-
|
|
61
|
-
|
|
156
|
+
autoFocus: autoFocus,
|
|
157
|
+
form: form
|
|
62
158
|
});
|
|
63
159
|
}
|
|
64
160
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _DTableIcon = _interopRequireDefault(require("../../DTableIcon"));
|
|
10
|
+
require("./index.css");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
const SelectDropdownIndicator = () => {
|
|
13
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
14
|
+
className: "select-dropdown-indicator d-flex align-items-center",
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
|
|
17
|
+
symbol: "down"
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var _default = exports.default = SelectDropdownIndicator;
|
|
@@ -1,51 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.user-select .select-module.select-module-avatar {
|
|
7
|
-
height: 24px;
|
|
8
|
-
width: 24px;
|
|
9
|
-
border-radius: 50%;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.user-select .select-module.select-module-name {
|
|
13
|
-
color: #212529;
|
|
14
|
-
font-size: 14px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.user-select .true__value-container .select-module-container {
|
|
18
|
-
display: block;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.user-select .true__value-container .select-module.select-module-avatar {
|
|
22
|
-
height: 16px;
|
|
23
|
-
width: 16px;
|
|
24
|
-
border-radius: 50%;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.user-select .true__value-container .true__multi-value__label {
|
|
28
|
-
padding: 0px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.user-select .true__value-container .true__multi-value__label .select-module.select-module-avatar {
|
|
32
|
-
transform: translateY(-2px);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.user-select .true__value-container .select-module.select-module-name {
|
|
36
|
-
font-size: 13px;
|
|
37
|
-
overflow: hidden;
|
|
38
|
-
text-overflow: ellipsis;
|
|
39
|
-
white-space: nowrap;
|
|
40
|
-
flex: 1 1;
|
|
41
|
-
line-height: 20px;
|
|
42
|
-
margin-left: 5px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.user-select .true__control.true__control--is-focused,
|
|
46
|
-
.user-select .true__control.true__control--is-focused:hover {
|
|
47
|
-
background-color: #ffffff;
|
|
48
|
-
border-color: #1991eb;
|
|
49
|
-
outline: 0;
|
|
50
|
-
box-shadow: 0 0 0 2px rgba(70, 127, 207, 0.25);
|
|
1
|
+
/* hide checkbox in select value container */
|
|
2
|
+
.seatable-select-value-container .seatable-multicolor-icon-check {
|
|
3
|
+
display: none;
|
|
51
4
|
}
|
package/package.json
CHANGED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.processOptionsWithClear = exports.handleSelectChange = exports.createHandleChange = exports.UserSelectStyle = exports.Option = exports.MenuSelectStyle = exports.MenuList = exports.DropdownIndicator = exports.ClearIndicator = void 0;
|
|
8
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _reactSelect = require("react-select");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
const _excluded = ["innerProps"]; // DtableSelect is based on seatable-ui.css, so use the following content to override the default react-select style
|
|
14
|
-
const DEFAULT_CONTROL_STYLE = {
|
|
15
|
-
border: '1px solid rgba(0, 40, 100, 0.12) !important'
|
|
16
|
-
};
|
|
17
|
-
const FOCUS_CONTROL_STYLE = {
|
|
18
|
-
fontSize: '14px',
|
|
19
|
-
backgroundColor: '#ffffff',
|
|
20
|
-
borderColor: '#1991eb',
|
|
21
|
-
outline: '0',
|
|
22
|
-
boxShadow: '0 0 0 2px rgba(70, 127, 207, 0.25)'
|
|
23
|
-
};
|
|
24
|
-
const noneCallback = () => ({
|
|
25
|
-
display: 'none'
|
|
26
|
-
});
|
|
27
|
-
const controlCallback = (provided, state) => {
|
|
28
|
-
const {
|
|
29
|
-
isDisabled,
|
|
30
|
-
isFocused
|
|
31
|
-
} = state;
|
|
32
|
-
if (isFocused && !isDisabled) {
|
|
33
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), FOCUS_CONTROL_STYLE), {}, {
|
|
34
|
-
'&:hover': (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), FOCUS_CONTROL_STYLE)
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
38
|
-
fontSize: '14px',
|
|
39
|
-
lineHeight: '1.5',
|
|
40
|
-
cursor: 'pointer'
|
|
41
|
-
}, DEFAULT_CONTROL_STYLE), {}, {
|
|
42
|
-
'&:hover': (0, _objectSpread2.default)({}, DEFAULT_CONTROL_STYLE)
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const UserSelectStyle = exports.UserSelectStyle = {
|
|
46
|
-
option: (provided, state) => {
|
|
47
|
-
const {
|
|
48
|
-
isDisabled,
|
|
49
|
-
isFocused
|
|
50
|
-
} = state;
|
|
51
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
52
|
-
cursor: isDisabled ? 'default' : 'pointer',
|
|
53
|
-
backgroundColor: isFocused ? '#f5f5f5' : '#fff'
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
control: controlCallback,
|
|
57
|
-
indicatorSeparator: noneCallback,
|
|
58
|
-
dropdownIndicator: noneCallback,
|
|
59
|
-
clearIndicator: noneCallback,
|
|
60
|
-
multiValue: provided => {
|
|
61
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
62
|
-
display: 'inline-flex',
|
|
63
|
-
alignItems: 'center',
|
|
64
|
-
background: '#eaeaea',
|
|
65
|
-
borderRadius: '10px',
|
|
66
|
-
margin: '0 10px 0 0',
|
|
67
|
-
padding: '0 0 0 2px'
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
multiValueLabel: provided => {
|
|
71
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
72
|
-
padding: '0px'
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
multiValueRemove: provided => {
|
|
76
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
77
|
-
color: '#666',
|
|
78
|
-
':hover': {
|
|
79
|
-
backgroundColor: 'transparent',
|
|
80
|
-
color: '#555555'
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
singleValue: provided => {
|
|
85
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
86
|
-
display: 'inline-flex',
|
|
87
|
-
alignItems: 'center',
|
|
88
|
-
background: '#eaeaea',
|
|
89
|
-
borderRadius: '10px',
|
|
90
|
-
margin: '0',
|
|
91
|
-
padding: '0 2px',
|
|
92
|
-
width: 'fit-content'
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const MenuSelectStyle = exports.MenuSelectStyle = {
|
|
97
|
-
option: (provided, state) => {
|
|
98
|
-
const {
|
|
99
|
-
isDisabled,
|
|
100
|
-
isFocused
|
|
101
|
-
} = state;
|
|
102
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
103
|
-
padding: '8px',
|
|
104
|
-
fontSize: '14px',
|
|
105
|
-
color: '#212529',
|
|
106
|
-
cursor: isDisabled ? 'default' : 'pointer',
|
|
107
|
-
backgroundColor: isFocused ? '#f5f5f5' : '#fff',
|
|
108
|
-
borderRadius: '4px',
|
|
109
|
-
':active': {
|
|
110
|
-
backgroundColor: '#f5f5f5'
|
|
111
|
-
},
|
|
112
|
-
'.header-icon .dtable-font': {
|
|
113
|
-
color: '#999'
|
|
114
|
-
},
|
|
115
|
-
'.header-icon .multicolor-icon': {
|
|
116
|
-
color: '#999'
|
|
117
|
-
},
|
|
118
|
-
'.seatable-ui-select-tip': {
|
|
119
|
-
fontSize: '12px',
|
|
120
|
-
color: '#666666'
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
},
|
|
124
|
-
control: controlCallback,
|
|
125
|
-
menuPortal: base => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, base), {}, {
|
|
126
|
-
zIndex: 9999
|
|
127
|
-
}),
|
|
128
|
-
indicatorSeparator: noneCallback,
|
|
129
|
-
menuList: provided => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
130
|
-
padding: '8px'
|
|
131
|
-
}),
|
|
132
|
-
valueContainer: (provided, state) => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
133
|
-
padding: '2px 8px 2px 16px'
|
|
134
|
-
}),
|
|
135
|
-
dropdownIndicator: (provided, state) => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
136
|
-
padding: 0
|
|
137
|
-
})
|
|
138
|
-
};
|
|
139
|
-
const DropdownIndicator = props => {
|
|
140
|
-
return _reactSelect.components.DropdownIndicator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.DropdownIndicator, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
141
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
142
|
-
className: "dtable-font dtable-icon-down3",
|
|
143
|
-
style: {
|
|
144
|
-
fontSize: '12px',
|
|
145
|
-
marginLeft: '-2px',
|
|
146
|
-
color: '#666666',
|
|
147
|
-
paddingRight: '16px'
|
|
148
|
-
}
|
|
149
|
-
})
|
|
150
|
-
}));
|
|
151
|
-
};
|
|
152
|
-
exports.DropdownIndicator = DropdownIndicator;
|
|
153
|
-
const ClearIndicator = _ref => {
|
|
154
|
-
let {
|
|
155
|
-
innerProps
|
|
156
|
-
} = _ref,
|
|
157
|
-
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
158
|
-
const onMouseDown = e => {
|
|
159
|
-
e.nativeEvent.stopImmediatePropagation();
|
|
160
|
-
innerProps.onMouseDown(e);
|
|
161
|
-
};
|
|
162
|
-
props.innerProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, innerProps), {}, {
|
|
163
|
-
onMouseDown
|
|
164
|
-
});
|
|
165
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.ClearIndicator, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
166
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
167
|
-
className: "dtable-font dtable-icon-fork-number",
|
|
168
|
-
style: {
|
|
169
|
-
fontSize: '12px',
|
|
170
|
-
marginRight: '-2px'
|
|
171
|
-
}
|
|
172
|
-
})
|
|
173
|
-
}));
|
|
174
|
-
};
|
|
175
|
-
exports.ClearIndicator = ClearIndicator;
|
|
176
|
-
const MenuList = props => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
177
|
-
onClick: e => e.nativeEvent.stopImmediatePropagation(),
|
|
178
|
-
onMouseDown: e => e.nativeEvent.stopImmediatePropagation(),
|
|
179
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.MenuList, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
180
|
-
children: props.children
|
|
181
|
-
}))
|
|
182
|
-
});
|
|
183
|
-
exports.MenuList = MenuList;
|
|
184
|
-
const Option = props => {
|
|
185
|
-
const {
|
|
186
|
-
isSelected,
|
|
187
|
-
label
|
|
188
|
-
} = props;
|
|
189
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.Option, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
190
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
191
|
-
style: {
|
|
192
|
-
display: 'flex',
|
|
193
|
-
alignItems: 'center',
|
|
194
|
-
justifyContent: 'space-between',
|
|
195
|
-
width: '100%'
|
|
196
|
-
},
|
|
197
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
198
|
-
children: label
|
|
199
|
-
}), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
200
|
-
className: "dtable-font dtable-icon-check",
|
|
201
|
-
style: {
|
|
202
|
-
fontSize: '14px',
|
|
203
|
-
color: '#666666',
|
|
204
|
-
paddingLeft: '16px'
|
|
205
|
-
}
|
|
206
|
-
})]
|
|
207
|
-
})
|
|
208
|
-
}));
|
|
209
|
-
};
|
|
210
|
-
exports.Option = Option;
|
|
211
|
-
const processOptionsWithClear = (options, isClearable) => {
|
|
212
|
-
if (isClearable && options && options.length > 0) {
|
|
213
|
-
return [{
|
|
214
|
-
label: '--',
|
|
215
|
-
value: '__clear__'
|
|
216
|
-
}, ...options];
|
|
217
|
-
}
|
|
218
|
-
return options;
|
|
219
|
-
};
|
|
220
|
-
exports.processOptionsWithClear = processOptionsWithClear;
|
|
221
|
-
const handleSelectChange = (selectedOption, actionMeta, onChangeCallback, isMulti) => {
|
|
222
|
-
if (isMulti && Array.isArray(selectedOption)) {
|
|
223
|
-
const hasClear = selectedOption && selectedOption.some(opt => opt && opt.value === '__clear__');
|
|
224
|
-
if (hasClear) {
|
|
225
|
-
onChangeCallback([], (0, _objectSpread2.default)((0, _objectSpread2.default)({}, actionMeta), {}, {
|
|
226
|
-
action: 'clear'
|
|
227
|
-
}));
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
} else if (selectedOption && selectedOption.value === '__clear__') {
|
|
231
|
-
onChangeCallback(null, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, actionMeta), {}, {
|
|
232
|
-
action: 'clear'
|
|
233
|
-
}));
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
onChangeCallback(selectedOption, actionMeta);
|
|
237
|
-
};
|
|
238
|
-
exports.handleSelectChange = handleSelectChange;
|
|
239
|
-
const createHandleChange = (onChange, isMulti) => {
|
|
240
|
-
return (selectedOption, actionMeta) => {
|
|
241
|
-
handleSelectChange(selectedOption, actionMeta, onChange, isMulti);
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
exports.createHandleChange = createHandleChange;
|