glib-web 0.15.3 → 0.17.0

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 (47) hide show
  1. package/LICENSE +0 -0
  2. package/actions/auth/restart.js +0 -0
  3. package/actions/dialogs/oauth.js +0 -0
  4. package/actions/dialogs/options.js +0 -0
  5. package/actions/windows/openWeb.js +0 -0
  6. package/components/_message.vue +0 -0
  7. package/components/avatar.vue +5 -1
  8. package/components/charts/pie.vue +34 -0
  9. package/components/component.vue +5 -1
  10. package/components/datetime.vue +0 -0
  11. package/components/fab.vue +0 -0
  12. package/components/fields/check.vue +1 -0
  13. package/components/fields/checkGroup.vue +8 -1
  14. package/components/fields/country/countries.js +0 -0
  15. package/components/fields/country/field.vue +0 -0
  16. package/components/fields/country/regions.js +0 -0
  17. package/components/fields/datetime.vue +0 -0
  18. package/components/fields/dynamicSelect.vue +0 -0
  19. package/components/fields/richText.vue +44 -10
  20. package/components/fields/select.vue +0 -0
  21. package/components/fields/text.vue +14 -3
  22. package/components/fields/timeZone.vue +0 -0
  23. package/components/hr.vue +0 -0
  24. package/components/html.vue +0 -0
  25. package/components/mixins/longClick.js +0 -0
  26. package/components/mixins/scrolling.js +0 -0
  27. package/components/mixins/styles.js +1 -20
  28. package/components/mixins/table/export.js +0 -0
  29. package/components/mixins/table/import.js +0 -0
  30. package/components/p.vue +0 -0
  31. package/components/panels/list.vue +5 -0
  32. package/components/progressCircle.vue +22 -0
  33. package/index.js +0 -7
  34. package/keys.js +0 -0
  35. package/nav/drawer.vue +21 -12
  36. package/nav/drawerButton.vue +0 -0
  37. package/package.json +1 -1
  38. package/settings.json.example +0 -0
  39. package/styles/test.sass +0 -0
  40. package/styles/test.scss +0 -0
  41. package/templates/unsupported.vue +0 -0
  42. package/utils/dom.js +0 -0
  43. package/utils/eventFiltering.js +11 -0
  44. package/utils/public.js +0 -0
  45. package/utils/settings.js +0 -0
  46. package/utils/storage.js +0 -0
  47. package/utils/url.js +0 -0
package/LICENSE CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -10,7 +10,11 @@
10
10
  <common-badge :spec="spec">
11
11
  <v-avatar :size="spec.size">
12
12
  <!-- Use `img` instead of `v-img` otherwise the rounded border will not work. -->
13
- <img :src="spec.url || spec.base64Data" @click="$onClick()" />
13
+ <img
14
+ :style="$styles()"
15
+ :src="spec.url || spec.base64Data"
16
+ @click="$onClick()"
17
+ />
14
18
  </v-avatar>
15
19
  </common-badge>
16
20
  </template>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <pie-chart
3
+ :style="genericStyles()"
4
+ :class="$classes()"
5
+ :data="series"
6
+ :library="options"
7
+ ></pie-chart>
8
+ </template>
9
+
10
+ <script>
11
+ export default {
12
+ mixins: [],
13
+ props: {
14
+ spec: { type: Object, required: true }
15
+ },
16
+ data: function() {
17
+ return {
18
+ series: []
19
+ };
20
+ },
21
+ methods: {
22
+ $ready() {
23
+ this.series = this.spec.dataSeries.reduce((prev, curr) => {
24
+ let obj = {};
25
+ obj[curr.title] = curr.value;
26
+
27
+ return Object.assign(prev, obj);
28
+ }, {});
29
+ }
30
+ }
31
+ };
32
+ </script>
33
+
34
+ <style scoped></style>
@@ -46,6 +46,7 @@ import Chip from "./chip";
46
46
  import Datetime from "./datetime";
47
47
 
48
48
  import ProgressBar from "./progressbar";
49
+ import ProgressCircle from "./progressCircle.vue";
49
50
 
50
51
  import Image from "./image";
51
52
  import Avatar from "./avatar";
@@ -114,6 +115,7 @@ import SelectBanner from "./banners/select";
114
115
 
115
116
  import LineChart from "./charts/line";
116
117
  import ColumnChart from "./charts/column";
118
+ import PieChart from "./charts/pie";
117
119
 
118
120
  import ShareButton from "./shareButton";
119
121
 
