@nocobase/client 2.0.0-alpha.55 → 2.0.0-alpha.56
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/models/base/GridModel.d.ts +19 -0
- package/es/flow/models/blocks/details/DetailsBlockModel.d.ts +1 -0
- package/es/index.mjs +115 -45
- package/lib/{index-C3fHjsMw-C1XXV2DW.js → index-C3fHjsMw-DmvAlAgD.js} +133 -133
- package/lib/index.js +8 -8
- package/lib/locale/zh-CN.json +2 -1
- package/package.json +6 -6
|
@@ -70,4 +70,23 @@ export declare class GridModel<T extends {
|
|
|
70
70
|
export declare function transformRowsToSingleColumn(rows: Record<string, string[][]>, options?: {
|
|
71
71
|
emptyColumnUid?: string;
|
|
72
72
|
}): Record<string, string[][]>;
|
|
73
|
+
export declare function recalculateGridSizes({ position, direction, resizeDistance, prevMoveDistance, oldSizes, oldRows, gridContainerWidth, gutter, columnCount, }: {
|
|
74
|
+
position: {
|
|
75
|
+
rowId: string;
|
|
76
|
+
columnIndex: number;
|
|
77
|
+
itemIndex: number;
|
|
78
|
+
};
|
|
79
|
+
direction: 'left' | 'right' | 'bottom' | 'corner';
|
|
80
|
+
resizeDistance: number;
|
|
81
|
+
prevMoveDistance: number;
|
|
82
|
+
oldSizes: Record<string, number[]>;
|
|
83
|
+
oldRows: Record<string, string[][]>;
|
|
84
|
+
gridContainerWidth: number;
|
|
85
|
+
gutter?: number;
|
|
86
|
+
columnCount?: number;
|
|
87
|
+
}): {
|
|
88
|
+
newRows: Record<string, string[][]>;
|
|
89
|
+
newSizes: Record<string, number[]>;
|
|
90
|
+
moveDistance: number;
|
|
91
|
+
};
|
|
73
92
|
export {};
|
|
@@ -32,5 +32,6 @@ export declare class DetailsBlockModel extends CollectionBlockModel<{
|
|
|
32
32
|
handlePageChange: (page: number) => Promise<void>;
|
|
33
33
|
refresh(): Promise<void>;
|
|
34
34
|
renderPagination(): React.JSX.Element;
|
|
35
|
+
renderConfigureActions(): React.JSX.Element;
|
|
35
36
|
renderComponent(): React.JSX.Element;
|
|
36
37
|
}
|
package/es/index.mjs
CHANGED
|
@@ -3833,6 +3833,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3833
3833
|
get readPrettyFormSettings() {
|
|
3834
3834
|
return readPrettyFormSettings;
|
|
3835
3835
|
},
|
|
3836
|
+
get recalculateGridSizes() {
|
|
3837
|
+
return recalculateGridSizes;
|
|
3838
|
+
},
|
|
3836
3839
|
get recordBlockInitializers() {
|
|
3837
3840
|
return recordBlockInitializers;
|
|
3838
3841
|
},
|
|
@@ -9667,7 +9670,7 @@ function addAppVersion(e, t) {
|
|
|
9667
9670
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
9668
9671
|
}), e;
|
|
9669
9672
|
}
|
|
9670
|
-
const name = "@nocobase/client", version = "2.0.0-alpha.
|
|
9673
|
+
const name = "@nocobase/client", version = "2.0.0-alpha.56", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
9671
9674
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
9672
9675
|
"@ant-design/cssinjs": "^1.11.1",
|
|
9673
9676
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -9690,10 +9693,10 @@ const name = "@nocobase/client", version = "2.0.0-alpha.55", license = "AGPL-3.0
|
|
|
9690
9693
|
"@formily/reactive-react": "^2.2.27",
|
|
9691
9694
|
"@formily/shared": "^2.2.27",
|
|
9692
9695
|
"@formily/validator": "^2.2.27",
|
|
9693
|
-
"@nocobase/evaluators": "2.0.0-alpha.
|
|
9694
|
-
"@nocobase/flow-engine": "2.0.0-alpha.
|
|
9695
|
-
"@nocobase/sdk": "2.0.0-alpha.
|
|
9696
|
-
"@nocobase/utils": "2.0.0-alpha.
|
|
9696
|
+
"@nocobase/evaluators": "2.0.0-alpha.56",
|
|
9697
|
+
"@nocobase/flow-engine": "2.0.0-alpha.56",
|
|
9698
|
+
"@nocobase/sdk": "2.0.0-alpha.56",
|
|
9699
|
+
"@nocobase/utils": "2.0.0-alpha.56",
|
|
9697
9700
|
"@tanstack/react-table": "^8.21.3",
|
|
9698
9701
|
"@types/tabulator-tables": "^6.2.6",
|
|
9699
9702
|
"acorn-jsx": "^5.3.2",
|
|
@@ -68258,32 +68261,43 @@ function recalculateGridSizes({
|
|
|
68258
68261
|
gutter: l = 16,
|
|
68259
68262
|
columnCount: c = 24
|
|
68260
68263
|
}) {
|
|
68261
|
-
var
|
|
68262
|
-
const u = _.cloneDeep(i), d = _.cloneDeep(r), p = d[e.rowId] || [], m = l * (p.length - 1)
|
|
68264
|
+
var y, S;
|
|
68265
|
+
const u = _.cloneDeep(i), d = _.cloneDeep(r), p = d[e.rowId] || [], m = l * (p.length - 1);
|
|
68266
|
+
let h = Math.floor(o / (a - m) * c);
|
|
68263
68267
|
if (h === n)
|
|
68264
68268
|
return { newRows: u, newSizes: d, moveDistance: h };
|
|
68265
|
-
|
|
68269
|
+
(S = d[y = e.rowId]) != null || (d[y] = [c]);
|
|
68270
|
+
const g = d[e.rowId];
|
|
68271
|
+
let x = h - n;
|
|
68272
|
+
const b = t === "left" && e.columnIndex > 0, C = t === "right" && e.columnIndex < g.length - 1;
|
|
68273
|
+
if (!b && !C && x > 0) {
|
|
68274
|
+
const v = g.reduce((F, A) => F + A, 0), P = c - v;
|
|
68275
|
+
if (P <= 0)
|
|
68276
|
+
return { newRows: u, newSizes: d, moveDistance: n };
|
|
68277
|
+
x > P && (h = n + P, x = P);
|
|
68278
|
+
}
|
|
68279
|
+
if (d[e.rowId][e.columnIndex] += x, t === "left" && e.columnIndex > 0 && (d[e.rowId][e.columnIndex - 1] -= x, d[e.rowId][e.columnIndex - 1] === 0 && removeEmptyColumnFromRow({
|
|
68266
68280
|
rows: u,
|
|
68267
68281
|
sizes: d,
|
|
68268
68282
|
position: e,
|
|
68269
68283
|
direction: "left"
|
|
68270
68284
|
})), t === "left" && e.columnIndex === 0) {
|
|
68271
|
-
const
|
|
68272
|
-
d[e.rowId][0] < c -
|
|
68285
|
+
const v = d[e.rowId].slice(1).reduce((F, A) => F + A, 0);
|
|
68286
|
+
d[e.rowId][0] < c - v && addEmptyColumnToRow({
|
|
68273
68287
|
rows: u,
|
|
68274
68288
|
sizes: d,
|
|
68275
68289
|
position: e,
|
|
68276
68290
|
direction: "left"
|
|
68277
68291
|
});
|
|
68278
68292
|
}
|
|
68279
|
-
if (t === "right" && e.columnIndex < d[e.rowId].length - 1 && (d[e.rowId][e.columnIndex + 1] -=
|
|
68293
|
+
if (t === "right" && e.columnIndex < d[e.rowId].length - 1 && (d[e.rowId][e.columnIndex + 1] -= x, d[e.rowId][e.columnIndex + 1] === 0 && removeEmptyColumnFromRow({
|
|
68280
68294
|
rows: u,
|
|
68281
68295
|
sizes: d,
|
|
68282
68296
|
position: e,
|
|
68283
68297
|
direction: "right"
|
|
68284
68298
|
})), t === "right" && e.columnIndex === d[e.rowId].length - 1) {
|
|
68285
|
-
const
|
|
68286
|
-
d[e.rowId][e.columnIndex] < c -
|
|
68299
|
+
const v = d[e.rowId].slice(0, -1).reduce((F, A) => F + A, 0);
|
|
68300
|
+
d[e.rowId][e.columnIndex] < c - v && addEmptyColumnToRow({
|
|
68287
68301
|
rows: u,
|
|
68288
68302
|
sizes: d,
|
|
68289
68303
|
position: e,
|
|
@@ -73436,42 +73450,55 @@ class DetailsBlockModel extends CollectionBlockModel {
|
|
|
73436
73450
|
}
|
|
73437
73451
|
);
|
|
73438
73452
|
}
|
|
73453
|
+
renderConfigureActions() {
|
|
73454
|
+
return /* @__PURE__ */ jsx(
|
|
73455
|
+
AddSubModelButton,
|
|
73456
|
+
{
|
|
73457
|
+
model: this,
|
|
73458
|
+
subModelKey: "actions",
|
|
73459
|
+
subModelBaseClass: this.getModelClassName("RecordActionGroupModel"),
|
|
73460
|
+
afterSubModelInit: (o) => O(this, null, function* () {
|
|
73461
|
+
o.setStepParams("buttonSettings", "general", { type: "default" });
|
|
73462
|
+
}),
|
|
73463
|
+
children: /* @__PURE__ */ jsx(FlowSettingsButton, { icon: /* @__PURE__ */ jsx(SettingOutlined, {}), children: this.translate("Actions") })
|
|
73464
|
+
},
|
|
73465
|
+
"details-actions-add"
|
|
73466
|
+
);
|
|
73467
|
+
}
|
|
73439
73468
|
renderComponent() {
|
|
73440
73469
|
var c, u;
|
|
73441
73470
|
const { colon: o, labelAlign: n, labelWidth: r, labelWrap: i, layout: a } = this.props, l = !!((u = (c = this.flowEngine) == null ? void 0 : c.flowSettings) != null && u.enabled);
|
|
73442
73471
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
73443
|
-
/* @__PURE__ */ jsx(DndProvider, { children: /* @__PURE__ */ jsx(
|
|
73444
|
-
|
|
73445
|
-
|
|
73446
|
-
|
|
73447
|
-
|
|
73448
|
-
|
|
73449
|
-
|
|
73450
|
-
|
|
73451
|
-
|
|
73472
|
+
/* @__PURE__ */ jsx(DndProvider, { children: /* @__PURE__ */ jsx(
|
|
73473
|
+
"div",
|
|
73474
|
+
{
|
|
73475
|
+
style: {
|
|
73476
|
+
textAlign: "right",
|
|
73477
|
+
lineHeight: "0px",
|
|
73478
|
+
padding: l && this.context.themeToken.padding
|
|
73479
|
+
},
|
|
73480
|
+
children: /* @__PURE__ */ jsxs(Space$1, { children: [
|
|
73481
|
+
this.mapSubModels("actions", (d) => {
|
|
73482
|
+
if (!(d.hidden && !l))
|
|
73483
|
+
return /* @__PURE__ */ jsx(Droppable, { model: d, children: /* @__PURE__ */ jsx(
|
|
73484
|
+
FlowModelRenderer,
|
|
73452
73485
|
{
|
|
73453
|
-
|
|
73454
|
-
|
|
73455
|
-
|
|
73486
|
+
model: d,
|
|
73487
|
+
showFlowSettings: { showBackground: !1, showBorder: !1, toolbarPosition: "above" },
|
|
73488
|
+
extraToolbarItems: [
|
|
73489
|
+
{
|
|
73490
|
+
key: "drag-handler",
|
|
73491
|
+
component: DragHandler$1,
|
|
73492
|
+
sort: 1
|
|
73493
|
+
}
|
|
73494
|
+
]
|
|
73456
73495
|
}
|
|
73457
|
-
|
|
73458
|
-
}
|
|
73459
|
-
) }, d.uid);
|
|
73460
|
-
}),
|
|
73461
|
-
/* @__PURE__ */ jsx(
|
|
73462
|
-
AddSubModelButton,
|
|
73463
|
-
{
|
|
73464
|
-
model: this,
|
|
73465
|
-
subModelKey: "actions",
|
|
73466
|
-
subModelBaseClass: this.getModelClassName("RecordActionGroupModel"),
|
|
73467
|
-
afterSubModelInit: (d) => O(this, null, function* () {
|
|
73468
|
-
d.setStepParams("buttonSettings", "general", { type: "default" });
|
|
73496
|
+
) }, d.uid);
|
|
73469
73497
|
}),
|
|
73470
|
-
|
|
73471
|
-
}
|
|
73472
|
-
|
|
73473
|
-
|
|
73474
|
-
] }) }) }),
|
|
73498
|
+
this.renderConfigureActions()
|
|
73499
|
+
] })
|
|
73500
|
+
}
|
|
73501
|
+
) }),
|
|
73475
73502
|
/* @__PURE__ */ jsx(FormComponent, { model: this, layoutProps: { colon: o, labelAlign: n, labelWidth: r, labelWrap: i, layout: a }, children: /* @__PURE__ */ jsx(FlowModelRenderer, { model: this.subModels.grid, showFlowSettings: !1 }) }),
|
|
73476
73503
|
this.renderPagination()
|
|
73477
73504
|
] });
|
|
@@ -77071,7 +77098,34 @@ function FieldDeletePlaceholder() {
|
|
|
77071
77098
|
}).replaceAll(">", ">");
|
|
77072
77099
|
return /* @__PURE__ */ jsx(Tooltip, { title: l, children: /* @__PURE__ */ jsx(ExclamationCircleOutlined, { style: { opacity: "0.45" } }) });
|
|
77073
77100
|
}
|
|
77074
|
-
const
|
|
77101
|
+
const CustomWidth = ({ setOpen: e, t, handleChange: o, defaultValue: n }) => {
|
|
77102
|
+
const [r, i] = useState(n);
|
|
77103
|
+
return /* @__PURE__ */ jsx(
|
|
77104
|
+
"div",
|
|
77105
|
+
{
|
|
77106
|
+
onClick: (a) => {
|
|
77107
|
+
a.stopPropagation(), e(!0);
|
|
77108
|
+
},
|
|
77109
|
+
onMouseLeave: () => {
|
|
77110
|
+
e(!0);
|
|
77111
|
+
},
|
|
77112
|
+
children: /* @__PURE__ */ jsxs(Space$1.Compact, { block: !0, children: [
|
|
77113
|
+
/* @__PURE__ */ jsx(
|
|
77114
|
+
InputNumber$1,
|
|
77115
|
+
{
|
|
77116
|
+
placeholder: t("Custom column width"),
|
|
77117
|
+
value: r,
|
|
77118
|
+
onChange: (a) => {
|
|
77119
|
+
i(a);
|
|
77120
|
+
},
|
|
77121
|
+
style: { width: "100%", minWidth: 200 }
|
|
77122
|
+
}
|
|
77123
|
+
),
|
|
77124
|
+
/* @__PURE__ */ jsx(Button, { type: "primary", onClick: () => o(r), children: "OK" })
|
|
77125
|
+
] })
|
|
77126
|
+
}
|
|
77127
|
+
);
|
|
77128
|
+
}, je = class je extends DisplayItemModel {
|
|
77075
77129
|
renderHiddenInConfig() {
|
|
77076
77130
|
return this.fieldDeleted ? /* @__PURE__ */ jsx(FieldDeletePlaceholder, {}) : /* @__PURE__ */ jsx(
|
|
77077
77131
|
Tooltip,
|
|
@@ -77282,6 +77336,7 @@ TableColumnModel.registerFlow({
|
|
|
77282
77336
|
width: {
|
|
77283
77337
|
title: tExpr("Column width"),
|
|
77284
77338
|
uiMode(e) {
|
|
77339
|
+
const t = e.model.props.width;
|
|
77285
77340
|
return {
|
|
77286
77341
|
type: "select",
|
|
77287
77342
|
key: "width",
|
|
@@ -77297,7 +77352,20 @@ TableColumnModel.registerFlow({
|
|
|
77297
77352
|
{ label: 400, value: 400 },
|
|
77298
77353
|
{ label: 450, value: 450 },
|
|
77299
77354
|
{ label: 500, value: 500 }
|
|
77300
|
-
]
|
|
77355
|
+
],
|
|
77356
|
+
dropdownRender: (o, n, r) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
77357
|
+
o,
|
|
77358
|
+
/* @__PURE__ */ jsx(Divider$1, { style: { margin: "4px 0" } }),
|
|
77359
|
+
/* @__PURE__ */ jsx(
|
|
77360
|
+
CustomWidth,
|
|
77361
|
+
{
|
|
77362
|
+
setOpen: n,
|
|
77363
|
+
handleChange: r,
|
|
77364
|
+
t: e.t,
|
|
77365
|
+
defaultValue: [50, 100, 150, 200, 250, 300, 350, 400, 450, 500].includes(t) ? null : t
|
|
77366
|
+
}
|
|
77367
|
+
)
|
|
77368
|
+
] })
|
|
77301
77369
|
}
|
|
77302
77370
|
};
|
|
77303
77371
|
},
|
|
@@ -84110,6 +84178,7 @@ const models = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
84110
84178
|
isFilterValueEmpty,
|
|
84111
84179
|
joinUrlSearch,
|
|
84112
84180
|
operatorComponentProps,
|
|
84181
|
+
recalculateGridSizes,
|
|
84113
84182
|
transformNestedData,
|
|
84114
84183
|
transformRowsToSingleColumn
|
|
84115
84184
|
}, Symbol.toStringTag, { value: "Module" })), openView = defineAction({
|
|
@@ -88578,7 +88647,7 @@ const Display = (e) => {
|
|
|
88578
88647
|
var y, S;
|
|
88579
88648
|
const u = useFlowContext(), [d, p] = useState(e || ""), m = useRef(null), h = !!((S = (y = u.model.flowEngine) == null ? void 0 : y.flowSettings) != null && S.enabled);
|
|
88580
88649
|
useEffect(() => {
|
|
88581
|
-
r && p(e);
|
|
88650
|
+
r !== !1 && p(e);
|
|
88582
88651
|
}, [e]);
|
|
88583
88652
|
const g = useCallback(
|
|
88584
88653
|
(v) => {
|
|
@@ -95165,6 +95234,7 @@ export {
|
|
|
95165
95234
|
parseVariablesAndChangeParamsToQueryString,
|
|
95166
95235
|
primaryKey,
|
|
95167
95236
|
readPrettyFormSettings,
|
|
95237
|
+
recalculateGridSizes,
|
|
95168
95238
|
recordBlockInitializers,
|
|
95169
95239
|
recordBlockInitializers_deprecated,
|
|
95170
95240
|
recordPickerViewer,
|