checkbox.d.ts.map 3.7 KB

1
  1. {"version":3,"sources":["../src/checkbox/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,MAAM,qBAAqB,CAAC;AAOlE,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,cAAc;IAClD,eAAe,WAMb;IAEF,SAAS,WAAuB;IAEhC,SAAS;;;;MAIP;IAEF,OAAO;;MAEL;IAEF,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMR;IAGF,IAAI;;;;;;;MAOF;IAEF,SAAS;;MAIP;IAEF,SAAS;;MAOP;IAEF,eAAe;;;QAKb;IAGF,OAAO;;;0BA4Ca,OAAO;8BAKH,OAAO;yCAOI,OAAO;gCAMhB,OAAO;MAK/B;CACH","file":"checkbox.d.ts","sourcesContent":["import { SuperComponent, wxComponent } from '../common/src/index';\nimport config from '../common/config';\nimport Props from './props';\n\nconst { prefix } = config;\nconst classPrefix = `${prefix}-checkbox`;\n@wxComponent()\nexport default class CheckBox 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 '../checkbox-group/checkbox-group': {\n type: 'ancestor' as 'ancestor',\n },\n };\n\n options = {\n multipleSlots: true,\n };\n\n properties = {\n ...Props,\n defaultChecked: {\n type: null,\n value: undefined,\n },\n };\n\n // 组件的内部数据\n data = {\n classPrefix,\n prefix,\n active: false,\n halfChecked: false,\n optionLinked: false,\n canCancel: false,\n };\n\n lifetimes = {\n attached() {\n this.initStatus();\n },\n };\n\n observers = {\n checked: function (isChecked) {\n this.initStatus();\n this.setData({\n active: isChecked,\n });\n },\n };\n\n controlledProps = [\n {\n key: 'checked',\n event: 'change',\n },\n ];\n\n /* Methods */\n methods = {\n onChange(e) {\n const { disabled, readonly } = this.data;\n if (disabled || readonly) return;\n const { target } = e.currentTarget.dataset;\n const { contentDisabled } = this.data;\n if (target === 'text' && contentDisabled) {\n return;\n }\n const { value, active, checkAll, optionLinked, canCancel } = this.data;\n const item = { name: value, checked: !active, checkAll };\n const [parent] = this.getRelationNodes('../checkbox-group/checkbox-group');\n if (parent) {\n if (checkAll || optionLinked) {\n parent.handleCheckAll({\n type: 'slot',\n checked: !active || (this.data.halfChecked && !canCancel),\n option: !checkAll,\n name: value,\n });\n } else {\n parent.updateValue(item);\n }\n } else if (checkAll || optionLinked) {\n this.triggerEvent('toggleAll', {\n type: 'not-slot',\n checked: !active || (this.data.halfChecked && !canCancel),\n option: !checkAll,\n name: value,\n });\n } else {\n this._trigger('change', { checked: !active });\n // this.triggerEvent('change', !active);\n // this.toggle();\n }\n },\n initStatus() {\n const { optionLinked, indeterminate } = this.data;\n if (!optionLinked) {\n this.setData({\n halfChecked: indeterminate,\n });\n }\n },\n setCancel(cancel: boolean) {\n this.setData({\n canCancel: cancel,\n });\n },\n setDisabled(disabled: Boolean) {\n this.setData({\n disabled: this.data.disabled || disabled,\n });\n },\n\n // 半选\n changeCheckAllHalfStatus(active: boolean) {\n this.setData({\n halfChecked: active,\n });\n },\n // group option\n setOptionLinked(linked: Boolean) {\n this.setData({\n optionLinked: linked,\n });\n },\n };\n}\n"]}