1 |
- {"version":3,"sources":["../src/picker/picker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,MAAM,qBAAqB,CAAC;AAQlE,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,cAAc;IAChD;;OAEG;IACH,UAAU,iCAAS;IAEnB,eAAe,WAAqE;IAEpF,OAAO;;MAEL;IAEF,SAAS;;;;MAIP;IAEF;;OAEG;IACH,IAAI;;MAEF;IAEF;;OAEG;IACH,OAAO;;;;;;;;;;;;;MA8BL;IAGF,KAAK;CAIN","file":"picker.d.ts","sourcesContent":["import { SuperComponent, wxComponent } from '../common/src/index';\nimport config from '../common/config';\nimport props from './props';\n\nconst { prefix } = config;\nconst name = `${prefix}-picker`;\n\n@wxComponent()\nexport default class Picker extends SuperComponent {\n /**\n * Component properties\n */\n properties = props;\n\n externalClasses = ['t-class', 't-class-confirm', 't-class-cancel', 't-class-title'];\n\n options = {\n multipleSlots: true,\n };\n\n relations = {\n './picker-column': {\n type: 'child' as 'child',\n },\n };\n\n /**\n * Component initial data\n */\n data = {\n classPrefix: name,\n };\n\n /**\n * Component methods\n */\n methods = {\n getPickerColumns() {\n const pickerColumns = this.getRelationNodes('./picker-column');\n if (Array.isArray(pickerColumns)) {\n return pickerColumns;\n }\n return [];\n },\n getSelectedValues() {\n const pickerColumns = this.getPickerColumns();\n if (pickerColumns?.length === 0) {\n return { index: undefined, value: undefined };\n }\n\n const selectedValues = {\n index: pickerColumns.map((pickerColumn) => pickerColumn._selectedIndex),\n value: pickerColumns.map((pickerColumn) => pickerColumn._selectedValue),\n };\n\n return selectedValues;\n },\n onConfirm() {\n this.triggerEvent('confirm', this.getSelectedValues());\n },\n onCancel() {\n this.triggerEvent('cancel');\n },\n triggerChange({ column, index, value }) {\n this.triggerEvent('change', { column, index, value });\n },\n };\n\n // 给 column 打标 标识顺序\n ready() {\n const columns = this.getPickerColumns();\n columns.map((column, index) => (column.columnIndex = index));\n }\n}\n"]}
|