diff options
| author | Henry Jameson <me@hjkos.com> | 2023-03-22 00:00:52 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2023-03-22 00:00:52 +0200 |
| commit | 6992439c92c247bf5b48155a76ff4e39a57b0ec7 (patch) | |
| tree | 49b3318cea1f209c200ec85342ddb8558c844d35 /src/components/settings_modal/helpers/boolean_setting.js | |
| parent | 2bf224e214d9b42333a2139a89c089ca9a544149 (diff) | |
fixes for diabled state, tri-state boolean and access control
Diffstat (limited to 'src/components/settings_modal/helpers/boolean_setting.js')
| -rw-r--r-- | src/components/settings_modal/helpers/boolean_setting.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/components/settings_modal/helpers/boolean_setting.js b/src/components/settings_modal/helpers/boolean_setting.js index 0df01d31..199d3d0f 100644 --- a/src/components/settings_modal/helpers/boolean_setting.js +++ b/src/components/settings_modal/helpers/boolean_setting.js @@ -3,13 +3,28 @@ import Setting from './setting.js' export default { ...Setting, + props: { + ...Setting.props, + indeterminateState: [String, Object] + }, components: { ...Setting.components, Checkbox }, + computed: { + ...Setting.computed, + isIndeterminate () { + return this.visibleState === this.indeterminateState + } + }, methods: { ...Setting.methods, getValue (e) { + // Basic tri-state toggle implementation + if (!!this.indeterminateState && !e && this.visibleState === true) { + // If we have indeterminate state, switching from true to false first goes through indeterminate + return this.indeterminateState + } return e } } |
