taro-ui 3.3.3 → 3.4.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/LICENSE +1 -1
- package/README.md +85 -0
- package/dist/common/utils.d.ts +2 -1
- package/dist/common/utils.js +3 -0
- package/dist/common/utils.js.map +1 -1
- package/dist/components/accordion/index.d.ts +16 -13
- package/dist/components/accordion/index.js +77 -97
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/action-sheet/body/index.d.ts +2 -4
- package/dist/components/action-sheet/body/index.js +8 -6
- package/dist/components/action-sheet/body/index.js.map +1 -1
- package/dist/components/action-sheet/body/item/index.d.ts +7 -7
- package/dist/components/action-sheet/body/item/index.js +14 -14
- package/dist/components/action-sheet/body/item/index.js.map +1 -1
- package/dist/components/action-sheet/footer/index.d.ts +7 -7
- package/dist/components/action-sheet/footer/index.js +14 -17
- package/dist/components/action-sheet/footer/index.js.map +1 -1
- package/dist/components/action-sheet/header/index.d.ts +2 -4
- package/dist/components/action-sheet/header/index.js +8 -9
- package/dist/components/action-sheet/header/index.js.map +1 -1
- package/dist/components/action-sheet/index.d.ts +12 -13
- package/dist/components/action-sheet/index.js +53 -57
- package/dist/components/action-sheet/index.js.map +1 -1
- package/dist/components/activity-indicator/index.d.ts +12 -6
- package/dist/components/activity-indicator/index.js +19 -22
- package/dist/components/activity-indicator/index.js.map +1 -1
- package/dist/components/avatar/index.d.ts +14 -8
- package/dist/components/avatar/index.js +36 -43
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +11 -8
- package/dist/components/badge/index.js +18 -34
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/button/index.d.ts +29 -14
- package/dist/components/button/index.js +97 -112
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/calendar/body/index.d.ts +3 -26
- package/dist/components/calendar/body/index.js +215 -235
- package/dist/components/calendar/body/index.js.map +1 -1
- package/dist/components/calendar/controller/index.d.ts +3 -5
- package/dist/components/calendar/controller/index.js +47 -43
- package/dist/components/calendar/controller/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +3 -20
- package/dist/components/calendar/index.js +219 -201
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/calendar/ui/date-list/index.d.ts +2 -6
- package/dist/components/calendar/ui/date-list/index.js +36 -41
- package/dist/components/calendar/ui/date-list/index.js.map +1 -1
- package/dist/components/calendar/ui/day-list/index.d.ts +2 -4
- package/dist/components/calendar/ui/day-list/index.js +6 -5
- package/dist/components/calendar/ui/day-list/index.js.map +1 -1
- package/dist/components/card/index.d.ts +15 -7
- package/dist/components/card/index.js +42 -43
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +11 -7
- package/dist/components/checkbox/index.js +30 -35
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/config-provider/context.d.ts +6 -0
- package/dist/components/config-provider/context.js +13 -0
- package/dist/components/config-provider/context.js.map +1 -0
- package/dist/components/config-provider/index.d.ts +7 -0
- package/dist/components/config-provider/index.js +15 -0
- package/dist/components/config-provider/index.js.map +1 -0
- package/dist/components/countdown/index.d.ts +19 -19
- package/dist/components/countdown/index.js +183 -118
- package/dist/components/countdown/index.js.map +1 -1
- package/dist/components/countdown/item/index.d.ts +8 -7
- package/dist/components/countdown/item/index.js +10 -13
- package/dist/components/countdown/item/index.js.map +1 -1
- package/dist/components/curtain/index.d.ts +11 -8
- package/dist/components/curtain/index.js +36 -45
- package/dist/components/curtain/index.js.map +1 -1
- package/dist/components/divider/index.d.ts +13 -6
- package/dist/components/divider/index.js +29 -38
- package/dist/components/divider/index.js.map +1 -1
- package/dist/components/drawer/index.d.ts +13 -15
- package/dist/components/drawer/index.js +100 -93
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/fab/index.d.ts +8 -7
- package/dist/components/fab/index.js +16 -16
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/flex/index.d.ts +11 -5
- package/dist/components/flex/index.js +17 -18
- package/dist/components/flex/index.js.map +1 -1
- package/dist/components/flex/item/index.d.ts +11 -5
- package/dist/components/flex/item/index.js +17 -18
- package/dist/components/flex/item/index.js.map +1 -1
- package/dist/components/float-layout/index.d.ts +20 -12
- package/dist/components/float-layout/index.js +56 -72
- package/dist/components/float-layout/index.js.map +1 -1
- package/dist/components/form/index.d.ts +11 -8
- package/dist/components/form/index.js +28 -28
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/grid/index.d.ts +22 -7
- package/dist/components/grid/index.js +61 -66
- package/dist/components/grid/index.js.map +1 -1
- package/dist/components/icon/index.d.ts +13 -7
- package/dist/components/icon/index.js +24 -34
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/image-picker/index.d.ts +19 -9
- package/dist/components/image-picker/index.js +83 -102
- package/dist/components/image-picker/index.js.map +1 -1
- package/dist/components/indexes/index.d.ts +16 -28
- package/dist/components/indexes/index.js +198 -209
- package/dist/components/indexes/index.js.map +1 -1
- package/dist/components/input/index.d.ts +37 -15
- package/dist/components/input/index.js +152 -161
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input-number/index.d.ts +20 -11
- package/dist/components/input-number/index.js +107 -126
- package/dist/components/input-number/index.js.map +1 -1
- package/dist/components/list/index.d.ts +7 -6
- package/dist/components/list/index.js +15 -15
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list/item/index.d.ts +27 -9
- package/dist/components/list/item/index.js +89 -117
- package/dist/components/list/item/index.js.map +1 -1
- package/dist/components/load-more/index.d.ts +15 -7
- package/dist/components/load-more/index.js +29 -50
- package/dist/components/load-more/index.js.map +1 -1
- package/dist/components/loading/index.d.ts +8 -7
- package/dist/components/loading/index.js +14 -20
- package/dist/components/loading/index.js.map +1 -1
- package/dist/components/message/index.d.ts +9 -14
- package/dist/components/message/index.js +45 -59
- package/dist/components/message/index.js.map +1 -1
- package/dist/components/modal/action/index.d.ts +7 -6
- package/dist/components/modal/action/index.js +15 -15
- package/dist/components/modal/action/index.js.map +1 -1
- package/dist/components/modal/content/index.d.ts +2 -4
- package/dist/components/modal/content/index.js +8 -6
- package/dist/components/modal/content/index.js.map +1 -1
- package/dist/components/modal/header/index.d.ts +2 -4
- package/dist/components/modal/header/index.js +8 -6
- package/dist/components/modal/header/index.js.map +1 -1
- package/dist/components/modal/index.d.ts +16 -14
- package/dist/components/modal/index.js +63 -77
- package/dist/components/modal/index.js.map +1 -1
- package/dist/components/nav-bar/index.d.ts +20 -10
- package/dist/components/nav-bar/index.js +146 -162
- package/dist/components/nav-bar/index.js.map +1 -1
- package/dist/components/noticebar/index.d.ts +17 -15
- package/dist/components/noticebar/index.js +115 -128
- package/dist/components/noticebar/index.js.map +1 -1
- package/dist/components/pagination/index.d.ts +13 -11
- package/dist/components/pagination/index.js +64 -120
- package/dist/components/pagination/index.js.map +1 -1
- package/dist/components/progress/index.d.ts +11 -5
- package/dist/components/progress/index.js +39 -36
- package/dist/components/progress/index.js.map +1 -1
- package/dist/components/radio/index.d.ts +11 -7
- package/dist/components/radio/index.js +29 -33
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/range/index.d.ts +19 -21
- package/dist/components/range/index.js +146 -153
- package/dist/components/range/index.js.map +1 -1
- package/dist/components/rate/index.d.ts +13 -7
- package/dist/components/rate/index.js +47 -62
- package/dist/components/rate/index.js.map +1 -1
- package/dist/components/search-bar/index.d.ts +23 -15
- package/dist/components/search-bar/index.js +120 -146
- package/dist/components/search-bar/index.js.map +1 -1
- package/dist/components/segmented-control/index.d.ts +14 -7
- package/dist/components/segmented-control/index.js +52 -66
- package/dist/components/segmented-control/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +21 -12
- package/dist/components/slider/index.js +66 -90
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/steps/index.d.ts +11 -7
- package/dist/components/steps/index.js +43 -48
- package/dist/components/steps/index.js.map +1 -1
- package/dist/components/swipe-action/index.d.ts +12 -25
- package/dist/components/swipe-action/index.js +118 -115
- package/dist/components/swipe-action/index.js.map +1 -1
- package/dist/components/swipe-action/options/index.d.ts +2 -4
- package/dist/components/swipe-action/options/index.js +18 -17
- package/dist/components/swipe-action/options/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +14 -7
- package/dist/components/switch/index.js +36 -41
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/tab-bar/index.d.ts +17 -7
- package/dist/components/tab-bar/index.js +108 -135
- package/dist/components/tab-bar/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +17 -23
- package/dist/components/tabs/index.js +185 -174
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tabs-pane/index.d.ts +11 -6
- package/dist/components/tabs-pane/index.js +26 -28
- package/dist/components/tabs-pane/index.js.map +1 -1
- package/dist/components/tag/index.d.ts +14 -7
- package/dist/components/tag/index.js +31 -40
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/textarea/index.d.ts +29 -11
- package/dist/components/textarea/index.js +72 -92
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/timeline/index.d.ts +9 -6
- package/dist/components/timeline/index.js +50 -56
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/toast/img.json +3 -6
- package/dist/components/toast/index.d.ts +16 -15
- package/dist/components/toast/index.js +85 -94
- package/dist/components/toast/index.js.map +1 -1
- package/dist/hooks/useComponentLocale.d.ts +2 -0
- package/dist/hooks/useComponentLocale.js +12 -0
- package/dist/hooks/useComponentLocale.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +4006 -4404
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4032 -4434
- package/dist/index.js.map +1 -1
- package/dist/locale/en_US.d.ts +3 -0
- package/dist/locale/en_US.js +34 -0
- package/dist/locale/en_US.js.map +1 -0
- package/dist/locale/index.d.ts +4 -0
- package/dist/locale/index.js +10 -0
- package/dist/locale/index.js.map +1 -0
- package/dist/locale/types.d.ts +34 -0
- package/dist/locale/types.js +1 -0
- package/dist/locale/types.js.map +1 -0
- package/dist/locale/zh_CN.d.ts +3 -0
- package/dist/locale/zh_CN.js +34 -0
- package/dist/locale/zh_CN.js.map +1 -0
- package/dist/style/components/avatar.scss +1 -1
- package/dist/style/components/badge.scss +7 -2
- package/dist/style/components/calendar.scss +1 -1
- package/dist/style/components/countdown.scss +2 -1
- package/dist/style/components/flex.scss +1 -1
- package/dist/style/components/grid.scss +2 -2
- package/dist/style/components/icon.scss +302 -101
- package/dist/style/components/input.scss +2 -2
- package/dist/style/components/progress.scss +1 -1
- package/dist/style/components/search-bar.scss +1 -1
- package/dist/style/components/steps.scss +2 -2
- package/dist/style/components/tabs.scss +1 -1
- package/dist/style/components/tag.scss +1 -1
- package/dist/style/components/timeline.scss +1 -1
- package/dist/style/components/toast.scss +7 -3
- package/dist/style/index.css +176 -176
- package/dist/style/index.css.map +1 -1
- package/dist/style/mixins/libs/hairline.scss +4 -19
- package/dist/style/mixins/libs/shade.scss +3 -6
- package/dist/style/mixins/libs/tint.scss +4 -7
- package/dist/style/themes/purple.scss +15 -15
- package/dist/style/themes/red.scss +16 -13
- package/dist/style/variables/default.scss +69 -73
- package/package.json +5 -3
- package/rn/components/accordion/index.tsx +2 -9
- package/rn/components/action-sheet/body/index.tsx +1 -3
- package/rn/components/action-sheet/body/item/index.tsx +1 -3
- package/rn/components/action-sheet/footer/index.tsx +1 -3
- package/rn/components/action-sheet/header/index.tsx +1 -3
- package/rn/components/activity-indicator/index.tsx +1 -3
- package/rn/components/avatar/index.tsx +5 -5
- package/rn/components/calendar/controller/index.tsx +2 -7
- package/rn/components/card/index.tsx +4 -4
- package/rn/components/countdown/index.scss +5 -4
- package/rn/components/countdown/item/index.tsx +1 -3
- package/rn/components/curtain/index.tsx +5 -5
- package/rn/components/flex/index.scss +2 -2
- package/rn/components/flex/item/index.scss +2 -2
- package/rn/components/grid/index.tsx +15 -15
- package/rn/components/icon/index.tsx +4 -4
- package/rn/components/image-picker/index.tsx +7 -7
- package/rn/components/pagination/index.tsx +7 -7
- package/rn/components/progress/index.tsx +5 -5
- package/rn/components/radio/index.tsx +7 -7
- package/rn/components/rate/index.tsx +4 -4
- package/rn/components/segmented-control/index.tsx +8 -8
- package/rn/components/slider/index.tsx +9 -9
- package/rn/components/steps/index.tsx +8 -8
- package/rn/components/swipe-action/options/index.tsx +1 -3
- package/rn/components/switch/index.tsx +2 -9
- package/rn/components/toast/img.json +3 -6
- package/rn/components/toast/index.tsx +8 -8
- package/rn/style/components/accordion.scss +1 -1
- package/rn/style/components/action-sheet.scss +1 -1
- package/rn/style/components/avatar.scss +1 -1
- package/rn/style/components/badge.scss +8 -3
- package/rn/style/components/button.scss +1 -1
- package/rn/style/components/calendar.scss +1 -1
- package/rn/style/components/checkbox.scss +1 -1
- package/rn/style/components/curtain.scss +1 -1
- package/rn/style/components/fab.scss +1 -4
- package/rn/style/components/flex.scss +1 -1
- package/rn/style/components/grid.scss +2 -6
- package/rn/style/components/icon.scss +302 -101
- package/rn/style/components/index.scss +41 -41
- package/rn/style/components/input.scss +1 -1
- package/rn/style/components/list.scss +2 -4
- package/rn/style/components/loading.scss +4 -4
- package/rn/style/components/message.scss +1 -1
- package/rn/style/components/modal.scss +0 -2
- package/rn/style/components/nav-bar.scss +3 -3
- package/rn/style/components/noticebar.scss +0 -4
- package/rn/style/components/progress.scss +1 -1
- package/rn/style/components/radio.scss +2 -2
- package/rn/style/components/range.scss +1 -1
- package/rn/style/components/search-bar.scss +1 -1
- package/rn/style/components/segmented-control.scss +4 -1
- package/rn/style/components/slider.scss +0 -1
- package/rn/style/components/steps.scss +3 -3
- package/rn/style/components/switch.scss +0 -1
- package/rn/style/components/tabs.scss +2 -2
- package/rn/style/components/tag.scss +1 -1
- package/rn/style/components/timeline.scss +0 -2
- package/rn/style/components/toast.scss +5 -2
- package/rn/style/index.scss +1 -1
- package/rn/style/mixins/libs/hairline.scss +4 -22
- package/rn/style/mixins/libs/shade.scss +1 -4
- package/rn/style/mixins/libs/tint.scss +2 -5
- package/rn/style/themes/purple.scss +15 -15
- package/rn/style/themes/red.scss +16 -13
- package/rn/style/variables/default.scss +69 -73
|
@@ -3,23 +3,21 @@ import _forEach from "lodash/forEach";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { View } from "@tarojs/components";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return /* @__PURE__ */ React.createElement(View, { className: classNames(rootClass) }, this.props.children);
|
|
22
|
-
}
|
|
6
|
+
function AtFlexItem(props) {
|
|
7
|
+
const rootClass = ["at-col"];
|
|
8
|
+
_forEach(props, (value, key) => {
|
|
9
|
+
if (key === "isAuto" && value) {
|
|
10
|
+
return rootClass.push("at-col--auto");
|
|
11
|
+
}
|
|
12
|
+
if (key === "isWrap" && value) {
|
|
13
|
+
return rootClass.push("at-col--wrap");
|
|
14
|
+
}
|
|
15
|
+
if (key === "size" && value) {
|
|
16
|
+
rootClass.push(`at-col-${value}`);
|
|
17
|
+
}
|
|
18
|
+
rootClass.push(`at-col__${key}--${value}`);
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ React.createElement(View, { className: classNames(rootClass) }, props.children);
|
|
23
21
|
}
|
|
24
22
|
AtFlexItem.propTypes = {
|
|
25
23
|
isAuto: PropTypes.bool,
|
|
@@ -28,7 +26,8 @@ AtFlexItem.propTypes = {
|
|
|
28
26
|
size: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
|
|
29
27
|
offset: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
|
|
30
28
|
};
|
|
29
|
+
var item_default = AtFlexItem;
|
|
31
30
|
export {
|
|
32
|
-
|
|
31
|
+
item_default as default
|
|
33
32
|
};
|
|
34
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/flex/item/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport _forEach from 'lodash/forEach'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/flex/item/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport _forEach from 'lodash/forEach'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { View } from '@tarojs/components'\nimport { AtFlexItemProps } from '../../../../types/flex'\n\nfunction AtFlexItem(props: AtFlexItemProps): JSX.Element {\n const rootClass = ['at-col']\n\n _forEach(props, (value, key) => {\n if (key === 'isAuto' && value) {\n return rootClass.push('at-col--auto')\n }\n if (key === 'isWrap' && value) {\n return rootClass.push('at-col--wrap')\n }\n if (key === 'size' && value) {\n rootClass.push(`at-col-${value}`)\n }\n rootClass.push(`at-col__${key}--${value}`)\n })\n\n return <View className={classNames(rootClass)}>{props.children}</View>\n}\n\nAtFlexItem.propTypes = {\n isAuto: PropTypes.bool,\n isWrap: PropTypes.bool,\n align: PropTypes.oneOf(['top', 'bottom', 'center']),\n size: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),\n offset: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n}\n\nexport default AtFlexItem\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,cAAc;AACrB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,YAAY;AAGrB,SAAS,WAAW,OAAqC;AACvD,QAAM,YAAY,CAAC,QAAQ;AAE3B,WAAS,OAAO,CAAC,OAAO,QAAQ;AAC9B,QAAI,QAAQ,YAAY,OAAO;AAC7B,aAAO,UAAU,KAAK,cAAc;AAAA,IACtC;AACA,QAAI,QAAQ,YAAY,OAAO;AAC7B,aAAO,UAAU,KAAK,cAAc;AAAA,IACtC;AACA,QAAI,QAAQ,UAAU,OAAO;AAC3B,gBAAU,KAAK,UAAU,KAAK,EAAE;AAAA,IAClC;AACA,cAAU,KAAK,WAAW,GAAG,KAAK,KAAK,EAAE;AAAA,EAC3C,CAAC;AAED,SAAO,oCAAC,QAAK,WAAW,WAAW,SAAS,KAAI,MAAM,QAAS;AACjE;AAEA,WAAW,YAAY;AAAA,EACrB,QAAQ,UAAU;AAAA,EAClB,QAAQ,UAAU;AAAA,EAClB,OAAO,UAAU,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC;AAAA,EAClD,MAAM,UAAU,MAAM,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;AAAA,EAC7D,QAAQ,UAAU,MAAM,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;AACjE;AAEA,IAAO,eAAQ;","names":[]}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { AtFloatLayoutProps } from '../../../types/float-layout';
|
|
3
|
+
declare function AtFloatLayout({ title, isOpened, scrollY, scrollX, scrollWithAnimation, scrollTop, scrollLeft, upperThreshold, lowerThreshold, className, children, onClose, onScroll, onScrollToLower, onScrollToUpper }: AtFloatLayoutProps): JSX.Element;
|
|
4
|
+
declare namespace AtFloatLayout {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
title: PropTypes.Requireable<string>;
|
|
7
|
+
isOpened: PropTypes.Requireable<boolean>;
|
|
8
|
+
scrollY: PropTypes.Requireable<boolean>;
|
|
9
|
+
scrollX: PropTypes.Requireable<boolean>;
|
|
10
|
+
scrollTop: PropTypes.Requireable<number>;
|
|
11
|
+
scrollLeft: PropTypes.Requireable<number>;
|
|
12
|
+
upperThreshold: PropTypes.Requireable<number>;
|
|
13
|
+
lowerThreshold: PropTypes.Requireable<number>;
|
|
14
|
+
scrollWithAnimation: PropTypes.Requireable<boolean>;
|
|
15
|
+
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
+
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
+
onScrollToLower: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
onScrollToUpper: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
+
};
|
|
13
20
|
}
|
|
21
|
+
export default AtFloatLayout;
|
|
@@ -1,88 +1,71 @@
|
|
|
1
1
|
import classNames from "classnames";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { ScrollView, Text, View } from "@tarojs/components";
|
|
5
5
|
import { handleTouchScroll } from "../../common/utils";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_isOpened: isOpened
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
31
|
-
const { isOpened } = nextProps;
|
|
32
|
-
if (this.props.isOpened !== isOpened) {
|
|
6
|
+
function AtFloatLayout({
|
|
7
|
+
title = "",
|
|
8
|
+
isOpened = false,
|
|
9
|
+
scrollY = true,
|
|
10
|
+
scrollX = false,
|
|
11
|
+
scrollWithAnimation = false,
|
|
12
|
+
scrollTop,
|
|
13
|
+
scrollLeft,
|
|
14
|
+
upperThreshold,
|
|
15
|
+
lowerThreshold,
|
|
16
|
+
className,
|
|
17
|
+
children,
|
|
18
|
+
onClose,
|
|
19
|
+
onScroll,
|
|
20
|
+
onScrollToLower,
|
|
21
|
+
onScrollToUpper
|
|
22
|
+
}) {
|
|
23
|
+
const [_isOpened, setIsOpened] = useState(isOpened);
|
|
24
|
+
const prevIsOpenedPropRef = useRef(isOpened);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (prevIsOpenedPropRef.current !== isOpened) {
|
|
33
27
|
handleTouchScroll(isOpened);
|
|
28
|
+
prevIsOpenedPropRef.current = isOpened;
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
setIsOpened((prev) => isOpened !== prev ? isOpened : prev);
|
|
31
|
+
}, [isOpened]);
|
|
32
|
+
const handleClose = (e) => {
|
|
33
|
+
if (typeof onClose === "function") {
|
|
34
|
+
onClose(e);
|
|
39
35
|
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
};
|
|
37
|
+
const close = (e) => {
|
|
38
|
+
setIsOpened(false);
|
|
39
|
+
handleClose(e);
|
|
40
|
+
};
|
|
41
|
+
const handleTouchMove = (e) => {
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
};
|
|
44
|
+
const rootClass = classNames(
|
|
45
|
+
"at-float-layout",
|
|
46
|
+
{
|
|
47
|
+
"at-float-layout--active": _isOpened
|
|
48
|
+
},
|
|
49
|
+
className
|
|
50
|
+
);
|
|
51
|
+
return /* @__PURE__ */ React.createElement(View, { className: rootClass, onTouchMove: handleTouchMove }, /* @__PURE__ */ React.createElement(View, { onClick: close, className: "at-float-layout__overlay" }), /* @__PURE__ */ React.createElement(View, { className: "at-float-layout__container layout" }, title ? /* @__PURE__ */ React.createElement(View, { className: "layout-header" }, /* @__PURE__ */ React.createElement(Text, { className: "layout-header__title" }, title), /* @__PURE__ */ React.createElement(View, { className: "layout-header__btn-close", onClick: close })) : null, /* @__PURE__ */ React.createElement(View, { className: "layout-body" }, /* @__PURE__ */ React.createElement(
|
|
52
|
+
ScrollView,
|
|
53
|
+
{
|
|
45
54
|
scrollY,
|
|
46
55
|
scrollX,
|
|
47
56
|
scrollTop,
|
|
48
57
|
scrollLeft,
|
|
49
58
|
upperThreshold,
|
|
50
59
|
lowerThreshold,
|
|
51
|
-
scrollWithAnimation
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
);
|
|
60
|
-
return /* @__PURE__ */ React.createElement(View, { className: rootClass, onTouchMove: this.handleTouchMove }, /* @__PURE__ */ React.createElement(View, { onClick: this.close, className: "at-float-layout__overlay" }), /* @__PURE__ */ React.createElement(View, { className: "at-float-layout__container layout" }, title ? /* @__PURE__ */ React.createElement(View, { className: "layout-header" }, /* @__PURE__ */ React.createElement(Text, { className: "layout-header__title" }, title), /* @__PURE__ */ React.createElement(View, { className: "layout-header__btn-close", onClick: this.close })) : null, /* @__PURE__ */ React.createElement(View, { className: "layout-body" }, /* @__PURE__ */ React.createElement(
|
|
61
|
-
ScrollView,
|
|
62
|
-
{
|
|
63
|
-
scrollY,
|
|
64
|
-
scrollX,
|
|
65
|
-
scrollTop,
|
|
66
|
-
scrollLeft,
|
|
67
|
-
upperThreshold,
|
|
68
|
-
lowerThreshold,
|
|
69
|
-
scrollWithAnimation,
|
|
70
|
-
onScroll: this.props.onScroll,
|
|
71
|
-
onScrollToLower: this.props.onScrollToLower,
|
|
72
|
-
onScrollToUpper: this.props.onScrollToUpper,
|
|
73
|
-
className: "layout-body__content"
|
|
74
|
-
},
|
|
75
|
-
this.props.children
|
|
76
|
-
))));
|
|
77
|
-
}
|
|
60
|
+
scrollWithAnimation,
|
|
61
|
+
onScroll,
|
|
62
|
+
onScrollToLower,
|
|
63
|
+
onScrollToUpper,
|
|
64
|
+
className: "layout-body__content"
|
|
65
|
+
},
|
|
66
|
+
children
|
|
67
|
+
))));
|
|
78
68
|
}
|
|
79
|
-
AtFloatLayout.defaultProps = {
|
|
80
|
-
title: "",
|
|
81
|
-
isOpened: false,
|
|
82
|
-
scrollY: true,
|
|
83
|
-
scrollX: false,
|
|
84
|
-
scrollWithAnimation: false
|
|
85
|
-
};
|
|
86
69
|
AtFloatLayout.propTypes = {
|
|
87
70
|
title: PropTypes.string,
|
|
88
71
|
isOpened: PropTypes.bool,
|
|
@@ -98,7 +81,8 @@ AtFloatLayout.propTypes = {
|
|
|
98
81
|
onScrollToLower: PropTypes.func,
|
|
99
82
|
onScrollToUpper: PropTypes.func
|
|
100
83
|
};
|
|
84
|
+
var float_layout_default = AtFloatLayout;
|
|
101
85
|
export {
|
|
102
|
-
|
|
86
|
+
float_layout_default as default
|
|
103
87
|
};
|
|
104
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/float-layout/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/float-layout/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React, { useEffect, useRef, useState } from 'react'\nimport { ScrollView, Text, View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtFloatLayoutProps } from '../../../types/float-layout'\nimport { handleTouchScroll } from '../../common/utils'\n\nfunction AtFloatLayout({\n title = '',\n isOpened = false,\n scrollY = true,\n scrollX = false,\n scrollWithAnimation = false,\n scrollTop,\n scrollLeft,\n upperThreshold,\n lowerThreshold,\n className,\n children,\n onClose,\n onScroll,\n onScrollToLower,\n onScrollToUpper\n}: AtFloatLayoutProps): JSX.Element {\n const [_isOpened, setIsOpened] = useState(isOpened)\n const prevIsOpenedPropRef = useRef(isOpened)\n\n useEffect(() => {\n if (prevIsOpenedPropRef.current !== isOpened) {\n handleTouchScroll(isOpened)\n prevIsOpenedPropRef.current = isOpened\n }\n setIsOpened(prev => (isOpened !== prev ? isOpened : prev))\n }, [isOpened])\n\n const handleClose = (e): void => {\n if (typeof onClose === 'function') {\n onClose(e)\n }\n }\n\n const close = (e): void => {\n setIsOpened(false)\n handleClose(e)\n }\n\n const handleTouchMove = (e: CommonEvent): void => {\n e.stopPropagation()\n }\n\n const rootClass = classNames(\n 'at-float-layout',\n {\n 'at-float-layout--active': _isOpened\n },\n className\n )\n\n return (\n <View className={rootClass} onTouchMove={handleTouchMove}>\n <View onClick={close} className='at-float-layout__overlay' />\n <View className='at-float-layout__container layout'>\n {title ? (\n <View className='layout-header'>\n <Text className='layout-header__title'>{title}</Text>\n <View className='layout-header__btn-close' onClick={close} />\n </View>\n ) : null}\n <View className='layout-body'>\n <ScrollView\n scrollY={scrollY}\n scrollX={scrollX}\n scrollTop={scrollTop}\n scrollLeft={scrollLeft}\n upperThreshold={upperThreshold}\n lowerThreshold={lowerThreshold}\n scrollWithAnimation={scrollWithAnimation}\n onScroll={onScroll}\n onScrollToLower={onScrollToLower}\n onScrollToUpper={onScrollToUpper}\n className='layout-body__content'\n >\n {children}\n </ScrollView>\n </View>\n </View>\n </View>\n )\n}\n\nAtFloatLayout.propTypes = {\n title: PropTypes.string,\n isOpened: PropTypes.bool,\n scrollY: PropTypes.bool,\n scrollX: PropTypes.bool,\n scrollTop: PropTypes.number,\n scrollLeft: PropTypes.number,\n upperThreshold: PropTypes.number,\n lowerThreshold: PropTypes.number,\n scrollWithAnimation: PropTypes.bool,\n onClose: PropTypes.func,\n onScroll: PropTypes.func,\n onScrollToLower: PropTypes.func,\n onScrollToUpper: PropTypes.func\n}\n\nexport default AtFloatLayout\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,SAAS,WAAW,QAAQ,gBAAgB;AACnD,SAAS,YAAY,MAAM,YAAY;AAGvC,SAAS,yBAAyB;AAElC,SAAS,cAAc;AAAA,EACrB,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,UAAU;AAAA,EACV,sBAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAoC;AAClC,QAAM,CAAC,WAAW,WAAW,IAAI,SAAS,QAAQ;AAClD,QAAM,sBAAsB,OAAO,QAAQ;AAE3C,YAAU,MAAM;AACd,QAAI,oBAAoB,YAAY,UAAU;AAC5C,wBAAkB,QAAQ;AAC1B,0BAAoB,UAAU;AAAA,IAChC;AACA,gBAAY,UAAS,aAAa,OAAO,WAAW,IAAK;AAAA,EAC3D,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,cAAc,CAAC,MAAY;AAC/B,QAAI,OAAO,YAAY,YAAY;AACjC,cAAQ,CAAC;AAAA,IACX;AAAA,EACF;AAEA,QAAM,QAAQ,CAAC,MAAY;AACzB,gBAAY,KAAK;AACjB,gBAAY,CAAC;AAAA,EACf;AAEA,QAAM,kBAAkB,CAAC,MAAyB;AAChD,MAAE,gBAAgB;AAAA,EACpB;AAEA,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,MACE,2BAA2B;AAAA,IAC7B;AAAA,IACA;AAAA,EACF;AAEA,SACE,oCAAC,QAAK,WAAW,WAAW,aAAa,mBACvC,oCAAC,QAAK,SAAS,OAAO,WAAU,4BAA2B,GAC3D,oCAAC,QAAK,WAAU,uCACb,QACC,oCAAC,QAAK,WAAU,mBACd,oCAAC,QAAK,WAAU,0BAAwB,KAAM,GAC9C,oCAAC,QAAK,WAAU,4BAA2B,SAAS,OAAO,CAC7D,IACE,MACJ,oCAAC,QAAK,WAAU,iBACd;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAU;AAAA;AAAA,IAET;AAAA,EACH,CACF,CACF,CACF;AAEJ;AAEA,cAAc,YAAY;AAAA,EACxB,OAAO,UAAU;AAAA,EACjB,UAAU,UAAU;AAAA,EACpB,SAAS,UAAU;AAAA,EACnB,SAAS,UAAU;AAAA,EACnB,WAAW,UAAU;AAAA,EACrB,YAAY,UAAU;AAAA,EACtB,gBAAgB,UAAU;AAAA,EAC1B,gBAAgB,UAAU;AAAA,EAC1B,qBAAqB,UAAU;AAAA,EAC/B,SAAS,UAAU;AAAA,EACnB,UAAU,UAAU;AAAA,EACpB,iBAAiB,UAAU;AAAA,EAC3B,iBAAiB,UAAU;AAC7B;AAEA,IAAO,uBAAQ;","names":[]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
3
2
|
import { AtFormProps } from '../../../types/form';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
declare function AtForm({ customStyle, className, reportSubmit, onSubmit, onReset, children }: AtFormProps): JSX.Element;
|
|
4
|
+
declare namespace AtForm {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
customStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
7
|
+
className: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
|
|
8
|
+
reportSubmit: PropTypes.Requireable<boolean>;
|
|
9
|
+
onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
|
+
onReset: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
+
};
|
|
10
12
|
}
|
|
13
|
+
export default AtForm;
|
|
@@ -2,34 +2,33 @@ import classNames from "classnames";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Form } from "@tarojs/components";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
function AtForm({
|
|
6
|
+
customStyle = "",
|
|
7
|
+
className = "",
|
|
8
|
+
reportSubmit = false,
|
|
9
|
+
onSubmit,
|
|
10
|
+
onReset,
|
|
11
|
+
children
|
|
12
|
+
}) {
|
|
13
|
+
const handleSubmit = (event) => {
|
|
14
|
+
onSubmit && onSubmit(event);
|
|
15
|
+
};
|
|
16
|
+
const handleReset = (event) => {
|
|
17
|
+
onReset && onReset(event);
|
|
18
|
+
};
|
|
19
|
+
const rootCls = classNames("at-form", className);
|
|
20
|
+
return /* @__PURE__ */ React.createElement(
|
|
21
|
+
Form,
|
|
22
|
+
{
|
|
23
|
+
className: rootCls,
|
|
24
|
+
style: customStyle,
|
|
25
|
+
onSubmit: handleSubmit,
|
|
26
|
+
reportSubmit,
|
|
27
|
+
onReset: handleReset
|
|
28
|
+
},
|
|
29
|
+
children
|
|
30
|
+
);
|
|
27
31
|
}
|
|
28
|
-
AtForm.defaultProps = {
|
|
29
|
-
customStyle: "",
|
|
30
|
-
className: "",
|
|
31
|
-
reportSubmit: false
|
|
32
|
-
};
|
|
33
32
|
AtForm.propTypes = {
|
|
34
33
|
customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
35
34
|
className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
@@ -37,7 +36,8 @@ AtForm.propTypes = {
|
|
|
37
36
|
onSubmit: PropTypes.func,
|
|
38
37
|
onReset: PropTypes.func
|
|
39
38
|
};
|
|
39
|
+
var form_default = AtForm;
|
|
40
40
|
export {
|
|
41
|
-
|
|
41
|
+
form_default as default
|
|
42
42
|
};
|
|
43
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/form/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/form/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { Form } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtFormProps } from '../../../types/form'\n\nfunction AtForm({\n customStyle = '',\n className = '',\n reportSubmit = false,\n onSubmit,\n onReset,\n children\n}: AtFormProps): JSX.Element {\n const handleSubmit = (event: CommonEvent): void => {\n onSubmit && onSubmit(event)\n }\n\n const handleReset = (event: CommonEvent): void => {\n onReset && onReset(event)\n }\n\n const rootCls = classNames('at-form', className)\n\n return (\n <Form\n className={rootCls}\n style={customStyle}\n onSubmit={handleSubmit}\n reportSubmit={reportSubmit}\n onReset={handleReset}\n >\n {children}\n </Form>\n )\n}\n\nAtForm.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n reportSubmit: PropTypes.bool,\n onSubmit: PropTypes.func,\n onReset: PropTypes.func\n}\n\nexport default AtForm\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,YAAY;AAIrB,SAAS,OAAO;AAAA,EACd,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AACF,GAA6B;AAC3B,QAAM,eAAe,CAAC,UAA6B;AACjD,gBAAY,SAAS,KAAK;AAAA,EAC5B;AAEA,QAAM,cAAc,CAAC,UAA6B;AAChD,eAAW,QAAQ,KAAK;AAAA,EAC1B;AAEA,QAAM,UAAU,WAAW,WAAW,SAAS;AAE/C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,MACX,OAAO;AAAA,MACP,UAAU;AAAA,MACV;AAAA,MACA,SAAS;AAAA;AAAA,IAER;AAAA,EACH;AAEJ;AAEA,OAAO,YAAY;AAAA,EACjB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AAAA,EAClE,cAAc,UAAU;AAAA,EACxB,UAAU,UAAU;AAAA,EACpB,SAAS,UAAU;AACrB;AAEA,IAAO,eAAQ;","names":[]}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
3
2
|
import { AtGridProps } from '../../../types/grid';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
declare function AtGrid({ data, mode, columnNum, hasBorder, className, onClick }: AtGridProps): JSX.Element | null;
|
|
4
|
+
declare namespace AtGrid {
|
|
5
|
+
var propTypes: {
|
|
6
|
+
mode: PropTypes.Requireable<string>;
|
|
7
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
8
|
+
hasBorder: PropTypes.Requireable<boolean>;
|
|
9
|
+
columnNum: PropTypes.Requireable<number>;
|
|
10
|
+
data: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
11
|
+
image: PropTypes.Requireable<string>;
|
|
12
|
+
value: PropTypes.Requireable<string>;
|
|
13
|
+
iconInfo: PropTypes.Requireable<PropTypes.InferProps<{
|
|
14
|
+
size: PropTypes.Requireable<number>;
|
|
15
|
+
value: PropTypes.Requireable<string>;
|
|
16
|
+
color: PropTypes.Requireable<string>;
|
|
17
|
+
prefixClass: PropTypes.Requireable<string>;
|
|
18
|
+
customStyle: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
19
|
+
className: PropTypes.Requireable<NonNullable<string | any[] | null | undefined>>;
|
|
20
|
+
}>>;
|
|
21
|
+
}> | null | undefined)[]>;
|
|
22
|
+
};
|
|
9
23
|
}
|
|
24
|
+
export default AtGrid;
|
|
@@ -4,77 +4,71 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { Image, Text, View } from "@tarojs/components";
|
|
6
6
|
import { mergeStyle } from "../../common/utils";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
function AtGrid({
|
|
8
|
+
data = [],
|
|
9
|
+
mode = "square",
|
|
10
|
+
columnNum = 3,
|
|
11
|
+
hasBorder = true,
|
|
12
|
+
className,
|
|
13
|
+
onClick
|
|
14
|
+
}) {
|
|
15
|
+
const handleClick = (item, index, row, event) => {
|
|
16
|
+
if (typeof onClick === "function") {
|
|
17
|
+
const clickIndex = row * columnNum + index;
|
|
18
|
+
onClick(item, clickIndex, event);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
if (Array.isArray(data) && data.length === 0) {
|
|
22
|
+
return null;
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
const gridGroup = _chunk(data, columnNum);
|
|
25
|
+
const bodyClass = classNames(
|
|
26
|
+
["at-grid__flex-item", "at-grid-item", `at-grid-item--${mode}`],
|
|
27
|
+
{
|
|
28
|
+
"at-grid-item--no-border": !hasBorder
|
|
22
29
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ React.createElement(View, { className: classNames("at-grid", className) }, gridGroup.map((item, i) => /* @__PURE__ */ React.createElement(View, { className: "at-grid__flex", key: `at-grid-group-${i}` }, item.map((childItem, index) => /* @__PURE__ */ React.createElement(
|
|
32
|
+
View,
|
|
33
|
+
{
|
|
34
|
+
key: `at-grid-item-${index}`,
|
|
35
|
+
className: classNames(bodyClass, {
|
|
36
|
+
"at-grid-item--last": index === columnNum - 1
|
|
37
|
+
}),
|
|
38
|
+
onClick: (event) => handleClick(childItem, index, i, event),
|
|
39
|
+
style: {
|
|
40
|
+
flex: `0 0 ${100 / columnNum}%`
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
/* @__PURE__ */ React.createElement(View, { className: "at-grid-item__content" }, /* @__PURE__ */ React.createElement(View, { className: "at-grid-item__content-inner" }, /* @__PURE__ */ React.createElement(View, { className: "content-inner__icon" }, childItem.image && /* @__PURE__ */ React.createElement(
|
|
44
|
+
Image,
|
|
26
45
|
{
|
|
27
|
-
"
|
|
46
|
+
className: "content-inner__img",
|
|
47
|
+
src: childItem.image,
|
|
48
|
+
mode: "scaleToFill"
|
|
28
49
|
}
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
View,
|
|
50
|
+
), childItem.iconInfo && !childItem.image && /* @__PURE__ */ React.createElement(
|
|
51
|
+
Text,
|
|
32
52
|
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
className: classNames(
|
|
53
|
-
childItem.iconInfo.prefixClass || "at-icon",
|
|
54
|
-
{
|
|
55
|
-
[`${childItem.iconInfo.prefixClass || "at-icon"}-${childItem.iconInfo.value}`]: childItem.iconInfo.value
|
|
56
|
-
},
|
|
57
|
-
childItem.iconInfo.className
|
|
58
|
-
),
|
|
59
|
-
style: mergeStyle(
|
|
60
|
-
{
|
|
61
|
-
color: childItem.iconInfo.color,
|
|
62
|
-
fontSize: `${childItem.iconInfo.size || 24}px`
|
|
63
|
-
},
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
65
|
-
childItem.iconInfo.customStyle
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
)), /* @__PURE__ */ React.createElement(Text, { className: "content-inner__text" }, childItem.value)))
|
|
69
|
-
)))));
|
|
70
|
-
}
|
|
53
|
+
className: classNames(
|
|
54
|
+
childItem.iconInfo.prefixClass || "at-icon",
|
|
55
|
+
{
|
|
56
|
+
[`${childItem.iconInfo.prefixClass || "at-icon"}-${childItem.iconInfo.value}`]: childItem.iconInfo.value
|
|
57
|
+
},
|
|
58
|
+
childItem.iconInfo.className
|
|
59
|
+
),
|
|
60
|
+
style: mergeStyle(
|
|
61
|
+
{
|
|
62
|
+
color: childItem.iconInfo.color,
|
|
63
|
+
fontSize: `${childItem.iconInfo.size || 24}px`
|
|
64
|
+
},
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
66
|
+
childItem.iconInfo.customStyle
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
)), /* @__PURE__ */ React.createElement(Text, { className: "content-inner__text" }, childItem.value)))
|
|
70
|
+
)))));
|
|
71
71
|
}
|
|
72
|
-
AtGrid.defaultProps = {
|
|
73
|
-
data: [],
|
|
74
|
-
columnNum: 3,
|
|
75
|
-
mode: "square",
|
|
76
|
-
hasBorder: true
|
|
77
|
-
};
|
|
78
72
|
AtGrid.propTypes = {
|
|
79
73
|
mode: PropTypes.string,
|
|
80
74
|
onClick: PropTypes.func,
|
|
@@ -95,7 +89,8 @@ AtGrid.propTypes = {
|
|
|
95
89
|
})
|
|
96
90
|
)
|
|
97
91
|
};
|
|
92
|
+
var grid_default = AtGrid;
|
|
98
93
|
export {
|
|
99
|
-
|
|
94
|
+
grid_default as default
|
|
100
95
|
};
|
|
101
96
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/grid/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport _chunk from 'lodash/chunk'\nimport PropTypes
|
|
1
|
+
{"version":3,"sources":["../../../src/components/grid/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport _chunk from 'lodash/chunk'\nimport PropTypes from 'prop-types'\nimport React from 'react'\nimport { Image, Text, View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtGridItem, AtGridProps } from '../../../types/grid'\nimport { mergeStyle } from '../../common/utils'\n\nfunction AtGrid({\n data = [],\n mode = 'square',\n columnNum = 3,\n hasBorder = true,\n className,\n onClick\n}: AtGridProps): JSX.Element | null {\n const handleClick = (\n item: AtGridItem,\n index: number,\n row: number,\n event: CommonEvent\n ): void => {\n if (typeof onClick === 'function') {\n const clickIndex = row * columnNum + index\n onClick(item, clickIndex, event)\n }\n }\n\n if (Array.isArray(data) && data.length === 0) {\n return null\n }\n\n const gridGroup = _chunk(data, columnNum)\n\n const bodyClass = classNames(\n ['at-grid__flex-item', 'at-grid-item', `at-grid-item--${mode}`],\n {\n 'at-grid-item--no-border': !hasBorder\n }\n )\n\n return (\n <View className={classNames('at-grid', className)}>\n {gridGroup.map((item, i) => (\n <View className='at-grid__flex' key={`at-grid-group-${i}`}>\n {item.map((childItem, index) => (\n <View\n key={`at-grid-item-${index}`}\n className={classNames(bodyClass, {\n 'at-grid-item--last': index === columnNum - 1\n })}\n onClick={event => handleClick(childItem, index, i, event)}\n style={{\n flex: `0 0 ${100 / columnNum}%`\n }}\n >\n <View className='at-grid-item__content'>\n <View className='at-grid-item__content-inner'>\n <View className='content-inner__icon'>\n {childItem.image && (\n <Image\n className='content-inner__img'\n src={childItem.image}\n mode='scaleToFill'\n />\n )}\n {childItem.iconInfo && !childItem.image && (\n <Text\n className={classNames(\n childItem.iconInfo.prefixClass || 'at-icon',\n {\n [`${childItem.iconInfo.prefixClass || 'at-icon'}-${\n childItem.iconInfo.value\n }`]: childItem.iconInfo.value\n },\n childItem.iconInfo.className\n )}\n style={mergeStyle(\n {\n color: childItem.iconInfo.color,\n fontSize: `${childItem.iconInfo.size || 24}px`\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n childItem.iconInfo!.customStyle!\n )}\n />\n )}\n </View>\n <Text className='content-inner__text'>{childItem.value}</Text>\n </View>\n </View>\n </View>\n ))}\n </View>\n ))}\n </View>\n )\n}\n\nAtGrid.propTypes = {\n mode: PropTypes.string,\n onClick: PropTypes.func,\n hasBorder: PropTypes.bool,\n columnNum: PropTypes.number,\n data: PropTypes.arrayOf(\n PropTypes.shape({\n image: PropTypes.string,\n value: PropTypes.string,\n iconInfo: PropTypes.shape({\n size: PropTypes.number,\n value: PropTypes.string,\n color: PropTypes.string,\n prefixClass: PropTypes.string,\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string])\n })\n })\n )\n}\n\nexport default AtGrid\n"],"mappings":"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","names":[]}
|