@yup/taro-ui 0.0.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +228 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +3 -1
- package/es/components/avatar/index.d.ts +18 -0
- package/es/components/avatar/index.js +1 -0
- package/es/components/avatar/style/index.css +28 -0
- package/es/components/avatar/style/index.d.ts +2 -0
- package/es/components/avatar/style/index.js +2 -0
- package/es/components/button/index.d.ts +19 -3
- package/es/components/button/index.js +1 -1
- package/es/components/button/style/index.css +118 -48
- package/es/components/button/style/index.d.ts +1 -0
- package/es/components/button/style/index.js +1 -0
- package/es/components/checkbox/checkbox-group.d.ts +6 -2
- package/es/components/checkbox/checkbox-group.js +1 -1
- package/es/components/checkbox/index.js +1 -1
- package/es/components/checkbox/style/index.css +2 -24
- package/es/components/checkbox/style/index.d.ts +1 -0
- package/es/components/checkbox/style/index.js +1 -0
- package/es/components/city-selector/hooks/useLevel2Multiple.d.ts +24 -0
- package/es/components/city-selector/hooks/useLevel2Multiple.js +1 -0
- package/es/components/city-selector/hooks/useLevel2Single.d.ts +19 -0
- package/es/components/city-selector/hooks/useLevel2Single.js +1 -0
- package/es/components/city-selector/hooks/useMultiple.d.ts +28 -0
- package/es/components/city-selector/hooks/useMultiple.js +1 -0
- package/es/components/city-selector/hooks/useSingle.d.ts +23 -0
- package/es/components/city-selector/hooks/useSingle.js +1 -0
- package/es/components/city-selector/index.d.ts +5 -0
- package/es/components/city-selector/index.js +1 -0
- package/es/components/city-selector/style/index.css +153 -0
- package/es/components/city-selector/style/index.d.ts +2 -0
- package/es/components/city-selector/util.d.ts +2 -0
- package/es/components/city-selector/util.js +1 -0
- package/es/components/date-picker-view/index.d.ts +40 -0
- package/es/components/date-picker-view/index.js +1 -0
- package/es/components/date-picker-view/style/index.css +3 -0
- package/es/components/date-picker-view/style/index.d.ts +2 -0
- package/es/components/date-picker-view/style/index.js +2 -0
- package/es/components/date-picker-view/util.d.ts +7 -0
- package/es/components/date-picker-view/util.js +1 -0
- package/es/components/dialog/context.d.ts +4 -0
- package/es/components/dialog/index.d.ts +31 -0
- package/es/components/dialog/index.js +1 -0
- package/es/components/dialog/style/index.css +113 -0
- package/es/components/dialog/style/index.d.ts +2 -0
- package/es/components/dialog/style/index.js +2 -0
- package/es/components/form/form-item.js +1 -1
- package/es/components/form/index.js +1 -1
- package/es/components/form/style/index.css +0 -22
- package/es/components/form/style/index.d.ts +1 -0
- package/es/components/form/style/index.js +1 -0
- package/es/components/icon/index.d.ts +12 -0
- package/es/components/icon/index.js +1 -0
- package/es/components/icon/style/iconfont.css +72 -0
- package/es/components/icon/style/iconfont.ttf +0 -0
- package/es/components/icon/style/iconfont.woff +0 -0
- package/es/components/icon/style/iconfont.woff2 +0 -0
- package/es/components/icon/style/index.d.ts +1 -0
- package/es/components/icon/style/index.js +1 -0
- package/es/components/input/index.d.ts +12 -0
- package/es/components/input/index.js +1 -1
- package/es/components/input/style/index.css +33 -32
- package/es/components/input/style/index.d.ts +2 -0
- package/es/components/input/style/index.js +2 -0
- package/es/components/input/style/search.css +21 -0
- package/es/components/media-uploader/index.d.ts +123 -0
- package/es/components/media-uploader/index.js +1 -0
- package/es/components/media-uploader/style/index.css +93 -0
- package/es/components/media-uploader/style/index.d.ts +2 -0
- package/es/components/media-uploader/style/index.js +2 -0
- package/es/components/picker-view/index.d.ts +25 -0
- package/es/components/picker-view/index.js +1 -0
- package/es/components/picker-view/style/index.css +62 -0
- package/es/components/picker-view/style/index.d.ts +2 -0
- package/es/components/picker-view/style/index.js +2 -0
- package/es/components/popup/index.d.ts +62 -0
- package/es/components/popup/index.js +1 -0
- package/es/components/popup/style/index.css +91 -0
- package/es/components/popup/style/index.d.ts +2 -0
- package/es/components/popup/style/index.js +2 -0
- package/es/components/radio/context.d.ts +5 -0
- package/es/components/radio/context.js +1 -0
- package/es/components/radio/index.js +1 -1
- package/es/components/radio/radio-group.js +1 -1
- package/es/components/radio/style/group.css +0 -22
- package/es/components/radio/style/index.d.ts +1 -0
- package/es/components/radio/style/index.js +1 -0
- package/es/components/radio/style/radio.css +11 -24
- package/es/components/safe-area/index.d.ts +13 -0
- package/es/components/safe-area/index.js +1 -0
- package/es/components/safe-area/style/index.css +3 -0
- package/es/components/safe-area/style/index.d.ts +2 -0
- package/es/components/safe-area/style/index.js +2 -0
- package/es/components/safe-area/util.d.ts +5 -0
- package/es/components/safe-area/util.js +1 -0
- package/es/components/switch/index.d.ts +6 -0
- package/es/components/switch/index.js +1 -0
- package/es/components/switch/style/index.css +38 -0
- package/es/components/switch/style/index.d.ts +2 -0
- package/es/components/switch/style/index.js +2 -0
- package/es/components/tag/index.d.ts +18 -0
- package/es/components/tag/index.js +1 -0
- package/es/components/tag/style/index.css +92 -0
- package/es/components/tag/style/index.d.ts +2 -0
- package/es/components/tag/style/index.js +2 -0
- package/es/components/toast/style/index.css +0 -22
- package/es/components/toast/style/index.d.ts +1 -0
- package/es/components/toast/style/index.js +1 -0
- package/es/components/toast/toast.js +1 -1
- package/es/components/toast/withToast.js +1 -1
- package/es/global/global.css +21 -0
- package/es/global/index.d.ts +2 -1
- package/es/global/theme-default.css +21 -0
- package/es/global/variables.css +0 -0
- package/es/hooks/useRefState.d.ts +7 -0
- package/es/hooks/useRefState.js +1 -0
- package/es/index.d.ts +26 -0
- package/es/index.js +1 -1
- package/es/node_modules/@yup/taro-checkbox/dist/_virtual/_rollupPluginBabelHelpers.js +1 -0
- package/es/node_modules/@yup/taro-checkbox/dist/checkbox-group.js +1 -0
- package/es/node_modules/@yup/taro-checkbox/dist/context.js +1 -0
- package/es/node_modules/@yup/taro-checkbox/dist/index.js +1 -0
- package/es/node_modules/@yup/taro-form/dist/_virtual/_rollupPluginBabelHelpers.js +3 -0
- package/es/node_modules/@yup/taro-form/dist/context.js +1 -0
- package/es/node_modules/@yup/taro-form/dist/formItem.js +1 -0
- package/es/node_modules/@yup/taro-form/dist/fromStore.js +1 -0
- package/es/node_modules/@yup/taro-form/dist/index.js +1 -0
- package/es/node_modules/@yup/taro-form/dist/useForm.js +1 -0
- package/es/node_modules/@yup/taro-form/dist/useWatch.js +1 -0
- package/es/node_modules/@yup/taro-radio/dist/_virtual/_rollupPluginBabelHelpers.js +1 -0
- package/es/node_modules/@yup/taro-radio/dist/context.js +1 -0
- package/es/node_modules/@yup/taro-radio/dist/index.js +1 -0
- package/es/node_modules/@yup/taro-radio/dist/radio-group.js +1 -0
- package/es/style/iconfont.ttf +0 -0
- package/es/style/iconfont.woff +0 -0
- package/es/style/iconfont.woff2 +0 -0
- package/es/style/index.css +282 -227
- package/es/utils/is.js +1 -1
- package/package.json +16 -9
- package/es/_virtual/_commonjsHelpers.js +0 -1
- package/es/_virtual/index.js +0 -1
- package/es/_virtual/jsx-runtime.js +0 -1
- package/es/_virtual/react-jsx-runtime.development.js +0 -1
- package/es/_virtual/react-jsx-runtime.production.min.js +0 -1
- package/es/global.css +0 -22
- package/es/node_modules/classnames/index.js +0 -1
- package/es/node_modules/react/cjs/react-jsx-runtime.development.js +0 -1
- package/es/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -10
- package/es/node_modules/react/jsx-runtime.js +0 -1
- package/es/utils/react.d.ts +0 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OptionTreeData, ValueType, CitySelectorProps } from '../type';
|
|
2
|
+
export interface UseLevel2MultipleOption {
|
|
3
|
+
cityMap: {
|
|
4
|
+
[propsName: ValueType]: OptionTreeData;
|
|
5
|
+
};
|
|
6
|
+
defaultValue: ValueType[];
|
|
7
|
+
value?: ValueType[];
|
|
8
|
+
municipality: ValueType[];
|
|
9
|
+
max?: number;
|
|
10
|
+
onSelect?: CitySelectorProps['onSelect'];
|
|
11
|
+
onChange?: CitySelectorProps['onChange'];
|
|
12
|
+
onRemove: (item: OptionTreeData) => Promise<boolean>;
|
|
13
|
+
beforeSelect: (value: OptionTreeData[], selectedItem: OptionTreeData) => Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
declare function useLevel2Multiple({ cityMap, defaultValue, municipality, beforeSelect, onRemove, onSelect, onChange, max, ...rst }: UseLevel2MultipleOption): {
|
|
16
|
+
handleClear: () => void;
|
|
17
|
+
handleRemove: (item: OptionTreeData) => Promise<void>;
|
|
18
|
+
selectedDataTopLevel: OptionTreeData;
|
|
19
|
+
handleLevel1Click: (item: OptionTreeData) => void;
|
|
20
|
+
handleLevel2Click: (item: OptionTreeData) => void;
|
|
21
|
+
level1SelectedData: OptionTreeData | undefined;
|
|
22
|
+
level2SelectedData: OptionTreeData[] | undefined;
|
|
23
|
+
};
|
|
24
|
+
export default useLevel2Multiple;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{objectWithoutProperties as n,slicedToArray as e,toConsumableArray as l,asyncToGenerator as r,regenerator as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import u from"react";var a=["cityMap","defaultValue","municipality","beforeSelect","onRemove","onSelect","onChange","max"];function i(i){var o=i.cityMap,c=i.defaultValue;i.municipality;var v=i.beforeSelect,d=i.onRemove,f=i.onSelect,s=i.onChange,p=i.max,m=n(i,a),h=u.useState(),y=e(h,2),b=y[0],S=y[1],I=u.useState(),w=e(I,2),C=w[0],g=w[1],k=function(){var n=r(t().m(function n(e,r){var u;return t().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,v(e,r);case 1:if(n.v){n.n=2;break}return n.a(2);case 2:if(!(p&&(null==e?void 0:e.length)>p)){n.n=3;break}return n.a(2);case 3:u=null==e?void 0:e.map(function(n){return n.id}),f&&(null==f||f(u)),s&&(null==s||s(u)),g(l(e));case 4:return n.a(2)}},n)}));return function(e,l){return n.apply(this,arguments)}}(),x=function(){var n=r(t().m(function n(e){var r;return t().w(function(n){for(;;)switch(n.n){case 0:r=null==e?void 0:e.map(function(n){return n.id}),s&&(null==s||s(r)),g(l(e));case 1:return n.a(2)}},n)}));return function(e){return n.apply(this,arguments)}}(),D=function(){var n=r(t().m(function n(e){var l;return t().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,null==d?void 0:d(e);case 1:if(n.v){n.n=2;break}return n.a(2);case 2:l=null==C?void 0:C.filter(function(n){return n.id!==e.id}),x(l);case 3:return n.a(2)}},n)}));return function(e){return n.apply(this,arguments)}}();u.useEffect(function(){var n,e=null==c?void 0:c.map(function(n){return o[n]});if(g(e),null!=e&&null!==(n=e[0])&&void 0!==n&&n.parentId){var l,r=o[null==e||null===(l=e[0])||void 0===l?void 0:l.parentId];S(r)}},[o]),u.useEffect(function(){if("value"in m){var n,e,l=null==m||null===(n=m.value)||void 0===n?void 0:n.map(function(n){return o[n]});if(g(l),null!=l&&null!==(e=l[0])&&void 0!==e&&e.parentId){var r,t=o[null==l||null===(r=l[0])||void 0===r?void 0:r.parentId];S(t)}}},[o,null==m?void 0:m.value]);var L=u.useMemo(function(){var n;return o[null==C||null===(n=C[0])||void 0===n?void 0:n.parentId]},[C,o]);return{handleClear:function(){x([])},handleRemove:D,selectedDataTopLevel:L,handleLevel1Click:function(n){var e,l;(S(n),null!=n&&null!==(e=n.children)&&void 0!==e&&e[0])&&g([null==n||null===(l=n.children)||void 0===l?void 0:l[0]])},handleLevel2Click:function(n){var e,r;n.parentId===(null==C||null===(e=C[0])||void 0===e?void 0:e.parentId)?null!=C&&null!==(r=C.map(function(n){return n.id}))&&void 0!==r&&r.includes(n.id)?D(n):k([].concat(l(C||[]),[n]),n):k([n],n)},level1SelectedData:b,level2SelectedData:C}}export{i as default};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OptionTreeData, ValueType, CitySelectorProps } from '../type';
|
|
2
|
+
export interface UseLevel2SingleOption {
|
|
3
|
+
cityMap: {
|
|
4
|
+
[propsName: ValueType]: OptionTreeData;
|
|
5
|
+
};
|
|
6
|
+
defaultValue: ValueType;
|
|
7
|
+
value: ValueType;
|
|
8
|
+
municipality: ValueType[];
|
|
9
|
+
onChange?: CitySelectorProps['onChange'];
|
|
10
|
+
beforeSelect: (selectedItem: OptionTreeData) => Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
declare function useLevel2Single({ cityMap, defaultValue, municipality, beforeSelect, onChange, ...rst }: UseLevel2SingleOption): {
|
|
13
|
+
selectedDataTopLevel: OptionTreeData;
|
|
14
|
+
handleLevel1Click: (item: OptionTreeData) => void;
|
|
15
|
+
handleLevel2Click: (item: OptionTreeData) => void;
|
|
16
|
+
level1SelectedData: OptionTreeData | undefined;
|
|
17
|
+
level2SelectedData: OptionTreeData | undefined;
|
|
18
|
+
};
|
|
19
|
+
export default useLevel2Single;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{objectWithoutProperties as e,slicedToArray as n,asyncToGenerator as l,regenerator as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import a from"react";var u=["cityMap","defaultValue","municipality","beforeSelect","onChange"];function i(i){var r=i.cityMap,o=i.defaultValue;i.municipality;var c=i.beforeSelect,d=i.onChange,v=e(i,u),f=a.useState(),s=n(f,2),p=s[0],m=s[1],h=a.useState(),y=n(h,2),S=y[0],I=y[1],b=function(){var e=l(t().m(function e(n){return t().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,null==c?void 0:c(n);case 1:e.v||d&&(null==d||d(null==n?void 0:n.id)),"value"in v||I(n);case 2:return e.a(2)}},e)}));return function(n){return e.apply(this,arguments)}}();return a.useEffect(function(){var e=r[o];if(I(e),null!=e&&e.parentId){var n=r[null==e?void 0:e.parentId];m(n)}},[r]),a.useEffect(function(){if("value"in v){var e=r[null==v?void 0:v.value];if(I(e),null!=e&&e.parentId){var n=r[null==e?void 0:e.parentId];m(n)}}},[r,null==v?void 0:v.value]),{selectedDataTopLevel:a.useMemo(function(){return r[null==S?void 0:S.parentId]},[S,r]),handleLevel1Click:function(e){(null==e?void 0:e.id)!==(null==p?void 0:p.id)&&function(e){m(e)}(e)},handleLevel2Click:function(e){(null==e?void 0:e.id)!==(null==S?void 0:S.id)&&b(e)},level1SelectedData:p,level2SelectedData:S}}export{i as default};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OptionTreeData, ValueType, CitySelectorProps } from '../type';
|
|
2
|
+
export interface UseMultipleOption {
|
|
3
|
+
cityMap: {
|
|
4
|
+
[propsName: ValueType]: OptionTreeData;
|
|
5
|
+
};
|
|
6
|
+
defaultValue: ValueType[];
|
|
7
|
+
value: ValueType[];
|
|
8
|
+
municipality: ValueType[];
|
|
9
|
+
max?: number;
|
|
10
|
+
onChange?: CitySelectorProps['onChange'];
|
|
11
|
+
onSelect?: CitySelectorProps['onSelect'];
|
|
12
|
+
onRemove: (item: OptionTreeData) => Promise<boolean>;
|
|
13
|
+
beforeSelect: (selectedItems: OptionTreeData[], selectedItem: OptionTreeData) => Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
declare function useMultiple({ cityMap, defaultValue, municipality, beforeSelect, onSelect, onChange, onRemove, max, ...rst }: UseMultipleOption): {
|
|
16
|
+
selectedDataSecondaryLevel: OptionTreeData;
|
|
17
|
+
selectedDataTopLevel: OptionTreeData;
|
|
18
|
+
level1SelectedData: OptionTreeData | undefined;
|
|
19
|
+
level2SelectedData: OptionTreeData | undefined;
|
|
20
|
+
level3SelectedData: OptionTreeData[] | undefined;
|
|
21
|
+
handleLevel1Click: (item: OptionTreeData) => void;
|
|
22
|
+
handleLevel2Click: (item: OptionTreeData) => void;
|
|
23
|
+
handleLevel3Click: (item: OptionTreeData) => void;
|
|
24
|
+
municipalitySelectedData: OptionTreeData[] | undefined;
|
|
25
|
+
handleRemove: (item: OptionTreeData) => Promise<void>;
|
|
26
|
+
handleClear: () => void;
|
|
27
|
+
};
|
|
28
|
+
export default useMultiple;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{objectWithoutProperties as n,slicedToArray as e,toConsumableArray as r,asyncToGenerator as t,regenerator as l}from"../../../_virtual/_rollupPluginBabelHelpers.js";import u from"react";import{isMunicipality as a}from"../util.js";var i=["cityMap","defaultValue","municipality","beforeSelect","onSelect","onChange","onRemove","max"];function o(o){var c=o.cityMap,d=o.defaultValue,v=o.municipality,f=o.beforeSelect,s=o.onSelect,p=o.onChange,m=o.onRemove,h=o.max,I=n(o,i),b=u.useState(),y=e(b,2),S=y[0],k=y[1],w=u.useState(),g=e(w,2),C=g[0],D=g[1],L=u.useState(),M=e(L,2),j=M[0],x=M[1],R=u.useState(),T=e(R,2),A=T[0],E=T[1],P=function(){var n=t(l().m(function n(e){var t;return l().w(function(n){for(;;)switch(n.n){case 0:t=null==e?void 0:e.map(function(n){return n.id}),E(r(e)),k([]),p&&(null==p||p(t));case 1:return n.a(2)}},n)}));return function(e){return n.apply(this,arguments)}}(),V=function(){var n=t(l().m(function n(e,t){var u,a;return l().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,f(e,t);case 1:if(u=n.v,a=null==e?void 0:e.map(function(n){return n.id}),u){n.n=2;break}return n.a(2);case 2:if(!(h&&h<(null==e?void 0:e.length))){n.n=3;break}return n.a(2);case 3:E(r(e)),k([]),s&&(null==s||s(a)),p&&(null==p||p(a));case 4:return n.a(2)}},n)}));return function(e,r){return n.apply(this,arguments)}}(),_=function(n){var e=null==n?void 0:n.map(function(n){return n.id});p&&(null==p||p(e)),k(r(n)),E([])},B=function(){var n=t(l().m(function n(e,t){var u;return l().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,f(e,t);case 1:if(n.v){n.n=2;break}return n.a(2);case 2:if(!(h&&h<(null==e?void 0:e.length))){n.n=3;break}return n.a(2);case 3:u=null==e?void 0:e.map(function(n){return n.id}),s&&(null==s||s(u)),p&&(null==p||p(u)),k(r(e)),E([]);case 4:return n.a(2)}},n)}));return function(e,r){return n.apply(this,arguments)}}(),G=function(){var n=t(l().m(function n(e){var t,u;return l().w(function(n){for(;;)switch(n.n){case 0:if(!a(e.parentId,v)){n.n=3;break}if(e.parentId===(null==S||null===(t=S[0])||void 0===t?void 0:t.parentId)){n.n=1;break}return B([e],e),n.a(2);case 1:if(null==S||null===(u=S.map(function(n){return n.id}))||void 0===u||!u.includes(e.id)){n.n=2;break}return H(e),n.a(2);case 2:return B([].concat(r(S||[]),[e]),e),n.a(2);case 3:x(e);case 4:return n.a(2)}},n)}));return function(e){return n.apply(this,arguments)}}(),H=function(){var n=t(l().m(function n(e){var t,u;return l().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,m(e);case 1:if(n.v){n.n=2;break}return n.a(2);case 2:if(!a(e.parentId,v)){n.n=3;break}return t=null==S?void 0:S.filter(function(n){return n.id!==e.id}),_(r(t)),n.a(2);case 3:u=null==A?void 0:A.filter(function(n){return n.id!==e.id}),P(u);case 4:return n.a(2)}},n)}));return function(e){return n.apply(this,arguments)}}();u.useEffect(function(){var n,e=null==d?void 0:d.map(function(n){return c[n]});if(E(e),null!=e&&null!==(n=e[0])&&void 0!==n&&n.parentId){var r,t=c[null==e||null===(r=e[0])||void 0===r?void 0:r.parentId];x(t),t&&D(c[t.parentId])}},[c]),u.useEffect(function(){if("value"in I){var n,e,r,t,l=null==I||null===(n=I.value)||void 0===n?void 0:n.map(function(n){return c[n]});if(E(l),a(null==l||null===(e=l[0])||void 0===e?void 0:e.parentId,v))return void D(c[null==l||null===(t=l[0])||void 0===t?void 0:t.parentId]);if(null!=l&&null!==(r=l[0])&&void 0!==r&&r.parentId){var u,i=c[null==l||null===(u=l[0])||void 0===u?void 0:u.parentId];x(i),i&&D(c[i.parentId])}}},[c,I,v]);var W=u.useMemo(function(){var n,e,r;return null!=S&&S.length?c[null==S||null===(r=S[0])||void 0===r?void 0:r.parentId]:c[null===(n=c[null==A||null===(e=A[0])||void 0===e?void 0:e.parentId])||void 0===n?void 0:n.parentId]},[c,A,S]);return{selectedDataSecondaryLevel:u.useMemo(function(){var n;return c[null==A||null===(n=A[0])||void 0===n?void 0:n.parentId]},[c,A]),selectedDataTopLevel:W,level1SelectedData:C,level2SelectedData:j,level3SelectedData:A,handleLevel1Click:function(n){n.id!==(null==C?void 0:C.id)&&function(n){var e,r;D(n),a(n.id,v)?(k([null==n||null===(e=n.children)||void 0===e?void 0:e[0]]),x(void 0)):(x(null==n||null===(r=n.children)||void 0===r?void 0:r[0]),k([])),E([])}(n)},handleLevel2Click:function(n){(n.id!==(null==C?void 0:C.id)||a(n.parentId,v))&&G(n)},handleLevel3Click:function(n){!function(n){var e,t;n.parentId===(null==A||null===(e=A[0])||void 0===e?void 0:e.parentId)?null!=A&&null!==(t=A.map(function(n){return n.id}))&&void 0!==t&&t.includes(n.id)?H(n):V([].concat(r(A||[]),[n]),n):V([n],n)}(n)},municipalitySelectedData:S,handleRemove:H,handleClear:function(){null!=S&&S.length?_([]):P([])}}}export{o as default};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OptionTreeData, ValueType, CitySelectorProps } from '../type';
|
|
2
|
+
export interface UseSingleOption {
|
|
3
|
+
cityMap: {
|
|
4
|
+
[propsName: ValueType]: OptionTreeData;
|
|
5
|
+
};
|
|
6
|
+
defaultValue: ValueType;
|
|
7
|
+
value: ValueType;
|
|
8
|
+
municipality: ValueType[];
|
|
9
|
+
onChange?: CitySelectorProps['onChange'];
|
|
10
|
+
beforeSelect: (item: OptionTreeData) => Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
declare function useSingle({ cityMap, value, onChange, defaultValue, municipality, beforeSelect, ...rst }: UseSingleOption): {
|
|
13
|
+
selectedDataSecondaryLevel: OptionTreeData;
|
|
14
|
+
municipalitySelectedData: OptionTreeData | undefined;
|
|
15
|
+
selectedDataTopLevel: OptionTreeData;
|
|
16
|
+
level1SelectedData: OptionTreeData | undefined;
|
|
17
|
+
level2SelectedData: OptionTreeData | undefined;
|
|
18
|
+
level3SelectedData: OptionTreeData | undefined;
|
|
19
|
+
handleLevel1Click: (item: OptionTreeData) => void;
|
|
20
|
+
handleLevel2Click: (item: OptionTreeData) => void;
|
|
21
|
+
handleLevel3Click: (item: OptionTreeData) => void;
|
|
22
|
+
};
|
|
23
|
+
export default useSingle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{objectWithoutProperties as e,slicedToArray as n,asyncToGenerator as l,regenerator as i}from"../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import{isMunicipality as a}from"../util.js";var r=["cityMap","value","onChange","defaultValue","municipality","beforeSelect"];function u(u){var d=u.cityMap,o=u.value,v=u.onChange,c=u.defaultValue,f=u.municipality,p=u.beforeSelect,s=e(u,r),h=t.useState(),m=n(h,2),I=m[0],S=m[1],y=t.useState(),D=n(y,2),b=D[0],C=D[1],L=t.useState(),g=n(L,2),k=g[0],M=g[1],j=t.useState(),T=n(j,2),w=T[0],E=T[1],P=function(){var e=l(i().m(function e(n){return i().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,p(n);case 1:if(e.v){e.n=2;break}return e.a(2);case 2:v&&(null==v||v(o));case 3:return e.a(2)}},e)}));return function(n){return e.apply(this,arguments)}}(),V=function(e){if(a(e.parentId,f))return"value"in s||S(e),void P(e);M(e)};t.useEffect(function(){var e=d[c];if(M(e),e){var n=d[e.parentId];M(n),n&&C(d[n.parentId])}},[d]),t.useEffect(function(){if("value"in s){var e=d[c];if(M(e),a(null==e?void 0:e.parentId,f))return void C(d[null==e?void 0:e.parentId]);if(e){var n=d[e.parentId];M(n),n&&C(d[n.parentId])}}},[d,s,f]);var _=t.useMemo(function(){var e;return I?d[null==I?void 0:I.parentId]:d[null===(e=d[null==w?void 0:w.parentId])||void 0===e?void 0:e.parentId]},[d,w,I]);return{selectedDataSecondaryLevel:t.useMemo(function(){return d[null==w?void 0:w.parentId]},[d,w]),municipalitySelectedData:I,selectedDataTopLevel:_,level1SelectedData:b,level2SelectedData:k,level3SelectedData:w,handleLevel1Click:function(e){e.id!==(null==b?void 0:b.id)&&function(e){var n,l,i;if(C(e),a(e.id,f))return S(null==e||null===(i=e.children)||void 0===i?void 0:i[0]),M(void 0),void E(void 0);S(void 0),M(null==e||null===(n=e.children)||void 0===n?void 0:n[0]),E(null==e||null===(l=e.children)||void 0===l||null===(l=l[0])||void 0===l||null===(l=l.children)||void 0===l?void 0:l[0])}(e)},handleLevel2Click:function(e){(a(e.parentId,f)&&(null==I?void 0:I.id)!==(null==e?void 0:e.id)||e.id!==(null==k?void 0:k.id))&&V(e)},handleLevel3Click:function(e){(null==w?void 0:w.id)!==(null==e?void 0:e.id)&&function(e){"value"in s||E(e),P(e)}(e)}}}export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{objectWithoutProperties as e,objectSpread2 as n,createForOfIteratorHelper as l,asyncToGenerator as i,regenerator as t}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as c,jsx as o}from"react/jsx-runtime";import r from"react";import a from"classnames";import{View as u,Text as d}from"@tarojs/components";import{isPromise as s}from"../../utils/is.js";import m from"../button/index.js";import p from"../icon/index.js";import v from"./hooks/useLevel2Multiple.js";import f from"./hooks/useLevel2Single.js";import y from"./hooks/useMultiple.js";import h from"./hooks/useSingle.js";import{isMunicipality as k}from"./util.js";var C=["className","cityList","level","max","maxCount","defaultValue","multiple","municipality","beforeSelect","onChange","onClear","onConfirm","onRemove","onSelect","countArea","panelTitle","checkedIcon","clearButtonProps","confirmButtonProps","checkedMarkForSingle","checkedMarkForMultipe"],S=function(S){var N,M,g,L=S.className,b=S.cityList,D=S.level,j=S.max,P=void 0===j?9:j,x=S.maxCount,T=void 0===x?P:x,I=S.defaultValue,R=S.multiple,V=void 0===R||R,w=S.municipality,B=void 0===w?[]:w,F=S.beforeSelect,z=S.onChange,A=S.onClear,H=S.onConfirm,_=S.onRemove,G=S.onSelect,O=S.countArea,W=S.panelTitle,q=S.checkedIcon,E=S.clearButtonProps,J=S.confirmButtonProps,K=S.checkedMarkForSingle,Q=S.checkedMarkForMultipe,U=e(S,C),X=r.useMemo(function(){var e=function(l,i){var t;return null==l||null===(t=l.filter(function(e){return!i&&!e.parentId||e.parentId===i}))||void 0===t?void 0:t.map(function(i){return n(n({},i),{},{children:e(l,i.id)})})};return e(b,void 0)},[b]),Y=r.useMemo(function(){var e={},n=function(i){var t,c=l(i);try{for(c.s();!(t=c.n()).done;){var o,r=t.value;e[r.id]=r,null!=r&&null!==(o=r.children)&&void 0!==o&&o.length&&n(r.children)}}catch(e){c.e(e)}finally{c.f()}};return n(X),e},[X]),Z=function(e,n){if(!F)return Promise.resolve(!0);var l=null==F?void 0:F(e,n);return s(l)?l:Promise.resolve(l)},$=function(e){if(!_)return Promise.resolve(!0);var n=null==_?void 0:_(e);return s(n)?n:Promise.resolve(n)},ee=function(e){if(!A)return Promise.resolve(!0);var n=null==A?void 0:A(e);return s(n)?n:Promise.resolve(n)},ne=v(n({cityMap:Y,municipality:B,beforeSelect:Z,max:P,onRemove:$,onChange:z,onSelect:G,defaultValue:I},U)),le=ne.handleClear,ie=ne.handleRemove,te=ne.selectedDataTopLevel,ce=ne.handleLevel1Click,oe=ne.handleLevel2Click,re=ne.level1SelectedData,ae=ne.level2SelectedData,ue=f(n({cityMap:Y,municipality:B,onChange:z,beforeSelect:Z,defaultValue:I},U)),de=ue.selectedDataTopLevel,se=ue.handleLevel1Click,me=ue.handleLevel2Click,pe=ue.level1SelectedData,ve=ue.level2SelectedData,fe=y(n({cityMap:Y,municipality:B,max:P,onChange:z,onSelect:G,onRemove:$,beforeSelect:Z,defaultValue:I},U)),ye=fe.handleClear,he=fe.handleRemove,ke=fe.selectedDataTopLevel,Ce=fe.selectedDataSecondaryLevel,Se=fe.municipalitySelectedData,Ne=fe.handleLevel1Click,Me=fe.handleLevel2Click,ge=fe.handleLevel3Click,Le=fe.level1SelectedData,be=fe.level2SelectedData,De=fe.level3SelectedData,je=h(n({cityMap:Y,municipality:B,onChange:z,beforeSelect:Z,defaultValue:I},U)),Pe=je.selectedDataTopLevel,xe=je.selectedDataSecondaryLevel,Te=je.municipalitySelectedData,Ie=je.handleLevel1Click,Re=je.handleLevel2Click,Ve=je.handleLevel3Click,we=je.level1SelectedData,Be=je.level2SelectedData,Fe=je.level3SelectedData,ze=r.useMemo(function(){return V?2===D?re:Le:2===D?pe:we},[D,V,re,Le,pe,we]),Ae=r.useMemo(function(){return V?2===D?ae:be:2===D?ve:Be},[D,V,ae,be,ve,Be]),He=function(){var e=i(t().m(function e(){return t().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,ee(Ke);case 1:if(e.v){e.n=2;break}return e.a(2);case 2:if(3!==D){e.n=3;break}return ye(),e.a(2);case 3:le();case 4:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),_e=function(){var e=i(t().m(function e(n){return t().w(function(e){for(;;)switch(e.n){case 0:if(3!==D){e.n=1;break}return he(n),e.a(2);case 1:ie(n);case 2:return e.a(2)}},e)}));return function(n){return e.apply(this,arguments)}}(),Ge=function(e){var n,l,i;return 3===D?V?k(e.parentId,B)?null==Se||null===(l=Se.map(function(e){return e.id}))||void 0===l||null===(i=l.includes)||void 0===i?void 0:i.call(l,e.id):(null==be?void 0:be.id)===(null==e?void 0:e.id):k(e.parentId,B)?(null==Te?void 0:Te.id)===e.id:(null==Be?void 0:Be.id)===e.id:V?null==ae||null===(n=ae.map(function(e){return e.id}))||void 0===n?void 0:n.includes(null==e?void 0:e.id):(null==ve?void 0:ve.id)===(null==e?void 0:e.id)},Oe=function(e){var n;return V?null==De||null===(n=De.map(function(e){return e.id}))||void 0===n?void 0:n.includes(e.id):(null==Fe?void 0:Fe.id)===e.id},We=function(e){return K?K(e):o(u,{className:"ypmini-city-selector-dot-badge"})},qe=function(e){return q?q(e):o(p,{className:"ypmini-city-selector-checked-icon",name:"checked"})},Ee=function(e){return Q?null==Q?void 0:Q(e):o(u,{className:"ypmini-city-selector-count-badge",children:e})},Je=r.useMemo(function(){return null!=Se&&Se.length?Se:De},[Se,De]),Ke=r.useMemo(function(){return 2===D?ae:Je},[D,Je,ae]),Qe=r.useMemo(function(){return null==Ke?void 0:Ke.length},[Ke]),Ue=r.useMemo(function(){return 2===D?te:ke},[D,te,ke]),Xe=r.useMemo(function(){return 2===D?de:Pe},[D,de,Pe]);return c(u,n(n({className:a("ypmini-city-selector-wrapper",L)},U),{},{children:[c(u,{className:"ypmini-city-selector",children:[o(u,{className:a("ypmini-city-selector-column","ypmini-city-selector-column-1",{"ypmini-city-selector-column-secondary":2===D}),children:null==X?void 0:X.map(function(e){return c(u,{className:a("ypmini-city-selector-column-item",{"ypmini-city-selector-column-item-active":(null==ze?void 0:ze.id)===e.id}),onClick:function(){return function(e){if(V)return 2===D?void ce(e):void Ne(e);2!==D?Ie(e):se(e)}(e)},children:[e.name,V||(null==Xe?void 0:Xe.id)!==e.id?null:We(e),V&&(null==Ue?void 0:Ue.id)===e.id?Ee(Qe||0):null]},e.id)})}),o(u,{className:a("ypmini-city-selector-column","ypmini-city-selector-column-2",{"ypmini-city-selector-column-secondary":2===D}),children:null==ze||null===(N=ze.children)||void 0===N?void 0:N.map(function(e){return c(u,{className:a("ypmini-city-selector-column-item",{"ypmini-city-selector-column-item-active":Ge(e)}),onClick:function(){return function(e){if(V)return 2===D?void oe(e):void Me(e);2!==D?Re(e):me(e)}(e)},children:[e.name,V||(null==xe?void 0:xe.id)!==e.id||3!==D?null:We(e),V&&3===D&&(null==Ce?void 0:Ce.id)===e.id?Ee(Qe||0):null,Ge(e)&&2===D||Ge(e)&&3===D&&k(e.parentId,B)?qe(e):null]},e.id)})}),3===D&&null!=Ae&&null!==(M=Ae.children)&&void 0!==M&&M.length?o(u,{className:"ypmini-city-selector-column ypmini-city-selector-colum-3",children:null==Ae||null===(g=Ae.children)||void 0===g?void 0:g.map(function(e){return c(u,{className:a("ypmini-city-selector-column-item",{"ypmini-city-selector-column-item-active":Oe(e)}),onClick:function(){return function(e){V?ge(e):Ve(e)}(e)},children:[e.name,Oe(e)?qe(e):null]},e.id)})}):null]}),V&&Qe?c(u,{className:"ypmini-city-selector-panel",children:[c(u,{className:"ypmini-city-selector-panel-header",children:[o(d,{className:"ypmini-city-selector-panel-title",children:W||"我选择的地址"}),o(d,{className:"ypmini-city-selector-panel-count",children:O?null==O?void 0:O(Qe||0,T):"已选".concat(Qe||0).concat(T?"/".concat(T):"")})]}),o(u,{className:"ypmini-city-selector-panel-selected",children:null==Ke?void 0:Ke.map(function(e){return c(u,{className:"ypmini-city-selector-panel-selected-item",children:[e.name,o(p,{className:"ypmini-city-selector-panel-selected-item-close-icon",name:"close",onClick:function(){return _e(e)}})]},e.id)})}),c(u,{className:"ypmini-city-selector-panel-footer",children:[o(m,n(n({size:"large",className:"ypmini-city-selector-panel-footer-btn-clear",block:!0,styleType:"default"},E||{}),{},{onClick:He,children:"清除"})),o(m,n(n({size:"large",className:"ypmini-city-selector-panel-footer-btn-confirm",block:!0,styleType:"primary"},J||{}),{},{onClick:function(){H&&(null==H||H(null==Ke?void 0:Ke.map(function(e){return e.id})))},children:"确定选择"}))]})]}):null]}))};export{S as default};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
page {
|
|
3
|
+
--ypmini-city-selector-column-item-height: calc(48px * var(--ypmini-hd));
|
|
4
|
+
--ypmini-city-selector-column-item-font-size: var(--ypmini-font-size-default);
|
|
5
|
+
}
|
|
6
|
+
.ypmini-city-selector-wrapper {
|
|
7
|
+
position: relative;
|
|
8
|
+
height: 100%;
|
|
9
|
+
border-top: 1px solid var(--ypmini-border-color);
|
|
10
|
+
}
|
|
11
|
+
.ypmini-city-selector {
|
|
12
|
+
display: flex;
|
|
13
|
+
height: 100%;
|
|
14
|
+
}
|
|
15
|
+
.ypmini-city-selector-column {
|
|
16
|
+
flex: 1;
|
|
17
|
+
}
|
|
18
|
+
.ypmini-city-selector-column.ypmini-city-selector-column-secondary {
|
|
19
|
+
flex: 0 0 50%;
|
|
20
|
+
}
|
|
21
|
+
.ypmini-city-selector-column.ypmini-city-selector-column-secondary:first-child {
|
|
22
|
+
flex: 0 0 50%;
|
|
23
|
+
}
|
|
24
|
+
.ypmini-city-selector-column:first-child {
|
|
25
|
+
flex: 0 0 33.33%;
|
|
26
|
+
}
|
|
27
|
+
.ypmini-city-selector-column:not(:first-child):not(:last-child) {
|
|
28
|
+
border-right: 1px solid var(--ypmini-border-color);
|
|
29
|
+
}
|
|
30
|
+
.ypmini-city-selector-column-item-active {
|
|
31
|
+
font-weight: bold;
|
|
32
|
+
color: var(--ypmini-primary-color);
|
|
33
|
+
}
|
|
34
|
+
.ypmini-city-selector-column-1 {
|
|
35
|
+
background: #f5f6fa;
|
|
36
|
+
}
|
|
37
|
+
.ypmini-city-selector-column-1 .ypmini-city-selector-column-item-active {
|
|
38
|
+
position: relative;
|
|
39
|
+
background: #fff;
|
|
40
|
+
}
|
|
41
|
+
.ypmini-city-selector-column-1 .ypmini-city-selector-column-item-active:before {
|
|
42
|
+
position: absolute;
|
|
43
|
+
content: " ";
|
|
44
|
+
left: 0;
|
|
45
|
+
top: 50%;
|
|
46
|
+
transform: translateY(-50%);
|
|
47
|
+
width: 6px;
|
|
48
|
+
height: 40px;
|
|
49
|
+
border-radius: 0px 4px 4px 0px;
|
|
50
|
+
background: var(--ypmini-primary-color);
|
|
51
|
+
}
|
|
52
|
+
.ypmini-city-selector-column-item {
|
|
53
|
+
position: relative;
|
|
54
|
+
height: var(--ypmini-city-selector-column-item-height);
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
padding-left: 24px;
|
|
58
|
+
font-size: var(--ypmini-city-selector-column-item-font-size);
|
|
59
|
+
}
|
|
60
|
+
.ypmini-city-selector-count-badge {
|
|
61
|
+
position: absolute;
|
|
62
|
+
right: 24px;
|
|
63
|
+
width: 28px;
|
|
64
|
+
height: 28px;
|
|
65
|
+
background: var(--ypmini-primary-color);
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
font-weight: bold;
|
|
70
|
+
font-size: 20px;
|
|
71
|
+
color: #fff;
|
|
72
|
+
border-radius: 100%;
|
|
73
|
+
top: 50%;
|
|
74
|
+
transform: translateY(-50%);
|
|
75
|
+
}
|
|
76
|
+
.ypmini-city-selector-dot-badge {
|
|
77
|
+
position: absolute;
|
|
78
|
+
border-radius: 100%;
|
|
79
|
+
top: 50%;
|
|
80
|
+
right: 24px;
|
|
81
|
+
width: 12px;
|
|
82
|
+
height: 12px;
|
|
83
|
+
transform: translateY(-50%);
|
|
84
|
+
background: var(--ypmini-primary-color);
|
|
85
|
+
}
|
|
86
|
+
.ypmini-city-selector-checked-icon {
|
|
87
|
+
font-size: 32px;
|
|
88
|
+
position: absolute;
|
|
89
|
+
right: 24px;
|
|
90
|
+
color: var(--ypmini-primary-color);
|
|
91
|
+
top: 50%;
|
|
92
|
+
transform: translateY(-50%);
|
|
93
|
+
}
|
|
94
|
+
.ypmini-city-selector-panel {
|
|
95
|
+
position: absolute;
|
|
96
|
+
left: 0;
|
|
97
|
+
right: 0;
|
|
98
|
+
bottom: 0;
|
|
99
|
+
padding: 24px;
|
|
100
|
+
border-radius: 24px 24px 0px 0px;
|
|
101
|
+
background: #ffffff;
|
|
102
|
+
box-shadow: 0px -4px 8px rgba(50, 52, 60, 0.1);
|
|
103
|
+
}
|
|
104
|
+
.ypmini-city-selector-panel-header {
|
|
105
|
+
display: flex;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
align-items: center;
|
|
108
|
+
}
|
|
109
|
+
.ypmini-city-selector-panel-title {
|
|
110
|
+
color: var(--ypmini-color-text);
|
|
111
|
+
font-weight: bold;
|
|
112
|
+
font-size: 32px;
|
|
113
|
+
}
|
|
114
|
+
.ypmini-city-selector-panel-count {
|
|
115
|
+
color: rgba(0, 0, 0, 0.45);
|
|
116
|
+
font-weight: 400;
|
|
117
|
+
font-size: 28px;
|
|
118
|
+
}
|
|
119
|
+
.ypmini-city-selector-panel-selected {
|
|
120
|
+
margin-top: 8px;
|
|
121
|
+
margin-left: -16px;
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-wrap: wrap;
|
|
124
|
+
}
|
|
125
|
+
.ypmini-city-selector-panel-selected-item {
|
|
126
|
+
margin-left: 16px;
|
|
127
|
+
margin-top: 16px;
|
|
128
|
+
border-radius: 8px;
|
|
129
|
+
padding: 0px 16px;
|
|
130
|
+
display: inline-flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
height: 56px;
|
|
134
|
+
background: var(--ypmini-primary-secondary-color);
|
|
135
|
+
color: var(--ypmini-primary-color);
|
|
136
|
+
font-weight: 400;
|
|
137
|
+
font-size: var(--ypmini-font-size-mini);
|
|
138
|
+
white-space: nowrap;
|
|
139
|
+
}
|
|
140
|
+
.ypmini-city-selector-panel-selected-item .ypmini-city-selector-panel-selected-item-close-icon {
|
|
141
|
+
font-size: 24px;
|
|
142
|
+
margin-left: 8px;
|
|
143
|
+
}
|
|
144
|
+
.ypmini-city-selector-panel-footer {
|
|
145
|
+
display: flex;
|
|
146
|
+
margin-top: 24px;
|
|
147
|
+
}
|
|
148
|
+
.ypmini-city-selector-panel-footer .ypmini-city-selector-panel-footer-btn-clear {
|
|
149
|
+
width: 220px;
|
|
150
|
+
}
|
|
151
|
+
.ypmini-city-selector-panel-footer .ypmini-taro-button:not(:first-child) {
|
|
152
|
+
margin-left: 20px;
|
|
153
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return null==r?void 0:r.includes(n)};export{n as isMunicipality};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PickerViewProps } from '../picker-view';
|
|
3
|
+
import { Dayjs } from 'dayjs';
|
|
4
|
+
export type DatePickerValue = Dayjs | 'tillNow';
|
|
5
|
+
export interface DatePickerViewProps extends Omit<PickerViewProps, 'value' | 'onChange' | 'columns'> {
|
|
6
|
+
/**
|
|
7
|
+
* 是否展示至今选项
|
|
8
|
+
*/
|
|
9
|
+
tillNow?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 日期选择器最小时间 默认当前时间的前10年
|
|
12
|
+
*/
|
|
13
|
+
minDate?: Dayjs;
|
|
14
|
+
/**
|
|
15
|
+
* 日期选择器最大时间限制 默认当前时间
|
|
16
|
+
*/
|
|
17
|
+
maxDate?: Dayjs;
|
|
18
|
+
/**
|
|
19
|
+
* 受控value,dayjs日期格式
|
|
20
|
+
*/
|
|
21
|
+
value?: DatePickerValue;
|
|
22
|
+
/**
|
|
23
|
+
* 模式支持 date 展示选择到天, month 仅选择到月
|
|
24
|
+
*/
|
|
25
|
+
pickerMode?: 'date' | 'month';
|
|
26
|
+
/**
|
|
27
|
+
* 仅用状态
|
|
28
|
+
*/
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 时间选择器类名
|
|
32
|
+
*/
|
|
33
|
+
pickerViewClassName?: string;
|
|
34
|
+
/**
|
|
35
|
+
* change事件
|
|
36
|
+
*/
|
|
37
|
+
onChange?: (value: DatePickerValue) => void;
|
|
38
|
+
}
|
|
39
|
+
declare const DatePickerView: React.FC<DatePickerViewProps>;
|
|
40
|
+
export default DatePickerView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{objectWithoutProperties as a,slicedToArray as e,toConsumableArray as l,objectSpread2 as t}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as n}from"react/jsx-runtime";import o from"classnames";import i from"react";import r from"../picker-view/index.js";import{toAppDate as u,genYearColum as s,genMonthColum as d,genDayColum as c,dateFormat as v}from"./util.js";import m from"../../hooks/useRefState.js";var f=["minDate","maxDate","pickerMode","onChange","className","pickerViewClassName","cellRender","indicatorClass","tillNow","disabled","onClick"],p=u(new Date),h=function(a){return Math.max(a,0)},w=function(w){var N=w.minDate,y=w.maxDate,Y=void 0===y?p:y,M=w.pickerMode,x=void 0===M?"date":M,b=w.onChange;w.className;var D=w.pickerViewClassName;w.cellRender,w.indicatorClass;var k=w.tillNow,C=void 0!==k&&k,j=w.disabled;w.onClick;var g=a(w,f),I=m("date"===x?[0,0,0]:[0,0]),P=e(I,2),R=P[0],V=P[1],A=m({}),E=e(A,3),S=E[0],_=E[1],B=E[2],H=i.useMemo(function(){return"month"!==x},[x]);i.useEffect(function(){var a,e;if(!("value"in g)){var t=N||Y.subtract(10,"y"),n=C?["tillNow"].concat(l(null===(a=s(t,Y))||void 0===a?void 0:a.reverse())):null===(e=s(t,Y))||void 0===e?void 0:e.reverse();if("tillNow"===n[null==R?void 0:R[0]])_({years:n,months:[],days:[]});else{var o=d(n[R[0]],t,Y),i="date"===x?c(o[R[1]],t,Y):[];_({years:n,months:o,days:i})}}},[null==g?void 0:g.value,x,R,N,Y,C]),i.useEffect(function(){if("value"in g){var a,e,n,o,i,r,u,m=null==g?void 0:g.value;e=N||Y.subtract(10,"y"),n=null===(a=s(e,Y))||void 0===a?void 0:a.reverse(),o=C?["tillNow"].concat(l(n)):n,i=m&&"tillNow"!==m?m:n[0],r="tillNow"===m?[]:d(i,e,Y),u="date"===x&&"tillNow"!==m?c(i||r[0],e,Y):[],_({years:o,months:r,days:u}),function(){if("tillNow"!==(null==g?void 0:g.value)&&null!=g&&g.value){var a=B.current,e=a.years,l=a.months,n=a.days,o=v(m,"YYYY"),i=v(m,"M"),r=Math.max(null==e?void 0:e.findIndex(function(a){return v(a,"YYYY")===o}),0),u=null==l?void 0:l.findIndex(function(a){return"".concat(v(a,"M"))==="".concat(i)}),s=null==n?void 0:n.findIndex(function(a){return"".concat(v(a,"D"))==="".concat(v(m,"D"))}),d="date"===x?[Math.max(r||0,0),Math.max(u||0,0),Math.max(s||0,0)]:[Math.max(r||0,0),Math.max(u||0,0)];0===r&&"tillNow"===e[0]&&_(function(a){return t(t({},a),{},{months:[],days:[]})}),V(d)}else V("date"===x?[0,0,0]:[0,0])}()}else V("date"===x?[0,0,0]:[0,0])},[null==g?void 0:g.value,N,Y,x,C]);var T=i.useMemo(function(){var a,e,l,t=[null==S||null===(a=S.years)||void 0===a?void 0:a.map(function(a){return{label:"tillNow"===a?"至今":"".concat(v(a,"YYYY"),"年"),value:"tillNow"===a?"tillNow":v(a,"YYYY"),date:a}}),null==S||null===(e=S.months)||void 0===e?void 0:e.map(function(a){return{label:"".concat(v(a,"M"),"月"),value:v(a,"M"),date:a}})];H&&t.push(null==S||null===(l=S.days)||void 0===l?void 0:l.map(function(a){return{label:"".concat(v(a,"D"),"日"),value:v(a,"D"),date:a}}));return t},[H,S]);return n(r,t(t({onChange:function(a){if(!j){var e=a.detail.value;V(e);var l=B.current.years;if("tillNow"===(null==l?void 0:l[h(null==e?void 0:e[0])]))b&&b("tillNow");else{var t=B.current.days,n=d(null==l?void 0:l[h(e[0])],N||Y.subtract(10,"y"),Y),o=v(null==l?void 0:l[h(e[0])],"YYYY"),i=v(null==n?void 0:n[h(e[1])],"M"),r="month"===x?"1":v(null==t?void 0:t[h(e[2])],"D");b&&b(u("".concat(o,"-").concat(i,"-").concat(r)))}}},className:o("ypmini-datepicker-view",D),disabled:j},g),{},{columns:T,value:R}))};w.displayName="DatePickerView";export{w as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
export type AppDateType = dayjs.Dayjs;
|
|
3
|
+
export declare const dateFormat: (date: string | number | Date | AppDateType, format?: string) => string;
|
|
4
|
+
export declare const toAppDate: (date: string | number | Date | AppDateType) => dayjs.Dayjs;
|
|
5
|
+
export declare const genYearColum: (minDate?: AppDateType, maxDate?: AppDateType) => dayjs.Dayjs[];
|
|
6
|
+
export declare const genMonthColum: (current: AppDateType, min: AppDateType, max: AppDateType) => dayjs.Dayjs[];
|
|
7
|
+
export declare const genDayColum: (current: AppDateType, min: AppDateType, max: AppDateType) => dayjs.Dayjs[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"dayjs";var n=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"YYYY-MM-DD";return t(r).format(n)},t=function(n){return r(n)},a=function(n,a){var o=n||new Date("1870-01-01"),f=r(t(a||new Date).startOf("year")).diff(r(o).startOf("year"),"year"),u=new Array(f).fill(0).map(function(n,t){return r(o).add(t+1,"year")});return u.unshift(o),u},o=function(n,a,o){if((null==n?void 0:n.format("YYYY"))===(null==a?void 0:a.format("YYYY"))){if((null==o?void 0:o.format("YYYY"))===(null==a?void 0:a.format("YYYY"))){var f=r(o).diff(r(a),"month"),u=new Array(f).fill(0).map(function(n,t){return r(a).add(t,"month")});return u.push(r(o)),u}var i=12-+r(a).format("M"),l=new Array(i).fill(0).map(function(n,t){return r(a).add(t+1,"month")});return l.unshift(r(a)),l}if((null==n?void 0:n.format("YYYY"))===(null==o?void 0:o.format("YYYY"))){var Y,e=+(null==o?void 0:o.format("M"));return null===(Y=new Array(e).fill(0).map(function(n,t){return r(o).subtract(t,"month")}))||void 0===Y?void 0:Y.reverse()}return new Array(12).fill(0).map(function(r,a){return t("".concat(null==n?void 0:n.format("YYYY"),"-").concat(a+1,"-").concat(null==n?void 0:n.format("D")))})},f=function(n,a,o){if((null==n?void 0:n.format("YYYY-MM"))===(null==a?void 0:a.format("YYYY-MM"))){var f=r(a).endOf("M").diff(r(a),"day"),u=new Array(f).fill(0).map(function(n,t){return r(a).add(t+1,"day")});return u.unshift(r(a)),u}if((null==n?void 0:n.format("YYYY-MM"))===(null==o?void 0:o.format("YYYY-MM"))){var i,l=r(o).diff(r(n).startOf("M"),"day"),Y=null===(i=new Array(l).fill(0).map(function(n,t){return r(o).subtract(t+1,"day")}))||void 0===i?void 0:i.reverse();return Y.push(r(o)),Y}var e=null==n?void 0:n.daysInMonth();return new Array(e).fill(0).map(function(r,a){return t("".concat(null==n?void 0:n.format("YYYY"),"-").concat(null==n?void 0:n.format("MM"),"-").concat(a+1))})};export{n as dateFormat,f as genDayColum,o as genMonthColum,a as genYearColum,t as toAppDate};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DialogProps, ConfirmModalProps, AlertModalProps } from './type';
|
|
3
|
+
export type * from './type';
|
|
4
|
+
/**
|
|
5
|
+
* 弹窗实例,支持外部调用 close 方法关闭弹窗
|
|
6
|
+
*/
|
|
7
|
+
export interface DialogInstance {
|
|
8
|
+
/** 关闭弹窗 */
|
|
9
|
+
close: () => void;
|
|
10
|
+
/** 弹窗唯一标识 */
|
|
11
|
+
show: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Dialog 组件 ref 类型
|
|
15
|
+
*/
|
|
16
|
+
export interface DialogRef {
|
|
17
|
+
/** 显示弹窗 */
|
|
18
|
+
show: () => void;
|
|
19
|
+
/** 关闭弹窗 */
|
|
20
|
+
close: () => void;
|
|
21
|
+
}
|
|
22
|
+
interface DialogStaticMethods {
|
|
23
|
+
confirm: (option: ConfirmModalProps) => void;
|
|
24
|
+
alert: (option: AlertModalProps) => void;
|
|
25
|
+
createDialog: (options?: DialogProps) => {
|
|
26
|
+
DialogWrapper: () => React.JSX.Element;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
declare const InternalDialog: React.ForwardRefExoticComponent<Omit<DialogProps, "ref"> & React.RefAttributes<DialogRef>>;
|
|
30
|
+
declare const Dialog: typeof InternalDialog & DialogStaticMethods;
|
|
31
|
+
export default Dialog;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{objectWithoutProperties as n,slicedToArray as i,objectSpread2 as e,asyncToGenerator as o,regenerator as r}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as t,jsx as l}from"react/jsx-runtime";import a,{useState as c,useEffect as s}from"react";import u from"@tarojs/taro";import{View as f}from"@tarojs/components";import m from"classnames";import d from"../button/index.js";import p from"../icon/index.js";var v=["title","content","children","cancelText","confirmText","showCancel","mask","maskClosable","duration","className","style","onClose","onCancel","onConfirm","afterClose","onMaskClick","showClose","footer","footerLayout"],y="setDialogProps",h=a.createRef(),C=a.forwardRef(function(u,y){var h=u.title,C=u.content,g=u.children,b=u.cancelText,w=void 0===b?"取消":b,k=u.confirmText,N=void 0===k?"确定":k,T=u.showCancel,j=void 0===T||T,x=u.mask,P=void 0===x||x,D=u.maskClosable,E=void 0!==D&&D,H=u.duration,L=void 0===H?200:H,M=u.className,R=u.style,S=u.onClose,W=u.onCancel,_=u.onConfirm,z=u.afterClose,A=u.onMaskClick;u.showClose;var B=u.footer,G=u.footerLayout,I=void 0===G?"horizal":G,q=n(u,v),F=c(!1),J=i(F,2),K=J[0],O=J[1],Q=c(!1),U=i(Q,2),V=U[0],X=U[1];a.useImperativeHandle(y,function(){return{show:function(){return X(!0)},close:function(){X(!1),null==S||S()}}}),s(function(){if(V){X(!0);var n=setTimeout(function(){O(!0)},10);return function(){return clearTimeout(n)}}O(!1);var i=setTimeout(function(){X(!1),null==z||z()},L);return function(){return clearTimeout(i)}},[V,L,z]);var Y=function(){var n=o(r().m(function n(){return r().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,null==W?void 0:W();case 1:"visible"in q||X(!1),null==W||W();case 2:return n.a(2)}},n)}));return function(){return n.apply(this,arguments)}}(),Z=function(){var n=o(r().m(function n(){return r().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,null==_?void 0:_();case 1:"visible"in q||X(!1);case 2:return n.a(2)}},n)}));return function(){return n.apply(this,arguments)}}();return a.useEffect(function(){"visible"in q&&X(!!q.visible)},[q]),V?t(f,e(e({className:m("ypmini-dialog-wrapper",{"ypmini-dialog-wrapper-visible":K}),style:{"--ypmini-dialog-duration":"".concat(L,"ms")}},q),{},{children:[P&&l(f,{className:m("ypmini-dialog-mask",{"ypmini-dialog-mask-visible":K}),onClick:function(){E&&("visible"in q||X(!1)),null==A||A()}}),t(f,{className:m("ypmini-dialog",M,{"ypmini-dialog-visible":K}),style:R,onClick:function(n){n.stopPropagation()},children:[j?l(p,{className:"ypmini-dialog-close",name:"close",onClick:function(){"visible"in q||X(!1),null==S||S()}}):null,h&&l(f,{className:"ypmini-dialog-header",children:h}),l(f,{className:"ypmini-dialog-body",children:g||C}),B?B():t(f,{className:m("ypmini-dialog-footer",{"ypmini-dialog-footer-vertical":"vertical"===I}),children:[j&&l(f,{className:"ypmini-dialog-btn ypmini-dialog-btn-cancel",onClick:Y,children:l(d,{block:!0,className:"ypmini-dialog-footer-btn",styleType:"default",children:w})}),l(f,{className:"ypmini-dialog-btn ypmini-dialog-btn-confirm",onClick:Z,children:l(d,{block:!0,className:"ypmini-dialog-footer-btn",styleType:"primary",children:N})})]})]})]})):null});C.confirm=function(n){var i,t,l;u.eventCenter.trigger(y,e(e({},n),{},{onConfirm:(l=o(r().m(function i(){var e,o;return r().w(function(i){for(;;)switch(i.n){case 0:return i.n=1,null==n||null===(e=n.onConfirm)||void 0===e?void 0:e.call(n);case 1:null==h||null===(o=h.current)||void 0===o||o.close();case 2:return i.a(2)}},i)})),function(){return l.apply(this,arguments)}),onCancel:(t=o(r().m(function i(){var e,o;return r().w(function(i){for(;;)switch(i.n){case 0:return i.n=1,null==n||null===(e=n.onCancel)||void 0===e?void 0:e.call(n);case 1:null==h||null===(o=h.current)||void 0===o||o.close();case 2:return i.a(2)}},i)})),function(){return t.apply(this,arguments)})})),null==h||null===(i=h.current)||void 0===i||i.show()},C.alert=function(n){var i,t;u.eventCenter.trigger(y,e(e({},n),{},{showCancel:!1,onConfirm:(t=o(r().m(function i(){var e,o;return r().w(function(i){for(;;)switch(i.n){case 0:return i.n=1,null==n||null===(e=n.onConfirm)||void 0===e?void 0:e.call(n);case 1:null==h||null===(o=h.current)||void 0===o||o.close();case 2:return i.a(2)}},i)})),function(){return t.apply(this,arguments)})})),null==h||null===(i=h.current)||void 0===i||i.show()},C.createDialog=function(n){return{DialogWrapper:function(){var o=a.useState({}),r=i(o,2),t=r[0],c=r[1];return a.useEffect(function(){u.eventCenter.on(y,function(n){c(n)})},[]),l(C,e(e(e({},n),t),{},{ref:h}))}}};export{C as default};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
page {
|
|
3
|
+
--ypmini-dialog-background: #fff;
|
|
4
|
+
--ypmini-dialog-border-radius: calc(12px * var(--ypmini-hd));
|
|
5
|
+
--ypmini-dialog-mask-background: var(--ypmini-mask-background);
|
|
6
|
+
--ypmini-dialog-z-index: 1100;
|
|
7
|
+
--ypmini-dialog-duration: 200ms;
|
|
8
|
+
--ypmini-dialog-width: calc(300px * var(--ypmini-hd));
|
|
9
|
+
--ypmini-dialog-title-font-size: var(--ypmini-font-size-large);
|
|
10
|
+
--ypmini-dialog-title-color: rgba(0, 0, 0, 0.85);
|
|
11
|
+
--ypmini-dialog-content-font-size: var(--ypmini-font-size-default);
|
|
12
|
+
--ypmini-dialog-content-color: rgba(0, 0, 0, 0.65);
|
|
13
|
+
--ypmini-dialog-btn-font-size: var(--ypmini-font-size-default);
|
|
14
|
+
--ypmini-dialog-btn-cancel-color: rgba(0, 0, 0, 0.65);
|
|
15
|
+
--ypmini-dialog-btn-confirm-color: var(--ypmini-primary-color);
|
|
16
|
+
}
|
|
17
|
+
.ypmini-dialog-wrapper {
|
|
18
|
+
position: fixed;
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
right: 0;
|
|
22
|
+
bottom: 0;
|
|
23
|
+
z-index: var(--ypmini-dialog-z-index);
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
}
|
|
29
|
+
.ypmini-dialog-wrapper-visible {
|
|
30
|
+
pointer-events: auto;
|
|
31
|
+
}
|
|
32
|
+
.ypmini-dialog-mask {
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 0;
|
|
35
|
+
left: 0;
|
|
36
|
+
right: 0;
|
|
37
|
+
bottom: 0;
|
|
38
|
+
background: var(--ypmini-dialog-mask-background);
|
|
39
|
+
opacity: 0;
|
|
40
|
+
transition: opacity var(--ypmini-dialog-duration) ease;
|
|
41
|
+
}
|
|
42
|
+
.ypmini-dialog-mask-visible {
|
|
43
|
+
opacity: 1;
|
|
44
|
+
}
|
|
45
|
+
.ypmini-dialog {
|
|
46
|
+
padding: 48px 32px 32px 32px;
|
|
47
|
+
position: relative;
|
|
48
|
+
width: var(--ypmini-dialog-width);
|
|
49
|
+
background: var(--ypmini-dialog-background);
|
|
50
|
+
border-radius: var(--ypmini-dialog-border-radius);
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
opacity: 0;
|
|
53
|
+
transform: scale(0.9);
|
|
54
|
+
transition: opacity var(--ypmini-dialog-duration) ease, transform var(--ypmini-dialog-duration) ease;
|
|
55
|
+
}
|
|
56
|
+
.ypmini-dialog-visible {
|
|
57
|
+
opacity: 1;
|
|
58
|
+
transform: scale(1);
|
|
59
|
+
}
|
|
60
|
+
.ypmini-dialog-header {
|
|
61
|
+
text-align: center;
|
|
62
|
+
font-size: var(--ypmini-dialog-title-font-size);
|
|
63
|
+
font-weight: bold;
|
|
64
|
+
color: var(--ypmini-dialog-title-color);
|
|
65
|
+
line-height: 48px;
|
|
66
|
+
}
|
|
67
|
+
.ypmini-dialog-close {
|
|
68
|
+
font-size: 48px;
|
|
69
|
+
position: absolute;
|
|
70
|
+
right: 16px;
|
|
71
|
+
top: 16px;
|
|
72
|
+
color: rgba(0, 0, 0, 0.25);
|
|
73
|
+
}
|
|
74
|
+
.ypmini-dialog-body {
|
|
75
|
+
margin-top: 24px;
|
|
76
|
+
margin-bottom: 32px;
|
|
77
|
+
text-align: center;
|
|
78
|
+
font-size: var(--ypmini-dialog-content-font-size);
|
|
79
|
+
color: var(--ypmini-dialog-content-color);
|
|
80
|
+
line-height: 1.6;
|
|
81
|
+
word-break: break-word;
|
|
82
|
+
}
|
|
83
|
+
.ypmini-dialog-footer {
|
|
84
|
+
display: flex;
|
|
85
|
+
}
|
|
86
|
+
.ypmini-dialog-footer.ypmini-dialog-footer-vertical {
|
|
87
|
+
display: block;
|
|
88
|
+
}
|
|
89
|
+
.ypmini-dialog-footer.ypmini-dialog-footer-vertical .ypmini-dialog-btn:not(:first-child) {
|
|
90
|
+
margin-top: 24px;
|
|
91
|
+
margin-left: 0;
|
|
92
|
+
}
|
|
93
|
+
.ypmini-dialog-footer-btn {
|
|
94
|
+
height: 40px;
|
|
95
|
+
line-height: 40px;
|
|
96
|
+
}
|
|
97
|
+
.ypmini-dialog-btn {
|
|
98
|
+
flex: 1;
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
font-size: var(--ypmini-dialog-btn-font-size);
|
|
103
|
+
}
|
|
104
|
+
.ypmini-dialog-btn:not(:first-child) {
|
|
105
|
+
margin-left: 22px;
|
|
106
|
+
}
|
|
107
|
+
.ypmini-dialog-btn-cancel {
|
|
108
|
+
color: var(--ypmini-dialog-btn-cancel-color);
|
|
109
|
+
}
|
|
110
|
+
.ypmini-dialog-btn-confirm {
|
|
111
|
+
color: var(--ypmini-dialog-btn-confirm-color);
|
|
112
|
+
font-weight: bold;
|
|
113
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{objectWithoutProperties as
|
|
1
|
+
import{objectWithoutProperties as r,objectSpread2 as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as i}from"react/jsx-runtime";import m from"classnames";import o from"../../node_modules/@yup/taro-form/dist/index.js";var t=["children","required","className"],a=function(a){var s=a.children,l=a.required,n=a.className,u=r(a,t);return i(o.Item,e(e({className:m("ypmini-form-item",{"ypmini-form-item-required":l},n)},u),{},{children:s}))};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{objectWithoutProperties as r,objectSpread2 as o}from"../../_virtual/_rollupPluginBabelHelpers.js";import{
|
|
1
|
+
import{objectWithoutProperties as r,objectSpread2 as o}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as e}from"react/jsx-runtime";import t from"classnames";import i from"../../node_modules/@yup/taro-form/dist/index.js";import a from"./form-item.js";var m=["children","layout","className"],s=function(a){var s=a.children,l=a.layout,c=void 0===l?"vertical":l,n=a.className,u=r(a,m);return e(i,o(o({className:t("ypmini-form",{"ypmini-form-horizontal":"horizontal"===c,"ypmini-form-vertical":"vertical"===c},n)},u),{},{children:s}))};s.Item=a,s.useForm=i.useForm,s.useWatch=i.useWatch;export{s as default};
|
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
:root,
|
|
2
|
-
page {
|
|
3
|
-
--ypmini-hd: 2;
|
|
4
|
-
--yp-color-primary: #0092ff;
|
|
5
|
-
--yp-color-text: rgba(0, 0, 0, 0.85);
|
|
6
|
-
--yp-color-text-light: #0092ff;
|
|
7
|
-
--yp-color-text-weak: rgba(0, 0, 0, 0.45);
|
|
8
|
-
--yp-border-color: #e9edf3;
|
|
9
|
-
--yp-color-text-primary: #333;
|
|
10
|
-
--yp-color-text-link: var(--yp-color-primary);
|
|
11
|
-
--yp-color-text-secondary: #666;
|
|
12
|
-
--yp-color-text-disabled: #ccc;
|
|
13
|
-
--yp-color-text-placeholder: #999;
|
|
14
|
-
--yp-font-size-default: calc(17px * var(--ypmini-hd));
|
|
15
|
-
--yp-radio-circle-checked-color: var(--yp-color-primary);
|
|
16
|
-
--yp-radio-button-checked-color: var(--yp-color-primary);
|
|
17
|
-
--yp-checkbox-circle-checked-color: var(--yp-color-primary);
|
|
18
|
-
--yp-checkbox-button-checked-color: var(--yp-color-primary);
|
|
19
|
-
--yp-border-radius-base: calc(4px * var(--ypmini-hd));
|
|
20
|
-
--yp-border-radius-button: calc(8px * var(--ypmini-hd));
|
|
21
|
-
--yp-space-horizontal-base: calc(12px * var(--ypmini-hd));
|
|
22
|
-
}
|
|
23
|
-
:root,
|
|
24
2
|
page {
|
|
25
3
|
--form-item-label-width: calc(60px * var(--ypmini-hd));
|
|
26
4
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextProps } from '@tarojs/components';
|
|
3
|
+
export interface IconProps extends TextProps {
|
|
4
|
+
/**
|
|
5
|
+
* icon 名称 (上传到阿里云iconfont项目,上传icon命名格式必须是xxx_icon, xxx代表icon的名称也就是icon的name属性,比如:search_icon,delete_icon 注意icon上传时需要选择"去除颜色并提交"。使用的时候颜色通过color去设置)
|
|
6
|
+
* iconfont远端地址:https://www.iconfont.cn/manage/index?spm=a313x.manage_type_myprojects.i1.db775f1f3.5c9d3a81OoaadK&manage_type=myprojects&projectId=5088009
|
|
7
|
+
* seacch 搜索Icon delete删除Icon
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
declare const Icon: React.FC<IconProps>;
|
|
12
|
+
export default Icon;
|