-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global options #1607
Comments
Related to #1569 |
@VividLemon maybe we use provide/inject, so have can have: |
Inject would work well for orchestrating the defaults, but I'm not sure how you would get it to influence prop defaults. The prop defaults needs to be an object literal. I don't think you're allowed to do some complex stuff. Alternatively, merging the values at runtime could work. Though not super ideal as props have nice features like template unwrapping |
any update on this ? |
Plan: The system is inspired by https://vuetifyjs.com/en/features/global-configuration/#using-in-custom-components The only con is that the default unwrapping of props in template is prevented. A minor nuisance, but unavoidable. The way I believe this works is, the options from the configurator get placed in a provide(), the useDefaults accepts the components props & component name. useDefaults is essentially // Psuedo, there is a way to make the name and props object strongly typed. I assume all props would need to be ComponentProps.ts imported style, rather than some declared inline, and some not export default (name: string, props: Record<string, unknown>) => {
const injectedProps = inject('propsString')
const mergeDefaults = computed(() => ({...injectedProps, ...props})) // Is props reactive?
return mergeDefaults // Would reactive(mergeDefaults) be more straightforward to use?
} Then each component would behave similarly to the steps shown in Vuetify In addition, some research could be done into how Vuetfiy actually creates their "withDefaults" function, perhaps there's some better methods they use to take inspirations from. The nested defaults isn't addressed in the example I gave, but could be interesting |
feat: implement global alias system fixes bootstrap-vue-next#1753 refactor: add bvn:: prefix to symbol keys refactor: fix typo in 'BCardImageProps' change to 'BCardImgProps'
* upstream/main: (23 commits) feat(BInput): Alias BFormInput to BInput fix(nuxt): dont teleport everything to #teleports -- selectively teleport based on body fixes bootstrap-vue-next#1898 chore: release main feat(nuxt): allow passthrough options to createBootstrap plugin chore: release main (bootstrap-vue-next#1894) feat: implmenet a use defaults system WIP fixes bootstrap-vue-next#1607 (bootstrap-vue-next#1889) docs(BCheckBox*): Small changes to get documentation to parity (bootstrap-vue-next#1873) docs: Add component reference link in the page table of contents sidebar fixed BTableLite item _showDetails BTable delete selection when primary-key chore: release main feat(BTable): add change event -- replaces bv `modelValue` see bootstrap-vue-next#1775 (comment) chore: release main fix(BTable): selectedItems not clearing values properly fixes bootstrap-vue-next#1878 (bootstrap-vue-next#1879) chore: release main (bootstrap-vue-next#1874) fix(BTable): Pass through original records to slots in most circumstances (bootstrap-vue-next#1869) chore: release main (bootstrap-vue-next#1867) feat(BTable): Allow dot in sortby key fix: update dependencies to fix a bug in vue compiler (bootstrap-vue-next#1866) chore: release main (bootstrap-vue-next#1859) ...
… (bootstrap-vue-next#1889) feat: implement a use defaults system fixes bootstrap-vue-next#1607 feat: implement global alias system fixes bootstrap-vue-next#1753 refactor: add bvn:: prefix to symbol keys refactor: fix typo in 'BCardImageProps' change to 'BCardImgProps' feat(BFormInput)!: move props lazy, trim & number to v-model modifier. Modifiers should behave more like native Vue modifiers (number modifier with unparseable value returns value as is) feat(BFormInput): type number performs the same as modifier feat(BCarouselSlide): allow individual interval for slides chore: update deps to fix some issues (nuxt useId, vue-tsc etc) docs: global options, aliases feat(nuxt): automatically globally set teleportTo to `#teleports` feat(BreakpointProps)!: strongly type breakpoints. Instead of weak string | number => 1,2,3...'1','2','3'... refactor(BRow): use script setup instead of options api refactor(BCol): use script setup instead of options api
A requirement of the library is to have a mechanism for creating "global options". Such as setting the default for props.
How exactly this would work idk yet.
But for instance this could be applied to having the nuxt module convert BLinks to NuxtLink (instead of RouterLink) by default, and other Nuxt specific options
The text was updated successfully, but these errors were encountered: