@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.
Files changed (264) hide show
  1. package/assets/css/components/_index.css +7 -1
  2. package/assets/css/components/action-card.css +1 -0
  3. package/assets/css/components/action-icon.css +2 -2
  4. package/assets/css/components/alert.css +28 -22
  5. package/assets/css/components/animation.css +52 -32
  6. package/assets/css/components/badge.css +1 -0
  7. package/assets/css/components/banner-text.css +15 -4
  8. package/assets/css/components/card.css +0 -1
  9. package/assets/css/components/content-placeholder.css +104 -0
  10. package/assets/css/components/dropdown.css +20 -7
  11. package/assets/css/components/empty-container.css +69 -1
  12. package/assets/css/components/filter-chosen.css +6 -0
  13. package/assets/css/components/filter-date-range.css +17 -1
  14. package/assets/css/components/filter-month.css +23 -17
  15. package/assets/css/components/filter-select.css +11 -0
  16. package/assets/css/components/icon-menu-item.css +12 -7
  17. package/assets/css/components/layout.css +1 -32
  18. package/assets/css/components/mobile-menu-nav.css +8 -4
  19. package/assets/css/components/modal.css +1 -1
  20. package/assets/css/components/number.css +12 -0
  21. package/assets/css/components/page-aside.css +54 -0
  22. package/assets/css/components/text-field.css +4 -0
  23. package/assets/js/css.js +1 -1
  24. package/assets/js/icons/mono.js +59 -91
  25. package/assets/js/icons/multicolor.js +1 -31
  26. package/components/1_atoms/AwActionIcon.vue +11 -2
  27. package/components/1_atoms/AwContentPlaceholder.vue +60 -0
  28. package/components/1_atoms/AwFlow.vue +37 -49
  29. package/components/1_atoms/AwGrid.vue +11 -3
  30. package/components/1_atoms/AwIcon/AwIcon.vue +5 -3
  31. package/components/1_atoms/AwIcon/AwIconSystemMono.vue +3 -2
  32. package/components/1_atoms/AwInput.vue +2 -2
  33. package/components/1_atoms/AwLabel.vue +1 -1
  34. package/components/1_atoms/AwList.vue +3 -1
  35. package/components/1_atoms/AwRadio.vue +1 -1
  36. package/components/1_atoms/AwSlider.vue +15 -1
  37. package/components/1_atoms/AwTag.vue +6 -1
  38. package/components/2_molecules/AwAlert.vue +63 -42
  39. package/components/2_molecules/AwBadge.vue +1 -1
  40. package/components/2_molecules/AwBannerText.vue +8 -2
  41. package/components/2_molecules/AwButton.vue +1 -1
  42. package/components/2_molecules/AwDescriptionInput.vue +19 -1
  43. package/components/2_molecules/AwEmptyContainer.vue +74 -72
  44. package/components/2_molecules/AwNumber.vue +180 -0
  45. package/components/2_molecules/AwSelect.vue +11 -4
  46. package/components/3_organisms/AwBottomBar.vue +22 -4
  47. package/components/3_organisms/AwFilterChosen.vue +73 -0
  48. package/components/3_organisms/AwFilterDateRange.vue +177 -0
  49. package/components/3_organisms/AwFilterMonth.vue +37 -40
  50. package/components/3_organisms/AwFilterSelect.vue +368 -0
  51. package/components/3_organisms/AwMultiBlockBuilder.vue +1 -1
  52. package/components/3_organisms/AwSubnav.vue +11 -1
  53. package/components/3_organisms/AwTable/AwTableBuilder.vue +20 -60
  54. package/components/3_organisms/AwTable/_AwTableCellDropdown.vue +6 -1
  55. package/components/3_organisms/AwTable/_AwTableRow.vue +2 -1
  56. package/components/4_pages/AwPage.vue +1 -0
  57. package/components/4_pages/AwPageAside.vue +108 -0
  58. package/components/5_layouts/AwLayoutCenter.vue +3 -8
  59. package/components/5_layouts/_AwMenuItemIcon.vue +9 -2
  60. package/components/5_layouts/_AwMobileMenuItem.vue +5 -3
  61. package/components/5_layouts/_AwUserMenu.vue +1 -1
  62. package/components/_config.js +26 -1
  63. package/docs/_template.md +80 -0
  64. package/docs/components/atoms/aw-accordion-fold.md +129 -0
  65. package/docs/components/atoms/aw-action-card-body.md +99 -0
  66. package/docs/components/atoms/aw-action-card.md +130 -0
  67. package/docs/components/atoms/aw-action-icon.md +126 -0
  68. package/docs/components/atoms/aw-avatar.md +106 -0
  69. package/docs/components/atoms/aw-card.md +137 -0
  70. package/docs/components/atoms/aw-checkbox.md +288 -0
  71. package/docs/components/atoms/aw-content-placeholder.md +147 -0
  72. package/docs/components/atoms/aw-description.md +83 -0
  73. package/docs/components/atoms/aw-dock.md +90 -0
  74. package/docs/components/atoms/aw-dropdown-button.md +94 -0
  75. package/docs/components/atoms/aw-dropdown.md +178 -0
  76. package/docs/components/atoms/aw-file.md +73 -0
  77. package/docs/components/atoms/aw-flow.md +140 -0
  78. package/docs/components/atoms/aw-grid.md +109 -0
  79. package/docs/components/atoms/aw-headline.md +71 -0
  80. package/docs/components/atoms/aw-icon-system-color.md +122 -0
  81. package/docs/components/atoms/aw-icon-system-mono.md +206 -0
  82. package/docs/components/atoms/aw-icon.md +235 -0
  83. package/docs/components/atoms/aw-info.md +123 -0
  84. package/docs/components/atoms/aw-input.md +212 -0
  85. package/docs/components/atoms/aw-label.md +136 -0
  86. package/docs/components/atoms/aw-link.md +151 -0
  87. package/docs/components/atoms/aw-list.md +152 -0
  88. package/docs/components/atoms/aw-progress.md +119 -0
  89. package/docs/components/atoms/aw-radio.md +182 -0
  90. package/docs/components/atoms/aw-refresh-wrapper.md +81 -0
  91. package/docs/components/atoms/aw-select-native.md +234 -0
  92. package/docs/components/atoms/aw-slider.md +189 -0
  93. package/docs/components/atoms/aw-sub-headline.md +73 -0
  94. package/docs/components/atoms/aw-switcher.md +192 -0
  95. package/docs/components/atoms/aw-tag.md +144 -0
  96. package/docs/components/atoms/aw-title.md +70 -0
  97. package/docs/components/atoms/aw-toggler.md +90 -0
  98. package/docs/components/layouts/aw-layout-center.md +168 -0
  99. package/docs/components/layouts/aw-layout-error.md +153 -0
  100. package/docs/components/layouts/aw-layout-provider.md +238 -0
  101. package/docs/components/layouts/aw-layout.md +88 -0
  102. package/docs/components/molecules/aw-action-button.md +138 -0
  103. package/docs/components/molecules/aw-alert.md +191 -0
  104. package/docs/components/molecules/aw-badge.md +129 -0
  105. package/docs/components/molecules/aw-banner-text.md +156 -0
  106. package/docs/components/molecules/aw-button-nav.md +111 -0
  107. package/docs/components/molecules/aw-button.md +193 -0
  108. package/docs/components/molecules/aw-description-input.md +124 -0
  109. package/docs/components/molecules/aw-empty-container.md +235 -0
  110. package/docs/components/molecules/aw-island.md +506 -0
  111. package/docs/components/molecules/aw-number.md +138 -0
  112. package/docs/components/molecules/aw-select-object.md +401 -0
  113. package/docs/components/molecules/aw-select.md +215 -0
  114. package/docs/components/molecules/aw-tab-nav.md +108 -0
  115. package/docs/components/molecules/aw-tel.md +129 -0
  116. package/docs/components/molecules/aw-textarea.md +83 -0
  117. package/docs/components/molecules/aw-userpic.md +115 -0
  118. package/docs/components/organisms/aw-address-block.md +64 -0
  119. package/docs/components/organisms/aw-address.md +132 -0
  120. package/docs/components/organisms/aw-birthday-picker.md +73 -0
  121. package/docs/components/organisms/aw-bottom-bar.md +66 -0
  122. package/docs/components/organisms/aw-calendar-days.md +115 -0
  123. package/docs/components/organisms/aw-calendar-nav.md +98 -0
  124. package/docs/components/organisms/aw-calendar-view.md +98 -0
  125. package/docs/components/organisms/aw-calendar.md +166 -0
  126. package/docs/components/organisms/aw-chart.md +154 -0
  127. package/docs/components/organisms/aw-chip-select.md +164 -0
  128. package/docs/components/organisms/aw-chip.md +126 -0
  129. package/docs/components/organisms/aw-code-snippet.md +94 -0
  130. package/docs/components/organisms/aw-code.md +132 -0
  131. package/docs/components/organisms/aw-context-menu.md +117 -0
  132. package/docs/components/organisms/aw-cropper.md +151 -0
  133. package/docs/components/organisms/aw-date.md +161 -0
  134. package/docs/components/organisms/aw-display-date.md +33 -0
  135. package/docs/components/organisms/aw-download-link.md +46 -0
  136. package/docs/components/organisms/aw-fetch-data.md +161 -0
  137. package/docs/components/organisms/aw-filter-chosen.md +226 -0
  138. package/docs/components/organisms/aw-filter-date-range.md +205 -0
  139. package/docs/components/organisms/aw-filter-month.md +43 -0
  140. package/docs/components/organisms/aw-filter-select.md +239 -0
  141. package/docs/components/organisms/aw-form.md +174 -0
  142. package/docs/components/organisms/aw-gmap-marker.md +86 -0
  143. package/docs/components/organisms/aw-gmap.md +90 -0
  144. package/docs/components/organisms/aw-image-upload.md +56 -0
  145. package/docs/components/organisms/aw-island-avatar.md +87 -0
  146. package/docs/components/organisms/aw-markdown-editor.md +104 -0
  147. package/docs/components/organisms/aw-modal-buttons.md +57 -0
  148. package/docs/components/organisms/aw-modal.md +246 -0
  149. package/docs/components/organisms/aw-model-edit.md +74 -0
  150. package/docs/components/organisms/aw-money.md +53 -0
  151. package/docs/components/organisms/aw-multi-block-builder.md +165 -0
  152. package/docs/components/organisms/aw-pagination.md +121 -0
  153. package/docs/components/organisms/aw-password.md +103 -0
  154. package/docs/components/organisms/aw-preview-card.md +45 -0
  155. package/docs/components/organisms/aw-search.md +116 -0
  156. package/docs/components/organisms/aw-subnav.md +122 -0
  157. package/docs/components/organisms/aw-table-builder.md +165 -0
  158. package/docs/components/organisms/aw-table-col.md +123 -0
  159. package/docs/components/organisms/aw-table-head.md +92 -0
  160. package/docs/components/organisms/aw-table-row.md +91 -0
  161. package/docs/components/organisms/aw-table.md +172 -0
  162. package/docs/components/organisms/aw-tags.md +54 -0
  163. package/docs/components/organisms/aw-toggle-show-aside.md +43 -0
  164. package/docs/components/organisms/aw-uploader-files.md +125 -0
  165. package/docs/components/organisms/aw-uploader.md +163 -0
  166. package/docs/components/organisms/aw-user-menu.md +87 -0
  167. package/docs/components/pages/aw-page-aside.md +296 -0
  168. package/docs/components/pages/aw-page-menu-buttons.md +172 -0
  169. package/docs/components/pages/aw-page-modal.md +198 -0
  170. package/docs/components/pages/aw-page-single.md +300 -0
  171. package/docs/components/pages/aw-page.md +194 -0
  172. package/docs/configuration.md +493 -0
  173. package/docs/cookbook/advanced-patterns.md +1388 -0
  174. package/docs/cookbook/common-patterns.md +965 -0
  175. package/docs/cookbook/index.md +786 -0
  176. package/docs/getting-started.md +596 -0
  177. package/docs/guides/best-practices.md +1106 -0
  178. package/docs/guides/data-fetching.md +852 -0
  179. package/docs/guides/error-handling.md +1172 -0
  180. package/docs/guides/forms-guide.md +1329 -0
  181. package/docs/guides/mobile-subnavigation.md +359 -0
  182. package/docs/guides/page-patterns/aside-pages.md +1418 -0
  183. package/docs/guides/page-patterns/dashboard-pages.md +990 -0
  184. package/docs/guides/page-patterns/detail-pages.md +1556 -0
  185. package/docs/guides/page-patterns/list-pages.md +1242 -0
  186. package/docs/index.md +263 -1
  187. package/docs/integrations.md +870 -0
  188. package/docs/reference/colors.md +232 -0
  189. package/docs/reference/icons.md +163 -0
  190. package/docs/reference/menu.md +462 -0
  191. package/docs/reference/plugins.md +970 -0
  192. package/docs/reference/troubleshooting.md +964 -0
  193. package/nuxt/awes.config.js +9 -8
  194. package/nuxt/index.js +2 -2
  195. package/nuxt/pages/more.vue +1 -1
  196. package/package.json +5 -3
  197. package/readme.md +171 -1
  198. package/store/awesIo.js +11 -0
  199. package/CHANGELOG.md +0 -4520
  200. package/docs/aw-accordion-fold.md +0 -46
  201. package/docs/aw-address.md +0 -44
  202. package/docs/aw-avatar.md +0 -51
  203. package/docs/aw-badge.md +0 -32
  204. package/docs/aw-button-nav.md +0 -44
  205. package/docs/aw-button.md +0 -50
  206. package/docs/aw-calendar-days.md +0 -46
  207. package/docs/aw-calendar-nav.md +0 -25
  208. package/docs/aw-calendar-view.md +0 -12
  209. package/docs/aw-calendar.md +0 -59
  210. package/docs/aw-card.md +0 -48
  211. package/docs/aw-chart.md +0 -51
  212. package/docs/aw-checkbox.md +0 -56
  213. package/docs/aw-chip-select.md +0 -46
  214. package/docs/aw-chip.md +0 -53
  215. package/docs/aw-code-snippet.md +0 -18
  216. package/docs/aw-code.md +0 -56
  217. package/docs/aw-content-wrapper.md +0 -40
  218. package/docs/aw-context-menu.md +0 -31
  219. package/docs/aw-cropper.md +0 -60
  220. package/docs/aw-dashboard-card.md +0 -37
  221. package/docs/aw-dashboard-donut.md +0 -30
  222. package/docs/aw-dashboard-line.md +0 -20
  223. package/docs/aw-dashboard-progress.md +0 -33
  224. package/docs/aw-dashboard-section.md +0 -32
  225. package/docs/aw-dashboard-speed.md +0 -30
  226. package/docs/aw-date.md +0 -52
  227. package/docs/aw-dropdown-button.md +0 -31
  228. package/docs/aw-dropdown.md +0 -69
  229. package/docs/aw-fetch-data.md +0 -45
  230. package/docs/aw-form.md +0 -52
  231. package/docs/aw-grid.md +0 -48
  232. package/docs/aw-icon.md +0 -50
  233. package/docs/aw-info.md +0 -53
  234. package/docs/aw-input.md +0 -55
  235. package/docs/aw-layout-default.md +0 -30
  236. package/docs/aw-layout-frame-center.md +0 -29
  237. package/docs/aw-layout-simple.md +0 -49
  238. package/docs/aw-link.md +0 -54
  239. package/docs/aw-markdown-editor.md +0 -51
  240. package/docs/aw-modal.md +0 -63
  241. package/docs/aw-multi-block-builder.md +0 -66
  242. package/docs/aw-page.md +0 -36
  243. package/docs/aw-pagination.md +0 -54
  244. package/docs/aw-password.md +0 -48
  245. package/docs/aw-radio.md +0 -54
  246. package/docs/aw-search.md +0 -49
  247. package/docs/aw-select.md +0 -93
  248. package/docs/aw-slider.md +0 -40
  249. package/docs/aw-svg-image.md +0 -19
  250. package/docs/aw-switcher.md +0 -51
  251. package/docs/aw-tab-nav.md +0 -55
  252. package/docs/aw-table-builder.md +0 -58
  253. package/docs/aw-table-col.md +0 -33
  254. package/docs/aw-table-head.md +0 -28
  255. package/docs/aw-table-row.md +0 -33
  256. package/docs/aw-table.md +0 -59
  257. package/docs/aw-tel.md +0 -47
  258. package/docs/aw-textarea.md +0 -47
  259. package/docs/aw-toggler.md +0 -41
  260. package/docs/aw-uploader-files.md +0 -20
  261. package/docs/aw-uploader.md +0 -60
  262. package/docs/aw-user-menu.md +0 -34
  263. package/docs/aw-userpic.md +0 -34
  264. /package/components/{3_organisms → 2_molecules}/AwTel.vue +0 -0
