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.
- package/LICENSE +0 -0
- package/action.js +2 -2
- package/actions/auth/restart.js +0 -0
- package/actions/dialogs/oauth.js +0 -0
- package/actions/dialogs/options.js +0 -0
- package/actions/panels/scrollTo.js +31 -6
- package/app.vue +1 -1
- package/components/_message.vue +0 -0
- package/components/component.vue +10 -2
- package/components/datetime.vue +0 -0
- package/components/fab.vue +0 -0
- package/components/fields/check.vue +10 -10
- package/components/fields/country/countries.js +0 -0
- package/components/fields/country/field.vue +0 -0
- package/components/fields/country/regions.js +0 -0
- package/components/fields/datetime.vue +0 -0
- package/components/fields/dynamicSelect.vue +0 -0
- package/components/fields/text.vue +2 -1
- package/components/fields/textarea.vue +4 -1
- package/components/fields/timeZone.vue +0 -0
- package/components/hr.vue +0 -0
- package/components/html.vue +0 -0
- package/components/mixins/events.js +18 -16
- package/components/mixins/longClick.js +0 -0
- package/components/mixins/scrolling.js +0 -0
- package/components/mixins/table/export.js +0 -0
- package/components/mixins/table/import.js +0 -0
- package/components/p.vue +0 -0
- package/keys.js +0 -0
- package/nav/dialog.vue +1 -1
- package/nav/drawerButton.vue +0 -0
- package/package.json +1 -1
- package/settings.json.example +0 -0
- package/styles/test.sass +0 -0
- package/styles/test.scss +0 -0
- package/templates/unsupported.vue +0 -0
- package/utils/dom.js +0 -0
- package/utils/http.js +10 -3
- package/utils/settings.js +2 -2
- package/utils/storage.js +0 -0
- 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
|
}
|
package/actions/auth/restart.js
CHANGED
|
File without changes
|
package/actions/dialogs/oauth.js
CHANGED
|
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(
|
|
3
|
+
execute(spec, component) {
|
|
4
4
|
const pageBody =
|
|
5
5
|
Utils.launch.dialog.closestBody(component) || Utils.history._pageBody;
|
|
6
6
|
|
|
7
|
-
const selector = `#${
|
|
7
|
+
const selector = `#${spec.viewId}`;
|
|
8
8
|
console.debug("Scrolling to", selector);
|
|
9
9
|
const element = pageBody.querySelector(selector);
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
},
|
|
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
package/components/_message.vue
CHANGED
|
File without changes
|
package/components/component.vue
CHANGED
|
@@ -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.$
|
|
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;
|
package/components/datetime.vue
CHANGED
|
File without changes
|
package/components/fab.vue
CHANGED
|
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
|
-
|
|
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,
|
|
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,
|
|
56
|
+
this.$type.ifObject(this.groupElement, val =>
|
|
57
57
|
val.dispatchEvent(new Event("change"))
|
|
58
58
|
);
|
|
59
59
|
}, 100);
|
|
60
60
|
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
|
|
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
|
|
@@ -8,12 +8,15 @@
|
|
|
8
8
|
:hint="spec.hint"
|
|
9
9
|
:placeholder="spec.placeholder"
|
|
10
10
|
:maxlength="spec.maxLength || 255"
|
|
11
|
-
:disabled="spec.
|
|
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
|
package/components/html.vue
CHANGED
|
File without changes
|
|
@@ -166,26 +166,28 @@ export default {
|
|
|
166
166
|
// this._linkFieldModels();
|
|
167
167
|
this.$ready();
|
|
168
168
|
},
|
|
169
|
-
async $recursiveUpdate() {
|
|
170
|
-
this.$
|
|
171
|
-
this
|
|
169
|
+
async $recursiveUpdate(stack) {
|
|
170
|
+
const children = this.$children;
|
|
171
|
+
if (this.spec) {
|
|
172
|
+
this.$update();
|
|
173
|
+
// this.$forceUpdate();
|
|
172
174
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
if (this.$data.$passthrough && children.length > 0) {
|
|
176
|
+
// stack = stack || [];
|
|
177
|
+
// stack = stack.concat([GLib.component.vueName(this)]);
|
|
176
178
|
|
|
177
|
-
|
|
178
|
-
|
|
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
package/nav/drawerButton.vue
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/settings.json.example
CHANGED
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|