@splunk/dynamic-editors 0.42.0 → 0.42.2

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +28 -94
  2. package/DynamicEditor.js +70 -69
  3. package/DynamicEditor.js.map +1 -1
  4. package/containers/EditorItem.js +73 -72
  5. package/containers/EditorItem.js.map +1 -1
  6. package/containers/EditorLayout.js +81 -80
  7. package/containers/EditorLayout.js.map +1 -1
  8. package/containers/EditorLayoutItem.js +55 -54
  9. package/containers/EditorLayoutItem.js.map +1 -1
  10. package/editors/AdvancedConfigCard.js.map +1 -1
  11. package/editors/ArrayOfStringsEditor.js +4 -4
  12. package/editors/ArrayOfStringsEditor.js.map +1 -1
  13. package/editors/CheckboxEditor.js.map +1 -1
  14. package/editors/ColorEditor.js.map +1 -1
  15. package/editors/ColumnMultiSelectionByFieldNameEditor.js.map +1 -1
  16. package/editors/ColumnMultiSelectionEditor.js +4 -4
  17. package/editors/ColumnMultiSelectionEditor.js.map +1 -1
  18. package/editors/ColumnSelectionEditor.js +4 -4
  19. package/editors/ColumnSelectionEditor.js.map +1 -1
  20. package/editors/CustomizedInSourceEditor.js +4 -4
  21. package/editors/CustomizedInSourceEditor.js.map +1 -1
  22. package/editors/DynamicColorEditor.js +40 -40
  23. package/editors/DynamicColorEditor.js.map +1 -1
  24. package/editors/DynamicColorEditorWithPrecedence.js +24 -24
  25. package/editors/DynamicColorEditorWithPrecedence.js.map +1 -1
  26. package/editors/DynamicItemEditor.js +4 -4
  27. package/editors/DynamicItemEditor.js.map +1 -1
  28. package/editors/ImageEditor.js.map +1 -1
  29. package/editors/MultiColorPickerEditor.js +1 -0
  30. package/editors/MultiColorPickerEditor.js.map +1 -1
  31. package/editors/NetworkGraphDynamicColorEditor.js +39 -39
  32. package/editors/NetworkGraphDynamicColorEditor.js.map +1 -1
  33. package/editors/NumberEditor.js.map +1 -1
  34. package/editors/PercentEditor.js.map +1 -1
  35. package/editors/PresetSelectorEditor.js +1 -1
  36. package/editors/PresetSelectorEditor.js.map +1 -1
  37. package/editors/RadioBarEditor.js.map +1 -1
  38. package/editors/SelectEditor.js.map +1 -1
  39. package/editors/SeriesColorsByFieldEditor.js +1 -0
  40. package/editors/SeriesColorsByFieldEditor.js.map +1 -1
  41. package/editors/SeriesColorsEditor.js +13 -12
  42. package/editors/SeriesColorsEditor.js.map +1 -1
  43. package/editors/SliderEditor.js +3 -3
  44. package/editors/SliderEditor.js.map +1 -1
  45. package/editors/StaticItemEditor.js.map +1 -1
  46. package/editors/TableColumnFormatterEditor.js +53 -52
  47. package/editors/TableColumnFormatterEditor.js.map +1 -1
  48. package/editors/TableDynamicColorEditor.js +24 -24
  49. package/editors/TableDynamicColorEditor.js.map +1 -1
  50. package/editors/TextAreaEditor.js.map +1 -1
  51. package/editors/TextEditor.js.map +1 -1
  52. package/editors/ThresholdEditor.js.map +1 -1
  53. package/editors/ToggleEditor.js.map +1 -1
  54. package/package.json +2 -2
  55. package/shared/AdvancedControlGroup.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnSelectionEditor.js","mappings":";;;;01BAAA,mBACA,WACA,aACA,UACA,UAEA,UAEA,UACA,UACA,aACA,UACA,UASMA,EAAS,+BACR,EAAAC,qBAAmB,CACtBC,cAAeC,EAAEC,OAAOC,WACxBC,aAAcH,EAAEI,KAChBC,cAAeL,EAAEM,QAAQN,EAAEC,QAC3BM,QAASP,EAAEC,OACXO,sBAAuBR,EAAES,OAEhB,EAAAC,sBAA6E,EACtFC,OACAC,QACAC,QAAQ,GACRC,gBAAgB,MAChBf,gBAAgB,UAChBgB,qBACAZ,eAAe,CAACa,GAAyDA,GACzEC,WACAC,aACAC,aACAd,gBACAE,UACAC,yBAAwB,MAExB,MAAMY,GAAa,IAAAC,eAAc,CAAEN,qBAAoBhB,mBACjD,QAAEuB,EAAO,OAAEC,IAAWH,aAAU,EAAVA,EAAYI,OAAQ,CAAEF,QAAS,G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orFooterMessage.tsx","webpack://@splunk/dynamic-editors/./src/hooks/useDataSource.tsx","webpack://@splunk/dynamic-editors/./src/interfaces/BaseEditorProps.ts","webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/./src/shared/ColumnSelectorFooterMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/dimensionConstants.ts","webpack://@splunk/dynamic-editors/./src/utils/columnSelectionUtils.ts","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Select\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/format\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/DataSourceContext\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/utils/dsl\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/utils/types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/dataSourceUtils\"","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/startup"],"sourcesContent":["import React, { useState, useCallback } from 'react';\nimport * as T from 'prop-types';\nimport Select from '@splunk/react-ui/Select';\nimport { getFieldsFromDSL } from '@splunk/visualization-encoding/utils/dsl';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport { DataType } from '@splunk/visualization-encoding/DataPrimitive';\nimport { BaseEditorPropTypes } from '../interfaces/BaseEditorProps';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useDataSource } from '../hooks/useDataSource';\nimport { getAvailableFieldsWithTypes, getPlaceholderMessage } from '../utils/columnSelectionUtils';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport { useColumnSelectorFooterMessage } from './useColumnSelectorFooterMessage';\n\ninterface ColumnSelectionEditorProps extends BaseEditorProps {\n dataSourceKey: string;\n prepareValue?: (id: Record<string, any>) => Record<string, any>;\n filterByTypes?: DataType[];\n tooltip?: string;\n hideEditorWhenLoading?: boolean;\n}\nconst propTypes: Record<keyof ColumnSelectionEditorProps, T.Validator<any>> = {\n ...BaseEditorPropTypes,\n dataSourceKey: T.string.isRequired,\n prepareValue: T.func,\n filterByTypes: T.arrayOf(T.string),\n tooltip: T.string,\n hideEditorWhenLoading: T.bool,\n};\nexport const ColumnSelectionEditor: React.FunctionComponent<ColumnSelectionEditorProps> = ({\n name,\n value,\n label = '',\n labelPosition = 'top',\n dataSourceKey = 'primary',\n dataSourceBindings,\n prepareValue = (id: Record<string, unknown>): Record<string, unknown> => id,\n onChange,\n isAdvanced,\n isDisabled,\n filterByTypes,\n tooltip,\n hideEditorWhenLoading = false,\n}) => {\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey });\n const { columns, fields } = dataSource?.data || { columns: [], fields: [] };\n const availableFieldsWithTypes = getAvailableFieldsWithTypes(columns, fields);\n // return `value` if `value` is undefined or null so editor shows placeholder message\n const fieldName =\n value == null\n ? value\n : getFieldsFromDSL(value, {\n [dataSourceKey]: dataSource,\n })[0] || '';\n const [selectedField, setSelectedField] = useState(fieldName);\n React.useEffect((): void => {\n setSelectedField(fieldName);\n }, [fieldName]);\n const [filter, setFilter] = useState('');\n const filteredFields = availableFieldsWithTypes.filter(\n (field): boolean => field.name.indexOf(filter) !== -1\n );\n const footerMessage = useColumnSelectorFooterMessage({\n availableFields: availableFieldsWithTypes,\n selectedFields: [selectedField],\n filteredFields,\n filter,\n });\n\n const handleValueChange = useCallback(\n (event, { value: selectedValue }): void => {\n setSelectedField(selectedValue);\n const update = prepareValue({\n options: {\n [name]: `> ${dataSourceKey} | seriesByName('${selectedValue}')`,\n },\n });\n onChange(event, update);\n },\n [dataSourceKey, name, onChange, prepareValue]\n );\n\n const handleFilterChange = useCallback((e, { keyword }): void => {\n setFilter(keyword);\n }, []);\n const { hasError, isMissing, isLoading } = getDataSourceStateInfo(dataSource);\n const disabled = isMissing || hasError || isDisabled;\n const placeholderMessage = getPlaceholderMessage({ isMissing, isLoading, hasError });\n const shouldRenderEditor = hideEditorWhenLoading ? !!selectedField : true;\n\n return (\n shouldRenderEditor && (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n tooltip={tooltip}\n isAdvanced={isAdvanced}\n >\n <Select\n data-test=\"ColumnSelectionEditor\"\n value={selectedField}\n onFilterChange={handleFilterChange}\n onChange={handleValueChange}\n footerMessage={footerMessage}\n disabled={disabled}\n placeholder={placeholderMessage}\n isLoadingOptions={isLoading}\n error={hasError}\n style={editorStyle}\n filter\n >\n {filteredFields.map(field => (\n <Select.Option\n key={field.name}\n label={`${field.name} (${field.type})`}\n value={field.name}\n disabled={!!filterByTypes?.length && !filterByTypes.find(f => f === field.type)}\n />\n ))}\n </Select>\n </ControlGroup>\n )\n );\n};\nColumnSelectionEditor.propTypes = propTypes;\n\nexport default ColumnSelectionEditor;\n","import React, { useMemo } from 'react';\nimport { ColumnSelectorFooterMessage } from '../shared/ColumnSelectorFooterMessage';\nimport type { FieldTuple } from '../utils/columnSelectionUtils';\n\ntype ObjectWithName = {\n name: string;\n [key: string]: string;\n};\n\ntype Fields = FieldTuple[] | ObjectWithName[];\n\ninterface FooterMessageProps {\n noSelectedFieldsInfo?: boolean;\n filter: string;\n availableFields: Fields;\n selectedFields?: string[];\n filteredFields: Fields;\n}\n\nexport const useColumnSelectorFooterMessage = ({\n filter,\n availableFields,\n selectedFields,\n filteredFields,\n noSelectedFieldsInfo = false,\n}: FooterMessageProps) => {\n const selectedFilteredFields = useMemo(() => {\n if (!selectedFields || !filteredFields) return [];\n\n const validSelectedFields = new Set(\n selectedFields.filter(field => field !== '' && field !== undefined)\n );\n\n return filteredFields.filter(item => validSelectedFields.has(item.name));\n }, [selectedFields, filteredFields]);\n\n // make sure to display only 'No matches' text when there is no result of filtering\n if (filter && !filteredFields.length) {\n return null;\n }\n\n return (\n <ColumnSelectorFooterMessage\n noSelectedFieldsInfo={noSelectedFieldsInfo}\n numSelected={selectedFilteredFields?.length} // if no filter is applied filteredFields equal availableFields\n numFiltered={filteredFields.length}\n numAvailable={availableFields.length}\n filter={filter}\n />\n );\n};\n","import { useState, useEffect, useContext } from 'react';\nimport DataSourceContext, {\n type BindingsSnapshot,\n type DataSourceApi,\n} from '@splunk/visualization-context/DataSourceContext';\nimport { get, isFunction } from 'lodash';\n\ninterface UseDataSourceParams {\n dataSourceBindings: BindingsSnapshot;\n dataSourceKey: string;\n}\n// @TODO(pwied): use DataSource interface in return type (w/o dependency on @splunk/visualizations)\nexport const useDataSource = ({\n dataSourceBindings,\n dataSourceKey,\n}: UseDataSourceParams): BindingsSnapshot => {\n const dataSourceApi = useContext<DataSourceApi>(DataSourceContext);\n const [dataSource, setDataSource] = useState<BindingsSnapshot>();\n useEffect((): (() => void) => {\n if (!get(dataSourceBindings, dataSourceKey)) {\n setDataSource(null);\n return () => undefined;\n }\n const unsubscribe =\n isFunction(dataSourceApi.subscribe) &&\n dataSourceApi.subscribe(dataSourceKey, (snapshot): void => setDataSource(snapshot));\n return () => {\n if (unsubscribe) {\n unsubscribe();\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dataSourceBindings]);\n return dataSource;\n};\n","import * as T from 'prop-types';\nimport type { JSONSchema7 } from 'json-schema';\n\nexport interface BaseEditorProps {\n name: string;\n value: any;\n onChange?: (...args: any[]) => void;\n label?: string; // @TODO(pwied): this should not live in editor props\n labelPosition?: 'top' | 'left'; // ^^^\n context?: Record<string, any>;\n labelWidth?: number;\n isAdvanced?: boolean;\n isDisabled?: boolean;\n dataSourceBindings?: Record<string, any>;\n options?: { [k: string]: any };\n optionsSchema?: {\n [key: string]: JSONSchema7;\n };\n}\n\nexport const BaseEditorPropTypes: Record<keyof BaseEditorProps, T.Validator<any>> = {\n name: T.string.isRequired,\n value: T.oneOfType([T.string, T.object, T.arrayOf(T.string)]),\n context: T.object,\n label: T.string,\n labelPosition: T.oneOf(['top', 'left']),\n labelWidth: T.number,\n onChange: T.func,\n isAdvanced: T.bool,\n isDisabled: T.bool,\n dataSourceBindings: T.object,\n options: T.object,\n optionsSchema: T.object,\n};\n","import React, { Children, cloneElement } from 'react';\nimport type { ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport Button, { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport SUIControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","import * as React from 'react';\nimport { sprintf } from '@splunk/ui-utils/format';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { useMemo } from 'react';\n\ninterface FooterProps {\n filter: string;\n numSelected?: number;\n numFiltered: number;\n numAvailable: number;\n noSelectedFieldsInfo?: boolean; // it is needed for AddColumn component which has different logic than other selection editors\n}\n\nexport const ColumnSelectorFooterMessage = ({\n numSelected,\n numFiltered,\n numAvailable,\n filter,\n noSelectedFieldsInfo,\n}: FooterProps) => {\n const footerMessageText = useMemo(() => {\n if (filter) {\n if (noSelectedFieldsInfo) {\n return sprintf(_('%(filtered)d filtered from %(available)d fields'), {\n filtered: numFiltered,\n available: numAvailable,\n });\n }\n return sprintf(_('%(selected)d selected from %(filtered)d filtered'), {\n selected: numSelected,\n filtered: numFiltered,\n });\n }\n return noSelectedFieldsInfo\n ? sprintf(_('%(shown)d of %(available)d fields'), {\n shown: numFiltered,\n available: numAvailable,\n })\n : sprintf(_('%(selected)d selected from %(available)d'), {\n selected: numSelected,\n available: numAvailable,\n });\n }, [filter, noSelectedFieldsInfo, numFiltered, numAvailable, numSelected]);\n\n return (\n <span data-test=\"footer-message\" aria-live=\"polite\" aria-atomic=\"true\">\n {footerMessageText}\n </span>\n );\n};\n","export const FLYOUT_PADDING = 21;\nexport const COLUMN_FLYOUT_PADDING = 16;\nexport const FLYOUT_WIDTH = 344;\n\nexport const VERTICAL_EDITOR_SPACING = 16;\n\nexport const DROPDOWN_MENU_WIDTH = 327;\n\nexport const editorStyle = { width: '100%' };\n","import { _ } from '@splunk/ui-utils/i18n';\nimport {\n inferDataTypeFromData,\n canInferTypeFromMeta,\n getDataTypeForMeta,\n} from '@splunk/visualization-encoding/utils/types';\n\nexport interface FieldTuple {\n name: string;\n type: string;\n}\n\nexport const getAvailableFieldsWithTypes = (\n columns: unknown[][],\n fields: { name: string; type?: string }[]\n): FieldTuple[] => {\n const fieldsWithType = fields.map((field, index) => {\n const { name } = field;\n const inferredType = canInferTypeFromMeta(field)\n ? getDataTypeForMeta(field)\n : inferDataTypeFromData(columns[index]);\n return {\n name,\n type: inferredType,\n };\n });\n return fieldsWithType;\n};\n\nexport const getFilteredFields = (availableFieldsWithTypes: FieldTuple[], filter: string): FieldTuple[] => {\n return availableFieldsWithTypes.filter((field): boolean => field.name.indexOf(filter) !== -1);\n};\n\nexport const sanitizeFieldNames = (value: unknown, fieldNames: string[]): string[] => {\n if (typeof value === 'string' && fieldNames.includes(value)) {\n return [value];\n }\n if (Array.isArray(value)) {\n return value.filter(name => fieldNames.includes(name));\n }\n return [];\n};\n\nexport const getPlaceholderMessage = ({\n hasError,\n isLoading,\n isMissing,\n defaultMessage = 'Select a field from data source',\n}: {\n hasError: boolean;\n isLoading: boolean;\n isMissing: boolean;\n defaultMessage?: string;\n}): string => {\n if (isMissing) {\n return _('Set up data source to select');\n }\n if (hasError) {\n return _('Please set up valid data source to select');\n }\n if (isLoading) {\n return _('Loading data source...');\n }\n return _(defaultMessage);\n};\n","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Select\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/format\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-context/DataSourceContext\");","module.exports = require(\"@splunk/visualization-encoding/utils/dsl\");","module.exports = require(\"@splunk/visualization-encoding/utils/types\");","module.exports = require(\"@splunk/visualizations-shared/dataSourceUtils\");","module.exports = require(\"lodash\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(5731);\n"],"names":["propTypes","BaseEditorPropTypes","dataSourceKey","T","string","isRequired","prepareValue","func","filterByTypes","arrayOf","tooltip","hideEditorWhenLoading","bool","ColumnSelectionEditor","name","value","label","labelPosition","dataSourceBindings","id","onChange","isAdvanced","isDisabled","dataSource","useDataSource","columns","fields","data","availableFieldsWithTypes","getAvailableFieldsWithTypes","fieldName","getFieldsFromDSL","selectedField","setSelectedField","useState","useEffect","filter","setFilter","filteredFields","field","indexOf","footerMessage","useColumnSelectorFooterMessage","availableFields","selectedFields","handleValueChange","useCallback","event","selectedValue","update","options","handleFilterChange","e","keyword","hasError","isMissing","isLoading","getDataSourceStateInfo","disabled","placeholderMessage","getPlaceholderMessage","onFilterChange","placeholder","isLoadingOptions","error","style","editorStyle","map","Option","key","type","length","find","f","noSelectedFieldsInfo","selectedFilteredFields","useMemo","validSelectedFields","Set","undefined","item","has","ColumnSelectorFooterMessage","numSelected","numFiltered","numAvailable","dataSourceApi","useContext","setDataSource","get","unsubscribe","isFunction","subscribe","snapshot","oneOfType","object","context","oneOf","labelWidth","number","optionsSchema","ControlGroupContainer","variables","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","onClick","content","_","icon","appearance","AdvancedControlGroup","dataTest","children","hideLabel","help","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","Boolean","child","cloneElement","flex","footerMessageText","sprintf","filtered","available","selected","shown","FLYOUT_PADDING","COLUMN_FLYOUT_PADDING","FLYOUT_WIDTH","VERTICAL_EDITOR_SPACING","DROPDOWN_MENU_WIDTH","width","index","canInferTypeFromMeta","getDataTypeForMeta","inferDataTypeFromData","getFilteredFields","sanitizeFieldNames","fieldNames","includes","Array","isArray","defaultMessage","module","exports","require","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","call"],"sourceRoot":""}
