95 lines
3.2 KiB
JavaScript
95 lines
3.2 KiB
JavaScript
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_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_vue.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", "selectSearch"],
|
|
setup(props, {
|
|
emit
|
|
}) {
|
|
const field = (0, import_vue.ref)();
|
|
const showSearchResult = () => props.focused && props.searchResult && props.showSearchResult;
|
|
const onSelect = (express) => {
|
|
emit("selectSearch", express);
|
|
emit("input", `${express.address || ""} ${express.name || ""}`.trim());
|
|
};
|
|
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",
|
|
"title": express.name,
|
|
"label": express.address,
|
|
"class": bem("search-item"),
|
|
"border": false,
|
|
"onClick": () => onSelect(express)
|
|
}, null));
|
|
};
|
|
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()]);
|
|
}
|
|
};
|
|
}
|
|
});
|