@qoretechnologies/reqraft 0.10.66-pr.145.gcb1e59d → 0.10.66
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/README.md +53 -1
- package/dist/components/Description/AllowedValuesHelp.d.ts +20 -0
- package/dist/components/Description/AllowedValuesHelp.d.ts.map +1 -0
- package/dist/components/Description/AllowedValuesHelp.js +86 -0
- package/dist/components/Description/AllowedValuesHelp.js.map +1 -0
- package/dist/components/Description/describedControl.d.ts +54 -0
- package/dist/components/Description/describedControl.d.ts.map +1 -0
- package/dist/components/Description/describedControl.js +81 -0
- package/dist/components/Description/describedControl.js.map +1 -0
- package/dist/components/Description/index.d.ts.map +1 -1
- package/dist/components/Description/index.js +3 -2
- package/dist/components/Description/index.js.map +1 -1
- package/dist/components/colorValue/colorValue.d.ts +59 -0
- package/dist/components/colorValue/colorValue.d.ts.map +1 -0
- package/dist/components/colorValue/colorValue.js +245 -0
- package/dist/components/colorValue/colorValue.js.map +1 -0
- package/dist/components/colorValue/index.d.ts +34 -0
- package/dist/components/colorValue/index.d.ts.map +1 -0
- package/dist/components/colorValue/index.js +136 -0
- package/dist/components/colorValue/index.js.map +1 -0
- package/dist/components/colorValue/labels.d.ts +12 -0
- package/dist/components/colorValue/labels.d.ts.map +1 -0
- package/dist/components/colorValue/labels.js +11 -0
- package/dist/components/colorValue/labels.js.map +1 -0
- package/dist/components/composer/Composer.d.ts +1 -1
- package/dist/components/composer/Composer.d.ts.map +1 -1
- package/dist/components/composer/Composer.js +2 -2
- package/dist/components/composer/Composer.js.map +1 -1
- package/dist/components/dpqlEditor/DpqlEditor.d.ts.map +1 -1
- package/dist/components/dpqlEditor/DpqlEditor.js +156 -10
- package/dist/components/dpqlEditor/DpqlEditor.js.map +1 -1
- package/dist/components/dpqlEditor/dpqlCompletions.d.ts +39 -0
- package/dist/components/dpqlEditor/dpqlCompletions.d.ts.map +1 -0
- package/dist/components/dpqlEditor/dpqlCompletions.js +294 -0
- package/dist/components/dpqlEditor/dpqlCompletions.js.map +1 -0
- package/dist/components/dpqlEditor/dpqlHelpers.d.ts +54 -5
- package/dist/components/dpqlEditor/dpqlHelpers.d.ts.map +1 -1
- package/dist/components/dpqlEditor/dpqlHelpers.js +420 -63
- package/dist/components/dpqlEditor/dpqlHelpers.js.map +1 -1
- package/dist/components/dpqlEditor/dpqlInserter.d.ts.map +1 -1
- package/dist/components/dpqlEditor/dpqlInserter.js +67 -29
- package/dist/components/dpqlEditor/dpqlInserter.js.map +1 -1
- package/dist/components/dpqlEditor/dpqlTags.d.ts +17 -7
- package/dist/components/dpqlEditor/dpqlTags.d.ts.map +1 -1
- package/dist/components/dpqlEditor/dpqlTags.js +44 -17
- package/dist/components/dpqlEditor/dpqlTags.js.map +1 -1
- package/dist/components/dpqlEditor/types.d.ts +94 -8
- package/dist/components/dpqlEditor/types.d.ts.map +1 -1
- package/dist/components/dpqlEditor/useDpqlSession.d.ts +7 -2
- package/dist/components/dpqlEditor/useDpqlSession.d.ts.map +1 -1
- package/dist/components/dpqlEditor/useDpqlSession.js +49 -17
- package/dist/components/dpqlEditor/useDpqlSession.js.map +1 -1
- package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +336 -243
- 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 +20 -57
- package/dist/components/form/engine/CompactToolbar.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +67 -59
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +606 -409
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/HiddenFieldsNote.d.ts +28 -0
- package/dist/components/form/engine/HiddenFieldsNote.d.ts.map +1 -0
- package/dist/components/form/engine/HiddenFieldsNote.js +32 -0
- package/dist/components/form/engine/HiddenFieldsNote.js.map +1 -0
- package/dist/components/form/engine/OptionFieldMessages.d.ts +2 -18
- package/dist/components/form/engine/OptionFieldMessages.d.ts.map +1 -1
- package/dist/components/form/engine/OptionFieldMessages.js +28 -25
- package/dist/components/form/engine/OptionFieldMessages.js.map +1 -1
- package/dist/components/form/engine/OptionsHelpDialog.d.ts.map +1 -1
- package/dist/components/form/engine/OptionsHelpDialog.js +19 -2
- package/dist/components/form/engine/OptionsHelpDialog.js.map +1 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts +2 -2
- package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts.map +1 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.js +11 -31
- package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -1
- package/dist/components/form/engine/compactRowContext.d.ts +30 -6
- 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 +56 -31
- package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
- package/dist/components/form/engine/compactRowStyles.js +121 -110
- package/dist/components/form/engine/compactRowStyles.js.map +1 -1
- package/dist/components/form/engine/compactToolbarColors.d.ts +16 -0
- package/dist/components/form/engine/compactToolbarColors.d.ts.map +1 -0
- package/dist/components/form/engine/compactToolbarColors.js +21 -0
- package/dist/components/form/engine/compactToolbarColors.js.map +1 -0
- package/dist/components/form/engine/compactToolbarContext.d.ts +0 -3
- 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/inheritProps.d.ts +29 -0
- package/dist/components/form/engine/inheritProps.d.ts.map +1 -0
- package/dist/components/form/engine/inheritProps.js +43 -0
- package/dist/components/form/engine/inheritProps.js.map +1 -0
- package/dist/components/form/engine/operatorSummary.d.ts +26 -0
- package/dist/components/form/engine/operatorSummary.d.ts.map +1 -0
- package/dist/components/form/engine/operatorSummary.js +35 -0
- package/dist/components/form/engine/operatorSummary.js.map +1 -0
- package/dist/components/form/engine/readFirst.d.ts +26 -22
- package/dist/components/form/engine/readFirst.d.ts.map +1 -1
- package/dist/components/form/engine/readFirst.js +79 -115
- package/dist/components/form/engine/readFirst.js.map +1 -1
- package/dist/components/form/engine/readFirstColors.d.ts +30 -0
- package/dist/components/form/engine/readFirstColors.d.ts.map +1 -0
- package/dist/components/form/engine/readFirstColors.js +51 -0
- package/dist/components/form/engine/readFirstColors.js.map +1 -0
- package/dist/components/form/engine/rowFocus.d.ts +3 -9
- package/dist/components/form/engine/rowFocus.d.ts.map +1 -1
- package/dist/components/form/engine/rowFocus.js +30 -19
- package/dist/components/form/engine/rowFocus.js.map +1 -1
- package/dist/components/form/engine/typeChoices.d.ts +1 -1
- package/dist/components/form/engine/variants/VariantCalmTable.d.ts.map +1 -1
- package/dist/components/form/engine/variants/VariantCalmTable.js +2 -1
- package/dist/components/form/engine/variants/VariantCalmTable.js.map +1 -1
- package/dist/components/form/engine/variants/VariantCards.d.ts.map +1 -1
- package/dist/components/form/engine/variants/VariantCards.js +2 -1
- package/dist/components/form/engine/variants/VariantCards.js.map +1 -1
- package/dist/components/form/engine/variants/VariantFocus.js +1 -1
- package/dist/components/form/engine/variants/VariantFocus.js.map +1 -1
- package/dist/components/form/engine/variants/VariantMinimal.d.ts.map +1 -1
- package/dist/components/form/engine/variants/VariantMinimal.js +2 -1
- package/dist/components/form/engine/variants/VariantMinimal.js.map +1 -1
- package/dist/components/form/engine/variants/variantParts.d.ts +1 -1
- package/dist/components/form/engine/variants/variantParts.d.ts.map +1 -1
- package/dist/components/form/engine/variants/variantParts.js +25 -17
- package/dist/components/form/engine/variants/variantParts.js.map +1 -1
- package/dist/components/form/expressions/DpqlRendering.d.ts +1 -1
- package/dist/components/form/expressions/DpqlRendering.d.ts.map +1 -1
- package/dist/components/form/expressions/DpqlRendering.js +7 -6
- package/dist/components/form/expressions/DpqlRendering.js.map +1 -1
- package/dist/components/form/expressions/ExpressionField.d.ts +67 -3
- package/dist/components/form/expressions/ExpressionField.d.ts.map +1 -1
- package/dist/components/form/expressions/ExpressionField.js +536 -114
- package/dist/components/form/expressions/ExpressionField.js.map +1 -1
- package/dist/components/form/expressions/argumentPresence.d.ts +14 -0
- package/dist/components/form/expressions/argumentPresence.d.ts.map +1 -1
- package/dist/components/form/expressions/argumentPresence.js +16 -1
- package/dist/components/form/expressions/argumentPresence.js.map +1 -1
- package/dist/components/form/expressions/builder/argumentDetail.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/argumentDetail.js +4 -1
- package/dist/components/form/expressions/builder/argumentDetail.js.map +1 -1
- package/dist/components/form/expressions/builder/argumentLabel.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/argumentLabel.js +30 -11
- package/dist/components/form/expressions/builder/argumentLabel.js.map +1 -1
- package/dist/components/form/expressions/builder/argumentWrapper.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/argumentWrapper.js +3 -1
- package/dist/components/form/expressions/builder/argumentWrapper.js.map +1 -1
- package/dist/components/form/expressions/builder/confirmMismatchedTypesModal.d.ts +9 -0
- package/dist/components/form/expressions/builder/confirmMismatchedTypesModal.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/confirmMismatchedTypesModal.js +30 -27
- package/dist/components/form/expressions/builder/confirmMismatchedTypesModal.js.map +1 -1
- package/dist/components/form/expressions/builder/confirmUnsupportedTypeModal.d.ts +1 -1
- package/dist/components/form/expressions/builder/confirmUnsupportedTypeModal.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/confirmUnsupportedTypeModal.js +7 -5
- package/dist/components/form/expressions/builder/confirmUnsupportedTypeModal.js.map +1 -1
- package/dist/components/form/expressions/builder/index.d.ts +34 -2
- package/dist/components/form/expressions/builder/index.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/index.js +170 -80
- package/dist/components/form/expressions/builder/index.js.map +1 -1
- package/dist/components/form/expressions/builder/item.d.ts +6 -2
- package/dist/components/form/expressions/builder/item.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/item.js +19 -5
- package/dist/components/form/expressions/builder/item.js.map +1 -1
- package/dist/components/form/expressions/builder/renderTemplate.js +1 -1
- package/dist/components/form/expressions/builder/renderTemplate.js.map +1 -1
- package/dist/components/form/expressions/dpqlMockRecordPath.d.ts +11 -0
- package/dist/components/form/expressions/dpqlMockRecordPath.d.ts.map +1 -0
- package/dist/components/form/expressions/dpqlMockRecordPath.js +254 -0
- package/dist/components/form/expressions/dpqlMockRecordPath.js.map +1 -0
- package/dist/components/form/expressions/expressionOperands.d.ts +16 -0
- package/dist/components/form/expressions/expressionOperands.d.ts.map +1 -0
- package/dist/components/form/expressions/expressionOperands.js +97 -0
- package/dist/components/form/expressions/expressionOperands.js.map +1 -0
- package/dist/components/form/expressions/fieldPath.d.ts +24 -0
- package/dist/components/form/expressions/fieldPath.d.ts.map +1 -0
- package/dist/components/form/expressions/fieldPath.js +152 -0
- package/dist/components/form/expressions/fieldPath.js.map +1 -0
- package/dist/components/form/expressions/loneValue.d.ts +17 -0
- package/dist/components/form/expressions/loneValue.d.ts.map +1 -0
- package/dist/components/form/expressions/loneValue.js +33 -0
- package/dist/components/form/expressions/loneValue.js.map +1 -0
- package/dist/components/form/expressions/mockExpressions.d.ts.map +1 -1
- package/dist/components/form/expressions/mockExpressions.js +22 -5
- package/dist/components/form/expressions/mockExpressions.js.map +1 -1
- package/dist/components/form/expressions/renderExpressionToText.d.ts +2 -0
- package/dist/components/form/expressions/renderExpressionToText.d.ts.map +1 -1
- package/dist/components/form/expressions/renderExpressionToText.js +37 -25
- package/dist/components/form/expressions/renderExpressionToText.js.map +1 -1
- package/dist/components/form/expressions/textOfExpression.d.ts +18 -0
- package/dist/components/form/expressions/textOfExpression.d.ts.map +1 -0
- package/dist/components/form/expressions/textOfExpression.js +49 -0
- package/dist/components/form/expressions/textOfExpression.js.map +1 -0
- package/dist/components/form/expressions/types.d.ts +12 -0
- package/dist/components/form/expressions/types.d.ts.map +1 -1
- package/dist/components/form/expressions/types.js +6 -1
- package/dist/components/form/expressions/types.js.map +1 -1
- package/dist/components/form/expressions/useExpressionType.d.ts +26 -0
- package/dist/components/form/expressions/useExpressionType.d.ts.map +1 -0
- package/dist/components/form/expressions/useExpressionType.js +181 -0
- package/dist/components/form/expressions/useExpressionType.js.map +1 -0
- package/dist/components/form/expressions/useRenderExpression.d.ts.map +1 -1
- package/dist/components/form/expressions/useRenderExpression.js +13 -9
- package/dist/components/form/expressions/useRenderExpression.js.map +1 -1
- package/dist/components/form/expressions/wildcardExpressions.d.ts +27 -0
- package/dist/components/form/expressions/wildcardExpressions.d.ts.map +1 -0
- package/dist/components/form/expressions/wildcardExpressions.js +101 -0
- package/dist/components/form/expressions/wildcardExpressions.js.map +1 -0
- package/dist/components/form/fields/Field.d.ts.map +1 -1
- package/dist/components/form/fields/Field.js +39 -18
- package/dist/components/form/fields/Field.js.map +1 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.d.ts +0 -7
- package/dist/components/form/fields/allowed-values/AllowedValues.d.ts.map +1 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.js +46 -35
- package/dist/components/form/fields/allowed-values/AllowedValues.js.map +1 -1
- package/dist/components/form/fields/allowed-values/choicePicture.d.ts +37 -0
- package/dist/components/form/fields/allowed-values/choicePicture.d.ts.map +1 -0
- package/dist/components/form/fields/allowed-values/choicePicture.js +64 -0
- package/dist/components/form/fields/allowed-values/choicePicture.js.map +1 -0
- package/dist/components/form/fields/array/ArrayAuto.d.ts.map +1 -1
- package/dist/components/form/fields/array/ArrayAuto.js +24 -0
- package/dist/components/form/fields/array/ArrayAuto.js.map +1 -1
- package/dist/components/form/fields/array/ArrayAutoField.d.ts.map +1 -1
- package/dist/components/form/fields/array/ArrayAutoField.js +36 -13
- package/dist/components/form/fields/array/ArrayAutoField.js.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.d.ts +30 -1
- package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.js +123 -79
- package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
- package/dist/components/form/fields/auto/hostEditorValue.d.ts +30 -0
- package/dist/components/form/fields/auto/hostEditorValue.d.ts.map +1 -0
- package/dist/components/form/fields/auto/hostEditorValue.js +53 -0
- package/dist/components/form/fields/auto/hostEditorValue.js.map +1 -0
- package/dist/components/form/fields/binary/Binary.d.ts.map +1 -1
- package/dist/components/form/fields/binary/Binary.js +23 -3
- package/dist/components/form/fields/binary/Binary.js.map +1 -1
- package/dist/components/form/fields/boolean/Boolean.d.ts +5 -0
- package/dist/components/form/fields/boolean/Boolean.d.ts.map +1 -1
- package/dist/components/form/fields/boolean/Boolean.js +9 -1
- package/dist/components/form/fields/boolean/Boolean.js.map +1 -1
- package/dist/components/form/fields/color/Color.d.ts +103 -16
- package/dist/components/form/fields/color/Color.d.ts.map +1 -1
- package/dist/components/form/fields/color/Color.js +616 -16
- package/dist/components/form/fields/color/Color.js.map +1 -1
- package/dist/components/form/fields/emittedValues.d.ts +34 -3
- package/dist/components/form/fields/emittedValues.d.ts.map +1 -1
- package/dist/components/form/fields/emittedValues.js +24 -1
- package/dist/components/form/fields/emittedValues.js.map +1 -1
- package/dist/components/form/fields/file/File.d.ts +1 -1
- package/dist/components/form/fields/file/File.d.ts.map +1 -1
- package/dist/components/form/fields/file/File.js +4 -2
- package/dist/components/form/fields/file/File.js.map +1 -1
- package/dist/components/form/fields/long-string/LongString.d.ts +1 -7
- package/dist/components/form/fields/long-string/LongString.d.ts.map +1 -1
- package/dist/components/form/fields/long-string/LongString.js +30 -13
- package/dist/components/form/fields/long-string/LongString.js.map +1 -1
- package/dist/components/form/fields/markdown/MarkdownView.js +1 -1
- package/dist/components/form/fields/multi-select/MultiSelectFormField.d.ts.map +1 -1
- package/dist/components/form/fields/multi-select/MultiSelectFormField.js +10 -7
- package/dist/components/form/fields/multi-select/MultiSelectFormField.js.map +1 -1
- package/dist/components/form/fields/number/Number.d.ts +7 -4
- package/dist/components/form/fields/number/Number.d.ts.map +1 -1
- package/dist/components/form/fields/number/Number.js +45 -18
- package/dist/components/form/fields/number/Number.js.map +1 -1
- package/dist/components/form/fields/object/Object.d.ts +1 -1
- package/dist/components/form/fields/object/Object.d.ts.map +1 -1
- package/dist/components/form/fields/object/Object.js +4 -2
- package/dist/components/form/fields/object/Object.js.map +1 -1
- package/dist/components/form/fields/pendingEdit.d.ts +52 -0
- package/dist/components/form/fields/pendingEdit.d.ts.map +1 -0
- package/dist/components/form/fields/pendingEdit.js +79 -0
- package/dist/components/form/fields/pendingEdit.js.map +1 -0
- package/dist/components/form/fields/radio-group/RadioGroup.d.ts.map +1 -1
- package/dist/components/form/fields/radio-group/RadioGroup.js +8 -13
- package/dist/components/form/fields/radio-group/RadioGroup.js.map +1 -1
- package/dist/components/form/fields/rich-text/RichText.d.ts +20 -1
- package/dist/components/form/fields/rich-text/RichText.d.ts.map +1 -1
- package/dist/components/form/fields/rich-text/RichText.js +426 -91
- package/dist/components/form/fields/rich-text/RichText.js.map +1 -1
- package/dist/components/form/fields/rich-text/useTemplateTags.d.ts +18 -0
- package/dist/components/form/fields/rich-text/useTemplateTags.d.ts.map +1 -0
- package/dist/components/form/fields/rich-text/useTemplateTags.js +80 -0
- package/dist/components/form/fields/rich-text/useTemplateTags.js.map +1 -0
- package/dist/components/form/fields/schema-definition/CatalogLeafForm.d.ts.map +1 -1
- package/dist/components/form/fields/schema-definition/CatalogLeafForm.js +4 -1
- package/dist/components/form/fields/schema-definition/CatalogLeafForm.js.map +1 -1
- package/dist/components/form/fields/schema-definition/CatalogNodeEditor.d.ts.map +1 -1
- package/dist/components/form/fields/schema-definition/CatalogNodeEditor.js +20 -5
- package/dist/components/form/fields/schema-definition/CatalogNodeEditor.js.map +1 -1
- package/dist/components/form/fields/schema-definition/TableEditor.d.ts.map +1 -1
- package/dist/components/form/fields/schema-definition/TableEditor.js +10 -2
- package/dist/components/form/fields/schema-definition/TableEditor.js.map +1 -1
- package/dist/components/form/fields/schema-definition/index.d.ts.map +1 -1
- package/dist/components/form/fields/schema-definition/index.js +8 -4
- package/dist/components/form/fields/schema-definition/index.js.map +1 -1
- package/dist/components/form/fields/select/Select.d.ts +10 -1
- package/dist/components/form/fields/select/Select.d.ts.map +1 -1
- package/dist/components/form/fields/select/Select.js +28 -14
- package/dist/components/form/fields/select/Select.js.map +1 -1
- package/dist/components/form/fields/select/SelectCollection.d.ts +5 -0
- package/dist/components/form/fields/select/SelectCollection.d.ts.map +1 -1
- package/dist/components/form/fields/select/SelectCollection.js +25 -12
- package/dist/components/form/fields/select/SelectCollection.js.map +1 -1
- package/dist/components/form/fields/select/unavailableRow.d.ts +23 -0
- package/dist/components/form/fields/select/unavailableRow.d.ts.map +1 -0
- package/dist/components/form/fields/select/unavailableRow.js +55 -0
- package/dist/components/form/fields/select/unavailableRow.js.map +1 -0
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts +11 -5
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts.map +1 -1
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.js +21 -5
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.js.map +1 -1
- package/dist/components/form/fields/template/TemplateBrowser.d.ts +16 -0
- package/dist/components/form/fields/template/TemplateBrowser.d.ts.map +1 -0
- package/dist/components/form/fields/template/TemplateBrowser.js +89 -0
- package/dist/components/form/fields/template/TemplateBrowser.js.map +1 -0
- package/dist/components/form/fields/template/TemplateField.d.ts +105 -1
- package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
- package/dist/components/form/fields/template/TemplateField.js +706 -168
- package/dist/components/form/fields/template/TemplateField.js.map +1 -1
- package/dist/components/form/fields/template/TemplatePicker.d.ts +54 -0
- package/dist/components/form/fields/template/TemplatePicker.d.ts.map +1 -0
- package/dist/components/form/fields/template/TemplatePicker.js +459 -0
- package/dist/components/form/fields/template/TemplatePicker.js.map +1 -0
- package/dist/components/form/fields/template/TemplateText.d.ts +0 -17
- package/dist/components/form/fields/template/TemplateText.d.ts.map +1 -1
- package/dist/components/form/fields/template/TemplateText.js +22 -16
- package/dist/components/form/fields/template/TemplateText.js.map +1 -1
- package/dist/components/form/fields/template/referenceNames.d.ts +63 -0
- package/dist/components/form/fields/template/referenceNames.d.ts.map +1 -0
- package/dist/components/form/fields/template/referenceNames.js +69 -0
- package/dist/components/form/fields/template/referenceNames.js.map +1 -0
- package/dist/components/form/fields/template/writtenAsText.d.ts +61 -0
- package/dist/components/form/fields/template/writtenAsText.d.ts.map +1 -0
- package/dist/components/form/fields/template/writtenAsText.js +204 -0
- package/dist/components/form/fields/template/writtenAsText.js.map +1 -0
- package/dist/components/form/index.d.ts +12 -2
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +25 -3
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/form/typeSentenceForm.d.ts +17 -0
- package/dist/components/form/typeSentenceForm.d.ts.map +1 -0
- package/dist/components/form/typeSentenceForm.js +54 -0
- package/dist/components/form/typeSentenceForm.js.map +1 -0
- package/dist/components/imageLightbox/ImageLightbox.d.ts.map +1 -1
- package/dist/components/imageLightbox/ImageLightbox.js +19 -9
- package/dist/components/imageLightbox/ImageLightbox.js.map +1 -1
- package/dist/components/log/Log.d.ts.map +1 -1
- package/dist/components/log/Log.js +20 -8
- package/dist/components/log/Log.js.map +1 -1
- package/dist/components/menu/Menu.d.ts.map +1 -1
- package/dist/components/menu/Menu.js +19 -10
- package/dist/components/menu/Menu.js.map +1 -1
- package/dist/components/smartEditor/CompletionMenu.d.ts +53 -0
- package/dist/components/smartEditor/CompletionMenu.d.ts.map +1 -0
- package/dist/components/smartEditor/CompletionMenu.js +302 -0
- package/dist/components/smartEditor/CompletionMenu.js.map +1 -0
- package/dist/components/smartEditor/MarkdownDoc.d.ts +1 -1
- package/dist/components/smartEditor/MarkdownDoc.js +3 -3
- package/dist/components/smartEditor/MarkdownDoc.js.map +1 -1
- package/dist/components/smartEditor/SmartEditor.d.ts.map +1 -1
- package/dist/components/smartEditor/SmartEditor.js +616 -190
- package/dist/components/smartEditor/SmartEditor.js.map +1 -1
- package/dist/components/smartEditor/completionStyle.d.ts +28 -0
- package/dist/components/smartEditor/completionStyle.d.ts.map +1 -0
- package/dist/components/smartEditor/completionStyle.js +79 -0
- package/dist/components/smartEditor/completionStyle.js.map +1 -0
- package/dist/components/smartEditor/contextTitle.d.ts +10 -0
- package/dist/components/smartEditor/contextTitle.d.ts.map +1 -0
- package/dist/components/smartEditor/contextTitle.js +21 -0
- package/dist/components/smartEditor/contextTitle.js.map +1 -0
- package/dist/components/smartEditor/editingAids.d.ts +64 -0
- package/dist/components/smartEditor/editingAids.d.ts.map +1 -0
- package/dist/components/smartEditor/editingAids.js +213 -0
- package/dist/components/smartEditor/editingAids.js.map +1 -0
- package/dist/components/smartEditor/index.d.ts +6 -1
- package/dist/components/smartEditor/index.d.ts.map +1 -1
- package/dist/components/smartEditor/index.js +19 -1
- package/dist/components/smartEditor/index.js.map +1 -1
- package/dist/components/smartEditor/templateCompletions.d.ts +98 -0
- package/dist/components/smartEditor/templateCompletions.d.ts.map +1 -0
- package/dist/components/smartEditor/templateCompletions.js +380 -0
- package/dist/components/smartEditor/templateCompletions.js.map +1 -0
- package/dist/components/smartEditor/typedReferences.d.ts +34 -0
- package/dist/components/smartEditor/typedReferences.d.ts.map +1 -0
- package/dist/components/smartEditor/typedReferences.js +179 -0
- package/dist/components/smartEditor/typedReferences.js.map +1 -0
- package/dist/components/smartEditor/types.d.ts +116 -2
- package/dist/components/smartEditor/types.d.ts.map +1 -1
- package/dist/components/smartEditor/useEditingAids.d.ts +38 -0
- package/dist/components/smartEditor/useEditingAids.d.ts.map +1 -0
- package/dist/components/smartEditor/useEditingAids.js +392 -0
- package/dist/components/smartEditor/useEditingAids.js.map +1 -0
- package/dist/components/smartEditor/useLspAutocomplete.d.ts +106 -3
- package/dist/components/smartEditor/useLspAutocomplete.d.ts.map +1 -1
- package/dist/components/smartEditor/useLspAutocomplete.js +592 -149
- package/dist/components/smartEditor/useLspAutocomplete.js.map +1 -1
- package/dist/components/smartEditor/useLspHover.d.ts +33 -7
- package/dist/components/smartEditor/useLspHover.d.ts.map +1 -1
- package/dist/components/smartEditor/useLspHover.js +364 -35
- package/dist/components/smartEditor/useLspHover.js.map +1 -1
- package/dist/components/smartEditor/useLspSemanticTokens.js +1 -1
- package/dist/components/smartEditor/useLspSemanticTokens.js.map +1 -1
- package/dist/components/smartEditor/useLspSession.d.ts +6 -0
- package/dist/components/smartEditor/useLspSession.d.ts.map +1 -1
- package/dist/components/smartEditor/useLspSession.js +7 -6
- package/dist/components/smartEditor/useLspSession.js.map +1 -1
- package/dist/components/smartEditor/useLspSignatureHelp.d.ts.map +1 -1
- package/dist/components/smartEditor/useLspSignatureHelp.js +6 -11
- package/dist/components/smartEditor/useLspSignatureHelp.js.map +1 -1
- package/dist/components/smartEditor/useTabCameIn.d.ts +10 -0
- package/dist/components/smartEditor/useTabCameIn.d.ts.map +1 -0
- package/dist/components/smartEditor/useTabCameIn.js +42 -0
- package/dist/components/smartEditor/useTabCameIn.js.map +1 -0
- package/dist/components/supportTicket/AttachmentChips.d.ts.map +1 -1
- package/dist/components/supportTicket/AttachmentChips.js +15 -5
- package/dist/components/supportTicket/AttachmentChips.js.map +1 -1
- package/dist/components/supportTicket/InterfaceReferenceTags.d.ts +2 -3
- 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 +9 -3
- package/dist/components/supportTicket/ReferencePicker.d.ts.map +1 -1
- package/dist/components/supportTicket/ReferencePicker.js +38 -23
- package/dist/components/supportTicket/ReferencePicker.js.map +1 -1
- package/dist/components/supportTicket/TicketHeader.d.ts +3 -4
- package/dist/components/supportTicket/TicketHeader.d.ts.map +1 -1
- package/dist/components/supportTicket/TicketHeader.js +21 -6
- package/dist/components/supportTicket/TicketHeader.js.map +1 -1
- package/dist/components/supportTicket/TicketMetaTags.d.ts +1 -1
- package/dist/components/supportTicket/TicketReplyBox.d.ts.map +1 -1
- package/dist/components/supportTicket/TicketReplyBox.js +10 -29
- package/dist/components/supportTicket/TicketReplyBox.js.map +1 -1
- package/dist/components/supportTicket/useLoadedImages.d.ts +0 -10
- package/dist/components/supportTicket/useLoadedImages.d.ts.map +1 -1
- package/dist/components/supportTicket/useLoadedImages.js +1 -63
- 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 +10 -9
- 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 +52 -21
- package/dist/components/ticketThread/TicketThread.js.map +1 -1
- package/dist/helpers/allowedValues.d.ts +21 -12
- package/dist/helpers/allowedValues.d.ts.map +1 -1
- package/dist/helpers/allowedValues.js +40 -20
- package/dist/helpers/allowedValues.js.map +1 -1
- package/dist/helpers/descriptionTooltip.d.ts +46 -0
- package/dist/helpers/descriptionTooltip.d.ts.map +1 -0
- package/dist/helpers/descriptionTooltip.js +76 -0
- package/dist/helpers/descriptionTooltip.js.map +1 -0
- package/dist/helpers/domProps.d.ts +5 -0
- package/dist/helpers/domProps.d.ts.map +1 -0
- package/dist/helpers/domProps.js +47 -0
- package/dist/helpers/domProps.js.map +1 -0
- package/dist/helpers/expressions.d.ts +115 -4
- package/dist/helpers/expressions.d.ts.map +1 -1
- package/dist/helpers/expressions.js +247 -29
- package/dist/helpers/expressions.js.map +1 -1
- package/dist/helpers/hoveringPointer.d.ts +26 -0
- package/dist/helpers/hoveringPointer.d.ts.map +1 -0
- package/dist/helpers/hoveringPointer.js +29 -0
- package/dist/helpers/hoveringPointer.js.map +1 -0
- package/dist/helpers/markdownText.d.ts +14 -0
- package/dist/helpers/markdownText.d.ts.map +1 -0
- package/dist/helpers/markdownText.js +160 -0
- package/dist/helpers/markdownText.js.map +1 -0
- package/dist/helpers/noDescription.d.ts +9 -0
- package/dist/helpers/noDescription.d.ts.map +1 -0
- package/dist/helpers/noDescription.js +13 -0
- package/dist/helpers/noDescription.js.map +1 -0
- package/dist/helpers/optionUiTypes.d.ts +2 -2
- package/dist/helpers/qorusTypeCatalogue.d.ts +147 -0
- package/dist/helpers/qorusTypeCatalogue.d.ts.map +1 -0
- package/dist/helpers/qorusTypeCatalogue.js +505 -0
- package/dist/helpers/qorusTypeCatalogue.js.map +1 -0
- package/dist/helpers/readableColors.d.ts +36 -0
- package/dist/helpers/readableColors.d.ts.map +1 -0
- package/dist/helpers/readableColors.js +116 -0
- package/dist/helpers/readableColors.js.map +1 -0
- package/dist/helpers/recordFieldReference.d.ts +15 -0
- package/dist/helpers/recordFieldReference.d.ts.map +1 -0
- package/dist/helpers/recordFieldReference.js +89 -0
- package/dist/helpers/recordFieldReference.js.map +1 -0
- package/dist/helpers/singleLineString.d.ts.map +1 -1
- package/dist/helpers/singleLineString.js +0 -1
- package/dist/helpers/singleLineString.js.map +1 -1
- package/dist/helpers/templateCatalogue.d.ts +104 -0
- package/dist/helpers/templateCatalogue.d.ts.map +1 -0
- package/dist/helpers/templateCatalogue.js +116 -0
- package/dist/helpers/templateCatalogue.js.map +1 -0
- package/dist/helpers/templateCatalogueContext.d.ts +19 -0
- package/dist/helpers/templateCatalogueContext.d.ts.map +1 -0
- package/dist/helpers/templateCatalogueContext.js +31 -0
- package/dist/helpers/templateCatalogueContext.js.map +1 -0
- package/dist/helpers/templateItems.d.ts +2 -2
- package/dist/helpers/templateItems.d.ts.map +1 -1
- package/dist/helpers/templateItems.js +6 -4
- package/dist/helpers/templateItems.js.map +1 -1
- package/dist/helpers/templateText.d.ts +1 -0
- package/dist/helpers/templateText.d.ts.map +1 -1
- package/dist/helpers/templateText.js +7 -3
- package/dist/helpers/templateText.js.map +1 -1
- package/dist/helpers/templateTree.d.ts +248 -0
- package/dist/helpers/templateTree.d.ts.map +1 -0
- package/dist/helpers/templateTree.js +892 -0
- package/dist/helpers/templateTree.js.map +1 -0
- package/dist/helpers/templateType.d.ts +28 -0
- package/dist/helpers/templateType.d.ts.map +1 -0
- package/dist/helpers/templateType.js +30 -0
- package/dist/helpers/templateType.js.map +1 -0
- package/dist/helpers/templates.d.ts +86 -16
- package/dist/helpers/templates.d.ts.map +1 -1
- package/dist/helpers/templates.js +305 -45
- package/dist/helpers/templates.js.map +1 -1
- package/dist/helpers/validations.d.ts +27 -0
- package/dist/helpers/validations.d.ts.map +1 -1
- package/dist/helpers/validations.js +169 -39
- package/dist/helpers/validations.js.map +1 -1
- package/dist/helpers/webLink.d.ts +8 -0
- package/dist/helpers/webLink.d.ts.map +1 -0
- package/dist/helpers/webLink.js +29 -0
- package/dist/helpers/webLink.js.map +1 -0
- package/dist/hooks/useQorusTypes.d.ts +12 -17
- package/dist/hooks/useQorusTypes.d.ts.map +1 -1
- package/dist/hooks/useQorusTypes.js +44 -172
- package/dist/hooks/useQorusTypes.js.map +1 -1
- package/dist/hooks/useReadableIntentShade.d.ts +9 -0
- package/dist/hooks/useReadableIntentShade.d.ts.map +1 -0
- package/dist/hooks/useReadableIntentShade.js +23 -0
- package/dist/hooks/useReadableIntentShade.js.map +1 -0
- package/dist/hooks/useReadableOpacity.d.ts +6 -0
- package/dist/hooks/useReadableOpacity.d.ts.map +1 -0
- package/dist/hooks/useReadableOpacity.js +17 -0
- package/dist/hooks/useReadableOpacity.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/dist/tracking/ui/ExperimentCard.d.ts +1 -1
- package/dist/tracking/ui/ExperimentCard.d.ts.map +1 -1
- package/dist/tracking/ui/ExperimentCard.js +26 -10
- package/dist/tracking/ui/ExperimentCard.js.map +1 -1
- package/dist/tracking/ui/card.d.ts +2 -2
- package/dist/tracking/ui/card.d.ts.map +1 -1
- package/dist/tracking/ui/card.js +2 -2
- package/dist/tracking/ui/card.js.map +1 -1
- package/dist/tracking/ui/readable.d.ts +14 -0
- package/dist/tracking/ui/readable.d.ts.map +1 -0
- package/dist/tracking/ui/readable.js +60 -0
- package/dist/tracking/ui/readable.js.map +1 -0
- package/dist/utils/fetch.d.ts +9 -2
- package/dist/utils/fetch.d.ts.map +1 -1
- package/dist/utils/fetch.js +6 -5
- package/dist/utils/fetch.js.map +1 -1
- package/dist/utils/lspClient.types.d.ts +2 -0
- package/dist/utils/lspClient.types.d.ts.map +1 -1
- package/dist/utils/websocket.d.ts +65 -2
- package/dist/utils/websocket.d.ts.map +1 -1
- package/dist/utils/websocket.js +276 -44
- package/dist/utils/websocket.js.map +1 -1
- package/package.json +14 -6
- package/.claude/CLAUDE.md +0 -317
- package/.tasks/EXPORT_EXPRESSION_BUILDER.md +0 -38
- package/.tasks/EXPRESSION_BUILDER_REPORT.md +0 -149
- package/.tasks/EXPRESSION_FIELD_SEAMS.md +0 -66
- package/.tasks/FIELD_STACK_REPORT.md +0 -234
- package/.tasks/FORM_ENGINE_COMPACT_READ_FIRST.md +0 -558
- package/.tasks/FORM_ENGINE_EXPRESSIONS.md +0 -197
- package/.tasks/FORM_ENGINE_OPTIONS_SYNC.md +0 -95
- package/.tasks/FORM_FIELD_EXTRAS.md +0 -72
- package/.tasks/INDEX.md +0 -111
- package/.tasks/LSP_SHARED_CONNECTION.md +0 -75
- package/.tasks/QONSOLE_ASSIST_FEATURES.md +0 -306
- package/.tasks/RENDER_EXPRESSION_LSP.md +0 -159
- package/.tasks/REQRAFT_AUTO_FIELD.md +0 -176
- package/.tasks/SCHEMA_DEFINITION_FIELD.md +0 -250
- package/.tasks/SMART_EDITOR_CONTEXT_AND_POLISH.md +0 -340
- package/.tasks/SMART_EDITOR_LSP_FEATURES.md +0 -299
- package/.tasks/SMART_EDITOR_REVIEW_FOLLOWUPS.md +0 -280
- package/.tasks/SMART_EDITOR_UX_POLISH.md +0 -383
- package/.tasks/SMART_EDITOR_VISUAL_POLISH.md +0 -246
- package/.tasks/STORY_NETWORK_ISOLATION.md +0 -98
- package/.tasks/TEMPLATE_TOKEN_GRAMMAR.md +0 -72
- package/CODE_OF_CONDUCT.md +0 -105
- package/CONTRIBUTING.MD +0 -78
- package/SECURITY.md +0 -3
- package/chromatic.config.json +0 -5
- package/design/COMPACT_ENGINE_REDESIGN.md +0 -156
- package/design/COMPACT_INFO_DISPLAY.md +0 -87
- package/design/COMPACT_PARITY.md +0 -85
- package/design/EXPRESSION_BUILDER_REPORT_STRATEGY.md +0 -92
- package/design/FORM_ENGINE_COMPACT.md +0 -300
- package/design/FORM_ENGINE_COMPACT_UX_PLAN.md +0 -353
- package/design/FORM_ENGINE_EXPRESSIONS.md +0 -257
- package/design/FORM_ENGINE_FIELD_MIGRATION.md +0 -419
- package/design/IDE_INTEGRATION.md +0 -64
- package/design/RENDER_EXPRESSION_TRANSPORT.md +0 -156
- package/design/SELECT_DIALOG_FLOOR.md +0 -86
- package/design/SMART_EDITOR_UX.md +0 -438
- package/design/TRACKING.md +0 -290
- package/design/UNAVAILABLE_ALLOWED_VALUES.md +0 -226
- package/dist/components/form/engine/formAppearance.d.ts +0 -49
- package/dist/components/form/engine/formAppearance.d.ts.map +0 -1
- package/dist/components/form/engine/formAppearance.js +0 -50
- package/dist/components/form/engine/formAppearance.js.map +0 -1
- package/dist/components/form/fields/ChoiceGroupHeading.d.ts +0 -21
- package/dist/components/form/fields/ChoiceGroupHeading.d.ts.map +0 -1
- package/dist/components/form/fields/ChoiceGroupHeading.js +0 -33
- package/dist/components/form/fields/ChoiceGroupHeading.js.map +0 -1
- package/dist/components/form/fields/allowed-values/savedValues.d.ts +0 -30
- package/dist/components/form/fields/allowed-values/savedValues.d.ts.map +0 -1
- package/dist/components/form/fields/allowed-values/savedValues.js +0 -39
- package/dist/components/form/fields/allowed-values/savedValues.js.map +0 -1
- package/dist/helpers/fieldDescription.d.ts +0 -16
- package/dist/helpers/fieldDescription.d.ts.map +0 -1
- package/dist/helpers/fieldDescription.js +0 -40
- package/dist/helpers/fieldDescription.js.map +0 -1
- package/src/components/Description/index.tsx +0 -254
- package/src/components/Description/markdownRendererContext.tsx +0 -29
- package/src/components/FocusedEditing/index.tsx +0 -50
- package/src/components/codeSize/index.tsx +0 -79
- package/src/components/composer/Composer.stories.tsx +0 -238
- package/src/components/composer/Composer.tsx +0 -554
- package/src/components/composer/helpers.ts +0 -74
- package/src/components/composer/index.ts +0 -2
- package/src/components/dpqlEditor/DpqlEditor.stories.tsx +0 -1183
- package/src/components/dpqlEditor/DpqlEditor.tsx +0 -219
- package/src/components/dpqlEditor/dpqlHelpers.ts +0 -287
- package/src/components/dpqlEditor/dpqlInserter.ts +0 -121
- package/src/components/dpqlEditor/dpqlProbe.ts +0 -165
- package/src/components/dpqlEditor/dpqlTags.ts +0 -114
- package/src/components/dpqlEditor/index.ts +0 -41
- package/src/components/dpqlEditor/types.ts +0 -203
- package/src/components/dpqlEditor/useDpqlProbe.ts +0 -33
- package/src/components/dpqlEditor/useDpqlSession.ts +0 -411
- package/src/components/form/engine/CompactRow.tsx +0 -2740
- package/src/components/form/engine/CompactToolbar.tsx +0 -399
- package/src/components/form/engine/FormEngine.stories.tsx +0 -9934
- package/src/components/form/engine/FormEngine.tsx +0 -4891
- package/src/components/form/engine/FormEngineAppearance.stories.tsx +0 -609
- package/src/components/form/engine/FormEngineRemote.stories.tsx +0 -679
- package/src/components/form/engine/FormEngineStickyHeaders.stories.tsx +0 -335
- package/src/components/form/engine/FormFieldsSkeleton.tsx +0 -82
- package/src/components/form/engine/OptionFieldMessages.tsx +0 -548
- package/src/components/form/engine/OptionsHelpDialog.tsx +0 -29
- package/src/components/form/engine/__fixtures__/basicFormOptions.ts +0 -309
- package/src/components/form/engine/__fixtures__/fieldChromeOptions.ts +0 -45
- package/src/components/form/engine/_structuredData/SchemaDataView.stories.tsx +0 -233
- package/src/components/form/engine/_structuredData/SchemaDataView.tsx +0 -755
- package/src/components/form/engine/_structuredData/StructuredDataView.stories.tsx +0 -85
- package/src/components/form/engine/_structuredData/StructuredDataView.tsx +0 -75
- package/src/components/form/engine/_structuredData/structuredData.ts +0 -145
- package/src/components/form/engine/compactRowContext.ts +0 -153
- package/src/components/form/engine/compactRowStyles.ts +0 -1087
- package/src/components/form/engine/compactToolbarContext.ts +0 -72
- package/src/components/form/engine/formAppearance.ts +0 -79
- package/src/components/form/engine/optionActions.ts +0 -128
- package/src/components/form/engine/optionsContext.ts +0 -24
- package/src/components/form/engine/readFirst.ts +0 -1090
- package/src/components/form/engine/rendererTypes.ts +0 -107
- package/src/components/form/engine/revealRow.ts +0 -123
- package/src/components/form/engine/rowFocus.ts +0 -112
- package/src/components/form/engine/rowMenuContext.ts +0 -159
- package/src/components/form/engine/rowOpenPicker.ts +0 -27
- package/src/components/form/engine/typeChoices.ts +0 -63
- package/src/components/form/engine/variants/FormEngineVariants.stories.tsx +0 -159
- package/src/components/form/engine/variants/VariantCalmTable.tsx +0 -244
- package/src/components/form/engine/variants/VariantCards.tsx +0 -212
- package/src/components/form/engine/variants/VariantFocus.tsx +0 -382
- package/src/components/form/engine/variants/VariantMinimal.tsx +0 -170
- package/src/components/form/engine/variants/focusDemo.ts +0 -145
- package/src/components/form/engine/variants/variantModel.ts +0 -223
- package/src/components/form/engine/variants/variantParts.tsx +0 -313
- package/src/components/form/expressions/DpqlRendering.tsx +0 -85
- package/src/components/form/expressions/ExpressionField.stories.tsx +0 -1395
- package/src/components/form/expressions/ExpressionField.tsx +0 -503
- package/src/components/form/expressions/argumentPresence.ts +0 -213
- package/src/components/form/expressions/builder/ExpressionBuilder.stories.tsx +0 -1683
- package/src/components/form/expressions/builder/argumentDetail.tsx +0 -17
- package/src/components/form/expressions/builder/argumentLabel.tsx +0 -146
- package/src/components/form/expressions/builder/argumentSlot.tsx +0 -101
- package/src/components/form/expressions/builder/argumentWrapper.tsx +0 -243
- package/src/components/form/expressions/builder/confirmMismatchedTypesModal.tsx +0 -120
- package/src/components/form/expressions/builder/confirmUnsupportedTypeModal.tsx +0 -69
- package/src/components/form/expressions/builder/index.tsx +0 -1545
- package/src/components/form/expressions/builder/item.tsx +0 -89
- package/src/components/form/expressions/builder/moveToPositionStrip.tsx +0 -156
- package/src/components/form/expressions/builder/renderTemplate.tsx +0 -42
- package/src/components/form/expressions/dpqlMockLanguage.ts +0 -566
- package/src/components/form/expressions/dpqlMockLsp.ts +0 -126
- package/src/components/form/expressions/mockExpressions.ts +0 -317
- package/src/components/form/expressions/renderExpressionToText.ts +0 -152
- package/src/components/form/expressions/types.ts +0 -110
- package/src/components/form/expressions/useExpressions.ts +0 -101
- package/src/components/form/expressions/useRenderExpression.ts +0 -165
- package/src/components/form/fields/ChoiceGroupHeading.tsx +0 -38
- package/src/components/form/fields/Field.stories.tsx +0 -143
- package/src/components/form/fields/Field.tsx +0 -734
- package/src/components/form/fields/allowed-values/AllowedValues.tsx +0 -321
- package/src/components/form/fields/allowed-values/savedValues.ts +0 -64
- package/src/components/form/fields/array/ArrayAuto.tsx +0 -237
- package/src/components/form/fields/array/ArrayAutoField.stories.tsx +0 -475
- package/src/components/form/fields/array/ArrayAutoField.tsx +0 -367
- package/src/components/form/fields/auto/AutoFormField.stories.tsx +0 -825
- package/src/components/form/fields/auto/AutoFormField.tsx +0 -1183
- package/src/components/form/fields/binary/Binary.stories.tsx +0 -122
- package/src/components/form/fields/binary/Binary.tsx +0 -91
- package/src/components/form/fields/boolean/Boolean.stories.tsx +0 -125
- package/src/components/form/fields/boolean/Boolean.tsx +0 -34
- package/src/components/form/fields/byte-size/ByteSize.stories.tsx +0 -87
- package/src/components/form/fields/byte-size/ByteSize.tsx +0 -58
- package/src/components/form/fields/color/Color.stories.tsx +0 -99
- package/src/components/form/fields/color/Color.tsx +0 -46
- package/src/components/form/fields/cron/Cron.stories.tsx +0 -68
- package/src/components/form/fields/cron/Cron.tsx +0 -80
- package/src/components/form/fields/date/Date.stories.tsx +0 -77
- package/src/components/form/fields/date/Date.tsx +0 -55
- package/src/components/form/fields/emittedValues.ts +0 -70
- package/src/components/form/fields/file/File.stories.tsx +0 -161
- package/src/components/form/fields/file/File.tsx +0 -227
- package/src/components/form/fields/long-string/LongString.stories.tsx +0 -147
- package/src/components/form/fields/long-string/LongString.tsx +0 -141
- package/src/components/form/fields/markdown/Markdown.stories.tsx +0 -76
- package/src/components/form/fields/markdown/Markdown.tsx +0 -81
- package/src/components/form/fields/markdown/MarkdownView.tsx +0 -222
- package/src/components/form/fields/multi-select/MultiSelectFormField.tsx +0 -140
- package/src/components/form/fields/number/Number.stories.tsx +0 -159
- package/src/components/form/fields/number/Number.tsx +0 -175
- package/src/components/form/fields/object/Object.stories.tsx +0 -398
- package/src/components/form/fields/object/Object.tsx +0 -255
- package/src/components/form/fields/radio-group/RadioGroup.stories.tsx +0 -95
- package/src/components/form/fields/radio-group/RadioGroup.tsx +0 -52
- package/src/components/form/fields/radio-group/images/java-96x128.png +0 -0
- package/src/components/form/fields/radio-group/images/python-129x128.png +0 -0
- package/src/components/form/fields/radio-group/images/qore-106x128.png +0 -0
- package/src/components/form/fields/rich-text/RichText.stories.tsx +0 -260
- package/src/components/form/fields/rich-text/RichText.tsx +0 -537
- package/src/components/form/fields/schema-definition/CatalogLeafForm.tsx +0 -242
- package/src/components/form/fields/schema-definition/CatalogNodeEditor.tsx +0 -758
- package/src/components/form/fields/schema-definition/Hint.tsx +0 -22
- package/src/components/form/fields/schema-definition/InlineValidationBanner.tsx +0 -138
- package/src/components/form/fields/schema-definition/Loader.tsx +0 -20
- package/src/components/form/fields/schema-definition/MigrationsTab.tsx +0 -187
- package/src/components/form/fields/schema-definition/SchemaDefinitionField.stories.tsx +0 -286
- package/src/components/form/fields/schema-definition/TableEditor.tsx +0 -155
- package/src/components/form/fields/schema-definition/TablesTab.tsx +0 -138
- package/src/components/form/fields/schema-definition/catalog.ts +0 -237
- package/src/components/form/fields/schema-definition/helpers.ts +0 -90
- package/src/components/form/fields/schema-definition/index.tsx +0 -418
- package/src/components/form/fields/schema-definition/mockCatalog.ts +0 -325
- package/src/components/form/fields/schema-definition/mockDefinition.ts +0 -111
- package/src/components/form/fields/schema-definition/referenceSuggestions.tsx +0 -152
- package/src/components/form/fields/schema-definition/starterTemplate.ts +0 -68
- package/src/components/form/fields/schema-definition/types.ts +0 -185
- package/src/components/form/fields/schema-definition/useSchemaOptionCatalog.ts +0 -49
- package/src/components/form/fields/select/Select.stories.tsx +0 -872
- package/src/components/form/fields/select/Select.tsx +0 -624
- package/src/components/form/fields/select/SelectCollection.tsx +0 -594
- package/src/components/form/fields/string/String.stories.tsx +0 -86
- package/src/components/form/fields/string/String.tsx +0 -43
- package/src/components/form/fields/template/ExampleValueModal.stories.tsx +0 -114
- package/src/components/form/fields/template/ExampleValueModal.tsx +0 -99
- package/src/components/form/fields/template/ReadOnlyTemplateTag.tsx +0 -47
- package/src/components/form/fields/template/TemplateField.stories.tsx +0 -1121
- package/src/components/form/fields/template/TemplateField.tsx +0 -1749
- package/src/components/form/fields/template/TemplateText.tsx +0 -115
- package/src/components/form/fields/template/__fixtures__/longExampleValue.ts +0 -7
- package/src/components/form/fields/template/__fixtures__/multiLevelTemplates.json +0 -147
- package/src/components/form/fields/template/__fixtures__/templates.json +0 -83
- package/src/components/form/fields/timeout/Timeout.stories.tsx +0 -228
- package/src/components/form/fields/timeout/Timeout.tsx +0 -87
- package/src/components/form/fields/url/Url.stories.tsx +0 -94
- package/src/components/form/fields/url/Url.tsx +0 -85
- package/src/components/form/index.tsx +0 -49
- package/src/components/imageLightbox/ImageLightbox.stories.tsx +0 -238
- package/src/components/imageLightbox/ImageLightbox.tsx +0 -238
- package/src/components/imageLightbox/index.ts +0 -1
- package/src/components/log/Log.stories.tsx +0 -333
- package/src/components/log/Log.tsx +0 -285
- package/src/components/menu/Menu.stories.tsx +0 -155
- package/src/components/menu/Menu.tsx +0 -312
- package/src/components/qonsoleSmartInput/QonsoleSmartInput.stories.tsx +0 -797
- package/src/components/qonsoleSmartInput/QonsoleSmartInput.tsx +0 -105
- package/src/components/qonsoleSmartInput/index.ts +0 -16
- package/src/components/qonsoleSmartInput/qonsoleInserter.ts +0 -77
- package/src/components/qonsoleSmartInput/types.ts +0 -133
- package/src/components/qonsoleSmartInput/useQonsoleSession.ts +0 -124
- package/src/components/searchFilterBar/SearchFilterBar.stories.tsx +0 -62
- package/src/components/searchFilterBar/SearchFilterBar.tsx +0 -144
- package/src/components/searchFilterBar/index.ts +0 -1
- package/src/components/smartEditor/MarkdownDoc.tsx +0 -190
- package/src/components/smartEditor/SmartEditor.stories.tsx +0 -475
- package/src/components/smartEditor/SmartEditor.tsx +0 -808
- package/src/components/smartEditor/__fixtures__/mockLspServer.ts +0 -205
- package/src/components/smartEditor/helpers.ts +0 -217
- package/src/components/smartEditor/index.ts +0 -35
- package/src/components/smartEditor/styling.ts +0 -45
- package/src/components/smartEditor/types.ts +0 -211
- package/src/components/smartEditor/useLspAutocomplete.ts +0 -758
- package/src/components/smartEditor/useLspDiagnosticDecorations.ts +0 -125
- package/src/components/smartEditor/useLspHover.ts +0 -230
- package/src/components/smartEditor/useLspSemanticTokens.ts +0 -298
- package/src/components/smartEditor/useLspSession.ts +0 -231
- package/src/components/smartEditor/useLspSignatureHelp.ts +0 -198
- package/src/components/supportTicket/AttachmentChips.stories.tsx +0 -171
- package/src/components/supportTicket/AttachmentChips.tsx +0 -147
- package/src/components/supportTicket/InterfaceReferenceTags.stories.tsx +0 -257
- package/src/components/supportTicket/InterfaceReferenceTags.tsx +0 -130
- package/src/components/supportTicket/ReferencePicker.stories.tsx +0 -580
- package/src/components/supportTicket/ReferencePicker.tsx +0 -573
- package/src/components/supportTicket/TicketConversation.stories.tsx +0 -120
- package/src/components/supportTicket/TicketHeader.stories.tsx +0 -183
- package/src/components/supportTicket/TicketHeader.tsx +0 -248
- package/src/components/supportTicket/TicketMetaTags.stories.tsx +0 -103
- package/src/components/supportTicket/TicketMetaTags.tsx +0 -85
- package/src/components/supportTicket/TicketReplyBox.stories.tsx +0 -357
- package/src/components/supportTicket/TicketReplyBox.tsx +0 -172
- package/src/components/supportTicket/__fixtures__/kindMarks.ts +0 -28
- package/src/components/supportTicket/attachmentAccess.ts +0 -97
- package/src/components/supportTicket/fileToAttachment.ts +0 -24
- package/src/components/supportTicket/index.ts +0 -10
- package/src/components/supportTicket/meta.ts +0 -206
- package/src/components/supportTicket/ticketModel.ts +0 -131
- package/src/components/supportTicket/useLoadedImages.ts +0 -93
- package/src/components/ticketReferences/TicketReferences.stories.tsx +0 -341
- package/src/components/ticketReferences/TicketReferences.tsx +0 -914
- package/src/components/ticketReferences/index.ts +0 -2
- package/src/components/ticketThread/TicketThread.stories.tsx +0 -898
- package/src/components/ticketThread/TicketThread.tsx +0 -706
- package/src/components/ticketThread/index.ts +0 -6
- package/src/contexts/FetchContext.tsx +0 -25
- package/src/contexts/ReqraftContext.tsx +0 -9
- package/src/contexts/StorageContext.tsx +0 -33
- package/src/global.d.ts +0 -4
- package/src/helpers/allowedValues.ts +0 -268
- package/src/helpers/choiceChip.ts +0 -227
- package/src/helpers/common.ts +0 -326
- package/src/helpers/dpqlDetection.ts +0 -209
- package/src/helpers/expressions.ts +0 -140
- package/src/helpers/fieldDescription.ts +0 -39
- package/src/helpers/optionUiTypes.ts +0 -199
- package/src/helpers/options.ts +0 -150
- package/src/helpers/providerValue.ts +0 -125
- package/src/helpers/scrollbar.ts +0 -32
- package/src/helpers/singleLineString.ts +0 -62
- package/src/helpers/templateItems.ts +0 -81
- package/src/helpers/templateText.ts +0 -350
- package/src/helpers/templates.ts +0 -602
- package/src/helpers/validations.ts +0 -2085
- package/src/hooks/useArgSchema.ts +0 -37
- package/src/hooks/useCoarsePointer.ts +0 -30
- package/src/hooks/useFetch/useFetch.stories.tsx +0 -379
- package/src/hooks/useFetch/useFetch.tsx +0 -154
- package/src/hooks/usePhoneViewport.ts +0 -34
- package/src/hooks/useQorusTypes.ts +0 -233
- package/src/hooks/useReqraftProperty.ts +0 -16
- package/src/hooks/useStorage/useStorage.stories.tsx +0 -168
- package/src/hooks/useStorage/useStorage.ts +0 -35
- package/src/hooks/useTemplates.ts +0 -123
- package/src/hooks/useValidation.ts +0 -9
- package/src/hooks/useWebSocket/useWebSocket.ts +0 -224
- package/src/hooks/useWebSocket/useWebsocket.stories.tsx +0 -640
- package/src/hooks/useWhyDidYouUpdate.ts +0 -38
- package/src/index.tsx +0 -86
- package/src/providers/FetchProvider.tsx +0 -40
- package/src/providers/ReqraftProvider.tsx +0 -52
- package/src/providers/StorageProvider.tsx +0 -131
- package/src/stores/currentUser/currentUser.stories.tsx +0 -100
- package/src/stores/currentUser/currentUser.tsx +0 -94
- package/src/stories/Data/fileFieldArgSchema.json +0 -86
- package/src/stories/Tests/utils.ts +0 -320
- package/src/stories/storyNetwork.ts +0 -92
- package/src/stories/tracking.tsx +0 -206
- package/src/tracking/browser/attach.ts +0 -186
- package/src/tracking/browser/env.ts +0 -78
- package/src/tracking/core/consent.ts +0 -37
- package/src/tracking/core/engagement.ts +0 -47
- package/src/tracking/core/experiments.ts +0 -258
- package/src/tracking/core/hash.ts +0 -26
- package/src/tracking/core/ids.ts +0 -25
- package/src/tracking/core/observable.ts +0 -23
- package/src/tracking/core/queue.ts +0 -131
- package/src/tracking/core/sections.ts +0 -166
- package/src/tracking/core/storage.ts +0 -69
- package/src/tracking/core/tracker.ts +0 -417
- package/src/tracking/core/types.ts +0 -162
- package/src/tracking/core/utm.ts +0 -23
- package/src/tracking/index.ts +0 -72
- package/src/tracking/markup.ts +0 -17
- package/src/tracking/react/Experiment.tsx +0 -44
- package/src/tracking/react/TrackingProvider.tsx +0 -56
- package/src/tracking/react/hooks.ts +0 -106
- package/src/tracking/react/index.ts +0 -13
- package/src/tracking/testing.ts +0 -108
- package/src/tracking/ui/ExperimentCard.stories.tsx +0 -296
- package/src/tracking/ui/ExperimentCard.tsx +0 -667
- package/src/tracking/ui/ExperimentsOverlay.stories.tsx +0 -155
- package/src/tracking/ui/ExperimentsOverlay.tsx +0 -437
- package/src/tracking/ui/anchor.ts +0 -180
- package/src/tracking/ui/card.ts +0 -464
- package/src/tracking/ui/client.ts +0 -117
- package/src/tracking/ui/index.ts +0 -77
- package/src/tracking/ui/types.ts +0 -110
- package/src/tracking/ui/useExperimentsAdmin.ts +0 -103
- package/src/types/Form.ts +0 -29
- package/src/types.ts +0 -14
- package/src/utils/datetime.ts +0 -10
- package/src/utils/fetch.ts +0 -457
- package/src/utils/lspClient.ts +0 -711
- package/src/utils/lspClient.types.ts +0 -211
- package/src/utils/queryUnlessCancelled.ts +0 -28
- package/src/utils/websocket.ts +0 -293
- package/vite.config.ts +0 -58
- package/vitest.config.ts +0 -69
|
@@ -1,1090 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IQorusFormField,
|
|
3
|
-
IQorusFormSchema,
|
|
4
|
-
TQorusFormFieldSchema,
|
|
5
|
-
TQorusType,
|
|
6
|
-
} from '@qoretechnologies/ts-toolkit';
|
|
7
|
-
import { isRendererOnlyUiType } from './rendererTypes';
|
|
8
|
-
import { isEmptyUiEnvelope, isUiEncodedValue } from './_structuredData/structuredData';
|
|
9
|
-
import { renderExpressionToText } from '../expressions/renderExpressionToText';
|
|
10
|
-
import { IExpressionValue } from '../expressions/types';
|
|
11
|
-
import yaml from 'js-yaml';
|
|
12
|
-
import { formatTimeoutValue, richtextToString } from '../../../helpers/common';
|
|
13
|
-
import { firstDeclaredType } from '../../../helpers/optionUiTypes';
|
|
14
|
-
import { findAllowedValueOption } from '../../../helpers/allowedValues';
|
|
15
|
-
|
|
16
|
-
/** "N noun" with naive pluralisation ("1 item", "2 items"). */
|
|
17
|
-
const pluralize = (count: number, noun: string): string =>
|
|
18
|
-
`${count} ${noun}${count === 1 ? '' : 's'}`;
|
|
19
|
-
|
|
20
|
-
// The server's typed-value serialization wraps each value in an envelope —
|
|
21
|
-
// `{ type, value }` plus optional descriptive keys. Only this exact shape is
|
|
22
|
-
// unwrapped; any foreign key means it's a real user hash, not an envelope.
|
|
23
|
-
// One envelope definition for the whole engine: the structured tree and the
|
|
24
|
-
// hash summaries must agree on what unwraps (`isUiEncodedValue` carries the
|
|
25
|
-
// full server allow-list, incl. keys like `sensitive`/`required`).
|
|
26
|
-
const isTypedEnvelope = (raw: unknown): raw is IQorusFormField => isUiEncodedValue(raw);
|
|
27
|
-
|
|
28
|
-
/** Reduce ONE list item to a short, human label — never an object. Unwraps a
|
|
29
|
-
* typed `{type, value}` envelope, prefers a `name`/`display_name`, and returns
|
|
30
|
-
* undefined for a bare object (no name) so the caller falls back to a count
|
|
31
|
-
* instead of printing "[object Object]". */
|
|
32
|
-
const summarizeListItem = (item: unknown): string | number | undefined => {
|
|
33
|
-
if (item === null || item === undefined) return undefined;
|
|
34
|
-
if (typeof item !== 'object') return item as string | number;
|
|
35
|
-
const obj = item as Record<string, unknown>;
|
|
36
|
-
// A named object (or allowed-value) → its label.
|
|
37
|
-
if (typeof obj.name === 'string' || typeof obj.name === 'number') return obj.name;
|
|
38
|
-
if (typeof obj.display_name === 'string') return obj.display_name;
|
|
39
|
-
// A typed envelope ({type, value}) or a {value} wrapper → look inside once.
|
|
40
|
-
if ('value' in obj) {
|
|
41
|
-
const inner = obj.value;
|
|
42
|
-
if (inner === null || inner === undefined) return undefined;
|
|
43
|
-
if (typeof inner !== 'object') return inner as string | number;
|
|
44
|
-
const innerName = (inner as Record<string, unknown>).name;
|
|
45
|
-
return typeof innerName === 'string' || typeof innerName === 'number' ? innerName : undefined;
|
|
46
|
-
}
|
|
47
|
-
return undefined;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Label ONE list item from the sub-schema that describes it.
|
|
52
|
-
*
|
|
53
|
-
* `summarizeListItem` can only read an item that names ITSELF — one carrying a
|
|
54
|
-
* `name` or `display_name` key. A hash whose fields are all domain fields names
|
|
55
|
-
* itself nowhere: an auth profile's scheme has `type`, `cookie_name`,
|
|
56
|
-
* `redirect_url`, and the row fell back to "2 items" — true, and silent about
|
|
57
|
-
* which two.
|
|
58
|
-
*
|
|
59
|
-
* The `arg_schema` is the same description the sub-form was built from, so the
|
|
60
|
-
* row can read an item the way the form asked for it: the FIRST declared field
|
|
61
|
-
* the item actually has, resolved through that field's allowed values. The
|
|
62
|
-
* scheme list then reads "Default RBAC, Cookie" — the words the author picked —
|
|
63
|
-
* instead of a count.
|
|
64
|
-
*
|
|
65
|
-
* Schema order, not value order: the first declared field is the one the form
|
|
66
|
-
* puts at the top of the item, which is the one that identifies it to its author.
|
|
67
|
-
* Value order is insertion order and would vary between two equal items.
|
|
68
|
-
*/
|
|
69
|
-
const summarizeHashItemFromSchema = (
|
|
70
|
-
item: unknown,
|
|
71
|
-
argSchema: Record<string, TQorusFormFieldSchema> | undefined
|
|
72
|
-
): string | number | undefined => {
|
|
73
|
-
if (!argSchema) {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
const record = isTypedEnvelope(item) ? item.value : item;
|
|
77
|
-
if (!record || typeof record !== 'object' || Array.isArray(record)) {
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
const fields = record as Record<string, unknown>;
|
|
81
|
-
const key = Object.keys(argSchema).find((name) => {
|
|
82
|
-
const raw = fields[name];
|
|
83
|
-
const value = isTypedEnvelope(raw) ? raw.value : raw;
|
|
84
|
-
return value !== undefined && value !== null && value !== '';
|
|
85
|
-
});
|
|
86
|
-
if (!key) {
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
const raw = fields[key];
|
|
90
|
-
const value = isTypedEnvelope(raw) ? raw.value : raw;
|
|
91
|
-
const label = getAllowedValueLabel(value, argSchema[key]);
|
|
92
|
-
if (label) {
|
|
93
|
-
return label;
|
|
94
|
-
}
|
|
95
|
-
// No allowed values (a free-text field): the stored value IS what was typed,
|
|
96
|
-
// so it reads correctly as-is. An object at this position has no short form,
|
|
97
|
-
// and a count beats printing its shape.
|
|
98
|
-
return typeof value === 'string' || typeof value === 'number' ? value : undefined;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/** Summarise a list value: join item labels, or fall back to an "N items" count
|
|
102
|
-
* (e.g. a list of anonymous hashes). Never prints raw objects. */
|
|
103
|
-
/**
|
|
104
|
-
* Join a list into one line, labelling each item from the field's allowed values
|
|
105
|
-
* where it has them.
|
|
106
|
-
*
|
|
107
|
-
* A multi-select stores what the server stores -- a parse option is
|
|
108
|
-
* `PO_REQUIRE_TYPES`, a permission is a code -- and the picker is what turns
|
|
109
|
-
* that into something readable. The row has the same allowed values the picker
|
|
110
|
-
* does, so it can read the same way instead of printing the wire form back.
|
|
111
|
-
*/
|
|
112
|
-
const formatList = (items: unknown[], schema?: TQorusFormFieldSchema): string => {
|
|
113
|
-
const argSchema = (schema as { arg_schema?: Record<string, TQorusFormFieldSchema> } | undefined)
|
|
114
|
-
?.arg_schema;
|
|
115
|
-
const parts = items
|
|
116
|
-
.map(
|
|
117
|
-
(item) =>
|
|
118
|
-
getAllowedValueLabel(item, schema) ??
|
|
119
|
-
summarizeListItem(item) ??
|
|
120
|
-
summarizeHashItemFromSchema(item, argSchema)
|
|
121
|
-
)
|
|
122
|
-
.filter((part) => part !== '' && part !== undefined && part !== null);
|
|
123
|
-
|
|
124
|
-
return parts.length ? parts.join(', ') : pluralize(items.length, 'item');
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
/** "datasource · omquser · /bb_local": the provider's kind, its name and its
|
|
128
|
-
* path, as the picker shows them. A read row must say WHICH provider a value
|
|
129
|
-
* is, and "11 fields" said only how many keys describe it. Undefined when the
|
|
130
|
-
* value is not shaped like a provider, so the caller falls through. */
|
|
131
|
-
export const formatDataProviderValue = (value: unknown): string | undefined => {
|
|
132
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
133
|
-
return undefined;
|
|
134
|
-
}
|
|
135
|
-
const { type, name, path } = value as { type?: unknown; name?: unknown; path?: unknown };
|
|
136
|
-
const parts = [type, name, path].filter(
|
|
137
|
-
(part): part is string => typeof part === 'string' && part.trim() !== ''
|
|
138
|
-
);
|
|
139
|
-
return parts.length ? parts.join(' · ') : undefined;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
/** Summarise a hash/object by its field count ("2 fields"), or "Set" when empty. */
|
|
143
|
-
const fieldCountLabel = (obj: object): string => {
|
|
144
|
-
const keys = Object.keys(obj);
|
|
145
|
-
return keys.length ? pluralize(keys.length, 'field') : 'Set';
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
/** The object/list editor stores complex values as a serialized YAML string
|
|
149
|
-
* (`%YAML 1.2 --- […]`) — parse it back for the summary; undefined when the
|
|
150
|
-
* string isn't a serialized structure. */
|
|
151
|
-
const parseSerialized = (value: string, type?: string): unknown => {
|
|
152
|
-
const looksLikeYamlDoc = /^\s*(%YAML|---)\s/.test(value);
|
|
153
|
-
if (type !== 'list' && type !== 'hash' && !looksLikeYamlDoc) {
|
|
154
|
-
return undefined;
|
|
155
|
-
}
|
|
156
|
-
try {
|
|
157
|
-
return yaml.load(value);
|
|
158
|
-
} catch {
|
|
159
|
-
return undefined;
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Pure helpers for FormEngine compact (read-first) mode: format an option's
|
|
165
|
-
* stored value into a short summary and resolve its group. Unit-testable.
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
|
-
/** A value is "empty" (nothing set) when it is nullish, an empty string, or an empty array. */
|
|
169
|
-
export const isOptionValueEmpty = (value: unknown): boolean =>
|
|
170
|
-
value === undefined ||
|
|
171
|
-
value === null ||
|
|
172
|
-
value === '' ||
|
|
173
|
-
(Array.isArray(value) && value.length === 0);
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* A schema-declared hash whose every entry is a materialised-but-unset field.
|
|
177
|
-
*
|
|
178
|
-
* `preselected` on a sub-field means "show this in the form so the author sees
|
|
179
|
-
* it exists" — a FORM instruction. Opening the sub-form materialises each one,
|
|
180
|
-
* `fixOptions` writes `{type: 'int'}` with no value, and the draft autosaves
|
|
181
|
-
* that, so the stored hash permanently carries keys that stand for nothing.
|
|
182
|
-
*
|
|
183
|
-
* The row then read those keys as content: `Runtime Defaults` listed three
|
|
184
|
-
* sub-fields with no values, counted toward "7/12 set", and showed a green
|
|
185
|
-
* set-dot — while the sub-form it summarises correctly said 0/3 set. Nothing
|
|
186
|
-
* was ever entered.
|
|
187
|
-
*
|
|
188
|
-
* Requires the sub-schema, and requires each key to be declared by it: without
|
|
189
|
-
* that, `{type: 'x'}` could be somebody's data rather than an empty envelope.
|
|
190
|
-
*/
|
|
191
|
-
export const isUnsetSchemaHash = (value: unknown, schema?: TQorusFormFieldSchema): boolean => {
|
|
192
|
-
const argSchema = (schema as { arg_schema?: Record<string, unknown> } | undefined)?.arg_schema;
|
|
193
|
-
if (!argSchema || typeof argSchema !== 'object') {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
const inner =
|
|
197
|
-
value && typeof value === 'object' && !Array.isArray(value) && 'value' in (value as object) ?
|
|
198
|
-
(value as { value: unknown }).value
|
|
199
|
-
: value;
|
|
200
|
-
if (!inner || typeof inner !== 'object' || Array.isArray(inner)) {
|
|
201
|
-
return false;
|
|
202
|
-
}
|
|
203
|
-
const keys = Object.keys(inner as object);
|
|
204
|
-
return (
|
|
205
|
-
keys.length > 0 &&
|
|
206
|
-
keys.every(
|
|
207
|
-
(key) =>
|
|
208
|
-
!!(argSchema as Record<string, unknown>)[key] &&
|
|
209
|
-
isEmptyUiEnvelope((inner as Record<string, unknown>)[key])
|
|
210
|
-
)
|
|
211
|
-
);
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
export const isFixedCompactAllowedValueOption = (
|
|
215
|
-
schema: TQorusFormFieldSchema | undefined
|
|
216
|
-
): boolean => {
|
|
217
|
-
if (!schema) {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const selectableSchema = schema as TQorusFormFieldSchema & { items?: unknown[] };
|
|
222
|
-
const options =
|
|
223
|
-
selectableSchema.allowed_values?.length ?
|
|
224
|
-
selectableSchema.allowed_values
|
|
225
|
-
: selectableSchema.items;
|
|
226
|
-
|
|
227
|
-
return !!(
|
|
228
|
-
options?.length &&
|
|
229
|
-
!schema.allowed_values_creatable &&
|
|
230
|
-
!schema.multiselect &&
|
|
231
|
-
!schema.arg_schema
|
|
232
|
-
);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
export const shouldAutoCollapseCompactAllowedValueOption = (
|
|
236
|
-
schema: TQorusFormFieldSchema | undefined,
|
|
237
|
-
value: unknown
|
|
238
|
-
): boolean => !isOptionValueEmpty(value) && isFixedCompactAllowedValueOption(schema);
|
|
239
|
-
|
|
240
|
-
/** Boolean fields have three meaningful states: unset, Yes, and No. Once the
|
|
241
|
-
* user chooses either boolean value in compact mode, the choice is complete
|
|
242
|
-
* and the inline editor can close without a separate confirmation. */
|
|
243
|
-
export const isCompactBooleanOption = (schema: TQorusFormFieldSchema | undefined): boolean => {
|
|
244
|
-
const type = firstDeclaredType(schema?.ui_type || schema?.type)?.toLowerCase();
|
|
245
|
-
return type === 'bool' || type === 'boolean';
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Whether a change completes a compact row, so its editor can close.
|
|
250
|
-
*
|
|
251
|
-
* Only a VALUE does: Yes or No, or one of a fixed list. An expression is
|
|
252
|
-
* built one step at a time - an operation, then each of its arguments - and
|
|
253
|
-
* every step is a change; closing the editor on the first one left a bool
|
|
254
|
-
* field's condition at `null > null`, with no way to fill in its arguments
|
|
255
|
-
* short of opening the row again for each of them.
|
|
256
|
-
*
|
|
257
|
-
* @param isExpression the row now holds an expression (`is_expression`)
|
|
258
|
-
*/
|
|
259
|
-
export const shouldAutoCollapseCompactOption = (
|
|
260
|
-
schema: TQorusFormFieldSchema | undefined,
|
|
261
|
-
value: unknown,
|
|
262
|
-
isExpression?: boolean
|
|
263
|
-
): boolean =>
|
|
264
|
-
!isExpression &&
|
|
265
|
-
!isOptionValueEmpty(value) &&
|
|
266
|
-
(isCompactBooleanOption(schema) || isFixedCompactAllowedValueOption(schema));
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Prefer the matching allowed_values entry's display_name (fallback `name`)
|
|
270
|
-
* over the raw stored value. The predicate lives in `helpers/allowedValues`,
|
|
271
|
-
* where the validator uses it too, so a value the row can name is exactly a
|
|
272
|
-
* value the form accepts.
|
|
273
|
-
*/
|
|
274
|
-
export { findAllowedValueOption };
|
|
275
|
-
|
|
276
|
-
const getAllowedValueLabel = (
|
|
277
|
-
value: unknown,
|
|
278
|
-
schema?: TQorusFormFieldSchema
|
|
279
|
-
): string | undefined => {
|
|
280
|
-
const match = findAllowedOption(value, schema);
|
|
281
|
-
return match ? match.display_name || match.title || match.name || undefined : undefined;
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
/** Local alias for the module's own callers. */
|
|
285
|
-
const findAllowedOption = findAllowedValueOption;
|
|
286
|
-
|
|
287
|
-
/** True when the field's selectable options carry images (logos). Such a choice
|
|
288
|
-
* renders too tall/rich for an inline row, so compact opens it in the card. */
|
|
289
|
-
export const optionHasImages = (schema?: TQorusFormFieldSchema): boolean => {
|
|
290
|
-
const s = schema as { allowed_values?: any[]; items?: any[] } | undefined;
|
|
291
|
-
const options = s?.allowed_values?.length ? s.allowed_values : s?.items;
|
|
292
|
-
return !!options?.some((option) => !!option?.image);
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
/** The selected option's image (logo), when it carries one — for the value cell. */
|
|
296
|
-
export const getAllowedValueImage = (
|
|
297
|
-
value: unknown,
|
|
298
|
-
schema?: TQorusFormFieldSchema
|
|
299
|
-
): string | undefined => {
|
|
300
|
-
const match = findAllowedOption(value, schema);
|
|
301
|
-
return (match?.image as string) || undefined;
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* The selected option's ICON, when it carries one and no logo — for the value
|
|
306
|
-
* cell.
|
|
307
|
-
*
|
|
308
|
-
* The same idea as {@link getAllowedValueImage} and read for the same reason:
|
|
309
|
-
* an option's mark belongs beside the value it names. Only images were rendered,
|
|
310
|
-
* so a picker whose entries are distinguished by ICON — an interface-kind list
|
|
311
|
-
* where every entry is a bare word, `Service`, `Job`, `Qog` — showed each mark
|
|
312
|
-
* while choosing and then dropped it the moment the row went read-only, which is
|
|
313
|
-
* the surface a reader spends the most time on.
|
|
314
|
-
*
|
|
315
|
-
* The image wins where an option has both: a logo is the more specific mark, and
|
|
316
|
-
* an icon standing behind it is a fallback rather than a second thing to draw.
|
|
317
|
-
*/
|
|
318
|
-
export const getAllowedValueIcon = (
|
|
319
|
-
value: unknown,
|
|
320
|
-
schema?: TQorusFormFieldSchema
|
|
321
|
-
): string | undefined => {
|
|
322
|
-
const match = findAllowedOption(value, schema);
|
|
323
|
-
if (!match || match.image) {
|
|
324
|
-
return undefined;
|
|
325
|
-
}
|
|
326
|
-
return (match.icon as string) || undefined;
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
/** Clamp an RGB channel to a 0–255 integer. */
|
|
330
|
-
const clampChannel = (n: number): number => Math.max(0, Math.min(255, Math.round(n)));
|
|
331
|
-
const toHexPart = (n: number): string => clampChannel(n).toString(16).padStart(2, '0');
|
|
332
|
-
|
|
333
|
-
/** The shape the rgbcolor field stores (react-color's RGBA result). */
|
|
334
|
-
type TColorValue = { r?: number; g?: number; b?: number; a?: number; hex?: string };
|
|
335
|
-
|
|
336
|
-
/** Normalised colour parts parsed from any shape the rgbcolor field can store. */
|
|
337
|
-
interface IParsedColor {
|
|
338
|
-
hex?: string;
|
|
339
|
-
r?: number;
|
|
340
|
-
g?: number;
|
|
341
|
-
b?: number;
|
|
342
|
-
a: number;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/** Whether parsed colour parts carry usable RGB channels. */
|
|
346
|
-
const hasRgb = (c: IParsedColor): c is IParsedColor & { r: number; g: number; b: number } =>
|
|
347
|
-
c.r !== undefined && c.g !== undefined && c.b !== undefined;
|
|
348
|
-
|
|
349
|
-
/** Parse an `rgbcolor` into normalised parts: accepts `{ r, g, b, a }` (may
|
|
350
|
-
* carry `hex`), `{ hex }`, or a raw hex string; undefined when unrecognisable. */
|
|
351
|
-
const parseColor = (value: unknown): IParsedColor | undefined => {
|
|
352
|
-
if (typeof value === 'string') {
|
|
353
|
-
const trimmed = value.trim();
|
|
354
|
-
return trimmed.startsWith('#') ? { hex: trimmed, a: 1 } : undefined;
|
|
355
|
-
}
|
|
356
|
-
if (value && typeof value === 'object') {
|
|
357
|
-
const c = value as TColorValue;
|
|
358
|
-
const a = typeof c.a === 'number' ? c.a : 1;
|
|
359
|
-
const hex = typeof c.hex === 'string' && c.hex.trim() ? c.hex.trim() : undefined;
|
|
360
|
-
if (typeof c.r === 'number' && typeof c.g === 'number' && typeof c.b === 'number') {
|
|
361
|
-
return { r: c.r, g: c.g, b: c.b, a, hex };
|
|
362
|
-
}
|
|
363
|
-
if (hex) {
|
|
364
|
-
return { hex, a };
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
return undefined;
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
/** Uppercase hex (`#0000FF`), or `rgba(…)` when non-opaque; undefined when
|
|
371
|
-
* unrecognisable (the caller falls back to the generic marker). */
|
|
372
|
-
export const formatColorValue = (value: unknown): string | undefined => {
|
|
373
|
-
const c = parseColor(value);
|
|
374
|
-
if (!c) {
|
|
375
|
-
return undefined;
|
|
376
|
-
}
|
|
377
|
-
// Prefer rgba(…) for non-opaque colours; the hex shortcut would drop alpha.
|
|
378
|
-
if (c.a < 1 && hasRgb(c)) {
|
|
379
|
-
const alpha = Math.round(c.a * 100) / 100;
|
|
380
|
-
return `rgba(${clampChannel(c.r)}, ${clampChannel(c.g)}, ${clampChannel(c.b)}, ${alpha})`;
|
|
381
|
-
}
|
|
382
|
-
if (c.hex) {
|
|
383
|
-
return c.hex.toUpperCase();
|
|
384
|
-
}
|
|
385
|
-
return hasRgb(c) ?
|
|
386
|
-
`#${toHexPart(c.r)}${toHexPart(c.g)}${toHexPart(c.b)}`.toUpperCase()
|
|
387
|
-
: undefined;
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
/** CSS colour for the swatch preview (keeps alpha); undefined when
|
|
391
|
-
* unrecognisable. */
|
|
392
|
-
export const colorToCss = (value: unknown): string | undefined => {
|
|
393
|
-
const c = parseColor(value);
|
|
394
|
-
if (!c) {
|
|
395
|
-
return undefined;
|
|
396
|
-
}
|
|
397
|
-
return hasRgb(c) ?
|
|
398
|
-
`rgba(${clampChannel(c.r)}, ${clampChannel(c.g)}, ${clampChannel(c.b)}, ${c.a})`
|
|
399
|
-
: c.hex;
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
/** Filename for a `file` value: accepts `{ name, content, size }`, the
|
|
403
|
-
* build-tab `{ name: { value } }` shape, or a raw path; undefined when no
|
|
404
|
-
* filename resolves. */
|
|
405
|
-
export const formatFileValue = (value: unknown): string | undefined => {
|
|
406
|
-
if (typeof value === 'string') {
|
|
407
|
-
const name = value.trim().split(/[\\/]/).pop();
|
|
408
|
-
return name || undefined;
|
|
409
|
-
}
|
|
410
|
-
if (value && typeof value === 'object') {
|
|
411
|
-
const name = (value as { name?: unknown }).name;
|
|
412
|
-
if (typeof name === 'string' && name.trim()) {
|
|
413
|
-
return name.trim();
|
|
414
|
-
}
|
|
415
|
-
const nested = (name as { value?: unknown } | undefined)?.value;
|
|
416
|
-
if (typeof nested === 'string' && nested.trim()) {
|
|
417
|
-
return nested.trim();
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
return undefined;
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
/** The byte size of a `file` value, when present (for the muted size suffix). */
|
|
424
|
-
export const getFileSize = (value: unknown): number | undefined => {
|
|
425
|
-
const size = (value as { size?: unknown } | undefined)?.size;
|
|
426
|
-
return typeof size === 'number' && Number.isFinite(size) && size >= 0 ? size : undefined;
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Effective UI type for DISPLAY — which preview/summary a value renders as.
|
|
431
|
-
*
|
|
432
|
-
* A renderer-only `ui_type` wins outright: the field's stored `type` holds the
|
|
433
|
-
* STORAGE type for those (a `code-editor` stores a string), so consulting the
|
|
434
|
-
* stored type here would render the bespoke editor's value as a plain string and
|
|
435
|
-
* silently drop its preview. Every other case keeps the stored type first, so an
|
|
436
|
-
* `any`/`auto` field still displays as whatever concrete type the user picked.
|
|
437
|
-
*/
|
|
438
|
-
export const getValueType = (
|
|
439
|
-
option?: IQorusFormField,
|
|
440
|
-
schema?: TQorusFormFieldSchema
|
|
441
|
-
): string | undefined => {
|
|
442
|
-
const uiType = (schema as { ui_type?: string } | undefined)?.ui_type;
|
|
443
|
-
|
|
444
|
-
if (isRendererOnlyUiType(uiType as TQorusType)) {
|
|
445
|
-
return uiType;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
return (option?.type || uiType || (schema as { type?: string } | undefined)?.type) as
|
|
449
|
-
string | undefined;
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
/** Human-readable byte count (e.g. `1.2 KB`). */
|
|
453
|
-
export const formatBytes = (bytes: number): string => {
|
|
454
|
-
if (bytes < 1024) {
|
|
455
|
-
return `${bytes} B`;
|
|
456
|
-
}
|
|
457
|
-
const units = ['KB', 'MB', 'GB', 'TB'];
|
|
458
|
-
let size = bytes / 1024;
|
|
459
|
-
let unit = 0;
|
|
460
|
-
while (size >= 1024 && unit < units.length - 1) {
|
|
461
|
-
size /= 1024;
|
|
462
|
-
unit += 1;
|
|
463
|
-
}
|
|
464
|
-
return `${size >= 10 || Number.isInteger(size) ? Math.round(size) : size.toFixed(1)} ${units[unit]}`;
|
|
465
|
-
};
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Short read-first summary of a value; '' when unset (the caller renders the
|
|
469
|
-
* placeholder). Bools → Yes/No, allowed_values → display label, colour →
|
|
470
|
-
* hex/rgba, file → filename, richtext → plain text, timeout → scaled duration
|
|
471
|
-
* ("45 seconds"), list → joined names, hash → "N fields" (generic "Set"
|
|
472
|
-
* fallback).
|
|
473
|
-
*/
|
|
474
|
-
/** Read-first summary of a `schema-definition` value: the schema name plus a
|
|
475
|
-
* table count (e.g. `orders · 2 tables`). */
|
|
476
|
-
const formatSchemaDefinition = (value: unknown): string => {
|
|
477
|
-
if (!value || typeof value !== 'object') return 'Schema';
|
|
478
|
-
const def = value as { schema?: { name?: string }; tables?: object };
|
|
479
|
-
const name = def.schema?.name;
|
|
480
|
-
const count = def.tables ? Object.keys(def.tables).length : 0;
|
|
481
|
-
const tables = count ? ` · ${count} table${count === 1 ? '' : 's'}` : '';
|
|
482
|
-
return name ? `${name}${tables}` : 'Schema';
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
/**
|
|
487
|
-
* How much prose a one-line summary may carry.
|
|
488
|
-
*
|
|
489
|
-
* The row's value cell is a single CSS-clipped line (`text-overflow: ellipsis`),
|
|
490
|
-
* so the CELL needs no cap — the browser does that. The `title` hover does: it
|
|
491
|
-
* is handed this same string whole, and a description is a document. Without a
|
|
492
|
-
* bound, hovering a 4,000-word description produces a 4,000-word native
|
|
493
|
-
* tooltip, which no browser renders usefully and no reader can scroll.
|
|
494
|
-
*
|
|
495
|
-
* 240 comfortably overfills the widest realistic cell (~80-120 characters), so
|
|
496
|
-
* nothing visible is lost, and leaves the hover as what it is useful as — the
|
|
497
|
-
* next sentence or two. The whole document is never far away: it renders in the
|
|
498
|
-
* row's inset below.
|
|
499
|
-
*/
|
|
500
|
-
export const SUMMARY_MAX_LENGTH = 240;
|
|
501
|
-
|
|
502
|
-
/** Clip to {@link SUMMARY_MAX_LENGTH}, on a word boundary where there is one
|
|
503
|
-
* close enough to the end, so a hover never stops mid-identifier. */
|
|
504
|
-
const capSummary = (text: string): string => {
|
|
505
|
-
if (text.length <= SUMMARY_MAX_LENGTH) {
|
|
506
|
-
return text;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
const cut = text.slice(0, SUMMARY_MAX_LENGTH);
|
|
510
|
-
const lastSpace = cut.lastIndexOf(' ');
|
|
511
|
-
const body = lastSpace > SUMMARY_MAX_LENGTH * 0.6 ? cut.slice(0, lastSpace) : cut;
|
|
512
|
-
|
|
513
|
-
return `${body.trimEnd()}…`;
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
* Summarise a markdown value as the prose it renders to.
|
|
518
|
-
*
|
|
519
|
-
* A read-first row has one line to work with, and for markdown that line was
|
|
520
|
-
* the SOURCE: a description opening with a heading read as `## Partner portal`,
|
|
521
|
-
* which is punctuation where the reader wanted the sentence. The markers are
|
|
522
|
-
* stripped rather than the value truncated, because what the row is standing in
|
|
523
|
-
* for is the rendered document, not the file behind it.
|
|
524
|
-
*
|
|
525
|
-
* Deliberately not a markdown parser: this feeds a one-line summary and the
|
|
526
|
-
* row's hover title, and the real document renders in the inset below the row.
|
|
527
|
-
*
|
|
528
|
-
* The inline rules below are CommonMark-shaped on purpose, because the naive
|
|
529
|
-
* versions corrupt exactly the text these descriptions are full of. `(\*|_)(.*?)\1`
|
|
530
|
-
* turns "2 * 3 * 4 items" into "2 3 4 items" and `retry_count_max` into
|
|
531
|
-
* `retrycountmax`: emphasis delimiters have to hug the text they wrap, and an
|
|
532
|
-
* underscore must not be intraword, or an option key loses its underscores.
|
|
533
|
-
*/
|
|
534
|
-
export const summariseMarkdown = (value: unknown): string => {
|
|
535
|
-
if (typeof value !== 'string') {
|
|
536
|
-
return '';
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
const prose = value
|
|
540
|
-
// a fenced block is never the summary of the thing it sits in
|
|
541
|
-
.replace(/```[\s\S]*?```/g, ' ')
|
|
542
|
-
// images before links — an image's `!` prefix would otherwise survive
|
|
543
|
-
.replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
544
|
-
.replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
545
|
-
// autolinks: <https://example.com> → https://example.com
|
|
546
|
-
.replace(/<((?:https?|mailto):[^>\s]+)>/g, '$1')
|
|
547
|
-
// leading block markers: heading hashes, blockquote carets, list bullets
|
|
548
|
-
.replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+|\d+[.)]\s+)/gm, '')
|
|
549
|
-
// setext underlines and thematic breaks carry no prose
|
|
550
|
-
.replace(/^\s{0,3}(?:={2,}|-{2,}|\*{3,}|_{3,})\s*$/gm, '')
|
|
551
|
-
// Emphasis / strong / strikethrough markers around their own text. The
|
|
552
|
-
// delimiters must hug the text they wrap, as CommonMark requires, and
|
|
553
|
-
// underscores additionally must not be intraword.
|
|
554
|
-
.replace(/(\*\*\*)(?=\S)([\s\S]+?)(?<=\S)\1/g, '$2')
|
|
555
|
-
.replace(/(?<![A-Za-z0-9])(___)(?=\S)([\s\S]+?)(?<=\S)\1(?![A-Za-z0-9])/g, '$2')
|
|
556
|
-
.replace(/(\*\*)(?=\S)([\s\S]+?)(?<=\S)\1/g, '$2')
|
|
557
|
-
.replace(/(?<![A-Za-z0-9])(__)(?=\S)([\s\S]+?)(?<=\S)\1(?![A-Za-z0-9])/g, '$2')
|
|
558
|
-
.replace(/(\*)(?=\S)([\s\S]+?)(?<=\S)\1/g, '$2')
|
|
559
|
-
.replace(/(?<![A-Za-z0-9])(_)(?=\S)([\s\S]+?)(?<=\S)\1(?![A-Za-z0-9])/g, '$2')
|
|
560
|
-
.replace(/~~(?=\S)([\s\S]+?)(?<=\S)~~/g, '$1')
|
|
561
|
-
// inline code spans
|
|
562
|
-
.replace(/`+([^`]+)`+/g, '$1')
|
|
563
|
-
.replace(/\s+/g, ' ')
|
|
564
|
-
.trim();
|
|
565
|
-
|
|
566
|
-
return capSummary(prose);
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* The expression AST a field holds, whichever shape it arrived in.
|
|
571
|
-
*
|
|
572
|
-
* An expression arrives in TWO shapes, and only the flat one used to be
|
|
573
|
-
* checked. At runtime the editor writes the flag onto the option
|
|
574
|
-
* (`{ is_expression: true, value: ast }`); a value read back from a saved draft
|
|
575
|
-
* carries the envelope NESTED (`{ value: { is_expression: true, value: ast } }`)
|
|
576
|
-
* with no flag on the option at all. Missing the nested shape sent a reloaded
|
|
577
|
-
* expression to the generic formatter, which printed the AST — the row showed
|
|
578
|
-
* `is_expression true / value / exp + / args 1 2` where the expression should
|
|
579
|
-
* be.
|
|
580
|
-
*
|
|
581
|
-
* Exported because the SUMMARY is not the only place that has to know. The AST
|
|
582
|
-
* is how an expression is stored, not what it is, so nothing may draw it as
|
|
583
|
-
* data: `CompactRow` asks this before deciding a hash-shaped value has earned a
|
|
584
|
-
* structured inset. Answering it in one place is what keeps the row's two
|
|
585
|
-
* halves — the line and the inset under it — talking about the same value.
|
|
586
|
-
*/
|
|
587
|
-
export const getExpressionAst = (option?: {
|
|
588
|
-
is_expression?: boolean;
|
|
589
|
-
value?: unknown;
|
|
590
|
-
}): IExpressionValue | undefined =>
|
|
591
|
-
option?.is_expression ? (option?.value as IExpressionValue | undefined)
|
|
592
|
-
: (
|
|
593
|
-
(option?.value as { is_expression?: boolean; value?: IExpressionValue } | undefined)
|
|
594
|
-
?.is_expression
|
|
595
|
-
) ?
|
|
596
|
-
(option?.value as { value?: IExpressionValue }).value
|
|
597
|
-
: undefined;
|
|
598
|
-
|
|
599
|
-
export const formatOptionValue = (
|
|
600
|
-
option?: IQorusFormField,
|
|
601
|
-
schema?: TQorusFormFieldSchema
|
|
602
|
-
): string => {
|
|
603
|
-
const value = option?.value;
|
|
604
|
-
|
|
605
|
-
if (isOptionValueEmpty(value) || isUnsetSchemaHash(value, schema)) {
|
|
606
|
-
return '';
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
// A sensitive option (passwords, tokens) must never print its value in the
|
|
610
|
-
// read-first row — the formatted string also feeds the row's hover title.
|
|
611
|
-
if ((schema as { sensitive?: boolean } | undefined)?.sensitive) {
|
|
612
|
-
return '••••••';
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
const expressionAst = getExpressionAst(option);
|
|
616
|
-
|
|
617
|
-
if (expressionAst !== undefined) {
|
|
618
|
-
// Offline summary of the {exp,args} AST already in the form value — the
|
|
619
|
-
// same client-side renderer the editor's "Explain" seam falls back to when
|
|
620
|
-
// the LSP is unreachable. The drill-in editor shows the canonical DPQL.
|
|
621
|
-
return renderExpressionToText(expressionAst) || 'Expression';
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
// schema-definition is stored as a hash envelope; summarise it as the schema
|
|
625
|
-
// name + table count rather than a meaningless top-level key count.
|
|
626
|
-
if ((schema as { ui_type?: string } | undefined)?.ui_type === 'schema-definition') {
|
|
627
|
-
return formatSchemaDefinition(value);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
// Same reasoning, different notation: show what the markdown says, not how it
|
|
631
|
-
// is written.
|
|
632
|
-
if ((schema as { ui_type?: string } | undefined)?.ui_type === 'markdown') {
|
|
633
|
-
// `|| 'Set'` is not defensive padding. A description that is ONLY a fenced
|
|
634
|
-
// code block summarises to the empty string — the block is dropped, and
|
|
635
|
-
// there is no prose behind it — and CompactRow reads `formatted === ''` as
|
|
636
|
-
// "no value" and renders a faint em-dash. A field holding a whole code
|
|
637
|
-
// block would show as empty. `'Set'` is this file's established answer for
|
|
638
|
-
// "there is a value here that does not reduce to a line" (colours, files,
|
|
639
|
-
// richtext all use it), and the block itself still renders in the inset.
|
|
640
|
-
return summariseMarkdown(value) || 'Set';
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
const type = getValueType(option, schema);
|
|
644
|
-
|
|
645
|
-
if (type === 'bool' || type === 'boolean') {
|
|
646
|
-
return value ? 'Yes' : 'No';
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
const allowedLabel = getAllowedValueLabel(value, schema);
|
|
650
|
-
if (allowedLabel) {
|
|
651
|
-
return allowedLabel;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
if (type === 'rgbcolor') {
|
|
655
|
-
return formatColorValue(value) ?? 'Set';
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
// Raw milliseconds read poorly at a glance — scale to the largest exact
|
|
659
|
-
// unit, matching what the expanded TimeoutFormField shows.
|
|
660
|
-
if (type === 'timeout' && typeof value === 'number') {
|
|
661
|
-
return formatTimeoutValue(value);
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
if (type === 'file') {
|
|
665
|
-
return formatFileValue(value) ?? 'Set';
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
if (type === 'richtext') {
|
|
669
|
-
const text = richtextToString(value as any);
|
|
670
|
-
return text && text.trim() ? text : 'Set';
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
// A markdown value reads as prose, not as source: the row's one line — and
|
|
674
|
-
// the hover title built from it — would otherwise open with `# ` or spend its
|
|
675
|
-
// width on `[label](https://…)`. The rendered document itself is drawn in the
|
|
676
|
-
// row's inset below.
|
|
677
|
-
if (type === 'markdown' && typeof value === 'string') {
|
|
678
|
-
const text = summariseMarkdown(value);
|
|
679
|
-
return text || 'Set';
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
if (Array.isArray(value)) {
|
|
683
|
-
return formatList(value, schema);
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
// A serialized list/hash (the object editor stores them as a YAML string):
|
|
687
|
-
// parse it back and summarise rather than showing the raw `%YAML 1.2 --- …`.
|
|
688
|
-
if (typeof value === 'string') {
|
|
689
|
-
const parsed = parseSerialized(value, type);
|
|
690
|
-
if (Array.isArray(parsed)) {
|
|
691
|
-
return formatList(parsed, schema);
|
|
692
|
-
}
|
|
693
|
-
if (parsed && typeof parsed === 'object') {
|
|
694
|
-
return fieldCountLabel(parsed as object);
|
|
695
|
-
}
|
|
696
|
-
if (parsed !== undefined && parsed !== null && typeof parsed !== 'object') {
|
|
697
|
-
return String(parsed);
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
// A provider is an object, but the count of its keys is not what the reader
|
|
702
|
-
// asked: name it. (The structured preview under the row shows the keys.)
|
|
703
|
-
if (type === 'data-provider') {
|
|
704
|
-
const provider = formatDataProviderValue(value);
|
|
705
|
-
if (provider) {
|
|
706
|
-
return provider;
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
if (typeof value === 'object') {
|
|
711
|
-
return fieldCountLabel(value as object);
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
return String(value);
|
|
715
|
-
};
|
|
716
|
-
|
|
717
|
-
/** One sub-field of a hash value, summarised for a read-first sub-row. */
|
|
718
|
-
export interface IReadFirstHashEntry {
|
|
719
|
-
/** The raw key in the hash. */
|
|
720
|
-
name: string;
|
|
721
|
-
/** Display label — the sub-field's `display_name` (from `arg_schema`) or the key. */
|
|
722
|
-
label: string;
|
|
723
|
-
/** The sub-field's value formatted via `formatOptionValue` ('' when unset). */
|
|
724
|
-
value: string;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
/**
|
|
728
|
-
* Expand a hash into sub-fields for the "view more" sub-rows. Handles the three
|
|
729
|
-
* hash shapes: arg_schema descriptors, serialized-YAML string, plain object.
|
|
730
|
-
* [] when not expandable; entry values format via `formatOptionValue`.
|
|
731
|
-
*/
|
|
732
|
-
export const getHashEntries = (
|
|
733
|
-
option?: IQorusFormField,
|
|
734
|
-
schema?: TQorusFormFieldSchema
|
|
735
|
-
): IReadFirstHashEntry[] => {
|
|
736
|
-
const value = option?.value;
|
|
737
|
-
if (isOptionValueEmpty(value)) {
|
|
738
|
-
return [];
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
let hashObject: Record<string, unknown> | undefined;
|
|
742
|
-
if (typeof value === 'string') {
|
|
743
|
-
const parsed = parseSerialized(value, 'hash');
|
|
744
|
-
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
745
|
-
hashObject = parsed as Record<string, unknown>;
|
|
746
|
-
}
|
|
747
|
-
} else if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
748
|
-
hashObject = value as Record<string, unknown>;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
if (!hashObject) {
|
|
752
|
-
return [];
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
const argSchema = (schema as { arg_schema?: Record<string, TQorusFormFieldSchema> } | undefined)
|
|
756
|
-
?.arg_schema;
|
|
757
|
-
|
|
758
|
-
return Object.keys(hashObject)
|
|
759
|
-
.filter((key) => {
|
|
760
|
-
// Only sub-fields with a value belong in a read view. `preselected`
|
|
761
|
-
// materialises a field so the FORM shows it; that is not a statement
|
|
762
|
-
// that the object has one, and listing it here says the opposite of
|
|
763
|
-
// what the sub-form says.
|
|
764
|
-
const subSchema = argSchema?.[key];
|
|
765
|
-
return !(subSchema && isEmptyUiEnvelope(hashObject![key]));
|
|
766
|
-
})
|
|
767
|
-
.map((key) => {
|
|
768
|
-
const raw = hashObject![key];
|
|
769
|
-
const subSchema = argSchema?.[key];
|
|
770
|
-
// A schema-declared (`arg_schema`) hash stores each entry as a
|
|
771
|
-
// `{ type, value }` field descriptor — gate on the sub-schema's presence.
|
|
772
|
-
// A schema-less hash *usually* stores raw values, but the server's typed
|
|
773
|
-
// serialization can nest envelopes there too (e.g. a hash default_value
|
|
774
|
-
// whose entries are `{ type: 'string', value: 'x' }`) — recognise those by
|
|
775
|
-
// their strict shape (a string `type`, a `value`, and no foreign keys) so
|
|
776
|
-
// the sub-row shows 'x' rather than counting the envelope's own keys.
|
|
777
|
-
// `'value' in raw` is FALSE for a materialised-but-unset field: `fixOptions`
|
|
778
|
-
// omits the key entirely when the value is undefined, leaving `{type: 'x'}`.
|
|
779
|
-
// Requiring `value` therefore classed that envelope as a raw hash VALUE and
|
|
780
|
-
// counted its own `type` key, so an untouched Runtime Defaults collapsed to
|
|
781
|
-
// "Timeout (Seconds) 1 field" three times over while the sub-form correctly
|
|
782
|
-
// said 0/3 set. With a sub-schema present, a `type`-only object is an empty
|
|
783
|
-
// envelope, never content.
|
|
784
|
-
// Shared with SchemaDataView, which previews this same value one level
|
|
785
|
-
// down: two renderers disagreeing about what an unset field looks like is
|
|
786
|
-
// how the row said "1 field" long after this one stopped.
|
|
787
|
-
const isEmptyEnvelope = !!subSchema && isEmptyUiEnvelope(raw);
|
|
788
|
-
const isFieldShape =
|
|
789
|
-
(!!subSchema &&
|
|
790
|
-
!!raw &&
|
|
791
|
-
typeof raw === 'object' &&
|
|
792
|
-
!Array.isArray(raw) &&
|
|
793
|
-
'value' in (raw as object)) ||
|
|
794
|
-
isEmptyEnvelope ||
|
|
795
|
-
isTypedEnvelope(raw);
|
|
796
|
-
const subOption: IQorusFormField =
|
|
797
|
-
isFieldShape ?
|
|
798
|
-
(raw as IQorusFormField)
|
|
799
|
-
: ({ type: subSchema?.type as IQorusFormField['type'], value: raw } as IQorusFormField);
|
|
800
|
-
|
|
801
|
-
return {
|
|
802
|
-
name: key,
|
|
803
|
-
label: subSchema?.display_name || key,
|
|
804
|
-
value: formatOptionValue(subOption, subSchema),
|
|
805
|
-
};
|
|
806
|
-
});
|
|
807
|
-
};
|
|
808
|
-
|
|
809
|
-
const titleCase = (value: string): string =>
|
|
810
|
-
value
|
|
811
|
-
.replace(/[_-]+/g, ' ')
|
|
812
|
-
.trim()
|
|
813
|
-
.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* Raw group key for an option: the server's `group`, else "general" for
|
|
817
|
-
* required/preselected (never buried — `group` is still rolling out
|
|
818
|
-
* server-side, qorus #259) and "optional" for the rest.
|
|
819
|
-
*/
|
|
820
|
-
export const getOptionGroup = (schema?: TQorusFormFieldSchema): string => {
|
|
821
|
-
const group = (schema as { group?: string } | undefined)?.group;
|
|
822
|
-
|
|
823
|
-
if (typeof group === 'string' && group.trim()) {
|
|
824
|
-
return group.trim();
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
return (
|
|
828
|
-
schema?.required ||
|
|
829
|
-
(schema as { required_groups?: string[] } | undefined)?.required_groups ||
|
|
830
|
-
(schema as { preselected?: boolean } | undefined)?.preselected
|
|
831
|
-
) ?
|
|
832
|
-
'general'
|
|
833
|
-
: 'optional';
|
|
834
|
-
};
|
|
835
|
-
|
|
836
|
-
/** Display label for a group key: the consumer-supplied label (FormEngine
|
|
837
|
-
* `groups` prop) or the title-cased key. */
|
|
838
|
-
export const getOptionGroupLabel = (
|
|
839
|
-
key: string,
|
|
840
|
-
groups?: Record<string, { label?: string } | undefined>
|
|
841
|
-
): string => groups?.[key]?.label ?? titleCase(key);
|
|
842
|
-
|
|
843
|
-
/** Completion summary for the read-first progress meter. */
|
|
844
|
-
export interface IReadFirstCompletion {
|
|
845
|
-
total: number;
|
|
846
|
-
/** Fields holding a value, whether or not anything is wrong with it. */
|
|
847
|
-
set: number;
|
|
848
|
-
/** Fields holding a value that nothing is flagging — what the meter fills. */
|
|
849
|
-
done: number;
|
|
850
|
-
pct: number;
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
/** Read-first row status, shared by the status DOT (CompactRow) and the
|
|
854
|
-
* status BOX bucketing (FormEngine) so the two can never disagree:
|
|
855
|
-
* invalid — a value fails validation, or a danger message is present (red)
|
|
856
|
-
* todo — empty & required (or has a warning message), needs a value (amber)
|
|
857
|
-
* pending — empty & required, but the person has not been to it yet: still to
|
|
858
|
-
* fill in, not yet a fault (neutral). A new form is not already wrong;
|
|
859
|
-
* the field becomes `todo` once they open it and leave it empty, or the
|
|
860
|
-
* host reports a submit attempt (`revealRequired`)
|
|
861
|
-
* set — has a valid value (green)
|
|
862
|
-
* optional — empty & not required, or covered by a one-of sibling (calm) */
|
|
863
|
-
export type TReadFirstStatus = 'invalid' | 'todo' | 'pending' | 'set' | 'optional';
|
|
864
|
-
|
|
865
|
-
export const getReadFirstStatus = (s: {
|
|
866
|
-
empty: boolean;
|
|
867
|
-
required: boolean;
|
|
868
|
-
/** Empty member of a one-of required group already satisfied by a sibling. */
|
|
869
|
-
covered: boolean;
|
|
870
|
-
/** Non-empty value fails validation, or a danger message is attached. */
|
|
871
|
-
invalid: boolean;
|
|
872
|
-
/** A warning message is attached (surfaces an empty field for attention). */
|
|
873
|
-
warned: boolean;
|
|
874
|
-
/**
|
|
875
|
-
* Whether the person has been to this field (opened it and left it), or the host
|
|
876
|
-
* reported a submit attempt. Until then an empty required field is `pending`, not
|
|
877
|
-
* `todo`. Unset means visited, the behaviour before this existed.
|
|
878
|
-
*/
|
|
879
|
-
visited?: boolean;
|
|
880
|
-
}): TReadFirstStatus => {
|
|
881
|
-
if (s.invalid) return 'invalid';
|
|
882
|
-
if (!s.empty) return 'set';
|
|
883
|
-
// A one-of member covered by a satisfied sibling reads as "set" (green) — the
|
|
884
|
-
// requirement is met; the row just shows a "Covered by …" note.
|
|
885
|
-
if (s.covered) return 'set';
|
|
886
|
-
if (s.warned) return 'todo';
|
|
887
|
-
if (s.required) return s.visited === false ? 'pending' : 'todo';
|
|
888
|
-
return 'optional';
|
|
889
|
-
};
|
|
890
|
-
|
|
891
|
-
/** Coarse bucket for the three status boxes (Needs attention / Set / Optional). A
|
|
892
|
-
* `pending` field is in the first box too: it still has to be filled in. The box only
|
|
893
|
-
* reads "To fill in" instead of "Needs attention" while nothing in it is a fault. */
|
|
894
|
-
export const getReadFirstBucket = (status: TReadFirstStatus): 'attention' | 'set' | 'optional' =>
|
|
895
|
-
status === 'set' ? 'set'
|
|
896
|
-
: status === 'optional' ? 'optional'
|
|
897
|
-
: 'attention';
|
|
898
|
-
|
|
899
|
-
/** Count how many of the shown options have a value set, for the progress meter. */
|
|
900
|
-
export const getReadFirstCompletion = (
|
|
901
|
-
shownOptions: Record<string, IQorusFormField | undefined> = {},
|
|
902
|
-
/**
|
|
903
|
-
* Whether the form flags this field as needing attention. Optional: without
|
|
904
|
-
* it the meter falls back to counting values alone, which is what a caller
|
|
905
|
-
* with no bucketing of its own can honestly say.
|
|
906
|
-
*/
|
|
907
|
-
needsAttention?: (name: string) => boolean
|
|
908
|
-
): IReadFirstCompletion => {
|
|
909
|
-
const names = Object.keys(shownOptions);
|
|
910
|
-
const total = names.length;
|
|
911
|
-
const hasValue = (name: string) => !isOptionValueEmpty(shownOptions[name]?.value);
|
|
912
|
-
const set = names.filter(hasValue).length;
|
|
913
|
-
/* "Set" and "needs attention" are not opposites. A field can hold a value and
|
|
914
|
-
still be wrong — one that fails validation, or one the host has flagged
|
|
915
|
-
because something INSIDE it is unfinished — and counting those as progress
|
|
916
|
-
is how a form comes to report 100% while the box beneath it says a field
|
|
917
|
-
needs attention.
|
|
918
|
-
|
|
919
|
-
It also cost the meter its amber run: the bar draws attention from `set%`
|
|
920
|
-
onward, so a field counted in both pushed that run past the right edge,
|
|
921
|
-
where `overflow: hidden` swallowed it. The one visual signal that something
|
|
922
|
-
was outstanding was the one thing the double-count hid. */
|
|
923
|
-
const done =
|
|
924
|
-
needsAttention ? names.filter((name) => hasValue(name) && !needsAttention(name)).length : set;
|
|
925
|
-
const pct = total ? Math.round((done / total) * 100) : 0;
|
|
926
|
-
|
|
927
|
-
return { total, set, done, pct };
|
|
928
|
-
};
|
|
929
|
-
|
|
930
|
-
/** What the "first field to fix" selector needs to know about one field.
|
|
931
|
-
* Kept deliberately minimal — both verdicts are supplied by the caller — so the
|
|
932
|
-
* selector is decoupled from the engine's value/schema shapes and unit-testable
|
|
933
|
-
* in isolation. */
|
|
934
|
-
export interface IFirstAttentionFieldMeta {
|
|
935
|
-
/** Whether the field can actually receive focus — the caller folds in
|
|
936
|
-
* disabled / readonly / read-only-form / unmet-dependency gating here. */
|
|
937
|
-
focusable: boolean;
|
|
938
|
-
/** Whether the form considers this field to "need attention". The caller
|
|
939
|
-
* supplies this from the SAME `getOptionBucket` the read-first status boxes
|
|
940
|
-
* use, so it covers every attention case — empty-required, an unsatisfied
|
|
941
|
-
* one-of group, AND a filled-but-invalid value — and the autofocus target can
|
|
942
|
-
* never drift from the visible needs-attention set. */
|
|
943
|
-
needsAttention: boolean;
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
/**
|
|
947
|
-
* Pick the first field the user must fix: the first focusable field — in the
|
|
948
|
-
* supplied (already ordered) name list — that the form buckets as "needs
|
|
949
|
-
* attention".
|
|
950
|
-
*
|
|
951
|
-
* Pure and side-effect free. It deliberately does NOT re-derive emptiness /
|
|
952
|
-
* required / validity itself; the caller passes `needsAttention` straight from
|
|
953
|
-
* the engine's own `getOptionBucket`, so there is a single source of truth and
|
|
954
|
-
* the "focus the first field to fix" affordance can never disagree with the
|
|
955
|
-
* per-row status the user sees (including filled-but-invalid rows). Returns
|
|
956
|
-
* `undefined` when nothing needs attention.
|
|
957
|
-
*/
|
|
958
|
-
export const getFirstAttentionOptionName = (
|
|
959
|
-
orderedNames: string[],
|
|
960
|
-
getFieldMeta: (name: string) => IFirstAttentionFieldMeta | undefined
|
|
961
|
-
): string | undefined => {
|
|
962
|
-
for (const name of orderedNames) {
|
|
963
|
-
const meta = getFieldMeta(name);
|
|
964
|
-
if (meta?.focusable && meta.needsAttention) {
|
|
965
|
-
return name;
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
return undefined;
|
|
970
|
-
};
|
|
971
|
-
|
|
972
|
-
/* ------------------------------------------------------------------------- */
|
|
973
|
-
/* Record identity — which field says WHICH item this is */
|
|
974
|
-
/* */
|
|
975
|
-
/* Lives here, beside the formatters it uses, rather than in the view that */
|
|
976
|
-
/* first needed it: it is data logic, not rendering, and BOTH list renderers */
|
|
977
|
-
/* plus their tests import it. Keeping it in `SchemaDataView` dragged React, */
|
|
978
|
-
/* styled-components and every Reqore component it renders into any module */
|
|
979
|
-
/* that only wanted to know an item's name — which broke `arrayAutoField`'s */
|
|
980
|
-
/* mocked-Reqore test the moment the editable list started using it. */
|
|
981
|
-
/* ------------------------------------------------------------------------- */
|
|
982
|
-
|
|
983
|
-
/** A UI-encoded value carries its type alongside it; the record's own value is inside. */
|
|
984
|
-
const unwrap = (value: unknown): unknown =>
|
|
985
|
-
isUiEncodedValue(value) ? (value as { value: unknown }).value : value;
|
|
986
|
-
|
|
987
|
-
/** Whether a value is worth a row of its own. `false` and `0` are values. */
|
|
988
|
-
export const isSet = (value: unknown): boolean =>
|
|
989
|
-
value !== undefined && value !== null && value !== '' && !(Array.isArray(value) && !value.length);
|
|
990
|
-
|
|
991
|
-
/**
|
|
992
|
-
* The keys to render, in the order to render them: the schema's own order first
|
|
993
|
-
* (that is the order the form puts the fields in), then anything stored that the
|
|
994
|
-
* schema does not mention, so undescribed data is shown rather than dropped.
|
|
995
|
-
*/
|
|
996
|
-
export const orderedKeys = (
|
|
997
|
-
record: Record<string, unknown>,
|
|
998
|
-
schema: IQorusFormSchema
|
|
999
|
-
): string[] => {
|
|
1000
|
-
const described = Object.keys(schema).filter((key) => isSet(unwrap(record[key])));
|
|
1001
|
-
const extra = Object.keys(record).filter((key) => !(key in schema) && isSet(unwrap(record[key])));
|
|
1002
|
-
return [...described, ...extra];
|
|
1003
|
-
};
|
|
1004
|
-
|
|
1005
|
-
/** A field whose content is source code. `ui_type` is what the form renders by,
|
|
1006
|
-
* so it is what the preview reads by too — the storage type is just `string`. */
|
|
1007
|
-
export const isCodeField = (fieldSchema: TQorusFormFieldSchema | undefined): boolean => {
|
|
1008
|
-
const uiType = (fieldSchema as { ui_type?: string } | undefined)?.ui_type;
|
|
1009
|
-
return uiType === 'code-editor';
|
|
1010
|
-
};
|
|
1011
|
-
|
|
1012
|
-
/**
|
|
1013
|
-
* The field whose value heads the item — the first DECLARED one holding a plain
|
|
1014
|
-
* scalar.
|
|
1015
|
-
*
|
|
1016
|
-
* Schema order, not value order: the first declared field is the one the form
|
|
1017
|
-
* puts at the top of an item, which is the one that says which item it is. A
|
|
1018
|
-
* code body or a nested level is skipped, not because it is unimportant but
|
|
1019
|
-
* because it has no one-line form — it belongs in the rows below where it can
|
|
1020
|
-
* actually be read.
|
|
1021
|
-
*
|
|
1022
|
-
* One definition, used both to RENDER the heading and to omit that field from
|
|
1023
|
-
* the rows. Computing it twice is how the heading and the rows start disagreeing
|
|
1024
|
-
* about which field was promoted, and the item shows its name twice or not at
|
|
1025
|
-
* all.
|
|
1026
|
-
*/
|
|
1027
|
-
export const titleKeyFor = (
|
|
1028
|
-
record: Record<string, unknown>,
|
|
1029
|
-
schema: IQorusFormSchema
|
|
1030
|
-
): string | undefined =>
|
|
1031
|
-
orderedKeys(record, schema).find((key) => {
|
|
1032
|
-
const fieldSchema = schema[key] as TQorusFormFieldSchema | undefined;
|
|
1033
|
-
if (isCodeField(fieldSchema)) {
|
|
1034
|
-
return false;
|
|
1035
|
-
}
|
|
1036
|
-
const raw = unwrap(record[key]);
|
|
1037
|
-
return typeof raw === 'string' || typeof raw === 'number';
|
|
1038
|
-
});
|
|
1039
|
-
|
|
1040
|
-
/** What identifies one record: which field was promoted, and how to draw it. */
|
|
1041
|
-
export interface IRecordIdentity {
|
|
1042
|
-
/** The promoted field's key, so a caller can omit it from the rows below. */
|
|
1043
|
-
key: string;
|
|
1044
|
-
/** The value, formatted the way its own row would format it. */
|
|
1045
|
-
text: string;
|
|
1046
|
-
/** The promoted field's label — a caption for the heading, not a second line. */
|
|
1047
|
-
label: string;
|
|
1048
|
-
/** A literal keeps its mono face; a chosen label is prose. */
|
|
1049
|
-
mono: boolean;
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
/**
|
|
1053
|
-
* The identity of one record, for any surface that heads a list item with it.
|
|
1054
|
-
*
|
|
1055
|
-
* Exported because the preview is not the only place a list of records is shown:
|
|
1056
|
-
* the editable list (`ArrayAuto`) heads the same records, and it must promote the
|
|
1057
|
-
* same field and format it the same way. Two implementations would drift the
|
|
1058
|
-
* moment one of them learned about a new field type, and the reader would meet
|
|
1059
|
-
* an item called `init` in the preview and `#1` in the editor.
|
|
1060
|
-
*/
|
|
1061
|
-
export const recordIdentity = (
|
|
1062
|
-
record: Record<string, unknown>,
|
|
1063
|
-
schema: IQorusFormSchema | undefined
|
|
1064
|
-
): IRecordIdentity | undefined => {
|
|
1065
|
-
if (!schema) {
|
|
1066
|
-
return undefined;
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
const key = titleKeyFor(record, schema);
|
|
1070
|
-
|
|
1071
|
-
if (!key) {
|
|
1072
|
-
return undefined;
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
const fieldSchema = schema[key] as TQorusFormFieldSchema | undefined;
|
|
1076
|
-
const raw = unwrap(record[key]);
|
|
1077
|
-
|
|
1078
|
-
return {
|
|
1079
|
-
key,
|
|
1080
|
-
text: formatOptionValue(
|
|
1081
|
-
{ type: fieldSchema?.type, value: raw } as IQorusFormField,
|
|
1082
|
-
fieldSchema
|
|
1083
|
-
),
|
|
1084
|
-
label: fieldLabel(key, fieldSchema),
|
|
1085
|
-
mono: !findAllowedValueOption(raw, fieldSchema),
|
|
1086
|
-
};
|
|
1087
|
-
};
|
|
1088
|
-
|
|
1089
|
-
export const fieldLabel = (key: string, fieldSchema: TQorusFormFieldSchema | undefined): string =>
|
|
1090
|
-
(fieldSchema as { display_name?: string } | undefined)?.display_name || key;
|