@policystudio/policy-studio-ui-vue 1.0.19 → 1.0.20
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/.eslintrc.js +1 -2
- package/.storybook/main.js +3 -3
- package/.storybook/preview.js +1 -1
- package/README.md +8 -0
- package/babel.config.js +3 -0
- package/backup-package-lock.json +37194 -0
- package/dist/css/psui_styles.css +31 -50
- package/package.json +28 -22
- package/src/assets/scss/base.scss +1 -28
- package/src/components/accordion/PsAccordion.vue +9 -1
- package/src/components/accordion/PsAccordionItem.vue +1 -1
- package/src/components/buttons/PsButton.vue +32 -12
- package/src/components/chips/PsChips.vue +46 -28
- package/src/components/controls/PsDraggable.vue +27 -2
- package/src/components/controls/PsRadioButton.vue +63 -38
- package/src/components/controls/PsSwitch.vue +75 -76
- package/src/components/datatable/PsDataTable.vue +25 -29
- package/src/components/datatable/PsDataTableItem.vue +2 -2
- package/src/components/tooltip/PsDialogTooltip.vue +79 -0
- package/src/components/tooltip/PsRichTooltip.vue +38 -0
- package/src/components/tooltip/PsTooltip.vue +120 -0
- package/src/components/ui/PsIcon.vue +87 -24
- package/src/index.js +15 -1
- package/src/stories/Accordion.stories.js +2 -2
- package/src/stories/Button.stories.js +11 -11
- package/src/stories/Checkbox.stories.js +6 -6
- package/src/stories/Chips.stories.js +7 -7
- package/src/stories/Colors.stories.mdx +35 -35
- package/src/stories/Datatable.stories.js +15 -8
- package/src/stories/Dialog.stories.js +9 -9
- package/src/stories/Draggable.stories.js +24 -0
- package/src/stories/Dropdown.stories.js +5 -5
- package/src/stories/Input.stories.js +10 -10
- package/src/stories/RadioButton.stories.js +14 -14
- package/src/stories/Slider.stories.js +9 -9
- package/src/stories/Swith.stories.js +10 -10
- package/src/stories/TabHeader.stories.js +9 -9
- package/src/stories/Toast.stories.js +13 -13
- package/src/stories/Toggle.stories.js +5 -5
- package/src/stories/Tooltip.stories.js +113 -0
- package/src/util/GeneralFunctions.js +8 -8
- package/src/util/imageLoader.js +50 -0
- package/tailwind.config.js +1 -0
- package/src/assets/scss/tailwind.css +0 -70643
- package/src/assets/scss/tailwind.scss +0 -61088
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import PsRadioButton from '../components/controls/PsRadioButton.vue'
|
|
1
|
+
import PsRadioButton from '../components/controls/PsRadioButton.vue'
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Components/Radio Button',
|
|
5
5
|
component: PsRadioButton,
|
|
6
6
|
argTypes: {},
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
const Template = (args, { argTypes }) => ({
|
|
10
10
|
props: Object.keys(argTypes),
|
|
11
11
|
components: { PsRadioButton },
|
|
12
12
|
data: () => {
|
|
13
13
|
return {
|
|
14
|
-
selectedValue:
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
methods: {
|
|
18
|
-
changeValue(newValue) {
|
|
19
|
-
this.selectedValue = newValue
|
|
14
|
+
selectedValue: 2,
|
|
20
15
|
}
|
|
21
16
|
},
|
|
22
17
|
template: `
|
|
23
18
|
<div>
|
|
24
19
|
<div>
|
|
25
|
-
<PsRadioButton v-bind="$props" name="options" label="Label 1" value="1"
|
|
26
|
-
<PsRadioButton v-bind="$props" name="options" label="Label 2" value="2"
|
|
27
|
-
<PsRadioButton v-bind="$props" name="options" label="Label 3" value="3"
|
|
20
|
+
<PsRadioButton v-bind="$props" name="options" label="Label 1" value="1" v-model="selectedValue" />
|
|
21
|
+
<PsRadioButton v-bind="$props" name="options" label="Label 2" value="2" v-model="selectedValue" />
|
|
22
|
+
<PsRadioButton v-bind="$props" name="options" label="Label 3" value="3" v-model="selectedValue" />
|
|
28
23
|
<div class="result">
|
|
29
24
|
Radio button selection: {{selectedValue}}
|
|
30
25
|
</div>
|
|
31
26
|
</div>
|
|
32
27
|
</div>
|
|
33
28
|
`
|
|
34
|
-
})
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export const Default = Template.bind({})
|
|
32
|
+
Default.args = {}
|
|
35
33
|
|
|
36
|
-
export const
|
|
37
|
-
|
|
34
|
+
export const Small = Template.bind({})
|
|
35
|
+
Small.args = {
|
|
36
|
+
small: true
|
|
37
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import PsSlider from '../components/controls/PsSlider.vue'
|
|
1
|
+
import PsSlider from '../components/controls/PsSlider.vue'
|
|
2
2
|
export default {
|
|
3
3
|
title: 'Components/Slider',
|
|
4
4
|
component: PsSlider,
|
|
5
5
|
argTypes: {
|
|
6
6
|
},
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
const Template = (args, { argTypes }) => ({
|
|
10
10
|
props: Object.keys(argTypes),
|
|
@@ -14,27 +14,27 @@ const Template = (args, { argTypes }) => ({
|
|
|
14
14
|
<PsSlider v-bind="$props" :value.sync="value" />
|
|
15
15
|
</div>
|
|
16
16
|
`
|
|
17
|
-
})
|
|
17
|
+
})
|
|
18
18
|
|
|
19
|
-
export const Label = Template.bind({})
|
|
19
|
+
export const Label = Template.bind({})
|
|
20
20
|
Label.args = {
|
|
21
21
|
min: 1,
|
|
22
22
|
max: 100,
|
|
23
23
|
value: 30,
|
|
24
24
|
label: 'Score Label'
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
export const NoLabel = Template.bind({})
|
|
27
|
+
export const NoLabel = Template.bind({})
|
|
28
28
|
NoLabel.args = {
|
|
29
29
|
min: 1,
|
|
30
30
|
max: 100,
|
|
31
31
|
value: 15
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
33
|
|
|
34
|
-
export const Bubble = Template.bind({})
|
|
34
|
+
export const Bubble = Template.bind({})
|
|
35
35
|
Bubble.args = {
|
|
36
36
|
min: 1,
|
|
37
37
|
max: 100,
|
|
38
38
|
value: 23,
|
|
39
39
|
bubble: true
|
|
40
|
-
}
|
|
40
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import PsSwitch, { sizes } from '../components/controls/PsSwitch.vue'
|
|
1
|
+
import PsSwitch, { sizes } from '../components/controls/PsSwitch.vue'
|
|
2
2
|
export default {
|
|
3
3
|
title: 'Components/Switch',
|
|
4
4
|
component: PsSwitch,
|
|
5
5
|
argTypes: {
|
|
6
6
|
size: { control: { type: 'select', options: sizes } }
|
|
7
7
|
},
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
|
|
10
10
|
const Template = (args, { argTypes }) => ({
|
|
11
11
|
props: Object.keys(argTypes),
|
|
@@ -17,22 +17,22 @@ const Template = (args, { argTypes }) => ({
|
|
|
17
17
|
},
|
|
18
18
|
template: `
|
|
19
19
|
<div>
|
|
20
|
-
<PsSwitch v-bind="$props"
|
|
20
|
+
<PsSwitch v-bind="$props" v-model="model" />
|
|
21
|
+
<p>{{ model }}</p>
|
|
21
22
|
</div>
|
|
22
23
|
`
|
|
23
|
-
})
|
|
24
|
+
})
|
|
24
25
|
|
|
25
|
-
export const Big = Template.bind({})
|
|
26
|
+
export const Big = Template.bind({})
|
|
26
27
|
Big.args = {
|
|
27
28
|
size: 'big',
|
|
28
|
-
active: true,
|
|
29
29
|
label: 'Switch Big',
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
export const Small = Template.bind({})
|
|
32
|
+
export const Small = Template.bind({})
|
|
33
33
|
Small.args = {
|
|
34
34
|
size: 'small',
|
|
35
|
-
active: true,
|
|
36
35
|
label: 'Switch Small',
|
|
37
|
-
|
|
36
|
+
small: true
|
|
37
|
+
}
|
|
38
38
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import PsTabHeader from '../components/tabs/PsTabHeader.vue'
|
|
1
|
+
import PsTabHeader from '../components/tabs/PsTabHeader.vue'
|
|
2
2
|
const items = ['Existing Buildings', 'New Constructions', 'Other tab']
|
|
3
3
|
const item = items[0]
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
title: 'Components/Tab Header',
|
|
7
7
|
component: PsTabHeader,
|
|
8
8
|
argTypes: {}
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
const Template = (args, { argTypes }) => ({
|
|
11
11
|
props: Object.keys(argTypes),
|
|
12
12
|
components: { PsTabHeader },
|
|
@@ -28,25 +28,25 @@ const Template = (args, { argTypes }) => ({
|
|
|
28
28
|
</div>
|
|
29
29
|
</div>
|
|
30
30
|
`
|
|
31
|
-
})
|
|
31
|
+
})
|
|
32
32
|
|
|
33
|
-
export const Standard = Template.bind({})
|
|
33
|
+
export const Standard = Template.bind({})
|
|
34
34
|
Standard.args = {
|
|
35
35
|
theme: 'standard',
|
|
36
36
|
items: items,
|
|
37
37
|
selected: item
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
|
|
40
|
-
export const Underline = Template.bind({})
|
|
40
|
+
export const Underline = Template.bind({})
|
|
41
41
|
Underline.args = {
|
|
42
42
|
theme: 'underline',
|
|
43
43
|
items: items,
|
|
44
44
|
selected: item
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
|
|
47
|
-
export const Folder = Template.bind({})
|
|
47
|
+
export const Folder = Template.bind({})
|
|
48
48
|
Folder.args = {
|
|
49
49
|
theme: 'folder',
|
|
50
50
|
items: items,
|
|
51
51
|
selected: item
|
|
52
|
-
}
|
|
52
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import PsToast, { typeOptions, fillOptions } from '../components/notifications/PsToast.vue'
|
|
1
|
+
import PsToast, { typeOptions, fillOptions } from '../components/notifications/PsToast.vue'
|
|
2
2
|
export default {
|
|
3
3
|
title: 'Components/Toast',
|
|
4
4
|
component: PsToast,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
type: { control: { type: 'select', options: typeOptions } },
|
|
7
7
|
fill: { control: { type: 'select', options: fillOptions } }
|
|
8
8
|
},
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
|
|
11
11
|
const Template = (args, { argTypes }) => ({
|
|
12
12
|
props: Object.keys(argTypes),
|
|
@@ -21,33 +21,33 @@ const Template = (args, { argTypes }) => ({
|
|
|
21
21
|
<template v-if="${'default' in args}" v-slot>${args.default}</template>
|
|
22
22
|
</PsToast>
|
|
23
23
|
`
|
|
24
|
-
})
|
|
24
|
+
})
|
|
25
25
|
|
|
26
|
-
export const Info = Template.bind({})
|
|
26
|
+
export const Info = Template.bind({})
|
|
27
27
|
Info.args = {
|
|
28
28
|
type: 'info',
|
|
29
29
|
message: 'This is an info alert',
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
export const Success = Template.bind({})
|
|
32
|
+
export const Success = Template.bind({})
|
|
33
33
|
Success.args = {
|
|
34
34
|
type: 'success',
|
|
35
35
|
message: 'This is a success alert',
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
|
|
38
|
-
export const Warning = Template.bind({})
|
|
38
|
+
export const Warning = Template.bind({})
|
|
39
39
|
Warning.args = {
|
|
40
40
|
type: 'warning',
|
|
41
41
|
message: 'This is a warning alert',
|
|
42
|
-
}
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
export const Error = Template.bind({})
|
|
44
|
+
export const Error = Template.bind({})
|
|
45
45
|
Error.args = {
|
|
46
46
|
type: 'error',
|
|
47
47
|
message: 'This is an error alert',
|
|
48
|
-
}
|
|
48
|
+
}
|
|
49
49
|
|
|
50
|
-
export const Actions = Template.bind({})
|
|
50
|
+
export const Actions = Template.bind({})
|
|
51
51
|
Actions.args = {
|
|
52
52
|
type: 'info',
|
|
53
53
|
message: 'This is an info alert with actions',
|
|
@@ -55,4 +55,4 @@ Actions.args = {
|
|
|
55
55
|
<span class="psui-cursor-pointer" @click="teste('Callback Action 1')">ACTION1</span>
|
|
56
56
|
<span class="psui-cursor-pointer" @click="teste('Callback Action 2')">ACTION2</span>
|
|
57
57
|
`
|
|
58
|
-
}
|
|
58
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import PsToggle from '../components/controls/PsToggle.vue'
|
|
1
|
+
import PsToggle from '../components/controls/PsToggle.vue'
|
|
2
2
|
export default {
|
|
3
3
|
title: 'Components/Toggle',
|
|
4
4
|
component: PsToggle,
|
|
5
5
|
argTypes: {},
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
const items = ['Option 1', 'Option 2', 'Option 3']
|
|
8
8
|
const selected = 'Option 2'
|
|
9
9
|
|
|
@@ -13,13 +13,13 @@ const Template = (args, { argTypes }) => ({
|
|
|
13
13
|
template: `
|
|
14
14
|
<PsToggle v-bind="$props" :selected.sync="selected" />
|
|
15
15
|
`
|
|
16
|
-
})
|
|
16
|
+
})
|
|
17
17
|
|
|
18
|
-
export const Default = Template.bind({})
|
|
18
|
+
export const Default = Template.bind({})
|
|
19
19
|
Default.args = {
|
|
20
20
|
items: items,
|
|
21
21
|
selected: selected
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import PsTooltip from '../components/tooltip/PsTooltip.vue'
|
|
2
|
+
import PsRichTooltip from '../components/tooltip/PsRichTooltip.vue'
|
|
3
|
+
import PsDialogTooltip,{ CSSCOLORS} from '../components/tooltip/PsDialogTooltip.vue'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Tooltip',
|
|
7
|
+
component: PsTooltip,
|
|
8
|
+
subcomponents: {PsRichTooltip, PsDialogTooltip}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const TemplateDialog = (args, {argTypes}) => ({
|
|
12
|
+
props: Object.keys(argTypes),
|
|
13
|
+
components: {PsDialogTooltip},
|
|
14
|
+
template: `
|
|
15
|
+
<div style='display: flex; justify-content: flex-end;'>
|
|
16
|
+
<PsDialogTooltip v-bind='$props'>
|
|
17
|
+
<p>Trigger</p>
|
|
18
|
+
</PsDialogTooltip>
|
|
19
|
+
<div>
|
|
20
|
+
`,
|
|
21
|
+
argTypes:{
|
|
22
|
+
type: { control : { type: 'select', options: CSSCOLORS}}
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const TemplateRich = (args,{argTypes})=>({
|
|
27
|
+
props: Object.keys(argTypes),
|
|
28
|
+
components: {PsRichTooltip},
|
|
29
|
+
template: `
|
|
30
|
+
<div style='display: flex; justify-content: flex-end;'>
|
|
31
|
+
<PsRichTooltip v-bind='$props'>
|
|
32
|
+
<p>Trigger</p>
|
|
33
|
+
</PsRichTooltip>
|
|
34
|
+
</div>
|
|
35
|
+
`
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const TemplateRight = (args,{argTypes})=>({
|
|
40
|
+
props: Object.keys(argTypes),
|
|
41
|
+
components: {PsTooltip},
|
|
42
|
+
template: `
|
|
43
|
+
<div style='display: flex; justify-content: flex-end;'>
|
|
44
|
+
<PsTooltip v-bind='$props'>
|
|
45
|
+
<template v-slot:trigger>
|
|
46
|
+
Trigger
|
|
47
|
+
</template>
|
|
48
|
+
</PsTooltip>
|
|
49
|
+
</div>
|
|
50
|
+
`
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const TemplateMiddle = (args, {argTypes})=> ({
|
|
54
|
+
props: Object.keys(argTypes),
|
|
55
|
+
components: {PsTooltip},
|
|
56
|
+
template: `
|
|
57
|
+
<div style='display: flex; justify-content: center;'>
|
|
58
|
+
<PsTooltip v-bind='$props'>
|
|
59
|
+
<template v-slot:trigger>
|
|
60
|
+
Trigger
|
|
61
|
+
</template>
|
|
62
|
+
</PsTooltip>
|
|
63
|
+
</div>
|
|
64
|
+
`
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const TemplateLeft = (args, {argTypes}) => ({
|
|
68
|
+
props: Object.keys(argTypes),
|
|
69
|
+
components: {PsTooltip},
|
|
70
|
+
template: `
|
|
71
|
+
<div style='display: flex; justify-content: flex-start;'>
|
|
72
|
+
<PsTooltip v-bind='$props'>
|
|
73
|
+
<template v-slot:trigger>
|
|
74
|
+
Trigger
|
|
75
|
+
</template>
|
|
76
|
+
</PsTooltip>
|
|
77
|
+
</div>
|
|
78
|
+
`
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
export const Dialog = TemplateDialog.bind({})
|
|
82
|
+
Dialog.args = {
|
|
83
|
+
text: 'Air seal all ductwork to a final duct leakage value of 10% of nominal airflow.',
|
|
84
|
+
title: 'Duct Sealing',
|
|
85
|
+
buttonText: 'More info',
|
|
86
|
+
cssClass: 'psui-w-32',
|
|
87
|
+
type: 'color'
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const Rich = TemplateRich.bind({})
|
|
91
|
+
Rich.args = {
|
|
92
|
+
type: 'red',
|
|
93
|
+
title: 'This is a test!!',
|
|
94
|
+
cssClass: 'psui-w-32'
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const RightSide = TemplateRight.bind({})
|
|
98
|
+
RightSide.args = {
|
|
99
|
+
title: 'This is a test!!!',
|
|
100
|
+
type: 'red',
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const Middle = TemplateMiddle.bind({})
|
|
104
|
+
Middle.args = {
|
|
105
|
+
title: 'This is a test!!!',
|
|
106
|
+
type: 'blue',
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const Left = TemplateLeft.bind({})
|
|
110
|
+
Left.args = {
|
|
111
|
+
title: 'This is a test!!!',
|
|
112
|
+
type: 'gray',
|
|
113
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export const randomString = (length) => {
|
|
2
|
-
var result = ''
|
|
3
|
-
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
4
|
-
var charactersLength = characters.length
|
|
2
|
+
var result = ''
|
|
3
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
|
4
|
+
var charactersLength = characters.length
|
|
5
5
|
for ( var i = 0; i < length; i++ ) {
|
|
6
|
-
result += characters.charAt(Math.floor(Math.random() * charactersLength))
|
|
6
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength))
|
|
7
7
|
}
|
|
8
|
-
return result
|
|
8
|
+
return result
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const getParentScrollableEl = (node) => {
|
|
12
12
|
|
|
13
13
|
if (node == null) {
|
|
14
|
-
return null
|
|
14
|
+
return null
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
if (node.scrollHeight > node.clientHeight) {
|
|
18
|
-
return node
|
|
18
|
+
return node
|
|
19
19
|
} else {
|
|
20
|
-
return getParentScrollableEl(node.parentNode)
|
|
20
|
+
return getParentScrollableEl(node.parentNode)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export default ({ imageUrl, onProgress = null, returnsBase64 = true }) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var xhr = new XMLHttpRequest()
|
|
4
|
+
var notifiedNotComputable = false
|
|
5
|
+
|
|
6
|
+
xhr.open('GET', imageUrl, true)
|
|
7
|
+
xhr.responseType = 'arraybuffer'
|
|
8
|
+
|
|
9
|
+
xhr.onprogress = (ev) => {
|
|
10
|
+
if (ev.lengthComputable) {
|
|
11
|
+
let progress = parseInt((ev.loaded / ev.total) * 100)
|
|
12
|
+
if(onProgress) onProgress(progress)
|
|
13
|
+
} else {
|
|
14
|
+
if (!notifiedNotComputable) {
|
|
15
|
+
notifiedNotComputable = true
|
|
16
|
+
if(onProgress) onProgress(-1)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
xhr.onloadend = () => {
|
|
22
|
+
const contentType = xhr.getResponseHeader("Content-Type")
|
|
23
|
+
if (!contentType.includes('image')) {
|
|
24
|
+
reject(xhr)
|
|
25
|
+
} else {
|
|
26
|
+
if (!notifiedNotComputable) {
|
|
27
|
+
if(onProgress) onProgress(100)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if(!returnsBase64) {
|
|
31
|
+
resolve()
|
|
32
|
+
} else {
|
|
33
|
+
var options = {}
|
|
34
|
+
var headers = xhr.getAllResponseHeaders()
|
|
35
|
+
var mime = headers.match(/^Content-Type\\:\s*(.*?)$/mi)
|
|
36
|
+
if (mime && mime[1]) options.type = mime[1]
|
|
37
|
+
var blob = new Blob([this.response], options)
|
|
38
|
+
resolve(window.URL.createObjectURL(blob))
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
xhr.onerror = () => {
|
|
44
|
+
console.log('asd')
|
|
45
|
+
reject()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
xhr.send()
|
|
49
|
+
})
|
|
50
|
+
}
|