layers-design-system 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/main.js +71 -50
package/package.json
CHANGED
package/src/main.js
CHANGED
|
@@ -1,80 +1,101 @@
|
|
|
1
|
-
import lang from
|
|
2
|
-
import locale from
|
|
3
|
-
import
|
|
4
|
-
import dayjs from
|
|
5
|
-
import localizedFormatPlugin from
|
|
1
|
+
import lang from "element-ui/lib/locale/lang/pt-br";
|
|
2
|
+
import locale from "element-ui/lib/locale";
|
|
3
|
+
import "dayjs/locale/pt-br";
|
|
4
|
+
import dayjs from "dayjs";
|
|
5
|
+
import localizedFormatPlugin from "dayjs/plugin/localizedFormat";
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import Colors from
|
|
9
|
-
import Icons from
|
|
10
|
-
import Schemas from
|
|
11
|
-
import Notification from
|
|
12
|
-
import FieldTypeComponents from
|
|
13
|
-
import RegisterElementUIComponents from
|
|
7
|
+
import "./style/main.scss";
|
|
8
|
+
import Colors from "./helpers/Colors";
|
|
9
|
+
import Icons from "./helpers/Icons";
|
|
10
|
+
import Schemas from "./helpers/Schemas";
|
|
11
|
+
import Notification from "./helpers/Notification";
|
|
12
|
+
import FieldTypeComponents from "./helpers/FieldTypeComponents";
|
|
13
|
+
import RegisterElementUIComponents from "./helpers/RegisterElementUIComponents";
|
|
14
14
|
|
|
15
15
|
// Vant
|
|
16
|
-
import Vant from
|
|
17
|
-
import
|
|
16
|
+
import Vant from "vant";
|
|
17
|
+
import "vant/lib/index.css";
|
|
18
18
|
// Zoomer
|
|
19
|
-
import VueZoomer from
|
|
19
|
+
import VueZoomer from "vue-zoomer";
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
function hasRequire() {
|
|
22
|
+
try {
|
|
23
|
+
void require.context;
|
|
24
|
+
return true;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const LayersDesignSystem = {};
|
|
31
|
+
LayersDesignSystem.install = function (Vue) {
|
|
32
|
+
Vue.prototype.$L = {};
|
|
24
33
|
|
|
25
|
-
Vue.use(Vant)
|
|
26
|
-
Vue.use(VueZoomer)
|
|
27
|
-
Vue.use(Colors)
|
|
28
|
-
Vue.use(Icons)
|
|
29
|
-
Vue.use(Schemas)
|
|
30
|
-
Vue.use(FieldTypeComponents)
|
|
31
|
-
Vue.use(RegisterElementUIComponents)
|
|
34
|
+
Vue.use(Vant);
|
|
35
|
+
Vue.use(VueZoomer);
|
|
36
|
+
Vue.use(Colors);
|
|
37
|
+
Vue.use(Icons);
|
|
38
|
+
Vue.use(Schemas);
|
|
39
|
+
Vue.use(FieldTypeComponents);
|
|
40
|
+
Vue.use(RegisterElementUIComponents);
|
|
32
41
|
|
|
33
|
-
locale.use(lang)
|
|
34
|
-
dayjs.extend(localizedFormatPlugin)
|
|
42
|
+
locale.use(lang);
|
|
43
|
+
dayjs.extend(localizedFormatPlugin);
|
|
35
44
|
|
|
36
45
|
Vue.mixin({
|
|
37
46
|
mounted() {
|
|
38
|
-
this.__layers_addClassName()
|
|
47
|
+
this.__layers_addClassName();
|
|
39
48
|
},
|
|
40
49
|
updated() {
|
|
41
|
-
this.__layers_addClassName()
|
|
50
|
+
this.__layers_addClassName();
|
|
42
51
|
},
|
|
43
52
|
methods: {
|
|
44
53
|
__layers_addClassName() {
|
|
45
54
|
if (!this.__layers_addedClassName) {
|
|
46
|
-
const tagName = this.$options.tagName ||
|
|
55
|
+
const tagName = this.$options.tagName || "";
|
|
47
56
|
if (/^l-/.test(tagName) && this.$el.classList) {
|
|
48
|
-
this.$el.classList.add(tagName)
|
|
57
|
+
this.$el.classList.add(tagName);
|
|
49
58
|
}
|
|
50
|
-
// this.__layers_addedClassName = true
|
|
51
59
|
}
|
|
52
60
|
},
|
|
53
61
|
},
|
|
54
|
-
})
|
|
62
|
+
});
|
|
55
63
|
|
|
56
|
-
Vue.prototype.$notify = function(params) {
|
|
57
|
-
const isClickable = params.onClick && params.onClick instanceof Function
|
|
64
|
+
Vue.prototype.$notify = function (params) {
|
|
65
|
+
const isClickable = params.onClick && params.onClick instanceof Function;
|
|
58
66
|
const customClasses = [
|
|
59
67
|
params.customClass,
|
|
60
68
|
params.type,
|
|
61
|
-
!params.customClass && !params.type &&
|
|
62
|
-
isClickable &&
|
|
63
|
-
]
|
|
69
|
+
!params.customClass && !params.type && "default",
|
|
70
|
+
isClickable && "cursor-pointer",
|
|
71
|
+
];
|
|
64
72
|
|
|
65
73
|
return Notification({
|
|
66
74
|
...params,
|
|
67
|
-
customClass: customClasses.filter((customClass) => customClass).join(
|
|
68
|
-
})
|
|
69
|
-
}
|
|
75
|
+
customClass: customClasses.filter((customClass) => customClass).join(" "),
|
|
76
|
+
});
|
|
77
|
+
};
|
|
70
78
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
if (hasRequire()) {
|
|
80
|
+
const requireComponent = require.context(
|
|
81
|
+
"./components",
|
|
82
|
+
true,
|
|
83
|
+
/index.vue$/
|
|
84
|
+
);
|
|
85
|
+
requireComponent.keys().forEach((path) => {
|
|
86
|
+
const component = requireComponent(path).default;
|
|
87
|
+
if (!component.tagName) throw new Error(`Missing tagName for ${path}`);
|
|
88
|
+
Vue.component(component.tagName, component);
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
const components = import.meta.glob("./components/**/index.vue", {
|
|
92
|
+
eager: true,
|
|
93
|
+
});
|
|
94
|
+
for (const componentModule of Object.values(components)) {
|
|
95
|
+
Vue.component(componentModule.default.tagName, componentModule.default);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
78
99
|
|
|
79
|
-
export { Notification }
|
|
80
|
-
export default LayersDesignSystem
|
|
100
|
+
export { Notification };
|
|
101
|
+
export default LayersDesignSystem;
|