@hashtagcms/admin-ui-kit 1.0.6
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 +21 -0
- package/README.md +83 -0
- package/dist/admin-ui-kit.min.css +14 -0
- package/dist/admin-ui-kit.min.js +2 -0
- package/dist/admin-ui-kit.min.js.LICENSE.txt +175 -0
- package/package.json +53 -0
- package/packages/components/README.md +92 -0
- package/packages/components/package.json +28 -0
- package/packages/components/src/action-bar.vue +237 -0
- package/packages/components/src/category-platform.vue +97 -0
- package/packages/components/src/category-settings.vue +815 -0
- package/packages/components/src/cms-module-dropdown.vue +78 -0
- package/packages/components/src/downlods.vue +21 -0
- package/packages/components/src/file-uploader.vue +188 -0
- package/packages/components/src/frontend-module-creator.vue +599 -0
- package/packages/components/src/global-site-button.vue +94 -0
- package/packages/components/src/homepage.vue +1087 -0
- package/packages/components/src/html-slot.vue +23 -0
- package/packages/components/src/image-gallery.vue +144 -0
- package/packages/components/src/index.js +53 -0
- package/packages/components/src/info-boxes.vue +68 -0
- package/packages/components/src/info-popup.vue +121 -0
- package/packages/components/src/language-button.vue +80 -0
- package/packages/components/src/language-copier.vue +177 -0
- package/packages/components/src/left-nav.vue +159 -0
- package/packages/components/src/library/copy-paste.vue +186 -0
- package/packages/components/src/library/info-box.vue +102 -0
- package/packages/components/src/library/left-menu-show-hide.vue +47 -0
- package/packages/components/src/library/loader.vue +141 -0
- package/packages/components/src/library/modal-box.vue +136 -0
- package/packages/components/src/library/split-button.vue +127 -0
- package/packages/components/src/library/timer-button.vue +43 -0
- package/packages/components/src/library/toast-box.vue +53 -0
- package/packages/components/src/menu-sorter.vue +265 -0
- package/packages/components/src/module-creator.vue +650 -0
- package/packages/components/src/module-permission.vue +334 -0
- package/packages/components/src/pagination.vue +125 -0
- package/packages/components/src/platform-button.vue +118 -0
- package/packages/components/src/search-bar.vue +144 -0
- package/packages/components/src/site-button.vue +42 -0
- package/packages/components/src/site-cloner.vue +150 -0
- package/packages/components/src/sitewise-copier.vue +234 -0
- package/packages/components/src/sitewise-data.vue +347 -0
- package/packages/components/src/sorter.vue +239 -0
- package/packages/components/src/tabular-view.vue +824 -0
- package/packages/components/src/title-bar.vue +76 -0
- package/packages/components/src/top-nav.vue +96 -0
- package/packages/helpers/README.md +88 -0
- package/packages/helpers/package.json +20 -0
- package/packages/helpers/src/admin-config.js +9 -0
- package/packages/helpers/src/common.js +89 -0
- package/packages/helpers/src/dashboard.js +16 -0
- package/packages/helpers/src/editor.js +163 -0
- package/packages/helpers/src/error-message-handler.js +50 -0
- package/packages/helpers/src/event-bus.js +4 -0
- package/packages/helpers/src/form.js +4 -0
- package/packages/helpers/src/fx.js +106 -0
- package/packages/helpers/src/humanize.js +14 -0
- package/packages/helpers/src/map.js +3 -0
- package/packages/styles/README.md +37 -0
- package/packages/styles/package.json +15 -0
- package/packages/styles/src/_action-bar.scss +35 -0
- package/packages/styles/src/_admin.scss +22 -0
- package/packages/styles/src/_animate.scss +1579 -0
- package/packages/styles/src/_badges.scss +34 -0
- package/packages/styles/src/_category-list.scss +14 -0
- package/packages/styles/src/_common.scss +163 -0
- package/packages/styles/src/_info-box.scss +96 -0
- package/packages/styles/src/_left-nav.scss +59 -0
- package/packages/styles/src/_loader.scss +82 -0
- package/packages/styles/src/_menu-sorter.scss +39 -0
- package/packages/styles/src/_model-creator.scss +48 -0
- package/packages/styles/src/_module-permission.scss +25 -0
- package/packages/styles/src/_page-manager.scss +63 -0
- package/packages/styles/src/_popover-modal.scss +20 -0
- package/packages/styles/src/_table-grid.scss +39 -0
- package/packages/styles/src/_toast.scss +20 -0
- package/packages/styles/src/_variables.scss +37 -0
- package/packages/styles/src/app.scss +2 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="d-flex flex-column flex-shrink-0 t_left js_left_menu">
|
|
3
|
+
<ul class="list-unstyled ps-0">
|
|
4
|
+
<template v-for="current in allData">
|
|
5
|
+
<li v-if="current.parent_id === 0">
|
|
6
|
+
<a
|
|
7
|
+
:title="current.sub_title"
|
|
8
|
+
:href="getHref(current)"
|
|
9
|
+
:class="
|
|
10
|
+
'text-white ' + getActiveCss(current.controller_name, current)
|
|
11
|
+
"
|
|
12
|
+
aria-expanded="true"
|
|
13
|
+
>
|
|
14
|
+
<i
|
|
15
|
+
v-if="hasChild(current)"
|
|
16
|
+
class="js_more fa fa-ellipsis-v pull-right adjustMore"
|
|
17
|
+
@click="showHide($event)"
|
|
18
|
+
></i>
|
|
19
|
+
<i :class="current.icon_css + ' fa-icons'" aria-hidden="true"></i>
|
|
20
|
+
{{ current.name }}
|
|
21
|
+
</a>
|
|
22
|
+
<template v-if="hasChild(current)">
|
|
23
|
+
<ul
|
|
24
|
+
:class="
|
|
25
|
+
'js_child btn-toggle-nav list-unstyled fw-normal ' +
|
|
26
|
+
getActiveCss(current.controller_name, current)
|
|
27
|
+
"
|
|
28
|
+
>
|
|
29
|
+
<li v-for="child in current.child">
|
|
30
|
+
<a
|
|
31
|
+
:title="child.sub_title"
|
|
32
|
+
:href="getHref(child)"
|
|
33
|
+
:class="
|
|
34
|
+
'text-white ' + getActiveCss(child.controller_name, child)
|
|
35
|
+
"
|
|
36
|
+
>
|
|
37
|
+
<i
|
|
38
|
+
:class="child.icon_css + ' fa-icons'"
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
></i>
|
|
41
|
+
{{ child.name }}
|
|
42
|
+
</a>
|
|
43
|
+
</li>
|
|
44
|
+
</ul>
|
|
45
|
+
</template>
|
|
46
|
+
</li>
|
|
47
|
+
</template>
|
|
48
|
+
</ul>
|
|
49
|
+
<hr />
|
|
50
|
+
<div class="dropdown">
|
|
51
|
+
<a
|
|
52
|
+
title="Open HashtagCMS.org"
|
|
53
|
+
:href="linkForHashtag"
|
|
54
|
+
target="_blank"
|
|
55
|
+
class="d-flex align-items-center text-light text-decoration-none"
|
|
56
|
+
data-bs-toggle="dropdown"
|
|
57
|
+
aria-expanded="false"
|
|
58
|
+
>
|
|
59
|
+
<strong>v{{ dataHashtagcmsVersion }}</strong>
|
|
60
|
+
</a>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script>
|
|
66
|
+
import AdminConfig from "@hashtagcms/helpers/admin-config";
|
|
67
|
+
export default {
|
|
68
|
+
mounted() {},
|
|
69
|
+
props: [
|
|
70
|
+
"dataList",
|
|
71
|
+
"dataControllerName",
|
|
72
|
+
"dataModulesAllowed",
|
|
73
|
+
"dataIsAdmin",
|
|
74
|
+
"dataHashtagcmsVersion",
|
|
75
|
+
],
|
|
76
|
+
data() {
|
|
77
|
+
return {
|
|
78
|
+
allData: this.dataList ? JSON.parse(this.dataList) : [],
|
|
79
|
+
modulesAllowed: this.dataModulesAllowed
|
|
80
|
+
? JSON.parse(this.dataModulesAllowed)
|
|
81
|
+
: [],
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
computed: {
|
|
85
|
+
linkForHashtag() {
|
|
86
|
+
return `https://www.hashtagcms.org/?utm_src=${window.location.href}`;
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
getIconLabel(data) {
|
|
91
|
+
return data.icon_css === "" || !data.icon_css
|
|
92
|
+
? data.controller_name.charAt(0).toUpperCase()
|
|
93
|
+
: "";
|
|
94
|
+
},
|
|
95
|
+
getIconCss(data) {
|
|
96
|
+
return data.icon_css === "" || !data.icon_css
|
|
97
|
+
? "badge badge-info text-small"
|
|
98
|
+
: data.icon_css;
|
|
99
|
+
},
|
|
100
|
+
hasChild(data) {
|
|
101
|
+
return data.child.length > 0;
|
|
102
|
+
},
|
|
103
|
+
getActiveCss(controller_name, data) {
|
|
104
|
+
return this.isActive(controller_name, data) ? "active" : "";
|
|
105
|
+
},
|
|
106
|
+
isActive(controller_name, data) {
|
|
107
|
+
if (this.dataControllerName === controller_name) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (data && data.child && data.child.length > 0) {
|
|
112
|
+
let controllerName = this.dataControllerName;
|
|
113
|
+
return data.child.find(function (c) {
|
|
114
|
+
return c.controller_name === controllerName;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
getHref(data) {
|
|
119
|
+
return AdminConfig.admin_path(data.controller_name);
|
|
120
|
+
},
|
|
121
|
+
hideAll() {
|
|
122
|
+
let $this = this;
|
|
123
|
+
document
|
|
124
|
+
.querySelectorAll(".js_left_menu .js_child")
|
|
125
|
+
.forEach(function (ele) {
|
|
126
|
+
ele.classList.remove("active", "animated", "fadeIn");
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
showHide(event) {
|
|
130
|
+
this.hideAll();
|
|
131
|
+
let ele = event.target;
|
|
132
|
+
if (ele.classList.contains("js_more")) {
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
//ele.nextSibling.style.display = "block";
|
|
135
|
+
ele.parentElement.nextElementSibling.classList.add(
|
|
136
|
+
"active",
|
|
137
|
+
"animated",
|
|
138
|
+
"fadeIn",
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
hasAccess(module_id) {
|
|
143
|
+
if (this.dataIsAdmin.toString() === "1") {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
for (let i = 0; i < this.modulesAllowed.length; i++) {
|
|
147
|
+
let current = this.modulesAllowed[i];
|
|
148
|
+
if (current.module_id === module_id) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return false;
|
|
153
|
+
},
|
|
154
|
+
getMinHeight() {
|
|
155
|
+
return `height:${window.innerHeight}px;`;
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
</script>
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
v-if="showCopy"
|
|
4
|
+
aria-label="Copy"
|
|
5
|
+
class="btn btn-outline-secondary"
|
|
6
|
+
title="Copy"
|
|
7
|
+
type="button"
|
|
8
|
+
@click="copyNow()"
|
|
9
|
+
>
|
|
10
|
+
<i aria-hidden="true" class="fa fa-copy"></i>
|
|
11
|
+
</button>
|
|
12
|
+
<button
|
|
13
|
+
v-if="showPaste"
|
|
14
|
+
aria-label="Paste"
|
|
15
|
+
class="btn btn-outline-secondary"
|
|
16
|
+
title="Paste"
|
|
17
|
+
type="button"
|
|
18
|
+
@click="pasteNow()"
|
|
19
|
+
>
|
|
20
|
+
<i aria-hidden="true" class="fa fa-paste"></i>
|
|
21
|
+
</button>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import {
|
|
26
|
+
CopyToClipboard,
|
|
27
|
+
PasteFromClipboard,
|
|
28
|
+
Toast,
|
|
29
|
+
IsJson,
|
|
30
|
+
} from "@hashtagcms/helpers/common";
|
|
31
|
+
import { EventBus } from "@hashtagcms/helpers/event-bus";
|
|
32
|
+
export default {
|
|
33
|
+
props: [
|
|
34
|
+
"dataIgnoreFields",
|
|
35
|
+
"dataPasteElement",
|
|
36
|
+
"dataForm",
|
|
37
|
+
"dataBackUrl",
|
|
38
|
+
"dataCopyPasteAutoInit",
|
|
39
|
+
"dataShowCopy",
|
|
40
|
+
"dataShowPaste",
|
|
41
|
+
],
|
|
42
|
+
mounted() {
|
|
43
|
+
if (this.autoInit) {
|
|
44
|
+
this.init();
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
created() {},
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
ignoreFields:
|
|
51
|
+
typeof this.dataIgnoreFields === "undefined"
|
|
52
|
+
? [
|
|
53
|
+
"id",
|
|
54
|
+
"site_id",
|
|
55
|
+
"backURL",
|
|
56
|
+
"actionPerformed",
|
|
57
|
+
"platform_id",
|
|
58
|
+
"_token",
|
|
59
|
+
"insert_by",
|
|
60
|
+
"update_by",
|
|
61
|
+
]
|
|
62
|
+
: JSON.parse(this.dataIgnoreFields),
|
|
63
|
+
copyKey: "cms_copy_data",
|
|
64
|
+
backURL:
|
|
65
|
+
typeof this.dataBackUrl === "undefined" || this.dataBackUrl === ""
|
|
66
|
+
? ""
|
|
67
|
+
: this.dataBackUrl,
|
|
68
|
+
autoInit:
|
|
69
|
+
this.dataCopyPasteAutoInit === undefined ||
|
|
70
|
+
this.dataCopyPasteAutoInit?.toString() === "true",
|
|
71
|
+
showCopy:
|
|
72
|
+
this.dataShowCopy === undefined ||
|
|
73
|
+
this.dataShowCopy.toString() === "true",
|
|
74
|
+
showPaste:
|
|
75
|
+
this.dataShowPaste === undefined ||
|
|
76
|
+
this.dataShowPaste.toString() === "true",
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
computed: {
|
|
80
|
+
form() {
|
|
81
|
+
let holder;
|
|
82
|
+
if (
|
|
83
|
+
typeof this.dataForm !== "undefined" &&
|
|
84
|
+
document.getElementById(this.dataForm)
|
|
85
|
+
) {
|
|
86
|
+
holder = document.getElementById(this.dataForm);
|
|
87
|
+
} else {
|
|
88
|
+
holder = document;
|
|
89
|
+
}
|
|
90
|
+
return holder;
|
|
91
|
+
},
|
|
92
|
+
pasteElement() {
|
|
93
|
+
let holder;
|
|
94
|
+
if (typeof this.dataPasteElement === "undefined") {
|
|
95
|
+
holder = this.form.querySelectorAll("input[type='text']")[0];
|
|
96
|
+
} else {
|
|
97
|
+
holder = this.form.getElementById(this.dataPasteElement);
|
|
98
|
+
}
|
|
99
|
+
//console.log("holder", holder);
|
|
100
|
+
return holder;
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
methods: {
|
|
104
|
+
init() {
|
|
105
|
+
let $this = this;
|
|
106
|
+
if (this.pasteElement) {
|
|
107
|
+
this.pasteElement.addEventListener("blur", function () {
|
|
108
|
+
if (IsJson(this.value)) {
|
|
109
|
+
$this.pasteNow();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
copyNow() {
|
|
115
|
+
let $this = this;
|
|
116
|
+
|
|
117
|
+
let inputs = this.form.querySelectorAll("input");
|
|
118
|
+
let textAreas = this.form.querySelectorAll("textarea");
|
|
119
|
+
let selects = this.form.querySelectorAll("select");
|
|
120
|
+
|
|
121
|
+
let allElements = [...inputs, ...textAreas, ...selects];
|
|
122
|
+
|
|
123
|
+
let store = {};
|
|
124
|
+
allElements.forEach(function (current) {
|
|
125
|
+
let name = current.getAttribute("name") || current.getAttribute("id");
|
|
126
|
+
|
|
127
|
+
if (
|
|
128
|
+
name != null &&
|
|
129
|
+
typeof name !== "object" &&
|
|
130
|
+
shouldIgnore(name) === -1
|
|
131
|
+
) {
|
|
132
|
+
store[name] =
|
|
133
|
+
current.type === "checkbox" || current.type === "radio"
|
|
134
|
+
? current.checked
|
|
135
|
+
: current.value;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
let data = JSON.stringify(store);
|
|
140
|
+
CopyToClipboard(data);
|
|
141
|
+
|
|
142
|
+
EventBus.emit("on-copy", data);
|
|
143
|
+
Toast.show(this, "Copied...", 1000);
|
|
144
|
+
|
|
145
|
+
function shouldIgnore(name) {
|
|
146
|
+
return $this.ignoreFields.findIndex(function (nm) {
|
|
147
|
+
return name === nm;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
fillData: function (data) {
|
|
152
|
+
let form = this.form;
|
|
153
|
+
if (data) {
|
|
154
|
+
for (let i in data) {
|
|
155
|
+
try {
|
|
156
|
+
let ele = form[i] || document.getElementById(i);
|
|
157
|
+
let val = data[i];
|
|
158
|
+
if (ele.type === "checkbox" || ele.type === "radio") {
|
|
159
|
+
ele.checked = val;
|
|
160
|
+
} else {
|
|
161
|
+
ele.value = val;
|
|
162
|
+
}
|
|
163
|
+
} catch (e) {
|
|
164
|
+
console.info("unable to set value @ " + i);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
pasteNow(cb) {
|
|
170
|
+
PasteFromClipboard()
|
|
171
|
+
.then((res) => {
|
|
172
|
+
if (IsJson(res)) {
|
|
173
|
+
this.fillData(JSON.parse(res));
|
|
174
|
+
}
|
|
175
|
+
if (cb) {
|
|
176
|
+
cb(JSON.parse(res));
|
|
177
|
+
}
|
|
178
|
+
EventBus.emit("on-paste", res);
|
|
179
|
+
})
|
|
180
|
+
.catch((res) => {
|
|
181
|
+
console.log("unable to paste");
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
</script>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="card mb-3 shadow info-box">
|
|
3
|
+
<span :class="getColor() + ' info-box-icon'"
|
|
4
|
+
><i style="font-style: normal" :class="icon">{{ getIconText() }}</i></span
|
|
5
|
+
>
|
|
6
|
+
<div class="card-body">
|
|
7
|
+
<h5 class="card-title">
|
|
8
|
+
<a v-if="link !== ''" :href="link" class="info-box-text"
|
|
9
|
+
><span class="info-box-text" v-html="content"></span
|
|
10
|
+
></a>
|
|
11
|
+
<span v-if="link === ''" class="info-box-text">{{ content }}</span>
|
|
12
|
+
</h5>
|
|
13
|
+
<p class="card-text text-center" v-if="subTitle !== ''">
|
|
14
|
+
{{ subTitle }}
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import { Storage } from "@hashtagcms/admin-sdk";
|
|
22
|
+
const Store = new Storage();
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
mounted() {},
|
|
26
|
+
props: [
|
|
27
|
+
"dataInfo",
|
|
28
|
+
"dataColorIndex",
|
|
29
|
+
"dataSubTitle",
|
|
30
|
+
"dataTitle",
|
|
31
|
+
"dataIconCss",
|
|
32
|
+
"dataLink",
|
|
33
|
+
],
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
info:
|
|
37
|
+
typeof this.dataInfo == "undefined"
|
|
38
|
+
? null
|
|
39
|
+
: typeof this.dataInfo == "string"
|
|
40
|
+
? JSON.parse(this.dataInfo)
|
|
41
|
+
: this.dataInfo,
|
|
42
|
+
subTitle:
|
|
43
|
+
typeof this.dataSubTitle !== "undefined" ? this.dataSubTitle : "",
|
|
44
|
+
iconCss: this.dataIconCss,
|
|
45
|
+
link: typeof this.dataLink == "undefined" ? "" : this.dataLink,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
content() {
|
|
50
|
+
return this.info !== null
|
|
51
|
+
? this.info.name || this.info.title
|
|
52
|
+
: this.dataTitle;
|
|
53
|
+
},
|
|
54
|
+
icon() {
|
|
55
|
+
if (
|
|
56
|
+
(typeof this.iconCss == "undefined" || this.iconCss === "") &&
|
|
57
|
+
this.info !== null
|
|
58
|
+
) {
|
|
59
|
+
return this.info.icon_css || this.info.iconCss;
|
|
60
|
+
} else {
|
|
61
|
+
return this.iconCss;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
getIconText() {
|
|
67
|
+
return this.info?.icon_css || typeof this.iconCss === "undefined"
|
|
68
|
+
? this.content
|
|
69
|
+
.replace(/[^a-zA-Z- ]/g, "")
|
|
70
|
+
.match(/\b\w/g)
|
|
71
|
+
.join("")
|
|
72
|
+
: "";
|
|
73
|
+
},
|
|
74
|
+
getColor: function () {
|
|
75
|
+
let n = !this.dataColorIndex
|
|
76
|
+
? this.getSerialNumber()
|
|
77
|
+
: this.dataColorIndex;
|
|
78
|
+
return "color-" + n;
|
|
79
|
+
},
|
|
80
|
+
getRandom(min = 1, max = 10) {
|
|
81
|
+
//not in used
|
|
82
|
+
min = parseInt(min);
|
|
83
|
+
max = parseInt(max);
|
|
84
|
+
return Math.floor(Math.random() * (max - min)) + min;
|
|
85
|
+
},
|
|
86
|
+
getSerialNumber() {
|
|
87
|
+
if (Store.fetch("counter") === undefined) {
|
|
88
|
+
Store.store("counter", 1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let counter = Store.fetch("counter");
|
|
92
|
+
|
|
93
|
+
if (counter > 10) {
|
|
94
|
+
counter = 1;
|
|
95
|
+
}
|
|
96
|
+
Store.store("counter", counter + 1);
|
|
97
|
+
|
|
98
|
+
return counter;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="btn-group">
|
|
3
|
+
<span @click="toggleMenu" :class="currentCss"></span>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { LeftMenu } from "@hashtagcms/helpers/common";
|
|
9
|
+
import { EventBus } from "@hashtagcms/helpers/event-bus";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
mounted() {
|
|
13
|
+
LeftMenu.init();
|
|
14
|
+
this.init();
|
|
15
|
+
},
|
|
16
|
+
props: ["dataIconCss", "dataIconCssOff"],
|
|
17
|
+
data() {
|
|
18
|
+
return {
|
|
19
|
+
visible: true,
|
|
20
|
+
currentCss: "",
|
|
21
|
+
css:
|
|
22
|
+
typeof this.dataIconCss == "undefined" || this.dataIconCss === ""
|
|
23
|
+
? "fa fa-arrow-left hand"
|
|
24
|
+
: this.dataIconCss,
|
|
25
|
+
cssOff:
|
|
26
|
+
typeof this.dataIconCssOff == "undefined" || this.dataIconCssOff === ""
|
|
27
|
+
? "fa fa-arrow-right hand"
|
|
28
|
+
: this.dataIconCssOff,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
init() {
|
|
33
|
+
this.currentCss = LeftMenu.isVisible() ? this.css : this.cssOff;
|
|
34
|
+
EventBus.on("left-menu-on-show", () => {
|
|
35
|
+
this.currentCss = this.css;
|
|
36
|
+
});
|
|
37
|
+
EventBus.on("left-menu-on-hide", () => {
|
|
38
|
+
this.currentCss = this.cssOff;
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
toggleMenu() {
|
|
42
|
+
this.visible = !this.visible;
|
|
43
|
+
LeftMenu.toggleShow();
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="visible">
|
|
3
|
+
<div class="loaderModal" ref="loaderModal" v-show="asModal"></div>
|
|
4
|
+
<div class="loaderPanel" ref="loaderSpinner">
|
|
5
|
+
<div class="spinner">
|
|
6
|
+
<svg viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
|
7
|
+
<circle
|
|
8
|
+
class="length"
|
|
9
|
+
fill="none"
|
|
10
|
+
stroke-width="8"
|
|
11
|
+
stroke-linecap="round"
|
|
12
|
+
cx="33"
|
|
13
|
+
cy="33"
|
|
14
|
+
r="28"
|
|
15
|
+
></circle>
|
|
16
|
+
</svg>
|
|
17
|
+
<svg viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
|
18
|
+
<circle
|
|
19
|
+
fill="none"
|
|
20
|
+
stroke-width="8"
|
|
21
|
+
stroke-linecap="round"
|
|
22
|
+
cx="33"
|
|
23
|
+
cy="33"
|
|
24
|
+
r="28"
|
|
25
|
+
></circle>
|
|
26
|
+
</svg>
|
|
27
|
+
<svg viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
|
28
|
+
<circle
|
|
29
|
+
fill="none"
|
|
30
|
+
stroke-width="8"
|
|
31
|
+
stroke-linecap="round"
|
|
32
|
+
cx="33"
|
|
33
|
+
cy="33"
|
|
34
|
+
r="28"
|
|
35
|
+
></circle>
|
|
36
|
+
</svg>
|
|
37
|
+
<svg viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
|
38
|
+
<circle
|
|
39
|
+
fill="none"
|
|
40
|
+
stroke-width="8"
|
|
41
|
+
stroke-linecap="round"
|
|
42
|
+
cx="33"
|
|
43
|
+
cy="33"
|
|
44
|
+
r="28"
|
|
45
|
+
></circle>
|
|
46
|
+
</svg>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<span class="loaderText" v-html="loadingText"></span>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script>
|
|
55
|
+
export default {
|
|
56
|
+
props: ["dataLoadingText", "dataAsModal"],
|
|
57
|
+
mounted() {
|
|
58
|
+
this.fixLayout();
|
|
59
|
+
},
|
|
60
|
+
data() {
|
|
61
|
+
return {
|
|
62
|
+
loadingText:
|
|
63
|
+
typeof this.dataLoadingText === "undefined"
|
|
64
|
+
? "Loading. Please wait..."
|
|
65
|
+
: this.dataLoadingText,
|
|
66
|
+
asModal:
|
|
67
|
+
typeof dataAsModal === "undefined" || dataAsModal === true
|
|
68
|
+
? true
|
|
69
|
+
: false,
|
|
70
|
+
visible: false,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
methods: {
|
|
74
|
+
fixLayout(position = null) {
|
|
75
|
+
let heightWidth = getHeightWidth();
|
|
76
|
+
|
|
77
|
+
let loaderModal = this.$refs.loaderModal;
|
|
78
|
+
let loaderSpinner = this.$refs.loaderSpinner;
|
|
79
|
+
|
|
80
|
+
//loader width/height
|
|
81
|
+
loaderModal.style.width = heightWidth.width + "px";
|
|
82
|
+
loaderModal.style.height = heightWidth.height + "px";
|
|
83
|
+
|
|
84
|
+
if (position !== null) {
|
|
85
|
+
if (position.left) {
|
|
86
|
+
loaderSpinner.style.left = position.left + "px";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (position.top) {
|
|
90
|
+
loaderSpinner.style.top = position.top + "px";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (position.right) {
|
|
94
|
+
loaderSpinner.style.top = position.right + "px";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function getHeightWidth() {
|
|
99
|
+
var width = 0,
|
|
100
|
+
height = 0;
|
|
101
|
+
if (typeof window.innerWidth == "number") {
|
|
102
|
+
//Non-IE
|
|
103
|
+
width = window.innerWidth;
|
|
104
|
+
height = window.innerHeight;
|
|
105
|
+
} else if (
|
|
106
|
+
document.documentElement &&
|
|
107
|
+
(document.documentElement.clientWidth ||
|
|
108
|
+
document.documentElement.clientHeight)
|
|
109
|
+
) {
|
|
110
|
+
//IE 6+ in 'standards compliant mode'
|
|
111
|
+
width = document.documentElement.clientWidth;
|
|
112
|
+
height = document.documentElement.clientHeight;
|
|
113
|
+
} else if (
|
|
114
|
+
document.body &&
|
|
115
|
+
(document.body.clientWidth || document.body.clientHeight)
|
|
116
|
+
) {
|
|
117
|
+
//IE 4 compatible
|
|
118
|
+
width = document.body.clientWidth;
|
|
119
|
+
height = document.body.clientHeight;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return { width, height };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
//console.log(width, height);
|
|
126
|
+
},
|
|
127
|
+
show(message = null, position = null) {
|
|
128
|
+
this.visible = true;
|
|
129
|
+
|
|
130
|
+
if (typeof message == "string") {
|
|
131
|
+
this.loadingText = message;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
this.fixLayout(position);
|
|
135
|
+
},
|
|
136
|
+
hide() {
|
|
137
|
+
this.visible = false;
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
</script>
|