@@ -1,104 +1,106 @@
1
1
  <template>
2
- <AwCard>
3
- <div
4
- ref="container"
5
- class="aw-empty-container"
6
- :class="{ 'aw-empty-container--visible': isVisible }"
7
- >
8
- <slot name="icon">
9
- <AwIcon
10
- v-if="icon"
11
- :name="icon"
12
- :size="iconSize"
13
- :style="{ fill: _iconColor }"
14
- />
15
- </slot>
16
-
17
- <AwSubHeadline v-if="title" class="m-0">{{ title }}</AwSubHeadline>
18
-
19
- <slot name="buttons"></slot>
20
- </div>
21
- </AwCard>
2
+ <Component
3
+ :is="theme === 'card' ? 'AwCard' : 'div'"
4
+ :class="{
5
+ 'aw-empty-container--visible': isVisible,
6
+ 'aw-empty-container--padding': theme !== 'card' && theme !== 'empty'
7
+ }"
8
+ class="aw-empty-container"
9
+ :style="{ '--card-padding-y': theme === 'card' ? '2.5rem' : '1.5rem' }"
10
+ >
11
+ <!-- image -->
12
+ <slot name="image">
13
+ <img
14
+ v-if="image"
15
+ :src="image"
16
+ :alt="title"
17
+ class="w-64 max-w-full"
18
+ aria-hidden="true"
19
+ />
20
+ <AwIcon
21
+ v-else-if="icon"
22
+ :name="icon"
23
+ size="80"
24
+ class="aw-empty-container__icon"
25
+ />
26
+ </slot>
27
+
28
+ <!-- title -->
29
+ <AwHeadline v-if="title" class="text-center my-0">{{
30
+ title
31
+ }}</AwHeadline>
32
+
33
+ <!-- description -->
34
+ <AwDescription
35
+ v-if="message || description"
36
+ class="text-center aw-empty-container__description"
37
+ v-html="$sanitize(message || description)"
38
+ />
39
+
40
+ <!-- content -->
41
+ <slot name="button">
42
+ <div
43
+ v-if="ctaButton"
44
+ class="flex flex-wrap justify-center gap-4 flex-col w-full md:flex-row"
45
+ >
46
+ <AwButton v-if="ctaButton" v-bind="ctaButton" />
47
+ </div>
48
+ </slot>
49
+ </Component>
22
50
  </template>
