glib-web 0.6.2 → 0.6.9

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.
Files changed (55) hide show
  1. package/action.js +7 -4
  2. package/actions/analytics/logEvent.js +1 -1
  3. package/actions/auth/creditCard.js +4 -4
  4. package/actions/auth/saveCsrfToken.js +4 -4
  5. package/actions/cables/push.js +0 -12
  6. package/actions/commands/copy.js +12 -0
  7. package/actions/dialogs/alert.js +2 -2
  8. package/actions/dialogs/close.js +2 -4
  9. package/actions/dialogs/notification.js +2 -2
  10. package/actions/dialogs/open.js +2 -4
  11. package/actions/dialogs/show.js +3 -2
  12. package/actions/forms/submit.js +2 -12
  13. package/actions/http/delete.js +1 -1
  14. package/actions/http/patch.js +1 -1
  15. package/actions/http/post.js +1 -1
  16. package/actions/http/put.js +1 -1
  17. package/actions/runMultiple.js +2 -2
  18. package/actions/timeouts/set.js +2 -2
  19. package/actions/windows/close.js +2 -2
  20. package/actions/windows/closeAll.js +2 -2
  21. package/actions/windows/closeWithReload.js +1 -1
  22. package/actions/windows/open.js +1 -1
  23. package/actions/windows/reload.js +1 -1
  24. package/actions/ws/push.js +1 -1
  25. package/app.vue +5 -3
  26. package/components/button.vue +9 -2
  27. package/components/calendar.vue +1 -1
  28. package/components/component.vue +4 -0
  29. package/components/fields/googlePlace.vue +80 -52
  30. package/components/fields/radioGroup.vue +1 -0
  31. package/components/markdown.vue +7 -0
  32. package/components/mixins/dataset.js +10 -0
  33. package/components/mixins/events.js +4 -5
  34. package/components/mixins/generic.js +6 -0
  35. package/components/mixins/list/autoload.js +2 -3
  36. package/components/mixins/table/autoload.js +2 -2
  37. package/components/mixins/tour.js +75 -0
  38. package/components/mixins/ws/actionCable.js +1 -1
  39. package/components/multimedia/video.vue +87 -0
  40. package/components/panels/form.vue +13 -3
  41. package/components/panels/list.vue +1 -1
  42. package/components/switch.vue +2 -2
  43. package/index.js +3 -0
  44. package/nav/appbar.vue +1 -1
  45. package/nav/dialog.vue +2 -2
  46. package/nav/drawer.vue +38 -8
  47. package/nav/sheet.vue +1 -2
  48. package/nav/snackbar.vue +1 -2
  49. package/package.json +3 -2
  50. package/utils/form.js +1 -5
  51. package/utils/http.js +2 -2
  52. package/utils/launch.js +25 -18
  53. package/utils/mime_type.js +78 -0
  54. package/utils/private/ws.js +1 -1
  55. package/utils/uploader.js +9 -36
