listpage-next 0.0.192 → 0.0.193

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 (52) hide show
  1. package/dist/components/AsyncSelect/index.d.ts +1 -1
  2. package/dist/components/FilterGroup/components/FilterItem/index.d.ts +1 -1
  3. package/dist/components/FilterGroup/components/FilterItem/index.js +2 -2
  4. package/dist/components/FilterGroup/index.d.ts +1 -2
  5. package/dist/components/PageLayout/components/PageLayout/index.js +1 -1
  6. package/dist/components/index.d.ts +9 -0
  7. package/dist/components/index.js +9 -0
  8. package/dist/features/ChatClient/ui/ChatDialog/useExtra.d.ts +1 -1
  9. package/dist/features/ListPage/components/DataTable/index.js +1 -1
  10. package/dist/features/ListPage/components/DataTable/renders/switch.js +1 -1
  11. package/dist/features/ListPage/types.d.ts +2 -2
  12. package/dist/index.d.ts +2 -10
  13. package/dist/index.js +2 -10
  14. package/package.json +1 -1
  15. package/dist/components/DataTable/components/DataTable.d.ts +0 -7
  16. package/dist/components/DataTable/components/DataTable.js +0 -85
  17. package/dist/components/DataTable/components/Render.d.ts +0 -17
  18. package/dist/components/DataTable/components/Render.js +0 -15
  19. package/dist/components/DataTable/hooks/useColumns.d.ts +0 -3
  20. package/dist/components/DataTable/hooks/useColumns.js +0 -9
  21. package/dist/components/DataTable/hooks/useData.d.ts +0 -20
  22. package/dist/components/DataTable/hooks/useData.js +0 -56
  23. package/dist/components/DataTable/index.d.ts +0 -2
  24. package/dist/components/DataTable/index.js +0 -1
  25. package/dist/components/DataTable/typings/index.d.ts +0 -25
  26. package/dist/components/DataTable/typings/index.js +0 -1
  27. package/dist/components/DataTable/typings/render.d.ts +0 -24
  28. package/dist/components/DataTable/typings/render.js +0 -0
  29. package/dist/components/DataTable/utils/render.d.ts +0 -2
  30. package/dist/components/DataTable/utils/render.js +0 -103
  31. package/dist/context/float.d.ts +0 -19
  32. package/dist/context/float.js +0 -59
  33. package/dist/context/index.d.ts +0 -1
  34. package/dist/context/index.js +0 -2
  35. package/dist/features/ListPage/components/DataTable/utils/render.d.ts +0 -2
  36. package/dist/features/ListPage/components/DataTable/utils/render.js +0 -25
  37. /package/dist/{http-client → api}/client/base_url.d.ts +0 -0
  38. /package/dist/{http-client → api}/client/base_url.js +0 -0
  39. /package/dist/{http-client → api}/client/client.d.ts +0 -0
  40. /package/dist/{http-client → api}/client/client.js +0 -0
  41. /package/dist/{http-client → api}/client/headers.d.ts +0 -0
  42. /package/dist/{http-client → api}/client/headers.js +0 -0
  43. /package/dist/{http-client → api}/client/index.d.ts +0 -0
  44. /package/dist/{http-client → api}/client/index.js +0 -0
  45. /package/dist/{http-client → api}/client/token.d.ts +0 -0
  46. /package/dist/{http-client → api}/client/token.js +0 -0
  47. /package/dist/{http-client → api}/client/types.d.ts +0 -0
  48. /package/dist/{http-client → api}/client/types.js +0 -0
  49. /package/dist/{http-client → api}/index.d.ts +0 -0
  50. /package/dist/{http-client → api}/index.js +0 -0
  51. /package/dist/{http-client → api}/types.d.ts +0 -0
  52. /package/dist/{http-client → api}/types.js +0 -0
@@ -1,5 +1,5 @@
1
1
  import { SelectProps } from 'antd';
