glib-web 3.0.2 → 3.0.4
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 +15 -29
- package/actions/analytics/logEvent.js +2 -2
- package/actions/auth/saveCsrfToken.js +0 -6
- package/actions/cables/push.js +3 -1
- package/actions/http/get.js +28 -16
- package/actions/panels/scrollTo.js +32 -7
- package/actions/panels/scrollToBottom.js +1 -1
- package/actions/windows/closeWithReload.js +1 -1
- package/actions/ws/push.js +2 -2
- package/app.vue +8 -9
- package/components/_chip.vue +29 -12
- package/components/_responsive.vue +27 -10
- package/components/component.vue +10 -2
- package/components/datetime.vue +0 -2
- package/components/fields/check.vue +31 -23
- package/components/fields/hidden.vue +7 -2
- package/components/fields/newRichText.vue +1 -1
- package/components/fields/radioGroup.vue +2 -1
- package/components/fields/richText.vue +4 -4
- package/components/fields/submit.vue +5 -2
- package/components/fields/text.vue +22 -23
- package/components/fields/textarea.vue +2 -1
- package/components/fields/timer.vue +1 -2
- package/components/label.vue +8 -4
- package/components/mixins/events.js +14 -19
- package/components/mixins/generic.js +2 -2
- package/components/mixins/styles.js +1 -1
- package/components/mixins/ws/actionCable.js +2 -2
- package/components/mixins/ws/phoenixSocket.js +6 -7
- package/components/panels/horizontal.vue +8 -8
- package/components/panels/list.vue +22 -3
- package/components/panels/responsive.vue +2 -11
- package/components/panels/scroll.vue +0 -3
- package/components/panels/table.vue +0 -3
- package/components/panels/timeline.vue +3 -4
- package/components/switch.vue +5 -4
- package/nav/dialog.vue +18 -8
- package/package.json +2 -2
- package/utils/history.js +1 -1
- package/utils/http.js +56 -10
- package/utils/private/ws.js +2 -2
- package/utils/public.js +0 -6
- package/utils/settings.js +10 -2
- package/actions/commands/enqueue.js +0 -17
- package/utils/queue.js +0 -102
package/action.js
CHANGED
|
@@ -52,7 +52,6 @@ import ActionsAnalyticsLogEvent from "./actions/analytics/logEvent";
|
|
|
52
52
|
|
|
53
53
|
import ActionCommandsCopy from "./actions/commands/copy";
|
|
54
54
|
import ActionCommandsCustom from "./actions/commands/custom";
|
|
55
|
-
import ActionCommandsEnqueue from "./actions/commands/enqueue";
|
|
56
55
|
|
|
57
56
|
import ActionToursStart from "./actions/tours/start";
|
|
58
57
|
import ActionToursStop from "./actions/tours/stop";
|
|
@@ -117,7 +116,6 @@ const actions = {
|
|
|
117
116
|
|
|
118
117
|
"commands/copy": ActionCommandsCopy,
|
|
119
118
|
"commands/custom": ActionCommandsCustom,
|
|
120
|
-
"commands/enqueue": ActionCommandsEnqueue,
|
|
121
119
|
|
|
122
120
|
"tours/start": ActionToursStart,
|
|
123
121
|
"components/update": ActionComponentsUpdate,
|
|
@@ -134,43 +132,34 @@ export default class Action {
|
|
|
134
132
|
if (!TypeUtils.isObject(spec)) {
|
|
135
133
|
return;
|
|
136
134
|
}
|
|
135
|
+
if (!TypeUtils.isObject(component)) {
|
|
136
|
+
console.warn("Action requires a component");
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
137
139
|
|
|
138
140
|
const name = spec.action;
|
|
139
141
|
if (TypeUtils.isString(name)) {
|
|
140
142
|
if (name.startsWith("component/")) {
|
|
141
|
-
this.executeLocal(name, spec, component);
|
|
143
|
+
return this.executeLocal(name, spec, component);
|
|
142
144
|
} else {
|
|
143
|
-
this.executeGlobal(name, spec, component, params);
|
|
145
|
+
return this.executeGlobal(name, spec, component, params);
|
|
144
146
|
}
|
|
145
|
-
|
|
146
|
-
// const actionName = name.replace(/-v1$/, "");
|
|
147
|
-
|
|
148
|
-
// try {
|
|
149
|
-
// const action = new actions[actionName]();
|
|
150
|
-
// const logDisabled = action.logDisabled && action.logDisabled();
|
|
151
|
-
// if (!logDisabled) {
|
|
152
|
-
// console.log(`Executing "${actionName}"`);
|
|
153
|
-
// }
|
|
154
|
-
// action.execute(spec, null, component, params);
|
|
155
|
-
// } catch (e) {
|
|
156
|
-
// console.log(`Failed executing command: "${e.message}"`);
|
|
157
|
-
// }
|
|
158
147
|
} else {
|
|
159
|
-
console.
|
|
148
|
+
console.warn(`Invalid action: "${name}"`);
|
|
160
149
|
}
|
|
161
150
|
}
|
|
162
151
|
|
|
163
152
|
static executeLocal(name, spec, component) {
|
|
164
153
|
const methodName = name.replace(/^component\//, "");
|
|
165
154
|
const componentName = GLib.component.vueName(component);
|
|
166
|
-
console.
|
|
155
|
+
console.debug(
|
|
167
156
|
`Executing component action on ${componentName}: ${methodName}`
|
|
168
157
|
);
|
|
169
158
|
component[`action_${methodName}`](spec);
|
|
170
159
|
}
|
|
171
160
|
|
|
172
161
|
static executeGlobal(name, spec, component, params) {
|
|
173
|
-
this._executeInternal(name, spec, component, params, actions);
|
|
162
|
+
return this._executeInternal(name, spec, component, params, actions);
|
|
174
163
|
}
|
|
175
164
|
|
|
176
165
|
static _executeInternal(name, spec, component, params, registry) {
|
|
@@ -179,16 +168,13 @@ export default class Action {
|
|
|
179
168
|
try {
|
|
180
169
|
const action = new registry[actionName]();
|
|
181
170
|
const logDisabled = action.logDisabled && action.logDisabled();
|
|
182
|
-
if (!logDisabled) {
|
|
183
|
-
console.
|
|
171
|
+
if (!logDisabled && !spec.silent) {
|
|
172
|
+
console.debug(`Executing "${actionName}"`);
|
|
184
173
|
}
|
|
185
|
-
action.execute(spec, component, params);
|
|
174
|
+
return action.execute(spec, component, params);
|
|
186
175
|
} catch (e) {
|
|
187
|
-
GLib.settings.errorHandler(
|
|
188
|
-
|
|
189
|
-
`Failed executing command "${actionName}". Error: ${e.message}`
|
|
190
|
-
)
|
|
191
|
-
);
|
|
176
|
+
GLib.settings.errorHandler(e, `Failed executing "${actionName}"`);
|
|
177
|
+
return null;
|
|
192
178
|
}
|
|
193
179
|
}
|
|
194
180
|
|
|
@@ -214,7 +200,7 @@ export default class Action {
|
|
|
214
200
|
}
|
|
215
201
|
|
|
216
202
|
static executeCustom(name, spec, component, params) {
|
|
217
|
-
this._executeInternal(name, spec, component, params, customActions);
|
|
203
|
+
return this._executeInternal(name, spec, component, params, customActions);
|
|
218
204
|
}
|
|
219
205
|
}
|
|
220
206
|
|
|
@@ -14,10 +14,10 @@ export default class {
|
|
|
14
14
|
const suffix = params.referer_group ? "w/ referer" : "w/o referer";
|
|
15
15
|
params.build_env = Utils.settings.env;
|
|
16
16
|
// params.build_version = Utils.settings.appVersion;
|
|
17
|
-
console.
|
|
17
|
+
console.debug(`Logging ${suffix}:`, properties.name, params);
|
|
18
18
|
firebase.analytics().logEvent(properties.name, params);
|
|
19
19
|
} else {
|
|
20
|
-
console.
|
|
20
|
+
console.debug("Waiting for firebase to be initialized...");
|
|
21
21
|
setTimeout(() => {
|
|
22
22
|
this.execute(properties);
|
|
23
23
|
}, 100);
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
// import Storage from '../../utils/storage'
|
|
2
|
-
// import Keys from '../../keys'
|
|
3
|
-
|
|
4
1
|
export default class {
|
|
5
2
|
execute(properties, component) {
|
|
6
|
-
// console.log(properties['token'])
|
|
7
|
-
// Storage.setLocal(Keys.Db.csrfToken, properties['token'])
|
|
8
|
-
|
|
9
3
|
Utils.dom.setCsrf(properties["token"]);
|
|
10
4
|
Action.execute(properties["onSave"], component);
|
|
11
5
|
}
|
package/actions/cables/push.js
CHANGED
|
@@ -6,7 +6,9 @@ export default class {
|
|
|
6
6
|
const ws = vueApp.actionCable;
|
|
7
7
|
const channel = ws.channels[channelName];
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// TODO: Use logDisabled() that reads params from server to decide whether we want to print the log or not.
|
|
10
|
+
// This is because `push` action's logs are a bit sensitive.
|
|
11
|
+
console.debug("Pushing to", channel);
|
|
10
12
|
|
|
11
13
|
Utils.type.ifString(properties.event, eventName => {
|
|
12
14
|
if (channel) {
|
package/actions/http/get.js
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
export default class {
|
|
2
|
-
execute(
|
|
2
|
+
execute(spec, component) {
|
|
3
|
+
return new Promise(resolve => {
|
|
4
|
+
GLib.http.execute(
|
|
5
|
+
spec,
|
|
6
|
+
"GET",
|
|
7
|
+
component,
|
|
8
|
+
(page, response) => {
|
|
9
|
+
this.handleSuccess(page, spec, component);
|
|
10
|
+
resolve({ page: page, response: response });
|
|
11
|
+
},
|
|
12
|
+
(error, response) => {
|
|
13
|
+
resolve({ error: error, response: response });
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
handleSuccess(page, spec, component) {
|
|
3
20
|
const currentUrl = window.location.href;
|
|
4
|
-
// const htmlUrl = Utils.url.htmlUrl(properties["url"]);
|
|
5
21
|
|
|
6
|
-
|
|
7
|
-
Utils.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
replayGetResponse: page.onResponse
|
|
13
|
-
});
|
|
22
|
+
Utils.type.ifString(spec.historyUrl, historyUrl => {
|
|
23
|
+
const cleanUrl = Utils.url.htmlUrl(historyUrl);
|
|
24
|
+
if (cleanUrl !== currentUrl) {
|
|
25
|
+
const data = Object.assign({}, window.vueApp.page, {
|
|
26
|
+
replayGetResponse: page.onResponse
|
|
27
|
+
});
|
|
14
28
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
GLib.action.handleResponse(page, controller);
|
|
29
|
+
Utils.history.pushPage(data, cleanUrl);
|
|
30
|
+
}
|
|
20
31
|
});
|
|
32
|
+
GLib.action.handleResponse(page, component);
|
|
21
33
|
}
|
|
22
|
-
}
|
|
34
|
+
}
|
|
@@ -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 = `#${
|
|
8
|
-
console.
|
|
7
|
+
const selector = `#${spec.viewId}`;
|
|
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
|
}
|
|
@@ -4,7 +4,7 @@ export default class {
|
|
|
4
4
|
// TODO: make this support any panelId
|
|
5
5
|
const target = properties.panelId ? `_innerBody` : "_pageBody";
|
|
6
6
|
const pageBody = Utils.history[target];
|
|
7
|
-
console.
|
|
7
|
+
console.debug(`Scrolling ${target} to bottom`);
|
|
8
8
|
pageBody.scrollTo({
|
|
9
9
|
top: pageBody.scrollHeight,
|
|
10
10
|
behavior: properties["animate"] ? "smooth" : "auto"
|
|
@@ -6,7 +6,7 @@ export default class {
|
|
|
6
6
|
const data = Object.assign({}, properties);
|
|
7
7
|
if (!Utils.history.back()) {
|
|
8
8
|
data.url = fallbackUrl;
|
|
9
|
-
console.
|
|
9
|
+
console.debug("Use fallbackUrl", data.url);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
// Allow time for history.back() to complete, which is important for actions that need
|
package/actions/ws/push.js
CHANGED
|
@@ -15,14 +15,14 @@ export default class {
|
|
|
15
15
|
channel
|
|
16
16
|
.push(eventName, payload)
|
|
17
17
|
.receive("ok", resp => {
|
|
18
|
-
console.
|
|
18
|
+
console.debug(
|
|
19
19
|
`Push to '${topicName}/${eventName}' succeeded`,
|
|
20
20
|
resp
|
|
21
21
|
);
|
|
22
22
|
Utils.ws.handleResponse(resp.onResponse, component);
|
|
23
23
|
})
|
|
24
24
|
.receive("error", resp => {
|
|
25
|
-
console.
|
|
25
|
+
console.debug(`Push to '${topicName}/${eventName}' failed`, resp);
|
|
26
26
|
Utils.ws.handleResponse(resp.onResponse, component);
|
|
27
27
|
});
|
|
28
28
|
} else {
|
package/app.vue
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<nav-appbar ref="appBar" :page="page" />
|
|
5
5
|
|
|
6
6
|
<v-progress-linear color="primary" v-if="vueApp.indicator" :indeterminate="true" height="5"
|
|
7
|
-
style="position: fixed; z-index: 4
|
|
7
|
+
style="position: fixed; z-index: 4">
|
|
8
8
|
</v-progress-linear>
|
|
9
9
|
|
|
10
10
|
<v-main :style="`height: ${mainHeight}px;`">
|
|
@@ -47,7 +47,7 @@ export default {
|
|
|
47
47
|
return {
|
|
48
48
|
title: "...",
|
|
49
49
|
mainHeight: 0,
|
|
50
|
-
vueApp
|
|
50
|
+
vueApp,
|
|
51
51
|
};
|
|
52
52
|
},
|
|
53
53
|
computed: {
|
|
@@ -62,7 +62,7 @@ export default {
|
|
|
62
62
|
},
|
|
63
63
|
containerComponent() {
|
|
64
64
|
if (this.formSpec) {
|
|
65
|
-
this.name =
|
|
65
|
+
this.name = "panels-form";
|
|
66
66
|
return "panels-form";
|
|
67
67
|
}
|
|
68
68
|
return "div";
|
|
@@ -80,10 +80,10 @@ export default {
|
|
|
80
80
|
watch: {
|
|
81
81
|
"vueApp.indicator": function (val, oldVal) {
|
|
82
82
|
document.title = val ? "..." : this.page.title;
|
|
83
|
-
}
|
|
83
|
+
},
|
|
84
84
|
},
|
|
85
85
|
created() {
|
|
86
|
-
console.
|
|
86
|
+
console.debug(
|
|
87
87
|
`Version: ${Utils.settings.appVersion} (${Utils.settings.env})`
|
|
88
88
|
);
|
|
89
89
|
Utils.history.saveInitialContent(this.page);
|
|
@@ -137,7 +137,6 @@ export default {
|
|
|
137
137
|
});
|
|
138
138
|
},
|
|
139
139
|
updateMainHeight() {
|
|
140
|
-
console.debug("Setting body height");
|
|
141
140
|
this.mainHeight = window.innerHeight - this.$refs.appBar.$el.offsetHeight;
|
|
142
141
|
},
|
|
143
142
|
},
|
|
@@ -193,13 +192,13 @@ body,
|
|
|
193
192
|
}
|
|
194
193
|
|
|
195
194
|
// Don't override the default button's effect.
|
|
196
|
-
.glib-clickable:not(.v-btn) {
|
|
195
|
+
.glib-clickable:not(.v-btn):not(.disabled) {
|
|
197
196
|
cursor: pointer;
|
|
198
197
|
|
|
199
198
|
// // So that we can display a semi-transparent layer on hover (see below)
|
|
200
199
|
position: relative;
|
|
201
200
|
|
|
202
|
-
&:hover:before {
|
|
201
|
+
&:not(.no-hover):hover:before {
|
|
203
202
|
content: "\A";
|
|
204
203
|
width: 100%;
|
|
205
204
|
height: 100%;
|
|
@@ -227,7 +226,7 @@ body,
|
|
|
227
226
|
}
|
|
228
227
|
|
|
229
228
|
.popover-menu-item {
|
|
230
|
-
font-size:
|
|
229
|
+
font-size: 16px;
|
|
231
230
|
padding: 8px 16px;
|
|
232
231
|
width: 100%;
|
|
233
232
|
}
|
package/components/_chip.vue
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<common-badge :spec="spec">
|
|
3
3
|
<div>
|
|
4
|
-
<v-chip
|
|
5
|
-
|
|
4
|
+
<v-chip
|
|
5
|
+
v-if="spec.onClick"
|
|
6
|
+
:style="genericStyles()"
|
|
7
|
+
:color="color"
|
|
8
|
+
:class="$classes()"
|
|
9
|
+
:href="$href()"
|
|
10
|
+
@click="$onClick()"
|
|
11
|
+
:variant="variant"
|
|
12
|
+
>
|
|
6
13
|
{{ spec.text }}
|
|
7
14
|
</v-chip>
|
|
8
|
-
<v-chip
|
|
15
|
+
<v-chip
|
|
16
|
+
v-else
|
|
17
|
+
:style="genericStyles()"
|
|
18
|
+
:color="color"
|
|
19
|
+
:class="$classes()"
|
|
20
|
+
:variant="variant"
|
|
21
|
+
>
|
|
9
22
|
{{ spec.text }}
|
|
10
23
|
</v-chip>
|
|
11
24
|
</div>
|
|
@@ -13,17 +26,17 @@
|
|
|
13
26
|
</template>
|
|
14
27
|
|
|
15
28
|
<script>
|
|
16
|
-
import { colors, variants } from
|
|
29
|
+
import { colors, variants } from "../utils/constant";
|
|
17
30
|
|
|
18
31
|
export default {
|
|
19
32
|
data: function () {
|
|
20
33
|
return {
|
|
21
|
-
color:
|
|
22
|
-
variant:
|
|
23
|
-
}
|
|
34
|
+
color: "",
|
|
35
|
+
variant: "tonal",
|
|
36
|
+
};
|
|
24
37
|
},
|
|
25
38
|
props: {
|
|
26
|
-
spec: { type: Object, required: true }
|
|
39
|
+
spec: { type: Object, required: true },
|
|
27
40
|
},
|
|
28
41
|
// data: function() {
|
|
29
42
|
// return {
|
|
@@ -34,15 +47,15 @@ export default {
|
|
|
34
47
|
$ready() {
|
|
35
48
|
colors.forEach((value) => {
|
|
36
49
|
if (this.$classes().includes(value)) this.color = value;
|
|
37
|
-
})
|
|
50
|
+
});
|
|
38
51
|
variants.forEach((value) => {
|
|
39
52
|
if (this.$classes().includes(value)) this.variant = value;
|
|
40
|
-
})
|
|
53
|
+
});
|
|
41
54
|
},
|
|
42
55
|
$registryEnabled() {
|
|
43
56
|
return false;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
57
|
+
},
|
|
58
|
+
},
|
|
46
59
|
};
|
|
47
60
|
</script>
|
|
48
61
|
|
|
@@ -51,4 +64,8 @@ export default {
|
|
|
51
64
|
.v-chip:not(.v-chip--clickable).theme--light:hover:before {
|
|
52
65
|
opacity: 0;
|
|
53
66
|
}
|
|
67
|
+
.icon-wrapper {
|
|
68
|
+
display: flex;
|
|
69
|
+
padding-right: 2px;
|
|
70
|
+
}
|
|
54
71
|
</style>
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component
|
|
2
|
+
<component
|
|
3
|
+
:is="componentName"
|
|
4
|
+
:class="cssClasses"
|
|
5
|
+
:style="$styles()"
|
|
6
|
+
:href="$href()"
|
|
7
|
+
@click="$onClick()"
|
|
8
|
+
>
|
|
3
9
|
<v-row no-gutters class="full-height">
|
|
4
10
|
<template v-for="(item, index) in spec.childViews">
|
|
5
|
-
<glib-component
|
|
6
|
-
|
|
11
|
+
<glib-component
|
|
12
|
+
v-if="isColumn(item)"
|
|
13
|
+
:key="viewKey(item, index)"
|
|
14
|
+
:spec="item"
|
|
15
|
+
/>
|
|
16
|
+
<div
|
|
17
|
+
v-else
|
|
18
|
+
:key="'else-' + viewKey(item, index)"
|
|
19
|
+
class="full-width"
|
|
20
|
+
:style="innerStyles"
|
|
21
|
+
>
|
|
7
22
|
<glib-component :spec="item" />
|
|
8
23
|
</div>
|
|
9
24
|
</template>
|
|
@@ -12,15 +27,14 @@
|
|
|
12
27
|
</template>
|
|
13
28
|
|
|
14
29
|
<script>
|
|
15
|
-
|
|
16
30
|
export default {
|
|
17
31
|
props: {
|
|
18
32
|
spec: { type: Object, required: true },
|
|
19
|
-
eventHandlers: { type: Object, default: null }
|
|
33
|
+
eventHandlers: { type: Object, default: null },
|
|
20
34
|
},
|
|
21
35
|
data() {
|
|
22
36
|
return {
|
|
23
|
-
innerStyles: {}
|
|
37
|
+
innerStyles: {},
|
|
24
38
|
};
|
|
25
39
|
},
|
|
26
40
|
computed: {
|
|
@@ -30,7 +44,7 @@ export default {
|
|
|
30
44
|
},
|
|
31
45
|
componentName() {
|
|
32
46
|
return this.spec.onClick ? "a" : "div";
|
|
33
|
-
}
|
|
47
|
+
},
|
|
34
48
|
},
|
|
35
49
|
methods: {
|
|
36
50
|
$ready() {
|
|
@@ -45,7 +59,7 @@ export default {
|
|
|
45
59
|
default:
|
|
46
60
|
align = "flex-start";
|
|
47
61
|
}
|
|
48
|
-
Object.assign(this.innerStyles, {
|
|
62
|
+
Object.assign(this.innerStyles, { "align-items": align, height: "auto" });
|
|
49
63
|
},
|
|
50
64
|
isColumn(item) {
|
|
51
65
|
return item.view == "panels/column-v1";
|
|
@@ -53,8 +67,11 @@ export default {
|
|
|
53
67
|
viewKey(item, index) {
|
|
54
68
|
// Use view name for key to avoid component reuse issue
|
|
55
69
|
return `view${index}_${item.view}`;
|
|
56
|
-
}
|
|
57
|
-
|
|
70
|
+
},
|
|
71
|
+
$registryEnabled() {
|
|
72
|
+
return false;
|
|
73
|
+
},
|
|
74
|
+
},
|
|
58
75
|
};
|
|
59
76
|
</script>
|
|
60
77
|
|
package/components/component.vue
CHANGED
|
@@ -209,7 +209,9 @@ export default {
|
|
|
209
209
|
},
|
|
210
210
|
data() {
|
|
211
211
|
return {
|
|
212
|
-
name: null
|
|
212
|
+
name: null,
|
|
213
|
+
// See events#$recursiveUpdate().
|
|
214
|
+
$passthrough: true
|
|
213
215
|
};
|
|
214
216
|
},
|
|
215
217
|
computed: {
|
|
@@ -240,7 +242,13 @@ export default {
|
|
|
240
242
|
}
|
|
241
243
|
},
|
|
242
244
|
$update() {
|
|
243
|
-
this.$
|
|
245
|
+
this.$ready();
|
|
246
|
+
|
|
247
|
+
const delegate = this.$refs.delegate;
|
|
248
|
+
if (delegate) {
|
|
249
|
+
// Might be null if the component is getting removed as part of the update.
|
|
250
|
+
delegate.$update();
|
|
251
|
+
}
|
|
244
252
|
},
|
|
245
253
|
$registryEnabled() {
|
|
246
254
|
return false;
|
package/components/datetime.vue
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<script>
|
|
13
13
|
export default {
|
|
14
14
|
props: {
|
|
15
|
-
spec: { type: Object, required: true }
|
|
15
|
+
spec: { type: Object, required: true }
|
|
16
16
|
},
|
|
17
17
|
data() {
|
|
18
18
|
return {
|
|
@@ -23,12 +23,37 @@ export default {
|
|
|
23
23
|
},
|
|
24
24
|
methods: {
|
|
25
25
|
$ready() {
|
|
26
|
+
this.updateData()
|
|
27
|
+
},
|
|
28
|
+
changed(event) {
|
|
29
|
+
// Execute later to ensure the checkbox's checked state has been updated.
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
this.$type.ifObject(this.groupElement, val =>
|
|
32
|
+
val.dispatchEvent(new Event("change"))
|
|
33
|
+
);
|
|
34
|
+
}, 100);
|
|
35
|
+
|
|
36
|
+
// setTimeout(() => {
|
|
37
|
+
this.$executeOnChange();
|
|
38
|
+
// }, 500);
|
|
39
|
+
},
|
|
40
|
+
$internalizeValue(val) {
|
|
41
|
+
if (val == this.spec.checkValue) {
|
|
42
|
+
return val;
|
|
43
|
+
}
|
|
44
|
+
return this.spec.uncheckValue;
|
|
45
|
+
},
|
|
46
|
+
action_merge(mergedSpec) {
|
|
47
|
+
Object.assign(this.spec, mergedSpec);
|
|
48
|
+
this.updateData()
|
|
49
|
+
},
|
|
50
|
+
updateData() {
|
|
26
51
|
this.groupElement = this.$el.closest("[data-component=checkGroup]");
|
|
27
52
|
|
|
28
53
|
let groupName = null;
|
|
29
54
|
this.$type.ifObject(
|
|
30
55
|
this.groupElement,
|
|
31
|
-
|
|
56
|
+
val => (groupName = val.getAttribute("name"))
|
|
32
57
|
);
|
|
33
58
|
|
|
34
59
|
this.fieldName = this.spec.name || groupName;
|
|
@@ -37,31 +62,14 @@ export default {
|
|
|
37
62
|
? this.spec.checkValue
|
|
38
63
|
: this.spec.value;
|
|
39
64
|
|
|
40
|
-
Utils.type.ifArray(this.spec.styleClasses,
|
|
65
|
+
Utils.type.ifArray(this.spec.styleClasses, classes => {
|
|
41
66
|
if (classes.remove("switch")) {
|
|
42
67
|
this.fieldType = "switch";
|
|
43
68
|
}
|
|
44
69
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
this.$type.ifObject(this.groupElement, (val) =>
|
|
50
|
-
val.dispatchEvent(new Event("change"))
|
|
51
|
-
);
|
|
52
|
-
}, 100);
|
|
53
|
-
|
|
54
|
-
setTimeout(() => {
|
|
55
|
-
this.$executeOnChange();
|
|
56
|
-
}, 500);
|
|
57
|
-
},
|
|
58
|
-
$internalizeValue(val) {
|
|
59
|
-
if (val == this.spec.checkValue) {
|
|
60
|
-
return val;
|
|
61
|
-
}
|
|
62
|
-
return this.spec.uncheckValue;
|
|
63
|
-
},
|
|
64
|
-
},
|
|
70
|
+
// this.fieldModel = this.spec.value;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
65
73
|
};
|
|
66
74
|
</script>
|
|
67
75
|
|
|
@@ -31,12 +31,13 @@ export default {
|
|
|
31
31
|
},
|
|
32
32
|
childSpec(childView) {
|
|
33
33
|
const cls = Object.assign({}, childView)
|
|
34
|
+
cls.styleClasses ||= []
|
|
34
35
|
if (this.activeClass(cls)) {
|
|
35
36
|
if (!cls.styleClasses.includes('radio--active')) {
|
|
36
37
|
cls.styleClasses.push('radio--active')
|
|
37
38
|
}
|
|
38
39
|
} else {
|
|
39
|
-
cls.styleClasses =
|
|
40
|
+
cls.styleClasses = cls.styleClasses.filter((v) => v != 'radio--active')
|
|
40
41
|
}
|
|
41
42
|
return cls;
|
|
42
43
|
},
|