23
51
 
24
52
  <script>
25
- import anime from 'animejs'
26
- import { toColor } from '@AwUtils/styles'
27
-
28
53
  export default {
29
54
  name: 'AwEmptyContainer',
30
55
 
31
56
  props: {
57
+ image: {
58
+ type: String,
59
+ default: ''
60
+ },
61
+
32
62
  icon: {
33
63
  type: String,
34
64
  default: ''
35
65
  },
36
66
 
37
- iconSize: {
38
- type: Number,
39
- default: 60
67
+ title: {
68
+ type: String,
69
+ default: ''
40
70
  },
41
71
 
42
- iconColor: {
72
+ message: {
43
73
  type: String,
44
- default: 'mono-100'
74
+ default: ''
45
75
  },
46
76
 
47
- title: {
77
+ description: {
48
78
  type: String,
49
79
  default: ''
80
+ },
81
+
82
+ theme: {
83
+ type: String,
84
+ default: 'card' // card, empty, transparent
85
+ },
86
+
87
+ ctaButton: {
88
+ type: Object,
89
+ default: null
50
90
  }
51
91
  },
52
92
 
53
93
  data() {
54
94
  return {
55
- isVisible: true
56
- }
57
- },
58
-
59
- computed: {
60
- _iconColor() {
61
- return this.iconColor ? toColor(this.iconColor) : null
95
+ isVisible: false
62
96
  }
63
97
  },
64
98
 
65
- beforeMount() {
66
- this.isVisible = false
67
- },
68
-
69
99
  mounted() {
70
- this.prepare()
71
-
72
- this.isVisible = true
73
-
74
- setTimeout(this.animate, 200)
75
- },
76
-
77
- methods: {
78
- prepare() {
79
- anime.set(this._getElements(), {
80
- opacity: 0,
81
- translateY: '0.5rem',
82
- transition: 'none'
83
- })
84
- },
85
-
86
- animate() {
87
- anime.set(this._getElements(), { transition: null })
88
-
89
- anime({
90
- targets: this._getElements(),
91
- opacity: 1,
92
- translateY: 0,
93
- delay: anime.stagger(120),
94
- easing: 'easeOutCirc',
95
- duration: 240
96
- })
97
- },
98
-
99
- _getElements() {
100
- return this.$refs.container?.children || []
101
- }
100
+ /* add class through timeout to force initial animation */
101
+ setTimeout(() => {
102
+ this.isVisible = true
103
+ }, 300)
102
104
  }
103
105
  }
104
106
  </script>
@@ -0,0 +1,180 @@
1
+ <template>
2
+ <AwInput
3
+ v-model="_value"
4
+ v-bind="$attrs"
5
+ inputmode="numeric"
6
+ :max="isFinite(_max) ? _max : null"
7
+ :min="isFinite(_min) ? _min : null"
8
+ theme="uncolor-postfix"
9
+ class="aw-number"
10
+ @paste="_onPaste"
11
+ @blur="_clamp"
12
+ @keypress="_onKeypress"
13
+ @input="_onInput"
14
+ >
15
+ <template
16
+ #element="{ cssClass, value, errorTooltip, mergedListeners, mergedAttributes, errorText, errorId }"
17
+ >
18
+ <input
19
+ v-tooltip.show.prepend="errorTooltip"
20
+ :class="cssClass"
21
+ v-bind="mergedAttributes"
22
+ type="tel"
23
+ :value="value"
24
+ :aria-describedby="errorText ? errorId : null"
25
+ :data-error="errorText || null"
26
+ v-on="mergedListeners"
27
+ />
28
+ </template>
29
+ <template #postfix>
30
+ <slot v-if="!hideButtons" name="postfix">
31
+ <AwButton
32
+ type="button"
33
+ tag="span"
34
+ role="button"
35
+ color="mono"
36
+ size="md"
37
+ class="aw-number__button"
38
+ icon="awesio/minus"
39
+ :disabled="_reachMin"
40
+ @click="subtract"
41
+ />
42
+ <AwButton
43
+ type="button"
44
+ tag="span"
45
+ role="button"
46
+ color="mono"
47
+ size="md"
48
+ class="aw-number__button"
49
+ icon="awesio/plus"
50
+ :disabled="_reachMax"
51
+ @click="add"
52
+ />
53
+ </slot>
54
+ </template>
55
+ </AwInput>
56
+ </template>
57
+
58
+ <script>
59
+ import { clamp } from 'rambdax'
60
+
61
+ const toNumber = (val) => Number(val) || 0
62
+
63
+ const PREVENT_KEYS = ['-', '+', 'e']
64
+
65
+ export default {
66
+ name: 'AwNumber',
67
+
68
+ inheritAttrs: false,
69
+
70
+ props: {
71
+ value: {
72
+ type: [Number, String],
73
+ default: 0
74
+ },
75
+
76
+ min: {
77
+ type: [Number, String],
78
+ default: -Infinity
79
+ },
80
+
81
+ max: {
82
+ type: [Number, String],
83
+ default: Infinity
84
+ },
85
+
86
+ step: {
87
+ type: [Number, String],
88
+ default: 1
89
+ },
90
+
91
+ integer: Boolean,
92
+
93
+ hideButtons: Boolean
94
+ },
95
+
96
+ computed: {
97
+ _value: {
98
+ get() {
99
+ return this.value ? toNumber(this.value) : null
100
+ },
101
+
102
+ set(val) {
103
+ this.$emit('input', val)
104
+ }
105
+ },
106
+
107
+ _min() {
108
+ return toNumber(this.min)
109
+ },
110
+
111
+ _max() {
112
+ return toNumber(this.max)
113
+ },
114
+
115
+ _step() {
116
+ return toNumber(this.step)
117
+ },
118
+
119
+ _reachMax() {
120
+ return this._value >= this._max
121
+ },
122
+
123
+ _reachMin() {
124
+ return this._value <= this._min
125
+ }
126
+ },
127
+
128
+ methods: {
129
+ /**
130
+ * @vuese
131
+ * Increment the value by step amount
132
+ */
133
+ add() {
134
+ const newValue = Math.min(this._max, this._value + this._step)
135
+
136
+ this._value = newValue
137
+ },
138
+
139
+ /**
140
+ * @vuese
141
+ * Decrement the value by step amount
142
+ */
143
+ subtract() {
144
+ const newValue = Math.max(this._min, this._value - this._step)
145
+
146
+ this._value = newValue
147
+ },
148
+
149
+ _clamp() {
150
+ this._value = clamp(this._min, this._max, this._value)
151
+ },
152
+
153
+ _onKeypress($event) {
154
+ if (
155
+ PREVENT_KEYS.includes($event.key) ||
156
+ (this.integer && isNaN($event.key))
157
+ ) {
158
+ $event.preventDefault()
159
+ }
160
+ },
161
+
162
+ _onPaste($event) {
163
+ const paseted = $event.clipboardData.getData('text')
164
+ const value = Number(paseted)
165
+
166
+ if (!value || value < this.min || value > this.max) {
167
+ $event.preventDefault()
168
+ }
169
+ },
170
+
171
+ _onInput(value) {
172
+ const number = Number(value)
173
+
174
+ if (this._max && number > this.max) {
175
+ this._value = this.max
176
+ }
177
+ }
178
+ }
179
+ }
180
+ </script>
@@ -896,6 +896,7 @@ export default {
896
896
 
897
897
  // ajax
898
898
  _preloadOptions() {
899
+ console.log('preloadOptions', this.searchPreload, typeof this.searchPreload)
899
900
  switch (typeof this.searchPreload) {
900
901
  case 'boolean':
901
902
  this.searchPreload &&
@@ -930,14 +931,20 @@ export default {
930
931
  this.cancellation = CancelToken.source()
931
932
 
932
933
  try {
933
- const fetchUrl = this.options(
934
+ let config = this.options(
934
935
  encodeURIComponent(this.searchPhrase)
935
936
  )
936
937
 
938
+ if (typeof config === 'string') {
939
+ config = {
940
+ method: 'get',
941
+ url: config
942
+ }
943
+ }
944
+
937
945
  const { data } = await this.$axios.request({
938
- cancelToken: this.cancellation.token,
939
- method: 'get',
940
- url: fetchUrl
946
+ ...config,
947
+ cancelToken: this.cancellation.token
941
948
  })
942
949
 
943
950
  this.selectOptions = pathOr([], 'data', data)
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <div v-if="showMenu" class="aw-bottom-bar" :style="itemMaxWidthVar" @click="scrollToTopOnCurrent">
2
+ <div
3
+ v-if="showMenu"
4
+ class="aw-bottom-bar"
5
+ :style="itemMaxWidthVar"
6
+ @click="scrollToTopOnCurrent"
7
+ >
3
8
  <slot name="bottom-bar-items">
4
9
  <AwMenuItemIcon
5
10
  v-for="(item, i) in items"
@@ -11,7 +16,13 @@
11
16
  </slot>
12
17
 
13
18
  <slot name="bottom-bar-toggler">
19
+ <Component
20
+ v-if="bottomBarMoreMenuItemComponent"
21
+ :is="bottomBarMoreMenuItemComponent.is"
22
+ />
23
+
14
24
  <AwMenuItemIcon
25
+ v-else
15
26
  :text="$t('Menu')"
16
27
  icon="menu-dots"
17
28
  :size="$options.ICON_SIZE"
@@ -43,6 +54,7 @@
43
54
  import { viewOr, lensProp, omit } from 'rambdax'
44
55
  import { getPath } from '@AwUtils/router'
45
56
  import AwMenuItemIcon from '@AwLayouts/_AwMenuItemIcon.vue'
57
+ import { mapGetters } from 'vuex'
46
58
 
47
59
  export const VISIBLE_ITEMS_COUNT = 4
48
60
 
@@ -66,8 +78,10 @@ export default {
66
78
  },
67
79
 
68
80
  computed: {
81
+ ...mapGetters('awesIo', ['bottomBarMoreMenuItemComponent']),
82
+
69
83
  itemMaxWidthVar() {
70
- return { '--item-width-percent': (100 / this.items.length + 1) + '%' }
84
+ return { '--item-width-percent': 100 / this.items.length + 1 + '%' }
71
85
  },
72
86
 
73
87
  actionButton() {
@@ -135,11 +149,15 @@ export default {
135
149
  },
136
150
 
137
151
  scrollToTopOnCurrent($event) {
138
- const link = $event.target.matches('a') ? $event.target : $event.target.closest('a')
152
+ const link = $event.target.matches('a')
153
+ ? $event.target
154
+ : $event.target.closest('a')
139
155
 
140
156
  if (!link) return
141
157
 
142
- if (getPath(link.getAttribute('href')) === getPath(this.$route.path)) {
158
+ if (
159
+ getPath(link.getAttribute('href')) === getPath(this.$route.path)
160
+ ) {
143
161
  window.scrollTo({ top: 0, behavior: 'smooth' })
144
162
  }
145
163
  }
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <div v-if="chips.length" class="aw-filter-chosen -mx-1">
3
+ <AwSlider>
4
+ <button v-for="{ prop, val } in chips" :key="`${prop}-${val}`" class="mx-1" @click="reset(prop, val)">
5
+ <AwChip class="bg-mono-800 hover:bg-error">
6
+ <template #left><span class="-ml-1"></span></template>
7
+ <slot :name="prop" :value="val" :pathOr="pathOr">
8
+ <slot :value="val" :prop="prop">
9
+ <span class="opacity-50 mr-1">{{ prop }}:</span> {{ val }}
10
+ </slot>
11
+ </slot>
12
+ <template #right>
13
+ <AwIcon name="awesio/close" size="16" class="mr-1 opacity-50" />
14
+ </template>
15
+ </AwChip>
16
+ </button>
17
+ <AwLink class="text-sm text-mono-400 mx-1" @click="reset()">
18
+ {{ $t('Reset') }}
19
+ </AwLink>
20
+ </AwSlider>
21
+ </div>
22
+ </template>
23
+
24
+ <script>
25
+ import { pick, omit, toPairs, isType, pathOr } from 'rambdax'
26
+
27
+ export default {
28
+ name: 'AwFilterChosen',
29
+
30
+ props: {
31
+ watchParams: {
32
+ type: Array,
33
+ required: true
34
+ }
35
+ },
36
+
37
+ computed: {
38
+ chips() {
39
+ return toPairs(pick(this.watchParams, this.$route.query)).reduce((acc, [prop, val]) => {
40
+ if (isType('Array', val)) {
41
+ return acc.concat(val.map((_val) => ({ prop, val: _val })))
42
+ } else {
43
+ return acc.concat([{ prop, val }])
44
+ }
45
+ }, [])
46
+ }
47
+ },
48
+
49
+ methods: {
50
+ reset(prop, val) {
51
+ let query
52
+
53
+ if (!prop) {
54
+ query = omit([...this.watchParams, 'page', 'search'], this.$route.query)
55
+ } else if (Array.isArray(this.$route.query[prop])) {
56
+ query = {
57
+ ...omit('page,search', this.$route.query),
58
+ [prop]: this.$route.query[prop].filter((_val) => _val != val)
59
+ }
60
+ } else {
61
+ query = omit([prop, 'page', 'search'], this.$route.query)
62
+ }
63
+
64
+ this.$router.replace({ ...this.$route, query }).catch((e) => {
65
+ console.log(e)
66
+ })
67
+ },
68
+
69
+ pathOr
70
+ }
71
+ }
72
+ </script>
73
+
@@ -0,0 +1,177 @@
1
+ <template>
2
+ <div class="aw-filter-date-range">
3
+ <!-- toggler -->
4
+ <AwButton theme="outline" color="default" class="filter-button" @click.stop="isVisible = !isVisible">
5
+ <AwIcon v-if="icon" :name="icon" class="mr-1" />
6
+ <slot name="label">
7
+ <span class="normal-case font-normal">
8
+ {{ formattedRange ? formattedRange : label }}
9
+ </span>
10
+ </slot>
11
+ <AwIcon name="awesio/triangle" size="16" class="caret" :class="{ 'rotate-180': isVisible }" />
12
+ </AwButton>
13
+
14
+ <!-- options -->
15
+ <slot name="dropdown" v-bind="{ isVisible, open, close, set }">
16
+ <AwDropdown class="aw-filter-date-range__dropdown" :close-on-action="false" :show="isVisible" @update:show="_onShowChange">
17
+ <slot name="calendar">
18
+ <AwCalendar v-model="value" :output-format="dateFormat" range />
19
+ </slot>
20
+
21
+ <!-- reset button -->
22
+ <slot name="reset" :reset="reset">
23
+ <template v-if="!noReset && !isDefaultDateRange">
24
+ <hr style="margin: 0.25rem 0" />
25
+ <AwDropdownButton @click="reset">
26
+ {{ $t('Reset') }}
27
+ </AwDropdownButton>
28
+ </template>
29
+ </slot>
30
+ </AwDropdown>
31
+ </slot>
32
+ </div>
33
+ </template>
34
+
35
+ <script>
36
+ import { omit, F } from 'rambdax'
37
+
38
+ export default {
39
+ name: '',
40
+
41
+ props: {
42
+ startParam: {
43
+ type: String,
44
+ default: 'start_date'
45
+ },
46
+
47
+ endParam: {
48
+ type: String,
49
+ default: 'end_date'
50
+ },
51
+
52
+ icon: {
53
+ type: String,
54
+ default: ''
55
+ },
56
+
57
+ label: {
58
+ type: String,
59
+ default: 'Dates'
60
+ },
61
+
62
+ dateFormat: {
63
+ type: String,
64
+ default: 'YYYY-MM-DD'
65
+ },
66
+
67
+ defaultDateRange: {
68
+ type: Object,
69
+ default: null
70
+ },
71
+
72
+ /**
73
+ * If true, reset button is hidden
74
+ */
75
+ noReset: Boolean
76
+ },
77
+
78
+ data() {
79
+ return {
80
+ isVisible: false
81
+ }
82
+ },
83
+
84
+ computed: {
85
+ startValue() {
86
+ return this.$route.query[this.startParam] || null
87
+ },
88
+
89
+ endValue() {
90
+ return this.$route.query[this.endParam] || null
91
+ },
92
+
93
+ value: {
94
+ get() {
95
+ return {
96
+ start: this.startValue,
97
+ end: this.endValue
98
+ }
99
+ },
100
+
101
+ set(value) {
102
+ if (!value) return
103
+
104
+ if (!value.start && !value.end) {
105
+ // remove param from query
106
+ if (this.$route.query[this.startParam] && this.$route.query[this.endParam]) {
107
+ this.$router
108
+ .replace({
109
+ ...this.$route,
110
+ query: omit([this.startParam, this.endParam, 'page', 'search'], this.$route.query)
111
+ })
112
+ .catch(F)
113
+ }
114
+ } else if (!(value.start === this.startValue && value.end === this.endValue)) {
115
+ this.$router
116
+ .replace({
117
+ ...this.$route,
118
+ query: {
119
+ ...omit('page,search', this.$route.query),
120
+ [this.startParam]: value.start,
121
+ [this.endParam]: value.end
122
+ }
123
+ })
124
+ .catch(F)
125
+ }
126
+
127
+ this.isVisible = false
128
+ }
129
+ },
130
+
131
+ isDefaultDateRange() {
132
+ return (
133
+ !!this.defaultDateRange &&
134
+ this.$route.query.start === this.defaultDateRange[this.startParam] &&
135
+ this.$route.query.end === this.defaultDateRange[this.endParam]
136
+ )
137
+ },
138
+
139
+ formattedRange() {
140
+ if (this.startValue && this.endValue) {
141
+ return [this.startValue, this.endValue].map((val) => this.$dayjs(val, this.dateFormat).format('ll')).join(' - ')
142
+ } else {
143
+ return ''
144
+ }
145
+ }
146
+ },
147
+
148
+ methods: {
149
+ open() {
150
+ this.isVisible = true
151
+ },
152
+
153
+ close() {
154
+ this.isVisible = false
155
+ },
156
+
157
+ set(val) {
158
+ this.value = val
159
+ },
160
+
161
+ reset() {
162
+ this.value = {
163
+ start: this.defaultDateRange?.[this.startParam] ?? null,
164
+ end: this.defaultDateRange?.[this.endParam] ?? null
165
+ }
166
+ },
167
+
168
+ _onShowChange(show) {
169
+ setTimeout(() => {
170
+ if (this.isVisible && !show) {
171
+ this.close()
172
+ }
173
+ }, 60)
174
+ }
175
+ }
176
+ }
177
+ </script>