renusify 2.1.0 → 2.1.2
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/components/calendar/index.js +1 -1
- package/components/chart/worldMap.js +1 -1
- package/components/form/addressInput/index.js +1 -1
- package/components/index.js +2 -2
- package/components/meta/index.js +1 -155
- package/components/meta/meta.js +155 -0
- package/directive/index.js +1 -1
- package/index.js +5 -9
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ export * as rCalendarYearTab from './year.vue'
|
|
|
4
4
|
export * as l_container from '../container/index.js'
|
|
5
5
|
export * as l_row from '../container/row.js'
|
|
6
6
|
export * as l_col from '../container/col.js'
|
|
7
|
-
export * as l_btn from '
|
|
7
|
+
export * as l_btn from '../button/index.js'
|
|
8
8
|
export * as l_icon from '../icon/index.js'
|
|
9
9
|
export * as l_card from '../card/index.js'
|
|
10
10
|
export * as l_modal from '../modal/index.js'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as
|
|
1
|
+
export * as rChartMap from './worldMap.vue'
|
|
2
2
|
export * as l_float from '../float/index.js'
|
package/components/index.js
CHANGED
|
@@ -82,7 +82,7 @@ export * as rTimeline from './timeline/index.js'
|
|
|
82
82
|
export * as rTour from './tour/index.js'
|
|
83
83
|
export * as rTree from './tree/index.js'
|
|
84
84
|
|
|
85
|
-
export const
|
|
85
|
+
export const _register = (app, components) => {
|
|
86
86
|
let d = {}
|
|
87
87
|
let s = {}
|
|
88
88
|
const setup = (ls) => {
|
|
@@ -103,7 +103,7 @@ export const register = (app, components) => {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
} catch (e) {
|
|
106
|
-
console.error('component not found',
|
|
106
|
+
console.error('component not found', name, e)
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
package/components/meta/index.js
CHANGED
|
@@ -1,155 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const rMeta= {
|
|
3
|
-
name: "r-meta",
|
|
4
|
-
created(){
|
|
5
|
-
this.build()
|
|
6
|
-
},
|
|
7
|
-
watch: {
|
|
8
|
-
'$attrs': {
|
|
9
|
-
handler() {
|
|
10
|
-
this.build()
|
|
11
|
-
},
|
|
12
|
-
deep: true
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
activated() {
|
|
16
|
-
this.build()
|
|
17
|
-
},
|
|
18
|
-
deactivated() {
|
|
19
|
-
this.removeAll()
|
|
20
|
-
},
|
|
21
|
-
methods: {
|
|
22
|
-
build() {
|
|
23
|
-
for (let i in this.$attrs) {
|
|
24
|
-
if (this.$helper.hasKey(this.$attrs, i)) {
|
|
25
|
-
this[i](this.$attrs[i]);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
html(obj) {
|
|
30
|
-
/*
|
|
31
|
-
:html="{
|
|
32
|
-
body: {id: 'aPageId'},
|
|
33
|
-
h1: {'data-foo': 'bar'},
|
|
34
|
-
}"
|
|
35
|
-
*/
|
|
36
|
-
Object.keys(obj).forEach(selector =>
|
|
37
|
-
this.setRootElementAttributes(selector, obj[selector])
|
|
38
|
-
);
|
|
39
|
-
},
|
|
40
|
-
head(obj) {
|
|
41
|
-
/*
|
|
42
|
-
:head="{
|
|
43
|
-
'meta[charset]': {charset: 'utf-8'},
|
|
44
|
-
}"
|
|
45
|
-
*/
|
|
46
|
-
Object.keys(obj).forEach(selector =>
|
|
47
|
-
this.setHeadElementAttributes(selector, obj[selector])
|
|
48
|
-
);
|
|
49
|
-
},
|
|
50
|
-
title(val) {
|
|
51
|
-
document.title = this.isRemoveValue(val) ? "" : val;
|
|
52
|
-
this.setMetaContent('itemprop="name"', val);
|
|
53
|
-
this.setMetaContent('property="og:title"', val);
|
|
54
|
-
this.setMetaContent('name="twitter:title"', val);
|
|
55
|
-
},
|
|
56
|
-
description(val) {
|
|
57
|
-
this.setMetaContent('name="description"', val);
|
|
58
|
-
this.setMetaContent('itemprop="description"', val);
|
|
59
|
-
this.setMetaContent('property="og:description"', val);
|
|
60
|
-
this.setMetaContent('name="twitter:description"', val);
|
|
61
|
-
},
|
|
62
|
-
keywords(val) {
|
|
63
|
-
this.setMetaContent('name="keywords"',val);
|
|
64
|
-
},
|
|
65
|
-
image(val) {
|
|
66
|
-
this.setMetaContent('itemprop="image"', val);
|
|
67
|
-
this.setMetaContent('property="og:image"', val);
|
|
68
|
-
this.setMetaContent('name="twitter:image"', val);
|
|
69
|
-
},
|
|
70
|
-
lang(val) {
|
|
71
|
-
this.setRootElementAttributes("html", {lang: val});
|
|
72
|
-
this.ogLocaleTag && this.setOgLocaleIfValid(val);
|
|
73
|
-
},
|
|
74
|
-
ogLocale(val) {
|
|
75
|
-
this.setMetaContent('property="og:locale"', val);
|
|
76
|
-
},
|
|
77
|
-
url(val) {
|
|
78
|
-
this.setHeadElementAttributes('link[rel="canonical"]', {href: val});
|
|
79
|
-
this.setMetaContent('property="og:url"', val);
|
|
80
|
-
this.setMetaContent('name="twitter:url"', val);
|
|
81
|
-
},
|
|
82
|
-
createChild(parent, selector) {
|
|
83
|
-
if (!this.getElement(parent, selector)) {
|
|
84
|
-
let property = selector;
|
|
85
|
-
property = property.split("[");
|
|
86
|
-
const name = property[0];
|
|
87
|
-
property = this.$helper.replacer(property[1], "]", "");
|
|
88
|
-
property = this.$helper.replacer(property, '"', "");
|
|
89
|
-
property = this.$helper.replacer(property, "'", "");
|
|
90
|
-
property = property.trim(" ");
|
|
91
|
-
property = property.split("=");
|
|
92
|
-
let meta = document.createElement(name);
|
|
93
|
-
meta.setAttribute("c", "renusify");
|
|
94
|
-
meta.setAttribute(property[0], property[1]);
|
|
95
|
-
parent.appendChild(meta);
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
setMetaContent(attr, val) {
|
|
99
|
-
this.createChild(document.head, `meta[${attr}]`);
|
|
100
|
-
this.setHeadElementAttributes(`meta[${attr}]`, {content: val});
|
|
101
|
-
},
|
|
102
|
-
setRootElementAttributes(selector, attributes) {
|
|
103
|
-
this.createChild(document, selector);
|
|
104
|
-
this.setElementAttributes(
|
|
105
|
-
this.getElement(document, selector),
|
|
106
|
-
attributes
|
|
107
|
-
);
|
|
108
|
-
},
|
|
109
|
-
setHeadElementAttributes(selector, attributes) {
|
|
110
|
-
this.createChild(document.head, selector);
|
|
111
|
-
this.setElementAttributes(
|
|
112
|
-
this.getElement(document.head, selector),
|
|
113
|
-
attributes
|
|
114
|
-
);
|
|
115
|
-
},
|
|
116
|
-
setElementAttributes(element, attributes) {
|
|
117
|
-
if (element) {
|
|
118
|
-
Object.keys(attributes).forEach(attrName => {
|
|
119
|
-
if (this.isRemoveValue(attributes[attrName])) {
|
|
120
|
-
element.removeAttribute(attrName);
|
|
121
|
-
} else {
|
|
122
|
-
element.setAttribute(attrName, attributes[attrName]);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
getElement(parent, selector) {
|
|
128
|
-
return parent.querySelector(selector);
|
|
129
|
-
},
|
|
130
|
-
setOgLocaleIfValid(locale) {
|
|
131
|
-
if (this.isRemoveValue(locale)) {
|
|
132
|
-
this.ogLocale(locale);
|
|
133
|
-
} else if (locale.match(/^[a-z]{2}-[a-z]{2}$/i)) {
|
|
134
|
-
const [language, region] = locale.split("-");
|
|
135
|
-
const ogLocale = `${language}_${region.toUpperCase()}`;
|
|
136
|
-
this.ogLocale(ogLocale);
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
isRemoveValue(val) {
|
|
140
|
-
return val === undefined || val === null;
|
|
141
|
-
},
|
|
142
|
-
removeAll() {
|
|
143
|
-
let children = document.querySelectorAll("[c='renusify']");
|
|
144
|
-
if (children) {
|
|
145
|
-
let childArray = Array.prototype.slice.call(children);
|
|
146
|
-
|
|
147
|
-
childArray.forEach(function (child) {
|
|
148
|
-
child.parentNode.removeChild(child);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
render() {
|
|
154
|
-
}
|
|
155
|
-
};
|
|
1
|
+
export * as rMeta from './index.js'
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
//https://github.com/troxler/headful/blob/master/src/headful.js
|
|
2
|
+
export default {
|
|
3
|
+
name: "r-meta",
|
|
4
|
+
created(){
|
|
5
|
+
this.build()
|
|
6
|
+
},
|
|
7
|
+
watch: {
|
|
8
|
+
'$attrs': {
|
|
9
|
+
handler() {
|
|
10
|
+
this.build()
|
|
11
|
+
},
|
|
12
|
+
deep: true
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
activated() {
|
|
16
|
+
this.build()
|
|
17
|
+
},
|
|
18
|
+
deactivated() {
|
|
19
|
+
this.removeAll()
|
|
20
|
+
},
|
|
21
|
+
methods: {
|
|
22
|
+
build() {
|
|
23
|
+
for (let i in this.$attrs) {
|
|
24
|
+
if (this.$helper.hasKey(this.$attrs, i)) {
|
|
25
|
+
this[i](this.$attrs[i]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
html(obj) {
|
|
30
|
+
/*
|
|
31
|
+
:html="{
|
|
32
|
+
body: {id: 'aPageId'},
|
|
33
|
+
h1: {'data-foo': 'bar'},
|
|
34
|
+
}"
|
|
35
|
+
*/
|
|
36
|
+
Object.keys(obj).forEach(selector =>
|
|
37
|
+
this.setRootElementAttributes(selector, obj[selector])
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
head(obj) {
|
|
41
|
+
/*
|
|
42
|
+
:head="{
|
|
43
|
+
'meta[charset]': {charset: 'utf-8'},
|
|
44
|
+
}"
|
|
45
|
+
*/
|
|
46
|
+
Object.keys(obj).forEach(selector =>
|
|
47
|
+
this.setHeadElementAttributes(selector, obj[selector])
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
title(val) {
|
|
51
|
+
document.title = this.isRemoveValue(val) ? "" : val;
|
|
52
|
+
this.setMetaContent('itemprop="name"', val);
|
|
53
|
+
this.setMetaContent('property="og:title"', val);
|
|
54
|
+
this.setMetaContent('name="twitter:title"', val);
|
|
55
|
+
},
|
|
56
|
+
description(val) {
|
|
57
|
+
this.setMetaContent('name="description"', val);
|
|
58
|
+
this.setMetaContent('itemprop="description"', val);
|
|
59
|
+
this.setMetaContent('property="og:description"', val);
|
|
60
|
+
this.setMetaContent('name="twitter:description"', val);
|
|
61
|
+
},
|
|
62
|
+
keywords(val) {
|
|
63
|
+
this.setMetaContent('name="keywords"',val);
|
|
64
|
+
},
|
|
65
|
+
image(val) {
|
|
66
|
+
this.setMetaContent('itemprop="image"', val);
|
|
67
|
+
this.setMetaContent('property="og:image"', val);
|
|
68
|
+
this.setMetaContent('name="twitter:image"', val);
|
|
69
|
+
},
|
|
70
|
+
lang(val) {
|
|
71
|
+
this.setRootElementAttributes("html", {lang: val});
|
|
72
|
+
this.ogLocaleTag && this.setOgLocaleIfValid(val);
|
|
73
|
+
},
|
|
74
|
+
ogLocale(val) {
|
|
75
|
+
this.setMetaContent('property="og:locale"', val);
|
|
76
|
+
},
|
|
77
|
+
url(val) {
|
|
78
|
+
this.setHeadElementAttributes('link[rel="canonical"]', {href: val});
|
|
79
|
+
this.setMetaContent('property="og:url"', val);
|
|
80
|
+
this.setMetaContent('name="twitter:url"', val);
|
|
81
|
+
},
|
|
82
|
+
createChild(parent, selector) {
|
|
83
|
+
if (!this.getElement(parent, selector)) {
|
|
84
|
+
let property = selector;
|
|
85
|
+
property = property.split("[");
|
|
86
|
+
const name = property[0];
|
|
87
|
+
property = this.$helper.replacer(property[1], "]", "");
|
|
88
|
+
property = this.$helper.replacer(property, '"', "");
|
|
89
|
+
property = this.$helper.replacer(property, "'", "");
|
|
90
|
+
property = property.trim(" ");
|
|
91
|
+
property = property.split("=");
|
|
92
|
+
let meta = document.createElement(name);
|
|
93
|
+
meta.setAttribute("c", "renusify");
|
|
94
|
+
meta.setAttribute(property[0], property[1]);
|
|
95
|
+
parent.appendChild(meta);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
setMetaContent(attr, val) {
|
|
99
|
+
this.createChild(document.head, `meta[${attr}]`);
|
|
100
|
+
this.setHeadElementAttributes(`meta[${attr}]`, {content: val});
|
|
101
|
+
},
|
|
102
|
+
setRootElementAttributes(selector, attributes) {
|
|
103
|
+
this.createChild(document, selector);
|
|
104
|
+
this.setElementAttributes(
|
|
105
|
+
this.getElement(document, selector),
|
|
106
|
+
attributes
|
|
107
|
+
);
|
|
108
|
+
},
|
|
109
|
+
setHeadElementAttributes(selector, attributes) {
|
|
110
|
+
this.createChild(document.head, selector);
|
|
111
|
+
this.setElementAttributes(
|
|
112
|
+
this.getElement(document.head, selector),
|
|
113
|
+
attributes
|
|
114
|
+
);
|
|
115
|
+
},
|
|
116
|
+
setElementAttributes(element, attributes) {
|
|
117
|
+
if (element) {
|
|
118
|
+
Object.keys(attributes).forEach(attrName => {
|
|
119
|
+
if (this.isRemoveValue(attributes[attrName])) {
|
|
120
|
+
element.removeAttribute(attrName);
|
|
121
|
+
} else {
|
|
122
|
+
element.setAttribute(attrName, attributes[attrName]);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
getElement(parent, selector) {
|
|
128
|
+
return parent.querySelector(selector);
|
|
129
|
+
},
|
|
130
|
+
setOgLocaleIfValid(locale) {
|
|
131
|
+
if (this.isRemoveValue(locale)) {
|
|
132
|
+
this.ogLocale(locale);
|
|
133
|
+
} else if (locale.match(/^[a-z]{2}-[a-z]{2}$/i)) {
|
|
134
|
+
const [language, region] = locale.split("-");
|
|
135
|
+
const ogLocale = `${language}_${region.toUpperCase()}`;
|
|
136
|
+
this.ogLocale(ogLocale);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
isRemoveValue(val) {
|
|
140
|
+
return val === undefined || val === null;
|
|
141
|
+
},
|
|
142
|
+
removeAll() {
|
|
143
|
+
let children = document.querySelectorAll("[c='renusify']");
|
|
144
|
+
if (children) {
|
|
145
|
+
let childArray = Array.prototype.slice.call(children);
|
|
146
|
+
|
|
147
|
+
childArray.forEach(function (child) {
|
|
148
|
+
child.parentNode.removeChild(child);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
render() {
|
|
154
|
+
}
|
|
155
|
+
};
|
package/directive/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export * as touch from './touch/index'
|
|
|
12
12
|
export * as title from './title/index'
|
|
13
13
|
export * as skeleton from './skeleton/index'
|
|
14
14
|
|
|
15
|
-
export const
|
|
15
|
+
export const _registers = (app, directives) => {
|
|
16
16
|
for (const arrayKey in directives) {
|
|
17
17
|
app.directive(arrayKey,directives[arrayKey].default)
|
|
18
18
|
}
|
package/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import Notify from './components/notify/notify.js';
|
|
|
8
8
|
import valid from './plugins/validation/Validate';
|
|
9
9
|
import Toast from './components/app/toast/toast.js';
|
|
10
10
|
import event from './plugins/event';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import {_register} from './components';
|
|
12
|
+
import {_registers} from './directive';
|
|
13
13
|
import {Icons} from "./tools/icons";
|
|
14
14
|
|
|
15
15
|
window.renusifyBus = event;
|
|
@@ -123,16 +123,12 @@ export default {
|
|
|
123
123
|
app.config.globalProperties.$v = (names) => v.checkType(names)
|
|
124
124
|
|
|
125
125
|
// install components
|
|
126
|
-
let required_directive =
|
|
126
|
+
let required_directive = _register(app, options['components'] || {});
|
|
127
127
|
if (options['directives']) {
|
|
128
|
-
options['directives']
|
|
129
|
-
if (!required_directive.includes(i)) {
|
|
130
|
-
required_directive.push(i)
|
|
131
|
-
}
|
|
132
|
-
})
|
|
128
|
+
Object.assign(required_directive,options['directives'])
|
|
133
129
|
}
|
|
134
130
|
// install directives
|
|
135
|
-
|
|
131
|
+
_registers(app, required_directive);
|
|
136
132
|
|
|
137
133
|
|
|
138
134
|
// renusify breakpoint
|