Skip to content

Commit

Permalink
fix: 🐛 typo and type fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaochao.yang committed Jan 19, 2024
1 parent 8d3911b commit 186e0ec
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 96 deletions.
Binary file modified bun.lockb
Binary file not shown.
43 changes: 0 additions & 43 deletions docs/style.css
Original file line number Diff line number Diff line change
@@ -1,43 +0,0 @@
.rspress-doc-container > div > div {
width: 100% !important;
}

.rspress-doc {
width: 100% !important;
max-width: unset !important;
padding: 0 !important;
}

.rspress-preview-code-show {
margin-top: -24px !important;
}
.rspress-doc div[class^=language-] {
border: 1px dashed var(--rp-code-block-bg) !important;
border-radius: 0 !important;
border-top: 0 !important;
}

// to fix FormButtonGroup sticky
.rspress-preview-card > div {
overflow: unset !important;
}

.rspress-preview-card {
padding: 12px !important;
border-radius: 0px !important;
border-color: var(--rp-code-block-bg) !important;
flex-direction: column;
}

.rspress-preview-operations.web {
justify-content: flex-end !important;
align-items: flex-end !important;
}

button, html [type="button"], [type="reset"], [type="submit"] {
-webkit-appearance: button;
}

img {
display: inline-block;
}
2 changes: 1 addition & 1 deletion scripts/switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const docs = (() => {
const list = {
ui: [`"antd"`, `"antd"`, `"@arco-design/web-react"`],
formily: [`@formily/antd"`, `@formily/antd-v5"`, `arco.formily"`],
pkg: [`@pro.formily/antd"`, `@pro.fromily/antd-v5"`, `@pro.formily/arco"`],
pkg: [`@pro.formily/antd"`, `@pro.formily/antd-v5"`, `@pro.formily/arco"`],
base: [
`/pro.formily/antd/"`,
`/pro.formily/antd-v5/"`,
Expand Down
2 changes: 0 additions & 2 deletions src/dict/colors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { BadgeProps } from "../adaptor/index";

export type PickArrayItem<T> = T extends (infer P)[] ? P : unknown;

const statusColors = {
Expand Down
1 change: 0 additions & 1 deletion src/dict/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export const registerDictLoader = (
return loaderFactory().then((list) => {
const mydict = listToDict(list);
memo[name] = mydict;
console.log("🚀 ~ returnloaderFactory ~ memo[name:", name, memo[name]);
return memo[name];
});
};
Expand Down
1 change: 0 additions & 1 deletion src/linkage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export const Linkage = observer(
loadData([])
.then((options) => {
state.options = options;
console.log("🚀 ~ .then ~ options:", options);
const values = value.map((x) => x);
state.loading = true;
return all
Expand Down
2 changes: 1 addition & 1 deletion src/long-text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const LongText: React.FC<
return (
<Paragraph
copyable={{
tooltips: [props.value],
tooltips: [props.value, "复制成功"],
}}
ellipsis
{...props}
Expand Down
10 changes: 5 additions & 5 deletions src/pro-array-table/features/expandable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { createContext, useEffect, useRef, useState } from "react";
import { useExpandRender } from "../hooks";
import { ProArrayTableProps, RowKey } from "../types";
import { ProArrayTableProps, RowKey, RowKeyFn } from "../types";

export type IExpandableProps = Required<ProArrayTableProps>["expandable"] & {};

Expand All @@ -9,8 +9,8 @@ function expandedSchameRowRender(record: any, index: number) {
}

export interface ITableExpandableContext {
expandedRowKeys: React.Key[];
setExpandedRowKeys: React.Dispatch<React.SetStateAction<React.Key[]>>;
expandedRowKeys: RowKey[];
setExpandedRowKeys: React.Dispatch<React.SetStateAction<RowKey[]>>;
}

export const TableExpandableContext = createContext<ITableExpandableContext>({
Expand All @@ -21,13 +21,13 @@ export const TableExpandableContext = createContext<ITableExpandableContext>({
export const useExpandable = (
props: IExpandableProps | undefined,
dataSlice: any[],
rowKeyRef: React.MutableRefObject<RowKey>,
rowKeyRef: React.MutableRefObject<RowKeyFn>,
pageNo?: number,
) => {
const [keys, setKeys] = useState([
...(props?.expandedRowKeys ?? []),
...(props?.defaultExpandedRowKeys ?? []),
]);
] as RowKey[]);
const inited = useRef(false);

const expandAll = () => {
Expand Down
1 change: 0 additions & 1 deletion src/pro-array-table/features/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export const usePagination = (
},
} as IPaginationProps)
: null;
console.log("🚀 ~ usePagination props:", props);

return [ctx, merged] as const;
};
7 changes: 4 additions & 3 deletions src/pro-array-table/features/row-selection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { createContext, useEffect, useState } from "react";
import { ProArrayTableProps } from "../types";
import { ProArrayTableProps, RowKey } from "../types";

export type IRowSelectionProps = ProArrayTableProps["rowSelection"];

Expand All @@ -9,8 +9,8 @@ export type IRowSelectionOptions = Exclude<
>;

export interface ITableSelectionContext {
selectedRowKeys: React.Key[];
setSelectedRowKeys: React.Dispatch<React.SetStateAction<React.Key[]>>;
selectedRowKeys: RowKey[];
setSelectedRowKeys: React.Dispatch<React.SetStateAction<RowKey[]>>;
}

export const TableRowSelectionContext = createContext<ITableSelectionContext>({
Expand All @@ -23,6 +23,7 @@ export const useRowSelection = (
pageNo?: number,
) => {
const [keys, setKeys] = useState([
// @ts-ignore for arco
...(propRowSelection?.defaultSelectedRowKeys ?? []),
...(propRowSelection?.selectedRowKeys ?? []),
]);
Expand Down
1 change: 1 addition & 0 deletions src/pro-array-table/mixin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Addition: ArrayBaseMixins["Addition"] = observer((props) => {
const page = useContext(TablePaginationContext);
return (
<ArrayBase.Addition
// @ts-ignore
block={false}
type={BUTTON_TYPE}
{...props}
Expand Down
11 changes: 8 additions & 3 deletions src/pro-array-table/types.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { FieldDisplayTypes, GeneralField } from "@formily/core";
import { Schema } from "@formily/json-schema";
import type { TableProps } from "../adaptor";
import type { Table } from "../adaptor";

type TableChangeParams = Parameters<Required<TableProps<any>>["onChange"]>;
type TableProps<T> = React.ComponentProps<typeof Table>;

export type TableChangeParams = Parameters<
Required<TableProps<any>>["onChange"]
>;

type RequiredTableProps = Required<TableProps<any>>;

export type ColumnProps<T> = Required<TableProps<T>>["columns"][0];
export type ColumnType<T> = Required<TableProps<T>>["columns"];
export type RowKey = string | ((row: any) => React.Key);
export type RowKeyFn = string | ((row: any) => React.Key);
export type RowKey = React.Key;

export type IChangeData = {
pagination: TableChangeParams[0];
Expand Down
11 changes: 1 addition & 10 deletions src/query-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import React, {
useState,
} from "react";
import { noop } from "../__builtins__";
import type { TableProps } from "../adaptor";

type TableChangeParams = Parameters<Required<TableProps<any>>["onChange"]>;
import { TableChangeParams } from "../pro-array-table/types";

export type IQueryListParams<Params = any> = {
pagination?: TableChangeParams[0];
Expand Down Expand Up @@ -142,13 +140,6 @@ export const QueryList = React.memo<React.PropsWithChildren<IQueryListProps>>(
s.componentProps.pagination.total = resp.total;
});
}
// console.log(
// "🚀 ~ .then ~ this.table?.componentProps:",
// this.table?.componentProps,
// );
// if (this.table?.componentProps?.pagination) {
// this.table.componentProps.pagination.total = resp.total;
// }
return resp;
})
.catch((e) => {
Expand Down
3 changes: 2 additions & 1 deletion src/suggestion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ export const Suggestion: React.FC<{
<Select
showSearch
loading={loading}
value={value}
value={value as any}
labelInValue={props.labelInValue}
mode={props.multiple ? "multiple" : undefined}
placeholder={props.placeholder}
style={props.style}
disabled={props.disabled}
defaultActiveFirstOption={false}
// @ts-ignore
showArrow={false}
filterOption={false}
onSearch={handleSearch}
Expand Down
1 change: 0 additions & 1 deletion ui/antd-v5/features/table-resizeable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export class ResizableTitle extends React.Component<
export const useResizeHeader = (opts: {
enable?: boolean;
}) => {
console.log("🚀 ~ opts.enable:", opts.enable);
const header: Required<TableProps<any>>["components"]["header"] = opts.enable
? { cell: ResizableTitle }
: {};
Expand Down
10 changes: 1 addition & 9 deletions ui/antd-v5/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@ export {
Typography,
} from "antd";

export type {
BadgeProps,
CascaderProps,
DrawerProps,
ModalProps,
PopconfirmProps,
TablePaginationConfig,
TableProps,
} from "antd";
export type { TablePaginationConfig } from "antd";
export * from "./features/table-resizeable";
export * from "./features/table-sortable";
export const BUTTON_TYPE = "link";
2 changes: 1 addition & 1 deletion ui/antd/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import "antd/lib/tag/style/index";
import "antd/lib/typography/style/index";
import "./themes/index";

export type { TablePaginationConfig, TableProps } from "antd";
export type { TablePaginationConfig } from "antd";
export * from "./features/table-resizeable";
export * from "./features/table-sortable";
export const BUTTON_TYPE = "link";
20 changes: 11 additions & 9 deletions ui/arco/commonfiy/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ export interface TableProps<T>
onExpand?: ArcoTableProps<T>["onExpand"];
onExpandedRowsChange?: ArcoTableProps<T>["onExpandedRowsChange"];
};
pagination: Omit<
Exclude<Required<ArcoTableProps<T>>["pagination"], boolean>,
"onPageSizeChange"
> & {
onShowSizeChange?: Exclude<
Required<ArcoTableProps<T>>["pagination"],
boolean
>["onPageSizeChange"];
};
pagination:
| (Omit<
Exclude<Required<ArcoTableProps<T>>["pagination"], boolean>,
"onPageSizeChange"
> & {
onShowSizeChange?: Exclude<
Required<ArcoTableProps<T>>["pagination"],
boolean
>["onPageSizeChange"];
})
| false;
rowSelection?: Omit<
Required<ArcoTableProps<T>>["rowSelection"],
"onChange"
Expand Down
3 changes: 0 additions & 3 deletions ui/arco/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ export {
Space,
Tag,
} from "@arco-design/web-react";
export type { BadgeProps } from "@arco-design/web-react";
export const Row = Grid.Row;

export type { TableProps } from "./commonfiy/table";

export type TablePaginationConfig = PaginationProps;

export const BUTTON_TYPE = "text";
Expand Down
2 changes: 1 addition & 1 deletion ui/arco/themes/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "./array-table-pro/style";
import "./pro-array-table/style";
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 186e0ec

Please sign in to comment.