canvasframework 0.5.16 → 0.5.18
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/canvasframework.js +2 -0
- package/dist/canvasframework.js.LICENSE.txt +1 -0
- package/package.json +18 -17
- package/components/Accordion.js +0 -265
- package/components/AndroidDatePickerDialog.js +0 -406
- package/components/AppBar.js +0 -398
- package/components/AudioPlayer.js +0 -611
- package/components/Avatar.js +0 -202
- package/components/Banner.js +0 -342
- package/components/BottomNavigationBar.js +0 -433
- package/components/BottomSheet.js +0 -234
- package/components/Button.js +0 -360
- package/components/Camera.js +0 -644
- package/components/Card.js +0 -193
- package/components/Chart.js +0 -700
- package/components/Checkbox.js +0 -166
- package/components/Chip.js +0 -212
- package/components/CircularProgress.js +0 -327
- package/components/ContextMenu.js +0 -116
- package/components/DatePicker.js +0 -298
- package/components/Dialog.js +0 -337
- package/components/Divider.js +0 -125
- package/components/Drawer.js +0 -276
- package/components/FAB.js +0 -270
- package/components/FileUpload.js +0 -315
- package/components/FloatedCamera.js +0 -644
- package/components/IOSDatePickerWheel.js +0 -430
- package/components/ImageCarousel.js +0 -219
- package/components/ImageComponent.js +0 -223
- package/components/Input.js +0 -831
- package/components/InputDatalist.js +0 -723
- package/components/InputTags.js +0 -624
- package/components/List.js +0 -95
- package/components/ListItem.js +0 -269
- package/components/Modal.js +0 -364
- package/components/MorphingFAB.js +0 -428
- package/components/MultiSelectDialog.js +0 -206
- package/components/NumberInput.js +0 -271
- package/components/PasswordInput.js +0 -462
- package/components/ProgressBar.js +0 -88
- package/components/QRCodeReader.js +0 -539
- package/components/RadioButton.js +0 -151
- package/components/SearchInput.js +0 -315
- package/components/SegmentedControl.js +0 -357
- package/components/Select.js +0 -199
- package/components/SelectDialog.js +0 -255
- package/components/Slider.js +0 -113
- package/components/SliverAppBar.js +0 -139
- package/components/Snackbar.js +0 -243
- package/components/SpeedDialFAB.js +0 -397
- package/components/Stepper.js +0 -281
- package/components/SwipeableListItem.js +0 -327
- package/components/Switch.js +0 -147
- package/components/Table.js +0 -492
- package/components/Tabs.js +0 -423
- package/components/Text.js +0 -141
- package/components/TextField.js +0 -151
- package/components/TimePicker.js +0 -934
- package/components/Toast.js +0 -236
- package/components/TreeView.js +0 -420
- package/components/Video.js +0 -397
- package/components/View.js +0 -140
- package/components/VirtualList.js +0 -120
- package/core/CanvasFramework.js +0 -3034
- package/core/Component.js +0 -243
- package/core/ThemeManager.js +0 -358
- package/core/UIBuilder.js +0 -267
- package/core/WebGLCanvasAdapter.js +0 -782
- package/features/Column.js +0 -43
- package/features/Grid.js +0 -47
- package/features/LayoutComponent.js +0 -43
- package/features/OpenStreetMap.js +0 -310
- package/features/Positioned.js +0 -33
- package/features/PullToRefresh.js +0 -328
- package/features/Row.js +0 -40
- package/features/SignaturePad.js +0 -257
- package/features/Skeleton.js +0 -193
- package/features/Stack.js +0 -21
- package/index.js +0 -119
- package/manager/AccessibilityManager.js +0 -107
- package/manager/ErrorHandler.js +0 -59
- package/manager/FeatureFlags.js +0 -60
- package/manager/MemoryManager.js +0 -107
- package/manager/PerformanceMonitor.js +0 -84
- package/manager/SecurityManager.js +0 -54
- package/utils/AnimationEngine.js +0 -734
- package/utils/CryptoManager.js +0 -303
- package/utils/DataStore.js +0 -403
- package/utils/DevTools.js +0 -1618
- package/utils/DevToolsConsole.js +0 -201
- package/utils/EventBus.js +0 -407
- package/utils/FetchClient.js +0 -74
- package/utils/FirebaseAuth.js +0 -653
- package/utils/FirebaseCore.js +0 -246
- package/utils/FirebaseFirestore.js +0 -581
- package/utils/FirebaseFunctions.js +0 -97
- package/utils/FirebaseRealtimeDB.js +0 -498
- package/utils/FirebaseStorage.js +0 -612
- package/utils/FormValidator.js +0 -355
- package/utils/GeoLocationService.js +0 -62
- package/utils/I18n.js +0 -207
- package/utils/IndexedDBManager.js +0 -273
- package/utils/InspectionOverlay.js +0 -308
- package/utils/NotificationManager.js +0 -60
- package/utils/OfflineSyncManager.js +0 -342
- package/utils/PayPalPayment.js +0 -678
- package/utils/QueryBuilder.js +0 -478
- package/utils/SafeArea.js +0 -64
- package/utils/SecureStorage.js +0 -289
- package/utils/StateManager.js +0 -207
- package/utils/StripePayment.js +0 -552
- package/utils/WebSocketClient.js +0 -66
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import Component from '../core/Component.js';
|
|
2
|
-
/**
|
|
3
|
-
* Composant d'image
|
|
4
|
-
* @class
|
|
5
|
-
* @extends Component
|
|
6
|
-
* @property {string} src - URL de l'image
|
|
7
|
-
* @property {string} fit - Mode d'ajustement ('cover', 'contain', 'fill', 'none')
|
|
8
|
-
* @property {number} borderRadius - Rayon des coins
|
|
9
|
-
* @property {string} placeholder - Couleur de placeholder
|
|
10
|
-
* @property {boolean} loaded - Image chargée
|
|
11
|
-
* @property {boolean} loading - En cours de chargement
|
|
12
|
-
* @property {boolean} error - Erreur de chargement
|
|
13
|
-
* @property {HTMLImageElement} img - Élément image HTML
|
|
14
|
-
*/
|
|
15
|
-
class ImageComponent extends Component {
|
|
16
|
-
/**
|
|
17
|
-
* Crée une instance de ImageComponent
|
|
18
|
-
* @param {CanvasFramework} framework - Framework parent
|
|
19
|
-
* @param {Object} [options={}] - Options de configuration
|
|
20
|
-
* @param {string} [options.src=''] - URL de l'image
|
|
21
|
-
* @param {string} [options.fit='cover'] - Mode d'ajustement
|
|
22
|
-
* @param {number} [options.borderRadius=0] - Rayon des coins
|
|
23
|
-
* @param {string} [options.placeholder='#E0E0E0'] - Couleur de placeholder
|
|
24
|
-
*/
|
|
25
|
-
constructor(framework, options = {}) {
|
|
26
|
-
super(framework, options);
|
|
27
|
-
this.src = options.src || '';
|
|
28
|
-
this.fit = options.fit || 'cover'; // cover, contain, fill, none
|
|
29
|
-
this.borderRadius = options.borderRadius || 0;
|
|
30
|
-
this.placeholder = options.placeholder || '#E0E0E0';
|
|
31
|
-
this.loaded = false;
|
|
32
|
-
this.loading = false;
|
|
33
|
-
this.error = false;
|
|
34
|
-
|
|
35
|
-
// Créer l'élément image
|
|
36
|
-
this.img = null;
|
|
37
|
-
if (this.src) {
|
|
38
|
-
this.loadImage();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Charge l'image
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
|
-
loadImage() {
|
|
47
|
-
if (this.loading) return;
|
|
48
|
-
|
|
49
|
-
this.loading = true;
|
|
50
|
-
this.img = new Image();
|
|
51
|
-
this.img.crossOrigin = 'anonymous';
|
|
52
|
-
|
|
53
|
-
this.img.onload = () => {
|
|
54
|
-
this.loaded = true;
|
|
55
|
-
this.loading = false;
|
|
56
|
-
this.error = false;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
this.img.onerror = () => {
|
|
60
|
-
this.loaded = false;
|
|
61
|
-
this.loading = false;
|
|
62
|
-
this.error = true;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
this.img.src = this.src;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Change l'URL de l'image
|
|
70
|
-
* @param {string} newSrc - Nouvelle URL
|
|
71
|
-
*/
|
|
72
|
-
setSrc(newSrc) {
|
|
73
|
-
this.src = newSrc;
|
|
74
|
-
this.loaded = false;
|
|
75
|
-
this.error = false;
|
|
76
|
-
this.loadImage();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Dessine l'image
|
|
81
|
-
* @param {CanvasRenderingContext2D} ctx - Contexte de dessin
|
|
82
|
-
*/
|
|
83
|
-
draw(ctx) {
|
|
84
|
-
ctx.save();
|
|
85
|
-
|
|
86
|
-
// Clipping avec borderRadius
|
|
87
|
-
if (this.borderRadius > 0) {
|
|
88
|
-
ctx.beginPath();
|
|
89
|
-
this.roundRect(ctx, this.x, this.y, this.width, this.height, this.borderRadius);
|
|
90
|
-
ctx.clip();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (this.loaded && this.img) {
|
|
94
|
-
// Dessiner l'image selon le mode fit
|
|
95
|
-
const imgRatio = this.img.width / this.img.height;
|
|
96
|
-
const boxRatio = this.width / this.height;
|
|
97
|
-
|
|
98
|
-
let drawWidth, drawHeight, drawX, drawY;
|
|
99
|
-
|
|
100
|
-
switch (this.fit) {
|
|
101
|
-
case 'cover':
|
|
102
|
-
if (imgRatio > boxRatio) {
|
|
103
|
-
drawHeight = this.height;
|
|
104
|
-
drawWidth = drawHeight * imgRatio;
|
|
105
|
-
drawX = this.x - (drawWidth - this.width) / 2;
|
|
106
|
-
drawY = this.y;
|
|
107
|
-
} else {
|
|
108
|
-
drawWidth = this.width;
|
|
109
|
-
drawHeight = drawWidth / imgRatio;
|
|
110
|
-
drawX = this.x;
|
|
111
|
-
drawY = this.y - (drawHeight - this.height) / 2;
|
|
112
|
-
}
|
|
113
|
-
break;
|
|
114
|
-
|
|
115
|
-
case 'contain':
|
|
116
|
-
if (imgRatio > boxRatio) {
|
|
117
|
-
drawWidth = this.width;
|
|
118
|
-
drawHeight = drawWidth / imgRatio;
|
|
119
|
-
drawX = this.x;
|
|
120
|
-
drawY = this.y + (this.height - drawHeight) / 2;
|
|
121
|
-
} else {
|
|
122
|
-
drawHeight = this.height;
|
|
123
|
-
drawWidth = drawHeight * imgRatio;
|
|
124
|
-
drawX = this.x + (this.width - drawWidth) / 2;
|
|
125
|
-
drawY = this.y;
|
|
126
|
-
}
|
|
127
|
-
break;
|
|
128
|
-
|
|
129
|
-
case 'fill':
|
|
130
|
-
drawX = this.x;
|
|
131
|
-
drawY = this.y;
|
|
132
|
-
drawWidth = this.width;
|
|
133
|
-
drawHeight = this.height;
|
|
134
|
-
break;
|
|
135
|
-
|
|
136
|
-
case 'none':
|
|
137
|
-
drawX = this.x + (this.width - this.img.width) / 2;
|
|
138
|
-
drawY = this.y + (this.height - this.img.height) / 2;
|
|
139
|
-
drawWidth = this.img.width;
|
|
140
|
-
drawHeight = this.img.height;
|
|
141
|
-
break;
|
|
142
|
-
|
|
143
|
-
default:
|
|
144
|
-
drawX = this.x;
|
|
145
|
-
drawY = this.y;
|
|
146
|
-
drawWidth = this.width;
|
|
147
|
-
drawHeight = this.height;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
ctx.drawImage(this.img, drawX, drawY, drawWidth, drawHeight);
|
|
151
|
-
|
|
152
|
-
} else if (this.loading) {
|
|
153
|
-
// Placeholder avec spinner
|
|
154
|
-
ctx.fillStyle = this.placeholder;
|
|
155
|
-
ctx.fillRect(this.x, this.y, this.width, this.height);
|
|
156
|
-
|
|
157
|
-
// Petit spinner au centre
|
|
158
|
-
const centerX = this.x + this.width / 2;
|
|
159
|
-
const centerY = this.y + this.height / 2;
|
|
160
|
-
const spinnerSize = Math.min(40, this.width / 3, this.height / 3);
|
|
161
|
-
|
|
162
|
-
ctx.strokeStyle = '#999999';
|
|
163
|
-
ctx.lineWidth = 3;
|
|
164
|
-
ctx.lineCap = 'round';
|
|
165
|
-
const rotation = (Date.now() / 10) % 360 * (Math.PI / 180);
|
|
166
|
-
ctx.beginPath();
|
|
167
|
-
ctx.arc(centerX, centerY, spinnerSize / 2, rotation, rotation + Math.PI * 1.5);
|
|
168
|
-
ctx.stroke();
|
|
169
|
-
|
|
170
|
-
} else if (this.error) {
|
|
171
|
-
// Placeholder avec icône d'erreur
|
|
172
|
-
ctx.fillStyle = this.placeholder;
|
|
173
|
-
ctx.fillRect(this.x, this.y, this.width, this.height);
|
|
174
|
-
|
|
175
|
-
ctx.fillStyle = '#999999';
|
|
176
|
-
ctx.font = '48px sans-serif';
|
|
177
|
-
ctx.textAlign = 'center';
|
|
178
|
-
ctx.textBaseline = 'middle';
|
|
179
|
-
ctx.fillText('⚠️', this.x + this.width / 2, this.y + this.height / 2);
|
|
180
|
-
|
|
181
|
-
} else {
|
|
182
|
-
// Placeholder simple
|
|
183
|
-
ctx.fillStyle = this.placeholder;
|
|
184
|
-
ctx.fillRect(this.x, this.y, this.width, this.height);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
ctx.restore();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Dessine un rectangle avec coins arrondis
|
|
192
|
-
* @param {CanvasRenderingContext2D} ctx - Contexte de dessin
|
|
193
|
-
* @param {number} x - Position X
|
|
194
|
-
* @param {number} y - Position Y
|
|
195
|
-
* @param {number} width - Largeur
|
|
196
|
-
* @param {number} height - Hauteur
|
|
197
|
-
* @param {number} radius - Rayon des coins
|
|
198
|
-
* @private
|
|
199
|
-
*/
|
|
200
|
-
roundRect(ctx, x, y, width, height, radius) {
|
|
201
|
-
ctx.beginPath();
|
|
202
|
-
ctx.moveTo(x + radius, y);
|
|
203
|
-
ctx.lineTo(x + width - radius, y);
|
|
204
|
-
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
|
|
205
|
-
ctx.lineTo(x + width, y + height - radius);
|
|
206
|
-
ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
|
|
207
|
-
ctx.lineTo(x + radius, y + height);
|
|
208
|
-
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
|
|
209
|
-
ctx.lineTo(x, y + radius);
|
|
210
|
-
ctx.quadraticCurveTo(x, y, x + radius, y);
|
|
211
|
-
ctx.closePath();
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Vérifie si un point est dans les limites
|
|
216
|
-
* @returns {boolean} False (non cliquable par défaut)
|
|
217
|
-
*/
|
|
218
|
-
isPointInside() {
|
|
219
|
-
return false; // Non cliquable par défaut
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export default ImageComponent;
|