chayns-api 1.0.28 → 1.0.30
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.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.Environment = exports.DialogType = exports.DialogButtonType = exports.DeviceOs = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
|
|
6
|
+
exports.ToastType = exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogButtonType = exports.DeviceOs = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
|
|
7
7
|
let DateType;
|
|
8
8
|
exports.DateType = DateType;
|
|
9
9
|
(function (DateType) {
|
|
@@ -11,6 +11,28 @@ exports.DateType = DateType;
|
|
|
11
11
|
DateType[DateType["TIME"] = 1] = "TIME";
|
|
12
12
|
DateType[DateType["DATE_TIME"] = 2] = "DATE_TIME";
|
|
13
13
|
})(DateType || (exports.DateType = DateType = {}));
|
|
14
|
+
let ToastType;
|
|
15
|
+
exports.ToastType = ToastType;
|
|
16
|
+
(function (ToastType) {
|
|
17
|
+
ToastType[ToastType["NEUTRAL"] = 1] = "NEUTRAL";
|
|
18
|
+
ToastType[ToastType["SUCCESS"] = 2] = "SUCCESS";
|
|
19
|
+
ToastType[ToastType["WARNING"] = 3] = "WARNING";
|
|
20
|
+
ToastType[ToastType["ERROR"] = 4] = "ERROR";
|
|
21
|
+
})(ToastType || (exports.ToastType = ToastType = {}));
|
|
22
|
+
let DialogInputType; // TEXTAREA = 'textarea', TODO Add this type when textarea is implemented in new chayns-components in dialog-v2
|
|
23
|
+
exports.DialogInputType = DialogInputType;
|
|
24
|
+
(function (DialogInputType) {
|
|
25
|
+
DialogInputType["NUMBER"] = "number";
|
|
26
|
+
DialogInputType["PASSWORD"] = "password";
|
|
27
|
+
DialogInputType["TELEPHONE"] = "tel";
|
|
28
|
+
DialogInputType["TEXT"] = "text";
|
|
29
|
+
})(DialogInputType || (exports.DialogInputType = DialogInputType = {}));
|
|
30
|
+
let DialogSelectType;
|
|
31
|
+
exports.DialogSelectType = DialogSelectType;
|
|
32
|
+
(function (DialogSelectType) {
|
|
33
|
+
DialogSelectType[DialogSelectType["DEFAULT"] = 0] = "DEFAULT";
|
|
34
|
+
DialogSelectType[DialogSelectType["ICON"] = 1] = "ICON";
|
|
35
|
+
})(DialogSelectType || (exports.DialogSelectType = DialogSelectType = {}));
|
|
14
36
|
let DialogButtonType;
|
|
15
37
|
exports.DialogButtonType = DialogButtonType;
|
|
16
38
|
(function (DialogButtonType) {
|
|
@@ -47,7 +47,7 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
47
47
|
|
|
48
48
|
// Infos that are only available on client or iframe side
|
|
49
49
|
const getClientDeviceInfo = () => ({
|
|
50
|
-
isTouch:
|
|
50
|
+
isTouch: navigator.maxTouchPoints > 0 && window.matchMedia('(pointer: coarse)').matches
|
|
51
51
|
});
|
|
52
52
|
exports.getClientDeviceInfo = getClientDeviceInfo;
|
|
53
53
|
const getScreenSize = width => {
|
|
@@ -4,6 +4,25 @@ export let DateType;
|
|
|
4
4
|
DateType[DateType["TIME"] = 1] = "TIME";
|
|
5
5
|
DateType[DateType["DATE_TIME"] = 2] = "DATE_TIME";
|
|
6
6
|
})(DateType || (DateType = {}));
|
|
7
|
+
export let ToastType;
|
|
8
|
+
(function (ToastType) {
|
|
9
|
+
ToastType[ToastType["NEUTRAL"] = 1] = "NEUTRAL";
|
|
10
|
+
ToastType[ToastType["SUCCESS"] = 2] = "SUCCESS";
|
|
11
|
+
ToastType[ToastType["WARNING"] = 3] = "WARNING";
|
|
12
|
+
ToastType[ToastType["ERROR"] = 4] = "ERROR";
|
|
13
|
+
})(ToastType || (ToastType = {}));
|
|
14
|
+
export let DialogInputType; // TEXTAREA = 'textarea', TODO Add this type when textarea is implemented in new chayns-components in dialog-v2
|
|
15
|
+
(function (DialogInputType) {
|
|
16
|
+
DialogInputType["NUMBER"] = "number";
|
|
17
|
+
DialogInputType["PASSWORD"] = "password";
|
|
18
|
+
DialogInputType["TELEPHONE"] = "tel";
|
|
19
|
+
DialogInputType["TEXT"] = "text";
|
|
20
|
+
})(DialogInputType || (DialogInputType = {}));
|
|
21
|
+
export let DialogSelectType;
|
|
22
|
+
(function (DialogSelectType) {
|
|
23
|
+
DialogSelectType[DialogSelectType["DEFAULT"] = 0] = "DEFAULT";
|
|
24
|
+
DialogSelectType[DialogSelectType["ICON"] = 1] = "ICON";
|
|
25
|
+
})(DialogSelectType || (DialogSelectType = {}));
|
|
7
26
|
export let DialogButtonType;
|
|
8
27
|
(function (DialogButtonType) {
|
|
9
28
|
DialogButtonType[DialogButtonType["OK"] = 1] = "OK";
|
|
@@ -41,7 +41,7 @@ const getDeviceInfo = (userAgent, acceptHeader) => {
|
|
|
41
41
|
|
|
42
42
|
// Infos that are only available on client or iframe side
|
|
43
43
|
export const getClientDeviceInfo = () => ({
|
|
44
|
-
isTouch:
|
|
44
|
+
isTouch: navigator.maxTouchPoints > 0 && window.matchMedia('(pointer: coarse)').matches
|
|
45
45
|
});
|
|
46
46
|
export const getScreenSize = width => {
|
|
47
47
|
let value;
|
|
@@ -22,12 +22,29 @@ export interface DialogDate {
|
|
|
22
22
|
monthSelect?: boolean;
|
|
23
23
|
yearSelect?: boolean;
|
|
24
24
|
}
|
|
25
|
+
export declare enum ToastType {
|
|
26
|
+
NEUTRAL = 1,
|
|
27
|
+
SUCCESS = 2,
|
|
28
|
+
WARNING = 3,
|
|
29
|
+
ERROR = 4
|
|
30
|
+
}
|
|
31
|
+
export interface DialogToast {
|
|
32
|
+
type: DialogType.TOAST;
|
|
33
|
+
icon?: string;
|
|
34
|
+
showDurationBar?: boolean;
|
|
35
|
+
duration?: number;
|
|
36
|
+
linkText?: string;
|
|
37
|
+
onLinkClick?: () => void;
|
|
38
|
+
permanent?: boolean;
|
|
39
|
+
showCloseIcon?: boolean;
|
|
40
|
+
toastType?: ToastType;
|
|
41
|
+
}
|
|
25
42
|
export interface BaseDialog {
|
|
26
43
|
text?: string;
|
|
27
44
|
buttons?: DialogButton[];
|
|
28
45
|
dialogId: number;
|
|
29
46
|
}
|
|
30
|
-
export type Dialog = BaseDialog & (DialogInput | DialogModule | DialogIFrame | DialogSelect | DialogDate);
|
|
47
|
+
export type Dialog = BaseDialog & (DialogInput | DialogModule | DialogIFrame | DialogSelect | DialogDate | DialogToast);
|
|
31
48
|
export interface DialogModule {
|
|
32
49
|
type: DialogType.MODULE;
|
|
33
50
|
system: {
|
|
@@ -42,18 +59,38 @@ export interface DialogIFrame {
|
|
|
42
59
|
url: string;
|
|
43
60
|
dialogInput: object;
|
|
44
61
|
}
|
|
62
|
+
export declare enum DialogInputType {
|
|
63
|
+
NUMBER = "number",
|
|
64
|
+
PASSWORD = "password",
|
|
65
|
+
TELEPHONE = "tel",
|
|
66
|
+
TEXT = "text"
|
|
67
|
+
}
|
|
45
68
|
export interface DialogInput {
|
|
46
69
|
type: DialogType.INPUT;
|
|
47
70
|
placeholder: string;
|
|
71
|
+
inputType: DialogInputType;
|
|
72
|
+
defaultValue?: string;
|
|
73
|
+
formatter?: (input: string) => string;
|
|
48
74
|
}
|
|
75
|
+
export declare enum DialogSelectType {
|
|
76
|
+
DEFAULT = 0,
|
|
77
|
+
ICON = 1
|
|
78
|
+
}
|
|
79
|
+
export type DialogSelectListItemType = {
|
|
80
|
+
id: number;
|
|
81
|
+
name: string;
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
isSelected?: boolean;
|
|
84
|
+
url?: string;
|
|
85
|
+
};
|
|
49
86
|
export interface DialogSelect {
|
|
50
87
|
type: DialogType.SELECT;
|
|
51
|
-
list:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
88
|
+
list: DialogSelectListItemType[];
|
|
89
|
+
multiselect?: boolean;
|
|
90
|
+
quickfind?: boolean;
|
|
91
|
+
selectType?: DialogSelectType;
|
|
92
|
+
preventCloseOnClick?: boolean;
|
|
93
|
+
selectAllCheckbox?: string;
|
|
57
94
|
}
|
|
58
95
|
export declare enum DialogButtonType {
|
|
59
96
|
OK = 1,
|