Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondYuan authored and ottomao committed Nov 13, 2023
1 parent 8a636f7 commit 5c63cc5
Show file tree
Hide file tree
Showing 42 changed files with 1,068 additions and 38 deletions.
8 changes: 3 additions & 5 deletions compiled/alipay/src/Input/Textarea/index.axml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<view
class="ant-textarea {{ disabled ? 'ant-textarea-disabled' : '' }} {{ className ? className : '' }} {{ selfFocus ? (focusClassName ? focusClassName : '') : '' }}"
class="ant-textarea {{ disabled ? 'ant-textarea-disabled' : '' }} {{ className ? className : '' }} {{ selfFocus ? focusClassName ? focusClassName : '' : '' }}"
style="{{ style || '' }};{{ focusStyle || '' }}">
<view class="ant-textarea-line">
<textarea
enableNative="{{ enableNative }}"
name="{{ name }}"
class="ant-textarea-content"
disabled="{{ disabled }}"
value="{{ typeof mixin.value === 'undefined' ? '' : mixin.value }}"
value="{{ mixin.value || '' }}"
placeholder="{{ placeholder }}"
placeholder-class="ant-textarea-placeholder {{ placeholderClassName ? placeholderClassName : '' }}"
placeholder-style="{{ placeholderStyle ? placeholderStyle : '' }}"
Expand All @@ -24,9 +24,7 @@
onBlur="onBlur" />
<view
a:if="{{ allowClear }}"
class="ant-textarea-clear {{ mixin.value && mixin.value.length > 0
? 'ant-textarea-clear-show'
: 'ant-textarea-clear-hidden' }}"
class="ant-textarea-clear {{ mixin.value && mixin.value.length > 0 ? 'ant-textarea-clear-show' : 'ant-textarea-clear-hidden' }}"
onTap="onClear">
<icon
className="ant-textarea-clear-icon"
Expand Down
1 change: 0 additions & 1 deletion compiled/alipay/src/Input/Textarea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ mountComponent<TextareaProps>(Textarea, {
allowClear: null,
controlled: null,
enableNative: false,
maxLength: null,
inputClassName: null,
disabled: null,
inputStyle: null,
Expand Down
6 changes: 2 additions & 4 deletions compiled/alipay/src/Input/index.axml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<view
class="ant-input {{ disabled ? 'ant-input-disabled' : '' }} {{ className ? className : '' }} {{ selfFocus ? (focusClassName ? focusClassName : '') : '' }}"
class="ant-input {{ disabled ? 'ant-input-disabled' : '' }} {{ className ? className : '' }} {{ selfFocus ? focusClassName ? focusClassName : '' : '' }}"
style="{{ style || '' }};{{ focusStyle || '' }}">
<view class="ant-input-prefix">
<slot name="prefix">{{ prefix }}</slot>
Expand Down Expand Up @@ -32,9 +32,7 @@
onBlur="onBlur" />
<view
a:if="{{ allowClear }}"
class="ant-input-clear {{ mixin.value && mixin.value.length > 0
? 'ant-input-clear-show'
: 'ant-input-clear-hidden' }}"
class="ant-input-clear {{ mixin.value && mixin.value.length > 0 ? 'ant-input-clear-show' : 'ant-input-clear-hidden' }}"
onTap="onClear">
<icon
className="ant-input-clear-icon"
Expand Down
8 changes: 1 addition & 7 deletions compiled/alipay/src/Popup/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
a:if="{{ showMask }}"
class="ant-popup-mask {{ maskClassName || '' }} {{ closing && !visible ? 'ant-popup-mask-closing' : '' }}"
onTap="onTapMask"
style="{{ animation
? '-webkit-animation-duration:' +
duration +
'ms; animation-duration:' +
duration +
'ms;'
: '' }} {{ maskStyle || '' }}" />
style="{{ animation ? '-webkit-animation-duration:' + duration + 'ms; animation-duration:' + duration + 'ms;' : '' }} {{ maskStyle || '' }}" />
<view
class="ant-popup-content ant-popup-{{ animationType }}-{{ position }} {{ closing ? 'ant-popup-' + animationType + '-' + position + '-close' : '' }}"
style="{{ utils.getContentStyle(position, animation, duration, width, height) }}"
Expand Down
8 changes: 2 additions & 6 deletions compiled/alipay/src/Stepper/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
class="ant-stepper {{ className ? className : '' }}"
style="{{ style }}">
<ant-button
className="ant-stepper-button ant-stepper-button-down {{ disabled || (mixin.value !== '' && mixin.value <= min)
? 'ant-stepper-button-disabled'
: '' }}"
className="ant-stepper-button ant-stepper-button-down {{ disabled || mixin.value !== '' && mixin.value <= min ? 'ant-stepper-button-disabled' : '' }}"
activeClassName="ant-stepper-button-hover"
icon="MinusOutline"
type="text"
Expand All @@ -29,9 +27,7 @@
value="{{ mixin.value }}" />
</view>
<ant-button
className="ant-stepper-button ant-stepper-button-up {{ disabled || (mixin.value !== '' && mixin.value >= max)
? 'ant-stepper-button-disabled'
: '' }}"
className="ant-stepper-button ant-stepper-button-up {{ disabled || mixin.value !== '' && mixin.value >= max ? 'ant-stepper-button-disabled' : '' }}"
activeClassName="ant-stepper-button-hover"
icon="AddOutline"
type="text"
Expand Down
34 changes: 34 additions & 0 deletions compiled/wechat/demo/pages/Input/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Page({
data: {
value: '',
money: '',
},
onChange: function (value, e) {
console.log(value, e);
},
handleChange: function (value) {
this.setData({
value: value,
});
},
handleMoney: function (value) {
console.log(value);
if (isNaN(Number(value))) {
return;
}
this.setData({
money: value,
});
},
clear: function () {
this.setData({
value: '',
});
},
handleRef: function (input) {
this.input = input;
},
clearByInputRef: function () {
this.input.update('');
}
});
8 changes: 8 additions & 0 deletions compiled/wechat/demo/pages/Input/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"defaultTitle": "Input",
"usingComponents": {
"ant-input": "../../../src/Input/index",
"ant-button": "../../../src/Button/index",
"container": "../../../src/Container/index"
}
}
76 changes: 76 additions & 0 deletions compiled/wechat/demo/pages/Input/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<container title="基础用法">
<ant-input
placeholder="请输入内容"
bind:change="onChange" />
</container>

