glib-web 2.6.7 → 2.6.8

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 (41) hide show
  1. package/LICENSE +0 -0
  2. package/action.js +2 -2
  3. package/actions/auth/restart.js +0 -0
  4. package/actions/dialogs/oauth.js +0 -0
  5. package/actions/dialogs/options.js +0 -0
  6. package/actions/panels/scrollTo.js +31 -6
  7. package/app.vue +1 -1
  8. package/components/_message.vue +0 -0
  9. package/components/component.vue +10 -2
  10. package/components/datetime.vue +0 -0
  11. package/components/fab.vue +0 -0
  12. package/components/fields/check.vue +10 -10
  13. package/components/fields/country/countries.js +0 -0
  14. package/components/fields/country/field.vue +0 -0
  15. package/components/fields/country/regions.js +0 -0
  16. package/components/fields/datetime.vue +0 -0
  17. package/components/fields/dynamicSelect.vue +0 -0
  18. package/components/fields/text.vue +2 -1
  19. package/components/fields/textarea.vue +4 -1
  20. package/components/fields/timeZone.vue +0 -0
  21. package/components/hr.vue +0 -0
  22. package/components/html.vue +0 -0
  23. package/components/mixins/events.js +18 -16
  24. package/components/mixins/longClick.js +0 -0
  25. package/components/mixins/scrolling.js +0 -0
  26. package/components/mixins/table/export.js +0 -0
  27. package/components/mixins/table/import.js +0 -0
  28. package/components/p.vue +0 -0
  29. package/keys.js +0 -0
  30. package/nav/dialog.vue +1 -1
  31. package/nav/drawerButton.vue +0 -0
  32. package/package.json +1 -1
  33. package/settings.json.example +0 -0
  34. package/styles/test.sass +0 -0
  35. package/styles/test.scss +0 -0
  36. package/templates/unsupported.vue +0 -0
  37. package/utils/dom.js +0 -0
  38. package/utils/http.js +10 -3
  39. package/utils/settings.js +2 -2
  40. package/utils/storage.js +0 -0
  41. package/utils/url.js +0 -0
package/LICENSE CHANGED
File without changes
package/action.js CHANGED
@@ -160,12 +160,12 @@ export default class Action {
160
160
  try {
161
161
  const action = new registry[actionName]();
162
162
  const logDisabled = action.logDisabled && action.logDisabled();
163
- if (!logDisabled) {
163
+ if (!logDisabled && !spec.silent) {
164
164
  console.debug(`Executing "${actionName}"`);
165
165
  }
166
166
  return action.execute(spec, component, params);
167
167
  } catch (e) {
168
- GLib.settings.errorHandler(e);
168
+ GLib.settings.errorHandler(e, `Failed executing "${actionName}"`);
169
169
  return null;
170
170
  }
171
171
  }
File without changes
File without changes
File without changes
@@ -1,20 +1,45 @@
1
1
  // Scroll the main body of the current window
2
2
  export default class {
3
- execute(properties, component) {
3
+ execute(spec, component) {
4
4
  const pageBody =
5
5
  Utils.launch.dialog.closestBody(component) || Utils.history._pageBody;
6
6
 
7
- const selector = `#${properties.viewId}`;
7
+ const selector = `#${spec.viewId}`;
8
8
  console.debug("Scrolling to", selector);
9
9
  const element = pageBody.querySelector(selector);
10
- element.scrollIntoView({
11
- behavior: properties["animate"] ? "smooth" : "auto"
12
- });
10
+
11
+ this.scrollIfNeeded(element, spec, component);
13
12
 
14
13
  element.classList.add("glib-scrollto");
15
14
  element.classList.add("glib-scrollto--highlighted");
15
+ }
16
+
17
+ // From https://gist.github.com/hsablonniere/2581101
18
+ scrollIfNeeded(element, spec, component, centerIfNeeded = true) {
19
+ const vm = this;
20
+ const observerOptions = {
21
+ threshold: 1 // Trigger callback when 100% of the element becomes/unbecomes visible
22
+ };
23
+ new IntersectionObserver(function([entry]) {
24
+ const ratio = entry.intersectionRatio;
25
+ if (ratio < 1) {
26
+ const place = ratio <= 0 && centerIfNeeded ? "center" : "nearest";
27
+ element.scrollIntoView({
28
+ block: place,
29
+ inline: place,
30
+ behavior: spec["animate"] ? "smooth" : "auto"
31
+ });
32
+ } else {
33
+ vm.onScrollEnd(element, spec, component);
34
+ this.disconnect();
35
+ }
36
+ }, observerOptions).observe(element);
37
+ }
38
+
39
+ onScrollEnd(element, spec, component) {
16
40
  setTimeout(() => {
17
41
  element.classList.remove("glib-scrollto--highlighted");
18
- }, 500);
42
+ }, 300); // Allow time so the changes can be seen by human eyes.
43
+ GLib.action.execute(spec.onScroll, component);
19
44
  }
20
45
  }
