preferences-widget.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <script lang="ts" setup>
  2. import { loadLocaleMessages } from '@vben/locales';
  3. import {
  4. COLOR_PRIMARY_RESETS,
  5. preferences,
  6. updatePreferences,
  7. } from '@vben-core/preferences';
  8. import Preferences from './preferences.vue';
  9. </script>
  10. <template>
  11. <Preferences
  12. :app-ai-assistant="preferences.app.aiAssistant"
  13. :app-color-gray-mode="preferences.app.colorGrayMode"
  14. :app-color-weak-mode="preferences.app.colorWeakMode"
  15. :app-content-compact="preferences.app.contentCompact"
  16. :app-dynamic-title="preferences.app.dynamicTitle"
  17. :app-layout="preferences.app.layout"
  18. :app-locale="preferences.app.locale"
  19. :app-semi-dark-menu="preferences.app.semiDarkMenu"
  20. :app-theme-mode="preferences.app.themeMode"
  21. :breadcrumb-enable="preferences.breadcrumb.enable"
  22. :breadcrumb-hide-only-one="preferences.breadcrumb.hideOnlyOne"
  23. :breadcrumb-home="preferences.breadcrumb.showHome"
  24. :breadcrumb-icon="preferences.breadcrumb.showIcon"
  25. :breadcrumb-style-type="preferences.breadcrumb.styleType"
  26. :color-primary-presets="COLOR_PRIMARY_RESETS"
  27. :footer-enable="preferences.footer.enable"
  28. :footer-fixed="preferences.footer.fixed"
  29. :header-enable="preferences.header.enable"
  30. :header-mode="preferences.header.mode"
  31. :navigation-accordion="preferences.navigation.accordion"
  32. :navigation-split="preferences.navigation.split"
  33. :navigation-style-type="preferences.navigation.styleType"
  34. :shortcut-keys-enable="preferences.shortcutKeys.enable"
  35. :shortcut-keys-global-logout="preferences.shortcutKeys.globalLogout"
  36. :shortcut-keys-global-preferences="
  37. preferences.shortcutKeys.globalPreferences
  38. "
  39. :shortcut-keys-global-search="preferences.shortcutKeys.globalSearch"
  40. :sidebar-collapsed="preferences.sidebar.collapsed"
  41. :sidebar-collapsed-show-title="preferences.sidebar.collapsedShowTitle"
  42. :sidebar-enable="preferences.sidebar.enable"
  43. :tabbar-enable="preferences.tabbar.enable"
  44. :tabbar-show-icon="preferences.tabbar.showIcon"
  45. :theme-color-primary="preferences.theme.colorPrimary"
  46. :transition-enable="preferences.transition.enable"
  47. :transition-name="preferences.transition.name"
  48. :transition-progress="preferences.transition.progress"
  49. @update:app-ai-assistant="
  50. (val) => updatePreferences({ app: { aiAssistant: val } })
  51. "
  52. @update:app-color-gray-mode="
  53. (val) => updatePreferences({ app: { colorGrayMode: val } })
  54. "
  55. @update:app-color-weak-mode="
  56. (val) => updatePreferences({ app: { colorWeakMode: val } })
  57. "
  58. @update:app-content-compact="
  59. (val) => updatePreferences({ app: { contentCompact: val } })
  60. "
  61. @update:app-dynamic-title="
  62. (val) => updatePreferences({ app: { dynamicTitle: val } })
  63. "
  64. @update:app-layout="(val) => updatePreferences({ app: { layout: val } })"
  65. @update:app-locale="
  66. (val) => {
  67. updatePreferences({ app: { locale: val } });
  68. loadLocaleMessages(val);
  69. }
  70. "
  71. @update:app-semi-dark-menu="
  72. (val) => updatePreferences({ app: { semiDarkMenu: val } })
  73. "
  74. @update:app-theme-mode="
  75. (val) => updatePreferences({ app: { themeMode: val } })
  76. "
  77. @update:breadcrumb-enable="
  78. (val) => updatePreferences({ breadcrumb: { enable: val } })
  79. "
  80. @update:breadcrumb-hide-only-one="
  81. (val) => updatePreferences({ breadcrumb: { hideOnlyOne: val } })
  82. "
  83. @update:breadcrumb-show-home="
  84. (val) => updatePreferences({ breadcrumb: { showHome: val } })
  85. "
  86. @update:breadcrumb-show-icon="
  87. (val) => updatePreferences({ breadcrumb: { showIcon: val } })
  88. "
  89. @update:breadcrumb-style-type="
  90. (val) => updatePreferences({ breadcrumb: { styleType: val } })
  91. "
  92. @update:footer-enable="
  93. (val) => updatePreferences({ footer: { enable: val } })
  94. "
  95. @update:footer-fixed="
  96. (val) => updatePreferences({ footer: { fixed: val } })
  97. "
  98. @update:header-enable="
  99. (val) => updatePreferences({ header: { enable: val } })
  100. "
  101. @update:header-mode="(val) => updatePreferences({ header: { mode: val } })"
  102. @update:navigation-accordion="
  103. (val) => updatePreferences({ navigation: { accordion: val } })
  104. "
  105. @update:navigation-split="
  106. (val) => updatePreferences({ navigation: { split: val } })
  107. "
  108. @update:navigation-style-type="
  109. (val) => updatePreferences({ navigation: { styleType: val } })
  110. "
  111. @update:shortcut-keys-enable="
  112. (val) => updatePreferences({ shortcutKeys: { enable: val } })
  113. "
  114. @update:shortcut-keys-global-logout="
  115. (val) => updatePreferences({ shortcutKeys: { globalLogout: val } })
  116. "
  117. @update:shortcut-keys-global-preferences="
  118. (val) => updatePreferences({ shortcutKeys: { globalPreferences: val } })
  119. "
  120. @update:shortcut-keys-global-search="
  121. (val) => updatePreferences({ shortcutKeys: { globalSearch: val } })
  122. "
  123. @update:sidebar-collapsed="
  124. (val) => updatePreferences({ sidebar: { collapsed: val } })
  125. "
  126. @update:sidebar-collapsed-show-title="
  127. (val) => updatePreferences({ sidebar: { collapsedShowTitle: val } })
  128. "
  129. @update:sidebar-enable="
  130. (val) => updatePreferences({ sidebar: { enable: val } })
  131. "
  132. @update:tabbar-enable="
  133. (val) => updatePreferences({ tabbar: { enable: val } })
  134. "
  135. @update:tabbar-show-icon="
  136. (val) => updatePreferences({ tabbar: { showIcon: val } })
  137. "
  138. @update:theme-color-primary="
  139. (val) => updatePreferences({ theme: { colorPrimary: val } })
  140. "
  141. @update:transition-enable="
  142. (val) => updatePreferences({ transition: { enable: val } })
  143. "
  144. @update:transition-name="
  145. (val) => updatePreferences({ transition: { name: val } })
  146. "
  147. @update:transition-progress="
  148. (val) => updatePreferences({ transition: { progress: val } })
  149. "
  150. />
  151. </template>