radio.d.ts.map 2.5 KB

1
  1. {"version":3,"sources":["../src/radio/radio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAe,MAAM,qBAAqB,CAAC;AAWlE,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,cAAc;IAC/C,eAAe,WAMb;IAEF,SAAS,WAAuB;IAEhC,SAAS;;;;MAIP;IAEF,OAAO;;MAEL;IAEF,SAAS;;MAIP;IAEF,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAER;IAEF,eAAe;;;QAKb;IAEF,SAAS;2BACY,OAAO;MAK1B;IAEF,IAAI;;;;;;;MAOF;IAEF,OAAO;;;8BA2BiB,OAAO;MAK7B;CACH","file":"radio.d.ts","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"]}