@community-release/nx-ui 0.0.6 → 0.0.7
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/dist/module.d.mts +7 -0
- package/dist/module.d.ts +7 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +230 -9
- package/dist/runtime/components/accordion.vue +221 -0
- package/dist/runtime/components/animated-number/animateValue.d.ts +13 -0
- package/dist/runtime/components/animated-number/animateValue.mjs +56 -0
- package/dist/runtime/components/animated-number/index.vue +43 -0
- package/dist/runtime/components/button/index.vue +360 -0
- package/dist/runtime/components/button/index.vue.d.ts +81 -0
- package/dist/runtime/components/button/props.json +6 -0
- package/dist/runtime/components/card.vue +138 -0
- package/dist/runtime/components/checkbox.vue +227 -0
- package/dist/runtime/components/countdown/index.vue +64 -0
- package/dist/runtime/components/countdown/props.json +6 -0
- package/dist/runtime/components/filter/index.vue +140 -0
- package/dist/runtime/components/filter/props.json +4 -0
- package/dist/runtime/components/grid.vue +169 -0
- package/dist/runtime/components/grid.vue.d.ts +56 -0
- package/dist/runtime/components/helpers/Countdown.d.ts +0 -0
- package/dist/runtime/components/helpers/Countdown.mjs +143 -0
- package/dist/runtime/components/helpers/getEventCoord.d.ts +7 -0
- package/dist/runtime/components/helpers/getEventCoord.mjs +16 -0
- package/dist/runtime/components/helpers/isImageExist.d.ts +6 -0
- package/dist/runtime/components/helpers/isImageExist.mjs +20 -0
- package/dist/runtime/components/helpers/isMobileDevice.d.ts +5 -0
- package/dist/runtime/components/helpers/isMobileDevice.mjs +12 -0
- package/dist/runtime/components/helpers/isWebKit.d.ts +5 -0
- package/dist/runtime/components/helpers/isWebKit.mjs +12 -0
- package/dist/runtime/components/helpers/uniq.d.ts +2 -0
- package/dist/runtime/components/helpers/uniq.mjs +1 -0
- package/dist/runtime/components/icons/check.svg +1 -0
- package/dist/runtime/components/icons/check.white.svg +1 -0
- package/dist/runtime/components/impulse-indicator.vue +139 -0
- package/dist/runtime/components/impulse-indicator.vue.d.ts +21 -0
- package/dist/runtime/components/input/index.vue +241 -0
- package/dist/runtime/components/input/props.json +5 -0
- package/dist/runtime/components/label.vue +33 -0
- package/dist/runtime/components/loading.vue +91 -0
- package/dist/runtime/components/map/device-zoom-switch.vue +160 -0
- package/dist/runtime/components/map/index.vue +135 -0
- package/dist/runtime/components/map/location/index.vue +109 -0
- package/dist/runtime/components/map/location/list.vue +54 -0
- package/dist/runtime/components/map/location/nearest.vue +88 -0
- package/dist/runtime/components/map/openlayers/index.vue +355 -0
- package/dist/runtime/components/map/props.json +5 -0
- package/dist/runtime/components/map/store.d.ts +114 -0
- package/dist/runtime/components/map/store.mjs +166 -0
- package/dist/runtime/components/map/zoom.vue +61 -0
- package/dist/runtime/components/notice/index.vue +63 -0
- package/dist/runtime/components/notice/item.vue +118 -0
- package/dist/runtime/components/notice/store.d.ts +27 -0
- package/dist/runtime/components/notice/store.mjs +46 -0
- package/dist/runtime/components/radio.vue +215 -0
- package/dist/runtime/components/select.vue +303 -0
- package/dist/runtime/components/static-map.vue +345 -0
- package/dist/runtime/components/styles/components.less +3 -0
- package/dist/runtime/components/styles/mixins.less +6 -0
- package/dist/runtime/components/textarea/index.vue +166 -0
- package/dist/runtime/components/textarea/props.json +4 -0
- package/dist/runtime/components/tooltip.vue +137 -0
- package/dist/runtime/plugins/methods.d.ts +2 -0
- package/dist/runtime/plugins/methods.mjs +20 -0
- package/dist/runtime/plugins/variables.d.ts +2 -0
- package/dist/runtime/plugins/variables.mjs +17 -0
- package/dist/types.d.mts +2 -11
- package/dist/types.d.ts +2 -11
- package/package.json +2 -2
package/dist/module.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
|
|
3
|
+
interface ModuleOptions {
|
|
4
|
+
}
|
|
5
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
6
|
+
|
|
7
|
+
export { type ModuleOptions, _default as default };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,12 +1,233 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineNuxtModule, createResolver, addTemplate, addPlugin, addComponentsDir, addComponent } from '@nuxt/kit';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// -- Unbuild CommonJS Shims --
|
|
9
|
+
import __cjs_url__ from 'url';
|
|
10
|
+
import __cjs_path__ from 'path';
|
|
11
|
+
import __cjs_mod__ from 'module';
|
|
12
|
+
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = __cjs_path__.dirname(__filename);
|
|
14
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
15
|
+
const defaultStyle = {
|
|
16
|
+
"content-width": "1400px",
|
|
17
|
+
// website content width
|
|
18
|
+
// Border radius
|
|
19
|
+
"border-radius-big": "18px",
|
|
20
|
+
"border-radius-default": "8px",
|
|
21
|
+
"border-radius-small": "3px",
|
|
22
|
+
// Inputs height
|
|
23
|
+
"input-height-large": "60px",
|
|
24
|
+
"input-height-big": "52px",
|
|
25
|
+
"input-height-medium": "48px",
|
|
26
|
+
"input-height-default": "42px",
|
|
27
|
+
"input-height-small": "32px",
|
|
28
|
+
"input-height-mini": "24px",
|
|
29
|
+
// Line height
|
|
30
|
+
"text-line-height": 1.4,
|
|
31
|
+
// Colors
|
|
32
|
+
"color-text": "rgba(0,0,0,0.8)",
|
|
33
|
+
"color-header-text": "rgba(0,0,0,1)",
|
|
34
|
+
"color-primary": "blue",
|
|
35
|
+
"color-primary-text": "blue",
|
|
36
|
+
"color-text-on-primary": "#fff",
|
|
37
|
+
"color-secondary": "cyan",
|
|
38
|
+
"color-secondary-text": "cyan",
|
|
39
|
+
"color-text-on-secondary": "#fff",
|
|
40
|
+
"color-gray": "rgba(56,60,68, 0.8)",
|
|
41
|
+
"color-gray-text": "rgba(56,60,68, 1)",
|
|
42
|
+
"color-text-on-gray": "#fff",
|
|
43
|
+
"color-red": "red",
|
|
44
|
+
"color-red-text": "var(--color-red)",
|
|
45
|
+
"color-text-on-red": "#fff",
|
|
46
|
+
"color-error": "var(--color-red)",
|
|
47
|
+
"color-surface": "#ccc",
|
|
48
|
+
"color-surface-text": "#aaa",
|
|
49
|
+
"color-text-on-surface": "var(--color-text)",
|
|
50
|
+
"color-neutral": "#ccc",
|
|
51
|
+
"color-neutral-text": "#aaa",
|
|
52
|
+
"color-text-on-neutral": "var(--color-text)",
|
|
53
|
+
"color-bg": "#fff",
|
|
54
|
+
"color-bg-text": "#fff",
|
|
55
|
+
"color-text-on-bg": "var(--color-text)",
|
|
56
|
+
"color-border": "#e8e8e8",
|
|
57
|
+
"color-border-bolder": "#e0e0e0",
|
|
58
|
+
// Text
|
|
59
|
+
"text-large": "32px",
|
|
60
|
+
"text-big": "24px",
|
|
61
|
+
"text-medium": "18px",
|
|
62
|
+
"text-default": "16px",
|
|
63
|
+
"text-small": "14px",
|
|
64
|
+
"text-mini": "12px",
|
|
65
|
+
// Font
|
|
66
|
+
"font-text": '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";',
|
|
67
|
+
"font-header": "var(--font-text)",
|
|
68
|
+
"font-accent": "var(--font-text)",
|
|
69
|
+
"font-icons": "FontAwesome",
|
|
70
|
+
"font-mono": "Consolas, SF Mono",
|
|
71
|
+
// Font weight
|
|
72
|
+
"font-weight-medium": "600",
|
|
73
|
+
// Padding
|
|
74
|
+
"space-extra-large": "100px",
|
|
75
|
+
"space-large": "50px",
|
|
76
|
+
"space-big": "32px",
|
|
77
|
+
"space-medium": "25px",
|
|
78
|
+
"space-default": "20px",
|
|
79
|
+
"space-small": "15px",
|
|
80
|
+
"space-mini": "10px",
|
|
81
|
+
"space-micro": "5px",
|
|
82
|
+
// Box shadow
|
|
83
|
+
"bs-1": "0 3px 8px rgba(13,72,177, 0.03), 0 6px 16px rgba(13,72,177, 0.03)",
|
|
84
|
+
"bs-2": "0 1px 3px rgba(13,72,177, 0.07), 0 1px 2px rgba(13,72,177, 0.1)",
|
|
85
|
+
"bs-3": "0 0.4px 0.6px rgba(13,72,177, 0.019), 0 1px 1.6px rgba(13,72,177, 0.027), 0 2.1px 3.2px rgba(13,72,177, 0.033), 4.4px 6.6px rgba(13,72,177, 0.041), 0 12px 18px rgba(13,72,177, 0.06)",
|
|
86
|
+
// Animation
|
|
87
|
+
"ani-time": "0.3s",
|
|
88
|
+
"ani-ease": "ease"
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const generateStyle = (options) => {
|
|
92
|
+
let result = ":root {";
|
|
93
|
+
const userStyle = options?.style ? options.style : {};
|
|
94
|
+
for (let key in userStyle) {
|
|
95
|
+
if (key in defaultStyle)
|
|
96
|
+
defaultStyle[key] = userStyle[key];
|
|
97
|
+
else
|
|
98
|
+
console.error(`UI: Unknown css variable defined in ui config "${key}"`);
|
|
99
|
+
}
|
|
100
|
+
for (let key in defaultStyle) {
|
|
101
|
+
result += `--ui-${key}:${defaultStyle[key]};`;
|
|
102
|
+
}
|
|
103
|
+
result += "}";
|
|
104
|
+
return result;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const defaultComponentsStyle = {
|
|
108
|
+
accordion: {
|
|
109
|
+
"title-font-size": "var(--ui-text-medium)",
|
|
110
|
+
"text-font-size": "var(--ui-text-default)"
|
|
111
|
+
},
|
|
112
|
+
button: {
|
|
113
|
+
"border-radius": "var(--ui-input-height-large)"
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const generateComponentsDefaults = (options) => {
|
|
118
|
+
let result = "";
|
|
119
|
+
const components = options?.components ? options.components : {};
|
|
120
|
+
for (let name in defaultComponentsStyle) {
|
|
121
|
+
const style = Object.assign(defaultComponentsStyle[name], components[name] ? components[name] : {});
|
|
122
|
+
for (let prop in style) {
|
|
123
|
+
result += `@ui-${name}-${prop}: ${style[prop]};
|
|
124
|
+
`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const __dirname__ = path.dirname(fileURLToPath(import.meta.url));
|
|
131
|
+
const readComponentsProps = (options = {}) => {
|
|
132
|
+
const dirComponents = path.resolve(__dirname__, "../runtime/components/");
|
|
133
|
+
const result = {};
|
|
134
|
+
let files = fs.readdirSync(dirComponents, { recursive: true });
|
|
135
|
+
files = files.filter((v) => v.indexOf("props.json") !== -1);
|
|
136
|
+
for (let file of files) {
|
|
137
|
+
const componentName = file.split("\\")[0];
|
|
138
|
+
const propsJSON = fs.readFileSync(path.resolve(dirComponents, file), { encoding: "utf-8" });
|
|
139
|
+
const props = JSON.parse(propsJSON);
|
|
140
|
+
result[componentName] = props;
|
|
141
|
+
}
|
|
142
|
+
if (options?.componentsProps) {
|
|
143
|
+
for (let componentName in options.componentsProps) {
|
|
144
|
+
if (!(componentName in result)) {
|
|
145
|
+
console.error(`Reading user defined components props error: component "${componentName}" does not exist`);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
const userDefinedProps = options.componentsProps[componentName];
|
|
149
|
+
for (let prop in userDefinedProps) {
|
|
150
|
+
if (!(prop in result[componentName])) {
|
|
151
|
+
console.error(`Reading user defined components props error: prop "${prop}" does not exist in "${componentName}"`);
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
result[componentName][prop] = userDefinedProps[prop];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return result;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const module = defineNuxtModule({
|
|
162
|
+
meta: {
|
|
163
|
+
name: "ui",
|
|
164
|
+
configKey: "ui"
|
|
165
|
+
},
|
|
166
|
+
// Default configuration options of the Nuxt module
|
|
167
|
+
defaults: {},
|
|
168
|
+
setup(options, nuxt) {
|
|
169
|
+
const { resolve } = createResolver(import.meta.url);
|
|
170
|
+
addTemplate({
|
|
171
|
+
filename: "ui.style.mjs",
|
|
172
|
+
getContents: () => "export default " + JSON.stringify(generateStyle(options))
|
|
173
|
+
//write: true
|
|
174
|
+
});
|
|
175
|
+
addTemplate({
|
|
176
|
+
dst: "./src/runtime/components/styles/components.less",
|
|
177
|
+
write: true,
|
|
178
|
+
filename: "components.less",
|
|
179
|
+
getContents: () => generateComponentsDefaults(options)
|
|
180
|
+
});
|
|
181
|
+
const componentsProps = readComponentsProps(options);
|
|
182
|
+
for (let componentName in componentsProps) {
|
|
183
|
+
addTemplate({
|
|
184
|
+
filename: `ui.${componentName}.mjs`,
|
|
185
|
+
// @ts-ignore
|
|
186
|
+
getContents: () => "export default " + JSON.stringify(componentsProps[componentName])
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
addPlugin({
|
|
190
|
+
src: resolve("./runtime/plugins/variables"),
|
|
191
|
+
mode: "server"
|
|
192
|
+
});
|
|
193
|
+
addPlugin({
|
|
194
|
+
src: resolve("./runtime/plugins/methods"),
|
|
195
|
+
mode: "all"
|
|
196
|
+
});
|
|
197
|
+
addComponentsDir({
|
|
198
|
+
path: resolve("./runtime/components"),
|
|
199
|
+
// watch: true,
|
|
200
|
+
prefix: "ui",
|
|
201
|
+
pathPrefix: false,
|
|
202
|
+
global: false,
|
|
203
|
+
extensions: ["vue"]
|
|
204
|
+
});
|
|
205
|
+
addComponent({
|
|
206
|
+
filePath: resolve("./runtime/components/map/zoom"),
|
|
207
|
+
name: "ui-map-zoom",
|
|
208
|
+
global: false
|
|
209
|
+
});
|
|
210
|
+
addComponent({
|
|
211
|
+
filePath: resolve("./runtime/components/map/device-zoom-switch"),
|
|
212
|
+
name: "ui-map-device-zoom-switch",
|
|
213
|
+
global: false
|
|
214
|
+
});
|
|
215
|
+
addComponent({
|
|
216
|
+
filePath: resolve("./runtime/components/map/location/index"),
|
|
217
|
+
name: "ui-map-location",
|
|
218
|
+
global: false
|
|
219
|
+
});
|
|
220
|
+
addComponent({
|
|
221
|
+
filePath: resolve("./runtime/components/map/location/list"),
|
|
222
|
+
name: "ui-map-location-list",
|
|
223
|
+
global: false
|
|
224
|
+
});
|
|
225
|
+
addComponent({
|
|
226
|
+
filePath: resolve("./runtime/components/map/location/nearest"),
|
|
227
|
+
name: "ui-map-location-nearest",
|
|
228
|
+
global: false
|
|
229
|
+
});
|
|
9
230
|
}
|
|
10
|
-
})
|
|
231
|
+
});
|
|
11
232
|
|
|
12
|
-
export default
|
|
233
|
+
export { module as default };
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="component-ui-accordion">
|
|
3
|
+
<div v-for="(item, index) of list" class="item" :class="{'tag-active': activeItem === index}">
|
|
4
|
+
<div class="header" @click="toggle(index)">
|
|
5
|
+
<i class="icon"></i>
|
|
6
|
+
<div class="title">{{ item.title }}</div>
|
|
7
|
+
<div class="btn-toggle"></div>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="text">
|
|
10
|
+
<div v-html="item.text"></div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</section>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
// Imports
|
|
18
|
+
import { ref, computed } from 'vue'
|
|
19
|
+
|
|
20
|
+
// Data
|
|
21
|
+
const props = defineProps({
|
|
22
|
+
/** Icon for light theme */
|
|
23
|
+
iconLight: {
|
|
24
|
+
type: String,
|
|
25
|
+
},
|
|
26
|
+
/** Icon for dark theme */
|
|
27
|
+
iconDark: {
|
|
28
|
+
type: String,
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Accordion elements list, AccordionListItem = {title: '', text: ''}
|
|
32
|
+
* @values AccordionListItem[]
|
|
33
|
+
*/
|
|
34
|
+
list: {
|
|
35
|
+
type: Array,
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Slide that is active(open) by default, null = all closed
|
|
39
|
+
* @values 1, 2, 3, 1000, null
|
|
40
|
+
*/
|
|
41
|
+
active: {
|
|
42
|
+
type: [Number, null],
|
|
43
|
+
default: 0
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const activeItem = ref(props.active);
|
|
48
|
+
|
|
49
|
+
const iconLightComputed = computed(() => {
|
|
50
|
+
return props.iconLight ? `url(${props.iconLight})` : 'none';
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const iconDarkComputed = computed(() => {
|
|
54
|
+
return props.iconDark ? `url(${props.iconDark})` : 'none';
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Methods
|
|
58
|
+
function toggle(i) {
|
|
59
|
+
activeItem.value = activeItem.value === i ? null : i;
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<style lang="less">
|
|
64
|
+
@import (less) './styles/components.less';
|
|
65
|
+
|
|
66
|
+
// Misc
|
|
67
|
+
@com-icon-size: 30px;
|
|
68
|
+
@com-btn-size: 20px;
|
|
69
|
+
@com-btn-width: 2px;
|
|
70
|
+
|
|
71
|
+
@com-ani-time: var(--ui-ani-time);
|
|
72
|
+
@com-ani-ease: var(--ui-ani-ease);
|
|
73
|
+
|
|
74
|
+
@com-text-line-height: var(--ui-text-line-height);
|
|
75
|
+
|
|
76
|
+
// Padding
|
|
77
|
+
@com-space-default: var(--ui-space-default);
|
|
78
|
+
@com-space-small: var(--ui-space-small);
|
|
79
|
+
@com-space-mini: var(--ui-space-mini);
|
|
80
|
+
|
|
81
|
+
// Colors
|
|
82
|
+
@com-color-border: var(--ui-color-border);
|
|
83
|
+
@com-color-header-text: var(--ui-color-header-text);
|
|
84
|
+
|
|
85
|
+
// Text
|
|
86
|
+
@com-text-medium: var(--ui-text-medium);
|
|
87
|
+
@com-text-default: var(--ui-text-default);
|
|
88
|
+
|
|
89
|
+
// Font
|
|
90
|
+
@com-font-header: var(--ui-font-header);
|
|
91
|
+
|
|
92
|
+
.component-ui-accordion {
|
|
93
|
+
.item {
|
|
94
|
+
padding-bottom: @com-space-small;
|
|
95
|
+
margin-top: @com-space-small;
|
|
96
|
+
border-bottom: 1px solid @com-color-border;
|
|
97
|
+
font-size: @com-text-medium;
|
|
98
|
+
|
|
99
|
+
&:last-child {
|
|
100
|
+
border-bottom: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Active state
|
|
104
|
+
&.tag-active {
|
|
105
|
+
.text {
|
|
106
|
+
grid-template-rows: 1fr;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.btn-toggle {
|
|
110
|
+
&:before,
|
|
111
|
+
&:after {
|
|
112
|
+
transform: rotate(90deg);
|
|
113
|
+
}
|
|
114
|
+
&:after {
|
|
115
|
+
opacity: 0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.header {
|
|
122
|
+
position: relative;
|
|
123
|
+
padding: @com-space-small 40px @com-space-small calc(@com-icon-size + @com-space-default);
|
|
124
|
+
margin-bottom: @com-space-mini;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.icon,
|
|
129
|
+
.btn-toggle {
|
|
130
|
+
transform: translateY(-50%);
|
|
131
|
+
position: absolute;
|
|
132
|
+
top: 50%;
|
|
133
|
+
width: @com-icon-size;
|
|
134
|
+
height: @com-icon-size;
|
|
135
|
+
line-height: @com-icon-size;
|
|
136
|
+
text-align: center;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.icon {
|
|
140
|
+
left: 0;
|
|
141
|
+
background-position: center;
|
|
142
|
+
background-size: contain;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.title {
|
|
146
|
+
font-family: @com-font-header;
|
|
147
|
+
font-weight: 600;
|
|
148
|
+
color: @com-color-header-text;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.btn-toggle {
|
|
152
|
+
right: 0;
|
|
153
|
+
|
|
154
|
+
&:before,
|
|
155
|
+
&:after {
|
|
156
|
+
content: '';
|
|
157
|
+
|
|
158
|
+
transition: all @com-ani-time @com-ani-ease;
|
|
159
|
+
transform-origin: center;
|
|
160
|
+
position: absolute;
|
|
161
|
+
background: @com-color-header-text;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// |
|
|
165
|
+
&:before {
|
|
166
|
+
top: (@com-icon-size/2) - (@com-btn-size / 2);
|
|
167
|
+
left: (@com-icon-size/2) - (@com-btn-width / 2);
|
|
168
|
+
width: @com-btn-width;
|
|
169
|
+
height: @com-btn-size;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// —
|
|
173
|
+
&:after {
|
|
174
|
+
top: (@com-icon-size/2) - (@com-btn-width / 2);
|
|
175
|
+
left: (@com-icon-size/2) - (@com-btn-size / 2);
|
|
176
|
+
width: @com-btn-size;
|
|
177
|
+
height: @com-btn-width;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.text {
|
|
182
|
+
transition: grid-template-rows @com-ani-time @com-ani-ease;
|
|
183
|
+
display: grid;
|
|
184
|
+
grid-template-rows: 0fr;
|
|
185
|
+
line-height: @com-text-line-height;
|
|
186
|
+
font-size: @com-text-default;
|
|
187
|
+
|
|
188
|
+
div {
|
|
189
|
+
overflow: hidden;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Themes settings
|
|
195
|
+
.theme-light .component-ui-accordion .icon,
|
|
196
|
+
.theme-lowvision .component-ui-accordion .icon {
|
|
197
|
+
background-image: v-bind(iconLightComputed);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.theme-dark .component-ui-accordion .icon {
|
|
201
|
+
background-image: v-bind(iconDarkComputed);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
@media only screen and (max-width: 500px) {
|
|
206
|
+
.component-ui-accordion {
|
|
207
|
+
.item {
|
|
208
|
+
font-size: @com-text-default;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.header {
|
|
212
|
+
padding: @com-space-small 35px @com-space-small calc(26 + @com-space-default);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.icon {
|
|
216
|
+
width: 26px;
|
|
217
|
+
height: 26px;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animate value
|
|
3
|
+
* @param {Function} callback
|
|
4
|
+
* @param {number} start
|
|
5
|
+
* @param {number} end
|
|
6
|
+
* @param {number} duration
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* animateValue((value) => {
|
|
10
|
+
* console.log('value', value);
|
|
11
|
+
* }, 0, 100, 10000);
|
|
12
|
+
*/
|
|
13
|
+
export default function _default(callback: Function, start: number, end: number, duration: number): void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// function outSine(n) {
|
|
2
|
+
// return Math.sin(n * Math.PI / 2);
|
|
3
|
+
// };
|
|
4
|
+
|
|
5
|
+
// function inOutSine(n) {
|
|
6
|
+
// return .5 * (1 - Math.cos(Math.PI * n));
|
|
7
|
+
// };
|
|
8
|
+
|
|
9
|
+
// function outCube(n) {
|
|
10
|
+
// return --n * n * n + 1;
|
|
11
|
+
// };
|
|
12
|
+
|
|
13
|
+
// function outQuad(n){
|
|
14
|
+
// return n * (2 - n);
|
|
15
|
+
// };
|
|
16
|
+
|
|
17
|
+
// function outQuart(n) {
|
|
18
|
+
// return 1 - (--n * n * n * n);
|
|
19
|
+
// };
|
|
20
|
+
|
|
21
|
+
function inOutQuart(n) {
|
|
22
|
+
n *= 2;
|
|
23
|
+
if (n < 1) return 0.5 * n * n * n * n;
|
|
24
|
+
return -0.5 * ((n -= 2) * n * n * n - 2);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Animate value
|
|
29
|
+
* @param {Function} callback
|
|
30
|
+
* @param {number} start
|
|
31
|
+
* @param {number} end
|
|
32
|
+
* @param {number} duration
|
|
33
|
+
* @example
|
|
34
|
+
*
|
|
35
|
+
* animateValue((value) => {
|
|
36
|
+
* console.log('value', value);
|
|
37
|
+
* }, 0, 100, 10000);
|
|
38
|
+
*/
|
|
39
|
+
export default function(callback, start, end, duration) {
|
|
40
|
+
const fn = inOutQuart;
|
|
41
|
+
let startTimestamp = null;
|
|
42
|
+
let val = start;
|
|
43
|
+
|
|
44
|
+
const step = (timestamp) => {
|
|
45
|
+
if (!startTimestamp) startTimestamp = timestamp;
|
|
46
|
+
|
|
47
|
+
const progress = fn(Math.min((timestamp - startTimestamp) / duration, 1));
|
|
48
|
+
|
|
49
|
+
val = Math.floor(progress * (end - start) + start);
|
|
50
|
+
callback(val);
|
|
51
|
+
|
|
52
|
+
if (progress < 1) requestAnimationFrame(step);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
requestAnimationFrame(step);
|
|
56
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="component-ui-animated-number">
|
|
3
|
+
{{ val }}
|
|
4
|
+
</span>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
// Imports
|
|
9
|
+
import { ref, watch } from 'vue';
|
|
10
|
+
import animateValue from './animateValue';
|
|
11
|
+
|
|
12
|
+
// Data
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
n: [Number, String],
|
|
15
|
+
active: Boolean,
|
|
16
|
+
delay: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 0
|
|
19
|
+
},
|
|
20
|
+
duration: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 4000
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const val = ref(0);
|
|
27
|
+
let activated = false;
|
|
28
|
+
|
|
29
|
+
watch(() => props.active, (v) => {
|
|
30
|
+
if (!v || activated) return;
|
|
31
|
+
|
|
32
|
+
activated = true;
|
|
33
|
+
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
animateValue(
|
|
36
|
+
(v) => { val.value = v; },
|
|
37
|
+
0,
|
|
38
|
+
props.n,
|
|
39
|
+
props.duration
|
|
40
|
+
);
|
|
41
|
+
}, props.delay);
|
|
42
|
+
}, { immediate: true });
|
|
43
|
+
</script>
|