Skip to content

Commit

Permalink
1.0.47
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaoGongBra committed Oct 30, 2024
1 parent 220f428 commit 1174dc9
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 22 deletions.
1 change: 1 addition & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {}
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "duxui",
"description": "DUXUI库",
"version": "1.0.45",
"version": "1.0.47",
"dependencies": [
"duxapp"
],
Expand Down
17 changes: 17 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# 1.0.47

## List
在小程序端新增虚拟列表功能,这需要手动开启,且有一些使用限制

## Checkbox
新增部分选中属性

## Avatar
修复主题配置不生效的问题

## 主题
修复ui模块主题配置不生效的问题

## Types
修复了一些类型提示

# 1.0.45

## Recorder
Expand Down
3 changes: 2 additions & 1 deletion components/Avatar/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
}

&__text {
text-align: center;
&--s {
font-size: 24px;
font-size: 20px;
}
&--m {
font-size: 28px;
Expand Down
4 changes: 2 additions & 2 deletions components/Button/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CSSProperties, ComponentType, ReactElement } from 'react'
import { ViewProps, ButtonProps } from '@tarojs/components'
import { ViewProps, ButtonProps as TaroButtonProps } from '@tarojs/components'

/** 圆角类型 */
interface type {
Expand Down Expand Up @@ -73,7 +73,7 @@ interface ButtonProps extends ViewProps {
/** 按钮内容 支持文本或者图标 */
children?: string
/** 小程序端 openType 属性 */
openType?: keyof ButtonProps.OpenType
openType?: keyof TaroButtonProps.OpenType
}

/**
Expand Down
1 change: 1 addition & 0 deletions components/DuxuiIcon/icons.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"banxuanze": 59746,
"voice-right": 59083,
"voice-right_01": 59146,
"voice-right_02": 59147,
Expand Down
1 change: 1 addition & 0 deletions components/DuxuiIcon/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ComponentType, Component, CSSProperties } from 'react'

interface names {
'banxuanze'
'voice-right'
'voice-right_01'
'voice-right_02'
Expand Down
2 changes: 1 addition & 1 deletion components/DuxuiIcon/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { font, px } from '@/duxapp/utils'
import icons from './icons.json'
import './index.scss'

font.load('DuxuiIcon', 'https://pictcdn.client.jujiang.me/fonts/DuxuiIcon.1728705176383.ttf')
font.load('DuxuiIcon', 'https://pictcdn.client.jujiang.me/fonts/DuxuiIcon.1729942957972.ttf')

export const DuxuiIcon = ({ name, color, size, style, className, ...props }) => {

Expand Down
5 changes: 5 additions & 0 deletions components/Form/Checkbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ interface CheckboxProps extends SpaceProps {
* 复选框是否被选中
*/
checked?: boolean
/**
* 半选中状态
* checked为假的时候生效
*/
half?: boolean
/**
* 禁用这个选项
*/
Expand Down
23 changes: 18 additions & 5 deletions components/Form/Checkbox.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createContext, useCallback, useContext } from 'react'
import { noop } from '@/duxapp/utils'
import { noop, stopPropagation } from '@/duxapp/utils'
import classNames from 'classnames'
import { Space } from '../Space'
import { Text } from '../Text'
Expand Down Expand Up @@ -57,7 +57,11 @@ const CheckboxGroup = ({
// console.log('12323',value, props)
// }

export const Checkbox = ({ value, label, checked, disabled, children: Child, className, style, ...props }) => {
export const Checkbox = ({
value, label, checked, half,
disabled, children: Child,
className, style, ...props
}) => {
const { check, currentValue } = useContext(context)

const isCheck = checked || currentValue?.includes(value)
Expand All @@ -72,9 +76,18 @@ export const Checkbox = ({ value, label, checked, disabled, children: Child, cla
/>
}

return <Space row items='center' size={8} onClick={() => !disabled && check(value)} className={className} style={style} {...props}>
<Text size={32} type={isCheck ? 'primary' : void 0} color={isCheck ? void 0 : 3}>
<DuxuiIcon name={isCheck ? 'xuanzhong' : 'xuanzekuang'} />
return <Space
row items='center' size={8}
onClick={e => {
if (!disabled) {
stopPropagation(e)
check(value)
}
}}
className={className} style={style} {...props}
>
<Text size={6} type={isCheck || half ? 'primary' : void 0} color={isCheck || half ? void 0 : 3}>
<DuxuiIcon name={isCheck ? 'xuanzhong' : half ? 'banxuanze' : 'xuanzekuang'} />
</Text>
{!!label && <Text>{label}</Text>}
</Space>
Expand Down
16 changes: 12 additions & 4 deletions components/Form/Upload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const ItemView = ({
if (item === src) {
current = i
}
if (mediaImage.some(end => src.endsWith(end))) {
if (isImage(item)) {
return {
url: item
}
Expand All @@ -139,18 +139,26 @@ const ItemView = ({
})
}, [src, value])

if (mediaImage.some(end => src.endsWith(end))) {
if (isImage(src)) {
return <Image className='UIUplod__item__image w-full h-full'
onClick={preview}
src={src}
mode='aspectFit'
/>
} else {
return <Video className='UIUplod__item__image w-full h-full' onClick={preview} src={src} />
return <Video
className='UIUplod__item__image w-full h-full'
onClick={preview}
src={src}
controls={false}
showCenterPlayBtn={false}
/>
}
}

const mediaImage = ['.jpg', '.png', '.gif', '.jpeg']
const mediaImage = ['.jpg', '.png', '.gif', '.jpeg', '.webp']

const isImage = url => mediaImage.some(v => url.split('?')[0].endsWith(v))

export const UploadImage = ({ onChange, value, ...props }) => {

Expand Down
12 changes: 8 additions & 4 deletions components/UploadManage/drive/qiniu.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default (() => {

return () => {
return {
isReady: isReady,
isReady,
configSync: callback => {
config.syncCallback = callback
},
Expand Down Expand Up @@ -160,14 +160,18 @@ export default (() => {
uploadTask.abort()
})

const res_1 = await uploadTask
const dataString = res_1.data
try {
const res_1 = await uploadTask
const dataString = res_1.data
const dataObject = JSON.parse(dataString)

if (res_1.statusCode !== 200) {
throw dataObject
}
dataObject.url = config.host + '/' + dataObject.key
return dataObject
} catch (e) {
console.log('返回值不是有效的JSON数据: ' + dataString)
console.log('上传错误: ', e)
throw e
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/Video/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VideoProps as TaroVideoProps } from '@tarojs/components/types'
import { VideoProps as TaroVideoProps } from '@tarojs/components'
import { ReactNode } from 'react'

interface VideoProps extends TaroVideoProps {
Expand Down
6 changes: 3 additions & 3 deletions config/themeToScss.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ module.exports = theme => {
scssData.avatar.push(`$duxuiAvatarIconSize: ${value.iconSize}px;`)
}
if (value.sizes?.s) {
scssData.avatar.push(`$duxuiAvatarSSize: ${value.sizes.s};`)
scssData.avatar.push(`$duxuiAvatarSSize: ${value.sizes.s}px;`)
}
if (value.sizes?.m) {
scssData.avatar.push(`$duxuiAvatarMSize: ${value.sizes.m};`)
scssData.avatar.push(`$duxuiAvatarMSize: ${value.sizes.m}px;`)
}
if (value.sizes?.l) {
scssData.avatar.push(`$duxuiAvatarLSize: ${value.sizes.l};`)
scssData.avatar.push(`$duxuiAvatarLSize: ${value.sizes.l}px;`)
}
break
}
Expand Down

0 comments on commit 1174dc9

Please sign in to comment.