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AA,CAAA;AAxFoB,KAAK;IADzB,WAAW,EAAE;GACO,KAAK,CAwFzB;eAxFoB,KAAK","file":"radio.js","sourcesContent":["import config from '../common/config';\nimport { SuperComponent, wxComponent } from '../common/src/index';\nimport Props from './props';\n\nconst { prefix } = config;\nconst name = `${prefix}-radio`;\n\nconst iconDefault = {\n 'fill-circle': ['check-circle-filled', 'circle'],\n 'stroke-line': ['check', ''],\n};\n@wxComponent()\nexport default class Radio extends SuperComponent {\n externalClasses = [\n `${prefix}-class`,\n `${prefix}-class-label`,\n `${prefix}-class-icon`,\n `${prefix}-class-content`,\n `${prefix}-class-border`,\n ];\n\n behaviors = ['wx://form-field'];\n\n relations = {\n '../radio-group/radio-group': {\n type: 'ancestor' as 'ancestor',\n },\n };\n\n options = {\n multipleSlots: true,\n };\n\n lifetimes = {\n attached() {\n this.initStatus();\n },\n };\n\n properties = {\n ...Props,\n };\n\n controlledProps = [\n {\n key: 'checked',\n event: 'change',\n },\n ];\n\n observers = {\n checked(isChecked: Boolean) {\n this.setData({\n active: isChecked,\n });\n },\n };\n\n data = {\n prefix,\n active: false,\n classPrefix: name,\n customIcon: false,\n optionLinked: false,\n iconVal: [],\n };\n\n methods = {\n handleTap(e) {\n if (this.data.disabled) return;\n\n const { target } = e.currentTarget.dataset;\n\n if (target === 'text' && this.data.contentDisabled) return;\n\n const { value, active } = this.data;\n const [parent] = this.getRelationNodes('../radio-group/radio-group');\n\n if (parent) {\n parent.updateValue(value);\n } else {\n this._trigger('change', { checked: !active });\n }\n },\n initStatus() {\n const { icon } = this.data;\n const isIdArr = Array.isArray(icon);\n\n this.setData({\n customIcon: isIdArr,\n iconVal: !isIdArr ? iconDefault[icon] : this.data.icon,\n });\n },\n\n setDisabled(disabled: Boolean) {\n this.setData({\n disabled: this.data.disabled || disabled,\n });\n },\n };\n}\n"]}