xdesign-vue-next
Version:
XDesign Component for vue-next
28 lines (24 loc) • 1.11 kB
JavaScript
/**
* xdesign v1.0.6
* (c) 2023 xdesign
* @license MIT
*/
import { getCurrentInstance, computed, inject } from 'vue';
import isBoolean from 'lodash/isBoolean';
function useDisabled(context) {
var currentInstance = getCurrentInstance();
var componentDisabled = computed(function () {
return currentInstance.props.disabled;
});
var formDisabled = inject("formDisabled", /* @__PURE__ */Object.create(null));
return computed(function () {
var _formDisabled$disable;
if (isBoolean(context === null || context === void 0 ? void 0 : context.beforeDisabled.value)) return context.beforeDisabled.value;
if (isBoolean(componentDisabled.value)) return componentDisabled.value;
if (isBoolean(context === null || context === void 0 ? void 0 : context.afterDisabled.value)) return context.afterDisabled.value;
if (isBoolean((_formDisabled$disable = formDisabled.disabled) === null || _formDisabled$disable === void 0 ? void 0 : _formDisabled$disable.value)) return formDisabled.disabled.value;
return false;
});
}
export { useDisabled };
//# sourceMappingURL=useDisabled.js.map