@vc-shell/framework 1.0.38 → 1.0.40

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 (256) hide show
  1. package/core/api/index.ts +1 -0
  2. package/core/api/platform.ts +8332 -0
  3. package/core/composables/index.ts +8 -0
  4. package/core/composables/useAutosave/index.ts +57 -0
  5. package/core/composables/useFunctions/debounce.ts +18 -0
  6. package/core/composables/useFunctions/delay.ts +7 -0
  7. package/core/composables/useFunctions/index.ts +21 -0
  8. package/core/composables/useFunctions/once.ts +14 -0
  9. package/core/composables/useFunctions/sleep.ts +4 -0
  10. package/core/composables/useFunctions/throttle.ts +17 -0
  11. package/core/composables/useI18n/index.ts +28 -0
  12. package/core/composables/useLogger/index.ts +24 -0
  13. package/core/composables/useNotifications/index.ts +116 -0
  14. package/core/composables/usePermissions/index.ts +32 -0
  15. package/core/composables/useSettings/index.ts +62 -0
  16. package/core/composables/useUser/index.ts +266 -0
  17. package/core/directives/autofocus/index.ts +9 -0
  18. package/core/directives/click-outside/index.ts +21 -0
  19. package/core/directives/index.ts +4 -0
  20. package/core/directives/loading/index.ts +28 -0
  21. package/core/directives/permissions/index.ts +20 -0
  22. package/core/plugins/index.ts +1 -0
  23. package/core/plugins/validation/index.ts +2 -0
  24. package/core/plugins/validation/rules.ts +196 -0
  25. package/core/types/index.ts +92 -0
  26. package/core/utilities/camelToSnake.ts +7 -0
  27. package/core/utilities/index.ts +1 -0
  28. package/dist/core/composables/useNotifications/index.d.ts +1 -1
  29. package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
  30. package/dist/core/composables/useSettings/index.d.ts +10 -1
  31. package/dist/core/composables/useSettings/index.d.ts.map +1 -1
  32. package/dist/core/composables/useUser/index.d.ts +2 -2
  33. package/dist/core/composables/useUser/index.d.ts.map +1 -1
  34. package/dist/core/plugins/validation/index.d.ts.map +1 -1
  35. package/dist/core/types/index.d.ts +1 -1
  36. package/dist/core/types/index.d.ts.map +1 -1
  37. package/dist/framework.js +72 -99
  38. package/dist/framework.js.map +1 -1
  39. package/dist/index.d.ts +3 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/shared/app-switcher/composables/useAppSwitcher/index.d.ts +1 -1
  42. package/dist/shared/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
  43. package/dist/shared/app-switcher/index.d.ts +2 -2
  44. package/dist/shared/app-switcher/index.d.ts.map +1 -1
  45. package/dist/shared/blade-navigation/composables/useBladeNavigation/index.d.ts +1 -1
  46. package/dist/shared/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
  47. package/dist/shared/blade-navigation/types/index.d.ts +1 -1
  48. package/dist/shared/blade-navigation/types/index.d.ts.map +1 -1
  49. package/dist/style.css +1 -1
  50. package/dist/tsconfig.tsbuildinfo +1 -0
  51. package/dist/ui/components/atoms/vc-badge/index.d.ts +5 -0
  52. package/dist/ui/components/atoms/vc-badge/index.d.ts.map +1 -0
  53. package/dist/ui/components/atoms/vc-badge/vc-badge-model.d.ts +28 -0
  54. package/dist/ui/components/atoms/vc-badge/vc-badge-model.d.ts.map +1 -0
  55. package/dist/{components → ui/components}/atoms/vc-badge/vc-badge.stories.d.ts +0 -0
  56. package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts.map +1 -0
  57. package/dist/ui/components/atoms/vc-button/index.d.ts +5 -0
  58. package/dist/ui/components/atoms/vc-button/index.d.ts.map +1 -0
  59. package/dist/ui/components/atoms/vc-button/vc-button-model.d.ts +28 -0
  60. package/dist/ui/components/atoms/vc-button/vc-button-model.d.ts.map +1 -0
  61. package/dist/{components → ui/components}/atoms/vc-button/vc-button.stories.d.ts +0 -0
  62. package/dist/ui/components/atoms/vc-button/vc-button.stories.d.ts.map +1 -0
  63. package/dist/{components → ui/components}/atoms/vc-checkbox/vc-checkbox.stories.d.ts +0 -0
  64. package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +1 -0
  65. package/dist/{components → ui/components}/atoms/vc-container/vc-container.stories.d.ts +0 -0
  66. package/dist/ui/components/atoms/vc-container/vc-container.stories.d.ts.map +1 -0
  67. package/dist/{components → ui/components}/atoms/vc-hint/vc-hint.stories.d.ts +0 -0
  68. package/dist/ui/components/atoms/vc-hint/vc-hint.stories.d.ts.map +1 -0
  69. package/dist/{components → ui/components}/atoms/vc-icon/vc-icon.stories.d.ts +0 -0
  70. package/dist/ui/components/atoms/vc-icon/vc-icon.stories.d.ts.map +1 -0
  71. package/dist/{components → ui/components}/atoms/vc-image/vc-image.stories.d.ts +0 -0
  72. package/dist/ui/components/atoms/vc-image/vc-image.stories.d.ts.map +1 -0
  73. package/dist/{components → ui/components}/atoms/vc-label/vc-label.stories.d.ts +0 -0
  74. package/dist/ui/components/atoms/vc-label/vc-label.stories.d.ts.map +1 -0
  75. package/dist/{components → ui/components}/atoms/vc-link/vc-link.stories.d.ts +0 -0
  76. package/dist/ui/components/atoms/vc-link/vc-link.stories.d.ts.map +1 -0
  77. package/dist/{components → ui/components}/atoms/vc-progress/vc-progress.stories.d.ts +0 -0
  78. package/dist/ui/components/atoms/vc-progress/vc-progress.stories.d.ts.map +1 -0
  79. package/dist/{components → ui/components}/atoms/vc-status/vc-status.stories.d.ts +0 -0
  80. package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts.map +1 -0
  81. package/dist/{components → ui/components}/atoms/vc-switch/vc-switch.stories.d.ts +0 -0
  82. package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts.map +1 -0
  83. package/dist/{components → ui/components}/index.d.ts +4 -3
  84. package/dist/ui/components/index.d.ts.map +1 -0
  85. package/dist/{components → ui/components}/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts +0 -0
  86. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts.map +1 -0
  87. package/dist/{components → ui/components}/molecules/vc-form/vc-form.stories.d.ts +0 -0
  88. package/dist/ui/components/molecules/vc-form/vc-form.stories.d.ts.map +1 -0
  89. package/dist/ui/components/molecules/vc-input/index.d.ts +5 -0
  90. package/dist/ui/components/molecules/vc-input/index.d.ts.map +1 -0
  91. package/dist/ui/components/molecules/vc-input/vc-input-model.d.ts +140 -0
  92. package/dist/ui/components/molecules/vc-input/vc-input-model.d.ts.map +1 -0
  93. package/dist/ui/components/molecules/vc-input-currency/index.d.ts +5 -0
  94. package/dist/ui/components/molecules/vc-input-currency/index.d.ts.map +1 -0
  95. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency-model.d.ts +124 -0
  96. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency-model.d.ts.map +1 -0
  97. package/dist/{components → ui/components}/molecules/vc-pagination/vc-pagination.stories.d.ts +0 -0
  98. package/dist/ui/components/molecules/vc-pagination/vc-pagination.stories.d.ts.map +1 -0
  99. package/dist/{components → ui/components}/molecules/vc-rating/vc-rating.stories.d.ts +0 -0
  100. package/dist/ui/components/molecules/vc-rating/vc-rating.stories.d.ts.map +1 -0
  101. package/dist/ui/components/molecules/vc-select/index.d.ts +5 -0
  102. package/dist/ui/components/molecules/vc-select/index.d.ts.map +1 -0
  103. package/dist/ui/components/molecules/vc-select/vc-select-model.d.ts +207 -0
  104. package/dist/ui/components/molecules/vc-select/vc-select-model.d.ts.map +1 -0
  105. package/dist/{components → ui/components}/molecules/vc-textarea/vc-textarea.stories.d.ts +0 -0
  106. package/dist/ui/components/molecules/vc-textarea/vc-textarea.stories.d.ts.map +1 -0
  107. package/dist/{components → ui/components}/organisms/vc-app/vc-app.stories.d.ts +0 -0
  108. package/dist/ui/components/organisms/vc-app/vc-app.stories.d.ts.map +1 -0
  109. package/dist/{components → ui/components}/organisms/vc-blade/vc-blade.stories.d.ts +0 -0
  110. package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts.map +1 -0
  111. package/dist/{components → ui/components}/organisms/vc-login-form/vc-login-form.stories.d.ts +0 -0
  112. package/dist/ui/components/organisms/vc-login-form/vc-login-form.stories.d.ts.map +1 -0
  113. package/dist/{components → ui/components}/organisms/vc-popup/vc-popup.stories.d.ts +0 -0
  114. package/dist/ui/components/organisms/vc-popup/vc-popup.stories.d.ts.map +1 -0
  115. package/dist/{components → ui/components}/organisms/vc-table/vc-table.stories.d.ts +0 -0
  116. package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts.map +1 -0
  117. package/dist/ui/types/index.d.ts +13 -0
  118. package/dist/ui/types/index.d.ts.map +1 -0
  119. package/dist/ui/types/ts-helpers.d.ts +13 -0
  120. package/dist/ui/types/ts-helpers.d.ts.map +1 -0
  121. package/dist/vite.config.d.ts.map +1 -1
  122. package/package.json +30 -10
  123. package/shared/app-switcher/components/index.ts +1 -0
  124. package/shared/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +90 -0
  125. package/shared/app-switcher/composables/index.ts +1 -0
  126. package/shared/app-switcher/composables/useAppSwitcher/index.ts +54 -0
  127. package/shared/app-switcher/index.ts +14 -0
  128. package/shared/assets/components/assets-details/assets-details.vue +138 -0
  129. package/shared/assets/components/index.ts +1 -0
  130. package/shared/assets/index.ts +19 -0
  131. package/shared/assets/locales/en.json +29 -0
  132. package/shared/assets/locales/index.ts +2 -0
  133. package/shared/blade-navigation/components/index.ts +1 -0
  134. package/shared/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +84 -0
  135. package/shared/blade-navigation/composables/index.ts +1 -0
  136. package/shared/blade-navigation/composables/useBladeNavigation/index.ts +216 -0
  137. package/shared/blade-navigation/index.ts +15 -0
  138. package/shared/blade-navigation/types/index.ts +52 -0
  139. package/shared/index.ts +16 -0
  140. package/tailwind.config.js +4 -3
  141. package/ui/components/atoms/vc-badge/index.ts +7 -0
  142. package/ui/components/atoms/vc-badge/vc-badge-model.ts +30 -0
  143. package/ui/components/atoms/vc-badge/vc-badge.stories.ts +27 -0
  144. package/ui/components/atoms/vc-badge/vc-badge.vue +57 -0
  145. package/ui/components/atoms/vc-button/index.ts +7 -0
  146. package/ui/components/atoms/vc-button/vc-button-model.ts +30 -0
  147. package/ui/components/atoms/vc-button/vc-button.stories.ts +34 -0
  148. package/ui/components/atoms/vc-button/vc-button.vue +219 -0
  149. package/ui/components/atoms/vc-card/vc-card.vue +137 -0
  150. package/ui/components/atoms/vc-checkbox/vc-checkbox.stories.ts +25 -0
  151. package/ui/components/atoms/vc-checkbox/vc-checkbox.vue +130 -0
  152. package/ui/components/atoms/vc-col/vc-col.vue +22 -0
  153. package/ui/components/atoms/vc-container/vc-container.stories.ts +31 -0
  154. package/ui/components/atoms/vc-container/vc-container.vue +222 -0
  155. package/ui/components/atoms/vc-hint/vc-hint.stories.ts +23 -0
  156. package/ui/components/atoms/vc-hint/vc-hint.vue +11 -0
  157. package/ui/components/atoms/vc-icon/vc-icon.stories.ts +32 -0
  158. package/ui/components/atoms/vc-icon/vc-icon.vue +36 -0
  159. package/ui/components/atoms/vc-image/vc-image.stories.ts +40 -0
  160. package/ui/components/atoms/vc-image/vc-image.vue +122 -0
  161. package/ui/components/atoms/vc-info-row/vc-info-row.vue +42 -0
  162. package/ui/components/atoms/vc-label/vc-label.stories.ts +23 -0
  163. package/ui/components/atoms/vc-label/vc-label.vue +49 -0
  164. package/ui/components/atoms/vc-link/vc-link.stories.ts +30 -0
  165. package/ui/components/atoms/vc-link/vc-link.vue +46 -0
  166. package/ui/components/atoms/vc-loading/vc-loading.vue +33 -0
  167. package/ui/components/atoms/vc-progress/vc-progress.stories.ts +25 -0
  168. package/ui/components/atoms/vc-progress/vc-progress.vue +65 -0
  169. package/ui/components/atoms/vc-row/vc-row.vue +13 -0
  170. package/ui/components/atoms/vc-status/vc-status.stories.ts +26 -0
  171. package/ui/components/atoms/vc-status/vc-status.vue +78 -0
  172. package/ui/components/atoms/vc-status-icon/vc-status-icon.vue +21 -0
  173. package/ui/components/atoms/vc-switch/vc-switch.stories.ts +27 -0
  174. package/ui/components/atoms/vc-switch/vc-switch.vue +100 -0
  175. package/ui/components/atoms/vc-widget/vc-widget.vue +85 -0
  176. package/ui/components/index.ts +44 -0
  177. package/ui/components/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue +103 -0
  178. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +39 -0
  179. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +21 -0
  180. package/ui/components/molecules/vc-currency-input/vc-input.vue +436 -0
  181. package/ui/components/molecules/vc-editor/vc-editor.vue +117 -0
  182. package/ui/components/molecules/vc-file-upload/vc-file-upload.vue +134 -0
  183. package/ui/components/molecules/vc-form/vc-form.stories.ts +23 -0
  184. package/ui/components/molecules/vc-form/vc-form.vue +5 -0
  185. package/ui/components/molecules/vc-input/index.ts +8 -0
  186. package/ui/components/molecules/vc-input/vc-input-model.ts +150 -0
  187. package/ui/components/molecules/vc-input/vc-input.vue +324 -0
  188. package/ui/components/molecules/vc-input-currency/index.ts +8 -0
  189. package/ui/components/molecules/vc-input-currency/vc-input-currency-model.ts +128 -0
  190. package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +86 -0
  191. package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +447 -0
  192. package/ui/components/molecules/vc-notification/vc-notification.vue +101 -0
  193. package/ui/components/molecules/vc-pagination/vc-pagination.stories.ts +23 -0
  194. package/ui/components/molecules/vc-pagination/vc-pagination.vue +169 -0
  195. package/ui/components/molecules/vc-rating/vc-rating.stories.ts +23 -0
  196. package/ui/components/molecules/vc-rating/vc-rating.vue +77 -0
  197. package/ui/components/molecules/vc-select/index.ts +7 -0
  198. package/ui/components/molecules/vc-select/vc-select-model.ts +216 -0
  199. package/ui/components/molecules/vc-select/vc-select.vue +727 -0
  200. package/ui/components/molecules/vc-slider/vc-slider.vue +106 -0
  201. package/ui/components/molecules/vc-textarea/vc-textarea.stories.ts +23 -0
  202. package/ui/components/molecules/vc-textarea/vc-textarea.vue +155 -0
  203. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +150 -0
  204. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +148 -0
  205. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +157 -0
  206. package/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +110 -0
  207. package/ui/components/organisms/vc-app/vc-app.stories.ts +75 -0
  208. package/ui/components/organisms/vc-app/vc-app.vue +169 -0
  209. package/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +126 -0
  210. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +223 -0
  211. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +67 -0
  212. package/ui/components/organisms/vc-blade/vc-blade.stories.ts +46 -0
  213. package/ui/components/organisms/vc-blade/vc-blade.vue +87 -0
  214. package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +426 -0
  215. package/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue +123 -0
  216. package/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +93 -0
  217. package/ui/components/organisms/vc-gallery/vc-gallery.vue +186 -0
  218. package/ui/components/organisms/vc-login-form/vc-login-form.stories.ts +55 -0
  219. package/ui/components/organisms/vc-login-form/vc-login-form.vue +48 -0
  220. package/ui/components/organisms/vc-popup/vc-popup.stories.ts +23 -0
  221. package/ui/components/organisms/vc-popup/vc-popup.vue +97 -0
  222. package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +113 -0
  223. package/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue +29 -0
  224. package/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +152 -0
  225. package/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +272 -0
  226. package/ui/components/organisms/vc-table/vc-table.stories.ts +99 -0
  227. package/ui/components/organisms/vc-table/vc-table.vue +638 -0
  228. package/ui/types/index.ts +38 -0
  229. package/ui/types/ts-helpers.ts +46 -0
  230. package/dist/components/atoms/vc-badge/vc-badge.stories.d.ts.map +0 -1
  231. package/dist/components/atoms/vc-button/vc-button.stories.d.ts.map +0 -1
  232. package/dist/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +0 -1
  233. package/dist/components/atoms/vc-container/vc-container.stories.d.ts.map +0 -1
  234. package/dist/components/atoms/vc-hint/vc-hint.stories.d.ts.map +0 -1
  235. package/dist/components/atoms/vc-icon/vc-icon.stories.d.ts.map +0 -1
  236. package/dist/components/atoms/vc-image/vc-image.stories.d.ts.map +0 -1
  237. package/dist/components/atoms/vc-label/vc-label.stories.d.ts.map +0 -1
  238. package/dist/components/atoms/vc-link/vc-link.stories.d.ts.map +0 -1
  239. package/dist/components/atoms/vc-progress/vc-progress.stories.d.ts.map +0 -1
  240. package/dist/components/atoms/vc-status/vc-status.stories.d.ts.map +0 -1
  241. package/dist/components/atoms/vc-switch/vc-switch.stories.d.ts.map +0 -1
  242. package/dist/components/index.d.ts.map +0 -1
  243. package/dist/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts.map +0 -1
  244. package/dist/components/molecules/vc-form/vc-form.stories.d.ts.map +0 -1
  245. package/dist/components/molecules/vc-input/vc-input.stories.d.ts +0 -7
  246. package/dist/components/molecules/vc-input/vc-input.stories.d.ts.map +0 -1
  247. package/dist/components/molecules/vc-pagination/vc-pagination.stories.d.ts.map +0 -1
  248. package/dist/components/molecules/vc-rating/vc-rating.stories.d.ts.map +0 -1
  249. package/dist/components/molecules/vc-select/vc-select.stories.d.ts +0 -7
  250. package/dist/components/molecules/vc-select/vc-select.stories.d.ts.map +0 -1
  251. package/dist/components/molecules/vc-textarea/vc-textarea.stories.d.ts.map +0 -1
  252. package/dist/components/organisms/vc-app/vc-app.stories.d.ts.map +0 -1
  253. package/dist/components/organisms/vc-blade/vc-blade.stories.d.ts.map +0 -1
  254. package/dist/components/organisms/vc-login-form/vc-login-form.stories.d.ts.map +0 -1
  255. package/dist/components/organisms/vc-popup/vc-popup.stories.d.ts.map +0 -1
  256. package/dist/components/organisms/vc-table/vc-table.stories.d.ts.map +0 -1
