1 | var __defProp = Object.defineProperty;
|
2 | var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3 | var __getOwnPropNames = Object.getOwnPropertyNames;
|
4 | var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5 | var __export = (target, all) => {
|
6 | for (var name2 in all)
|
7 | __defProp(target, name2, { get: all[name2], enumerable: true });
|
8 | };
|
9 | var __copyProps = (to, from, except, desc) => {
|
10 | if (from && typeof from === "object" || typeof from === "function") {
|
11 | for (let key of __getOwnPropNames(from))
|
12 | if (!__hasOwnProp.call(to, key) && key !== except)
|
13 | __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14 | }
|
15 | return to;
|
16 | };
|
17 | var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18 | var stdin_exports = {};
|
19 | __export(stdin_exports, {
|
20 | default: () => stdin_default
|
21 | });
|
22 | module.exports = __toCommonJS(stdin_exports);
|
23 | var import_vue = require("vue");
|
24 | var import_utils = require("../utils");
|
25 | var import_tag = require("../tag");
|
26 | var import_icon = require("../icon");
|
27 | var import_cell = require("../cell");
|
28 | var import_radio = require("../radio");
|
29 | var import_checkbox = require("../checkbox");
|
30 | const [name, bem] = (0, import_utils.createNamespace)("address-item");
|
31 | var stdin_default = (0, import_vue.defineComponent)({
|
32 | name,
|
33 | props: {
|
34 | address: (0, import_utils.makeRequiredProp)(Object),
|
35 | disabled: Boolean,
|
36 | switchable: Boolean,
|
37 | singleChoice: Boolean,
|
38 | defaultTagText: String,
|
39 | rightIcon: (0, import_utils.makeStringProp)("edit")
|
40 | },
|
41 | emits: ["edit", "click", "select"],
|
42 | setup(props, {
|
43 | slots,
|
44 | emit
|
45 | }) {
|
46 | const onClick = (event) => {
|
47 | if (props.switchable) {
|
48 | emit("select");
|
49 | }
|
50 | emit("click", event);
|
51 | };
|
52 | const renderRightIcon = () => (0, import_vue.createVNode)(import_icon.Icon, {
|
53 | "name": props.rightIcon,
|
54 | "class": bem("edit"),
|
55 | "onClick": (event) => {
|
56 | event.stopPropagation();
|
57 | emit("edit");
|
58 | emit("click", event);
|
59 | }
|
60 | }, null);
|
61 | const renderTag = () => {
|
62 | if (slots.tag) {
|
63 | return slots.tag(props.address);
|
64 | }
|
65 | if (props.address.isDefault && props.defaultTagText) {
|
66 | return (0, import_vue.createVNode)(import_tag.Tag, {
|
67 | "type": "primary",
|
68 | "round": true,
|
69 | "class": bem("tag")
|
70 | }, {
|
71 | default: () => [props.defaultTagText]
|
72 | });
|
73 | }
|
74 | };
|
75 | const renderContent = () => {
|
76 | const {
|
77 | address,
|
78 | disabled,
|
79 | switchable,
|
80 | singleChoice
|
81 | } = props;
|
82 | const Info = [(0, import_vue.createVNode)("div", {
|
83 | "class": bem("name")
|
84 | }, [`${address.name} ${address.tel}`, renderTag()]), (0, import_vue.createVNode)("div", {
|
85 | "class": bem("address")
|
86 | }, [address.address])];
|
87 | if (switchable && !disabled) {
|
88 | if (singleChoice) {
|
89 | return (0, import_vue.createVNode)(import_radio.Radio, {
|
90 | "name": address.id,
|
91 | "iconSize": 18
|
92 | }, {
|
93 | default: () => [Info]
|
94 | });
|
95 | } else {
|
96 | return (0, import_vue.createVNode)(import_checkbox.Checkbox, {
|
97 | "name": address.id,
|
98 | "iconSize": 18
|
99 | }, {
|
100 | default: () => [Info]
|
101 | });
|
102 | }
|
103 | }
|
104 | return Info;
|
105 | };
|
106 | return () => {
|
107 | var _a;
|
108 | const {
|
109 | disabled
|
110 | } = props;
|
111 | return (0, import_vue.createVNode)("div", {
|
112 | "class": bem({
|
113 | disabled
|
114 | }),
|
115 | "onClick": onClick
|
116 | }, [(0, import_vue.createVNode)(import_cell.Cell, {
|
117 | "border": false,
|
118 | "titleClass": bem("title")
|
119 | }, {
|
120 | title: renderContent,
|
121 | "right-icon": renderRightIcon
|
122 | }), (_a = slots.bottom) == null ? void 0 : _a.call(slots, (0, import_utils.extend)({}, props.address, {
|
123 | disabled
|
124 | }))]);
|
125 | };
|
126 | }
|
127 | });
|