@creekjs/web-components 1.0.0 → 1.0.1
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.
- package/README.md +241 -973
- package/dist/bg-center/index.d.ts +5 -0
- package/dist/creek-config-provider/CreekConfigContext.d.ts +5 -0
- package/dist/creek-config-provider/index.d.ts +9 -0
- package/dist/creek-hooks/index.d.ts +1 -0
- package/dist/creek-hooks/useViewportHeight.d.ts +31 -0
- package/dist/creek-icon/index.d.ts +11 -0
- package/dist/creek-keep-alive/index.d.ts +1 -0
- package/dist/creek-layout/CollapseButton.d.ts +9 -0
- package/dist/creek-layout/Exception/NotFound.d.ts +1 -0
- package/dist/creek-layout/Exception/NotFoundPage.d.ts +2 -0
- package/dist/creek-layout/Exception/index.d.ts +6 -0
- package/dist/creek-layout/HeaderContent/FullScreen.d.ts +6 -0
- package/dist/creek-layout/HeaderContent/UserInfo.d.ts +1 -0
- package/dist/creek-layout/HeaderContent/index.d.ts +1 -0
- package/dist/creek-layout/index.d.ts +13 -0
- package/dist/creek-loading/index.d.ts +9 -0
- package/dist/creek-search/CreekSearch.d.ts +7 -0
- package/dist/creek-search/CreekSearchContext.d.ts +54 -0
- package/dist/creek-search/CreekSearchContext.js +1 -1
- package/dist/creek-search/CreekSearchFilterDisplay.d.ts +5 -0
- package/dist/creek-search/CreekSearchInput.d.ts +4 -0
- package/dist/creek-search/CreekSearchValueSelector.d.ts +5 -0
- package/dist/creek-search/index.d.ts +5 -0
- package/dist/creek-search/type.d.ts +8 -0
- package/dist/creek-table/SearchTable.d.ts +3 -0
- package/dist/creek-table/TableOptionRender.d.ts +9 -0
- package/dist/creek-table/TableViewContent.d.ts +4 -0
- package/dist/creek-table/hooks/index.d.ts +3 -0
- package/dist/creek-table/hooks/useAdaptiveToolBar.d.ts +9 -0
- package/dist/creek-table/hooks/useAutoAddFilterToColumns.d.ts +12 -0
- package/dist/creek-table/hooks/useElementDistance.d.ts +7 -0
- package/dist/creek-table/index.d.ts +3 -0
- package/dist/creek-table/toolBarRender.d.ts +4 -0
- package/dist/creek-table/type.d.ts +19 -0
- package/dist/index.d.ts +7 -0
- package/package.json +2 -2
- package/src/creek-search/CreekSearchContext.tsx +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CreekConfigContextProps } from './CreekConfigContext';
|
|
3
|
+
export type CreekConfigProviderProps = CreekConfigContextProps & {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export declare const CreekConfigProvider: {
|
|
7
|
+
(props: CreekConfigProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
CreekConfigContext: import("react").Context<CreekConfigContextProps>;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useViewportHeight';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface UseViewportHeightOptions {
|
|
3
|
+
/** 底部保留空间(如固定在底部的元素高度),默认 0 */
|
|
4
|
+
bottomOffset?: number;
|
|
5
|
+
/** 顶部保留空间,默认自动计算到容器顶部的距离 */
|
|
6
|
+
topOffset?: number;
|
|
7
|
+
/** 额外的边距,默认 0 */
|
|
8
|
+
margin?: number;
|
|
9
|
+
/** 最小高度,默认 0 */
|
|
10
|
+
minHeight?: number;
|
|
11
|
+
/** 最大高度,不设置则无限制 */
|
|
12
|
+
maxHeight?: number;
|
|
13
|
+
/** 是否启用调试模式,会在控制台输出计算信息 */
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
/** 防抖延迟时间(毫秒),默认 16ms */
|
|
16
|
+
debounceDelay?: number;
|
|
17
|
+
/** 依赖项数组,当这些值变化时会重新计算高度(比如搜索条件) */
|
|
18
|
+
deps?: React.DependencyList;
|
|
19
|
+
isObserverParent?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const useViewportHeight: (options?: UseViewportHeightOptions) => {
|
|
22
|
+
/** 容器引用,需要绑定到目标元素的容器 */
|
|
23
|
+
containerRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
24
|
+
/** 计算得出的可视区域高度 */
|
|
25
|
+
viewPortHeight: number | undefined;
|
|
26
|
+
/** 手动重新计算高度的方法 */
|
|
27
|
+
recalculate: (this: unknown) => void;
|
|
28
|
+
/** 是否已完成高度计算 */
|
|
29
|
+
isCalculated: boolean;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Icon from '@ant-design/icons';
|
|
2
|
+
import type { GetProps } from 'antd';
|
|
3
|
+
import { CreekConfigProviderProps } from '../creek-config-provider';
|
|
4
|
+
type CustomIconComponentProps = GetProps<typeof Icon>;
|
|
5
|
+
export type CreekIconProps = CustomIconComponentProps & {
|
|
6
|
+
iconFontCNs?: CreekConfigProviderProps['iconFontCNs'];
|
|
7
|
+
type?: string;
|
|
8
|
+
component?: CustomIconComponentProps['component'];
|
|
9
|
+
};
|
|
10
|
+
export declare const CreekIcon: (props: CreekIconProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CreekKeepAlive: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type CollapsedButtonProps = {
|
|
2
|
+
collapsed?: boolean;
|
|
3
|
+
};
|
|
4
|
+
export type CollapsedButtonStore = {
|
|
5
|
+
collapsed: boolean;
|
|
6
|
+
changeCollapsed: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const useCollapsedStore: import("zustand").UseBoundStore<import("zustand").StoreApi<CollapsedButtonStore>>;
|
|
9
|
+
export declare const CollapsedButton: (props: CollapsedButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NotFound: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type FullScreenStore = {
|
|
2
|
+
isFullScreen: boolean;
|
|
3
|
+
changeFullScreen: () => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const useFullScreenStore: import("zustand").UseBoundStore<import("zustand").StoreApi<FullScreenStore>>;
|
|
6
|
+
export declare const FullScreen: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const UserInfo: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HeaderContent: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ProLayoutProps } from "@ant-design/pro-components";
|
|
2
|
+
export type LayoutProps = ProLayoutProps & {
|
|
3
|
+
runtimeConfig: ProLayoutProps;
|
|
4
|
+
userConfig?: ProLayoutProps;
|
|
5
|
+
navigate?: (path?: string | number) => void;
|
|
6
|
+
initialInfo?: {
|
|
7
|
+
initialState: any;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
setInitialState: () => void;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const CreekLayout: (props: LayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export * from "./Exception";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Spin } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare class Loading {
|
|
4
|
+
private static container;
|
|
5
|
+
private static root;
|
|
6
|
+
private static createContainer;
|
|
7
|
+
static open(config?: React.ComponentProps<typeof Spin>): void;
|
|
8
|
+
static close(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ParamsType, ProColumnType } from '@ant-design/pro-components';
|
|
2
|
+
export type CreekSearchProps<T> = {
|
|
3
|
+
columns: ProColumnType<T>[];
|
|
4
|
+
onSubmit?: (values: Record<string, any>) => void;
|
|
5
|
+
justify?: 'start' | 'end';
|
|
6
|
+
};
|
|
7
|
+
export declare const CreekSearch: <T extends ParamsType>(props: CreekSearchProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ParamsType, ProColumnType, ProTableProps } from '@ant-design/pro-components';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
import { CreekSearchAddFilterOption, CreekSearchFilter } from './type';
|
|
4
|
+
interface ValueTypeConfig {
|
|
5
|
+
showValueSelector: boolean;
|
|
6
|
+
dateFormat?: string;
|
|
7
|
+
isRange?: boolean;
|
|
8
|
+
isDateTime?: boolean;
|
|
9
|
+
displayName: string;
|
|
10
|
+
componentType: 'input' | 'select' | 'date' | 'dateRange' | 'time' | 'timeRange' | 'number' | 'switch' | 'radio' | 'checkbox';
|
|
11
|
+
}
|
|
12
|
+
export interface SearchContextValue<T extends ParamsType, U extends ParamsType, ValueType = 'text'> {
|
|
13
|
+
searchValue: string;
|
|
14
|
+
filters: CreekSearchFilter[];
|
|
15
|
+
showValueSelector: boolean;
|
|
16
|
+
selectedColumn: ProColumnType<T, U>;
|
|
17
|
+
tempValue: any;
|
|
18
|
+
inputRef: React.RefObject<any>;
|
|
19
|
+
columns: ProTableProps<T, U, ValueType>['columns'];
|
|
20
|
+
filterOptions: ProTableProps<T, U, ValueType>['columns'];
|
|
21
|
+
onSubmit?: (params: U) => void;
|
|
22
|
+
beforeSearchSubmit?: (params: Record<string, any>) => Record<string, any>;
|
|
23
|
+
setSearchValue: (value: string) => void;
|
|
24
|
+
setFilters: React.Dispatch<React.SetStateAction<CreekSearchFilter[]>>;
|
|
25
|
+
setShowValueSelector: (show: boolean) => void;
|
|
26
|
+
setSelectedColumn: (column: any) => void;
|
|
27
|
+
setTempValue: (value: any) => void;
|
|
28
|
+
handleSearch: (value: string) => void;
|
|
29
|
+
handleSelectColumn: (value: string) => void;
|
|
30
|
+
addFilter: (key: string, option: CreekSearchAddFilterOption) => void;
|
|
31
|
+
confirmAddFilter: () => void;
|
|
32
|
+
cancelValueSelector: () => void;
|
|
33
|
+
removeFilter: (filterId: string) => void;
|
|
34
|
+
handelRest: () => void;
|
|
35
|
+
getColumnOptions: (column: any) => Array<{
|
|
36
|
+
label: string;
|
|
37
|
+
value: string;
|
|
38
|
+
}>;
|
|
39
|
+
getDisplayText: (column: any, value: any) => any;
|
|
40
|
+
hasOptions: (column: any) => boolean;
|
|
41
|
+
filtersToParams: (filters: CreekSearchFilter[]) => ParamsType;
|
|
42
|
+
getValueTypeConfig: (valueType?: ProColumnType<T, U>['valueType']) => ValueTypeConfig;
|
|
43
|
+
formatDateValue: (value: any, config: ValueTypeConfig) => string | string[];
|
|
44
|
+
shouldShowValueSelector: (column: any) => boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare const useSearchContext: <T extends ParamsType, U extends ParamsType, ValueType = "text">() => SearchContextValue<T, U, ValueType>;
|
|
47
|
+
interface CreekSearchProviderProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> {
|
|
48
|
+
columns: ProTableProps<T, U, ValueType>['columns'];
|
|
49
|
+
onSubmit?: (params: U) => void;
|
|
50
|
+
beforeSearchSubmit?: (params: Record<string, any>) => Record<string, any>;
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
}
|
|
53
|
+
export declare const CreekSearchProvider: <T extends ParamsType, U extends ParamsType, ValueType = "text">({ columns, onSubmit, beforeSearchSubmit, children, }: CreekSearchProviderProps<T, U, ValueType>) => import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export {};
|
|
@@ -233,7 +233,7 @@ export var CreekSearchProvider = function CreekSearchProvider(_ref) {
|
|
|
233
233
|
|
|
234
234
|
// 筛选条件配置
|
|
235
235
|
var filterOptions = columns === null || columns === void 0 ? void 0 : columns.filter(function (item) {
|
|
236
|
-
return item.search !== false || item.hideInSearch !==
|
|
236
|
+
return item.search !== false || item.hideInSearch !== true;
|
|
237
237
|
});
|
|
238
238
|
|
|
239
239
|
// 获取valueType配置
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ParamsType } from '@ant-design/pro-components';
|
|
2
|
+
export type CreekFilterDisplayProps<T, U, ValueType> = {
|
|
3
|
+
className?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const CreekFilterDisplay: <T extends ParamsType, U extends ParamsType, ValueType = "text">(props: CreekFilterDisplayProps<T, U, ValueType>) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ParamsType } from '@ant-design/pro-components';
|
|
2
|
+
export type CreekSearchValueSelectorProps<T extends ParamsType, U extends ParamsType> = {
|
|
3
|
+
onConfirm?: () => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const CreekSearchValueSelector: <T extends ParamsType, U extends ParamsType>(props: CreekSearchValueSelectorProps<T, U>) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ParamsType } from '@ant-design/pro-components';
|
|
2
|
+
import { CreekTableProps } from './type';
|
|
3
|
+
export declare const SearchProTable: <T extends ParamsType, U extends ParamsType, ValueType = "text">(props: CreekTableProps<T, U, ValueType>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ParamsType } from '@ant-design/pro-components';
|
|
3
|
+
import { OptionRenderCustom } from './type';
|
|
4
|
+
export type TableOptionRenderProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = {
|
|
5
|
+
defaultDom?: React.ReactNode[];
|
|
6
|
+
importConfig?: OptionRenderCustom;
|
|
7
|
+
exportConfig?: OptionRenderCustom;
|
|
8
|
+
};
|
|
9
|
+
export declare const TableOptionRender: <T extends ParamsType, U extends ParamsType, ValueType = "text">(props: TableOptionRenderProps<T, U, ValueType>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ParamsType } from '@ant-design/pro-components';
|
|
2
|
+
import { CreekTableProps } from './type';
|
|
3
|
+
export type CreekTableViewRender<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = CreekTableProps<T, U, ValueType>['tableViewRender'];
|
|
4
|
+
export declare const TableViewContent: <T extends ParamsType, U extends ParamsType, ValueType = "text">(props: CreekTableProps<T, U, ValueType>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
export declare const useAdaptiveToolBar: (options: {
|
|
3
|
+
containerRef: MutableRefObject<HTMLElement | null>;
|
|
4
|
+
prefixCls: string;
|
|
5
|
+
minLeftDistance?: number;
|
|
6
|
+
hysteresis?: number;
|
|
7
|
+
}) => {
|
|
8
|
+
shouldCollapse: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ParamsType, ProColumnType } from '@ant-design/pro-components';
|
|
2
|
+
import { CreekTableProps } from '../type';
|
|
3
|
+
interface UseAutoAddFilterToColumnsProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> {
|
|
4
|
+
columns: CreekTableProps<T, U, ValueType>['columns'];
|
|
5
|
+
autoAddFilterForColumn?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface UseAutoAddFilterToColumnsReturn<T extends ParamsType, U extends ParamsType, ValueType> {
|
|
8
|
+
columnsWithFilter: CreekTableProps<T, U, ValueType>['columns'];
|
|
9
|
+
getColumnKey: (column: ProColumnType<T, U>) => string;
|
|
10
|
+
}
|
|
11
|
+
export declare const useAutoAddFilterToColumns: <T extends ParamsType, U extends ParamsType, ValueType = "text">({ columns, autoAddFilterForColumn, }: UseAutoAddFilterToColumnsProps<T, U, ValueType>) => UseAutoAddFilterToColumnsReturn<T, U, ValueType>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ParamsType } from '@ant-design/pro-components';
|
|
2
|
+
import { CreekTableProps } from './type';
|
|
3
|
+
export declare const CreekTable: <T extends ParamsType, U extends ParamsType, ValueType = "text">(props: CreekTableProps<T, U, ValueType>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ParamsType, ProTableProps } from '@ant-design/pro-components';
|
|
3
|
+
export type OptionRenderCustom = {
|
|
4
|
+
text?: string;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
};
|
|
8
|
+
export type CreekTableProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = Omit<ProTableProps<T, U, ValueType>, 'search' | 'options'> & {
|
|
9
|
+
pageFixedBottom?: boolean;
|
|
10
|
+
pageFixedBottomConfig?: {
|
|
11
|
+
/** 底部保留空间(如固定在底部的元素高度),默认 0 */
|
|
12
|
+
bottomFix?: number;
|
|
13
|
+
};
|
|
14
|
+
options?: ProTableProps<T, U, ValueType>['options'] & {
|
|
15
|
+
importConfig?: OptionRenderCustom;
|
|
16
|
+
exportConfig?: OptionRenderCustom;
|
|
17
|
+
};
|
|
18
|
+
autoAddFilterForColumn?: boolean;
|
|
19
|
+
};
|
package/dist/index.d.ts
ADDED
package/package.json
CHANGED
|
@@ -276,7 +276,7 @@ export const CreekSearchProvider = <T extends ParamsType, U extends ParamsType,
|
|
|
276
276
|
const inputRef = useRef<any>(null);
|
|
277
277
|
|
|
278
278
|
// 筛选条件配置
|
|
279
|
-
const filterOptions = columns?.filter((item) => item.search !== false || item.hideInSearch !==
|
|
279
|
+
const filterOptions = columns?.filter((item) => item.search !== false || item.hideInSearch !== true);
|
|
280
280
|
|
|
281
281
|
// 获取valueType配置
|
|
282
282
|
const getValueTypeConfig = (valueType?: ProColumnType<T, U>['valueType']) => {
|