sti-antd-package 0.0.32 → 0.0.33

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.
@@ -1,8 +1,10 @@
1
1
  import { formColLayout } from "../../../constants";
2
2
  import { ValidateStatus } from "antd/es/form/FormItem";
3
3
  import { RcFile } from "antd/es/upload";
4
- import { UploadListType } from "antd/es/upload/interface";
4
+ import { UploadChangeParam, UploadFile, UploadListType } from "antd/es/upload/interface";
5
5
  import { Rule, RuleObject } from "rc-field-form/lib/interface";
6
+ import { UploadRequestOption } from "rc-upload/lib/interface";
7
+ type BeforeUploadValueType = void | boolean | string | Blob | File;
6
8
  export interface UploadDraggerComponentProps {
7
9
  noItem?: boolean;
8
10
  multiple?: boolean;
@@ -12,6 +14,12 @@ export interface UploadDraggerComponentProps {
12
14
  rootClassNames?: string[];
13
15
  classNames?: string[];
14
16
  action?: string | ((file: RcFile) => string) | ((file: RcFile) => PromiseLike<string>);
17
+ withCredentials?: boolean;
18
+ beforeUpload?: ((file: RcFile, fileList: RcFile[]) => BeforeUploadValueType | Promise<BeforeUploadValueType>);
19
+ customRequest?: (options: UploadRequestOption<any>) => void;
20
+ onChange?: (info: UploadChangeParam<UploadFile<any>>) => void;
21
+ onDrop?: (event: React.DragEvent<HTMLDivElement>) => void;
22
+ defaultFileList?: UploadFile<any>[];
15
23
  formColLayout?: typeof formColLayout;
16
24
  name?: string;
17
25
  label?: React.ReactNode;
@@ -22,3 +30,4 @@ export interface UploadDraggerComponentProps {
22
30
  validateStatus?: ValidateStatus;
23
31
  help?: React.ReactNode;
24
32
  }
33
+ export {};
package/dist/index.d.ts CHANGED
@@ -30,7 +30,8 @@ import { TableProps } from 'rc-table';
30
30
  import { GetRowKey, ExpandableConfig } from 'rc-table/lib/interface';
31
31
  import { TabsType, TabsPosition, TabsProps } from 'antd/es/tabs';
32
32
  import { RcFile } from 'antd/es/upload';
33
- import { UploadListType } from 'antd/es/upload/interface';
33
+ import { UploadListType, UploadChangeParam, UploadFile } from 'antd/es/upload/interface';
34
+ import { UploadRequestOption } from 'rc-upload/lib/interface';
34
35
  import { MessageInstance } from 'antd/es/message/interface';
35
36
  import { HookAPI } from 'antd/es/modal/useModal';
36
37
  import { NotificationInstance } from 'antd/es/notification/interface';
@@ -1100,6 +1101,7 @@ interface TextAreaComponentProps {
1100
1101
 
1101
1102
  declare const _default: React$1.NamedExoticComponent<TextAreaComponentProps>;
1102
1103
 
1104
+ type BeforeUploadValueType = void | boolean | string | Blob | File;
1103
1105
  interface UploadDraggerComponentProps {
1104
1106
  noItem?: boolean;
1105
1107
  multiple?: boolean;
@@ -1109,6 +1111,12 @@ interface UploadDraggerComponentProps {
1109
1111
  rootClassNames?: string[];
1110
1112
  classNames?: string[];
1111
1113
  action?: string | ((file: RcFile) => string) | ((file: RcFile) => PromiseLike<string>);
1114
+ withCredentials?: boolean;
1115
+ beforeUpload?: ((file: RcFile, fileList: RcFile[]) => BeforeUploadValueType | Promise<BeforeUploadValueType>);
1116
+ customRequest?: (options: UploadRequestOption<any>) => void;
1117
+ onChange?: (info: UploadChangeParam<UploadFile<any>>) => void;
1118
+ onDrop?: (event: React.DragEvent<HTMLDivElement>) => void;
1119
+ defaultFileList?: UploadFile<any>[];
1112
1120
  formColLayout?: typeof _default$i;
1113
1121
  name?: string;
1114
1122
  label?: React.ReactNode;
package/dist/index.esm.js CHANGED
@@ -23510,28 +23510,13 @@ const normFile = (event) => {
23510
23510
  return event;
23511
23511
  return event && event['fileList'];
23512
23512
  };
23513
- const UploadDraggerComponent = ({ noItem, readonly, multiple, disabled, listType, rootClassNames, classNames, action, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, }) => {
23513
+ const UploadDraggerComponent = ({ noItem, readonly, multiple, disabled, listType, rootClassNames, classNames, action, withCredentials, beforeUpload, customRequest, onChange, onDrop, defaultFileList, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, }) => {
23514
23514
  const rootClassDragger = [];
23515
23515
  rootClassNames && rootClassDragger.push(...rootClassNames);
23516
23516
  const classDragger = [];
23517
23517
  classNames && classDragger.push(...classNames);
23518
23518
  readonly && classDragger.push(styleDragger['readonly']);
23519
- const onChange = (info) => {
23520
- const { status } = info.file;
23521
- if (status !== 'uploading') {
23522
- console.log(info.file, info.fileList);
23523
- }
23524
- if (status === 'done') {
23525
- message.success(`${info.file.name} file uploaded successfully.`);
23526
- }
23527
- else if (status === 'error') {
23528
- message.error(`${info.file.name} file upload failed.`);
23529
- }
23530
- };
23531
- const onDrop = (e) => {
23532
- console.log('Dropped files', e.dataTransfer.files);
23533
- };
23534
- const dragger = (jsxRuntimeExports.jsxs(Dragger, { multiple: multiple, disabled: disabled || readonly, listType: listType, rootClassName: rootClassDragger.join(' '), className: classDragger.join(' '), action: action, onChange: onChange, onDrop: onDrop, children: [jsxRuntimeExports.jsx("p", { className: "ant-upload-drag-icon", children: jsxRuntimeExports.jsx(RefIcon$6, {}) }), jsxRuntimeExports.jsx("p", { className: "ant-upload-text", children: "Click or drag file to this area to upload" }), jsxRuntimeExports.jsx("p", { className: "ant-upload-hint", children: "Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files." })] }));
23519
+ const dragger = (jsxRuntimeExports.jsxs(Dragger, { multiple: multiple, disabled: disabled || readonly, listType: listType, rootClassName: rootClassDragger.join(' '), className: classDragger.join(' '), action: action, withCredentials: withCredentials, beforeUpload: beforeUpload, customRequest: customRequest, onChange: onChange, onDrop: onDrop, defaultFileList: defaultFileList, children: [jsxRuntimeExports.jsx("p", { className: "ant-upload-drag-icon", children: jsxRuntimeExports.jsx(RefIcon$6, {}) }), jsxRuntimeExports.jsx("p", { className: "ant-upload-text", children: "Click or drag file to this area to upload" }), jsxRuntimeExports.jsx("p", { className: "ant-upload-hint", children: "Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files." })] }));
23535
23520
  return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !noItem ? (jsxRuntimeExports.jsx(FormItemComponent$1, Object.assign({}, formColLayout, { name: name, label: label, required: required, ruleType: ruleType, ruleMessage: ruleMessage, rules: rules, valuePropName: "fileList", getValueFromEvent: normFile, validateStatus: validateStatus, help: help, children: dragger })))
23536
23521
  : dragger }));
23537
23522
  };
package/dist/index.js CHANGED
@@ -23529,28 +23529,13 @@ const normFile = (event) => {
23529
23529
  return event;
23530
23530
  return event && event['fileList'];
23531
23531
  };
23532
- const UploadDraggerComponent = ({ noItem, readonly, multiple, disabled, listType, rootClassNames, classNames, action, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, }) => {
23532
+ const UploadDraggerComponent = ({ noItem, readonly, multiple, disabled, listType, rootClassNames, classNames, action, withCredentials, beforeUpload, customRequest, onChange, onDrop, defaultFileList, formColLayout, name, label, required, rules, ruleType, ruleMessage, validateStatus, help, }) => {
23533
23533
  const rootClassDragger = [];
23534
23534
  rootClassNames && rootClassDragger.push(...rootClassNames);
23535
23535
  const classDragger = [];
23536
23536
  classNames && classDragger.push(...classNames);
23537
23537
  readonly && classDragger.push(styleDragger['readonly']);
23538
- const onChange = (info) => {
23539
- const { status } = info.file;
23540
- if (status !== 'uploading') {
23541
- console.log(info.file, info.fileList);
23542
- }
23543
- if (status === 'done') {
23544
- antd.message.success(`${info.file.name} file uploaded successfully.`);
23545
- }
23546
- else if (status === 'error') {
23547
- antd.message.error(`${info.file.name} file upload failed.`);
23548
- }
23549
- };
23550
- const onDrop = (e) => {
23551
- console.log('Dropped files', e.dataTransfer.files);
23552
- };
23553
- const dragger = (jsxRuntimeExports.jsxs(Dragger, { multiple: multiple, disabled: disabled || readonly, listType: listType, rootClassName: rootClassDragger.join(' '), className: classDragger.join(' '), action: action, onChange: onChange, onDrop: onDrop, children: [jsxRuntimeExports.jsx("p", { className: "ant-upload-drag-icon", children: jsxRuntimeExports.jsx(RefIcon$6, {}) }), jsxRuntimeExports.jsx("p", { className: "ant-upload-text", children: "Click or drag file to this area to upload" }), jsxRuntimeExports.jsx("p", { className: "ant-upload-hint", children: "Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files." })] }));
23538
+ const dragger = (jsxRuntimeExports.jsxs(Dragger, { multiple: multiple, disabled: disabled || readonly, listType: listType, rootClassName: rootClassDragger.join(' '), className: classDragger.join(' '), action: action, withCredentials: withCredentials, beforeUpload: beforeUpload, customRequest: customRequest, onChange: onChange, onDrop: onDrop, defaultFileList: defaultFileList, children: [jsxRuntimeExports.jsx("p", { className: "ant-upload-drag-icon", children: jsxRuntimeExports.jsx(RefIcon$6, {}) }), jsxRuntimeExports.jsx("p", { className: "ant-upload-text", children: "Click or drag file to this area to upload" }), jsxRuntimeExports.jsx("p", { className: "ant-upload-hint", children: "Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files." })] }));
23554
23539
  return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !noItem ? (jsxRuntimeExports.jsx(FormItemComponent$1, Object.assign({}, formColLayout, { name: name, label: label, required: required, ruleType: ruleType, ruleMessage: ruleMessage, rules: rules, valuePropName: "fileList", getValueFromEvent: normFile, validateStatus: validateStatus, help: help, children: dragger })))
23555
23540
  : dragger }));
23556
23541
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sti-antd-package",
3
3
  "description": "STI ANT Design",
4
- "version": "0.0.32",
4
+ "version": "0.0.33",
5
5
  "type": "module",
6
6
  "module": "dist/index.esm.js",
7
7
  "types": "dist/index.d.ts",