From 0e39e81e5c1f9a4f24c2c46030102e8ed12f2d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Tue, 15 Mar 2022 22:44:07 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A0=94=E5=8F=91=20date-picker=20?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/docs/zh-CN/components/datePicker.md | 6 +- example/src/router/zh-CN.ts | 6 + example/src/view/utils/menus.ts | 6 + src/component/datePicker/index.ts | 8 + src/component/datePicker/index.vue | 419 ++++++++++++++++++++ src/index.ts | 5 +- src/resolver/index.ts | 6 +- src/theme/date.less | 160 ++++++++ src/theme/font/iconfont.eot | Bin 0 -> 2456 bytes src/theme/font/iconfont.svg | 45 +++ src/theme/font/iconfont.ttf | Bin 0 -> 2272 bytes src/theme/font/iconfont.woff | Bin 0 -> 1492 bytes src/theme/index.less | 1 + 13 files changed, 655 insertions(+), 7 deletions(-) create mode 100644 src/component/datePicker/index.ts create mode 100644 src/component/datePicker/index.vue create mode 100644 src/theme/date.less create mode 100644 src/theme/font/iconfont.eot create mode 100644 src/theme/font/iconfont.svg create mode 100644 src/theme/font/iconfont.ttf create mode 100644 src/theme/font/iconfont.woff diff --git a/example/docs/zh-CN/components/datePicker.md b/example/docs/zh-CN/components/datePicker.md index 7e7213a5..a0d750bd 100644 --- a/example/docs/zh-CN/components/datePicker.md +++ b/example/docs/zh-CN/components/datePicker.md @@ -7,8 +7,7 @@ ::: demo diff --git a/src/index.ts b/src/index.ts index 23c4224b..38d7d5de 100644 --- a/src/index.ts +++ b/src/index.ts @@ -77,6 +77,7 @@ import LaySplitPanelItem from "./component/splitPanelItem/index"; import LayException from "./component/exception/index"; import LayResult from "./component/result/index"; import LayFullscreen from "./component/fullscreen/index"; +import LayDatePicker from "./component/datePicker/index"; import LayConfigProvider from "./provider"; import { InstallOptions } from "./types"; @@ -152,6 +153,7 @@ const components: Record = { LayResult, LayFullscreen, LayConfigProvider, + LayDatePicker }; const install = (app: App, options?: InstallOptions): void => { @@ -235,10 +237,11 @@ export { LayResult, LayFullscreen, LayConfigProvider, + LayDatePicker }; export { layer }; export default { install }; -export * from "./resolver"; \ No newline at end of file +export * from "./resolver"; diff --git a/src/resolver/index.ts b/src/resolver/index.ts index e70deae1..4acddd48 100644 --- a/src/resolver/index.ts +++ b/src/resolver/index.ts @@ -1,6 +1,6 @@ /** * Layui-vue Resolver - * + * * √ On-demand import components for @layui/layui-vue * √ component and style resolver for @layui/icons-vue * √ layer API @@ -111,7 +111,6 @@ const matchComponents = [ ]; export interface LayuiVueResolverOptions { - /** * import style along with components * @@ -133,7 +132,6 @@ export interface LayuiVueResolverOptions { * */ exclude?: string[]; - } const libRE = /^Lay[A-Z]/; @@ -189,7 +187,7 @@ function resolveComponent(name: string, options: LayuiVueResolverOptions) { /** * Resolver for layui-vue - * + * * @param options * @returns */ diff --git a/src/theme/date.less b/src/theme/date.less new file mode 100644 index 00000000..2a17681e --- /dev/null +++ b/src/theme/date.less @@ -0,0 +1,160 @@ +/** 图标字体 **/ +@font-face {font-family: 'laydate-icon'; + src: url('./font/iconfont.eot'); + src: url('./font/iconfont.eot#iefix') format('embedded-opentype'), + url('./font/iconfont.svg#iconfont') format('svg'), + url('./font/iconfont.woff') format('woff'), + url('./font/iconfont.ttf') format('truetype'); + } + + .laydate-icon{ + font-family:"laydate-icon" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + + html #layuicss-laydate{display: none; position: absolute; width: 1989px;} + + /* 初始化 */ + .layui-laydate *{margin: 0; padding: 0;} + + /* 主体结构 */ + .layui-laydate, .layui-laydate *{box-sizing: border-box;} + .layui-laydate{position: absolute; z-index: 66666666; margin: 5px 0; border-radius: 2px; font-size: 14px; -webkit-animation-duration: 0.2s; animation-duration: 0.2s; -webkit-animation-fill-mode: both; animation-fill-mode: both;} + .layui-laydate-main{width: 272px;} + .layui-laydate-header *, + .layui-laydate-content td, + .layui-laydate-list li{transition-duration: .3s; -webkit-transition-duration: .3s;} + + /* 微微往下滑入 */ + @keyframes laydate-downbit { + 0% {opacity: 0.3; transform: translate3d(0, -5px, 0);} + 100% {opacity: 1; transform: translate3d(0, 0, 0);} + } + + .layui-laydate{animation-name: laydate-downbit;} + .layui-laydate-static{ position: relative; z-index: 0; display: inline-block; margin: 0; -webkit-animation: none; animation: none;} + + /* 展开年月列表时 */ + .laydate-ym-show .laydate-prev-m, + .laydate-ym-show .laydate-next-m{display: none !important;} + .laydate-ym-show .laydate-prev-y, + .laydate-ym-show .laydate-next-y{display: inline-block !important;} + .laydate-ym-show .laydate-set-ym span[lay-type="month"]{display: none !important;} + + /* 展开时间列表时 */ + .laydate-time-show .layui-laydate-header .layui-icon, + .laydate-time-show .laydate-set-ym span[lay-type="year"], + .laydate-time-show .laydate-set-ym span[lay-type="month"]{display: none !important;} + + /* 头部结构 */ + .layui-laydate-header{position: relative; line-height:30px; padding: 10px 70px 5px;} + .layui-laydate-header *{display: inline-block; vertical-align: bottom;} + .layui-laydate-header i{position: absolute; top: 10px; padding: 0 5px; color: #999; font-size: 18px; cursor: pointer;} + .layui-laydate-header i.laydate-prev-y{left: 15px;} + .layui-laydate-header i.laydate-prev-m{left: 45px;} + .layui-laydate-header i.laydate-next-y{right: 15px;} + .layui-laydate-header i.laydate-next-m{right: 45px;} + .laydate-set-ym{width: 100%; text-align: center; box-sizing: border-box; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;} + .laydate-set-ym span{padding: 0 10px; cursor: pointer;} + .laydate-time-text{cursor: default !important;} + + /* 主体结构 */ + .layui-laydate-content{position: relative; padding: 10px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;} + .layui-laydate-content table{border-collapse: collapse; border-spacing: 0;} + .layui-laydate-content th, + .layui-laydate-content td{width: 36px; height: 30px; padding: 5px; text-align: center;} + .layui-laydate-content th{font-weight: 400;} + .layui-laydate-content td{position: relative; cursor: pointer;} + .laydate-day-mark{position: absolute; left: 0; top: 0; width: 100%; line-height: 30px; font-size: 12px; overflow: hidden;} + .laydate-day-mark::after{position: absolute; content:''; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%;} + + /* 底部结构 */ + .layui-laydate-footer{position: relative; height: 46px; line-height: 26px; padding: 10px;} + .layui-laydate-footer span{display: inline-block; vertical-align: top; height: 26px; line-height: 24px; padding: 0 10px; border: 1px solid #C9C9C9; border-radius: 2px; background-color: #fff; font-size: 12px; cursor: pointer; white-space: nowrap; transition: all .3s;} + .layui-laydate-footer span:hover{color: #5FB878;} + .layui-laydate-footer span.layui-laydate-preview{cursor: default; border-color: transparent !important;} + .layui-laydate-footer span.layui-laydate-preview:hover{color: #666;} + .layui-laydate-footer span:first-child.layui-laydate-preview{padding-left: 0;} + .laydate-footer-btns{position: absolute; right: 10px; top: 10px;} + .laydate-footer-btns span{margin: 0 0 0 -1px;} + + /* 年月列表 */ + .layui-laydate-list{position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding: 10px; box-sizing: border-box; background-color: #fff;} + .layui-laydate-list>li{position: relative; display: inline-block; width: 33.3%; height: 36px; line-height: 36px; margin: 3px 0; vertical-align: middle; text-align: center; cursor: pointer;} + .laydate-month-list>li{width: 25%; margin: 17px 0;} + .laydate-time-list>li{height: 100%; margin: 0; line-height: normal; cursor: default;} + .laydate-time-list p{position: relative; top: -4px; line-height: 29px;} + .laydate-time-list ol{height: 181px; overflow: hidden;} + .laydate-time-list>li:hover ol{overflow-y: auto;} + .laydate-time-list ol li{width: 130%; padding-left: 4px; height: 30px; line-height: 30px; text-align: left; cursor: pointer;} + + /* 提示 */ + .layui-laydate-hint{position: absolute; top: 115px; left: 50%; width: 250px; margin-left: -125px; line-height: 20px; padding: 15px; text-align: center; font-size: 12px; color: #FF5722;} + + + /* 双日历 */ + .layui-laydate-range{width: 546px;} + .layui-laydate-range .layui-laydate-main{display: inline-block; vertical-align: middle;} + .layui-laydate-range .laydate-main-list-1 .layui-laydate-header, + .layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left: 1px solid #e2e2e2;} + + + /* 默认简约主题 */ + .layui-laydate, .layui-laydate-hint{border: 1px solid #d2d2d2; box-shadow: 0 2px 4px rgba(0,0,0,.12); background-color: #fff; color: #666;} + .layui-laydate-header{border-bottom: 1px solid #e2e2e2;} + .layui-laydate-header i:hover, + .layui-laydate-header span:hover{color: #5FB878;} + .layui-laydate-content{border-top: none 0; border-bottom: none 0;} + .layui-laydate-content th{color: #333;} + .layui-laydate-content td{color: #666;} + .layui-laydate-content td.laydate-selected{background-color: #B5FFF8;} + .laydate-selected:hover{background-color: #00F7DE !important;} + .layui-laydate-content td:hover, + .layui-laydate-list li:hover{background-color: #eee; color: #333;} + .laydate-time-list li ol{margin: 0; padding: 0; border: 1px solid #e2e2e2;} + .laydate-time-list li:first-child ol{border-left-width: 1px;} + .laydate-time-list>li:hover{background: none;} + .layui-laydate-content .laydate-day-prev, + .layui-laydate-content .laydate-day-next{color: #d2d2d2;} + .laydate-selected.laydate-day-prev, + .laydate-selected.laydate-day-next{background-color: #f8f8f8 !important;} + .layui-laydate-footer{border-top: 1px solid #e2e2e2;} + .layui-laydate-hint{color: #FF5722;} + .laydate-day-mark::after{background-color: #5FB878;} + .layui-laydate-content td.layui-this .laydate-day-mark::after{display: none;} + .layui-laydate-footer span[lay-type="date"]{color: #5FB878;} + .layui-laydate .layui-this{background-color: #009688 !important; color: #fff !important;} + .layui-laydate .laydate-disabled, + .layui-laydate .laydate-disabled:hover{background:none !important; color: #d2d2d2 !important; cursor: not-allowed !important; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;} + + /* 墨绿/自定义背景色主题 */ + .laydate-theme-molv{border: none;} + .laydate-theme-molv.layui-laydate-range{width: 548px} + .laydate-theme-molv .layui-laydate-main{width: 274px;} + .laydate-theme-molv .layui-laydate-header{border: none; background-color: #009688;} + .laydate-theme-molv .layui-laydate-header i, + .laydate-theme-molv .layui-laydate-header span{color: #f6f6f6;} + .laydate-theme-molv .layui-laydate-header i:hover, + .laydate-theme-molv .layui-laydate-header span:hover{color: #fff;} + .laydate-theme-molv .layui-laydate-content{border: 1px solid #e2e2e2; border-top: none; border-bottom: none;} + .laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left: none;} + .laydate-theme-molv .layui-laydate-footer{border: 1px solid #e2e2e2;} + + /* 格子主题 */ + .laydate-theme-grid .layui-laydate-content td, + .laydate-theme-grid .layui-laydate-content thead, + .laydate-theme-grid .laydate-year-list>li, + .laydate-theme-grid .laydate-month-list>li{border: 1px solid #e2e2e2;} + .laydate-theme-grid .laydate-selected, + .laydate-theme-grid .laydate-selected:hover{background-color: #f2f2f2 !important; color: #009688 !important;} + .laydate-theme-grid .laydate-selected.laydate-day-prev, + .laydate-theme-grid .laydate-selected.laydate-day-next{color: #d2d2d2 !important;} + .laydate-theme-grid .laydate-year-list, + .laydate-theme-grid .laydate-month-list{margin: 1px 0 0 1px;} + .laydate-theme-grid .laydate-year-list>li, + .laydate-theme-grid .laydate-month-list>li{margin: 0 -1px -1px 0;} + .laydate-theme-grid .laydate-year-list>li{height: 43px; line-height: 43px;} + .laydate-theme-grid .laydate-month-list>li{height: 71px; line-height: 71px;} \ No newline at end of file diff --git a/src/theme/font/iconfont.eot b/src/theme/font/iconfont.eot new file mode 100644 index 0000000000000000000000000000000000000000..c861caa8e2c1e5bfff43ca36bf79fe3195545148 GIT binary patch literal 2456 zcmc&$U2GIp6h3EWclM|4ENt8Dw(PdkmhM(tw(YtU3JL_Uh&B;HOP~_7bZ6U={bRd@ zEkWIo_!|<4i3VfP#9-i&L`)1Jkw+dhCIsS(AsAs3vs$|eAFngtr$Wyy=ZNkcq#`CiW=yMTg}p(M>y3Vn%m zT0=85NqNe_K&9ParfANzDS`>mIG7^M!b;d^G(<5Pgy#R|fm%3GM-`H3aL1lkwq7*8 z{2kH7GEPDBGK8+RJ(tFakU{6_h{*~g4v5Pqb-F?@t^s_12Lgng&6~A1e z3JmP%#Zof%S=^U4h$0%1m;IKCGxnG?STVXEcSH%^K^q{u@e>JMuFBPknuxtzm8$zq z1Oa1&h1eI7_%cRe1r`xLrt853cuZ~()tf7i+3SmaFWU_+R#M1XEYI$`nb8%+1%2k z%F*snawCO^Y1T}o3RKAecOC@#gvD!21fo$=vlOp5Z_#3pGY#{*&J)>UnL{5>JR ze44$%X!~2n^U~+s+|eEKZCYdO?BCoJ*BaeN>;3*#zyG9LaXQ_Sib#Q%av~6r(gSN__d^eE`_q2GJD-~{BrK#sPuWVb1|M9j!qrcU)qQM<( zYv^9x#7FPc1sm(bk)IK&$jaKE(p|a1%&c`DjxvWv_>^&Ygm+2THyX3X>_#@f1xxIr z9$v@Noe|?OpBgbPF0sQd*RIJ|@wWS@gEXQ>9*zf^TpkWIDP03R^q|a}`MfV0R*kcq z^0h~Ny)s{b?1QYU;i%ecyulT|00_$XM40ySiH8Ugi&*=H{FU5CE2xvYh&-%xMG^=q zk{FJ6@DO+2PjvH;e91_uk+919jW5(tM2+%M<8345i-c6(2P!NmF7ul(3q^dqk0*pK zYP|Ol0T29i%Y4s;H_d3)>%z#^W*bZ7f^QZtgYUJm12|!0Co0Ak8!O;nu(6l=Xs?ay zkeeqEF*{Hh=}G#~#*BjWjg2J~vL9?LgTHHI2k<{Oc2WQ}!J0>*AotnWOXIxF#&s0o zkGr-=?WN|6A6p!o0*_nJ!8;T7srFZB# zy|^&%?2)N>sg%~z#e7y9#R7UJlh+Ex{2_g^6q_!U3L6Fn#KMA)P3E)sG;Tvx*6kXe zLc$$HP1pXb(r!3H@9f6JrGQb)YOx+>OGYRV$O`D?%C@2H?EkwLvA2UxiS&@ + + + + +Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/theme/font/iconfont.ttf b/src/theme/font/iconfont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0bd6c4a88dd899aea3926e49bdfb37e81004bcb9 GIT binary patch literal 2272 zcmc&#TWl0n82KNt^83(# zg?zD)t!0$i8_?xTMAC*uJ(*TNe&s#beh-;i1mU_VzX^O9vU)LBsrLK~M0_1xFk46^ zr3uc!{~UBRm#h}Kn+{?=2wlr3bNaq(&fP>#o6Yvf-j z&hVAUDTBRF+nsqbOr{uCUA;&pW1q#?Do{l=BIcMi#aY`Y16FvCVMLYS z9kda;8<(iP+K?ObO;LNbAvF$|2nu|Jh1eH{oeVEzU{T>iYW5a9r0gwe+fBU7X2iZ% zZNU;7*i#{5ZyR_XLd0`v9I!+@w#K|A_6a;nZ_`Kg9fx3vXw4tw%W{x9X@n+eJK-H+ zWt4|hDa?b>L`)jx?m=gFPnRl3hogh8;h~uP1osRnU4i&iBGRL{6d$YH&yNkpr=l?_ z%IgxFrA-_UgqeF+_3ibq3HjwS>+8Ne@Q5_P?Y+^yUHdz*hM|Oo~2vU#t}X}ZCq@z!!9?k%2)8V`)GhPqE4QQ2fADy z4s{*&X^?9Lu}5E6&L&H( zR4bm-OXa0PUYm?fw9-5Dyk5E!w|sOVUa4fXOsSC5W|2V8W(!)eR5+}sDzU{%rMPi? zTqG8JELF(i)3}XFq*IbA=+iiGhp2{riBeRcJY~$j0=q11YOt^@*Zya*2Yw5*Y|fV+ zX!RiPIe3?-jA$a8hL1&zCLS1N2dwj^$KC5K(^0G6DLx95k(XKllwJ=C6?L2PFC1OTvcj?W!%ck U%LUx7>Qb_{RMXw|I4MH>3rdt+EdT%j literal 0 HcmV?d00001 diff --git a/src/theme/font/iconfont.woff b/src/theme/font/iconfont.woff new file mode 100644 index 0000000000000000000000000000000000000000..bfe5599671f9441ceebdc8afeac71d4f65a741c7 GIT binary patch literal 1492 zcmY+Ec~Fx_7{)gwfRsQv0;F70?g7dvDTi_k2q?&X&U_&x2IUmw6v>BjMv!1R4M!=} zat=&T#2N_qQ9*2LQO=SDwfF%7h8S8TISJOqsY87jqJohD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_&HiQKEtgx3 z>LtfIQt8)xnzrY;Yf+EB*DOR&shTfhb@0-ik46GN42H;azKOR$cS5Xl&6XwPzf#7( zRFpCaYtr3ymQWjRB`O~G2;TY7X;p5q+7h_!%j12);&&J2W5A7dm CyJwOB literal 0 HcmV?d00001 diff --git a/src/theme/index.less b/src/theme/index.less index 2c3cc873..f36b3c9e 100644 --- a/src/theme/index.less +++ b/src/theme/index.less @@ -1,4 +1,5 @@ @import "./variable.less"; +@import "./date.less"; .layui-inline, img {