UNPKG

cione-comp-lib

Version:

`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`

96 lines (95 loc) 2.61 kB
import { __extends } from "../../../../tslib/tslib.es6.mjs"; import { isArray, map } from "../../../../zrender/lib/core/util.mjs"; import ComponentModel from "../../model/Component.mjs"; import { getLayoutParams, sizeCalculable, mergeLayoutParam } from "../../util/layout.mjs"; var CalendarModel = function(_super) { __extends(CalendarModel2, _super); function CalendarModel2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = CalendarModel2.type; return _this; } CalendarModel2.prototype.init = function(option, parentModel, ecModel) { var inputPositionParams = getLayoutParams(option); _super.prototype.init.apply(this, arguments); mergeAndNormalizeLayoutParams(option, inputPositionParams); }; CalendarModel2.prototype.mergeOption = function(option) { _super.prototype.mergeOption.apply(this, arguments); mergeAndNormalizeLayoutParams(this.option, option); }; CalendarModel2.prototype.getCellSize = function() { return this.option.cellSize; }; CalendarModel2.type = "calendar"; CalendarModel2.defaultOption = { z: 2, left: 80, top: 60, cellSize: 20, orient: "horizontal", splitLine: { show: true, lineStyle: { color: "#000", width: 1, type: "solid" } }, itemStyle: { color: "#fff", borderWidth: 1, borderColor: "#ccc" }, dayLabel: { show: true, firstDay: 0, position: "start", margin: "50%", color: "#000" }, monthLabel: { show: true, position: "start", margin: 5, align: "center", formatter: null, color: "#000" }, yearLabel: { show: true, position: null, margin: 30, formatter: null, color: "#ccc", fontFamily: "sans-serif", fontWeight: "bolder", fontSize: 20 } }; return CalendarModel2; }(ComponentModel); function mergeAndNormalizeLayoutParams(target, raw) { var cellSize = target.cellSize; var cellSizeArr; if (!isArray(cellSize)) { cellSizeArr = target.cellSize = [cellSize, cellSize]; } else { cellSizeArr = cellSize; } if (cellSizeArr.length === 1) { cellSizeArr[1] = cellSizeArr[0]; } var ignoreSize = map([0, 1], function(hvIdx) { if (sizeCalculable(raw, hvIdx)) { cellSizeArr[hvIdx] = "auto"; } return cellSizeArr[hvIdx] != null && cellSizeArr[hvIdx] !== "auto"; }); mergeLayoutParam(target, raw, { type: "box", ignoreSize }); } var CalendarModel$1 = CalendarModel; export { CalendarModel$1 as default };