hongluan-ui
Version:
Hongluan Component Library for Vue 3
62 lines (59 loc) • 1.61 kB
JavaScript
import { defineComponent, watch, renderSlot } from 'vue';
import '../../../utils/index.mjs';
import '../../../constants/index.mjs';
import '../../../hooks/index.mjs';
import { isValidComponentSize } from '../../../utils/vue/validator.mjs';
import { PREFIX } from '../../../constants/prefix.mjs';
import { useEmptyValuesProps } from '../../../hooks/use-empty-values/index.mjs';
import { provideGlobalConfig } from '../../../hooks/use-global-config/index.mjs';
const messageConfig = {};
const configProviderProps = {
a11y: {
type: Boolean,
default: true
},
locale: {
type: Object
},
size: {
type: String,
validator: isValidComponentSize
},
zIndex: Number,
touchmoveForbid: {
type: Boolean,
default: true
},
systemIcons: {
type: Object,
value: () => ({})
},
experimentalFeatures: {
type: Object
},
keyboardNavigation: {
type: Boolean,
default: true
},
message: {
type: Object
},
namespace: {
type: String,
default: PREFIX.toLocaleLowerCase()
},
...useEmptyValuesProps
};
const ConfigProvider = defineComponent({
name: "ConfigProvider",
props: configProviderProps,
setup(props, { slots }) {
watch(() => props.message, (val) => {
Object.assign(messageConfig, val != null ? val : {});
}, { immediate: true, deep: true });
const config = provideGlobalConfig(props);
return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
}
});
export { configProviderProps, ConfigProvider as default, messageConfig };
//# sourceMappingURL=config-provider.mjs.map