Skip to content

Commit a21a6af

Browse files
committed
feat(JSONEditor): allows to configure statusBar visibility
1 parent b83f32d commit a21a6af

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

docs/composables/useTheme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export default {
5757
mainMenuBar: false,
5858
// Set the visibility of the navigation bar.
5959
navigationBar: false,
60+
// Set the visibility of the status bar.
61+
statusBar: false,
6062
},
6163
},
6264
operation: {
@@ -172,6 +174,7 @@ export default {
172174
| `setPlaygroundJsonEditorMode` | Sets the mode of the JSON editor. | `'tree'` | `'text'`, `'tree'`, `'table'` |
173175
| `setPlaygroundJsonEditorMainMenuBar` | Sets the visibility of the main menu bar. | `false` | `true`, `false` |
174176
| `setPlaygroundJsonEditorNavigationBar` | Sets the visibility of the navigation bar. | `false` | `true`, `false` |
177+
| `setPlaygroundJsonEditorStatusBar` | Sets the visibility of the status bar. | `false` | `true`, `false` |
175178

176179
## Operation Configuration
177180

src/components/Common/OAJSONEditor.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const isDark = themeConfig.isDark
3232
:main-menu-bar="themeConfig.getPlaygroundJsonEditorMainMenuBar()"
3333
:navigation-bar="themeConfig.getPlaygroundJsonEditorNavigationBar()"
3434
:mode="themeConfig.getPlaygroundJsonEditorMode()"
35+
:status-bar="themeConfig.getPlaygroundJsonEditorStatusBar()"
3536
class="oa-jse"
3637
:class="{
3738
'oa-jse-theme-dark': isDark,

src/composables/useTheme.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export interface PlaygroundConfig {
5757
mode: Ref<PlaygroundJsonEditorMode>
5858
mainMenuBar: Ref<boolean>
5959
navigationBar: Ref<boolean>
60+
statusBar: Ref<boolean>
6061
}
6162
}
6263

@@ -235,6 +236,7 @@ const themeConfig: UseThemeConfig = {
235236
mode: ref<PlaygroundJsonEditorMode>('tree'),
236237
mainMenuBar: ref<boolean>(false),
237238
navigationBar: ref<boolean>(false),
239+
statusBar: ref<boolean>(false),
238240
},
239241
},
240242
security: {
@@ -369,6 +371,10 @@ export function useTheme(initialConfig: PartialUseThemeConfig = {}) {
369371
setPlaygroundJsonEditorNavigationBar(config.playground.jsonEditor.navigationBar)
370372
}
371373

374+
if (config?.playground?.jsonEditor?.statusBar !== undefined) {
375+
setPlaygroundJsonEditorStatusBar(config.playground.jsonEditor.statusBar)
376+
}
377+
372378
if (config?.security?.defaultScheme !== undefined) {
373379
setSecurityDefaultScheme(config.security.defaultScheme)
374380
}
@@ -584,6 +590,15 @@ export function useTheme(initialConfig: PartialUseThemeConfig = {}) {
584590
themeConfig.playground.jsonEditor.navigationBar.value = value
585591
}
586592

593+
function getPlaygroundJsonEditorStatusBar(): boolean | undefined {
594+
return themeConfig?.playground?.jsonEditor?.statusBar.value
595+
}
596+
597+
function setPlaygroundJsonEditorStatusBar(value: boolean) {
598+
// @ts-expect-error: This is a valid expression.
599+
themeConfig.playground.jsonEditor.statusBar.value = value
600+
}
601+
587602
function getSecurityDefaultScheme(): string | null | undefined {
588603
return themeConfig?.security?.defaultScheme?.value
589604
}
@@ -877,6 +892,8 @@ export function useTheme(initialConfig: PartialUseThemeConfig = {}) {
877892
setPlaygroundJsonEditorMainMenuBar,
878893
getPlaygroundJsonEditorNavigationBar,
879894
setPlaygroundJsonEditorNavigationBar,
895+
getPlaygroundJsonEditorStatusBar,
896+
setPlaygroundJsonEditorStatusBar,
880897
getSecurityDefaultScheme,
881898
setSecurityDefaultScheme,
882899
getOperationBadges,

0 commit comments

Comments
 (0)