@tarojs/components-react 4.1.5 → 4.1.6-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/image/index.js +60 -2
- package/dist/components/image/index.js.map +1 -1
- package/dist/components/picker/index.js +60 -21
- package/dist/components/picker/index.js.map +1 -1
- package/dist/components/picker/picker-group.js +22 -8
- package/dist/components/picker/picker-group.js.map +1 -1
- package/dist/components/picker/react-style/style.css +1 -1
- package/dist/components/picker/react-style/style.css.map +1 -1
- package/dist/components/refresher/index.js +7 -0
- package/dist/components/refresher/index.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/solid/components/image/index.js +95 -28
- package/dist/solid/components/image/index.js.map +1 -1
- package/dist/solid/components/picker/index.js +65 -29
- package/dist/solid/components/picker/index.js.map +1 -1
- package/dist/solid/components/picker/picker-group.js +34 -12
- package/dist/solid/components/picker/picker-group.js.map +1 -1
- package/dist/solid/components/refresher/index.js +7 -0
- package/dist/solid/components/refresher/index.js.map +1 -0
- package/dist/solid/index.css +1 -1
- package/dist/solid/index.js +1 -0
- package/dist/solid/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.taro-picker__overlay{position:fixed;z-index:1000}.taro-picker__mask-overlay,.taro-picker__overlay{bottom:0;height:100%;left:0;right:0;top:0;width:100%}.taro-picker__mask-overlay{background-color:rgba(0,0,0,.6);position:absolute;z-index:1001}.taro-picker{background-color:#e5e5e5;bottom:0;font-size:14px;left:0;position:absolute;width:100%;z-index:1002}.taro-picker__hd{align-items:center;background-color:#fff;display:flex;font-size:17px;height:44px;justify-content:space-between;padding:0;position:relative}.taro-picker__hd:after{background-color:#e5e5e5;bottom:0;content:"";height:1px;left:0;position:absolute;transform:scaleY(.5);width:100%}.taro-picker__action{color:#
|
|
1
|
+
.taro-picker__overlay{position:fixed;z-index:1000}.taro-picker__mask-overlay,.taro-picker__overlay{bottom:0;height:100%;left:0;right:0;top:0;width:100%}.taro-picker__mask-overlay{background-color:rgba(0,0,0,.6);position:absolute;z-index:1001}.taro-picker{background-color:#e5e5e5;bottom:0;font-size:14px;left:0;position:absolute;width:100%;z-index:1002}.taro-picker__hd{align-items:center;background-color:#fff;display:flex;font-size:17px;height:44px;justify-content:space-between;padding:0;position:relative}.taro-picker__hd:after{background-color:#e5e5e5;bottom:0;content:"";height:1px;left:0;position:absolute;transform:scaleY(.5);width:100%}.taro-picker__action{color:#ff0f23;flex:0 0 auto;font-size:14px;height:44px;line-height:44px;padding:0 10px}.taro-picker__action:first-child{color:#888}.taro-picker__title{color:#000;font-size:16px;font-weight:500;left:50%;max-width:40%;overflow:hidden;position:absolute;text-overflow:ellipsis;top:50%;transform:translate(-50%,-50%);white-space:nowrap}.taro-picker__bd{background-color:#fff;height:238px;overflow:hidden;width:100%}.taro-picker__bd,.taro-picker__group{box-sizing:border-box;display:flex;flex:1}.taro-picker__group{align-items:center;height:100%;justify-content:center;min-width:0;position:relative}.taro-picker__group--date .taro-picker__columns{display:flex;height:100%;width:100%}.taro-picker__mask{background:linear-gradient(180deg,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6) 40%,hsla(0,0%,100%,0) 45%,hsla(0,0%,100%,0) 55%,hsla(0,0%,100%,.6) 60%,hsla(0,0%,100%,.95));height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:1}.taro-picker__indicator{box-sizing:border-box;height:34px;left:0;position:absolute;top:50%;transform:translateY(-50%);width:100%;z-index:1002}.taro-picker__indicator:after,.taro-picker__indicator:before{background-color:#e5e5e5;content:"";height:1px;left:0;position:absolute;right:0;transform:scaleY(.5)}.taro-picker__indicator:before{top:0}.taro-picker__indicator:after{bottom:0}.taro-picker__content{box-sizing:border-box;height:100%;width:100%}.taro-picker__item{align-items:center;box-sizing:border-box;color:#000;display:flex;font-size:16px;height:34px;justify-content:center;line-height:34px;overflow:hidden;padding:0 8px;text-align:center;text-overflow:ellipsis;white-space:nowrap;width:100%}.taro-picker__item--selected{color:#ff0f23;font-weight:500}.taro-picker__item--disabled{color:#999}.taro-picker__column{flex:1;margin:0 8px}.taro-picker__column:first-child{margin-left:0}.taro-picker__column:last-child{margin-right:0}.taro-picker__item--custom{align-items:center;color:#888;display:flex;font-weight:400;justify-content:center;text-align:center}@keyframes taro-picker__slide-up{0%{transform:translate3d(0,100%,0)}to{transform:translateZ(0)}}@keyframes taro-picker__slide-down{0%{transform:translateZ(0)}to{transform:translate3d(0,100%,0)}}@keyframes taro-picker__fade-in{0%{opacity:0}to{opacity:1}}@keyframes taro-picker__fade-out{0%{opacity:1}to{opacity:0}}
|
|
2
2
|
/*# sourceMappingURL=style.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.scss"],"names":[],"mappings":"AACA,sBACE,cAAe,CAOf,YACF,CAEA,iDAPE,QAAS,CAGT,WAAY,CAFZ,MAAO,CAFP,OAAQ,CADR,KAAM,CAIN,UAeF,CAVA,2BASE,+BAAoC,CARpC,iBAAkB,CAOlB,YAEF,CAEA,aAKE,wBAAyB,CAHzB,QAAS,CAKT,cAAe,CAJf,MAAO,CAFP,iBAAkB,CAKlB,UAAW,CAFX,YAIF,CAEA,iBAEE,kBAAmB,CAInB,qBAAsB,CALtB,YAAa,CAMb,cAAe,CAHf,WAAY,CADZ,6BAA8B,CAE9B,SAAU,CAGV,iBACF,CACA,uBAOE,wBAAyB,CAHzB,QAAS,CAHT,UAAW,CAKX,UAAW,CAHX,MAAO,CADP,iBAAkB,CAMlB,oBAAsB,CAHtB,UAIF,CAEA,qBAKE,aAAc,CAJd,aAAc,CAKd,cAAe,CAHf,WAAY,CACZ,gBAAiB,CAFjB,cAKF,CACA,iCACE,UACF,CAEA,oBAWE,UAAW,CADX,cAAe,CADf,eAAgB,CAPhB,QAAS,CAGT,aAAc,CACd,eAAgB,CALhB,iBAAkB,CAOlB,sBAAuB,CALvB,OAAQ,CACR,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taro-picker__overlay {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 1000;\n}\n\n.taro-picker__mask-overlay {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 1001;\n background-color: rgba(0, 0, 0, 0.6);\n}\n\n.taro-picker {\n position: absolute;\n bottom: 0;\n left: 0;\n z-index: 1002;\n background-color: #e5e5e5;\n width: 100%;\n font-size: 14px;\n}\n\n.taro-picker__hd {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 44px;\n padding: 0;\n background-color: #fff;\n font-size: 17px;\n position: relative;\n}\n.taro-picker__hd::after {\n content: \"\";\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 1px;\n background-color: #e5e5e5;\n transform: scaleY(0.5);\n}\n\n.taro-picker__action {\n flex: 0 0 auto; /* 不伸缩,保持内容宽度 */\n padding: 0 10px;\n height: 44px;\n line-height: 44px;\n color: #
|
|
1
|
+
{"version":3,"sources":["index.scss"],"names":[],"mappings":"AACA,sBACE,cAAe,CAOf,YACF,CAEA,iDAPE,QAAS,CAGT,WAAY,CAFZ,MAAO,CAFP,OAAQ,CADR,KAAM,CAIN,UAeF,CAVA,2BASE,+BAAoC,CARpC,iBAAkB,CAOlB,YAEF,CAEA,aAKE,wBAAyB,CAHzB,QAAS,CAKT,cAAe,CAJf,MAAO,CAFP,iBAAkB,CAKlB,UAAW,CAFX,YAIF,CAEA,iBAEE,kBAAmB,CAInB,qBAAsB,CALtB,YAAa,CAMb,cAAe,CAHf,WAAY,CADZ,6BAA8B,CAE9B,SAAU,CAGV,iBACF,CACA,uBAOE,wBAAyB,CAHzB,QAAS,CAHT,UAAW,CAKX,UAAW,CAHX,MAAO,CADP,iBAAkB,CAMlB,oBAAsB,CAHtB,UAIF,CAEA,qBAKE,aAAc,CAJd,aAAc,CAKd,cAAe,CAHf,WAAY,CACZ,gBAAiB,CAFjB,cA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GACE,uBACF,CACA,GACE,+BACF,CACF,CACA,gCACE,GACE,SACF,CACA,GACE,SACF,CACF,CACA,iCACE,GACE,SACF,CACA,GACE,SACF,CACF","file":"style.css","sourcesContent":["@charset \"UTF-8\";\n.taro-picker__overlay {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 1000;\n}\n\n.taro-picker__mask-overlay {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 1001;\n background-color: rgba(0, 0, 0, 0.6);\n}\n\n.taro-picker {\n position: absolute;\n bottom: 0;\n left: 0;\n z-index: 1002;\n background-color: #e5e5e5;\n width: 100%;\n font-size: 14px;\n}\n\n.taro-picker__hd {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 44px;\n padding: 0;\n background-color: #fff;\n font-size: 17px;\n position: relative;\n}\n.taro-picker__hd::after {\n content: \"\";\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 1px;\n background-color: #e5e5e5;\n transform: scaleY(0.5);\n}\n\n.taro-picker__action {\n flex: 0 0 auto; /* 不伸缩,保持内容宽度 */\n padding: 0 10px;\n height: 44px;\n line-height: 44px;\n color: #FF0F23;\n font-size: 14px;\n}\n.taro-picker__action:first-child {\n color: #888;\n}\n\n.taro-picker__title {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n max-width: 40%; /* 限制最大宽度,防止挤压按钮 */\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n font-weight: 500;\n font-size: 16px;\n color: #000;\n}\n\n.taro-picker__bd {\n display: flex;\n flex: 1;\n width: 100%;\n height: 238px;\n box-sizing: border-box;\n overflow: hidden;\n background-color: #fff;\n}\n\n.taro-picker__group {\n display: flex;\n position: relative;\n height: 100%;\n box-sizing: border-box;\n justify-content: center; /* 水平居中 */\n align-items: center;\n flex: 1; /* 确保在多列情况下平均分配空间 */\n min-width: 0;\n}\n.taro-picker__group--date .taro-picker__columns {\n display: flex;\n width: 100%;\n height: 100%;\n}\n\n.taro-picker__mask {\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.6) 40%, rgba(255, 255, 255, 0) 45%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.6) 60%, rgba(255, 255, 255, 0.95) 100%);\n pointer-events: none;\n}\n\n.taro-picker__indicator {\n position: absolute;\n left: 0;\n top: 50%;\n z-index: 1002;\n width: 100%;\n height: 34px;\n box-sizing: border-box;\n transform: translateY(-50%);\n}\n.taro-picker__indicator::before, .taro-picker__indicator::after {\n content: \"\";\n position: absolute;\n left: 0;\n right: 0;\n height: 1px;\n background-color: #e5e5e5;\n transform: scaleY(0.5);\n}\n.taro-picker__indicator::before {\n top: 0;\n}\n.taro-picker__indicator::after {\n bottom: 0;\n}\n\n.taro-picker__content {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n}\n\n.taro-picker__item {\n width: 100%;\n height: 34px;\n padding: 0 8px; /* 增加内边距使文本不贴边 */\n box-sizing: border-box;\n overflow: hidden; /* 隐藏溢出内容 */\n line-height: 34px;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n font-size: 16px; /* 稍微减小字体大小 */\n color: #000;\n}\n.taro-picker__item--selected {\n font-weight: 500; /* 使用适中的字体粗细 */\n color: #FF0F23;\n}\n.taro-picker__item--disabled {\n color: #999;\n}\n\n.taro-picker__column {\n flex: 1;\n margin: 0 8px;\n}\n.taro-picker__column:first-child {\n margin-left: 0;\n}\n.taro-picker__column:last-child {\n margin-right: 0;\n}\n\n.taro-picker__item--custom {\n text-align: center; /* 确保自定义项也居中 */\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: normal;\n color: #888;\n}\n\n@keyframes taro-picker__slide-up {\n from {\n transform: translate3d(0, 100%, 0);\n }\n to {\n transform: translate3d(0, 0, 0);\n }\n}\n@keyframes taro-picker__slide-down {\n from {\n transform: translate3d(0, 0, 0);\n }\n to {\n transform: translate3d(0, 100%, 0);\n }\n}\n@keyframes taro-picker__fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes taro-picker__fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/refresher/index.ts"],"sourcesContent":["import { View } from '@tarojs/components'\n\n// TODO: Refresher 组件未实现,暂时使用 View 组件\nconst Refresher = View\n\nexport default Refresher\n"],"names":["Refresher","View"],"mappings":";;AAEA;AACMA,MAAAA,SAAS,GAAGC;;;;"}
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@-webkit-keyframes weuiLoading{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes weuiLoading{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.taro-button-core[loading]>.weui-loading{animation:weuiLoading 1s steps(12) infinite;background:transparent url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E9E9E9' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23989697' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%239B999A' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23A3A1A2' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23ABA9AA' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23B2B2B2' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23BAB8B9' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23C2C0C1' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23CBCBCB' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23D2D2D2' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23DADADA' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E2E2E2' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E") no-repeat;background-size:100%;display:inline-block;height:20px;vertical-align:middle;width:20px}.taro-button-core[loading]>.weui-loading.weui-btn_primary,.taro-button-core[loading]>.weui-loading.weui-btn_warn{color:hsla(0,0%,100%,.6)}.taro-button-core[loading]>.weui-loading.weui-btn_primary{background-color:#179b16}.taro-button-core[loading]>.weui-loading.weui-btn_warn{background-color:#ce3c39}.taro-button-core{-webkit-tap-highlight-color:rgba(0,0,0,0);appearance:none;background-color:#f8f8f8;border-radius:5px;border-width:0;box-sizing:border-box;color:#000;display:block;font-size:18px;line-height:2.55555556;margin-left:auto;margin-right:auto;outline:0;overflow:hidden;padding-left:14px;padding-right:14px;position:relative;text-align:center;text-decoration:none;width:100%}.taro-button-core:focus{outline:0}.taro-button-core:not([disabled]):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core:after{border:1px solid rgba(0,0,0,.2);border-radius:10px;box-sizing:border-box;content:" ";height:200%;left:0;position:absolute;top:0;transform:scale(.5);transform-origin:0 0;width:200%}.taro-button-core+.taro-button-core{margin-top:15px}.taro-button-core[type=default]{background-color:#f8f8f8;color:#000}.taro-button-core[type=default]:not([disabled]):visited{color:#000}.taro-button-core[type=default]:not([disabled]):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core[size=mini]{display:inline-block;font-size:13px;line-height:2.3;padding:0 1.32em;width:auto}.taro-button-core[plain=true],.taro-button-core[plain=true][type=default],.taro-button-core[plain=true][type=primary]{background-color:transparent;border-width:1px}.taro-button-core[disabled]{color:hsla(0,0%,100%,.6)}.taro-button-core[disabled][type=default]{background-color:#f7f7f7;color:rgba(0,0,0,.3)}.taro-button-core[disabled][type=primary]{background-color:#9ed99d}.taro-button-core[disabled][type=warn]{background-color:#ec8b89}.taro-button-core[loading] .weui-loading{margin:-.2em .34em 0 0}.taro-button-core[loading][type=primary],.taro-button-core[loading][type=warn]{color:hsla(0,0%,100%,.6)}.taro-button-core[loading][type=primary]{background-color:#179b16}.taro-button-core[loading][type=warn]{background-color:#ce3c39}.taro-button-core[plain=true][type=primary]{border:1px solid #1aad19;color:#1aad19}.taro-button-core[plain=true][type=primary]:not([disabled]):active{background-color:transparent;border-color:rgba(26,173,25,.6);color:rgba(26,173,25,.6)}.taro-button-core[plain=true][type=primary]:after{border-width:0}.taro-button-core[plain=true][type=warn]{border:1px solid #e64340;color:#e64340}.taro-button-core[plain=true][type=warn]:not([disabled]):active{background-color:transparent;border-color:rgba(230,67,64,.6);color:rgba(230,67,64,.6)}.taro-button-core[plain=true][type=warn]:after{border-width:0}.taro-button-core[plain=true],.taro-button-core[plain=true][type=default]{border:1px solid #353535;color:#353535}.taro-button-core[plain=true]:not([disabled]):active,.taro-button-core[plain=true][type=default]:not([disabled]):active{background-color:transparent;border-color:rgba(53,53,53,.6);color:rgba(53,53,53,.6)}.taro-button-core[plain=true]:after,.taro-button-core[plain=true][type=default]:after{border-width:0}.taro-button-core[type=primary]{background-color:#1aad19;color:#fff}.taro-button-core[type=primary]:not([disabled]):visited{color:#fff}.taro-button-core[type=primary]:not([disabled]):active{background-color:#179b16;color:hsla(0,0%,100%,.6)}.taro-button-core[type=warn]{background-color:#e64340;color:#fff}.taro-button-core[type=warn]:not([disabled]):visited{color:#fff}.taro-button-core[type=warn]:not([disabled]):active{background-color:#ce3c39;color:hsla(0,0%,100%,.6)}.taro-button-core[plain=true][disabled],.taro-button-core[plain=true][disabled][type=primary]{background-color:#f7f7f7;border:1px solid rgba(0,0,0,.2);color:rgba(0,0,0,.3)}.weui-icon-circle:before{content:"\ea01"}.weui-icon-download:before{content:"\ea02"}.weui-icon-info:before{content:"\ea03"}.weui-icon-safe-success:before{content:"\ea04"}.weui-icon-safe-warn:before{content:"\ea05"}.weui-icon-success:before{content:"\ea06"}.weui-icon-success-circle:before{content:"\ea07"}.weui-icon-success-no-circle:before{content:"\ea08"}.weui-icon-waiting:before{content:"\ea09"}.weui-icon-waiting-circle:before{content:"\ea0a"}.weui-icon-warn:before{content:"\ea0b"}.weui-icon-info-circle:before{content:"\ea0c"}.weui-icon-cancel:before{content:"\ea0d"}.weui-icon-search:before{content:"\ea0e"}.weui-icon-clear:before{content:"\ea0f"}.weui-icon-back:before{content:"\ea10"}.weui-icon-delete:before{content:"\ea11"}.weui-icon-success{color:#09bb07;font-size:23px}.weui-icon-waiting{color:#10aeff;font-size:23px}.weui-icon-warn{color:#f43530;font-size:23px}.weui-icon-info{color:#10aeff;font-size:23px}.weui-icon-success-circle,.weui-icon-success-no-circle{color:#09bb07;font-size:23px}.weui-icon-waiting-circle{color:#10aeff;font-size:23px}.weui-icon-circle{color:#c9c9c9;font-size:23px}.weui-icon-download,.weui-icon-info-circle{color:#09bb07;font-size:23px}.weui-icon-safe-success{color:#09bb07}.weui-icon-safe-warn{color:#ffbe00}.weui-icon-cancel{color:#f43530;font-size:22px}.weui-icon-clear,.weui-icon-search{color:#b2b2b2;font-size:14px}.weui-icon-delete.weui-icon_gallery-delete{color:#fff;font-size:22px}.weui-icon_msg{font-size:93px}.weui-icon_msg.weui-icon-warn{color:#f76260}.weui-icon_msg-primary{font-size:93px}.weui-icon_msg-primary.weui-icon-warn{color:#ffbe00}img[src=""]{opacity:0}.taro-img{display:inline-block;font-size:0;height:240px;overflow:hidden;position:relative;width:320px}.taro-img.taro-img__widthfix,.taro-img__mode-heightfix{height:100%}.taro-img__mode-scaletofill{height:100%;width:100%}.taro-img__mode-aspectfit{height:100%;object-fit:contain;width:100%}.taro-img__mode-aspectfill{height:100%;object-fit:cover;width:100%}.taro-img__mode-widthfix{width:100%}.taro-img__mode-bottom,.taro-img__mode-top{left:50%;position:absolute;transform:translate(-50%)}.taro-img__mode-bottom{bottom:0}.taro-img__mode-center{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.taro-img__mode-left,.taro-img__mode-right{position:absolute;top:50%;transform:translateY(-50%)}.taro-img__mode-right{right:0}.taro-img__mode-topright{position:absolute;right:0}.taro-img__mode-bottomleft{bottom:0;position:absolute}.taro-img__mode-bottomright{bottom:0;position:absolute;right:0}.taro-input-core{display:block}.weui-input{-webkit-appearance:none;background-color:transparent;border:0;color:inherit;font-size:inherit;height:1.4705882353em;line-height:1.4705882353;outline:0;width:100%}.weui-input::-webkit-inner-spin-button,.weui-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.taro-picker__overlay{position:fixed;z-index:1000}.taro-picker__mask-overlay,.taro-picker__overlay{bottom:0;height:100%;left:0;right:0;top:0;width:100%}.taro-picker__mask-overlay{background-color:rgba(0,0,0,.6);position:absolute;z-index:1001}.taro-picker{background-color:#e5e5e5;bottom:0;font-size:14px;left:0;position:absolute;width:100%;z-index:1002}.taro-picker__hd{align-items:center;background-color:#fff;display:flex;font-size:17px;height:44px;justify-content:space-between;padding:0;position:relative}.taro-picker__hd:after{background-color:#e5e5e5;bottom:0;content:"";height:1px;left:0;position:absolute;transform:scaleY(.5);width:100%}.taro-picker__action{color:#1aad19;flex:0 0 auto;font-size:14px;height:44px;line-height:44px;padding:0 10px}.taro-picker__action:first-child{color:#888}.taro-picker__title{color:#000;font-size:16px;font-weight:500;left:50%;max-width:40%;overflow:hidden;position:absolute;text-overflow:ellipsis;top:50%;transform:translate(-50%,-50%);white-space:nowrap}.taro-picker__bd{background-color:#fff;height:238px;overflow:hidden;width:100%}.taro-picker__bd,.taro-picker__group{box-sizing:border-box;display:flex;flex:1}.taro-picker__group{align-items:center;height:100%;justify-content:center;min-width:0;position:relative}.taro-picker__group--date .taro-picker__columns{display:flex;height:100%;width:100%}.taro-picker__mask{background:linear-gradient(180deg,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6) 40%,hsla(0,0%,100%,0) 45%,hsla(0,0%,100%,0) 55%,hsla(0,0%,100%,.6) 60%,hsla(0,0%,100%,.95));height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:1}.taro-picker__indicator{box-sizing:border-box;height:34px;left:0;position:absolute;top:50%;transform:translateY(-50%);width:100%;z-index:1002}.taro-picker__indicator:after,.taro-picker__indicator:before{background-color:#e5e5e5;content:"";height:1px;left:0;position:absolute;right:0;transform:scaleY(.5)}.taro-picker__indicator:before{top:0}.taro-picker__indicator:after{bottom:0}.taro-picker__content{box-sizing:border-box;height:100%;width:100%}.taro-picker__item{align-items:center;box-sizing:border-box;color:#000;display:flex;font-size:16px;height:34px;justify-content:center;line-height:34px;overflow:hidden;padding:0 8px;text-align:center;text-overflow:ellipsis;white-space:nowrap;width:100%}.taro-picker__item--selected{color:#1aad19;font-weight:500}.taro-picker__item--disabled{color:#999}.taro-picker__column{flex:1;margin:0 8px}.taro-picker__column:first-child{margin-left:0}.taro-picker__column:last-child{margin-right:0}.taro-picker__item--custom{align-items:center;color:#888;display:flex;font-weight:400;justify-content:center;text-align:center}@keyframes taro-picker__slide-up{0%{transform:translate3d(0,100%,0)}to{transform:translateZ(0)}}@keyframes taro-picker__slide-down{0%{transform:translateZ(0)}to{transform:translate3d(0,100%,0)}}@keyframes taro-picker__fade-in{0%{opacity:0}to{opacity:1}}@keyframes taro-picker__fade-out{0%{opacity:1}to{opacity:0}}.rmc-pull-to-refresh-content{transform-origin:left top 0}.rmc-pull-to-refresh-content-wrapper{min-height:100%}.rmc-pull-to-refresh-transition{transition:transform .3s}@keyframes rmc-pull-to-refresh-indicator{50%{opacity:.2}to{opacity:1}}.rmc-pull-to-refresh-indicator{height:30px;line-height:10px;text-align:center}.rmc-pull-to-refresh-indicator>div{animation-fill-mode:both;animation:rmc-pull-to-refresh-indicator .5s linear 0s infinite;background-color:grey;border-radius:100%;display:inline-block;height:6px;margin:3px;width:6px}.rmc-pull-to-refresh-indicator>div:nth-child(0){animation-delay:-.1s!important}.rmc-pull-to-refresh-indicator>div:first-child{animation-delay:-.2s!important}.rmc-pull-to-refresh-indicator>div:nth-child(2){animation-delay:-.3s!important}.rmc-pull-to-refresh-down .rmc-pull-to-refresh-indicator{margin-top:-25px}.taro-scroll{-webkit-overflow-scrolling:auto}.taro-scroll--hidebar::-webkit-scrollbar{display:none}.taro-scroll-view{overflow:hidden}.taro-scroll-view__scroll-x{overflow-x:scroll;overflow-y:hidden}.taro-scroll-view__scroll-y{overflow-x:hidden;overflow-y:scroll}.swiper-container-wrapper{height:150px}.swiper-container{height:100%;overflow:visible;position:relative}.taro-text{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.taro-text__selectable{-moz-user-select:text;-webkit-user-select:text;-ms-user-select:text;user-select:text}
|
|
1
|
+
@-webkit-keyframes weuiLoading{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes weuiLoading{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.taro-button-core[loading]>.weui-loading{animation:weuiLoading 1s steps(12) infinite;background:transparent url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E9E9E9' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23989697' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%239B999A' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23A3A1A2' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23ABA9AA' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23B2B2B2' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23BAB8B9' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23C2C0C1' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23CBCBCB' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23D2D2D2' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23DADADA' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E2E2E2' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E") no-repeat;background-size:100%;display:inline-block;height:20px;vertical-align:middle;width:20px}.taro-button-core[loading]>.weui-loading.weui-btn_primary,.taro-button-core[loading]>.weui-loading.weui-btn_warn{color:hsla(0,0%,100%,.6)}.taro-button-core[loading]>.weui-loading.weui-btn_primary{background-color:#179b16}.taro-button-core[loading]>.weui-loading.weui-btn_warn{background-color:#ce3c39}.taro-button-core{-webkit-tap-highlight-color:rgba(0,0,0,0);appearance:none;background-color:#f8f8f8;border-radius:5px;border-width:0;box-sizing:border-box;color:#000;display:block;font-size:18px;line-height:2.55555556;margin-left:auto;margin-right:auto;outline:0;overflow:hidden;padding-left:14px;padding-right:14px;position:relative;text-align:center;text-decoration:none;width:100%}.taro-button-core:focus{outline:0}.taro-button-core:not([disabled]):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core:after{border:1px solid rgba(0,0,0,.2);border-radius:10px;box-sizing:border-box;content:" ";height:200%;left:0;position:absolute;top:0;transform:scale(.5);transform-origin:0 0;width:200%}.taro-button-core+.taro-button-core{margin-top:15px}.taro-button-core[type=default]{background-color:#f8f8f8;color:#000}.taro-button-core[type=default]:not([disabled]):visited{color:#000}.taro-button-core[type=default]:not([disabled]):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core[size=mini]{display:inline-block;font-size:13px;line-height:2.3;padding:0 1.32em;width:auto}.taro-button-core[plain=true],.taro-button-core[plain=true][type=default],.taro-button-core[plain=true][type=primary]{background-color:transparent;border-width:1px}.taro-button-core[disabled]{color:hsla(0,0%,100%,.6)}.taro-button-core[disabled][type=default]{background-color:#f7f7f7;color:rgba(0,0,0,.3)}.taro-button-core[disabled][type=primary]{background-color:#9ed99d}.taro-button-core[disabled][type=warn]{background-color:#ec8b89}.taro-button-core[loading] .weui-loading{margin:-.2em .34em 0 0}.taro-button-core[loading][type=primary],.taro-button-core[loading][type=warn]{color:hsla(0,0%,100%,.6)}.taro-button-core[loading][type=primary]{background-color:#179b16}.taro-button-core[loading][type=warn]{background-color:#ce3c39}.taro-button-core[plain=true][type=primary]{border:1px solid #1aad19;color:#1aad19}.taro-button-core[plain=true][type=primary]:not([disabled]):active{background-color:transparent;border-color:rgba(26,173,25,.6);color:rgba(26,173,25,.6)}.taro-button-core[plain=true][type=primary]:after{border-width:0}.taro-button-core[plain=true][type=warn]{border:1px solid #e64340;color:#e64340}.taro-button-core[plain=true][type=warn]:not([disabled]):active{background-color:transparent;border-color:rgba(230,67,64,.6);color:rgba(230,67,64,.6)}.taro-button-core[plain=true][type=warn]:after{border-width:0}.taro-button-core[plain=true],.taro-button-core[plain=true][type=default]{border:1px solid #353535;color:#353535}.taro-button-core[plain=true]:not([disabled]):active,.taro-button-core[plain=true][type=default]:not([disabled]):active{background-color:transparent;border-color:rgba(53,53,53,.6);color:rgba(53,53,53,.6)}.taro-button-core[plain=true]:after,.taro-button-core[plain=true][type=default]:after{border-width:0}.taro-button-core[type=primary]{background-color:#1aad19;color:#fff}.taro-button-core[type=primary]:not([disabled]):visited{color:#fff}.taro-button-core[type=primary]:not([disabled]):active{background-color:#179b16;color:hsla(0,0%,100%,.6)}.taro-button-core[type=warn]{background-color:#e64340;color:#fff}.taro-button-core[type=warn]:not([disabled]):visited{color:#fff}.taro-button-core[type=warn]:not([disabled]):active{background-color:#ce3c39;color:hsla(0,0%,100%,.6)}.taro-button-core[plain=true][disabled],.taro-button-core[plain=true][disabled][type=primary]{background-color:#f7f7f7;border:1px solid rgba(0,0,0,.2);color:rgba(0,0,0,.3)}.weui-icon-circle:before{content:"\ea01"}.weui-icon-download:before{content:"\ea02"}.weui-icon-info:before{content:"\ea03"}.weui-icon-safe-success:before{content:"\ea04"}.weui-icon-safe-warn:before{content:"\ea05"}.weui-icon-success:before{content:"\ea06"}.weui-icon-success-circle:before{content:"\ea07"}.weui-icon-success-no-circle:before{content:"\ea08"}.weui-icon-waiting:before{content:"\ea09"}.weui-icon-waiting-circle:before{content:"\ea0a"}.weui-icon-warn:before{content:"\ea0b"}.weui-icon-info-circle:before{content:"\ea0c"}.weui-icon-cancel:before{content:"\ea0d"}.weui-icon-search:before{content:"\ea0e"}.weui-icon-clear:before{content:"\ea0f"}.weui-icon-back:before{content:"\ea10"}.weui-icon-delete:before{content:"\ea11"}.weui-icon-success{color:#09bb07;font-size:23px}.weui-icon-waiting{color:#10aeff;font-size:23px}.weui-icon-warn{color:#f43530;font-size:23px}.weui-icon-info{color:#10aeff;font-size:23px}.weui-icon-success-circle,.weui-icon-success-no-circle{color:#09bb07;font-size:23px}.weui-icon-waiting-circle{color:#10aeff;font-size:23px}.weui-icon-circle{color:#c9c9c9;font-size:23px}.weui-icon-download,.weui-icon-info-circle{color:#09bb07;font-size:23px}.weui-icon-safe-success{color:#09bb07}.weui-icon-safe-warn{color:#ffbe00}.weui-icon-cancel{color:#f43530;font-size:22px}.weui-icon-clear,.weui-icon-search{color:#b2b2b2;font-size:14px}.weui-icon-delete.weui-icon_gallery-delete{color:#fff;font-size:22px}.weui-icon_msg{font-size:93px}.weui-icon_msg.weui-icon-warn{color:#f76260}.weui-icon_msg-primary{font-size:93px}.weui-icon_msg-primary.weui-icon-warn{color:#ffbe00}img[src=""]{opacity:0}.taro-img{display:inline-block;font-size:0;height:240px;overflow:hidden;position:relative;width:320px}.taro-img.taro-img__widthfix,.taro-img__mode-heightfix{height:100%}.taro-img__mode-scaletofill{height:100%;width:100%}.taro-img__mode-aspectfit{height:100%;object-fit:contain;width:100%}.taro-img__mode-aspectfill{height:100%;object-fit:cover;width:100%}.taro-img__mode-widthfix{width:100%}.taro-img__mode-bottom,.taro-img__mode-top{left:50%;position:absolute;transform:translate(-50%)}.taro-img__mode-bottom{bottom:0}.taro-img__mode-center{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.taro-img__mode-left,.taro-img__mode-right{position:absolute;top:50%;transform:translateY(-50%)}.taro-img__mode-right{right:0}.taro-img__mode-topright{position:absolute;right:0}.taro-img__mode-bottomleft{bottom:0;position:absolute}.taro-img__mode-bottomright{bottom:0;position:absolute;right:0}.taro-input-core{display:block}.weui-input{-webkit-appearance:none;background-color:transparent;border:0;color:inherit;font-size:inherit;height:1.4705882353em;line-height:1.4705882353;outline:0;width:100%}.weui-input::-webkit-inner-spin-button,.weui-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.taro-picker__overlay{position:fixed;z-index:1000}.taro-picker__mask-overlay,.taro-picker__overlay{bottom:0;height:100%;left:0;right:0;top:0;width:100%}.taro-picker__mask-overlay{background-color:rgba(0,0,0,.6);position:absolute;z-index:1001}.taro-picker{background-color:#e5e5e5;bottom:0;font-size:14px;left:0;position:absolute;width:100%;z-index:1002}.taro-picker__hd{align-items:center;background-color:#fff;display:flex;font-size:17px;height:44px;justify-content:space-between;padding:0;position:relative}.taro-picker__hd:after{background-color:#e5e5e5;bottom:0;content:"";height:1px;left:0;position:absolute;transform:scaleY(.5);width:100%}.taro-picker__action{color:#ff0f23;flex:0 0 auto;font-size:14px;height:44px;line-height:44px;padding:0 10px}.taro-picker__action:first-child{color:#888}.taro-picker__title{color:#000;font-size:16px;font-weight:500;left:50%;max-width:40%;overflow:hidden;position:absolute;text-overflow:ellipsis;top:50%;transform:translate(-50%,-50%);white-space:nowrap}.taro-picker__bd{background-color:#fff;height:238px;overflow:hidden;width:100%}.taro-picker__bd,.taro-picker__group{box-sizing:border-box;display:flex;flex:1}.taro-picker__group{align-items:center;height:100%;justify-content:center;min-width:0;position:relative}.taro-picker__group--date .taro-picker__columns{display:flex;height:100%;width:100%}.taro-picker__mask{background:linear-gradient(180deg,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6) 40%,hsla(0,0%,100%,0) 45%,hsla(0,0%,100%,0) 55%,hsla(0,0%,100%,.6) 60%,hsla(0,0%,100%,.95));height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:1}.taro-picker__indicator{box-sizing:border-box;height:34px;left:0;position:absolute;top:50%;transform:translateY(-50%);width:100%;z-index:1002}.taro-picker__indicator:after,.taro-picker__indicator:before{background-color:#e5e5e5;content:"";height:1px;left:0;position:absolute;right:0;transform:scaleY(.5)}.taro-picker__indicator:before{top:0}.taro-picker__indicator:after{bottom:0}.taro-picker__content{box-sizing:border-box;height:100%;width:100%}.taro-picker__item{align-items:center;box-sizing:border-box;color:#000;display:flex;font-size:16px;height:34px;justify-content:center;line-height:34px;overflow:hidden;padding:0 8px;text-align:center;text-overflow:ellipsis;white-space:nowrap;width:100%}.taro-picker__item--selected{color:#ff0f23;font-weight:500}.taro-picker__item--disabled{color:#999}.taro-picker__column{flex:1;margin:0 8px}.taro-picker__column:first-child{margin-left:0}.taro-picker__column:last-child{margin-right:0}.taro-picker__item--custom{align-items:center;color:#888;display:flex;font-weight:400;justify-content:center;text-align:center}@keyframes taro-picker__slide-up{0%{transform:translate3d(0,100%,0)}to{transform:translateZ(0)}}@keyframes taro-picker__slide-down{0%{transform:translateZ(0)}to{transform:translate3d(0,100%,0)}}@keyframes taro-picker__fade-in{0%{opacity:0}to{opacity:1}}@keyframes taro-picker__fade-out{0%{opacity:1}to{opacity:0}}.rmc-pull-to-refresh-content{transform-origin:left top 0}.rmc-pull-to-refresh-content-wrapper{min-height:100%}.rmc-pull-to-refresh-transition{transition:transform .3s}@keyframes rmc-pull-to-refresh-indicator{50%{opacity:.2}to{opacity:1}}.rmc-pull-to-refresh-indicator{height:30px;line-height:10px;text-align:center}.rmc-pull-to-refresh-indicator>div{animation-fill-mode:both;animation:rmc-pull-to-refresh-indicator .5s linear 0s infinite;background-color:grey;border-radius:100%;display:inline-block;height:6px;margin:3px;width:6px}.rmc-pull-to-refresh-indicator>div:nth-child(0){animation-delay:-.1s!important}.rmc-pull-to-refresh-indicator>div:first-child{animation-delay:-.2s!important}.rmc-pull-to-refresh-indicator>div:nth-child(2){animation-delay:-.3s!important}.rmc-pull-to-refresh-down .rmc-pull-to-refresh-indicator{margin-top:-25px}.taro-scroll{-webkit-overflow-scrolling:auto}.taro-scroll--hidebar::-webkit-scrollbar{display:none}.taro-scroll-view{overflow:hidden}.taro-scroll-view__scroll-x{overflow-x:scroll;overflow-y:hidden}.taro-scroll-view__scroll-y{overflow-x:hidden;overflow-y:scroll}.swiper-container-wrapper{height:150px}.swiper-container{height:100%;overflow:visible;position:relative}.taro-text{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.taro-text__selectable{-moz-user-select:text;-webkit-user-select:text;-ms-user-select:text;user-select:text}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { default as Image } from './components/image/index.js';
|
|
|
5
5
|
export { default as Input } from './components/input/index.js';
|
|
6
6
|
export { default as Picker } from './components/picker/index.js';
|
|
7
7
|
export { default as PullDownRefresh } from './components/pull-down-refresh/index.js';
|
|
8
|
+
export { default as Refresher } from './components/refresher/index.js';
|
|
8
9
|
export { default as ScrollView } from './components/scroll-view/index.js';
|
|
9
10
|
export { Swiper, SwiperItem } from './components/swiper/index.js';
|
|
10
11
|
export { default as Text } from './components/text/index.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.react.ts"],"sourcesContent":["/* eslint-disable simple-import-sort/exports */\nexport { Ad } from '@tarojs/components/lib/react'\nexport { AdCustom } from '@tarojs/components/lib/react'\nexport { AnimationVideo } from '@tarojs/components/lib/react'\nexport { AnimationView } from '@tarojs/components/lib/react'\nexport { ArCamera } from '@tarojs/components/lib/react'\nexport { Audio } from '@tarojs/components/lib/react'\nexport { AwemeData } from '@tarojs/components/lib/react'\nexport { Block } from '@tarojs/components/lib/react'\nexport { default as Button } from './components/button'\nexport { Camera } from '@tarojs/components/lib/react'\nexport { Canvas } from '@tarojs/components/lib/react'\nexport { ChannelLive } from '@tarojs/components/lib/react'\nexport { ChannelVideo } from '@tarojs/components/lib/react'\nexport { Checkbox, CheckboxGroup } from '@tarojs/components/lib/react'\nexport { CommentDetail, CommentList } from '@tarojs/components/lib/react'\nexport { ContactButton } from '@tarojs/components/lib/react'\nexport { CoverImage } from '@tarojs/components/lib/react'\nexport { CoverView } from '@tarojs/components/lib/react'\nexport { CustomWrapper } from '@tarojs/components/lib/react'\nexport { DraggableSheet } from '@tarojs/components/lib/react'\nexport { Editor } from '@tarojs/components/lib/react'\nexport { FollowSwan } from '@tarojs/components/lib/react'\nexport { Form } from '@tarojs/components/lib/react'\nexport { FunctionalPageNavigator } from '@tarojs/components/lib/react'\nexport { GridView } from '@tarojs/components/lib/react'\nexport { GridBuilder } from '@tarojs/components/lib/react'\nexport { default as Icon } from './components/icon'\nexport { default as Image } from './components/image'\nexport { InlinePaymentPanel } from '@tarojs/components/lib/react'\nexport { default as Input } from './components/input'\nexport { KeyboardAccessory } from '@tarojs/components/lib/react'\nexport { Label } from '@tarojs/components/lib/react'\nexport { Lifestyle } from '@tarojs/components/lib/react'\nexport { Like } from '@tarojs/components/lib/react'\nexport { LivePlayer } from '@tarojs/components/lib/react'\nexport { LivePusher } from '@tarojs/components/lib/react'\nexport { ListBuilder } from '@tarojs/components/lib/react'\nexport { ListView } from '@tarojs/components/lib/react'\nexport { Login } from '@tarojs/components/lib/react'\nexport { Lottie } from '@tarojs/components/lib/react'\nexport { Map } from '@tarojs/components/lib/react'\nexport { MatchMedia } from '@tarojs/components/lib/react'\nexport { MovableArea, MovableView } from '@tarojs/components/lib/react'\nexport { NavigationBar } from '@tarojs/components/lib/react'\nexport { Navigator } from '@tarojs/components/lib/react'\nexport { NestedScrollBody } from '@tarojs/components/lib/react'\nexport { NestedScrollHeader } from '@tarojs/components/lib/react'\nexport { OfficialAccount } from '@tarojs/components/lib/react'\nexport { OpenData } from '@tarojs/components/lib/react'\nexport { OpenContainer } from '@tarojs/components/lib/react'\nexport { PageContainer } from '@tarojs/components/lib/react'\nexport { PageMeta } from '@tarojs/components/lib/react'\nexport { default as Picker } from './components/picker'\nexport { PickerView, PickerViewColumn } from '@tarojs/components/lib/react'\nexport { Progress } from '@tarojs/components/lib/react'\nexport { default as PullDownRefresh } from './components/pull-down-refresh'\n// export { PullToRefresh } from '@tarojs/components/lib/react'\nexport { Radio, RadioGroup } from '@tarojs/components/lib/react'\nexport { RichText } from '@tarojs/components/lib/react'\nexport { RootPortal } from '@tarojs/components/lib/react'\nexport { RtcRoom, RtcRoomItem } from '@tarojs/components/lib/react'\nexport { Script } from '@tarojs/components/lib/react'\nexport { default as ScrollView } from './components/scroll-view'\nexport { ShareElement } from '@tarojs/components/lib/react'\nexport { Slider } from '@tarojs/components/lib/react'\nexport { Snapshot } from '@tarojs/components/lib/react'\nexport { Span } from '@tarojs/components/lib/react'\nexport { NativeSlot, Slot } from '@tarojs/components/lib/react'\nexport { Swiper, SwiperItem } from './components/swiper'\nexport { Switch } from '@tarojs/components/lib/react'\nexport { Tabs } from '@tarojs/components/lib/react'\nexport { default as Text } from './components/text'\nexport { Textarea } from '@tarojs/components/lib/react'\nexport { Video } from '@tarojs/components/lib/react'\nexport { default as View } from './components/view'\nexport { VoipRoom } from '@tarojs/components/lib/react'\nexport { WebView } from '@tarojs/components/lib/react'\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.react.ts"],"sourcesContent":["/* eslint-disable simple-import-sort/exports */\nexport { Ad } from '@tarojs/components/lib/react'\nexport { AdCustom } from '@tarojs/components/lib/react'\nexport { AnimationVideo } from '@tarojs/components/lib/react'\nexport { AnimationView } from '@tarojs/components/lib/react'\nexport { ArCamera } from '@tarojs/components/lib/react'\nexport { Audio } from '@tarojs/components/lib/react'\nexport { AwemeData } from '@tarojs/components/lib/react'\nexport { Block } from '@tarojs/components/lib/react'\nexport { default as Button } from './components/button'\nexport { Camera } from '@tarojs/components/lib/react'\nexport { Canvas } from '@tarojs/components/lib/react'\nexport { ChannelLive } from '@tarojs/components/lib/react'\nexport { ChannelVideo } from '@tarojs/components/lib/react'\nexport { Checkbox, CheckboxGroup } from '@tarojs/components/lib/react'\nexport { CommentDetail, CommentList } from '@tarojs/components/lib/react'\nexport { ContactButton } from '@tarojs/components/lib/react'\nexport { CoverImage } from '@tarojs/components/lib/react'\nexport { CoverView } from '@tarojs/components/lib/react'\nexport { CustomWrapper } from '@tarojs/components/lib/react'\nexport { DraggableSheet } from '@tarojs/components/lib/react'\nexport { Editor } from '@tarojs/components/lib/react'\nexport { FollowSwan } from '@tarojs/components/lib/react'\nexport { Form } from '@tarojs/components/lib/react'\nexport { FunctionalPageNavigator } from '@tarojs/components/lib/react'\nexport { GridView } from '@tarojs/components/lib/react'\nexport { GridBuilder } from '@tarojs/components/lib/react'\nexport { default as Icon } from './components/icon'\nexport { default as Image } from './components/image'\nexport { InlinePaymentPanel } from '@tarojs/components/lib/react'\nexport { default as Input } from './components/input'\nexport { KeyboardAccessory } from '@tarojs/components/lib/react'\nexport { Label } from '@tarojs/components/lib/react'\nexport { Lifestyle } from '@tarojs/components/lib/react'\nexport { Like } from '@tarojs/components/lib/react'\nexport { LivePlayer } from '@tarojs/components/lib/react'\nexport { LivePusher } from '@tarojs/components/lib/react'\nexport { ListBuilder } from '@tarojs/components/lib/react'\nexport { ListView } from '@tarojs/components/lib/react'\nexport { Login } from '@tarojs/components/lib/react'\nexport { Lottie } from '@tarojs/components/lib/react'\nexport { Map } from '@tarojs/components/lib/react'\nexport { MatchMedia } from '@tarojs/components/lib/react'\nexport { MovableArea, MovableView } from '@tarojs/components/lib/react'\nexport { NavigationBar } from '@tarojs/components/lib/react'\nexport { Navigator } from '@tarojs/components/lib/react'\nexport { NestedScrollBody } from '@tarojs/components/lib/react'\nexport { NestedScrollHeader } from '@tarojs/components/lib/react'\nexport { OfficialAccount } from '@tarojs/components/lib/react'\nexport { OpenData } from '@tarojs/components/lib/react'\nexport { OpenContainer } from '@tarojs/components/lib/react'\nexport { PageContainer } from '@tarojs/components/lib/react'\nexport { PageMeta } from '@tarojs/components/lib/react'\nexport { default as Picker } from './components/picker'\nexport { PickerView, PickerViewColumn } from '@tarojs/components/lib/react'\nexport { Progress } from '@tarojs/components/lib/react'\nexport { default as PullDownRefresh } from './components/pull-down-refresh'\n// export { PullToRefresh } from '@tarojs/components/lib/react'\nexport { default as Refresher } from './components/refresher'\nexport { Radio, RadioGroup } from '@tarojs/components/lib/react'\nexport { RichText } from '@tarojs/components/lib/react'\nexport { RootPortal } from '@tarojs/components/lib/react'\nexport { RtcRoom, RtcRoomItem } from '@tarojs/components/lib/react'\nexport { Script } from '@tarojs/components/lib/react'\nexport { default as ScrollView } from './components/scroll-view'\nexport { ShareElement } from '@tarojs/components/lib/react'\nexport { Slider } from '@tarojs/components/lib/react'\nexport { Snapshot } from '@tarojs/components/lib/react'\nexport { Span } from '@tarojs/components/lib/react'\nexport { NativeSlot, Slot } from '@tarojs/components/lib/react'\nexport { Swiper, SwiperItem } from './components/swiper'\nexport { Switch } from '@tarojs/components/lib/react'\nexport { Tabs } from '@tarojs/components/lib/react'\nexport { default as Text } from './components/text'\nexport { Textarea } from '@tarojs/components/lib/react'\nexport { Video } from '@tarojs/components/lib/react'\nexport { default as View } from './components/view'\nexport { VoipRoom } from '@tarojs/components/lib/react'\nexport { WebView } from '@tarojs/components/lib/react'\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA"}
|
|
@@ -1,12 +1,46 @@
|
|
|
1
|
-
import { template, use, spread,
|
|
1
|
+
import { template, use, spread, mergeProps, getOwner, effect, style, insert, addEventListener, setAttribute } from 'solid-js/web';
|
|
2
2
|
import { __rest } from 'tslib';
|
|
3
3
|
import './style/index.css.js';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { createForwardRefComponent } from '../../utils/index.js';
|
|
6
|
-
import { useRef, useState,
|
|
6
|
+
import { useRef, useState, useEffect, useCallback } from '../../utils/hooks.solid.js';
|
|
7
7
|
|
|
8
|
-
var _tmpl$ = /*#__PURE__*/template(`<div
|
|
9
|
-
_tmpl$2 = /*#__PURE__*/template(`<
|
|
8
|
+
var _tmpl$ = /*#__PURE__*/template(`<div><canvas-tag>`, true, false, false),
|
|
9
|
+
_tmpl$2 = /*#__PURE__*/template(`<div>`),
|
|
10
|
+
_tmpl$3 = /*#__PURE__*/template(`<img>`);
|
|
11
|
+
// CDN脚本URL
|
|
12
|
+
const LEGO_CDN_URL = 'http://ossin.jd.com/swm-plus/h5Tag/tag.js';
|
|
13
|
+
// 检查CDN脚本是否已加载
|
|
14
|
+
const isLegoScriptLoaded = () => {
|
|
15
|
+
return document.querySelector(`script[src="${LEGO_CDN_URL}"]`) !== null;
|
|
16
|
+
};
|
|
17
|
+
// 插入CDN脚本
|
|
18
|
+
const insertLegoScript = () => {
|
|
19
|
+
if (isLegoScriptLoaded()) return;
|
|
20
|
+
const script = document.createElement('script');
|
|
21
|
+
script.type = 'module';
|
|
22
|
+
script.src = LEGO_CDN_URL;
|
|
23
|
+
document.head.appendChild(script);
|
|
24
|
+
};
|
|
25
|
+
// 解析lego协议URL
|
|
26
|
+
const parseLegoUrl = src => {
|
|
27
|
+
if (!src.startsWith('lego://')) return null;
|
|
28
|
+
try {
|
|
29
|
+
// 移除 'lego://' 前缀
|
|
30
|
+
const urlWithoutProtocol = src.substring(7);
|
|
31
|
+
// 分割tagId和参数
|
|
32
|
+
const [tagId, params] = urlWithoutProtocol.split('?');
|
|
33
|
+
// 解析参数
|
|
34
|
+
const text = params ? new URLSearchParams(params).get('text') || '' : '';
|
|
35
|
+
return {
|
|
36
|
+
tagId,
|
|
37
|
+
text
|
|
38
|
+
};
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.warn('Failed to parse lego URL:', src, error);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
10
44
|
function Image(props) {
|
|
11
45
|
const imgRef = useRef(null);
|
|
12
46
|
const observer = useRef({});
|
|
@@ -21,7 +55,18 @@ function Image(props) {
|
|
|
21
55
|
imgProps,
|
|
22
56
|
forwardedRef
|
|
23
57
|
} = props,
|
|
24
|
-
reset = __rest(props
|
|
58
|
+
reset = __rest(props
|
|
59
|
+
// 检查是否为lego模式
|
|
60
|
+
, ["className", "style", "src", "mode", "onError", "lazyLoad", "imgProps", "forwardedRef"]);
|
|
61
|
+
// 检查是否为lego模式
|
|
62
|
+
const legoData = parseLegoUrl(src);
|
|
63
|
+
const isLegoMode = legoData !== null;
|
|
64
|
+
// 如果是lego模式,确保CDN脚本已加载
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (isLegoMode) {
|
|
67
|
+
insertLegoScript();
|
|
68
|
+
}
|
|
69
|
+
}, [isLegoMode]);
|
|
25
70
|
const cls = classNames('taro-img', {
|
|
26
71
|
'taro-img__widthfix': mode === 'widthFix'
|
|
27
72
|
}, className);
|
|
@@ -60,32 +105,54 @@ function Image(props) {
|
|
|
60
105
|
(_b = (_a = observer.current) === null || _a === void 0 ? void 0 : _a.disconnect) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
61
106
|
};
|
|
62
107
|
}, [lazyLoad, src]);
|
|
108
|
+
// 如果是lego模式,渲染canvas-tag
|
|
109
|
+
if (isLegoMode && legoData) {
|
|
110
|
+
return (() => {
|
|
111
|
+
var _el$ = _tmpl$(),
|
|
112
|
+
_el$2 = _el$.firstChild;
|
|
113
|
+
use(forwardedRef, _el$);
|
|
114
|
+
_el$.className = cls;
|
|
115
|
+
spread(_el$, reset, false, true);
|
|
116
|
+
spread(_el$2, mergeProps({
|
|
117
|
+
get tagId() {
|
|
118
|
+
return legoData.tagId;
|
|
119
|
+
},
|
|
120
|
+
get text() {
|
|
121
|
+
return legoData.text;
|
|
122
|
+
}
|
|
123
|
+
}, imgProps), false, false);
|
|
124
|
+
_el$2._$owner = getOwner();
|
|
125
|
+
effect(_$p => style(_el$, style$1, _$p));
|
|
126
|
+
return _el$;
|
|
127
|
+
})();
|
|
128
|
+
}
|
|
129
|
+
// 普通图片模式
|
|
63
130
|
return (() => {
|
|
64
|
-
var _el$ = _tmpl$();
|
|
65
|
-
use(forwardedRef, _el$);
|
|
66
|
-
_el
|
|
67
|
-
spread(_el
|
|
68
|
-
insert(_el
|
|
69
|
-
var _el$
|
|
70
|
-
addEventListener(_el$
|
|
71
|
-
addEventListener(_el$
|
|
72
|
-
use(img => imgRef.current = img, _el$
|
|
73
|
-
_el$
|
|
74
|
-
setAttribute(_el$
|
|
75
|
-
spread(_el$
|
|
76
|
-
return _el$
|
|
131
|
+
var _el$3 = _tmpl$2();
|
|
132
|
+
use(forwardedRef, _el$3);
|
|
133
|
+
_el$3.className = cls;
|
|
134
|
+
spread(_el$3, reset, false, true);
|
|
135
|
+
insert(_el$3, lazyLoad ? (() => {
|
|
136
|
+
var _el$4 = _tmpl$3();
|
|
137
|
+
addEventListener(_el$4, "error", onError);
|
|
138
|
+
addEventListener(_el$4, "load", imageOnLoad);
|
|
139
|
+
use(img => imgRef.current = img, _el$4);
|
|
140
|
+
_el$4.className = imgCls;
|
|
141
|
+
setAttribute(_el$4, "data-src", src);
|
|
142
|
+
spread(_el$4, imgProps, false, false);
|
|
143
|
+
return _el$4;
|
|
77
144
|
})() : (() => {
|
|
78
|
-
var _el$
|
|
79
|
-
addEventListener(_el$
|
|
80
|
-
addEventListener(_el$
|
|
81
|
-
use(img => imgRef.current = img, _el$
|
|
82
|
-
_el$
|
|
83
|
-
setAttribute(_el$
|
|
84
|
-
spread(_el$
|
|
85
|
-
return _el$
|
|
145
|
+
var _el$5 = _tmpl$3();
|
|
146
|
+
addEventListener(_el$5, "error", onError);
|
|
147
|
+
addEventListener(_el$5, "load", imageOnLoad);
|
|
148
|
+
use(img => imgRef.current = img, _el$5);
|
|
149
|
+
_el$5.className = imgCls;
|
|
150
|
+
setAttribute(_el$5, "src", src);
|
|
151
|
+
spread(_el$5, imgProps, false, false);
|
|
152
|
+
return _el$5;
|
|
86
153
|
})());
|
|
87
|
-
effect(_$p => style(_el
|
|
88
|
-
return _el
|
|
154
|
+
effect(_$p => style(_el$3, style$1, _$p));
|
|
155
|
+
return _el$3;
|
|
89
156
|
})();
|
|
90
157
|
}
|
|
91
158
|
var index = createForwardRefComponent(Image);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/image/index.tsx"],"sourcesContent":["import './style/index.css'\n\nimport classNames from 'classnames'\n\nimport { createForwardRefComponent } from '../../utils'\nimport { useCallback, useEffect, useRef, useState } from '../../utils/hooks'\n\nimport type React from 'react'\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n src: string\n mode: string\n onError: () => void\n onLoad: (e) => void\n lazyLoad?: boolean\n imgProps?: Record<string, any>\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n}\n\nfunction Image (props: IProps) {\n const imgRef = useRef<HTMLImageElement | null>(null)\n const observer = useRef<Partial<IntersectionObserver>>({})\n const [, setIsLoaded] = useState(false)\n const {\n className,\n style = {},\n src,\n mode,\n onError,\n lazyLoad,\n imgProps,\n forwardedRef,\n ...reset\n } = props\n const cls = classNames(\n 'taro-img',\n {\n 'taro-img__widthfix': mode === 'widthFix'\n },\n className\n )\n const imgCls = classNames(\n 'taro-img__mode-' +\n (mode || 'scaleToFill').toLowerCase().replace(/\\s/g, '')\n )\n\n const imageOnLoad = useCallback((e) => {\n const { onLoad } = props\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n writable: true,\n value: {\n width: e.target.width,\n height: e.target.height\n }\n })\n\n onLoad && onLoad(e)\n }, [props])\n\n useEffect(() => {\n if (lazyLoad) {\n observer.current = new IntersectionObserver(\n entries => {\n // 异步 api 关系\n if (entries[entries.length - 1].isIntersecting) {\n setIsLoaded(true)\n // findDOMNode(this).children[0].src = src\n imgRef.current!.src = src\n }\n },\n {\n rootMargin: '300px 0px'\n }\n )\n observer.current.observe?.(imgRef.current!)\n }\n\n return () => {\n observer.current?.disconnect?.()\n }\n }, [lazyLoad, src])\n\n return (\n <div className={cls} style={style} ref={forwardedRef} {...reset}>\n {lazyLoad ? (\n <img\n ref={img => (imgRef.current = img)}\n className={imgCls}\n data-src={src}\n onLoad={imageOnLoad}\n onError={onError}\n {...imgProps}\n />\n ) : (\n <img\n ref={img => (imgRef.current = img)}\n className={imgCls}\n src={src}\n onLoad={imageOnLoad}\n onError={onError}\n {...imgProps}\n />\n )}\n </div>\n )\n}\n\nexport default createForwardRefComponent(Image)\n"],"names":["Image","props","imgRef","useRef","observer","setIsLoaded","useState","className","style","src","mode","onError","lazyLoad","imgProps","forwardedRef","reset","__rest","cls","classNames","imgCls","toLowerCase","replace","imageOnLoad","useCallback","e","onLoad","Object","defineProperty","enumerable","writable","value","width","target","height","useEffect","current","IntersectionObserver","entries","length","isIntersecting","rootMargin","_b","_a","observe","call","disconnect","_el$","_tmpl$","_$use","_$spread","_$insert","_el$2","_tmpl$2","_$addEventListener","img","_$setAttribute","_el$3","_$effect","_$p","_$style","createForwardRefComponent"],"mappings":";;;;;;;;;AAmBA,SAASA,KAAKA,CAAEC,KAAa,EAAA;AAC3B,EAAA,MAAM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xC,OAAO,CAAA;MAAA0C,gBAAA,CAAAF,KAAA,EAAA,MAAA,EADR7B,WAAW,CAAA;MAAA0B,GAAA,CAHdM,GAAG,IAAKpD,MAAM,CAACiC,OAAO,GAAGmB,GAAI,EAAAH,KAAA,CAAA;MAAAA,KAAA,CAAA5C,SAAA,GACvBY,MAAM;MAAAoC,YAAA,CAAAJ,KAAA,EAAA,UAAA,EACP1C,GAAG,CAAA;MAAAwC,MAAA,CAAAE,KAAA,EAGTtC,QAAQ,EAAA,KAAA,EAAA,KAAA,CAAA;AAAA,MAAA,OAAAsC,KAAA;AAAA,KAAA,GAAA,GAAA,CAAA,MAAA;MAAA,IAAAK,KAAA,GAAAJ,OAAA,EAAA;MAAAC,gBAAA,CAAAG,KAAA,EAAA,OAAA,EAQH7C,OAAO,CAAA;MAAA0C,gBAAA,CAAAG,KAAA,EAAA,MAAA,EADRlC,WAAW,CAAA;MAAA0B,GAAA,CAHdM,GAAG,IAAKpD,MAAM,CAACiC,OAAO,GAAGmB,GAAI,EAAAE,KAAA,CAAA;MAAAA,KAAA,CAAAjD,SAAA,GACvBY,MAAM;MAAAoC,YAAA,CAAAC,KAAA,EAAA,KAAA,EACZ/C,GAAG,CAAA;MAAAwC,MAAA,CAAAO,KAAA,EAGJ3C,QAAQ,EAAA,KAAA,EAAA,KAAA,CAAA;AAAA,MAAA,OAAA2C,KAAA;KAEf,GAAA,CAAA;IAAAC,MAAA,CAAAC,GAAA,IAAAC,KAAA,CAAAb,IAAA,EAnByBtC,OAAK,EAAAkD,GAAA,CAAA,CAAA;AAAA,IAAA,OAAAZ,IAAA;AAAA,GAAA,GAAA;AAsBrC;AAEA,YAAec,yBAAyB,CAAC5D,KAAK,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/image/index.tsx"],"sourcesContent":["import './style/index.css'\n\nimport classNames from 'classnames'\n\nimport { createForwardRefComponent } from '../../utils'\nimport { useCallback, useEffect, useRef, useState } from '../../utils/hooks'\n\nimport type React from 'react'\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n src: string\n mode: string\n onError: () => void\n onLoad: (e) => void\n lazyLoad?: boolean\n imgProps?: Record<string, any>\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n}\n\n// CDN脚本URL\nconst LEGO_CDN_URL = 'http://ossin.jd.com/swm-plus/h5Tag/tag.js'\n\n// 检查CDN脚本是否已加载\nconst isLegoScriptLoaded = (): boolean => {\n return document.querySelector(`script[src=\"${LEGO_CDN_URL}\"]`) !== null\n}\n\n// 插入CDN脚本\nconst insertLegoScript = (): void => {\n if (isLegoScriptLoaded()) return\n\n const script = document.createElement('script')\n script.type = 'module'\n script.src = LEGO_CDN_URL\n document.head.appendChild(script)\n}\n\n// 解析lego协议URL\nconst parseLegoUrl = (src: string): { tagId: string, text: string } | null => {\n if (!src.startsWith('lego://')) return null\n\n try {\n // 移除 'lego://' 前缀\n const urlWithoutProtocol = src.substring(7)\n\n // 分割tagId和参数\n const [tagId, params] = urlWithoutProtocol.split('?')\n\n // 解析参数\n const text = params ? new URLSearchParams(params).get('text') || '' : ''\n\n return { tagId, text }\n } catch (error) {\n console.warn('Failed to parse lego URL:', src, error)\n return null\n }\n}\n\nfunction Image (props: IProps) {\n const imgRef = useRef<HTMLImageElement | null>(null)\n const observer = useRef<Partial<IntersectionObserver>>({})\n const [, setIsLoaded] = useState(false)\n const {\n className,\n style = {},\n src,\n mode,\n onError,\n lazyLoad,\n imgProps,\n forwardedRef,\n ...reset\n } = props\n\n // 检查是否为lego模式\n const legoData = parseLegoUrl(src)\n const isLegoMode = legoData !== null\n\n // 如果是lego模式,确保CDN脚本已加载\n useEffect(() => {\n if (isLegoMode) {\n insertLegoScript()\n }\n }, [isLegoMode])\n\n const cls = classNames(\n 'taro-img',\n {\n 'taro-img__widthfix': mode === 'widthFix'\n },\n className\n )\n const imgCls = classNames(\n 'taro-img__mode-' +\n (mode || 'scaleToFill').toLowerCase().replace(/\\s/g, '')\n )\n\n const imageOnLoad = useCallback((e) => {\n const { onLoad } = props\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n writable: true,\n value: {\n width: e.target.width,\n height: e.target.height\n }\n })\n\n onLoad && onLoad(e)\n }, [props])\n\n useEffect(() => {\n if (lazyLoad) {\n observer.current = new IntersectionObserver(\n entries => {\n // 异步 api 关系\n if (entries[entries.length - 1].isIntersecting) {\n setIsLoaded(true)\n // findDOMNode(this).children[0].src = src\n imgRef.current!.src = src\n }\n },\n {\n rootMargin: '300px 0px'\n }\n )\n observer.current.observe?.(imgRef.current!)\n }\n\n return () => {\n observer.current?.disconnect?.()\n }\n }, [lazyLoad, src])\n\n // 如果是lego模式,渲染canvas-tag\n if (isLegoMode && legoData) {\n return (\n <div className={cls} style={style} ref={forwardedRef} {...reset}>\n <canvas-tag\n tagId={legoData.tagId}\n text={legoData.text}\n {...imgProps}\n />\n </div>\n )\n }\n\n // 普通图片模式\n return (\n <div className={cls} style={style} ref={forwardedRef} {...reset}>\n {lazyLoad ? (\n <img\n ref={img => (imgRef.current = img)}\n className={imgCls}\n data-src={src}\n onLoad={imageOnLoad}\n onError={onError}\n {...imgProps}\n />\n ) : (\n <img\n ref={img => (imgRef.current = img)}\n className={imgCls}\n src={src}\n onLoad={imageOnLoad}\n onError={onError}\n {...imgProps}\n />\n )}\n </div>\n )\n}\n\nexport default createForwardRefComponent(Image)\n"],"names":["LEGO_CDN_URL","isLegoScriptLoaded","document","querySelector","insertLegoScript","script","createElement","type","src","head","appendChild","parseLegoUrl","startsWith","urlWithoutProtocol","substring","tagId","params","split","text","URLSearchParams","get","error","console","warn","Image","props","imgRef","useRef","observer","setIsLoaded","useState","className","style","mode","onError","lazyLoad","imgProps","forwardedRef","reset","__rest","legoData","isLegoMode","useEffect","cls","classNames","imgCls","toLowerCase","replace","imageOnLoad","useCallback","e","onLoad","Object","defineProperty","enumerable","writable","value","width","target","height","current","IntersectionObserver","entries","length","isIntersecting","rootMargin","_b","_a","observe","call","disconnect","_el$","_tmpl$","_el$2","firstChild","_$use","_$spread","_$mergeProps","_$owner","_$getOwner","_$effect","_$p","_$style","_el$3","_tmpl$2","_$insert","_el$4","_tmpl$3","_$addEventListener","img","_$setAttribute","_el$5","createForwardRefComponent"],"mappings":";;;;;;;;;;AAmBA;AACA,MAAMA,YAAY,GAAG,2CAA2C;AAEhE;AACA,MAAMC,kBAAkB,GAAGA,MAAc;EACvC,OAAOC,QAAQ,CAACC,aAAa,CAAC,eAAeH,YAAY,CAAA,EAAA,CAAI,CAAC,KAAK,IAAI;AACzE,CAAC;AAED;AACA,MAAMI,gBAAgB,GAAGA,MAAW;EAClC,IAAIH,kBAAkB,EAAE,EAAE;AAE1B,EAAA,MAAMI,MAAM,GAAGH,QAAQ,CAACI,aAAa,CAAC,QAAQ,CAAC;EAC/CD,MAAM,CAACE,IAAI,GAAG,QAAQ;EACtBF,MAAM,CAACG,GAAG,GAAGR,YAAY;AACzBE,EAAAA,QAAQ,CAACO,IAAI,CAACC,WAAW,CAACL,MAAM,CAAC;AACnC,CAAC;AAED;AACA,MAAMM,YAAY,GAAIH,GAAW,IAA4C;EAC3E,IAAI,CAACA,GAAG,CAACI,UAAU,CAAC,SAAS,CAAC,EAAE,OAAO,IAAI;EAE3C,IAAI;AACF;AACA,IAAA,MAAMC,kBAAkB,GAAGL,GAAG,CAACM,SAAS,CAAC,CAAC,CAAC;AAE3C;IACA,MAAM,CAACC,KAAK,EAAEC,MAAM,CAAC,GAAGH,kBAAkB,CAACI,KAAK,CAAC,GAAG,CAAC;AAErD;AACA,IAAA,MAAMC,IAAI,GAAGF,MAAM,GAAG,IAAIG,eAAe,CAACH,MAAM,CAAC,CAACI,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;IAExE,OAAO;MAAEL,KAAK;AAAEG,MAAAA;KAAM;GACvB,CAAC,OAAOG,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,2BAA2B,EAAEf,GAAG,EAAEa,KAAK,CAAC;AACrD,I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D,MAAM,CAACkC,OAAO,GAAG6B,GAAI,EAAAH,KAAA,CAAA;MAAAA,KAAA,CAAAvD,SAAA,GACvBc,MAAM;MAAA6C,YAAA,CAAAJ,KAAA,EAAA,UAAA,EACP9E,GAAG,CAAA;MAAAoE,MAAA,CAAAU,KAAA,EAGTlD,QAAQ,EAAA,KAAA,EAAA,KAAA,CAAA;AAAA,MAAA,OAAAkD,KAAA;AAAA,KAAA,GAAA,GAAA,CAAA,MAAA;MAAA,IAAAK,KAAA,GAAAJ,OAAA,EAAA;MAAAC,gBAAA,CAAAG,KAAA,EAAA,OAAA,EAQHzD,OAAO,CAAA;MAAAsD,gBAAA,CAAAG,KAAA,EAAA,MAAA,EADR3C,WAAW,CAAA;MAAA2B,GAAA,CAHdc,GAAG,IAAK/D,MAAM,CAACkC,OAAO,GAAG6B,GAAI,EAAAE,KAAA,CAAA;MAAAA,KAAA,CAAA5D,SAAA,GACvBc,MAAM;MAAA6C,YAAA,CAAAC,KAAA,EAAA,KAAA,EACZnF,GAAG,CAAA;MAAAoE,MAAA,CAAAe,KAAA,EAGJvD,QAAQ,EAAA,KAAA,EAAA,KAAA,CAAA;AAAA,MAAA,OAAAuD,KAAA;KAEf,GAAA,CAAA;IAAAX,MAAA,CAAAC,GAAA,IAAAC,KAAA,CAAAC,KAAA,EAnByBnD,OAAK,EAAAiD,GAAA,CAAA,CAAA;AAAA,IAAA,OAAAE,KAAA;AAAA,GAAA,GAAA;AAsBrC;AAEA,YAAeS,yBAAyB,CAACpE,KAAK,CAAC;;;;"}
|
|
@@ -10,6 +10,17 @@ import { PickerGroup } from './picker-group.js';
|
|
|
10
10
|
// 稳定的空数组引用,避免每次渲染都创建新引用
|
|
11
11
|
const EMPTY_ARRAY = [];
|
|
12
12
|
const EMPTY_OBJECT = {};
|
|
13
|
+
// 语言映射函数
|
|
14
|
+
function getLanguageText(lang) {
|
|
15
|
+
const isEnglish = lang === 'en-US' || lang === 'en-GB';
|
|
16
|
+
return {
|
|
17
|
+
confirm: isEnglish ? 'Confirm' : '确定',
|
|
18
|
+
cancel: isEnglish ? 'Cancel' : '取消',
|
|
19
|
+
year: isEnglish ? 'Year ' : '年',
|
|
20
|
+
month: isEnglish ? 'Month ' : '月',
|
|
21
|
+
day: isEnglish ? 'Day ' : '日'
|
|
22
|
+
};
|
|
23
|
+
}
|
|
13
24
|
// 数据验证函数
|
|
14
25
|
function validateRegionData(data) {
|
|
15
26
|
let componentName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Picker';
|
|
@@ -110,14 +121,15 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
110
121
|
level = 'region',
|
|
111
122
|
regionData,
|
|
112
123
|
textProps = EMPTY_OBJECT,
|
|
124
|
+
colors = EMPTY_OBJECT,
|
|
113
125
|
onChange,
|
|
114
126
|
onColumnChange,
|
|
115
127
|
onCancel,
|
|
116
128
|
children,
|
|
117
|
-
|
|
118
|
-
|
|
129
|
+
formType,
|
|
130
|
+
lang
|
|
119
131
|
} = props,
|
|
120
|
-
restProps = __rest(props, ["mode", "disabled", "range", "rangeKey", "value", "start", "end", "fields", "headerText", "level", "regionData", "textProps", "onChange", "onColumnChange", "onCancel", "children", "
|
|
132
|
+
restProps = __rest(props, ["mode", "disabled", "range", "rangeKey", "value", "start", "end", "fields", "headerText", "level", "regionData", "textProps", "colors", "onChange", "onColumnChange", "onCancel", "children", "formType", "lang"]);
|
|
121
133
|
const indexRef = React__default.useRef([]);
|
|
122
134
|
const pickerDateRef = React__default.useRef();
|
|
123
135
|
// 记录是否是用户滚动
|
|
@@ -172,8 +184,8 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
172
184
|
} else if (mode === 'date') {
|
|
173
185
|
const val = value;
|
|
174
186
|
let _value = verifyDate(val) || new Date(new Date().setHours(0, 0, 0, 0));
|
|
175
|
-
const _start = verifyDate(start) || new Date('
|
|
176
|
-
const _end = verifyDate(end) || new Date('
|
|
187
|
+
const _start = verifyDate(start) || new Date('1875/01/01');
|
|
188
|
+
const _end = verifyDate(end) || new Date('2100/01/01');
|
|
177
189
|
if (!(_start <= _end)) {
|
|
178
190
|
throw new Error(`Picker start time must be less than end time.`);
|
|
179
191
|
}
|
|
@@ -265,15 +277,18 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
265
277
|
// 隐藏 Picker
|
|
266
278
|
const hidePicker = React__default.useCallback(() => {
|
|
267
279
|
isInitializationCompletedRef.current = false;
|
|
280
|
+
// 动画暂时不支持,暂时屏蔽相关样式挂载逻辑
|
|
281
|
+
// setState(prev => ({ ...prev, fadeOut: true }))
|
|
282
|
+
// setTimeout(() => {
|
|
283
|
+
// setState(prev => ({
|
|
284
|
+
// ...prev,
|
|
285
|
+
// hidden: true,
|
|
286
|
+
// fadeOut: false
|
|
287
|
+
// }))
|
|
288
|
+
// }, 350)
|
|
268
289
|
setState(prev => Object.assign(Object.assign({}, prev), {
|
|
269
|
-
|
|
290
|
+
hidden: true
|
|
270
291
|
}));
|
|
271
|
-
setTimeout(() => {
|
|
272
|
-
setState(prev => Object.assign(Object.assign({}, prev), {
|
|
273
|
-
hidden: true,
|
|
274
|
-
fadeOut: false
|
|
275
|
-
}));
|
|
276
|
-
}, 350);
|
|
277
292
|
}, []);
|
|
278
293
|
// 更新索引
|
|
279
294
|
const updateIndex = React__default.useCallback(function (index, columnId) {
|
|
@@ -591,7 +606,8 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
591
606
|
},
|
|
592
607
|
get selectedIndex() {
|
|
593
608
|
return state.selectedIndices[index];
|
|
594
|
-
}
|
|
609
|
+
},
|
|
610
|
+
colors: colors
|
|
595
611
|
}));
|
|
596
612
|
}
|
|
597
613
|
case 'time':
|
|
@@ -606,7 +622,8 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
606
622
|
columnId: "0",
|
|
607
623
|
get selectedIndex() {
|
|
608
624
|
return state.selectedIndices[0];
|
|
609
|
-
}
|
|
625
|
+
},
|
|
626
|
+
colors: colors
|
|
610
627
|
}), createComponent(PickerGroup, {
|
|
611
628
|
get key() {
|
|
612
629
|
return `minute-${state.timestamp}`;
|
|
@@ -617,7 +634,8 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
617
634
|
columnId: "1",
|
|
618
635
|
get selectedIndex() {
|
|
619
636
|
return state.selectedIndices[1];
|
|
620
|
-
}
|
|
637
|
+
},
|
|
638
|
+
colors: colors
|
|
621
639
|
})];
|
|
622
640
|
}
|
|
623
641
|
case 'date':
|
|
@@ -630,9 +648,11 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
630
648
|
} = pickerDateRef.current;
|
|
631
649
|
const currentYear = _updateValue[0];
|
|
632
650
|
const currentMonth = _updateValue[1];
|
|
633
|
-
const
|
|
634
|
-
const
|
|
635
|
-
const
|
|
651
|
+
const langText = getLanguageText(lang);
|
|
652
|
+
const isEnglish = lang === 'en-US' || lang === 'en-GB';
|
|
653
|
+
const yearRange = getYearRange(_start.getFullYear(), _end.getFullYear()).map(item => isEnglish ? `${langText.year}${item}` : `${item}${langText.year}`);
|
|
654
|
+
const monthRange = getMonthRange(_start, _end, currentYear).map(item => isEnglish ? `${langText.month}${item < 10 ? `0${item}` : item}` : `${item < 10 ? `0${item}` : item}${langText.month}`);
|
|
655
|
+
const dayRange = getDayRange(_start, _end, currentYear, currentMonth).map(item => isEnglish ? `${langText.day}${item < 10 ? `0${item}` : item}` : `${item < 10 ? `0${item}` : item}${langText.day}`);
|
|
636
656
|
const renderView = [createComponent(PickerGroup, {
|
|
637
657
|
key: `year`,
|
|
638
658
|
mode: "date",
|
|
@@ -642,7 +662,8 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
642
662
|
columnId: "0",
|
|
643
663
|
get selectedIndex() {
|
|
644
664
|
return state.selectedIndices[0];
|
|
645
|
-
}
|
|
665
|
+
},
|
|
666
|
+
colors: colors
|
|
646
667
|
})];
|
|
647
668
|
if (fields === 'month' || fields === 'day') {
|
|
648
669
|
renderView.push(createComponent(PickerGroup, {
|
|
@@ -654,7 +675,8 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
654
675
|
columnId: "1",
|
|
655
676
|
get selectedIndex() {
|
|
656
677
|
return state.selectedIndices[1];
|
|
657
|
-
}
|
|
678
|
+
},
|
|
679
|
+
colors: colors
|
|
658
680
|
}));
|
|
659
681
|
}
|
|
660
682
|
if (fields === 'day') {
|
|
@@ -667,7 +689,8 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
667
689
|
columnId: "2",
|
|
668
690
|
get selectedIndex() {
|
|
669
691
|
return state.selectedIndices[2];
|
|
670
|
-
}
|
|
692
|
+
},
|
|
693
|
+
colors: colors
|
|
671
694
|
}));
|
|
672
695
|
}
|
|
673
696
|
return renderView;
|
|
@@ -706,7 +729,8 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
706
729
|
},
|
|
707
730
|
get selectedIndex() {
|
|
708
731
|
return state.selectedIndices[i];
|
|
709
|
-
}
|
|
732
|
+
},
|
|
733
|
+
colors: colors
|
|
710
734
|
}));
|
|
711
735
|
}
|
|
712
736
|
return columns;
|
|
@@ -719,10 +743,11 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
719
743
|
columnId: "0",
|
|
720
744
|
get selectedIndex() {
|
|
721
745
|
return state.selectedIndices[0];
|
|
722
|
-
}
|
|
746
|
+
},
|
|
747
|
+
colors: colors
|
|
723
748
|
});
|
|
724
749
|
}
|
|
725
|
-
}, [mode, range, rangeKey, fields, updateIndex, updateDay, handleColumnChange, pickerDateRef.current, level, regionData, state.selectedIndices, columnsCount]);
|
|
750
|
+
}, [mode, range, rangeKey, fields, updateIndex, updateDay, handleColumnChange, pickerDateRef.current, level, regionData, state.selectedIndices, columnsCount, lang, colors]);
|
|
726
751
|
// 动画类名控制逻辑
|
|
727
752
|
const clsMask = classNames('taro-picker__mask-overlay', 'taro-picker__animate-fade-in', {
|
|
728
753
|
'taro-picker__animate-fade-out': state.fadeOut
|
|
@@ -735,15 +760,16 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
735
760
|
showPicker,
|
|
736
761
|
hidePicker
|
|
737
762
|
}));
|
|
763
|
+
// 获取语言文本
|
|
764
|
+
const langText = getLanguageText(lang);
|
|
738
765
|
return createComponent(View, mergeProps({
|
|
739
766
|
ref(r$) {
|
|
740
767
|
var _ref$ = ref;
|
|
741
768
|
typeof _ref$ === "function" ? _ref$(r$) : ref = r$;
|
|
742
|
-
}
|
|
743
|
-
style: style
|
|
769
|
+
}
|
|
744
770
|
}, formType ? {
|
|
745
771
|
'data-form-type': formType
|
|
746
|
-
} : {}, () => omit(restProps, ['mode', 'disabled', 'range', 'rangeKey', 'value', 'start', 'end', 'fields', 'name', 'textProps', 'onChange', 'onColumnChange', 'onCancel', 'children', '
|
|
772
|
+
} : {}, () => omit(restProps, ['mode', 'disabled', 'range', 'rangeKey', 'value', 'start', 'end', 'fields', 'name', 'textProps', 'onChange', 'onColumnChange', 'onCancel', 'children', 'formType']), {
|
|
747
773
|
get children() {
|
|
748
774
|
return [createComponent(View, {
|
|
749
775
|
onClick: showPicker,
|
|
@@ -763,8 +789,13 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
763
789
|
return [createComponent(View, {
|
|
764
790
|
className: "taro-picker__action",
|
|
765
791
|
onClick: handleCancel,
|
|
792
|
+
get style() {
|
|
793
|
+
return {
|
|
794
|
+
color: colors.cancelButtonColor
|
|
795
|
+
};
|
|
796
|
+
},
|
|
766
797
|
get children() {
|
|
767
|
-
return (_a = textProps.cancelText) !== null && _a !== void 0 ? _a :
|
|
798
|
+
return (_a = textProps.cancelText) !== null && _a !== void 0 ? _a : langText.cancel;
|
|
768
799
|
}
|
|
769
800
|
}), memo(() => headerText && createComponent(View, {
|
|
770
801
|
className: "taro-picker__title",
|
|
@@ -772,8 +803,13 @@ const Picker = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
772
803
|
})), createComponent(View, {
|
|
773
804
|
className: "taro-picker__action",
|
|
774
805
|
onClick: handleChange,
|
|
806
|
+
get style() {
|
|
807
|
+
return {
|
|
808
|
+
color: colors.confirmButtonColor
|
|
809
|
+
};
|
|
810
|
+
},
|
|
775
811
|
get children() {
|
|
776
|
-
return (_b = textProps.okText) !== null && _b !== void 0 ? _b :
|
|
812
|
+
return (_b = textProps.okText) !== null && _b !== void 0 ? _b : langText.confirm;
|
|
777
813
|
}
|
|
778
814
|
})];
|
|
779
815
|
}
|