tdesign-vue-next
Version:
TDesign Component for vue-next
32 lines (27 loc) • 1.57 kB
JavaScript
/**
* tdesign v1.20.2
* (c) 2026 tdesign
* @license MIT
*/
;
var Vue = require('vue');
var isArray = require('./dep-959f4847.js');
var isBoolean = require('./dep-6512c9d2.js');
function useDisabled(context) {
var currentInstance = Vue.getCurrentInstance();
var componentDisabled = Vue.computed(function () {
return currentInstance.props.disabled;
});
var formDisabled = Vue.inject("formDisabled", /* @__PURE__ */Object.create(null));
return Vue.computed(function () {
var _context$beforeDisabl, _context$afterDisable, _formDisabled$disable;
if (isArray.isArray(componentDisabled.value) && componentDisabled.value.length === 2) return componentDisabled.value;
if (isBoolean.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.isBoolean(componentDisabled.value)) return componentDisabled.value;
if (isBoolean.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.isBoolean((_formDisabled$disable = formDisabled.disabled) === null || _formDisabled$disable === void 0 ? void 0 : _formDisabled$disable.value)) return formDisabled.disabled.value;
return false;
});
}
exports.useDisabled = useDisabled;
//# sourceMappingURL=dep-a2e46896.js.map