inviton-powerduck 0.0.6 → 0.0.8
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/app/powerduck-initializer.ts +13 -1
- package/app/powerduck-system-resources.ts +1 -0
- package/common/utils/language-utils.ts +9 -1
- package/common/utils/upload-image-helper.ts +4 -3
- package/components/accordion/accordion.tsx +3 -1
- package/components/app/navigation-guard.ts +3 -3
- package/components/button/button.tsx +54 -29
- package/components/button/excel-upload-button.tsx +2 -2
- package/components/button/ladda-button.tsx +2 -2
- package/components/button/text-button.tsx +12 -9
- package/components/button/upload-button.tsx +6 -6
- package/components/card/card-header-with-options.tsx +1 -1
- package/components/card/card.tsx +33 -20
- package/components/card/image-card.tsx +39 -34
- package/components/chart-js/bar-chart.tsx +63 -62
- package/components/collapse/index.tsx +42 -0
- package/components/datatable/col-vis-modal.tsx +2 -2
- package/components/datatable/css/datatable.css +28 -4
- package/components/datatable/datatable-static.tsx +11 -2
- package/components/datatable/datatable.tsx +195 -88
- package/components/datatable/export-excel-modal.tsx +73 -70
- package/components/datatable/filter-modal.tsx +2 -2
- package/components/dropdown/country-dropdown.tsx +138 -283
- package/components/dropdown/image-dropdown.tsx +2 -2
- package/components/dropdown/index.tsx +27 -5
- package/components/dropdown/mobile/legacy_fdd.css +59 -30
- package/components/dropdown/mobile/legacy_fdd.ts +287 -197
- package/components/dropdown/mobile/legacy_lvb.ts +56 -59
- package/components/dropdown/ts/select2-multi-checkboxes.ts +10 -2
- package/components/dropdown-button/css/dropdown-button.css +4 -0
- package/components/dropdown-button/dropdown-button-element.tsx +78 -0
- package/components/dropdown-button/dropdown-button.tsx +24 -23
- package/components/dropzone/gallery-dropzone.tsx +83 -58
- package/components/form/fieldset.tsx +7 -1
- package/components/form/form-item-flex.tsx +4 -3
- package/components/form/form-item-wrapper.tsx +6 -6
- package/components/google/places-autocomplete.tsx +3 -3
- package/components/image-crop/image-cropping-modal.tsx +2 -3
- package/components/image-crop/upload-and-crop.tsx +24 -24
- package/components/input/checkbox.tsx +4 -2
- package/components/input/css/wysiwig.css +5 -0
- package/components/input/datetime-picker.tsx +60 -50
- package/components/input/geo-json.tsx +2 -2
- package/components/input/gps-input.tsx +2 -2
- package/components/input/localized-string-input.tsx +3 -4
- package/components/input/localized-string-wysiwyg.tsx +3 -0
- package/components/input/localized-url-input.tsx +4 -5
- package/components/input/numeric-input.tsx +9 -2
- package/components/input/plugins/trumbowyg/custom-upload.ts +325 -0
- package/components/input/plugins/trumbowyg/lang/sk.ts +6 -0
- package/components/input/plugins/trumbowyg/modal-issues-fix.ts +141 -0
- package/components/input/plugins/trumbowyg/wysiwyg-config.ts +55 -0
- package/components/input/radio-button-group.tsx +41 -27
- package/components/input/textarea.tsx +5 -0
- package/components/input/textbox.tsx +29 -2
- package/components/input/video-urls.tsx +2 -2
- package/components/input/wysiwig.tsx +99 -26
- package/components/modal/modal-utils.ts +19 -1
- package/components/open-street-map/open-street-map.tsx +44 -41
- package/components/progress-bar/index.tsx +93 -23
- package/components/quick-edit/quick-edit-modal-base.tsx +4 -4
- package/components/stars/css/stars.css +39 -0
- package/components/stars/stars.tsx +204 -0
- package/components/swiper/css/gallery-swiper.css +41 -0
- package/components/swiper/swiper-gallery.tsx +89 -0
- package/components/swiper/swiper-slide.tsx +12 -0
- package/components/swiper/swiper.tsx +134 -0
- package/components/tabs/tabs.tsx +1 -1
- package/components/tooltip/index.tsx +5 -3
- package/components/wizard/wizard.tsx +2 -2
- package/data/image.ts +11 -0
- package/package.json +3 -1
- package/common/image-declarations.d.ts +0 -24
- package/components/input/plugins/trumbowyg/open-modal-fix.ts +0 -127
|
@@ -3,13 +3,25 @@ import { IPowerduckSystemResources } from './powerduck-system-resources';
|
|
|
3
3
|
import jquery from "jquery";
|
|
4
4
|
import moment from "moment";
|
|
5
5
|
import select2 from "select2";
|
|
6
|
+
import { Language } from '../common/enums/language';
|
|
7
|
+
import { LanguageUtils } from '../common/utils/language-utils';
|
|
8
|
+
|
|
9
|
+
export interface PoweduckInitFrameworkArgs {
|
|
10
|
+
supportedLanguages?: Language[]
|
|
11
|
+
}
|
|
6
12
|
|
|
7
13
|
export default class PowerduckInitializer {
|
|
8
|
-
static
|
|
14
|
+
static initFramework(args?: PoweduckInitFrameworkArgs) {
|
|
9
15
|
window["jQuery"] = jquery;
|
|
10
16
|
window["$"] = window["jQuery"];
|
|
11
17
|
window["moment"] = moment;
|
|
12
18
|
window["select2"] = select2();
|
|
19
|
+
|
|
20
|
+
if (args != null) {
|
|
21
|
+
if (args.supportedLanguages?.length as number > 0) {
|
|
22
|
+
LanguageUtils.supportedLanguages = args.supportedLanguages as Language[];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
13
25
|
}
|
|
14
26
|
|
|
15
27
|
static initState<TResoures extends IPowerduckSystemResources>(resources: TResoures, args?: PowerduckStateInitArgs) {
|
|
@@ -5,6 +5,8 @@ import { arraySort } from "./array-sort";
|
|
|
5
5
|
import { PortalUtils } from "./utils";
|
|
6
6
|
|
|
7
7
|
export namespace LanguageUtils {
|
|
8
|
+
export let supportedLanguages = [Language.Slovak, Language.English];
|
|
9
|
+
|
|
8
10
|
export interface LanguageListItem {
|
|
9
11
|
text: string;
|
|
10
12
|
value: string;
|
|
@@ -63,6 +65,12 @@ export namespace LanguageUtils {
|
|
|
63
65
|
return newOption;
|
|
64
66
|
};
|
|
65
67
|
|
|
68
|
+
for (let i = 0; i <= 7; i++) {
|
|
69
|
+
if (supportedLanguages.indexOf(i) > -1) {
|
|
70
|
+
retVal.push(getLanguage(i));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
try {
|
|
67
75
|
retVal.sort(function (a, b) {
|
|
68
76
|
return a.text.localeCompare(b.text);
|
|
@@ -196,6 +204,6 @@ export namespace LanguageUtils {
|
|
|
196
204
|
}
|
|
197
205
|
|
|
198
206
|
export function negateString(str: string): string {
|
|
199
|
-
return PowerduckState.getResourceValue('negationBase')
|
|
207
|
+
return PowerduckState.getResourceValue('negationBase') + str.toLowerCase();
|
|
200
208
|
}
|
|
201
209
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
|
|
2
|
+
import PowerduckState from "../../app/powerduck-state";
|
|
3
|
+
import { ImageResponse, OnUploadImageResponse } from "../../data/image";
|
|
3
4
|
import { AppHttpProvider } from "../api-http";
|
|
4
5
|
import { BrowserImageCompression } from "./broswer-image-compression";
|
|
5
6
|
import StringUtils from "./string-utils";
|
|
@@ -21,7 +22,7 @@ export class UploadImageHelper {
|
|
|
21
22
|
body: formData,
|
|
22
23
|
headers: {
|
|
23
24
|
Authorization: "Bearer " + AppHttpProvider.bearerToken,
|
|
24
|
-
"Accept-Language":
|
|
25
|
+
"Accept-Language": PowerduckState.getCurrentLanguageCode(),
|
|
25
26
|
},
|
|
26
27
|
});
|
|
27
28
|
|
|
@@ -61,7 +61,7 @@ class Accordion extends TsxComponent<AccordionArgs> implements AccordionArgs {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
getSkin(): AccordionSkin {
|
|
64
|
-
return this.skin
|
|
64
|
+
return (this.skin === AccordionSkin.Light ? AccordionSkin.Light : AccordionSkin.Contrasting);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
getCssClassSkin() {
|
|
@@ -81,6 +81,8 @@ class Accordion extends TsxComponent<AccordionArgs> implements AccordionArgs {
|
|
|
81
81
|
<a
|
|
82
82
|
data-toggle="collapse"
|
|
83
83
|
data-parent={"#" + componentId}
|
|
84
|
+
data-bs-toggle="collapse"
|
|
85
|
+
data-bs-parent={"#" + componentId}
|
|
84
86
|
href={"#" + componentId + "-coll-" + i}
|
|
85
87
|
aria-expanded="false"
|
|
86
88
|
aria-controls={componentId + "-coll-" + i}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
|
|
3
3
|
export interface NavigationBeforeLeaveArgs {
|
|
4
|
-
to?: IAppRoute
|
|
5
|
-
from?:
|
|
4
|
+
to?: any; //IAppRoute
|
|
5
|
+
from?: any;
|
|
6
6
|
instance: any;
|
|
7
7
|
allowsAsync: boolean;
|
|
8
8
|
next: (result?: boolean) => void;
|
|
@@ -5,6 +5,8 @@ import { Tooltip } from "bootstrap";
|
|
|
5
5
|
import { isNullOrEmpty } from "../../common/utils/is-null-or-empty";
|
|
6
6
|
|
|
7
7
|
interface ButtonArgs extends _ButtonArgsBase {
|
|
8
|
+
href?: string
|
|
9
|
+
hrefTarget?: '_blank' | '_self' | '_parent' | '_top'
|
|
8
10
|
clicked: (e: any) => void;
|
|
9
11
|
}
|
|
10
12
|
|
|
@@ -25,6 +27,8 @@ class Button extends TsxComponent<ButtonArgs> implements ButtonArgs {
|
|
|
25
27
|
@Prop() disabled!: boolean;
|
|
26
28
|
@Prop() fullWidth!: boolean;
|
|
27
29
|
@Prop() pulsate!: boolean;
|
|
30
|
+
@Prop() href!: string
|
|
31
|
+
@Prop() hrefTarget!: '_blank' | '_self' | '_parent' | '_top'
|
|
28
32
|
|
|
29
33
|
//When update, update Button & DropdownButton :/
|
|
30
34
|
getCssClass(): string {
|
|
@@ -36,7 +40,8 @@ class Button extends TsxComponent<ButtonArgs> implements ButtonArgs {
|
|
|
36
40
|
(this.iconButton ? " btn-icon" : "") +
|
|
37
41
|
(this.cssClass != null ? " " + this.cssClass : "") +
|
|
38
42
|
(this.fullWidth ? " full-width" : "") +
|
|
39
|
-
(this.pulsate ? " btn-pulsating" : "")
|
|
43
|
+
(this.pulsate ? " btn-pulsating" : "") +
|
|
44
|
+
(this.iconOnRight ? ' btn-icon-on-right' : '')
|
|
40
45
|
);
|
|
41
46
|
}
|
|
42
47
|
|
|
@@ -48,7 +53,7 @@ class Button extends TsxComponent<ButtonArgs> implements ButtonArgs {
|
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
|
|
51
|
-
|
|
56
|
+
handleButtonClicked(e) {
|
|
52
57
|
this.clicked(e);
|
|
53
58
|
|
|
54
59
|
if (!isNullOrEmpty(this.tooltip)) {
|
|
@@ -65,35 +70,55 @@ class Button extends TsxComponent<ButtonArgs> implements ButtonArgs {
|
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
render(h) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
type="button"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
>
|
|
80
|
-
{this.icon && this.iconOnRight != true && (
|
|
81
|
-
<span class="btn-label">
|
|
82
|
-
<i class={this.icon}></i>
|
|
83
|
-
{this.text && <span> </span>}
|
|
84
|
-
</span>
|
|
85
|
-
)}
|
|
73
|
+
if (this.href == null) {
|
|
74
|
+
return (
|
|
75
|
+
<button type="button" class={this.getCssClass()} disabled={this.disabled == true} data-dismiss={this.dismissModal ? 'modal' : null} data-bs-dismiss={this.dismissModal ? 'modal' : null} title={this.tooltip} onClick={(e) => { this.handleButtonClicked(e) }}>
|
|
76
|
+
{this.icon && this.iconOnRight != true &&
|
|
77
|
+
<span class="btn-label">
|
|
78
|
+
<i class={this.icon}></i>
|
|
79
|
+
{this.text &&
|
|
80
|
+
<span> </span>
|
|
81
|
+
}
|
|
82
|
+
</span>
|
|
83
|
+
}
|
|
86
84
|
|
|
87
|
-
|
|
85
|
+
{this.text}
|
|
88
86
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
{this.icon && this.iconOnRight == true &&
|
|
88
|
+
<span class="btn-label">
|
|
89
|
+
{this.text &&
|
|
90
|
+
<span> </span>
|
|
91
|
+
}
|
|
92
|
+
<i class={this.icon}></i>
|
|
93
|
+
</span>
|
|
94
|
+
}
|
|
95
|
+
</button>
|
|
96
|
+
)
|
|
97
|
+
} else {
|
|
98
|
+
return (
|
|
99
|
+
<a href={this.href} target={this.hrefTarget == null ? '_self' : this.hrefTarget} class={this.getCssClass()} disabled={this.disabled == true} data-dismiss={this.dismissModal ? 'modal' : null} data-bs-dismiss={this.dismissModal ? 'modal' : null} title={this.tooltip}>
|
|
100
|
+
{this.icon && this.iconOnRight != true &&
|
|
101
|
+
<span class="btn-label">
|
|
102
|
+
<i class={this.icon}></i>
|
|
103
|
+
{this.text &&
|
|
104
|
+
<span> </span>
|
|
105
|
+
}
|
|
106
|
+
</span>
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
{this.text}
|
|
110
|
+
|
|
111
|
+
{this.icon && this.iconOnRight == true &&
|
|
112
|
+
<span class="btn-label">
|
|
113
|
+
{this.text &&
|
|
114
|
+
<span> </span>
|
|
115
|
+
}
|
|
116
|
+
<i class={this.icon}></i>
|
|
117
|
+
</span>
|
|
118
|
+
}
|
|
119
|
+
</a>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
97
122
|
}
|
|
98
123
|
}
|
|
99
124
|
|
|
@@ -25,7 +25,7 @@ class ExcelUploadButton extends TsxComponent<ExcelUploadButtonArgs> implements E
|
|
|
25
25
|
@Prop() pulsate!: boolean;
|
|
26
26
|
@Prop() excelLoaded: (excelData: Array<Array<string>>) => void;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
handleFileLoaded(buffer) {
|
|
29
29
|
if (this.excelLoaded != null) {
|
|
30
30
|
this.excelLoaded(ExcelReader.readFileAsJson(buffer));
|
|
31
31
|
}
|
|
@@ -37,7 +37,7 @@ class ExcelUploadButton extends TsxComponent<ExcelUploadButtonArgs> implements E
|
|
|
37
37
|
onlyExcel={true}
|
|
38
38
|
asArrayBuffer={true}
|
|
39
39
|
changedClientside={(e) => {
|
|
40
|
-
this.
|
|
40
|
+
this.handleFileLoaded(e);
|
|
41
41
|
}}
|
|
42
42
|
cssClass={this.cssClass}
|
|
43
43
|
layout={this.layout}
|
|
@@ -23,7 +23,7 @@ class LaddaButton extends TsxComponent<LaddaButtonArgs> implements LaddaButtonAr
|
|
|
23
23
|
@Prop() pulsate!: boolean;
|
|
24
24
|
@Prop() clicked: (e: any) => Promise<any>;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
handleButtonClicked(e) {
|
|
27
27
|
var targetElem = e.target as HTMLElement;
|
|
28
28
|
if (targetElem.nodeName.toLowerCase() != "button") {
|
|
29
29
|
targetElem = $(targetElem).closest("button")[0];
|
|
@@ -43,7 +43,7 @@ class LaddaButton extends TsxComponent<LaddaButtonArgs> implements LaddaButtonAr
|
|
|
43
43
|
return (
|
|
44
44
|
<Button
|
|
45
45
|
clicked={(e) => {
|
|
46
|
-
this.
|
|
46
|
+
this.handleButtonClicked(e);
|
|
47
47
|
}}
|
|
48
48
|
cssClass={this.cssClass}
|
|
49
49
|
layout={this.layout}
|
|
@@ -10,6 +10,7 @@ interface TextButtonArgs {
|
|
|
10
10
|
cssClass?: string;
|
|
11
11
|
pulsate?: boolean;
|
|
12
12
|
fontAdjust?: boolean;
|
|
13
|
+
iconOnRight?: boolean
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
@Component
|
|
@@ -19,6 +20,7 @@ class TextButton extends TsxComponent<TextButtonArgs> implements TextButtonArgs
|
|
|
19
20
|
@Prop() text!: string;
|
|
20
21
|
@Prop() tooltip!: string;
|
|
21
22
|
@Prop() fontAdjust!: boolean;
|
|
23
|
+
@Prop() iconOnRight!: boolean;
|
|
22
24
|
|
|
23
25
|
@Prop() clicked: (e: any) => void;
|
|
24
26
|
@Prop() disabled!: boolean;
|
|
@@ -29,7 +31,7 @@ class TextButton extends TsxComponent<TextButtonArgs> implements TextButtonArgs
|
|
|
29
31
|
return "text-button" + (this.cssClass != null ? " " + this.cssClass : "") + (this.pulsate ? " btn-pulsating" : "") + (this.fontAdjust == true ? " text-button-font" : "");
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
handleButtonClicked(e) {
|
|
33
35
|
this.clicked(e);
|
|
34
36
|
|
|
35
37
|
if (!isNullOrEmpty(this.tooltip)) {
|
|
@@ -45,15 +47,16 @@ class TextButton extends TsxComponent<TextButtonArgs> implements TextButtonArgs
|
|
|
45
47
|
|
|
46
48
|
render(h) {
|
|
47
49
|
return (
|
|
48
|
-
<span
|
|
49
|
-
|
|
50
|
-
this.
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
title={this.tooltip}
|
|
54
|
-
>
|
|
55
|
-
<i class={this.icon}></i>
|
|
50
|
+
<span onClick={(e) => { this.handleButtonClicked(e) }} class={this.getCssClass()} title={this.tooltip}>
|
|
51
|
+
{!this.iconOnRight &&
|
|
52
|
+
<i class={this.icon}></i>
|
|
53
|
+
}
|
|
54
|
+
|
|
56
55
|
<span>{this.text}</span>
|
|
56
|
+
|
|
57
|
+
{this.iconOnRight &&
|
|
58
|
+
<i class={this.icon}></i>
|
|
59
|
+
}
|
|
57
60
|
</span>
|
|
58
61
|
);
|
|
59
62
|
}
|
|
@@ -108,7 +108,7 @@ class UploadButton extends TsxComponent<UploadButtonArgs> implements UploadButto
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
handleClientButtonClicked() {
|
|
112
112
|
this.$refs.clientImageLoader["click"]();
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -116,14 +116,14 @@ class UploadButton extends TsxComponent<UploadButtonArgs> implements UploadButto
|
|
|
116
116
|
this.handleClientsideChange(e.target.files[0]);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
handleDrop(e) {
|
|
120
120
|
var file = e.dataTransfer.files[0];
|
|
121
121
|
if (file != null) {
|
|
122
122
|
this.handleClientsideChange(file);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
handleDummyEvent(e: Event) {
|
|
127
127
|
e.preventDefault();
|
|
128
128
|
e.stopPropagation();
|
|
129
129
|
}
|
|
@@ -134,11 +134,11 @@ class UploadButton extends TsxComponent<UploadButtonArgs> implements UploadButto
|
|
|
134
134
|
if (targetEl["_eventsBound"] == null) {
|
|
135
135
|
targetEl["_eventsBound"] = true;
|
|
136
136
|
["drag", "dragstart", "dragend", "dragover", "dragenter", "dragleave", "drop"].forEach((evType) => {
|
|
137
|
-
targetEl.addEventListener(evType, this.
|
|
137
|
+
targetEl.addEventListener(evType, this.handleDummyEvent);
|
|
138
138
|
});
|
|
139
139
|
|
|
140
140
|
targetEl.addEventListener("drop", (e) => {
|
|
141
|
-
this.
|
|
141
|
+
this.handleDrop(e);
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
});
|
|
@@ -156,7 +156,7 @@ class UploadButton extends TsxComponent<UploadButtonArgs> implements UploadButto
|
|
|
156
156
|
<Button
|
|
157
157
|
ref={"uploadButton"}
|
|
158
158
|
clicked={(e) => {
|
|
159
|
-
this.
|
|
159
|
+
this.handleClientButtonClicked();
|
|
160
160
|
}}
|
|
161
161
|
cssClass={this.cssClass}
|
|
162
162
|
layout={this.layout}
|
|
@@ -36,7 +36,7 @@ class CardHeaderWithOptions extends TsxComponent<CardHeaderWithOptionsArgs> impl
|
|
|
36
36
|
)}
|
|
37
37
|
|
|
38
38
|
<div class="dropdown card-header-options-dropdown">
|
|
39
|
-
<button type="button" class="btn btn-default dropdown-toggle no-caret" data-toggle="dropdown">
|
|
39
|
+
<button type="button" class="btn btn-default dropdown-toggle no-caret" data-toggle="dropdown" data-bs-toggle="dropdown">
|
|
40
40
|
<i class="icon icon-settings"></i>
|
|
41
41
|
</button>
|
|
42
42
|
<div class="dropdown-menu dropdown-menu-right">
|
package/components/card/card.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import PowerduckState from
|
|
1
|
+
import { Prop, toNative } from 'vue-facing-decorator'
|
|
2
|
+
|
|
3
|
+
import PowerduckState from '../../app/powerduck-state'
|
|
4
|
+
import TsxComponent, { Component } from '../../app/vuetsx'
|
|
4
5
|
|
|
5
6
|
export enum CardRole {
|
|
6
7
|
Normal = 0,
|
|
@@ -8,24 +9,28 @@ export enum CardRole {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
interface CardArgs {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
role?: CardRole
|
|
13
|
+
renderMode?: 'default' | 'inlined'
|
|
14
|
+
hasShadow?: boolean
|
|
15
|
+
cssClass?: string
|
|
16
|
+
clicked?: () => void
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
@Component
|
|
17
20
|
class Card extends TsxComponent<CardArgs> implements CardArgs {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
@Prop() role!: CardRole
|
|
22
|
+
@Prop() hasShadow!: boolean
|
|
23
|
+
@Prop() renderMode?: 'default' | 'inlined'
|
|
24
|
+
@Prop() cssClass?: string
|
|
25
|
+
@Prop() clicked?: () => void
|
|
26
|
+
|
|
27
|
+
render() {
|
|
28
|
+
return (
|
|
29
|
+
<div onClick={this?.clicked} role={this.getRole()} class={`card${this.role == CardRole.RootCard ? ' single-card root-element' : ''}${this.getStickyCssClass()}${this.getBoxShadowCardCss()}${this.getRenderModeCardCss()} ${this.cssClass ?? ''}`}>
|
|
30
|
+
{this.$slots.default?.()}
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
29
34
|
|
|
30
35
|
getStickyCssClass(): string {
|
|
31
36
|
var cssClass = "";
|
|
@@ -55,8 +60,16 @@ class Card extends TsxComponent<CardArgs> implements CardArgs {
|
|
|
55
60
|
return " card-render-inlined";
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
return ''
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getRole() {
|
|
67
|
+
if (this.clicked != null) {
|
|
68
|
+
return 'button'
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return 'initial'
|
|
72
|
+
}
|
|
60
73
|
}
|
|
61
74
|
|
|
62
|
-
export default toNative(Card);
|
|
75
|
+
export default toNative(Card);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { Prop, toNative } from 'vue-facing-decorator'
|
|
2
|
+
|
|
3
|
+
import PowerduckState from '../../app/powerduck-state'
|
|
4
|
+
import TsxComponent, { Component } from '../../app/vuetsx'
|
|
5
|
+
import Card from './card'
|
|
6
|
+
import CardBody from './card-body'
|
|
6
7
|
|
|
7
8
|
export enum CardRole {
|
|
8
9
|
Normal = 0,
|
|
@@ -10,39 +11,43 @@ export enum CardRole {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
interface ImageCardArgs {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
role?: CardRole
|
|
15
|
+
renderMode?: 'default' | 'inlined'
|
|
16
|
+
hasShadow?: boolean
|
|
17
|
+
imgUrl: string
|
|
18
|
+
imgAlt?: string
|
|
19
|
+
height?: string
|
|
20
|
+
clicked?: () => void
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
@Component
|
|
21
24
|
class ImageCard extends TsxComponent<ImageCardArgs> implements ImageCardArgs {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
@Prop() role!: CardRole
|
|
26
|
+
@Prop() hasShadow!: boolean
|
|
27
|
+
@Prop() renderMode?: 'default' | 'inlined'
|
|
28
|
+
@Prop() imgUrl: string
|
|
29
|
+
@Prop() height?: string
|
|
30
|
+
@Prop() imgAlt?: string
|
|
31
|
+
@Prop() clicked?: () => void
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
render() {
|
|
34
|
+
return (
|
|
35
|
+
<Card clicked={this?.clicked} renderMode="inlined">
|
|
36
|
+
<div class="row g-0">
|
|
37
|
+
<div class="col-md-3" style={`height: ${this.height ?? 'auto'}`}>
|
|
38
|
+
<img
|
|
39
|
+
src={this.imgUrl}
|
|
40
|
+
class="img-fluid rounded-start h-100 w-100 object-fit-cover"
|
|
41
|
+
alt={this.imgAlt ?? 'Image'}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="col-md-8">
|
|
45
|
+
<CardBody>{this.$slots.default?.()}</CardBody>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</Card>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
46
51
|
|
|
47
52
|
getStickyCssClass(): string {
|
|
48
53
|
var cssClass = ""
|
|
@@ -76,4 +81,4 @@ class ImageCard extends TsxComponent<ImageCardArgs> implements ImageCardArgs {
|
|
|
76
81
|
}
|
|
77
82
|
}
|
|
78
83
|
|
|
79
|
-
export default toNative(ImageCard)
|
|
84
|
+
export default toNative(ImageCard)
|