Skip to content

Commit

Permalink
feat(numberkeyboard): harmony cpp adaption (#2799)
Browse files Browse the repository at this point in the history
* feat(numberkeyboard): harmony cpp adaption

* feat(numberkeyboard): harmony cpp adaption

* fix: sth about re
  • Loading branch information
Alex-huxiyang authored Dec 11, 2024
1 parent e8fa0d4 commit 8564857
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@
"author": "oasis-cloud"
},
{
"version": "2.0.0",
"version": "3.0.0",
"name": "NumberKeyboard",
"type": "component",
"cName": "数字键盘",
Expand Down
3 changes: 2 additions & 1 deletion src/packages/numberkeyboard/demos/taro/demo4.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState } from 'react'
import { Cell, NumberKeyboard } from '@nutui/nutui-react-taro'
import { View } from '@tarojs/components'

const Demo4 = () => {
const [visible, setVisible] = useState(false)
Expand All @@ -15,7 +16,7 @@ const Demo4 = () => {
<NumberKeyboard
visible={visible}
title="标题"
rightActions={<span>Done</span>}
rightActions={<View>Done</View>}
custom={['.']}
onChange={onChange}
onDelete={onDelete}
Expand Down
11 changes: 10 additions & 1 deletion src/packages/numberkeyboard/numberkeyboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
&-title {
color: $color-title;
display: inline-block;
font-size: $popup-title-font-size;
}

&-close {
position: absolute;
display: block;
right: 0;
top: 50%;
transform: translateY(-50%);
padding: $numberkeyboard-header-close-padding;
color: $numberkeyboard-header-close-color;
font-size: $numberkeyboard-header-close-font-size;
Expand All @@ -47,7 +50,12 @@
&-wrapper {
position: relative;
flex: 1;
/* #ifdef harmony */
width: 33%;
/* #endif */
/* #ifndef harmony */
flex-basis: 33%;
/* #endif */
box-sizing: border-box;
padding: 0 6px 6px 0;
background-color: $numberkeyboard-wrapper-background-color;
Expand Down Expand Up @@ -76,9 +84,10 @@
&-sidebar {
display: flex;
flex: 1;
flex-basis: 33%;
flex-direction: column;

.nut-numberkeyboard-body-wrapper {
width: 100%;
.key {
position: absolute;
top: 0;
Expand Down
13 changes: 7 additions & 6 deletions src/packages/numberkeyboard/numberkeyboard.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Popup from '@/packages/popup/index.taro'
import { PopupProps } from '@/packages/popup/popup.taro'
import { useConfig } from '@/packages/configprovider/configprovider.taro'
import { ComponentDefaults } from '@/utils/typings'
import { mergeProps } from '@/utils/merge-props'

export interface NumberKeyboardProps extends PopupProps {
visible: boolean
Expand Down Expand Up @@ -49,7 +50,7 @@ export const NumberKeyboard: FunctionComponent<
onClose,
onConfirm,
...rest
} = { ...defaultProps, ...props }
} = mergeProps(defaultProps, props)
const classPrefix = 'nut-numberkeyboard'

const getBasicKeys = () => {
Expand Down Expand Up @@ -86,8 +87,8 @@ export const NumberKeyboard: FunctionComponent<
const style = {
background: `url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAnCAYAAABJ0cukAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNT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C0tDQo=') no-repeat center`,
backgroundSize: '100% 100%',
width: '28px',
height: '24px',
width: 28,
height: 24,
}
return <View style={style} />
}
Expand Down Expand Up @@ -122,7 +123,7 @@ export const NumberKeyboard: FunctionComponent<
switch (item.type) {
case 'num':
case 'custom':
return <View>{item.id}</View>
return <>{item.id}</>
case 'delete':
return <DeleteIcon />
case 'close':
Expand Down Expand Up @@ -168,12 +169,12 @@ export const NumberKeyboard: FunctionComponent<
<View className={`${classPrefix}-header`}>
<View className={`${classPrefix}-header-title`}>{title}</View>
{type === 'default' && (
<span
<View
className={`${classPrefix}-header-close`}
onClick={onConfirm}
>
{rightActions || locale.done}
</span>
</View>
)}
</View>
)}
Expand Down

0 comments on commit 8564857

Please sign in to comment.