@easyv/config
Advanced tools
Comparing version 1.0.32 to 1.0.33
const config = require('./lib'); | ||
module.exports = config; |
324
lib/axes.js
@@ -61,2 +61,31 @@ "use strict"; | ||
}; | ||
var categoryAxis = function categoryAxis(_ref) { | ||
var _ref$on = _ref.on, | ||
on = _ref$on === void 0 ? true : _ref$on, | ||
_ref$label = _ref.label, | ||
label = _ref$label === void 0 ? defaultCategoryAxis.label : _ref$label, | ||
_ref$axisLine = _ref.axisLine, | ||
axisLine_ = _ref$axisLine === void 0 ? defaultCategoryAxis.axisLine : _ref$axisLine, | ||
_ref$tickLine = _ref.tickLine, | ||
tickLine_ = _ref$tickLine === void 0 ? defaultCategoryAxis.tickLine : _ref$tickLine, | ||
_ref$gridLine = _ref.gridLine, | ||
gridLine_ = _ref$gridLine === void 0 ? defaultCategoryAxis.gridLine : _ref$gridLine; | ||
return [{ | ||
name: 'on', | ||
displayName: '启用', | ||
value: on, | ||
type: 'boolean' | ||
}, _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _label.axisLabel)(label)), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.axisLine)(axisLine_)), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.tickLine)(tickLine_)), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.gridLine)(gridLine_))]; | ||
}; | ||
exports.categoryAxis = categoryAxis; | ||
var defaultValueAxis = { | ||
@@ -110,181 +139,16 @@ on: true, | ||
var categoryAxis = function categoryAxis(_ref) { | ||
var _ref$on = _ref.on, | ||
on = _ref$on === void 0 ? defaultCategoryAxis.on : _ref$on, | ||
_ref$label = _ref.label; | ||
_ref$label = _ref$label === void 0 ? defaultCategoryAxis.label : _ref$label; | ||
var _ref$label$show = _ref$label.show, | ||
showLabel = _ref$label$show === void 0 ? defaultCategoryAxis.label.show : _ref$label$show, | ||
_ref$label$format = _ref$label.format; | ||
_ref$label$format = _ref$label$format === void 0 ? defaultCategoryAxis.label.format : _ref$label$format; | ||
var _ref$label$format$typ = _ref$label$format.type, | ||
type = _ref$label$format$typ === void 0 ? defaultCategoryAxis.label.format.type : _ref$label$format$typ, | ||
_ref$label$format$sho = _ref$label$format.showType, | ||
showType = _ref$label$format$sho === void 0 ? defaultCategoryAxis.label.format.showType : _ref$label$format$sho, | ||
_ref$label$appearance = _ref$label.appearance; | ||
_ref$label$appearance = _ref$label$appearance === void 0 ? defaultCategoryAxis.label.appearance : _ref$label$appearance; | ||
var _ref$label$appearance2 = _ref$label$appearance.count, | ||
count = _ref$label$appearance2 === void 0 ? defaultCategoryAxis.label.appearance.count : _ref$label$appearance2, | ||
_ref$label$appearance3 = _ref$label$appearance.angle, | ||
angle = _ref$label$appearance3 === void 0 ? defaultCategoryAxis.label.appearance.angle : _ref$label$appearance3, | ||
_ref$label$appearance4 = _ref$label$appearance.wordBreak, | ||
wordBreak = _ref$label$appearance4 === void 0 ? defaultCategoryAxis.label.appearance.wordBreak : _ref$label$appearance4, | ||
_ref$label$translate = _ref$label.translate; | ||
_ref$label$translate = _ref$label$translate === void 0 ? defaultCategoryAxis.label.translate : _ref$label$translate; | ||
var _ref$label$translate$ = _ref$label$translate.x, | ||
labelTranslateX = _ref$label$translate$ === void 0 ? defaultCategoryAxis.label.translate.x : _ref$label$translate$, | ||
_ref$label$translate$2 = _ref$label$translate.y, | ||
labelTranslateY = _ref$label$translate$2 === void 0 ? defaultCategoryAxis.label.translate.y : _ref$label$translate$2, | ||
_ref$label$font = _ref$label.font, | ||
labelFont = _ref$label$font === void 0 ? defaultCategoryAxis.label.font : _ref$label$font, | ||
_ref$axisLine = _ref.axisLine; | ||
_ref$axisLine = _ref$axisLine === void 0 ? defaultCategoryAxis.axisLine : _ref$axisLine; | ||
var _ref$axisLine$show = _ref$axisLine.show, | ||
showAxis = _ref$axisLine$show === void 0 ? defaultCategoryAxis.axisLine.show : _ref$axisLine$show, | ||
_ref$axisLine$color = _ref$axisLine.color, | ||
axisColor = _ref$axisLine$color === void 0 ? defaultCategoryAxis.axisLine.color : _ref$axisLine$color, | ||
_ref$axisLine$lineWid = _ref$axisLine.lineWidth, | ||
axisLineWidth = _ref$axisLine$lineWid === void 0 ? defaultCategoryAxis.axisLine.lineWidth : _ref$axisLine$lineWid, | ||
_ref$tickLine = _ref.tickLine; | ||
_ref$tickLine = _ref$tickLine === void 0 ? defaultCategoryAxis.tickLine : _ref$tickLine; | ||
var _ref$tickLine$show = _ref$tickLine.show, | ||
showTickLine = _ref$tickLine$show === void 0 ? defaultCategoryAxis.tickLine.show : _ref$tickLine$show, | ||
_ref$tickLine$color = _ref$tickLine.color, | ||
tickLineColor = _ref$tickLine$color === void 0 ? defaultCategoryAxis.tickLine.color : _ref$tickLine$color, | ||
_ref$tickLine$lineWid = _ref$tickLine.lineWidth, | ||
tickLineLineWidth = _ref$tickLine$lineWid === void 0 ? defaultCategoryAxis.tickLine.lineWidth : _ref$tickLine$lineWid, | ||
_ref$tickLine$tickSiz = _ref$tickLine.tickSize, | ||
tickLineTickSize = _ref$tickLine$tickSiz === void 0 ? defaultCategoryAxis.tickLine.tickSize : _ref$tickLine$tickSiz, | ||
_ref$gridLine = _ref.gridLine; | ||
_ref$gridLine = _ref$gridLine === void 0 ? defaultCategoryAxis.gridLine : _ref$gridLine; | ||
var _ref$gridLine$show = _ref$gridLine.show, | ||
showGridLine = _ref$gridLine$show === void 0 ? defaultCategoryAxis.gridLine.show : _ref$gridLine$show, | ||
_ref$gridLine$strokeD = _ref$gridLine.strokeDasharray, | ||
gridLineStrokeDasharray = _ref$gridLine$strokeD === void 0 ? defaultCategoryAxis.gridLine.strokeDasharray : _ref$gridLine$strokeD, | ||
_ref$gridLine$color = _ref$gridLine.color, | ||
gridLineColor = _ref$gridLine$color === void 0 ? defaultCategoryAxis.gridLine.color : _ref$gridLine$color, | ||
_ref$gridLine$lineWid = _ref$gridLine.lineWidth, | ||
gridLineLineWidth = _ref$gridLine$lineWid === void 0 ? defaultCategoryAxis.gridLine.lineWidth : _ref$gridLine$lineWid; | ||
return [{ | ||
name: 'on', | ||
displayName: '启用', | ||
value: on, | ||
type: 'boolean' | ||
}, _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _label.axisLabel)({ | ||
show: showLabel, | ||
format: { | ||
type: type, | ||
showType: showType | ||
}, | ||
appearance: { | ||
count: count, | ||
angle: angle, | ||
wordBreak: wordBreak | ||
}, | ||
translate: { | ||
x: labelTranslateX, | ||
y: labelTranslateY | ||
}, | ||
font: labelFont | ||
})), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.axisLine)({ | ||
show: showAxis, | ||
color: axisColor, | ||
lineWidth: axisLineWidth | ||
})), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.tickLine)({ | ||
show: showTickLine, | ||
color: tickLineColor, | ||
lineWidth: tickLineLineWidth, | ||
tickSize: tickLineTickSize | ||
})), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.gridLine)({ | ||
show: showGridLine, | ||
strokeDasharray: gridLineStrokeDasharray, | ||
color: gridLineColor, | ||
lineWidth: gridLineLineWidth | ||
}))]; | ||
}; | ||
exports.categoryAxis = categoryAxis; | ||
var valueAxis = function valueAxis() { | ||
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultValueAxis, | ||
on = _ref2.on, | ||
_ref2$label = _ref2.label; | ||
_ref2$label = _ref2.label, | ||
label = _ref2$label === void 0 ? defaultValueAxis.label : _ref2$label, | ||
_ref2$unit = _ref2.unit, | ||
unit_ = _ref2$unit === void 0 ? defaultValueAxis.unit : _ref2$unit, | ||
_ref2$axisLine = _ref2.axisLine, | ||
axisLine_ = _ref2$axisLine === void 0 ? defaultValueAxis.axisLine : _ref2$axisLine, | ||
_ref2$tickLine = _ref2.tickLine, | ||
tickLine_ = _ref2$tickLine === void 0 ? defaultValueAxis.tickLine : _ref2$tickLine, | ||
_ref2$gridLine = _ref2.gridLine, | ||
gridLine_ = _ref2$gridLine === void 0 ? defaultValueAxis.gridLine : _ref2$gridLine; | ||
_ref2$label = _ref2$label === void 0 ? defaultValueAxis.label : _ref2$label; | ||
var _ref2$label$show = _ref2$label.show, | ||
showLabel = _ref2$label$show === void 0 ? defaultValueAxis.label.show : _ref2$label$show, | ||
_ref2$label$extent = _ref2$label.extent; | ||
_ref2$label$extent = _ref2$label$extent === void 0 ? defaultValueAxis.label.extent : _ref2$label$extent; | ||
var _ref2$label$extent$mi = _ref2$label$extent.min, | ||
min = _ref2$label$extent$mi === void 0 ? defaultValueAxis.label.extent.min : _ref2$label$extent$mi, | ||
_ref2$label$extent$ma = _ref2$label$extent.max, | ||
max = _ref2$label$extent$ma === void 0 ? defaultValueAxis.label.extent.max : _ref2$label$extent$ma, | ||
_ref2$label$auto = _ref2$label.auto, | ||
auto = _ref2$label$auto === void 0 ? defaultValueAxis.label.auto : _ref2$label$auto, | ||
_ref2$label$mode = _ref2$label.mode, | ||
mode = _ref2$label$mode === void 0 ? defaultValueAxis.label.mode : _ref2$label$mode, | ||
_ref2$label$count = _ref2$label.count, | ||
count = _ref2$label$count === void 0 ? defaultValueAxis.label.count : _ref2$label$count, | ||
_ref2$label$step = _ref2$label.step, | ||
step = _ref2$label$step === void 0 ? defaultValueAxis.label.step : _ref2$label$step, | ||
_ref2$label$decimal = _ref2$label.decimal, | ||
decimal = _ref2$label$decimal === void 0 ? defaultValueAxis.label.decimal : _ref2$label$decimal, | ||
_ref2$label$suffix = _ref2$label.suffix, | ||
suffix = _ref2$label$suffix === void 0 ? defaultValueAxis.label.suffix : _ref2$label$suffix, | ||
_ref2$label$translate = _ref2$label.translate; | ||
_ref2$label$translate = _ref2$label$translate === void 0 ? defaultValueAxis.label.translate : _ref2$label$translate; | ||
var _ref2$label$translate2 = _ref2$label$translate.x, | ||
labelTranslateX = _ref2$label$translate2 === void 0 ? defaultValueAxis.label.translate.x : _ref2$label$translate2, | ||
_ref2$label$translate3 = _ref2$label$translate.y, | ||
labelTranslateY = _ref2$label$translate3 === void 0 ? defaultValueAxis.label.translate.y : _ref2$label$translate3, | ||
_ref2$label$font = _ref2$label.font, | ||
labelFont = _ref2$label$font === void 0 ? defaultValueAxis.label.font : _ref2$label$font, | ||
_ref2$unit = _ref2.unit; | ||
_ref2$unit = _ref2$unit === void 0 ? defaultValueAxis.unit : _ref2$unit; | ||
var _ref2$unit$show = _ref2$unit.show, | ||
showUnit = _ref2$unit$show === void 0 ? defaultValueAxis.unit.show : _ref2$unit$show, | ||
_ref2$unit$text = _ref2$unit.text, | ||
unitText = _ref2$unit$text === void 0 ? defaultValueAxis.unit.text : _ref2$unit$text, | ||
_ref2$unit$font = _ref2$unit.font, | ||
unitFont = _ref2$unit$font === void 0 ? defaultValueAxis.unit.font : _ref2$unit$font, | ||
_ref2$unit$translate = _ref2$unit.translate; | ||
_ref2$unit$translate = _ref2$unit$translate === void 0 ? defaultValueAxis.unit.translate : _ref2$unit$translate; | ||
var unitTranslateX = _ref2$unit$translate.x, | ||
unitTranslateY = _ref2$unit$translate.y, | ||
_ref2$axisLine = _ref2.axisLine; | ||
_ref2$axisLine = _ref2$axisLine === void 0 ? defaultValueAxis.axisLine : _ref2$axisLine; | ||
var _ref2$axisLine$show = _ref2$axisLine.show, | ||
showAxis = _ref2$axisLine$show === void 0 ? defaultValueAxis.axisLine.show : _ref2$axisLine$show, | ||
_ref2$axisLine$color = _ref2$axisLine.color, | ||
axisColor = _ref2$axisLine$color === void 0 ? defaultValueAxis.axisLine.color : _ref2$axisLine$color, | ||
_ref2$axisLine$lineWi = _ref2$axisLine.lineWidth, | ||
axisLineWidth = _ref2$axisLine$lineWi === void 0 ? defaultValueAxis.axisLine.lineWidth : _ref2$axisLine$lineWi, | ||
_ref2$tickLine = _ref2.tickLine; | ||
_ref2$tickLine = _ref2$tickLine === void 0 ? defaultValueAxis.tickLine : _ref2$tickLine; | ||
var _ref2$tickLine$show = _ref2$tickLine.show, | ||
showTickLine = _ref2$tickLine$show === void 0 ? defaultValueAxis.tickLine.show : _ref2$tickLine$show, | ||
_ref2$tickLine$color = _ref2$tickLine.color, | ||
tickLineColor = _ref2$tickLine$color === void 0 ? defaultValueAxis.tickLine.color : _ref2$tickLine$color, | ||
_ref2$tickLine$lineWi = _ref2$tickLine.lineWidth, | ||
tickLineLineWidth = _ref2$tickLine$lineWi === void 0 ? defaultValueAxis.tickLine.lineWidth : _ref2$tickLine$lineWi, | ||
_ref2$tickLine$tickSi = _ref2$tickLine.tickSize, | ||
tickLineTickSize = _ref2$tickLine$tickSi === void 0 ? defaultValueAxis.tickLine.tickSize : _ref2$tickLine$tickSi, | ||
_ref2$gridLine = _ref2.gridLine; | ||
_ref2$gridLine = _ref2$gridLine === void 0 ? defaultValueAxis.gridLine : _ref2$gridLine; | ||
var _ref2$gridLine$show = _ref2$gridLine.show, | ||
showGridLine = _ref2$gridLine$show === void 0 ? defaultValueAxis.gridLine.show : _ref2$gridLine$show, | ||
_ref2$gridLine$stroke = _ref2$gridLine.strokeDasharray, | ||
gridLineStrokeDasharray = _ref2$gridLine$stroke === void 0 ? defaultValueAxis.gridLine.strokeDasharray : _ref2$gridLine$stroke, | ||
_ref2$gridLine$color = _ref2$gridLine.color, | ||
gridLineColor = _ref2$gridLine$color === void 0 ? defaultValueAxis.gridLine.color : _ref2$gridLine$color, | ||
_ref2$gridLine$lineWi = _ref2$gridLine.lineWidth, | ||
gridLineLineWidth = _ref2$gridLine$lineWi === void 0 ? defaultValueAxis.gridLine.lineWidth : _ref2$gridLine$lineWi; | ||
return [{ | ||
@@ -295,99 +159,13 @@ name: 'on', | ||
type: 'boolean' | ||
}, { | ||
rule: [['on', '$eq', true]], | ||
name: 'label', | ||
displayName: '轴标签', | ||
value: [{ | ||
name: 'show', | ||
displayName: '显示', | ||
value: showLabel, | ||
type: 'boolean' | ||
}, _objectSpread({ | ||
rule: [['show', '$eq', true]] | ||
}, (0, _.extent)(min, max)), { | ||
rule: [['show', '$eq', true]], | ||
name: 'auto', | ||
displayName: '刻度自适应', | ||
value: auto, | ||
type: 'boolean' | ||
}, { | ||
rule: [['show', '$eq', true], ['auto', '$eq', false]], | ||
name: 'mode', | ||
displayName: '模式', | ||
value: mode, | ||
type: 'radio', | ||
config: { | ||
options: [{ | ||
name: '数量强制', | ||
value: 'count' | ||
}, { | ||
name: '步长强制', | ||
value: 'step' | ||
}] | ||
} | ||
}, { | ||
rule: [['show', '$eq', true], ['auto', '$eq', false], ['mode', '$eq', 'count']], | ||
name: 'count', | ||
displayName: '标签数量', | ||
value: count, | ||
min: 2, | ||
type: 'number' | ||
}, { | ||
rule: [['show', '$eq', true], ['auto', '$eq', false], ['mode', '$eq', 'step']], | ||
name: 'step', | ||
displayName: '步长', | ||
value: step, | ||
type: 'number' | ||
}, { | ||
rule: [['show', '$eq', true], ['auto', '$eq', false]], | ||
name: 'decimal', | ||
displayName: '小数位数', | ||
value: decimal, | ||
type: 'number' | ||
}, { | ||
rule: [['show', '$eq', true]], | ||
name: 'suffix', | ||
displayName: '后缀内容', | ||
value: suffix, | ||
type: 'input' | ||
}, _objectSpread({ | ||
rule: [['show', '$eq', true]] | ||
}, (0, _.translate)(labelTranslateX, labelTranslateY)), { | ||
rule: [['show', '$eq', true]], | ||
name: 'font', | ||
displayName: '文本样式', | ||
value: labelFont, | ||
type: 'textStyle' | ||
}] | ||
}, _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.unit)({ | ||
show: showUnit, | ||
text: unitText, | ||
font: unitFont, | ||
translate: { | ||
x: unitTranslateX, | ||
y: unitTranslateY | ||
} | ||
})), _objectSpread({ | ||
}, (0, _label.valueAsixLabel)(label)), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.axisLine)({ | ||
show: showAxis, | ||
color: axisColor, | ||
lineWidth: axisLineWidth | ||
})), _objectSpread({ | ||
}, (0, _.unit)(unit_)), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.tickLine)({ | ||
show: showTickLine, | ||
color: tickLineColor, | ||
lineWidth: tickLineLineWidth, | ||
tickSize: tickLineTickSize | ||
})), _objectSpread({ | ||
}, (0, _.axisLine)(axisLine_)), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.gridLine)({ | ||
show: showGridLine, | ||
strokeDasharray: gridLineStrokeDasharray, | ||
color: gridLineColor, | ||
lineWidth: gridLineLineWidth | ||
}))]; | ||
}, (0, _.tickLine)(tickLine_)), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.gridLine)(gridLine_))]; | ||
}; | ||
@@ -400,4 +178,3 @@ | ||
xAxis: defaultCategoryAxis, | ||
yAxis: defaultValueAxis, | ||
zAxis: defaultValueAxis | ||
yAxis: defaultValueAxis | ||
}, | ||
@@ -408,4 +185,3 @@ _ref3$xAxis = _ref3.xAxis, | ||
yAxis = _ref3$yAxis === void 0 ? defaultValueAxis : _ref3$yAxis, | ||
_ref3$zAxis = _ref3.zAxis, | ||
zAxis = _ref3$zAxis === void 0 ? defaultValueAxis : _ref3$zAxis; | ||
zAxis = _ref3.zAxis; | ||
@@ -423,7 +199,9 @@ return { | ||
value: valueAxis(yAxis) | ||
}, { | ||
}, zAxis && { | ||
name: 'zAxis', | ||
displayName: 'Z轴', | ||
value: valueAxis(zAxis) | ||
}], | ||
}].filter(function (item) { | ||
return !!item; | ||
}), | ||
config: { | ||
@@ -430,0 +208,0 @@ layout: 'horizontal' |
@@ -0,0 +0,0 @@ "use strict"; |
123
lib/label.js
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.axisLabel = exports.labelOfPie = exports["default"] = void 0; | ||
exports.valueAsixLabel = exports.axisLabel = exports.labelOfPie = exports["default"] = void 0; | ||
@@ -562,2 +562,121 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
exports.axisLabel = axisLabel; | ||
exports.axisLabel = axisLabel; | ||
var defaultValueAxisLabel = { | ||
show: true, | ||
extent: { | ||
min: '0', | ||
max: '' | ||
}, | ||
auto: false, | ||
mode: 'count', | ||
count: 3, | ||
step: 100, | ||
decimal: 0, | ||
suffix: '', | ||
translate: { | ||
x: 6, | ||
y: 0 | ||
}, | ||
font: defaultFont | ||
}; | ||
var valueAsixLabel = function valueAsixLabel() { | ||
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultValueAxisLabel, | ||
_ref4$show = _ref4.show, | ||
showLabel = _ref4$show === void 0 ? defaultValueAxisLabel.show : _ref4$show, | ||
_ref4$extent = _ref4.extent; | ||
_ref4$extent = _ref4$extent === void 0 ? defaultValueAxisLabel.extent : _ref4$extent; | ||
var _ref4$extent$min = _ref4$extent.min, | ||
min = _ref4$extent$min === void 0 ? defaultValueAxisLabel.extent.min : _ref4$extent$min, | ||
_ref4$extent$max = _ref4$extent.max, | ||
max = _ref4$extent$max === void 0 ? defaultValueAxisLabel.extent.max : _ref4$extent$max, | ||
_ref4$auto = _ref4.auto, | ||
auto = _ref4$auto === void 0 ? defaultValueAxisLabel.auto : _ref4$auto, | ||
_ref4$mode = _ref4.mode, | ||
mode = _ref4$mode === void 0 ? defaultValueAxisLabel.mode : _ref4$mode, | ||
_ref4$count = _ref4.count, | ||
count = _ref4$count === void 0 ? defaultValueAxisLabel.count : _ref4$count, | ||
_ref4$step = _ref4.step, | ||
step = _ref4$step === void 0 ? defaultValueAxisLabel.step : _ref4$step, | ||
_ref4$decimal = _ref4.decimal, | ||
decimal = _ref4$decimal === void 0 ? defaultValueAxisLabel.decimal : _ref4$decimal, | ||
_ref4$suffix = _ref4.suffix, | ||
suffix = _ref4$suffix === void 0 ? defaultValueAxisLabel.suffix : _ref4$suffix, | ||
_ref4$translate = _ref4.translate; | ||
_ref4$translate = _ref4$translate === void 0 ? defaultValueAxisLabel.translate : _ref4$translate; | ||
var _ref4$translate$x = _ref4$translate.x, | ||
labelTranslateX = _ref4$translate$x === void 0 ? defaultValueAxisLabel.translate.x : _ref4$translate$x, | ||
_ref4$translate$y = _ref4$translate.y, | ||
labelTranslateY = _ref4$translate$y === void 0 ? defaultValueAxisLabel.translate.y : _ref4$translate$y, | ||
_ref4$font = _ref4.font, | ||
labelFont = _ref4$font === void 0 ? defaultValueAxisLabel.font : _ref4$font; | ||
return { | ||
name: 'label', | ||
displayName: '轴标签', | ||
value: [{ | ||
name: 'show', | ||
displayName: '显示', | ||
value: showLabel, | ||
type: 'boolean' | ||
}, _objectSpread({ | ||
rule: [['show', '$eq', true]] | ||
}, (0, _.extent)(min, max)), { | ||
rule: [['show', '$eq', true]], | ||
name: 'auto', | ||
displayName: '刻度自适应', | ||
value: auto, | ||
type: 'boolean' | ||
}, { | ||
rule: [['show', '$eq', true], ['auto', '$eq', false]], | ||
name: 'mode', | ||
displayName: '模式', | ||
value: mode, | ||
type: 'radio', | ||
config: { | ||
options: [{ | ||
name: '数量强制', | ||
value: 'count' | ||
}, { | ||
name: '步长强制', | ||
value: 'step' | ||
}] | ||
} | ||
}, { | ||
rule: [['show', '$eq', true], ['auto', '$eq', false], ['mode', '$eq', 'count']], | ||
name: 'count', | ||
displayName: '标签数量', | ||
value: count, | ||
min: 2, | ||
type: 'number' | ||
}, { | ||
rule: [['show', '$eq', true], ['auto', '$eq', false], ['mode', '$eq', 'step']], | ||
name: 'step', | ||
displayName: '步长', | ||
value: step, | ||
type: 'number' | ||
}, { | ||
rule: [['show', '$eq', true], ['auto', '$eq', false]], | ||
name: 'decimal', | ||
displayName: '小数位数', | ||
value: decimal, | ||
type: 'number' | ||
}, { | ||
rule: [['show', '$eq', true]], | ||
name: 'suffix', | ||
displayName: '后缀内容', | ||
value: suffix, | ||
type: 'input' | ||
}, _objectSpread({ | ||
rule: [['show', '$eq', true]] | ||
}, (0, _.translate)(labelTranslateX, labelTranslateY)), { | ||
rule: [['show', '$eq', true]], | ||
name: 'font', | ||
displayName: '文本样式', | ||
value: labelFont, | ||
type: 'textStyle' | ||
}] | ||
}; | ||
}; | ||
exports.valueAsixLabel = valueAsixLabel; |
{ | ||
"name": "@easyv/config", | ||
"version": "1.0.32", | ||
"version": "1.0.33", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,0 +0,0 @@ import { show as showConfig } from './'; |
292
src/axes.js
@@ -1,3 +0,3 @@ | ||
import { gridLine, tickLine, axisLine, extent, unit, translate, font } from '.'; | ||
import { axisLabel } from './label'; | ||
import { gridLine, tickLine, axisLine, unit, font } from '.'; | ||
import { axisLabel, valueAsixLabel } from './label'; | ||
const defaultFont = font(); | ||
@@ -31,2 +31,33 @@ const defaultFontAxisY = font({ | ||
export const categoryAxis = ({ | ||
on = true, | ||
label = defaultCategoryAxis.label, | ||
axisLine: axisLine_ = defaultCategoryAxis.axisLine, | ||
tickLine: tickLine_ = defaultCategoryAxis.tickLine, | ||
gridLine: gridLine_ = defaultCategoryAxis.gridLine, | ||
}) => [ | ||
{ | ||
name: 'on', | ||
displayName: '启用', | ||
value: on, | ||
type: 'boolean', | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...axisLabel(label), | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...axisLine(axisLine_), | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...tickLine(tickLine_), | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...gridLine(gridLine_), | ||
}, | ||
]; | ||
const defaultValueAxis = { | ||
@@ -67,129 +98,9 @@ on: true, | ||
export const categoryAxis = ({ | ||
on = defaultCategoryAxis.on, | ||
label: { | ||
show: showLabel = defaultCategoryAxis.label.show, | ||
format: { | ||
type = defaultCategoryAxis.label.format.type, | ||
showType = defaultCategoryAxis.label.format.showType | ||
} = defaultCategoryAxis.label.format, | ||
appearance: { | ||
count = defaultCategoryAxis.label.appearance.count, | ||
angle = defaultCategoryAxis.label.appearance.angle, | ||
wordBreak = defaultCategoryAxis.label.appearance.wordBreak | ||
} = defaultCategoryAxis.label.appearance, | ||
translate: { | ||
x: labelTranslateX = defaultCategoryAxis.label.translate.x, | ||
y: labelTranslateY = defaultCategoryAxis.label.translate.y | ||
} = defaultCategoryAxis.label.translate, | ||
font: labelFont = defaultCategoryAxis.label.font, | ||
} = defaultCategoryAxis.label, | ||
axisLine: { | ||
show: showAxis = defaultCategoryAxis.axisLine.show, | ||
color: axisColor = defaultCategoryAxis.axisLine.color, | ||
lineWidth: axisLineWidth = defaultCategoryAxis.axisLine.lineWidth, | ||
} = defaultCategoryAxis.axisLine, | ||
tickLine: { | ||
show: showTickLine = defaultCategoryAxis.tickLine.show, | ||
color: tickLineColor = defaultCategoryAxis.tickLine.color, | ||
lineWidth: tickLineLineWidth = defaultCategoryAxis.tickLine.lineWidth, | ||
tickSize: tickLineTickSize = defaultCategoryAxis.tickLine.tickSize, | ||
} = defaultCategoryAxis.tickLine, | ||
gridLine: { | ||
show: showGridLine = defaultCategoryAxis.gridLine.show, | ||
strokeDasharray: gridLineStrokeDasharray = defaultCategoryAxis.gridLine | ||
.strokeDasharray, | ||
color: gridLineColor = defaultCategoryAxis.gridLine.color, | ||
lineWidth: gridLineLineWidth = defaultCategoryAxis.gridLine.lineWidth, | ||
} = defaultCategoryAxis.gridLine, | ||
}) => [ | ||
{ | ||
name: 'on', | ||
displayName: '启用', | ||
value: on, | ||
type: 'boolean', | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...axisLabel({ | ||
show:showLabel, | ||
format: { type: type, showType: showType }, | ||
appearance: { count: count, angle: angle, wordBreak: wordBreak }, | ||
translate: { x: labelTranslateX, y: labelTranslateY }, | ||
font: labelFont, | ||
}), | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...axisLine({ | ||
show: showAxis, | ||
color: axisColor, | ||
lineWidth: axisLineWidth, | ||
}), | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...tickLine({ | ||
show: showTickLine, | ||
color: tickLineColor, | ||
lineWidth: tickLineLineWidth, | ||
tickSize: tickLineTickSize, | ||
}), | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...gridLine({ | ||
show: showGridLine, | ||
strokeDasharray: gridLineStrokeDasharray, | ||
color: gridLineColor, | ||
lineWidth: gridLineLineWidth, | ||
}), | ||
}, | ||
]; | ||
export const valueAxis = ({ | ||
on, | ||
label: { | ||
show: showLabel = defaultValueAxis.label.show, | ||
extent: { | ||
min = defaultValueAxis.label.extent.min, | ||
max = defaultValueAxis.label.extent.max, | ||
} = defaultValueAxis.label.extent, | ||
auto = defaultValueAxis.label.auto, | ||
mode = defaultValueAxis.label.mode, | ||
count = defaultValueAxis.label.count, | ||
step = defaultValueAxis.label.step, | ||
decimal = defaultValueAxis.label.decimal, | ||
suffix = defaultValueAxis.label.suffix, | ||
translate: { | ||
x: labelTranslateX = defaultValueAxis.label.translate.x, | ||
y: labelTranslateY = defaultValueAxis.label.translate.y, | ||
} = defaultValueAxis.label.translate, | ||
font: labelFont = defaultValueAxis.label.font, | ||
} = defaultValueAxis.label, | ||
unit: { | ||
show: showUnit = defaultValueAxis.unit.show, | ||
text: unitText = defaultValueAxis.unit.text, | ||
font: unitFont = defaultValueAxis.unit.font, | ||
translate: { x: unitTranslateX, y: unitTranslateY } = defaultValueAxis.unit | ||
.translate, | ||
} = defaultValueAxis.unit, | ||
axisLine: { | ||
show: showAxis = defaultValueAxis.axisLine.show, | ||
color: axisColor = defaultValueAxis.axisLine.color, | ||
lineWidth: axisLineWidth = defaultValueAxis.axisLine.lineWidth, | ||
} = defaultValueAxis.axisLine, | ||
tickLine: { | ||
show: showTickLine = defaultValueAxis.tickLine.show, | ||
color: tickLineColor = defaultValueAxis.tickLine.color, | ||
lineWidth: tickLineLineWidth = defaultValueAxis.tickLine.lineWidth, | ||
tickSize: tickLineTickSize = defaultValueAxis.tickLine.tickSize, | ||
} = defaultValueAxis.tickLine, | ||
gridLine: { | ||
show: showGridLine = defaultValueAxis.gridLine.show, | ||
strokeDasharray: gridLineStrokeDasharray = defaultValueAxis.gridLine | ||
.strokeDasharray, | ||
color: gridLineColor = defaultValueAxis.gridLine.color, | ||
lineWidth: gridLineLineWidth = defaultValueAxis.gridLine.lineWidth, | ||
} = defaultValueAxis.gridLine, | ||
label = defaultValueAxis.label, | ||
unit: unit_ = defaultValueAxis.unit, | ||
axisLine: axisLine_ = defaultValueAxis.axisLine, | ||
tickLine: tickLine_ = defaultValueAxis.tickLine, | ||
gridLine: gridLine_ = defaultValueAxis.gridLine, | ||
} = defaultValueAxis) => [ | ||
@@ -204,125 +115,19 @@ { | ||
rule: [['on', '$eq', true]], | ||
name: 'label', | ||
displayName: '轴标签', | ||
value: [ | ||
{ | ||
name: 'show', | ||
displayName: '显示', | ||
value: showLabel, | ||
type: 'boolean', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
...extent(min, max), | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'auto', | ||
displayName: '刻度自适应', | ||
value: auto, | ||
type: 'boolean', | ||
}, | ||
{ | ||
rule: [ | ||
['show', '$eq', true], | ||
['auto', '$eq', false], | ||
], | ||
name: 'mode', | ||
displayName: '模式', | ||
value: mode, | ||
type: 'radio', | ||
config: { | ||
options: [ | ||
{ name: '数量强制', value: 'count' }, | ||
{ name: '步长强制', value: 'step' }, | ||
], | ||
}, | ||
}, | ||
{ | ||
rule: [ | ||
['show', '$eq', true], | ||
['auto', '$eq', false], | ||
['mode', '$eq', 'count'], | ||
], | ||
name: 'count', | ||
displayName: '标签数量', | ||
value: count, | ||
min: 2, | ||
type: 'number', | ||
}, | ||
{ | ||
rule: [ | ||
['show', '$eq', true], | ||
['auto', '$eq', false], | ||
['mode', '$eq', 'step'], | ||
], | ||
name: 'step', | ||
displayName: '步长', | ||
value: step, | ||
type: 'number', | ||
}, | ||
{ | ||
rule: [ | ||
['show', '$eq', true], | ||
['auto', '$eq', false], | ||
], | ||
name: 'decimal', | ||
displayName: '小数位数', | ||
value: decimal, | ||
type: 'number', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'suffix', | ||
displayName: '后缀内容', | ||
value: suffix, | ||
type: 'input', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
...translate(labelTranslateX, labelTranslateY), | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'font', | ||
displayName: '文本样式', | ||
value: labelFont, | ||
type: 'textStyle', | ||
}, | ||
], | ||
...valueAsixLabel(label), | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...unit({ | ||
show: showUnit, | ||
text: unitText, | ||
font: unitFont, | ||
translate: { x: unitTranslateX, y: unitTranslateY }, | ||
}), | ||
...unit(unit_), | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...axisLine({ | ||
show: showAxis, | ||
color: axisColor, | ||
lineWidth: axisLineWidth, | ||
}), | ||
...axisLine(axisLine_), | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...tickLine({ | ||
show: showTickLine, | ||
color: tickLineColor, | ||
lineWidth: tickLineLineWidth, | ||
tickSize: tickLineTickSize, | ||
}), | ||
...tickLine(tickLine_), | ||
}, | ||
{ | ||
rule: [['on', '$eq', true]], | ||
...gridLine({ | ||
show: showGridLine, | ||
strokeDasharray: gridLineStrokeDasharray, | ||
color: gridLineColor, | ||
lineWidth: gridLineLineWidth, | ||
}), | ||
...gridLine(gridLine_), | ||
}, | ||
@@ -332,10 +137,5 @@ ]; | ||
export default ( | ||
{ | ||
xAxis = defaultCategoryAxis, | ||
yAxis = defaultValueAxis, | ||
zAxis = defaultValueAxis, | ||
} = { | ||
{ xAxis = defaultCategoryAxis, yAxis = defaultValueAxis, zAxis } = { | ||
xAxis: defaultCategoryAxis, | ||
yAxis: defaultValueAxis, | ||
zAxis: defaultValueAxis, | ||
} | ||
@@ -356,3 +156,3 @@ ) => ({ | ||
}, | ||
{ | ||
zAxis && { | ||
name: 'zAxis', | ||
@@ -362,3 +162,3 @@ displayName: 'Z轴', | ||
}, | ||
], | ||
].filter((item) => !!item), | ||
config: { | ||
@@ -365,0 +165,0 @@ layout: 'horizontal', |
@@ -0,0 +0,0 @@ const axisLine = { |
@@ -0,0 +0,0 @@ const defaultBrush = { |
@@ -0,0 +0,0 @@ const defaultDimension = { |
@@ -0,0 +0,0 @@ const extent = { |
@@ -0,0 +0,0 @@ const defaultFont = { |
@@ -0,0 +0,0 @@ const gridLine = { |
@@ -0,0 +0,0 @@ import show from './show'; |
@@ -0,0 +0,0 @@ /** |
122
src/label.js
@@ -1,2 +0,2 @@ | ||
import { translate, font } from '.'; | ||
import { translate, font, extent } from '.'; | ||
@@ -542,1 +542,121 @@ const defaultFont = font(); | ||
}); | ||
const defaultValueAxisLabel = { | ||
show: true, | ||
extent: { min: '0', max: '' }, | ||
auto: false, | ||
mode: 'count', | ||
count: 3, | ||
step: 100, | ||
decimal: 0, | ||
suffix: '', | ||
translate: { x: 6, y: 0 }, | ||
font: defaultFont, | ||
} | ||
export const valueAsixLabel = ({ | ||
show: showLabel = defaultValueAxisLabel.show, | ||
extent: { | ||
min = defaultValueAxisLabel.extent.min, | ||
max = defaultValueAxisLabel.extent.max, | ||
} = defaultValueAxisLabel.extent, | ||
auto = defaultValueAxisLabel.auto, | ||
mode = defaultValueAxisLabel.mode, | ||
count = defaultValueAxisLabel.count, | ||
step = defaultValueAxisLabel.step, | ||
decimal = defaultValueAxisLabel.decimal, | ||
suffix = defaultValueAxisLabel.suffix, | ||
translate: { | ||
x: labelTranslateX = defaultValueAxisLabel.translate.x, | ||
y: labelTranslateY = defaultValueAxisLabel.translate.y, | ||
} = defaultValueAxisLabel.translate, | ||
font: labelFont = defaultValueAxisLabel.font, | ||
} = defaultValueAxisLabel) => ({ | ||
name: 'label', | ||
displayName: '轴标签', | ||
value: [ | ||
{ | ||
name: 'show', | ||
displayName: '显示', | ||
value: showLabel, | ||
type: 'boolean', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
...extent(min, max), | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'auto', | ||
displayName: '刻度自适应', | ||
value: auto, | ||
type: 'boolean', | ||
}, | ||
{ | ||
rule: [ | ||
['show', '$eq', true], | ||
['auto', '$eq', false], | ||
], | ||
name: 'mode', | ||
displayName: '模式', | ||
value: mode, | ||
type: 'radio', | ||
config: { | ||
options: [ | ||
{ name: '数量强制', value: 'count' }, | ||
{ name: '步长强制', value: 'step' }, | ||
], | ||
}, | ||
}, | ||
{ | ||
rule: [ | ||
['show', '$eq', true], | ||
['auto', '$eq', false], | ||
['mode', '$eq', 'count'], | ||
], | ||
name: 'count', | ||
displayName: '标签数量', | ||
value: count, | ||
min: 2, | ||
type: 'number', | ||
}, | ||
{ | ||
rule: [ | ||
['show', '$eq', true], | ||
['auto', '$eq', false], | ||
['mode', '$eq', 'step'], | ||
], | ||
name: 'step', | ||
displayName: '步长', | ||
value: step, | ||
type: 'number', | ||
}, | ||
{ | ||
rule: [ | ||
['show', '$eq', true], | ||
['auto', '$eq', false], | ||
], | ||
name: 'decimal', | ||
displayName: '小数位数', | ||
value: decimal, | ||
type: 'number', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'suffix', | ||
displayName: '后缀内容', | ||
value: suffix, | ||
type: 'input', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
...translate(labelTranslateX, labelTranslateY), | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'font', | ||
displayName: '文本样式', | ||
value: labelFont, | ||
type: 'textStyle', | ||
}, | ||
] | ||
}); |
@@ -0,0 +0,0 @@ const { translate: translateConfig, font, show: showConfig } = require('.'); |
@@ -0,0 +0,0 @@ const defaultMapping = { fieldName: '', displayName: '' }; |
@@ -0,0 +0,0 @@ const defaultMargin = { |
@@ -0,0 +0,0 @@ import { font, show as showConfig, translate as translateConfig } from './'; |
@@ -0,0 +0,0 @@ import { mapping, label } from '.'; |
@@ -0,0 +0,0 @@ export default (show = false) => ({ |
@@ -0,0 +0,0 @@ const defaultTickLine = { |
@@ -0,0 +0,0 @@ import { translate, margin } from '.'; |
@@ -0,0 +0,0 @@ export default (x = 0, y = 0) => ({ |
@@ -0,0 +0,0 @@ const { translate } = require('.'); |
Sorry, the diff of this file is not supported yet
213446
7436