@bildvitta/quasar-ui-asteroid 2.12.4 → 3.0.0-alpha.1

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 (188) hide show
  1. package/dist/api/QasBox.json +16 -0
  2. package/dist/api/QasBreakline.json +32 -0
  3. package/dist/api/QasBtn.json +15 -0
  4. package/dist/api/QasDebugger.json +13 -0
  5. package/dist/asteroid.cjs.css +1 -0
  6. package/dist/asteroid.cjs.js +9154 -0
  7. package/dist/asteroid.cjs.min.js +6 -0
  8. package/dist/asteroid.esm.css +1 -0
  9. package/dist/asteroid.esm.js +9145 -0
  10. package/dist/asteroid.esm.min.js +6 -0
  11. package/dist/asteroid.umd.css +1 -0
  12. package/dist/asteroid.umd.js +9148 -0
  13. package/dist/asteroid.umd.min.js +6 -0
  14. package/dist/vetur/asteroid-attributes.json +30 -0
  15. package/dist/vetur/asteroid-tags.json +29 -0
  16. package/package.json +42 -56
  17. package/src/assets/logo-modular.svg +1 -0
  18. package/src/asteroid.js +1 -0
  19. package/src/components/actions/QasActions.vue +45 -0
  20. package/src/components/actions-menu/QasActionsMenu.vue +8 -19
  21. package/src/components/alert/QasAlert.vue +90 -0
  22. package/src/components/app-bar/QasAppBar.vue +59 -61
  23. package/src/components/app-menu/QasAppMenu.vue +128 -41
  24. package/src/components/avatar/QasAvatar.vue +7 -3
  25. package/src/components/box/QasBox.vue +12 -4
  26. package/src/components/box/QasBox.yml +13 -0
  27. package/src/components/breakline/QasBreakline.vue +37 -0
  28. package/src/components/breakline/QasBreakline.yml +25 -0
  29. package/src/components/btn/QasBtn.vue +27 -24
  30. package/src/components/btn/QasBtn.yml +12 -0
  31. package/src/components/card/QasCard.vue +29 -21
  32. package/src/components/checkbox-group/QasCheckboxGroup.vue +31 -17
  33. package/src/components/copy/QasCopy.vue +22 -11
  34. package/src/components/date-time-input/QasDateTimeInput.vue +16 -26
  35. package/src/components/debugger/QasDebugger.vue +2 -0
  36. package/src/components/debugger/QasDebugger.yml +10 -0
  37. package/src/components/delete/QasDelete.vue +28 -15
  38. package/src/components/dialog/QasDialog.vue +71 -67
  39. package/src/components/dialog-router/QasDialogRouter.vue +12 -4
  40. package/src/components/field/QasField.vue +22 -25
  41. package/src/components/filters/QasFilters.vue +31 -24
  42. package/src/components/form-generator/QasFormGenerator.vue +13 -15
  43. package/src/components/form-view/QasFormView.vue +117 -66
  44. package/src/components/gallery/QasGallery.vue +39 -26
  45. package/src/components/grid-generator/QasGridGenerator.vue +12 -6
  46. package/src/components/index.js +0 -0
  47. package/src/components/input/QasInput.vue +38 -36
  48. package/src/components/label/QasLabel.vue +14 -15
  49. package/src/components/layout/QasLayout.vue +81 -0
  50. package/src/components/list-items/QasListItems.vue +16 -8
  51. package/src/components/list-view/QasListView.vue +31 -28
  52. package/src/components/map/QasMap.vue +15 -25
  53. package/src/components/nested-fields/QasNestedFields.vue +39 -36
  54. package/src/components/numeric-input/QasNumericInput.vue +125 -0
  55. package/src/components/page-header/QasPageHeader.vue +19 -10
  56. package/src/components/password-input/QasPasswordInput.vue +20 -18
  57. package/src/components/password-strength-checker/QasPasswordStrengthChecker.vue +52 -31
  58. package/src/components/profile/QasProfile.vue +14 -12
  59. package/src/components/resizer/QasResizer.vue +1 -1
  60. package/src/components/search-box/QasSearchBox.vue +36 -20
  61. package/src/components/select/QasSelect.vue +43 -44
  62. package/src/components/select-list/QasSelectList.vue +64 -51
  63. package/src/components/signature-pad/QasSignaturePad.vue +57 -41
  64. package/src/components/signature-uploader/QasSignatureUploader.vue +15 -13
  65. package/src/components/single-view/QasSingleView.vue +31 -17
  66. package/src/components/sortable/QasSortable.vue +45 -27
  67. package/src/components/table-generator/QasTableGenerator.vue +95 -22
  68. package/src/components/tabs-generator/QasTabsGenerator.vue +36 -24
  69. package/src/components/text-truncate/QasTextTruncate.vue +25 -17
  70. package/src/components/transfer/QasTransfer.vue +57 -53
  71. package/src/components/uploader/QasUploader.vue +169 -48
  72. package/src/css/background.scss +1 -1
  73. package/src/css/border.scss +7 -6
  74. package/src/css/design-system.scss +0 -43
  75. package/src/css/fonts.scss +2 -28
  76. package/src/css/opacity.scss +0 -4
  77. package/src/css/set-brand.scss +15 -0
  78. package/src/css/transitions.scss +1 -1
  79. package/src/helpers/add-counter-suffix.js +3 -0
  80. package/src/helpers/{base64ToBlob.js → base-64-to-blob.js} +0 -0
  81. package/src/helpers/{constructObject.js → construct-object.js} +0 -0
  82. package/src/helpers/filter-object.js +8 -6
  83. package/src/helpers/filters.js +3 -4
  84. package/src/helpers/get-slot-children-text.js +15 -0
  85. package/src/helpers/{greatestCommonDivisor.js → greatest-common-divisor.js} +0 -0
  86. package/src/helpers/images.js +28 -0
  87. package/src/helpers/index.js +11 -57
  88. package/src/helpers/is-local-development.js +3 -0
  89. package/src/helpers/scroll-on-grap.js +61 -0
  90. package/src/index.cjs.js +1 -0
  91. package/src/index.esm.js +4 -0
  92. package/src/index.scss +18 -20
  93. package/src/index.umd.js +2 -0
  94. package/src/mixins/context.js +1 -1
  95. package/src/mixins/dialog-router.js +17 -0
  96. package/src/mixins/form.js +4 -12
  97. package/src/mixins/generator.js +14 -14
  98. package/src/mixins/index.js +2 -8
  99. package/src/mixins/password.js +73 -11
  100. package/src/mixins/screen.js +8 -6
  101. package/src/mixins/view.js +57 -20
  102. package/src/plugins/Dialog.js +14 -0
  103. package/src/plugins/NotifySuccess.js +3 -3
  104. package/src/plugins/index.js +4 -2
  105. package/src/store/history.js +43 -0
  106. package/src/store/index.js +1 -0
  107. package/src/vue-plugin.js +185 -0
  108. package/.babelrc +0 -12
  109. package/.storybook/main.js +0 -35
  110. package/.storybook/preview.js +0 -26
  111. package/debug.log +0 -1
  112. package/index.js +0 -4
  113. package/jest-setup.js +0 -1
  114. package/jest.config.json +0 -22
  115. package/postcss.config.js +0 -5
  116. package/src/components/Introduction.stories.mdx +0 -12
  117. package/src/components/actions-menu/QasActionsMenu.stories.js +0 -73
  118. package/src/components/app-bar/QasAppBar.stories.js +0 -88
  119. package/src/components/app-menu/QasAppMenu.stories.js +0 -62
  120. package/src/components/apps-menu/QasAppsMenu.spec.js +0 -58
  121. package/src/components/apps-menu/QasAppsMenu.stories.js +0 -54
  122. package/src/components/apps-menu/QasAppsMenu.vue +0 -48
  123. package/src/components/avatar/QasAvatar.spec.js +0 -14
  124. package/src/components/avatar/QasAvatar.stories.js +0 -52
  125. package/src/components/box/QasBox.spec.js +0 -18
  126. package/src/components/box/QasBox.stories.js +0 -35
  127. package/src/components/break-line/QasBreakLine.stories.js +0 -57
  128. package/src/components/break-line/QasBreakLine.vue +0 -52
  129. package/src/components/btn/QasBtn.stories.js +0 -45
  130. package/src/components/btn-actions/QasBtnActions.stories.js +0 -77
  131. package/src/components/btn-actions/QasBtnActions.vue +0 -54
  132. package/src/components/card/QasCard.stories.js +0 -126
  133. package/src/components/checkbox-group/QasCheckboxGroup.stories.js +0 -59
  134. package/src/components/copy/QasCopy.stories.js +0 -41
  135. package/src/components/date-time-input/QasDateTimeInput.stories.js +0 -67
  136. package/src/components/debugger/QasDebugger.stories.js +0 -33
  137. package/src/components/decimal-input/QasDecimalInput.stories.js +0 -82
  138. package/src/components/decimal-input/QasDecimalInput.vue +0 -92
  139. package/src/components/delete/QasDelete.stories.js +0 -80
  140. package/src/components/dialog/QasDialog.stories.js +0 -139
  141. package/src/components/dialog-router/QasDialogRouter.stories.js +0 -38
  142. package/src/components/field/QasField.stories.js +0 -181
  143. package/src/components/filters/QasFilters.stories.js +0 -121
  144. package/src/components/form-generator/QasFormGenerator.stories.js +0 -115
  145. package/src/components/form-view/QasFormView.stories.js +0 -236
  146. package/src/components/gallery/QasGallery.stories.js +0 -91
  147. package/src/components/grid-generator/QasGridGenerator.stories.js +0 -138
  148. package/src/components/input/QasInput.stories.js +0 -78
  149. package/src/components/label/QasLabel.stories.js +0 -60
  150. package/src/components/list-items/QasListItems.stories.js +0 -130
  151. package/src/components/list-view/QasListView.stories.js +0 -168
  152. package/src/components/map/QasMap.stories.js +0 -75
  153. package/src/components/nested-fields/QasNestedFields.stories.js +0 -255
  154. package/src/components/page-header/QasPageHeader.stories.js +0 -61
  155. package/src/components/password-input/QasPasswordInput.stories.js +0 -76
  156. package/src/components/password-strength-checker/QasPasswordStrengthChecker.stories.js +0 -54
  157. package/src/components/profile/QasProfile.stories.js +0 -131
  158. package/src/components/resizer/QasResizer.stories.js +0 -43
  159. package/src/components/search-box/QasSearchBox.stories.js +0 -111
  160. package/src/components/select/QasSelect.stories.js +0 -113
  161. package/src/components/select-list/QasSelectList.stories.js +0 -153
  162. package/src/components/signature-pad/QasSignaturePad.stories.js +0 -51
  163. package/src/components/signature-uploader/QasSignatureUploader.stories.js +0 -69
  164. package/src/components/single-view/QasSingleView.stories.js +0 -130
  165. package/src/components/sortable/QasSortable.stories.js +0 -80
  166. package/src/components/table-generator/QasTableGenerator.stories.js +0 -116
  167. package/src/components/tabs-generator/QasTabsGenerator.stories.js +0 -145
  168. package/src/components/text-truncate/QasTextTruncate.stories.js +0 -55
  169. package/src/components/tip/QasTip.stories.js +0 -57
  170. package/src/components/tip/QasTip.vue +0 -68
  171. package/src/components/tooltip/QasTooltip.stories.js +0 -63
  172. package/src/components/tooltip/QasTooltip.vue +0 -81
  173. package/src/components/transfer/QasTransfer.stories.js +0 -118
  174. package/src/components/uploader/QasCustomUploader.vue +0 -121
  175. package/src/components/uploader/QasUploader.stories.js +0 -139
  176. package/src/directives/Test.js +0 -13
  177. package/src/helpers/historyHandler.js +0 -52
  178. package/src/helpers/label.js +0 -3
  179. package/src/index.js +0 -245
  180. package/src/mixins/map-markers.js +0 -26
  181. package/src/mixins/unsaved-changes.js +0 -24
  182. package/src/mixins/uploader.js +0 -30
  183. package/src/mocks/json/user.json +0 -27
  184. package/src/mocks/json/users-new.json +0 -23
  185. package/src/mocks/json/users.json +0 -97
  186. package/src/mocks/storeModule.js +0 -71
  187. package/src/pages/Forbidden.vue +0 -6
  188. 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,121 +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.files = []
83
- this.isAddingFiles = true
84
-
85
- const filesPromise = []
86
-
87
- for (const file of filesToUpload) {
88
- filesPromise.push(this.filesHandler(file))
89
- }
90
-
91
- const processedFiles = await Promise.all(filesPromise)
92
- this.isAddingFiles = false
93
- QUploaderBase.extendOptions.methods.__addFiles.call(this, null, processedFiles)
94
- },
95
-
96
- resizeDimensions (sizeLimit, width, height) {
97
- const factor = sizeLimit / Math.max(width, height)
98
-
99
- if (factor < 1) {
100
- width *= factor
101
- height *= factor
102
- }
103
-
104
- return {
105
- width: Math.round(width),
106
- height: Math.round(height)
107
- }
108
- },
109
-
110
- getImageSize (image) {
111
- return new Promise((resolve, reject) => {
112
- image.addEventListener('load', () => {
113
- resolve({ width: image.naturalWidth, height: image.naturalHeight })
114
- })
115
-
116
- image.addEventListener('error', reject)
117
- })
118
- }
119
- }
120
- }
121
- </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
- }