@@ -0,0 +1,78 @@
1
+ export default {
2
+ aac: "audio/aac",
3
+ abw: "application/x-abiword",
4
+ ai: "application/postscript",
5
+ arc: "application/octet-stream",
6
+ avi: "video/x-msvideo",
7
+ azw: "application/vnd.amazon.ebook",
8
+ bin: "application/octet-stream",
9
+ bz: "application/x-bzip",
10
+ bz2: "application/x-bzip2",
11
+ csh: "application/x-csh",
12
+ css: "text/css",
13
+ csv: "text/csv",
14
+ doc: "application/msword",
15
+ dll: "application/octet-stream",
16
+ eot: "application/vnd.ms-fontobject",
17
+ epub: "application/epub+zip",
18
+ gif: "image/gif",
19
+ htm: "text/html",
20
+ html: "text/html",
21
+ ico: "image/x-icon",
22
+ ics: "text/calendar",
23
+ jar: "application/java-archive",
24
+ jpeg: "image/jpeg",
25
+ jpg: "image/jpeg",
26
+ js: "application/javascript",
27
+ json: "application/json",
28
+ mid: "audio/midi",
29
+ midi: "audio/midi",
30
+ mp2: "audio/mpeg",
31
+ mp3: "audio/mpeg",
32
+ mp4: "video/mp4",
33
+ mpa: "video/mpeg",
34
+ mpe: "video/mpeg",
35
+ mpeg: "video/mpeg",
36
+ mpkg: "application/vnd.apple.installer+xml",
37
+ odp: "application/vnd.oasis.opendocument.presentation",
38
+ ods: "application/vnd.oasis.opendocument.spreadsheet",
39
+ odt: "application/vnd.oasis.opendocument.text",
40
+ oga: "audio/ogg",
41
+ ogv: "video/ogg",
42
+ ogx: "application/ogg",
43
+ otf: "font/otf",
44
+ png: "image/png",
45
+ ppt: "application/vnd.ms-powerpoint",
46
+ rar: "application/x-rar-compressed",
47
+ rtf: "application/rtf",
48
+ sh: "application/x-sh",
49
+ svg: "image/svg+xml",
50
+ swf: "application/x-shockwave-flash",
51
+ tar: "application/x-tar",
52
+ tif: "image/tiff",
53
+ tiff: "image/tiff",
54
+ ts: "application/typescript",
55
+ ttf: "font/ttf",
56
+ txt: "text/plain",
57
+ vsd: "application/vnd.visio",
58
+ wav: "audio/x-wav",
59
+ weba: "audio/webm",
60
+ webm: "video/webm",
61
+ webp: "image/webp",
62
+ woff: "font/woff",
63
+ woff2: "font/woff2",
64
+ xhtml: "application/xhtml+xml",
65
+ xls: "application/vnd.ms-excel",
66
+ xlsx: "application/vnd.ms-excel",
67
+ xlsx_OLD: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
68
+ xml: "application/xml",
69
+ xul: "application/vnd.mozilla.xul+xml",
70
+ "3gp": "video/3gpp",
71
+ "3gp_DOES_NOT_CONTAIN_VIDEO": "audio/3gpp",
72
+ "3gp2": "video/3gpp2",
73
+ "3gp2_DOES_NOT_CONTAIN_VIDEO": "audio/3gpp2",
74
+ "7z": "application/x-7z-compressed",
75
+ image: "image/*",
76
+ pdf: "application/pdf",
77
+ zip: "application/(zip|x-zip-compressed|octet-stream)"
78
+ };
@@ -16,7 +16,7 @@ export default class {
16
16
  console.log(`Executing component action: ${methodName}`);
17
17
  component[`action_${methodName}`](payload);
18
18
  } else {
19
- GLib.action.execute(payload, null, component);
19
+ GLib.action.execute(payload, component);
20
20
  }
21
21
  }
22
22
  }
package/utils/uploader.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { DirectUpload } from "@rails/activestorage";
2
2
  import Type from "../utils/type";
3
+ import mimeType from "../utils/mime_type";
3
4
 
4
5
  const MB_SIZE = 1000;
5
6
 
@@ -63,47 +64,19 @@ export default class Uploader {
63
64
 
64
65
  validateFile(spec) {
65
66
  return this.validateFileAccordingToRules(spec.accepts);
66
-
67
- // if (Type.isString(spec.accepts)) {
68
- // if (spec.accepts) {
69
- // const acceptsRegex = new RegExp(spec.accepts);
70
-
71
- // if (!acceptsRegex.test(this.file.type)) {
72
- // alert("Invalid file type.");
73
- // return false;
74
- // }
75
- // }
76
-
77
- // if (spec.file_size_limit) {
78
- // if (this.file.size > spec.file_size_limit * MB_SIZE) {
79
- // alert(spec.file_size_limit_alert_text);
80
- // return false;
81
- // }
82
- // }
83
- // } else {
84
- // return this.validateFileAccordingToRules(spec.accepts);
85
- // }
86
-
87
- // return true;
88
67
  }
89
68
 
90
69
  validateFileAccordingToRules(spec) {
91
70
  if (Type.isObject(spec)) {
92
- let mimeType;
93
- switch (spec.fileType) {
94
- case "image/*": // Legacy
95
- case "image":
96
- mimeType = "image/*";
97
- break;
98
- case "pdf":
99
- mimeType = "application/pdf";
100
- break;
101
- default:
102
- return;
103
- }
71
+ let validFileType = false;
72
+ [spec.fileType].flat().forEach(key => {
73
+ const acceptsRegex = new RegExp(mimeType[key]);
74
+ if (acceptsRegex.test(this.file.type)) {
75
+ validFileType = true;
76
+ }
77
+ });
104
78
 
105
- const acceptsRegex = new RegExp(mimeType);
106
- if (!acceptsRegex.test(this.file.type)) {
79
+ if (!validFileType) {
107
80
  alert(spec.fileTypeErrorText || "Invalid file type");
108
81
  return false;
109
82
  }