glib-web 0.5.77
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/.eslintrc.js +37 -0
- package/LICENSE +201 -0
- package/README.md +33 -0
- package/action.js +167 -0
- package/actions/analytics/logEvent.js +26 -0
- package/actions/auth/creditCard.js +29 -0
- package/actions/auth/restart.js +5 -0
- package/actions/auth/saveCsrfToken.js +12 -0
- package/actions/cables/push.js +38 -0
- package/actions/dialogs/alert.js +15 -0
- package/actions/dialogs/close.js +7 -0
- package/actions/dialogs/notification.js +14 -0
- package/actions/dialogs/oauth.js +6 -0
- package/actions/dialogs/open.js +7 -0
- package/actions/dialogs/options.js +5 -0
- package/actions/dialogs/show.js +5 -0
- package/actions/forms/submit.js +15 -0
- package/actions/http/delete.js +7 -0
- package/actions/http/patch.js +7 -0
- package/actions/http/post.js +7 -0
- package/actions/http/put.js +7 -0
- package/actions/panels/scrollTo.js +18 -0
- package/actions/panels/scrollToBottom.js +11 -0
- package/actions/runMultiple.js +11 -0
- package/actions/sheets/select.js +5 -0
- package/actions/snackbars/alert.js +15 -0
- package/actions/snackbars/select.js +5 -0
- package/actions/timeouts/set.js +20 -0
- package/actions/windows/close.js +13 -0
- package/actions/windows/closeAll.js +16 -0
- package/actions/windows/closeWithReload.js +18 -0
- package/actions/windows/open.js +5 -0
- package/actions/windows/openWeb.js +5 -0
- package/actions/windows/refreshState.js +5 -0
- package/actions/windows/reload.js +24 -0
- package/actions/ws/push.js +35 -0
- package/app.vue +180 -0
- package/components/_button.vue +101 -0
- package/components/_dropdownMenu.vue +76 -0
- package/components/_icon.vue +50 -0
- package/components/_message.vue +25 -0
- package/components/avatar.vue +16 -0
- package/components/banners/alert.vue +49 -0
- package/components/banners/select.vue +82 -0
- package/components/button.vue +13 -0
- package/components/calendar.vue +105 -0
- package/components/charts/column.vue +26 -0
- package/components/charts/line.vue +61 -0
- package/components/chip.vue +24 -0
- package/components/component.vue +222 -0
- package/components/datetime.vue +54 -0
- package/components/fab.vue +33 -0
- package/components/fields/_patternText.vue +61 -0
- package/components/fields/_select.vue +86 -0
- package/components/fields/autocomplete.vue +73 -0
- package/components/fields/check.vue +104 -0
- package/components/fields/checkGroup.vue +51 -0
- package/components/fields/country/countries.js +251 -0
- package/components/fields/country/field.vue +81 -0
- package/components/fields/country/regions.js +12 -0
- package/components/fields/creditCard.vue +105 -0
- package/components/fields/date.vue +24 -0
- package/components/fields/datetime.vue +49 -0
- package/components/fields/dynamicGroup.vue +106 -0
- package/components/fields/dynamicSelect.vue +173 -0
- package/components/fields/file.vue +166 -0
- package/components/fields/googlePlace.vue +158 -0
- package/components/fields/hidden.vue +18 -0
- package/components/fields/location.vue +223 -0
- package/components/fields/newRichText.vue +191 -0
- package/components/fields/phone/countries.js +315 -0
- package/components/fields/phone/field.vue +348 -0
- package/components/fields/phone/sprite.css +1071 -0
- package/components/fields/radio.vue +64 -0
- package/components/fields/radioGroup.vue +93 -0
- package/components/fields/rating.vue +26 -0
- package/components/fields/richText.vue +172 -0
- package/components/fields/select.vue +17 -0
- package/components/fields/stripe/stripeFields.vue +93 -0
- package/components/fields/stripe/stripeIndividualFields.vue +207 -0
- package/components/fields/stripeExternalAccount.vue +135 -0
- package/components/fields/stripeToken.vue +59 -0
- package/components/fields/submit.vue +23 -0
- package/components/fields/text.vue +144 -0
- package/components/fields/textarea.vue +59 -0
- package/components/fields/timeZone.vue +22 -0
- package/components/fields/timer.vue +83 -0
- package/components/h1.vue +28 -0
- package/components/h2.vue +20 -0
- package/components/h3.vue +22 -0
- package/components/h4.vue +20 -0
- package/components/h5.vue +20 -0
- package/components/h6.vue +20 -0
- package/components/hr.vue +13 -0
- package/components/html.vue +13 -0
- package/components/icon.vue +25 -0
- package/components/image.vue +87 -0
- package/components/label.vue +62 -0
- package/components/map.vue +206 -0
- package/components/markdown.vue +52 -0
- package/components/mixins/events.js +178 -0
- package/components/mixins/generic.js +58 -0
- package/components/mixins/list/autoload.js +144 -0
- package/components/mixins/longClick.js +56 -0
- package/components/mixins/scrolling.js +35 -0
- package/components/mixins/styles.js +221 -0
- package/components/mixins/table/autoload.js +131 -0
- package/components/mixins/table/export.js +52 -0
- package/components/mixins/table/import.js +106 -0
- package/components/mixins/text.js +20 -0
- package/components/mixins/ws/actionCable.js +48 -0
- package/components/mixins/ws/phoenixSocket.js +117 -0
- package/components/p.vue +36 -0
- package/components/panels/carousel.vue +55 -0
- package/components/panels/column.vue +117 -0
- package/components/panels/custom.vue +52 -0
- package/components/panels/flow.vue +81 -0
- package/components/panels/form.vue +126 -0
- package/components/panels/horizontal.vue +73 -0
- package/components/panels/list.vue +241 -0
- package/components/panels/responsive.vue +88 -0
- package/components/panels/scroll.vue +68 -0
- package/components/panels/split.vue +52 -0
- package/components/panels/table.vue +234 -0
- package/components/panels/ul.vue +34 -0
- package/components/panels/vertical.vue +71 -0
- package/components/panels/web.vue +11 -0
- package/components/spacer.vue +11 -0
- package/components/switch.vue +42 -0
- package/components/tabBar.vue +44 -0
- package/extensions/array.js +20 -0
- package/extensions/string.js +21 -0
- package/index.js +195 -0
- package/keys.js +12 -0
- package/nav/appbar.vue +117 -0
- package/nav/content.vue +40 -0
- package/nav/dialog.vue +127 -0
- package/nav/drawer.vue +88 -0
- package/nav/drawerButton.vue +28 -0
- package/nav/drawerLabel.vue +21 -0
- package/nav/sheet.vue +57 -0
- package/nav/snackbar.vue +72 -0
- package/package.json +42 -0
- package/settings.json.example +21 -0
- package/static/plugins/alignment/alignment.js +76 -0
- package/static/plugins/alignment/alignment.min.js +1 -0
- package/static/plugins/beyondgrammar/beyondgrammar.js +46 -0
- package/static/plugins/beyondgrammar/beyondgrammar.min.js +1 -0
- package/static/plugins/blockcode/blockcode.js +110 -0
- package/static/plugins/blockcode/blockcode.min.js +1 -0
- package/static/plugins/clips/clips.js +44 -0
- package/static/plugins/clips/clips.min.js +1 -0
- package/static/plugins/counter/counter.js +60 -0
- package/static/plugins/counter/counter.min.js +1 -0
- package/static/plugins/definedlinks/definedlinks.js +64 -0
- package/static/plugins/definedlinks/definedlinks.min.js +1 -0
- package/static/plugins/handle/handle.js +173 -0
- package/static/plugins/handle/handle.min.js +1 -0
- package/static/plugins/icons/icons.js +72 -0
- package/static/plugins/icons/icons.min.js +1 -0
- package/static/plugins/imageposition/imageposition.js +85 -0
- package/static/plugins/imageposition/imageposition.min.js +1 -0
- package/static/plugins/inlineformat/inlineformat.js +85 -0
- package/static/plugins/inlineformat/inlineformat.min.js +1 -0
- package/static/plugins/removeformat/removeformat.js +28 -0
- package/static/plugins/removeformat/removeformat.min.js +1 -0
- package/static/plugins/selector/selector.js +96 -0
- package/static/plugins/selector/selector.min.js +1 -0
- package/static/plugins/specialchars/specialchars.js +63 -0
- package/static/plugins/specialchars/specialchars.min.js +1 -0
- package/static/plugins/textdirection/textdirection.js +55 -0
- package/static/plugins/textdirection/textdirection.min.js +1 -0
- package/static/plugins/textexpander/textexpander.js +46 -0
- package/static/plugins/textexpander/textexpander.min.js +1 -0
- package/static/plugins/underline/underline.js +27 -0
- package/static/plugins/underline/underline.min.js +1 -0
- package/static/redactorx.css +1344 -0
- package/static/redactorx.js +14254 -0
- package/static/redactorx.min.css +1 -0
- package/static/redactorx.min.js +1 -0
- package/static/redactorx.usm.min.js +2 -0
- package/styles/test.sass +3 -0
- package/styles/test.scss +5 -0
- package/templates/_menu.vue +38 -0
- package/templates/comment.vue +202 -0
- package/templates/featured.vue +32 -0
- package/templates/thumbnail.vue +138 -0
- package/templates/unsupported.vue +12 -0
- package/utils/app.js +14 -0
- package/utils/dom.js +13 -0
- package/utils/form.js +34 -0
- package/utils/format.js +14 -0
- package/utils/hash.js +29 -0
- package/utils/helper.js +44 -0
- package/utils/history.js +70 -0
- package/utils/http.js +209 -0
- package/utils/launch.js +135 -0
- package/utils/private/ws.js +22 -0
- package/utils/public.js +23 -0
- package/utils/settings.js +48 -0
- package/utils/storage.js +9 -0
- package/utils/type.js +69 -0
- package/utils/uploader.js +121 -0
- package/utils/url.js +132 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="scrollable">
|
|
3
|
+
<div ref="topAnchor"></div>
|
|
4
|
+
|
|
5
|
+
<table :style="$styles()">
|
|
6
|
+
<template v-for="(section, sectionIndex) in sections">
|
|
7
|
+
<thead :key="`head_${sectionIndex}`">
|
|
8
|
+
<tr v-if="importable || exportable">
|
|
9
|
+
<td colspan="10">
|
|
10
|
+
<div class="pa-3">
|
|
11
|
+
<template v-if="importable">
|
|
12
|
+
<span
|
|
13
|
+
>{{
|
|
14
|
+
rows(section).length + section.dataRows.length
|
|
15
|
+
}}
|
|
16
|
+
rows</span
|
|
17
|
+
>
|
|
18
|
+
<input
|
|
19
|
+
ref="fileInput"
|
|
20
|
+
style="display: none;"
|
|
21
|
+
type="file"
|
|
22
|
+
accept=".csv"
|
|
23
|
+
@change="loadFile($event, section)"
|
|
24
|
+
/>
|
|
25
|
+
<v-btn @click="triggerImport(sectionIndex)">Import</v-btn>
|
|
26
|
+
<v-btn
|
|
27
|
+
:disabled="totalRows(section) <= 0"
|
|
28
|
+
@click="submitRows($event, section)"
|
|
29
|
+
>Save</v-btn
|
|
30
|
+
>
|
|
31
|
+
<v-btn
|
|
32
|
+
:disabled="totalRows(section) <= 0"
|
|
33
|
+
@click="clear(section)"
|
|
34
|
+
>Clear</v-btn
|
|
35
|
+
>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<div class="float-right">
|
|
39
|
+
<v-btn
|
|
40
|
+
v-if="exportable"
|
|
41
|
+
:download="exportFile"
|
|
42
|
+
:href="exportCsv(section)"
|
|
43
|
+
>{{ exportLabel }}</v-btn
|
|
44
|
+
>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div v-if="output" style="white-space: pre-line;">
|
|
49
|
+
{{ output }}
|
|
50
|
+
</div>
|
|
51
|
+
</td>
|
|
52
|
+
</tr>
|
|
53
|
+
|
|
54
|
+
<tr v-if="section.header" :style="genericStyles(section.header)">
|
|
55
|
+
<template v-if="section.header.dataCells">
|
|
56
|
+
<th
|
|
57
|
+
v-for="(cell, index) in section.header.dataCells"
|
|
58
|
+
:key="index"
|
|
59
|
+
>
|
|
60
|
+
{{ cell }}
|
|
61
|
+
</th>
|
|
62
|
+
</template>
|
|
63
|
+
<th
|
|
64
|
+
v-for="(cell, index) in section.header.cellViews"
|
|
65
|
+
v-else
|
|
66
|
+
:key="index"
|
|
67
|
+
>
|
|
68
|
+
<ui-component :spec="cell" />
|
|
69
|
+
</th>
|
|
70
|
+
</tr>
|
|
71
|
+
</thead>
|
|
72
|
+
|
|
73
|
+
<tbody :key="`body_${sectionIndex}`">
|
|
74
|
+
<!-- <tr v-for="(row, index) in section.rows" :key="`row_${index}`"> -->
|
|
75
|
+
<template v-for="(row, rowIndex) in section.rows">
|
|
76
|
+
<tr
|
|
77
|
+
:key="`row_${rowIndex}`"
|
|
78
|
+
:class="row.onClick ? 'clickable' : ''"
|
|
79
|
+
>
|
|
80
|
+
<td
|
|
81
|
+
v-for="(cell, cellIndex) in row.cellViews"
|
|
82
|
+
:key="`cell_${cellIndex}`"
|
|
83
|
+
:colSpan="colSpan(row, cellIndex)"
|
|
84
|
+
:style="colStyles(row, cellIndex)"
|
|
85
|
+
>
|
|
86
|
+
<!-- Prevent double links -->
|
|
87
|
+
<ui-component v-if="$href(cell)" :spec="cell" />
|
|
88
|
+
<a v-else :href="$href(row)" @click="$onClick($event, row)">
|
|
89
|
+
<ui-component :spec="cell" />
|
|
90
|
+
</a>
|
|
91
|
+
</td>
|
|
92
|
+
</tr>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<tr
|
|
96
|
+
v-for="(row, rowIndex) in section.dataRows"
|
|
97
|
+
:key="`data_row_${rowIndex}`"
|
|
98
|
+
>
|
|
99
|
+
<td
|
|
100
|
+
v-for="(cell, cellIndex) in row"
|
|
101
|
+
:key="`data_cell_${cellIndex}`"
|
|
102
|
+
>
|
|
103
|
+
<a class="data-cell">{{ cell }}</a>
|
|
104
|
+
</td>
|
|
105
|
+
</tr>
|
|
106
|
+
</tbody>
|
|
107
|
+
</template>
|
|
108
|
+
</table>
|
|
109
|
+
|
|
110
|
+
<div ref="bottomAnchor" class="py-3 px-6" :style="bottomAnchorStyles">
|
|
111
|
+
Loading...
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
|
|
116
|
+
<script>
|
|
117
|
+
import autoloadMixin from "../mixins/table/autoload.js";
|
|
118
|
+
import exportMixin from "../mixins/table/export.js";
|
|
119
|
+
import importMixin from "../mixins/table/import.js";
|
|
120
|
+
|
|
121
|
+
export default {
|
|
122
|
+
mixins: [autoloadMixin, exportMixin, importMixin],
|
|
123
|
+
props: {
|
|
124
|
+
spec: { type: Object, required: true }
|
|
125
|
+
},
|
|
126
|
+
data() {
|
|
127
|
+
return {
|
|
128
|
+
sections: []
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
computed: {
|
|
132
|
+
output() {
|
|
133
|
+
// let str = ""
|
|
134
|
+
// let count = 0
|
|
135
|
+
// for (const section of this.sections) {
|
|
136
|
+
// for (const row of section.dataRows) {
|
|
137
|
+
// const name = row[2]
|
|
138
|
+
// const email = row[3]
|
|
139
|
+
// const createdAt = row[5]
|
|
140
|
+
// const activationState = row[14] ? 'active' : 'pending'
|
|
141
|
+
// count += 1
|
|
142
|
+
// if (email.includes("'")) {
|
|
143
|
+
// console.log("INVALID NAME", name)
|
|
144
|
+
// }
|
|
145
|
+
// str += `{ name: "${name}".to_s, email: '${email}'.to_s, created_at: '${createdAt}', activation_state: '${activationState}'},\n`
|
|
146
|
+
// }
|
|
147
|
+
// }
|
|
148
|
+
// return `Processing ${count} rows:\n[\n${str}\n]`
|
|
149
|
+
return "";
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
methods: {
|
|
153
|
+
$ready() {
|
|
154
|
+
this.sections = this.spec.sections;
|
|
155
|
+
for (const section of this.sections) {
|
|
156
|
+
section.header = section.header || {};
|
|
157
|
+
// Use $set() to bind the nested property
|
|
158
|
+
this.$set(section, "dataRows", []);
|
|
159
|
+
}
|
|
160
|
+
this.autoloadAll(this.spec.nextPage);
|
|
161
|
+
this.initCsvExport();
|
|
162
|
+
this.initCsvImport();
|
|
163
|
+
this.enableInfiniteScrollIfApplicable();
|
|
164
|
+
},
|
|
165
|
+
$tearDown() {
|
|
166
|
+
this.cancelAutoloadRequest();
|
|
167
|
+
},
|
|
168
|
+
clear(section) {
|
|
169
|
+
section.rows = [];
|
|
170
|
+
section.dataRows = [];
|
|
171
|
+
},
|
|
172
|
+
colSpan(row, index) {
|
|
173
|
+
const spans = row.colSpans || [];
|
|
174
|
+
return spans[index] || 1;
|
|
175
|
+
},
|
|
176
|
+
colStyles(row, index) {
|
|
177
|
+
const colStyles = row.colStyles || [];
|
|
178
|
+
return this.$styles(colStyles[index] || {});
|
|
179
|
+
},
|
|
180
|
+
rows(section) {
|
|
181
|
+
return section.rows || [];
|
|
182
|
+
},
|
|
183
|
+
triggerImport(index) {
|
|
184
|
+
const input = this.$refs.fileInput[index];
|
|
185
|
+
input.click();
|
|
186
|
+
},
|
|
187
|
+
totalRows(section) {
|
|
188
|
+
return (section.rows || []).length + (section.dataRows || []).length;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
</script>
|
|
193
|
+
|
|
194
|
+
<style lang="scss" scoped>
|
|
195
|
+
table {
|
|
196
|
+
border-spacing: 0;
|
|
197
|
+
}
|
|
198
|
+
thead {
|
|
199
|
+
th {
|
|
200
|
+
padding: 10px 4px;
|
|
201
|
+
border-top: 1px solid rgba(0, 0, 0, 0.12);
|
|
202
|
+
// border-left: 1px solid rgba(0, 0, 0, 0.12);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
tbody {
|
|
206
|
+
tr.clickable {
|
|
207
|
+
td > a {
|
|
208
|
+
cursor: pointer;
|
|
209
|
+
}
|
|
210
|
+
&:hover {
|
|
211
|
+
background: #eee;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
td {
|
|
216
|
+
border-top: 1px solid rgba(0, 0, 0, 0.12);
|
|
217
|
+
// border-left: 1px solid rgba(0, 0, 0, 0.12);
|
|
218
|
+
|
|
219
|
+
a {
|
|
220
|
+
padding: 10px 24px;
|
|
221
|
+
display: block;
|
|
222
|
+
color: inherit;
|
|
223
|
+
cursor: default;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
.scrollable {
|
|
228
|
+
width: 100%;
|
|
229
|
+
overflow: auto;
|
|
230
|
+
}
|
|
231
|
+
.data-cell {
|
|
232
|
+
white-space: pre-line;
|
|
233
|
+
}
|
|
234
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul :style="$styles()" :class="$classes()">
|
|
3
|
+
<!-- Use view name for key to avoid component reuse issue -->
|
|
4
|
+
<li v-for="(item, index) in spec.childViews" :key="`${index}_${item.view}`">
|
|
5
|
+
<ui-component :spec="item" />
|
|
6
|
+
</li>
|
|
7
|
+
</ul>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
props: {
|
|
13
|
+
spec: { type: Object, required: true }
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<style lang="scss" scoped>
|
|
19
|
+
// TODO: Need responsive support for mobile screens.
|
|
20
|
+
ul.breadcrumbs {
|
|
21
|
+
padding-left: 0px;
|
|
22
|
+
list-style: none;
|
|
23
|
+
|
|
24
|
+
li {
|
|
25
|
+
display: inline;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
li + li:before {
|
|
29
|
+
padding: 4px 4px 4px 8px;
|
|
30
|
+
color: black;
|
|
31
|
+
content: "/\00a0";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="cssClasses" :style="cssStyles" @click="$onClick()">
|
|
3
|
+
<template v-for="(item, index) in spec.childViews">
|
|
4
|
+
<!-- Use view name for key to avoid component reuse issue -->
|
|
5
|
+
<ui-component :key="`${index}_${item.view}`" :spec="item" />
|
|
6
|
+
</template>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
props: {
|
|
13
|
+
spec: { type: Object, required: true }
|
|
14
|
+
},
|
|
15
|
+
computed: {
|
|
16
|
+
cssClasses: function() {
|
|
17
|
+
// TODO: Remove this after migrating to `panels/responsive`
|
|
18
|
+
// Vertical panels are nameless when used in predefined layout (e.g. page.body, list.header, etc.)
|
|
19
|
+
this.spec.view = this.spec.view || "panels/vertical";
|
|
20
|
+
|
|
21
|
+
const classes = this.$classes().concat("layouts-vertical");
|
|
22
|
+
switch (this.spec.distribution) {
|
|
23
|
+
case "fillEqually":
|
|
24
|
+
classes.push("layouts-vertical--fill-equally");
|
|
25
|
+
break;
|
|
26
|
+
case "spaceEqually":
|
|
27
|
+
classes.push("layouts-vertical--space-equally");
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
return classes;
|
|
31
|
+
},
|
|
32
|
+
cssStyles: function() {
|
|
33
|
+
const styles = this.genericStyles();
|
|
34
|
+
switch (this.spec.align) {
|
|
35
|
+
case "center":
|
|
36
|
+
styles["align-items"] = "center";
|
|
37
|
+
break;
|
|
38
|
+
case "right":
|
|
39
|
+
styles["align-items"] = "flex-end";
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
styles["align-items"] = "flex-start";
|
|
43
|
+
}
|
|
44
|
+
return styles;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<style scoped>
|
|
51
|
+
.layouts-vertical {
|
|
52
|
+
display: flex;
|
|
53
|
+
/* overflow: hidden; */
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* From https://stackoverflow.com/questions/13483331/make-buttons-same-width-without-specifying-exact-size */
|
|
58
|
+
.layouts-vertical--space-equally {
|
|
59
|
+
justify-content: space-around;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
62
|
+
|
|
63
|
+
<style>
|
|
64
|
+
.layouts-vertical--fill-equally > * {
|
|
65
|
+
flex: initial;
|
|
66
|
+
height: 100% !important;
|
|
67
|
+
}
|
|
68
|
+
.layouts-vertical--space-equally > * {
|
|
69
|
+
flex: initial;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$classes()">
|
|
3
|
+
<v-switch
|
|
4
|
+
v-model="enabled"
|
|
5
|
+
:label="spec.text"
|
|
6
|
+
hide-details
|
|
7
|
+
@change="changed"
|
|
8
|
+
>
|
|
9
|
+
</v-switch>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
props: {
|
|
16
|
+
spec: { type: Object, required: true }
|
|
17
|
+
},
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
enabled: false
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
methods: {
|
|
24
|
+
$ready() {
|
|
25
|
+
this.enabled = this.spec.enabled;
|
|
26
|
+
},
|
|
27
|
+
changed() {
|
|
28
|
+
if (this.enabled) {
|
|
29
|
+
GLib.action.execute(this.spec.onEnabled, {}, this);
|
|
30
|
+
} else {
|
|
31
|
+
GLib.action.execute(this.spec.onDisabled, {}, this);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style scoped>
|
|
39
|
+
.v-input--selection-controls {
|
|
40
|
+
margin-top: 0;
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-tabs
|
|
3
|
+
v-model="tab"
|
|
4
|
+
grow
|
|
5
|
+
show-arrows
|
|
6
|
+
:background-color="spec.backgroundColor"
|
|
7
|
+
:slider-color="spec.color"
|
|
8
|
+
:style="'width: 100%'"
|
|
9
|
+
>
|
|
10
|
+
<v-tab
|
|
11
|
+
v-for="(item, index) in spec.buttons"
|
|
12
|
+
:key="index"
|
|
13
|
+
:href="$href(item)"
|
|
14
|
+
@click="$onClick($event, item)"
|
|
15
|
+
>
|
|
16
|
+
<common-icon v-if="item.icon" :spec="item.icon" />
|
|
17
|
+
<span :style="{ color: spec.color }">{{ item.text }}</span>
|
|
18
|
+
</v-tab>
|
|
19
|
+
</v-tabs>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
export default {
|
|
24
|
+
props: {
|
|
25
|
+
spec: { type: Object, required: true }
|
|
26
|
+
},
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
tab: null,
|
|
30
|
+
buttons: null
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
$ready() {
|
|
35
|
+
this.buttons = this.spec.tabButtons || this.spec.buttons;
|
|
36
|
+
for (const [index, button] of this.buttons.entries()) {
|
|
37
|
+
if (button.disabled) {
|
|
38
|
+
this.tab = this.$href(button);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Array.prototype.remove = function(element) {
|
|
2
|
+
const index = this.indexOf(element);
|
|
3
|
+
if (index !== -1) {
|
|
4
|
+
this.splice(index, 1);
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
return false;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
Array.prototype.clear = function() {
|
|
11
|
+
this.length = 0;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
Array.prototype.first = function() {
|
|
15
|
+
return this[0];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
Array.prototype.last = function() {
|
|
19
|
+
return this[this.length - 1];
|
|
20
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
2
|
+
String.prototype.hashCode = function() {
|
|
3
|
+
var hash = 0,
|
|
4
|
+
i,
|
|
5
|
+
chr;
|
|
6
|
+
if (this.length === 0) return hash;
|
|
7
|
+
for (i = 0; i < this.length; i++) {
|
|
8
|
+
chr = this.charCodeAt(i);
|
|
9
|
+
hash = (hash << 5) - hash + chr;
|
|
10
|
+
hash |= 0; // Convert to 32bit integer
|
|
11
|
+
}
|
|
12
|
+
return hash;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
String.prototype.contains = function(substr) {
|
|
16
|
+
return this.indexOf(substr) > -1;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
String.prototype.presence = function() {
|
|
20
|
+
return this.length > 0 ? this.toString() : null;
|
|
21
|
+
};
|
package/index.js
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import Vue from "vue";
|
|
2
|
+
export { Vue };
|
|
3
|
+
|
|
4
|
+
import App from "./app.vue";
|
|
5
|
+
|
|
6
|
+
import * as VueGoogleMaps from "vue2-google-maps";
|
|
7
|
+
Vue.use(VueGoogleMaps, {
|
|
8
|
+
load: {
|
|
9
|
+
key: process.env.GMAPS_API_KEY,
|
|
10
|
+
libraries: "places"
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
import "./styles/test.scss";
|
|
15
|
+
import "./styles/test.sass";
|
|
16
|
+
|
|
17
|
+
import Vuetify from "vuetify";
|
|
18
|
+
import "vuetify/dist/vuetify.min.css";
|
|
19
|
+
// import "material-design-icons-iconfont/dist/material-design-icons.css";
|
|
20
|
+
// import "@mdi/font/css/materialdesignicons.css";
|
|
21
|
+
Vue.use(Vuetify);
|
|
22
|
+
|
|
23
|
+
import Chartkick from "vue-chartkick";
|
|
24
|
+
import Chart from "chart.js";
|
|
25
|
+
Vue.use(Chartkick.use(Chart));
|
|
26
|
+
|
|
27
|
+
// TODO: make this opt-in
|
|
28
|
+
import VueYoutube from "vue-youtube";
|
|
29
|
+
Vue.use(VueYoutube);
|
|
30
|
+
|
|
31
|
+
// import VueAnalytics from 'vue-analytics'
|
|
32
|
+
// // TODO: Avoid hardcoding
|
|
33
|
+
// Vue.use(VueAnalytics, {
|
|
34
|
+
// id: 'UA-146876849-1'
|
|
35
|
+
// })
|
|
36
|
+
|
|
37
|
+
import "./extensions/string.js";
|
|
38
|
+
import "./extensions/array.js";
|
|
39
|
+
|
|
40
|
+
// Recursive components must be global
|
|
41
|
+
import VerticalPanel from "./components/panels/vertical";
|
|
42
|
+
import ResponsivePanel from "./components/panels/responsive";
|
|
43
|
+
import Component from "./components/component";
|
|
44
|
+
import CommonIcon from "./components/_icon";
|
|
45
|
+
import CommonButton from "./components/_button";
|
|
46
|
+
import CommonMessage from "./components/_message";
|
|
47
|
+
import CommonDropdownMenu from "./components/_dropdownMenu";
|
|
48
|
+
import CommonTemplateMenu from "./templates/_menu";
|
|
49
|
+
Vue.component("panels-vertical", VerticalPanel);
|
|
50
|
+
Vue.component("panels-responsive", ResponsivePanel);
|
|
51
|
+
Vue.component("common-button", CommonButton);
|
|
52
|
+
Vue.component("common-icon", CommonIcon);
|
|
53
|
+
Vue.component("common-message", CommonMessage);
|
|
54
|
+
Vue.component("common-dropdownMenu", CommonDropdownMenu);
|
|
55
|
+
Vue.component("templates-menu", CommonTemplateMenu);
|
|
56
|
+
|
|
57
|
+
// TODO: Deprecate
|
|
58
|
+
Vue.component("ui-component", Component);
|
|
59
|
+
|
|
60
|
+
Vue.component("glib-component", Component);
|
|
61
|
+
Vue.component("glib-icon", CommonIcon);
|
|
62
|
+
Vue.component("glib-panels-responsive", ResponsivePanel);
|
|
63
|
+
// Vue.component("glib-templates-menu", CommonTemplateMenu);
|
|
64
|
+
|
|
65
|
+
import genericMixin from "./components/mixins/generic.js";
|
|
66
|
+
Vue.mixin(genericMixin);
|
|
67
|
+
|
|
68
|
+
import eventsMixin from "./components/mixins/events.js";
|
|
69
|
+
Vue.mixin(eventsMixin);
|
|
70
|
+
|
|
71
|
+
import stylesMixin from "./components/mixins/styles.js";
|
|
72
|
+
Vue.mixin(stylesMixin);
|
|
73
|
+
|
|
74
|
+
import scrollingMixin from "./components/mixins/scrolling.js";
|
|
75
|
+
Vue.mixin(scrollingMixin);
|
|
76
|
+
|
|
77
|
+
import longClickDirective from "./components/mixins/longClick.js";
|
|
78
|
+
window.longClickInstance = longClickDirective({ delay: 500, interval: 0 });
|
|
79
|
+
Vue.directive("longclick", window.longClickInstance);
|
|
80
|
+
|
|
81
|
+
// TODO: Deprecate
|
|
82
|
+
import TypeUtils from "./utils/type";
|
|
83
|
+
Vue.use({
|
|
84
|
+
install: function(Vue, options) {
|
|
85
|
+
Vue.prototype.$type = {
|
|
86
|
+
isObject: TypeUtils.isObject,
|
|
87
|
+
isString: TypeUtils.isString,
|
|
88
|
+
isNumber: TypeUtils.isNumber,
|
|
89
|
+
isArray: TypeUtils.isArray,
|
|
90
|
+
|
|
91
|
+
ifObject: TypeUtils.ifObject,
|
|
92
|
+
ifString: TypeUtils.ifString,
|
|
93
|
+
ifNumber: TypeUtils.ifNumber,
|
|
94
|
+
ifArray: TypeUtils.ifArray
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
import Utils from "./utils/helper";
|
|
100
|
+
window.Utils = Utils;
|
|
101
|
+
|
|
102
|
+
import Framework from "./utils/public";
|
|
103
|
+
window.GLib = Framework;
|
|
104
|
+
|
|
105
|
+
import { settings } from "./utils/settings";
|
|
106
|
+
export { settings };
|
|
107
|
+
|
|
108
|
+
// TODO: https://vuejs.org/v2/guide/components-dynamic-async.html#Async-Components
|
|
109
|
+
// Vue.component('async-webpack-example', function (resolve) {
|
|
110
|
+
// // This special require syntax will instruct Webpack to
|
|
111
|
+
// // automatically split your built code into bundles which
|
|
112
|
+
// // are loaded over Ajax requests.
|
|
113
|
+
// require(['./my-async-component'], resolve)
|
|
114
|
+
// })
|
|
115
|
+
|
|
116
|
+
import VueGtag from "vue-gtag";
|
|
117
|
+
|
|
118
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
119
|
+
const gtagId = settings.gtagId;
|
|
120
|
+
if (gtagId) {
|
|
121
|
+
Vue.use(VueGtag, {
|
|
122
|
+
config: {
|
|
123
|
+
id: settings.gtagId,
|
|
124
|
+
params: {
|
|
125
|
+
send_page_view: false
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
window.vueApp = {
|
|
132
|
+
vuetify: new Vuetify({
|
|
133
|
+
icons: {
|
|
134
|
+
iconfont: "md"
|
|
135
|
+
},
|
|
136
|
+
theme: {
|
|
137
|
+
themes: Utils.settings.themes
|
|
138
|
+
},
|
|
139
|
+
breakpoint: {
|
|
140
|
+
smAndDown: true
|
|
141
|
+
}
|
|
142
|
+
}),
|
|
143
|
+
page: window.__page,
|
|
144
|
+
indicator: false,
|
|
145
|
+
// Rename to isPageStale
|
|
146
|
+
isStale: false,
|
|
147
|
+
stateUpdatedAt: null,
|
|
148
|
+
webSocket: { channels: {}, header: {} },
|
|
149
|
+
actionCable: { channels: {} },
|
|
150
|
+
temp: {}
|
|
151
|
+
};
|
|
152
|
+
new Vue({
|
|
153
|
+
el: "#app",
|
|
154
|
+
vuetify: window.vueApp.vuetify,
|
|
155
|
+
data: {
|
|
156
|
+
vueApp: window.vueApp
|
|
157
|
+
},
|
|
158
|
+
// data: {
|
|
159
|
+
// vuetify: vuetify,
|
|
160
|
+
// page: window.__page,
|
|
161
|
+
// indicator: false,
|
|
162
|
+
// isStale: false,
|
|
163
|
+
// webSocket: { channels: {}, header: {}, listWindow: null }
|
|
164
|
+
// },
|
|
165
|
+
render: function(createElement) {
|
|
166
|
+
return createElement(App, { props: { page: this.$data.vueApp.page } });
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// The above code uses Vue without the compiler, which means you cannot
|
|
172
|
+
// use Vue to target elements in your existing html templates. You would
|
|
173
|
+
// need to always use single file components.
|
|
174
|
+
// To be able to target elements in your existing html/erb templates,
|
|
175
|
+
// comment out the above code and uncomment the below
|
|
176
|
+
// Add <%= javascript_pack_tag 'hello_vue' %> to your layout
|
|
177
|
+
// Then add this markup to your html template:
|
|
178
|
+
//
|
|
179
|
+
// <div id='hello'>
|
|
180
|
+
// {{message}}
|
|
181
|
+
// <app></app>
|
|
182
|
+
// </div>
|
|
183
|
+
|
|
184
|
+
// import Vue from 'vue/dist/vue.esm'
|
|
185
|
+
// import App from '../app.vue'
|
|
186
|
+
//
|
|
187
|
+
// document.addEventListener('DOMContentLoaded', () => {
|
|
188
|
+
// const app = new Vue({
|
|
189
|
+
// el: '#hello',
|
|
190
|
+
// data: {
|
|
191
|
+
// message: "Can you say hello?"
|
|
192
|
+
// },
|
|
193
|
+
// components: { App }
|
|
194
|
+
// })
|
|
195
|
+
// })
|
package/keys.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// See https://stackoverflow.com/questions/32647215/declaring-static-constants-in-es6-classes
|
|
2
|
+
// const csrfToken = "__csrfToken";
|
|
3
|
+
|
|
4
|
+
// See https://stackoverflow.com/questions/28784375/nested-es6-classes
|
|
5
|
+
export default class Keys {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
Keys.Db = class {
|
|
9
|
+
// static get csrfToken() {
|
|
10
|
+
// return csrfToken;
|
|
11
|
+
// }
|
|
12
|
+
}
|