@ecolovo/uniapp-components 1.0.6 → 1.0.9
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 +117 -0
- package/components/aspect/aspect.vue +3 -3
- package/components/badge/badge.vue +1 -1
- package/components/button/button.vue +6 -2
- package/components/checkbox/checkbox.vue +18 -4
- package/components/checkbox-group/checkbox-group.vue +1 -1
- package/components/checkbox-group2/checkbox-group2.vue +1 -1
- package/components/checkbox-group2/checkbox.vue +1 -1
- package/components/data-list/data-list.vue +1 -1
- package/components/date-picker/date-picker-view.vue +1 -1
- package/components/date-picker/date-picker.vue +1 -1
- package/components/datetime-picker/datetime-picker-view.vue +1 -1
- package/components/datetime-picker/datetime-picker.vue +1 -1
- package/components/dialog/dialog-content.vue +11 -7
- package/components/dialog/dialog.vue +22 -14
- package/components/dropdown/dropdown.vue +1 -1
- package/components/empty/empty.vue +1 -1
- package/components/flex/flex.vue +1 -1
- package/components/form/form.vue +1 -1
- package/components/form-item/form-item.vue +1 -1
- package/components/icon/icon.vue +1 -1
- package/components/image/image.vue +1 -1
- package/components/input/input.vue +1 -1
- package/components/input/password-input.vue +1 -1
- package/components/list-page/list-page.vue +1 -1
- package/components/load-more/load-more.vue +1 -1
- package/components/loading/animations/loading-animation1.vue +1 -1
- package/components/loading/animations/loading-animation2.vue +1 -1
- package/components/loading/animations/loading-animation3.vue +1 -1
- package/components/loading/animations/loading-animation4.vue +1 -1
- package/components/loading/loading.vue +1 -1
- package/components/message-box/message-box.vue +1 -1
- package/components/number-dialog/number-dialog.vue +1 -1
- package/components/number-input/number-input.vue +1 -1
- package/components/numpad/numpad.vue +1 -1
- package/components/page/page-body.vue +8 -3
- package/components/page/page-footer.vue +1 -1
- package/components/page/page-header.vue +24 -8
- package/components/page/page.vue +7 -7
- package/components/picker/picker-popup.vue +1 -1
- package/components/picker/picker.vue +1 -1
- package/components/popover/popover-content.vue +1 -1
- package/components/popover/popover-mask.vue +1 -1
- package/components/popover/popover.vue +1 -1
- package/components/popup/popup-content.vue +1 -1
- package/components/popup/popup.vue +1 -1
- package/components/price/price.vue +1 -1
- package/components/search/search.vue +1 -1
- package/components/searching/searching.vue +1 -1
- package/components/selector/selector.vue +1 -1
- package/components/switch/switch.vue +1 -1
- package/components/tab/tab.vue +1 -1
- package/components/table/table.vue +1 -1
- package/components/textarea/textarea.vue +1 -1
- package/components/time-picker/time-picker-view.vue +1 -1
- package/components/time-picker/time-picker.vue +1 -1
- package/components/uploader/file-uploader.vue +1 -1
- package/components/uploader/media-uploader.vue +1 -1
- package/components/uploader/upload-button.vue +1 -1
- package/components/uploader/uploader.vue +1 -1
- package/configs/index.d.ts +22 -0
- package/configs/index.js +31 -4
- package/init.d.ts +19 -0
- package/init.js +4 -1
- package/mixins/componentName.js +2 -2
- package/package.json +15 -1
- package/styles/global.scss +4 -4
- package/styles/utils/css-var.scss +7 -2
- package/styles/utils/z-index.scss +1 -1
- package/styles/var/component.scss +5 -2
- package/styles/var/theme.scss +20 -10
- package/utils/windowInfo.js +0 -4
|
@@ -57,9 +57,10 @@
|
|
|
57
57
|
import componentName from '../../mixins/componentName';
|
|
58
58
|
import windowInfoMixin from '../../mixins/windowInfo';
|
|
59
59
|
import IconCpn from '../icon/icon.vue';
|
|
60
|
+
import { homePath } from '../../configs';
|
|
60
61
|
|
|
61
62
|
export default {
|
|
62
|
-
name: '
|
|
63
|
+
name: 'PageHeader',
|
|
63
64
|
options: {
|
|
64
65
|
virtualHost: true,
|
|
65
66
|
styleIsolation: 'shared',
|
|
@@ -84,27 +85,42 @@ export default {
|
|
|
84
85
|
},
|
|
85
86
|
/** 导航按钮类型: 0 = 不显示,1 = 返回,2 = 首页,3 = 返回|首页 */
|
|
86
87
|
navType: {
|
|
87
|
-
type: Number,
|
|
88
|
-
default:
|
|
88
|
+
type: [Number, null],
|
|
89
|
+
default: null,
|
|
89
90
|
},
|
|
90
91
|
},
|
|
91
92
|
computed: {
|
|
92
93
|
/** 首页路径 */
|
|
93
94
|
homePageUrl() {
|
|
94
|
-
|
|
95
|
-
return process.env.VUE_APP_HOME_PATH;
|
|
95
|
+
return homePath;
|
|
96
96
|
},
|
|
97
97
|
/** 是否显示返回按钮 */
|
|
98
98
|
hasBack() {
|
|
99
|
-
|
|
99
|
+
// 如果指定了导航按钮类型,则根据类型判断
|
|
100
|
+
if (this.navType !== null) return !!(this.navType & 1);
|
|
101
|
+
const pages = getCurrentPages();
|
|
102
|
+
// 在首页不显示返回按钮
|
|
103
|
+
if (this.homePageUrl === '/' + pages[0].route) return false;
|
|
104
|
+
// 页面栈只有一个时不显示返回按钮
|
|
105
|
+
if (pages.length === 1) return false;
|
|
106
|
+
// 其他情况均显示返回按钮
|
|
107
|
+
return true;
|
|
100
108
|
},
|
|
101
109
|
/** 是否显示首页按钮 */
|
|
102
110
|
hasHome() {
|
|
103
|
-
|
|
111
|
+
// 如果指定了导航按钮类型,则根据类型判断
|
|
112
|
+
if (this.navType !== null) return !!(this.navType & 2);
|
|
113
|
+
const pages = getCurrentPages();
|
|
114
|
+
// 在首页不显示返回首页按钮
|
|
115
|
+
if (this.homePageUrl === '/' + pages[0].route) return false;
|
|
116
|
+
// 页面栈只有一个时显示返回按钮
|
|
117
|
+
if (pages.length === 1) return true;
|
|
118
|
+
// 其他情况均不显示返回按钮
|
|
119
|
+
return false;
|
|
104
120
|
},
|
|
105
121
|
/** 导航按钮个数 */
|
|
106
122
|
iconCount() {
|
|
107
|
-
return
|
|
123
|
+
return (this.hasBack ? 1 : 0) + (this.hasHome ? 1 : 0);
|
|
108
124
|
},
|
|
109
125
|
styleStr() {
|
|
110
126
|
return [
|
package/components/page/page.vue
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
:has-custom-nav="custom"
|
|
12
12
|
:has-footer="hasFooter && $slots.footer"
|
|
13
13
|
:use-scroll="useScroll"
|
|
14
|
-
:is-tab-page="
|
|
14
|
+
:is-tab-page="tabbar"
|
|
15
15
|
:enable-refresh="enableRefresh"
|
|
16
16
|
:refreshing="refreshing"
|
|
17
17
|
@scroll="$emit('scroll', $event)"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<slot></slot>
|
|
22
22
|
</page-body-cpn>
|
|
23
23
|
|
|
24
|
-
<page-footer-cpn v-if="hasFooter && $slots.footer" :is-tab-page="
|
|
24
|
+
<page-footer-cpn v-if="hasFooter && $slots.footer" :is-tab-page="tabbar">
|
|
25
25
|
<slot name="footer"></slot>
|
|
26
26
|
</page-footer-cpn>
|
|
27
27
|
|
|
@@ -37,7 +37,7 @@ import PageFooterCpn from './page-footer.vue';
|
|
|
37
37
|
import PageHeaderCpn from './page-header.vue';
|
|
38
38
|
|
|
39
39
|
export default {
|
|
40
|
-
name: '
|
|
40
|
+
name: 'Page',
|
|
41
41
|
options: {
|
|
42
42
|
virtualHost: true,
|
|
43
43
|
styleIsolation: 'shared',
|
|
@@ -95,10 +95,10 @@ export default {
|
|
|
95
95
|
type: String,
|
|
96
96
|
default: 'light',
|
|
97
97
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
/** 是否是 tabbar 页面,且 tabbar 未隐藏 */
|
|
99
|
+
tabbar: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false,
|
|
102
102
|
},
|
|
103
103
|
},
|
|
104
104
|
};
|
package/components/tab/tab.vue
CHANGED
|
@@ -27,7 +27,7 @@ import { formatDate } from '../../utils/date';
|
|
|
27
27
|
const hourOptions = range(0, 24).map((item) => ('' + item).padStart(2, '0'));
|
|
28
28
|
|
|
29
29
|
export default {
|
|
30
|
-
name: '
|
|
30
|
+
name: 'TimePickerView',
|
|
31
31
|
options: {
|
|
32
32
|
virtualHost: true,
|
|
33
33
|
styleIsolation: 'shared',
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** 组件前缀 */
|
|
2
|
+
declare let componentPrefix: string;
|
|
3
|
+
/** 首页路径 */
|
|
4
|
+
declare let homePath: string;
|
|
5
|
+
/** 设置组件前缀 */
|
|
6
|
+
declare const setComponentPrefix: (prefix: string) => void;
|
|
7
|
+
/** 设置首页路径 */
|
|
8
|
+
declare const setHomePath: (path: string) => void;
|
|
9
|
+
/** iconfont 图标 map */
|
|
10
|
+
declare let iconMap: Map<string, { fontFamily: string; prefix: string; name: string }>;
|
|
11
|
+
interface IconFontJson {
|
|
12
|
+
font_family: string;
|
|
13
|
+
css_prefix_text: string;
|
|
14
|
+
glyphs: { font_class: string }[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 添加一组图标,传入 iconfont.json 文件内容
|
|
18
|
+
* @param iconJson iconfont.json 文件内容
|
|
19
|
+
*/
|
|
20
|
+
declare const addIcons: (iconJson: IconFontJson) => void;
|
|
21
|
+
|
|
22
|
+
export { componentPrefix, homePath, IconFontJson, setComponentPrefix, setHomePath, iconMap, addIcons };
|
package/configs/index.js
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
/** 组件前缀 */
|
|
2
2
|
let componentPrefix = 'app';
|
|
3
|
+
/** 首页路径 */
|
|
4
|
+
let homePath = '/pages/index/index';
|
|
3
5
|
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* 设置组件前缀
|
|
8
|
+
* @param {string} prefix 组件前缀
|
|
9
|
+
*/
|
|
5
10
|
function setComponentPrefix(prefix) {
|
|
6
11
|
componentPrefix = prefix;
|
|
7
12
|
}
|
|
8
13
|
|
|
14
|
+
/**
|
|
15
|
+
* 设置首页路径
|
|
16
|
+
* @param {string} path 首页路径
|
|
17
|
+
*/
|
|
18
|
+
function setHomePath(path) {
|
|
19
|
+
homePath = path;
|
|
20
|
+
}
|
|
21
|
+
|
|
9
22
|
/** iconfont 图标 map */
|
|
10
23
|
const iconMap = new Map();
|
|
11
24
|
|
|
12
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* 添加单个图标
|
|
27
|
+
* @param {string} fontFamily 字体文件名
|
|
28
|
+
* @param {string} prefix 图标前缀
|
|
29
|
+
* @param {string} name 图标名称
|
|
30
|
+
*/
|
|
13
31
|
function addIconToMap(fontFamily, prefix, name) {
|
|
14
32
|
if (iconMap.has(name)) {
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
15
34
|
console.error(
|
|
16
35
|
`图标库 "${fontFamily}" 中的图标 "${name}" 在图标库 "${
|
|
17
36
|
iconMap.get(name).fontFamily
|
|
@@ -26,7 +45,14 @@ function addIconToMap(fontFamily, prefix, name) {
|
|
|
26
45
|
});
|
|
27
46
|
}
|
|
28
47
|
|
|
29
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* 添加一组图标,传入 iconfont.json 文件内容
|
|
50
|
+
* @param {object} iconJson iconfont.json 文件内容
|
|
51
|
+
* @param {string} iconJson.font_family
|
|
52
|
+
* @param {string} iconJson.css_prefix_text
|
|
53
|
+
* @param {object[]} iconJson.glyphs
|
|
54
|
+
* @param {string} iconJson.glyphs.font_class
|
|
55
|
+
*/
|
|
30
56
|
function addIcons(iconJson) {
|
|
31
57
|
const fontFamily = iconJson.font_family;
|
|
32
58
|
const prefix = iconJson.css_prefix_text;
|
|
@@ -36,6 +62,7 @@ function addIcons(iconJson) {
|
|
|
36
62
|
});
|
|
37
63
|
}
|
|
38
64
|
|
|
65
|
+
// 添加内部图标库
|
|
39
66
|
addIcons(require('../resources/iconfont/uniapp_ui_icon/iconfont.json'));
|
|
40
67
|
|
|
41
|
-
export { componentPrefix, setComponentPrefix, iconMap, addIcons };
|
|
68
|
+
export { componentPrefix, homePath, setComponentPrefix, setHomePath, iconMap, addIcons };
|
package/init.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IconFontJson } from './configs';
|
|
2
|
+
|
|
3
|
+
/** 组件库初始化配置 */
|
|
4
|
+
interface InitOptions {
|
|
5
|
+
/** 组件前缀 */
|
|
6
|
+
componentPrefix?: string;
|
|
7
|
+
/** 首页路径 */
|
|
8
|
+
homePath?: string;
|
|
9
|
+
/** iconfont 图标 json 文件 */
|
|
10
|
+
iconfont?: IconFontJson | IconFontJson[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 初始化组件库
|
|
15
|
+
* @param {InitOptions} options 组件库初始化配置
|
|
16
|
+
*/
|
|
17
|
+
declare const init: (options: InitOptions) => void;
|
|
18
|
+
|
|
19
|
+
export default init;
|
package/init.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
const { setComponentPrefix, addIcons } = require('./configs');
|
|
1
|
+
const { setComponentPrefix, setHomePath, addIcons } = require('./configs');
|
|
2
2
|
|
|
3
3
|
/** 组件库初始化方法,在 main.js 中调用 */
|
|
4
4
|
function init(options = {}) {
|
|
5
5
|
if (options.componentPrefix) {
|
|
6
6
|
setComponentPrefix(options.componentPrefix);
|
|
7
7
|
}
|
|
8
|
+
if (options.homePath) {
|
|
9
|
+
setHomePath(options.homePath);
|
|
10
|
+
}
|
|
8
11
|
if (options.iconfont) {
|
|
9
12
|
if (Array.isArray(options.iconfont)) {
|
|
10
13
|
options.iconfont.forEach(addIcons);
|
package/mixins/componentName.js
CHANGED
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
},
|
|
18
18
|
/** 添加前缀后的组件名-大驼峰模式 */
|
|
19
19
|
componentClass() {
|
|
20
|
-
return this.componentPrefix + this.$options.name
|
|
20
|
+
return this.componentPrefix + this.$options.name;
|
|
21
21
|
},
|
|
22
22
|
/** 添加前缀后的组件名-短横线模式 */
|
|
23
23
|
componentKebabClass() {
|
|
@@ -25,7 +25,7 @@ export default {
|
|
|
25
25
|
},
|
|
26
26
|
/** 合并后的组件类名 */
|
|
27
27
|
componentClassNames() {
|
|
28
|
-
const baseClass = this.$style?.[this.$options.name
|
|
28
|
+
const baseClass = this.$style?.[this.$options.name];
|
|
29
29
|
return [...(baseClass ? [baseClass] : []), this.componentClass, this.componentKebabClass];
|
|
30
30
|
},
|
|
31
31
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecolovo/uniapp-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Ecolovo UniApp 组件库",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"lint": "eslint . --fix"
|
|
7
|
+
},
|
|
5
8
|
"keywords": [
|
|
6
9
|
"uniapp",
|
|
7
10
|
"components"
|
|
@@ -11,5 +14,16 @@
|
|
|
11
14
|
"dependencies": {
|
|
12
15
|
"case-anything": "3.1.2",
|
|
13
16
|
"lodash-es": "4.17.21"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@dcloudio/types": "^3.4.30",
|
|
20
|
+
"@eslint/js": "^10.0.1",
|
|
21
|
+
"eslint": "^10.0.3",
|
|
22
|
+
"eslint-config-prettier": "^10.1.8",
|
|
23
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
24
|
+
"eslint-plugin-vue": "^10.8.0",
|
|
25
|
+
"globals": "^17.4.0",
|
|
26
|
+
"prettier": "^2.8.8",
|
|
27
|
+
"vue-eslint-parser": "^10.4.0"
|
|
14
28
|
}
|
|
15
29
|
}
|
package/styles/global.scss
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@use './utils' as *;
|
|
4
4
|
|
|
5
5
|
page {
|
|
6
|
-
@each $name, $value in $
|
|
6
|
+
@each $name, $value in $themes {
|
|
7
7
|
@for $i from 9 through 1 {
|
|
8
8
|
#{DO_NOT_USE__global-var-name(theme, $name + '-dark' + $i)}: #{color.scale($value, $blackness: $i * 10%)};
|
|
9
9
|
}
|
|
@@ -12,13 +12,13 @@ page {
|
|
|
12
12
|
#{DO_NOT_USE__global-var-name(theme, $name + '-light' + $i)}: #{color.scale($value, $whiteness: $i * 10%)};
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
@each $name, $value in $
|
|
15
|
+
@each $name, $value in $colors {
|
|
16
16
|
#{DO_NOT_USE__global-var-name(color, $name)}: #{$value};
|
|
17
17
|
}
|
|
18
|
-
@each $name, $value in $
|
|
18
|
+
@each $name, $value in $font-sizes {
|
|
19
19
|
#{DO_NOT_USE__global-var-name(font-size, $name)}: #{$value};
|
|
20
20
|
}
|
|
21
|
-
@each $name, $value in $
|
|
21
|
+
@each $name, $value in $others {
|
|
22
22
|
#{DO_NOT_USE__global-var-name(other, $name)}: #{$value};
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -12,8 +12,13 @@ $component-vars: null !default;
|
|
|
12
12
|
@return string.unquote('--#{$component-prefix}-#{$component}--#{$name}');
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
//
|
|
16
|
-
@mixin UTILS__SET_VAR($component, $
|
|
15
|
+
// 设置组件单个外部变量值
|
|
16
|
+
@mixin UTILS__SET_VAR($component, $name, $value) {
|
|
17
|
+
#{UTILS__VAR_NAME($name, $component)}: $value;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 设置组件一组外部变量值
|
|
21
|
+
@mixin UTILS__SET_VAR_LIST($component, $values) {
|
|
17
22
|
@each $name, $value in $values {
|
|
18
23
|
#{UTILS__VAR_NAME($name, $component)}: $value;
|
|
19
24
|
}
|
|
@@ -39,8 +39,11 @@ $page-body: () !default;
|
|
|
39
39
|
$page-body-default: (
|
|
40
40
|
// 可视区域背景
|
|
41
41
|
background: transparent,
|
|
42
|
-
padding
|
|
43
|
-
padding-
|
|
42
|
+
padding: 20rpx,
|
|
43
|
+
padding-top: null,
|
|
44
|
+
padding-right: null,
|
|
45
|
+
padding-bottom: null,
|
|
46
|
+
padding-left: null
|
|
44
47
|
);
|
|
45
48
|
$page-body: map.merge($page-body-default, $page-body);
|
|
46
49
|
|
package/styles/var/theme.scss
CHANGED
|
@@ -2,39 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
$component-prefix: 'app' !default;
|
|
4
4
|
|
|
5
|
-
$
|
|
5
|
+
$z-index-maps: () !default;
|
|
6
|
+
$z-index-maps-default: (
|
|
6
7
|
loading: 9999,
|
|
7
8
|
dialog: 4000,
|
|
8
9
|
dropdown: 3000,
|
|
9
10
|
popover: 3000,
|
|
10
11
|
page-header: 2000,
|
|
11
12
|
page-footer: 2000,
|
|
12
|
-
)
|
|
13
|
+
);
|
|
14
|
+
$z-index-maps: map.merge($z-index-maps-default, $z-index-maps);
|
|
13
15
|
|
|
14
|
-
$
|
|
16
|
+
$themes: () !default;
|
|
17
|
+
$themes-default: (
|
|
15
18
|
primary: #f26f24,
|
|
16
19
|
secondary: #1e87e9,
|
|
17
20
|
success: #6fe633,
|
|
18
21
|
warning: #f3bb2d,
|
|
19
22
|
danger: #ff0000,
|
|
20
23
|
info: #9a9a99,
|
|
21
|
-
)
|
|
24
|
+
);
|
|
25
|
+
$themes: map.merge($themes-default, $themes);
|
|
22
26
|
|
|
23
|
-
$
|
|
27
|
+
$colors: () !default;
|
|
28
|
+
$colors-default: (
|
|
24
29
|
foreground: #333,
|
|
25
30
|
background: #f4f5f6,
|
|
26
31
|
placeholder: #9a9a99,
|
|
27
32
|
disabled: c3c4c5,
|
|
28
|
-
)
|
|
33
|
+
);
|
|
34
|
+
$colors: map.merge($colors-default, $colors);
|
|
29
35
|
|
|
30
|
-
$
|
|
36
|
+
$font-sizes: () !default;
|
|
37
|
+
$font-sizes-default: (
|
|
31
38
|
small: 24rpx,
|
|
32
39
|
normal: 28rpx,
|
|
33
40
|
large: 32rpx,
|
|
34
|
-
)
|
|
41
|
+
);
|
|
42
|
+
$font-sizes: map.merge($font-sizes-default, $font-sizes);
|
|
35
43
|
|
|
36
|
-
$
|
|
44
|
+
$others: () !default;
|
|
45
|
+
$others-default: (
|
|
37
46
|
font-size-small: 24rpx,
|
|
38
47
|
font-size-normal: 28rpx,
|
|
39
48
|
font-size-large: 32rpx,
|
|
40
|
-
)
|
|
49
|
+
);
|
|
50
|
+
$others: map.merge($others-default, $others);
|
package/utils/windowInfo.js
CHANGED