@nocobase/client 2.0.0-beta.5 → 2.0.0-beta.6
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.
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
type RouteOptions = {
|
|
10
|
+
id: string;
|
|
11
|
+
schemaUid: string;
|
|
12
|
+
children?: RouteOptions[];
|
|
13
|
+
};
|
|
14
|
+
export declare class RouteRepository {
|
|
15
|
+
protected ctx: any;
|
|
16
|
+
routes: Array<RouteOptions>;
|
|
17
|
+
constructor(ctx: any);
|
|
18
|
+
setRoutes(routes: Array<any>): void;
|
|
19
|
+
listAccessible(): RouteOptions[];
|
|
20
|
+
getRouteBySchemaUid(schemaUid: string): RouteOptions | undefined;
|
|
21
|
+
private findRoute;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
package/es/index.mjs
CHANGED
|
@@ -106,7 +106,7 @@ import { evaluators } from "@nocobase/evaluators/client";
|
|
|
106
106
|
import * as formilyAntdV5 from "@formily/antd-v5";
|
|
107
107
|
import { FormLayout, ArrayCollapse as ArrayCollapse$2, ArrayItems, ArrayBase, TreeSelect as TreeSelect$1, Input as Input$4, FormItem as FormItem$1, useFormLayout, ArrayTable, NumberPicker, Select as Select$2, FormButtonGroup, Upload as Upload$2 } from "@formily/antd-v5";
|
|
108
108
|
import * as nocobaseFlowEngine from "@nocobase/flow-engine";
|
|
109
|
-
import { observer, useFlowEngine, createCollectionContextMeta, FlowEngine, FlowEngineProvider, FlowEngineGlobalsContextProvider,
|
|
109
|
+
import { observer, useFlowEngine, createCollectionContextMeta, useFlowEngineContext, FlowEngine, FlowEngineProvider, FlowEngineGlobalsContextProvider, useFlowContext, FlowContextSelector, defineAction, tExpr, useFlowViewContext, parseValueToPath, VariableInput as VariableInput$1, createEphemeralContext, useFlowSettingsContext, pruneFilter, FlowModel, observable as observable$1, defineFlow, useFlowModelById, FlowModelRenderer, reaction as reaction$1, parsePathnameToViewParams, ViewNavigation, useFlowModel, buildSubModelItems, buildSubModelItem, DisplayItemModel, FilterItem as FilterItem$2, FilterGroup as FilterGroup$3, EMPTY_COLUMN_UID, DragHandler as DragHandler$1, findModelUidPosition, buildLayoutSnapshot, getSlotKey, simulateLayoutForSlot, resolveDropIntent, DndProvider, Droppable, MemoFlowModelRenderer, AddSubModelButton, FlowSettingsButton, setupRunJSContexts, getRunJSDocFor, listSnippetsForContext, FlowRunJSContext, compileRunJs, JSRunner, createSafeNavigator, createSafeWindow, createSafeDocument, getRunJSScenesForContext, getPageActive, MobilePopup, SingleRecordResource, MultiRecordResource, escapeT, createAssociationAwareObjectMetaFactory, createAssociationSubpathResolver, createCurrentRecordMetaFactory, createRecordResolveOnServerWithLocal, EditableItemModel, FormItem as FormItem$2, FieldModelRenderer, isVariableExpression, ModelRenderMode, buildWrapperFieldChildren, FilterableItemModel, FlowModelContext, ElementProxy, FlowsFloatContextMenu, FlowModelProvider, FlowErrorFallback, createRecordMetaFactory, autorun as autorun$1, useFlowModelContext, largeField, ActionScene, jioToJoiSchema, FlowRuntimeContext, extractPropertyPath, VariableTag, FlowStepContext, untracked as untracked$1, isBeforeRenderFlow } from "@nocobase/flow-engine";
|
|
110
110
|
import { FieldModelRenderer as on } from "@nocobase/flow-engine";
|
|
111
111
|
import ignore from "ignore";
|
|
112
112
|
import cronstrue from "cronstrue";
|
|
@@ -9682,7 +9682,7 @@ function addAppVersion(e, t) {
|
|
|
9682
9682
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
9683
9683
|
}), e;
|
|
9684
9684
|
}
|
|
9685
|
-
const name = "@nocobase/client", version = "2.0.0-beta.
|
|
9685
|
+
const name = "@nocobase/client", version = "2.0.0-beta.6", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
9686
9686
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
9687
9687
|
"@ant-design/cssinjs": "^1.11.1",
|
|
9688
9688
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -9705,10 +9705,10 @@ const name = "@nocobase/client", version = "2.0.0-beta.5", license = "AGPL-3.0",
|
|
|
9705
9705
|
"@formily/reactive-react": "^2.2.27",
|
|
9706
9706
|
"@formily/shared": "^2.2.27",
|
|
9707
9707
|
"@formily/validator": "^2.2.27",
|
|
9708
|
-
"@nocobase/evaluators": "2.0.0-beta.
|
|
9709
|
-
"@nocobase/flow-engine": "2.0.0-beta.
|
|
9710
|
-
"@nocobase/sdk": "2.0.0-beta.
|
|
9711
|
-
"@nocobase/utils": "2.0.0-beta.
|
|
9708
|
+
"@nocobase/evaluators": "2.0.0-beta.6",
|
|
9709
|
+
"@nocobase/flow-engine": "2.0.0-beta.6",
|
|
9710
|
+
"@nocobase/sdk": "2.0.0-beta.6",
|
|
9711
|
+
"@nocobase/utils": "2.0.0-beta.6",
|
|
9712
9712
|
"@tanstack/react-table": "^8.21.3",
|
|
9713
9713
|
"@types/tabulator-tables": "^6.2.6",
|
|
9714
9714
|
"acorn-jsx": "^5.3.2",
|
|
@@ -26096,14 +26096,21 @@ const CurrentRouteProvider = memo(({ children: e, uid: t }) => {
|
|
|
26096
26096
|
});
|
|
26097
26097
|
AllAccessDesktopRoutesContext.displayName = "AllAccessDesktopRoutesContext";
|
|
26098
26098
|
const useAllAccessDesktopRoutes = () => useContext(AllAccessDesktopRoutesContext), RoutesRequestProvider = ({ children: e }) => {
|
|
26099
|
-
const t = useRef(!1), { data:
|
|
26100
|
-
|
|
26101
|
-
|
|
26102
|
-
|
|
26103
|
-
|
|
26104
|
-
|
|
26105
|
-
|
|
26106
|
-
|
|
26099
|
+
const t = useFlowEngineContext(), o = useRef(!1), { data: n, refresh: r, loading: i } = useRequest(
|
|
26100
|
+
{
|
|
26101
|
+
url: "/desktopRoutes:listAccessible",
|
|
26102
|
+
params: { tree: !0, sort: "sort" }
|
|
26103
|
+
},
|
|
26104
|
+
{
|
|
26105
|
+
onSuccess(l) {
|
|
26106
|
+
t.routeRepository.setRoutes((l == null ? void 0 : l.data) || emptyArray);
|
|
26107
|
+
}
|
|
26108
|
+
}
|
|
26109
|
+
), a = useMemo(() => ({
|
|
26110
|
+
allAccessRoutes: (n == null ? void 0 : n.data) || emptyArray,
|
|
26111
|
+
refresh: r
|
|
26112
|
+
}), [n == null ? void 0 : n.data, r]);
|
|
26113
|
+
return i && !o.current ? null : (o.current = !0, /* @__PURE__ */ jsx(AllAccessDesktopRoutesContext.Provider, { value: a, children: e }));
|
|
26107
26114
|
}, noAccessPermission = (e, t) => e ? !findRouteBySchemaUid(e, t) : !1, AdminDynamicPage = () => {
|
|
26108
26115
|
const e = useCurrentPageUid(), { allAccessRoutes: t } = useAllAccessDesktopRoutes();
|
|
26109
26116
|
return isGroup(e, t) ? null : noAccessPermission(e, t) ? /* @__PURE__ */ jsx(AppNotFound, {}) : /* @__PURE__ */ jsx(KeepAlive, { uid: e, children: (o) => /* @__PURE__ */ jsx(CurrentPageUidContext.Provider, { value: o, children: /* @__PURE__ */ jsx(CurrentRouteProvider, { uid: o, children: /* @__PURE__ */ jsx(RemoteSchemaComponent, { uid: o }) }) }) });
|
|
@@ -29123,6 +29130,32 @@ function parseDate(e) {
|
|
|
29123
29130
|
let t = Array.isArray(e) ? (o = e[1]) != null ? o : e[0] : e;
|
|
29124
29131
|
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(t) ? new Date(t) : /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(t) ? new Date(t.replace(" ", "T")) : /^\d{4}-\d{2}-\d{2}$/.test(t) ? parseFullDate(t) : /^\d{4}-\d{2}$/.test(t) ? parseMonth(t) : /^\d{4}Q[1-4]$/.test(t) ? parseQuarter(t) : /^\d{4}$/.test(t) ? parseYear(t) : null;
|
|
29125
29132
|
}
|
|
29133
|
+
class RouteRepository {
|
|
29134
|
+
constructor(t) {
|
|
29135
|
+
I(this, "routes", []);
|
|
29136
|
+
this.ctx = t;
|
|
29137
|
+
}
|
|
29138
|
+
setRoutes(t) {
|
|
29139
|
+
this.routes = t;
|
|
29140
|
+
}
|
|
29141
|
+
listAccessible() {
|
|
29142
|
+
return this.routes;
|
|
29143
|
+
}
|
|
29144
|
+
getRouteBySchemaUid(t) {
|
|
29145
|
+
return this.findRoute(this.routes, t);
|
|
29146
|
+
}
|
|
29147
|
+
findRoute(t, o) {
|
|
29148
|
+
for (const n of t) {
|
|
29149
|
+
if (n.schemaUid === o)
|
|
29150
|
+
return n;
|
|
29151
|
+
if (n.children) {
|
|
29152
|
+
const r = this.findRoute(n.children, o);
|
|
29153
|
+
if (r)
|
|
29154
|
+
return r;
|
|
29155
|
+
}
|
|
29156
|
+
}
|
|
29157
|
+
}
|
|
29158
|
+
}
|
|
29126
29159
|
class Application {
|
|
29127
29160
|
constructor(t = {}) {
|
|
29128
29161
|
I(this, "eventBus", new EventTarget());
|
|
@@ -29234,6 +29267,8 @@ class Application {
|
|
|
29234
29267
|
scope: this.scopes
|
|
29235
29268
|
}), this.use(AntdAppProvider), this.use(DataSourceApplicationProvider, { dataSourceManager: this.dataSourceManager }), this.use(OpenModeProvider), this.flowEngine.context.defineProperty("app", {
|
|
29236
29269
|
value: this
|
|
29270
|
+
}), this.flowEngine.context.defineProperty("routeRepository", {
|
|
29271
|
+
value: new RouteRepository(this.flowEngine.context)
|
|
29237
29272
|
}), this.flowEngine.context.defineProperty("appInfo", {
|
|
29238
29273
|
get: () => N(this, null, function* () {
|
|
29239
29274
|
var n;
|
|
@@ -32680,7 +32715,8 @@ const DragHandler = (e) => {
|
|
|
32680
32715
|
const S = {
|
|
32681
32716
|
name: "$nForm",
|
|
32682
32717
|
ctx: x,
|
|
32683
|
-
collectionName: e
|
|
32718
|
+
collectionName: e,
|
|
32719
|
+
dataSource: m.current.dataSourceKey
|
|
32684
32720
|
}, F = `{{ $nForm.${p} }}`;
|
|
32685
32721
|
if (C == null)
|
|
32686
32722
|
return;
|
|
@@ -71297,45 +71333,36 @@ RootPageModel.registerFlow({
|
|
|
71297
71333
|
init: {
|
|
71298
71334
|
handler(e, t) {
|
|
71299
71335
|
return N(this, null, function* () {
|
|
71300
|
-
var r
|
|
71336
|
+
var r;
|
|
71301
71337
|
if (e.model.hasSubModel("tabs"))
|
|
71302
71338
|
return;
|
|
71303
|
-
const
|
|
71304
|
-
|
|
71305
|
-
|
|
71306
|
-
|
|
71307
|
-
|
|
71308
|
-
schemaUid: e.model.parentId
|
|
71309
|
-
},
|
|
71310
|
-
appends: ["children"]
|
|
71311
|
-
}
|
|
71312
|
-
});
|
|
71313
|
-
e.model.setProps("routeId", (r = o == null ? void 0 : o.data) == null ? void 0 : r.id);
|
|
71314
|
-
const n = _.castArray((i = o == null ? void 0 : o.data) == null ? void 0 : i.children);
|
|
71315
|
-
for (const l of n.sort((c, u) => c.sort - u.sort)) {
|
|
71316
|
-
if (l.hideInMenu)
|
|
71339
|
+
const o = e.routeRepository.getRouteBySchemaUid(e.model.parentId);
|
|
71340
|
+
e.model.setProps("routeId", o == null ? void 0 : o.id);
|
|
71341
|
+
const n = _.castArray(o == null ? void 0 : o.children);
|
|
71342
|
+
for (const i of n.sort((a, l) => a.sort - l.sort)) {
|
|
71343
|
+
if (i.hideInMenu)
|
|
71317
71344
|
continue;
|
|
71318
|
-
const
|
|
71345
|
+
const a = e.engine.createModel({
|
|
71319
71346
|
parentId: e.model.uid,
|
|
71320
|
-
uid:
|
|
71347
|
+
uid: i.schemaUid,
|
|
71321
71348
|
subKey: "tabs",
|
|
71322
71349
|
subType: "array",
|
|
71323
71350
|
use: "RootPageTabModel",
|
|
71324
|
-
sortIndex:
|
|
71351
|
+
sortIndex: i.sort,
|
|
71325
71352
|
props: {
|
|
71326
|
-
route:
|
|
71353
|
+
route: i
|
|
71327
71354
|
},
|
|
71328
|
-
flowRegistry: (
|
|
71355
|
+
flowRegistry: (r = i.options) == null ? void 0 : r.flowRegistry,
|
|
71329
71356
|
stepParams: {
|
|
71330
71357
|
pageTabSettings: {
|
|
71331
71358
|
tab: {
|
|
71332
|
-
title:
|
|
71333
|
-
icon:
|
|
71359
|
+
title: i.title,
|
|
71360
|
+
icon: i.icon
|
|
71334
71361
|
}
|
|
71335
71362
|
}
|
|
71336
71363
|
}
|
|
71337
71364
|
});
|
|
71338
|
-
e.model.addSubModel("tabs",
|
|
71365
|
+
e.model.addSubModel("tabs", a);
|
|
71339
71366
|
}
|
|
71340
71367
|
});
|
|
71341
71368
|
}
|