function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } /* Analyzed bindings: { "loading": "props", "Popconfirm": "setup-maybe-ref", "Button": "setup-maybe-ref", "popconfirmProps": "setup-maybe-ref", "ref": "setup-const", "JAIcon": "setup-maybe-ref", "props": "setup-reactive-const", "visible": "setup-ref", "cancel": "setup-const", "ok": "setup-const", "visibleChange": "setup-const" } */ import { defineComponent as _defineComponent } from 'vue'; import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, createTextVNode as _createTextVNode, unref as _unref, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot, mergeProps as _mergeProps, openBlock as _openBlock, createBlock as _createBlock } from "vue"; const _hoisted_1 = { class: "popconfirm-title" }; import { Popconfirm, Button } from 'ant-design-vue'; import { popconfirmProps } from 'ant-design-vue/lib/popconfirm'; import { ref } from 'vue'; const __sfc_main__ = /*#__PURE__*/ _defineComponent({ props: { ...popconfirmProps(), loading: { type: Boolean, default: false, }, }, setup(__props) { const props = __props; const visible = ref(false); const cancel = async (e) => { await _optionalChain([props, 'access', _2 => _2.onCancel, 'optionalCall', _3 => _3(e)]); visible.value = false; }; const ok = async (e) => { await _optionalChain([props, 'access', _4 => _4.onConfirm, 'optionalCall', _5 => _5(e)]); visible.value = false; }; const visibleChange = (value) => { visible.value = value; }; return (_ctx, _cache) => { return (_openBlock(), _createBlock(_unref(Popconfirm), _mergeProps(props, { visible: visible.value, onVisibleChange: visibleChange }), { title: _withCtx(() => [ _createElementVNode("div", _hoisted_1, _toDisplayString(props.title || '是否确定删除?'), 1 /* TEXT */) ]), cancelButton: _withCtx(() => [ _createVNode(_unref(Button), { size: "small", class: "popconfirm-button", onClick: cancel }, { default: _withCtx(() => [ _createTextVNode(_toDisplayString(props.cancelText || '取消'), 1 /* TEXT */) ]), _: 1 /* STABLE */ }) ]), okButton: _withCtx(() => [ _createVNode(_unref(Button), { loading: __props.loading, type: "primary", size: "small", class: "popconfirm-button", onClick: ok }, { default: _withCtx(() => [ _createTextVNode(_toDisplayString(props.okText || '确定'), 1 /* TEXT */) ]), _: 1 /* STABLE */ }, 8 /* PROPS */, ["loading"]) ]), default: _withCtx(() => [ _renderSlot(_ctx.$slots, "default") ]), _: 3 /* FORWARDED */ }, 16 /* FULL_PROPS */, ["visible"])); }; } }); export default __sfc_main__;