@@ -132,6 +134,7 @@ export default {
132
134
  "views-chip": Chip,
133
135
  "views-datetime": Datetime,
134
136
  "views-progressBar": ProgressBar,
137
+ "views-progressCircle": ProgressCircle,
135
138
 
136
139
  "views-image": Image,
137
140
  "views-avatar": Avatar,
@@ -200,7 +203,8 @@ export default {
200
203
  "banners-select": SelectBanner,
201
204
 
202
205
  "charts-line": LineChart,
203
- "charts-column": ColumnChart
206
+ "charts-column": ColumnChart,
207
+ "charts-pie": PieChart
204
208
  },
205
209
  props: {
206
210
  spec: { type: Object, required: true }
File without changes
File without changes
@@ -6,6 +6,7 @@
6
6
  <v-checkbox
7
7
  v-model="fieldModel"
8
8
  :name="fieldName"
9
+ :disabled="spec.readOnly"
9
10
  :value="spec.checkValue"
10
11
  :label="fieldModel ? spec.onLabel || spec.label : spec.label"
11
12
  :on-icon="spec.onIcon"
@@ -8,7 +8,7 @@
8
8
  <!-- <fields-hidden v-if="!anyChecked" :spec="uncheckSpec" /> -->
9
9
 
10
10
  <div v-for="(item, index) in spec.childViews" :key="index">
11
- <glib-component :spec="item" />
11
+ <glib-component :spec="childSpec(item)" />
12
12
  </div>
13
13
 
14
14
  <v-text-field
@@ -76,6 +76,13 @@ export default {
76
76
  return;
77
77
  }
78
78
  });
79
+ },
80
+ childSpec(item) {
81
+ if (this.spec.readOnly) {
82
+ return Object.assign(item, { readOnly: this.spec.readOnly });
83
+ }
84
+
85
+ return item;
79
86
  }
80
87
  }
81
88
  };
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -4,7 +4,6 @@
4
4
  <VueEditor
5
5
  v-model="rawValue"
6
6
  :editor-toolbar="customToolbar"
7
- :use-custom-image-handler="true"
8
7
  @text-change="separateOutImages"
9
8
  @image-added="uploadImage"
10
9
  />
@@ -39,7 +38,7 @@ export default {
39
38
  ["bold", "italic", "strike"],
40
39
  [{ header: 1 }, { header: 2 }],
41
40
  [{ list: "ordered" }, { list: "bullet" }],
42
- ["blockquote", "link"]
41
+ ["link"]
43
42
  ],
44
43
  rawValue: "",
45
44
  cleanValue: "",
@@ -49,6 +48,14 @@ export default {
49
48
  imageUploader: {},
50
49
  turndownService: new TurndownService({ headingStyle: "atx" })
51
50
  }),
51
+ computed: {
52
+ showProgress: function() {
53
+ return this.progress.value >= 0;
54
+ },
55
+ markdownValue: function() {
56
+ return this.turndownService.turndown(this.rawValue);
57
+ }
58
+ },
52
59
  // mounted: function () {
53
60
  // const vm = this
54
61
  // this.rawValue = (this.spec.value || "").replace(/\{\{image([0-9]+)\}\}/g, function (_, index) {
