@vyron/mini-components
Advanced tools
| /// <reference types="react" /> | ||
| import { ViewProps } from "@tarojs/components/types/View"; | ||
| import { IconProps } from "@vyron/mini-components/icon"; | ||
| import { navigationBarTextStyle } from "@vyron/mini-components/common/hooks/useMenuButton"; | ||
| import { IconProps } from "../icon"; | ||
| import { navigationBarTextStyle } from "../common/hooks/useMenuButton"; | ||
| export interface MenuIcon { | ||
@@ -6,0 +6,0 @@ white?: IconProps; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../packages/appbar/icons/back-black-icon.png","../../packages/appbar/icons/back-white-icon.png","../../packages/appbar/icons/home-black-icon.png","../../packages/appbar/icons/home-white-icon.png","../../packages/appbar/icons/menu-black-icon.png","../../packages/appbar/icons/menu-white-icon.png","../../packages/appbar/index.tsx"],"sourcesContent":["const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAABECAMAAADeKmfwAAAAWlBMVEVMaXEwMDAnJycvLy8yMjIAAAAyMjIwMDAjIyMsLCwvLy8tLS0sLCwwMDAwMDAvLy8vLy8yMjIyMjIwMDAwMDAwMDAwMDAwMDAzMzMxMTEzMzMxMTExMTEzMzOrqidJAAAAHXRSTlMAVSBI7APg+AcRkj4Xqyo2MGvP135evcRkh3O0oW8RbOQAAAIDSURBVHjafZbZsqUgDEWbSWQeRBQ9/v9vdkm8jwmP1q7FzkDiP+oonkL4ZUNpViPO4+iCUyKTqtRa20JxmJX6eZ6xE6Jo5fOeS+CexbG8nGOgxtWain41OjCPgbg7lvcq2ZxRKGefd8ltjxjH53tqdDvNiuXHndvkVOYUFnuG/Dz3jnJ8tMfkhBIxjcoMcrgx3HO66+TY06McziCu5XR43T/Pdkc5q2fhlWh5CVSTCnACzjH+tJOzDYd27F/sEo/d8BZmXLfFGyiKCp53ol6tTs/94gZv+i9269A8J8jzs+1pxTnX1MjuONrQH0cWp7CGNqLNBC1d4AkS4Znncit6lwgzQfUnuMJErE2Mto6YMHWZ76s4o3DR5CxHAg4t8islWuR8hoJTqvGDRmuUyu19Wu8jE9Z569AAjGCtnP3kq6ohe/zG1OBBbiIqnOUvC8/2jh5XsQtYVUTcl/EXuF8GoVqF3WDYnt7gKlcWYLGMu/fZ3sCykSi2KN8zp9aS4RfUsbZkCPdNw+hhXhEVOm+oY3FEvoQFX4MZXKXiLh9ysMJ66ttDjWhgOaapYQ8inm19yLUBQ/hvAZ2Ee+PKt8p2Afkil+IoH4teryXDJ3JRD2EUwSoSOqd4IhOiw8+DpWbJygfUsTFcpIywk2Uv8tcoHovW+jdQBbBYPzqDLBCsEEIy/wHcPzPpWpXCKAAAAABJRU5ErkJggg==\";\n export default img;","const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAABECAMAAADeKmfwAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABgUExURUxpcf///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////05o8T8AAAAfdFJOUwDqID4D4FUH+RH1FypmcKY2MLLvz9dLfl6PvcSWRIeJaFfEAAACFUlEQVR42oWWS7KsIAxAn/wUEBBU8Afuf5eviD1NrsOuUychhKT/UZ9gS0ohaooZdXb3fWVGQXrZhmmaTk951DNM7/u2g4Dmc3375yuec75l99wNTVyMizedMUFZTMT4LXuotXAtUM8Bsdb9mDGPjQmYqTg9YvXhbu/MsCkusLPHE+rzpgP12Pm8wRP8jDEiqq+Gu8JzXtIG5zqdRT1MfeeSjuP3/sv5PFDPaFXoiBl8RZnFreBJuEdb93Rk2htHOzaqAc4+4GfXrATTPenBG2jOG8QaDuK+ymY6dHmm8aZPn+fhaJ0XJcGzH8uIezwww8UZ2tA/z+C4wBpa1wLNIa+MFyiHFz7PRzRWDVCgLVQmMEgV0JiHExNmkz3l3XMtcAg88l4+Dw3ZkYLkAM8wM4pq4Wu0QlH8uHrq69UikTorF7hWRbhGpsLaqS1Ei0dcioShtudZ4C7rz+/ZptnilPLSQMQ843lp6yF7IxtBjfnZwZWc1TjFvXwhLxXx7G08E7jCOROXXf3vmVNrSTP/3eNWFiKvWgyMnqAsUVXm0m+IcaJe9fnyakrjlJgPoAwMVnw9XftLjmhwcWXIYQ8Qi8/20msDhvDzG8KwyP5cZUeFetFLsYHrz/XqIvxCL+pWtSBc3woxyVmiEvmCiPdDzZKRte8ei8IhofMJb+jx5F+j+ZbTNIVGQUJXdd2XgipQrpDCov8D2KI5M3rnN1QAAAAASUVORK5CYII=\";\n export default img;","const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAP1BMVEVMaXEyMjI4ODgyMjIzMzMzMzMyMjIzMzMzMzMwMDB/f38yMjIyMjIzMzM0NDQzMzMwMDAyMjIyMjIxMTEzMzNXydlsAAAAFHRSTlMAvwmTbTL3yK06AiHqhV3aFUJ1UnEAngMAAADfSURBVHja7dTRjoMgEIXhA+iAgKh13v9ZNyaTdrfWccje9rsk+RNzIuCjzdWaCqxy4AMNsPGJRcgwWCM/JY9bZeFf4oobU+U/lgLVTvymTlAMfEY7Ls380UOZ80SZ1zu+lLw6p9DnHSufaPNuxCfavI34FjVlTn3eHNgoZJnTzHmgRO4QCxJ3SSDuQpjZLWzkHM+AR7R/j8ehI8A3+EcQ27a1aA9muSbWIGa5KM4YDBCDMZggJmMwQoy9wfQNXoHrDYI1CHK+v58PIlz8M9mxCa0QJZqfe+EfjlhHseHwAzQzd/NycpUyAAAAAElFTkSuQmCC\";\n export default img;","const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABCUExURUxpcf///////////////////////////////////////////////////////////////////////////////////zezJKIAAAAVdFJOUwAJPZJt97+txzQCGOqFzF3aJ091pVnxnMYAAADiSURBVHja7dTbioQwEIThSmISTTyP9f6vOgjNMOuObcvu3e53GfhBChN85FPf5wVWJXAXG9i4TBEKDGrLl+xwaZn5pq240PX8Yl6gWiMP+g6Kht/FFacGfvQ4m3PjgT6vSzzQ560zFWNV5hTKvDKnrvd4M0VeipMypz5v2WgUisxplhxQRxrJvJm3ZETeEjEwzTRKiQPg0Nq/x2F3I8B/8INgnLyfRnswyDWxBm2Ri5KMQQPRGAMP0RmD7k8H/reCZA02OQ/WIMj5ejxvRDj5Z0qiSawQdTQ/98I9UqQuthN2TzwCff8MqYWBAAAAAElFTkSuQmCC\";\n export default img;","const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAyCAMAAADSto1cAAAAD1BMVEVMaXEzMzMyMjI3NzczMzMm1dT1AAAABHRSTlMAquwXFmSHCwAAADpJREFUeNrt1MENAEAIAkFB+q/5ipDkPjsFmMhjZ+WcWDvKmcY5c+VI5Z3OsABQQu2pPQBqT+3/1v4BefkSnSSU5FIAAAAASUVORK5CYII=\";\n export default img;","const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAyBAMAAAAXRmBdAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAPUExURUxpcf///////////////0Wl2ZkAAAAEdFJOUwCq7BcWZIcLAAAAMUlEQVQ4y2MwVHHBC5yEGURcCABHBhVCSpyIUUKERUQ4dxSMAlLAaA4YBaM5YFjlAACxZ54vNXLLFgAAAABJRU5ErkJggg==\";\n export default img;","import React from \"react\";\nimport { CoverView } from \"@tarojs/components\";\nimport { ViewProps } from \"@tarojs/components/types/View\";\nimport Icon, { IconProps } from \"@vyron/mini-components/icon\";\nimport useMenuButton, {\n navigationBarTextStyle,\n} from \"@vyron/mini-components/common/hooks/useMenuButton\";\nimport {\n getCurrPages,\n goToHome,\n navigateBack,\n mergeStyle,\n} from \"@vyron/mini-components/common\";\n// 图片\nimport BackBlack from \"./icons/back-black-icon.png\";\nimport BackWhite from \"./icons/back-white-icon.png\";\nimport HomeBlack from \"./icons/home-black-icon.png\";\nimport HomeWhite from \"./icons/home-white-icon.png\";\nimport MenuBlack from \"./icons/menu-black-icon.png\";\nimport MenuWhite from \"./icons/menu-white-icon.png\";\n\nexport interface MenuIcon {\n white?: IconProps;\n black?: IconProps;\n}\n\nexport interface leftIconProps extends ViewProps {\n home?: MenuIcon;\n back?: MenuIcon;\n}\n\nexport interface RightIconProps extends ViewProps {\n menu?: MenuIcon;\n}\n\nexport interface TitleProps extends ViewProps {\n text?: string;\n}\n\nexport interface NavigationBarProps extends ViewProps {\n title?: string | TitleProps;\n backgroundColor?: string;\n statusBarBackgroundColor?: string;\n type?: navigationBarTextStyle;\n left?: leftIconProps;\n middle?: ViewProps;\n right?: RightIconProps;\n onTitleClick?: Function;\n onLeftClick?: Function;\n onRightClick?: Function;\n}\n\nconst getTitleProps = (props: string | TitleProps): TitleProps => {\n return typeof props === \"string\" ? { text: props } : props;\n};\nconst defaultHomeIconProps = {\n isCover: true,\n localImage: true,\n style: {\n width: \"34rpx\",\n height: \"34rpx\",\n },\n};\nconst defaultBackIconProps = {\n isCover: true,\n localImage: true,\n style: {\n width: \"18rpx\",\n height: \"30rpx\",\n },\n};\nconst defaultMenuIconProps = {\n isCover: true,\n localImage: true,\n style: {\n width: \"34rpx\",\n height: \"25rpx\",\n },\n};\nconst defaultNavigationBarProps: NavigationBarProps = {\n title: \"微信\",\n type: \"white\",\n backgroundColor: \"#ffffff\",\n // statusBarBackgroundColor: \"#ffffff\",\n left: {\n home: {\n white: {\n ...defaultHomeIconProps,\n type: HomeWhite,\n },\n black: {\n ...defaultHomeIconProps,\n type: HomeBlack,\n },\n },\n back: {\n white: {\n ...defaultBackIconProps,\n type: BackWhite,\n },\n black: {\n ...defaultBackIconProps,\n type: BackBlack,\n },\n },\n },\n right: {\n menu: {\n white: {\n ...defaultMenuIconProps,\n type: MenuWhite,\n },\n black: {\n ...defaultMenuIconProps,\n type: MenuBlack,\n },\n },\n },\n onLeftClick: ({ isHome }) => {\n isHome ? goToHome() : navigateBack();\n },\n};\n\nconst AppBar = (props: NavigationBarProps) => {\n const {\n type,\n title,\n left,\n right,\n middle,\n backgroundColor,\n onTitleClick,\n onLeftClick,\n onRightClick,\n // statusBarBackgroundColor,\n } = {\n ...defaultNavigationBarProps,\n ...props,\n };\n const { rect, wrapStyle, menuStyle, delimiterStyle } = useMenuButton({\n type: type as navigationBarTextStyle,\n });\n const { width, height } = menuStyle;\n const { position, zIndex, ...restProps } = wrapStyle;\n let { isFirst: isHome, isTabBar } = getCurrPages();\n const {\n text,\n style: titleStyle,\n className: titleCls,\n ...restTitleProps\n } = getTitleProps(title || {});\n const {\n home,\n back,\n className: leftCls,\n ...restLeftProps\n } = left as leftIconProps;\n const {\n menu,\n className: rightCls,\n ...restRightProps\n } = right as RightIconProps;\n const { className: delimiterCls, style: delimiterSty } = (middle ??\n {}) as TitleProps;\n const leftIconProps = isHome ? home : back;\n const menuClickProps = { isHome, menuStyle, rect, props: left };\n return (\n <React.Fragment>\n <CoverView\n style={{\n ...wrapStyle,\n backgroundColor,\n }}\n className=\"__appbar__\"\n >\n <CoverView\n style={menuStyle}\n className={`__left__menu__ ${\n isTabBar ? \"__left__menu__hidden__\" : \"\"\n }`}\n >\n <CoverView\n {...restLeftProps}\n className={`__menu__item__wrap__ ${leftCls ?? \"\"}`}\n onClick={(eve) => onLeftClick?.(menuClickProps, eve)}\n >\n <Icon\n {...(leftIconProps?.[\n type as navigationBarTextStyle\n ] as IconProps)}\n />\n </CoverView>\n <CoverView\n className={`__delimiter__ ${delimiterCls ?? \"\"}`}\n style={mergeStyle(delimiterStyle, delimiterSty)}\n />\n <CoverView\n {...restRightProps}\n className={`__menu__item__wrap__ ${rightCls ?? \"\"}`}\n onClick={(eve) => onRightClick?.(menuClickProps, eve)}\n >\n <Icon {...(menu?.[type as navigationBarTextStyle] as IconProps)} />\n </CoverView>\n </CoverView>\n <CoverView\n {...restTitleProps}\n className={`__appbar__title__ ${titleCls ?? \"\"}`}\n style={mergeStyle(\n {\n color: backgroundColor === \"#ffffff\" ? \"#333\" : \"#fff\",\n },\n titleStyle\n )}\n onClick={(eve) => onTitleClick?.(eve)}\n >\n {text}\n </CoverView>\n <CoverView\n style={{ width, height }}\n className={`__right__menu__ ${\n isTabBar ? \"__right__menu__hidden__\" : \"\"\n }`}\n />\n </CoverView>\n <CoverView style={restProps} />\n </React.Fragment>\n );\n};\n\nAppBar.options = {\n addGlobalClass: true,\n};\n\nexport default AppBar;\n"],"names":["img","HomeWhite","HomeBlack","BackWhite","BackBlack","MenuWhite","MenuBlack"],"mappings":";;;;;;;AAAA,MAAM,GAAG,GAAG,o9BAAo9B;;ACAh+B,MAAMA,KAAG,GAAG,4hCAA4hC;;ACAxiC,MAAMA,KAAG,GAAG,4hBAA4hB;;ACAxiB,MAAMA,KAAG,GAAG,4kBAA4kB;;ACAxlB,MAAMA,KAAG,GAAG,4OAA4O;;ACAxP,MAAMA,KAAG,GAAG,wQAAwQ;;ACoDpR,IAAM,aAAa,GAAG,UAAC,KAA0B;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;AAC7D,CAAC,CAAC;AACF,IAAM,oBAAoB,GAAG;IAC3B,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,OAAO;KAChB;CACF,CAAC;AACF,IAAM,oBAAoB,GAAG;IAC3B,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,OAAO;KAChB;CACF,CAAC;AACF,IAAM,oBAAoB,GAAG;IAC3B,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,OAAO;KAChB;CACF,CAAC;AACF,IAAM,yBAAyB,GAAuB;IACpD,KAAK,EAAE,IAAI;IACX,IAAI,EAAE,OAAO;IACb,eAAe,EAAE,SAAS;;IAE1B,IAAI,EAAE;QACJ,I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Y,GAAI,EAAE,CAAE,EAChD,KAAK,EAAE,UAAU,CAAC,cAAc,EAAE,YAAY,CAAC,GAC/C;gBACF,oBAAC,SAAS,eACJ,cAAc,IAClB,SAAS,EAAE,2BAAwB,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAE,EACnD,OAAO,EAAE,UAAC,GAAG,WAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,cAAc,EAAE,GAAG,IAAC;oBAErD,oBAAC,IAAI,eAAM,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,IAA8B,CAAe,EAAI,CACzD,CACF;YACZ,oBAAC,SAAS,eACJ,cAAc,IAClB,SAAS,EAAE,wBAAqB,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAE,EAChD,KAAK,EAAE,UAAU,CACf;oBACE,KAAK,EAAE,eAAe,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM;iBACvD,EACD,UAAU,CACX,EACD,OAAO,EAAE,UAAC,GAAG,WAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,GAAG,IAAC,KAEpC,IAAI,CACK;YACZ,oBAAC,SAAS,IACR,KAAK,EAAE,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,EACxB,SAAS,EAAE,sBACT,QAAQ,GAAG,yBAAyB,GAAG,EAAE,CACzC,GACF,CACQ;QACZ,oBAAC,SAAS,IAAC,KAAK,EAAE,SAAS,GAAI,CAChB,EACjB;AACJ,EAAE;AAEF,MAAM,CAAC,OAAO,GAAG;IACf,cAAc,EAAE,IAAI;CACrB;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../packages/appbar/icons/back-black-icon.png","../../packages/appbar/icons/back-white-icon.png","../../packages/appbar/icons/home-black-icon.png","../../packages/appbar/icons/home-white-icon.png","../../packages/appbar/icons/menu-black-icon.png","../../packages/appbar/icons/menu-white-icon.png","../../packages/appbar/index.tsx"],"sourcesContent":["const img = \"data:image/png;base64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pcf///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////05o8T8AAAAfdFJOUwDqID4D4FUH+RH1FypmcKY2MLLvz9dLfl6PvcSWRIeJaFfEAAACFUlEQVR42oWWS7KsIAxAn/wUEBBU8Afuf5eviD1NrsOuUychhKT/UZ9gS0ohaooZdXb3fWVGQXrZhmmaTk951DNM7/u2g4Dmc3375yuec75l99wNTVyMizedMUFZTMT4LXuotXAtUM8Bsdb9mDGPjQmYqTg9YvXhbu/MsCkusLPHE+rzpgP12Pm8wRP8jDEiqq+Gu8JzXtIG5zqdRT1MfeeSjuP3/sv5PFDPaFXoiBl8RZnFreBJuEdb93Rk2htHOzaqAc4+4GfXrATTPenBG2jOG8QaDuK+ymY6dHmm8aZPn+fhaJ0XJcGzH8uIezwww8UZ2tA/z+C4wBpa1wLNIa+MFyiHFz7PRzRWDVCgLVQmMEgV0JiHExNmkz3l3XMtcAg88l4+Dw3ZkYLkAM8wM4pq4Wu0QlH8uHrq69UikTorF7hWRbhGpsLaqS1Ei0dcioShtudZ4C7rz+/ZptnilPLSQMQ843lp6yF7IxtBjfnZwZWc1TjFvXwhLxXx7G08E7jCOROXXf3vmVNrSTP/3eNWFiKvWgyMnqAsUVXm0m+IcaJe9fnyakrjlJgPoAwMVnw9XftLjmhwcWXIYQ8Qi8/20msDhvDzG8KwyP5cZUeFetFLsYHrz/XqIvxCL+pWtSBc3woxyVmiEvmCiPdDzZKRte8ei8IhofMJb+jx5F+j+ZbTNIVGQUJXdd2XgipQrpDCov8D2KI5M3rnN1QAAAAASUVORK5CYII=\";\n export default img;","const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAP1BMVEVMaXEyMjI4ODgyMjIzMzMzMzMyMjIzMzMzMzMwMDB/f38yMjIyMjIzMzM0NDQzMzMwMDAyMjIyMjIxMTEzMzNXydlsAAAAFHRSTlMAvwmTbTL3yK06AiHqhV3aFUJ1UnEAngMAAADfSURBVHja7dTRjoMgEIXhA+iAgKh13v9ZNyaTdrfWccje9rsk+RNzIuCjzdWaCqxy4AMNsPGJRcgwWCM/JY9bZeFf4oobU+U/lgLVTvymTlAMfEY7Ls380UOZ80SZ1zu+lLw6p9DnHSufaPNuxCfavI34FjVlTn3eHNgoZJnTzHmgRO4QCxJ3SSDuQpjZLWzkHM+AR7R/j8ehI8A3+EcQ27a1aA9muSbWIGa5KM4YDBCDMZggJmMwQoy9wfQNXoHrDYI1CHK+v58PIlz8M9mxCa0QJZqfe+EfjlhHseHwAzQzd/NycpUyAAAAAElFTkSuQmCC\";\n export default img;","const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABCUExURUxpcf///////////////////////////////////////////////////////////////////////////////////zezJKIAAAAVdFJOUwAJPZJt97+txzQCGOqFzF3aJ091pVnxnMYAAADiSURBVHja7dTbioQwEIThSmISTTyP9f6vOgjNMOuObcvu3e53GfhBChN85FPf5wVWJXAXG9i4TBEKDGrLl+xwaZn5pq240PX8Yl6gWiMP+g6Kht/FFacGfvQ4m3PjgT6vSzzQ560zFWNV5hTKvDKnrvd4M0VeipMypz5v2WgUisxplhxQRxrJvJm3ZETeEjEwzTRKiQPg0Nq/x2F3I8B/8INgnLyfRnswyDWxBm2Ri5KMQQPRGAMP0RmD7k8H/reCZA02OQ/WIMj5ejxvRDj5Z0qiSawQdTQ/98I9UqQuthN2TzwCff8MqYWBAAAAAElFTkSuQmCC\";\n export default img;","const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAyCAMAAADSto1cAAAAD1BMVEVMaXEzMzMyMjI3NzczMzMm1dT1AAAABHRSTlMAquwXFmSHCwAAADpJREFUeNrt1MENAEAIAkFB+q/5ipDkPjsFmMhjZ+WcWDvKmcY5c+VI5Z3OsABQQu2pPQBqT+3/1v4BefkSnSSU5FIAAAAASUVORK5CYII=\";\n export default img;","const img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAyBAMAAAAXRmBdAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAPUExURUxpcf///////////////0Wl2ZkAAAAEdFJOUwCq7BcWZIcLAAAAMUlEQVQ4y2MwVHHBC5yEGURcCABHBhVCSpyIUUKERUQ4dxSMAlLAaA4YBaM5YFjlAACxZ54vNXLLFgAAAABJRU5ErkJggg==\";\n export default img;","import React from \"react\";\nimport { CoverView } from \"@tarojs/components\";\nimport { ViewProps } from \"@tarojs/components/types/View\";\nimport Icon from \"@vyron/mini-components/icon\";\nimport useMenuButton from \"@vyron/mini-components/common/hooks/useMenuButton\";\nimport {\n getCurrPages,\n goToHome,\n navigateBack,\n mergeStyle,\n} from \"@vyron/mini-components/common\";\n// 图片\nimport BackBlack from \"./icons/back-black-icon.png\";\nimport BackWhite from \"./icons/back-white-icon.png\";\nimport HomeBlack from \"./icons/home-black-icon.png\";\nimport HomeWhite from \"./icons/home-white-icon.png\";\nimport MenuBlack from \"./icons/menu-black-icon.png\";\nimport MenuWhite from \"./icons/menu-white-icon.png\";\n\nimport { IconProps } from \"../icon\";\nimport { navigationBarTextStyle } from \"../common/hooks/useMenuButton\";\n\nexport interface MenuIcon {\n white?: IconProps;\n black?: IconProps;\n}\n\nexport interface leftIconProps extends ViewProps {\n home?: MenuIcon;\n back?: MenuIcon;\n}\n\nexport interface RightIconProps extends ViewProps {\n menu?: MenuIcon;\n}\n\nexport interface TitleProps extends ViewProps {\n text?: string;\n}\n\nexport interface NavigationBarProps extends ViewProps {\n title?: string | TitleProps;\n backgroundColor?: string;\n statusBarBackgroundColor?: string;\n type?: navigationBarTextStyle;\n left?: leftIconProps;\n middle?: ViewProps;\n right?: RightIconProps;\n onTitleClick?: Function;\n onLeftClick?: Function;\n onRightClick?: Function;\n}\n\nconst getTitleProps = (props: string | TitleProps): TitleProps => {\n return typeof props === \"string\" ? { text: props } : props;\n};\nconst defaultHomeIconProps = {\n isCover: true,\n localImage: true,\n style: {\n width: \"34rpx\",\n height: \"34rpx\",\n },\n};\nconst defaultBackIconProps = {\n isCover: true,\n localImage: true,\n style: {\n width: \"18rpx\",\n height: \"30rpx\",\n },\n};\nconst defaultMenuIconProps = {\n isCover: true,\n localImage: true,\n style: {\n width: \"34rpx\",\n height: \"25rpx\",\n },\n};\nconst defaultNavigationBarProps: NavigationBarProps = {\n title: \"微信\",\n type: \"white\",\n backgroundColor: \"#ffffff\",\n // statusBarBackgroundColor: \"#ffffff\",\n left: {\n home: {\n white: {\n ...defaultHomeIconProps,\n type: HomeWhite,\n },\n black: {\n ...defaultHomeIconProps,\n type: HomeBlack,\n },\n },\n back: {\n white: {\n ...defaultBackIconProps,\n type: BackWhite,\n },\n black: {\n ...defaultBackIconProps,\n type: BackBlack,\n },\n },\n },\n right: {\n menu: {\n white: {\n ...defaultMenuIconProps,\n type: MenuWhite,\n },\n black: {\n ...defaultMenuIconProps,\n type: MenuBlack,\n },\n },\n },\n onLeftClick: ({ isHome }) => {\n isHome ? goToHome() : navigateBack();\n },\n};\n\nconst AppBar = (props: NavigationBarProps) => {\n const {\n type,\n title,\n left,\n right,\n middle,\n backgroundColor,\n onTitleClick,\n onLeftClick,\n onRightClick,\n // statusBarBackgroundColor,\n } = {\n ...defaultNavigationBarProps,\n ...props,\n };\n const { rect, wrapStyle, menuStyle, delimiterStyle } = useMenuButton({\n type: type as navigationBarTextStyle,\n });\n const { width, height } = menuStyle;\n const { position, zIndex, ...restProps } = wrapStyle;\n let { isFirst: isHome, isTabBar } = getCurrPages();\n const {\n text,\n style: titleStyle,\n className: titleCls,\n ...restTitleProps\n } = getTitleProps(title || {});\n const {\n home,\n back,\n className: leftCls,\n ...restLeftProps\n } = left as leftIconProps;\n const {\n menu,\n className: rightCls,\n ...restRightProps\n } = right as RightIconProps;\n const { className: delimiterCls, style: delimiterSty } = (middle ??\n {}) as TitleProps;\n const leftIconProps = isHome ? home : back;\n const menuClickProps = { isHome, menuStyle, rect, props: left };\n return (\n <React.Fragment>\n <CoverView\n style={{\n ...wrapStyle,\n backgroundColor,\n }}\n className=\"__appbar__\"\n >\n <CoverView\n style={menuStyle}\n className={`__left__menu__ ${\n isTabBar ? \"__left__menu__hidden__\" : \"\"\n }`}\n >\n <CoverView\n {...restLeftProps}\n className={`__menu__item__wrap__ ${leftCls ?? \"\"}`}\n onClick={(eve) => onLeftClick?.(menuClickProps, eve)}\n >\n <Icon\n {...(leftIconProps?.[\n type as navigationBarTextStyle\n ] as IconProps)}\n />\n </CoverView>\n <CoverView\n className={`__delimiter__ ${delimiterCls ?? \"\"}`}\n style={mergeStyle(delimiterStyle, delimiterSty)}\n />\n <CoverView\n {...restRightProps}\n className={`__menu__item__wrap__ ${rightCls ?? \"\"}`}\n onClick={(eve) => onRightClick?.(menuClickProps, eve)}\n >\n <Icon {...(menu?.[type as navigationBarTextStyle] as IconProps)} />\n </CoverView>\n </CoverView>\n <CoverView\n {...restTitleProps}\n className={`__appbar__title__ ${titleCls ?? \"\"}`}\n style={mergeStyle(\n {\n color: backgroundColor === \"#ffffff\" ? \"#333\" : \"#fff\",\n },\n titleStyle\n )}\n onClick={(eve) => onTitleClick?.(eve)}\n >\n {text}\n </CoverView>\n <CoverView\n style={{ width, height }}\n className={`__right__menu__ ${\n isTabBar ? \"__right__menu__hidden__\" : \"\"\n }`}\n />\n </CoverView>\n <CoverView style={restProps} />\n </React.Fragment>\n );\n};\n\nAppBar.options = {\n addGlobalClass: true,\n};\n\nexport default AppBar;\n"],"names":["img","HomeWhite","HomeBlack","BackWhite","BackBlack","MenuWhite","MenuBlack"],"mappings":";;;;;;;AAAA,MAAM,GAAG,GAAG,o9BAAo9B;;ACAh+B,MAAMA,KAAG,GAAG,4hCAA4hC;;ACAxiC,MAAMA,KAAG,GAAG,4hBAA4hB;;ACAxiB,MAAMA,KAAG,GAAG,4kBAA4kB;;ACAxlB,MAAMA,KAAG,GAAG,4OAA4O;;ACAxP,MAAMA,KAAG,GAAG,wQ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AAE,CAAE,EAChD,KAAK,EAAE,UAAU,CACf;oBACE,KAAK,EAAE,eAAe,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM;iBACvD,EACD,UAAU,CACX,EACD,OAAO,EAAE,UAAC,GAAG,WAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,GAAG,IAAC,KAEpC,IAAI,CACK;YACZ,oBAAC,SAAS,IACR,KAAK,EAAE,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,EACxB,SAAS,EAAE,sBACT,QAAQ,GAAG,yBAAyB,GAAG,EAAE,CACzC,GACF,CACQ;QACZ,oBAAC,SAAS,IAAC,KAAK,EAAE,SAAS,GAAI,CAChB,EACjB;AACJ,EAAE;AAEF,MAAM,CAAC,OAAO,GAAG;IACf,cAAc,EAAE,IAAI;CACrB;;;;"} |
| import React from "react"; | ||
| import { StandardProps } from "@tarojs/components"; | ||
| import { AuthScope } from "@vyron/mini-components/common"; | ||
| import { AuthScope } from "../common"; | ||
| declare type PromiseFn = (args?: any) => Promise<any>; | ||
@@ -5,0 +5,0 @@ declare type ObjectService = { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../packages/authorize/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { login } from \"@tarojs/taro\";\nimport { Button, StandardProps } from \"@tarojs/components\";\nimport { isFunction, isPromise, ensureAuthScope, AuthScope } from \"@vyron/mini-components/common\";\n\ntype PromiseFn = (args?: any) => Promise<any>;\n\ntype ObjectService = {\n params: object;\n fn: PromiseFn;\n needMiniCode?: boolean;\n codeKey?: string;\n};\n\ntype AuthorizeService = PromiseFn | ObjectService;\n\ntype OpenType =\n | \"contact\"\n | \"getPhoneNumber\"\n | \"getUserInfo\"\n | \"launchApp\"\n | \"scope\";\n\nexport interface AuthorizeProps extends StandardProps {\n authorize: boolean;\n openType?: OpenType;\n authScope?: AuthScope;\n children?: React.ReactElement | string;\n onAuthorize?: Function;\n service?: AuthorizeService;\n}\n\nconst SUCCESS_MSG = {\n getPhoneNumber: \"getPhoneNumber:ok\",\n getUserInfo: \"getUserInfo:ok\",\n};\n\nasync function getService(\n service: AuthorizeService,\n param: object = {}\n): Promise<any> {\n if (service === void 0) {\n throw `service is undefined!`;\n }\n if (isPromise(service)) {\n return (service as PromiseFn)(param);\n }\n let { params, fn, needMiniCode, codeKey } = service as ObjectService;\n params = {\n ...params,\n ...param,\n };\n if (needMiniCode) {\n params[codeKey || \"code\"] = await login();\n }\n return fn(params);\n}\n\nasync function onGetPhoneNumber(eve: any) {\n const { errMsg, ...rest } = eve.detail;\n if (errMsg !== SUCCESS_MSG.getPhoneNumber) {\n return;\n }\n try {\n let userinfo = await getService(this.service, rest);\n // dispatch({type:\"userinfo/update\",payload:{userinfo}});\n onSuccess.bind(this, userinfo, eve)();\n } catch (error) {}\n}\n\nasync function onGetUserInfo(eve: any) {\n const { errMsg, ...rest } = eve.detail;\n if (errMsg !== SUCCESS_MSG.getUserInfo) {\n return;\n }\n try {\n let userinfo = await getService(this.service, rest);\n // dispatch({type:\"userinfo/update\",payload:{userinfo}});\n onSuccess.bind(this, userinfo, eve)();\n } catch (error) {}\n}\n\nfunction authorizeScope(eve: any) {\n ensureAuthScope(this.authScope)\n .then(() => {\n this.onAuthorize && this.onAuthorize(eve);\n })\n .catch(() => {\n console.log(`未授权:${this.authScope}`);\n });\n}\n\nfunction onSuccess(...args: any) {\n isFunction(this.onAuthorize) && this.onAuthorize(...args);\n}\n\nconst Authorize = (props: AuthorizeProps) => {\n const { authorize, onAuthorize, className = \"\", openType, ...rest } = props;\n function onClick(eve: any) {\n if (!openType) return;\n const openTypeFns = {\n contact: onSuccess.bind(props),\n launchApp: onSuccess.bind(props),\n scope: authorizeScope.bind(props),\n getUserInfo: onGetUserInfo.bind(props),\n getPhoneNumber: onGetPhoneNumber.bind(props),\n };\n\n if (!isFunction(openTypeFns[openType])) return;\n openTypeFns[openType](eve);\n }\n return (\n <React.Fragment>\n {!authorize ? (\n // @ts-ignore\n <Button\n {...rest}\n openType={openType}\n onClick={onClick}\n onContact={onClick}\n onLaunchapp={onClick}\n onGetUserInfo={onClick}\n onGetPhoneNumber={onClick}\n className={`__authorize__ ${className}`}\n >\n {props?.children}\n </Button>\n ) : (\n // @ts-ignore\n <Button\n {...rest}\n openType=\"\"\n onClick={(eve) => onAuthorize && onAuthorize(eve)}\n className={`__authorize__ ${className}`}\n >\n {props?.children}\n </Button>\n )}\n </React.Fragment>\n );\n};\n\nAuthorize.options = {\n addGlobalClass: true,\n};\n\nexport default Authorize;\n"],"names":[],"mappings":";;;;;;AAgCA,IAAM,WAAW,GAAG;IAClB,cAAc,EAAE,mBAAmB;IACnC,WAAW,EAAE,gBAAgB;CAC9B,CAAC;AAEF,SAAe,UAAU,CACvB,OAAyB,EACzB,KAAkB;IAAlB,sBAAA,EAAA,UAAkB;;;;;;oBAElB,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE;wBACtB,MAAM,uBAAuB,CAAC;qBAC/B;oBACD,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE;wBACtB,sBAAQ,OAAqB,CAAC,KAAK,CAAC,EAAC;qBACtC;oBACG,KAAwC,OAAwB,EAA9D,MAAM,YAAA,EAAE,EAAE,QAAA,EAAE,YAAY,kBAAA,EAAE,OAAO,aAAA,CAA8B;oBACrE,MAAM,yBACD,MAAM,GACN,KAAK,CACT,CAAC;yBACE,YAAY,EAAZ,wBAAY;oBACd,KAAA,MAAM,CAAA;oBAAC,KAAA,OAAO,IAAI,MAAM,CAAA;oBAAI,qBAAM,KAAK,EAAE,EAAA;;oBAAzC,MAAyB,GAAG,SAAa,CAAC;;wBAE5C,sBAAO,EAAE,CAAC,MAAM,CAAC,EAAC;;;;CACnB;AAED,SAAe,gBAAgB,CAAC,GAAQ;;;;;;oBAChC,KAAsB,GAAG,CAAC,MAAM,EAA9B,MAAM,YAAA,EAAK,IAAI,cAAjB,UAAmB,CAAF,CAAgB;oBACvC,IAAI,MAAM,KAAK,WAAW,CA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,CACc,EACjB;AACJ,EAAE;AAEF,SAAS,CAAC,OAAO,GAAG;IAClB,cAAc,EAAE,IAAI;CACrB;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../packages/authorize/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { login } from \"@tarojs/taro\";\nimport { Button, StandardProps } from \"@tarojs/components\";\nimport {\n isFunction,\n isPromise,\n ensureAuthScope,\n} from \"@vyron/mini-components/common\";\n\nimport { AuthScope } from \"../common\";\n\ntype PromiseFn = (args?: any) => Promise<any>;\n\ntype ObjectService = {\n params: object;\n fn: PromiseFn;\n needMiniCode?: boolean;\n codeKey?: string;\n};\n\ntype AuthorizeService = PromiseFn | ObjectService;\n\ntype OpenType =\n | \"contact\"\n | \"getPhoneNumber\"\n | \"getUserInfo\"\n | \"launchApp\"\n | \"scope\";\n\nexport interface AuthorizeProps extends StandardProps {\n authorize: boolean;\n openType?: OpenType;\n authScope?: AuthScope;\n children?: React.ReactElement | string;\n onAuthorize?: Function;\n service?: AuthorizeService;\n}\n\nconst SUCCESS_MSG = {\n getPhoneNumber: \"getPhoneNumber:ok\",\n getUserInfo: \"getUserInfo:ok\",\n};\n\nasync function getService(\n service: AuthorizeService,\n param: object = {}\n): Promise<any> {\n if (service === void 0) {\n throw `service is undefined!`;\n }\n if (isPromise(service)) {\n return (service as PromiseFn)(param);\n }\n let { params, fn, needMiniCode, codeKey } = service as ObjectService;\n params = {\n ...params,\n ...param,\n };\n if (needMiniCode) {\n params[codeKey || \"code\"] = await login();\n }\n return fn(params);\n}\n\nasync function onGetPhoneNumber(eve: any) {\n const { errMsg, ...rest } = eve.detail;\n if (errMsg !== SUCCESS_MSG.getPhoneNumber) {\n return;\n }\n try {\n let userinfo = await getService(this.service, rest);\n // dispatch({type:\"userinfo/update\",payload:{userinfo}});\n onSuccess.bind(this, userinfo, eve)();\n } catch (error) {}\n}\n\nasync function onGetUserInfo(eve: any) {\n const { errMsg, ...rest } = eve.detail;\n if (errMsg !== SUCCESS_MSG.getUserInfo) {\n return;\n }\n try {\n let userinfo = await getService(this.service, rest);\n // dispatch({type:\"userinfo/update\",payload:{userinfo}});\n onSuccess.bind(this, userinfo, eve)();\n } catch (error) {}\n}\n\nfunction authorizeScope(eve: any) {\n ensureAuthScope(this.authScope)\n .then(() => {\n this.onAuthorize && this.onAuthorize(eve);\n })\n .catch(() => {\n console.log(`未授权:${this.authScope}`);\n });\n}\n\nfunction onSuccess(...args: any) {\n isFunction(this.onAuthorize) && this.onAuthorize(...args);\n}\n\nconst Authorize = (props: AuthorizeProps) => {\n const { authorize, onAuthorize, className = \"\", openType, ...rest } = props;\n function onClick(eve: any) {\n if (!openType) return;\n const openTypeFns = {\n contact: onSuccess.bind(props),\n launchApp: onSuccess.bind(props),\n scope: authorizeScope.bind(props),\n getUserInfo: onGetUserInfo.bind(props),\n getPhoneNumber: onGetPhoneNumber.bind(props),\n };\n\n if (!isFunction(openTypeFns[openType])) return;\n openTypeFns[openType](eve);\n }\n return (\n <React.Fragment>\n {!authorize ? (\n // @ts-ignore\n <Button\n {...rest}\n openType={openType}\n onClick={onClick}\n onContact={onClick}\n onLaunchapp={onClick}\n onGetUserInfo={onClick}\n onGetPhoneNumber={onClick}\n className={`__authorize__ ${className}`}\n >\n {props?.children}\n </Button>\n ) : (\n // @ts-ignore\n <Button\n {...rest}\n openType=\"\"\n onClick={(eve) => onAuthorize && onAuthorize(eve)}\n className={`__authorize__ ${className}`}\n >\n {props?.children}\n </Button>\n )}\n </React.Fragment>\n );\n};\n\nAuthorize.options = {\n addGlobalClass: true,\n};\n\nexport default Authorize;\n"],"names":[],"mappings":";;;;;;AAsCA,IAAM,WAAW,GAAG;IAClB,cAAc,EAAE,mBAAmB;IACnC,WAAW,EAAE,gBAAgB;CAC9B,CAAC;AAEF,SAAe,UAAU,CACvB,OAAyB,EACzB,KAAkB;IAAlB,sBAAA,EAAA,UAAkB;;;;;;oBAElB,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE;wBACtB,MAAM,uB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,CAAC,CAAC;YAAE,OAAO;QAC/C,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;KAC5B;IACD,QACE,oBAAC,KAAK,CAAC,QAAQ,QACZ,CAAC,SAAS;;IAET,oBAAC,MAAM,eACD,IAAI,IACR,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,OAAO,EACpB,aAAa,EAAE,OAAO,EACtB,gBAAgB,EAAE,OAAO,EACzB,SAAS,EAAE,mBAAiB,SAAW,KAEtC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CACT;;IAGT,oBAAC,MAAM,eACD,IAAI,IACR,QAAQ,EAAC,EAAE,EACX,OAAO,EAAE,UAAC,GAAG,IAAK,OAAA,WAAW,IAAI,WAAW,CAAC,GAAG,CAAC,GAAA,EACjD,SAAS,EAAE,mBAAiB,SAAW,KAEtC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CACT,CACV,CACc,EACjB;AACJ,EAAE;AAEF,SAAS,CAAC,OAAO,GAAG;IAClB,cAAc,EAAE,IAAI;CACrB;;;;"} |
| /// <reference types="react" /> | ||
| import { IconProps } from "@vyron/mini-components/icon"; | ||
| import { ViewProps } from "@tarojs/components/types/View"; | ||
| import { CustomElement, CustomStyle } from "@vyron/mini-components/types"; | ||
| import { IconProps } from "../icon"; | ||
| import { CustomElement, CustomStyle } from "../types"; | ||
| export interface CellGroupProps extends ViewProps { | ||
@@ -6,0 +6,0 @@ title?: CustomElement; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../packages/cell/index.tsx"],"sourcesContent":["import React, { useMemo, isValidElement } from \"react\";\nimport { View } from \"@tarojs/components\";\nimport Icon, { IconProps } from \"@vyron/mini-components/icon\";\nimport { ViewProps } from \"@tarojs/components/types/View\";\nimport { CustomElement, CustomStyle } from \"@vyron/mini-components/types\";\nimport {\n isFunction,\n isNull,\n isUndefined,\n navigateTo,\n redirectTo,\n} from \"@vyron/mini-components/common\";\n\n\n\nexport interface CellGroupProps extends ViewProps {\n title?: CustomElement;\n titleClass?: string;\n titleStyle?: CustomStyle;\n border?: boolean;\n children?: CustomElement;\n}\n\nexport type ArrowDirection = \"left\" | \"right\" | \"up\" | \"down\";\n\nexport interface CellProps extends ViewProps {\n title?: CustomElement;\n colon?: boolean;\n titleClass?: string;\n titleStyle?: CustomStyle;\n value: CustomElement;\n valueClass?: string;\n valueStyle?: CustomStyle;\n label?: CustomElement;\n labelClass?: string;\n labelStyle?: CustomStyle;\n icon?: CustomElement | IconProps;\n rightIcon?: CustomElement | IconProps;\n url?: string;\n replace?: boolean;\n required?: boolean;\n center?: boolean;\n arrow?: boolean;\n border?: boolean;\n arrowDirection?: ArrowDirection;\n children?: CustomElement;\n}\n\nconst defaultCellProps = {\n colon: false,\n replace: false,\n center: false,\n arrow: false,\n border: true,\n arrowDirection: \"right\",\n};\n\nconst Cell = (props: CellProps) => {\n const {\n title,\n colon,\n titleClass,\n titleStyle,\n value,\n valueClass,\n valueStyle,\n label,\n labelClass,\n labelStyle,\n icon,\n rightIcon,\n url,\n replace,\n required,\n arrow,\n arrowDirection,\n center,\n className,\n onClick,\n border,\n ...restProps\n } = {\n ...defaultCellProps,\n ...props,\n };\n\n const _label = useMemo(() => {\n if (isUndefined(label)) return null;\n return (\n <View\n className={`__cell__label__ ${labelClass ?? \"\"}`}\n style={labelStyle ?? \"\"}\n >\n {label}\n </View>\n );\n }, [label, labelClass, labelStyle]);\n\n const _icon = useMemo(() => {\n if (isUndefined(icon)) return null;\n let _iconProps = (typeof icon === \"string\"\n ? { type: icon }\n : icon) as IconProps;\n return isValidElement(icon) ? (\n icon\n ) : (\n <Icon\n {..._iconProps}\n className={`__cell__left__icon__ ${_iconProps?.className ?? \"\"}`}\n />\n );\n }, [icon]);\n\n const _rightIcon = useMemo(() => {\n if (isUndefined(rightIcon) && !arrow) return null;\n let _iconProps = (typeof rightIcon === \"string\"\n ? { type: rightIcon }\n : rightIcon) as IconProps;\n if (arrow) {\n _iconProps = {\n type: \"icon-back5\",\n className: `__cell__icon__arrow__ ${arrowDirection ?? \"\"}`,\n };\n }\n return isValidElement(rightIcon) ? (\n rightIcon\n ) : (\n <Icon\n {..._iconProps}\n className={`__cell__right__icon__ ${_iconProps?.className ?? \"\"}`}\n />\n );\n }, [arrow, arrowDirection, rightIcon]);\n\n const _title = useMemo(() => {\n if (isUndefined(title)) return null;\n return (\n <View\n style={titleStyle ?? \"\"}\n className={`__cell__title__ ${titleClass ?? \"\"}`}\n >\n {title}\n {colon ? \":\" : \"\"}\n {_label}\n </View>\n );\n }, [_label, colon, title, titleClass, titleStyle]);\n\n const _value = useMemo(() => {\n return (\n <View\n className={`__cell__value__ ${\n isNull(_title) ? \"__cell__value__only__\" : \"\"\n } ${valueClass ?? \"\"}`}\n style={valueStyle ?? \"\"}\n >\n {value}\n </View>\n );\n }, [_title, value, valueClass, valueStyle]);\n\n return (\n <View\n {...restProps}\n onClick={(eve) => {\n const isUrl = typeof url === \"string\";\n if (isFunction(onClick)) {\n // @ts-ignore\n isUrl ? onClick({ replace, url }, eve) : onClick(eve);\n }\n if (!isUrl) return;\n // @ts-ignore\n replace ? redirectTo(url) : navigateTo({ url });\n }}\n className={`__cell__ ${required ? \"__cell__required__\" : \"\"} ${\n border ? \"__cell__border__\" : \"\"\n } ${center ? \"__cell__center__\" : \"\"} ${className ?? \"\"}`}\n >\n {_icon}\n {_title}\n {_value}\n {_rightIcon}\n {props?.children}\n </View>\n );\n};\n\nconst defaultCellGroupProps: CellGroupProps = {\n border: true,\n};\nconst CellGroup = (props: CellGroupProps): typeof CellGroup => {\n const { title, titleClass, titleStyle, border, className, ...restProps } = {\n ...defaultCellGroupProps,\n ...props,\n };\n\n const cellGroup = useMemo(\n () => (\n <View\n {...restProps}\n className={`__cell__group__ ${border ? \"border-top-bottom\" : \"\"} ${\n className ?? \"\"\n }`}\n >\n {props?.children}\n </View>\n ),\n [border, className, props, restProps]\n );\n\n const titleComponent = useMemo(() => {\n if (isUndefined(title)) return null;\n return !isValidElement(title) ? (\n <View\n style={titleStyle}\n className={`__cell__group__title__ ${titleClass ?? \"\"}`}\n >\n {title}\n </View>\n ) : (\n title\n );\n }, [title, titleClass, titleStyle]);\n\n return title ? (\n <React.Fragment>\n {titleComponent}\n {cellGroup}\n </React.Fragment>\n ) : (\n cellGroup\n );\n};\n\nexport { Cell as default, CellGroup };\n"],"names":[],"mappings":";;;;;;AAgDA,IAAM,gBAAgB,GAAG;IACvB,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE,OAAO;CACxB,CAAC;IAEI,IAAI,GAAG,UAAC,KAAgB;IAC5B,IAAM,2BAwBD,gBAAgB,GAChB,KAAK,CACT,EAzBC,KAAK,WAAA,EACL,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,UAAU,gBAAA,EACV,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,UAAU,gBAAA,EACV,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,UAAU,gBAAA,EACV,IAAI,UAAA,EACJ,SAAS,eAAA,EACT,GAAG,SAAA,EACH,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,KAAK,WAAA,EACL,cAAc,oBAAA,EACd,MAAM,YAAA,EACN,SAAS,eAAA,EACT,OAAO,aAAA,EACP,MAAM,YAAA,EACH,SAAS,cAtBR,kPAuBL,CAGA,CAAC;IAEF,IAAM,MAAM,GAAG,OAAO,CAAC;QACrB,IAAI,WAAW,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACpC,QACE,oBAAC,IAAI,IACH,SAAS,EAAE,sBAAmB,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,CAAE,EAChD,KAAK,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,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jB,SAAS,CACV,CAAC;AACJ;;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../packages/cell/index.tsx"],"sourcesContent":["import React, { useMemo, isValidElement } from \"react\";\nimport { View } from \"@tarojs/components\";\nimport Icon from \"@vyron/mini-components/icon\";\nimport { ViewProps } from \"@tarojs/components/types/View\";\nimport {\n isFunction,\n isNull,\n isUndefined,\n navigateTo,\n redirectTo,\n} from \"@vyron/mini-components/common\";\nimport { IconProps } from \"../icon\";\nimport { CustomElement, CustomStyle } from \"../types\";\n\nexport interface CellGroupProps extends ViewProps {\n title?: CustomElement;\n titleClass?: string;\n titleStyle?: CustomStyle;\n border?: boolean;\n children?: CustomElement;\n}\n\nexport type ArrowDirection = \"left\" | \"right\" | \"up\" | \"down\";\n\nexport interface CellProps extends ViewProps {\n title?: CustomElement;\n colon?: boolean;\n titleClass?: string;\n titleStyle?: CustomStyle;\n value: CustomElement;\n valueClass?: string;\n valueStyle?: CustomStyle;\n label?: CustomElement;\n labelClass?: string;\n labelStyle?: CustomStyle;\n icon?: CustomElement | IconProps;\n rightIcon?: CustomElement | IconProps;\n url?: string;\n replace?: boolean;\n required?: boolean;\n center?: boolean;\n arrow?: boolean;\n border?: boolean;\n arrowDirection?: ArrowDirection;\n children?: CustomElement;\n}\n\nconst defaultCellProps = {\n colon: false,\n replace: false,\n center: false,\n arrow: false,\n border: true,\n arrowDirection: \"right\",\n};\n\nconst Cell = (props: CellProps) => {\n const {\n title,\n colon,\n titleClass,\n titleStyle,\n value,\n valueClass,\n valueStyle,\n label,\n labelClass,\n labelStyle,\n icon,\n rightIcon,\n url,\n replace,\n required,\n arrow,\n arrowDirection,\n center,\n className,\n onClick,\n border,\n ...restProps\n } = {\n ...defaultCellProps,\n ...props,\n };\n\n const _label = useMemo(() => {\n if (isUndefined(label)) return null;\n return (\n <View\n className={`__cell__label__ ${labelClass ?? \"\"}`}\n style={labelStyle ?? \"\"}\n >\n {label}\n </View>\n );\n }, [label, labelClass, labelStyle]);\n\n const _icon = useMemo(() => {\n if (isUndefined(icon)) return null;\n let _iconProps = (typeof icon === \"string\"\n ? { type: icon }\n : icon) as IconProps;\n return isValidElement(icon) ? (\n icon\n ) : (\n <Icon\n {..._iconProps}\n className={`__cell__left__icon__ ${_iconProps?.className ?? \"\"}`}\n />\n );\n }, [icon]);\n\n const _rightIcon = useMemo(() => {\n if (isUndefined(rightIcon) && !arrow) return null;\n let _iconProps = (typeof rightIcon === \"string\"\n ? { type: rightIcon }\n : rightIcon) as IconProps;\n if (arrow) {\n _iconProps = {\n type: \"icon-back5\",\n className: `__cell__icon__arrow__ ${arrowDirection ?? \"\"}`,\n };\n }\n return isValidElement(rightIcon) ? (\n rightIcon\n ) : (\n <Icon\n {..._iconProps}\n className={`__cell__right__icon__ ${_iconProps?.className ?? \"\"}`}\n />\n );\n }, [arrow, arrowDirection, rightIcon]);\n\n const _title = useMemo(() => {\n if (isUndefined(title)) return null;\n return (\n <View\n style={titleStyle ?? \"\"}\n className={`__cell__title__ ${titleClass ?? \"\"}`}\n >\n {title}\n {colon ? \":\" : \"\"}\n {_label}\n </View>\n );\n }, [_label, colon, title, titleClass, titleStyle]);\n\n const _value = useMemo(() => {\n return (\n <View\n className={`__cell__value__ ${\n isNull(_title) ? \"__cell__value__only__\" : \"\"\n } ${valueClass ?? \"\"}`}\n style={valueStyle ?? \"\"}\n >\n {value}\n </View>\n );\n }, [_title, value, valueClass, valueStyle]);\n\n return (\n <View\n {...restProps}\n onClick={(eve) => {\n const isUrl = typeof url === \"string\";\n if (isFunction(onClick)) {\n // @ts-ignore\n isUrl ? onClick({ replace, url }, eve) : onClick(eve);\n }\n if (!isUrl) return;\n // @ts-ignore\n replace ? redirectTo(url) : navigateTo({ url });\n }}\n className={`__cell__ ${required ? \"__cell__required__\" : \"\"} ${\n border ? \"__cell__border__\" : \"\"\n } ${center ? \"__cell__center__\" : \"\"} ${className ?? \"\"}`}\n >\n {_icon}\n {_title}\n {_value}\n {_rightIcon}\n {props?.children}\n </View>\n );\n};\n\nconst defaultCellGroupProps: CellGroupProps = {\n border: true,\n};\nconst CellGroup = (props: CellGroupProps): typeof CellGroup => {\n const { title, titleClass, titleStyle, border, className, ...restProps } = {\n ...defaultCellGroupProps,\n ...props,\n };\n\n const cellGroup = useMemo(\n () => (\n <View\n {...restProps}\n className={`__cell__group__ ${border ? \"border-top-bottom\" : \"\"} ${\n className ?? \"\"\n }`}\n >\n {props?.children}\n </View>\n ),\n [border, className, props, restProps]\n );\n\n const titleComponent = useMemo(() => {\n if (isUndefined(title)) return null;\n return !isValidElement(title) ? (\n <View\n style={titleStyle}\n className={`__cell__group__title__ ${titleClass ?? \"\"}`}\n >\n {title}\n </View>\n ) : (\n title\n );\n }, [title, titleClass, titleStyle]);\n\n return title ? (\n <React.Fragment>\n {titleComponent}\n {cellGroup}\n </React.Fragment>\n ) : (\n cellGroup\n );\n};\n\nexport { Cell as default, CellGroup };\n"],"names":[],"mappings":";;;;;;AA+CA,IAAM,gBAAgB,GAAG;IACvB,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE,OAAO;CACxB,CAAC;IAEI,IAAI,GAAG,UAAC,KAAgB;IAC5B,IAAM,2BAwBD,gBAAgB,GAChB,KAAK,CACT,EAzBC,KAAK,WAAA,EACL,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,UAAU,gBAAA,EACV,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,UAAU,gBAAA,EACV,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,UAAU,gBAAA,EACV,IAAI,UAAA,EACJ,SAAS,eAAA,EACT,GAAG,SAAA,EACH,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,KAAK,WAAA,EACL,cAAc,oBAAA,EACd,MAAM,YAAA,EACN,SAAS,eAAA,EACT,OAAO,aAAA,EACP,MAAM,YAAA,EACH,SAAS,cAtBR,k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AAU,EACjB,SAAS,EAAE,6BAA0B,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,CAAE,IAEtD,KAAK,CACD,KAEP,KAAK,CACN,CAAC;KACH,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IAEpC,OAAO,KAAK,IACV,oBAAC,KAAK,CAAC,QAAQ;QACZ,cAAc;QACd,SAAS,CACK,KAEjB,SAAS,CACV,CAAC;AACJ;;;;;"} |
@@ -1,10 +0,10 @@ | ||
| export { default as useUpdate } from "@vyron/mini-components/common/hooks/useUpdate"; | ||
| export { default as useMount } from "@vyron/mini-components/common/hooks/useMount"; | ||
| export { default as useUnmount } from "@vyron/mini-components/common/hooks/useUnmount"; | ||
| export { default as useUpdateEffect } from "@vyron/mini-components/common/hooks/useUpdateEffect"; | ||
| export { default as useUpdateLayoutEffect } from "@vyron/mini-components/common/hooks/useUpdateLayoutEffect"; | ||
| export { default as useWhyUpdate } from "@vyron/mini-components/common/hooks/useWhyUpdate"; | ||
| export { default as useMenuButton } from "@vyron/mini-components/common/hooks/useMenuButton"; | ||
| export { default as useSystemInfo } from "@vyron/mini-components/common/hooks/useSystemInfo"; | ||
| export { default as usePrevious } from "@vyron/mini-components/common/hooks/usePrevious"; | ||
| export { default as useTransition } from "@vyron/mini-components/common/hooks/useTransition"; | ||
| export { default as useUpdate } from "./useUpdate"; | ||
| export { default as useMount } from "./useMount"; | ||
| export { default as useUnmount } from "./useUnmount"; | ||
| export { default as useUpdateEffect } from "./useUpdateEffect"; | ||
| export { default as useUpdateLayoutEffect } from "./useUpdateLayoutEffect"; | ||
| export { default as useWhyUpdate } from "./useWhyUpdate"; | ||
| export { default as useMenuButton } from "./useMenuButton"; | ||
| export { default as useSystemInfo } from "./useSystemInfo"; | ||
| export { default as usePrevious } from "./usePrevious"; | ||
| export { default as useTransition } from "./useTransition"; |
@@ -1,11 +0,11 @@ | ||
| export { default as useUpdate } from '@vyron/mini-components/lib/common/hooks/useUpdate'; | ||
| export { default as useMount } from '@vyron/mini-components/lib/common/hooks/useMount'; | ||
| export { default as useUnmount } from '@vyron/mini-components/lib/common/hooks/useUnmount'; | ||
| export { default as useUpdateEffect } from '@vyron/mini-components/lib/common/hooks/useUpdateEffect'; | ||
| export { default as useUpdateLayoutEffect } from '@vyron/mini-components/lib/common/hooks/useUpdateLayoutEffect'; | ||
| export { default as useWhyUpdate } from '@vyron/mini-components/lib/common/hooks/useWhyUpdate'; | ||
| export { default as useMenuButton } from '@vyron/mini-components/lib/common/hooks/useMenuButton'; | ||
| export { default as useSystemInfo } from '@vyron/mini-components/lib/common/hooks/useSystemInfo'; | ||
| export { default as usePrevious } from '@vyron/mini-components/lib/common/hooks/usePrevious'; | ||
| export { default as useTransition } from '@vyron/mini-components/lib/common/hooks/useTransition'; | ||
| export { default as useUpdate } from './useUpdate'; | ||
| export { default as useMount } from './useMount'; | ||
| export { default as useUnmount } from './useUnmount'; | ||
| export { default as useUpdateEffect } from './useUpdateEffect'; | ||
| export { default as useUpdateLayoutEffect } from './useUpdateLayoutEffect'; | ||
| export { default as useWhyUpdate } from './useWhyUpdate'; | ||
| export { default as useMenuButton } from './useMenuButton'; | ||
| export { default as useSystemInfo } from './useSystemInfo'; | ||
| export { default as usePrevious } from './usePrevious'; | ||
| export { default as useTransition } from './useTransition'; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
| import { BaseObject } from "@vyron/mini-components/types"; | ||
| import { BaseObject } from "../../../types"; | ||
| export declare type navigationBarTextStyle = "black" | "white"; | ||
@@ -3,0 +3,0 @@ export declare type menuProps = { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../../../packages/common/hooks/useMenuButton/index.ts"],"sourcesContent":["import { useRef, useState } from \"react\";\nimport { BaseObject } from \"@vyron/mini-components/types\";\nimport { getMenuButtonBoundingClientRect, get } from \"@vyron/mini-components/common\";\nimport { useMount, useSystemInfo } from \"@vyron/mini-components/common\";\n\nexport type navigationBarTextStyle = \"black\" | \"white\";\n\nexport type menuProps = {\n type?: navigationBarTextStyle;\n};\n\nexport type menuData = {\n rect: BaseObject;\n wrapStyle: BaseObject;\n menuStyle: BaseObject;\n delimiterStyle: BaseObject;\n system: Taro.getSystemInfoSync.Result;\n};\n\nconst defaultMenuProps: menuProps = {\n type: \"white\" as navigationBarTextStyle,\n};\n\nconst defaultColors = {\n border: {\n black: `rgba(0,0,0,0.1)`,\n white: `rgba(255,255,255,0.25)`,\n },\n background: {\n black: \"rgba(252,252,252,0.6)\",\n white: \"rgba(0,0,0,0.15)\",\n },\n delimiter: {\n black: \"rgba(0,0,0,0.1)\",\n white: \"rgba(255,255,255,0.3)\",\n },\n};\n\nconst useMenuButton = (props: menuProps = {}): menuData => {\n const { type: typeStyle } = {\n ...defaultMenuProps,\n ...props,\n };\n const rectRef = useRef(getMenuButtonBoundingClientRect());\n const systemInfo = useSystemInfo();\n const [style, setStyle] = useState({\n wrapStyle: {},\n menuStyle: {},\n delimiterStyle: {},\n });\n useMount(() => {\n const { width, height, top, right } = rectRef.current;\n const { screenWidth, statusBarHeight } = systemInfo;\n setStyle({\n wrapStyle: {\n position: \"fixed\",\n zIndex: 1000,\n boxSizing: \"border-box\",\n width: screenWidth + \"px\",\n paddingTop: statusBarHeight + \"px\",\n paddingLeft: screenWidth - right + \"px\",\n paddingRight: screenWidth - right + \"px\",\n height: `${\n height + statusBarHeight + (top - statusBarHeight + 2) * 2\n }px`,\n },\n menuStyle: {\n boxSizing: \"border-box\",\n width: width + `px`,\n height: height + `px`,\n borderRadius: height / 2 + `px`,\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: get(defaultColors, `border.${typeStyle}`),\n backgroundColor: get(defaultColors, `background.${typeStyle}`),\n },\n delimiterStyle: {\n width: `1px`,\n height: \"18px\",\n backgroundColor: get(defaultColors, `delimiter.${typeStyle}`),\n },\n });\n });\n return {\n ...style,\n system: systemInfo,\n rect: rectRef.current,\n };\n};\n\nex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G,IAAI;gBACxC,MAAM,EACJ,MAAM,GAAG,eAAe,GAAG,CAAC,GAAG,GAAG,eAAe,GAAG,CAAC,IAAI,CAAC,OACxD;aACL;YACD,SAAS,EAAE;gBACT,SAAS,EAAE,YAAY;gBACvB,KAAK,EAAE,KAAK,GAAG,IAAI;gBACnB,MAAM,EAAE,MAAM,GAAG,IAAI;gBACrB,YAAY,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;gBAC/B,WAAW,EAAE,KAAK;gBAClB,WAAW,EAAE,OAAO;gBACpB,WAAW,EAAE,GAAG,CAAC,aAAa,EAAE,YAAU,SAAW,CAAC;gBACtD,eAAe,EAAE,GAAG,CAAC,aAAa,EAAE,gBAAc,SAAW,CAAC;aAC/D;YACD,cAAc,EAAE;gBACd,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,MAAM;gBACd,eAAe,EAAE,GAAG,CAAC,aAAa,EAAE,eAAa,SAAW,CAAC;aAC9D;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;IACH,6BACK,KAAK,KACR,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,OAAO,CAAC,OAAO,IACrB;AACJ;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../../../packages/common/hooks/useMenuButton/index.ts"],"sourcesContent":["import { useRef, useState } from \"react\";\nimport {\n getMenuButtonBoundingClientRect,\n get,\n} from \"@vyron/mini-components/common\";\nimport { useMount, useSystemInfo } from \"@vyron/mini-components/common\";\nimport { BaseObject } from \"../../../types\";\n\nexport type navigationBarTextStyle = \"black\" | \"white\";\n\nexport type menuProps = {\n type?: navigationBarTextStyle;\n};\n\nexport type menuData = {\n rect: BaseObject;\n wrapStyle: BaseObject;\n menuStyle: BaseObject;\n delimiterStyle: BaseObject;\n system: Taro.getSystemInfoSync.Result;\n};\n\nconst defaultMenuProps: menuProps = {\n type: \"white\" as navigationBarTextStyle,\n};\n\nconst defaultColors = {\n border: {\n black: `rgba(0,0,0,0.1)`,\n white: `rgba(255,255,255,0.25)`,\n },\n background: {\n black: \"rgba(252,252,252,0.6)\",\n white: \"rgba(0,0,0,0.15)\",\n },\n delimiter: {\n black: \"rgba(0,0,0,0.1)\",\n white: \"rgba(255,255,255,0.3)\",\n },\n};\n\nconst useMenuButton = (props: menuProps = {}): menuData => {\n const { type: typeStyle } = {\n ...defaultMenuProps,\n ...props,\n };\n const rectRef = useRef(getMenuButtonBoundingClientRect());\n const systemInfo = useSystemInfo();\n const [style, setStyle] = useState({\n wrapStyle: {},\n menuStyle: {},\n delimiterStyle: {},\n });\n useMount(() => {\n const { width, height, top, right } = rectRef.current;\n const { screenWidth, statusBarHeight } = systemInfo;\n setStyle({\n wrapStyle: {\n position: \"fixed\",\n zIndex: 1000,\n boxSizing: \"border-box\",\n width: screenWidth + \"px\",\n paddingTop: statusBarHeight + \"px\",\n paddingLeft: screenWidth - right + \"px\",\n paddingRight: screenWidth - right + \"px\",\n height: `${\n height + statusBarHeight + (top - statusBarHeight + 2) * 2\n }px`,\n },\n menuStyle: {\n boxSizing: \"border-box\",\n width: width + `px`,\n height: height + `px`,\n borderRadius: height / 2 + `px`,\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: get(defaultColors, `border.${typeStyle}`),\n backgroundColor: get(defaultColors, `background.${typeStyle}`),\n },\n delimiterStyle: {\n width: `1px`,\n height: \"18px\",\n backgroundColor: get(defaultColors, `delimiter.${typeStyle}`),\n },\n });\n });\n return {\n ...style,\n system: systemInfo,\n rect: rectRef.current,\n };\n};\n\nexport default useMenuButton;\n"],"names":[],"mappings":";;;;AAsBA,IAAM,gBAAgB,GAAc;IAClC,IAAI,EAAE,OAAiC;CACxC,CAAC;AAEF,IAAM,aAAa,GAAG;IACpB,MAAM,EAAE;QACN,KAAK,EAAE,iBAAiB;QACxB,KAAK,EAAE,wBAAwB;KAChC;IACD,UAAU,EAAE;QACV,KAAK,EAAE,uBAAuB;QAC9B,KAAK,EAAE,kBAAkB;KAC1B;IACD,SAAS,EAAE;QACT,KAAK,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gBAClB,WAAW,EAAE,OAAO;gBACpB,WAAW,EAAE,GAAG,CAAC,aAAa,EAAE,YAAU,SAAW,CAAC;gBACtD,eAAe,EAAE,GAAG,CAAC,aAAa,EAAE,gBAAc,SAAW,CAAC;aAC/D;YACD,cAAc,EAAE;gBACd,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,MAAM;gBACd,eAAe,EAAE,GAAG,CAAC,aAAa,EAAE,eAAa,SAAW,CAAC;aAC9D;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;IACH,6BACK,KAAK,KACR,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,OAAO,CAAC,OAAO,IACrB;AACJ;;;;"} |
@@ -1,2 +0,2 @@ | ||
| import { TransitionType } from "@vyron/mini-components/transition"; | ||
| import { TransitionType } from "../../../transition"; | ||
| export interface useTransitionProps { | ||
@@ -3,0 +3,0 @@ show: boolean; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../../../packages/common/hooks/useTransition/index.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { TransitionType } from \"@vyron/mini-components/transition\";\nimport { requestAnimationFrame } from \"@vyron/mini-components/common\";\n\ntype TransitionStatus = \"enter\" | \"enterTo\" | \"leave\" | \"leaveTo\";\n\nconst getClassNames = (name: TransitionType) => ({\n enter: `__${name}__enter__ __${name}__enter__active__ ${name}-enter-active`,\n enterTo: `__${name}__enter__to__ __${name}__enter__active__ ${name}-enter-active`,\n leave: `__${name}__leave__ __${name}__leave__active__ ${name}-leave-active`,\n leaveTo: `__${name}__leave__to__ __${name}__leave__active__ ${name}-leave-active`,\n});\n\nexport interface useTransitionProps {\n show: boolean;\n name: TransitionType;\n transitionDuration: number; //ms\n beforeEnter?: Function;\n onEnter?: Function;\n beforeLeave?: Function;\n onLeave?: Function;\n}\n\nconst useTransition = (props: useTransitionProps) => {\n const {\n show,\n name,\n beforeEnter,\n onEnter,\n beforeLeave,\n onLeave,\n transitionDuration,\n } = props;\n const [inited, setInited] = useState(false);\n const [display, setDisplay] = useState(show);\n const [className, setClassName] = useState(\"\");\n\n useEffect(() => {\n if (show === display) {\n return;\n }\n show ? enter() : leave();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [show]);\n let status: null | TransitionStatus = null;\n let transitionEnded: boolean;\n function enter() {\n status = \"enter\";\n const classes = getClassNames(name);\n beforeEnter && beforeEnter();\n requestAnimationFrame(() => {\n onEnter && onEnter();\n !inited && setInited(true);\n setDisplay(true);\n setClassName(classes.enter);\n requestAnimationFrame(() => {\n status = \"enterTo\";\n transitionEnded = false;\n setClassName(classes.enterTo);\n });\n });\n }\n function leave() {\n status = \"leave\";\n const classes = getClassNames(name);\n beforeLeave && beforeLeave();\n requestAnimationFrame(() => {\n onLeave && onLeave();\n setClassName(classes.leave);\n requestAnimationFrame(() => {\n status = \"leaveTo\";\n transitionEnded = false;\n setTimeout(() => onTransitionEnd(), transitionDuration);\n setClassName(classes.leaveTo);\n });\n });\n }\n function onTransitionEnd() {\n if (transitionEnded) return;\n status = null;\n transitionEnded = true;\n // setClassName(\"\");\n if (!show && display) {\n setDisplay(false);\n }\n }\n return {\n inited,\n status,\n display,\n className,\n transitionDuration,\n onTransitionEnd,\n };\n};\n\nexport default useTransition;\n"],"names":[],"mappings":";;;AAMA,IAAM,aAAa,GAAG,UAAC,IAAoB,IAAK,QAAC;IAC/C,KAAK,EAAE,OAAK,IAAI,oBAAe,IAAI,0BAAqB,IAAI,kBAAe;IAC3E,OAAO,EAAE,OAAK,IAAI,wBAAmB,IAAI,0BAAqB,IAAI,kBAAe;IACjF,KAAK,EAAE,OAAK,IAAI,oBAAe,IAAI,0BAAqB,IAAI,kBAAe;IAC3E,OAAO,EAAE,OAAK,IAAI,wBAAmB,IAAI,0BAAqB,IAAI,kBAAe;CAClF,IAAC,CAAC;IAYG,aAAa,GAAG,UAAC,KAAyB;IAE5C,IAAA,IAAI,GAOF,KAAK,KAPH,EACJ,IAAI,GAMF,KAAK,KANH,EACJ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,CAAC,IAAI,CAAC,CAAC;QACpC,WAAW,IAAI,WAAW,EAAE,CAAC;QAC7B,qBAAqB,CAAC;YACpB,OAAO,IAAI,OAAO,EAAE,CAAC;YACrB,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5B,qBAAqB,CAAC;gBACpB,MAAM,GAAG,SAAS,CAAC;gBACnB,eAAe,GAAG,KAAK,CAAC;gBACxB,UAAU,CAAC,cAAM,OAAA,eAAe,EAAE,GAAA,EAAE,kBAAkB,CAAC,CAAC;gBACxD,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAC/B,CAAC,CAAC;SACJ,CAAC,CAAC;KACJ;IACD,SAAS,eAAe;QACtB,IAAI,eAAe;YAAE,OAAO;QAC5B,MAAM,GAAG,IAAI,CAAC;QACd,eAAe,GAAG,IAAI,CAAC;;QAEvB,IAAI,CAAC,IAAI,IAAI,OAAO,EAAE;YACpB,UAAU,CAAC,KAAK,CAAC,CAAC;SACnB;KACF;IACD,OAAO;QACL,MAAM,QAAA;QACN,MAAM,QAAA;QACN,OAAO,SAAA;QACP,SAAS,WAAA;QACT,kBAAkB,oBAAA;QAClB,eAAe,iBAAA;KAChB,CAAC;AACJ;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../../../packages/common/hooks/useTransition/index.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { requestAnimationFrame } from \"@vyron/mini-components/common\";\nimport { TransitionType } from \"../../../transition\";\n\ntype TransitionStatus = \"enter\" | \"enterTo\" | \"leave\" | \"leaveTo\";\n\nconst getClassNames = (name: TransitionType) => ({\n enter: `__${name}__enter__ __${name}__enter__active__ ${name}-enter-active`,\n enterTo: `__${name}__enter__to__ __${name}__enter__active__ ${name}-enter-active`,\n leave: `__${name}__leave__ __${name}__leave__active__ ${name}-leave-active`,\n leaveTo: `__${name}__leave__to__ __${name}__leave__active__ ${name}-leave-active`,\n});\n\nexport interface useTransitionProps {\n show: boolean;\n name: TransitionType;\n transitionDuration: number; //ms\n beforeEnter?: Function;\n onEnter?: Function;\n beforeLeave?: Function;\n onLeave?: Function;\n}\n\nconst useTransition = (props: useTransitionProps) => {\n const {\n show,\n name,\n beforeEnter,\n onEnter,\n beforeLeave,\n onLeave,\n transitionDuration,\n } = props;\n const [inited, setInited] = useState(false);\n const [display, setDisplay] = useState(show);\n const [className, setClassName] = useState(\"\");\n\n useEffect(() => {\n if (show === display) {\n return;\n }\n show ? enter() : leave();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [show]);\n let status: null | TransitionStatus = null;\n let transitionEnded: boolean;\n function enter() {\n status = \"enter\";\n const classes = getClassNames(name);\n beforeEnter && beforeEnter();\n requestAnimationFrame(() => {\n onEnter && onEnter();\n !inited && setInited(true);\n setDisplay(true);\n setClassName(classes.enter);\n requestAnimationFrame(() => {\n status = \"enterTo\";\n transitionEnded = false;\n setClassName(classes.enterTo);\n });\n });\n }\n function leave() {\n status = \"leave\";\n const classes = getClassNames(name);\n beforeLeave && beforeLeave();\n requestAnimationFrame(() => {\n onLeave && onLeave();\n setClassName(classes.leave);\n requestAnimationFrame(() => {\n status = \"leaveTo\";\n transitionEnded = false;\n setTimeout(() => onTransitionEnd(), transitionDuration);\n setClassName(classes.leaveTo);\n });\n });\n }\n function onTransitionEnd() {\n if (transitionEnded) return;\n status = null;\n transitionEnded = true;\n // setClassName(\"\");\n if (!show && display) {\n setDisplay(false);\n }\n }\n return {\n inited,\n status,\n display,\n className,\n transitionDuration,\n onTransitionEnd,\n };\n};\n\nexport default useTransition;\n"],"names":[],"mappings":";;;AAMA,IAAM,aAAa,GAAG,UAAC,IAAoB,IAAK,QAAC;IAC/C,KAAK,EAAE,OAAK,IAAI,oBAAe,IAAI,0BAAqB,IAAI,kBAAe;IAC3E,OAAO,EAAE,OAAK,IAAI,wBAAmB,IAAI,0BAAqB,IAAI,kBAAe;IACjF,KAAK,EAAE,OAAK,IAAI,oBAAe,IAAI,0BAAqB,IAAI,kBAAe;IAC3E,OA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AK,CAAC;gBACxB,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAC/B,CAAC,CAAC;SACJ,CAAC,CAAC;KACJ;IACD,SAAS,KAAK;QACZ,MAAM,GAAG,OAAO,CAAC;QACjB,IAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACpC,WAAW,IAAI,WAAW,EAAE,CAAC;QAC7B,qBAAqB,CAAC;YACpB,OAAO,IAAI,OAAO,EAAE,CAAC;YACrB,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5B,qBAAqB,CAAC;gBACpB,MAAM,GAAG,SAAS,CAAC;gBACnB,eAAe,GAAG,KAAK,CAAC;gBACxB,UAAU,CAAC,cAAM,OAAA,eAAe,EAAE,GAAA,EAAE,kBAAkB,CAAC,CAAC;gBACxD,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAC/B,CAAC,CAAC;SACJ,CAAC,CAAC;KACJ;IACD,SAAS,eAAe;QACtB,IAAI,eAAe;YAAE,OAAO;QAC5B,MAAM,GAAG,IAAI,CAAC;QACd,eAAe,GAAG,IAAI,CAAC;;QAEvB,IAAI,CAAC,IAAI,IAAI,OAAO,EAAE;YACpB,UAAU,CAAC,KAAK,CAAC,CAAC;SACnB;KACF;IACD,OAAO;QACL,MAAM,QAAA;QACN,MAAM,QAAA;QACN,OAAO,SAAA;QACP,SAAS,WAAA;QACT,kBAAkB,oBAAA;QAClB,eAAe,iBAAA;KAChB,CAAC;AACJ;;;;"} |
| import { ReactElement } from "react"; | ||
| import { IconProps } from "@vyron/mini-components/icon"; | ||
| import { IconProps } from "../icon"; | ||
| export declare type EmptyType = "empty" | "network" | "error"; | ||
@@ -4,0 +4,0 @@ export interface EmptyProps { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../packages/empty/index.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { View } from \"@tarojs/components\";\nimport Icon, { IconProps } from \"@vyron/mini-components/icon\";\n\n\nexport type EmptyType = \"empty\" | \"network\" | \"error\";\n\nexport interface EmptyProps {\n image?: EmptyType | IconProps;\n className?: string;\n description?: string;\n children?: string | ReactElement;\n onClick?: Function;\n}\n\ntype DefaultIconProps = {\n [key: string]: IconProps;\n};\n\nconst defaultIcons: DefaultIconProps = {\n empty: {\n size: \"160rpx\",\n type: `icon-empty`,\n color: \"#999\",\n },\n error: {\n size: \"160rpx\",\n color: \"#FF5722\",\n type: `icon-network_error1`,\n },\n network: {\n size: \"160rpx\",\n color: \"red\",\n type: `icon-network-error`,\n },\n};\n\nconst defaultEmptyProps = {\n image: \"empty\",\n};\n\nconst defaultIconTypes = [\"empty\", \"network\", \"error\"];\n\nconst Empty = (props: EmptyProps) => {\n let { image, className, description, onClick } = {\n ...defaultEmptyProps,\n ...props,\n };\n if (typeof image === \"string\") {\n image = defaultIconTypes.includes(image) ? image : \"empty\";\n }\n const iconProps: IconProps =\n typeof image === \"string\" ? defaultIcons[image] : image;\n return (\n <View\n className={`__empty__ ${className ?? \"\"}`}\n onClick={(eve) => onClick?.(eve)}\n >\n <Icon {...iconProps} />\n {!!description && (\n <View className=\"__empty__description__\">{description}</View>\n )}\n {props?.children}\n </View>\n );\n};\n\nEmpty.options = {\n addGlobalClass: true,\n};\n\nexport default Empty;\n"],"names":[],"mappings":";;;;;AAmBA,IAAM,YAAY,GAAqB;IACrC,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,MAAM;KACd;IACD,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,qBAAqB;KAC5B;IACD,OAAO,EAAE;QACP,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,oBAAoB;KAC3B;CACF,CAAC;AAEF,IAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,IAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAEjD,KAAK,GAAG,UAAC,KAAiB;IAC1B,IAAA,2BACC,iBAAiB,GACjB,KAAK,CACT,EAHK,KAAK,WAAA,EAAE,SAAS,eAAA,EAAE,WAAW,iBAAA,EAAE,OAAO,aAG3C,CAAC;IACF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC;KAC5D;IACD,IAAM,SAAS,GACb,OAAO,KAAK,KAAK,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IAC1D,QACE,oBAAC,IAAI,IACH,SAAS,EAAE,gBAAa,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAE,EACzC,OAAO,EAAE,UAAC,GAAG,WAAK,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,IAAC;QAEhC,oBAAC,IAAI,eAAK,SAAS,EAAI;QACtB,CAAC,CAAC,WAAW,KACZ,oBAAC,IAAI,IAAC,SAAS,EAAC,wBAAwB,IAAE,WAAW,CAAQ,CAC9D,EACA,KAAK,aAAL,KAAK;QAAL,KAAK,CAAE,QAAQ,CACX,EACP;AACJ,EAAE;AAEF,KAAK,CAAC,OAAO,GAAG;IACd,cAAc,EAAE,IAAI;CACrB;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../packages/empty/index.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { View } from \"@tarojs/components\";\nimport Icon from \"@vyron/mini-components/icon\";\nimport { IconProps } from \"../icon\";\n\nexport type EmptyType = \"empty\" | \"network\" | \"error\";\n\nexport interface EmptyProps {\n image?: EmptyType | IconProps;\n className?: string;\n description?: string;\n children?: string | ReactElement;\n onClick?: Function;\n}\n\ntype DefaultIconProps = {\n [key: string]: IconProps;\n};\n\nconst defaultIcons: DefaultIconProps = {\n empty: {\n size: \"160rpx\",\n type: `icon-empty`,\n color: \"#999\",\n },\n error: {\n size: \"160rpx\",\n color: \"#FF5722\",\n type: `icon-network_error1`,\n },\n network: {\n size: \"160rpx\",\n color: \"red\",\n type: `icon-network-error`,\n },\n};\n\nconst defaultEmptyProps = {\n image: \"empty\",\n};\n\nconst defaultIconTypes = [\"empty\", \"network\", \"error\"];\n\nconst Empty = (props: EmptyProps) => {\n let { image, className, description, onClick } = {\n ...defaultEmptyProps,\n ...props,\n };\n if (typeof image === \"string\") {\n image = defaultIconTypes.includes(image) ? image : \"empty\";\n }\n const iconProps: IconProps =\n typeof image === \"string\" ? defaultIcons[image] : image;\n return (\n <View\n className={`__empty__ ${className ?? \"\"}`}\n onClick={(eve) => onClick?.(eve)}\n >\n <Icon {...iconProps} />\n {!!description && (\n <View className=\"__empty__description__\">{description}</View>\n )}\n {props?.children}\n </View>\n );\n};\n\nEmpty.options = {\n addGlobalClass: true,\n};\n\nexport default Empty;\n"],"names":[],"mappings":";;;;;AAmBA,IAAM,YAAY,GAAqB;IACrC,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,MAAM;KACd;IACD,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,qBAAqB;KAC5B;IACD,OAAO,EAAE;QACP,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,oBAAoB;KAC3B;CACF,CAAC;AAEF,IAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,IAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAEjD,KAAK,GAAG,UAAC,KAAiB;IAC1B,IAAA,2BACC,iBAAiB,GACjB,KAAK,CACT,EAHK,KAAK,WAAA,EAAE,SAAS,eAAA,EAAE,WAAW,iBAAA,EAAE,OAAO,aAG3C,CAAC;IACF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC;KAC5D;IACD,IAAM,SAAS,GACb,OAAO,KAAK,KAAK,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IAC1D,QACE,oBAAC,IAAI,IACH,SAAS,EAAE,gBAAa,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAE,EACzC,OAAO,EAAE,UAAC,GAAG,WAAK,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,IAAC;QAEhC,oBAAC,IAAI,eAAK,SAAS,EAAI;QACtB,CAAC,CAAC,WAAW,KACZ,oBAAC,IAAI,IAAC,SAAS,EAAC,wBAAwB,IAAE,WAAW,CAAQ,CAC9D,EACA,KAAK,aAAL,KAAK;QAAL,KAAK,CAAE,QAAQ,CACX,EACP;AACJ,EAAE;AAEF,KAAK,CAAC,OAAO,GAAG;IACd,cAAc,EAAE,IAAI;CACrB;;;;"} |
| /// <reference types="react" /> | ||
| import { IconProps } from "@vyron/mini-components/icon"; | ||
| import { CustomStyle, CustomTextAlign, CustomElement } from "@vyron/mini-components/types"; | ||
| import { InputProps } from "./baseInput"; | ||
| import { IconProps } from "../icon"; | ||
| declare type FieldType = "text" | "number" | "idcard" | "digit" | "tel" | "password" | "textarea"; | ||
@@ -6,0 +6,0 @@ declare type ClearTriggerType = "focus" | "always"; |
+5
-56
@@ -1,4 +0,4 @@ | ||
| import { __assign } from 'tslib'; | ||
| import { __rest, __assign } from 'tslib'; | ||
| import React, { useRef } from 'react'; | ||
| import components_1, { View } from '@tarojs/components'; | ||
| import { Textarea, Input, View } from '@tarojs/components'; | ||
| import Icon from '@vyron/mini-components/lib/icon'; | ||
@@ -8,59 +8,8 @@ import Cell from '@vyron/mini-components/lib/cell'; | ||
| var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
| function getDefaultExportFromCjs (x) { | ||
| return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
| } | ||
| function createCommonjsModule(fn, basedir, module) { | ||
| return module = { | ||
| path: basedir, | ||
| exports: {}, | ||
| require: function (path, base) { | ||
| return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); | ||
| } | ||
| }, fn(module, module.exports), module.exports; | ||
| } | ||
| function commonjsRequire () { | ||
| throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); | ||
| } | ||
| var baseInput = createCommonjsModule(function (module, exports) { | ||
| var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () { | ||
| __assign = Object.assign || function(t) { | ||
| for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
| s = arguments[i]; | ||
| for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
| t[p] = s[p]; | ||
| } | ||
| return t; | ||
| }; | ||
| return __assign.apply(this, arguments); | ||
| }; | ||
| var __rest = (commonjsGlobal && commonjsGlobal.__rest) || function (s, e) { | ||
| var t = {}; | ||
| for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
| t[p] = s[p]; | ||
| if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
| for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
| if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
| t[p[i]] = s[p[i]]; | ||
| } | ||
| return t; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| var BaseInput = function (props) { | ||
| var isTextarea = props.isTextarea, rest = __rest(props, ["isTextarea"]); | ||
| var Component = isTextarea ? components_1.Textarea : components_1.Input; | ||
| return React.default.createElement(Component, __assign({}, rest)); | ||
| var Component = isTextarea ? Textarea : Input; | ||
| return React.createElement(Component, __assign({}, rest)); | ||
| }; | ||
| exports.default = BaseInput; | ||
| }); | ||
| var Input = /*@__PURE__*/getDefaultExportFromCjs(baseInput); | ||
| var defaultFieldProps = { | ||
@@ -215,3 +164,3 @@ type: "text", | ||
| React.createElement(View, { className: "__field__value__body__" }, | ||
| React.createElement(Input, __assign({}, getInputProps(_props))), | ||
| React.createElement(BaseInput, __assign({}, getInputProps(_props))), | ||
| clear && (React.createElement(Icon, { type: "close-filled", className: "__field__clear__", style: showClear ? "" : "display:none", onClick: onClear }))), | ||
@@ -218,0 +167,0 @@ type === "textarea" && maxlength > 0 && (React.createElement(View, __assign({}, wordLimitProps), ((_c = (_b = valueRef.current) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) + "/" + maxlength)), |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../packages/field/baseInput.js","../../packages/field/index.tsx"],"sourcesContent":["\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar react_1 = require(\"react\");\nvar components_1 = require(\"@tarojs/components\");\nvar BaseInput = function (props) {\n var isTextarea = props.isTextarea, rest = __rest(props, [\"isTextarea\"]);\n var Component = isTextarea ? components_1.Textarea : components_1.Input;\n return react_1.default.createElement(Component, __assign({}, rest));\n};\nexports.default = BaseInput;\n//# sourceMappingURL=baseInput.js.map","import React, { useRef } from \"react\";\nimport { View } from \"@tarojs/components\";\nimport Icon, { IconProps } from \"@vyron/mini-components/icon\";\nimport Cell, { CellProps } from \"@vyron/mini-components/cell\";\nimport { compact, isFunction, isUndefined, mergeStyle, pick } from \"@vyron/mini-components/common\";\nimport { CustomStyle, CustomTextAlign, CustomElement } from \"@vyron/mini-components/types\";\nimport { useUpdate } from \"@vyron/mini-components/common\";\nimport Input, { InputProps } from \"./baseInput\";\n\n\ntype FieldType =\n | \"text\"\n | \"number\"\n | \"idcard\"\n | \"digit\"\n | \"tel\"\n | \"password\"\n | \"textarea\";\n\ntype ClearTriggerType = \"focus\" | \"always\";\n\ntype TriggleType = \"onChange\" | \"onBlur\";\n\ntype Formatter = (value: any) => any;\n\n// export interface Rule {\n// required?: boolean;\n// message?: string | ((value: any, rule: Rule) => string);\n// validator?: (value: any, rule: Rule) => boolean | Promise<any>;\n// pattern?: RegExp;\n// formatter?: (value: any, rule: Rule) => any;\n// }\n\nexport interface FieldProps\n extends Omit<InputProps, \"type\" | \"placeholderStyle\"> {\n // Input\n name?: string;\n key?: string;\n type?: FieldType;\n inputClass?: string;\n inputStyle?: CustomStyle;\n inputAlign?: CustomTextAlign;\n readonly?: boolean;\n // Cell\n colon?: boolean;\n leftIcon?: string | IconProps;\n rightIcon?: string | IconProps;\n label?: CustomElement;\n labelClass?: string;\n labelStyle?: CustomStyle;\n labelAlign?: CustomTextAlign;\n required?: boolean;\n center?: boolean;\n // Others\n showWordLimit?: boolean; // 需要设置 maxlength属性\n limitClass?: string;\n limitStyle?: CustomStyle;\n clear?: boolean | IconProps; // 自定义clear icon 或 默认icon样式\n clearTrigger?: ClearTriggerType; // 当输入框有内容时, 显示清除图标的时机, always一直显示, focus 聚焦显示\n showError?: boolean;\n errorMsg?: string;\n errorClass?: string;\n errorStyle?: CustomStyle;\n errorAlign?: CustomTextAlign;\n // format\n formatter?: Formatter;\n formatTrigger?: TriggleType;\n // Children\n children?: CustomElement;\n // Events\n onClear?: Function;\n onLeftIconClick?: Function;\n onRightIconClick?: Function;\n}\n\nconst defaultFieldProps = {\n type: \"text\",\n fixed: false,\n autoHeight: true,\n maxlength: 200,\n showConfirmBar: false,\n disableDefaultPadding: true,\n clear: false,\n clearTrigger: \"focus\",\n showWordLimit: false,\n inputAlign: \"left\",\n showError: true,\n formatTriggleType: \"onChange\",\n placeholderClass: \"input-placeholder\",\n};\n\nconst getIconProps = (\n props: string | IconProps | undefined,\n fn: any\n): string | IconProps | undefined => {\n if (!isFunction(fn) || isUndefined(undefined)) return props;\n if (typeof props === \"string\") {\n return {\n type: props,\n onClick: fn,\n };\n }\n return props?.onClick ? props : { ...(props as IconProps), onClick: fn };\n};\n\nconst getCellProps = (props: FieldProps): CellProps => {\n const {\n colon,\n leftIcon,\n rightIcon,\n required,\n center,\n label,\n labelClass,\n labelStyle,\n labelAlign,\n inputAlign,\n onLeftIconClick,\n onRightIconClick,\n } = props;\n return compact(\n {\n colon,\n required,\n center,\n title: label,\n titleStyle: labelStyle,\n titleClass: `__field__label__ ${\n labelAlign ? `__field__label__${labelAlign}__` : \"\"\n } ${labelClass ?? \"\"} `,\n valueClass: `__field__value__ ${\n inputAlign ? `__field__value__${inputAlign}__` : \"\"\n }`,\n icon: getIconProps(leftIcon, onLeftIconClick),\n rightIcon: getIconProps(rightIcon, onRightIconClick),\n },\n isUndefined\n ) as CellProps;\n};\n\nconst getInputProps = (props: FieldProps): InputProps => {\n const {\n type,\n maxlength,\n inputClass,\n fixed,\n readonly,\n disabled,\n autoHeight,\n showConfirmBar,\n disableDefaultPadding,\n onLineChange,\n } = props;\n let inputProps = pick(props, [\n // input\n \"value\",\n \"placeholder\",\n \"placeholderClass\",\n \"placeholderStyle\",\n \"cursorSpacing\",\n \"focus\",\n \"confirmType\",\n \"confirmHold\",\n \"alwaysEmbed\",\n \"cursor\",\n \"selectionStart\",\n \"selectionEnd\",\n \"adjustPosition\",\n \"holdKeyboard\",\n \"inputStyle\",\n \"onInput\",\n \"onFocus\",\n \"onBlur\",\n \"onConfirm\",\n \"onKeyboardHeightChange\",\n ]);\n inputProps = {\n ...inputProps,\n disabled: disabled || readonly,\n isTextarea: type === \"textarea\",\n password: type === \"password\",\n type: type === \"tel\" ? \"number\" : type,\n maxlength: type === \"tel\" ? 11 : maxlength,\n className: `__field__control__ ${\n type === \"textarea\" ? \"__field__textarea__\" : \"\"\n } ${inputClass ?? \"\"}`,\n };\n if (inputProps.isTextarea) {\n delete inputProps[\"type\"];\n inputProps = {\n ...inputProps,\n fixed,\n autoHeight,\n showConfirmBar,\n disableDefaultPadding,\n onLineChange,\n };\n }\n return compact(inputProps, isUndefined) as InputProps;\n};\n\nconst getErrorProps = (props: FieldProps): object => {\n let { errorClass, errorStyle, errorAlign, errorMsg } = props;\n return compact(\n {\n style: mergeStyle(errorStyle, errorMsg ? \"\" : `display:none;`),\n className: `__field__error__ ${errorClass ?? \"\"} ${\n errorAlign ? `__field__error__${errorAlign}__` : \"\"\n }`,\n },\n isUndefined\n );\n};\n\nconst getWordLimitProps = (props: FieldProps): object => {\n const { limitClass, limitStyle } = props;\n return compact(\n {\n style: limitStyle,\n className: `__field__limit__ ${limitClass ?? \"\"}`,\n },\n isUndefined\n );\n};\n\nconst formatFn = (_value: any, fn?: Function): any => {\n return isFunction(fn) ? fn?.(_value) : _value;\n};\n\nconst Field = (props: FieldProps) => {\n let { formatter, formatTrigger, disabled, readonly } = props;\n const update = useUpdate();\n let valueRef = useRef(props?.value ?? \"\");\n let focusRef = useRef(!!props?.focus);\n const onFocus = (eve) => {\n focusRef.current = true;\n props?.onFocus?.(eve);\n update();\n };\n const onBlur = (eve) => {\n focusRef.current = false;\n // 格式化\n if (formatTrigger === \"onBlur\") {\n valueRef.current = formatFn(valueRef.current, formatter);\n }\n props?.onBlur?.(eve);\n update();\n };\n const onInput = (eve) => {\n valueRef.current = eve.detail.value;\n // 格式化\n if (formatTrigger === \"onChange\") {\n valueRef.current = formatFn(valueRef.current, formatter);\n }\n if (isFunction(props.onInput)) {\n let callbackValue = (props.onInput as Function)(eve);\n if (!isUndefined(callbackValue)) {\n valueRef.current = callbackValue;\n }\n }\n // 校验\n update();\n return valueRef.current;\n };\n const _props = {\n ...defaultFieldProps,\n ...props,\n onFocus,\n onBlur,\n onInput,\n value: valueRef.current,\n } as FieldProps;\n const {\n showError,\n errorMsg,\n type,\n maxlength,\n clear,\n clearTrigger,\n onClear: _onClear,\n } = _props;\n const cellProps = getCellProps(_props);\n const errorProps = getErrorProps(_props);\n const wordLimitProps = getWordLimitProps(_props);\n const onClear = (eve) => {\n valueRef.current = \"\";\n focusRef.current = false;\n _onClear?.(eve);\n update();\n };\n const showClear =\n !(disabled || readonly) &&\n valueRef.current.length > 0 &&\n (clearTrigger === \"focus\" ? focusRef.current : true);\n\n const fieldValue = (\n <React.Fragment>\n <View className=\"__field__value__body__\">\n <Input {...getInputProps(_props)} />\n {clear && (\n <Icon\n type=\"close-filled\"\n className=\"__field__clear__\"\n style={showClear ? \"\" : `display:none`}\n onClick={onClear}\n />\n )}\n </View>\n {type === \"textarea\" && (maxlength as number) > 0 && (\n <View {...wordLimitProps}>{`${\n valueRef.current?.length ?? 0\n }/${maxlength}`}</View>\n )}\n {!!showError && <View {...errorProps}>{errorMsg}</View>}\n </React.Fragment>\n );\n return (\n <Cell\n {...cellProps}\n className={`__field__ ${_props?.disabled ? `__field__disabled__` : \"\"} ${\n _props?.readonly ? `__field__readonly__` : \"\"\n } ${_props?.className ?? \"\"}`}\n value={fieldValue}\n >\n {props?.children}\n </Cell>\n );\n};\n\nexport default Field;\n"],"names":["this","react_1"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAI,QAAQ,GAAG,CAACA,cAAI,IAAIA,cAAI,CAAC,QAAQ,KAAK,YAAY;AACtD,IAAI,QAAQ,GAAG,MAAM,CAAC,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C,kBAAkB,EAC5B,KAAK,EAAE,SAAS,GAAG,EAAE,GAAG,cAAc,EACtC,OAAO,EAAE,OAAO,GAChB,CACH,CACI;QACN,IAAI,KAAK,UAAU,IAAK,SAAoB,GAAG,CAAC,KAC/C,oBAAC,IAAI,eAAK,cAAc,GAAG,aACzB,QAAQ,CAAC,OAAO,0CAAE,MAAM,mCAAI,CAAC,UAC3B,SAAW,CAAQ,CACxB;QACA,CAAC,CAAC,SAAS,IAAI,oBAAC,IAAI,eAAK,UAAU,GAAG,QAAQ,CAAQ,CACxC,CAClB,CAAC;IACF,QACE,oBAAC,IAAI,eACC,SAAS,IACb,SAAS,EAAE,gBAAa,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,IAAG,qBAAqB,GAAG,EAAE,WACnE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,IAAG,qBAAqB,GAAG,EAAE,iBAC3C,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,mCAAI,EAAE,CAAE,EAC7B,KAAK,EAAE,UAAU,KAEhB,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CACX,EACP;AACJ;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../packages/field/baseInput.tsx","../../packages/field/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { Input, Textarea } from \"@tarojs/components\";\nimport { InputProps as _InputProps } from \"@tarojs/components/types/input\";\nimport { CommonEventFunction } from \"@tarojs/components/types\";\nimport { TextareaProps } from \"@tarojs/components/types/Textarea\";\n\nexport interface InputProps extends _InputProps {\n isTextarea?: boolean;\n // Textarea\n fixed?: boolean;\n autoHeight?: boolean;\n showConfirmBar?: boolean;\n disableDefaultPadding?: boolean;\n onLineChange?: CommonEventFunction<TextareaProps.onLineChangeEventDetail>;\n}\n\nconst BaseInput = (props: InputProps) => {\n const { isTextarea, ...rest } = props;\n const Component = isTextarea ? Textarea : Input;\n return <Component {...rest} />;\n};\n\nexport default BaseInput;\n","import React, { useRef } from \"react\";\nimport { View } from \"@tarojs/components\";\nimport Icon from \"@vyron/mini-components/icon\";\nimport Cell from \"@vyron/mini-components/cell\";\nimport {\n compact,\n isFunction,\n isUndefined,\n mergeStyle,\n pick,\n} from \"@vyron/mini-components/common\";\nimport {\n CustomStyle,\n CustomTextAlign,\n CustomElement,\n} from \"@vyron/mini-components/types\";\nimport { useUpdate } from \"@vyron/mini-components/common\";\nimport Input, { InputProps } from \"./baseInput\";\nimport { IconProps } from \"../icon\";\nimport { CellProps } from \"../cell\";\n\ntype FieldType =\n | \"text\"\n | \"number\"\n | \"idcard\"\n | \"digit\"\n | \"tel\"\n | \"password\"\n | \"textarea\";\n\ntype ClearTriggerType = \"focus\" | \"always\";\n\ntype TriggleType = \"onChange\" | \"onBlur\";\n\ntype Formatter = (value: any) => any;\n\n// export interface Rule {\n// required?: boolean;\n// message?: string | ((value: any, rule: Rule) => string);\n// validator?: (value: any, rule: Rule) => boolean | Promise<any>;\n// pattern?: RegExp;\n// formatter?: (value: any, rule: Rule) => any;\n// }\n\nexport interface FieldProps\n extends Omit<InputProps, \"type\" | \"placeholderStyle\"> {\n // Input\n name?: string;\n key?: string;\n type?: FieldType;\n inputClass?: string;\n inputStyle?: CustomStyle;\n inputAlign?: CustomTextAlign;\n readonly?: boolean;\n // Cell\n colon?: boolean;\n leftIcon?: string | IconProps;\n rightIcon?: string | IconProps;\n label?: CustomElement;\n labelClass?: string;\n labelStyle?: CustomStyle;\n labelAlign?: CustomTextAlign;\n required?: boolean;\n center?: boolean;\n // Others\n showWordLimit?: boolean; // 需要设置 maxlength属性\n limitClass?: string;\n limitStyle?: CustomStyle;\n clear?: boolean | IconProps; // 自定义clear icon 或 默认icon样式\n clearTrigger?: ClearTriggerType; // 当输入框有内容时, 显示清除图标的时机, always一直显示, focus 聚焦显示\n showError?: boolean;\n errorMsg?: string;\n errorClass?: string;\n errorStyle?: CustomStyle;\n errorAlign?: CustomTextAlign;\n // format\n formatter?: Formatter;\n formatTrigger?: TriggleType;\n // Children\n children?: CustomElement;\n // Events\n onClear?: Function;\n onLeftIconClick?: Function;\n onRightIconClick?: Function;\n}\n\nconst defaultFieldProps = {\n type: \"text\",\n fixed: false,\n autoHeight: true,\n maxlength: 200,\n showConfirmBar: false,\n disableDefaultPadding: true,\n clear: false,\n clearTrigger: \"focus\",\n showWordLimit: false,\n inputAlign: \"left\",\n showError: true,\n formatTriggleType: \"onChange\",\n placeholderClass: \"input-placeholder\",\n};\n\nconst getIconProps = (\n props: string | IconProps | undefined,\n fn: any\n): string | IconProps | undefined => {\n if (!isFunction(fn) || isUndefined(undefined)) return props;\n if (typeof props === \"string\") {\n return {\n type: props,\n onClick: fn,\n };\n }\n return props?.onClick ? props : { ...(props as IconProps), onClick: fn };\n};\n\nconst getCellProps = (props: FieldProps): CellProps => {\n const {\n colon,\n leftIcon,\n rightIcon,\n required,\n center,\n label,\n labelClass,\n labelStyle,\n labelAlign,\n inputAlign,\n onLeftIconClick,\n onRightIconClick,\n } = props;\n return compact(\n {\n colon,\n required,\n center,\n title: label,\n titleStyle: labelStyle,\n titleClass: `__field__label__ ${\n labelAlign ? `__field__label__${labelAlign}__` : \"\"\n } ${labelClass ?? \"\"} `,\n valueClass: `__field__value__ ${\n inputAlign ? `__field__value__${inputAlign}__` : \"\"\n }`,\n icon: getIconProps(leftIcon, onLeftIconClick),\n rightIcon: getIconProps(rightIcon, onRightIconClick),\n },\n isUndefined\n ) as CellProps;\n};\n\nconst getInputProps = (props: FieldProps): InputProps => {\n const {\n type,\n maxlength,\n inputClass,\n fixed,\n readonly,\n disabled,\n autoHeight,\n showConfirmBar,\n disableDefaultPadding,\n onLineChange,\n } = props;\n let inputProps = pick(props, [\n // input\n \"value\",\n \"placeholder\",\n \"placeholderClass\",\n \"placeholderStyle\",\n \"cursorSpacing\",\n \"focus\",\n \"confirmType\",\n \"confirmHold\",\n \"alwaysEmbed\",\n \"cursor\",\n \"selectionStart\",\n \"selectionEnd\",\n \"adjustPosition\",\n \"holdKeyboard\",\n \"inputStyle\",\n \"onInput\",\n \"onFocus\",\n \"onBlur\",\n \"onConfirm\",\n \"onKeyboardHeightChange\",\n ]);\n inputProps = {\n ...inputProps,\n disabled: disabled || readonly,\n isTextarea: type === \"textarea\",\n password: type === \"password\",\n type: type === \"tel\" ? \"number\" : type,\n maxlength: type === \"tel\" ? 11 : maxlength,\n className: `__field__control__ ${\n type === \"textarea\" ? \"__field__textarea__\" : \"\"\n } ${inputClass ?? \"\"}`,\n };\n if (inputProps.isTextarea) {\n delete inputProps[\"type\"];\n inputProps = {\n ...inputProps,\n fixed,\n autoHeight,\n showConfirmBar,\n disableDefaultPadding,\n onLineChange,\n };\n }\n return compact(inputProps, isUndefined) as InputProps;\n};\n\nconst getErrorProps = (props: FieldProps): object => {\n let { errorClass, errorStyle, errorAlign, errorMsg } = props;\n return compact(\n {\n style: mergeStyle(errorStyle, errorMsg ? \"\" : `display:none;`),\n className: `__field__error__ ${errorClass ?? \"\"} ${\n errorAlign ? `__field__error__${errorAlign}__` : \"\"\n }`,\n },\n isUndefined\n );\n};\n\nconst getWordLimitProps = (props: FieldProps): object => {\n const { limitClass, limitStyle } = props;\n return compact(\n {\n style: limitStyle,\n className: `__field__limit__ ${limitClass ?? \"\"}`,\n },\n isUndefined\n );\n};\n\nconst formatFn = (_value: any, fn?: Function): any => {\n return isFunction(fn) ? fn?.(_value) : _value;\n};\n\nconst Field = (props: FieldProps) => {\n let { formatter, formatTrigger, disabled, readonly } = props;\n const update = useUpdate();\n let valueRef = useRef(props?.value ?? \"\");\n let focusRef = useRef(!!props?.focus);\n const onFocus = (eve) => {\n focusRef.current = true;\n props?.onFocus?.(eve);\n update();\n };\n const onBlur = (eve) => {\n focusRef.current = false;\n // 格式化\n if (formatTrigger === \"onBlur\") {\n valueRef.current = formatFn(valueRef.current, formatter);\n }\n props?.onBlur?.(eve);\n update();\n };\n const onInput = (eve) => {\n valueRef.current = eve.detail.value;\n // 格式化\n if (formatTrigger === \"onChange\") {\n valueRef.current = formatFn(valueRef.current, formatter);\n }\n if (isFunction(props.onInput)) {\n let callbackValue = (props.onInput as Function)(eve);\n if (!isUndefined(callbackValue)) {\n valueRef.current = callbackValue;\n }\n }\n // 校验\n update();\n return valueRef.current;\n };\n const _props = {\n ...defaultFieldProps,\n ...props,\n onFocus,\n onBlur,\n onInput,\n value: valueRef.current,\n } as FieldProps;\n const {\n showError,\n errorMsg,\n type,\n maxlength,\n clear,\n clearTrigger,\n onClear: _onClear,\n } = _props;\n const cellProps = getCellProps(_props);\n const errorProps = getErrorProps(_props);\n const wordLimitProps = getWordLimitProps(_props);\n const onClear = (eve) => {\n valueRef.current = \"\";\n focusRef.current = false;\n _onClear?.(eve);\n update();\n };\n const showClear =\n !(disabled || readonly) &&\n valueRef.current.length > 0 &&\n (clearTrigger === \"focus\" ? focusRef.current : true);\n\n const fieldValue = (\n <React.Fragment>\n <View className=\"__field__value__body__\">\n <Input {...getInputProps(_props)} />\n {clear && (\n <Icon\n type=\"close-filled\"\n className=\"__field__clear__\"\n style={showClear ? \"\" : `display:none`}\n onClick={onClear}\n />\n )}\n </View>\n {type === \"textarea\" && (maxlength as number) > 0 && (\n <View {...wordLimitProps}>{`${\n valueRef.current?.length ?? 0\n }/${maxlength}`}</View>\n )}\n {!!showError && <View {...errorProps}>{errorMsg}</View>}\n </React.Fragment>\n );\n return (\n <Cell\n {...cellProps}\n className={`__field__ ${_props?.disabled ? `__field__disabled__` : \"\"} ${\n _props?.readonly ? `__field__readonly__` : \"\"\n } ${_props?.className ?? \"\"}`}\n value={fieldValue}\n >\n {props?.children}\n </Cell>\n );\n};\n\nexport default Field;\n"],"names":["Input"],"mappings":";;;;;;;AAgBA,IAAM,SAAS,GAAG,UAAC,KAAiB;IAC1B,IAAA,UAAU,GAAc,KAAK,WAAnB,EAAK,IAAI,UAAK,KAAK,EAA/B,cAAuB,CAAF,CAAW;IACtC,IAAM,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,K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/mini-components/authorize"; | ||
| export { default as Carousel } from "@vyron/mini-components/carousel"; | ||
| export { default as Divider } from "@vyron/mini-components/divider"; | ||
| export { default as Empty } from "@vyron/mini-components/empty"; | ||
| export { default as Icon } from "@vyron/mini-components/icon"; | ||
| export { default as Image } from "@vyron/mini-components/image"; | ||
| export { default as List } from "@vyron/mini-components/list"; | ||
| export { default as Loading } from "@vyron/mini-components/loading"; | ||
| export { default as AppBar } from "@vyron/mini-components/appbar"; | ||
| export { default as Overlay } from "@vyron/mini-components/overlay"; | ||
| export { default as Transition } from "@vyron/mini-components/transition"; | ||
| export { default as Cell, CellGroup } from "@vyron/mini-components/cell"; | ||
| export { default as Field } from "@vyron/mini-components/field"; | ||
| export { default as Authorize } from "./authorize"; | ||
| export { default as Carousel } from "./carousel"; | ||
| export { default as Divider } from "./divider"; | ||
| export { default as Empty } from "./empty"; | ||
| export { default as Icon } from "./icon"; | ||
| export { default as Image } from "./image"; | ||
| export { default as List } from "./list"; | ||
| export { default as Loading } from "./loading"; | ||
| export { default as AppBar } from "./appbar"; | ||
| export { default as Overlay } from "./overlay"; | ||
| export { default as Transition } from "./transition"; | ||
| export { default as Cell, CellGroup } from "./cell"; | ||
| export { default as Field } from "./field"; |
+13
-13
@@ -1,14 +0,14 @@ | ||
| export { default as Authorize } from '@vyron/mini-components/lib/authorize'; | ||
| export { default as Carousel } from '@vyron/mini-components/lib/carousel'; | ||
| export { default as Divider } from '@vyron/mini-components/lib/divider'; | ||
| export { default as Empty } from '@vyron/mini-components/lib/empty'; | ||
| export { default as Icon } from '@vyron/mini-components/lib/icon'; | ||
| export { default as Image } from '@vyron/mini-components/lib/image'; | ||
| export { default as List } from '@vyron/mini-components/lib/list'; | ||
| export { default as Loading } from '@vyron/mini-components/lib/loading'; | ||
| export { default as AppBar } from '@vyron/mini-components/lib/appbar'; | ||
| export { default as Overlay } from '@vyron/mini-components/lib/overlay'; | ||
| export { default as Transition } from '@vyron/mini-components/lib/transition'; | ||
| export { default as Cell, CellGroup } from '@vyron/mini-components/lib/cell'; | ||
| export { default as Field } from '@vyron/mini-components/lib/field'; | ||
| export { default as Authorize } from './authorize'; | ||
| export { default as Carousel } from './carousel'; | ||
| export { default as Divider } from './divider'; | ||
| export { default as Empty } from './empty'; | ||
| export { default as Icon } from './icon'; | ||
| export { default as Image } from './image'; | ||
| export { default as List } from './list'; | ||
| export { default as Loading } from './loading'; | ||
| export { default as AppBar } from './appbar'; | ||
| export { default as Overlay } from './overlay'; | ||
| export { default as Transition } from './transition'; | ||
| export { default as Cell, CellGroup } from './cell'; | ||
| export { default as Field } from './field'; | ||
| //# sourceMappingURL=index.js.map |
| import React from "react"; | ||
| import { ScrollViewProps } from "@tarojs/components/types/ScrollView"; | ||
| import { BaseObject, CustomStyle } from "@vyron/mini-components/types"; | ||
| import { BaseObject, CustomStyle } from "../types"; | ||
| declare type OmitScrollViewProps = "scrollX" | "scrollY" | "refresherEnabled" | "refreshTriggered"; | ||
@@ -5,0 +5,0 @@ export interface ListProps extends Omit<ScrollViewProps, OmitScrollViewProps> { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../packages/list/index.tsx"],"sourcesContent":["import React, {\n isValidElement,\n useMemo,\n useState,\n useCallback,\n useRef,\n} from \"react\";\nimport { ScrollView, View, Slot } from \"@tarojs/components\";\nimport { ScrollViewProps } from \"@tarojs/components/types/ScrollView\";\nimport Loading from \"@vyron/mini-components/loading\";\nimport {\n isEmpty,\n isFunction,\n isReactComponentType,\n} from \"@vyron/mini-components/common\";\nimport { useMount, useUpdate } from \"@vyron/mini-components/common\";\nimport { BaseObject, CustomStyle } from \"@vyron/mini-components/types\";\n\ntype OmitScrollViewProps =\n | \"scrollX\"\n | \"scrollY\"\n | \"refresherEnabled\"\n | \"refreshTriggered\";\n\nexport interface ListProps extends Omit<ScrollViewProps, OmitScrollViewProps> {\n // list\n hasMore?: boolean; // 是否还可以继续上拉加载\n data?: BaseObject[]; // 组件展示时的数据\n ListComponent?: React.ComponentType; // 配合data和ListComponent渲染列表\n children?: React.ReactElement | string; // 可自行渲染子元素,也可配合data和ListComponent渲染\n // refresher\n firstTriggered?: boolean; // 是否启用第一次刷新\n onRefresh?: Function; // 下拉刷新,一般用于请求数据\n onRefreshCancel?: Function; // 下拉刷新取消或复位\n onReachBottom?: Function; // 滑动到底部的回调,一般用于请求数据\n refresherStayTime?: number; // 刷新成功或失败提示持续时长,默认700ms\n refresherClassName?: string; // 自定义类名\n refresherStyle?: CustomStyle; // 自定义样式\n // loading\n loading?: React.ReactElement; // 自定义loading\n loadingText?: string; // 滑动到底部加载时显示的文字(自定义时无效)\n loadingClass?: string; // 自定义类名\n loadingStyle?: CustomStyle; // 自定义样式\n // error\n error?: React.ReactElement; // 自定义error\n errorText?: string; // 滑动到底部请求错误时显示的文字(自定义时无效)\n errorClass?: string; // 自定义类名\n errorStyle?: CustomStyle; // 自定义样式\n}\n\nenum PullingStatus {\n static,\n pulling,\n overPulling,\n loading,\n success,\n error,\n}\n\nconst pullStatusText = [\n \"\",\n \"下拉刷新\",\n \"松开手刷新\",\n \"正在加载...\",\n \"加载成功\",\n \"加载失败\",\n];\n\nconst defaultProps = {\n scrollY: true,\n hasMore: true,\n firstTriggered: false,\n refresherEnabled: true,\n lowerThreshold: 80,\n loadingText: \"加载中...\",\n errorText: \"请求失败,点击重新加载\",\n refresherDefaultStyle: \"none\",\n refresherThreshold: 50,\n refresherBackground: \"#00ab84\",\n refresherStayTime: 700,\n};\n\nconst List = (props: ListProps) => {\n const {\n data,\n error,\n errorClass,\n errorStyle,\n errorText,\n loading,\n loadingText,\n loadingClass,\n loadingStyle,\n hasMore,\n className,\n onRefresh,\n onReachBottom,\n onRefreshCancel,\n firstTriggered,\n onRefresherRefresh,\n onRefresherAbort,\n onRefresherRestore,\n ListComponent,\n refresherThreshold,\n refresherStayTime,\n refresherDefaultStyle,\n refresherClassName,\n refresherStyle,\n ...restProps\n } = {\n ...defaultProps,\n ...props,\n };\n const update = useUpdate();\n const refresherRef = useRef<PullingStatus>(PullingStatus.static);\n const setRefresherStatus = useCallback(\n (status: PullingStatus) => {\n refresherRef.current = status;\n update();\n },\n [update]\n );\n const [bottomState, setBottomState] = useState({\n loading: false,\n error: false,\n });\n useMount(() => {\n if (firstTriggered) {\n setTimeout(() => {\n setRefresherStatus(PullingStatus.loading);\n }, 0);\n }\n });\n\n // 下拉动作\n const _onRefresherPulling = useCallback(\n (eve) => {\n if (refresherRef.current < PullingStatus.loading) {\n const { dy } = eve.detail;\n setRefresherStatus(\n dy >= refresherThreshold\n ? PullingStatus.overPulling\n : PullingStatus.pulling\n );\n }\n },\n [refresherThreshold, setRefresherStatus]\n );\n\n // 触发下拉刷新\n const _onRefresherRefresh = useCallback(\n (eve) => {\n if (refresherRef.current !== PullingStatus.loading) {\n setRefresherStatus(PullingStatus.loading);\n }\n const resetStatus = () => {\n if (refresherRef.current !== PullingStatus.static) {\n setTimeout(() => {\n setRefresherStatus(PullingStatus.static);\n }, refresherStayTime);\n }\n };\n isFunction(onRefresh) &&\n (onRefresh as Function)([\n () => {\n if (refresherRef.current === PullingStatus.loading) {\n setRefresherStatus(PullingStatus.success);\n }\n resetStatus();\n },\n () => {\n if (refresherRef.current === PullingStatus.loading) {\n setRefresherStatus(PullingStatus.error);\n }\n resetStatus();\n },\n ]);\n isFunction(onRefresherRefresh) && (onRefresherRefresh as Function)(eve);\n },\n [onRefresh, onRefresherRefresh, refresherStayTime, setRefresherStatus]\n );\n\n // 下拉刷新被终止\n const _onRefresherAbort = useCallback(\n (eve) => {\n if (refresherRef.current !== PullingStatus.static) {\n setRefresherStatus(PullingStatus.static);\n }\n isFunction(onRefresherAbort) && (onRefresherAbort as Function)(eve);\n },\n [onRefresherAbort, setRefresherStatus]\n );\n\n // 下拉刷新复位\n const _onRefresherRestore = useCallback(\n (eve) => {\n if (refresherRef.current !== PullingStatus.static) {\n debugger;\n setRefresherStatus(PullingStatus.static);\n }\n isFunction(onRefreshCancel) && (onRefreshCancel as Function)();\n isFunction(onRefresherRestore) && (onRefresherRestore as Function)(eve);\n },\n [onRefreshCancel, onRefresherRestore, setRefresherStatus]\n );\n\n // 滚动到底部\n const onScrollToBottom = useCallback(\n ({ force = false } = {}, eve) => {\n if (!hasMore && (bottomState.loading || bottomState.error) && !force) {\n return;\n }\n setBottomState({\n loading: true,\n error: false,\n });\n isFunction(onReachBottom) &&\n (onReachBottom as Function)(\n [\n function stopLoading() {\n setBottomState({\n loading: false,\n error: false,\n });\n },\n function onError() {\n setBottomState({\n loading: false,\n error: true,\n });\n },\n ],\n eve\n );\n },\n [bottomState.error, bottomState.loading, onReachBottom, hasMore]\n );\n\n const bottomComponent = useMemo<React.ReactElement | null>(() => {\n if (bottomState.loading) {\n return isValidElement(loading) ? (\n loading\n ) : (\n <Loading\n block\n size=\"40rpx\"\n style={loadingStyle ?? {}}\n className={`__list__loading__ ${loadingClass ?? \"\"}`}\n >\n {loadingText}\n </Loading>\n );\n } else if (bottomState.error) {\n return isValidElement(error) ? (\n React.cloneElement(error, {\n onClick: (eve) => {\n error?.props?.onClick?.(eve);\n onScrollToBottom({ force: true }, eve);\n },\n })\n ) : (\n <View\n style={errorStyle}\n className={`__list__error__ ${errorClass ?? \"\"}`}\n onClick={(eve) => onScrollToBottom({ force: true }, eve)}\n >\n {errorText}\n </View>\n );\n }\n return null;\n }, [\n bottomState.loading,\n bottomState.error,\n loading,\n loadingStyle,\n loadingClass,\n loadingText,\n error,\n errorStyle,\n errorClass,\n errorText,\n onScrollToBottom,\n ]);\n\n return (\n <ScrollView\n {...restProps}\n refresherThreshold={refresherThreshold}\n onRefresherPulling={_onRefresherPulling}\n onRefresherRefresh={_onRefresherRefresh}\n onRefresherAbort={_onRefresherAbort}\n onRefresherRestore={_onRefresherRestore}\n refresherDefaultStyle={refresherDefaultStyle}\n onScrollToLower={(eve) => onScrollToBottom(undefined, eve)}\n refresherTriggered={refresherRef.current !== PullingStatus.static}\n className={`__list__ ${className ?? \"\"}`}\n >\n {refresherDefaultStyle === \"none\" && (\n <Slot name=\"refresher\">\n <View\n style={refresherStyle}\n className={`__refresher__ ${refresherClassName ?? \"\"}`}\n >\n {pullStatusText[refresherRef.current]}\n </View>\n </Slot>\n )}\n {props?.children}\n {!isEmpty(data) &&\n isReactComponentType(ListComponent) &&\n data?.map((_data, index) => (\n // @ts-ignore\n <ListComponent data={_data} key={_data?.id || index} />\n ))}\n {bottomComponent}\n </ScrollView>\n );\n};\n\nList.options = {\n addGlobalClass: true,\n};\n\nexport default List;\n"],"names":[],"mappings":";;;;;;AAkDA,IAAK,aAOJ;AAPD,WAAK,aAAa;IAChB,qDAAM,CAAA;IACN,uDAAO,CAAA;IACP,+DAAW,CAAA;IACX,uDAAO,CAAA;IACP,uDAAO,CAAA;IACP,mDAAK,CAAA;AACP,CAAC,EAPI,aAAa,KAAb,aAAa,QAOjB;AAED,IAAM,cAAc,GAAG;IACrB,EAAE;IACF,MAAM;IACN,OAAO;IACP,SAAS;IACT,MAAM;IACN,MAAM;CACP,CAAC;AAEF,IAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,KAAK;IACrB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,EAAE;IAClB,WAAW,EAAE,QAAQ;IACrB,SAAS,EAAE,aAAa;IACxB,qBAAqB,EAAE,MAAM;IAC7B,kBAAkB,EAAE,EAAE;IACtB,mBAAmB,EAAE,SAAS;IAC9B,iBAAiB,EAAE,GAAG;CACvB,CAAC;IAEI,IAAI,GAAG,UAAC,KAAgB;IAC5B,IAAM,2BA2BD,YAAY,GACZ,KAAK,CACT,EA5BC,IAAI,UAAA,EACJ,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,UAAU,gBAAA,EACV,SAAS,eAAA,EACT,OAAO,aAAA,EACP,WAAW,iBAAA,EACX,YAAY,kBAAA,EACZ,YAAY,kBAAA,EACZ,OAAO,aAAA,EACP,SAAS,eAAA,EACT,SAAS,eAAA,EACT,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,YAAY,CAAC,OAAO,KAAK,aAAa,CAAC,MAAM,EACjE,SAAS,EAAE,eAAY,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAE;QAEvC,qBAAqB,KAAK,MAAM,KAC/B,oBAAC,IAAI,IAAC,IAAI,EAAC,WAAW;YACpB,oBAAC,IAAI,IACH,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,oBAAiB,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,EAAE,CAAE,IAErD,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,CAChC,CACF,CACR,EACA,KAAK,aAAL,KAAK;QAAL,KAAK,CAAE,QAAQ;QACf,CAAC,OAAO,CAAC,IAAI,CAAC;YACb,oBAAoB,CAAC,aAAa,CAAC,KACnC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,CAAC,UAAC,KAAK,EAAE,KAAK,IAAK;;QAE1B,oBAAC,aAAa,IAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,EAAE,KAAI,KAAK,GAAI,IACxD,EAAC;QACH,eAAe,CACL,EACb;AACJ,EAAE;AAEF,IAAI,CAAC,OAAO,GAAG;IACb,cAAc,EAAE,IAAI;CACrB;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../packages/list/index.tsx"],"sourcesContent":["import React, {\n isValidElement,\n useMemo,\n useState,\n useCallback,\n useRef,\n} from \"react\";\nimport { ScrollView, View, Slot } from \"@tarojs/components\";\nimport { ScrollViewProps } from \"@tarojs/components/types/ScrollView\";\nimport Loading from \"@vyron/mini-components/loading\";\nimport {\n isEmpty,\n isFunction,\n isReactComponentType,\n} from \"@vyron/mini-components/common\";\nimport { useMount, useUpdate } from \"@vyron/mini-components/common\";\nimport { BaseObject, CustomStyle } from \"../types\";\n\ntype OmitScrollViewProps =\n | \"scrollX\"\n | \"scrollY\"\n | \"refresherEnabled\"\n | \"refreshTriggered\";\n\nexport interface ListProps extends Omit<ScrollViewProps, OmitScrollViewProps> {\n // list\n hasMore?: boolean; // 是否还可以继续上拉加载\n data?: BaseObject[]; // 组件展示时的数据\n ListComponent?: React.ComponentType; // 配合data和ListComponent渲染列表\n children?: React.ReactElement | string; // 可自行渲染子元素,也可配合data和ListComponent渲染\n // refresher\n firstTriggered?: boolean; // 是否启用第一次刷新\n onRefresh?: Function; // 下拉刷新,一般用于请求数据\n onRefreshCancel?: Function; // 下拉刷新取消或复位\n onReachBottom?: Function; // 滑动到底部的回调,一般用于请求数据\n refresherStayTime?: number; // 刷新成功或失败提示持续时长,默认700ms\n refresherClassName?: string; // 自定义类名\n refresherStyle?: CustomStyle; // 自定义样式\n // loading\n loading?: React.ReactElement; // 自定义loading\n loadingText?: string; // 滑动到底部加载时显示的文字(自定义时无效)\n loadingClass?: string; // 自定义类名\n loadingStyle?: CustomStyle; // 自定义样式\n // error\n error?: React.ReactElement; // 自定义error\n errorText?: string; // 滑动到底部请求错误时显示的文字(自定义时无效)\n errorClass?: string; // 自定义类名\n errorStyle?: CustomStyle; // 自定义样式\n}\n\nenum PullingStatus {\n static,\n pulling,\n overPulling,\n loading,\n success,\n error,\n}\n\nconst pullStatusText = [\n \"\",\n \"下拉刷新\",\n \"松开手刷新\",\n \"正在加载...\",\n \"加载成功\",\n \"加载失败\",\n];\n\nconst defaultProps = {\n scrollY: true,\n hasMore: true,\n firstTriggered: false,\n refresherEnabled: true,\n lowerThreshold: 80,\n loadingText: \"加载中...\",\n errorText: \"请求失败,点击重新加载\",\n refresherDefaultStyle: \"none\",\n refresherThreshold: 50,\n refresherBackground: \"#00ab84\",\n refresherStayTime: 700,\n};\n\nconst List = (props: ListProps) => {\n const {\n data,\n error,\n errorClass,\n errorStyle,\n errorText,\n loading,\n loadingText,\n loadingClass,\n loadingStyle,\n hasMore,\n className,\n onRefresh,\n onReachBottom,\n onRefreshCancel,\n firstTriggered,\n onRefresherRefresh,\n onRefresherAbort,\n onRefresherRestore,\n ListComponent,\n refresherThreshold,\n refresherStayTime,\n refresherDefaultStyle,\n refresherClassName,\n refresherStyle,\n ...restProps\n } = {\n ...defaultProps,\n ...props,\n };\n const update = useUpdate();\n const refresherRef = useRef<PullingStatus>(PullingStatus.static);\n const setRefresherStatus = useCallback(\n (status: PullingStatus) => {\n refresherRef.current = status;\n update();\n },\n [update]\n );\n const [bottomState, setBottomState] = useState({\n loading: false,\n error: false,\n });\n useMount(() => {\n if (firstTriggered) {\n setTimeout(() => {\n setRefresherStatus(PullingStatus.loading);\n }, 0);\n }\n });\n\n // 下拉动作\n const _onRefresherPulling = useCallback(\n (eve) => {\n if (refresherRef.current < PullingStatus.loading) {\n const { dy } = eve.detail;\n setRefresherStatus(\n dy >= refresherThreshold\n ? PullingStatus.overPulling\n : PullingStatus.pulling\n );\n }\n },\n [refresherThreshold, setRefresherStatus]\n );\n\n // 触发下拉刷新\n const _onRefresherRefresh = useCallback(\n (eve) => {\n if (refresherRef.current !== PullingStatus.loading) {\n setRefresherStatus(PullingStatus.loading);\n }\n const resetStatus = () => {\n if (refresherRef.current !== PullingStatus.static) {\n setTimeout(() => {\n setRefresherStatus(PullingStatus.static);\n }, refresherStayTime);\n }\n };\n isFunction(onRefresh) &&\n (onRefresh as Function)([\n () => {\n if (refresherRef.current === PullingStatus.loading) {\n setRefresherStatus(PullingStatus.success);\n }\n resetStatus();\n },\n () => {\n if (refresherRef.current === PullingStatus.loading) {\n setRefresherStatus(PullingStatus.error);\n }\n resetStatus();\n },\n ]);\n isFunction(onRefresherRefresh) && (onRefresherRefresh as Function)(eve);\n },\n [onRefresh, onRefresherRefresh, refresherStayTime, setRefresherStatus]\n );\n\n // 下拉刷新被终止\n const _onRefresherAbort = useCallback(\n (eve) => {\n if (refresherRef.current !== PullingStatus.static) {\n setRefresherStatus(PullingStatus.static);\n }\n isFunction(onRefresherAbort) && (onRefresherAbort as Function)(eve);\n },\n [onRefresherAbort, setRefresherStatus]\n );\n\n // 下拉刷新复位\n const _onRefresherRestore = useCallback(\n (eve) => {\n if (refresherRef.current !== PullingStatus.static) {\n debugger;\n setRefresherStatus(PullingStatus.static);\n }\n isFunction(onRefreshCancel) && (onRefreshCancel as Function)();\n isFunction(onRefresherRestore) && (onRefresherRestore as Function)(eve);\n },\n [onRefreshCancel, onRefresherRestore, setRefresherStatus]\n );\n\n // 滚动到底部\n const onScrollToBottom = useCallback(\n ({ force = false } = {}, eve) => {\n if (!hasMore && (bottomState.loading || bottomState.error) && !force) {\n return;\n }\n setBottomState({\n loading: true,\n error: false,\n });\n isFunction(onReachBottom) &&\n (onReachBottom as Function)(\n [\n function stopLoading() {\n setBottomState({\n loading: false,\n error: false,\n });\n },\n function onError() {\n setBottomState({\n loading: false,\n error: true,\n });\n },\n ],\n eve\n );\n },\n [bottomState.error, bottomState.loading, onReachBottom, hasMore]\n );\n\n const bottomComponent = useMemo<React.ReactElement | null>(() => {\n if (bottomState.loading) {\n return isValidElement(loading) ? (\n loading\n ) : (\n <Loading\n block\n size=\"40rpx\"\n style={loadingStyle ?? {}}\n className={`__list__loading__ ${loadingClass ?? \"\"}`}\n >\n {loadingText}\n </Loading>\n );\n } else if (bottomState.error) {\n return isValidElement(error) ? (\n React.cloneElement(error, {\n onClick: (eve) => {\n error?.props?.onClick?.(eve);\n onScrollToBottom({ force: true }, eve);\n },\n })\n ) : (\n <View\n style={errorStyle}\n className={`__list__error__ ${errorClass ?? \"\"}`}\n onClick={(eve) => onScrollToBottom({ force: true }, eve)}\n >\n {errorText}\n </View>\n );\n }\n return null;\n }, [\n bottomState.loading,\n bottomState.error,\n loading,\n loadingStyle,\n loadingClass,\n loadingText,\n error,\n errorStyle,\n errorClass,\n errorText,\n onScrollToBottom,\n ]);\n\n return (\n <ScrollView\n {...restProps}\n refresherThreshold={refresherThreshold}\n onRefresherPulling={_onRefresherPulling}\n onRefresherRefresh={_onRefresherRefresh}\n onRefresherAbort={_onRefresherAbort}\n onRefresherRestore={_onRefresherRestore}\n refresherDefaultStyle={refresherDefaultStyle}\n onScrollToLower={(eve) => onScrollToBottom(undefined, eve)}\n refresherTriggered={refresherRef.current !== PullingStatus.static}\n className={`__list__ ${className ?? \"\"}`}\n >\n {refresherDefaultStyle === \"none\" && (\n <Slot name=\"refresher\">\n <View\n style={refresherStyle}\n className={`__refresher__ ${refresherClassName ?? \"\"}`}\n >\n {pullStatusText[refresherRef.current]}\n </View>\n </Slot>\n )}\n {props?.children}\n {!isEmpty(data) &&\n isReactComponentType(ListComponent) &&\n data?.map((_data, index) => (\n // @ts-ignore\n <ListComponent data={_data} key={_data?.id || index} />\n ))}\n {bottomComponent}\n </ScrollView>\n );\n};\n\nList.options = {\n addGlobalClass: true,\n};\n\nexport default List;\n"],"names":[],"mappings":";;;;;;AAkDA,IAAK,aAOJ;AAPD,WAAK,aAAa;IAChB,qDAAM,CAAA;IACN,uDAAO,CAAA;IACP,+DAAW,CAAA;IACX,uDAAO,CAAA;IACP,uDAAO,CAAA;IACP,mDAAK,CAAA;AACP,CAAC,EAPI,aAAa,KAAb,aAAa,QAOjB;AAED,IAAM,cAAc,GAAG;IACrB,EAAE;IACF,MAAM;IACN,OAAO;IACP,SAAS;IACT,MAAM;IACN,MAAM;CACP,CAAC;AAEF,IAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,KAAK;IACrB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,EAAE;IAClB,WAAW,EAAE,QAAQ;IACrB,SAAS,EAAE,aAAa;IACxB,qBAAqB,EAAE,MAAM;IAC7B,kBAAkB,EAAE,EAAE;IACtB,mBAAmB,EAAE,SAAS;IAC9B,iBAAiB,EAAE,GAAG;CACvB,CAAC;IAEI,IAAI,GAAG,UAAC,KAAgB;IAC5B,IAAM,2BA2BD,YAAY,GACZ,KAAK,CACT,EA5BC,IAAI,UAAA,EACJ,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,UAAU,gBAAA,EACV,SAAS,eAAA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BAAqB,EAAE,qBAAqB,EAC5C,eAAe,EAAE,UAAC,GAAG,IAAK,OAAA,gBAAgB,CAAC,SAAS,EAAE,GAAG,CAAC,GAAA,EAC1D,kBAAkB,EAAE,YAAY,CAAC,OAAO,KAAK,aAAa,CAAC,MAAM,EACjE,SAAS,EAAE,eAAY,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAE;QAEvC,qBAAqB,KAAK,MAAM,KAC/B,oBAAC,IAAI,IAAC,IAAI,EAAC,WAAW;YACpB,oBAAC,IAAI,IACH,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,oBAAiB,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,EAAE,CAAE,IAErD,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,CAChC,CACF,CACR,EACA,KAAK,aAAL,KAAK;QAAL,KAAK,CAAE,QAAQ;QACf,CAAC,OAAO,CAAC,IAAI,CAAC;YACb,oBAAoB,CAAC,aAAa,CAAC,KACnC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,CAAC,UAAC,KAAK,EAAE,KAAK,IAAK;;QAE1B,oBAAC,aAAa,IAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,EAAE,KAAI,KAAK,GAAI,IACxD,EAAC;QACH,eAAe,CACL,EACb;AACJ,EAAE;AAEF,IAAI,CAAC,OAAO,GAAG;IACb,cAAc,EAAE,IAAI;CACrB;;;;"} |
| import { ReactElement } from "react"; | ||
| import { CustomStyle } from "@vyron/mini-components/types"; | ||
| import { CustomStyle } from "../types"; | ||
| declare type LoadingType = "circular" | "spinner"; | ||
@@ -4,0 +4,0 @@ export interface LoadingProps { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sources":["../../packages/loading/index.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { View } from \"@tarojs/components\";\nimport { mergeStyle } from \"@vyron/mini-components/common\";\nimport { CustomStyle } from \"@vyron/mini-components/types\";\n\n\ntype LoadingType = \"circular\" | \"spinner\";\n\nexport interface LoadingProps {\n color?: string;\n type?: LoadingType;\n size?: string;\n textSize?: string;\n vertical?: boolean;\n block?: boolean;\n className?: string;\n style?: CustomStyle;\n children?: string | ReactElement;\n}\n\nconst defaultLoadingPorps: LoadingProps = {\n color: \"#999\",\n type: \"circular\",\n size: \"40rpx\",\n vertical: false,\n textSize: \"28rpx\",\n block: false,\n};\nconst dots = Array.from({ length: 12 });\nconst Loading = (props: LoadingProps) => {\n const { className, color, type, size, textSize, vertical, block, style } = {\n ...defaultLoadingPorps,\n ...props,\n };\n return (\n <View\n className={`__loading__ ${className || \"\"} ${\n vertical ? `__loading__vertical__` : \"\"\n } ${block ? `__loading__block__` : \"\"}`}\n >\n <View\n className={`__loading__${type}__`}\n style={mergeStyle(style, {\n color,\n width: size,\n height: size,\n })}\n >\n {type === \"spinner\" &&\n dots.map((_, index) => (\n <View className=\"__loading__spinner__dot__\" key={index}></View>\n ))}\n </View>\n <View className=\"__loading__text__\" style={{ fontSize: textSize }}>\n {props.children}\n </View>\n </View>\n );\n};\nLoading.options = {\n addGlobalClass: true,\n};\n\nexport default Loading;\n"],"names":[],"mappings":";;;;;AAoBA,IAAM,mBAAmB,GAAiB;IACxC,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,KAAK;CACb,CAAC;AACF,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAClC,OAAO,GAAG,UAAC,KAAmB;IAC5B,IAAA,2BACD,mBAAmB,GACnB,KAAK,CACT,EAHO,SAAS,eAAA,EAAE,KAAK,WAAA,EAAE,IAAI,UAAA,EAAE,IAAI,UAAA,EAAE,QAAQ,cAAA,EAAE,QAAQ,cAAA,EAAE,KAAK,WAAA,EAAE,KAAK,WAGrE,CAAC;IACF,QACE,oBAAC,IAAI,IACH,SAAS,EAAE,kBAAe,SAAS,IAAI,EAAE,WACvC,QAAQ,GAAG,uBAAuB,GAAG,EAAE,WACrC,KAAK,GAAG,oBAAoB,GAAG,EAAE,CAAE;QAEvC,oBAAC,IAAI,IACH,SAAS,EAAE,gBAAc,IAAI,OAAI,EACjC,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE;gBACvB,KAAK,OAAA;gBACL,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,IAAI;aACb,CAAC,IAED,IAAI,KAAK,SAAS;YACjB,IAAI,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,KAAK,IAAK,QACrB,oBAAC,IAAI,IAAC,SAAS,EAAC,2BAA2B,EAAC,GAAG,EAAE,KAAK,GAAS,IAChE,CAAC,CACC;QACP,oBAAC,IAAI,IAAC,SAAS,EAAC,mBAAmB,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAC9D,KAAK,CAAC,QAAQ,CACV,CACF,EACP;AACJ,EAAE;AACF,OAAO,CAAC,OAAO,GAAG;IAChB,cAAc,EAAE,IAAI;CACrB;;;;"} | ||
| {"version":3,"file":"index.js","sources":["../../packages/loading/index.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { View } from \"@tarojs/components\";\nimport { mergeStyle } from \"@vyron/mini-components/common\";\nimport { CustomStyle } from \"../types\";\n\ntype LoadingType = \"circular\" | \"spinner\";\n\nexport interface LoadingProps {\n color?: string;\n type?: LoadingType;\n size?: string;\n textSize?: string;\n vertical?: boolean;\n block?: boolean;\n className?: string;\n style?: CustomStyle;\n children?: string | ReactElement;\n}\n\nconst defaultLoadingPorps: LoadingProps = {\n color: \"#999\",\n type: \"circular\",\n size: \"40rpx\",\n vertical: false,\n textSize: \"28rpx\",\n block: false,\n};\nconst dots = Array.from({ length: 12 });\nconst Loading = (props: LoadingProps) => {\n const { className, color, type, size, textSize, vertical, block, style } = {\n ...defaultLoadingPorps,\n ...props,\n };\n return (\n <View\n className={`__loading__ ${className || \"\"} ${\n vertical ? `__loading__vertical__` : \"\"\n } ${block ? `__loading__block__` : \"\"}`}\n >\n <View\n className={`__loading__${type}__`}\n style={mergeStyle(style, {\n color,\n width: size,\n height: size,\n })}\n >\n {type === \"spinner\" &&\n dots.map((_, index) => (\n <View className=\"__loading__spinner__dot__\" key={index}></View>\n ))}\n </View>\n <View className=\"__loading__text__\" style={{ fontSize: textSize }}>\n {props.children}\n </View>\n </View>\n );\n};\nLoading.options = {\n addGlobalClass: true,\n};\n\nexport default Loading;\n"],"names":[],"mappings":";;;;;AAmBA,IAAM,mBAAmB,GAAiB;IACxC,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,KAAK;CACb,CAAC;AACF,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAClC,OAAO,GAAG,UAAC,KAAmB;IAC5B,IAAA,2BACD,mBAAmB,GACnB,KAAK,CACT,EAHO,SAAS,eAAA,EAAE,KAAK,WAAA,EAAE,IAAI,UAAA,EAAE,IAAI,UAAA,EAAE,QAAQ,cAAA,EAAE,QAAQ,cAAA,EAAE,KAAK,WAAA,EAAE,KAAK,WAGrE,CAAC;IACF,QACE,oBAAC,IAAI,IACH,SAAS,EAAE,kBAAe,SAAS,IAAI,EAAE,WACvC,QAAQ,GAAG,uBAAuB,GAAG,EAAE,WACrC,KAAK,GAAG,oBAAoB,GAAG,EAAE,CAAE;QAEvC,oBAAC,IAAI,IACH,SAAS,EAAE,gBAAc,IAAI,OAAI,EACjC,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE;gBACvB,KAAK,OAAA;gBACL,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,IAAI;aACb,CAAC,IAED,IAAI,KAAK,SAAS;YACjB,IAAI,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,KAAK,IAAK,QACrB,oBAAC,IAAI,IAAC,SAAS,EAAC,2BAA2B,EAAC,GAAG,EAAE,KAAK,GAAS,IAChE,CAAC,CACC;QACP,oBAAC,IAAI,IAAC,SAAS,EAAC,mBAAmB,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAC9D,KAAK,CAAC,QAAQ,CACV,CACF,EACP;AACJ,EAAE;AACF,OAAO,CAAC,OAAO,GAAG;IAChB,cAAc,EAAE,IAAI;CACrB;;;;"} |
+1
-1
| { | ||
| "name": "@vyron/mini-components", | ||
| "version": "0.0.2", | ||
| "version": "0.0.3", | ||
| "main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "author": "vyron", |
| /// <reference types="react" /> | ||
| import { ViewProps } from "@tarojs/components/types/View"; | ||
| import { IconProps } from "@vyron/mini-components/icon"; | ||
| import { navigationBarTextStyle } from "@vyron/mini-components/common/hooks/useMenuButton"; | ||
| export interface MenuIcon { | ||
| white?: IconProps; | ||
| black?: IconProps; | ||
| } | ||
| export interface leftIconProps extends ViewProps { | ||
| home?: MenuIcon; | ||
| back?: MenuIcon; | ||
| } | ||
| export interface RightIconProps extends ViewProps { | ||
| menu?: MenuIcon; | ||
| } | ||
| export interface TitleProps extends ViewProps { | ||
| text?: string; | ||
| } | ||
| export interface NavigationBarProps extends ViewProps { | ||
| title?: string | TitleProps; | ||
| backgroundColor?: string; | ||
| statusBarBackgroundColor?: string; | ||
| type?: navigationBarTextStyle; | ||
| left?: leftIconProps; | ||
| middle?: ViewProps; | ||
| right?: RightIconProps; | ||
| onTitleClick?: Function; | ||
| onLeftClick?: Function; | ||
| onRightClick?: Function; | ||
| } | ||
| declare const AppBar: { | ||
| (props: NavigationBarProps): JSX.Element; | ||
| options: { | ||
| addGlobalClass: boolean; | ||
| }; | ||
| }; | ||
| export default AppBar; |
| import React from "react"; | ||
| import { StandardProps } from "@tarojs/components"; | ||
| import { AuthScope } from "@vyron/mini-components/common"; | ||
| declare type PromiseFn = (args?: any) => Promise<any>; | ||
| declare type ObjectService = { | ||
| params: object; | ||
| fn: PromiseFn; | ||
| needMiniCode?: boolean; | ||
| codeKey?: string; | ||
| }; | ||
| declare type AuthorizeService = PromiseFn | ObjectService; | ||
| declare type OpenType = "contact" | "getPhoneNumber" | "getUserInfo" | "launchApp" | "scope"; | ||
| export interface AuthorizeProps extends StandardProps { | ||
| authorize: boolean; | ||
| openType?: OpenType; | ||
| authScope?: AuthScope; | ||
| children?: React.ReactElement | string; | ||
| onAuthorize?: Function; | ||
| service?: AuthorizeService; | ||
| } | ||
| declare const Authorize: { | ||
| (props: AuthorizeProps): JSX.Element; | ||
| options: { | ||
| addGlobalClass: boolean; | ||
| }; | ||
| }; | ||
| export default Authorize; |
| import React from "react"; | ||
| import { SwiperProps } from "@tarojs/components/types/Swiper"; | ||
| import { SwiperItemProps } from "@tarojs/components/types/SwiperItem"; | ||
| import { BaseObject } from "@vyron/mini-components/types"; | ||
| export declare type IndicatorType = "dots" | "numbers"; | ||
| export declare type IndicatorPosition = "topLeft" | "topCenter" | "topRight" | "leftTop" | "leftCenter" | "leftRight" | "rightTop" | "rightCenter" | "rightBottom" | "bottomLeft" | "bottomRight" | "bottomCenter"; | ||
| export interface CustomIndicatorProps { | ||
| customIndicator?: boolean; | ||
| dotActiveLine?: boolean; | ||
| indicatorType?: IndicatorType; | ||
| indicatorPosition?: IndicatorPosition; | ||
| wrapperClassName?: string; | ||
| } | ||
| export interface ExtendSwiperProps extends CustomIndicatorProps, SwiperProps { | ||
| } | ||
| export interface ExtendSwiperItemProps extends SwiperItemProps { | ||
| extra?: (data?: BaseObject) => React.ReactElement; | ||
| } | ||
| export declare type CarouselData = BaseObject[]; | ||
| export interface CarouselProps { | ||
| data: CarouselData; | ||
| style?: React.CSSProperties | string; | ||
| className?: string; | ||
| children?: React.ReactElement; | ||
| swiperProps?: ExtendSwiperProps; | ||
| swiperItemProps?: ExtendSwiperItemProps; | ||
| extra?: React.ReactElement; | ||
| } | ||
| declare const Carousel: (props: CarouselProps) => JSX.Element; | ||
| export default Carousel; |
| /// <reference types="react" /> | ||
| import { IconProps } from "@vyron/mini-components/icon"; | ||
| import { ViewProps } from "@tarojs/components/types/View"; | ||
| import { CustomElement, CustomStyle } from "@vyron/mini-components/types"; | ||
| export interface CellGroupProps extends ViewProps { | ||
| title?: CustomElement; | ||
| titleClass?: string; | ||
| titleStyle?: CustomStyle; | ||
| border?: boolean; | ||
| children?: CustomElement; | ||
| } | ||
| export declare type ArrowDirection = "left" | "right" | "up" | "down"; | ||
| export interface CellProps extends ViewProps { | ||
| title?: CustomElement; | ||
| colon?: boolean; | ||
| titleClass?: string; | ||
| titleStyle?: CustomStyle; | ||
| value: CustomElement; | ||
| valueClass?: string; | ||
| valueStyle?: CustomStyle; | ||
| label?: CustomElement; | ||
| labelClass?: string; | ||
| labelStyle?: CustomStyle; | ||
| icon?: CustomElement | IconProps; | ||
| rightIcon?: CustomElement | IconProps; | ||
| url?: string; | ||
| replace?: boolean; | ||
| required?: boolean; | ||
| center?: boolean; | ||
| arrow?: boolean; | ||
| border?: boolean; | ||
| arrowDirection?: ArrowDirection; | ||
| children?: CustomElement; | ||
| } | ||
| declare const Cell: (props: CellProps) => JSX.Element; | ||
| declare const CellGroup: any; | ||
| export { Cell as default, CellGroup }; |
| export { default as useUpdate } from "@vyron/mini-components/common/hooks/useUpdate"; | ||
| export { default as useMount } from "@vyron/mini-components/common/hooks/useMount"; | ||
| export { default as useUnmount } from "@vyron/mini-components/common/hooks/useUnmount"; | ||
| export { default as useUpdateEffect } from "@vyron/mini-components/common/hooks/useUpdateEffect"; | ||
| export { default as useUpdateLayoutEffect } from "@vyron/mini-components/common/hooks/useUpdateLayoutEffect"; | ||
| export { default as useWhyUpdate } from "@vyron/mini-components/common/hooks/useWhyUpdate"; | ||
| export { default as useMenuButton } from "@vyron/mini-components/common/hooks/useMenuButton"; | ||
| export { default as useSystemInfo } from "@vyron/mini-components/common/hooks/useSystemInfo"; | ||
| export { default as usePrevious } from "@vyron/mini-components/common/hooks/usePrevious"; | ||
| export { default as useTransition } from "@vyron/mini-components/common/hooks/useTransition"; |
| import { BaseObject } from "@vyron/mini-components/types"; | ||
| export declare type navigationBarTextStyle = "black" | "white"; | ||
| export declare type menuProps = { | ||
| type?: navigationBarTextStyle; | ||
| }; | ||
| export declare type menuData = { | ||
| rect: BaseObject; | ||
| wrapStyle: BaseObject; | ||
| menuStyle: BaseObject; | ||
| delimiterStyle: BaseObject; | ||
| system: Taro.getSystemInfoSync.Result; | ||
| }; | ||
| declare const useMenuButton: (props?: menuProps) => menuData; | ||
| export default useMenuButton; |
| export declare type fn = (...args: any) => void; | ||
| declare const useMount: (fns: fn | fn[]) => void; | ||
| export default useMount; |
| export declare type compareFunction<T> = (prev: T | undefined, next: T) => boolean; | ||
| declare const usePrevious: <T>(state: T, compare?: compareFunction<T> | undefined) => T | undefined; | ||
| export default usePrevious; |
| declare const useSystemInfo: () => Taro.getSystemInfoSync.Result; | ||
| export default useSystemInfo; |
| import { TransitionType } from "@vyron/mini-components/transition"; | ||
| export interface useTransitionProps { | ||
| show: boolean; | ||
| name: TransitionType; | ||
| transitionDuration: number; | ||
| beforeEnter?: Function; | ||
| onEnter?: Function; | ||
| beforeLeave?: Function; | ||
| onLeave?: Function; | ||
| } | ||
| declare const useTransition: (props: useTransitionProps) => { | ||
| inited: boolean; | ||
| status: null; | ||
| display: boolean; | ||
| className: string; | ||
| transitionDuration: number; | ||
| onTransitionEnd: () => void; | ||
| }; | ||
| export default useTransition; |
| import { fn } from "../useMount"; | ||
| declare const useUnmount: (fns: fn | fn[]) => void; | ||
| export default useUnmount; |
| declare const useUpdate: () => () => void; | ||
| export default useUpdate; |
| import { useEffect } from "react"; | ||
| declare const useUpdateEffect: typeof useEffect; | ||
| export default useUpdateEffect; |
| import { useLayoutEffect } from "react"; | ||
| declare const useUpdateLayoutEffect: typeof useLayoutEffect; | ||
| export default useUpdateLayoutEffect; |
| export declare type cProps = { | ||
| [key: string]: any; | ||
| }; | ||
| declare const useWhyUpdate: (componentName: string, props: cProps) => void; | ||
| export default useWhyUpdate; |
| export * from "./util"; | ||
| export * from "./hooks"; |
| import { BaseObject } from "@vyron/mini-components/types"; | ||
| export declare const objectProto: Object; | ||
| export declare const hasOwnProperty: (v: string | number | symbol) => boolean; | ||
| /** | ||
| * @param {any} target 检测的值 | ||
| * @returns {boolean} 返回布尔值,`true`表示是数组,`false`表示不是数组 | ||
| * | ||
| */ | ||
| export declare const isArray: (arg: any) => arg is any[]; | ||
| /** | ||
| * 检测当前值是否为buffer类型 | ||
| * @params {any} value 检测的值 | ||
| * @returns {boolean} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isBuffer: (_value: any) => boolean; | ||
| /** | ||
| * 获取任意值的字符串类型 | ||
| * @param {any} value 转换为字符串的数据 | ||
| * @returns {string} 返回 Object.prototype.toString.call(value) 的值 | ||
| * | ||
| */ | ||
| export declare const toString: (value: any) => string; | ||
| /** | ||
| * | ||
| * @param {any} value 任意合法值 | ||
| * @returns {string} 返回 value的数据类型,如 string object function null undefined number .... | ||
| * | ||
| */ | ||
| export declare const getTypeof: (value: any) => string; | ||
| /** | ||
| * | ||
| * @param {any} value 任意合法值 | ||
| * @returns {string} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isNull: (value: any) => boolean; | ||
| /** | ||
| * | ||
| * @param {any} value 任意合法值 | ||
| * @returns {string} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isUndefined: (value: any) => boolean; | ||
| /** | ||
| * 判断当前值是否为对象 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| */ | ||
| export declare const isObject: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为Map类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isMap: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为WeakMap类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isWeakMap: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为Set类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isSet: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为WeakSet类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isWeakSet: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为Function类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isFunction: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为GeneratorFunction类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isGeneratorFunction: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为Promise类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isPromise: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为RegExp类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isRegExp: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为Boolean类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| */ | ||
| export declare const isBoolean: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为Arguments类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| */ | ||
| export declare const isArguments: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为Symbol类型 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| */ | ||
| export declare const isSymbol: (value: any) => boolean; | ||
| /** | ||
| * 检测当前值是否为空 | ||
| * @param {any} value 任意合法值 | ||
| * @returns {boolean} 返回boolean | ||
| * | ||
| */ | ||
| export declare const isEmpty: (value: any) => boolean; | ||
| /** | ||
| * 过滤掉目标对象中的被Boolean转为false的值 | ||
| * @param { [] | object } value | ||
| * @param {(arg: any) => boolean} fn 每次过滤执行的函数 | ||
| * @returns { [] | object } 返回过滤后的值 | ||
| */ | ||
| export declare function compact(value: [] | object, fn?: (arg: any) => boolean): [] | object; | ||
| /** | ||
| * | ||
| * 遍历对象并返回对象可枚举属性组成的数组 | ||
| * @param {object} value 遍历对象 | ||
| * @returns {string[]} 返回对象的自身可枚举属性组成的数组 | ||
| * | ||
| */ | ||
| export declare const keys: { | ||
| (o: object): string[]; | ||
| (o: {}): string[]; | ||
| }; | ||
| /** | ||
| * 遍历对象并返回对象可枚举属性值组成的数组 | ||
| * @param {object} value 遍历对象 | ||
| * @returns {any[]} 返回对象的自身可枚举属性值组成的数组 | ||
| * | ||
| */ | ||
| export declare const values: { | ||
| <T>(o: { | ||
| [s: string]: T; | ||
| } | ArrayLike<T>): T[]; | ||
| (o: {}): any[]; | ||
| }; | ||
| /** | ||
| * | ||
| * @param value 检索的对象 | ||
| * @param callback 循环时每个元素的回调 | ||
| * @param thisArg 回调函数作用域 | ||
| */ | ||
| export declare type ForEachCallback<T = BaseObject | any[]> = (value: any, key?: number, target?: T) => any; | ||
| export declare const forEach: (value: BaseObject | any[], callback: ForEachCallback, thisArg?: any) => void; | ||
| /** | ||
| * 遍历对象并执行回调 | ||
| * @param {BaseObject} object 遍历的对象 | ||
| * @param {ForEachCallback} callback 遍历执行的回调函数 | ||
| * @param {any} thisArg 回调函数作用域 | ||
| */ | ||
| export declare const foreachObject: (object: BaseObject, callback: ForEachCallback, thisArg: any) => void; | ||
| /** | ||
| * 创建一个从object中选取属性的对象 | ||
| * @param {object} object 来源对象 | ||
| * @param {string | string[] | predicate } props 需要获取的属性或自定义是否获取, | ||
| * 返回true则获取,false则忽略 | ||
| * @returns {object} 返回新对象 | ||
| * | ||
| */ | ||
| declare type predicate = (value: string, key: string | number) => boolean; | ||
| export declare function pick(object: BaseObject, props: string | string[] | predicate): BaseObject; | ||
| declare type MergeProps = { | ||
| object: BaseObject; | ||
| source: BaseObject; | ||
| }; | ||
| export declare function merge({ object, source }: MergeProps, isDeep?: boolean): BaseObject; | ||
| export {}; |
| /// <reference types="react" /> | ||
| import get from "lodash.get"; | ||
| import kebabcase from "lodash.kebabcase"; | ||
| import { BaseObject, BaseMap } from "@vyron/mini-components/types"; | ||
| export * from "./base"; | ||
| export * from "./system"; | ||
| export * from "./style"; | ||
| export { get, kebabcase }; | ||
| /** | ||
| * 获取七牛云图片地址 | ||
| * @param {string} name 图片名称 | ||
| * @returns {string} 完整七牛云图片地址 | ||
| * | ||
| */ | ||
| export declare const getImageUrl: (name: string) => string; | ||
| /** | ||
| * 代理fn,并返回一个Promise | ||
| * @param {funciton} fn 需要promise化的函数 | ||
| * @param {any} args 传递给fn的参数 | ||
| * @returns {Promise} 返回promise | ||
| */ | ||
| export declare const promiseify: (fn: Function) => any; | ||
| /** | ||
| * | ||
| * @param {string} url 获取参数的URL | ||
| * @param {BaseObject} params 追加的参数对象 | ||
| * @returns {RouterData} 返回一个包含[无参数URL字符串]和[拼接参数字符串]以及[参数对象]的对象 | ||
| */ | ||
| declare type RouterData = { | ||
| url: string; | ||
| query: string; | ||
| params: BaseObject; | ||
| }; | ||
| export declare const getRouterParams: (url: string, params?: BaseObject) => RouterData; | ||
| /** | ||
| * | ||
| * @param {BaseObject} params 小程序 this.$router.params对象 | ||
| * @returns {BaseObject} 解析小程序路由参数,二维码扫描参数q,小程序码扫码参数scene | ||
| * 其中 scene 字符串传参格式应为 key=value&key2=value2 格式 | ||
| * | ||
| */ | ||
| export declare const getMiniParams: (params: BaseObject) => BaseObject; | ||
| /** | ||
| * 将对象转换成Map | ||
| * @param {object} obj 转换成Map的原始对象 | ||
| * @param {BaseMap} initMap 初始Map对象,如果存在将在初始Map对象上增加属性,属性存在则覆盖 | ||
| * @returns {BaseMap} 返回转换后的Map对象 | ||
| * | ||
| */ | ||
| export declare const objectToMap: (obj: BaseObject, initMap?: BaseMap | undefined) => BaseMap; | ||
| /** | ||
| * 将Map转换成对象 | ||
| * @param {BaseMap} map 转换成对象的Map | ||
| * @param {object} initObj 初始对象,如果存在将在初始对象上增加属性,属性存在则覆盖 | ||
| * @returns {BaseMap} 返回转换后的Map对象 | ||
| * | ||
| */ | ||
| export declare const mapToObject: (map: BaseMap, initObj?: BaseObject | undefined) => BaseObject; | ||
| /** | ||
| * 下一次页面渲染前执行的方法 | ||
| * @param {Function} fn 执行的方法 | ||
| * | ||
| */ | ||
| export declare const nextTick: (fn: Function) => void; | ||
| /** | ||
| * 小程序中模拟requestAnimationFrame | ||
| * @param {Function} cb 回调函数 | ||
| * | ||
| */ | ||
| export declare function requestAnimationFrame(cb: Function): void | Taro.NodesRef; | ||
| /** | ||
| * 判断元素是否为组件类型(函数组件或类组件) | ||
| * @param {React.ComponentType} Component 检测的组件 | ||
| * @returns {boolean} 返回boolean | ||
| */ | ||
| export declare function isReactComponentType(Component: React.ComponentType | undefined): boolean; |
| /// <reference types="react" /> | ||
| declare type Style = string | React.CSSProperties | undefined; | ||
| export declare function mergeStyle(baseStyles: Style, mergeStyles?: Style): string; | ||
| export {}; |
| import { getSystemInfoSync as _getSystemInfoSync, getMenuButtonBoundingClientRect as _getMenuRect } from "@tarojs/taro"; | ||
| export * from "./route"; | ||
| export * from "./setting"; | ||
| export declare const getSystemInfoSync: () => _getSystemInfoSync.Result; | ||
| export declare const getMenuButtonBoundingClientRect: () => _getMenuRect.Rect; |
| import { Page } from "@tarojs/taro"; | ||
| /***************************** Page *************************************/ | ||
| declare type CurrentPage = { | ||
| pages: Page[]; | ||
| current: Page; | ||
| isFirst: boolean; | ||
| isTabBar: boolean; | ||
| isRootPage: boolean; | ||
| }; | ||
| /** | ||
| * | ||
| * 获取当前小程序页面信息 | ||
| * @returns {CurrentPage} 当前页面信息 | ||
| * pages 路由栈 | ||
| * current 当前路由页面 | ||
| * isFirst 路由栈长度为1 | ||
| * isRootPage 当前路由栈是否小程序tabBar页面 | ||
| * | ||
| */ | ||
| export declare const getCurrPages: () => CurrentPage; | ||
| /** | ||
| * | ||
| * 判断页面是否为小程序tabBar页面 | ||
| * | ||
| * @param {Page} page Page对象 | ||
| * @returns {boolean} Page是否为tabBar页面 | ||
| */ | ||
| export declare const isTabBar: (page: Page) => boolean; | ||
| /** | ||
| * | ||
| * @param {Page} page Page对象 | ||
| * @returns {boolean} Page是否为首页 | ||
| * | ||
| */ | ||
| export declare const isRootPage: (page: Page) => boolean; | ||
| /** | ||
| * 跳转到指定小程序页面,如果路由栈大于9个,将关闭当前页面,并跳转到目的页面,返回Promise | ||
| * @param {string} url 跳转页面路径 | ||
| * @param {General.IAnyObject} events 可选,页面间通信接口,用于监听被打开页面发送到当前页面的数据 | ||
| * @returns {Promise<any>} 返回Promise,成功then,失败catch | ||
| * | ||
| */ | ||
| declare type RouterOption = { | ||
| url: string; | ||
| events?: { | ||
| [key: string]: Function; | ||
| }; | ||
| }; | ||
| export declare const navigateTo: (option: RouterOption) => Promise<any>; | ||
| /** | ||
| * | ||
| * 关闭当前页面并跳转到目标页面,返回Promise | ||
| * @param {string} url 跳转页面路径 | ||
| * @returns {Promise<any>} 返回Promise对象 | ||
| * | ||
| */ | ||
| export declare const redirectTo: (url: string) => Promise<any>; | ||
| /** | ||
| * 关闭当前页面,返回上一页面或多级页面 | ||
| * @param {number} delta 返回页面栈层数,默认1 | ||
| * @returns {Promise<any>} 返回Promise | ||
| */ | ||
| export declare const navigateBack: (delta?: number) => Promise<any>; | ||
| /** | ||
| * 如果是tabBar页面将关闭所有非tabBar页面,否则关闭当前页面,跳转到目标页面 | ||
| * @param {string} url 跳转页面路径 | ||
| * @returns {Promise<any>} 返回Promise | ||
| * | ||
| */ | ||
| export declare const switchTab: (url: string) => Promise<any>; | ||
| /** | ||
| * 关闭所有页面,打开对应页面 | ||
| * @param {string} url 打开页面地址 | ||
| * @returns {Promise<any>} 返回Promise | ||
| * | ||
| */ | ||
| export declare const reLaunch: (url: string) => Promise<any>; | ||
| /** | ||
| * 关闭所有页面,打开首页 | ||
| * @returns {Promise<any>} 返回Promise | ||
| */ | ||
| export declare const goToHome: () => Promise<any>; | ||
| export {}; |
| /** | ||
| * | ||
| * @param {AuthScope} scope 需要获取的授权项 | ||
| * @param {string} message 授权曾拒绝,提示打开设置页面的提示信息 | ||
| * @returns {Promise<any>} 返回 Promise<any> | ||
| * | ||
| */ | ||
| export declare type AuthScope = "userInfo" | "address" | "invoice" | "werun" | "record" | "camera" | "userLocation" | "invoiceTitle" | "writePhotosAlbum"; | ||
| export declare const ensureAuthScope: (scope: AuthScope, message?: string | undefined) => Promise<any>; |
| /// <reference types="react" /> | ||
| import { ViewProps } from "@tarojs/components/types/View"; | ||
| declare type ContentPosition = "left" | "right" | "center"; | ||
| export interface DividerProps extends ViewProps { | ||
| text?: string; | ||
| hairLine?: boolean; | ||
| contentPosition?: ContentPosition; | ||
| } | ||
| declare const Divider: { | ||
| (props: DividerProps): JSX.Element; | ||
| options: { | ||
| addGlobalClass: boolean; | ||
| }; | ||
| }; | ||
| export default Divider; |
| import { ReactElement } from "react"; | ||
| import { IconProps } from "@vyron/mini-components/icon"; | ||
| export declare type EmptyType = "empty" | "network" | "error"; | ||
| export interface EmptyProps { | ||
| image?: EmptyType | IconProps; | ||
| className?: string; | ||
| description?: string; | ||
| children?: string | ReactElement; | ||
| onClick?: Function; | ||
| } | ||
| declare const Empty: { | ||
| (props: EmptyProps): JSX.Element; | ||
| options: { | ||
| addGlobalClass: boolean; | ||
| }; | ||
| }; | ||
| export default Empty; |
| /// <reference types="react" /> | ||
| import { InputProps as _InputProps } from "@tarojs/components/types/input"; | ||
| import { CommonEventFunction } from "@tarojs/components/types"; | ||
| import { TextareaProps } from "@tarojs/components/types/Textarea"; | ||
| export interface InputProps extends _InputProps { | ||
| isTextarea?: boolean; | ||
| fixed?: boolean; | ||
| autoHeight?: boolean; | ||
| showConfirmBar?: boolean; | ||
| disableDefaultPadding?: boolean; | ||
| onLineChange?: CommonEventFunction<TextareaProps.onLineChangeEventDetail>; | ||
| } | ||
| declare const BaseInput: (props: InputProps) => JSX.Element; | ||
| export default BaseInput; |
| /// <reference types="react" /> | ||
| import { IconProps } from "@vyron/mini-components/icon"; | ||
| import { CustomStyle, CustomTextAlign, CustomElement } from "@vyron/mini-components/types"; | ||
| import { InputProps } from "./baseInput"; | ||
| declare type FieldType = "text" | "number" | "idcard" | "digit" | "tel" | "password" | "textarea"; | ||
| declare type ClearTriggerType = "focus" | "always"; | ||
| declare type TriggleType = "onChange" | "onBlur"; | ||
| declare type Formatter = (value: any) => any; | ||
| export interface FieldProps extends Omit<InputProps, "type" | "placeholderStyle"> { | ||
| name?: string; | ||
| key?: string; | ||
| type?: FieldType; | ||
| inputClass?: string; | ||
| inputStyle?: CustomStyle; | ||
| inputAlign?: CustomTextAlign; | ||
| readonly?: boolean; | ||
| colon?: boolean; | ||
| leftIcon?: string | IconProps; | ||
| rightIcon?: string | IconProps; | ||
| label?: CustomElement; | ||
| labelClass?: string; | ||
| labelStyle?: CustomStyle; | ||
| labelAlign?: CustomTextAlign; | ||
| required?: boolean; | ||
| center?: boolean; | ||
| showWordLimit?: boolean; | ||
| limitClass?: string; | ||
| limitStyle?: CustomStyle; | ||
| clear?: boolean | IconProps; | ||
| clearTrigger?: ClearTriggerType; | ||
| showError?: boolean; | ||
| errorMsg?: string; | ||
| errorClass?: string; | ||
| errorStyle?: CustomStyle; | ||
| errorAlign?: CustomTextAlign; | ||
| formatter?: Formatter; | ||
| formatTrigger?: TriggleType; | ||
| children?: CustomElement; | ||
| onClear?: Function; | ||
| onLeftIconClick?: Function; | ||
| onRightIconClick?: Function; | ||
| } | ||
| declare const Field: (props: FieldProps) => JSX.Element; | ||
| export default Field; |
| import React from "react"; | ||
| import { ViewProps } from "@tarojs/components/types/View"; | ||
| export interface IconProps extends ViewProps { | ||
| isCover?: boolean; | ||
| type: string; | ||
| size?: string; | ||
| color?: string; | ||
| className?: string; | ||
| fontFamily?: string; | ||
| localImage?: boolean; | ||
| style?: React.CSSProperties | string; | ||
| children?: string | React.ReactElement; | ||
| } | ||
| declare const Icon: { | ||
| (props: IconProps): JSX.Element; | ||
| options: { | ||
| addGlobalClass: boolean; | ||
| }; | ||
| }; | ||
| export default Icon; |
| import React from "react"; | ||
| import { ImageProps as _ImageProps } from "@tarojs/components/types/Image"; | ||
| export interface ImageProps extends _ImageProps { | ||
| src: string; | ||
| showLoading?: boolean; | ||
| loadingIcon?: string; | ||
| loading?: React.ReactElement; | ||
| showError?: boolean; | ||
| errorIcon?: string; | ||
| error?: React.ReactElement; | ||
| round?: boolean; | ||
| radius?: string; | ||
| width?: string; | ||
| height?: string; | ||
| } | ||
| declare const Component: { | ||
| (props: ImageProps): JSX.Element; | ||
| options: { | ||
| addGlobalClass: boolean; | ||
| }; | ||
| }; | ||
| export default Component; |
| export { default as Authorize } from "@vyron/mini-components/authorize"; | ||
| export { default as Carousel } from "@vyron/mini-components/carousel"; | ||
| export { default as Divider } from "@vyron/mini-components/divider"; | ||
| export { default as Empty } from "@vyron/mini-components/empty"; | ||
| export { default as Icon } from "@vyron/mini-components/icon"; | ||
| export { default as Image } from "@vyron/mini-components/image"; | ||
| export { default as List } from "@vyron/mini-components/list"; | ||
| export { default as Loading } from "@vyron/mini-components/loading"; | ||
| export { default as AppBar } from "@vyron/mini-components/appbar"; | ||
| export { default as Overlay } from "@vyron/mini-components/overlay"; | ||
| export { default as Transition } from "@vyron/mini-components/transition"; | ||
| export { default as Cell, CellGroup } from "@vyron/mini-components/cell"; | ||
| export { default as Field } from "@vyron/mini-components/field"; |
| import React from "react"; | ||
| import { ScrollViewProps } from "@tarojs/components/types/ScrollView"; | ||
| import { BaseObject, CustomStyle } from "@vyron/mini-components/types"; | ||
| declare type OmitScrollViewProps = "scrollX" | "scrollY" | "refresherEnabled" | "refreshTriggered"; | ||
| export interface ListProps extends Omit<ScrollViewProps, OmitScrollViewProps> { | ||
| hasMore?: boolean; | ||
| data?: BaseObject[]; | ||
| ListComponent?: React.ComponentType; | ||
| children?: React.ReactElement | string; | ||
| firstTriggered?: boolean; | ||
| onRefresh?: Function; | ||
| onRefreshCancel?: Function; | ||
| onReachBottom?: Function; | ||
| refresherStayTime?: number; | ||
| refresherClassName?: string; | ||
| refresherStyle?: CustomStyle; | ||
| loading?: React.ReactElement; | ||
| loadingText?: string; | ||
| loadingClass?: string; | ||
| loadingStyle?: CustomStyle; | ||
| error?: React.ReactElement; | ||
| errorText?: string; | ||
| errorClass?: string; | ||
| errorStyle?: CustomStyle; | ||
| } | ||
| declare const List: { | ||
| (props: ListProps): JSX.Element; | ||
| options: { | ||
| addGlobalClass: boolean; | ||
| }; | ||
| }; | ||
| export default List; |
| import { ReactElement } from "react"; | ||
| import { CustomStyle } from "@vyron/mini-components/types"; | ||
| declare type LoadingType = "circular" | "spinner"; | ||
| export interface LoadingProps { | ||
| color?: string; | ||
| type?: LoadingType; | ||
| size?: string; | ||
| textSize?: string; | ||
| vertical?: boolean; | ||
| block?: boolean; | ||
| className?: string; | ||
| style?: CustomStyle; | ||
| children?: string | ReactElement; | ||
| } | ||
| declare const Loading: { | ||
| (props: LoadingProps): JSX.Element; | ||
| options: { | ||
| addGlobalClass: boolean; | ||
| }; | ||
| }; | ||
| export default Loading; |
| import React from "react"; | ||
| export interface OverlayProps { | ||
| show: boolean; | ||
| className?: string; | ||
| customAppbar?: boolean; | ||
| preventScroll?: boolean; | ||
| opacity?: number | string; | ||
| zIndex?: number | string; | ||
| duration?: number | string; | ||
| onClick?: (eve: any) => void; | ||
| style?: React.CSSProperties | string; | ||
| children?: React.ReactElement | string; | ||
| } | ||
| declare const Overlay: (props: OverlayProps) => JSX.Element; | ||
| export default Overlay; |
| import React from "react"; | ||
| export declare type TransitionType = "fade" | "fadeUp" | "fadeDown" | "fadeLeft" | "fadeRight" | "slideUp" | "slideDown" | "slideLeft" | "slideRight"; | ||
| export interface TransitionProps { | ||
| show: boolean; | ||
| duration?: number; | ||
| name: TransitionType; | ||
| children: React.ReactElement; | ||
| } | ||
| declare const Transition: (props: TransitionProps) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null; | ||
| export default Transition; |
| /// <reference types="react" /> | ||
| export declare type BaseObject = { | ||
| [key: string]: any; | ||
| }; | ||
| export declare type BaseMap = Map<string, any>; | ||
| export declare type ExtractAllType<T> = T extends { | ||
| [key: string]: infer U; | ||
| } ? U : T; | ||
| export declare type ExtractArrayType<T> = T extends (infer U)[] ? U : T; | ||
| export declare type CustomElement = React.ReactElement | string; | ||
| export declare type CustomStyle = React.CSSProperties | string; | ||
| export declare type CustomTextAlign = "left" | "center" | "right"; |
Sorry, the diff of this file is too big to display
478917
-6.68%119
-22.22%5487
-13.37%