diff --git a/package.json b/package.json index 93b0524..0c33aba 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "jsbn": "^1.1.0", "jsencrypt": "^3.3.2", "lodash": "^4.17.21", + "marked": "4.x", "pinia-plugin-unistorage": "^0.1.2", "to-arraybuffer": "^1.0.1", "uview-plus": "^3.3.32", diff --git a/pageMarket/superVip/vip-lv-add.vue b/pageMarket/superVip/vip-lv-add.vue index 726ea0e..82a972a 100644 --- a/pageMarket/superVip/vip-lv-add.vue +++ b/pageMarket/superVip/vip-lv-add.vue @@ -132,7 +132,6 @@ import CouponList from "./components/coupon-list.vue"; import { ref, onMounted, watch, reactive, computed } from "vue"; import { useSuperVipStore } from "@/store/market.js"; import * as memberApi from "@/http/api/market/member.js"; -import { options } from "../../../cashier_wx/uni_modules/uview-plus/components/u-markdown/marked.esm"; const times = [ { diff --git a/pages.json b/pages.json index ef1e0b7..e5286ab 100644 --- a/pages.json +++ b/pages.json @@ -70,6 +70,13 @@ "navigationBarTitleText": "全部操作" } }, + { + "path": "pages/permission/secondary_page", + "pageId": "PAGES_SECONDARY_PAGE", + "style": { + "navigationBarTitleText": "更多操作" + } + }, { "path": "pages/shopSetUp/decoration", "pageId": "PAGES_DECORATION", @@ -390,35 +397,35 @@ { "root": "pageSalesSummary", "pages": [{ - "pageId": "PAGES_DATA_SUMMARY", - "path": "index", - "style": { - "navigationBarTitleText": "数据统计" + "pageId": "PAGES_DATA_SUMMARY", + "path": "index", + "style": { + "navigationBarTitleText": "数据统计" + } + }, + { + "pageId": "PAGES_SALES_SUMMARY", + "path": "sales", + "style": { + "navigationBarTitleText": "销量统计" + } + }, + { + "pageId": "PAGES_PRODUCT_SALES_RANKING", + "path": "productSalesRanking", + "style": { + "navigationBarTitleText": "商品销售排行" + } + }, + { + "pageId": "PAGES_TABLE_SALES_RANKING", + "path": "table", + "style": { + "navigationBarTitleText": "桌台统计" + } } - }, - { - "pageId": "PAGES_SALES_SUMMARY", - "path": "sales", - "style": { - "navigationBarTitleText": "销量统计" - } - }, - { - "pageId": "PAGES_PRODUCT_SALES_RANKING", - "path": "productSalesRanking", - "style": { - "navigationBarTitleText": "商品销售排行" - } - }, - { - "pageId": "PAGES_TABLE_SALES_RANKING", - "path": "table", - "style": { - "navigationBarTitleText": "桌台统计" - } - } - - ] + + ] }, { "root": "pageLineUp", diff --git a/pages/permission/permission.vue b/pages/permission/permission.vue index d83b0eb..501f9f3 100644 --- a/pages/permission/permission.vue +++ b/pages/permission/permission.vue @@ -7,25 +7,21 @@ --> - - - {{item.title}} + + + {{ item.title }} - + - - - {{item.title}} + + + {{ item.title }} - + - {{item1.title}} + {{ item1.title }} @@ -35,125 +31,137 @@ \ No newline at end of file +.item-menu-image { + width: 94rpx; + height: 94rpx; +} + diff --git a/pages/permission/secondary_page.vue b/pages/permission/secondary_page.vue new file mode 100644 index 0000000..0b778a7 --- /dev/null +++ b/pages/permission/secondary_page.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7a3a632..2688639 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,781 +1,244 @@ -lockfileVersion: '9.0' +lockfileVersion: '6.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false -importers: +dependencies: + bignumber.js: + specifier: ^9.3.1 + version: 9.3.1 + clipboard: + specifier: ^2.0.11 + version: 2.0.11 + dayjs: + specifier: ^1.11.13 + version: 1.11.19 + gm-crypto: + specifier: ^0.1.8 + version: 0.1.12 + immutable: + specifier: ^4.3.7 + version: 4.3.7 + js-base64: + specifier: ^3.7.2 + version: 3.7.8 + jsbn: + specifier: ^1.1.0 + version: 1.1.0 + jsencrypt: + specifier: ^3.3.2 + version: 3.5.4 + lodash: + specifier: ^4.17.21 + version: 4.17.21 + marked: + specifier: 4.x + version: 4.3.0 + pinia-plugin-unistorage: + specifier: ^0.1.2 + version: 0.1.2 + to-arraybuffer: + specifier: ^1.0.1 + version: 1.0.1 + uview-plus: + specifier: ^3.3.32 + version: 3.6.18 + ysk-utils: + specifier: ^1.0.78 + version: 1.0.78 - .: - dependencies: - bignumber.js: - specifier: ^9.3.1 - version: 9.3.1 - clipboard: - specifier: ^2.0.11 - version: 2.0.11 - dayjs: - specifier: ^1.11.13 - version: 1.11.19 - gm-crypto: - specifier: ^0.1.8 - version: 0.1.12 - immutable: - specifier: ^4.3.7 - version: 4.3.7 - js-base64: - specifier: ^3.7.2 - version: 3.7.8 - jsbn: - specifier: ^1.1.0 - version: 1.1.0 - jsencrypt: - specifier: ^3.3.2 - version: 3.5.4 - lodash: - specifier: ^4.17.21 - version: 4.17.21 - pinia-plugin-unistorage: - specifier: ^0.1.2 - version: 0.1.2 - to-arraybuffer: - specifier: ^1.0.1 - version: 1.0.1 - uview-plus: - specifier: ^3.3.32 - version: 3.6.15 - ysk-utils: - specifier: ^1.0.78 - version: 1.0.78 - devDependencies: - copy-webpack-plugin: - specifier: ^12.0.2 - version: 12.0.2(webpack@5.102.1) - sass: - specifier: ^1.78.0 - version: 1.94.0 - sass-loader: - specifier: ^10.5.2 - version: 10.5.2(sass@1.94.0)(webpack@5.102.1) +devDependencies: + copy-webpack-plugin: + specifier: ^12.0.2 + version: 12.0.2(webpack@5.103.0) + sass: + specifier: ^1.78.0 + version: 1.94.2 + sass-loader: + specifier: ^10.5.2 + version: 10.5.2(sass@1.94.2)(webpack@5.103.0) packages: - '@jridgewell/gen-mapping@0.3.13': + /@jridgewell/gen-mapping@0.3.13: resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + '@jridgewell/trace-mapping': 0.3.31 + dev: true - '@jridgewell/resolve-uri@3.1.2': + /@jridgewell/resolve-uri@3.1.2: resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} + dev: true - '@jridgewell/source-map@0.3.11': + /@jridgewell/source-map@0.3.11: resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==} + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + dev: true - '@jridgewell/sourcemap-codec@1.5.5': + /@jridgewell/sourcemap-codec@1.5.5: resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} + dev: true - '@jridgewell/trace-mapping@0.3.31': + /@jridgewell/trace-mapping@0.3.31: resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.5 + dev: true - '@nodelib/fs.scandir@2.1.5': + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + dev: true - '@nodelib/fs.stat@2.0.5': + /@nodelib/fs.stat@2.0.5: resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} engines: {node: '>= 8'} + dev: true - '@nodelib/fs.walk@1.2.8': + /@nodelib/fs.walk@1.2.8: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.19.1 + dev: true - '@parcel/watcher-android-arm64@2.5.1': + /@parcel/watcher-android-arm64@2.5.1: resolution: {integrity: sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [android] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-darwin-arm64@2.5.1': + /@parcel/watcher-darwin-arm64@2.5.1: resolution: {integrity: sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [darwin] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-darwin-x64@2.5.1': + /@parcel/watcher-darwin-x64@2.5.1: resolution: {integrity: sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [darwin] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-freebsd-x64@2.5.1': + /@parcel/watcher-freebsd-x64@2.5.1: resolution: {integrity: sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [freebsd] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-linux-arm-glibc@2.5.1': + /@parcel/watcher-linux-arm-glibc@2.5.1: resolution: {integrity: sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==} engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] + libc: [glibc] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-linux-arm-musl@2.5.1': + /@parcel/watcher-linux-arm-musl@2.5.1: resolution: {integrity: sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==} engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] + libc: [musl] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-linux-arm64-glibc@2.5.1': + /@parcel/watcher-linux-arm64-glibc@2.5.1: resolution: {integrity: sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] + libc: [glibc] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-linux-arm64-musl@2.5.1': + /@parcel/watcher-linux-arm64-musl@2.5.1: resolution: {integrity: sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] + libc: [musl] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-linux-x64-glibc@2.5.1': + /@parcel/watcher-linux-x64-glibc@2.5.1: resolution: {integrity: sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] + libc: [glibc] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-linux-x64-musl@2.5.1': + /@parcel/watcher-linux-x64-musl@2.5.1: resolution: {integrity: sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] + libc: [musl] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-win32-arm64@2.5.1': + /@parcel/watcher-win32-arm64@2.5.1: resolution: {integrity: sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [win32] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-win32-ia32@2.5.1': + /@parcel/watcher-win32-ia32@2.5.1: resolution: {integrity: sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==} engines: {node: '>= 10.0.0'} cpu: [ia32] os: [win32] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher-win32-x64@2.5.1': + /@parcel/watcher-win32-x64@2.5.1: resolution: {integrity: sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [win32] + requiresBuild: true + dev: true + optional: true - '@parcel/watcher@2.5.1': + /@parcel/watcher@2.5.1: resolution: {integrity: sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==} engines: {node: '>= 10.0.0'} - - '@sindresorhus/merge-streams@2.3.0': - resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} - engines: {node: '>=18'} - - '@types/eslint-scope@3.7.7': - resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==} - - '@types/eslint@9.6.1': - resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==} - - '@types/estree@1.0.8': - resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} - - '@types/json-schema@7.0.15': - resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - - '@types/node@24.10.1': - resolution: {integrity: sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==} - - '@webassemblyjs/ast@1.14.1': - resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} - - '@webassemblyjs/floating-point-hex-parser@1.13.2': - resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==} - - '@webassemblyjs/helper-api-error@1.13.2': - resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==} - - '@webassemblyjs/helper-buffer@1.14.1': - resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==} - - '@webassemblyjs/helper-numbers@1.13.2': - resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==} - - '@webassemblyjs/helper-wasm-bytecode@1.13.2': - resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==} - - '@webassemblyjs/helper-wasm-section@1.14.1': - resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==} - - '@webassemblyjs/ieee754@1.13.2': - resolution: {integrity: sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==} - - '@webassemblyjs/leb128@1.13.2': - resolution: {integrity: sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==} - - '@webassemblyjs/utf8@1.13.2': - resolution: {integrity: sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==} - - '@webassemblyjs/wasm-edit@1.14.1': - resolution: {integrity: sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==} - - '@webassemblyjs/wasm-gen@1.14.1': - resolution: {integrity: sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==} - - '@webassemblyjs/wasm-opt@1.14.1': - resolution: {integrity: sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==} - - '@webassemblyjs/wasm-parser@1.14.1': - resolution: {integrity: sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==} - - '@webassemblyjs/wast-printer@1.14.1': - resolution: {integrity: sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==} - - '@xtuc/ieee754@1.2.0': - resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} - - '@xtuc/long@4.2.2': - resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} - - acorn-import-phases@1.0.4: - resolution: {integrity: sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==} - engines: {node: '>=10.13.0'} - peerDependencies: - acorn: ^8.14.0 - - acorn@8.15.0: - resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==} - engines: {node: '>=0.4.0'} - hasBin: true - - ajv-formats@2.1.1: - resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} - peerDependencies: - ajv: ^8.0.0 - peerDependenciesMeta: - ajv: - optional: true - - ajv-keywords@3.5.2: - resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==} - peerDependencies: - ajv: ^6.9.1 - - ajv-keywords@5.1.0: - resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==} - peerDependencies: - ajv: ^8.8.2 - - ajv@6.12.6: - resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} - - ajv@8.17.1: - resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==} - - base64-js@1.5.1: - resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - - baseline-browser-mapping@2.8.29: - resolution: {integrity: sha512-sXdt2elaVnhpDNRDz+1BDx1JQoJRuNk7oVlAlbGiFkLikHCAQiccexF/9e91zVi6RCgqspl04aP+6Cnl9zRLrA==} - hasBin: true - - big.js@5.2.2: - resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} - - bignumber.js@9.3.1: - resolution: {integrity: sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==} - - braces@3.0.3: - resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} - engines: {node: '>=8'} - - browserslist@4.28.0: - resolution: {integrity: sha512-tbydkR/CxfMwelN0vwdP/pLkDwyAASZ+VfWm4EOwlB6SWhx1sYnWLqo8N5j0rAzPfzfRaxt0mM/4wPU/Su84RQ==} - engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} - hasBin: true - - buffer-from@1.1.2: - resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - - buffer@5.7.1: - resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} - - caniuse-lite@1.0.30001755: - resolution: {integrity: sha512-44V+Jm6ctPj7R52Na4TLi3Zri4dWUljJd+RDm+j8LtNCc/ihLCT+X1TzoOAkRETEWqjuLnh9581Tl80FvK7jVA==} - - chokidar@4.0.3: - resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} - engines: {node: '>= 14.16.0'} - - chrome-trace-event@1.0.4: - resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} - engines: {node: '>=6.0'} - - clipboard@2.0.11: - resolution: {integrity: sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==} - - commander@2.20.3: - resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} - - copy-webpack-plugin@12.0.2: - resolution: {integrity: sha512-SNwdBeHyII+rWvee/bTnAYyO8vfVdcSTud4EIb6jcZ8inLeWucJE0DnxXQBjlQ5zlteuuvooGQy3LIyGxhvlOA==} - engines: {node: '>= 18.12.0'} - peerDependencies: - webpack: ^5.1.0 - - dayjs@1.11.19: - resolution: {integrity: sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==} - - delegate@3.2.0: - resolution: {integrity: sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==} - - detect-libc@1.0.3: - resolution: {integrity: sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==} - engines: {node: '>=0.10'} - hasBin: true - - electron-to-chromium@1.5.255: - resolution: {integrity: sha512-Z9oIp4HrFF/cZkDPMpz2XSuVpc1THDpT4dlmATFlJUIBVCy9Vap5/rIXsASP1CscBacBqhabwh8vLctqBwEerQ==} - - emojis-list@3.0.0: - resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} - engines: {node: '>= 4'} - - enhanced-resolve@5.18.3: - resolution: {integrity: sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==} - engines: {node: '>=10.13.0'} - - es-module-lexer@1.7.0: - resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} - - escalade@3.2.0: - resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} - engines: {node: '>=6'} - - eslint-scope@5.1.1: - resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} - engines: {node: '>=8.0.0'} - - esrecurse@4.3.0: - resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} - engines: {node: '>=4.0'} - - estraverse@4.3.0: - resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} - engines: {node: '>=4.0'} - - estraverse@5.3.0: - resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} - engines: {node: '>=4.0'} - - events@3.3.0: - resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} - engines: {node: '>=0.8.x'} - - fast-deep-equal@3.1.3: - resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - - fast-glob@3.3.3: - resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} - engines: {node: '>=8.6.0'} - - fast-json-stable-stringify@2.1.0: - resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - - fast-uri@3.1.0: - resolution: {integrity: sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==} - - fastq@1.19.1: - resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} - - fill-range@7.1.1: - resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} - engines: {node: '>=8'} - - glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - - glob-parent@6.0.2: - resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} - engines: {node: '>=10.13.0'} - - glob-to-regexp@0.4.1: - resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} - - globby@14.1.0: - resolution: {integrity: sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==} - engines: {node: '>=18'} - - gm-crypto@0.1.12: - resolution: {integrity: sha512-ercd9ionBqxR+/FCXICr0eo+jzC8BvSK0j9L7/eB0uwbyjgeMPTdBNrcQTqIuRXOtOAKSGsTNvtLYFnIxNEoFg==} - - good-listener@1.2.2: - resolution: {integrity: sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==} - - graceful-fs@4.2.11: - resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - - has-flag@4.0.0: - resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} - engines: {node: '>=8'} - - ieee754@1.2.1: - resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} - - ignore@7.0.5: - resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} - engines: {node: '>= 4'} - - immutable@4.3.7: - resolution: {integrity: sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==} - - immutable@5.1.4: - resolution: {integrity: sha512-p6u1bG3YSnINT5RQmx/yRZBpenIl30kVxkTLDyHLIMk0gict704Q9n+thfDI7lTRm9vXdDYutVzXhzcThxTnXA==} - - is-extglob@2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - - is-glob@4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} - - is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - - jest-worker@27.5.1: - resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} - engines: {node: '>= 10.13.0'} - - js-base64@3.7.8: - resolution: {integrity: sha512-hNngCeKxIUQiEUN3GPJOkz4wF/YvdUdbNL9hsBcMQTkKzboD7T/q3OYOuuPZLUE6dBxSGpwhk5mwuDud7JVAow==} - - jsbn@1.1.0: - resolution: {integrity: sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==} - - jsencrypt@3.5.4: - resolution: {integrity: sha512-kNjfYEMNASxrDGsmcSQh/rUTmcoRfSUkxnAz+MMywM8jtGu+fFEZ3nJjHM58zscVnwR0fYmG9sGkTDjqUdpiwA==} - - json-parse-even-better-errors@2.3.1: - resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} - - json-schema-traverse@0.4.1: - resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} - - json-schema-traverse@1.0.0: - resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - - json5@2.2.3: - resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} - engines: {node: '>=6'} - hasBin: true - - klona@2.0.6: - resolution: {integrity: sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==} - engines: {node: '>= 8'} - - loader-runner@4.3.1: - resolution: {integrity: sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==} - engines: {node: '>=6.11.5'} - - loader-utils@2.0.4: - resolution: {integrity: sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==} - engines: {node: '>=8.9.0'} - - loadsh@0.0.4: - resolution: {integrity: sha512-U+wLL8InpfRalWrr+0SuhWgGt10M4OyAk6G8xCYo2rwpiHtxZkWiFpjei0vO463ghW8LPCdhqQxXlMy2qicAEw==} - deprecated: This is a typosquat on the popular Lodash package. This is not maintained nor is the original Lodash package. - - lodash@4.17.21: - resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - - merge-stream@2.0.0: - resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} - - merge2@1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - - micromatch@4.0.8: - resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} - engines: {node: '>=8.6'} - - mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - - mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - - neo-async@2.6.2: - resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} - - node-addon-api@7.1.1: - resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==} - - node-releases@2.0.27: - resolution: {integrity: sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==} - - normalize-path@3.0.0: - resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} - engines: {node: '>=0.10.0'} - - path-type@6.0.0: - resolution: {integrity: sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==} - engines: {node: '>=18'} - - picocolors@1.1.1: - resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} - - picomatch@2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} - - pinia-plugin-unistorage@0.1.2: - resolution: {integrity: sha512-WXit2cGnm5rG6CDTcLSLehNWhyJS/Yq7WEeeXAapZbCnqoPJxlszqg7rT8S+OP47az0h5nlajGo+LuyMxUQ2uw==} - - punycode@2.3.1: - resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} - engines: {node: '>=6'} - - queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - - randombytes@2.1.0: - resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} - - readdirp@4.1.2: - resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} - engines: {node: '>= 14.18.0'} - - require-from-string@2.0.2: - resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} - engines: {node: '>=0.10.0'} - - reusify@1.1.0: - resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - - run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - - safe-buffer@5.2.1: - resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - - sass-loader@10.5.2: - resolution: {integrity: sha512-vMUoSNOUKJILHpcNCCyD23X34gve1TS7Rjd9uXHeKqhvBG39x6XbswFDtpbTElj6XdMFezoWhkh5vtKudf2cgQ==} - engines: {node: '>= 10.13.0'} - peerDependencies: - fibers: '>= 3.1.0' - node-sass: ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 - sass: ^1.3.0 - webpack: ^4.36.0 || ^5.0.0 - peerDependenciesMeta: - fibers: - optional: true - node-sass: - optional: true - sass: - optional: true - - sass@1.94.0: - resolution: {integrity: sha512-Dqh7SiYcaFtdv5Wvku6QgS5IGPm281L+ZtVD1U2FJa7Q0EFRlq8Z3sjYtz6gYObsYThUOz9ArwFqPZx+1azILQ==} - engines: {node: '>=14.0.0'} - hasBin: true - - schema-utils@3.3.0: - resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==} - engines: {node: '>= 10.13.0'} - - schema-utils@4.3.3: - resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} - engines: {node: '>= 10.13.0'} - - select@1.1.2: - resolution: {integrity: sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA==} - - semver@7.7.3: - resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==} - engines: {node: '>=10'} - hasBin: true - - serialize-javascript@6.0.2: - resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} - - slash@5.1.0: - resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} - engines: {node: '>=14.16'} - - source-map-js@1.2.1: - resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} - engines: {node: '>=0.10.0'} - - source-map-support@0.5.21: - resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} - - source-map@0.6.1: - resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} - engines: {node: '>=0.10.0'} - - supports-color@8.1.1: - resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} - engines: {node: '>=10'} - - tapable@2.3.0: - resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} - engines: {node: '>=6'} - - terser-webpack-plugin@5.3.14: - resolution: {integrity: sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==} - engines: {node: '>= 10.13.0'} - peerDependencies: - '@swc/core': '*' - esbuild: '*' - uglify-js: '*' - webpack: ^5.1.0 - peerDependenciesMeta: - '@swc/core': - optional: true - esbuild: - optional: true - uglify-js: - optional: true - - terser@5.44.1: - resolution: {integrity: sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw==} - engines: {node: '>=10'} - hasBin: true - - tiny-emitter@2.1.0: - resolution: {integrity: sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==} - - to-arraybuffer@1.0.1: - resolution: {integrity: sha512-okFlQcoGTi4LQBG/PgSYblw9VOyptsz2KJZqc6qtgGdes8VktzUQkj4BI2blit072iS8VODNcMA+tvnS9dnuMA==} - - to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - - undici-types@7.16.0: - resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==} - - unicorn-magic@0.3.0: - resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} - engines: {node: '>=18'} - - update-browserslist-db@1.1.4: - resolution: {integrity: sha512-q0SPT4xyU84saUX+tomz1WLkxUbuaJnR1xWt17M7fJtEJigJeWUNGUqrauFXsHnqev9y9JTRGwk13tFBuKby4A==} - hasBin: true - peerDependencies: - browserslist: '>= 4.21.0' - - uri-js@4.4.1: - resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - - uview-plus@3.6.15: - resolution: {integrity: sha512-HcwI5eJV3UhBnhogQ6UxelM7m5UhEWOK/vUVdtQDTkGWB2biMKu8ovpEo8JsLpSZpZ880ZgvHvMeeTJaiIYjEg==} - engines: {HBuilderX: ^3.1.0, uni-app: ^4.66, uni-app-x: ''} - - watchpack@2.4.4: - resolution: {integrity: sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==} - engines: {node: '>=10.13.0'} - - webpack-sources@3.3.3: - resolution: {integrity: sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==} - engines: {node: '>=10.13.0'} - - webpack@5.102.1: - resolution: {integrity: sha512-7h/weGm9d/ywQ6qzJ+Xy+r9n/3qgp/thalBbpOi5i223dPXKi04IBtqPN9nTd+jBc7QKfvDbaBnFipYp4sJAUQ==} - engines: {node: '>=10.13.0'} - hasBin: true - peerDependencies: - webpack-cli: '*' - peerDependenciesMeta: - webpack-cli: - optional: true - - ysk-utils@1.0.78: - resolution: {integrity: sha512-Bgr5B3WWiy0nbgL91QVKoVPYm4wt13Rlav757zEjMVRHbmTjwFEhi3wJlYus0JGd52mbknSxXHMazAPHXwA7uQ==} - -snapshots: - - '@jridgewell/gen-mapping@0.3.13': - dependencies: - '@jridgewell/sourcemap-codec': 1.5.5 - '@jridgewell/trace-mapping': 0.3.31 - - '@jridgewell/resolve-uri@3.1.2': {} - - '@jridgewell/source-map@0.3.11': - dependencies: - '@jridgewell/gen-mapping': 0.3.13 - '@jridgewell/trace-mapping': 0.3.31 - - '@jridgewell/sourcemap-codec@1.5.5': {} - - '@jridgewell/trace-mapping@0.3.31': - dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.5 - - '@nodelib/fs.scandir@2.1.5': - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - - '@nodelib/fs.stat@2.0.5': {} - - '@nodelib/fs.walk@1.2.8': - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.19.1 - - '@parcel/watcher-android-arm64@2.5.1': - optional: true - - '@parcel/watcher-darwin-arm64@2.5.1': - optional: true - - '@parcel/watcher-darwin-x64@2.5.1': - optional: true - - '@parcel/watcher-freebsd-x64@2.5.1': - optional: true - - '@parcel/watcher-linux-arm-glibc@2.5.1': - optional: true - - '@parcel/watcher-linux-arm-musl@2.5.1': - optional: true - - '@parcel/watcher-linux-arm64-glibc@2.5.1': - optional: true - - '@parcel/watcher-linux-arm64-musl@2.5.1': - optional: true - - '@parcel/watcher-linux-x64-glibc@2.5.1': - optional: true - - '@parcel/watcher-linux-x64-musl@2.5.1': - optional: true - - '@parcel/watcher-win32-arm64@2.5.1': - optional: true - - '@parcel/watcher-win32-ia32@2.5.1': - optional: true - - '@parcel/watcher-win32-x64@2.5.1': - optional: true - - '@parcel/watcher@2.5.1': + requiresBuild: true dependencies: detect-libc: 1.0.3 is-glob: 4.0.3 @@ -795,65 +258,100 @@ snapshots: '@parcel/watcher-win32-arm64': 2.5.1 '@parcel/watcher-win32-ia32': 2.5.1 '@parcel/watcher-win32-x64': 2.5.1 + dev: true optional: true - '@sindresorhus/merge-streams@2.3.0': {} + /@sindresorhus/merge-streams@2.3.0: + resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} + engines: {node: '>=18'} + dev: true - '@types/eslint-scope@3.7.7': + /@types/eslint-scope@3.7.7: + resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==} dependencies: '@types/eslint': 9.6.1 '@types/estree': 1.0.8 + dev: true - '@types/eslint@9.6.1': + /@types/eslint@9.6.1: + resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==} dependencies: '@types/estree': 1.0.8 '@types/json-schema': 7.0.15 + dev: true - '@types/estree@1.0.8': {} + /@types/estree@1.0.8: + resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} + dev: true - '@types/json-schema@7.0.15': {} + /@types/json-schema@7.0.15: + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + dev: true - '@types/node@24.10.1': + /@types/node@24.10.1: + resolution: {integrity: sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==} dependencies: undici-types: 7.16.0 + dev: true - '@webassemblyjs/ast@1.14.1': + /@webassemblyjs/ast@1.14.1: + resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} dependencies: '@webassemblyjs/helper-numbers': 1.13.2 '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + dev: true - '@webassemblyjs/floating-point-hex-parser@1.13.2': {} + /@webassemblyjs/floating-point-hex-parser@1.13.2: + resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==} + dev: true - '@webassemblyjs/helper-api-error@1.13.2': {} + /@webassemblyjs/helper-api-error@1.13.2: + resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==} + dev: true - '@webassemblyjs/helper-buffer@1.14.1': {} + /@webassemblyjs/helper-buffer@1.14.1: + resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==} + dev: true - '@webassemblyjs/helper-numbers@1.13.2': + /@webassemblyjs/helper-numbers@1.13.2: + resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==} dependencies: '@webassemblyjs/floating-point-hex-parser': 1.13.2 '@webassemblyjs/helper-api-error': 1.13.2 '@xtuc/long': 4.2.2 + dev: true - '@webassemblyjs/helper-wasm-bytecode@1.13.2': {} + /@webassemblyjs/helper-wasm-bytecode@1.13.2: + resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==} + dev: true - '@webassemblyjs/helper-wasm-section@1.14.1': + /@webassemblyjs/helper-wasm-section@1.14.1: + resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==} dependencies: '@webassemblyjs/ast': 1.14.1 '@webassemblyjs/helper-buffer': 1.14.1 '@webassemblyjs/helper-wasm-bytecode': 1.13.2 '@webassemblyjs/wasm-gen': 1.14.1 + dev: true - '@webassemblyjs/ieee754@1.13.2': + /@webassemblyjs/ieee754@1.13.2: + resolution: {integrity: sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==} dependencies: '@xtuc/ieee754': 1.2.0 + dev: true - '@webassemblyjs/leb128@1.13.2': + /@webassemblyjs/leb128@1.13.2: + resolution: {integrity: sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==} dependencies: '@xtuc/long': 4.2.2 + dev: true - '@webassemblyjs/utf8@1.13.2': {} + /@webassemblyjs/utf8@1.13.2: + resolution: {integrity: sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==} + dev: true - '@webassemblyjs/wasm-edit@1.14.1': + /@webassemblyjs/wasm-edit@1.14.1: + resolution: {integrity: sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==} dependencies: '@webassemblyjs/ast': 1.14.1 '@webassemblyjs/helper-buffer': 1.14.1 @@ -863,23 +361,29 @@ snapshots: '@webassemblyjs/wasm-opt': 1.14.1 '@webassemblyjs/wasm-parser': 1.14.1 '@webassemblyjs/wast-printer': 1.14.1 + dev: true - '@webassemblyjs/wasm-gen@1.14.1': + /@webassemblyjs/wasm-gen@1.14.1: + resolution: {integrity: sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==} dependencies: '@webassemblyjs/ast': 1.14.1 '@webassemblyjs/helper-wasm-bytecode': 1.13.2 '@webassemblyjs/ieee754': 1.13.2 '@webassemblyjs/leb128': 1.13.2 '@webassemblyjs/utf8': 1.13.2 + dev: true - '@webassemblyjs/wasm-opt@1.14.1': + /@webassemblyjs/wasm-opt@1.14.1: + resolution: {integrity: sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==} dependencies: '@webassemblyjs/ast': 1.14.1 '@webassemblyjs/helper-buffer': 1.14.1 '@webassemblyjs/wasm-gen': 1.14.1 '@webassemblyjs/wasm-parser': 1.14.1 + dev: true - '@webassemblyjs/wasm-parser@1.14.1': + /@webassemblyjs/wasm-parser@1.14.1: + resolution: {integrity: sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==} dependencies: '@webassemblyjs/ast': 1.14.1 '@webassemblyjs/helper-api-error': 1.13.2 @@ -887,93 +391,164 @@ snapshots: '@webassemblyjs/ieee754': 1.13.2 '@webassemblyjs/leb128': 1.13.2 '@webassemblyjs/utf8': 1.13.2 + dev: true - '@webassemblyjs/wast-printer@1.14.1': + /@webassemblyjs/wast-printer@1.14.1: + resolution: {integrity: sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==} dependencies: '@webassemblyjs/ast': 1.14.1 '@xtuc/long': 4.2.2 + dev: true - '@xtuc/ieee754@1.2.0': {} + /@xtuc/ieee754@1.2.0: + resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} + dev: true - '@xtuc/long@4.2.2': {} + /@xtuc/long@4.2.2: + resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} + dev: true - acorn-import-phases@1.0.4(acorn@8.15.0): + /acorn-import-phases@1.0.4(acorn@8.15.0): + resolution: {integrity: sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==} + engines: {node: '>=10.13.0'} + peerDependencies: + acorn: ^8.14.0 dependencies: acorn: 8.15.0 + dev: true - acorn@8.15.0: {} + /acorn@8.15.0: + resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true - ajv-formats@2.1.1(ajv@8.17.1): - optionalDependencies: + /ajv-formats@2.1.1(ajv@8.17.1): + resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + dependencies: ajv: 8.17.1 + dev: true - ajv-keywords@3.5.2(ajv@6.12.6): + /ajv-keywords@3.5.2(ajv@6.12.6): + resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==} + peerDependencies: + ajv: ^6.9.1 dependencies: ajv: 6.12.6 + dev: true - ajv-keywords@5.1.0(ajv@8.17.1): + /ajv-keywords@5.1.0(ajv@8.17.1): + resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==} + peerDependencies: + ajv: ^8.8.2 dependencies: ajv: 8.17.1 fast-deep-equal: 3.1.3 + dev: true - ajv@6.12.6: + /ajv@6.12.6: + resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: fast-deep-equal: 3.1.3 fast-json-stable-stringify: 2.1.0 json-schema-traverse: 0.4.1 uri-js: 4.4.1 + dev: true - ajv@8.17.1: + /ajv@8.17.1: + resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==} dependencies: fast-deep-equal: 3.1.3 fast-uri: 3.1.0 json-schema-traverse: 1.0.0 require-from-string: 2.0.2 + dev: true - base64-js@1.5.1: {} + /base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + dev: false - baseline-browser-mapping@2.8.29: {} + /baseline-browser-mapping@2.8.32: + resolution: {integrity: sha512-OPz5aBThlyLFgxyhdwf/s2+8ab3OvT7AdTNvKHBwpXomIYeXqpUUuT8LrdtxZSsWJ4R4CU1un4XGh5Ez3nlTpw==} + hasBin: true + dev: true - big.js@5.2.2: {} + /big.js@5.2.2: + resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} + dev: true - bignumber.js@9.3.1: {} + /bignumber.js@9.3.1: + resolution: {integrity: sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==} + dev: false - braces@3.0.3: + /braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} dependencies: fill-range: 7.1.1 + dev: true - browserslist@4.28.0: + /browserslist@4.28.0: + resolution: {integrity: sha512-tbydkR/CxfMwelN0vwdP/pLkDwyAASZ+VfWm4EOwlB6SWhx1sYnWLqo8N5j0rAzPfzfRaxt0mM/4wPU/Su84RQ==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true dependencies: - baseline-browser-mapping: 2.8.29 - caniuse-lite: 1.0.30001755 - electron-to-chromium: 1.5.255 + baseline-browser-mapping: 2.8.32 + caniuse-lite: 1.0.30001757 + electron-to-chromium: 1.5.263 node-releases: 2.0.27 update-browserslist-db: 1.1.4(browserslist@4.28.0) + dev: true - buffer-from@1.1.2: {} + /buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + dev: true - buffer@5.7.1: + /buffer@5.7.1: + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} dependencies: base64-js: 1.5.1 ieee754: 1.2.1 + dev: false - caniuse-lite@1.0.30001755: {} + /caniuse-lite@1.0.30001757: + resolution: {integrity: sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ==} + dev: true - chokidar@4.0.3: + /chokidar@4.0.3: + resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} + engines: {node: '>= 14.16.0'} dependencies: readdirp: 4.1.2 + dev: true - chrome-trace-event@1.0.4: {} + /chrome-trace-event@1.0.4: + resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} + engines: {node: '>=6.0'} + dev: true - clipboard@2.0.11: + /clipboard@2.0.11: + resolution: {integrity: sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==} dependencies: good-listener: 1.2.2 select: 1.1.2 tiny-emitter: 2.1.0 + dev: false - commander@2.20.3: {} + /commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + dev: true - copy-webpack-plugin@12.0.2(webpack@5.102.1): + /copy-webpack-plugin@12.0.2(webpack@5.103.0): + resolution: {integrity: sha512-SNwdBeHyII+rWvee/bTnAYyO8vfVdcSTud4EIb6jcZ8inLeWucJE0DnxXQBjlQ5zlteuuvooGQy3LIyGxhvlOA==} + engines: {node: '>= 18.12.0'} + peerDependencies: + webpack: ^5.1.0 dependencies: fast-glob: 3.3.3 glob-parent: 6.0.2 @@ -981,76 +556,138 @@ snapshots: normalize-path: 3.0.0 schema-utils: 4.3.3 serialize-javascript: 6.0.2 - webpack: 5.102.1 + webpack: 5.103.0 + dev: true - dayjs@1.11.19: {} + /dayjs@1.11.19: + resolution: {integrity: sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==} + dev: false - delegate@3.2.0: {} + /delegate@3.2.0: + resolution: {integrity: sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==} + dev: false - detect-libc@1.0.3: + /detect-libc@1.0.3: + resolution: {integrity: sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==} + engines: {node: '>=0.10'} + hasBin: true + requiresBuild: true + dev: true optional: true - electron-to-chromium@1.5.255: {} + /electron-to-chromium@1.5.263: + resolution: {integrity: sha512-DrqJ11Knd+lo+dv+lltvfMDLU27g14LMdH2b0O3Pio4uk0x+z7OR+JrmyacTPN2M8w3BrZ7/RTwG3R9B7irPlg==} + dev: true - emojis-list@3.0.0: {} + /emojis-list@3.0.0: + resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} + engines: {node: '>= 4'} + dev: true - enhanced-resolve@5.18.3: + /enhanced-resolve@5.18.3: + resolution: {integrity: sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==} + engines: {node: '>=10.13.0'} dependencies: graceful-fs: 4.2.11 tapable: 2.3.0 + dev: true - es-module-lexer@1.7.0: {} + /es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} + dev: true - escalade@3.2.0: {} + /escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + dev: true - eslint-scope@5.1.1: + /eslint-scope@5.1.1: + resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} + engines: {node: '>=8.0.0'} dependencies: esrecurse: 4.3.0 estraverse: 4.3.0 + dev: true - esrecurse@4.3.0: + /esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} dependencies: estraverse: 5.3.0 + dev: true - estraverse@4.3.0: {} + /estraverse@4.3.0: + resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} + engines: {node: '>=4.0'} + dev: true - estraverse@5.3.0: {} + /estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + dev: true - events@3.3.0: {} + /events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + dev: true - fast-deep-equal@3.1.3: {} + /fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + dev: true - fast-glob@3.3.3: + /fast-glob@3.3.3: + resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} + engines: {node: '>=8.6.0'} dependencies: '@nodelib/fs.stat': 2.0.5 '@nodelib/fs.walk': 1.2.8 glob-parent: 5.1.2 merge2: 1.4.1 micromatch: 4.0.8 + dev: true - fast-json-stable-stringify@2.1.0: {} + /fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + dev: true - fast-uri@3.1.0: {} + /fast-uri@3.1.0: + resolution: {integrity: sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==} + dev: true - fastq@1.19.1: + /fastq@1.19.1: + resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} dependencies: reusify: 1.1.0 + dev: true - fill-range@7.1.1: + /fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} dependencies: to-regex-range: 5.0.1 + dev: true - glob-parent@5.1.2: + /glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} dependencies: is-glob: 4.0.3 + dev: true - glob-parent@6.0.2: + /glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} dependencies: is-glob: 4.0.3 + dev: true - glob-to-regexp@0.4.1: {} + /glob-to-regexp@0.4.1: + resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} + dev: true - globby@14.1.0: + /globby@14.1.0: + resolution: {integrity: sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==} + engines: {node: '>=18'} dependencies: '@sindresorhus/merge-streams': 2.3.0 fast-glob: 3.3.3 @@ -1058,231 +695,456 @@ snapshots: path-type: 6.0.0 slash: 5.1.0 unicorn-magic: 0.3.0 + dev: true - gm-crypto@0.1.12: + /gm-crypto@0.1.12: + resolution: {integrity: sha512-ercd9ionBqxR+/FCXICr0eo+jzC8BvSK0j9L7/eB0uwbyjgeMPTdBNrcQTqIuRXOtOAKSGsTNvtLYFnIxNEoFg==} dependencies: buffer: 5.7.1 jsbn: 1.1.0 to-arraybuffer: 1.0.1 + dev: false - good-listener@1.2.2: + /good-listener@1.2.2: + resolution: {integrity: sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==} dependencies: delegate: 3.2.0 + dev: false - graceful-fs@4.2.11: {} + /graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + dev: true - has-flag@4.0.0: {} + /has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + dev: true - ieee754@1.2.1: {} + /ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + dev: false - ignore@7.0.5: {} + /ignore@7.0.5: + resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} + engines: {node: '>= 4'} + dev: true - immutable@4.3.7: {} + /immutable@4.3.7: + resolution: {integrity: sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==} + dev: false - immutable@5.1.4: {} + /immutable@5.1.4: + resolution: {integrity: sha512-p6u1bG3YSnINT5RQmx/yRZBpenIl30kVxkTLDyHLIMk0gict704Q9n+thfDI7lTRm9vXdDYutVzXhzcThxTnXA==} + dev: true - is-extglob@2.1.1: {} + /is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + dev: true - is-glob@4.0.3: + /is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} dependencies: is-extglob: 2.1.1 + dev: true - is-number@7.0.0: {} + /is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + dev: true - jest-worker@27.5.1: + /jest-worker@27.5.1: + resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} + engines: {node: '>= 10.13.0'} dependencies: '@types/node': 24.10.1 merge-stream: 2.0.0 supports-color: 8.1.1 + dev: true - js-base64@3.7.8: {} + /js-base64@3.7.8: + resolution: {integrity: sha512-hNngCeKxIUQiEUN3GPJOkz4wF/YvdUdbNL9hsBcMQTkKzboD7T/q3OYOuuPZLUE6dBxSGpwhk5mwuDud7JVAow==} + dev: false - jsbn@1.1.0: {} + /jsbn@1.1.0: + resolution: {integrity: sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==} + dev: false - jsencrypt@3.5.4: {} + /jsencrypt@3.5.4: + resolution: {integrity: sha512-kNjfYEMNASxrDGsmcSQh/rUTmcoRfSUkxnAz+MMywM8jtGu+fFEZ3nJjHM58zscVnwR0fYmG9sGkTDjqUdpiwA==} + dev: false - json-parse-even-better-errors@2.3.1: {} + /json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + dev: true - json-schema-traverse@0.4.1: {} + /json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + dev: true - json-schema-traverse@1.0.0: {} + /json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + dev: true - json5@2.2.3: {} + /json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + dev: true - klona@2.0.6: {} + /klona@2.0.6: + resolution: {integrity: sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==} + engines: {node: '>= 8'} + dev: true - loader-runner@4.3.1: {} + /loader-runner@4.3.1: + resolution: {integrity: sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==} + engines: {node: '>=6.11.5'} + dev: true - loader-utils@2.0.4: + /loader-utils@2.0.4: + resolution: {integrity: sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==} + engines: {node: '>=8.9.0'} dependencies: big.js: 5.2.2 emojis-list: 3.0.0 json5: 2.2.3 + dev: true - loadsh@0.0.4: {} + /loadsh@0.0.4: + resolution: {integrity: sha512-U+wLL8InpfRalWrr+0SuhWgGt10M4OyAk6G8xCYo2rwpiHtxZkWiFpjei0vO463ghW8LPCdhqQxXlMy2qicAEw==} + deprecated: This is a typosquat on the popular Lodash package. This is not maintained nor is the original Lodash package. + dev: false - lodash@4.17.21: {} + /lodash@4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + dev: false - merge-stream@2.0.0: {} + /marked@4.3.0: + resolution: {integrity: sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==} + engines: {node: '>= 12'} + hasBin: true + dev: false - merge2@1.4.1: {} + /merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + dev: true - micromatch@4.0.8: + /merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + dev: true + + /micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} dependencies: braces: 3.0.3 picomatch: 2.3.1 + dev: true - mime-db@1.52.0: {} + /mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + dev: true - mime-types@2.1.35: + /mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} dependencies: mime-db: 1.52.0 + dev: true - neo-async@2.6.2: {} + /neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + dev: true - node-addon-api@7.1.1: + /node-addon-api@7.1.1: + resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==} + requiresBuild: true + dev: true optional: true - node-releases@2.0.27: {} + /node-releases@2.0.27: + resolution: {integrity: sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==} + dev: true - normalize-path@3.0.0: {} + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true - path-type@6.0.0: {} + /path-type@6.0.0: + resolution: {integrity: sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==} + engines: {node: '>=18'} + dev: true - picocolors@1.1.1: {} + /picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + dev: true - picomatch@2.3.1: {} + /picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + dev: true - pinia-plugin-unistorage@0.1.2: {} + /pinia-plugin-unistorage@0.1.2: + resolution: {integrity: sha512-WXit2cGnm5rG6CDTcLSLehNWhyJS/Yq7WEeeXAapZbCnqoPJxlszqg7rT8S+OP47az0h5nlajGo+LuyMxUQ2uw==} + dev: false - punycode@2.3.1: {} + /punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + dev: true - queue-microtask@1.2.3: {} + /queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + dev: true - randombytes@2.1.0: + /randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} dependencies: safe-buffer: 5.2.1 + dev: true - readdirp@4.1.2: {} + /readdirp@4.1.2: + resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} + engines: {node: '>= 14.18.0'} + dev: true - require-from-string@2.0.2: {} + /require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + dev: true - reusify@1.1.0: {} + /reusify@1.1.0: + resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + dev: true - run-parallel@1.2.0: + /run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: queue-microtask: 1.2.3 + dev: true - safe-buffer@5.2.1: {} + /safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + dev: true - sass-loader@10.5.2(sass@1.94.0)(webpack@5.102.1): + /sass-loader@10.5.2(sass@1.94.2)(webpack@5.103.0): + resolution: {integrity: sha512-vMUoSNOUKJILHpcNCCyD23X34gve1TS7Rjd9uXHeKqhvBG39x6XbswFDtpbTElj6XdMFezoWhkh5vtKudf2cgQ==} + engines: {node: '>= 10.13.0'} + peerDependencies: + fibers: '>= 3.1.0' + node-sass: ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 + sass: ^1.3.0 + webpack: ^4.36.0 || ^5.0.0 + peerDependenciesMeta: + fibers: + optional: true + node-sass: + optional: true + sass: + optional: true dependencies: klona: 2.0.6 loader-utils: 2.0.4 neo-async: 2.6.2 + sass: 1.94.2 schema-utils: 3.3.0 semver: 7.7.3 - webpack: 5.102.1 - optionalDependencies: - sass: 1.94.0 + webpack: 5.103.0 + dev: true - sass@1.94.0: + /sass@1.94.2: + resolution: {integrity: sha512-N+7WK20/wOr7CzA2snJcUSSNTCzeCGUTFY3OgeQP3mZ1aj9NMQ0mSTXwlrnd89j33zzQJGqIN52GIOmYrfq46A==} + engines: {node: '>=14.0.0'} + hasBin: true dependencies: chokidar: 4.0.3 immutable: 5.1.4 source-map-js: 1.2.1 optionalDependencies: '@parcel/watcher': 2.5.1 + dev: true - schema-utils@3.3.0: + /schema-utils@3.3.0: + resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==} + engines: {node: '>= 10.13.0'} dependencies: '@types/json-schema': 7.0.15 ajv: 6.12.6 ajv-keywords: 3.5.2(ajv@6.12.6) + dev: true - schema-utils@4.3.3: + /schema-utils@4.3.3: + resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} + engines: {node: '>= 10.13.0'} dependencies: '@types/json-schema': 7.0.15 ajv: 8.17.1 ajv-formats: 2.1.1(ajv@8.17.1) ajv-keywords: 5.1.0(ajv@8.17.1) + dev: true - select@1.1.2: {} + /select@1.1.2: + resolution: {integrity: sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA==} + dev: false - semver@7.7.3: {} + /semver@7.7.3: + resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==} + engines: {node: '>=10'} + hasBin: true + dev: true - serialize-javascript@6.0.2: + /serialize-javascript@6.0.2: + resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} dependencies: randombytes: 2.1.0 + dev: true - slash@5.1.0: {} + /slash@5.1.0: + resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} + engines: {node: '>=14.16'} + dev: true - source-map-js@1.2.1: {} + /source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + dev: true - source-map-support@0.5.21: + /source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} dependencies: buffer-from: 1.1.2 source-map: 0.6.1 + dev: true - source-map@0.6.1: {} + /source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + dev: true - supports-color@8.1.1: + /supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} dependencies: has-flag: 4.0.0 + dev: true - tapable@2.3.0: {} + /tapable@2.3.0: + resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} + engines: {node: '>=6'} + dev: true - terser-webpack-plugin@5.3.14(webpack@5.102.1): + /terser-webpack-plugin@5.3.14(webpack@5.103.0): + resolution: {integrity: sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==} + engines: {node: '>= 10.13.0'} + peerDependencies: + '@swc/core': '*' + esbuild: '*' + uglify-js: '*' + webpack: ^5.1.0 + peerDependenciesMeta: + '@swc/core': + optional: true + esbuild: + optional: true + uglify-js: + optional: true dependencies: '@jridgewell/trace-mapping': 0.3.31 jest-worker: 27.5.1 schema-utils: 4.3.3 serialize-javascript: 6.0.2 terser: 5.44.1 - webpack: 5.102.1 + webpack: 5.103.0 + dev: true - terser@5.44.1: + /terser@5.44.1: + resolution: {integrity: sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw==} + engines: {node: '>=10'} + hasBin: true dependencies: '@jridgewell/source-map': 0.3.11 acorn: 8.15.0 commander: 2.20.3 source-map-support: 0.5.21 + dev: true - tiny-emitter@2.1.0: {} + /tiny-emitter@2.1.0: + resolution: {integrity: sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==} + dev: false - to-arraybuffer@1.0.1: {} + /to-arraybuffer@1.0.1: + resolution: {integrity: sha512-okFlQcoGTi4LQBG/PgSYblw9VOyptsz2KJZqc6qtgGdes8VktzUQkj4BI2blit072iS8VODNcMA+tvnS9dnuMA==} + dev: false - to-regex-range@5.0.1: + /to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} dependencies: is-number: 7.0.0 + dev: true - undici-types@7.16.0: {} + /undici-types@7.16.0: + resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==} + dev: true - unicorn-magic@0.3.0: {} + /unicorn-magic@0.3.0: + resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} + engines: {node: '>=18'} + dev: true - update-browserslist-db@1.1.4(browserslist@4.28.0): + /update-browserslist-db@1.1.4(browserslist@4.28.0): + resolution: {integrity: sha512-q0SPT4xyU84saUX+tomz1WLkxUbuaJnR1xWt17M7fJtEJigJeWUNGUqrauFXsHnqev9y9JTRGwk13tFBuKby4A==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' dependencies: browserslist: 4.28.0 escalade: 3.2.0 picocolors: 1.1.1 + dev: true - uri-js@4.4.1: + /uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: punycode: 2.3.1 + dev: true - uview-plus@3.6.15: + /uview-plus@3.6.18: + resolution: {integrity: sha512-dYKt5VOdA/PtAcuKijy2ltrerYr/o8xnJSIjbRn483jILia/MTaiv83GUFSvrr+1UyQEvM+ZXkkpVdfV6GBEZw==} + engines: {HBuilderX: ^3.1.0, uni-app: ^4.66, uni-app-x: ''} dependencies: clipboard: 2.0.11 dayjs: 1.11.19 + dev: false - watchpack@2.4.4: + /watchpack@2.4.4: + resolution: {integrity: sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==} + engines: {node: '>=10.13.0'} dependencies: glob-to-regexp: 0.4.1 graceful-fs: 4.2.11 + dev: true - webpack-sources@3.3.3: {} + /webpack-sources@3.3.3: + resolution: {integrity: sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==} + engines: {node: '>=10.13.0'} + dev: true - webpack@5.102.1: + /webpack@5.103.0: + resolution: {integrity: sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw==} + engines: {node: '>=10.13.0'} + hasBin: true + peerDependencies: + webpack-cli: '*' + peerDependenciesMeta: + webpack-cli: + optional: true dependencies: '@types/eslint-scope': 3.7.7 '@types/estree': 1.0.8 @@ -1306,16 +1168,19 @@ snapshots: neo-async: 2.6.2 schema-utils: 4.3.3 tapable: 2.3.0 - terser-webpack-plugin: 5.3.14(webpack@5.102.1) + terser-webpack-plugin: 5.3.14(webpack@5.103.0) watchpack: 2.4.4 webpack-sources: 3.3.3 transitivePeerDependencies: - '@swc/core' - esbuild - uglify-js + dev: true - ysk-utils@1.0.78: + /ysk-utils@1.0.78: + resolution: {integrity: sha512-Bgr5B3WWiy0nbgL91QVKoVPYm4wt13Rlav757zEjMVRHbmTjwFEhi3wJlYus0JGd52mbknSxXHMazAPHXwA7uQ==} dependencies: bignumber.js: 9.3.1 loadsh: 0.0.4 lodash: 4.17.21 + dev: false diff --git a/store/menus.js b/store/menus.js index f0948f0..5b7dc5a 100644 --- a/store/menus.js +++ b/store/menus.js @@ -43,27 +43,32 @@ export const useMenusStore = defineStore('menus', { return { originMenus: [], menuList: [], - allPages: allPages,//小程序全部页面 - adminPages:[]//后台返回的全部页面 + allPages: allPages, //小程序全部页面 + adminPages: [] //后台返回的全部页面 }; }, actions: { async getMenus() { const data = await menusApi.getMenus() this.originMenus = data; - const arr = flattenNestedChildren(data).filter(v =>{ - return v.miniPath + const arr = flattenNestedChildren(data).filter(v => { + return v.miniPath }) - this.adminPages=arr; + this.adminPages = arr; this.menuList = this.allPages.filter(v => { const findItem = arr.find(item => item.miniPath == v.pageId || item.miniPath .replace(/^\/+|\/+$/g, '') == v.allPath) + + if (v.title == '经营工具') { + console.log('经营工具===', findItem); + } return findItem }) - return this.originMenus + + + return this.originMenus } }, unistorage: true, // 开启后对 state 的数据读写都将持久化 -} -); \ No newline at end of file +}); \ No newline at end of file diff --git a/uni_modules/iRainna-dayjs/changelog.md b/uni_modules/iRainna-dayjs/changelog.md index c434fbc..92bf71c 100644 --- a/uni_modules/iRainna-dayjs/changelog.md +++ b/uni_modules/iRainna-dayjs/changelog.md @@ -1,2 +1,4 @@ +## 1.0.1(2024-08-09) +更新文档 ## 1.0.0(2023-09-19) first diff --git a/uni_modules/iRainna-dayjs/package.json b/uni_modules/iRainna-dayjs/package.json index bf1a2a8..faf26bf 100644 --- a/uni_modules/iRainna-dayjs/package.json +++ b/uni_modules/iRainna-dayjs/package.json @@ -1,10 +1,10 @@ { "id": "iRainna-dayjs", "displayName": "dayjs", - "version": "1.0.0", - "description": "iRainna-dayjs", + "version": "1.0.1", + "description": "可直接在uniapp中使用dayjs的内置方法", "keywords": [ - "iRainna-dayjs" + "dayjs" ], "repository": "", "engines": { @@ -35,7 +35,8 @@ "platforms": { "cloud": { "tcb": "y", - "aliyun": "y" + "aliyun": "y", + "alipay": "n" }, "client": { "Vue": { diff --git a/uni_modules/iRainna-dayjs/readme.md b/uni_modules/iRainna-dayjs/readme.md index 6746afd..d121b06 100644 --- a/uni_modules/iRainna-dayjs/readme.md +++ b/uni_modules/iRainna-dayjs/readme.md @@ -1 +1,10 @@ -# iRainna-dayjs \ No newline at end of file +# Dayjs + + Dayjs是一个极简的JavaScript库,可以解析、验证、操作和显示日期和时间。 + +`uniapp-vue3`推荐使用[rainui](https://ext.dcloud.net.cn/plugin?id=19701),内置dayjs、loadsh、animate.css,方便高效开发 + + + + + diff --git a/uni_modules/kux-dayjs/changelog.md b/uni_modules/kux-dayjs/changelog.md index 369981c..36d8044 100644 --- a/uni_modules/kux-dayjs/changelog.md +++ b/uni_modules/kux-dayjs/changelog.md @@ -1,2 +1,69 @@ +## 1.0.6(2025-06-10) ++ 【重要】新增支持鸿蒙运行环境。 ++ 【重要】新增支持微信小程序运行环境。 +## 1.0.5(2024-06-27) ++ 修复时区偏移量计算bug。 + +## 1.0.4(2024-06-02) ++ 修复 `isBefore`、`isSame`、`isAfter`、`isSameOrBefore`、`isSameOrAfter` 和 `isBetween` 等比较方法时总是以当前时间为基准比较的bug。 ++ 修复安卓部分方法指定日期参数无效的bug。 + +## 1.0.3(2024-05-06) ++ 【重要】不再支持编译器 4.1 以下版本,请及时更新编译器为 4.1 以上版本以更好兼容后续更新迭代。 ++ 【重要】适配支持 `app-js` 引擎版本。(即目前ios的js引擎版本)。 ++ 【重要】`diff` api 默认单位调整为毫秒,和 [dayjs](https://day.js.org/docs/zh-CN/display/difference) 实现保持一致。 ++ `diff` 方法支持传入构造的 `Dayjs` 对象,示例如下: + + ``` + import { dayjs } from '@/uni_modules/kux-dayjs'; + + const date1 = dayjs('2024-05-06 12:23:53'); + console.log(date1.diff(dayjs('2024-05-06'), 'M')); // 结果为743 + ``` ++ 修复 `startOf` 和 `endOf` 时间基准总是为当前时间的问题。 ++ 调整函数签名,解决编译器4.1以上版本不兼容的问题。 ++ 优化其他已知问题。 +## 1.0.2(2024-03-23) ++ 支持通过字符串形式初始化实例,目前支持的字符串格式如下: + + YYYY-MM-DD + + YYYY/MM/DD + + YYYY-MM-DD HH + + YYYY-MM-DD HH:MM + + YYYY-MM-DD HH:MM:SS + + YYYY-MM-DD HH:MM:SS.millis + + YYYY/MM/DD HH + + YYYY/MM/DD HH:MM + + YYYY/MM/DD HH:MM:SS + + YYYY/MM/DD HH:MM:SS.millis + + ISO 8601 格式(包括 UTC 时间) + + 示例代码如下: + + ``` + console.log(dayjs('2023-12-13').format('YYYY-MM-DD')); + console.log(dayjs('2024/01/01').format('YYYY-MM-DD')); + console.log(dayjs('2023-12-13 12:23').format('YYYY-MM-DD HH:mm')); + console.log(dayjs('2023-12-13 12:23:45').format('YYYY-MM-DD HH:mm:ss')); + console.log(dayjs('2023-12-12 19:35:35.123').format('YYYY-MM-DD HH:mm:ss.SSS')); + console.log(dayjs('2023-12-13T10:16:18.000Z').format('YYYY-MM-DD HH:mm:ss')); + console.log(dayjs('2023-12-13T12:25:36.567+08:00').format('YYYY-MM-DD HH:mm:ss.SSS')); + ``` + ++ 支持通过时间戳初始化实例,由于 `uts` 联合类型限制,所以目前通过字符串形式的时间戳传入参数,示例代码如下: + + ``` + console.log(dayjs(`${dayjs().valueOf()}`, true).format('YYYY-MM-DD HH:mm:ss')); + console.log(dayjs('1683234305000', true).format('YY-MM-DD HH:mm:ss')); + ``` ++ 补全类和函数类型签名 + > **说明** + > + > `HBuilderX` 版本 4.0 及以上才支持。 + ++ 修复部分场景下毫秒丢失的问题。 +## 1.0.1(2024-01-30) ++ 支持web版本【hbx4.0及以上支持】 ++ `解析` 增加 `YY` 年份两位数选项,示例 YY:23 + ## 1.0.0(2023-12-14) 初始发布 diff --git a/uni_modules/kux-dayjs/common/calendar.uts b/uni_modules/kux-dayjs/common/calendar.uts index e44f5a3..aaca462 100644 --- a/uni_modules/kux-dayjs/common/calendar.uts +++ b/uni_modules/kux-dayjs/common/calendar.uts @@ -59,6 +59,7 @@ export type InfoType = { isLeap : boolean; } +// #ifndef APP-HARMONY export type LunarInfoType = { lYear : number; lMonth : number; @@ -79,6 +80,30 @@ export type LunarInfoType = { Term ?: string; astro ?: string } +// #endif + +// #ifdef APP-HARMONY +export interface LunarInfoType { + lYear : number; + lMonth : number; + lDay : number; + IMonthCn : string; + IDayCn : string; + cYear : number; + cMonth : number; + cDay : number; + gzYear ?: string; + gzMonth ?: string; + gzDay ?: string; + isToday : boolean; + isLeap : boolean; + nWeek ?: number; + ncWeek ?: string; + isTerm ?: boolean; + Term ?: string; + astro ?: string +} +// #endif export class Lunar { diff --git a/uni_modules/kux-dayjs/common/date.uts b/uni_modules/kux-dayjs/common/date.uts index 3cff411..d9764da 100644 --- a/uni_modules/kux-dayjs/common/date.uts +++ b/uni_modules/kux-dayjs/common/date.uts @@ -1,63 +1,159 @@ import { Lunar, LunarInfoType } from './calendar'; export type DateType = { - fullDate: string; - year: number; - month: number; - date: number; - hour: number; - minute: number; - second: number; - millisecond: number; - day: number; - isToday: boolean; - lunar: string; + fullDate : string; + year : number; + month : number; + date : number; + hour : number; + minute : number; + second : number; + millisecond : number; + day : number; + isToday : boolean; + lunar : string; +}; + +export type DateInfo = { + year : number, + month : number, + day : number, + hours : number, + minutes : number, + seconds : number, + milliseconds : number }; export class DateUtil { - private lunar: Lunar; - constructor () { + private lunar : Lunar; + + private static readonly dateRegex = /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})(?:[ T](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?(?:[ ]?(Z|[+-]\d{2}:\d{2}))?$/; + + + constructor() { this.lunar = new Lunar(); }; - + /** * 计算阴历日期显示 */ - getlunar (year : number, month : number, date : number) : LunarInfoType { + getlunar(year : number, month : number, date : number) : LunarInfoType { return this.lunar.solar2lunar(year, month, date) } - + + /** + * 解析时间戳 + */ + parseTimestamp(timestamp : number) : DateInfo { + let mTimestamp : number = timestamp; + // 定义每个时间单位的毫秒数 + const millisecondsPerSecond : number = 1000; + const millisecondsPerMinute = 60 * millisecondsPerSecond; + const millisecondsPerHour = 60 * millisecondsPerMinute; + const millisecondsPerDay = 24 * millisecondsPerHour; + + // 计算总天数 + let totalDays = Math.floor(mTimestamp / millisecondsPerDay); + mTimestamp -= totalDays * millisecondsPerDay; + + // 计算年、月、日 + const startYear : number = 1970; + let year = startYear; + let month : number = 0; + let day : number = 0; + + // 计算当前年是否为闰年 + const isLeapYear = (year : number) : boolean => (year % 4 == 0 && year % 100 != 0) || year % 400 == 0; + + // 计算年份 + while (true) { + const daysInYear = isLeapYear(year) ? 366 : 365; + if (totalDays >= daysInYear) { + totalDays -= daysInYear; + year++; + } else { + break; + } + } + + // 计算月份 + const daysInMonth = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + for (month = 0; month < daysInMonth.length; month++) { + if (totalDays < daysInMonth[month]) { + break; + } + totalDays -= daysInMonth[month]; + } + month++; // 月份是从0开始的,所以需要+1 + day = totalDays + 1; // 加1是因为总天数已经减去了一整天的毫秒数 + + // 计算小时、分钟、秒 + const hours = Math.floor(mTimestamp / millisecondsPerHour) % 24; + mTimestamp -= hours * millisecondsPerHour; + const minutes = Math.floor(mTimestamp / millisecondsPerMinute) % 60; + mTimestamp -= minutes * millisecondsPerMinute; + const seconds = Math.floor(mTimestamp / millisecondsPerSecond) % 60; + const milliseconds = mTimestamp % millisecondsPerSecond; + + return { + year, + month, + day, + hours, + minutes, + seconds, + milliseconds + } as DateInfo; + } + /** * 获取任意时间 */ - getDate (date: string): DateType { - let dd: Date = new Date(); - let hour = 0; - let minute = 0; - let second = 0; - let milllisceond = 0; - - if (date !== '') { - const datePart = date.split(" "); - const dateData = datePart[0].split("-"); - const year = parseInt(dateData[0]); - const month = parseInt(dateData[1]); - const day = parseInt(dateData[2]); - - if (datePart.length > 1) { - const timeData = datePart[1].split(":"); - hour = parseInt(timeData[0]); - minute = parseInt(timeData[1]); - const secondPart = timeData[2].split("."); - second = parseInt(secondPart[0]); - if (secondPart.length > 1) { - milllisceond = parseInt(secondPart[1]); - } + getDate(date : string) : DateType { + let dd : Date = new Date(); + + // 使用正则表达式解析日期和时间 + const match = date.match(DateUtil.dateRegex); + if (match != null && match[1] != null && match[2] != null && match[3] != null && match.length > 0) { + // 解构匹配结果 + // const [_, year, month, day, hour, minute, second, milllisceond] = match; + const yearR = parseInt(match[1]!, 10); + const monthR = parseInt(match[2]!, 10); + const dayR = parseInt(match[3]!, 10); + let hourR = 0; + if (match.length >= 5 && match[4] != null) { + hourR = parseInt(match[4]!, 10); + } + let minuteR = 0; + if (match.length >= 6 && match[5] != null) { + minuteR = parseInt(match[5]!, 10); + } + let secondR = 0; + if (match.length >= 7 && match[6] != null) { + secondR = parseInt(match[6]!, 10); + } + let millisceondR = 0; + if (match.length >= 8 && match[7] != null) { + millisceondR = parseInt(match[7]!, 10); + } + let timezoneOffset: string | null = null; + if (match.length >= 9 && match[8] != null) { + timezoneOffset = match[8]; + } + + // 创建 Date 对象 + dd = new Date(yearR, monthR - 1, dayR, hourR, minuteR, secondR, millisceondR); + + // 应用时区偏移 + if (timezoneOffset != null && timezoneOffset != 'Z') { + const offsetSign = (timezoneOffset.split(''))[0] == '+' ? 1 : -1; + const offsetHours = 8 - parseInt(timezoneOffset.substring(1, 3), 10); + const offsetMinutes = parseInt(timezoneOffset.substring(4, 6), 10); + const offsetMilliseconds = (offsetHours * 60 + offsetMinutes) * 60 * 1000 * offsetSign; + dd = new Date(dd.getTime() + offsetMilliseconds); } - - dd = new Date(year, month - 1, day, hour, minute, second, milllisceond); } - + const y = dd.getFullYear(); const m = dd.getMonth() + 1; const d = dd.getDate(); @@ -65,11 +161,11 @@ export class DateUtil { const M = dd.getMinutes(); const s = dd.getSeconds(); const ms = dd.getMilliseconds(); - + let nowDate = y + '-' + m + '-' + d; const lunarData = this.getlunar(y, m, d); - - const data: DateType = { + + const data : DateType = { fullDate: nowDate, year: y, month: m, @@ -82,7 +178,7 @@ export class DateUtil { lunar: lunarData.IDayCn, isToday: this.getlunar(y, m, d).isToday }; - + return data; - }; + }; }; \ No newline at end of file diff --git a/uni_modules/kux-dayjs/common/index.uts b/uni_modules/kux-dayjs/common/index.uts index 8e426a8..148c8a5 100644 --- a/uni_modules/kux-dayjs/common/index.uts +++ b/uni_modules/kux-dayjs/common/index.uts @@ -1,39 +1,68 @@ -import { DateFormat, LunarType, DiffUnit, FromToOptions, DatetimeOptions, IsBetweenContains, DatetimeUnit } from "../utssdk/interface.uts"; +import { DateFormat, LunarType, DiffUnit, FromToOptions, DatetimeOptions, IsBetweenContains, DatetimeUnit, IKuxDayjs } from "../utssdk/interface.uts"; import { Lunar } from './calendar'; import { DateType, DateUtil } from './date'; import { MONTHS, WEEKDAYS, MONTH_DAYS } from './constant'; +import { floor } from './utils'; -class KuxDayjs { - private d: Date - private dd: DateType - private lunar: Lunar - private dateUtil: DateUtil - private dateStr: string - constructor (date: string = '') { +class KuxDayjs implements IKuxDayjs { + public d : Date + public dd : DateType + private lunar : Lunar + private dateUtil : DateUtil + private dateStr : string + private uniVersion : number + + constructor(date : string = '', isTimestamp : boolean = false, isCST : boolean = true) { + this.uniVersion = uni.getSystemInfoSync().uniCompileVersionCode; this.dateStr = date; this.lunar = new Lunar(); this.dateUtil = new DateUtil(); const dd = this.dateUtil.getDate(date); this.dd = dd; this.d = new Date(dd.year, dd.month - 1, dd.date, dd.hour, dd.minute, dd.second, dd.millisecond); + // if (this.uniVersion >= 4.0) { + // this.d = new Date(date); + // } + if (isTimestamp) { + let timestamp = parseInt(date); + if (isCST) { + timestamp += 8 * 3600 * 1000; + } + this.fromTimestamp(timestamp); + } } - + + /** + * 根据时间戳实例化 + * @param {number} timestamp 时间戳 + */ + private fromTimestamp(timestamp : number) : KuxDayjs { + const dd = this.dateUtil.parseTimestamp(timestamp); + this.dd = this.dateUtil.getDate(`${`${dd.year}`.padStart(2, '0')}-${`${dd.month}`.padStart(2, '0')}-${`${dd.day}`.padStart(2, '0')} ${`${dd.hours}`.padStart(2, '0')}:${`${dd.minutes}`.padStart(2, '0')}:${`${dd.seconds}`.padStart(2, '0')}.${`${dd.milliseconds}`.padStart(3, '0')}`); + this.d = new Date(dd.year, dd.month - 1, dd.day, dd.hours, dd.minutes, dd.seconds, dd.milliseconds); + + return this; + } + /** * 当前时间对象 * @description 返回一个基于指定日期和时间的 KuxDayjs 对象 * @param {string} date 日期时间字符串,比如:'2023-12-12 19:35:35' */ - dayjs (date: string): KuxDayjs { + dayjs(date : string) : IKuxDayjs { this.dateStr = date; this.lunar = new Lunar(); this.dateUtil = new DateUtil(); const dd = this.dateUtil.getDate(date); this.dd = dd; - this.d = new Date(dd.year, dd.month - 1, dd.date, dd.hour, dd.minute, dd.second, dd.millisecond); - + // this.d = new Date(dd.year, dd.month - 1, dd.date, dd.hour, dd.minute, dd.second, dd.millisecond); + if (this.uniVersion >= 4.0) { + this.d = new Date(date); + } + return this; } - + /** * 基于当前时间复制一个 KuxDayjs 对象 * @returns {KuxDayjs} @@ -42,18 +71,19 @@ class KuxDayjs { * const b = a.clone(); * // a 和 b 是两个独立的 KuxDayjs 对象 */ - clone (): KuxDayjs { + clone() : IKuxDayjs { return new KuxDayjs(); } - + /** * 日期格式化 * @description 根据传入的占位符返回格式化后的日期 * @param format 格式,如 'YYYY-MM-DD HH:mm:ss' * @returns string */ - format (format: string): string { + format(format : string) : string { const YYYY = `${this.d.getFullYear()}`; + const YY = YYYY.slice(-2); const M = `${this.d.getMonth() + 1}`; const MM = M.padStart(2, '0'); const DD = `${this.d.getDate()}`.padStart(2, '0'); @@ -61,7 +91,7 @@ class KuxDayjs { const mm = `${this.d.getMinutes()}`.padStart(2, '0'); const ss = `${this.d.getSeconds()}`.padStart(2, '0'); const SSS = `${this.d.getMilliseconds()}`.padStart(3, '0'); - + // 上午/下午 let ampm = 'AM'; let ampmCN = '上午'; @@ -73,42 +103,22 @@ class KuxDayjs { ampmZN = 'pm'; formattedHours = `${(Math.abs(parseInt(HH)) - 12)}`.padStart(2, '0'); } - + return format .replace('YYYY', YYYY) + .replace('YY', YY) .replace('MM', MM) .replace('DD', DD) .replace('HH', formattedHours) .replace('mm', mm) .replace('ss', ss) .replace('SSS', SSS) + .replace('AA', ampmCN) .replace('A', ampm) .replace('a', ampmZN) - .replace('AA', ampmCN) } - /** - * 差异 - * @description 返回指定单位下两个日期时间之间的差异 - * @param {string} date 比较的日期 - * @param {DiffUnit} unit 单位,默认为 `day` - * + week 周,缩写 `w` - * + day 天,缩写 `d` - * + month 月份,缩写 `M` - * + year 年,缩写 `y` - * + hour 小时,缩写 `h` - * + minute 分钟,缩写 `m` - * + second 秒,缩写 `s` - * + millisecond 毫秒,缩写 `ms` - * @param {boolean} strict 严格模式,设置为 `true` 时,会保持浮点数格式 - * @returns number - */ - diff (date: string, unit: DiffUnit = 'day', strict: boolean = false): number { - // 将日期转换为毫秒数 - const time1 = this.d.getTime(); - const dd = this.dateUtil.getDate(date); - const time2 = new Date(dd.year, dd.month - 1, dd.date).getTime(); - + private _diffCommon(dd: DateType, time1: number, time2: number, unit: DiffUnit, strict: boolean): number { // 计算两个日期的毫秒数差 const diffInMilliseconds = Math.abs(time1 - time2); // 秒数差 @@ -132,8 +142,11 @@ class KuxDayjs { const diffMonths = (year1 - year2) * 12 + (month1 - month2); + // 年数差 + const diffYear = year1 - year2; + // 判断单位 - let data: number; + let data : number; switch (unit) { case 'millisecond': @@ -172,39 +185,100 @@ class KuxDayjs { case 'm': data = diffMonths; break; + case 'y': + data = diffYear; + break; + case 'year': + data = diffYear; + break; default: data = diffDays; break; } if (!strict) { - data = Math.floor(data); + // data = Math.floor(data); + data = floor(data); } - return data; + return Math.abs(data); } - /** - * 日历时间 - * @description 获取指定年月的日历面板数据 - * @param {number} 年 - * @param {number} 月 - * @returns {DateFormat} 返回数据 - */ - calendar (year: number = 0, month: number = 0): DateFormat[] { - let outDate: DateFormat[] = []; + private _diffByDate(date: IKuxDayjs, unit: DiffUnit, strict: boolean): number { + const time1 = this.d.getTime(); + const time2 = date.d.getTime(); + + return this._diffCommon(date.dd, time1, time2, unit, strict); + } + + private _diff(date : string, unit : DiffUnit, strict : boolean) : number { + // 将日期转换为毫秒数 + const time1 = this.d.getTime(); + const dd = this.dateUtil.getDate(date); + const time2 = new Date(dd.year, dd.month - 1, dd.date, dd.hour, dd.minute, dd.second, dd.millisecond).getTime(); + + return this._diffCommon(dd, time1, time2, unit, strict); + } + + diff(date : IKuxDayjs) : number + + diff(date : string) : number + + diff(date : IKuxDayjs, unit : DiffUnit | null) : number + + diff(date : string, unit : DiffUnit | null) : number + + diff(date : IKuxDayjs, unit : DiffUnit | null, strict : boolean | null): number + + diff(date : string, unit : DiffUnit | null, strict : boolean | null) : number + + // #ifndef APP-HARMONY + diff(date : any, unit : DiffUnit | null, strict : boolean | null) : number { + // #ifdef APP-ANDROID + if (date instanceof IKuxDayjs) { + return this._diffByDate(date as IKuxDayjs, unit ?? 'ms', strict ?? false); + } + // #endif + // #ifndef APP-ANDROID + if (date instanceof KuxDayjs) { + return this._diffByDate(date as IKuxDayjs, unit ?? 'ms', strict ?? false); + } + // #endif + + return this._diff(`${date}`, unit ?? 'ms', strict ?? false); + } + // #endif + // #ifdef APP-HARMONY + diff(date : any, unit ?: DiffUnit | null, strict ?: boolean | null) : number { + // #ifdef APP-ANDROID + if (date instanceof IKuxDayjs) { + return this._diffByDate(date as IKuxDayjs, unit ?? 'ms', strict ?? false); + } + // #endif + // #ifndef APP-ANDROID + if (date instanceof KuxDayjs) { + return this._diffByDate(date as IKuxDayjs, unit ?? 'ms', strict ?? false); + } + // #endif + + return this._diff(`${date}`, unit ?? 'ms', strict ?? false); + } + // #endif + + private _calendar(year : number, month : number) : DateFormat[] { + let outDate : DateFormat[] = []; let date = new Date(); let curYear = year; let curMonth = month; - + if (isNaN(curYear) || curYear < 1900) { curYear = date.getFullYear(); } - + if (isNaN(curMonth) || curMonth < 1) { curMonth = date.getMonth() + 1; } - + // 获取当月第一天 const firstDayOfThisMonth = new Date(curYear, curMonth - 1, 1); const preMonthDay = firstDayOfThisMonth.getDay(); @@ -214,15 +288,15 @@ class KuxDayjs { // 获取本月最后一天,即下月第0天 const lastDayOfThisMonth = new Date(curYear, curMonth, 0); const lastDateOfThisMonth = lastDayOfThisMonth.getDate(); - + // 获取周日期数据,一个月最多跨6周,即6 * 7格式排版 for (let i = 0; i < 6 * 7; i++) { // 获取当前排序日期 - let thisYear: number = curYear, - thisMonth: number = curMonth, - dateN: number = i + 1 - preMonthDay, - cursorDate: number = dateN; - + let thisYear : number = curYear, + thisMonth : number = curMonth, + dateN : number = i + 1 - preMonthDay, + cursorDate : number = dateN; + if (dateN <= 0) { thisMonth -= 1; cursorDate = dateN + lastDateOfLastMonth; @@ -231,7 +305,7 @@ class KuxDayjs { thisMonth += 1; cursorDate = dateN - lastDateOfThisMonth; } - + if (thisMonth == 13) { thisMonth = 1; thisYear += 1; @@ -240,20 +314,20 @@ class KuxDayjs { thisMonth = 12; thisYear -= 1; } - + // 计算该日期与当前时间的天数差 // const diffInDays = this.diff() const startDate = new Date(thisYear, thisMonth - 1, cursorDate); const endDate = new Date(this.d.getFullYear(), this.d.getMonth(), this.d.getDate()); const fullDate = `${thisYear}-${`${thisMonth}`.padStart(2, '0')}-${`${cursorDate}`.padStart(2, '0')}`; - + let diffInDays = this.diff(fullDate); // let diffInDays = 0; - + if (startDate.getTime() < endDate.getTime()) { diffInDays *= -1; } - + outDate.push({ year: thisYear, month: thisMonth, @@ -269,174 +343,266 @@ class KuxDayjs { fullDate } as DateFormat) } - + return outDate; } - - /** - * 获取/设置毫秒数 - * @description 获取或设置毫秒 - * @param {number} ms 0-999的毫秒数,如果大于-1就是设置操作,否则为获取操作 - * @returns {number} 返回0-999的毫秒数 - */ - millisecond (ms: number = -1): number { + + calendar() : DateFormat[] + + calendar(year : number | null) : DateFormat[] + + // #ifndef APP-HARMONY + calendar(year : number | null, month : number | null) : DateFormat[] { + return this._calendar(year ?? 0, month ?? 0); + } + // #endif + // #ifdef APP-HARMONY + calendar(year ?: number | null, month ?: number | null) : DateFormat[] { + return this._calendar(year ?? 0, month ?? 0); + } + // #endif + + private _millsecond(ms : number) : number { if (ms > -1) { return this.d.getTime(); } - + return this.d.setMilliseconds(ms); } - - /** - * 获取/设置秒数 - * @description 获取或设置秒 - * @param {number} s 0-59的秒数,如果大于-1就是设置操作,否则为获取操作 - * @returns {number} 返回0-59的秒数 - */ - second (s: number = -1): number { + + millisecond() : number + + // #ifndef APP-HARMONY + millisecond(ms : number | null) : number { + return this._millsecond(ms ?? -1); + } + // #endif + // #ifdef APP-HARMONY + millisecond(ms ?: number | null) : number { + return this._millsecond(ms ?? -1); + } + // #endif + + private _second(s : number) : number { if (s > -1) { return this.d.setSeconds(s); } - + return this.d.getSeconds(); } - - /** - * 获取/设置分钟 - * @description 获取或设置分钟 - * @param {number} M 0-59的分钟数,如果大于-1就是设置操作,否则为获取操作 - * @returns {number} 返回0-59的分钟数 - */ - minute (M: number = -1): number { + + second() : number + + // #ifndef APP-HARMONY + second(s : number | null) : number { + return this._second(s ?? -1); + } + // #endif + // #ifdef APP-HARMONY + second(s ?: number | null) : number { + return this._second(s ?? -1); + } + // #endif + + private _minute(M : number) : number { if (M > -1) { return this.d.setMinutes(M); } - + return this.d.getMinutes(); } - - /** - * 获取/设置小时 - * @description 获取或设置小时 - * @param {number} h 0-23的小时数,如果大于-1就是设置操作,否则为获取操作 - * @returns {number} 返回0-23的小时数 - */ - hour (h: number = -1): number { + + minute() : number + + // #ifndef APP-HARMONY + minute(M : number | null) : number { + return this._minute(M ?? -1); + } + // #endif + // #ifdef APP-HARMONY + minute(M ?: number | null) : number { + return this._minute(M ?? -1); + } + // #endif + + private _hour(h : number) : number { if (h > -1) { return this.d.setHours(h); } - + return this.d.getHours(); } - - /** - * 获取/设置日期 - * @description 获取或设置日期 - * @param {number} d 日期数,传入参数就是设置操作,否则为获取操作。如果为 d 指定 0,那么日期就会被设置为上个月的最后一天。如果 d 被设置为负数,日期会设置为上个月最后一天往前数这个负数绝对值天数后的日期。-1 会设置为上月最后一天的前一天(译者注:例如当前为 4 月,如果 date(-2),则为 3 月 29 日) - * @returns {number} 返回1-31的日期数 - */ - date (d?: number): number { - if (!isNaN(parseInt(`${d}`))) { - return this.d.setDate(parseInt(`${d}`)); + + hour() : number + + // #ifndef APP-HARMONY + hour(h : number | null) : number { + return this._hour(h ?? -1); + } + // #endif + // #ifdef APP-HARMONY + hour(h ?: number | null) : number { + return this._hour(h ?? -1); + } + // #endif + + private _date(d : number | null) : number { + if (d != null) { + return this.d.setDate(d); } - + return this.d.getDate(); } - + + date() : number + + // #ifndef APP-HARMONY + date(d : number | null) : number { + return this._date(d); + } + // #endif + // #ifdef APP-HARMONY + date(d ?: number | null) : number { + return this._date(d); + } + // #endif + /** * 获取星期几,0 表示星期天。目前仅支持获取,不支持设置操作 * @description 获取或设置星期 * @returns {number} 返回0-6的整数,0代表星期日,1代表星期一,以此类推。 */ - day (): number { + day() : number { return this.d.getDay(); } - + /** * 获取/设置时间 * @description 获取或设置毫秒 * @param {number} t 一个整数,表示从 1970-1-1 00:00:00 UTC 开始计时的毫秒数。 传入参数就是设置操作,否则为获取操作。 * @returns {number} 返回UTC 1970 年 1 月 1 日 00:00:00 与更新日期之间的毫秒数(实际上是自变量的值)。 */ - time (t: number): number { + time(t : number) : number { if (!isNaN(parseInt(`${t}`))) { return this.d.setTime(parseInt(`${t}`)); } - + return this.d.getTime(); } - - /** - * 获取/设置月份 - * @description 获取或设置月份 - * @param {number} m 0-11的整数,如果m大于0则为设置操作,否则为获取操作 - * @returns {number} n - * + 获取操作返回0-11的整数(表示一月到十二月)。 - * + 设置操作返回基于 1 January 1970 00:00:00 UTC 开始计算的毫秒数。 - */ - month (m: number = -1): number { + + private _month(m : number) : number { if (m > -1) { return this.d.setMonth(m); } - + return this.d.getMonth(); } - - /** - * 获取/设置年 - * @description 获取或设置年份 - * @param {number} y 大于1969的整数,如果大于1969则为设置操作,否则为获取操作 - * @returns {number} 返回操作后的年份数 - */ - year (y: number = 1969): number { + + month() : number + + // #ifndef APP-HARMONY + month(m : number | null) : number { + return this._month(m ?? -1); + } + // #endif + // #ifdef APP-HARMONY + month(m ?: number | null) : number { + return this._month(m ?? -1); + } + // #endif + + private _year(y : number) : number { if (y > 1969) { return this.d.setFullYear(y); } - + return this.d.getFullYear(); } - - /** - * 增加 - * @description 返回增加一定时间的复制的 KuxDayjs 对象 - * @param {string} count 需要增加的整数,支持配合单位操作 - * @param {DiffUnit} unit 单位,默认为 `day` - * + week 周,缩写 `w` - * + day 天,缩写 `d` - * + month 月份,缩写 `M` - * + year 年,缩写 `y` - * + hour 小时,缩写 `h` - * + minute 分钟,缩写 `m` - * + second 秒,缩写 `s` - * + millisecond 毫秒,缩写 `ms` - * @returns {Date} d 操作后的Date对象 - */ - add (count: number = 0, unit: DiffUnit = 'day'): KuxDayjs { + + year() : number + + // #ifndef APP-HARMONY + year(y : number | null) : number { + return this._year(y ?? 1969); + } + // #endif + // #ifdef APP-HARMONY + year(y ?: number | null) : number { + return this._year(y ?? 1969); + } + // #endif + + private _add(count : number, unit : DiffUnit) : IKuxDayjs { if (count < 0) { console.warn('【kux-dayjs:add】请输入大于0的数字'); return this; } - if (unit === 'day' || unit === 'd') { + if (unit == 'day' || unit == 'd') { this.d.setDate(this.d.getDate() + count); - } else if (unit === 'month' || unit === 'M') { + } else if (unit == 'month' || unit == 'M') { this.d.setMonth(this.d.getMonth() + count); - } else if (unit === 'year' || unit === 'y') { + } else if (unit == 'year' || unit == 'y') { this.d.setFullYear(this.d.getFullYear() + count); - } else if (unit === 'week' || unit === 'w') { + } else if (unit == 'week' || unit == 'w') { this.d.setDate((this.d.getDate() + 7) * count); - } else if (unit === 'hour' || unit === 'h') { + } else if (unit == 'hour' || unit == 'h') { this.d.setHours(this.d.getHours() + count); - } else if (unit === 'minute' || unit === 'm') { + } else if (unit == 'minute' || unit == 'm') { this.d.setMinutes(this.d.getMinutes() + count); - } else if (unit === 'second' || unit === 's') { + } else if (unit == 'second' || unit == 's') { this.d.setSeconds(this.d.getSeconds() + count); - } else if (unit === 'millisecond' || unit === 'ms') { + } else if (unit == 'millisecond' || unit == 'ms') { this.d.setMilliseconds(this.d.getMilliseconds() + count); } - + return this; } - + + add() : IKuxDayjs + + add(count : number | null) : IKuxDayjs + + // #ifndef APP-HARMONY + add(count : number | null, unit : DiffUnit | null) : IKuxDayjs { + return this._add(count ?? 0, unit ?? 'day'); + } + // #endif + // #ifdef APP-HARMONY + add(count ?: number | null, unit ?: DiffUnit | null) : IKuxDayjs { + return this._add(count ?? 0, unit ?? 'day'); + } + // #endif + + private _subtract(count : number, unit : DiffUnit) : IKuxDayjs { + if (count < 0) { + console.warn('【kux-dayjs:subtract】请输入大于0的数字'); + return this; + } + if (unit == 'day' || unit == 'd') { + this.d.setDate(this.d.getDate() - count); + } else if (unit == 'month' || unit == 'M') { + this.d.setMonth(this.d.getMonth() - count); + } else if (unit == 'year' || unit == 'y') { + this.d.setFullYear(this.d.getFullYear() - count); + } else if (unit == 'week' || unit == 'w') { + this.d.setDate((this.d.getDate() - 7) * count); + } else if (unit == 'hour' || unit == 'h') { + this.d.setHours(this.d.getHours() - count); + } else if (unit == 'minute' || unit == 'm') { + this.d.setMinutes(this.d.getMinutes() - count); + } else if (unit == 'second' || unit == 's') { + this.d.setSeconds(this.d.getSeconds() - count); + } else if (unit == 'millisecond' || unit == 'ms') { + this.d.setMilliseconds(this.d.getMilliseconds() - count); + } + + return this; + } + + subtract() : IKuxDayjs + + subtract(count : number | null) : IKuxDayjs + /** * 减去 * @description 返回减去一定时间的复制的 KuxDayjs 对象 @@ -452,63 +618,48 @@ class KuxDayjs { * + millisecond 毫秒,缩写 `ms` * @returns {Date} d 操作后的Date对象 */ - subtract (count: number = 0, unit: DiffUnit = 'day'): KuxDayjs { - if (count < 0) { - console.warn('【kux-dayjs:subtract】请输入大于0的数字'); - return this; - } - if (unit === 'day' || unit === 'd') { - this.d.setDate(this.d.getDate() - count); - } else if (unit === 'month' || unit === 'M') { - this.d.setMonth(this.d.getMonth() - count); - } else if (unit === 'year' || unit === 'y') { - this.d.setFullYear(this.d.getFullYear() - count); - } else if (unit === 'week' || unit === 'w') { - this.d.setDate((this.d.getDate() - 7) * count); - } else if (unit === 'hour' || unit === 'h') { - this.d.setHours(this.d.getHours() - count); - } else if (unit === 'minute' || unit === 'm') { - this.d.setMinutes(this.d.getMinutes() - count); - } else if (unit === 'second' || unit === 's') { - this.d.setSeconds(this.d.getSeconds() - count); - } else if (unit === 'millisecond' || unit === 'ms') { - this.d.setMilliseconds(this.d.getMilliseconds() - count); - } - - return this; + // #ifndef APP-HARMONY + subtract(count : number | null, unit : DiffUnit | null) : IKuxDayjs { + return this._subtract(count ?? 0, unit ?? 'day'); } - + // #endif + // #ifdef APP-HARMONY + subtract(count ?: number | null, unit ?: DiffUnit | null) : IKuxDayjs { + return this._subtract(count ?? 0, unit ?? 'day'); + } + // #endif + /** * 设置时间为0时0分0秒0毫秒 */ - private _setTimeStart (): KuxDayjs { + private _setTimeStart() : IKuxDayjs { this.d.setHours(0); this.d.setMinutes(0); this.d.setSeconds(0); this.d.setMilliseconds(0); - + return this; } - + /** * 设置时间为23时59分59秒999毫秒 */ - private _setTimeEnd () { + private _setTimeEnd() { this.d.setHours(23); this.d.setMinutes(59); this.d.setSeconds(59); this.d.setMilliseconds(999); } - + /** * 设置时间为今天 */ - today (): KuxDayjs { + today() : IKuxDayjs { this.d = new Date(); - + return this; } - + /** * 时间的开始 * @description 返回复制的 KuxDayjs 对象,并设置到一个时间的开始。 @@ -522,36 +673,36 @@ class KuxDayjs { * + second 秒,缩写 `s` * @returns {Date} d 操作后的Date对象 */ - startOf (unit: DiffUnit): KuxDayjs { - this.today(); - - if (unit === 'week' || unit === 'w') { + startOf(unit : DiffUnit) : IKuxDayjs { + // this.today(); + + if (unit == 'week' || unit == 'w') { const day = this.d.getDay(); this.d.setDate((this.d.getDate() - day + (day == 0 ? -6 : 1))); this._setTimeStart(); - } else if (unit === 'day' || unit === 'd') { + } else if (unit == 'day' || unit == 'd') { this._setTimeStart(); - } else if (unit === 'month' || unit === 'M') { + } else if (unit == 'month' || unit == 'M') { this.d.setDate(1); this._setTimeStart(); - } else if (unit === 'year' || unit === 'y') { + } else if (unit == 'year' || unit == 'y') { this.d.setMonth(0); this.d.setDate(1); this._setTimeStart(); - } else if (unit === 'hour' || unit === 'h') { + } else if (unit == 'hour' || unit == 'h') { this.d.setMinutes(0); this.d.setSeconds(0); this.d.setMilliseconds(0); - } else if (unit === 'minute' || unit === 'm') { + } else if (unit == 'minute' || unit == 'm') { this.d.setSeconds(0); this.d.setMilliseconds(0); - } else if (unit === 'second' || unit === 's') { + } else if (unit == 'second' || unit == 's') { this.d.setMilliseconds(0); } - + return this; } - + /** * 时间的结束 * @description 返回复制的 KuxDayjs 对象,并设置到一个时间的末尾。 @@ -565,39 +716,39 @@ class KuxDayjs { * + second 秒,缩写 `s` * @returns {Date} d 操作后的Date对象 */ - endOf (unit: DiffUnit): KuxDayjs { - this.today(); - - if (unit === 'week' || unit === 'w') { + endOf(unit : DiffUnit) : IKuxDayjs { + // this.today(); + + if (unit == 'week' || unit == 'w') { const day = this.d.getDay(); this.d.setDate(this.d.getDate() + (7 - day)); this._setTimeEnd(); - } else if (unit === 'day' || unit === 'd') { + } else if (unit == 'day' || unit == 'd') { this._setTimeEnd(); - } else if (unit === 'month' || unit === 'M') { + } else if (unit == 'month' || unit == 'M') { const year = this.d.getFullYear(); const month = this.d.getMonth() + 1; this.d = new Date(year, month, 0); this._setTimeEnd(); - } else if (unit === 'year' || unit === 'y') { + } else if (unit == 'year' || unit == 'y') { const year = this.d.getFullYear(); this.d = new Date(year, 11, 31); this._setTimeEnd(); - } else if (unit === 'hour' || unit === 'h') { + } else if (unit == 'hour' || unit == 'h') { this.d.setMinutes(59); this.d.setSeconds(59); this.d.setMilliseconds(999); - } else if (unit === 'minute' || unit === 'm') { + } else if (unit == 'minute' || unit == 'm') { this.d.setSeconds(59); this.d.setMilliseconds(999); - } else if (unit === 'second' || unit === 's') { + } else if (unit == 'second' || unit == 's') { this.d.setMilliseconds(999); } - + return this; }; - - private _fromOrto (date: Date, options: FromToOptions = { + + private _fromOrto(date : Date, options : FromToOptions = { isSuffix: false, relativeTime: { s: '', @@ -612,7 +763,7 @@ class KuxDayjs { y: '', yy: '' } - } as FromToOptions, type: 'from' | 'to' = 'from'): string { + } as FromToOptions, type : 'from' | 'to' = 'from') : string { const now = date.getTime(); let diff = now - this.d.getTime(); const diffSeconds = Math.floor(diff / 1000); @@ -621,7 +772,7 @@ class KuxDayjs { const diffDays = Math.floor(diffHours / 24); const diffMonths = Math.floor(diffDays / 30.44); const diffYears = Math.floor(diffMonths / 12); - + const isSuffix = options.isSuffix ?? false; const s = options.relativeTime?.s ?? ''; const m = options.relativeTime?.m ?? ''; @@ -634,17 +785,17 @@ class KuxDayjs { const mons = options.relativeTime?.mons ?? ''; const y = options.relativeTime?.y ?? ''; const yy = options.relativeTime?.yy ?? ''; - + let outStr = ''; - let suffix = isSuffix ? '' : (type === 'from' ? '前' : '后'); - + let suffix = isSuffix ? '' : (type == 'from' ? '前' : '后'); + if (diffSeconds > 0 && diffSeconds < 45) { outStr = `${diffSeconds}秒${suffix}`; if (s.includes('%s')) { outStr = s; outStr = outStr.replace('%s', `${diffSeconds}`); } - } else if (diffSeconds >= 45 && diffSeconds <= 89) { + } else if (diffSeconds >= 45 && diffSeconds <= 89) { outStr = `1分钟${suffix}`; if (m.includes('%m')) { outStr = m; @@ -705,254 +856,214 @@ class KuxDayjs { outStr = outStr.replace('%yy', `${diffYears}`); } } - + return outStr; }; - - /** - * 相对当前时间(前) - * @description 返回现在到当前实例的相对时间 - * @param {FromNowOptions} options 配置项 - * + isSuffix - boolean类型,是否自动携带后缀,为true的时候会自动添加“前”后缀,如 1年前;手动指定 `relativeTime` 时该项不生效 - * + relativeTime - RelativeTime类型,自定义格式,支持变量见下方说明 - * | 范围 | 键量 | 使用变量 | 说明 | 示例 | - * | --- | --- | --- | --- | --- | - * | 0 to 44seconds | s | %s | 几秒前 | %s seconds ago | - * | 45 to 89 seconds | m | %m | 1分钟前 | %m minute ago | - * | 90 seconds to 44 minutes | mm | %mm | 几分钟前 | %mm minutes ago | - * | 45 to 89 minutes | h | %h | 1小时前 | %h hour ago | - * | 90 minutes to 21 hours | hh | %hh | 几小时前 | %hh hours ago | - * | 22 to 35 hours | d | d | %d | 1天前 | %d day ago | - * | 36 hours to 25 days | dd | %dd | 几天前 | %dd days ago | - * | 26 to 45 days | mon | %mon | 1个月前 | %mon month ago | - * | 46 days to 10 months | mons | %mons | 几个月前 | %mons months ago | - * | 11 months to 17 months | y | %y | 1年前 | %y year ago | - * | 18 months + | yy | %yy | 几年前 | %yy years ago | - * - * @returns string - * - * @example - * ### 基本示例 - * const datetime = dayjs('2021-12-12 15:43:58'); - * console.log(datetime.fromNow()); // 输出 1年前 - * - * ### 自定义格式示例 - * const datetime = dayjs('2021-12-12 15:43:58'); - * const options: FromNowOptions = { - * isSuffix: false, - * relativeTime: { - * y: '%s year ago' - * } as RelativeTime - * }; - * console.log(datetime.fromNow(options)); // 输出 1 year ago - */ - fromNow (options: FromToOptions = { - isSuffix: false, - relativeTime: { - s: '', - m: '', - mm: '', - h: '', - hh: '', - d: '', - dd: '', - mon: '', - mons: '', - y: '', - yy: '' - } - } as FromToOptions): string { + + private _fromNow(options : FromToOptions) : string { return this._fromOrto(new Date(), options); - }; - - /** - * 相对指定时间(前) - * @description 返回 X 到当前实例的相对时间 - * @param {FromNowOptions} options 配置项 - * + isSuffix - boolean类型,是否自动携带后缀,为true的时候会自动添加“前”后缀,如 1年前;手动指定 `relativeTime` 时该项不生效 - * + relativeTime - RelativeTime类型,自定义格式,支持变量见下方说明 - * | 范围 | 键量 | 使用变量 | 说明 | 示例 | - * | --- | --- | --- | --- | --- | - * | 0 to 44seconds | s | %s | 几秒前 | %s seconds ago | - * | 45 to 89 seconds | m | %m | 1分钟前 | %m minute ago | - * | 90 seconds to 44 minutes | mm | %mm | 几分钟前 | %mm minutes ago | - * | 45 to 89 minutes | h | %h | 1小时前 | %h hour ago | - * | 90 minutes to 21 hours | hh | %hh | 几小时前 | %hh hours ago | - * | 22 to 35 hours | d | d | %d | 1天前 | %d day ago | - * | 36 hours to 25 days | dd | %dd | 几天前 | %dd days ago | - * | 26 to 45 days | mon | %mon | 1个月前 | %mon month ago | - * | 46 days to 10 months | mons | %mons | 几个月前 | %mons months ago | - * | 11 months to 17 months | y | %y | 1年前 | %y year ago | - * | 18 months + | yy | %yy | 几年前 | %yy years ago | - * - * @returns string - * - * @example - * ### 基本示例 - * const datetime = dayjs('2021-12-12 15:43:58'); - * const a = dayjs('2022-12-12'); - * console.log(datetime.from(a)); // 输出 1年前 - * - * ### 自定义格式示例 - * const datetime = dayjs('2021-12-12 15:43:58'); - * const a = dayjs('2022-12-12'); - * const options: FromNowOptions = { - * isSuffix: false, - * relativeTime: { - * y: '%s year ago' - * } as RelativeTime - * }; - * console.log(datetime.from(a, options)); // 输出 1 year ago - */ - from (dayjs: KuxDayjs, options: FromToOptions = { - isSuffix: false, - relativeTime: { - s: '', - m: '', - mm: '', - h: '', - hh: '', - d: '', - dd: '', - mon: '', - mons: '', - y: '', - yy: '' - } - } as FromToOptions): string { + } + + fromNow() : string + + // #ifndef APP-HARMONY + fromNow(options : FromToOptions | null) : string { + return this._fromNow(options ?? { + isSuffix: false, + relativeTime: { + s: '', + m: '', + mm: '', + h: '', + hh: '', + d: '', + dd: '', + mon: '', + mons: '', + y: '', + yy: '' + } + } as FromToOptions) + } + // #endif + // #ifdef APP-HARMONY + fromNow(options ?: FromToOptions | null) : string { + return this._fromNow(options ?? { + isSuffix: false, + relativeTime: { + s: '', + m: '', + mm: '', + h: '', + hh: '', + d: '', + dd: '', + mon: '', + mons: '', + y: '', + yy: '' + } + } as FromToOptions) + } + // #endif + + private _from(dayjs : IKuxDayjs, options : FromToOptions) : string { return this._fromOrto(dayjs.d, options); } - - /** - * 相对当前时间(后) - * @description 返回当前实例到现在的相对时间 - * @param {FromNowOptions} options 配置项 - * + isSuffix - boolean类型,是否自动携带后缀,为true的时候会自动添加“后”后缀,如 1年后;手动指定 `relativeTime` 时该项不生效 - * + relativeTime - RelativeTime类型,自定义格式,支持变量见下方说明 - * | 范围 | 键量 | 使用变量 | 说明 | 示例 | - * | --- | --- | --- | --- | --- | - * | 0 to 44seconds | s | %s | 几秒后 | %s seconds after | - * | 45 to 89 seconds | m | %m | 1分钟后 | %m minute after | - * | 90 seconds to 44 minutes | mm | %mm | 几分钟后 | %mm minutes after | - * | 45 to 89 minutes | h | %h | 1小时后 | %h hour after | - * | 90 minutes to 21 hours | hh | %hh | 几小时后 | %hh hours after | - * | 22 to 35 hours | d | d | %d | 1天后 | %d day after | - * | 36 hours to 25 days | dd | %dd | 几天后 | %dd days after | - * | 26 to 45 days | mon | %mon | 1个月后 | %mon month after | - * | 46 days to 10 months | mons | %mons | 几个月后 | %mons months after | - * | 11 months to 17 months | y | %y | 1年后 | %y year after | - * | 18 months + | yy | %yy | 几年后 | %yy years after | - * - * @returns string - * - * @example - * ### 基本示例 - * const datetime = dayjs('2021-12-12 15:43:58'); - * console.log(datetime.toNow()); // 输出 1年后 - * - * ### 自定义格式示例 - * const datetime = dayjs('2021-12-12 15:43:58'); - * const options: FromToOptions = { - * isSuffix: false, - * relativeTime: { - * y: '%s year after' - * } as RelativeTime - * }; - * console.log(datetime.toNow(options)); // 输出 1 year after - */ - toNow (options: FromToOptions = { - isSuffix: false, - relativeTime: { - s: '', - m: '', - mm: '', - h: '', - hh: '', - d: '', - dd: '', - mon: '', - mons: '', - y: '', - yy: '' - } - } as FromToOptions): string { + + from(dayjs : IKuxDayjs) : string + + // #ifndef APP-HARMONY + from(dayjs : IKuxDayjs, options : FromToOptions | null) : string { + return this._from(dayjs, options ?? { + isSuffix: false, + relativeTime: { + s: '', + m: '', + mm: '', + h: '', + hh: '', + d: '', + dd: '', + mon: '', + mons: '', + y: '', + yy: '' + } + } as FromToOptions); + } + // #endif + // #ifdef APP-HARMONY + from(dayjs : IKuxDayjs, options ?: FromToOptions | null) : string { + return this._from(dayjs, options ?? { + isSuffix: false, + relativeTime: { + s: '', + m: '', + mm: '', + h: '', + hh: '', + d: '', + dd: '', + mon: '', + mons: '', + y: '', + yy: '' + } + } as FromToOptions); + } + // #endif + + private _toNow(options : FromToOptions) : string { return this._fromOrto(new Date(), options); } - - /** - * 相对指定时间(后) - * @description 返回当前实例到 X 的相对时间 - * @param {FromNowOptions} options 配置项 - * + isSuffix - boolean类型,是否自动携带后缀,为true的时候会自动添加“前”后缀,如 1年后;手动指定 `relativeTime` 时该项不生效 - * + relativeTime - RelativeTime类型,自定义格式,支持变量见下方说明 - * | 范围 | 键量 | 使用变量 | 说明 | 示例 | - * | --- | --- | --- | --- | --- | - * | 0 to 44seconds | s | %s | 几秒后 | %s seconds after | - * | 45 to 89 seconds | m | %m | 1分钟后 | %m minute after | - * | 90 seconds to 44 minutes | mm | %mm | 几分钟后 | %mm minutes after | - * | 45 to 89 minutes | h | %h | 1小时后 | %h hour after | - * | 90 minutes to 21 hours | hh | %hh | 几小时后 | %hh hours after | - * | 22 to 35 hours | d | d | %d | 1天后 | %d day after | - * | 36 hours to 25 days | dd | %dd | 几天后 | %dd days after | - * | 26 to 45 days | mon | %mon | 1个月后 | %mon month after | - * | 46 days to 10 months | mons | %mons | 几个月后 | %mons months after | - * | 11 months to 17 months | y | %y | 1年后 | %y year after | - * | 18 months + | yy | %yy | 几年后 | %yy years after | - * - * @returns string - * - * @example - * ### 基本示例 - * const datetime = dayjs('2021-12-12 15:43:58'); - * const a = dayjs('2022-12-12'); - * console.log(datetime.to(a)); // 输出 1年后 - * - * ### 自定义格式示例 - * const datetime = dayjs('2021-12-12 15:43:58'); - * const a = dayjs('2022-12-12'); - * const options: FromToOptions = { - * isSuffix: false, - * relativeTime: { - * y: '%s year after' - * } as RelativeTime - * }; - * console.log(datetime.to(a, options)); // 输出 1 year after - */ - to (date: KuxDayjs, options: FromToOptions = { - isSuffix: false, - relativeTime: { - s: '', - m: '', - mm: '', - h: '', - hh: '', - d: '', - dd: '', - mon: '', - mons: '', - y: '', - yy: '' - } - } as FromToOptions): string { + + toNow() : string + + // #ifndef APP-HARMONY + toNow(options : FromToOptions | null) : string { + return this._toNow(options ?? { + isSuffix: false, + relativeTime: { + s: '', + m: '', + mm: '', + h: '', + hh: '', + d: '', + dd: '', + mon: '', + mons: '', + y: '', + yy: '' + } + } as FromToOptions); + } + // #endif + // #ifdef APP-HARMONY + toNow(options ?: FromToOptions | null) : string { + return this._toNow(options ?? { + isSuffix: false, + relativeTime: { + s: '', + m: '', + mm: '', + h: '', + hh: '', + d: '', + dd: '', + mon: '', + mons: '', + y: '', + yy: '' + } + } as FromToOptions); + } + // #endif + + private _to(date: IKuxDayjs, options : FromToOptions) : string { return this._fromOrto(date.d, options); } - + + to(date: IKuxDayjs) : string + + // #ifndef APP-HARMONY + to(date: IKuxDayjs, options : FromToOptions | null) : string { + return this._to(date, options ?? { + isSuffix: false, + relativeTime: { + s: '', + m: '', + mm: '', + h: '', + hh: '', + d: '', + dd: '', + mon: '', + mons: '', + y: '', + yy: '' + } + } as FromToOptions); + } + // #endif + // #ifdef APP-HARMONY + to(date: IKuxDayjs, options ?: FromToOptions | null) : string { + return this._to(date, options ?? { + isSuffix: false, + relativeTime: { + s: '', + m: '', + mm: '', + h: '', + hh: '', + d: '', + dd: '', + mon: '', + mons: '', + y: '', + yy: '' + } + } as FromToOptions); + } + // #endif + /** * Unix时间戳(毫秒) * @description 返回当前实例的 UNIX 时间戳,13位数字,毫秒 */ - valueOf (): number { + valueOf() : number { return this.d.getTime(); } - + /** * Unix时间戳 * @description 返回当前实例的 UNIX 时间戳,10位数字,秒。 */ - unix (): number { + unix() : number { return Math.floor(this.valueOf() / 1000); } - + /** * 是否闰年 * @description 查询 KuxDayjs 对象的年份是否是闰年 @@ -961,10 +1072,10 @@ class KuxDayjs { * const date = dayjs('2000-01-01'); * console.log(date.isLeapYear()); // 输出 true */ - isLeapYear (): boolean { + isLeapYear() : boolean { return (this.dd.year % 4 == 0 && this.dd.year % 100 != 0) || this.dd.year % 400 == 0; } - + /** * 获取月天数 * @description 获取当前月份包含的天数 @@ -972,24 +1083,24 @@ class KuxDayjs { * const date = dayjs('2023-12-12'); * console.log(date.daysInMonth()); // 输出 31 */ - daysInMonth (): number { - + daysInMonth() : number { + // 如果是闰年,2月有 29 天 if (this.dd.month == 2 && this.isLeapYear()) { return 29; } - + return MONTH_DAYS[this.dd.month - 1]; } - + /** * 转Date * @description 从KuxDayjs中获取原生的Date对象 */ - toDate (): Date { + toDate() : Date { return this.d; } - + /** * 转数组 * @description 返回一个包含各个时间信息的 Array @@ -997,10 +1108,10 @@ class KuxDayjs { * const datetime = dayjs('2023-12-13 10:16:18'); * console.log(datetime.toArray()); // 输出 [2023,12,13,10,16,18,0] */ - toArray(): number[] { + toArray() : number[] { return Array(this.dd.year, this.dd.month, this.dd.date, this.dd.hour, this.dd.minute, this.dd.second, this.dd.millisecond); } - + /** * 转JSON * @description 序列化为 ISO 8601 格式的字符串 @@ -1008,7 +1119,7 @@ class KuxDayjs { * const datetime = dayjs('2023-12-13 10:16:18'); * console.log(datetime.toJSON()); // 输出 2023-12-13T10:16:18.000Z */ - toJSON(): string { + toJSON() : string { const year = `${this.dd.year}`.padStart(2, '0'); const month = `${this.dd.month}`.padStart(2, '0'); const date = `${this.dd.date}`.padStart(2, '0'); @@ -1016,10 +1127,10 @@ class KuxDayjs { const minutes = `${this.dd.minute}`.padStart(2, '0'); const seconds = `${this.dd.second}`.padStart(2, '0'); const milliseconds = `${this.dd.millisecond}`.padStart(3, '0'); - + return `${year}-${month}-${date}T${hours}:${minutes}:${seconds}.${milliseconds}Z`; } - + /** * 转对象 * @description 返回包含时间信息的 Object @@ -1027,7 +1138,7 @@ class KuxDayjs { * const datetime = dayjs('2023-12-13 10:16:18'); * console.log(datetime.toObject()); // 输出 {"date":13,"hours":10,"milliseconds":0,"minutes":16,"months":12,"seconds":18,"years":2023} */ - toObject(): DatetimeOptions { + toObject() : DatetimeOptions { return { years: this.dd.year, months: this.dd.month, @@ -1038,7 +1149,7 @@ class KuxDayjs { milliseconds: this.dd.millisecond } as DatetimeOptions; } - + /** * 转字符串 * @description 返回包含时间信息的"RFC 822" 或 "RFC 5322" 格式字符串 @@ -1046,7 +1157,7 @@ class KuxDayjs { * const datetime = dayjs('2023-12-13 10:16:18'); * console.log(datetime.toRFCString()); // 输出 Wed, 13 Dec 2023 10:16:18 GMT */ - toRFCString (): string { + toRFCString() : string { const weekday = WEEKDAYS[this.toDate().getDay()]; const year = `${this.dd.year}`; const month = MONTHS[this.toDate().getMonth()]; @@ -1054,13 +1165,13 @@ class KuxDayjs { const hours = `${this.dd.hour}`.padStart(2, '0'); const minutes = `${this.dd.minute}`.padStart(2, '0'); const seconds = `${this.dd.second}`.padStart(2, '0'); - + return `${weekday}, ${day} ${month} ${year} ${hours}:${minutes}:${seconds} GMT`; } - - private _isGetDate (dayjs: KuxDayjs, unit: DiffUnit = 'ms'): Date { - let date: Date; - + + private _isGetDate(dayjs : IKuxDayjs, unit : DiffUnit = 'ms') : Date { + let date : Date; + const year = dayjs.dd.year; const month = dayjs.dd.month; const day = dayjs.dd.date; @@ -1068,217 +1179,256 @@ class KuxDayjs { const minute = dayjs.dd.minute; const second = dayjs.dd.second; const millsecond = dayjs.dd.millisecond; - - if (unit === 'year' || unit === 'y') { + + if (unit == 'year' || unit == 'y') { date = new Date(year, 0, 0, 0, 0, 0, 0); - } else if (unit === 'month' || unit === 'M') { + } else if (unit == 'month' || unit == 'M') { date = new Date(year, month - 1); - } else if (unit === 'day' || unit === 'd') { + } else if (unit == 'day' || unit == 'd') { date = new Date(year, month - 1, day); - } else if (unit === 'hour' || unit === 'h') { + } else if (unit == 'hour' || unit == 'h') { date = new Date(year, month - 1, day, hour); - } else if (unit === 'minute' || unit === 'm') { + } else if (unit == 'minute' || unit == 'm') { date = new Date(year, month - 1, day, hour, minute); - } else if (unit === 'second' || unit === 's') { + } else if (unit == 'second' || unit == 's') { date = new Date(year, month - 1, day, hour, minute, second); } else { date = new Date(year, month - 1, day, hour, minute, second, millsecond); } - + return date; } - - /** - * 是否之前 - * @description 表示 KuxDayjs 对象是否在另一个提供的日期时间之前 - * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 - * @param {DiffUnit} unit 比较单位,默认为ms - * + year - 年,缩写为 `y` - * + month - 月,缩写为 `M` - * + day - 日,缩写为 `d` - * + hour - 小时,缩写为 `h` - * + minute - 分钟,缩写为 `m` - * + second - 秒,缩写为 `s` - * + millisecond - 毫秒,缩写为 `ms` - * @returns {boolean} - * @example - * const datetime = dayjs('2023-12-13 10:16:18'); - * console.log(datetime.isBefore('2024-12-12')); // 输出 true - * console.log(datetime.isBefore('2024-12-12', 'year')); // 输出 true - */ - isBefore (datetime: string, unit: DiffUnit = 'ms'): boolean { - const dayjs = this.dayjs(datetime); + + private _isBefore(datetime : string, unit : DiffUnit) : boolean { + const dayjs = this.clone().dayjs(datetime); const date1 = this._isGetDate(dayjs, unit); - const date2 = this._isGetDate(this.clone(), unit); - - return date2.getTime() < date1.getTime(); + // const date2 = this._isGetDate(this.clone(), unit); + + return this.d.getTime() < date1.getTime(); } - - /** - * 是否相同 - * @description 表示 KuxDayjs 对象是否和另一个提供的日期时间相同 - * @param {string} date 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 - * @param {DatetimeUnit} unit 比较单位,默认为ms - * + year - 年,缩写为 `y` - * + month - 月,缩写为 `M` - * + day - 日,缩写为 `d` - * + hour - 小时,缩写为 `h` - * + minute - 分钟,缩写为 `m` - * + second - 秒,缩写为 `s` - * + millisecond - 毫秒,缩写为 `ms` - * @returns {boolean} - * @example - * const datetime = dayjs('2023-12-13 10:16:18'); - * console.log(datetime.isSame('2023-12-12')); // 输出 false - * console.log(datetime.isSame('2023-12-12', 'year')); // 输出 true - */ - isSame (datetime: string, unit: DatetimeUnit = 'ms'): boolean { - const dayjs = this.dayjs(datetime); - const date1 = this._isGetDate(dayjs, unit); - const date2 = this._isGetDate(this.clone()); - - return date2.getTime() === date1.getTime(); + + isBefore(datetime : string) : boolean + + // #ifndef APP-HARMONY + isBefore(datetime : string, unit : DiffUnit | null) : boolean { + return this._isBefore(datetime, unit ?? 'ms'); } - - /** - * 是否之后 - * @description 表示 KuxDayjs 对象是否在另一个提供的日期时间之后 - * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 - * @param {DatetimeUnit} unit 比较单位,默认为ms - * + year - 年,缩写为 `y` - * + month - 月,缩写为 `M` - * + day - 日,缩写为 `d` - * + hour - 小时,缩写为 `h` - * + minute - 分钟,缩写为 `m` - * + second - 秒,缩写为 `s` - * + millisecond - 毫秒,缩写为 `ms` - * @returns {boolean} - * @example - * const datetime = dayjs('2023-12-13 10:16:18'); - * console.log(datetime.isAfter('2023-12-12')); // 输出 true - * console.log(datetime.isAfter('2023-12-12', 'year')); // 输出 true - */ - isAfter (datetime: string, unit: DatetimeUnit = 'ms'): boolean { - const dayjs = this.dayjs(datetime); - const date1 = this._isGetDate(dayjs, unit); - const date2 = this._isGetDate(this.clone(), unit); - - return date2.getTime() > date1.getTime(); + // #endif + // #ifdef APP-HARMONY + isBefore(datetime : string, unit ?: DiffUnit | null) : boolean { + return this._isBefore(datetime, unit ?? 'ms'); } - - /** - * 是否相同或之前 - * @description 表示 KuxDayjs 对象是和另一个提供的日期时间相同或在其之前 - * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 - * @param {DatetimeUnit} unit 比较单位,默认为ms - * + year - 年,缩写为 `y` - * + month - 月,缩写为 `M` - * + day - 日,缩写为 `d` - * + hour - 小时,缩写为 `h` - * + minute - 分钟,缩写为 `m` - * + second - 秒,缩写为 `s` - * + millisecond - 毫秒,缩写为 `ms` - * @returns {boolean} - * @example - * const datetime = dayjs('2023-12-13 10:16:18'); - * console.log(datetime.isSameOrBefore('2023-12-12')); // 输出 false - * console.log(datetime.isSameOrBefore('2023-12-12', 'year')); // 输出 true - */ - isSameOrBefore (datetime: string, unit: DatetimeUnit = 'ms'): boolean { - const dayjs = this.dayjs(datetime); + // #endif + + private _isSame(datetime : string, unit : DatetimeUnit) : boolean { + const dayjs = this.clone().dayjs(datetime); const date1 = this._isGetDate(dayjs, unit); - const date2 = this._isGetDate(this.clone(), unit); + // const date2 = this._isGetDate(this.clone()); + if (unit == 'y' || unit == 'year') { + return this.d.getFullYear() == date1.getFullYear(); + } + if (unit == 'month' || unit == 'M') { + return this.d.getMonth() == date1.getMonth(); + } + + if (unit == 'day' || unit == 'd') { + return this.d.getDate() == date1.getDate(); + } + + if (unit == 'hour' || unit == 'h') { + return this.d.getHours() == date1.getHours(); + } + + if (unit == 'minute' || unit == 'm') { + return this.d.getMinutes() == date1.getMinutes(); + } + + if (unit == 'second' || unit == 's') { + return this.d.getSeconds() == date1.getSeconds(); + } + + return this.d.getTime() == date1.getTime(); + } + + isSame(datetime : string) : boolean + + // #ifndef APP-HARMONY + isSame(datetime : string, unit : DatetimeUnit | null) : boolean { + return this._isSame(datetime, unit ?? 'ms'); + } + // #endif + // #ifdef APP-HARMONY + isSame(datetime : string, unit ?: DatetimeUnit | null) : boolean { + return this._isSame(datetime, unit ?? 'ms'); + } + // #endif + + private _isAfter(datetime : string, unit : DatetimeUnit) : boolean { + const dayjs = this.clone().dayjs(datetime); + const date1 = this._isGetDate(dayjs, unit); + // const date2 = this._isGetDate(this.clone(), unit); + + return this.d.getTime() > date1.getTime(); + } + + isAfter(datetime : string) : boolean + + // #ifndef APP-HARMONY + isAfter(datetime : string, unit : DatetimeUnit | null) : boolean { + return this._isAfter(datetime, unit ?? 'ms'); + } + // #endif + // #ifdef APP-HARMONY + isAfter(datetime : string, unit ?: DatetimeUnit | null) : boolean { + return this._isAfter(datetime, unit ?? 'ms'); + } + // #endif + + private _isSameOrBefore(datetime : string, unit : DatetimeUnit) : boolean { + const dayjs = this.clone().dayjs(datetime); + const date1 = this._isGetDate(dayjs, unit); + // const date2 = this._isGetDate(this.clone(), unit); + const time1 = date1.getTime(); - const time2 = date2.getTime(); + const time2 = this.d.getTime(); + if (unit == 'y' || unit == 'year') { + return this.d.getFullYear() <= dayjs.dd.year; + } + + if (unit == 'month' || unit == 'M') { + return this.d.getMonth() <= date1.getMonth(); + } + + if (unit == 'day' || unit == 'd') { + return this.d.getDate() <= date1.getDate(); + } + + if (unit == 'hour' || unit == 'h') { + return this.d.getHours() <= date1.getHours(); + } + + if (unit == 'minute' || unit == 'm') { + return this.d.getMinutes() <= date1.getMinutes(); + } + + if (unit == 'second' || unit == 's') { + return this.d.getSeconds() <= date1.getSeconds(); + } + return time2 <= time1; } - - /** - * 是否相同或之后 - * @description 表示 KuxDayjs 对象是否和另一个提供的日期时间相同或在其之后 - * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 - * @param {DatetimeUnit} unit 比较单位,默认为ms - * + year - 年,缩写为 `y` - * + month - 月,缩写为 `M` - * + day - 日,缩写为 `d` - * + hour - 小时,缩写为 `h` - * + minute - 分钟,缩写为 `m` - * + second - 秒,缩写为 `s` - * + millisecond - 毫秒,缩写为 `ms` - * @returns {boolean} - * @example - * const datetime = dayjs('2023-12-13 10:16:18'); - * console.log(datetime.isSameOrAfter('2023-12-12')); // 输出 true - * console.log(datetime.isSameOrAfter('2023-12-12', 'year')); // 输出 true - */ - isSameOrAfter (datetime: string, unit: DatetimeUnit = 'ms'): boolean { - const dayjs = this.dayjs(datetime); + + isSameOrBefore(datetime : string) : boolean + + // #ifndef APP-HARMONY + isSameOrBefore(datetime : string, unit : DatetimeUnit | null) : boolean { + return this._isSameOrBefore(datetime, unit ?? 'ms'); + } + // #endif + // #ifdef APP-HARMONY + isSameOrBefore(datetime : string, unit ?: DatetimeUnit | null) : boolean { + return this._isSameOrBefore(datetime, unit ?? 'ms'); + } + // #endif + + private _isSameOrAfter(datetime : string, unit : DatetimeUnit) : boolean { + const dayjs = this.clone().dayjs(datetime); const date1 = this._isGetDate(dayjs, unit); - const date2 = this._isGetDate(this.clone(), unit); - + // const date2 = this._isGetDate(this.clone(), unit); + const time1 = date1.getTime(); - const time2 = date2.getTime(); + const time2 = this.d.getTime(); + if (unit == 'y' || unit == 'year') { + return this.d.getFullYear() >= dayjs.dd.year; + } + + if (unit == 'month' || unit == 'M') { + return this.d.getMonth() >= date1.getMonth(); + } + + if (unit == 'day' || unit == 'd') { + return this.d.getDate() >= date1.getDate(); + } + + if (unit == 'hour' || unit == 'h') { + return this.d.getHours() >= date1.getHours(); + } + + if (unit == 'minute' || unit == 'm') { + return this.d.getMinutes() >= date1.getMinutes(); + } + + if (unit == 'second' || unit == 's') { + return this.d.getSeconds() >= date1.getSeconds(); + } + return time2 >= time1; } - - /** - * 是否两者之间 - * @description 表示 KuxDayjs 对象是否在其他两个的日期时间之间 - * @param {string} datetime1 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 - * @param {string} datetime2 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 - * @param {DatetimeUnit} unit 比较单位,默认为 `ms` - * + year - 年,缩写为 `y` - * + month - 月,缩写为 `M` - * + day - 日,缩写为 `d` - * + hour - 小时,缩写为 `h` - * + minute - 分钟,缩写为 `m` - * + second - 秒,缩写为 `s` - * + millisecond - 毫秒,缩写为 `ms` - * @param {IsBetweenContains} contains 包含关系,见下方说明 - * + `[` - 向前包含,等同于 `<=` - * + `]` - 向后包含,等同于 `>=` - * + `[]` - 前后都包含 - * @returns {boolean} - * @example - * const date = dayjs('2023-12-13'); - * console.log(date.isBetween('2023-12-13', '2023-12-14', 'day')); // 输出 false - * console.log(date.isBetween('2023-12-13', '2023-12-14', 'day', '[')); // 输出 true - */ - isBetween (datetime1: string, datetime2: string, unit: DatetimeUnit = 'ms', contains: IsBetweenContains = ''): boolean { - const dayjs1 = this.dayjs(datetime1); + + isSameOrAfter(datetime : string) : boolean + + // #ifndef APP-HARMONY + isSameOrAfter(datetime : string, unit : DatetimeUnit | null) : boolean { + return this._isSameOrAfter(datetime, unit ?? 'ms'); + } + // #endif + // #ifdef APP-HARMONY + isSameOrAfter(datetime : string, unit ?: DatetimeUnit | null) : boolean { + return this._isSameOrAfter(datetime, unit ?? 'ms'); + } + // #endif + + private _isBetween(datetime1 : string, datetime2 : string, unit : DatetimeUnit, contains : IsBetweenContains) : boolean { + const dayjs1 = this.clone().dayjs(datetime1); const date1 = this._isGetDate(dayjs1, unit); - + const dayjs2 = this.dayjs(datetime2); const date2 = this._isGetDate(dayjs2, unit); - - const date3 = this._isGetDate(this.clone(), unit); - + + // const date3 = this._isGetDate(this.clone(), unit); + const time1 = date1.getTime(); const time2 = date2.getTime(); - const time3 = date3.getTime(); - + const time3 = this.d.getTime(); + // 向前包含 - if (contains === '[') { + if (contains == '[') { return time3 >= time1 && time3 < time2; } - + // 向后包含 - if (contains === ']') { + if (contains == ']') { return time3 > time1 && time3 <= time2; } - + // 前后都包含 - if (contains === '[]') { + if (contains == '[]') { return time3 >= time1 && time3 <= time2; } - + // 前后都不包含 return time3 > time1 && time3 < time2; } + + isBetween(datetime1 : string, datetime2 : string) : boolean + + isBetween(datetime1 : string, datetime2 : string, unit : DatetimeUnit | null) : boolean + + // #ifndef APP-HARMONY + isBetween(datetime1 : string, datetime2 : string, unit : DatetimeUnit | null, contains : IsBetweenContains | null) : boolean { + return this._isBetween(datetime1, datetime2, unit ?? 'ms', contains ?? ''); + } + // #endif + // #ifdef APP-HARMONY + isBetween(datetime1 : string, datetime2 : string, unit ?: DatetimeUnit | null, contains ?: IsBetweenContains | null) : boolean { + return this._isBetween(datetime1, datetime2, unit ?? 'ms', contains ?? ''); + } + + // #endif /** * 是否是Dayjs * @description 这表示一个变量是否为 KuxDayjs 对象 @@ -1289,14 +1439,26 @@ class KuxDayjs { * console.log(now.isDayjs(dayjs())); // 输出 true * console.log(now.isDayjs(new Date())); // 输出 false */ - isDayjs (dayjs: any): boolean { + isDayjs(dayjs : any) : boolean { + // #ifndef APP-ANDROID return dayjs instanceof KuxDayjs; + // #endif + // #ifdef APP-ANDROID + return dayjs instanceof IKuxDayjs; + // #endif } }; -export function dayjs (date: string = ''): KuxDayjs { - return new KuxDayjs(date); +/** + * 创建的KuxDayjs实例 + * @param {string} date 日期时间戳字符串,如果是想初始化时间戳可以直接把时间戳通过字符串形式传入。时间戳为毫秒形式 + * @param {boolean} isTimestamp 是否是时间戳格式 + * @param {boolean} isCST 是否是中国标准时间,既UTC时间+8小时,`isTimestamp` 为 `true` 时生效,默认为 `true` + * @returns KuxDayjs实例 + */ +export function dayjs(date : string = '', isTimestamp : boolean = false, isCST : boolean = true) : IKuxDayjs { + return new KuxDayjs(date, isTimestamp, isCST); }; // 导出类型 -export * from '../utssdk/interface'; \ No newline at end of file +// export * from '../utssdk/interface'; \ No newline at end of file diff --git a/uni_modules/kux-dayjs/common/utils.uts b/uni_modules/kux-dayjs/common/utils.uts new file mode 100644 index 0000000..3620dfc --- /dev/null +++ b/uni_modules/kux-dayjs/common/utils.uts @@ -0,0 +1,12 @@ +// #ifdef APP-ANDROID +import MathFloor from 'kotlin.math.floor'; +// #endif + +export const floor = (value: number): number => { + // #ifndef APP-ANDROID + return Math.floor(value); + // #endif + // #ifdef APP-ANDROID + return Number.from(MathFloor(value.toDouble())); + // #endif +} \ No newline at end of file diff --git a/uni_modules/kux-dayjs/package.json b/uni_modules/kux-dayjs/package.json index 71cc65b..fdfcb00 100644 --- a/uni_modules/kux-dayjs/package.json +++ b/uni_modules/kux-dayjs/package.json @@ -1,18 +1,19 @@ { "id": "kux-dayjs", "displayName": "kux-dayjs", - "version": "1.0.0", - "description": "一个极简的 `uts` 库,API 设计完全参考 `dayjs` 的设计、所以上手该库基本零成本了,方便开发者们验证、操作和显示日期和时间。", + "version": "1.0.6", + "description": "是一个极简的 uts 库,API 设计完全参考 dayjs 的设计、所以上手该库基本零成本了,方便开发者们验证、操作和显示日期和时间。", "keywords": [ - "时间", - "日期", - "格式化", - "day", - "date" + "kux-dayjs", + "dayjs", + "时间格式化", + "日期" ], - "repository": "https://gitcode.net/kviewui/kviewui-x", + "repository": "https://gitcode.com/kviewui/kux-dayjs", "engines": { - "HBuilderX": "^3.6.8" + "HBuilderX": "^3.6.8", + "uni-app": "^4.66", + "uni-app-x": "^4.66" }, "dcloudext": { "type": "uts", @@ -32,54 +33,69 @@ "data": "插件不采集任何数据", "permissions": "无" }, - "npmurl": "" + "npmurl": "", + "darkmode": "x", + "i18n": "x", + "widescreen": "x" }, "uni_modules": { "dependencies": [], "encrypt": [], "platforms": { "cloud": { - "tcb": "y", - "aliyun": "y" + "tcb": "√", + "aliyun": "√", + "alipay": "x" }, "client": { - "Vue": { - "vue2": "n", - "vue3": "y" + "uni-app": { + "vue": { + "vue2": "-", + "vue3": "-" + }, + "web": { + "safari": "-", + "chrome": "-" + }, + "app": { + "vue": "-", + "nvue": "-", + "android": "-", + "ios": "-", + "harmony": "-" + }, + "mp": { + "weixin": "-", + "alipay": "-", + "toutiao": "-", + "baidu": "-", + "kuaishou": "-", + "jd": "-", + "harmony": "-", + "qq": "-", + "lark": "-" + }, + "quickapp": { + "huawei": "-", + "union": "-" + } }, - "App": { - "app-android": { - "minVersion": "19" - }, - "app-ios": "n" - }, - "H5-mobile": { - "Safari": "n", - "Android Browser": "n", - "微信浏览器(Android)": "n", - "QQ浏览器(Android)": "n" - }, - "H5-pc": { - "Chrome": "n", - "IE": "n", - "Edge": "n", - "Firefox": "n", - "Safari": "n" - }, - "小程序": { - "微信": "n", - "阿里": "n", - "百度": "n", - "字节跳动": "n", - "QQ": "n", - "钉钉": "n", - "快手": "n", - "飞书": "n", - "京东": "n" - }, - "快应用": { - "华为": "n", - "联盟": "n" + "uni-app-x": { + "web": { + "safari": "√", + "chrome": "√" + }, + "app": { + "android": { + "extVersion": "", + "minVersion": "21" + }, + "ios": "√", + "harmony": "√" + }, + "mp": { + "weixin": "√" + } } } } diff --git a/uni_modules/kux-dayjs/readme.md b/uni_modules/kux-dayjs/readme.md index 059a805..1597e7a 100644 --- a/uni_modules/kux-dayjs/readme.md +++ b/uni_modules/kux-dayjs/readme.md @@ -1,13 +1,17 @@ # kux-dayjs `KuxDayjs` 是一个极简的 `uts` 库,API 设计完全参考 `dayjs` 的设计、所以上手该库基本零成本了,方便开发者们验证、操作和显示日期和时间。 +## 开源地址:[https://gitcode.com/kviewui/kux-dayjs](https://gitcode.com/kviewui/kux-dayjs) + ## 目录结构 -
    +
+ -### 导入插件 +### 导入插件 ```ts import { dayjs } from '@/uni_modules/kux-dayjs'; ``` -### 解析 +### 解析 -#### 实例 +#### 实例 代替修改本地Date.prototype,`KuxDayjs` 对 `Date` 对象进行了封装,只需要调用 `dayjs()` 即可 `KuxDayjs` 对象是不可变的,也就是说,以某种方式改变 `KuxDayjs` 对象的所有API操作都将返回它的一个新实例。 -#### 当前时间 +#### 当前时间 直接调用 `dayjs()` 将返回一个包含当前日期和时间的 `KuxDayjs` 对象。 ```ts const now = dayjs(); ``` >目前仅支持传入 `YYYY-MM-DD HH:mm:ss.S` 格式的日期时间字符串 +> +> `1.0.2` 及以上版本支持字符串解析。请看 [字符串](#parse_string) + + +#### 字符串 +`1.0.2` 及以上版本开始支持字符串解析,支持各种主流字符串格式,具体如下: + ++ YYYY-MM-DD ++ YYYY/MM/DD ++ YYYY-MM-DD HH ++ YYYY-MM-DD HH:MM ++ YYYY-MM-DD HH:MM:SS ++ YYYY-MM-DD HH:MM:SS.millis ++ YYYY/MM/DD HH ++ YYYY/MM/DD HH:MM ++ YYYY/MM/DD HH:MM:SS ++ YYYY/MM/DD HH:MM:SS.millis ++ ISO 8601 格式(包括 UTC 时间) + +示例代码 + +``` +console.log(dayjs('2023-12-13').format('YYYY-MM-DD')); +console.log(dayjs('2024/01/01').format('YYYY-MM-DD')); +console.log(dayjs('2023-12-13 12:23').format('YYYY-MM-DD HH:mm')); +console.log(dayjs('2023-12-13 12:23:45').format('YYYY-MM-DD HH:mm:ss')); +console.log(dayjs('2023-12-12 19:35:35.123').format('YYYY-MM-DD HH:mm:ss.SSS')); +console.log(dayjs('2023-12-13T10:16:18.000Z').format('YYYY-MM-DD HH:mm:ss')); +console.log(dayjs('2023-12-13T12:25:36.567+08:00').format('YYYY-MM-DD HH:mm:ss.SSS')); +console.log(dayjs(`${dayjs().valueOf()}`, true).format('YYYY-MM-DD HH:mm:ss')); +console.log(dayjs('1683234305000', true).format('YY-MM-DD HH:mm:ss')); +``` +> **参数说明** +> +> 初始化参数目前为三个,见下面表格 +> +> | 参数名 | 类型 | 必填 | 默认值 | 说明 +> | --- | --- | --- | --- | --- +> | date | string | 否 | | 日期时间字符串,支持字符串格式的时间戳解析 +> | isTimestamp | boolean | 否 | false | 是否为时间戳,是的话内部会自动转为整数作为时间戳解析 +> | isCST | boolean | 否 | true | 是否是中国标准时间,既UTC时间+8小时,`isTimestamp` 为 `true` 时生效,默认为 `true` -#### 克隆复制 +#### 克隆复制 所有的 `KuxDayjs` 对象都是不可变的。 但如果有必要,使用 `dayjs().clone()` 可以复制出一个当前对象。 ```ts const a = dayjs(); @@ -98,11 +157,11 @@ const b = a.clone(); // a 和 b 是两个独立的 KuxDayjs 对象 ``` -### 取值/赋值 +### 取值/赋值 -#### 毫秒 +#### 毫秒 获取或设置毫秒。
传入0到999的数字。 如果超出这个范围,它会进位到秒。 ```ts @@ -110,8 +169,8 @@ dayjs().millisecond() dayjs().millisecond(1) ``` -#### 秒 +#### 秒 获取或设置秒。
传入0到59的数字。 如果超出这个范围,它会进位到分钟。 ```ts @@ -119,8 +178,8 @@ dayjs().second() dayjs().second(1) ``` -#### 分钟 +#### 分钟 获取或设置分钟。
传入0到59的数字。 如果超出这个范围,它会进位到小时。 ```ts @@ -128,8 +187,8 @@ dayjs().minute() dayjs().minute(59) ``` -#### 小时 +#### 小时 获取或设置小时。
传入0到23的数字。 如果超出这个范围,它会进位到天数。 ```ts @@ -137,8 +196,8 @@ dayjs().hour() dayjs().hour(12) ``` -#### 日期 +#### 日期 获取或设置日期。
传入1到31的数字。 如果超出这个范围,它会进位到月份。 ```ts @@ -147,8 +206,8 @@ dayjs().date(1) ``` > ****注意****
`dayjs().date()` 是该月的日期。`dayjs().day()` 是星期几。 -#### 星期 +#### 星期 获取或设置星期几。
传入 number 从0(星期天)到6(星期六)。 如果超出这个范围,它会进位到其他周。 ```ts @@ -157,8 +216,8 @@ dayjs().day(0) ``` > ****注意****
`dayjs().date()` 是该月的日期。`dayjs().day()` 是星期几。 -#### 时间 +#### 时间 获取或设置时间。
传入一个整数,表示从 1970-1-1 00:00:00 UTC 开始计时的毫秒数。 传入参数就是设置操作,否则为获取操作。 ```ts @@ -166,8 +225,8 @@ dayjs().time() dayjs().time(1) ``` -#### 月 +#### 月 获取或设置月份。
传入0到11的 number。 如果超出这个范围,它会进位到年份。 ```ts @@ -176,24 +235,24 @@ dayjs().month(0) ``` > ****注意****
月份是从 0 开始计算的,即 1 月是 0。 -#### 年 +#### 年 获取或设置年份。
```ts dayjs().year() dayjs().year(2000) ``` -### 操作 +### 操作 您可能需要一些方法来操作 `KuxDayjs` 对象。
`KuxDayjs` 支持像这样的链式调用。 ```ts dayjs('2019-01-25').add(1, 'day').subtract(1, 'year').year(2009); ``` -#### 增加 +#### 增加 返回增加一定时间的复制的 `KuxDayjs` 对象。 ```ts dayjs().add(7, 'day') @@ -208,8 +267,8 @@ dayjs().add(7, 'day') + second 秒,缩写 `s` + millisecond 毫秒,缩写 `ms` -#### 减去 +#### 减去 返回减去一定时间的复制的 `KuxDayjs` 对象。 ```ts dayjs().subtract(7, 'day') @@ -224,15 +283,15 @@ dayjs().subtract(7, 'day') + second 秒,缩写 `s` + millisecond 毫秒,缩写 `ms` -#### 今天 +#### 今天 返回设置时间为今天的复制的 `KuxDayjs` 对象。 ```ts dayjs().today() ``` -#### 时间的开始 +#### 时间的开始 返回复制的 `KuxDayjs` 对象,并设置到一个时间的开始。 ```ts dayjs().startOf('year') @@ -249,8 +308,8 @@ dayjs().startOf('year') >****注意****
暂时不支持跨年操作。 -#### 时间的结束 +#### 时间的结束 返回复制的 `KuxDayjs` 对象,并设置到一个时间的末尾。 ```ts dayjs().endOf('month') @@ -267,12 +326,12 @@ dayjs().endOf('month') >****注意****
暂时不支持跨年操作。 -### 显示 +### 显示 当解析和操作完成后,您需要一些方式来展示 `KuxDayjs` 对象。 -#### 格式化 +#### 格式化 根据传入的占位符返回格式化后的日期。 ```ts dayjs().format('YYYY-MM-DD HH:mm:ss') @@ -284,6 +343,7 @@ dayjs().format('YYYY-MM-DD HH:mm:ss A') | 标识 | 示例 | 描述 | | --- | --- | --- | | YYYY | 2023 | 年份,四位数 | +| YY | 23 | 年份,两位数 | | MM | 12 | 月份 | | DD | 01 | 日,两位数 | | HH | 22 | 小时,两位数 | @@ -294,8 +354,8 @@ dayjs().format('YYYY-MM-DD HH:mm:ss A') | a | am/pm | 上/下午,小写 | | AA | 上/下午 | 上/下午 | -#### 相对当前时间(前) +#### 相对当前时间(前) 返回现在到当前实例的相对时间。 ```ts dayjs('2021-12-12').fromNow(); // 1年前 @@ -308,22 +368,22 @@ dayjs('2021-12-12').fromNow(); // 1年前 | relativeTime | `{s: '', m: '', mm: '', h: '', hh: '', d: '', dd: '', mon: '', mons: '', y: '', yy: ''}` | 自定义格式,变量说明见下方说明 | #### RelativeTime 说明 -| 范围 | 键量 | 使用变量 | 说明 | 示例 | +| 范围 | 键值 | 使用变量 | 说明 | 示例 | | --- | --- | --- | --- | --- | | 0 to 44seconds | s | %s | 几秒前 | %s seconds ago | | 45 to 89 seconds | m | %m | 1分钟前 | %m minute ago | | 90 seconds to 44 minutes | mm | %mm | 几分钟前 | %mm minutes ago | | 45 to 89 minutes | h | %h | 1小时前 | %h hour ago | | 90 minutes to 21 hours | hh | %hh | 几小时前 | %hh hours ago | -| 22 to 35 hours | d | d | %d | 1天前 | %d day ago | +| 22 to 35 hours | d | %d | 1天前 | %d day ago | | 36 hours to 25 days | dd | %dd | 几天前 | %dd days ago | | 26 to 45 days | mon | %mon | 1个月前 | %mon month ago | | 46 days to 10 months | mons | %mons | 几个月前 | %mons months ago | | 11 months to 17 months | y | %y | 1年前 | %y year ago | | 18 months + | yy | %yy | 几年前 | %yy years ago | -#### 相对指定时间(前) +#### 相对指定时间(前) 返回 X 到当前实例的相对时间。 ```ts const datetime = dayjs('2021-12-12 15:43:58'); @@ -338,22 +398,22 @@ datetime.from(a); // 1年前 | relativeTime | `{s: '', m: '', mm: '', h: '', hh: '', d: '', dd: '', mon: '', mons: '', y: '', yy: ''}` | 自定义格式,变量说明见下方说明 | #### RelativeTime 说明 -| 范围 | 键量 | 使用变量 | 说明 | 示例 | +| 范围 | 键值 | 使用变量 | 说明 | 示例 | | --- | --- | --- | --- | --- | | 0 to 44seconds | s | %s | 几秒前 | %s seconds ago | | 45 to 89 seconds | m | %m | 1分钟前 | %m minute ago | | 90 seconds to 44 minutes | mm | %mm | 几分钟前 | %mm minutes ago | | 45 to 89 minutes | h | %h | 1小时前 | %h hour ago | | 90 minutes to 21 hours | hh | %hh | 几小时前 | %hh hours ago | -| 22 to 35 hours | d | d | %d | 1天前 | %d day ago | +| 22 to 35 hours | d | %d | 1天前 | %d day ago | | 36 hours to 25 days | dd | %dd | 几天前 | %dd days ago | | 26 to 45 days | mon | %mon | 1个月前 | %mon month ago | | 46 days to 10 months | mons | %mons | 几个月前 | %mons months ago | | 11 months to 17 months | y | %y | 1年前 | %y year ago | | 18 months + | yy | %yy | 几年前 | %yy years ago | -#### 相对当前时间(后) +#### 相对当前时间(后) 返回当前实例到现在的相对时间。 ```ts dayjs('2021-12-12').toNow(); // 1年后 @@ -366,22 +426,22 @@ dayjs('2021-12-12').toNow(); // 1年后 | relativeTime | `{s: '', m: '', mm: '', h: '', hh: '', d: '', dd: '', mon: '', mons: '', y: '', yy: ''}` | 自定义格式,变量说明见下方说明 | #### RelativeTime 说明 -| 范围 | 键量 | 使用变量 | 说明 | 示例 | +| 范围 | 键值 | 使用变量 | 说明 | 示例 | | --- | --- | --- | --- | --- | | 0 to 44seconds | s | %s | 几秒后 | %s seconds after | | 45 to 89 seconds | m | %m | 1分钟后 | %m minute after | | 90 seconds to 44 minutes | mm | %mm | 几分钟后 | %mm minutes after | | 45 to 89 minutes | h | %h | 1小时后 | %h hour after | | 90 minutes to 21 hours | hh | %hh | 几小时后 | %hh hours after | -| 22 to 35 hours | d | d | %d | 1天后 | %d day after | +| 22 to 35 hours | d | %d | 1天后 | %d day after | | 36 hours to 25 days | dd | %dd | 几天后 | %dd days after | | 26 to 45 days | mon | %mon | 1个月后 | %mon month after | | 46 days to 10 months | mons | %mons | 几个月后 | %mons months after | | 11 months to 17 months | y | %y | 1年后 | %y year after | | 18 months + | yy | %yy | 几年后 | %yy years after | -#### 相对指定时间(后) +#### 相对指定时间(后) 返回当前实例到现在的相对时间。 ```ts const datetime = dayjs('2021-12-12 15:43:58'); @@ -396,22 +456,22 @@ console.log(datetime.to(a)); // 输出 1年后 | relativeTime | `{s: '', m: '', mm: '', h: '', hh: '', d: '', dd: '', mon: '', mons: '', y: '', yy: ''}` | 自定义格式,变量说明见下方说明 | #### RelativeTime 说明 -| 范围 | 键量 | 使用变量 | 说明 | 示例 | +| 范围 | 键值 | 使用变量 | 说明 | 示例 | | --- | --- | --- | --- | --- | | 0 to 44seconds | s | %s | 几秒后 | %s seconds after | | 45 to 89 seconds | m | %m | 1分钟后 | %m minute after | | 90 seconds to 44 minutes | mm | %mm | 几分钟后 | %mm minutes after | | 45 to 89 minutes | h | %h | 1小时后 | %h hour after | | 90 minutes to 21 hours | hh | %hh | 几小时后 | %hh hours after | -| 22 to 35 hours | d | d | %d | 1天后 | %d day after | +| 22 to 35 hours | d | %d | 1天后 | %d day after | | 36 hours to 25 days | dd | %dd | 几天后 | %dd days after | | 26 to 45 days | mon | %mon | 1个月后 | %mon month after | | 46 days to 10 months | mons | %mons | 几个月后 | %mons months after | | 11 months to 17 months | y | %y | 1年后 | %y year after | | 18 months + | yy | %yy | 几年后 | %yy years after | -#### 日历时间 +#### 日历时间 传入指定年月获取指定年月的日历面板数据,指定年月省略时默认获取当年年月的数据。返回 `DateFormat[]`,`DateFormat` 见下方说明。 ```ts dayjs().calendar(); @@ -458,8 +518,8 @@ dayjs().calendar(); | lunarD | `number` | 农历日期数字 | isLeap | `boolean` | 是否闰月 -#### 差异(Diff) +#### 差异(Diff) 返回指定单位下两个日期时间之间的差异。 ```ts const date1 = dayjs('2019-01-25'); @@ -486,70 +546,69 @@ date1.diff('2018-06-05', 'month', true) // 7.645161290322581; + second 秒,缩写 `s` + millisecond 毫秒,缩写 `ms` -#### Unix时间戳(毫秒) +#### Unix时间戳(毫秒) 返回当前实例的 UNIX 时间戳,13位数字,毫秒 ```ts dayjs('2019-01-25').valueOf() // 1548381600000 ``` -#### Unix时间戳 +#### Unix时间戳 返回当前实例的 UNIX 时间戳,10位数字,秒 ```ts dayjs('2019-01-25').valueOf() // 1548381600 ``` 此值不包含毫秒信息,会进位到秒。 - -#### 获取月天数 +#### 获取月天数 获取当前月份包含的天数。 ```ts const date = dayjs('2023-12-12'); // 31 ``` -#### 转Date +#### 转Date 从 `KuxDayjs` 中获取原生的Date对象。 ```ts dayjs('2023-12-12').toDate(); ``` -#### 转数组 +#### 转数组 返回一个包含各个时间信息的 Array。 ```ts const datetime = dayjs('2023-12-13 10:16:18');// [2023,12,13,10,16,18,0] ``` -#### 转JSON +#### 转JSON 序列化为 `ISO 8601` 格式的字符串。 ```ts dayjs('2023-12-13 10:16:18').toJSON(); // 2023-12-13T10:16:18.000Z ``` -#### 转对象 +#### 转对象 返回包含时间信息的 Object。 ```ts dayjs('2023-12-13 10:16:18').toObject(); // {"date":13,"hours":10,"milliseconds":0,"minutes":16,"months":12,"seconds":18,"years":2023} ``` -#### 转字符串 +#### 转字符串 返回包含时间信息的 `RFC 822` 或 `RFC 5322` 格式字符串。 ```ts dayjs('2023-12-13 10:16:18').toRFCString(); // Wed, 13 Dec 2023 10:16:18 GMT ``` -### 查询 +### 查询 `KuxDayjs` 对象还有很多查询的方法。 -#### 是否之前 +#### 是否之前 表示 `KuxDayjs` 对象是否在另一个提供的日期时间之前。 ```ts dayjs('2023-12-13 10:16:18').isBefore('2024-12-12'); // true @@ -567,8 +626,8 @@ dayjs('2023-12-13 10:16:18').isBefore('2024-12-12', 'year'); // true + second - 秒,缩写为 `s` + millisecond - 毫秒,缩写为 `ms` -#### 是否相同 +#### 是否相同 表示 `KuxDayjs` 对象是否和另一个提供的日期时间相同。 ```ts dayjs('2023-12-13 10:16:18').isBefore('2023-12-12'); // false @@ -586,8 +645,8 @@ dayjs('2023-12-13 10:16:18').isBefore('2023-12-12', 'year'); // true + second - 秒,缩写为 `s` + millisecond - 毫秒,缩写为 `ms` -#### 是否之后 +#### 是否之后 表示 `KuxDayjs` 对象是否在另一个提供的日期时间之后。 ```ts dayjs('2023-12-13 10:16:18').isAfter('2023-12-12'); // true @@ -605,8 +664,8 @@ dayjs('2023-12-13 10:16:18').isAfter('2023-12-12', 'year'); // true + second - 秒,缩写为 `s` + millisecond - 毫秒,缩写为 `ms` -#### 是否相同或之前 +#### 是否相同或之前 表示 `KuxDayjs` 对象是和另一个提供的日期时间相同或在其之前。 ```ts dayjs('2023-12-13 10:16:18').isSameOrBefore('2023-12-12'); // false @@ -624,8 +683,8 @@ dayjs('2023-12-13 10:16:18').isSameOrBefore('2023-12-12', 'year'); // true + second - 秒,缩写为 `s` + millisecond - 毫秒,缩写为 `ms` -#### 是否相同或之后 +#### 是否相同或之后 表示 `KuxDayjs` 对象是和另一个提供的日期时间相同或在其之前。 ```ts dayjs('2023-12-13 10:16:18').isSameOrAfter('2023-12-12'); // true @@ -643,8 +702,8 @@ dayjs('2023-12-13 10:16:18').isSameOrAfter('2023-12-12', 'year'); // true + second - 秒,缩写为 `s` + millisecond - 毫秒,缩写为 `ms` -#### 是否两者之间 +#### 是否两者之间 表示 `KuxDayjs` 对象是否在其他两个的日期时间之间。 ```ts dayjs('2023-12-13').isBetween('2023-12-13', '2023-12-14'); // 默认毫秒 @@ -671,6 +730,7 @@ dayjs('2023-12-13').isBetween('2023-12-13', '2023-12-14', 'day', '['); + `]` - 向后包含,等同于 `>=` + `[]` - 前后都包含 + #### 是否是KuxDayjs 这表示一个变量是否为 `KuxDayjs` 对象。 ```ts @@ -678,8 +738,155 @@ dayjs().isDayjs(dayjs()); // true dayjs().isDayjs(new Date()); // false ``` + #### 是否闰年 查询 `KuxDayjs` 对象的年份是否是闰年。 ```ts dayjs('2000-01-01').isLeapYear(); // true -``` \ No newline at end of file +``` + + +### 自定义类型 +因为 `uts` 强类型,所以有些 API 参数需要指定参数类型,以上所有 API 涉及的自定义类型都在下面列出,如果有需要可以自己手动导入类型使用。 + + +#### InfoType +```ts +export type InfoType = { + lunarY : number; + lunarM : number; + lunarD : number; + isLeap : boolean; +} +``` + + +#### LunarType +```ts +export type LunarType = { + month: string; + date: string; +}; +``` + + +#### DatetimeUnit +```ts +export type DatetimeUnit = +| 'day' +| 'd' +| 'month' +| 'M' +| 'year' +| 'y' +| 'hour' +| 'h' +| 'minute' +| 'm' +| 'second' +| 's' +| 'millisecond' +| 'ms' +``` + + +#### DiffUnit +```ts +export type DiffUnit = +| 'week' +| 'w' +| 'day' +| 'd' +| 'month' +| 'M' +| 'year' +| 'y' +| 'hour' +| 'h' +| 'minute' +| 'm' +| 'second' +| 's' +| 'millisecond' +| 'ms' +``` + + +#### DateFormat +```ts +export type DateFormat = { + year: number; + month: number; + date: number; + render: any; + lunar: LunarType; + fullLunar: InfoType; + diffDays: number; + isToday: boolean; + fullDate: string; +}; +``` + + +#### RelativeTime +```ts +export type RelativeTime = { + s?: string; + m?: string; + mm?: string; + h?: string; + hh?: string; + d?: string; + dd?: string; + mon?: string; + mons?: string; + y?: string; + yy?: string; +}; +``` + + +#### FromToOptions +```ts +export type FromToOptions = { + isSuffix?: boolean; + relativeTime?: RelativeTime; +}; +``` + + +#### DatetimeOptions +```ts +export type DatetimeOptions = { + years: number; + months: number; + date: number; + hours: number; + minutes: number; + seconds: number; + milliseconds: number; +}; +``` + + +#### IsBetweenContains +```ts +export type IsBetweenContains = +| '[' +| ']' +| '[]' +| '' +``` + +--- +### 结语 +#### kux 不生产代码,只做代码的搬运工,致力于提供uts 的 js 生态轮子实现,欢迎各位大佬在插件市场搜索使用 kux 生态插件:[https://ext.dcloud.net.cn/search?q=kux](https://ext.dcloud.net.cn/search?q=kux) + +___ +### 友情推荐 ++ [GVIM即时通讯模版](https://ext.dcloud.net.cn/plugin?id=16419):GVIM即时通讯模版,基于uni-app x开发的一款即时通讯模版 ++ [t-uvue-ui](https://ext.dcloud.net.cn/plugin?id=15571):T-UVUE-UI是基于UNI-APP X开发的前端UI框架 ++ [UxFrame 低代码高性能UI框架](https://ext.dcloud.net.cn/plugin?id=16148):【F2图表、双滑块slider、炫酷效果tabbar、拖拽排序、日历拖拽选择、签名...】UniAppX 高质量UI库 ++ [wx-ui 基于uni-app x开发的高性能混合UI库](https://ext.dcloud.net.cn/plugin?id=15579):基于uni-app x开发的高性能混合UI库,集成 uts api 和 uts component,提供了一套完整、高效且易于使用的UI组件和API,让您以更少的时间成本,轻松完成高性能应用开发。 ++ [firstui-uvue](https://ext.dcloud.net.cn/plugin?id=16294):FirstUI(unix)组件库,一款适配 uni-app x 的轻量、简洁、高效、全面的移动端组件库。 ++ [easyXUI 不仅仅是UI 更是为UniApp X设计的电商模板库](https://ext.dcloud.net.cn/plugin?id=15602):easyX 不仅仅是UI库,更是一个轻量、可定制的UniAPP X电商业务模板库,可作为官方组件库的补充,始终坚持简单好用、易上手 \ No newline at end of file diff --git a/uni_modules/kux-dayjs/utssdk/app-harmony/index.uts b/uni_modules/kux-dayjs/utssdk/app-harmony/index.uts new file mode 100644 index 0000000..a26d00c --- /dev/null +++ b/uni_modules/kux-dayjs/utssdk/app-harmony/index.uts @@ -0,0 +1 @@ +export * from '../../common/index'; \ No newline at end of file diff --git a/uni_modules/kux-dayjs/utssdk/app-js/index.uts b/uni_modules/kux-dayjs/utssdk/app-js/index.uts new file mode 100644 index 0000000..a26d00c --- /dev/null +++ b/uni_modules/kux-dayjs/utssdk/app-js/index.uts @@ -0,0 +1 @@ +export * from '../../common/index'; \ No newline at end of file diff --git a/uni_modules/kux-dayjs/utssdk/interface.uts b/uni_modules/kux-dayjs/utssdk/interface.uts index b621ea8..bd7f7e4 100644 --- a/uni_modules/kux-dayjs/utssdk/interface.uts +++ b/uni_modules/kux-dayjs/utssdk/interface.uts @@ -1,97 +1,1082 @@ import { InfoType } from '../common/calendar'; +import { DateType } from '../common/date'; export type LunarType = { - month: string; - date: string; + month : string; + date : string; }; -export type DatetimeUnit = -| 'day' -| 'd' -| 'month' -| 'M' -| 'year' -| 'y' -| 'hour' -| 'h' -| 'minute' -| 'm' -| 'second' -| 's' -| 'millisecond' -| 'ms' +export type DatetimeUnit = + | 'day' + | 'd' + | 'month' + | 'M' + | 'year' + | 'y' + | 'hour' + | 'h' + | 'minute' + | 'm' + | 'second' + | 's' + | 'millisecond' + | 'ms' -export type WeekUnit = -| 'week' -| 'w' +export type WeekUnit = + | 'week' + | 'w' -export type DiffUnit = -| 'week' -| 'w' -| 'day' -| 'd' -| 'month' -| 'M' -| 'year' -| 'y' -| 'hour' -| 'h' -| 'minute' -| 'm' -| 'second' -| 's' -| 'millisecond' -| 'ms' -; +export type DiffUnit = + | 'week' + | 'w' + | 'day' + | 'd' + | 'month' + | 'M' + | 'year' + | 'y' + | 'hour' + | 'h' + | 'minute' + | 'm' + | 'second' + | 's' + | 'millisecond' + | 'ms' + ; export type DateFormat = { - year: number; - month: number; - date: number; - render: any; - lunar: LunarType; - fullLunar: InfoType; - diffDays: number; - isToday: boolean; - fullDate: string; + year : number; + month : number; + date : number; + render : any; + lunar : LunarType; + fullLunar : InfoType; + diffDays : number; + isToday : boolean; + fullDate : string; }; export type RelativeTime = { - s?: string; - m?: string; - mm?: string; - h?: string; - hh?: string; - d?: string; - dd?: string; - mon?: string; - mons?: string; - y?: string; - yy?: string; + s ?: string; + m ?: string; + mm ?: string; + h ?: string; + hh ?: string; + d ?: string; + dd ?: string; + mon ?: string; + mons ?: string; + y ?: string; + yy ?: string; }; export type FromToOptions = { - isSuffix?: boolean; - relativeTime?: RelativeTime; + isSuffix ?: boolean; + relativeTime ?: RelativeTime; }; export type DatetimeOptions = { - years: number; - months: number; - date: number; - hours: number; - minutes: number; - seconds: number; - milliseconds: number; + years : number; + months : number; + date : number; + hours : number; + minutes : number; + seconds : number; + milliseconds : number; }; export type DateDiff = { - date1: Date, - date2: Date + date1 : Date, + date2 : Date }; -export type IsBetweenContains = -| '[' -| ']' -| '[]' -| '' \ No newline at end of file +export type IsBetweenContains = + | '[' + | ']' + | '[]' + | '' + +/** + * KuxDayjs实例 + */ +export interface IKuxDayjs { + d: Date + dd: DateType + /** + * 构造函数 + * @param {string} date 日期时间戳字符串,如果是想初始化时间戳可以直接把时间戳通过字符串形式传入。时间戳为毫秒形式 + * @param {boolean} isTimestamp 是否时间戳格式 + * @param {boolean} isCST 是否是中国标准时间,既UTC时间+8小时,`isTimestamp` 为 `true` 时生效,默认为 `true` + */ + // constructor(date ?: string, isTimestamp ?: boolean, isCST ?: boolean) + + /** + * 当前时间对象 + * @description 返回一个基于指定日期和时间的 KuxDayjs 对象 + * @param {string} date 日期时间字符串,比如:'2023-12-12 19:35:35' + * @returns KuxDayjs + */ + dayjs(date : string) : IKuxDayjs; + + /** + * 基于当前时间复制一个 KuxDayjs 对象 + * @returns KuxDayjs + * @example + * const a = dayjs(); + * const b = a.clone(); + * // a 和 b 是两个独立的 KuxDayjs 对象 + */ + clone() : IKuxDayjs; + + /** + * 日期格式化 + * @description 根据传入的占位符返回格式化后的日期 + * @param format 格式,如 'YYYY-MM-DD HH:mm:ss' + * @returns string + */ + format(format : string) : string; + + /** + * 差异 + * @description 返回指定单位下两个日期时间之间的差异 + * @param {string} date 比较的日期 + * @returns number + */ + diff (date: string) : number + + /** + * 差异 + * @description 返回指定单位下两个日期时间之间的差异 + * @param { IKuxDayjs } date 比较的日期对象 + * @returns number + */ + diff (date: IKuxDayjs): number + + /** + * 差异 + * @description 返回指定单位下两个日期时间之间的差异 + * @param { IKuxDayjs } date 比较的日期对象 + * @param {DiffUnit} unit 单位,默认为 `day` + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * + millisecond 毫秒,缩写 `ms` + * @returns number + */ + diff (date: IKuxDayjs, unit: DiffUnit | null): number + + /** + * 差异 + * @description 返回指定单位下两个日期时间之间的差异 + * @param {string} date 比较的日期 + * @param {DiffUnit} unit 单位,默认为 `day` + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * + millisecond 毫秒,缩写 `ms` + * @returns number + */ + diff (date: string, unit: DiffUnit | null): number + + /** + * 差异 + * @description 返回指定单位下两个日期时间之间的差异 + * @param { IKuxDayjs } date 比较的日期对象 + * @param {DiffUnit} unit 单位,默认为 `day` + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * + millisecond 毫秒,缩写 `ms` + * @param {boolean} strict 严格模式,设置为 `true` 时,会保持浮点数格式 + * @returns number + */ + diff (date: IKuxDayjs, unit: DiffUnit | null, strict: boolean | null): number + + /** + * 差异 + * @description 返回指定单位下两个日期时间之间的差异 + * @param {string} date 比较的日期 + * @param {DiffUnit} unit 单位,默认为 `day` + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * + millisecond 毫秒,缩写 `ms` + * @param {boolean} strict 严格模式,设置为 `true` 时,会保持浮点数格式 + * @returns number + */ + diff(date : string, unit : DiffUnit | null, strict : boolean | null) : number; + + diff(date: any, unit: DiffUnit | null, strict: boolean | null): number + + /** + * 日历时间 + * @description 获取指定年月的日历面板数据 + * @returns {DateFormat} DateFormat[] + */ + calendar () : DateFormat[] + + /** + * 日历时间 + * @description 获取指定年月的日历面板数据 + * @param {number} year 年 + * @returns {DateFormat} DateFormat[] + */ + calendar (year: number | null): DateFormat[]; + + /** + * 日历时间 + * @description 获取指定年月的日历面板数据 + * @param {number} year 年 + * @param {number} month 月 + * @returns {DateFormat} DateFormat[] + */ + calendar(year : number | null, month : number | null) : DateFormat[]; + + /** + * 获取/设置毫秒数 + * @description 获取或设置毫秒 + * @returns 返回0-999的毫秒数 + */ + millisecond() : number + + /** + * 获取/设置毫秒数 + * @description 获取或设置毫秒 + * @param {number} ms 0-999的毫秒数,如果大于-1就是设置操作,否则为获取操作 + * @returns 返回0-999的毫秒数 + */ + millisecond(ms : number | null) : number; + + /** + * 获取/设置秒数 + * @description 获取或设置秒 + * @returns {number} 返回0-59的秒数 + */ + second () : number + + /** + * 获取/设置秒数 + * @description 获取或设置秒 + * @param {number} s 0-59的秒数,如果大于-1就是设置操作,否则为获取操作 + * @returns {number} 返回0-59的秒数 + */ + second(s : number | null) : number; + + /** + * 获取/设置分钟 + * @description 获取或设置分钟 + * @returns {number} 返回0-59的分钟数 + */ + minute() : number + + /** + * 获取/设置分钟 + * @description 获取或设置分钟 + * @param {number} M 0-59的分钟数,如果大于-1就是设置操作,否则为获取操作 + * @returns {number} 返回0-59的分钟数 + */ + minute(M : number | null) : number; + + /** + * 获取/设置小时 + * @description 获取或设置小时 + * @returns {number} 返回0-23的小时数 + */ + hour() : number + + /** + * 获取/设置小时 + * @description 获取或设置小时 + * @param {number} h 0-23的小时数,如果大于-1就是设置操作,否则为获取操作 + * @returns {number} 返回0-23的小时数 + */ + hour(h : number | null) : number; + + /** + * 获取/设置日期 + * @description 获取或设置日期 + * @returns {number} 返回1-31的日期数 + */ + date(): number + + /** + * 获取/设置日期 + * @description 获取或设置日期 + * @param {number} d 日期数,传入参数就是设置操作,否则为获取操作。如果为 d 指定 0,那么日期就会被设置为上个月的最后一天。如果 d 被设置为负数,日期会设置为上个月最后一天往前数这个负数绝对值天数后的日期。-1 会设置为上月最后一天的前一天(译者注:例如当前为 4 月,如果 date(-2),则为 3 月 29 日) + * @returns {number} 返回1-31的日期数 + */ + date(d : number | null) : number; + + /** + * 获取星期几,0 表示星期天。目前仅支持获取,不支持设置操作 + * @description 获取或设置星期 + * @returns {number} 返回0-6的整数,0代表星期日,1代表星期一,以此类推。 + */ + day() : number; + + /** + * 获取/设置时间 + * @description 获取或设置毫秒 + * @param {number} t 一个整数,表示从 1970-1-1 00:00:00 UTC 开始计时的毫秒数。 传入参数就是设置操作,否则为获取操作。 + * @returns {number} 返回UTC 1970 年 1 月 1 日 00:00:00 与更新日期之间的毫秒数(实际上是自变量的值)。 + */ + time(t : number) : number; + + /** + * 获取/设置月份 + * @description 获取或设置月份 + * @returns {number} n + * + 获取操作返回0-11的整数(表示一月到十二月)。 + * + 设置操作返回基于 1 January 1970 00:00:00 UTC 开始计算的毫秒数。 + */ + month () : number + + /** + * 获取/设置月份 + * @description 获取或设置月份 + * @param {number} m 0-11的整数,如果m大于0则为设置操作,否则为获取操作 + * @returns {number} n + * + 获取操作返回0-11的整数(表示一月到十二月)。 + * + 设置操作返回基于 1 January 1970 00:00:00 UTC 开始计算的毫秒数。 + */ + month(m : number | null) : number; + + /** + * 获取/设置年 + * @description 获取或设置年份 + * @returns {number} 返回操作后的年份数 + */ + year(): number + + /** + * 获取/设置年 + * @description 获取或设置年份 + * @param {number} y 大于1969的整数,如果大于1969则为设置操作,否则为获取操作 + * @returns {number} 返回操作后的年份数 + */ + year(y : number | null) : number; + + /** + * 增加 + * @description 返回增加一定时间的复制的 KuxDayjs 对象 + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * + millisecond 毫秒,缩写 `ms` + * @returns {Date} d 操作后的Date对象 + */ + add() : IKuxDayjs + + /** + * 增加 + * @description 返回增加一定时间的复制的 KuxDayjs 对象 + * @param {string} count 需要增加的整数,支持配合单位操作 + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * + millisecond 毫秒,缩写 `ms` + * @returns {Date} d 操作后的Date对象 + */ + add(count: number | null): IKuxDayjs + + /** + * 增加 + * @description 返回增加一定时间的复制的 KuxDayjs 对象 + * @param {string} count 需要增加的整数,支持配合单位操作 + * @param {DiffUnit} unit 单位,默认为 `day` + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * + millisecond 毫秒,缩写 `ms` + * @returns {Date} d 操作后的Date对象 + */ + add(count : number | null, unit : DiffUnit | null) : IKuxDayjs; + + /** + * 减去 + * @description 返回减去一定时间的复制的 KuxDayjs 对象 + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * + millisecond 毫秒,缩写 `ms` + * @returns {Date} d 操作后的Date对象 + */ + subtract() : IKuxDayjs + + /** + * 减去 + * @description 返回减去一定时间的复制的 KuxDayjs 对象 + * @param {string} count 需要减去的整数,支持配合单位操作 + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * + millisecond 毫秒,缩写 `ms` + * @returns {Date} d 操作后的Date对象 + */ + subtract(count: number | null): IKuxDayjs + + /** + * 减去 + * @description 返回减去一定时间的复制的 KuxDayjs 对象 + * @param {string} count 需要减去的整数,支持配合单位操作 + * @param {DiffUnit} unit 单位,默认为 `day` + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * + millisecond 毫秒,缩写 `ms` + * @returns {Date} d 操作后的Date对象 + */ + subtract(count : number | null, unit : DiffUnit | null) : IKuxDayjs; + + /** + * 设置时间为今天 + */ + today() : IKuxDayjs; + + /** + * 时间的开始 + * @description 返回复制的 KuxDayjs 对象,并设置到一个时间的开始。 + * @param {DiffUnit} unit 单位 + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * @returns {Date} d 操作后的Date对象 + */ + startOf(unit : DiffUnit) : IKuxDayjs; + + /** + * 时间的结束 + * @description 返回复制的 KuxDayjs 对象,并设置到一个时间的末尾。 + * @param {DiffUnit} unit 单位 + * + week 周,缩写 `w` + * + day 天,缩写 `d` + * + month 月份,缩写 `M` + * + year 年,缩写 `y` + * + hour 小时,缩写 `h` + * + minute 分钟,缩写 `m` + * + second 秒,缩写 `s` + * @returns {Date} d 操作后的Date对象 + */ + endOf(unit : DiffUnit) : IKuxDayjs; + + /** + * 相对当前时间(前) + * @description 返回现在到当前实例的相对时间 + * + * @returns string + * + * @example + * ### 基本示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * console.log(datetime.fromNow()); // 输出 1年前 + * + * ### 自定义格式示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const options: FromNowOptions = { + * isSuffix: false, + * relativeTime: { + * y: '%s year ago' + * } as RelativeTime + * }; + * console.log(datetime.fromNow(options)); // 输出 1 year ago + */ + fromNow(): string + + /** + * 相对当前时间(前) + * @description 返回现在到当前实例的相对时间 + * @param {FromNowOptions} options 配置项 + * + isSuffix - boolean类型,是否自动携带后缀,为true的时候会自动添加“前”后缀,如 1年前;手动指定 `relativeTime` 时该项不生效 + * + relativeTime - RelativeTime类型,自定义格式,支持变量见下方说明 + * | 范围 | 键量 | 使用变量 | 说明 | 示例 | + * | --- | --- | --- | --- | --- | + * | 0 to 44seconds | s | %s | 几秒前 | %s seconds ago | + * | 45 to 89 seconds | m | %m | 1分钟前 | %m minute ago | + * | 90 seconds to 44 minutes | mm | %mm | 几分钟前 | %mm minutes ago | + * | 45 to 89 minutes | h | %h | 1小时前 | %h hour ago | + * | 90 minutes to 21 hours | hh | %hh | 几小时前 | %hh hours ago | + * | 22 to 35 hours | d | d | %d | 1天前 | %d day ago | + * | 36 hours to 25 days | dd | %dd | 几天前 | %dd days ago | + * | 26 to 45 days | mon | %mon | 1个月前 | %mon month ago | + * | 46 days to 10 months | mons | %mons | 几个月前 | %mons months ago | + * | 11 months to 17 months | y | %y | 1年前 | %y year ago | + * | 18 months + | yy | %yy | 几年前 | %yy years ago | + * + * @returns string + * + * @example + * ### 基本示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * console.log(datetime.fromNow()); // 输出 1年前 + * + * ### 自定义格式示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const options: FromNowOptions = { + * isSuffix: false, + * relativeTime: { + * y: '%s year ago' + * } as RelativeTime + * }; + * console.log(datetime.fromNow(options)); // 输出 1 year ago + */ + fromNow(options : FromToOptions | null) : string; + + /** + * 相对指定时间(前) + * @description 返回 X 到当前实例的相对时间 + * @returns string + * + * @example + * ### 基本示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const a = dayjs('2022-12-12'); + * console.log(datetime.from(a)); // 输出 1年前 + * + * ### 自定义格式示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const a = dayjs('2022-12-12'); + * const options: FromNowOptions = { + * isSuffix: false, + * relativeTime: { + * y: '%s year ago' + * } as RelativeTime + * }; + * console.log(datetime.from(a, options)); // 输出 1 year ago + */ + from(dayjs: IKuxDayjs): string + + /** + * 相对指定时间(前) + * @description 返回 X 到当前实例的相对时间 + * @param {FromNowOptions} options 配置项 + * + isSuffix - boolean类型,是否自动携带后缀,为true的时候会自动添加“前”后缀,如 1年前;手动指定 `relativeTime` 时该项不生效 + * + relativeTime - RelativeTime类型,自定义格式,支持变量见下方说明 + * | 范围 | 键量 | 使用变量 | 说明 | 示例 | + * | --- | --- | --- | --- | --- | + * | 0 to 44seconds | s | %s | 几秒前 | %s seconds ago | + * | 45 to 89 seconds | m | %m | 1分钟前 | %m minute ago | + * | 90 seconds to 44 minutes | mm | %mm | 几分钟前 | %mm minutes ago | + * | 45 to 89 minutes | h | %h | 1小时前 | %h hour ago | + * | 90 minutes to 21 hours | hh | %hh | 几小时前 | %hh hours ago | + * | 22 to 35 hours | d | d | %d | 1天前 | %d day ago | + * | 36 hours to 25 days | dd | %dd | 几天前 | %dd days ago | + * | 26 to 45 days | mon | %mon | 1个月前 | %mon month ago | + * | 46 days to 10 months | mons | %mons | 几个月前 | %mons months ago | + * | 11 months to 17 months | y | %y | 1年前 | %y year ago | + * | 18 months + | yy | %yy | 几年前 | %yy years ago | + * + * @returns string + * + * @example + * ### 基本示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const a = dayjs('2022-12-12'); + * console.log(datetime.from(a)); // 输出 1年前 + * + * ### 自定义格式示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const a = dayjs('2022-12-12'); + * const options: FromNowOptions = { + * isSuffix: false, + * relativeTime: { + * y: '%s year ago' + * } as RelativeTime + * }; + * console.log(datetime.from(a, options)); // 输出 1 year ago + */ + from(dayjs : IKuxDayjs, options : FromToOptions | null) : string; + + /** + * 相对当前时间(后) + * @description 返回当前实例到现在的相对时间 + * + * @returns string + * + * @example + * ### 基本示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * console.log(datetime.toNow()); // 输出 1年后 + * + * ### 自定义格式示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const options: FromToOptions = { + * isSuffix: false, + * relativeTime: { + * y: '%s year after' + * } as RelativeTime + * }; + * console.log(datetime.toNow(options)); // 输出 1 year after + */ + toNow(): string + + /** + * 相对当前时间(后) + * @description 返回当前实例到现在的相对时间 + * @param {FromNowOptions} options 配置项 + * + isSuffix - boolean类型,是否自动携带后缀,为true的时候会自动添加“后”后缀,如 1年后;手动指定 `relativeTime` 时该项不生效 + * + relativeTime - RelativeTime类型,自定义格式,支持变量见下方说明 + * | 范围 | 键量 | 使用变量 | 说明 | 示例 | + * | --- | --- | --- | --- | --- | + * | 0 to 44seconds | s | %s | 几秒后 | %s seconds after | + * | 45 to 89 seconds | m | %m | 1分钟后 | %m minute after | + * | 90 seconds to 44 minutes | mm | %mm | 几分钟后 | %mm minutes after | + * | 45 to 89 minutes | h | %h | 1小时后 | %h hour after | + * | 90 minutes to 21 hours | hh | %hh | 几小时后 | %hh hours after | + * | 22 to 35 hours | d | d | %d | 1天后 | %d day after | + * | 36 hours to 25 days | dd | %dd | 几天后 | %dd days after | + * | 26 to 45 days | mon | %mon | 1个月后 | %mon month after | + * | 46 days to 10 months | mons | %mons | 几个月后 | %mons months after | + * | 11 months to 17 months | y | %y | 1年后 | %y year after | + * | 18 months + | yy | %yy | 几年后 | %yy years after | + * + * @returns string + * + * @example + * ### 基本示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * console.log(datetime.toNow()); // 输出 1年后 + * + * ### 自定义格式示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const options: FromToOptions = { + * isSuffix: false, + * relativeTime: { + * y: '%s year after' + * } as RelativeTime + * }; + * console.log(datetime.toNow(options)); // 输出 1 year after + */ + toNow(options : FromToOptions | null) : string; + + /** + * 相对指定时间(后) + * @description 返回当前实例到 X 的相对时间 + * + * @returns string + * + * @example + * ### 基本示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const a = dayjs('2022-12-12'); + * console.log(datetime.to(a)); // 输出 1年后 + * + * ### 自定义格式示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const a = dayjs('2022-12-12'); + * const options: FromToOptions = { + * isSuffix: false, + * relativeTime: { + * y: '%s year after' + * } as RelativeTime + * }; + * console.log(datetime.to(a, options)); // 输出 1 year after + */ + to(date: IKuxDayjs): string + + /** + * 相对指定时间(后) + * @description 返回当前实例到 X 的相对时间 + * @param {FromNowOptions} options 配置项 + * + isSuffix - boolean类型,是否自动携带后缀,为true的时候会自动添加“前”后缀,如 1年后;手动指定 `relativeTime` 时该项不生效 + * + relativeTime - RelativeTime类型,自定义格式,支持变量见下方说明 + * | 范围 | 键量 | 使用变量 | 说明 | 示例 | + * | --- | --- | --- | --- | --- | + * | 0 to 44seconds | s | %s | 几秒后 | %s seconds after | + * | 45 to 89 seconds | m | %m | 1分钟后 | %m minute after | + * | 90 seconds to 44 minutes | mm | %mm | 几分钟后 | %mm minutes after | + * | 45 to 89 minutes | h | %h | 1小时后 | %h hour after | + * | 90 minutes to 21 hours | hh | %hh | 几小时后 | %hh hours after | + * | 22 to 35 hours | d | d | %d | 1天后 | %d day after | + * | 36 hours to 25 days | dd | %dd | 几天后 | %dd days after | + * | 26 to 45 days | mon | %mon | 1个月后 | %mon month after | + * | 46 days to 10 months | mons | %mons | 几个月后 | %mons months after | + * | 11 months to 17 months | y | %y | 1年后 | %y year after | + * | 18 months + | yy | %yy | 几年后 | %yy years after | + * + * @returns string + * + * @example + * ### 基本示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const a = dayjs('2022-12-12'); + * console.log(datetime.to(a)); // 输出 1年后 + * + * ### 自定义格式示例 + * const datetime = dayjs('2021-12-12 15:43:58'); + * const a = dayjs('2022-12-12'); + * const options: FromToOptions = { + * isSuffix: false, + * relativeTime: { + * y: '%s year after' + * } as RelativeTime + * }; + * console.log(datetime.to(a, options)); // 输出 1 year after + */ + to(date : IKuxDayjs, options : FromToOptions | null) : string; + + /** + * Unix时间戳(毫秒) + * @description 返回当前实例的 UNIX 时间戳,13位数字,毫秒 + * @returns number + */ + valueOf() : number; + + /** + * Unix时间戳 + * @description 返回当前实例的 UNIX 时间戳,10位数字,秒。 + * @returns number + */ + unix() : number; + + /** + * 是否闰年 + * @description 查询 KuxDayjs 对象的年份是否是闰年 + * @returns {boolean} boolean + * @example + * const date = dayjs('2000-01-01'); + * console.log(date.isLeapYear()); // 输出 true + */ + isLeapYear() : boolean; + + /** + * 获取月天数 + * @description 获取当前月份包含的天数 + * @returns number + * @example + * const date = dayjs('2023-12-12'); + * console.log(date.daysInMonth()); // 输出 31 + */ + daysInMonth() : number; + + /** + * 转Date + * @description 从KuxDayjs中获取原生的Date对象 + * @returns Date + */ + toDate() : Date; + + /** + * 转数组 + * @description 返回一个包含各个时间信息的 Array + * @returns number[] + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.toArray()); // 输出 [2023,12,13,10,16,18,0] + */ + toArray() : number[]; + + /** + * 转JSON + * @description 序列化为 ISO 8601 格式的字符串 + * @returns string + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.toJSON()); // 输出 2023-12-13T10:16:18.000Z + */ + toJSON() : string; + + /** + * 转对象 + * @description 返回包含时间信息的 Object + * @returns DatetimeOptions + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.toObject()); // 输出 {"date":13,"hours":10,"milliseconds":0,"minutes":16,"months":12,"seconds":18,"years":2023} + */ + toObject() : DatetimeOptions; + + /** + * 转字符串 + * @description 返回包含时间信息的"RFC 822" 或 "RFC 5322" 格式字符串 + * @returns string + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.toRFCString()); // 输出 Wed, 13 Dec 2023 10:16:18 GMT + */ + toRFCString() : string; + + /** + * 是否之前 + * @description 表示 KuxDayjs 对象是否在另一个提供的日期时间之前 + * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @returns {boolean} boolean + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.isBefore('2024-12-12')); // 输出 true + * console.log(datetime.isBefore('2024-12-12', 'year')); // 输出 true + */ + isBefore(datetime: string): boolean + + /** + * 是否之前 + * @description 表示 KuxDayjs 对象是否在另一个提供的日期时间之前 + * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @param {DiffUnit} unit 比较单位,默认为ms + * + year - 年,缩写为 `y` + * + month - 月,缩写为 `M` + * + day - 日,缩写为 `d` + * + hour - 小时,缩写为 `h` + * + minute - 分钟,缩写为 `m` + * + second - 秒,缩写为 `s` + * + millisecond - 毫秒,缩写为 `ms` + * @returns {boolean} boolean + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.isBefore('2024-12-12')); // 输出 true + * console.log(datetime.isBefore('2024-12-12', 'year')); // 输出 true + */ + isBefore(datetime : string, unit : DiffUnit | null) : boolean; + + /** + * 是否相同 + * @description 表示 KuxDayjs 对象是否和另一个提供的日期时间相同 + * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @returns {boolean} boolean + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.isSame('2023-12-12')); // 输出 false + * console.log(datetime.isSame('2023-12-12', 'year')); // 输出 true + */ + isSame(datetime: string): boolean + + /** + * 是否相同 + * @description 表示 KuxDayjs 对象是否和另一个提供的日期时间相同 + * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @param {DatetimeUnit} unit 比较单位,默认为ms + * + year - 年,缩写为 `y` + * + month - 月,缩写为 `M` + * + day - 日,缩写为 `d` + * + hour - 小时,缩写为 `h` + * + minute - 分钟,缩写为 `m` + * + second - 秒,缩写为 `s` + * + millisecond - 毫秒,缩写为 `ms` + * @returns {boolean} boolean + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.isSame('2023-12-12')); // 输出 false + * console.log(datetime.isSame('2023-12-12', 'year')); // 输出 true + */ + isSame(datetime : string, unit : DatetimeUnit | null) : boolean; + + /** + * 是否之后 + * @description 表示 KuxDayjs 对象是否在另一个提供的日期时间之后 + * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @returns {boolean} boolean + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.isAfter('2023-12-12')); // 输出 true + * console.log(datetime.isAfter('2023-12-12', 'year')); // 输出 true + */ + isAfter(datetime: string): boolean + + /** + * 是否之后 + * @description 表示 KuxDayjs 对象是否在另一个提供的日期时间之后 + * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @param {DatetimeUnit} unit 比较单位,默认为ms + * + year - 年,缩写为 `y` + * + month - 月,缩写为 `M` + * + day - 日,缩写为 `d` + * + hour - 小时,缩写为 `h` + * + minute - 分钟,缩写为 `m` + * + second - 秒,缩写为 `s` + * + millisecond - 毫秒,缩写为 `ms` + * @returns {boolean} boolean + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.isAfter('2023-12-12')); // 输出 true + * console.log(datetime.isAfter('2023-12-12', 'year')); // 输出 true + */ + isAfter(datetime : string, unit : DatetimeUnit | null) : boolean; + + /** + * 是否相同或之前 + * @description 表示 KuxDayjs 对象是和另一个提供的日期时间相同或在其之前 + * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @returns {boolean} boolean + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.isSameOrBefore('2023-12-12')); // 输出 false + * console.log(datetime.isSameOrBefore('2023-12-12', 'year')); // 输出 true + */ + isSameOrBefore(datetime: string): boolean + + /** + * 是否相同或之前 + * @description 表示 KuxDayjs 对象是和另一个提供的日期时间相同或在其之前 + * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @param {DatetimeUnit} unit 比较单位,默认为ms + * + year - 年,缩写为 `y` + * + month - 月,缩写为 `M` + * + day - 日,缩写为 `d` + * + hour - 小时,缩写为 `h` + * + minute - 分钟,缩写为 `m` + * + second - 秒,缩写为 `s` + * + millisecond - 毫秒,缩写为 `ms` + * @returns {boolean} boolean + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.isSameOrBefore('2023-12-12')); // 输出 false + * console.log(datetime.isSameOrBefore('2023-12-12', 'year')); // 输出 true + */ + isSameOrBefore(datetime : string, unit : DatetimeUnit | null) : boolean; + + /** + * 是否相同或之后 + * @description 表示 KuxDayjs 对象是否和另一个提供的日期时间相同或在其之后 + * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @returns {boolean} boolean + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.isSameOrAfter('2023-12-12')); // 输出 true + * console.log(datetime.isSameOrAfter('2023-12-12', 'year')); // 输出 true + */ + isSameOrAfter(datetime: string): boolean + + /** + * 是否相同或之后 + * @description 表示 KuxDayjs 对象是否和另一个提供的日期时间相同或在其之后 + * @param {string} datetime 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @param {DatetimeUnit} unit 比较单位,默认为ms + * + year - 年,缩写为 `y` + * + month - 月,缩写为 `M` + * + day - 日,缩写为 `d` + * + hour - 小时,缩写为 `h` + * + minute - 分钟,缩写为 `m` + * + second - 秒,缩写为 `s` + * + millisecond - 毫秒,缩写为 `ms` + * @returns {boolean} boolean + * @example + * const datetime = dayjs('2023-12-13 10:16:18'); + * console.log(datetime.isSameOrAfter('2023-12-12')); // 输出 true + * console.log(datetime.isSameOrAfter('2023-12-12', 'year')); // 输出 true + */ + isSameOrAfter(datetime : string, unit : DatetimeUnit | null) : boolean; + + /** + * 是否两者之间 + * @description 表示 KuxDayjs 对象是否在其他两个的日期时间之间 + * @param {string} datetime1 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @param {string} datetime2 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @returns {boolean} boolean + * @example + * const date = dayjs('2023-12-13'); + * console.log(date.isBetween('2023-12-13', '2023-12-14', 'day')); // 输出 false + * console.log(date.isBetween('2023-12-13', '2023-12-14', 'day', '[')); // 输出 true + */ + isBetween(datetime1: string, datetime2: string): boolean + + /** + * 是否两者之间 + * @description 表示 KuxDayjs 对象是否在其他两个的日期时间之间 + * @param {string} datetime1 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @param {string} datetime2 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @param {DatetimeUnit} unit 比较单位,默认为 `ms` + * + year - 年,缩写为 `y` + * + month - 月,缩写为 `M` + * + day - 日,缩写为 `d` + * + hour - 小时,缩写为 `h` + * + minute - 分钟,缩写为 `m` + * + second - 秒,缩写为 `s` + * + millisecond - 毫秒,缩写为 `ms` + * @returns {boolean} boolean + * @example + * const date = dayjs('2023-12-13'); + * console.log(date.isBetween('2023-12-13', '2023-12-14', 'day')); // 输出 false + * console.log(date.isBetween('2023-12-13', '2023-12-14', 'day', '[')); // 输出 true + */ + isBetween(datetime1: string, datetime2: string, unit: DatetimeUnit | null): boolean + + /** + * 是否两者之间 + * @description 表示 KuxDayjs 对象是否在其他两个的日期时间之间 + * @param {string} datetime1 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @param {string} datetime2 日期时间字符串,仅支持 'YYYY-MM-DD HH:mm:ss.S'格式 + * @param {DatetimeUnit} unit 比较单位,默认为 `ms` + * + year - 年,缩写为 `y` + * + month - 月,缩写为 `M` + * + day - 日,缩写为 `d` + * + hour - 小时,缩写为 `h` + * + minute - 分钟,缩写为 `m` + * + second - 秒,缩写为 `s` + * + millisecond - 毫秒,缩写为 `ms` + * @param {IsBetweenContains} contains 包含关系,见下方说明 + * + `[` - 向前包含,等同于 `<=` + * + `]` - 向后包含,等同于 `>=` + * + `[]` - 前后都包含 + * @returns {boolean} boolean + * @example + * const date = dayjs('2023-12-13'); + * console.log(date.isBetween('2023-12-13', '2023-12-14', 'day')); // 输出 false + * console.log(date.isBetween('2023-12-13', '2023-12-14', 'day', '[')); // 输出 true + */ + isBetween(datetime1 : string, datetime2 : string, unit : DatetimeUnit | null, contains : IsBetweenContains | null) : boolean; + + /** + * 是否是Dayjs + * @description 这表示一个变量是否为 KuxDayjs 对象 + * @param {any} dayjs 判断的对象 + * @returns {boolean} boolean + * @example + * const now = dayjs(); + * console.log(now.isDayjs(dayjs())); // 输出 true + * console.log(now.isDayjs(new Date())); // 输出 false + */ + isDayjs(dayjs : any) : boolean; +} + +/** + * 创建的KuxDayjs实例 + * @param {string} date 日期时间戳字符串,如果是想初始化时间戳可以直接把时间戳通过字符串形式传入。时间戳为毫秒形式 + * @param {boolean} isTimestamp 是否是时间戳格式 + * @param {boolean} isCST 是否是中国标准时间,既UTC时间+8小时,`isTimestamp` 为 `true` 时生效,默认为 `true` + * @returns KuxDayjs实例 + */ +export declare function dayjs(date ?: string, isTimestamp ?: boolean, isCST ?: boolean) : IKuxDayjs; \ No newline at end of file diff --git a/uni_modules/kux-dayjs/utssdk/mp-weixin/index.uts b/uni_modules/kux-dayjs/utssdk/mp-weixin/index.uts new file mode 100644 index 0000000..a26d00c --- /dev/null +++ b/uni_modules/kux-dayjs/utssdk/mp-weixin/index.uts @@ -0,0 +1 @@ +export * from '../../common/index'; \ No newline at end of file diff --git a/uni_modules/kux-dayjs/utssdk/web/index.uts b/uni_modules/kux-dayjs/utssdk/web/index.uts new file mode 100644 index 0000000..a26d00c --- /dev/null +++ b/uni_modules/kux-dayjs/utssdk/web/index.uts @@ -0,0 +1 @@ +export * from '../../common/index'; \ No newline at end of file diff --git a/uni_modules/lime-clipper/changelog.md b/uni_modules/lime-clipper/changelog.md index 1fa8ac2..d5c615e 100644 --- a/uni_modules/lime-clipper/changelog.md +++ b/uni_modules/lime-clipper/changelog.md @@ -1,3 +1,28 @@ +## 1.1.3(2025-06-03) +- feat: 兼容uniappx 鸿蒙next +- feat: uniappx 增加`fixedBoxWidth`属性,用于固定裁剪框宽度 +## 1.1.2(2025-03-24) +- fix: 修复uniappx 初始化设置图片时,在APP端无法响尺寸的问题 +## 1.1.1(2025-03-07) +- fix: 修复uniappx 无法拖动裁剪框高度的问题 +## 1.1.0(2025-02-22) +- chore: 更新文档 +## 1.0.9(2025-02-14) +- fix: uniapp x ios setLineDash不能为0 +## 1.0.8(2025-01-22) +- feat: 非uniapp x 增加canvasId属性 +## 1.0.7(2025-01-04) +- fix: 修复 vue2 无法生成图片的问题 +## 1.0.6(2024-12-28) +- fix: 修复 vue3 再次调用的时候生成空白的图片 +## 1.0.5(2024-12-17) +- fix: vue2 修复css变量问题 +## 1.0.4(2024-12-06) +- chore: 类型 +## 1.0.3(2024-12-06) +- chore: 更新文档 +## 1.0.2(2024-12-06) +- feat: 兼容uniappx, 目前在uniappx app 上无法使用本地缓存的图片,这个来自于官方BUG,预计在hbx4.42以后修复 ## 1.0.1(2023-06-12) - fix: 修复vue3 QQ小程序无法生成问题 ## 1.0.0(2023-06-01) diff --git a/uni_modules/lime-clipper/components/l-clipper/index.scss b/uni_modules/lime-clipper/components/l-clipper/index.scss index 8c4a78e..2f70376 100644 --- a/uni_modules/lime-clipper/components/l-clipper/index.scss +++ b/uni_modules/lime-clipper/components/l-clipper/index.scss @@ -1,8 +1,21 @@ -$clipper-edge-border-width: 6rpx !default; -$clipper-confirm-color: #07c160 !default; +@import '~@/uni_modules/lime-style/index.scss'; +$prefix: l !default; +$clipper: #{$prefix}-clipper; + +@font-face { + font-family: clipper-icon; + src: url('https://at.alicdn.com/t/c/font_4769200_ijsa6pjss7d.ttf?t=1733274494453') + // src: url('data:application/octet-stream;base64,AAEAAAALAIAAAwAwR1NVQiCLJXoAAAE4AAAAVE9TLzI9gUo9AAABjAAAAGBjbWFwhWDsFAAAAfgAAAF+Z2x5ZsX2J6QAAAOAAAABJGhlYWQqCQFBAAAA4AAAADZoaGVhB94DhAAAALwAAAAkaG10eAwAAAAAAAHsAAAADGxvY2EARACSAAADeAAAAAhtYXhwAREAPQAAARgAAAAgbmFtZRCjPLAAAASkAAACZ3Bvc3TvWVFJAAAHDAAAADgAAQAAA4D/gABcBAAAAAAABAAAAQAAAAAAAAAAAAAAAAAAAAMAAQAAAAEAAI0L+7JfDzz1AAsEAAAAAADjdV5nAAAAAON1XmcAAAAABAADdgAAAAgAAgAAAAAAAAABAAAAAwAxAAQAAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKADAAPgACREZMVAAObGF0bgAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAQEAAGQAAUAAAKJAswAAACPAokCzAAAAesAMgEIAAACAAUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBmRWQAwOds520DgP+AAAAD3ACAAAAAAQAAAAAAAAAAAAAAAAACBAAAAAQAAAAEAAAAAAAABQAAAAMAAAAsAAAABAAAAVYAAQAAAAAAUAADAAEAAAAsAAMACgAAAVYABAAkAAAABAAEAAEAAOdt//8AAOds//8AAAABAAQAAAACAAEAAAEGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAACgAAAAAAAAAAgAA52wAAOdsAAAAAgAA520AAOdtAAAAAQAAAAAAAABEAJIABAAAAAADiQN2ABEAFQAhACcAACUhIiY1ETQ2MyEyFhURFgYHBiUhESElIzQuASM1MhcWFxYlJzcXBxcCSP5mFh0gEwGaFh0CBAUK/mMBXP6kArxSRnZEXE9MLS7+67GxPXp6HSATAT4WHSAT/skHEwgYUgEAMEV1RlIuLUxPEbW1Pnd+AAAAAAMAAAAAA3gCzAAOAB8AMAAAARYUBwYiJjU0Njc2MzIWAREhETc2Mh8BNz4BMzIXJhcTFhURFAYjISImNRE0NjMhMgGMFBQVPSkLChQfERcBx/1wPg0pDj3GCREMFBIFYoQNGxT9cBQbGxQCkxECCRU/DxUpGw4cChQK/vkBj/5nPQ4OPe8ICRECcwE9DRX92xUbGxUCJRUbAAAAAAAAEgDeAAEAAAAAAAAAEwAAAAEAAAAAAAEACAATAAEAAAAAAAIABwAbAAEAAAAAAAMACAAiAAEAAAAAAAQACAAqAAEAAAAAAAUACwAyAAEAAAAAAAYACAA9AAEAAAAAAAoAKwBFAAEAAAAAAAsAEwBwAAMAAQQJAAAAJgCDAAMAAQQJAAEAEACpAAMAAQQJAAIADgC5AAMAAQQJAAMAEADHAAMAAQQJAAQAEADXAAMAAQQJAAUAFgDnAAMAAQQJAAYAEAD9AAMAAQQJAAoAVgENAAMAAQQJAAsAJgFjQ3JlYXRlZCBieSBpY29uZm9udGljb25mb250UmVndWxhcmljb25mb250aWNvbmZvbnRWZXJzaW9uIDEuMGljb25mb250R2VuZXJhdGVkIGJ5IHN2ZzJ0dGYgZnJvbSBGb250ZWxsbyBwcm9qZWN0Lmh0dHA6Ly9mb250ZWxsby5jb20AQwByAGUAYQB0AGUAZAAgAGIAeQAgAGkAYwBvAG4AZgBvAG4AdABpAGMAbwBuAGYAbwBuAHQAUgBlAGcAdQBsAGEAcgBpAGMAbwBuAGYAbwBuAHQAaQBjAG8AbgBmAG8AbgB0AFYAZQByAHMAaQBvAG4AIAAxAC4AMABpAGMAbwBuAGYAbwBuAHQARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMBAgEDAQQABnJvdGF0ZQVwaG90bwAA'); +} + + +$clipper-edge-border-width: create-var(clipper-edge-border-width, 6rpx); //6rpx !default; +$clipper-confirm-color: create-var(clipper-confirm-color, #07c160); //#07c160 !default; +$clipper-z-index: create-var(clipper-z-index, 99); //99 !default; +$clipper-mask-color: create-var(clipper-mask-color, rgba(0, 0, 0, 0.5)); //99 !default; .flex-auto { - flex:auto + flex: auto } .bg-transparent { @@ -11,30 +24,48 @@ $clipper-confirm-color: #07c160 !default; } .lime-clipper { - width: 100vw; - height: calc( 100vh - var(--window-top)); + width: 100%; + // height: calc(100vh - var(--window-top)); + bottom: 0; + /* #ifdef APP-ANDROID || APP-IOS || APP-HARMONY */ + top: 0; + /* #endif */ + /* #ifndef APP-ANDROID || APP-IOS || APP-HARMONY */ + top: var(--window-top); + /* #endif */ + background-color: rgba(0, 0, 0, 0.9); position: fixed; - top: var(--window-top); - left: 300vw; - z-index: 1; + + left: 3000%; + z-index: $clipper-z-index; + &.open { left: 0; } + &-mask { position: relative; z-index: 2; + overflow: visible; + flex: 1; + /* #ifndef APP-ANDROID || APP-IOS || APP-HARMONY */ pointer-events: none; + /* #endif */ } &__content { pointer-events: none; position: absolute; - border: 1rpx solid rgba(255,255,255,.3); + box-sizing: border-box; - box-shadow: rgba(0, 0, 0, 0.5) 0 0 0 80vh; - background: transparent; + // box-shadow: $clipper-mask-color 0 0 0 80rpx; + box-shadow: 0 0 0 800rpx $clipper-mask-color ; + background: transparent; + overflow: visible; // transition-duration 0.35s // transition-property left,top + /* #ifndef APP-ANDROID || APP-IOS || APP-HARMONY */ + border: 1rpx solid rgba(255,255,255,.3); &::before,&::after { content: ''; position: absolute; @@ -56,16 +87,20 @@ $clipper-confirm-color: #07c160 !default; border-top:none; border-bottom: none; } + /* #endif */ } - + /* #ifndef APP-ANDROID || APP-IOS || APP-HARMONY */ &__edge { + overflow: visible; position: absolute; // left 6rpx width: 34rpx; height: 34rpx; + // background: red; border: $clipper-edge-border-width solid #ffffff; pointer-events: auto; + &::before { content: ''; position: absolute; @@ -73,10 +108,9 @@ $clipper-confirm-color: #07c160 !default; height: 40rpx; background-color: transparent; } - &:nth-child(1) { - left: - $clipper-edge-border-width; - top: - $clipper-edge-border-width; + left: calc(#{$clipper-edge-border-width} * -1); + top: calc(#{$clipper-edge-border-width} * -1); border-bottom-width: 0 !important; border-right-width: 0 !important; &:before { @@ -86,8 +120,8 @@ $clipper-confirm-color: #07c160 !default; } &:nth-child(2) { - right: - $clipper-edge-border-width; - top: - $clipper-edge-border-width; + right: calc(#{$clipper-edge-border-width} * -1); + top: calc(#{$clipper-edge-border-width} * -1); border-bottom-width: 0 !important; border-left-width: 0 !important; &:before { @@ -98,8 +132,8 @@ $clipper-confirm-color: #07c160 !default; } &:nth-child(3) { - left: - $clipper-edge-border-width; - bottom: - $clipper-edge-border-width; + left: calc(#{$clipper-edge-border-width} * -1); + bottom: calc(#{$clipper-edge-border-width} * -1); border-top-width: 0 !important; border-right-width: 0 !important; &:before { @@ -109,8 +143,8 @@ $clipper-confirm-color: #07c160 !default; } &:nth-child(4) { - right: - $clipper-edge-border-width; - bottom: - $clipper-edge-border-width; + right: calc(#{$clipper-edge-border-width} * -1); + bottom: calc(#{$clipper-edge-border-width} * -1); border-top-width: 0 !important; border-left-width: 0 !important; &:before { @@ -118,28 +152,34 @@ $clipper-confirm-color: #07c160 !default; left: 50%; } } - } - + /* #endif */ &-image { width: 100%; - max-width: inherit; border-style: none; position: absolute; top: 0; left: 0; z-index: 1; + transform-origin: center; + /* #ifndef APP-ANDROID || APP-IOS || APP-HARMONY */ + max-width: inherit; -webkit-backface-visibility: hidden; backface-visibility: hidden; - transform-origin: center; + /* #endif */ + } &-canvas { position: fixed; - z-index: 10; - left: -200vw; - top: -200vw; + z-index: 100; + left: -200%; + top: -200%; pointer-events: none; + + // left:0; + // top:50%; + // background-color: red; } &-tools { @@ -148,16 +188,23 @@ $clipper-confirm-color: #07c160 !default; bottom: 10px; width: 100%; z-index: 99; - color: #fff; &__btns { - font-weight: bold; display: flex; + flex-direction: row; align-items: center; justify-content: space-between; width: 100%; padding: 20rpx 40rpx; box-sizing: border-box; + .text { + color: #fff; + min-width: 60rpx; + // #ifndef UNI-APP-X + display: block; + // #endif + } .cancel { + font-weight: bold; width: 112rpx; height: 60rpx; text-align: center; @@ -165,19 +212,23 @@ $clipper-confirm-color: #07c160 !default; } .confirm { + font-weight: bold; width: 112rpx; height: 60rpx; line-height: 60rpx; - background: var(--lime-clipper-confirm-color, $clipper-confirm-color); + background: $clipper-confirm-color; border-radius: 6rpx; text-align: center; } - - image { - display: block; - width: 60rpx; - height: 60rpx; - } + .rotate,.photo { + font-family: clipper-icon; + font-size: 60rpx; + } + // image { + // // display: block; + // width: 60rpx; + // height: 60rpx; + // } } } } diff --git a/uni_modules/lime-clipper/components/l-clipper/l-clipper.uvue b/uni_modules/lime-clipper/components/l-clipper/l-clipper.uvue new file mode 100644 index 0000000..abe406d --- /dev/null +++ b/uni_modules/lime-clipper/components/l-clipper/l-clipper.uvue @@ -0,0 +1,986 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/lime-clipper/components/l-clipper/l-clipper.vue b/uni_modules/lime-clipper/components/l-clipper/l-clipper.vue index a361738..10bf794 100644 --- a/uni_modules/lime-clipper/components/l-clipper/l-clipper.vue +++ b/uni_modules/lime-clipper/components/l-clipper/l-clipper.vue @@ -1,33 +1,20 @@ - + \ No newline at end of file diff --git a/uni_modules/lime-clipper/components/l-clipper/type.ts b/uni_modules/lime-clipper/components/l-clipper/type.ts new file mode 100644 index 0000000..7dadd55 Binary files /dev/null and b/uni_modules/lime-clipper/components/l-clipper/type.ts differ diff --git a/uni_modules/lime-clipper/components/l-clipper/utils.js b/uni_modules/lime-clipper/components/l-clipper/utils.js index 3d4d30e..f2e4916 100644 Binary files a/uni_modules/lime-clipper/components/l-clipper/utils.js and b/uni_modules/lime-clipper/components/l-clipper/utils.js differ diff --git a/uni_modules/lime-clipper/components/l-clipper/utils.uts b/uni_modules/lime-clipper/components/l-clipper/utils.uts new file mode 100644 index 0000000..09e716a Binary files /dev/null and b/uni_modules/lime-clipper/components/l-clipper/utils.uts differ diff --git a/uni_modules/lime-clipper/components/lime-clipper/lime-clipper.uvue b/uni_modules/lime-clipper/components/lime-clipper/lime-clipper.uvue new file mode 100644 index 0000000..ce6368f --- /dev/null +++ b/uni_modules/lime-clipper/components/lime-clipper/lime-clipper.uvue @@ -0,0 +1,186 @@ + + + + + + \ No newline at end of file diff --git a/uni_modules/lime-clipper/components/lime-clipper/lime-clipper.vue b/uni_modules/lime-clipper/components/lime-clipper/lime-clipper.vue index 5fd80d6..347a0a1 100644 --- a/uni_modules/lime-clipper/components/lime-clipper/lime-clipper.vue +++ b/uni_modules/lime-clipper/components/lime-clipper/lime-clipper.vue @@ -10,6 +10,7 @@ export default { data() { return { + imageUrl: 'https://img12.360buyimg.com/pop/s1180x940_jfs/t1/97205/26/1142/87801/5dbac55aEf795d962/48a4d7a63ff80b8b.jpg', url: '', show: false } diff --git a/uni_modules/lime-clipper/encrypt b/uni_modules/lime-clipper/encrypt new file mode 100644 index 0000000..2460e11 --- /dev/null +++ b/uni_modules/lime-clipper/encrypt @@ -0,0 +1 @@ +3=GzWfFxQA<4LD21*nXmfP \ No newline at end of file diff --git a/uni_modules/lime-clipper/package.json b/uni_modules/lime-clipper/package.json index eec34ed..5123569 100644 --- a/uni_modules/lime-clipper/package.json +++ b/uni_modules/lime-clipper/package.json @@ -1,8 +1,8 @@ { "id": "lime-clipper", - "displayName": "图片剪刀-LimeUI", - "version": "1.0.1", - "description": "一款自我感觉良好的图片裁剪插件", + "displayName": "lime-clipper 图片裁剪", + "version": "1.1.3", + "description": "一款自我感觉良好的图片裁剪插件, 兼容uniapp/uniappx", "keywords": [ "图片裁剪", "缩放", @@ -11,15 +11,17 @@ ], "repository": "https://gitee.com/liangei/lime-clipper", "engines": { - "HBuilderX": "^3.6.4" + "HBuilderX": "^4.44", + "uni-app": "^4.45", + "uni-app-x": "^4.66" }, -"dcloudext": { + "dcloudext": { "sale": { "regular": { - "price": "0.00" + "price": "59.99" }, "sourcecode": { - "price": "0.00" + "price": "60.00" } }, "contact": { @@ -31,44 +33,74 @@ "permissions": "无" }, "npmurl": "", - "type": "component-vue" + "type": "component-vue", + "darkmode": "x", + "i18n": "x", + "widescreen": "x" }, "uni_modules": { - "dependencies": [], + "dependencies": [ + "lime-style" + ], "encrypt": [], "platforms": { "cloud": { - "tcb": "y", - "aliyun": "y" + "tcb": "x", + "aliyun": "x", + "alipay": "x" }, "client": { - "App": { - "app-vue": "y", - "app-nvue": "n" + "uni-app": { + "vue": { + "vue2": "√", + "vue3": "√" + }, + "web": { + "safari": "√", + "chrome": "√" + }, + "app": { + "vue": "√", + "nvue": "-", + "android": { + "extVersion": "", + "minVersion": "21" + }, + "ios": "√", + "harmony": "√" + }, + "mp": { + "weixin": "√", + "alipay": "-", + "toutiao": "-", + "baidu": "-", + "kuaishou": "-", + "jd": "-", + "harmony": "-", + "qq": "-", + "lark": "-" + }, + "quickapp": { + "huawei": "-", + "union": "-" + } }, - "H5-mobile": { - "Safari": "y", - "Android Browser": "y", - "微信浏览器(Android)": "y", - "QQ浏览器(Android)": "y" - }, - "H5-pc": { - "Chrome": "y", - "IE": "u", - "Edge": "u", - "Firefox": "u", - "Safari": "y" - }, - "小程序": { - "微信": "y", - "阿里": "y", - "百度": "y", - "字节跳动": "y", - "QQ": "y" - }, - "快应用": { - "华为": "u", - "联盟": "u" + "uni-app-x": { + "web": { + "safari": "√", + "chrome": "√" + }, + "app": { + "android": { + "extVersion": "", + "minVersion": "21" + }, + "ios": "√", + "harmony": "√" + }, + "mp": { + "weixin": "√" + } } } } diff --git a/uni_modules/lime-clipper/readme.md b/uni_modules/lime-clipper/readme.md index dcc2462..bb7d104 100644 --- a/uni_modules/lime-clipper/readme.md +++ b/uni_modules/lime-clipper/readme.md @@ -1,9 +1,5 @@ # Clipper 图片裁剪 -> uniapp 图片裁剪,可用于图片头像等裁剪处理 -> [查看更多 站点1](https://limeui.qcoon.cn/#/clipper)
-> [查看更多 站点2](http://liangei.gitee.io/limeui/#/clipper)
-> Q群:1169785031 - +> 图片裁剪,可用于图片头像等裁剪处理 ## 平台兼容 @@ -12,9 +8,10 @@ | √ | √ | √ | 未测 | √ | √ | √ | ## 安装 -在市场导入**[图片剪刀](https://ext.dcloud.net.cn/plugin?id=3594)uni_modules**版本的即可,无需`import` - +插件市场导入即可 +## 文档 +[clipper](https://limex.qcoon.cn/components/clipper.html) ## 代码演示 ### 基本用法 @@ -66,23 +63,13 @@ export default { ### 确定按钮颜色 -样式变量名:`--clipper_confirm_color`, `nvue` 无效, `nvue`需要通过挂载全局样式表实现。 -可放到全局样式的 `page` 里或节点的 `style` + ```html - -``` -```css -// css 中为组件设置 CSS 变量 -.clipper { - --clipper_confirm_color: linear-gradient(to right, #ff6034, #ee0a24) -} -// 全局 -page { - --clipper_confirm_color: linear-gradient(to right, #ff6034, #ee0a24) -} + ``` + ### 使用插槽 共五个插槽 `cancel` 取消按钮、 `photo` 选择图片按钮、 `rotate` 旋转按钮、 `confirm` 确定按钮和默认插槽。 @@ -108,38 +95,48 @@ page { 旋转 确定 - - 显示取消按钮 - - - 显示选择图片按钮 - - - 显示旋转按钮 - - - 显示确定按钮 - - - 锁定裁剪框宽度 - - - 锁定裁剪框高度 - - - 锁定裁剪框比例 - - - 限制移动范围 - - - 禁止缩放 - - - 禁止旋转 - - + + + 显示取消按钮{{isShowCancelBtn}} + + + 显示选择图片按钮 + + + + 显示旋转按钮 + + + + 显示确定按钮 + + + + 锁定裁剪框宽度 + + + + 锁定裁剪框高度 + + + + 锁定裁剪框比例 + + + + 限制移动范围 + + + + 禁止缩放 + + + + 禁止旋转 + + + ``` @@ -191,6 +188,7 @@ export default { | image-url | 图片路径 | string | | | quality | 图片的质量,取值范围为 [0, 1],不在范围内时当作1处理 | number | `1` | | source | `{album: '从相册中选择'}`key为图片来源类型,value为选项说明 | Object | | +| fixedBoxWidth | 固定裁剪框宽度,作用是拖拽裁剪框后,依然保持输入的宽度。单位为 `rpx` | number | `-` | | width | 裁剪框宽度,单位为 `rpx` | number | `400` | | height | 裁剪框高度 | number | `400` | | min-width | 裁剪框最小宽度 | number | `200` | @@ -211,6 +209,7 @@ export default { | is-show-rotate-btn | 是否显示转按钮 | boolean | `true` | | is-show-confirm-btn | 是否显示确定按钮 | boolean | `true` | | is-show-cancel-btn | 是否显示关闭按钮 | boolean | `true` | +| confirm-bg-color | 确定按钮背景色 | string | `` | diff --git a/uni_modules/lime-painter/changelog.md b/uni_modules/lime-painter/changelog.md index b988d35..588fa02 100644 --- a/uni_modules/lime-painter/changelog.md +++ b/uni_modules/lime-painter/changelog.md @@ -1,3 +1,5 @@ +## 1.9.6.6(2024-09-25) +- fix: 修复background-position无效的问题 ## 1.9.6.5(2024-04-14) - fix: 修复`nvue`无法生图的问题 ## 1.9.6.4(2024-03-10) diff --git a/uni_modules/lime-painter/components/l-painter/painter.js b/uni_modules/lime-painter/components/l-painter/painter.js index bd42fc9..a8e3483 100644 --- a/uni_modules/lime-painter/components/l-painter/painter.js +++ b/uni_modules/lime-painter/components/l-painter/painter.js @@ -1 +1 @@ -var t=function(){return t=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=360&&(s-=360);s<0&&(s+=360);if(0===(s=Math.round(s)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===s)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===s)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===s)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var a=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(s===a)return{x0:n,y0:i+r,x1:e+n,y1:r};if(s===180-a)return{x0:n,y0:r,x1:e+n,y1:i+r};if(s===180+a)return{x0:e+n,y0:r,x1:n,y1:i+r};if(s===360-a)return{x0:e+n,y0:i+r,x1:n,y1:r};var h=0,c=0,f=0,l=0;if(s180-a&&s<180||s>180&&s<180+a||s>360-a){var d=s*Math.PI/180,u=s360-a?i/2:-i/2,p=Math.tan(d)*u,g=s180-a&&s<180?e/2-p:-e/2-p;h=-(f=p+(v=Math.pow(Math.sin(d),2)*g)),c=-(l=u+v/Math.tan(d))}if(s>a&&s<90||s>90&&s<90+a||s>180+a&&s<270||s>270&&s<360-a){var v;d=(90-s)*Math.PI/180,p=s>a&&s<90||s>90&&s<90+a?e/2:-e/2,u=Math.tan(d)*p,g=s>a&&s<90||s>270&&s<360-a?i/2-u:-i/2-u;h=-(f=p+(v=Math.pow(Math.sin(d),2)*g)/Math.tan(d)),c=-(l=u+v)}return h=Math.round(h+e/2)+n,c=Math.round(i/2-c)+r,f=Math.round(f+e/2)+n,l=Math.round(i/2-l)+r,{x0:h,y0:c,x1:f,y1:l}}(r,t,e,i,n),a=s.x0,h=s.y0,c=s.x1,f=s.y1,l=o.createLinearGradient(a,h,c,f),d=r.match(/linear-gradient\((.+)\)/)[1],u=L(d.substring(d.indexOf(",")+1)),p=0;pt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function C(t){return"number"==typeof t}function H(t){return"auto"===t||null===t}function D(t){return/%$/.test(t)}var Y=p,$=u,U=d,N=g,X=y,_=w,q=m;function G(t){return t.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()}))}function V(t,e){var i,n,o=function(t){var e=t.match(/([a-z]+)/)[1];return[e,G(t.split(e)[1])]}(t),s=o[0],a=o[1],h=e.split(" ");if(a)return(i={})[s+a]=e,i;if(h.length&&!a){var c=h[0],f=h[1],l=h[2],d=h[3];return(n={})[s+r[0]]=c,n[s+r[1]]=f||c,n[s+r[2]]=l||c,n[s+r[3]]=d||f||c,n}}function J(t){t=t.trim();for(var e=new Array,i="+",n="",r=t.length,o=0;o0;)"("===t[a+=1]&&(s+=1),")"===t[a]&&(s-=1);n="".concat(J(t.slice(o+1,a))),o=a}if(isNaN(Number(t[o]))&&"."!==t[o]||o===r-1){var h=parseFloat(n);switch(i){case"+":e.push(h);break;case"-":e.push(-h);break;case"*":e.push(e.pop()*h);break;case"/":e.push(e.pop()/h)}i=t[o],n=""}}for(var c=0;e.length;)c+=e.pop();return c}var Q,Z=0,K=function(){function t(){R(this,"elements",[]),R(this,"afterElements",[]),R(this,"beforeElements",[]),R(this,"ids",[]),R(this,"width",0),R(this,"height",0),R(this,"top",0),R(this,"left",0),R(this,"pre",null),R(this,"offsetX",0),R(this,"offsetY",0),Z++,this.id=Z}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){if(!this.ids.includes(t.id)){this.ids.push(t.id),this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()}},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth)||(this.closeLine(),!1)},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.includes(t.id)||(this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t))},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0)this[this.key.height]&&(this.container[this.key.lineMaxHeight]=this[this.key.height]=i),this[this.key.width]+=this.getWidth(t.offsetSize);var n=Math.min(this.getWidth(this),!this.getWidth(this.container.contentSize)&&1/0);(this.container[this.key.lineMaxWidth]||0)1)return 0;var e=t.style.alignSelf,i=this.getHeight(this.container.contentSize),n=i-this.getHeight(t.offsetSize);return"flex-end"===e?n:"center"===e?n/2:"stretch"===e?(n&&t.name==d&&(t.style[this.key.width]=this.getWidth(t.offsetSize),t.style[this.key.height]=i,delete t.line,delete t.lines,t.getBoxWidthHeight()),0):0},r.layout=function(t,e){var i=this;this.refreshXAlign(),this.pre?(this.top=this.pre.top+this.pre.height+this.offsetY,this.left=e+this.offsetX):(this.top=Math.max(this.top,this.container.contentSize.top,t)+this.offsetY,this.left=Math.max(this.left,this.container.contentSize.left,e)+this.offsetX),this.elements.forEach((function(t,e){i.setIndent(t);var n=i.elements[e-1],r=i.getOffsetY(t);t.style[i.key.top]=i[i.key.top]+r,t.style[i.key.left]=n?n.offsetSize[i.key.left]+i.getWidth(n.offsetSize):i[i.key.left],t.getBoxPosition()}))},n}(K),nt=p,rt=u,ot=d,st=v,at=y,ht=b,ct=w,ft=m,lt=0,dt={left:null,top:null,width:null,height:null},ut=new Map,pt=function(){function t(t,e,i,n){var o=this;R(this,"id",lt++),R(this,"style",{left:null,top:null,width:null,height:null}),R(this,"computedStyle",{}),R(this,"originStyle",{}),R(this,"children",{}),R(this,"layoutBox",F({},dt)),R(this,"contentSize",F({},dt)),R(this,"clientSize",F({},dt)),R(this,"borderSize",F({},dt)),R(this,"offsetSize",F({},dt)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.type||t.name,this.attributes=this.getAttributes(t);var s=function(t,e){var i,n=["color","fontSize","lineHeight","verticalAlign","fontWeight","textAlign"],o=t.type,s=void 0===o?U:o,a=t.styles,h=void 0===a?{}:a,c=(e||{}).computedStyle,f=Object.assign({},S);if([$,Y,N].includes(s)&&!h.display&&(f.display=X),c)for(var l=0;l=0&&l<0,Y=c>=0&&u<0;return i==a[0]&&(this[i].left=t.left+s+v+E+(D?2*-l:0),this[i].top=t.top+c+x+W+(Y?2*-u:0),this[i].width=t.width+(this[i].widthAdd?0:C),this[i].height=t.height+(this[i].heightAdd?0:H),this[i].widthAdd=C,this[i].heightAdd=H),i==a[1]&&(this[i].left=t.left+s+E+(D<0?-l:0),this[i].top=t.top+c+W+(Y?-u:0),this[i].width=t.width+v+w,this[i].height=t.height+x+S),i==a[2]&&(this[i].left=t.left+s+E/2+(D<0?-l:0),this[i].top=t.top+c+W/2+(Y?-u:0),this[i].width=t.width+v+w+E/2+F/2,this[i].height=t.height+x+S+T/2+W/2),i==a[3]&&(this[i].left=t.left+(D<0?-l:0),this[i].top=t.top+(Y?-u:0),this[i].width=t.width+v+w+E+F+s+l,this[i].height=t.height+x+S+T+W+u+c),this[i]},e.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),"border-box"==e.boxSizing){var o=e||{},s=o.border,h=(s=void 0===s?{}:s).borderWidth,c=void 0===h?0:h,f=o.borderTop,l=(f=void 0===f?{}:f).borderTopWidth,d=void 0===l?c:l,u=o.borderBottom,p=(u=void 0===u?{}:u).borderBottomWidth,g=void 0===p?c:p,v=o.borderRight,y=(v=void 0===v?{}:v).borderRightWidth,x=void 0===y?c:y,b=o.borderLeft,w=(b=void 0===b?{}:b).borderLeftWidth,m=void 0===w?c:w,S=o.padding,z=(S=void 0===S?{}:S).paddingTop,I=void 0===z?0:z,M=S.paddingRight,k=void 0===M?0:M,B=S.paddingBottom,W=void 0===B?0:B,P=S.paddingLeft,O=void 0===P?0:P;i||(t.width-=O+k+x+m),1!==i||n||(t.height-=I+W+d+g)}this.layoutBox&&(a.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},e.getBoxPosition=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,s=void 0===o?0:o,a=F({},this.contentSize,{left:r,top:s}),h=this.contentSize.top-this.offsetSize.top,c=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var f,l=E(this.root.fixedLine.elements);!(f=l()).done;){var d=f.value;d.setPosition(d,this.root.offsetSize),d.getBoxPosition()}}if(e)for(var u,p=E(e.elements);!(u=p()).done;){var g=u.value,v=F({},this.borderSize,{left:r,top:s});g.setPosition(g,v);var y=this.borderSize.top-this.offsetSize.top,x=this.borderSize.left-this.offsetSize.left;g.style.left+=r+x,g.style.top+=s+y,g.getBoxPosition()}if(i)for(var b,w=E(i);!(b=w()).done;){b.value.layout(a.top+h,a.left+c)}return this.layoutBoxUpdate(a,t),this.layoutBox},e.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},e.isBlock=function(t){return void 0===t&&(t=this),t&&t.style.display==st},e.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==ht},e.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},e.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&(!!t.parent&&(!(!t.parent||t.parent.style.display!==ht)||void 0))},e.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==at},e.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},e.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},e.getParentSize=function(t,e){if(void 0===t&&(t=this),void 0===e&&(e=!1),t&&t.parent){if(t.parent.contentSize.width)return t.parent.contentSize;if(e)return this.getParentSize(t.parent,e)}return null},e.getBoxWidthHeight=function(){var t=this,e=this.name,i=this.computedStyle,n=this.attributes,r=this.parent,o=void 0===r?{}:r,s=this.ctx,a=this.getChildren(),h=i.left,c=void 0===h?0:h,f=i.top,l=void 0===f?0:f,d=i.bottom,u=i.right,p=i.width,g=void 0===p?0:p,v=i.minWidth,y=i.maxWidth,x=i.minHeight,b=i.maxHeight,w=i.height,m=void 0===w?0:w,S=i.fontSize,z=i.fontWeight,I=i.fontFamily,M=i.fontStyle,k=i.position;i.textIndent;var B=i.lineClamp,P=i.lineHeight,O=i.padding,T=void 0===O?{}:O,L=i.margin,R=void 0===L?{}:L,F=i.border,A=(F=void 0===F?{}:F).borderWidth,j=void 0===A?0:A,E=i.borderRight,C=(E=void 0===E?{}:E).borderRightWidth,Y=void 0===C?j:C,$=i.borderLeft,U=($=void 0===$?{}:$).borderLeftWidth,N=void 0===U?j:U,X=o.contentSize&&o.contentSize.width,_=o.contentSize&&o.contentSize.height;if(D(g)&&X&&(g=W(g,X)),D(g)&&!X&&(g=null),D(m)&&_&&(m=W(m,_)),D(m)&&!_&&(m=null),D(v)&&X&&(v=W(v,X)),D(y)&&X&&(y=W(y,X)),D(x)&&_&&(x=W(x,_)),D(b)&&_&&(b=W(b,_)),i.padding&&X)for(var q in i.padding)Object.hasOwnProperty.call(T,q)&&(T[q]=W(T[q],X));var G=T.paddingRight,V=void 0===G?0:G,J=T.paddingLeft,Q=void 0===J?0:J;if(i.margin&&[R.marginLeft,R.marginRight].includes("auto"))if(g){var Z=X&&X-g-V-Q-N-Y||0;R.marginLeft==R.marginRight?R.marginLeft=R.marginRight=Z/2:H(R.marginLeft)?R.marginLeft=Z:R.marginRight=Z}else R.marginLeft=R.marginRight=0;var tt=R.marginRight,et=void 0===tt?0:tt,st=R.marginLeft,at={width:g,height:m,left:0,top:0},ht=Q+V+N+Y+(void 0===st?0:st)+et;if(this.offsetWidth=ht,e==rt&&!this.attributes.widths){var ft=n.text||"";s.save(),s.setFonts({fontFamily:I,fontSize:S,fontWeight:z,fontStyle:M}),ft.length,"\n"==ft&&(ft="",this.isBr=!0),(""+ft).split("\n").map((function(e){var i=Array.from(e).map((function(e){var i=""+(/^[\u4e00-\u9fa5]+$/.test(e)?"cn":e)+I+S+z+M,n=ut.get(i);if(n)return{width:n,text:e};var r=t.measureText(e,S).width;return ut.set(i,r),{width:r,text:e}})),n=t.measureText(e,S),r=n.fontHeight,o=n.ascent,s=n.descent;t.attributes.fontHeight=r,t.attributes.ascent=o,t.attributes.descent=s,t.attributes.widths||(t.attributes.widths=[]),t.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e.width}),0)})})),s.restore()}if(e==nt&&null==g){var lt=n.width,dt=n.height;at.width=this.contrastSize(Math.round(lt*m/dt)||0,v,y),this.layoutBoxUpdate(at,i,0)}if(e==rt&&null==g){var pt=this.attributes.widths,gt=Math.max.apply(Math,pt.map((function(t){return t.total})));if(o&&X>0&&(gt>X||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed)gt=X;at.width=this.contrastSize(gt,v,y),this.layoutBoxUpdate(at,i,0)}if(e==rt&&(o.style.flex||!this.attributes.lines)){var vt=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e.width>at.width?(vt++,e.width):t+e.width}),0)})),vt=B&&vt>B?B:vt,this.attributes.lines=vt}if(e==nt&&null==m){var yt=n.width,xt=n.height;n.text,at.height=this.contrastSize(W(at.width*xt/yt)||0,x,b),this.layoutBoxUpdate(at,i,1)}e==rt&&null==m&&(P=W(P,S),at.height=this.contrastSize(W(this.attributes.lines*P),x,b),this.layoutBoxUpdate(at,i,1,!0)),!g&&o&&o.children&&X&&(!this.isFlex(o)||o.isFlexCalc)&&([ot,rt].includes(e)&&this.isFlex()||e==ot&&this.isBlock(this)&&this.isInFlow())&&(at.width=this.contrastSize(X-(o.isFlexCalc?0:ht),v,y),this.layoutBoxUpdate(at,i)),g&&!D(g)&&(at.width=this.contrastSize(g,v,y),this.layoutBoxUpdate(at,i,0)),m&&!D(m)&&(at.height=this.contrastSize(at.height,x,b),this.layoutBoxUpdate(at,i,1));var bt=0;if(a.length){var wt=null,mt=!1;a.forEach((function(e,n){e.getBoxWidthHeight();var r=a[n+1];if(r&&r.isInFlow()&&(e.next=r),!t.line||!t.line.ids.includes(e.id))if(e.isInFlow()&&!e.inFlexBox()){var o=t.getBoxState(wt,e);if(e.isBr)return mt=!0;t.line&&t.line.canIEnter(e)&&!o&&!mt?t.line.add(e):(mt=!1,(new K).bind(e)),wt=e}else e.inFlexBox()?t.line&&(t.line.canIEnter(e)||"nowrap"==i.flexWrap)?t.line.add(e):(new it).bind(e):e.isFixed?t.root.fixedLine?t.root.fixedLine.fixedAdd(e):(new K).fixedBind(e):t.fixedLine?t.fixedLine.fixedAdd(e):(new K).fixedBind(e,1)})),this.lines&&(bt=this.lines.reduce((function(t,e){return t+e.height}),0))}var St=0,zt=0;if(!g&&(this.isAbsolute||this.isFixed)&&X){var It=k==ct?X:this.root.width,Mt=It-(D(c)?W(c,It):c)-(D(u)?W(u,It):u);St=i.left?Mt:this.lineMaxWidth}if(!m&&(null!=l?l:this.isAbsolute||this.isFixed&&_)){var kt=k==ct?_:this.root.height,Bt=kt-(D(l)?W(l,kt):l)-(D(d)?W(d,kt):d);zt=i.top?Bt:0}if(g&&!D(g)||at.width||(at.width=St||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?X||o.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,v,y),this.layoutBoxUpdate(at,i,0)),m||!bt&&!zt||(at.height=zt||this.contrastSize(bt,x,b),this.layoutBoxUpdate(at,i)),i.borderRadius&&this.borderSize&&this.borderSize.width)for(var q in i.borderRadius)Object.hasOwnProperty.call(i.borderRadius,q)&&(i.borderRadius[q]=W(i.borderRadius[q],this.borderSize.width));return this.layoutBox},e.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.root.contentSize=this.contentSize,this.getBoxPosition(),this.offsetSize},t}(),gt=function(){var t,e,i,n,r,o,s=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],a=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],h=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],c=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],f=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],l=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],d=[],u=[],p=[],g=[],v=[],y=2;function x(t,e){var i;t>e&&(i=t,t=e,e=i),i=e,i*=e,i+=e,i>>=1,g[i+=t]=1}function b(t,i){var n;for(p[t+e*i]=1,n=-2;n<2;n++)p[t+n+e*(i-2)]=1,p[t-2+e*(i+n+1)]=1,p[t+2+e*(i+n)]=1,p[t+n+1+e*(i+2)]=1;for(n=0;n<2;n++)x(t-1,i+n),x(t+1,i-n),x(t-n,i-1),x(t+n,i+1)}function w(t){for(;t>=255;)t=((t-=255)>>8)+(255&t);return t}var m=[];function S(t,e,i,n){var r,o,s;for(r=0;re&&(i=t,t=e,e=i),i=e,i+=e*e,i>>=1,g[i+=t]}function I(t){var i,n,r,o;switch(t){case 0:for(n=0;n>1&1,i=0;i=5&&(i+=3+v[e]-5);for(e=3;et||3*v[e-3]>=4*v[e]||3*v[e+3]>=4*v[e])&&(i+=40);return i}function k(){var t,i,n,r,o,s=0,a=0;for(i=0;ie*e;)h-=e*e,c++;for(s+=10*c,t=0;t1)for(P=s[t],B=e-7;;){for(M=e-7;M>P-3&&(b(M,B),!(M6)for(P=a[t-7],W=17,M=0;M<6;M++)for(B=0;B<3;B++,W--)1&(W>11?t>>W-12:P>>W)?(p[5-M+e*(2-B+e-11)]=1,p[2-B+e-11+e*(5-M)]=1):(x(5-M,2-B+e-11),x(2-B+e-11,5-M));for(B=0;B=(M=r*(i+n)+n)-2&&(O=M-2,t>9&&O--),T=O,t>9){for(d[T+2]=0,d[T+3]=0;T--;)P=d[T],d[T+3]|=255&P<<4,d[T+2]=P>>4;d[2]|=255&O<<4,d[1]=O>>4,d[0]=64|O>>12}else{for(d[T+1]=0,d[T+2]=0;T--;)P=d[T],d[T+2]|=255&P<<4,d[T+1]=P>>4;d[1]|=255&O<<4,d[0]=64|O>>4}for(T=O+3-(t<10);T0;L--)m[L]=m[L]?m[L-1]^l[w(f[m[L]]+T)]:m[L-1];m[0]=l[w(f[m[0]]+T)]}for(T=0;T<=o;T++)m[T]=f[m[T]];for(W=M,B=0,T=0;T>=1)1&B&&(p[e-1-W+8*e]=1,W<6?p[8+e*W]=1:p[8+e*(W+1)]=1);for(W=0;W<7;W++,B>>=1)1&B&&(p[8+e*(e-7+W)]=1,W?p[6-W+8*e]=1:p[7+8*e]=1);return p}(v)},utf16to8:function(t){var e,i,n,r;for(e="",n=t.length,i=0;i=1&&r<=127?e+=t.charAt(i):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r>>0&63)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|r>>0&63));return e},draw:function(t,i,n,r,o){i.drawView(n,r);var s=i.ctx,a=n.contentSize,h=a.width,c=a.height,f=a.left,l=a.top;r.borderRadius,r.backgroundColor;var d=r.color,u=void 0===d?"#000000":d;r.border,n.contentSize.left,n.borderSize.left,n.contentSize.top,n.borderSize.top;if(y=o||y,s){s.save(),i.setOpacity(r),i.setTransform(n,r);var p=Math.min(h,c);t=this.utf16to8(t);var g=this.getFrame(t),v=p/e;s.setFillStyle(u);for(var x=0;x=s||n==c&&o=s)&&(a=e.width/i.width);var f=i.width*a,l=i.height*a,d=r||[],u=d[0],p=d[1],g=B(u)?W(u,e.width):(e.width-f)*(P(u)?W(u,1):{left:0,center:.5,right:1}[u||"center"]),v=B(p)?W(p,e.height):(e.height-l)*(P(p)?W(p,1):{top:0,center:.5,bottom:1}[p||"center"]),y=function(t,e){return[(t-g)/a,(e-v)/a]},x=y(0,0),b=x[0],w=x[1],m=y(e.width,e.height),S=m[0],z=m[1],I=Math.max,M=Math.min;return{sx:I(b,0),sy:I(w,0),sw:M(S-b,i.width),sh:M(z-w,i.height),dx:I(g,0),dy:I(v,0),dw:M(f,e.width),dh:M(l,e.height)}}({objectFit:u,objectPosition:v},r.contentSize,t),o=i.sx,s=i.sy,a=i.sh,h=i.sw,c=i.dx,f=i.dy,l=i.dh,d=i.dw;I==n.MP_BAIDU?e.drawImage(t.src,c+m,f+S,d,l,o,s,h,a):e.drawImage(t.src,o,s,h,a,c+m,f+S,d,l)}else e.drawImage(t.src,m,S,b,w)},O=function(){e.restore(),L.drawView(r,o,!1,!0,!1),h(1)},T=function(t){k(t),O()},T(t),[2]}))}))}))];case 1:return h.sent(),[2]}}))}))},r.prototype.drawText=function(t,e,i,n){var r=this,o=this.ctx,s=e.borderSize,a=e.contentSize,h=e.left,c=e.top,f=a.width,l=a.height,d=a.left-s.left||0,u=a.top-s.top||0,p=i.color,g=i.lineHeight,v=i.fontSize,y=i.fontWeight,x=i.fontFamily,b=i.fontStyle,w=i.textIndent,m=void 0===w?0:w,S=i.textAlign,z=i.textStroke,I=i.verticalAlign,M=void 0===I?mt:I,k=i.backgroundColor,P=i.lineClamp,O=i.backgroundClip,T=i.textShadow,L=i.textDecoration;if(m=B(m)?m:0,this.drawView(e,i,O!=yt),g=W(g,v),t){o.save(),h+=d,c+=u;var R=n.fontHeight,F=n.descent,A=void 0===F?0:F,j=n.ascent,E=A+(void 0===j?0:j);switch(o.setFonts({fontFamily:x,fontSize:v,fontWeight:y,fontStyle:b}),o.setTextBaseline(mt),o.setTextAlign(S),O?this.setBackground(k,f,l,h,c):o.setFillStyle(p),S){case zt:break;case It:h+=.5*f;break;case Mt:h+=f}var C=n.lines*g,H=Math.ceil((l-C)/2);switch(H<0&&(H=0),M){case wt:break;case mt:c+=H;break;case St:c+=2*H}var D=(g-R)/2,Y=g/2,$=function(t){var e=o.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,r=e.actualBoundingBoxAscent;return M==wt?{fix:E?void 0===r?0:r:Y-D/2,lineY:E?0:D-D/2}:M==mt?{fix:E?Y+n/4:Y,lineY:E?0:D}:M==St?{fix:E?g-n:Y+D/2,lineY:E?2*D:D+D/2}:{fix:0,height:0,lineY:0}},U=function(t,e,i){var r=t;switch(S){case zt:r+=i;break;case It:r=(t-=i/2)+i;break;case Mt:r=t,t-=i}if(L){o.setLineWidth(v/13),o.beginPath();var s=.1*n.fontHeight;/\bunderline\b/.test(L)&&(o.moveTo(t,e+n.fontHeight+s),o.lineTo(r,e+n.fontHeight+s)),/\boverline\b/.test(L)&&(o.moveTo(t,e-s),o.lineTo(r,e-s)),/\bline-through\b/.test(L)&&(o.moveTo(t,e+.5*n.fontHeight),o.lineTo(r,e+.5*n.fontHeight)),o.closePath(),o.setStrokeStyle(p),o.stroke()}},N=function(t,e,i){var n=function(){o.setLineWidth(z.width),o.setStrokeStyle(z.color),o.strokeText(t,e,i)},s="outset";z&&z.type!==s?(o.save(),r.setShadow({boxShadow:T}),o.fillText(t,e,i),o.restore(),n()):z&&z.type==s?(o.save(),r.setShadow({boxShadow:T}),n(),o.restore(),o.save(),o.fillText(t,e,i),o.restore()):(r.setShadow({boxShadow:T}),o.fillText(t,e,i))};if(!n.widths||1==n.widths.length&&n.widths[0].total+m<=a.width){var X=$(t),_=X.fix,q=void 0===_?0:_,G=X.lineY;return N(t,h+m,c+q),U(h+m,c+G,n&&n.widths&&n.widths[0].total||n.text),c+=g,o.restore(),void this.setBorder(e,i)}for(var V=c,J=h,Q="",Z=0,K=o.measureText("...").width,tt=n.widths,et=0;eta.width){Z>=P&&(Q+="…"),Z++,nt=0;var ct=$(Q);q=ct.fix,G=ct.lineY;N(Q,J,c+q),U(J,c+G,nt),c+=g,Q=""}else if(rt==it.length-1){et!=tt.length-1&&Z==P&&K+ntV+l||Z>P)break}}o.restore()}},r.prototype.source=function(t){return e(this,void 0,void 0,(function(){var e,n,r,o,s=this;return i(this,(function(i){switch(i.label){case 0:if(this.node=null,e=+new Date,"{}"==JSON.stringify(t))return[2];if(t.styles=t.styles||t.css||{},!t.type)for(n in t.type=bt,t)["views","children","type","css","styles"].includes(n)||(t.styles[n]=t[n],delete t[n]);return t.styles.boxSizing||(t.styles.boxSizing="border-box"),[4,this.create(t)];case 1:return(r=i.sent())?(o=r.layout()||{},this.size=o,this.node=r,this.onEffectFinished().then((function(t){return s.lifecycle("onEffectSuccess",t)})).catch((function(t){return s.lifecycle("onEffectFail",t)})),this.performance&&console.log("布局用时:"+(+new Date-e)+"ms"),[2,this.size]):[2,console.warn("no node")]}}))}))},r.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},r.prototype.create=function(n,r){return e(this,void 0,void 0,(function(){function e(i,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var o=[];return i.forEach((function(i){var s=i.styles,a=void 0===s?{}:s,h=i.css,c=void 0===h?{}:h,f=i.children,l=void 0===f?[]:f,d=i.views,u=void 0===d?[]:d,p=i.text,g=void 0===p?"":p,v=i.type,y=void 0===v?"":v;!l&&u&&(i.children=l=u);var x={};x=t(t(r?t({},n):{},a),c);var b={},w={},m={};Object.keys(x).map((function(t){if(t.includes("padding")||t.includes("margin")){var e=V(t,x[t]);Object.keys(e).map((function(t){t.includes("Left")?w[t]=e[t]:t.includes("Right")?m[t]=e[t]:b[t]=e[t]}))}}));if(x.textIndent&&(w.textIndent=x.textIndent,delete n.textIndent),""!==g){var S=Array.from(g);S.forEach((function(t,e){var i=Object.assign({},x,b);0===e?Object.assign(i,w):e==S.length-1&&Object.assign(i,m),delete i.padding,delete i.margin,o.push({type:"text",text:t,styles:i})}))}if(y==vt||y==xt)o.push(i);else if("block"===a.display&&l.length>0){var z=e(l,x,!1);i.children=z,i.flattened=!0,o.push(i)}else if(l.length>0){z=e(l,x,r);o=o.concat(z)}})),o}var o,s,a,h,c,f,l,d,u,p,g,v,y,b,w,m,S,z,I,M,k,B,W,P;return i(this,(function(i){switch(i.label){case 0:if(!n)return[2];if(n.styles||(n.styles=n.css||{}),o=n.type,s=n.show,a=void 0===s||s,h=o==vt,c=[yt,xt].includes(o),f="textBox"==o,l=n.styles||{},d=l.backgroundImage,u=l.display,h&&!n.src&&!n.url)return[2];if(u==x||!a)return[2];if(c||f){if(p=n.children,g=n.views,!p&&g&&(n.children=p=g),!n.text&&(!p||p&&!p.length))return[2];p&&p.length&&!n.flattened&&(v=e(n.children||n.views),n.type="view",n.children=v)}if(!(h||n.type==bt&&d))return[3,4];y=h?n.src:"",b=/url\(['"]?(.*?)['"]?\)/.exec(d),d&&b&&b[1]&&(y=b[1]||""),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.getImageInfo(y)];case 2:return w=i.sent(),m=w.width,S=w.height,!(z=w.path)&&h?[2]:(z&&(n.attributes=Object.assign(n.attributes||{},{width:m,height:S,path:z,src:z,naturalSrc:y})),[3,4]);case 3:return I=i.sent(),n.type!=bt?[2]:(this.lifecycle("onEffectFail",t(t({},I),{src:y})),[3,4]);case 4:if(this.count+=1,M=new pt(n,r,this.root,this.ctx),!(k=n.children||n.views))return[3,8];B=0,i.label=5;case 5:return B0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=360&&(s-=360);s<0&&(s+=360);if(0===(s=Math.round(s)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===s)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===s)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===s)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var a=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(s===a)return{x0:n,y0:i+r,x1:e+n,y1:r};if(s===180-a)return{x0:n,y0:r,x1:e+n,y1:i+r};if(s===180+a)return{x0:e+n,y0:r,x1:n,y1:i+r};if(s===360-a)return{x0:e+n,y0:i+r,x1:n,y1:r};var h=0,c=0,f=0,l=0;if(s180-a&&s<180||s>180&&s<180+a||s>360-a){var d=s*Math.PI/180,u=s360-a?i/2:-i/2,p=Math.tan(d)*u,g=s180-a&&s<180?e/2-p:-e/2-p;h=-(f=p+(v=Math.pow(Math.sin(d),2)*g)),c=-(l=u+v/Math.tan(d))}if(s>a&&s<90||s>90&&s<90+a||s>180+a&&s<270||s>270&&s<360-a){var v;d=(90-s)*Math.PI/180,p=s>a&&s<90||s>90&&s<90+a?e/2:-e/2,u=Math.tan(d)*p,g=s>a&&s<90||s>270&&s<360-a?i/2-u:-i/2-u;h=-(f=p+(v=Math.pow(Math.sin(d),2)*g)/Math.tan(d)),c=-(l=u+v)}return h=Math.round(h+e/2)+n,c=Math.round(i/2-c)+r,f=Math.round(f+e/2)+n,l=Math.round(i/2-l)+r,{x0:h,y0:c,x1:f,y1:l}}(r,t,e,i,n),a=s.x0,h=s.y0,c=s.x1,f=s.y1,l=o.createLinearGradient(a,h,c,f),d=r.match(/linear-gradient\((.+)\)/)[1],u=R(d.substring(d.indexOf(",")+1)),p=0;pt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function H(t){return"number"==typeof t}function D(t){return"auto"===t||null===t}function $(t){return/%$/.test(t)}var Y=p,U=u,N=d,X=g,_=y,q=w,G=m;function V(t){return t.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()}))}function J(t,e){var i,n,o=function(t){var e=t.match(/([a-z]+)/)[1];return[e,V(t.split(e)[1])]}(t),s=o[0],a=o[1],h=e.split(" ");if(a)return(i={})[s+a]=e,i;if(h.length&&!a){var c=h[0],f=h[1],l=h[2],d=h[3];return(n={})[s+r[0]]=c,n[s+r[1]]=f||c,n[s+r[2]]=l||c,n[s+r[3]]=d||f||c,n}}function Q(t){t=t.trim();for(var e=new Array,i="+",n="",r=t.length,o=0;o0;)"("===t[a+=1]&&(s+=1),")"===t[a]&&(s-=1);n="".concat(Q(t.slice(o+1,a))),o=a}if(isNaN(Number(t[o]))&&"."!==t[o]||o===r-1){var h=parseFloat(n);switch(i){case"+":e.push(h);break;case"-":e.push(-h);break;case"*":e.push(e.pop()*h);break;case"/":e.push(e.pop()/h)}i=t[o],n=""}}for(var c=0;e.length;)c+=e.pop();return c}var Z,K=0,et=function(){function t(){F(this,"elements",[]),F(this,"afterElements",[]),F(this,"beforeElements",[]),F(this,"ids",[]),F(this,"width",0),F(this,"height",0),F(this,"top",0),F(this,"left",0),F(this,"pre",null),F(this,"offsetX",0),F(this,"offsetY",0),K++,this.id=K}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){if(!this.ids.includes(t.id)){this.ids.push(t.id),this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()}},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth)||(this.closeLine(),!1)},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.includes(t.id)||(this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t))},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0)this[this.key.height]&&(this.container[this.key.lineMaxHeight]=this[this.key.height]=i),this[this.key.width]+=this.getWidth(t.offsetSize);var n=Math.min(this.getWidth(this),!this.getWidth(this.container.contentSize)&&1/0);(this.container[this.key.lineMaxWidth]||0)1)return 0;var e=t.style.alignSelf,i=this.getHeight(this.container.contentSize),n=i-this.getHeight(t.offsetSize);return"flex-end"===e?n:"center"===e?n/2:"stretch"===e?(n&&t.name==d&&(t.style[this.key.width]=this.getWidth(t.offsetSize),t.style[this.key.height]=i,delete t.line,delete t.lines,t.getBoxWidthHeight()),0):0},r.layout=function(t,e){var i=this;this.refreshXAlign(),this.pre?(this.top=this.pre.top+this.pre.height+this.offsetY,this.left=e+this.offsetX):(this.top=Math.max(this.top,this.container.contentSize.top,t)+this.offsetY,this.left=Math.max(this.left,this.container.contentSize.left,e)+this.offsetX),this.elements.forEach((function(t,e){i.setIndent(t);var n=i.elements[e-1],r=i.getOffsetY(t);t.style[i.key.top]=i[i.key.top]+r,t.style[i.key.left]=n?n.offsetSize[i.key.left]+i.getWidth(n.offsetSize):i[i.key.left],t.getBoxPosition()}))},n}(et),rt=p,ot=u,st=d,at=v,ht=y,ct=b,ft=w,lt=m,dt=0,ut={left:null,top:null,width:null,height:null},pt=new Map,gt=function(){function t(t,e,i,n){var o=this;F(this,"id",dt++),F(this,"style",{left:null,top:null,width:null,height:null}),F(this,"computedStyle",{}),F(this,"originStyle",{}),F(this,"children",{}),F(this,"layoutBox",A({},ut)),F(this,"contentSize",A({},ut)),F(this,"clientSize",A({},ut)),F(this,"borderSize",A({},ut)),F(this,"offsetSize",A({},ut)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.type||t.name,this.attributes=this.getAttributes(t);var s=function(t,e){var i,n=["color","fontSize","lineHeight","verticalAlign","fontWeight","textAlign"],o=t.type,s=void 0===o?N:o,a=t.styles,h=void 0===a?{}:a,c=(e||{}).computedStyle,f=Object.assign({},S);if([U,Y,X].includes(s)&&!h.display&&(f.display=_),c)for(var l=0;l=0&&l<0,$=c>=0&&u<0;return i==a[0]&&(this[i].left=t.left+s+v+E+(D?2*-l:0),this[i].top=t.top+c+x+W+($?2*-u:0),this[i].width=t.width+(this[i].widthAdd?0:C),this[i].height=t.height+(this[i].heightAdd?0:H),this[i].widthAdd=C,this[i].heightAdd=H),i==a[1]&&(this[i].left=t.left+s+E+(D<0?-l:0),this[i].top=t.top+c+W+($?-u:0),this[i].width=t.width+v+w,this[i].height=t.height+x+S),i==a[2]&&(this[i].left=t.left+s+E/2+(D<0?-l:0),this[i].top=t.top+c+W/2+($?-u:0),this[i].width=t.width+v+w+E/2+F/2,this[i].height=t.height+x+S+T/2+W/2),i==a[3]&&(this[i].left=t.left+(D<0?-l:0),this[i].top=t.top+($?-u:0),this[i].width=t.width+v+w+E+F+s+l,this[i].height=t.height+x+S+T+W+u+c),this[i]},e.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),"border-box"==e.boxSizing){var o=e||{},s=o.border,h=(s=void 0===s?{}:s).borderWidth,c=void 0===h?0:h,f=o.borderTop,l=(f=void 0===f?{}:f).borderTopWidth,d=void 0===l?c:l,u=o.borderBottom,p=(u=void 0===u?{}:u).borderBottomWidth,g=void 0===p?c:p,v=o.borderRight,y=(v=void 0===v?{}:v).borderRightWidth,x=void 0===y?c:y,b=o.borderLeft,w=(b=void 0===b?{}:b).borderLeftWidth,m=void 0===w?c:w,S=o.padding,z=(S=void 0===S?{}:S).paddingTop,I=void 0===z?0:z,M=S.paddingRight,k=void 0===M?0:M,B=S.paddingBottom,W=void 0===B?0:B,P=S.paddingLeft,O=void 0===P?0:P;i||(t.width-=O+k+x+m),1!==i||n||(t.height-=I+W+d+g)}this.layoutBox&&(a.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},e.getBoxPosition=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,s=void 0===o?0:o,a=A({},this.contentSize,{left:r,top:s}),h=this.contentSize.top-this.offsetSize.top,c=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var f,l=C(this.root.fixedLine.elements);!(f=l()).done;){var d=f.value;d.setPosition(d,this.root.offsetSize),d.getBoxPosition()}}if(e)for(var u,p=C(e.elements);!(u=p()).done;){var g=u.value,v=A({},this.borderSize,{left:r,top:s});g.setPosition(g,v);var y=this.borderSize.top-this.offsetSize.top,x=this.borderSize.left-this.offsetSize.left;g.style.left+=r+x,g.style.top+=s+y,g.getBoxPosition()}if(i)for(var b,w=C(i);!(b=w()).done;){b.value.layout(a.top+h,a.left+c)}return this.layoutBoxUpdate(a,t),this.layoutBox},e.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},e.isBlock=function(t){return void 0===t&&(t=this),t&&t.style.display==at},e.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==ct},e.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},e.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&(!!t.parent&&(!(!t.parent||t.parent.style.display!==ct)||void 0))},e.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==ht},e.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},e.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},e.getParentSize=function(t,e){if(void 0===t&&(t=this),void 0===e&&(e=!1),t&&t.parent){if(t.parent.contentSize.width)return t.parent.contentSize;if(e)return this.getParentSize(t.parent,e)}return null},e.getBoxWidthHeight=function(){var t=this,e=this.name,i=this.computedStyle,n=this.attributes,r=this.parent,o=void 0===r?{}:r,s=this.ctx,a=this.getChildren(),h=i.left,c=void 0===h?0:h,f=i.top,l=void 0===f?0:f,d=i.bottom,u=i.right,p=i.width,g=void 0===p?0:p,v=i.minWidth,y=i.maxWidth,x=i.minHeight,b=i.maxHeight,w=i.height,m=void 0===w?0:w,S=i.fontSize,z=i.fontWeight,I=i.fontFamily,M=i.fontStyle,k=i.position;i.textIndent;var B=i.lineClamp,P=i.lineHeight,O=i.padding,T=void 0===O?{}:O,L=i.margin,R=void 0===L?{}:L,F=i.border,A=(F=void 0===F?{}:F).borderWidth,j=void 0===A?0:A,E=i.borderRight,C=(E=void 0===E?{}:E).borderRightWidth,H=void 0===C?j:C,Y=i.borderLeft,U=(Y=void 0===Y?{}:Y).borderLeftWidth,N=void 0===U?j:U,X=o.contentSize&&o.contentSize.width,_=o.contentSize&&o.contentSize.height;if($(g)&&X&&(g=W(g,X)),$(g)&&!X&&(g=null),$(m)&&_&&(m=W(m,_)),$(m)&&!_&&(m=null),$(v)&&X&&(v=W(v,X)),$(y)&&X&&(y=W(y,X)),$(x)&&_&&(x=W(x,_)),$(b)&&_&&(b=W(b,_)),i.padding&&X)for(var q in i.padding)Object.hasOwnProperty.call(T,q)&&(T[q]=W(T[q],X));var G=T.paddingRight,V=void 0===G?0:G,J=T.paddingLeft,Q=void 0===J?0:J;if(i.margin&&[R.marginLeft,R.marginRight].includes("auto"))if(g){var Z=X&&X-g-V-Q-N-H||0;R.marginLeft==R.marginRight?R.marginLeft=R.marginRight=Z/2:D(R.marginLeft)?R.marginLeft=Z:R.marginRight=Z}else R.marginLeft=R.marginRight=0;var K=R.marginRight,tt=void 0===K?0:K,it=R.marginLeft,at={width:g,height:m,left:0,top:0},ht=Q+V+N+H+(void 0===it?0:it)+tt;if(this.offsetWidth=ht,e==ot&&!this.attributes.widths){var ct=n.text||"";s.save(),s.setFonts({fontFamily:I,fontSize:S,fontWeight:z,fontStyle:M}),ct.length,"\n"==ct&&(ct="",this.isBr=!0),(""+ct).split("\n").map((function(e){var i=Array.from(e).map((function(e){var i=""+(/^[\u4e00-\u9fa5]+$/.test(e)?"cn":e)+I+S+z+M,n=pt.get(i);if(n)return{width:n,text:e};var r=t.measureText(e,S).width;return pt.set(i,r),{width:r,text:e}})),n=t.measureText(e,S),r=n.fontHeight,o=n.ascent,s=n.descent;t.attributes.fontHeight=r,t.attributes.ascent=o,t.attributes.descent=s,t.attributes.widths||(t.attributes.widths=[]),t.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e.width}),0)})})),s.restore()}if(e==rt&&null==g){var lt=n.width,dt=n.height;at.width=this.contrastSize(Math.round(lt*m/dt)||0,v,y),this.layoutBoxUpdate(at,i,0)}if(e==ot&&null==g){var ut=this.attributes.widths,gt=Math.max.apply(Math,ut.map((function(t){return t.total})));if(o&&X>0&&(gt>X||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed)gt=X;at.width=this.contrastSize(gt,v,y),this.layoutBoxUpdate(at,i,0)}if(e==ot&&(o.style.flex||!this.attributes.lines)){var vt=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e.width>at.width?(vt++,e.width):t+e.width}),0)})),vt=B&&vt>B?B:vt,this.attributes.lines=vt}if(e==rt&&null==m){var yt=n.width,xt=n.height;n.text,at.height=this.contrastSize(W(at.width*xt/yt)||0,x,b),this.layoutBoxUpdate(at,i,1)}e==ot&&null==m&&(P=W(P,S),at.height=this.contrastSize(W(this.attributes.lines*P),x,b),this.layoutBoxUpdate(at,i,1,!0)),!g&&o&&o.children&&X&&(!this.isFlex(o)||o.isFlexCalc)&&([st,ot].includes(e)&&this.isFlex()||e==st&&this.isBlock(this)&&this.isInFlow())&&(at.width=this.contrastSize(X-(o.isFlexCalc?0:ht),v,y),this.layoutBoxUpdate(at,i)),g&&!$(g)&&(at.width=this.contrastSize(g,v,y),this.layoutBoxUpdate(at,i,0)),m&&!$(m)&&(at.height=this.contrastSize(at.height,x,b),this.layoutBoxUpdate(at,i,1));var bt=0;if(a.length){var wt=null,mt=!1;a.forEach((function(e,n){e.getBoxWidthHeight();var r=a[n+1];if(r&&r.isInFlow()&&(e.next=r),!t.line||!t.line.ids.includes(e.id))if(e.isInFlow()&&!e.inFlexBox()){var o=t.getBoxState(wt,e);if(e.isBr)return mt=!0;t.line&&t.line.canIEnter(e)&&!o&&!mt?t.line.add(e):(mt=!1,(new et).bind(e)),wt=e}else e.inFlexBox()?t.line&&(t.line.canIEnter(e)||"nowrap"==i.flexWrap)?t.line.add(e):(new nt).bind(e):e.isFixed?t.root.fixedLine?t.root.fixedLine.fixedAdd(e):(new et).fixedBind(e):t.fixedLine?t.fixedLine.fixedAdd(e):(new et).fixedBind(e,1)})),this.lines&&(bt=this.lines.reduce((function(t,e){return t+e.height}),0))}var St=0,zt=0;if(!g&&(this.isAbsolute||this.isFixed)&&X){var It=k==ft?X:this.root.width,Mt=It-($(c)?W(c,It):c)-($(u)?W(u,It):u);St=i.left?Mt:this.lineMaxWidth}if(!m&&(null!=l?l:this.isAbsolute||this.isFixed&&_)){var kt=k==ft?_:this.root.height,Bt=kt-($(l)?W(l,kt):l)-($(d)?W(d,kt):d);zt=i.top?Bt:0}if(g&&!$(g)||at.width||(at.width=St||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?X||o.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,v,y),this.layoutBoxUpdate(at,i,0)),m||!bt&&!zt||(at.height=zt||this.contrastSize(bt,x,b),this.layoutBoxUpdate(at,i)),i.borderRadius&&this.borderSize&&this.borderSize.width)for(var q in i.borderRadius)Object.hasOwnProperty.call(i.borderRadius,q)&&(i.borderRadius[q]=W(i.borderRadius[q],this.borderSize.width));return this.layoutBox},e.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.root.contentSize=this.contentSize,this.getBoxPosition(),this.offsetSize},t}(),vt=function(){var t,e,i,n,r,o,s=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],a=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],h=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],c=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],f=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],l=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],d=[],u=[],p=[],g=[],v=[],y=2;function x(t,e){var i;t>e&&(i=t,t=e,e=i),i=e,i*=e,i+=e,i>>=1,g[i+=t]=1}function b(t,i){var n;for(p[t+e*i]=1,n=-2;n<2;n++)p[t+n+e*(i-2)]=1,p[t-2+e*(i+n+1)]=1,p[t+2+e*(i+n)]=1,p[t+n+1+e*(i+2)]=1;for(n=0;n<2;n++)x(t-1,i+n),x(t+1,i-n),x(t-n,i-1),x(t+n,i+1)}function w(t){for(;t>=255;)t=((t-=255)>>8)+(255&t);return t}var m=[];function S(t,e,i,n){var r,o,s;for(r=0;re&&(i=t,t=e,e=i),i=e,i+=e*e,i>>=1,g[i+=t]}function I(t){var i,n,r,o;switch(t){case 0:for(n=0;n>1&1,i=0;i=5&&(i+=3+v[e]-5);for(e=3;et||3*v[e-3]>=4*v[e]||3*v[e+3]>=4*v[e])&&(i+=40);return i}function k(){var t,i,n,r,o,s=0,a=0;for(i=0;ie*e;)h-=e*e,c++;for(s+=10*c,t=0;t1)for(P=s[t],B=e-7;;){for(M=e-7;M>P-3&&(b(M,B),!(M6)for(P=a[t-7],W=17,M=0;M<6;M++)for(B=0;B<3;B++,W--)1&(W>11?t>>W-12:P>>W)?(p[5-M+e*(2-B+e-11)]=1,p[2-B+e-11+e*(5-M)]=1):(x(5-M,2-B+e-11),x(2-B+e-11,5-M));for(B=0;B=(M=r*(i+n)+n)-2&&(O=M-2,t>9&&O--),T=O,t>9){for(d[T+2]=0,d[T+3]=0;T--;)P=d[T],d[T+3]|=255&P<<4,d[T+2]=P>>4;d[2]|=255&O<<4,d[1]=O>>4,d[0]=64|O>>12}else{for(d[T+1]=0,d[T+2]=0;T--;)P=d[T],d[T+2]|=255&P<<4,d[T+1]=P>>4;d[1]|=255&O<<4,d[0]=64|O>>4}for(T=O+3-(t<10);T0;L--)m[L]=m[L]?m[L-1]^l[w(f[m[L]]+T)]:m[L-1];m[0]=l[w(f[m[0]]+T)]}for(T=0;T<=o;T++)m[T]=f[m[T]];for(W=M,B=0,T=0;T>=1)1&B&&(p[e-1-W+8*e]=1,W<6?p[8+e*W]=1:p[8+e*(W+1)]=1);for(W=0;W<7;W++,B>>=1)1&B&&(p[8+e*(e-7+W)]=1,W?p[6-W+8*e]=1:p[7+8*e]=1);return p}(v)},utf16to8:function(t){var e,i,n,r;for(e="",n=t.length,i=0;i=1&&r<=127?e+=t.charAt(i):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r>>0&63)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|r>>0&63));return e},draw:function(t,i,n,r,o){i.drawView(n,r);var s=i.ctx,a=n.contentSize,h=a.width,c=a.height,f=a.left,l=a.top;r.borderRadius,r.backgroundColor;var d=r.color,u=void 0===d?"#000000":d;r.border,n.contentSize.left,n.borderSize.left,n.contentSize.top,n.borderSize.top;if(y=o||y,s){s.save(),i.setOpacity(r),i.setTransform(n,r);var p=Math.min(h,c);t=this.utf16to8(t);var g=this.getFrame(t),v=p/e;s.setFillStyle(u);for(var x=0;x=s||n==c&&o=s)&&(a=e.width/i.width);var f=i.width*a,l=i.height*a,d=r||[],u=d[0],p=d[1],g=O(u)?W(u,e.width):(e.width-f)*(P(u)?W(u,1):{left:0,center:.5,right:1}[u||"center"]),v=O(p)?W(p,e.height):(e.height-l)*(P(p)?W(p,1):{top:0,center:.5,bottom:1}[p||"center"]),y=function(t,e){return[(t-g)/a,(e-v)/a]},x=y(0,0),b=x[0],w=x[1],m=y(e.width,e.height),S=m[0],z=m[1],I=Math.max,M=Math.min;return{sx:I(b,0),sy:I(w,0),sw:M(S-b,i.width),sh:M(z-w,i.height),dx:I(g,0),dy:I(v,0),dw:M(f,e.width),dh:M(l,e.height)}}({objectFit:u,objectPosition:v},r.contentSize,t),o=i.sx,s=i.sy,a=i.sh,h=i.sw,c=i.dx,f=i.dy,l=i.dh,d=i.dw;I==n.MP_BAIDU?e.drawImage(t.src,c+m,f+S,d,l,o,s,h,a):e.drawImage(t.src,o,s,h,a,c+m,f+S,d,l)}else e.drawImage(t.src,m,S,b,w)},B=function(){e.restore(),L.drawView(r,o,!1,!0,!1),h(1)},T=function(t){k(t),B()},T(t),[2]}))}))}))];case 1:return h.sent(),[2]}}))}))},r.prototype.drawText=function(t,e,i,n){var r=this,o=this.ctx,s=e.borderSize,a=e.contentSize,h=e.left,c=e.top,f=a.width,l=a.height,d=a.left-s.left||0,u=a.top-s.top||0,p=i.color,g=i.lineHeight,v=i.fontSize,y=i.fontWeight,x=i.fontFamily,b=i.fontStyle,w=i.textIndent,m=void 0===w?0:w,S=i.textAlign,z=i.textStroke,I=i.verticalAlign,M=void 0===I?St:I,k=i.backgroundColor,P=i.lineClamp,O=i.backgroundClip,T=i.textShadow,L=i.textDecoration;if(m=B(m)?m:0,this.drawView(e,i,O!=xt),g=W(g,v),t){o.save(),h+=d,c+=u;var R=n.fontHeight,F=n.descent,A=void 0===F?0:F,j=n.ascent,E=A+(void 0===j?0:j);switch(o.setFonts({fontFamily:x,fontSize:v,fontWeight:y,fontStyle:b}),o.setTextBaseline(St),o.setTextAlign(S),O?this.setBackground(k,f,l,h,c):o.setFillStyle(p),S){case It:break;case Mt:h+=.5*f;break;case kt:h+=f}var C=n.lines*g,H=Math.ceil((l-C)/2);switch(H<0&&(H=0),M){case mt:break;case St:c+=H;break;case zt:c+=2*H}var D=(g-R)/2,$=g/2,Y=function(t){var e=o.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,r=e.actualBoundingBoxAscent;return M==mt?{fix:E?void 0===r?0:r:$-D/2,lineY:E?0:D-D/2}:M==St?{fix:E?$+n/4:$,lineY:E?0:D}:M==zt?{fix:E?g-n:$+D/2,lineY:E?2*D:D+D/2}:{fix:0,height:0,lineY:0}},U=function(t,e,i){var r=t;switch(S){case It:r+=i;break;case Mt:r=(t-=i/2)+i;break;case kt:r=t,t-=i}if(L){o.setLineWidth(v/13),o.beginPath();var s=.1*n.fontHeight;/\bunderline\b/.test(L)&&(o.moveTo(t,e+n.fontHeight+s),o.lineTo(r,e+n.fontHeight+s)),/\boverline\b/.test(L)&&(o.moveTo(t,e-s),o.lineTo(r,e-s)),/\bline-through\b/.test(L)&&(o.moveTo(t,e+.5*n.fontHeight),o.lineTo(r,e+.5*n.fontHeight)),o.closePath(),o.setStrokeStyle(p),o.stroke()}},N=function(t,e,i){var n=function(){o.setLineWidth(z.width),o.setStrokeStyle(z.color),o.strokeText(t,e,i)},s="outset";z&&z.type!==s?(o.save(),r.setShadow({boxShadow:T}),o.fillText(t,e,i),o.restore(),n()):z&&z.type==s?(o.save(),r.setShadow({boxShadow:T}),n(),o.restore(),o.save(),o.fillText(t,e,i),o.restore()):(r.setShadow({boxShadow:T}),o.fillText(t,e,i))};if(!n.widths||1==n.widths.length&&n.widths[0].total+m<=a.width){var X=Y(t),_=X.fix,q=void 0===_?0:_,G=X.lineY;return N(t,h+m,c+q),U(h+m,c+G,n&&n.widths&&n.widths[0].total||n.text),c+=g,o.restore(),void this.setBorder(e,i)}for(var V=c,J=h,Q="",Z=0,K=o.measureText("...").width,tt=n.widths,et=0;eta.width){Z>=P&&(Q+="…"),Z++,nt=0;var ct=Y(Q);q=ct.fix,G=ct.lineY;N(Q,J,c+q),U(J,c+G,nt),c+=g,Q=""}else if(rt==it.length-1){et!=tt.length-1&&Z==P&&K+ntV+l||Z>P)break}}o.restore()}},r.prototype.source=function(t){return e(this,void 0,void 0,(function(){var e,n,r,o,s=this;return i(this,(function(i){switch(i.label){case 0:if(this.node=null,e=+new Date,"{}"==JSON.stringify(t))return[2];if(t.styles=t.styles||t.css||{},!t.type)for(n in t.type=wt,t)["views","children","type","css","styles"].includes(n)||(t.styles[n]=t[n],delete t[n]);return t.styles.boxSizing||(t.styles.boxSizing="border-box"),[4,this.create(t)];case 1:return(r=i.sent())?(o=r.layout()||{},this.size=o,this.node=r,this.onEffectFinished().then((function(t){return s.lifecycle("onEffectSuccess",t)})).catch((function(t){return s.lifecycle("onEffectFail",t)})),this.performance&&console.log("布局用时:"+(+new Date-e)+"ms"),[2,this.size]):[2,console.warn("no node")]}}))}))},r.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},r.prototype.create=function(n,r){return e(this,void 0,void 0,(function(){function e(i,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var o=[];return i.forEach((function(i){var s=i.styles,a=void 0===s?{}:s,h=i.css,c=void 0===h?{}:h,f=i.children,l=void 0===f?[]:f,d=i.views,u=void 0===d?[]:d,p=i.text,g=void 0===p?"":p,v=i.type,y=void 0===v?"":v;!l&&u&&(i.children=l=u);var x={};x=t(t(r?t({},n):{},a),c);var b={},w={},m={};Object.keys(x).map((function(t){if(t.includes("padding")||t.includes("margin")){var e=J(t,x[t]);Object.keys(e).map((function(t){t.includes("Left")?w[t]=e[t]:t.includes("Right")?m[t]=e[t]:b[t]=e[t]}))}}));if(x.textIndent&&(w.textIndent=x.textIndent,delete n.textIndent),""!==g){var S=Array.from(g);S.forEach((function(t,e){var i=Object.assign({},x,b);0===e?Object.assign(i,w):e==S.length-1&&Object.assign(i,m),delete i.padding,delete i.margin,o.push({type:"text",text:t,styles:i})}))}if(y==yt||y==bt)o.push(i);else if("block"===a.display&&l.length>0){var z=e(l,x,!1);i.children=z,i.flattened=!0,o.push(i)}else if(l.length>0){z=e(l,x,r);o=o.concat(z)}})),o}var o,s,a,h,c,f,l,d,u,p,g,v,y,b,w,m,S,z,I,M,k,B,W,P;return i(this,(function(i){switch(i.label){case 0:if(!n)return[2];if(n.styles||(n.styles=n.css||{}),o=n.type,s=n.show,a=void 0===s||s,h=o==yt,c=[xt,bt].includes(o),f="textBox"==o,l=n.styles||{},d=l.backgroundImage,u=l.display,h&&!n.src&&!n.url)return[2];if(u==x||!a)return[2];if(c||f){if(p=n.children,g=n.views,!p&&g&&(n.children=p=g),!n.text&&(!p||p&&!p.length))return[2];p&&p.length&&!n.flattened&&(v=e(n.children||n.views),n.type="view",n.children=v)}if(!(h||n.type==wt&&d))return[3,4];y=h?n.src:"",b=/url\(['"]?(.*?)['"]?\)/.exec(d),d&&b&&b[1]&&(y=b[1]||""),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.getImageInfo(y)];case 2:return w=i.sent(),m=w.width,S=w.height,!(z=w.path)&&h?[2]:(z&&(n.attributes=Object.assign(n.attributes||{},{width:m,height:S,path:z,src:z,naturalSrc:y})),[3,4]);case 3:return I=i.sent(),n.type!=wt?[2]:(this.lifecycle("onEffectFail",t(t({},I),{src:y})),[3,4]);case 4:if(this.count+=1,M=new gt(n,r,this.root,this.ctx),!(k=n.children||n.views))return[3,8];B=0,i.label=5;case 5:return B0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=360&&(s-=360);s<0&&(s+=360);if(0===(s=Math.round(s)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===s)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===s)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===s)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var h=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(s===h)return{x0:n,y0:i+r,x1:e+n,y1:r};if(s===180-h)return{x0:n,y0:r,x1:e+n,y1:i+r};if(s===180+h)return{x0:e+n,y0:r,x1:n,y1:i+r};if(s===360-h)return{x0:e+n,y0:i+r,x1:n,y1:r};var a=0,l=0,d=0,c=0;if(s180-h&&s<180||s>180&&s<180+h||s>360-h){var f=s*Math.PI/180,u=s360-h?i/2:-i/2,p=Math.tan(f)*u,g=s180-h&&s<180?e/2-p:-e/2-p;a=-(d=p+(v=Math.pow(Math.sin(f),2)*g)),l=-(c=u+v/Math.tan(f))}if(s>h&&s<90||s>90&&s<90+h||s>180+h&&s<270||s>270&&s<360-h){var v;f=(90-s)*Math.PI/180,p=s>h&&s<90||s>90&&s<90+h?e/2:-e/2,u=Math.tan(f)*p,g=s>h&&s<90||s>270&&s<360-h?i/2-u:-i/2-u;a=-(d=p+(v=Math.pow(Math.sin(f),2)*g)/Math.tan(f)),l=-(c=u+v)}return a=Math.round(a+e/2)+n,l=Math.round(i/2-l)+r,d=Math.round(d+e/2)+n,c=Math.round(i/2-c)+r,{x0:a,y0:l,x1:d,y1:c}}(r,t,e,i,n),h=s.x0,a=s.y0,l=s.x1,d=s.y1,c=o.createLinearGradient(h,a,l,d),f=r.match(/linear-gradient\((.+)\)/)[1],u=L(f.substring(f.indexOf(",")+1)),p=0;pt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function H(t){return"number"==typeof t}function C(t){return"auto"===t||null===t}function D(t){return/%$/.test(t)}var Y=p,$=u,U=f,N=g,X=y,_=w,q=m;function G(t){return t.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()}))}function V(t,e){var i,n,o=function(t){var e=t.match(/([a-z]+)/)[1];return[e,G(t.split(e)[1])]}(t),s=o[0],h=o[1],a=e.split(" ");if(h)return(i={})[s+h]=e,i;if(a.length&&!h){var l=a[0],d=a[1],c=a[2],f=a[3];return(n={})[s+r[0]]=l,n[s+r[1]]=d||l,n[s+r[2]]=c||l,n[s+r[3]]=f||d||l,n}}function J(t){t=t.trim();for(var e=new Array,i="+",n="",r=t.length,o=0;o0;)"("===t[h+=1]&&(s+=1),")"===t[h]&&(s-=1);n="".concat(J(t.slice(o+1,h))),o=h}if(isNaN(Number(t[o]))&&"."!==t[o]||o===r-1){var a=parseFloat(n);switch(i){case"+":e.push(a);break;case"-":e.push(-a);break;case"*":e.push(e.pop()*a);break;case"/":e.push(e.pop()/a)}i=t[o],n=""}}for(var l=0;e.length;)l+=e.pop();return l}var Q,Z=0,K=function(){function t(){R(this,"elements",[]),R(this,"afterElements",[]),R(this,"beforeElements",[]),R(this,"ids",[]),R(this,"width",0),R(this,"height",0),R(this,"top",0),R(this,"left",0),R(this,"pre",null),R(this,"offsetX",0),R(this,"offsetY",0),Z++,this.id=Z}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){if(!this.ids.includes(t.id)){this.ids.push(t.id),this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()}},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth)||(this.closeLine(),!1)},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.includes(t.id)||(this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t))},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0)this[this.key.height]&&(this.container[this.key.lineMaxHeight]=this[this.key.height]=i),this[this.key.width]+=this.getWidth(t.offsetSize);var n=Math.min(this.getWidth(this),!this.getWidth(this.container.contentSize)&&1/0);(this.container[this.key.lineMaxWidth]||0)1)return 0;var e=t.style.alignSelf,i=this.getHeight(this.container.contentSize),n=i-this.getHeight(t.offsetSize);return"flex-end"===e?n:"center"===e?n/2:"stretch"===e?(n&&t.name==f&&(t.style[this.key.width]=this.getWidth(t.offsetSize),t.style[this.key.height]=i,delete t.line,delete t.lines,t.getBoxWidthHeight()),0):0},r.layout=function(t,e){var i=this;this.refreshXAlign(),this.pre?(this.top=this.pre.top+this.pre.height+this.offsetY,this.left=e+this.offsetX):(this.top=Math.max(this.top,this.container.contentSize.top,t)+this.offsetY,this.left=Math.max(this.left,this.container.contentSize.left,e)+this.offsetX),this.elements.forEach((function(t,e){i.setIndent(t);var n=i.elements[e-1],r=i.getOffsetY(t);t.style[i.key.top]=i[i.key.top]+r,t.style[i.key.left]=n?n.offsetSize[i.key.left]+i.getWidth(n.offsetSize):i[i.key.left],t.getBoxPosition()}))},n}(K),nt=p,rt=u,ot=f,st=v,ht=y,at=b,lt=w,dt=m,ct=0,ft={left:null,top:null,width:null,height:null},ut=new Map,pt=function(){function t(t,e,i,n){var o=this;R(this,"id",ct++),R(this,"style",{left:null,top:null,width:null,height:null}),R(this,"computedStyle",{}),R(this,"originStyle",{}),R(this,"children",{}),R(this,"layoutBox",F({},ft)),R(this,"contentSize",F({},ft)),R(this,"clientSize",F({},ft)),R(this,"borderSize",F({},ft)),R(this,"offsetSize",F({},ft)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.type||t.name,this.attributes=this.getAttributes(t);var s=function(t,e){var i,n=["color","fontSize","lineHeight","verticalAlign","fontWeight","textAlign"],o=t.type,s=void 0===o?U:o,h=t.styles,a=void 0===h?{}:h,l=(e||{}).computedStyle,d=Object.assign({},S);if([$,Y,N].includes(s)&&!a.display&&(d.display=X),l)for(var c=0;c=0&&c<0,Y=l>=0&&u<0;return i==h[0]&&(this[i].left=t.left+s+v+E+(D?2*-c:0),this[i].top=t.top+l+x+k+(Y?2*-u:0),this[i].width=t.width+(this[i].widthAdd?0:H),this[i].height=t.height+(this[i].heightAdd?0:C),this[i].widthAdd=H,this[i].heightAdd=C),i==h[1]&&(this[i].left=t.left+s+E+(D<0?-c:0),this[i].top=t.top+l+k+(Y?-u:0),this[i].width=t.width+v+w,this[i].height=t.height+x+S),i==h[2]&&(this[i].left=t.left+s+E/2+(D<0?-c:0),this[i].top=t.top+l+k/2+(Y?-u:0),this[i].width=t.width+v+w+E/2+F/2,this[i].height=t.height+x+S+T/2+k/2),i==h[3]&&(this[i].left=t.left+(D<0?-c:0),this[i].top=t.top+(Y?-u:0),this[i].width=t.width+v+w+E+F+s+c,this[i].height=t.height+x+S+T+k+u+l),this[i]},e.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),"border-box"==e.boxSizing){var o=e||{},s=o.border,a=(s=void 0===s?{}:s).borderWidth,l=void 0===a?0:a,d=o.borderTop,c=(d=void 0===d?{}:d).borderTopWidth,f=void 0===c?l:c,u=o.borderBottom,p=(u=void 0===u?{}:u).borderBottomWidth,g=void 0===p?l:p,v=o.borderRight,y=(v=void 0===v?{}:v).borderRightWidth,x=void 0===y?l:y,b=o.borderLeft,w=(b=void 0===b?{}:b).borderLeftWidth,m=void 0===w?l:w,S=o.padding,z=(S=void 0===S?{}:S).paddingTop,I=void 0===z?0:z,M=S.paddingRight,B=void 0===M?0:M,W=S.paddingBottom,k=void 0===W?0:W,P=S.paddingLeft,O=void 0===P?0:P;i||(t.width-=O+B+x+m),1!==i||n||(t.height-=I+k+f+g)}this.layoutBox&&(h.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},e.getBoxPosition=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,s=void 0===o?0:o,h=F({},this.contentSize,{left:r,top:s}),a=this.contentSize.top-this.offsetSize.top,l=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var d,c=E(this.root.fixedLine.elements);!(d=c()).done;){var f=d.value;f.setPosition(f,this.root.offsetSize),f.getBoxPosition()}}if(e)for(var u,p=E(e.elements);!(u=p()).done;){var g=u.value,v=F({},this.borderSize,{left:r,top:s});g.setPosition(g,v);var y=this.borderSize.top-this.offsetSize.top,x=this.borderSize.left-this.offsetSize.left;g.style.left+=r+x,g.style.top+=s+y,g.getBoxPosition()}if(i)for(var b,w=E(i);!(b=w()).done;){b.value.layout(h.top+a,h.left+l)}return this.layoutBoxUpdate(h,t),this.layoutBox},e.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},e.isBlock=function(t){return void 0===t&&(t=this),t&&t.style.display==st},e.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==at},e.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},e.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&(!!t.parent&&(!(!t.parent||t.parent.style.display!==at)||void 0))},e.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==ht},e.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},e.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},e.getParentSize=function(t,e){if(void 0===t&&(t=this),void 0===e&&(e=!1),t&&t.parent){if(t.parent.contentSize.width)return t.parent.contentSize;if(e)return this.getParentSize(t.parent,e)}return null},e.getBoxWidthHeight=function(){var t=this,e=this.name,i=this.computedStyle,n=this.attributes,r=this.parent,o=void 0===r?{}:r,s=this.ctx,h=this.getChildren(),a=i.left,l=void 0===a?0:a,d=i.top,c=void 0===d?0:d,f=i.bottom,u=i.right,p=i.width,g=void 0===p?0:p,v=i.minWidth,y=i.maxWidth,x=i.minHeight,b=i.maxHeight,w=i.height,m=void 0===w?0:w,S=i.fontSize,z=i.fontWeight,I=i.fontFamily,M=i.fontStyle,B=i.position;i.textIndent;var W=i.lineClamp,P=i.lineHeight,O=i.padding,T=void 0===O?{}:O,L=i.margin,R=void 0===L?{}:L,F=i.border,A=(F=void 0===F?{}:F).borderWidth,j=void 0===A?0:A,E=i.borderRight,H=(E=void 0===E?{}:E).borderRightWidth,Y=void 0===H?j:H,$=i.borderLeft,U=($=void 0===$?{}:$).borderLeftWidth,N=void 0===U?j:U,X=o.contentSize&&o.contentSize.width,_=o.contentSize&&o.contentSize.height;if(D(g)&&X&&(g=k(g,X)),D(g)&&!X&&(g=null),D(m)&&_&&(m=k(m,_)),D(m)&&!_&&(m=null),D(v)&&X&&(v=k(v,X)),D(y)&&X&&(y=k(y,X)),D(x)&&_&&(x=k(x,_)),D(b)&&_&&(b=k(b,_)),i.padding&&X)for(var q in i.padding)Object.hasOwnProperty.call(T,q)&&(T[q]=k(T[q],X));var G=T.paddingRight,V=void 0===G?0:G,J=T.paddingLeft,Q=void 0===J?0:J;if(i.margin&&[R.marginLeft,R.marginRight].includes("auto"))if(g){var Z=X&&X-g-V-Q-N-Y||0;R.marginLeft==R.marginRight?R.marginLeft=R.marginRight=Z/2:C(R.marginLeft)?R.marginLeft=Z:R.marginRight=Z}else R.marginLeft=R.marginRight=0;var tt=R.marginRight,et=void 0===tt?0:tt,st=R.marginLeft,ht={width:g,height:m,left:0,top:0},at=Q+V+N+Y+(void 0===st?0:st)+et;if(this.offsetWidth=at,e==rt&&!this.attributes.widths){var dt=n.text||"";s.save(),s.setFonts({fontFamily:I,fontSize:S,fontWeight:z,fontStyle:M}),dt.length,"\n"==dt&&(dt="",this.isBr=!0),(""+dt).split("\n").map((function(e){var i=Array.from(e).map((function(e){var i=""+(/^[\u4e00-\u9fa5]+$/.test(e)?"cn":e)+I+S+z+M,n=ut.get(i);if(n)return{width:n,text:e};var r=t.measureText(e,S).width;return ut.set(i,r),{width:r,text:e}})),n=t.measureText(e,S),r=n.fontHeight,o=n.ascent,s=n.descent;t.attributes.fontHeight=r,t.attributes.ascent=o,t.attributes.descent=s,t.attributes.widths||(t.attributes.widths=[]),t.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e.width}),0)})})),s.restore()}if(e==nt&&null==g){var ct=n.width,ft=n.height;ht.width=this.contrastSize(Math.round(ct*m/ft)||0,v,y),this.layoutBoxUpdate(ht,i,0)}if(e==rt&&null==g){var pt=this.attributes.widths,gt=Math.max.apply(Math,pt.map((function(t){return t.total})));if(o&&X>0&&(gt>X||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed)gt=X;ht.width=this.contrastSize(gt,v,y),this.layoutBoxUpdate(ht,i,0)}if(e==rt&&(o.style.flex||!this.attributes.lines)){var vt=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e.width>ht.width?(vt++,e.width):t+e.width}),0)})),vt=W&&vt>W?W:vt,this.attributes.lines=vt}if(e==nt&&null==m){var yt=n.width,xt=n.height;n.text,ht.height=this.contrastSize(k(ht.width*xt/yt)||0,x,b),this.layoutBoxUpdate(ht,i,1)}e==rt&&null==m&&(P=k(P,S),ht.height=this.contrastSize(k(this.attributes.lines*P),x,b),this.layoutBoxUpdate(ht,i,1,!0)),!g&&o&&o.children&&X&&(!this.isFlex(o)||o.isFlexCalc)&&([ot,rt].includes(e)&&this.isFlex()||e==ot&&this.isBlock(this)&&this.isInFlow())&&(ht.width=this.contrastSize(X-(o.isFlexCalc?0:at),v,y),this.layoutBoxUpdate(ht,i)),g&&!D(g)&&(ht.width=this.contrastSize(g,v,y),this.layoutBoxUpdate(ht,i,0)),m&&!D(m)&&(ht.height=this.contrastSize(ht.height,x,b),this.layoutBoxUpdate(ht,i,1));var bt=0;if(h.length){var wt=null,mt=!1;h.forEach((function(e,n){e.getBoxWidthHeight();var r=h[n+1];if(r&&r.isInFlow()&&(e.next=r),!t.line||!t.line.ids.includes(e.id))if(e.isInFlow()&&!e.inFlexBox()){var o=t.getBoxState(wt,e);if(e.isBr)return mt=!0;t.line&&t.line.canIEnter(e)&&!o&&!mt?t.line.add(e):(mt=!1,(new K).bind(e)),wt=e}else e.inFlexBox()?t.line&&(t.line.canIEnter(e)||"nowrap"==i.flexWrap)?t.line.add(e):(new it).bind(e):e.isFixed?t.root.fixedLine?t.root.fixedLine.fixedAdd(e):(new K).fixedBind(e):t.fixedLine?t.fixedLine.fixedAdd(e):(new K).fixedBind(e,1)})),this.lines&&(bt=this.lines.reduce((function(t,e){return t+e.height}),0))}var St=0,zt=0;if(!g&&(this.isAbsolute||this.isFixed)&&X){var It=B==lt?X:this.root.width,Mt=It-(D(l)?k(l,It):l)-(D(u)?k(u,It):u);St=i.left?Mt:this.lineMaxWidth}if(!m&&(null!=c?c:this.isAbsolute||this.isFixed&&_)){var Bt=B==lt?_:this.root.height,Wt=Bt-(D(c)?k(c,Bt):c)-(D(f)?k(f,Bt):f);zt=i.top?Wt:0}if(g&&!D(g)||ht.width||(ht.width=St||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?X||o.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,v,y),this.layoutBoxUpdate(ht,i,0)),m||!bt&&!zt||(ht.height=zt||this.contrastSize(bt,x,b),this.layoutBoxUpdate(ht,i)),i.borderRadius&&this.borderSize&&this.borderSize.width)for(var q in i.borderRadius)Object.hasOwnProperty.call(i.borderRadius,q)&&(i.borderRadius[q]=k(i.borderRadius[q],this.borderSize.width));return this.layoutBox},e.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.root.contentSize=this.contentSize,this.getBoxPosition(),this.offsetSize},t}(),gt=p,vt=u,yt=g,xt=f,bt=d.TOP,wt=d.MIDDLE,mt=d.BOTTOM,St=c.LEFT,zt=c.CENTER,It=c.RIGHT,Mt=function(){function r(t){var e,i,r=this;this.v="1.9.5.1",this.id=null,this.pixelRatio=1,this.width=0,this.height=0,this.sleep=1e3/30,this.count=0,this.isRate=!1,this.isDraw=!0,this.isCache=!0,this.fixed="",this.useCORS=!1,this.performance=!1,this.imageBus=[],this.createImage=function(t,e){return new Promise((function(i,n){var o=null;window||r.canvas.createImage?(o=r.canvas&&r.canvas.createImage?r.canvas.createImage():new Image,e&&o.setAttribute("crossOrigin","Anonymous"),o.src=t,o.onload=function(){i({width:o.naturalWidth||o.width,height:o.naturalHeight||o.height,path:o,src:this.src})},o.onerror=function(t){n(t)}):n({fail:"getImageInfo fail",src:t})}))},this.options=t,Object.assign(this,t),this.ctx=(e=t.context,i={get:function(t,i){if("setFonts"===i)return function(t){var i=t.fontFamily,r=void 0===i?"sans-serif":i,o=t.fontSize,s=void 0===o?14:o,h=t.fontWeight,a=void 0===h?"normal":h,l=t.fontStyle,d=void 0===l?"normal":l;I==n.MP_TOUTIAO&&(a="bold"==a?"bold":"",d="italic"==d?"italic":""),e.font="".concat(d," ").concat(a," ").concat(Math.round(s),"px ").concat(r)};if(!e.draw||!e.setFillStyle){if("setFillStyle"===i)return function(t){e.fillStyle=t};if("setStrokeStyle"===i)return function(t){e.strokeStyle=t};if("setLineWidth"===i)return function(t){e.lineWidth=t};if("setLineCap"===i)return function(t){e.lineCap=t};if("setFontSize"===i)return function(t){e.font="".concat(String(t),"px sans-serif")};if("setGlobalAlpha"===i)return function(t){e.globalAlpha=t};if("setLineJoin"===i)return function(t){e.lineJoin=t};if("setTextAlign"===i)return function(t){e.textAlign=t};if("setMiterLimit"===i)return function(t){e.miterLimit=t};if("setShadow"===i)return function(t,i,n,r){e.shadowOffsetX=t,e.shadowOffsetY=i,e.shadowBlur=n,e.shadowColor=r};if("setTextBaseline"===i)return function(t){e.textBaseline=t};if("createCircularGradient"===i)return function(){};if("draw"===i)return function(){};if("function"==typeof e[i])return function(){for(var t=[],n=0;n=s||n==l&&o=s)&&(h=e.width/i.width);var d=i.width*h,c=i.height*h,f=r||[],u=f[0],p=f[1],g=W(u)?k(u,e.width):(e.width-d)*(P(u)?k(u,1):{left:0,center:.5,right:1}[u||"center"]),v=W(p)?k(p,e.height):(e.height-c)*(P(p)?k(p,1):{top:0,center:.5,bottom:1}[p||"center"]),y=function(t,e){return[(t-g)/h,(e-v)/h]},x=y(0,0),b=x[0],w=x[1],m=y(e.width,e.height),S=m[0],z=m[1],I=Math.max,M=Math.min;return{sx:I(b,0),sy:I(w,0),sw:M(S-b,i.width),sh:M(z-w,i.height),dx:I(g,0),dy:I(v,0),dw:M(d,e.width),dh:M(c,e.height)}}({objectFit:u,objectPosition:v},r.contentSize,t),o=i.sx,s=i.sy,h=i.sh,a=i.sw,l=i.dx,d=i.dy,c=i.dh,f=i.dw;I==n.MP_BAIDU?e.drawImage(t.src,l+m,d+S,f,c,o,s,a,h):e.drawImage(t.src,o,s,a,h,l+m,d+S,f,c)}else e.drawImage(t.src,m,S,b,w)},O=function(){e.restore(),L.drawView(r,o,!1,!0,!1),a(1)},T=function(t){B(t),O()},T(t),[2]}))}))}))];case 1:return a.sent(),[2]}}))}))},r.prototype.drawText=function(t,e,i,n){var r=this,o=this.ctx,s=e.borderSize,h=e.contentSize,a=e.left,l=e.top,d=h.width,c=h.height,f=h.left-s.left||0,u=h.top-s.top||0,p=i.color,g=i.lineHeight,v=i.fontSize,y=i.fontWeight,x=i.fontFamily,b=i.fontStyle,w=i.textIndent,m=void 0===w?0:w,S=i.textAlign,z=i.textStroke,I=i.verticalAlign,M=void 0===I?wt:I,B=i.backgroundColor,P=i.lineClamp,O=i.backgroundClip,T=i.textShadow,L=i.textDecoration;if(m=W(m)?m:0,this.drawView(e,i,O!=vt),g=k(g,v),t){o.save(),a+=f,l+=u;var R=n.fontHeight,F=n.descent,A=void 0===F?0:F,j=n.ascent,E=A+(void 0===j?0:j);switch(o.setFonts({fontFamily:x,fontSize:v,fontWeight:y,fontStyle:b}),o.setTextBaseline(wt),o.setTextAlign(S),O?this.setBackground(B,d,c,a,l):o.setFillStyle(p),S){case St:break;case zt:a+=.5*d;break;case It:a+=d}var H=n.lines*g,C=Math.ceil((c-H)/2);switch(C<0&&(C=0),M){case bt:break;case wt:l+=C;break;case mt:l+=2*C}var D=(g-R)/2,Y=g/2,$=function(t){var e=o.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,r=e.actualBoundingBoxAscent;return M==bt?{fix:E?void 0===r?0:r:Y-D/2,lineY:E?0:D-D/2}:M==wt?{fix:E?Y+n/4:Y,lineY:E?0:D}:M==mt?{fix:E?g-n:Y+D/2,lineY:E?2*D:D+D/2}:{fix:0,height:0,lineY:0}},U=function(t,e,i){var r=t;switch(S){case St:r+=i;break;case zt:r=(t-=i/2)+i;break;case It:r=t,t-=i}if(L){o.setLineWidth(v/13),o.beginPath();var s=.1*n.fontHeight;/\bunderline\b/.test(L)&&(o.moveTo(t,e+n.fontHeight+s),o.lineTo(r,e+n.fontHeight+s)),/\boverline\b/.test(L)&&(o.moveTo(t,e-s),o.lineTo(r,e-s)),/\bline-through\b/.test(L)&&(o.moveTo(t,e+.5*n.fontHeight),o.lineTo(r,e+.5*n.fontHeight)),o.closePath(),o.setStrokeStyle(p),o.stroke()}},N=function(t,e,i){var n=function(){o.setLineWidth(z.width),o.setStrokeStyle(z.color),o.strokeText(t,e,i)},s="outset";z&&z.type!==s?(o.save(),r.setShadow({boxShadow:T}),o.fillText(t,e,i),o.restore(),n()):z&&z.type==s?(o.save(),r.setShadow({boxShadow:T}),n(),o.restore(),o.save(),o.fillText(t,e,i),o.restore()):(r.setShadow({boxShadow:T}),o.fillText(t,e,i))};if(!n.widths||1==n.widths.length&&n.widths[0].total+m<=h.width){var X=$(t),_=X.fix,q=void 0===_?0:_,G=X.lineY;return N(t,a+m,l+q),U(a+m,l+G,n&&n.widths&&n.widths[0].total||n.text),l+=g,o.restore(),void this.setBorder(e,i)}for(var V=l,J=a,Q="",Z=0,K=o.measureText("...").width,tt=n.widths,et=0;eth.width){Z>=P&&(Q+="…"),Z++,nt=0;var lt=$(Q);q=lt.fix,G=lt.lineY;N(Q,J,l+q),U(J,l+G,nt),l+=g,Q=""}else if(rt==it.length-1){et!=tt.length-1&&Z==P&&K+ntV+c||Z>P)break}}o.restore()}},r.prototype.source=function(t){return e(this,void 0,void 0,(function(){var e,n,r,o,s=this;return i(this,(function(i){switch(i.label){case 0:if(this.node=null,e=+new Date,"{}"==JSON.stringify(t))return[2];if(!t.type)for(n in t.type=xt,t.styles=t.styles||t.css||{},t)["views","children","type","css","styles"].includes(n)||(t.styles[n]=t[n],delete t[n]);return t.styles.boxSizing||(t.styles.boxSizing="border-box"),[4,this.create(t)];case 1:return(r=i.sent())?(o=r.layout()||{},this.size=o,this.node=r,this.onEffectFinished().then((function(t){return s.lifecycle("onEffectSuccess",t)})).catch((function(t){return s.lifecycle("onEffectFail",t)})),this.performance&&console.log("布局用时:"+(+new Date-e)+"ms"),[2,this.size]):[2,console.warn("no node")]}}))}))},r.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},r.prototype.create=function(n,r){return e(this,void 0,void 0,(function(){function e(i,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var o=[];return i.forEach((function(i){var s=i.styles,h=void 0===s?{}:s,a=i.children,l=void 0===a?[]:a,d=i.text,c=void 0===d?"":d,f=i.type,u=void 0===f?"":f,p={};p=t(r?t({},n):{},h);var g={},v={},y={};Object.keys(p).map((function(t){if(t.includes("padding")||t.includes("margin")){var e=V(t,p[t]);Object.keys(e).map((function(t){t.includes("Left")?v[t]=e[t]:t.includes("Right")?y[t]=e[t]:g[t]=e[t]}))}}));if(p.textIndent&&(v.textIndent=p.textIndent,delete n.textIndent),""!==c){var x=Array.from(c);x.forEach((function(t,e){var i=Object.assign({},p,g);0===e?Object.assign(i,v):e==x.length-1&&Object.assign(i,y),delete i.padding,delete i.margin,o.push({type:"text",text:t,styles:i})}))}if(u==gt||u==yt)o.push(i);else if("block"===h.display&&l.length>0){var b=e(l,p,!1);i.children=b,i.flattened=!0,o.push(i)}else if(l.length>0){b=e(l,p,r);o=o.concat(b)}})),o}var o,s,h,a,l,d,c,f,u,p,g,v,y,b,w,m,S,z,I,M,B;return i(this,(function(i){switch(i.label){case 0:if(!n)return[2];if(n.styles||(n.styles=n.css||{}),o=n.type,s=o==gt,h=[vt,yt].includes(o),a="textBox"==o,l=n.styles||{},d=l.backgroundImage,c=l.display,s&&!n.src&&!n.url)return[2];if(c==x)return[2];if(h||a){if(f=n.children,!n.text&&(!f||f&&!f.length))return[2];f&&f.length&&!n.flattened&&(u=e(n.children),n.type="view",n.children=u)}if(!(s||n.type==xt&&d))return[3,4];p=s?n.src:"",g=/url\(['"]?(.*?)['"]?\)/.exec(d),d&&g&&g[1]&&(p=g[1]||""),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.getImageInfo(p)];case 2:return v=i.sent(),y=v.width,b=v.height,!(w=v.path)&&s?[2]:(w&&(n.attributes=Object.assign(n.attributes||{},{width:y,height:b,path:w,src:w,naturalSrc:p})),[3,4]);case 3:return m=i.sent(),n.type!=xt?[2]:(this.lifecycle("onEffectFail",t(t({},m),{src:p})),[3,4]);case 4:if(this.count+=1,S=new pt(n,r,this.root,this.ctx),!(z=n.views||n.children))return[3,8];I=0,i.label=5;case 5:return I0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=360&&(s-=360);s<0&&(s+=360);if(0===(s=Math.round(s)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===s)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===s)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===s)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var h=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(s===h)return{x0:n,y0:i+r,x1:e+n,y1:r};if(s===180-h)return{x0:n,y0:r,x1:e+n,y1:i+r};if(s===180+h)return{x0:e+n,y0:r,x1:n,y1:i+r};if(s===360-h)return{x0:e+n,y0:i+r,x1:n,y1:r};var a=0,l=0,d=0,c=0;if(s180-h&&s<180||s>180&&s<180+h||s>360-h){var f=s*Math.PI/180,u=s360-h?i/2:-i/2,p=Math.tan(f)*u,g=s180-h&&s<180?e/2-p:-e/2-p;a=-(d=p+(v=Math.pow(Math.sin(f),2)*g)),l=-(c=u+v/Math.tan(f))}if(s>h&&s<90||s>90&&s<90+h||s>180+h&&s<270||s>270&&s<360-h){var v;f=(90-s)*Math.PI/180,p=s>h&&s<90||s>90&&s<90+h?e/2:-e/2,u=Math.tan(f)*p,g=s>h&&s<90||s>270&&s<360-h?i/2-u:-i/2-u;a=-(d=p+(v=Math.pow(Math.sin(f),2)*g)/Math.tan(f)),l=-(c=u+v)}return a=Math.round(a+e/2)+n,l=Math.round(i/2-l)+r,d=Math.round(d+e/2)+n,c=Math.round(i/2-c)+r,{x0:a,y0:l,x1:d,y1:c}}(r,t,e,i,n),h=s.x0,a=s.y0,l=s.x1,d=s.y1,c=o.createLinearGradient(h,a,l,d),f=r.match(/linear-gradient\((.+)\)/)[1],u=R(f.substring(f.indexOf(",")+1)),p=0;pt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function C(t){return"number"==typeof t}function D(t){return"auto"===t||null===t}function $(t){return/%$/.test(t)}var Y=p,U=u,N=f,X=g,_=y,q=w,G=m;function V(t){return t.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()}))}function J(t,e){var i,n,o=function(t){var e=t.match(/([a-z]+)/)[1];return[e,V(t.split(e)[1])]}(t),s=o[0],h=o[1],a=e.split(" ");if(h)return(i={})[s+h]=e,i;if(a.length&&!h){var l=a[0],d=a[1],c=a[2],f=a[3];return(n={})[s+r[0]]=l,n[s+r[1]]=d||l,n[s+r[2]]=c||l,n[s+r[3]]=f||d||l,n}}function Q(t){t=t.trim();for(var e=new Array,i="+",n="",r=t.length,o=0;o0;)"("===t[h+=1]&&(s+=1),")"===t[h]&&(s-=1);n="".concat(Q(t.slice(o+1,h))),o=h}if(isNaN(Number(t[o]))&&"."!==t[o]||o===r-1){var a=parseFloat(n);switch(i){case"+":e.push(a);break;case"-":e.push(-a);break;case"*":e.push(e.pop()*a);break;case"/":e.push(e.pop()/a)}i=t[o],n=""}}for(var l=0;e.length;)l+=e.pop();return l}var Z,K=0,et=function(){function t(){F(this,"elements",[]),F(this,"afterElements",[]),F(this,"beforeElements",[]),F(this,"ids",[]),F(this,"width",0),F(this,"height",0),F(this,"top",0),F(this,"left",0),F(this,"pre",null),F(this,"offsetX",0),F(this,"offsetY",0),K++,this.id=K}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){if(!this.ids.includes(t.id)){this.ids.push(t.id),this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()}},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth)||(this.closeLine(),!1)},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.includes(t.id)||(this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t))},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0)this[this.key.height]&&(this.container[this.key.lineMaxHeight]=this[this.key.height]=i),this[this.key.width]+=this.getWidth(t.offsetSize);var n=Math.min(this.getWidth(this),!this.getWidth(this.container.contentSize)&&1/0);(this.container[this.key.lineMaxWidth]||0)1)return 0;var e=t.style.alignSelf,i=this.getHeight(this.container.contentSize),n=i-this.getHeight(t.offsetSize);return"flex-end"===e?n:"center"===e?n/2:"stretch"===e?(n&&t.name==f&&(t.style[this.key.width]=this.getWidth(t.offsetSize),t.style[this.key.height]=i,delete t.line,delete t.lines,t.getBoxWidthHeight()),0):0},r.layout=function(t,e){var i=this;this.refreshXAlign(),this.pre?(this.top=this.pre.top+this.pre.height+this.offsetY,this.left=e+this.offsetX):(this.top=Math.max(this.top,this.container.contentSize.top,t)+this.offsetY,this.left=Math.max(this.left,this.container.contentSize.left,e)+this.offsetX),this.elements.forEach((function(t,e){i.setIndent(t);var n=i.elements[e-1],r=i.getOffsetY(t);t.style[i.key.top]=i[i.key.top]+r,t.style[i.key.left]=n?n.offsetSize[i.key.left]+i.getWidth(n.offsetSize):i[i.key.left],t.getBoxPosition()}))},n}(et),rt=p,ot=u,st=f,ht=v,at=y,lt=b,dt=w,ct=m,ft=0,ut={left:null,top:null,width:null,height:null},pt=new Map,gt=function(){function t(t,e,i,n){var o=this;F(this,"id",ft++),F(this,"style",{left:null,top:null,width:null,height:null}),F(this,"computedStyle",{}),F(this,"originStyle",{}),F(this,"children",{}),F(this,"layoutBox",A({},ut)),F(this,"contentSize",A({},ut)),F(this,"clientSize",A({},ut)),F(this,"borderSize",A({},ut)),F(this,"offsetSize",A({},ut)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.type||t.name,this.attributes=this.getAttributes(t);var s=function(t,e){var i,n=["color","fontSize","lineHeight","verticalAlign","fontWeight","textAlign"],o=t.type,s=void 0===o?N:o,h=t.styles,a=void 0===h?{}:h,l=(e||{}).computedStyle,d=Object.assign({},S);if([U,Y,X].includes(s)&&!a.display&&(d.display=_),l)for(var c=0;c=0&&c<0,$=l>=0&&u<0;return i==h[0]&&(this[i].left=t.left+s+v+E+(D?2*-c:0),this[i].top=t.top+l+x+k+($?2*-u:0),this[i].width=t.width+(this[i].widthAdd?0:H),this[i].height=t.height+(this[i].heightAdd?0:C),this[i].widthAdd=H,this[i].heightAdd=C),i==h[1]&&(this[i].left=t.left+s+E+(D<0?-c:0),this[i].top=t.top+l+k+($?-u:0),this[i].width=t.width+v+w,this[i].height=t.height+x+S),i==h[2]&&(this[i].left=t.left+s+E/2+(D<0?-c:0),this[i].top=t.top+l+k/2+($?-u:0),this[i].width=t.width+v+w+E/2+F/2,this[i].height=t.height+x+S+T/2+k/2),i==h[3]&&(this[i].left=t.left+(D<0?-c:0),this[i].top=t.top+($?-u:0),this[i].width=t.width+v+w+E+F+s+c,this[i].height=t.height+x+S+T+k+u+l),this[i]},e.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),"border-box"==e.boxSizing){var o=e||{},s=o.border,a=(s=void 0===s?{}:s).borderWidth,l=void 0===a?0:a,d=o.borderTop,c=(d=void 0===d?{}:d).borderTopWidth,f=void 0===c?l:c,u=o.borderBottom,p=(u=void 0===u?{}:u).borderBottomWidth,g=void 0===p?l:p,v=o.borderRight,y=(v=void 0===v?{}:v).borderRightWidth,x=void 0===y?l:y,b=o.borderLeft,w=(b=void 0===b?{}:b).borderLeftWidth,m=void 0===w?l:w,S=o.padding,z=(S=void 0===S?{}:S).paddingTop,I=void 0===z?0:z,M=S.paddingRight,B=void 0===M?0:M,W=S.paddingBottom,k=void 0===W?0:W,P=S.paddingLeft,O=void 0===P?0:P;i||(t.width-=O+B+x+m),1!==i||n||(t.height-=I+k+f+g)}this.layoutBox&&(h.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},e.getBoxPosition=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,s=void 0===o?0:o,h=A({},this.contentSize,{left:r,top:s}),a=this.contentSize.top-this.offsetSize.top,l=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var d,c=H(this.root.fixedLine.elements);!(d=c()).done;){var f=d.value;f.setPosition(f,this.root.offsetSize),f.getBoxPosition()}}if(e)for(var u,p=H(e.elements);!(u=p()).done;){var g=u.value,v=A({},this.borderSize,{left:r,top:s});g.setPosition(g,v);var y=this.borderSize.top-this.offsetSize.top,x=this.borderSize.left-this.offsetSize.left;g.style.left+=r+x,g.style.top+=s+y,g.getBoxPosition()}if(i)for(var b,w=H(i);!(b=w()).done;){b.value.layout(h.top+a,h.left+l)}return this.layoutBoxUpdate(h,t),this.layoutBox},e.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},e.isBlock=function(t){return void 0===t&&(t=this),t&&t.style.display==ht},e.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==lt},e.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},e.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&(!!t.parent&&(!(!t.parent||t.parent.style.display!==lt)||void 0))},e.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==at},e.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},e.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},e.getParentSize=function(t,e){if(void 0===t&&(t=this),void 0===e&&(e=!1),t&&t.parent){if(t.parent.contentSize.width)return t.parent.contentSize;if(e)return this.getParentSize(t.parent,e)}return null},e.getBoxWidthHeight=function(){var t=this,e=this.name,i=this.computedStyle,n=this.attributes,r=this.parent,o=void 0===r?{}:r,s=this.ctx,h=this.getChildren(),a=i.left,l=void 0===a?0:a,d=i.top,c=void 0===d?0:d,f=i.bottom,u=i.right,p=i.width,g=void 0===p?0:p,v=i.minWidth,y=i.maxWidth,x=i.minHeight,b=i.maxHeight,w=i.height,m=void 0===w?0:w,S=i.fontSize,z=i.fontWeight,I=i.fontFamily,M=i.fontStyle,B=i.position;i.textIndent;var W=i.lineClamp,P=i.lineHeight,O=i.padding,T=void 0===O?{}:O,L=i.margin,R=void 0===L?{}:L,F=i.border,A=(F=void 0===F?{}:F).borderWidth,j=void 0===A?0:A,E=i.borderRight,H=(E=void 0===E?{}:E).borderRightWidth,C=void 0===H?j:H,Y=i.borderLeft,U=(Y=void 0===Y?{}:Y).borderLeftWidth,N=void 0===U?j:U,X=o.contentSize&&o.contentSize.width,_=o.contentSize&&o.contentSize.height;if($(g)&&X&&(g=k(g,X)),$(g)&&!X&&(g=null),$(m)&&_&&(m=k(m,_)),$(m)&&!_&&(m=null),$(v)&&X&&(v=k(v,X)),$(y)&&X&&(y=k(y,X)),$(x)&&_&&(x=k(x,_)),$(b)&&_&&(b=k(b,_)),i.padding&&X)for(var q in i.padding)Object.hasOwnProperty.call(T,q)&&(T[q]=k(T[q],X));var G=T.paddingRight,V=void 0===G?0:G,J=T.paddingLeft,Q=void 0===J?0:J;if(i.margin&&[R.marginLeft,R.marginRight].includes("auto"))if(g){var Z=X&&X-g-V-Q-N-C||0;R.marginLeft==R.marginRight?R.marginLeft=R.marginRight=Z/2:D(R.marginLeft)?R.marginLeft=Z:R.marginRight=Z}else R.marginLeft=R.marginRight=0;var K=R.marginRight,tt=void 0===K?0:K,it=R.marginLeft,ht={width:g,height:m,left:0,top:0},at=Q+V+N+C+(void 0===it?0:it)+tt;if(this.offsetWidth=at,e==ot&&!this.attributes.widths){var lt=n.text||"";s.save(),s.setFonts({fontFamily:I,fontSize:S,fontWeight:z,fontStyle:M}),lt.length,"\n"==lt&&(lt="",this.isBr=!0),(""+lt).split("\n").map((function(e){var i=Array.from(e).map((function(e){var i=""+(/^[\u4e00-\u9fa5]+$/.test(e)?"cn":e)+I+S+z+M,n=pt.get(i);if(n)return{width:n,text:e};var r=t.measureText(e,S).width;return pt.set(i,r),{width:r,text:e}})),n=t.measureText(e,S),r=n.fontHeight,o=n.ascent,s=n.descent;t.attributes.fontHeight=r,t.attributes.ascent=o,t.attributes.descent=s,t.attributes.widths||(t.attributes.widths=[]),t.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e.width}),0)})})),s.restore()}if(e==rt&&null==g){var ct=n.width,ft=n.height;ht.width=this.contrastSize(Math.round(ct*m/ft)||0,v,y),this.layoutBoxUpdate(ht,i,0)}if(e==ot&&null==g){var ut=this.attributes.widths,gt=Math.max.apply(Math,ut.map((function(t){return t.total})));if(o&&X>0&&(gt>X||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed)gt=X;ht.width=this.contrastSize(gt,v,y),this.layoutBoxUpdate(ht,i,0)}if(e==ot&&(o.style.flex||!this.attributes.lines)){var vt=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e.width>ht.width?(vt++,e.width):t+e.width}),0)})),vt=W&&vt>W?W:vt,this.attributes.lines=vt}if(e==rt&&null==m){var yt=n.width,xt=n.height;n.text,ht.height=this.contrastSize(k(ht.width*xt/yt)||0,x,b),this.layoutBoxUpdate(ht,i,1)}e==ot&&null==m&&(P=k(P,S),ht.height=this.contrastSize(k(this.attributes.lines*P),x,b),this.layoutBoxUpdate(ht,i,1,!0)),!g&&o&&o.children&&X&&(!this.isFlex(o)||o.isFlexCalc)&&([st,ot].includes(e)&&this.isFlex()||e==st&&this.isBlock(this)&&this.isInFlow())&&(ht.width=this.contrastSize(X-(o.isFlexCalc?0:at),v,y),this.layoutBoxUpdate(ht,i)),g&&!$(g)&&(ht.width=this.contrastSize(g,v,y),this.layoutBoxUpdate(ht,i,0)),m&&!$(m)&&(ht.height=this.contrastSize(ht.height,x,b),this.layoutBoxUpdate(ht,i,1));var bt=0;if(h.length){var wt=null,mt=!1;h.forEach((function(e,n){e.getBoxWidthHeight();var r=h[n+1];if(r&&r.isInFlow()&&(e.next=r),!t.line||!t.line.ids.includes(e.id))if(e.isInFlow()&&!e.inFlexBox()){var o=t.getBoxState(wt,e);if(e.isBr)return mt=!0;t.line&&t.line.canIEnter(e)&&!o&&!mt?t.line.add(e):(mt=!1,(new et).bind(e)),wt=e}else e.inFlexBox()?t.line&&(t.line.canIEnter(e)||"nowrap"==i.flexWrap)?t.line.add(e):(new nt).bind(e):e.isFixed?t.root.fixedLine?t.root.fixedLine.fixedAdd(e):(new et).fixedBind(e):t.fixedLine?t.fixedLine.fixedAdd(e):(new et).fixedBind(e,1)})),this.lines&&(bt=this.lines.reduce((function(t,e){return t+e.height}),0))}var St=0,zt=0;if(!g&&(this.isAbsolute||this.isFixed)&&X){var It=B==dt?X:this.root.width,Mt=It-($(l)?k(l,It):l)-($(u)?k(u,It):u);St=i.left?Mt:this.lineMaxWidth}if(!m&&(null!=c?c:this.isAbsolute||this.isFixed&&_)){var Bt=B==dt?_:this.root.height,Wt=Bt-($(c)?k(c,Bt):c)-($(f)?k(f,Bt):f);zt=i.top?Wt:0}if(g&&!$(g)||ht.width||(ht.width=St||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?X||o.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,v,y),this.layoutBoxUpdate(ht,i,0)),m||!bt&&!zt||(ht.height=zt||this.contrastSize(bt,x,b),this.layoutBoxUpdate(ht,i)),i.borderRadius&&this.borderSize&&this.borderSize.width)for(var q in i.borderRadius)Object.hasOwnProperty.call(i.borderRadius,q)&&(i.borderRadius[q]=k(i.borderRadius[q],this.borderSize.width));return this.layoutBox},e.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.root.contentSize=this.contentSize,this.getBoxPosition(),this.offsetSize},t}(),vt=p,yt=u,xt=g,bt=f,wt=d.TOP,mt=d.MIDDLE,St=d.BOTTOM,zt=c.LEFT,It=c.CENTER,Mt=c.RIGHT,Bt=function(){function r(t){var e,i,r=this;this.v="1.9.5.1",this.id=null,this.pixelRatio=1,this.width=0,this.height=0,this.sleep=1e3/30,this.count=0,this.isRate=!1,this.isDraw=!0,this.isCache=!0,this.fixed="",this.useCORS=!1,this.performance=!1,this.imageBus=[],this.createImage=function(t,e){return new Promise((function(i,n){var o=null;window||r.canvas.createImage?(o=r.canvas&&r.canvas.createImage?r.canvas.createImage():new Image,e&&o.setAttribute("crossOrigin","Anonymous"),o.src=t,o.onload=function(){i({width:o.naturalWidth||o.width,height:o.naturalHeight||o.height,path:o,src:this.src})},o.onerror=function(t){n(t)}):n({fail:"getImageInfo fail",src:t})}))},this.options=t,Object.assign(this,t),this.ctx=(e=t.context,i={get:function(t,i){if("setFonts"===i)return function(t){var i=t.fontFamily,r=void 0===i?"sans-serif":i,o=t.fontSize,s=void 0===o?14:o,h=t.fontWeight,a=void 0===h?"normal":h,l=t.fontStyle,d=void 0===l?"normal":l;I==n.MP_TOUTIAO&&(a="bold"==a?"bold":"",d="italic"==d?"italic":""),e.font="".concat(d," ").concat(a," ").concat(Math.round(s),"px ").concat(r)};if(!e.draw||!e.setFillStyle){if("setFillStyle"===i)return function(t){e.fillStyle=t};if("setStrokeStyle"===i)return function(t){e.strokeStyle=t};if("setLineWidth"===i)return function(t){e.lineWidth=t};if("setLineCap"===i)return function(t){e.lineCap=t};if("setFontSize"===i)return function(t){e.font="".concat(String(t),"px sans-serif")};if("setGlobalAlpha"===i)return function(t){e.globalAlpha=t};if("setLineJoin"===i)return function(t){e.lineJoin=t};if("setTextAlign"===i)return function(t){e.textAlign=t};if("setMiterLimit"===i)return function(t){e.miterLimit=t};if("setShadow"===i)return function(t,i,n,r){e.shadowOffsetX=t,e.shadowOffsetY=i,e.shadowBlur=n,e.shadowColor=r};if("setTextBaseline"===i)return function(t){e.textBaseline=t};if("createCircularGradient"===i)return function(){};if("draw"===i)return function(){};if("function"==typeof e[i])return function(){for(var t=[],n=0;n=s||n==l&&o=s)&&(h=e.width/i.width);var d=i.width*h,c=i.height*h,f=r||[],u=f[0],p=f[1],g=O(u)?k(u,e.width):(e.width-d)*(P(u)?k(u,1):{left:0,center:.5,right:1}[u||"center"]),v=O(p)?k(p,e.height):(e.height-c)*(P(p)?k(p,1):{top:0,center:.5,bottom:1}[p||"center"]),y=function(t,e){return[(t-g)/h,(e-v)/h]},x=y(0,0),b=x[0],w=x[1],m=y(e.width,e.height),S=m[0],z=m[1],I=Math.max,M=Math.min;return{sx:I(b,0),sy:I(w,0),sw:M(S-b,i.width),sh:M(z-w,i.height),dx:I(g,0),dy:I(v,0),dw:M(d,e.width),dh:M(c,e.height)}}({objectFit:u,objectPosition:v},r.contentSize,t),o=i.sx,s=i.sy,h=i.sh,a=i.sw,l=i.dx,d=i.dy,c=i.dh,f=i.dw;I==n.MP_BAIDU?e.drawImage(t.src,l+m,d+S,f,c,o,s,a,h):e.drawImage(t.src,o,s,a,h,l+m,d+S,f,c)}else e.drawImage(t.src,m,S,b,w)},W=function(){e.restore(),L.drawView(r,o,!1,!0,!1),a(1)},T=function(t){B(t),W()},T(t),[2]}))}))}))];case 1:return a.sent(),[2]}}))}))},r.prototype.drawText=function(t,e,i,n){var r=this,o=this.ctx,s=e.borderSize,h=e.contentSize,a=e.left,l=e.top,d=h.width,c=h.height,f=h.left-s.left||0,u=h.top-s.top||0,p=i.color,g=i.lineHeight,v=i.fontSize,y=i.fontWeight,x=i.fontFamily,b=i.fontStyle,w=i.textIndent,m=void 0===w?0:w,S=i.textAlign,z=i.textStroke,I=i.verticalAlign,M=void 0===I?mt:I,B=i.backgroundColor,P=i.lineClamp,O=i.backgroundClip,T=i.textShadow,L=i.textDecoration;if(m=W(m)?m:0,this.drawView(e,i,O!=yt),g=k(g,v),t){o.save(),a+=f,l+=u;var R=n.fontHeight,F=n.descent,A=void 0===F?0:F,j=n.ascent,E=A+(void 0===j?0:j);switch(o.setFonts({fontFamily:x,fontSize:v,fontWeight:y,fontStyle:b}),o.setTextBaseline(mt),o.setTextAlign(S),O?this.setBackground(B,d,c,a,l):o.setFillStyle(p),S){case zt:break;case It:a+=.5*d;break;case Mt:a+=d}var H=n.lines*g,C=Math.ceil((c-H)/2);switch(C<0&&(C=0),M){case wt:break;case mt:l+=C;break;case St:l+=2*C}var D=(g-R)/2,$=g/2,Y=function(t){var e=o.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,r=e.actualBoundingBoxAscent;return M==wt?{fix:E?void 0===r?0:r:$-D/2,lineY:E?0:D-D/2}:M==mt?{fix:E?$+n/4:$,lineY:E?0:D}:M==St?{fix:E?g-n:$+D/2,lineY:E?2*D:D+D/2}:{fix:0,height:0,lineY:0}},U=function(t,e,i){var r=t;switch(S){case zt:r+=i;break;case It:r=(t-=i/2)+i;break;case Mt:r=t,t-=i}if(L){o.setLineWidth(v/13),o.beginPath();var s=.1*n.fontHeight;/\bunderline\b/.test(L)&&(o.moveTo(t,e+n.fontHeight+s),o.lineTo(r,e+n.fontHeight+s)),/\boverline\b/.test(L)&&(o.moveTo(t,e-s),o.lineTo(r,e-s)),/\bline-through\b/.test(L)&&(o.moveTo(t,e+.5*n.fontHeight),o.lineTo(r,e+.5*n.fontHeight)),o.closePath(),o.setStrokeStyle(p),o.stroke()}},N=function(t,e,i){var n=function(){o.setLineWidth(z.width),o.setStrokeStyle(z.color),o.strokeText(t,e,i)},s="outset";z&&z.type!==s?(o.save(),r.setShadow({boxShadow:T}),o.fillText(t,e,i),o.restore(),n()):z&&z.type==s?(o.save(),r.setShadow({boxShadow:T}),n(),o.restore(),o.save(),o.fillText(t,e,i),o.restore()):(r.setShadow({boxShadow:T}),o.fillText(t,e,i))};if(!n.widths||1==n.widths.length&&n.widths[0].total+m<=h.width){var X=Y(t),_=X.fix,q=void 0===_?0:_,G=X.lineY;return N(t,a+m,l+q),U(a+m,l+G,n&&n.widths&&n.widths[0].total||n.text),l+=g,o.restore(),void this.setBorder(e,i)}for(var V=l,J=a,Q="",Z=0,K=o.measureText("...").width,tt=n.widths,et=0;eth.width){Z>=P&&(Q+="…"),Z++,nt=0;var lt=Y(Q);q=lt.fix,G=lt.lineY;N(Q,J,l+q),U(J,l+G,nt),l+=g,Q=""}else if(rt==it.length-1){et!=tt.length-1&&Z==P&&K+ntV+c||Z>P)break}}o.restore()}},r.prototype.source=function(t){return e(this,void 0,void 0,(function(){var e,n,r,o,s=this;return i(this,(function(i){switch(i.label){case 0:if(this.node=null,e=+new Date,"{}"==JSON.stringify(t))return[2];if(!t.type)for(n in t.type=bt,t.styles=t.styles||t.css||{},t)["views","children","type","css","styles"].includes(n)||(t.styles[n]=t[n],delete t[n]);return t.styles.boxSizing||(t.styles.boxSizing="border-box"),[4,this.create(t)];case 1:return(r=i.sent())?(o=r.layout()||{},this.size=o,this.node=r,this.onEffectFinished().then((function(t){return s.lifecycle("onEffectSuccess",t)})).catch((function(t){return s.lifecycle("onEffectFail",t)})),this.performance&&console.log("布局用时:"+(+new Date-e)+"ms"),[2,this.size]):[2,console.warn("no node")]}}))}))},r.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},r.prototype.create=function(n,r){return e(this,void 0,void 0,(function(){function e(i,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var o=[];return i.forEach((function(i){var s=i.styles,h=void 0===s?{}:s,a=i.children,l=void 0===a?[]:a,d=i.text,c=void 0===d?"":d,f=i.type,u=void 0===f?"":f,p={};p=t(r?t({},n):{},h);var g={},v={},y={};Object.keys(p).map((function(t){if(t.includes("padding")||t.includes("margin")){var e=J(t,p[t]);Object.keys(e).map((function(t){t.includes("Left")?v[t]=e[t]:t.includes("Right")?y[t]=e[t]:g[t]=e[t]}))}}));if(p.textIndent&&(v.textIndent=p.textIndent,delete n.textIndent),""!==c){var x=Array.from(c);x.forEach((function(t,e){var i=Object.assign({},p,g);0===e?Object.assign(i,v):e==x.length-1&&Object.assign(i,y),delete i.padding,delete i.margin,o.push({type:"text",text:t,styles:i})}))}if(u==vt||u==xt)o.push(i);else if("block"===h.display&&l.length>0){var b=e(l,p,!1);i.children=b,i.flattened=!0,o.push(i)}else if(l.length>0){b=e(l,p,r);o=o.concat(b)}})),o}var o,s,h,a,l,d,c,f,u,p,g,v,y,b,w,m,S,z,I,M,B;return i(this,(function(i){switch(i.label){case 0:if(!n)return[2];if(n.styles||(n.styles=n.css||{}),o=n.type,s=o==vt,h=[yt,xt].includes(o),a="textBox"==o,l=n.styles||{},d=l.backgroundImage,c=l.display,s&&!n.src&&!n.url)return[2];if(c==x)return[2];if(h||a){if(f=n.children,!n.text&&(!f||f&&!f.length))return[2];f&&f.length&&!n.flattened&&(u=e(n.children),n.type="view",n.children=u)}if(!(s||n.type==bt&&d))return[3,4];p=s?n.src:"",g=/url\(['"]?(.*?)['"]?\)/.exec(d),d&&g&&g[1]&&(p=g[1]||""),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.getImageInfo(p)];case 2:return v=i.sent(),y=v.width,b=v.height,!(w=v.path)&&s?[2]:(w&&(n.attributes=Object.assign(n.attributes||{},{width:y,height:b,path:w,src:w,naturalSrc:p})),[3,4]);case 3:return m=i.sent(),n.type!=bt?[2]:(this.lifecycle("onEffectFail",t(t({},m),{src:p})),[3,4]);case 4:if(this.count+=1,S=new gt(n,r,this.root,this.ctx),!(z=n.views||n.children))return[3,8];I=0,i.label=5;case 5:return I0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=360&&(s-=360);s<0&&(s+=360);if(0===(s=Math.round(s)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===s)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===s)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===s)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var a=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(s===a)return{x0:n,y0:i+r,x1:e+n,y1:r};if(s===180-a)return{x0:n,y0:r,x1:e+n,y1:i+r};if(s===180+a)return{x0:e+n,y0:r,x1:n,y1:i+r};if(s===360-a)return{x0:e+n,y0:i+r,x1:n,y1:r};var h=0,c=0,f=0,d=0;if(s180-a&&s<180||s>180&&s<180+a||s>360-a){var l=s*Math.PI/180,u=s360-a?i/2:-i/2,p=Math.tan(l)*u,g=s180-a&&s<180?e/2-p:-e/2-p;h=-(f=p+(v=Math.pow(Math.sin(l),2)*g)),c=-(d=u+v/Math.tan(l))}if(s>a&&s<90||s>90&&s<90+a||s>180+a&&s<270||s>270&&s<360-a){var v;l=(90-s)*Math.PI/180,p=s>a&&s<90||s>90&&s<90+a?e/2:-e/2,u=Math.tan(l)*p,g=s>a&&s<90||s>270&&s<360-a?i/2-u:-i/2-u;h=-(f=p+(v=Math.pow(Math.sin(l),2)*g)/Math.tan(l)),c=-(d=u+v)}return h=Math.round(h+e/2)+n,c=Math.round(i/2-c)+r,f=Math.round(f+e/2)+n,d=Math.round(i/2-d)+r,{x0:h,y0:c,x1:f,y1:d}}(r,t,e,i,n),a=s.x0,h=s.y0,c=s.x1,f=s.y1,d=o.createLinearGradient(a,h,c,f),l=r.match(/linear-gradient\((.+)\)/)[1],u=X(l.substring(l.indexOf(",")+1)),p=0;pt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Z(t){return"number"==typeof t}function K(t){return"auto"===t||null===t}function et(t){return/%$/.test(t)}var it=I,nt=z,rt=S,ot=M,st=B,at=O,ht=T;function ct(t){return t.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()}))}function ft(t,e){var i,n,r=function(t){var e=t.match(/([a-z]+)/)[1];return[e,ct(t.split(e)[1])]}(t),o=r[0],s=r[1],a=e.split(" ");if(s)return(i={})[o+s]=e,i;if(a.length&&!s){var h=a[0],c=a[1],f=a[2],l=a[3];return(n={})[o+d[0]]=h,n[o+d[1]]=c||h,n[o+d[2]]=f||h,n[o+d[3]]=l||c||h,n}}function dt(t){t=t.trim();for(var e=new Array,i="+",n="",r=t.length,o=0;o0;)"("===t[a+=1]&&(s+=1),")"===t[a]&&(s-=1);n="".concat(dt(t.slice(o+1,a))),o=a}if(isNaN(Number(t[o]))&&"."!==t[o]||o===r-1){var h=parseFloat(n);switch(i){case"+":e.push(h);break;case"-":e.push(-h);break;case"*":e.push(e.pop()*h);break;case"/":e.push(e.pop()/h)}i=t[o],n=""}}for(var c=0;e.length;)c+=e.pop();return c}var lt,ut=0,pt=function(){function t(){q(this,"elements",[]),q(this,"afterElements",[]),q(this,"beforeElements",[]),q(this,"ids",[]),q(this,"width",0),q(this,"height",0),q(this,"top",0),q(this,"left",0),q(this,"pre",null),q(this,"offsetX",0),q(this,"offsetY",0),ut++,this.id=ut}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){if(!this.ids.includes(t.id)){this.ids.push(t.id),this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()}},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth)||(this.closeLine(),!1)},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.includes(t.id)||(this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t))},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0)this[this.key.height]&&(this.container[this.key.lineMaxHeight]=this[this.key.height]=i),this[this.key.width]+=this.getWidth(t.offsetSize);var n=Math.min(this.getWidth(this),!this.getWidth(this.container.contentSize)&&1/0);(this.container[this.key.lineMaxWidth]||0)1)return 0;var e=t.style.alignSelf,i=this.getHeight(this.container.contentSize),n=i-this.getHeight(t.offsetSize);return e===f?n:e===h?n/2:"stretch"===e?(n&&t.name==S&&(t.style[this.key.width]=this.getWidth(t.offsetSize),t.style[this.key.height]=i,delete t.line,delete t.lines,t.getBoxWidthHeight()),0):0},r.layout=function(t,e){var i=this;this.refreshXAlign(),this.pre?(this.top=this.pre.top+this.pre.height+this.offsetY,this.left=e+this.offsetX):(this.top=Math.max(this.top,this.container.contentSize.top,t)+this.offsetY,this.left=Math.max(this.left,this.container.contentSize.left,e)+this.offsetX),this.elements.forEach((function(t,e){i.setIndent(t);var n=i.elements[e-1],r=i.getOffsetY(t);t.style[i.key.top]=i[i.key.top]+r,t.style[i.key.left]=n?n.offsetSize[i.key.left]+i.getWidth(n.offsetSize):i[i.key.left],t.getBoxPosition()}))},n}(pt),xt=I,wt=z,mt=S,St=k,zt=B,It=P,Mt=O,kt=T,Bt=0,Wt={left:null,top:null,width:null,height:null},Pt=new Map,Ot=function(){function t(t,e,i,n){var r=this;q(this,"id",Bt++),q(this,"style",{left:null,top:null,width:null,height:null}),q(this,"computedStyle",{}),q(this,"originStyle",{}),q(this,"children",{}),q(this,"layoutBox",G({},Wt)),q(this,"contentSize",G({},Wt)),q(this,"clientSize",G({},Wt)),q(this,"borderSize",G({},Wt)),q(this,"offsetSize",G({},Wt)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.type||t.name,this.attributes=this.getAttributes(t);var o=function(t,e){var i,n=["color","fontSize","lineHeight","verticalAlign","fontWeight","textAlign"],r=t.type,o=void 0===r?rt:r,s=t.styles,h=void 0===s?{}:s,c=(e||{}).computedStyle,f=Object.assign({},F);if([nt,it,ot].includes(o)&&!h.display&&(f.display=st),c)for(var l=0;l=0&&f<0,Y=h>=0&&l<0;return i==y[0]&&(this[i].left=t.left+s+g+j+(D?2*-f:0),this[i].top=t.top+h+b+W+(Y?2*-l:0),this[i].width=t.width+(this[i].widthAdd?0:C),this[i].height=t.height+(this[i].heightAdd?0:H),this[i].widthAdd=C,this[i].heightAdd=H),i==y[1]&&(this[i].left=t.left+s+j+(D<0?-f:0),this[i].top=t.top+h+W+(Y?-l:0),this[i].width=t.width+g+w,this[i].height=t.height+b+S),i==y[2]&&(this[i].left=t.left+s+j/2+(D<0?-f:0),this[i].top=t.top+h+W/2+(Y?-l:0),this[i].width=t.width+g+w+j/2+F/2,this[i].height=t.height+b+S+T/2+W/2),i==y[3]&&(this[i].left=t.left+(D<0?-f:0),this[i].top=t.top+(Y?-l:0),this[i].width=t.width+g+w+j+F+s+f,this[i].height=t.height+b+S+T+W+l+h),this[i]},e.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),"border-box"==e.boxSizing){var o=e||{},s=o.border,a=(s=void 0===s?{}:s).borderWidth,h=void 0===a?0:a,c=o.borderTop,f=(c=void 0===c?{}:c).borderTopWidth,d=void 0===f?h:f,l=o.borderBottom,u=(l=void 0===l?{}:l).borderBottomWidth,p=void 0===u?h:u,g=o.borderRight,v=(g=void 0===g?{}:g).borderRightWidth,b=void 0===v?h:v,x=o.borderLeft,w=(x=void 0===x?{}:x).borderLeftWidth,m=void 0===w?h:w,S=o.padding,z=(S=void 0===S?{}:S).paddingTop,I=void 0===z?0:z,M=S.paddingRight,k=void 0===M?0:M,B=S.paddingBottom,W=void 0===B?0:B,P=S.paddingLeft,O=void 0===P?0:P;i||(t.width-=O+k+b+m),1!==i||n||(t.height-=I+W+d+p)}this.layoutBox&&(y.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},e.getBoxPosition=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,s=void 0===o?0:o,a=G({},this.contentSize,{left:r,top:s}),h=this.contentSize.top-this.offsetSize.top,c=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var f,d=Q(this.root.fixedLine.elements);!(f=d()).done;){var l=f.value;l.setPosition(l,this.root.offsetSize),l.getBoxPosition()}}if(e)for(var u,p=Q(e.elements);!(u=p()).done;){var g=u.value,v=G({},this.borderSize,{left:r,top:s});g.setPosition(g,v);var y=this.borderSize.top-this.offsetSize.top,b=this.borderSize.left-this.offsetSize.left;g.style.left+=r+b,g.style.top+=s+y,g.getBoxPosition()}if(i)for(var x,w=Q(i);!(x=w()).done;){x.value.layout(a.top+h,a.left+c)}return this.layoutBoxUpdate(a,t),this.layoutBox},e.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},e.isBlock=function(t){return void 0===t&&(t=this),t&&t.style.display==St},e.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==It},e.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},e.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&(!!t.parent&&(!(!t.parent||t.parent.style.display!==It)||void 0))},e.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==zt},e.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},e.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},e.getParentSize=function(t,e){if(void 0===t&&(t=this),void 0===e&&(e=!1),t&&t.parent){if(t.parent.contentSize.width)return t.parent.contentSize;if(e)return this.getParentSize(t.parent,e)}return null},e.getBoxWidthHeight=function(){var t=this,e=this.name,i=this.computedStyle,n=this.attributes,r=this.parent,o=void 0===r?{}:r,s=this.ctx,a=this.getChildren(),h=i.left,c=void 0===h?0:h,f=i.top,d=void 0===f?0:f,l=i.bottom,u=i.right,p=i.width,g=void 0===p?0:p,v=i.minWidth,y=i.maxWidth,b=i.minHeight,x=i.maxHeight,w=i.height,m=void 0===w?0:w,S=i.fontSize,z=i.fontWeight,I=i.fontFamily,M=i.fontStyle,k=i.position;i.textIndent;var B=i.lineClamp,W=i.lineHeight,P=i.padding,O=void 0===P?{}:P,T=i.margin,L=void 0===T?{}:T,R=i.border,F=(R=void 0===R?{}:R).borderWidth,A=void 0===F?0:F,E=i.borderRight,j=(E=void 0===E?{}:E).borderRightWidth,C=void 0===j?A:j,H=i.borderLeft,D=(H=void 0===H?{}:H).borderLeftWidth,Y=void 0===D?A:D,U=o.contentSize&&o.contentSize.width,N=o.contentSize&&o.contentSize.height;if(et(g)&&U&&(g=$(g,U)),et(g)&&!U&&(g=null),et(m)&&N&&(m=$(m,N)),et(m)&&!N&&(m=null),et(v)&&U&&(v=$(v,U)),et(y)&&U&&(y=$(y,U)),et(b)&&N&&(b=$(b,N)),et(x)&&N&&(x=$(x,N)),i.padding&&U)for(var _ in i.padding)Object.hasOwnProperty.call(O,_)&&(O[_]=$(O[_],U));var X=O.paddingRight,q=void 0===X?0:X,G=O.paddingLeft,V=void 0===G?0:G;if(i.margin&&[L.marginLeft,L.marginRight].includes("auto"))if(g){var J=U&&U-g-q-V-Y-C||0;L.marginLeft==L.marginRight?L.marginLeft=L.marginRight=J/2:K(L.marginLeft)?L.marginLeft=J:L.marginRight=J}else L.marginLeft=L.marginRight=0;var Q=L.marginRight,Z=void 0===Q?0:Q,tt=L.marginLeft,it={width:g,height:m,left:0,top:0},nt=V+q+Y+C+(void 0===tt?0:tt)+Z;if(this.offsetWidth=nt,e==wt&&!this.attributes.widths){var rt=n.text||"";s.save(),s.setFonts({fontFamily:I,fontSize:S,fontWeight:z,fontStyle:M}),rt.length,"\n"==rt&&(rt="",this.isBr=!0),(""+rt).split("\n").map((function(e){var i=Array.from(e).map((function(e){var i=""+(/^[\u4e00-\u9fa5]+$/.test(e)?"cn":e)+I+S+z+M,n=Pt.get(i);if(n)return{width:n,text:e};var r=t.measureText(e,S).width;return Pt.set(i,r),{width:r,text:e}})),n=t.measureText(e,S),r=n.fontHeight,o=n.ascent,s=n.descent;t.attributes.fontHeight=r,t.attributes.ascent=o,t.attributes.descent=s,t.attributes.widths||(t.attributes.widths=[]),t.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e.width}),0)})})),s.restore()}if(e==xt&&null==g){var ot=n.width,st=n.height;it.width=this.contrastSize(Math.round(ot*m/st)||0,v,y),this.layoutBoxUpdate(it,i,0)}if(e==wt&&null==g){var at=this.attributes.widths,ht=Math.max.apply(Math,at.map((function(t){return t.total})));if(o&&U>0&&(ht>U||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed)ht=U;it.width=this.contrastSize(ht,v,y),this.layoutBoxUpdate(it,i,0)}if(e==wt&&(o.style.flex||!this.attributes.lines)){var ct=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e.width>it.width?(ct++,e.width):t+e.width}),0)})),ct=B&&ct>B?B:ct,this.attributes.lines=ct}if(e==xt&&null==m){var ft=n.width,dt=n.height;n.text,it.height=this.contrastSize($(it.width*dt/ft)||0,b,x),this.layoutBoxUpdate(it,i,1)}e==wt&&null==m&&(W=$(W,S),it.height=this.contrastSize($(this.attributes.lines*W),b,x),this.layoutBoxUpdate(it,i,1,!0)),!g&&o&&o.children&&U&&(!this.isFlex(o)||o.isFlexCalc)&&([mt,wt].includes(e)&&this.isFlex()||e==mt&&this.isBlock(this)&&this.isInFlow())&&(it.width=this.contrastSize(U-(o.isFlexCalc?0:nt),v,y),this.layoutBoxUpdate(it,i)),g&&!et(g)&&(it.width=this.contrastSize(g,v,y),this.layoutBoxUpdate(it,i,0)),m&&!et(m)&&(it.height=this.contrastSize(it.height,b,x),this.layoutBoxUpdate(it,i,1));var lt=0;if(a.length){var ut=null,gt=!1;a.forEach((function(e,n){e.getBoxWidthHeight();var r=a[n+1];if(r&&r.isInFlow()&&(e.next=r),!t.line||!t.line.ids.includes(e.id))if(e.isInFlow()&&!e.inFlexBox()){var o=t.getBoxState(ut,e);if(e.isBr)return gt=!0;t.line&&t.line.canIEnter(e)&&!o&&!gt?t.line.add(e):(gt=!1,(new pt).bind(e)),ut=e}else e.inFlexBox()?t.line&&(t.line.canIEnter(e)||"nowrap"==i.flexWrap)?t.line.add(e):(new bt).bind(e):e.isFixed?t.root.fixedLine?t.root.fixedLine.fixedAdd(e):(new pt).fixedBind(e):t.fixedLine?t.fixedLine.fixedAdd(e):(new pt).fixedBind(e,1)})),this.lines&&(lt=this.lines.reduce((function(t,e){return t+e.height}),0))}var vt=0,yt=0;if(!g&&(this.isAbsolute||this.isFixed)&&U){var St=k==Mt?U:this.root.width,zt=St-(et(c)?$(c,St):c)-(et(u)?$(u,St):u);vt=i.left?zt:this.lineMaxWidth}if(!m&&(null!=d?d:this.isAbsolute||this.isFixed&&N)){var It=k==Mt?N:this.root.height,kt=It-(et(d)?$(d,It):d)-(et(l)?$(l,It):l);yt=i.top?kt:0}if(g&&!et(g)||it.width||(it.width=vt||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?U||o.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,v,y),this.layoutBoxUpdate(it,i,0)),m||!lt&&!yt||(it.height=yt||this.contrastSize(lt,b,x),this.layoutBoxUpdate(it,i)),i.borderRadius&&this.borderSize&&this.borderSize.width)for(var _ in i.borderRadius)Object.hasOwnProperty.call(i.borderRadius,_)&&(i.borderRadius[_]=$(i.borderRadius[_],this.borderSize.width));return this.layoutBox},e.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.root.contentSize=this.contentSize,this.getBoxPosition(),this.offsetSize},t}(),Tt=function(){var t,e,i,n,r,o,s=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],a=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],h=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],c=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],f=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],d=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],l=[],u=[],p=[],g=[],v=[],y=2;function b(t,e){var i;t>e&&(i=t,t=e,e=i),i=e,i*=e,i+=e,i>>=1,g[i+=t]=1}function x(t,i){var n;for(p[t+e*i]=1,n=-2;n<2;n++)p[t+n+e*(i-2)]=1,p[t-2+e*(i+n+1)]=1,p[t+2+e*(i+n)]=1,p[t+n+1+e*(i+2)]=1;for(n=0;n<2;n++)b(t-1,i+n),b(t+1,i-n),b(t-n,i-1),b(t+n,i+1)}function w(t){for(;t>=255;)t=((t-=255)>>8)+(255&t);return t}var m=[];function S(t,e,i,n){var r,o,s;for(r=0;re&&(i=t,t=e,e=i),i=e,i+=e*e,i>>=1,g[i+=t]}function I(t){var i,n,r,o;switch(t){case 0:for(n=0;n>1&1,i=0;i=5&&(i+=3+v[e]-5);for(e=3;et||3*v[e-3]>=4*v[e]||3*v[e+3]>=4*v[e])&&(i+=40);return i}function k(){var t,i,n,r,o,s=0,a=0;for(i=0;ie*e;)h-=e*e,c++;for(s+=10*c,t=0;t1)for(P=s[t],B=e-7;;){for(M=e-7;M>P-3&&(x(M,B),!(M6)for(P=a[t-7],W=17,M=0;M<6;M++)for(B=0;B<3;B++,W--)1&(W>11?t>>W-12:P>>W)?(p[5-M+e*(2-B+e-11)]=1,p[2-B+e-11+e*(5-M)]=1):(b(5-M,2-B+e-11),b(2-B+e-11,5-M));for(B=0;B=(M=r*(i+n)+n)-2&&(O=M-2,t>9&&O--),T=O,t>9){for(l[T+2]=0,l[T+3]=0;T--;)P=l[T],l[T+3]|=255&P<<4,l[T+2]=P>>4;l[2]|=255&O<<4,l[1]=O>>4,l[0]=64|O>>12}else{for(l[T+1]=0,l[T+2]=0;T--;)P=l[T],l[T+2]|=255&P<<4,l[T+1]=P>>4;l[1]|=255&O<<4,l[0]=64|O>>4}for(T=O+3-(t<10);T0;L--)m[L]=m[L]?m[L-1]^d[w(f[m[L]]+T)]:m[L-1];m[0]=d[w(f[m[0]]+T)]}for(T=0;T<=o;T++)m[T]=f[m[T]];for(W=M,B=0,T=0;T>=1)1&B&&(p[e-1-W+8*e]=1,W<6?p[8+e*W]=1:p[8+e*(W+1)]=1);for(W=0;W<7;W++,B>>=1)1&B&&(p[8+e*(e-7+W)]=1,W?p[6-W+8*e]=1:p[7+8*e]=1);return p}(v)},utf16to8:function(t){var e,i,n,r;for(e="",n=t.length,i=0;i=1&&r<=127?e+=t.charAt(i):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r>>0&63)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|r>>0&63));return e},draw:function(t,i,n,r,o){i.drawView(n,r);var s=i.ctx,a=n.contentSize,h=a.width,c=a.height,f=a.left,d=a.top;r.borderRadius,r.backgroundColor;var l=r.color,u=void 0===l?"#000000":l;r.border,n.contentSize.left,n.borderSize.left,n.contentSize.top,n.borderSize.top;if(y=o||y,s){s.save(),i.setOpacity(r),i.setTransform(n,r);var p=Math.min(h,c);t=this.utf16to8(t);var g=this.getFrame(t),v=p/e;s.setFillStyle(u);for(var b=0;b=s||n==c&&o=s)&&(a=e.width/i.width);var f=i.width*a,d=i.height*a,l=r||[],u=l[0],p=l[1],g=Y(u)?$(u,e.width):(e.width-f)*(U(u)?$(u,1):{left:0,center:.5,right:1}[u||"center"]),v=Y(p)?$(p,e.height):(e.height-d)*(U(p)?$(p,1):{top:0,center:.5,bottom:1}[p||"center"]),y=function(t,e){return[(t-g)/a,(e-v)/a]},b=y(0,0),x=b[0],w=b[1],m=y(e.width,e.height),S=m[0],z=m[1],I=Math.max,M=Math.min;return{sx:I(x,0),sy:I(w,0),sw:M(S-x,i.width),sh:M(z-w,i.height),dx:I(g,0),dy:I(v,0),dw:M(f,e.width),dh:M(d,e.height)}}({objectFit:u,objectPosition:v},e.contentSize,t),o=n.sx,s=n.sy,a=n.sh,h=n.sw,c=n.dx,f=n.dy,d=n.dh,l=n.dw;C==r.MP_BAIDU?i.drawImage(t.src,c+m,f+S,l,d,o,s,h,a):i.drawImage(t.src,o,s,h,a,c+m,f+S,l,d)}else i.drawImage(t.src,m,S,x,w)},k=function(){i.restore(),W.drawView(e,o,!1,!0,!1),h(1)},B=function(t){M(t),k()},B(t),[2]}))}))}))];case 1:return h.sent(),[2]}}))}))},t.prototype.drawText=function(t,e,i,n){var r=this,o=this.ctx,s=e.borderSize,a=e.contentSize,h=e.left,c=e.top,f=a.width,d=a.height,l=a.left-s.left||0,u=a.top-s.top||0,p=i.color,g=i.lineHeight,v=i.fontSize,y=i.fontWeight,b=i.fontFamily,x=i.fontStyle,w=i.textIndent,m=void 0===w?0:w,S=i.textAlign,z=i.textStroke,I=i.verticalAlign,M=void 0===I?jt:I,k=i.backgroundColor,B=i.lineClamp,W=i.backgroundClip,P=i.textShadow,O=i.textDecoration;if(m=Y(m)?m:0,this.drawView(e,i,W!=Rt),g=$(g,v),t){o.save(),h+=l,c+=u;var T=n.fontHeight,L=n.descent,R=void 0===L?0:L,F=n.ascent,A=R+(void 0===F?0:F);switch(o.setFonts({fontFamily:b,fontSize:v,fontWeight:y,fontStyle:x}),o.setTextBaseline(jt),o.setTextAlign(S),W?this.setBackground(k,f,d,h,c):o.setFillStyle(p),S){case Ht:break;case Dt:h+=.5*f;break;case Yt:h+=f}var E=n.lines*g,j=Math.ceil((d-E)/2);switch(j<0&&(j=0),M){case Et:break;case jt:c+=j;break;case Ct:c+=2*j}var C=(g-T)/2,H=g/2,D=function(t){var e=o.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,r=e.actualBoundingBoxAscent;return M==Et?{fix:A?void 0===r?0:r:H-C/2,lineY:A?0:C-C/2}:M==jt?{fix:A?H+n/4:H,lineY:A?0:C}:M==Ct?{fix:A?g-n:H+C/2,lineY:A?2*C:C+C/2}:{fix:0,height:0,lineY:0}},U=function(t,e,i){var r=t;switch(S){case Ht:r+=i;break;case Dt:r=(t-=i/2)+i;break;case Yt:r=t,t-=i}if(O){o.setLineWidth(v/13),o.beginPath();var s=.1*n.fontHeight;/\bunderline\b/.test(O)&&(o.moveTo(t,e+n.fontHeight+s),o.lineTo(r,e+n.fontHeight+s)),/\boverline\b/.test(O)&&(o.moveTo(t,e-s),o.lineTo(r,e-s)),/\bline-through\b/.test(O)&&(o.moveTo(t,e+.5*n.fontHeight),o.lineTo(r,e+.5*n.fontHeight)),o.closePath(),o.setStrokeStyle(p),o.stroke()}},N=function(t,e,i){var n=function(){o.setLineWidth(z.width),o.setStrokeStyle(z.color),o.strokeText(t,e,i)},s="outset";z&&z.type!==s?(o.save(),r.setShadow({boxShadow:P}),o.fillText(t,e,i),o.restore(),n()):z&&z.type==s?(o.save(),r.setShadow({boxShadow:P}),n(),o.restore(),o.save(),o.fillText(t,e,i),o.restore()):(r.setShadow({boxShadow:P}),o.fillText(t,e,i))};if(!n.widths||1==n.widths.length&&n.widths[0].total+m<=a.width){var _=D(t),X=_.fix,q=void 0===X?0:X,G=_.lineY;return N(t,h+m,c+q),U(h+m,c+G,n&&n.widths&&n.widths[0].total||n.text),c+=g,o.restore(),void this.setBorder(e,i)}for(var V=c,J=h,Q="",Z=0,K=o.measureText("...").width,tt=n.widths,et=0;eta.width){Z>=B&&(Q+="…"),Z++,nt=0;var ct=D(Q);q=ct.fix,G=ct.lineY;N(Q,J,c+q),U(J,c+G,nt),c+=g,Q=""}else if(rt==it.length-1){et!=tt.length-1&&Z==B&&K+ntV+d||Z>B)break}}o.restore()}},t.prototype.source=function(t){return i(this,void 0,void 0,(function(){var e,i,r,o,s=this;return n(this,(function(n){switch(n.label){case 0:if(this.node=null,e=+new Date,"{}"==JSON.stringify(t))return[2];if(t.styles=t.styles||t.css||{},!t.type)for(i in t.type=At,t)["views","children","type","css","styles"].includes(i)||(t.styles[i]=t[i],delete t[i]);return t.styles.boxSizing||(t.styles.boxSizing="border-box"),[4,this.create(t)];case 1:return(r=n.sent())?(o=r.layout()||{},this.size=o,this.node=r,this.onEffectFinished().then((function(t){return s.lifecycle("onEffectSuccess",t)})).catch((function(t){return s.lifecycle("onEffectFail",t)})),this.performance&&console.log("布局用时:"+(+new Date-e)+"ms"),[2,this.size]):[2,console.warn("no node")]}}))}))},t.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},t.prototype.create=function(t,r){return i(this,void 0,void 0,(function(){function i(t,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var o=[];return t.forEach((function(t){var s=t.styles,a=void 0===s?{}:s,h=t.css,c=void 0===h?{}:h,f=t.children,d=void 0===f?[]:f,l=t.views,u=void 0===l?[]:l,p=t.text,g=void 0===p?"":p,v=t.type,y=void 0===v?"":v;!d&&u&&(t.children=d=u);var b={};b=e(e(r?e({},n):{},a),c);var x={},w={},m={};Object.keys(b).map((function(t){if(t.includes("padding")||t.includes("margin")){var e=ft(t,b[t]);Object.keys(e).map((function(t){t.includes("Left")?w[t]=e[t]:t.includes("Right")?m[t]=e[t]:x[t]=e[t]}))}}));if(b.textIndent&&(w.textIndent=b.textIndent,delete n.textIndent),""!==g){var S=Array.from(g);S.forEach((function(t,e){var i=Object.assign({},b,x);0===e?Object.assign(i,w):e==S.length-1&&Object.assign(i,m),delete i.padding,delete i.margin,o.push({type:"text",text:t,styles:i})}))}if(y==Lt||y==Ft)o.push(t);else if("block"===a.display&&d.length>0){var z=i(d,b,!1);t.children=z,t.flattened=!0,o.push(t)}else if(d.length>0){z=i(d,b,r);o=o.concat(z)}})),o}var o,s,a,h,c,f,d,l,u,p,g,v,y,b,x,w,m,S,z,I,M,k,B,P;return n(this,(function(n){switch(n.label){case 0:if(!t)return[2];if(t.styles||(t.styles=t.css||{}),o=t.type,s=t.show,a=void 0===s||s,h=o==Lt,c=[Rt,Ft].includes(o),f="textBox"==o,d=t.styles||{},l=d.backgroundImage,u=d.display,h&&!t.src&&!t.url)return[2];if(u==W||!a)return[2];if(c||f){if(p=t.children,g=t.views,!p&&g&&(t.children=p=g),!t.text&&(!p||p&&!p.length))return[2];p&&p.length&&!t.flattened&&(v=i(t.children||t.views),t.type="view",t.children=v)}if(!(h||t.type==At&&l))return[3,4];y=h?t.src:"",b=/url\(['"]?(.*?)['"]?\)/.exec(l),l&&b&&b[1]&&(y=b[1]||""),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.getImageInfo(y)];case 2:return x=n.sent(),w=x.width,m=x.height,!(S=x.path)&&h?[2]:(S&&(t.attributes=Object.assign(t.attributes||{},{width:w,height:m,path:S,src:S,naturalSrc:y})),[3,4]);case 3:return z=n.sent(),t.type!=At?[2]:(this.lifecycle("onEffectFail",e(e({},z),{src:y})),[3,4]);case 4:if(this.count+=1,I=new Ot(t,r,this.root,this.ctx),!(M=t.children||t.views))return[3,8];k=0,n.label=5;case 5:return k0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=360&&(s-=360);s<0&&(s+=360);if(0===(s=Math.round(s)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===s)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===s)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===s)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var a=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(s===a)return{x0:n,y0:i+r,x1:e+n,y1:r};if(s===180-a)return{x0:n,y0:r,x1:e+n,y1:i+r};if(s===180+a)return{x0:e+n,y0:r,x1:n,y1:i+r};if(s===360-a)return{x0:e+n,y0:i+r,x1:n,y1:r};var h=0,c=0,f=0,d=0;if(s180-a&&s<180||s>180&&s<180+a||s>360-a){var l=s*Math.PI/180,u=s360-a?i/2:-i/2,p=Math.tan(l)*u,g=s180-a&&s<180?e/2-p:-e/2-p;h=-(f=p+(v=Math.pow(Math.sin(l),2)*g)),c=-(d=u+v/Math.tan(l))}if(s>a&&s<90||s>90&&s<90+a||s>180+a&&s<270||s>270&&s<360-a){var v;l=(90-s)*Math.PI/180,p=s>a&&s<90||s>90&&s<90+a?e/2:-e/2,u=Math.tan(l)*p,g=s>a&&s<90||s>270&&s<360-a?i/2-u:-i/2-u;h=-(f=p+(v=Math.pow(Math.sin(l),2)*g)/Math.tan(l)),c=-(d=u+v)}return h=Math.round(h+e/2)+n,c=Math.round(i/2-c)+r,f=Math.round(f+e/2)+n,d=Math.round(i/2-d)+r,{x0:h,y0:c,x1:f,y1:d}}(r,t,e,i,n),a=s.x0,h=s.y0,c=s.x1,f=s.y1,d=o.createLinearGradient(a,h,c,f),l=r.match(/linear-gradient\((.+)\)/)[1],u=q(l.substring(l.indexOf(",")+1)),p=0;pt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function K(t){return"number"==typeof t}function et(t){return"auto"===t||null===t}function it(t){return/%$/.test(t)}var nt=I,rt=z,ot=S,st=M,at=B,ht=O,ct=T;function ft(t){return t.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()}))}function dt(t,e){var i,n,r=function(t){var e=t.match(/([a-z]+)/)[1];return[e,ft(t.split(e)[1])]}(t),o=r[0],s=r[1],a=e.split(" ");if(s)return(i={})[o+s]=e,i;if(a.length&&!s){var h=a[0],c=a[1],f=a[2],l=a[3];return(n={})[o+d[0]]=h,n[o+d[1]]=c||h,n[o+d[2]]=f||h,n[o+d[3]]=l||c||h,n}}function lt(t){t=t.trim();for(var e=new Array,i="+",n="",r=t.length,o=0;o0;)"("===t[a+=1]&&(s+=1),")"===t[a]&&(s-=1);n="".concat(lt(t.slice(o+1,a))),o=a}if(isNaN(Number(t[o]))&&"."!==t[o]||o===r-1){var h=parseFloat(n);switch(i){case"+":e.push(h);break;case"-":e.push(-h);break;case"*":e.push(e.pop()*h);break;case"/":e.push(e.pop()/h)}i=t[o],n=""}}for(var c=0;e.length;)c+=e.pop();return c}var ut,pt=0,gt=function(){function t(){G(this,"elements",[]),G(this,"afterElements",[]),G(this,"beforeElements",[]),G(this,"ids",[]),G(this,"width",0),G(this,"height",0),G(this,"top",0),G(this,"left",0),G(this,"pre",null),G(this,"offsetX",0),G(this,"offsetY",0),pt++,this.id=pt}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){if(!this.ids.includes(t.id)){this.ids.push(t.id),this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()}},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth)||(this.closeLine(),!1)},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.includes(t.id)||(this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t))},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0)this[this.key.height]&&(this.container[this.key.lineMaxHeight]=this[this.key.height]=i),this[this.key.width]+=this.getWidth(t.offsetSize);var n=Math.min(this.getWidth(this),!this.getWidth(this.container.contentSize)&&1/0);(this.container[this.key.lineMaxWidth]||0)1)return 0;var e=t.style.alignSelf,i=this.getHeight(this.container.contentSize),n=i-this.getHeight(t.offsetSize);return e===f?n:e===h?n/2:"stretch"===e?(n&&t.name==S&&(t.style[this.key.width]=this.getWidth(t.offsetSize),t.style[this.key.height]=i,delete t.line,delete t.lines,t.getBoxWidthHeight()),0):0},r.layout=function(t,e){var i=this;this.refreshXAlign(),this.pre?(this.top=this.pre.top+this.pre.height+this.offsetY,this.left=e+this.offsetX):(this.top=Math.max(this.top,this.container.contentSize.top,t)+this.offsetY,this.left=Math.max(this.left,this.container.contentSize.left,e)+this.offsetX),this.elements.forEach((function(t,e){i.setIndent(t);var n=i.elements[e-1],r=i.getOffsetY(t);t.style[i.key.top]=i[i.key.top]+r,t.style[i.key.left]=n?n.offsetSize[i.key.left]+i.getWidth(n.offsetSize):i[i.key.left],t.getBoxPosition()}))},n}(gt),wt=I,mt=z,St=S,zt=k,It=B,Mt=P,kt=O,Bt=T,Wt=0,Pt={left:null,top:null,width:null,height:null},Ot=new Map,Tt=function(){function t(t,e,i,n){var r=this;G(this,"id",Wt++),G(this,"style",{left:null,top:null,width:null,height:null}),G(this,"computedStyle",{}),G(this,"originStyle",{}),G(this,"children",{}),G(this,"layoutBox",V({},Pt)),G(this,"contentSize",V({},Pt)),G(this,"clientSize",V({},Pt)),G(this,"borderSize",V({},Pt)),G(this,"offsetSize",V({},Pt)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.type||t.name,this.attributes=this.getAttributes(t);var o=function(t,e){var i,n=["color","fontSize","lineHeight","verticalAlign","fontWeight","textAlign"],r=t.type,o=void 0===r?ot:r,s=t.styles,h=void 0===s?{}:s,c=(e||{}).computedStyle,f=Object.assign({},F);if([rt,nt,st].includes(o)&&!h.display&&(f.display=at),c)for(var l=0;l=0&&f<0,$=h>=0&&l<0;return i==y[0]&&(this[i].left=t.left+s+g+j+(D?2*-f:0),this[i].top=t.top+h+b+W+($?2*-l:0),this[i].width=t.width+(this[i].widthAdd?0:C),this[i].height=t.height+(this[i].heightAdd?0:H),this[i].widthAdd=C,this[i].heightAdd=H),i==y[1]&&(this[i].left=t.left+s+j+(D<0?-f:0),this[i].top=t.top+h+W+($?-l:0),this[i].width=t.width+g+w,this[i].height=t.height+b+S),i==y[2]&&(this[i].left=t.left+s+j/2+(D<0?-f:0),this[i].top=t.top+h+W/2+($?-l:0),this[i].width=t.width+g+w+j/2+F/2,this[i].height=t.height+b+S+T/2+W/2),i==y[3]&&(this[i].left=t.left+(D<0?-f:0),this[i].top=t.top+($?-l:0),this[i].width=t.width+g+w+j+F+s+f,this[i].height=t.height+b+S+T+W+l+h),this[i]},e.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),"border-box"==e.boxSizing){var o=e||{},s=o.border,a=(s=void 0===s?{}:s).borderWidth,h=void 0===a?0:a,c=o.borderTop,f=(c=void 0===c?{}:c).borderTopWidth,d=void 0===f?h:f,l=o.borderBottom,u=(l=void 0===l?{}:l).borderBottomWidth,p=void 0===u?h:u,g=o.borderRight,v=(g=void 0===g?{}:g).borderRightWidth,b=void 0===v?h:v,x=o.borderLeft,w=(x=void 0===x?{}:x).borderLeftWidth,m=void 0===w?h:w,S=o.padding,z=(S=void 0===S?{}:S).paddingTop,I=void 0===z?0:z,M=S.paddingRight,k=void 0===M?0:M,B=S.paddingBottom,W=void 0===B?0:B,P=S.paddingLeft,O=void 0===P?0:P;i||(t.width-=O+k+b+m),1!==i||n||(t.height-=I+W+d+p)}this.layoutBox&&(y.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},e.getBoxPosition=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,s=void 0===o?0:o,a=V({},this.contentSize,{left:r,top:s}),h=this.contentSize.top-this.offsetSize.top,c=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var f,d=Z(this.root.fixedLine.elements);!(f=d()).done;){var l=f.value;l.setPosition(l,this.root.offsetSize),l.getBoxPosition()}}if(e)for(var u,p=Z(e.elements);!(u=p()).done;){var g=u.value,v=V({},this.borderSize,{left:r,top:s});g.setPosition(g,v);var y=this.borderSize.top-this.offsetSize.top,b=this.borderSize.left-this.offsetSize.left;g.style.left+=r+b,g.style.top+=s+y,g.getBoxPosition()}if(i)for(var x,w=Z(i);!(x=w()).done;){x.value.layout(a.top+h,a.left+c)}return this.layoutBoxUpdate(a,t),this.layoutBox},e.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},e.isBlock=function(t){return void 0===t&&(t=this),t&&t.style.display==zt},e.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==Mt},e.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},e.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&(!!t.parent&&(!(!t.parent||t.parent.style.display!==Mt)||void 0))},e.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==It},e.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},e.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},e.getParentSize=function(t,e){if(void 0===t&&(t=this),void 0===e&&(e=!1),t&&t.parent){if(t.parent.contentSize.width)return t.parent.contentSize;if(e)return this.getParentSize(t.parent,e)}return null},e.getBoxWidthHeight=function(){var t=this,e=this.name,i=this.computedStyle,n=this.attributes,r=this.parent,o=void 0===r?{}:r,s=this.ctx,a=this.getChildren(),h=i.left,c=void 0===h?0:h,f=i.top,d=void 0===f?0:f,l=i.bottom,u=i.right,p=i.width,g=void 0===p?0:p,v=i.minWidth,y=i.maxWidth,b=i.minHeight,x=i.maxHeight,w=i.height,m=void 0===w?0:w,S=i.fontSize,z=i.fontWeight,I=i.fontFamily,M=i.fontStyle,k=i.position;i.textIndent;var B=i.lineClamp,W=i.lineHeight,P=i.padding,O=void 0===P?{}:P,T=i.margin,L=void 0===T?{}:T,R=i.border,F=(R=void 0===R?{}:R).borderWidth,A=void 0===F?0:F,E=i.borderRight,j=(E=void 0===E?{}:E).borderRightWidth,C=void 0===j?A:j,H=i.borderLeft,D=(H=void 0===H?{}:H).borderLeftWidth,$=void 0===D?A:D,U=o.contentSize&&o.contentSize.width,N=o.contentSize&&o.contentSize.height;if(it(g)&&U&&(g=Y(g,U)),it(g)&&!U&&(g=null),it(m)&&N&&(m=Y(m,N)),it(m)&&!N&&(m=null),it(v)&&U&&(v=Y(v,U)),it(y)&&U&&(y=Y(y,U)),it(b)&&N&&(b=Y(b,N)),it(x)&&N&&(x=Y(x,N)),i.padding&&U)for(var _ in i.padding)Object.hasOwnProperty.call(O,_)&&(O[_]=Y(O[_],U));var X=O.paddingRight,q=void 0===X?0:X,G=O.paddingLeft,V=void 0===G?0:G;if(i.margin&&[L.marginLeft,L.marginRight].includes("auto"))if(g){var J=U&&U-g-q-V-$-C||0;L.marginLeft==L.marginRight?L.marginLeft=L.marginRight=J/2:et(L.marginLeft)?L.marginLeft=J:L.marginRight=J}else L.marginLeft=L.marginRight=0;var Q=L.marginRight,Z=void 0===Q?0:Q,K=L.marginLeft,tt={width:g,height:m,left:0,top:0},nt=V+q+$+C+(void 0===K?0:K)+Z;if(this.offsetWidth=nt,e==mt&&!this.attributes.widths){var rt=n.text||"";s.save(),s.setFonts({fontFamily:I,fontSize:S,fontWeight:z,fontStyle:M}),rt.length,"\n"==rt&&(rt="",this.isBr=!0),(""+rt).split("\n").map((function(e){var i=Array.from(e).map((function(e){var i=""+(/^[\u4e00-\u9fa5]+$/.test(e)?"cn":e)+I+S+z+M,n=Ot.get(i);if(n)return{width:n,text:e};var r=t.measureText(e,S).width;return Ot.set(i,r),{width:r,text:e}})),n=t.measureText(e,S),r=n.fontHeight,o=n.ascent,s=n.descent;t.attributes.fontHeight=r,t.attributes.ascent=o,t.attributes.descent=s,t.attributes.widths||(t.attributes.widths=[]),t.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e.width}),0)})})),s.restore()}if(e==wt&&null==g){var ot=n.width,st=n.height;tt.width=this.contrastSize(Math.round(ot*m/st)||0,v,y),this.layoutBoxUpdate(tt,i,0)}if(e==mt&&null==g){var at=this.attributes.widths,ht=Math.max.apply(Math,at.map((function(t){return t.total})));if(o&&U>0&&(ht>U||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed)ht=U;tt.width=this.contrastSize(ht,v,y),this.layoutBoxUpdate(tt,i,0)}if(e==mt&&(o.style.flex||!this.attributes.lines)){var ct=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e.width>tt.width?(ct++,e.width):t+e.width}),0)})),ct=B&&ct>B?B:ct,this.attributes.lines=ct}if(e==wt&&null==m){var ft=n.width,dt=n.height;n.text,tt.height=this.contrastSize(Y(tt.width*dt/ft)||0,b,x),this.layoutBoxUpdate(tt,i,1)}e==mt&&null==m&&(W=Y(W,S),tt.height=this.contrastSize(Y(this.attributes.lines*W),b,x),this.layoutBoxUpdate(tt,i,1,!0)),!g&&o&&o.children&&U&&(!this.isFlex(o)||o.isFlexCalc)&&([St,mt].includes(e)&&this.isFlex()||e==St&&this.isBlock(this)&&this.isInFlow())&&(tt.width=this.contrastSize(U-(o.isFlexCalc?0:nt),v,y),this.layoutBoxUpdate(tt,i)),g&&!it(g)&&(tt.width=this.contrastSize(g,v,y),this.layoutBoxUpdate(tt,i,0)),m&&!it(m)&&(tt.height=this.contrastSize(tt.height,b,x),this.layoutBoxUpdate(tt,i,1));var lt=0;if(a.length){var ut=null,pt=!1;a.forEach((function(e,n){e.getBoxWidthHeight();var r=a[n+1];if(r&&r.isInFlow()&&(e.next=r),!t.line||!t.line.ids.includes(e.id))if(e.isInFlow()&&!e.inFlexBox()){var o=t.getBoxState(ut,e);if(e.isBr)return pt=!0;t.line&&t.line.canIEnter(e)&&!o&&!pt?t.line.add(e):(pt=!1,(new gt).bind(e)),ut=e}else e.inFlexBox()?t.line&&(t.line.canIEnter(e)||"nowrap"==i.flexWrap)?t.line.add(e):(new xt).bind(e):e.isFixed?t.root.fixedLine?t.root.fixedLine.fixedAdd(e):(new gt).fixedBind(e):t.fixedLine?t.fixedLine.fixedAdd(e):(new gt).fixedBind(e,1)})),this.lines&&(lt=this.lines.reduce((function(t,e){return t+e.height}),0))}var vt=0,yt=0;if(!g&&(this.isAbsolute||this.isFixed)&&U){var bt=k==kt?U:this.root.width,zt=bt-(it(c)?Y(c,bt):c)-(it(u)?Y(u,bt):u);vt=i.left?zt:this.lineMaxWidth}if(!m&&(null!=d?d:this.isAbsolute||this.isFixed&&N)){var It=k==kt?N:this.root.height,Mt=It-(it(d)?Y(d,It):d)-(it(l)?Y(l,It):l);yt=i.top?Mt:0}if(g&&!it(g)||tt.width||(tt.width=vt||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?U||o.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,v,y),this.layoutBoxUpdate(tt,i,0)),m||!lt&&!yt||(tt.height=yt||this.contrastSize(lt,b,x),this.layoutBoxUpdate(tt,i)),i.borderRadius&&this.borderSize&&this.borderSize.width)for(var _ in i.borderRadius)Object.hasOwnProperty.call(i.borderRadius,_)&&(i.borderRadius[_]=Y(i.borderRadius[_],this.borderSize.width));return this.layoutBox},e.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.root.contentSize=this.contentSize,this.getBoxPosition(),this.offsetSize},t}(),Lt=function(){var t,e,i,n,r,o,s=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],a=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],h=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],c=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],f=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],d=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],l=[],u=[],p=[],g=[],v=[],y=2;function b(t,e){var i;t>e&&(i=t,t=e,e=i),i=e,i*=e,i+=e,i>>=1,g[i+=t]=1}function x(t,i){var n;for(p[t+e*i]=1,n=-2;n<2;n++)p[t+n+e*(i-2)]=1,p[t-2+e*(i+n+1)]=1,p[t+2+e*(i+n)]=1,p[t+n+1+e*(i+2)]=1;for(n=0;n<2;n++)b(t-1,i+n),b(t+1,i-n),b(t-n,i-1),b(t+n,i+1)}function w(t){for(;t>=255;)t=((t-=255)>>8)+(255&t);return t}var m=[];function S(t,e,i,n){var r,o,s;for(r=0;re&&(i=t,t=e,e=i),i=e,i+=e*e,i>>=1,g[i+=t]}function I(t){var i,n,r,o;switch(t){case 0:for(n=0;n>1&1,i=0;i=5&&(i+=3+v[e]-5);for(e=3;et||3*v[e-3]>=4*v[e]||3*v[e+3]>=4*v[e])&&(i+=40);return i}function k(){var t,i,n,r,o,s=0,a=0;for(i=0;ie*e;)h-=e*e,c++;for(s+=10*c,t=0;t1)for(P=s[t],B=e-7;;){for(M=e-7;M>P-3&&(x(M,B),!(M6)for(P=a[t-7],W=17,M=0;M<6;M++)for(B=0;B<3;B++,W--)1&(W>11?t>>W-12:P>>W)?(p[5-M+e*(2-B+e-11)]=1,p[2-B+e-11+e*(5-M)]=1):(b(5-M,2-B+e-11),b(2-B+e-11,5-M));for(B=0;B=(M=r*(i+n)+n)-2&&(O=M-2,t>9&&O--),T=O,t>9){for(l[T+2]=0,l[T+3]=0;T--;)P=l[T],l[T+3]|=255&P<<4,l[T+2]=P>>4;l[2]|=255&O<<4,l[1]=O>>4,l[0]=64|O>>12}else{for(l[T+1]=0,l[T+2]=0;T--;)P=l[T],l[T+2]|=255&P<<4,l[T+1]=P>>4;l[1]|=255&O<<4,l[0]=64|O>>4}for(T=O+3-(t<10);T0;L--)m[L]=m[L]?m[L-1]^d[w(f[m[L]]+T)]:m[L-1];m[0]=d[w(f[m[0]]+T)]}for(T=0;T<=o;T++)m[T]=f[m[T]];for(W=M,B=0,T=0;T>=1)1&B&&(p[e-1-W+8*e]=1,W<6?p[8+e*W]=1:p[8+e*(W+1)]=1);for(W=0;W<7;W++,B>>=1)1&B&&(p[8+e*(e-7+W)]=1,W?p[6-W+8*e]=1:p[7+8*e]=1);return p}(v)},utf16to8:function(t){var e,i,n,r;for(e="",n=t.length,i=0;i=1&&r<=127?e+=t.charAt(i):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r>>0&63)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|r>>0&63));return e},draw:function(t,i,n,r,o){i.drawView(n,r);var s=i.ctx,a=n.contentSize,h=a.width,c=a.height,f=a.left,d=a.top;r.borderRadius,r.backgroundColor;var l=r.color,u=void 0===l?"#000000":l;r.border,n.contentSize.left,n.borderSize.left,n.contentSize.top,n.borderSize.top;if(y=o||y,s){s.save(),i.setOpacity(r),i.setTransform(n,r);var p=Math.min(h,c);t=this.utf16to8(t);var g=this.getFrame(t),v=p/e;s.setFillStyle(u);for(var b=0;b=s||n==c&&o=s)&&(a=e.width/i.width);var f=i.width*a,d=i.height*a,l=r||[],u=l[0],p=l[1],g=N(u)?Y(u,e.width):(e.width-f)*(U(u)?Y(u,1):{left:0,center:.5,right:1}[u||"center"]),v=N(p)?Y(p,e.height):(e.height-d)*(U(p)?Y(p,1):{top:0,center:.5,bottom:1}[p||"center"]),y=function(t,e){return[(t-g)/a,(e-v)/a]},b=y(0,0),x=b[0],w=b[1],m=y(e.width,e.height),S=m[0],z=m[1],I=Math.max,M=Math.min;return{sx:I(x,0),sy:I(w,0),sw:M(S-x,i.width),sh:M(z-w,i.height),dx:I(g,0),dy:I(v,0),dw:M(f,e.width),dh:M(d,e.height)}}({objectFit:u,objectPosition:v},e.contentSize,t),o=n.sx,s=n.sy,a=n.sh,h=n.sw,c=n.dx,f=n.dy,d=n.dh,l=n.dw;C==r.MP_BAIDU?i.drawImage(t.src,c+m,f+S,l,d,o,s,h,a):i.drawImage(t.src,o,s,h,a,c+m,f+S,l,d)}else i.drawImage(t.src,m,S,x,w)},k=function(){i.restore(),W.drawView(e,o,!1,!0,!1),h(1)},B=function(t){M(t),k()},B(t),[2]}))}))}))];case 1:return h.sent(),[2]}}))}))},t.prototype.drawText=function(t,e,i,n){var r=this,o=this.ctx,s=e.borderSize,a=e.contentSize,h=e.left,c=e.top,f=a.width,d=a.height,l=a.left-s.left||0,u=a.top-s.top||0,p=i.color,g=i.lineHeight,v=i.fontSize,y=i.fontWeight,b=i.fontFamily,x=i.fontStyle,w=i.textIndent,m=void 0===w?0:w,S=i.textAlign,z=i.textStroke,I=i.verticalAlign,M=void 0===I?Ct:I,k=i.backgroundColor,B=i.lineClamp,W=i.backgroundClip,P=i.textShadow,O=i.textDecoration;if(m=$(m)?m:0,this.drawView(e,i,W!=Ft),g=Y(g,v),t){o.save(),h+=l,c+=u;var T=n.fontHeight,L=n.descent,R=void 0===L?0:L,F=n.ascent,A=R+(void 0===F?0:F);switch(o.setFonts({fontFamily:b,fontSize:v,fontWeight:y,fontStyle:x}),o.setTextBaseline(Ct),o.setTextAlign(S),W?this.setBackground(k,f,d,h,c):o.setFillStyle(p),S){case Dt:break;case $t:h+=.5*f;break;case Yt:h+=f}var E=n.lines*g,j=Math.ceil((d-E)/2);switch(j<0&&(j=0),M){case jt:break;case Ct:c+=j;break;case Ht:c+=2*j}var C=(g-T)/2,H=g/2,D=function(t){var e=o.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,r=e.actualBoundingBoxAscent;return M==jt?{fix:A?void 0===r?0:r:H-C/2,lineY:A?0:C-C/2}:M==Ct?{fix:A?H+n/4:H,lineY:A?0:C}:M==Ht?{fix:A?g-n:H+C/2,lineY:A?2*C:C+C/2}:{fix:0,height:0,lineY:0}},U=function(t,e,i){var r=t;switch(S){case Dt:r+=i;break;case $t:r=(t-=i/2)+i;break;case Yt:r=t,t-=i}if(O){o.setLineWidth(v/13),o.beginPath();var s=.1*n.fontHeight;/\bunderline\b/.test(O)&&(o.moveTo(t,e+n.fontHeight+s),o.lineTo(r,e+n.fontHeight+s)),/\boverline\b/.test(O)&&(o.moveTo(t,e-s),o.lineTo(r,e-s)),/\bline-through\b/.test(O)&&(o.moveTo(t,e+.5*n.fontHeight),o.lineTo(r,e+.5*n.fontHeight)),o.closePath(),o.setStrokeStyle(p),o.stroke()}},N=function(t,e,i){var n=function(){o.setLineWidth(z.width),o.setStrokeStyle(z.color),o.strokeText(t,e,i)},s="outset";z&&z.type!==s?(o.save(),r.setShadow({boxShadow:P}),o.fillText(t,e,i),o.restore(),n()):z&&z.type==s?(o.save(),r.setShadow({boxShadow:P}),n(),o.restore(),o.save(),o.fillText(t,e,i),o.restore()):(r.setShadow({boxShadow:P}),o.fillText(t,e,i))};if(!n.widths||1==n.widths.length&&n.widths[0].total+m<=a.width){var _=D(t),X=_.fix,q=void 0===X?0:X,G=_.lineY;return N(t,h+m,c+q),U(h+m,c+G,n&&n.widths&&n.widths[0].total||n.text),c+=g,o.restore(),void this.setBorder(e,i)}for(var V=c,J=h,Q="",Z=0,K=o.measureText("...").width,tt=n.widths,et=0;eta.width){Z>=B&&(Q+="…"),Z++,nt=0;var ct=D(Q);q=ct.fix,G=ct.lineY;N(Q,J,c+q),U(J,c+G,nt),c+=g,Q=""}else if(rt==it.length-1){et!=tt.length-1&&Z==B&&K+ntV+d||Z>B)break}}o.restore()}},t.prototype.source=function(t){return i(this,void 0,void 0,(function(){var e,i,r,o,s=this;return n(this,(function(n){switch(n.label){case 0:if(this.node=null,e=+new Date,"{}"==JSON.stringify(t))return[2];if(t.styles=t.styles||t.css||{},!t.type)for(i in t.type=Et,t)["views","children","type","css","styles"].includes(i)||(t.styles[i]=t[i],delete t[i]);return t.styles.boxSizing||(t.styles.boxSizing="border-box"),[4,this.create(t)];case 1:return(r=n.sent())?(o=r.layout()||{},this.size=o,this.node=r,this.onEffectFinished().then((function(t){return s.lifecycle("onEffectSuccess",t)})).catch((function(t){return s.lifecycle("onEffectFail",t)})),this.performance&&console.log("布局用时:"+(+new Date-e)+"ms"),[2,this.size]):[2,console.warn("no node")]}}))}))},t.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},t.prototype.create=function(t,r){return i(this,void 0,void 0,(function(){function i(t,n,r){void 0===n&&(n={}),void 0===r&&(r=!0);var o=[];return t.forEach((function(t){var s=t.styles,a=void 0===s?{}:s,h=t.css,c=void 0===h?{}:h,f=t.children,d=void 0===f?[]:f,l=t.views,u=void 0===l?[]:l,p=t.text,g=void 0===p?"":p,v=t.type,y=void 0===v?"":v;!d&&u&&(t.children=d=u);var b={};b=e(e(r?e({},n):{},a),c);var x={},w={},m={};Object.keys(b).map((function(t){if(t.includes("padding")||t.includes("margin")){var e=dt(t,b[t]);Object.keys(e).map((function(t){t.includes("Left")?w[t]=e[t]:t.includes("Right")?m[t]=e[t]:x[t]=e[t]}))}}));if(b.textIndent&&(w.textIndent=b.textIndent,delete n.textIndent),""!==g){var S=Array.from(g);S.forEach((function(t,e){var i=Object.assign({},b,x);0===e?Object.assign(i,w):e==S.length-1&&Object.assign(i,m),delete i.padding,delete i.margin,o.push({type:"text",text:t,styles:i})}))}if(y==Rt||y==At)o.push(t);else if("block"===a.display&&d.length>0){var z=i(d,b,!1);t.children=z,t.flattened=!0,o.push(t)}else if(d.length>0){z=i(d,b,r);o=o.concat(z)}})),o}var o,s,a,h,c,f,d,l,u,p,g,v,y,b,x,w,m,S,z,I,M,k,B,P;return n(this,(function(n){switch(n.label){case 0:if(!t)return[2];if(t.styles||(t.styles=t.css||{}),o=t.type,s=t.show,a=void 0===s||s,h=o==Rt,c=[Ft,At].includes(o),f="textBox"==o,d=t.styles||{},l=d.backgroundImage,u=d.display,h&&!t.src&&!t.url)return[2];if(u==W||!a)return[2];if(c||f){if(p=t.children,g=t.views,!p&&g&&(t.children=p=g),!t.text&&(!p||p&&!p.length))return[2];p&&p.length&&!t.flattened&&(v=i(t.children||t.views),t.type="view",t.children=v)}if(!(h||t.type==Et&&l))return[3,4];y=h?t.src:"",b=/url\(['"]?(.*?)['"]?\)/.exec(l),l&&b&&b[1]&&(y=b[1]||""),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.getImageInfo(y)];case 2:return x=n.sent(),w=x.width,m=x.height,!(S=x.path)&&h?[2]:(S&&(t.attributes=Object.assign(t.attributes||{},{width:w,height:m,path:S,src:S,naturalSrc:y})),[3,4]);case 3:return z=n.sent(),t.type!=Et?[2]:(this.lifecycle("onEffectFail",e(e({},z),{src:y})),[3,4]);case 4:if(this.count+=1,I=new Tt(t,r,this.root,this.ctx),!(M=t.children||t.views))return[3,8];k=0,n.label=5;case 5:return k uniapp 海报画板,更优雅的海报生成方案 -> [查看更多 站点 1](https://limeui.qcoon.cn/#/painter) -> [查看更多 站点 2](http://liangei.gitee.io/limeui/#/painter) -> Q 群:1169785031 +> [查看更多](https://limeui.qcoon.cn/#/painter) ## 平台兼容 diff --git a/uni_modules/lime-style/changelog.md b/uni_modules/lime-style/changelog.md new file mode 100644 index 0000000..c12d39b --- /dev/null +++ b/uni_modules/lime-style/changelog.md @@ -0,0 +1,48 @@ +## 0.2.4(2025-11-14) +- feat: 优化create-var +## 0.2.3(2025-10-19) +- fix: 修复非uts环境使用set的问题 +## 0.2.2(2025-10-15) +- fix: 去掉版本判断 +## 0.2.1(2025-10-15) +- fix: 修复条件判断问题 +## 0.2.0(2025-10-01) +- fix: 修复uniapp主题变化报错问题 +## 0.1.9(2025-09-26) +- feat: 更新宫格暗黑hover颜色 +## 0.1.8(2025-09-08) +- feat: 去掉vue2的判断 +## 0.1.7(2025-08-15) +更新变量 +## 0.1.6(2025-06-20) +- feat: 放弃使用rpx +## 0.1.5(2025-06-20) +- fix: 修复 vue2 rpx转成px的问题 +## 0.1.4(2025-06-12) +- feat: 增加一些函数 +## 0.1.3(2025-05-07) +- feat: 增加`hairline`函数 +## 0.1.2(2025-04-24) +- feat: 根据官方建议,字体使用px +## 0.1.1(2025-03-25) +- feat: 更换rbgToHsv算法 +## 0.1.0(2025-03-13) +- feat: hbx4.56 Vue2 scss 预编译器默认已由 node-sass 更换为 dart-sass +## 0.0.9(2025-01-16) +- feat: 更新 +## 0.0.8(2024-12-15) +- fix: 修复vue2 不支持rgba(0,0,0,1%) +## 0.0.7(2024-12-11) +- feat: 增加除法 +## 0.0.6(2024-12-04) +- fix: 除法问题 +## 0.0.5(2024-11-20) +- feat: 增加flex +## 0.0.4(2024-11-20) +- feat: 增加flex +## 0.0.3(2024-09-30) +- fix: 由于 vue2 h5 css变量不支持rpx,故转成px +## 0.0.2(2024-09-23) +- fix: 修复 vue2 math.div 问题 +## 0.0.1(2024-09-02) +- init diff --git a/uni_modules/lime-style/color/colorPalette.scss b/uni_modules/lime-style/color/colorPalette.scss new file mode 100644 index 0000000..6408e72 --- /dev/null +++ b/uni_modules/lime-style/color/colorPalette.scss @@ -0,0 +1,236 @@ +/* #ifdef VUE3 */ +@use "sass:math"; +/* #endif */ + + + +$hueStep: 2; +$saturationStep1: 0.16; +$saturationStep2: 0.05; +$brightnessStep1: 0.05; +$brightnessStep2: 0.15; +$lightColorCount: 5; +$darkColorCount: 4; + +$darkColorMap: ( + (index: 7, opacity: 0.15), + (index: 6, opacity: 0.25), + (index: 5, opacity: 0.3), + (index: 5, opacity: 0.45), + (index: 5, opacity: 0.65), + (index: 5, opacity: 0.85), + (index: 4, opacity: 0.9), + (index: 3, opacity: 0.95), + (index: 2, opacity: 0.97), + (index: 1, opacity: 0.98) +); + +@function div($dividend, $divisor) { + /* #ifdef VUE3 */ + @return math.div($dividend, $divisor); + /* #endif + /* #ifndef VUE3 */ + @return $dividend / $divisor; + /* #endif */ +} + +// 求一个数的n次幂 +@function pow($number, $n) { + $ret: 1; + @if $n >= 0 { + @for $i from 1 through $n { + $ret: $ret * $number; + } + } @else { + @for $i from $n to 0 { + $ret: $ret / $number; + } + } + @return $ret; +} + +// 浮点数保留小数位 +@function toFixed($float, $digits: 2) { + $pow: pow(10, $digits); + @return div(round($float * $pow) , $pow); +} + + +// 根据颜色获取对应的hsv,在tinycolor中首先进行了归一化处理,这里没有 +// 返回的结果h是0~360,代表的是色相的角度, sv的范围0-1 +@function rbgToHsv($limeColor) { + $r: red($limeColor); + $g: green($limeColor); + $b: blue($limeColor); + $max: max($r, $g, $b); + $min: min($r, $g, $b); + $diff: $max - $min; + $h: 0; + + @if $max == $min { + $h: 0 + } @else if $max == $r { + $h: div(60 * ($g - $b) , $diff) + if($g >= $b, 0, 360); + } @else if $max == $g { + $h: 60 * div($b - $r , $diff) + 120 //($b - $r) / $diff + 120; + } @else if $max == $b{ + $h: div(60 * ($r - $g) , $diff) + 240; + } + + $s: if($max == 0, 0, div($diff , $max)); + $v: div($max , 255); + + @return $h, $s, $v; +} +// hsv转化成rgb,借鉴了tinycolor的做法,避免通过$th的值判断来获取对应的rgb的取值 +// $t1~4的计算目前不清楚为什么这样做 +@function hsvTorgb($h, $s, $v) { + // $th: floor(div($h , 60)); + // $t1: div($h , 60) - $th; + // $t2: $v * (1 - $s); + // $t3: $v * (1 - $t1 * $s); + // $t4: $v * (1 - (1 - $t1) * $s); + // $i: $th + 1; + // $r: nth(($v, $t3, $t2, $t2, $t4, $v), $i); + // $g: nth(($t4, $v, $v, $t3, $t2, $t2), $i); + // $b: nth(($t2, $t2, $t4, $v, $v, $t3), $i); + + // @return rgb($r * 255, $g * 255, $b * 255); + $h: $h % 360; + + // 2. 计算色相区域 (0~5),对应6个60度区间 + $th: floor(div($h, 60)) % 6; // 强制th在0~5之间 + + // 3. 计算中间变量 + $t1: div($h, 60) - $th; + $t2: $v * (1 - $s); + $t3: $v * (1 - $t1 * $s); + $t4: $v * (1 - (1 - $t1) * $s); + + // 4. 根据色相区域选择RGB分量 + $i: $th + 1; // 索引范围锁定为1~6 + + // 定义各区域对应的RGB系数 + $r-values: ($v, $t3, $t2, $t2, $t4, $v); + $g-values: ($t4, $v, $v, $t3, $t2, $t2); + $b-values: ($t2, $t2, $t4, $v, $v, $t3); + + // 5. 获取RGB分量并转换为0~255整数 + $r: nth($r-values, $i) * 255; + $g: nth($g-values, $i) * 255; + $b: nth($b-values, $i) * 255; + + // 6. 返回RGB颜色值 + @return rgb(round($r), round($g), round($b)); +} + +//转换色相 +@function getHue($h, $i, $isLight) { + $hue: null; + @if $h >= 60 and $h <= 240 { + $hue: if($isLight, $h - $hueStep * $i, $h + $hueStep * $i); + } @else { + $hue: if($isLight, $h + $hueStep * $i, $h - $hueStep * $i); + } + + $hue: ($hue + 360) % 360; + + @return round($hue); +} + +// 转换饱和度 +@function getSaturation($s, $i, $isLight) { + $saturation: null; + @if $isLight { + $saturation: $s - $saturationStep1 * $i; + } @else if $i == $darkColorCount { + $saturation: $s + $saturationStep1; + } @else { + $saturation: $s + $saturationStep2 * $i; + } + $saturation: min($saturation, 1); + + @if $isLight and $i == $lightColorCount and $saturation > 0.1 { + $saturation: 0.1; + } + + $saturation: max($saturation, 0.06); + + @return toFixed($saturation, 2); +} + +// 转换明度 +@function getValue($v, $i, $isLight) { + $value: min( + if( + $isLight, + $v + $brightnessStep1 * $i, + $v - $brightnessStep2 * $i + ), + 1); + + @return toFixed($value, 2); +} + + +@function mix($rgb1, $rgb2, $amount){ + $p: $amount; + $r: (red($rgb2) - red($rgb1)) * $p + red($rgb1); + $g: (green($rgb2) - green($rgb1)) * $p + green($rgb1); + $b: (blue($rgb2) - blue($rgb1)) * $p + blue($rgb1); + + @return rgb($r, $g, $b) +} + +// 根据颜色和对应的色板位置,计算出对应的色板颜色 +@function genColor($color, $index, $theme: 'default' , $bgColor: #242424) { + $isLight: if($index <= 6, true, false); + $hsv: rbgToHsv($color); + //这里将i转换成以主色为中心,两侧的i值逐渐增大 + $i: if($isLight, $lightColorCount + 1 - $index, $index - $lightColorCount - 1); + + @if $theme == 'dark' { + $item: nth($darkColorMap, $index); + $index2: map-get($item, index); + $opacity: map-get($item, opacity); + + $rgb: genColor($color, $index2 + 1); + + // @return $rgb; + @return mix( + $bgColor, + $rgb, + $opacity + ) + } + + @return hsvTorgb( + getHue(nth($hsv, 1), $i, $isLight), + getSaturation(nth($hsv, 2), $i, $isLight), + getValue(nth($hsv, 3), $i, $isLight) + ); +} + +@function getSolidColor($base-color, $brightness) { + // 验证输入参数 + @if type-of($base-color) != 'color' { + @error "Expected color for $base-color, but got #{type-of($base-color)}: #{$base-color}"; + } + + @if type-of($brightness) != 'number' { + @error "Expected number for $brightness, but got #{type-of($brightness)}: #{$brightness}"; + } + + // 获取基础颜色的HSL值 + $hue: hue($base-color); + $saturation: saturation($base-color); + $lightness: lightness($base-color); + + // 计算新的亮度值 (限制在0-100%范围内) + $new-lightness: clamp(0%, $lightness + $brightness, 100%); + + // 使用HSL函数创建新颜色 + $new-color: hsl($hue, $saturation, $new-lightness); + + @return $new-color; +} \ No newline at end of file diff --git a/uni_modules/lime-style/color/colors.scss b/uni_modules/lime-style/color/colors.scss new file mode 100644 index 0000000..2f1a1d5 --- /dev/null +++ b/uni_modules/lime-style/color/colors.scss @@ -0,0 +1,18 @@ +// 品牌色-主色 +$primary-color: #3283ff!default; +// 错误色 +$error-color: #FF4D4F!default; +// 警告色 +$warning-color: #ffb400!default;// #FF7D00!default; +// 信息色 +$info-color: $primary-color!default; +// 成功色 +$success-color: #34c471!default; + +$blue: #3283ff!default; +$red: #FF4D4F!default; +$orange: #ffb400!default; +$yellow: #fcd53f!default; +$green: #34c471 !default; +$white: #fff; +$black: #000; diff --git a/uni_modules/lime-style/functions.scss b/uni_modules/lime-style/functions.scss new file mode 100644 index 0000000..8332c1a --- /dev/null +++ b/uni_modules/lime-style/functions.scss @@ -0,0 +1,11 @@ +/* #ifdef VUE3 */ +@use "sass:math"; +// #endif +@function divide($dividend, $divisor) { + /* #ifdef VUE3 */ + @return math.div($dividend, $divisor); + /* #endif + /* #ifndef VUE3 */ + @return $dividend / $divisor; + /* #endif +} diff --git a/uni_modules/lime-style/hairline.uts b/uni_modules/lime-style/hairline.uts new file mode 100644 index 0000000..8dc0d89 --- /dev/null +++ b/uni_modules/lime-style/hairline.uts @@ -0,0 +1,153 @@ +import { unitConvert } from '@/uni_modules/lime-shared/unitConvert'; + +export type DrawBorderOptions = { + direction : 'top' | 'bottom' | 'left' | 'right'; + color ?: string; + colorKey ?: string; // 在dom中获取颜色 + startOffsetKey?: string; // 在dom哪个属性获取 + startOffset ?: number | string; // 支持数字或 CSS 字符串(如 '10px') + endOffset ?: number | string; + lineWidth ?: number; + watchSize ?: boolean; // 是否监听尺寸变化自动重绘 + immediate ?: boolean; // 是否立即绘制 + bordered?: boolean; + +} + +export type UseDrawBorderReturn = { + color: Ref, + renderBorder: () => void, + clearBorder: () => void; + dispose: () => void, +} +/** + * 在元素上绘制边框,并支持动态监听尺寸变化 + * @param elementRef 目标元素的 Ref + * @param options 边框配置 + * @returns 清理函数(用于卸载时取消监听) + */ +export function useDrawBorder( + elementRef : Ref, + options : DrawBorderOptions +):UseDrawBorderReturn { + let resizeObserver : UniResizeObserver | null = null; + const { watchSize = true, immediate = true } = options; + const defalutColor = '#e7e7e7' + const color = ref(options.color ?? defalutColor) + const bordered = ref(options.bordered ?? true) + let computedStartOffset = 0 + let computedEndOffset = 0 + + // 绘制边框 + const renderBorder = () => { + if (elementRef.value == null) return; + const ctx = elementRef.value!.getDrawableContext(); + if (ctx == null) return; + + const rect = elementRef.value!.getBoundingClientRect(); + ctx.reset(); + + const { + direction, + startOffset = 0, + endOffset = 0, + lineWidth = 0.5, + colorKey, + startOffsetKey, + } = options; + + + // 转换单位(如果是字符串,如 '10px') + if(computedStartOffset == 0) { + computedStartOffset = unitConvert((startOffsetKey != null ? elementRef.value?.style.getPropertyValue(startOffsetKey!) ?? startOffset : startOffset)) + } + if(computedEndOffset == 0) { + computedEndOffset = unitConvert(endOffset) + } + + if(color.value == defalutColor && colorKey != null) { + color.value = elementRef.value?.style.getPropertyValue(colorKey!) ?? defalutColor + // if(color.value.length == 0) { + // color.value = defalutColor + // } + } + ctx.strokeStyle = color.value; + ctx.lineWidth = lineWidth; + + // 根据方向计算坐标 + switch (direction) { + case 'top': + ctx.moveTo(computedStartOffset, 0); + ctx.lineTo(rect.width - computedEndOffset, 0); + break; + case 'bottom': + ctx.moveTo(computedStartOffset, rect.height - 0.25); + ctx.lineTo(rect.width - computedEndOffset, rect.height - 0.25); + break; + case 'left': + ctx.moveTo(0, computedStartOffset); + ctx.lineTo(0, rect.height - computedEndOffset); + break; + case 'right': + ctx.moveTo(rect.width, computedStartOffset); + ctx.lineTo(rect.width, rect.height - computedEndOffset); + break; + } + + ctx.stroke(); + ctx.update(); + }; + + const setupResizeObserver = () => { + // 监听尺寸变化(如果启用) + if (watchSize) { + if (resizeObserver == null) { + resizeObserver = new UniResizeObserver((entries : Array) => { + if(!bordered.value) return + renderBorder(); + }) + } + watchEffect(()=>{ + if (elementRef.value != null) { + resizeObserver!.observe(elementRef.value!); + } + }) + } + } + + + // 清理函数(卸载时取消监听) + const dispose = () => { + if (resizeObserver != null && elementRef.value != null) { + // resizeObserver.unobserve(elementRef.value!); + resizeObserver!.disconnect(); + resizeObserver = null; + } + }; + + const clearBorder = ()=> { + if (elementRef.value == null) return; + const ctx = elementRef.value!.getDrawableContext(); + if (ctx == null) return; + bordered.value = false + ctx.reset() + ctx.update() + } + + setupResizeObserver() + // 初始绘制 + if(immediate) { + renderBorder(); + } + + + + + return { + renderBorder, // 手动触发绘制 + dispose, // 清理监听 + clearBorder, + color + } as UseDrawBorderReturn + +} \ No newline at end of file diff --git a/uni_modules/lime-style/index.scss b/uni_modules/lime-style/index.scss new file mode 100644 index 0000000..edd46a7 --- /dev/null +++ b/uni_modules/lime-style/index.scss @@ -0,0 +1,7 @@ +@import './theme/default'; +@import './var'; +// @import './mixins/ellipsis'; +// @import './mixins/hairline'; +@import './mixins/create'; +@import './mixins/directionalProperty'; +// @import './mixins/useTheme'; \ No newline at end of file diff --git a/uni_modules/lime-style/index.uts b/uni_modules/lime-style/index.uts new file mode 100644 index 0000000..208438f --- /dev/null +++ b/uni_modules/lime-style/index.uts @@ -0,0 +1,3 @@ +export * from './token/useThemeMode' +export * from './token/useThemeVars' +export * from './token/interface' \ No newline at end of file diff --git a/uni_modules/lime-style/mixins/bem.scss b/uni_modules/lime-style/mixins/bem.scss new file mode 100644 index 0000000..e69de29 diff --git a/uni_modules/lime-style/mixins/create.scss b/uni_modules/lime-style/mixins/create.scss new file mode 100644 index 0000000..ea313a9 --- /dev/null +++ b/uni_modules/lime-style/mixins/create.scss @@ -0,0 +1,235 @@ +/* #ifdef VUE3 */ +@use "sass:math"; +/* #endif */ + +/* #ifndef UNI-APP-X && APP || APP-NVUE */ +$use-css-var: true !default; +/* #endif */ +/* #ifdef UNI-APP-X && APP || APP-NVUE */ +$use-css-var: false !default; +/* #endif */ + + +@function div($dividend, $divisor) { + /* #ifdef VUE3 */ + @return math.div($dividend, $divisor); + /* #endif */ + /* #ifndef VUE3 */ + @return $dividend / $divisor; + /* #endif */ +} + +@function rpx-to-px($value) { + // 递归处理列表 + @if type-of($value) == list { + $new-list: (); + @each $item in $value { + $new-list: append($new-list, rpx-to-px($item)); + } + @return $new-list; + } + + // 处理数字类型 - 带 rpx 单位 + @if type-of($value) == number and unit($value) == 'rpx' { + // 安全处理单位转换 + @return calc-strip-unit($value) * 0.5 * 1px; + } + + // 处理字符串类型 + @if type-of($value) == string { + $string: $value; + $rpx-index: str-index($string, 'rpx'); + + // 如果字符串以数字开头并以 rpx 结尾,转换为数值 + @if $rpx-index == (str-length($string) - 2) { + $num-str: str-slice($string, 1, $rpx-index - 1); + $number: to-number($num-str); + @if type-of($number) == number { + @return $number * 0.5 * 1px; + } + } + + // 字符串中可能包含多个 rpx 值 + @if $rpx-index { + $result: ''; + @while $rpx-index { + // 找到数字部分起点 + $num-end: $rpx-index - 1; + $num-start: $num-end; + @while $num-start > 0 and is-numeric-char(str-slice($string, $num-start, $num-start)) { + $num-start: $num-start - 1; + } + + // 提取数字部分 + $num-str: str-slice($string, $num-start + 1, $num-end); + $number: to-number($num-str); + + // 转换为 px 数值 + $px-value: $number * 0.5 * 1px; + + // 构建结果字符串 + $result: $result + str-slice($string, 1, $num_start) + '#{$px_value}'; + + // 更新剩余字符串 + $string: str-slice($string, $rpx-index + 3); + $rpx-index: str-index($string, 'rpx'); + } + @return #{$result + $string}; + } + } + + // 其他类型直接返回 + @return $value; +} + +// 辅助函数:安全去除单位并返回数值 +@function calc-strip-unit($number) { + @if type-of($number) == number { + $unit: unit($number); + $units: ("px": 1px, "rpx": 1rpx, "em": 1em, "rem": 1rem, "%": 1%); + + @if map-has-key($units, $unit) { + @return div($number , map-get($units, $unit)); + } + + @if unitless($number) { + @return $number; + } + } + + @return $number; +} + +// 辅助函数:检查字符是否为数字 +@function is-numeric-char($char) { + $chars: "-.0123456789"; + @return str-index($chars, $char) != null; +} + +// 辅助函数:将字符串安全转换为数字 +@function to-number($string) { + // 如果输入已经是数字,直接返回 + @if type-of($string) == number { + @return $string; + } + + // 处理带符号的数字 + $is-negative: false; + $numeric: ""; + $found-number: false; + + // 提取所有数字字符 + @for $i from 1 through str-length($string) { + $char: str-slice($string, $i, $i); + + @if $char == "-" and $numeric == "" { + $is-negative: true; + } + @else if $char == "." and str-index($numeric, ".") == null { + $numeric: $numeric + $char; + } + @else if $char >= "0" and $char <= "9" { + $numeric: $numeric + $char; + $found-number: true; + } + } + + // 如果有实际数字内容,转换为数值 + @if $found-number { + $result: 0; + $decimal-index: str-index($numeric, "."); + + @if $decimal-index { + // 处理带小数的数字 + $integer-part: str-slice($numeric, 1, $decimal-index - 1); + $decimal-part: str-slice($numeric, $decimal-index + 1); + + @if $integer-part == "" { $integer-part: "0"; } + + $result: to-integer($integer-part); + + $divisor: 1; + @for $i from 1 through str-length($decimal-part) { + $divisor: $divisor * 10; + $digit: to-integer(str-slice($decimal-part, $i, $i)); + $result: $result + ($digit / $divisor); + } + } @else { + // 处理整数 + $result: to-integer($numeric); + } + + @return if($is-negative, -$result, $result); + } + + // 无法转换则返回原字符串 + @return $string; +} + +// 辅助函数:将整数字符串转换为数字 +@function to-integer($string) { + $result: 0; + + @for $i from 1 through str-length($string) { + $char: str-slice($string, $i, $i); + $result: $result * 10 + (str-index("0123456789", $char) - 1); + } + + @return $result; +} + +@function create-var($name, $values...) { + // 将不定数量的参数转换为列表 + $value-list: $values; + $css-value: null; + + @if length($value-list) == 0 { + // @warn "The list must have at least 1 values."; + @return ''; + } @else { + // 初始化CSS变量的值为列表中的第一个值 + /* #ifndef VUE2 */ + $css-value: nth($value-list, 1); + /* #endif */ + /* #ifdef VUE2 */ + $css-value: rpx-to-px(nth($value-list, 1)); + /* #endif */ + } + // 检查列表长度是否大于等于2 + @if length($value-list) >= 2 { + // 使用@for循环遍历剩余的值,并构建CSS变量的完整值 + @for $i from 2 through length($value-list) { + /* #ifndef VUE2 */ + $css-value: $css-value + ", " + nth($value-list, $i); + /* #endif */ + /* #ifdef VUE2 */ + $css-value: $css-value + ", " + rpx-to-px(nth($value-list, $i)); + /* #endif */ + } + } + + // /* #ifndef UNI-APP-X */ + // @return var(--l-#{$name}, #{$css-value}); + // /* #endif */ + + // /* #ifdef UNI-APP-X && APP */ + // @if $use-css-var { + // @return var(--l-#{$name}, #{$css-value}); + // } @else { + // @return $css-value; + // } + // /* #endif */ + + + // /* #ifdef APP-NVUE */ + // @return $css-value; + // /* #endif */ + + // @return var(--l-#{$name}, #{$css-value}); + + @if $use-css-var { + @return var(--l-#{$name}, #{$css-value}); + } @else { + @return $css-value; + } +} diff --git a/uni_modules/lime-style/mixins/directionalProperty.scss b/uni_modules/lime-style/mixins/directionalProperty.scss new file mode 100644 index 0000000..6d23d1a --- /dev/null +++ b/uni_modules/lime-style/mixins/directionalProperty.scss @@ -0,0 +1,401 @@ +// ======================================================================= +// 方向属性核心生成器 (支持所有方向相关属性) +// ======================================================================= +@mixin directional-property( + $property, + $values, + $exclude: () +) { + // 属性类型分组 + $group-standard: padding, margin; // 标准方向属性 + $group-radius: border-radius; // 圆角属性 + $group-border: border, border-top, border-right, border-bottom, border-left; // 边框属性 + $group-outline: outline, outline-top, outline-right, outline-bottom, outline-left; // 轮廓属性 + $group-position: inset, inset-block, inset-inline, top, right, bottom, left; // 定位属性 + $group-size: block-size, inline-size; // 块/行尺寸属性 + + // 定义每个方向的值 + $top: null; + $right: null; + $bottom: null; + $left: null; + + // 确定处理模式 + $is-standard: index($group-standard, $property); + $is-radius: index($group-radius, $property); + $is-border: index($group-border, $property); + $is-outline: index($group-outline, $property); + $is-position: index($group-position, $property); + $is-size: index($group-size, $property); + + // ===================================================================== + // 解析输入值 - 根据属性类型处理 + // ===================================================================== + @if type-of($values) == 'list' { + $length: length($values); + + // 单个值 - 所有方向相同值 + @if $length == 1 { + $top: nth($values, 1); + $right: nth($values, 1); + $bottom: nth($values, 1); + $left: nth($values, 1); + } + + // 两个值 + @else if $length == 2 { + // 特殊处理:border-radius + @if $is-radius { + $top: nth($values, 1); + $right: nth($values, 2); + $bottom: nth($values, 1); + $left: nth($values, 2); + } + // 标准处理:上下 | 左右 + @else if $is-standard or $is-border or $is-outline or $is-position { + $top: nth($values, 1); + $bottom: nth($values, 1); + $right: nth($values, 2); + $left: nth($values, 2); + } + // 块/行尺寸处理 + @else if $is-size { + $top: nth($values, 1); + $right: nth($values, 2); + } + } + + // 三个值 + @else if $length == 3 { + // border-radius特殊处理 + @if $is-radius { + $top: nth($values, 1); + $right: nth($values, 2); + $bottom: nth($values, 3); + $left: nth($values, 2); + } + // 标准处理 + @else if $is-standard or $is-border or $is-outline or $is-position { + $top: nth($values, 1); + $right: nth($values, 2); + $left: nth($values, 2); + $bottom: nth($values, 3); + } + } + + // 四个值 + @else if $length == 4 { + $top: nth($values, 1); + $right: nth($values, 2); + $bottom: nth($values, 3); + $left: nth($values, 4); + } + } + @else { + // 单个值传递 + $top: $values; + $right: $values; + $bottom: $values; + $left: $values; + } + + // ===================================================================== + // 生成CSS属性(排除指定方向) + // ===================================================================== + + // 1. 圆角处理 + @if $is-radius { + @if not index($exclude, top-left) and $top != null { + border-top-left-radius: $top; + } + @if not index($exclude, top-right) and $right != null { + border-top-right-radius: $right; + } + @if not index($exclude, bottom-right) and $bottom != null { + border-bottom-right-radius: $bottom; + } + @if not index($exclude, bottom-left) and $left != null { + border-bottom-left-radius: $left; + } + } + + // 2. 标准方向处理 (padding, margin) + @else if $is-standard { + @if not index($exclude, top) and $top != null { + #{$property}-top: $top; + } + @if not index($exclude, right) and $right != null { + #{$property}-right: $right; + } + @if not index($exclude, bottom) and $bottom != null { + #{$property}-bottom: $bottom; + } + @if not index($exclude, left) and $left != null { + #{$property}-left: $left; + } + } + + // 3. 边框处理 + @else if $is-border { + // 完整边框设置 + @if $property == 'border' { + @if not index($exclude, top) and $top != null { + border-top-width: nth($values, 1); + border-top-style: nth($values, 2); + border-top-color: nth($values, 3); + } + @if not index($exclude, right) and $right != null { + border-right-width: nth($values, 1); + border-right-style: nth($values, 2); + border-right-color: nth($values, 3); + } + @if not index($exclude, bottom) and $bottom != null { + // border-bottom: $bottom; + border-bottom-width: nth($values, 1); + border-bottom-style: nth($values, 2); + border-bottom-color: nth($values, 3); + } + @if not index($exclude, left) and $left != null { + // border-left: $left; + border-left-width: nth($values, 1); + border-left-style: nth($values, 2); + border-left-color: nth($values, 3); + } + } + // 单边边框 + @else { + $direction: str-slice($property, 8); // 提取方向 + @if not index($exclude, $direction) { + // #{$property}: $top; + #{$property}-width: nth($values, 1); + #{$property}-style: nth($values, 2); + #{$property}-color: nth($values, 3); + } + } + } + + // 4. 轮廓处理 + @else if $is-outline { + // 完整轮廓设置 + @if $property == 'outline' { + @if not index($exclude, top) and $top != null { + outline-top: $top; + } + @if not index($exclude, right) and $right != null { + outline-right: $right; + } + @if not index($exclude, bottom) and $bottom != null { + outline-bottom: $bottom; + } + @if not index($exclude, left) and $left != null { + outline-left: $left; + } + } + // 单边轮廓 + @else { + $direction: str-slice($property, 8); // 提取方向 + @if not index($exclude, $direction) { + #{$property}: $top; + } + } + } + + // 5. 定位处理 + @else if $is-position { + // inset简写处理 + @if $property == 'inset' { + @if not index($exclude, top) and $top != null { + top: $top; + } + @if not index($exclude, right) and $right != null { + right: $right; + } + @if not index($exclude, bottom) and $bottom != null { + bottom: $bottom; + } + @if not index($exclude, left) and $left != null { + left: $left; + } + } + // inset-block 和 inset-inline + @else if $property == 'inset-block' { + @if not index($exclude, top) and $top != null { + top: $top; + } + @if not index($exclude, bottom) and $bottom != null { + bottom: $bottom; + } + } + @else if $property == 'inset-inline' { + @if not index($exclude, left) and $left != null { + left: $left; + } + @if not index($exclude, right) and $right != null { + right: $right; + } + } + // 单一定位 + @else { + @if not index($exclude, $property) { + #{$property}: $top; + } + } + } + + // 6. 尺寸处理 + @else if $is-size { + @if $property == 'block-size' { + @if not index($exclude, top) and $top != null { + height: $top; + } + } + @else if $property == 'inline-size' { + @if not index($exclude, left) and $left != null { + width: $left; + } + } + } +} + +// ======================================================================= +// 快捷混合宏:标准属性 +// ======================================================================= +@mixin padding($values, $exclude: ()) { + @include directional-property(padding, $values, $exclude); +} + +@mixin margin($values, $exclude: ()) { + @include directional-property(margin, $values, $exclude); +} + +@mixin border-radius($values, $exclude: ()) { + @include directional-property(border-radius, $values, $exclude); +} + +// ======================================================================= +// 快捷混合宏:边框属性 +// ======================================================================= +@mixin border($value, $exclude: ()) { + @include directional-property(border, $value, $exclude); +} + +@mixin border-top($value, $exclude: ()) { + @include directional-property(border-top, $value, $exclude); +} + +@mixin border-right($value, $exclude: ()) { + @include directional-property(border-right, $value, $exclude); +} + +@mixin border-bottom($value, $exclude: ()) { + @include directional-property(border-bottom, $value, $exclude); +} + +@mixin border-left($value, $exclude: ()) { + @include directional-property(border-left, $value, $exclude); +} + +// ======================================================================= +// 快捷混合宏:轮廓属性 +// ======================================================================= +@mixin outline($value, $exclude: ()) { + @include directional-property(outline, $value, $exclude); +} + +@mixin outline-top($value, $exclude: ()) { + @include directional-property(outline-top, $value, $exclude); +} + +@mixin outline-right($value, $exclude: ()) { + @include directional-property(outline-right, $value, $exclude); +} + +@mixin outline-bottom($value, $exclude: ()) { + @include directional-property(outline-bottom, $value, $exclude); +} + +@mixin outline-left($value, $exclude: ()) { + @include directional-property(outline-left, $value, $exclude); +} + +// ======================================================================= +// 快捷混合宏:定位属性 +// ======================================================================= +@mixin inset($values, $exclude: ()) { + @include directional-property(inset, $values, $exclude); +} + +@mixin inset-block($values, $exclude: ()) { + @include directional-property(inset-block, $values, $exclude); +} + +@mixin inset-inline($values, $exclude: ()) { + @include directional-property(inset-inline, $values, $exclude); +} + +@mixin top($value, $exclude: ()) { + @include directional-property(top, $value, $exclude); +} + +@mixin right($value, $exclude: ()) { + @include directional-property(right, $value, $exclude); +} + +@mixin bottom($value, $exclude: ()) { + @include directional-property(bottom, $value, $exclude); +} + +@mixin left($value, $exclude: ()) { + @include directional-property(left, $value, $exclude); +} + +// ======================================================================= +// 快捷混合宏:尺寸属性 +// ======================================================================= +@mixin block-size($value, $exclude: ()) { + @include directional-property(block-size, $value, $exclude); +} + +@mixin inline-size($value, $exclude: ()) { + @include directional-property(inline-size, $value, $exclude); +} + +// ======================================================================= +// 组合混合宏 +// ======================================================================= +// 带圆角的边框 +@mixin bordered($border-value, $radius-value) { + @include border($border-value); + @include border-radius($radius-value); +} + +// 绝对定位容器 +@mixin absolute-container($inset: 0) { + position: absolute; + @include inset($inset); +} + +// 固定定位容器 +@mixin fixed-container($inset: 0) { + position: fixed; + @include inset($inset); +} + +// ======================================================================= +// 圆角辅助混合宏 +// ======================================================================= +@mixin border-top-radius($value) { + @include border-radius($value 0 0, (bottom-right, bottom-left)); +} + +@mixin border-right-radius($value) { + @include border-radius(0 $value 0 0, (top-left, bottom-left)); +} + +@mixin border-bottom-radius($value) { + @include border-radius(0 0 $value, (top-right, top-left)); +} + +@mixin border-left-radius($value) { + @include border-radius(0 0 0 $value, (top-right, bottom-right)); +} \ No newline at end of file diff --git a/uni_modules/lime-style/mixins/ellipsis.scss b/uni_modules/lime-style/mixins/ellipsis.scss new file mode 100644 index 0000000..97e762a --- /dev/null +++ b/uni_modules/lime-style/mixins/ellipsis.scss @@ -0,0 +1,22 @@ +@mixin ellipsis { + // overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + /* #ifndef UNI-APP-X && APP || APP-NVUE */ + word-wrap: normal; + /* #endif */ +} + + +@mixin ellipsisLn($line) { + // overflow: hidden; + text-overflow: ellipsis; + /* #ifdef UNI-APP-X && APP || APP-NVUE */ + lines: $line; + /* #endif */ + /* #ifndef UNI-APP-X && APP || APP-NVUE */ + -webkit-line-clamp: $line; + display: -webkit-box; + -webkit-box-orient: vertical; + /* #endif */ +} \ No newline at end of file diff --git a/uni_modules/lime-style/mixins/flex.scss b/uni_modules/lime-style/mixins/flex.scss new file mode 100644 index 0000000..0c3dd84 --- /dev/null +++ b/uni_modules/lime-style/mixins/flex.scss @@ -0,0 +1,20 @@ +@mixin flex { + /* #ifndef UNI-APP-X */ + display: flex; + /* #endif */ +} +@mixin flex-column { + /* #ifndef UNI-APP-X */ + flex-direction: column; + /* #endif */ +} +@mixin flex-row { + flex-direction: row; +} + +@mixin universal { + position: relative; + box-sizing: border-box; + display: flex; + flex-direction: column; +} diff --git a/uni_modules/lime-style/mixins/hairline.scss b/uni_modules/lime-style/mixins/hairline.scss new file mode 100644 index 0000000..5044518 --- /dev/null +++ b/uni_modules/lime-style/mixins/hairline.scss @@ -0,0 +1,66 @@ +// @import '../theme/default.scss'; + +@mixin hairline-base { + position: absolute; + box-sizing: border-box; + content: ' '; + pointer-events: none; + transform-origin: center; /* cover wechat button:after default transforn-origin */ +} + +@mixin hairline($color: $border-color-2) { + @include hairline-base; + top: -50%; + right: -50%; + bottom: -50%; + left: -50%; + border: 1px solid $color; + transform: scale(.5); +} + +@mixin hairline-top($color: $border-color-1, $left: 0, $right: 0) { + @include hairline-base; + top: 0; + right: $right; + left: $left; + border-top: 1px solid $color; + transform: scaleY(0.5); +} + +@mixin hairline-bottom($color: $border-color-1, $left: 0, $right: 0) { + @include hairline-base; + right: $right; + bottom: 0; + left: $left; + border-bottom: 1px solid $color; + transform: scaleY(0.5); +} + +@mixin hairline-left($color: $border-bolor-1) { + @include hairline-base; + top: 0; + bottom: 0; + left: 0; + border-left: 1px solid $color; + transform: scaleX(.5); +} + +@mixin hairline-right($color: $border-bolor-1) { + @include hairline-base; + top: 0; + bottom: 0; + right: 0; + border-right: 1px solid $color; + transform: scaleX(.5); +} + +// @mixin border { +// /* #ifndef UNI-APP-X && APP */ +// &:after { +// @content; +// } +// /* #endif */ +// /* #ifdef UNI-APP-X && APP */ +// @content; +// /* #endif */ +// } \ No newline at end of file diff --git a/uni_modules/lime-style/mixins/platform.scss b/uni_modules/lime-style/mixins/platform.scss new file mode 100644 index 0000000..ebd3c8f --- /dev/null +++ b/uni_modules/lime-style/mixins/platform.scss @@ -0,0 +1,17 @@ +/* #ifdef APP-NVUE || UNI-APP-X && APP */ +$is-app: true; +/* #endif */ +/* #ifndef APP-NVUE || UNI-APP-X && APP */ +$is-app: false; +/* #endif */ + +@mixin is-app { + @if $is-app { + @content; + } +} +@mixin not-app { + @if not($is-app) { + @content; + } +} diff --git a/uni_modules/lime-style/mixins/useTheme.scss b/uni_modules/lime-style/mixins/useTheme.scss new file mode 100644 index 0000000..83df7ca --- /dev/null +++ b/uni_modules/lime-style/mixins/useTheme.scss @@ -0,0 +1,60 @@ +$limeThemes: light, dark; +$theme: light; + +@mixin use-theme($mode: null) { + @if $mode != null { + /* #ifndef UNI-APP-X && APP || APP-NVUE */ + @media (prefers-color-scheme: $mode) { + @content; + } + /* #endif */ + /* #ifdef UNI-APP-X && APP || APP-NVUE */ + &.#{$mode} { + @content; + } + /* #endif */ + } @else { + @each $mode in $limeThemes { + $theme: $mode !global; + /* #ifndef UNI-APP-X && APP || APP-NVUE */ + @media (prefers-color-scheme: $mode) { + @content; + } + /* #endif */ + + /* #ifdef UNI-APP-X && APP || APP-NVUE */ + &.#{$mode} { + @content; + } + /* #endif */ + } + } + +} + +@mixin theme-dark { + /* #ifndef UNI-APP-X && APP || APP-NVUE */ + @media (prefers-color-scheme: dark) { + page { + @content; + } + } + /* #endif */ + /* #ifdef UNI-APP-X && APP || APP-NVUE */ + .dark { + @content; + } + /* #endif */ + /* #ifdef WEB */ + :root[data-lime-theme='dark'] page { + @content; + } + /* #endif */ +} + + +@function get-var($themes, $key) { + @return map-get($themes, $key) +} + + diff --git a/uni_modules/lime-style/mixins/utilities.scss b/uni_modules/lime-style/mixins/utilities.scss new file mode 100644 index 0000000..3a4ea4a --- /dev/null +++ b/uni_modules/lime-style/mixins/utilities.scss @@ -0,0 +1,7 @@ +@import './flex'; + +@mixin resize-none { + /* #ifndef UNI-APP-X && APP */ + resize: none; + /* #endif */ +} diff --git a/uni_modules/lime-style/package.json b/uni_modules/lime-style/package.json new file mode 100644 index 0000000..4b38aaa --- /dev/null +++ b/uni_modules/lime-style/package.json @@ -0,0 +1,103 @@ +{ + "id": "lime-style", + "displayName": "lime-style", + "version": "0.2.4", + "description": "lime-style", + "keywords": [ + "lime-style" +], + "repository": "", + "engines": { + "HBuilderX": "^3.1.0", + "uni-app": "^4.44", + "uni-app-x": "^4.61" + }, + "dcloudext": { + "type": "sdk-js", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "", + "darkmode": "x", + "i18n": "x", + "widescreen": "x" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "√", + "aliyun": "√", + "alipay": "√" + }, + "client": { + "uni-app": { + "vue": { + "vue2": "√", + "vue3": "√" + }, + "web": { + "safari": "√", + "chrome": "√" + }, + "app": { + "vue": "√", + "nvue": "√", + "android": { + "extVersion": "", + "minVersion": "22" + }, + "ios": "√", + "harmony": "√" + }, + "mp": { + "weixin": "√", + "alipay": "√", + "toutiao": "√", + "baidu": "√", + "kuaishou": "√", + "jd": "√", + "harmony": "-", + "qq": "-", + "lark": "-" + }, + "quickapp": { + "huawei": "-", + "union": "-" + } + }, + "uni-app-x": { + "web": { + "safari": "√", + "chrome": "√" + }, + "app": { + "android": { + "extVersion": "", + "minVersion": "22" + }, + "ios": "√", + "harmony": "√" + }, + "mp": { + "weixin": "√" + } + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/lime-style/readme.md b/uni_modules/lime-style/readme.md new file mode 100644 index 0000000..0f53a25 --- /dev/null +++ b/uni_modules/lime-style/readme.md @@ -0,0 +1,16 @@ +# lime-style + +## 更换色系 +在uni.scss中增加 +```css +// 品牌色-主色 +$primary-color: #3283ff; +// 错误色 +$error-color: #FF4D4F; +// 警告色 +$warning-color: #ffb400; +// 成功色 +$success-color: #34c471; + +$blue: #3283ff; +``` \ No newline at end of file diff --git a/uni_modules/lime-style/theme/dark.scss b/uni_modules/lime-style/theme/dark.scss new file mode 100644 index 0000000..0c8a17e --- /dev/null +++ b/uni_modules/lime-style/theme/dark.scss @@ -0,0 +1,635 @@ +@import '../mixins/create.scss'; +@import '../color/colorPalette.scss'; +@import '../color/colors.scss'; +@import '../mixins/useTheme'; + +$blue-1: #{genColor($blue, 1, dark)}; +$blue-2: #{genColor($blue, 2, dark)}; +$blue-3: #{genColor($blue, 3, dark)}; +$blue-4: #{genColor($blue, 4, dark)}; +$blue-5: #{genColor($blue, 5, dark)}; +$blue-6: #{genColor($blue, 6, dark)}; +$blue-7: #{genColor($blue, 7, dark)}; +$blue-8: #{genColor($blue, 8, dark)}; +$blue-9: #{genColor($blue, 9, dark)}; +$blue-10: #{genColor($blue, 10, dark)}; + +$info-color-1: #{genColor($info-color, 1, dark)}; +$info-color-2: #{genColor($info-color, 2, dark)}; +$info-color-3: #{genColor($info-color, 3, dark)}; +$info-color-4: #{genColor($info-color, 4, dark)}; +$info-color-5: #{genColor($info-color, 5, dark)}; +$info-color-6: #{genColor($info-color, 6, dark)}; +$info-color-7: #{genColor($info-color, 7, dark)}; +$info-color-8: #{genColor($info-color, 8, dark)}; +$info-color-9: #{genColor($info-color, 9, dark)}; +$info-color-10: #{genColor($info-color, 10, dark)}; + +$primary-color-1: #{genColor($primary-color, 1, dark)}; // 浅色/白底悬浮 +$primary-color-2: #{genColor($primary-color, 2, dark)}; // 文字禁用 +$primary-color-3: #{genColor($primary-color, 3, dark)}; // 一般禁用 +$primary-color-4: #{genColor($primary-color, 4, dark)}; // 特殊场景 禁用 +$primary-color-5: #{genColor($primary-color, 5, dark)}; // 悬浮 +$primary-color-6: #{genColor($primary-color, 6, dark)}; // 常规 +$primary-color-7: #{genColor($primary-color, 7, dark)}; // 点击 +$primary-color-8: #{genColor($primary-color, 8, dark)}; // +$primary-color-9: #{genColor($primary-color, 9, dark)}; +$primary-color-10: #{genColor($primary-color, 10, dark)}; + +$error-color-1: #{genColor($error-color, 1, dark)}; +$error-color-2: #{genColor($error-color, 2, dark)}; +$error-color-3: #{genColor($error-color, 3, dark)}; +$error-color-4: #{genColor($error-color, 4, dark)}; +$error-color-5: #{genColor($error-color, 5, dark)}; +$error-color-6: #{genColor($error-color, 6, dark)}; +$error-color-7: #{genColor($error-color, 7, dark)}; +$error-color-8: #{genColor($error-color, 8, dark)}; +$error-color-9: #{genColor($error-color, 9, dark)}; +$error-color-10: #{genColor($error-color, 10, dark)}; + +$warning-color-1: #{genColor($warning-color, 1, dark)}; +$warning-color-2: #{genColor($warning-color, 2, dark)}; +$warning-color-3: #{genColor($warning-color, 3, dark)}; +$warning-color-4: #{genColor($warning-color, 4, dark)}; +$warning-color-5: #{genColor($warning-color, 5, dark)}; +$warning-color-6: #{genColor($warning-color, 6, dark)}; +$warning-color-7: #{genColor($warning-color, 7, dark)}; +$warning-color-8: #{genColor($warning-color, 8, dark)}; +$warning-color-9: #{genColor($warning-color, 9, dark)}; +$warning-color-10: #{genColor($warning-color, 10, dark)}; + +$success-color-1: #{genColor($success-color, 1, dark)}; // 浅色/白底悬浮 +$success-color-2: #{genColor($success-color, 2, dark)}; // 文字禁用 +$success-color-3: #{genColor($success-color, 3, dark)}; // 一般禁用 +$success-color-4: #{genColor($success-color, 4, dark)}; // 特殊场景 +$success-color-5: #{genColor($success-color, 5, dark)}; // 悬浮 +$success-color-6: #{genColor($success-color, 6, dark)}; // 常规 +$success-color-7: #{genColor($success-color, 7, dark)}; // 点击 +$success-color-8: #{genColor($success-color, 8, dark)}; +$success-color-9: #{genColor($success-color, 9, dark)}; +$success-color-10: #{genColor($success-color, 10, dark)}; + +// $gray-1: #f3f3f3; +// $gray-2: #eeeeee; +// $gray-3: #e7e7e7; +// $gray-4: #dcdcdc; +// $gray-5: #c5c5c5; +// $gray-6: #a6a6a6; +// $gray-7: #8b8b8b; +// $gray-8: #777777; +// $gray-9: #5e5e5e; +// $gray-10: #4b4b4b; +// $gray-11: #383838; +// $gray-12: #2c2c2c; +// $gray-13: #242424; +// $gray-14: #181818; + +// 暗色模式的灰度 +$gray-1: #181818; // 最深 +$gray-2: #242424; +$gray-3: #2c2c2c; +$gray-4: #383838; +$gray-5: #4b4b4b; +$gray-6: #5e5e5e; +$gray-7: #777777; +$gray-8: #8b8b8b; +$gray-9: #a6a6a6; +$gray-10: #c5c5c5; +$gray-11: #dcdcdc; +$gray-12: #e7e7e7; +$gray-13: #eeeeee; +$gray-14: #f3f3f3; // 最浅 + +$text-color-1: rgba(255,255,255,0.85); //primary +$text-color-2: rgba(255,255,255,0.65); //secondary +$text-color-3: rgba(255,255,255,0.45); //placeholder +$text-color-4: rgba(255,255,255,0.25); //disabled + +// 容器 +$bg-color-page: $gray-1;//#000000; // 整体背景色 布局 +$bg-color-container: $gray-2;//#1d1d1d; // 一级容器背景 组件 +$bg-color-elevated: $gray-2;//#1f1f1f; // 二级容器背景 浮层 +$bg-color-spotlight: $gray-5; // 引起注意的如 Tooltip +$bg-color-mask: rgba(0, 0, 0, 0.65); // 蒙层 + +// 填充 +$fill-1: rgba(255,255,255,0.18); +$fill-2: rgba(255,255,255,0.12); +$fill-3: rgba(255,255,255,0.08); +$fill-4: rgba(255,255,255,0.04); + +// 描边 +$border-color-1: $gray-3;//#{getSolidColor(#000, 26%)}; //#424242; // 浅色 +$border-color-2: $gray-4;//#{getSolidColor(#000, 19%)}; //#303030; // 一般 +$border-color-3: $gray-5;//#{getSolidColor(#000, 15%)}; //$gray-4; // 深/悬浮 +$border-color-4: $gray-6;//#{getSolidColor(#000, 12%)}; //$gray-6; // 重/按钮描边 + + +@mixin theme-dark { + // 蓝色系 + --l-blue-1: #{$blue-1}; + --l-blue-2: #{$blue-2}; + --l-blue-3: #{$blue-3}; + --l-blue-4: #{$blue-4}; + --l-blue-5: #{$blue-5}; + --l-blue-6: #{$blue-6}; + --l-blue-7: #{$blue-7}; + --l-blue-8: #{$blue-8}; + --l-blue-9: #{$blue-9}; + --l-blue-10: #{$blue-10}; + + --l-info-color-1: #{$info-color-1}; + --l-info-color-2: #{$info-color-2}; + --l-info-color-3: #{$info-color-3}; + --l-info-color-4: #{$info-color-4}; + --l-info-color-5: #{$info-color-5}; + --l-info-color-6: #{$info-color-6}; + --l-info-color-7: #{$info-color-7}; + --l-info-color-8: #{$info-color-8}; + --l-info-color-9: #{$info-color-9}; + --l-info-color-10: #{$info-color-10}; + + // 主色系 + --l-primary-color-1: #{$primary-color-1}; + --l-primary-color-2: #{$primary-color-2}; + --l-primary-color-3: #{$primary-color-3}; + --l-primary-color-4: #{$primary-color-4}; + --l-primary-color-5: #{$primary-color-5}; + --l-primary-color-6: #{$primary-color-6}; + --l-primary-color-7: #{$primary-color-7}; + --l-primary-color-8: #{$primary-color-8}; + --l-primary-color-9: #{$primary-color-9}; + --l-primary-color-10: #{$primary-color-10}; + + // 错误色系 + --l-error-color-1: #{$error-color-1}; + --l-error-color-2: #{$error-color-2}; + --l-error-color-3: #{$error-color-3}; + --l-error-color-4: #{$error-color-4}; + --l-error-color-5: #{$error-color-5}; + --l-error-color-6: #{$error-color-6}; + --l-error-color-7: #{$error-color-7}; + --l-error-color-8: #{$error-color-8}; + --l-error-color-9: #{$error-color-9}; + --l-error-color-10: #{$error-color-10}; + + // 警告色系 + --l-warning-color-1: #{$warning-color-1}; + --l-warning-color-2: #{$warning-color-2}; + --l-warning-color-3: #{$warning-color-3}; + --l-warning-color-4: #{$warning-color-4}; + --l-warning-color-5: #{$warning-color-5}; + --l-warning-color-6: #{$warning-color-6}; + --l-warning-color-7: #{$warning-color-7}; + --l-warning-color-8: #{$warning-color-8}; + --l-warning-color-9: #{$warning-color-9}; + --l-warning-color-10: #{$warning-color-10}; + + // 成功色系 + --l-success-color-1: #{$success-color-1}; + --l-success-color-2: #{$success-color-2}; + --l-success-color-3: #{$success-color-3}; + --l-success-color-4: #{$success-color-4}; + --l-success-color-5: #{$success-color-5}; + --l-success-color-6: #{$success-color-6}; + --l-success-color-7: #{$success-color-7}; + --l-success-color-8: #{$success-color-8}; + --l-success-color-9: #{$success-color-9}; + --l-success-color-10: #{$success-color-10}; + + // 灰色系 + --l-gray-1: #{$gray-1}; + --l-gray-2: #{$gray-2}; + --l-gray-3: #{$gray-3}; + --l-gray-4: #{$gray-4}; + --l-gray-5: #{$gray-5}; + --l-gray-6: #{$gray-6}; + --l-gray-7: #{$gray-7}; + --l-gray-8: #{$gray-8}; + --l-gray-9: #{$gray-9}; + --l-gray-10: #{$gray-10}; + --l-gray-11: #{$gray-11}; + --l-gray-12: #{$gray-12}; + --l-gray-13: #{$gray-13}; + --l-gray-14: #{$gray-14}; + + // 文字颜色 + --l-text-color-1: #{$text-color-1}; + --l-text-color-2: #{$text-color-2}; + --l-text-color-3: #{$text-color-3}; + --l-text-color-4: #{$text-color-4}; + + // 容器背景色 + --l-bg-color-page: #{$bg-color-page}; + --l-bg-color-container: #{$bg-color-container}; + --l-bg-color-elevated: #{$bg-color-elevated}; + --l-bg-color-spotlight: #{$bg-color-spotlight}; + --l-bg-color-mask: #{$bg-color-mask}; + + // 填充色 + --l-fill-1: #{$fill-1}; + --l-fill-2: #{$fill-2}; + --l-fill-3: #{$fill-3}; + --l-fill-4: #{$fill-4}; + + // 描边色 + --l-border-color-1: #{$border-color-1}; + --l-border-color-2: #{$border-color-2}; + --l-border-color-3: #{$border-color-3}; + --l-border-color-4: #{$border-color-4}; + + // loading + --l-loading-text-color: #{$text-color-3}; + + // load-more + --l-load-more-text-color: #{$text-color-3}; + --l-load-more-color: #{$text-color-4}; + + // 按钮 + --l-button-default-solid-text-color: #000; + --l-button-default-border-color: #{$gray-5}; + --l-button-default-color: #{$gray-14}; + --l-button-default-light-color: #{$gray-4}; + --l-button-default-light-hover-color: #{$gray-5}; + --l-button-primary-light-color: #{$primary-color-2}; + --l-button-primary-light-hover-color: #{$primary-color-3}; + --l-button-danger-light-color: #{$error-color-2}; + --l-button-danger-light-hover-color: #{$error-color-3}; + --l-button-warning-light-color: #{$warning-color-2}; + --l-button-warning-light-hover-color: #{$warning-color-3}; + --l-button-success-light-color: #{$success-color-2}; + --l-button-success-light-hover-color: #{$success-color-3}; + --l-button-info-light-color: #{$info-color-1}; + --l-button-info-light-hover-color: #{$info-color-2}; + --l-button-primary-color: #{$primary-color-6}; + --l-button-danger-color: #{$error-color-6}; + --l-button-warning-color: #{$warning-color-6}; + --l-button-info-color: #{$info-color-6}; + + // 遮罩 + // --l-overlay-bg-color: #{$bg-color-mask}; + // 弹窗 + --l-popup-bg-color: #{$bg-color-elevated}; + --l-popup-close-icon-color: #{$text-color-2}; + + // 单元格 + --l-cell-group-title-color: #{$text-color-3}; + --l-cell-group-border-color: #{$border-color-3}; + --l-cell-bg-color: #{$bg-color-container}; + --l-cell-hover-color: #{$gray-3}; + --l-cell-border-color: #{$border-color-2}; + --l-cell-note-color: #{$text-color-3}; + --l-cell-description-color: #{$text-color-2}; + --l-cell-title-color: #{$text-color-1}; + --l-cell-right-icon-color: #{$text-color-3}; + + // 步进器 + --l-stepper-button-bg-color: #{$gray-4}; + --l-stepper-input-disabled-bg: #{$gray-3}; + --l-stepper-input-color: #{$text-color-1}; + --l-stepper-input-disabled-color: #{$text-color-4}; + --l-stepper-border-color: #{$gray-4}; + + // tabbar + --l-tabbar-bg-color: #{$bg-color-container}; + --l-tabbar-border-color: #{$border-color-1}; + --l-tabbar-color: #{$text-color-1}; + --l-tabbar-active-color: #{$primary-color-6}; + --l-tabbar-active-bg-color: #{$primary-color-1}; + + // link + --l-link-default-color: #{$text-color-1}; + + // image + --l-image-loading-bg-color: #{$fill-3}; + --l-image-color: #{$text-color-3}; + + // divider 分割线 + --l-divider-color: #{$border-color-2}; + --l-divider-text-color: #{$text-color-2}; + + // card 卡片 + --l-card-bg-color: #{$bg-color-container}; + --l-card-title-color: #{$text-color-1}; + --l-card-extra-color: #{$text-color-3}; + --l-card-note-color: #{$text-color-3}; + --l-card-border-color: #{$border-color-2}; + + // grid 宫格 + --l-grid-item-bg-color: #{$bg-color-container}; + --l-grid-item-image-bg-color: #{$fill-4}; + --l-grid-item-text-color: #{$text-color-1}; + --l-grid-item-hover-bg-color: #{$fill-3}; + --l-grid-item-description-color: #{$text-color-3}; + --l-grid-item-border-color: #{$border-color-2}; + --l-grid-item-icon-color: #{$text-color-1}; + + // cascader 级联 + --l-cascader-title-color: #{$text-color-1}; + --l-cascader-bg-color: #{$bg-color-container}; + --l-cascader-cell-title-color: #{$text-color-1}; + --l-cascader-disabled-color: #{$text-color-3}; + --l-cascader-options-title-color: #{$text-color-3}; + --l-cascader-close-icon-color: #{$text-color-2}; + + // tabs 标签页 + --l-tab-nav-bg-color: #{$bg-color-container}; + --l-tab-content-bg-color: #{$bg-color-container}; + --l-tab-split-color: #{$border-color-1}; + --l-tab-item-color: #{$text-color-2}; + --l-tab-item-disabled-color: #{$text-color-4}; + + // checkbox 复选框 + --l-checkbox-border-icon-color: #{$gray-8}; + --l-checkbox-icon-bg-color: #{$bg-color-container}; + --l-checkbox-text-color: #{$text-color-1}; + --l-checkbox-icon-disabled-bg-color: #{$gray-3}; + --l-checkbox-icon-disabled-color: #{$gray-6}; + + // radio 单选框 + --l-radio-border-icon-color: #{$gray-8}; + --l-radio-icon-bg-color: #{$bg-color-container}; + --l-radio-text-color: #{$text-color-1}; + --l-radio-icon-disabled-bg-color: #{$gray-3}; + --l-radio-icon-disabled-color: #{$gray-6}; + + // search 搜索 + --l-search-bg-color: #{$fill-3}; + --l-search-icon-color: #{$text-color-4}; + --l-search-clear-icon-color: #{$text-color-4}; + --l-search-text-color: #{$text-color-1}; + --l-search-label-color: #{$text-color-1}; + --l-search-placeholder-color: #{$text-color-3}; + + // switch + --l-switch-checked-disabled-color: #{$primary-color-3}; + --l-switch-unchecked-color: #{$gray-5}; + --l-switch-unchecked-disabled-color: #{$gray-4}; + + // input 输入框 + --l-input-text-color: #{$text-color-1}; + --l-input-tips-color: #{$text-color-3}; + --l-input-bg-color: #{$bg-color-container}; + --l-input-border-color: #{$border-color-2}; + --l-input-placeholder-text-color: #{$text-color-3}; + --l-input-prefix-icon-color: #{$text-color-1}; + --l-input-suffix-icon-color: #{$text-color-3}; + --l-input-label-text-color: #{$text-color-1}; + --l-input-suffix-text-color: #{$text-color-1}; + --l-input-disabled-text-color: #{$text-color-4}; + --l-input-disabled-bg-color: #{$fill-3}; + --l-input-border-color: #{$border-color-2}; + + // textarea + --l-textarea-bg-color: #{$bg-color-container}; + --l-textarea-placeholder-color: #{$text-color-3}; + --l-textarea-text-color: #{$text-color-1}; + --l-textarea-label-color: #{$text-color-1}; + --l-textarea-indicator-text-color: #{$text-color-3}; + --l-textarea-border-color: #{$border-color-2}; + --l-textarea-disabled-text-color: #{$text-color-4}; + + // upload + --l-upload-bg-color: #{$gray-4}; + --l-upload-add-bg-color: #{$gray-4}; + --l-upload-add-color: #{$text-color-3}; + + // picker + --l-picker-bg-color: #{$bg-color-container}; + --l-picker-cancel-color: #{$text-color-2}; + --l-picker-title-color: #{$text-color-1}; + --l-picker-item-active-color: #{$text-color-1}; + --l-picker-mask-top-color: #{$gray-2}; + --l-picker-loading-mask-color: rgba(0,0,0,.6); + --l-picker-item-color: #{$text-color-1}; + --l-picker-indicator-bg-color: #{$fill-3}; + + // empty + --l-empty-opacity: 0.6; + + // segmented + --l-segmented-bg-color: #{$gray-4}; + --l-segmented-text-color: #{$text-color-2}; + --l-segmented-active-bg-color: #{$gray-5}; + + // keyboard + --l-keyboard-bg-color: #{$bg-color-elevated}; + --l-keyboard-color: #{$text-color-1}; + --l-keyboard-key-bg-color: #{$gray-5}; + --l-keyboard-key-hover-bg-color: #{$gray-4}; + --l-keyboard-icon-bg-color: #{$gray-5}; + --l-keyboard-icon-color: #{$text-color-3}; + + // code-input + --l-code-input-bg-color: #{$gray-4}; + --l-code-input-active-bg-color: #{$gray-5}; + --l-code-input-info-color: #{$text-color-3}; + --l-code-input-dot-color: #{$text-color-1}; + --l-code-input-text-color: #{$text-color-1}; + --l-code-input-cursor-color: #{$text-color-1}; + --l-code-input-active-border-color: #{$gray-6}; + + // steps + --l-step-description-color: #{$text-color-3}; + --l-step-wait-circle-bg-color: #{$gray-4}; + --l-step-wait-circle-color: #{$text-color-3}; + --l-step-wait-title-color: #{$text-color-3}; + --l-step-wait-icon-color: #{$text-color-3}; + --l-step-wait-dot-border-color: #{$gray-5}; + --l-step-line-color: #{$gray-5}; + --l-step-finish-title-color: #{$text-color-1}; + --l-step-finish-circle-bg-color: #{$primary-color-2}; + --l-step-error-circle-bg-color: #{$error-color-2}; + + // date-strip + --l-date-strip-bg-color: #{$bg-color-container}; + --l-date-strip-color: #{$text-color-1}; + --l-date-strip-prefix-color: #{$text-color-3}; + --l-date-strip-color: #{$text-color-2}; + + // slider + --l-slider-rail-color: #{$gray-5}; + --l-slider-thumb-border-color: #{$gray-11}; + + // form + --l-form-item-border-color: #{$border-color-2}; + --l-form-bg-color: #{$bg-color-container}; + --l-form-item-label-color: #{$text-color-1}; + + // color-picker + --l-color-picker-color: #{$text-color-1}; + --l-color-picker-label-color: #{$text-color-2}; + --l-color-picker-field-bg-color: #{$fill-2}; + --l-color-picker-divider-color: #{$border-color-2}; + + // calendar + --l-calendar-bg-color: #{$bg-color-container}; + --l-calendar-title-color: #{$text-color-1}; + --l-calendar-days-color: #{$text-color-2}; + --l-calendar-item-color: #{$text-color-1}; + --l-calendar-item-disabled-color: #{$text-color-4}; + --l-calendar-item-centre-color: #{$primary-color-2}; + --l-calendar-month-mark-color: #{$fill-3}; + --l-calendar-switch-mode-icon-color: #{$text-color-2}; + --l-calendar-switch-mode-icon-disabled-color: #{$text-color-4}; + --l-calendar-header-border-color: #{$border-color-2}; + + // loading + --l-loading-text-color: #{$text-color-3}; + + // dialog + --l-dialog-title-color: #{$text-color-1}; + --l-dialog-content-color: #{$text-color-2}; + --l-dialog-close-color: #{$text-color-3}; + // --l-dialog-bg-color: #{$bg-color-container}; + --l-dialog-bg-color: #{$gray-3}; + --l-dialog-split-color: #{$border-color-2}; + + // action-sheet + --l-action-sheet-item-disabled-color: #{$text-color-4}; + --l-action-sheet-hover-color: #{$gray-3}; + --l-action-sheet-border-color: #{$border-color-1}; + --l-action-sheet-gap-color: #{$bg-color-page}; + --l-action-sheet-color: #{$text-color-1}; + --l-action-sheet-description-color: #{$text-color-3}; + --l-action-sheet-cancel-color: #{$text-color-1}; + --l-action-sheet-cancel-bg-color: #{$bg-color-container}; + --l-action-sheet-image-bg-color: #{$fill-3}; + --l-action-sheet-title-color: #{$text-color-1}; + --l-action-sheet-close-btn-color: #{$text-color-1}; + + // sorter + --l-sorter-color: #{$text-color-1}; + + // floating-panel + --l-floating-panel-bg-color: #{$bg-color-elevated}; + --l-floating-panel-bar-color: #{$fill-1}; + + // dropdown-menu + --l-dropdown-menu-color: #{$text-color-1}; + --l-dropdown-menu-bg-color: #{$bg-color-container}; + --l-dropdown-menu-border-color: #{$border-color-1}; + --l-dropdown-menu-disabled-color: #{$border-color-3}; + --l-dropdown-menu-arrow-color: #{$gray-6}; + --l-dropdown-menu-arrow-active-color: #{$gray-4}; + --l-dropdown-item-cell-title-color: #{$text-color-1}; + + // pull-refresh + --l-pull-refresh-refresher-color: #{$text-color-2}; + + // circle + --l-circle-trail-color: #{$gray-5}; + + // collapse + --l-collapse-panel-bg-color: #{$bg-color-container}; + --l-collapse-content-text-color: #{$text-color-1}; + --l-collapse-right-icon-color: #{$text-color-4}; + --l-collapse-border-color: #{$border-color-2}; + + // count-down + --l-count-down-text-color: #{$text-color-1}; + + // empty + --l-empty-description-color: #{$text-color-3}; + // progress + --l-progress-trail-color: #{$gray-5}; + --l-progress-text-color: #{$text-color-2}; + + // tag + // --l-tag-default-solid-text-color: #000; + --l-tag-text-color: #{$gray-14}; + --l-tag-default-color: #{$gray-6}; + --l-tag-default-light-color: #{$gray-4}; + --l-tag-default-border-color: #{$gray-5}; + --l-tag-primary-light-color: #{$primary-color-2}; + --l-tag-danger-light-color: #{$error-color-2}; + --l-tag-warning-light-color: #{$warning-color-2}; + --l-tag-success-light-color: #{$success-color-2}; + + // amount + --l-amount-color: #{$text-color-1}; + + // avatar + --l-avatar-bg-color: #{$primary-color-1}; + --l-avatar-border-color: #{$gray-2}; + + // highlight + --l-highlight-normal-color: #{$text-color-1}; + + // text-ellipsis + --l-text-ellipsis-color: #{$text-color-1}; + + // read-more + --l-read-more-handle-color: #{$text-color-2}; + --l-read-more-read-start: rgba(36, 36, 36, 0.9); + --l-read-more-read-end: rgba(36, 36, 36, 0.3); + --l-read-more-mask-bg-color: linear-gradient( + to top, + rgba(0,0,0,0), + rgba(0,0,0,1), + ); + // notice-bar + --l-notice-bar-info-bg-color: #{$info-color-1}; + --l-notice-bar-success-bg-color: #{$success-color-1}; + --l-notice-bar-warning-bg-color: #{$warning-color-1}; + --l-notice-bar-danger-bg-color: #{$error-color-1}; + + // scrollx + --l-scrollx-track-color: #{$gray-4}; + + // dateformat + --l-dateformat-color: #{$text-color-1}; + + // footer + --l-footer-text-color: #{$text-color-3}; + --l-footer-link-dividing-line-color: #{$text-color-3}; + --l-footer-logo-title-color: #{$text-color-1}; + + // tree + --l-tree-node-text-color: #{$text-color-1}; + --l-tree-arrow-color: #{$gray-6}; + + // table + --l-table-bg-color: #{$bg-color-container}; + --l-table-border-color: #{$border-color-2}; + --l-table-td-fixed-bg-color: #{$bg-color-container}; + --l-table-tr-fixed-bg-color: #{$bg-color-container}; + + // sidebar + --l-sidebar-bg-color: #{$gray-3}; + --l-sidebar-selected-bg-color: #{$bg-color-container}; + --l-sidebar-text-color: #{$text-color-2}; + --l-sidebar-disabled-text-color: #{$text-color-4}; + + // back-top + --l-back-top-bg-color: #{$bg-color-elevated}; + --l-back-top-border-color: #{$border-color-2}; + --l-back-top-text-color: #{$text-color-2}; + + // navbar + --l-navbar-bg-color: #{$bg-color-container}; + --l-navbar-color: #{$text-color-1}; + --l-navbar-capsule-border-color: #{$border-color-2}; + + // pagination + --l-pagination-bg-color: #{$gray-4}; + --l-pagination-disabled-bg-color: #{$gray-3}; + --l-pagination-hover-bg-color: #{$gray-5}; + --l-pagination-text-color: #{$text-color-2}; + --l-pagination-disabled-color: #{$text-color-4}; + --l-pagination-simple-text-color: #{$text-color-1}; + + // indexes + --l-indexes-sidebar-color: #{$text-color-1}; + --l-indexes-anchor-color: #{$text-color-1}; + --l-indexes-anchor-bg-color: #{$gray-4}; + --l-indexes-anchor-active-bg-color: #{$gray-4}; + --l-indexes-sidebar-tips-bg-color: #{$primary-color-1}; + + // typing + --l-typing-bg-color: #{$bg-color-container}; + --l-typing-text-color: #{$text-color-1}; + + // fit-swiper + --l-fit-swiper-indicator-color: #{$gray-5}; +} diff --git a/uni_modules/lime-style/theme/default.scss b/uni_modules/lime-style/theme/default.scss new file mode 100644 index 0000000..90aaba7 --- /dev/null +++ b/uni_modules/lime-style/theme/default.scss @@ -0,0 +1,181 @@ +@import '../mixins/create.scss'; +@import '../color/colorPalette.scss'; +@import '../color/colors.scss'; + +$blue-1: genColor($blue, 1); +$blue-2: genColor($blue, 2); +$blue-3: genColor($blue, 3); +$blue-4: genColor($blue, 4); +$blue-5: genColor($blue, 5); +$blue-6: $blue; +$blue-7: genColor($blue, 7); +$blue-8: genColor($blue, 8); +$blue-9: genColor($blue, 9); +$blue-10: genColor($blue, 10); + +$info-color-1: genColor($info-color, 1); +$info-color-2: genColor($info-color, 2); +$info-color-3: genColor($info-color, 3); +$info-color-4: genColor($info-color, 4); +$info-color-5: genColor($info-color, 5); +$info-color-6: $info-color; +$info-color-7: genColor($info-color, 7); +$info-color-8: genColor($info-color, 8); +$info-color-9: genColor($info-color, 9); +$info-color-10: genColor($info-color, 10); + +$primary-color-1: create-var('primary-color-1', genColor($primary-color, 1)); // 浅色/白底悬浮 +$primary-color-2: create-var('primary-color-2', genColor($primary-color, 2)); // 文字禁用 +$primary-color-3: create-var('primary-color-3', genColor($primary-color, 3)); // 一般禁用 +$primary-color-4: create-var('primary-color-4', genColor($primary-color, 4)); // 特殊场景 禁用 +$primary-color-5: create-var('primary-color-5', genColor($primary-color, 5)); // 悬浮 +$primary-color-6: create-var('primary-color-6', $primary-color); // 常规 +$primary-color-7: create-var('primary-color-7', genColor($primary-color, 7)); // 点击 +$primary-color-8: create-var('primary-color-8', genColor($primary-color, 8)); // +$primary-color-9: create-var('primary-color-9', genColor($primary-color, 9)); +$primary-color-10: create-var('primary-color-10', genColor($primary-color, 10)); + +$error-color-1: create-var('error-color-1', genColor($error-color, 1)); +$error-color-2: create-var('error-color-2', genColor($error-color, 2)); +$error-color-3: create-var('error-color-3', genColor($error-color, 3)); +$error-color-4: create-var('error-color-4', genColor($error-color, 4)); +$error-color-5: create-var('error-color-5', genColor($error-color, 5)); +$error-color-6: create-var('error-color-6', $error-color); +$error-color-7: create-var('error-color-7', genColor($error-color, 7)); +$error-color-8: create-var('error-color-8', genColor($error-color, 8)); +$error-color-9: create-var('error-color-9', genColor($error-color, 9)); +$error-color-10: create-var('error-color-10', genColor($error-color, 10)); + +$warning-color-1: create-var('warning-color-1', genColor($warning-color, 1)); +$warning-color-2: create-var('warning-color-2', genColor($warning-color, 2)); +$warning-color-3: create-var('warning-color-3', genColor($warning-color, 3)); +$warning-color-4: create-var('warning-color-4', genColor($warning-color, 4)); +$warning-color-5: create-var('warning-color-5', genColor($warning-color, 5)); +$warning-color-6: create-var('warning-color-6', $warning-color); +$warning-color-7: create-var('warning-color-7', genColor($warning-color, 7)); +$warning-color-8: create-var('warning-color-8', genColor($warning-color, 8)); +$warning-color-9: create-var('warning-color-9', genColor($warning-color, 9)); +$warning-color-10: create-var('warning-color-10', genColor($warning-color, 10)); + +$success-color-1: create-var('success-color-1', genColor($success-color, 1)); // 浅色/白底悬浮 +$success-color-2: create-var('success-color-2', genColor($success-color, 2)); // 文字禁用 +$success-color-3: create-var('success-color-3', genColor($success-color, 3)); // 一般禁用 +$success-color-4: create-var('success-color-4', genColor($success-color, 4)); // 特殊场景 +$success-color-5: create-var('success-color-5', genColor($success-color, 5)); // 悬浮 +$success-color-6: create-var('success-color-6', $success-color); // 常规 +$success-color-7: create-var('success-color-7', genColor($success-color, 7)); // 点击 +$success-color-8: create-var('success-color-8', genColor($success-color, 8)); +$success-color-9: create-var('success-color-9', genColor($success-color, 9)); +$success-color-10: create-var('success-color-10', genColor($success-color, 10)); + +$white: create-var('white', #fff); +$gray-1: create-var('gray-1', #f3f3f3); +$gray-2: create-var('gray-2', #eeeeee); +$gray-3: create-var('gray-3', #e7e7e7); +$gray-4: create-var('gray-4', #dcdcdc); +$gray-5: create-var('gray-5', #c5c5c5); +$gray-6: create-var('gray-6', #a6a6a6); +$gray-7: create-var('gray-7', #8b8b8b); +$gray-8: create-var('gray-8', #777777); +$gray-9: create-var('gray-9', #5e5e5e); +$gray-10: create-var('gray-10', #4b4b4b); +$gray-11: create-var('gray-11', #383838); +$gray-12: create-var('gray-12', #2c2c2c); +$gray-13: create-var('gray-13', #242424); +$gray-14: create-var('gray-14', #181818); +$black: create-var('black', #000); + +// $text-color-1: create-var('text-color-1', rgba(0,0,0,0.88)); //primary +// $text-color-2: create-var('text-color-2', rgba(0,0,0,0.65)); //secondary +// $text-color-3: create-var('text-color-3', rgba(0,0,0,0.45)); //placeholder +// $text-color-4: create-var('text-color-4', rgba(0,0,0,0.25)); //disabled +$text-color-1: create-var('text-color-1', #000000E0); // primary (rgba(0,0,0,0.88)) +$text-color-2: create-var('text-color-2', #000000A6); // secondary (rgba(0,0,0,0.65)) +$text-color-3: create-var('text-color-3', #00000073); // placeholder (rgba(0,0,0,0.45)) +$text-color-4: create-var('text-color-4', #00000040); // disabled (rgba(0,0,0,0.25)) + +// 容器 +$bg-color-page: create-var('bg-color-page', $gray-1); // 整体背景色 布局 +$bg-color-container: create-var('bg-color-container', #fff); // 一级容器背景 组件 +$bg-color-elevated: create-var('bg-color-elevated', #fff); // 二级容器背景 浮层 +$bg-color-spotlight: create-var('bg-color-spotlight', rgba(0, 0, 0, 0.85)); // 引起注意的如 Tooltip +$bg-color-mask: create-var('bg-color-mask', rgba(0, 0, 0, 0.45)); // 蒙层 + +// 填充 +// $fill-1: create-var('fill-1', rgba(0, 0, 0, 0.15)); +// $fill-2: create-var('fill-2', rgba(0, 0, 0, 0.06)); +// $fill-3: create-var('fill-3', rgba(0, 0, 0, 0.04)); +// $fill-4: create-var('fill-4', rgba(0, 0, 0, 0.02)); +$fill-1: create-var('fill-1', #00000026); // rgba(0,0,0,0.15) +$fill-2: create-var('fill-2', #0000000F); // rgba(0,0,0,0.06) +$fill-3: create-var('fill-3', #0000000A); // rgba(0,0,0,0.04) +$fill-4: create-var('fill-4', #00000005); // rgba(0,0,0,0.02) + + +// 描边 +$border-color-1: create-var('border-color-1', $gray-2); // 浅色 +$border-color-2: create-var('border-color-2', $gray-3); // 一般 +$border-color-3: create-var('border-color-3', $gray-4); // 深/悬浮 +$border-color-4: create-var('border-color-4', $gray-6); // 重/按钮描边 + + +$alpha-disabled: create-var('alpha-disabled', 0.5); +$alpha-pressed: create-var('alpha-pressed', 0.07); + +// 投影 +/* #ifndef UNI-APP-X && APP */ +$shadow-1: create-var( + shadow-1, + 0 1px 10px rgba(0, 0, 0, 0.05), + 0 4px 5px rgba(0, 0, 0, 0.08), + 0 2px 4px -1px rgba(0, 0, 0, 0.12) +); + +$shadow-2: create-var( + 'shadow-2', + 0 1px 10px rgba(0, 0, 0, 0.05), + 0 4px 5px rgba(0, 0, 0, 0.08), + 0 2px 4px -1px rgba(0, 0, 0, 0.12) +); +$shadow-3: create-var( + shadow-3, + 0 6px 30px 5px rgba(0, 0, 0, 0.05), + 0 16px 24px 2px rgba(0, 0, 0, 0.04), + 0 8px 10px -5px rgba(0, 0, 0, 0.08) +); + +/* #endif */ +/* #ifdef UNI-APP-X && APP */ +$shadow-1: create-var( + shadow-1, + 0 1px 10px rgba(0, 0, 0, 0.05) +); +$shadow-2: create-var( + 'shadow-2', + 0 1px 10px rgba(0, 0, 0, 0.05) +); +$shadow-3: create-var( + shadow-3, + /* #ifdef APP-HARMONY + 0 6px 30px 5px $gray-3 + /* #endif */ + /* #ifndef APP-HARMONY + 0 6px 30px 5px rgba(0, 0, 0, 0.05) + /* #endif */ + +); +/* #endif */ +$shadow-4: create-var(shadow-4, 0 2px 8px 0 rgba(0, 0, 0, .06)); + +// 基础颜色的扩展 用于 聚焦 / 禁用 / 点击 等状态 +$primary-color-focus: create-var('primary-color-focus', $primary-color-1);// focus态,包括鼠标和键盘 +$primary-color-active: create-var('primary-color-active', $primary-color-8);// 点击态 +$primary-color-disabled: create-var('primary-color-disabled', $primary-color-3); +$primary-color-light: create-var('primary-color-light', $primary-color-1); // 浅色的选中态 +$primary-color-light-active: create-var('primary-color-light-active', $primary-color-2); // 浅色的选中态 + +$primary-color: create-var(primary-color, $primary-color); +$error-color: create-var(error-color, $error-color); +$warning-color: create-var(warning-color, $warning-color); +$success-color: create-var(success-color, $success-color); +$info-color: create-var(info-color, $info-color); \ No newline at end of file diff --git a/uni_modules/lime-style/token/dark.uts b/uni_modules/lime-style/token/dark.uts new file mode 100644 index 0000000..bb373af --- /dev/null +++ b/uni_modules/lime-style/token/dark.uts @@ -0,0 +1,67 @@ +import { TinyColor, generate, LGenerateOptions } from '@/uni_modules/lime-color'; +import { getAlphaColor, getSolidColor, generateColorPalettes } from './shared' +import { SeedToken } from './interface' +// #ifndef UNI-APP-X +export type UTSJSONObject = Record +const UTSJSONObject = Object +// #endif + +export function generateNeutralColorPalettes( + bgBaseColor : string | null, + textBaseColor : string | null) : UTSJSONObject { + const colorBgBase = bgBaseColor ?? '#000'; + const colorTextBase = textBaseColor ?? '#fff'; + + return { + 'bgColorBase': colorBgBase, + 'textColorBase': colorTextBase, + + 'textColor1': getAlphaColor(colorTextBase, 0.85), + 'textColor2': getAlphaColor(colorTextBase, 0.65), + 'textColor3': getAlphaColor(colorTextBase, 0.45), + 'textColor4': getAlphaColor(colorTextBase, 0.25), + + 'fill1': getAlphaColor(colorTextBase, 0.18), + 'fill2': getAlphaColor(colorTextBase, 0.12), + 'fill3': getAlphaColor(colorTextBase, 0.08), + 'fill4': getAlphaColor(colorTextBase, 0.04), + + 'bgColorElevated': getSolidColor(colorBgBase, 12), + 'bgColorContainer': getSolidColor(colorBgBase, 8), + 'bgColorPage': getSolidColor(colorBgBase, 0), + 'bgColorSpotlight': getSolidColor(colorBgBase, 26), + // 'bgColor5': getAlphaColor(colorTextBase, 0.04), + 'bgColorMask': getAlphaColor(colorBgBase, 0.45), + 'bgColorBlur': getAlphaColor(colorTextBase, 0.04), + + 'borderColor1': getSolidColor(colorBgBase, 26), + 'borderColor2': getSolidColor(colorBgBase, 19) + } +} + + +export function genColorMapToken(token : SeedToken) : UTSJSONObject { + const colorPrimaryBase = token.primaryColor + const colorSuccessBase = token.successColor + const colorWarningBase = token.warningColor + const colorErrorBase = token.errorColor + const colorInfoBase = token.infoColor + const colorBgBase = token.bgColorBase + const colorTextBase = token.textColorBase + + const primaryColors = generateColorPalettes(colorPrimaryBase, 'primaryColor', 'dark'); + const successColors = generateColorPalettes(colorSuccessBase, 'successColor', 'dark'); + const warningColors = generateColorPalettes(colorWarningBase, 'warningColor', 'dark'); + const errorColors = generateColorPalettes(colorErrorBase, 'errorColor', 'dark'); + const infoColors = generateColorPalettes(colorInfoBase, 'infoColor', 'dark'); + const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase); + + return UTSJSONObject.assign( + {}, + primaryColors, + successColors, + warningColors, + errorColors, + infoColors, + neutralColors) +} \ No newline at end of file diff --git a/uni_modules/lime-style/token/genFontMapToken.uts b/uni_modules/lime-style/token/genFontMapToken.uts new file mode 100644 index 0000000..ccd7256 --- /dev/null +++ b/uni_modules/lime-style/token/genFontMapToken.uts @@ -0,0 +1,49 @@ +// import type { FontMapToken } from '../../interface'; +import { getFontSizes } from './genFontSizes'; + +export const genFontMapToken = (fontSize : number | null) : UTSJSONObject => { + if (fontSize == null) return {} + const fontSizePairs = getFontSizes(fontSize); + const fontSizes = fontSizePairs.map((pair) : number => pair.size); + const lineHeights = fontSizePairs.map((pair) : number => pair.lineHeight); + + const fontSizeXS = fontSizes[0]; + const fontSizeSM = fontSizes[1]; + const fontSizeMD = fontSizes[3]; + const fontSizeLG = fontSizes[4]; + + const lineHeight = lineHeights[2]; + const lineHeightSM = lineHeights[1]; + const lineHeightMD = lineHeights[3]; + const lineHeightLG = lineHeights[4]; + + return { + fontSize, + fontSizeXS, + fontSizeSM, + fontSizeMD, + fontSizeLG, + fontSizeXL: fontSizes[5], + + fontSizeHeading1: fontSizes[7], + fontSizeHeading2: fontSizes[6], + fontSizeHeading3: fontSizes[5], + fontSizeHeading4: fontSizes[4], + fontSizeHeading5: fontSizes[3], + + lineHeight, + lineHeightLG, + lineHeightMD, + lineHeightSM, + + fontHeight: Math.round(lineHeight * fontSizeMD), + fontHeightLG: Math.round(lineHeightLG * fontSizeLG), + fontHeightSM: Math.round(lineHeightSM * fontSizeSM), + + lineHeightHeading1: lineHeights[7], + lineHeightHeading2: lineHeights[6], + lineHeightHeading3: lineHeights[5], + lineHeightHeading4: lineHeights[4], + lineHeightHeading5: lineHeights[3], + }; +}; \ No newline at end of file diff --git a/uni_modules/lime-style/token/genFontSizes.uts b/uni_modules/lime-style/token/genFontSizes.uts new file mode 100644 index 0000000..c294b54 --- /dev/null +++ b/uni_modules/lime-style/token/genFontSizes.uts @@ -0,0 +1,30 @@ +import { FontSize } from './interface'; + +export function getLineHeight(fontSize : number) : number { + return (fontSize + 8) / fontSize; +} + +// https://zhuanlan.zhihu.com/p/32746810 +export function getFontSizes(base : number) : FontSize[] { + const length = 11 // 10 + const offset = 2 // 1 + // #ifdef APP-ANDROID + const arr = Array.fromNative(new IntArray(length.toInt())); + // #endif + // #ifndef APP-ANDROID + const arr = Array.from({ length }); + // #endif + const fontSizes = arr.map((_, index) : number => { + const i = index - offset; + const baseSize = base * Math.pow(Math.E, i / 5); + const intSize = index > 1 ? Math.floor(baseSize) : Math.ceil(baseSize); + + // Convert to even + return Math.floor(intSize / 2) * 2; + }); + fontSizes[offset] = base; + return fontSizes.map((size) : FontSize => ({ + size, + lineHeight: getLineHeight(size), + } as FontSize)); +} \ No newline at end of file diff --git a/uni_modules/lime-style/token/genRadius.uts b/uni_modules/lime-style/token/genRadius.uts new file mode 100644 index 0000000..f4378d1 --- /dev/null +++ b/uni_modules/lime-style/token/genRadius.uts @@ -0,0 +1,63 @@ +export function genRadius(radiusBase : number):Map { + let radiusXL = radiusBase; + let radiusLG = radiusBase; + let radiusMD = radiusBase; + let radiusSM = radiusBase; + let radiusXS = radiusBase; + let radiusOuter = radiusBase; + + + // radiusSM = radiusBase - 3 + // radiusXS = radiusSM - 1 + // radiusLG = radiusBase + 3 + // radiusXL = radiusLG + 3 + + + // radiusXL + if (radiusBase < 6 && radiusBase >= 5) { + radiusXL = radiusBase + 3; + } else if (radiusBase < 16 && radiusBase >= 6) { + radiusXL = radiusBase + 6; + } else if (radiusBase >= 16) { + radiusXL = 16; + } + + // radiusLG + if (radiusBase < 6 && radiusBase >= 5) { + radiusLG = radiusBase + 1; + } else if (radiusBase < 16 && radiusBase >= 6) { + radiusLG = radiusBase + 3; + } else if (radiusBase >= 16) { + radiusLG = 16; + } + + // radiusSM + if (radiusBase < 7 && radiusBase >= 5) { + radiusSM = 3; + } else if (radiusBase < 8 && radiusBase >= 7) { + radiusSM = 4; + } else if (radiusBase < 14 && radiusBase >= 8) { + radiusSM = 5; + } else if (radiusBase < 16 && radiusBase >= 14) { + radiusSM = 6; + } else if (radiusBase >= 16) { + radiusSM = 8; + } + + // radiusXS + if (radiusBase < 6 && radiusBase >= 2) { + radiusXS = 1; + } else if (radiusBase >= 6) { + radiusXS = 2; + } + + + return new Map([ + ['borderRadius', radiusBase], + ['borderRadiusXS', radiusXS], + ['borderRadiusSM', radiusSM], + ['borderRadiusMD', radiusMD], + ['borderRadiusLG', radiusLG], + ['borderRadiusXL', radiusXL], + ]) +} \ No newline at end of file diff --git a/uni_modules/lime-style/token/genSizeMapToken.uts b/uni_modules/lime-style/token/genSizeMapToken.uts new file mode 100644 index 0000000..f7832ab --- /dev/null +++ b/uni_modules/lime-style/token/genSizeMapToken.uts @@ -0,0 +1,20 @@ +// import {SizeMapToken} from './interface' + +/** + * sizeUnit 尺寸变化单位 + * sizeStep 尺寸步长 + */ +export function genSizeMapToken(sizeUnit : number | null = 4, sizeStep : number | null = 4) : UTSJSONObject { + if (sizeUnit == null || sizeStep == null) return {} + return { + spacerHG: sizeUnit * (sizeStep + 16), // 80 + spacerXL: sizeUnit * (sizeStep + 8), // 48 + spacerLG: sizeUnit * (sizeStep + 4), // 32 + spacerMD: sizeUnit * (sizeStep + 2), // 24 + spacerMS: sizeUnit * sizeStep, // 16 + spacer: sizeUnit * sizeStep, // 16 + spacerSM: sizeUnit * (sizeStep - 1), // 12 + spacerXS: sizeUnit * (sizeStep - 2), // 8 + spacerTN: sizeUnit * (sizeStep - 3), // 4 + }; +} \ No newline at end of file diff --git a/uni_modules/lime-style/token/interface.uts b/uni_modules/lime-style/token/interface.uts new file mode 100644 index 0000000..9f93daf --- /dev/null +++ b/uni_modules/lime-style/token/interface.uts @@ -0,0 +1,184 @@ + +export type SeedToken = { + // ---------- Color ---------- // + /** + * @nameZH 是否生成深色色板 + * @nameEN GenerateDarkPalette + * @desc 是否生成一套完整的深色阶梯色板,以支持深色模式的应用 + * @descEN Whether to generate a complete set of dark color palettes to support dark mode applications + */ + useDark ?: boolean; + + /** + * @nameZH 品牌主色 + * @nameEN Brand Color + * @desc 品牌色是体现产品特性和传播理念最直观的视觉元素之一。在你完成品牌主色的选取之后,我们会自动帮你生成一套完整的色板,并赋予它们有效的设计语义 + * @descEN Brand color is one of the most direct visual elements to reflect the characteristics and communication of the product. After you have selected the brand color, we will automatically generate a complete color palette and assign it effective design semantics. + */ + primaryColor ?: string; + /** + * @nameZH 成功色 + * @nameEN Success Color + * @desc 用于表示操作成功的 Token 序列,如 Result、Progress 等组件会使用该组梯度变量。 + * @descEN Used to represent the token sequence of operation success, such as Result, Progress and other components will use these map tokens. + */ + successColor ?: string; + + /** + * @nameZH 警戒色 + * @nameEN Warning Color + * @desc 用于表示操作警告的 Token 序列,如 Notification、 Alert等警告类组件或 Input 输入类等组件会使用该组梯度变量。 + * @descEN Used to represent the warning map token, such as Notification, Alert, etc. Alert or Control component(like Input) will use these map tokens. + */ + warningColor ?: string; + /** + * @nameZH 错误色 + * @nameEN Error Color + * @desc 用于表示操作失败的 Token 序列,如失败按钮、错误状态提示(Result)组件等。 + * @descEN Used to represent the visual elements of the operation failure, such as the error Button, error Result component, etc. + */ + errorColor ?: string; + /** + * @nameZH 信息色 + * @nameEN Info Color + * @desc 用于表示操作信息的 Token 序列,如 Alert 、Tag、 Progress 等组件都有用到该组梯度变量。 + * @descEN Used to represent the operation information of the Token sequence, such as Alert, Tag, Progress, and other components use these map tokens. + */ + infoColor ?: string; + /** + * @nameZH 基础文本色 + * @nameEN Seed Text Color + * @desc 用于派生文本色梯度的基础变量,v5 中我们添加了一层文本色的派生算法可以产出梯度明确的文本色的梯度变量。但请不要在代码中直接使用该 Seed Token ! + * @descEN Used to derive the base variable of the text color gradient. In v5, we added a layer of text color derivation algorithm to produce gradient variables of text color gradient. But please do not use this Seed Token directly in the code! + */ + textColorBase ?: string; + + /** + * @nameZH 基础背景色 + * @nameEN Seed Background Color + * @desc 用于派生背景色梯度的基础变量,v5 中我们添加了一层背景色的派生算法可以产出梯度明确的背景色的梯度变量。但请不要在代码中直接使用该 Seed Token ! + * @descEN Used to derive the base variable of the background color gradient. In v5, we added a layer of background color derivation algorithm to produce map token of background color. But PLEASE DO NOT USE this Seed Token directly in the code! + */ + bgColorBase ?: string; + + /** + * @nameZH 超链接颜色 + * @nameEN Hyperlink color + * @desc 控制超链接的颜色。 + * @descEN Control the color of hyperlink. + */ + linkColor ?: string; + + // ---------- Font ---------- // + + /** + * @nameZH 字体 + * @nameEN Font family for default text + * @desc Lime Ui 的字体家族中优先使用系统默认的界面字体,同时提供了一套利于屏显的备用字体库,来维护在不同平台以及浏览器的显示下,字体始终保持良好的易读性和可读性,体现了友好、稳定和专业的特性。 + * @descEN The font family of Lime Ui prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics. + */ + fontFamily ?: string; + + /** + * @nameZH 代码字体 + * @nameEN Font family for code text + * @desc 代码字体,用于 Typography 内的 code、pre 和 kbd 类型的元素 + * @descEN Code font, used for code, pre and kbd elements in Typography + */ + fontFamilyCode ?: string; + + /** + * @nameZH 默认字号 + * @nameEN Default Font Size + * @desc 设计系统中使用最广泛的字体大小,文本梯度也将基于该字号进行派生。 + * @descEN The most widely used font size in the design system, from which the text gradient will be derived. + * @default 14 + */ + fontSize ?: number; + + + // ---------- BorderRadius ---------- // + + /** + * @nameZH 基础圆角 + * @nameEN Base Border Radius + * @descEN Border radius of base components + * @desc 基础组件的圆角大小,例如按钮、输入框、卡片等 + */ + borderRadius ?: number; + + // ---------- Size ---------- // + + /** + * @nameZH 尺寸变化单位 + * @nameEN Size Change Unit + * @desc 用于控制组件尺寸的变化单位,在 Lime Ui 中我们的基础单位为 4 ,便于更加细致地控制尺寸梯度 + * @descEN The unit of size change, in Lime Ui, our base unit is 4, which is more fine-grained control of the size step + * @default 4 + */ + sizeUnit ?: number; + + /** + * @nameZH 尺寸步长 + * @nameEN Size Base Step + * @desc 用于控制组件尺寸的基础步长,尺寸步长结合尺寸变化单位,就可以派生各种尺寸梯度。通过调整步长即可得到不同的布局模式,例如 V5 紧凑模式下的尺寸步长为 2 + * @descEN The base step of size change, the size step combined with the size change unit, can derive various size steps. By adjusting the step, you can get different layout modes, such as the size step of the compact mode of V5 is 2 + * @default 4 + */ + sizeStep ?: number; +} +export type FontSize = { + size : number + lineHeight : number +} +export type SizeMapToken = { + /** + * @nameZH Huge + * @default 80 + */ + sizeHG : number; + /** + * @nameZH XL + * @default 48 + */ + sizeXL : number; + /** + * @nameZH LG + * @default 32 + */ + sizeLG : number; + /** + * @nameZH MD + * @default 24 + */ + sizeMD : number; + /** Same as size by default, but could be larger in compact mode */ + sizeMS : number; + /** + * @nameZH 默认 + * @desc 默认尺寸 + * @default 16 + */ + size : number; + /** + * @nameZH SM + * @default 12 + */ + sizeSM : number; + /** + * @nameZH XS + * @default 8 + */ + sizeXS : number; + /** + * @nameZH Tiny + * @default 4 + */ + sizeTN : number; +} + + +// #ifndef UNI-APP-X +export type VueApp = any +export type UTSJSONObject = Record +// #endif diff --git a/uni_modules/lime-style/token/light.uts b/uni_modules/lime-style/token/light.uts new file mode 100644 index 0000000..8e3155a --- /dev/null +++ b/uni_modules/lime-style/token/light.uts @@ -0,0 +1,66 @@ +import { TinyColor, generate } from '@/uni_modules/lime-color'; +import { getAlphaColor, getSolidColor, generateColorPalettes } from './shared' +import { SeedToken } from './interface' +// #ifndef UNI-APP-X +export type UTSJSONObject = Record +const UTSJSONObject = Object +// #endif + +export function generateNeutralColorPalettes( + bgBaseColor : string | null, + textBaseColor : string | null +) : UTSJSONObject { + const colorBgBase = bgBaseColor ?? '#fff'; + const colorTextBase = textBaseColor ?? '#000'; + + return { + 'bgColorBase': bgBaseColor, + 'textColorBase': textBaseColor, + + 'textColor1': getAlphaColor(colorTextBase, 0.88), + 'textColor2': getAlphaColor(colorTextBase, 0.65), + 'textColor3': getAlphaColor(colorTextBase, 0.45), + 'textColor4': getAlphaColor(colorTextBase, 0.25), + + 'fill1': getAlphaColor(colorTextBase, 0.15), + 'fill2': getAlphaColor(colorTextBase, 0.06), + 'fill3': getAlphaColor(colorTextBase, 0.04), + 'fill4': getAlphaColor(colorTextBase, 0.02), + + 'bgColorPage': getSolidColor(colorBgBase, 4), + 'bgColorContainer': getSolidColor(colorBgBase, 0), + 'bgColorElevated': getSolidColor(colorBgBase, 0), + 'bgColorMask': getAlphaColor(colorTextBase, 0.45), + 'bgColorSpotlight': getAlphaColor(colorTextBase, 0.85), + 'bgColorBlur': 'transparent', + + 'borderColor1': getSolidColor(colorBgBase, 15), + 'borderColor2': getSolidColor(colorBgBase, 6) + } +}; + +export function genColorMapToken(token : SeedToken) : UTSJSONObject { + const colorPrimaryBase = token.primaryColor + const colorSuccessBase = token.successColor + const colorWarningBase = token.warningColor + const colorErrorBase = token.errorColor + const colorInfoBase = token.infoColor + const colorBgBase = token.bgColorBase + const colorTextBase = token.textColorBase + + const primaryColors = generateColorPalettes(colorPrimaryBase, 'primaryColor'); + const successColors = generateColorPalettes(colorSuccessBase, 'successColor'); + const warningColors = generateColorPalettes(colorWarningBase, 'warningColor'); + const errorColors = generateColorPalettes(colorErrorBase, 'errorColor'); + const infoColors = generateColorPalettes(colorInfoBase, 'infoColor'); + const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase); + + return UTSJSONObject.assign( + {}, + primaryColors, + successColors, + warningColors, + errorColors, + infoColors, + neutralColors) +} \ No newline at end of file diff --git a/uni_modules/lime-style/token/shared.uts b/uni_modules/lime-style/token/shared.uts new file mode 100644 index 0000000..45ed035 --- /dev/null +++ b/uni_modules/lime-style/token/shared.uts @@ -0,0 +1,24 @@ +import { TinyColor, generate } from '@/uni_modules/lime-color'; +import { LGenerateOptions } from '@/uni_modules/lime-color/utssdk/interface'; + +export const getAlphaColor = (baseColor : string, alpha : number) : string => + new TinyColor(baseColor).setAlpha(alpha).toRgbString(); + +export const getSolidColor = (baseColor : string, brightness : number) : string => { + const instance = new TinyColor(baseColor); + return instance.lighten(brightness).toHexString(); +}; + +export function generateColorPalettes(baseColor : string | null, name : string, theme: string = 'default') : UTSJSONObject { + if (baseColor == null) return {} + const colors = generate(baseColor, { theme } as LGenerateOptions); + const colorPalettes = colors.reduce((prev:UTSJSONObject, color:string, index:number) : UTSJSONObject => { + prev[`${name}${index + 1}`] = color; + return prev + }, {}) + + // 默认为中间色 + colorPalettes[name] = colorPalettes[`${name}${6}`] + return colorPalettes +} + diff --git a/uni_modules/lime-style/token/useThemeMode.uts b/uni_modules/lime-style/token/useThemeMode.uts new file mode 100644 index 0000000..ffd9de4 --- /dev/null +++ b/uni_modules/lime-style/token/useThemeMode.uts @@ -0,0 +1,126 @@ +// @ts-nocheck +// #ifndef UNI-APP-X +import { type ComputedRef, ref, watch, getCurrentScope, onScopeDispose, computed, reactive } from './vue'; +// #endif + +type ThemeMode = 'light' | 'dark' | 'auto' +const THEME_LOCAL_STORAGE_KEY = 'app-theme-preference' + +let limeThemeId = -1 +const limeThemeMode = ref('auto') +const limeTheme = ref(getTheme()) + + +function setWeb (theme: ThemeMode) { + // #ifdef WEB + const pageHead = document.querySelector(".uni-page-head"); + if(!pageHead) return + if (theme == 'dark') { + pageHead.style.backgroundColor = '#181818' + pageHead.style.color = '' + } else { + pageHead.style.backgroundColor = 'rgb(245, 245, 245)' + pageHead.style.color = 'rgb(0, 0, 0)' + } + // #endif +} + + +export function getTheme(): 'dark' | 'light' { + // #ifndef UNI-APP-X && APP + let mode = uni.getStorageSync(THEME_LOCAL_STORAGE_KEY) + limeThemeMode.value = (mode || 'auto') + const hostTheme = uni.getAppBaseInfo().hostTheme; + return limeThemeMode.value === 'auto' ? (hostTheme || 'light') : limeThemeMode.value + // #endif + + // #ifdef UNI-APP-X && APP + let { osTheme, appTheme } = uni.getSystemInfoSync(); + return appTheme == "auto" ? osTheme! : appTheme! + // #endif + + +} + +// #ifndef UNI-APP-X +let limeThemeCallBack = (result) => { + limeTheme.value = result.theme +}; +// #endif + +export function stop() { + // #ifndef UNI-APP-X + uni.offThemeChange(limeThemeCallBack) + // #endif + // #ifdef UNI-APP-X + // #ifndef UNI-APP-X && APP + uni.offHostThemeChange(limeThemeId) + + // #endif + // #ifdef UNI-APP-X && APP + uni.offAppThemeChange(limeThemeId) + // #endif + // #endif +} + + +// 检查系统主题 +export const checkSystemTheme = () => { + stop() + limeTheme.value = getTheme() + // #ifndef UNI-APP-X + uni.onThemeChange(limeThemeCallBack); + // #endif + // #ifdef UNI-APP-X + // #ifndef UNI-APP-X && APP + limeThemeId = uni.onHostThemeChange((result) => { + limeTheme.value = result.hostTheme + }); + // #endif + // #ifdef UNI-APP-X && APP + limeThemeId = uni.onAppThemeChange((res : AppThemeChangeResult) => { + limeTheme.value = res.appTheme.trim() + }) + // #endif + // #endif +} + + +export const isDarkMode = computed(() => { + return limeTheme.value == "dark"; +}); + +export function setThemeMode(theme: 'dark' | 'light' | 'auto') { + // #ifdef UNI-APP-X && APP + if (limeTheme.value == theme) return; + uni.setAppTheme({ + theme, + success: function (result: SetAppThemeSuccessResult) { + console.log("设置appTheme为"+ result.theme +"成功") + limeTheme.value = result.theme + }, + fail: function (e : IAppThemeFail) { + console.log("设置appTheme为 auto 失败,原因:", e.errMsg) + } + }) + // #endif + // #ifndef UNI-APP-X && APP + limeThemeMode.value = theme + uni.setStorageSync(THEME_LOCAL_STORAGE_KEY, theme) + limeTheme.value = getTheme() + // #endif + // #ifdef WEB + setWeb(limeTheme.value ) + // #endif +} + + +export function toggleTheme() { + setThemeMode(isDarkMode.value ? 'light' : 'dark') +} + +// #ifdef WEB +watch(isDarkMode, ()=>{ + setWeb(limeTheme.value) +}) +// #endif \ No newline at end of file diff --git a/uni_modules/lime-style/token/useThemeVars.uts b/uni_modules/lime-style/token/useThemeVars.uts new file mode 100644 index 0000000..d5ceb23 --- /dev/null +++ b/uni_modules/lime-style/token/useThemeVars.uts @@ -0,0 +1,123 @@ +// @ts-nocheck +import { isDarkMode } from './useThemeMode' +import type { SeedToken } from './interface'; +import { genFontMapToken } from './genFontMapToken'; +import { genSizeMapToken } from './genSizeMapToken'; +import { genColorMapToken as genLightColorMapToken } from './light'; +import { genColorMapToken as genDarkColorMapToken } from './dark'; +import { computed, reactive } from 'vue'; // 或相应的响应式系统 + + + +// #ifndef UNI-APP-X +export type VueApp = any +export type UTSJSONObject = Record +const UTSJSONObject = Object +// #endif + + +// 内部存储的 tokens +type LimeTokens = { + light : UTSJSONObject + dark : UTSJSONObject +} + +// 默认的基础 token +const DEFAULT_SEED_TOKEN : SeedToken = { + primaryColor: '#3283ff' +}; + +export const themeTokenMaps = reactive({ + light: {}, + dark: {}, +}) + + +// 初始化默认 tokens +function initDefaultTokens() { + // Light 主题颜色 + const lightColors = { + white: '#fff', + gray1: '#f3f3f3', + gray2: '#eeeeee', + gray3: '#e7e7e7', + gray4: '#dcdcdc', + gray5: '#c5c5c5', + gray6: '#a6a6a6', + gray7: '#8b8b8b', + gray8: '#777777', + gray9: '#5e5e5e', + gray10: '#4b4b4b', + gray11: '#383838', + gray12: '#2c2c2c', + gray13: '#242424', + gray14: '#181818', + black: '#000', + ...genLightColorMapToken(DEFAULT_SEED_TOKEN) + }; + // Dark 主题颜色 + const darkColors = { + white: '#000', // 在暗黑模式下反转 + gray1: '#181818', + gray2: '#242424', + gray3: '#2c2c2c', + gray4: '#383838', + gray5: '#4b4b4b', + gray6: '#5e5e5e', + gray7: '#777777', + gray8: '#8b8b8b', + gray9: '#a6a6a6', + gray10: '#c5c5c5', + gray11: '#dcdcdc', + gray12: '#e7e7e7', + gray13: '#eeeeee', + gray14: '#f3f3f3', + black: '#fff', // 在暗黑模式下反转 + ...genDarkColorMapToken(DEFAULT_SEED_TOKEN) + }; + + themeTokenMaps.light = UTSJSONObject.assign({}, lightColors, lightColors) + themeTokenMaps.dark = UTSJSONObject.assign({}, darkColors, darkColors) +} + +initDefaultTokens(); + +// 导出的 themeTokens 是计算属性,自动返回当前主题的 tokens +export const themeTokens = computed(():UTSJSONObject => { + return isDarkMode.value ? themeTokenMaps.dark : themeTokenMaps.light; +}); + + + +export function useThemeToken(token : SeedToken | null = null) { + if (token != null) { + const lightColors = genLightColorMapToken(token!); + const darkColors = genDarkColorMapToken(token!); + + // 只有在提供了相关属性时才重新生成 fonts 和 sizes + const fonts = genFontMapToken(token!.fontSize) + const sizes = genSizeMapToken(token!.sizeUnit, token.sizeStep) + + themeTokenMaps.light = UTSJSONObject.assign({}, themeTokenMaps.light, lightColors, fonts, sizes) + themeTokenMaps.dark = UTSJSONObject.assign({}, themeTokenMaps.dark, darkColors, fonts, sizes) + } +} + +export function useThemeVars(options : UTSJSONObject | null = null) { + if (options != null) { + const currentTheme = isDarkMode.value ? themeTokenMaps.dark : themeTokenMaps.light; + + // #ifdef UNI-APP-X && APP + options.toMap().forEach((value, key) => { + currentTheme.set(key, value); + }); + // #endif + + // #ifndef UNI-APP-X && APP + Object.entries(options).forEach(([key, value]) => { + // currentTheme.set(key, value); + currentTheme[key] = value + }); + // #endif + } +} \ No newline at end of file diff --git a/uni_modules/lime-style/token/vue.ts b/uni_modules/lime-style/token/vue.ts new file mode 100644 index 0000000..d8ded83 --- /dev/null +++ b/uni_modules/lime-style/token/vue.ts @@ -0,0 +1,13 @@ +// @ts-nocheck +// #ifndef VUE3 +import Vue from 'vue' +import VueCompositionAPI from '@vue/composition-api' +Vue.use(VueCompositionAPI) +export * from '@vue/composition-api' +// #endif +// #ifdef VUE3 +export * from 'vue'; +// #endif +// #ifdef APP-IOS || APP-ANDROID +export type ComputedRef = ComputedRefImpl +// #endif \ No newline at end of file diff --git a/uni_modules/lime-style/var.scss b/uni_modules/lime-style/var.scss new file mode 100644 index 0000000..3b107f8 --- /dev/null +++ b/uni_modules/lime-style/var.scss @@ -0,0 +1,64 @@ +@import './mixins/create.scss'; +// 公共前缀 +$prefix: l !default; + +// Spacer +$spacer: create-var('spacer', 16px) !default; // base +$spacer-tn: create-var('spacer-tn', 4px) !default; // Tiny +$spacer-xs: create-var('spacer-xs', 8px) !default; // Extra Small +$spacer-sm: create-var('spacer-sm', 12px) !default; // Small +$spacer-md: create-var('spacer-md', 24px) !default; // Medium +$spacer-lg: create-var('spacer-lg', 32px) !default; // Large +$spacer-xl: create-var('spacer-xl', 48px) !default; // Extra Large +$spacer-hg: create-var('spacer-hg', 80px) !default; // Huge //Ultra Big + +// Font 官方建议字体不跟随页面变化 +$font-size: create-var('font-size', 14px) !default; +$font-size-xs: create-var('font-size-xs', 10px) !default; +$font-size-sm: create-var('font-size-sm', 12px) !default; +$font-size-md: create-var('font-size-md', 16px) !default; +$font-size-lg: create-var('font-size-lg',20px) !default; +$font-size-xl: create-var('font-size-xl', 36px) !default; + +$font-size-heading-1: create-var('font-size-heading-1', 38px) !default; +$font-size-heading-2: create-var('font-size-heading-2', 30px) !default; +$font-size-heading-3: create-var('font-size-heading-3', 24px) !default; +$font-size-heading-4: create-var('font-size-heading-4', 20px) !default; +$font-size-heading-5: create-var('font-size-heading-5', 16px) !default; + + +$font-family: create-var('font-family', PingFang SC, Microsoft YaHei, Arial Regular) !default; // 字体-磅数-常规 +$font-family-md: create-var('font-family-md', PingFang SC, Microsoft YaHei, Arial Medium) !default; // 字体-磅数-粗体 + + +// 行高 +$line-height: create-var('line-height', 1.5714285714285714) !default; +$line-height-sm: create-var('line-height-sm', 1.6666666666666667) !default; +$line-height-md: create-var('line-height-lg', 1.5) !default; +$line-height-lg: create-var('line-height-lg', 1.4) !default; + +$line-height-heading-1: create-var('line-height-heading-1', 1.2105263157894737) !default; +$line-height-heading-2: create-var('line-height-heading-2', 1.2666666666666666) !default; +$line-height-heading-3: create-var('line-height-heading-3', 1.3333333333333333) !default; +$line-height-heading-4: create-var('line-height-heading-4', 1.4) !default; +$line-height-heading-5: create-var('line-height-heading-5', 1.5) !default; + + +// 圆角 +$border-radius: create-var('border-radius', 6px) !default; +$border-radius-xs: create-var('border-radius-xs', 2px) !default; +$border-radius-sm: create-var('border-radius-sm', 3px) !default; +$border-radius-md: create-var('border-radius-md', 6px) !default; +$border-radius-lg: create-var('border-radius-lg', 9px) !default; +$border-radius-xl: create-var('border-radius-xl', 12px) !default; +$border-radius-hg: create-var('border-radius-hg', 999px) !default; +// $border-radius-circle: var(--l-border-radius-circle, 50%); + + +// 动画 +$anim-time-fn-easing: create-var('anim-time-fn-easing', cubic-bezier(0.38, 0, 0.24, 1)) !default; +$anim-time-fn-ease-out: create-var('anim-time-fn-ease-out', cubic-bezier(0, 0, 0.15, 1)) !default; +$anim-time-fn-ease-in: create-var('anim-time-fn-ease-in', cubic-bezier(0.82, 0, 1, 0.9)) !default; +$anim-duration-base: create-var('anim-duration-base', 0.2s) !default; +$anim-duration-moderate: create-var('anim-duration-moderate', 0.24s) !default; +$anim-duration-slow: create-var('anim-duration-slow', 0.28s) !default; \ No newline at end of file diff --git a/uni_modules/mp-html/README.md b/uni_modules/mp-html/README.md index 9959952..cf9ba73 100644 --- a/uni_modules/mp-html/README.md +++ b/uni_modules/mp-html/README.md @@ -1,8 +1,4 @@ -## news -1. 欢迎加入 `QQ` 交流群:`699734691` - ![group](https://6874-html-foe72-1259071903.tcb.qcloud.la/assets/group.jpg?sign=558401bccbd56b01debe1bfac6a3b55e&t=1648801090) -2. 示例微信小程序 `富文本插件` 添加 `获取组件包` 功能 [详细](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart?id=mp) - ![富文本插件](https://6874-html-foe72-1259071903.tcb.qcloud.la/assets/case/%E5%AF%8C%E6%96%87%E6%9C%AC%E6%8F%92%E4%BB%B6.jpg?sign=200e28d06f36049c18d42cdd46270c35&t=1648801110) +## 为减小组件包的大小,默认组件包中不包含编辑、latex 公式等扩展功能,需要使用扩展功能的请参考下方的 插件扩展 栏的说明 ## 功能介绍 - 全端支持(含 `v3、NVUE`) @@ -11,10 +7,10 @@ - 支持设置占位图(加载中、出错时、预览时) - 支持锚点跳转、长按复制等丰富功能 - 支持大部分 *html* 实体 -- 丰富的插件(关键词搜索、内容 **编辑** 等) +- 丰富的插件(关键词搜索、内容编辑、`latex` 公式等) - 效率高、容错性强且轻量化 -查看 [功能介绍](https://jin-yufeng.gitee.io/mp-html/#/overview/feature) 了解更多 +查看 [功能介绍](https://jin-yufeng.github.io/mp-html/#/overview/feature) 了解更多 ## 使用方法 - `uni_modules` 方式 @@ -88,13 +84,13 @@ 使用 *cli* 方式运行的项目,通过 *npm* 方式引入时,需要在 *vue.config.js* 中配置 *transpileDependencies*,详情可见 [#330](https://github.com/jin-yufeng/mp-html/issues/330#issuecomment-913617687) 如果在 **nvue** 中使用还要将 `dist/uni-app/static` 目录下的内容拷贝到项目的 `static` 目录下,否则无法运行 -查看 [快速开始](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart) 了解更多 +查看 [快速开始](https://jin-yufeng.github.io/mp-html/#/overview/quickstart) 了解更多 ## 组件属性 | 属性 | 类型 | 默认值 | 说明 | |:---:|:---:|:---:|---| -| container-style | String | | 容器的样式([2.1.0+](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog#v210)) | +| container-style | String | | 容器的样式([2.1.0+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v210)) | | content | String | | 用于渲染的 html 字符串 | | copy-link | Boolean | true | 是否允许外部链接被点击时自动复制 | | domain | String | | 主域名(用于链接拼接) | @@ -110,7 +106,7 @@ | tag-style | Object | | 设置标签的默认样式 | | use-anchor | Boolean | false | 是否使用锚点链接 | -查看 [属性](https://jin-yufeng.gitee.io/mp-html/#/basic/prop) 了解更多 +查看 [属性](https://jin-yufeng.github.io/mp-html/#/basic/prop) 了解更多 ## 组件事件 @@ -121,8 +117,9 @@ | error | 发生渲染错误时 | | imgtap | 图片被点击时 | | linktap | 链接被点击时 | +| play | 音视频播放时 | -查看 [事件](https://jin-yufeng.gitee.io/mp-html/#/basic/event) 了解更多 +查看 [事件](https://jin-yufeng.github.io/mp-html/#/basic/event) 了解更多 ## api 组件实例上提供了一些 `api` 方法可供调用 @@ -135,8 +132,10 @@ | getRect | 获取富文本内容的位置和大小 | | setContent | 设置富文本内容 | | imgList | 获取所有图片的数组 | +| pauseMedia | 暂停播放音视频([2.2.2+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v222)) | +| setPlaybackRate | 设置音视频播放速率([2.4.0+](https://jin-yufeng.github.io/mp-html/#/changelog/changelog#v240)) | -查看 [api](https://jin-yufeng.gitee.io/mp-html/#/advanced/api) 了解更多 +查看 [api](https://jin-yufeng.github.io/mp-html/#/advanced/api) 了解更多 ## 插件扩展 除基本功能外,本组件还提供了丰富的扩展,可按照需要选用 @@ -144,7 +143,7 @@ | 名称 | 作用 | |:---:|---| | audio | 音乐播放器 | -| editable | 富文本 **编辑**([示例项目](https://6874-html-foe72-1259071903.tcb.qcloud.la/editable.zip?sign=cc0017be203fb3dbca62d33a0c15792e&t=1608447445)) | +| editable | 富文本 **编辑**([示例项目](https://mp-html.oss-cn-hangzhou.aliyuncs.com/editable.zip)) | | emoji | 解析 emoji | | highlight | 代码块高亮显示 | | markdown | 渲染 markdown | @@ -152,8 +151,9 @@ | style | 匹配 style 标签中的样式 | | txv-video | 使用腾讯视频 | | img-cache | 图片缓存 by [@PentaTea](https://github.com/PentaTea) | +| latex | 渲染 latex 公式 by [@Zeng-J](https://github.com/Zeng-J) | -从插件市场导入的包中 **不含有** 扩展插件,需要使用插件参考以下方法: +从插件市场导入的包中 **不含有** 扩展插件,使用插件需通过微信小程序 `富文本插件` 获取或参考以下方法进行打包: 1. 获取完整组件包 ```bash npm install mp-html @@ -167,19 +167,26 @@ ``` 4. 拷贝 `dist/uni-app` 中的内容到项目根目录 -查看 [插件](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin) 了解更多 +查看 [插件](https://jin-yufeng.github.io/mp-html/#/advanced/plugin) 了解更多 ## 关于 nvue `nvue` 使用原生渲染,不支持部分 `css` 样式,为实现和 `html` 相同的效果,组件内部通过 `web-view` 进行渲染,性能上差于原生,根据 `weex` 官方建议,`web` 标签仅应用在非常规的降级场景。因此,如果通过原生的方式(如 `richtext`)能够满足需要,则不建议使用本组件,如果有较多的富文本内容,则可以直接使用 `vue` 页面 由于渲染方式与其他端不同,有以下限制: 1. 不支持 `lazy-load` 属性 2. 视频不支持全屏播放 +3. 如果在 `flex-direction: row` 的容器中使用,需要给组件设置宽度或设置 `flex: 1` 占满剩余宽度 纯 `nvue` 模式下,[此问题](https://ask.dcloud.net.cn/question/119678) 修复前,不支持通过 `uni_modules` 引入,需要本地引入(将 [dist/uni-app](https://github.com/jin-yufeng/mp-html/tree/master/dist/uni-app) 中的内容拷贝到项目根目录下) + ## 问题反馈 -遇到问题时,请先查阅 [常见问题](https://jin-yufeng.gitee.io/mp-html/#/question/faq) 和 [issue](https://github.com/jin-yufeng/mp-html/issues) 中是否已有相同的问题 +遇到问题时,请先查阅 [常见问题](https://jin-yufeng.github.io/mp-html/#/question/faq) 和 [issue](https://github.com/jin-yufeng/mp-html/issues) 中是否已有相同的问题 可通过 [issue](https://github.com/jin-yufeng/mp-html/issues/new/choose) 、插件问答或发送邮件到 [mp_html@126.com](mailto:mp_html@126.com) 提问,不建议在评论区提问(不方便回复) 提问请严格按照 [issue 模板](https://github.com/jin-yufeng/mp-html/issues/new/choose) ,描述清楚使用环境、`html` 内容或可复现的 `demo` 项目以及复现方式,对于 **描述不清**、**无法复现** 或重复的问题将不予回复 -查看 [问题反馈](https://jin-yufeng.gitee.io/mp-html/#/question/feedback) 了解更多 \ No newline at end of file +欢迎加入 `QQ` 交流群: +群1(已满):`699734691` +群2(已满):`778239129` +群3:`960265313` + +查看 [问题反馈](https://jin-yufeng.github.io/mp-html/#/question/feedback) 了解更多 diff --git a/uni_modules/mp-html/changelog.md b/uni_modules/mp-html/changelog.md index c370731..ebb557a 100644 --- a/uni_modules/mp-html/changelog.md +++ b/uni_modules/mp-html/changelog.md @@ -1,3 +1,71 @@ +## v2.5.1(2025-04-20) +1. `U` 适配鸿蒙 `APP` [详细](https://github.com/jin-yufeng/mp-html/issues/615) +2. `U` 微信小程序替换废弃 `api` `getSystemInfoSync` [详细](https://github.com/jin-yufeng/mp-html/issues/613) +3. `F` 修复了 `app` 端播放视频可能报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/617) +4. `F` 修复了 `latex` 插件可能出现 `xxx can be used only in display mode` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/632) +5. `F` 修复了 `uni-app` 包 `latex` 公式可能不显示的问题 [#599](https://github.com/jin-yufeng/mp-html/issues/599)、[#627](https://github.com/jin-yufeng/mp-html/issues/627) +## v2.5.0(2024-04-22) +1. `U` `play` 事件增加返回 `src` 等信息 [详细](https://github.com/jin-yufeng/mp-html/issues/526) +2. `U` `preview-img` 属性支持设置为 `all` 开启 `base64` 图片预览 [详细](https://github.com/jin-yufeng/mp-html/issues/536) +3. `U` `editable` 插件增加简易模式(点击文字直接编辑) +4. `U` `latex` 插件支持块级公式 [详细](https://github.com/jin-yufeng/mp-html/issues/582) +5. `F` 修复了表格部分情况下背景丢失的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/587) +6. `F` 修复了部分 `svg` 无法显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/591) +7. `F` 修复了 `h5` 和 `app` 端部分情况下样式无法识别的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/518) +8. `F` 修复了 `latex` 插件部分情况下显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/580) +9. `F` 修复了 `editable` 插件表格无法删除的问题 +10. `F` 修复了 `editable` 插件 `vue3` `h5` 端点击图片报错的问题 +11. `F` 修复了 `editable` 插件点击表格没有菜单栏的问题 +## v2.4.3(2024-01-21) +1. `A` 增加 [card](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#card) 插件 [详细](https://github.com/jin-yufeng/mp-html/pull/533) by [@whoooami](https://github.com/whoooami) +2. `F` 修复了 `svg` 中包含 `foreignobject` 可能不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/523) +3. `F` 修复了合并单元格的表格部分情况下显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/561) +4. `F` 修复了 `img` 标签设置 `object-fit` 无效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/567) +5. `F` 修复了 `latex` 插件公式会换行的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/540) +6. `F` 修复了 `editable` 和 `audio` 插件共用时点击 `audio` 无法编辑的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/529) by [@whoooami](https://github.com/whoooami) +7. `F` 修复了微信小程序部分情况下图片会报错 `replace of undefined` 的问题 +8. `F` 修复了快手小程序图片不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/571) +## v2.4.2(2023-05-14) +1. `A` `editable` 插件支持修改文字颜色 [详细](https://github.com/jin-yufeng/mp-html/issues/254) +2. `F` 修复了 `svg` 中有 `style` 不生效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/505) +3. `F` 修复了使用旧版编译器可能报错 `Bad attr nodes` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/472) +4. `F` 修复了 `app` 端可能出现无法读取 `lazyLoad` 的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/513) +5. `F` 修复了 `editable` 插件在点击换图时未拼接 `domain` 的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/497) by [@TwoKe945](https://github.com/TwoKe945) +6. `F` 修复了 `latex` 插件部分情况下不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/515) +7. `F` 修复了 `editable` 插件点击音视频时其他标签框不消失的问题 +## v2.4.1(2022-12-25) +1. `F` 修复了没有图片时 `ready` 事件可能不触发的问题 +2. `F` 修复了加载过程中可能出现 `Root label not found` 错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/470) +3. `F` 修复了 `audio` 插件退出页面可能会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/457) +4. `F` 修复了 `vue3` 运行到 `app` 在 `HBuilder X 3.6.10` 以上报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/480) +5. `F` 修复了 `nvue` 端链接中包含 `%22` 时可能无法显示的问题 +6. `F` 修复了 `vue3` 使用 `highlight` 插件可能报错的问题 +## v2.4.0(2022-08-27) +1. `A` 增加了 [setPlaybackRate](https://jin-yufeng.gitee.io/mp-html/#/advanced/api#setPlaybackRate) 的 `api`,可以设置音视频的播放速率 [详细](https://github.com/jin-yufeng/mp-html/issues/452) +2. `A` 示例小程序代码开源 [详细](https://github.com/jin-yufeng/mp-html-demo) +3. `U` 优化 `ready` 事件触发时机,未设置懒加载的情况下基本可以准确触发 [详细](https://github.com/jin-yufeng/mp-html/issues/195) +4. `U` `highlight` 插件在编辑状态下不进行高亮处理,便于编辑 +5. `F` 修复了 `flex` 布局下图片大小可能不正确的问题 +6. `F` 修复了 `selectable` 属性没有设置 `force` 也可能出现渲染异常的问题 +7. `F` 修复了表格中的图片大小可能不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/448) +8. `F` 修复了含有合并单元格的表格可能无法设置竖直对齐的问题 +9. `F` 修复了 `editable` 插件在 `scroll-view` 中使用时工具条位置可能不正确的问题 +10. `F` 修复了 `vue3` 使用 [search](advanced/plugin#search) 插件可能导致错误换行的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/449) +## v2.3.2(2022-08-13) +1. `A` 增加 [latex](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#latex) 插件,可以渲染数学公式 [详细](https://github.com/jin-yufeng/mp-html/pull/447) by [@Zeng-J](https://github.com/Zeng-J) +2. `U` 优化根节点下有很多标签的长内容渲染速度 +3. `U` `highlight` 插件适配 `lang-xxx` 格式 +4. `F` 修复了 `table` 标签设置 `border` 属性后可能无法修改边框样式的问题 [详细](https://github.com/jin-yufeng/mp-html/pull/439) by [@zouxingjie](https://github.com/zouxingjie) +5. `F` 修复了 `editable` 插件输入连续空格无效的问题 +6. `F` 修复了 `vue3` 图片设置 `inline` 会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/438) +7. `F` 修复了 `vue3` 使用 `table` 可能报错的问题 +## v2.3.1(2022-05-20) +1. `U` `app` 端支持使用本地图片 +2. `U` 优化了微信小程序 `selectable` 属性在 `ios` 端的处理 [详细](https://jin-yufeng.gitee.io/mp-html/#/basic/prop#selectable) +3. `F` 修复了 `editable` 插件不在顶部时 `tooltip` 位置可能错误的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/430) +4. `F` 修复了 `vue3` 运行到微信小程序可能报错丢失内容的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/414) +5. `F` 修复了 `vue3` 部分标签可能被错误换行的问题 +6. `F` 修复了 `editable` 插件 `app` 端插入视频无法预览的问题 ## v2.3.0(2022-04-01) 1. `A` 增加了 `play` 事件,音视频播放时触发,可用于与页面其他音视频进行互斥播放 [详细](basic/event#play) 2. `U` `show-img-menu` 属性支持控制预览时是否长按弹出菜单 diff --git a/uni_modules/mp-html/components/mp-html/mp-html.vue b/uni_modules/mp-html/components/mp-html/mp-html.vue index 24caed9..796762b 100644 --- a/uni_modules/mp-html/components/mp-html/mp-html.vue +++ b/uni_modules/mp-html/components/mp-html/mp-html.vue @@ -2,7 +2,7 @@ - + @@ -12,7 +12,7 @@ - diff --git a/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue b/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue index 912ba92..be5bb64 100644 --- a/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue +++ b/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue @@ -75,7 +75,7 @@ */ export default { name: 'UniDataPicker', - emits: ['popupopened', 'popupclosed', 'nodeclick', 'input', 'change', 'update:modelValue'], + emits: ['popupopened', 'popupclosed', 'nodeclick', 'input', 'change', 'update:modelValue','inputclick'], mixins: [dataPicker], components: { DataPickerView @@ -131,9 +131,16 @@ this.load(); }) }, + watch: { + localdata: { + handler() { + this.load() + }, + deep: true + }, + }, methods: { clear() { - this.modelValue = null; this._dispatchEvent([]); }, onPropsChange() { @@ -148,10 +155,6 @@ return; } - if (!this.hasValue) { - // return; - } - // 回显本地数据 if (this.isLocalData) { this.loadData(); @@ -184,6 +187,7 @@ }, handleInput() { if (this.readonly) { + this.$emit('inputclick') return } this.show() @@ -228,15 +232,24 @@ } let result = [] - for (let i = 0; i < value.length; i++) { - var val = value[i] - var item = dataList.find((v) => { - return v.value == val - }) - if (item) { - result.push(item) - } - } + if (Array.isArray(value)) { + for (let i = 0; i < value.length; i++) { + var val = value[i] + var item = dataList.find((v) => { + return v.value == val + }) + if (item) { + result.push(item) + } + } + } else { + let item = dataList.find((v) => { + return v.value == value; + }); + if (item) { + result.push(item); + } + } if (result.length) { this.inputSelected = result } diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/loading.uts b/uni_modules/uni-data-picker/components/uni-data-pickerview/loading.uts new file mode 100644 index 0000000..baa0dff --- /dev/null +++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/loading.uts @@ -0,0 +1 @@ +export const imgbase : string = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QzlBMzU3OTlEOUM0MTFFOUI0NTZDNERBQURBQzI4RkUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QzlBMzU3OUFEOUM0MTFFOUI0NTZDNERBQURBQzI4RkUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDOUEzNTc5N0Q5QzQxMUU5QjQ1NkM0REFBREFDMjhGRSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDOUEzNTc5OEQ5QzQxMUU5QjQ1NkM0REFBREFDMjhGRSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pt+ALSwAAA6CSURBVHja1FsLkFZVHb98LM+F5bHL8khA1iSeiyQBCRM+YGqKUnnJTDLGI0BGZlKDIU2MMglUiDApEZvSsZnQtBRJtKwQNKQMFYeRDR10WOLd8ljYXdh+v8v5fR3Od+797t1dnOnO/Ofce77z+J//+b/P+ZqtXbs2sJ9MJhNUV1cHJ06cCJo3bx7EPc2aNcvpy7pWrVoF+/fvDyoqKoI2bdoE9fX1F7TjN8a+EXBn/fkfvw942Tf+wYMHg9mzZwfjxo0LDhw4EPa1x2MbFw/fOGfPng1qa2tzcCkILsLDydq2bRsunpOTMM7TD/W/tZDZhPdeKD+yGxHhdu3aBV27dg3OnDlzMVANMheLAO3btw8KCwuDmpoaX5OxbgUIMEq7K8IcPnw4KCsrC/r37x8cP378/4cAXAB3vqSkJMuiDhTkw+XcuXNhOWbMmKBly5YhUT8xArhyFvP0BfwRsAuwxJZJsm/nzp2DTp06he/OU+cZ64K6o0ePBkOHDg2GDx8e6gEbJ5Q/NHNuAJQ1hgBeHUDlR7nVTkY8rQAvAi4z34vR/mPs1FoRsaCgIJThI0eOBC1atEiFGGV+5MiRoS45efJkqFjJFXV1dQuA012m2WcwTw98fy6CqBdsaiIO4CScrGPHjvk4odhavPquRtFWXEC25VgkREKOCh/qDSq+vn37htzD/mZTOmOc5U7zKzBPEedygWshcDyWvs30igAbU+6oyMgJBCFhwQE0fccxN60Ay9iebbjoDh06hMowjQxT4fXq1SskArmHZpkArvixp/kWzHdMeArExSJEaiXIjjRjRJ4DaAGWpibLzXN3Fm1vA5teBgh3j1Rv3bp1YgKwPdmf2p9zcyNYYgPKMfY0T5f5nNYdw158nJ8QawW4CLKwiOBSEgO/hok2eBydR+3dYH+PLxA5J8Vv0KBBwenTp0P2JWAx6+yFEBfs8lMY+y0SWMBNI9E4ThKi58VKTg3FQZS1RQF1cz27eC0QHMu+3E0SkUowjhVt5VdaWhp07949ZHv2Qd1EjDXM2cla1M0nl3GxAs3J9yREzyTdFVKVFOaE9qRA8GM0WebRuo9JGZKA7Mv2SeS/Z8+eoQ9BArMfFrLGo6jvxbhHbJZnKX2Rzz1O7QhJJ9Cs2ZMaWIyq/zhdeqPNfIoHd58clIQD+JSXl4dKlyIAuBdVXZwFVWKspSSoxE++h8x4k3uCnEhE4I5KwRiFWGOU0QWKiCYLbdoRMRKAu2kQ9vkfLU6dOhX06NEjlH+yMRZSinnuyWnYosVcji8CEA/6Cg2JF+IIUBqnGKUTCNwtwBN4f89RiK1R96DEgO2o0NDmtEdvVFdVVYV+P3UAPUEs6GFwV3PHmXkD4vh74iDFJysVI/MlaQhwKeBNTLYX5VuA8T4/gZxA4MRGFxDB6R7OmYPfyykGRJbyie+XnGYnQIC/coH9+vULiYrxrkL9ZA9+0ykaHIfEpM7ge8TiJ2CsHYwyMfafAF1yCGBHYIbCVDjDjKt7BeB51D+LgQa6OkG7IDYEEtvQ7lnXLKLtLdLuJBpE4gPUXcW2+PkZwOex+4cGDhwYDBkyRL7/HFcEwUGPo/8uWRUpYnfxGHco8HkewLHLyYmAawAPuIFZxhOpDfJQ8gbUv41yORAptMWBNr6oqMhWird5+u+iHmBb2nhjDV7HWBNQTgK8y11l5NetWzc5ULscAtSj7nbNI0skhWeUZCc0W4nyH/jO4Vz0u1IeYhbk4AiwM6tjxIWByHsoZ9qcIBPJd/y+DwPfBESOmCa/QF3WiZHucLlEDpNxcNhmheEOPgdQNx6/VZFQzFZ5TN08AHXQt2Ii3EdyFuUsPtTcGPhW5iMiCNELvz+Gdn9huG4HUJaW/w3g0wxV0XaG7arG2WeKiUWYM4Y7GO5ezshTARbbWGw/DvXkpp/ivVvE0JVoMxN4rpGzJMhE5Pl+xlATsDIqikP9F9D2z3h9nOksEUFhK+qO4rcPkoalMQ/HqJLIyb3F3JdjrCcw1yZ8joyJLR5gCo54etlag7qIoeNh1N1BRYj3DTFJ0elotxPlVzkGuYAmL0VSJVGAJA41c4Z6A3BzTLfn0HYwYKEI6CUAMzZEWvLsIcQOo1AmmyyM72nHJCfYsogflGV6jEk9vyQZXSuq6w4c16NsGcGZbwOPr+H1RkOk2LEzjNepxQkihHSCQ4ynAYNRx2zMKV92CQMWqj8J0BRE8EShxRFN6YrfCRhC0x3r/Zm4IbQCcmJoV0kMamllccR6FjHqUC5F2R/wS2dcymOlfAKOS4KmzQb5cpNC2MC7JhVn5wjXoJ44rYhLh8n0eXOCorJxa7POjbSlCGVczr34/RsAmrcvo9s+wGp3tzVhntxiXiJ4nvEYb4FJkf0O8HocAePmLvCxnL0AORraVekJk6TYjDabRVXfRE2lCN1h6ZQRN1+InUbsCpKwoBZHh0dODN9JBCUffItXxEavTQkUtnfTVAplCWL3JISz29h4NjotnuSsQKJCk8dF+kJR6RARjrqFVmfPnj3ZbK8cIJ0msd6jgHPGtfVTQ8VLmlvh4mct9sobRmPic0DyDQQnx/NlfYUgyz59+oScsH379pAwXABD32nTpoUHIToESeI5mnbE/UqDdyLcafEBf2MCqgC7NwxIbMREJQ0g4D4sfJwnD+AmRrII05cfMWJE+L1169bQr+fip06dGp4oJ83lmYd5wj/EmMa4TaHivo4EeCguYZBnkB5g2aWA69OIEnUHOaGysjIYMGBAMGnSpODYsWPZwCpFmm4lNq+4gSLQA7jcX8DwtjEyRC8wjabnXEx9kfWnTJkSJkAo90xpJVV+FmcVNeYAF5zWngS4C4O91MBxmAv8blLEpbjI5sz9MTdAhcgkCT1RO8mZkAjfiYpTEvStAS53Uw1vAiUGgZ3GpuQEYvoiBqlIan7kSDHnTwJQFNiPu0+5VxCVYhcZIjNrdXUDdp+Eq5AZ3Gkg8QAyVZRZIk4Tl4QAbF9cXJxNYZMAtAokgs4BrNxEpCtteXg7DDTMDKYNSuQdKsnJBek7HxewvxaosWxLYXtw+cJp18217wql4aKCfBNoEu0O5VU+PhctJ0YeXD4C6JQpyrlpSLTojpGGGN5YwNziChdIZLk4lvLcFJ9jMX3QdiImY9bmGQU+TRUL5CHITTRlgF8D9ouD1MfmLoEPl5xokIumZ2cfgMpHt47IW9N64Hsh7wQYYjyIugWuF5fCqYncXRd5vPMWyizzvhi/32+nvG0dZc9vR6fZOu0md5e+uC408FvKSIOZwXlGvxPv95izA2Vtvg1xKFWARI+vMX66HUhpQQb643uW1bSjuTWyw2SBvDrBvjFic1eGGlz5esq3ko9uSIlBRqPuFcCv8F4WIcN12nVaBd0SaYwI6PDDImR11JkqgHcPmQssjxIn6bUshygDFJUTxPMpHk+jfjPgupgdnYV2R/g7xSjtpah8RJBewhwf0gGK6XI92u4wXFEU40afJ4DN4h5LcAd+40HI3JgJecuT0c062W0i2hQJUTcxan3/CMW1PF2K6bbA+Daz4xRs1D3Br1Cm0OihKCqizW78/nXAF/G5TXrEcVzaNMH6CyMswqsAHqDyDLEyou8lwOXnKF8DjI6KjV3KzMBiXkDH8ij/H214J5A596ekrZ3F0zXlWeL7+P5eUrNo3/QwC15uxthuzidy7DzKRwEDaAViiDgKbTbz7CJnzo0bN7pIfIiid8SuPwn25o3QCmpnyjlZkyxPP8EomCJzrGb7GJMx7tNsq4MT2xMUYaiErZOluTzKsnz3gwCeCZyVRZJfYplNEokEjwrPtxlxjeYAk+F1F74VAzPxQRNYYdtpOUvWs8J1sGhBJMNsb7igN8plJs1eSmLIhLKE4rvaCX27gOhLpLOsIzJ7qn/i+wZzcvSOZ23/du8TZjwV8zHIXoP4R3ifBxiFz1dcVpa3aPntPE+c6TmIWE9EtcMmAcPdWAhYhAXxcLOQi9L1WhD1Sc8p1d2oL7XGiRKp8F4A2i8K/nfI+y/gsTDJ/YC/8+AD5Uh04KHiGl+cIFPnBDDrPMjwRGkLXyxO4VGbfQWnDH2v0bVWE3C9QOXlepbgjEfIJQI6XDG3z5ahD9cw2pS78ipB85wyScNTvsVzlzzhL8/jRrnmVjfFJK/m3m4nj9vbgQTguT8XZTjsm672R5uJKEaQmBI/c58gyus8ZDagLpEVSJBIyHp4jn++xqPV71OgQgJYEWOtZ/haxRtKmWOBu8xdBLftWltsY84zE6WIEy/eIOWL+BaayMx+KHtL7EAkqdNDLiEXmEMUHniedtJqg9HmZtfvt26vNi0BdG3Ft3g8ZOf7PAu59TxtzivLNIekyi+wD1i8CuUiD9FXAa8C+/xS3JPmZnomyc7H+fb4/Se0bk41Fel621r4cgVxbq91V4jVqwB7HTe2M7jgB+QWHavZkDRPmZcASoZEmBx6i75bGjPcMdL4/VKGFAGWZkGzPG0XAbdL9A81G5LOmUnC9hHKJeO7dcUMjblSl12867ElFTtaGl20xvvLGPdVz/8TVuU7y0x1PG7vtNg24oz9Uo/Z412++VFWI7Fcog9tu9Lm6gvRmIPv9x1xmQAu6RDkXtbOtlGEmpgD5Nvnyc0dcv0EE6cfdi1HmhMf9wDF3k3gtRvEedhxjpgfqPb9PU9iEJHnyOUA7bQUXh6kq/D7l2iTjWv7XOD530BDr8jIrus+srXjt4MzumJMHuTsBa63YKE1+RR5lBjEikCCnWKWiHdzOgKO+nRIBAF88za/IFmJ3eMZov4CYxGBabcpGL8EYx+SeMXJeRwHNsV/h+vdxeuhEpN3ZyNY78Gm2fknJxVGhyjixPiQvVkNzT1elD9Py/aTAL64Hb9vcYmC9zfdXdT/C1LeGbg4rnBaAihDFJH12W5ulfNCNe/xTsP3bp8ikzJs5BF+5PNfAQYAPaseTdsEcaYAAAAASUVORK5CYII=' \ No newline at end of file diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.uts b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.uts new file mode 100644 index 0000000..372795d --- /dev/null +++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.uts @@ -0,0 +1,693 @@ +export type PaginationType = { + current : number, + size : number, + count : number +} + +export type LoadMoreType = { + contentdown : string, + contentrefresh : string, + contentnomore : string +} + +export type SelectedItemType = { + name : string, + value : string, +} + +export type GetCommandOptions = { + collection ?: UTSJSONObject, + field ?: string, + orderby ?: string, + where ?: any, + pageData ?: string, + pageCurrent ?: number, + pageSize ?: number, + getCount ?: boolean, + getTree ?: any, + getTreePath ?: UTSJSONObject, + startwith ?: string, + limitlevel ?: number, + groupby ?: string, + groupField ?: string, + distinct ?: boolean, + pageIndistinct ?: boolean, + foreignKey ?: string, + loadtime ?: string, + manual ?: boolean +} + +const DefaultSelectedNode = { + text: '请选择', + value: '' +} + +export const dataPicker = defineMixin({ + props: { + localdata: { + type: Array as PropType>, + default: [] as Array + }, + collection: { + type: Object, + default: '' + }, + field: { + type: String, + default: '' + }, + orderby: { + type: String, + default: '' + }, + where: { + type: Object, + default: '' + }, + pageData: { + type: String, + default: 'add' + }, + pageCurrent: { + type: Number, + default: 1 + }, + pageSize: { + type: Number, + default: 20 + }, + getcount: { + type: Boolean, + default: false + }, + gettree: { + type: Object, + default: '' + }, + gettreepath: { + type: Object, + default: '' + }, + startwith: { + type: String, + default: '' + }, + limitlevel: { + type: Number, + default: 10 + }, + groupby: { + type: String, + default: '' + }, + groupField: { + type: String, + default: '' + }, + distinct: { + type: Boolean, + default: false + }, + pageIndistinct: { + type: Boolean, + default: false + }, + foreignKey: { + type: String, + default: '' + }, + loadtime: { + type: String, + default: 'auto' + }, + manual: { + type: Boolean, + default: false + }, + preload: { + type: Boolean, + default: false + }, + stepSearh: { + type: Boolean, + default: true + }, + selfField: { + type: String, + default: '' + }, + parentField: { + type: String, + default: '' + }, + multiple: { + type: Boolean, + default: false + }, + value: { + type: Object, + default: '' + }, + modelValue: { + type: Object, + default: '' + }, + defaultProps: { + type: Object as PropType, + } + }, + data() { + return { + loading: false, + error: null as UniCloudError | null, + treeData: [] as Array, + selectedIndex: 0, + selectedNodes: [] as Array, + selectedPages: [] as Array[], + selectedValue: '', + selectedPaths: [] as Array, + pagination: { + current: 1, + size: 20, + count: 0 + } as PaginationType + } + }, + computed: { + mappingTextName() : string { + // TODO + return (this.defaultProps != null) ? this.defaultProps!.getString('text', 'text') : 'text' + }, + mappingValueName() : string { + // TODO + return (this.defaultProps != null) ? this.defaultProps!.getString('value', 'value') : 'value' + }, + currentDataList() : Array { + if (this.selectedIndex > this.selectedPages.length - 1) { + return [] as Array + } + return this.selectedPages[this.selectedIndex] + }, + isLocalData() : boolean { + return this.localdata.length > 0 + }, + isCloudData() : boolean { + return this._checkIsNotNull(this.collection) + }, + isCloudDataList() : boolean { + return (this.isCloudData && (this.parentField.length == 0 && this.selfField.length == 0)) + }, + isCloudDataTree() : boolean { + return (this.isCloudData && this.parentField.length > 0 && this.selfField.length > 0) + }, + dataValue() : any { + return this.hasModelValue ? this.modelValue : this.value + }, + hasCloudTreeData() : boolean { + return this.treeData.length > 0 + }, + hasModelValue() : boolean { + if (typeof this.modelValue == 'string') { + const valueString = this.modelValue as string + return (valueString.length > 0) + } else if (Array.isArray(this.modelValue)) { + const valueArray = this.modelValue as Array + return (valueArray.length > 0) + } + return false + }, + hasCloudDataValue() : boolean { + if (typeof this.dataValue == 'string') { + const valueString = this.dataValue as string + return (valueString.length > 0) + } + return false + } + }, + created() { + this.pagination.current = this.pageCurrent + this.pagination.size = this.pageSize + + this.$watch( + () : any => [ + this.pageCurrent, + this.pageSize, + this.localdata, + this.value, + this.collection, + this.field, + this.getcount, + this.orderby, + this.where, + this.groupby, + this.groupField, + this.distinct + ], + (newValue : Array, oldValue : Array) => { + this.pagination.size = this.pageSize + if (newValue[0] !== oldValue[0]) { + this.pagination.current = this.pageCurrent + } + + this.onPropsChange() + } + ) + }, + methods: { + onPropsChange() { + this.selectedIndex = 0 + this.treeData.length = 0 + this.selectedNodes.length = 0 + this.selectedPages.length = 0 + this.selectedPaths.length = 0 + + // 加载数据 + this.$nextTick(() => { + this.loadData() + }) + }, + + onTabSelect(index : number) { + this.selectedIndex = index + }, + + onNodeClick(nodeData : UTSJSONObject) { + if (nodeData.getBoolean('disable', false)) { + return + } + + const isLeaf = this._checkIsLeafNode(nodeData) + + this._trimSelectedNodes(nodeData) + + this.$emit('nodeclick', nodeData) + + if (this.isLocalData) { + if (isLeaf || !this._checkHasChildren(nodeData)) { + this.onFinish() + } + } else if (this.isCloudDataList) { + this.onFinish() + } else if (this.isCloudDataTree) { + if (isLeaf) { + this.onFinish() + } else if (!this._checkHasChildren(nodeData)) { + // 尝试请求一次,如果没有返回数据标记为叶子节点 + this.loadCloudDataNode(nodeData) + } + } + }, + + getChangeNodes(): Array { + const nodes: Array = [] + this.selectedNodes.forEach((node : UTSJSONObject) => { + const newNode: UTSJSONObject = {} + newNode[this.mappingTextName] = node.getString(this.mappingTextName) + newNode[this.mappingValueName] = node.getString(this.mappingValueName) + nodes.push(newNode) + }) + return nodes + }, + + onFinish() { }, + + // 加载数据(自动判定环境) + loadData() { + if (this.isLocalData) { + this.loadLocalData() + } else if (this.isCloudDataList) { + this.loadCloudDataList() + } else if (this.isCloudDataTree) { + this.loadCloudDataTree() + } + }, + + // 加载本地数据 + loadLocalData() { + this.treeData = this.localdata + if (Array.isArray(this.dataValue)) { + const value = this.dataValue as Array + this.selectedPaths = value.slice(0) + this._pushSelectedTreeNodes(value, this.localdata) + } else { + this._pushSelectedNodes(this.localdata) + } + }, + + // 加载 Cloud 数据 (单列) + loadCloudDataList() { + this._loadCloudData(null, (data : Array) => { + this.treeData = data + this._pushSelectedNodes(data) + }) + }, + + // 加载 Cloud 数据 (树形) + loadCloudDataTree() { + let commandOptions = { + field: this._cloudDataPostField(), + where: this._cloudDataTreeWhere(), + getTree: true + } as GetCommandOptions + if (this._checkIsNotNull(this.gettree)) { + commandOptions.startwith = `${this.selfField}=='${this.dataValue as string}'` + } + this._loadCloudData(commandOptions, (data : Array) => { + this.treeData = data + if (this.selectedPaths.length > 0) { + this._pushSelectedTreeNodes(this.selectedPaths, data) + } else { + this._pushSelectedNodes(data) + } + }) + }, + + // 加载 Cloud 数据 (节点) + loadCloudDataNode(nodeData : UTSJSONObject) { + const commandOptions = { + field: this._cloudDataPostField(), + where: this._cloudDataNodeWhere() + } as GetCommandOptions + this._loadCloudData(commandOptions, (data : Array) => { + nodeData['children'] = data + if (data.length == 0) { + nodeData['isleaf'] = true + this.onFinish() + } else { + this._pushSelectedNodes(data) + } + }) + }, + + // 回显 Cloud Tree Path + loadCloudDataPath() { + if (!this.hasCloudDataValue) { + return + } + + const command : GetCommandOptions = {} + + // 单列 + if (this.isCloudDataList) { + // 根据 field's as value标识匹配 where 条件 + let where : Array = []; + let whereField = this._getForeignKeyByField(); + if (whereField.length > 0) { + where.push(`${whereField} == '${this.dataValue as string}'`) + } + + let whereString = where.join(' || ') + if (this._checkIsNotNull(this.where)) { + whereString = `(${this.where}) && (${whereString})` + } + + command.field = this._cloudDataPostField() + command.where = whereString + } + + // 树形 + if (this.isCloudDataTree) { + command.field = this._cloudDataPostField() + command.getTreePath = { + startWith: `${this.selfField}=='${this.dataValue as string}'` + } + } + + this._loadCloudData(command, (data : Array) => { + this._extractTreePath(data, this.selectedPaths) + }) + }, + + _loadCloudData(options ?: GetCommandOptions, callback ?: ((data : Array) => void)) { + if (this.loading) { + return + } + this.loading = true + + this.error = null + + this._getCommand(options).then((response : UniCloudDBGetResult) => { + callback?.(response.data) + }).catch((err : any | null) => { + this.error = err as UniCloudError + }).finally(() => { + this.loading = false + }) + }, + + _cloudDataPostField() : string { + let fields = [this.field]; + if (this.parentField.length > 0) { + fields.push(`${this.parentField} as parent_value`) + } + return fields.join(',') + }, + + _cloudDataTreeWhere() : string { + let result : Array = [] + let selectedNodes = this.selectedNodes.length > 0 ? this.selectedNodes : this.selectedPaths + let parentField = this.parentField + if (parentField.length > 0) { + result.push(`${parentField} == null || ${parentField} == ""`) + } + if (selectedNodes.length > 0) { + for (var i = 0; i < selectedNodes.length - 1; i++) { + const parentFieldValue = selectedNodes[i].getString('value', '') + result.push(`${parentField} == '${parentFieldValue}'`) + } + } + + let where : Array = [] + if (this._checkIsNotNull(this.where)) { + where.push(`(${this.where as string})`) + } + + if (result.length > 0) { + where.push(`(${result.join(' || ')})`) + } + + return where.join(' && ') + }, + + _cloudDataNodeWhere() : string { + const where : Array = [] + if (this.selectedNodes.length > 0) { + const value = this.selectedNodes[this.selectedNodes.length - 1].getString('value', '') + where.push(`${this.parentField} == '${value}'`) + } + + let whereString = where.join(' || ') + if (this._checkIsNotNull(this.where)) { + return `(${this.where as string}) && (${whereString})` + } + + return whereString + }, + + _getWhereByForeignKey() : string { + let result : Array = [] + let whereField = this._getForeignKeyByField(); + if (whereField.length > 0) { + result.push(`${whereField} == '${this.dataValue as string}'`) + } + + if (this._checkIsNotNull(this.where)) { + return `(${this.where}) && (${result.join(' || ')})` + } + + return result.join(' || ') + }, + + _getForeignKeyByField() : string { + const fields = this.field.split(',') + let whereField = '' + for (let i = 0; i < fields.length; i++) { + const items = fields[i].split('as') + if (items.length < 2) { + continue + } + if (items[1].trim() === 'value') { + whereField = items[0].trim() + break + } + } + return whereField + }, + + _getCommand(options ?: GetCommandOptions) : Promise { + let db = uniCloud.databaseForJQL() + + let collection = Array.isArray(this.collection) ? db.collection(...(this.collection as Array)) : db.collection(this.collection) + + let filter : UniCloudDBFilter | null = null + if (this.foreignKey.length > 0) { + filter = collection.foreignKey(this.foreignKey) + } + + const where : any = options?.where ?? this.where + if (typeof where == 'string') { + const whereString = where as string + if (whereString.length > 0) { + filter = (filter != null) ? filter.where(where) : collection.where(where) + } + } else { + filter = (filter != null) ? filter.where(where) : collection.where(where) + } + + let query : UniCloudDBQuery | null = null + if (this.field.length > 0) { + query = (filter != null) ? filter.field(this.field) : collection.field(this.field) + } + if (this.groupby.length > 0) { + if (query != null) { + query = query.groupBy(this.groupby) + } else if (filter != null) { + query = filter.groupBy(this.groupby) + } + } + if (this.groupField.length > 0) { + if (query != null) { + query = query.groupField(this.groupField) + } else if (filter != null) { + query = filter.groupField(this.groupField) + } + } + if (this.distinct == true) { + if (query != null) { + query = query.distinct(this.field) + } else if (filter != null) { + query = filter.distinct(this.field) + } + } + if (this.orderby.length > 0) { + if (query != null) { + query = query.orderBy(this.orderby) + } else if (filter != null) { + query = filter.orderBy(this.orderby) + } + } + + const size = this.pagination.size + const current = this.pagination.current + if (query != null) { + query = query.skip(size * (current - 1)).limit(size) + } else if (filter != null) { + query = filter.skip(size * (current - 1)).limit(size) + } else { + query = collection.skip(size * (current - 1)).limit(size) + } + + const getOptions = {} + const treeOptions = { + limitLevel: this.limitlevel, + startWith: this.startwith + } + if (this.getcount == true) { + getOptions['getCount'] = this.getcount + } + + const getTree : any = options?.getTree ?? this.gettree + if (typeof getTree == 'string') { + const getTreeString = getTree as string + if (getTreeString.length > 0) { + getOptions['getTree'] = treeOptions + } + } else if (typeof getTree == 'object') { + getOptions['getTree'] = treeOptions + } else { + getOptions['getTree'] = getTree + } + + const getTreePath = options?.getTreePath ?? this.gettreepath + if (typeof getTreePath == 'string') { + const getTreePathString = getTreePath as string + if (getTreePathString.length > 0) { + getOptions['getTreePath'] = getTreePath + } + } else { + getOptions['getTreePath'] = getTreePath + } + + return query.get(getOptions) + }, + + _checkIsNotNull(value : any) : boolean { + if (typeof value == 'string') { + const valueString = value as string + return (valueString.length > 0) + } else if (value instanceof UTSJSONObject) { + return true + } + return false + }, + + _checkIsLeafNode(nodeData : UTSJSONObject) : boolean { + if (this.selectedIndex >= this.limitlevel) { + return true + } + + if (nodeData.getBoolean('isleaf', false)) { + return true + } + + return false + }, + + _checkHasChildren(nodeData : UTSJSONObject) : boolean { + const children = nodeData.getArray('children') ?? ([] as Array) + return children.length > 0 + }, + + _pushSelectedNodes(nodes : Array) { + this.selectedNodes.push(DefaultSelectedNode) + this.selectedPages.push(nodes) + this.selectedIndex = this.selectedPages.length - 1 + }, + + _trimSelectedNodes(nodeData : UTSJSONObject) { + this.selectedNodes.splice(this.selectedIndex) + this.selectedNodes.push(nodeData) + + if (this.selectedPages.length > 0) { + this.selectedPages.splice(this.selectedIndex + 1) + } + + const children = nodeData.getArray('children') ?? ([] as Array) + if (children.length > 0) { + this.selectedNodes.push(DefaultSelectedNode) + this.selectedPages.push(children) + } + + this.selectedIndex = this.selectedPages.length - 1 + }, + + _pushSelectedTreeNodes(paths : Array, nodes : Array) { + let children : Array = nodes + paths.forEach((node : UTSJSONObject) => { + const findNode = children.find((item : UTSJSONObject) : boolean => { + return (item.getString(this.mappingValueName) == node.getString(this.mappingValueName)) + }) + if (findNode != null) { + this.selectedPages.push(children) + this.selectedNodes.push(node) + children = findNode.getArray('children') ?? ([] as Array) + } + }) + this.selectedIndex = this.selectedPages.length - 1 + }, + + _extractTreePath(nodes : Array, result : Array) { + if (nodes.length == 0) { + return + } + + const node = nodes[0] + result.push(node) + + const children = node.getArray('children') + if (Array.isArray(children) && children!.length > 0) { + this._extractTreePath(children, result) + } + } + } +}) diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.css b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.css new file mode 100644 index 0000000..39fe1c3 --- /dev/null +++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.css @@ -0,0 +1,76 @@ +.uni-data-pickerview { + position: relative; + flex-direction: column; + overflow: hidden; +} + +.loading-cover { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + align-items: center; + justify-content: center; + background-color: rgba(150, 150, 150, .1); +} + +.error { + background-color: #fff; + padding: 15px; +} + +.error-text { + color: #DD524D; +} + +.selected-node-list { + flex-direction: row; + flex-wrap: nowrap; +} + +.selected-node-item { + margin-left: 10px; + margin-right: 10px; + padding: 8px 10px 8px 10px; + border-bottom: 2px solid transparent; +} + +.selected-node-item-active { + color: #007aff; + border-bottom-color: #007aff; +} + +.list-view { + flex: 1; +} + +.list-item { + flex-direction: row; + justify-content: space-between; + padding: 12px 15px; + border-bottom: 1px solid #f0f0f0; +} + +.item-text { + color: #333333; +} + +.item-text-disabled { + opacity: .5; +} + +.item-text-overflow { + overflow: hidden; +} + +.check { + margin-right: 5px; + border: 2px solid #007aff; + border-left: 0; + border-top: 0; + height: 12px; + width: 6px; + transform-origin: center; + transform: rotate(45deg); +} diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.uvue b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.uvue new file mode 100644 index 0000000..f4780f3 --- /dev/null +++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.uvue @@ -0,0 +1,69 @@ + + + + + diff --git a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue index e79f9bd..6ebced9 100644 --- a/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue +++ b/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue @@ -2,25 +2,27 @@ - - + + + {{item[map.text]}} + + + diff --git a/uni_modules/uni-data-picker/package.json b/uni_modules/uni-data-picker/package.json index 7b731fc..ba69c67 100644 --- a/uni_modules/uni-data-picker/package.json +++ b/uni_modules/uni-data-picker/package.json @@ -1,7 +1,7 @@ { "id": "uni-data-picker", "displayName": "uni-data-picker 数据驱动的picker选择器", - "version": "1.0.8", + "version": "2.0.2", "description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景", "keywords": [ "uni-ui", @@ -48,12 +48,15 @@ "platforms": { "cloud": { "tcb": "y", - "aliyun": "y" + "aliyun": "y", + "alipay": "n" }, "client": { "App": { - "app-vue": "y", - "app-nvue": "u" + "app-vue": "y", + "app-nvue": "y", + "app-uvue": "y", + "app-harmony": "u" }, "H5-mobile": { "Safari": "y", @@ -87,4 +90,4 @@ } } } -} \ No newline at end of file +} diff --git a/uni_modules/uni-data-picker/readme.md b/uni_modules/uni-data-picker/readme.md index 6cda224..19dd0e8 100644 --- a/uni_modules/uni-data-picker/readme.md +++ b/uni_modules/uni-data-picker/readme.md @@ -19,4 +19,4 @@ 在uniCloud数据表中新建表“uni-id-address”和“opendb-city-china”,这2个表的schema自带foreignKey关联。在“uni-id-address”表的表结构页面使用schema2code生成前端页面,会自动生成地址管理的维护页面,自动从“opendb-city-china”表包含的中国所有省市区信息里选择地址。 ### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-picker) -#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-data-select/changelog.md b/uni_modules/uni-data-select/changelog.md index 9e48c69..1681eae 100644 --- a/uni_modules/uni-data-select/changelog.md +++ b/uni_modules/uni-data-select/changelog.md @@ -1,3 +1,32 @@ +## 1.1.0(2025-08-19) +- 新增 插槽 selected empty option +- 新增 mutiple 属性,支持多选功能 +- 新增 wrap 属性,支持选中的文字超过一行显示 +- 新增 align 属性,支持修改选中的文字显示的位置 +- 新增 hideRight 属性,支持隐藏右侧所有按钮 +- 新增 mode 属性,支持修改边框样式 +- 新增 事件 open close clear +## 1.0.10(2025-04-14) +- 修复 清除按钮不展示问题 +## 1.0.9(2025-03-26) +- 优化 默认背景为白色与整体组件保持风格统一 +## 1.0.8(2024-03-28) +- 修复 在vue2下:style动态绑定导致编译失败的bug +## 1.0.7(2024-01-20) +- 修复 长文本回显超过容器的bug,超过容器部分显示省略号 +## 1.0.6(2023-04-12) +- 修复 微信小程序点击时会改变背景颜色的 bug +## 1.0.5(2023-02-03) +- 修复 禁用时会显示清空按钮 +## 1.0.4(2023-02-02) +- 优化 查询条件短期内多次变更只查询最后一次变更后的结果 +- 调整 内部缓存键名调整为 uni-data-select-lastSelectedValue +## 1.0.3(2023-01-16) +- 修复 不关联服务空间报错的问题 +## 1.0.2(2023-01-14) +- 新增 属性 `format` 可用于格式化显示选项内容 +## 1.0.1(2022-12-06) +- 修复 当where变化时,数据不会自动更新的问题 ## 0.1.9(2022-09-05) - 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框 ## 0.1.8(2022-08-29) diff --git a/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue b/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue index 919ffe3..85b2d7b 100644 --- a/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue +++ b/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue @@ -2,27 +2,59 @@ {{label + ':'}} - - - {{current}} - {{typePlaceholder}} - - + + + + + + + + + + + + - - - - - {{emptyTips}} - - - {{formatItemName(item)}} - - - + + + + + + + + + @@ -33,27 +65,55 @@ * DataChecklist 数据选择器 * @description 通过数据渲染的下拉框组件 * @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select - * @property {String} value 默认值 + * @property {String|Array} value 默认值,多选时为数组 * @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}] * @property {Boolean} clear 是否可以清空已选项 * @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效 * @property {String} label 左侧标题 * @property {String} placeholder 输入框的提示文字 * @property {Boolean} disabled 是否禁用 + * @property {Boolean} multiple 是否多选模式 + * @property {Boolean} wrap 是否允许选中文本换行显示 + * @property {String} placement 弹出位置 + * @value top 顶部弹出 + * @value bottom 底部弹出(default) + * @property {String} align 选择文字的位置 + * @value left 显示左侧 + * @value center 显示中间 + * @value right 显示 右侧 + * @property {Boolean} hideRight 是否隐藏右侧按钮 + * @property {String} mode 边框样式 + * @value default 四周边框 + * @value underline 下边框 + * @value none 无边框 * @event {Function} change 选中发生变化触发 + * @event {Function} open 选择框开启时触发 + * @event {Function} close 选择框关闭时触发 + * @event {Function} clear 点击清除按钮之后触发 */ export default { - name: "uni-stat-select", + name: "uni-data-select", mixins: [uniCloud.mixinDatacom || {}], - data() { - return { - showSelector: false, - current: '', - mixinDatacomResData: [], - apps: [], - channels: [] - }; + emits: [ + 'open', + 'close', + 'update:modelValue', + 'input', + 'clear', + 'change' + ], + model: { + prop: 'modelValue', + event: 'update:modelValue' + }, + options: { + // #ifdef MP-TOUTIAO + virtualHost: false, + // #endif + // #ifndef MP-TOUTIAO + virtualHost: true + // #endif }, props: { localdata: { @@ -63,11 +123,11 @@ } }, value: { - type: [String, Number], + type: [String, Number, Array], default: '' }, modelValue: { - type: [String, Number], + type: [String, Number, Array], default: '' }, label: { @@ -90,15 +150,56 @@ type: Number, default: 0 }, - disabled: { + disabled: { type: Boolean, default: false - } + }, + // 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}" + format: { + type: String, + default: '' + }, + placement: { + type: String, + default: 'bottom' + }, + multiple: { + type: Boolean, + default: false + }, + wrap: { + type: Boolean, + default: false + }, + align:{ + type: String, + default: "left" + }, + hideRight: { + type: Boolean, + default: false + }, + mode:{ + type: String, + default: 'default' + } + }, + data() { + return { + showSelector: false, + current: '', + mixinDatacomResData: [], + apps: [], + channels: [], + cacheKey: "uni-data-select-lastSelectedValue", + }; }, created() { - this.last = `${this.collection}_last_selected_option_value` + this.debounceGet = this.debounce(() => { + this.query(); + }, 300); if (this.collection && !this.localdata.length) { - this.mixinDatacomEasyGet() + this.debounceGet(); } }, computed: { @@ -113,9 +214,77 @@ return placeholder ? common + placeholder : common + }, + valueCom() { + if (this.value === '') return this.modelValue + if (this.modelValue === '') return this.value + return this.value + }, + textShow() { + // 长文本显示 + if (this.multiple) { + const currentValues = this.getCurrentValues(); + if (Array.isArray(currentValues) && currentValues.length > 0) { + const selectedItems = this.mixinDatacomResData.filter(item => currentValues.includes(item.value)); + return selectedItems.map(item => this.formatItemName(item)).join(', '); + } else { + return ''; // 空数组时返回空字符串,显示占位符 + } + } else { + return this.current; + } + }, + shouldShowClear() { + if (this.multiple) { + const currentValues = this.getCurrentValues(); + return Array.isArray(currentValues) && currentValues.length > 0; + } else { + return !!this.current; + } + }, + shouldWrap() { + // 只有在多选模式、开启换行、且有内容时才应用换行样式 + return this.multiple && this.wrap && !!this.textShow; + }, + getOffsetByPlacement() { + switch (this.placement) { + case 'top': + return "bottom:calc(100% + 12px);"; + case 'bottom': + return "top:calc(100% + 12px);"; + } + }, + slotSelected(){ + // #ifdef VUE2 + return this.$scopedSlots ? this.$scopedSlots.selected : false + // #endif + // #ifdef VUE3 + return this.$slots ? this.$slots.selected : false + // #endif + }, + slotEmpty(){ + // #ifdef VUE2 + return this.$scopedSlots ? this.$scopedSlots.empty : false + // #endif + // #ifdef VUE3 + return this.$slots ? this.$slots.empty : false + // #endif + }, + slotOption(){ + // #ifdef VUE2 + return this.$scopedSlots ? this.$scopedSlots.option : false + // #endif + // #ifdef VUE3 + return this.$slots ? this.$slots.option : false + // #endif } }, watch: { + showSelector:{ + handler(val,old){ + val ? this.$emit('open') : this.$emit('close') + } + }, localdata: { immediate: true, handler(val, old) { @@ -124,16 +293,9 @@ } } }, - // #ifndef VUE3 - value() { + valueCom(val, old) { this.initDefVal() }, - // #endif - // #ifdef VUE3 - modelValue() { - this.initDefVal() - }, - // #endif mixinDatacomResData: { immediate: true, handler(val) { @@ -141,77 +303,182 @@ this.initDefVal() } } - } + }, }, methods: { + getSelectedItems() { + const currentValues = this.getCurrentValues(); + let _minxData = this.mixinDatacomResData + // #ifdef MP-WEIXIN || MP-TOUTIAO + _minxData = JSON.parse(JSON.stringify(this.mixinDatacomResData)) + // #endif + if (this.multiple) { + return _minxData.filter(item => currentValues.includes(item.value)) || []; + } else { + return _minxData.filter(item => item.value === currentValues) || []; + } + }, + debounce(fn, time = 100) { + let timer = null + return function(...args) { + if (timer) clearTimeout(timer) + timer = setTimeout(() => { + fn.apply(this, args) + }, time) + } + }, + // 检查项目是否已选中 + isSelected(item) { + if (this.multiple) { + const currentValues = this.getCurrentValues(); + return Array.isArray(currentValues) && currentValues.includes(item.value); + } else { + return this.getCurrentValues() === item.value; + } + }, + // 获取当前选中的值 + getCurrentValues() { + if (this.multiple) { + return Array.isArray(this.valueCom) ? this.valueCom : (this.valueCom ? [this.valueCom] : []); + } else { + return this.valueCom; + } + }, + // 执行数据库查询 + query() { + this.mixinDatacomEasyGet(); + }, + // 监听查询条件变更事件 + onMixinDatacomPropsChange() { + if (this.collection) { + this.debounceGet(); + } + }, initDefVal() { - let defValue = '' - if ((this.value || this.value === 0) && !this.isDisabled(this.value)) { - defValue = this.value - } else if ((this.modelValue || this.modelValue === 0) && !this.isDisabled(this.modelValue)) { - defValue = this.modelValue + let defValue = this.multiple ? [] : '' + if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) { + defValue = this.valueCom } else { let strogeValue if (this.collection) { - strogeValue = uni.getStorageSync(this.last) + strogeValue = this.getCache() } if (strogeValue || strogeValue === 0) { defValue = strogeValue } else { - let defItem = '' - if (this.defItem > 0 && this.defItem < this.mixinDatacomResData.length) { - defItem = this.mixinDatacomResData[this.defItem - 1].value + let defItem = this.multiple ? [] : '' + if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) { + defItem = this.multiple ? [this.mixinDatacomResData[this.defItem - 1].value] : this.mixinDatacomResData[this.defItem - 1].value } defValue = defItem } - this.emit(defValue) + if (defValue || defValue === 0 || (this.multiple && Array.isArray(defValue) && defValue.length > 0)) { + this.emit(defValue) + } + } + + if (this.multiple) { + const selectedValues = Array.isArray(defValue) ? defValue : (defValue ? [defValue] : []); + const selectedItems = this.mixinDatacomResData.filter(item => selectedValues.includes(item.value)); + this.current = selectedItems.map(item => this.formatItemName(item)); + } else { + const def = this.mixinDatacomResData.find(item => item.value === defValue) + this.current = def ? this.formatItemName(def) : '' } - const def = this.mixinDatacomResData.find(item => item.value === defValue) - this.current = def ? this.formatItemName(def) : '' }, /** - * @param {[String, Number]} value + * @param {[String, Number, Array]} value * 判断用户给的 value 是否同时为禁用状态 */ isDisabled(value) { - let isDisabled = false; - - this.mixinDatacomResData.forEach(item => { - if (item.value === value) { - isDisabled = item.disable - } - }) - - return isDisabled; - }, - - clearVal() { - this.emit('') - if (this.collection) { - uni.removeStorageSync(this.last) + if (Array.isArray(value)) { + // 对于数组,如果任意一个值被禁用,则认为整体被禁用 + return value.some(val => { + return this.mixinDatacomResData.some(item => item.value === val && item.disable); + }); + } else { + let isDisabled = false; + this.mixinDatacomResData.forEach(item => { + if (item.value === value) { + isDisabled = item.disable + } + }) + return isDisabled; } }, + clearVal() { + const emptyValue = this.multiple ? [] : ''; + this.emit(emptyValue) + this.current = this.multiple ? [] : '' + if (this.collection) { + this.removeCache() + } + this.$emit('clear') + }, + checkBoxChange(res){ + let range = res.detail.value + + let currentValues = range && range.length > 0? range.map((item)=>{ + const index = parseInt(item, 10); + + if (isNaN(index)) { + console.error(`无效索引: ${item}`); + } + + if (index < 0 || index >= this.mixinDatacomResData.length) { + console.error(`索引越界: ${index}`); + } + + return this.mixinDatacomResData[index].value; + }) : [] + const selectedItems = this.mixinDatacomResData.filter(dataItem => currentValues.includes(dataItem.value)); + this.current = selectedItems.map(dataItem => this.formatItemName(dataItem)); + + this.emit(currentValues); + }, change(item) { if (!item.disable) { - this.showSelector = false - this.current = this.formatItemName(item) - this.emit(item.value) + if (this.multiple) { + // 多选模式 + let currentValues = this.getCurrentValues(); + if (!Array.isArray(currentValues)) { + currentValues = currentValues ? [currentValues] : []; + } + + const itemValue = item.value; + const index = currentValues.indexOf(itemValue); + + if (index > -1) { + currentValues.splice(index, 1); + } else { + currentValues.push(itemValue); + } + + const selectedItems = this.mixinDatacomResData.filter(dataItem => currentValues.includes(dataItem.value)); + this.current = selectedItems.map(dataItem => this.formatItemName(dataItem)); + + this.emit(currentValues); + } else { + // 单选模式 + this.showSelector = false + this.current = this.formatItemName(item) + this.emit(item.value) + } } }, emit(val) { - this.$emit('change', val) this.$emit('input', val) this.$emit('update:modelValue', val) + this.$emit('change', val) if (this.collection) { - uni.setStorageSync(this.last, val) + this.setCache(val); } }, - toggleSelector() { - if(this.disabled){ - return - } + if (this.disabled) { + return + } this.showSelector = !this.showSelector }, @@ -222,14 +489,50 @@ channel_code } = item channel_code = channel_code ? `(${channel_code})` : '' - return this.collection.indexOf('app-list') > 0 ? - `${text}(${value})` : - ( - text ? - text : - `未命名${channel_code}` - ) - } + + if (this.format) { + // 格式化输出 + let str = ""; + str = this.format; + for (let key in item) { + str = str.replace(new RegExp(`{${key}}`, "g"), item[key]); + } + return str; + } else { + return this.collection.indexOf('app-list') > 0 ? + `${text}(${value})` : + ( + text ? + text : + `未命名${channel_code}` + ) + } + }, + // 获取当前加载的数据 + getLoadData() { + return this.mixinDatacomResData; + }, + // 获取当前缓存key + getCurrentCacheKey() { + return this.collection; + }, + // 获取缓存 + getCache(name = this.getCurrentCacheKey()) { + let cacheData = uni.getStorageSync(this.cacheKey) || {}; + return cacheData[name]; + }, + // 设置缓存 + setCache(value, name = this.getCurrentCacheKey()) { + let cacheData = uni.getStorageSync(this.cacheKey) || {}; + cacheData[name] = value; + uni.setStorageSync(this.cacheKey, cacheData); + }, + // 删除缓存 + removeCache(name = this.getCurrentCacheKey()) { + let cacheData = uni.getStorageSync(this.cacheKey) || {}; + delete cacheData[name]; + uni.setStorageSync(this.cacheKey, cacheData); + }, } } @@ -239,7 +542,11 @@ $uni-main-color: #333 !default; $uni-secondary-color: #909399 !default; $uni-border-3: #e5e5e5; - + $uni-primary: #2979ff !default; + $uni-success: #4cd964 !default; + $uni-warning: #f0ad4e !default; + $uni-error: #dd524d !default; + $uni-info: #909399 !default; /* #ifndef APP-NVUE */ @media screen and (max-width: 500px) { @@ -253,13 +560,16 @@ display: flex; align-items: center; // padding: 15px; + /* #ifdef H5 */ cursor: pointer; + /* #endif */ width: 100%; flex: 1; box-sizing: border-box; } .uni-stat-box { + background-color: #fff; width: 100%; flex: 1; } @@ -278,9 +588,16 @@ margin-right: 5px; } + .border-bottom { + border-bottom: solid 1px $uni-border-3; + } + + .border-default { + border: 1px solid $uni-border-3; + } + .uni-select { font-size: 14px; - border: 1px solid $uni-border-3; box-sizing: border-box; border-radius: 4px; padding: 0 5px; @@ -292,15 +609,20 @@ /* #endif */ flex-direction: row; align-items: center; - border-bottom: solid 1px $uni-border-3; width: 100%; flex: 1; - height: 35px; + min-height: 35px; - &--disabled{ - background-color: #f5f7fa; - cursor: not-allowed; - } + &--disabled { + background-color: #f5f7fa; + cursor: not-allowed; + } + + &--wrap { + height: auto; + min-height: 35px; + // align-items: flex-start; + } } .uni-select__label { @@ -312,7 +634,8 @@ } .uni-select__input-box { - height: 35px; + // height: 35px; + width: 0px; position: relative; /* #ifndef APP-NVUE */ display: flex; @@ -320,6 +643,24 @@ flex: 1; flex-direction: row; align-items: center; + + &--wrap { + .uni-select__input-text { + margin-right: 8px; + } + } + + .padding-top-bottom { + padding-top: 5px; + padding-bottom: 5px; + } + + .slot-content { + width: 100%; + display: flex; + flex-direction: row; + flex-wrap: wrap; + } } .uni-select__input { @@ -339,7 +680,6 @@ box-sizing: border-box; /* #endif */ position: absolute; - top: calc(100% + 12px); left: 0; width: 100%; background-color: #FFFFFF; @@ -357,21 +697,33 @@ /* #endif */ } + /* #ifdef H5 */ + @media (min-width: 768px) { + .uni-select__selector-scroll { + max-height: 600px; + } + } + + /* #endif */ + .uni-select__selector-empty, .uni-select__selector-item { /* #ifndef APP-NVUE */ display: flex; cursor: pointer; /* #endif */ + flex-direction: row; + align-items: center; line-height: 35px; font-size: 14px; - text-align: center; /* border-bottom: solid 1px $uni-border-3; */ padding: 0px 10px; } - .uni-select__selector-item:hover { - background-color: #f9f9f9; + + + .uni-select__selector-item-check { + margin-left: auto; } .uni-select__selector-empty:last-child, @@ -387,8 +739,10 @@ } /* picker 弹出层通用的指示小三角 */ - .uni-popper__arrow, - .uni-popper__arrow::after { + .uni-popper__arrow_bottom, + .uni-popper__arrow_bottom::after, + .uni-popper__arrow_top, + .uni-popper__arrow_top::after { position: absolute; display: block; width: 0; @@ -398,7 +752,7 @@ border-width: 6px; } - .uni-popper__arrow { + .uni-popper__arrow_bottom { filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03)); top: -6px; left: 10%; @@ -407,7 +761,7 @@ border-bottom-color: #EBEEF5; } - .uni-popper__arrow::after { + .uni-popper__arrow_bottom::after { content: " "; top: 1px; margin-left: -6px; @@ -415,6 +769,24 @@ border-bottom-color: #fff; } + .uni-popper__arrow_top { + filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03)); + bottom: -6px; + left: 10%; + margin-right: 3px; + border-bottom-width: 0; + border-top-color: #EBEEF5; + } + + .uni-popper__arrow_top::after { + content: " "; + bottom: 1px; + margin-left: -6px; + border-bottom-width: 0; + border-top-color: #fff; + } + + .uni-select__input-text { // width: 280px; width: 100%; @@ -423,11 +795,22 @@ text-overflow: ellipsis; -o-text-overflow: ellipsis; overflow: hidden; + + &--wrap { + white-space: normal; + text-overflow: initial; + -o-text-overflow: initial; + overflow: visible; + word-wrap: break-word; + word-break: break-all; + // line-height: 1.5; + } } .uni-select__input-placeholder { color: $uni-base-color; font-size: 12px; + margin: 1px 0; } .uni-select--mask { @@ -436,5 +819,19 @@ bottom: 0; right: 0; left: 0; + z-index: 2; } + + .align-left { + text-align: left; + } + + .align-center { + text-align: center; + } + + .align-right { + text-align: right; + } + diff --git a/uni_modules/uni-data-select/package.json b/uni_modules/uni-data-select/package.json index 2a203ca..4033502 100644 --- a/uni_modules/uni-data-select/package.json +++ b/uni_modules/uni-data-select/package.json @@ -1,7 +1,7 @@ { "id": "uni-data-select", "displayName": "uni-data-select 下拉框选择器", - "version": "0.1.9", + "version": "1.1.0", "description": "通过数据驱动的下拉框选择器", "keywords": [ "uni-ui", @@ -12,12 +12,14 @@ ], "repository": "https://github.com/dcloudio/uni-ui", "engines": { - "HBuilderX": "^3.1.1" + "HBuilderX": "^3.1.1", + "uni-app": "^4.45", + "uni-app-x": "" }, "directories": { "example": "../../temps/example_temps" }, -"dcloudext": { + "dcloudext": { "sale": { "regular": { "price": "0.00" @@ -35,51 +37,70 @@ "permissions": "无" }, "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", - "type": "component-vue" + "type": "component-vue", + "darkmode": "x", + "i18n": "x", + "widescreen": "x" }, "uni_modules": { - "dependencies": ["uni-load-more"], + "dependencies": [ + "uni-load-more" + ], "encrypt": [], "platforms": { "cloud": { - "tcb": "y", - "aliyun": "y" + "tcb": "√", + "aliyun": "√", + "alipay": "√" }, "client": { - "App": { - "app-vue": "u", - "app-nvue": "n" + "uni-app": { + "vue": { + "vue2": "√", + "vue3": "√" + }, + "web": { + "safari": "√", + "chrome": "√" + }, + "app": { + "vue": "√", + "nvue": "-", + "android": "√", + "ios": "√", + "harmony": "√" + }, + "mp": { + "weixin": "√", + "alipay": "√", + "toutiao": "√", + "baidu": "-", + "kuaishou": "-", + "jd": "-", + "harmony": "-", + "qq": "-", + "lark": "-" + }, + "quickapp": { + "huawei": "-", + "union": "-" + } }, - "H5-mobile": { - "Safari": "y", - "Android Browser": "y", - "微信浏览器(Android)": "y", - "QQ浏览器(Android)": "y" - }, - "H5-pc": { - "Chrome": "y", - "IE": "y", - "Edge": "y", - "Firefox": "y", - "Safari": "y" - }, - "小程序": { - "微信": "y", - "阿里": "u", - "百度": "u", - "字节跳动": "u", - "QQ": "u", - "京东": "u" - }, - "快应用": { - "华为": "u", - "联盟": "u" - }, - "Vue": { - "vue2": "y", - "vue3": "y" + "uni-app-x": { + "web": { + "safari": "-", + "chrome": "-" + }, + "app": { + "android": "-", + "ios": "-", + "harmony": "-" + }, + "mp": { + "weixin": "-" + } } } } } -} +} \ No newline at end of file diff --git a/uni_modules/uni-datetime-picker/changelog.md b/uni_modules/uni-datetime-picker/changelog.md index 9f09862..1eee75e 100644 --- a/uni_modules/uni-datetime-picker/changelog.md +++ b/uni_modules/uni-datetime-picker/changelog.md @@ -1,41 +1,111 @@ +## 2.2.42(2025-08-20) +- 修复 datetime-picker 小程序样式警告 +## 2.2.41(2025-08-20) +- 修复 uni-datetime-picker组件时间对比报错问题 +## 2.2.40(2025-04-14) +- 修复 绑定字符串值的时,日历面板选中状态未重置到默认值的问题 +## 2.2.39(2025-04-14) +- 修复 在 iOS 微信小程序上type='daterange'时,传入'YYYY-MM-DD'格式不生效的问题 + +## 2.2.38(2024-10-15) +- 修复 微信小程序中的getSystemInfo警告 +## 2.2.35(2024-09-21) +- 修复 没有选中日期时点击确定直接报错的Bug [详情](https://ask.dcloud.net.cn/question/198168) +## 2.2.34(2024-04-24) +- 新增 日期点击事件,在点击日期时会触发该事件。 +## 2.2.33(2024-04-15) +- 修复 抖音小程序事件传递失效bug +## 2.2.32(2024-02-20) +- 修复 日历的close事件触发异常的bug [详情](https://github.com/dcloudio/uni-ui/issues/844) +## 2.2.31(2024-02-20) +- 修复 h5平台 右边日历的月份默认+1的bug [详情](https://github.com/dcloudio/uni-ui/issues/841) +## 2.2.30(2024-01-31) +- 修复 隐藏“秒”时,在IOS15及以下版本时出现 结束时间在开始时间之前 的bug [详情](https://github.com/dcloudio/uni-ui/issues/788) +## 2.2.29(2024-01-20) +- 新增 show事件,弹窗弹出时触发该事件 [详情](https://github.com/dcloudio/uni-app/issues/4694) +## 2.2.28(2024-01-18) +- 去除 noChange事件,当进行日期范围选择时,若只选了一天,则开始结束日期都为同一天 [详情](https://github.com/dcloudio/uni-ui/issues/815) +## 2.2.27(2024-01-10) +- 优化 增加noChange事件,当进行日期范围选择时,若有空值,则触发该事件 [详情](https://github.com/dcloudio/uni-ui/issues/815) +## 2.2.26(2024-01-08) +- 修复 字节小程序时间选择范围器失效问题 [详情](https://github.com/dcloudio/uni-ui/issues/834) +## 2.2.25(2023-10-18) +- 修复 PC端初次修改时间,开始时间未更新的Bug [详情](https://github.com/dcloudio/uni-ui/issues/737) +## 2.2.24(2023-06-02) +- 修复 部分情况修改时间,开始、结束时间显示异常的Bug [详情](https://ask.dcloud.net.cn/question/171146) +- 优化 当前月可以选择上月、下月的日期的Bug +## 2.2.23(2023-05-02) +- 修复 部分情况修改时间,开始时间未更新的Bug [详情](https://github.com/dcloudio/uni-ui/issues/737) +- 修复 部分平台及设备第一次点击无法显示弹框的Bug +- 修复 ios 日期格式未补零显示及使用异常的Bug [详情](https://ask.dcloud.net.cn/question/162979) +## 2.2.22(2023-03-30) +- 修复 日历 picker 修改年月后,自动选中当月1日的Bug [详情](https://ask.dcloud.net.cn/question/165937) +- 修复 小程序端 低版本 ios NaN的Bug [详情](https://ask.dcloud.net.cn/question/162979) +## 2.2.21(2023-02-20) +- 修复 firefox 浏览器显示区域点击无法拉起日历弹框的Bug [详情](https://ask.dcloud.net.cn/question/163362) +## 2.2.20(2023-02-17) +- 优化 值为空依然选中当天问题 +- 优化 提供 default-value 属性支持配置选择器打开时默认显示的时间 +- 优化 非范围选择未选择日期时间,点击确认按钮选中当前日期时间 +- 优化 字节小程序日期时间范围选择,底部日期换行的Bug +## 2.2.19(2023-02-09) +- 修复 2.2.18 引起范围选择配置 end 选择无效的Bug [详情](https://github.com/dcloudio/uni-ui/issues/686) +## 2.2.18(2023-02-08) +- 修复 移动端范围选择change事件触发异常的Bug [详情](https://github.com/dcloudio/uni-ui/issues/684) +- 优化 PC端输入日期格式错误时返回当前日期时间 +- 优化 PC端输入日期时间超出 start、end 限制的Bug +- 优化 移动端日期时间范围用法时间展示不完整问题 +## 2.2.17(2023-02-04) +- 修复 小程序端绑定 Date 类型报错的Bug [详情](https://github.com/dcloudio/uni-ui/issues/679) +- 修复 vue3 time-picker 无法显示绑定时分秒的Bug +## 2.2.16(2023-02-02) +- 修复 字节小程序报错的Bug +## 2.2.15(2023-02-02) +- 修复 某些情况切换月份错误的Bug +## 2.2.14(2023-01-30) +- 修复 某些情况切换月份错误的Bug [详情](https://ask.dcloud.net.cn/question/162033) +## 2.2.13(2023-01-10) +- 修复 多次加载组件造成内存占用的Bug +## 2.2.12(2022-12-01) +- 修复 vue3 下 i18n 国际化初始值不正确的Bug ## 2.2.11(2022-09-19) -- 修复,支付宝小程序样式错乱,[详情](https://github.com/dcloudio/uni-app/issues/3861) +- 修复 支付宝小程序样式错乱的Bug [详情](https://github.com/dcloudio/uni-app/issues/3861) ## 2.2.10(2022-09-19) -- 修复,反向选择日期范围,日期显示异常,[详情](https://ask.dcloud.net.cn/question/153401?item_id=212892&rf=false) +- 修复 反向选择日期范围,日期显示异常的Bug [详情](https://ask.dcloud.net.cn/question/153401?item_id=212892&rf=false) ## 2.2.9(2022-09-16) - 可以使用 uni-scss 控制主题色 ## 2.2.8(2022-09-08) -- 修复 close事件无效的 bug +- 修复 close事件无效的Bug ## 2.2.7(2022-09-05) -- 修复 移动端 maskClick 无效的 bug,详见:[https://ask.dcloud.net.cn/question/140824?item_id=209458&rf=false](https://ask.dcloud.net.cn/question/140824?item_id=209458&rf=false) +- 修复 移动端 maskClick 无效的Bug [详情](https://ask.dcloud.net.cn/question/140824) ## 2.2.6(2022-06-30) - 优化 组件样式,调整了组件图标大小、高度、颜色等,与uni-ui风格保持一致 ## 2.2.5(2022-06-24) -- 修复 日历顶部年月及底部确认未国际化 bug +- 修复 日历顶部年月及底部确认未国际化的Bug ## 2.2.4(2022-03-31) -- 修复 Vue3 下动态赋值,单选类型未响应的 bug +- 修复 Vue3 下动态赋值,单选类型未响应的Bug ## 2.2.3(2022-03-28) -- 修复 Vue3 下动态赋值未响应的 bug +- 修复 Vue3 下动态赋值未响应的Bug ## 2.2.2(2021-12-10) -- 修复 clear-icon 属性在小程序平台不生效的 bug +- 修复 clear-icon 属性在小程序平台不生效的Bug ## 2.2.1(2021-12-10) -- 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的 bug +- 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的Bug ## 2.2.0(2021-11-19) -- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) -- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker) -## 2.1.5(2021-11-09) +- 优化 组件UI,并提供设计资源 [详情](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移 [https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker) +## 2.1.5(2021-11-09) - 新增 提供组件设计资源,组件样式调整 ## 2.1.4(2021-09-10) -- 修复 hide-second 在移动端的 bug -- 修复 单选赋默认值时,赋值日期未高亮的 bug -- 修复 赋默认值时,移动端未正确显示时间的 bug +- 修复 hide-second 在移动端的Bug +- 修复 单选赋默认值时,赋值日期未高亮的Bug +- 修复 赋默认值时,移动端未正确显示时间的Bug ## 2.1.3(2021-09-09) - 新增 hide-second 属性,支持只使用时分,隐藏秒 ## 2.1.2(2021-09-03) - 优化 取消选中时(范围选)直接开始下一次选择, 避免多点一次 - 优化 移动端支持清除按钮,同时支持通过 ref 调用组件的 clear 方法 - 优化 调整字号大小,美化日历界面 -- 修复 因国际化导致的 placeholder 失效的 bug +- 修复 因国际化导致的 placeholder 失效的Bug ## 2.1.1(2021-08-24) - 新增 支持国际化 - 优化 范围选择器在 pc 端过宽的问题 @@ -43,50 +113,50 @@ - 新增 适配 vue3 ## 2.0.19(2021-08-09) - 新增 支持作为 uni-forms 子组件相关功能 -- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的 bug +- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的Bug ## 2.0.18(2021-08-05) -- 修复 type 属性动态赋值无效的 bug +- 修复 type 属性动态赋值无效的Bug - 修复 ‘确认’按钮被 tabbar 遮盖 bug -- 修复 组件未赋值时范围选左、右日历相同的 bug +- 修复 组件未赋值时范围选左、右日历相同的Bug ## 2.0.17(2021-08-04) -- 修复 范围选未正确显示当前值的 bug -- 修复 h5 平台(移动端)报错 'cale' of undefined 的 bug +- 修复 范围选未正确显示当前值的Bug +- 修复 h5 平台(移动端)报错 'cale' of undefined 的Bug ## 2.0.16(2021-07-21) - 新增 return-type 属性支持返回 date 日期对象 ## 2.0.15(2021-07-14) -- 修复 单选日期类型,初始赋值后不在当前日历的 bug +- 修复 单选日期类型,初始赋值后不在当前日历的Bug - 新增 clearIcon 属性,显示框的清空按钮可配置显示隐藏(仅 pc 有效) - 优化 移动端移除显示框的清空按钮,无实际用途 ## 2.0.14(2021-07-14) -- 修复 组件赋值为空,界面未更新的 bug -- 修复 start 和 end 不能动态赋值的 bug -- 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的 bug +- 修复 组件赋值为空,界面未更新的Bug +- 修复 start 和 end 不能动态赋值的Bug +- 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的Bug ## 2.0.13(2021-07-08) -- 修复 范围选择不能动态赋值的 bug +- 修复 范围选择不能动态赋值的Bug ## 2.0.12(2021-07-08) - 修复 范围选择的初始时间在一个月内时,造成无法选择的bug ## 2.0.11(2021-07-08) - 优化 弹出层在超出视窗边缘定位不准确的问题 ## 2.0.10(2021-07-08) -- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的 bug +- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的Bug - 优化 弹出层在超出视窗边缘被遮盖的问题 ## 2.0.9(2021-07-07) - 新增 maskClick 事件 -- 修复 特殊情况日历 rpx 布局错误的 bug,rpx -> px +- 修复 特殊情况日历 rpx 布局错误的Bug,rpx -> px - 修复 范围选择时清空返回值不合理的bug,['', ''] -> [] ## 2.0.8(2021-07-07) - 新增 日期时间显示框支持插槽 ## 2.0.7(2021-07-01) - 优化 添加 uni-icons 依赖 ## 2.0.6(2021-05-22) -- 修复 图标在小程序上不显示的 bug +- 修复 图标在小程序上不显示的Bug - 优化 重命名引用组件,避免潜在组件命名冲突 ## 2.0.5(2021-05-20) - 优化 代码目录扁平化 ## 2.0.4(2021-05-12) - 新增 组件示例地址 ## 2.0.3(2021-05-10) -- 修复 ios 下不识别 '-' 日期格式的 bug +- 修复 ios 下不识别 '-' 日期格式的Bug - 优化 pc 下弹出层添加边框和阴影 ## 2.0.2(2021-05-08) - 修复 在 admin 中获取弹出层定位错误的bug @@ -97,7 +167,7 @@ > 注意:此版本不向后兼容,不再支持单独时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker) ## 1.0.6(2021-03-18) - 新增 hide-second 属性,时间支持仅选择时、分 -- 修复 选择跟显示的日期不一样的 bug -- 修复 chang事件触发2次的 bug -- 修复 分、秒 end 范围错误的 bug +- 修复 选择跟显示的日期不一样的Bug +- 修复 chang事件触发2次的Bug +- 修复 分、秒 end 范围错误的Bug - 优化 更好的 nvue 适配 diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue index a2201d3..dba9887 100644 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue @@ -13,10 +13,10 @@ 'uni-calendar-item--after-checked':weeks.afterMultiple, 'uni-calendar-item--disable':weeks.disable, }"> - + {{weeks.date}} - + @@ -41,10 +41,6 @@ return [] } }, - lunar: { - type: Boolean, - default: false - }, checkHover: { type: Boolean, default: false @@ -83,11 +79,6 @@ color: darken($color: $uni-primary, $amount: 40%); } - .uni-calendar-item__weeks-lunar-text { - font-size: 12px; - color: #333; - } - .uni-calendar-item__weeks-box-item { position: relative; /* #ifndef APP-NVUE */ @@ -116,7 +107,6 @@ } .uni-calendar-item__weeks-box .uni-calendar-item--disable { - // background-color: rgba(249, 249, 249, $uni-opacity-disabled); cursor: default; } @@ -124,7 +114,7 @@ color: #D1D1D1; } - .uni-calendar-item--isDay { + .uni-calendar-item--today { position: absolute; top: 10px; right: 17%; diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue index b376470..0f9e121 100644 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue @@ -1,31 +1,37 @@ - diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json index 9acf1ab..024f22f 100644 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json @@ -1,7 +1,7 @@ { "uni-datetime-picker.selectDate": "select date", "uni-datetime-picker.selectTime": "select time", - "uni-datetime-picker.selectDateTime": "select datetime", + "uni-datetime-picker.selectDateTime": "select date and time", "uni-datetime-picker.startDate": "start date", "uni-datetime-picker.endDate": "end date", "uni-datetime-picker.startTime": "start time", diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue index b4ba172..1817692 100644 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue @@ -77,21 +77,20 @@ - - - - diff --git a/uni_modules/uni-easyinput/package.json b/uni_modules/uni-easyinput/package.json index af8cf5c..00de64a 100644 --- a/uni_modules/uni-easyinput/package.json +++ b/uni_modules/uni-easyinput/package.json @@ -1,7 +1,7 @@ { "id": "uni-easyinput", "displayName": "uni-easyinput 增强输入框", - "version": "1.1.4", + "version": "1.1.22", "description": "Easyinput 组件是对原生input组件的增强", "keywords": [ "uni-ui", @@ -12,12 +12,14 @@ ], "repository": "https://github.com/dcloudio/uni-ui", "engines": { - "HBuilderX": "" + "HBuilderX": "", + "uni-app": "^4.07", + "uni-app-x": "" }, "directories": { "example": "../../temps/example_temps" }, -"dcloudext": { + "dcloudext": { "sale": { "regular": { "price": "0.00" @@ -35,51 +37,69 @@ "permissions": "无" }, "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", - "type": "component-vue" + "type": "component-vue", + "darkmode": "x", + "i18n": "x", + "widescreen": "x" }, "uni_modules": { "dependencies": [ - "uni-scss", + "uni-scss", "uni-icons" ], "encrypt": [], "platforms": { "cloud": { - "tcb": "y", - "aliyun": "y" + "tcb": "x", + "aliyun": "x", + "alipay": "x" }, "client": { - "App": { - "app-vue": "y", - "app-nvue": "y" + "uni-app": { + "vue": { + "vue2": "√", + "vue3": "√" + }, + "web": { + "safari": "√", + "chrome": "√" + }, + "app": { + "vue": "√", + "nvue": "-", + "android": "√", + "ios": "√", + "harmony": "√" + }, + "mp": { + "weixin": "√", + "alipay": "√", + "toutiao": "√", + "baidu": "√", + "kuaishou": "√", + "jd": "√", + "harmony": "√", + "qq": "√", + "lark": "-" + }, + "quickapp": { + "huawei": "-", + "union": "-" + } }, - "H5-mobile": { - "Safari": "y", - "Android Browser": "y", - "微信浏览器(Android)": "y", - "QQ浏览器(Android)": "y" - }, - "H5-pc": { - "Chrome": "y", - "IE": "y", - "Edge": "y", - "Firefox": "y", - "Safari": "y" - }, - "小程序": { - "微信": "y", - "阿里": "y", - "百度": "y", - "字节跳动": "y", - "QQ": "y" - }, - "快应用": { - "华为": "u", - "联盟": "u" - }, - "Vue": { - "vue2": "y", - "vue3": "y" + "uni-app-x": { + "web": { + "safari": "-", + "chrome": "-" + }, + "app": { + "android": "-", + "ios": "-", + "harmony": "-" + }, + "mp": { + "weixin": "-" + } } } } diff --git a/uni_modules/uni-fab/changelog.md b/uni_modules/uni-fab/changelog.md index 0048ff9..8a22807 100644 --- a/uni_modules/uni-fab/changelog.md +++ b/uni_modules/uni-fab/changelog.md @@ -1,3 +1,7 @@ +## 1.2.6(2024-10-12) +- 修复 微信小程序中的getSystemInfo警告 +## 1.2.5(2023-03-29) +- 新增 pattern.icon 属性,可自定义图标 ## 1.2.4(2022-09-07) 小程序端由于 style 使用了对象导致报错,[详情](https://ask.dcloud.net.cn/question/152790?item_id=211778&rf=false) ## 1.2.3(2022-09-05) diff --git a/uni_modules/uni-fab/components/uni-fab/uni-fab.vue b/uni_modules/uni-fab/components/uni-fab/uni-fab.vue index 509bd78..492b5d1 100644 --- a/uni_modules/uni-fab/components/uni-fab/uni-fab.vue +++ b/uni_modules/uni-fab/components/uni-fab/uni-fab.vue @@ -35,7 +35,7 @@ 'uni-fab__circle--rightTop': rightTop, 'uni-fab__content--other-platform': !isAndroidNvue }" class="uni-fab__circle uni-fab__plus" :style="{ 'background-color': styles.buttonColor, 'bottom': nvueBottom }" @click="_onClick"> - @@ -115,7 +115,8 @@ selectedColor: '#007AFF', backgroundColor: '#fff', buttonColor: '#007AFF', - iconColor: '#fff' + iconColor: '#fff', + icon: 'plusempty' } } }, @@ -163,8 +164,8 @@ }, // 计算 nvue bottom nvueBottom() { - const safeBottom = uni.getSystemInfoSync().windowBottom; // #ifdef APP-NVUE + const safeBottom = uni.getSystemInfoSync().windowBottom; return 30 + safeBottom // #endif // #ifndef APP-NVUE diff --git a/uni_modules/uni-fab/package.json b/uni_modules/uni-fab/package.json index 6636170..1b8543c 100644 --- a/uni_modules/uni-fab/package.json +++ b/uni_modules/uni-fab/package.json @@ -1,7 +1,7 @@ { "id": "uni-fab", "displayName": "uni-fab 悬浮按钮", - "version": "1.2.4", + "version": "1.2.6", "description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。", "keywords": [ "uni-ui", @@ -43,7 +43,8 @@ "platforms": { "cloud": { "tcb": "y", - "aliyun": "y" + "aliyun": "y", + "alipay": "n" }, "client": { "App": { diff --git a/uni_modules/uni-file-picker/changelog.md b/uni_modules/uni-file-picker/changelog.md index 5c81026..f829b7e 100644 --- a/uni_modules/uni-file-picker/changelog.md +++ b/uni_modules/uni-file-picker/changelog.md @@ -1,3 +1,29 @@ +## 1.1.2(2025-09-17) +- 修复 设置readonly属性后内容插槽失效的问题。 +## 1.1.1(2025-09-03) +- 修复 动态dir目录,不生效的问题 +## 1.1.0(2025-09-02) +- 新增 dir 属性,可以选择上传目录 +## 1.0.13(2025-08-18) +- 修复 删除文件后,返回信息不包含file对象的问题 +## 1.0.12(2025-04-14) +- 修复 支付宝小程序 上传样式问题 +## 1.0.10(2024-07-09) +- 优化 vue3兼容性 +## 1.0.9(2024-07-09) +- 修复 value 属性不兼容vue3的bug +## 1.0.8(2024-03-20) +- 补充 删除文件时返回文件下标 +## 1.0.7(2024-02-21) +- 新增 微信小程序选择视频时改用chooseMedia,并返回视频缩略图 +## 1.0.6(2024-01-06) +- 新增 微信小程序不再调用chooseImage,而是调用chooseMedia +## 1.0.5(2024-01-03) +- 新增 上传文件至云存储携带本地文件名称 +## 1.0.4(2023-03-29) +- 修复 手动上传删除一个文件后不能再上传的bug +## 1.0.3(2022-12-19) +- 新增 sourceType 属性, 可以自定义图片和视频选择的来源 ## 1.0.2(2022-07-04) - 修复 在uni-forms下样式不生效的bug ## 1.0.1(2021-11-23) diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js b/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js index 24a07f5..9c6bcdf 100644 --- a/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js +++ b/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js @@ -7,10 +7,32 @@ function chooseImage(opts) { const { count, sizeType = ['original', 'compressed'], - sourceType = ['album', 'camera'], + sourceType, extension } = opts return new Promise((resolve, reject) => { + // 微信由于旧接口不再维护,针对微信小程序平台改用chooseMedia接口 + // #ifdef MP-WEIXIN + uni.chooseMedia({ + count, + sizeType, + sourceType, + mediaType: ['image'], + extension, + success(res) { + res.tempFiles.forEach(item => { + item.path = item.tempFilePath; + }) + resolve(normalizeChooseAndUploadFileRes(res, 'image')); + }, + fail(res) { + reject({ + errMsg: res.errMsg.replace('chooseImage:fail', ERR_MSG_FAIL), + }); + }, + }) + // #endif + // #ifndef MP-WEIXIN uni.chooseImage({ count, sizeType, @@ -25,18 +47,60 @@ function chooseImage(opts) { }); }, }); + // #endif + }); } function chooseVideo(opts) { const { + count, camera, compressed, maxDuration, - sourceType = ['album', 'camera'], + sourceType, extension } = opts; return new Promise((resolve, reject) => { + // 微信由于旧接口不再维护,针对微信小程序平台改用chooseMedia接口 + // #ifdef MP-WEIXIN + uni.chooseMedia({ + count, + compressed, + maxDuration, + sourceType, + extension, + mediaType: ['video'], + success(res) { + const { + tempFiles, + } = res; + resolve(normalizeChooseAndUploadFileRes({ + errMsg: 'chooseVideo:ok', + tempFiles: tempFiles.map(item => { + return { + name: item.name || '', + path: item.tempFilePath, + thumbTempFilePath: item.thumbTempFilePath, + size:item.size, + type: (res.tempFile && res.tempFile.type) || '', + width:item.width, + height:item.height, + duration:item.duration, + fileType: 'video', + cloudPath: '', + } + }), + }, 'video')); + }, + fail(res) { + reject({ + errMsg: res.errMsg.replace('chooseVideo:fail', ERR_MSG_FAIL), + }); + }, + }) + // #endif + // #ifndef MP-WEIXIN uni.chooseVideo({ camera, compressed, @@ -54,8 +118,7 @@ function chooseVideo(opts) { resolve(normalizeChooseAndUploadFileRes({ errMsg: 'chooseVideo:ok', tempFilePaths: [tempFilePath], - tempFiles: [ - { + tempFiles: [{ name: (res.tempFile && res.tempFile.name) || '', path: tempFilePath, size, @@ -74,6 +137,7 @@ function chooseVideo(opts) { }); }, }); + // #endif }); } @@ -211,8 +275,7 @@ function chooseAndUploadFile(opts = { }) { if (opts.type === 'image') { return uploadFiles(chooseImage(opts), opts); - } - else if (opts.type === 'video') { + } else if (opts.type === 'video') { return uploadFiles(chooseVideo(opts), opts); } return uploadFiles(chooseAll(opts), opts); diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue b/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue index 0928a41..51f9e21 100644 --- a/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue +++ b/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue @@ -4,19 +4,13 @@ {{ title }} {{ filesList.length }}/{{ limitLength }} - + - - - - + + - +
@@ -89,24 +83,18 @@ }, emits: ['select', 'success', 'fail', 'progress', 'delete', 'update:modelValue', 'input'], props: { - // #ifdef VUE3 modelValue: { type: [Array, Object], default () { return [] } }, - // #endif - - // #ifndef VUE3 value: { type: [Array, Object], default () { return [] } }, - // #endif - disabled: { type: Boolean, default: false @@ -185,31 +173,48 @@ default () { return ['original', 'compressed'] } + }, + sourceType: { + type: Array, + default () { + return ['album', 'camera'] + } + }, + provider: { + type: String, + default: '' // 默认上传到 unicloud 内置存储 extStorage 扩展存储 + }, + dir: { + type: String, + default: '/' } }, data() { return { files: [], - localValue: [] + localValue: [], + dirPath: '/' } }, watch: { - // #ifndef VUE3 value: { handler(newVal, oldVal) { this.setValue(newVal, oldVal) }, immediate: true }, - // #endif - // #ifdef VUE3 modelValue: { handler(newVal, oldVal) { this.setValue(newVal, oldVal) }, immediate: true }, - // #endif + dir: { + handler(newVal) { + this.dirPath = newVal + }, + immediate: true + }, }, computed: { filesList() { @@ -284,19 +289,19 @@ return this.uploadFiles(files) }, async setValue(newVal, oldVal) { - const newData = async (v) => { + const newData = async (v) => { const reg = /cloud:\/\/([\w.]+\/?)\S*/ let url = '' - if(v.fileID){ + if (v.fileID) { url = v.fileID - }else{ + } else { url = v.url } if (reg.test(url)) { v.fileID = url v.url = await this.getTempFileURL(url) } - if(v.url) v.path = v.url + if (v.url) v.path = v.url return v } if (this.returnType === 'object') { @@ -307,13 +312,13 @@ } } else { if (!newVal) newVal = [] - for(let i =0 ;i < newVal.length ;i++){ + for (let i = 0; i < newVal.length; i++) { let v = newVal[i] await newData(v) } } this.localValue = newVal - if (this.form && this.formItem &&!this.is_reset) { + if (this.form && this.formItem && !this.is_reset) { this.is_reset = false this.formItem.setValue(this.localValue) } @@ -325,7 +330,6 @@ * 选择文件 */ choose() { - if (this.disabled) return if (this.files.length >= Number(this.limitLength) && this.showType !== 'grid' && this.returnType === 'array') { @@ -349,6 +353,7 @@ type: this.fileMediatype, compressed: false, sizeType: this.sizeType, + sourceType: this.sourceType, // TODO 如果为空,video 有问题 extension: _extname.length > 0 ? _extname : undefined, count: this.limitLength - this.files.length, //默认9 @@ -370,7 +375,9 @@ * @param {Object} res */ async chooseFileCallback(res) { + const _extname = get_extname(this.fileExtname) + const is_one = (Number(this.limitLength) === 1 && this.disablePreview && !this.disabled) || @@ -396,11 +403,13 @@ let filedata = await get_file_data(files[i], this.fileMediatype) filedata.progress = 0 filedata.status = 'ready' - this.files.push(filedata) - currentData.push({ + // fix by mehaotian ,统一返回,删除也包含file对象 + let fileTempData = { ...filedata, file: files[i] - }) + } + this.files.push(fileTempData) + currentData.push(fileTempData) } this.$emit('select', { tempFiles: currentData, @@ -411,6 +420,24 @@ if (!this.autoUpload || this.noSpace) { res.tempFiles = [] } + res.tempFiles.map((fileItem, index) => { + this.provider && (fileItem.provider = this.provider); + const fileNameSplit = fileItem.name.split('.') + const ext = fileNameSplit.pop() + const fileName = fileNameSplit.join('.').replace(/[\s\/\?<>\\:\*\|":]/g, '_') + // 选择文件目录上传 + let dir = this.dirPath || ''; // 防止用户传入的 dir 不正常 + // 检查最后一个字符是否为 '/'(同时处理空字符串情况) + if (dir && dir[dir.length - 1] !== '/') { + dir += '/'; + } + + fileItem.cloudPath = dir + fileName + '_' + Date.now() + '_' + index + '.' + ext + fileItem.cloudPathAsRealPath = true + + return fileItem + }) + return res }, /** @@ -457,7 +484,7 @@ const reg = /cloud:\/\/([\w.]+\/?)\S*/ if (reg.test(item.url)) { this.files[index].url = await this.getTempFileURL(item.url) - }else{ + } else { this.files[index].url = item.url } @@ -516,6 +543,7 @@ */ delFile(index) { this.$emit('delete', { + index, tempFile: this.files[index], tempFilePath: this.files[index].url }) @@ -545,7 +573,7 @@ let data = [] if (this.returnType === 'object') { data = this.backObject(this.files)[0] - this.localValue = data?data:null + this.localValue = data ? data : null } else { data = this.backObject(this.files) if (!this.localValue) { @@ -575,8 +603,12 @@ name: v.name, path: v.path, size: v.size, - fileID:v.fileID, - url: v.url + fileID: v.fileID, + url: v.url, + // 修改删除一个文件后不能再上传的bug, #694 + uuid: v.uuid, + status: v.status, + cloudPath: v.cloudPath }) }) return newFilesData @@ -634,14 +666,6 @@ color: #999; } - .is-add { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - align-items: center; - justify-content: center; - } - .icon-add { width: 50px; height: 5px; diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue b/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue index 625d92e..0d26379 100644 --- a/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue +++ b/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue @@ -8,8 +8,7 @@ + 'files-border':index !== 0 && styles.dividline}" :style="index !== 0 && styles.dividline &&borderLineStyle"> - - - - {{ msg }} - - - - - - - - - - {{ msg }} - - - - + + + + * + {{label}} + + + + + + + {{msg}} + + + + + + + + + + {{msg}} + + + + diff --git a/uni_modules/uni-forms/components/uni-forms/uni-forms.vue b/uni_modules/uni-forms/components/uni-forms/uni-forms.vue index ed2f6d9..d061313 100644 --- a/uni_modules/uni-forms/components/uni-forms/uni-forms.vue +++ b/uni_modules/uni-forms/components/uni-forms/uni-forms.vue @@ -52,7 +52,7 @@ * @property {String} labelPosition = [top|left] label 位置 默认 left * @value top 顶部显示 label * @value left 左侧显示 label - * @property {String} labelWidth label 宽度,默认 65px + * @property {String} labelWidth label 宽度,默认 70px * @property {String} labelAlign = [left|center|right] label 居中方式 默认 left * @value left label 左侧显示 * @value center label 居中 @@ -68,7 +68,12 @@ name: 'uniForms', emits: ['validate', 'submit'], options: { + // #ifdef MP-TOUTIAO + virtualHost: false, + // #endif + // #ifndef MP-TOUTIAO virtualHost: true + // #endif }, props: { // 即将弃用 @@ -180,7 +185,9 @@ } } if (!formVm) return console.error('当前 uni-froms 组件缺少 ref 属性'); - formVm.setValue(name, value); + if(formVm.model)formVm.model[name] = value + if(formVm.modelValue)formVm.modelValue[name] = value + if(formVm.value)formVm.value[name] = value } } } diff --git a/uni_modules/uni-forms/package.json b/uni_modules/uni-forms/package.json index e3736c4..0d72c63 100644 --- a/uni_modules/uni-forms/package.json +++ b/uni_modules/uni-forms/package.json @@ -1,7 +1,7 @@ { "id": "uni-forms", "displayName": "uni-forms 表单", - "version": "1.4.8", + "version": "1.4.13", "description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据", "keywords": [ "uni-ui", @@ -46,7 +46,8 @@ "platforms": { "cloud": { "tcb": "y", - "aliyun": "y" + "aliyun": "y", + "alipay": "n" }, "client": { "App": { diff --git a/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.vue b/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.vue index 20fd54e..19c08d7 100644 --- a/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.vue +++ b/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.vue @@ -68,7 +68,7 @@ } - diff --git a/uni_modules/uni-icons/components/uni-icons/uni-icons.vue b/uni_modules/uni-icons/components/uni-icons/uni-icons.vue index 86e7444..1bd3d5e 100644 --- a/uni_modules/uni-icons/components/uni-icons/uni-icons.vue +++ b/uni_modules/uni-icons/components/uni-icons/uni-icons.vue @@ -1,24 +1,28 @@ - \ No newline at end of file diff --git a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue index 8952545..5af55e0 100644 --- a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue +++ b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue @@ -1,11 +1,11 @@