@nocobase/client 2.0.0-alpha.14 → 2.0.0-alpha.15
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/flow/components/BlockItemCard.d.ts +2 -0
- package/es/flow/components/filter/FilterContainer.d.ts +4 -4
- package/es/flow/models/blocks/details/DetailsCustomItemModel.d.ts +2 -2
- package/es/flow/models/blocks/details/DetailsJSFieldItemModel.d.ts +2 -2
- package/es/flow/models/blocks/form/FormJSFieldItemModel.d.ts +1 -1
- package/es/flow/models/blocks/table/TableBlockModel.d.ts +4 -0
- package/es/flow/models/blocks/table/TableJSFieldItemModel.d.ts +2 -2
- package/es/flow/models/blocks/utils/transformChildrenToJS.d.ts +38 -0
- package/es/index.mjs +205 -108
- package/lib/{index-C3fHjsMw-Dbd-7ROZ.js → index-C3fHjsMw-CP-pUIkQ.js} +220 -224
- package/lib/index.js +35 -39
- package/package.json +6 -6
|
@@ -9,5 +9,7 @@
|
|
|
9
9
|
import { CardProps } from 'antd';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
export declare const BlockItemCard: React.ForwardRefExoticComponent<CardProps & {
|
|
12
|
+
beforeContent?: React.ReactNode;
|
|
13
|
+
afterContent?: React.ReactNode;
|
|
12
14
|
description?: any;
|
|
13
15
|
} & React.RefAttributes<unknown>>;
|
|
@@ -34,15 +34,15 @@ interface FilterContentProps {
|
|
|
34
34
|
* 支持新的数据结构格式:
|
|
35
35
|
* ```typescript
|
|
36
36
|
* {
|
|
37
|
-
* "logic": "or",
|
|
37
|
+
* "logic": "$or",
|
|
38
38
|
* "items": [
|
|
39
39
|
* {
|
|
40
40
|
* "path": "isAdmin",
|
|
41
|
-
* "operator": "eq",
|
|
41
|
+
* "operator": "$eq",
|
|
42
42
|
* "value": true
|
|
43
43
|
* },
|
|
44
44
|
* {
|
|
45
|
-
* "logic": "and",
|
|
45
|
+
* "logic": "$and",
|
|
46
46
|
* "items": [...]
|
|
47
47
|
* }
|
|
48
48
|
* ]
|
|
@@ -52,7 +52,7 @@ interface FilterContentProps {
|
|
|
52
52
|
* @example
|
|
53
53
|
* ```typescript
|
|
54
54
|
* const filterValue = observable({
|
|
55
|
-
* logic: 'and',
|
|
55
|
+
* logic: '$and',
|
|
56
56
|
* items: []
|
|
57
57
|
* });
|
|
58
58
|
*
|
|
@@ -6,8 +6,8 @@
|
|
|
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
|
-
import { FlowModel, FlowModelContext, ModelRenderMode } from '@nocobase/flow-engine';
|
|
9
|
+
import { FlowModel, FlowModelContext, ModelRenderMode, SubModelItem } from '@nocobase/flow-engine';
|
|
10
10
|
export declare class DetailsCustomItemModel extends FlowModel {
|
|
11
11
|
static renderMode: ModelRenderMode;
|
|
12
|
-
static defineChildren(ctx: FlowModelContext):
|
|
12
|
+
static defineChildren(ctx: FlowModelContext): Promise<SubModelItem[]> | SubModelItem[];
|
|
13
13
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
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
|
-
import { FlowModelContext } from '@nocobase/flow-engine';
|
|
9
|
+
import { FlowModelContext, type SubModelItem } from '@nocobase/flow-engine';
|
|
10
10
|
import { DetailsCustomItemModel } from './DetailsCustomItemModel';
|
|
11
11
|
/**
|
|
12
12
|
* “JavaScript 字段”菜单入口(详情):
|
|
@@ -15,5 +15,5 @@ import { DetailsCustomItemModel } from './DetailsCustomItemModel';
|
|
|
15
15
|
* - 点击后创建 DetailsItemModel,并将其 subModels.field 固定为 JSFieldModel。
|
|
16
16
|
*/
|
|
17
17
|
export declare class DetailsJSFieldItemModel extends DetailsCustomItemModel {
|
|
18
|
-
static defineChildren(ctx: FlowModelContext):
|
|
18
|
+
static defineChildren(ctx: FlowModelContext): Promise<SubModelItem[]>;
|
|
19
19
|
}
|
|
@@ -14,5 +14,5 @@ import { FlowModel, FlowModelContext } from '@nocobase/flow-engine';
|
|
|
14
14
|
* - 点击后创建标准 FormItemModel,并将子字段设置为 JSEditableFieldModel。
|
|
15
15
|
*/
|
|
16
16
|
export declare class FormJSFieldItemModel extends FlowModel {
|
|
17
|
-
static defineChildren(ctx: FlowModelContext): import("@nocobase/flow-engine").SubModelItem[]
|
|
17
|
+
static defineChildren(ctx: FlowModelContext): Promise<import("@nocobase/flow-engine").SubModelItem[]>;
|
|
18
18
|
}
|
|
@@ -35,6 +35,10 @@ export declare class TableBlockModel extends CollectionBlockModel<TableBlockMode
|
|
|
35
35
|
};
|
|
36
36
|
customModelClasses: CustomTableBlockModelClassesEnum;
|
|
37
37
|
get resource(): MultiRecordResource<any>;
|
|
38
|
+
private readonly columns;
|
|
39
|
+
private disposeAutorun;
|
|
40
|
+
onMount(): void;
|
|
41
|
+
onUnmount(): void;
|
|
38
42
|
createResource(ctx: any, params: any): MultiRecordResource<unknown>;
|
|
39
43
|
getColumns(): any[];
|
|
40
44
|
EditableRow: (props: any) => React.JSX.Element;
|
|
@@ -6,7 +6,7 @@
|
|
|
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
|
-
import { FlowModelContext } from '@nocobase/flow-engine';
|
|
9
|
+
import { FlowModelContext, type SubModelItem } from '@nocobase/flow-engine';
|
|
10
10
|
import { TableCustomColumnModel } from './TableCustomColumnModel';
|
|
11
11
|
/**
|
|
12
12
|
* “JavaScript 字段”菜单入口(表格):
|
|
@@ -15,5 +15,5 @@ import { TableCustomColumnModel } from './TableCustomColumnModel';
|
|
|
15
15
|
* - 点击后创建 TableColumnModel,并将其 subModels.field 固定为 JSFieldModel。
|
|
16
16
|
*/
|
|
17
17
|
export declare class TableJSFieldItemModel extends TableCustomColumnModel {
|
|
18
|
-
static defineChildren(ctx: FlowModelContext):
|
|
18
|
+
static defineChildren(ctx: FlowModelContext): Promise<SubModelItem[]>;
|
|
19
19
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 FlowModelContext, type SubModelItem } from '@nocobase/flow-engine';
|
|
10
|
+
export interface TransformOptions {
|
|
11
|
+
fieldUseModel: string;
|
|
12
|
+
refreshTargets: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 递归将 SubModelItem 列表中的叶子节点 createModelOptions 重写为指定的 JS 字段模型。
|
|
16
|
+
* - 保留 children 的形态:数组或函数;
|
|
17
|
+
* - 对函数型 children 做一层包裹,确保返回结果继续被转换;
|
|
18
|
+
* - 对已有 createModelOptions(对象或函数)做二次包装并追加 subModels.field.use。
|
|
19
|
+
*/
|
|
20
|
+
export declare function transformChildrenToJS(items: SubModelItem[] | false | undefined, options: TransformOptions): SubModelItem[];
|
|
21
|
+
/**
|
|
22
|
+
* 构造“关联字段(JS 化)”分组节点,支持懒加载 children 并在返回时完成 JS 化。
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildAssociationJSGroup(ctx: FlowModelContext, provider: (ctx: FlowModelContext) => SubModelItem[] | Promise<SubModelItem[]>, options: TransformOptions & {
|
|
25
|
+
key?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
searchable?: boolean;
|
|
28
|
+
searchPlaceholder?: string;
|
|
29
|
+
}): SubModelItem;
|
|
30
|
+
export declare function buildFormAssociationChildren(ctx: FlowModelContext): SubModelItem[];
|
|
31
|
+
export interface JSFieldMenuChildrenOptions {
|
|
32
|
+
useModel: string;
|
|
33
|
+
fieldUseModel: string;
|
|
34
|
+
refreshTargets: string[];
|
|
35
|
+
associationPathName?: string;
|
|
36
|
+
associationProvider: (ctx: FlowModelContext) => SubModelItem[] | Promise<SubModelItem[]>;
|
|
37
|
+
}
|
|
38
|
+
export declare function buildJSFieldMenuChildren(ctx: FlowModelContext, opts: JSFieldMenuChildrenOptions): Promise<SubModelItem[]>;
|
package/es/index.mjs
CHANGED
|
@@ -9588,7 +9588,7 @@ function addAppVersion(e, t) {
|
|
|
9588
9588
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
9589
9589
|
}), e;
|
|
9590
9590
|
}
|
|
9591
|
-
const name = "@nocobase/client", version = "2.0.0-alpha.
|
|
9591
|
+
const name = "@nocobase/client", version = "2.0.0-alpha.15", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
9592
9592
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
9593
9593
|
"@ant-design/cssinjs": "^1.11.1",
|
|
9594
9594
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -9611,10 +9611,10 @@ const name = "@nocobase/client", version = "2.0.0-alpha.14", license = "AGPL-3.0
|
|
|
9611
9611
|
"@formily/reactive-react": "^2.2.27",
|
|
9612
9612
|
"@formily/shared": "^2.2.27",
|
|
9613
9613
|
"@formily/validator": "^2.2.27",
|
|
9614
|
-
"@nocobase/evaluators": "2.0.0-alpha.
|
|
9615
|
-
"@nocobase/flow-engine": "2.0.0-alpha.
|
|
9616
|
-
"@nocobase/sdk": "2.0.0-alpha.
|
|
9617
|
-
"@nocobase/utils": "2.0.0-alpha.
|
|
9614
|
+
"@nocobase/evaluators": "2.0.0-alpha.15",
|
|
9615
|
+
"@nocobase/flow-engine": "2.0.0-alpha.15",
|
|
9616
|
+
"@nocobase/sdk": "2.0.0-alpha.15",
|
|
9617
|
+
"@nocobase/utils": "2.0.0-alpha.15",
|
|
9618
9618
|
"@tanstack/react-table": "^8.21.3",
|
|
9619
9619
|
"@types/tabulator-tables": "^6.2.6",
|
|
9620
9620
|
ahooks: "^3.7.2",
|
|
@@ -10436,6 +10436,7 @@ const opacityStyle = {
|
|
|
10436
10436
|
/* @__PURE__ */ jsx(Spin, I(f({}, _.omit(e, "children")), { style: e.spinning ? spinStyle : displayNone$3 })),
|
|
10437
10437
|
/* @__PURE__ */ jsx("div", { style: e.spinning ? opacityStyle : null, children: e.children })
|
|
10438
10438
|
] }));
|
|
10439
|
+
HighPerformanceSpin.displayName = "HighPerformanceSpin";
|
|
10439
10440
|
var FilterBlockType = /* @__PURE__ */ ((e) => (e[e.FORM = 0] = "FORM", e[e.TABLE = 1] = "TABLE", e[e.TREE = 2] = "TREE", e[e.COLLAPSE = 3] = "COLLAPSE", e))(FilterBlockType || {});
|
|
10440
10441
|
const mergeFilter = (e, t = "$and") => {
|
|
10441
10442
|
const o = e.filter((n) => {
|
|
@@ -65400,7 +65401,7 @@ const BlockConfigsContext = createContext({
|
|
|
65400
65401
|
(e) => {
|
|
65401
65402
|
var l;
|
|
65402
65403
|
const { value: t, FilterItem: o, ctx: n } = e;
|
|
65403
|
-
t.logic || (t.logic = "and"), Array.isArray(t.items) || (t.items = []);
|
|
65404
|
+
t.logic || (t.logic = "$and"), Array.isArray(t.items) || (t.items = []);
|
|
65404
65405
|
const r = () => {
|
|
65405
65406
|
var c;
|
|
65406
65407
|
(c = n == null ? void 0 : n.model) != null && c.dispatchEvent && n.model.dispatchEvent("reset");
|
|
@@ -67135,7 +67136,7 @@ class GridModel extends FlowModel {
|
|
|
67135
67136
|
MemoFlowModelRenderer,
|
|
67136
67137
|
{
|
|
67137
67138
|
model: a,
|
|
67138
|
-
fallback: this.itemFallback,
|
|
67139
|
+
fallback: r.skeleton || this.itemFallback,
|
|
67139
67140
|
showFlowSettings: this.flowEngine.flowSettings.enabled ? this.getItemFlowSettings() : !1,
|
|
67140
67141
|
showErrorFallback: !0,
|
|
67141
67142
|
settingsMenuLevel: (l = a == null ? void 0 : a.settingsMenuLevel) != null ? l : this.itemSettingsMenuLevel,
|
|
@@ -67503,41 +67504,47 @@ const useMarkdownStyles = () => {
|
|
|
67503
67504
|
}
|
|
67504
67505
|
);
|
|
67505
67506
|
return /* @__PURE__ */ jsx(Fragment$1, { children: t ? r : i });
|
|
67506
|
-
}, useBlockHeight = ({ height: e, heightMode: t }) => t !== "specifyValue" ? null : e, BlockItemCard = React.forwardRef(
|
|
67507
|
-
|
|
67508
|
-
/* @__PURE__ */ jsxs("
|
|
67509
|
-
|
|
67510
|
-
|
|
67511
|
-
|
|
67512
|
-
|
|
67513
|
-
|
|
67514
|
-
|
|
67515
|
-
|
|
67516
|
-
|
|
67517
|
-
|
|
67518
|
-
|
|
67519
|
-
|
|
67520
|
-
|
|
67521
|
-
|
|
67507
|
+
}, useBlockHeight = ({ height: e, heightMode: t }) => t !== "specifyValue" ? null : e, BlockItemCard = React.forwardRef(
|
|
67508
|
+
(e, t) => {
|
|
67509
|
+
const { t: o } = useTranslation(), { token: n } = theme.useToken(), p = e, { title: r, description: i, children: a, className: l } = p, c = W(p, ["title", "description", "children", "className"]), u = useBlockHeight(e), d = (r || i) && /* @__PURE__ */ jsxs("div", { style: { padding: "8px 0px 8px" }, children: [
|
|
67510
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
67511
|
+
" ",
|
|
67512
|
+
o(r, { ns: NAMESPACE_UI_SCHEMA })
|
|
67513
|
+
] }),
|
|
67514
|
+
i && /* @__PURE__ */ jsx(
|
|
67515
|
+
DisplayMarkdown,
|
|
67516
|
+
{
|
|
67517
|
+
value: o(i, { ns: NAMESPACE_UI_SCHEMA }),
|
|
67518
|
+
style: {
|
|
67519
|
+
overflowWrap: "break-word",
|
|
67520
|
+
whiteSpace: "normal",
|
|
67521
|
+
fontWeight: 400,
|
|
67522
|
+
color: n.colorTextDescription,
|
|
67523
|
+
borderRadius: "4px"
|
|
67524
|
+
}
|
|
67522
67525
|
}
|
|
67523
|
-
|
|
67524
|
-
)
|
|
67525
|
-
|
|
67526
|
-
|
|
67527
|
-
|
|
67528
|
-
|
|
67529
|
-
|
|
67530
|
-
|
|
67531
|
-
|
|
67532
|
-
|
|
67533
|
-
|
|
67534
|
-
|
|
67535
|
-
|
|
67536
|
-
|
|
67537
|
-
|
|
67538
|
-
|
|
67539
|
-
|
|
67540
|
-
|
|
67526
|
+
)
|
|
67527
|
+
] });
|
|
67528
|
+
return /* @__PURE__ */ jsxs(
|
|
67529
|
+
Card,
|
|
67530
|
+
I(f({
|
|
67531
|
+
ref: t,
|
|
67532
|
+
title: d,
|
|
67533
|
+
style: { display: "flex", flexDirection: "column", height: u },
|
|
67534
|
+
styles: {
|
|
67535
|
+
body: { flex: 1, display: "flex", flexDirection: "column", overflow: "auto" }
|
|
67536
|
+
},
|
|
67537
|
+
className: l
|
|
67538
|
+
}, c), {
|
|
67539
|
+
children: [
|
|
67540
|
+
e.beforeContent,
|
|
67541
|
+
a,
|
|
67542
|
+
e.afterContent
|
|
67543
|
+
]
|
|
67544
|
+
})
|
|
67545
|
+
);
|
|
67546
|
+
}
|
|
67547
|
+
), getContentWidth = (e) => {
|
|
67541
67548
|
if (e) {
|
|
67542
67549
|
const t = document.createRange();
|
|
67543
67550
|
return t.selectNodeContents(e), t.getBoundingClientRect().width;
|
|
@@ -67548,6 +67555,10 @@ const useMarkdownStyles = () => {
|
|
|
67548
67555
|
textOverflow: "ellipsis",
|
|
67549
67556
|
whiteSpace: "nowrap",
|
|
67550
67557
|
wordBreak: "break-all"
|
|
67558
|
+
}, wrappingDefaultStyle = {
|
|
67559
|
+
overflowWrap: "break-word",
|
|
67560
|
+
whiteSpace: "normal",
|
|
67561
|
+
wordBreak: "break-word"
|
|
67551
67562
|
}, isOverflowTooltip = (e) => {
|
|
67552
67563
|
if (!e)
|
|
67553
67564
|
return !1;
|
|
@@ -67569,10 +67580,19 @@ const useMarkdownStyles = () => {
|
|
|
67569
67580
|
const l = useCallback((u) => {
|
|
67570
67581
|
const d = u.target;
|
|
67571
67582
|
isOverflowTooltip(a.current) && n(d.scrollWidth >= d.clientWidth);
|
|
67572
|
-
}, []), c = useMemo(
|
|
67573
|
-
|
|
67574
|
-
|
|
67575
|
-
|
|
67583
|
+
}, []), c = useMemo(() => {
|
|
67584
|
+
const u = e.ellipsis ? { onMouseEnter: l } : {};
|
|
67585
|
+
return /* @__PURE__ */ jsx(
|
|
67586
|
+
"div",
|
|
67587
|
+
I(f({
|
|
67588
|
+
ref: a,
|
|
67589
|
+
role: e.role,
|
|
67590
|
+
style: e.ellipsis ? ellipsisDefaultStyle : wrappingDefaultStyle
|
|
67591
|
+
}, u), {
|
|
67592
|
+
children: e.children
|
|
67593
|
+
})
|
|
67594
|
+
);
|
|
67595
|
+
}, [l, e.children, e.ellipsis, e.role]);
|
|
67576
67596
|
return !e.ellipsis || !o ? c : /* @__PURE__ */ jsx(
|
|
67577
67597
|
Popover,
|
|
67578
67598
|
{
|
|
@@ -71886,15 +71906,82 @@ DetailsGridModel.registerFlow({
|
|
|
71886
71906
|
}
|
|
71887
71907
|
}
|
|
71888
71908
|
});
|
|
71909
|
+
function transformChildrenToJS(e, t) {
|
|
71910
|
+
const { fieldUseModel: o, refreshTargets: n } = t, r = (i) => Array.isArray(i) ? i.map((a) => {
|
|
71911
|
+
const l = f({}, a);
|
|
71912
|
+
if (l.children)
|
|
71913
|
+
if (typeof l.children == "function") {
|
|
71914
|
+
const c = l.children;
|
|
71915
|
+
l.children = (u) => O(this, null, function* () {
|
|
71916
|
+
const d = yield c(u);
|
|
71917
|
+
return r(d);
|
|
71918
|
+
});
|
|
71919
|
+
} else
|
|
71920
|
+
Array.isArray(l.children) && (l.children = r(l.children));
|
|
71921
|
+
if (l.createModelOptions) {
|
|
71922
|
+
const c = l.createModelOptions;
|
|
71923
|
+
l.createModelOptions = (u, d) => O(this, null, function* () {
|
|
71924
|
+
const p = yield typeof c == "function" ? c(u, d) : c;
|
|
71925
|
+
return p.subModels = p.subModels || {}, p.subModels.field = I(f({}, p.subModels.field || {}), { use: o }), p;
|
|
71926
|
+
}), l.refreshTargets = l.refreshTargets || n;
|
|
71927
|
+
}
|
|
71928
|
+
return l;
|
|
71929
|
+
}) : [];
|
|
71930
|
+
return r(e);
|
|
71931
|
+
}
|
|
71932
|
+
function buildAssociationJSGroup(e, t, o) {
|
|
71933
|
+
var u, d, p, m;
|
|
71934
|
+
const { fieldUseModel: n, refreshTargets: r } = o, i = (u = o.key) != null ? u : "js-association-fields", a = (d = o.label) != null ? d : escapeT("Display association fields"), l = (p = o.searchable) != null ? p : !0, c = (m = o.searchPlaceholder) != null ? m : escapeT("Search fields");
|
|
71935
|
+
return {
|
|
71936
|
+
key: i,
|
|
71937
|
+
type: "group",
|
|
71938
|
+
label: a,
|
|
71939
|
+
searchable: l,
|
|
71940
|
+
searchPlaceholder: c,
|
|
71941
|
+
children: (h) => O(this, null, function* () {
|
|
71942
|
+
const g = yield t(h);
|
|
71943
|
+
return transformChildrenToJS(g, { fieldUseModel: n, refreshTargets: r });
|
|
71944
|
+
})
|
|
71945
|
+
};
|
|
71946
|
+
}
|
|
71947
|
+
class FormAssociationFieldGroupShim extends AssociationFieldGroupModel {
|
|
71948
|
+
}
|
|
71949
|
+
k(FormAssociationFieldGroupShim, "itemModelName", "FormItemModel");
|
|
71950
|
+
function buildFormAssociationChildren(e) {
|
|
71951
|
+
return FormAssociationFieldGroupShim.defineChildren(e);
|
|
71952
|
+
}
|
|
71953
|
+
function buildJSFieldMenuChildren(e, t) {
|
|
71954
|
+
return O(this, null, function* () {
|
|
71955
|
+
var m;
|
|
71956
|
+
const { useModel: o, fieldUseModel: n, refreshTargets: r, associationPathName: i, associationProvider: a } = t, l = buildWrapperFieldChildren(e, {
|
|
71957
|
+
useModel: o,
|
|
71958
|
+
fieldUseModel: n,
|
|
71959
|
+
associationPathName: i,
|
|
71960
|
+
refreshTargets: r
|
|
71961
|
+
});
|
|
71962
|
+
let c = [];
|
|
71963
|
+
const u = (m = l == null ? void 0 : l[0]) == null ? void 0 : m.children;
|
|
71964
|
+
Array.isArray(u) && (c = u);
|
|
71965
|
+
let d = [...c];
|
|
71966
|
+
const p = yield a(e);
|
|
71967
|
+
if (Array.isArray(p) && p.length > 0) {
|
|
71968
|
+
const h = buildAssociationJSGroup(e, a, {
|
|
71969
|
+
fieldUseModel: n,
|
|
71970
|
+
refreshTargets: r
|
|
71971
|
+
});
|
|
71972
|
+
d = [...c, h];
|
|
71973
|
+
}
|
|
71974
|
+
return d;
|
|
71975
|
+
});
|
|
71976
|
+
}
|
|
71889
71977
|
class DetailsJSFieldItemModel extends DetailsCustomItemModel {
|
|
71890
71978
|
static defineChildren(t) {
|
|
71891
|
-
|
|
71892
|
-
const o = buildWrapperFieldChildren(t, {
|
|
71979
|
+
return buildJSFieldMenuChildren(t, {
|
|
71893
71980
|
useModel: "DetailsItemModel",
|
|
71894
71981
|
fieldUseModel: "JSFieldModel",
|
|
71895
|
-
refreshTargets: ["DetailsItemModel"]
|
|
71982
|
+
refreshTargets: ["DetailsItemModel"],
|
|
71983
|
+
associationProvider: (o) => DetailsAssociationFieldGroupModel.defineChildren(o)
|
|
71896
71984
|
});
|
|
71897
|
-
return ((n = o == null ? void 0 : o[0]) == null ? void 0 : n.children) || [];
|
|
71898
71985
|
}
|
|
71899
71986
|
}
|
|
71900
71987
|
DetailsJSFieldItemModel.define({
|
|
@@ -73831,14 +73918,13 @@ FormCustomItemModel.define({
|
|
|
73831
73918
|
});
|
|
73832
73919
|
class FormJSFieldItemModel extends FlowModel {
|
|
73833
73920
|
static defineChildren(t) {
|
|
73834
|
-
|
|
73835
|
-
const o = buildWrapperFieldChildren(t, {
|
|
73921
|
+
return buildJSFieldMenuChildren(t, {
|
|
73836
73922
|
useModel: "FormItemModel",
|
|
73837
73923
|
fieldUseModel: "JSEditableFieldModel",
|
|
73838
73924
|
associationPathName: t.prefixFieldPath,
|
|
73839
|
-
refreshTargets: ["FormItemModel", "FilterFormItemModel"]
|
|
73925
|
+
refreshTargets: ["FormItemModel", "FilterFormItemModel"],
|
|
73926
|
+
associationProvider: buildFormAssociationChildren
|
|
73840
73927
|
});
|
|
73841
|
-
return ((n = o == null ? void 0 : o[0]) == null ? void 0 : n.children) || [];
|
|
73842
73928
|
}
|
|
73843
73929
|
}
|
|
73844
73930
|
FormJSFieldItemModel.define({
|
|
@@ -74363,7 +74449,7 @@ function adjustColumnOrder(e) {
|
|
|
74363
74449
|
r.fixed === "left" ? t.push(r) : r.fixed === "right" ? n.push(r) : o.push(r);
|
|
74364
74450
|
}), [...t, ...o, ...n];
|
|
74365
74451
|
}
|
|
74366
|
-
const TableIndex = (e) => {
|
|
74452
|
+
const MemoizedTable = React.memo(Table$3), TableIndex = (e) => {
|
|
74367
74453
|
const n = e, { index: t } = n, o = W(n, ["index"]);
|
|
74368
74454
|
return /* @__PURE__ */ jsx("div", I(f({ className: classNames("nb-table-index"), style: { padding: "0 8px 0 16px" } }, o), { children: t }));
|
|
74369
74455
|
}, rowSelectCheckboxWrapperClass = css`
|
|
@@ -74433,6 +74519,8 @@ class TableBlockModel extends CollectionBlockModel {
|
|
|
74433
74519
|
TableCustomColumnModel: "TableCustomColumnModel"
|
|
74434
74520
|
});
|
|
74435
74521
|
k(this, "customModelClasses", {});
|
|
74522
|
+
k(this, "columns", observable$1.ref([]));
|
|
74523
|
+
k(this, "disposeAutorun");
|
|
74436
74524
|
k(this, "EditableRow", (o) => /* @__PURE__ */ jsx("tr", f({}, o)));
|
|
74437
74525
|
k(this, "EditableCell", observer((o) => {
|
|
74438
74526
|
const g = o, { className: n, title: r, editable: i, width: a, record: l, recordIndex: c, dataIndex: u, children: d, model: p } = g, m = W(g, ["className", "title", "editable", "width", "record", "recordIndex", "dataIndex", "children", "model"]), h = useRef(null);
|
|
@@ -74551,6 +74639,14 @@ class TableBlockModel extends CollectionBlockModel {
|
|
|
74551
74639
|
get resource() {
|
|
74552
74640
|
return super.resource;
|
|
74553
74641
|
}
|
|
74642
|
+
onMount() {
|
|
74643
|
+
super.onMount(), this.disposeAutorun = autorun$1(() => {
|
|
74644
|
+
this.columns.value = this.getColumns();
|
|
74645
|
+
});
|
|
74646
|
+
}
|
|
74647
|
+
onUnmount() {
|
|
74648
|
+
super.onUnmount(), this.disposeAutorun && this.disposeAutorun();
|
|
74649
|
+
}
|
|
74554
74650
|
createResource(o, n) {
|
|
74555
74651
|
return this.context.createResource(MultiRecordResource);
|
|
74556
74652
|
}
|
|
@@ -74618,7 +74714,7 @@ class TableBlockModel extends CollectionBlockModel {
|
|
|
74618
74714
|
};
|
|
74619
74715
|
}
|
|
74620
74716
|
renderComponent() {
|
|
74621
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
74717
|
+
return this.columns.value.length ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
74622
74718
|
/* @__PURE__ */ jsx(DndProvider, { children: /* @__PURE__ */ jsxs(
|
|
74623
74719
|
"div",
|
|
74624
74720
|
{
|
|
@@ -74661,34 +74757,18 @@ class TableBlockModel extends CollectionBlockModel {
|
|
|
74661
74757
|
]
|
|
74662
74758
|
}
|
|
74663
74759
|
) }),
|
|
74664
|
-
/* @__PURE__ */ jsx(
|
|
74665
|
-
|
|
74760
|
+
/* @__PURE__ */ jsx(HighPerformanceSpin, { spinning: !!this.resource.loading, children: /* @__PURE__ */ jsx(
|
|
74761
|
+
HighPerformanceTable,
|
|
74666
74762
|
{
|
|
74667
|
-
|
|
74668
|
-
tableLayout: "fixed",
|
|
74763
|
+
model: this,
|
|
74669
74764
|
size: this.props.size,
|
|
74670
|
-
rowKey: this.collection.filterTargetKey,
|
|
74671
|
-
rowSelection: f({
|
|
74672
|
-
columnWidth: 50,
|
|
74673
|
-
type: "checkbox",
|
|
74674
|
-
onChange: (o, n) => {
|
|
74675
|
-
this.resource.setSelectedRows(n);
|
|
74676
|
-
},
|
|
74677
|
-
selectedRowKeys: this.resource.getSelectedRows().map((o) => o[this.collection.filterTargetKey]),
|
|
74678
|
-
renderCell: this.renderCell
|
|
74679
|
-
}, this.rowSelectionProps),
|
|
74680
|
-
loading: this.resource.loading,
|
|
74681
74765
|
virtual: this.props.virtual,
|
|
74682
|
-
scroll: { x: "max-content" },
|
|
74683
74766
|
dataSource: this.resource.getData(),
|
|
74684
|
-
columns: this.
|
|
74685
|
-
pagination: this.pagination()
|
|
74686
|
-
onChange: (o) => {
|
|
74687
|
-
console.log("onChange pagination:", o), this.resource.loading = !0, this.resource.setPage(o.current), this.resource.setPageSize(o.pageSize), this.resource.refresh();
|
|
74688
|
-
}
|
|
74767
|
+
columns: this.columns.value,
|
|
74768
|
+
pagination: this.pagination()
|
|
74689
74769
|
}
|
|
74690
|
-
)
|
|
74691
|
-
] });
|
|
74770
|
+
) })
|
|
74771
|
+
] }) : /* @__PURE__ */ jsx(Skeleton, { paragraph: { rows: 3 } });
|
|
74692
74772
|
}
|
|
74693
74773
|
}
|
|
74694
74774
|
k(TableBlockModel, "scene", BlockSceneEnum.many);
|
|
@@ -74837,6 +74917,41 @@ TableBlockModel.define({
|
|
|
74837
74917
|
},
|
|
74838
74918
|
sort: 300
|
|
74839
74919
|
});
|
|
74920
|
+
const tableScroll = { x: "max-content" }, HighPerformanceTable = React.memo(
|
|
74921
|
+
(e) => {
|
|
74922
|
+
const { model: t, size: o, virtual: n, dataSource: r, columns: i, pagination: a } = e, l = useMemo(() => f({
|
|
74923
|
+
columnWidth: 50,
|
|
74924
|
+
type: "checkbox",
|
|
74925
|
+
onChange: (d, p) => {
|
|
74926
|
+
t.resource.setSelectedRows(p);
|
|
74927
|
+
},
|
|
74928
|
+
selectedRowKeys: t.resource.getSelectedRows().map((d) => d[t.collection.filterTargetKey]),
|
|
74929
|
+
renderCell: t.renderCell
|
|
74930
|
+
}, t.rowSelectionProps), [t]), c = useCallback(
|
|
74931
|
+
(d) => {
|
|
74932
|
+
console.log("onChange pagination:", d), t.resource.loading = !0, t.resource.setPage(d.current), t.resource.setPageSize(d.pageSize), t.resource.refresh();
|
|
74933
|
+
},
|
|
74934
|
+
[t]
|
|
74935
|
+
), u = useMemo(() => a, [r]);
|
|
74936
|
+
return /* @__PURE__ */ jsx(
|
|
74937
|
+
MemoizedTable,
|
|
74938
|
+
{
|
|
74939
|
+
components: t.components,
|
|
74940
|
+
tableLayout: "fixed",
|
|
74941
|
+
size: o,
|
|
74942
|
+
rowKey: t.collection.filterTargetKey,
|
|
74943
|
+
rowSelection: l,
|
|
74944
|
+
virtual: n,
|
|
74945
|
+
scroll: tableScroll,
|
|
74946
|
+
dataSource: r,
|
|
74947
|
+
columns: i,
|
|
74948
|
+
pagination: u,
|
|
74949
|
+
onChange: c
|
|
74950
|
+
}
|
|
74951
|
+
);
|
|
74952
|
+
}
|
|
74953
|
+
);
|
|
74954
|
+
HighPerformanceTable.displayName = "HighPerformanceTable";
|
|
74840
74955
|
function FieldDeletePlaceholder() {
|
|
74841
74956
|
const { t: e } = useTranslation(), t = useFlowModel(), o = t.context.blockModel, n = o.collection.dataSource, r = o.collection, i = t.fieldPath, a = useMemo(() => {
|
|
74842
74957
|
const c = `${e(n.displayName || n.key)} > `, u = r ? `${e(r.title) || r.name || r.tableName} > ` : "";
|
|
@@ -75177,13 +75292,12 @@ TableSelectModel.define({
|
|
|
75177
75292
|
});
|
|
75178
75293
|
class TableJSFieldItemModel extends TableCustomColumnModel {
|
|
75179
75294
|
static defineChildren(t) {
|
|
75180
|
-
|
|
75181
|
-
const o = buildWrapperFieldChildren(t, {
|
|
75295
|
+
return buildJSFieldMenuChildren(t, {
|
|
75182
75296
|
useModel: "TableColumnModel",
|
|
75183
75297
|
fieldUseModel: "JSFieldModel",
|
|
75184
|
-
refreshTargets: ["TableColumnModel"]
|
|
75298
|
+
refreshTargets: ["TableColumnModel"],
|
|
75299
|
+
associationProvider: (o) => TableAssociationFieldGroupModel.defineChildren(o)
|
|
75185
75300
|
});
|
|
75186
|
-
return ((n = o == null ? void 0 : o[0]) == null ? void 0 : n.children) || [];
|
|
75187
75301
|
}
|
|
75188
75302
|
}
|
|
75189
75303
|
TableJSFieldItemModel.define({
|
|
@@ -78697,37 +78811,20 @@ class ClickableFieldModel extends FieldModel {
|
|
|
78697
78811
|
* 基类统一渲染逻辑
|
|
78698
78812
|
*/
|
|
78699
78813
|
render() {
|
|
78700
|
-
const { value: t, displayStyle: o, fieldNames: n, overflowMode: r
|
|
78701
|
-
|
|
78702
|
-
tooltip: {
|
|
78703
|
-
rootClassName: css`
|
|
78704
|
-
.ant-tooltip-inner {
|
|
78705
|
-
color: #000;
|
|
78706
|
-
}
|
|
78707
|
-
`,
|
|
78708
|
-
color: "#fff"
|
|
78709
|
-
}
|
|
78710
|
-
} : !1,
|
|
78711
|
-
// 处理省略显示
|
|
78712
|
-
style: {
|
|
78713
|
-
whiteSpace: r === "wrap" ? "normal" : "nowrap",
|
|
78714
|
-
// 控制换行
|
|
78715
|
-
width: i || "auto"
|
|
78716
|
-
}
|
|
78717
|
-
};
|
|
78718
|
-
if (a)
|
|
78814
|
+
const { value: t, displayStyle: o, fieldNames: n, overflowMode: r } = this.props, i = this.props.titleField || (n == null ? void 0 : n.label), a = r === "ellipsis";
|
|
78815
|
+
if (i)
|
|
78719
78816
|
if (o === "tag") {
|
|
78720
|
-
const
|
|
78721
|
-
return /* @__PURE__ */ jsx(
|
|
78817
|
+
const l = castArray(t).map((c, u) => /* @__PURE__ */ jsx(React.Fragment, { children: this.renderInDisplayStyle(c == null ? void 0 : c[i], c) }, u));
|
|
78818
|
+
return /* @__PURE__ */ jsx(EllipsisWithTooltip, { ellipsis: a, children: l });
|
|
78722
78819
|
} else {
|
|
78723
|
-
const
|
|
78724
|
-
const
|
|
78725
|
-
return
|
|
78820
|
+
const l = castArray(t).flatMap((c, u) => {
|
|
78821
|
+
const d = this.renderInDisplayStyle(c == null ? void 0 : c[i], c);
|
|
78822
|
+
return u === 0 ? [d] : [/* @__PURE__ */ jsx("span", { children: ", " }, `sep-${u}`), d];
|
|
78726
78823
|
});
|
|
78727
|
-
return /* @__PURE__ */ jsx(
|
|
78824
|
+
return /* @__PURE__ */ jsx(EllipsisWithTooltip, { ellipsis: a, children: l });
|
|
78728
78825
|
}
|
|
78729
78826
|
else
|
|
78730
|
-
return /* @__PURE__ */ jsx(
|
|
78827
|
+
return /* @__PURE__ */ jsx(EllipsisWithTooltip, { ellipsis: a, children: this.renderInDisplayStyle(t) });
|
|
78731
78828
|
}
|
|
78732
78829
|
}
|
|
78733
78830
|
ClickableFieldModel.registerFlow({
|