tdesign-mobile-vue
Version:
tdesign-mobile-vue
59 lines (55 loc) • 1.47 kB
JavaScript
/**
* tdesign v1.7.0
* (c) 2024 TDesign Group
* @license MIT
*/
import { i as isString_1 } from '../../../_chunks/dep-6303c50c.mjs';
import '../../../_chunks/dep-8bf3054e.mjs';
import '../../../_chunks/dep-3d249f65.mjs';
import '../../../_chunks/dep-620d73f7.mjs';
import '../../../_chunks/dep-019e292f.mjs';
import '../../../_chunks/dep-32364550.mjs';
import '../../../_chunks/dep-9b2de386.mjs';
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_1(label)) {
var text = String(val);
try {
var rule = /\${value}%/g;
var enableToReplace = rule.test(label);
if (enableToReplace) {
text = label.replace(/\${value}/g, 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;
};
export { formatLabel, formatSliderValue, getStopStyle };
//# sourceMappingURL=utils.mjs.map