tdesign-vue-next
Version:
TDesign Component for vue-next
63 lines (57 loc) • 1.52 kB
JavaScript
/**
* tdesign v1.11.5
* (c) 2025 tdesign
* @license MIT
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var isString = require('../../_chunks/dep-b8b9c2a3.js');
require('../../_chunks/dep-bbe343d7.js');
require('@babel/runtime/helpers/typeof');
require('../../_chunks/dep-5ad8a2ab.js');
require('../../_chunks/dep-0c2ad01b.js');
var getStopStyle = function getStopStyle(position, isVertical) {
return isVertical ? {
top: "calc(".concat(100 - position, "% - 1px)")
} : {
left: "".concat(position, "%")
};
};
var formatSliderValue = function formatSliderValue(val, type) {
if (type === "first") {
if (val instanceof Array) {
return val[0];
}
return val;
}
if (val instanceof Array) {
return val[1];
}
return 0;
};
var formatLabel = function formatLabel(label, val) {
if (Boolean(label) === false) {
return String(val);
}
if (isString.isString(label)) {
var text = String(val);
try {
var rule = /\${value}%/g;
var enableToReplace = rule.test(label);
if (enableToReplace) {
text = label.replace(rule, String(val));
} else {
text = label;
throw new Error();
}
} catch (e) {
console.warn("fail to parse label prop, please pass string such as '${value}%'");
}
return text;
}
return label;
};
exports.formatLabel = formatLabel;
exports.formatSliderValue = formatSliderValue;
exports.getStopStyle = getStopStyle;
//# sourceMappingURL=index.js.map