@qoretechnologies/reqraft 0.10.50-pr.115.gf7dfde4 → 0.10.50
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 +2 -13
- package/dist/components/form/engine/CompactRow.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +24 -7
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +55 -54
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/rendererTypes.d.ts +0 -13
- package/dist/components/form/engine/rendererTypes.d.ts.map +1 -1
- package/dist/components/form/engine/rendererTypes.js.map +1 -1
- package/package.json +2 -2
- package/src/components/form/engine/CompactRow.tsx +2 -13
- package/src/components/form/engine/FormEngine.stories.tsx +179 -4
- package/src/components/form/engine/FormEngine.tsx +79 -45
- package/src/components/form/engine/rendererTypes.ts +0 -12
|
@@ -111,7 +111,7 @@ var reduce_1 = __importDefault(require("lodash/reduce"));
|
|
|
111
111
|
var size_1 = __importDefault(require("lodash/size"));
|
|
112
112
|
var react_2 = __importStar(require("react"));
|
|
113
113
|
var react_use_1 = require("react-use");
|
|
114
|
-
var styled_components_1 =
|
|
114
|
+
var styled_components_1 = __importStar(require("styled-components"));
|
|
115
115
|
var use_context_selector_1 = require("use-context-selector");
|
|
116
116
|
var common_1 = require("../../../helpers/common");
|
|
117
117
|
var options_1 = require("../../../helpers/options");
|
|
@@ -186,12 +186,16 @@ var PositiveColorEffect = {
|
|
|
186
186
|
};
|
|
187
187
|
// Compact (read-first) layout: flat label | value | action rows in collapsible
|
|
188
188
|
// group panels; colours come in as props so the layout follows the Reqore theme.
|
|
189
|
-
var StyledCompactWrap = styled_components_1.default.div(
|
|
189
|
+
var StyledCompactWrap = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex-flow: column;\n gap: 10px;\n width: 100%;\n /* Allow the wrap to shrink inside flex/grid parents so its rows' ellipsis can\n engage instead of overflowing the container horizontally. */\n min-width: 0;\n max-width: 100%;\n\n /* Scroll ownership \u2014 see `compactScroll`.\n\n 'host' (the default): the page or panel around us already scrolls, so we\n must not cap our height and scroll our own body, or the reader gets two\n scrollbars in two styles and cannot tell which moves what.\n\n `overflow-x: clip`, NOT `hidden`: CSS coerces an `overflow-y: visible`\n to `auto` whenever the other axis is neither visible nor clip, which would\n leave this box a scroll container \u2014 the element stops scrolling only\n because `max-height: none` means nothing overflows, while `position:\n sticky` inside it still resolves against US instead of the host, so the\n toolbar silently stops pinning. `clip` keeps the horizontal guard without\n that coercion. */\n ", "\n\n /* Option logos (e.g. language images) render as <img> inside ReqoreIcon's\n square box; constrain them so portrait PNGs don't overflow the row. */\n .reqore-icon img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n"], ["\n display: flex;\n flex-flow: column;\n gap: 10px;\n width: 100%;\n /* Allow the wrap to shrink inside flex/grid parents so its rows' ellipsis can\n engage instead of overflowing the container horizontally. */\n min-width: 0;\n max-width: 100%;\n\n /* Scroll ownership \u2014 see \\`compactScroll\\`.\n\n 'host' (the default): the page or panel around us already scrolls, so we\n must not cap our height and scroll our own body, or the reader gets two\n scrollbars in two styles and cannot tell which moves what.\n\n \\`overflow-x: clip\\`, NOT \\`hidden\\`: CSS coerces an \\`overflow-y: visible\\`\n to \\`auto\\` whenever the other axis is neither visible nor clip, which would\n leave this box a scroll container \u2014 the element stops scrolling only\n because \\`max-height: none\\` means nothing overflows, while \\`position:\n sticky\\` inside it still resolves against US instead of the host, so the\n toolbar silently stops pinning. \\`clip\\` keeps the horizontal guard without\n that coercion. */\n ", "\n\n /* Option logos (e.g. language images) render as <img> inside ReqoreIcon's\n square box; constrain them so portrait PNGs don't overflow the row. */\n .reqore-icon img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n"])), function (_a) {
|
|
190
|
+
var $ownScroll = _a.$ownScroll;
|
|
191
|
+
return $ownScroll
|
|
192
|
+
? (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* 'own': we are the scroller. The sticky toolbar pins to whatever\n scrolls, so a host whose scrollport carries top padding would\n resolve sticky `top: 0` against its padding box and leave an\n unblurred strip above the toolbar. Scrolling in this unpadded box\n pins it flush. Cap at the host's available height, but do not grow\n to fill it \u2014 short forms still hug their content.\n\n `min-height: 0` is what lets a flex item shrink below its content\n so there is something to scroll; it belongs to this branch only. */\n min-height: 0;\n max-height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n "], ["\n /* 'own': we are the scroller. The sticky toolbar pins to whatever\n scrolls, so a host whose scrollport carries top padding would\n resolve sticky \\`top: 0\\` against its padding box and leave an\n unblurred strip above the toolbar. Scrolling in this unpadded box\n pins it flush. Cap at the host's available height, but do not grow\n to fill it \u2014 short forms still hug their content.\n\n \\`min-height: 0\\` is what lets a flex item shrink below its content\n so there is something to scroll; it belongs to this branch only. */\n min-height: 0;\n max-height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n "]))) : (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n /* `min-height: auto` is load-bearing, not a default: inside a column\n flex parent the shrink allowance above collapses this box to zero\n height while its rows paint outside it, so the form looks right but\n contributes nothing to layout \u2014 the host cannot size or scroll to\n it and anything below it stacks against nothing. */\n min-height: auto;\n max-height: none;\n overflow-y: visible;\n overflow-x: clip;\n "], ["\n /* \\`min-height: auto\\` is load-bearing, not a default: inside a column\n flex parent the shrink allowance above collapses this box to zero\n height while its rows paint outside it, so the form looks right but\n contributes nothing to layout \u2014 the host cannot size or scroll to\n it and anything below it stacks against nothing. */\n min-height: auto;\n max-height: none;\n overflow-y: visible;\n overflow-x: clip;\n "])));
|
|
193
|
+
});
|
|
190
194
|
// Batched-commit dock: a floating Save/Discard card pinned bottom-right. Sticky
|
|
191
195
|
// (not fixed) so it stays within the form's own scroll bounds when the engine
|
|
192
196
|
// renders inside a drawer/panel; align-self pushes it to the right edge, and it
|
|
193
197
|
// elevates above the rows with an opaque surface + border + shadow.
|
|
194
|
-
var StyledCommitDock = styled_components_1.default.div(
|
|
198
|
+
var StyledCommitDock = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: sticky;\n bottom: 8px;\n z-index: 6;\n align-self: flex-end;\n width: fit-content;\n max-width: 100%;\n padding: 8px 10px;\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n box-shadow: 0 4px 16px ", ";\n"], ["\n position: sticky;\n bottom: 8px;\n z-index: 6;\n align-self: flex-end;\n width: fit-content;\n max-width: 100%;\n padding: 8px 10px;\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n box-shadow: 0 4px 16px ", ";\n"])), function (_a) {
|
|
195
199
|
var $bg = _a.$bg;
|
|
196
200
|
return $bg;
|
|
197
201
|
}, function (_a) {
|
|
@@ -397,12 +401,26 @@ var FormEngineImpl = function (_a) {
|
|
|
397
401
|
var _b, _c, _d, _f, _g, _h;
|
|
398
402
|
var name = _a.name, uniqueName = _a.uniqueName, value = _a.value, onChange = _a.onChange, onSingleOptionsChange = _a.onSingleOptionsChange, onDependableOptionChange = _a.onDependableOptionChange, placeholder = _a.placeholder, noValueString = _a.noValueString, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
399
403
|
isValid = _a.isValid, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
400
|
-
url = _a.url, customUrl = _a.customUrl, operatorsUrl = _a.operatorsUrl, onOptionsLoaded = _a.onOptionsLoaded, recordRequiresSearchOptions = _a.recordRequiresSearchOptions, readOnly = _a.readOnly, _j = _a.allowTemplates, allowTemplates = _j === void 0 ? true : _j, interfaceContext = _a.interfaceContext, templateFieldProps = _a.templateFieldProps, forceDropdown = _a.forceDropdown, _k = _a.showTypeToggle, showTypeToggle = _k === void 0 ? true : _k, compact = _a.compact,
|
|
404
|
+
url = _a.url, customUrl = _a.customUrl, operatorsUrl = _a.operatorsUrl, onOptionsLoaded = _a.onOptionsLoaded, recordRequiresSearchOptions = _a.recordRequiresSearchOptions, readOnly = _a.readOnly, _j = _a.allowTemplates, allowTemplates = _j === void 0 ? true : _j, interfaceContext = _a.interfaceContext, templateFieldProps = _a.templateFieldProps, forceDropdown = _a.forceDropdown, _k = _a.showTypeToggle, showTypeToggle = _k === void 0 ? true : _k, compact = _a.compact,
|
|
405
|
+
// Destructured only to keep it out of `rest` (and so off the DOM). The gutter
|
|
406
|
+
// this prop documents was never implemented: it was passed to the wrap as
|
|
407
|
+
// `$flush`, whose styled template had no interpolation slot, so it has always
|
|
408
|
+
// been a no-op. Removing it from the API is a separate, breaking change —
|
|
409
|
+
// every consumer passing it today already gets the flush layout by default.
|
|
410
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
411
|
+
_l = _a.compactFlush,
|
|
412
|
+
// Destructured only to keep it out of `rest` (and so off the DOM). The gutter
|
|
413
|
+
// this prop documents was never implemented: it was passed to the wrap as
|
|
414
|
+
// `$flush`, whose styled template had no interpolation slot, so it has always
|
|
415
|
+
// been a no-op. Removing it from the API is a separate, breaking change —
|
|
416
|
+
// every consumer passing it today already gets the flush layout by default.
|
|
417
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
418
|
+
compactFlush = _l === void 0 ? false : _l, _m = _a.compactNested, compactNested = _m === void 0 ? false : _m, _o = _a.compactScroll, compactScroll = _o === void 0 ? 'host' : _o, compactPanelProps = _a.compactPanelProps, _p = _a.compactCollapsedGroups, compactCollapsedGroups = _p === void 0 ? ['optional'] : _p, _q = _a.compactToolbar, compactToolbar = _q === void 0 ? true : _q, _r = _a.commitMode, commitMode = _r === void 0 ? 'immediate' : _r, _s = _a.expandMode, expandMode = _s === void 0 ? 'single' : _s, onCommit = _a.onCommit, operatorsProp = _a.operators, groups = _a.groups, optionsLoader = _a.optionsLoader, onValidityChange = _a.onValidityChange, optionActions = _a.optionActions, _t = _a.optionActionsCollapse, optionActionsCollapse = _t === void 0 ? 'auto' : _t, componentOverrides = _a.componentOverrides, codePreviewRenderer = _a.codePreviewRenderer,
|
|
401
419
|
// consumed by the wrapper below, which publishes it to every description this
|
|
402
420
|
// form draws; destructured here only so it cannot reach `rest` and be spread
|
|
403
421
|
// onto a DOM node
|
|
404
422
|
_markdownRenderer = _a.markdownRenderer, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
405
|
-
rendererOnlyUiTypes = _a.rendererOnlyUiTypes, inheritedFromParent = _a.inheritedFromParent, autoFocusFirstRequired = _a.autoFocusFirstRequired, expandFirstRequired = _a.expandFirstRequired, initialExpandedOptions = _a.initialExpandedOptions, maxFieldsShown = _a.maxFieldsShown, rest = __rest(_a, ["name", "uniqueName", "value", "onChange", "onSingleOptionsChange", "onDependableOptionChange", "placeholder", "noValueString", "isValid", "url", "customUrl", "operatorsUrl", "onOptionsLoaded", "recordRequiresSearchOptions", "readOnly", "allowTemplates", "interfaceContext", "templateFieldProps", "forceDropdown", "showTypeToggle", "compact", "compactFlush", "compactNested", "compactPanelProps", "compactCollapsedGroups", "compactToolbar", "commitMode", "expandMode", "onCommit", "operators", "groups", "optionsLoader", "onValidityChange", "optionActions", "optionActionsCollapse", "componentOverrides", "codePreviewRenderer", "markdownRenderer", "rendererOnlyUiTypes", "inheritedFromParent", "autoFocusFirstRequired", "expandFirstRequired", "initialExpandedOptions", "maxFieldsShown"]);
|
|
423
|
+
rendererOnlyUiTypes = _a.rendererOnlyUiTypes, inheritedFromParent = _a.inheritedFromParent, autoFocusFirstRequired = _a.autoFocusFirstRequired, expandFirstRequired = _a.expandFirstRequired, initialExpandedOptions = _a.initialExpandedOptions, maxFieldsShown = _a.maxFieldsShown, rest = __rest(_a, ["name", "uniqueName", "value", "onChange", "onSingleOptionsChange", "onDependableOptionChange", "placeholder", "noValueString", "isValid", "url", "customUrl", "operatorsUrl", "onOptionsLoaded", "recordRequiresSearchOptions", "readOnly", "allowTemplates", "interfaceContext", "templateFieldProps", "forceDropdown", "showTypeToggle", "compact", "compactFlush", "compactNested", "compactScroll", "compactPanelProps", "compactCollapsedGroups", "compactToolbar", "commitMode", "expandMode", "onCommit", "operators", "groups", "optionsLoader", "onValidityChange", "optionActions", "optionActionsCollapse", "componentOverrides", "codePreviewRenderer", "markdownRenderer", "rendererOnlyUiTypes", "inheritedFromParent", "autoFocusFirstRequired", "expandFirstRequired", "initialExpandedOptions", "maxFieldsShown"]);
|
|
406
424
|
// Built-ins + whatever the consumer declared for its own injected editors.
|
|
407
425
|
var isRendererOnly = (0, react_2.useMemo)(function () { return (0, rendererTypes_1.createRendererOnlyUiTypeCheck)(rendererOnlyUiTypes); }, [JSON.stringify(rendererOnlyUiTypes)]);
|
|
408
426
|
// Pointer CAPABILITY and viewport WIDTH are different questions and both
|
|
@@ -420,33 +438,33 @@ var FormEngineImpl = function (_a) {
|
|
|
420
438
|
var collapseOptionActions = optionActionsCollapse === 'always' ? true
|
|
421
439
|
: optionActionsCollapse === 'never' ? false
|
|
422
440
|
: !isHoverCapable || !!isMobile;
|
|
423
|
-
var
|
|
441
|
+
var _u = (0, react_2.useState)((rest === null || rest === void 0 ? void 0 : rest.options) || undefined), options = _u[0], setOptions = _u[1];
|
|
424
442
|
// optionsLoader lifecycle: loading feeds the skeleton gate, error the banner.
|
|
425
|
-
var
|
|
426
|
-
var
|
|
443
|
+
var _v = (0, react_2.useState)(!!optionsLoader && !(rest === null || rest === void 0 ? void 0 : rest.options)), optionsLoading = _v[0], setOptionsLoading = _v[1];
|
|
444
|
+
var _w = (0, react_2.useState)(), optionsError = _w[0], setOptionsError = _w[1];
|
|
427
445
|
// Operators: prop-provided (compact) or fetched via operatorsUrl (dpql,
|
|
428
446
|
// ported from IDE Options) — the fetch overrides the seeded prop value.
|
|
429
|
-
var
|
|
447
|
+
var _x = (0, react_2.useState)(operatorsProp), operators = _x[0], setOperators = _x[1];
|
|
430
448
|
// Remote-fetch loading (ported from IDE Options); only relevant when one of
|
|
431
449
|
// the fetch urls is set — schema-as-props consumers never see the skeleton.
|
|
432
|
-
var
|
|
450
|
+
var _y = (0, react_2.useState)(!!(url || customUrl || operatorsUrl)), loading = _y[0], setLoading = _y[1];
|
|
433
451
|
var confirmAction = (0, reqore_1.useReqoreProperty)('confirmAction');
|
|
434
452
|
var theme = (0, reqore_1.useReqoreTheme)();
|
|
435
|
-
var
|
|
436
|
-
var
|
|
453
|
+
var _z = (0, react_2.useState)(), focusedEditing = _z[0], setFocusedEditing = _z[1];
|
|
454
|
+
var _0 = (0, react_2.useState)(false), showFieldTypes = _0[0], setShowFieldTypes = _0[1];
|
|
437
455
|
// Global toggle (toolbar ⓘ): reveal the short-description info panel on every
|
|
438
456
|
// field that has a short_desc. Per-row ⓘ overrides still win over it.
|
|
439
457
|
// Global field-info visibility, tri-state: `undefined` = default (critical
|
|
440
458
|
// messages auto-open, the rest closed); `true` = show all; `false` = hide all
|
|
441
459
|
// (even message fields). The toolbar ⓘ drives it.
|
|
442
|
-
var
|
|
443
|
-
var
|
|
444
|
-
var
|
|
460
|
+
var _1 = (0, react_2.useState)(undefined), showAllDescriptions = _1[0], setShowAllDescriptions = _1[1];
|
|
461
|
+
var _2 = (0, react_2.useState)(), showHelpForOption = _2[0], setShowHelpForOption = _2[1];
|
|
462
|
+
var _3 = (0, react_2.useState)(false), showInvalidOptionsOnly = _3[0], setShowInvalidOptionsOnly = _3[1];
|
|
445
463
|
// Which options are expanded into their editor (several can be open at once).
|
|
446
|
-
var
|
|
464
|
+
var _4 = (0, react_2.useState)([]), expandedOptions = _4[0], setExpandedOptions = _4[1];
|
|
447
465
|
/** Status boxes whose "N more fields" control the reader has opened. Keyed by
|
|
448
466
|
box so opening Optional does not also unfold Set. */
|
|
449
|
-
var
|
|
467
|
+
var _5 = (0, react_2.useState)([]), expandedMoreBoxes = _5[0], setExpandedMoreBoxes = _5[1];
|
|
450
468
|
// --- Reveal a status box's content when it is opened ----------------------
|
|
451
469
|
//
|
|
452
470
|
// The status boxes stack, so the last one ("Optional", which holds every
|
|
@@ -462,7 +480,7 @@ var FormEngineImpl = function (_a) {
|
|
|
462
480
|
// box has not grown and there is nothing to scroll to. A layout effect runs
|
|
463
481
|
// after the DOM is updated and before paint, which makes the reveal
|
|
464
482
|
// deterministic instead of a guessed delay.
|
|
465
|
-
var
|
|
483
|
+
var _6 = (0, react_2.useState)(undefined), openedStatusBox = _6[0], setOpenedStatusBox = _6[1];
|
|
466
484
|
var statusBoxRefs = (0, react_2.useRef)({});
|
|
467
485
|
(0, react_2.useLayoutEffect)(function () {
|
|
468
486
|
var _a, _b;
|
|
@@ -493,13 +511,13 @@ var FormEngineImpl = function (_a) {
|
|
|
493
511
|
var settledBucket = (0, react_2.useRef)({});
|
|
494
512
|
// Measured form width (not viewport — the form lives in drawers/panels of
|
|
495
513
|
// arbitrary width) drives the stacked narrow layout.
|
|
496
|
-
var
|
|
514
|
+
var _7 = (0, react_use_1.useMeasure)(), compactWrapRef = _7[0], compactWrapWidth = _7[1].width;
|
|
497
515
|
// Own handle on the scroll wrap (useMeasure's ref is a callback, no `.current`)
|
|
498
516
|
// so the label-column measurement can publish its CSS var on the element. It's
|
|
499
517
|
// STATE, not a ref: the wrap mounts only after the loading-skeleton gate
|
|
500
518
|
// resolves, so the measurement effect must re-run when the node appears — a
|
|
501
519
|
// ref wouldn't retrigger it.
|
|
502
|
-
var
|
|
520
|
+
var _8 = (0, react_2.useState)(null), compactWrapNode = _8[0], setCompactWrapNode = _8[1];
|
|
503
521
|
// Ref mirror of the wrap node for callbacks that must not re-create when it
|
|
504
522
|
// mounts (flashOptions reads it inside a rAF).
|
|
505
523
|
var compactWrapNodeRef = (0, react_2.useRef)(null);
|
|
@@ -553,8 +571,8 @@ var FormEngineImpl = function (_a) {
|
|
|
553
571
|
var readRowHeights = (0, react_2.useRef)({});
|
|
554
572
|
// Required-groups linkage: hovering a group chip highlights every member row;
|
|
555
573
|
// clicking a sibling in the chip's popover scrolls to it and flashes it.
|
|
556
|
-
var
|
|
557
|
-
var
|
|
574
|
+
var _9 = (0, react_2.useState)([]), highlightedOptions = _9[0], setHighlightedOptions = _9[1];
|
|
575
|
+
var _10 = (0, react_2.useState)([]), flashedOptions = _10[0], setFlashedOptions = _10[1];
|
|
558
576
|
var flashTimeout = (0, react_2.useRef)();
|
|
559
577
|
var flashOptions = (0, react_2.useCallback)(function (optionNames, scrollToFirst) {
|
|
560
578
|
if (scrollToFirst === void 0) { scrollToFirst = false; }
|
|
@@ -603,16 +621,16 @@ var FormEngineImpl = function (_a) {
|
|
|
603
621
|
});
|
|
604
622
|
var compactNarrow = !!compactWrapWidth && compactWrapWidth < 480;
|
|
605
623
|
// Info panels auto-open on Tier-1 content; the per-row user override sticks.
|
|
606
|
-
var
|
|
624
|
+
var _11 = (0, react_2.useState)({}), infoPanelOverrides = _11[0], setInfoPanelOverrides = _11[1];
|
|
607
625
|
// Toolbar filters affect the listed rows only — the meter reflects the full set.
|
|
608
|
-
var
|
|
609
|
-
var
|
|
626
|
+
var _12 = (0, react_2.useState)(false), requiredOnly = _12[0], setRequiredOnly = _12[1];
|
|
627
|
+
var _13 = (0, react_2.useState)(''), compactQuery = _13[0], setCompactQuery = _13[1];
|
|
610
628
|
// Compact field sort (Fields menu → "Sort by"); 'schema' = declared order.
|
|
611
|
-
var
|
|
612
|
-
var
|
|
629
|
+
var _14 = (0, react_2.useState)('schema'), compactSort = _14[0], setCompactSort = _14[1];
|
|
630
|
+
var _15 = (0, react_2.useState)(function () { return ({
|
|
613
631
|
fields: (0, exports.fixOptions)(value, options || {}, undefined, isRendererOnly),
|
|
614
632
|
meta: undefined,
|
|
615
|
-
}); }), localValue =
|
|
633
|
+
}); }), localValue = _15[0], setLocalValue = _15[1];
|
|
616
634
|
var originalValue = (0, react_2.useRef)();
|
|
617
635
|
// Track the last value we emitted via onChange so we can skip re-applying fixOptions
|
|
618
636
|
// when the parent echoes it back as the new value prop (controlled component loop prevention)
|
|
@@ -621,7 +639,7 @@ var FormEngineImpl = function (_a) {
|
|
|
621
639
|
originalValue.current = localValue.fields;
|
|
622
640
|
}
|
|
623
641
|
var unavailableOptionsCount = (0, react_2.useRef)(0);
|
|
624
|
-
var
|
|
642
|
+
var _16 = (0, useQorusTypes_1.useQorusTypes)(), compactValue = _16.compactValue, typesLoading = _16.loading;
|
|
625
643
|
var templates = (0, useTemplates_1.useTemplates)(allowTemplates, rest.stringTemplates, interfaceContext);
|
|
626
644
|
(0, react_2.useEffect)(function () {
|
|
627
645
|
if ((0, lodash_1.isEqual)(localValue.fields, value)) {
|
|
@@ -1459,7 +1477,7 @@ var FormEngineImpl = function (_a) {
|
|
|
1459
1477
|
// The info panel below the row keeps showing schema messages while editing —
|
|
1460
1478
|
// rendering them in the editor too would balloon a one-line edit.
|
|
1461
1479
|
suppressSchemaMessages) {
|
|
1462
|
-
var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
1480
|
+
var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
1463
1481
|
var type = _a.type, other = __rest(_a, ["type"]);
|
|
1464
1482
|
var operatorParts = (0, common_1.fixOperatorValue)(other.op);
|
|
1465
1483
|
// The RENDERER type for this row — which editor mounts. Distinct from the
|
|
@@ -1549,40 +1567,23 @@ var FormEngineImpl = function (_a) {
|
|
|
1549
1567
|
// control groups. The allowed-values renderer itself enforces the
|
|
1550
1568
|
// fixed catalogue and never exposes free-form entry.
|
|
1551
1569
|
allowCustomValues: (0, readFirst_1.isFixedCompactAllowedValueOption)(optionSchema) ||
|
|
1552
|
-
(((_g = options === null || options === void 0 ? void 0 : options[optionName]) === null || _g === void 0 ? void 0 : _g.supports_custom_values) !== false && resolvedType !== 'any'),
|
|
1553
|
-
// A field may declare a template list OF ITS OWN, and when it does
|
|
1554
|
-
// that list is the one to offer. The engine-wide `stringTemplates`
|
|
1555
|
-
// are the form's shared vocabulary - config items, system properties
|
|
1556
|
-
// - and every field draws on the same set. A per-field list answers a
|
|
1557
|
-
// question only that field asks: a test assertion's `$.` references
|
|
1558
|
-
// are the values ITS case captured, and no other field in the form
|
|
1559
|
-
// should be offering them.
|
|
1560
|
-
//
|
|
1561
|
-
// Passing the engine's list unconditionally overwrote the schema's,
|
|
1562
|
-
// so a field that declared templates had none by the time it
|
|
1563
|
-
// rendered. On a typed field that only cost the picker; on an
|
|
1564
|
-
// ANY-LIKE one it changed the question, because `TemplateField`
|
|
1565
|
-
// opens on the template selector only when there is something to
|
|
1566
|
-
// pick and otherwise falls back to the type picker. An untyped field
|
|
1567
|
-
// therefore asked the author to choose `string`/`int`/`hash` before
|
|
1568
|
-
// it would let them name a value they had already captured.
|
|
1569
|
-
templates: (_h = optionSchema === null || optionSchema === void 0 ? void 0 : optionSchema.templates) !== null && _h !== void 0 ? _h : templates.value }, (0, exports.getTypeAndCanBeNull)(
|
|
1570
|
+
(((_g = options === null || options === void 0 ? void 0 : options[optionName]) === null || _g === void 0 ? void 0 : _g.supports_custom_values) !== false && resolvedType !== 'any'), templates: templates.value }, (0, exports.getTypeAndCanBeNull)(
|
|
1570
1571
|
// The RENDERER type picks the editor — the storage type lives on
|
|
1571
1572
|
// the value envelope. Passing storage here rendered a `richtext`
|
|
1572
1573
|
// field as a plain string input.
|
|
1573
|
-
resolvedType, (
|
|
1574
|
+
resolvedType, (_h = options === null || options === void 0 ? void 0 : options[optionName]) === null || _h === void 0 ? void 0 : _h.allowed_values, other.op), { ui_type: resolvedType, name: optionName, uniqueName: "".concat(uniqueName ? "".concat(uniqueName, ".") : "".concat(name ? "".concat(name, ".") : '')).concat(optionName), onChange:
|
|
1574
1575
|
// Identity-stable on purpose: the typed fields debounce on
|
|
1575
1576
|
// `[localValue, onChange]` — an inline lambda resets the pending emit
|
|
1576
1577
|
// every render and the typed value can starve.
|
|
1577
|
-
handleValueChange, key: optionName, arg_schema: (
|
|
1578
|
+
handleValueChange, key: optionName, arg_schema: (_j = options === null || options === void 0 ? void 0 : options[optionName]) === null || _j === void 0 ? void 0 : _j.arg_schema, noSoft: !!(rest === null || rest === void 0 ? void 0 : rest.options), value: other.value, isFunction: other.is_expression, isDefaultFunction: ((_k = options === null || options === void 0 ? void 0 : options[optionName]) === null || _k === void 0 ? void 0 : _k.default_view) === 'expression', sensitive: (_l = options === null || options === void 0 ? void 0 : options[optionName]) === null || _l === void 0 ? void 0 : _l.sensitive, default_value: (0, common_1.getDefaultValue)(options === null || options === void 0 ? void 0 : options[optionName]), isDefaultTemplate: ((_m = options === null || options === void 0 ? void 0 : options[optionName]) === null || _m === void 0 ? void 0 : _m.default_view) === 'template', allowed_values: (_o = options === null || options === void 0 ? void 0 : options[optionName]) === null || _o === void 0 ? void 0 : _o.allowed_values, allowed_values_creatable: (_p = options === null || options === void 0 ? void 0 : options[optionName]) === null || _p === void 0 ? void 0 : _p.allowed_values_creatable, disabled: ((_q = options === null || options === void 0 ? void 0 : options[optionName]) === null || _q === void 0 ? void 0 : _q.disabled) ||
|
|
1578
1579
|
(
|
|
1579
1580
|
// a system-owned field states that as `readonly`; only the older
|
|
1580
1581
|
// compat projection also sent `disabled`, so honouring only
|
|
1581
1582
|
// `disabled` rendered an editable control for a value the user
|
|
1582
1583
|
// cannot change (see CompactRow's `fieldReadonly`)
|
|
1583
|
-
(
|
|
1584
|
+
(_r = options === null || options === void 0 ? void 0 : options[optionName]) === null || _r === void 0 ? void 0 : _r.readonly) ||
|
|
1584
1585
|
readOnly ||
|
|
1585
|
-
!(0, validations_1.hasAllDependenciesFullfilled)((
|
|
1586
|
+
!(0, validations_1.hasAllDependenciesFullfilled)((_s = options === null || options === void 0 ? void 0 : options[optionName]) === null || _s === void 0 ? void 0 : _s.depends_on, availableOptions, options || {}), readOnly: readOnly, size: editorSize || rest.size, menuItems: ((_t = options === null || options === void 0 ? void 0 : options[optionName]) === null || _t === void 0 ? void 0 : _t.ui_type) === 'any' ?
|
|
1586
1587
|
getCustomMenuTemplateItems(optionName)
|
|
1587
1588
|
: undefined }, templateFieldProps, { forceDropdown: effectiveForceDropdown })), (0, jsx_runtime_1.jsx)(OptionFieldMessages_1.OptionFieldMessages, { schema: options || {}, allOptions: availableOptions, name: optionName, option: __assign({ type: resolvedType }, other), getType: getTypeForOption }), operators && (0, size_1.default)(operators) && (0, size_1.default)(other.op) ?
|
|
1588
1589
|
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 5 }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { size: 'small', children: (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreTagGroup, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'small', labelKey: 'WHERE', label: optionName }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'small', labelKey: 'IS', label: operatorParts.join(' ') }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'small', intent: 'info', label: other.value ?
|
|
@@ -2103,7 +2104,7 @@ var FormEngineImpl = function (_a) {
|
|
|
2103
2104
|
}, children: groupConfig.subtitle })
|
|
2104
2105
|
: null, renderGroupRows(rows)] }, groupName));
|
|
2105
2106
|
};
|
|
2106
|
-
return ((0, jsx_runtime_1.jsx)(exports.OptionsContext.Provider, { value: { schema: options, value: availableOptions }, 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', "$
|
|
2107
|
+
return ((0, jsx_runtime_1.jsx)(exports.OptionsContext.Provider, { value: { schema: options, value: availableOptions }, 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
|
|
2107
2108
|
// Mirrors the toolbar's own search-row gate: when no search
|
|
2108
2109
|
// row renders, the header is a thin strip and sits tight to
|
|
2109
2110
|
// the first status box (see StyledCompactPanel).
|
|
@@ -2420,5 +2421,5 @@ var FormEngineImpl = function (_a) {
|
|
|
2420
2421
|
var FormEngine = function (props) { return ((0, jsx_runtime_1.jsx)(markdownRendererContext_1.MarkdownRendererContext.Provider, { value: props.markdownRenderer, children: (0, jsx_runtime_1.jsx)(FormEngineImpl, __assign({}, props)) })); };
|
|
2421
2422
|
exports.FormEngine = FormEngine;
|
|
2422
2423
|
exports.default = exports.FormEngine;
|
|
2423
|
-
var templateObject_1, templateObject_2;
|
|
2424
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
2424
2425
|
//# sourceMappingURL=FormEngine.js.map
|