@devtron-labs/devtron-fe-common-lib 0.0.39-beta-2 → 0.0.40
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/Common/Common.service.d.ts +2 -2
- package/dist/Common/Constants.d.ts +1 -0
- package/dist/Common/Types.d.ts +36 -2
- package/dist/Common/index.d.ts +0 -1
- package/dist/index.js +339 -441
- package/package.json +1 -4
- package/src/Common/Common.service.ts +223 -76
- package/src/Common/Constants.ts +1 -0
- package/src/Common/ImageTags.tsx +11 -2
- package/src/Common/Types.ts +44 -2
- package/src/Common/index.ts +0 -1
- package/dist/Common/RJSF/Form.d.ts +0 -4
- package/dist/Common/RJSF/common/FieldRow.d.ts +0 -3
- package/dist/Common/RJSF/common/types.d.ts +0 -8
- package/dist/Common/RJSF/config.d.ts +0 -4
- package/dist/Common/RJSF/constants.d.ts +0 -5
- package/dist/Common/RJSF/index.d.ts +0 -2
- package/dist/Common/RJSF/templates/ArrayFieldItemTemplate.d.ts +0 -3
- package/dist/Common/RJSF/templates/ArrayFieldTemplate.d.ts +0 -3
- package/dist/Common/RJSF/templates/BaseInput.d.ts +0 -3
- package/dist/Common/RJSF/templates/ButtonTemplates/AddButton.d.ts +0 -3
- package/dist/Common/RJSF/templates/ButtonTemplates/RemoveButton.d.ts +0 -3
- package/dist/Common/RJSF/templates/ButtonTemplates/SubmitButton.d.ts +0 -3
- package/dist/Common/RJSF/templates/ButtonTemplates/index.d.ts +0 -3
- package/dist/Common/RJSF/templates/Description.d.ts +0 -3
- package/dist/Common/RJSF/templates/Field.d.ts +0 -3
- package/dist/Common/RJSF/templates/FieldErrorTemplate.d.ts +0 -3
- package/dist/Common/RJSF/templates/ObjectFieldTemplate.d.ts +0 -3
- package/dist/Common/RJSF/templates/TitleField.d.ts +0 -3
- package/dist/Common/RJSF/templates/WrapIfAdditionalTemplate.d.ts +0 -3
- package/dist/Common/RJSF/templates/index.d.ts +0 -10
- package/dist/Common/RJSF/types.d.ts +0 -3
- package/dist/Common/RJSF/utils.d.ts +0 -14
- package/dist/Common/RJSF/widgets/Checkbox.d.ts +0 -3
- package/dist/Common/RJSF/widgets/Select.d.ts +0 -3
- package/dist/Common/RJSF/widgets/index.d.ts +0 -2
- package/src/Assets/Icon/ic-chevron-down.svg +0 -5
- package/src/Common/RJSF/Form.tsx +0 -29
- package/src/Common/RJSF/common/FieldRow.tsx +0 -31
- package/src/Common/RJSF/common/types.ts +0 -9
- package/src/Common/RJSF/config.ts +0 -37
- package/src/Common/RJSF/constants.ts +0 -5
- package/src/Common/RJSF/index.ts +0 -2
- package/src/Common/RJSF/rjsfForm.scss +0 -17
- package/src/Common/RJSF/templates/ArrayFieldItemTemplate.tsx +0 -33
- package/src/Common/RJSF/templates/ArrayFieldTemplate.tsx +0 -77
- package/src/Common/RJSF/templates/BaseInput.tsx +0 -16
- package/src/Common/RJSF/templates/ButtonTemplates/AddButton.tsx +0 -18
- package/src/Common/RJSF/templates/ButtonTemplates/RemoveButton.tsx +0 -10
- package/src/Common/RJSF/templates/ButtonTemplates/SubmitButton.tsx +0 -18
- package/src/Common/RJSF/templates/ButtonTemplates/index.ts +0 -3
- package/src/Common/RJSF/templates/Description.tsx +0 -12
- package/src/Common/RJSF/templates/Field.tsx +0 -30
- package/src/Common/RJSF/templates/FieldErrorTemplate.tsx +0 -25
- package/src/Common/RJSF/templates/ObjectFieldTemplate.tsx +0 -96
- package/src/Common/RJSF/templates/TitleField.tsx +0 -9
- package/src/Common/RJSF/templates/WrapIfAdditionalTemplate.tsx +0 -51
- package/src/Common/RJSF/templates/index.ts +0 -10
- package/src/Common/RJSF/types.ts +0 -4
- package/src/Common/RJSF/utils.ts +0 -59
- package/src/Common/RJSF/widgets/Checkbox.tsx +0 -44
- package/src/Common/RJSF/widgets/Select.tsx +0 -72
- package/src/Common/RJSF/widgets/index.ts +0 -2
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { WidgetProps } from '@rjsf/utils'
|
|
3
|
-
import ReactSelect, { components } from 'react-select'
|
|
4
|
-
import { PLACEHOLDERS } from '../constants'
|
|
5
|
-
import { getCommonSelectStyle } from '../utils'
|
|
6
|
-
|
|
7
|
-
import { ReactComponent as ArrowDown } from '../../../Assets/Icon/ic-chevron-down.svg'
|
|
8
|
-
|
|
9
|
-
const commonStyles = getCommonSelectStyle()
|
|
10
|
-
|
|
11
|
-
const DropdownIndicator = (props) => (
|
|
12
|
-
<components.DropdownIndicator {...props}>
|
|
13
|
-
<ArrowDown className="icon-dim-20 icon-n5" data-testid="overview-project-edit-dropdown" />
|
|
14
|
-
</components.DropdownIndicator>
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
export const Select = (props: WidgetProps) => {
|
|
18
|
-
const {
|
|
19
|
-
id,
|
|
20
|
-
multiple = false,
|
|
21
|
-
options,
|
|
22
|
-
value,
|
|
23
|
-
disabled,
|
|
24
|
-
readonly,
|
|
25
|
-
autofocus = false,
|
|
26
|
-
onChange,
|
|
27
|
-
onBlur,
|
|
28
|
-
onFocus,
|
|
29
|
-
placeholder,
|
|
30
|
-
} = props
|
|
31
|
-
const { enumOptions: selectOptions = [] } = options
|
|
32
|
-
const emptyValue = multiple ? [] : ''
|
|
33
|
-
|
|
34
|
-
const handleChange = (option) => {
|
|
35
|
-
onChange(multiple ? option.map((o) => o.value) : option.value)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const getOption = (value) =>
|
|
39
|
-
multiple
|
|
40
|
-
? selectOptions.filter((option) => value.includes(option.value))
|
|
41
|
-
: selectOptions.find((option) => option.value === value)
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<ReactSelect
|
|
45
|
-
id={id}
|
|
46
|
-
name={id}
|
|
47
|
-
isMulti={multiple}
|
|
48
|
-
value={typeof value === 'undefined' ? emptyValue : getOption(value)}
|
|
49
|
-
autoFocus={autofocus}
|
|
50
|
-
onChange={handleChange}
|
|
51
|
-
options={selectOptions}
|
|
52
|
-
onBlur={() => onBlur(id, value)}
|
|
53
|
-
onFocus={() => onFocus(id, value)}
|
|
54
|
-
placeholder={placeholder || PLACEHOLDERS.SELECT}
|
|
55
|
-
isDisabled={disabled || readonly}
|
|
56
|
-
styles={{
|
|
57
|
-
...commonStyles,
|
|
58
|
-
control: (base) => ({
|
|
59
|
-
...base,
|
|
60
|
-
...commonStyles.control,
|
|
61
|
-
backgroundColor: 'var(--N50)',
|
|
62
|
-
}),
|
|
63
|
-
}}
|
|
64
|
-
components={{
|
|
65
|
-
IndicatorSeparator: null,
|
|
66
|
-
DropdownIndicator,
|
|
67
|
-
}}
|
|
68
|
-
menuPlacement="auto"
|
|
69
|
-
menuPortalTarget={document.body}
|
|
70
|
-
/>
|
|
71
|
-
)
|
|
72
|
-
}
|