123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __getOwnPropNames = Object.getOwnPropertyNames;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __export = (target, all) => {
- for (var name2 in all)
- __defProp(target, name2, { get: all[name2], enumerable: true });
- };
- var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
- };
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
- var stdin_exports = {};
- __export(stdin_exports, {
- default: () => stdin_default
- });
- module.exports = __toCommonJS(stdin_exports);
- var import_vue = require("vue");
- var import_vue2 = require("vue");
- var import_utils = require("../utils");
- var import_cell = require("../cell");
- var import_field = require("../field");
- const [name, bem] = (0, import_utils.createNamespace)("address-edit-detail");
- const t = (0, import_utils.createNamespace)("address-edit")[2];
- var stdin_default = (0, import_vue2.defineComponent)({
- name,
- props: {
- show: Boolean,
- rows: import_utils.numericProp,
- value: String,
- rules: Array,
- focused: Boolean,
- maxlength: import_utils.numericProp,
- searchResult: Array,
- showSearchResult: Boolean
- },
- emits: ["blur", "focus", "input", "select-search"],
- setup(props, {
- emit
- }) {
- const field = (0, import_vue2.ref)();
- const showSearchResult = () => props.focused && props.searchResult && props.showSearchResult;
- const onSelect = (express) => {
- emit("select-search", express);
- emit("input", `${express.address || ""} ${express.name || ""}`.trim());
- };
- const renderSearchTitle = (express) => {
- if (express.name) {
- const text = express.name.replace(props.value, `<span class=${bem("keyword")}>${props.value}</span>`);
- return (0, import_vue.createVNode)("div", {
- "innerHTML": text
- }, null);
- }
- };
- const renderSearchResult = () => {
- if (!showSearchResult()) {
- return;
- }
- const {
- searchResult
- } = props;
- return searchResult.map((express) => (0, import_vue.createVNode)(import_cell.Cell, {
- "clickable": true,
- "key": express.name + express.address,
- "icon": "location-o",
- "label": express.address,
- "class": bem("search-item"),
- "border": false,
- "onClick": () => onSelect(express)
- }, {
- title: () => renderSearchTitle(express)
- }));
- };
- const onBlur = (event) => emit("blur", event);
- const onFocus = (event) => emit("focus", event);
- const onInput = (value) => emit("input", value);
- return () => {
- if (props.show) {
- return (0, import_vue.createVNode)(import_vue.Fragment, null, [(0, import_vue.createVNode)(import_field.Field, {
- "autosize": true,
- "clearable": true,
- "ref": field,
- "class": bem(),
- "rows": props.rows,
- "type": "textarea",
- "rules": props.rules,
- "label": t("addressDetail"),
- "border": !showSearchResult(),
- "maxlength": props.maxlength,
- "modelValue": props.value,
- "placeholder": t("addressDetail"),
- "onBlur": onBlur,
- "onFocus": onFocus,
- "onUpdate:modelValue": onInput
- }, null), renderSearchResult()]);
- }
- };
- }
- });
|