tdesign-vue
Version:
241 lines (233 loc) • 9.89 kB
JavaScript
/**
* tdesign v1.15.0
* (c) 2026 tdesign
* @license MIT
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var Vue = require('vue');
var configProvider_context = require('../_chunks/dep-8eddb350.js');
var _common_js_globalConfig_t = require('../_common/js/global-config/t.js');
require('../_common/js/global-config/default-config.js');
require('../_common/js/global-config/locale/zh_CN.js');
require('../_chunks/dep-0c37520c.js');
require('@babel/runtime/helpers/typeof');
require('../_chunks/dep-c13dcbfd.js');
require('dayjs');
require('../_chunks/dep-6f4e680e.js');
require('../_chunks/dep-bb0ececf.js');
require('../_chunks/dep-3b2292ce.js');
require('../_chunks/dep-ba7f5924.js');
require('../_chunks/dep-10fcb46d.js');
require('../_chunks/dep-6eba4d23.js');
require('../_chunks/dep-010db548.js');
require('../_chunks/dep-8d206316.js');
require('../_chunks/dep-2bc87cc8.js');
require('../_chunks/dep-f77d6ad5.js');
require('../_chunks/dep-9dae8101.js');
require('../_chunks/dep-7c84d9a0.js');
require('../_chunks/dep-733a2279.js');
require('../_chunks/dep-d844c9ed.js');
require('../_chunks/dep-c05a9033.js');
require('../_chunks/dep-efe55b82.js');
require('../_chunks/dep-7da70ee1.js');
require('../_chunks/dep-124386d4.js');
require('../_chunks/dep-f5b14344.js');
require('../_chunks/dep-36c2788b.js');
require('../_chunks/dep-fa353fbb.js');
require('../_chunks/dep-d66ab3a4.js');
require('../_chunks/dep-d4d8c513.js');
require('@babel/runtime/helpers/slicedToArray');
require('../_chunks/dep-a2217d56.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);
function getConfigReceiverMixins(_componentName) {
return Vue__default["default"].extend({
name: "TConfigProvider",
inject: {
globalConfig: {
"default": void 0
}
},
computed: {
global: function global() {
var data = this.globalConfig || configProvider_context.defaultGlobalConfig;
return data[_componentName];
},
classPrefix: function classPrefix() {
var _this$globalConfig;
return ((_this$globalConfig = this.globalConfig) === null || _this$globalConfig === void 0 ? void 0 : _this$globalConfig.classPrefix) || (configProvider_context.defaultGlobalConfig === null || configProvider_context.defaultGlobalConfig === void 0 ? void 0 : configProvider_context.defaultGlobalConfig.classPrefix);
},
componentName: function componentName() {
var _this$globalConfig2;
var classPrefix = ((_this$globalConfig2 = this.globalConfig) === null || _this$globalConfig2 === void 0 ? void 0 : _this$globalConfig2.classPrefix) || (configProvider_context.defaultGlobalConfig === null || configProvider_context.defaultGlobalConfig === void 0 ? void 0 : configProvider_context.defaultGlobalConfig.classPrefix);
return "".concat(classPrefix, "-").concat(_componentName);
},
commonSizeClassName: function commonSizeClassName() {
return {
small: "".concat(this.classPrefix, "-size-s"),
medium: "".concat(this.classPrefix, "-size-m"),
large: "".concat(this.classPrefix, "-size-l"),
"default": "",
xs: "".concat(this.classPrefix, "-size-xs"),
xl: "".concat(this.classPrefix, "-size-xl"),
block: "".concat(this.classPrefix, "-size-full-width")
};
},
commonStatusClassName: function commonStatusClassName() {
return {
loading: "".concat(this.classPrefix, "-is-loading"),
loadMore: "".concat(this.classPrefix, "-is-load-more"),
disabled: "".concat(this.classPrefix, "-is-disabled"),
focused: "".concat(this.classPrefix, "-is-focused"),
success: "".concat(this.classPrefix, "-is-success"),
error: "".concat(this.classPrefix, "-is-error"),
warning: "".concat(this.classPrefix, "-is-warning"),
selected: "".concat(this.classPrefix, "-is-selected"),
active: "".concat(this.classPrefix, "-is-active"),
checked: "".concat(this.classPrefix, "-is-checked"),
current: "".concat(this.classPrefix, "-is-current"),
hidden: "".concat(this.classPrefix, "-is-hidden"),
visible: "".concat(this.classPrefix, "-is-visible"),
expanded: "".concat(this.classPrefix, "-is-expanded"),
indeterminate: "".concat(this.classPrefix, "-is-indeterminate")
};
}
},
methods: {
t: function t(pattern, placement) {
if (typeof pattern === "function") {
return pattern(placement);
}
return _common_js_globalConfig_t.t(pattern, placement);
}
}
});
}
function getGlobalIconMixins() {
return Vue__default["default"].extend({
name: "TGlobalIcon",
inject: {
globalConfig: {
"default": void 0
}
},
methods: {
useGlobalIcon: function useGlobalIcon(tdIcon) {
var iconGlobalData = (this.globalConfig || configProvider_context.defaultGlobalConfig).icon;
var resultIcon = {};
Object.keys(tdIcon).forEach(function (key) {
resultIcon[key] = (iconGlobalData === null || iconGlobalData === void 0 ? void 0 : iconGlobalData[key]) || tdIcon[key];
});
return resultIcon;
}
}
});
}
function getKeepAnimationMixins() {
return Vue__default["default"].extend({
name: "TKeepAnimation",
inject: {
globalConfig: {
"default": void 0
}
},
computed: {
keepAnimation: function keepAnimation() {
var animationConfig = configProvider_context.mergeWith$1({}, configProvider_context.defaultGlobalConfig.animation);
if (this.globalConfig && this.globalConfig.animation) {
animationConfig = configProvider_context.mergeWith$1(animationConfig, this.globalConfig.animation, function (objValue, srcValue) {
if (Array.isArray(objValue)) {
return srcValue;
}
});
}
var isKeep = function isKeep(type) {
return animationConfig && !animationConfig.exclude.includes(type) && animationConfig.include.includes(type);
};
return {
ripple: isKeep("ripple"),
expand: isKeep("expand"),
fade: isKeep("fade")
};
}
}
});
}
function getClassPrefixMixins(_componentName2) {
return Vue__default["default"].extend({
name: "TClassPrefixProvider",
inject: {
globalConfig: {
"default": void 0
}
},
computed: {
classPrefix: function classPrefix() {
var _this$globalConfig3;
return ((_this$globalConfig3 = this.globalConfig) === null || _this$globalConfig3 === void 0 ? void 0 : _this$globalConfig3.classPrefix) || configProvider_context.defaultGlobalConfig.classPrefix;
},
componentName: function componentName() {
var _this$globalConfig4;
var classPrefix = ((_this$globalConfig4 = this.globalConfig) === null || _this$globalConfig4 === void 0 ? void 0 : _this$globalConfig4.classPrefix) || configProvider_context.defaultGlobalConfig.classPrefix;
return "".concat(classPrefix, "-").concat(_componentName2);
},
commonSizeClassName: function commonSizeClassName() {
return {
small: "".concat(this.classPrefix, "-size-s"),
medium: "".concat(this.classPrefix, "-size-m"),
large: "".concat(this.classPrefix, "-size-l"),
"default": "",
xs: "".concat(this.classPrefix, "-size-xs"),
xl: "".concat(this.classPrefix, "-size-xl"),
block: "".concat(this.classPrefix, "-size-full-width")
};
},
commonStatusClassName: function commonStatusClassName() {
return {
loading: "".concat(this.classPrefix, "-is-loading"),
loadMore: "".concat(this.classPrefix, "-is-load-more"),
disabled: "".concat(this.classPrefix, "-is-disabled"),
focused: "".concat(this.classPrefix, "-is-focused"),
success: "".concat(this.classPrefix, "-is-success"),
error: "".concat(this.classPrefix, "-is-error"),
warning: "".concat(this.classPrefix, "-is-warning"),
selected: "".concat(this.classPrefix, "-is-selected"),
active: "".concat(this.classPrefix, "-is-active"),
checked: "".concat(this.classPrefix, "-is-checked"),
current: "".concat(this.classPrefix, "-is-current"),
hidden: "".concat(this.classPrefix, "-is-hidden"),
visible: "".concat(this.classPrefix, "-is-visible"),
expanded: "".concat(this.classPrefix, "-is-expanded"),
indeterminate: "".concat(this.classPrefix, "-is-indeterminate")
};
}
}
});
}
function getAttachConfigMixins(componentName) {
return Vue__default["default"].extend({
name: "TAttachProvider",
inject: {
globalConfig: {
"default": void 0
}
},
methods: {
globalAttach: function globalAttach() {
var _this$globalConfig5;
var globalConfigAttach = (_this$globalConfig5 = this.globalConfig) === null || _this$globalConfig5 === void 0 ? void 0 : _this$globalConfig5.attach;
if (typeof globalConfigAttach === "string" || typeof globalConfigAttach === "function") {
return globalConfigAttach;
}
return (globalConfigAttach === null || globalConfigAttach === void 0 ? void 0 : globalConfigAttach[componentName]) || "body";
}
}
});
}
exports["default"] = getConfigReceiverMixins;
exports.getAttachConfigMixins = getAttachConfigMixins;
exports.getClassPrefixMixins = getClassPrefixMixins;
exports.getGlobalIconMixins = getGlobalIconMixins;
exports.getKeepAnimationMixins = getKeepAnimationMixins;
//# sourceMappingURL=config-receiver.js.map