UNPKG

label-print-design

Version:

操作简单,组件丰富的一站式打印解决方案打印设计器

77 lines (74 loc) 2.41 kB
import { defineComponent, openBlock, createBlock, unref, withCtx, renderSlot } from 'vue'; import { computed } from 'vue-demi'; import { useAppStoreHook } from '../../../stores/app.mjs'; import TipIcon from './tip-icon.vue.mjs'; import { hasStyle } from '../../../constants/common.mjs'; import { ActionEnum } from '../../../utils/historyUtil.mjs'; import { multipleElementGetValue, multipleElementSetValue } from '../../../utils/elementUtil.mjs'; import { mitt } from '../../../utils/utils.mjs'; var _sfc_main = /* @__PURE__ */ defineComponent({ __name: "style-icon", props: { props: { default: "" }, propsValue: { default: void 0 }, enableProps: { default: "" }, disabled: { type: Boolean, default: void 0 }, marginTop: { default: "" } }, emits: ["update:modelValue"], setup(__props, { emit: __emit }) { const appStore = useAppStoreHook(); const emit = __emit; const props = __props; const value = computed(() => { if (!props.props) { return false; } const result = multipleElementGetValue(props.props); if (props.propsValue == void 0) { return result; } else { return result === props.propsValue; } }); const disabled = computed(() => { if (props.disabled !== void 0) { return props.disabled; } if (appStore.currentElement.length == 0) { return true; } for (let currentElementElement of appStore.currentElement) { if (!hasStyle(currentElementElement.type, props.enableProps)) { return true; } } return false; }); function change(val) { let tmpVal = val; if (props.propsValue != void 0) { if (val) { tmpVal = props.propsValue; } } multipleElementSetValue(props.props, tmpVal); mitt.emit("panelSnapshot", { action: ActionEnum.UPDATE_STYLE, elementList: appStore.currentElement }); } return (_ctx, _cache) => { return openBlock(), createBlock(TipIcon, { modelValue: unref(value), "onUpdate:modelValue": change, disabled: unref(disabled) }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 /* FORWARDED */ }, 8, ["modelValue", "disabled"]); }; } }); export { _sfc_main as default }; //# sourceMappingURL=style-icon.vue2.mjs.map