@@ -62,13 +69,8 @@ export default {
62
69
  // return "{{IMAGE_NOT_FOUND}}"
63
70
  // })
64
71
  // },
65
- computed: {
66
- showProgress: function() {
67
- return this.progress.value >= 0;
68
- },
69
- markdownValue: function() {
70
- return this.turndownService.turndown(this.rawValue);
71
- }
72
+ mounted() {
73
+ this.registerScrollEvent();
72
74
  },
73
75
  methods: {
74
76
  $ready() {
@@ -162,12 +164,39 @@ export default {
162
164
  };
163
165
  reader.readAsDataURL(file);
164
166
  vm.progress.value = -1;
167
+ },
168
+ updateToolbar: function(wrapper, toolbar, container) {
169
+ if (wrapper.scrollTop >= container.offsetTop) {
170
+ toolbar.classList.add("sticky");
171
+ toolbar.style.top = `${wrapper.offsetTop}px`;
172
+ toolbar.style.left = `${wrapper.offsetLeft}px`;
173
+ toolbar.style.width = `${wrapper.offsetWidth}px`;
174
+ } else {
175
+ toolbar.classList.remove("sticky");
176
+ toolbar.style.top = "auto";
177
+ toolbar.style.left = "auto";
178
+ toolbar.style.width = "auto";
179
+ }
180
+ },
181
+ registerScrollEvent: function() {
182
+ const wrapper = document.querySelector(".v-dialog") || window;
183
+ const toolbar = this.$el.querySelector(".ql-toolbar");
184
+ const container = this.$el.querySelector(".ql-container");
185
+
186
+ if (wrapper) {
187
+ wrapper.addEventListener("scroll", () =>
188
+ this.updateToolbar(wrapper, toolbar, container)
189
+ );
190
+ window.addEventListener("resize", () =>
191
+ this.updateToolbar(wrapper, toolbar, container)
192
+ );
193
+ }
165
194
  }
166
195
  }
167
196
  };
168
197
  </script>
169
198
 
170
- <style scoped>
199
+ <style>
171
200
  /*
172
201
  @import "~vue2-editor/dist/vue2-editor.css";
173
202
  @import '~quill/dist/quill.core.css';
@@ -177,4 +206,9 @@ export default {
177
206
  height: 375px;
178
207
  }
179
208
  */
209
+ .ql-toolbar.sticky {
210
+ position: fixed;
211
+ z-index: 99;
212
+ background-color: white;
213
+ }
180
214
  </style>
File without changes
@@ -35,6 +35,8 @@
35
35
  </template>
36
36
 
37
37
  <script>
38
+ import eventFiltering from "../../utils/eventFiltering";
39
+
38
40
  export default {
39
41
  props: {
40
42
  spec: { type: Object, required: true },
@@ -125,11 +127,20 @@ export default {
125
127
  classes() {
126
128
  return this.$classes().concat("g-text-field--hintless");
127
129
  },
128
- // TODO: Consider using debounce to wait until user has finished typing.
129
- onChange() {
130
+ onChange: eventFiltering.debounce(function() {
131
+ this.executeActionWithParams();
132
+ }, 300),
133
+ executeActionWithParams() {
130
134
  Utils.type.ifObject(this.spec.onChange, onChange => {
131
135
  this.$nextTick(() => {
132
- GLib.action.execute(onChange, this);
136
+ const params = {
137
+ [this.spec.paramNameForFormData || "formData"]: {
138
+ [this.fieldName]: this.fieldModel
139
+ }
140
+ };
141
+
142
+ const data = Object.assign({}, onChange, params);
143
+ GLib.action.execute(data, this);
133
144
  });
134
145
  });
135
146
  }
File without changes
package/components/hr.vue CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -40,6 +40,7 @@ export default {
40
40
  if (val === this.vuetifyEmptyString) {
41
41
  val = "";
42
42
  }
43
+
43
44
  // Make the field property observable for dynamic showing/hiding
44
45
  Vue.set(
45
46
  this.$data._fieldModels,
@@ -96,26 +97,6 @@ export default {
96
97
  val => (styles["text-align"] = val)
97
98
  );
98
99
 
99
- // const padding = properties.padding;
100
- // if (Utils.type.isObject(padding)) {
101
- // Utils.type.ifNumber(
102
- // padding.top,
103
- // top => (styles["padding-top"] = `${top}px`)
104
- // );
105
- // Utils.type.ifNumber(
106
- // padding.bottom,
107
- // bottom => (styles["padding-bottom"] = `${bottom}px`)
108
- // );
109
- // Utils.type.ifNumber(
110
- // padding.left,
111
- // left => (styles["padding-left"] = `${left}px`)
112
- // );
113
- // Utils.type.ifNumber(
114
- // padding.right,
115
- // right => (styles["padding-right"] = `${right}px`)
116
- // );
117
- // }
118
-
119
100
  Utils.type.ifObject(properties.padding, padding => {
120
101
  Utils.type.ifNumber(
121
102
  padding.top,
File without changes
File without changes
package/components/p.vue CHANGED
File without changes
@@ -264,4 +264,9 @@ export default {
264
264
  opacity: 0.5;
265
265
  background: #dddddd;
266
266
  }
267
+
268
+ .selected {
269
+ // TODO: Use lighter primary color: https://stackoverflow.com/questions/48280990/using-custom-theming-in-vuetify-and-pass-color-variables-to-components
270
+ background-color: lightblue;
271
+ }
267
272
  </style>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <v-progress-circular
3
+ :class="$classes()"
4
+ :rotate="spec.rotate || 270"
5
+ :size="spec.size || 100"
6
+ :width="spec.width || 20"
7
+ :color="spec.color"
8
+ :value="spec.value"
9
+ >
10
+ <span class="grey--text text--lighten-1 text-h5">{{ spec.text }}</span>
11
+ </v-progress-circular>
12
+ </template>
13
+
14
+ <script>
15
+ export default {
16
+ props: {
17
+ spec: { type: Object, required: true }
18
+ }
19
+ };
20
+ </script>
21
+
22
+ <style scoped></style>
package/index.js CHANGED
@@ -182,13 +182,6 @@ document.addEventListener("DOMContentLoaded", () => {
182
182
  data: {
183
183
  vueApp: window.vueApp
184
184
  },
185
- // data: {
186
- // vuetify: vuetify,
187
- // page: window.__page,
188
- // indicator: false,
189
- // isStale: false,
190
- // webSocket: { channels: {}, header: {}, listWindow: null }
191
- // },
192
185
  render: function(createElement) {
193
186
  return createElement(App, { props: { page: this.$data.vueApp.page } });
194
187
  }
package/keys.js CHANGED
File without changes
package/nav/drawer.vue CHANGED
@@ -10,14 +10,14 @@
10
10
  :permanent="cssClasses.includes('permanent')"
11
11
  :style="style"
12
12
  :expand-on-hover="expandOnHover()"
13
- :mini-variant.sync="mini"
13
+ :mini-variant.sync="shrunk"
14
14
  @input="updateState"
15
15
  >
16
- <template v-if="mini != null" v-slot:prepend>
16
+ <template v-if="mini" v-slot:prepend>
17
17
  <v-list-item>
18
18
  <v-list-item-icon>
19
- <v-icon v-if="!mini">mdi-chevron-left</v-icon>
20
- <v-icon v-if="mini">mdi-chevron-right</v-icon>
19
+ <v-icon v-if="!shrunk">mdi-chevron-left</v-icon>
20
+ <v-icon v-if="shrunk">mdi-chevron-right</v-icon>
21
21
  </v-list-item-icon>
22
22
  </v-list-item>
23
23
  </template>
@@ -39,7 +39,7 @@
39
39
  <v-list-item>
40
40
  <!-- Display the first line when the drawer is shrunk. Display the second line when the drawer is expanded -->
41
41
  <div style="display: none">Show if expand</div>
42
- <panels-responsive v-if="!mini" :spec="spec.footer" />
42
+ <panels-responsive v-if="!shrunk" :spec="spec.footer" />
43
43
  </v-list-item>
44
44
  </template>
45
45
  </v-navigation-drawer>
@@ -135,7 +135,8 @@ export default {
135
135
  // Using null as the starting value for its v-model will initialize the drawer as closed on mobile and as open on desktop.
136
136
  // See https://vuetifyjs.com/en/components/navigation-drawers
137
137
  state: null,
138
- mini: true
138
+ mini: true,
139
+ shrunk: true
139
140
  };
140
141
  },
141
142
  computed: {
@@ -167,7 +168,7 @@ export default {
167
168
  },
168
169
  methods: {
169
170
  $ready() {
170
- this.mini = !this.cssClasses.includes("maxi");
171
+ this.shrunk = this.mini = this.cssClasses.includes("mini");
171
172
  this.updateNavigationStyle(window.location);
172
173
 
173
174
  // this.$el.addEventListener('drawers/clickButton', () => { this.updateState(false) }, false)
@@ -181,10 +182,7 @@ export default {
181
182
  this.state = state;
182
183
  },
183
184
  expandOnHover() {
184
- return (
185
- this.cssClasses.includes("mini") ||
186
- (this.cssClasses.includes("mini-lg-and-above") && this.lgAndAbove)
187
- );
185
+ return this.mini;
188
186
  },
189
187
  updateNavigationStyle(urlObject) {
190
188
  const navMap = navigationMap(this.$el, urlObject.pathname);
@@ -199,7 +197,7 @@ export default {
199
197
  };
200
198
  </script>
201
199
 
202
- <style scoped>
200
+ <style lang="scss" scoped>
203
201
  .nav-item {
204
202
  position: relative;
205
203
  }
@@ -215,3 +213,14 @@ export default {
215
213
  background-color: white;
216
214
  }
217
215
  </style>
216
+
217
+ <style lang="scss">
218
+ // Move the padding to the badge to ensure that the item is middle-aligned.
219
+ .v-list--dense .nav-item .v-list-item .v-list-item__content {
220
+ padding: 0;
221
+
222
+ .v-badge {
223
+ margin: 8px 0;
224
+ }
225
+ }
226
+ </style>
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glib-web",
3
- "version": "0.15.3",
3
+ "version": "0.17.0",
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
package/utils/dom.js CHANGED
File without changes
@@ -0,0 +1,11 @@
1
+ export default class {
2
+ static debounce(func, timeout = 300) {
3
+ let timer;
4
+ return function(...args) {
5
+ clearTimeout(timer);
6
+ timer = setTimeout(() => {
7
+ func.apply(this, args);
8
+ }, timeout);
9
+ };
10
+ }
11
+ }
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