@@ -6,13 +6,16 @@ import {
66 UseDisplayValueClass ,
77 UseFieldContainerClass ,
88 UseInlineFieldsContainerClass ,
9+ UsePrependAppendIconClasses ,
910} from '@/types' ;
1011import { componentName } from '../utils/globals' ;
1112
1213
1314// ------------------------------------------------ Main Container //
1415export const useInlineFieldsContainerClass : UseInlineFieldsContainerClass = ( options ) => {
15- const { field = '' , density = '' , disabled = false , iconSet = 'mdi' , loading = false , loadingWait, tableField = false } = options ;
16+ const { field = '' , density = '' , disabled = false , iconSet = 'mdi' , loading = false , loadingWait, tableField = false , variant } = options ;
17+
18+ const hasDensityAndVariant = density && variant ;
1619
1720 return {
1821 [ `${ componentName } ` ] : true ,
@@ -21,10 +24,22 @@ export const useInlineFieldsContainerClass: UseInlineFieldsContainerClass = (opt
2124 [ `${ componentName } --container-table` ] : tableField ,
2225 [ `${ componentName } --container-icon-set-${ iconSet } ` ] : true ,
2326 [ `${ componentName } --container-loading` ] : loading && loadingWait ,
27+ // Field //
2428 [ `${ componentName } --container-${ field } ` ] : true ,
2529 [ `${ componentName } --container-${ field } -${ density } ` ] : true ,
26- [ `vi-${ field } ` ] : true ,
27- [ `vi-${ field } -${ density } ` ] : true ,
30+ [ `${ componentName } --container-${ field } -${ density } -${ variant } ` ] : hasDensityAndVariant ,
31+ [ `${ componentName } --container-${ field } -${ variant } ` ] : variant ,
32+ [ `${ componentName } --container-${ field } -${ variant } -${ density } ` ] : hasDensityAndVariant ,
33+
34+ // Density //
35+ [ `${ componentName } --container-${ density } ` ] : density ,
36+ [ `${ componentName } --container-${ density } -${ field } ` ] : density ,
37+ [ `${ componentName } --container-${ density } -${ variant } ` ] : hasDensityAndVariant ,
38+
39+ // Variant //
40+ [ `${ componentName } --container-${ variant } ` ] : variant ,
41+ [ `${ componentName } --container-${ variant } -${ density } ` ] : hasDensityAndVariant ,
42+ [ `${ componentName } --container-${ variant } -${ field } ` ] : variant ,
2843 } ;
2944} ;
3045
@@ -34,6 +49,7 @@ export const useDisplayContainerClass: UseDisplayContainerClass = (options) => {
3449 const { field = '' , density = '' } = options ;
3550
3651 return {
52+ [ `${ componentName } --display-container` ] : true ,
3753 [ `${ componentName } --display-wrapper-value` ] : true ,
3854 [ `${ field } ` ] : true ,
3955 'v-input' : true ,
@@ -59,7 +75,6 @@ export const useDisplaySelectionControlClasses: UseDisplaySelectionControlClass
5975 const { density = '' } = options ;
6076
6177 return {
62- // 'v-selection-control': true,
6378 [ `v-selection-control--density-${ density } ` ] : true ,
6479 } ;
6580} ;
@@ -71,15 +86,29 @@ export const useDisplayValueClass: UseDisplayValueClass = (name, valueColor, opt
7186 [ `${ componentName } ` ] : true ,
7287 [ `${ componentName } --display-value-${ name } ` ] : true ,
7388 [ `${ componentName } --display-value` ] : true ,
74- [ `${ componentName } --display-wrapper- value-empty` ] : unref ( empty ) ,
89+ [ `${ componentName } --display-value-empty` ] : unref ( empty ) ,
7590 [ `text-${ valueColor } ` ] : ! unref ( error ) ,
7691 'text-danger' : unref ( error ) ,
7792 } ;
7893} ;
7994
8095
96+ // ------------------------ Prepend/Append Icons //
97+ export const usePrependAppendIconClasses : UsePrependAppendIconClasses = ( options ) => {
98+ const { inner = false , position } = options ;
99+
100+ return {
101+ [ `${ componentName } --display-icon` ] : ! inner ,
102+ [ `${ componentName } --display-${ position } -icon` ] : ! inner ,
103+ [ `${ componentName } --display-${ position } -inner-icon` ] : inner ,
104+ 'me-1' : position === 'prepend' ,
105+ 'ms-1' : position === 'append' ,
106+ } ;
107+ } ;
108+
109+
81110// ------------------------------------------------ Field Container //
82- export const useFieldContainerClass : UseFieldContainerClass = ( options ) : object => {
111+ export const useFieldContainerClass : UseFieldContainerClass = ( options ) => {
83112 const { name, active = false } = options ;
84113
85114 return {
@@ -95,12 +124,12 @@ export const useFieldContainerClass: UseFieldContainerClass = (options): object
95124export const useSaveFieldsContainerClass = ( ) : object => {
96125 return {
97126 [ `${ componentName } --save-fields-container` ] : true ,
98- 'align-center' : true ,
99- 'd-flex' : true ,
127+ // 'align-center': true,
128+ // 'd-flex': true,
100129 } ;
101130} ;
102131
103- export const useCancelButtonClass : UseCancelButtonClass = ( options ) : object => {
132+ export const useCancelButtonClass : UseCancelButtonClass = ( options ) => {
104133 const { cancelButtonVariant } = options ;
105134
106135 return {
0 commit comments