glib-web 0.11.0 → 0.11.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 (63) hide show
  1. package/LICENSE +0 -0
  2. package/action.js +2 -0
  3. package/actions/auth/restart.js +0 -0
  4. package/actions/cables/push.js +3 -2
  5. package/actions/dialogs/alert.js +1 -1
  6. package/actions/dialogs/oauth.js +0 -0
  7. package/actions/dialogs/options.js +0 -0
  8. package/actions/dialogs/reload.js +5 -0
  9. package/actions/dialogs/show.js +0 -1
  10. package/actions/sheets/select.js +2 -2
  11. package/actions/snackbars/alert.js +2 -4
  12. package/actions/snackbars/select.js +2 -2
  13. package/actions/windows/openWeb.js +0 -0
  14. package/actions/ws/push.js +2 -1
  15. package/components/_message.vue +0 -0
  16. package/components/_responsive.vue +19 -2
  17. package/components/datetime.vue +0 -0
  18. package/components/fab.vue +0 -0
  19. package/components/fields/_select.vue +8 -0
  20. package/components/fields/check.vue +11 -5
  21. package/components/fields/country/countries.js +0 -0
  22. package/components/fields/country/field.vue +0 -0
  23. package/components/fields/country/regions.js +0 -0
  24. package/components/fields/datetime.vue +0 -0
  25. package/components/fields/dynamicGroup.vue +8 -4
  26. package/components/fields/dynamicSelect.vue +0 -0
  27. package/components/fields/file.vue +1 -1
  28. package/components/fields/radioGroup.vue +10 -0
  29. package/components/fields/select.vue +0 -0
  30. package/components/fields/timeZone.vue +0 -0
  31. package/components/hr.vue +0 -0
  32. package/components/html.vue +0 -0
  33. package/components/mixins/generic.js +6 -6
  34. package/components/mixins/longClick.js +0 -0
  35. package/components/mixins/scrolling.js +0 -0
  36. package/components/mixins/table/export.js +0 -0
  37. package/components/mixins/table/import.js +0 -0
  38. package/components/mixins/ws/phoenixSocket.js +4 -1
  39. package/components/p.vue +0 -0
  40. package/components/panels/column.vue +1 -1
  41. package/components/panels/form.vue +18 -11
  42. package/components/panels/horizontal.vue +23 -1
  43. package/components/panels/split.vue +0 -0
  44. package/components/panels/timeline.vue +13 -10
  45. package/components/panels/ul.vue +0 -0
  46. package/components/panels/vertical.vue +23 -1
  47. package/keys.js +0 -0
  48. package/nav/appbar.vue +54 -25
  49. package/nav/dialog.vue +1 -0
  50. package/nav/drawerButton.vue +0 -0
  51. package/package.json +1 -1
  52. package/settings.json.example +0 -0
  53. package/styles/test.sass +0 -0
  54. package/styles/test.scss +0 -0
  55. package/templates/featured.vue +0 -0
  56. package/templates/unsupported.vue +0 -0
  57. package/utils/dom.js +0 -0
  58. package/utils/http.js +1 -1
  59. package/utils/launch.js +53 -25
  60. package/utils/public.js +0 -0
  61. package/utils/settings.js +0 -0
  62. package/utils/storage.js +0 -0
  63. package/utils/url.js +0 -0
package/LICENSE CHANGED
File without changes
package/action.js CHANGED
@@ -13,6 +13,7 @@ import ActionsDialogsAlert from "./actions/dialogs/alert";
13
13
  import ActionsDialogsShow from "./actions/dialogs/show";
14
14
  import ActionsDialogsOpen from "./actions/dialogs/open";
15
15
  import ActionsDialogsClose from "./actions/dialogs/close";
16
+ import ActionsDialogsReload from "./actions/dialogs/reload";
16
17
  import ActionsDialogsOptions from "./actions/dialogs/options";
17
18
  import ActionsDialogsNotification from "./actions/dialogs/notification";
18
19
  import ActionsDialogsOauth from "./actions/dialogs/oauth";
