@bildvitta/quasar-ui-asteroid 2.16.0 → 3.0.0-alpha.2

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 (280) hide show
  1. package/dist/api/QasActions.json +40 -0
  2. package/dist/api/QasActionsMenu.json +64 -0
  3. package/dist/api/QasAlert.json +40 -0
  4. package/dist/api/QasAppBar.json +52 -0
  5. package/dist/api/QasAppMenu.json +38 -0
  6. package/dist/api/QasAvatar.json +44 -0
  7. package/dist/api/QasBox.json +16 -0
  8. package/dist/api/QasBreakline.json +32 -0
  9. package/dist/api/QasBtn.json +16 -0
  10. package/dist/api/QasCard.json +52 -0
  11. package/dist/api/QasCheckboxGroup.json +38 -0
  12. package/dist/api/QasCopy.json +29 -0
  13. package/dist/api/QasDateTimeInput.json +60 -0
  14. package/dist/api/QasDebugger.json +13 -0
  15. package/dist/api/QasDelete.json +64 -0
  16. package/dist/api/QasDialog.json +109 -0
  17. package/dist/api/QasDialogRouter.json +31 -0
  18. package/dist/api/QasField.json +56 -0
  19. package/dist/api/QasFilters.json +111 -0
  20. package/dist/api/QasFormGenerator.json +92 -0
  21. package/dist/api/QasFormView.json +228 -0
  22. package/dist/api/QasGallery.json +54 -0
  23. package/dist/api/QasGridGenerator.json +108 -0
  24. package/dist/api/QasInput.json +40 -0
  25. package/dist/api/QasLabel.json +40 -0
  26. package/dist/api/QasLayout.json +47 -0
  27. package/dist/api/QasListItems.json +72 -0
  28. package/dist/api/QasListView.json +161 -0
  29. package/dist/api/QasMap.json +41 -0
  30. package/dist/api/QasNestedFields.json +223 -0
  31. package/dist/api/QasNumericInput.json +68 -0
  32. package/dist/api/QasPageHeader.json +36 -0
  33. package/dist/api/QasPasswordInput.json +121 -0
  34. package/dist/api/QasPasswordStrengthChecker.json +126 -0
  35. package/dist/api/QasProfile.json +74 -0
  36. package/dist/api/QasResizer.json +34 -0
  37. package/dist/api/QasSearchBox.json +91 -0
  38. package/dist/api/QasSelect.json +88 -0
  39. package/dist/api/QasSelectList.json +134 -0
  40. package/dist/api/QasSignaturePad.json +63 -0
  41. package/dist/api/QasSignatureUploader.json +41 -0
  42. package/dist/api/QasSingleView.json +147 -0
  43. package/dist/api/QasSortable.json +80 -0
  44. package/dist/api/QasTableGenerator.json +56 -0
  45. package/dist/api/QasTabsGenerator.json +90 -0
  46. package/dist/api/QasTextTruncate.json +38 -0
  47. package/dist/api/QasTransfer.json +70 -0
  48. package/dist/api/QasUploader.json +143 -0
  49. package/dist/asteroid.cjs.css +1 -0
  50. package/dist/asteroid.cjs.js +9307 -0
  51. package/dist/asteroid.cjs.min.js +6 -0
  52. package/dist/asteroid.esm.css +1 -0
  53. package/dist/asteroid.esm.js +9298 -0
  54. package/dist/asteroid.esm.min.js +6 -0
  55. package/dist/asteroid.umd.css +1 -0
  56. package/dist/asteroid.umd.js +9301 -0
  57. package/dist/asteroid.umd.min.js +6 -0
  58. package/dist/vetur/asteroid-attributes.json +1178 -0
  59. package/dist/vetur/asteroid-tags.json +535 -0
  60. package/package.json +41 -56
  61. package/src/assets/logo-modular.svg +1 -1
  62. package/src/asteroid.js +1 -0
  63. package/src/components/actions/QasActions.vue +45 -0
  64. package/src/components/actions/QasActions.yml +24 -0
  65. package/src/components/actions-menu/QasActionsMenu.vue +41 -14
  66. package/src/components/actions-menu/QasActionsMenu.yml +63 -0
  67. package/src/components/alert/QasAlert.vue +90 -0
  68. package/src/components/alert/QasAlert.yml +33 -0
  69. package/src/components/app-bar/QasAppBar.vue +16 -13
  70. package/src/components/app-bar/QasAppBar.yml +51 -0
  71. package/src/components/app-menu/QasAppMenu.vue +10 -12
  72. package/src/components/app-menu/QasAppMenu.yml +32 -0
  73. package/src/components/avatar/QasAvatar.vue +17 -9
  74. package/src/components/avatar/QasAvatar.yml +38 -0
  75. package/src/components/box/QasBox.vue +12 -4
  76. package/src/components/box/QasBox.yml +13 -0
  77. package/src/components/breakline/QasBreakline.vue +37 -0
  78. package/src/components/breakline/QasBreakline.yml +25 -0
  79. package/src/components/btn/QasBtn.vue +27 -24
  80. package/src/components/btn/QasBtn.yml +13 -0
  81. package/src/components/card/QasCard.vue +32 -33
  82. package/src/components/card/QasCard.yml +42 -0
  83. package/src/components/checkbox-group/QasCheckboxGroup.vue +50 -17
  84. package/src/components/checkbox-group/QasCheckboxGroup.yml +30 -0
  85. package/src/components/copy/QasCopy.vue +22 -11
  86. package/src/components/copy/QasCopy.yml +20 -0
  87. package/src/components/date-time-input/QasDateTimeInput.vue +18 -26
  88. package/src/components/date-time-input/QasDateTimeInput.yml +54 -0
  89. package/src/components/debugger/QasDebugger.vue +2 -0
  90. package/src/components/debugger/QasDebugger.yml +10 -0
  91. package/src/components/delete/QasDelete.vue +43 -16
  92. package/src/components/delete/QasDelete.yml +52 -0
  93. package/src/components/dialog/QasDialog.vue +63 -67
  94. package/src/components/dialog/QasDialog.yml +86 -0
  95. package/src/components/dialog-router/QasDialogRouter.vue +14 -4
  96. package/src/components/dialog-router/QasDialogRouter.yml +23 -0
  97. package/src/components/field/QasField.vue +21 -24
  98. package/src/components/field/QasField.yml +31 -0
  99. package/src/components/filters/QasFilters.vue +33 -26
  100. package/src/components/filters/QasFilters.yml +91 -0
  101. package/src/components/form-generator/QasFormGenerator.vue +13 -15
  102. package/src/components/form-generator/QasFormGenerator.yml +64 -0
  103. package/src/components/form-view/QasFormView.vue +129 -69
  104. package/src/components/form-view/QasFormView.yml +179 -0
  105. package/src/components/gallery/QasGallery.vue +47 -30
  106. package/src/components/gallery/QasGallery.yml +51 -0
  107. package/src/components/grid-generator/QasGridGenerator.vue +15 -7
  108. package/src/components/grid-generator/QasGridGenerator.yml +73 -0
  109. package/src/components/index.js +0 -0
  110. package/src/components/input/QasInput.vue +43 -36
  111. package/src/components/input/QasInput.yml +32 -0
  112. package/src/components/label/QasLabel.vue +14 -15
  113. package/src/components/label/QasLabel.yml +28 -0
  114. package/src/components/layout/QasLayout.vue +13 -21
  115. package/src/components/layout/QasLayout.yml +38 -0
  116. package/src/components/list-items/QasListItems.vue +15 -12
  117. package/src/components/list-items/QasListItems.yml +57 -0
  118. package/src/components/list-view/QasListView.vue +57 -31
  119. package/src/components/list-view/QasListView.yml +132 -0
  120. package/src/components/map/QasMap.vue +15 -31
  121. package/src/components/map/QasMap.yml +33 -0
  122. package/src/components/nested-fields/QasNestedFields.vue +57 -47
  123. package/src/components/nested-fields/QasNestedFields.yml +180 -0
  124. package/src/components/numeric-input/QasNumericInput.vue +31 -22
  125. package/src/components/numeric-input/QasNumericInput.yml +51 -0
  126. package/src/components/page-header/QasPageHeader.vue +20 -11
  127. package/src/components/page-header/QasPageHeader.yml +24 -0
  128. package/src/components/password-input/QasPasswordInput.vue +24 -21
  129. package/src/components/password-input/QasPasswordInput.yml +103 -0
  130. package/src/components/password-strength-checker/QasPasswordStrengthChecker.vue +51 -34
  131. package/src/components/password-strength-checker/QasPasswordStrengthChecker.yml +103 -0
  132. package/src/components/profile/QasProfile.vue +15 -13
  133. package/src/components/profile/QasProfile.yml +60 -0
  134. package/src/components/resizer/QasResizer.vue +3 -3
  135. package/src/components/resizer/QasResizer.yml +23 -0
  136. package/src/components/search-box/QasSearchBox.vue +50 -21
  137. package/src/components/search-box/QasSearchBox.yml +76 -0
  138. package/src/components/select/QasSelect.vue +51 -50
  139. package/src/components/select/QasSelect.yml +62 -0
  140. package/src/components/select-list/QasSelectList.vue +72 -53
  141. package/src/components/select-list/QasSelectList.yml +116 -0
  142. package/src/components/signature-pad/QasSignaturePad.vue +60 -40
  143. package/src/components/signature-pad/QasSignaturePad.yml +53 -0
  144. package/src/components/signature-uploader/QasSignatureUploader.vue +19 -17
  145. package/src/components/signature-uploader/QasSignatureUploader.yml +36 -0
  146. package/src/components/single-view/QasSingleView.vue +41 -22
  147. package/src/components/single-view/QasSingleView.yml +116 -0
  148. package/src/components/sortable/QasSortable.vue +51 -30
  149. package/src/components/sortable/QasSortable.yml +65 -0
  150. package/src/components/table-generator/QasTableGenerator.vue +112 -21
  151. package/src/components/table-generator/QasTableGenerator.yml +46 -0
  152. package/src/components/tabs-generator/QasTabsGenerator.vue +37 -25
  153. package/src/components/tabs-generator/QasTabsGenerator.yml +67 -0
  154. package/src/components/text-truncate/QasTextTruncate.vue +25 -17
  155. package/src/components/text-truncate/QasTextTruncate.yml +32 -0
  156. package/src/components/transfer/QasTransfer.vue +48 -49
  157. package/src/components/transfer/QasTransfer.yml +59 -0
  158. package/src/components/uploader/QasUploader.vue +169 -48
  159. package/src/components/uploader/QasUploader.yml +117 -0
  160. package/src/css/background.scss +1 -1
  161. package/src/css/border.scss +7 -6
  162. package/src/css/design-system.scss +0 -43
  163. package/src/css/fonts.scss +2 -28
  164. package/src/css/opacity.scss +0 -4
  165. package/src/css/set-brand.scss +15 -0
  166. package/src/css/transitions.scss +1 -1
  167. package/src/helpers/add-counter-suffix.js +3 -0
  168. package/src/helpers/{base64ToBlob.js → base-64-to-blob.js} +0 -0
  169. package/src/helpers/{constructObject.js → construct-object.js} +0 -0
  170. package/src/helpers/filter-object.js +8 -6
  171. package/src/helpers/filters.js +8 -4
  172. package/src/helpers/{greatestCommonDivisor.js → get-greatest-common-divisor.js} +0 -0
  173. package/src/helpers/get-slot-children-text.js +15 -0
  174. package/src/helpers/images.js +28 -0
  175. package/src/helpers/index.js +11 -59
  176. package/src/helpers/{isLocalDevelopment.js → is-local-development.js} +0 -0
  177. package/src/helpers/set-scroll-on-grab.js +61 -0
  178. package/src/index.cjs.js +1 -0
  179. package/src/index.esm.js +4 -0
  180. package/src/index.scss +19 -21
  181. package/src/index.umd.js +2 -0
  182. package/src/mixins/context.js +1 -1
  183. package/src/mixins/dialog-router.js +17 -0
  184. package/src/mixins/form.js +4 -12
  185. package/src/mixins/generator.js +14 -14
  186. package/src/mixins/index.js +2 -8
  187. package/src/mixins/password.js +73 -11
  188. package/src/mixins/screen.js +8 -6
  189. package/src/mixins/view.js +62 -22
  190. package/src/plugins/dialog/Dialog.js +14 -0
  191. package/src/plugins/dialog/Dialog.yml +10 -0
  192. package/src/plugins/index.js +4 -2
  193. package/src/plugins/{NotifyError.js → notify-error/NotifyError.js} +0 -0
  194. package/src/plugins/notify-error/NotifyError.yml +11 -0
  195. package/src/plugins/{NotifySuccess.js → notify-success/NotifySuccess.js} +3 -3
  196. package/src/plugins/notify-success/NotifySuccess.yml +11 -0
  197. package/src/store/history.js +43 -0
  198. package/src/store/index.js +1 -0
  199. package/src/vue-plugin.js +185 -0
  200. package/.babelrc +0 -12
  201. package/.storybook/main.js +0 -35
  202. package/.storybook/preview.js +0 -26
  203. package/debug.log +0 -1
  204. package/index.js +0 -4
  205. package/jest-setup.js +0 -1
  206. package/jest.config.json +0 -22
  207. package/postcss.config.js +0 -5
  208. package/src/components/Introduction.stories.mdx +0 -12
  209. package/src/components/actions-menu/QasActionsMenu.stories.js +0 -73
  210. package/src/components/app-bar/QasAppBar.stories.js +0 -84
  211. package/src/components/app-menu/QasAppMenu.stories.js +0 -66
  212. package/src/components/apps-menu/QasAppsMenu.spec.js +0 -58
  213. package/src/components/apps-menu/QasAppsMenu.stories.js +0 -54
  214. package/src/components/apps-menu/QasAppsMenu.vue +0 -48
  215. package/src/components/avatar/QasAvatar.spec.js +0 -14
  216. package/src/components/avatar/QasAvatar.stories.js +0 -52
  217. package/src/components/box/QasBox.spec.js +0 -18
  218. package/src/components/box/QasBox.stories.js +0 -35
  219. package/src/components/break-line/QasBreakLine.stories.js +0 -57
  220. package/src/components/break-line/QasBreakLine.vue +0 -52
  221. package/src/components/btn/QasBtn.stories.js +0 -45
  222. package/src/components/btn-actions/QasBtnActions.stories.js +0 -77
  223. package/src/components/btn-actions/QasBtnActions.vue +0 -54
  224. package/src/components/card/QasCard.stories.js +0 -126
  225. package/src/components/checkbox-group/QasCheckboxGroup.stories.js +0 -59
  226. package/src/components/copy/QasCopy.stories.js +0 -41
  227. package/src/components/date-time-input/QasDateTimeInput.stories.js +0 -67
  228. package/src/components/debugger/QasDebugger.stories.js +0 -33
  229. package/src/components/delete/QasDelete.stories.js +0 -80
  230. package/src/components/dialog/QasDialog.stories.js +0 -139
  231. package/src/components/dialog-router/QasDialogRouter.stories.js +0 -38
  232. package/src/components/field/QasField.stories.js +0 -181
  233. package/src/components/filters/QasFilters.stories.js +0 -121
  234. package/src/components/form-generator/QasFormGenerator.stories.js +0 -115
  235. package/src/components/form-view/QasFormView.stories.js +0 -236
  236. package/src/components/gallery/QasGallery.stories.js +0 -91
  237. package/src/components/grid-generator/QasGridGenerator.stories.js +0 -142
  238. package/src/components/input/QasInput.stories.js +0 -78
  239. package/src/components/label/QasLabel.stories.js +0 -60
  240. package/src/components/layout/QasLayout.stories.js +0 -104
  241. package/src/components/list-items/QasListItems.stories.js +0 -135
  242. package/src/components/list-view/QasListView.stories.js +0 -168
  243. package/src/components/map/QasMap.stories.js +0 -75
  244. package/src/components/nested-fields/QasNestedFields.stories.js +0 -255
  245. package/src/components/numeric-input/QasNumericInput.stories.js +0 -92
  246. package/src/components/page-header/QasPageHeader.stories.js +0 -61
  247. package/src/components/password-input/QasPasswordInput.stories.js +0 -76
  248. package/src/components/password-strength-checker/QasPasswordStrengthChecker.stories.js +0 -54
  249. package/src/components/profile/QasProfile.stories.js +0 -131
  250. package/src/components/resizer/QasResizer.stories.js +0 -43
  251. package/src/components/search-box/QasSearchBox.stories.js +0 -111
  252. package/src/components/select/QasSelect.stories.js +0 -113
  253. package/src/components/select-list/QasSelectList.stories.js +0 -153
  254. package/src/components/signature-pad/QasSignaturePad.stories.js +0 -51
  255. package/src/components/signature-uploader/QasSignatureUploader.stories.js +0 -69
  256. package/src/components/single-view/QasSingleView.stories.js +0 -130
  257. package/src/components/sortable/QasSortable.stories.js +0 -80
  258. package/src/components/table-generator/QasTableGenerator.stories.js +0 -120
  259. package/src/components/tabs-generator/QasTabsGenerator.stories.js +0 -145
  260. package/src/components/text-truncate/QasTextTruncate.stories.js +0 -55
  261. package/src/components/tip/QasTip.stories.js +0 -57
  262. package/src/components/tip/QasTip.vue +0 -68
  263. package/src/components/tooltip/QasTooltip.stories.js +0 -63
  264. package/src/components/tooltip/QasTooltip.vue +0 -81
  265. package/src/components/transfer/QasTransfer.stories.js +0 -118
  266. package/src/components/uploader/QasCustomUploader.vue +0 -120
  267. package/src/components/uploader/QasUploader.stories.js +0 -139
  268. package/src/directives/Test.js +0 -13
  269. package/src/helpers/historyHandler.js +0 -52
  270. package/src/helpers/label.js +0 -3
  271. package/src/index.js +0 -249
  272. package/src/mixins/map-markers.js +0 -26
  273. package/src/mixins/unsaved-changes.js +0 -24
  274. package/src/mixins/uploader.js +0 -30
  275. package/src/mocks/json/user.json +0 -27
  276. package/src/mocks/json/users-new.json +0 -23
  277. package/src/mocks/json/users.json +0 -97
  278. package/src/mocks/storeModule.js +0 -71
  279. package/src/pages/Forbidden.vue +0 -6
  280. package/src/pages/NotFound.vue +0 -6
