82 lines
3.4 KiB
JavaScript
82 lines
3.4 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.prepareComponentToken = exports.initPickerPanelToken = exports.initPanelComponentToken = void 0;
|
|
var _tinycolor = require("@ctrl/tinycolor");
|
|
var _token = require("../../input/style/token");
|
|
var _roundedArrow = require("../../style/roundedArrow");
|
|
const initPickerPanelToken = token => {
|
|
const {
|
|
componentCls,
|
|
controlHeightLG,
|
|
paddingXXS,
|
|
padding
|
|
} = token;
|
|
return {
|
|
pickerCellCls: `${componentCls}-cell`,
|
|
pickerCellInnerCls: `${componentCls}-cell-inner`,
|
|
pickerYearMonthCellWidth: token.calc(controlHeightLG).mul(1.5).equal(),
|
|
pickerQuarterPanelContentHeight: token.calc(controlHeightLG).mul(1.4).equal(),
|
|
pickerCellPaddingVertical: token.calc(paddingXXS).add(token.calc(paddingXXS).div(2)).equal(),
|
|
pickerCellBorderGap: 2,
|
|
// Magic for gap between cells
|
|
pickerControlIconSize: 7,
|
|
pickerControlIconMargin: 4,
|
|
pickerControlIconBorderWidth: 1.5,
|
|
pickerDatePanelPaddingHorizontal: token.calc(padding).add(token.calc(paddingXXS).div(2)).equal() // 18 in normal
|
|
};
|
|
};
|
|
exports.initPickerPanelToken = initPickerPanelToken;
|
|
const initPanelComponentToken = token => {
|
|
const {
|
|
colorBgContainerDisabled,
|
|
controlHeight,
|
|
controlHeightSM,
|
|
controlHeightLG,
|
|
paddingXXS,
|
|
lineWidth
|
|
} = token;
|
|
// Item height default use `controlHeight - 2 * paddingXXS`,
|
|
// but some case `paddingXXS=0`.
|
|
// Let's fallback it.
|
|
const dblPaddingXXS = paddingXXS * 2;
|
|
const dblLineWidth = lineWidth * 2;
|
|
const multipleItemHeight = Math.min(controlHeight - dblPaddingXXS, controlHeight - dblLineWidth);
|
|
const multipleItemHeightSM = Math.min(controlHeightSM - dblPaddingXXS, controlHeightSM - dblLineWidth);
|
|
const multipleItemHeightLG = Math.min(controlHeightLG - dblPaddingXXS, controlHeightLG - dblLineWidth);
|
|
// FIXED_ITEM_MARGIN is a hardcode calculation since calc not support rounding
|
|
const INTERNAL_FIXED_ITEM_MARGIN = Math.floor(paddingXXS / 2);
|
|
const filledToken = {
|
|
INTERNAL_FIXED_ITEM_MARGIN,
|
|
cellHoverBg: token.controlItemBgHover,
|
|
cellActiveWithRangeBg: token.controlItemBgActive,
|
|
cellHoverWithRangeBg: new _tinycolor.TinyColor(token.colorPrimary).lighten(35).toHexString(),
|
|
cellRangeBorderColor: new _tinycolor.TinyColor(token.colorPrimary).lighten(20).toHexString(),
|
|
cellBgDisabled: colorBgContainerDisabled,
|
|
timeColumnWidth: controlHeightLG * 1.4,
|
|
timeColumnHeight: 28 * 8,
|
|
timeCellHeight: 28,
|
|
cellWidth: controlHeightSM * 1.5,
|
|
cellHeight: controlHeightSM,
|
|
textHeight: controlHeightLG,
|
|
withoutTimeCellHeight: controlHeightLG * 1.65,
|
|
multipleItemBg: token.colorFillSecondary,
|
|
multipleItemBorderColor: 'transparent',
|
|
multipleItemHeight,
|
|
multipleItemHeightSM,
|
|
multipleItemHeightLG,
|
|
multipleSelectorBgDisabled: colorBgContainerDisabled,
|
|
multipleItemColorDisabled: token.colorTextDisabled,
|
|
multipleItemBorderColorDisabled: 'transparent'
|
|
};
|
|
return filledToken;
|
|
};
|
|
exports.initPanelComponentToken = initPanelComponentToken;
|
|
const prepareComponentToken = token => Object.assign(Object.assign(Object.assign(Object.assign({}, (0, _token.initComponentToken)(token)), initPanelComponentToken(token)), (0, _roundedArrow.getArrowToken)(token)), {
|
|
presetsWidth: 120,
|
|
presetsMaxWidth: 200,
|
|
zIndexPopup: token.zIndexPopupBase + 50
|
|
});
|
|
exports.prepareComponentToken = prepareComponentToken; |