canvasframework 0.5.18 → 0.5.20
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 +30 -0
- package/components/Accordion.js +265 -0
- package/components/AndroidDatePickerDialog.js +406 -0
- package/components/AppBar.js +398 -0
- package/components/AudioPlayer.js +611 -0
- package/components/Avatar.js +202 -0
- package/components/Banner.js +342 -0
- package/components/BottomNavigationBar.js +433 -0
- package/components/BottomSheet.js +234 -0
- package/components/Button.js +358 -0
- package/components/Camera.js +644 -0
- package/components/Card.js +193 -0
- package/components/Chart.js +700 -0
- package/components/Checkbox.js +166 -0
- package/components/Chip.js +212 -0
- package/components/CircularProgress.js +327 -0
- package/components/ContextMenu.js +116 -0
- package/components/DatePicker.js +298 -0
- package/components/Dialog.js +337 -0
- package/components/Divider.js +125 -0
- package/components/Drawer.js +276 -0
- package/components/FAB.js +270 -0
- package/components/FileUpload.js +315 -0
- package/components/FloatedCamera.js +644 -0
- package/components/IOSDatePickerWheel.js +430 -0
- package/components/ImageCarousel.js +219 -0
- package/components/ImageComponent.js +223 -0
- package/components/Input.js +831 -0
- package/components/InputDatalist.js +723 -0
- package/components/InputTags.js +624 -0
- package/components/List.js +95 -0
- package/components/ListItem.js +269 -0
- package/components/Modal.js +364 -0
- package/components/MorphingFAB.js +428 -0
- package/components/MultiSelectDialog.js +206 -0
- package/components/NumberInput.js +271 -0
- package/components/PasswordInput.js +462 -0
- package/components/ProgressBar.js +88 -0
- package/components/QRCodeReader.js +539 -0
- package/components/RadioButton.js +151 -0
- package/components/SearchInput.js +315 -0
- package/components/SegmentedControl.js +357 -0
- package/components/Select.js +199 -0
- package/components/SelectDialog.js +255 -0
- package/components/Slider.js +113 -0
- package/components/SliverAppBar.js +139 -0
- package/components/Snackbar.js +243 -0
- package/components/SpeedDialFAB.js +397 -0
- package/components/Stepper.js +281 -0
- package/components/SwipeableListItem.js +327 -0
- package/components/Switch.js +147 -0
- package/components/Table.js +492 -0
- package/components/Tabs.js +423 -0
- package/components/Text.js +141 -0
- package/components/TextField.js +151 -0
- package/components/TimePicker.js +934 -0
- package/components/Toast.js +236 -0
- package/components/TreeView.js +420 -0
- package/components/Video.js +397 -0
- package/components/View.js +140 -0
- package/components/VirtualList.js +120 -0
- package/core/CanvasFramework.js +3045 -0
- package/core/Component.js +243 -0
- package/core/ThemeManager.js +358 -0
- package/core/UIBuilder.js +267 -0
- package/core/WebGLCanvasAdapter.js +782 -0
- package/features/Column.js +43 -0
- package/features/Grid.js +47 -0
- package/features/LayoutComponent.js +43 -0
- package/features/OpenStreetMap.js +310 -0
- package/features/Positioned.js +33 -0
- package/features/PullToRefresh.js +328 -0
- package/features/Row.js +40 -0
- package/features/SignaturePad.js +257 -0
- package/features/Skeleton.js +193 -0
- package/features/Stack.js +21 -0
- package/index.js +119 -0
- package/manager/AccessibilityManager.js +107 -0
- package/manager/ErrorHandler.js +59 -0
- package/manager/FeatureFlags.js +60 -0
- package/manager/MemoryManager.js +107 -0
- package/manager/PerformanceMonitor.js +84 -0
- package/manager/SecurityManager.js +54 -0
- package/package.json +22 -16
- package/utils/AnimationEngine.js +734 -0
- package/utils/CryptoManager.js +303 -0
- package/utils/DataStore.js +403 -0
- package/utils/DevTools.js +1618 -0
- package/utils/DevToolsConsole.js +201 -0
- package/utils/EventBus.js +407 -0
- package/utils/FetchClient.js +74 -0
- package/utils/FirebaseAuth.js +653 -0
- package/utils/FirebaseCore.js +246 -0
- package/utils/FirebaseFirestore.js +581 -0
- package/utils/FirebaseFunctions.js +97 -0
- package/utils/FirebaseRealtimeDB.js +498 -0
- package/utils/FirebaseStorage.js +612 -0
- package/utils/FormValidator.js +355 -0
- package/utils/GeoLocationService.js +62 -0
- package/utils/I18n.js +207 -0
- package/utils/IndexedDBManager.js +273 -0
- package/utils/InspectionOverlay.js +308 -0
- package/utils/NotificationManager.js +60 -0
- package/utils/OfflineSyncManager.js +342 -0
- package/utils/PayPalPayment.js +678 -0
- package/utils/QueryBuilder.js +478 -0
- package/utils/SafeArea.js +64 -0
- package/utils/SecureStorage.js +289 -0
- package/utils/StateManager.js +207 -0
- package/utils/StripePayment.js +552 -0
- package/utils/WebSocketClient.js +66 -0
- package/dist/canvasframework.js +0 -2
- package/dist/canvasframework.js.LICENSE.txt +0 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import Component from '../core/Component.js';
|
|
2
|
+
/**
|
|
3
|
+
* Carte avec ombre et contenu
|
|
4
|
+
* @class
|
|
5
|
+
* @extends Component
|
|
6
|
+
* @property {Component[]} children - Enfants de la carte
|
|
7
|
+
* @property {number} padding - Padding interne
|
|
8
|
+
* @property {string} bgColor - Couleur de fond
|
|
9
|
+
* @property {number} elevation - Élévation (ombre)
|
|
10
|
+
* @property {number} borderRadius - Rayon des coins
|
|
11
|
+
* @property {boolean} clipContent - Clip le contenu
|
|
12
|
+
* @property {boolean} clickableChildren - Active les clics sur les enfants
|
|
13
|
+
*/
|
|
14
|
+
class Card extends Component {
|
|
15
|
+
/**
|
|
16
|
+
* Crée une instance de Card
|
|
17
|
+
* @param {CanvasFramework} framework - Framework parent
|
|
18
|
+
* @param {Object} [options={}] - Options de configuration
|
|
19
|
+
* @param {number} [options.padding=16] - Padding interne
|
|
20
|
+
* @param {string} [options.bgColor='#FFFFFF'] - Couleur de fond
|
|
21
|
+
* @param {number} [options.elevation=2] - Élévation (ombre)
|
|
22
|
+
* @param {number} [options.borderRadius] - Rayon des coins (auto selon platform)
|
|
23
|
+
* @param {boolean} [options.clipContent=true] - Clip le contenu
|
|
24
|
+
* @param {boolean} [options.clickableChildren=true] - Active les clics enfants
|
|
25
|
+
*/
|
|
26
|
+
constructor(framework, options = {}) {
|
|
27
|
+
super(framework, options);
|
|
28
|
+
this.children = [];
|
|
29
|
+
this.padding = options.padding || 16;
|
|
30
|
+
this.bgColor = options.bgColor || '#FFFFFF';
|
|
31
|
+
this.elevation = options.elevation || 2;
|
|
32
|
+
this.borderRadius = options.borderRadius || (framework.platform === 'material' ? 4 : 12);
|
|
33
|
+
this.clipContent = options.clipContent !== false;
|
|
34
|
+
this.clickableChildren = options.clickableChildren !== false; // NOUVEAU: activer/désactiver les enfants cliquables
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Ajoute un enfant à la carte
|
|
39
|
+
* @param {Component} child - Composant enfant
|
|
40
|
+
* @returns {Component} L'enfant ajouté
|
|
41
|
+
*/
|
|
42
|
+
add(child) {
|
|
43
|
+
// Ajuster les coordonnées de l'enfant pour qu'elles soient relatives à la Card
|
|
44
|
+
child.x = child.x || 0;
|
|
45
|
+
child.y = child.y || 0;
|
|
46
|
+
this.children.push(child);
|
|
47
|
+
|
|
48
|
+
// Marquer l'enfant comme appartenant à cette Card
|
|
49
|
+
child.parentCard = this;
|
|
50
|
+
|
|
51
|
+
return child;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Dessine la carte et ses enfants
|
|
56
|
+
* @param {CanvasRenderingContext2D} ctx - Contexte de dessin
|
|
57
|
+
*/
|
|
58
|
+
draw(ctx) {
|
|
59
|
+
ctx.save();
|
|
60
|
+
|
|
61
|
+
// Ombre
|
|
62
|
+
if (this.elevation > 0) {
|
|
63
|
+
ctx.shadowColor = 'rgba(0, 0, 0, 0.15)';
|
|
64
|
+
ctx.shadowBlur = this.elevation * 3;
|
|
65
|
+
ctx.shadowOffsetY = this.elevation;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Background
|
|
69
|
+
ctx.fillStyle = this.bgColor;
|
|
70
|
+
ctx.beginPath();
|
|
71
|
+
this.roundRect(ctx, this.x, this.y, this.width, this.height, this.borderRadius);
|
|
72
|
+
ctx.fill();
|
|
73
|
+
|
|
74
|
+
ctx.shadowColor = 'transparent';
|
|
75
|
+
|
|
76
|
+
// Clipping pour empêcher le contenu de déborder
|
|
77
|
+
if (this.clipContent) {
|
|
78
|
+
ctx.beginPath();
|
|
79
|
+
this.roundRect(ctx, this.x, this.y, this.width, this.height, this.borderRadius);
|
|
80
|
+
ctx.clip();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Children - dessinés relativement à la Card
|
|
84
|
+
for (let child of this.children) {
|
|
85
|
+
if (child.visible) {
|
|
86
|
+
// Sauvegarder les coordonnées originales
|
|
87
|
+
const originalX = child.x;
|
|
88
|
+
const originalY = child.y;
|
|
89
|
+
|
|
90
|
+
// Ajuster les coordonnées pour être relatives à la Card
|
|
91
|
+
child.x = this.x + this.padding + originalX;
|
|
92
|
+
child.y = this.y + this.padding + originalY;
|
|
93
|
+
|
|
94
|
+
// Dessiner l'enfant
|
|
95
|
+
child.draw(ctx);
|
|
96
|
+
|
|
97
|
+
// Restaurer les coordonnées originales
|
|
98
|
+
child.x = originalX;
|
|
99
|
+
child.y = originalY;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
ctx.restore();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Vérifie les clics sur les enfants
|
|
108
|
+
* @param {number} x - Coordonnée X
|
|
109
|
+
* @param {number} y - Coordonnée Y
|
|
110
|
+
* @returns {boolean} True si un enfant a été cliqué
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
113
|
+
checkChildClick(x, y) {
|
|
114
|
+
// Ajuster y avec le scrollOffset
|
|
115
|
+
const adjustedY = y - this.framework.scrollOffset;
|
|
116
|
+
|
|
117
|
+
// Vérifier chaque enfant
|
|
118
|
+
for (let i = this.children.length - 1; i >= 0; i--) {
|
|
119
|
+
const child = this.children[i];
|
|
120
|
+
|
|
121
|
+
// Calculer les coordonnées absolues de l'enfant
|
|
122
|
+
const childX = this.x + this.padding + child.x;
|
|
123
|
+
const childY = this.y + this.padding + child.y;
|
|
124
|
+
|
|
125
|
+
// Vérifier si le clic est dans l'enfant
|
|
126
|
+
if (child.visible &&
|
|
127
|
+
adjustedY >= childY &&
|
|
128
|
+
adjustedY <= childY + child.height &&
|
|
129
|
+
x >= childX &&
|
|
130
|
+
x <= childX + child.width) {
|
|
131
|
+
|
|
132
|
+
// Si l'enfant a un onClick ou onPress, le déclencher
|
|
133
|
+
if (child.onClick) {
|
|
134
|
+
child.onClick();
|
|
135
|
+
return true;
|
|
136
|
+
} else if (child.onPress) {
|
|
137
|
+
child.onPress(x, adjustedY);
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Dessine un rectangle avec coins arrondis
|
|
148
|
+
* @param {CanvasRenderingContext2D} ctx - Contexte de dessin
|
|
149
|
+
* @param {number} x - Position X
|
|
150
|
+
* @param {number} y - Position Y
|
|
151
|
+
* @param {number} width - Largeur
|
|
152
|
+
* @param {number} height - Hauteur
|
|
153
|
+
* @param {number} radius - Rayon des coins
|
|
154
|
+
* @private
|
|
155
|
+
*/
|
|
156
|
+
roundRect(ctx, x, y, width, height, radius) {
|
|
157
|
+
ctx.beginPath();
|
|
158
|
+
ctx.moveTo(x + radius, y);
|
|
159
|
+
ctx.lineTo(x + width - radius, y);
|
|
160
|
+
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
|
|
161
|
+
ctx.lineTo(x + width, y + height - radius);
|
|
162
|
+
ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
|
|
163
|
+
ctx.lineTo(x + radius, y + height);
|
|
164
|
+
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
|
|
165
|
+
ctx.lineTo(x, y + radius);
|
|
166
|
+
ctx.quadraticCurveTo(x, y, x + radius, y);
|
|
167
|
+
ctx.closePath();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Vérifie si un point est dans les limites
|
|
172
|
+
* @param {number} x - Coordonnée X
|
|
173
|
+
* @param {number} y - Coordonnée Y
|
|
174
|
+
* @returns {boolean} True si le point est dans la carte
|
|
175
|
+
*/
|
|
176
|
+
isPointInside(x, y) {
|
|
177
|
+
return x >= this.x &&
|
|
178
|
+
x <= this.x + this.width &&
|
|
179
|
+
y >= this.y &&
|
|
180
|
+
y <= this.y + this.height;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Gère le clic sur la carte
|
|
185
|
+
* @private
|
|
186
|
+
*/
|
|
187
|
+
onClick() {
|
|
188
|
+
// La Card elle-même peut avoir un onClick, mais on veut aussi vérifier les enfants
|
|
189
|
+
// Cette logique est gérée dans le CanvasFramework modifié ci-dessous
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export default Card;
|