@nocobase/client-v2 2.1.0-beta.35 → 2.1.0-beta.37
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/es/BaseApplication.d.ts +2 -1
- package/es/components/PoweredBy.d.ts +18 -0
- package/es/components/SwitchLanguage.d.ts +11 -0
- package/es/components/form/DialogFormLayout.d.ts +51 -0
- package/es/components/form/DrawerFormLayout.d.ts +11 -11
- package/es/components/form/PasswordInput.d.ts +40 -0
- package/es/components/form/RemoteSelect.d.ts +79 -0
- package/es/components/form/filter/CollectionFilter.d.ts +41 -0
- package/es/components/form/filter/CollectionFilterItem.d.ts +41 -0
- package/es/components/form/filter/DateFilterDynamicComponent.d.ts +57 -0
- package/es/components/form/filter/FilterValueInput.d.ts +29 -0
- package/es/components/form/filter/index.d.ts +11 -0
- package/es/components/form/filter/useFilterActionProps.d.ts +96 -0
- package/es/components/form/index.d.ts +4 -0
- package/es/components/form/table/styles.d.ts +10 -0
- package/es/components/index.d.ts +2 -0
- package/es/data-source/ExtendCollectionsProvider.d.ts +24 -0
- package/es/data-source/index.d.ts +9 -0
- package/es/flow/components/filter/index.d.ts +2 -0
- package/es/flow/components/filter/useFilterOptions.d.ts +54 -0
- package/es/flow/models/base/ActionModelCore.d.ts +6 -0
- package/es/flow/models/base/GridModel.d.ts +2 -0
- package/es/flow/utils/dataScopeFormValueClear.d.ts +14 -0
- package/es/flow-compat/passwordUtils.d.ts +1 -1
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/useCurrentAppInfo.d.ts +9 -0
- package/es/index.d.ts +1 -0
- package/es/index.mjs +109 -92
- package/es/nocobase-buildin-plugin/index.d.ts +20 -2
- package/es/utils/appVersionHTML.d.ts +10 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/remotePlugins.d.ts +4 -1
- package/lib/index.js +115 -98
- package/package.json +7 -7
- package/src/BaseApplication.tsx +16 -3
- package/src/PluginSettingsManager.ts +2 -1
- package/src/__tests__/PluginSettingsManager.test.ts +19 -0
- package/src/__tests__/PoweredBy.test.tsx +130 -0
- package/src/__tests__/app.test.tsx +40 -0
- package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +39 -72
- package/src/__tests__/remotePlugins.test.ts +55 -0
- package/src/__tests__/useCurrentRoles.test.tsx +100 -0
- package/src/components/PoweredBy.tsx +71 -0
- package/src/components/README.md +397 -0
- package/src/components/README.zh-CN.md +394 -0
- package/src/components/SwitchLanguage.tsx +48 -0
- package/src/components/form/DialogFormLayout.tsx +87 -0
- package/src/components/form/DrawerFormLayout.tsx +13 -32
- package/src/components/form/PasswordInput.tsx +211 -0
- package/src/components/form/RemoteSelect.tsx +137 -0
- package/src/components/form/filter/CollectionFilter.tsx +101 -0
- package/src/components/form/filter/CollectionFilterItem.tsx +176 -0
- package/src/components/form/filter/DateFilterDynamicComponent.tsx +283 -0
- package/src/components/form/filter/FilterValueInput.tsx +198 -0
- package/src/components/form/filter/__tests__/CollectionFilterItem.test.tsx +205 -0
- package/src/components/form/filter/__tests__/DateFilterDynamicComponent.test.tsx +148 -0
- package/src/components/form/filter/__tests__/FilterValueInput.test.tsx +243 -0
- package/src/components/form/filter/__tests__/compileFilterGroup.test.ts +146 -0
- package/src/components/form/filter/index.ts +13 -0
- package/src/components/form/filter/useFilterActionProps.ts +200 -0
- package/src/components/form/index.tsx +4 -0
- package/src/components/form/table/Table.tsx +2 -1
- package/src/components/form/table/styles.ts +19 -0
- package/src/components/index.ts +2 -0
- package/src/css-variable/CSSVariableProvider.tsx +10 -1
- package/src/data-source/ExtendCollectionsProvider.tsx +70 -0
- package/src/data-source/index.ts +10 -0
- package/src/flow/actions/__tests__/dataScopeFormValueClear.test.ts +96 -0
- package/src/flow/actions/dataScope.tsx +3 -0
- package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +1 -4
- package/src/flow/admin-shell/admin-layout/HelpLite.tsx +7 -33
- package/src/flow/components/BlockItemCard.tsx +2 -2
- package/src/flow/components/filter/index.ts +3 -0
- package/src/flow/components/filter/useFilterOptions.ts +80 -0
- package/src/flow/models/base/ActionModel.tsx +8 -7
- package/src/flow/models/base/ActionModelCore.tsx +15 -7
- package/src/flow/models/base/GridModel.tsx +93 -36
- package/src/flow/models/base/__tests__/GridModel.visibleLayout.test.ts +83 -11
- package/src/flow/models/blocks/details/DetailsItemModel.tsx +2 -0
- package/src/flow/models/blocks/form/FormItemModel.tsx +5 -3
- package/src/flow/models/blocks/form/__tests__/FormItemModel.defineChildren.test.ts +108 -0
- package/src/flow/models/blocks/table/TableActionsColumnModel.tsx +5 -0
- package/src/flow/models/blocks/table/TableColumnModel.tsx +2 -0
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.tsx +2 -0
- package/src/flow/utils/dataScopeFormValueClear.ts +278 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useCurrentAppInfo.ts +36 -0
- package/src/index.ts +1 -0
- package/src/nocobase-buildin-plugin/index.tsx +66 -18
- package/src/nocobase-buildin-plugin/plugins/LocalePlugin.ts +1 -0
- package/src/utils/appVersionHTML.ts +28 -0
- package/src/utils/globalDeps.ts +2 -2
- package/src/utils/index.tsx +2 -0
- package/src/utils/remotePlugins.ts +12 -7
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { Collection } from '@nocobase/flow-engine';
|
|
10
|
+
/**
|
|
11
|
+
* One operator entry on a `FilterOption`. Mirrors v1's interface-defined operator shape so the v2 filter value renderer can pick up the same per-operator value-side schema (e.g. datetime operators wanting the smart date picker, array/enum operators wanting a tag-mode Select).
|
|
12
|
+
*/
|
|
13
|
+
export type FilterOperator = {
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
/**
|
|
17
|
+
* Per-operator override for the value-side renderer. Wins over the field's own `uiSchema` when set. The `x-component` string is looked up against the v2 filter component registry.
|
|
18
|
+
*/
|
|
19
|
+
schema?: {
|
|
20
|
+
'x-component'?: string;
|
|
21
|
+
'x-component-props'?: Record<string, any>;
|
|
22
|
+
} & Record<string, any>;
|
|
23
|
+
/** Operator takes no right-hand value (e.g. `$empty`, `$notEmpty`). */
|
|
24
|
+
noValue?: boolean;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
/** Single field-tree node returned by `useFilterOptions`. */
|
|
28
|
+
export type FilterOption = {
|
|
29
|
+
name: string;
|
|
30
|
+
type?: string;
|
|
31
|
+
target?: string;
|
|
32
|
+
title: string;
|
|
33
|
+
schema?: Record<string, any>;
|
|
34
|
+
operators?: FilterOperator[];
|
|
35
|
+
children?: FilterOption[];
|
|
36
|
+
};
|
|
37
|
+
export interface UseFilterOptionsArgs {
|
|
38
|
+
/**
|
|
39
|
+
* Whitelist of root-level field names to expose. Empty/undefined means "all filterable fields". The whitelist applies only at depth 1 — nested fields under an allowed association field are always included, matching the legacy v1 `Filter.Action` behaviour.
|
|
40
|
+
*/
|
|
41
|
+
filterableFieldNames?: string[];
|
|
42
|
+
/** Bypass the `filterableFieldNames` whitelist (mirrors v1 `noIgnore`). */
|
|
43
|
+
noIgnore?: boolean;
|
|
44
|
+
/** Translator used for field/operator labels. Defaults to identity. */
|
|
45
|
+
t?: (key: string) => string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* v2 equivalent of v1's `useFilterOptions`/`useFilterFieldOptions`. Walks a `Collection`'s fields and returns the nested option tree consumed by antd `Cascader` in `CollectionFilterItem` (and any other v2 filter surface that wants the same field picker).
|
|
49
|
+
*
|
|
50
|
+
* Mirrors v1 in two ways that matter:
|
|
51
|
+
* - association fields (belongsTo / hasMany / m2m / etc.) are kept and recursed into via `fieldsToOptions`'s `nested` branch — so picking `user.username` is a first-class action, just like the legacy cascader.
|
|
52
|
+
* - the whitelist applies at depth 1 only, so capping the root field list (e.g. to `['lockedTs', 'unlockTs', 'user']`) doesn't accidentally hide the nested `user.username` / `user.nickname` leaves.
|
|
53
|
+
*/
|
|
54
|
+
export declare function useFilterOptions(collection: Collection | undefined, args?: UseFilterOptionsArgs): FilterOption[];
|
|
@@ -20,10 +20,12 @@ export declare const ActionSceneEnum: {
|
|
|
20
20
|
export declare class ActionModel<T extends DefaultStructure = DefaultStructure> extends FlowModel<T> {
|
|
21
21
|
props: ButtonProps & {
|
|
22
22
|
tooltip?: string;
|
|
23
|
+
iconOnly?: boolean;
|
|
23
24
|
};
|
|
24
25
|
scene: ActionSceneType;
|
|
25
26
|
defaultProps: ButtonProps & {
|
|
26
27
|
tooltip?: string;
|
|
28
|
+
iconOnly?: boolean;
|
|
27
29
|
};
|
|
28
30
|
enableEditTooltip: boolean;
|
|
29
31
|
enableEditTitle: boolean;
|
|
@@ -31,6 +33,10 @@ export declare class ActionModel<T extends DefaultStructure = DefaultStructure>
|
|
|
31
33
|
enableEditType: boolean;
|
|
32
34
|
enableEditDanger: boolean;
|
|
33
35
|
enableEditColor: boolean;
|
|
36
|
+
buttonTypeOptions: {
|
|
37
|
+
value: string;
|
|
38
|
+
label: string;
|
|
39
|
+
}[];
|
|
34
40
|
static _getScene(): any[];
|
|
35
41
|
static _isScene(scene: ActionSceneType): boolean;
|
|
36
42
|
getAclActionName(): any;
|
|
@@ -55,6 +55,7 @@ export declare class GridModel<T extends {
|
|
|
55
55
|
private buildResizedCells;
|
|
56
56
|
private getResizeRowPath;
|
|
57
57
|
private getResizeContainerWidth;
|
|
58
|
+
private prunePlaceholderOnlyRows;
|
|
58
59
|
private resizeGridLayout;
|
|
59
60
|
onMount(): void;
|
|
60
61
|
saveGridLayout(layout?: GridLayoutData | GridLayoutV2): void;
|
|
@@ -82,6 +83,7 @@ export declare class GridModel<T extends {
|
|
|
82
83
|
* 运行态按可见 block 过滤行/列,避免“整行都是 hidden block”但依然保留行间距占位。
|
|
83
84
|
* - 配置态(flowSettingsEnabled)保持原始 rows/sizes 以便拖拽和布局编辑。
|
|
84
85
|
* - 运行态仅在判断为“整列/整行都不可见”时做过滤,不写回 props/stepParams,布局元数据保持不变。
|
|
86
|
+
* - 空列是拖拽缩窄后保存的布局占位,运行态需要保留其宽度,但 Grid 渲染层不会渲染其内容。
|
|
85
87
|
*/
|
|
86
88
|
private getVisibleLayout;
|
|
87
89
|
render(): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { FlowContext } from '@nocobase/flow-engine';
|
|
10
|
+
/**
|
|
11
|
+
* When a field's dataScope filter references other form values (e.g. `{{ ctx.formValues.school.id }}`),
|
|
12
|
+
* clear current field value after the dependency changes, so users don't keep an invalid stale selection.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ensureFormValueDrivenDataScopeClear(ctx: FlowContext, params: any): void;
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
export declare const getStrength: (val: any) => 60 | 0 |
|
|
9
|
+
export declare const getStrength: (val: any) => 60 | 0 | 100 | 80 | 40 | 20;
|
package/es/hooks/index.d.ts
CHANGED
|
@@ -7,5 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
export * from './useApp';
|
|
10
|
+
export * from './useCurrentAppInfo';
|
|
10
11
|
export * from './usePlugin';
|
|
11
12
|
export * from './useRouter';
|
|
13
|
+
export { escapeHTML, getAppVersionHTML } from '../utils/appVersionHTML';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useCurrentAppInfo<TAppInfo extends Record<string, any> = Record<string, any>>(): TAppInfo;
|
package/es/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from './nocobase-buildin-plugin';
|
|
|
30
30
|
export * from './collection-field-interface/CollectionFieldInterface';
|
|
31
31
|
export * from './collection-field-interface/CollectionFieldInterfaceManager';
|
|
32
32
|
export * from './collection-manager/interfaces';
|
|
33
|
+
export * from './data-source';
|
|
33
34
|
export * from './flow';
|
|
34
35
|
export { DEFAULT_DATA_SOURCE_KEY, isTitleField, isTitleFieldInterface } from './flow-compat';
|
|
35
36
|
export { default as AntdAppProvider } from './theme/AntdAppProvider';
|