@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.
Files changed (199) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +33 -0
  3. package/components/accordion-content.d.ts +46 -0
  4. package/components/accordion-content.js +22 -0
  5. package/components/accordion-item.d.ts +51 -0
  6. package/components/accordion-item.js +77 -0
  7. package/components/accordion-toggle.d.ts +46 -0
  8. package/components/accordion-toggle.js +22 -0
  9. package/components/accordion.d.ts +50 -0
  10. package/components/accordion.js +23 -0
  11. package/components/actions-button.d.ts +56 -0
  12. package/components/actions-button.js +58 -0
  13. package/components/actions-group.d.ts +46 -0
  14. package/components/actions-group.js +22 -0
  15. package/components/actions-label.d.ts +51 -0
  16. package/components/actions-label.js +36 -0
  17. package/components/actions.d.ts +109 -0
  18. package/components/actions.js +157 -0
  19. package/components/app.d.ts +310 -0
  20. package/components/app.js +267 -0
  21. package/components/area-chart.d.ts +88 -0
  22. package/components/area-chart.js +364 -0
  23. package/components/badge.d.ts +54 -0
  24. package/components/badge.js +29 -0
  25. package/components/block-footer.d.ts +46 -0
  26. package/components/block-footer.js +22 -0
  27. package/components/block-header.d.ts +46 -0
  28. package/components/block-header.js +22 -0
  29. package/components/block-title.d.ts +54 -0
  30. package/components/block-title.js +35 -0
  31. package/components/block.d.ts +163 -0
  32. package/components/block.js +123 -0
  33. package/components/breadcrumbs-collapsed.d.ts +19 -0
  34. package/components/breadcrumbs-collapsed.js +21 -0
  35. package/components/breadcrumbs-item.d.ts +22 -0
  36. package/components/breadcrumbs-item.js +24 -0
  37. package/components/breadcrumbs-separator.d.ts +19 -0
  38. package/components/breadcrumbs-separator.js +20 -0
  39. package/components/breadcrumbs.d.ts +19 -0
  40. package/components/breadcrumbs.js +20 -0
  41. package/components/button.d.ts +371 -0
  42. package/components/button.js +182 -0
  43. package/components/card-content.d.ts +51 -0
  44. package/components/card-content.js +28 -0
  45. package/components/card-footer.d.ts +46 -0
  46. package/components/card-footer.js +22 -0
  47. package/components/card-header.d.ts +46 -0
  48. package/components/card-header.js +22 -0
  49. package/components/card.d.ts +145 -0
  50. package/components/card.js +192 -0
  51. package/components/checkbox.d.ts +72 -0
  52. package/components/checkbox.js +70 -0
  53. package/components/chip.d.ts +107 -0
  54. package/components/chip.js +81 -0
  55. package/components/fab-backdrop.d.ts +46 -0
  56. package/components/fab-backdrop.js +22 -0
  57. package/components/fab-button.d.ts +67 -0
  58. package/components/fab-button.js +52 -0
  59. package/components/fab-buttons.d.ts +51 -0
  60. package/components/fab-buttons.js +26 -0
  61. package/components/fab.d.ts +76 -0
  62. package/components/fab.js +78 -0
  63. package/components/gauge.d.ts +91 -0
  64. package/components/gauge.js +151 -0
  65. package/components/icon.d.ts +78 -0
  66. package/components/icon.js +100 -0
  67. package/components/input.d.ts +226 -0
  68. package/components/input.js +409 -0
  69. package/components/link.d.ts +287 -0
  70. package/components/link.js +129 -0
  71. package/components/list-button.d.ts +239 -0
  72. package/components/list-button.js +71 -0
  73. package/components/list-group.d.ts +71 -0
  74. package/components/list-group.js +53 -0
  75. package/components/list-index.d.ts +81 -0
  76. package/components/list-index.js +96 -0
  77. package/components/list-input.d.ts +245 -0
  78. package/components/list-input.js +415 -0
  79. package/components/list-item.d.ts +370 -0
  80. package/components/list-item.js +451 -0
  81. package/components/list.d.ts +236 -0
  82. package/components/list.js +222 -0
  83. package/components/login-screen-title.d.ts +46 -0
  84. package/components/login-screen-title.js +22 -0
  85. package/components/login-screen.d.ts +61 -0
  86. package/components/login-screen.js +104 -0
  87. package/components/message.d.ts +116 -0
  88. package/components/message.js +169 -0
  89. package/components/messagebar-attachment.d.ts +56 -0
  90. package/components/messagebar-attachment.js +52 -0
  91. package/components/messagebar-attachments.d.ts +46 -0
  92. package/components/messagebar-attachments.js +22 -0
  93. package/components/messagebar-sheet-image.d.ts +55 -0
  94. package/components/messagebar-sheet-image.js +48 -0
  95. package/components/messagebar-sheet-item.d.ts +46 -0
  96. package/components/messagebar-sheet-item.js +22 -0
  97. package/components/messagebar-sheet.d.ts +46 -0
  98. package/components/messagebar-sheet.js +22 -0
  99. package/components/messagebar.d.ts +117 -0
  100. package/components/messagebar.js +193 -0
  101. package/components/messages-title.d.ts +46 -0
  102. package/components/messages-title.js +22 -0
  103. package/components/messages.d.ts +116 -0
  104. package/components/messages.js +134 -0
  105. package/components/nav-left.d.ts +68 -0
  106. package/components/nav-left.js +66 -0
  107. package/components/nav-right.d.ts +50 -0
  108. package/components/nav-right.js +25 -0
  109. package/components/nav-title-large.d.ts +46 -0
  110. package/components/nav-title-large.js +25 -0
  111. package/components/nav-title.d.ts +58 -0
  112. package/components/nav-title.js +31 -0
  113. package/components/navbar.d.ts +110 -0
  114. package/components/navbar.js +248 -0
  115. package/components/page-content.d.ts +113 -0
  116. package/components/page-content.js +147 -0
  117. package/components/page.d.ts +150 -0
  118. package/components/page.js +331 -0
  119. package/components/panel.d.ts +139 -0
  120. package/components/panel.js +198 -0
  121. package/components/photo-browser.d.ts +164 -0
  122. package/components/photo-browser.js +181 -0
  123. package/components/pie-chart.d.ts +37 -0
  124. package/components/pie-chart.js +172 -0
  125. package/components/popover.d.ts +101 -0
  126. package/components/popover.js +157 -0
  127. package/components/popup.d.ts +99 -0
  128. package/components/popup.js +161 -0
  129. package/components/preloader.d.ts +50 -0
  130. package/components/preloader.js +65 -0
  131. package/components/progressbar.d.ts +54 -0
  132. package/components/progressbar.js +44 -0
  133. package/components/radio.d.ts +68 -0
  134. package/components/radio.js +59 -0
  135. package/components/range.d.ts +141 -0
  136. package/components/range.js +139 -0
  137. package/components/routable-modals.d.ts +19 -0
  138. package/components/routable-modals.js +58 -0
  139. package/components/searchbar.d.ts +182 -0
  140. package/components/searchbar.js +285 -0
  141. package/components/segmented.d.ts +87 -0
  142. package/components/segmented.js +53 -0
  143. package/components/sheet.d.ts +132 -0
  144. package/components/sheet.js +213 -0
  145. package/components/skeleton-avatar.d.ts +6 -0
  146. package/components/skeleton-avatar.js +3 -0
  147. package/components/skeleton-block.d.ts +6 -0
  148. package/components/skeleton-block.js +3 -0
  149. package/components/skeleton-image.d.ts +6 -0
  150. package/components/skeleton-image.js +3 -0
  151. package/components/skeleton-text.d.ts +6 -0
  152. package/components/skeleton-text.js +3 -0
  153. package/components/stepper.d.ts +197 -0
  154. package/components/stepper.js +230 -0
  155. package/components/subnavbar.d.ts +59 -0
  156. package/components/subnavbar.js +40 -0
  157. package/components/swipeout-actions.d.ts +58 -0
  158. package/components/swipeout-actions.js +33 -0
  159. package/components/swipeout-button.d.ts +75 -0
  160. package/components/swipeout-button.js +48 -0
  161. package/components/tab.d.ts +51 -0
  162. package/components/tab.js +128 -0
  163. package/components/tabs.d.ts +63 -0
  164. package/components/tabs.js +59 -0
  165. package/components/text-editor.d.ts +95 -0
  166. package/components/text-editor.js +147 -0
  167. package/components/toggle.d.ts +80 -0
  168. package/components/toggle.js +89 -0
  169. package/components/toolbar.d.ts +108 -0
  170. package/components/toolbar.js +135 -0
  171. package/components/treeview-item.d.ts +265 -0
  172. package/components/treeview-item.js +140 -0
  173. package/components/treeview.d.ts +46 -0
  174. package/components/treeview.js +22 -0
  175. package/components/use-icon.d.ts +19 -0
  176. package/components/use-icon.js +27 -0
  177. package/components/view.d.ts +296 -0
  178. package/components/view.js +373 -0
  179. package/components/views.d.ts +50 -0
  180. package/components/views.js +25 -0
  181. package/framework7-vue-bundle.js +190 -0
  182. package/framework7-vue.d.ts +121 -0
  183. package/framework7-vue.js +108 -0
  184. package/package.json +65 -0
  185. package/shared/components-router.js +203 -0
  186. package/shared/f7.js +71 -0
  187. package/shared/get-router-initial-component.js +35 -0
  188. package/shared/mixins.js +233 -0
  189. package/shared/modal-state-classes.js +10 -0
  190. package/shared/plugin.js +37 -0
  191. package/shared/router-open-in.js +105 -0
  192. package/shared/use-icon.js +37 -0
  193. package/shared/use-route-props.js +18 -0
  194. package/shared/use-smart-select.js +24 -0
  195. package/shared/use-store.js +24 -0
  196. package/shared/use-tab.js +24 -0
  197. package/shared/use-theme.js +11 -0
  198. package/shared/use-tooltip.js +43 -0
  199. 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
+