@@ -0,0 +1,223 @@
1
+ <template>
2
+ <div
3
+ class="vc-blade-toolbar-button"
4
+ :class="{ 'vc-blade-toolbar-button_disabled': disabled || isWaiting }"
5
+ @click="onClick"
6
+ :title="title"
7
+ >
8
+ <div ref="dropButtonRef">
9
+ <div class="vc-blade-toolbar-button__wrap" ref="bladeDropToggle">
10
+ <VcIcon
11
+ class="vc-blade-toolbar-button__icon"
12
+ :icon="icon"
13
+ size="m"
14
+ ></VcIcon>
15
+ <div v-if="isExpanded" class="vc-blade-toolbar-button__title">
16
+ {{ title }}
17
+ </div>
18
+ </div>
19
+ <teleport to="#app">
20
+ <div
21
+ class="vc-blade-toolbar-button__dropdown"
22
+ v-if="isDropActive"
23
+ ref="bladeDropRef"
24
+ >
25
+ <div
26
+ class="vc-blade-toolbar-button__dropdown-item"
27
+ v-for="(item, i) in dropdownItems"
28
+ :key="i"
29
+ @click="handleDropItemClick(item)"
30
+ >
31
+ <VcIcon
32
+ :icon="item.icon"
33
+ class="vc-blade-toolbar-button__dropdown-item-icon"
34
+ />
35
+ {{ item.title }}
36
+ </div>
37
+ </div>
38
+ </teleport>
39
+ </div>
40
+ </div>
41
+ </template>
42
+
43
+ <script lang="ts">
44
+ import { defineComponent, nextTick, PropType, ref } from "vue";
45
+
46
+ export default defineComponent({
47
+ inheritAttrs: false,
48
+ });
49
+ </script>
50
+
51
+ <script lang="ts" setup>
52
+ import { VcIcon } from "@/ui/components";
53
+ import { createPopper, Instance } from "@popperjs/core";
54
+ import { IBladeDropdownItem } from "@/core/types";
55
+
56
+ const props = defineProps({
57
+ disabled: {
58
+ type: Boolean,
59
+ default: false,
60
+ },
61
+
62
+ isExpanded: {
63
+ type: Boolean,
64
+ default: true,
65
+ },
66
+
67
+ icon: {
68
+ type: String,
69
+ default: "fas fa-question-circle",
70
+ },
71
+
72
+ title: {
73
+ type: String,
74
+ default: undefined,
75
+ },
76
+
77
+ dropdownItems: {
78
+ type: Array as PropType<IBladeDropdownItem[]>,
79
+ default: () => [],
80
+ },
81
+
82
+ clickHandler: {
83
+ type: Function,
84
+ default: undefined,
85
+ },
86
+ });
87
+ const emit = defineEmits(["click"]);
88
+
89
+ const popper = ref<Instance>();
90
+ const isWaiting = ref(false);
91
+ const isDropActive = ref(false);
92
+ const bladeDropToggle = ref();
93
+ const dropButtonRef = ref();
94
+ const bladeDropRef = ref();
95
+
96
+ async function onClick(): Promise<void> {
97
+ console.debug("vc-blade-toolbar-item#onClick()");
98
+
99
+ if (!props.disabled && !isWaiting.value) {
100
+ if (props.clickHandler && typeof props.clickHandler === "function") {
101
+ isWaiting.value = true;
102
+ try {
103
+ await props.clickHandler();
104
+ } finally {
105
+ isWaiting.value = false;
106
+ }
107
+ } else if (props.dropdownItems?.length) {
108
+ toggleDropdown();
109
+ } else {
110
+ emit("click");
111
+ }
112
+ }
113
+ }
114
+
115
+ function toggleDropdown() {
116
+ if (props.dropdownItems?.length) {
117
+ if (isDropActive.value) {
118
+ isDropActive.value = false;
119
+ popper.value?.destroy();
120
+ } else {
121
+ isDropActive.value = true;
122
+ nextTick(() => {
123
+ popper.value = createPopper(bladeDropToggle.value, bladeDropRef.value, {
124
+ placement: "bottom",
125
+ modifiers: [
126
+ {
127
+ name: "offset",
128
+ options: {
129
+ offset: [70, 5],
130
+ },
131
+ },
132
+ ],
133
+ });
134
+ });
135
+ }
136
+ }
137
+ }
138
+
139
+ function handleDropItemClick(item: IBladeDropdownItem) {
140
+ if (item.clickHandler && typeof item.clickHandler === "function") {
141
+ item.clickHandler();
142
+ toggleDropdown();
143
+ }
144
+ }
145
+ </script>
146
+
147
+ <style lang="scss">
148
+ :root {
149
+ --blade-toolbar-button-title-color: #465769;
150
+ --blade-toolbar-button-title-color-hover: #465769;
151
+ --blade-toolbar-button-title-color-disabled: #9fa2a6;
152
+
153
+ --blade-toolbar-button-icon-color: #319ed4;
154
+ --blade-toolbar-button-icon-color-hover: #257fad;
155
+ --blade-toolbar-button-icon-color-disabled: #d2d4d7;
156
+
157
+ --blade-toolbar-button-background-color: var(
158
+ --blade-toolbar-background-color
159
+ );
160
+ --blade-toolbar-button-background-color-hover: var(
161
+ --blade-toolbar-background-color
162
+ );
163
+ --blade-toolbar-button-background-color-disabled: var(
164
+ --blade-toolbar-background-color
165
+ );
166
+ }
167
+
168
+ .vc-blade-toolbar-button {
169
+ @apply tw-px-2 tw-bg-[color:var(--blade-toolbar-button-background-color)] tw-box-border tw-cursor-pointer;
170
+
171
+ &__wrap {
172
+ @apply tw-inline-flex tw-flex-col tw-justify-center tw-items-center tw-relative;
173
+ }
174
+
175
+ &__title {
176
+ @apply tw-text-sm tw-whitespace-nowrap tw-mt-1 tw-text-[color:var(--blade-toolbar-button-title-color)];
177
+ }
178
+
179
+ &__icon {
180
+ @apply tw-text-[color:var(--blade-toolbar-button-icon-color)];
181
+ }
182
+
183
+ &__dropdown {
184
+ @apply tw-absolute tw-bg-white tw-z-[9999] tw-shadow-[1px_1px_22px_rgba(126,142,157,0.2)];
185
+ }
186
+
187
+ &__dropdown-item {
188
+ @apply tw-p-3 tw-text-lg tw-text-black tw-border-l tw-border-solid
189
+ tw-border-l-[#eef0f2] tw-border-b tw-border-b-[#eef0f2]
190
+ tw-bg-white tw-cursor-pointer tw-flex tw-flex-row tw-items-center
191
+ hover:tw-bg-[#eff7fc];
192
+ }
193
+
194
+ &__dropdown-item-icon {
195
+ @apply tw-text-[#a9bfd2] tw-mr-2;
196
+ }
197
+
198
+ &:hover {
199
+ @apply tw-bg-[color:var(--blade-toolbar-button-background-color-hover)];
200
+
201
+ .vc-blade-toolbar-button__title {
202
+ @apply tw-text-[color:var(--blade-toolbar-button-title-color-hover)];
203
+ }
204
+
205
+ .vc-blade-toolbar-button__icon {
206
+ @apply tw-text-[color:var(--blade-toolbar-button-icon-color-hover)];
207
+ }
208
+ }
209
+
210
+ &_disabled,
211
+ &_disabled:hover {
212
+ @apply tw-bg-[color:var(--blade-toolbar-button-background-color-disabled)] tw-cursor-default;
213
+
214
+ .vc-blade-toolbar-button__title {
215
+ @apply tw-text-[color:var(--blade-toolbar-button-title-color-disabled)];
216
+ }
217
+
218
+ .vc-blade-toolbar-button__icon {
219
+ @apply tw-text-[color:var(--blade-toolbar-button-icon-color-disabled)];
220
+ }
221
+ }
222
+ }
223
+ </style>
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <div
3
+ v-if="isToolbarVisible()"
4
+ class="tw-h-[var(--blade-toolbar-height)] tw-bg-[color:var(--blade-toolbar-background-color)] tw-border-b-[color:#eaedf3] tw-border-solid tw-border-b tw-flex tw-box-border tw-w-full tw-content-center tw-items-stretch tw-shrink-0"
5
+ :class="{ '!tw-h-[var(--blade-toolbar-height-expanded)]': isExpanded }"
6
+ >
7
+ <div
8
+ class="tw-grow tw-basis-0 tw-flex tw-content-start tw-items-center tw-overflow-x-auto tw-px-2"
9
+ >
10
+ <template v-for="item in items" :key="item.id">
11
+ <VcBladeToolbarButton
12
+ v-if="item.isVisible === undefined || item.isVisible"
13
+ v-bind="item"
14
+ :isExpanded="isExpanded"
15
+ />
16
+ </template>
17
+ </div>
18
+ <VcIcon
19
+ class="tw-self-center tw-justify-self-center tw-text-[#a1c0d4] tw-cursor-pointer tw-mr-4 hover:tw-text-[#7ea8c4]"
20
+ :icon="`fas fa-chevron-${isExpanded ? 'up' : 'down'}`"
21
+ @click="toggleToolbar"
22
+ ></VcIcon>
23
+ </div>
24
+ </template>
25
+
26
+ <script lang="ts" setup>
27
+ import { ref } from "vue";
28
+ import VcBladeToolbarButton from "./_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue";
29
+
30
+ const props = defineProps({
31
+ items: {
32
+ type: Array,
33
+ default: () => [],
34
+ },
35
+ });
36
+
37
+ const isExpanded = ref(true);
38
+ try {
39
+ isExpanded.value =
40
+ localStorage.getItem("VC_BLADE_TOOLBAR_IS_EXPANDED") === "true";
41
+ } catch (err) {
42
+ isExpanded.value = true;
43
+ }
44
+
45
+ function toggleToolbar() {
46
+ isExpanded.value = !isExpanded.value;
47
+ localStorage.setItem(
48
+ "VC_BLADE_TOOLBAR_IS_EXPANDED",
49
+ isExpanded.value.toString()
50
+ );
51
+ }
52
+
53
+ function isToolbarVisible() {
54
+ const visibleItems = (props.items as { isVisible: boolean }[]).filter(
55
+ (item) => item.isVisible === undefined || item.isVisible
56
+ );
57
+ return !!visibleItems.length;
58
+ }
59
+ </script>
60
+
61
+ <style lang="scss">
62
+ :root {
63
+ --blade-toolbar-height: 36px;
64
+ --blade-toolbar-height-expanded: 50px;
65
+ --blade-toolbar-background-color: #ffffff;
66
+ }
67
+ </style>
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Blade component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcBlade from "./vc-blade.vue";
7
+
8
+ export default {
9
+ title: "organisms/vc-blade",
10
+ component: VcBlade,
11
+ argTypes: {
12
+ collapse: { action: "collapse", name: "collapse" },
13
+ expand: { action: "expand", name: "expand" },
14
+ },
15
+ };
16
+
17
+ const Template: Story = (args) => ({
18
+ components: { VcBlade },
19
+ setup() {
20
+ return { args };
21
+ },
22
+ template:
23
+ '<vc-blade v-bind="args"><div class="p-4">Blade Contents</div></vc-blade>',
24
+ });
25
+
26
+ export const Blade = Template.bind({});
27
+ Blade.storyName = "vc-blade";
28
+ Blade.args = {
29
+ icon: "fas fa-star",
30
+ title: "My Awesome Blade",
31
+ subtitle: "Optional Subtitle",
32
+ width: 700,
33
+ closable: false,
34
+ searchable: false,
35
+
36
+ toolbarItems: [
37
+ { id: 1, icon: "fas fa-sync-alt", title: "Refresh" },
38
+ { id: 2, icon: "fas fa-plus", title: "Add" },
39
+ { id: 3, icon: "fas fa-trash", title: "Delete", disabled: true },
40
+ { id: 4, icon: "fas fa-download", title: "Import" },
41
+ { id: 5, icon: "fas fa-upload", title: "Export" },
42
+ { id: 6, icon: "fas fa-cut", title: "Cut", disabled: true },
43
+ { id: 7, icon: "fas fa-paste", title: "Paste", disabled: true },
44
+ { id: 8, icon: "fas fa-cubes", title: "Bulk export", disabled: true },
45
+ ],
46
+ };
@@ -0,0 +1,87 @@
1
+ <template>
2
+ <div
3
+ class="vc-blade tw-relative tw-flex tw-shrink-0 tw-flex-col tw-bg-[color:var(--blade-background-color)] tw-rounded-[var(--blade-border-radius)] tw-shadow-[2px_2px_8px_rgba(126,142,157,0.14)] tw-my-4 tw-mx-2 tw-overflow-hidden tw-transition-[width] tw-duration-200"
4
+ :style="{ width: typeof width === 'number' ? `${width}px` : width }"
5
+ :class="[$attrs.class, { '!tw-w-full tw-shrink': $isMobile.value || expanded }]"
6
+ >
7
+ <!-- Init blade header -->
8
+ <VcBladeHeader
9
+ class="tw-shrink-0"
10
+ v-if="!$isMobile.value || closable"
11
+ :expanded="expanded"
12
+ :closable="closable"
13
+ :icon="icon"
14
+ :title="title"
15
+ :subtitle="subtitle"
16
+ @close="$emit('close')"
17
+ >
18
+ <template v-slot:actions v-if="$slots['actions']">
19
+ <slot name="actions"></slot>
20
+ </template>
21
+ </VcBladeHeader>
22
+
23
+ <!-- Set up blade toolbar -->
24
+ <VcBladeToolbar class="tw-shrink-0" :items="toolbarItems"></VcBladeToolbar>
25
+
26
+ <slot></slot>
27
+ </div>
28
+ </template>
29
+
30
+ <script lang="ts">
31
+ import { defineComponent, PropType } from "vue";
32
+
33
+ export default defineComponent({
34
+ inheritAttrs: false,
35
+ });
36
+ </script>
37
+
38
+ <script lang="ts" setup>
39
+ import VcBladeHeader from "./_internal/vc-blade-header/vc-blade-header.vue";
40
+ import VcBladeToolbar from "./_internal/vc-blade-toolbar/vc-blade-toolbar.vue";
41
+ import { IBladeToolbar } from "@/core/types";
42
+
43
+ defineProps({
44
+ icon: {
45
+ type: String,
46
+ },
47
+
48
+ title: {
49
+ type: String,
50
+ },
51
+
52
+ subtitle: {
53
+ type: String,
54
+ },
55
+
56
+ width: {
57
+ type: [Number, String],
58
+ default: "30%",
59
+ },
60
+
61
+ expanded: {
62
+ type: Boolean,
63
+ default: false,
64
+ },
65
+
66
+ closable: {
67
+ type: Boolean,
68
+ default: true,
69
+ },
70
+
71
+ toolbarItems: {
72
+ type: Array as PropType<IBladeToolbar[]>,
73
+ default: () => [],
74
+ },
75
+ });
76
+ </script>
77
+
78
+ <style lang="scss">
79
+ :root {
80
+ --blade-background-color: #ffffff;
81
+ --blade-border-radius: 6px;
82
+ }
83
+
84
+ .vc-app_mobile .vc-blade {
85
+ @apply tw-m-0 tw-rounded-none;
86
+ }
87
+ </style>