@xenknight/framework7-vue 0.0.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.
- package/LICENSE +20 -0
- package/README.md +33 -0
- package/components/accordion-content.d.ts +46 -0
- package/components/accordion-content.js +22 -0
- package/components/accordion-item.d.ts +51 -0
- package/components/accordion-item.js +77 -0
- package/components/accordion-toggle.d.ts +46 -0
- package/components/accordion-toggle.js +22 -0
- package/components/accordion.d.ts +50 -0
- package/components/accordion.js +23 -0
- package/components/actions-button.d.ts +56 -0
- package/components/actions-button.js +58 -0
- package/components/actions-group.d.ts +46 -0
- package/components/actions-group.js +22 -0
- package/components/actions-label.d.ts +51 -0
- package/components/actions-label.js +36 -0
- package/components/actions.d.ts +109 -0
- package/components/actions.js +157 -0
- package/components/app.d.ts +310 -0
- package/components/app.js +267 -0
- package/components/area-chart.d.ts +88 -0
- package/components/area-chart.js +364 -0
- package/components/badge.d.ts +54 -0
- package/components/badge.js +29 -0
- package/components/block-footer.d.ts +46 -0
- package/components/block-footer.js +22 -0
- package/components/block-header.d.ts +46 -0
- package/components/block-header.js +22 -0
- package/components/block-title.d.ts +54 -0
- package/components/block-title.js +35 -0
- package/components/block.d.ts +163 -0
- package/components/block.js +123 -0
- package/components/breadcrumbs-collapsed.d.ts +19 -0
- package/components/breadcrumbs-collapsed.js +21 -0
- package/components/breadcrumbs-item.d.ts +22 -0
- package/components/breadcrumbs-item.js +24 -0
- package/components/breadcrumbs-separator.d.ts +19 -0
- package/components/breadcrumbs-separator.js +20 -0
- package/components/breadcrumbs.d.ts +19 -0
- package/components/breadcrumbs.js +20 -0
- package/components/button.d.ts +371 -0
- package/components/button.js +182 -0
- package/components/card-content.d.ts +51 -0
- package/components/card-content.js +28 -0
- package/components/card-footer.d.ts +46 -0
- package/components/card-footer.js +22 -0
- package/components/card-header.d.ts +46 -0
- package/components/card-header.js +22 -0
- package/components/card.d.ts +145 -0
- package/components/card.js +192 -0
- package/components/checkbox.d.ts +72 -0
- package/components/checkbox.js +70 -0
- package/components/chip.d.ts +107 -0
- package/components/chip.js +81 -0
- package/components/fab-backdrop.d.ts +46 -0
- package/components/fab-backdrop.js +22 -0
- package/components/fab-button.d.ts +67 -0
- package/components/fab-button.js +52 -0
- package/components/fab-buttons.d.ts +51 -0
- package/components/fab-buttons.js +26 -0
- package/components/fab.d.ts +76 -0
- package/components/fab.js +78 -0
- package/components/gauge.d.ts +91 -0
- package/components/gauge.js +151 -0
- package/components/icon.d.ts +78 -0
- package/components/icon.js +100 -0
- package/components/input.d.ts +226 -0
- package/components/input.js +409 -0
- package/components/link.d.ts +287 -0
- package/components/link.js +129 -0
- package/components/list-button.d.ts +239 -0
- package/components/list-button.js +71 -0
- package/components/list-group.d.ts +71 -0
- package/components/list-group.js +53 -0
- package/components/list-index.d.ts +81 -0
- package/components/list-index.js +96 -0
- package/components/list-input.d.ts +245 -0
- package/components/list-input.js +415 -0
- package/components/list-item.d.ts +370 -0
- package/components/list-item.js +451 -0
- package/components/list.d.ts +236 -0
- package/components/list.js +222 -0
- package/components/login-screen-title.d.ts +46 -0
- package/components/login-screen-title.js +22 -0
- package/components/login-screen.d.ts +61 -0
- package/components/login-screen.js +104 -0
- package/components/message.d.ts +116 -0
- package/components/message.js +169 -0
- package/components/messagebar-attachment.d.ts +56 -0
- package/components/messagebar-attachment.js +52 -0
- package/components/messagebar-attachments.d.ts +46 -0
- package/components/messagebar-attachments.js +22 -0
- package/components/messagebar-sheet-image.d.ts +55 -0
- package/components/messagebar-sheet-image.js +48 -0
- package/components/messagebar-sheet-item.d.ts +46 -0
- package/components/messagebar-sheet-item.js +22 -0
- package/components/messagebar-sheet.d.ts +46 -0
- package/components/messagebar-sheet.js +22 -0
- package/components/messagebar.d.ts +117 -0
- package/components/messagebar.js +193 -0
- package/components/messages-title.d.ts +46 -0
- package/components/messages-title.js +22 -0
- package/components/messages.d.ts +116 -0
- package/components/messages.js +134 -0
- package/components/nav-left.d.ts +68 -0
- package/components/nav-left.js +66 -0
- package/components/nav-right.d.ts +50 -0
- package/components/nav-right.js +25 -0
- package/components/nav-title-large.d.ts +46 -0
- package/components/nav-title-large.js +25 -0
- package/components/nav-title.d.ts +58 -0
- package/components/nav-title.js +31 -0
- package/components/navbar.d.ts +110 -0
- package/components/navbar.js +248 -0
- package/components/page-content.d.ts +113 -0
- package/components/page-content.js +147 -0
- package/components/page.d.ts +150 -0
- package/components/page.js +331 -0
- package/components/panel.d.ts +139 -0
- package/components/panel.js +198 -0
- package/components/photo-browser.d.ts +164 -0
- package/components/photo-browser.js +181 -0
- package/components/pie-chart.d.ts +37 -0
- package/components/pie-chart.js +172 -0
- package/components/popover.d.ts +101 -0
- package/components/popover.js +157 -0
- package/components/popup.d.ts +99 -0
- package/components/popup.js +161 -0
- package/components/preloader.d.ts +50 -0
- package/components/preloader.js +65 -0
- package/components/progressbar.d.ts +54 -0
- package/components/progressbar.js +44 -0
- package/components/radio.d.ts +68 -0
- package/components/radio.js +59 -0
- package/components/range.d.ts +141 -0
- package/components/range.js +139 -0
- package/components/routable-modals.d.ts +19 -0
- package/components/routable-modals.js +58 -0
- package/components/searchbar.d.ts +182 -0
- package/components/searchbar.js +285 -0
- package/components/segmented.d.ts +87 -0
- package/components/segmented.js +53 -0
- package/components/sheet.d.ts +132 -0
- package/components/sheet.js +213 -0
- package/components/skeleton-avatar.d.ts +6 -0
- package/components/skeleton-avatar.js +3 -0
- package/components/skeleton-block.d.ts +6 -0
- package/components/skeleton-block.js +3 -0
- package/components/skeleton-image.d.ts +6 -0
- package/components/skeleton-image.js +3 -0
- package/components/skeleton-text.d.ts +6 -0
- package/components/skeleton-text.js +3 -0
- package/components/stepper.d.ts +197 -0
- package/components/stepper.js +230 -0
- package/components/subnavbar.d.ts +59 -0
- package/components/subnavbar.js +40 -0
- package/components/swipeout-actions.d.ts +58 -0
- package/components/swipeout-actions.js +33 -0
- package/components/swipeout-button.d.ts +75 -0
- package/components/swipeout-button.js +48 -0
- package/components/tab.d.ts +51 -0
- package/components/tab.js +128 -0
- package/components/tabs.d.ts +63 -0
- package/components/tabs.js +59 -0
- package/components/text-editor.d.ts +95 -0
- package/components/text-editor.js +147 -0
- package/components/toggle.d.ts +80 -0
- package/components/toggle.js +89 -0
- package/components/toolbar.d.ts +108 -0
- package/components/toolbar.js +135 -0
- package/components/treeview-item.d.ts +265 -0
- package/components/treeview-item.js +140 -0
- package/components/treeview.d.ts +46 -0
- package/components/treeview.js +22 -0
- package/components/use-icon.d.ts +19 -0
- package/components/use-icon.js +27 -0
- package/components/view.d.ts +296 -0
- package/components/view.js +373 -0
- package/components/views.d.ts +50 -0
- package/components/views.js +25 -0
- package/framework7-vue-bundle.js +190 -0
- package/framework7-vue.d.ts +121 -0
- package/framework7-vue.js +108 -0
- package/package.json +65 -0
- package/shared/components-router.js +203 -0
- package/shared/f7.js +71 -0
- package/shared/get-router-initial-component.js +35 -0
- package/shared/mixins.js +233 -0
- package/shared/modal-state-classes.js +10 -0
- package/shared/plugin.js +37 -0
- package/shared/router-open-in.js +105 -0
- package/shared/use-icon.js +37 -0
- package/shared/use-route-props.js +18 -0
- package/shared/use-smart-select.js +24 -0
- package/shared/use-store.js +24 -0
- package/shared/use-tab.js +24 -0
- package/shared/use-theme.js +11 -0
- package/shared/use-tooltip.js +43 -0
- package/shared/utils.js +110 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
|
|
2
|
+
import { ComponentOptionsMixin, DefineComponent, PropType } from 'vue';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
declare const PhotoBrowser: DefineComponent<
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
params: {
|
|
9
|
+
type: ObjectConstructor;
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
photos: {
|
|
13
|
+
type: ArrayConstructor;
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
thumbs: {
|
|
17
|
+
type: ArrayConstructor;
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
view: {
|
|
21
|
+
type: StringConstructor | ObjectConstructor;
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
renderNavbar: {
|
|
25
|
+
type: FunctionConstructor;
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
renderToolbar: {
|
|
29
|
+
type: FunctionConstructor;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
renderCaption: {
|
|
33
|
+
type: FunctionConstructor;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
renderObject: {
|
|
37
|
+
type: FunctionConstructor;
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
renderLazyPhoto: {
|
|
41
|
+
type: FunctionConstructor;
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
renderPhoto: {
|
|
45
|
+
type: FunctionConstructor;
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
renderPage: {
|
|
49
|
+
type: FunctionConstructor;
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
renderPopup: {
|
|
53
|
+
type: FunctionConstructor;
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
renderStandalone: {
|
|
57
|
+
type: FunctionConstructor;
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
renderThumb: {
|
|
61
|
+
type: FunctionConstructor;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
init: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
exposition: {
|
|
70
|
+
type: BooleanConstructor;
|
|
71
|
+
default: boolean;
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
expositionHideCaptions: {
|
|
75
|
+
type: BooleanConstructor;
|
|
76
|
+
default: boolean;
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
type: {
|
|
80
|
+
type: StringConstructor;
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
navbar: {
|
|
84
|
+
type: BooleanConstructor;
|
|
85
|
+
default: boolean;
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
toolbar: {
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
default: boolean;
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
theme: {
|
|
94
|
+
type: StringConstructor;
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
captionsTheme: {
|
|
98
|
+
type: StringConstructor;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
iconsColor: {
|
|
102
|
+
type: StringConstructor;
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
swipeToClose: {
|
|
106
|
+
type: BooleanConstructor;
|
|
107
|
+
default: boolean;
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
pageBackLinkText: {
|
|
111
|
+
type: StringConstructor;
|
|
112
|
+
default: undefined;
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
popupCloseLinkIcon: {
|
|
116
|
+
type: BooleanConstructor;
|
|
117
|
+
default: undefined;
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
popupCloseLinkText: {
|
|
121
|
+
type: StringConstructor;
|
|
122
|
+
default: undefined;
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
navbarOfText: {
|
|
126
|
+
type: StringConstructor;
|
|
127
|
+
default: undefined;
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
navbarShowCount: {
|
|
131
|
+
type: BooleanConstructor;
|
|
132
|
+
default: undefined;
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
swiper: {
|
|
136
|
+
type: ObjectConstructor;
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
url: {
|
|
140
|
+
type: StringConstructor;
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
routableModals: {
|
|
144
|
+
type: BooleanConstructor;
|
|
145
|
+
default: boolean;
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
virtualSlides: {
|
|
149
|
+
type: BooleanConstructor;
|
|
150
|
+
default: boolean;
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
() => JSX.Element,
|
|
154
|
+
unknown,
|
|
155
|
+
{},
|
|
156
|
+
{},
|
|
157
|
+
ComponentOptionsMixin,
|
|
158
|
+
ComponentOptionsMixin,
|
|
159
|
+
("photobrowser:open" | "photobrowser:close" | "photobrowser:opened" | "photobrowser:closed" | "photobrowser:swipetoclose")[],
|
|
160
|
+
"photobrowser:open" | "photobrowser:close" | "photobrowser:opened" | "photobrowser:closed" | "photobrowser:swipetoclose"
|
|
161
|
+
>;
|
|
162
|
+
|
|
163
|
+
export default PhotoBrowser;
|
|
164
|
+
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { watch, onMounted, onBeforeUnmount } from 'vue';
|
|
2
|
+
import { extend } from '../shared/utils.js';
|
|
3
|
+
import { f7ready, f7 } from '../shared/f7.js';
|
|
4
|
+
export default {
|
|
5
|
+
name: 'f7-photo-browser',
|
|
6
|
+
props: {
|
|
7
|
+
init: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: true
|
|
10
|
+
},
|
|
11
|
+
params: Object,
|
|
12
|
+
photos: Array,
|
|
13
|
+
thumbs: Array,
|
|
14
|
+
exposition: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
},
|
|
18
|
+
expositionHideCaptions: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false
|
|
21
|
+
},
|
|
22
|
+
type: {
|
|
23
|
+
type: String
|
|
24
|
+
},
|
|
25
|
+
navbar: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
toolbar: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: true
|
|
32
|
+
},
|
|
33
|
+
theme: {
|
|
34
|
+
type: String
|
|
35
|
+
},
|
|
36
|
+
captionsTheme: {
|
|
37
|
+
type: String
|
|
38
|
+
},
|
|
39
|
+
iconsColor: {
|
|
40
|
+
type: String
|
|
41
|
+
},
|
|
42
|
+
swipeToClose: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: true
|
|
45
|
+
},
|
|
46
|
+
pageBackLinkText: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: undefined
|
|
49
|
+
},
|
|
50
|
+
popupCloseLinkIcon: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: undefined
|
|
53
|
+
},
|
|
54
|
+
popupCloseLinkText: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: undefined
|
|
57
|
+
},
|
|
58
|
+
navbarOfText: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: undefined
|
|
61
|
+
},
|
|
62
|
+
navbarShowCount: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: undefined
|
|
65
|
+
},
|
|
66
|
+
swiper: {
|
|
67
|
+
type: Object
|
|
68
|
+
},
|
|
69
|
+
url: {
|
|
70
|
+
type: String
|
|
71
|
+
},
|
|
72
|
+
routableModals: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: false
|
|
75
|
+
},
|
|
76
|
+
virtualSlides: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: true
|
|
79
|
+
},
|
|
80
|
+
view: [String, Object],
|
|
81
|
+
renderNavbar: Function,
|
|
82
|
+
renderToolbar: Function,
|
|
83
|
+
renderCaption: Function,
|
|
84
|
+
renderObject: Function,
|
|
85
|
+
renderLazyPhoto: Function,
|
|
86
|
+
renderPhoto: Function,
|
|
87
|
+
renderPage: Function,
|
|
88
|
+
renderPopup: Function,
|
|
89
|
+
renderStandalone: Function,
|
|
90
|
+
renderThumb: Function
|
|
91
|
+
},
|
|
92
|
+
emits: ['photobrowser:open', 'photobrowser:close', 'photobrowser:opened', 'photobrowser:closed', 'photobrowser:swipetoclose'],
|
|
93
|
+
setup(props, _ref) {
|
|
94
|
+
let {
|
|
95
|
+
emit
|
|
96
|
+
} = _ref;
|
|
97
|
+
let f7PhotoBrowser = null;
|
|
98
|
+
const open = index => {
|
|
99
|
+
return f7PhotoBrowser.open(index);
|
|
100
|
+
};
|
|
101
|
+
const close = () => {
|
|
102
|
+
return f7PhotoBrowser.close();
|
|
103
|
+
};
|
|
104
|
+
const expositionToggle = () => {
|
|
105
|
+
return f7PhotoBrowser.expositionToggle();
|
|
106
|
+
};
|
|
107
|
+
const expositionEnable = () => {
|
|
108
|
+
return f7PhotoBrowser.expositionEnable();
|
|
109
|
+
};
|
|
110
|
+
const expositionDisable = () => {
|
|
111
|
+
return f7PhotoBrowser.expositionDisable();
|
|
112
|
+
};
|
|
113
|
+
watch(() => props.photos, value => {
|
|
114
|
+
const pb = f7PhotoBrowser;
|
|
115
|
+
if (!pb) return;
|
|
116
|
+
pb.params.photos = value;
|
|
117
|
+
if (pb.opened && pb.swiper) {
|
|
118
|
+
pb.swiper.update();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
watch(() => props.thumbs, value => {
|
|
122
|
+
const pb = f7PhotoBrowser;
|
|
123
|
+
if (!pb) return;
|
|
124
|
+
pb.params.thumbs = value;
|
|
125
|
+
if (pb.opened && pb.thumbsSwiper) {
|
|
126
|
+
pb.thumbsSwiper.update();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
onMounted(() => {
|
|
130
|
+
if (!props.init) return;
|
|
131
|
+
f7ready(() => {
|
|
132
|
+
let paramsComputed;
|
|
133
|
+
if (typeof props.params !== 'undefined') {
|
|
134
|
+
paramsComputed = props.params;
|
|
135
|
+
} else {
|
|
136
|
+
paramsComputed = {
|
|
137
|
+
...props
|
|
138
|
+
};
|
|
139
|
+
delete paramsComputed.params;
|
|
140
|
+
}
|
|
141
|
+
Object.keys(paramsComputed).forEach(param => {
|
|
142
|
+
if (typeof paramsComputed[param] === 'undefined' || paramsComputed[param] === '') delete paramsComputed[param];
|
|
143
|
+
});
|
|
144
|
+
paramsComputed = extend({}, paramsComputed, {
|
|
145
|
+
on: {
|
|
146
|
+
open() {
|
|
147
|
+
emit('photobrowser:open');
|
|
148
|
+
},
|
|
149
|
+
close() {
|
|
150
|
+
emit('photobrowser:close');
|
|
151
|
+
},
|
|
152
|
+
opened() {
|
|
153
|
+
emit('photobrowser:opened');
|
|
154
|
+
},
|
|
155
|
+
closed() {
|
|
156
|
+
emit('photobrowser:closed');
|
|
157
|
+
},
|
|
158
|
+
swipeToClose() {
|
|
159
|
+
emit('photobrowser:swipetoclose');
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
f7PhotoBrowser = f7.photoBrowser.create(paramsComputed);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
onBeforeUnmount(() => {
|
|
167
|
+
if (f7PhotoBrowser && f7PhotoBrowser.destroy) f7PhotoBrowser.destroy();
|
|
168
|
+
f7PhotoBrowser = null;
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
open,
|
|
172
|
+
close,
|
|
173
|
+
expositionToggle,
|
|
174
|
+
expositionEnable,
|
|
175
|
+
expositionDisable
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
render() {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
import { ComponentOptionsMixin, DefineComponent, PropType } from 'vue';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
declare const PieChart: DefineComponent<
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
tooltip: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
formatTooltip: {
|
|
13
|
+
type: FunctionConstructor;
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
size: {
|
|
17
|
+
type: NumberConstructor;
|
|
18
|
+
default: number;
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
datasets: {
|
|
22
|
+
type: ArrayConstructor;
|
|
23
|
+
default: () => [];
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
() => JSX.Element,
|
|
27
|
+
unknown,
|
|
28
|
+
{},
|
|
29
|
+
{},
|
|
30
|
+
ComponentOptionsMixin,
|
|
31
|
+
ComponentOptionsMixin,
|
|
32
|
+
("select")[],
|
|
33
|
+
"select"
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
export default PieChart;
|
|
37
|
+
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, renderSlot as _renderSlot } from "vue";
|
|
2
|
+
const _hoisted_1 = ["width", "height", "viewBox"];
|
|
3
|
+
const _hoisted_2 = ["d", "fill", "data-index", "onClick", "onMouseenter"];
|
|
4
|
+
function render(_ctx, _cache) {
|
|
5
|
+
return _openBlock(), _createElementBlock("div", {
|
|
6
|
+
ref: "elRef",
|
|
7
|
+
class: _normalizeClass(_ctx.classes)
|
|
8
|
+
}, [(_openBlock(), _createElementBlock("svg", {
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
width: _ctx.size,
|
|
11
|
+
height: _ctx.size,
|
|
12
|
+
viewBox: `-${_ctx.size / 3} -${_ctx.size / 3} ${_ctx.size * 2 / 3} ${_ctx.size * 2 / 3}`,
|
|
13
|
+
style: _normalizeStyle({
|
|
14
|
+
transform: 'rotate(-90deg)'
|
|
15
|
+
})
|
|
16
|
+
}, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.paths, (path, index) => {
|
|
17
|
+
return _openBlock(), _createElementBlock("path", {
|
|
18
|
+
key: path.label || index,
|
|
19
|
+
d: path.points,
|
|
20
|
+
fill: path.color,
|
|
21
|
+
"data-index": index,
|
|
22
|
+
class: _normalizeClass(_ctx.classNames({
|
|
23
|
+
'pie-chart-hidden': _ctx.currentIndex !== null && _ctx.currentIndex !== index
|
|
24
|
+
})),
|
|
25
|
+
onClick: $event => _ctx.setCurrentIndex(index),
|
|
26
|
+
onMouseenter: $event => _ctx.setCurrentIndex(index),
|
|
27
|
+
onMouseleave: _cache[0] || (_cache[0] = $event => _ctx.setCurrentIndex(null))
|
|
28
|
+
}, null, 42, _hoisted_2);
|
|
29
|
+
}), 128))], 12, _hoisted_1)), _renderSlot(_ctx.$slots, "default")], 2);
|
|
30
|
+
}
|
|
31
|
+
import { computed, onBeforeUnmount, ref, watch } from 'vue';
|
|
32
|
+
import { classNames } from '../shared/utils.js';
|
|
33
|
+
import { f7 } from '../shared/f7.js';
|
|
34
|
+
export default {
|
|
35
|
+
name: 'f7-pie-chart',
|
|
36
|
+
render,
|
|
37
|
+
props: {
|
|
38
|
+
size: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 320
|
|
41
|
+
},
|
|
42
|
+
tooltip: Boolean,
|
|
43
|
+
datasets: {
|
|
44
|
+
type: Array,
|
|
45
|
+
default: () => []
|
|
46
|
+
},
|
|
47
|
+
formatTooltip: Function
|
|
48
|
+
},
|
|
49
|
+
emits: ['select'],
|
|
50
|
+
setup(props, _ref) {
|
|
51
|
+
let {
|
|
52
|
+
emit
|
|
53
|
+
} = _ref;
|
|
54
|
+
const elRef = ref(null);
|
|
55
|
+
let f7Tooltip = null;
|
|
56
|
+
const currentIndex = ref(null);
|
|
57
|
+
const setCurrentIndex = index => {
|
|
58
|
+
currentIndex.value = index;
|
|
59
|
+
};
|
|
60
|
+
const summValue = computed(() => {
|
|
61
|
+
let summ = 0;
|
|
62
|
+
props.datasets.map(d => d.value || 0).forEach(value => {
|
|
63
|
+
summ += value;
|
|
64
|
+
});
|
|
65
|
+
return summ;
|
|
66
|
+
});
|
|
67
|
+
const paths = computed(() => {
|
|
68
|
+
const p = [];
|
|
69
|
+
let cumulativePercentage = 0;
|
|
70
|
+
function getCoordinatesForPercentage(percentage) {
|
|
71
|
+
const x = Math.cos(2 * Math.PI * percentage) * (props.size / 3);
|
|
72
|
+
const y = Math.sin(2 * Math.PI * percentage) * (props.size / 3);
|
|
73
|
+
return [x, y];
|
|
74
|
+
}
|
|
75
|
+
props.datasets.forEach(_ref2 => {
|
|
76
|
+
let {
|
|
77
|
+
value,
|
|
78
|
+
label,
|
|
79
|
+
color
|
|
80
|
+
} = _ref2;
|
|
81
|
+
const percentage = value / summValue.value;
|
|
82
|
+
const [startX, startY] = getCoordinatesForPercentage(cumulativePercentage);
|
|
83
|
+
cumulativePercentage += percentage;
|
|
84
|
+
const [endX, endY] = getCoordinatesForPercentage(cumulativePercentage);
|
|
85
|
+
const largeArcFlag = percentage > 0.5 ? 1 : 0;
|
|
86
|
+
const points = [`M ${startX} ${startY}`,
|
|
87
|
+
// Move
|
|
88
|
+
`A ${props.size / 3} ${props.size / 3} 0 ${largeArcFlag} 1 ${endX} ${endY}`,
|
|
89
|
+
// Arc
|
|
90
|
+
'L 0 0' // Line
|
|
91
|
+
].join(' ');
|
|
92
|
+
p.push({
|
|
93
|
+
points,
|
|
94
|
+
label,
|
|
95
|
+
color
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
return p;
|
|
99
|
+
});
|
|
100
|
+
const formatTooltipText = () => {
|
|
101
|
+
if (currentIndex.value === null) return '';
|
|
102
|
+
const {
|
|
103
|
+
value,
|
|
104
|
+
label,
|
|
105
|
+
color
|
|
106
|
+
} = props.datasets[currentIndex.value];
|
|
107
|
+
const percentage = value / summValue.value * 100;
|
|
108
|
+
const round = v => {
|
|
109
|
+
if (parseInt(v, 10) === v) return v;
|
|
110
|
+
return Math.round(v * 100) / 100;
|
|
111
|
+
};
|
|
112
|
+
if (props.formatTooltip) {
|
|
113
|
+
return props.formatTooltip({
|
|
114
|
+
index: currentIndex.value,
|
|
115
|
+
value,
|
|
116
|
+
label,
|
|
117
|
+
color,
|
|
118
|
+
percentage
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
const tooltipText = `${label ? `${label}: ` : ''}${round(value)} (${round(percentage)}%)`;
|
|
122
|
+
return `
|
|
123
|
+
<div class="pie-chart-tooltip-label">
|
|
124
|
+
<span class="pie-chart-tooltip-color" style="background-color: ${color};"></span> ${tooltipText}
|
|
125
|
+
</div>
|
|
126
|
+
`;
|
|
127
|
+
};
|
|
128
|
+
const setTooltip = () => {
|
|
129
|
+
const index = currentIndex.value;
|
|
130
|
+
if (index === null && !f7Tooltip) return;
|
|
131
|
+
if (!props.tooltip || !elRef.value || !f7) return;
|
|
132
|
+
if (index !== null && !f7Tooltip) {
|
|
133
|
+
f7Tooltip = f7.tooltip.create({
|
|
134
|
+
trigger: 'manual',
|
|
135
|
+
containerEl: elRef.value,
|
|
136
|
+
targetEl: elRef.value.querySelector(`path[data-index="${index}"]`),
|
|
137
|
+
text: formatTooltipText(),
|
|
138
|
+
cssClass: 'pie-chart-tooltip'
|
|
139
|
+
});
|
|
140
|
+
f7Tooltip.show();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (!f7Tooltip) return;
|
|
144
|
+
if (index !== null) {
|
|
145
|
+
f7Tooltip.setText(formatTooltipText());
|
|
146
|
+
f7Tooltip.setTargetEl(elRef.value.querySelector(`path[data-index="${index}"]`));
|
|
147
|
+
f7Tooltip.show();
|
|
148
|
+
} else {
|
|
149
|
+
f7Tooltip.hide();
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
watch(() => currentIndex.value, () => {
|
|
153
|
+
emit('select', currentIndex.value, props.datasets[currentIndex.value]);
|
|
154
|
+
setTooltip();
|
|
155
|
+
});
|
|
156
|
+
onBeforeUnmount(() => {
|
|
157
|
+
if (f7Tooltip && f7Tooltip.destroy) {
|
|
158
|
+
f7Tooltip.destroy();
|
|
159
|
+
}
|
|
160
|
+
f7Tooltip = null;
|
|
161
|
+
});
|
|
162
|
+
const classes = computed(() => classNames('pie-chart'));
|
|
163
|
+
return {
|
|
164
|
+
elRef,
|
|
165
|
+
currentIndex,
|
|
166
|
+
classes,
|
|
167
|
+
paths,
|
|
168
|
+
classNames,
|
|
169
|
+
setCurrentIndex
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
|
|
2
|
+
import { ComponentOptionsMixin, DefineComponent, PropType } from 'vue';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
declare const Popover: DefineComponent<
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
opened: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
animate: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: undefined;
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
targetEl: {
|
|
18
|
+
type: StringConstructor | ObjectConstructor;
|
|
19
|
+
default: undefined;
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
arrow: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: undefined;
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
backdrop: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: undefined;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
backdropEl: {
|
|
33
|
+
type: StringConstructor | ObjectConstructor;
|
|
34
|
+
default: undefined;
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
closeByBackdropClick: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
default: undefined;
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
closeByOutsideClick: {
|
|
43
|
+
type: BooleanConstructor;
|
|
44
|
+
default: undefined;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
closeOnEscape: {
|
|
48
|
+
type: BooleanConstructor;
|
|
49
|
+
default: undefined;
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
containerEl: {
|
|
53
|
+
type: StringConstructor | ObjectConstructor;
|
|
54
|
+
default: undefined;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
verticalPosition: {
|
|
58
|
+
type: StringConstructor;
|
|
59
|
+
default: undefined;
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
color: {
|
|
63
|
+
type: StringConstructor;
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
colorTheme: {
|
|
67
|
+
type: StringConstructor;
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
textColor: {
|
|
71
|
+
type: StringConstructor;
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
bgColor: {
|
|
75
|
+
type: StringConstructor;
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
borderColor: {
|
|
79
|
+
type: StringConstructor;
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
rippleColor: {
|
|
83
|
+
type: StringConstructor;
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
dark: {
|
|
87
|
+
type: BooleanConstructor;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
() => JSX.Element,
|
|
91
|
+
unknown,
|
|
92
|
+
{},
|
|
93
|
+
{},
|
|
94
|
+
ComponentOptionsMixin,
|
|
95
|
+
ComponentOptionsMixin,
|
|
96
|
+
("popover:open" | "popover:opened" | "popover:close" | "popover:closed" | "update:opened")[],
|
|
97
|
+
"popover:open" | "popover:opened" | "popover:close" | "popover:closed" | "update:opened"
|
|
98
|
+
>;
|
|
99
|
+
|
|
100
|
+
export default Popover;
|
|
101
|
+
|