inviton-powerduck 0.0.102 → 0.0.105
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toNative, Prop } from "vue-facing-decorator";
|
|
2
2
|
import TsxComponent, { Component } from "../../app/vuetsx";
|
|
3
|
-
import DataTable, { TableColumn, RowIndexMode, DataTableFilterMode, DataTableOnSortedArgs } from "./datatable";
|
|
3
|
+
import DataTable, { TableColumn, RowIndexMode, DataTableFilterMode, DataTableOnSortedArgs, DataTableMobileBehavior } from "./datatable";
|
|
4
4
|
import { IWebApiClient, WebClientApiMethod } from "../../common/IWebClient";
|
|
5
5
|
|
|
6
6
|
interface DataTableStaticArgs {
|
|
@@ -19,6 +19,7 @@ interface DataTableStaticArgs {
|
|
|
19
19
|
preserveFilter?: boolean
|
|
20
20
|
checkboxButtonsVisible?: boolean;
|
|
21
21
|
sortableRows?: boolean;
|
|
22
|
+
mobileBehavior?: DataTableMobileBehavior;
|
|
22
23
|
rowCheckstateChanged?: (row: any, checked: boolean, selectedRows: any[]) => void;
|
|
23
24
|
sortComplete?: (args: DataTableOnSortedArgs) => void;
|
|
24
25
|
}
|
|
@@ -41,6 +42,7 @@ export class DataTableStaticComponent extends TsxComponent<DataTableStaticArgs>
|
|
|
41
42
|
@Prop() checkboxesTitle!: string;
|
|
42
43
|
@Prop() checkboxButtonsVisible!: boolean;
|
|
43
44
|
@Prop() sortableRows!: boolean;
|
|
45
|
+
@Prop() mobileBehavior!: DataTableMobileBehavior;
|
|
44
46
|
@Prop() rowCheckstateChanged?: (row: any, checked: boolean, selectedRows: any[]) => void;
|
|
45
47
|
@Prop() sortComplete?: (args: DataTableOnSortedArgs) => void;
|
|
46
48
|
|
|
@@ -119,6 +121,7 @@ export class DataTableStaticComponent extends TsxComponent<DataTableStaticArgs>
|
|
|
119
121
|
sortComplete={this.sortComplete}
|
|
120
122
|
preserveOrderBy={this.preserveOrderBy}
|
|
121
123
|
fullSizeHasButtonBelow={this.fullSizeTable}
|
|
124
|
+
mobileBehavior={this.mobileBehavior}
|
|
122
125
|
/>
|
|
123
126
|
);
|
|
124
127
|
}
|
|
@@ -63,6 +63,12 @@ class DropzoneGalleryComponent extends TsxComponent<DropzoneGalleryArgs> impleme
|
|
|
63
63
|
this.bindScript();
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
beforeUnmount() {
|
|
67
|
+
try {
|
|
68
|
+
(this.$refs.galleryDropzone as any).dropzone.destroy();
|
|
69
|
+
} catch (error) { }
|
|
70
|
+
}
|
|
71
|
+
|
|
66
72
|
updateSortOrder(itemArr?: DropzoneGalleryItem[]) {
|
|
67
73
|
let applySort = false;
|
|
68
74
|
if (itemArr == null) {
|
|
@@ -4,9 +4,9 @@ interface SwiperSlideArgs { }
|
|
|
4
4
|
|
|
5
5
|
@Component
|
|
6
6
|
class SwiperSlideComponent extends TsxComponent<SwiperSlideArgs> implements SwiperSlideArgs {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
render(h) {
|
|
8
|
+
return (<div class="swiper-slide">{this.$slots?.default()}</div>)
|
|
9
|
+
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const SwiperSlide = toNative(SwiperSlideComponent)
|
|
@@ -1,134 +1,202 @@
|
|
|
1
1
|
import { toNative, Prop } from "vue-facing-decorator";
|
|
2
2
|
import TsxComponent, { Component } from "../../app/vuetsx";
|
|
3
3
|
import SwiperCore from 'swiper';
|
|
4
|
+
import type { Vue } from 'vue-facing-decorator';
|
|
5
|
+
import { Navigation, Pagination } from 'swiper/modules';
|
|
4
6
|
import 'swiper/css'
|
|
5
7
|
import 'swiper/css/navigation'
|
|
6
8
|
import 'swiper/css/pagination'
|
|
9
|
+
import './css/swiper.css';
|
|
7
10
|
|
|
11
|
+
type VueType = typeof Vue.prototype;
|
|
12
|
+
interface IVue extends VueType { }
|
|
13
|
+
SwiperCore.use([Navigation, Pagination]);
|
|
8
14
|
|
|
9
15
|
interface SwiperArgs {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
hasPagination?: boolean
|
|
17
|
+
direction?: 'horizontal' | 'vertical'
|
|
18
|
+
slidesPerView?: 'auto' | number
|
|
19
|
+
slidesPerGroup?: number
|
|
20
|
+
spaceBetween?: number
|
|
21
|
+
freeMode?: boolean
|
|
22
|
+
grabCursor?: boolean
|
|
23
|
+
speed?: number
|
|
24
|
+
autoplay?: boolean
|
|
25
|
+
preventClicks?: boolean
|
|
26
|
+
navigation?: { nextEl: () => HTMLElement | string | IVue, prevEl: () => HTMLElement | string | IVue }
|
|
27
|
+
slideChanged?: (e?: SwiperSlideChangedArgs) => void,
|
|
28
|
+
zoomChanged?: (scale: number) => void
|
|
29
|
+
zoom?: boolean | SwiperZoomArgs
|
|
16
30
|
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
export interface SwiperSlideChangedArgs {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
activeIndex: number
|
|
35
|
+
previousIndex: number
|
|
36
|
+
swiper: any
|
|
23
37
|
}
|
|
24
38
|
|
|
25
39
|
export interface SwiperZoomArgs {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
enabled: boolean
|
|
41
|
+
maxRatio?: number
|
|
42
|
+
minRatio?: number
|
|
29
43
|
}
|
|
30
44
|
|
|
31
45
|
|
|
32
46
|
@Component
|
|
33
47
|
class SwiperComponent extends TsxComponent<SwiperArgs> implements SwiperArgs {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
48
|
+
@Prop() key: string;
|
|
49
|
+
@Prop() hasPagination?: boolean
|
|
50
|
+
@Prop() direction?: 'horizontal' | 'vertical'
|
|
51
|
+
@Prop() slidesPerView?: 'auto' | number
|
|
52
|
+
@Prop() slidesPerGroup?: number
|
|
53
|
+
@Prop() spaceBetween?: number
|
|
54
|
+
@Prop() freeMode?: boolean
|
|
55
|
+
@Prop() grabCursor?: boolean
|
|
56
|
+
@Prop() speed: number
|
|
57
|
+
@Prop() autoplay: boolean
|
|
58
|
+
@Prop() preventClicks: boolean
|
|
59
|
+
@Prop() navigation?: { nextEl: () => HTMLElement | string | IVue, prevEl: () => HTMLElement | string | IVue }
|
|
60
|
+
@Prop() zoom?: boolean | SwiperZoomArgs
|
|
61
|
+
@Prop() slideChanged?: (e?: SwiperSlideChangedArgs) => void
|
|
62
|
+
@Prop() zoomChanged?: (scale: number) => void
|
|
63
|
+
zoomed: boolean = false;
|
|
64
|
+
|
|
65
|
+
mounted() {
|
|
66
|
+
const rootElem = this.$el;
|
|
67
|
+
if (rootElem != null) {
|
|
68
|
+
let existingInstance = (rootElem as any).swiper;
|
|
69
|
+
if (existingInstance == null) {
|
|
70
|
+
let args: any = {
|
|
71
|
+
zoom: this.getZoomArgs(),
|
|
72
|
+
direction: this.direction || 'horizontal',
|
|
73
|
+
spaceBetween: this.spaceBetween > 0 ? this.spaceBetween : 0,
|
|
74
|
+
pagination: this.shouldRenderPagination() ? {
|
|
75
|
+
el: this.$refs.swiperPagination,
|
|
76
|
+
type: 'bullets',
|
|
77
|
+
} : {
|
|
78
|
+
el: null
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
if (this.slidesPerView != null) {
|
|
83
|
+
args.slidesPerView = this.slidesPerView;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (this.slidesPerGroup != null) {
|
|
87
|
+
args.slidesPerGroup = this.slidesPerGroup;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (this.freeMode != null) {
|
|
91
|
+
args.freeMode = this.freeMode;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (this.grabCursor != null) {
|
|
95
|
+
args.grabCursor = this.grabCursor;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (this.speed != null) {
|
|
99
|
+
args.speed = this.speed;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (this.autoplay != null) {
|
|
103
|
+
args.autoplay = this.autoplay;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (this.preventClicks != null) {
|
|
107
|
+
args.preventClicks = this.preventClicks;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (this.navigation != null) {
|
|
111
|
+
const getForProp = (prop) => {
|
|
112
|
+
if (prop == null) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const propVal = prop();
|
|
117
|
+
if (propVal == null) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return propVal.$el ?? propVal;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
args.navigation = {
|
|
125
|
+
prevEl: getForProp(this.navigation.prevEl),
|
|
126
|
+
nextEl: getForProp(this.navigation.nextEl),
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (this.slideChanged != null) {
|
|
131
|
+
args.on = {
|
|
132
|
+
slideChange: (swiper: any) => {
|
|
133
|
+
this.slideChanged({
|
|
134
|
+
activeIndex: swiper.activeIndex,
|
|
135
|
+
previousIndex: swiper.previousIndex,
|
|
136
|
+
swiper: swiper
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (this.zoomChanged != null) {
|
|
143
|
+
args.on = {
|
|
144
|
+
...args.on,
|
|
145
|
+
zoomChange: (swiperEvent: any, scale: number) => {
|
|
146
|
+
this.zoomed = scale > 1 ? true : false;
|
|
147
|
+
this.zoomChanged(scale)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
new SwiperCore(rootElem as any, args);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
getSwiperInstance() {
|
|
158
|
+
const rootElem = this.$el;
|
|
159
|
+
if (rootElem != null) {
|
|
160
|
+
return (rootElem as any).swiper;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
getZoomArgs(): SwiperZoomArgs {
|
|
167
|
+
if (this.zoom == true) {
|
|
168
|
+
return {
|
|
169
|
+
enabled: true
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return this.zoom as SwiperZoomArgs;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
shouldRenderPagination(): boolean {
|
|
177
|
+
return this.hasPagination != false;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
render(h) {
|
|
183
|
+
const zoomEnabled = (this.zoom == true || (this.zoom as SwiperZoomArgs)?.enabled == true);
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<div class="swiper">
|
|
187
|
+
{this.shouldRenderPagination() &&
|
|
188
|
+
<div ref="swiperPagination" class={`swiper-pagination swiper-pagination-bullets swiper-pagination-horizontal ${this.zoomed ?
|
|
189
|
+
"hide-swiper-pagination-bulets" :
|
|
190
|
+
""}`
|
|
191
|
+
}></div>
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
<div class="swiper-wrapper">
|
|
195
|
+
{this.$slots?.default()}
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
132
200
|
}
|
|
133
201
|
|
|
134
202
|
const Swiper = toNative(SwiperComponent)
|