| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 | import _extends from "@babel/runtime/helpers/esm/extends";// Utilsimport { createNamespace } from '../utils';import { isAndroid } from '../utils/validate/system'; // Componentsimport Cell from '../cell';import Field from '../field';var _createNamespace = createNamespace('address-edit-detail'),    createComponent = _createNamespace[0],    bem = _createNamespace[1],    t = _createNamespace[2];var android = isAndroid();export default createComponent({  props: {    value: String,    errorMessage: String,    focused: Boolean,    detailRows: [Number, String],    searchResult: Array,    detailMaxlength: [Number, String],    showSearchResult: Boolean  },  computed: {    shouldShowSearchResult: function shouldShowSearchResult() {      return this.focused && this.searchResult && this.showSearchResult;    }  },  methods: {    onSelect: function onSelect(express) {      this.$emit('select-search', express);      this.$emit('input', ((express.address || '') + " " + (express.name || '')).trim());    },    onFinish: function onFinish() {      this.$refs.field.blur();    },    genFinish: function genFinish() {      var h = this.$createElement;      var show = this.value && this.focused && android;      if (show) {        return h("div", {          "class": bem('finish'),          "on": {            "click": this.onFinish          }        }, [t('complete')]);      }    },    genSearchResult: function genSearchResult() {      var _this = this;      var h = this.$createElement;      var value = this.value,          shouldShowSearchResult = this.shouldShowSearchResult,          searchResult = this.searchResult;      if (shouldShowSearchResult) {        return searchResult.map(function (express) {          return h(Cell, {            "key": express.name + express.address,            "attrs": {              "clickable": true,              "border": false,              "icon": "location-o",              "label": express.address            },            "class": bem('search-item'),            "on": {              "click": function click() {                _this.onSelect(express);              }            },            "scopedSlots": {              title: function title() {                if (express.name) {                  var text = express.name.replace(value, "<span class=" + bem('keyword') + ">" + value + "</span>");                  return h("div", {                    "domProps": {                      "innerHTML": text                    }                  });                }              }            }          });        });      }    }  },  render: function render() {    var h = arguments[0];    return h(Cell, {      "class": bem()    }, [h(Field, {      "attrs": {        "autosize": true,        "rows": this.detailRows,        "clearable": !android,        "type": "textarea",        "value": this.value,        "errorMessage": this.errorMessage,        "border": !this.shouldShowSearchResult,        "label": t('label'),        "maxlength": this.detailMaxlength,        "placeholder": t('placeholder')      },      "ref": "field",      "scopedSlots": {        icon: this.genFinish      },      "on": _extends({}, this.$listeners)    }), this.genSearchResult()]);  }});
 |