|
@@ -138,13 +138,15 @@ class DeviceSelector extends Component {
|
138
|
138
|
}
|
139
|
139
|
|
140
|
140
|
/**
|
141
|
|
- * Creates a AKDropdownMenu Component using passed in props and options.
|
|
141
|
+ * Creates a AKDropdownMenu Component using passed in props and options. If
|
|
142
|
+ * the dropdown needs to be disabled, then only the AKDropdownMenu trigger
|
|
143
|
+ * element is returned to simulate a disabled state.
|
142
|
144
|
*
|
143
|
145
|
* @param {Object} options - Additional configuration for display.
|
144
|
146
|
* @param {Object} options.defaultSelected - The option that should be set
|
145
|
147
|
* as currently chosen.
|
146
|
|
- * @param {boolean} options.isDisabled - If true, AKDropdownMenu will not
|
147
|
|
- * open on click.
|
|
148
|
+ * @param {boolean} options.isDisabled - If true, only the AKDropdownMenu
|
|
149
|
+ * trigger component will be returned to simulate a disabled dropdown.
|
148
|
150
|
* @param {Array} options.items - All the selectable options to display.
|
149
|
151
|
* @param {string} options.placeholder - The translation key to display when
|
150
|
152
|
* no selection has been made.
|
|
@@ -155,16 +157,22 @@ class DeviceSelector extends Component {
|
155
|
157
|
const triggerText
|
156
|
158
|
= (options.defaultSelected && options.defaultSelected.content)
|
157
|
159
|
|| options.placeholder;
|
|
160
|
+ const trigger = this._createDropdownTrigger(triggerText);
|
|
161
|
+
|
|
162
|
+ if (options.isDisabled) {
|
|
163
|
+ return (
|
|
164
|
+ <div className = 'device-selector-trigger-disabled'>
|
|
165
|
+ { trigger }
|
|
166
|
+ </div>
|
|
167
|
+ );
|
|
168
|
+ }
|
158
|
169
|
|
159
|
170
|
return (
|
160
|
171
|
<AKDropdownMenu
|
161
|
|
- { ...(options.isDisabled && { isOpen: !options.isDisabled }) }
|
162
|
172
|
items = { [ { items: options.items || [] } ] }
|
163
|
|
- noMatchesFound
|
164
|
|
- = { this.props.t('deviceSelection.noOtherDevices') }
|
165
|
173
|
onItemActivated = { this._onSelect }
|
166
|
174
|
shouldFitContainer = { true }>
|
167
|
|
- { this._createDropdownTrigger(triggerText) }
|
|
175
|
+ { trigger }
|
168
|
176
|
</AKDropdownMenu>
|
169
|
177
|
);
|
170
|
178
|
}
|
|
@@ -208,7 +216,7 @@ class DeviceSelector extends Component {
|
208
|
216
|
_renderNoPermission() {
|
209
|
217
|
return this._createDropdown({
|
210
|
218
|
isDisabled: true,
|
211
|
|
- placeholder: this.props.t('settings.noPermission')
|
|
219
|
+ placeholder: this.props.t('deviceSelection.noPermission')
|
212
|
220
|
});
|
213
|
221
|
}
|
214
|
222
|
}
|