@nutui/nutui-react 2.0.19-beta.1 → 2.0.20-beta.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/esm/Button.js +84 -5
  3. package/dist/esm/Image.js +1 -1
  4. package/dist/esm/Uploader.js +191 -191
  5. package/dist/esm/formitem2.js +184 -78
  6. package/dist/esm/types/src/packages/uploader/demo.taro.d.ts +0 -15
  7. package/dist/esm/types/src/packages/uploader/file-item.d.ts +19 -0
  8. package/dist/esm/types/src/packages/uploader/index.d.ts +2 -1
  9. package/dist/esm/types/src/packages/uploader/index.taro.d.ts +2 -1
  10. package/dist/esm/types/src/packages/uploader/preview.d.ts +2 -0
  11. package/dist/esm/types/src/packages/uploader/preview.taro.d.ts +2 -0
  12. package/dist/esm/types/src/packages/uploader/upload.d.ts +3 -0
  13. package/dist/esm/types/src/packages/uploader/uploader.d.ts +5 -23
  14. package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +10 -26
  15. package/dist/locales/base.js +1 -1
  16. package/dist/locales/en-US.js +1 -1
  17. package/dist/locales/id-ID.js +1 -1
  18. package/dist/locales/tr-TR.js +1 -1
  19. package/dist/locales/zh-CN.js +1 -1
  20. package/dist/locales/zh-TW.js +1 -1
  21. package/dist/locales/zh-UG.js +1 -1
  22. package/dist/nutui.react.es.js +281 -300
  23. package/dist/nutui.react.umd.js +281 -300
  24. package/dist/style.mjs +1 -1
  25. package/dist/types/packages/calendar/calendar.d.ts +4 -4
  26. package/dist/types/packages/uploader/file-item.d.ts +19 -0
  27. package/dist/types/packages/uploader/index.d.ts +2 -1
  28. package/dist/types/packages/uploader/preview.d.ts +2 -0
  29. package/dist/types/packages/uploader/upload.d.ts +3 -0
  30. package/dist/types/packages/uploader/uploader.d.ts +5 -23
  31. package/package.json +1 -1
  32. package/dist/esm/button2.js +0 -87
package/dist/style.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.0.19-beta.1 Tue Sep 26 2023 19:08:45 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.0.20 Fri Oct 13 2023 14:01:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -111,22 +111,22 @@ export interface CalendarProps {
111
111
  renderDayBottom?: (date: Day) => string | JSX.Element
112
112
  /**
113
113
  * 关闭时触发
114
- * @default
114
+ * @default -
115
115
  */
116
116
  onClose?: () => void
117
117
  /**
118
118
  * 选择之后或是点击确认按钮触发
119
- * @default
119
+ * @default -
120
120
  */
121
121
  onConfirm?: (param: string) => void
122
122
  /**
123
123
  * 点击/选择后触发
124
- * @default
124
+ * @default -
125
125
  */
126
126
  onDayClick?: (data: string) => void
127
127
  /**
128
128
  * 年月子标题到达顶部时触发
129
- * @default
129
+ * @default -
130
130
  */
131
131
  onPageChange?: (param: string) => void
132
132
  }
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from 'react';
2
+ export declare class FileItem {
3
+ status: FileItemStatus;
4
+ message: string;
5
+ uid: string;
6
+ name?: string;
7
+ url?: string;
8
+ type?: string;
9
+ path?: string;
10
+ percentage?: string | number;
11
+ formData?: FormData;
12
+ responseText?: string;
13
+ loadingIcon?: ReactNode;
14
+ failIcon?: ReactNode;
15
+ }
16
+ export type FileItemStatus = 'ready' | 'uploading' | 'success' | 'error' | 'removed';
17
+ export type FileType<T> = {
18
+ [key: string]: T;
19
+ };
@@ -1,3 +1,4 @@
1
1
  import { Uploader } from './uploader';
