@gateweb/react-utils 1.11.0 → 1.12.2

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.
@@ -507,8 +507,12 @@ declare const validateFileType: (file: File, accepts: string[]) => boolean;
507
507
  * getMimeType('txt') // 'text/plain'
508
508
  * getMimeType('zip') // 'application/zip'
509
509
  * getMimeType('mp4') // 'application/octet-stream'
510
+ * getMimeType('xls') // 'application/vnd.ms-excel'
511
+ * getMimeType('xlsx') // 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
512
+ * getMimeType('doc') // 'application/msword'
513
+ * getMimeType('docx') // 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
510
514
  */
511
- declare const getMimeType: (fileName: string) => "image/jpeg" | "image/png" | "application/pdf" | "application/zip" | "text/csv" | "text/plain" | "application/octet-stream";
515
+ declare const getMimeType: (fileName: string) => "image/jpeg" | "image/png" | "application/pdf" | "application/zip" | "text/csv" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "text/plain" | "application/octet-stream";
512
516
 
513
517
  declare function invariant(condition: any, message?: string | (() => string)): asserts condition;
514
518
 
package/dist/cjs/index.js CHANGED
@@ -287,6 +287,10 @@ function createEnumLikeObject(obj, name, scene) {
287
287
  * getMimeType('txt') // 'text/plain'
288
288
  * getMimeType('zip') // 'application/zip'
289
289
  * getMimeType('mp4') // 'application/octet-stream'
290
+ * getMimeType('xls') // 'application/vnd.ms-excel'
291
+ * getMimeType('xlsx') // 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
292
+ * getMimeType('doc') // 'application/msword'
293
+ * getMimeType('docx') // 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
290
294
  */ const getMimeType = (fileName)=>{
291
295
  switch((fileName.split('.').pop() || '').toLocaleLowerCase()){
292
296
  case 'jpeg':
@@ -300,6 +304,14 @@ function createEnumLikeObject(obj, name, scene) {
300
304
  return 'application/zip';
301
305
  case 'csv':
302
306
  return 'text/csv';
307
+ case 'xls':
308
+ return 'application/vnd.ms-excel';
309
+ case 'xlsx':
310
+ return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
311
+ case 'doc':
312
+ return 'application/msword';
313
+ case 'docx':
314
+ return 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
303
315
  case 'txt':
304
316
  return 'text/plain';
305
317
  default:
@@ -507,8 +507,12 @@ declare const validateFileType: (file: File, accepts: string[]) => boolean;
507
507
  * getMimeType('txt') // 'text/plain'
508
508
  * getMimeType('zip') // 'application/zip'
509
509
  * getMimeType('mp4') // 'application/octet-stream'
510
+ * getMimeType('xls') // 'application/vnd.ms-excel'
511
+ * getMimeType('xlsx') // 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
512
+ * getMimeType('doc') // 'application/msword'
513
+ * getMimeType('docx') // 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
510
514
  */
511
- declare const getMimeType: (fileName: string) => "image/jpeg" | "image/png" | "application/pdf" | "application/zip" | "text/csv" | "text/plain" | "application/octet-stream";
515
+ declare const getMimeType: (fileName: string) => "image/jpeg" | "image/png" | "application/pdf" | "application/zip" | "text/csv" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "text/plain" | "application/octet-stream";
512
516
 
513
517
  declare function invariant(condition: any, message?: string | (() => string)): asserts condition;
514
518
 
package/dist/es/index.mjs CHANGED
@@ -280,6 +280,10 @@ function createEnumLikeObject(obj, name, scene) {
280
280
  * getMimeType('txt') // 'text/plain'
281
281
  * getMimeType('zip') // 'application/zip'
282
282
  * getMimeType('mp4') // 'application/octet-stream'
283
+ * getMimeType('xls') // 'application/vnd.ms-excel'
284
+ * getMimeType('xlsx') // 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
285
+ * getMimeType('doc') // 'application/msword'
286
+ * getMimeType('docx') // 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
283
287
  */ const getMimeType = (fileName)=>{
284
288
  switch((fileName.split('.').pop() || '').toLocaleLowerCase()){
285
289
  case 'jpeg':
@@ -293,6 +297,14 @@ function createEnumLikeObject(obj, name, scene) {
293
297
  return 'application/zip';
294
298
  case 'csv':
295
299
  return 'text/csv';
300
+ case 'xls':
301
+ return 'application/vnd.ms-excel';
302
+ case 'xlsx':
303
+ return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
304
+ case 'doc':
305
+ return 'application/msword';
306
+ case 'docx':
307
+ return 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
296
308
  case 'txt':
297
309
  return 'text/plain';
298
310
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gateweb/react-utils",
3
- "version": "1.11.0",
3
+ "version": "1.12.2",
4
4
  "description": "React Utils for GateWeb",
5
5
  "homepage": "https://github.com/GatewebSolutions/react-utils",
6
6
  "files": [