UNPKG

qt-public-ui

Version:

新设计规范下业务组件库

136 lines (134 loc) 3.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.tabOptions = exports.radioOptions = exports["default"] = void 0; /* eslint-disable no-param-reassign */ var radioOptions = exports.radioOptions = [{ name: '本周', value: 'thisWeek' }, { name: '上周', value: 'lastWeek' // 不包含今天 }, { name: '本月', value: 'thisMonth' }, { name: '上月', value: 'lastMonth' // 不包含今天 }, { name: '过去1小时', value: 'recent1Hour' }, { name: '过去24小时', value: 'recent24Hour' }, { name: '过去48小时', value: 'recent48Hour' }, { name: '实时', value: 'today' }, { name: '昨天', value: 'yesterday' }, { name: '过去7天', value: 'recent7Day' // 不包含今天 }, { name: '近7天', value: 'recent7DayFromToday' // 包含今天 }, { name: '过去15天', value: 'recent15Day' }, { name: '近15天', value: 'recent15DayFromToday' // 包含今天 }, { name: '过去30天', value: 'recent30Day' }, { name: '近30天', value: 'recent30DayFromToday' }, { name: '过去60天', value: 'recent60Day' }, { name: '近60天', value: 'recent60DayFromToday' }, { name: '过去90天', value: 'recent90Day' }, { name: '近90天', value: 'recent90DayFromToday' }]; var tabOptions = exports.tabOptions = [{ name: '任意1天', value: 'unit_day', tips: '请选择任意1天,查看这1天内的数据情况' }, { name: '任意7天', value: 'unit_7day', tips: '请选择任意7天范围的日期,查看这7天内的数据情况' }, { name: '任意15天', value: 'unit_15day', tips: '请选择任意15天范围的日期,查看这15天内的数据情况' }, { name: '任意30天', value: 'unit_30day', tips: '请选择任意30天范围的日期,查看这30天内的数据情况' }, { name: '任意60天', value: 'unit_60day', tips: '请选择任意60天范围的日期,查看这60天内的数据情况' }, { name: '任意90天', value: 'unit_90day', tips: '请选择任意90天范围的日期,查看这90天内的数据情况' }, { name: '任意1周', value: 'unit_week', tips: '请选择任意1周,查看这些天内的数据情况' }, { name: '任意1月', value: 'unit_month', tips: '请选择任意1月,查看这些天内的数据情况' }, { name: '自定义', value: 'unit_custom', tips: '请选择任意起止时间,查看这些天内的数据情况' }]; var _default = exports["default"] = { getRadioOptions: function getRadioOptions(options) { var original = JSON.parse(JSON.stringify(radioOptions)); if (!options) return original.filter(function (opt) { return !/FromToday|Hour$/.test(opt.value); }); if (options.length === 0) return []; return original.filter(function (opt) { return options.includes(opt.value); }); }, getTabOptions: function getTabOptions(options) { var original = JSON.parse(JSON.stringify(tabOptions)); if (!options) return original; if (options.length === 0) return [tabOptions.find(function (it) { return it.value === 'unit_custom'; })]; return original.filter(function (opt) { var option = options.find(function (ele) { return typeof ele === 'string' ? ele === opt.value : ele.key === opt.value; }); if (option instanceof Object) { opt.tips = option.tips || opt.tips; } return !!option; }); }, getFullTabs: function getFullTabs() { return tabOptions.map(function (it) { return it.value; }); } };