@parallelworks/ui 0.1.0 → 0.2.0
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/dist/assets/editor.worker-CuBRIwi-.js +14776 -0
- package/dist/assets/json.worker-8ytS02vz.js +22161 -0
- package/dist/assets/yaml.worker-DJC-VUcv.js +48367 -0
- package/dist/chunks/Indicator-fF8AVbjQ.js +158 -0
- package/dist/chunks/Loader-DQiZ75fa.js +25 -0
- package/dist/chunks/MarkdownImpl-Bq4QhrtA.js +33 -0
- package/dist/chunks/Monaco-CP_cL9gp.js +745 -0
- package/dist/chunks/Provider-C2VtPnh5.js +151 -0
- package/dist/chunks/SwitchToggleSmall-FcsaYSTs.js +14 -0
- package/dist/chunks/Table-DWuRINhu.js +855 -0
- package/dist/chunks/Tooltip-WgbiC_nd.js +71 -0
- package/dist/chunks/lib-DTgL8klR.js +191 -0
- package/dist/chunks/workers-Cjfjb8E7.js +119 -0
- package/dist/components/CollapsiblePanel.d.ts +27 -0
- package/dist/components/CopyToClipboard.d.ts +17 -0
- package/dist/components/Dropdown.d.ts +24 -0
- package/dist/components/Indicator.d.ts +4 -0
- package/dist/components/Listbox.d.ts +18 -0
- package/dist/components/Markdown.d.ts +7 -0
- package/dist/components/MarkdownImpl.d.ts +2 -0
- package/dist/components/MultiSelect.d.ts +19 -0
- package/dist/components/Overview.d.ts +12 -0
- package/dist/components/Provider.d.ts +145 -0
- package/dist/components/SectionHeader.d.ts +6 -0
- package/dist/components/SwitchToggle.d.ts +12 -0
- package/dist/components/SwitchToggleSmall.d.ts +6 -0
- package/dist/components/dropdownUtils.d.ts +18 -0
- package/dist/editor/Editor.d.ts +2 -0
- package/dist/editor/EditorField.d.ts +11 -0
- package/dist/editor/FormCodePanel.d.ts +8 -0
- package/dist/editor/Monaco.d.ts +31 -0
- package/dist/editor/index.d.ts +6 -0
- package/dist/editor/index.js +219 -0
- package/dist/editor/themes.d.ts +4 -0
- package/dist/editor/workers.d.ts +6 -0
- package/dist/form/FieldWrapper.d.ts +10 -0
- package/dist/form/Fields/BooleanField.d.ts +12 -0
- package/dist/form/Fields/BucketReadOnlyField.d.ts +7 -0
- package/dist/form/Fields/CheckboxGroupField.d.ts +18 -0
- package/dist/form/Fields/ColorField.d.ts +8 -0
- package/dist/form/Fields/DropdownField.d.ts +24 -0
- package/dist/form/Fields/DurationField.d.ts +13 -0
- package/dist/form/Fields/LabelField.d.ts +9 -0
- package/dist/form/Fields/MultiDropdownField.d.ts +18 -0
- package/dist/form/Fields/NumberField.d.ts +13 -0
- package/dist/form/Fields/ObjectField.d.ts +8 -0
- package/dist/form/Fields/RadioField.d.ts +9 -0
- package/dist/form/Fields/RangeField.d.ts +11 -0
- package/dist/form/Fields/ResourceOptionIcon.d.ts +11 -0
- package/dist/form/Fields/StepField.d.ts +3 -0
- package/dist/form/Fields/StringField.d.ts +17 -0
- package/dist/form/Fields/TextAreaField.d.ts +8 -0
- package/dist/form/Fields/durationValidity.d.ts +2 -0
- package/dist/form/Form.d.ts +105 -0
- package/dist/form/SpecialTypes/DropdownWrapper.d.ts +14 -0
- package/dist/form/SpecialTypes/FormikCustomDropdown.d.ts +53 -0
- package/dist/form/SpecialTypes/FormikCustomInput.d.ts +17 -0
- package/dist/form/SpecialTypes/FormikMultiSelectDropdown.d.ts +13 -0
- package/dist/form/SpecialTypes/FormikNumericInput.d.ts +9 -0
- package/dist/form/SpecialTypes/index.d.ts +3 -0
- package/dist/form/Wizard/WizardContainer.d.ts +5 -0
- package/dist/form/Wizard/WizardNavigation.d.ts +2 -0
- package/dist/form/Wizard/WizardStepContent.d.ts +8 -0
- package/dist/form/Wizard/WizardStepIndicator.d.ts +2 -0
- package/dist/form/Wizard/types.d.ts +171 -0
- package/dist/form/Wizard/useWizardState.d.ts +28 -0
- package/dist/form/Wizard/utils.d.ts +2 -0
- package/dist/form/fieldRegistry.d.ts +7 -0
- package/dist/form/index.d.ts +16 -0
- package/dist/form/index.js +2317 -0
- package/dist/form/lib.d.ts +15 -0
- package/dist/form/types/fieldComponentTypes.d.ts +32 -0
- package/dist/form/types/fieldTypes.d.ts +80 -0
- package/dist/form/types/workflow-schema.d.ts +1107 -0
- package/dist/form/useParsedOpts.d.ts +5 -0
- package/dist/form/usePrevious.d.ts +1 -0
- package/dist/form/utils/checkShowIfObject.d.ts +1 -0
- package/dist/form/utils/getParentValue.d.ts +1 -0
- package/dist/form/utils/getPlaceholder.d.ts +2 -0
- package/dist/form/utils/getValueUsingPath.d.ts +1 -0
- package/dist/form/utils/pwResolver.d.ts +18 -0
- package/dist/form/utils/secondaryField.d.ts +8 -0
- package/dist/form/utils/slurmDuration.d.ts +15 -0
- package/dist/icons.d.ts +1 -1
- package/dist/icons.js +2 -2
- package/dist/index.d.ts +17 -0
- package/dist/index.js +107 -323
- package/dist/logviewer/LogViewer.d.ts +18 -0
- package/dist/logviewer/index.d.ts +1 -0
- package/dist/logviewer/index.js +534 -0
- package/dist/logviewer/logviewer.css +70 -0
- package/dist/styles.css +1 -1
- package/dist/workflow/AnnotationBanner.d.ts +5 -0
- package/dist/workflow/Collapse.d.ts +6 -0
- package/dist/workflow/DependencyGraph.d.ts +15 -0
- package/dist/workflow/JobSummary.d.ts +38 -0
- package/dist/workflow/MatrixGroup.d.ts +41 -0
- package/dist/workflow/Reveal.d.ts +7 -0
- package/dist/workflow/TreeView.d.ts +42 -0
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.js +2330 -0
- package/package.json +60 -6
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface IToggleProps {
|
|
2
|
+
onChange: (value: boolean) => void;
|
|
3
|
+
value?: boolean;
|
|
4
|
+
/** Display label for the on/off positions; defaults to Yes/No. */
|
|
5
|
+
yesLabel?: string;
|
|
6
|
+
noLabel?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
datatip?: string;
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function SwitchToggle({ onChange, value, yesLabel, noLabel, disabled, datatip, invalid, }: IToggleProps): import("react").JSX.Element;
|
|
12
|
+
export default SwitchToggle;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
interface SwitchToggleSmallProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
|
|
3
|
+
value?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export default function SwitchToggleSmall({ value, disabled, className, ...buttonProps }: SwitchToggleSmallProps): React.JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export interface IOptions<T = unknown> {
|
|
3
|
+
label: string;
|
|
4
|
+
value: T;
|
|
5
|
+
secondaryValue?: unknown;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
description?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ICategory<T = unknown> {
|
|
11
|
+
category?: string;
|
|
12
|
+
options: IOptions<T>[];
|
|
13
|
+
}
|
|
14
|
+
export declare function isCategory<T>(option: ICategory<T> | IOptions<T> | string): option is ICategory<T>;
|
|
15
|
+
export declare function isOption<T>(option: ICategory<T> | IOptions<T> | string): option is IOptions<T>;
|
|
16
|
+
export declare function flattenOptions<T>(options: (ICategory<T> | IOptions<T> | string)[]): (IOptions<T> | ICategory<T>)[];
|
|
17
|
+
export declare function filterOption<T>(option: IOptions<T>, query: string): boolean;
|
|
18
|
+
export declare function DropdownCaret(): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../form/types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../form/types/fieldTypes.js';
|
|
3
|
+
export interface IEditorField extends BaseField {
|
|
4
|
+
type: 'editor';
|
|
5
|
+
default?: string;
|
|
6
|
+
options?: {
|
|
7
|
+
language?: string;
|
|
8
|
+
theme?: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export default function EditorField(props: FieldComponentProps<IEditorField>): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as monaco from 'monaco-editor';
|
|
2
|
+
export interface EditorMarketplaceItem {
|
|
3
|
+
readonly slug?: string;
|
|
4
|
+
readonly name?: string | null;
|
|
5
|
+
readonly description?: string | null;
|
|
6
|
+
readonly type?: string | null;
|
|
7
|
+
readonly subtype?: string | null;
|
|
8
|
+
readonly versions?: readonly string[] | null;
|
|
9
|
+
}
|
|
10
|
+
export interface EditorWorkflowItem {
|
|
11
|
+
readonly name?: string;
|
|
12
|
+
readonly displayName?: string | null;
|
|
13
|
+
readonly description?: string | null;
|
|
14
|
+
readonly type?: string | null;
|
|
15
|
+
}
|
|
16
|
+
type MarketplaceItem = EditorMarketplaceItem;
|
|
17
|
+
type WorkflowItem = EditorWorkflowItem;
|
|
18
|
+
export type ISchemaError = monaco.editor.IMarker;
|
|
19
|
+
export interface IEditorProps extends monaco.editor.IStandaloneEditorConstructionOptions {
|
|
20
|
+
className?: string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
onChange?: (value: string) => void;
|
|
23
|
+
onValidate?: (errors: any[]) => void;
|
|
24
|
+
width?: string | number;
|
|
25
|
+
height?: string | number;
|
|
26
|
+
path?: 'file:///workflow.yaml' | string;
|
|
27
|
+
marketplaceItems?: MarketplaceItem[];
|
|
28
|
+
workflows?: WorkflowItem[];
|
|
29
|
+
}
|
|
30
|
+
export default function MonacoEditor({ className, disabled, onChange, onValidate, width, height, path, marketplaceItems, workflows, ...options }: IEditorProps): import("react").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Editor } from './Editor.js';
|
|
2
|
+
export { default as EditorField, type IEditorField } from './EditorField.js';
|
|
3
|
+
export { default as FormCodePanel } from './FormCodePanel.js';
|
|
4
|
+
export type { EditorMarketplaceItem, EditorWorkflowItem, IEditorProps, ISchemaError, } from './Monaco.js';
|
|
5
|
+
export { defineEditorThemes, getThemeName } from './themes.js';
|
|
6
|
+
export { setupMonacoWorkers } from './workers.js';
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { CheckIcon, CopyIcon, EyeIcon, EyeOffIcon } from "../icons.js";
|
|
2
|
+
import { o as useStrings, r as useNotify } from "../chunks/Provider-C2VtPnh5.js";
|
|
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 };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type * as monaco from 'monaco-editor';
|
|
2
|
+
export declare function expandShorthandHex(color: string): string;
|
|
3
|
+
export declare function defineEditorThemes(monacoEditor: typeof monaco.editor): void;
|
|
4
|
+
export declare function getThemeName(isDark: boolean, disabled?: boolean): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Points window.MonacoEnvironment at the bundled workers. Idempotent, and a
|
|
3
|
+
* host that already configured its own MonacoEnvironment wins — the editor
|
|
4
|
+
* calls this on first load only when nothing is configured.
|
|
5
|
+
*/
|
|
6
|
+
export declare function setupMonacoWorkers(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export declare function FieldWrapper({ label, tooltipComponent, description, labelPosition, spaceCompact, optional, children, }: {
|
|
3
|
+
label: string;
|
|
4
|
+
tooltipComponent?: React.ReactNode;
|
|
5
|
+
description?: string | undefined;
|
|
6
|
+
labelPosition?: 'left' | 'top' | undefined;
|
|
7
|
+
spaceCompact?: boolean | undefined;
|
|
8
|
+
optional?: boolean | undefined;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
3
|
+
export interface IBooleanField extends BaseField {
|
|
4
|
+
type: 'boolean';
|
|
5
|
+
default?: boolean;
|
|
6
|
+
options?: {
|
|
7
|
+
onOption?: boolean | string;
|
|
8
|
+
offOption?: boolean | string;
|
|
9
|
+
};
|
|
10
|
+
disabled_message?: string;
|
|
11
|
+
}
|
|
12
|
+
export default function BooleanField(props: FieldComponentProps<IBooleanField>): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
3
|
+
interface BucketReadOnlyField extends BaseField {
|
|
4
|
+
type: 'bucket-read-only';
|
|
5
|
+
}
|
|
6
|
+
export default function BucketReadOnlyField({ field, disabled, missing, labelPosition, setFormDirty, }: FieldComponentProps<BucketReadOnlyField>): import("react").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
3
|
+
export interface ICheckboxGroupField extends BaseField {
|
|
4
|
+
type: 'checkbox-group';
|
|
5
|
+
options?: Array<{
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Maps a value to the values it forces on. While the key is selected, each
|
|
12
|
+
* listed value is checked and locked (disabled) to show the implication.
|
|
13
|
+
* Deselecting the key clears the implied values unless the user had also
|
|
14
|
+
* selected them independently.
|
|
15
|
+
*/
|
|
16
|
+
implies?: Record<string, string[]>;
|
|
17
|
+
}
|
|
18
|
+
export default function CheckboxGroupField({ field, label, labelPosition, missing, disabled, onChange, tooltipComponent, spaceCompact, setFormDirty, }: FieldComponentProps<ICheckboxGroupField>): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
3
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
4
|
+
export interface IColorField extends BaseField {
|
|
5
|
+
type: 'color';
|
|
6
|
+
default?: string;
|
|
7
|
+
}
|
|
8
|
+
export default function ColorField(props: FieldComponentProps<IColorField>): React.JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
3
|
+
export interface IDropdownField extends BaseField {
|
|
4
|
+
type: 'dropdown';
|
|
5
|
+
dropdownType?: string;
|
|
6
|
+
options: Array<{
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
secondaryLabel?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
}> | Record<string, Array<{
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
secondaryLabel?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
}>>;
|
|
17
|
+
parentValue?: string;
|
|
18
|
+
resetOnChange?: boolean;
|
|
19
|
+
autoselect?: boolean;
|
|
20
|
+
allowCustomValue?: boolean;
|
|
21
|
+
customValueLabel?: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
}
|
|
24
|
+
export default function DropdownField(props: FieldComponentProps<IDropdownField, string>): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
3
|
+
export interface IDurationField extends BaseField {
|
|
4
|
+
type: 'duration';
|
|
5
|
+
default?: number;
|
|
6
|
+
min?: number | string;
|
|
7
|
+
max?: number | string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
disableValue?: number;
|
|
10
|
+
disableLabel?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: import("react").MemoExoticComponent<({ field, label, labelPosition, missing, disabled, onChange, tooltipComponent, spaceCompact, setFormDirty, currentValue, setFieldValue, setFieldTouched, }: FieldComponentProps<IDurationField, number | string | undefined>) => import("react").JSX.Element>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
3
|
+
export interface ILabelField extends BaseField {
|
|
4
|
+
type: 'label';
|
|
5
|
+
text?: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
bold?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export default function LabelField(props: FieldComponentProps<ILabelField>): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
3
|
+
export interface IMultiDropdownField extends BaseField {
|
|
4
|
+
type: 'multi-dropdown';
|
|
5
|
+
options: Array<string | {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string | boolean | number;
|
|
8
|
+
secondaryLabel?: string;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
}> | Record<string, Array<string | {
|
|
11
|
+
label: string;
|
|
12
|
+
value: string | boolean | number;
|
|
13
|
+
secondaryLabel?: string;
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
}>>;
|
|
16
|
+
parentValue?: string | boolean | number;
|
|
17
|
+
}
|
|
18
|
+
export default function MultiDropdownField({ field, label, tooltipComponent, labelPosition, spaceCompact, disabled, missing, setFormDirty, onChange, }: FieldComponentProps<IMultiDropdownField>): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
3
|
+
export interface INumberField extends BaseField {
|
|
4
|
+
type: 'number';
|
|
5
|
+
default?: number;
|
|
6
|
+
prefillDefault?: boolean;
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
thousandsSeparator?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export default function NumberField(props: FieldComponentProps<INumberField>): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
3
|
+
import type { BaseField, DynamicFormSchema } from '../types/fieldTypes.js';
|
|
4
|
+
export interface IObjectField extends BaseField {
|
|
5
|
+
type: 'object';
|
|
6
|
+
options: DynamicFormSchema;
|
|
7
|
+
}
|
|
8
|
+
export default function ObjectField({ field, label, tooltipComponent, missingFields, setFormDirty, workflowForm, labelPosition, spaceCompact, }: FieldComponentProps<IObjectField>): React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
3
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
4
|
+
export interface IRadioField extends BaseField {
|
|
5
|
+
type: 'radio';
|
|
6
|
+
options?: string[];
|
|
7
|
+
optionLabelPosition?: 'left' | 'top';
|
|
8
|
+
}
|
|
9
|
+
export default function RadioField(props: FieldComponentProps<IRadioField>): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
3
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
4
|
+
export interface IRangeField extends BaseField {
|
|
5
|
+
type: 'range';
|
|
6
|
+
default?: number;
|
|
7
|
+
min: number;
|
|
8
|
+
max: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
}
|
|
11
|
+
export default function RangeField(props: FieldComponentProps<IRangeField>): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StatusDot } from '../../components/StatusBadge.js';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
interface ResourceOptionIconProps {
|
|
4
|
+
imageUrl?: string;
|
|
5
|
+
fallbackIcon: string;
|
|
6
|
+
alt: string;
|
|
7
|
+
variant?: ComponentProps<typeof StatusDot>['variant'];
|
|
8
|
+
dotSize?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function ResourceOptionIcon({ imageUrl, fallbackIcon, alt, variant, dotSize, }: ResourceOptionIconProps): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
3
|
+
export interface IStringField extends BaseField {
|
|
4
|
+
type: 'string' | 'password';
|
|
5
|
+
default?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
lowercase?: boolean;
|
|
8
|
+
minLength?: number;
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
step?: number;
|
|
13
|
+
sanitize?: string;
|
|
14
|
+
prefillDefault?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: import("react").MemoExoticComponent<(props: FieldComponentProps<IStringField, string>) => import("react").JSX.Element>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FieldComponentProps } from '../types/fieldComponentTypes.js';
|
|
2
|
+
import type { BaseField } from '../types/fieldTypes.js';
|
|
3
|
+
export interface ITextAreaField extends BaseField {
|
|
4
|
+
type: 'textarea';
|
|
5
|
+
default?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
}
|
|
8
|
+
export default function TextAreaField(props: FieldComponentProps<ITextAreaField>): import("react").JSX.Element;
|