1
+ {"version":3,"file":"ColumnSelectionEditor.js","mappings":";;;;01BAAA,mBACA,aACA,UACA,UAGA,UACA,UACA,aACA,UACA,UAWa,EAAAA,sBAA6E,EACtFC,OACAC,QACAC,QAAQ,GACRC,gBAAgB,MAChBC,gBAAgB,UAChBC,qBACAC,eAAe,CAACC,GAAmDA,GACnEC,WACAC,aACAC,aACAC,gBACAC,UACAC,yBAAwB,MAExB,MAAMC,GAAa,IAAAC,eAAc,CAAEV,qBAAoBD,mBACjD,QAAEY,EAAO,OAAEC,IAAWH,aAAU,EAAVA,EAAYI,OAAQ,CAAEF,QAAS,GAAIC,OAAQ,IACjEE,GAA2B,IAAAC,6BAA4BJ,EAASC,GAEhEI,EACO,MAATpB,EACMA,GACA,IAAAqB,kBAAiBrB,EAAO,CACpB,CAACG,GAAgBU,IAClB,IAAM,IACZS,EAAeC,IAAoB,IAAAC,UAASJ,GACnD,UAAMK,WAAU,KACZF,EAAiBH,EAAU,GAC5B,CAACA,IACJ,MAAOM,EAAQC,IAAa,IAAAH,UAAS,IAC/BI,EAAiBV,EAAyBQ,QAC3CG,IAAmD,IAAhCA,EAAM9B,KAAK+B,QAAQJ,KAErCK,GAAgB,IAAAC,gCAA+B,CACjDC,gBAAiBf,EACjBgB,eAAgB,CAACZ,GACjBM,iBACAF,WAGES,GAAoB,IAAAC,cACtB,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SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqB5E,IAAjB6E,EACH,OAAOA,EAAaN,QAGrB,IAAID,EAASG,EAAyBG,GAAY,CAGjDL,QAAS,CAAC,GAOX,OAHAO,EAAoBF,GAAUG,KAAKT,EAAOC,QAASD,EAAQA,EAAOC,QAASI,GAGpEL,EAAOC,OACf,CCnB0BI,CAAoB,M","sources":["webpack://@splunk/dynamic-editors/./src/editors/ColumnSelectionEditor.tsx","webpack://@splunk/dynamic-editors/./src/editors/useColumnSelectorFooterMessage.tsx","webpack://@splunk/dynamic-editors/./src/hooks/useDataSource.tsx","webpack://@splunk/dynamic-editors/./src/shared/AdvancedControlGroup.tsx","webpack://@splunk/dynamic-editors/./src/shared/ColumnSelectorFooterMessage.tsx","webpack://@splunk/dynamic-editors/./src/shared/dimensionConstants.ts","webpack://@splunk/dynamic-editors/./src/utils/columnSelectionUtils.ts","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-icons/SlidersDoubleHorizontal\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Select\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Tooltip\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/format\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-context/DataSourceContext\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/utils/dsl\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualization-encoding/utils/types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/visualizations-shared/dataSourceUtils\"","webpack://@splunk/dynamic-editors/external commonjs2 \"lodash\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/startup"],"sourcesContent":["import React, { useState, useCallback } from 'react';\nimport Select from '@splunk/react-ui/Select';\nimport { getFieldsFromDSL } from '@splunk/visualization-encoding/utils/dsl';\nimport { getDataSourceStateInfo } from '@splunk/visualizations-shared/dataSourceUtils';\nimport type { DataType } from '@splunk/visualization-encoding/DataPrimitive';\nimport type { BaseEditorProps } from '../interfaces/BaseEditorProps';\nimport { useDataSource } from '../hooks/useDataSource';\nimport { getAvailableFieldsWithTypes, getPlaceholderMessage } from '../utils/columnSelectionUtils';\nimport ControlGroup from '../shared/AdvancedControlGroup';\nimport { editorStyle } from '../shared/dimensionConstants';\nimport { useColumnSelectorFooterMessage } from './useColumnSelectorFooterMessage';\nimport type { DynamicOptionsConfig } from '../types';\n\ninterface ColumnSelectionEditorProps extends BaseEditorProps {\n dataSourceKey: string;\n prepareValue?: (id: DynamicOptionsConfig) => DynamicOptionsConfig;\n filterByTypes?: DataType[];\n tooltip?: string;\n hideEditorWhenLoading?: boolean;\n}\n\nexport const ColumnSelectionEditor: React.FunctionComponent<ColumnSelectionEditorProps> = ({\n name,\n value,\n label = '',\n labelPosition = 'top',\n dataSourceKey = 'primary',\n dataSourceBindings,\n prepareValue = (id: DynamicOptionsConfig): DynamicOptionsConfig => id,\n onChange,\n isAdvanced,\n isDisabled,\n filterByTypes,\n tooltip,\n hideEditorWhenLoading = false,\n}) => {\n const dataSource = useDataSource({ dataSourceBindings, dataSourceKey });\n const { columns, fields } = dataSource?.data || { columns: [], fields: [] };\n const availableFieldsWithTypes = getAvailableFieldsWithTypes(columns, fields);\n // return `value` if `value` is undefined or null so editor shows placeholder message\n const fieldName =\n value == null\n ? value\n : getFieldsFromDSL(value, {\n [dataSourceKey]: dataSource,\n })[0] || '';\n const [selectedField, setSelectedField] = useState(fieldName);\n React.useEffect((): void => {\n setSelectedField(fieldName);\n }, [fieldName]);\n const [filter, setFilter] = useState('');\n const filteredFields = availableFieldsWithTypes.filter(\n (field): boolean => field.name.indexOf(filter) !== -1\n );\n const footerMessage = useColumnSelectorFooterMessage({\n availableFields: availableFieldsWithTypes,\n selectedFields: [selectedField],\n filteredFields,\n filter,\n });\n\n const handleValueChange = useCallback(\n (event, { value: selectedValue }): void => {\n setSelectedField(selectedValue);\n const update = prepareValue({\n options: {\n [name]: `> ${dataSourceKey} | seriesByName('${selectedValue}')`,\n },\n });\n onChange(event, update);\n },\n [dataSourceKey, name, onChange, prepareValue]\n );\n\n const handleFilterChange = useCallback((e, { keyword }): void => {\n setFilter(keyword);\n }, []);\n const { hasError, isMissing, isLoading } = getDataSourceStateInfo(dataSource);\n const disabled = isMissing || hasError || isDisabled;\n const placeholderMessage = getPlaceholderMessage({ isMissing, isLoading, hasError });\n const shouldRenderEditor = hideEditorWhenLoading ? !!selectedField : true;\n\n return (\n shouldRenderEditor && (\n <ControlGroup\n label={label}\n labelPosition={labelPosition}\n tooltip={tooltip}\n isAdvanced={isAdvanced}\n >\n <Select\n data-test=\"ColumnSelectionEditor\"\n value={selectedField}\n onFilterChange={handleFilterChange}\n onChange={handleValueChange}\n footerMessage={footerMessage}\n disabled={disabled}\n placeholder={placeholderMessage}\n isLoadingOptions={isLoading}\n error={hasError}\n style={editorStyle}\n filter\n >\n {filteredFields.map(field => (\n <Select.Option\n key={field.name}\n label={`${field.name} (${field.type})`}\n value={field.name}\n disabled={!!filterByTypes?.length && !filterByTypes.find(f => f === field.type)}\n />\n ))}\n </Select>\n </ControlGroup>\n )\n );\n};\n\nexport default ColumnSelectionEditor;\n","import React, { useMemo } from 'react';\nimport { ColumnSelectorFooterMessage } from '../shared/ColumnSelectorFooterMessage';\nimport type { FieldTuple } from '../utils/columnSelectionUtils';\n\ntype ObjectWithName = {\n name: string;\n [key: string]: string;\n};\n\ntype Fields = FieldTuple[] | ObjectWithName[];\n\ninterface FooterMessageProps {\n noSelectedFieldsInfo?: boolean;\n filter: string;\n availableFields: Fields;\n selectedFields?: string[];\n filteredFields: Fields;\n}\n\nexport const useColumnSelectorFooterMessage = ({\n filter,\n availableFields,\n selectedFields,\n filteredFields,\n noSelectedFieldsInfo = false,\n}: FooterMessageProps) => {\n const selectedFilteredFields = useMemo(() => {\n if (!selectedFields || !filteredFields) return [];\n\n const validSelectedFields = new Set(\n selectedFields.filter(field => field !== '' && field !== undefined)\n );\n\n return filteredFields.filter(item => validSelectedFields.has(item.name));\n }, [selectedFields, filteredFields]);\n\n // make sure to display only 'No matches' text when there is no result of filtering\n if (filter && !filteredFields.length) {\n return null;\n }\n\n return (\n <ColumnSelectorFooterMessage\n noSelectedFieldsInfo={noSelectedFieldsInfo}\n numSelected={selectedFilteredFields?.length} // if no filter is applied filteredFields equal availableFields\n numFiltered={filteredFields.length}\n numAvailable={availableFields.length}\n filter={filter}\n />\n );\n};\n","import { useState, useEffect, useContext } from 'react';\nimport DataSourceContext, {\n type BindingsSnapshot,\n type DataSourceApi,\n} from '@splunk/visualization-context/DataSourceContext';\nimport { get, isFunction } from 'lodash';\n\ninterface UseDataSourceParams {\n dataSourceBindings: BindingsSnapshot;\n dataSourceKey: string;\n}\n// @TODO(pwied): use DataSource interface in return type (w/o dependency on @splunk/visualizations)\nexport const useDataSource = ({\n dataSourceBindings,\n dataSourceKey,\n}: UseDataSourceParams): BindingsSnapshot => {\n const dataSourceApi = useContext<DataSourceApi>(DataSourceContext);\n const [dataSource, setDataSource] = useState<BindingsSnapshot>();\n useEffect((): (() => void) => {\n if (!get(dataSourceBindings, dataSourceKey)) {\n setDataSource(null);\n return () => undefined;\n }\n const unsubscribe =\n isFunction(dataSourceApi.subscribe) &&\n dataSourceApi.subscribe(dataSourceKey, (snapshot): void => setDataSource(snapshot));\n return () => {\n if (unsubscribe) {\n unsubscribe();\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dataSourceBindings]);\n return dataSource;\n};\n","import React, { Children, cloneElement } from 'react';\nimport type { ReactElement } from 'react';\nimport * as T from 'prop-types';\nimport styled from 'styled-components';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport AdvancedConfigIcon from '@splunk/react-icons/SlidersDoubleHorizontal';\nimport { variables } from '@splunk/themes';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport type { ButtonClickHandler, ButtonProps } from '@splunk/react-ui/Button';\nimport Button from '@splunk/react-ui/Button';\nimport SUIControlGroup from '@splunk/react-ui/ControlGroup';\nimport type { ControlGroupPropsBase } from '@splunk/react-ui/ControlGroup';\n\ninterface AdvancedControlGroupProps extends Omit<ControlGroupPropsBase, 'splunkTheme'> {\n 'data-test'?: string;\n style?: Record<string, string | number>;\n isAdvanced?: boolean;\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n onAdvancedConfigButtonClick?: ButtonClickHandler;\n}\n\ninterface AdvancedConfigButtonProps {\n label?: string;\n onClick?: ButtonClickHandler;\n}\n\n// remove all surrounding margins. let parent add padding\nconst ControlGroupContainer = styled(SUIControlGroup)`\n margin-top: 0;\n padding: 0;\n // adjust bottom margin according to theme\n margin-bottom: ${variables.spacingMedium};\n width: 100%;\n\n // remove top margin of the first component in control group\n &:first-child {\n margin-top: 0;\n }\n\n // remove bottom margin of the last component in control group\n &:last-child {\n margin-bottom: 0;\n }\n // remove top padding on label of the first control group\n [data-test='label']:first-of-type {\n padding-top: 0;\n }\n`;\n\n// override tooltip to set desired config button style\nconst StyledToolTip = styled(Tooltip)`\n display: flex;\n > span {\n display: flex;\n width: 35px;\n }\n`;\n\nconst StyledAdvancedConfigButton = styled(Button)<ButtonProps>`\n color: ${variables.contentColorActive} !important;\n &:hover {\n background-color: ${variables.interactiveColorOverlayDrag} !important;\n }\n`;\n\nexport const AdvancedConfigButton = ({\n label = '',\n onClick,\n}: AdvancedConfigButtonProps): React.ReactElement => {\n return (\n <StyledToolTip\n data-test={`${label}-advanced-config-button-tooltip`}\n content={_('Advanced configurations')}\n >\n <StyledAdvancedConfigButton\n data-test={`${label}-advanced-config-button`}\n icon={<AdvancedConfigIcon data-test={`${label}-advanced-config-button-icon`} />}\n appearance=\"subtle\"\n onClick={onClick}\n />\n </StyledToolTip>\n );\n};\n\nconst AdvancedControlGroup = ({\n 'data-test': dataTest,\n children,\n isAdvanced = false,\n label,\n hideLabel,\n labelPosition,\n labelWidth,\n tooltip,\n help,\n style,\n error,\n controlsLayout,\n onClick,\n onAdvancedConfigButtonClick,\n}: AdvancedControlGroupProps): React.ReactElement => (\n <ControlGroupContainer\n data-test={dataTest ?? 'control-group'}\n label={label}\n hideLabel={hideLabel}\n labelPosition={labelPosition}\n labelWidth={labelWidth}\n tooltip={tooltip}\n help={help}\n error={error}\n style={style}\n onClick={onClick}\n controlsLayout={controlsLayout}\n >\n {isAdvanced\n ? Children.toArray(children)\n .filter(Boolean)\n .map(child =>\n cloneElement(child as ReactElement, {\n style: { flex: 1 },\n })\n )\n : children}\n {isAdvanced ? <AdvancedConfigButton label={label} onClick={onAdvancedConfigButtonClick} /> : null}\n </ControlGroupContainer>\n);\n\nAdvancedControlGroup.propTypes = {\n /**\n * Style overriding SUI ControlGroup\n */\n style: T.object,\n /**\n * Whether the current editor is enabled with advanced configurations\n */\n isAdvanced: T.bool,\n /**\n * Callback for editor click\n */\n onClick: T.func,\n /**\n * Callback for advanced config button click\n */\n onAdvancedConfigButtonClick: T.func,\n};\n\nexport default AdvancedControlGroup;\n","import * as React from 'react';\nimport { sprintf } from '@splunk/ui-utils/format';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport { useMemo } from 'react';\n\ninterface FooterProps {\n filter: string;\n numSelected?: number;\n numFiltered: number;\n numAvailable: number;\n noSelectedFieldsInfo?: boolean; // it is needed for AddColumn component which has different logic than other selection editors\n}\n\nexport const ColumnSelectorFooterMessage = ({\n numSelected,\n numFiltered,\n numAvailable,\n filter,\n noSelectedFieldsInfo,\n}: FooterProps) => {\n const footerMessageText = useMemo(() => {\n if (filter) {\n if (noSelectedFieldsInfo) {\n return sprintf(_('%(filtered)d filtered from %(available)d fields'), {\n filtered: numFiltered,\n available: numAvailable,\n });\n }\n return sprintf(_('%(selected)d selected from %(filtered)d filtered'), {\n selected: numSelected,\n filtered: numFiltered,\n });\n }\n return noSelectedFieldsInfo\n ? sprintf(_('%(shown)d of %(available)d fields'), {\n shown: numFiltered,\n available: numAvailable,\n })\n : sprintf(_('%(selected)d selected from %(available)d'), {\n selected: numSelected,\n available: numAvailable,\n });\n }, [filter, noSelectedFieldsInfo, numFiltered, numAvailable, numSelected]);\n\n return (\n <span data-test=\"footer-message\" aria-live=\"polite\" aria-atomic=\"true\">\n {footerMessageText}\n </span>\n );\n};\n","export const FLYOUT_PADDING = 21;\nexport const COLUMN_FLYOUT_PADDING = 16;\nexport const FLYOUT_WIDTH = 344;\n\nexport const VERTICAL_EDITOR_SPACING = 16;\n\nexport const DROPDOWN_MENU_WIDTH = 327;\n\nexport const editorStyle = { width: '100%' };\n","import { _ } from '@splunk/ui-utils/i18n';\nimport {\n inferDataTypeFromData,\n canInferTypeFromMeta,\n getDataTypeForMeta,\n} from '@splunk/visualization-encoding/utils/types';\n\nexport interface FieldTuple {\n name: string;\n type: string;\n}\n\nexport const getAvailableFieldsWithTypes = (\n columns: unknown[][],\n fields: { name: string; type?: string }[]\n): FieldTuple[] => {\n const fieldsWithType = fields.map((field, index) => {\n const { name } = field;\n const inferredType = canInferTypeFromMeta(field)\n ? getDataTypeForMeta(field)\n : inferDataTypeFromData(columns[index]);\n return {\n name,\n type: inferredType,\n };\n });\n return fieldsWithType;\n};\n\nexport const getFilteredFields = (availableFieldsWithTypes: FieldTuple[], filter: string): FieldTuple[] => {\n return availableFieldsWithTypes.filter((field): boolean => field.name.indexOf(filter) !== -1);\n};\n\nexport const sanitizeFieldNames = (value: unknown, fieldNames: string[]): string[] => {\n if (typeof value === 'string' && fieldNames.includes(value)) {\n return [value];\n }\n if (Array.isArray(value)) {\n return value.filter(name => fieldNames.includes(name));\n }\n return [];\n};\n\nexport const getPlaceholderMessage = ({\n hasError,\n isLoading,\n isMissing,\n defaultMessage = 'Select a field from data source',\n}: {\n hasError: boolean;\n isLoading: boolean;\n isMissing: boolean;\n defaultMessage?: string;\n}): string => {\n if (isMissing) {\n return _('Set up data source to select');\n }\n if (hasError) {\n return _('Please set up valid data source to select');\n }\n if (isLoading) {\n return _('Loading data source...');\n }\n return _(defaultMessage);\n};\n","module.exports = require(\"@splunk/react-icons/SlidersDoubleHorizontal\");","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Select\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes\");","module.exports = require(\"@splunk/ui-utils/format\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@splunk/visualization-context/DataSourceContext\");","module.exports = require(\"@splunk/visualization-encoding/utils/dsl\");","module.exports = require(\"@splunk/visualization-encoding/utils/types\");","module.exports = require(\"@splunk/visualizations-shared/dataSourceUtils\");","module.exports = require(\"lodash\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(5731);\n"],"names":["ColumnSelectionEditor","name","value","label","labelPosition","dataSourceKey","dataSourceBindings","prepareValue","id","onChange","isAdvanced","isDisabled","filterByTypes","tooltip","hideEditorWhenLoading","dataSource","useDataSource","columns","fields","data","availableFieldsWithTypes","getAvailableFieldsWithTypes","fieldName","getFieldsFromDSL","selectedField","setSelectedField","useState","useEffect","filter","setFilter","filteredFields","field","indexOf","footerMessage","useColumnSelectorFooterMessage","availableFields","selectedFields","handleValueChange","useCallback","event","selectedValue","update","options","handleFilterChange","e","keyword","hasError","isMissing","isLoading","getDataSourceStateInfo","disabled","placeholderMessage","getPlaceholderMessage","onFilterChange","placeholder","isLoadingOptions","error","style","editorStyle","map","Option","key","type","length","find","f","noSelectedFieldsInfo","selectedFilteredFields","useMemo","validSelectedFields","Set","undefined","item","has","ColumnSelectorFooterMessage","numSelected","numFiltered","numAvailable","dataSourceApi","useContext","setDataSource","get","unsubscribe","isFunction","subscribe","snapshot","ControlGroupContainer","variables","spacingMedium","StyledToolTip","StyledAdvancedConfigButton","contentColorActive","interactiveColorOverlayDrag","AdvancedConfigButton","onClick","content","_","icon","appearance","AdvancedControlGroup","dataTest","children","hideLabel","labelWidth","help","controlsLayout","onAdvancedConfigButtonClick","Children","toArray","Boolean","child","cloneElement","flex","propTypes","T","object","bool","func","footerMessageText","sprintf","filtered","available","selected","shown","FLYOUT_PADDING","COLUMN_FLYOUT_PADDING","FLYOUT_WIDTH","VERTICAL_EDITOR_SPACING","DROPDOWN_MENU_WIDTH","width","index","canInferTypeFromMeta","getDataTypeForMeta","inferDataTypeFromData","getFilteredFields","sanitizeFieldNames","fieldNames","includes","Array","isArray","defaultMessage","module","exports","require","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","call"],"sourceRoot":""}
@@ -2,14 +2,14 @@
2
2
  * Copyright © 2018 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
