@chobantonov/jsonforms-react-extended-renderers 0.0.0-stage → 0.1.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/LICENSE +22 -0
- package/README.md +17 -2
- package/lib/AgGridControlRenderer.impl-BO-Z1x0Y.js +2 -0
- package/lib/AgGridControlRenderer.impl-BO-Z1x0Y.js.map +1 -0
- package/lib/AgGridControlRenderer.impl-BZS8_ocu.mjs +429 -0
- package/lib/AgGridControlRenderer.impl-BZS8_ocu.mjs.map +1 -0
- package/lib/DynamicJSXRenderer-Cyw40Kz0.js +2 -0
- package/lib/DynamicJSXRenderer-Cyw40Kz0.js.map +1 -0
- package/lib/DynamicJSXRenderer-DyB3ZpZV.mjs +109 -0
- package/lib/DynamicJSXRenderer-DyB3ZpZV.mjs.map +1 -0
- package/lib/MarkupLabelRenderer.impl-CWfdcUuH.mjs +12 -0
- package/lib/MarkupLabelRenderer.impl-CWfdcUuH.mjs.map +1 -0
- package/lib/MarkupLabelRenderer.impl-DnuzIPQg.js +2 -0
- package/lib/MarkupLabelRenderer.impl-DnuzIPQg.js.map +1 -0
- package/lib/MonacoControlRenderer.impl-BwgLGNMK.js +3 -0
- package/lib/MonacoControlRenderer.impl-BwgLGNMK.js.map +1 -0
- package/lib/MonacoControlRenderer.impl-CyjMHbOd.mjs +186 -0
- package/lib/MonacoControlRenderer.impl-CyjMHbOd.mjs.map +1 -0
- package/lib/RactiveTemplate-7L44A38e.js +2 -0
- package/lib/RactiveTemplate-7L44A38e.js.map +1 -0
- package/lib/RactiveTemplate-Cat7CxUp.mjs +74 -0
- package/lib/RactiveTemplate-Cat7CxUp.mjs.map +1 -0
- package/lib/ajv-localizers.cjs.js +2 -0
- package/lib/ajv-localizers.cjs.js.map +1 -0
- package/lib/ajv-localizers.esm.js +7 -0
- package/lib/ajv-localizers.esm.js.map +1 -0
- package/lib/ajvI18n-2UTyJv5g.js +2 -0
- package/lib/ajvI18n-2UTyJv5g.js.map +1 -0
- package/lib/ajvI18n-DO8FFvx1.mjs +227 -0
- package/lib/ajvI18n-DO8FFvx1.mjs.map +1 -0
- package/lib/celTemplate-Cl0alaCz.js +3 -0
- package/lib/celTemplate-Cl0alaCz.js.map +1 -0
- package/lib/celTemplate-D_AGhaIL.mjs +137 -0
- package/lib/celTemplate-D_AGhaIL.mjs.map +1 -0
- package/lib/components/DynamicJSXRenderer.d.ts +7 -0
- package/lib/components/ExtendedJsonForms.d.ts +80 -0
- package/lib/components/GenericAdditionalProperties.d.ts +4 -0
- package/lib/components/InterpolatedText.d.ts +34 -0
- package/lib/components/RactiveTemplate.d.ts +37 -0
- package/lib/components/editorRendererTypes.d.ts +139 -0
- package/lib/components/elementRender.d.ts +15 -0
- package/lib/configNamespaces-BFclHtB8.mjs +1 -0
- package/lib/configNamespaces-sboXDudL.js +1 -0
- package/lib/core/ajv.d.ts +82 -0
- package/lib/core/ajvI18n/bg.d.ts +2 -0
- package/lib/core/ajvI18n/index.d.ts +118 -0
- package/lib/core/ajvI18n/localizers.d.ts +20 -0
- package/lib/core/dynamicDefaults.d.ts +34 -0
- package/lib/core/keywords.d.ts +24 -0
- package/lib/core/transform.d.ts +29 -0
- package/lib/core/uiSchema.d.ts +48 -0
- package/lib/elementRender-Dbp2e-Cc.js +2 -0
- package/lib/elementRender-Dbp2e-Cc.js.map +1 -0
- package/lib/elementRender-y8MK9CCE.mjs +5 -0
- package/lib/elementRender-y8MK9CCE.mjs.map +1 -0
- package/lib/index.d.ts +41 -0
- package/lib/jsonforms-react-extended.cjs.js +16 -0
- package/lib/jsonforms-react-extended.cjs.js.map +1 -0
- package/lib/jsonforms-react-extended.esm.js +2335 -0
- package/lib/jsonforms-react-extended.esm.js.map +1 -0
- package/lib/locale/bg.d.ts +14 -0
- package/lib/markdown-C_y73Q0w.mjs +123 -0
- package/lib/markdown-C_y73Q0w.mjs.map +1 -0
- package/lib/markdown-CuqtpGVd.js +2 -0
- package/lib/markdown-CuqtpGVd.js.map +1 -0
- package/lib/objectWithoutProperties-6zedhz76.js +2 -0
- package/lib/objectWithoutProperties-6zedhz76.js.map +1 -0
- package/lib/objectWithoutProperties-yjQMyZ0y.mjs +58 -0
- package/lib/objectWithoutProperties-yjQMyZ0y.mjs.map +1 -0
- package/lib/renderers/AgGridControlRenderer.d.ts +10 -0
- package/lib/renderers/AgGridControlRenderer.impl.d.ts +4 -0
- package/lib/renderers/ButtonRenderer.d.ts +83 -0
- package/lib/renderers/GenericMixedRenderer.d.ts +9 -0
- package/lib/renderers/HorizontalLayoutRenderer.d.ts +5 -0
- package/lib/renderers/ImageViewRenderer.d.ts +48 -0
- package/lib/renderers/LinkRenderer.d.ts +23 -0
- package/lib/renderers/MarkupLabelRenderer.d.ts +35 -0
- package/lib/renderers/MarkupLabelRenderer.impl.d.ts +17 -0
- package/lib/renderers/MonacoControlRenderer.d.ts +8 -0
- package/lib/renderers/MonacoControlRenderer.impl.d.ts +4 -0
- package/lib/renderers/RactiveTemplateLayoutRenderer.d.ts +6 -0
- package/lib/renderers/SeparatorRenderer.d.ts +17 -0
- package/lib/renderers/SlotRenderer.d.ts +5 -0
- package/lib/renderers/SpacerRenderer.d.ts +5 -0
- package/lib/renderers/SplitLayoutRenderer.d.ts +18 -0
- package/lib/renderers/TemplateLayoutRenderer.d.ts +13 -0
- package/lib/renderers/TemplateRenderer.d.ts +17 -0
- package/lib/renderers/TsxTemplateLayoutRenderer.d.ts +111 -0
- package/lib/renderers/index.d.ts +13 -0
- package/lib/renderers/templateEngines.d.ts +43 -0
- package/lib/util/actionContext.d.ts +23 -0
- package/lib/util/additionalErrors.d.ts +77 -0
- package/lib/util/celEnvironment.d.ts +23 -0
- package/lib/util/celTemplate.d.ts +47 -0
- package/lib/util/childNames.d.ts +46 -0
- package/lib/util/configNamespaces.d.ts +1 -0
- package/lib/util/cron.d.ts +122 -0
- package/lib/util/editorControls.d.ts +8 -0
- package/lib/util/editorDiagnostics.d.ts +56 -0
- package/lib/util/extendedControls.d.ts +4 -0
- package/lib/util/extendedLocale.d.ts +32 -0
- package/lib/util/fileFilterValue.d.ts +3 -0
- package/lib/util/formContext.d.ts +54 -0
- package/lib/util/gridColumns.d.ts +6 -0
- package/lib/util/horizontalLayout.d.ts +10 -0
- package/lib/util/i18nDefaults.d.ts +45 -0
- package/lib/util/interpolate.d.ts +105 -0
- package/lib/util/labelFilterValue.d.ts +2 -0
- package/lib/util/lazyControl.d.ts +36 -0
- package/lib/util/lazyTemplate.d.ts +18 -0
- package/lib/util/markdown.d.ts +55 -0
- package/lib/util/markdownEscape.d.ts +27 -0
- package/lib/util/markup.d.ts +74 -0
- package/lib/util/maskControls.d.ts +2 -0
- package/lib/util/templateLang.d.ts +87 -0
- package/lib/util/templateUrls.d.ts +40 -0
- package/lib/util/urlPolicy.d.ts +42 -0
- package/lib/util/useCronPicker.d.ts +24 -0
- package/lib/util/useDurationControl.d.ts +99 -0
- package/lib/util/useEditorAppearance.d.ts +21 -0
- package/lib/util/useExtendedTranslator.d.ts +10 -0
- package/lib/util/useMonacoShadowStyles.d.ts +2 -0
- package/package.json +110 -3
- package/src/components/DynamicJSXRenderer.tsx +274 -0
- package/src/components/ExtendedJsonForms.tsx +329 -0
- package/src/components/GenericAdditionalProperties.tsx +362 -0
- package/src/components/InterpolatedText.tsx +114 -0
- package/src/components/RactiveTemplate.tsx +161 -0
- package/src/components/editorRendererTypes.ts +135 -0
- package/src/components/elementRender.ts +15 -0
- package/src/core/ajv.ts +177 -0
- package/src/core/ajvI18n/bg.ts +203 -0
- package/src/core/ajvI18n/index.ts +267 -0
- package/src/core/ajvI18n/localizers.ts +25 -0
- package/src/core/dynamicDefaults.ts +170 -0
- package/src/core/keywords.ts +71 -0
- package/src/core/transform.ts +137 -0
- package/src/core/uiSchema.ts +53 -0
- package/src/index.tsx +196 -0
- package/src/locale/bg.ts +51 -0
- package/src/renderers/AgGridControlRenderer.impl.tsx +788 -0
- package/src/renderers/AgGridControlRenderer.tsx +24 -0
- package/src/renderers/ButtonRenderer.tsx +328 -0
- package/src/renderers/GenericMixedRenderer.tsx +224 -0
- package/src/renderers/HorizontalLayoutRenderer.tsx +93 -0
- package/src/renderers/ImageViewRenderer.tsx +328 -0
- package/src/renderers/LinkRenderer.tsx +92 -0
- package/src/renderers/MarkupLabelRenderer.impl.tsx +26 -0
- package/src/renderers/MarkupLabelRenderer.tsx +327 -0
- package/src/renderers/MonacoControlRenderer.impl.tsx +351 -0
- package/src/renderers/MonacoControlRenderer.tsx +24 -0
- package/src/renderers/RactiveTemplateLayoutRenderer.tsx +172 -0
- package/src/renderers/SeparatorRenderer.tsx +55 -0
- package/src/renderers/SlotRenderer.tsx +34 -0
- package/src/renderers/SpacerRenderer.tsx +69 -0
- package/src/renderers/SplitLayoutRenderer.tsx +220 -0
- package/src/renderers/TemplateLayoutRenderer.tsx +394 -0
- package/src/renderers/TemplateRenderer.tsx +71 -0
- package/src/renderers/TsxTemplateLayoutRenderer.tsx +258 -0
- package/src/renderers/index.ts +14 -0
- package/src/renderers/templateEngines.tsx +100 -0
- package/src/util/actionContext.ts +29 -0
- package/src/util/additionalErrors.tsx +391 -0
- package/src/util/celEnvironment.ts +300 -0
- package/src/util/celTemplate.ts +267 -0
- package/src/util/childNames.ts +135 -0
- package/src/util/configNamespaces.ts +6 -0
- package/src/util/cron.ts +433 -0
- package/src/util/editorControls.ts +58 -0
- package/src/util/editorDiagnostics.ts +103 -0
- package/src/util/extendedControls.ts +34 -0
- package/src/util/extendedLocale.ts +67 -0
- package/src/util/fileFilterValue.ts +28 -0
- package/src/util/formContext.ts +74 -0
- package/src/util/gridColumns.ts +80 -0
- package/src/util/horizontalLayout.ts +59 -0
- package/src/util/i18nDefaults.ts +80 -0
- package/src/util/interpolate.ts +218 -0
- package/src/util/labelFilterValue.ts +49 -0
- package/src/util/lazyControl.tsx +66 -0
- package/src/util/lazyTemplate.tsx +110 -0
- package/src/util/markdown.tsx +345 -0
- package/src/util/markdownEscape.ts +29 -0
- package/src/util/markup.ts +144 -0
- package/src/util/maskControls.ts +6 -0
- package/src/util/templateLang.ts +145 -0
- package/src/util/templateUrls.ts +274 -0
- package/src/util/urlPolicy.ts +115 -0
- package/src/util/useCronPicker.ts +102 -0
- package/src/util/useDurationControl.ts +272 -0
- package/src/util/useEditorAppearance.ts +86 -0
- package/src/util/useExtendedTranslator.ts +25 -0
- package/src/util/useMonacoShadowStyles.ts +47 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LayoutProps, RankedTester } from '@jsonforms/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const spacerRendererTester: RankedTester;
|
|
4
|
+
export declare const SpacerRendererComponent: ({ uischema, visible }: LayoutProps) => React.JSX.Element | null;
|
|
5
|
+
export declare const SpacerRenderer: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LayoutProps, RankedTester, UISchemaElement } from '@jsonforms/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const sharedSplitLayoutTester: RankedTester;
|
|
4
|
+
export declare const splitCssSize: (value: unknown) => string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* The initial share of each pane.
|
|
7
|
+
*
|
|
8
|
+
* "Initial sizes use normal sizing" - so a pane's `options.layout.weight`
|
|
9
|
+
* decides its share, exactly as it would in an ordinary layout, and equal
|
|
10
|
+
* shares are what Auto produces rather than a rule of their own.
|
|
11
|
+
*
|
|
12
|
+
* "Span SHOULD NOT be used" with a splitter, so it is ignored here; a pane
|
|
13
|
+
* asking for one falls back to Auto rather than being sized against a grid
|
|
14
|
+
* that a draggable pane does not have.
|
|
15
|
+
*/
|
|
16
|
+
export declare const initialSplitSizes: (elements: UISchemaElement[]) => number[];
|
|
17
|
+
export declare const SharedSplitLayout: (props: LayoutProps) => React.JSX.Element | null;
|
|
18
|
+
export declare const SharedSplitLayoutRenderer: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LayoutProps, RankedTester } from '@jsonforms/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { TemplateLayoutElement } from '../util/templateLang';
|
|
4
|
+
export interface TemplateLayoutProps extends LayoutProps {
|
|
5
|
+
uischema: TemplateLayoutElement;
|
|
6
|
+
components?: Record<string, React.ComponentType<any>>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Default tester for a template layout.
|
|
10
|
+
* @type {RankedTester}
|
|
11
|
+
*/
|
|
12
|
+
export declare const templateRendererTester: RankedTester;
|
|
13
|
+
export declare const TemplateLayoutRenderer: ({ path, enabled, schema, uischema, visible, renderers, cells, config, components, }: TemplateLayoutProps) => React.JSX.Element | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LayoutProps, RankedTester, UISchemaElement } from '@jsonforms/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ExtendedUISchemaElement } from '../core/uiSchema';
|
|
4
|
+
/**
|
|
5
|
+
* Kept as an alias so existing imports still resolve; the type itself is the
|
|
6
|
+
* project-wide one, since `name` belongs to every element rather than to
|
|
7
|
+
* templates. See `core/uiSchema`.
|
|
8
|
+
*/
|
|
9
|
+
export type NamedElement = ExtendedUISchemaElement & {
|
|
10
|
+
elements?: UISchemaElement[];
|
|
11
|
+
};
|
|
12
|
+
export type TemplateSlots = Record<string, UISchemaElement>;
|
|
13
|
+
export declare const TemplateSlotsContext: React.Context<TemplateSlots>;
|
|
14
|
+
export declare const hasTemplateName: (uischema: UISchemaElement) => boolean;
|
|
15
|
+
export declare const namedTemplateTester: RankedTester;
|
|
16
|
+
export declare const TemplateRendererComponent: (props: LayoutProps) => React.JSX.Element | null;
|
|
17
|
+
export declare const TemplateRenderer: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { JsonSchema, LayoutProps, RankedTester, Translator } from '@jsonforms/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ExtendedUISchemaElement } from '../core/uiSchema';
|
|
4
|
+
import { type FormContext } from '../util/formContext';
|
|
5
|
+
import { UrlPolicy } from '../util/urlPolicy';
|
|
6
|
+
import type { TemplateLayoutElement } from '../util/templateLang';
|
|
7
|
+
/**
|
|
8
|
+
* A `TemplateLayout` whose template is a **function**, not a string.
|
|
9
|
+
*
|
|
10
|
+
* The same element, authored in TypeScript instead of serialized. Nothing is
|
|
11
|
+
* compiled from a string, so there is no parser and - importantly - **no
|
|
12
|
+
* `allowScriptEvaluation`**: the permission exists because string evaluation
|
|
13
|
+
* needs CSP `unsafe-eval`, and a function the build already compiled needs
|
|
14
|
+
* nothing of the sort. A TSX template is strictly the safer of the two forms.
|
|
15
|
+
*
|
|
16
|
+
* It is not portable, and that is the deal: a function cannot be serialized,
|
|
17
|
+
* so a form carrying one cannot be sent over the wire. The portable
|
|
18
|
+
* `TemplateLayoutElement.template` stays a `string`; only the React-specific
|
|
19
|
+
* `ReactTemplateLayoutElement` widens it.
|
|
20
|
+
*/
|
|
21
|
+
/** What a `Slot` receives. `children` is the fallback, per section 13. */
|
|
22
|
+
export interface SlotProps {
|
|
23
|
+
name: string;
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Everything a TSX template is handed.
|
|
28
|
+
*
|
|
29
|
+
* Deliberately close to what the string engines expose, so the three forms
|
|
30
|
+
* stay one idea - plus the pieces a function can actually use: the element
|
|
31
|
+
* definitions for inspection, a guarded write, and the layout's own schema
|
|
32
|
+
* and path.
|
|
33
|
+
*/
|
|
34
|
+
export interface TemplateRenderProps<T = unknown> {
|
|
35
|
+
/** The whole form's data, as the string engines' `data` binding. */
|
|
36
|
+
data: T;
|
|
37
|
+
/** Where this layout sits, for addressing a write. */
|
|
38
|
+
path: string;
|
|
39
|
+
/** Core schema errors, unfiltered. */
|
|
40
|
+
errors: unknown[];
|
|
41
|
+
/** The schema at this layout's path. */
|
|
42
|
+
schema: JsonSchema;
|
|
43
|
+
/** This element, for its own `options`. */
|
|
44
|
+
uischema: TemplateLayoutElement;
|
|
45
|
+
/**
|
|
46
|
+
* The child **elements**, by name - the definitions, not rendered output.
|
|
47
|
+
* Read `.type`, `.scope`, `.options`, or reach a layout's own `.elements`.
|
|
48
|
+
*/
|
|
49
|
+
elements: Record<string, ExtendedUISchemaElement>;
|
|
50
|
+
/** Places a named child, with optional fallback content. */
|
|
51
|
+
Slot: (props: SlotProps) => React.ReactElement | null;
|
|
52
|
+
/** False when the form or this subtree is disabled or read-only. */
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* True when the form is read-only.
|
|
56
|
+
*
|
|
57
|
+
* Distinct from `enabled` on purpose. A read-only form sets `enabled` to
|
|
58
|
+
* false as well, but the two mean different things to a widget: *disabled*
|
|
59
|
+
* is "not available right now", *read-only* is "display this, do not edit
|
|
60
|
+
* it" - and the second often wants text rather than a greyed-out input.
|
|
61
|
+
*/
|
|
62
|
+
readonly: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Writes through the normal change dispatch.
|
|
65
|
+
*
|
|
66
|
+
* Section 13 requires that a template's two-way binding "must not bypass
|
|
67
|
+
* readonly/restrict or normal form change dispatch", so this is a no-op
|
|
68
|
+
* while `enabled` is false. It does **not** know about `restrict`, which is
|
|
69
|
+
* per-renderer and has no shared guard a layout can consult - a template can
|
|
70
|
+
* still write past an array's `maxItems`. Recorded rather than pretended
|
|
71
|
+
* away.
|
|
72
|
+
*/
|
|
73
|
+
handleChange: (path: string, value: unknown) => void;
|
|
74
|
+
translate: Translator;
|
|
75
|
+
/**
|
|
76
|
+
* Section 12's URL policy, resolved from the form's config.
|
|
77
|
+
*
|
|
78
|
+
* **This profile has to apply it itself**, and that is not an oversight.
|
|
79
|
+
* The string engines route every element through a `createElement` pragma
|
|
80
|
+
* this package owns, so an `href` carrying `javascript:` is dropped before
|
|
81
|
+
* the element exists. A TSX template is compiled by the *build*, with
|
|
82
|
+
* React's own pragma, and there is nothing to intercept.
|
|
83
|
+
*
|
|
84
|
+
* The distinction is real: a string template is **data** and may arrive with
|
|
85
|
+
* the form; a TSX template is **code** in this repository, which can already
|
|
86
|
+
* do anything. What is still data either way is the *value* - so a template
|
|
87
|
+
* writing `href={data.url}` should pass it through
|
|
88
|
+
* `isAllowedUrl(url, urlPolicy)` first, which is why the policy is handed
|
|
89
|
+
* over here rather than left to be imported and resolved again.
|
|
90
|
+
*/
|
|
91
|
+
urlPolicy: UrlPolicy;
|
|
92
|
+
/** Section 3's `FormContext`, in full. */
|
|
93
|
+
context: FormContext;
|
|
94
|
+
}
|
|
95
|
+
export type TemplateRender<T = unknown> = (props: TemplateRenderProps<T>) => React.ReactNode;
|
|
96
|
+
/** The React-only element: `template` may be a function here. */
|
|
97
|
+
export type ReactTemplateLayoutElement<T = unknown> = Omit<TemplateLayoutElement, 'template'> & {
|
|
98
|
+
template: string | TemplateRender<T>;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Selected by the **shape of `template`**, not by `lang`.
|
|
102
|
+
*
|
|
103
|
+
* A function is not written in a template language, so routing it through
|
|
104
|
+
* `lang` would be the wrong axis - and it must win over the string engines,
|
|
105
|
+
* which a shared `uiTypeIs('TemplateLayout')` alone would not guarantee.
|
|
106
|
+
*/
|
|
107
|
+
export declare const tsxTemplateLayoutTester: RankedTester;
|
|
108
|
+
export declare const TsxTemplateLayoutRendererComponent: (props: LayoutProps & {
|
|
109
|
+
uischema: ReactTemplateLayoutElement;
|
|
110
|
+
}) => React.JSX.Element | null;
|
|
111
|
+
export declare const TsxTemplateLayoutRenderer: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './TemplateLayoutRenderer';
|
|
2
|
+
export * from './TsxTemplateLayoutRenderer';
|
|
3
|
+
export * from './ButtonRenderer';
|
|
4
|
+
export * from './GenericMixedRenderer';
|
|
5
|
+
export * from './TemplateRenderer';
|
|
6
|
+
export * from './SlotRenderer';
|
|
7
|
+
export * from './SpacerRenderer';
|
|
8
|
+
export * from './ImageViewRenderer';
|
|
9
|
+
export * from './SeparatorRenderer';
|
|
10
|
+
export * from './HorizontalLayoutRenderer';
|
|
11
|
+
export * from './SplitLayoutRenderer';
|
|
12
|
+
export * from './LinkRenderer';
|
|
13
|
+
export * from './MarkupLabelRenderer';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { RankedTester, UISchemaElement } from '@jsonforms/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { TemplateLang } from '../util/templateLang';
|
|
4
|
+
/**
|
|
5
|
+
* Selecting a template engine, and refusing to run one.
|
|
6
|
+
*
|
|
7
|
+
* A `TemplateLayout` is dispatched to a renderer per **language**, so each
|
|
8
|
+
* engine is an ordinary registry entry with its own tester rather than a
|
|
9
|
+
* branch inside one component. The tester is where the choice belongs: a
|
|
10
|
+
* `TesterContext` carries the form-wide `config`, which is what
|
|
11
|
+
* `defaultTemplateLang` lives in.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* A tester for one engine.
|
|
15
|
+
*
|
|
16
|
+
* Deliberately does **not** consult `allowScriptEvaluation`. A tester that
|
|
17
|
+
* returned `-1` for a disabled host would leave the element unmatched and the
|
|
18
|
+
* form silent; the specification asks for the opposite - "report
|
|
19
|
+
* unsupported/evaluation-disabled behavior instead". So the renderer is still
|
|
20
|
+
* selected, and it explains itself.
|
|
21
|
+
*/
|
|
22
|
+
export declare const templateLangTester: (lang: TemplateLang) => RankedTester;
|
|
23
|
+
/**
|
|
24
|
+
* The fallback for a `TemplateLayout` no engine claimed.
|
|
25
|
+
*
|
|
26
|
+
* "Unknown or unsupported languages must be diagnosed rather than interpreted
|
|
27
|
+
* as another engine." Ranked below the engines, so it only wins when the
|
|
28
|
+
* resolution produced no supported language.
|
|
29
|
+
*/
|
|
30
|
+
export declare const unsupportedTemplateLangTester: RankedTester;
|
|
31
|
+
export interface TemplateDiagnosticProps {
|
|
32
|
+
uischema: UISchemaElement;
|
|
33
|
+
config?: unknown;
|
|
34
|
+
visible?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Says why a template is not being rendered, in place of rendering it.
|
|
38
|
+
*
|
|
39
|
+
* Both reasons are reported the same way and neither is an error state the
|
|
40
|
+
* form can recover from by itself: one is an authoring mistake, the other a
|
|
41
|
+
* deliberate host policy.
|
|
42
|
+
*/
|
|
43
|
+
export declare const TemplateDiagnostic: ({ uischema, config, visible, }: TemplateDiagnosticProps) => React.JSX.Element | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UISchemaElement } from '@jsonforms/core';
|
|
3
|
+
export type ActionEvent = {
|
|
4
|
+
action: string;
|
|
5
|
+
label: string;
|
|
6
|
+
/**
|
|
7
|
+
* `params` from the element, passed through untouched.
|
|
8
|
+
*
|
|
9
|
+
* Section 14 makes this a top-level field on `Button`, and it is how one
|
|
10
|
+
* command serves several buttons - `setLocale` with `{ "locale": "bg" }`
|
|
11
|
+
* rather than a `setLocaleBg` action per language.
|
|
12
|
+
*/
|
|
13
|
+
params?: Record<string, unknown>;
|
|
14
|
+
/** The UI schema element that triggered the action. */
|
|
15
|
+
element: UISchemaElement;
|
|
16
|
+
/**
|
|
17
|
+
* The JSON Forms context, reachable from a `script` as `this.context`.
|
|
18
|
+
*/
|
|
19
|
+
context?: unknown;
|
|
20
|
+
};
|
|
21
|
+
export type HandleAction = (event: ActionEvent) => void | Promise<void>;
|
|
22
|
+
export declare const HandleActionContext: React.Context<HandleAction | undefined>;
|
|
23
|
+
export declare const useHandleAction: () => HandleAction | undefined;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Middleware } from '@jsonforms/core';
|
|
3
|
+
import type { ErrorObject } from 'ajv';
|
|
4
|
+
export interface PublishOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Drop these errors when the value at their `instancePath` changes.
|
|
7
|
+
* Default true.
|
|
8
|
+
*/
|
|
9
|
+
clearOnChange?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Stable code, so a host can grep for it. */
|
|
12
|
+
export declare const NO_STORE_DIAGNOSTIC = "additionalErrors.noStore";
|
|
13
|
+
export interface AdditionalErrorStore {
|
|
14
|
+
/**
|
|
15
|
+
* True for the placeholder a renderer gets outside a provider.
|
|
16
|
+
*
|
|
17
|
+
* A renderer that was *asked* to publish - Monaco with `propagateErrors` on
|
|
18
|
+
* - can then say so instead of going quiet, which is the difference between
|
|
19
|
+
* a host learning it forgot the wiring and a host concluding the option
|
|
20
|
+
* does not work.
|
|
21
|
+
*/
|
|
22
|
+
readonly inert?: boolean;
|
|
23
|
+
/** Replaces everything this owner had published. An empty list retracts. */
|
|
24
|
+
publish: (owner: string, errors: ErrorObject[], options?: PublishOptions) => void;
|
|
25
|
+
/** Retracts one owner's errors. */
|
|
26
|
+
clear: (owner: string) => void;
|
|
27
|
+
/** Retracts everything - a fresh submit, for instance. */
|
|
28
|
+
clearAll: () => void;
|
|
29
|
+
/** Everything published, in publication order. */
|
|
30
|
+
all: () => ErrorObject[];
|
|
31
|
+
/** Called after any change; returns an unsubscribe. */
|
|
32
|
+
subscribe: (listener: () => void) => () => void;
|
|
33
|
+
/** Hand this to `<JsonForms middleware={…} />`. */
|
|
34
|
+
middleware: Middleware;
|
|
35
|
+
}
|
|
36
|
+
export declare const createAdditionalErrorStore: () => AdditionalErrorStore;
|
|
37
|
+
/** Which owner an error belongs to, or undefined for a host-supplied one. */
|
|
38
|
+
export declare const additionalErrorOwner: (error: ErrorObject) => string | undefined;
|
|
39
|
+
export declare const AdditionalErrorStoreProvider: ({ store, children, }: {
|
|
40
|
+
store: AdditionalErrorStore;
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
}) => React.JSX.Element;
|
|
43
|
+
/**
|
|
44
|
+
* The store for the enclosing form, or an inert one.
|
|
45
|
+
*
|
|
46
|
+
* Inert rather than throwing, because a renderer must not require the host to
|
|
47
|
+
* have wired anything: publication is what a host opts into, and a renderer
|
|
48
|
+
* that also shows its diagnostic locally keeps doing so either way.
|
|
49
|
+
*/
|
|
50
|
+
export declare const useAdditionalErrorStore: () => AdditionalErrorStore;
|
|
51
|
+
/**
|
|
52
|
+
* Publishes one owner's errors for as long as the component is mounted.
|
|
53
|
+
*
|
|
54
|
+
* Republished when the content changes, and **retracted on unmount** - an
|
|
55
|
+
* error left behind by a control that is no longer on the form would make it
|
|
56
|
+
* invalid with nothing on screen to explain why.
|
|
57
|
+
*/
|
|
58
|
+
export declare const useOwnedAdditionalErrors: (owner: string, errors: ErrorObject[], options?: PublishOptions) => void;
|
|
59
|
+
/** Everything published, re-rendering the caller when it changes. */
|
|
60
|
+
export declare const useAdditionalErrors: () => ErrorObject[];
|
|
61
|
+
/**
|
|
62
|
+
* Read by `ExtendedJsonForms`, which is how a form should install a store.
|
|
63
|
+
*
|
|
64
|
+
* There is no `useAdditionalErrorProps` for a host assembling `<JsonForms>`
|
|
65
|
+
* itself, and that is deliberate: delivering published errors through the
|
|
66
|
+
* `additionalErrors` **prop** undoes the edit that provoked them.
|
|
67
|
+
* `JsonFormsStateProvider` lists the prop in an effect's dependencies and
|
|
68
|
+
* re-dispatches `updateCore(data, …)` with the prop data of that render, while
|
|
69
|
+
* a renderer publishes from its own effect - which runs before the parent's
|
|
70
|
+
* `onChange` has told the host about the edit. The re-dispatch then carries
|
|
71
|
+
* the previous data.
|
|
72
|
+
*
|
|
73
|
+
* `ExtendedJsonForms` composes JSON Forms' own provider so it can dispatch
|
|
74
|
+
* from **inside**, where the data comes from core and is current by
|
|
75
|
+
* construction. A host that needs to assemble the form itself should copy that
|
|
76
|
+
* arrangement rather than reach for the prop.
|
|
77
|
+
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluates one expression against a scope.
|
|
3
|
+
*
|
|
4
|
+
* Every name in the scope is declared as `dyn`, which is what an untyped
|
|
5
|
+
* evaluation already gives: measured against this library's own
|
|
6
|
+
* `evaluate()`, a `dyn` declaration accepts everything it accepts and refuses
|
|
7
|
+
* the same things - including `seats + 1`, where CEL will not mix a
|
|
8
|
+
* double-typed value with an integer literal. (`seats + 1.0` works.) So the
|
|
9
|
+
* typed environment costs nothing and is what makes the formatting functions
|
|
10
|
+
* reachable.
|
|
11
|
+
*
|
|
12
|
+
* Declaring the names also keeps the refusal: an identifier that is not in
|
|
13
|
+
* the scope is an error rather than a silent `undefined`.
|
|
14
|
+
*
|
|
15
|
+
* **The repair runs only after the one failure it fixes.** Data is read as
|
|
16
|
+
* it arrives, so the ordinary path converts nothing; an object carrying a
|
|
17
|
+
* `constructor` key is rebuilt as maps and the expression is tried once
|
|
18
|
+
* more. Converting up front would mean walking the whole form's data on
|
|
19
|
+
* every label of every render to serve a case almost no schema has.
|
|
20
|
+
*/
|
|
21
|
+
/** The form's translator, as JSON Forms supplies it. */
|
|
22
|
+
export type Translate = (key: string, defaultMessage?: string) => string | undefined;
|
|
23
|
+
export declare const evaluateWith: (expression: string, scope: Record<string, unknown>, locale: string | undefined, translate?: Translate) => unknown;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Translate } from './celEnvironment';
|
|
2
|
+
import { TemplateSegment } from './interpolate';
|
|
3
|
+
export interface TemplateResult {
|
|
4
|
+
text: string;
|
|
5
|
+
/** One per expression that could not be rendered. Never thrown. */
|
|
6
|
+
failures: string[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders the segments, substituting each expression's value.
|
|
10
|
+
*
|
|
11
|
+
* `escape` is applied to **substituted values only**, never to the literal
|
|
12
|
+
* segments. That distinction is the whole security property when the result
|
|
13
|
+
* is about to be parsed as Markdown: a value containing
|
|
14
|
+
* `[click](javascript:alert(1))` has to render as those characters, while the
|
|
15
|
+
* author's own `**bold**` in the surrounding literal must still work.
|
|
16
|
+
* Escaping the finished string would break the second; escaping nothing would
|
|
17
|
+
* break the first. It is also why the template is split into segments rather
|
|
18
|
+
* than evaluated with a regex replace.
|
|
19
|
+
*
|
|
20
|
+
* An expression that throws does not take the label down: it contributes
|
|
21
|
+
* empty text and a failure, and the caller decides what to show.
|
|
22
|
+
*/
|
|
23
|
+
export declare const renderTemplate: (segments: TemplateSegment[], scope: Record<string, unknown>, escape?: (text: string) => string, locale?: string, translate?: Translate) => TemplateResult;
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the declared `textParams` against the namespaces.
|
|
26
|
+
*
|
|
27
|
+
* This is the **only** place the form's data is read. A parameter's value is
|
|
28
|
+
* the right-hand side of a declaration in the UI schema, which is where
|
|
29
|
+
* knowledge of the data model belongs; the text it feeds knows only the
|
|
30
|
+
* parameter's name, which is what makes that text translatable.
|
|
31
|
+
*
|
|
32
|
+
* A value is treated as a template, so the same grammar applies one level
|
|
33
|
+
* down: `"Atlas"` is a literal, `"{data.plan}"` resolves, and
|
|
34
|
+
* `"Plan {data.plan}"` does both. A non-string value - a number, a boolean,
|
|
35
|
+
* an object to navigate with `{user.name}` - passes through untouched.
|
|
36
|
+
*
|
|
37
|
+
* Parameters see the namespaces and **not each other**. Allowing one to
|
|
38
|
+
* reference another would need an evaluation order and a cycle check, for a
|
|
39
|
+
* capability that an extra parameter already covers.
|
|
40
|
+
*
|
|
41
|
+
* Values are not escaped here. Escaping belongs to the moment a value is
|
|
42
|
+
* substituted into the text, because that is the string a parser will see.
|
|
43
|
+
*/
|
|
44
|
+
export declare const resolveTextParams: (raw: Record<string, unknown> | undefined, namespaceScope: Record<string, unknown>, locale?: string, translate?: Translate) => {
|
|
45
|
+
params: Record<string, unknown>;
|
|
46
|
+
failures: string[];
|
|
47
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ExtendedUISchemaElement } from '../core/uiSchema';
|
|
2
|
+
/**
|
|
3
|
+
* Addressing a template's children.
|
|
4
|
+
*
|
|
5
|
+
* Section 13: "each named child is available as a partial that mounts its
|
|
6
|
+
* delegated renderer. Unnamed children receive their decimal index as a
|
|
7
|
+
* fallback name."
|
|
8
|
+
*
|
|
9
|
+
* The fallback is where it gets interesting, and the section does not say what
|
|
10
|
+
* happens when the two collide. They can: a child explicitly named `"0"` wants
|
|
11
|
+
* the same key as the first child's index fallback. The previous
|
|
12
|
+
* implementation let whichever came last win the map, so the **other child was
|
|
13
|
+
* never placed at all** - no partial, no dispatch, no error. A control simply
|
|
14
|
+
* was not on the form, and nothing said why.
|
|
15
|
+
*
|
|
16
|
+
* The rule here: an explicit name always keeps its key, because the author
|
|
17
|
+
* asked for it. An index fallback applies **only if no explicit name has
|
|
18
|
+
* claimed that index**, and when one has, the unnamed child is reported as
|
|
19
|
+
* unaddressable rather than silently dropped or quietly given some other
|
|
20
|
+
* number no template would reference.
|
|
21
|
+
*/
|
|
22
|
+
export interface ResolvedChildNames {
|
|
23
|
+
/**
|
|
24
|
+
* One entry per child, in order. `undefined` means the child could not be
|
|
25
|
+
* given an address and no template can place it.
|
|
26
|
+
*/
|
|
27
|
+
names: (string | undefined)[];
|
|
28
|
+
/** Name to child index, for looking a child up from a template. */
|
|
29
|
+
byName: Record<string, number>;
|
|
30
|
+
/** Stable-coded messages for names that could not be assigned. */
|
|
31
|
+
diagnostics: string[];
|
|
32
|
+
}
|
|
33
|
+
export declare const resolveChildNames: (elements: readonly ExtendedUISchemaElement[] | undefined) => ResolvedChildNames;
|
|
34
|
+
export declare const ractiveTransitionAttributes: (template: string) => string[];
|
|
35
|
+
export declare function useNamedChildren(elements: ExtendedUISchemaElement[] | undefined): {
|
|
36
|
+
/**
|
|
37
|
+
* One entry per child, in order. `undefined` means the child could not be
|
|
38
|
+
* given an address and no template can place it.
|
|
39
|
+
*/
|
|
40
|
+
names: (string | undefined)[];
|
|
41
|
+
/** Name to child index, for looking a child up from a template. */
|
|
42
|
+
byName: Record<string, number>;
|
|
43
|
+
/** Stable-coded messages for names that could not be assigned. */
|
|
44
|
+
diagnostics: string[];
|
|
45
|
+
children: ExtendedUISchemaElement[];
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { JSONFORMS_EXTENDED_CONFIG_KEY, JSONFORMS_CONFIG_KEY, extendedConfig, resolveExtendedOption, } from '@chobantonov/jsonforms-react-renderer-common/core/configNamespaces';
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Six-field cron, read and written.
|
|
3
|
+
*
|
|
4
|
+
* **Six fields, not five and not seven**: `second minute hour day-of-month month day-of-week`.
|
|
5
|
+
* This is Spring's dialect — `org.springframework.scheduling.support.CronExpression`, which is
|
|
6
|
+
* also what Quartz-adjacent Java schedulers accept minus the year field. It is deliberately not
|
|
7
|
+
* Unix cron, which has no seconds, and not Quartz, which adds a seventh `year` field and ORs the
|
|
8
|
+
* two day fields. An expression written for one and read as the other schedules the wrong thing
|
|
9
|
+
* while looking correct, so the dialect is stated rather than guessed.
|
|
10
|
+
*
|
|
11
|
+
* Spring **ANDs** every field — `CronExpression.nextOrSame` applies them in sequence, with none of
|
|
12
|
+
* Quartz's OR special case — and `?` is its alias for `*`, allowed only in the two day fields.
|
|
13
|
+
*
|
|
14
|
+
* The model here is **one value set per field**, which is what lets the picker offer a list to
|
|
15
|
+
* choose from rather than a syntax to learn. A field that cannot be stated as a set — `L`, `W`,
|
|
16
|
+
* `#` — is left as the text it is, and the control edits that field as text. Nothing is lost and
|
|
17
|
+
* nothing is rewritten.
|
|
18
|
+
*/
|
|
19
|
+
/** A placeholder for an empty field: every fifteen minutes, on the minute. */
|
|
20
|
+
export declare const DEFAULT_CRON = "0 0/15 * * * *";
|
|
21
|
+
/** The six fields, in the order an expression writes them. */
|
|
22
|
+
export declare const CRON_FIELDS: readonly ["second", "minute", "hour", "dayOfMonth", "month", "dayOfWeek"];
|
|
23
|
+
export type CronField = (typeof CRON_FIELDS)[number];
|
|
24
|
+
/** Day-of-week names Spring accepts, in the order it numbers them. */
|
|
25
|
+
export declare const DAY_NAMES: readonly ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
|
|
26
|
+
/** Month names Spring accepts. `JAN` is 1, so this list is offset by one from its values. */
|
|
27
|
+
export declare const MONTH_NAMES: readonly ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
|
|
28
|
+
/**
|
|
29
|
+
* The range a field's **values** live in.
|
|
30
|
+
*
|
|
31
|
+
* Day-of-week stops at 6 although Spring also accepts `7` for Sunday: a set with two Sundays in it
|
|
32
|
+
* would offer the same day twice in the picker. `7` is folded to `0` on the way in and never
|
|
33
|
+
* written back out.
|
|
34
|
+
*/
|
|
35
|
+
export declare const FIELD_RANGE: Record<CronField, [number, number]>;
|
|
36
|
+
/** The six fields of an expression, or `undefined` when it does not have six. */
|
|
37
|
+
export declare function splitCron(expression: string): string[] | undefined;
|
|
38
|
+
/** A field's six parts joined back into an expression. */
|
|
39
|
+
export declare function joinCron(fields: readonly string[]): string;
|
|
40
|
+
/**
|
|
41
|
+
* The values one field selects, or `undefined` when it does not select a set.
|
|
42
|
+
*
|
|
43
|
+
* `undefined` is the honest answer for `L`, `W` and `#` — "the last weekday of the month" is not a
|
|
44
|
+
* list of days, and turning it into one would change what the schedule does. It is also the answer
|
|
45
|
+
* for anything malformed, which is what lets the caller tell a field it can offer choices for from
|
|
46
|
+
* one it has to leave as text.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseField(text: string, field: CronField): number[] | undefined;
|
|
49
|
+
/** One value as the picker shows it and the expression writes it: a name where the field has one. */
|
|
50
|
+
export declare function labelFor(value: number, field: CronField): string;
|
|
51
|
+
/**
|
|
52
|
+
* One field written as compactly as it can be said.
|
|
53
|
+
*
|
|
54
|
+
* Runs become ranges and an even spacing becomes a step, because that is how people write these
|
|
55
|
+
* and a list of every value is not readable at a glance. Named fields are written with their names
|
|
56
|
+
* and never with a step: a step on a name is not something every reader will be sure of, and the
|
|
57
|
+
* list it would save is three characters long.
|
|
58
|
+
*/
|
|
59
|
+
export declare function formatField(values: readonly number[], field: CronField): string;
|
|
60
|
+
/** Why this expression cannot be scheduled, as a message key, or `undefined` when it can. */
|
|
61
|
+
export declare function cronProblem(expression: string): string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* How often the schedule repeats — the coarsest thing it puts a condition on.
|
|
64
|
+
*
|
|
65
|
+
* This is what the picker asks first, because it decides which of the six fields are worth showing:
|
|
66
|
+
* a schedule that runs every hour has nothing to say about which day it is, and five dropdowns of
|
|
67
|
+
* "every" is a form that hides its own answer. Derived rather than stored, so an expression typed
|
|
68
|
+
* into the field opens on the period it actually describes.
|
|
69
|
+
*/
|
|
70
|
+
export type CronPeriod = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
|
|
71
|
+
/** Whether a field says anything at all, rather than standing for every value it could take. */
|
|
72
|
+
export declare function isEvery(text: string, field: CronField): boolean;
|
|
73
|
+
export declare function periodOf(fields: readonly string[]): CronPeriod;
|
|
74
|
+
/**
|
|
75
|
+
* The fields the picker shows for a period, coarsest first.
|
|
76
|
+
*
|
|
77
|
+
* Everything finer than the period, which is what "repeats every X" leaves to be decided. A period
|
|
78
|
+
* of `week` hides the day of the month, since naming both days would mean "the 5th, and only when
|
|
79
|
+
* it is a Monday" — legal under Spring's AND, and never what picking a weekday meant.
|
|
80
|
+
*/
|
|
81
|
+
export declare function fieldsForPeriod(period: CronPeriod): CronField[];
|
|
82
|
+
/**
|
|
83
|
+
* Whether two expressions schedule the same thing.
|
|
84
|
+
*
|
|
85
|
+
* The point is to **not write**. `0 0/15 * * * *` and its asterisk spelling select the same
|
|
86
|
+
* minutes, and `@daily` is `0 0 0 * * *`; opening the picker on one and pressing OK without
|
|
87
|
+
* touching anything must leave the field exactly as it was. Rewriting it would mark the field
|
|
88
|
+
* dirty on its own and quietly replace what a server sent — the same rule the duration control
|
|
89
|
+
* keeps for `P1DT0H` against `P1D`, and the one section 18 states as "existing data must not be
|
|
90
|
+
* silently normalized solely because the renderer is mounted".
|
|
91
|
+
*
|
|
92
|
+
* Compared as **values**, field by field, which is the only comparison that answers this: the two
|
|
93
|
+
* spellings are different strings and the same schedule. A field neither side can state as a set is
|
|
94
|
+
* compared as text, because two pieces of syntax this does not model are only known to agree when
|
|
95
|
+
* they are identical.
|
|
96
|
+
*/
|
|
97
|
+
export declare function sameExpression(left: string, right: string): boolean;
|
|
98
|
+
/** Every field standing for every value: what a picker opened on nothing has chosen so far. */
|
|
99
|
+
export declare const NOTHING_CHOSEN: readonly string[];
|
|
100
|
+
/**
|
|
101
|
+
* A period's fields with everything coarser than it standing down to every.
|
|
102
|
+
*
|
|
103
|
+
* The period is a **lens**, not data: it decides which rows are worth showing and nothing else, so
|
|
104
|
+
* this seeds nothing and selects nothing. The one thing it must do is drop the conditions the lens
|
|
105
|
+
* is about to hide — a monthly schedule switched to daily that kept its day of the month would
|
|
106
|
+
* still run once a month, with nothing on screen saying so, because the row that said it is gone.
|
|
107
|
+
*/
|
|
108
|
+
export declare function standDown(fields: readonly string[], period: CronPeriod): string[];
|
|
109
|
+
/**
|
|
110
|
+
* The time of day a choice implies, where it has not been said.
|
|
111
|
+
*
|
|
112
|
+
* Picking nine o'clock means **nine o'clock**, not every second of the hour after it — but in cron
|
|
113
|
+
* a field left alone means every value, so `* * 9 * * *` is 3600 executions and not one. So
|
|
114
|
+
* choosing a value pins the time fields below it that are still saying "every".
|
|
115
|
+
*
|
|
116
|
+
* Only downwards, only the time fields, and only when something was actually chosen. Clearing a
|
|
117
|
+
* field pins nothing, and the day and month fields are never filled in on someone's behalf: that
|
|
118
|
+
* would be the picker deciding which day the schedule runs, which is the question being asked.
|
|
119
|
+
* Every pin it does make is one selection away from being undone, so "every minute during the 9am
|
|
120
|
+
* hour" is still reachable — it is just no longer what picking an hour silently means.
|
|
121
|
+
*/
|
|
122
|
+
export declare function withTimeDefaults(fields: readonly string[], changed: CronField): string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const monacoControlTester: (uischema: import("@jsonforms/core").UISchemaElement, schema: import("@jsonforms/core").JsonSchema, context: import("@jsonforms/core").TesterContext) => number;
|
|
2
|
+
export declare const extendedAgGridTester: (uischema: import("@jsonforms/core").UISchemaElement, schema: import("@jsonforms/core").JsonSchema, context: import("@jsonforms/core").TesterContext) => number;
|
|
3
|
+
export declare const resolveEditorLanguage: (options: Record<string, any>, data: unknown) => string;
|
|
4
|
+
export declare const encodeEditorValue: (data: unknown, convert: boolean) => string;
|
|
5
|
+
export declare const decodeEditorValue: (value: string, convert: boolean) => {
|
|
6
|
+
valid: boolean;
|
|
7
|
+
value: unknown;
|
|
8
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ErrorObject } from 'ajv';
|
|
2
|
+
/**
|
|
3
|
+
* The one summary error an editor publishes, and when it publishes it.
|
|
4
|
+
*
|
|
5
|
+
* Section 21: "publish **at most one summary additionalError per editor
|
|
6
|
+
* instance**, regardless of the number of blocking diagnostics. Publish none
|
|
7
|
+
* when that editor has no error-level diagnostics."
|
|
8
|
+
*/
|
|
9
|
+
/** The keyword the specification names for this error. */
|
|
10
|
+
export declare const EDITOR_DIAGNOSTIC_KEYWORD = "editor.language";
|
|
11
|
+
/**
|
|
12
|
+
* Monaco's `MarkerSeverity.Error`.
|
|
13
|
+
*
|
|
14
|
+
* A plain number rather than an import: `monaco-editor` is loaded as a chunk
|
|
15
|
+
* by `@monaco-editor/react`, and importing the enum for one constant would
|
|
16
|
+
* pull the whole editor into any bundle that touches this module. The values
|
|
17
|
+
* are part of Monaco's public API - Hint 1, Info 2, Warning 4, Error 8.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MONACO_SEVERITY_ERROR = 8;
|
|
20
|
+
export interface EditorMarker {
|
|
21
|
+
severity?: number;
|
|
22
|
+
message?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Only error-level markers count. "Warnings … stay inside Monaco." */
|
|
25
|
+
export declare const countBlockingMarkers: (markers: EditorMarker[] | undefined) => number;
|
|
26
|
+
/**
|
|
27
|
+
* Whether this editor publishes into the form's additional errors.
|
|
28
|
+
*
|
|
29
|
+
* Resolution is element option, then namespaced form config.
|
|
30
|
+
*
|
|
31
|
+
* **The default is `false`, and the portable contract says `true`.** That is a
|
|
32
|
+
* deliberate divergence, recorded in adjustment 31: publishing turns a
|
|
33
|
+
* language-service diagnostic into something that can block a form, and this
|
|
34
|
+
* project's position is that a host opts into that rather than inheriting it.
|
|
35
|
+
* A form that wants the portable default sets the option once, form-wide.
|
|
36
|
+
*/
|
|
37
|
+
export declare const resolvePropagateErrors: (elementOptions: Record<string, unknown> | undefined, config: unknown) => boolean;
|
|
38
|
+
/** `a.b.0.c` - JSON Forms' path spelling - as the JSON Pointer `/a/b/0/c`. */
|
|
39
|
+
export declare const pointerFor: (path: string) => string;
|
|
40
|
+
export interface EditorSummaryInput {
|
|
41
|
+
/** Unique per editor instance, so two editors never overwrite each other. */
|
|
42
|
+
owner: string;
|
|
43
|
+
path: string;
|
|
44
|
+
language: string | undefined;
|
|
45
|
+
errorCount: number;
|
|
46
|
+
message: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The summary, in the AJV-compatible shape the specification gives.
|
|
50
|
+
*
|
|
51
|
+
* `params.owner` is the addition: several renderers may own errors at one
|
|
52
|
+
* path, so the host's registry needs to know whose is whose. Section 18 wants
|
|
53
|
+
* that metadata "in runtime integration state, outside business data and the
|
|
54
|
+
* authored UI schema", which an error's `params` is.
|
|
55
|
+
*/
|
|
56
|
+
export declare const editorSummaryError: ({ owner, path, language, errorCount, message, }: EditorSummaryInput) => ErrorObject;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const extendedColorTester: (uischema: import("@jsonforms/core").UISchemaElement, schema: import("@jsonforms/core").JsonSchema, context: import("@jsonforms/core").TesterContext) => number;
|
|
2
|
+
export declare const extendedDurationTester: (uischema: import("@jsonforms/core").UISchemaElement, schema: import("@jsonforms/core").JsonSchema, context: import("@jsonforms/core").TesterContext) => number;
|
|
3
|
+
export declare const extendedNullTester: (uischema: import("@jsonforms/core").UISchemaElement, schema: import("@jsonforms/core").JsonSchema, context: import("@jsonforms/core").TesterContext) => number;
|
|
4
|
+
export declare const colorPickerValue: (value: unknown) => string;
|