@qoretechnologies/reqraft 0.10.78-pr.145.gca7df95 → 0.10.78-pr.145.gd4df77e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +26 -9
- package/dist/components/form/engine/CompactRow.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +13 -0
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +97 -41
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/OptionFieldMessages.js +1 -1
- package/dist/components/form/engine/cardHeaderPin.d.ts +59 -0
- package/dist/components/form/engine/cardHeaderPin.d.ts.map +1 -0
- package/dist/components/form/engine/cardHeaderPin.js +137 -0
- package/dist/components/form/engine/cardHeaderPin.js.map +1 -0
- package/dist/components/form/engine/compactRowContext.d.ts +10 -0
- package/dist/components/form/engine/compactRowContext.d.ts.map +1 -1
- package/dist/components/form/engine/compactRowContext.js.map +1 -1
- package/dist/components/form/engine/compactRowStyles.d.ts +2 -0
- package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
- package/dist/components/form/engine/compactRowStyles.js +52 -39
- package/dist/components/form/engine/compactRowStyles.js.map +1 -1
- package/dist/components/form/engine/revealRow.d.ts +7 -4
- package/dist/components/form/engine/revealRow.d.ts.map +1 -1
- package/dist/components/form/engine/revealRow.js +13 -7
- package/dist/components/form/engine/revealRow.js.map +1 -1
- package/dist/components/form/expressions/DpqlRendering.js +1 -1
- package/dist/components/form/expressions/DpqlRendering.js.map +1 -1
- package/dist/components/form/expressions/labels.js +5 -5
- package/dist/components/form/expressions/labels.js.map +1 -1
- package/dist/components/form/fields/schema-definition/labels.js +4 -4
- package/dist/components/form/fields/schema-definition/labels.js.map +1 -1
- package/dist/components/form/fields/template/TemplatePicker.d.ts.map +1 -1
- package/dist/components/form/fields/template/TemplatePicker.js +22 -13
- package/dist/components/form/fields/template/TemplatePicker.js.map +1 -1
- package/dist/components/smartEditor/completionStyle.d.ts +4 -4
- package/dist/components/smartEditor/completionStyle.d.ts.map +1 -1
- package/dist/components/smartEditor/completionStyle.js +12 -17
- package/dist/components/smartEditor/completionStyle.js.map +1 -1
- package/dist/components/smartEditor/types.d.ts +1 -1
- package/dist/helpers/reqraftLabels.js +8 -8
- package/dist/helpers/reqraftLabels.js.map +1 -1
- package/dist/helpers/templateItems.d.ts +13 -0
- package/dist/helpers/templateItems.d.ts.map +1 -1
- package/dist/helpers/templateItems.js +57 -1
- package/dist/helpers/templateItems.js.map +1 -1
- package/dist/helpers/templates.d.ts.map +1 -1
- package/dist/helpers/templates.js +4 -1
- package/dist/helpers/templates.js.map +1 -1
- package/dist/helpers/validationLabels.js +3 -3
- package/dist/helpers/validationLabels.js.map +1 -1
- package/dist/hooks/useEqualValue.d.ts +14 -0
- package/dist/hooks/useEqualValue.d.ts.map +1 -0
- package/dist/hooks/useEqualValue.js +27 -0
- package/dist/hooks/useEqualValue.js.map +1 -0
- package/dist/hooks/useTemplates.d.ts +0 -7
- package/dist/hooks/useTemplates.d.ts.map +1 -1
- package/dist/hooks/useTemplates.js +19 -8
- package/dist/hooks/useTemplates.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -128,6 +128,7 @@ var validations_1 = require("../../../helpers/validations");
|
|
|
128
128
|
var useCoarsePointer_1 = require("../../../hooks/useCoarsePointer");
|
|
129
129
|
var useQorusTypes_1 = require("../../../hooks/useQorusTypes");
|
|
130
130
|
var useTemplates_1 = require("../../../hooks/useTemplates");
|
|
131
|
+
var useEqualValue_1 = require("../../../hooks/useEqualValue");
|
|
131
132
|
var fetch_1 = require("../../../utils/fetch");
|
|
132
133
|
var queryUnlessCancelled_1 = require("../../../utils/queryUnlessCancelled");
|
|
133
134
|
var Description_1 = require("../../Description");
|
|
@@ -692,15 +693,21 @@ var FormEngineImpl = function (_a) {
|
|
|
692
693
|
// been a no-op. Removing it from the API is a separate, breaking change —
|
|
693
694
|
// every consumer passing it today already gets the flush layout by default.
|
|
694
695
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
695
|
-
compactFlush = _k === void 0 ? false : _k, _l = _a.compactNested, compactNested = _l === void 0 ? false : _l, _m = _a.compactScroll, compactScroll = _m === void 0 ? 'host' : _m, compactPanelProps = _a.compactPanelProps, compactCollapsedGroupsProp = _a.compactCollapsedGroups, compactBoxLabels = _a.compactBoxLabels, _o = _a.revealRequired, revealRequired = _o === void 0 ? false : _o, focusAttentionRequest = _a.focusAttentionRequest, onAttentionChange = _a.onAttentionChange, outsideAttention = _a.outsideAttention, _p = _a.compactStickyBoxHeaders, compactStickyBoxHeaders = _p === void 0 ? true : _p, _q = _a.
|
|
696
|
+
compactFlush = _k === void 0 ? false : _k, _l = _a.compactNested, compactNested = _l === void 0 ? false : _l, _m = _a.compactScroll, compactScroll = _m === void 0 ? 'host' : _m, compactPanelProps = _a.compactPanelProps, compactCollapsedGroupsProp = _a.compactCollapsedGroups, compactBoxLabels = _a.compactBoxLabels, _o = _a.revealRequired, revealRequired = _o === void 0 ? false : _o, focusAttentionRequest = _a.focusAttentionRequest, onAttentionChange = _a.onAttentionChange, outsideAttention = _a.outsideAttention, _p = _a.compactStickyBoxHeaders, compactStickyBoxHeaders = _p === void 0 ? true : _p, _q = _a.compactStickyCardHeaders, compactStickyCardHeaders = _q === void 0 ? true : _q, _r = _a.compactStickyOffset, compactStickyOffset = _r === void 0 ? 0 : _r, _s = _a.compactToolbar, compactToolbar = _s === void 0 ? true : _s, _t = _a.commitMode, commitMode = _t === void 0 ? 'immediate' : _t, _u = _a.expandMode, expandMode = _u === void 0 ? 'single' : _u, onCommit = _a.onCommit, operatorsProp = _a.operators, groups = _a.groups, optionsLoader = _a.optionsLoader, onValidityChange = _a.onValidityChange, optionActionsProp = _a.optionActions, _v = _a.optionActionsCollapse, optionActionsCollapse = _v === void 0 ? 'auto' : _v, componentOverridesProp = _a.componentOverrides, codePreviewRenderer = _a.codePreviewRenderer, readSummariesProp = _a.readSummaries, cardEditorTypesProp = _a.cardEditorTypes,
|
|
696
697
|
// consumed by the wrapper below, which publishes it to every description this
|
|
697
698
|
// form draws; destructured here only so it cannot reach `rest` and be spread
|
|
698
699
|
// onto a DOM node
|
|
699
700
|
_markdownRenderer = _a.markdownRenderer, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
700
701
|
rendererOnlyUiTypes = _a.rendererOnlyUiTypes, templateAwareUiTypes = _a.templateAwareUiTypes, anyLikeUiTypes = _a.anyLikeUiTypes, inheritedFromParent = _a.inheritedFromParent, autoFocusFirstRequired = _a.autoFocusFirstRequired, expandFirstRequired = _a.expandFirstRequired, initialExpandedOptions = _a.initialExpandedOptions, expandOptionsRequest = _a.expandOptionsRequest, valueKey = _a.valueKey, maxFieldsShown = _a.maxFieldsShown,
|
|
701
702
|
// The form's own props, read here and never handed on to the collection drawn below (`{...rest}`).
|
|
702
|
-
optionsSchema = _a.options, stringTemplates = _a.stringTemplates, skeletonReason = _a.skeletonReason, rest = __rest(_a, ["name", "uniqueName", "value", "onChange", "onSingleOptionsChange", "onDependableOptionChange", "placeholder", "noValueString", "isValid", "url", "customUrl", "operatorsUrl", "onOptionsLoaded", "recordRequiresSearchOptions", "readOnly", "onReadOnlyActivate", "allowTemplates", "interfaceContext", "templateFieldProps", "forceDropdown", "showTypeToggle", "compact", "appearance", "compactFlush", "compactNested", "compactScroll", "compactPanelProps", "compactCollapsedGroups", "compactBoxLabels", "revealRequired", "focusAttentionRequest", "onAttentionChange", "outsideAttention", "compactStickyBoxHeaders", "compactStickyOffset", "compactToolbar", "commitMode", "expandMode", "onCommit", "operators", "groups", "optionsLoader", "onValidityChange", "optionActions", "optionActionsCollapse", "componentOverrides", "codePreviewRenderer", "readSummaries", "cardEditorTypes", "markdownRenderer", "rendererOnlyUiTypes", "templateAwareUiTypes", "anyLikeUiTypes", "inheritedFromParent", "autoFocusFirstRequired", "expandFirstRequired", "initialExpandedOptions", "expandOptionsRequest", "valueKey", "maxFieldsShown", "options", "stringTemplates", "skeletonReason"]);
|
|
703
|
+
optionsSchema = _a.options, stringTemplates = _a.stringTemplates, skeletonReason = _a.skeletonReason, rest = __rest(_a, ["name", "uniqueName", "value", "onChange", "onSingleOptionsChange", "onDependableOptionChange", "placeholder", "noValueString", "isValid", "url", "customUrl", "operatorsUrl", "onOptionsLoaded", "recordRequiresSearchOptions", "readOnly", "onReadOnlyActivate", "allowTemplates", "interfaceContext", "templateFieldProps", "forceDropdown", "showTypeToggle", "compact", "appearance", "compactFlush", "compactNested", "compactScroll", "compactPanelProps", "compactCollapsedGroups", "compactBoxLabels", "revealRequired", "focusAttentionRequest", "onAttentionChange", "outsideAttention", "compactStickyBoxHeaders", "compactStickyCardHeaders", "compactStickyOffset", "compactToolbar", "commitMode", "expandMode", "onCommit", "operators", "groups", "optionsLoader", "onValidityChange", "optionActions", "optionActionsCollapse", "componentOverrides", "codePreviewRenderer", "readSummaries", "cardEditorTypes", "markdownRenderer", "rendererOnlyUiTypes", "templateAwareUiTypes", "anyLikeUiTypes", "inheritedFromParent", "autoFocusFirstRequired", "expandFirstRequired", "initialExpandedOptions", "expandOptionsRequest", "valueKey", "maxFieldsShown", "options", "stringTemplates", "skeletonReason"]);
|
|
703
704
|
var feWords = (0, reqraftLabels_1.useReqraftLabels)().formEngine;
|
|
705
|
+
/* A host's lists and maps, as the same reference while they say the same thing: a host that writes them as
|
|
706
|
+
literals in its render handed a new one every time, and the rows' context was rebuilt with each (useEqualValue). */
|
|
707
|
+
var optionActions = (0, useEqualValue_1.useEqualValue)(optionActionsProp);
|
|
708
|
+
var componentOverrides = (0, useEqualValue_1.useEqualValue)(componentOverridesProp);
|
|
709
|
+
var readSummaries = (0, useEqualValue_1.useEqualValue)(readSummariesProp);
|
|
710
|
+
var cardEditorTypes = (0, useEqualValue_1.useEqualValue)(cardEditorTypesProp);
|
|
704
711
|
// Built-ins + whatever the consumer declared for its own injected editors.
|
|
705
712
|
var isRendererOnly = (0, react_2.useMemo)(function () { return (0, rendererTypes_1.createRendererOnlyUiTypeCheck)(rendererOnlyUiTypes); }, [JSON.stringify(rendererOnlyUiTypes)]);
|
|
706
713
|
// Pointer CAPABILITY and viewport WIDTH are different questions and both
|
|
@@ -725,7 +732,7 @@ var FormEngineImpl = function (_a) {
|
|
|
725
732
|
enters the component, so the header, the chips, the messages, the meter and
|
|
726
733
|
the read-first summary cannot disagree about it: every one of them reads
|
|
727
734
|
`options`, and none of them has to know the rule. */
|
|
728
|
-
var
|
|
735
|
+
var _w = (0, react_2.useState)(optionsSchema || undefined), servedOptions = _w[0], setOptions = _w[1];
|
|
729
736
|
var options = (0, react_2.useMemo)(function () { return (0, options_1.resolveDegenerateRequiredGroups)(servedOptions); }, [servedOptions]);
|
|
730
737
|
/* Whether the schema the form holds is the one in force: its host is not waiting behind the skeleton, and a
|
|
731
738
|
schema the host hands down has been taken in (`servedOptions` follows the `options` prop a render later).
|
|
@@ -740,33 +747,33 @@ var FormEngineImpl = function (_a) {
|
|
|
740
747
|
JSON.stringify(optionsSchema || undefined) !== JSON.stringify(servedOptions);
|
|
741
748
|
var schemaInForce = !rest.skeleton && !hostSchemaPending;
|
|
742
749
|
// optionsLoader lifecycle: loading feeds the skeleton gate, error the banner.
|
|
743
|
-
var
|
|
744
|
-
var
|
|
750
|
+
var _x = (0, react_2.useState)(!!optionsLoader && !optionsSchema), optionsLoading = _x[0], setOptionsLoading = _x[1];
|
|
751
|
+
var _y = (0, react_2.useState)(), optionsError = _y[0], setOptionsError = _y[1];
|
|
745
752
|
// Operators: prop-provided (compact) or fetched via operatorsUrl (dpql,
|
|
746
753
|
// ported from IDE Options) — the fetch overrides the seeded prop value.
|
|
747
|
-
var
|
|
754
|
+
var _z = (0, react_2.useState)(operatorsProp), operators = _z[0], setOperators = _z[1];
|
|
748
755
|
// Remote-fetch loading (ported from IDE Options); only relevant when one of
|
|
749
756
|
// the fetch urls is set — schema-as-props consumers never see the skeleton.
|
|
750
|
-
var
|
|
757
|
+
var _0 = (0, react_2.useState)(!!(url || customUrl || operatorsUrl)), loading = _0[0], setLoading = _0[1];
|
|
751
758
|
var confirmAction = (0, reqore_1.useReqoreProperty)('confirmAction');
|
|
752
759
|
var theme = (0, reqore_1.useReqoreTheme)();
|
|
753
760
|
var calm = (0, formAppearance_1.useIsCalmForm)();
|
|
754
|
-
var
|
|
755
|
-
var
|
|
761
|
+
var _1 = (0, react_2.useState)(), focusedEditing = _1[0], setFocusedEditing = _1[1];
|
|
762
|
+
var _2 = (0, react_2.useState)(false), showFieldTypes = _2[0], setShowFieldTypes = _2[1];
|
|
756
763
|
// Global toggle (toolbar ⓘ): reveal the short-description info panel on every
|
|
757
764
|
// field that has a short_desc. Per-row ⓘ overrides still win over it.
|
|
758
765
|
// Global field-info visibility, tri-state: `undefined` = default (critical
|
|
759
766
|
// messages auto-open, the rest closed); `true` = show all; `false` = hide all
|
|
760
767
|
// (even message fields). The toolbar ⓘ drives it.
|
|
761
|
-
var
|
|
762
|
-
var
|
|
763
|
-
var
|
|
768
|
+
var _3 = (0, react_2.useState)(undefined), showAllDescriptions = _3[0], setShowAllDescriptions = _3[1];
|
|
769
|
+
var _4 = (0, react_2.useState)(), showHelpForOption = _4[0], setShowHelpForOption = _4[1];
|
|
770
|
+
var _5 = (0, react_2.useState)(false), showInvalidOptionsOnly = _5[0], setShowInvalidOptionsOnly = _5[1];
|
|
764
771
|
// Which options are expanded into their editor (several can be open at once).
|
|
765
|
-
var
|
|
772
|
+
var _6 = (0, react_2.useState)([]), expandedOptions = _6[0], setExpandedOptions = _6[1];
|
|
766
773
|
// The fields the person has opened and left. An empty required field becomes a
|
|
767
774
|
// fault only then (or after a submit attempt, `revealRequired`): a form nobody has
|
|
768
775
|
// touched is not already wrong.
|
|
769
|
-
var
|
|
776
|
+
var _7 = (0, react_2.useState)([]), visitedOptions = _7[0], setVisitedOptions = _7[1];
|
|
770
777
|
var lastExpandedOptions = (0, react_2.useRef)([]);
|
|
771
778
|
(0, react_2.useEffect)(function () {
|
|
772
779
|
var left = lastExpandedOptions.current.filter(function (name) { return !expandedOptions.includes(name); });
|
|
@@ -780,7 +787,7 @@ var FormEngineImpl = function (_a) {
|
|
|
780
787
|
}, [expandedOptions]);
|
|
781
788
|
/** Status boxes whose "N more fields" control the reader has opened. Keyed by
|
|
782
789
|
box so opening Optional does not also unfold Set. */
|
|
783
|
-
var
|
|
790
|
+
var _8 = (0, react_2.useState)([]), expandedMoreBoxes = _8[0], setExpandedMoreBoxes = _8[1];
|
|
784
791
|
// --- Reveal a status box's content when it is opened ----------------------
|
|
785
792
|
//
|
|
786
793
|
// The status boxes stack, so the last one ("Optional", which holds every
|
|
@@ -796,7 +803,7 @@ var FormEngineImpl = function (_a) {
|
|
|
796
803
|
// box has not grown and there is nothing to scroll to. A layout effect runs
|
|
797
804
|
// after the DOM is updated and before paint, which makes the reveal
|
|
798
805
|
// deterministic instead of a guessed delay.
|
|
799
|
-
var
|
|
806
|
+
var _9 = (0, react_2.useState)(undefined), openedStatusBox = _9[0], setOpenedStatusBox = _9[1];
|
|
800
807
|
var statusBoxRefs = (0, react_2.useRef)({});
|
|
801
808
|
(0, react_2.useLayoutEffect)(function () {
|
|
802
809
|
var _a, _b;
|
|
@@ -831,13 +838,13 @@ var FormEngineImpl = function (_a) {
|
|
|
831
838
|
var openBoxes = (0, rowPlaces_1.useOpenBoxes)();
|
|
832
839
|
// Measured form width (not viewport — the form lives in drawers/panels of
|
|
833
840
|
// arbitrary width) drives the stacked narrow layout.
|
|
834
|
-
var
|
|
841
|
+
var _10 = (0, react_use_1.useMeasure)(), compactWrapRef = _10[0], compactWrapWidth = _10[1].width;
|
|
835
842
|
// Own handle on the scroll wrap (useMeasure's ref is a callback, no `.current`)
|
|
836
843
|
// so the label-column measurement can publish its CSS var on the element. It's
|
|
837
844
|
// STATE, not a ref: the wrap mounts only after the loading-skeleton gate
|
|
838
845
|
// resolves, so the measurement effect must re-run when the node appears — a
|
|
839
846
|
// ref wouldn't retrigger it.
|
|
840
|
-
var
|
|
847
|
+
var _11 = (0, react_2.useState)(null), compactWrapNode = _11[0], setCompactWrapNode = _11[1];
|
|
841
848
|
// Ref mirror of the wrap node for callbacks that must not re-create when it
|
|
842
849
|
// mounts (flashOptions reads it inside a rAF).
|
|
843
850
|
var compactWrapNodeRef = (0, react_2.useRef)(null);
|
|
@@ -853,10 +860,28 @@ var FormEngineImpl = function (_a) {
|
|
|
853
860
|
/* The label column the rows are laid out with: measured from the labels (see below), the
|
|
854
861
|
default until it is. A form stacks its rows where its value column would be too narrow
|
|
855
862
|
beside it (`isCompactNarrow`), not at one form width whatever its labels are. */
|
|
856
|
-
var
|
|
863
|
+
var _12 = (0, react_2.useState)(compactRowStyles_1.COMPACT_LABEL_COL), compactLabelColumn = _12[0], setCompactLabelColumn = _12[1];
|
|
857
864
|
// the label column holds a finger's help button where the pointer is a finger (`labelAffordanceWidth`)
|
|
858
865
|
var coarsePointer = (0, useCoarsePointer_1.useCoarsePointer)();
|
|
859
|
-
|
|
866
|
+
/* The wrap's width as it is laid out the moment it mounts, read before it is first drawn.
|
|
867
|
+
`useMeasure` reports only from a ResizeObserver, after the browser's next layout, so until
|
|
868
|
+
then the width was 0 and a narrow form drew its first frames as a wide one: on a 190px form
|
|
869
|
+
a 220px name column, and the editor of an open row in a 0px column past the row's right edge.
|
|
870
|
+
Anything opened in those frames was laid out there - a picker focused as the form appeared
|
|
871
|
+
had its list closed as hidden (board f63). The observer's figure takes over once it has one. */
|
|
872
|
+
var _13 = (0, react_2.useState)(0), mountedWrapWidth = _13[0], setMountedWrapWidth = _13[1];
|
|
873
|
+
(0, react_2.useLayoutEffect)(function () {
|
|
874
|
+
if (!compactWrapNode) {
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
var style = getComputedStyle(compactWrapNode);
|
|
878
|
+
var contentWidth = compactWrapNode.clientWidth -
|
|
879
|
+
(parseFloat(style.paddingLeft) || 0) -
|
|
880
|
+
(parseFloat(style.paddingRight) || 0);
|
|
881
|
+
setMountedWrapWidth(function (current) { return (current === contentWidth ? current : contentWidth); });
|
|
882
|
+
}, [compactWrapNode]);
|
|
883
|
+
var compactLaidOutWidth = compactWrapWidth || mountedWrapWidth;
|
|
884
|
+
var compactNarrow = !!compactLaidOutWidth && (0, compactRowStyles_1.isCompactNarrow)(compactLaidOutWidth, compactLabelColumn);
|
|
860
885
|
/* How much pinned chrome sits above a status-box header.
|
|
861
886
|
|
|
862
887
|
Sticky offsets do not compose on their own: everything pinned in one
|
|
@@ -871,7 +896,7 @@ var FormEngineImpl = function (_a) {
|
|
|
871
896
|
a search row and a field picker that each hide themselves when they have
|
|
872
897
|
nothing to say, and what is left wraps differently at every form width.
|
|
873
898
|
Zero when this form draws no toolbar at all. */
|
|
874
|
-
var
|
|
899
|
+
var _14 = (0, react_2.useState)(0), compactToolbarHeight = _14[0], setCompactToolbarHeight = _14[1];
|
|
875
900
|
(0, react_2.useLayoutEffect)(function () {
|
|
876
901
|
var wrap = compactWrapNode;
|
|
877
902
|
if (!compact || !wrap || compactNested || !compactStickyBoxHeaders) {
|
|
@@ -927,7 +952,7 @@ var FormEngineImpl = function (_a) {
|
|
|
927
952
|
form before anything has moved. The host is whatever paints first above the
|
|
928
953
|
form: the page, a drawer's panel surface, a card. Read once it mounts (and
|
|
929
954
|
when the theme changes), not assumed from the theme's main color. */
|
|
930
|
-
var
|
|
955
|
+
var _15 = (0, react_2.useState)(), compactHostColour = _15[0], setCompactHostColour = _15[1];
|
|
931
956
|
(0, react_2.useLayoutEffect)(function () {
|
|
932
957
|
if (!calm || !compact || compactNested || !compactWrapNode) {
|
|
933
958
|
setCompactHostColour(undefined);
|
|
@@ -999,9 +1024,18 @@ var FormEngineImpl = function (_a) {
|
|
|
999
1024
|
var readRowHeights = (0, react_2.useRef)({});
|
|
1000
1025
|
// Required-groups linkage: hovering a group chip highlights every member row;
|
|
1001
1026
|
// clicking a sibling in the chip's popover scrolls to it and flashes it.
|
|
1002
|
-
var
|
|
1003
|
-
|
|
1004
|
-
|
|
1027
|
+
var _16 = (0, react_2.useState)([]), highlightedOptions = _16[0], setHighlightedOptions = _16[1];
|
|
1028
|
+
/* The rows flashing, and which time this is. A flash is a CSS animation that plays once when its class is set
|
|
1029
|
+
and ends on the row's own background, so nothing takes the class off again: a timer did, 1.4s later, and that
|
|
1030
|
+
update came from no event at all, so React reported it (and the context it changed, once for every row reading
|
|
1031
|
+
it) as an update a test had not waited for - a thousand times a story in the IDE's API schema forms (board t-96).
|
|
1032
|
+
`generation` says which time it is, so a row that flashes again starts its animation again (`CompactRow`). */
|
|
1033
|
+
var _17 = (0, react_2.useState)({
|
|
1034
|
+
names: [],
|
|
1035
|
+
generation: 0,
|
|
1036
|
+
}), flash = _17[0], setFlash = _17[1];
|
|
1037
|
+
var flashedOptions = flash.names;
|
|
1038
|
+
var flashGeneration = flash.generation;
|
|
1005
1039
|
var flashOptions = (0, react_2.useCallback)(function (optionNames, scrollToFirst) {
|
|
1006
1040
|
if (scrollToFirst === void 0) { scrollToFirst = false; }
|
|
1007
1041
|
if (scrollToFirst && optionNames[0]) {
|
|
@@ -1026,12 +1060,9 @@ var FormEngineImpl = function (_a) {
|
|
|
1026
1060
|
}
|
|
1027
1061
|
});
|
|
1028
1062
|
}
|
|
1029
|
-
|
|
1030
|
-
clearTimeout(flashTimeout.current);
|
|
1031
|
-
flashTimeout.current = setTimeout(function () { return setFlashedOptions([]); }, 1400);
|
|
1063
|
+
setFlash(function (current) { return ({ names: optionNames, generation: current.generation + 1 }); });
|
|
1032
1064
|
}, []);
|
|
1033
1065
|
var flashOption = (0, react_2.useCallback)(function (optionName) { return flashOptions([optionName], true); }, [flashOptions]);
|
|
1034
|
-
(0, react_2.useEffect)(function () { return function () { return clearTimeout(flashTimeout.current); }; }, []);
|
|
1035
1066
|
// Follow a field across panels: when its status bucket changes — e.g. you fill
|
|
1036
1067
|
// an optional field and it jumps to Set / Needs attention — scroll to its new
|
|
1037
1068
|
// row and flash it so it's easy to keep track of. `settledBucket` holds each
|
|
@@ -1053,16 +1084,16 @@ var FormEngineImpl = function (_a) {
|
|
|
1053
1084
|
}
|
|
1054
1085
|
});
|
|
1055
1086
|
// Info panels auto-open on Tier-1 content; the per-row user override sticks.
|
|
1056
|
-
var
|
|
1087
|
+
var _18 = (0, react_2.useState)({}), infoPanelOverrides = _18[0], setInfoPanelOverrides = _18[1];
|
|
1057
1088
|
// Toolbar filters affect the listed rows only — the meter reflects the full set.
|
|
1058
|
-
var
|
|
1059
|
-
var
|
|
1089
|
+
var _19 = (0, react_2.useState)(false), requiredOnly = _19[0], setRequiredOnly = _19[1];
|
|
1090
|
+
var _20 = (0, react_2.useState)(''), compactQuery = _20[0], setCompactQuery = _20[1];
|
|
1060
1091
|
// Compact field sort (Fields menu → "Sort by"); 'schema' = declared order.
|
|
1061
|
-
var
|
|
1062
|
-
var
|
|
1092
|
+
var _21 = (0, react_2.useState)('schema'), compactSort = _21[0], setCompactSort = _21[1];
|
|
1093
|
+
var _22 = (0, react_2.useState)(function () { return ({
|
|
1063
1094
|
fields: (0, exports.fixOptions)(value, options || {}, undefined, isRendererOnly),
|
|
1064
1095
|
meta: undefined,
|
|
1065
|
-
}); }), localValue =
|
|
1096
|
+
}); }), localValue = _22[0], setLocalValue = _22[1];
|
|
1066
1097
|
var originalValue = (0, react_2.useRef)();
|
|
1067
1098
|
// Track the last value we emitted via onChange so we can skip re-applying fixOptions
|
|
1068
1099
|
// when the parent echoes it back as the new value prop (controlled component loop prevention)
|
|
@@ -1120,7 +1151,7 @@ var FormEngineImpl = function (_a) {
|
|
|
1120
1151
|
originalValue.current = localValue.fields;
|
|
1121
1152
|
}
|
|
1122
1153
|
var unavailableOptionsCount = (0, react_2.useRef)(0);
|
|
1123
|
-
var
|
|
1154
|
+
var _23 = (0, useQorusTypes_1.useQorusTypes)(), compactValue = _23.compactValue, typesLoading = _23.loading;
|
|
1124
1155
|
// an option's type in words, while the form shows field types (qorus#646: it said the type's code, `<string>`)
|
|
1125
1156
|
var typeName = (0, typeSentenceForm_1.useTypeName)();
|
|
1126
1157
|
var templates = (0, useTemplates_1.useTemplates)(allowTemplates, stringTemplates, interfaceContext);
|
|
@@ -1634,6 +1665,9 @@ var FormEngineImpl = function (_a) {
|
|
|
1634
1665
|
showInvalidOptionsOnly,
|
|
1635
1666
|
schemaInForce,
|
|
1636
1667
|
]);
|
|
1668
|
+
/* The schema and the values, as one value while neither changes: every row reads it through a selector
|
|
1669
|
+
(`OptionFieldMessages`), and a new object on each render of the form asked every row again (board f70). */
|
|
1670
|
+
var optionsContextValue = (0, react_2.useMemo)(function () { return ({ schema: options, value: availableOptions }); }, [options, availableOptions]);
|
|
1637
1671
|
// Per required-group: its member options, and which member (if any) already
|
|
1638
1672
|
// satisfies it — drives the "One of" chips and the "covered by" notes.
|
|
1639
1673
|
var requiredGroupsInfo = (0, react_2.useMemo)(function () {
|
|
@@ -2694,6 +2728,10 @@ var FormEngineImpl = function (_a) {
|
|
|
2694
2728
|
// same surface and edge Reqore gives the section panels themselves).
|
|
2695
2729
|
var cPanel = (0, formAppearance_1.getCalmPanelSurface)(theme);
|
|
2696
2730
|
var cHairline = (0, formAppearance_1.getCalmPanelHairline)(theme);
|
|
2731
|
+
/* An open field's card pins its heading while its long body is read (`compactStickyCardHeaders`), on the surface
|
|
2732
|
+
the status box headers pin on. A nested sub-form's card sits in the parent's card, whose heading pins instead. */
|
|
2733
|
+
var stickyCardHeaders = compact && compactStickyCardHeaders && !compactNested;
|
|
2734
|
+
var pinnedHeaderSurface = calm ? cPanel : (0, colors_1.getMainBackgroundColor)(theme);
|
|
2697
2735
|
// The closure surface the extracted CompactRow reads through context. Refs and
|
|
2698
2736
|
// setters are stable; the state/memo/handler fields change identity as they do
|
|
2699
2737
|
// today, so a row re-renders exactly when its inputs do.
|
|
@@ -2711,12 +2749,16 @@ var FormEngineImpl = function (_a) {
|
|
|
2711
2749
|
codeEditor: componentOverrides === null || componentOverrides === void 0 ? void 0 : componentOverrides['code-editor'],
|
|
2712
2750
|
readSummaries: readSummaries,
|
|
2713
2751
|
cardEditorTypes: cardEditorTypes,
|
|
2752
|
+
stickyCardHeaders: stickyCardHeaders,
|
|
2753
|
+
stickyHostOffset: compactStickyOffset,
|
|
2754
|
+
pinnedHeaderSurface: pinnedHeaderSurface,
|
|
2714
2755
|
showAllDescriptions: showAllDescriptions,
|
|
2715
2756
|
expandedOptions: expandedOptions,
|
|
2716
2757
|
visitedOptions: visitedOptions,
|
|
2717
2758
|
revealRequired: revealRequired,
|
|
2718
2759
|
highlightedOptions: highlightedOptions,
|
|
2719
2760
|
flashedOptions: flashedOptions,
|
|
2761
|
+
flashGeneration: flashGeneration,
|
|
2720
2762
|
infoPanelOverrides: infoPanelOverrides,
|
|
2721
2763
|
setHighlightedOptions: setHighlightedOptions,
|
|
2722
2764
|
setInfoPanelOverrides: setInfoPanelOverrides,
|
|
@@ -2765,12 +2807,16 @@ var FormEngineImpl = function (_a) {
|
|
|
2765
2807
|
componentOverrides,
|
|
2766
2808
|
readSummaries,
|
|
2767
2809
|
cardEditorTypes,
|
|
2810
|
+
stickyCardHeaders,
|
|
2811
|
+
compactStickyOffset,
|
|
2812
|
+
pinnedHeaderSurface,
|
|
2768
2813
|
showAllDescriptions,
|
|
2769
2814
|
expandedOptions,
|
|
2770
2815
|
visitedOptions,
|
|
2771
2816
|
revealRequired,
|
|
2772
2817
|
highlightedOptions,
|
|
2773
2818
|
flashedOptions,
|
|
2819
|
+
flashGeneration,
|
|
2774
2820
|
infoPanelOverrides,
|
|
2775
2821
|
setHighlightedOptions,
|
|
2776
2822
|
setInfoPanelOverrides,
|
|
@@ -3354,11 +3400,11 @@ var FormEngineImpl = function (_a) {
|
|
|
3354
3400
|
addableGroups.map(function (key) { return renderNestedGroup(key, addableByGroup[key], 'addable'); })
|
|
3355
3401
|
: null] })));
|
|
3356
3402
|
};
|
|
3357
|
-
return ((0, jsx_runtime_1.jsx)(optionsContext_1.OptionsContext.Provider, { value:
|
|
3403
|
+
return ((0, jsx_runtime_1.jsx)(optionsContext_1.OptionsContext.Provider, { value: optionsContextValue, children: (0, jsx_runtime_1.jsx)(compactRowContext_1.CompactRowContext.Provider, { value: compactRowContextValue, children: (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreErrorBoundary, { children: [showHelpForOption && ((0, jsx_runtime_1.jsx)(OptionsHelpDialog_1.OptionsHelpDialog, { onClose: function () { return setShowHelpForOption(undefined); }, option: options[showHelpForOption] })), (0, jsx_runtime_1.jsx)(compactToolbarContext_1.CompactToolbarContext.Provider, { value: compactToolbarContextValue, children: (0, jsx_runtime_1.jsxs)(StyledCompactWrap, { ref: setCompactWrap, className: 'options-readfirst-scroll', "$ownScroll": compactScroll === 'own' && !compactNested, children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledCompactPanel
|
|
3358
3404
|
// Mirrors the toolbar's own search-row gate: when no search
|
|
3359
3405
|
// row renders, the header is a thin strip and sits tight to
|
|
3360
3406
|
// the first status box (see StyledCompactPanel).
|
|
3361
|
-
, __assign({ "$tightHeader": !((compactToolbarParts === null || compactToolbarParts === void 0 ? void 0 : compactToolbarParts.search) && (0, size_1.default)(options) > 1), "$headerBg": compactNested ? 'transparent' : headerBg, "$nested": compactNested, "$calm": calm, "$stickyBoxes": compactStickyBoxHeaders
|
|
3407
|
+
, __assign({ "$tightHeader": !((compactToolbarParts === null || compactToolbarParts === void 0 ? void 0 : compactToolbarParts.search) && (0, size_1.default)(options) > 1), "$headerBg": compactNested ? 'transparent' : headerBg, "$nested": compactNested, "$calm": calm, "$stickyBoxes": compactStickyBoxHeaders || stickyCardHeaders, "$letPin": !compactNested, "$stackHeader": compactNarrow &&
|
|
3362
3408
|
!!((compactPanelProps === null || compactPanelProps === void 0 ? void 0 : compactPanelProps.label) ||
|
|
3363
3409
|
(compactPanelProps === null || compactPanelProps === void 0 ? void 0 : compactPanelProps.icon) ||
|
|
3364
3410
|
((_f = compactPanelProps === null || compactPanelProps === void 0 ? void 0 : compactPanelProps.actions) === null || _f === void 0 ? void 0 : _f.length)), flat: true,
|
|
@@ -3511,7 +3557,7 @@ var FormEngineImpl = function (_a) {
|
|
|
3511
3557
|
being read — see `compactStickyBoxHeaders`. Sticky
|
|
3512
3558
|
is bounded by its containing block, so the header
|
|
3513
3559
|
leaves with its box and only one is ever pinned. */
|
|
3514
|
-
stickyHeader: stickyBoxHeaders, stickyHeaderOffset: stickyBoxHeaders ? boxStickyOffset : undefined, collapseButtonProps: { flat: true, minimal: true, size: 'small' }, collapsible: true,
|
|
3560
|
+
stickyHeader: stickyBoxHeaders, stickyHeaderOffset: stickyBoxHeaders ? boxStickyOffset : undefined, "$letPin": !stickyBoxHeaders, collapseButtonProps: { flat: true, minimal: true, size: 'small' }, collapsible: true,
|
|
3515
3561
|
// Which boxes start closed is the consumer's call
|
|
3516
3562
|
// (`compactCollapsedGroups`, default `['optional']`: the
|
|
3517
3563
|
// Optional box holds every not-yet-added field, so a form
|
|
@@ -3569,7 +3615,17 @@ var FormEngineImpl = function (_a) {
|
|
|
3569
3615
|
borderBottomLeftRadius: 'inherit',
|
|
3570
3616
|
borderBottomRightRadius: 'inherit',
|
|
3571
3617
|
}
|
|
3572
|
-
: {
|
|
3618
|
+
: {
|
|
3619
|
+
paddingTop: 4,
|
|
3620
|
+
paddingBottom: 6,
|
|
3621
|
+
/* Reqore's body is `overflow: auto`, a scrollport that never scrolls here and
|
|
3622
|
+
that anything pinned inside it would pin to instead of the page. `clip`
|
|
3623
|
+
keeps the horizontal guard (see the form's body), `flow-root` the
|
|
3624
|
+
formatting context the `auto` gave. */
|
|
3625
|
+
overflowY: 'visible',
|
|
3626
|
+
overflowX: 'clip',
|
|
3627
|
+
display: 'flow-root',
|
|
3628
|
+
}, children: [(0, jsx_runtime_1.jsx)(rowPlaces_1.OpenBoxMark, { box: box.key, onShown: openBoxes.onShown }), (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledGroupBody, __assign({}, groupBodyProps, { "$boxCorners": true, className: compactNarrow ? 'readfirst-narrow' : undefined, children: [shownGroups.map(function (groupName) {
|
|
3573
3629
|
return renderBoxGroup(box.key, groupName, shownRowSet);
|
|
3574
3630
|
}), deferredCount ? renderMoreRow(box.key, deferredCount, moreOpen) : null, deferredCount && moreOpen ?
|
|
3575
3631
|
deferredGroups.map(function (groupName) {
|
|
@@ -3612,7 +3668,7 @@ var FormEngineImpl = function (_a) {
|
|
|
3612
3668
|
if (compact) {
|
|
3613
3669
|
return renderCompact();
|
|
3614
3670
|
}
|
|
3615
|
-
return ((0, jsx_runtime_1.jsx)(optionsContext_1.OptionsContext.Provider, { value:
|
|
3671
|
+
return ((0, jsx_runtime_1.jsx)(optionsContext_1.OptionsContext.Provider, { value: optionsContextValue, children: (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreErrorBoundary, { children: [showHelpForOption && ((0, jsx_runtime_1.jsx)(OptionsHelpDialog_1.OptionsHelpDialog, { onClose: function () { return setShowHelpForOption(undefined); }, option: options[showHelpForOption] })), recordRequiresSearchOptions && !readOnly ?
|
|
3616
3672
|
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { intent: (0, formAppearance_1.calmNoteIntent)('info', calm), children: feWords.searchOptionsRequired }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 10 })] })
|
|
3617
3673
|
: null, (0, jsx_runtime_1.jsx)(reqore_1.ReqoreCollection, __assign({ minColumnWidth: '350px', flat: true, padded: false, minimal: true }, rest, { label: compact ? undefined : rest.label, responsiveTitle: false, inputProps: {
|
|
3618
3674
|
disabled: (0, size_1.default)(availableOptions) < 2,
|