framework7-react 7.0.9 → 8.0.0-beta.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/components/accordion-content.js +2 -2
- package/components/accordion-item.js +2 -11
- package/components/accordion-toggle.js +2 -2
- package/components/accordion.js +2 -2
- package/components/actions-button.d.ts +1 -1
- package/components/actions-button.js +4 -8
- package/components/actions-group.js +2 -2
- package/components/actions-label.js +4 -6
- package/components/actions.js +4 -14
- package/components/app.js +4 -8
- package/components/area-chart.js +6 -45
- package/components/badge.js +2 -2
- package/components/block-footer.js +2 -2
- package/components/block-header.js +2 -2
- package/components/block-title.js +2 -2
- package/components/block.d.ts +17 -4
- package/components/block.js +37 -11
- package/components/breadcrumbs-collapsed.js +2 -4
- package/components/breadcrumbs-item.js +2 -4
- package/components/breadcrumbs-separator.js +2 -2
- package/components/breadcrumbs.js +2 -2
- package/components/button.d.ts +3 -7
- package/components/button.js +8 -24
- package/components/card-content.js +2 -2
- package/components/card-footer.js +2 -2
- package/components/card-header.js +2 -2
- package/components/card.d.ts +5 -2
- package/components/card.js +14 -23
- package/components/checkbox.js +2 -4
- package/components/chip.d.ts +0 -1
- package/components/chip.js +2 -9
- package/components/fab-backdrop.js +2 -2
- package/components/fab-button.js +2 -6
- package/components/fab-buttons.js +2 -2
- package/components/fab.js +2 -10
- package/components/gauge.js +2 -2
- package/components/icon.d.ts +0 -1
- package/components/icon.js +3 -17
- package/components/input.js +1 -57
- package/components/link.d.ts +0 -1
- package/components/link.js +5 -12
- package/components/list-button.js +2 -4
- package/components/list-group.js +2 -2
- package/components/list-index.d.ts +0 -1
- package/components/list-index.js +3 -13
- package/components/list-input.d.ts +0 -1
- package/components/list-input.js +1 -55
- package/components/list-item-content.js +6 -20
- package/components/list-item.d.ts +0 -1
- package/components/list-item.js +5 -35
- package/components/list.d.ts +21 -9
- package/components/list.js +43 -37
- package/components/login-screen-title.js +2 -2
- package/components/login-screen.js +3 -15
- package/components/message.js +2 -10
- package/components/messagebar-attachment.js +2 -5
- package/components/messagebar-attachments.js +2 -2
- package/components/messagebar-sheet-image.js +4 -5
- package/components/messagebar-sheet-item.js +2 -2
- package/components/messagebar-sheet.js +2 -2
- package/components/messagebar.js +1 -19
- package/components/messages-title.js +2 -2
- package/components/messages.js +2 -15
- package/components/nav-left.js +2 -6
- package/components/nav-right.js +2 -2
- package/components/nav-title-large.js +2 -2
- package/components/nav-title.js +2 -4
- package/components/navbar.d.ts +1 -2
- package/components/navbar.js +5 -31
- package/components/page-content.js +2 -16
- package/components/page.d.ts +0 -1
- package/components/page.js +4 -62
- package/components/panel.d.ts +1 -0
- package/components/panel.js +6 -26
- package/components/photo-browser.js +1 -17
- package/components/pie-chart.js +6 -18
- package/components/popover.d.ts +1 -0
- package/components/popover.js +4 -14
- package/components/popup.js +3 -19
- package/components/preloader.js +5 -14
- package/components/progressbar.js +2 -4
- package/components/radio.js +2 -4
- package/components/range.js +2 -9
- package/components/routable-modals.js +2 -7
- package/components/searchbar.d.ts +1 -2
- package/components/searchbar.js +5 -30
- package/components/segmented.d.ts +0 -3
- package/components/segmented.js +4 -10
- package/components/sheet.js +2 -22
- package/components/stepper.d.ts +0 -5
- package/components/stepper.js +3 -33
- package/components/subnavbar.js +2 -2
- package/components/swipeout-actions.js +2 -4
- package/components/swipeout-button.js +2 -4
- package/components/swiper-slide.d.ts +1 -0
- package/components/swiper-slide.js +1 -0
- package/components/swiper.d.ts +1 -0
- package/components/swiper.js +1 -0
- package/components/tab.js +4 -15
- package/components/tabs.js +1 -4
- package/components/text-editor.js +1 -18
- package/components/toggle.js +1 -13
- package/components/toolbar.d.ts +2 -6
- package/components/toolbar.js +9 -20
- package/components/treeview-item.d.ts +0 -1
- package/components/treeview-item.js +2 -11
- package/components/treeview.js +2 -2
- package/components/view.d.ts +0 -6
- package/components/view.js +3 -30
- package/components/views.js +2 -2
- package/framework7-react.d.ts +2 -12
- package/framework7-react.js +3 -12
- package/package.json +1 -1
- package/shared/components-router.js +0 -32
- package/shared/f7.js +5 -19
- package/shared/get-router-initial-component.js +0 -4
- package/shared/mixins.js +2 -8
- package/shared/plugin.js +2 -8
- package/shared/router-open-in.js +4 -15
- package/shared/tabbar-context.js +1 -1
- package/shared/use-icon.js +1 -6
- package/shared/use-isomorphic-layout-effect.js +0 -2
- package/shared/use-route-props.js +0 -1
- package/shared/use-smart-select.js +0 -3
- package/shared/use-store.js +4 -8
- package/shared/use-tab.js +0 -4
- package/shared/use-theme.js +0 -2
- package/shared/use-tooltip.js +0 -5
- package/shared/utils.js +0 -18
- package/shared/watch-prop.js +0 -1
- package/components/appbar.d.ts +0 -28
- package/components/appbar.js +0 -45
- package/components/col.d.ts +0 -36
- package/components/col.js +0 -75
- package/components/list-item-cell.d.ts +0 -23
- package/components/list-item-cell.js +0 -28
- package/components/list-item-row.d.ts +0 -23
- package/components/list-item-row.js +0 -28
- package/components/menu-dropdown-item.d.ts +0 -68
- package/components/menu-dropdown-item.js +0 -59
- package/components/menu-dropdown.d.ts +0 -28
- package/components/menu-dropdown.js +0 -42
- package/components/menu-item.d.ts +0 -81
- package/components/menu-item.js +0 -101
- package/components/menu.d.ts +0 -23
- package/components/menu.js +0 -30
- package/components/row.d.ts +0 -31
- package/components/row.js +0 -64
package/components/page.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
|
|
5
4
|
import { classNames, getExtraAttrs, getSlots, emit } from '../shared/utils.js';
|
|
@@ -7,13 +6,13 @@ import { colorClasses } from '../shared/mixins.js';
|
|
|
7
6
|
import { f7ready, f7 } from '../shared/f7.js';
|
|
8
7
|
import PageContent from './page-content.js';
|
|
9
8
|
|
|
9
|
+
|
|
10
10
|
const Page = /*#__PURE__*/forwardRef((props, ref) => {
|
|
11
11
|
const {
|
|
12
12
|
className,
|
|
13
13
|
id,
|
|
14
14
|
style,
|
|
15
15
|
name,
|
|
16
|
-
stacked,
|
|
17
16
|
withSubnavbar,
|
|
18
17
|
subnavbar,
|
|
19
18
|
withNavbarLarge,
|
|
@@ -49,158 +48,118 @@ const Page = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
49
48
|
const hasNavbarLargeCollapsed = useRef(false);
|
|
50
49
|
const hasCardExpandableOpened = useRef(false);
|
|
51
50
|
const routerPositionClass = useRef('');
|
|
52
|
-
const routerForceUnstack = useRef(false);
|
|
53
51
|
const routerPageRole = useRef(null);
|
|
54
52
|
const routerPageRoleDetailRoot = useRef(false);
|
|
55
53
|
const routerPageMasterStack = useRef(false);
|
|
56
54
|
const extraAttrs = getExtraAttrs(props);
|
|
57
|
-
const elRef = useRef(null);
|
|
55
|
+
const elRef = useRef(null);
|
|
58
56
|
|
|
57
|
+
// Main Page Events
|
|
59
58
|
const onPageMounted = page => {
|
|
60
59
|
if (elRef.current !== page.el) return;
|
|
61
60
|
emit(props, 'pageMounted', page);
|
|
62
61
|
};
|
|
63
|
-
|
|
64
62
|
const onPageInit = page => {
|
|
65
63
|
if (elRef.current !== page.el) return;
|
|
66
|
-
|
|
67
64
|
if (typeof withSubnavbar === 'undefined' && typeof subnavbar === 'undefined') {
|
|
68
65
|
if (page.$navbarEl && page.$navbarEl.length && page.$navbarEl.find('.subnavbar').length || page.$el.children('.navbar').find('.subnavbar').length) {
|
|
69
66
|
hasSubnavbar.current = true;
|
|
70
67
|
}
|
|
71
68
|
}
|
|
72
|
-
|
|
73
69
|
if (typeof withNavbarLarge === 'undefined' && typeof navbarLarge === 'undefined') {
|
|
74
70
|
if (page.$navbarEl && page.$navbarEl.hasClass('navbar-large')) {
|
|
75
71
|
hasNavbarLarge.current = true;
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
|
-
|
|
79
74
|
emit(props, 'pageInit', page);
|
|
80
75
|
};
|
|
81
|
-
|
|
82
76
|
const onPageReinit = page => {
|
|
83
77
|
if (elRef.current !== page.el) return;
|
|
84
78
|
emit(props, 'pageReinit', page);
|
|
85
79
|
};
|
|
86
|
-
|
|
87
80
|
const onPageBeforeIn = page => {
|
|
88
81
|
if (elRef.current !== page.el) return;
|
|
89
|
-
|
|
90
82
|
if (!page.swipeBack) {
|
|
91
83
|
if (page.from === 'next') {
|
|
92
84
|
routerPositionClass.current = 'page-next';
|
|
93
85
|
}
|
|
94
|
-
|
|
95
86
|
if (page.from === 'previous') {
|
|
96
87
|
routerPositionClass.current = 'page-previous';
|
|
97
88
|
}
|
|
98
89
|
}
|
|
99
|
-
|
|
100
90
|
emit(props, 'pageBeforeIn', page);
|
|
101
91
|
};
|
|
102
|
-
|
|
103
92
|
const onPageBeforeOut = page => {
|
|
104
93
|
if (elRef.current !== page.el) return;
|
|
105
94
|
emit(props, 'pageBeforeOut', page);
|
|
106
95
|
};
|
|
107
|
-
|
|
108
96
|
const onPageAfterOut = page => {
|
|
109
97
|
if (elRef.current !== page.el) return;
|
|
110
|
-
|
|
111
98
|
if (page.to === 'next') {
|
|
112
99
|
routerPositionClass.current = 'page-next';
|
|
113
100
|
}
|
|
114
|
-
|
|
115
101
|
if (page.to === 'previous') {
|
|
116
102
|
routerPositionClass.current = 'page-previous';
|
|
117
103
|
}
|
|
118
|
-
|
|
119
104
|
emit(props, 'pageAfterOut', page);
|
|
120
105
|
};
|
|
121
|
-
|
|
122
106
|
const onPageAfterIn = page => {
|
|
123
107
|
if (elRef.current !== page.el) return;
|
|
124
108
|
routerPositionClass.current = 'page-current';
|
|
125
109
|
emit(props, 'pageAfterIn', page);
|
|
126
110
|
};
|
|
127
|
-
|
|
128
111
|
const onPageBeforeRemove = page => {
|
|
129
112
|
if (elRef.current !== page.el) return;
|
|
130
113
|
emit(props, 'pageBeforeRemove', page);
|
|
131
114
|
};
|
|
132
|
-
|
|
133
115
|
const onPageBeforeUnmount = page => {
|
|
134
116
|
if (elRef.current !== page.el) return;
|
|
135
117
|
emit(props, 'pageBeforeUnmount', page);
|
|
136
|
-
}; // Helper events
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const onPageStack = pageEl => {
|
|
140
|
-
if (elRef.current !== pageEl) return;
|
|
141
|
-
routerForceUnstack.current = false;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const onPageUnstack = pageEl => {
|
|
145
|
-
if (elRef.current !== pageEl) return;
|
|
146
|
-
routerForceUnstack.current = true;
|
|
147
118
|
};
|
|
148
|
-
|
|
149
119
|
const onPagePosition = (pageEl, position) => {
|
|
150
120
|
if (elRef.current !== pageEl) return;
|
|
151
121
|
routerPositionClass.current = `page-${position}`;
|
|
152
122
|
};
|
|
153
|
-
|
|
154
123
|
const onPageRole = (pageEl, rolesData) => {
|
|
155
124
|
if (elRef.current !== pageEl) return;
|
|
156
125
|
routerPageRole.current = rolesData.role;
|
|
157
126
|
routerPageRoleDetailRoot.current = rolesData.detailRoot;
|
|
158
127
|
};
|
|
159
|
-
|
|
160
128
|
const onPageMasterStack = pageEl => {
|
|
161
129
|
if (elRef.current !== pageEl) return;
|
|
162
130
|
routerPageMasterStack.current = true;
|
|
163
131
|
};
|
|
164
|
-
|
|
165
132
|
const onPageMasterUnstack = pageEl => {
|
|
166
133
|
if (elRef.current !== pageEl) return;
|
|
167
134
|
routerPageMasterStack.current = false;
|
|
168
135
|
};
|
|
169
|
-
|
|
170
136
|
const onPageNavbarLargeCollapsed = pageEl => {
|
|
171
137
|
if (elRef.current !== pageEl) return;
|
|
172
138
|
hasNavbarLargeCollapsed.current = true;
|
|
173
139
|
};
|
|
174
|
-
|
|
175
140
|
const onPageNavbarLargeExpanded = pageEl => {
|
|
176
141
|
if (elRef.current !== pageEl) return;
|
|
177
142
|
hasNavbarLargeCollapsed.current = false;
|
|
178
143
|
};
|
|
179
|
-
|
|
180
144
|
const onCardOpened = (cardEl, pageEl) => {
|
|
181
145
|
if (elRef.current !== pageEl) return;
|
|
182
146
|
hasCardExpandableOpened.current = true;
|
|
183
147
|
};
|
|
184
|
-
|
|
185
148
|
const onCardClose = (cardEl, pageEl) => {
|
|
186
149
|
if (elRef.current !== pageEl) return;
|
|
187
150
|
hasCardExpandableOpened.current = false;
|
|
188
151
|
};
|
|
189
|
-
|
|
190
152
|
const onPageTabShow = pageEl => {
|
|
191
153
|
if (elRef.current !== pageEl) return;
|
|
192
154
|
emit(props, 'pageTabShow');
|
|
193
155
|
};
|
|
194
|
-
|
|
195
156
|
const onPageTabHide = pageEl => {
|
|
196
157
|
if (elRef.current !== pageEl) return;
|
|
197
158
|
emit(props, 'pageTabHide');
|
|
198
159
|
};
|
|
199
|
-
|
|
200
160
|
useImperativeHandle(ref, () => ({
|
|
201
161
|
el: elRef.current
|
|
202
162
|
}));
|
|
203
|
-
|
|
204
163
|
const attachEvents = () => {
|
|
205
164
|
f7ready(() => {
|
|
206
165
|
f7.on('pageMounted', onPageMounted);
|
|
@@ -212,8 +171,6 @@ const Page = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
212
171
|
f7.on('pageAfterIn', onPageAfterIn);
|
|
213
172
|
f7.on('pageBeforeRemove', onPageBeforeRemove);
|
|
214
173
|
f7.on('pageBeforeUnmount', onPageBeforeUnmount);
|
|
215
|
-
f7.on('pageStack', onPageStack);
|
|
216
|
-
f7.on('pageUnstack', onPageUnstack);
|
|
217
174
|
f7.on('pagePosition', onPagePosition);
|
|
218
175
|
f7.on('pageRole', onPageRole);
|
|
219
176
|
f7.on('pageMasterStack', onPageMasterStack);
|
|
@@ -226,7 +183,6 @@ const Page = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
226
183
|
f7.on('pageTabHide', onPageTabHide);
|
|
227
184
|
});
|
|
228
185
|
};
|
|
229
|
-
|
|
230
186
|
const detachEvents = () => {
|
|
231
187
|
if (!f7) return;
|
|
232
188
|
f7.off('pageMounted', onPageMounted);
|
|
@@ -238,8 +194,6 @@ const Page = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
238
194
|
f7.off('pageAfterIn', onPageAfterIn);
|
|
239
195
|
f7.off('pageBeforeRemove', onPageBeforeRemove);
|
|
240
196
|
f7.off('pageBeforeUnmount', onPageBeforeUnmount);
|
|
241
|
-
f7.off('pageStack', onPageStack);
|
|
242
|
-
f7.off('pageUnstack', onPageUnstack);
|
|
243
197
|
f7.off('pagePosition', onPagePosition);
|
|
244
198
|
f7.off('pageRole', onPageRole);
|
|
245
199
|
f7.off('pageMasterStack', onPageMasterStack);
|
|
@@ -251,7 +205,6 @@ const Page = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
251
205
|
f7.off('pageTabShow', onPageTabShow);
|
|
252
206
|
f7.off('pageTabHide', onPageTabHide);
|
|
253
207
|
};
|
|
254
|
-
|
|
255
208
|
useIsomorphicLayoutEffect(() => {
|
|
256
209
|
attachEvents();
|
|
257
210
|
return detachEvents;
|
|
@@ -268,40 +221,31 @@ const Page = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
268
221
|
let hasSubnavbarComputed;
|
|
269
222
|
let hasNavbarLargeComputed;
|
|
270
223
|
let hasMessages = messagesContent;
|
|
271
|
-
|
|
272
224
|
if (slotsDefault) {
|
|
273
225
|
slotsDefault.forEach(child => {
|
|
274
226
|
if (typeof child === 'undefined') return;
|
|
275
227
|
let isFixedTag = false;
|
|
276
228
|
const tag = child.type && (child.type.displayName || child.type.name);
|
|
277
|
-
|
|
278
229
|
if (!tag) {
|
|
279
230
|
if (pageContent) staticList.push(child);
|
|
280
231
|
return;
|
|
281
232
|
}
|
|
282
|
-
|
|
283
233
|
if (tag === 'f7-subnavbar') hasSubnavbarComputed = true;
|
|
284
|
-
|
|
285
234
|
if (tag === 'f7-navbar') {
|
|
286
235
|
if (child.props && child.props.large) hasNavbarLargeComputed = true;
|
|
287
236
|
}
|
|
288
|
-
|
|
289
237
|
if (typeof hasMessages === 'undefined' && tag === 'f7-messages') hasMessages = true;
|
|
290
|
-
|
|
291
238
|
if (fixedTags.indexOf(tag) >= 0) {
|
|
292
239
|
isFixedTag = true;
|
|
293
240
|
}
|
|
294
|
-
|
|
295
241
|
if (pageContent) {
|
|
296
242
|
if (isFixedTag) fixedList.push(child);else staticList.push(child);
|
|
297
243
|
}
|
|
298
244
|
});
|
|
299
245
|
}
|
|
300
|
-
|
|
301
246
|
const forceSubnavbar = typeof subnavbar === 'undefined' && typeof withSubnavbar === 'undefined' ? hasSubnavbarComputed || hasSubnavbar.current : false;
|
|
302
247
|
const forceNavbarLarge = typeof navbarLarge === 'undefined' && typeof withNavbarLarge === 'undefined' ? hasNavbarLargeComputed || hasNavbarLarge.current : false;
|
|
303
248
|
const classes = classNames(className, 'page', routerPositionClass.current, {
|
|
304
|
-
stacked: stacked && !routerForceUnstack.current,
|
|
305
249
|
tabs,
|
|
306
250
|
'page-with-subnavbar': subnavbar || withSubnavbar || forceSubnavbar,
|
|
307
251
|
'page-with-navbar-large': navbarLarge || withNavbarLarge || forceNavbarLarge,
|
|
@@ -316,7 +260,6 @@ const Page = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
316
260
|
'page-with-card-opened': hasCardExpandableOpened.current === true,
|
|
317
261
|
'login-screen-page': loginScreen
|
|
318
262
|
}, colorClasses(props));
|
|
319
|
-
|
|
320
263
|
if (!pageContent) {
|
|
321
264
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
322
265
|
id: id,
|
|
@@ -326,7 +269,6 @@ const Page = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
326
269
|
ref: elRef
|
|
327
270
|
}, extraAttrs), slotsFixed, slotsStatic, slotsDefault);
|
|
328
271
|
}
|
|
329
|
-
|
|
330
272
|
const pageContentEl = /*#__PURE__*/React.createElement(PageContent, {
|
|
331
273
|
ptr: ptr,
|
|
332
274
|
ptrDistance: ptrDistance,
|
package/components/panel.d.ts
CHANGED
package/components/panel.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
4
3
|
import { useIsomorphicLayoutEffect } from '../shared/use-isomorphic-layout-effect.js';
|
|
5
4
|
import { classNames, getExtraAttrs, noUndefinedProps, emit } from '../shared/utils.js';
|
|
@@ -8,6 +7,7 @@ import { f7ready, f7 } from '../shared/f7.js';
|
|
|
8
7
|
import { watchProp } from '../shared/watch-prop.js';
|
|
9
8
|
|
|
10
9
|
|
|
10
|
+
|
|
11
11
|
const Panel = /*#__PURE__*/forwardRef((props, ref) => {
|
|
12
12
|
const f7Panel = useRef(null);
|
|
13
13
|
const {
|
|
@@ -21,6 +21,7 @@ const Panel = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21
21
|
cover,
|
|
22
22
|
reveal,
|
|
23
23
|
push,
|
|
24
|
+
floating,
|
|
24
25
|
left,
|
|
25
26
|
// right,
|
|
26
27
|
opened,
|
|
@@ -43,60 +44,48 @@ const Panel = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
43
44
|
const isClosing = useRef(false);
|
|
44
45
|
const isCollapsed = useRef(false);
|
|
45
46
|
const isBreakpoint = useRef(false);
|
|
46
|
-
|
|
47
47
|
const onOpen = event => {
|
|
48
48
|
isOpened.current = true;
|
|
49
49
|
isClosing.current = false;
|
|
50
50
|
emit(props, 'panelOpen', event);
|
|
51
51
|
};
|
|
52
|
-
|
|
53
52
|
const onOpened = event => {
|
|
54
53
|
emit(props, 'panelOpened', event);
|
|
55
54
|
};
|
|
56
|
-
|
|
57
55
|
const onClose = event => {
|
|
58
56
|
isOpened.current = false;
|
|
59
57
|
isClosing.current = true;
|
|
60
58
|
emit(props, 'panelClose', event);
|
|
61
59
|
};
|
|
62
|
-
|
|
63
60
|
const onClosed = event => {
|
|
64
61
|
isClosing.current = false;
|
|
65
62
|
emit(props, 'panelClosed', event);
|
|
66
63
|
};
|
|
67
|
-
|
|
68
64
|
const onBackdropClick = event => {
|
|
69
65
|
emit(props, 'click panelBackdropClick', event);
|
|
70
66
|
};
|
|
71
|
-
|
|
72
67
|
const onSwipe = event => {
|
|
73
68
|
emit(props, 'panelSwipe', event);
|
|
74
69
|
};
|
|
75
|
-
|
|
76
70
|
const onSwipeOpen = event => {
|
|
77
71
|
emit(props, 'panelSwipeOpen', event);
|
|
78
72
|
};
|
|
79
|
-
|
|
80
73
|
const onBreakpoint = event => {
|
|
81
74
|
isBreakpoint.current = true;
|
|
82
75
|
isCollapsed.current = false;
|
|
83
76
|
emit(props, 'panelBreakpoint', event);
|
|
84
77
|
};
|
|
85
|
-
|
|
86
78
|
const onCollapsedBreakpoint = event => {
|
|
87
79
|
isBreakpoint.current = false;
|
|
88
80
|
isCollapsed.current = true;
|
|
89
81
|
emit(props, 'panelCollapsedBreakpoint', event);
|
|
90
82
|
};
|
|
91
|
-
|
|
92
83
|
const onResize = function () {
|
|
93
84
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
94
85
|
args[_key] = arguments[_key];
|
|
95
86
|
}
|
|
96
|
-
|
|
97
87
|
emit(props, 'panelResize', ...args);
|
|
98
88
|
};
|
|
99
|
-
|
|
100
89
|
useImperativeHandle(ref, () => ({
|
|
101
90
|
el: elRef.current,
|
|
102
91
|
f7Panel: () => f7Panel.current
|
|
@@ -107,14 +96,12 @@ const Panel = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
107
96
|
});
|
|
108
97
|
watchProp(opened, newValue => {
|
|
109
98
|
if (!f7Panel.current) return;
|
|
110
|
-
|
|
111
99
|
if (newValue) {
|
|
112
100
|
f7Panel.current.open();
|
|
113
101
|
} else {
|
|
114
102
|
f7Panel.current.close();
|
|
115
103
|
}
|
|
116
104
|
});
|
|
117
|
-
|
|
118
105
|
const modalEvents = method => {
|
|
119
106
|
if (!f7Panel.current) return;
|
|
120
107
|
f7Panel.current[method]('open', onOpen);
|
|
@@ -128,16 +115,13 @@ const Panel = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
128
115
|
f7Panel.current[method]('breakpoint', onBreakpoint);
|
|
129
116
|
f7Panel.current[method]('resize', onResize);
|
|
130
117
|
};
|
|
131
|
-
|
|
132
118
|
const onMount = () => {
|
|
133
119
|
f7ready(() => {
|
|
134
120
|
const $ = f7.$;
|
|
135
121
|
if (!$) return;
|
|
136
|
-
|
|
137
122
|
if ($('.panel-backdrop').length === 0) {
|
|
138
123
|
$('<div class="panel-backdrop"></div>').insertBefore(elRef.current);
|
|
139
124
|
}
|
|
140
|
-
|
|
141
125
|
const params = noUndefinedProps({
|
|
142
126
|
el: elRef.current,
|
|
143
127
|
resizable,
|
|
@@ -155,21 +139,17 @@ const Panel = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
155
139
|
});
|
|
156
140
|
f7Panel.current = f7.panel.create(params);
|
|
157
141
|
modalEvents('on');
|
|
158
|
-
|
|
159
142
|
if (opened) {
|
|
160
143
|
f7Panel.current.open(false);
|
|
161
144
|
}
|
|
162
145
|
});
|
|
163
146
|
};
|
|
164
|
-
|
|
165
147
|
const onDestroy = () => {
|
|
166
148
|
if (f7Panel.current && f7Panel.current.destroy) {
|
|
167
149
|
f7Panel.current.destroy();
|
|
168
150
|
}
|
|
169
|
-
|
|
170
151
|
f7Panel.current = null;
|
|
171
152
|
};
|
|
172
|
-
|
|
173
153
|
useIsomorphicLayoutEffect(() => {
|
|
174
154
|
modalEvents('on');
|
|
175
155
|
return () => {
|
|
@@ -180,9 +160,9 @@ const Panel = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
180
160
|
onMount();
|
|
181
161
|
return onDestroy;
|
|
182
162
|
}, []);
|
|
183
|
-
const sideComputed = side || (left ? 'left' : 'right');
|
|
184
|
-
|
|
185
|
-
const effectComputed = effect || (reveal ? 'reveal' : push ? 'push' : 'cover');
|
|
163
|
+
const sideComputed = side || (left ? 'left' : 'right');
|
|
164
|
+
// eslint-disable-next-line
|
|
165
|
+
const effectComputed = effect || (reveal ? 'reveal' : push ? 'push' : floating ? 'floating' : 'cover');
|
|
186
166
|
const classes = classNames(className, 'panel', {
|
|
187
167
|
'panel-in': isOpened.current && !isClosing.current && !isBreakpoint.current,
|
|
188
168
|
'panel-in-breakpoint': isBreakpoint.current,
|
|
@@ -5,6 +5,7 @@ import { watchProp } from '../shared/watch-prop.js';
|
|
|
5
5
|
import { f7ready, f7 } from '../shared/f7.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
const PhotoBrowser = /*#__PURE__*/forwardRef((props, ref) => {
|
|
9
10
|
const f7PhotoBrowser = useRef(null);
|
|
10
11
|
const {
|
|
@@ -39,27 +40,21 @@ const PhotoBrowser = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
39
40
|
renderPopup,
|
|
40
41
|
renderStandalone
|
|
41
42
|
} = props;
|
|
42
|
-
|
|
43
43
|
const open = index => {
|
|
44
44
|
return f7PhotoBrowser.current.open(index);
|
|
45
45
|
};
|
|
46
|
-
|
|
47
46
|
const close = () => {
|
|
48
47
|
return f7PhotoBrowser.current.close();
|
|
49
48
|
};
|
|
50
|
-
|
|
51
49
|
const expositionToggle = () => {
|
|
52
50
|
return f7PhotoBrowser.current.expositionToggle();
|
|
53
51
|
};
|
|
54
|
-
|
|
55
52
|
const expositionEnable = () => {
|
|
56
53
|
return f7PhotoBrowser.current.expositionEnable();
|
|
57
54
|
};
|
|
58
|
-
|
|
59
55
|
const expositionDisable = () => {
|
|
60
56
|
return f7PhotoBrowser.current.expositionDisable();
|
|
61
57
|
};
|
|
62
|
-
|
|
63
58
|
useImperativeHandle(ref, () => ({
|
|
64
59
|
f7PhotoBrowser: () => f7PhotoBrowser.current,
|
|
65
60
|
open,
|
|
@@ -72,17 +67,14 @@ const PhotoBrowser = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
72
67
|
const pb = f7PhotoBrowser.current;
|
|
73
68
|
if (!pb) return;
|
|
74
69
|
pb.params.photos = newValue;
|
|
75
|
-
|
|
76
70
|
if (pb.opened && pb.swiper) {
|
|
77
71
|
pb.swiper.update();
|
|
78
72
|
}
|
|
79
73
|
});
|
|
80
|
-
|
|
81
74
|
const onMount = () => {
|
|
82
75
|
if (!init) return;
|
|
83
76
|
f7ready(() => {
|
|
84
77
|
let paramsComputed;
|
|
85
|
-
|
|
86
78
|
if (typeof params !== 'undefined') {
|
|
87
79
|
paramsComputed = params;
|
|
88
80
|
} else {
|
|
@@ -117,7 +109,6 @@ const PhotoBrowser = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
117
109
|
renderStandalone
|
|
118
110
|
};
|
|
119
111
|
}
|
|
120
|
-
|
|
121
112
|
Object.keys(paramsComputed).forEach(param => {
|
|
122
113
|
if (typeof paramsComputed[param] === 'undefined' || paramsComputed[param] === '') delete paramsComputed[param];
|
|
123
114
|
});
|
|
@@ -126,34 +117,27 @@ const PhotoBrowser = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
126
117
|
open() {
|
|
127
118
|
emit(props, 'photoBrowserOpen');
|
|
128
119
|
},
|
|
129
|
-
|
|
130
120
|
close() {
|
|
131
121
|
emit(props, 'photoBrowserClose');
|
|
132
122
|
},
|
|
133
|
-
|
|
134
123
|
opened() {
|
|
135
124
|
emit(props, 'photoBrowserOpened');
|
|
136
125
|
},
|
|
137
|
-
|
|
138
126
|
closed() {
|
|
139
127
|
emit(props, 'photoBrowserClosed');
|
|
140
128
|
},
|
|
141
|
-
|
|
142
129
|
swipeToClose() {
|
|
143
130
|
emit(props, 'photoBrowserSwipeToClose');
|
|
144
131
|
}
|
|
145
|
-
|
|
146
132
|
}
|
|
147
133
|
});
|
|
148
134
|
f7PhotoBrowser.current = f7.photoBrowser.create(paramsComputed);
|
|
149
135
|
});
|
|
150
136
|
};
|
|
151
|
-
|
|
152
137
|
const onDestroy = () => {
|
|
153
138
|
if (f7PhotoBrowser.current && f7PhotoBrowser.current.destroy) f7PhotoBrowser.current.destroy();
|
|
154
139
|
f7PhotoBrowser.current = null;
|
|
155
140
|
};
|
|
156
|
-
|
|
157
141
|
useIsomorphicLayoutEffect(() => {
|
|
158
142
|
onMount();
|
|
159
143
|
return onDestroy;
|
package/components/pie-chart.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
2
|
import React, { forwardRef, useRef, useImperativeHandle, useState, useEffect } from 'react';
|
|
4
3
|
import { classNames, getExtraAttrs, emit } from '../shared/utils.js';
|
|
5
4
|
import { f7 } from '../shared/f7.js';
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
@@ -23,7 +23,6 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
23
23
|
useImperativeHandle(ref, () => ({
|
|
24
24
|
el: elRef.current
|
|
25
25
|
}));
|
|
26
|
-
|
|
27
26
|
const getSummValue = () => {
|
|
28
27
|
let summ = 0;
|
|
29
28
|
datasets.map(d => d.value || 0).forEach(value => {
|
|
@@ -31,17 +30,14 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
31
30
|
});
|
|
32
31
|
return summ;
|
|
33
32
|
};
|
|
34
|
-
|
|
35
33
|
const getPaths = () => {
|
|
36
34
|
const paths = [];
|
|
37
35
|
let cumulativePercentage = 0;
|
|
38
|
-
|
|
39
36
|
function getCoordinatesForPercentage(percentage) {
|
|
40
37
|
const x = Math.cos(2 * Math.PI * percentage) * (size / 3);
|
|
41
38
|
const y = Math.sin(2 * Math.PI * percentage) * (size / 3);
|
|
42
39
|
return [x, y];
|
|
43
40
|
}
|
|
44
|
-
|
|
45
41
|
datasets.forEach(_ref => {
|
|
46
42
|
let {
|
|
47
43
|
value,
|
|
@@ -53,8 +49,10 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
53
49
|
cumulativePercentage += percentage;
|
|
54
50
|
const [endX, endY] = getCoordinatesForPercentage(cumulativePercentage);
|
|
55
51
|
const largeArcFlag = percentage > 0.5 ? 1 : 0;
|
|
56
|
-
const points = [`M ${startX} ${startY}`,
|
|
57
|
-
|
|
52
|
+
const points = [`M ${startX} ${startY}`,
|
|
53
|
+
// Move
|
|
54
|
+
`A ${size / 3} ${size / 3} 0 ${largeArcFlag} 1 ${endX} ${endY}`,
|
|
55
|
+
// Arc
|
|
58
56
|
'L 0 0' // Line
|
|
59
57
|
].join(' ');
|
|
60
58
|
paths.push({
|
|
@@ -65,7 +63,6 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
65
63
|
});
|
|
66
64
|
return paths;
|
|
67
65
|
};
|
|
68
|
-
|
|
69
66
|
const formatTooltipText = () => {
|
|
70
67
|
if (currentIndex === null) return '';
|
|
71
68
|
const {
|
|
@@ -74,12 +71,10 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
74
71
|
color
|
|
75
72
|
} = datasets[currentIndex];
|
|
76
73
|
const percentage = value / getSummValue() * 100;
|
|
77
|
-
|
|
78
74
|
const round = v => {
|
|
79
75
|
if (parseInt(v, 10) === v) return v;
|
|
80
76
|
return Math.round(v * 100) / 100;
|
|
81
77
|
};
|
|
82
|
-
|
|
83
78
|
if (formatTooltip) {
|
|
84
79
|
return formatTooltip({
|
|
85
80
|
index: currentIndex,
|
|
@@ -89,7 +84,6 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
89
84
|
percentage
|
|
90
85
|
});
|
|
91
86
|
}
|
|
92
|
-
|
|
93
87
|
const tooltipText = `${label ? `${label}: ` : ''}${round(value)} (${round(percentage)}%)`;
|
|
94
88
|
return `
|
|
95
89
|
<div class="pie-chart-tooltip-label">
|
|
@@ -97,11 +91,9 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
97
91
|
</div>
|
|
98
92
|
`;
|
|
99
93
|
};
|
|
100
|
-
|
|
101
94
|
const setTooltip = () => {
|
|
102
95
|
if (currentIndex === null && !f7Tooltip.current) return;
|
|
103
96
|
if (!tooltip || !elRef.current || !f7) return;
|
|
104
|
-
|
|
105
97
|
if (currentIndex !== null && !f7Tooltip.current) {
|
|
106
98
|
f7Tooltip.current = f7.tooltip.create({
|
|
107
99
|
trigger: 'manual',
|
|
@@ -113,9 +105,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
113
105
|
f7Tooltip.current.show();
|
|
114
106
|
return;
|
|
115
107
|
}
|
|
116
|
-
|
|
117
108
|
if (!f7Tooltip.current) return;
|
|
118
|
-
|
|
119
109
|
if (currentIndex !== null) {
|
|
120
110
|
f7Tooltip.current.setText(formatTooltipText());
|
|
121
111
|
f7Tooltip.current.setTargetEl(elRef.current.querySelector(`path[data-index="${currentIndex}"]`));
|
|
@@ -124,7 +114,6 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
124
114
|
f7Tooltip.current.hide();
|
|
125
115
|
}
|
|
126
116
|
};
|
|
127
|
-
|
|
128
117
|
useEffect(() => {
|
|
129
118
|
if (previousIndex.current === currentIndex) return;
|
|
130
119
|
previousIndex.current = currentIndex;
|
|
@@ -136,7 +125,6 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
136
125
|
if (f7Tooltip.current && f7Tooltip.current.destroy) {
|
|
137
126
|
f7Tooltip.current.destroy();
|
|
138
127
|
}
|
|
139
|
-
|
|
140
128
|
f7Tooltip.current = null;
|
|
141
129
|
};
|
|
142
130
|
}, []);
|
package/components/popover.d.ts
CHANGED