<container title="初始值">
<ant-input
placeholder="请输入内容"
defaultValue="这是antd mini小程序组件"
bind:change="onChange" />
</container>

<container title="带清除按钮">
<ant-input
placeholder="请输入内容"
allowClear />
</container>

<container title="带有前缀后缀">
<ant-input
placeholder="请输入内容"
bind:change="onChange"
allowClear>
<view slot="prefix">¥</view>
<view slot="suffix">RMB</view>
</ant-input>
</container>

<container title="禁用状态">
<ant-input
placeholder="被禁用的输入框"
disabled="{{ true }}" />
</container>

<container title="受控模式">
<ant-input
value="{{ value }}"
placeholder="请输入内容"
allowClear
bind:change="handleChange" />
<ant-button
bind:tap="clear"
inline
size="small">
clear
</ant-button>
</container>

<container title="受控模式-输入金额">
<ant-input
placeholder="请输入金额"
value="{{ money }}"
bind:change="handleMoney"
type="digit"
className="input money"
focusClassName="border">
<view slot="prefix">¥</view>
<view slot="suffix">RMB</view>
</ant-input>
</container>

<container title="非受控模式通过ref修改input">
<ant-input
placeholder="请输入内容"
bind:change="onChange"
ref="handleRef" />

<view>
<ant-button
inline
bind:tap="clearByInputRef">
clear
</ant-button>
</view>
</container>
15 changes: 15 additions & 0 deletions compiled/wechat/demo/pages/Input/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.input {
padding: 4px 0 4px 0;
border-radius: 4px;
border: 1px solid transparent;
transition: all 1s;
}
.money {
width: 180px;
}
.border {
border-color: #1677ff;
}
button {
margin-top: 8px;
}
34 changes: 34 additions & 0 deletions compiled/wechat/demo/pages/InputCustom/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Page({
data: {
value: '',
money: '',
},
onChange: function (value, e) {
console.log(value, e);
},
handleChange: function (value) {
this.setData({
value: value,
});
},
handleMoney: function (value) {
console.log(value);
if (isNaN(Number(value))) {
return;
}
this.setData({
money: value,
});
},
clear: function () {
this.setData({
value: '',
});
},
handleRef: function (input) {
this.input = input;
},
clearByInputRef: function () {
this.input.update('');
}
});
9 changes: 9 additions & 0 deletions compiled/wechat/demo/pages/InputCustom/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"defaultTitle": "Input",
"usingComponents": {
"ant-input": "../../../src/Input/index",
"ant-textarea": "../../../src/Input/Textarea/index",
"ant-icon": "../../../src/Icon/index",
"container": "../../../src/Container/index"
}
}
42 changes: 42 additions & 0 deletions compiled/wechat/demo/pages/InputCustom/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<container title="带有border">
<ant-input
className="custom"
placeholder="请输入内容"
bind:change="onChange" />

