dry-ux 1.71.0 → 1.73.0
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/dist/dajaxice/DajaxiceCall.js +1 -1
- package/dist/dajaxice/Proxy.interface.d.ts +4 -0
- package/dist/enhanced-inputs/Element.d.ts +105 -0
- package/dist/enhanced-inputs/Element.js +145 -0
- package/dist/enhanced-inputs/Validaition.d.ts +0 -74
- package/dist/enhanced-inputs/Validaition.js +6 -104
- package/dist/error/ErrorBoundary.stories.d.ts +5 -0
- package/dist/error/ErrorBoundary.stories.js +23 -0
- package/dist/error/ErrorScreen.stories.d.ts +4 -0
- package/dist/error/ErrorScreen.stories.js +12 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -2
- package/dist/styles/helper.css +863 -0
- package/dist/ui-utils/Money.stories.d.ts +7 -0
- package/dist/ui-utils/Money.stories.js +34 -0
- package/dist/ui-utils/RenderWhenVisible.stories.d.ts +4 -0
- package/dist/ui-utils/RenderWhenVisible.stories.js +15 -0
- package/dist/ui-utils/Spinner.stories.d.ts +7 -0
- package/dist/ui-utils/Spinner.stories.js +11 -0
- package/package.json +15 -4
|
@@ -98,7 +98,7 @@ class DajaxiceCall {
|
|
|
98
98
|
this.callApi();
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
|
-
(0, utilities_1.fnWithAuthCheck)(this.callApi, authCheck.url, authCheck.redirectUrl).catch(this.handleError);
|
|
101
|
+
(0, utilities_1.fnWithAuthCheck)(this.callApi, authCheck.url, authCheck.redirectUrl).catch(authCheck.onError || this.handleError);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
@@ -70,6 +70,10 @@ export interface IDajaxiceProxy<TModule> {
|
|
|
70
70
|
* The URL to redirect to if not authenticated.
|
|
71
71
|
*/
|
|
72
72
|
redirectUrl: string;
|
|
73
|
+
/**
|
|
74
|
+
* The method to call if the authentication check fails.
|
|
75
|
+
*/
|
|
76
|
+
onError?: (error: any) => void;
|
|
73
77
|
};
|
|
74
78
|
/**
|
|
75
79
|
* The error handler function.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export type InputElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
2
|
+
/**
|
|
3
|
+
* Class representing a generic DOM element with utility methods for manipulation and validation.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Element {
|
|
6
|
+
native: HTMLElement;
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of Element.
|
|
9
|
+
* @param native The native HTML element.
|
|
10
|
+
*/
|
|
11
|
+
constructor(native: HTMLElement);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the value of the input element.
|
|
14
|
+
* @returns The value of the input element.
|
|
15
|
+
*/
|
|
16
|
+
val(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Checks if the element has a specific class.
|
|
19
|
+
* @param className The class name to check.
|
|
20
|
+
* @returns True if the element has the class, false otherwise.
|
|
21
|
+
*/
|
|
22
|
+
hasClass(className: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Removes a specific class from the element.
|
|
25
|
+
* @param className The class name to remove.
|
|
26
|
+
*/
|
|
27
|
+
removeClass(className: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the value of a data attribute.
|
|
30
|
+
* @param attribute The data attribute name.
|
|
31
|
+
* @returns The value of the data attribute.
|
|
32
|
+
*/
|
|
33
|
+
data(attribute: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the value of an attribute.
|
|
36
|
+
* @param attribute The attribute name.
|
|
37
|
+
* @returns The value of the attribute or null if not found.
|
|
38
|
+
*/
|
|
39
|
+
attr(attribute: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Checks if the element is visible.
|
|
42
|
+
* @returns True if the element is visible, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
visible(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the closest ancestor element that matches the selector.
|
|
47
|
+
* @param selector The selector to match.
|
|
48
|
+
* @returns The closest ancestor element.
|
|
49
|
+
*/
|
|
50
|
+
parents(selector: string): Element;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the next sibling element.
|
|
53
|
+
* @returns The next sibling element.
|
|
54
|
+
*/
|
|
55
|
+
next(): Element | null;
|
|
56
|
+
/**
|
|
57
|
+
* Inserts HTML after the element.
|
|
58
|
+
* @param html The HTML to insert.
|
|
59
|
+
*/
|
|
60
|
+
after(html: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Adds a class to the element.
|
|
63
|
+
* @param className The class name to add.
|
|
64
|
+
*/
|
|
65
|
+
addClass(className: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Removes the element from the DOM.
|
|
68
|
+
*/
|
|
69
|
+
remove(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the native input element.
|
|
72
|
+
* @returns The native input element.
|
|
73
|
+
*/
|
|
74
|
+
get nativeInput(): InputElement;
|
|
75
|
+
/**
|
|
76
|
+
* Finds an element by its ID.
|
|
77
|
+
* @param id The ID of the element to find.
|
|
78
|
+
* @returns The Element instance if found, null otherwise.
|
|
79
|
+
*/
|
|
80
|
+
static byId(id: string): Element | null;
|
|
81
|
+
/**
|
|
82
|
+
* Finds the first element matching the CSS selector.
|
|
83
|
+
* @param selector The CSS selector to match.
|
|
84
|
+
* @returns The Element instance if found, null otherwise.
|
|
85
|
+
*/
|
|
86
|
+
static bySelector(selector: string): Element | null;
|
|
87
|
+
/**
|
|
88
|
+
* Finds all elements matching the CSS selector.
|
|
89
|
+
* @param selector The CSS selector to match.
|
|
90
|
+
* @returns An array of Element instances.
|
|
91
|
+
*/
|
|
92
|
+
static bySelectorAll(selector: string): Element[];
|
|
93
|
+
/**
|
|
94
|
+
* Finds all elements with the specified tag name.
|
|
95
|
+
* @param tagName The tag name to match.
|
|
96
|
+
* @returns An array of Element instances.
|
|
97
|
+
*/
|
|
98
|
+
static byTagName(tagName: string): Element[];
|
|
99
|
+
/**
|
|
100
|
+
* Finds all elements with the specified class name.
|
|
101
|
+
* @param className The class name to match.
|
|
102
|
+
* @returns An array of Element instances.
|
|
103
|
+
*/
|
|
104
|
+
static byClassName(className: string): Element[];
|
|
105
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Element = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Class representing a generic DOM element with utility methods for manipulation and validation.
|
|
6
|
+
*/
|
|
7
|
+
class Element {
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of Element.
|
|
10
|
+
* @param native The native HTML element.
|
|
11
|
+
*/
|
|
12
|
+
constructor(native) {
|
|
13
|
+
this.native = native;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Gets the value of the input element.
|
|
17
|
+
* @returns The value of the input element.
|
|
18
|
+
*/
|
|
19
|
+
val() {
|
|
20
|
+
return this.nativeInput.value;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the element has a specific class.
|
|
24
|
+
* @param className The class name to check.
|
|
25
|
+
* @returns True if the element has the class, false otherwise.
|
|
26
|
+
*/
|
|
27
|
+
hasClass(className) {
|
|
28
|
+
return this.native.classList.contains(className);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Removes a specific class from the element.
|
|
32
|
+
* @param className The class name to remove.
|
|
33
|
+
*/
|
|
34
|
+
removeClass(className) {
|
|
35
|
+
this.native.classList.remove(className);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets the value of a data attribute.
|
|
39
|
+
* @param attribute The data attribute name.
|
|
40
|
+
* @returns The value of the data attribute.
|
|
41
|
+
*/
|
|
42
|
+
data(attribute) {
|
|
43
|
+
return this.native.getAttribute(["data"].concat(attribute.split(/(?=[A-Z])/).map(s => s.toLowerCase())).join("-"));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets the value of an attribute.
|
|
47
|
+
* @param attribute The attribute name.
|
|
48
|
+
* @returns The value of the attribute or null if not found.
|
|
49
|
+
*/
|
|
50
|
+
attr(attribute) {
|
|
51
|
+
return this.native.getAttribute(attribute);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Checks if the element is visible.
|
|
55
|
+
* @returns True if the element is visible, false otherwise.
|
|
56
|
+
*/
|
|
57
|
+
visible() {
|
|
58
|
+
return !!(this.native.offsetWidth || this.native.offsetHeight || this.native.getClientRects().length);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets the closest ancestor element that matches the selector.
|
|
62
|
+
* @param selector The selector to match.
|
|
63
|
+
* @returns The closest ancestor element.
|
|
64
|
+
*/
|
|
65
|
+
parents(selector) {
|
|
66
|
+
return new Element(this.native.closest(selector));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Gets the next sibling element.
|
|
70
|
+
* @returns The next sibling element.
|
|
71
|
+
*/
|
|
72
|
+
next() {
|
|
73
|
+
return !!this.native.nextElementSibling ? new Element(this.native.nextElementSibling) : null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Inserts HTML after the element.
|
|
77
|
+
* @param html The HTML to insert.
|
|
78
|
+
*/
|
|
79
|
+
after(html) {
|
|
80
|
+
this.native.insertAdjacentHTML("afterend", html);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Adds a class to the element.
|
|
84
|
+
* @param className The class name to add.
|
|
85
|
+
*/
|
|
86
|
+
addClass(className) {
|
|
87
|
+
this.native.classList.add(className);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Removes the element from the DOM.
|
|
91
|
+
*/
|
|
92
|
+
remove() {
|
|
93
|
+
this.native.remove();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Gets the native input element.
|
|
97
|
+
* @returns The native input element.
|
|
98
|
+
*/
|
|
99
|
+
get nativeInput() {
|
|
100
|
+
return this.native;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Finds an element by its ID.
|
|
104
|
+
* @param id The ID of the element to find.
|
|
105
|
+
* @returns The Element instance if found, null otherwise.
|
|
106
|
+
*/
|
|
107
|
+
static byId(id) {
|
|
108
|
+
const element = document.getElementById(id);
|
|
109
|
+
return element ? new Element(element) : null;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Finds the first element matching the CSS selector.
|
|
113
|
+
* @param selector The CSS selector to match.
|
|
114
|
+
* @returns The Element instance if found, null otherwise.
|
|
115
|
+
*/
|
|
116
|
+
static bySelector(selector) {
|
|
117
|
+
const element = document.querySelector(selector);
|
|
118
|
+
return element ? new Element(element) : null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Finds all elements matching the CSS selector.
|
|
122
|
+
* @param selector The CSS selector to match.
|
|
123
|
+
* @returns An array of Element instances.
|
|
124
|
+
*/
|
|
125
|
+
static bySelectorAll(selector) {
|
|
126
|
+
return Array.from(document.querySelectorAll(selector)).map(el => new Element(el));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Finds all elements with the specified tag name.
|
|
130
|
+
* @param tagName The tag name to match.
|
|
131
|
+
* @returns An array of Element instances.
|
|
132
|
+
*/
|
|
133
|
+
static byTagName(tagName) {
|
|
134
|
+
return Array.from(document.getElementsByTagName(tagName)).map(el => new Element(el));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Finds all elements with the specified class name.
|
|
138
|
+
* @param className The class name to match.
|
|
139
|
+
* @returns An array of Element instances.
|
|
140
|
+
*/
|
|
141
|
+
static byClassName(className) {
|
|
142
|
+
return Array.from(document.getElementsByClassName(className)).map(el => new Element(el));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.Element = Element;
|
|
@@ -1,77 +1,3 @@
|
|
|
1
|
-
type InputElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
2
|
-
/**
|
|
3
|
-
* Class representing a generic DOM element with utility methods for manipulation and validation.
|
|
4
|
-
*/
|
|
5
|
-
export declare class Element {
|
|
6
|
-
native: HTMLElement;
|
|
7
|
-
/**
|
|
8
|
-
* Creates an instance of Element.
|
|
9
|
-
* @param native The native HTML element.
|
|
10
|
-
*/
|
|
11
|
-
constructor(native: HTMLElement);
|
|
12
|
-
/**
|
|
13
|
-
* Gets the value of the input element.
|
|
14
|
-
* @returns The value of the input element.
|
|
15
|
-
*/
|
|
16
|
-
val(): string;
|
|
17
|
-
/**
|
|
18
|
-
* Checks if the element has a specific class.
|
|
19
|
-
* @param className The class name to check.
|
|
20
|
-
* @returns True if the element has the class, false otherwise.
|
|
21
|
-
*/
|
|
22
|
-
hasClass(className: string): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Removes a specific class from the element.
|
|
25
|
-
* @param className The class name to remove.
|
|
26
|
-
*/
|
|
27
|
-
removeClass(className: string): void;
|
|
28
|
-
/**
|
|
29
|
-
* Gets the value of a data attribute.
|
|
30
|
-
* @param attribute The data attribute name.
|
|
31
|
-
* @returns The value of the data attribute.
|
|
32
|
-
*/
|
|
33
|
-
data(attribute: string): string;
|
|
34
|
-
/**
|
|
35
|
-
* Gets the value of an attribute.
|
|
36
|
-
* @param attribute
|
|
37
|
-
*/
|
|
38
|
-
attr(attribute: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* Checks if the element is visible.
|
|
41
|
-
* @returns True if the element is visible, false otherwise.
|
|
42
|
-
*/
|
|
43
|
-
visible(): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Gets the closest ancestor element that matches the selector.
|
|
46
|
-
* @param selector The selector to match.
|
|
47
|
-
* @returns The closest ancestor element.
|
|
48
|
-
*/
|
|
49
|
-
parents(selector: string): Element;
|
|
50
|
-
/**
|
|
51
|
-
* Gets the next sibling element.
|
|
52
|
-
* @returns The next sibling element.
|
|
53
|
-
*/
|
|
54
|
-
next(): Element | null;
|
|
55
|
-
/**
|
|
56
|
-
* Inserts HTML after the element.
|
|
57
|
-
* @param html The HTML to insert.
|
|
58
|
-
*/
|
|
59
|
-
after(html: string): void;
|
|
60
|
-
/**
|
|
61
|
-
* Adds a class to the element.
|
|
62
|
-
* @param className The class name to add.
|
|
63
|
-
*/
|
|
64
|
-
addClass(className: string): void;
|
|
65
|
-
/**
|
|
66
|
-
* Removes the element from the DOM.
|
|
67
|
-
*/
|
|
68
|
-
remove(): void;
|
|
69
|
-
/**
|
|
70
|
-
* Gets the native input element.
|
|
71
|
-
* @returns The native input element.
|
|
72
|
-
*/
|
|
73
|
-
get nativeInput(): InputElement;
|
|
74
|
-
}
|
|
75
1
|
/**
|
|
76
2
|
* Options for configuring the validation.
|
|
77
3
|
*/
|
|
@@ -1,106 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Validation =
|
|
3
|
+
exports.Validation = void 0;
|
|
4
|
+
const Element_1 = require("./Element");
|
|
4
5
|
const daysOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
5
|
-
/**
|
|
6
|
-
* Class representing a generic DOM element with utility methods for manipulation and validation.
|
|
7
|
-
*/
|
|
8
|
-
class Element {
|
|
9
|
-
/**
|
|
10
|
-
* Creates an instance of Element.
|
|
11
|
-
* @param native The native HTML element.
|
|
12
|
-
*/
|
|
13
|
-
constructor(native) {
|
|
14
|
-
this.native = native;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Gets the value of the input element.
|
|
18
|
-
* @returns The value of the input element.
|
|
19
|
-
*/
|
|
20
|
-
val() {
|
|
21
|
-
return this.nativeInput.value;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Checks if the element has a specific class.
|
|
25
|
-
* @param className The class name to check.
|
|
26
|
-
* @returns True if the element has the class, false otherwise.
|
|
27
|
-
*/
|
|
28
|
-
hasClass(className) {
|
|
29
|
-
return this.native.classList.contains(className);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Removes a specific class from the element.
|
|
33
|
-
* @param className The class name to remove.
|
|
34
|
-
*/
|
|
35
|
-
removeClass(className) {
|
|
36
|
-
this.native.classList.remove(className);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Gets the value of a data attribute.
|
|
40
|
-
* @param attribute The data attribute name.
|
|
41
|
-
* @returns The value of the data attribute.
|
|
42
|
-
*/
|
|
43
|
-
data(attribute) {
|
|
44
|
-
return this.native.getAttribute(["data"].concat(attribute.split(/(?=[A-Z])/).map(s => s.toLowerCase())).join("-"));
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Gets the value of an attribute.
|
|
48
|
-
* @param attribute
|
|
49
|
-
*/
|
|
50
|
-
attr(attribute) {
|
|
51
|
-
return this.native.getAttribute(attribute);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Checks if the element is visible.
|
|
55
|
-
* @returns True if the element is visible, false otherwise.
|
|
56
|
-
*/
|
|
57
|
-
visible() {
|
|
58
|
-
return !!(this.native.offsetWidth || this.native.offsetHeight || this.native.getClientRects().length);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Gets the closest ancestor element that matches the selector.
|
|
62
|
-
* @param selector The selector to match.
|
|
63
|
-
* @returns The closest ancestor element.
|
|
64
|
-
*/
|
|
65
|
-
parents(selector) {
|
|
66
|
-
return new Element(this.native.closest(selector));
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Gets the next sibling element.
|
|
70
|
-
* @returns The next sibling element.
|
|
71
|
-
*/
|
|
72
|
-
next() {
|
|
73
|
-
return !!this.native.nextElementSibling ? new Element(this.native.nextElementSibling) : null;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Inserts HTML after the element.
|
|
77
|
-
* @param html The HTML to insert.
|
|
78
|
-
*/
|
|
79
|
-
after(html) {
|
|
80
|
-
this.native.insertAdjacentHTML("afterend", html);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Adds a class to the element.
|
|
84
|
-
* @param className The class name to add.
|
|
85
|
-
*/
|
|
86
|
-
addClass(className) {
|
|
87
|
-
this.native.classList.add(className);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Removes the element from the DOM.
|
|
91
|
-
*/
|
|
92
|
-
remove() {
|
|
93
|
-
this.native.remove();
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Gets the native input element.
|
|
97
|
-
* @returns The native input element.
|
|
98
|
-
*/
|
|
99
|
-
get nativeInput() {
|
|
100
|
-
return this.native;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.Element = Element;
|
|
104
6
|
/**
|
|
105
7
|
* Class representing form validation.
|
|
106
8
|
*/
|
|
@@ -115,7 +17,7 @@ class Validation {
|
|
|
115
17
|
* @param form The form element.
|
|
116
18
|
* @returns An array of elements to be validated.
|
|
117
19
|
*/
|
|
118
|
-
this.getElements = (form) => Array.from(form.getElementsByClassName("validate")).map(field => new Element(field));
|
|
20
|
+
this.getElements = (form) => Array.from(form.getElementsByClassName("validate")).map(field => new Element_1.Element(field));
|
|
119
21
|
const { form, modernErrorMessage } = options || {};
|
|
120
22
|
if ((form === null || form === void 0 ? void 0 : form.id) || (form === null || form === void 0 ? void 0 : form.element)) {
|
|
121
23
|
this.form = typeof form.id ? document.getElementById(form.id) : form.element;
|
|
@@ -130,7 +32,7 @@ class Validation {
|
|
|
130
32
|
* @param input The input element or its ID.
|
|
131
33
|
*/
|
|
132
34
|
bindToValueChanges(input) {
|
|
133
|
-
const element = typeof input === "string" ? new Element(document.getElementById(input)) : new Element(input);
|
|
35
|
+
const element = typeof input === "string" ? new Element_1.Element(document.getElementById(input)) : new Element_1.Element(input);
|
|
134
36
|
element.native.addEventListener("change", event => this.validate(element));
|
|
135
37
|
}
|
|
136
38
|
/**
|
|
@@ -154,7 +56,7 @@ class Validation {
|
|
|
154
56
|
* @returns True if the input is valid, false otherwise.
|
|
155
57
|
*/
|
|
156
58
|
validateInput(input) {
|
|
157
|
-
const element = typeof input === "string" ? new Element(document.getElementById(input)) : new Element(input);
|
|
59
|
+
const element = typeof input === "string" ? new Element_1.Element(document.getElementById(input)) : new Element_1.Element(input);
|
|
158
60
|
return this.validate(element);
|
|
159
61
|
}
|
|
160
62
|
/**
|
|
@@ -234,7 +136,7 @@ class Validation {
|
|
|
234
136
|
//Optional: data-compare-message
|
|
235
137
|
if (element.hasClass("validate-compare") && isValid) {
|
|
236
138
|
if (element.data("compare") != null) {
|
|
237
|
-
const compareTo = new Element(document.getElementById(element.data("compare"))).val();
|
|
139
|
+
const compareTo = new Element_1.Element(document.getElementById(element.data("compare"))).val();
|
|
238
140
|
isValid = compareTo == value;
|
|
239
141
|
if (element.data("compareMessage") != null)
|
|
240
142
|
errorMsg = element.data("compareMessage");
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WithError = exports.Default = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const ErrorBoundary_1 = require("./ErrorBoundary");
|
|
6
|
+
exports.default = {
|
|
7
|
+
title: "ErrorBoundary",
|
|
8
|
+
component: ErrorBoundary_1.ErrorBoundary,
|
|
9
|
+
};
|
|
10
|
+
const Template = args => (React.createElement(ErrorBoundary_1.ErrorBoundary, Object.assign({}, args),
|
|
11
|
+
React.createElement("div", null, "Child component content")));
|
|
12
|
+
exports.Default = Template.bind({});
|
|
13
|
+
exports.Default.args = {};
|
|
14
|
+
exports.WithError = Template.bind({});
|
|
15
|
+
exports.WithError.args = {
|
|
16
|
+
fallback: (error, resetError) => (React.createElement("div", null,
|
|
17
|
+
React.createElement("h1", null, "Custom Fallback UI"),
|
|
18
|
+
React.createElement("p", null, error.message),
|
|
19
|
+
React.createElement("button", { onClick: resetError }, "Try Again"))),
|
|
20
|
+
children: (() => {
|
|
21
|
+
throw new Error("Test error");
|
|
22
|
+
})(),
|
|
23
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const ErrorScreen_1 = require("./ErrorScreen");
|
|
6
|
+
exports.default = {
|
|
7
|
+
title: "ErrorScreen",
|
|
8
|
+
component: ErrorScreen_1.ErrorScreen,
|
|
9
|
+
};
|
|
10
|
+
const Template = args => React.createElement(ErrorScreen_1.ErrorScreen, Object.assign({}, args));
|
|
11
|
+
exports.Default = Template.bind({});
|
|
12
|
+
exports.Default.args = {};
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,8 @@ export { ErrorScreen } from "./error/ErrorScreen";
|
|
|
14
14
|
export { Loader } from "./ui-utils/Loader";
|
|
15
15
|
export { Spinner } from "./ui-utils/Spinner";
|
|
16
16
|
export { RenderWhenVisible } from "./ui-utils/RenderWhenVisible";
|
|
17
|
-
export { Validation
|
|
17
|
+
export { Validation } from "./enhanced-inputs/Validaition";
|
|
18
18
|
export { Viewport } from "./ui-utils/ViewportDetect";
|
|
19
19
|
export * from "./enhanced-inputs/HTMLInputs";
|
|
20
20
|
export * from "./enhanced-inputs/interface";
|
|
21
|
+
export { Element } from "./enhanced-inputs/Element";
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.Element = exports.Viewport = exports.Validation = exports.RenderWhenVisible = exports.Spinner = exports.Loader = exports.ErrorScreen = exports.ErrorBoundary = exports.DajaxiceProxy = exports.unflatten = exports.flatten = exports.classSet = exports.DryUXProvider = exports.Money = exports.DryUXRenderer = exports.DryUXContext = exports.useDryUxContext = void 0;
|
|
18
18
|
var UIUtilProvider_1 = require("./ui-utils/UIUtilProvider");
|
|
19
19
|
Object.defineProperty(exports, "useDryUxContext", { enumerable: true, get: function () { return UIUtilProvider_1.useUIUtilContext; } });
|
|
20
20
|
Object.defineProperty(exports, "DryUXContext", { enumerable: true, get: function () { return UIUtilProvider_1.UIUtilContext; } });
|
|
@@ -46,8 +46,9 @@ var RenderWhenVisible_1 = require("./ui-utils/RenderWhenVisible");
|
|
|
46
46
|
Object.defineProperty(exports, "RenderWhenVisible", { enumerable: true, get: function () { return RenderWhenVisible_1.RenderWhenVisible; } });
|
|
47
47
|
var Validaition_1 = require("./enhanced-inputs/Validaition");
|
|
48
48
|
Object.defineProperty(exports, "Validation", { enumerable: true, get: function () { return Validaition_1.Validation; } });
|
|
49
|
-
Object.defineProperty(exports, "Element", { enumerable: true, get: function () { return Validaition_1.Element; } });
|
|
50
49
|
var ViewportDetect_1 = require("./ui-utils/ViewportDetect");
|
|
51
50
|
Object.defineProperty(exports, "Viewport", { enumerable: true, get: function () { return ViewportDetect_1.Viewport; } });
|
|
52
51
|
__exportStar(require("./enhanced-inputs/HTMLInputs"), exports);
|
|
53
52
|
__exportStar(require("./enhanced-inputs/interface"), exports);
|
|
53
|
+
var Element_1 = require("./enhanced-inputs/Element");
|
|
54
|
+
Object.defineProperty(exports, "Element", { enumerable: true, get: function () { return Element_1.Element; } });
|