package/app.vue CHANGED
@@ -201,7 +201,7 @@ body,
201
201
  // // So that we can display a semi-transparent layer on hover (see below)
202
202
  position: relative;
203
203
 
204
- &:hover:before {
204
+ &:not(.no-hover):hover:before {
205
205
  content: "\A";
206
206
  width: 100%;
207
207
  height: 100%;
File without changes
@@ -241,7 +241,9 @@ export default {
241
241
  },
242
242
  data() {
243
243
  return {
244
- name: null
244
+ name: null,
245
+ // See events#$recursiveUpdate().
246
+ $passthrough: true
245
247
  };
246
248
  },
247
249
  // beforeUpdate() {
@@ -264,7 +266,13 @@ export default {
264
266
  }
265
267
  },
266
268
  $update() {
267
- this.$refs.delegate.$update();
269
+ this.$ready();
270
+
271
+ const delegate = this.$refs.delegate;
272
+ if (delegate) {
273
+ // Might be null if the component is getting removed as part of the update.
274
+ delegate.$update();
275
+ }
268
276
  },
269
277
  $registryEnabled() {
270
278
  return false;
File without changes
File without changes
@@ -20,12 +20,12 @@
20
20
  <script>
21
21
  export default {
22
22
  props: {
23
- spec: { type: Object, required: true },
23
+ spec: { type: Object, required: true }
24
24
  },
25
25
  data() {
26
26
  return {
27
27
  groupName: null,
28
- fieldType: null,
28
+ fieldType: null
29
29
  };
30
30
  },
31
31
  methods: {
@@ -35,7 +35,7 @@ export default {
35
35
  let groupName = null;
36
36
  this.$type.ifObject(
37
37
  this.groupElement,
38
- (val) => (groupName = val.getAttribute("name"))
38
+ val => (groupName = val.getAttribute("name"))
39
39
  );
40
40
 
41
41
  this.fieldName = this.spec.name || groupName;
@@ -44,7 +44,7 @@ export default {
44
44
  ? this.spec.checkValue
45
45
  : this.spec.value;
46
46
 
47
- Utils.type.ifArray(this.spec.styleClasses, (classes) => {
47
+ Utils.type.ifArray(this.spec.styleClasses, classes => {
48
48
  if (classes.remove("switch")) {
49
49
  this.fieldType = "switch";
50
50
  }
@@ -53,22 +53,22 @@ export default {
53
53
  changed(event) {
54
54
  // Execute later to ensure the checkbox's checked state has been updated.
55
55
  setTimeout(() => {
56
- this.$type.ifObject(this.groupElement, (val) =>
56
+ this.$type.ifObject(this.groupElement, val =>
57
57
  val.dispatchEvent(new Event("change"))
58
58
  );
59
59
  }, 100);
60
60
 
61
- setTimeout(() => {
62
- this.$executeOnChange();
63
- }, 500);
61
+ // setTimeout(() => {
62
+ this.$executeOnChange();
63
+ // }, 500);
64
64
  },
65
65
  $internalizeValue(val) {
66
66
  if (val == this.spec.checkValue) {
67
67
  return val;
68
68
  }
69
69
  return this.spec.uncheckValue;
70
- },
71
- },
70
+ }
71
+ }
72
72
  };
73
73
  </script>
74
74
 
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -9,7 +9,8 @@
9
9
  :hint="spec.hint"
10
10
  :placeholder="spec.placeholder"
11
11
  :maxlength="spec.maxLength || 255"
12
- :disabled="spec.readOnly"
12
+ :disabled="spec.disabled"
13
+ :readonly="spec.readOnly"
13
14
  :type="variant.type"
14
15
  :rules="rules"
15
16
  :prepend-inner-icon="leftIconName"
@@ -8,12 +8,15 @@
8
8
  :hint="spec.hint"
9
9
  :placeholder="spec.placeholder"
10
10
  :maxlength="spec.maxLength || 255"
11
- :disabled="spec.readOnly"
11
+ :disabled="spec.disabled"
12
+ :readonly="spec.readOnly"
12
13
  :height="height"
13
14
  :rules="$validation()"
14
15
  counter
15
16
  :outlined="$classes().includes('outlined')"
16
17
  :no-resize="$classes().includes('no-resize')"
18
+ :dense="$classes().includes('dense')"
19
+ :autofocus="spec.autoFocus || false"
17
20
  validate-on-blur
18
21
  @keyup="$onTyping"
19
22
  @input="onChange"
File without changes
package/components/hr.vue CHANGED
File without changes
File without changes
@@ -166,26 +166,28 @@ export default {
166
166
  // this._linkFieldModels();
167
167
  this.$ready();
168
168
  },
169
- async $recursiveUpdate() {
170
- this.$update();
171
- this.$forceUpdate();
169
+ async $recursiveUpdate(stack) {
170
+ const children = this.$children;
171
+ if (this.spec) {
172
+ this.$update();
173
+ // this.$forceUpdate();
172
174
 
173
- // Execute on next tick to ensure that the children have received the updated spec.
174
- // Important: The nextTick() needs to be used in each of the recursion.
175
- await this.$nextTick();
175
+ if (this.$data.$passthrough && children.length > 0) {
176
+ // stack = stack || [];
177
+ // stack = stack.concat([GLib.component.vueName(this)]);
176
178
 
177
- this.$children.find(child => {
178
- child.$recursiveUpdate();
179
+ // Execute on next tick to ensure that the children have received the updated spec.
180
+ // Important: The nextTick() needs to be used in each of the recursion.
181
+ //
182
+ // Not sure if this is still required if component.vue's $ready() is written as a computed property.
183
+ await this.$nextTick();
184
+ }
185
+ }
186
+
187
+ children.find(child => {
188
+ child.$recursiveUpdate(stack);
179
189
  });
180
190
  },
181
- // _recursiveUpdate() {
182
- // this.$update();
183
- // this.$forceUpdate();
184
-
185
- // this.$children.find(child => {
186
- // child._recursiveUpdate();
187
- // });
188
- // },
189
191
  $dispatchEvent(name, data) {
190
192
  const event = new Event(name, { bubbles: true });
191
193
 
File without changes
File without changes
File without changes
File without changes
package/components/p.vue CHANGED
File without changes
package/keys.js CHANGED
File without changes
package/nav/dialog.vue CHANGED
@@ -5,7 +5,7 @@
5
5
  :dark="false"
6
6
  :fullscreen="fullscreen"
7
7
  :sm-and-down="false"
8
- :persistent="true"
8
+ :persistent="!spec.closeOnBlur"
9
9
  >
10
10
  <v-card :style="hamburgerStyles" class="hamburger">
11
11
  <!-- <v-card-title v-if="title || showClose" class="text-h5" primary-title> -->
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glib-web",
3
- "version": "2.6.7",
3
+ "version": "2.6.8",
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
package/utils/http.js CHANGED
@@ -160,7 +160,10 @@ export default class {
160
160
  url = Utils.url.appendParams(url, body);
161
161
  body = null;
162
162
  }
163
- console.debug(`${method} ${url}`);
163
+ const silent = properties.silent;
164
+ if (!silent) {
165
+ console.debug(`${method} ${url}`);
166
+ }
164
167
 
165
168
  const request = new HttpRequest();
166
169
  let response = null;
@@ -195,7 +198,9 @@ export default class {
195
198
  }
196
199
  })
197
200
  .then(data => {
198
- console.debug("Success", data);
201
+ if (!silent) {
202
+ console.debug("Success", data);
203
+ }
199
204
  jsonHandler(data, response);
200
205
  })
201
206
  .catch(error => {
@@ -209,7 +214,9 @@ export default class {
209
214
  if (errorHandler) {
210
215
  errorHandler(error, response);
211
216
  } else {
212
- Utils.launch.snackbar.error(message, component);
217
+ if (!silent) {
218
+ Utils.launch.snackbar.error(message, component);
219
+ }
213
220
  }
214
221
  } else {
215
222
  console.info("Canceled");
package/utils/settings.js CHANGED
@@ -3,8 +3,8 @@ class MutableSettings {
3
3
  this.reactive = true;
4
4
  this.themes = {};
5
5
  this.gtagId = null;
6
- this.errorHandler = err => {
7
- console.error(err.message);
6
+ this.errorHandler = (err, message) => {
7
+ console.error(message || err.message);
8
8
  };
9
9
  this.headerAugmenter = (_url, _method) => {
10
10
  // Set a custom augmenter to add custom HTTP headers.
package/utils/storage.js CHANGED
File without changes
package/utils/url.js CHANGED
File without changes