<ant-input
className="custom"
placeholder="请输入内容"
bind:change="onChange">
<ant-icon
type="SearchOutline"
slot="prefix" />
<ant-icon
type="AudioOutline"
slot="suffix" />
</ant-input>

<ant-textarea
className="custom"
placeholder="请输入内容"
bind:change="onChange" />
</container>

<container title="自定义颜色">
<ant-input
className="custom-color"
placeholder="请输入内容"
bind:change="onChange" />

<ant-textarea
className="custom-color"
placeholder="请输入内容"
bind:change="onChange" />
</container>

<container title="自定义placeholderClassName">
<ant-input
placeholderClassName="placeholder"
placeholder="请输入内容"
bind:change="onChange" />
</container>
23 changes: 23 additions & 0 deletions compiled/wechat/demo/pages/InputCustom/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.custom {
border: 1px solid #eeeeee;
padding: 4px;
border-radius: 4px;
margin-bottom: 12px;
}
.placeholder {
color: #333333;
opacity: 0.7;
font-size: 16px;
}
.custom-color {
margin-bottom: 12px;
}
.custom-color input,
.custom-color textarea {
padding: 4px;
background: #f5f5f5;
border-radius: 4px;
}
textarea {
min-height: 100px;
}
10 changes: 10 additions & 0 deletions compiled/wechat/demo/pages/InputSearchBar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Page({
onChange: function (value, e) {
console.log(value, e);
},
onConfirm: function (value) {
my.alert({
content: value,
});
}
});
7 changes: 7 additions & 0 deletions compiled/wechat/demo/pages/InputSearchBar/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"defaultTitle": "Input",
"usingComponents": {
"ant-input": "../../../src/Input/index",
"icon": "../../../src/Icon/index"
}
}
20 changes: 20 additions & 0 deletions compiled/wechat/demo/pages/InputSearchBar/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<view class="container">
<ant-input
placeholder="请输入内容"
bind:change="onChange"
className="search-bar"
focusClassName="search-bar-focus"
confirm-type="search"
allowClear
focus
onConfirm="onConfirm">
<icon
slot="prefix"
type="SearchOutline" />

<icon
slot="suffix"
type="AudioOutline" />
</ant-input>
<view class="cancel">取消</view>
</view>
19 changes: 19 additions & 0 deletions compiled/wechat/demo/pages/InputSearchBar/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.container {
display: flex;
align-items: center;
padding: 16px;
}
.search-bar {
padding: 4px 0 4px 0;
border-radius: 4px;
border: 1px solid transparent;
transition: all 0.4s;
flex: 1;
}
.search-bar-focus {
border-color: #1677ff;
}
.cancel {
color: #333333;
margin-left: 8px;
}
Loading

0 comments on commit 5c63cc5

Please sign in to comment.