@@ -62,6 +63,7 @@ const actions = {
62
63
  "dialogs/show": ActionsDialogsShow,
63
64
  "dialogs/open": ActionsDialogsOpen,
64
65
  "dialogs/close": ActionsDialogsClose,
66
+ "dialogs/reload": ActionsDialogsReload,
65
67
  "dialogs/options": ActionsDialogsOptions,
66
68
  "dialogs/notification": ActionsDialogsNotification,
67
69
  "dialogs/oauth": ActionsDialogsOauth,
File without changes
@@ -1,5 +1,5 @@
1
1
  export default class {
2
- execute(properties) {
2
+ execute(properties, component) {
3
3
  Utils.type.ifString(properties.channel, channelName => {
4
4
  const ws = window.vueApp.actionCable;
5
5
  const channel = ws.channels[channelName];
@@ -17,7 +17,8 @@ export default class {
17
17
  } else {
18
18
  console.error(`Channel not joined: '${channelName}'`);
19
19
  Utils.launch.snackbar.error(
20
- "Something went wrong and we have been notified"
20
+ "Something went wrong and we have been notified",
21
+ component
21
22
  );
22
23
  }
23
24
  });
@@ -1,4 +1,4 @@
1
- import Launch from "../../utils/launch";
1
+ // import Launch from "../../utils/launch";
2
2
 
3
3
  export default class {
4
4
  execute(properties, component) {
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ export default class {
2
+ execute(spec, component) {
3
+ Utils.launch.dialog.reload(spec, component);
4
+ }
5
+ }
@@ -1,6 +1,5 @@
1
1
  export default class {
2
2
  execute(spec, component) {
3
- console.log("P1", spec);
4
3
  Utils.launch.dialog.open(spec, component);
5
4
  }
6
5
  }
@@ -1,5 +1,5 @@
1
1
  export default class {
2
- execute(properties) {
3
- Utils.launch.sheet.open(properties);
2
+ execute(properties, component) {
3
+ Utils.launch.sheet.open(properties, component);
4
4
  }
5
5
  }
@@ -1,7 +1,5 @@
1
- import Launch from "../../utils/launch";
2
-
3
1
  export default class {
4
- execute(properties) {
2
+ execute(properties, component) {
5
3
  const spec = Object.assign({}, properties, {
6
4
  buttons: [
7
5
  {
@@ -10,6 +8,6 @@ export default class {
10
8
  }
11
9
  ]
12
10
  });
13
- Utils.launch.snackbar.open(spec);
11
+ Utils.launch.snackbar.open(spec, component);
14
12
  }
15
13
  }
@@ -1,5 +1,5 @@
1
1
  export default class {
2
- execute(properties) {
3
- Utils.launch.snackbar.open(properties);
2
+ execute(properties, component) {
3
+ Utils.launch.snackbar.open(properties, component);
4
4
  }
5
5
  }
File without changes
@@ -26,7 +26,8 @@ export default class {
26
26
  } else {
27
27
  console.error(`Topic not joined: '${topicName}'`);
28
28
  Utils.launch.snackbar.error(
29
- "Something went wrong and we have been notified"
29
+ "Something went wrong and we have been notified",
30
+ component
30
31
  );
31
32
  }
32
33
  });
File without changes
@@ -81,7 +81,7 @@ export default {
81
81
  };
82
82
  </script>
83
83
 
84
- <style scoped>
84
+ <style lang="scss" scoped>
85
85
  .row {
86
86
  margin-left: 0;
87
87
  margin-right: 0;
@@ -96,8 +96,25 @@ export default {
96
96
  .full-height {
97
97
  height: 100%;
98
98
  }
99
- .v-application a {
99
+ a.panels-responsive {
100
100
  color: inherit;
101
101
  text-decoration: inherit;
102
+
103
+ // So that we can display a semi-transparent layer on hover (see below)
104
+ position: relative;
105
+
106
+ &:hover:after {
107
+ content: "\A";
108
+ width: 100%;
109
+ height: 100%;
110
+ background: rgba(0, 0, 0, 0.2);
111
+ position: absolute;
112
+ top: 0;
113
+ left: 0;
114
+ }
115
+
116
+ &:active:after {
117
+ background: rgba(0, 0, 0, 0.4);
118
+ }
102
119
  }
103
120
  </style>
File without changes
File without changes
@@ -17,6 +17,7 @@
17
17
  :class="$classes()"
18
18
  :outlined="$classes().includes('outlined')"
19
19
  :append-icon="append.icon"
20
+ @change="onChange"
20
21
  />
21
22
 
22
23
  <input
@@ -80,6 +81,13 @@ export default {
80
81
  },
81
82
  classes() {
82
83
  return this.$classes().concat("g-text-field--hintless");
84
+ },
85
+ onChange() {
86
+ Utils.type.ifObject(this.spec.onChange, onChange => {
87
+ this.$nextTick(() => {
88
+ GLib.action.execute(onChange, this);
89
+ });
90
+ });
83
91
  }
84
92
  }
85
93
  };
@@ -68,11 +68,17 @@ export default {
68
68
  );
69
69
  }, 100);
70
70
 
71
- if (this.spec.submitOnChange) {
72
- setTimeout(() => {
73
- this.$dispatchEvent("forms/submit");
74
- }, 200);
75
- }
71
+ // if (this.spec.submitOnChange) {
72
+ // setTimeout(() => {
73
+ // this.$dispatchEvent("forms/submit");
74
+ // }, 200);
75
+ // }
76
+
77
+ Utils.type.ifObject(this.spec.onChange, onChange => {
78
+ this.$nextTick(() => {
79
+ GLib.action.execute(onChange, this);
80
+ });
81
+ });
76
82
  },
77
83
  $internalizeValue(val) {
78
84
  if (val == this.spec.checkValue) {
File without changes
File without changes
File without changes
File without changes
@@ -93,10 +93,14 @@ export default {
93
93
  this.groupValues.push([{}]);
94
94
  },
95
95
  removeGroup(index) {
96
- Utils.launch.sheet.confirm({}, () => {
97
- // Don't delete the group in order to maintain consistent indexes between model and view.
98
- this.$set(this.groupValues[index], "_destroy", 1);
99
- });
96
+ Utils.launch.sheet.confirm(
97
+ {},
98
+ () => {
99
+ // Don't delete the group in order to maintain consistent indexes between model and view.
100
+ this.$set(this.groupValues[index], "_destroy", 1);
101
+ },
102
+ this
103
+ );
100
104
  },
101
105
  isDeleted(index) {
102
106
  return this.groupValues[index]._destroy;
File without changes
@@ -133,7 +133,7 @@ export default {
133
133
  input.disabled = true;
134
134
  upload.start((error, blob) => {
135
135
  if (error) {
136
- Utils.launch.snackbar.error(error);
136
+ Utils.launch.snackbar.error(error, this);
137
137
  } else {
138
138
  this.uploaded = true;
139
139
  this.progress.value = -1;
@@ -5,6 +5,7 @@
5
5
  :disabled="spec.readOnly"
6
6
  :rules="$validation()"
7
7
  :row="spec.row"
8
+ @change="onChange"
8
9
  >
9
10
  <div v-for="(item, index) in spec.childViews" :key="index">
10
11
  <ui-component :spec="item" />
@@ -23,6 +24,15 @@
23
24
  export default {
24
25
  props: {
25
26
  spec: { type: Object, required: true }
27
+ },
28
+ methods: {
29
+ onChange() {
30
+ Utils.type.ifObject(this.spec.onChange, onChange => {
31
+ this.$nextTick(() => {
32
+ GLib.action.execute(onChange, this);
33
+ });
34
+ });
35
+ }
26
36
  }
27
37
  };
28
38
  </script>
File without changes
File without changes
package/components/hr.vue CHANGED
File without changes
File without changes
@@ -23,12 +23,12 @@ export default {
23
23
  });
24
24
  return augmentedRules;
25
25
  },
26
- // This can be overridden by the component to ensure that dialogs are shown within the component,
27
- // which is necessary for operations requiring certain hierarchy, e.g. submitting a form from a
28
- // child dialog.
29
- $dialogContainer() {
30
- return document.body;
31
- },
26
+ // // This can be overridden by the component to ensure that dialogs are shown within the component,
27
+ // // which is necessary for operations requiring certain hierarchy, e.g. submitting a form from a
28
+ // // child dialog.
29
+ // $dialogContainer() {
30
+ // return document.body;
31
+ // },
32
32
  $wsSubscribeEvents(spec) {
33
33
  if (!Utils.type.isObject(spec)) {
34
34
  return;
File without changes
File without changes
File without changes
File without changes
@@ -95,7 +95,10 @@ export default {
95
95
  })
96
96
  .receive("error", resp => {
97
97
  console.log(`Unable to join channel '${topicName}'`, resp);
98
- Utils.launch.snackbar.error("Unable to connect. Please try again.");
98
+ Utils.launch.snackbar.error(
99
+ "Unable to connect. Please try again.",
100
+ this
101
+ );
99
102
  });
100
103
  },
101
104
  _wsDisconnectSocket() {
package/components/p.vue CHANGED
File without changes
@@ -5,7 +5,7 @@
5
5
  :md="md.cols"
6
6
  :sm="sm.cols"
7
7
  :style="cssStyles()"
8
- cols="12"
8
+ :cols="xs.cols || 12"
9
9
  >
10
10
  <panels-responsive :spec="spec" />
11
11
  </v-col>
@@ -96,10 +96,7 @@ export default {
96
96
  this.submit();
97
97
  },
98
98
  submit() {
99
- if (this.$refs.form.validate()) {
100
- // Remove focus from current input field to avoid double submit if the user presses ENTER again.
101
- document.activeElement.blur();
102
-
99
+ this.validate(() => {
103
100
  Utils.type.ifObject(
104
101
  this.spec.onSubmit,
105
102
  onSubmit => {
@@ -114,19 +111,29 @@ export default {
114
111
  this.directSubmit();
115
112
  }
116
113
  );
117
- } else {
118
- Utils.launch.dialog.alert("Make sure all fields are valid");
119
- }
114
+ });
120
115
  },
121
116
  directSubmit() {
122
- GLib.form.submitData(this.formElement, this);
117
+ this.validate(() => {
118
+ GLib.form.submitData(this.formElement, this);
119
+ });
120
+ },
121
+ validate(onPassed) {
122
+ if (this.$refs.form.validate()) {
123
+ // Remove focus from current input field to avoid double submit if the user presses ENTER again.
124
+ document.activeElement.blur();
125
+
126
+ onPassed();
127
+ } else {
128
+ Utils.launch.dialog.alert("Make sure all fields are valid", this);
129
+ }
123
130
  },
124
131
  action_clear() {
125
132
  this.formElement.reset();
126
- },
127
- $dialogContainer() {
128
- return this.formElement;
129
133
  }
134
+ // $dialogContainer() {
135
+ // return this.formElement;
136
+ // }
130
137
  }
131
138
  };
132
139
  </script>
@@ -65,7 +65,7 @@ export default {
65
65
  };
66
66
  </script>
67
67
 
68
- <style scoped>
68
+ <style lang="scss" scoped>
69
69
  .layouts-horizontal {
70
70
  display: flex;
71
71
  /* overflow: hidden; */
@@ -75,6 +75,28 @@ export default {
75
75
  .layouts-horizontal--space-equally {
76
76
  justify-content: space-around;
77
77
  }
78
+
79
+ a.panels-horizontal {
80
+ color: inherit;
81
+ text-decoration: inherit;
82
+
83
+ // So that we can display a semi-transparent layer on hover (see below)
84
+ position: relative;
85
+
86
+ &:hover:after {
87
+ content: "\A";
88
+ width: 100%;
89
+ height: 100%;
90
+ background: rgba(0, 0, 0, 0.2);
91
+ position: absolute;
92
+ top: 0;
93
+ left: 0;
94
+ }
95
+
96
+ &:active:after {
97
+ background: rgba(0, 0, 0, 0.4);
98
+ }
99
+ }
78
100
  </style>
79
101
 
80
102
  <style>
File without changes
@@ -19,12 +19,10 @@
19
19
  <div v-if="item.left_label" class="number-circle">
20
20
  {{ item.left_label }}
21
21
  </div>
22
- <v-icon v-else size="24" :color="dotColor(item)">{{
23
- (item.active || item.completed
24
- ? item.activeIcon
25
- : item.regularIcon) ||
26
- (item.active || item.completed ? activeIcon : regularIcon)
27
- }}</v-icon>
22
+ <!-- TODO: Use common-icon -->
23
+ <v-icon v-else size="24" :color="dotColor(item)">
24
+ {{ dotIcon(item) }}
25
+ </v-icon>
28
26
  </div>
29
27
  </template>
30
28
 
@@ -52,9 +50,9 @@ export default {
52
50
  data() {
53
51
  return {
54
52
  items: this.spec.items,
55
- activeIcon: this.spec.activeIcon || "check_circle",
56
- regularIcon: this.spec.regularIcon || "radio_button_unchecked",
57
- color: this.spec.color || "blue",
53
+ uncompletedIcon: this.spec.uncompletedIcon || "check_circle",
54
+ completedIcon: this.spec.completedIcon || "radio_button_unchecked",
55
+ completedColor: this.spec.completedColor || "blue",
58
56
  uncompletedColor: this.spec.uncompletedColor || "grey"
59
57
  };
60
58
  },
@@ -71,7 +69,12 @@ export default {
71
69
  dotColor(item) {
72
70
  return !item.completed && !item.active
73
71
  ? this.uncompletedColor
74
- : item.color || this.color;
72
+ : this.completedColor;
73
+ },
74
+ dotIcon(item) {
75
+ return item.active || item.completed
76
+ ? item.uncompletedIcon || this.uncompletedIcon
77
+ : item.completedIcon || this.completedIcon
75
78
  }
76
79
  }
77
80
  };
File without changes
@@ -56,7 +56,7 @@ export default {
56
56
  };
57
57
  </script>
58
58
 
59
- <style scoped>
59
+ <style lang="scss" scoped>
60
60
  .layouts-vertical {
61
61
  display: flex;
62
62
  /* overflow: hidden; */
@@ -67,6 +67,28 @@ export default {
67
67
  .layouts-vertical--space-equally {
68
68
  justify-content: space-around;
69
69
  }
70
+
71
+ a.panels-vertical {
72
+ color: inherit;
73
+ text-decoration: inherit;
74
+
75
+ // So that we can display a semi-transparent layer on hover (see below)
76
+ position: relative;
77
+
78
+ &:hover:after {
79
+ content: "\A";
80
+ width: 100%;
81
+ height: 100%;
82
+ background: rgba(0, 0, 0, 0.2);
83
+ position: absolute;
84
+ top: 0;
85
+ left: 0;
86
+ }
87
+
88
+ &:active:after {
89
+ background: rgba(0, 0, 0, 0.4);
90
+ }
91
+ }
70
92
  </style>
71
93
 
72
94
  <style>
package/keys.js CHANGED
File without changes
package/nav/appbar.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div>
2
+ <div :class="cssClasses()">
3
3
  <nav-drawer
4
4
  v-if="page.leftDrawer"
5
5
  :trigger="drawerTrigger"
@@ -7,7 +7,7 @@
7
7
  :spec="page.leftDrawer"
8
8
  />
9
9
 
10
- <v-toolbar :style="style" class="pages-navBar">
10
+ <v-toolbar :style="style" :height="navBar.height">
11
11
  <v-app-bar-nav-icon
12
12
  v-if="page.leftDrawer && !isPermanent"
13
13
  style="color: inherit;"
@@ -25,20 +25,29 @@
25
25
  </div>
26
26
  <v-spacer></v-spacer>
27
27
 
28
- <template v-for="(btn, index) in navBar.rightButtons">
29
- <common-dropdownMenu
30
- v-if="btn.childButtons"
31
- :key="index"
32
- :spec="btn"
33
- :disabled="$isBusy"
34
- />
35
- <common-button
36
- v-else
37
- :key="`right_${index}`"
38
- :spec="buttonSpec(btn)"
39
- :disabled="$isBusy"
40
- />
41
- </template>
28
+ <!-- See https://codesandbox.io/embed/14ry9r3lll -->
29
+ <v-toolbar-items class="hidden-sm-and-down">
30
+ <template v-for="(btn, index) in navBar.rightButtons">
31
+ <common-dropdownMenu
32
+ v-if="btn.childButtons"
33
+ :key="index"
34
+ :spec="btn"
35
+ :disabled="$isBusy"
36
+ />
37
+ <common-button
38
+ v-else
39
+ :key="`right_${index}`"
40
+ :spec="buttonSpec(btn)"
41
+ :disabled="$isBusy"
42
+ />
43
+ </template>
44
+ </v-toolbar-items>
45
+
46
+ <common-dropdownMenu
47
+ v-if="showMobileMenu"
48
+ class="hidden-md-and-up"
49
+ :spec="mobileMenu"
50
+ />
42
51
 
43
52
  <views-avatar v-if="navBar.imageUrl" :spec="avatarSpec(navBar)" />
44
53
 
@@ -56,7 +65,6 @@
56
65
 
57
66
  <script>
58
67
  import NavDrawer from "./drawer";
59
- import Launch from "../utils/launch";
60
68
  import ViewsAvatar from "../components/avatar";
61
69
 
62
70
  export default {
@@ -71,7 +79,8 @@ export default {
71
79
  return {
72
80
  drawerTrigger: null,
73
81
  navBar: {},
74
- on: false
82
+ rightButtons: []
83
+ // on: false
75
84
  };
76
85
  },
77
86
  computed: {
@@ -90,16 +99,29 @@ export default {
90
99
  },
91
100
  isPermanent() {
92
101
  return this.leftPadding !== null;
102
+ },
103
+ showMobileMenu() {
104
+ return this.rightButtons.length > 0 && this.$vuetify.breakpoint.smAndDown;
105
+ },
106
+ mobileMenu() {
107
+ return {
108
+ icon: { material: { name: "mdi-dots-vertical" } },
109
+ childButtons: this.rightButtons
110
+ };
93
111
  }
94
112
  },
95
113
  methods: {
96
114
  $ready() {
97
115
  this.navBar = this.page.navBar || {};
116
+ this.rightButtons = this.navBar.rightButtons || [];
98
117
  },
99
118
  buttonSpec(item) {
119
+ const styleClasses = (item.styleClasses || []).concat(
120
+ item.text ? ["text"] : ["icon"]
121
+ );
100
122
  return Object.assign({}, item, {
101
123
  view: "button-v1",
102
- styleClasses: item.text ? ["text"] : ["icon"]
124
+ styleClasses: styleClasses
103
125
  });
104
126
  },
105
127
  viewSourceEnabled: function() {
@@ -116,18 +138,25 @@ export default {
116
138
  url: spec["imageUrl"],
117
139
  onClick: spec["onCLick"]
118
140
  };
141
+ },
142
+ cssClasses() {
143
+ this.navBar.view = this.navBar.view || "pages/navBar";
144
+ // console.log("A", this.navBar.view, this.navBar);
145
+ return this.$classes(this.navBar);
119
146
  }
120
147
  }
121
148
  };
122
149
  </script>
123
150
 
124
151
  <style lang="scss" scoped>
125
- .v-btn.views-button {
126
- &.icon {
127
- color: inherit;
128
- }
129
- &.text {
130
- color: inherit;
152
+ .v-btn {
153
+ &.views-button {
154
+ &.icon {
155
+ color: inherit;
156
+ }
157
+ &.text {
158
+ color: inherit;
159
+ }
131
160
  }
132
161
  }
133
162
  .pages-navBar {
package/nav/dialog.vue CHANGED
@@ -89,6 +89,7 @@ export default {
89
89
  this.title = this.spec.title;
90
90
  this.message = this.spec.message;
91
91
  this.body = this.spec.body;
92
+ this.showClose = this.spec.showClose || false;
92
93
  Action.execute(spec.onLoad, this);
93
94
  }
94
95
 
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glib-web",
3
- "version": "0.11.0",
3
+ "version": "0.11.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
File without changes
package/styles/test.sass CHANGED
File without changes
package/styles/test.scss CHANGED
File without changes
File without changes
File without changes
package/utils/dom.js CHANGED
File without changes
package/utils/http.js CHANGED
@@ -170,7 +170,7 @@ export default class {
170
170
  vm.stopIndicator(component);
171
171
  if (!request.canceled) {
172
172
  console.error("Error:", error);
173
- Utils.launch.snackbar.error(error);
173
+ Utils.launch.snackbar.error(error, component);
174
174
  } else {
175
175
  console.info("Canceled");
176
176
  }
package/utils/launch.js CHANGED
@@ -41,11 +41,28 @@ class LaunchDialog {
41
41
  // instance.stack = this.stack;
42
42
 
43
43
  if (component) {
44
- const placeholder = component
45
- .$dialogContainer()
46
- .appendChild(document.createElement("div"));
44
+ // const placeholder = component
45
+ // .$dialogContainer()
46
+ // .appendChild(document.createElement("div"));
47
+
48
+ const placeholder = component.$el.appendChild(
49
+ document.createElement("div")
50
+ );
47
51
  instance.$mount(placeholder);
52
+ } else {
53
+ console.error("A dialog has to be displayed in a component");
54
+ }
55
+ }
56
+
57
+ static reload(properties, component) {
58
+ if (!this.stack) {
59
+ return;
48
60
  }
61
+
62
+ Utils.type.ifObject(this.stack.last(), dialog => {
63
+ // TODO: Find out a way to change the dialog's property.
64
+ console.log("D", dialog);
65
+ });
49
66
  }
50
67
 
51
68
  static close(properties, component) {
@@ -62,7 +79,8 @@ class LaunchDialog {
62
79
  });
63
80
  }
64
81
 
65
- static alert(message) {
82
+ // This is only meant to be used internally
83
+ static alert(message, component) {
66
84
  const properties = {
67
85
  message: message
68
86
  };
@@ -74,12 +92,12 @@ class LaunchDialog {
74
92
  }
75
93
  ]
76
94
  });
77
- this.dialog(spec);
95
+ this.open(spec, component);
78
96
  }
79
97
  }
80
98
 
81
99
  class LaunchSheet {
82
- static open(properties) {
100
+ static open(properties, component) {
83
101
  const SheetClass = Vue.extend(Sheet);
84
102
  const instance = new SheetClass({
85
103
  vuetify: new Vuetify({
@@ -89,15 +107,20 @@ class LaunchSheet {
89
107
  }),
90
108
  propsData: { spec: properties }
91
109
  });
92
- const placeholder = document.body.appendChild(
93
- document.createElement("div")
94
- );
95
- instance.$mount(placeholder);
96
- // instance.show = true
110
+
111
+ if (component) {
112
+ const placeholder = component.$el.appendChild(
113
+ document.createElement("div")
114
+ );
115
+ instance.$mount(placeholder);
116
+ } else {
117
+ console.error("A sheet has to be displayed in a component");
118
+ }
119
+
97
120
  return instance;
98
121
  }
99
122
 
100
- static confirm(properties, onConfirm) {
123
+ static confirm(properties, onConfirm, component) {
101
124
  const spec = Object.assign({}, properties, {
102
125
  buttons: [
103
126
  {
@@ -106,37 +129,42 @@ class LaunchSheet {
106
129
  }
107
130
  ]
108
131
  });
109
- this.open(spec);
132
+ this.open(spec, component);
110
133
  }
111
134
 
112
- static alert(message, buttons) {
135
+ static alert(message, buttons, component) {
113
136
  const spec = { message: message, buttons: buttons };
114
- this.open(spec);
137
+ this.open(spec, component);
115
138
  }
116
139
  }
117
140
 
118
141
  class LaunchSnackbar {
119
- static open(properties) {
142
+ static open(properties, component) {
120
143
  const SnackbarClass = Vue.extend(Snackbar);
121
144
  const instance = new SnackbarClass({
122
145
  vuetify: window.vueApp.vuetify,
123
146
  propsData: { spec: properties, vueApp: window.vueApp }
124
147
  });
125
148
 
126
- const placeholder = document.body.appendChild(
127
- document.createElement("div")
128
- );
129
- instance.$mount(placeholder);
130
- instance.show = true;
149
+ if (component) {
150
+ const placeholder = component.$el.appendChild(
151
+ document.createElement("div")
152
+ );
153
+ instance.$mount(placeholder);
154
+ instance.show = true;
155
+ } else {
156
+ console.error("A snackbar has to be displayed in a component");
157
+ }
158
+
131
159
  return instance;
132
160
  }
133
161
 
134
- static error(message) {
135
- this.open({ message: message, styleClasses: ["error"] });
162
+ static error(message, component) {
163
+ this.open({ message: message, styleClasses: ["error"] }, component);
136
164
  }
137
165
 
138
- static indicator(message) {
139
- const instance = this.open({ message: message, timeout: -1 });
166
+ static indicator(message, component) {
167
+ const instance = this.open({ message: message, timeout: -1 }, component);
140
168
  instance.indicator = true;
141
169
  }
142
170
  }
package/utils/public.js CHANGED
File without changes
package/utils/settings.js CHANGED
File without changes
package/utils/storage.js CHANGED
File without changes
package/utils/url.js CHANGED
File without changes