@ldmjs/ui 1.0.0-dev-1 → 1.0.0-dev-3
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/README.md +33 -1
- package/config/rules.js +51 -0
- package/config/webpack.config.build.js +23 -31
- package/config/webpack.config.dev.js +3 -31
- package/dist/css/index.css +86 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +967 -0
- package/dist/scss/_colors.scss +73 -0
- package/dist/scss/_variables.scss +5 -0
- package/dist/scss/index.scss +2 -0
- package/dist/utils.d.ts +4 -0
- package/main.ts +25 -3
- package/package.json +15 -11
- package/src/app.vue +4 -1
- package/src/css/index.css +86 -0
- package/src/index.d.ts +1 -0
- package/src/index.ts +18 -29
- package/src/ld-icon/icons.md +1 -1
- package/src/ld-icon/index.ts +35 -0
- package/src/ld-loader/index.ts +8 -0
- package/src/ld-loader/ld-loader.ts +123 -0
- package/src/ld-loader/ld-loader.vue +133 -0
- package/src/scss/_colors.scss +73 -0
- package/src/scss/_variables.scss +5 -0
- package/src/scss/index.scss +2 -0
- package/src/utils/isDefined.ts +5 -0
- package/src/utils/zIndex.ts +11 -0
- package/src/utils.d.ts +4 -0
- package/dist/main.umd.js +0 -311
- package/dist/main.umd.js.LICENSE.txt +0 -13
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
$colors: ('primary', 'secondary', 'success', 'warning', 'error', 'grey', 'dark', 'white');
|
|
2
|
+
|
|
3
|
+
body,
|
|
4
|
+
.v-application {
|
|
5
|
+
@each $color in $colors {
|
|
6
|
+
& .#{$color} {
|
|
7
|
+
background-color: var(--#{$color}) !important;
|
|
8
|
+
border-color: var(--#{$color}) !important;
|
|
9
|
+
}
|
|
10
|
+
& .#{$color}--text, & .text-#{$color} {
|
|
11
|
+
@if $color == 'primary' {
|
|
12
|
+
color: var(--#{$color}-l-2) !important;
|
|
13
|
+
} @else {
|
|
14
|
+
color: var(--#{$color}) !important;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
& .#{$color}--bg, & .bg-#{$color} {
|
|
18
|
+
@if $color == 'primary' {
|
|
19
|
+
background-color: var(--#{$color}-l-8) !important;
|
|
20
|
+
} @else if $color == 'grey' {
|
|
21
|
+
background-color: var(--#{$color}-l-6) !important;
|
|
22
|
+
} @else if $color == 'secondary' {
|
|
23
|
+
background-color: var(--#{$color}-l-5) !important;
|
|
24
|
+
} @else {
|
|
25
|
+
background-color: var(--#{$color}) !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
& .#{$color}--border, & .border-#{$color} {
|
|
29
|
+
@if $color == 'primary' {
|
|
30
|
+
border-color: var(--#{$color}-l-2) !important;
|
|
31
|
+
} @else if $color == 'grey' {
|
|
32
|
+
border-color: var(--#{$color}-l-5) !important;
|
|
33
|
+
} @else {
|
|
34
|
+
border-color: var(--#{$color}) !important;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
& .#{$color}--hover {
|
|
38
|
+
transition: background 0.1s;
|
|
39
|
+
@if $color == 'grey' {
|
|
40
|
+
&:hover {
|
|
41
|
+
background-color: var(--#{$color}-l-6) !important;
|
|
42
|
+
}
|
|
43
|
+
} @else if $color == 'secondary' {
|
|
44
|
+
&:hover {
|
|
45
|
+
background-color: var(--#{$color}-l-5) !important;
|
|
46
|
+
}
|
|
47
|
+
} @else {
|
|
48
|
+
&:hover {
|
|
49
|
+
background-color: var(--#{$color}) !important;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
& .text-color {
|
|
56
|
+
color: var(--text);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
& .label-color {
|
|
60
|
+
color: var(--label);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.main-gradient-h {
|
|
65
|
+
background: var(--primary);
|
|
66
|
+
background: linear-gradient(90deg, var(--primary) 0%, var(--primary-d-1) 100%);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.main-gradient-v {
|
|
70
|
+
background: var(--primary);
|
|
71
|
+
background: linear-gradient(180deg, var(--primary) 0%, var(--primary-d-1) 100%);
|
|
72
|
+
}
|
|
73
|
+
|
package/dist/utils.d.ts
ADDED
package/main.ts
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
|
+
import '@/css';
|
|
2
|
+
import '@/scss';
|
|
3
|
+
|
|
1
4
|
import { createApp } from 'vue';
|
|
2
5
|
import App from './src/app.vue';
|
|
3
6
|
import ldmui from './src/index';
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
async function start() {
|
|
9
|
+
const appComponent = createApp(App);
|
|
10
|
+
const promise = new Promise(resolve => {
|
|
11
|
+
fetch('/icons.json')
|
|
12
|
+
.then(res => res.json())
|
|
13
|
+
.then(data => {
|
|
14
|
+
appComponent.use(ldmui, {
|
|
15
|
+
LdIcon: {
|
|
16
|
+
path: 'icons',
|
|
17
|
+
map: data
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return resolve(true)
|
|
21
|
+
})
|
|
22
|
+
.catch(e => {
|
|
23
|
+
//
|
|
24
|
+
})
|
|
25
|
+
})
|
|
6
26
|
|
|
7
|
-
|
|
27
|
+
await promise;
|
|
8
28
|
|
|
9
|
-
appComponent.mount('#app');
|
|
29
|
+
appComponent.mount('#app');
|
|
30
|
+
}
|
|
10
31
|
|
|
32
|
+
start()
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldmjs/ui",
|
|
3
|
-
"version": "1.0.0-dev-
|
|
3
|
+
"version": "1.0.0-dev-3",
|
|
4
4
|
"description": "ldm ui",
|
|
5
|
-
"main": "dist/
|
|
5
|
+
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "webpack serve --config config/webpack.config.dev.js --progress --profile",
|
|
8
8
|
"build": "webpack --config config/webpack.config.build.js --stats-error-details"
|
|
@@ -21,24 +21,28 @@
|
|
|
21
21
|
"url": "https://github.com/ldmjs/ui/issues"
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/ldmjs/ui#readme",
|
|
24
|
-
"
|
|
24
|
+
"devDependencies": {
|
|
25
25
|
"@typescript-eslint/eslint-plugin": "5.41.0",
|
|
26
26
|
"@typescript-eslint/parser": "5.41.0",
|
|
27
|
-
"terser-webpack-plugin": "5.3.10",
|
|
28
|
-
"typescript": "4.9.5",
|
|
29
|
-
"vue": "3.4.21",
|
|
30
|
-
"vue-loader": "17.3.1",
|
|
31
|
-
"webpack": "5.90.2",
|
|
32
|
-
"webpack-cli": "5.1.4"
|
|
33
|
-
},
|
|
34
|
-
"devDependencies": {
|
|
35
27
|
"@types/eslint": "^8",
|
|
36
28
|
"copy-webpack-plugin": "^12.0.2",
|
|
29
|
+
"css-loader": "6.8.1",
|
|
37
30
|
"eslint": "8.56.0",
|
|
38
31
|
"html-webpack-plugin": "5.6.0",
|
|
32
|
+
"node-sass": "9.0.0",
|
|
33
|
+
"postcss-loader": "7.3.3",
|
|
34
|
+
"sass": "1.69.5",
|
|
35
|
+
"sass-loader": "13.3.2",
|
|
36
|
+
"style-loader": "3.3.3",
|
|
37
|
+
"terser-webpack-plugin": "5.3.10",
|
|
39
38
|
"ts-loader": "9.5.1",
|
|
39
|
+
"typescript": "4.9.5",
|
|
40
|
+
"vue": "3.4.21",
|
|
40
41
|
"vue-class-component": "8.0.0-rc.1",
|
|
42
|
+
"vue-loader": "17.3.1",
|
|
41
43
|
"vue-property-decorator": "10.0.0-rc.3",
|
|
44
|
+
"webpack": "5.90.2",
|
|
45
|
+
"webpack-cli": "5.1.4",
|
|
42
46
|
"webpack-dev-server": "4.15.1"
|
|
43
47
|
}
|
|
44
48
|
}
|
package/src/app.vue
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<ld-icon>user</ld-icon>
|
|
3
|
+
<ld-icon color="primary">user</ld-icon>
|
|
4
|
+
<div style="position: relative; width: 100%; height: 65px;">
|
|
5
|
+
<loader :options="{ transparent: true, global: false }" :visible="true" />
|
|
6
|
+
</div>
|
|
4
7
|
</div>
|
|
5
8
|
</template>
|
|
6
9
|
<script>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--primary-d-1: hsla(210, 100%, 18%, 100%);
|
|
3
|
+
--primary: hsla(210, 100%, 26%, 100%);
|
|
4
|
+
--primary-l-1: hsla(210, 100%, 34%, 100%);
|
|
5
|
+
--primary-l-2: hsla(210, 100%, 42%, 100%);
|
|
6
|
+
--primary-l-3: hsla(210, 100%, 50%, 100%);
|
|
7
|
+
--primary-l-4: hsla(210, 100%, 58%, 100%);
|
|
8
|
+
--primary-l-5: hsla(210, 100%, 66%, 100%);
|
|
9
|
+
--primary-l-6: hsla(210, 100%, 74%, 100%);
|
|
10
|
+
--primary-l-7: hsla(210, 100%, 82%, 100%);
|
|
11
|
+
--primary-l-8: hsla(210, 100%, 90%, 100%);
|
|
12
|
+
|
|
13
|
+
--dark: hsla(219, 83%, 14%, 100%);
|
|
14
|
+
--dark-l-1-09: hsla(219, 83%, 14%, 90%);
|
|
15
|
+
--dark-l-2-08: hsla(219, 83%, 14%, 80%);
|
|
16
|
+
--dark-l-3-07: hsla(219, 83%, 14%, 70%);
|
|
17
|
+
--dark-l-4-06: hsla(219, 83%, 14%, 60%);
|
|
18
|
+
--dark-l-5-05: hsla(219, 83%, 14%, 50%);
|
|
19
|
+
--dark-l-6-04: hsla(219, 83%, 14%, 40%);
|
|
20
|
+
--dark-l-7-03: hsla(219, 83%, 14%, 30%);
|
|
21
|
+
--dark-l-8-02: hsla(219, 83%, 14%, 20%);
|
|
22
|
+
--dark-l-9-01: hsla(219, 83%, 14%, 10%);
|
|
23
|
+
|
|
24
|
+
--secondary-d-4: hsla(204, 100%, 18%, 100%);
|
|
25
|
+
--secondary-d-3: hsla(204, 100%, 26%, 100%);
|
|
26
|
+
--secondary-d-2: hsla(204, 100%, 34%, 100%);
|
|
27
|
+
--secondary-d-1: hsla(204, 100%, 42%, 100%);
|
|
28
|
+
--secondary: hsla(204, 100%, 50%, 100%);
|
|
29
|
+
--secondary-l-1: hsla(204, 100%, 58%, 100%);
|
|
30
|
+
--secondary-l-2: hsla(204, 100%, 66%, 100%);
|
|
31
|
+
--secondary-l-3: hsla(204, 100%, 74%, 100%);
|
|
32
|
+
--secondary-l-4: hsla(204, 100%, 82%, 100%);
|
|
33
|
+
--secondary-l-5: hsla(204, 100%, 90%, 100%);
|
|
34
|
+
|
|
35
|
+
--success-d-3: hsla(135, 59%, 17%, 100%);
|
|
36
|
+
--success-d-2: hsla(135, 59%, 25%, 100%);
|
|
37
|
+
--success-d-1: hsla(135, 59%, 33%, 100%);
|
|
38
|
+
--success: hsla(135, 59%, 41%, 100%);
|
|
39
|
+
--success-l-1: hsla(135, 59%, 49%, 100%);
|
|
40
|
+
--success-l-2: hsla(135, 59%, 57%, 100%);
|
|
41
|
+
--success-l-3: hsla(135, 59%, 65%, 100%);
|
|
42
|
+
--success-l-4: hsla(135, 59%, 73%, 100%);
|
|
43
|
+
--success-l-5: hsla(135, 59%, 81%, 100%);
|
|
44
|
+
--success-l-6: hsla(135, 59%, 89%, 100%);
|
|
45
|
+
|
|
46
|
+
--error-d-3: hsla(7, 82%, 18%, 100%);
|
|
47
|
+
--error-d-2: hsla(7, 82%, 26%, 100%);
|
|
48
|
+
--error-d-1: hsla(7, 82%, 34%, 100%);
|
|
49
|
+
--error: hsla(7, 82%, 42%, 100%);
|
|
50
|
+
--error-l-1: hsla(7, 82%, 50%, 100%);
|
|
51
|
+
--error-l-2: hsla(7, 82%, 58%, 100%);
|
|
52
|
+
--error-l-3: hsla(7, 82%, 66%, 100%);
|
|
53
|
+
--error-l-4: hsla(7, 82%, 74%, 100%);
|
|
54
|
+
--error-l-5: hsla(7, 82%, 82%, 100%);
|
|
55
|
+
--error-l-6: hsla(7, 82%, 90%, 100%);
|
|
56
|
+
|
|
57
|
+
--warning-d-4: hsla(24, 100%, 18%, 100%);
|
|
58
|
+
--warning-d-3: hsla(24, 100%, 26%, 100%);
|
|
59
|
+
--warning-d-2: hsla(24, 100%, 34%, 100%);
|
|
60
|
+
--warning-d-1: hsla(24, 100%, 42%, 100%);
|
|
61
|
+
--warning: hsla(24, 100%, 50%, 100%);
|
|
62
|
+
--warning-l-1: hsla(24, 100%, 58%, 100%);
|
|
63
|
+
--warning-l-2: hsla(24, 100%, 66%, 100%);
|
|
64
|
+
--warning-l-3: hsla(24, 100%, 74%, 100%);
|
|
65
|
+
--warning-l-4: hsla(24, 100%, 82%, 100%);
|
|
66
|
+
--warning-l-5: hsla(24, 100%, 90%, 100%);
|
|
67
|
+
|
|
68
|
+
--grey-d-3: hsla(0, 0%, 14%, 100%);
|
|
69
|
+
--grey-d-2: hsla(0, 0%, 23%, 100%);
|
|
70
|
+
--grey-d-1: hsla(0, 0%, 32%, 100%);
|
|
71
|
+
--grey: hsla(0, 0%, 41%, 100%);
|
|
72
|
+
--grey-l-1: hsla(0, 0%, 50%, 100%);
|
|
73
|
+
--grey-l-2: hsla(0, 0%, 59%, 100%);
|
|
74
|
+
--grey-l-3: hsla(0, 0%, 68%, 100%);
|
|
75
|
+
--grey-l-4: hsla(0, 0%, 77%, 100%);
|
|
76
|
+
--grey-l-5: hsla(0, 0%, 86%, 100%);
|
|
77
|
+
--grey-l-6: hsla(0, 0%, 95%, 100%);
|
|
78
|
+
|
|
79
|
+
--black: hsla(0, 0%, 0%, 100%);
|
|
80
|
+
|
|
81
|
+
--white: hsla(0, 0%, 100%, 100%);
|
|
82
|
+
|
|
83
|
+
--text: hsla(0, 0%, 13%, 100%);
|
|
84
|
+
|
|
85
|
+
--label: hsla(0, 0%, 47%, 100%);
|
|
86
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '@ldmjs/ui'
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { App
|
|
2
|
-
import
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import ldiconReg from './ld-icon';
|
|
3
|
+
import ldLoaderReg from './ld-loader';
|
|
4
|
+
|
|
5
|
+
import { isDefined } from '@/utils/isDefined';
|
|
6
|
+
import { getZIndex } from '@/utils/zIndex';
|
|
3
7
|
|
|
4
8
|
const ldmuiPlugin = {
|
|
5
9
|
install(vue: App, options?: {
|
|
@@ -10,36 +14,21 @@ const ldmuiPlugin = {
|
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
map: {
|
|
20
|
-
default: options?.LdIcon?.map ?? { icons: [] }
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
vue.component('ld-icon', ldicon);
|
|
24
|
-
return;
|
|
17
|
+
ldiconReg(vue, options?.LdIcon)
|
|
18
|
+
ldLoaderReg(vue)
|
|
19
|
+
|
|
20
|
+
vue.config.globalProperties.$utils = {
|
|
21
|
+
isDefined
|
|
25
22
|
}
|
|
26
|
-
let cmp: any = defineComponent(ldicon);
|
|
27
|
-
cmp = cmp.setup.__vccOpts;
|
|
28
|
-
cmp = {
|
|
29
|
-
...cmp,
|
|
30
|
-
props: {
|
|
31
|
-
...cmp.props,
|
|
32
|
-
path: {
|
|
33
|
-
default: options.LdIcon.path
|
|
34
|
-
},
|
|
35
|
-
map: {
|
|
36
|
-
default: options.LdIcon.map
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
vue.component('ld-icon', defineComponent(cmp));
|
|
41
23
|
},
|
|
42
24
|
};
|
|
43
25
|
|
|
44
26
|
export default ldmuiPlugin;
|
|
45
27
|
|
|
28
|
+
export {
|
|
29
|
+
isDefined,
|
|
30
|
+
getZIndex
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
package/src/ld-icon/icons.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
Все иконки можно посмотреть, открыв страничку по адресу:
|
|
2
|
-
localhost:
|
|
2
|
+
localhost:4000/assets/icons/icons.html
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { App, defineComponent } from 'vue';
|
|
2
|
+
import ldicon from '@/ld-icon/ld-icon.vue';
|
|
3
|
+
|
|
4
|
+
function reg(vue: App, options?: { path: string; map: { icons: Array<[string, string]> } }) {
|
|
5
|
+
if ($DEV) {
|
|
6
|
+
ldicon.props = {
|
|
7
|
+
...ldicon.props,
|
|
8
|
+
path: {
|
|
9
|
+
default: options?.path ?? 'icons',
|
|
10
|
+
},
|
|
11
|
+
map: {
|
|
12
|
+
default: options?.map ?? { icons: [] }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
vue.component('ld-icon', ldicon);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let cmp: any = defineComponent(ldicon);
|
|
19
|
+
cmp = cmp.setup.__vccOpts;
|
|
20
|
+
cmp = {
|
|
21
|
+
...cmp,
|
|
22
|
+
props: {
|
|
23
|
+
...cmp.props,
|
|
24
|
+
path: {
|
|
25
|
+
default: options?.path ?? 'icons',
|
|
26
|
+
},
|
|
27
|
+
map: {
|
|
28
|
+
default: options?.map ?? { icons: [] }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
vue.component('ld-icon', defineComponent(cmp));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default reg;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { isDefined } from '@/utils/isDefined';
|
|
2
|
+
import { getZIndex } from '@/utils/zIndex';
|
|
3
|
+
import { Prop, Vue } from 'vue-property-decorator';
|
|
4
|
+
|
|
5
|
+
enum LoaderType {
|
|
6
|
+
SandGlass = 0,
|
|
7
|
+
Clock = 1,
|
|
8
|
+
Circle = 2,
|
|
9
|
+
Css = 3,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface ILoaderOptions {
|
|
13
|
+
type?: LoaderType;
|
|
14
|
+
transparent: boolean;
|
|
15
|
+
global: boolean;
|
|
16
|
+
size?: 'small' | 'big';
|
|
17
|
+
color?: 'primary' | 'white';
|
|
18
|
+
relative?: boolean;
|
|
19
|
+
bg?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default class Loader extends Vue {
|
|
23
|
+
@Prop({ type: Object, default: { size: 'big', bg: true } }) options: ILoaderOptions;
|
|
24
|
+
@Prop({ type: Boolean, default: 'false' }) visible: boolean;
|
|
25
|
+
@Prop({
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'circle',
|
|
28
|
+
validator: value => ['sand', 'circle', 'clock', 'css'].includes(value as string),
|
|
29
|
+
})
|
|
30
|
+
indicator: string;
|
|
31
|
+
@Prop({ type: String, default: '' }) css: string;
|
|
32
|
+
|
|
33
|
+
created() {
|
|
34
|
+
if (!this.options.size) {
|
|
35
|
+
this.options.size = 'big';
|
|
36
|
+
}
|
|
37
|
+
if (this.indicator) {
|
|
38
|
+
switch (this.indicator) {
|
|
39
|
+
case 'circle':
|
|
40
|
+
this.options.type = LoaderType.Circle;
|
|
41
|
+
break;
|
|
42
|
+
case 'sand':
|
|
43
|
+
this.options.type = LoaderType.SandGlass;
|
|
44
|
+
break;
|
|
45
|
+
case 'clock':
|
|
46
|
+
this.options.type = LoaderType.Clock;
|
|
47
|
+
break;
|
|
48
|
+
case 'css':
|
|
49
|
+
this.options.type = LoaderType.Css;
|
|
50
|
+
break;
|
|
51
|
+
default:
|
|
52
|
+
this.options.type = LoaderType.SandGlass;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get isSandGlass() {
|
|
59
|
+
return this.indicator === 'sand' || this.options.type === LoaderType.SandGlass;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get isCircle() {
|
|
63
|
+
return this.indicator === 'circle' || this.options.type === LoaderType.Circle;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
get isCssClass() {
|
|
67
|
+
return this.indicator === 'css' || this.options.type === LoaderType.Css;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get imgClass() {
|
|
71
|
+
return this.css;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
get isTransparent() {
|
|
75
|
+
return this.options.transparent;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
get noBackground() {
|
|
79
|
+
return isDefined(this.options.bg) && !this.options.bg;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
get isGlobal() {
|
|
83
|
+
return Boolean(this.options.global);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get styles() {
|
|
87
|
+
return {
|
|
88
|
+
'z-index': getZIndex(this.$parent.$el) + 2,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
get size() {
|
|
93
|
+
return this.options?.size ?? 'big';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
get color() {
|
|
97
|
+
return this.options?.color ?? 'primary';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
get isRelative() {
|
|
101
|
+
return this.options?.relative;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get cssClasses(): string[] {
|
|
105
|
+
const classes = [];
|
|
106
|
+
if (!this.isTransparent) {
|
|
107
|
+
classes.push('loader__white-bg');
|
|
108
|
+
}
|
|
109
|
+
if (this.isGlobal) {
|
|
110
|
+
classes.push('loading-mask-global');
|
|
111
|
+
}
|
|
112
|
+
if (this.isRelative) {
|
|
113
|
+
classes.push('loader__relative');
|
|
114
|
+
} else {
|
|
115
|
+
classes.push('loading-mask');
|
|
116
|
+
}
|
|
117
|
+
if (this.noBackground) {
|
|
118
|
+
classes.push('loader__transparent');
|
|
119
|
+
}
|
|
120
|
+
classes.push(`loader__color-${this.color}`);
|
|
121
|
+
return classes;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="visible" class="loader" :class="cssClasses" :style="styles">
|
|
3
|
+
<i v-if="isSandGlass" class="fa fa-spin fa-hourglass-o fa-3x fa-fw loader__icon"></i>
|
|
4
|
+
<div v-else-if="isCircle" class="circle" :class="size"></div>
|
|
5
|
+
<div v-else-if="isCssClass" :class="imgClass"></div>
|
|
6
|
+
<i v-else class="fa fa-clock-o fa-3x fa-fw loader__icon loader__icon-gray"></i>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
<script src="./ld-loader.ts" lang="ts"></script>
|
|
10
|
+
<style lang="scss" scoped>
|
|
11
|
+
.loader {
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
top: 0px;
|
|
15
|
+
left: 0px;
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
transition: opacity 0.15s linear;
|
|
21
|
+
|
|
22
|
+
&__icon {
|
|
23
|
+
vertical-align: middle;
|
|
24
|
+
height: 48px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__icon-gray {
|
|
28
|
+
color: var(--grey-l-5);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
$small: calc(var(--font-size) + 4px);
|
|
32
|
+
$normal: calc(var(--font-size) * 2);
|
|
33
|
+
$big: calc(var(--font-size) * 3);
|
|
34
|
+
|
|
35
|
+
.circle.small {
|
|
36
|
+
width: $small;
|
|
37
|
+
height: $small;
|
|
38
|
+
border-width: 3px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.circle.big {
|
|
42
|
+
width: $big;
|
|
43
|
+
height: $big;
|
|
44
|
+
border-width: 3px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.circle {
|
|
48
|
+
animation: rotating 0.7s linear infinite;
|
|
49
|
+
width: $normal;
|
|
50
|
+
height: $normal;
|
|
51
|
+
border-radius: 50%;
|
|
52
|
+
border: 2px solid transparent;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.loader__color-primary {
|
|
56
|
+
&:not(.loader__transparent) {
|
|
57
|
+
background: rgba(255, 255, 255, 0.5);
|
|
58
|
+
}
|
|
59
|
+
.circle {
|
|
60
|
+
border-right-color: var(--primary);
|
|
61
|
+
border-bottom-color: var(--primary);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
&.loader__color-white {
|
|
65
|
+
background: none;
|
|
66
|
+
.circle {
|
|
67
|
+
border-right-color: var(--white);
|
|
68
|
+
border-bottom-color: var(--white);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
&.loader__white-bg {
|
|
72
|
+
&:not(.loader__transparent) {
|
|
73
|
+
background: rgba(255, 255, 255, 1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.loading-mask-global {
|
|
79
|
+
position: fixed !important;
|
|
80
|
+
width: 100vw !important;
|
|
81
|
+
height: 100vh !important;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.loading-mask {
|
|
85
|
+
position: absolute;
|
|
86
|
+
-webkit-backface-visibility: hidden;
|
|
87
|
+
backface-visibility: hidden;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.loader__relative {
|
|
91
|
+
position: relative;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@-moz-keyframes rotating {
|
|
95
|
+
0% {
|
|
96
|
+
transform: rotate(0);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
100% {
|
|
100
|
+
transform: rotate(360deg);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@-webkit-keyframes rotating {
|
|
105
|
+
0% {
|
|
106
|
+
transform: rotate(0);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
100% {
|
|
110
|
+
transform: rotate(360deg);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@-o-keyframes rotating {
|
|
115
|
+
0% {
|
|
116
|
+
transform: rotate(0);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
100% {
|
|
120
|
+
transform: rotate(360deg);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@keyframes rotating {
|
|
125
|
+
0% {
|
|
126
|
+
transform: rotate(0);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
100% {
|
|
130
|
+
transform: rotate(360deg);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</style>
|