Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: avartar\steps\video\inputnumber 事件优化 #371

Merged
merged 32 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
466f6fa
fix: 修复Infiniteloading 组件 pullTxt、loadTxt 和 loadMoreTxt 参数无效
junjun666 Aug 18, 2022
6cde211
Merge branch 'jdf2e:main' into main
junjun666 Sep 1, 2022
f2e7bfd
Merge branch 'jdf2e:main' into main
junjun666 Sep 2, 2022
8a6c6d2
Merge branch 'jdf2e:main' into main
junjun666 Sep 5, 2022
e51e7cf
Merge branch 'jdf2e:main' into main
junjun666 Sep 7, 2022
800e9f7
Merge branch 'jdf2e:main' into main
junjun666 Sep 8, 2022
531d5bd
Merge branch 'jdf2e:main' into main
junjun666 Sep 12, 2022
416856a
Merge branch 'jdf2e:main' into main
junjun666 Sep 14, 2022
d76f4ed
feat: taro适配
junjun666 Sep 14, 2022
da7ea2c
fix: 修改文档
junjun666 Sep 14, 2022
1dc4f97
Merge branch 'jdf2e:main' into main
junjun666 Sep 15, 2022
2f974d0
Merge branch 'jdf2e:main' into main
junjun666 Sep 16, 2022
56b913f
Merge branch 'jdf2e:main' into main
junjun666 Sep 16, 2022
3c9494e
Merge branch 'jdf2e:main' into main
junjun666 Sep 19, 2022
0e01d99
feat: 新增uploader属性补齐开发
junjun666 Sep 19, 2022
0526de7
Merge branch 'main' of https://github.com/junjun666/nutui-react into …
junjun666 Sep 19, 2022
c46ae32
fix: 修复两处ts校验
junjun666 Sep 19, 2022
d2e6d49
feat: 代码合并
junjun666 Sep 19, 2022
2d35429
fix: 修改文档版本标注
junjun666 Sep 19, 2022
0e76e23
fix: 修复uploader taro本地ts报错
junjun666 Sep 19, 2022
0c12eb1
Merge branch 'jdf2e:main' into main
junjun666 Sep 20, 2022
566bced
feat: 提交taro适配文档更新
junjun666 Sep 20, 2022
56b23d6
Merge branch 'jdf2e:main' into main
junjun666 Sep 21, 2022
8118974
feat: infiniteloading的taro适配开发
junjun666 Sep 21, 2022
07be7bb
Merge branch 'jdf2e:main' into main
junjun666 Sep 22, 2022
ad138de
fix: 修改ts报错
junjun666 Sep 22, 2022
0078b20
Merge branch 'jdf2e:main' into main
junjun666 Sep 28, 2022
5a93eae
Merge branch 'jdf2e:main' into main
junjun666 Oct 24, 2022
4a8833f
Merge branch 'jdf2e:main' into main
junjun666 Oct 25, 2022
f6562ca
fix: fix/uploader-324
junjun666 Oct 25, 2022
980f2d1
Merge branch 'jdf2e:main' into main
junjun666 Oct 25, 2022
9622756
fix: 提交on事件的绑定切换
junjun666 Oct 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/packages/avatar/__tests__/avatar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ test('alt props', () => {
test('should emit active-avatarror event', () => {
const activeAvatar = jest.fn()
const { getByTestId } = render(
<Avatar data-testid="avatar-click" activeAvatar={activeAvatar} />
<Avatar data-testid="avatar-click" onActiveAvatar={activeAvatar} />
)
fireEvent.click(getByTestId('avatar-click'))
expect(activeAvatar).toBeCalled()
Expand Down
7 changes: 4 additions & 3 deletions src/packages/avatar/avatar.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface AvatarProps extends IComponent {
alt: string
style: React.CSSProperties
activeAvatar: (e: MouseEvent) => void
onActiveAvatar: (e: MouseEvent) => void
onError: (e: any) => void
}

Expand Down Expand Up @@ -56,6 +57,7 @@ export const Avatar: FunctionComponent<
className,
style,
activeAvatar,
onActiveAvatar,
onError,
iconClassPrefix,
iconFontClassName,
Expand Down Expand Up @@ -139,9 +141,8 @@ export const Avatar: FunctionComponent<
}

const clickAvatar: MouseEventHandler<HTMLDivElement> = (e: any) => {
if (props.activeAvatar) {
props.activeAvatar(e)
}
activeAvatar && activeAvatar(e)
onActiveAvatar && onActiveAvatar(e)
}

console.log(
Expand Down
8 changes: 4 additions & 4 deletions src/packages/avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface AvatarProps extends IComponent {
alt: string
style: React.CSSProperties
activeAvatar: (e: MouseEvent) => void
onActiveAvatar: (e: MouseEvent) => void
onError: (e: any) => void
}

Expand Down Expand Up @@ -56,6 +57,7 @@ export const Avatar: FunctionComponent<
className,
style,
activeAvatar,
onActiveAvatar,
onError,
iconClassPrefix,
iconFontClassName,
Expand Down Expand Up @@ -111,7 +113,6 @@ export const Avatar: FunctionComponent<

const avatarLength = (children: any) => {
for (let i = 0; i < children.length; i++) {
console.log('child', children[i], children[i].classList)
if (
children[i] &&
children[i].classList &&
Expand Down Expand Up @@ -140,9 +141,8 @@ export const Avatar: FunctionComponent<
}

const clickAvatar: MouseEventHandler<HTMLDivElement> = (e: any) => {
if (props.activeAvatar) {
props.activeAvatar(e)
}
activeAvatar && activeAvatar(e)
onActiveAvatar && onActiveAvatar(e)
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/packages/avatar/demo.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const AvatarDemo = () => {
</Cell>
<h2>{translated['43f00872']}</h2>
<Cell>
<Avatar icon="my" activeAvatar={activeAvatar} />
<Avatar icon="my" onActiveAvatar={activeAvatar} />
</Cell>
</div>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/packages/avatar/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const AvatarDemo = () => {
</Cell>
<h2>{translated['43f00872']}</h2>
<Cell>
<Avatar icon="my" activeAvatar={activeAvatar} />
<Avatar icon="my" onActiveAvatar={activeAvatar} />
</Cell>
</div>
</>
Expand Down
5 changes: 3 additions & 2 deletions src/packages/avatar/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const App = () => {
}
return (
<>
<Avatar icon="my" activeAvatar={activeAvatar} />
<Avatar icon="my" onActiveAvatar={activeAvatar} />
</>
)
}
Expand Down Expand Up @@ -226,5 +226,6 @@ export default App;

| Event | Description | Type | Arguments |
| ---------------- | ------------ | -------- | -------- |
| activeAvatar | Emitted when cell is clicked | Function | event |
| activeAvatar `v1.3.8(Abandon)` | Emitted when cell is clicked | Function | event |
| onActiveAvatar `v1.3.8` | Emitted when cell is clicked | Function | event |
| onError | Handler when img load error | Function | event |
5 changes: 3 additions & 2 deletions src/packages/avatar/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const App = () => {
}
return (
<>
<Avatar icon="my" activeAvatar={activeAvatar} />
<Avatar icon="my" onActiveAvatar={activeAvatar} />
</>
)
}
Expand Down Expand Up @@ -229,5 +229,6 @@ export default App;

| 字段 | 说明 | 类型 | 回调参数 |
| ---------------- | ------------ | -------- | -------- |
| activeAvatar | 点击头像触发事件 | Function | event |
| activeAvatar `v1.3.8废弃` | 点击头像触发事件 | Function | event |
| onActiveAvatar `v1.3.8` | 点击头像触发事件 | Function | event |
| onError | 图片加载失败的事件 | Function | event |
5 changes: 3 additions & 2 deletions src/packages/avatar/doc.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const App = () => {
}
return (
<>
<Avatar icon="my" activeAvatar={activeAvatar} />
<Avatar icon="my" onActiveAvatar={activeAvatar} />
</>
)
}
Expand Down Expand Up @@ -227,5 +227,6 @@ export default App;

| 字段 | 說明 | 類型 | 回調參數 |
| ---------------- | ------------ | -------- | -------- |
| activeAvatar | 點擊頭像觸發事件 | Function | event |
| activeAvatar `v1.3.8廢棄` | 點擊頭像觸發事件 | Function | event |
| onActiveAvatar `v1.3.8` | 點擊頭像觸發事件 | Function | event |
| onError | 圖片加載失敗的事件 | Function | event |
2 changes: 1 addition & 1 deletion src/packages/barrage/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default App;
| top | Vertical distance of barrage | Number | 10 |
| loop | Loop play | Boolean | true |

### Events
### Events API

| Event | Description | Arguments |
|--------|----------------|--------------|
Expand Down
2 changes: 1 addition & 1 deletion src/packages/barrage/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default App;
| top | 弹幕垂直距离 | Number | 10 |
| loop | 是否循环播放 | Boolean | true |

### Events
### Events API

| 事件名 | 说明 | 回调参数 |
|--------|----------------|--------------|
Expand Down
2 changes: 1 addition & 1 deletion src/packages/barrage/doc.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default App;
| top | 彈幕垂直距離 | Number | 10 |
| loop | 是否循環播放 | Boolean | true |

### Events
### Events API

| 事件名 | 說明 | 回調參數 |
|--------|----------------|--------------|
Expand Down
33 changes: 19 additions & 14 deletions src/packages/inputnumber/__tests__/inputnumber.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ test('should add step 2 when trigger click plus button', () => {
<InputNumber
modelValue={1}
step={2}
overlimit={overlimit}
add={add}
change={change}
onOverlimit={overlimit}
onAdd={add}
onChangeFuc={change}
/>
)
const iconPlus = container.querySelectorAll('.nut-icon-plus')[0]
Expand All @@ -37,9 +37,9 @@ test('should minis step 2 when trigger click minis button', () => {
<InputNumber
modelValue={3}
step={2}
overlimit={overlimit}
reduce={reduce}
change={change}
onOverlimit={overlimit}
onReduce={reduce}
onChangeFuc={change}
/>
)
const iconMinus = container.querySelectorAll('.nut-icon-minus')[0]
Expand All @@ -58,9 +58,9 @@ test('should render max props', () => {
modelValue={100}
min="2"
max="100"
overlimit={overlimit}
add={add}
change={change}
onOverlimit={overlimit}
onAdd={add}
onChangeFuc={change}
/>
)
const iconPlus = container.querySelectorAll('.nut-icon-plus')[0]
Expand All @@ -79,9 +79,9 @@ test('should render min props', () => {
modelValue={2}
min="2"
max="100"
overlimit={overlimit}
reduce={reduce}
change={change}
onOverlimit={overlimit}
onReduce={reduce}
onChangeFuc={change}
/>
)
const iconMinus = container.querySelectorAll('.nut-icon-minus')[0]
Expand All @@ -107,7 +107,7 @@ test('should not trigger click when disabled props to be true', () => {
test('should not focus input when readonly props to be true', () => {
const focus = jest.fn()
const { container } = render(
<InputNumber readonly modelValue={2} focus={focus} />
<InputNumber readonly modelValue={2} onFocus={focus} />
)
const iconMinus = container.querySelectorAll('.nut-icon-minus')[0]
fireEvent.click(iconMinus)
Expand Down Expand Up @@ -138,7 +138,12 @@ test('should update input value when inputValue overlimit', () => {
const change = jest.fn()
const blur = jest.fn()
const { container } = render(
<InputNumber modelValue={2} max="100" change={change} blur={blur} />
<InputNumber
modelValue={2}
max="100"
onChangeFuc={change}
onBlurFuc={blur}
/>
)
const input = container.querySelectorAll('input')[0]
input.value = '200'
Expand Down
8 changes: 6 additions & 2 deletions src/packages/inputnumber/demo.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const InputNumberDemo = () => {
modelValue={inputState.val3}
min="10"
max="20"
overlimit={overlimit}
onOverlimit={overlimit}
/>
</Cell>
<h2>{translated['181965e2']}</h2>
Expand All @@ -137,7 +137,11 @@ const InputNumberDemo = () => {
</Cell>
<h2>{translated['65bafb1d']}</h2>
<Cell>
<InputNumber modelValue={inputState.val7} change={onChange} isAsync />
<InputNumber
modelValue={inputState.val7}
onChangeFuc={onChange}
isAsync
/>
</Cell>
<h2>{translated['7e2394ae']}</h2>
<Cell>
Expand Down
8 changes: 6 additions & 2 deletions src/packages/inputnumber/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const InputNumberDemo = () => {
modelValue={inputState.val3}
min="10"
max="20"
overlimit={overlimit}
onOverlimit={overlimit}
/>
</Cell>
<h2>{translated['181965e2']}</h2>
Expand All @@ -128,7 +128,11 @@ const InputNumberDemo = () => {
</Cell>
<h2>{translated['65bafb1d']}</h2>
<Cell>
<InputNumber modelValue={inputState.val7} change={onChange} isAsync />
<InputNumber
modelValue={inputState.val7}
onChangeFuc={onChange}
isAsync
/>
</Cell>
<h2>{translated['7e2394ae']}</h2>
<Cell>
Expand Down
22 changes: 14 additions & 8 deletions src/packages/inputnumber/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const App = () => {
}
return (
<>
<InputNumber modelValue={inputState.val3} min="10" max="20" overlimit={overlimit} />
<InputNumber modelValue={inputState.val3} min="10" max="20" onOverlimit={overlimit} />
</>
)
}
Expand Down Expand Up @@ -223,7 +223,7 @@ const App = () => {
}
return (
<>
<InputNumber modelValue={inputState.val7} change={onChange} isAsync />
<InputNumber modelValue={inputState.val7} onChangeFuc={onChange} isAsync />
</>
)
}
Expand Down Expand Up @@ -280,9 +280,15 @@ export default App;

| Event | Description | Arguments |
|-----------|------------------------|--------------------------------|
| add | Triggered when the Add button is clicked | event: Event |
| reduce | Triggered when the decrease button is clicked | event: Event |
| overlimit | Triggered when an unavailable button is clicked | event: Event |
| change | Triggered when the value changes | value: number , event : Event |
| blur | Triggered when the input box blur | event: Event |
| focus | Triggered when the input box focus | event: Event |
| add `v1.3.8(Abandon)` | Triggered when the Add button is clicked | event: Event |
| reduce `v1.3.8(Abandon)` | Triggered when the decrease button is clicked | event: Event |
| overlimit `v1.3.8(Abandon)` | Triggered when an unavailable button is clicked | event: Event |
| change `v1.3.8(Abandon)` | Triggered when the value changes | value: number , event : Event |
| blur `v1.3.8(Abandon)` | Triggered when the input box blur | event: Event |
| focus `v1.3.8(Abandon)` | Triggered when the input box focus | event: Event |
| onAdd `v1.3.8` | Triggered when the Add button is clicked | event: Event |
| onReduce `v1.3.8` | Triggered when the decrease button is clicked | event: Event |
| onOverlimit `v1.3.8` | Triggered when an unavailable button is clicked | event: Event |
| onChangeFuc `v1.3.8` | Triggered when the value changes | value: number , event : Event |
| onBlurFuc `v1.3.8` | Triggered when the input box blur | event: Event |
| onFocus `v1.3.8` | Triggered when the input box focus | event: Event |
22 changes: 14 additions & 8 deletions src/packages/inputnumber/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const App = () => {
}
return (
<>
<InputNumber modelValue={inputState.val3} min="10" max="20" overlimit={overlimit} />
<InputNumber modelValue={inputState.val3} min="10" max="20" onOverlimit={overlimit} />
</>
)
}
Expand Down Expand Up @@ -222,7 +222,7 @@ const App = () => {
}
return (
<>
<InputNumber modelValue={inputState.val7} change={onChange} isAsync />
<InputNumber modelValue={inputState.val7} onChangeFuc={onChange} isAsync />
</>
)
}
Expand Down Expand Up @@ -279,9 +279,15 @@ export default App;

| 事件名 | 说明 | 回调参数 |
|-----------|------------------------|--------------------------------|
| add | 点击增加按钮时触发 | event: Event |
| reduce | 点击减少按钮时触发 | event: Event |
| overlimit | 点击不可用的按钮时触发 | event: Event |
| change | 值改变时触发 | value: number , event : Event |
| blur | 输入框失去焦点时触发 | event: Event |
| focus | 输入框获得焦点时触发 | event: Event |
| add `v1.3.8废弃` | 点击增加按钮时触发 | event: Event |
| onAdd `v1.3.8` | 点击增加按钮时触发 | event: Event |
| reduce `v1.3.8废弃` | 点击减少按钮时触发 | event: Event |
| onReduce `v1.3.8` | 点击减少按钮时触发 | event: Event |
| overlimit `v1.3.8废弃` | 点击不可用的按钮时触发 | event: Event |
| onOverlimit `v1.3.8` | 点击不可用的按钮时触发 | event: Event |
| change `v1.3.8废弃` | 值改变时触发 | value: number , event : Event |
| onChangeFuc `v1.3.8` | 值改变时触发 | value: number , event : Event |
| blur `v1.3.8废弃` | 输入框失去焦点时触发 | event: Event |
| onBlurFuc `v1.3.8` | 输入框失去焦点时触发 | event: Event |
| focus `v1.3.8废弃` | 输入框获得焦点时触发 | event: Event |
| onFocus `v1.3.8` | 输入框获得焦点时触发 | event: Event |
Loading