77 :class =" tableClasses"
88 :data-vdt-id =" tableId"
99 :density =" density"
10- :expand-on-click =" loadedDrilldown. expandOnClick"
10+ :expand-on-click =" expandOnClick"
1111 :expanded =" loadedDrilldown.expanded"
1212 :fixed-header =" loadedDrilldown.fixedHeader"
1313 :group-by =" loadedDrilldown.groupBy"
1414 :headers =" loadedDrilldown.headers"
1515 :height =" loadedDrilldown.height"
1616 :hide-no-data =" hidingNoData"
17- :hover =" loadedDrilldown. hover"
17+ :hover =" hover"
1818 :item-selectable =" loadedDrilldown.itemSelectable"
1919 :item-value =" loadedDrilldown.itemValue"
2020 :items =" loadedDrilldown.items"
2121 :items-length =" loadedDrilldown.itemsLength"
2222 :items-per-page =" loadedDrilldown.itemsPerPage"
23- :items-per-page-options =" loadedDrilldown. itemsPerPageOptions"
24- :loading =" (!loadedDrilldown. loaderType || slots.loading) && loadedDrilldown.loading"
23+ :items-per-page-options =" itemsPerPageOptions"
24+ :loading =" (!loaderType || slots.loading) && loadedDrilldown.loading"
2525 :multi-sort =" loadedDrilldown.multiSort"
2626 :must-sort =" loadedDrilldown.mustSort"
2727 :no-data-text =" loadedDrilldown.noDataText"
7474 :colors =" loadedDrilldown.colors"
7575 :column-widths =" loadedDrilldown.columnWidths"
7676 :density =" density"
77- :headerBackgroundColor =" headerBackgroundColor"
77+ :headerBackgroundColor =" settings. headerBackgroundColor"
7878 :headerColor =" headerColor"
7979 :items =" loadedDrilldown.items"
8080 :level =" level"
81- :loader-props =" loadedDrilldown. loaderProps"
81+ :loader-props =" loaderProps"
8282 :loader-settings =" {
8383 colspan: props.columns.length,
84- loaderType: loadedDrilldown. loaderType,
84+ loaderType: loaderType,
8585 loading: loadedDrilldown.loading,
8686 loadingText: loadingText,
8787 }"
8888 :match-column-widths =" loadedDrilldown.matchColumnWidths"
8989 :select-strategy =" loadedDrilldown.selectStrategy"
9090 :show-select =" loadedDrilldown.showSelect"
9191 :slot-props =" { ...props }"
92- :sort-asc-icon =" loadedDrilldown. sortAscIcon"
92+ :sort-asc-icon =" sortAscIcon"
9393 :sort-by =" loadedDrilldown.sortBy"
9494 :table-model-value =" loadedDrilldown.modelValue"
9595 >
137137 items: loadedDrilldown.items,
138138 loaderSettings: {
139139 colspan: props.columns.length,
140- loaderType: loadedDrilldown. loaderType,
140+ loaderType: loaderType,
141141 loading: loadedDrilldown.loading,
142142 loadingText: loadingText,
143143 },
199199 <ItemSlot
200200 :key =" level"
201201 :density =" density"
202- :expand-on-click =" loadedDrilldown. expandOnClick"
202+ :expand-on-click =" expandOnClick"
203203 :group-by =" loadedDrilldown.groupBy"
204204 :item-selectable =" loadedDrilldown.itemSelectable"
205205 :items =" loadedDrilldown.items"
237237 <VDrilldownTable
238238 :key =" internalItem.key"
239239 :column-widths =" loadedDrilldown.columnWidths"
240- :defaultColors =" defaultColors"
240+ :defaultColors =" settings. defaultColors"
241241 :density =" density"
242242 :drilldown =" loadedDrilldown"
243243 :footer-background-color =" footerBackgroundColor"
@@ -398,6 +398,7 @@ import {
398398 watchDebounced ,
399399 watchOnce ,
400400} from ' @vueuse/core' ;
401+ import { globalOptions } from ' ./' ;
401402
402403
403404// -------------------------------------------------- Emits & Slots & Injects //
@@ -417,13 +418,20 @@ const emit = defineEmits([
417418// -------------------------------------------------- Props //
418419const props = withDefaults (defineProps <Props >(), { ... AllProps });
419420
420- const { colorPercentageChange, colorPercentageDirection, defaultColors, density, footerBackgroundColor, footerColor, headerBackgroundColor, headerColor } = toRefs (props );
421+ const injectedOptions = inject (globalOptions , {});
422+ const settings = ref ({ ... props , ... injectedOptions });
423+
424+ const { colorPercentageChange, colorPercentageDirection, elevation, expandOnClick, footerBackgroundColor, footerColor, headerBackgroundColor, headerColor, hover, itemsPerPageOptions, loaderProps, loaderType, separator, sortAscIcon } = toRefs (settings .value );
421425
422426const slots = useSlots ();
423427const attrs = useAttrs ();
424428
425429const tableType = shallowRef <TableType >(null );
426430
431+ const density = computed (() => {
432+ return props .density ;
433+ });
434+
427435
428436// -------------------------------------------------- Mounted Hooks //
429437/**
@@ -447,7 +455,7 @@ onBeforeMount(() => {
447455let loadedDrilldown = reactive <Props >(Object .assign ({}, props ));
448456
449457if (loadedDrilldown ?.colors ) {
450- loadedDrilldown .colors .default = { ... defaultColorValues , ... defaultColors .value };
458+ loadedDrilldown .colors .default = { ... defaultColorValues , ... settings .value . defaultColors };
451459}
452460
453461
@@ -500,15 +508,19 @@ watch(() => props.loading, () => {
500508});
501509
502510watchEffect (() => {
503- if (loadedDrilldown .colors && defaultColors .value ) {
504- loadedDrilldown .colors .default = { ... defaultColorValues , ... defaultColors .value };
511+ if (loadedDrilldown .colors && settings .value . defaultColors ) {
512+ loadedDrilldown .colors .default = { ... defaultColorValues , ... settings .value . defaultColors };
505513 }
506514});
507515
516+ watchEffect (() => {
517+ settings .value = { ... props , ... injectedOptions };
518+ });
519+
508520
509521// -------------------------------------------------- Table #
510522const showLoadingDrilldownTable = (loading : boolean ): boolean => {
511- const loaderType = loadedDrilldown . loaderType ;
523+ const loaderType = unref ( settings . value . loaderType ) ;
512524
513525 if (loading ) {
514526 if (loaderType === ' skelton' ) {
@@ -531,13 +543,13 @@ const tableClasses = computed<object>(() => {
531543 const isServerSide = false ;
532544
533545 return useTableClasses ({
534- elevation: loadedDrilldown . elevation ,
546+ elevation: unref ( elevation ) ,
535547 fixedHeader: loadedDrilldown .fixedHeader ,
536548 isDrilldown: props .isDrilldown ,
537- isHover: loadedDrilldown . hover ,
549+ isHover: unref ( hover ) ,
538550 isServerSide ,
539551 level: loadedDrilldown .level ,
540- separator: loadedDrilldown . separator ,
552+ separator: unref ( separator ) ,
541553 });
542554});
543555
0 commit comments