1 |
- {"version":3,"sources":["../src/segmented-control/segmented-control.ts"],"names":[],"mappings":"","file":"segmented-control.d.ts","sourcesContent":["import TComponent from '../common/component';\nimport config from '../common/config';\n\nconst { prefix } = config;\nconst name = `${prefix}-segmented-control`;\n\nTComponent({\n properties: {\n value: {\n type: String,\n optionalTypes: [Number],\n value: '',\n observer: 'updateValue',\n },\n items: {\n type: Array,\n value: [],\n },\n },\n data: {\n currentValue: null,\n classPrefix: name,\n classBasePrefix: prefix,\n },\n methods: {\n onTap(event: any) {\n const { value } = event.currentTarget.dataset;\n this.updateValue(value);\n this.triggerEvent('change', value);\n },\n updateValue(value) {\n if ((this.data.items || []).some((item) => item.value === value)) {\n this.setData({ currentValue: value });\n } else {\n this.setData({ currentValue: +value });\n }\n },\n },\n});\n"]}
|