2
- export type { FileType, FileItem, UploaderProps, FileItemStatus, } from './uploader';
2
+ export type { UploaderProps } from './uploader';
3
+ export type { FileType, FileItem, FileItemStatus } from './file-item';
3
4
  export default Uploader;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Preview: React.FunctionComponent<any>;
@@ -16,6 +16,9 @@ export declare class UploadOptions {
16
16
  onFailure?: any;
17
17
  beforeXhrUpload?: any;
18
18
  }
19
+ export declare const UPLOADING = "uploading";
20
+ export declare const SUCCESS = "success";
21
+ export declare const ERROR = "error";
19
22
  export declare class Upload {
20
23
  options: UploadOptions;
21
24
  constructor(options: UploadOptions);
@@ -1,10 +1,7 @@
1
1
  import React from 'react';
2
2
  import { UploadOptions } from './upload';
3
3
  import { BasicComponent } from '../../utils/typings';
4
- export type FileType<T> = {
5
- [key: string]: T;
6
- };
7
- export type FileItemStatus = 'ready' | 'uploading' | 'success' | 'error' | 'removed';
4
+ import { FileItem } from './file-item';
8
5
  export interface UploaderProps extends BasicComponent {
9
6
  /**
10
7
  * 上传服务器的接口地址
@@ -25,12 +22,12 @@ export interface UploaderProps extends BasicComponent {
25
22
  * 默认已经上传的文件列表
26
23
  * @default []
27
24
  */
28
- defaultValue?: FileType<React.ReactNode>[]
25
+ defaultValue?: FileItem[]
29
26
  /**
30
27
  * 已经上传的文件列表
31
28
  * @default []
32
29
  */
33
- value?: FileType<string>[]
30
+ value?: FileItem[]
34
31
  /**
35
32
  * 上传列表的内建样式,支持两种基本样式 picture、list
36
33
  * @default picture
@@ -125,7 +122,7 @@ export interface UploaderProps extends BasicComponent {
125
122
  * 图片[选取模式](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input#htmlattrdefcapture"),直接调起摄像头
126
123
  * @default false
127
124
  */
128
- capture: boolean
125
+ capture: boolean | 'user' | 'environment'
129
126
  className: string;
130
127
  /**
131
128
  * 当上传非图片('image')格式的默认图片地址
@@ -180,10 +177,7 @@ export interface UploaderProps extends BasicComponent {
180
177
  * 上传文件改变时的状态
181
178
  * @default -
182
179
  */
183
- onChange?: (param: {
184
- fileList: FileItem[];
185
- event: React.ChangeEvent<HTMLInputElement>;
186
- }) => void
180
+ onChange?: (p: FileItem[]) => void
187
181
  /**
188
182
  * 上传前的函数需要返回一个Promise对象
189
183
  * @default -
@@ -205,18 +199,6 @@ export interface UploaderProps extends BasicComponent {
205
199
  */
206
200
  onFileItemClick?: (file: FileItem) => void
207
201
  }
208
- export declare class FileItem {
209
- status: FileItemStatus;
210
- message: string;
211
- uid: string;
212
- name?: string;
213
- url?: string;
214
- type?: string;
215
- path?: string;
216
- percentage: string | number;
217
- formData: FormData;
218
- responseText?: string;
219
- }
220
202
  export declare const Uploader: React.ForwardRefExoticComponent<Partial<UploaderProps> & {
221
203
  children?: React.ReactNode;
222
204
  } & React.RefAttributes<unknown>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutui/nutui-react",
3
- "version": "2.0.19-beta.1",
3
+ "version": "2.0.20-beta.0",
4
4
  "style": "dist/style.css",
5
5
  "main": "dist/nutui.react.umd.js",
6
6
  "module": "dist/esm/nutui-react.es.js",
@@ -1,87 +0,0 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- var _excluded = ["color", "shape", "fill", "loading", "disabled", "type", "size", "block", "icon", "children", "onClick", "className", "style", "nativeType"];
4
- function ownKeys(object, enumerableOnly) {
5
- var keys = Object.keys(object);
6
- if (Object.getOwnPropertySymbols) {
7
- var symbols = Object.getOwnPropertySymbols(object);
8
- enumerableOnly && (symbols = symbols.filter(function(sym) {
9
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
10
- })), keys.push.apply(keys, symbols);
11
- }
12
- return keys;
13
- }
14
- function _objectSpread(target) {
15
- for (var i = 1; i < arguments.length; i++) {
16
- var source = null != arguments[i] ? arguments[i] : {};
17
- i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
18
- _defineProperty(target, key, source[key]);
19
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
20
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
21
- });
22
- }
23
- return target;
24
- }
25
- import React__default, { useCallback } from "react";
26
- import classNames from "classnames";
27
- import { Loading } from "@nutui/icons-react";
28
- import { C as ComponentDefaults } from "./typings.js";
29
- var prefixCls = "nut-button";
30
- var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
31
- color: "",
32
- type: "default",
33
- size: "normal",
34
- shape: "round",
35
- fill: "solid",
36
- loading: false,
37
- disabled: false,
38
- block: false,
39
- icon: null,
40
- nativeType: "button",
41
- onClick: function onClick(e) {
42
- }
43
- });
44
- var Button = React__default.forwardRef(function(props, ref) {
45
- var _classNames;
46
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), color = _defaultProps$props.color, shape = _defaultProps$props.shape, fill = _defaultProps$props.fill, loading = _defaultProps$props.loading, disabled = _defaultProps$props.disabled, type = _defaultProps$props.type, size = _defaultProps$props.size, block = _defaultProps$props.block, icon = _defaultProps$props.icon, children = _defaultProps$props.children, onClick2 = _defaultProps$props.onClick, className = _defaultProps$props.className, style = _defaultProps$props.style, nativeType = _defaultProps$props.nativeType, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
47
- var getStyle = useCallback(function() {
48
- var style2 = {};
49
- if (props.color) {
50
- if (fill && fill === "outline") {
51
- style2.color = color;
52
- style2.background = "#fff";
53
- if (!(color !== null && color !== void 0 && color.includes("gradient"))) {
54
- style2.borderColor = color;
55
- }
56
- } else {
57
- style2.color = "#fff";
58
- style2.background = color;
59
- }
60
- }
61
- return style2;
62
- }, [color]);
63
- var handleClick = function handleClick2(e) {
64
- if (!loading && !disabled && onClick2) {
65
- onClick2(e);
66
- }
67
- };
68
- return React__default.createElement("button", _objectSpread(_objectSpread({}, rest), {}, {
69
- ref,
70
- type: nativeType,
71
- className: classNames(prefixCls, className, props.type ? "".concat(prefixCls, "--").concat(type) : null, props.fill ? "".concat(prefixCls, "--").concat(fill) : null, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "--").concat(size), size), _defineProperty(_classNames, "".concat(prefixCls, "--").concat(shape), shape), _defineProperty(_classNames, "".concat(prefixCls, "--block"), block), _defineProperty(_classNames, "".concat(prefixCls, "--disabled"), disabled), _defineProperty(_classNames, "".concat(prefixCls, "--loading"), loading), _classNames)),
72
- style: _objectSpread(_objectSpread({}, getStyle()), style),
73
- onClick: function onClick3(e) {
74
- return handleClick(e);
75
- }
76
- }), React__default.createElement("div", {
77
- className: "nut-button__warp"
78
- }, loading ? React__default.createElement(Loading, {
79
- className: "nut-icon-loading"
80
- }) : null, !loading && icon ? icon : null, children && React__default.createElement("div", {
81
- className: icon || loading ? "nut-button-text" : ""
82
- }, children)));
83
- });
84
- Button.displayName = "NutButton";
85
- export {
86
- Button as B
87
- };