@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.
- package/dist/api/QasBox.json +16 -0
- package/dist/api/QasBreakline.json +32 -0
- package/dist/api/QasBtn.json +15 -0
- package/dist/api/QasDebugger.json +13 -0
- package/dist/asteroid.cjs.css +1 -0
- package/dist/asteroid.cjs.js +9154 -0
- package/dist/asteroid.cjs.min.js +6 -0
- package/dist/asteroid.esm.css +1 -0
- package/dist/asteroid.esm.js +9145 -0
- package/dist/asteroid.esm.min.js +6 -0
- package/dist/asteroid.umd.css +1 -0
- package/dist/asteroid.umd.js +9148 -0
- package/dist/asteroid.umd.min.js +6 -0
- package/dist/vetur/asteroid-attributes.json +30 -0
- package/dist/vetur/asteroid-tags.json +29 -0
- package/package.json +42 -56
- package/src/assets/logo-modular.svg +1 -0
- package/src/asteroid.js +1 -0
- package/src/components/actions/QasActions.vue +45 -0
- package/src/components/actions-menu/QasActionsMenu.vue +8 -19
- package/src/components/alert/QasAlert.vue +90 -0
- package/src/components/app-bar/QasAppBar.vue +59 -61
- package/src/components/app-menu/QasAppMenu.vue +128 -41
- package/src/components/avatar/QasAvatar.vue +7 -3
- package/src/components/box/QasBox.vue +12 -4
- package/src/components/box/QasBox.yml +13 -0
- package/src/components/breakline/QasBreakline.vue +37 -0
- package/src/components/breakline/QasBreakline.yml +25 -0
- package/src/components/btn/QasBtn.vue +27 -24
- package/src/components/btn/QasBtn.yml +12 -0
- package/src/components/card/QasCard.vue +29 -21
- package/src/components/checkbox-group/QasCheckboxGroup.vue +31 -17
- package/src/components/copy/QasCopy.vue +22 -11
- package/src/components/date-time-input/QasDateTimeInput.vue +16 -26
- package/src/components/debugger/QasDebugger.vue +2 -0
- package/src/components/debugger/QasDebugger.yml +10 -0
- package/src/components/delete/QasDelete.vue +28 -15
- package/src/components/dialog/QasDialog.vue +71 -67
- package/src/components/dialog-router/QasDialogRouter.vue +12 -4
- package/src/components/field/QasField.vue +22 -25
- package/src/components/filters/QasFilters.vue +31 -24
- package/src/components/form-generator/QasFormGenerator.vue +13 -15
- package/src/components/form-view/QasFormView.vue +117 -66
- package/src/components/gallery/QasGallery.vue +39 -26
- package/src/components/grid-generator/QasGridGenerator.vue +12 -6
- package/src/components/index.js +0 -0
- package/src/components/input/QasInput.vue +38 -36
- package/src/components/label/QasLabel.vue +14 -15
- package/src/components/layout/QasLayout.vue +81 -0
- package/src/components/list-items/QasListItems.vue +16 -8
- package/src/components/list-view/QasListView.vue +31 -28
- package/src/components/map/QasMap.vue +15 -25
- package/src/components/nested-fields/QasNestedFields.vue +39 -36
- package/src/components/numeric-input/QasNumericInput.vue +125 -0
- package/src/components/page-header/QasPageHeader.vue +19 -10
- package/src/components/password-input/QasPasswordInput.vue +20 -18
- package/src/components/password-strength-checker/QasPasswordStrengthChecker.vue +52 -31
- package/src/components/profile/QasProfile.vue +14 -12
- package/src/components/resizer/QasResizer.vue +1 -1
- package/src/components/search-box/QasSearchBox.vue +36 -20
- package/src/components/select/QasSelect.vue +43 -44
- package/src/components/select-list/QasSelectList.vue +64 -51
- package/src/components/signature-pad/QasSignaturePad.vue +57 -41
- package/src/components/signature-uploader/QasSignatureUploader.vue +15 -13
- package/src/components/single-view/QasSingleView.vue +31 -17
- package/src/components/sortable/QasSortable.vue +45 -27
- package/src/components/table-generator/QasTableGenerator.vue +95 -22
- package/src/components/tabs-generator/QasTabsGenerator.vue +36 -24
- package/src/components/text-truncate/QasTextTruncate.vue +25 -17
- package/src/components/transfer/QasTransfer.vue +57 -53
- package/src/components/uploader/QasUploader.vue +169 -48
- package/src/css/background.scss +1 -1
- package/src/css/border.scss +7 -6
- package/src/css/design-system.scss +0 -43
- package/src/css/fonts.scss +2 -28
- package/src/css/opacity.scss +0 -4
- package/src/css/set-brand.scss +15 -0
- package/src/css/transitions.scss +1 -1
- package/src/helpers/add-counter-suffix.js +3 -0
- package/src/helpers/{base64ToBlob.js → base-64-to-blob.js} +0 -0
- package/src/helpers/{constructObject.js → construct-object.js} +0 -0
- package/src/helpers/filter-object.js +8 -6
- package/src/helpers/filters.js +3 -4
- package/src/helpers/get-slot-children-text.js +15 -0
- package/src/helpers/{greatestCommonDivisor.js → greatest-common-divisor.js} +0 -0
- package/src/helpers/images.js +28 -0
- package/src/helpers/index.js +11 -57
- package/src/helpers/is-local-development.js +3 -0
- package/src/helpers/scroll-on-grap.js +61 -0
- package/src/index.cjs.js +1 -0
- package/src/index.esm.js +4 -0
- package/src/index.scss +18 -20
- package/src/index.umd.js +2 -0
- package/src/mixins/context.js +1 -1
- package/src/mixins/dialog-router.js +17 -0
- package/src/mixins/form.js +4 -12
- package/src/mixins/generator.js +14 -14
- package/src/mixins/index.js +2 -8
- package/src/mixins/password.js +73 -11
- package/src/mixins/screen.js +8 -6
- package/src/mixins/view.js +57 -20
- package/src/plugins/Dialog.js +14 -0
- package/src/plugins/NotifySuccess.js +3 -3
- package/src/plugins/index.js +4 -2
- package/src/store/history.js +43 -0
- package/src/store/index.js +1 -0
- package/src/vue-plugin.js +185 -0
- package/.babelrc +0 -12
- package/.storybook/main.js +0 -35
- package/.storybook/preview.js +0 -26
- package/debug.log +0 -1
- package/index.js +0 -4
- package/jest-setup.js +0 -1
- package/jest.config.json +0 -22
- package/postcss.config.js +0 -5
- package/src/components/Introduction.stories.mdx +0 -12
- package/src/components/actions-menu/QasActionsMenu.stories.js +0 -73
- package/src/components/app-bar/QasAppBar.stories.js +0 -88
- package/src/components/app-menu/QasAppMenu.stories.js +0 -62
- package/src/components/apps-menu/QasAppsMenu.spec.js +0 -58
- package/src/components/apps-menu/QasAppsMenu.stories.js +0 -54
- package/src/components/apps-menu/QasAppsMenu.vue +0 -48
- package/src/components/avatar/QasAvatar.spec.js +0 -14
- package/src/components/avatar/QasAvatar.stories.js +0 -52
- package/src/components/box/QasBox.spec.js +0 -18
- package/src/components/box/QasBox.stories.js +0 -35
- package/src/components/break-line/QasBreakLine.stories.js +0 -57
- package/src/components/break-line/QasBreakLine.vue +0 -52
- package/src/components/btn/QasBtn.stories.js +0 -45
- package/src/components/btn-actions/QasBtnActions.stories.js +0 -77
- package/src/components/btn-actions/QasBtnActions.vue +0 -54
- package/src/components/card/QasCard.stories.js +0 -126
- package/src/components/checkbox-group/QasCheckboxGroup.stories.js +0 -59
- package/src/components/copy/QasCopy.stories.js +0 -41
- package/src/components/date-time-input/QasDateTimeInput.stories.js +0 -67
- package/src/components/debugger/QasDebugger.stories.js +0 -33
- package/src/components/decimal-input/QasDecimalInput.stories.js +0 -82
- package/src/components/decimal-input/QasDecimalInput.vue +0 -92
- package/src/components/delete/QasDelete.stories.js +0 -80
- package/src/components/dialog/QasDialog.stories.js +0 -139
- package/src/components/dialog-router/QasDialogRouter.stories.js +0 -38
- package/src/components/field/QasField.stories.js +0 -181
- package/src/components/filters/QasFilters.stories.js +0 -121
- package/src/components/form-generator/QasFormGenerator.stories.js +0 -115
- package/src/components/form-view/QasFormView.stories.js +0 -236
- package/src/components/gallery/QasGallery.stories.js +0 -91
- package/src/components/grid-generator/QasGridGenerator.stories.js +0 -138
- package/src/components/input/QasInput.stories.js +0 -78
- package/src/components/label/QasLabel.stories.js +0 -60
- package/src/components/list-items/QasListItems.stories.js +0 -130
- package/src/components/list-view/QasListView.stories.js +0 -168
- package/src/components/map/QasMap.stories.js +0 -75
- package/src/components/nested-fields/QasNestedFields.stories.js +0 -255
- package/src/components/page-header/QasPageHeader.stories.js +0 -61
- package/src/components/password-input/QasPasswordInput.stories.js +0 -76
- package/src/components/password-strength-checker/QasPasswordStrengthChecker.stories.js +0 -54
- package/src/components/profile/QasProfile.stories.js +0 -131
- package/src/components/resizer/QasResizer.stories.js +0 -43
- package/src/components/search-box/QasSearchBox.stories.js +0 -111
- package/src/components/select/QasSelect.stories.js +0 -113
- package/src/components/select-list/QasSelectList.stories.js +0 -153
- package/src/components/signature-pad/QasSignaturePad.stories.js +0 -51
- package/src/components/signature-uploader/QasSignatureUploader.stories.js +0 -69
- package/src/components/single-view/QasSingleView.stories.js +0 -130
- package/src/components/sortable/QasSortable.stories.js +0 -80
- package/src/components/table-generator/QasTableGenerator.stories.js +0 -116
- package/src/components/tabs-generator/QasTabsGenerator.stories.js +0 -145
- package/src/components/text-truncate/QasTextTruncate.stories.js +0 -55
- package/src/components/tip/QasTip.stories.js +0 -57
- package/src/components/tip/QasTip.vue +0 -68
- package/src/components/tooltip/QasTooltip.stories.js +0 -63
- package/src/components/tooltip/QasTooltip.vue +0 -81
- package/src/components/transfer/QasTransfer.stories.js +0 -118
- package/src/components/uploader/QasCustomUploader.vue +0 -121
- package/src/components/uploader/QasUploader.stories.js +0 -139
- package/src/directives/Test.js +0 -13
- package/src/helpers/historyHandler.js +0 -52
- package/src/helpers/label.js +0 -3
- package/src/index.js +0 -245
- package/src/mixins/map-markers.js +0 -26
- package/src/mixins/unsaved-changes.js +0 -24
- package/src/mixins/uploader.js +0 -30
- package/src/mocks/json/user.json +0 -27
- package/src/mocks/json/users-new.json +0 -23
- package/src/mocks/json/users.json +0 -97
- package/src/mocks/storeModule.js +0 -71
- package/src/pages/Forbidden.vue +0 -6
- 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
|
-
}
|
package/src/directives/Test.js
DELETED
|
@@ -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
|
-
}
|
package/src/helpers/label.js
DELETED