@xh/hoist 72.0.0-SNAPSHOT.1737150473558 → 72.0.0-SNAPSHOT.1737484375112
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/CHANGELOG.md +10 -1
- package/admin/columns/Tracking.ts +10 -0
- package/admin/tabs/activity/tracking/ActivityTrackingModel.ts +2 -0
- package/admin/tabs/activity/tracking/detail/ActivityDetailModel.ts +1 -0
- package/build/types/admin/columns/Tracking.d.ts +1 -0
- package/build/types/core/types/Interfaces.d.ts +12 -3
- package/build/types/kit/onsen/index.d.ts +1 -1
- package/build/types/kit/swiper/index.d.ts +98 -0
- package/build/types/mobile/cmp/navigator/Navigator.d.ts +2 -6
- package/build/types/mobile/cmp/navigator/NavigatorModel.d.ts +18 -11
- package/build/types/mobile/cmp/navigator/impl/GestureRefresh.d.ts +8 -0
- package/build/types/mobile/cmp/navigator/impl/{swipe/SwiperModel.d.ts → GestureRefreshModel.d.ts} +1 -8
- package/build/types/mobile/cmp/navigator/impl/Utils.d.ts +9 -0
- package/cmp/ag-grid/AgGrid.scss +6 -0
- package/core/types/Interfaces.ts +13 -3
- package/kit/onsen/index.ts +0 -1
- package/kit/onsen/theme.scss +0 -5
- package/kit/swiper/index.ts +14 -0
- package/kit/swiper/styles.scss +2 -0
- package/mobile/cmp/navigator/Navigator.scss +20 -0
- package/mobile/cmp/navigator/Navigator.ts +36 -19
- package/mobile/cmp/navigator/NavigatorModel.ts +156 -99
- package/mobile/cmp/navigator/impl/{swipe/Swiper.scss → GestureRefresh.scss} +6 -1
- package/mobile/cmp/navigator/impl/GestureRefresh.ts +55 -0
- package/mobile/cmp/navigator/impl/GestureRefreshModel.ts +86 -0
- package/mobile/cmp/navigator/impl/Page.scss +4 -2
- package/mobile/cmp/navigator/impl/Page.ts +10 -12
- package/mobile/cmp/navigator/impl/Utils.ts +107 -0
- package/package.json +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/types/mobile/cmp/navigator/impl/swipe/BackIndicator.d.ts +0 -6
- package/build/types/mobile/cmp/navigator/impl/swipe/RefreshIndicator.d.ts +0 -6
- package/build/types/mobile/cmp/navigator/impl/swipe/Swiper.d.ts +0 -8
- package/mobile/cmp/navigator/impl/swipe/BackIndicator.ts +0 -34
- package/mobile/cmp/navigator/impl/swipe/RefreshIndicator.ts +0 -36
- package/mobile/cmp/navigator/impl/swipe/Swiper.ts +0 -35
- package/mobile/cmp/navigator/impl/swipe/SwiperModel.ts +0 -153
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import './Swiper.scss';
|
|
2
|
-
import { SwiperModel } from './SwiperModel';
|
|
3
|
-
/**
|
|
4
|
-
* Wrap the Onsen Navigator with drag gesture handling.
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare const swiper: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<SwiperModel>>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
import {div} from '@xh/hoist/cmp/layout';
|
|
8
|
-
import {hoistCmp} from '@xh/hoist/core';
|
|
9
|
-
import {Icon} from '@xh/hoist/icon';
|
|
10
|
-
import classNames from 'classnames';
|
|
11
|
-
import {SwiperModel} from './SwiperModel';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Indicator for the swipeToGoBack affordance
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export const backIndicator = hoistCmp.factory<SwiperModel>(({model}) => {
|
|
18
|
-
const {backStarted, backProgress, backCompleted} = model,
|
|
19
|
-
left = -40 + backProgress * 60,
|
|
20
|
-
className = classNames(
|
|
21
|
-
'xh-swiper-indicator',
|
|
22
|
-
backCompleted ? 'xh-swiper-indicator--complete' : null,
|
|
23
|
-
backStarted ? 'xh-swiper-indicator--started' : null
|
|
24
|
-
);
|
|
25
|
-
return div({
|
|
26
|
-
className,
|
|
27
|
-
style: {
|
|
28
|
-
top: '50%',
|
|
29
|
-
left,
|
|
30
|
-
transform: `translateY(-50%)`
|
|
31
|
-
},
|
|
32
|
-
item: Icon.chevronLeft()
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
import {div} from '@xh/hoist/cmp/layout';
|
|
8
|
-
import {hoistCmp} from '@xh/hoist/core';
|
|
9
|
-
import {Icon} from '@xh/hoist/icon';
|
|
10
|
-
import classNames from 'classnames';
|
|
11
|
-
import {SwiperModel} from './SwiperModel';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Indicator for the pulldownToRefresh affordance
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export const refreshIndicator = hoistCmp.factory<SwiperModel>(({model}) => {
|
|
18
|
-
const {refreshStarted, refreshProgress, refreshCompleted} = model,
|
|
19
|
-
top = -40 + refreshProgress * 85,
|
|
20
|
-
degrees = Math.floor(refreshProgress * 360),
|
|
21
|
-
className = classNames(
|
|
22
|
-
'xh-swiper-indicator',
|
|
23
|
-
refreshCompleted ? 'xh-swiper-indicator--complete' : null,
|
|
24
|
-
refreshStarted ? 'xh-swiper-indicator--started' : null
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
return div({
|
|
28
|
-
className,
|
|
29
|
-
style: {
|
|
30
|
-
top,
|
|
31
|
-
left: '50%',
|
|
32
|
-
transform: `translateX(-50%) rotate(${degrees}deg)`
|
|
33
|
-
},
|
|
34
|
-
item: Icon.refresh()
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
import {frame} from '@xh/hoist/cmp/layout';
|
|
8
|
-
import {creates, hoistCmp} from '@xh/hoist/core';
|
|
9
|
-
import {gestureDetector} from '@xh/hoist/kit/onsen';
|
|
10
|
-
import {backIndicator} from './BackIndicator';
|
|
11
|
-
import {refreshIndicator} from './RefreshIndicator';
|
|
12
|
-
import './Swiper.scss';
|
|
13
|
-
import {SwiperModel} from './SwiperModel';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Wrap the Onsen Navigator with drag gesture handling.
|
|
17
|
-
*
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export const swiper = hoistCmp.factory({
|
|
21
|
-
model: creates(SwiperModel),
|
|
22
|
-
|
|
23
|
-
render({model, children}) {
|
|
24
|
-
return frame(
|
|
25
|
-
refreshIndicator(),
|
|
26
|
-
backIndicator(),
|
|
27
|
-
gestureDetector({
|
|
28
|
-
onDragStart: model.onDragStart,
|
|
29
|
-
onDrag: model.onDrag,
|
|
30
|
-
onDragEnd: model.onDragEnd,
|
|
31
|
-
item: children
|
|
32
|
-
})
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
import {HoistModel, lookup, XH} from '@xh/hoist/core';
|
|
8
|
-
import {action, computed, makeObservable, observable} from '@xh/hoist/mobx';
|
|
9
|
-
import {consumeEvent} from '@xh/hoist/utils/js';
|
|
10
|
-
import {isFinite, clamp} from 'lodash';
|
|
11
|
-
import {NavigatorModel} from '../../NavigatorModel';
|
|
12
|
-
|
|
13
|
-
import './Swiper.scss';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export class SwiperModel extends HoistModel {
|
|
19
|
-
@lookup(NavigatorModel) navigatorModel;
|
|
20
|
-
|
|
21
|
-
@observable backProgress = null;
|
|
22
|
-
@observable refreshProgress = null;
|
|
23
|
-
|
|
24
|
-
@computed get backStarted() {
|
|
25
|
-
return isFinite(this.backProgress);
|
|
26
|
-
}
|
|
27
|
-
@computed get backCompleted() {
|
|
28
|
-
return this.backProgress === 1;
|
|
29
|
-
}
|
|
30
|
-
@action backStart() {
|
|
31
|
-
this.backProgress = 0;
|
|
32
|
-
}
|
|
33
|
-
@action backEnd() {
|
|
34
|
-
this.backProgress = null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@computed get refreshStarted() {
|
|
38
|
-
return isFinite(this.refreshProgress);
|
|
39
|
-
}
|
|
40
|
-
@computed get refreshCompleted() {
|
|
41
|
-
return this.refreshProgress === 1;
|
|
42
|
-
}
|
|
43
|
-
@action refreshStart() {
|
|
44
|
-
this.refreshProgress = 0;
|
|
45
|
-
}
|
|
46
|
-
@action refreshEnd() {
|
|
47
|
-
this.refreshProgress = null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
constructor() {
|
|
51
|
-
super();
|
|
52
|
-
makeObservable(this);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@action
|
|
56
|
-
onDragStart = e => {
|
|
57
|
-
const {navigatorModel} = this,
|
|
58
|
-
{direction} = e.gesture;
|
|
59
|
-
|
|
60
|
-
this.refreshEnd();
|
|
61
|
-
this.backEnd();
|
|
62
|
-
|
|
63
|
-
// Back
|
|
64
|
-
// Check we have a page to nav to and avoid conflict with browser back
|
|
65
|
-
if (
|
|
66
|
-
direction === 'right' &&
|
|
67
|
-
navigatorModel.swipeToGoBack &&
|
|
68
|
-
navigatorModel.stack.length >= 2 &&
|
|
69
|
-
e.gesture.startEvent.center.pageX > 20 &&
|
|
70
|
-
!this.isDraggingChild(e, 'right')
|
|
71
|
-
) {
|
|
72
|
-
this.backStart();
|
|
73
|
-
consumeEvent(e);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Refresh
|
|
78
|
-
if (
|
|
79
|
-
direction === 'down' &&
|
|
80
|
-
navigatorModel.pullDownToRefresh &&
|
|
81
|
-
!this.isDraggingChild(e, 'down')
|
|
82
|
-
) {
|
|
83
|
-
this.refreshStart();
|
|
84
|
-
consumeEvent(e);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
@action
|
|
90
|
-
onDrag = e => {
|
|
91
|
-
const {direction, deltaX, deltaY} = e.gesture;
|
|
92
|
-
|
|
93
|
-
// For either gesture we set normalised progress based on distance dragged, or kill it
|
|
94
|
-
|
|
95
|
-
// Back
|
|
96
|
-
if (this.backStarted) {
|
|
97
|
-
if (direction !== 'right') {
|
|
98
|
-
this.backEnd();
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
this.backProgress = clamp(deltaX / 150, 0, 1);
|
|
102
|
-
consumeEvent(e);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Refresh
|
|
107
|
-
if (this.refreshStarted) {
|
|
108
|
-
if (direction !== 'down') {
|
|
109
|
-
this.refreshEnd();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
this.refreshProgress = clamp(deltaY / 150, 0, 1);
|
|
113
|
-
consumeEvent(e);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
@action
|
|
119
|
-
onDragEnd = e => {
|
|
120
|
-
// Back
|
|
121
|
-
if (this.backStarted) {
|
|
122
|
-
if (this.backCompleted) XH.popRoute();
|
|
123
|
-
this.backEnd();
|
|
124
|
-
consumeEvent(e);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// Refresh
|
|
128
|
-
if (this.refreshStarted) {
|
|
129
|
-
if (this.refreshCompleted) XH.refreshAppAsync();
|
|
130
|
-
this.refreshEnd();
|
|
131
|
-
consumeEvent(e);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
isDraggingChild(e, dir) {
|
|
136
|
-
// Loop through the touch targets to ensure it is safe to swipe
|
|
137
|
-
for (let el = e.target; el && el !== document.body; el = el.parentNode) {
|
|
138
|
-
// Don't conflict with grid header reordering or chart dragging.
|
|
139
|
-
if (el.classList.contains('xh-grid-header') || el.classList.contains('xh-chart')) {
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Ensure any scrolling element in the target path takes priority over swipe navigation.
|
|
144
|
-
if (
|
|
145
|
-
(dir === 'right' && el.scrollWidth > el.offsetWidth && el.scrollLeft > 0) ||
|
|
146
|
-
(dir === 'down' && el.scrollHeight > el.offsetHeight && el.scrollTop > 0)
|
|
147
|
-
) {
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
}
|