@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 @@
|
|
|
1
|
+
import{objectWithoutProperties as o,objectSpread2 as a}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as r}from"react/jsx-runtime";import e from"classnames";import{Text as t}from"@tarojs/components";var s=["name","className"],m=function(m){var n=m.name,c=m.className,i=o(m,s);return r(t,a({className:e(c,"iconfont","icon-".concat(n,"_icon"))},i))};export{m as default};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "iconfont";
|
|
3
|
+
/* Project id 5088009 */
|
|
4
|
+
src: url('iconfont.woff2?t=1767782477263') format('woff2'), url('iconfont.woff?t=1767782477263') format('woff'), url('iconfont.ttf?t=1767782477263') format('truetype');
|
|
5
|
+
}
|
|
6
|
+
.iconfont {
|
|
7
|
+
font-family: "iconfont" !important;
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
font-style: normal;
|
|
10
|
+
-webkit-font-smoothing: antialiased;
|
|
11
|
+
-moz-osx-font-smoothing: grayscale;
|
|
12
|
+
}
|
|
13
|
+
.icon-checked_icon:before {
|
|
14
|
+
content: "\e61e";
|
|
15
|
+
}
|
|
16
|
+
.icon-refresh_icon:before {
|
|
17
|
+
content: "\e61f";
|
|
18
|
+
}
|
|
19
|
+
.icon-location_icon:before {
|
|
20
|
+
content: "\e620";
|
|
21
|
+
}
|
|
22
|
+
.icon-add_icon:before {
|
|
23
|
+
content: "\e61d";
|
|
24
|
+
}
|
|
25
|
+
.icon-telephone_icon:before {
|
|
26
|
+
content: "\e60f";
|
|
27
|
+
}
|
|
28
|
+
.icon-wechat_icon:before {
|
|
29
|
+
content: "\e610";
|
|
30
|
+
}
|
|
31
|
+
.icon-search_icon:before {
|
|
32
|
+
content: "\e611";
|
|
33
|
+
}
|
|
34
|
+
.icon-edit_icon:before {
|
|
35
|
+
content: "\e60e";
|
|
36
|
+
}
|
|
37
|
+
.icon-add-circle_icon:before {
|
|
38
|
+
content: "\e612";
|
|
39
|
+
}
|
|
40
|
+
.icon-checked-fill_icon:before {
|
|
41
|
+
content: "\e60d";
|
|
42
|
+
}
|
|
43
|
+
.icon-quote-fill_icon:before {
|
|
44
|
+
content: "\e613";
|
|
45
|
+
}
|
|
46
|
+
.icon-vedio_icon:before {
|
|
47
|
+
content: "\e614";
|
|
48
|
+
}
|
|
49
|
+
.icon-delete-fill_icon:before {
|
|
50
|
+
content: "\e615";
|
|
51
|
+
}
|
|
52
|
+
.icon-close_icon:before {
|
|
53
|
+
content: "\e616";
|
|
54
|
+
}
|
|
55
|
+
.icon-time_icon:before {
|
|
56
|
+
content: "\e617";
|
|
57
|
+
}
|
|
58
|
+
.icon-phone_icon:before {
|
|
59
|
+
content: "\e618";
|
|
60
|
+
}
|
|
61
|
+
.icon-arrow-right_icon:before {
|
|
62
|
+
content: "\e619";
|
|
63
|
+
}
|
|
64
|
+
.icon-attention_icon:before {
|
|
65
|
+
content: "\e61a";
|
|
66
|
+
}
|
|
67
|
+
.icon-comment_icon:before {
|
|
68
|
+
content: "\e61b";
|
|
69
|
+
}
|
|
70
|
+
.icon-camera_icon:before {
|
|
71
|
+
content: "\e61c";
|
|
72
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './iconfont.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './iconfont.css';
|
|
@@ -17,6 +17,18 @@ export interface InputProps extends TaroInputProps {
|
|
|
17
17
|
* 边框样式 outlined 边框 borderless 无边框样式
|
|
18
18
|
*/
|
|
19
19
|
variant?: 'outlined' | 'borderless';
|
|
20
|
+
/**
|
|
21
|
+
* change事件 返回输入值
|
|
22
|
+
*/
|
|
23
|
+
onChange?: (val: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* 输入框的值触发 注意点击删除Icon会触发onChange
|
|
26
|
+
*/
|
|
27
|
+
onDelete?: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* 自定义前缀Icon
|
|
30
|
+
*/
|
|
31
|
+
prefixIcon?: React.ReactNode;
|
|
20
32
|
}
|
|
21
33
|
declare const Input: React.FC<InputProps>;
|
|
22
34
|
export default Input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{objectWithoutProperties as e,slicedToArray as
|
|
1
|
+
import{objectWithoutProperties as e,slicedToArray as n,objectSpread2 as l}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as a,jsx as t,Fragment as o}from"react/jsx-runtime";import i from"react";import r from"classnames";import{View as u,Input as c,Text as s}from"@tarojs/components";import p from"../icon/index.js";var m=["variant","allowClear","showCount","clearIcon","className","style","onClick","onInput","maxlength","defaultValue","onChange","onDelete","prefixIcon"],d=function(d){var f=d.variant,h=void 0===f?"outlined":f,v=d.allowClear,y=void 0===v||v,x=d.showCount;d.clearIcon;var C=d.className,g=d.style,N=d.onClick,I=d.onInput,w=d.maxlength,j=d.defaultValue,b=d.onChange,k=d.onDelete,S=d.prefixIcon,D=e(d,m),P=i.useState(j||""),T=n(P,2),V=T[0],_=T[1],z=i.useRef(null);return i.useEffect(function(){"value"in D&&_(D.value||"")},[D]),a(u,{className:r("ypmini-taro-input-wrapper",{"ypmini-taro-input-borderless-wrapper":"borderless"===h},C),style:g,onClick:N,children:[S?t(u,{className:"ypmini-taro-input-prefix-icon-wrapper",children:S}):null,t(c,l({ref:z,placeholderStyle:"font-size: 17px;color: #00000040;",placeholderTextColor:"#00000040",value:V,onInput:function(e){_(e.detail.value),I&&I(e),b&&b(e.detail.value)},maxlength:w,className:"ypmini-taro-input"},D)),y&&null!=V&&V.length?t(u,{className:"ypmini-taro-input-clear",onClick:function(){_(""),k&&k(),b&&b("")},children:t(p,{className:"ypmini-taro-input-clear-icon",name:"delete-fill"})}):null,x?a(u,{className:"ypmini-taro-input-count",children:[t(s,{className:r("ypmini-taro-input-count-current",{"ypmini-taro-input-count-current-light":(null==V?void 0:V.length)>0}),children:null==V?void 0:V.length}),w?a(o,{children:["/",t(s,{className:"ypmini-taro-input-count-total",children:w||0})]}):null]}):null]})};export{d as default};
|
|
@@ -1,52 +1,46 @@
|
|
|
1
1
|
:root,
|
|
2
2
|
page {
|
|
3
|
-
--ypmini-
|
|
4
|
-
--
|
|
5
|
-
--
|
|
6
|
-
--
|
|
7
|
-
--
|
|
8
|
-
--
|
|
9
|
-
--
|
|
10
|
-
--
|
|
11
|
-
--
|
|
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
|
-
page {
|
|
25
|
-
--input-placeholder-color: rgba(0, 0, 0, 0.25);
|
|
26
|
-
--input-text-color: var(--yp-color-text);
|
|
27
|
-
--input-font-size: var(--yp-font-size-default);
|
|
3
|
+
--ypmini-input-placeholder-color: var(--ypmini-color-text-placeholder);
|
|
4
|
+
--ypmini-input-text-color: var(--ypmini-color-text);
|
|
5
|
+
--ypmini-input-font-size: var(--ypmini-font-size-default);
|
|
6
|
+
--ypmini-input-delete-cion-color: #00000040;
|
|
7
|
+
--ypmini-input-delete-cion-size: calc(var(--ypmini-hd) * 16px);
|
|
8
|
+
--ypmini-input-height: calc(48px * var(--ypmini-hd));
|
|
9
|
+
--ypmini-input-prefix-icon-size: calc(16px * var(--ypmini-hd));
|
|
10
|
+
--ypmini-input-border-color: var(--ypmini-border-color);
|
|
11
|
+
--ypmini-input-prefix-icon-color: #000000a6;
|
|
28
12
|
}
|
|
29
13
|
.ypmini-taro-input-wrapper {
|
|
30
14
|
display: flex;
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
align-items: center;
|
|
16
|
+
height: var(--ypmini-input-height);
|
|
17
|
+
font-size: var(--ypmini-input-font-size);
|
|
18
|
+
padding: 0px 24px;
|
|
33
19
|
border-radius: 16px;
|
|
34
|
-
border: 2px solid
|
|
20
|
+
border: 2px solid var(--ypmini-input-border-color);
|
|
35
21
|
box-sizing: border-box;
|
|
36
22
|
}
|
|
37
23
|
.ypmini-taro-input-borderless-wrapper {
|
|
38
24
|
border: unset;
|
|
39
25
|
}
|
|
40
26
|
.ypmini-taro-input {
|
|
41
|
-
color: var(--input-text-color);
|
|
27
|
+
color: var(--ypmini-input-text-color);
|
|
42
28
|
flex: 1;
|
|
43
29
|
border: none;
|
|
44
30
|
}
|
|
45
31
|
.ypmini-taro-input input::placeholder {
|
|
46
|
-
color: var(--input-placeholder-color);
|
|
32
|
+
color: var(--ypmini-input-placeholder-color);
|
|
47
33
|
}
|
|
48
34
|
.ypmini-input-placeholder {
|
|
49
|
-
color: var(--input-placeholder-color);
|
|
35
|
+
color: var(--ypmini-input-placeholder-color);
|
|
36
|
+
}
|
|
37
|
+
.ypmini-taro-input-clear {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
}
|
|
41
|
+
.ypmini-taro-input-clear-icon {
|
|
42
|
+
color: var(--ypmini-input-delete-cion-color);
|
|
43
|
+
font-size: var(--ypmini-input-delete-cion-size);
|
|
50
44
|
}
|
|
51
45
|
.ypmini-taro-input-count {
|
|
52
46
|
color: rgba(0, 0, 0, 0.45);
|
|
@@ -56,5 +50,12 @@ page {
|
|
|
56
50
|
margin-left: 8px;
|
|
57
51
|
}
|
|
58
52
|
.ypmini-taro-input-count .ypmini-taro-input-count-current-light {
|
|
59
|
-
color: var(--
|
|
53
|
+
color: var(--ypmini-color-text-light);
|
|
54
|
+
}
|
|
55
|
+
.ypmini-taro-input-prefix-icon-wrapper {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
font-size: var(--ypmini-input-prefix-icon-size);
|
|
59
|
+
margin-right: 16px;
|
|
60
|
+
color: var(--ypmini-input-prefix-icon-color);
|
|
60
61
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
page {
|
|
3
|
+
--search-input-backgroud: hsl(223, 54%, 97%);
|
|
4
|
+
--search-input-height: calc(var(--ypmini-hd) * 48px);
|
|
5
|
+
--search-input-font-size: calc(var(--ypmini-hd) * 15px);
|
|
6
|
+
}
|
|
7
|
+
.ypmini-search-input-wrapper {
|
|
8
|
+
padding: 0px 24px;
|
|
9
|
+
border-radius: 16px;
|
|
10
|
+
height: var(--search-input-height);
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
font-size: var(--search-input-font-size);
|
|
14
|
+
background: var(--search-input-backgroud);
|
|
15
|
+
}
|
|
16
|
+
.ypmini-search-input {
|
|
17
|
+
font-size: var(--input-font-size);
|
|
18
|
+
}
|
|
19
|
+
.ypmini-search-input-icon {
|
|
20
|
+
font-size: 32px;
|
|
21
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import TaroType from '@tarojs/taro/types';
|
|
3
|
+
type TaroImgFile = TaroType.chooseImage.SuccessCallbackResult['tempFiles'][0] | TaroType.chooseMedia.SuccessCallbackResult['tempFiles'][0];
|
|
4
|
+
type TaroImgFileList = TaroType.chooseImage.SuccessCallbackResult['tempFiles'] | TaroType.chooseMedia.SuccessCallbackResult['tempFiles'];
|
|
5
|
+
export type UploadStatus = 'uploading' | 'done' | 'error' | 'removed';
|
|
6
|
+
/***
|
|
7
|
+
* percent 进度 1-10
|
|
8
|
+
*/
|
|
9
|
+
export type FileType = UploadFile & {
|
|
10
|
+
percent?: number;
|
|
11
|
+
};
|
|
12
|
+
export type UploadFile = {
|
|
13
|
+
/**
|
|
14
|
+
* 文件唯一ID
|
|
15
|
+
*/
|
|
16
|
+
uid?: string | number;
|
|
17
|
+
/**
|
|
18
|
+
* 文件下载地址
|
|
19
|
+
*/
|
|
20
|
+
url: string;
|
|
21
|
+
/**
|
|
22
|
+
* 本地预览地址
|
|
23
|
+
*/
|
|
24
|
+
path?: string;
|
|
25
|
+
/**
|
|
26
|
+
* 文件名
|
|
27
|
+
*/
|
|
28
|
+
name?: string;
|
|
29
|
+
/**
|
|
30
|
+
* 上传状态
|
|
31
|
+
*/
|
|
32
|
+
status?: UploadStatus;
|
|
33
|
+
/**
|
|
34
|
+
* 文件类型 目前仅支持图片和视频
|
|
35
|
+
*/
|
|
36
|
+
type?: string;
|
|
37
|
+
};
|
|
38
|
+
export interface MediaUploaderProps {
|
|
39
|
+
/**
|
|
40
|
+
* 内置的上传组件类型 image 仅支持图片调用taro的chooseImage api,media 图片和视频都支持 调用taro的chooseMedia api
|
|
41
|
+
*/
|
|
42
|
+
chooseApiType?: 'image' | 'media';
|
|
43
|
+
/**
|
|
44
|
+
* 删除事件 返回false不会删除文件
|
|
45
|
+
*/
|
|
46
|
+
onRemove?: (file: FileType, fileList: FileType[]) => boolean | Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* 自定义上传请求
|
|
49
|
+
*/
|
|
50
|
+
uploadRequest?: (options: {
|
|
51
|
+
file: TaroImgFile;
|
|
52
|
+
fileList: TaroImgFileList;
|
|
53
|
+
onSuccess: (val: FileType) => void;
|
|
54
|
+
onError: () => void;
|
|
55
|
+
onProgress: (params: {
|
|
56
|
+
percent: number;
|
|
57
|
+
}) => void;
|
|
58
|
+
}) => void;
|
|
59
|
+
/**
|
|
60
|
+
* 自定义上传行为
|
|
61
|
+
*/
|
|
62
|
+
customUpload?: () => Promise<{
|
|
63
|
+
file: FileType;
|
|
64
|
+
fileList: FileType[];
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* 是否支持删除
|
|
68
|
+
*/
|
|
69
|
+
showDelete?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* 是否支持多文件上传
|
|
72
|
+
*/
|
|
73
|
+
multiple?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* 对外的change事件
|
|
76
|
+
*/
|
|
77
|
+
onChange?: (value: {
|
|
78
|
+
file: UploadFile;
|
|
79
|
+
fileList: UploadFile[];
|
|
80
|
+
}) => void;
|
|
81
|
+
/**
|
|
82
|
+
* 上传文件之前的钩子,返回false会停止上传
|
|
83
|
+
*/
|
|
84
|
+
beforeUpload?: (file: TaroImgFile, files: TaroImgFileList) => boolean | Promise<boolean>;
|
|
85
|
+
/**
|
|
86
|
+
* 图片选择option参数
|
|
87
|
+
*/
|
|
88
|
+
chooseImageOption?: TaroType.chooseImage.Option;
|
|
89
|
+
/**
|
|
90
|
+
* 获取媒体的option 参数
|
|
91
|
+
*/
|
|
92
|
+
chooseMediaOption?: TaroType.chooseMedia.Option;
|
|
93
|
+
/**
|
|
94
|
+
* 已上传文件(受控)
|
|
95
|
+
*/
|
|
96
|
+
value?: UploadFile[];
|
|
97
|
+
/**
|
|
98
|
+
* 默认值(已上传文件)
|
|
99
|
+
*/
|
|
100
|
+
defaultValue?: UploadFile[];
|
|
101
|
+
/**
|
|
102
|
+
* 是否禁止使用
|
|
103
|
+
*/
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* 自定义上传按钮样式
|
|
107
|
+
*/
|
|
108
|
+
children?: React.ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* 单选(multiple为false)时是否允许修改 默认不允许
|
|
111
|
+
*/
|
|
112
|
+
allowMofify?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* 定义多选时最多允许上传多少图片,超出会自动截断并隐藏上传按钮,0表示不做限制,默认0
|
|
115
|
+
*/
|
|
116
|
+
maxCount?: number;
|
|
117
|
+
/**
|
|
118
|
+
* 是否允许删除 默认 true 允许删除
|
|
119
|
+
*/
|
|
120
|
+
allowClear?: boolean;
|
|
121
|
+
}
|
|
122
|
+
declare const MediaUploader: React.FC<MediaUploaderProps>;
|
|
123
|
+
export default MediaUploader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{objectWithoutProperties as e,slicedToArray as n,asyncToGenerator as i,regenerator as r,objectSpread2 as a,regeneratorValues as l,toConsumableArray as o}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as t,jsx as u}from"react/jsx-runtime";import s from"react";import c from"classnames";import{chooseImage as d,chooseMedia as m}from"@tarojs/taro";import{View as p,Image as f}from"@tarojs/components";import{isPromise as v}from"../../utils/is.js";import y from"../icon/index.js";var h=["disabled","onChange","defaultValue","chooseApiType","beforeUpload","customUpload","uploadRequest","chooseMediaOption","chooseImageOption","children","maxCount","allowMofify","multiple","onRemove","allowClear"],g=function(g){var b,w,N,k=g.disabled,j=g.onChange,C=g.defaultValue,L=g.chooseApiType,P=void 0===L?"image":L,O=g.beforeUpload,F=g.customUpload,U=g.uploadRequest,T=g.chooseMediaOption,x=g.chooseImageOption,M=g.children,A=g.maxCount,R=void 0===A?0:A,S=g.allowMofify,E=g.multiple,I=void 0===E||E,V=g.onRemove,q=g.allowClear,D=void 0===q||q,_=e(g,h),B=s.useState(C||[]),G=n(B,2),H=G[0],W=G[1],z=function(){var e=i(r().m(function e(){var n,t,u;return r().w(function(e){for(;;)switch(e.n){case 0:if(!k){e.n=1;break}return e.a(2);case 1:if(!F){e.n=3;break}return e.n=2,F();case 2:return n=e.v,t=n.fileList,W(t),j&&j(n),e.a(2);case 3:u=function(){var e,n,t=function(e,n){if(!I){var i=a(a({},e),{},{status:n.status,percent:n.percent||10});return{file:i,fileList:[i]}}var r,l=null==H?void 0:H.findIndex(function(i){return i.uid===((null==n?void 0:n.originUid)||e.uid)});return l>=0?((r=H[l]).status=n.status,r.percent=n.percent||10,H[l]=r):(r=a(a({},e),{},{status:n.status,percent:n.percent||10}),H.push(r)),{file:r,fileList:o(H)}},u=function(e,n){var i=t(a({},e),{status:"done",originUid:n}),r=i.file,l=i.fileList;j&&j({file:r,fileList:l}),W(l)},s=function(e,n){var i=a(a({},e),{},{status:"error"}),r=t(i,{status:"error",originUid:n}),l=r.file,o=r.fileList;j&&j({file:l,fileList:o}),W(o)},c=function(e,n){var i=n.percent,r=t(e,{status:"uploading",percent:i}),a=r.file,l=r.fileList;j&&j({file:a,fileList:l}),W(l)};return"image"===P?a(a({},x||{}),{},{count:I&&(null==x?void 0:x.count)||1,success:(e=i(r().m(function e(n){var i,o,t,d,m,p;return r().w(function(e){for(;;)switch(e.n){case 0:i=n.tempFiles,o=i,R&&(t=R-H.length,o=i.slice(0,t)),d=r().m(function e(){var n,i;return r().w(function(e){for(;;)switch(e.n){case 0:return n=o[p],e.n=1,J(n,o);case 1:if(e.v){e.n=2;break}return e.a(2,{v:void 0});case 2:return i="".concat(p).concat((new Date).valueOf()),e.n=3,null==U?void 0:U({file:n,fileList:o,onSuccess:function(e){u(a({type:n.type},e),i)},onError:function(){var e;return s({url:n.path,name:null===(e=n.originalFileObj)||void 0===e?void 0:e.name,uid:i,type:n.type},i)},onProgress:function(e){var r;return c({url:n.path,name:null===(r=n.originalFileObj)||void 0===r?void 0:r.name,uid:i,type:n.type},e)}});case 3:return e.a(2)}},e)}),p=0;case 1:if(!(p<o.length)){e.n=4;break}return e.d(l(d()),2);case 2:if(!(m=e.v)){e.n=3;break}return e.a(2,m.v);case 3:p++,e.n=1;break;case 4:return e.a(2)}},e)})),function(n){return e.apply(this,arguments)})}):a(a({},T||{}),{},{count:I&&(null==x?void 0:x.count)||1,success:(n=i(r().m(function e(n){var i,o,t,d,m,p;return r().w(function(e){for(;;)switch(e.n){case 0:i=n.tempFiles,o=i,R&&(t=R-H.length,o=i.slice(0,t)),d=r().m(function e(){var n,i;return r().w(function(e){for(;;)switch(e.n){case 0:return n=o[p],e.n=1,J(n,o);case 1:if(e.v){e.n=2;break}return e.a(2,{v:void 0});case 2:return i="".concat(p).concat((new Date).valueOf()),e.n=3,null==U?void 0:U({file:n,fileList:o,onSuccess:function(e){u(a({type:n.fileType},e),i)},onError:function(){var e;return s({url:n.tempFilePath,name:null===(e=n.originalFileObj)||void 0===e?void 0:e.name,uid:i,type:n.fileType},i)},onProgress:function(e){var r;return c({url:n.tempFilePath,name:null==n||null===(r=n.originalFileObj)||void 0===r?void 0:r.name,uid:i,type:n.fileType},e)}});case 3:return e.a(2)}},e)}),p=0;case 1:if(!(p<o.length)){e.n=4;break}return e.d(l(d()),2);case 2:if(!(m=e.v)){e.n=3;break}return e.a(2,m.v);case 3:p++,e.n=1;break;case 4:return e.a(2)}},e)})),function(e){return n.apply(this,arguments)})})},("image"===P?d:m)(u());case 4:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),J=function(e,n){if(!O)return Promise.resolve(!0);var i=null==O?void 0:O(e,n);return v(i)?i:Promise.resolve(i)},K=function(e){if(!V)return Promise.resolve(!0);var n=null==V?void 0:V(e,H);return v(n)?n:Promise.resolve(n)},Q=function(){var e=i(r().m(function e(n){var i,l;return r().w(function(e){for(;;)switch(e.n){case 0:if(!V){e.n=2;break}return e.n=1,K(n);case 1:if(e.v){e.n=2;break}return e.a(2);case 2:i=null==H?void 0:H.find(function(e){return e.uid===n.uid}),l=null==H?void 0:H.filter(function(e){return e.uid!==n.uid}),W(l),j&&j({file:a(a({},i),{},{status:"removed"}),fileList:l});case 3:return e.a(2)}},e)}));return function(n){return e.apply(this,arguments)}}();return s.useEffect(function(){"value"in _&&W(_.value)},[_]),I?t(p,{className:"ypmini-media-uploader-list",children:[null==H?void 0:H.map(function(e){return t(p,{className:"ypmini-media-uploader-cell",children:[D&&!k?u(p,{className:"ypmini-media-uploader-cell-delete",onClick:function(n){n.stopPropagation(),Q(e)},children:u(y,{className:"ypmini-media-uploader-cell-delete-icon",name:"close"})}):null,"uploading"===(null==e?void 0:e.status)&&((null==e?void 0:e.percent)||0)<10?u(p,{className:"ypmini-media-uploader-process-mask",children:u(p,{className:"ypmini-media-uploader-process-bar",children:u(p,{className:"ypmini-media-uploader-process-bar-inner",style:{width:"".concat(10*((null==e?void 0:e.percent)||0),"%")}})})}):null,u(f,{className:"ypmini-media-uploader-image-view",src:e.url})]},e.uid)}),R&&(null==H?void 0:H.length)>=R?null:u(p,{className:"ypmini-media-uploader-cell ypmini-media-uploader-button",onClick:function(){return z()},children:M||u(y,{className:"ypmini-media-uploader-icon",name:"add"})})]}):null!=H&&H[0]?t(p,{className:c("ypmini-media-uploader-cell",{"ypmini-media-uploader-cell-single":!I}),onClick:function(e){S&&z()},children:[D&&!k?u(p,{className:"ypmini-media-uploader-cell-delete",onClick:function(e){e.stopPropagation(),Q(null==H?void 0:H[0])},children:u(y,{className:"ypmini-media-uploader-cell-delete-icon",name:"close"})}):null,"uploading"===(null==H||null===(b=H[0])||void 0===b?void 0:b.status)&&((null==H||null===(w=H[0])||void 0===w?void 0:w.percent)||0)<10?u(p,{className:"ypmini-media-uploader-process-mask",children:u(p,{className:"ypmini-media-uploader-process-bar",children:u(p,{className:"ypmini-media-uploader-process-bar-inner",style:{width:"".concat(10*((null==H||null===(N=H[0])||void 0===N?void 0:N.percent)||0),"%")}})})}):null,u(f,{className:"ypmini-media-uploader-image-view",src:null==H?void 0:H[0].url})]}):u(p,{className:c("ypmini-media-uploader-cell","ypmini-media-uploader-button",{"ypmini-media-uploader-button-single":!I}),onClick:function(){return z()},children:M||u(y,{className:"ypmini-media-uploader-icon",name:"add"})})};g.displayName="MediaUploader";export{g as default};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
pgae {
|
|
3
|
+
--ypmini-media-uploader-button-width: calc(106px * var(--ypmini-hd));
|
|
4
|
+
--ypmini-media-uploader-button-height: calc(106px * var(--ypmini-hd));
|
|
5
|
+
--ypmini-media-uploader-button-border-radius: calc(8px * var(--ypmini-hd));
|
|
6
|
+
--ypmini-media-uploader-button-border-color: #e9edf3;
|
|
7
|
+
--ypmini-media-uploader-horizal-sapce: calc(12px * var(--ypmini-hd));
|
|
8
|
+
--ypmini-media-uploader-vertical-sapce: calc(12px * var(--ypmini-hd));
|
|
9
|
+
}
|
|
10
|
+
.ypmini-media-uploader-list {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-wrap: wrap;
|
|
13
|
+
margin-top: calc(-1 * var(--ypmini-media-uploader-vertical-sapce));
|
|
14
|
+
margin-left: calc(-1 * var(--ypmini-media-uploader-horizal-sapce));
|
|
15
|
+
}
|
|
16
|
+
.ypmini-media-uploader-cell {
|
|
17
|
+
width: var(--ypmini-media-uploader-button-width);
|
|
18
|
+
height: var(--ypmini-media-uploader-button-height);
|
|
19
|
+
border-radius: var(--ypmini-media-uploader-button-border-radius);
|
|
20
|
+
border: 2px dashed var(--ypmini-media-uploader-button-border-color);
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
margin-top: var(--ypmini-media-uploader-vertical-sapce);
|
|
23
|
+
margin-left: var(--ypmini-media-uploader-horizal-sapce);
|
|
24
|
+
border: unset;
|
|
25
|
+
position: relative;
|
|
26
|
+
}
|
|
27
|
+
.ypmini-media-uploader-cell.ypmini-media-uploader-cell-single {
|
|
28
|
+
margin-top: 0;
|
|
29
|
+
margin-left: 0;
|
|
30
|
+
}
|
|
31
|
+
.ypmini-media-uploader-cell-delete {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
position: absolute;
|
|
36
|
+
right: 0;
|
|
37
|
+
top: 0;
|
|
38
|
+
z-index: 10;
|
|
39
|
+
height: 48px;
|
|
40
|
+
width: 48px;
|
|
41
|
+
border-radius: 0px 16px 0px 16px;
|
|
42
|
+
background: rgba(0, 0, 0, 0.65);
|
|
43
|
+
}
|
|
44
|
+
.ypmini-media-uploader-cell-delete .ypmini-media-uploader-cell-delete-icon {
|
|
45
|
+
font-size: 32px;
|
|
46
|
+
color: #fff;
|
|
47
|
+
}
|
|
48
|
+
.ypmini-media-uploader-image-view {
|
|
49
|
+
height: 100%;
|
|
50
|
+
width: 100%;
|
|
51
|
+
object-fit: contain;
|
|
52
|
+
}
|
|
53
|
+
.ypmini-media-uploader-process-mask {
|
|
54
|
+
position: absolute;
|
|
55
|
+
left: 0;
|
|
56
|
+
right: 0;
|
|
57
|
+
bottom: 0;
|
|
58
|
+
top: 0;
|
|
59
|
+
background: rgba(0, 0, 0, 0.65);
|
|
60
|
+
z-index: 20;
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
}
|
|
65
|
+
.ypmini-media-uploader-process-bar {
|
|
66
|
+
width: calc(100% - (34px * var(--ypmini-hd)));
|
|
67
|
+
height: 12px;
|
|
68
|
+
border-radius: 6px;
|
|
69
|
+
background: rgba(255, 255, 255, 0.45);
|
|
70
|
+
}
|
|
71
|
+
.ypmini-media-uploader-process-bar-inner {
|
|
72
|
+
height: 100%;
|
|
73
|
+
width: 30%;
|
|
74
|
+
border-radius: 6px;
|
|
75
|
+
background: #ffffff;
|
|
76
|
+
}
|
|
77
|
+
.ypmini-media-uploader-button {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
width: var(--ypmini-media-uploader-button-width);
|
|
82
|
+
height: var(--ypmini-media-uploader-button-height);
|
|
83
|
+
border-radius: var(--ypmini-media-uploader-button-border-radius);
|
|
84
|
+
border: 2px dashed var(--ypmini-media-uploader-button-border-color);
|
|
85
|
+
}
|
|
86
|
+
.ypmini-media-uploader-button.ypmini-media-uploader-button-single {
|
|
87
|
+
margin-top: 0;
|
|
88
|
+
margin-left: 0;
|
|
89
|
+
}
|
|
90
|
+
.ypmini-media-uploader-button .ypmini-media-uploader-icon {
|
|
91
|
+
font-size: 66px;
|
|
92
|
+
color: #e9edf3;
|
|
93
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PickerViewProps as TaroPickerViewProps } from '@tarojs/components';
|
|
3
|
+
export interface ColumnType {
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PickerViewProps extends Omit<TaroPickerViewProps, 'children'> {
|
|
8
|
+
/**
|
|
9
|
+
* picker-view列配置数据
|
|
10
|
+
*/
|
|
11
|
+
columns: ColumnType[][];
|
|
12
|
+
/**
|
|
13
|
+
* 是否禁用
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 自定义选项格式化
|
|
18
|
+
*/
|
|
19
|
+
cellRender?: (item: ColumnType, option: {
|
|
20
|
+
colIndex: number;
|
|
21
|
+
originNode: React.ReactNode;
|
|
22
|
+
}) => React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
declare const PickerView: React.FC<PickerViewProps>;
|
|
25
|
+
export default PickerView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{objectWithoutProperties as i,objectSpread2 as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as r,jsx as a}from"react/jsx-runtime";import l from"classnames";import{View as n,PickerView as c,PickerViewColumn as s}from"@tarojs/components";var o=["columns","className","indicatorClass","cellRender","disabled"],m=function(m){var t=m.columns,p=m.className,u=m.indicatorClass,d=m.cellRender,v=m.disabled,f=i(m,o);return r(n,{className:l("ypmini-picker-view-wrapper",p),children:[v?a(n,{className:"ypmini-picker-view-mask"}):null,a(c,e(e({className:l("ypmini-picker-view"),indicatorClass:l("ypmini-picker-view-indicator",u)},f),{},{children:null==t?void 0:t.map(function(i,e){return a(s,{className:"ypmini-picker-view-column",children:null==i?void 0:i.map(function(i){return function(i,e){var r=a(n,{className:"ypmini-picker-view-column-item",children:i.label},i.value);return d?d(i,{colIndex:e,originNode:r}):r}(i,e)})},e)})}))]})};export{m as default};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
page {
|
|
3
|
+
--ypmini-picker-view-column-font-size: var(--ypmini-font-size-large);
|
|
4
|
+
--ypmini-picker-view-column-font-color: #00000040;
|
|
5
|
+
--ypmini-picker-view-column-active-fot-color: ##000000a6;
|
|
6
|
+
--ypmini-picker-view-column-active-font-size: var(--ypmini-font-size-max);
|
|
7
|
+
--ypmini-picker-view-column-height: calc(var(--ypmini-hd) * 52px);
|
|
8
|
+
--ypmini-picker-view-indicator-background-color: #f5f7fc;
|
|
9
|
+
--ypmini-picker-view-indicator-border-radius: calc(var(--ypmini-hd) * 8px);
|
|
10
|
+
--ypmini-picker-view-disabled-mask-index: 100;
|
|
11
|
+
--ypmini-picker-view-disabled-mask-background-color: rgba(255, 255, 255, 0.6);
|
|
12
|
+
}
|
|
13
|
+
.ypmini-picker-view-wrapper {
|
|
14
|
+
position: relative;
|
|
15
|
+
height: 100%;
|
|
16
|
+
}
|
|
17
|
+
.ypmini-picker-view {
|
|
18
|
+
height: 100%;
|
|
19
|
+
}
|
|
20
|
+
.ypmini-picker-view-column {
|
|
21
|
+
z-index: 20;
|
|
22
|
+
}
|
|
23
|
+
.ypmini-picker-view-column .ypmini-picker-view-indicator {
|
|
24
|
+
background: var(--ypmini-picker-view-indicator-background-color);
|
|
25
|
+
z-index: 0;
|
|
26
|
+
}
|
|
27
|
+
.ypmini-picker-view-column::first-child .ypmini-picker-view-indicator {
|
|
28
|
+
border-top-left-radius: var(--ypmini-picker-view-indicator-border-radius);
|
|
29
|
+
border-bottom-left-radius: var(--ypmini-picker-view-indicator-border-radius);
|
|
30
|
+
}
|
|
31
|
+
.ypmini-picker-view-column::last-child .ypmini-picker-view-indicator {
|
|
32
|
+
border-top-right-radius: var(--ypmini-picker-view-indicator-border-radius);
|
|
33
|
+
border-bottom-right-radius: var(--ypmini-picker-view-indicator-border-radius);
|
|
34
|
+
}
|
|
35
|
+
.ypmini-picker-view-column-item {
|
|
36
|
+
height: var(--ypmini-picker-view-column-height);
|
|
37
|
+
line-height: var(--ypmini-picker-view-column-height);
|
|
38
|
+
font-size: var(--ypmini-picker-view-column-font-size);
|
|
39
|
+
}
|
|
40
|
+
.ypmini-picker-view-indicator {
|
|
41
|
+
height: var(--ypmini-picker-view-column-height);
|
|
42
|
+
background: var(--ypmini-picker-view-indicator-background-color);
|
|
43
|
+
z-index: 0;
|
|
44
|
+
border-radius: 16px;
|
|
45
|
+
border-bottom: unset;
|
|
46
|
+
border-top: unset;
|
|
47
|
+
}
|
|
48
|
+
.ypmini-picker-view-indicator::before {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
.ypmini-picker-view-indicator::after {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
.ypmini-picker-view-mask {
|
|
55
|
+
position: absolute;
|
|
56
|
+
left: 0;
|
|
57
|
+
right: 0;
|
|
58
|
+
bottom: 0;
|
|
59
|
+
top: 0;
|
|
60
|
+
z-index: var(--ypmini-picker-view-disabled-mask-index);
|
|
61
|
+
background-color: var(--ypmini-picker-view-disabled-mask-background-color);
|
|
62
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps } from '@tarojs/components';
|
|
3
|
+
export interface PopupProps extends Omit<ViewProps, 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* 是否显示弹出层
|
|
6
|
+
*/
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 弹出层内容
|
|
10
|
+
*/
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* 是否显示遮罩层
|
|
14
|
+
*/
|
|
15
|
+
mask?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 点击遮罩层是否关闭
|
|
18
|
+
*/
|
|
19
|
+
maskClosable?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 弹出层圆角
|
|
22
|
+
*/
|
|
23
|
+
round?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 动画时长,单位毫秒
|
|
26
|
+
*/
|
|
27
|
+
duration?: number;
|
|
28
|
+
/**
|
|
29
|
+
* 关闭时触发
|
|
30
|
+
*/
|
|
31
|
+
onClose?: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* 动画结束后触发
|
|
34
|
+
*/
|
|
35
|
+
afterClose?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* 点击取消触发
|
|
38
|
+
*/
|
|
39
|
+
onCancel?: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* 点击确认后触发
|
|
42
|
+
*/
|
|
43
|
+
onConfirm?: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* 标题
|
|
46
|
+
*/
|
|
47
|
+
title?: React.ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* 取消按钮文字
|
|
50
|
+
*/
|
|
51
|
+
cancelText?: React.ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* 确认按钮文字
|
|
54
|
+
*/
|
|
55
|
+
confirmText?: React.ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* 自定义头
|
|
58
|
+
*/
|
|
59
|
+
customHeader?: React.ReactNode;
|
|
60
|
+
}
|
|
61
|
+
declare const Popup: React.FC<PopupProps>;
|
|
62
|
+
export default Popup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{objectWithoutProperties as i,slicedToArray as e,objectSpread2 as o}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as n,jsx as r}from"react/jsx-runtime";import{useState as a,useEffect as l}from"react";import p from"classnames";import{View as t}from"@tarojs/components";var s=["visible","children","className","mask","maskClosable","round","duration","onClose","afterClose","onCancel","onConfirm","cancelText","confirmText","title","style","customHeader"],c=function(c){var m=c.visible,u=void 0!==m&&m,d=c.children,f=c.className,v=c.mask,y=void 0===v||v,C=c.maskClosable,h=void 0===C||C,b=c.round,k=void 0===b||b,N=c.duration,T=void 0===N?300:N,x=c.onClose,j=c.afterClose,H=c.onCancel,P=c.onConfirm,g=c.cancelText,w=void 0===g?"取消":g,_=c.confirmText,A=void 0===_?"确定":_,B=c.title,S=c.style,W=c.customHeader,q=i(c,s),z=a(!1),D=e(z,2),E=D[0],F=D[1],G=a(!1),I=e(G,2),J=I[0],K=I[1];l(function(){if(u){K(!0);var i=setTimeout(function(){F(!0)},10);return function(){return clearTimeout(i)}}F(!1);var e=setTimeout(function(){K(!1),null==j||j()},T);return function(){return clearTimeout(e)}},[u,T,j]);return J?n(t,o(o({className:p("ypmini-popup-wrapper",{"ypmini-popup-wrapper-visible":E}),style:{"--ypmini-popup-duration":"".concat(T,"ms")}},q),{},{children:[y&&r(t,{className:p("ypmini-popup-mask",{"ypmini-popup-mask-visible":E}),onClick:function(){h&&(null==x||x())}}),n(t,{className:p("ypmini-popup",f,{"ypmini-popup-visible":E,"ypmini-popup-round":k}),style:S,onClick:function(i){i.stopPropagation()},children:[W||n(t,{className:"ypmini-popup-header",children:[r(t,{className:"ypmini-popup-header-cancel",onClick:function(){null==H||H()},children:w}),r(t,{className:"ypmini-popup-header-title",children:B}),r(t,{className:"ypmini-popup-header-confirm",onClick:function(){null==P||P()},children:A})]}),d]})]})):null};export{c as default};
|