2
- import { PaginationData } from '../../http-client';
2
+ import { PaginationData } from '../../api';
3
3
  type BaseOption = {
4
4
  label: string;
5
5
  value: string;
@@ -1,5 +1,5 @@
1
- import { FormItemProps } from 'antd';
2
1
  import { ReactElement, ReactNode } from 'react';
2
+ import { FormItemProps } from 'antd';
3
3
  export interface FilterItemProps {
4
4
  label?: ReactNode;
5
5
  children: ReactElement;
@@ -1,8 +1,8 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { Form, Input } from "antd";
3
- import { LabelInline, LabelWrapper } from "../LabelWrapper/index.js";
4
2
  import { cloneElement, useState } from "react";
3
+ import { Form, Input } from "antd";
5
4
  import { omit } from "lodash";
5
+ import { LabelInline, LabelWrapper } from "../LabelWrapper/index.js";
6
6
  const FilterItem = (props)=>{
7
7
  const { label, children, formItemProps, labelInline } = props;
8
8
  const [focus, setFocus] = useState(false);
@@ -1,4 +1,3 @@
1
- export { FilterForm } from './components/FilterForm';
2
- export type { FilterFormOption } from './components/FilterForm';
1
+ export { FilterForm, type FilterFormOption } from './components/FilterForm';
3
2
  export { FilterGroup, type FilterGroupProps } from './components/FilterGroup';
4
3
  export { cleanUpFormValues } from './utils/format';
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useImperativeHandle } from "react";
2
3
  import { Layout } from "antd";
3
4
  import { styled } from "styled-components";
4
5
  import { PageSider } from "../PageSider/index.js";
5
6
  import { PageHeader } from "../PageHeader/index.js";
6
7
  import { PageContent } from "../PageContent/index.js";
7
8
  import { PageProvider, usePageContext } from "../PageProvider/index.js";
8
- import { useImperativeHandle } from "react";
9
9
  const PageLayoutComponent = (props)=>{
10
10
  const { siderProps, sider, header, content, logo, pageRef } = props;
11
11
  const context = usePageContext();
@@ -0,0 +1,9 @@
1
+ export * from './AsyncSelect';
2
+ export * from './AsyncButton';
3
+ export * from './AsyncSwitch';
4
+ export * from './CheckButton';
5
+ export * from './InfiniteList';
6
+ export * from './Menu';
7
+ export * from './TextOverflow';
8
+ export * from './PageLayout';
9
+ export * from './FilterGroup';
@@ -0,0 +1,9 @@
1
+ export * from "./AsyncSelect/index.js";
2
+ export * from "./AsyncButton/index.js";
3
+ export * from "./AsyncSwitch/index.js";
4
+ export * from "./CheckButton/index.js";
5
+ export * from "./InfiniteList/index.js";
6
+ export * from "./Menu/index.js";
7
+ export * from "./TextOverflow/index.js";
8
+ export * from "./PageLayout/index.js";
9
+ export * from "./FilterGroup/index.js";
@@ -9,4 +9,4 @@ export interface ExtraOptions {
9
9
  clear: ReactNode;
10
10
  }) => ReactNode[];
11
11
  }
12
- export declare function useExtra(options: ExtraOptions): import("react/jsx-runtime").JSX.Element[] | ReactNode[];
12
+ export declare function useExtra(options: ExtraOptions): ReactNode[] | import("react/jsx-runtime").JSX.Element[];
@@ -1,10 +1,10 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Card, Table } from "antd";
3
3
  import { observer } from "mobx-react-lite";
4
- import { useListPageStore } from "../../context/index.js";
5
4
  import { usePagination } from "../../hooks/usePagination.js";
6
5
  import { useColumns } from "../../hooks/useColumns.js";
7
6
  import { useSelectionTools } from "../../hooks/useSelectionTools.js";
7
+ import { useListPageStore } from "../../context/index.js";
8
8
  import { TableContainer } from "../../styles.js";
