Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3044: FileUpload expose onFileSelect #3132

Merged
merged 2 commits into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["next/babel"]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# next.js
/.next/
/out/
tsconfig.tsbuildinfo

# production
/dist
Expand Down
2 changes: 1 addition & 1 deletion components/lib/card/Card.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';

type CardTemplateTypes = React.ReactNode | ((props: CardProps) => React.ReactNode);

export interface CardProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'ref'> {
export interface CardProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'ref' | 'title'> {
header?: CardTemplateTypes;
footer?: CardTemplateTypes;
title?: CardTemplateTypes;
Expand Down
3 changes: 2 additions & 1 deletion components/lib/fileupload/FileUpload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ interface FileUploadRemoveParams {
}

interface FileUploadProps {
id?: string;
id?: void;
name?: string;
url?: string;
mode?: FileUploadModeType;
Expand Down Expand Up @@ -130,6 +130,7 @@ export declare class FileUpload extends React.Component<FileUploadProps, any> {
public upload(): void;
public clear(): void;
public formatSize(bytes: number): number;
public onFileSelect(event: FileUploadSelectParams): void;
public getElement(): HTMLElement;
public getInput(): HTMLInputElement;
}
1 change: 1 addition & 0 deletions components/lib/fileupload/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export const FileUpload = React.memo(React.forwardRef((props, ref) => {
upload,
clear,
formatSize,
onFileSelect,
getInput: () => fileInputRef.current,
getContent: () => contentRef.current
}));
Expand Down
4 changes: 2 additions & 2 deletions components/lib/inputmask/InputMask.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface InputMaskChangeParams {
target: InputMaskChangeTargetOptions;
}

export interface InputMaskProps extends InputTextProps {
export interface InputMaskProps extends Omit<InputTextProps, 'onChange'> {
mask?: string;
slotChar?: string;
autoClear?: boolean;
Expand All @@ -38,6 +38,6 @@ export interface InputMaskProps extends InputTextProps {
children?: React.ReactNode;
}

export declare class InputMask extends React.Component<InputMaskProps, any> {
export declare class InputMask extends React.Component<InputMaskProps, any> {
public getElement(): InputText;
}
3 changes: 1 addition & 2 deletions components/lib/inputnumber/InputNumber.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface InputNumberChangeParams {
value: number | null;
}

export interface InputNumberProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, 'ref'> {
export interface InputNumberProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, 'onChange' | 'ref'> {
value?: number | null;
inputRef?: React.Ref<HTMLInputElement>;
format?: boolean;
Expand Down Expand Up @@ -51,7 +51,6 @@ export interface InputNumberProps extends Omit<React.DetailedHTMLProps<React.HT
required?: boolean;
tabIndex?: number;
pattern?: string;
inputMode?: string;
placeholder?: string;
readOnly?: boolean;
size?: number;
Expand Down
2 changes: 1 addition & 1 deletion components/lib/listbox/ListBox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface ListBoxProps extends Omit<React.DetailedHTMLProps<React.InputHT
children?: React.ReactNode;
}

export declare class ListBox extends React.Component<ListBoxProps, any> {
export declare class ListBox extends React.Component<ListBoxProps, any> {
public getElement(): HTMLDivElement;
public getVirtualScroller(): VirtualScroller;
}
4 changes: 2 additions & 2 deletions components/lib/mention/Mention.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface MentionSelectParams {
suggestion: any;
}

export interface MentionProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange' | 'onInput' | 'onFocus' | 'onBlur' | 'ref'> {
export interface MentionProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onSelect' | 'onChange' | 'onInput' | 'onFocus' | 'onBlur' | 'ref'> {
inputId?: string;
inputRef?: React.Ref<HTMLInputElement>;
trigger?: MentionTriggerType;
Expand Down Expand Up @@ -56,7 +56,7 @@ export interface MentionProps extends Omit<React.DetailedHTMLProps<React.InputHT
children?: React.ReactNode;
}

export declare class Mention extends React.Component<MentionProps, any> {
export declare class Mention extends React.Component<MentionProps, any> {
public getElement(): HTMLDivElement;
public getInput(): InputTextarea;
public getOverlay(): HTMLElement;
Expand Down
4 changes: 2 additions & 2 deletions components/lib/steps/Steps.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ interface StepsSelectParams {
index: number;
}

export interface StepsProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'ref'> {
export interface StepsProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onSelect' | 'ref'> {
model: MenuItem[];
activeIndex?: number;
readOnly?: boolean;
onSelect?(e: StepsSelectParams): void;
children?: React.ReactNode;
}

export declare class Steps extends React.Component<StepsProps, any> {
export declare class Steps extends React.Component<StepsProps, any> {
public getElement(): HTMLDivElement;
}
2 changes: 1 addition & 1 deletion components/lib/tree/Tree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ interface TreeSelectionParams {
value: TreeSelectionKeys;
}

interface TreeEventNodeParams {
export interface TreeEventNodeParams {
originalEvent: React.SyntheticEvent;
node: TreeNode;
}
Expand Down
6 changes: 4 additions & 2 deletions components/lib/treeselect/TreeSelect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ interface TreeSelectCheckboxSelectionKeyType {
partialChecked?: boolean;
}

interface TreeSelectEventNodeParams extends TreeEventNodeParams {
interface TreeSelectEventNodeParams {
originalEvent: React.SyntheticEvent;
node: TreeNode;
}

interface TreeSelectFilterValueChangeParams {
Expand Down Expand Up @@ -112,6 +114,6 @@ export interface TreeSelectProps extends Omit<React.DetailedHTMLProps<React.Inpu
children?: React.ReactNode;
}

export declare class TreeSelect extends React.Component<TreeSelectProps, any> {
export declare class TreeSelect extends React.Component<TreeSelectProps, any> {
public getElement(): HTMLDivElement;
}
5 changes: 5 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
117 changes: 101 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"build-api": "node ./api-generator/build-api.js",
"security-check": "npm audit --production --audit-level high",
"start": "next start",
"lint": "next lint --max-warnings=0"
"lint": "next lint --max-warnings=0",
"type-check": "tsc"
},
"dependencies": {
"chart.js": "3.8.0",
Expand All @@ -36,12 +37,16 @@
"@babel/plugin-transform-runtime": "^7.18.6",
"@babel/preset-env": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@typescript-eslint/parser": "^5.21.0",
"@rollup/plugin-alias": "^3.1.2",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-replace": "^2.4.2",
"@types/node": "^18.6.4",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@types/react-transition-group": "^4.4.5",
"@typescript-eslint/parser": "^5.21.0",
"eslint": "8.18.0",
"eslint-config-next": "12.2.0",
"gulp": "^4.0.2",
Expand All @@ -53,6 +58,7 @@
"rollup": "^2.52.1",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-terser": "^7.0.2",
"sass": "^1.53.0"
"sass": "^1.53.0",
"typescript": "^4.7.4"
}
}
Loading