UNPKG

drip-table

Version:

A tiny and powerful enterprise-class solution for building tables.

584 lines (489 loc) 11.1 kB
@import url("../../../styles/theme/default.less"); @prefix-cls: jfe-drip-table-rc-date-picker; @background-color: #fff; @input-placeholder-color: hsv(0, 0, 75%); .placeholder(@color: @input-placeholder-color) { // Firefox &::placeholder { opacity: 1; // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526 color: @color; } &:placeholder-shown { text-overflow: ellipsis; } } .@{prefix-cls} { box-sizing: border-box; margin: 0; color: @drip-table-text-color; font-size: 14px; font-variant: tabular-nums; line-height: 1.5715; list-style: none; font-feature-settings: "tnum"; padding: 4px 11px; position: relative; display: inline-flex; align-items: center; background: #ffffff; border: 1px solid #d9d9d9; border-radius: 2px; transition: border .3s, box-shadow .3s; &-focused { border-color: @drip-table-primary-active-color; box-shadow: 0 0 0 2px @drip-table-primary-shadow-color; border-right-width: 1px; outline: 0; } &-rtl { direction: rtl; } &-panel { display: inline-flex; flex-direction: column; text-align: center; background: #ffffff; border: 1px solid #0000000f; border-radius: 2px; outline: none; &-focused { border-color: blue; } &-rtl { direction: rtl; } } // ===================== Shared Panel ===================== &-decade-panel, &-year-panel, &-month-panel, &-week-panel, &-date-panel, &-time-panel { display: flex; flex-direction: column; table { text-align: center; border-collapse: collapse; } } // Header &-header { display: flex; padding: 0 8px; border-bottom: 1px solid #0000000f; >button { min-width: 1.6em; font-size: 14px; } button { padding: 0; color: #00000040; line-height: 40px; background: 0 0; border: 0; cursor: pointer; transition: color .3s; } > * { flex: none; } &-view { flex: auto; font-weight: 500; line-height: 40px; > button { padding: 0; border: 0; color: @drip-table-text-color; } } } &-body { padding: 8px 12px; } &-panel-container &-panel &-content, &-panel-container &-panel table { text-align: center; } &-content, &-date-panel { width: 252px; } &-content { width: 100%; table-layout: fixed; border-collapse: collapse; } &-content th, &-content td { position: relative; min-width: 24px; font-weight: 400; } // Content &-cell { padding: 3px 0; color: #00000040; cursor: pointer; &-disabled { opacity: .2; } &-inner { position: relative; z-index: 2; display: inline-block; min-width: 24px; height: 24px; line-height: 24px; border-radius: 2px; transition: background .3s, border .3s; } &-in-view { color: @drip-table-text-color; } &-in-range > &-inner { background: #3700ff0d; } &-range-hover-start, &-range-hover-end, &-range-hover { position: relative; &::after { position: absolute; top: 3px; right: 0; bottom: 0; left: 0; border: 1px dashed @drip-table-primary-color; border-right: 0; border-left: 0; content: ""; pointer-events: none; } } &-range-hover-start::after { border-left: 1px dashed @drip-table-primary-color !important; } &-range-hover-end::after { border-right: 1px dashed @drip-table-primary-color !important; } &-today > &-inner { border: 1px solid blue; } &-range-start > &-inner, &-range-end > &-inner, &-selected > &-inner { background: @drip-table-primary-color; color: #ffffff; } } &-cell::before { position: absolute; top: 50%; right: 0; left: 0; z-index: 1; height: 24px; transform: translateY(-50%); transition: all .3s; content: ""; } &-footer, &-picker-footer { background: @background-color; } &-ranges { margin: 0; padding: 0; overflow: hidden; list-style: none; > li { display: inline-block; } } &-ok { float: right; } // ================== Year & Month Panel ================== &-year-panel, &-month-panel { .@{prefix-cls}-cell-inner { width: 80px; } } // ====================== Week Panel ====================== &-week-panel { &-row { &:hover { .@{prefix-cls}-cell { background: red; } } &-selected { .@{prefix-cls}-cell { background: #0000ff4d; } } } .@{prefix-cls}-cell, .@{prefix-cls}-cell-inner { width: 20px; } .@{prefix-cls}-cell-week { color: #999999; font-weight: bold; font-size: 12px; } .@{prefix-cls}-cell:hover > .@{prefix-cls}-cell-inner, .@{prefix-cls}-cell-selected > .@{prefix-cls}-cell-inner { background: transparent; } } // ====================== Date Panel ====================== &-date-panel { .@{prefix-cls}-cell-inner { width: 20px; } } // ====================== Time Panel ====================== &-time-panel { width: auto; .@{prefix-cls}-content { display: flex; max-height: 200px; } &-column { flex: none; width: 50px; margin: 0; padding: 0 0 180px; overflow-x: hidden; overflow-y: hidden; font-size: 12px; text-align: left; list-style: none; transition: background .3s; &-active { background: #0000ff1a; } &:hover { overflow-y: auto; } > li { margin: 0; padding: 0; cursor: pointer; &.@{prefix-cls}-time-panel-cell { &-disabled { opacity: .5; } } .@{prefix-cls}-time-panel-cell-inner { display: block; width: 100%; height: 20px; margin: 0; padding: 0 0 0 12px; color: #333333; line-height: 20px; text-align: left; .@{prefix-cls}-panel-rtl & { padding: 0 12px 0 0; text-align: right; } } } } } // ====================== Date Time ======================= &-datetime-panel { display: flex; .@{prefix-cls}-time-panel { border-left: 1px solid #999999; } .@{prefix-cls}-date-panel, .@{prefix-cls}-time-panel { transition: opacity .3s; } // Keyboard &-active { .@{prefix-cls}-date-panel, .@{prefix-cls}-time-panel { opacity: .3; &-active { opacity: 1; } } } } // ======================== Input ========================= &-input { position: relative; display: inline-flex; align-items: center; width: 100%; .@{prefix-cls}-rtl & { text-align: right; } button, input { overflow: hidden; } > input { position: relative; display: inline-block; width: 100%; color: @drip-table-text-color; font-size: 14px; line-height: 1.5715; border-radius: 2px; transition: all .3s; flex: auto; min-width: 1px; height: auto; padding: 0; background: 0 0; border: 0; outline: none; } > input:placeholder-shown { text-overflow: ellipsis; } } &-clear { position: absolute; top: 0; right: 4px; cursor: pointer; .@{prefix-cls}-rtl & { right: auto; left: 4px; } &-btn::after { content: "×"; font-size: 18px; } } // ======================= Dropdown ======================= &-dropdown { position: absolute; z-index: 999999; &-range { padding: 10px 0; } &-hidden { display: none; } // Panel @arrow-size: 10px; &-placement-topLeft, &-placement-topRight { .@{prefix-cls}-range-arrow { bottom: @arrow-size / 2 + 1px; transform: rotate(135deg); } } &-placement-bottomLeft, &-placement-bottomright { .@{prefix-cls}-range-arrow { top: @arrow-size / 2 + 1px; transform: rotate(-45deg); } } .@{prefix-cls}-range-arrow { position: absolute; left: @arrow-size; z-index: 1; width: @arrow-size; height: @arrow-size; margin-left: 10px; transition: all .3s; .@{prefix-cls}-dropdown-rtl& { right: @arrow-size; left: auto; margin-right: 10px; margin-left: 0; } &::before, &::after { position: absolute; top: 50%; left: 50%; box-sizing: border-box; transform: translate(-50%, -50%); content: ""; .@{prefix-cls}-dropdown-rtl& { right: 50%; left: auto; transform: translate(50%, -50%); } } &::before { width: @arrow-size; height: @arrow-size; border: @arrow-size / 2 solid blue; border-color: blue blue transparent transparent; } &::after { width: @arrow-size - 2px; height: @arrow-size - 2px; border: (@arrow-size - 2px) / 2 solid blue; border-color: @background-color @background-color transparent transparent; } } } // ======================================================== // = Range Picker = // ======================================================== &-cell-range-start &-cell-inner { background: @drip-table-primary-color; } &-cell-range-end &-cell-inner { background: @drip-table-primary-color; } &-cell-range-start::before { background: #e6f7ff !important; } &-cell-range-end::before { background: #e6f7ff !important; } &-cell-in-range::before { background: #e6f7ff !important; } &-cell-in-range &-cell-inner { background: transparent !important; } &-range { position: relative; display: inline-flex; &-wrapper { display: flex; } .@{prefix-cls}-active-bar { bottom: 0; height: 2px; background: @drip-table-primary-color; opacity: 0; transition: all .3s; pointer-events: none; } &.@{prefix-cls}-focused { border-color: @drip-table-primary-active-color; box-shadow: 0 0 0 2px @drip-table-primary-shadow-color; border-right-width: 1px; outline: 0; .@{prefix-cls}-active-bar { opacity: 1; } } } &-panel-container { overflow: hidden; vertical-align: top; background: #ffffff; border-radius: 2px; box-shadow: 0 3px 6px -4px #0000001f, 0 6px 16px #00000014, 0 9px 28px 8px #0000000d; transition: margin .3s; } }