@qoretechnologies/reqraft 0.10.53 → 0.10.54-pr.115.g9bc96ed
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/.claude/CLAUDE.md +25 -0
- package/.tasks/INDEX.md +1 -0
- package/.tasks/STORY_NETWORK_ISOLATION.md +98 -0
- package/README.md +1 -1
- package/design/FORM_ENGINE_EXPRESSIONS.md +110 -0
- package/design/FORM_ENGINE_FIELD_MIGRATION.md +56 -1
- package/design/RENDER_EXPRESSION_TRANSPORT.md +76 -10
- package/design/SMART_EDITOR_UX.md +21 -0
- package/dist/components/dpqlEditor/DpqlEditor.d.ts.map +1 -1
- package/dist/components/dpqlEditor/DpqlEditor.js +3 -3
- package/dist/components/dpqlEditor/DpqlEditor.js.map +1 -1
- package/dist/components/dpqlEditor/dpqlHelpers.d.ts +6 -0
- package/dist/components/dpqlEditor/dpqlHelpers.d.ts.map +1 -1
- package/dist/components/dpqlEditor/dpqlHelpers.js +21 -2
- package/dist/components/dpqlEditor/dpqlHelpers.js.map +1 -1
- package/dist/components/dpqlEditor/dpqlProbe.d.ts +37 -0
- package/dist/components/dpqlEditor/dpqlProbe.d.ts.map +1 -0
- package/dist/components/dpqlEditor/dpqlProbe.js +203 -0
- package/dist/components/dpqlEditor/dpqlProbe.js.map +1 -0
- package/dist/components/dpqlEditor/dpqlTags.d.ts +8 -0
- package/dist/components/dpqlEditor/dpqlTags.d.ts.map +1 -1
- package/dist/components/dpqlEditor/dpqlTags.js +5 -1
- package/dist/components/dpqlEditor/dpqlTags.js.map +1 -1
- package/dist/components/dpqlEditor/index.d.ts +4 -0
- package/dist/components/dpqlEditor/index.d.ts.map +1 -1
- package/dist/components/dpqlEditor/index.js +5 -1
- package/dist/components/dpqlEditor/index.js.map +1 -1
- package/dist/components/dpqlEditor/types.d.ts +42 -2
- package/dist/components/dpqlEditor/types.d.ts.map +1 -1
- package/dist/components/dpqlEditor/types.js +0 -4
- package/dist/components/dpqlEditor/types.js.map +1 -1
- package/dist/components/dpqlEditor/useDpqlProbe.d.ts +4 -0
- package/dist/components/dpqlEditor/useDpqlProbe.d.ts.map +1 -0
- package/dist/components/dpqlEditor/useDpqlProbe.js +29 -0
- package/dist/components/dpqlEditor/useDpqlProbe.js.map +1 -0
- package/dist/components/dpqlEditor/useDpqlSession.d.ts +5 -2
- package/dist/components/dpqlEditor/useDpqlSession.d.ts.map +1 -1
- package/dist/components/dpqlEditor/useDpqlSession.js +8 -2
- package/dist/components/dpqlEditor/useDpqlSession.js.map +1 -1
- package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +192 -45
- package/dist/components/form/engine/CompactRow.js.map +1 -1
- package/dist/components/form/engine/CompactToolbar.d.ts.map +1 -1
- package/dist/components/form/engine/CompactToolbar.js +5 -2
- package/dist/components/form/engine/CompactToolbar.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +160 -12
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +376 -75
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/FormFieldsSkeleton.d.ts +48 -0
- package/dist/components/form/engine/FormFieldsSkeleton.d.ts.map +1 -0
- package/dist/components/form/engine/FormFieldsSkeleton.js +38 -0
- package/dist/components/form/engine/FormFieldsSkeleton.js.map +1 -0
- package/dist/components/form/engine/OptionFieldMessages.d.ts +17 -2
- package/dist/components/form/engine/OptionFieldMessages.d.ts.map +1 -1
- package/dist/components/form/engine/OptionFieldMessages.js +61 -11
- package/dist/components/form/engine/OptionFieldMessages.js.map +1 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts.map +1 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.js +7 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -1
- package/dist/components/form/engine/compactToolbarContext.d.ts +1 -0
- package/dist/components/form/engine/compactToolbarContext.d.ts.map +1 -1
- package/dist/components/form/engine/readFirst.d.ts +42 -1
- package/dist/components/form/engine/readFirst.d.ts.map +1 -1
- package/dist/components/form/engine/readFirst.js +74 -7
- package/dist/components/form/engine/readFirst.js.map +1 -1
- package/dist/components/form/engine/rendererTypes.d.ts +13 -0
- package/dist/components/form/engine/rendererTypes.d.ts.map +1 -1
- package/dist/components/form/engine/rendererTypes.js.map +1 -1
- package/dist/components/form/engine/rowMenuContext.d.ts +78 -0
- package/dist/components/form/engine/rowMenuContext.d.ts.map +1 -0
- package/dist/components/form/engine/rowMenuContext.js +103 -0
- package/dist/components/form/engine/rowMenuContext.js.map +1 -0
- package/dist/components/form/engine/typeChoices.d.ts +37 -0
- package/dist/components/form/engine/typeChoices.d.ts.map +1 -0
- package/dist/components/form/engine/typeChoices.js +25 -0
- package/dist/components/form/engine/typeChoices.js.map +1 -0
- package/dist/components/form/expressions/DpqlRendering.d.ts +26 -0
- package/dist/components/form/expressions/DpqlRendering.d.ts.map +1 -0
- package/dist/components/form/expressions/DpqlRendering.js +53 -0
- package/dist/components/form/expressions/DpqlRendering.js.map +1 -0
- package/dist/components/form/expressions/ExpressionField.d.ts +7 -1
- package/dist/components/form/expressions/ExpressionField.d.ts.map +1 -1
- package/dist/components/form/expressions/ExpressionField.js +202 -45
- package/dist/components/form/expressions/ExpressionField.js.map +1 -1
- package/dist/components/form/expressions/argumentPresence.d.ts +97 -0
- package/dist/components/form/expressions/argumentPresence.d.ts.map +1 -0
- package/dist/components/form/expressions/argumentPresence.js +203 -0
- package/dist/components/form/expressions/argumentPresence.js.map +1 -0
- package/dist/components/form/expressions/builder/argumentLabel.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/argumentLabel.js +9 -4
- package/dist/components/form/expressions/builder/argumentLabel.js.map +1 -1
- package/dist/components/form/expressions/builder/index.d.ts +15 -2
- package/dist/components/form/expressions/builder/index.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/index.js +20 -58
- package/dist/components/form/expressions/builder/index.js.map +1 -1
- package/dist/components/form/expressions/builder/renderTemplate.d.ts +4 -1
- package/dist/components/form/expressions/builder/renderTemplate.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/renderTemplate.js +10 -67
- package/dist/components/form/expressions/builder/renderTemplate.js.map +1 -1
- package/dist/components/form/expressions/dpqlMockLanguage.d.ts +76 -0
- package/dist/components/form/expressions/dpqlMockLanguage.d.ts.map +1 -0
- package/dist/components/form/expressions/dpqlMockLanguage.js +525 -0
- package/dist/components/form/expressions/dpqlMockLanguage.js.map +1 -0
- package/dist/components/form/expressions/dpqlMockLsp.d.ts +31 -2
- package/dist/components/form/expressions/dpqlMockLsp.d.ts.map +1 -1
- package/dist/components/form/expressions/dpqlMockLsp.js +86 -80
- package/dist/components/form/expressions/dpqlMockLsp.js.map +1 -1
- package/dist/components/form/expressions/mockExpressions.d.ts.map +1 -1
- package/dist/components/form/expressions/mockExpressions.js +8 -4
- package/dist/components/form/expressions/mockExpressions.js.map +1 -1
- package/dist/components/form/expressions/renderExpressionToText.d.ts +1 -1
- package/dist/components/form/expressions/renderExpressionToText.d.ts.map +1 -1
- package/dist/components/form/expressions/renderExpressionToText.js +95 -19
- package/dist/components/form/expressions/renderExpressionToText.js.map +1 -1
- package/dist/components/form/expressions/types.d.ts +7 -0
- package/dist/components/form/expressions/types.d.ts.map +1 -1
- package/dist/components/form/expressions/useRenderExpression.d.ts +7 -16
- package/dist/components/form/expressions/useRenderExpression.d.ts.map +1 -1
- package/dist/components/form/expressions/useRenderExpression.js +50 -126
- package/dist/components/form/expressions/useRenderExpression.js.map +1 -1
- package/dist/components/form/fields/Field.d.ts.map +1 -1
- package/dist/components/form/fields/Field.js +3 -1
- package/dist/components/form/fields/Field.js.map +1 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.d.ts +11 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.d.ts.map +1 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.js +14 -2
- package/dist/components/form/fields/allowed-values/AllowedValues.js.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.js +32 -8
- package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
- package/dist/components/form/fields/date/Date.d.ts +1 -1
- package/dist/components/form/fields/date/Date.d.ts.map +1 -1
- package/dist/components/form/fields/date/Date.js +16 -2
- package/dist/components/form/fields/date/Date.js.map +1 -1
- package/dist/components/form/fields/rich-text/RichText.d.ts +21 -1
- package/dist/components/form/fields/rich-text/RichText.d.ts.map +1 -1
- package/dist/components/form/fields/rich-text/RichText.js +140 -8
- package/dist/components/form/fields/rich-text/RichText.js.map +1 -1
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts +2 -1
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts.map +1 -1
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.js +3 -2
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.js.map +1 -1
- package/dist/components/form/fields/template/TemplateField.d.ts +31 -1
- package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
- package/dist/components/form/fields/template/TemplateField.js +528 -50
- package/dist/components/form/fields/template/TemplateField.js.map +1 -1
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +1 -0
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/smartEditor/SmartEditor.d.ts.map +1 -1
- package/dist/components/smartEditor/SmartEditor.js +29 -8
- package/dist/components/smartEditor/SmartEditor.js.map +1 -1
- package/dist/components/smartEditor/__fixtures__/mockLspServer.d.ts +8 -0
- package/dist/components/smartEditor/__fixtures__/mockLspServer.d.ts.map +1 -1
- package/dist/components/smartEditor/__fixtures__/mockLspServer.js +53 -10
- package/dist/components/smartEditor/__fixtures__/mockLspServer.js.map +1 -1
- package/dist/components/smartEditor/useLspSession.d.ts +5 -1
- package/dist/components/smartEditor/useLspSession.d.ts.map +1 -1
- package/dist/components/smartEditor/useLspSession.js +16 -2
- package/dist/components/smartEditor/useLspSession.js.map +1 -1
- package/dist/helpers/dpqlDetection.d.ts +58 -0
- package/dist/helpers/dpqlDetection.d.ts.map +1 -0
- package/dist/helpers/dpqlDetection.js +164 -0
- package/dist/helpers/dpqlDetection.js.map +1 -0
- package/dist/helpers/optionUiTypes.d.ts +3 -3
- package/dist/helpers/options.d.ts +37 -0
- package/dist/helpers/options.d.ts.map +1 -1
- package/dist/helpers/options.js +78 -1
- package/dist/helpers/options.js.map +1 -1
- package/dist/helpers/templateItems.d.ts +47 -0
- package/dist/helpers/templateItems.d.ts.map +1 -0
- package/dist/helpers/templateItems.js +88 -0
- package/dist/helpers/templateItems.js.map +1 -0
- package/dist/helpers/templateText.d.ts +37 -0
- package/dist/helpers/templateText.d.ts.map +1 -0
- package/dist/helpers/templateText.js +64 -0
- package/dist/helpers/templateText.js.map +1 -0
- package/dist/helpers/templates.d.ts +19 -11
- package/dist/helpers/templates.d.ts.map +1 -1
- package/dist/helpers/templates.js +46 -29
- package/dist/helpers/templates.js.map +1 -1
- package/dist/helpers/validations.d.ts.map +1 -1
- package/dist/helpers/validations.js +56 -9
- package/dist/helpers/validations.js.map +1 -1
- package/dist/hooks/useArgSchema.d.ts +2 -1
- package/dist/hooks/useArgSchema.d.ts.map +1 -1
- package/dist/hooks/useFetch/useFetch.d.ts +3 -1
- package/dist/hooks/useFetch/useFetch.d.ts.map +1 -1
- package/dist/hooks/useFetch/useFetch.js +47 -9
- package/dist/hooks/useFetch/useFetch.js.map +1 -1
- package/dist/hooks/useTemplates.d.ts +20 -0
- package/dist/hooks/useTemplates.d.ts.map +1 -1
- package/dist/hooks/useTemplates.js +34 -2
- package/dist/hooks/useTemplates.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/stories/storyNetwork.d.ts +36 -0
- package/dist/stories/storyNetwork.d.ts.map +1 -0
- package/dist/stories/storyNetwork.js +82 -0
- package/dist/stories/storyNetwork.js.map +1 -0
- package/dist/utils/fetch.d.ts +151 -1
- package/dist/utils/fetch.d.ts.map +1 -1
- package/dist/utils/fetch.js +256 -44
- package/dist/utils/fetch.js.map +1 -1
- package/dist/utils/lspClient.d.ts +6 -0
- package/dist/utils/lspClient.d.ts.map +1 -1
- package/dist/utils/lspClient.js +62 -11
- package/dist/utils/lspClient.js.map +1 -1
- package/dist/utils/websocket.d.ts +6 -0
- package/dist/utils/websocket.d.ts.map +1 -1
- package/dist/utils/websocket.js +15 -7
- package/dist/utils/websocket.js.map +1 -1
- package/package.json +2 -2
- package/src/components/dpqlEditor/DpqlEditor.stories.tsx +3 -119
- package/src/components/dpqlEditor/DpqlEditor.tsx +5 -2
- package/src/components/dpqlEditor/dpqlHelpers.ts +20 -1
- package/src/components/dpqlEditor/dpqlProbe.ts +165 -0
- package/src/components/dpqlEditor/dpqlTags.ts +13 -0
- package/src/components/dpqlEditor/index.ts +4 -0
- package/src/components/dpqlEditor/types.ts +38 -2
- package/src/components/dpqlEditor/useDpqlProbe.ts +33 -0
- package/src/components/dpqlEditor/useDpqlSession.ts +20 -4
- package/src/components/form/engine/CompactRow.tsx +240 -51
- package/src/components/form/engine/CompactToolbar.tsx +10 -3
- package/src/components/form/engine/FormEngine.stories.tsx +423 -120
- package/src/components/form/engine/FormEngine.tsx +504 -87
- package/src/components/form/engine/FormFieldsSkeleton.tsx +76 -0
- package/src/components/form/engine/OptionFieldMessages.tsx +89 -11
- package/src/components/form/engine/_structuredData/SchemaDataView.tsx +11 -0
- package/src/components/form/engine/compactToolbarContext.ts +1 -1
- package/src/components/form/engine/readFirst.ts +86 -7
- package/src/components/form/engine/rendererTypes.ts +12 -0
- package/src/components/form/engine/rowMenuContext.ts +159 -0
- package/src/components/form/engine/typeChoices.ts +55 -0
- package/src/components/form/expressions/DpqlRendering.tsx +85 -0
- package/src/components/form/expressions/ExpressionField.stories.tsx +826 -48
- package/src/components/form/expressions/ExpressionField.tsx +265 -54
- package/src/components/form/expressions/argumentPresence.ts +200 -0
- package/src/components/form/expressions/builder/ExpressionBuilder.stories.tsx +20 -4
- package/src/components/form/expressions/builder/argumentLabel.tsx +10 -4
- package/src/components/form/expressions/builder/index.tsx +39 -77
- package/src/components/form/expressions/builder/renderTemplate.tsx +23 -56
- package/src/components/form/expressions/dpqlMockLanguage.ts +565 -0
- package/src/components/form/expressions/dpqlMockLsp.ts +109 -83
- package/src/components/form/expressions/mockExpressions.ts +8 -4
- package/src/components/form/expressions/renderExpressionToText.ts +112 -22
- package/src/components/form/expressions/types.ts +7 -0
- package/src/components/form/expressions/useRenderExpression.ts +43 -127
- package/src/components/form/fields/Field.tsx +3 -2
- package/src/components/form/fields/allowed-values/AllowedValues.tsx +13 -2
- package/src/components/form/fields/auto/AutoFormField.stories.tsx +27 -20
- package/src/components/form/fields/auto/AutoFormField.tsx +33 -9
- package/src/components/form/fields/date/Date.tsx +17 -1
- package/src/components/form/fields/rich-text/RichText.tsx +199 -22
- package/src/components/form/fields/template/ReadOnlyTemplateTag.tsx +4 -2
- package/src/components/form/fields/template/TemplateField.stories.tsx +31 -9
- package/src/components/form/fields/template/TemplateField.tsx +714 -122
- package/src/components/form/index.tsx +1 -0
- package/src/components/log/Log.stories.tsx +2 -1
- package/src/components/smartEditor/SmartEditor.tsx +41 -9
- package/src/components/smartEditor/__fixtures__/mockLspServer.ts +52 -3
- package/src/components/smartEditor/useLspSession.ts +21 -3
- package/src/helpers/dpqlDetection.ts +209 -0
- package/src/helpers/options.ts +70 -0
- package/src/helpers/templateItems.ts +81 -0
- package/src/helpers/templateText.ts +92 -0
- package/src/helpers/templates.ts +47 -37
- package/src/helpers/validations.ts +59 -9
- package/src/hooks/useFetch/useFetch.stories.tsx +6 -5
- package/src/hooks/useFetch/useFetch.tsx +53 -7
- package/src/hooks/useStorage/useStorage.stories.tsx +2 -1
- package/src/hooks/useTemplates.ts +41 -0
- package/src/hooks/useWebSocket/useWebsocket.stories.tsx +2 -1
- package/src/index.tsx +14 -1
- package/src/stores/currentUser/currentUser.stories.tsx +2 -1
- package/src/stories/storyNetwork.ts +92 -0
- package/src/utils/fetch.ts +311 -21
- package/src/utils/lspClient.ts +68 -11
- package/src/utils/websocket.ts +20 -9
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IReqoreDropdownItem } from '@qoretechnologies/reqore/dist/components/Dropdown/list';
|
|
3
|
+
/**
|
|
4
|
+
* SEAM (reqraft): an editor publishes its own actions into the row's ⋮ menu.
|
|
5
|
+
*
|
|
6
|
+
* A row already renders one overflow menu — Edit fullscreen, Remove field, and
|
|
7
|
+
* any `optionActions` the host injected — and the comment on it has always said
|
|
8
|
+
* why: *"this row already has a menu, so they reuse it rather than adding a
|
|
9
|
+
* second one beside it."* An EDITOR could not reach that menu, so an editor
|
|
10
|
+
* with affordances of its own had no choice but to draw a second ⋮ inside the
|
|
11
|
+
* value cell. The IDE's template field does exactly that, and the two menus
|
|
12
|
+
* ended up side by side on one control, at slightly different widths.
|
|
13
|
+
*
|
|
14
|
+
* `optionActions` does not solve it: that seam is host configuration, resolved
|
|
15
|
+
* from the option's name and schema before the editor exists, so it cannot know
|
|
16
|
+
* what the editor can offer *now* — whether its templates have loaded, whether
|
|
17
|
+
* the value is already an expression, which custom items the field was given.
|
|
18
|
+
*
|
|
19
|
+
* ## Why registration is keyed, and by whom
|
|
20
|
+
*
|
|
21
|
+
* Menu items carry `onClick` handlers, so they are a new array on every render
|
|
22
|
+
* and cannot be compared by value. An editor therefore publishes a `key`
|
|
23
|
+
* alongside them: a primitive describing WHICH items it is currently offering
|
|
24
|
+
* (`'expression,template'`). The row re-renders only when a publisher's key
|
|
25
|
+
* changes, so a re-rendering editor cannot drive the row into a state loop.
|
|
26
|
+
*
|
|
27
|
+
* Each registration also belongs to ONE publisher. A single shared slot let
|
|
28
|
+
* two publishers in the same row — an expression builder's operands — overwrite
|
|
29
|
+
* each other's key on every render, which re-rendered the row and both of them,
|
|
30
|
+
* which published again: a synchronous render loop that froze the page. And a
|
|
31
|
+
* slot that outlived its editor kept that editor's handlers after it unmounted,
|
|
32
|
+
* so a row closed and reopened offered items that did nothing. Registrations
|
|
33
|
+
* are therefore per publisher, withdrawn on unmount, and a click always reaches
|
|
34
|
+
* the handler from the publisher's latest render.
|
|
35
|
+
*
|
|
36
|
+
* Publish with `useRowMenuPublisher`; provide with `useRowMenuRegistry`.
|
|
37
|
+
*/
|
|
38
|
+
export interface IRowMenuRegistration {
|
|
39
|
+
/**
|
|
40
|
+
* Publish a publisher's menu items into the containing row's ⋮.
|
|
41
|
+
*
|
|
42
|
+
* @param publisherId identifies the publishing editor (one per mounted editor)
|
|
43
|
+
* @param key a primitive describing which items are being offered; the row
|
|
44
|
+
* re-renders only when it changes
|
|
45
|
+
* @param items the items to merge, or an empty array to contribute none
|
|
46
|
+
*/
|
|
47
|
+
registerRowMenuItems: (publisherId: string, key: string, items: IReqoreDropdownItem[]) => void;
|
|
48
|
+
/** Withdraw a publisher's items — when it unmounts or leaves the row. */
|
|
49
|
+
unregisterRowMenuItems: (publisherId: string) => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Absent outside a compact row — the classic (non-compact) render path has no
|
|
53
|
+
* row menu to merge into, and an editor there keeps drawing its own control.
|
|
54
|
+
*/
|
|
55
|
+
export declare const RowMenuContext: import("react").Context<IRowMenuRegistration>;
|
|
56
|
+
/**
|
|
57
|
+
* The row-menu channel for the row this editor is inside, or `undefined` when
|
|
58
|
+
* there is no row menu to publish into.
|
|
59
|
+
*
|
|
60
|
+
* An editor that finds it should render no menu of its own; one that does not
|
|
61
|
+
* must keep rendering its own, or its actions become unreachable.
|
|
62
|
+
*/
|
|
63
|
+
export declare const useRowMenu: () => IRowMenuRegistration | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Publish `items` into `rowMenu` for as long as the calling editor is mounted.
|
|
66
|
+
* `rowMenu` is passed rather than read here so an editor can claim the channel
|
|
67
|
+
* and hide it from what it renders (see `TemplateField`).
|
|
68
|
+
*/
|
|
69
|
+
export declare const useRowMenuPublisher: (rowMenu: IRowMenuRegistration | undefined, key: string, items: IReqoreDropdownItem[]) => void;
|
|
70
|
+
/**
|
|
71
|
+
* The row side of the channel: the registration to provide, and the items the
|
|
72
|
+
* row's ⋮ should list.
|
|
73
|
+
*/
|
|
74
|
+
export declare const useRowMenuRegistry: () => {
|
|
75
|
+
rowMenu: IRowMenuRegistration;
|
|
76
|
+
items: IReqoreDropdownItem[];
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=rowMenuContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rowMenuContext.d.ts","sourceRoot":"","sources":["../../../../src/components/form/engine/rowMenuContext.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAY7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,oBAAoB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,IAAI,CAAC;IAC/F,yEAAyE;IACzE,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,+CAA6D,CAAC;AAEzF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,QAAO,oBAAoB,GAAG,SAAuC,CAAC;AAE7F;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,YACrB,oBAAoB,GAAG,SAAS,OACpC,MAAM,SACJ,mBAAmB,EAAE,KAC3B,IAQF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAO;IACpC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,KAAK,EAAE,mBAAmB,EAAE,CAAC;CAwD9B,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.useRowMenuRegistry = exports.useRowMenuPublisher = exports.useRowMenu = exports.RowMenuContext = void 0;
|
|
24
|
+
var react_1 = require("react");
|
|
25
|
+
/**
|
|
26
|
+
* Absent outside a compact row — the classic (non-compact) render path has no
|
|
27
|
+
* row menu to merge into, and an editor there keeps drawing its own control.
|
|
28
|
+
*/
|
|
29
|
+
exports.RowMenuContext = (0, react_1.createContext)(undefined);
|
|
30
|
+
/**
|
|
31
|
+
* The row-menu channel for the row this editor is inside, or `undefined` when
|
|
32
|
+
* there is no row menu to publish into.
|
|
33
|
+
*
|
|
34
|
+
* An editor that finds it should render no menu of its own; one that does not
|
|
35
|
+
* must keep rendering its own, or its actions become unreachable.
|
|
36
|
+
*/
|
|
37
|
+
var useRowMenu = function () { return (0, react_1.useContext)(exports.RowMenuContext); };
|
|
38
|
+
exports.useRowMenu = useRowMenu;
|
|
39
|
+
/**
|
|
40
|
+
* Publish `items` into `rowMenu` for as long as the calling editor is mounted.
|
|
41
|
+
* `rowMenu` is passed rather than read here so an editor can claim the channel
|
|
42
|
+
* and hide it from what it renders (see `TemplateField`).
|
|
43
|
+
*/
|
|
44
|
+
var useRowMenuPublisher = function (rowMenu, key, items) {
|
|
45
|
+
var publisherId = (0, react_1.useId)();
|
|
46
|
+
(0, react_1.useEffect)(function () {
|
|
47
|
+
rowMenu === null || rowMenu === void 0 ? void 0 : rowMenu.registerRowMenuItems(publisherId, key, items);
|
|
48
|
+
}, [rowMenu, publisherId, key, items]);
|
|
49
|
+
(0, react_1.useEffect)(function () { return function () { return rowMenu === null || rowMenu === void 0 ? void 0 : rowMenu.unregisterRowMenuItems(publisherId); }; }, [rowMenu, publisherId]);
|
|
50
|
+
};
|
|
51
|
+
exports.useRowMenuPublisher = useRowMenuPublisher;
|
|
52
|
+
/**
|
|
53
|
+
* The row side of the channel: the registration to provide, and the items the
|
|
54
|
+
* row's ⋮ should list.
|
|
55
|
+
*/
|
|
56
|
+
var useRowMenuRegistry = function () {
|
|
57
|
+
// Which publishers are offering which item SET — the only state, so only a
|
|
58
|
+
// change of set re-renders the row.
|
|
59
|
+
var _a = (0, react_1.useState)({}), keys = _a[0], setKeys = _a[1];
|
|
60
|
+
// Each publisher's items from its latest render, read at click time.
|
|
61
|
+
var latest = (0, react_1.useRef)({});
|
|
62
|
+
var registerRowMenuItems = (0, react_1.useCallback)(function (publisherId, key, items) {
|
|
63
|
+
latest.current[publisherId] = items;
|
|
64
|
+
setKeys(function (previous) {
|
|
65
|
+
var _a;
|
|
66
|
+
return previous[publisherId] === key ? previous : __assign(__assign({}, previous), (_a = {}, _a[publisherId] = key, _a));
|
|
67
|
+
});
|
|
68
|
+
}, []);
|
|
69
|
+
var unregisterRowMenuItems = (0, react_1.useCallback)(function (publisherId) {
|
|
70
|
+
delete latest.current[publisherId];
|
|
71
|
+
setKeys(function (previous) {
|
|
72
|
+
if (!(publisherId in previous)) {
|
|
73
|
+
return previous;
|
|
74
|
+
}
|
|
75
|
+
var next = __assign({}, previous);
|
|
76
|
+
delete next[publisherId];
|
|
77
|
+
return next;
|
|
78
|
+
});
|
|
79
|
+
}, []);
|
|
80
|
+
var rowMenu = (0, react_1.useMemo)(function () { return ({ registerRowMenuItems: registerRowMenuItems, unregisterRowMenuItems: unregisterRowMenuItems }); }, [registerRowMenuItems, unregisterRowMenuItems]);
|
|
81
|
+
var items = (0, react_1.useMemo)(function () {
|
|
82
|
+
return Object.keys(keys).flatMap(function (publisherId) {
|
|
83
|
+
var _a;
|
|
84
|
+
return ((_a = latest.current[publisherId]) !== null && _a !== void 0 ? _a : []).map(function (item, index) {
|
|
85
|
+
return item.onClick
|
|
86
|
+
? __assign(__assign({}, item), {
|
|
87
|
+
// Same key, same item set, so the index still names this item;
|
|
88
|
+
// the handler is whatever the publisher rendered last.
|
|
89
|
+
onClick: (function () {
|
|
90
|
+
var _a, _b, _c;
|
|
91
|
+
var args = [];
|
|
92
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
93
|
+
args[_i] = arguments[_i];
|
|
94
|
+
}
|
|
95
|
+
return (_c = (_b = (_a = latest.current[publisherId]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.onClick) === null || _c === void 0 ? void 0 : _c.call.apply(_c, __spreadArray([_b], args, false));
|
|
96
|
+
}) }) : item;
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}, [keys]);
|
|
100
|
+
return { rowMenu: rowMenu, items: items };
|
|
101
|
+
};
|
|
102
|
+
exports.useRowMenuRegistry = useRowMenuRegistry;
|
|
103
|
+
//# sourceMappingURL=rowMenuContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rowMenuContext.js","sourceRoot":"","sources":["../../../../src/components/form/engine/rowMenuContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,+BASe;AAmDf;;;GAGG;AACU,QAAA,cAAc,GAAG,IAAA,qBAAa,EAAmC,SAAS,CAAC,CAAC;AAEzF;;;;;;GAMG;AACI,IAAM,UAAU,GAAG,cAAwC,OAAA,IAAA,kBAAU,EAAC,sBAAc,CAAC,EAA1B,CAA0B,CAAC;AAAhF,QAAA,UAAU,cAAsE;AAE7F;;;;GAIG;AACI,IAAM,mBAAmB,GAAG,UACjC,OAAyC,EACzC,GAAW,EACX,KAA4B;IAE5B,IAAM,WAAW,GAAG,IAAA,aAAK,GAAE,CAAC;IAE5B,IAAA,iBAAS,EAAC;QACR,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,oBAAoB,CAAC,WAAW,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IAEvC,IAAA,iBAAS,EAAC,cAAM,OAAA,cAAM,OAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,sBAAsB,CAAC,WAAW,CAAC,EAA5C,CAA4C,EAAlD,CAAkD,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;AAC9F,CAAC,CAAC;AAZW,QAAA,mBAAmB,uBAY9B;AAEF;;;GAGG;AACI,IAAM,kBAAkB,GAAG;IAIhC,2EAA2E;IAC3E,oCAAoC;IAC9B,IAAA,KAAkB,IAAA,gBAAQ,EAAyB,EAAE,CAAC,EAArD,IAAI,QAAA,EAAE,OAAO,QAAwC,CAAC;IAC7D,qEAAqE;IACrE,IAAM,MAAM,GAAG,IAAA,cAAM,EAAwC,EAAE,CAAC,CAAC;IAEjE,IAAM,oBAAoB,GAAG,IAAA,mBAAW,EACtC,UAAC,WAAmB,EAAE,GAAW,EAAE,KAA4B;QAC7D,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC;QACpC,OAAO,CAAC,UAAC,QAAQ;;YACf,OAAA,QAAQ,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,uBAAM,QAAQ,gBAAG,WAAW,IAAG,GAAG,MAAE;QAA9E,CAA8E,CAC/E,CAAC;IACJ,CAAC,EACD,EAAE,CACH,CAAC;IAEF,IAAM,sBAAsB,GAAG,IAAA,mBAAW,EAAC,UAAC,WAAmB;QAC7D,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACnC,OAAO,CAAC,UAAC,QAAQ;YACf,IAAI,CAAC,CAAC,WAAW,IAAI,QAAQ,CAAC,EAAE,CAAC;gBAC/B,OAAO,QAAQ,CAAC;YAClB,CAAC;YACD,IAAM,IAAI,gBAAQ,QAAQ,CAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAM,OAAO,GAAG,IAAA,eAAO,EACrB,cAAM,OAAA,CAAC,EAAE,oBAAoB,sBAAA,EAAE,sBAAsB,wBAAA,EAAE,CAAC,EAAlD,CAAkD,EACxD,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAC/C,CAAC;IAEF,IAAM,KAAK,GAAG,IAAA,eAAO,EACnB;QACE,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAC,WAAW;;YACpC,OAAA,CAAC,MAAA,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,IAAI,EAAE,KAAK;gBAClD,OAAA,IAAI,CAAC,OAAO;oBACV,CAAC,uBACM,IAAI;wBACP,+DAA+D;wBAC/D,uDAAuD;wBACvD,OAAO,EAAE,CAAC;;4BAAC,cAAkB;iCAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;gCAAlB,yBAAkB;;4BAC3B,OAAA,MAAC,MAAA,MAAA,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,0CAAG,KAAK,CAAC,0CAAE,OAEzB,6EAAM,IAAI,SAAC,CAAA;yBAAA,CAAmC,IAElE,CAAC,CAAC,IAAI;YAVR,CAUQ,CACT,CAAA;SAAA,CACF;IAdD,CAcC,EACH,CAAC,IAAI,CAAC,CACP,CAAC;IAEF,OAAO,EAAE,OAAO,SAAA,EAAE,KAAK,OAAA,EAAE,CAAC;AAC5B,CAAC,CAAC;AA1DW,QAAA,kBAAkB,sBA0D7B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which options offer the per-type choices ("Integer", "Text", "Hash", …) in
|
|
3
|
+
* the row's menu.
|
|
4
|
+
*
|
|
5
|
+
* A field that pins no concrete type has to give the author some way to say
|
|
6
|
+
* what kind of value they mean, and the row menu is where that lives — the
|
|
7
|
+
* alternative, a standalone *"Please select data type"* control, replaces a
|
|
8
|
+
* typable field with a pick-only one.
|
|
9
|
+
*
|
|
10
|
+
* The rule was `ui_type === 'any'`, which is one of the three ways a schema
|
|
11
|
+
* says "untyped", so the choices went missing on the other two:
|
|
12
|
+
*
|
|
13
|
+
* - **`type: 'auto'` with no `ui_type` at all.** This is how the server
|
|
14
|
+
* declares an assertion's Expected Value, so that field never offered them.
|
|
15
|
+
* They appeared only inside an expression, where the OPERAND's schema does
|
|
16
|
+
* say `ui_type: 'any'` — so the same option offered them in the Visual view
|
|
17
|
+
* and not in the Text view, which reads as the menu losing items.
|
|
18
|
+
* - **A host's own untyped editor.** The IDE renders Expected Value through
|
|
19
|
+
* `test-reference`, a `ui_type` reqraft knows nothing about; the field is no
|
|
20
|
+
* less untyped for having a custom editor.
|
|
21
|
+
*
|
|
22
|
+
* `ui_type` is asked FIRST and on its own: a schema that names a concrete
|
|
23
|
+
* editor (`ui_type: 'string'`) has pinned the field even if its storage `type`
|
|
24
|
+
* is still `auto`.
|
|
25
|
+
*/
|
|
26
|
+
import { IQorusFormField } from '@qoretechnologies/ts-toolkit';
|
|
27
|
+
/** The spellings that mean "no concrete type" wherever they appear. */
|
|
28
|
+
export declare const BuiltInAnyLikeTypes: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Does this option leave its type up to the author?
|
|
31
|
+
*
|
|
32
|
+
* @param option the option's schema entry
|
|
33
|
+
* @param extraUiTypes host `ui_type` names that are untyped editors of their
|
|
34
|
+
* own — see `FormEngine`'s `anyLikeUiTypes`
|
|
35
|
+
*/
|
|
36
|
+
export declare const offersTypeChoices: (option: Partial<IQorusFormField> | undefined, extraUiTypes?: string[]) => boolean;
|
|
37
|
+
//# sourceMappingURL=typeChoices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeChoices.d.ts","sourceRoot":"","sources":["../../../../src/components/form/engine/typeChoices.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,UAAkB,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,WACpB,QAAQ,eAAe,CAAC,GAAG,SAAS,iBAC7B,MAAM,EAAE,KACtB,OAaF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.offersTypeChoices = exports.BuiltInAnyLikeTypes = void 0;
|
|
4
|
+
/** The spellings that mean "no concrete type" wherever they appear. */
|
|
5
|
+
exports.BuiltInAnyLikeTypes = ['any', 'auto'];
|
|
6
|
+
/**
|
|
7
|
+
* Does this option leave its type up to the author?
|
|
8
|
+
*
|
|
9
|
+
* @param option the option's schema entry
|
|
10
|
+
* @param extraUiTypes host `ui_type` names that are untyped editors of their
|
|
11
|
+
* own — see `FormEngine`'s `anyLikeUiTypes`
|
|
12
|
+
*/
|
|
13
|
+
var offersTypeChoices = function (option, extraUiTypes) {
|
|
14
|
+
if (!option) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
var uiType = option.ui_type;
|
|
18
|
+
if (uiType) {
|
|
19
|
+
return exports.BuiltInAnyLikeTypes.includes(uiType) || !!(extraUiTypes === null || extraUiTypes === void 0 ? void 0 : extraUiTypes.includes(uiType));
|
|
20
|
+
}
|
|
21
|
+
// No `ui_type`: the storage type is the only thing that can pin the field.
|
|
22
|
+
return exports.BuiltInAnyLikeTypes.includes(option.type);
|
|
23
|
+
};
|
|
24
|
+
exports.offersTypeChoices = offersTypeChoices;
|
|
25
|
+
//# sourceMappingURL=typeChoices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeChoices.js","sourceRoot":"","sources":["../../../../src/components/form/engine/typeChoices.ts"],"names":[],"mappings":";;;AA4BA,uEAAuE;AAC1D,QAAA,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAEnD;;;;;;GAMG;AACI,IAAM,iBAAiB,GAAG,UAC/B,MAA4C,EAC5C,YAAuB;IAEvB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAM,MAAM,GAAI,MAA+B,CAAC,OAAO,CAAC;IAExD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,2BAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,CAAC,MAAM,CAAC,CAAA,CAAC;IAClF,CAAC;IAED,2EAA2E;IAC3E,OAAO,2BAAmB,CAAC,QAAQ,CAAE,MAA4B,CAAC,IAAc,CAAC,CAAC;AACpF,CAAC,CAAC;AAhBW,QAAA,iBAAiB,qBAgB5B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IReqoreFormTemplates } from '@qoretechnologies/reqore/dist/components/Textarea';
|
|
2
|
+
import { IExpressionValue } from './types';
|
|
3
|
+
export interface IDpqlRenderingProps {
|
|
4
|
+
/** DPQL, or a readable rendering of it, to show. */
|
|
5
|
+
text: string;
|
|
6
|
+
/** The surface's template catalogue: a reference in it reads as its name. */
|
|
7
|
+
templates?: IReqoreFormTemplates;
|
|
8
|
+
'data-testid'?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Shows `text` as DPQL: monospace, server-coloured, references as chips. */
|
|
11
|
+
export declare const DpqlRendering: ({ text, templates, "data-testid": testId }: IDpqlRenderingProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export interface IExpressionRenderingProps {
|
|
13
|
+
/** The expression AST to render. */
|
|
14
|
+
expression: IExpressionValue;
|
|
15
|
+
/** The surface's template catalogue: a reference in it reads as its name. */
|
|
16
|
+
templates?: IReqoreFormTemplates;
|
|
17
|
+
'data-testid'?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The server's readable rendering of `expression`, shown through
|
|
21
|
+
* `DpqlRendering`. It waits for the server — in the form's one waiting shape —
|
|
22
|
+
* and says so plainly if the server cannot render, rather than showing an
|
|
23
|
+
* approximation that reads like the real thing.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ExpressionRendering: ({ expression, templates, "data-testid": testId, }: IExpressionRenderingProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=DpqlRendering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DpqlRendering.d.ts","sourceRoot":"","sources":["../../../../src/components/form/expressions/DpqlRendering.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAIzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAK3C,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,6EAA6E;AAC7E,eAAO,MAAM,aAAa,+CAAgD,mBAAmB,4CAiB5F,CAAC;AAEF,MAAM,WAAW,yBAAyB;IACxC,oCAAoC;IACpC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,6EAA6E;IAC7E,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,sDAI7B,yBAAyB,4CAiB3B,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpressionRendering = exports.DpqlRendering = void 0;
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
// Copyright 2026 Qore Technologies, s.r.o.
|
|
6
|
+
// How a DPQL expression is shown when it is shown but not edited.
|
|
7
|
+
//
|
|
8
|
+
// ONE rendering for every read-only place an expression appears — the Explain
|
|
9
|
+
// panel, the Text view's Preview, the conversion a type-fit message suggests,
|
|
10
|
+
// a collapsed expression row — so they read the same everywhere: monospace,
|
|
11
|
+
// coloured by the language server's semantic tokens (the canonical tokenizer,
|
|
12
|
+
// see `useLspSemanticTokens`), template references as chips. Before, the same
|
|
13
|
+
// expression could be highlighted in one place, plain proportional text in the
|
|
14
|
+
// next and a bare `<code>` in a third, depending only on which component
|
|
15
|
+
// happened to draw it.
|
|
16
|
+
var reqore_1 = require("@qoretechnologies/reqore");
|
|
17
|
+
var react_use_1 = require("react-use");
|
|
18
|
+
var dpqlEditor_1 = require("../../dpqlEditor");
|
|
19
|
+
var FormFieldsSkeleton_1 = require("../engine/FormFieldsSkeleton");
|
|
20
|
+
var useRenderExpression_1 = require("./useRenderExpression");
|
|
21
|
+
var noop = function () { return undefined; };
|
|
22
|
+
/** Shows `text` as DPQL: monospace, server-coloured, references as chips. */
|
|
23
|
+
var DpqlRendering = function (_a) {
|
|
24
|
+
var text = _a.text, templates = _a.templates, testId = _a["data-testid"];
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: 'dpql-rendering', "data-testid": testId, style: { width: '100%', minWidth: 0 }, children: (0, jsx_runtime_1.jsx)(dpqlEditor_1.DpqlEditor, { value: text, onChange: noop, readOnly: true,
|
|
26
|
+
// The text is a rendering, not something being written: nothing to
|
|
27
|
+
// diagnose, and a hover would describe tokens of a document nobody edits.
|
|
28
|
+
showDiagnostics: false, enableHover: false, templateTagsUseIntent: true, templates: templates,
|
|
29
|
+
// The text is already known; only its colours wait for the server, so
|
|
30
|
+
// nothing is hidden behind "Connecting to language server…".
|
|
31
|
+
loadingIndicator: null }) }));
|
|
32
|
+
};
|
|
33
|
+
exports.DpqlRendering = DpqlRendering;
|
|
34
|
+
/**
|
|
35
|
+
* The server's readable rendering of `expression`, shown through
|
|
36
|
+
* `DpqlRendering`. It waits for the server — in the form's one waiting shape —
|
|
37
|
+
* and says so plainly if the server cannot render, rather than showing an
|
|
38
|
+
* approximation that reads like the real thing.
|
|
39
|
+
*/
|
|
40
|
+
var ExpressionRendering = function (_a) {
|
|
41
|
+
var expression = _a.expression, templates = _a.templates, testId = _a["data-testid"];
|
|
42
|
+
var renderRich = (0, useRenderExpression_1.useRenderExpression)().renderRich;
|
|
43
|
+
var rendering = (0, react_use_1.useAsync)(function () { return renderRich(expression); }, [JSON.stringify(expression)]);
|
|
44
|
+
if (rendering.loading) {
|
|
45
|
+
return (0, jsx_runtime_1.jsx)(FormFieldsSkeleton_1.FormFieldsSkeleton, { rows: 1, reason: 'expression-rendering' });
|
|
46
|
+
}
|
|
47
|
+
if (!rendering.value) {
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { size: 'small', intent: 'muted', flat: true, opaque: false, "data-testid": testId, children: "This expression could not be rendered." }));
|
|
49
|
+
}
|
|
50
|
+
return (0, jsx_runtime_1.jsx)(exports.DpqlRendering, { text: rendering.value.text, templates: templates, "data-testid": testId });
|
|
51
|
+
};
|
|
52
|
+
exports.ExpressionRendering = ExpressionRendering;
|
|
53
|
+
//# sourceMappingURL=DpqlRendering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DpqlRendering.js","sourceRoot":"","sources":["../../../../src/components/form/expressions/DpqlRendering.tsx"],"names":[],"mappings":";;;;AAAA,2CAA2C;AAC3C,kEAAkE;AAClE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,yEAAyE;AACzE,uBAAuB;AACvB,mDAAyD;AAEzD,uCAAqC;AACrC,+CAA8C;AAC9C,mEAAkE;AAElE,6DAA4D;AAE5D,IAAM,IAAI,GAAG,cAAY,OAAA,SAAS,EAAT,CAAS,CAAC;AAUnC,6EAA6E;AACtE,IAAM,aAAa,GAAG,UAAC,EAA+D;QAA7D,IAAI,UAAA,EAAE,SAAS,eAAA,EAAiB,MAAM,oBAAA;IAA4B,OAAA,CAChG,gCAAK,SAAS,EAAC,gBAAgB,iBAAc,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,YACxF,uBAAC,uBAAU,IACT,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,IAAI,EACd,QAAQ;YACR,mEAAmE;YACnE,0EAA0E;YAC1E,eAAe,EAAE,KAAK,EACtB,WAAW,EAAE,KAAK,EAClB,qBAAqB,QACrB,SAAS,EAAE,SAAS;YACpB,sEAAsE;YACtE,6DAA6D;YAC7D,gBAAgB,EAAE,IAAI,GACtB,GACE,CACP;AAjBiG,CAiBjG,CAAC;AAjBW,QAAA,aAAa,iBAiBxB;AAUF;;;;;GAKG;AACI,IAAM,mBAAmB,GAAG,UAAC,EAIR;QAH1B,UAAU,gBAAA,EACV,SAAS,eAAA,EACM,MAAM,oBAAA;IAEb,IAAA,UAAU,GAAK,IAAA,yCAAmB,GAAE,WAA1B,CAA2B;IAC7C,IAAM,SAAS,GAAG,IAAA,oBAAQ,EAAC,cAAM,OAAA,UAAU,CAAC,UAAU,CAAC,EAAtB,CAAsB,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAEvF,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO,uBAAC,uCAAkB,IAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAC,sBAAsB,GAAG,CAAC;IACvE,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CACL,uBAAC,sBAAa,IAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAC,IAAI,QAAC,MAAM,EAAE,KAAK,iBAAe,MAAM,uDAElE,CACjB,CAAC;IACJ,CAAC;IAED,OAAO,uBAAC,qBAAa,IAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,iBAAe,MAAM,GAAI,CAAC;AAClG,CAAC,CAAC;AArBW,QAAA,mBAAmB,uBAqB9B"}
|
|
@@ -38,10 +38,16 @@ export interface IExpressionFieldProps {
|
|
|
38
38
|
recordType?: string;
|
|
39
39
|
/** Initial editor mode (default `visual`). */
|
|
40
40
|
defaultMode?: TExpressionMode;
|
|
41
|
+
/**
|
|
42
|
+
* SEAM (reqraft): the host's per-`ui_type` editors, forwarded to the
|
|
43
|
+
* builder's operand fields. Without them an operand typed with one of the
|
|
44
|
+
* CONSUMER's ui_types renders "Unknown type!".
|
|
45
|
+
*/
|
|
46
|
+
componentOverrides?: Record<string, React.FC<any>>;
|
|
41
47
|
size?: string;
|
|
42
48
|
/** Forwarded to the builder — operand reordering for varargs expressions. */
|
|
43
49
|
reorder?: TExpressionReorder;
|
|
44
50
|
}
|
|
45
|
-
export declare const ExpressionField: import("react").MemoExoticComponent<({ value, onChange, type, returnType, readOnly, expressions: expressionsOverride, expressionsUrl, localTemplates, serverHandled, extraActions, provider, recordType, defaultMode, size, reorder, }: IExpressionFieldProps) => import("react/jsx-runtime").JSX.Element>;
|
|
51
|
+
export declare const ExpressionField: import("react").MemoExoticComponent<({ value, onChange, type, returnType, readOnly, expressions: expressionsOverride, expressionsUrl, localTemplates, serverHandled, extraActions, provider, recordType, defaultMode, size, componentOverrides, reorder, }: IExpressionFieldProps) => import("react/jsx-runtime").JSX.Element>;
|
|
46
52
|
export default ExpressionField;
|
|
47
53
|
//# sourceMappingURL=ExpressionField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressionField.d.ts","sourceRoot":"","sources":["../../../../src/components/form/expressions/ExpressionField.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ExpressionField.d.ts","sourceRoot":"","sources":["../../../../src/components/form/expressions/ExpressionField.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAIzF,OAAO,EAAqB,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAoB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAI/F,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,CAAC;AAgBhD,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAClC,6EAA6E;IAC7E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,uEAAuE;IACvE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,uBAAuB,CAAC,cAAc,CAAC,CAAC;IACvD,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,eAAO,MAAM,eAAe,8PAkBvB,qBAAqB,6CAkYzB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|