nutui-uniapp
Advanced tools
Comparing version 1.1.10 to 1.2.0
@@ -1,2 +0,2 @@ | ||
import { type ComponentInternalInstance } from 'vue' | ||
import type { ComponentInternalInstance } from 'vue' | ||
import { useSelectorQuery } from './useSelectorQuery' | ||
@@ -3,0 +3,0 @@ |
@@ -89,14 +89,2 @@ import { isDef, isObject } from './is' | ||
export function deepMerge(target: any, newObj: any) { | ||
Object.keys(newObj).forEach((key) => { | ||
const targetValue = target[key] | ||
const newObjValue = newObj[key] | ||
if (isObject(targetValue) && isObject(newObjValue)) | ||
deepMerge(targetValue, newObjValue) | ||
else | ||
target[key] = newObjValue | ||
}) | ||
return target | ||
} | ||
export function myFixed(num: any, digit = 2) { | ||
@@ -103,0 +91,0 @@ if (Object.is(Number.parseFloat(num), Number.NaN)) |
@@ -15,5 +15,5 @@ /** | ||
/** | ||
* 是否为闫年 | ||
* @return {Boolse} true|false | ||
*/ | ||
* 是否为闫年 | ||
* @return {Boolse} true|false | ||
*/ | ||
export function isLeapYear(y: number): boolean { | ||
@@ -25,3 +25,3 @@ return (y % 4 === 0 && y % 100 !== 0) || y % 400 === 0 | ||
* 返回星期数 | ||
* @return {String} | ||
* @return {string} | ||
*/ | ||
@@ -37,3 +37,3 @@ export function getWhatDay(year: number, month: number, day: number): string { | ||
* 返回星期数 | ||
* @return {Number} | ||
* @return {number} | ||
*/ | ||
@@ -51,3 +51,3 @@ export function getMonthPreDay(year: number, month: number): number { | ||
* 返回月份天数 | ||
* @return {Number} | ||
* @return {number} | ||
*/ | ||
@@ -86,3 +86,3 @@ export function getMonthDays(year: string, month: string): number { | ||
* 返回日期格式字符串 | ||
* @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推 | ||
* @param {number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推 | ||
* @return {string} '2014-12-31' | ||
@@ -100,3 +100,3 @@ */ | ||
* 时间比较 | ||
* @return {Boolean} | ||
* @return {boolean} | ||
*/ | ||
@@ -114,3 +114,3 @@ export function compareDate(date1: string, date2: string): boolean { | ||
* 时间是否相等 | ||
* @return {Boolean} | ||
* @return {boolean} | ||
*/ | ||
@@ -136,3 +136,3 @@ export function isEqual(date1: string, date2: string): boolean { | ||
} | ||
export function getYearWeek(year: string, month: string, date: string, firstDayOfWeek = 0): number { | ||
export function getYearWeek(year: string, month: string, date: string): number { | ||
const dateNow = new Date(Number(year), Number.parseInt(month) - 1, Number(date)) | ||
@@ -139,0 +139,0 @@ const dateFirst = new Date(Number(year), 0, 1) |
@@ -5,12 +5,11 @@ import { isPromise } from './is' | ||
export function funInterceptor(interceptor: Interceptor | undefined, | ||
{ | ||
args = [], | ||
done, | ||
canceled, | ||
}: { | ||
args?: unknown[] | ||
done: (val?: any) => void | ||
canceled?: () => void | ||
}) { | ||
export function funInterceptor(interceptor: Interceptor | undefined, { | ||
args = [], | ||
done, | ||
canceled, | ||
}: { | ||
args?: unknown[] | ||
done: (val?: any) => void | ||
canceled?: () => void | ||
}) { | ||
if (interceptor) { | ||
@@ -17,0 +16,0 @@ const returnVal = interceptor(null, ...args) |
import { hyphenate } from './common' | ||
import { isNumber, isString } from './is' | ||
import { isEmpty, isNumber, isString } from './is' | ||
@@ -46,1 +46,67 @@ export type NormalizedStyle = Record<string, string | number> | ||
} | ||
/** | ||
* @description 样式转换 | ||
* 对象转字符串,或者字符串转对象 | ||
* @param {object | string} customStyle 需要转换的目标 | ||
* @param {string} target 转换的目的,object-转为对象,string-转为字符串 | ||
* @returns {object|string} | ||
*/ | ||
export function addStyle(customStyle: string | object, target = 'object') { | ||
// 字符串转字符串,对象转对象情形,直接返回 | ||
if ( | ||
isEmpty(customStyle) | ||
|| (typeof customStyle === 'object' && target === 'object') | ||
|| (target === 'string' && typeof customStyle === 'string') | ||
) | ||
return customStyle | ||
// 字符串转对象 | ||
if (target === 'object') { | ||
// 去除字符串样式中的两端空格(中间的空格不能去掉,比如padding: 20px 0如果去掉了就错了),空格是无用的 | ||
customStyle = trim(customStyle) | ||
// 根据";"将字符串转为数组形式 | ||
const styleArray = customStyle.split(';') | ||
const style: any = {} | ||
// 历遍数组,拼接成对象 | ||
for (let i = 0; i < styleArray.length; i++) { | ||
// 'font-size:20px;color:red;',如此最后字符串有";"的话,会导致styleArray最后一个元素为空字符串,这里需要过滤 | ||
if (styleArray[i]) { | ||
const item = styleArray[i].split(':') | ||
style[trim(item[0])] = trim(item[1]) | ||
} | ||
} | ||
return style | ||
} | ||
// 这里为对象转字符串形式 | ||
let string = '' | ||
for (const i in customStyle as any) { | ||
// 驼峰转为中划线的形式,否则css内联样式,无法识别驼峰样式属性名 | ||
const key = i.replace(/([A-Z])/g, '-$1').toLowerCase() | ||
string += `${key}:${customStyle[i]};` | ||
} | ||
// 去除两端空格 | ||
return trim(string) | ||
} | ||
/** | ||
* @description 去除空格 | ||
* @param String str 需要去除空格的字符串 | ||
* @param String pos both(左右)|left|right|all 默认both | ||
*/ | ||
export function trim(str: string, pos = 'both') { | ||
str = String(str) | ||
if (pos === 'both') | ||
return str.replace(/^\s+|\s+$/g, '') | ||
if (pos === 'left') | ||
return str.replace(/^\s*/, '') | ||
if (pos === 'right') | ||
return str.replace(/(\s*$)/g, '') | ||
if (pos === 'all') | ||
return str.replace(/\s+/g, '') | ||
return str | ||
} |
@@ -60,3 +60,4 @@ import type { ExtractPropTypes, PropType } from 'vue' | ||
return { | ||
item, index, | ||
item, | ||
index, | ||
} | ||
@@ -63,0 +64,0 @@ }, |
import type { CascaderConfig, CascaderOption, convertConfig } from './types' | ||
export function formatTree(tree: CascaderOption[], | ||
parent: CascaderOption | null, | ||
config: CascaderConfig): CascaderOption[] { | ||
export function formatTree(tree: CascaderOption[], parent: CascaderOption | null, config: CascaderConfig): CascaderOption[] { | ||
return tree.map((node: CascaderOption) => { | ||
@@ -7,0 +5,0 @@ const { value: valueKey = 'value', text: textKey = 'text', children: childrenKey = 'children' } = config |
import type { ExtractPropTypes, PropType } from 'vue' | ||
import { commonProps } from '../_utils' | ||
import { commonProps, isObject, isString } from '../_utils' | ||
import type { ConfirmTextType, InputFormatTrigger, InputMode, InputType } from './type' | ||
@@ -94,10 +94,10 @@ | ||
export const inputEmits = { | ||
'click': (evt: any) => evt, | ||
'clickInput': (evt: any) => evt, | ||
'blur': (evt: any) => evt, | ||
'focus': (evt: any) => evt, | ||
'clear': (val: string, evt: any) => evt, | ||
'click': (evt: any) => isObject(evt), | ||
'clickInput': (evt: any) => isObject(evt), | ||
'blur': (evt: any) => isObject(evt), | ||
'focus': (evt: any) => isObject(evt), | ||
'clear': (_val: string) => isString(_val), | ||
'keypress': () => true, | ||
'confirm': (val: string, val2: any) => true, | ||
'update:modelValue': (val1?: string, val2?: any) => true, | ||
'confirm': (_val: string, _val2: any) => true, | ||
'update:modelValue': (_val1?: string, _val2?: any) => true, | ||
} | ||
@@ -104,0 +104,0 @@ |
import { type ComputedRef, type SetupContext, computed, reactive, toRefs, watch, watchEffect } from 'vue' | ||
import { PREFIX } from '../_constants' | ||
import { animationName } from '../_constants/types' | ||
import { type PopupEmits, type PopupProps } from './popup' | ||
import type { PopupEmits, PopupProps } from './popup' | ||
@@ -74,3 +74,3 @@ const initIndex = 500 | ||
const onClickOverlay = (e: Event) => { | ||
const onClickOverlay = () => { | ||
emit('click-overlay') | ||
@@ -77,0 +77,0 @@ if (props.closeOnClickOverlay) |
@@ -74,2 +74,6 @@ import type { ExtractPropTypes, PropType } from 'vue' | ||
}, | ||
cursorSpacing: { | ||
type: Number, | ||
default: 0, | ||
}, | ||
} | ||
@@ -80,13 +84,13 @@ | ||
export const searchbarEmits = { | ||
'update:modelValue': (val: string | number, event: Event) => true, | ||
'change': (val: string | number, event: Event) => true, | ||
'blur': (val: string | number, event: Event) => true, | ||
'focus': (val: string | number, event: Event) => true, | ||
'clear': (val: string | number) => true, | ||
'search': (val: string | number) => true, | ||
'clickInput': (event: Event) => true, | ||
'clickLeftIcon': (val: string | number, event: Event) => true, | ||
'clickRightIcon': (val: string | number, event: Event) => true, | ||
'update:modelValue': (_val: string | number, _event: Event) => true, | ||
'change': (_val: string | number, _event: Event) => true, | ||
'blur': (_val: string | number, _event: Event) => true, | ||
'focus': (_val: string | number, _event: Event) => true, | ||
'clear': (_val: string | number) => true, | ||
'search': (_val: string | number) => true, | ||
'clickInput': (_event: Event) => true, | ||
'clickLeftIcon': (_val: string | number, _event: Event) => true, | ||
'clickRightIcon': (_val: string | number, _event: Event) => true, | ||
} | ||
export type SearchbarEmits = typeof searchbarEmits |
import type { ExtractPropTypes } from 'vue' | ||
import { isBoolean } from '../_utils' | ||
import { commonProps, isH5 } from '../_utils' | ||
export const stickyProps = { | ||
top: { | ||
type: [Number, String], | ||
default: 0, | ||
}, | ||
...commonProps, | ||
zIndex: { | ||
type: [Number, String], | ||
default: 99, | ||
default: '', | ||
}, | ||
scrollTop: { | ||
offsetTop: { | ||
type: [Number, String], | ||
default: 1, | ||
default: 0, | ||
}, | ||
customNavHeight: { | ||
type: [String, Number], | ||
// H5端的导航栏属于“自定义”导航栏的范畴,因为它是非原生的,与普通元素一致 | ||
default: isH5 ? 44 : 0, | ||
}, | ||
// 是否开启吸顶功能 | ||
disabled: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
// 吸顶区域的背景颜色 | ||
bgColor: { | ||
type: String, | ||
default: 'transparent', | ||
}, | ||
// 列表中的索引值 | ||
index: { | ||
type: [String, Number], | ||
default: '', | ||
}, | ||
} | ||
export type StickyProps = ExtractPropTypes<typeof stickyProps> | ||
export const stickyEmits = { | ||
change: (isFixed: boolean) => isBoolean(isFixed), | ||
} | ||
export type StickyEmits = typeof stickyEmits |
@@ -49,3 +49,4 @@ import type { ExtractPropTypes } from 'vue' | ||
return { | ||
val, evt, | ||
val, | ||
evt, | ||
} | ||
@@ -52,0 +53,0 @@ }, |
@@ -48,3 +48,4 @@ import type { ExtractPropTypes } from 'vue' | ||
return { | ||
val, index, | ||
val, | ||
index, | ||
} | ||
@@ -51,0 +52,0 @@ }, |
@@ -85,11 +85,10 @@ import type { SetupContext } from 'vue' | ||
export function getClassNames(name: string, | ||
{ | ||
enterClass, | ||
enterActiveClass, | ||
enterToClass, | ||
leaveClass, | ||
leaveActiveClass, | ||
leaveToClass, | ||
}: IClassNameProps): IClassNames { | ||
export function getClassNames(name: string, { | ||
enterClass, | ||
enterActiveClass, | ||
enterToClass, | ||
leaveClass, | ||
leaveActiveClass, | ||
leaveToClass, | ||
}: IClassNameProps): IClassNames { | ||
const defaultClassNames = getDefaultClassNames(name) | ||
@@ -96,0 +95,0 @@ return { |
@@ -1,5 +0,1 @@ | ||
import { useTranslate } from '../../locale' | ||
const { translate } = useTranslate('nut-uploader') | ||
export type SizeType = 'original' | 'compressed' | ||
@@ -16,3 +12,3 @@ export type SourceType = 'album' | 'camera' | ||
uid: string | ||
uid?: string | ||
@@ -27,5 +23,5 @@ name: string | ||
percentage: string | number | ||
percentage?: string | number | ||
formData: any | ||
formData?: any | ||
} |
@@ -48,7 +48,11 @@ import type { ExtractPropTypes, PropType } from 'vue' | ||
onChange: { type: Function }, | ||
// // 当accept为video时生效,是否压缩视频,默认为true(默认 true ) | ||
// compressed: { type: Boolean, default: true }, | ||
// 当accept为video时生效,拍摄视频最长拍摄时间,单位秒(默认 60 ) | ||
/** | ||
* 当accept为video时生效,是否压缩视频,默认为true(默认 true ) | ||
* compressed: { type: Boolean, default: true }, | ||
* 当accept为video时生效,拍摄视频最长拍摄时间,单位秒(默认 60 ) | ||
*/ | ||
maxDuration: { type: [Number, String], default: 60 }, | ||
// 所选的图片的尺寸, 可选值为original compressed | ||
/** | ||
* 所选的图片的尺寸, 可选值为original compressed | ||
*/ | ||
sizeType: { | ||
@@ -58,3 +62,5 @@ type: Array as PropType<SizeType[]>, | ||
}, | ||
// 当accept为video时生效,可选值为back或front | ||
/** | ||
* 当accept为video时生效,可选值为back或front | ||
*/ | ||
camera: { | ||
@@ -61,0 +67,0 @@ type: String as PropType<'back' | 'front' | undefined>, |
@@ -117,7 +117,2 @@ // For this project development | ||
} | ||
@@ -128,2 +123,2 @@ | ||
export { } | ||
export { } |
@@ -5,3 +5,3 @@ { | ||
"displayName": "nutui-uniapp", | ||
"version": "1.1.10", | ||
"version": "1.2.0", | ||
"description": "京东风格的轻量级移动端 Uniapp、Vue3 组件库(支持小程序开发)", | ||
@@ -33,4 +33,4 @@ "author": "yang1206 <y1149221897@outlook.com>", | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.mjs" | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs" | ||
}, | ||
@@ -48,8 +48,8 @@ "./package.json": "./package.json", | ||
"files": [ | ||
"README.md", | ||
"components", | ||
"dist", | ||
"styles", | ||
"components", | ||
"README.md", | ||
"global.d.ts", | ||
"locale/**", | ||
"global.d.ts" | ||
"styles" | ||
], | ||
@@ -56,0 +56,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1802752
565
16236