UNPKG

acud

Version:

acg react 组件库

1,088 lines (925 loc) • 32.7 kB
@picker-cell-inner-cls: ~'@{picker-prefix-cls}-cell-inner'; .@{picker-prefix-cls} { @picker-arrow-size: 7px; @picker-year-month-cell-width: 60px; // @picker-panel-width: @picker-panel-cell-width * 7+@padding-sm * 2+4; &-panel { display: inline-flex; flex-direction: column; text-align: center; border-radius: @border-radius-base; outline: none; &-header { height: 8*@P; padding: 0 3*@P; background-color: @G10; font-size: @T2; line-height: 8*@P; color: @G2; > li { .basic-tp-config(@date-picker-header-tp); margin-right: 6*@P; display: inline-block; cursor: pointer; } } &.@{picker-prefix-cls}-panel-has-range { .@{picker-prefix-cls}-date-panel .@{picker-prefix-cls}-content td:not(.@{picker-prefix-cls}-cell-range-hover-start):not(.@{picker-prefix-cls}-cell-range-hover-end):not(.@{picker-prefix-cls}-cell-range-start):not(.@{picker-prefix-cls}-cell-range-end):not(.@{picker-prefix-cls}-cell-today):hover { // background-color: @G10 !important; .@{picker-prefix-cls}-cell-inner { background-color: @G10 !important; } } } } // ======================================================== // = Shared Panel = // ======================================================== &-date-panel, &-decade-panel, &-year-panel, &-quarter-panel, &-month-panel, &-week-panel, &-date-panel, &-time-panel { display: flex; flex-direction: column; width: @date-picker-panel-width; } &-decade-panel { width: 286px; } &-month-panel, &-year-panel { .@{picker-prefix-cls}-cell-in-range, .@{picker-prefix-cls}-cell-range-hover { &:not(:first-child)::before { width: 3*@P; left: -3*@P; background: @picker-basic-cell-active-with-range-color; } } .@{picker-prefix-cls}-cell-in-view { &.@{picker-prefix-cls}-cell-in-range { &.@{picker-prefix-cls}-cell-range-hover-end, &.@{picker-prefix-cls}-cell-range-hover-start { &:hover { .@{picker-prefix-cls}-cell-inner { background-color: @B2; } } } } &.@{picker-prefix-cls}-cell-range-hover-end, &.@{picker-prefix-cls}-cell-range-hover-start { &:not(.@{picker-prefix-cls}-cell-in-range):not(.@{picker-prefix-cls}-cell-selected):not(.@{picker-prefix-cls}-cell-range-end):not(.@{picker-prefix-cls}-cell-range-start):hover { .@{picker-prefix-cls}-cell-inner { background: @picker-basic-cell-active-with-range-color; } } } } .@{picker-prefix-cls}-cell-disabled { &:not(:first-child) { &::before { left: -3*@P; } } } } // ======================= Header ======================= &-header { display: flex; padding: 0 3*@P; .basic-tp-config(@date-picker-date-tp); border-bottom: 1px solid @G8; >* { flex: none; } button { padding: 0; .basic-tp-config(@date-picker-header-icon-tp); background: transparent; border: 0; cursor: pointer; transition: color @animation-duration-slow; } >button { min-width: 2*@P; font-size: 4*@P; } &-super-prev-btn, &-next-btn { margin-right: @P; } &-view { flex: auto; font-size: @T2; line-height: 10*@P; .basic-tp-config(@date-picker-date-tp); button { font-size: @T2; color: inherit; font-weight: 400; .basic-tp-config(@date-picker-header-tp); &:not(:first-child) { margin-left: 2*@P; } } } } // Arrow button &-prev-icon, &-next-icon, &-super-prev-icon, &-super-next-icon { position: relative; display: inline-block; width: @picker-arrow-size; height: @picker-arrow-size; &::before { position: absolute; top: 0; left: 0; display: inline-block; width: @picker-arrow-size; height: @picker-arrow-size; border: 0 solid currentColor; border-width: 1px 0 0 1px; content: ''; } } &-super-prev-icon, &-super-next-icon { &::after { position: absolute; top: floor((@picker-arrow-size / 2)); left: floor((@picker-arrow-size / 2)); display: inline-block; width: @picker-arrow-size; height: @picker-arrow-size; border: 0 solid currentColor; border-width: 1px 0 0 1px; content: ''; } } &-prev-icon, &-super-prev-icon { transform: rotate(-45deg); } &-next-icon, &-super-next-icon { transform: rotate(135deg); } // ======================== Body ======================== &-content { width: 100%; table-layout: fixed; border-collapse: collapse; >div { width: 8*@P; margin-right: 4*@P; height: 6*@P + 2; overflow: visible; &:after { content: ':'; display: block; position: relative; top: -7*@P; left: 6*@P; } input { width: 100%; outline-style: none; line-height: 6*@P; text-align: center; height: 6*@P; box-sizing: border-box; border: 1px solid; .basic-p-config(@date-picker-default-p); } &:last-child { &:after { display: none; } } } th, td { position: relative; font-weight: 400; font-size: @date-picker-base-font-size; } td { // .basic-p-config(@date-picker-date-p); } } .picker-cell-inner(@cellClassName) { &::before { position: absolute; top: 50%; right: 0; left: 0; z-index: 1; height: @picker-panel-cell-height; transform: translateY(-50%); content: ''; } // >>> Default .@{cellClassName} { position: relative; z-index: 2; display: inline-block; min-width: 6*@P; height: @picker-panel-cell-height; line-height: @picker-panel-cell-height; border-radius: @R2; transition: background @animation-duration-slow, border @animation-duration-slow; } // >>> Hover &:hover:not(&-in-view), &:hover:not(&-selected):not(&-range-start):not(&-range-end):not(&-range-hover-start):not(&-range-hover-end) { .@{cellClassName} { background: @G10; border-radius: @R2; } } // >>> Today &-in-view&-today .@{cellClassName} { &::before { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 1; border: 1px solid @B6; content: ''; border-radius: @R2; } } &-today:not(&-in-range):not(&-range-hover):not(&-range-end):not(&-selected):not(&-range-start):not(&-disabled) { background-color: transparent; .@{picker-prefix-cls}-cell-inner { background-color: transparent; } } // >>> In Range &-in-view&-in-range, &-in-view&-range-hover { position: relative; background: @picker-basic-cell-active-with-range-color; &:not(:first-child)::before { width: 3*@P; left: -3*@P; background: @picker-basic-cell-active-with-range-color; } &.@{picker-prefix-cls}-cell-start { &::before { background: transparent; } } } &-start&-in-view&-range-end&-selected { &::before { width: 0 !important; background: transparent !important; } } &-in-view&-range-end:not(:first-child)::before, &-in-view&-range-hover-end:not(:first-child)::before{ width: 3*@P; left: -3*@P; background: @picker-basic-cell-active-with-range-color; } &-in-view&-range-hover-end&-range-hover-edge-start:not(:first-child)::before { background-color: transparent; } // >>> Selected &-in-view&-selected .@{cellClassName}, &-in-view&-range-start .@{cellClassName}, &-in-view&-range-end .@{cellClassName} { .property-setting(@date-picker-date-tp, 'click', color); // background: @B6; .property-setting(@date-picker-date-p, 'click', background-color); } &-in-view&-range-start, &-in-view&-range-end { .@{picker-prefix-cls}-cell-inner { border-radius: @R2; } } &-in-view&-range-start:not(&-range-start-single), &-in-view&-range-end:not(&-range-end-single) { &::before { background: @picker-basic-cell-active-with-range-color; } } &-in-view&-range-start&-range-end { &::before { background: transparent; } } &-in-view&-range-start&-range-end&-selected, &-in-view&-range-start&-range-hover-start&-range-hover-end { &::before { background: transparent !important; } } &-range-end-single:not(&-range-hover-end) { &::before { background: transparent !important; } } &-in-view&-range-start&-range-hover-start::before { background-color: @picker-basic-cell-active-with-range-color; } &-in-view&-range-start::before { left: 50%; } &-in-view&-range-end::before { right: 50%; } // Add space for stash &-range-hover-start::after, &-range-hover-end::after, &-range-hover::after { right: 0; left: 2px; } // Hover with in range // &-in-view&-in-range&-range-hover::before, // &-in-view&-range-start&-range-hover::before, // &-in-view&-range-end&-range-hover::before, // &-in-view&-range-start:not(&-range-start-single)&-range-hover-start::before, // &-in-view&-range-end:not(&-range-end-single)&-range-hover-end::before, // .@{picker-prefix-cls}-panel> :not(.@{picker-prefix-cls}-date-panel) &-in-view&-in-range&-range-hover-start::before, // .@{picker-prefix-cls}-panel> :not(.@{picker-prefix-cls}-date-panel) &-in-view&-in-range&-range-hover-end::before { // background: @picker-date-hover-range-color; // } // range start border-radius // &-in-view&-range-start:not(&-range-start-single):not(&-range-end) .@{cellClassName} { // border-radius: @border-radius-base 0 0 @border-radius-base; // } // range end border-radius // &-in-view&-range-end:not(&-range-end-single):not(&-range-start) .@{cellClassName} { // border-radius: 0 @border-radius-base @border-radius-base 0; // } // DatePanel only .@{picker-prefix-cls}-date-panel &-in-view&-in-range&-range-hover-start .@{cellClassName}, .@{picker-prefix-cls}-date-panel &-in-view&-in-range&-range-hover-end .@{cellClassName} { &::after { position: absolute; top: 0; bottom: 0; z-index: -1; background: @picker-date-hover-range-color; content: ''; border-radius: @R2; } } .@{picker-prefix-cls}-date-panel &-in-view&-in-range&-range-hover-start .@{cellClassName}::after { right: 0; left: 0; } .@{picker-prefix-cls}-date-panel &-in-view&-in-range&-range-hover-end .@{cellClassName}::after { right: 0; left: 0; } .@{picker-prefix-cls}-date-panel &-in-view&-range-hover:not(:first-child)::before { left: -3*@P + 3; } // Hover with range start & end &-range-hover&-range-start::after { right: 50%; } &-range-hover&-range-end::after { left: 50%; } // Edge start tr>&-in-view&-range-hover:first-child::after, tr>&-in-view&-range-hover-end:first-child::after, &-in-view&-start&-range-hover-edge-start&-range-hover-edge-start-near-range::after, &-in-view&-range-hover-edge-start:not(&-range-hover-edge-start-near-range)::after, &-in-view&-range-hover-start::after { left: 0; border-left: @border-width-base dashed @picker-date-hover-range-border-color; border-top-left-radius: @border-radius-base; border-bottom-left-radius: @border-radius-base; } // Edge end tr>&-in-view&-range-hover:last-child::after, tr>&-in-view&-range-hover-start:last-child::after, &-in-view&-end&-range-hover-edge-end&-range-hover-edge-end-near-range::after, &-in-view&-range-hover-edge-end:not(&-range-hover-edge-end-near-range)::after, &-in-view&-range-hover-end::after { right: 0; border-right: @border-width-base dashed @picker-date-hover-range-border-color; border-top-right-radius: @border-radius-base; border-bottom-right-radius: @border-radius-base; } // >>> Disabled &-disabled { pointer-events: none; .@{cellClassName} { color: @G6; background: @G10; } // &::before { // background: @picker-basic-cell-disabled-bg; // } &:not(:first-child) { &::before { width: 3*@P; left: -3*@P + 2; background: @G10; } } } &-disabled&-today .@{cellClassName}::before { border-color: @disabled-color; } } &-cell { cursor: pointer; .property-setting(@date-picker-date-tp, 'disabled', color); // In view &-in-view { .property-setting(@date-picker-date-tp, 'default', color); } // Disabled &-disabled { cursor: not-allowed; } .picker-cell-inner(~'@{picker-cell-inner-cls}'); } &-decade-panel, &-year-panel, &-quarter-panel, &-month-panel { .@{picker-prefix-cls}-content { // height: @picker-panel-without-time-cell-height * 4; } .@{picker-cell-inner-cls} { // padding: 0 @padding-xs; } .@{picker-prefix-cls}-cell { &-disabled .@{picker-cell-inner-cls} { // background: @picker-basic-cell-disabled-bg; } } .@{picker-prefix-cls}-body { padding: 0 3*@P; } } &-quarter-panel { .@{picker-prefix-cls}-content { height: 56px; tr { td { &:last-child { margin-right: 3*@P; } } } } } &-date-panel { .@{picker-prefix-cls}-content td:hover { // border-radius: @R2; // &:not(.@{picker-prefix-cls}-cell-in-range) { // background-color: transparent; // } } tr { .@{picker-prefix-cls}-cell:first-child { &::before { display: none; } } } .@{picker-prefix-cls}-cell-range-end:not(:first-child)::before { left: -2*@P; } .@{picker-prefix-cls}-content { thead { th { width: 6*@P; line-height: 6*@P; color: @G2; } } tbody { tr { margin-top: 2*@P; } } tr { display: flex; justify-content: space-between; width: 60*@P - 2*3*@P; } } .@{picker-prefix-cls}-cell-in-view { &.@{picker-prefix-cls}-cell-range-hover-end:not(.@{picker-prefix-cls}-cell-range-end), &.@{picker-prefix-cls}-cell-range-hover-start:not(.@{picker-prefix-cls}-cell-range-start) { &:hover { .@{picker-prefix-cls}-cell-inner { background-color: @picker-basic-cell-active-with-range-color; } } } } } // ======================== Footer ======================== &-footer { width: min-content; min-width: 100%; // line-height: @picker-text-height - 2 * @border-width-base; text-align: center; border-top: 1px solid @G8; font-size: @T2; line-height: 24px; cursor: pointer; // border-bottom: @border-width-base @border-style-base transparent; .@{picker-prefix-cls}-panel & { // border-top: @border-width-base @border-style-base @picker-border-color; } &-extra { padding: 0 @padding-sm; // line-height: @picker-text-height - 2 * @border-width-base; text-align: left; &:not(:last-child) { // border-bottom: @border-width-base @border-style-base @picker-border-color; } } } &-now { text-align: left; } &-today-btn { // color: @link-color; &:hover { // color: @link-hover-color; } &:active { // color: @link-active-color; } &&-disabled { // color: @disabled-color; cursor: not-allowed; } } // ======================================================== // = Special = // ======================================================== // ===================== Decade Panel ===================== &-decade-panel { tr { display: block; margin: 3*@P 0; td { display: inline-block; margin-right: 3*@P; width: 79px; &:last-child { margin-right: 0; } } .@{picker-cell-inner-cls} { width: 100%; } } .@{picker-prefix-cls}-cell::before { display: none; } } // ============= Year & Quarter & Month Panel ============= &-year-panel, &-quarter-panel, &-month-panel { width: 192px; // @hover-cell-fixed-distance: ((((@picker-panel-width - @padding-xs * 2) / 3) - @picker-year-month-cell-width) / 2); tr { display: block; margin: 3*@P 0; td { display: inline-block; margin-right: 3*@P; // border-radius: @R2; &:last-child { margin-right: 0; } } } .@{picker-cell-inner-cls} { width: 12*@P; } .@{picker-prefix-cls}-cell-range-hover-start::after { // left: @hover-cell-fixed-distance; // border-left: @border-width-base dashed @picker-date-hover-range-border-color; border-radius: @border-radius-base 0 0 @border-radius-base; .@{picker-prefix-cls}-panel-rtl & { // right: @hover-cell-fixed-distance; // border-right: @border-width-base dashed @picker-date-hover-range-border-color; border-radius: 0 @border-radius-base @border-radius-base 0; } } .@{picker-prefix-cls}-cell-range-hover-end::after { // right: @hover-cell-fixed-distance; // border-right: @border-width-base dashed @picker-date-hover-range-border-color; border-radius: 0 @border-radius-base @border-radius-base 0; .@{picker-prefix-cls}-panel-rtl & { // left: @hover-cell-fixed-distance; // border-left: @border-width-base dashed @picker-date-hover-range-border-color; border-radius: @border-radius-base 0 0 @border-radius-base; } } } &-panels { &:last-child.@{picker-prefix-cls}-month-panel { width: 186px; } .@{picker-prefix-cls}-date-panel { width: 234px; } .@{picker-prefix-cls}-decade-panel { width: 285px; .@{picker-prefix-cls}-header, .@{picker-prefix-cls}-body { padding-right: 12px !important; } } } // ====================== Week Panel ====================== &-week-panel { .@{picker-prefix-cls}-body { padding: @padding-xs @padding-sm; } // Clear cell style .@{picker-prefix-cls}-cell { &:hover .@{picker-cell-inner-cls}, // &-selected .@{picker-cell-inner-cls}, .@{picker-cell-inner-cls} { background: transparent !important; } &-disabled::before { width: 100%; left: 0; } } // acud-picker-cell acud-picker-cell-disabled &-row { td { transition: background @animation-duration-slow; } &:hover td { background: @picker-basic-cell-hover-color; } &-selected td, &-selected:hover td { background-color: @B6!important; color: @G11; &.@{picker-prefix-cls}-cell-week { // color: fade(@text-color-inverse, 50%); } &.@{picker-prefix-cls}-cell-today .@{picker-cell-inner-cls}::before { border-color: @B6; } .@{picker-cell-inner-cls} { // color: @text-color-inverse; } } } } &-date-panel, &-month-panel, &-year-panel { tr { td.@{picker-prefix-cls}-cell-in-view.@{picker-prefix-cls}-cell-in-range, td.@{picker-prefix-cls}-cell-range-hover { &:first-child { border-radius: @R2 0 0 @R2; } &:last-child { border-radius: 0 @R2 @R2 0; } &.@{picker-prefix-cls}-cell-end { border-top-right-radius: @R2; border-bottom-right-radius: @R2; } &.@{picker-prefix-cls}-cell-start { border-top-left-radius: @R2; border-bottom-left-radius: @R2; } } td.@{picker-prefix-cls}-cell-range-hover-end:not(.@{picker-prefix-cls}-cell-range-end):not(.@{picker-prefix-cls}-cell-in-range) { .@{picker-prefix-cls}-cell-inner { border-radius: 0 @R2 @R2 0; } &:first-child, &.@{picker-prefix-cls}-cell-selected { .@{picker-prefix-cls}-cell-inner { border-radius: @R2; } } } td.@{picker-prefix-cls}-cell-range-hover-start:not(.@{picker-prefix-cls}-cell-selected):not(.@{picker-prefix-cls}-cell-range-start):not(.@{picker-prefix-cls}-cell-in-range) { .@{picker-prefix-cls}-cell-inner { border-radius: @R2 0 0 @R2; } &:last-child, &.@{picker-prefix-cls}-cell-selected { .@{picker-prefix-cls}-cell-inner { border-radius: @R2; } } } } } // ====================== Date Panel ====================== &-date-panel { .@{picker-prefix-cls}-body { padding: 3*@P; } .@{picker-prefix-cls}-content { // width: @picker-panel-cell-width * 7; th { // width: @picker-panel-cell-width; } } } // ==================== Datetime Panel ==================== &-datetime-panel { display: flex; .@{picker-prefix-cls}-time-panel { border-left: @border-width-base solid @G8; } .@{picker-prefix-cls}-date-panel, .@{picker-prefix-cls}-time-panel { transition: opacity @animation-duration-slow; } // Keyboard &-active { .@{picker-prefix-cls}-date-panel, .@{picker-prefix-cls}-time-panel { opacity: 0.3; &-active { opacity: 1; } } } } // ====================== Time Panel ====================== &-time-panel { width: auto; min-width: auto; .@{picker-prefix-cls}-content { display: flex; flex: auto; height: @picker-time-panel-column-height; } &-column { flex: 1 0 auto; width: @picker-time-panel-column-width; margin: 0; padding: 0; overflow-y: hidden; text-align: left; list-style: none; transition: background @animation-duration-slow; &::after { display: block; height: @picker-time-panel-column-height - @picker-time-panel-cell-height; content: ''; .@{picker-prefix-cls}-datetime-panel & { height: @picker-time-panel-column-height - @picker-time-panel-cell-height + 2 * @border-width-base; } } &:not(:first-child) { border-left: @border-width-base solid @G8; } // &-active { // background: fade(@calendar-item-active-bg, 20%); // } &:hover { overflow-y: auto; overflow-y: overlay; } > li { margin: 0; padding: 0; &.@{picker-prefix-cls}-time-panel-cell { .@{picker-prefix-cls}-time-panel-cell-inner { display: block; width: 100%; height: @picker-time-panel-cell-height; margin: 0; // padding: 0 0 0 ((@picker-time-panel-column-width - 28px) / 2); color: @text-color; font-size: @T2; line-height: @picker-time-panel-cell-height; text-align: center; border-radius: 0; cursor: pointer; transition: background @animation-duration-slow; &:hover { background: @G10; } } &-selected { .@{picker-prefix-cls}-time-panel-cell-inner { background: @B1; } } &-disabled { .@{picker-prefix-cls}-time-panel-cell-inner { color: @disabled-color; background: transparent; cursor: not-allowed; } } } } } } // &-time-panel { // width: auto; // min-width: auto; // height: 6*@P; // padding: 0 3*@P; // .@{picker-prefix-cls}-content { // display: flex; // flex: auto; // .@{acud-prefix}-input-number-handler-wrap { // display: none; // } // .@{acud-prefix}-input-number-input-wrap { // input { // border: none; // padding: 0; // display: block; // } // } // } // &-column { // flex: 1 0 auto; // // width: @picker-time-panel-column-width; // margin: 0; // padding: 0; // overflow-y: hidden; // text-align: left; // list-style: none; // transition: background @animation-duration-slow; // &::after { // display: block; // // height: @picker-time-panel-column-height - @picker-time-panel-cell-height; // content: ''; // .@{picker-prefix-cls}-datetime-panel & { // // height: @picker-time-panel-column-height - @picker-time-panel-cell-height + 2 * @border-width-base; // } // } // &:not(:first-child) { // // border-left: @border-width-base @border-style-base @picker-border-color; // } // &-active { // // background: fade(@calendar-item-active-bg, 20%); // } // &:hover { // overflow-y: auto; // } // >li { // margin: 0; // padding: 0; // &.@{picker-prefix-cls}-time-panel-cell { // .@{picker-prefix-cls}-time-panel-cell-inner { // display: block; // width: 100%; // // height: @picker-time-panel-cell-height; // margin: 0; // // padding: 0 0 0 ((@picker-time-panel-column-width - 28px) / 2); // // color: @text-color; // // line-height: @picker-time-panel-cell-height; // border-radius: 0; // cursor: pointer; // transition: background @animation-duration-slow; // &:hover { // // background: @item-hover-bg; // } // } // &-selected { // .@{picker-prefix-cls}-time-panel-cell-inner { // // background: @calendar-item-active-bg; // } // } // &-disabled { // .@{picker-prefix-cls}-time-panel-cell-inner { // // color: @disabled-color; // background: transparent; // cursor: not-allowed; // } // } // } // } // } // } } // Fix IE11 render bug by css hacks /* stylelint-disable-next-line */ _:-ms-fullscreen, :root { .@{picker-prefix-cls}-range-wrapper { .@{picker-prefix-cls}-month-panel .@{picker-prefix-cls}-cell, .@{picker-prefix-cls}-year-panel .@{picker-prefix-cls}-cell { padding: 21px 0; } } }