tdesign-vue-next
Version:
TDesign Component for vue-next
28 lines (24 loc) • 1.35 kB
JavaScript
/**
* tdesign v1.15.2
* (c) 2025 tdesign
* @license MIT
*/
import { getCurrentInstance, computed, inject } from 'vue';
import { isBoolean } from 'lodash-es';
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 _context$beforeDisabl, _context$afterDisable, _formDisabled$disable;
if (isBoolean(context === null || context === void 0 || (_context$beforeDisabl = context.beforeDisabled) === null || _context$beforeDisabl === void 0 ? void 0 : _context$beforeDisabl.value)) return context.beforeDisabled.value;
if (isBoolean(componentDisabled.value)) return componentDisabled.value;
if (isBoolean(context === null || context === void 0 || (_context$afterDisable = context.afterDisabled) === null || _context$afterDisable === void 0 ? void 0 : _context$afterDisable.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 as u };
//# sourceMappingURL=dep-5360ac56.js.map