@qoretechnologies/reqraft 0.10.74 → 0.10.75-pr.145.g23fa8a0
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/Description/index.d.ts.map +1 -1
- package/dist/components/Description/index.js +22 -4
- package/dist/components/Description/index.js.map +1 -1
- package/dist/components/codeSize/index.d.ts +6 -0
- package/dist/components/codeSize/index.d.ts.map +1 -1
- package/dist/components/codeSize/index.js +12 -2
- package/dist/components/codeSize/index.js.map +1 -1
- package/dist/components/composer/Composer.d.ts +7 -2
- package/dist/components/composer/Composer.d.ts.map +1 -1
- package/dist/components/composer/Composer.js +4 -3
- package/dist/components/composer/Composer.js.map +1 -1
- package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +130 -28
- 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 +70 -18
- package/dist/components/form/engine/CompactToolbar.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +65 -1
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +453 -185
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/ItemAttention.d.ts +12 -0
- package/dist/components/form/engine/ItemAttention.d.ts.map +1 -0
- package/dist/components/form/engine/ItemAttention.js +33 -0
- package/dist/components/form/engine/ItemAttention.js.map +1 -0
- package/dist/components/form/engine/OptionFieldMessages.d.ts +19 -2
- package/dist/components/form/engine/OptionFieldMessages.d.ts.map +1 -1
- package/dist/components/form/engine/OptionFieldMessages.js +39 -4
- 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 +27 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -1
- package/dist/components/form/engine/compactRowContext.d.ts +5 -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 +12 -0
- package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
- package/dist/components/form/engine/compactRowStyles.js +79 -43
- package/dist/components/form/engine/compactRowStyles.js.map +1 -1
- package/dist/components/form/engine/compactToolbarContext.d.ts +9 -0
- package/dist/components/form/engine/compactToolbarContext.d.ts.map +1 -1
- package/dist/components/form/engine/compactToolbarContext.js.map +1 -1
- package/dist/components/form/engine/formAppearance.d.ts +80 -0
- package/dist/components/form/engine/formAppearance.d.ts.map +1 -0
- package/dist/components/form/engine/formAppearance.js +143 -0
- package/dist/components/form/engine/formAppearance.js.map +1 -0
- package/dist/components/form/engine/readFirst.d.ts +23 -2
- package/dist/components/form/engine/readFirst.d.ts.map +1 -1
- package/dist/components/form/engine/readFirst.js +14 -5
- package/dist/components/form/engine/readFirst.js.map +1 -1
- package/dist/components/form/engine/revealRow.d.ts +13 -0
- package/dist/components/form/engine/revealRow.d.ts.map +1 -1
- package/dist/components/form/engine/revealRow.js +24 -1
- package/dist/components/form/engine/revealRow.js.map +1 -1
- package/dist/components/form/engine/rowFocus.d.ts +9 -1
- package/dist/components/form/engine/rowFocus.d.ts.map +1 -1
- package/dist/components/form/engine/rowFocus.js +17 -4
- package/dist/components/form/engine/rowFocus.js.map +1 -1
- package/dist/components/form/engine/rowLabelled.d.ts +9 -0
- package/dist/components/form/engine/rowLabelled.d.ts.map +1 -0
- package/dist/components/form/engine/rowLabelled.js +12 -0
- package/dist/components/form/engine/rowLabelled.js.map +1 -0
- package/dist/components/form/expressions/ExpressionField.d.ts.map +1 -1
- package/dist/components/form/expressions/ExpressionField.js +3 -1
- package/dist/components/form/expressions/ExpressionField.js.map +1 -1
- package/dist/components/form/expressions/builder/index.d.ts +6 -1
- package/dist/components/form/expressions/builder/index.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/index.js +11 -2
- package/dist/components/form/expressions/builder/index.js.map +1 -1
- package/dist/components/form/expressions/mockExpressions.d.ts.map +1 -1
- package/dist/components/form/expressions/mockExpressions.js +18 -0
- package/dist/components/form/expressions/mockExpressions.js.map +1 -1
- package/dist/components/form/expressions/renderExpressionToText.d.ts.map +1 -1
- package/dist/components/form/expressions/renderExpressionToText.js +15 -0
- package/dist/components/form/expressions/renderExpressionToText.js.map +1 -1
- package/dist/components/form/fields/ChoiceGroupHeading.d.ts +22 -0
- package/dist/components/form/fields/ChoiceGroupHeading.d.ts.map +1 -0
- package/dist/components/form/fields/ChoiceGroupHeading.js +40 -0
- package/dist/components/form/fields/ChoiceGroupHeading.js.map +1 -0
- package/dist/components/form/fields/Field.d.ts.map +1 -1
- package/dist/components/form/fields/Field.js +5 -3
- package/dist/components/form/fields/Field.js.map +1 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.d.ts +7 -0
- package/dist/components/form/fields/allowed-values/AllowedValues.d.ts.map +1 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.js +28 -7
- package/dist/components/form/fields/allowed-values/AllowedValues.js.map +1 -1
- package/dist/components/form/fields/allowed-values/savedValues.d.ts +30 -0
- package/dist/components/form/fields/allowed-values/savedValues.d.ts.map +1 -0
- package/dist/components/form/fields/allowed-values/savedValues.js +39 -0
- package/dist/components/form/fields/allowed-values/savedValues.js.map +1 -0
- package/dist/components/form/fields/array/ArrayAuto.d.ts.map +1 -1
- package/dist/components/form/fields/array/ArrayAuto.js +23 -3
- package/dist/components/form/fields/array/ArrayAuto.js.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.d.ts +5 -1
- package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.js +30 -9
- package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
- package/dist/components/form/fields/boolean/Boolean.d.ts +7 -1
- package/dist/components/form/fields/boolean/Boolean.d.ts.map +1 -1
- package/dist/components/form/fields/boolean/Boolean.js +8 -2
- package/dist/components/form/fields/boolean/Boolean.js.map +1 -1
- package/dist/components/form/fields/long-string/LongString.d.ts +7 -1
- package/dist/components/form/fields/long-string/LongString.d.ts.map +1 -1
- package/dist/components/form/fields/long-string/LongString.js +15 -5
- package/dist/components/form/fields/long-string/LongString.js.map +1 -1
- package/dist/components/form/fields/number/Number.d.ts +4 -1
- package/dist/components/form/fields/number/Number.d.ts.map +1 -1
- package/dist/components/form/fields/number/Number.js +17 -5
- package/dist/components/form/fields/number/Number.js.map +1 -1
- package/dist/components/form/fields/radio-group/RadioGroup.d.ts.map +1 -1
- package/dist/components/form/fields/radio-group/RadioGroup.js +13 -7
- package/dist/components/form/fields/radio-group/RadioGroup.js.map +1 -1
- package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
- package/dist/components/form/fields/template/TemplateField.js +36 -16
- package/dist/components/form/fields/template/TemplateField.js.map +1 -1
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +2 -0
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/imageLightbox/ImageLightbox.d.ts.map +1 -1
- package/dist/components/imageLightbox/ImageLightbox.js +2 -0
- package/dist/components/imageLightbox/ImageLightbox.js.map +1 -1
- package/dist/components/supportTicket/InterfaceReferenceTags.d.ts +3 -2
- package/dist/components/supportTicket/InterfaceReferenceTags.d.ts.map +1 -1
- package/dist/components/supportTicket/InterfaceReferenceTags.js.map +1 -1
- package/dist/components/supportTicket/ReferencePicker.d.ts +2 -1
- package/dist/components/supportTicket/ReferencePicker.d.ts.map +1 -1
- package/dist/components/supportTicket/ReferencePicker.js +19 -13
- package/dist/components/supportTicket/ReferencePicker.js.map +1 -1
- package/dist/components/supportTicket/TicketHeader.d.ts.map +1 -1
- package/dist/components/supportTicket/TicketHeader.js +4 -1
- package/dist/components/supportTicket/TicketHeader.js.map +1 -1
- package/dist/components/supportTicket/TicketMetaTags.d.ts +19 -12
- package/dist/components/supportTicket/TicketMetaTags.d.ts.map +1 -1
- package/dist/components/supportTicket/TicketMetaTags.js +47 -6
- package/dist/components/supportTicket/TicketMetaTags.js.map +1 -1
- package/dist/components/supportTicket/TicketReplyBox.d.ts +3 -2
- package/dist/components/supportTicket/TicketReplyBox.d.ts.map +1 -1
- package/dist/components/supportTicket/TicketReplyBox.js +31 -14
- package/dist/components/supportTicket/TicketReplyBox.js.map +1 -1
- package/dist/components/supportTicket/WorkspaceAccessStatus.d.ts +10 -2
- package/dist/components/supportTicket/WorkspaceAccessStatus.d.ts.map +1 -1
- package/dist/components/supportTicket/WorkspaceAccessStatus.js +25 -4
- package/dist/components/supportTicket/WorkspaceAccessStatus.js.map +1 -1
- package/dist/components/supportTicket/accessMeta.d.ts +6 -1
- package/dist/components/supportTicket/accessMeta.d.ts.map +1 -1
- package/dist/components/supportTicket/accessMeta.js +14 -1
- package/dist/components/supportTicket/accessMeta.js.map +1 -1
- package/dist/components/supportTicket/meta.d.ts +22 -0
- package/dist/components/supportTicket/meta.d.ts.map +1 -1
- package/dist/components/supportTicket/meta.js +30 -1
- package/dist/components/supportTicket/meta.js.map +1 -1
- package/dist/components/supportTicket/ticketAttentionInks.d.ts +23 -0
- package/dist/components/supportTicket/ticketAttentionInks.d.ts.map +1 -0
- package/dist/components/supportTicket/ticketAttentionInks.js +42 -0
- package/dist/components/supportTicket/ticketAttentionInks.js.map +1 -0
- package/dist/components/supportTicket/useLoadedImages.d.ts +10 -0
- package/dist/components/supportTicket/useLoadedImages.d.ts.map +1 -1
- package/dist/components/supportTicket/useLoadedImages.js +63 -1
- package/dist/components/supportTicket/useLoadedImages.js.map +1 -1
- package/dist/components/ticketReferences/TicketReferences.d.ts.map +1 -1
- package/dist/components/ticketReferences/TicketReferences.js +6 -2
- package/dist/components/ticketReferences/TicketReferences.js.map +1 -1
- package/dist/components/ticketThread/TicketThread.d.ts.map +1 -1
- package/dist/components/ticketThread/TicketThread.js +10 -16
- package/dist/components/ticketThread/TicketThread.js.map +1 -1
- package/dist/helpers/allowedValues.d.ts.map +1 -1
- package/dist/helpers/allowedValues.js +8 -0
- package/dist/helpers/allowedValues.js.map +1 -1
- package/dist/helpers/fieldDescription.d.ts +16 -0
- package/dist/helpers/fieldDescription.d.ts.map +1 -0
- package/dist/helpers/fieldDescription.js +40 -0
- package/dist/helpers/fieldDescription.js.map +1 -0
- package/dist/helpers/markdownText.d.ts +9 -0
- package/dist/helpers/markdownText.d.ts.map +1 -1
- package/dist/helpers/markdownText.js +49 -2
- package/dist/helpers/markdownText.js.map +1 -1
- package/dist/helpers/reqraftLabels.d.ts +31 -0
- package/dist/helpers/reqraftLabels.d.ts.map +1 -1
- package/dist/helpers/reqraftLabels.js +9 -0
- package/dist/helpers/reqraftLabels.js.map +1 -1
- package/dist/helpers/singleLineString.d.ts.map +1 -1
- package/dist/helpers/singleLineString.js +1 -0
- package/dist/helpers/singleLineString.js.map +1 -1
- package/package.json +1 -1
|
@@ -112,6 +112,7 @@ var typeChoices_1 = require("./typeChoices");
|
|
|
112
112
|
var optionActions_1 = require("./optionActions");
|
|
113
113
|
var rendererTypes_1 = require("./rendererTypes");
|
|
114
114
|
var revealRow_1 = require("./revealRow");
|
|
115
|
+
var rowFocus_1 = require("./rowFocus");
|
|
115
116
|
var emittedValues_1 = require("../fields/emittedValues");
|
|
116
117
|
var lodash_1 = require("lodash");
|
|
117
118
|
var map_1 = __importDefault(require("lodash/map"));
|
|
@@ -120,6 +121,7 @@ var size_1 = __importDefault(require("lodash/size"));
|
|
|
120
121
|
var react_2 = __importStar(require("react"));
|
|
121
122
|
var react_use_1 = require("react-use");
|
|
122
123
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
124
|
+
var fieldDescription_1 = require("../../../helpers/fieldDescription");
|
|
123
125
|
var common_1 = require("../../../helpers/common");
|
|
124
126
|
var options_1 = require("../../../helpers/options");
|
|
125
127
|
var validations_1 = require("../../../helpers/validations");
|
|
@@ -143,11 +145,12 @@ var OptionFieldMessages_1 = require("./OptionFieldMessages");
|
|
|
143
145
|
var optionsContext_1 = require("./optionsContext");
|
|
144
146
|
var markdownRendererContext_1 = require("../../Description/markdownRendererContext");
|
|
145
147
|
var OptionsHelpDialog_1 = require("./OptionsHelpDialog");
|
|
148
|
+
var formAppearance_1 = require("./formAppearance");
|
|
146
149
|
var typeSentenceForm_1 = require("../typeSentenceForm");
|
|
147
150
|
var referenceNames_1 = require("../fields/template/referenceNames");
|
|
148
151
|
var qorusTypeCatalogue_1 = require("../../../helpers/qorusTypeCatalogue");
|
|
149
152
|
var allowedValues_1 = require("../../../helpers/allowedValues");
|
|
150
|
-
var
|
|
153
|
+
var rowFocus_2 = require("./rowFocus");
|
|
151
154
|
var optionUiTypes_1 = require("../../../helpers/optionUiTypes");
|
|
152
155
|
var readFirst_1 = require("./readFirst");
|
|
153
156
|
/** One shared "nothing came down from above" bag. See `inheritedScopeFor`. */
|
|
@@ -668,31 +671,34 @@ var STRECHABLE_TYPES = new Set(['tool-catalog']);
|
|
|
668
671
|
/** How faded reqore draws a panel's title icon. */
|
|
669
672
|
var PANEL_TITLE_ICON_ALPHA = 0.7;
|
|
670
673
|
var FormEngineImpl = function (_a) {
|
|
671
|
-
var _b, _c, _d, _f, _g;
|
|
674
|
+
var _b, _c, _d, _f, _g, _h;
|
|
672
675
|
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
|
|
673
676
|
isValid = _a.isValid, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
674
|
-
url = _a.url, customUrl = _a.customUrl, operatorsUrl = _a.operatorsUrl, onOptionsLoaded = _a.onOptionsLoaded, recordRequiresSearchOptions = _a.recordRequiresSearchOptions, readOnly = _a.readOnly, onReadOnlyActivate = _a.onReadOnlyActivate,
|
|
677
|
+
url = _a.url, customUrl = _a.customUrl, operatorsUrl = _a.operatorsUrl, onOptionsLoaded = _a.onOptionsLoaded, recordRequiresSearchOptions = _a.recordRequiresSearchOptions, readOnly = _a.readOnly, onReadOnlyActivate = _a.onReadOnlyActivate, _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,
|
|
678
|
+
// Read through the context `FormEngine` provides (resolved there against an
|
|
679
|
+
// inherited appearance); destructured only to keep it out of `rest`.
|
|
680
|
+
_appearance = _a.appearance, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
675
681
|
// Destructured only to keep it out of `rest` (and so off the DOM). The gutter
|
|
676
682
|
// this prop documents was never implemented: it was passed to the wrap as
|
|
677
683
|
// `$flush`, whose styled template had no interpolation slot, so it has always
|
|
678
684
|
// been a no-op. Removing it from the API is a separate, breaking change —
|
|
679
685
|
// every consumer passing it today already gets the flush layout by default.
|
|
680
686
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
681
|
-
|
|
687
|
+
_l = _a.compactFlush, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
682
688
|
// Destructured only to keep it out of `rest` (and so off the DOM). The gutter
|
|
683
689
|
// this prop documents was never implemented: it was passed to the wrap as
|
|
684
690
|
// `$flush`, whose styled template had no interpolation slot, so it has always
|
|
685
691
|
// been a no-op. Removing it from the API is a separate, breaking change —
|
|
686
692
|
// every consumer passing it today already gets the flush layout by default.
|
|
687
693
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
688
|
-
compactFlush =
|
|
694
|
+
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, compactCollapsedGroupsProp = _a.compactCollapsedGroups, compactBoxLabels = _a.compactBoxLabels, _p = _a.revealRequired, revealRequired = _p === void 0 ? false : _p, focusAttentionRequest = _a.focusAttentionRequest, onAttentionChange = _a.onAttentionChange, outsideAttention = _a.outsideAttention, _q = _a.compactStickyBoxHeaders, compactStickyBoxHeaders = _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, optionActions = _a.optionActions, _v = _a.optionActionsCollapse, optionActionsCollapse = _v === void 0 ? 'auto' : _v, componentOverrides = _a.componentOverrides, codePreviewRenderer = _a.codePreviewRenderer, readSummaries = _a.readSummaries, cardEditorTypes = _a.cardEditorTypes,
|
|
689
695
|
// consumed by the wrapper below, which publishes it to every description this
|
|
690
696
|
// form draws; destructured here only so it cannot reach `rest` and be spread
|
|
691
697
|
// onto a DOM node
|
|
692
698
|
_markdownRenderer = _a.markdownRenderer, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
693
699
|
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,
|
|
694
700
|
// The form's own props, read here and never handed on to the collection drawn below (`{...rest}`).
|
|
695
|
-
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", "compactFlush", "compactNested", "compactScroll", "compactPanelProps", "compactCollapsedGroups", "compactBoxLabels", "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"]);
|
|
701
|
+
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"]);
|
|
696
702
|
var feWords = (0, reqraftLabels_1.useReqraftLabels)().formEngine;
|
|
697
703
|
// Built-ins + whatever the consumer declared for its own injected editors.
|
|
698
704
|
var isRendererOnly = (0, react_2.useMemo)(function () { return (0, rendererTypes_1.createRendererOnlyUiTypeCheck)(rendererOnlyUiTypes); }, [JSON.stringify(rendererOnlyUiTypes)]);
|
|
@@ -718,7 +724,7 @@ var FormEngineImpl = function (_a) {
|
|
|
718
724
|
enters the component, so the header, the chips, the messages, the meter and
|
|
719
725
|
the read-first summary cannot disagree about it: every one of them reads
|
|
720
726
|
`options`, and none of them has to know the rule. */
|
|
721
|
-
var
|
|
727
|
+
var _w = (0, react_2.useState)(optionsSchema || undefined), servedOptions = _w[0], setOptions = _w[1];
|
|
722
728
|
var options = (0, react_2.useMemo)(function () { return (0, options_1.resolveDegenerateRequiredGroups)(servedOptions); }, [servedOptions]);
|
|
723
729
|
/* Whether the schema the form holds is the one in force: its host is not waiting behind the skeleton, and a
|
|
724
730
|
schema the host hands down has been taken in (`servedOptions` follows the `options` prop a render later).
|
|
@@ -733,31 +739,47 @@ var FormEngineImpl = function (_a) {
|
|
|
733
739
|
JSON.stringify(optionsSchema || undefined) !== JSON.stringify(servedOptions);
|
|
734
740
|
var schemaInForce = !rest.skeleton && !hostSchemaPending;
|
|
735
741
|
// optionsLoader lifecycle: loading feeds the skeleton gate, error the banner.
|
|
736
|
-
var
|
|
737
|
-
var
|
|
742
|
+
var _x = (0, react_2.useState)(!!optionsLoader && !optionsSchema), optionsLoading = _x[0], setOptionsLoading = _x[1];
|
|
743
|
+
var _y = (0, react_2.useState)(), optionsError = _y[0], setOptionsError = _y[1];
|
|
738
744
|
// Operators: prop-provided (compact) or fetched via operatorsUrl (dpql,
|
|
739
745
|
// ported from IDE Options) — the fetch overrides the seeded prop value.
|
|
740
|
-
var
|
|
746
|
+
var _z = (0, react_2.useState)(operatorsProp), operators = _z[0], setOperators = _z[1];
|
|
741
747
|
// Remote-fetch loading (ported from IDE Options); only relevant when one of
|
|
742
748
|
// the fetch urls is set — schema-as-props consumers never see the skeleton.
|
|
743
|
-
var
|
|
749
|
+
var _0 = (0, react_2.useState)(!!(url || customUrl || operatorsUrl)), loading = _0[0], setLoading = _0[1];
|
|
744
750
|
var confirmAction = (0, reqore_1.useReqoreProperty)('confirmAction');
|
|
745
751
|
var theme = (0, reqore_1.useReqoreTheme)();
|
|
746
|
-
var
|
|
747
|
-
var
|
|
752
|
+
var calm = (0, formAppearance_1.useIsCalmForm)();
|
|
753
|
+
var _1 = (0, react_2.useState)(), focusedEditing = _1[0], setFocusedEditing = _1[1];
|
|
754
|
+
var _2 = (0, react_2.useState)(false), showFieldTypes = _2[0], setShowFieldTypes = _2[1];
|
|
748
755
|
// Global toggle (toolbar ⓘ): reveal the short-description info panel on every
|
|
749
756
|
// field that has a short_desc. Per-row ⓘ overrides still win over it.
|
|
750
757
|
// Global field-info visibility, tri-state: `undefined` = default (critical
|
|
751
758
|
// messages auto-open, the rest closed); `true` = show all; `false` = hide all
|
|
752
759
|
// (even message fields). The toolbar ⓘ drives it.
|
|
753
|
-
var
|
|
754
|
-
var
|
|
755
|
-
var
|
|
760
|
+
var _3 = (0, react_2.useState)(undefined), showAllDescriptions = _3[0], setShowAllDescriptions = _3[1];
|
|
761
|
+
var _4 = (0, react_2.useState)(), showHelpForOption = _4[0], setShowHelpForOption = _4[1];
|
|
762
|
+
var _5 = (0, react_2.useState)(false), showInvalidOptionsOnly = _5[0], setShowInvalidOptionsOnly = _5[1];
|
|
756
763
|
// Which options are expanded into their editor (several can be open at once).
|
|
757
|
-
var
|
|
764
|
+
var _6 = (0, react_2.useState)([]), expandedOptions = _6[0], setExpandedOptions = _6[1];
|
|
765
|
+
// The fields the person has opened and left. An empty required field becomes a
|
|
766
|
+
// fault only then (or after a submit attempt, `revealRequired`): a form nobody has
|
|
767
|
+
// touched is not already wrong.
|
|
768
|
+
var _7 = (0, react_2.useState)([]), visitedOptions = _7[0], setVisitedOptions = _7[1];
|
|
769
|
+
var lastExpandedOptions = (0, react_2.useRef)([]);
|
|
770
|
+
(0, react_2.useEffect)(function () {
|
|
771
|
+
var left = lastExpandedOptions.current.filter(function (name) { return !expandedOptions.includes(name); });
|
|
772
|
+
lastExpandedOptions.current = expandedOptions;
|
|
773
|
+
if (left.length) {
|
|
774
|
+
setVisitedOptions(function (prev) {
|
|
775
|
+
var added = left.filter(function (name) { return !prev.includes(name); });
|
|
776
|
+
return added.length ? __spreadArray(__spreadArray([], prev, true), added, true) : prev;
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
}, [expandedOptions]);
|
|
758
780
|
/** Status boxes whose "N more fields" control the reader has opened. Keyed by
|
|
759
781
|
box so opening Optional does not also unfold Set. */
|
|
760
|
-
var
|
|
782
|
+
var _8 = (0, react_2.useState)([]), expandedMoreBoxes = _8[0], setExpandedMoreBoxes = _8[1];
|
|
761
783
|
// --- Reveal a status box's content when it is opened ----------------------
|
|
762
784
|
//
|
|
763
785
|
// The status boxes stack, so the last one ("Optional", which holds every
|
|
@@ -773,7 +795,7 @@ var FormEngineImpl = function (_a) {
|
|
|
773
795
|
// box has not grown and there is nothing to scroll to. A layout effect runs
|
|
774
796
|
// after the DOM is updated and before paint, which makes the reveal
|
|
775
797
|
// deterministic instead of a guessed delay.
|
|
776
|
-
var
|
|
798
|
+
var _9 = (0, react_2.useState)(undefined), openedStatusBox = _9[0], setOpenedStatusBox = _9[1];
|
|
777
799
|
var statusBoxRefs = (0, react_2.useRef)({});
|
|
778
800
|
(0, react_2.useLayoutEffect)(function () {
|
|
779
801
|
var _a, _b;
|
|
@@ -804,13 +826,13 @@ var FormEngineImpl = function (_a) {
|
|
|
804
826
|
var settledBucket = (0, react_2.useRef)({});
|
|
805
827
|
// Measured form width (not viewport — the form lives in drawers/panels of
|
|
806
828
|
// arbitrary width) drives the stacked narrow layout.
|
|
807
|
-
var
|
|
829
|
+
var _10 = (0, react_use_1.useMeasure)(), compactWrapRef = _10[0], compactWrapWidth = _10[1].width;
|
|
808
830
|
// Own handle on the scroll wrap (useMeasure's ref is a callback, no `.current`)
|
|
809
831
|
// so the label-column measurement can publish its CSS var on the element. It's
|
|
810
832
|
// STATE, not a ref: the wrap mounts only after the loading-skeleton gate
|
|
811
833
|
// resolves, so the measurement effect must re-run when the node appears — a
|
|
812
834
|
// ref wouldn't retrigger it.
|
|
813
|
-
var
|
|
835
|
+
var _11 = (0, react_2.useState)(null), compactWrapNode = _11[0], setCompactWrapNode = _11[1];
|
|
814
836
|
// Ref mirror of the wrap node for callbacks that must not re-create when it
|
|
815
837
|
// mounts (flashOptions reads it inside a rAF).
|
|
816
838
|
var compactWrapNodeRef = (0, react_2.useRef)(null);
|
|
@@ -826,7 +848,7 @@ var FormEngineImpl = function (_a) {
|
|
|
826
848
|
/* The label column the rows are laid out with: measured from the labels (see below), the
|
|
827
849
|
default until it is. A form stacks its rows where its value column would be too narrow
|
|
828
850
|
beside it (`isCompactNarrow`), not at one form width whatever its labels are. */
|
|
829
|
-
var
|
|
851
|
+
var _12 = (0, react_2.useState)(compactRowStyles_1.COMPACT_LABEL_COL), compactLabelColumn = _12[0], setCompactLabelColumn = _12[1];
|
|
830
852
|
// the label column holds a finger's help button where the pointer is a finger (`labelAffordanceWidth`)
|
|
831
853
|
var coarsePointer = (0, useCoarsePointer_1.useCoarsePointer)();
|
|
832
854
|
var compactNarrow = !!compactWrapWidth && (0, compactRowStyles_1.isCompactNarrow)(compactWrapWidth, compactLabelColumn);
|
|
@@ -844,7 +866,7 @@ var FormEngineImpl = function (_a) {
|
|
|
844
866
|
a search row and a field picker that each hide themselves when they have
|
|
845
867
|
nothing to say, and what is left wraps differently at every form width.
|
|
846
868
|
Zero when this form draws no toolbar at all. */
|
|
847
|
-
var
|
|
869
|
+
var _13 = (0, react_2.useState)(0), compactToolbarHeight = _13[0], setCompactToolbarHeight = _13[1];
|
|
848
870
|
(0, react_2.useLayoutEffect)(function () {
|
|
849
871
|
var wrap = compactWrapNode;
|
|
850
872
|
if (!compact || !wrap || compactNested || !compactStickyBoxHeaders) {
|
|
@@ -884,6 +906,38 @@ var FormEngineImpl = function (_a) {
|
|
|
884
906
|
the ResizeObserver never fires and a stale 124px would go on offsetting
|
|
885
907
|
the box headers below a toolbar that is no longer there. */
|
|
886
908
|
}, [compact, compactNested, compactStickyBoxHeaders, compactNarrow, compactWrapNode, options]);
|
|
909
|
+
/* The colour a calm form sits on, for its pinned toolbar's glass.
|
|
910
|
+
|
|
911
|
+
A calm form has no surface of its own, so the toolbar has to paint one to
|
|
912
|
+
keep the rows that scroll under it from showing through the meter and the
|
|
913
|
+
search — and it has to be the host's colour, or it draws a band across the
|
|
914
|
+
form before anything has moved. The host is whatever paints first above the
|
|
915
|
+
form: the page, a drawer's panel surface, a card. Read once it mounts (and
|
|
916
|
+
when the theme changes), not assumed from the theme's main colour. */
|
|
917
|
+
var _14 = (0, react_2.useState)(), compactHostColour = _14[0], setCompactHostColour = _14[1];
|
|
918
|
+
(0, react_2.useLayoutEffect)(function () {
|
|
919
|
+
if (!calm || !compact || compactNested || !compactWrapNode) {
|
|
920
|
+
setCompactHostColour(undefined);
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
var _loop_1 = function (node) {
|
|
924
|
+
var _a = (getComputedStyle(node).backgroundColor.match(/[\d.]+/g) || [])
|
|
925
|
+
.slice(0, 4)
|
|
926
|
+
.map(Number), r = _a[0], g = _a[1], b = _a[2], _b = _a[3], alpha = _b === void 0 ? 1 : _b;
|
|
927
|
+
if (alpha > 0 && b !== undefined) {
|
|
928
|
+
setCompactHostColour(function (prev) {
|
|
929
|
+
return (prev === null || prev === void 0 ? void 0 : prev[0]) === r && (prev === null || prev === void 0 ? void 0 : prev[1]) === g && (prev === null || prev === void 0 ? void 0 : prev[2]) === b ? prev : [r, g, b];
|
|
930
|
+
});
|
|
931
|
+
return { value: void 0 };
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
for (var node = compactWrapNode.parentElement; node; node = node.parentElement) {
|
|
935
|
+
var state_1 = _loop_1(node);
|
|
936
|
+
if (typeof state_1 === "object")
|
|
937
|
+
return state_1.value;
|
|
938
|
+
}
|
|
939
|
+
setCompactHostColour(undefined);
|
|
940
|
+
}, [calm, compact, compactNested, compactWrapNode, theme]);
|
|
887
941
|
// Global label-column sizing: size the label column to the WIDEST field label
|
|
888
942
|
// across the whole form, clamped to [MIN, MAX], and publish it as a CSS var on
|
|
889
943
|
// the scroll wrap. Both the grid column and the value-surface offsets read the
|
|
@@ -932,8 +986,8 @@ var FormEngineImpl = function (_a) {
|
|
|
932
986
|
var readRowHeights = (0, react_2.useRef)({});
|
|
933
987
|
// Required-groups linkage: hovering a group chip highlights every member row;
|
|
934
988
|
// clicking a sibling in the chip's popover scrolls to it and flashes it.
|
|
935
|
-
var
|
|
936
|
-
var
|
|
989
|
+
var _15 = (0, react_2.useState)([]), highlightedOptions = _15[0], setHighlightedOptions = _15[1];
|
|
990
|
+
var _16 = (0, react_2.useState)([]), flashedOptions = _16[0], setFlashedOptions = _16[1];
|
|
937
991
|
var flashTimeout = (0, react_2.useRef)();
|
|
938
992
|
var flashOptions = (0, react_2.useCallback)(function (optionNames, scrollToFirst) {
|
|
939
993
|
if (scrollToFirst === void 0) { scrollToFirst = false; }
|
|
@@ -985,16 +1039,16 @@ var FormEngineImpl = function (_a) {
|
|
|
985
1039
|
}
|
|
986
1040
|
});
|
|
987
1041
|
// Info panels auto-open on Tier-1 content; the per-row user override sticks.
|
|
988
|
-
var
|
|
1042
|
+
var _17 = (0, react_2.useState)({}), infoPanelOverrides = _17[0], setInfoPanelOverrides = _17[1];
|
|
989
1043
|
// Toolbar filters affect the listed rows only — the meter reflects the full set.
|
|
990
|
-
var
|
|
991
|
-
var
|
|
1044
|
+
var _18 = (0, react_2.useState)(false), requiredOnly = _18[0], setRequiredOnly = _18[1];
|
|
1045
|
+
var _19 = (0, react_2.useState)(''), compactQuery = _19[0], setCompactQuery = _19[1];
|
|
992
1046
|
// Compact field sort (Fields menu → "Sort by"); 'schema' = declared order.
|
|
993
|
-
var
|
|
994
|
-
var
|
|
1047
|
+
var _20 = (0, react_2.useState)('schema'), compactSort = _20[0], setCompactSort = _20[1];
|
|
1048
|
+
var _21 = (0, react_2.useState)(function () { return ({
|
|
995
1049
|
fields: (0, exports.fixOptions)(value, options || {}, undefined, isRendererOnly),
|
|
996
1050
|
meta: undefined,
|
|
997
|
-
}); }), localValue =
|
|
1051
|
+
}); }), localValue = _21[0], setLocalValue = _21[1];
|
|
998
1052
|
var originalValue = (0, react_2.useRef)();
|
|
999
1053
|
// Track the last value we emitted via onChange so we can skip re-applying fixOptions
|
|
1000
1054
|
// when the parent echoes it back as the new value prop (controlled component loop prevention)
|
|
@@ -1052,7 +1106,7 @@ var FormEngineImpl = function (_a) {
|
|
|
1052
1106
|
originalValue.current = localValue.fields;
|
|
1053
1107
|
}
|
|
1054
1108
|
var unavailableOptionsCount = (0, react_2.useRef)(0);
|
|
1055
|
-
var
|
|
1109
|
+
var _22 = (0, useQorusTypes_1.useQorusTypes)(), compactValue = _22.compactValue, typesLoading = _22.loading;
|
|
1056
1110
|
// an option's type in words, while the form shows field types (qorus#646: it said the type's code, `<string>`)
|
|
1057
1111
|
var typeName = (0, typeSentenceForm_1.useTypeName)();
|
|
1058
1112
|
var templates = (0, useTemplates_1.useTemplates)(allowTemplates, stringTemplates, interfaceContext);
|
|
@@ -1795,6 +1849,11 @@ var FormEngineImpl = function (_a) {
|
|
|
1795
1849
|
return newValue;
|
|
1796
1850
|
}
|
|
1797
1851
|
if (showInvalidOptionsOnly &&
|
|
1852
|
+
// An open row stays while the reader is in it, as its box does
|
|
1853
|
+
// (`stableBucketOf`): the first character typed into an empty required
|
|
1854
|
+
// field makes it valid, and hiding it then would pull the field out
|
|
1855
|
+
// from under the caret mid-word.
|
|
1856
|
+
!expandedOptions.includes(optionName) &&
|
|
1798
1857
|
isOptionValid(optionName, (0, exports.getOptionFieldStorageType)(optionName, option.type, options, operators, option.op, isRendererOnly, optionHoldsExpression(option)), option.value)) {
|
|
1799
1858
|
return newValue;
|
|
1800
1859
|
}
|
|
@@ -1803,6 +1862,7 @@ var FormEngineImpl = function (_a) {
|
|
|
1803
1862
|
}, [
|
|
1804
1863
|
dependencyLockedNames,
|
|
1805
1864
|
showInvalidOptionsOnly,
|
|
1865
|
+
expandedOptions,
|
|
1806
1866
|
isRendererOnly,
|
|
1807
1867
|
JSON.stringify(availableOptions),
|
|
1808
1868
|
JSON.stringify(options),
|
|
@@ -1858,8 +1918,11 @@ var FormEngineImpl = function (_a) {
|
|
|
1858
1918
|
covered: covered,
|
|
1859
1919
|
invalid: invalid,
|
|
1860
1920
|
warned: msgIntent === 'warning',
|
|
1921
|
+
visited: revealRequired || visitedOptions.includes(name),
|
|
1861
1922
|
});
|
|
1862
1923
|
}, [
|
|
1924
|
+
revealRequired,
|
|
1925
|
+
visitedOptions,
|
|
1863
1926
|
isRendererOnly,
|
|
1864
1927
|
JSON.stringify(options),
|
|
1865
1928
|
JSON.stringify(availableOptions),
|
|
@@ -1889,6 +1952,23 @@ var FormEngineImpl = function (_a) {
|
|
|
1889
1952
|
// a hidden field (its `depends_on` does not hold) is not in the form, nor in its counts
|
|
1890
1953
|
function (name) { return !dependencyLockedNames.includes(name) && getOptionBucket(name) === 'attention'; }).length;
|
|
1891
1954
|
}, [JSON.stringify(availableOptions), getOptionBucket, dependencyLockedNames]);
|
|
1955
|
+
// How many of those are faults rather than only still to fill in (`pending`). Zero
|
|
1956
|
+
// on a new form, so its first box reads "To fill in" without amber.
|
|
1957
|
+
var readFirstAttentionFaultCount = (0, react_2.useMemo)(function () {
|
|
1958
|
+
return Object.keys(availableOptions || {}).filter(function (name) { return getOptionBucket(name) === 'attention' && getOptionStatus(name) !== 'pending'; }).length;
|
|
1959
|
+
}, [JSON.stringify(availableOptions), getOptionBucket, getOptionStatus]);
|
|
1960
|
+
// The same two numbers, to a host that draws its own submit control from them.
|
|
1961
|
+
var onAttentionChangeRef = (0, react_2.useRef)(onAttentionChange);
|
|
1962
|
+
onAttentionChangeRef.current = onAttentionChange;
|
|
1963
|
+
// What the host found wrong outside the fields: in the line and in what the host is told.
|
|
1964
|
+
var outsideAttentionCount = Math.max(0, (_b = outsideAttention === null || outsideAttention === void 0 ? void 0 : outsideAttention.count) !== null && _b !== void 0 ? _b : 0);
|
|
1965
|
+
(0, react_2.useEffect)(function () {
|
|
1966
|
+
var _a;
|
|
1967
|
+
(_a = onAttentionChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onAttentionChangeRef, {
|
|
1968
|
+
count: readFirstAttentionCount + outsideAttentionCount,
|
|
1969
|
+
faults: readFirstAttentionFaultCount + outsideAttentionCount,
|
|
1970
|
+
});
|
|
1971
|
+
}, [readFirstAttentionCount, readFirstAttentionFaultCount, outsideAttentionCount]);
|
|
1892
1972
|
var getIntent = (0, react_2.useCallback)(
|
|
1893
1973
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1894
1974
|
function (optName, type, optValue, _op) {
|
|
@@ -2159,7 +2239,7 @@ var FormEngineImpl = function (_a) {
|
|
|
2159
2239
|
}
|
|
2160
2240
|
hasAutoFocusedRef.current = true;
|
|
2161
2241
|
var entered = event.target;
|
|
2162
|
-
if ((0,
|
|
2242
|
+
if ((0, rowFocus_2.isTypingControl)(entered)) {
|
|
2163
2243
|
return;
|
|
2164
2244
|
}
|
|
2165
2245
|
var target = firstAttentionRow();
|
|
@@ -2187,6 +2267,48 @@ var FormEngineImpl = function (_a) {
|
|
|
2187
2267
|
compactWrapNode.removeEventListener('focusin', onFocusIn);
|
|
2188
2268
|
};
|
|
2189
2269
|
}, [autoFocusFirstRequired, compact, compactWrapNode]);
|
|
2270
|
+
// A submit that could not go is answered with where to type: each new
|
|
2271
|
+
// `focusAttentionRequest` opens the first field that needs attention and puts the
|
|
2272
|
+
// caret in it. The host's submit button holds the caret at that moment, and an open
|
|
2273
|
+
// row never takes a caret held outside it (CompactRow), so the button lets go of it
|
|
2274
|
+
// here first; the person asked to submit, and this is the answer to that. It picks
|
|
2275
|
+
// the field the arrival scan above would (`firstAttentionRow`), and spends that scan:
|
|
2276
|
+
// the person has been taken to a field now.
|
|
2277
|
+
var lastFocusRequest = (0, react_2.useRef)(focusAttentionRequest);
|
|
2278
|
+
(0, react_2.useEffect)(function () {
|
|
2279
|
+
var _a;
|
|
2280
|
+
if (focusAttentionRequest === lastFocusRequest.current) {
|
|
2281
|
+
return;
|
|
2282
|
+
}
|
|
2283
|
+
lastFocusRequest.current = focusAttentionRequest;
|
|
2284
|
+
if (!focusAttentionRequest || !compact || !options) {
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
var target = firstAttentionRow();
|
|
2288
|
+
if (!target) {
|
|
2289
|
+
return;
|
|
2290
|
+
}
|
|
2291
|
+
hasAutoFocusedRef.current = true;
|
|
2292
|
+
var wrap = compactWrapNodeRef.current;
|
|
2293
|
+
var active = document.activeElement;
|
|
2294
|
+
if (active && active !== document.body && !(wrap === null || wrap === void 0 ? void 0 : wrap.contains(active))) {
|
|
2295
|
+
active.blur();
|
|
2296
|
+
}
|
|
2297
|
+
if (!expandedOptions.includes(target)) {
|
|
2298
|
+
// The row's own open effect reveals it and takes the caret.
|
|
2299
|
+
openFirstAttentionRow(target);
|
|
2300
|
+
return;
|
|
2301
|
+
}
|
|
2302
|
+
// Already open (the field the form opened on arrival): its open effect has run,
|
|
2303
|
+
// so the caret goes to its control here.
|
|
2304
|
+
var row = wrap === null || wrap === void 0 ? void 0 : wrap.querySelector("[data-field=\"".concat(target, "\"]"));
|
|
2305
|
+
if (row) {
|
|
2306
|
+
(0, revealRow_1.revealRow)(row, 'auto');
|
|
2307
|
+
(_a = (0, rowFocus_1.findRowFocusTarget)(row.querySelector('.options-readfirst-row-editor'), {
|
|
2308
|
+
textEntryOnly: row.classList.contains('options-readfirst-card'),
|
|
2309
|
+
})) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
2310
|
+
}
|
|
2311
|
+
}, [focusAttentionRequest]);
|
|
2190
2312
|
// Read-first completion summary (how many shown options have a value set),
|
|
2191
2313
|
// surfaced as a progress meter at the top of the compact form.
|
|
2192
2314
|
var readFirstCompletion = (0, react_2.useMemo)(function () {
|
|
@@ -2362,7 +2484,7 @@ var FormEngineImpl = function (_a) {
|
|
|
2362
2484
|
return null;
|
|
2363
2485
|
var items = schemaMsgs.map(function (_a, index) {
|
|
2364
2486
|
var intent = _a.intent, title = _a.title, content = _a.content;
|
|
2365
|
-
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { intent: intent, title: title, opaque: false, size: 'small',
|
|
2487
|
+
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { intent: (0, formAppearance_1.calmNoteIntent)(intent, calm), title: title, opaque: false, size: 'small',
|
|
2366
2488
|
// Compact: flat (no border) to match the read-row info panels;
|
|
2367
2489
|
// classic forms keep the bordered, bottom-margined message.
|
|
2368
2490
|
flat: compact || undefined, margin: compact ? undefined : 'bottom', children: content }, title || index));
|
|
@@ -2462,7 +2584,10 @@ var FormEngineImpl = function (_a) {
|
|
|
2462
2584
|
readOnly ||
|
|
2463
2585
|
!(0, validations_1.hasAllDependenciesFullfilled)((_v = options === null || options === void 0 ? void 0 : options[optionName]) === null || _v === void 0 ? void 0 : _v.depends_on, availableOptions, options || {}), readOnly: readOnly, size: editorSize || rest.size, menuItems: (0, typeChoices_1.offersTypeChoices)(options === null || options === void 0 ? void 0 : options[optionName], anyLikeUiTypes) ?
|
|
2464
2586
|
getCustomMenuTemplateItems(optionName)
|
|
2465
|
-
: 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, isRendererOnly: isRendererOnly
|
|
2587
|
+
: 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, isRendererOnly: isRendererOnly,
|
|
2588
|
+
// Open is not left: a field the form opened for typing (the first empty
|
|
2589
|
+
// one, on a new form) says what it needs without already being wrong.
|
|
2590
|
+
requirementPending: !(revealRequired || visitedOptions.includes(optionName)) }), operators && (0, size_1.default)(operators) && (0, size_1.default)(other.op) ?
|
|
2466
2591
|
(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', className: 'options-operator-summary', children: (0, operatorSummary_1.operatorSummary)({
|
|
2467
2592
|
label: (optionSchema === null || optionSchema === void 0 ? void 0 : optionSchema.display_name) || optionName,
|
|
2468
2593
|
operatorKeys: operatorParts,
|
|
@@ -2496,10 +2621,12 @@ var FormEngineImpl = function (_a) {
|
|
|
2496
2621
|
getTypeForOption,
|
|
2497
2622
|
inheritedScopes,
|
|
2498
2623
|
inheritedFromParent,
|
|
2624
|
+
revealRequired,
|
|
2625
|
+
visitedOptions,
|
|
2499
2626
|
]);
|
|
2500
2627
|
// Compact (read-first) rendering.
|
|
2501
2628
|
// Theme-derived colors so the flat-row layout adapts to light/dark/custom themes.
|
|
2502
|
-
var cText = ((
|
|
2629
|
+
var cText = ((_c = theme === null || theme === void 0 ? void 0 : theme.text) === null || _c === void 0 ? void 0 : _c.color) || '#f1f0ee';
|
|
2503
2630
|
// Text emphasis tiers via reqore's readable-color helper (key = full readable
|
|
2504
2631
|
// text, muted = its dimmed variant, faint = the dimmed variant softened
|
|
2505
2632
|
// further) instead of hand-rolled hex-alpha suffixes on the raw text color.
|
|
@@ -2508,10 +2635,12 @@ var FormEngineImpl = function (_a) {
|
|
|
2508
2635
|
var cFaint = "".concat(cMuted, "99");
|
|
2509
2636
|
var cDivider = "".concat(cText, "14");
|
|
2510
2637
|
var cHover = "".concat(cText, "0d");
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
var
|
|
2514
|
-
var
|
|
2638
|
+
// Calm: the intents as words that read on the section surface, not the
|
|
2639
|
+
// theme's fills (see `getCalmIntentText`). Dots and edges take them too.
|
|
2640
|
+
var cDanger = calm ? (0, formAppearance_1.getCalmIntentText)(theme, 'danger') : ((_d = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _d === void 0 ? void 0 : _d.danger) || '#e35a5a';
|
|
2641
|
+
var cWarning = calm ? (0, formAppearance_1.getCalmIntentText)(theme, 'warning') : ((_f = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _f === void 0 ? void 0 : _f.warning) || '#ffdf34';
|
|
2642
|
+
var cInfo = ((_g = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _g === void 0 ? void 0 : _g.info) || '#3b8eea';
|
|
2643
|
+
var cSuccess = ((_h = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _h === void 0 ? void 0 : _h.success) || '#36b37e';
|
|
2515
2644
|
// the rows' own words and marks, in colors that read on every surface a row is drawn on
|
|
2516
2645
|
var rowInks = (0, react_2.useMemo)(function () { return (0, readFirstColors_1.getReadFirstInks)(theme); }, [theme]);
|
|
2517
2646
|
// an option panel's short description, faint: as faint as it still reads in the theme
|
|
@@ -2527,6 +2656,10 @@ var FormEngineImpl = function (_a) {
|
|
|
2527
2656
|
// The "N more fields" row's dashed edge. Well above the divider tint: this
|
|
2528
2657
|
// one is an affordance the reader has to notice, not a hairline between rows.
|
|
2529
2658
|
var cMoreBorder = "".concat(cText, "4d");
|
|
2659
|
+
// Calm: the section surface and its hairline, from the theme's panel (the
|
|
2660
|
+
// same surface and edge Reqore gives the section panels themselves).
|
|
2661
|
+
var cPanel = (0, formAppearance_1.getCalmPanelSurface)(theme);
|
|
2662
|
+
var cHairline = (0, formAppearance_1.getCalmPanelHairline)(theme);
|
|
2530
2663
|
// The closure surface the extracted CompactRow reads through context. Refs and
|
|
2531
2664
|
// setters are stable; the state/memo/handler fields change identity as they do
|
|
2532
2665
|
// today, so a row re-renders exactly when its inputs do.
|
|
@@ -2546,6 +2679,8 @@ var FormEngineImpl = function (_a) {
|
|
|
2546
2679
|
cardEditorTypes: cardEditorTypes,
|
|
2547
2680
|
showAllDescriptions: showAllDescriptions,
|
|
2548
2681
|
expandedOptions: expandedOptions,
|
|
2682
|
+
visitedOptions: visitedOptions,
|
|
2683
|
+
revealRequired: revealRequired,
|
|
2549
2684
|
highlightedOptions: highlightedOptions,
|
|
2550
2685
|
flashedOptions: flashedOptions,
|
|
2551
2686
|
infoPanelOverrides: infoPanelOverrides,
|
|
@@ -2598,6 +2733,8 @@ var FormEngineImpl = function (_a) {
|
|
|
2598
2733
|
cardEditorTypes,
|
|
2599
2734
|
showAllDescriptions,
|
|
2600
2735
|
expandedOptions,
|
|
2736
|
+
visitedOptions,
|
|
2737
|
+
revealRequired,
|
|
2601
2738
|
highlightedOptions,
|
|
2602
2739
|
flashedOptions,
|
|
2603
2740
|
infoPanelOverrides,
|
|
@@ -2641,13 +2778,22 @@ var FormEngineImpl = function (_a) {
|
|
|
2641
2778
|
var compactToolbarParts = (0, react_2.useMemo)(function () {
|
|
2642
2779
|
if (compactToolbar === false)
|
|
2643
2780
|
return null;
|
|
2781
|
+
// A calm sub-form nested in a row (a list item, a hash field) draws only its
|
|
2782
|
+
// fields. Its readiness is said once, by the item it sits in, and each row
|
|
2783
|
+
// says what it lacks; a search over two to six fields helps nobody, and one
|
|
2784
|
+
// per item stacked a second search box under the form's own for every item.
|
|
2785
|
+
if (calm && compactNested)
|
|
2786
|
+
return null;
|
|
2644
2787
|
var all = { completion: true, search: true, fields: true, help: true };
|
|
2645
2788
|
return compactToolbar === true ? all : __assign(__assign({}, all), compactToolbar);
|
|
2646
|
-
}, [JSON.stringify(compactToolbar)]);
|
|
2789
|
+
}, [JSON.stringify(compactToolbar), calm, compactNested]);
|
|
2647
2790
|
var compactToolbarContextValue = (0, react_2.useMemo)(function () { return ({
|
|
2648
2791
|
readOnly: readOnly,
|
|
2649
2792
|
invalidCount: (0, size_1.default)(validityData.invalidFields),
|
|
2650
2793
|
attentionCount: readFirstAttentionCount,
|
|
2794
|
+
attentionFaultCount: readFirstAttentionFaultCount,
|
|
2795
|
+
outsideAttentionCount: outsideAttentionCount,
|
|
2796
|
+
onRevealOutside: outsideAttention === null || outsideAttention === void 0 ? void 0 : outsideAttention.onReveal,
|
|
2651
2797
|
completion: readFirstCompletion,
|
|
2652
2798
|
showInvalidOnly: showInvalidOptionsOnly,
|
|
2653
2799
|
onToggleInvalidOnly: handleToggleInvalidOnly,
|
|
@@ -2694,6 +2840,7 @@ var FormEngineImpl = function (_a) {
|
|
|
2694
2840
|
onReadOnlyActivate,
|
|
2695
2841
|
validityData,
|
|
2696
2842
|
readFirstAttentionCount,
|
|
2843
|
+
readFirstAttentionFaultCount,
|
|
2697
2844
|
readFirstCompletion,
|
|
2698
2845
|
showInvalidOptionsOnly,
|
|
2699
2846
|
handleToggleInvalidOnly,
|
|
@@ -2723,8 +2870,12 @@ var FormEngineImpl = function (_a) {
|
|
|
2723
2870
|
// removes it, and then the header carries just the consumer's own actions.
|
|
2724
2871
|
var compactHeaderActions = (0, react_2.useMemo)(function () { return __spreadArray(__spreadArray([], (compactToolbarParts ? [{ as: CompactToolbar_1.CompactToolbar, responsive: false }] : []), true), ((compactPanelProps === null || compactPanelProps === void 0 ? void 0 : compactPanelProps.actions) || []), true); }, [compactPanelProps === null || compactPanelProps === void 0 ? void 0 : compactPanelProps.actions, compactToolbarParts]);
|
|
2725
2872
|
var renderCompact = function () {
|
|
2726
|
-
var _a, _b, _c, _d;
|
|
2727
|
-
|
|
2873
|
+
var _a, _b, _c, _d, _f;
|
|
2874
|
+
// Calm: the host's own colour (see `compactHostColour`), so the pinned
|
|
2875
|
+
// toolbar's glass is invisible until something scrolls under it.
|
|
2876
|
+
var headerBg = calm && compactHostColour ?
|
|
2877
|
+
"rgba(".concat(compactHostColour.join(', '), ", 0.88)")
|
|
2878
|
+
: "".concat(calm ? (0, colors_1.getMainBackgroundColor)(theme) : (0, colors_1.changeDarkness)((0, colors_1.getMainBackgroundColor)(theme), 0.02)).concat((0, colors_1.percentToHexAlpha)(88));
|
|
2728
2879
|
// Toolbar filters narrow the listed rows; the meter reflects the full set.
|
|
2729
2880
|
var query = compactQuery.trim().toLowerCase();
|
|
2730
2881
|
var matchesQuery = function (optionName) { var _a; return !query || (((_a = options === null || options === void 0 ? void 0 : options[optionName]) === null || _a === void 0 ? void 0 : _a.display_name) || optionName).toLowerCase().includes(query); };
|
|
@@ -2953,21 +3104,29 @@ var FormEngineImpl = function (_a) {
|
|
|
2953
3104
|
var stickyBoxHeaders = compactStickyBoxHeaders && !compactNested;
|
|
2954
3105
|
var boxStickyOffset = compactStickyOffset + compactToolbarHeight;
|
|
2955
3106
|
var STATUS_BOXES = [
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
3107
|
+
// The first box is amber only once something in it is a fault. On a new form it
|
|
3108
|
+
// holds the required fields still to fill in, which is not yet anything wrong.
|
|
3109
|
+
readFirstAttentionFaultCount ?
|
|
3110
|
+
{
|
|
3111
|
+
key: 'attention',
|
|
3112
|
+
label: (_a = compactBoxLabels === null || compactBoxLabels === void 0 ? void 0 : compactBoxLabels.attention) !== null && _a !== void 0 ? _a : feWords.boxAttention,
|
|
3113
|
+
intent: 'warning',
|
|
3114
|
+
icon: 'ErrorWarningLine',
|
|
3115
|
+
}
|
|
3116
|
+
: {
|
|
3117
|
+
key: 'attention',
|
|
3118
|
+
label: (_b = compactBoxLabels === null || compactBoxLabels === void 0 ? void 0 : compactBoxLabels.pending) !== null && _b !== void 0 ? _b : feWords.boxPending,
|
|
3119
|
+
icon: 'CheckboxBlankCircleLine',
|
|
3120
|
+
},
|
|
2962
3121
|
{
|
|
2963
3122
|
key: 'set',
|
|
2964
|
-
label: (
|
|
3123
|
+
label: (_c = compactBoxLabels === null || compactBoxLabels === void 0 ? void 0 : compactBoxLabels.set) !== null && _c !== void 0 ? _c : feWords.boxSet,
|
|
2965
3124
|
intent: 'success',
|
|
2966
3125
|
icon: 'CheckLine',
|
|
2967
3126
|
},
|
|
2968
3127
|
{
|
|
2969
3128
|
key: 'optional',
|
|
2970
|
-
label: (
|
|
3129
|
+
label: (_d = compactBoxLabels === null || compactBoxLabels === void 0 ? void 0 : compactBoxLabels.optional) !== null && _d !== void 0 ? _d : feWords.boxOptional,
|
|
2971
3130
|
icon: 'CheckboxBlankCircleLine',
|
|
2972
3131
|
},
|
|
2973
3132
|
];
|
|
@@ -3017,7 +3176,13 @@ var FormEngineImpl = function (_a) {
|
|
|
3017
3176
|
// "Covers"/"Covered by" chips already say which member satisfies it.
|
|
3018
3177
|
if (requiredGroupsInfo.satisfiedBy[grp])
|
|
3019
3178
|
return railed;
|
|
3020
|
-
|
|
3179
|
+
// Amber once someone has been to the group (or a submit was attempted); until
|
|
3180
|
+
// then it is still to fill in, in the quiet colour, like its members.
|
|
3181
|
+
var clusterVisited = memberEntries.some(function (e) { return getOptionStatus(e.name) !== 'pending'; });
|
|
3182
|
+
var clusterColor = clusterVisited ? cWarning : cMuted;
|
|
3183
|
+
// its words and mark: the same colour, in the shade of it that reads on the tint
|
|
3184
|
+
var clusterInk = clusterVisited ? rowInks.warning : rowInks.mutedReason;
|
|
3185
|
+
return ((0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRequiredClusterBox, { className: 'options-readfirst-required-cluster', "$border": "".concat(clusterColor, "33"), "$tint": "".concat(clusterColor, "0d"), "$calm": calm, children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRequiredClusterHeader, { className: 'options-readfirst-required-cluster-header', "$color": clusterInk, "$calm": calm, children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'LinkM', size: calm ? '13px' : '11px', style: { color: clusterInk } }), feWords.oneOfRequired] }), railed] }, grp));
|
|
3021
3186
|
});
|
|
3022
3187
|
};
|
|
3023
3188
|
// One schema group inside a status box: its thin sub-label, the group's
|
|
@@ -3028,32 +3193,111 @@ var FormEngineImpl = function (_a) {
|
|
|
3028
3193
|
can be split across the shown and folded halves of a capped box, and its
|
|
3029
3194
|
label must appear above whichever half holds its first row. */
|
|
3030
3195
|
var renderBoxGroup = function (boxKey, groupName, only) {
|
|
3031
|
-
var groupConfig = groups === null || groups === void 0 ? void 0 : groups[groupName];
|
|
3032
3196
|
var rows = only ?
|
|
3033
3197
|
(buckets[boxKey][groupName] || []).filter(function (entry) { return only.has(entry.name); })
|
|
3034
3198
|
: buckets[boxKey][groupName];
|
|
3035
3199
|
if (only && !rows.length) {
|
|
3036
3200
|
return null;
|
|
3037
3201
|
}
|
|
3202
|
+
return renderGroupBlock(groupName, rows);
|
|
3203
|
+
};
|
|
3204
|
+
/** A group's sub-label, subtitle and rows. `key` tells two halves of one
|
|
3205
|
+
group apart when both render in the same body. */
|
|
3206
|
+
var renderGroupBlock = function (groupName, rows, key) {
|
|
3207
|
+
if (key === void 0) { key = groupName; }
|
|
3208
|
+
var groupConfig = groups === null || groups === void 0 ? void 0 : groups[groupName];
|
|
3038
3209
|
return ((0, jsx_runtime_1.jsxs)(react_2.default.Fragment, { children: [showGroupSubLabel(groupName) ?
|
|
3039
|
-
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledStatusBoxGroupLabel, { children: (0, readFirst_1.getOptionGroupLabel)(groupName, groups) })
|
|
3210
|
+
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledStatusBoxGroupLabel, { className: 'options-readfirst-group-label', "$calm": calm, "$color": cKey, children: (0, readFirst_1.getOptionGroupLabel)(groupName, groups) })
|
|
3040
3211
|
: null, showGroupSubLabel(groupName) && (groupConfig === null || groupConfig === void 0 ? void 0 : groupConfig.subtitle) ?
|
|
3041
|
-
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreP, { size: 'small', effect: { opacity: 0.6 }, style:
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3212
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreP, { className: 'options-readfirst-group-subtitle', size: 'small', effect: { opacity: 0.6 }, style: calm ?
|
|
3213
|
+
// Under the calm heading, at the rows' inset; the space below
|
|
3214
|
+
// it is the next row's own padding.
|
|
3215
|
+
{ margin: 0, padding: "2px ".concat(compactRowStyles_1.CALM_SECTION_INSET, "px 4px") }
|
|
3216
|
+
: {
|
|
3217
|
+
marginTop: 2,
|
|
3218
|
+
marginBottom: 8,
|
|
3219
|
+
marginLeft: compactRowStyles_1.GROUP_INDENT,
|
|
3220
|
+
paddingRight: 10,
|
|
3221
|
+
}, children: groupConfig.subtitle })
|
|
3222
|
+
: null, renderGroupRows(rows)] }, key));
|
|
3223
|
+
};
|
|
3224
|
+
/** The "N more fields" control: a quiet last row of the body it folds. */
|
|
3225
|
+
var renderMoreRow = function (boxKey, count, open) { return ((0, jsx_runtime_1.jsxs)("button", { type: 'button', className: 'readfirst-row readfirst-more-row options-readfirst-more', "aria-expanded": open, onClick: function () {
|
|
3226
|
+
return setExpandedMoreBoxes(function (prev) {
|
|
3227
|
+
return prev.includes(boxKey) ? prev.filter(function (k) { return k !== boxKey; }) : __spreadArray(__spreadArray([], prev, true), [boxKey], false);
|
|
3228
|
+
});
|
|
3229
|
+
}, children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreP, { size: 'small', effect: { opacity: 0.8 }, children: open ? feWords.showFewer : feWords.moreFields(count, boxKey === 'optional') }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'ArrowDownSLine', size: 'small', className: 'readfirst-more-chevron', effect: { opacity: 0.8 } })] })); };
|
|
3230
|
+
var groupBodyProps = {
|
|
3231
|
+
$calm: calm,
|
|
3232
|
+
$hairline: cHairline,
|
|
3233
|
+
$divider: cDivider,
|
|
3234
|
+
$hover: cHover,
|
|
3235
|
+
$focus: cWarning,
|
|
3236
|
+
$success: cSuccess,
|
|
3237
|
+
$rowBg: cRowBg,
|
|
3238
|
+
$lineColor: cGroupLine,
|
|
3239
|
+
$moreBorder: cMoreBorder,
|
|
3240
|
+
};
|
|
3241
|
+
/* Calm, nested in a row (a list item, a hash field's sub-form): the item is
|
|
3242
|
+
already the card, so its fields sit in it directly instead of in status
|
|
3243
|
+
boxes, which drew a card inside the card. In schema order, so a row does
|
|
3244
|
+
not move to another box under the caret as it is filled; a row that lacks
|
|
3245
|
+
a value still says so where the value would be. The fields nobody has
|
|
3246
|
+
added fold behind one quiet last row, the same control a capped box ends
|
|
3247
|
+
with — and when nothing else is listed they ARE the form, so they show. */
|
|
3248
|
+
var renderNestedRows = function () {
|
|
3249
|
+
// Fields with no named group are one list here. The engine files them under
|
|
3250
|
+
// two synthetic keys (the required ones and the rest), which the boxes
|
|
3251
|
+
// never showed; in one list that split put a set Description above an
|
|
3252
|
+
// empty Method Name. Named groups keep their sub-labels and their order.
|
|
3253
|
+
var UNLABELLED = '';
|
|
3254
|
+
var keyOf = function (groupName) { return (showGroupSubLabel(groupName) ? groupName : UNLABELLED); };
|
|
3255
|
+
var nestedKeys = (0, lodash_1.uniq)(groupKeys.map(keyOf));
|
|
3256
|
+
var listedByGroup = {};
|
|
3257
|
+
var addableByGroup = {};
|
|
3258
|
+
groupKeys.forEach(function (groupName) {
|
|
3259
|
+
grouped[groupName].forEach(function (entry) {
|
|
3260
|
+
var _a;
|
|
3261
|
+
var target = entry.hidden ? addableByGroup : listedByGroup;
|
|
3262
|
+
(target[_a = keyOf(groupName)] || (target[_a] = [])).push(entry);
|
|
3263
|
+
});
|
|
3264
|
+
});
|
|
3265
|
+
// In the schema's order, not the order the values arrived in.
|
|
3266
|
+
var schemaOrder = Object.keys(options || {});
|
|
3267
|
+
var bySchema = function (a, b) {
|
|
3268
|
+
return schemaOrder.indexOf(a.name) - schemaOrder.indexOf(b.name);
|
|
3269
|
+
};
|
|
3270
|
+
(0, lodash_1.forEach)(listedByGroup, function (rows) { return rows.sort(bySchema); });
|
|
3271
|
+
(0, lodash_1.forEach)(addableByGroup, function (rows) { return rows.sort(bySchema); });
|
|
3272
|
+
var renderNestedGroup = function (key, rows, half) {
|
|
3273
|
+
return key === UNLABELLED ?
|
|
3274
|
+
(0, jsx_runtime_1.jsx)(react_2.default.Fragment, { children: renderGroupRows(rows) }, "".concat(half, "-fields"))
|
|
3275
|
+
: renderGroupBlock(key, rows, "".concat(half, "-").concat(key));
|
|
3276
|
+
};
|
|
3277
|
+
var listedGroups = nestedKeys.filter(function (key) { var _a; return (_a = listedByGroup[key]) === null || _a === void 0 ? void 0 : _a.length; });
|
|
3278
|
+
var addableGroups = nestedKeys.filter(function (key) { var _a; return (_a = addableByGroup[key]) === null || _a === void 0 ? void 0 : _a.length; });
|
|
3279
|
+
var addableCount = addableGroups.reduce(function (total, key) { return total + addableByGroup[key].length; }, 0);
|
|
3280
|
+
var folds = listedGroups.length > 0;
|
|
3281
|
+
var addableOpen = !folds || expandedMoreBoxes.includes('optional');
|
|
3282
|
+
return ((0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledGroupBody, __assign({}, groupBodyProps, { className: "readfirst-nested-list".concat(compactNarrow ? ' readfirst-narrow' : ''), children: [listedGroups.map(function (key) { return renderNestedGroup(key, listedByGroup[key], 'listed'); }), folds && addableCount ? renderMoreRow('optional', addableCount, addableOpen) : null, addableOpen ?
|
|
3283
|
+
addableGroups.map(function (key) { return renderNestedGroup(key, addableByGroup[key], 'addable'); })
|
|
3284
|
+
: null] })));
|
|
3048
3285
|
};
|
|
3049
3286
|
return ((0, jsx_runtime_1.jsx)(optionsContext_1.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
|
|
3050
3287
|
// Mirrors the toolbar's own search-row gate: when no search
|
|
3051
3288
|
// row renders, the header is a thin strip and sits tight to
|
|
3052
3289
|
// the first status box (see StyledCompactPanel).
|
|
3053
|
-
, __assign({ "$tightHeader": !((compactToolbarParts === null || compactToolbarParts === void 0 ? void 0 : compactToolbarParts.search) && (0, size_1.default)(options) > 1), "$headerBg": compactNested ? 'transparent' : headerBg, "$nested": compactNested, "$stickyBoxes": compactStickyBoxHeaders && !compactNested, "$stackHeader": compactNarrow &&
|
|
3290
|
+
, __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 && !compactNested, "$stackHeader": compactNarrow &&
|
|
3054
3291
|
!!((compactPanelProps === null || compactPanelProps === void 0 ? void 0 : compactPanelProps.label) ||
|
|
3055
3292
|
(compactPanelProps === null || compactPanelProps === void 0 ? void 0 : compactPanelProps.icon) ||
|
|
3056
|
-
((
|
|
3293
|
+
((_f = compactPanelProps === null || compactPanelProps === void 0 ? void 0 : compactPanelProps.actions) === null || _f === void 0 ? void 0 : _f.length)), flat: true,
|
|
3294
|
+
// Calm: no surface and no lift at all. A theme that gives
|
|
3295
|
+
// panels a surface of their own (Reqore's `theme.panel`) would
|
|
3296
|
+
// otherwise paint this wrapper as a card around the section
|
|
3297
|
+
// cards inside it. Transparent and un-raised, Reqore also drops
|
|
3298
|
+
// the wrapper's horizontal padding, so the readiness line, the
|
|
3299
|
+
// search and the sections share one left edge with the host.
|
|
3300
|
+
raised: !calm, minimal: true, transparent: calm || undefined,
|
|
3057
3301
|
// No panel background: the form sits transparently on whatever
|
|
3058
3302
|
// hosts it (page, drawer, or — for an arg_schema field — the
|
|
3059
3303
|
// parent's edit card) instead of stacking its own dark surface.
|
|
@@ -3105,117 +3349,133 @@ var FormEngineImpl = function (_a) {
|
|
|
3105
3349
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { flat: true, opaque: false, size: 'small', children: readOnly && !query ? feWords.nothingSet : feWords.noFieldsMatch })
|
|
3106
3350
|
: null, readOnly ?
|
|
3107
3351
|
bucketCount('set') ?
|
|
3108
|
-
(0, jsx_runtime_1.jsx)("div", { className: 'options-readfirst-read', style: { padding: '4px 4px 6px' }, children: (0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledGroupBody, {
|
|
3352
|
+
(0, jsx_runtime_1.jsx)("div", { className: 'options-readfirst-read', style: { padding: calm ? 0 : '4px 4px 6px' }, children: (0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledGroupBody, __assign({}, groupBodyProps, { className: "readfirst-read-list".concat(compactNarrow ? ' readfirst-narrow' : ''), children: bucketGroups.set.map(function (groupName) { return renderBoxGroup('set', groupName); }) })) })
|
|
3109
3353
|
: null
|
|
3110
|
-
:
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
.map(function (entry) { return entry.name; }));
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3354
|
+
: calm && compactNested ? renderNestedRows()
|
|
3355
|
+
: STATUS_BOXES.map(function (box) {
|
|
3356
|
+
var groupsInBox = bucketGroups[box.key];
|
|
3357
|
+
var count = bucketCount(box.key);
|
|
3358
|
+
if (!count)
|
|
3359
|
+
return null;
|
|
3360
|
+
var hasPreselectedRows = boxHasPreselectedRows(box.key);
|
|
3361
|
+
var wouldCollapse = compactCollapsedGroups.includes(box.key) &&
|
|
3362
|
+
!query &&
|
|
3363
|
+
!(box.key === 'optional' && onlyOptionalRows && !collapsedGroupsRequested);
|
|
3364
|
+
// Only a box that was opened SOLELY to reveal a preselected
|
|
3365
|
+
// row splits its body; a box that renders open anyway shows
|
|
3366
|
+
// all of its groups as before.
|
|
3367
|
+
var splitForPreselected = wouldCollapse && hasPreselectedRows;
|
|
3368
|
+
// Which rows this box shows, and which fold away, decided at
|
|
3369
|
+
// ROW level because `maxFieldsShown` counts fields — a
|
|
3370
|
+
// group-level split can only ever cut at a group boundary.
|
|
3371
|
+
// Group order is preserved so the visible rows read in the
|
|
3372
|
+
// same order they would if nothing were folded.
|
|
3373
|
+
var orderedRows = groupsInBox.flatMap(function (groupName) { return buckets[box.key][groupName] || []; });
|
|
3374
|
+
// The number in the box's header counts the rows whose value
|
|
3375
|
+
// belongs in it NOW. A field being edited keeps its box until it
|
|
3376
|
+
// is left (so it does not jump away under the caret), and it used
|
|
3377
|
+
// to keep its count too: a box read "To fill in 1" while its last
|
|
3378
|
+
// field already had a value and the host's submit read ready.
|
|
3379
|
+
var headerCount = readOnly ? count : (orderedRows.filter(function (entry) { return getOptionBucket(entry.name, entry.hidden) === box.key; }).length);
|
|
3380
|
+
// Optional's own rule first: a box opened solely to reveal
|
|
3381
|
+
// preselected rows offers those, not an arbitrary first-N.
|
|
3382
|
+
var candidateRows = splitForPreselected ? orderedRows.filter(isPreselectedRow) : orderedRows;
|
|
3383
|
+
// …then the cap applies to whatever that left.
|
|
3384
|
+
var capped = maxFieldsShown !== undefined && candidateRows.length > maxFieldsShown;
|
|
3385
|
+
var shownRows = capped ? candidateRows.slice(0, maxFieldsShown) : candidateRows;
|
|
3386
|
+
var shownRowSet = new Set(shownRows.map(function (entry) { return entry.name; }));
|
|
3387
|
+
// Everything the box holds that is not on show. Once the
|
|
3388
|
+
// reader asks for more they get the whole box — withholding
|
|
3389
|
+
// the non-preselected remainder behind a second control is
|
|
3390
|
+
// the same defect one level down.
|
|
3391
|
+
var deferredRowSet = new Set(orderedRows
|
|
3392
|
+
.filter(function (entry) { return !shownRowSet.has(entry.name); })
|
|
3393
|
+
.map(function (entry) { return entry.name; }));
|
|
3394
|
+
var deferredCount = deferredRowSet.size;
|
|
3395
|
+
var shownGroups = groupsInBox.filter(function (groupName) {
|
|
3396
|
+
return (buckets[box.key][groupName] || []).some(function (entry) {
|
|
3397
|
+
return shownRowSet.has(entry.name);
|
|
3398
|
+
});
|
|
3147
3399
|
});
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3400
|
+
var deferredGroups = groupsInBox.filter(function (groupName) {
|
|
3401
|
+
return (buckets[box.key][groupName] || []).some(function (entry) { return !shownRowSet.has(entry.name); });
|
|
3402
|
+
});
|
|
3403
|
+
var moreOpen = Boolean(query) || expandedMoreBoxes.includes(box.key);
|
|
3404
|
+
var accent = box.key === 'attention' && readFirstAttentionFaultCount ? cWarning
|
|
3405
|
+
: box.key === 'set' ? cSuccess
|
|
3406
|
+
: cMuted;
|
|
3407
|
+
// The muted "Optional" box reads as a quieter, recessed
|
|
3408
|
+
// surface — a touch darker than the page rather than the
|
|
3409
|
+
// faint grey tint the accent would give.
|
|
3410
|
+
// Calm: every box is the same panel — no recessed one.
|
|
3411
|
+
var boxBg = box.key === 'optional' && !calm ?
|
|
3412
|
+
(0, colors_1.changeDarkness)((0, colors_1.getMainBackgroundColor)(theme), 0.06)
|
|
3413
|
+
: undefined;
|
|
3414
|
+
return ((0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledStatusBox, { "$accent": accent, "$bg": boxBg, "$calm": calm, "$surface": stickyBoxHeaders ?
|
|
3415
|
+
calm ? cPanel
|
|
3416
|
+
: (0, colors_1.getMainBackgroundColor)(theme)
|
|
3417
|
+
: undefined, ref: function (node) {
|
|
3418
|
+
statusBoxRefs.current[box.key] = node;
|
|
3419
|
+
},
|
|
3420
|
+
// Opening arms the reveal; collapsing disarms it, so a
|
|
3421
|
+
// close never scrolls.
|
|
3422
|
+
onCollapseChange: function (collapsed) {
|
|
3423
|
+
return setOpenedStatusBox(collapsed ? undefined : box.key);
|
|
3424
|
+
},
|
|
3425
|
+
// Calm: an ordinary panel — Reqore paints the theme's
|
|
3426
|
+
// panel surface and its hairline edge. The header stays
|
|
3427
|
+
// minimal (no surface or rule of its own); the first
|
|
3428
|
+
// row's hairline is the line under it.
|
|
3429
|
+
flat: !calm, minimal: true,
|
|
3430
|
+
/* The header stays on screen while its own box is
|
|
3431
|
+
being read — see `compactStickyBoxHeaders`. Sticky
|
|
3432
|
+
is bounded by its containing block, so the header
|
|
3433
|
+
leaves with its box and only one is ever pinned. */
|
|
3434
|
+
stickyHeader: stickyBoxHeaders, stickyHeaderOffset: stickyBoxHeaders ? boxStickyOffset : undefined, collapseButtonProps: { flat: true, minimal: true, size: 'small' }, collapsible: true,
|
|
3435
|
+
// Which boxes start closed is the consumer's call
|
|
3436
|
+
// (`compactCollapsedGroups`, default `['optional']`: the
|
|
3437
|
+
// Optional box holds every not-yet-added field, so a form
|
|
3438
|
+
// opens on what is in use). Two rules override it:
|
|
3439
|
+
//
|
|
3440
|
+
// A SEARCH forces every box open — ReqorePanel unmounts
|
|
3441
|
+
// collapsed content, so a match inside a closed box would
|
|
3442
|
+
// be unreachable. (isCollapsed is the panel's controllable
|
|
3443
|
+
// state; manual toggling still works with no query set.)
|
|
3444
|
+
//
|
|
3445
|
+
// The Optional box stays open when it is the ONLY box,
|
|
3446
|
+
// because collapsing it renders a card that looks empty and
|
|
3447
|
+
// broken: an auth profile's Authorization block, whose nine
|
|
3448
|
+
// requirement fields are all optional, showed as a titled
|
|
3449
|
+
// card containing one collapsed "Optional 9" strip and
|
|
3450
|
+
// nothing else. This does not generalise to the other two —
|
|
3451
|
+
// a lone Set box collapsed is a deliberate ask, and its
|
|
3452
|
+
// header still reports what is in there.
|
|
3453
|
+
//
|
|
3454
|
+
// A PRESELECTED row overrides it too: the schema asked
|
|
3455
|
+
// for that field to be visible on a new form, so the
|
|
3456
|
+
// box it lands in opens. The groups it does NOT appear
|
|
3457
|
+
// in stay behind an inner collapse below, so opening
|
|
3458
|
+
// the box reveals the preselected fields without also
|
|
3459
|
+
// dumping every not-yet-added optional field on the
|
|
3460
|
+
// author.
|
|
3461
|
+
isCollapsed: wouldCollapse && !hasPreselectedRows, label: calm ?
|
|
3462
|
+
// One status dot and a word — and only where a
|
|
3463
|
+
// person is needed. The count is a quiet number.
|
|
3464
|
+
(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledGroupHeader, { "$calm": true, children: [box.key === 'attention' && readFirstAttentionFaultCount ?
|
|
3465
|
+
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledStatusDot, { className: 'options-readfirst-group-dot', "$color": cWarning, "aria-hidden": true })
|
|
3466
|
+
: null, (0, jsx_runtime_1.jsx)(reqore_1.ReqoreP, { effect: { weight: 'bold' }, size: 'normal', children: box.label }), headerCount ?
|
|
3467
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreSpan, { className: 'options-readfirst-group-count', size: 'small', effect: { opacity: 0.65 }, children: headerCount })
|
|
3468
|
+
: null] })
|
|
3469
|
+
: (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledGroupHeader, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreP, { effect: { weight: 'bold' }, size: 'normal', children: box.label }), headerCount ?
|
|
3470
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'small', minimal: true, compact: true, intent: box.intent, label: String(headerCount) })
|
|
3471
|
+
: null] }), icon: calm ? undefined : box.icon, className: 'options-readfirst-group', padded: false, contentStyle: { padding: calm ? 0 : '4px 4px 6px' }, children: (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledGroupBody, __assign({}, groupBodyProps, { className: compactNarrow ? 'readfirst-narrow' : undefined, children: [shownGroups.map(function (groupName) {
|
|
3472
|
+
return renderBoxGroup(box.key, groupName, shownRowSet);
|
|
3473
|
+
}), deferredCount ? renderMoreRow(box.key, deferredCount, moreOpen) : null, deferredCount && moreOpen ?
|
|
3474
|
+
deferredGroups.map(function (groupName) {
|
|
3475
|
+
return renderBoxGroup(box.key, groupName, deferredRowSet);
|
|
3476
|
+
})
|
|
3477
|
+
: null] })) }, box.key));
|
|
3478
|
+
})] })), commitMode === 'batched' && !readOnly && dirtyOptionNames.length ?
|
|
3219
3479
|
(0, jsx_runtime_1.jsx)(StyledCommitDock, { "$bg": cBg, "$border": cDivider, children: (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { className: 'options-readfirst-commitbar', verticalAlign: 'center', wrap: true, children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'tiny', minimal: true, flat: true, compact: true, effect: { uppercase: true, spaced: 1 }, intent: 'warning', icon: 'EditLine', label: feWords.unsavedChanges(dirtyOptionNames.length) }), validityData.isValid ? null : ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'tiny', minimal: true, flat: true, wrap: true, intent: 'danger', icon: 'ErrorWarningLine', className: 'options-readfirst-commit-blocked', label: (0, readFirst_1.describeBlockedSave)(validityData.invalidFields, options) })), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { size: 'small', intent: 'success', icon: 'CheckLine', fixed: true, className: 'options-readfirst-save', disabled: !validityData.isValid, tooltip: validityData.isValid ? feWords.applyChanges : feWords.resolveInvalid, onClick: handleCommitClick, children: feWords.save }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { size: 'small', minimal: true, flat: true, fixed: true, icon: 'HistoryLine', className: 'options-readfirst-discard', onClick: handleRevertChangesClick, children: feWords.discard })] }) })
|
|
3220
3480
|
: null] }) })] }) }) }));
|
|
3221
3481
|
};
|
|
@@ -3252,7 +3512,7 @@ var FormEngineImpl = function (_a) {
|
|
|
3252
3512
|
return renderCompact();
|
|
3253
3513
|
}
|
|
3254
3514
|
return ((0, jsx_runtime_1.jsx)(optionsContext_1.OptionsContext.Provider, { value: { schema: options, value: availableOptions }, 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 ?
|
|
3255
|
-
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { intent: 'info', children: feWords.searchOptionsRequired }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 10 })] })
|
|
3515
|
+
(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 })] })
|
|
3256
3516
|
: 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: {
|
|
3257
3517
|
disabled: (0, size_1.default)(availableOptions) < 2,
|
|
3258
3518
|
}, labelSize: 4, filterable: 'filterable' in rest ? rest.filterable : !compact, sortable: 'sortable' in rest ? rest.sortable : !compact && (0, size_1.default)(availableOptions) > 1, defaultSortBy: null, contentRenderer: function (children) { return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, size_1.default)(validityData.invalidFields) && !readOnly ?
|
|
@@ -3264,7 +3524,7 @@ var FormEngineImpl = function (_a) {
|
|
|
3264
3524
|
: null, (0, jsx_runtime_1.jsx)(HiddenFieldsNote_1.HiddenFieldsNote, { fields: hiddenFieldsWithValues }), children, (0, size_1.default)(filteredOptions) >= 1 && !readOnly ?
|
|
3265
3525
|
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 10 }), (0, jsx_runtime_1.jsx)(Select_1.SelectFormField, { items: optionalFields, onChange: function (val) { return handleAddOptionalFieldChange('options', val); }, placeholder: placeholder || feWords.moreOptions, minimal: true, icon: 'ListView', showDescription: false, fluid: true, size: rest.size })] })
|
|
3266
3526
|
: null] })); }, sortButtonProps: { minimal: true }, showLayoutSwitch: false, style: { width: '100%' }, items: (0, map_1.default)(shownOptions, function (_a, optionName) {
|
|
3267
|
-
var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r
|
|
3527
|
+
var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
3268
3528
|
var type = _a.type, other = __rest(_a, ["type"]);
|
|
3269
3529
|
return ({
|
|
3270
3530
|
label: ((_b = options[optionName]) === null || _b === void 0 ? void 0 : _b.display_name) || optionName,
|
|
@@ -3280,12 +3540,14 @@ var FormEngineImpl = function (_a) {
|
|
|
3280
3540
|
cursor: 'help',
|
|
3281
3541
|
}
|
|
3282
3542
|
: undefined,
|
|
3283
|
-
onClick: ((
|
|
3543
|
+
onClick: (0, fieldDescription_1.fieldHasLongDescription)(options[optionName]) ?
|
|
3544
|
+
function () { return handleOptionLabelClick(optionName); }
|
|
3545
|
+
: undefined,
|
|
3284
3546
|
},
|
|
3285
|
-
showLabelTooltip: !!((
|
|
3547
|
+
showLabelTooltip: !!((_f = options[optionName]) === null || _f === void 0 ? void 0 : _f.short_desc),
|
|
3286
3548
|
customLabelTooltip: {
|
|
3287
3549
|
delay: 300,
|
|
3288
|
-
content: ((0, jsx_runtime_1.jsx)(Description_1.Description, { longDescription: "".concat((
|
|
3550
|
+
content: ((0, jsx_runtime_1.jsx)(Description_1.Description, { longDescription: "".concat((_g = options[optionName]) === null || _g === void 0 ? void 0 : _g.short_desc).concat((0, fieldDescription_1.fieldHasLongDescription)(options[optionName]) ? feWords.clickToLearnMore : ''), margin: 'none' })),
|
|
3289
3551
|
},
|
|
3290
3552
|
description: showFieldTypes ?
|
|
3291
3553
|
[(0, qorusTypeCatalogue_1.optionTypeWords)(options[optionName], typeName), options[optionName].short_desc]
|
|
@@ -3295,7 +3557,7 @@ var FormEngineImpl = function (_a) {
|
|
|
3295
3557
|
descriptionEffect: {
|
|
3296
3558
|
textSize: '11px',
|
|
3297
3559
|
opacity: optionDescOpacity,
|
|
3298
|
-
underline: ((
|
|
3560
|
+
underline: (0, fieldDescription_1.fieldHasLongDescription)(options[optionName]) ? 'underline dotted #878787' : undefined,
|
|
3299
3561
|
},
|
|
3300
3562
|
customTheme: {
|
|
3301
3563
|
main: 'main:darken:1',
|
|
@@ -3332,7 +3594,7 @@ var FormEngineImpl = function (_a) {
|
|
|
3332
3594
|
menu: [
|
|
3333
3595
|
!readOnly &&
|
|
3334
3596
|
type !== 'code-editor' &&
|
|
3335
|
-
(((
|
|
3597
|
+
(((_h = options[optionName]) === null || _h === void 0 ? void 0 : _h.ui_type) || ((_j = options[optionName]) === null || _j === void 0 ? void 0 : _j.type)) !==
|
|
3336
3598
|
'code-editor' && {
|
|
3337
3599
|
label: feWords.focusedEditing,
|
|
3338
3600
|
icon: 'FullscreenLine',
|
|
@@ -3352,15 +3614,15 @@ var FormEngineImpl = function (_a) {
|
|
|
3352
3614
|
!readOnly &&
|
|
3353
3615
|
other.value &&
|
|
3354
3616
|
!(0, lodash_1.isEqual)(other.value, (0, common_1.getDefaultValue)(options[optionName])) &&
|
|
3355
|
-
!(((
|
|
3617
|
+
!(((_k = options[optionName]) === null || _k === void 0 ? void 0 : _k.disabled) || ((_l = options[optionName]) === null || _l === void 0 ? void 0 : _l.readonly)) && {
|
|
3356
3618
|
label: feWords.removeValue,
|
|
3357
3619
|
icon: 'CloseLine',
|
|
3358
3620
|
className: 'options-item-remove',
|
|
3359
3621
|
onClick: function () { return handleValueChange(optionName, undefined); },
|
|
3360
3622
|
},
|
|
3361
3623
|
!readOnly &&
|
|
3362
|
-
!((
|
|
3363
|
-
!((
|
|
3624
|
+
!((_m = options[optionName]) === null || _m === void 0 ? void 0 : _m.preselected) &&
|
|
3625
|
+
!((_o = options[optionName]) === null || _o === void 0 ? void 0 : _o.required) && {
|
|
3364
3626
|
label: feWords.removeOption,
|
|
3365
3627
|
icon: 'DeleteBinLine',
|
|
3366
3628
|
intent: 'danger',
|
|
@@ -3376,8 +3638,8 @@ var FormEngineImpl = function (_a) {
|
|
|
3376
3638
|
},
|
|
3377
3639
|
],
|
|
3378
3640
|
}),
|
|
3379
|
-
content: ((0, jsx_runtime_1.jsxs)(FocusedEditing_1.FocusedEditing, { isFullscreen: focusedEditing === optionName, onClose: function () { return setFocusedEditing(undefined); }, description: (
|
|
3380
|
-
(0, jsx_runtime_1.jsx)(Description_1.Description, { longDescription: (
|
|
3641
|
+
content: ((0, jsx_runtime_1.jsxs)(FocusedEditing_1.FocusedEditing, { isFullscreen: focusedEditing === optionName, onClose: function () { return setFocusedEditing(undefined); }, description: (_p = options[optionName]) === null || _p === void 0 ? void 0 : _p.display_name, intent: getIntent(optionName, type, other.value, other.op), children: [focusedEditing === optionName ?
|
|
3642
|
+
(0, jsx_runtime_1.jsx)(Description_1.Description, { longDescription: (_q = options[optionName]) === null || _q === void 0 ? void 0 : _q.desc, shortDescription: (_r = options[optionName]) === null || _r === void 0 ? void 0 : _r.short_desc, longDescriptionShownByDefault: true })
|
|
3381
3643
|
: null, renderOption(optionName, __assign({ type: type }, other))] })),
|
|
3382
3644
|
});
|
|
3383
3645
|
}), defaultZoom: 1, zoomable: false, actions: __spreadArray(__spreadArray([], (rest.actions || []).map(function (action) { return (__assign(__assign({}, action), { minimal: true })); }), true), [
|
|
@@ -3415,9 +3677,15 @@ var FormEngineImpl = function (_a) {
|
|
|
3415
3677
|
* hand is how one of them gets missed.
|
|
3416
3678
|
*/
|
|
3417
3679
|
var FormEngine = function (props) {
|
|
3680
|
+
var _a;
|
|
3681
|
+
// The form's own `appearance` wins; without one it follows the form (or the
|
|
3682
|
+
// host's provider) it sits in, so a nested sub-form never changes look
|
|
3683
|
+
// halfway down its parent.
|
|
3684
|
+
var inherited = (0, formAppearance_1.useFormAppearance)();
|
|
3685
|
+
var appearance = (_a = props.appearance) !== null && _a !== void 0 ? _a : inherited;
|
|
3418
3686
|
// what the host knows of references beyond the catalogue, for every chip the form draws (qorus#646)
|
|
3419
3687
|
var referenceNames = (0, react_2.useMemo)(function () { var _a; return (_a = props.templateReferences) !== null && _a !== void 0 ? _a : NO_REFERENCE_NAMES; }, [props.templateReferences]);
|
|
3420
|
-
return ((0, jsx_runtime_1.jsx)(markdownRendererContext_1.MarkdownRendererContext.Provider, { value: props.markdownRenderer, children: (0, jsx_runtime_1.jsx)(typeSentenceForm_1.TypeSentenceFormProvider, { children: (0, jsx_runtime_1.jsx)(referenceNames_1.TemplateReferenceNamesProvider, { value: referenceNames, children: (0, jsx_runtime_1.jsx)(FormEngineImpl, __assign({}, props)) }) }) }));
|
|
3688
|
+
return ((0, jsx_runtime_1.jsx)(markdownRendererContext_1.MarkdownRendererContext.Provider, { value: props.markdownRenderer, children: (0, jsx_runtime_1.jsx)(formAppearance_1.FormAppearanceProvider, { value: appearance, children: (0, jsx_runtime_1.jsx)(typeSentenceForm_1.TypeSentenceFormProvider, { children: (0, jsx_runtime_1.jsx)(referenceNames_1.TemplateReferenceNamesProvider, { value: referenceNames, children: (0, jsx_runtime_1.jsx)(FormEngineImpl, __assign({}, props)) }) }) }) }));
|
|
3421
3689
|
};
|
|
3422
3690
|
exports.FormEngine = FormEngine;
|
|
3423
3691
|
var NO_REFERENCE_NAMES = {};
|