@ecolovo/uniapp-components 1.0.9 → 2.0.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/README.md +83 -51
- package/components/aspect/aspect.vue +24 -15
- package/components/badge/badge.scss +20 -0
- package/components/badge/badge.vue +49 -40
- package/components/button/button.scss +15 -0
- package/components/button/button.vue +125 -181
- package/components/checkbox/checkbox.scss +10 -0
- package/components/checkbox/checkbox.vue +118 -146
- package/components/checkbox-group/checkbox-group.vue +79 -81
- package/components/checkbox-group2/checkbox-group2.vue +111 -107
- package/components/checkbox-group2/checkbox2.vue +104 -0
- package/components/data-list/data-list.scss +9 -0
- package/components/data-list/data-list.vue +70 -79
- package/components/date-picker/date-picker-view.vue +125 -124
- package/components/date-picker/date-picker.vue +145 -146
- package/components/dialog/dialog-content.vue +39 -47
- package/components/dialog/dialog.scss +11 -0
- package/components/dialog/dialog.vue +125 -138
- package/components/dropdown/dropdown.scss +11 -0
- package/components/dropdown/dropdown.vue +55 -97
- package/components/empty/empty.scss +14 -0
- package/components/empty/empty.vue +42 -41
- package/components/flex/flex.vue +45 -54
- package/components/form/form.vue +29 -24
- package/components/form-item/form-item.scss +11 -0
- package/components/form-item/form-item.vue +43 -40
- package/components/icon/icon.vue +70 -85
- package/components/image/image.vue +35 -38
- package/components/input/input.vue +65 -79
- package/components/input/password-input.vue +34 -42
- package/components/list-page/list-page.vue +73 -99
- package/components/load-more/load-more.scss +12 -0
- package/components/load-more/load-more.vue +29 -29
- package/components/loading/animations/loading-animation1.vue +8 -8
- package/components/loading/animations/loading-animation2.vue +8 -9
- package/components/loading/animations/loading-animation3.vue +11 -11
- package/components/loading/animations/loading-animation4.vue +8 -8
- package/components/loading/loading.vue +19 -20
- package/components/message-box/message-box.vue +59 -41
- package/components/number-dialog/number-dialog.scss +9 -0
- package/components/number-dialog/number-dialog.vue +209 -204
- package/components/number-input/number-input.scss +9 -0
- package/components/number-input/number-input.vue +233 -232
- package/components/numpad/numpad.scss +9 -0
- package/components/numpad/numpad.vue +133 -150
- package/components/page/page-body.scss +15 -0
- package/components/page/page-body.vue +137 -119
- package/components/page/page-footer.scss +13 -0
- package/components/page/page-footer.vue +31 -33
- package/components/page/page-header.scss +17 -0
- package/components/page/page-header.vue +89 -94
- package/components/page/page.scss +9 -0
- package/components/page/page.vue +105 -81
- package/components/picker/picker-popup.vue +218 -209
- package/components/picker/picker.vue +99 -104
- package/components/popover/popover-content.vue +54 -63
- package/components/popover/popover-mask.vue +63 -63
- package/components/popover/popover.scss +28 -0
- package/components/popover/popover.vue +49 -47
- package/components/popup/popup-content.vue +49 -53
- package/components/popup/popup.scss +11 -0
- package/components/popup/popup.vue +117 -132
- package/components/price/price.scss +20 -0
- package/components/price/price.vue +31 -42
- package/components/search/search.scss +12 -0
- package/components/search/search.vue +93 -117
- package/components/searching/searching.vue +33 -40
- package/components/selector/selector.vue +43 -48
- package/components/switch/switch.scss +12 -0
- package/components/switch/switch.vue +99 -96
- package/components/tab/tab.scss +19 -0
- package/components/tab/tab.vue +151 -145
- package/components/textarea/textarea.vue +104 -101
- package/composable/component-name.ts +10 -0
- package/configs/index.ts +82 -0
- package/{easyCom.js → easyCom.ts} +1 -1
- package/index.ts +1 -0
- package/init.ts +34 -0
- package/package.json +12 -4
- package/styles/utils/css-var.scss +12 -15
- package/styles/utils/ellipsis.scss +0 -7
- package/styles/utils/z-index.scss +1 -1
- package/styles/var/component.scss +21 -245
- package/utils/{date.js → date.ts} +44 -42
- package/utils/freezeDeep.ts +9 -0
- package/utils/price.ts +57 -0
- package/utils/round.ts +11 -0
- package/utils/{windowInfo.js → windowInfo.ts} +12 -35
- package/components/checkbox-group2/checkbox.vue +0 -109
- package/components/datetime-picker/datetime-picker-view.vue +0 -209
- package/components/datetime-picker/datetime-picker.vue +0 -235
- package/components/form/mixin.js +0 -13
- package/components/list-page/list-page.js +0 -10
- package/components/table/table.vue +0 -112
- package/components/time-picker/time-picker-view.vue +0 -127
- package/components/time-picker/time-picker.vue +0 -140
- package/components/uploader/download.js +0 -81
- package/components/uploader/file-uploader.vue +0 -52
- package/components/uploader/files.js +0 -225
- package/components/uploader/media-uploader.vue +0 -179
- package/components/uploader/mixin.js +0 -171
- package/components/uploader/uni.js +0 -38
- package/components/uploader/upload-button.vue +0 -29
- package/components/uploader/uploader copy.vue +0 -547
- package/components/uploader/uploader.vue +0 -117
- package/configs/index.d.ts +0 -22
- package/configs/index.js +0 -68
- package/init.d.ts +0 -19
- package/init.js +0 -20
- package/mixins/componentName.js +0 -32
- package/mixins/listPage.js +0 -1
- package/mixins/windowInfo.js +0 -1
- package/utils/fileSize.js +0 -39
- package/utils/floor.js +0 -20
- package/utils/freezeDeep.js +0 -19
- package/utils/price.js +0 -32
- package/utils/round.js +0 -22
package/configs/index.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/** 组件前缀 */
|
|
2
|
-
let componentPrefix = 'app';
|
|
3
|
-
/** 首页路径 */
|
|
4
|
-
let homePath = '/pages/index/index';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 设置组件前缀
|
|
8
|
-
* @param {string} prefix 组件前缀
|
|
9
|
-
*/
|
|
10
|
-
function setComponentPrefix(prefix) {
|
|
11
|
-
componentPrefix = prefix;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 设置首页路径
|
|
16
|
-
* @param {string} path 首页路径
|
|
17
|
-
*/
|
|
18
|
-
function setHomePath(path) {
|
|
19
|
-
homePath = path;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** iconfont 图标 map */
|
|
23
|
-
const iconMap = new Map();
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* 添加单个图标
|
|
27
|
-
* @param {string} fontFamily 字体文件名
|
|
28
|
-
* @param {string} prefix 图标前缀
|
|
29
|
-
* @param {string} name 图标名称
|
|
30
|
-
*/
|
|
31
|
-
function addIconToMap(fontFamily, prefix, name) {
|
|
32
|
-
if (iconMap.has(name)) {
|
|
33
|
-
// eslint-disable-next-line no-console
|
|
34
|
-
console.error(
|
|
35
|
-
`图标库 "${fontFamily}" 中的图标 "${name}" 在图标库 "${
|
|
36
|
-
iconMap.get(name).fontFamily
|
|
37
|
-
}" 中已存在,这个图标将被忽略`
|
|
38
|
-
);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
iconMap.set(name, {
|
|
42
|
-
fontFamily,
|
|
43
|
-
prefix,
|
|
44
|
-
name,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
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
|
-
*/
|
|
56
|
-
function addIcons(iconJson) {
|
|
57
|
-
const fontFamily = iconJson.font_family;
|
|
58
|
-
const prefix = iconJson.css_prefix_text;
|
|
59
|
-
const glyphs = iconJson.glyphs;
|
|
60
|
-
glyphs.forEach((glyph) => {
|
|
61
|
-
addIconToMap(fontFamily, prefix, glyph.font_class);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// 添加内部图标库
|
|
66
|
-
addIcons(require('../resources/iconfont/uniapp_ui_icon/iconfont.json'));
|
|
67
|
-
|
|
68
|
-
export { componentPrefix, homePath, setComponentPrefix, setHomePath, iconMap, addIcons };
|
package/init.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const { setComponentPrefix, setHomePath, addIcons } = require('./configs');
|
|
2
|
-
|
|
3
|
-
/** 组件库初始化方法,在 main.js 中调用 */
|
|
4
|
-
function init(options = {}) {
|
|
5
|
-
if (options.componentPrefix) {
|
|
6
|
-
setComponentPrefix(options.componentPrefix);
|
|
7
|
-
}
|
|
8
|
-
if (options.homePath) {
|
|
9
|
-
setHomePath(options.homePath);
|
|
10
|
-
}
|
|
11
|
-
if (options.iconfont) {
|
|
12
|
-
if (Array.isArray(options.iconfont)) {
|
|
13
|
-
options.iconfont.forEach(addIcons);
|
|
14
|
-
} else {
|
|
15
|
-
addIcons(options.iconfont);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default init;
|
package/mixins/componentName.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { kebabCase, pascalCase } from 'case-anything';
|
|
2
|
-
import { componentPrefix } from '../configs';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
/* #ifdef MP */
|
|
6
|
-
data() {
|
|
7
|
-
return {
|
|
8
|
-
// 添加 $style 属性,否则在 wxml 中无法使用
|
|
9
|
-
$style: {},
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
/* #endif */
|
|
13
|
-
computed: {
|
|
14
|
-
/** 组件公共前缀 */
|
|
15
|
-
componentPrefix() {
|
|
16
|
-
return pascalCase(componentPrefix);
|
|
17
|
-
},
|
|
18
|
-
/** 添加前缀后的组件名-大驼峰模式 */
|
|
19
|
-
componentClass() {
|
|
20
|
-
return this.componentPrefix + this.$options.name;
|
|
21
|
-
},
|
|
22
|
-
/** 添加前缀后的组件名-短横线模式 */
|
|
23
|
-
componentKebabClass() {
|
|
24
|
-
return kebabCase(this.componentClass);
|
|
25
|
-
},
|
|
26
|
-
/** 合并后的组件类名 */
|
|
27
|
-
componentClassNames() {
|
|
28
|
-
const baseClass = this.$style?.[this.$options.name];
|
|
29
|
-
return [...(baseClass ? [baseClass] : []), this.componentClass, this.componentKebabClass];
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
};
|
package/mixins/listPage.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { pulldownRefreshMixin } from '../components/list-page/list-page';
|
package/mixins/windowInfo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { windowInfoMixin as default } from '../utils/windowInfo';
|
package/utils/fileSize.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { floor } from './floor';
|
|
2
|
-
|
|
3
|
-
const ONE_KB = 1024;
|
|
4
|
-
const ONE_MB = ONE_KB * 1024;
|
|
5
|
-
const ONE_GB = ONE_MB * 1024;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 格式化文件尺寸
|
|
9
|
-
* @param {number} size 文件大小 B
|
|
10
|
-
* @returns {{
|
|
11
|
-
* size: number;
|
|
12
|
-
* unit: 'B' | 'KB' | 'MB' | 'GB';
|
|
13
|
-
* formattedSize: string;
|
|
14
|
-
* }} 格式化后的大小
|
|
15
|
-
*/
|
|
16
|
-
export function fileSize(size) {
|
|
17
|
-
if (size < 0) {
|
|
18
|
-
return { size: -1, unit: 'B', formattedSize: '' };
|
|
19
|
-
}
|
|
20
|
-
const rtnObj = {};
|
|
21
|
-
if (size < 100) {
|
|
22
|
-
rtnObj.size = size;
|
|
23
|
-
rtnObj.unit = 'B';
|
|
24
|
-
} else if (size < ONE_KB) {
|
|
25
|
-
rtnObj.size = floor(size / ONE_KB, 2);
|
|
26
|
-
rtnObj.unit = 'KB';
|
|
27
|
-
} else if (size < ONE_MB) {
|
|
28
|
-
rtnObj.size = floor(size / ONE_KB, 0);
|
|
29
|
-
rtnObj.unit = 'KB';
|
|
30
|
-
} else if (size < ONE_GB) {
|
|
31
|
-
rtnObj.size = floor(size / ONE_MB, 1);
|
|
32
|
-
rtnObj.unit = 'MB';
|
|
33
|
-
} else {
|
|
34
|
-
rtnObj.size = floor(size / ONE_GB, 1);
|
|
35
|
-
rtnObj.unit = 'GB';
|
|
36
|
-
}
|
|
37
|
-
rtnObj.formattedSize = `${rtnObj.size} ${rtnObj.unit}`;
|
|
38
|
-
return rtnObj;
|
|
39
|
-
}
|
package/utils/floor.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { round } from './round';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 向下取值
|
|
5
|
-
* @param {number} val 需要处理的数据
|
|
6
|
-
* @param {number} precision 保留小数位数,默认不保留
|
|
7
|
-
* @returns {number} 处理后的数据
|
|
8
|
-
*/
|
|
9
|
-
export function floor(val, precision = 0) {
|
|
10
|
-
return Math.floor(+round(val, precision) + 'e' + precision) / Math.pow(10, precision);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* 向下取值,并保留 2 位小数
|
|
15
|
-
* @param {number} val 需要处理的数据
|
|
16
|
-
* @returns {number} 处理后的数据
|
|
17
|
-
*/
|
|
18
|
-
export function floor2(val) {
|
|
19
|
-
return floor(val, 2);
|
|
20
|
-
}
|
package/utils/freezeDeep.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 深度冻结一个对象
|
|
3
|
-
*
|
|
4
|
-
* 注意:传入的对象和返回的对象是同一个引用,慎用!!
|
|
5
|
-
*
|
|
6
|
-
* @template T
|
|
7
|
-
* @param {T} obj 要被冻结的对象
|
|
8
|
-
* @returns {Readonly<T>}
|
|
9
|
-
*/
|
|
10
|
-
export function freezeDeep(obj) {
|
|
11
|
-
if (!(typeof obj === 'object' && obj)) {
|
|
12
|
-
return obj;
|
|
13
|
-
} else {
|
|
14
|
-
for (let key in obj) {
|
|
15
|
-
freezeDeep(obj[key]);
|
|
16
|
-
}
|
|
17
|
-
return Object.freeze(obj);
|
|
18
|
-
}
|
|
19
|
-
}
|
package/utils/price.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 格式化价格
|
|
3
|
-
* @param {number} price 价格
|
|
4
|
-
* @returns {FormattedPrice}
|
|
5
|
-
*/
|
|
6
|
-
export function formatPrice(price) {
|
|
7
|
-
if (isNaN(price)) {
|
|
8
|
-
return {
|
|
9
|
-
price: '',
|
|
10
|
-
negative: false,
|
|
11
|
-
integer: '',
|
|
12
|
-
decimal: '',
|
|
13
|
-
number: NaN,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
price = Number(price);
|
|
17
|
-
let negative = false;
|
|
18
|
-
if (price < 0) {
|
|
19
|
-
negative = true;
|
|
20
|
-
price = -price;
|
|
21
|
-
}
|
|
22
|
-
const integer = Math.floor(price).toString();
|
|
23
|
-
const decimal = (Math.round(+price + 'e' + 2) % 100).toString().padStart(2, '0');
|
|
24
|
-
const formattedPrice = `${negative ? '-' : ''}${integer}.${decimal}`;
|
|
25
|
-
return {
|
|
26
|
-
price: formattedPrice, // 价格字符串
|
|
27
|
-
negative,
|
|
28
|
-
integer, // 整数部分
|
|
29
|
-
decimal, // 小数部分
|
|
30
|
-
number: Number(formattedPrice),
|
|
31
|
-
};
|
|
32
|
-
}
|
package/utils/round.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 四舍五入处理
|
|
3
|
-
* @param {number} val 需要处理的数据
|
|
4
|
-
* @param {number} precision 保留小数位数,默认不保留
|
|
5
|
-
* @returns {number} 处理后的数据
|
|
6
|
-
*/
|
|
7
|
-
export function round(val, precision = 0) {
|
|
8
|
-
if (val.toString().indexOf('e') >= 0) {
|
|
9
|
-
const exponential = val.toString().split('e');
|
|
10
|
-
return Math.round(exponential[0] + 'e' + (+exponential[1] + precision)) / Math.pow(10, precision);
|
|
11
|
-
}
|
|
12
|
-
return Math.round(+val + 'e' + precision) / Math.pow(10, precision);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 四舍五入处理,并保留 2 位小数
|
|
17
|
-
* @param {number} val 需要处理的数据
|
|
18
|
-
* @returns {number} 处理后的数据
|
|
19
|
-
*/
|
|
20
|
-
export function round2(val) {
|
|
21
|
-
return round(val, 2);
|
|
22
|
-
}
|