UNPKG

tdesign-vue

Version:
39 lines (35 loc) 1.85 kB
/** * tdesign v1.14.1 * (c) 2025 tdesign * @license MIT */ import _defineProperty from '@babel/runtime/helpers/defineProperty'; import Vue from 'vue'; import { capitalize } from 'lodash-es'; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function withInstall(comp, dep, directive, alias) { var _c$options; var c = comp; var name = (c === null || c === void 0 || (_c$options = c.options) === null || _c$options === void 0 ? void 0 : _c$options.name) || c.name; c.install = function (Vue2, config) { var defaults = { prefix: "t" }; var installConfig = _objectSpread(_objectSpread({}, defaults), config); var defaultPrefix = capitalize(defaults.prefix); var compName = alias || name; var componentName = compName.replace(defaultPrefix, "").replace("-mapprops", ""); componentName = capitalize(installConfig.prefix) + componentName; Vue2.component(componentName, comp); }; if (dep && Vue && (Vue._installedPlugins || []).indexOf(dep) === -1) { Vue.use(dep); } if (directive) { Vue.directive(directive.name, directive.comp); } return comp; } export { withInstall as default, withInstall }; //# sourceMappingURL=withInstall.js.map