This commit is contained in:
Ling53666
2025-08-18 09:11:51 +08:00
commit 02554225da
2516 changed files with 133155 additions and 0 deletions

View File

@ -0,0 +1,70 @@
<import-sjs
from="../index.sjs"
name="componentUtils"
></import-sjs>
<list
className="ant-radio-group {{className ? className : ''}} ant-radio-group-{{position}}"
style="{{style}}"
>
<radio-group
name="{{name}}"
value="{{mixin.value}}"
>
<view class="ant-radio-group-body">
<block a:if="{{position === 'vertical'}}">
<block
a:for="{{options}}"
a:for-index="index"
a:for-item="item"
>
<list-item>
<radio
checked="{{componentUtils.getChecked(index, options, mixin.value)}}"
data-index="{{index}}"
value="{{item.value}}"
disabled="{{disabled || item.disabled}}"
color="{{item.color || color}}"
onChange="onChange"
>
<slot
name="label"
value="{{item}}"
index="{{index}}"
>
<view class="ant-radio-group-item-label-default">
{{item.label}}
</view>
</slot>
</radio>
</list-item>
</block>
</block>
<block a:else>
<block
a:for="{{options}}"
a:for-index="index"
a:for-item="item"
>
<radio
checked="{{componentUtils.getChecked(index, options, mixin.value)}}"
data-index="{{index}}"
value="{{item.value}}"
disabled="{{disabled || item.disabled}}"
color="{{item.color || color}}"
onChange="onChange"
>
<slot
name="label"
value="{{item}}"
index="{{index}}"
>
<view class="ant-radio-group-item-label-default">
{{item.label}}
</view>
</slot>
</radio>
</block>
</block>
</view>
</radio-group>
</list>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,16 @@
import { Component, triggerEvent, getValueFromProps } from '../../_util/simply';
import { RadioGroupDefaultProps } from './props';
import mixinValue from '../../mixins/value';
Component(RadioGroupDefaultProps, {
onChange: function (_, e) {
var event;
event = e;
var index = event.currentTarget.dataset.index;
var options = getValueFromProps(this, 'options');
var value = options[index].value;
if (!this.isControlled()) {
this.update(value);
}
triggerEvent(this, 'change', value, event);
},
}, null, [mixinValue()]);

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"list": "../../List/index",
"list-item": "../../List/ListItem/index",
"radio": "../index"
}
}

View File

@ -0,0 +1,50 @@
@import (reference) '../variable.less';
@radioGroupPrefix: ant-radio-group;
.@{radioGroupPrefix} {
&-horizontal {
.@{radioGroupPrefix}-body {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
.ant-list-item-line {
padding-right: 0;
}
.ant-radio-item {
flex-flow: 0;
}
.ant-list-item-line::after {
display: none;
}
}
}
&-header:empty,
&-footer:empty {
display: none;
}
&-header,
&-footer {
display: flex;
align-items: center;
padding: @v-spacing-standard @v-spacing-large;
line-height: 1.4;
font-size: 30 * @rpx;
color: @radio-header-color;
}
&-body {
position: relative;
overflow: hidden;
.ant-radio-item-content {
.ant-radio-group-item-label-default:not(:nth-child(1)) {
display: none;
}
}
}
}

View File

@ -0,0 +1,17 @@
import { IBaseProps } from '../../_util/base';
export interface IRadioGroupProps extends IBaseProps {
value: string;
defaultValue: string;
name: string;
disabled?: boolean;
color: string;
position: 'horizontal' | 'vertical';
onChange?: (value: string, e: any) => void;
options: {
label?: string;
value?: string;
disabled?: boolean;
color?: string;
}[];
}
export declare const RadioGroupDefaultProps: Partial<IRadioGroupProps>;

View File

@ -0,0 +1,9 @@
export var RadioGroupDefaultProps = {
value: null,
defaultValue: null,
name: '',
disabled: false,
color: '',
position: 'vertical',
options: [],
};