123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- exports.__esModule = true;
- exports.default = void 0;
- var _babelHelperVueJsxMergeProps = _interopRequireDefault(require("@vue/babel-helper-vue-jsx-merge-props"));
- var _utils = require("../utils");
- var _functional = require("../utils/functional");
- var _button = _interopRequireDefault(require("../button"));
- var _radioGroup = _interopRequireDefault(require("../radio-group"));
- var _Item = _interopRequireDefault(require("./Item"));
- // Utils
- // Components
- var _createNamespace = (0, _utils.createNamespace)('address-list'),
- createComponent = _createNamespace[0],
- bem = _createNamespace[1],
- t = _createNamespace[2];
- function AddressList(h, props, slots, ctx) {
- function genList(list, disabled) {
- if (!list) {
- return;
- }
- return list.map(function (item, index) {
- return h(_Item.default, {
- "attrs": {
- "data": item,
- "disabled": disabled,
- "switchable": props.switchable,
- "defaultTagText": props.defaultTagText
- },
- "key": item.id,
- "scopedSlots": {
- bottom: slots['item-bottom'],
- tag: slots.tag
- },
- "on": {
- "select": function select() {
- (0, _functional.emit)(ctx, disabled ? 'select-disabled' : 'select', item, index);
- if (!disabled) {
- (0, _functional.emit)(ctx, 'input', item.id);
- }
- },
- "edit": function edit() {
- (0, _functional.emit)(ctx, disabled ? 'edit-disabled' : 'edit', item, index);
- },
- "click": function click() {
- (0, _functional.emit)(ctx, 'click-item', item, index);
- }
- }
- });
- });
- }
- var List = genList(props.list);
- var DisabledList = genList(props.disabledList, true);
- return h("div", (0, _babelHelperVueJsxMergeProps.default)([{
- "class": bem()
- }, (0, _functional.inherit)(ctx)]), [slots.top == null ? void 0 : slots.top(), h(_radioGroup.default, {
- "attrs": {
- "value": props.value
- }
- }, [List]), props.disabledText && h("div", {
- "class": bem('disabled-text')
- }, [props.disabledText]), DisabledList, slots.default == null ? void 0 : slots.default(), h("div", {
- "class": bem('bottom')
- }, [h(_button.default, {
- "attrs": {
- "round": true,
- "block": true,
- "type": "danger",
- "text": props.addButtonText || t('add')
- },
- "class": bem('add'),
- "on": {
- "click": function click() {
- (0, _functional.emit)(ctx, 'add');
- }
- }
- })])]);
- }
- AddressList.props = {
- list: Array,
- value: [Number, String],
- disabledList: Array,
- disabledText: String,
- addButtonText: String,
- defaultTagText: String,
- switchable: {
- type: Boolean,
- default: true
- }
- };
- var _default = createComponent(AddressList);
- exports.default = _default;
|