- */(()=>{"use strict";var e={2468:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=i(r(9497)),l=i(r(23)),s=r(6649),c=u(r(9250)),f=u(r(7020)),d=u(r(1551)),p=u(r(1151)),{useRef:b,useState:_,useCallback:h}=a,m={label:l.string,labelPosition:l.oneOf(["top","left"]),labelWidth:l.number,onResetToDefault:l.func},v=({label:e,labelPosition:t="left",labelWidth:r,onResetToDefault:o})=>{const[n,i]=_(!1),u=b(null),l=h((()=>i(!0)),[]),m=h((()=>i(!1)),[]);return a.createElement(c.default,{label:(0,s._)(e),labelPosition:t,labelWidth:r},a.createElement(f.default,{"data-test":"customized-in-source-button",onClick:l,appearance:"default",ref:u,label:(0,s._)("Customized in source")}),a.createElement(d.default,{"data-test":"customized-in-source-popover",open:n,anchor:u.current,onRequestClose:m,defaultPlacement:"horizontal"},a.createElement(p.default,{onResetToDefault:o})))};v.propTypes=m,t.default=v},1151:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=i(r(9497)),l=i(r(23)),s=r(6649),c=u(r(232)),f=u(r(4566)),d=u(r(6447)),p=u(r(7020)),b=(0,s._)("Dynamic Option: Customized in source"),_=(0,s._)("Configured in source code beyond what can be shown here. Resetting to default will overwrite this custom configurations."),h=(0,s._)("Reset to default"),m=c.default.div`
5
+ */(()=>{"use strict";var e={2468:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),u=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=u(r(9497)),l=r(6649),s=i(r(9250)),c=i(r(7020)),d=i(r(1551)),f=i(r(1151)),{useRef:p,useState:b,useCallback:_}=a;t.default=({label:e,labelPosition:t="left",labelWidth:r,onResetToDefault:o})=>{const[n,u]=b(!1),i=p(null),h=_((()=>u(!0)),[]),v=_((()=>u(!1)),[]);return a.createElement(s.default,{label:(0,l._)(e),labelPosition:t,labelWidth:r},a.createElement(c.default,{"data-test":"customized-in-source-button",onClick:h,appearance:"default",ref:i,label:(0,l._)("Customized in source")}),a.createElement(d.default,{"data-test":"customized-in-source-popover",open:n,anchor:i.current,onRequestClose:v,defaultPlacement:"horizontal"},a.createElement(f.default,{onResetToDefault:o})))}},1151:function(e,t,r){var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),u=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=u(r(9497)),l=u(r(23)),s=r(6649),c=i(r(232)),d=i(r(4566)),f=i(r(6447)),p=i(r(7020)),b=(0,s._)("Dynamic Option: Customized in source"),_=(0,s._)("Configured in source code beyond what can be shown here. Resetting to default will overwrite this custom configurations."),h=(0,s._)("Reset to default"),v=c.default.div`
6
6
  padding: ${({padding:e})=>null!=e?e:"20px"};
7
7
  width: ${({width:e})=>null!=e?e:"300px"};
8
- color: ${f.default.contentColorActive};
9
- `,v=c.default.div`
8
+ color: ${d.default.contentColorActive};
9
+ `,m=c.default.div`
10
10
  font-weight: 600;
11
11
  font-size: 14px;
12
12
  line-height: 20px;
13
13
  margin-bottom: 10px;
14
- `,g={headerText:l.string,info:l.string,resetButtonText:l.string,onResetToDefault:l.func,style:l.object},x=({headerText:e=b,info:t=_,resetButtonText:r=h,onResetToDefault:o=(()=>{}),style:n={}})=>a.createElement(m,{style:n},a.createElement(v,{"data-test":"popover-header"},e),a.createElement(d.default,{"data-test":"customized-source-popover-message",type:"info"},t),a.createElement(p.default,{"data-test":"popover-reset",appearance:"secondary",onClick:o,label:r}));x.propTypes=g,t.default=x},7020:e=>{e.exports=require("@splunk/react-ui/Button")},9250:e=>{e.exports=require("@splunk/react-ui/ControlGroup")},6447:e=>{e.exports=require("@splunk/react-ui/Message")},1551:e=>{e.exports=require("@splunk/react-ui/Popover")},4566:e=>{e.exports=require("@splunk/themes/variables")},6649:e=>{e.exports=require("@splunk/ui-utils/i18n")},23:e=>{e.exports=require("prop-types")},9497:e=>{e.exports=require("react")},232:e=>{e.exports=require("styled-components")}},t={};var r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}(2468);module.exports=r})();
14
+ `,x={headerText:l.string,info:l.string,resetButtonText:l.string,onResetToDefault:l.func,style:l.object},g=({headerText:e=b,info:t=_,resetButtonText:r=h,onResetToDefault:o=(()=>{}),style:n={}})=>a.createElement(v,{style:n},a.createElement(m,{"data-test":"popover-header"},e),a.createElement(f.default,{"data-test":"customized-source-popover-message",type:"info"},t),a.createElement(p.default,{"data-test":"popover-reset",appearance:"secondary",onClick:o,label:r}));g.propTypes=x,t.default=g},7020:e=>{e.exports=require("@splunk/react-ui/Button")},9250:e=>{e.exports=require("@splunk/react-ui/ControlGroup")},6447:e=>{e.exports=require("@splunk/react-ui/Message")},1551:e=>{e.exports=require("@splunk/react-ui/Popover")},4566:e=>{e.exports=require("@splunk/themes/variables")},6649:e=>{e.exports=require("@splunk/ui-utils/i18n")},23:e=>{e.exports=require("prop-types")},9497:e=>{e.exports=require("react")},232:e=>{e.exports=require("styled-components")}},t={};var r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var u=t[o]={exports:{}};return e[o].call(u.exports,u,u.exports,r),u.exports}(2468);module.exports=r})();
15
15
  //# sourceMappingURL=CustomizedInSourceEdit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C,EAA4B,EAC9BL,aAAaT,EACbU,OAAOT,EACPU,kBAAkBT,EAClBjB,mBAAmB,MAAqB,GACxC2B,QAAQ,CAAC,KAET,gBAACT,EAAc,CAACS,MAAOA,GACnB,gBAACJ,EAAa,aAAW,kBAAkBC,GAC3C,gBAAC,UAAO,aAAW,oCAAoCM,KAAK,QACvDL,GAEL,gBAAC,UAAM,aACO,gBACVf,WAAW,YACXD,QAAST,EACTP,MAAOiC,KAKnBG,EAA0BrC,UAAYA,EAEtC,UAAeqC,C,WCrEfE,EAAOC,QAAUC,QAAQ,0B,WCAzBF,EAAOC,QAAUC,QAAQ,gC,WCAzBF,EAAOC,QAAUC,QAAQ,2B,WCAzBF,EAAOC,QAAUC,QAAQ,2B,WCAzBF,EAAOC,QAAUC,QAAQ,2B,WCAzBF,EAAOC,QAAUC,QAAQ,wB,SCAzBF,EAAOC,QAAUC,QAAQ,a,WCAzBF,EAAOC,QAAUC,QAAQ,Q,UCAzBF,EAAOC,QAAUC,QAAQ,oB,GCCrBC,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaN,QAGrB,IAAID,EAASG,EAAyBG,GAAY,CAGjDL,QAAS,CAAC,GAOX,OAHAQ,EAAoBH,GAAUI,KAAKV,EAAOC,QAASD,EAAQA,EAAOC,QAASI,GAGpEL,EAAOC,OACf,CCnB0BI,CAAoB,M","sources":["webpack://@splunk/dynamic-editors/./src/editors/CustomizedInSourceEditor.tsx","webpack://@splunk/dynamic-editors/./src/shared/CustomizedInSourceMessage.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Message\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Popover\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes/variables\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/startup"],"sourcesContent":["import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport Button from '@splunk/react-ui/Button';\nimport Popover from '@splunk/react-ui/Popover';\nimport CustomizedInSourceMessage from '../shared/CustomizedInSourceMessage';\n\nconst { useRef, useState, useCallback } = React;\n\nexport interface CustomizedInSourceEditorProps {\n label: string;\n labelPosition?: 'left' | 'top';\n labelWidth?: number;\n onResetToDefault?: (...args: any[]) => void;\n}\n\nconst propTypes: Record<keyof CustomizedInSourceEditorProps, T.Validator<any>> = {\n label: T.string,\n labelPosition: T.oneOf(['top', 'left']),\n labelWidth: T.number,\n onResetToDefault: T.func,\n};\n\nconst CustomizedInSourceEditor = ({\n label,\n labelPosition = 'left',\n labelWidth,\n onResetToDefault,\n}: CustomizedInSourceEditorProps) => {\n const [open, setOpen] = useState(false);\n const anchor = useRef(null);\n const handleOpen = useCallback((): void => setOpen(true), []);\n const handleRequestClose = useCallback((): void => setOpen(false), []);\n\n return (\n <ControlGroup label={_(label)} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Button\n data-test=\"customized-in-source-button\"\n onClick={handleOpen}\n appearance=\"default\"\n ref={anchor}\n label={_('Customized in source')}\n />\n <Popover\n data-test=\"customized-in-source-popover\"\n open={open}\n anchor={anchor.current}\n onRequestClose={handleRequestClose}\n defaultPlacement=\"horizontal\"\n >\n <CustomizedInSourceMessage onResetToDefault={onResetToDefault} />\n </Popover>\n </ControlGroup>\n );\n};\n\nCustomizedInSourceEditor.propTypes = propTypes;\n\nexport default CustomizedInSourceEditor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Message from '@splunk/react-ui/Message';\nimport Button from '@splunk/react-ui/Button';\n\nconst defaultHeaderText = _('Dynamic Option: Customized in source');\nconst defaultInfo = _(\n 'Configured in source code beyond what can be shown here. Resetting to default will overwrite this custom configurations.'\n);\nconst defaultResetButtonText = _('Reset to default');\n\nconst PopoverContent = styled.div<{\n padding?: number | string;\n width?: number | string;\n}>`\n padding: ${({ padding }: any) => padding ?? '20px'};\n width: ${({ width }: any) => width ?? '300px'};\n color: ${variables.contentColorActive};\n`;\n\nconst PopoverHeader = styled.div`\n font-weight: 600;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 10px;\n`;\n\nexport interface CustomizedInSourceMessageProps {\n headerText?: string;\n info?: string;\n resetButtonText?: string;\n onResetToDefault?: (...args: any[]) => void;\n style?: Record<string, any>;\n}\n\nconst propTypes: Record<keyof CustomizedInSourceMessageProps, T.Validator<any>> = {\n headerText: T.string,\n info: T.string,\n resetButtonText: T.string,\n onResetToDefault: T.func,\n style: T.object,\n};\n\nconst CustomizedInSourceMessage = ({\n headerText = defaultHeaderText,\n info = defaultInfo,\n resetButtonText = defaultResetButtonText,\n onResetToDefault = (): void => undefined,\n style = {},\n}: CustomizedInSourceMessageProps): React.ReactElement => (\n <PopoverContent style={style}>\n <PopoverHeader data-test=\"popover-header\">{headerText}</PopoverHeader>\n <Message data-test=\"customized-source-popover-message\" type=\"info\">\n {info}\n </Message>\n <Button\n data-test=\"popover-reset\"\n appearance=\"secondary\"\n onClick={onResetToDefault}\n label={resetButtonText}\n />\n </PopoverContent>\n);\n\nCustomizedInSourceMessage.propTypes = propTypes;\n\nexport default CustomizedInSourceMessage;\n","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Message\");","module.exports = require(\"@splunk/react-ui/Popover\");","module.exports = require(\"@splunk/themes/variables\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(2468);\n"],"names":["useRef","useState","useCallback","React","propTypes","label","T","string","labelPosition","oneOf","labelWidth","number","onResetToDefault","func","CustomizedInSourceEditor","open","setOpen","anchor","handleOpen","handleRequestClose","_","onClick","appearance","ref","current","onRequestClose","defaultPlacement","defaultHeaderText","defaultInfo","defaultResetButtonText","PopoverContent","div","padding","width","contentColorActive","PopoverHeader","headerText","info","resetButtonText","style","object","CustomizedInSourceMessage","type","module","exports","require","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}
1
+ {"version":3,"file":"CustomizedInSourceEditor.js","mappings":";;;;2zBAAA,mBACA,UACA,aACA,aACA,aACA,cAEM,OAAEA,EAAM,SAAEC,EAAQ,YAAEC,GAAgBC,EA0C1C,UAjCiC,EAC7BC,QACAC,gBAAgB,OAChBC,aACAC,uBAEA,MAAOC,EAAMC,GAAWR,GAAS,GAC3BS,EAASV,EAAO,MAChBW,EAAaT,GAAY,IAAYO,GAAQ,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OC,QAAUC,QAAQ,2B,WCAzBF,EAAOC,QAAUC,QAAQ,wB,SCAzBF,EAAOC,QAAUC,QAAQ,a,WCAzBF,EAAOC,QAAUC,QAAQ,Q,UCAzBF,EAAOC,QAAUC,QAAQ,oB,GCCrBC,EAA2B,CAAC,ECEhC,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaN,QAGrB,IAAID,EAASG,EAAyBG,GAAY,CAGjDL,QAAS,CAAC,GAOX,OAHAQ,EAAoBH,GAAUI,KAAKV,EAAOC,QAASD,EAAQA,EAAOC,QAASI,GAGpEL,EAAOC,OACf,CCnB0BI,CAAoB,M","sources":["webpack://@splunk/dynamic-editors/./src/editors/CustomizedInSourceEditor.tsx","webpack://@splunk/dynamic-editors/./src/shared/CustomizedInSourceMessage.tsx","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Button\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/ControlGroup\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Message\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/react-ui/Popover\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/themes/variables\"","webpack://@splunk/dynamic-editors/external commonjs2 \"@splunk/ui-utils/i18n\"","webpack://@splunk/dynamic-editors/external commonjs2 \"prop-types\"","webpack://@splunk/dynamic-editors/external commonjs2 \"react\"","webpack://@splunk/dynamic-editors/external commonjs2 \"styled-components\"","webpack://@splunk/dynamic-editors/webpack/bootstrap","webpack://@splunk/dynamic-editors/webpack/startup"],"sourcesContent":["import * as React from 'react';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport ControlGroup from '@splunk/react-ui/ControlGroup';\nimport Button from '@splunk/react-ui/Button';\nimport Popover from '@splunk/react-ui/Popover';\nimport CustomizedInSourceMessage from '../shared/CustomizedInSourceMessage';\n\nconst { useRef, useState, useCallback } = React;\n\nexport interface CustomizedInSourceEditorProps {\n label: string;\n labelPosition?: 'left' | 'top';\n labelWidth?: number;\n onResetToDefault?: (event?: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst CustomizedInSourceEditor = ({\n label,\n labelPosition = 'left',\n labelWidth,\n onResetToDefault,\n}: CustomizedInSourceEditorProps) => {\n const [open, setOpen] = useState(false);\n const anchor = useRef(null);\n const handleOpen = useCallback((): void => setOpen(true), []);\n const handleRequestClose = useCallback((): void => setOpen(false), []);\n\n return (\n <ControlGroup label={_(label)} labelPosition={labelPosition} labelWidth={labelWidth}>\n <Button\n data-test=\"customized-in-source-button\"\n onClick={handleOpen}\n appearance=\"default\"\n ref={anchor}\n label={_('Customized in source')}\n />\n <Popover\n data-test=\"customized-in-source-popover\"\n open={open}\n anchor={anchor.current}\n onRequestClose={handleRequestClose}\n defaultPlacement=\"horizontal\"\n >\n <CustomizedInSourceMessage onResetToDefault={onResetToDefault} />\n </Popover>\n </ControlGroup>\n );\n};\n\nexport default CustomizedInSourceEditor;\n","import * as React from 'react';\nimport * as T from 'prop-types';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport styled from 'styled-components';\nimport variables from '@splunk/themes/variables';\nimport Message from '@splunk/react-ui/Message';\nimport Button from '@splunk/react-ui/Button';\n\nconst defaultHeaderText = _('Dynamic Option: Customized in source');\nconst defaultInfo = _(\n 'Configured in source code beyond what can be shown here. Resetting to default will overwrite this custom configurations.'\n);\nconst defaultResetButtonText = _('Reset to default');\n\nconst PopoverContent = styled.div<{\n padding?: number | string;\n width?: number | string;\n}>`\n padding: ${({ padding }: any) => padding ?? '20px'};\n width: ${({ width }: any) => width ?? '300px'};\n color: ${variables.contentColorActive};\n`;\n\nconst PopoverHeader = styled.div`\n font-weight: 600;\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 10px;\n`;\n\nexport interface CustomizedInSourceMessageProps {\n headerText?: string;\n info?: string;\n resetButtonText?: string;\n onResetToDefault?: (...args: any[]) => void;\n style?: Record<string, any>;\n}\n\nconst propTypes: Record<keyof CustomizedInSourceMessageProps, T.Validator<any>> = {\n headerText: T.string,\n info: T.string,\n resetButtonText: T.string,\n onResetToDefault: T.func,\n style: T.object,\n};\n\nconst CustomizedInSourceMessage = ({\n headerText = defaultHeaderText,\n info = defaultInfo,\n resetButtonText = defaultResetButtonText,\n onResetToDefault = (): void => undefined,\n style = {},\n}: CustomizedInSourceMessageProps): React.ReactElement => (\n <PopoverContent style={style}>\n <PopoverHeader data-test=\"popover-header\">{headerText}</PopoverHeader>\n <Message data-test=\"customized-source-popover-message\" type=\"info\">\n {info}\n </Message>\n <Button\n data-test=\"popover-reset\"\n appearance=\"secondary\"\n onClick={onResetToDefault}\n label={resetButtonText}\n />\n </PopoverContent>\n);\n\nCustomizedInSourceMessage.propTypes = propTypes;\n\nexport default CustomizedInSourceMessage;\n","module.exports = require(\"@splunk/react-ui/Button\");","module.exports = require(\"@splunk/react-ui/ControlGroup\");","module.exports = require(\"@splunk/react-ui/Message\");","module.exports = require(\"@splunk/react-ui/Popover\");","module.exports = require(\"@splunk/themes/variables\");","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"styled-components\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(2468);\n"],"names":["useRef","useState","useCallback","React","label","labelPosition","labelWidth","onResetToDefault","open","setOpen","anchor","handleOpen","handleRequestClose","_","onClick","appearance","ref","current","onRequestClose","defaultPlacement","defaultHeaderText","defaultInfo","defaultResetButtonText","PopoverContent","div","padding","width","contentColorActive","PopoverHeader","propTypes","headerText","T","string","info","resetButtonText","func","style","object","CustomizedInSourceMessage","type","module","exports","require","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call"],"sourceRoot":""}