@parallelworks/ui 0.2.0 → 0.3.1
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/README.md +5 -0
- package/dist/chunks/CodePreviewEditor-CSPRILMp.js +61 -0
- package/dist/chunks/Indicator-hBSIxOPK.js +39 -0
- package/dist/chunks/Markdown-C5Re2ezs.js +101 -0
- package/dist/chunks/{Indicator-fF8AVbjQ.js → Modal-sOUEwebV.js} +1 -38
- package/dist/chunks/{Monaco-CP_cL9gp.js → Monaco-CC4ak1JG.js} +3 -31
- package/dist/chunks/Provider-DvVvScTQ.js +391 -0
- package/dist/chunks/StatusBadge-DXp4zkSd.js +46 -0
- package/dist/chunks/{Table-DWuRINhu.js → SwitchToggle-2uRw8ZeJ.js} +2 -132
- package/dist/chunks/Table-C5z6qWjM.js +91 -0
- package/dist/chunks/editor-D55tumuZ.js +372 -0
- package/dist/chunks/list-7PyDF1tz.js +465 -0
- package/dist/components/Provider.d.ts +293 -0
- package/dist/editor/index.d.ts +1 -0
- package/dist/editor/index.js +2 -219
- package/dist/editor/useCssIsDark.d.ts +6 -0
- package/dist/file-explorer/FileExplorer.d.ts +23 -0
- package/dist/file-explorer/FileExplorerContext.d.ts +17 -0
- package/dist/file-explorer/FilePreview/CodePreviewEditor.d.ts +6 -0
- package/dist/file-explorer/FilePreview/Inline.d.ts +13 -0
- package/dist/file-explorer/FilePreview/StreamedBadge.d.ts +1 -0
- package/dist/file-explorer/FilePreview/Viewer.d.ts +15 -0
- package/dist/file-explorer/FilePreview/index.d.ts +15 -0
- package/dist/file-explorer/FilePreview/parse.d.ts +24 -0
- package/dist/file-explorer/FilePreview/previewCache.d.ts +26 -0
- package/dist/file-explorer/FilePreview/previewType.d.ts +21 -0
- package/dist/file-explorer/FilePreview/readCappedBytes.d.ts +37 -0
- package/dist/file-explorer/FilePreview/useObjectBlobUrl.d.ts +16 -0
- package/dist/file-explorer/FilePreview/useObjectText.d.ts +23 -0
- package/dist/file-explorer/FilePreview/usePresignedUrl.d.ts +12 -0
- package/dist/file-explorer/FileRow.d.ts +35 -0
- package/dist/file-explorer/FileRowsWindow.d.ts +43 -0
- package/dist/file-explorer/FileTable.d.ts +26 -0
- package/dist/file-explorer/FileTableHeaders.d.ts +13 -0
- package/dist/file-explorer/LoadMoreRow.d.ts +15 -0
- package/dist/file-explorer/TreeView.d.ts +28 -0
- package/dist/file-explorer/helpers.d.ts +47 -0
- package/dist/file-explorer/index.d.ts +10 -0
- package/dist/file-explorer/index.js +5646 -0
- package/dist/file-explorer/lib/batch.d.ts +3 -0
- package/dist/file-explorer/lib/errors.d.ts +3 -0
- package/dist/file-explorer/lib/fileExplorer.d.ts +32 -0
- package/dist/file-explorer/lib/paging.d.ts +93 -0
- package/dist/file-explorer/lib/types.d.ts +92 -0
- package/dist/file-explorer/lib/utils.d.ts +37 -0
- package/dist/file-explorer/toasts.d.ts +9 -0
- package/dist/file-explorer/treeRows.d.ts +35 -0
- package/dist/file-explorer/useNearEnd.d.ts +7 -0
- package/dist/form/index.js +4 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -101
- package/dist/list/ListTable.d.ts +63 -0
- package/dist/list/RowContextMenu.d.ts +113 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.js +2 -0
- package/dist/logviewer/index.js +1 -1
- package/dist/styles/theme.css +30 -0
- package/dist/styles.css +1 -1
- package/dist/workflow/index.js +3 -2
- package/package.json +20 -3
- package/dist/chunks/Provider-C2VtPnh5.js +0 -151
- package/dist/chunks/workers-Cjfjb8E7.js +0 -119
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
export type UIToastId = string | number;
|
|
3
|
+
export interface UIToastOptions {
|
|
4
|
+
toastId?: UIToastId;
|
|
5
|
+
/** false hides the default icon. */
|
|
6
|
+
icon?: false;
|
|
7
|
+
closeButton?: boolean;
|
|
8
|
+
autoClose?: number | false;
|
|
9
|
+
}
|
|
10
|
+
export interface UIToastUpdate {
|
|
11
|
+
render?: ReactNode;
|
|
12
|
+
type?: 'info' | 'success' | 'warning' | 'error';
|
|
13
|
+
/** false or null hides the icon. */
|
|
14
|
+
icon?: false | null;
|
|
15
|
+
isLoading?: boolean;
|
|
16
|
+
closeButton?: boolean | null;
|
|
17
|
+
autoClose?: number | false | null;
|
|
18
|
+
}
|
|
2
19
|
export interface UINotify {
|
|
3
20
|
info: (message: string) => void;
|
|
4
21
|
success: (message: string) => void;
|
|
22
|
+
warning: (message: string) => void;
|
|
5
23
|
error: (message: string) => void;
|
|
24
|
+
/** Persistent spinner toast; drive it with update/dismiss via the returned id. */
|
|
25
|
+
loading: (content: ReactNode, options?: UIToastOptions) => UIToastId;
|
|
26
|
+
update: (id: UIToastId, update: UIToastUpdate) => void;
|
|
27
|
+
/** Without an id, dismisses every open toast. */
|
|
28
|
+
dismiss: (id?: UIToastId) => void;
|
|
6
29
|
}
|
|
7
30
|
export interface UIStrings {
|
|
8
31
|
loading: string;
|
|
@@ -47,6 +70,210 @@ export interface UIStrings {
|
|
|
47
70
|
openOriginalWorkflow: string;
|
|
48
71
|
openInNewGraph: string;
|
|
49
72
|
};
|
|
73
|
+
fileExplorer: {
|
|
74
|
+
preview: {
|
|
75
|
+
shareFile: string;
|
|
76
|
+
open: string;
|
|
77
|
+
userType: string;
|
|
78
|
+
select: (name: string) => string;
|
|
79
|
+
viewDetails: string;
|
|
80
|
+
openFolder: string;
|
|
81
|
+
delete: string;
|
|
82
|
+
detailsTab: string;
|
|
83
|
+
previewTab: string;
|
|
84
|
+
preview: string;
|
|
85
|
+
openFullPreview: string;
|
|
86
|
+
quickLook: string;
|
|
87
|
+
fullWindow: string;
|
|
88
|
+
streamed: string;
|
|
89
|
+
streamedTooltip: string;
|
|
90
|
+
loading: string;
|
|
91
|
+
linkError: string;
|
|
92
|
+
errorTitle: string;
|
|
93
|
+
previewError: string;
|
|
94
|
+
tooLarge: string;
|
|
95
|
+
downloadInstead: string;
|
|
96
|
+
archiveTitle: string;
|
|
97
|
+
archiveMessage: string;
|
|
98
|
+
unsupportedTitle: string;
|
|
99
|
+
unsupportedMessage: string;
|
|
100
|
+
notebookParseError: string;
|
|
101
|
+
copyUri: string;
|
|
102
|
+
download: string;
|
|
103
|
+
close: string;
|
|
104
|
+
zoomIn: string;
|
|
105
|
+
zoomOut: string;
|
|
106
|
+
previousFile: string;
|
|
107
|
+
nextFile: string;
|
|
108
|
+
csvRows: (count: number, columns: number) => string;
|
|
109
|
+
csvFirstRows: (count: number, columns: number) => string;
|
|
110
|
+
head: string;
|
|
111
|
+
tail: string;
|
|
112
|
+
firstLines: (count: number) => string;
|
|
113
|
+
lastLines: (count: number) => string;
|
|
114
|
+
notebookOutput: string;
|
|
115
|
+
};
|
|
116
|
+
createFolder: {
|
|
117
|
+
action: string;
|
|
118
|
+
submit: string;
|
|
119
|
+
creating: string;
|
|
120
|
+
folder: string;
|
|
121
|
+
namePlaceholder: string;
|
|
122
|
+
success: (name: string) => string;
|
|
123
|
+
error: (message: string) => string;
|
|
124
|
+
invalidTarget: string;
|
|
125
|
+
noWriteAccess: string;
|
|
126
|
+
unsupported: string;
|
|
127
|
+
validation: {
|
|
128
|
+
reserved: string;
|
|
129
|
+
separator: string;
|
|
130
|
+
exists: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
readOnly: string;
|
|
134
|
+
cors: {
|
|
135
|
+
explanation: {
|
|
136
|
+
title: string;
|
|
137
|
+
description: string;
|
|
138
|
+
action: string;
|
|
139
|
+
note: string;
|
|
140
|
+
};
|
|
141
|
+
actions: {
|
|
142
|
+
retry: string;
|
|
143
|
+
addRules: string;
|
|
144
|
+
};
|
|
145
|
+
propagating: {
|
|
146
|
+
title: string;
|
|
147
|
+
description: string;
|
|
148
|
+
stages: {
|
|
149
|
+
submitted: string;
|
|
150
|
+
propagating: string;
|
|
151
|
+
verified: string;
|
|
152
|
+
};
|
|
153
|
+
telemetry: {
|
|
154
|
+
probing: string;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
selectedCount: (count: number) => string;
|
|
159
|
+
loadingMore: string;
|
|
160
|
+
loadMore: string;
|
|
161
|
+
retry: string;
|
|
162
|
+
partialCount: (count: number) => string;
|
|
163
|
+
notFound: {
|
|
164
|
+
title: (name: string) => string;
|
|
165
|
+
description: string;
|
|
166
|
+
retry: string;
|
|
167
|
+
};
|
|
168
|
+
treeMoreCount: (count: number) => string;
|
|
169
|
+
treeMoreCountPartial: (count: number) => string;
|
|
170
|
+
messages: {
|
|
171
|
+
noWriteAccess: string;
|
|
172
|
+
uploadsUnsupported: string;
|
|
173
|
+
noFilesForDownload: string;
|
|
174
|
+
downloadLinkFailed: string;
|
|
175
|
+
fileLinkFailed: string;
|
|
176
|
+
fileLinkCopied: string;
|
|
177
|
+
noUri: string;
|
|
178
|
+
uriCopied: string;
|
|
179
|
+
uriCopyFailed: string;
|
|
180
|
+
storageUnavailable: string;
|
|
181
|
+
waitForCurrentUpload: string;
|
|
182
|
+
waitForUpload: string;
|
|
183
|
+
downloadUnsupported: string;
|
|
184
|
+
sharingUnsupported: string;
|
|
185
|
+
deleteUnsupported: string;
|
|
186
|
+
uploadUnsupported: string;
|
|
187
|
+
noItemsForDeletion: string;
|
|
188
|
+
deleting: string;
|
|
189
|
+
deleteSomeFailed: string;
|
|
190
|
+
deleteSuccess: string;
|
|
191
|
+
deleteFailed: (message: string) => string;
|
|
192
|
+
noFilesToUpload: string;
|
|
193
|
+
invalidUploadTarget: string;
|
|
194
|
+
uploadInitFailed: string;
|
|
195
|
+
uploadQueuedInfo: string;
|
|
196
|
+
connectFailed: string;
|
|
197
|
+
corsNoStorage: string;
|
|
198
|
+
corsAdded: string;
|
|
199
|
+
corsPropagating: string;
|
|
200
|
+
};
|
|
201
|
+
chrome: {
|
|
202
|
+
explorer: string;
|
|
203
|
+
refresh: string;
|
|
204
|
+
collapse: string;
|
|
205
|
+
upload: string;
|
|
206
|
+
download: string;
|
|
207
|
+
access: string;
|
|
208
|
+
manageAccess: string;
|
|
209
|
+
delete: string;
|
|
210
|
+
copyToClipboard: string;
|
|
211
|
+
selectAll: string;
|
|
212
|
+
name: string;
|
|
213
|
+
size: string;
|
|
214
|
+
created: string;
|
|
215
|
+
hash: string;
|
|
216
|
+
storageIconAlt: string;
|
|
217
|
+
};
|
|
218
|
+
confirmUpload: {
|
|
219
|
+
title: string;
|
|
220
|
+
text: (path: string) => string;
|
|
221
|
+
defaultPath: string;
|
|
222
|
+
noPath: string;
|
|
223
|
+
confirm: string;
|
|
224
|
+
target: string;
|
|
225
|
+
totalSize: string;
|
|
226
|
+
sizeLimitTitle: string;
|
|
227
|
+
sizeLimitBody: (total: string, max: string) => string;
|
|
228
|
+
sizeLimitHint: string;
|
|
229
|
+
};
|
|
230
|
+
confirmDelete: {
|
|
231
|
+
title: string;
|
|
232
|
+
text: string;
|
|
233
|
+
action: string;
|
|
234
|
+
};
|
|
235
|
+
empty: {
|
|
236
|
+
nothingSelected: string;
|
|
237
|
+
nothingSelectedHint: string;
|
|
238
|
+
folderEmpty: string;
|
|
239
|
+
dropHint: string;
|
|
240
|
+
readOnlyHint: string;
|
|
241
|
+
connectionIssue: string;
|
|
242
|
+
tryAgain: string;
|
|
243
|
+
shareThisFile: string;
|
|
244
|
+
};
|
|
245
|
+
upload: {
|
|
246
|
+
inQueue: (position: number, total: number) => string;
|
|
247
|
+
queuedShort: (position: number, total: number) => string;
|
|
248
|
+
destination: string;
|
|
249
|
+
eta: string;
|
|
250
|
+
uploading: string;
|
|
251
|
+
completeTitle: string;
|
|
252
|
+
completeShort: string;
|
|
253
|
+
failedTitle: string;
|
|
254
|
+
failedShort: string;
|
|
255
|
+
unknownTitle: string;
|
|
256
|
+
unknownShort: string;
|
|
257
|
+
cancelled: string;
|
|
258
|
+
completed: string;
|
|
259
|
+
failed: string;
|
|
260
|
+
totalSize: string;
|
|
261
|
+
size: string;
|
|
262
|
+
calculating: string;
|
|
263
|
+
expandDetails: string;
|
|
264
|
+
minimizeDetails: string;
|
|
265
|
+
sessionNotQueued: (id: string, status: string) => string;
|
|
266
|
+
allCancelled: (count: number) => string;
|
|
267
|
+
someUploaded: (count: number) => string;
|
|
268
|
+
someCancelled: (count: number) => string;
|
|
269
|
+
allUploaded: string;
|
|
270
|
+
failedSummary: (failed: number, total: number) => string;
|
|
271
|
+
failReasonGeneric: string;
|
|
272
|
+
refreshFailed: (name: string, message: string) => string;
|
|
273
|
+
unknownError: string;
|
|
274
|
+
overallProgress: string;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
50
277
|
form: {
|
|
51
278
|
invalidDuration: string;
|
|
52
279
|
durationOutOfRange: (min: string, max: string) => string;
|
|
@@ -56,6 +283,19 @@ export interface UIStrings {
|
|
|
56
283
|
readOnlyDescription: string;
|
|
57
284
|
readOnlyForced: string;
|
|
58
285
|
};
|
|
286
|
+
list: {
|
|
287
|
+
copy: (label: string) => string;
|
|
288
|
+
copied: (label: string) => string;
|
|
289
|
+
couldntCopy: (label: string) => string;
|
|
290
|
+
moreActions: string;
|
|
291
|
+
labelName: string;
|
|
292
|
+
labelEmail: string;
|
|
293
|
+
labelUsername: string;
|
|
294
|
+
labelUid: string;
|
|
295
|
+
labelId: string;
|
|
296
|
+
labelUrl: string;
|
|
297
|
+
couldNotLoad: (noun: string) => string;
|
|
298
|
+
};
|
|
59
299
|
}
|
|
60
300
|
export interface UINavigation {
|
|
61
301
|
toWorkflow: (name: string) => void;
|
|
@@ -89,9 +329,32 @@ export interface UIData {
|
|
|
89
329
|
* editor's input completion. Absent, that completion silently no-ops.
|
|
90
330
|
*/
|
|
91
331
|
resolveWorkflowJson?: (ref: WorkflowJsonRef) => Promise<unknown>;
|
|
332
|
+
/**
|
|
333
|
+
* Provisions browser-access CORS rules on a storage. Absent, the storage
|
|
334
|
+
* explorer hides its "add CORS rules" affordance.
|
|
335
|
+
*/
|
|
336
|
+
provisionCorsRules?: (args: {
|
|
337
|
+
csp: string;
|
|
338
|
+
type?: string;
|
|
339
|
+
username: string;
|
|
340
|
+
storageName: string;
|
|
341
|
+
}) => Promise<{
|
|
342
|
+
error?: string;
|
|
343
|
+
}>;
|
|
92
344
|
}
|
|
93
345
|
import type { FieldComponent } from '../form/fieldRegistry.js';
|
|
346
|
+
/** Renders internal navigation; hosts bind their router's Link. */
|
|
347
|
+
export type UILinkComponent = React.ComponentType<{
|
|
348
|
+
to: string;
|
|
349
|
+
onClick?: () => void;
|
|
350
|
+
className?: string;
|
|
351
|
+
children: ReactNode;
|
|
352
|
+
}>;
|
|
353
|
+
/** The provider's link slot, with a plain anchor fallback. */
|
|
354
|
+
export declare function useLink(): UILinkComponent;
|
|
94
355
|
export interface UISlots {
|
|
356
|
+
/** Internal navigation links; absent falls back to a plain anchor. */
|
|
357
|
+
link?: UILinkComponent;
|
|
95
358
|
/**
|
|
96
359
|
* Host-supplied form field components, merged over the form engine's core
|
|
97
360
|
* registry by field type. Lazy components are supported — the registry
|
|
@@ -117,6 +380,35 @@ export interface UISlots {
|
|
|
117
380
|
type?: string;
|
|
118
381
|
className?: string;
|
|
119
382
|
}) => ReactNode;
|
|
383
|
+
/** Icon URL for a storage type; absent falls back to a generic disk icon.
|
|
384
|
+
* Scheme-dependent variants are the host's concern — bind with the host's
|
|
385
|
+
* own theme state. */
|
|
386
|
+
storageIconUrl?: (args: {
|
|
387
|
+
type: string;
|
|
388
|
+
}) => string | undefined;
|
|
389
|
+
/**
|
|
390
|
+
* The storage explorer's access-management drawer; absent hides the
|
|
391
|
+
* affordance. `storage` and `groups` are the host's own objects passed back
|
|
392
|
+
* through the explorer opaquely.
|
|
393
|
+
*/
|
|
394
|
+
accessDrawer?: (args: {
|
|
395
|
+
open: boolean;
|
|
396
|
+
setOpen: (open: boolean) => void;
|
|
397
|
+
storage: unknown;
|
|
398
|
+
groups?: unknown;
|
|
399
|
+
}) => ReactNode;
|
|
400
|
+
/** The storage explorer's create-folder dialog; absent hides the affordance. */
|
|
401
|
+
createFolderDialog?: (args: {
|
|
402
|
+
open: boolean;
|
|
403
|
+
onClose: () => void;
|
|
404
|
+
typeIcon?: ReactNode;
|
|
405
|
+
typeLabel: string;
|
|
406
|
+
namePlaceholder: string;
|
|
407
|
+
submitLabel: string;
|
|
408
|
+
submittingLabel: string;
|
|
409
|
+
validateName: (name: string) => string | null;
|
|
410
|
+
onSubmit: (name: string) => Promise<boolean>;
|
|
411
|
+
}) => ReactNode;
|
|
120
412
|
}
|
|
121
413
|
export interface UIProviderValue {
|
|
122
414
|
notify: UINotify;
|
|
@@ -130,6 +422,7 @@ export declare function useStrings(): UIStrings;
|
|
|
130
422
|
export declare function useNavigation(): UINavigation;
|
|
131
423
|
export declare function useSlots(): UISlots;
|
|
132
424
|
export declare function useWorkflowJsonResolver(): ((ref: WorkflowJsonRef) => Promise<unknown>) | undefined;
|
|
425
|
+
export declare function useProvisionCorsRules(): UIData['provisionCorsRules'];
|
|
133
426
|
export declare function useRunFile(slug: string, path: string | null, options?: {
|
|
134
427
|
refreshInterval?: number;
|
|
135
428
|
}): RunFileResult;
|
package/dist/editor/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { default as FormCodePanel } from './FormCodePanel.js';
|
|
|
4
4
|
export type { EditorMarketplaceItem, EditorWorkflowItem, IEditorProps, ISchemaError, } from './Monaco.js';
|
|
5
5
|
export { defineEditorThemes, getThemeName } from './themes.js';
|
|
6
6
|
export { setupMonacoWorkers } from './workers.js';
|
|
7
|
+
export { useCssIsDark } from './useCssIsDark.js';
|
package/dist/editor/index.js
CHANGED
|
@@ -1,219 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { t as Loader } from "../chunks/Loader-DQiZ75fa.js";
|
|
4
|
-
import { t as SwitchToggleSmall } from "../chunks/SwitchToggleSmall-FcsaYSTs.js";
|
|
5
|
-
import { c as FieldWrapper, n as flattenGroups, r as impureSetValueFromPath } from "../chunks/lib-DTgL8klR.js";
|
|
6
|
-
import { n as defineEditorThemes, r as getThemeName, t as setupMonacoWorkers } from "../chunks/workers-Cjfjb8E7.js";
|
|
7
|
-
import cx from "classnames";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { Suspense, lazy, useMemo, useRef, useState } from "react";
|
|
10
|
-
import { convertToDynamicForm, parseStringsOfObj, parseStringsOfObjReady } from "@parallelworks/workflow-parser";
|
|
11
|
-
import { useField, useFormikContext } from "formik";
|
|
12
|
-
//#region src/editor/Editor.tsx
|
|
13
|
-
var MonacoEditor = lazy(() => import("../chunks/Monaco-CP_cL9gp.js"));
|
|
14
|
-
function Editor({ ...props }) {
|
|
15
|
-
return /* @__PURE__ */ jsx(Suspense, {
|
|
16
|
-
fallback: /* @__PURE__ */ jsx(Loader, { text: "Loading editor..." }),
|
|
17
|
-
children: /* @__PURE__ */ jsx(MonacoEditor, { ...props })
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/editor/EditorField.tsx
|
|
22
|
-
function hasResetKeys(obj) {
|
|
23
|
-
return obj.editorKeyPostfix !== void 0;
|
|
24
|
-
}
|
|
25
|
-
function EditorField(props) {
|
|
26
|
-
const { field, label, labelPosition, disabled, onChange, tooltipComponent, spaceCompact, setFormDirty } = props;
|
|
27
|
-
const [fieldState] = useField(field.name);
|
|
28
|
-
const { setFieldValue, setFieldTouched, values } = useFormikContext();
|
|
29
|
-
const debounceRef = useRef(null);
|
|
30
|
-
const touchedRef = useRef(false);
|
|
31
|
-
const handleChange = (val) => {
|
|
32
|
-
touchedRef.current = true;
|
|
33
|
-
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
34
|
-
debounceRef.current = setTimeout(() => {
|
|
35
|
-
if (onChange) onChange(val);
|
|
36
|
-
setFieldTouched(field.name, true);
|
|
37
|
-
setFieldValue(field.name, val);
|
|
38
|
-
setFormDirty(true);
|
|
39
|
-
}, 500);
|
|
40
|
-
};
|
|
41
|
-
let editorKeyPostfix = "";
|
|
42
|
-
if (hasResetKeys(values)) editorKeyPostfix = values.editorKeyPostfix;
|
|
43
|
-
const postfixKey = useMemo(() => {
|
|
44
|
-
const randomKey = Math.random().toString(36).substring(7);
|
|
45
|
-
return editorKeyPostfix || randomKey;
|
|
46
|
-
}, [editorKeyPostfix]);
|
|
47
|
-
const value = fieldState.value;
|
|
48
|
-
return /* @__PURE__ */ jsx(FieldWrapper, {
|
|
49
|
-
optional: field.optional,
|
|
50
|
-
label,
|
|
51
|
-
tooltipComponent,
|
|
52
|
-
labelPosition,
|
|
53
|
-
spaceCompact,
|
|
54
|
-
children: /* @__PURE__ */ jsx(Editor, {
|
|
55
|
-
height: "200px",
|
|
56
|
-
path: field.name,
|
|
57
|
-
value: touchedRef.current ? void 0 : value,
|
|
58
|
-
className: cx("bg-(--theme-input-bg) w-11 border focus:border rounded text-[10px] leading-4 pl-[6px]", disabled && "opacity-75"),
|
|
59
|
-
readOnly: disabled,
|
|
60
|
-
onChange: handleChange,
|
|
61
|
-
language: field.options?.language || "shell"
|
|
62
|
-
}, field.name + postfixKey)
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/editor/FormCodePanel.tsx
|
|
67
|
-
var shouldIgnoreField = (fieldSchema, inputs, arrayIndex) => {
|
|
68
|
-
if (!fieldSchema?.ignore || !fieldSchema?.hidden) return false;
|
|
69
|
-
if (!parseStringsOfObjReady) return false;
|
|
70
|
-
return parseStringsOfObj({
|
|
71
|
-
inputs,
|
|
72
|
-
obj: convertToDynamicForm(fieldSchema),
|
|
73
|
-
index: arrayIndex ?? -1
|
|
74
|
-
}).hidden === true;
|
|
75
|
-
};
|
|
76
|
-
var filterFields = (formJSON, data, prefix, rootData, arrayIndex) => {
|
|
77
|
-
const filteredFields = [];
|
|
78
|
-
return {
|
|
79
|
-
filteredFields,
|
|
80
|
-
filtered: Object.keys(data).reduce((acc, key) => {
|
|
81
|
-
if (data[key] !== null && Array.isArray(data[key])) {
|
|
82
|
-
acc[key] = [];
|
|
83
|
-
if (!formJSON[key]) return acc;
|
|
84
|
-
for (let i = 0; i < data[key].length; i++) {
|
|
85
|
-
let filteredFieldsNested = [];
|
|
86
|
-
let filteredNested = {};
|
|
87
|
-
if (typeof data[key][i] === "object") {
|
|
88
|
-
const result = filterFields(formJSON[key].options, data[key][i], key + `[${i}].`, rootData || data, i);
|
|
89
|
-
filteredNested = result.filtered;
|
|
90
|
-
filteredFieldsNested = result.filteredFields;
|
|
91
|
-
} else filteredNested = data[key][i];
|
|
92
|
-
filteredFields.push(...filteredFieldsNested);
|
|
93
|
-
acc[key][i] = filteredNested;
|
|
94
|
-
}
|
|
95
|
-
return acc;
|
|
96
|
-
}
|
|
97
|
-
if (data[key] !== null && formJSON && formJSON[key] && typeof data[key] === "object") {
|
|
98
|
-
const { filteredFields: filteredFieldsNested, filtered: filteredNested } = filterFields(formJSON[key], data[key], key + ".", rootData || data, arrayIndex);
|
|
99
|
-
filteredFields.push(...filteredFieldsNested);
|
|
100
|
-
acc[key] = filteredNested;
|
|
101
|
-
return acc;
|
|
102
|
-
}
|
|
103
|
-
if (formJSON?.[key]?.sensitive) {
|
|
104
|
-
const name = prefix ? prefix + key : key;
|
|
105
|
-
filteredFields.push({
|
|
106
|
-
key: name,
|
|
107
|
-
value: data[key]
|
|
108
|
-
});
|
|
109
|
-
return acc;
|
|
110
|
-
}
|
|
111
|
-
const contextData = rootData || data;
|
|
112
|
-
if (formJSON && shouldIgnoreField(formJSON[key], contextData, arrayIndex)) return acc;
|
|
113
|
-
acc[key] = data[key];
|
|
114
|
-
return acc;
|
|
115
|
-
}, {})
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
var populateFiltered = (filteredFields, data) => {
|
|
119
|
-
filteredFields.forEach((element) => {
|
|
120
|
-
impureSetValueFromPath(data, element.key, element.value);
|
|
121
|
-
});
|
|
122
|
-
return data;
|
|
123
|
-
};
|
|
124
|
-
function FormCodePanel({ formJSON, data, mutate, height = "600px", disabled = false }) {
|
|
125
|
-
const notify = useNotify();
|
|
126
|
-
const { common: t } = useStrings();
|
|
127
|
-
const [jsonHasErrors, setJsonHasErrors] = useState(false);
|
|
128
|
-
const [showHidden, setShowHidden] = useState(false);
|
|
129
|
-
const [copied, setCopied] = useState(false);
|
|
130
|
-
const copyResetRef = useRef(void 0);
|
|
131
|
-
const isValidJson = (errors) => {
|
|
132
|
-
setJsonHasErrors(errors.length > 0);
|
|
133
|
-
};
|
|
134
|
-
const { filteredFields, filtered } = filterFields(flattenGroups(formJSON), data || {});
|
|
135
|
-
const hasHiddenFields = filteredFields.length > 0;
|
|
136
|
-
const displayObj = showHidden && hasHiddenFields ? populateFiltered(filteredFields, structuredClone(filtered)) : filtered;
|
|
137
|
-
const showHiddenRef = useRef(showHidden);
|
|
138
|
-
showHiddenRef.current = showHidden;
|
|
139
|
-
const filteredFieldsRef = useRef(filteredFields);
|
|
140
|
-
filteredFieldsRef.current = filteredFields;
|
|
141
|
-
const json = JSON.stringify(displayObj, null, 2);
|
|
142
|
-
const handleCopy = async () => {
|
|
143
|
-
try {
|
|
144
|
-
await navigator.clipboard.writeText(json);
|
|
145
|
-
setCopied(true);
|
|
146
|
-
clearTimeout(copyResetRef.current);
|
|
147
|
-
copyResetRef.current = setTimeout(() => setCopied(false), 2e3);
|
|
148
|
-
} catch {
|
|
149
|
-
notify.error(t.copyFailed);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
153
|
-
style: { height },
|
|
154
|
-
className: "flex w-full flex-col gap-2",
|
|
155
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
156
|
-
className: cx("flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border", jsonHasErrors ? "border-red-500" : "border-(--theme-border)"),
|
|
157
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
158
|
-
className: "bg-(--theme-muted-panel-bg) text-(--theme-muted-panel-color) flex shrink-0 items-center gap-3 border-b border-(--theme-border) px-3 py-2",
|
|
159
|
-
children: [hasHiddenFields && /* @__PURE__ */ jsxs("label", {
|
|
160
|
-
title: t.showHiddenFieldsHint,
|
|
161
|
-
className: "flex cursor-pointer select-none items-center gap-2 text-sm text-(--theme-app)",
|
|
162
|
-
children: [/* @__PURE__ */ jsx(SwitchToggleSmall, {
|
|
163
|
-
value: showHidden,
|
|
164
|
-
"aria-label": t.showHiddenFields,
|
|
165
|
-
onClick: () => setShowHidden((prev) => !prev)
|
|
166
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
167
|
-
className: "flex items-center gap-1.5",
|
|
168
|
-
children: [showHidden ? /* @__PURE__ */ jsx(EyeIcon, {}) : /* @__PURE__ */ jsx(EyeOffIcon, {}), t.showHiddenFields]
|
|
169
|
-
})]
|
|
170
|
-
}), /* @__PURE__ */ jsxs("button", {
|
|
171
|
-
type: "button",
|
|
172
|
-
onClick: handleCopy,
|
|
173
|
-
"aria-label": copied ? t.copied : t.copy,
|
|
174
|
-
className: "ml-auto flex shrink-0 items-center gap-1.5 rounded-md border border-(--theme-border) px-2.5 py-1.5 text-sm text-(--theme-app) transition-colors duration-150 hover:bg-(--theme-hover) focus:outline-none focus-visible:ring-2 focus-visible:ring-(--theme-link)",
|
|
175
|
-
children: [copied ? /* @__PURE__ */ jsx(CheckIcon, { className: "text-green-500" }) : /* @__PURE__ */ jsx(CopyIcon, { className: "text-(--theme-muted-text-color)" }), copied ? t.copied : t.copy]
|
|
176
|
-
})]
|
|
177
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
178
|
-
className: "min-h-0 flex-1",
|
|
179
|
-
children: /* @__PURE__ */ jsx(Editor, {
|
|
180
|
-
height: "100%",
|
|
181
|
-
value: json,
|
|
182
|
-
onValidate: isValidJson,
|
|
183
|
-
className: "!rounded-none !border-0",
|
|
184
|
-
minimap: { enabled: false },
|
|
185
|
-
scrollBeyondLastLine: false,
|
|
186
|
-
overviewRulerLanes: 0,
|
|
187
|
-
overviewRulerBorder: false,
|
|
188
|
-
lineNumbersMinChars: 3,
|
|
189
|
-
lineDecorationsWidth: 8,
|
|
190
|
-
renderLineHighlight: "none",
|
|
191
|
-
padding: {
|
|
192
|
-
top: 12,
|
|
193
|
-
bottom: 12
|
|
194
|
-
},
|
|
195
|
-
fontSize: 13,
|
|
196
|
-
scrollbar: {
|
|
197
|
-
verticalScrollbarSize: 10,
|
|
198
|
-
horizontalScrollbarSize: 10
|
|
199
|
-
},
|
|
200
|
-
onChange: (e) => {
|
|
201
|
-
try {
|
|
202
|
-
const parsed = JSON.parse(e);
|
|
203
|
-
mutate(showHiddenRef.current ? parsed : populateFiltered(filteredFieldsRef.current, parsed));
|
|
204
|
-
} catch {
|
|
205
|
-
console.log("JSON.parse error in slurm editor");
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
language: "json",
|
|
209
|
-
disabled
|
|
210
|
-
})
|
|
211
|
-
})]
|
|
212
|
-
}), jsonHasErrors && /* @__PURE__ */ jsx("p", {
|
|
213
|
-
className: "shrink-0 text-sm text-red-500",
|
|
214
|
-
children: t.jsonHasErrors
|
|
215
|
-
})]
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
//#endregion
|
|
219
|
-
export { Editor, EditorField, FormCodePanel, defineEditorThemes, getThemeName, setupMonacoWorkers };
|
|
1
|
+
import { a as FormCodePanel, i as getThemeName, n as setupMonacoWorkers, o as EditorField, r as defineEditorThemes, s as Editor, t as useCssIsDark } from "../chunks/editor-D55tumuZ.js";
|
|
2
|
+
export { Editor, EditorField, FormCodePanel, defineEditorThemes, getThemeName, setupMonacoWorkers, useCssIsDark };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Follows the host's CSS color-scheme, the same signal the log viewer's
|
|
3
|
+
* light-dark() palette uses — no provider API involved. For the rare concrete
|
|
4
|
+
* pick (editor themes, image variants) the tokens cannot express.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useCssIsDark(): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IFileExplorerClient, IFileExplorerProvider } from './lib/fileExplorer.js';
|
|
2
|
+
import type { TStorage } from './lib/types.js';
|
|
3
|
+
interface IFileExplorerProps {
|
|
4
|
+
storages: TStorage[];
|
|
5
|
+
/** Resolves the storage's injected provider pair; the host owns caching. */
|
|
6
|
+
getProviderAndClient: (storage: TStorage) => Promise<{
|
|
7
|
+
provider: IFileExplorerProvider | null;
|
|
8
|
+
client: IFileExplorerClient | null;
|
|
9
|
+
}>;
|
|
10
|
+
onRefresh?: () => void;
|
|
11
|
+
showUserHierarchy?: boolean;
|
|
12
|
+
groups?: {
|
|
13
|
+
name: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
}[];
|
|
16
|
+
groupsLoading?: boolean;
|
|
17
|
+
selectedPath: string;
|
|
18
|
+
onPathChange: (path: string) => void;
|
|
19
|
+
/** The modern layout drops the sidebar heading and adds the toolbar row. */
|
|
20
|
+
variant?: 'classic' | 'modern';
|
|
21
|
+
}
|
|
22
|
+
export default function FileExplorer({ storages, onRefresh, showUserHierarchy, groups, groupsLoading, selectedPath, onPathChange, getProviderAndClient, variant, }: IFileExplorerProps): import("react").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TreeNode, UploadFileProgress, UploadNode, UploadSession } from './lib/types.js';
|
|
2
|
+
import type { IFileExplorerClient, IFileExplorerProvider } from './lib/fileExplorer.js';
|
|
3
|
+
interface IFileExplorerContextValue {
|
|
4
|
+
uploadSessionMap: Map<string, UploadSession>;
|
|
5
|
+
uploadQueue: string[];
|
|
6
|
+
addUploadSession: (storageName: string, targetPath: string, uploadNodes: UploadNode[], client: IFileExplorerClient, provider: IFileExplorerProvider, targetNode: TreeNode, refreshTargetNode: (targetNode: TreeNode) => Promise<unknown>) => string;
|
|
7
|
+
getUploadSessionById: (sessionId: string) => UploadSession | undefined;
|
|
8
|
+
getUploadQueueIndex: (sessionId: string) => number;
|
|
9
|
+
startUploadSession: (sessionId: string) => Promise<void>;
|
|
10
|
+
updateFileUploadProgress?: (sessionId: string, fileKey: string, progress: UploadFileProgress) => void;
|
|
11
|
+
}
|
|
12
|
+
interface IFileExplorerProviderProps {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function FileExplorerProvider({ children }: IFileExplorerProviderProps): import("react").JSX.Element;
|
|
16
|
+
export declare function useFileExplorer(): IFileExplorerContextValue;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TreeNode, TStorage } from '../lib/types.js';
|
|
2
|
+
interface FilePreviewInlineProps {
|
|
3
|
+
node: TreeNode;
|
|
4
|
+
storage: TStorage | null;
|
|
5
|
+
getPresignedUrl: (node: TreeNode) => Promise<[string | null, Error | null]>;
|
|
6
|
+
onOpenFull: (node: TreeNode) => void;
|
|
7
|
+
onDownload: (node: TreeNode) => void;
|
|
8
|
+
/** When false, skip fetching and release any held preview blob. */
|
|
9
|
+
active?: boolean;
|
|
10
|
+
showSecurityIndicator?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function FilePreviewInline({ node, storage, getPresignedUrl, onOpenFull, onDownload, active, showSecurityIndicator, }: FilePreviewInlineProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function StreamedBadge(): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TreeNode, TStorage } from '../lib/types.js';
|
|
2
|
+
import { type PreviewKind } from './previewType.js';
|
|
3
|
+
interface FilePreviewViewerProps {
|
|
4
|
+
node: TreeNode;
|
|
5
|
+
kind: PreviewKind;
|
|
6
|
+
url: string | null;
|
|
7
|
+
urlLoading: boolean;
|
|
8
|
+
urlError: string | null;
|
|
9
|
+
/** Image zoom percentage; 100 fits the stage. */
|
|
10
|
+
zoom?: number;
|
|
11
|
+
onDownload?: (() => void) | undefined;
|
|
12
|
+
storage?: TStorage | null;
|
|
13
|
+
}
|
|
14
|
+
export declare function FilePreviewViewer({ node, kind, url, urlLoading, urlError, zoom, onDownload, storage, }: FilePreviewViewerProps): import("react").JSX.Element | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TreeNode, TStorage } from '../lib/types.js';
|
|
2
|
+
interface FilePreviewProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
node: TreeNode | null;
|
|
5
|
+
siblings: TreeNode[];
|
|
6
|
+
storage: TStorage | null;
|
|
7
|
+
getPresignedUrl: (node: TreeNode) => Promise<[string | null, Error | null]>;
|
|
8
|
+
onNavigate: (node: TreeNode) => void;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
onDownload: (node: TreeNode) => void;
|
|
11
|
+
onCopyUri: (node: TreeNode) => void;
|
|
12
|
+
showSecurityIndicator?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function FilePreview({ open, node, siblings, storage, getPresignedUrl, onNavigate, onClose, onDownload, onCopyUri, showSecurityIndicator, }: FilePreviewProps): import("react").ReactPortal | null;
|
|
15
|
+
export {};
|