glib-web 2.3.0 → 2.4.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.
- package/action.js +1 -1
- package/actions/windows/openWeb.js +0 -0
- package/components/_badge.vue +3 -0
- package/components/_button.vue +16 -1
- package/components/_chip.vue +10 -9
- package/components/_responsive.vue +1 -8
- package/components/_tooltip.vue +48 -10
- package/components/button.vue +7 -1
- package/components/chip.vue +7 -1
- package/components/component.vue +3 -0
- package/components/fields/_patternText.vue +11 -0
- package/components/fields/_select.vue +10 -8
- package/components/fields/date.vue +7 -0
- package/components/fields/richText.vue +203 -115
- package/components/fields/select.vue +1 -1
- package/components/h4.vue +5 -0
- package/components/mixins/events.js +14 -0
- package/components/mixins/generic.js +1 -1
- package/components/mixins/styles.js +6 -3
- package/components/panels/horizontal.vue +17 -1
- package/components/panels/timeline.vue +47 -16
- package/extensions/array.js +4 -0
- package/extensions/string.js +4 -0
- package/index.js +2 -0
- package/nav/drawer.vue +4 -2
- package/package.json +5 -3
- package/templates/thumbnail.vue +2 -2
- package/tsconfig.json +103 -0
- package/utils/app.js +0 -4
- package/utils/component.js +18 -2
- package/utils/format.js +23 -1
- package/utils/hash.js +25 -0
- package/utils/public.js +4 -0
- package/utils/storage.js +2 -3
- package/utils/url.js +10 -8
package/action.js
CHANGED
|
@@ -146,7 +146,7 @@ export default class Action {
|
|
|
146
146
|
|
|
147
147
|
static executeLocal(name, spec, component) {
|
|
148
148
|
const methodName = name.replace(/^component\//, "");
|
|
149
|
-
const componentName =
|
|
149
|
+
const componentName = GLib.component.vueName(component);
|
|
150
150
|
console.log(
|
|
151
151
|
`Executing component action on ${componentName}: ${methodName}`
|
|
152
152
|
);
|
|
File without changes
|
package/components/_badge.vue
CHANGED
package/components/_button.vue
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<common-badge :spec="spec">
|
|
3
|
+
<!-- Use `click.prevent` to prevent bubbling when clicking a dropdown button that is
|
|
4
|
+
located in a list row that has href. -->
|
|
3
5
|
<v-btn
|
|
4
6
|
:type="type"
|
|
5
7
|
:disabled="disabled || $isBusy || spec.disabled"
|
|
@@ -14,7 +16,7 @@
|
|
|
14
16
|
:tile="$classes().includes('tile')"
|
|
15
17
|
:rounded="$classes().includes('rounded')"
|
|
16
18
|
:depressed="$classes().includes('depressed')"
|
|
17
|
-
@click="type == 'submit' ? null : $onClick()"
|
|
19
|
+
@click.prevent="type == 'submit' ? null : $onClick()"
|
|
18
20
|
v-on="eventHandlers"
|
|
19
21
|
>
|
|
20
22
|
<span><common-icon :spec="spec.icon || {}"/></span>
|
|
@@ -51,11 +53,24 @@ export default {
|
|
|
51
53
|
styles["color"] = styles["color"] || "#1976d2";
|
|
52
54
|
}
|
|
53
55
|
return styles;
|
|
56
|
+
},
|
|
57
|
+
$registryEnabled() {
|
|
58
|
+
return false;
|
|
54
59
|
}
|
|
55
60
|
}
|
|
56
61
|
};
|
|
57
62
|
</script>
|
|
58
63
|
|
|
64
|
+
<style lang="scss">
|
|
65
|
+
.v-btn {
|
|
66
|
+
&.link {
|
|
67
|
+
.v-icon {
|
|
68
|
+
font-size: 16px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
73
|
+
|
|
59
74
|
<style lang="scss" scoped>
|
|
60
75
|
a,
|
|
61
76
|
button {
|
package/components/_chip.vue
CHANGED
|
@@ -21,20 +21,21 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script>
|
|
24
|
-
// import TooltipMixins from "./mixins/tooltip";
|
|
25
24
|
export default {
|
|
26
|
-
// mixins: [TooltipMixins],
|
|
27
25
|
props: {
|
|
28
26
|
spec: { type: Object, required: true }
|
|
29
27
|
},
|
|
30
|
-
data: function() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
28
|
+
// data: function() {
|
|
29
|
+
// return {
|
|
30
|
+
// tooltip: {}
|
|
31
|
+
// };
|
|
32
|
+
// },
|
|
35
33
|
methods: {
|
|
36
|
-
$ready() {
|
|
37
|
-
|
|
34
|
+
// $ready() {
|
|
35
|
+
// this.tooltip = this.spec.tooltip || {};
|
|
36
|
+
// },
|
|
37
|
+
$registryEnabled() {
|
|
38
|
+
return false;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
};
|
|
@@ -43,14 +43,7 @@ export default {
|
|
|
43
43
|
computed: {
|
|
44
44
|
cssClasses() {
|
|
45
45
|
// Provide a default name so the panel will not be nameless when used in predefined layouts (e.g. page.body, list.header, etc.)
|
|
46
|
-
return this.$classes(
|
|
47
|
-
Object.assign(
|
|
48
|
-
{
|
|
49
|
-
view: "panels/responsive"
|
|
50
|
-
},
|
|
51
|
-
this.spec
|
|
52
|
-
)
|
|
53
|
-
);
|
|
46
|
+
return this.$classes(this.spec, "panels/responsive");
|
|
54
47
|
},
|
|
55
48
|
componentName() {
|
|
56
49
|
return this.spec.onClick ? "a" : "div";
|
package/components/_tooltip.vue
CHANGED
|
@@ -1,37 +1,63 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<v-menu v-if="spec.childButtons" left bottom>
|
|
3
|
+
<template v-slot:activator="{ on: onMenu }">
|
|
4
|
+
<v-tooltip
|
|
5
|
+
:disabled="tooltip.disabled"
|
|
6
|
+
:top="tooltipPositionMatches('top')"
|
|
7
|
+
:right="tooltipPositionMatches('right')"
|
|
8
|
+
:bottom="tooltipPositionMatches('bottom')"
|
|
9
|
+
:left="tooltipPositionMatches('left')"
|
|
10
|
+
>
|
|
11
|
+
<template v-slot:activator="{ on: onTooltip }">
|
|
12
|
+
<slot name="activator" :on="{ ...onMenu, ...onTooltip }" />
|
|
13
|
+
</template>
|
|
14
|
+
<span> {{ tooltip.text }} </span>
|
|
15
|
+
</v-tooltip>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<v-list>
|
|
19
|
+
<v-list-item
|
|
20
|
+
v-for="(childItem, childIndex) in spec.childButtons"
|
|
21
|
+
:key="childIndex"
|
|
22
|
+
>
|
|
23
|
+
<common-button
|
|
24
|
+
:spec="buttonSpec(childItem)"
|
|
25
|
+
:disabled="childItem.disabled || $isBusy"
|
|
26
|
+
/>
|
|
27
|
+
</v-list-item>
|
|
28
|
+
</v-list>
|
|
29
|
+
</v-menu>
|
|
2
30
|
<v-tooltip
|
|
31
|
+
v-else
|
|
3
32
|
:disabled="tooltip.disabled"
|
|
4
33
|
:top="tooltipPositionMatches('top')"
|
|
5
34
|
:right="tooltipPositionMatches('right')"
|
|
6
35
|
:bottom="tooltipPositionMatches('bottom')"
|
|
7
36
|
:left="tooltipPositionMatches('left')"
|
|
8
37
|
>
|
|
9
|
-
<template v-slot:activator="{ on }">
|
|
10
|
-
|
|
11
|
-
<slot name="activator" :on="on" />
|
|
38
|
+
<template v-slot:activator="{ on: onTooltip }">
|
|
39
|
+
<slot name="activator" :on="{ ...onTooltip }" />
|
|
12
40
|
</template>
|
|
13
41
|
<span> {{ tooltip.text }} </span>
|
|
14
42
|
</v-tooltip>
|
|
15
43
|
</template>
|
|
16
44
|
|
|
17
45
|
<script>
|
|
18
|
-
// import tooltipMixin from "./mixins/tooltip";
|
|
19
|
-
|
|
20
46
|
export default {
|
|
21
|
-
// mixins: [tooltipMixin],
|
|
22
47
|
props: {
|
|
23
48
|
spec: { type: Object, required: true }
|
|
24
49
|
},
|
|
25
50
|
data() {
|
|
26
51
|
return {
|
|
27
|
-
tooltip: {}
|
|
28
|
-
childSpec: Object.assign({}, this.spec, { id: undefined })
|
|
52
|
+
tooltip: {}
|
|
53
|
+
// childSpec: Object.assign({}, this.spec, { id: undefined })
|
|
29
54
|
};
|
|
30
55
|
},
|
|
31
56
|
methods: {
|
|
32
57
|
$ready() {
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
58
|
+
this.updateData();
|
|
59
|
+
// this.tooltip = this.spec.tooltip || { disabled: true };
|
|
60
|
+
// this.childSpec = Object.assign({}, this.spec, { id: undefined });
|
|
35
61
|
},
|
|
36
62
|
// $initAccessories() {
|
|
37
63
|
// this.tooltip = this.spec.tooltip || { disabled: true };
|
|
@@ -42,6 +68,18 @@ export default {
|
|
|
42
68
|
} else {
|
|
43
69
|
return position == "bottom";
|
|
44
70
|
}
|
|
71
|
+
},
|
|
72
|
+
buttonSpec(item) {
|
|
73
|
+
return Object.assign({}, item, {
|
|
74
|
+
view: "button-v1",
|
|
75
|
+
styleClasses: ["text"]
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
$registryEnabled() {
|
|
79
|
+
return false;
|
|
80
|
+
},
|
|
81
|
+
updateData() {
|
|
82
|
+
this.tooltip = this.spec.tooltip || { disabled: true };
|
|
45
83
|
}
|
|
46
84
|
}
|
|
47
85
|
};
|
package/components/button.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<common-tooltip :spec="spec">
|
|
2
|
+
<common-tooltip ref="tooltip" :spec="spec">
|
|
3
3
|
<template v-slot:activator="{ on }">
|
|
4
4
|
<common-button :spec="spec" :disabled="$isBusy" :event-handlers="on" />
|
|
5
5
|
</template>
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
export default {
|
|
11
11
|
props: {
|
|
12
12
|
spec: { type: Object, required: true }
|
|
13
|
+
},
|
|
14
|
+
methods: {
|
|
15
|
+
action_merge(mergedSpec) {
|
|
16
|
+
Object.assign(this.spec, mergedSpec);
|
|
17
|
+
this.$refs.tooltip.updateData();
|
|
18
|
+
}
|
|
13
19
|
}
|
|
14
20
|
};
|
|
15
21
|
</script>
|
package/components/chip.vue
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<common-chip :spec="spec" />
|
|
2
|
+
<common-chip ref="delegate" :spec="spec" />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script>
|
|
6
6
|
export default {
|
|
7
7
|
props: {
|
|
8
8
|
spec: { type: Object, required: true }
|
|
9
|
+
},
|
|
10
|
+
methods: {
|
|
11
|
+
action_merge(mergedSpec) {
|
|
12
|
+
Object.assign(this.spec, mergedSpec);
|
|
13
|
+
// this.$refs.delegate.updateData();
|
|
14
|
+
}
|
|
9
15
|
}
|
|
10
16
|
};
|
|
11
17
|
</script>
|
package/components/component.vue
CHANGED
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
:rules="$validation()"
|
|
17
17
|
:outlined="$classes().includes('outlined')"
|
|
18
18
|
:style="$styles()"
|
|
19
|
+
:dense="$classes().includes('dense')"
|
|
19
20
|
clearable
|
|
21
|
+
@input="onChange"
|
|
20
22
|
/>
|
|
21
23
|
</div>
|
|
22
24
|
</template>
|
|
@@ -58,6 +60,15 @@ export default {
|
|
|
58
60
|
},
|
|
59
61
|
classes() {
|
|
60
62
|
return this.$classes().concat("g-text-field--hintless");
|
|
63
|
+
},
|
|
64
|
+
onChange() {
|
|
65
|
+
this.$executeOnChange();
|
|
66
|
+
},
|
|
67
|
+
$registryEnabled() {
|
|
68
|
+
return false;
|
|
69
|
+
},
|
|
70
|
+
updateData() {
|
|
71
|
+
this.fieldModel = this.spec.value;
|
|
61
72
|
}
|
|
62
73
|
}
|
|
63
74
|
};
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
validate-on-blur
|
|
16
16
|
persistent-hint
|
|
17
17
|
:class="$classes()"
|
|
18
|
+
:dense="$classes().includes('dense')"
|
|
18
19
|
:outlined="$classes().includes('outlined')"
|
|
19
20
|
:append-icon="append.icon"
|
|
20
21
|
@change="onChange"
|
|
@@ -60,7 +61,7 @@ export default {
|
|
|
60
61
|
},
|
|
61
62
|
methods: {
|
|
62
63
|
$ready() {
|
|
63
|
-
this.updateData();
|
|
64
|
+
this.updateData(false);
|
|
64
65
|
},
|
|
65
66
|
normalizedOptions() {
|
|
66
67
|
return this.spec.options.map(i => {
|
|
@@ -78,17 +79,18 @@ export default {
|
|
|
78
79
|
return this.$classes().concat("g-text-field--hintless");
|
|
79
80
|
},
|
|
80
81
|
onChange() {
|
|
81
|
-
|
|
82
|
-
this.$nextTick(() => {
|
|
83
|
-
GLib.action.execute(onChange, this);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
82
|
+
this.$executeOnChange();
|
|
86
83
|
},
|
|
87
|
-
updateData() {
|
|
84
|
+
updateData(reinitValue) {
|
|
88
85
|
this.options = this.normalizedOptions();
|
|
89
86
|
this.append = this.spec.append || {};
|
|
90
87
|
this.rules = this.$validation();
|
|
91
|
-
|
|
88
|
+
|
|
89
|
+
if (reinitValue) {
|
|
90
|
+
this.fieldModel = this.spec.value || this.defaultValue;
|
|
91
|
+
} else if (this.defaultValue) {
|
|
92
|
+
// Don't execute if null because that will trigger an unnecessary update which will break
|
|
93
|
+
// select fields with `unspecified` value. See `/glib/json_ui_garage?path=forms%2Fselects`.
|
|
92
94
|
this.fieldModel = this.defaultValue;
|
|
93
95
|
}
|
|
94
96
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date for why we need to use `pattern` -->
|
|
3
3
|
<fields-patternText
|
|
4
|
+
ref="delegate"
|
|
4
5
|
:spec="spec"
|
|
5
6
|
:type="spec.type || 'date'"
|
|
6
7
|
pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}"
|
|
@@ -17,6 +18,12 @@ export default {
|
|
|
17
18
|
},
|
|
18
19
|
props: {
|
|
19
20
|
spec: { type: Object, required: true }
|
|
21
|
+
},
|
|
22
|
+
methods: {
|
|
23
|
+
action_merge(mergedSpec) {
|
|
24
|
+
Object.assign(this.spec, mergedSpec);
|
|
25
|
+
this.$refs.delegate.updateData();
|
|
26
|
+
}
|
|
20
27
|
}
|
|
21
28
|
};
|
|
22
29
|
</script>
|