UNPKG

tdesign-vue

Version:
248 lines (240 loc) 10 kB
/** * tdesign v1.11.2 * (c) 2025 tdesign * @license MIT */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var Vue = require('vue'); var configProvider_context = require('../_chunks/dep-07fb8c0e.js'); require('../_common/js/global-config/default-config.js'); require('../_common/js/global-config/locale/zh_CN.js'); require('../_chunks/dep-a4a18104.js'); require('@babel/runtime/helpers/typeof'); require('../_chunks/dep-27dd8cc6.js'); require('dayjs'); require('../_chunks/dep-87c765cc.js'); require('../_chunks/dep-75cd6d52.js'); require('../_chunks/dep-b1a02818.js'); require('../_chunks/dep-3d8ab37d.js'); require('../_chunks/dep-ecccff93.js'); require('../_chunks/dep-a4308f57.js'); require('../_chunks/dep-a4cecac4.js'); require('../_chunks/dep-ab142eaf.js'); require('../_chunks/dep-6ad3de7c.js'); require('../_chunks/dep-e4278c54.js'); require('../_chunks/dep-fcf0662d.js'); require('../_chunks/dep-8b1e056e.js'); require('../_chunks/dep-5db8defc.js'); require('../_chunks/dep-6e4c473c.js'); require('../_chunks/dep-234b7c02.js'); require('../_chunks/dep-a4747856.js'); require('../_chunks/dep-932dd69e.js'); require('../_chunks/dep-9f4caea4.js'); require('../_chunks/dep-dbd838d6.js'); require('../_chunks/dep-b3120c1b.js'); require('../_chunks/dep-68ba2357.js'); require('../_chunks/dep-173eb46c.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 === "string") { if (!placement) return pattern; var regexp = /\{\s*([\w-]+)\s*\}/g; var translated = pattern.replace(regexp, function (match, key) { if (placement) { return String(placement[key]); } return ""; }); return translated; } if (typeof pattern === "function") { return pattern(placement); } return ""; } } }); } 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