9
9
  const DataTable = observer((props)=>{
10
10
  const { title, extra, columns = [], rowTitleKey, rowSelectionType, tableProps } = props;
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { AsyncSwitch } from "../../../../../components/AsyncSwitch/index.js";
2
+ import { AsyncSwitch } from "../../../../../components/index.js";
3
3
  const switchRender = (value, record, index, props)=>/*#__PURE__*/ jsx(AsyncSwitch, {
4
4
  defaultValue: value,
5
5
  ...props,
@@ -1,7 +1,7 @@
1
1
  import { JSX, ReactNode } from 'react';
2
- import { FilterFormOption } from '../../components/FilterGroup';
2
+ import { BaseQueryParams, PaginationData } from '../../api';
3
+ import { FilterFormOption } from '../../components';
3
4
  import type { ListPageStore } from './context';
4
- import { BaseQueryParams, PaginationData } from '../../http-client';
5
5
  import type { FloatComponentProps } from '../../components/PageLayout/components/PageProvider/float';
6
6
  export type StateValue<FilterValue = any> = {
7
7
  filterValues?: FilterValue;
package/dist/index.d.ts CHANGED
@@ -1,14 +1,6 @@
1
1
  import '@ant-design/v5-patch-for-react-19';
2
- export * from './components/FilterGroup';
3
- export * from './components/InfiniteList';
4
- export * from './components/Menu';
5
- export * from './components/DataTable';
6
- export * from './components/AsyncSelect';
7
- export * from './components/AsyncButton';
8
- export * from './components/TextOverflow';
9
- export * from './components/PageLayout';
10
- export * from './components/CheckButton';
2
+ export * from './components';
3
+ export * from './api';
11
4
  export * from './features/JsonEditor';
12
5
  export * from './features/ChatClient';
13
6
  export * from './features/ListPage';
14
- export * from './http-client';
package/dist/index.js CHANGED
@@ -1,14 +1,6 @@
1
1
  import "@ant-design/v5-patch-for-react-19";
2
- export * from "./components/FilterGroup/index.js";
3
- export * from "./components/InfiniteList/index.js";
4
- export * from "./components/Menu/index.js";
5
- export * from "./components/DataTable/index.js";
6
- export * from "./components/AsyncSelect/index.js";
7
- export * from "./components/AsyncButton/index.js";
8
- export * from "./components/TextOverflow/index.js";
9
- export * from "./components/PageLayout/index.js";
10
- export * from "./components/CheckButton/index.js";
2
+ export * from "./components/index.js";
3
+ export * from "./api/index.js";
11
4
  export * from "./features/JsonEditor/index.js";
12
5
  export * from "./features/ChatClient/index.js";
13
6
  export * from "./features/ListPage/index.js";
14
- export * from "./http-client/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.192",
3
+ "version": "0.0.193",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,7 +0,0 @@
1
- import { Ref } from 'react';
2
- import { DataTableContext, DataTableProps } from '../typings';
3
- export declare const PaginationContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
- export declare const TableContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
- export declare const DataTable: <Record = any>(props: DataTableProps<Record> & {
6
- tableRef?: Ref<DataTableContext>;
7
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,85 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useImperativeHandle } from "react";
3
- import { Card, Pagination, Table } from "antd";
4
- import styled_components from "styled-components";
5
- import { useColumns } from "../hooks/useColumns.js";
6
- import { useData } from "../hooks/useData.js";
7
- import { FloatProvider, useFloatContext } from "../../../context/index.js";
8
- const PaginationContainer = styled_components.div`
9
- padding: 12px 16px 12px 0;
10
- border-top: 1px solid #f0f0f0;
11
- `;
12
- const TableContainer = styled_components.div`
13
- table {
14
- tr:last-child {
15
- td {
16
- border-bottom: none;
17
- }
18
- }
19
- }
20
- `;
21
- const DataTableComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
22
- const { title, extra, dataSource, request, refreshDeps, ...restProps } = props;
23
- const { data, loading, pagination, onPaginationChange, refresh } = useData({
24
- dataSource,
25
- request,
26
- refreshDeps,
27
- pagination: restProps.pagination
28
- });
29
- const floatCtx = useFloatContext();
30
- const actions = {
31
- refresh
32
- };
33
- const ctx = {
34
- ...floatCtx,
35
- ...actions
36
- };
37
- useImperativeHandle(ref, ()=>ctx, [
38
- ctx
39
- ]);
40
- const columns = useColumns(props, ctx);
41
- return /*#__PURE__*/ jsxs(Card, {
42
- title: title,
43
- extra: extra,
44
- styles: {
45
- body: {
46
- padding: 0
47
- }
48
- },
49
- children: [
50
- /*#__PURE__*/ jsx(TableContainer, {
51
- children: /*#__PURE__*/ jsx(Table, {
52
- bordered: false,
53
- loading: loading,
54
- ...restProps,
55
- columns: columns,
56
- dataSource: data,
57
- pagination: false
58
- })
59
- }),
60
- false !== restProps.pagination && /*#__PURE__*/ jsx(PaginationContainer, {
61
- children: /*#__PURE__*/ jsx(Pagination, {
62
- align: "end",
63
- ...pagination,
64
- ...restProps?.pagination,
65
- onChange: onPaginationChange
66
- })
67
- })
68
- ]
69
- });
70
- });
71
- const DataTable = (props)=>{
72
- const { tableRef, ...restProps } = props;
73
- if (!props.floats) return /*#__PURE__*/ jsx(DataTableComponent, {
74
- ...restProps,
75
- ref: tableRef
76
- });
77
- return /*#__PURE__*/ jsx(FloatProvider, {
78
- floats: props.floats,
79
- children: /*#__PURE__*/ jsx(DataTableComponent, {
80
- ...restProps,
81
- ref: tableRef
82
- })
83
- });
84
- };
85
- export { DataTable, PaginationContainer, TableContainer };
@@ -1,17 +0,0 @@
1
- import { JSX } from 'react';
2
- export interface RenderProps<T, Record, C> {
3
- ctx: C;
4
- defaultValue: T;
5
- record: Record;
6
- index: number;
7
- render: (props: UserRenderComponentProps<T, Record, C>) => JSX.Element;
8
- }
9
- export type UserRenderComponentProps<T, Record, C> = {
10
- ctx: C;
11
- value: T;
12
- onChange: (v: T) => void;
13
- record: Record;
14
- index: number;
15
- };
16
- export type ColumnRender<R, C = any> = <T = any>(props: UserRenderComponentProps<T, R, C>) => JSX.Element;
17
- export declare const Render: <T = any, Record = any, C = any>(props: RenderProps<C, T, Record>) => import("react/jsx-runtime").JSX.Element;
@@ -1,15 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useControllableValue } from "ahooks";
3
- import { toJS } from "mobx";
4
- const Render = (props)=>{
5
- const { render: Component, record, index, ctx } = props;
6
- const [value, onChange] = useControllableValue(props);
7
- return /*#__PURE__*/ jsx(Component, {
8
- value: value,
9
- onChange: onChange,
10
- record: toJS(record),
11
- index: index,
12
- ctx: ctx
13
- });
14
- };
15
- export { Render };
@@ -1,3 +0,0 @@
1
- import { ColumnType } from 'antd/es/table';
2
- import { DataTableContext, DataTableProps } from '../typings';
3
- export declare function useColumns<Record>(props: DataTableProps<Record>, ctx: DataTableContext): ColumnType<Record>[];
@@ -1,9 +0,0 @@
1
- import { createColumnRender } from "../utils/render.js";
2
- function useColumns(props, ctx) {
3
- const { columns = [] } = props;
4
- return columns.map((column)=>({
5
- ...column,
6
- render: createColumnRender(ctx, column)
7
- }));
8
- }
9
- export { useColumns };
@@ -1,20 +0,0 @@
1
- import { DataTableProps } from "../typings";
2
- import { BaseQueryParams } from "../../../http-client";
3
- export declare function useData<T = any>(props: DataTableProps<T>): {
4
- data: T[];
5
- loading: boolean;
6
- pagination: BaseQueryParams;
7
- refresh: () => void;
8
- onPaginationChange: (page: number, pageSize: number) => void;
9
- } | {
10
- data: T[] | undefined;
11
- loading: boolean;
12
- refresh: () => void;
13
- pagination: {
14
- current?: number;
15
- pageSize?: number;
16
- sort?: string;
17
- total: number | undefined;
18
- };
19
- onPaginationChange: (page: number, pageSize: number) => void;
20
- };
@@ -1,56 +0,0 @@
1
- import { useState } from "react";
2
- import { useRequest, useUpdateEffect } from "ahooks";
3
- function useData(props) {
4
- const { dataSource = [], request, refreshDeps = [] } = props;
5
- const pagination = props.pagination ?? {};
6
- const [params, setParams] = useState({
7
- current: pagination.current || pagination.defaultCurrent || 1,
8
- pageSize: pagination.pageSize || pagination.defaultPageSize || 10
9
- });
10
- const { loading, data: response, refresh } = useRequest(async ()=>{
11
- const response = await request?.(params);
12
- return response;
13
- }, {
14
- ready: !!request,
15
- refreshDeps: [
16
- ...refreshDeps,
17
- params
18
- ]
19
- });
20
- useUpdateEffect(()=>{
21
- setParams({
22
- current: 1,
23
- pageSize: params.pageSize || pagination?.pageSize || pagination.defaultPageSize || 10
24
- });
25
- }, [
26
- ...refreshDeps
27
- ]);
28
- const onChange = (page, pageSize)=>{
29
- const current = pageSize !== params.pageSize ? 1 : page;
30
- setParams({
31
- ...params,
32
- current,
33
- pageSize
34
- });
35
- pagination?.onChange?.(current, pageSize);
36
- };
37
- if (!request) return {
38
- data: dataSource,
39
- loading: false,
40
- pagination: params,
41
- refresh,
42
- onPaginationChange: onChange
43
- };
44
- const { list, total } = response || {};
45
- return {
46
- data: list,
47
- loading,
48
- refresh,
49
- pagination: {
50
- total,
51
- ...params
52
- },
53
- onPaginationChange: onChange
54
- };
55
- }
56
- export { useData };
@@ -1,2 +0,0 @@
1
- export * from './components/DataTable';
2
- export { type DataTableColumns, type DataTableProps, type DataTableContext, } from './typings';
@@ -1 +0,0 @@
1
- export * from "./components/DataTable.js";
@@ -1,25 +0,0 @@
1
- import React, { JSX } from 'react';
2
- import { TableProps } from 'antd';
3
- import { BaseQueryParams, PaginationData } from '../../../http-client';
4
- import { ColumnType } from 'antd/es/table';
5
- import { ColumnRenderProps } from './render';
6
- export interface DataTableProps<Record = any> extends Omit<TableProps<Record>, 'dataSource' | 'title' | 'columns'> {
7
- dataSource?: Record[];
8
- request?: (pageParams: BaseQueryParams) => Promise<PaginationData<Record>>;
9
- refreshDeps?: any[];
10
- title?: React.ReactNode;
11
- extra?: React.ReactNode;
12
- columns?: DataTableColumns<Record, DataTableContext>[];
13
- floats?: {
14
- key: string;
15
- content: JSX.Element;
16
- }[];
17
- }
18
- export interface DataTableColumns<Record = any, Context = any> extends ColumnType<Record>, Omit<ColumnRenderProps<Record, Context>, 'render'> {
19
- }
20
- export interface DataTableContext {
21
- showFloat: (key: string, record: any) => void;
22
- hideFloat: (key: string) => void;
23
- refresh: () => void;
24
- }
25
- export * from './render';
@@ -1 +0,0 @@
1
- export * from "./render.js";
@@ -1,24 +0,0 @@
1
- import { HTMLAttributeAnchorTarget } from 'react';
2
- import { SwitchProps, TagProps, TypographyProps } from 'antd';
3
- import { ColumnType } from 'antd/es/table';
4
- import { ColumnRender } from '../components/Render';
5
- export type ComponentType = 'text' | 'time' | 'tag' | 'link' | 'switch';
6
- export type ComponentProps = ComponentType extends 'text' ? TextComponentProps : ComponentType extends 'time' ? TimeComponentProps : ComponentType extends 'tag' ? TagComponentProps : ComponentType extends 'link' ? LinkComponentProps : ComponentType extends 'switch' ? SwitchComponentProps : unknown;
7
- export type TextComponentProps = TypographyProps['Text'];
8
- export type TimeComponentProps = {
9
- format?: string;
10
- };
11
- export type TagComponentProps = TagProps;
12
- export type LinkComponentProps = {
13
- titlePropName?: string | ((record: any) => string);
14
- hrefPropName?: string | ((record: any) => string);
15
- target?: HTMLAttributeAnchorTarget;
16
- };
17
- export type SwitchComponentProps = SwitchProps & {
18
- syncChange?: (value: boolean, record: any) => Promise<void>;
19
- };
20
- export interface ColumnRenderProps<Record, Context> {
21
- component?: ComponentType | ColumnRender<Record, Context>;
22
- props?: ComponentProps;
23
- render?: ColumnType<Record>['render'];
24
- }
File without changes
@@ -1,2 +0,0 @@
1
- import { ColumnRenderProps } from '../typings/render';
2
- export declare function createColumnRender<Record = any, Context = any, ColumnType extends ColumnRenderProps<Record, Context> = any>(ctx: Context, column: ColumnType): ColumnType['render'];
@@ -1,103 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Tag, Typography } from "antd";
3
- import { styled } from "styled-components";
4
- import dayjs from "dayjs";
5
- import { Render } from "../components/Render.js";
6
- import { TextOverflow } from "../../TextOverflow/index.js";
7
- import { AsyncSwitch } from "../../AsyncSwitch/index.js";
8
- function createColumnRender(ctx, column) {
9
- if (column.component) {
10
- if ('text' === column.component) return function(value, record, index) {
11
- return textRender(value, record, column.props);
12
- };
13
- if ('time' === column.component) return function(value, record, index) {
14
- return timeRender(value, record, column.props);
15
- };
16
- if ('tag' === column.component) return function(value, record, index) {
17
- return tagRender(value, record, column.props);
18
- };
19
- if ('link' === column.component) return function(value, record, index) {
20
- return linkRender(value, record, column.props);
21
- };
22
- if ('switch' === column.component) return function(value, record, index) {
23
- return switchRender(value, record, column.props);
24
- };
25
- return function(value, record, index) {
26
- return /*#__PURE__*/ jsx(Render, {
27
- render: column.component,
28
- defaultValue: value,
29
- record: record,
30
- index: index,
31
- ctx: ctx
32
- });
33
- };
34
- }
35
- return column.render;
36
- }
37
- function textRender(value, record, props) {
38
- return /*#__PURE__*/ jsx(Typography.Text, {
39
- ellipsis: {
40
- tooltip: true
41
- },
42
- ...props,
43
- children: value
44
- });
45
- }
46
- function timeRender(value, record, props) {
47
- try {
48
- const time = value ? dayjs(value).format(props?.format) : '-';
49
- return /*#__PURE__*/ jsx("span", {
50
- children: time
51
- });
52
- } catch {
53
- return /*#__PURE__*/ jsx("span", {
54
- children: "-"
55
- });
56
- }
57
- }
58
- function tagRender(value, record, props) {
59
- return /*#__PURE__*/ jsx(Tag, {
60
- ...props,
61
- children: value
62
- });
63
- }
64
- function linkRender(value, record, props) {
65
- const getPropName = (propName)=>{
66
- if ('function' == typeof propName) return propName(record);
67
- return record[propName];
68
- };
69
- const title = getPropName(props?.titlePropName || 'title');
70
- const href = getPropName(props?.hrefPropName || 'href');
71
- const aLink = /*#__PURE__*/ jsx(LinkStyle, {
72
- href: href,
73
- target: props?.target,
74
- children: title
75
- });
76
- return /*#__PURE__*/ jsx(TextOverflow, {
77
- text: aLink,
78
- tooltipProps: {
79
- title
80
- }
81
- });
82
- }
83
- function switchRender(value, record, props) {
84
- return /*#__PURE__*/ jsx(AsyncSwitch, {
85
- defaultValue: value,
86
- ...props,
87
- syncChange: async (checked)=>{
88
- await props?.syncChange?.(checked, record);
89
- }
90
- });
91
- }
92
- const LinkStyle = styled.a`
93
- color: #1677ff;
94
- &:hover {
95
- color: #69b1ff;
96
- }
97
- outline: 0;
98
- text-decoration: none;
99
- transition: color 0.3s;
100
- background-color: transparent;
101
- cursor: pointer;
102
- `;
103
- export { createColumnRender };
@@ -1,19 +0,0 @@
1
- import React, { JSX } from 'react';
2
- export interface FloatContextProps {
3
- showFloat: (key: string, record: any, onCloseCallback?: () => void) => void;
4
- hideFloat: (key: string) => void;
5
- }
6
- export declare const FloatContext: React.Context<FloatContextProps | undefined>;
7
- export declare const useFloatContext: () => FloatContextProps;
8
- export declare const FloatProvider: (props: {
9
- floats?: {
10
- key: string;
11
- content: JSX.Element;
12
- }[];
13
- children: React.ReactNode;
14
- }) => import("react/jsx-runtime").JSX.Element;
15
- export type FloatComponentProps<T extends Record<string, any> = any> = {
16
- record: T;
17
- visible: boolean;
18
- onClose: () => void;
19
- };
@@ -1,59 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { cloneElement, createContext, useCallback, useContext, useRef, useState } from "react";
3
- const FloatContext = /*#__PURE__*/ createContext(void 0);
4
- const useFloatContext = ()=>{
5
- const context = useContext(FloatContext);
6
- if (!context) return {
7
- showFloat: ()=>{},
8
- hideFloat: ()=>{}
9
- };
10
- return context;
11
- };
12
- const FloatProvider = (props)=>{
13
- const { floats = [], children } = props;
14
- const floatsMapRef = useRef({});
15
- const [eles, setEles] = useState([]);
16
- const hideFloat = useCallback((key)=>{
17
- if (!floatsMapRef.current[key]) return;
18
- setEles(eles.filter((i)=>i !== floatsMapRef.current[key]));
19
- delete floatsMapRef.current[key];
20
- }, [
21
- eles
22
- ]);
23
- const showFloat = useCallback((key, record, onCloseCallback)=>{
24
- if (!floatsMapRef.current[key]) {
25
- const content = floats.find((i)=>i.key === key)?.content;
26
- if (!content) return;
27
- const onClose = ()=>{
28
- hideFloat(key);
29
- onCloseCallback?.();
30
- };
31
- const newContent = /*#__PURE__*/ cloneElement(content, {
32
- record,
33
- onClose,
34
- visible: true
35
- });
36
- floatsMapRef.current[key] = newContent;
37
- setEles([
38
- ...eles,
39
- newContent
40
- ]);
41
- }
42
- }, [
43
- eles,
44
- hideFloat
45
- ]);
46
- return /*#__PURE__*/ jsx(FloatContext.Provider, {
47
- value: {
48
- showFloat,
49
- hideFloat
50
- },
51
- children: /*#__PURE__*/ jsxs(Fragment, {
52
- children: [
53
- children,
54
- eles
55
- ]
56
- })
57
- });
58
- };
59
- export { FloatContext, FloatProvider, useFloatContext };
@@ -1 +0,0 @@
1
- export { FloatContext, FloatProvider, useFloatContext } from './float';
@@ -1,2 +0,0 @@
1
- import { FloatContext, FloatProvider, useFloatContext } from "./float.js";
2
- export { FloatContext, FloatProvider, useFloatContext };
@@ -1,2 +0,0 @@
1
- import { ComponentType } from '../types';
2
- export declare function createColumnRender<RecordValue extends Record<string, any> = any, FilterValue = any>(component?: ComponentType, props?: any): ((value: any, record: RecordValue, index: number) => import("react").ReactNode) | undefined;
@@ -1,25 +0,0 @@
1
- import { textRender } from "../renders/text.js";
2
- import { timeRender } from "../renders/time.js";
3
- import { tagRender } from "../renders/tag.js";
4
- import { linkRender } from "../renders/link.js";
5
- import { switchRender } from "../renders/switch.js";
6
- function createColumnRender(component, props) {
7
- if (component) {
8
- if ('text' === component) return function(value, record, index) {
9
- return textRender(value, record, index, props);
10
- };
11
- if ('time' === component) return function(value, record, index) {
12
- return timeRender(value, record, index, props);
13
- };
14
- if ('tag' === component) return function(value, record, index) {
15
- return tagRender(value, record, index, props);
16
- };
17
- if ('link' === component) return function(value, record, index) {
18
- return linkRender(value, record, index, props);
19
- };
20
- if ('switch' === component) return function(value, record, index) {
21
- return switchRender(value, record, index, props);
22
- };
23
- }
24
- }
25
- export { createColumnRender };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes