@flanksource/clicky-ui 0.3.19 → 0.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ErrorWrapper.cjs +1 -1
- package/dist/components/ErrorWrapper.cjs.map +1 -1
- package/dist/components/ErrorWrapper.js +1 -1
- package/dist/components/ErrorWrapper.js.map +1 -1
- package/dist/components/UnitStepControls.cjs +55 -0
- package/dist/components/UnitStepControls.cjs.map +1 -0
- package/dist/components/UnitStepControls.d.ts +10 -0
- package/dist/components/UnitStepControls.d.ts.map +1 -0
- package/dist/components/UnitStepControls.js +55 -0
- package/dist/components/UnitStepControls.js.map +1 -0
- package/dist/components/json-schema-form-accordion-array.cjs +5 -73
- package/dist/components/json-schema-form-accordion-array.cjs.map +1 -1
- package/dist/components/json-schema-form-accordion-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-accordion-array.js +3 -71
- package/dist/components/json-schema-form-accordion-array.js.map +1 -1
- package/dist/components/json-schema-form-array.cjs +6 -1
- package/dist/components/json-schema-form-array.cjs.map +1 -1
- package/dist/components/json-schema-form-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-array.js +6 -1
- package/dist/components/json-schema-form-array.js.map +1 -1
- package/dist/components/json-schema-form-cards-array.cjs +96 -0
- package/dist/components/json-schema-form-cards-array.cjs.map +1 -0
- package/dist/components/json-schema-form-cards-array.d.ts +7 -0
- package/dist/components/json-schema-form-cards-array.d.ts.map +1 -0
- package/dist/components/json-schema-form-cards-array.js +96 -0
- package/dist/components/json-schema-form-cards-array.js.map +1 -0
- package/dist/components/json-schema-form-item-row.cjs +81 -0
- package/dist/components/json-schema-form-item-row.cjs.map +1 -0
- package/dist/components/json-schema-form-item-row.d.ts +19 -0
- package/dist/components/json-schema-form-item-row.d.ts.map +1 -0
- package/dist/components/json-schema-form-item-row.js +81 -0
- package/dist/components/json-schema-form-item-row.js.map +1 -0
- package/dist/components/json-schema-form-render.cjs +2 -2
- package/dist/components/json-schema-form-render.cjs.map +1 -1
- package/dist/components/json-schema-form-render.d.ts.map +1 -1
- package/dist/components/json-schema-form-render.js +2 -2
- package/dist/components/json-schema-form-render.js.map +1 -1
- package/dist/components/json-schema-form-resolve.cjs +1 -1
- package/dist/components/json-schema-form-resolve.cjs.map +1 -1
- package/dist/components/json-schema-form-resolve.js +1 -1
- package/dist/components/json-schema-form-resolve.js.map +1 -1
- package/dist/components/json-schema-form-tone.cjs +12 -0
- package/dist/components/json-schema-form-tone.cjs.map +1 -1
- package/dist/components/json-schema-form-tone.js +12 -0
- package/dist/components/json-schema-form-tone.js.map +1 -1
- package/dist/components/json-schema-form-types.d.ts +1 -1
- package/dist/components/json-schema-form-types.d.ts.map +1 -1
- package/dist/components/unit-form-extension.cjs +126 -0
- package/dist/components/unit-form-extension.cjs.map +1 -0
- package/dist/components/unit-form-extension.d.ts +8 -0
- package/dist/components/unit-form-extension.d.ts.map +1 -0
- package/dist/components/unit-form-extension.js +126 -0
- package/dist/components/unit-form-extension.js.map +1 -0
- package/dist/components.cjs +4 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.ts +1 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +4 -0
- package/dist/components.js.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.cjs +61 -8
- package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.js +61 -8
- package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.cjs +10 -4
- package/dist/data/diagnostics/error-diagnostics.cjs.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.d.ts.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.js +10 -4
- package/dist/data/diagnostics/error-diagnostics.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.cjs +12 -6
- package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.js +12 -6
- package/dist/data/query-browser/QueryBrowser.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs +2 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.d.ts +16 -14
- package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.js +2 -1
- package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/string.cjs +8 -0
- package/dist/lib/string.cjs.map +1 -1
- package/dist/lib/string.d.ts +1 -0
- package/dist/lib/string.d.ts.map +1 -1
- package/dist/lib/string.js +8 -0
- package/dist/lib/string.js.map +1 -1
- package/dist/profiles/catalogTree.cjs +133 -0
- package/dist/profiles/catalogTree.cjs.map +1 -0
- package/dist/profiles/catalogTree.d.ts +11 -0
- package/dist/profiles/catalogTree.d.ts.map +1 -0
- package/dist/profiles/catalogTree.js +133 -0
- package/dist/profiles/catalogTree.js.map +1 -0
- package/dist/profiles/connectionBrowserModel.cjs +185 -0
- package/dist/profiles/connectionBrowserModel.cjs.map +1 -0
- package/dist/profiles/connectionBrowserModel.d.ts +169 -0
- package/dist/profiles/connectionBrowserModel.d.ts.map +1 -0
- package/dist/profiles/connectionBrowserModel.js +185 -0
- package/dist/profiles/connectionBrowserModel.js.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.cjs +185 -0
- package/dist/profiles/connectionQueryWorkspace.cjs.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.d.ts +63 -0
- package/dist/profiles/connectionQueryWorkspace.d.ts.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.js +185 -0
- package/dist/profiles/connectionQueryWorkspace.js.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.cjs +28 -0
- package/dist/profiles/connectionQueryWorkspaceModel.cjs.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.d.ts +38 -0
- package/dist/profiles/connectionQueryWorkspaceModel.d.ts.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.js +28 -0
- package/dist/profiles/connectionQueryWorkspaceModel.js.map +1 -0
- package/dist/profiles/esFieldValues.cjs +64 -0
- package/dist/profiles/esFieldValues.cjs.map +1 -0
- package/dist/profiles/esFieldValues.d.ts +48 -0
- package/dist/profiles/esFieldValues.d.ts.map +1 -0
- package/dist/profiles/esFieldValues.js +64 -0
- package/dist/profiles/esFieldValues.js.map +1 -0
- package/dist/profiles/esParamMappingModel.cjs +301 -0
- package/dist/profiles/esParamMappingModel.cjs.map +1 -0
- package/dist/profiles/esParamMappingModel.d.ts +37 -0
- package/dist/profiles/esParamMappingModel.d.ts.map +1 -0
- package/dist/profiles/esParamMappingModel.js +301 -0
- package/dist/profiles/esParamMappingModel.js.map +1 -0
- package/dist/profiles/esParamMappingPill.cjs +24 -0
- package/dist/profiles/esParamMappingPill.cjs.map +1 -0
- package/dist/profiles/esParamMappingPill.d.ts +13 -0
- package/dist/profiles/esParamMappingPill.d.ts.map +1 -0
- package/dist/profiles/esParamMappingPill.js +24 -0
- package/dist/profiles/esParamMappingPill.js.map +1 -0
- package/dist/profiles/esParamOperandExtension.cjs +75 -0
- package/dist/profiles/esParamOperandExtension.cjs.map +1 -0
- package/dist/profiles/esParamOperandExtension.d.ts +11 -0
- package/dist/profiles/esParamOperandExtension.d.ts.map +1 -0
- package/dist/profiles/esParamOperandExtension.js +75 -0
- package/dist/profiles/esParamOperandExtension.js.map +1 -0
- package/dist/profiles/esQueryBuilder.cjs +205 -0
- package/dist/profiles/esQueryBuilder.cjs.map +1 -0
- package/dist/profiles/esQueryBuilder.d.ts +35 -0
- package/dist/profiles/esQueryBuilder.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilder.js +205 -0
- package/dist/profiles/esQueryBuilder.js.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.cjs +23 -0
- package/dist/profiles/esQueryBuilderExtension.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.d.ts +5 -0
- package/dist/profiles/esQueryBuilderExtension.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.js +23 -0
- package/dist/profiles/esQueryBuilderExtension.js.map +1 -0
- package/dist/profiles/esQueryBuilderForm.cjs +26 -0
- package/dist/profiles/esQueryBuilderForm.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderForm.d.ts +18 -0
- package/dist/profiles/esQueryBuilderForm.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderForm.js +26 -0
- package/dist/profiles/esQueryBuilderForm.js.map +1 -0
- package/dist/profiles/esQueryBuilderModel.cjs +131 -0
- package/dist/profiles/esQueryBuilderModel.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderModel.d.ts +108 -0
- package/dist/profiles/esQueryBuilderModel.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderModel.js +131 -0
- package/dist/profiles/esQueryBuilderModel.js.map +1 -0
- package/dist/profiles/esQueryClauseGroup.cjs +144 -0
- package/dist/profiles/esQueryClauseGroup.cjs.map +1 -0
- package/dist/profiles/esQueryClauseGroup.d.ts +10 -0
- package/dist/profiles/esQueryClauseGroup.d.ts.map +1 -0
- package/dist/profiles/esQueryClauseGroup.js +144 -0
- package/dist/profiles/esQueryClauseGroup.js.map +1 -0
- package/dist/profiles/esQueryCompile.cjs +47 -0
- package/dist/profiles/esQueryCompile.cjs.map +1 -0
- package/dist/profiles/esQueryCompile.d.ts +39 -0
- package/dist/profiles/esQueryCompile.d.ts.map +1 -0
- package/dist/profiles/esQueryCompile.js +47 -0
- package/dist/profiles/esQueryCompile.js.map +1 -0
- package/dist/profiles/esQueryConditionRow.cjs +168 -0
- package/dist/profiles/esQueryConditionRow.cjs.map +1 -0
- package/dist/profiles/esQueryConditionRow.d.ts +37 -0
- package/dist/profiles/esQueryConditionRow.d.ts.map +1 -0
- package/dist/profiles/esQueryConditionRow.js +168 -0
- package/dist/profiles/esQueryConditionRow.js.map +1 -0
- package/dist/profiles/esQueryGroupModel.cjs +12 -0
- package/dist/profiles/esQueryGroupModel.cjs.map +1 -0
- package/dist/profiles/esQueryGroupModel.d.ts +9 -0
- package/dist/profiles/esQueryGroupModel.d.ts.map +1 -0
- package/dist/profiles/esQueryGroupModel.js +12 -0
- package/dist/profiles/esQueryGroupModel.js.map +1 -0
- package/dist/profiles/esQueryOccur.cjs +16 -0
- package/dist/profiles/esQueryOccur.cjs.map +1 -0
- package/dist/profiles/esQueryOccur.d.ts +11 -0
- package/dist/profiles/esQueryOccur.d.ts.map +1 -0
- package/dist/profiles/esQueryOccur.js +16 -0
- package/dist/profiles/esQueryOccur.js.map +1 -0
- package/dist/profiles/esQueryOperandEditors.cjs +279 -0
- package/dist/profiles/esQueryOperandEditors.cjs.map +1 -0
- package/dist/profiles/esQueryOperandEditors.d.ts +24 -0
- package/dist/profiles/esQueryOperandEditors.d.ts.map +1 -0
- package/dist/profiles/esQueryOperandEditors.js +279 -0
- package/dist/profiles/esQueryOperandEditors.js.map +1 -0
- package/dist/profiles/esQueryOperandModel.cjs +28 -0
- package/dist/profiles/esQueryOperandModel.cjs.map +1 -0
- package/dist/profiles/esQueryOperandModel.d.ts +17 -0
- package/dist/profiles/esQueryOperandModel.d.ts.map +1 -0
- package/dist/profiles/esQueryOperandModel.js +28 -0
- package/dist/profiles/esQueryOperandModel.js.map +1 -0
- package/dist/profiles/esQueryOperators.cjs +165 -0
- package/dist/profiles/esQueryOperators.cjs.map +1 -0
- package/dist/profiles/esQueryOperators.d.ts +83 -0
- package/dist/profiles/esQueryOperators.d.ts.map +1 -0
- package/dist/profiles/esQueryOperators.js +165 -0
- package/dist/profiles/esQueryOperators.js.map +1 -0
- package/dist/profiles/esQueryOutputEditor.cjs +138 -0
- package/dist/profiles/esQueryOutputEditor.cjs.map +1 -0
- package/dist/profiles/esQueryOutputEditor.d.ts +7 -0
- package/dist/profiles/esQueryOutputEditor.d.ts.map +1 -0
- package/dist/profiles/esQueryOutputEditor.js +138 -0
- package/dist/profiles/esQueryOutputEditor.js.map +1 -0
- package/dist/profiles/esQueryOutputModel.cjs +16 -0
- package/dist/profiles/esQueryOutputModel.cjs.map +1 -0
- package/dist/profiles/esQueryOutputModel.d.ts +14 -0
- package/dist/profiles/esQueryOutputModel.d.ts.map +1 -0
- package/dist/profiles/esQueryOutputModel.js +16 -0
- package/dist/profiles/esQueryOutputModel.js.map +1 -0
- package/dist/profiles/esQueryPreview.cjs +30 -0
- package/dist/profiles/esQueryPreview.cjs.map +1 -0
- package/dist/profiles/esQueryPreview.d.ts +6 -0
- package/dist/profiles/esQueryPreview.d.ts.map +1 -0
- package/dist/profiles/esQueryPreview.js +30 -0
- package/dist/profiles/esQueryPreview.js.map +1 -0
- package/dist/profiles/esQuerySortEditor.cjs +143 -0
- package/dist/profiles/esQuerySortEditor.cjs.map +1 -0
- package/dist/profiles/esQuerySortEditor.d.ts +9 -0
- package/dist/profiles/esQuerySortEditor.d.ts.map +1 -0
- package/dist/profiles/esQuerySortEditor.js +143 -0
- package/dist/profiles/esQuerySortEditor.js.map +1 -0
- package/dist/profiles/esQuerySortModel.cjs +13 -0
- package/dist/profiles/esQuerySortModel.cjs.map +1 -0
- package/dist/profiles/esQuerySortModel.d.ts +4 -0
- package/dist/profiles/esQuerySortModel.d.ts.map +1 -0
- package/dist/profiles/esQuerySortModel.js +13 -0
- package/dist/profiles/esQuerySortModel.js.map +1 -0
- package/dist/profiles/esValueCombobox.cjs +86 -0
- package/dist/profiles/esValueCombobox.cjs.map +1 -0
- package/dist/profiles/esValueCombobox.d.ts +15 -0
- package/dist/profiles/esValueCombobox.d.ts.map +1 -0
- package/dist/profiles/esValueCombobox.js +86 -0
- package/dist/profiles/esValueCombobox.js.map +1 -0
- package/dist/profiles/jsonPathSample.cjs +75 -0
- package/dist/profiles/jsonPathSample.cjs.map +1 -0
- package/dist/profiles/jsonPathSample.d.ts +27 -0
- package/dist/profiles/jsonPathSample.d.ts.map +1 -0
- package/dist/profiles/jsonPathSample.js +75 -0
- package/dist/profiles/jsonPathSample.js.map +1 -0
- package/dist/profiles/jsonPathSampleRow.cjs +14 -0
- package/dist/profiles/jsonPathSampleRow.cjs.map +1 -0
- package/dist/profiles/jsonPathSampleRow.d.ts +6 -0
- package/dist/profiles/jsonPathSampleRow.d.ts.map +1 -0
- package/dist/profiles/jsonPathSampleRow.js +14 -0
- package/dist/profiles/jsonPathSampleRow.js.map +1 -0
- package/dist/profiles/profileApi.cjs +37 -0
- package/dist/profiles/profileApi.cjs.map +1 -0
- package/dist/profiles/profileApi.d.ts +32 -0
- package/dist/profiles/profileApi.d.ts.map +1 -0
- package/dist/profiles/profileApi.js +37 -0
- package/dist/profiles/profileApi.js.map +1 -0
- package/dist/profiles/profileBuilder.cjs +65 -0
- package/dist/profiles/profileBuilder.cjs.map +1 -0
- package/dist/profiles/profileBuilder.d.ts +11 -0
- package/dist/profiles/profileBuilder.d.ts.map +1 -0
- package/dist/profiles/profileBuilder.js +65 -0
- package/dist/profiles/profileBuilder.js.map +1 -0
- package/dist/profiles/profileBuilderExtension.cjs +25 -0
- package/dist/profiles/profileBuilderExtension.cjs.map +1 -0
- package/dist/profiles/profileBuilderExtension.d.ts +5 -0
- package/dist/profiles/profileBuilderExtension.d.ts.map +1 -0
- package/dist/profiles/profileBuilderExtension.js +25 -0
- package/dist/profiles/profileBuilderExtension.js.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.cjs +368 -0
- package/dist/profiles/profileBuilderWorkspace.cjs.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.d.ts +21 -0
- package/dist/profiles/profileBuilderWorkspace.d.ts.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.js +368 -0
- package/dist/profiles/profileBuilderWorkspace.js.map +1 -0
- package/dist/profiles/profileColumnModel.cjs +23 -0
- package/dist/profiles/profileColumnModel.cjs.map +1 -0
- package/dist/profiles/profileColumnModel.d.ts +8 -0
- package/dist/profiles/profileColumnModel.d.ts.map +1 -0
- package/dist/profiles/profileColumnModel.js +23 -0
- package/dist/profiles/profileColumnModel.js.map +1 -0
- package/dist/profiles/profileColumnPicker.cjs +68 -0
- package/dist/profiles/profileColumnPicker.cjs.map +1 -0
- package/dist/profiles/profileColumnPicker.d.ts +11 -0
- package/dist/profiles/profileColumnPicker.d.ts.map +1 -0
- package/dist/profiles/profileColumnPicker.js +68 -0
- package/dist/profiles/profileColumnPicker.js.map +1 -0
- package/dist/profiles/profileEditor.cjs +386 -0
- package/dist/profiles/profileEditor.cjs.map +1 -0
- package/dist/profiles/profileEditor.d.ts +19 -0
- package/dist/profiles/profileEditor.d.ts.map +1 -0
- package/dist/profiles/profileEditor.js +386 -0
- package/dist/profiles/profileEditor.js.map +1 -0
- package/dist/profiles/profileEditorModel.cjs +181 -0
- package/dist/profiles/profileEditorModel.cjs.map +1 -0
- package/dist/profiles/profileEditorModel.d.ts +74 -0
- package/dist/profiles/profileEditorModel.d.ts.map +1 -0
- package/dist/profiles/profileEditorModel.js +181 -0
- package/dist/profiles/profileEditorModel.js.map +1 -0
- package/dist/profiles/profileEditorPreview.cjs +38 -0
- package/dist/profiles/profileEditorPreview.cjs.map +1 -0
- package/dist/profiles/profileEditorPreview.d.ts +12 -0
- package/dist/profiles/profileEditorPreview.d.ts.map +1 -0
- package/dist/profiles/profileEditorPreview.js +38 -0
- package/dist/profiles/profileEditorPreview.js.map +1 -0
- package/dist/profiles/profileEditorRail.cjs +46 -0
- package/dist/profiles/profileEditorRail.cjs.map +1 -0
- package/dist/profiles/profileEditorRail.d.ts +8 -0
- package/dist/profiles/profileEditorRail.d.ts.map +1 -0
- package/dist/profiles/profileEditorRail.js +46 -0
- package/dist/profiles/profileEditorRail.js.map +1 -0
- package/dist/profiles/profileEditorRaw.cjs +118 -0
- package/dist/profiles/profileEditorRaw.cjs.map +1 -0
- package/dist/profiles/profileEditorRaw.d.ts +7 -0
- package/dist/profiles/profileEditorRaw.d.ts.map +1 -0
- package/dist/profiles/profileEditorRaw.js +118 -0
- package/dist/profiles/profileEditorRaw.js.map +1 -0
- package/dist/profiles/profileEditorRoutes.cjs +7 -0
- package/dist/profiles/profileEditorRoutes.cjs.map +1 -0
- package/dist/profiles/profileEditorRoutes.d.ts +2 -0
- package/dist/profiles/profileEditorRoutes.d.ts.map +1 -0
- package/dist/profiles/profileEditorRoutes.js +7 -0
- package/dist/profiles/profileEditorRoutes.js.map +1 -0
- package/dist/profiles/profileEditorSections.cjs +213 -0
- package/dist/profiles/profileEditorSections.cjs.map +1 -0
- package/dist/profiles/profileEditorSections.d.ts +23 -0
- package/dist/profiles/profileEditorSections.d.ts.map +1 -0
- package/dist/profiles/profileEditorSections.js +213 -0
- package/dist/profiles/profileEditorSections.js.map +1 -0
- package/dist/profiles/profileFieldEditor.cjs +200 -0
- package/dist/profiles/profileFieldEditor.cjs.map +1 -0
- package/dist/profiles/profileFieldEditor.d.ts +34 -0
- package/dist/profiles/profileFieldEditor.d.ts.map +1 -0
- package/dist/profiles/profileFieldEditor.js +200 -0
- package/dist/profiles/profileFieldEditor.js.map +1 -0
- package/dist/profiles/profileFieldGrid.cjs +250 -0
- package/dist/profiles/profileFieldGrid.cjs.map +1 -0
- package/dist/profiles/profileFieldGrid.d.ts +20 -0
- package/dist/profiles/profileFieldGrid.d.ts.map +1 -0
- package/dist/profiles/profileFieldGrid.js +250 -0
- package/dist/profiles/profileFieldGrid.js.map +1 -0
- package/dist/profiles/profileFieldManager.cjs +103 -0
- package/dist/profiles/profileFieldManager.cjs.map +1 -0
- package/dist/profiles/profileFieldManager.d.ts +9 -0
- package/dist/profiles/profileFieldManager.d.ts.map +1 -0
- package/dist/profiles/profileFieldManager.js +103 -0
- package/dist/profiles/profileFieldManager.js.map +1 -0
- package/dist/profiles/profileFieldState.cjs +136 -0
- package/dist/profiles/profileFieldState.cjs.map +1 -0
- package/dist/profiles/profileFieldState.d.ts +41 -0
- package/dist/profiles/profileFieldState.d.ts.map +1 -0
- package/dist/profiles/profileFieldState.js +136 -0
- package/dist/profiles/profileFieldState.js.map +1 -0
- package/dist/profiles/profileFieldTypes.cjs +17 -0
- package/dist/profiles/profileFieldTypes.cjs.map +1 -0
- package/dist/profiles/profileFieldTypes.d.ts +8 -0
- package/dist/profiles/profileFieldTypes.d.ts.map +1 -0
- package/dist/profiles/profileFieldTypes.js +17 -0
- package/dist/profiles/profileFieldTypes.js.map +1 -0
- package/dist/profiles/profileParamModel.cjs +78 -0
- package/dist/profiles/profileParamModel.cjs.map +1 -0
- package/dist/profiles/profileParamModel.d.ts +3 -0
- package/dist/profiles/profileParamModel.d.ts.map +1 -0
- package/dist/profiles/profileParamModel.js +78 -0
- package/dist/profiles/profileParamModel.js.map +1 -0
- package/dist/profiles/profileSamplePayload.cjs +15 -0
- package/dist/profiles/profileSamplePayload.cjs.map +1 -0
- package/dist/profiles/profileSamplePayload.d.ts +13 -0
- package/dist/profiles/profileSamplePayload.d.ts.map +1 -0
- package/dist/profiles/profileSamplePayload.js +15 -0
- package/dist/profiles/profileSamplePayload.js.map +1 -0
- package/dist/profiles/profileWizard.cjs +257 -0
- package/dist/profiles/profileWizard.cjs.map +1 -0
- package/dist/profiles/profileWizard.d.ts +12 -0
- package/dist/profiles/profileWizard.d.ts.map +1 -0
- package/dist/profiles/profileWizard.js +257 -0
- package/dist/profiles/profileWizard.js.map +1 -0
- package/dist/profiles/profileWizardHelp.cjs +10 -0
- package/dist/profiles/profileWizardHelp.cjs.map +1 -0
- package/dist/profiles/profileWizardHelp.d.ts +13 -0
- package/dist/profiles/profileWizardHelp.d.ts.map +1 -0
- package/dist/profiles/profileWizardHelp.js +10 -0
- package/dist/profiles/profileWizardHelp.js.map +1 -0
- package/dist/profiles/profileWizardModel.cjs +198 -0
- package/dist/profiles/profileWizardModel.cjs.map +1 -0
- package/dist/profiles/profileWizardModel.d.ts +255 -0
- package/dist/profiles/profileWizardModel.d.ts.map +1 -0
- package/dist/profiles/profileWizardModel.js +198 -0
- package/dist/profiles/profileWizardModel.js.map +1 -0
- package/dist/profiles/profileWizardQueryStep.cjs +215 -0
- package/dist/profiles/profileWizardQueryStep.cjs.map +1 -0
- package/dist/profiles/profileWizardQueryStep.d.ts +18 -0
- package/dist/profiles/profileWizardQueryStep.d.ts.map +1 -0
- package/dist/profiles/profileWizardQueryStep.js +215 -0
- package/dist/profiles/profileWizardQueryStep.js.map +1 -0
- package/dist/profiles/profileWizardSteps.cjs +214 -0
- package/dist/profiles/profileWizardSteps.cjs.map +1 -0
- package/dist/profiles/profileWizardSteps.d.ts +35 -0
- package/dist/profiles/profileWizardSteps.d.ts.map +1 -0
- package/dist/profiles/profileWizardSteps.js +214 -0
- package/dist/profiles/profileWizardSteps.js.map +1 -0
- package/dist/profiles/profileYaml.cjs +19 -0
- package/dist/profiles/profileYaml.cjs.map +1 -0
- package/dist/profiles/profileYaml.d.ts +4 -0
- package/dist/profiles/profileYaml.d.ts.map +1 -0
- package/dist/profiles/profileYaml.js +19 -0
- package/dist/profiles/profileYaml.js.map +1 -0
- package/dist/profiles/prometheusResults.cjs +60 -0
- package/dist/profiles/prometheusResults.cjs.map +1 -0
- package/dist/profiles/prometheusResults.d.ts +7 -0
- package/dist/profiles/prometheusResults.d.ts.map +1 -0
- package/dist/profiles/prometheusResults.js +60 -0
- package/dist/profiles/prometheusResults.js.map +1 -0
- package/dist/profiles/queryRowLimits.cjs +82 -0
- package/dist/profiles/queryRowLimits.cjs.map +1 -0
- package/dist/profiles/queryRowLimits.d.ts +9 -0
- package/dist/profiles/queryRowLimits.d.ts.map +1 -0
- package/dist/profiles/queryRowLimits.js +82 -0
- package/dist/profiles/queryRowLimits.js.map +1 -0
- package/dist/profiles/queryRowLimitsModel.cjs +10 -0
- package/dist/profiles/queryRowLimitsModel.cjs.map +1 -0
- package/dist/profiles/queryRowLimitsModel.d.ts +9 -0
- package/dist/profiles/queryRowLimitsModel.d.ts.map +1 -0
- package/dist/profiles/queryRowLimitsModel.js +10 -0
- package/dist/profiles/queryRowLimitsModel.js.map +1 -0
- package/dist/profiles/queryTargetPicker.cjs +42 -0
- package/dist/profiles/queryTargetPicker.cjs.map +1 -0
- package/dist/profiles/queryTargetPicker.d.ts +8 -0
- package/dist/profiles/queryTargetPicker.d.ts.map +1 -0
- package/dist/profiles/queryTargetPicker.js +42 -0
- package/dist/profiles/queryTargetPicker.js.map +1 -0
- package/dist/profiles/testSchema.d.ts +3 -0
- package/dist/profiles/testSchema.d.ts.map +1 -0
- package/dist/profiles.cjs +223 -0
- package/dist/profiles.cjs.map +1 -0
- package/dist/profiles.d.ts +68 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +223 -0
- package/dist/profiles.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirror of the Go `query/esdsl` specification. The builder edits this shape and
|
|
3
|
+
* the server compiles it; nothing here renders DSL, so the two never drift.
|
|
4
|
+
*/
|
|
5
|
+
export type EsOccur = "filter" | "must" | "should" | "must_not";
|
|
6
|
+
/** A literal operand, or `{param}` binding one to a profile parameter. */
|
|
7
|
+
export type EsValue = unknown;
|
|
8
|
+
export type EsCondition = {
|
|
9
|
+
op: string;
|
|
10
|
+
occur?: EsOccur | "" | undefined;
|
|
11
|
+
field?: string | undefined;
|
|
12
|
+
fields?: string[] | undefined;
|
|
13
|
+
value?: EsValue | undefined;
|
|
14
|
+
values?: EsValue[] | undefined;
|
|
15
|
+
gt?: EsValue | undefined;
|
|
16
|
+
gte?: EsValue | undefined;
|
|
17
|
+
lt?: EsValue | undefined;
|
|
18
|
+
lte?: EsValue | undefined;
|
|
19
|
+
format?: string | undefined;
|
|
20
|
+
timeZone?: string | undefined;
|
|
21
|
+
analyzer?: string | undefined;
|
|
22
|
+
matchOperator?: string | undefined;
|
|
23
|
+
multiMatchType?: string | undefined;
|
|
24
|
+
fuzziness?: string | undefined;
|
|
25
|
+
slop?: number | undefined;
|
|
26
|
+
boost?: number | undefined;
|
|
27
|
+
caseInsensitive?: boolean | undefined;
|
|
28
|
+
escape?: boolean | undefined;
|
|
29
|
+
path?: string | undefined;
|
|
30
|
+
scoreMode?: string | undefined;
|
|
31
|
+
minimumShouldMatch?: string | undefined;
|
|
32
|
+
conditions?: EsCondition[] | undefined;
|
|
33
|
+
optional?: boolean | undefined;
|
|
34
|
+
when?: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
export type EsSortBy = {
|
|
37
|
+
field: string;
|
|
38
|
+
order?: string | undefined;
|
|
39
|
+
mode?: string | undefined;
|
|
40
|
+
missing?: string | undefined;
|
|
41
|
+
unmappedType?: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
export type EsSearch = {
|
|
44
|
+
query?: EsCondition | undefined;
|
|
45
|
+
sort?: EsSortBy[] | undefined;
|
|
46
|
+
size?: number | undefined;
|
|
47
|
+
from?: number | undefined;
|
|
48
|
+
source?: {
|
|
49
|
+
enabled?: boolean | undefined;
|
|
50
|
+
includes?: string[] | undefined;
|
|
51
|
+
excludes?: string[] | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
trackTotalHits?: {
|
|
54
|
+
enabled?: boolean | undefined;
|
|
55
|
+
threshold?: number | undefined;
|
|
56
|
+
} | undefined;
|
|
57
|
+
storedFields?: string[] | undefined;
|
|
58
|
+
fields?: string[] | undefined;
|
|
59
|
+
aggregations?: Record<string, unknown> | undefined;
|
|
60
|
+
timeField?: string | undefined;
|
|
61
|
+
};
|
|
62
|
+
/** A path of child indexes from the root condition. `[]` is the root itself. */
|
|
63
|
+
export type ConditionPath = number[];
|
|
64
|
+
export declare function normalizeOccur(occur: string | undefined): EsOccur;
|
|
65
|
+
/**
|
|
66
|
+
* defaultOperatorForFamily is the operator a family reads best as. It seeds a
|
|
67
|
+
* new condition and leads the operator list, so both agree by construction.
|
|
68
|
+
*/
|
|
69
|
+
export declare function defaultOperatorForFamily(family: string): string;
|
|
70
|
+
export declare function emptyCondition(family?: string): EsCondition;
|
|
71
|
+
export declare function emptyGroup(): EsCondition;
|
|
72
|
+
export declare function conditionAt(root: EsCondition, path: ConditionPath): EsCondition | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* updateAt rebuilds only the branch it edits, so untouched subtrees keep their
|
|
75
|
+
* identity and React re-renders just the changed rows.
|
|
76
|
+
*/
|
|
77
|
+
export declare function updateAt(root: EsCondition, path: ConditionPath, update: (condition: EsCondition) => EsCondition): EsCondition;
|
|
78
|
+
export declare function insertAt(root: EsCondition, groupPath: ConditionPath, position: number, condition: EsCondition): EsCondition;
|
|
79
|
+
export declare function removeAt(root: EsCondition, path: ConditionPath): EsCondition;
|
|
80
|
+
/** isParamValue reports whether an operand binds a profile parameter. */
|
|
81
|
+
export declare function isParamValue(value: EsValue): value is {
|
|
82
|
+
param: string;
|
|
83
|
+
};
|
|
84
|
+
export declare function paramName(value: EsValue): string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* fieldForParam is the field a parameter filters on: the field of the first
|
|
87
|
+
* condition whose operand binds it. A parameter the specification never
|
|
88
|
+
* references has no field, and so nothing to offer values from.
|
|
89
|
+
*/
|
|
90
|
+
export declare function fieldForParam(search: EsSearch | undefined, name: string): string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* isEmptySpec reports whether a specification says nothing the raw query would
|
|
93
|
+
* not. It is what decides whether a profile is still in raw mode.
|
|
94
|
+
*/
|
|
95
|
+
export declare function isEmptySpec(search: EsSearch | undefined): boolean;
|
|
96
|
+
export type QueryModeTransition = {
|
|
97
|
+
search: EsSearch | undefined;
|
|
98
|
+
query: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* toRawMode leaves the builder for the raw editor, seeding it with the DSL the
|
|
102
|
+
* specification last compiled to. The specification is dropped, never kept
|
|
103
|
+
* alongside the query: the server treats holding both as an authoring error.
|
|
104
|
+
*/
|
|
105
|
+
export declare function toRawMode(_search: EsSearch | undefined, compiled: string, currentQuery?: string): QueryModeTransition;
|
|
106
|
+
/** toBuilderMode is the inverse: the raw query is dropped, not parsed. */
|
|
107
|
+
export declare function toBuilderMode(search?: EsSearch): QueryModeTransition;
|
|
108
|
+
//# sourceMappingURL=esQueryBuilderModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esQueryBuilderModel.d.ts","sourceRoot":"","sources":["../../src/profiles/esQueryBuilderModel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEhE,0EAA0E;AAC1E,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC;AAE9B,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,OAAO,GAAG,EAAE,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;IAC/B,EAAE,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACzB,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,EAAE,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACzB,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,cAAc,CAAC,EAAE,M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5E;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAQvE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,QAAQ,GAAG,SAAS,EAC5B,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAqBpB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAajE;AASD,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,QAAQ,EAAE,MAAM,EAChB,YAAY,SAAK,GAChB,mBAAmB,CAErB;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,mBAAmB,CAEpE"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const defaultOperators = {
|
|
2
|
+
keyword: "term",
|
|
3
|
+
text: "match",
|
|
4
|
+
date: "range",
|
|
5
|
+
number: "range",
|
|
6
|
+
boolean: "term",
|
|
7
|
+
ip: "term",
|
|
8
|
+
nested: "nested"
|
|
9
|
+
};
|
|
10
|
+
function normalizeOccur(occur) {
|
|
11
|
+
return occur || "filter";
|
|
12
|
+
}
|
|
13
|
+
function defaultOperatorForFamily(family) {
|
|
14
|
+
return defaultOperators[family] ?? "term";
|
|
15
|
+
}
|
|
16
|
+
function emptyCondition(family = "keyword") {
|
|
17
|
+
const op = defaultOperatorForFamily(family);
|
|
18
|
+
return op === "nested" ? { op, conditions: [] } : { op };
|
|
19
|
+
}
|
|
20
|
+
function emptyGroup() {
|
|
21
|
+
return { op: "bool", conditions: [] };
|
|
22
|
+
}
|
|
23
|
+
function conditionAt(root, path) {
|
|
24
|
+
var _a;
|
|
25
|
+
let node = root;
|
|
26
|
+
for (const index of path) {
|
|
27
|
+
node = (_a = node == null ? void 0 : node.conditions) == null ? void 0 : _a[index];
|
|
28
|
+
if (!node) return void 0;
|
|
29
|
+
}
|
|
30
|
+
return node;
|
|
31
|
+
}
|
|
32
|
+
function updateAt(root, path, update) {
|
|
33
|
+
if (path.length === 0) return update(root);
|
|
34
|
+
const [index, ...rest] = path;
|
|
35
|
+
return {
|
|
36
|
+
...root,
|
|
37
|
+
conditions: (root.conditions ?? []).map(
|
|
38
|
+
(child, position) => position === index ? updateAt(child, rest, update) : child
|
|
39
|
+
)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function insertAt(root, groupPath, position, condition) {
|
|
43
|
+
return updateAt(root, groupPath, (group) => {
|
|
44
|
+
const children = [...group.conditions ?? []];
|
|
45
|
+
children.splice(Math.min(Math.max(position, 0), children.length), 0, condition);
|
|
46
|
+
return { ...group, conditions: children };
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function removeAt(root, path) {
|
|
50
|
+
if (path.length === 0) return emptyGroup();
|
|
51
|
+
const index = path[path.length - 1];
|
|
52
|
+
return updateAt(root, path.slice(0, -1), (group) => ({
|
|
53
|
+
...group,
|
|
54
|
+
conditions: (group.conditions ?? []).filter(
|
|
55
|
+
(_child, position) => position !== index
|
|
56
|
+
)
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
function isParamValue(value) {
|
|
60
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
61
|
+
const keys = Object.keys(value);
|
|
62
|
+
return keys.length === 1 && keys[0] === "param" && typeof value.param === "string";
|
|
63
|
+
}
|
|
64
|
+
function paramName(value) {
|
|
65
|
+
return isParamValue(value) ? value.param : void 0;
|
|
66
|
+
}
|
|
67
|
+
function fieldForParam(search, name) {
|
|
68
|
+
const walk = (condition) => {
|
|
69
|
+
if (!condition) return void 0;
|
|
70
|
+
const operands = [
|
|
71
|
+
condition.value,
|
|
72
|
+
...condition.values ?? [],
|
|
73
|
+
condition.gt,
|
|
74
|
+
condition.gte,
|
|
75
|
+
condition.lt,
|
|
76
|
+
condition.lte
|
|
77
|
+
];
|
|
78
|
+
if (condition.field && operands.some((value) => paramName(value) === name)) {
|
|
79
|
+
return condition.field;
|
|
80
|
+
}
|
|
81
|
+
for (const child of condition.conditions ?? []) {
|
|
82
|
+
const found = walk(child);
|
|
83
|
+
if (found) return found;
|
|
84
|
+
}
|
|
85
|
+
return void 0;
|
|
86
|
+
};
|
|
87
|
+
return name ? walk(search == null ? void 0 : search.query) : void 0;
|
|
88
|
+
}
|
|
89
|
+
function isEmptySpec(search) {
|
|
90
|
+
if (!search) return true;
|
|
91
|
+
const { query, ...rest } = search;
|
|
92
|
+
for (const value of Object.values(rest)) {
|
|
93
|
+
if (Array.isArray(value) ? value.length > 0 : value !== void 0 && value !== null) {
|
|
94
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
95
|
+
if (Object.keys(value).length > 0) return false;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return isEmptyCondition(query);
|
|
102
|
+
}
|
|
103
|
+
function isEmptyCondition(condition) {
|
|
104
|
+
if (!condition) return true;
|
|
105
|
+
if (condition.op === "match_all") return true;
|
|
106
|
+
if (condition.op !== "bool") return false;
|
|
107
|
+
return (condition.conditions ?? []).every(isEmptyCondition);
|
|
108
|
+
}
|
|
109
|
+
function toRawMode(_search, compiled, currentQuery = "") {
|
|
110
|
+
return { search: void 0, query: compiled.trim() || currentQuery };
|
|
111
|
+
}
|
|
112
|
+
function toBuilderMode(search) {
|
|
113
|
+
return { search: search ?? { query: emptyGroup() }, query: "" };
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
conditionAt,
|
|
117
|
+
defaultOperatorForFamily,
|
|
118
|
+
emptyCondition,
|
|
119
|
+
emptyGroup,
|
|
120
|
+
fieldForParam,
|
|
121
|
+
insertAt,
|
|
122
|
+
isEmptySpec,
|
|
123
|
+
isParamValue,
|
|
124
|
+
normalizeOccur,
|
|
125
|
+
paramName,
|
|
126
|
+
removeAt,
|
|
127
|
+
toBuilderMode,
|
|
128
|
+
toRawMode,
|
|
129
|
+
updateAt
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=esQueryBuilderModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esQueryBuilderModel.js","sources":["../../src/profiles/esQueryBuilderModel.ts"],"sourcesContent":["/**\n * Mirror of the Go `query/esdsl` specification. The builder edits this shape and\n * the server compiles it; nothing here renders DSL, so the two never drift.\n */\n\nexport type EsOccur = \"filter\" | \"must\" | \"should\" | \"must_not\";\n\n/** A literal operand, or `{param}` binding one to a profile parameter. */\nexport type EsValue = unknown;\n\nexport type EsCondition = {\n op: string;\n occur?: EsOccur | \"\" | undefined;\n field?: string | undefined;\n fields?: string[] | undefined;\n value?: EsValue | undefined;\n values?: EsValue[] | undefined;\n gt?: EsValue | undefined;\n gte?: EsValue | undefined;\n lt?: EsValue | undefined;\n lte?: EsValue | undefined;\n format?: string | undefined;\n timeZone?: string | undefined;\n analyzer?: string | undefined;\n matchOperator?: string | undefined;\n multiMatchType?: string | undefined;\n fuzziness?: string | undefined;\n slop?: number | undefined;\n boost?: number | undefined;\n caseInsensitive?: boolean | undefined;\n escape?: boolean | undefined;\n path?: string | undefined;\n scoreMode?: string | undefined;\n minimumShouldMatch?: string | undefined;\n conditions?: EsCondition[] | undefined;\n optional?: boolean | undefined;\n when?: string | undefined;\n};\n\nexport type EsSortBy = {\n field: string;\n order?: string | undefined;\n mode?: string | undefined;\n missing?: string | undefined;\n unmappedType?: string | undefined;\n};\n\nexport type EsSearch = {\n query?: EsCondition | undefined;\n sort?: EsSortBy[] | undefined;\n size?: number | undefined;\n from?: number | undefined;\n source?:\n | {\n enabled?: boolean | undefined;\n includes?: string[] | undefined;\n excludes?: string[] | undefined;\n }\n | undefined;\n trackTotalHits?:\n | { enabled?: boolean | undefined; threshold?: number | undefined }\n | undefined;\n storedFields?: string[] | undefined;\n fields?: string[] | undefined;\n aggregations?: Record<string, unknown> | undefined;\n timeField?: string | undefined;\n};\n\n/** A path of child indexes from the root condition. `[]` is the root itself. */\nexport type ConditionPath = number[];\n\nconst defaultOperators: Record<string, string> = {\n keyword: \"term\",\n text: \"match\",\n date: \"range\",\n number: \"range\",\n boolean: \"term\",\n ip: \"term\",\n nested: \"nested\",\n};\n\nexport function normalizeOccur(occur: string | undefined): EsOccur {\n return (occur || \"filter\") as EsOccur;\n}\n\n/**\n * defaultOperatorForFamily is the operator a family reads best as. It seeds a\n * new condition and leads the operator list, so both agree by construction.\n */\nexport function defaultOperatorForFamily(family: string): string {\n return defaultOperators[family] ?? \"term\";\n}\n\nexport function emptyCondition(family = \"keyword\"): EsCondition {\n const op = defaultOperatorForFamily(family);\n return op === \"nested\" ? { op, conditions: [] } : { op };\n}\n\nexport function emptyGroup(): EsCondition {\n return { op: \"bool\", conditions: [] };\n}\n\nexport function conditionAt(\n root: EsCondition,\n path: ConditionPath,\n): EsCondition | undefined {\n let node: EsCondition | undefined = root;\n for (const index of path) {\n node = node?.conditions?.[index];\n if (!node) return undefined;\n }\n return node;\n}\n\n/**\n * updateAt rebuilds only the branch it edits, so untouched subtrees keep their\n * identity and React re-renders just the changed rows.\n */\nexport function updateAt(\n root: EsCondition,\n path: ConditionPath,\n update: (condition: EsCondition) => EsCondition,\n): EsCondition {\n if (path.length === 0) return update(root);\n const [index, ...rest] = path;\n return {\n ...root,\n conditions: (root.conditions ?? []).map((child, position) =>\n position === index ? updateAt(child, rest, update) : child,\n ),\n };\n}\n\nexport function insertAt(\n root: EsCondition,\n groupPath: ConditionPath,\n position: number,\n condition: EsCondition,\n): EsCondition {\n return updateAt(root, groupPath, (group) => {\n const children = [...(group.conditions ?? [])];\n children.splice(Math.min(Math.max(position, 0), children.length), 0, condition);\n return { ...group, conditions: children };\n });\n}\n\nexport function removeAt(root: EsCondition, path: ConditionPath): EsCondition {\n if (path.length === 0) return emptyGroup();\n const index = path[path.length - 1];\n return updateAt(root, path.slice(0, -1), (group) => ({\n ...group,\n conditions: (group.conditions ?? []).filter(\n (_child, position) => position !== index,\n ),\n }));\n}\n\n/** isParamValue reports whether an operand binds a profile parameter. */\nexport function isParamValue(value: EsValue): value is { param: string } {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n const keys = Object.keys(value as Record<string, unknown>);\n return (\n keys.length === 1 &&\n keys[0] === \"param\" &&\n typeof (value as { param: unknown }).param === \"string\"\n );\n}\n\nexport function paramName(value: EsValue): string | undefined {\n return isParamValue(value) ? value.param : undefined;\n}\n\n/**\n * fieldForParam is the field a parameter filters on: the field of the first\n * condition whose operand binds it. A parameter the specification never\n * references has no field, and so nothing to offer values from.\n */\nexport function fieldForParam(\n search: EsSearch | undefined,\n name: string,\n): string | undefined {\n const walk = (condition: EsCondition | undefined): string | undefined => {\n if (!condition) return undefined;\n const operands: EsValue[] = [\n condition.value,\n ...(condition.values ?? []),\n condition.gt,\n condition.gte,\n condition.lt,\n condition.lte,\n ];\n if (condition.field && operands.some((value) => paramName(value) === name)) {\n return condition.field;\n }\n for (const child of condition.conditions ?? []) {\n const found = walk(child);\n if (found) return found;\n }\n return undefined;\n };\n return name ? walk(search?.query) : undefined;\n}\n\n/**\n * isEmptySpec reports whether a specification says nothing the raw query would\n * not. It is what decides whether a profile is still in raw mode.\n */\nexport function isEmptySpec(search: EsSearch | undefined): boolean {\n if (!search) return true;\n const { query, ...rest } = search;\n for (const value of Object.values(rest)) {\n if (Array.isArray(value) ? value.length > 0 : value !== undefined && value !== null) {\n if (typeof value === \"object\" && !Array.isArray(value)) {\n if (Object.keys(value as object).length > 0) return false;\n continue;\n }\n return false;\n }\n }\n return isEmptyCondition(query);\n}\n\nfunction isEmptyCondition(condition: EsCondition | undefined): boolean {\n if (!condition) return true;\n if (condition.op === \"match_all\") return true;\n if (condition.op !== \"bool\") return false;\n return (condition.conditions ?? []).every(isEmptyCondition);\n}\n\nexport type QueryModeTransition = {\n search: EsSearch | undefined;\n query: string;\n};\n\n/**\n * toRawMode leaves the builder for the raw editor, seeding it with the DSL the\n * specification last compiled to. The specification is dropped, never kept\n * alongside the query: the server treats holding both as an authoring error.\n */\nexport function toRawMode(\n _search: EsSearch | undefined,\n compiled: string,\n currentQuery = \"\",\n): QueryModeTransition {\n return { search: undefined, query: compiled.trim() || currentQuery };\n}\n\n/** toBuilderMode is the inverse: the raw query is dropped, not parsed. */\nexport function toBuilderMode(search?: EsSearch): QueryModeTransition {\n return { search: search ?? { query: emptyGroup() }, query: \"\" };\n}\n"],"names":[],"mappings":"AAuEA,MAAM,mBAA2C;AAAA,EAC/C,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,QAAQ;AACV;AAEO,SAAS,eAAe,OAAoC;AACjE,SAAQ,SAAS;AACnB;AAMO,SAAS,yBAAyB,QAAwB;AAC/D,SAAO,iBAAiB,MAAM,KAAK;AACrC;AAEO,SAAS,eAAe,SAAS,WAAwB;AAC9D,QAAM,KAAK,yBAAyB,MAAM;AAC1C,SAAO,OAAO,WAAW,EAAE,IAAI,YAAY,CAAA,EAAC,IAAM,EAAE,GAAA;AACtD;AAEO,SAAS,aAA0B;AACxC,SAAO,EAAE,IAAI,QAAQ,YAAY,CAAA,EAAC;AACpC;AAEO,SAAS,YACd,MACA,MACyB;AAlC3B;AAmCE,MAAI,OAAgC;AACpC,aAAW,SAAS,MAAM;AACxB,YAAO,kCAAM,eAAN,mBAAmB;AAC1B,QAAI,CAAC,KAAM,QAAO;AAAA,EACpB;AACA,SAAO;AACT;AAMO,SAAS,SACd,MACA,MACA,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AQ,UAAU,EAAE,OAAO,aAAW,GAAK,OAAO,GAAA;AAC7D;"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const Combobox = require("../components/Combobox.cjs");
|
|
5
|
+
const IconButton = require("../components/IconButton.cjs");
|
|
6
|
+
const InputField = require("../components/InputField.cjs");
|
|
7
|
+
const button = require("../components/button.cjs");
|
|
8
|
+
const select = require("../components/select.cjs");
|
|
9
|
+
const profileWizardModel = require("./profileWizardModel.cjs");
|
|
10
|
+
const esQueryBuilderModel = require("./esQueryBuilderModel.cjs");
|
|
11
|
+
const esQueryConditionRow = require("./esQueryConditionRow.cjs");
|
|
12
|
+
const esQueryOperators = require("./esQueryOperators.cjs");
|
|
13
|
+
const esQueryGroupModel = require("./esQueryGroupModel.cjs");
|
|
14
|
+
const esQueryOccur = require("./esQueryOccur.cjs");
|
|
15
|
+
const UiAdd = require("../icons/components/UiAdd.cjs");
|
|
16
|
+
const UiTrash = require("../icons/components/UiTrash.cjs");
|
|
17
|
+
function EsQueryClauseGroup({
|
|
18
|
+
condition,
|
|
19
|
+
path,
|
|
20
|
+
context,
|
|
21
|
+
actions,
|
|
22
|
+
root = false
|
|
23
|
+
}) {
|
|
24
|
+
const children = condition.conditions ?? [];
|
|
25
|
+
const set = (patch) => actions.update(path, (current) => profileWizardModel.applyPatch(current, patch));
|
|
26
|
+
const hasShould = children.some(
|
|
27
|
+
(child) => esQueryBuilderModel.normalizeOccur(child.occur) === "should"
|
|
28
|
+
);
|
|
29
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
"data-es-group": condition.op,
|
|
33
|
+
className: "rounded-md border border-dashed border-border px-2 py-2",
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
36
|
+
root ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Match" }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
37
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-28 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
|
+
select.Select,
|
|
39
|
+
{
|
|
40
|
+
"aria-label": "Clause",
|
|
41
|
+
value: esQueryBuilderModel.normalizeOccur(condition.occur),
|
|
42
|
+
options: esQueryOccur.occurOptions(context.vocabulary.occurs),
|
|
43
|
+
onChange: (event) => set({ occur: event.target.value })
|
|
44
|
+
}
|
|
45
|
+
) }),
|
|
46
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-32 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
select.Select,
|
|
48
|
+
{
|
|
49
|
+
"aria-label": "Group type",
|
|
50
|
+
value: condition.op,
|
|
51
|
+
options: esQueryGroupModel.groupOperatorOptions(context.vocabulary.catalog),
|
|
52
|
+
onChange: (event) => set({ op: event.target.value })
|
|
53
|
+
}
|
|
54
|
+
) })
|
|
55
|
+
] }),
|
|
56
|
+
condition.op === "nested" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
Combobox.Combobox,
|
|
58
|
+
{
|
|
59
|
+
ariaLabel: "Nested path",
|
|
60
|
+
className: "min-w-48 flex-1",
|
|
61
|
+
value: condition.path ?? "",
|
|
62
|
+
onChange: (next) => set({ path: next }),
|
|
63
|
+
options: nestedPathOptions(context.fields),
|
|
64
|
+
placeholder: "Nested path…",
|
|
65
|
+
allowCustomValue: true
|
|
66
|
+
}
|
|
67
|
+
) : null,
|
|
68
|
+
hasShould ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
+
InputField.InputField,
|
|
70
|
+
{
|
|
71
|
+
"aria-label": "Minimum should match",
|
|
72
|
+
className: "w-40",
|
|
73
|
+
placeholder: "min should match",
|
|
74
|
+
value: condition.minimumShouldMatch ?? "",
|
|
75
|
+
onChange: (next) => set({ minimumShouldMatch: next === "" ? void 0 : next })
|
|
76
|
+
}
|
|
77
|
+
) : null,
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-auto flex shrink-0 items-center gap-1", children: [
|
|
79
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
80
|
+
button.Button,
|
|
81
|
+
{
|
|
82
|
+
type: "button",
|
|
83
|
+
variant: "ghost",
|
|
84
|
+
size: "sm",
|
|
85
|
+
onClick: () => actions.insert(path, esQueryBuilderModel.emptyCondition()),
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsxRuntime.jsx(UiAdd.UiAdd, { className: "text-xs" }),
|
|
88
|
+
" Condition"
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
93
|
+
button.Button,
|
|
94
|
+
{
|
|
95
|
+
type: "button",
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
size: "sm",
|
|
98
|
+
onClick: () => actions.insert(path, esQueryBuilderModel.emptyGroup()),
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsx(UiAdd.UiAdd, { className: "text-xs" }),
|
|
101
|
+
" Group"
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
root ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
+
IconButton.IconButton,
|
|
107
|
+
{
|
|
108
|
+
icon: UiTrash.UiTrash,
|
|
109
|
+
label: "Remove group",
|
|
110
|
+
onClick: () => actions.remove(path)
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] })
|
|
114
|
+
] }),
|
|
115
|
+
children.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: "No conditions — every document matches." }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 flex flex-col gap-2", children: children.map(
|
|
116
|
+
(child, index) => esQueryGroupModel.isGroupOperator(context.vocabulary.catalog, child.op) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
117
|
+
EsQueryClauseGroup,
|
|
118
|
+
{
|
|
119
|
+
condition: child,
|
|
120
|
+
path: [...path, index],
|
|
121
|
+
context,
|
|
122
|
+
actions
|
|
123
|
+
},
|
|
124
|
+
index
|
|
125
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
126
|
+
esQueryConditionRow.EsQueryConditionRow,
|
|
127
|
+
{
|
|
128
|
+
condition: child,
|
|
129
|
+
path: [...path, index],
|
|
130
|
+
context,
|
|
131
|
+
actions
|
|
132
|
+
},
|
|
133
|
+
index
|
|
134
|
+
)
|
|
135
|
+
) })
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function nestedPathOptions(fields) {
|
|
141
|
+
return fields.filter((field) => esQueryOperators.fieldFamily(field) === "nested").map((field) => ({ value: field.name, label: field.name }));
|
|
142
|
+
}
|
|
143
|
+
exports.EsQueryClauseGroup = EsQueryClauseGroup;
|
|
144
|
+
//# sourceMappingURL=esQueryClauseGroup.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esQueryClauseGroup.cjs","sources":["../../src/profiles/esQueryClauseGroup.tsx"],"sourcesContent":["/**\n * A bool or nested group of conditions. A group renders itself for a child that\n * is also a group, so the tree nests to whatever depth the author builds; the\n * compiler places no bound on it either.\n */\n\nimport { Combobox } from \"../components/Combobox\";\nimport { IconButton } from \"../components/IconButton\";\nimport { InputField } from \"../components/InputField\";\nimport { Button } from \"../components/button\";\nimport { Select } from \"../components/select\";\nimport { UiAdd, UiTrash } from \"../icons\";\nimport { applyPatch, type Patch } from \"./profileWizardModel\";\nimport {\n emptyCondition,\n emptyGroup,\n normalizeOccur,\n type ConditionPath,\n type EsCondition\n} from \"./esQueryBuilderModel\";\nimport {\n EsQueryConditionRow,\n type EsQueryContext,\n type EsQueryTreeActions\n} from \"./esQueryConditionRow\";\nimport {\n fieldFamily,\n type EsFieldMapping\n} from \"./esQueryOperators\";\nimport { groupOperatorOptions, isGroupOperator } from \"./esQueryGroupModel\";\nimport { occurOptions } from \"./esQueryOccur\";\n\nexport function EsQueryClauseGroup({\n condition,\n path,\n context,\n actions,\n root = false\n}: {\n condition: EsCondition;\n path: ConditionPath;\n context: EsQueryContext;\n actions: EsQueryTreeActions;\n root?: boolean;\n}) {\n const children = condition.conditions ?? [];\n const set = (patch: Patch<EsCondition>) =>\n actions.update(path, (current) => applyPatch(current, patch));\n // A should clause alongside anything else matches one by default. Offering the\n // override only once a should exists keeps it out of the way until it means\n // something.\n const hasShould = children.some(\n (child) => normalizeOccur(child.occur) === \"should\",\n );\n\n return (\n <div\n data-es-group={condition.op}\n className=\"rounded-md border border-dashed border-border px-2 py-2\"\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n {root ? (\n <span className=\"text-xs font-medium text-muted-foreground\">Match</span>\n ) : (\n <>\n <span className=\"w-28 shrink-0\">\n <Select\n aria-label=\"Clause\"\n value={normalizeOccur(condition.occur)}\n options={occurOptions(context.vocabulary.occurs)}\n onChange={(event) => set({ occur: event.target.value as never })}\n />\n </span>\n <span className=\"w-32 shrink-0\">\n <Select\n aria-label=\"Group type\"\n value={condition.op}\n options={groupOperatorOptions(context.vocabulary.catalog)}\n onChange={(event) => set({ op: event.target.value })}\n />\n </span>\n </>\n )}\n {condition.op === \"nested\" ? (\n <Combobox\n ariaLabel=\"Nested path\"\n className=\"min-w-48 flex-1\"\n value={condition.path ?? \"\"}\n onChange={(next) => set({ path: next })}\n options={nestedPathOptions(context.fields)}\n placeholder=\"Nested path…\"\n allowCustomValue\n />\n ) : null}\n {hasShould ? (\n <InputField\n aria-label=\"Minimum should match\"\n className=\"w-40\"\n placeholder=\"min should match\"\n value={condition.minimumShouldMatch ?? \"\"}\n onChange={(next) =>\n set({ minimumShouldMatch: next === \"\" ? undefined : next })\n }\n />\n ) : null}\n <span className=\"ml-auto flex shrink-0 items-center gap-1\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => actions.insert(path, emptyCondition())}\n >\n <UiAdd className=\"text-xs\" /> Condition\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => actions.insert(path, emptyGroup())}\n >\n <UiAdd className=\"text-xs\" /> Group\n </Button>\n {root ? null : (\n <IconButton\n icon={UiTrash}\n label=\"Remove group\"\n onClick={() => actions.remove(path)}\n />\n )}\n </span>\n </div>\n {children.length === 0 ? (\n <p className=\"mt-2 text-xs text-muted-foreground\">\n No conditions — every document matches.\n </p>\n ) : (\n <div className=\"mt-2 flex flex-col gap-2\">\n {children.map((child, index) =>\n isGroupOperator(context.vocabulary.catalog, child.op) ? (\n <EsQueryClauseGroup\n key={index}\n condition={child}\n path={[...path, index]}\n context={context}\n actions={actions}\n />\n ) : (\n <EsQueryConditionRow\n key={index}\n condition={child}\n path={[...path, index]}\n context={context}\n actions={actions}\n />\n ),\n )}\n </div>\n )}\n </div>\n );\n}\n\nfunction nestedPathOptions(fields: EsFieldMapping[]) {\n return fields\n .filter((field) => fieldFamily(field) === \"nested\")\n .map((field) => ({ value: field.name, label: field.name }));\n}\n"],"names":["applyPatch","normalizeOccur","jsxs","Fragment","jsx","Select","occurOptions","groupOperatorOptions","Combobox","InputField","Button","emptyCondition","UiAdd","emptyGroup","IconButton","UiTrash","isGroupOperator","EsQueryConditionRow","fieldFamily"],"mappings":";;;;;;;;;;;;;;;;AAgCO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AACT,GAMG;AACD,QAAM,WAAW,UAAU,cAAc,CAAA;AACzC,QAAM,MAAM,CAAC,UACX,QAAQ,OAAO,MAAM,CAAC,YAA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AA;AAAA,UACpC,EAAA,CAEJ;AAAA,QAAA,GACF;AAAA,QACC,SAAS,WAAW,IACnBX,2BAAAA,IAAC,KAAA,EAAE,WAAU,sCAAqC,UAAA,0CAAA,CAElD,IAEAA,2BAAAA,IAAC,OAAA,EAAI,WAAU,4BACZ,UAAA,SAAS;AAAA,UAAI,CAAC,OAAO,UACpBY,kBAAAA,gBAAgB,QAAQ,WAAW,SAAS,MAAM,EAAE,IAClDZ,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cAEC,WAAW;AAAA,cACX,MAAM,CAAC,GAAG,MAAM,KAAK;AAAA,cACrB;AAAA,cACA;AAAA,YAAA;AAAA,YAJK;AAAA,UAAA,IAOPA,2BAAAA;AAAAA,YAACa,oBAAAA;AAAAA,YAAA;AAAA,cAEC,WAAW;AAAA,cACX,MAAM,CAAC,GAAG,MAAM,KAAK;AAAA,cACrB;AAAA,cACA;AAAA,YAAA;AAAA,YAJK;AAAA,UAAA;AAAA,QAKP,EAEJ,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;AAEA,SAAS,kBAAkB,QAA0B;AACnD,SAAO,OACJ,OAAO,CAAC,UAAUC,iBAAAA,YAAY,KAAK,MAAM,QAAQ,EACjD,IAAI,CAAC,WAAW,EAAE,OAAO,MAAM,MAAM,OAAO,MAAM,OAAO;AAC9D;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConditionPath, EsCondition } from './esQueryBuilderModel';
|
|
2
|
+
import { EsQueryContext, EsQueryTreeActions } from './esQueryConditionRow';
|
|
3
|
+
export declare function EsQueryClauseGroup({ condition, path, context, actions, root }: {
|
|
4
|
+
condition: EsCondition;
|
|
5
|
+
path: ConditionPath;
|
|
6
|
+
context: EsQueryContext;
|
|
7
|
+
actions: EsQueryTreeActions;
|
|
8
|
+
root?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=esQueryClauseGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esQueryClauseGroup.d.ts","sourceRoot":"","sources":["../../src/profiles/esQueryClauseGroup.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAQ/B,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,IAAI,EACJ,OAAO,EACP,OAAO,EACP,IAAY,EACb,EAAE;IACD,SAAS,EAAE,WAAW,CAAC;IACvB,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,2CAoHA"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Combobox } from "../components/Combobox.js";
|
|
3
|
+
import { IconButton } from "../components/IconButton.js";
|
|
4
|
+
import { InputField } from "../components/InputField.js";
|
|
5
|
+
import { Button } from "../components/button.js";
|
|
6
|
+
import { Select } from "../components/select.js";
|
|
7
|
+
import { applyPatch } from "./profileWizardModel.js";
|
|
8
|
+
import { normalizeOccur, emptyCondition, emptyGroup } from "./esQueryBuilderModel.js";
|
|
9
|
+
import { EsQueryConditionRow } from "./esQueryConditionRow.js";
|
|
10
|
+
import { fieldFamily } from "./esQueryOperators.js";
|
|
11
|
+
import { groupOperatorOptions, isGroupOperator } from "./esQueryGroupModel.js";
|
|
12
|
+
import { occurOptions } from "./esQueryOccur.js";
|
|
13
|
+
import { UiAdd } from "../icons/components/UiAdd.js";
|
|
14
|
+
import { UiTrash } from "../icons/components/UiTrash.js";
|
|
15
|
+
function EsQueryClauseGroup({
|
|
16
|
+
condition,
|
|
17
|
+
path,
|
|
18
|
+
context,
|
|
19
|
+
actions,
|
|
20
|
+
root = false
|
|
21
|
+
}) {
|
|
22
|
+
const children = condition.conditions ?? [];
|
|
23
|
+
const set = (patch) => actions.update(path, (current) => applyPatch(current, patch));
|
|
24
|
+
const hasShould = children.some(
|
|
25
|
+
(child) => normalizeOccur(child.occur) === "should"
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ jsxs(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
"data-es-group": condition.op,
|
|
31
|
+
className: "rounded-md border border-dashed border-border px-2 py-2",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
34
|
+
root ? /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Match" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
+
/* @__PURE__ */ jsx("span", { className: "w-28 shrink-0", children: /* @__PURE__ */ jsx(
|
|
36
|
+
Select,
|
|
37
|
+
{
|
|
38
|
+
"aria-label": "Clause",
|
|
39
|
+
value: normalizeOccur(condition.occur),
|
|
40
|
+
options: occurOptions(context.vocabulary.occurs),
|
|
41
|
+
onChange: (event) => set({ occur: event.target.value })
|
|
42
|
+
}
|
|
43
|
+
) }),
|
|
44
|
+
/* @__PURE__ */ jsx("span", { className: "w-32 shrink-0", children: /* @__PURE__ */ jsx(
|
|
45
|
+
Select,
|
|
46
|
+
{
|
|
47
|
+
"aria-label": "Group type",
|
|
48
|
+
value: condition.op,
|
|
49
|
+
options: groupOperatorOptions(context.vocabulary.catalog),
|
|
50
|
+
onChange: (event) => set({ op: event.target.value })
|
|
51
|
+
}
|
|
52
|
+
) })
|
|
53
|
+
] }),
|
|
54
|
+
condition.op === "nested" ? /* @__PURE__ */ jsx(
|
|
55
|
+
Combobox,
|
|
56
|
+
{
|
|
57
|
+
ariaLabel: "Nested path",
|
|
58
|
+
className: "min-w-48 flex-1",
|
|
59
|
+
value: condition.path ?? "",
|
|
60
|
+
onChange: (next) => set({ path: next }),
|
|
61
|
+
options: nestedPathOptions(context.fields),
|
|
62
|
+
placeholder: "Nested path…",
|
|
63
|
+
allowCustomValue: true
|
|
64
|
+
}
|
|
65
|
+
) : null,
|
|
66
|
+
hasShould ? /* @__PURE__ */ jsx(
|
|
67
|
+
InputField,
|
|
68
|
+
{
|
|
69
|
+
"aria-label": "Minimum should match",
|
|
70
|
+
className: "w-40",
|
|
71
|
+
placeholder: "min should match",
|
|
72
|
+
value: condition.minimumShouldMatch ?? "",
|
|
73
|
+
onChange: (next) => set({ minimumShouldMatch: next === "" ? void 0 : next })
|
|
74
|
+
}
|
|
75
|
+
) : null,
|
|
76
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-auto flex shrink-0 items-center gap-1", children: [
|
|
77
|
+
/* @__PURE__ */ jsxs(
|
|
78
|
+
Button,
|
|
79
|
+
{
|
|
80
|
+
type: "button",
|
|
81
|
+
variant: "ghost",
|
|
82
|
+
size: "sm",
|
|
83
|
+
onClick: () => actions.insert(path, emptyCondition()),
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsx(UiAdd, { className: "text-xs" }),
|
|
86
|
+
" Condition"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsxs(
|
|
91
|
+
Button,
|
|
92
|
+
{
|
|
93
|
+
type: "button",
|
|
94
|
+
variant: "ghost",
|
|
95
|
+
size: "sm",
|
|
96
|
+
onClick: () => actions.insert(path, emptyGroup()),
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ jsx(UiAdd, { className: "text-xs" }),
|
|
99
|
+
" Group"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
root ? null : /* @__PURE__ */ jsx(
|
|
104
|
+
IconButton,
|
|
105
|
+
{
|
|
106
|
+
icon: UiTrash,
|
|
107
|
+
label: "Remove group",
|
|
108
|
+
onClick: () => actions.remove(path)
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] })
|
|
112
|
+
] }),
|
|
113
|
+
children.length === 0 ? /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: "No conditions — every document matches." }) : /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-col gap-2", children: children.map(
|
|
114
|
+
(child, index) => isGroupOperator(context.vocabulary.catalog, child.op) ? /* @__PURE__ */ jsx(
|
|
115
|
+
EsQueryClauseGroup,
|
|
116
|
+
{
|
|
117
|
+
condition: child,
|
|
118
|
+
path: [...path, index],
|
|
119
|
+
context,
|
|
120
|
+
actions
|
|
121
|
+
},
|
|
122
|
+
index
|
|
123
|
+
) : /* @__PURE__ */ jsx(
|
|
124
|
+
EsQueryConditionRow,
|
|
125
|
+
{
|
|
126
|
+
condition: child,
|
|
127
|
+
path: [...path, index],
|
|
128
|
+
context,
|
|
129
|
+
actions
|
|
130
|
+
},
|
|
131
|
+
index
|
|
132
|
+
)
|
|
133
|
+
) })
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
function nestedPathOptions(fields) {
|
|
139
|
+
return fields.filter((field) => fieldFamily(field) === "nested").map((field) => ({ value: field.name, label: field.name }));
|
|
140
|
+
}
|
|
141
|
+
export {
|
|
142
|
+
EsQueryClauseGroup
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=esQueryClauseGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esQueryClauseGroup.js","sources":["../../src/profiles/esQueryClauseGroup.tsx"],"sourcesContent":["/**\n * A bool or nested group of conditions. A group renders itself for a child that\n * is also a group, so the tree nests to whatever depth the author builds; the\n * compiler places no bound on it either.\n */\n\nimport { Combobox } from \"../components/Combobox\";\nimport { IconButton } from \"../components/IconButton\";\nimport { InputField } from \"../components/InputField\";\nimport { Button } from \"../components/button\";\nimport { Select } from \"../components/select\";\nimport { UiAdd, UiTrash } from \"../icons\";\nimport { applyPatch, type Patch } from \"./profileWizardModel\";\nimport {\n emptyCondition,\n emptyGroup,\n normalizeOccur,\n type ConditionPath,\n type EsCondition\n} from \"./esQueryBuilderModel\";\nimport {\n EsQueryConditionRow,\n type EsQueryContext,\n type EsQueryTreeActions\n} from \"./esQueryConditionRow\";\nimport {\n fieldFamily,\n type EsFieldMapping\n} from \"./esQueryOperators\";\nimport { groupOperatorOptions, isGroupOperator } from \"./esQueryGroupModel\";\nimport { occurOptions } from \"./esQueryOccur\";\n\nexport function EsQueryClauseGroup({\n condition,\n path,\n context,\n actions,\n root = false\n}: {\n condition: EsCondition;\n path: ConditionPath;\n context: EsQueryContext;\n actions: EsQueryTreeActions;\n root?: boolean;\n}) {\n const children = condition.conditions ?? [];\n const set = (patch: Patch<EsCondition>) =>\n actions.update(path, (current) => applyPatch(current, patch));\n // A should clause alongside anything else matches one by default. Offering the\n // override only once a should exists keeps it out of the way until it means\n // something.\n const hasShould = children.some(\n (child) => normalizeOccur(child.occur) === \"should\",\n );\n\n return (\n <div\n data-es-group={condition.op}\n className=\"rounded-md border border-dashed border-border px-2 py-2\"\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n {root ? (\n <span className=\"text-xs font-medium text-muted-foreground\">Match</span>\n ) : (\n <>\n <span className=\"w-28 shrink-0\">\n <Select\n aria-label=\"Clause\"\n value={normalizeOccur(condition.occur)}\n options={occurOptions(context.vocabulary.occurs)}\n onChange={(event) => set({ occur: event.target.value as never })}\n />\n </span>\n <span className=\"w-32 shrink-0\">\n <Select\n aria-label=\"Group type\"\n value={condition.op}\n options={groupOperatorOptions(context.vocabulary.catalog)}\n onChange={(event) => set({ op: event.target.value })}\n />\n </span>\n </>\n )}\n {condition.op === \"nested\" ? (\n <Combobox\n ariaLabel=\"Nested path\"\n className=\"min-w-48 flex-1\"\n value={condition.path ?? \"\"}\n onChange={(next) => set({ path: next })}\n options={nestedPathOptions(context.fields)}\n placeholder=\"Nested path…\"\n allowCustomValue\n />\n ) : null}\n {hasShould ? (\n <InputField\n aria-label=\"Minimum should match\"\n className=\"w-40\"\n placeholder=\"min should match\"\n value={condition.minimumShouldMatch ?? \"\"}\n onChange={(next) =>\n set({ minimumShouldMatch: next === \"\" ? undefined : next })\n }\n />\n ) : null}\n <span className=\"ml-auto flex shrink-0 items-center gap-1\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => actions.insert(path, emptyCondition())}\n >\n <UiAdd className=\"text-xs\" /> Condition\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => actions.insert(path, emptyGroup())}\n >\n <UiAdd className=\"text-xs\" /> Group\n </Button>\n {root ? null : (\n <IconButton\n icon={UiTrash}\n label=\"Remove group\"\n onClick={() => actions.remove(path)}\n />\n )}\n </span>\n </div>\n {children.length === 0 ? (\n <p className=\"mt-2 text-xs text-muted-foreground\">\n No conditions — every document matches.\n </p>\n ) : (\n <div className=\"mt-2 flex flex-col gap-2\">\n {children.map((child, index) =>\n isGroupOperator(context.vocabulary.catalog, child.op) ? (\n <EsQueryClauseGroup\n key={index}\n condition={child}\n path={[...path, index]}\n context={context}\n actions={actions}\n />\n ) : (\n <EsQueryConditionRow\n key={index}\n condition={child}\n path={[...path, index]}\n context={context}\n actions={actions}\n />\n ),\n )}\n </div>\n )}\n </div>\n );\n}\n\nfunction nestedPathOptions(fields: EsFieldMapping[]) {\n return fields\n .filter((field) => fieldFamily(field) === \"nested\")\n .map((field) => ({ value: field.name, label: field.name }));\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAgCO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AACT,GAMG;AACD,QAAM,WAAW,UAAU,cAAc,CAAA;AACzC,QAAM,MAAM,CAAC,UACX,QAAQ,OAAO,MAAM,CAAC,YAAY,WAAW,SAAS,KAAK,CAAC;AAI9D,QAAM,YAAY,SAAS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