@@ -1,68 +0,0 @@
1
- <template>
2
- <div v-if="isOpened" class="q-pa-lg qas-tip relative-position rounded-borders" :class="classes" :style="styles">
3
- <q-btn class="absolute-top-right q-mr-md q-mt-sm" :color="color" dense flat icon="o_close" rounded @click="close" />
4
- <div class="q-gutter-md q-mr-lg" :class="classes">
5
- <slot name="header">
6
- <div v-if="title" class="text-bold text-h5">{{ title }}</div>
7
- </slot>
8
- <slot>
9
- <p>{{ text }}</p>
10
- </slot>
11
- </div>
12
- </div>
13
- </template>
14
-
15
- <script>
16
- export default {
17
- props: {
18
- bgColor: {
19
- type: String,
20
- default: 'transparent'
21
- },
22
-
23
- color: {
24
- type: String,
25
- default: 'primary'
26
- },
27
-
28
- text: {
29
- type: String,
30
- default: ''
31
- },
32
-
33
- title: {
34
- type: String,
35
- default: ''
36
- }
37
- },
38
-
39
- data () {
40
- return {
41
- isOpened: true
42
- }
43
- },
44
-
45
- computed: {
46
- classes () {
47
- return [`bg-${this.bgColor}`, `text-${this.color}`]
48
- },
49
-
50
- styles () {
51
- return { borderColor: this.color }
52
- }
53
- },
54
-
55
- methods: {
56
- close () {
57
- this.isOpened = false
58
- }
59
- }
60
- }
61
- </script>
62
-
63
- <style lang="scss">
64
- .qas-tip {
65
- border-style: solid;
66
- border-width: 0 10px;
67
- }
68
- </style>
@@ -1,63 +0,0 @@
1
- import QasTooltip from './QasTooltip.vue'
2
-
3
- export default {
4
- component: QasTooltip,
5
- title: 'Components/Tooltip',
6
-
7
- parameters: {
8
- docs: {
9
- description: {
10
- component: 'Creates a warning or message will be shown.'
11
- }
12
- }
13
- },
14
-
15
- argTypes: {
16
- // Props
17
- color: {
18
- description: 'Icon color name.'
19
- },
20
-
21
- icon: {
22
- description: 'Icon name.'
23
- },
24
-
25
- message: {
26
- description: 'Tooltip message.'
27
- },
28
-
29
- messageIcon: {
30
- description: 'Message icon name.'
31
- },
32
-
33
- messageIconSize: {
34
- description: 'Message icon size.'
35
- },
36
-
37
- notifyProps: {
38
- description: 'Props of $q.notify plugin'
39
- },
40
-
41
- size: {
42
- description: 'Tooltip\'s icon size.'
43
- },
44
-
45
- width: {
46
- description: 'Tooltip\'s width.'
47
- }
48
- }
49
- }
50
-
51
- const Template = (args, { argTypes }) => ({
52
- components: { QasTooltip },
53
- props: Object.keys(argTypes),
54
- template:
55
- `<qas-tooltip
56
- v-bind="$props"
57
- message-icon="o_assignment_late"
58
- messageIcon="o_assignment_late" icon="o_assignment_late"
59
- message="Message!"
60
- />`
61
- })
62
-
63
- export const Default = Template.bind({})
@@ -1,81 +0,0 @@
1
- <template>
2
- <q-icon :color="color" :name="icon" :size="size" @click="showNotify(notifyProps)">
3
- <q-tooltip v-if="!$_isSmall" anchor="top middle" self="bottom middle">
4
- <div class="items-center no-wrap row" :style="styles">
5
- <q-icon v-if="messageIcon" :name="messageIcon" :size="messageIconSize" />
6
- <div class="q-ml-sm text-subtitle2">{{ message }}</div>
7
- </div>
8
- </q-tooltip>
9
- </q-icon>
10
- </template>
11
-
12
- <script>
13
- import screen from '../../mixins/screen.js'
14
-
15
- export default {
16
- mixins: [screen],
17
-
18
- props: {
19
- color: {
20
- default: 'primary',
21
- type: String
22
- },
23
-
24
- icon: {
25
- default: '',
26
- type: String,
27
- required: true
28
- },
29
-
30
- message: {
31
- default: '',
32
- type: String,
33
- required: true
34
- },
35
-
36
- messageIcon: {
37
- default: '',
38
- type: String
39
- },
40
-
41
- messageIconSize: {
42
- default: '20px',
43
- type: String
44
- },
45
-
46
- notifyProps: {
47
- default: () => ({}),
48
- type: Object
49
- },
50
-
51
- size: {
52
- default: '20px',
53
- type: String
54
- },
55
-
56
- width: {
57
- default: '300px',
58
- type: String
59
- }
60
- },
61
-
62
- computed: {
63
- styles () {
64
- return {
65
- width: this.width
66
- }
67
- }
68
- },
69
-
70
- methods: {
71
- showNotify (attrs) {
72
- if (this.$_isSmall) {
73
- this.$q.notify({
74
- message: this.message,
75
- ...attrs
76
- })
77
- }
78
- }
79
- }
80
- }
81
- </script>
@@ -1,118 +0,0 @@
1
- import QasTransfer from './QasTransfer.vue'
2
-
3
- const noSummary = {
4
- type: { summary: null }
5
- }
6
-
7
- export default {
8
- component: QasTransfer,
9
- title: 'Components/Transfer',
10
-
11
- parameters: {
12
- docs: {
13
- description: {
14
- component: 'Transfer items between two lists.'
15
- }
16
- }
17
- },
18
-
19
- argTypes: {
20
- // Props
21
- emitValue: {
22
- description: 'When `true`, transform `value` into an array of selected items key, instead of object.'
23
- },
24
-
25
- fuseOptions: {
26
- description: '[Fuse.js](https://fusejs.io) options.',
27
- table: {
28
- defaultValue: {
29
- detail: JSON.stringify({ keys: ['label'] }),
30
- summary: '{}'
31
- }
32
- }
33
- },
34
-
35
- hideEmptySlot: {
36
- description: 'Hides empty slot.'
37
- },
38
-
39
- label: {
40
- description: 'From list label.'
41
- },
42
-
43
- labelKey: {
44
- description: 'Key to be used instead of `label`.'
45
- },
46
-
47
- options: {
48
- description: 'Options to be transfered.'
49
- },
50
-
51
- value: {
52
- description: 'Selected items. See `emitValue` prop to use keys instead of objects.'
53
- },
54
-
55
- valueKey: {
56
- description: 'Key to be used instead of `value`.'
57
- },
58
-
59
- // Events
60
- input: {
61
- description: 'Fires when model changes. Also used by `v-model`.',
62
- table: {
63
- defaultValue: {
64
- detail: JSON.stringify({ value: 'array' }),
65
- summary: '{}'
66
- }
67
- }
68
- },
69
-
70
- // Slots
71
- // TODO: Renomear para "from-list-item" e "to-list-item".
72
- 'item-first-column': {
73
- description: 'From list slot, inside of `QItem`.',
74
- table: noSummary
75
- },
76
-
77
- 'item-second-column': {
78
- description: 'To list slot, inside of `QItem`.',
79
- table: noSummary
80
- }
81
- }
82
- }
83
-
84
- const Template = (args, { argTypes }) => ({
85
- components: { QasTransfer },
86
- props: Object.keys(argTypes),
87
-
88
- data () {
89
- return {
90
- model: []
91
- }
92
- },
93
-
94
- template:
95
- `<div>
96
- <qas-transfer v-model="model" v-bind="$props" />
97
- <pre>{{ model }}</pre>
98
- </div>`
99
- })
100
-
101
- export const Default = Template.bind({})
102
-
103
- Default.args = {
104
- fuseOptions: { keys: ['label'] },
105
- label: 'List of items',
106
- options: [
107
- { label: 'Item 1', value: 1 },
108
- { label: 'Item 2', value: 2 },
109
- { label: 'Item 3', value: 3 },
110
- { label: 'Item 4', value: 4 },
111
- { label: 'Item 5', value: 5 },
112
- { label: 'Item 6', value: 6 },
113
- { label: 'Item 7', value: 7 },
114
- { label: 'Item 8', value: 8 },
115
- { label: 'Item 9', value: 9 },
116
- { label: 'Item 10', value: 10 }
117
- ]
118
- }
@@ -1,120 +0,0 @@
1
- <script>
2
- import Pica from 'pica'
3
- import { QUploader } from 'quasar'
4
- import uploaderMixin from '../../mixins/uploader'
5
- import QUploaderBase from 'quasar/src/components/uploader/QUploaderBase'
6
-
7
- export default {
8
- name: 'QasCustomUploader',
9
-
10
- extends: QUploader,
11
-
12
- mixins: [uploaderMixin],
13
-
14
- data () {
15
- return {
16
- isAddingFiles: false
17
- }
18
- },
19
-
20
- computed: {
21
- // overrides "isBusy" from quasar for adding "this.isAddingFiles"
22
- isBusy () {
23
- return this.isAddingFiles || this.promises.length > 0
24
- },
25
-
26
- picaResizeOptionsDefault () {
27
- return {
28
- unsharpAmount: 160,
29
- unsharpRadius: 0.6,
30
- unsharpThreshold: 1,
31
- ...this.picaResizeOptions
32
- }
33
- }
34
- },
35
-
36
- methods: {
37
- // function for handling files and resize if it is an image type
38
- async filesHandler (file) {
39
- const { type } = file
40
-
41
- // only resize if is an image type
42
- if (!this.acceptResizeTypes.includes(type) || !this.useResize) return file
43
-
44
- try {
45
- // create a new image and canvas for resizing purpose
46
- const image = new Image()
47
- const canvas = document.createElement('canvas')
48
-
49
- image.src = URL.createObjectURL(file)
50
-
51
- // get the original width and height of the uploaded image
52
- const { width, height } = await this.getImageSize(image)
53
-
54
- // get the redimensioned sizes
55
- const resizedDimensions = this.resizeDimensions(this.sizeLimit, width, height)
56
-
57
- canvas.width = resizedDimensions.width
58
- canvas.height = resizedDimensions.height
59
-
60
- // fix cors issues
61
- image.crossOrigin = ''
62
-
63
- image.width = width
64
- image.height = height
65
-
66
- // get the resized canvas and transform it into a blob
67
- const pica = Pica()
68
- const resizedImage = await pica.resize(image, canvas, this.picaResizeOptionsDefault)
69
- const blob = await pica.toBlob(resizedImage, type, 0.90)
70
-
71
- // now returns the newly formatted file
72
- return new File([blob], file.name, { type })
73
- } catch {
74
- // if there is an error, return the original file
75
- return file
76
- }
77
- },
78
-
79
- // overrides "__addFiles" from quasar
80
- async __addFiles (event, files = []) {
81
- const filesToUpload = event?.target?.files || files
82
- this.isAddingFiles = true
83
-
84
- const filesPromise = []
85
-
86
- for (const file of filesToUpload) {
87
- filesPromise.push(this.filesHandler(file))
88
- }
89
-
90
- const processedFiles = await Promise.all(filesPromise)
91
- this.isAddingFiles = false
92
- QUploaderBase.extendOptions.methods.__addFiles.call(this, null, processedFiles)
93
- },
94
-
95
- resizeDimensions (sizeLimit, width, height) {
96
- const factor = sizeLimit / Math.max(width, height)
97
-
98
- if (factor < 1) {
99
- width *= factor
100
- height *= factor
101
- }
102
-
103
- return {
104
- width: Math.round(width),
105
- height: Math.round(height)
106
- }
107
- },
108
-
109
- getImageSize (image) {
110
- return new Promise((resolve, reject) => {
111
- image.addEventListener('load', () => {
112
- resolve({ width: image.naturalWidth, height: image.naturalHeight })
113
- })
114
-
115
- image.addEventListener('error', reject)
116
- })
117
- }
118
- }
119
- }
120
- </script>
@@ -1,139 +0,0 @@
1
- import QasUploader from './QasUploader.vue'
2
-
3
- const hides = {
4
- table: { disable: true }
5
- }
6
-
7
- export default {
8
- component: QasUploader,
9
- title: 'Components/Upload',
10
-
11
- parameters: {
12
- docs: {
13
- description: {
14
- component: 'Extends [QUploader](https://quasar.dev/vue-components/uploader). Require [Axios](https://github.com/axios/axios) to async upload files to server.'
15
- }
16
- }
17
- },
18
-
19
- argTypes: {
20
- // Props
21
- accept: hides,
22
-
23
- entity: {
24
- description: 'Used by server to know where to store files in the assets bucket.'
25
- },
26
-
27
- hint: {
28
- description: 'Help text.'
29
- },
30
-
31
- label: hides,
32
-
33
- maxFiles: {
34
- description: 'Max number of files to select.'
35
- },
36
-
37
- value: {
38
- control: null,
39
- description: 'File object.'
40
- },
41
-
42
- errorMessage: {
43
- description: 'Error message.'
44
- },
45
-
46
- picaResizeOptions: {
47
- description: 'Node [pica](https://github.com/nodeca/pica) resize method options.',
48
- table: {
49
- defaultValue: {
50
- detail: JSON.stringify({
51
- unsharpAmount: 160,
52
- unsharpRadius: 0.6,
53
- unsharpThreshold: 1
54
- })
55
- }
56
- }
57
- },
58
-
59
- acceptResizeTypes: {
60
- description: 'Accepted file types to resize.'
61
- },
62
-
63
- sizeLimit: {
64
- description: 'Max file size in pixels.'
65
- },
66
-
67
- useResize: {
68
- description: 'Enable resizer image to fit the sizeLimit.'
69
- },
70
-
71
- // Events
72
- input: {
73
- description: 'Fires when files change.'
74
- },
75
-
76
- // Slots
77
- 'custom-upload': {
78
- description: 'Replace `QasUploader` component. The `context` will give access to all the functions and attributes of the component.',
79
- table: {
80
- defaultValue: {
81
- detail: JSON.stringify({ context: 'object' }),
82
- summary: '{}'
83
- },
84
-
85
- type: { summary: null }
86
- }
87
- },
88
-
89
- header: {
90
- description: 'Slot in case you want to customize the `QasUploader` header.',
91
- table: {
92
- defaultValue: {
93
- detail: JSON.stringify({ scope: 'object' }),
94
- summary: '{}'
95
- },
96
-
97
- type: { summary: null }
98
- }
99
- },
100
-
101
- list: {
102
- description: 'Slot if you want to customize the content that contains the file listing.',
103
- table: {
104
- defaultValue: {
105
- detail: JSON.stringify({ scope: 'object' }),
106
- summary: '{}'
107
- },
108
-
109
- type: { summary: null }
110
- }
111
- }
112
- }
113
- }
114
-
115
- const Template = (args, { argTypes }) => ({
116
- components: { QasUploader },
117
- props: Object.keys(argTypes),
118
- template:
119
- `<div>
120
- <qas-uploader v-bind="$props" />
121
- <qas-uploader v-bind="$props">
122
- <template #custom-upload="{ context }">
123
- <q-btn color="primary" flat no-caps @click="context.dispatchUpload">
124
- <q-circular-progress v-if="context.isFetching" class="q-mr-sm" color="primary" indeterminate size="20px" />
125
- <q-icon class="q-mr-sm" name="o_camera_alt" />
126
- Fazer upload
127
- </q-btn>
128
- </template>
129
- </qas-uploader>
130
- </div>`
131
- })
132
-
133
- export const Default = Template.bind({})
134
-
135
- Default.args = {
136
- accept: '.jpg,.jpeg,.png',
137
- entity: 'posts/image',
138
- label: 'Image'
139
- }
@@ -1,13 +0,0 @@
1
- export default {
2
- name: 'test',
3
-
4
- bind (element, { arg: argument, value }) {
5
- if (element && argument) {
6
- element.dataset.test = argument
7
- }
8
-
9
- if (element && value) {
10
- element.dataset.testKey = value
11
- }
12
- }
13
- }
@@ -1,52 +0,0 @@
1
- // TODO: Renomear arquivo para history.js e tirar os "handler".
2
- import Vue from 'vue'
3
-
4
- const history = Vue.observable({
5
- hasPreviousRoute: false,
6
- list: []
7
- })
8
-
9
- function handleHistory () {
10
- return {
11
- getPreviousRoute (currentRoute) {
12
- const index = history.list.findIndex(item => item.name === currentRoute.name)
13
-
14
- if (~index) {
15
- history.list.splice(index, 1)
16
- }
17
-
18
- history.hasPreviousRoute = history.list.length > 1
19
- return history.list[history.list.length - 1]
20
- },
21
-
22
- push (route) {
23
- const routeExistsInList = history.list.find(item => item.name === route.name)
24
-
25
- if (routeExistsInList) {
26
- return null
27
- }
28
-
29
- history.list.push(route)
30
- history.hasPreviousRoute = history.list.length > 1
31
- },
32
-
33
- destroy (routes) {
34
- if (!history.list.length) {
35
- return null
36
- }
37
-
38
- routes.forEach(route => {
39
- const index = history.list.findIndex(item => item.name === route)
40
-
41
- if (~index) {
42
- history.list.splice(index, 1)
43
- }
44
- })
45
- }
46
- }
47
- }
48
-
49
- export {
50
- history,
51
- handleHistory
52
- }
@@ -1,3 +0,0 @@
1
- export default function (quantity, label) {
2
- return quantity ? `${label} (${quantity})` : label
3
- }