UNPKG

@antmjs/vantui

Version:

一套适用于Taro3及React的vantui组件库

36 lines (35 loc) 2.15 kB
"use strict"; var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.pivotStyle = pivotStyle; exports.pivotText = pivotText; exports.portionStyle = portionStyle; exports.rootStyle = rootStyle; var utils = _interopRequireWildcard(require("../wxs/utils")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function pivotText(pivotText, percentage) { return pivotText || percentage + '%'; } function rootStyle(data) { return utils.style({ height: data.strokeWidth ? utils.addUnit(data.strokeWidth) : '', background: data.trackColor }); } function portionStyle(data) { return utils.style({ background: data.inactive ? '#cacaca' : data.color, width: data.percentage ? data.percentage + '%' : '' }); } function pivotStyle(data) { return utils.style({ color: data.textColor, visibility: data.right === 0 ? 'hidden' : 'visible', right: data.right + 'px', background: data.pivotColor ? data.pivotColor : data.inactive ? '#cacaca' : data.color }); }