@nutui/nutui-react 2.0.0-alpha.15 → 2.0.0-alpha.16
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/CHANGELOG.md +14 -0
- package/dist/esm/DatePicker.js +54 -58
- package/dist/esm/Dialog/style/index.js +1 -0
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Menu/style/style.css +1 -1
- package/dist/esm/Menu.js +5 -3
- package/dist/esm/MenuItem/style/style.css +1 -1
- package/dist/esm/MenuItem.js +31 -44
- package/dist/esm/NoticeBar.js +2 -2
- package/dist/esm/Picker.js +1 -1
- package/dist/esm/Popover.js +3 -40
- package/dist/esm/Popup.js +1 -1
- package/dist/esm/Toast.js +16 -7
- package/dist/esm/Uploader.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/src/packages/datepicker/datepicker.d.ts +11 -17
- package/dist/esm/types/src/packages/datepicker/datepicker.taro.d.ts +11 -17
- package/dist/esm/types/src/packages/datepicker/index.d.ts +1 -0
- package/dist/esm/types/src/packages/datepicker/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/nutui.react.taro.d.ts +2 -2
- package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +2 -2
- package/dist/esm/types/src/packages/toast/Notification.d.ts +4 -1
- package/dist/esm/use-click-away.js +43 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +210 -224
- package/dist/nutui.react.umd.js +210 -224
- package/dist/packages/menuitem/menuitem.scss +1 -1
- package/dist/packages/noticebar/noticebar.scss +0 -3
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/datepicker/datepicker.d.ts +79 -25
- package/dist/types/packages/datepicker/index.d.ts +1 -0
- package/dist/types/packages/toast/Notification.d.ts +4 -1
- package/package.json +1 -1
package/dist/esm/Toast.js
CHANGED
|
@@ -56,9 +56,9 @@ function _isNativeReflectConstruct() {
|
|
|
56
56
|
}
|
|
57
57
|
import * as React from "react";
|
|
58
58
|
import classNames from "classnames";
|
|
59
|
+
import { Issue, Failure, Loading, Check } from "@nutui/icons-react";
|
|
59
60
|
import { r as render, u as unmount } from "./render.js";
|
|
60
61
|
import { O as Overlay } from "./overlay2.js";
|
|
61
|
-
import { Issue, Failure, Loading, Check } from "@nutui/icons-react";
|
|
62
62
|
import { C as ComponentDefaults } from "./typings.js";
|
|
63
63
|
import "react-dom";
|
|
64
64
|
var classPrefix = "nut-toast";
|
|
@@ -73,14 +73,23 @@ var Notification = /* @__PURE__ */ function(_React$PureComponent) {
|
|
|
73
73
|
_this.close = _this.close.bind(_assertThisInitialized(_this));
|
|
74
74
|
_this.startCloseTimer = _this.startCloseTimer.bind(_assertThisInitialized(_this));
|
|
75
75
|
_this.clearCloseTimer = _this.clearCloseTimer.bind(_assertThisInitialized(_this));
|
|
76
|
-
_this.close = _this.close.bind(_assertThisInitialized(_this));
|
|
77
76
|
_this.clickCover = _this.clickCover.bind(_assertThisInitialized(_this));
|
|
77
|
+
_this.state = {
|
|
78
|
+
show: true
|
|
79
|
+
};
|
|
78
80
|
return _this;
|
|
79
81
|
}
|
|
80
82
|
_createClass(Notification2, [{
|
|
81
83
|
key: "close",
|
|
82
84
|
value: function close() {
|
|
85
|
+
this.setState({
|
|
86
|
+
show: false
|
|
87
|
+
});
|
|
83
88
|
this.clearCloseTimer();
|
|
89
|
+
if (this.props.id) {
|
|
90
|
+
var element = document.getElementById(this.props.id);
|
|
91
|
+
element && element.parentNode && element.parentNode.removeChild(element);
|
|
92
|
+
}
|
|
84
93
|
this.props.onClose();
|
|
85
94
|
}
|
|
86
95
|
}, {
|
|
@@ -153,15 +162,15 @@ var Notification = /* @__PURE__ */ function(_React$PureComponent) {
|
|
|
153
162
|
value: function render2() {
|
|
154
163
|
var _this3 = this;
|
|
155
164
|
var _this$props = this.props, id = _this$props.id, icon = _this$props.icon, title = _this$props.title, content = _this$props.content, position = _this$props.position, size = _this$props.size, closeOnOverlayClick = _this$props.closeOnOverlayClick, style = _this$props.style, className = _this$props.className, contentClassName = _this$props.contentClassName, contentStyle = _this$props.contentStyle;
|
|
165
|
+
var show2 = this.state.show;
|
|
156
166
|
var classes = classNames(_defineProperty({
|
|
157
167
|
"nut-toast-has-icon": icon
|
|
158
168
|
}, "nut-toast-".concat(size), true));
|
|
159
169
|
return React.createElement(React.Fragment, null, React.createElement(Overlay, {
|
|
160
|
-
visible:
|
|
170
|
+
visible: show2,
|
|
161
171
|
style,
|
|
162
172
|
className: "".concat(classPrefix, "__overlay-default ").concat(className),
|
|
163
173
|
onClick: function onClick() {
|
|
164
|
-
console.log("onclick");
|
|
165
174
|
_this3.clickCover();
|
|
166
175
|
},
|
|
167
176
|
closeOnOverlayClick
|
|
@@ -183,9 +192,9 @@ var Notification = /* @__PURE__ */ function(_React$PureComponent) {
|
|
|
183
192
|
_defineProperty(Notification, "newInstance", void 0);
|
|
184
193
|
Notification.newInstance = function(properties, callback) {
|
|
185
194
|
var element = document.createElement("div");
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
195
|
+
var id = properties.id ? properties.id : "".concat((/* @__PURE__ */ new Date()).getTime());
|
|
196
|
+
element.id = id;
|
|
197
|
+
properties.id = id;
|
|
189
198
|
document.body.appendChild(element);
|
|
190
199
|
var called = false;
|
|
191
200
|
function ref(instance) {
|
package/dist/esm/Uploader.js
CHANGED
|
@@ -31,7 +31,7 @@ import classNames from "classnames";
|
|
|
31
31
|
import { Failure, Loading, Link, Del, Photograph } from "@nutui/icons-react";
|
|
32
32
|
import Progress from "./Progress.js";
|
|
33
33
|
import { useConfig } from "./ConfigProvider.js";
|
|
34
|
-
import {
|
|
34
|
+
import { a as isPromise } from "./index.js";
|
|
35
35
|
import { C as ComponentDefaults } from "./typings.js";
|
|
36
36
|
var UploadOptions = /* @__PURE__ */ _createClass(function UploadOptions2() {
|
|
37
37
|
_classCallCheck(this, UploadOptions2);
|
package/dist/esm/index.js
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
className?: string | number;
|
|
8
|
-
}
|
|
9
|
-
export interface DatePickerProps {
|
|
10
|
-
modelValue: Date | null;
|
|
2
|
+
import { PickerOption } from '@/packages/picker/index';
|
|
3
|
+
import { BasicComponent } from '@/utils/typings';
|
|
4
|
+
export interface DatePickerProps extends BasicComponent {
|
|
5
|
+
value?: Date | null;
|
|
6
|
+
defaultValue?: Date | null;
|
|
11
7
|
visible: boolean;
|
|
12
8
|
title: string;
|
|
13
9
|
type: 'date' | 'time' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes';
|
|
14
|
-
|
|
10
|
+
showChinese: boolean;
|
|
15
11
|
minuteStep: number;
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
startDate: Date;
|
|
13
|
+
endDate: Date;
|
|
18
14
|
threeDimensional: boolean;
|
|
19
|
-
className?: string;
|
|
20
|
-
style?: React.CSSProperties;
|
|
21
15
|
formatter: (type: string, option: PickerOption) => PickerOption;
|
|
22
16
|
filter: (type: string, option: PickerOption[]) => PickerOption[];
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
onConfirm: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void;
|
|
25
19
|
onChange?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], columnIndex: number) => void;
|
|
26
20
|
}
|
|
27
|
-
export declare const DatePicker: FunctionComponent<Partial<DatePickerProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>>;
|
|
21
|
+
export declare const DatePicker: FunctionComponent<Partial<DatePickerProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>>;
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
className?: string | number;
|
|
8
|
-
}
|
|
9
|
-
export interface DatePickerProps {
|
|
10
|
-
modelValue: Date | null;
|
|
2
|
+
import { PickerOption } from '@/packages/picker/index';
|
|
3
|
+
import { BasicComponent } from '@/utils/typings';
|
|
4
|
+
export interface DatePickerProps extends BasicComponent {
|
|
5
|
+
value?: Date | null;
|
|
6
|
+
defaultValue?: Date | null;
|
|
11
7
|
visible: boolean;
|
|
12
8
|
title: string;
|
|
13
9
|
type: 'date' | 'time' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes';
|
|
14
|
-
|
|
10
|
+
showChinese: boolean;
|
|
15
11
|
minuteStep: number;
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
startDate: Date;
|
|
13
|
+
endDate: Date;
|
|
18
14
|
threeDimensional: boolean;
|
|
19
|
-
className?: string;
|
|
20
|
-
style?: React.CSSProperties;
|
|
21
15
|
formatter: (type: string, option: PickerOption) => PickerOption;
|
|
22
16
|
filter: (type: string, option: PickerOption[]) => PickerOption[];
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
onConfirm: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void;
|
|
25
19
|
onChange?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], columnIndex: number) => void;
|
|
26
20
|
}
|
|
27
|
-
export declare const DatePicker: FunctionComponent<Partial<DatePickerProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>>;
|
|
21
|
+
export declare const DatePicker: FunctionComponent<Partial<DatePickerProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>>;
|
|
@@ -52,7 +52,7 @@ import Badge from '@/packages/badge/index.taro';
|
|
|
52
52
|
import Dialog from '@/packages/dialog/index.taro';
|
|
53
53
|
import Drag from '@/packages/drag/index.taro';
|
|
54
54
|
import Empty from '@/packages/empty/index.taro';
|
|
55
|
-
import
|
|
55
|
+
import InfiniteLoading from '@/packages/infiniteloading/index.taro';
|
|
56
56
|
import NoticeBar from '@/packages/noticebar/index.taro';
|
|
57
57
|
import Notify from '@/packages/notify/index.taro';
|
|
58
58
|
import Popover from '@/packages/popover/index.taro';
|
|
@@ -182,4 +182,4 @@ import '@/packages/timedetail/timedetail.scss';
|
|
|
182
182
|
import '@/packages/timeselect/timeselect.scss';
|
|
183
183
|
import '@/packages/trendarrow/trendarrow.scss';
|
|
184
184
|
import '@/packages/watermark/watermark.scss';
|
|
185
|
-
export { Button, Cell, CellGroup, ConfigProvider, Image, Overlay, Col, Divider, Grid, GridItem, Layout, Row, Sticky, BackTop, Elevator, FixedNav, NavBar, SideNavBar, SideNavBarItem, SubSideNavBar, Tabbar, TabbarItem, TabPane, Tabs, Address, Calendar, CalendarItem, Cascader, Checkbox, CheckboxGroup, DatePicker, Form, FormItem, Input, InputNumber, Menu, MenuItem, NumberKeyboard, Picker, Radio, RadioGroup, Range, Rate, SearchBar, ShortPassword, Signature, Switch, TextArea, Uploader, ActionSheet, Badge, Dialog, Drag, Empty,
|
|
185
|
+
export { Button, Cell, CellGroup, ConfigProvider, Image, Overlay, Col, Divider, Grid, GridItem, Layout, Row, Sticky, BackTop, Elevator, FixedNav, NavBar, SideNavBar, SideNavBarItem, SubSideNavBar, Tabbar, TabbarItem, TabPane, Tabs, Address, Calendar, CalendarItem, Cascader, Checkbox, CheckboxGroup, DatePicker, Form, FormItem, Input, InputNumber, Menu, MenuItem, NumberKeyboard, Picker, Radio, RadioGroup, Range, Rate, SearchBar, ShortPassword, Signature, Switch, TextArea, Uploader, ActionSheet, Badge, Dialog, Drag, Empty, InfiniteLoading, NoticeBar, Notify, Popover, PullToRefresh, Skeleton, Swipe, Popup, Toast, Animate, AnimatingNumbers, Audio, Avatar, AvatarGroup, CircleProgress, Collapse, CollapseItem, CountDown, Ellipsis, ImagePreview, Indicator, VirtualList, Pagination, Price, Progress, Step, Steps, Swiper, SwiperItem, Table, Tag, Video, Barrage, Card, TimeDetail, TimeSelect, TrendArrow, WaterMark };
|
|
@@ -52,7 +52,7 @@ import Badge from '@/packages/badge/index.taro';
|
|
|
52
52
|
import Dialog from '@/packages/dialog/index.taro';
|
|
53
53
|
import Drag from '@/packages/drag/index.taro';
|
|
54
54
|
import Empty from '@/packages/empty/index.taro';
|
|
55
|
-
import
|
|
55
|
+
import InfiniteLoading from '@/packages/infiniteloading/index.taro';
|
|
56
56
|
import NoticeBar from '@/packages/noticebar/index.taro';
|
|
57
57
|
import Notify from '@/packages/notify/index.taro';
|
|
58
58
|
import Popover from '@/packages/popover/index.taro';
|
|
@@ -90,4 +90,4 @@ import TimeDetail from '@/packages/timedetail/index.taro';
|
|
|
90
90
|
import TimeSelect from '@/packages/timeselect/index.taro';
|
|
91
91
|
import TrendArrow from '@/packages/trendarrow/index.taro';
|
|
92
92
|
import WaterMark from '@/packages/watermark/index.taro';
|
|
93
|
-
export { Button, Cell, CellGroup, ConfigProvider, Image, Overlay, Col, Divider, Grid, GridItem, Layout, Row, Sticky, BackTop, Elevator, FixedNav, NavBar, SideNavBar, SideNavBarItem, SubSideNavBar, Tabbar, TabbarItem, TabPane, Tabs, Address, Calendar, CalendarItem, Cascader, Checkbox, CheckboxGroup, DatePicker, Form, FormItem, Input, InputNumber, Menu, MenuItem, NumberKeyboard, Picker, Radio, RadioGroup, Range, Rate, SearchBar, ShortPassword, Signature, Switch, TextArea, Uploader, ActionSheet, Badge, Dialog, Drag, Empty,
|
|
93
|
+
export { Button, Cell, CellGroup, ConfigProvider, Image, Overlay, Col, Divider, Grid, GridItem, Layout, Row, Sticky, BackTop, Elevator, FixedNav, NavBar, SideNavBar, SideNavBarItem, SubSideNavBar, Tabbar, TabbarItem, TabPane, Tabs, Address, Calendar, CalendarItem, Cascader, Checkbox, CheckboxGroup, DatePicker, Form, FormItem, Input, InputNumber, Menu, MenuItem, NumberKeyboard, Picker, Radio, RadioGroup, Range, Rate, SearchBar, ShortPassword, Signature, Switch, TextArea, Uploader, ActionSheet, Badge, Dialog, Drag, Empty, InfiniteLoading, NoticeBar, Notify, Popover, PullToRefresh, Skeleton, Swipe, Popup, Toast, Animate, AnimatingNumbers, Audio, Avatar, AvatarGroup, CircleProgress, Collapse, CollapseItem, CountDown, Ellipsis, ImagePreview, Indicator, VirtualList, Pagination, Price, Progress, Step, Steps, Swiper, SwiperItem, Table, Tag, Video, Barrage, Card, TimeDetail, TimeSelect, TrendArrow, WaterMark };
|
|
@@ -13,7 +13,10 @@ export interface NotificationProps extends BasicComponent {
|
|
|
13
13
|
contentStyle?: React.CSSProperties;
|
|
14
14
|
onClose: () => void;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export interface NotificationState {
|
|
17
|
+
show: boolean;
|
|
18
|
+
}
|
|
19
|
+
export default class Notification extends React.PureComponent<NotificationProps, NotificationState> {
|
|
17
20
|
static newInstance: (properties: NotificationProps, callback: any) => void;
|
|
18
21
|
private closeTimer;
|
|
19
22
|
constructor(props: NotificationProps);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { i as isFunction } from "./index.js";
|
|
3
|
+
var getTargetElement = function getTargetElement2(target) {
|
|
4
|
+
var targetElement;
|
|
5
|
+
if (isFunction(target)) {
|
|
6
|
+
targetElement = target();
|
|
7
|
+
} else if ("current" in target) {
|
|
8
|
+
targetElement = target.current;
|
|
9
|
+
} else {
|
|
10
|
+
targetElement = target;
|
|
11
|
+
}
|
|
12
|
+
return targetElement;
|
|
13
|
+
};
|
|
14
|
+
function useClickAway(onClickAway, target) {
|
|
15
|
+
var eventName = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "click";
|
|
16
|
+
var isListener = arguments.length > 3 ? arguments[3] : void 0;
|
|
17
|
+
var outerVar = arguments.length > 4 ? arguments[4] : void 0;
|
|
18
|
+
var handler = function handler2(event) {
|
|
19
|
+
var targets = Array.isArray(target) ? target : [target];
|
|
20
|
+
if (targets.some(function(item) {
|
|
21
|
+
var targetElement = getTargetElement(item);
|
|
22
|
+
return !targetElement || targetElement.contains(event.target);
|
|
23
|
+
})) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (outerVar) {
|
|
27
|
+
onClickAway();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
useEffect(function() {
|
|
31
|
+
if (isListener) {
|
|
32
|
+
window.addEventListener(eventName, handler, false);
|
|
33
|
+
} else {
|
|
34
|
+
window.removeEventListener(eventName, handler, false);
|
|
35
|
+
}
|
|
36
|
+
return function() {
|
|
37
|
+
window.removeEventListener(eventName, handler, true);
|
|
38
|
+
};
|
|
39
|
+
}, [target]);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
useClickAway as u
|
|
43
|
+
};
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/tr-TR.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
package/dist/locales/zh-UG.js
CHANGED