@nocobase/flow-engine 2.1.0-beta.22 → 2.1.0-beta.23
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/lib/components/FieldModelRenderer.js +2 -2
- package/lib/components/FlowModelRenderer.d.ts +2 -0
- package/lib/components/FlowModelRenderer.js +2 -0
- package/lib/components/dnd/index.d.ts +19 -1
- package/lib/components/dnd/index.js +239 -21
- package/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.js +20 -1
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.d.ts +4 -0
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.js +21 -8
- package/lib/components/settings/wrappers/contextual/useFloatToolbarPortal.js +2 -0
- package/lib/components/settings/wrappers/contextual/useFloatToolbarVisibility.js +100 -32
- package/lib/components/subModel/index.d.ts +1 -0
- package/lib/components/subModel/index.js +19 -0
- package/lib/components/subModel/utils.d.ts +1 -1
- package/lib/data-source/index.d.ts +73 -0
- package/lib/data-source/index.js +205 -1
- package/lib/flowContext.d.ts +2 -0
- package/lib/flowI18n.js +2 -1
- package/lib/models/DisplayItemModel.d.ts +1 -1
- package/lib/models/EditableItemModel.d.ts +1 -1
- package/lib/models/FilterableItemModel.d.ts +1 -1
- package/lib/models/flowModel.d.ts +11 -9
- package/lib/models/flowModel.js +48 -9
- package/lib/provider.js +38 -23
- package/package.json +4 -4
- package/src/__tests__/provider.test.tsx +24 -2
- package/src/components/FieldModelRenderer.tsx +2 -1
- package/src/components/FlowModelRenderer.tsx +6 -0
- package/src/components/__tests__/dnd.test.ts +44 -0
- package/src/components/dnd/index.tsx +286 -26
- package/src/components/settings/wrappers/contextual/DefaultSettingsIcon.tsx +25 -1
- package/src/components/settings/wrappers/contextual/FlowsFloatContextMenu.tsx +24 -5
- package/src/components/settings/wrappers/contextual/__tests__/DefaultSettingsIcon.test.tsx +94 -3
- package/src/components/settings/wrappers/contextual/__tests__/FlowsFloatContextMenu.test.tsx +171 -2
- package/src/components/settings/wrappers/contextual/useFloatToolbarPortal.ts +2 -0
- package/src/components/settings/wrappers/contextual/useFloatToolbarVisibility.ts +112 -32
- package/src/components/subModel/index.ts +1 -0
- package/src/data-source/__tests__/index.test.ts +34 -1
- package/src/data-source/index.ts +252 -2
- package/src/flowContext.ts +2 -0
- package/src/flowI18n.ts +2 -1
- package/src/models/DisplayItemModel.tsx +1 -1
- package/src/models/EditableItemModel.tsx +1 -1
- package/src/models/FilterableItemModel.tsx +1 -1
- package/src/models/flowModel.tsx +85 -23
- package/src/provider.tsx +41 -25
|
@@ -31,6 +31,7 @@ __export(useFloatToolbarVisibility_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(useFloatToolbarVisibility_exports);
|
|
33
33
|
var import_react = require("react");
|
|
34
|
+
var import_dnd = require("../../../dnd");
|
|
34
35
|
const TOOLBAR_HIDE_DELAY = 180;
|
|
35
36
|
const CHILD_FLOAT_MENU_ACTIVITY_EVENT = "nb-float-menu-child-activity";
|
|
36
37
|
const isNodeWithin = /* @__PURE__ */ __name((target, container) => {
|
|
@@ -65,15 +66,41 @@ const useFloatToolbarVisibility = /* @__PURE__ */ __name(({
|
|
|
65
66
|
const [isHostHovered, setIsHostHovered] = (0, import_react.useState)(false);
|
|
66
67
|
const [isToolbarHovered, setIsToolbarHovered] = (0, import_react.useState)(false);
|
|
67
68
|
const [isDraggingToolbar, setIsDraggingToolbar] = (0, import_react.useState)(false);
|
|
69
|
+
const [isDraggingToolbarItem, setIsDraggingToolbarItem] = (0, import_react.useState)(false);
|
|
68
70
|
const [isToolbarPinned, setIsToolbarPinned] = (0, import_react.useState)(false);
|
|
69
71
|
const [isHidePending, setIsHidePending] = (0, import_react.useState)(false);
|
|
70
72
|
const [activeChildToolbarIds, setActiveChildToolbarIds] = (0, import_react.useState)([]);
|
|
71
73
|
const hideToolbarTimerRef = (0, import_react.useRef)(null);
|
|
72
74
|
const reportedChildActivityToAncestorsRef = (0, import_react.useRef)(false);
|
|
75
|
+
const isHostHoveredRef = (0, import_react.useRef)(false);
|
|
76
|
+
const isToolbarHoveredRef = (0, import_react.useRef)(false);
|
|
77
|
+
const isDraggingToolbarRef = (0, import_react.useRef)(false);
|
|
78
|
+
const isDraggingToolbarItemRef = (0, import_react.useRef)(false);
|
|
79
|
+
const isToolbarPinnedRef = (0, import_react.useRef)(false);
|
|
80
|
+
const setHostHovered = (0, import_react.useCallback)((value) => {
|
|
81
|
+
isHostHoveredRef.current = value;
|
|
82
|
+
setIsHostHovered(value);
|
|
83
|
+
}, []);
|
|
84
|
+
const setToolbarHovered = (0, import_react.useCallback)((value) => {
|
|
85
|
+
isToolbarHoveredRef.current = value;
|
|
86
|
+
setIsToolbarHovered(value);
|
|
87
|
+
}, []);
|
|
88
|
+
const setDraggingToolbar = (0, import_react.useCallback)((value) => {
|
|
89
|
+
isDraggingToolbarRef.current = value;
|
|
90
|
+
setIsDraggingToolbar(value);
|
|
91
|
+
}, []);
|
|
92
|
+
const setDraggingToolbarItem = (0, import_react.useCallback)((value) => {
|
|
93
|
+
isDraggingToolbarItemRef.current = value;
|
|
94
|
+
setIsDraggingToolbarItem(value);
|
|
95
|
+
}, []);
|
|
96
|
+
const setToolbarPinned = (0, import_react.useCallback)((value) => {
|
|
97
|
+
isToolbarPinnedRef.current = value;
|
|
98
|
+
setIsToolbarPinned(value);
|
|
99
|
+
}, []);
|
|
73
100
|
const hasActiveChildToolbar = activeChildToolbarIds.length > 0;
|
|
74
|
-
const isToolbarVisible = !hideMenu && !hasActiveChildToolbar && (isHostHovered || isToolbarHovered || isDraggingToolbar || isToolbarPinned);
|
|
75
|
-
const shouldRenderToolbar = isToolbarVisible || isToolbarPinned || isDraggingToolbar;
|
|
76
|
-
const isToolbarInteractionActive = isHostHovered || isToolbarHovered || isDraggingToolbar || isToolbarPinned || isHidePending;
|
|
101
|
+
const isToolbarVisible = !hideMenu && !hasActiveChildToolbar && (isHostHovered || isToolbarHovered || isDraggingToolbar || isDraggingToolbarItem || isToolbarPinned);
|
|
102
|
+
const shouldRenderToolbar = isToolbarVisible || isToolbarPinned || isDraggingToolbar || isDraggingToolbarItem;
|
|
103
|
+
const isToolbarInteractionActive = isHostHovered || isToolbarHovered || isDraggingToolbar || isDraggingToolbarItem || isToolbarPinned || isHidePending;
|
|
77
104
|
const clearHideToolbarTimer = (0, import_react.useCallback)(() => {
|
|
78
105
|
if (hideToolbarTimerRef.current !== null) {
|
|
79
106
|
window.clearTimeout(hideToolbarTimerRef.current);
|
|
@@ -87,16 +114,19 @@ const useFloatToolbarVisibility = /* @__PURE__ */ __name(({
|
|
|
87
114
|
hideToolbarTimerRef.current = window.setTimeout(() => {
|
|
88
115
|
hideToolbarTimerRef.current = null;
|
|
89
116
|
setIsHidePending(false);
|
|
90
|
-
if (
|
|
117
|
+
if (isDraggingToolbarRef.current || isDraggingToolbarItemRef.current || isToolbarPinnedRef.current) {
|
|
91
118
|
return;
|
|
92
119
|
}
|
|
93
|
-
|
|
94
|
-
|
|
120
|
+
setHostHovered(false);
|
|
121
|
+
setToolbarHovered(false);
|
|
95
122
|
}, TOOLBAR_HIDE_DELAY);
|
|
96
|
-
}, [clearHideToolbarTimer,
|
|
97
|
-
const handleSettingsMenuOpenChange = (0, import_react.useCallback)(
|
|
98
|
-
|
|
99
|
-
|
|
123
|
+
}, [clearHideToolbarTimer, setHostHovered, setToolbarHovered]);
|
|
124
|
+
const handleSettingsMenuOpenChange = (0, import_react.useCallback)(
|
|
125
|
+
(open) => {
|
|
126
|
+
setToolbarPinned(open);
|
|
127
|
+
},
|
|
128
|
+
[setToolbarPinned]
|
|
129
|
+
);
|
|
100
130
|
(0, import_react.useEffect)(() => {
|
|
101
131
|
const hostElement = containerRef.current;
|
|
102
132
|
if (!hostElement) {
|
|
@@ -122,6 +152,35 @@ const useFloatToolbarVisibility = /* @__PURE__ */ __name(({
|
|
|
122
152
|
hostElement.removeEventListener(CHILD_FLOAT_MENU_ACTIVITY_EVENT, handleChildToolbarActivity);
|
|
123
153
|
};
|
|
124
154
|
}, [containerRef]);
|
|
155
|
+
(0, import_react.useEffect)(() => {
|
|
156
|
+
const hostElement = containerRef.current;
|
|
157
|
+
const ownerDocument = hostElement == null ? void 0 : hostElement.ownerDocument;
|
|
158
|
+
if (!ownerDocument) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const handleToolbarDragActivity = /* @__PURE__ */ __name((event) => {
|
|
162
|
+
var _a, _b;
|
|
163
|
+
const customEvent = event;
|
|
164
|
+
if (((_a = customEvent.detail) == null ? void 0 : _a.modelUid) !== modelUid) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if ((_b = customEvent.detail) == null ? void 0 : _b.active) {
|
|
168
|
+
clearHideToolbarTimer();
|
|
169
|
+
setDraggingToolbarItem(true);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
setDraggingToolbarItem(false);
|
|
173
|
+
if (isHostHoveredRef.current || isToolbarHoveredRef.current || isToolbarPinnedRef.current) {
|
|
174
|
+
clearHideToolbarTimer();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
scheduleHideToolbar();
|
|
178
|
+
}, "handleToolbarDragActivity");
|
|
179
|
+
ownerDocument.addEventListener(import_dnd.TOOLBAR_DRAG_ACTIVITY_EVENT, handleToolbarDragActivity);
|
|
180
|
+
return () => {
|
|
181
|
+
ownerDocument.removeEventListener(import_dnd.TOOLBAR_DRAG_ACTIVITY_EVENT, handleToolbarDragActivity);
|
|
182
|
+
};
|
|
183
|
+
}, [clearHideToolbarTimer, containerRef, modelUid, scheduleHideToolbar, setDraggingToolbarItem]);
|
|
125
184
|
(0, import_react.useEffect)(() => {
|
|
126
185
|
const hostElement = containerRef.current;
|
|
127
186
|
if (!hostElement || reportedChildActivityToAncestorsRef.current === isToolbarInteractionActive) {
|
|
@@ -163,71 +222,80 @@ const useFloatToolbarVisibility = /* @__PURE__ */ __name(({
|
|
|
163
222
|
const isCurrentHostTarget = !childWithMenu || childWithMenu === containerRef.current;
|
|
164
223
|
if (isCurrentHostTarget) {
|
|
165
224
|
clearHideToolbarTimer();
|
|
166
|
-
|
|
225
|
+
setHostHovered(true);
|
|
167
226
|
}
|
|
168
227
|
setHideMenu(!!childWithMenu && childWithMenu !== containerRef.current);
|
|
169
228
|
},
|
|
170
|
-
[clearHideToolbarTimer, containerRef]
|
|
229
|
+
[clearHideToolbarTimer, containerRef, setHostHovered]
|
|
171
230
|
);
|
|
172
231
|
const handleHostMouseEnter = (0, import_react.useCallback)(() => {
|
|
173
232
|
clearHideToolbarTimer();
|
|
174
233
|
setHideMenu(false);
|
|
175
234
|
updatePortalRect();
|
|
176
|
-
|
|
177
|
-
}, [clearHideToolbarTimer, updatePortalRect]);
|
|
235
|
+
setHostHovered(true);
|
|
236
|
+
}, [clearHideToolbarTimer, setHostHovered, updatePortalRect]);
|
|
178
237
|
const handleHostMouseLeave = (0, import_react.useCallback)(
|
|
179
238
|
(e) => {
|
|
180
|
-
if (
|
|
181
|
-
|
|
239
|
+
if (isToolbarPinnedRef.current) {
|
|
240
|
+
setHostHovered(false);
|
|
182
241
|
return;
|
|
183
242
|
}
|
|
184
243
|
if (isNodeWithin(e.relatedTarget, toolbarContainerRef.current)) {
|
|
185
244
|
clearHideToolbarTimer();
|
|
186
|
-
|
|
187
|
-
|
|
245
|
+
setHostHovered(false);
|
|
246
|
+
setToolbarHovered(true);
|
|
188
247
|
return;
|
|
189
248
|
}
|
|
190
249
|
if (isNodeWithinDescendantFloatToolbar(e.relatedTarget, containerRef.current, modelUid)) {
|
|
191
250
|
clearHideToolbarTimer();
|
|
192
251
|
setHideMenu(false);
|
|
193
|
-
|
|
252
|
+
setHostHovered(true);
|
|
194
253
|
return;
|
|
195
254
|
}
|
|
196
255
|
scheduleHideToolbar();
|
|
197
256
|
},
|
|
198
|
-
[
|
|
257
|
+
[
|
|
258
|
+
clearHideToolbarTimer,
|
|
259
|
+
containerRef,
|
|
260
|
+
modelUid,
|
|
261
|
+
scheduleHideToolbar,
|
|
262
|
+
setHostHovered,
|
|
263
|
+
setToolbarHovered,
|
|
264
|
+
toolbarContainerRef
|
|
265
|
+
]
|
|
199
266
|
);
|
|
200
267
|
const handleToolbarMouseEnter = (0, import_react.useCallback)(() => {
|
|
201
268
|
clearHideToolbarTimer();
|
|
202
269
|
updatePortalRect();
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}, [clearHideToolbarTimer, updatePortalRect]);
|
|
270
|
+
setHostHovered(false);
|
|
271
|
+
setToolbarHovered(true);
|
|
272
|
+
}, [clearHideToolbarTimer, setHostHovered, setToolbarHovered, updatePortalRect]);
|
|
206
273
|
const handleToolbarMouseLeave = (0, import_react.useCallback)(
|
|
207
274
|
(e) => {
|
|
208
|
-
if (
|
|
209
|
-
|
|
275
|
+
if (isToolbarPinnedRef.current || isDraggingToolbarItemRef.current) {
|
|
276
|
+
clearHideToolbarTimer();
|
|
277
|
+
setToolbarHovered(false);
|
|
210
278
|
return;
|
|
211
279
|
}
|
|
212
|
-
|
|
280
|
+
setToolbarHovered(false);
|
|
213
281
|
if (isNodeWithin(e.relatedTarget, containerRef.current)) {
|
|
214
282
|
clearHideToolbarTimer();
|
|
215
|
-
|
|
283
|
+
setHostHovered(true);
|
|
216
284
|
return;
|
|
217
285
|
}
|
|
218
286
|
scheduleHideToolbar();
|
|
219
287
|
},
|
|
220
|
-
[clearHideToolbarTimer, containerRef,
|
|
288
|
+
[clearHideToolbarTimer, containerRef, scheduleHideToolbar, setHostHovered, setToolbarHovered]
|
|
221
289
|
);
|
|
222
290
|
const handleResizeDragStart = (0, import_react.useCallback)(() => {
|
|
223
291
|
updatePortalRect();
|
|
224
|
-
|
|
292
|
+
setDraggingToolbar(true);
|
|
225
293
|
schedulePortalRectUpdate();
|
|
226
|
-
}, [schedulePortalRectUpdate, updatePortalRect]);
|
|
294
|
+
}, [schedulePortalRectUpdate, setDraggingToolbar, updatePortalRect]);
|
|
227
295
|
const handleResizeDragEnd = (0, import_react.useCallback)(() => {
|
|
228
|
-
|
|
296
|
+
setDraggingToolbar(false);
|
|
229
297
|
schedulePortalRectUpdate();
|
|
230
|
-
}, [schedulePortalRectUpdate]);
|
|
298
|
+
}, [schedulePortalRectUpdate, setDraggingToolbar]);
|
|
231
299
|
return {
|
|
232
300
|
isToolbarVisible,
|
|
233
301
|
shouldRenderToolbar,
|
|
@@ -7,10 +7,16 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
14
20
|
var __copyProps = (to, from, except, desc) => {
|
|
15
21
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
22
|
for (let key of __getOwnPropNames(from))
|
|
@@ -20,13 +26,26 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
26
|
return to;
|
|
21
27
|
};
|
|
22
28
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
23
37
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
38
|
var subModel_exports = {};
|
|
39
|
+
__export(subModel_exports, {
|
|
40
|
+
LazyDropdown: () => import_LazyDropdown.default
|
|
41
|
+
});
|
|
25
42
|
module.exports = __toCommonJS(subModel_exports);
|
|
26
43
|
__reExport(subModel_exports, require("./AddSubModelButton"), module.exports);
|
|
44
|
+
var import_LazyDropdown = __toESM(require("./LazyDropdown"));
|
|
27
45
|
__reExport(subModel_exports, require("./utils"), module.exports);
|
|
28
46
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
47
|
0 && (module.exports = {
|
|
48
|
+
LazyDropdown,
|
|
30
49
|
...require("./AddSubModelButton"),
|
|
31
50
|
...require("./utils")
|
|
32
51
|
});
|
|
@@ -15,11 +15,49 @@ export interface DataSourceOptions extends Record<string, any> {
|
|
|
15
15
|
description?: string;
|
|
16
16
|
[key: string]: any;
|
|
17
17
|
}
|
|
18
|
+
export type DataSourceRequester = (options: Record<string, any>) => Promise<any>;
|
|
19
|
+
export interface DataSourceLoadResult {
|
|
20
|
+
collections?: CollectionOptions[];
|
|
21
|
+
dataSources?: Array<DataSourceOptions & {
|
|
22
|
+
collections?: CollectionOptions[];
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
export type DataSourceLoader = (context: {
|
|
26
|
+
key: string;
|
|
27
|
+
manager: DataSourceManager;
|
|
28
|
+
}) => Promise<DataSourceLoadResult>;
|
|
18
29
|
export declare class DataSourceManager {
|
|
19
30
|
dataSources: Map<string, DataSource>;
|
|
20
31
|
flowEngine: FlowEngine;
|
|
32
|
+
requester?: DataSourceRequester;
|
|
33
|
+
collectionFieldInterfaceManager?: {
|
|
34
|
+
addFieldInterfaces?: (fieldInterfaceClasses?: any[]) => void;
|
|
35
|
+
addFieldInterfaceGroups?: (groups: Record<string, {
|
|
36
|
+
label: string;
|
|
37
|
+
order?: number;
|
|
38
|
+
}>) => void;
|
|
39
|
+
addFieldInterfaceComponentOption?: (name: string, option: any) => void;
|
|
40
|
+
addFieldInterfaceOperator?: (name: string, operator: any) => void;
|
|
41
|
+
getFieldInterface?: (name: string) => any;
|
|
42
|
+
};
|
|
43
|
+
loaders: Map<string, DataSourceLoader>;
|
|
44
|
+
loadedKeys: Set<string>;
|
|
45
|
+
loadingKeys: Set<string>;
|
|
46
|
+
loadErrors: Map<string, Error>;
|
|
47
|
+
loadingPromise: Promise<void> | null;
|
|
21
48
|
constructor();
|
|
22
49
|
setFlowEngine(flowEngine: FlowEngine): void;
|
|
50
|
+
setRequester(requester?: DataSourceRequester): void;
|
|
51
|
+
setCollectionFieldInterfaceManager(manager: DataSourceManager['collectionFieldInterfaceManager']): void;
|
|
52
|
+
addFieldInterfaces(fieldInterfaceClasses?: any[]): void;
|
|
53
|
+
addFieldInterfaceGroups(groups: Record<string, {
|
|
54
|
+
label: string;
|
|
55
|
+
order?: number;
|
|
56
|
+
}>): void;
|
|
57
|
+
addFieldInterfaceComponentOption(name: string, option: any): void;
|
|
58
|
+
addFieldInterfaceOperator(name: string, operator: any): void;
|
|
59
|
+
registerLoader(key: string, loader: DataSourceLoader): void;
|
|
60
|
+
removeLoader(key: string): void;
|
|
23
61
|
addDataSource(ds: DataSource | DataSourceOptions): void;
|
|
24
62
|
upsertDataSource(ds: DataSource | DataSourceOptions): void;
|
|
25
63
|
removeDataSource(key: string): void;
|
|
@@ -28,6 +66,29 @@ export declare class DataSourceManager {
|
|
|
28
66
|
getDataSource(key: string): DataSource | undefined;
|
|
29
67
|
getCollection(dataSourceKey: string, collectionName: string): Collection | undefined;
|
|
30
68
|
getCollectionField(fieldPathWithDataSource: string): CollectionField;
|
|
69
|
+
ensureLoaded(options?: {
|
|
70
|
+
force?: boolean;
|
|
71
|
+
keys?: string[];
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
reload(options?: {
|
|
74
|
+
keys?: string[];
|
|
75
|
+
}): Promise<void>;
|
|
76
|
+
reloadDataSource(key: string): Promise<void>;
|
|
77
|
+
protected resolveLoadKeys(requestedKeys?: string[]): string[];
|
|
78
|
+
protected getApp(): {
|
|
79
|
+
eventBus?: EventTarget;
|
|
80
|
+
};
|
|
81
|
+
protected dispatchDataSourceEvent(type: 'dataSource:loaded' | 'dataSource:loadFailed', detail: {
|
|
82
|
+
dataSourceKey: string;
|
|
83
|
+
initial: boolean;
|
|
84
|
+
error?: Error;
|
|
85
|
+
}): void;
|
|
86
|
+
protected setDataSourceState(key: string, options: Partial<Pick<DataSourceOptions, 'status' | 'errorMessage'>> & Record<string, any>): void;
|
|
87
|
+
protected applyDataSourceLoadResult(key: string, result: DataSourceLoadResult): void;
|
|
88
|
+
protected loadKey(key: string, options: {
|
|
89
|
+
initial: boolean;
|
|
90
|
+
force: boolean;
|
|
91
|
+
}): Promise<void>;
|
|
31
92
|
}
|
|
32
93
|
export declare class DataSource {
|
|
33
94
|
dataSourceManager: DataSourceManager;
|
|
@@ -38,6 +99,8 @@ export declare class DataSource {
|
|
|
38
99
|
get displayName(): any;
|
|
39
100
|
get key(): any;
|
|
40
101
|
get name(): any;
|
|
102
|
+
get status(): any;
|
|
103
|
+
get errorMessage(): any;
|
|
41
104
|
setDataSourceManager(dataSourceManager: DataSourceManager): void;
|
|
42
105
|
getCollections(): Collection[];
|
|
43
106
|
getCollection(name: string): Collection | undefined;
|
|
@@ -52,9 +115,14 @@ export declare class DataSource {
|
|
|
52
115
|
upsertCollections(collections: CollectionOptions[], options?: {
|
|
53
116
|
clearFields?: boolean;
|
|
54
117
|
}): void;
|
|
118
|
+
setCollections(collections: CollectionOptions[], options?: {
|
|
119
|
+
clearFields?: boolean;
|
|
120
|
+
}): void;
|
|
55
121
|
removeCollection(name: string): void;
|
|
56
122
|
clearCollections(): void;
|
|
57
123
|
setOptions(newOptions?: any): void;
|
|
124
|
+
patchOptions(newOptions?: any): void;
|
|
125
|
+
reload(): Promise<void>;
|
|
58
126
|
getCollectionField(fieldPath: string): CollectionField;
|
|
59
127
|
}
|
|
60
128
|
export interface CollectionOptions {
|
|
@@ -72,6 +140,7 @@ export declare class CollectionManager {
|
|
|
72
140
|
notSupportView?: string[];
|
|
73
141
|
};
|
|
74
142
|
constructor(dataSource: DataSource);
|
|
143
|
+
protected resetCaches(): void;
|
|
75
144
|
get flowEngine(): FlowEngine;
|
|
76
145
|
addCollection(collection: Collection | CollectionOptions): void;
|
|
77
146
|
removeCollection(name: string): void;
|
|
@@ -82,6 +151,9 @@ export declare class CollectionManager {
|
|
|
82
151
|
upsertCollections(collections: CollectionOptions[], options?: {
|
|
83
152
|
clearFields?: boolean;
|
|
84
153
|
}): void;
|
|
154
|
+
setCollections(collections: CollectionOptions[], options?: {
|
|
155
|
+
clearFields?: boolean;
|
|
156
|
+
}): void;
|
|
85
157
|
sortCollectionsByInherits(collections: CollectionOptions[]): CollectionOptions[];
|
|
86
158
|
getCollection(name: string): Collection | undefined;
|
|
87
159
|
getCollections(): Collection[];
|
|
@@ -116,6 +188,7 @@ export declare class Collection {
|
|
|
116
188
|
setOptions(newOptions?: any, options?: {
|
|
117
189
|
clearFields?: boolean;
|
|
118
190
|
}): void;
|
|
191
|
+
setOption(key: string, value: any): void;
|
|
119
192
|
getFields(): CollectionField[];
|
|
120
193
|
getToOneAssociationFields(): CollectionField[];
|
|
121
194
|
getAssociationFields(types?: any[]): CollectionField[];
|