@awes-io/ui 2.142.3 → 2.144.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/components/_index.css +7 -1
- package/assets/css/components/action-card.css +1 -0
- package/assets/css/components/action-icon.css +2 -2
- package/assets/css/components/alert.css +28 -22
- package/assets/css/components/animation.css +52 -32
- package/assets/css/components/badge.css +1 -0
- package/assets/css/components/banner-text.css +15 -4
- package/assets/css/components/card.css +0 -1
- package/assets/css/components/content-placeholder.css +104 -0
- package/assets/css/components/dropdown.css +20 -7
- package/assets/css/components/empty-container.css +69 -1
- package/assets/css/components/filter-chosen.css +6 -0
- package/assets/css/components/filter-date-range.css +17 -1
- package/assets/css/components/filter-month.css +23 -17
- package/assets/css/components/filter-select.css +11 -0
- package/assets/css/components/icon-menu-item.css +12 -7
- package/assets/css/components/layout.css +1 -32
- package/assets/css/components/mobile-menu-nav.css +8 -4
- package/assets/css/components/modal.css +1 -1
- package/assets/css/components/number.css +12 -0
- package/assets/css/components/page-aside.css +54 -0
- package/assets/css/components/text-field.css +4 -0
- package/assets/js/css.js +1 -1
- package/assets/js/icons/mono.js +59 -91
- package/assets/js/icons/multicolor.js +1 -31
- package/components/1_atoms/AwActionIcon.vue +11 -2
- package/components/1_atoms/AwContentPlaceholder.vue +60 -0
- package/components/1_atoms/AwFlow.vue +37 -49
- package/components/1_atoms/AwGrid.vue +11 -3
- package/components/1_atoms/AwIcon/AwIcon.vue +5 -3
- package/components/1_atoms/AwIcon/AwIconSystemMono.vue +3 -2
- package/components/1_atoms/AwInput.vue +2 -2
- package/components/1_atoms/AwLabel.vue +1 -1
- package/components/1_atoms/AwList.vue +3 -1
- package/components/1_atoms/AwRadio.vue +1 -1
- package/components/1_atoms/AwSlider.vue +15 -1
- package/components/1_atoms/AwTag.vue +6 -1
- package/components/2_molecules/AwAlert.vue +63 -42
- package/components/2_molecules/AwBadge.vue +1 -1
- package/components/2_molecules/AwBannerText.vue +8 -2
- package/components/2_molecules/AwButton.vue +1 -1
- package/components/2_molecules/AwDescriptionInput.vue +19 -1
- package/components/2_molecules/AwEmptyContainer.vue +74 -72
- package/components/2_molecules/AwNumber.vue +180 -0
- package/components/2_molecules/AwSelect.vue +11 -4
- package/components/3_organisms/AwBottomBar.vue +22 -4
- package/components/3_organisms/AwFilterChosen.vue +73 -0
- package/components/3_organisms/AwFilterDateRange.vue +177 -0
- package/components/3_organisms/AwFilterMonth.vue +37 -40
- package/components/3_organisms/AwFilterSelect.vue +368 -0
- package/components/3_organisms/AwMultiBlockBuilder.vue +1 -1
- package/components/3_organisms/AwSubnav.vue +11 -1
- package/components/3_organisms/AwTable/AwTableBuilder.vue +20 -60
- package/components/3_organisms/AwTable/_AwTableCellDropdown.vue +6 -1
- package/components/3_organisms/AwTable/_AwTableRow.vue +2 -1
- package/components/4_pages/AwPage.vue +1 -0
- package/components/4_pages/AwPageAside.vue +108 -0
- package/components/5_layouts/AwLayoutCenter.vue +3 -8
- package/components/5_layouts/_AwMenuItemIcon.vue +9 -2
- package/components/5_layouts/_AwMobileMenuItem.vue +5 -3
- package/components/5_layouts/_AwUserMenu.vue +1 -1
- package/components/_config.js +26 -1
- package/docs/_template.md +80 -0
- package/docs/components/atoms/aw-accordion-fold.md +129 -0
- package/docs/components/atoms/aw-action-card-body.md +99 -0
- package/docs/components/atoms/aw-action-card.md +130 -0
- package/docs/components/atoms/aw-action-icon.md +126 -0
- package/docs/components/atoms/aw-avatar.md +106 -0
- package/docs/components/atoms/aw-card.md +137 -0
- package/docs/components/atoms/aw-checkbox.md +288 -0
- package/docs/components/atoms/aw-content-placeholder.md +147 -0
- package/docs/components/atoms/aw-description.md +83 -0
- package/docs/components/atoms/aw-dock.md +90 -0
- package/docs/components/atoms/aw-dropdown-button.md +94 -0
- package/docs/components/atoms/aw-dropdown.md +178 -0
- package/docs/components/atoms/aw-file.md +73 -0
- package/docs/components/atoms/aw-flow.md +140 -0
- package/docs/components/atoms/aw-grid.md +109 -0
- package/docs/components/atoms/aw-headline.md +71 -0
- package/docs/components/atoms/aw-icon-system-color.md +122 -0
- package/docs/components/atoms/aw-icon-system-mono.md +206 -0
- package/docs/components/atoms/aw-icon.md +235 -0
- package/docs/components/atoms/aw-info.md +123 -0
- package/docs/components/atoms/aw-input.md +212 -0
- package/docs/components/atoms/aw-label.md +136 -0
- package/docs/components/atoms/aw-link.md +151 -0
- package/docs/components/atoms/aw-list.md +152 -0
- package/docs/components/atoms/aw-progress.md +119 -0
- package/docs/components/atoms/aw-radio.md +182 -0
- package/docs/components/atoms/aw-refresh-wrapper.md +81 -0
- package/docs/components/atoms/aw-select-native.md +234 -0
- package/docs/components/atoms/aw-slider.md +189 -0
- package/docs/components/atoms/aw-sub-headline.md +73 -0
- package/docs/components/atoms/aw-switcher.md +192 -0
- package/docs/components/atoms/aw-tag.md +144 -0
- package/docs/components/atoms/aw-title.md +70 -0
- package/docs/components/atoms/aw-toggler.md +90 -0
- package/docs/components/layouts/aw-layout-center.md +168 -0
- package/docs/components/layouts/aw-layout-error.md +153 -0
- package/docs/components/layouts/aw-layout-provider.md +238 -0
- package/docs/components/layouts/aw-layout.md +88 -0
- package/docs/components/molecules/aw-action-button.md +138 -0
- package/docs/components/molecules/aw-alert.md +191 -0
- package/docs/components/molecules/aw-badge.md +129 -0
- package/docs/components/molecules/aw-banner-text.md +156 -0
- package/docs/components/molecules/aw-button-nav.md +111 -0
- package/docs/components/molecules/aw-button.md +193 -0
- package/docs/components/molecules/aw-description-input.md +124 -0
- package/docs/components/molecules/aw-empty-container.md +235 -0
- package/docs/components/molecules/aw-island.md +506 -0
- package/docs/components/molecules/aw-number.md +138 -0
- package/docs/components/molecules/aw-select-object.md +401 -0
- package/docs/components/molecules/aw-select.md +215 -0
- package/docs/components/molecules/aw-tab-nav.md +108 -0
- package/docs/components/molecules/aw-tel.md +129 -0
- package/docs/components/molecules/aw-textarea.md +83 -0
- package/docs/components/molecules/aw-userpic.md +115 -0
- package/docs/components/organisms/aw-address-block.md +64 -0
- package/docs/components/organisms/aw-address.md +132 -0
- package/docs/components/organisms/aw-birthday-picker.md +73 -0
- package/docs/components/organisms/aw-bottom-bar.md +66 -0
- package/docs/components/organisms/aw-calendar-days.md +115 -0
- package/docs/components/organisms/aw-calendar-nav.md +98 -0
- package/docs/components/organisms/aw-calendar-view.md +98 -0
- package/docs/components/organisms/aw-calendar.md +166 -0
- package/docs/components/organisms/aw-chart.md +154 -0
- package/docs/components/organisms/aw-chip-select.md +164 -0
- package/docs/components/organisms/aw-chip.md +126 -0
- package/docs/components/organisms/aw-code-snippet.md +94 -0
- package/docs/components/organisms/aw-code.md +132 -0
- package/docs/components/organisms/aw-context-menu.md +117 -0
- package/docs/components/organisms/aw-cropper.md +151 -0
- package/docs/components/organisms/aw-date.md +161 -0
- package/docs/components/organisms/aw-display-date.md +33 -0
- package/docs/components/organisms/aw-download-link.md +46 -0
- package/docs/components/organisms/aw-fetch-data.md +161 -0
- package/docs/components/organisms/aw-filter-chosen.md +226 -0
- package/docs/components/organisms/aw-filter-date-range.md +205 -0
- package/docs/components/organisms/aw-filter-month.md +43 -0
- package/docs/components/organisms/aw-filter-select.md +239 -0
- package/docs/components/organisms/aw-form.md +174 -0
- package/docs/components/organisms/aw-gmap-marker.md +86 -0
- package/docs/components/organisms/aw-gmap.md +90 -0
- package/docs/components/organisms/aw-image-upload.md +56 -0
- package/docs/components/organisms/aw-island-avatar.md +87 -0
- package/docs/components/organisms/aw-markdown-editor.md +104 -0
- package/docs/components/organisms/aw-modal-buttons.md +57 -0
- package/docs/components/organisms/aw-modal.md +246 -0
- package/docs/components/organisms/aw-model-edit.md +74 -0
- package/docs/components/organisms/aw-money.md +53 -0
- package/docs/components/organisms/aw-multi-block-builder.md +165 -0
- package/docs/components/organisms/aw-pagination.md +121 -0
- package/docs/components/organisms/aw-password.md +103 -0
- package/docs/components/organisms/aw-preview-card.md +45 -0
- package/docs/components/organisms/aw-search.md +116 -0
- package/docs/components/organisms/aw-subnav.md +122 -0
- package/docs/components/organisms/aw-table-builder.md +165 -0
- package/docs/components/organisms/aw-table-col.md +123 -0
- package/docs/components/organisms/aw-table-head.md +92 -0
- package/docs/components/organisms/aw-table-row.md +91 -0
- package/docs/components/organisms/aw-table.md +172 -0
- package/docs/components/organisms/aw-tags.md +54 -0
- package/docs/components/organisms/aw-toggle-show-aside.md +43 -0
- package/docs/components/organisms/aw-uploader-files.md +125 -0
- package/docs/components/organisms/aw-uploader.md +163 -0
- package/docs/components/organisms/aw-user-menu.md +87 -0
- package/docs/components/pages/aw-page-aside.md +296 -0
- package/docs/components/pages/aw-page-menu-buttons.md +172 -0
- package/docs/components/pages/aw-page-modal.md +198 -0
- package/docs/components/pages/aw-page-single.md +300 -0
- package/docs/components/pages/aw-page.md +194 -0
- package/docs/configuration.md +493 -0
- package/docs/cookbook/advanced-patterns.md +1388 -0
- package/docs/cookbook/common-patterns.md +965 -0
- package/docs/cookbook/index.md +786 -0
- package/docs/getting-started.md +596 -0
- package/docs/guides/best-practices.md +1106 -0
- package/docs/guides/data-fetching.md +852 -0
- package/docs/guides/error-handling.md +1172 -0
- package/docs/guides/forms-guide.md +1329 -0
- package/docs/guides/mobile-subnavigation.md +359 -0
- package/docs/guides/page-patterns/aside-pages.md +1418 -0
- package/docs/guides/page-patterns/dashboard-pages.md +990 -0
- package/docs/guides/page-patterns/detail-pages.md +1556 -0
- package/docs/guides/page-patterns/list-pages.md +1242 -0
- package/docs/index.md +263 -1
- package/docs/integrations.md +870 -0
- package/docs/reference/colors.md +232 -0
- package/docs/reference/icons.md +163 -0
- package/docs/reference/menu.md +462 -0
- package/docs/reference/plugins.md +970 -0
- package/docs/reference/troubleshooting.md +964 -0
- package/nuxt/awes.config.js +9 -8
- package/nuxt/index.js +2 -2
- package/nuxt/pages/more.vue +1 -1
- package/package.json +5 -3
- package/readme.md +171 -1
- package/store/awesIo.js +11 -0
- package/CHANGELOG.md +0 -4520
- package/docs/aw-accordion-fold.md +0 -46
- package/docs/aw-address.md +0 -44
- package/docs/aw-avatar.md +0 -51
- package/docs/aw-badge.md +0 -32
- package/docs/aw-button-nav.md +0 -44
- package/docs/aw-button.md +0 -50
- package/docs/aw-calendar-days.md +0 -46
- package/docs/aw-calendar-nav.md +0 -25
- package/docs/aw-calendar-view.md +0 -12
- package/docs/aw-calendar.md +0 -59
- package/docs/aw-card.md +0 -48
- package/docs/aw-chart.md +0 -51
- package/docs/aw-checkbox.md +0 -56
- package/docs/aw-chip-select.md +0 -46
- package/docs/aw-chip.md +0 -53
- package/docs/aw-code-snippet.md +0 -18
- package/docs/aw-code.md +0 -56
- package/docs/aw-content-wrapper.md +0 -40
- package/docs/aw-context-menu.md +0 -31
- package/docs/aw-cropper.md +0 -60
- package/docs/aw-dashboard-card.md +0 -37
- package/docs/aw-dashboard-donut.md +0 -30
- package/docs/aw-dashboard-line.md +0 -20
- package/docs/aw-dashboard-progress.md +0 -33
- package/docs/aw-dashboard-section.md +0 -32
- package/docs/aw-dashboard-speed.md +0 -30
- package/docs/aw-date.md +0 -52
- package/docs/aw-dropdown-button.md +0 -31
- package/docs/aw-dropdown.md +0 -69
- package/docs/aw-fetch-data.md +0 -45
- package/docs/aw-form.md +0 -52
- package/docs/aw-grid.md +0 -48
- package/docs/aw-icon.md +0 -50
- package/docs/aw-info.md +0 -53
- package/docs/aw-input.md +0 -55
- package/docs/aw-layout-default.md +0 -30
- package/docs/aw-layout-frame-center.md +0 -29
- package/docs/aw-layout-simple.md +0 -49
- package/docs/aw-link.md +0 -54
- package/docs/aw-markdown-editor.md +0 -51
- package/docs/aw-modal.md +0 -63
- package/docs/aw-multi-block-builder.md +0 -66
- package/docs/aw-page.md +0 -36
- package/docs/aw-pagination.md +0 -54
- package/docs/aw-password.md +0 -48
- package/docs/aw-radio.md +0 -54
- package/docs/aw-search.md +0 -49
- package/docs/aw-select.md +0 -93
- package/docs/aw-slider.md +0 -40
- package/docs/aw-svg-image.md +0 -19
- package/docs/aw-switcher.md +0 -51
- package/docs/aw-tab-nav.md +0 -55
- package/docs/aw-table-builder.md +0 -58
- package/docs/aw-table-col.md +0 -33
- package/docs/aw-table-head.md +0 -28
- package/docs/aw-table-row.md +0 -33
- package/docs/aw-table.md +0 -59
- package/docs/aw-tel.md +0 -47
- package/docs/aw-textarea.md +0 -47
- package/docs/aw-toggler.md +0 -41
- package/docs/aw-uploader-files.md +0 -20
- package/docs/aw-uploader.md +0 -60
- package/docs/aw-user-menu.md +0 -34
- package/docs/aw-userpic.md +0 -34
- /package/components/{3_organisms → 2_molecules}/AwTel.vue +0 -0
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
---
|
|
2
|
+
metaTitle: Configuration | AwesCode UI
|
|
3
|
+
meta:
|
|
4
|
+
- name: description
|
|
5
|
+
content: Complete configuration guide for AwesCode UI - static settings, component defaults, and customization options.
|
|
6
|
+
title: Configuration
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Configuration
|
|
10
|
+
|
|
11
|
+
The AwesCode UI framework provides two types of configuration: static configuration for application-wide settings and dynamic component configuration for runtime customization.
|
|
12
|
+
|
|
13
|
+
## Static Configuration (awes.config.js)
|
|
14
|
+
|
|
15
|
+
Create an `awes.config.js` file in your project root to configure static settings like logos, backgrounds, fonts, and internationalization.
|
|
16
|
+
|
|
17
|
+
### Basic Structure
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
export default {
|
|
21
|
+
// Main configuration
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const dark = {
|
|
25
|
+
// Dark theme overrides
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const lang = {
|
|
29
|
+
// Internationalization settings
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const dayjs = {
|
|
33
|
+
// Date/time formatting
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const axios = {
|
|
37
|
+
// HTTP client settings
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const notify = {
|
|
41
|
+
// Notification defaults
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Default Configuration Options
|
|
46
|
+
|
|
47
|
+
#### Logo Configuration
|
|
48
|
+
|
|
49
|
+
Configure your application logo and its variants:
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
export default {
|
|
53
|
+
logo: {
|
|
54
|
+
src: '/logo.svg',
|
|
55
|
+
alt: 'My App'
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
fullLogo: {
|
|
59
|
+
src: '/logo-full.svg',
|
|
60
|
+
alt: 'My App Full Logo'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Default values:**
|
|
66
|
+
- `logo.src`: `'https://static.awes.io/logo-blue.svg'`
|
|
67
|
+
- `logo.alt`: `'AwesCode UI'`
|
|
68
|
+
- `fullLogo.src`: `'https://static.awes.io/logo-blue_white.svg'`
|
|
69
|
+
- `fullLogo.alt`: `'AwesCode UI'`
|
|
70
|
+
|
|
71
|
+
#### Background
|
|
72
|
+
|
|
73
|
+
Set a background image for your application:
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
export default {
|
|
77
|
+
background: {
|
|
78
|
+
src: '/background.svg'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Default:** `'https://static.awes.io/demo/awes-background.svg'`
|
|
84
|
+
|
|
85
|
+
#### Google Fonts
|
|
86
|
+
|
|
87
|
+
Load custom fonts from Google Fonts:
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
export default {
|
|
91
|
+
googleFont: 'https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap'
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Default:** `null` (no custom font)
|
|
96
|
+
|
|
97
|
+
#### Custom Styles
|
|
98
|
+
|
|
99
|
+
Import and apply custom style configurations:
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
import styles from '../assets/js/styles'
|
|
103
|
+
|
|
104
|
+
export default {
|
|
105
|
+
style: styles.custom
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Default:** `styles.default` (from `@awes-io/ui/assets/js/styles`)
|
|
110
|
+
|
|
111
|
+
### Dark Theme Configuration
|
|
112
|
+
|
|
113
|
+
Export a `dark` object to override settings for dark theme:
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
export const dark = {
|
|
117
|
+
logo: {
|
|
118
|
+
src: '/logo-dark.svg',
|
|
119
|
+
alt: 'My App Dark'
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
fullLogo: {
|
|
123
|
+
src: '/logo-full-dark.svg',
|
|
124
|
+
alt: 'My App Full Logo Dark'
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
background: {
|
|
128
|
+
src: '/background-dark.svg'
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
style: styles.dark
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Default dark theme values:**
|
|
136
|
+
- Inverts logo colors from the main theme
|
|
137
|
+
- Uses `styles.dark` for styling
|
|
138
|
+
|
|
139
|
+
### Internationalization (i18n)
|
|
140
|
+
|
|
141
|
+
Configure language and translation settings in `awes.config.js`:
|
|
142
|
+
|
|
143
|
+
```javascript
|
|
144
|
+
export const lang = {
|
|
145
|
+
// Available locales
|
|
146
|
+
locales: ['en', 'es', 'fr'],
|
|
147
|
+
|
|
148
|
+
// Default locale
|
|
149
|
+
locale: 'en',
|
|
150
|
+
|
|
151
|
+
// Suppress warnings
|
|
152
|
+
silentTranslationWarn: true,
|
|
153
|
+
silentFallbackWarn: true,
|
|
154
|
+
|
|
155
|
+
// Fetch translations from API
|
|
156
|
+
fetchTranslation: true,
|
|
157
|
+
|
|
158
|
+
// Translation statistics
|
|
159
|
+
statsTranslation: false,
|
|
160
|
+
statsAutoload: false,
|
|
161
|
+
|
|
162
|
+
// Language cookie name
|
|
163
|
+
langCookie: 'i18n_redirected',
|
|
164
|
+
|
|
165
|
+
// Retry configuration for loading translations
|
|
166
|
+
retry: {
|
|
167
|
+
retries: 5,
|
|
168
|
+
retryDelay: 5000,
|
|
169
|
+
block: false
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Note:** You don't need to configure i18n in `nuxt.config.js`. AwesCode UI handles i18n configuration automatically through `awes.config.js`. Only add the `lang` export if you need to customize from the defaults.
|
|
175
|
+
|
|
176
|
+
**Defaults:**
|
|
177
|
+
- `locales`: `['en']`
|
|
178
|
+
- `locale`: `'en'`
|
|
179
|
+
- `silentTranslationWarn`: `true`
|
|
180
|
+
- `silentFallbackWarn`: `true`
|
|
181
|
+
- `fetchTranslation`: `false`
|
|
182
|
+
- `statsTranslation`: `false`
|
|
183
|
+
- `statsAutoload`: `false`
|
|
184
|
+
- `langCookie`: `'i18n_redirected'`
|
|
185
|
+
- `retry.retries`: `5`
|
|
186
|
+
- `retry.retryDelay`: `5000`
|
|
187
|
+
- `retry.block`: `false`
|
|
188
|
+
|
|
189
|
+
### Date/Time Configuration
|
|
190
|
+
|
|
191
|
+
Configure Day.js for date and time formatting:
|
|
192
|
+
|
|
193
|
+
```javascript
|
|
194
|
+
export const dayjs = {
|
|
195
|
+
// String format options
|
|
196
|
+
stringFormat: {
|
|
197
|
+
pattern: 'YYYY-MM-DD',
|
|
198
|
+
format: true
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
// Day.js plugins to load
|
|
202
|
+
plugins: [
|
|
203
|
+
'dayjs/plugin/isLeapYear',
|
|
204
|
+
'dayjs/plugin/relativeTime',
|
|
205
|
+
'dayjs/plugin/utc',
|
|
206
|
+
'dayjs/plugin/timezone'
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Defaults:**
|
|
212
|
+
- `stringFormat.pattern`: `null`
|
|
213
|
+
- `stringFormat.format`: `true`
|
|
214
|
+
- `plugins`: `['dayjs/plugin/isLeapYear', 'dayjs/plugin/relativeTime']`
|
|
215
|
+
|
|
216
|
+
### Axios Configuration
|
|
217
|
+
|
|
218
|
+
Configure the HTTP client:
|
|
219
|
+
|
|
220
|
+
```javascript
|
|
221
|
+
export const axios = {
|
|
222
|
+
testUrl: 'https://api.example.com/health'
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Default:** `testUrl: 'https://httpbin.org/get'`
|
|
227
|
+
|
|
228
|
+
### Notification Defaults
|
|
229
|
+
|
|
230
|
+
Configure default notification behavior:
|
|
231
|
+
|
|
232
|
+
```javascript
|
|
233
|
+
export const notify = {
|
|
234
|
+
duration: 5000,
|
|
235
|
+
position: 'top-right'
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Default:** `{}` (empty object)
|
|
240
|
+
|
|
241
|
+
## Dynamic Component Configuration (Plugin)
|
|
242
|
+
|
|
243
|
+
For component defaults that may need runtime updates (e.g., after API requests), configure them in a Nuxt plugin using `Vue.prototype[CONFIG_VAR]`.
|
|
244
|
+
|
|
245
|
+
### Creating the Plugin
|
|
246
|
+
|
|
247
|
+
Create `plugins/components.js`:
|
|
248
|
+
|
|
249
|
+
```javascript
|
|
250
|
+
import Vue from 'vue'
|
|
251
|
+
import { CONFIG_VAR } from '@AwUtils/component'
|
|
252
|
+
|
|
253
|
+
export default async ({ app, $axios }) => {
|
|
254
|
+
// Initialize config object
|
|
255
|
+
Vue.prototype[CONFIG_VAR] = Vue.prototype[CONFIG_VAR] || {}
|
|
256
|
+
|
|
257
|
+
// Example: Fetch settings from API
|
|
258
|
+
try {
|
|
259
|
+
const settings = await $axios.$get('/api/settings')
|
|
260
|
+
|
|
261
|
+
// Configure components based on API response
|
|
262
|
+
Vue.prototype[CONFIG_VAR].AwButton = {
|
|
263
|
+
size: settings.buttonSize || 'md',
|
|
264
|
+
color: settings.primaryColor || 'accent',
|
|
265
|
+
theme: 'solid'
|
|
266
|
+
}
|
|
267
|
+
} catch (error) {
|
|
268
|
+
// Fallback to defaults if API fails
|
|
269
|
+
Vue.prototype[CONFIG_VAR].AwButton = {
|
|
270
|
+
size: 'md',
|
|
271
|
+
color: 'accent',
|
|
272
|
+
theme: 'solid'
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Configure other components
|
|
277
|
+
Vue.prototype[CONFIG_VAR].AwInput = {
|
|
278
|
+
baseClass: 'aw-text-field'
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
Vue.prototype[CONFIG_VAR].AwPageHeadline = {
|
|
282
|
+
breadcrumbMenu: true
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
Vue.prototype[CONFIG_VAR].AwTable = {
|
|
286
|
+
sortable: true,
|
|
287
|
+
filterable: true
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Registering the Plugin
|
|
293
|
+
|
|
294
|
+
Add the plugin to `nuxt.config.js`:
|
|
295
|
+
|
|
296
|
+
```javascript
|
|
297
|
+
export default {
|
|
298
|
+
plugins: [
|
|
299
|
+
'~/plugins/components.js'
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Available Component Configurations
|
|
305
|
+
|
|
306
|
+
Different components accept different configuration options. Here are some common examples:
|
|
307
|
+
|
|
308
|
+
#### AwButton
|
|
309
|
+
|
|
310
|
+
```javascript
|
|
311
|
+
Vue.prototype[CONFIG_VAR].AwButton = {
|
|
312
|
+
size: 'md', // sm, md, lg
|
|
313
|
+
color: 'accent', // accent, primary, success, error, mono
|
|
314
|
+
theme: 'solid' // solid, outline, ghost
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
#### AwInput
|
|
319
|
+
|
|
320
|
+
```javascript
|
|
321
|
+
Vue.prototype[CONFIG_VAR].AwInput = {
|
|
322
|
+
baseClass: 'aw-text-field'
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
#### AwPageHeadline
|
|
327
|
+
|
|
328
|
+
```javascript
|
|
329
|
+
Vue.prototype[CONFIG_VAR].AwPageHeadline = {
|
|
330
|
+
breadcrumbMenu: true
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### AwTable
|
|
335
|
+
|
|
336
|
+
```javascript
|
|
337
|
+
Vue.prototype[CONFIG_VAR].AwTable = {
|
|
338
|
+
sortable: true,
|
|
339
|
+
filterable: true,
|
|
340
|
+
perPage: 25
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## Complete Example
|
|
345
|
+
|
|
346
|
+
Here's a complete example showing both static and dynamic configuration:
|
|
347
|
+
|
|
348
|
+
### awes.config.js
|
|
349
|
+
|
|
350
|
+
```javascript
|
|
351
|
+
import styles from '../assets/js/styles'
|
|
352
|
+
|
|
353
|
+
export default {
|
|
354
|
+
logo: {
|
|
355
|
+
src: '/logo.svg',
|
|
356
|
+
alt: 'My Application'
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
fullLogo: {
|
|
360
|
+
src: '/logo-full.svg',
|
|
361
|
+
alt: 'My Application'
|
|
362
|
+
},
|
|
363
|
+
|
|
364
|
+
background: {
|
|
365
|
+
src: '/background.svg'
|
|
366
|
+
},
|
|
367
|
+
|
|
368
|
+
googleFont: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap',
|
|
369
|
+
|
|
370
|
+
style: styles.default
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export const dark = {
|
|
374
|
+
logo: {
|
|
375
|
+
src: '/logo-dark.svg'
|
|
376
|
+
},
|
|
377
|
+
|
|
378
|
+
fullLogo: {
|
|
379
|
+
src: '/logo-full-dark.svg'
|
|
380
|
+
},
|
|
381
|
+
|
|
382
|
+
background: {
|
|
383
|
+
src: '/background-dark.svg'
|
|
384
|
+
},
|
|
385
|
+
|
|
386
|
+
style: styles.dark
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export const lang = {
|
|
390
|
+
locales: ['en', 'es', 'fr'],
|
|
391
|
+
locale: 'en',
|
|
392
|
+
fetchTranslation: true,
|
|
393
|
+
langCookie: 'app_language'
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export const dayjs = {
|
|
397
|
+
stringFormat: {
|
|
398
|
+
pattern: 'YYYY-MM-DD',
|
|
399
|
+
format: true
|
|
400
|
+
},
|
|
401
|
+
plugins: [
|
|
402
|
+
'dayjs/plugin/relativeTime',
|
|
403
|
+
'dayjs/plugin/utc',
|
|
404
|
+
'dayjs/plugin/timezone'
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### plugins/components.js
|
|
410
|
+
|
|
411
|
+
```javascript
|
|
412
|
+
import Vue from 'vue'
|
|
413
|
+
import { CONFIG_VAR } from '@AwUtils/component'
|
|
414
|
+
|
|
415
|
+
export default async ({ app, $axios }) => {
|
|
416
|
+
Vue.prototype[CONFIG_VAR] = Vue.prototype[CONFIG_VAR] || {}
|
|
417
|
+
|
|
418
|
+
try {
|
|
419
|
+
const settings = await $axios.$get('/api/app/settings')
|
|
420
|
+
|
|
421
|
+
Vue.prototype[CONFIG_VAR].AwButton = {
|
|
422
|
+
size: settings.ui.buttonSize,
|
|
423
|
+
color: settings.ui.primaryColor,
|
|
424
|
+
theme: 'solid'
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
Vue.prototype[CONFIG_VAR].AwPageHeadline = {
|
|
428
|
+
breadcrumbMenu: settings.ui.showBreadcrumbs
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
Vue.prototype[CONFIG_VAR].AwTable = {
|
|
432
|
+
sortable: settings.ui.tableSortable,
|
|
433
|
+
filterable: settings.ui.tableFilterable,
|
|
434
|
+
perPage: settings.ui.tablePerPage
|
|
435
|
+
}
|
|
436
|
+
} catch (error) {
|
|
437
|
+
// Fallback to sensible defaults
|
|
438
|
+
Vue.prototype[CONFIG_VAR].AwButton = {
|
|
439
|
+
size: 'md',
|
|
440
|
+
color: 'accent',
|
|
441
|
+
theme: 'solid'
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
Vue.prototype[CONFIG_VAR].AwPageHeadline = {
|
|
445
|
+
breadcrumbMenu: true
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
Vue.prototype[CONFIG_VAR].AwTable = {
|
|
449
|
+
sortable: true,
|
|
450
|
+
filterable: true,
|
|
451
|
+
perPage: 25
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
## Accessing Configuration at Runtime
|
|
458
|
+
|
|
459
|
+
You can access the configuration in your components:
|
|
460
|
+
|
|
461
|
+
```javascript
|
|
462
|
+
export default {
|
|
463
|
+
computed: {
|
|
464
|
+
logoSrc() {
|
|
465
|
+
return this.$awes._config.logo.src
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
|
|
469
|
+
mounted() {
|
|
470
|
+
// Access component config
|
|
471
|
+
const buttonConfig = this[this.$options.CONFIG_VAR]?.AwButton
|
|
472
|
+
console.log('Button size:', buttonConfig?.size)
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## Best Practices
|
|
478
|
+
|
|
479
|
+
1. **Static for Branding**: Use `awes.config.js` for logos, colors, fonts, and other branding elements that don't change at runtime.
|
|
480
|
+
|
|
481
|
+
2. **Dynamic for User Settings**: Use the plugin approach for component configurations that depend on user preferences or API data.
|
|
482
|
+
|
|
483
|
+
3. **Provide Fallbacks**: Always provide sensible defaults in your plugin in case API requests fail.
|
|
484
|
+
|
|
485
|
+
4. **Keep It Simple**: Don't over-configure. Only customize what you need to change from the defaults.
|
|
486
|
+
|
|
487
|
+
5. **Document Custom Settings**: If you add custom configuration options, document them for your team.
|
|
488
|
+
|
|
489
|
+
## See Also
|
|
490
|
+
|
|
491
|
+
- [Getting Started](./getting-started.md) - Initial setup guide
|
|
492
|
+
- [Best Practices](./guides/best-practices.md) - Framework patterns and conventions
|
|
493
|
+
- [Component Index](./index.md) - Browse all available components
|