@pepperi-addons/ngx-lib-react 0.5.0 → 0.5.1
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/README.md +48 -0
- package/elements/3rdpartylicenses.txt +28 -0
- package/elements/main.js +1 -1
- package/http-helpers.d.ts +49 -0
- package/http-helpers.js +164 -0
- package/index.d.ts +15 -0
- package/index.js +17 -0
- package/package.json +1 -1
- package/pep-address.d.ts +38 -0
- package/pep-address.js +71 -0
- package/pep-attachment.d.ts +24 -0
- package/pep-attachment.js +76 -0
- package/pep-bread-crumbs.d.ts +16 -0
- package/pep-bread-crumbs.js +35 -0
- package/pep-carousel.d.ts +28 -0
- package/pep-carousel.js +80 -0
- package/pep-checkbox.d.ts +5 -0
- package/pep-checkbox.js +16 -1
- package/pep-chips.d.ts +6 -0
- package/pep-chips.js +13 -3
- package/pep-color-picker.d.ts +9 -0
- package/pep-color-picker.js +27 -0
- package/pep-color.d.ts +6 -0
- package/pep-color.js +14 -2
- package/pep-date.d.ts +25 -0
- package/pep-date.js +84 -7
- package/pep-dialog.d.ts +9 -0
- package/pep-dialog.js +34 -0
- package/pep-icon.d.ts +8 -0
- package/pep-icon.js +18 -0
- package/pep-image.d.ts +32 -0
- package/pep-image.js +89 -0
- package/pep-images-filmstrip.d.ts +16 -0
- package/pep-images-filmstrip.js +40 -0
- package/pep-link.d.ts +9 -0
- package/pep-link.js +21 -3
- package/pep-page-layout.d.ts +11 -0
- package/pep-page-layout.js +19 -0
- package/pep-search.d.ts +27 -0
- package/pep-search.js +59 -0
- package/pep-select.d.ts +14 -0
- package/pep-select.js +55 -7
- package/pep-separator.d.ts +2 -0
- package/pep-separator.js +6 -2
- package/pep-skeleton-loader.d.ts +8 -0
- package/pep-skeleton-loader.js +30 -0
- package/pep-snack-bar.d.ts +7 -0
- package/pep-snack-bar.js +33 -0
- package/pep-textarea.d.ts +14 -0
- package/pep-textarea.js +36 -8
- package/pep-textbox.d.ts +15 -0
- package/pep-textbox.js +46 -1
- package/services.d.ts +15 -0
- package/services.js +27 -0
- package/types.d.ts +9 -0
- package/types.js +9 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Helper Functions for React
|
|
3
|
+
*
|
|
4
|
+
* These are standalone functions that wrap common HTTP patterns from PepHttpService
|
|
5
|
+
* without requiring Angular's dependency injection.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* HTTP request options
|
|
9
|
+
*/
|
|
10
|
+
export interface PepHttpOptions {
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
params?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Make a GET HTTP request with optional authorization
|
|
16
|
+
*/
|
|
17
|
+
export declare function pepHttpGet<T = any>(url: string, options?: PepHttpOptions): Promise<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Make a POST HTTP request with optional authorization
|
|
20
|
+
*/
|
|
21
|
+
export declare function pepHttpPost<T = any>(url: string, body: any, options?: PepHttpOptions): Promise<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Make a PUT HTTP request with optional authorization
|
|
24
|
+
*/
|
|
25
|
+
export declare function pepHttpPut<T = any>(url: string, body: any, options?: PepHttpOptions): Promise<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Make a DELETE HTTP request with optional authorization
|
|
28
|
+
*/
|
|
29
|
+
export declare function pepHttpDelete<T = any>(url: string, options?: PepHttpOptions): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Make a PATCH HTTP request with optional authorization
|
|
32
|
+
*/
|
|
33
|
+
export declare function pepHttpPatch<T = any>(url: string, body: any, options?: PepHttpOptions): Promise<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Helper to add Bearer token to headers
|
|
36
|
+
*/
|
|
37
|
+
export declare function addBearerToken(token: string, options?: PepHttpOptions): PepHttpOptions;
|
|
38
|
+
/**
|
|
39
|
+
* Helper to add Pepperi session token to headers
|
|
40
|
+
*/
|
|
41
|
+
export declare function addPepperiSessionToken(token: string, options?: PepHttpOptions): PepHttpOptions;
|
|
42
|
+
/**
|
|
43
|
+
* Build URL with query parameters
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildUrl(baseUrl: string, params: Record<string, any>): string;
|
|
46
|
+
/**
|
|
47
|
+
* Retry a request with exponential backoff
|
|
48
|
+
*/
|
|
49
|
+
export declare function pepHttpRetry<T>(requestFn: () => Promise<T>, maxRetries?: number, delayMs?: number): Promise<T>;
|
package/http-helpers.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Helper Functions for React
|
|
3
|
+
*
|
|
4
|
+
* These are standalone functions that wrap common HTTP patterns from PepHttpService
|
|
5
|
+
* without requiring Angular's dependency injection.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Make a GET HTTP request with optional authorization
|
|
9
|
+
*/
|
|
10
|
+
export async function pepHttpGet(url, options = {}) {
|
|
11
|
+
const headers = new Headers({
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
...options.headers
|
|
14
|
+
});
|
|
15
|
+
// Add query params if provided
|
|
16
|
+
let fullUrl = url;
|
|
17
|
+
if (options.params) {
|
|
18
|
+
const params = new URLSearchParams(options.params);
|
|
19
|
+
fullUrl = `${url}?${params.toString()}`;
|
|
20
|
+
}
|
|
21
|
+
const response = await fetch(fullUrl, {
|
|
22
|
+
method: 'GET',
|
|
23
|
+
headers,
|
|
24
|
+
credentials: 'include' // Include cookies for authentication
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
throw new Error(`HTTP Error ${response.status}: ${response.statusText}`);
|
|
28
|
+
}
|
|
29
|
+
return response.json();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Make a POST HTTP request with optional authorization
|
|
33
|
+
*/
|
|
34
|
+
export async function pepHttpPost(url, body, options = {}) {
|
|
35
|
+
const headers = new Headers({
|
|
36
|
+
'Content-Type': 'application/json',
|
|
37
|
+
...options.headers
|
|
38
|
+
});
|
|
39
|
+
const response = await fetch(url, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers,
|
|
42
|
+
body: JSON.stringify(body),
|
|
43
|
+
credentials: 'include' // Include cookies for authentication
|
|
44
|
+
});
|
|
45
|
+
if (!response.ok) {
|
|
46
|
+
throw new Error(`HTTP Error ${response.status}: ${response.statusText}`);
|
|
47
|
+
}
|
|
48
|
+
return response.json();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Make a PUT HTTP request with optional authorization
|
|
52
|
+
*/
|
|
53
|
+
export async function pepHttpPut(url, body, options = {}) {
|
|
54
|
+
const headers = new Headers({
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
...options.headers
|
|
57
|
+
});
|
|
58
|
+
const response = await fetch(url, {
|
|
59
|
+
method: 'PUT',
|
|
60
|
+
headers,
|
|
61
|
+
body: JSON.stringify(body),
|
|
62
|
+
credentials: 'include'
|
|
63
|
+
});
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
throw new Error(`HTTP Error ${response.status}: ${response.statusText}`);
|
|
66
|
+
}
|
|
67
|
+
return response.json();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Make a DELETE HTTP request with optional authorization
|
|
71
|
+
*/
|
|
72
|
+
export async function pepHttpDelete(url, options = {}) {
|
|
73
|
+
const headers = new Headers({
|
|
74
|
+
'Content-Type': 'application/json',
|
|
75
|
+
...options.headers
|
|
76
|
+
});
|
|
77
|
+
const response = await fetch(url, {
|
|
78
|
+
method: 'DELETE',
|
|
79
|
+
headers,
|
|
80
|
+
credentials: 'include'
|
|
81
|
+
});
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
throw new Error(`HTTP Error ${response.status}: ${response.statusText}`);
|
|
84
|
+
}
|
|
85
|
+
// DELETE might return empty response
|
|
86
|
+
const text = await response.text();
|
|
87
|
+
return text ? JSON.parse(text) : null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Make a PATCH HTTP request with optional authorization
|
|
91
|
+
*/
|
|
92
|
+
export async function pepHttpPatch(url, body, options = {}) {
|
|
93
|
+
const headers = new Headers({
|
|
94
|
+
'Content-Type': 'application/json',
|
|
95
|
+
...options.headers
|
|
96
|
+
});
|
|
97
|
+
const response = await fetch(url, {
|
|
98
|
+
method: 'PATCH',
|
|
99
|
+
headers,
|
|
100
|
+
body: JSON.stringify(body),
|
|
101
|
+
credentials: 'include'
|
|
102
|
+
});
|
|
103
|
+
if (!response.ok) {
|
|
104
|
+
throw new Error(`HTTP Error ${response.status}: ${response.statusText}`);
|
|
105
|
+
}
|
|
106
|
+
return response.json();
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Helper to add Bearer token to headers
|
|
110
|
+
*/
|
|
111
|
+
export function addBearerToken(token, options = {}) {
|
|
112
|
+
return {
|
|
113
|
+
...options,
|
|
114
|
+
headers: {
|
|
115
|
+
...options.headers,
|
|
116
|
+
'Authorization': `Bearer ${token}`
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Helper to add Pepperi session token to headers
|
|
122
|
+
*/
|
|
123
|
+
export function addPepperiSessionToken(token, options = {}) {
|
|
124
|
+
return {
|
|
125
|
+
...options,
|
|
126
|
+
headers: {
|
|
127
|
+
...options.headers,
|
|
128
|
+
'PepperiSessionToken': token
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Build URL with query parameters
|
|
134
|
+
*/
|
|
135
|
+
export function buildUrl(baseUrl, params) {
|
|
136
|
+
const searchParams = new URLSearchParams();
|
|
137
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
138
|
+
if (value !== null && value !== undefined) {
|
|
139
|
+
searchParams.append(key, String(value));
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
const queryString = searchParams.toString();
|
|
143
|
+
return queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Retry a request with exponential backoff
|
|
147
|
+
*/
|
|
148
|
+
export async function pepHttpRetry(requestFn, maxRetries = 3, delayMs = 1000) {
|
|
149
|
+
let lastError;
|
|
150
|
+
for (let i = 0; i < maxRetries; i++) {
|
|
151
|
+
try {
|
|
152
|
+
return await requestFn();
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
lastError = error;
|
|
156
|
+
if (i < maxRetries - 1) {
|
|
157
|
+
// Wait with exponential backoff
|
|
158
|
+
await new Promise(resolve => setTimeout(resolve, delayMs * Math.pow(2, i)));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
throw lastError;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=http-helpers.js.map
|
package/index.d.ts
CHANGED
|
@@ -14,3 +14,18 @@ export * from './pep-menu.js';
|
|
|
14
14
|
export * from './pep-separator.js';
|
|
15
15
|
export * from './pep-draggable-item.js';
|
|
16
16
|
export * from './pep-checkbox.js';
|
|
17
|
+
export * from './pep-dialog.js';
|
|
18
|
+
export { PepImage } from './pep-image.js';
|
|
19
|
+
export { PepImagesFilmstrip } from './pep-images-filmstrip.js';
|
|
20
|
+
export { PepAttachment } from './pep-attachment.js';
|
|
21
|
+
export { PepBreadCrumbs } from './pep-bread-crumbs.js';
|
|
22
|
+
export { PepSkeletonLoader } from './pep-skeleton-loader.js';
|
|
23
|
+
export { PepSearch } from './pep-search.js';
|
|
24
|
+
export { PepSnackBar } from './pep-snack-bar.js';
|
|
25
|
+
export { PepPageLayout } from './pep-page-layout.js';
|
|
26
|
+
export { PepCarousel } from './pep-carousel.js';
|
|
27
|
+
export { PepIcon } from './pep-icon.js';
|
|
28
|
+
export { PepAddress } from './pep-address.js';
|
|
29
|
+
export * from './pep-color-picker.js';
|
|
30
|
+
export * from './services.js';
|
|
31
|
+
export * from './http-helpers.js';
|
package/index.js
CHANGED
|
@@ -14,4 +14,21 @@ export * from './pep-menu.js';
|
|
|
14
14
|
export * from './pep-separator.js';
|
|
15
15
|
export * from './pep-draggable-item.js';
|
|
16
16
|
export * from './pep-checkbox.js';
|
|
17
|
+
export * from './pep-dialog.js';
|
|
18
|
+
export { PepImage } from './pep-image.js';
|
|
19
|
+
export { PepImagesFilmstrip } from './pep-images-filmstrip.js';
|
|
20
|
+
export { PepAttachment } from './pep-attachment.js';
|
|
21
|
+
export { PepBreadCrumbs } from './pep-bread-crumbs.js';
|
|
22
|
+
export { PepSkeletonLoader } from './pep-skeleton-loader.js';
|
|
23
|
+
export { PepSearch } from './pep-search.js';
|
|
24
|
+
export { PepSnackBar } from './pep-snack-bar.js';
|
|
25
|
+
export { PepPageLayout } from './pep-page-layout.js';
|
|
26
|
+
export { PepCarousel } from './pep-carousel.js';
|
|
27
|
+
export { PepIcon } from './pep-icon.js';
|
|
28
|
+
export { PepAddress } from './pep-address.js';
|
|
29
|
+
export * from './pep-color-picker.js';
|
|
30
|
+
// Export all services
|
|
31
|
+
export * from './services.js';
|
|
32
|
+
// Export HTTP helper functions
|
|
33
|
+
export * from './http-helpers.js';
|
|
17
34
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
package/pep-address.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type PepLayoutType = 'form' | 'card' | 'table';
|
|
3
|
+
export declare type PepHorizontalAlignment = 'left' | 'center' | 'right';
|
|
4
|
+
export interface PepFieldValueChangeEvent {
|
|
5
|
+
key: string;
|
|
6
|
+
value: any;
|
|
7
|
+
}
|
|
8
|
+
export interface PepAddressGroupField {
|
|
9
|
+
key: string;
|
|
10
|
+
value?: any;
|
|
11
|
+
formattedValue?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
type?: string;
|
|
15
|
+
controlType?: 'textbox' | 'select';
|
|
16
|
+
mandatory?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
readonly?: boolean;
|
|
19
|
+
xAlignment?: PepHorizontalAlignment;
|
|
20
|
+
rowSpan?: number;
|
|
21
|
+
colSpan?: number;
|
|
22
|
+
options?: any[];
|
|
23
|
+
}
|
|
24
|
+
export interface PepAddressProps {
|
|
25
|
+
fieldKey?: string;
|
|
26
|
+
formattedValue?: string;
|
|
27
|
+
label?: string;
|
|
28
|
+
mandatory?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
readonly?: boolean;
|
|
31
|
+
visible?: boolean;
|
|
32
|
+
xAlignment?: PepHorizontalAlignment;
|
|
33
|
+
rowSpan?: number;
|
|
34
|
+
groupFields?: PepAddressGroupField[];
|
|
35
|
+
layoutType?: PepLayoutType;
|
|
36
|
+
onAddressValueChange?: (event: PepFieldValueChangeEvent) => void;
|
|
37
|
+
}
|
|
38
|
+
export declare const PepAddress: React.FC<PepAddressProps>;
|
package/pep-address.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
export const PepAddress = ({ fieldKey, formattedValue, label, mandatory, disabled, readonly, visible = true, xAlignment, rowSpan, groupFields, layoutType, onAddressValueChange, }) => {
|
|
4
|
+
const elementRef = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const element = elementRef.current;
|
|
7
|
+
if (!element)
|
|
8
|
+
return;
|
|
9
|
+
// Wait for custom element to be fully upgraded
|
|
10
|
+
const setProperties = () => {
|
|
11
|
+
try {
|
|
12
|
+
if (element && element.key !== undefined) {
|
|
13
|
+
// Phase 1: set structural props first so Angular can create controls
|
|
14
|
+
if (fieldKey !== undefined)
|
|
15
|
+
element.key = fieldKey;
|
|
16
|
+
if (groupFields !== undefined)
|
|
17
|
+
element.groupFields = groupFields;
|
|
18
|
+
if (layoutType !== undefined)
|
|
19
|
+
element.layoutType = layoutType;
|
|
20
|
+
// Phase 2: defer behavioral props to next tick to avoid early validator updates
|
|
21
|
+
const applyPhase2 = () => {
|
|
22
|
+
try {
|
|
23
|
+
if (label !== undefined)
|
|
24
|
+
element.label = label;
|
|
25
|
+
if (xAlignment !== undefined)
|
|
26
|
+
element.xAlignment = xAlignment;
|
|
27
|
+
if (rowSpan !== undefined)
|
|
28
|
+
element.rowSpan = rowSpan;
|
|
29
|
+
if (formattedValue !== undefined)
|
|
30
|
+
element.formattedValue = formattedValue;
|
|
31
|
+
if (mandatory !== undefined)
|
|
32
|
+
element.mandatory = mandatory;
|
|
33
|
+
if (disabled !== undefined)
|
|
34
|
+
element.disabled = disabled;
|
|
35
|
+
if (readonly !== undefined)
|
|
36
|
+
element.readonly = readonly;
|
|
37
|
+
if (visible !== undefined)
|
|
38
|
+
element.visible = visible;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
console.error('Error applying PepAddress phase 2 properties:', e);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
setTimeout(applyPhase2, 0);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// If not ready, try again
|
|
48
|
+
setTimeout(setProperties, 50);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.error('Error setting PepAddress properties:', error);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
setTimeout(setProperties, 100);
|
|
56
|
+
}, [fieldKey, formattedValue, label, mandatory, disabled, readonly, visible, xAlignment, rowSpan, groupFields, layoutType]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const element = elementRef.current;
|
|
59
|
+
if (!element)
|
|
60
|
+
return;
|
|
61
|
+
const handleAddressValueChange = (event) => {
|
|
62
|
+
onAddressValueChange === null || onAddressValueChange === void 0 ? void 0 : onAddressValueChange(event.detail);
|
|
63
|
+
};
|
|
64
|
+
element.addEventListener('addressValueChange', handleAddressValueChange);
|
|
65
|
+
return () => {
|
|
66
|
+
element.removeEventListener('addressValueChange', handleAddressValueChange);
|
|
67
|
+
};
|
|
68
|
+
}, [onAddressValueChange]);
|
|
69
|
+
return _jsx("pep-address-element", { ref: elementRef });
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=pep-address.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface PepAttachmentProps {
|
|
3
|
+
keyProp?: string;
|
|
4
|
+
src?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
mandatory?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
xAlignment?: 'start' | 'center' | 'end';
|
|
10
|
+
rowSpan?: number;
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
form?: any;
|
|
13
|
+
showTitle?: boolean;
|
|
14
|
+
renderTitle?: boolean;
|
|
15
|
+
layoutType?: 'form' | 'table' | 'card';
|
|
16
|
+
isActive?: boolean;
|
|
17
|
+
handleActions?: boolean;
|
|
18
|
+
hint?: string;
|
|
19
|
+
onChooseFile?: () => void;
|
|
20
|
+
onFileChange?: (fileData: any) => void;
|
|
21
|
+
onElementClick?: (event: any) => void;
|
|
22
|
+
onValidationChange?: (isValid: boolean) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const PepAttachment: React.FC<PepAttachmentProps>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
export const PepAttachment = ({ keyProp, src, label, mandatory, disabled, readonly, xAlignment, rowSpan, visible, form, showTitle, renderTitle, layoutType, isActive, handleActions, hint, onChooseFile, onFileChange, onElementClick, onValidationChange, }) => {
|
|
4
|
+
const elementRef = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const element = elementRef.current;
|
|
7
|
+
if (!element)
|
|
8
|
+
return;
|
|
9
|
+
// Defer property setting to ensure Angular component initialization completes
|
|
10
|
+
setTimeout(() => {
|
|
11
|
+
if (keyProp !== undefined)
|
|
12
|
+
element.key = keyProp;
|
|
13
|
+
if (src !== undefined)
|
|
14
|
+
element.src = src;
|
|
15
|
+
if (label !== undefined)
|
|
16
|
+
element.label = label;
|
|
17
|
+
if (mandatory !== undefined)
|
|
18
|
+
element.mandatory = mandatory;
|
|
19
|
+
if (disabled !== undefined)
|
|
20
|
+
element.disabled = disabled;
|
|
21
|
+
if (readonly !== undefined)
|
|
22
|
+
element.readonly = readonly;
|
|
23
|
+
if (xAlignment !== undefined)
|
|
24
|
+
element.xAlignment = xAlignment;
|
|
25
|
+
if (rowSpan !== undefined)
|
|
26
|
+
element.rowSpan = rowSpan;
|
|
27
|
+
if (visible !== undefined)
|
|
28
|
+
element.visible = visible;
|
|
29
|
+
if (form !== undefined)
|
|
30
|
+
element.form = form;
|
|
31
|
+
if (showTitle !== undefined)
|
|
32
|
+
element.showTitle = showTitle;
|
|
33
|
+
if (renderTitle !== undefined)
|
|
34
|
+
element.renderTitle = renderTitle;
|
|
35
|
+
if (layoutType !== undefined)
|
|
36
|
+
element.layoutType = layoutType;
|
|
37
|
+
if (isActive !== undefined)
|
|
38
|
+
element.isActive = isActive;
|
|
39
|
+
if (handleActions !== undefined)
|
|
40
|
+
element.handleActions = handleActions;
|
|
41
|
+
if (hint !== undefined)
|
|
42
|
+
element.hint = hint;
|
|
43
|
+
console.log('PepAttachment properties set:', { src, label, mandatory, disabled, readonly });
|
|
44
|
+
}, 0);
|
|
45
|
+
}, [keyProp, src, label, mandatory, disabled, readonly, xAlignment, rowSpan, visible, form, showTitle, renderTitle, layoutType, isActive, handleActions, hint]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const element = elementRef.current;
|
|
48
|
+
if (!element)
|
|
49
|
+
return;
|
|
50
|
+
// Event listeners
|
|
51
|
+
const handleChooseFile = () => {
|
|
52
|
+
onChooseFile === null || onChooseFile === void 0 ? void 0 : onChooseFile();
|
|
53
|
+
};
|
|
54
|
+
const handleFileChange = (event) => {
|
|
55
|
+
onFileChange === null || onFileChange === void 0 ? void 0 : onFileChange(event.detail);
|
|
56
|
+
};
|
|
57
|
+
const handleElementClick = (event) => {
|
|
58
|
+
onElementClick === null || onElementClick === void 0 ? void 0 : onElementClick(event.detail);
|
|
59
|
+
};
|
|
60
|
+
const handleValidationChange = (event) => {
|
|
61
|
+
onValidationChange === null || onValidationChange === void 0 ? void 0 : onValidationChange(event.detail);
|
|
62
|
+
};
|
|
63
|
+
element.addEventListener('chooseFile', handleChooseFile);
|
|
64
|
+
element.addEventListener('fileChange', handleFileChange);
|
|
65
|
+
element.addEventListener('elementClick', handleElementClick);
|
|
66
|
+
element.addEventListener('validationChange', handleValidationChange);
|
|
67
|
+
return () => {
|
|
68
|
+
element.removeEventListener('chooseFile', handleChooseFile);
|
|
69
|
+
element.removeEventListener('fileChange', handleFileChange);
|
|
70
|
+
element.removeEventListener('elementClick', handleElementClick);
|
|
71
|
+
element.removeEventListener('validationChange', handleValidationChange);
|
|
72
|
+
};
|
|
73
|
+
}, [onChooseFile, onFileChange, onElementClick, onValidationChange]);
|
|
74
|
+
return _jsx("pep-attachment-element", { ref: elementRef });
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=pep-attachment.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface PepBreadCrumbItem {
|
|
3
|
+
key: string;
|
|
4
|
+
text: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface PepBreadCrumbsProps {
|
|
9
|
+
items?: PepBreadCrumbItem[];
|
|
10
|
+
displayType?: 'label' | 'items';
|
|
11
|
+
addSpacing?: boolean;
|
|
12
|
+
onItemClick?: (event: {
|
|
13
|
+
source: PepBreadCrumbItem;
|
|
14
|
+
}) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const PepBreadCrumbs: React.FC<PepBreadCrumbsProps>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
export const PepBreadCrumbs = ({ items, displayType, addSpacing, onItemClick, }) => {
|
|
4
|
+
const elementRef = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const element = elementRef.current;
|
|
7
|
+
if (!element)
|
|
8
|
+
return;
|
|
9
|
+
// Defer property setting to ensure Angular component initialization completes
|
|
10
|
+
setTimeout(() => {
|
|
11
|
+
if (items !== undefined)
|
|
12
|
+
element.items = items;
|
|
13
|
+
if (displayType !== undefined)
|
|
14
|
+
element.displayType = displayType;
|
|
15
|
+
if (addSpacing !== undefined)
|
|
16
|
+
element.addSpacing = addSpacing;
|
|
17
|
+
console.log('PepBreadCrumbs properties set:', { items, displayType, addSpacing });
|
|
18
|
+
}, 0);
|
|
19
|
+
}, [items, displayType, addSpacing]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const element = elementRef.current;
|
|
22
|
+
if (!element)
|
|
23
|
+
return;
|
|
24
|
+
// Event listeners
|
|
25
|
+
const handleItemClick = (event) => {
|
|
26
|
+
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(event.detail);
|
|
27
|
+
};
|
|
28
|
+
element.addEventListener('itemClick', handleItemClick);
|
|
29
|
+
return () => {
|
|
30
|
+
element.removeEventListener('itemClick', handleItemClick);
|
|
31
|
+
};
|
|
32
|
+
}, [onItemClick]);
|
|
33
|
+
return _jsx("pep-bread-crumbs-element", { ref: elementRef });
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=pep-bread-crumbs.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface PepCarouselProps {
|
|
3
|
+
scrollbarHidden?: boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
xDisabled?: boolean;
|
|
6
|
+
yDisabled?: boolean;
|
|
7
|
+
xWheelEnabled?: boolean;
|
|
8
|
+
dragDisabled?: boolean;
|
|
9
|
+
snapDisabled?: boolean;
|
|
10
|
+
snapOffset?: number;
|
|
11
|
+
snapDuration?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
onDsInitialized?: () => void;
|
|
15
|
+
onIndexChanged?: (index: number) => void;
|
|
16
|
+
onReachesLeftBound?: (reached: boolean) => void;
|
|
17
|
+
onReachesRightBound?: (reached: boolean) => void;
|
|
18
|
+
onSnapAnimationFinished?: (index: number) => void;
|
|
19
|
+
onDragStart?: () => void;
|
|
20
|
+
onDragEnd?: () => void;
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare type PepCarouselRef = {
|
|
24
|
+
moveLeft: () => void;
|
|
25
|
+
moveRight: () => void;
|
|
26
|
+
moveTo: (index: number) => void;
|
|
27
|
+
};
|
|
28
|
+
export declare const PepCarousel: any;
|
package/pep-carousel.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
|
+
export const PepCarousel = React.forwardRef(({ scrollbarHidden = false, disabled = false, xDisabled = false, yDisabled = false, xWheelEnabled = false, dragDisabled = false, snapDisabled = false, snapOffset = 0, snapDuration = 500, className, style, onDsInitialized, onIndexChanged, onReachesLeftBound, onReachesRightBound, onSnapAnimationFinished, onDragStart, onDragEnd, children }, ref) => {
|
|
4
|
+
const elementRef = useRef(null);
|
|
5
|
+
React.useImperativeHandle(ref, () => ({
|
|
6
|
+
moveLeft: () => { var _a, _b; return (_b = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.moveLeft) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
7
|
+
moveRight: () => { var _a, _b; return (_b = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.moveRight) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
8
|
+
moveTo: (index) => { var _a, _b; return (_b = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.moveTo) === null || _b === void 0 ? void 0 : _b.call(_a, index); }
|
|
9
|
+
}));
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const element = elementRef.current;
|
|
12
|
+
if (!element)
|
|
13
|
+
return;
|
|
14
|
+
// Use setTimeout to ensure the element is ready for property setting
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
if (scrollbarHidden !== undefined)
|
|
17
|
+
element.scrollbarHidden = scrollbarHidden;
|
|
18
|
+
if (disabled !== undefined)
|
|
19
|
+
element.disabled = disabled;
|
|
20
|
+
if (xDisabled !== undefined)
|
|
21
|
+
element.xDisabled = xDisabled;
|
|
22
|
+
if (yDisabled !== undefined)
|
|
23
|
+
element.yDisabled = yDisabled;
|
|
24
|
+
if (xWheelEnabled !== undefined)
|
|
25
|
+
element.xWheelEnabled = xWheelEnabled;
|
|
26
|
+
if (dragDisabled !== undefined)
|
|
27
|
+
element.dragDisabled = dragDisabled;
|
|
28
|
+
if (snapDisabled !== undefined)
|
|
29
|
+
element.snapDisabled = snapDisabled;
|
|
30
|
+
if (snapOffset !== undefined)
|
|
31
|
+
element.snapOffset = snapOffset;
|
|
32
|
+
if (snapDuration !== undefined)
|
|
33
|
+
element.snapDuration = snapDuration;
|
|
34
|
+
}, 0);
|
|
35
|
+
}, [scrollbarHidden, disabled, xDisabled, yDisabled, xWheelEnabled, dragDisabled, snapDisabled, snapOffset, snapDuration]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const element = elementRef.current;
|
|
38
|
+
if (!element)
|
|
39
|
+
return;
|
|
40
|
+
const handleDsInitialized = () => onDsInitialized === null || onDsInitialized === void 0 ? void 0 : onDsInitialized();
|
|
41
|
+
const handleIndexChanged = (event) => onIndexChanged === null || onIndexChanged === void 0 ? void 0 : onIndexChanged(event.detail);
|
|
42
|
+
const handleReachesLeftBound = (event) => onReachesLeftBound === null || onReachesLeftBound === void 0 ? void 0 : onReachesLeftBound(event.detail);
|
|
43
|
+
const handleReachesRightBound = (event) => onReachesRightBound === null || onReachesRightBound === void 0 ? void 0 : onReachesRightBound(event.detail);
|
|
44
|
+
const handleSnapAnimationFinished = (event) => onSnapAnimationFinished === null || onSnapAnimationFinished === void 0 ? void 0 : onSnapAnimationFinished(event.detail);
|
|
45
|
+
const handleDragStart = () => onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart();
|
|
46
|
+
const handleDragEnd = () => onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd();
|
|
47
|
+
if (onDsInitialized)
|
|
48
|
+
element.addEventListener('dsInitialized', handleDsInitialized);
|
|
49
|
+
if (onIndexChanged)
|
|
50
|
+
element.addEventListener('indexChanged', handleIndexChanged);
|
|
51
|
+
if (onReachesLeftBound)
|
|
52
|
+
element.addEventListener('reachesLeftBound', handleReachesLeftBound);
|
|
53
|
+
if (onReachesRightBound)
|
|
54
|
+
element.addEventListener('reachesRightBound', handleReachesRightBound);
|
|
55
|
+
if (onSnapAnimationFinished)
|
|
56
|
+
element.addEventListener('snapAnimationFinished', handleSnapAnimationFinished);
|
|
57
|
+
if (onDragStart)
|
|
58
|
+
element.addEventListener('dragStart', handleDragStart);
|
|
59
|
+
if (onDragEnd)
|
|
60
|
+
element.addEventListener('dragEnd', handleDragEnd);
|
|
61
|
+
return () => {
|
|
62
|
+
if (onDsInitialized)
|
|
63
|
+
element.removeEventListener('dsInitialized', handleDsInitialized);
|
|
64
|
+
if (onIndexChanged)
|
|
65
|
+
element.removeEventListener('indexChanged', handleIndexChanged);
|
|
66
|
+
if (onReachesLeftBound)
|
|
67
|
+
element.removeEventListener('reachesLeftBound', handleReachesLeftBound);
|
|
68
|
+
if (onReachesRightBound)
|
|
69
|
+
element.removeEventListener('reachesRightBound', handleReachesRightBound);
|
|
70
|
+
if (onSnapAnimationFinished)
|
|
71
|
+
element.removeEventListener('snapAnimationFinished', handleSnapAnimationFinished);
|
|
72
|
+
if (onDragStart)
|
|
73
|
+
element.removeEventListener('dragStart', handleDragStart);
|
|
74
|
+
if (onDragEnd)
|
|
75
|
+
element.removeEventListener('dragEnd', handleDragEnd);
|
|
76
|
+
};
|
|
77
|
+
}, [onDsInitialized, onIndexChanged, onReachesLeftBound, onReachesRightBound, onSnapAnimationFinished, onDragStart, onDragEnd]);
|
|
78
|
+
return (_jsx("pep-carousel-element", { ref: elementRef, className: className, style: style, children: children }));
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=pep-carousel.js.map
|
package/pep-checkbox.d.ts
CHANGED
|
@@ -13,6 +13,11 @@ export interface PepCheckboxProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
13
13
|
rowSpan?: number;
|
|
14
14
|
additionalValue?: any;
|
|
15
15
|
visible?: boolean;
|
|
16
|
+
form?: unknown;
|
|
17
|
+
isActive?: boolean;
|
|
18
|
+
showTitle?: boolean;
|
|
19
|
+
renderTitle?: boolean;
|
|
20
|
+
layoutType?: 'form' | 'table' | 'card' | string;
|
|
16
21
|
onValueChange?: (value: boolean) => void;
|
|
17
22
|
onValidationChange?: (isValid: boolean) => void;
|
|
18
23
|
className?: string;
|