@devtron-labs/devtron-fe-common-lib 0.0.6-beta-24 → 0.0.6-beta-26
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/CustomTagSelector/ResizableTagTextArea.d.ts +1 -1
- package/dist/Common/CustomTagSelector/TagDetails.d.ts +2 -2
- package/dist/Common/CustomTagSelector/TagLabelSelect.d.ts +1 -1
- package/dist/Common/CustomTagSelector/TagLabelValueSelector.d.ts +1 -1
- package/dist/Common/CustomTagSelector/Types.d.ts +59 -0
- package/dist/Common/CustomTagSelector/index.d.ts +3 -0
- package/dist/Common/Types.d.ts +0 -54
- package/dist/index.js +27 -27
- package/package.json +1 -1
- package/src/Common/CustomTagSelector/ResizableTagTextArea.tsx +1 -1
- package/src/Common/CustomTagSelector/TagDetails.tsx +10 -2
- package/src/Common/CustomTagSelector/TagLabelSelect.tsx +8 -3
- package/src/Common/CustomTagSelector/TagLabelValueSelector.tsx +13 -10
- package/src/Common/CustomTagSelector/Types.ts +63 -0
- package/src/Common/CustomTagSelector/index.ts +4 -1
- package/src/Common/Types.ts +0 -60
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ResizableTagTextAreaProps } from '
|
|
2
|
+
import { ResizableTagTextAreaProps } from './Types';
|
|
3
3
|
export declare function ResizableTagTextArea({ className, minHeight, maxHeight, value, onChange, onBlur, onFocus, placeholder, tabIndex, refVar, dependentRef, }: ResizableTagTextAreaProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TagDetailType } from '
|
|
3
|
-
export
|
|
2
|
+
import { TagDetailType } from './Types';
|
|
3
|
+
export declare const TagDetails: ({ index, tagData, setTagData, removeTag, tabIndex, suggestedTagsOptions, }: TagDetailType) => JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TagLabelValueSelectorType } from '
|
|
2
|
+
import { TagLabelValueSelectorType } from './Types';
|
|
3
3
|
export declare const TagLabelValueSelector: ({ selectedTagIndex, tagData, setTagData, tagOptions, isRequired, tagInputType, placeholder, tabIndex, refVar, dependentRef, }: TagLabelValueSelectorType) => JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { KEY_VALUE } from '../Constants';
|
|
3
|
+
import { OptionType } from '../Types';
|
|
4
|
+
export interface TagType {
|
|
5
|
+
id?: number;
|
|
6
|
+
key: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
propagate: boolean;
|
|
10
|
+
mandatoryProjectIdsCsv?: string;
|
|
11
|
+
isInvalidKey?: boolean;
|
|
12
|
+
isInvalidValue?: boolean;
|
|
13
|
+
isSuggested?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface TagErrorType {
|
|
16
|
+
isValid: boolean;
|
|
17
|
+
messages: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface TagLabelSelectType {
|
|
20
|
+
isCreateApp?: boolean;
|
|
21
|
+
labelTags: TagType[];
|
|
22
|
+
setLabelTags: (tagList: TagType[]) => void;
|
|
23
|
+
tabIndex?: number;
|
|
24
|
+
selectedProjectId?: number;
|
|
25
|
+
suggestedTagsOptions?: OptionType[];
|
|
26
|
+
}
|
|
27
|
+
export interface TagDetailType {
|
|
28
|
+
index: number;
|
|
29
|
+
tagData: TagType;
|
|
30
|
+
setTagData: (index: number, tagData: TagType) => void;
|
|
31
|
+
removeTag?: (index: number) => void;
|
|
32
|
+
tabIndex?: number;
|
|
33
|
+
suggestedTagsOptions?: OptionType[];
|
|
34
|
+
}
|
|
35
|
+
export interface TagLabelValueSelectorType {
|
|
36
|
+
selectedTagIndex: number;
|
|
37
|
+
tagData: TagType;
|
|
38
|
+
setTagData: (index: number, tagData: TagType) => void;
|
|
39
|
+
tagOptions?: OptionType[];
|
|
40
|
+
isRequired?: boolean;
|
|
41
|
+
tagInputType?: KEY_VALUE;
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
tabIndex?: number;
|
|
44
|
+
refVar?: React.MutableRefObject<HTMLTextAreaElement>;
|
|
45
|
+
dependentRef?: React.MutableRefObject<HTMLTextAreaElement>;
|
|
46
|
+
}
|
|
47
|
+
export interface ResizableTagTextAreaProps {
|
|
48
|
+
className?: string;
|
|
49
|
+
minHeight?: number;
|
|
50
|
+
maxHeight?: number;
|
|
51
|
+
value?: string;
|
|
52
|
+
onChange?: (e: any) => void;
|
|
53
|
+
onBlur?: (e: any) => void;
|
|
54
|
+
onFocus?: (e: any) => void;
|
|
55
|
+
placeholder?: string;
|
|
56
|
+
tabIndex?: number;
|
|
57
|
+
refVar?: React.MutableRefObject<HTMLTextAreaElement>;
|
|
58
|
+
dependentRef?: React.MutableRefObject<HTMLTextAreaElement>;
|
|
59
|
+
}
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { KEY_VALUE } from './Constants';
|
|
3
1
|
export interface ResponseType {
|
|
4
2
|
code: number;
|
|
5
3
|
status: string;
|
|
@@ -19,58 +17,6 @@ export declare enum TippyTheme {
|
|
|
19
17
|
black = "black",
|
|
20
18
|
white = "white"
|
|
21
19
|
}
|
|
22
|
-
export interface TagType {
|
|
23
|
-
id?: number;
|
|
24
|
-
key: string;
|
|
25
|
-
value?: string;
|
|
26
|
-
description?: string;
|
|
27
|
-
propagate: boolean;
|
|
28
|
-
mandatoryProjectIdsCsv?: string;
|
|
29
|
-
isInvalidKey?: boolean;
|
|
30
|
-
isInvalidValue?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export interface TagErrorType {
|
|
33
|
-
isValid: boolean;
|
|
34
|
-
messages: string[];
|
|
35
|
-
}
|
|
36
|
-
export interface TagLabelSelectType {
|
|
37
|
-
isCreateApp?: boolean;
|
|
38
|
-
labelTags: TagType[];
|
|
39
|
-
setLabelTags: (tagList: TagType[]) => void;
|
|
40
|
-
tabIndex?: number;
|
|
41
|
-
}
|
|
42
|
-
export interface TagDetailType {
|
|
43
|
-
index: number;
|
|
44
|
-
tagData: TagType;
|
|
45
|
-
setTagData: (index: number, tagData: TagType) => void;
|
|
46
|
-
removeTag: (index: number) => void;
|
|
47
|
-
tabIndex?: number;
|
|
48
|
-
}
|
|
49
|
-
export interface TagLabelValueSelectorType {
|
|
50
|
-
selectedTagIndex: number;
|
|
51
|
-
tagData: TagType;
|
|
52
|
-
setTagData: (index: number, tagData: TagType) => void;
|
|
53
|
-
tagOptions?: OptionType[];
|
|
54
|
-
isRequired?: boolean;
|
|
55
|
-
tagInputType?: KEY_VALUE;
|
|
56
|
-
placeholder?: string;
|
|
57
|
-
tabIndex?: number;
|
|
58
|
-
refVar?: React.MutableRefObject<HTMLTextAreaElement>;
|
|
59
|
-
dependentRef?: React.MutableRefObject<HTMLTextAreaElement>;
|
|
60
|
-
}
|
|
61
|
-
export interface ResizableTagTextAreaProps {
|
|
62
|
-
className?: string;
|
|
63
|
-
minHeight?: number;
|
|
64
|
-
maxHeight?: number;
|
|
65
|
-
value?: string;
|
|
66
|
-
onChange?: (e: any) => void;
|
|
67
|
-
onBlur?: (e: any) => void;
|
|
68
|
-
onFocus?: (e: any) => void;
|
|
69
|
-
placeholder?: string;
|
|
70
|
-
tabIndex?: number;
|
|
71
|
-
refVar?: React.MutableRefObject<HTMLTextAreaElement>;
|
|
72
|
-
dependentRef?: React.MutableRefObject<HTMLTextAreaElement>;
|
|
73
|
-
}
|
|
74
20
|
export interface TeamList extends ResponseType {
|
|
75
21
|
result: Teams[];
|
|
76
22
|
}
|
package/dist/index.js
CHANGED
|
@@ -8480,21 +8480,6 @@ function PropagateTagInfo(_a) {
|
|
|
8480
8480
|
return (jsxRuntime.jsx(TippyCustomized, __assign({ theme: exports.TippyTheme.white, className: "w-300", placement: "top", Icon: SvgInjectTag, heading: 'Propagate tags to K8s resources', infoText: "", additionalContent: additionalInfo(), showCloseButton: true, trigger: "click", interactive: true, documentationLink: isCreateApp ? DOCUMENTATION.APP_TAGS : DOCUMENTATION.APP_OVERVIEW_TAGS, documentationLinkText: "View Documentation" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flexbox cursor" }, { children: [jsxRuntime.jsx(SvgInjectTag, { className: "icon-dim-16 mt-2 mr-4" }), jsxRuntime.jsx("span", { children: "Propagate tags" }), jsxRuntime.jsx(SvgIcHelpOutline, { className: "icon-dim-16 mt-2 ml-4" })] })) })));
|
|
8481
8481
|
}
|
|
8482
8482
|
|
|
8483
|
-
var _path$2;
|
|
8484
|
-
function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
|
|
8485
|
-
var SvgIcAdd = function SvgIcAdd(props) {
|
|
8486
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
|
|
8487
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
8488
|
-
width: "1em",
|
|
8489
|
-
height: "1em",
|
|
8490
|
-
viewBox: "0 0 24 24"
|
|
8491
|
-
}, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
8492
|
-
className: "ic-add_svg__fill-color",
|
|
8493
|
-
fill: "#999",
|
|
8494
|
-
d: "M18 13h-5v5a1 1 0 0 1-2 0v-5H6a1 1 0 0 1 0-2h5V6a1 1 0 0 1 2 0v5h5a1 1 0 0 1 0 2z"
|
|
8495
|
-
})));
|
|
8496
|
-
};
|
|
8497
|
-
|
|
8498
8483
|
var validateTagValue = function (value) {
|
|
8499
8484
|
var errorList = [];
|
|
8500
8485
|
if (value.length > 63) {
|
|
@@ -8555,15 +8540,15 @@ var ValidationRules = /** @class */ (function () {
|
|
|
8555
8540
|
return ValidationRules;
|
|
8556
8541
|
}());
|
|
8557
8542
|
|
|
8558
|
-
var _path$
|
|
8559
|
-
function _extends$
|
|
8543
|
+
var _path$2;
|
|
8544
|
+
function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
|
|
8560
8545
|
var SvgIcInfoOutlined = function SvgIcInfoOutlined(props) {
|
|
8561
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
8546
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
|
|
8562
8547
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8563
8548
|
width: "1em",
|
|
8564
8549
|
height: "1em",
|
|
8565
8550
|
viewBox: "0 0 20 20"
|
|
8566
|
-
}, props), _path$
|
|
8551
|
+
}, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
8567
8552
|
d: "M10 1.667c4.6 0 8.333 3.733 8.333 8.333S14.6 18.333 10 18.333 1.667 14.6 1.667 10 5.4 1.667 10 1.667zm0 1.666A6.67 6.67 0 0 0 3.333 10 6.67 6.67 0 0 0 10 16.667 6.67 6.67 0 0 0 16.667 10 6.67 6.67 0 0 0 10 3.333zm0 5.834c.46 0 .833.373.833.833v3.333a.834.834 0 1 1-1.666 0V10c0-.46.373-.833.833-.833zm0-3.334A.833.833 0 1 1 10 7.5a.833.833 0 0 1 0-1.667z",
|
|
8568
8553
|
fill: "#06C",
|
|
8569
8554
|
fillRule: "evenodd"
|
|
@@ -8625,10 +8610,10 @@ var TagLabelValueSelector = function (_a) {
|
|
|
8625
8610
|
}, 300);
|
|
8626
8611
|
};
|
|
8627
8612
|
var handleOnBlur = function (e) {
|
|
8628
|
-
setActiveElement('');
|
|
8629
8613
|
if (!e.relatedTarget ||
|
|
8630
8614
|
!e.relatedTarget.classList.value ||
|
|
8631
8615
|
!e.relatedTarget.classList.value.includes("tag-".concat(selectedTagIndex, "-class"))) {
|
|
8616
|
+
setActiveElement('');
|
|
8632
8617
|
var _tagData = __assign({}, tagData);
|
|
8633
8618
|
_tagData[tagInputType] = selectedValue;
|
|
8634
8619
|
if (tagInputType === exports.KEY_VALUE.KEY) {
|
|
@@ -8675,9 +8660,7 @@ var TagLabelValueSelector = function (_a) {
|
|
|
8675
8660
|
if (tagOptions === null || tagOptions === void 0 ? void 0 : tagOptions.length) {
|
|
8676
8661
|
var filteredTags = tagOptions.filter(function (tag) { return tag.value.indexOf(selectedValue) >= 0; });
|
|
8677
8662
|
if (filteredTags.length) {
|
|
8678
|
-
return (jsxRuntime.jsx("div", __assign({ className: "
|
|
8679
|
-
.filter(function (tag) { return tag.value.indexOf(selectedValue) >= 0; })
|
|
8680
|
-
.map(function (tag, index) { return (jsxRuntime.jsx("div", __assign({ "data-key": "".concat(tag.value, "-").concat(index), className: "cursor", onClick: onSelectValue }, { children: tag.label }))); }) })));
|
|
8663
|
+
return (jsxRuntime.jsx("div", { children: filteredTags.map(function (tag, index) { return (jsxRuntime.jsx("div", __assign({ "data-key": tag.label, className: "dc__hover-n50 lh-20 fs-13 fw-6 pt-6 pr-8 pb-6 pl-8 cursor", onClick: onSelectValue }, { children: tag.label }), "".concat(tag.value, "-").concat(index))); }) }));
|
|
8681
8664
|
}
|
|
8682
8665
|
}
|
|
8683
8666
|
return renderValidationsSuggestions();
|
|
@@ -8689,8 +8672,8 @@ var TagLabelValueSelector = function (_a) {
|
|
|
8689
8672
|
: ''), value: selectedValue, onChange: handleInputChange, onBlur: handleOnBlur, onFocus: handleOnFocus, placeholder: placeholder, tabIndex: tabIndex, refVar: refVar, dependentRef: dependentRef }) })), jsxRuntime.jsx(PopupMenu.Body, __assign({ rootClassName: "tag-".concat(selectedTagIndex, "-class"), autoWidth: true, preventWheelDisable: true }, { children: activeElement === "tag-".concat(tagInputType, "-").concat(selectedTagIndex) && renderSuggestions() }))] })));
|
|
8690
8673
|
};
|
|
8691
8674
|
|
|
8692
|
-
function
|
|
8693
|
-
var index = _a.index, tagData = _a.tagData, setTagData = _a.setTagData, removeTag = _a.removeTag, _b = _a.tabIndex, tabIndex = _b === void 0 ? 1 : _b;
|
|
8675
|
+
var TagDetails = function (_a) {
|
|
8676
|
+
var index = _a.index, tagData = _a.tagData, setTagData = _a.setTagData, removeTag = _a.removeTag, _b = _a.tabIndex, tabIndex = _b === void 0 ? 1 : _b, suggestedTagsOptions = _a.suggestedTagsOptions;
|
|
8694
8677
|
var keyRef = React.useRef(null);
|
|
8695
8678
|
var valueRef = React.useRef(null);
|
|
8696
8679
|
var deleteTag = function (e) {
|
|
@@ -8702,8 +8685,23 @@ function TagDetails(_a) {
|
|
|
8702
8685
|
_tagData.propagate = !_tagData.propagate;
|
|
8703
8686
|
setTagData(index, _tagData);
|
|
8704
8687
|
};
|
|
8705
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flexbox mb-8" }, { children: [jsxRuntime.jsx("div", __assign({ className: "dc__border h-30 pl-4 pr-4 br-4 mr-8 pointer ".concat(tagData.propagate ? 'bcn-7' : ''), onClick: propagateTagToResource }, { children: jsxRuntime.jsx(SvgInjectTag, { className: "icon-dim-20 mt-4 ".concat(tagData.propagate ? 'scn-0' : '') }) })), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.KEY, placeholder: "Enter key", tabIndex: tabIndex - 1, refVar: keyRef, dependentRef: valueRef }), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.VALUE, placeholder: "Enter value", tabIndex: tabIndex, refVar: valueRef, dependentRef: keyRef }), jsxRuntime.jsx("div", __assign({ className: "dc__border pl-4 pr-4 dc__right-radius-4 pointer flex top", onClick: deleteTag }, { children: jsxRuntime.jsx(SvgIcClose, { className: "icon-dim-20 mt-4" }) }))] })));
|
|
8706
|
-
}
|
|
8688
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flexbox mb-8" }, { children: [jsxRuntime.jsx("div", __assign({ className: "dc__border h-30 pl-4 pr-4 br-4 mr-8 pointer ".concat(tagData.propagate ? 'bcn-7' : ''), onClick: propagateTagToResource }, { children: jsxRuntime.jsx(SvgInjectTag, { className: "icon-dim-20 mt-4 ".concat(tagData.propagate ? 'scn-0' : '') }) })), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.KEY, placeholder: "Enter key", tabIndex: tabIndex - 1, refVar: keyRef, dependentRef: valueRef, tagOptions: suggestedTagsOptions }), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.VALUE, placeholder: "Enter value", tabIndex: tabIndex, refVar: valueRef, dependentRef: keyRef }), jsxRuntime.jsx("div", __assign({ className: "dc__border pl-4 pr-4 dc__right-radius-4 pointer flex top", onClick: deleteTag }, { children: jsxRuntime.jsx(SvgIcClose, { className: "icon-dim-20 mt-4" }) }))] })));
|
|
8689
|
+
};
|
|
8690
|
+
|
|
8691
|
+
var _path$1;
|
|
8692
|
+
function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
|
|
8693
|
+
var SvgIcAdd = function SvgIcAdd(props) {
|
|
8694
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
8695
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8696
|
+
width: "1em",
|
|
8697
|
+
height: "1em",
|
|
8698
|
+
viewBox: "0 0 24 24"
|
|
8699
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
8700
|
+
className: "ic-add_svg__fill-color",
|
|
8701
|
+
fill: "#999",
|
|
8702
|
+
d: "M18 13h-5v5a1 1 0 0 1-2 0v-5H6a1 1 0 0 1 0-2h5V6a1 1 0 0 1 2 0v5h5a1 1 0 0 1 0 2z"
|
|
8703
|
+
})));
|
|
8704
|
+
};
|
|
8707
8705
|
|
|
8708
8706
|
var TagLabelSelect = function (_a) {
|
|
8709
8707
|
var isCreateApp = _a.isCreateApp, labelTags = _a.labelTags, setLabelTags = _a.setLabelTags, _b = _a.tabIndex, tabIndex = _b === void 0 ? 0 : _b;
|
|
@@ -16393,6 +16391,7 @@ exports.Option = Option;
|
|
|
16393
16391
|
exports.PATTERNS = PATTERNS;
|
|
16394
16392
|
exports.PopupMenu = PopupMenu;
|
|
16395
16393
|
exports.Progressing = Progressing;
|
|
16394
|
+
exports.PropagateTagInfo = PropagateTagInfo;
|
|
16396
16395
|
exports.ROUTES = ROUTES;
|
|
16397
16396
|
exports.RadioGroup = RadioGroup;
|
|
16398
16397
|
exports.RadioGroupItem = RadioGroupItem;
|
|
@@ -16402,6 +16401,7 @@ exports.ServerError = ServerError;
|
|
|
16402
16401
|
exports.ServerErrors = ServerErrors;
|
|
16403
16402
|
exports.SingleSelectOption = SingleSelectOption;
|
|
16404
16403
|
exports.TOAST_ACCESS_DENIED = TOAST_ACCESS_DENIED;
|
|
16404
|
+
exports.TagDetails = TagDetails;
|
|
16405
16405
|
exports.TagLabelSelect = TagLabelSelect;
|
|
16406
16406
|
exports.TagLabelValueSelector = TagLabelValueSelector;
|
|
16407
16407
|
exports.TippyCustomized = TippyCustomized;
|
package/package.json
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import React, { useRef } from 'react'
|
|
2
2
|
import { ReactComponent as DeleteCross } from '../../Assets/Icon/ic-close.svg'
|
|
3
3
|
import { ReactComponent as InjectTag } from '../../Assets/Icon/inject-tag.svg'
|
|
4
|
-
import { TagDetailType } from '../Types'
|
|
5
4
|
import { TagLabelValueSelector } from './TagLabelValueSelector'
|
|
6
5
|
import { KEY_VALUE } from '../Constants'
|
|
7
6
|
import { stopPropagation } from '../Helper'
|
|
7
|
+
import { TagDetailType } from './Types'
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export const TagDetails = ({
|
|
10
|
+
index,
|
|
11
|
+
tagData,
|
|
12
|
+
setTagData,
|
|
13
|
+
removeTag,
|
|
14
|
+
tabIndex = 1,
|
|
15
|
+
suggestedTagsOptions,
|
|
16
|
+
}: TagDetailType) => {
|
|
10
17
|
const keyRef = useRef(null)
|
|
11
18
|
const valueRef = useRef(null)
|
|
12
19
|
|
|
@@ -36,6 +43,7 @@ export default function TagDetails({ index, tagData, setTagData, removeTag, tabI
|
|
|
36
43
|
tabIndex={tabIndex - 1}
|
|
37
44
|
refVar={keyRef}
|
|
38
45
|
dependentRef={valueRef}
|
|
46
|
+
tagOptions={suggestedTagsOptions}
|
|
39
47
|
/>
|
|
40
48
|
<TagLabelValueSelector
|
|
41
49
|
selectedTagIndex={index}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropagateTagInfo from './PropagateTagInfo'
|
|
3
3
|
import { ReactComponent as Add } from '../../Assets/Icon/ic-add.svg'
|
|
4
|
-
import TagDetails from './TagDetails'
|
|
5
|
-
import { TagLabelSelectType } from '../Types'
|
|
6
4
|
import { DEFAULT_TAG_DATA } from '../Constants'
|
|
5
|
+
import { TagLabelSelectType } from './Types'
|
|
6
|
+
import { TagDetails } from './TagDetails'
|
|
7
7
|
|
|
8
|
-
export const TagLabelSelect = ({
|
|
8
|
+
export const TagLabelSelect = ({
|
|
9
|
+
isCreateApp,
|
|
10
|
+
labelTags,
|
|
11
|
+
setLabelTags,
|
|
12
|
+
tabIndex = 0
|
|
13
|
+
}: TagLabelSelectType) => {
|
|
9
14
|
const setTagData = (index, tagValue): void => {
|
|
10
15
|
const _tags = [...labelTags]
|
|
11
16
|
_tags[index] = tagValue
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { TagLabelValueSelectorType } from '../Types'
|
|
3
2
|
import PopupMenu from '../PopupMenu'
|
|
4
3
|
import { ValidationRules } from './ValidationRules'
|
|
5
4
|
import { ReactComponent as ErrorCross } from '../../Assets/Icon/ic-cross.svg'
|
|
@@ -7,6 +6,7 @@ import { ReactComponent as Info } from '../../Assets/Icon/ic-info-outlined.svg'
|
|
|
7
6
|
import { KEY_VALUE } from '../Constants'
|
|
8
7
|
import { stopPropagation } from '../Helper'
|
|
9
8
|
import { ResizableTagTextArea } from './ResizableTagTextArea'
|
|
9
|
+
import { TagLabelValueSelectorType } from './Types'
|
|
10
10
|
|
|
11
11
|
export const TagLabelValueSelector = ({
|
|
12
12
|
selectedTagIndex,
|
|
@@ -34,12 +34,12 @@ export const TagLabelValueSelector = ({
|
|
|
34
34
|
}, 300)
|
|
35
35
|
}
|
|
36
36
|
const handleOnBlur = (e) => {
|
|
37
|
-
setActiveElement('')
|
|
38
37
|
if (
|
|
39
38
|
!e.relatedTarget ||
|
|
40
39
|
!e.relatedTarget.classList.value ||
|
|
41
40
|
!e.relatedTarget.classList.value.includes(`tag-${selectedTagIndex}-class`)
|
|
42
41
|
) {
|
|
42
|
+
setActiveElement('')
|
|
43
43
|
const _tagData = { ...tagData }
|
|
44
44
|
_tagData[tagInputType] = selectedValue
|
|
45
45
|
if (tagInputType === KEY_VALUE.KEY) {
|
|
@@ -107,14 +107,17 @@ export const TagLabelValueSelector = ({
|
|
|
107
107
|
const filteredTags = tagOptions.filter((tag) => tag.value.indexOf(selectedValue) >= 0)
|
|
108
108
|
if (filteredTags.length) {
|
|
109
109
|
return (
|
|
110
|
-
<div
|
|
111
|
-
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
110
|
+
<div>
|
|
111
|
+
{filteredTags.map((tag, index) => (
|
|
112
|
+
<div
|
|
113
|
+
key={`${tag.value}-${index}`}
|
|
114
|
+
data-key={tag.label}
|
|
115
|
+
className="dc__hover-n50 lh-20 fs-13 fw-6 pt-6 pr-8 pb-6 pl-8 cursor"
|
|
116
|
+
onClick={onSelectValue}
|
|
117
|
+
>
|
|
118
|
+
{tag.label}
|
|
119
|
+
</div>
|
|
120
|
+
))}
|
|
118
121
|
</div>
|
|
119
122
|
)
|
|
120
123
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { KEY_VALUE } from '../Constants'
|
|
2
|
+
import { OptionType } from '../Types'
|
|
3
|
+
|
|
4
|
+
export interface TagType {
|
|
5
|
+
id?: number
|
|
6
|
+
key: string
|
|
7
|
+
value?: string
|
|
8
|
+
description?: string
|
|
9
|
+
propagate: boolean
|
|
10
|
+
mandatoryProjectIdsCsv?: string
|
|
11
|
+
isInvalidKey?: boolean
|
|
12
|
+
isInvalidValue?: boolean
|
|
13
|
+
isSuggested?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface TagErrorType {
|
|
17
|
+
isValid: boolean
|
|
18
|
+
messages: string[]
|
|
19
|
+
}
|
|
20
|
+
export interface TagLabelSelectType {
|
|
21
|
+
isCreateApp?: boolean
|
|
22
|
+
labelTags: TagType[]
|
|
23
|
+
setLabelTags: (tagList: TagType[]) => void
|
|
24
|
+
tabIndex?: number
|
|
25
|
+
selectedProjectId?: number
|
|
26
|
+
suggestedTagsOptions?: OptionType[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface TagDetailType {
|
|
30
|
+
index: number
|
|
31
|
+
tagData: TagType
|
|
32
|
+
setTagData: (index: number, tagData: TagType) => void
|
|
33
|
+
removeTag?: (index: number) => void
|
|
34
|
+
tabIndex?: number
|
|
35
|
+
suggestedTagsOptions?: OptionType[]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface TagLabelValueSelectorType {
|
|
39
|
+
selectedTagIndex: number
|
|
40
|
+
tagData: TagType
|
|
41
|
+
setTagData: (index: number, tagData: TagType) => void
|
|
42
|
+
tagOptions?: OptionType[]
|
|
43
|
+
isRequired?: boolean
|
|
44
|
+
tagInputType?: KEY_VALUE
|
|
45
|
+
placeholder?: string
|
|
46
|
+
tabIndex?: number
|
|
47
|
+
refVar?: React.MutableRefObject<HTMLTextAreaElement>
|
|
48
|
+
dependentRef?: React.MutableRefObject<HTMLTextAreaElement>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ResizableTagTextAreaProps {
|
|
52
|
+
className?: string
|
|
53
|
+
minHeight?: number
|
|
54
|
+
maxHeight?: number
|
|
55
|
+
value?: string
|
|
56
|
+
onChange?: (e) => void
|
|
57
|
+
onBlur?: (e) => void
|
|
58
|
+
onFocus?: (e) => void
|
|
59
|
+
placeholder?: string
|
|
60
|
+
tabIndex?: number
|
|
61
|
+
refVar?: React.MutableRefObject<HTMLTextAreaElement>
|
|
62
|
+
dependentRef?: React.MutableRefObject<HTMLTextAreaElement>
|
|
63
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export {default as PropagateTagInfo} from './PropagateTagInfo'
|
|
2
|
+
export * from './TagDetails'
|
|
1
3
|
export * from './TagLabelSelect'
|
|
2
4
|
export * from './TagLabelValueSelector'
|
|
3
|
-
export * from './ResizableTagTextArea'
|
|
5
|
+
export * from './ResizableTagTextArea'
|
|
6
|
+
export * from './Types'
|
package/src/Common/Types.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { KEY_VALUE } from './Constants'
|
|
2
|
-
|
|
3
1
|
export interface ResponseType {
|
|
4
2
|
code: number
|
|
5
3
|
status: string
|
|
@@ -22,64 +20,6 @@ export enum TippyTheme {
|
|
|
22
20
|
black = 'black',
|
|
23
21
|
white = 'white',
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
export interface TagType {
|
|
27
|
-
id?: number
|
|
28
|
-
key: string
|
|
29
|
-
value?: string
|
|
30
|
-
description?: string
|
|
31
|
-
propagate: boolean
|
|
32
|
-
mandatoryProjectIdsCsv?: string
|
|
33
|
-
isInvalidKey?: boolean
|
|
34
|
-
isInvalidValue?: boolean
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface TagErrorType {
|
|
38
|
-
isValid: boolean
|
|
39
|
-
messages: string[]
|
|
40
|
-
}
|
|
41
|
-
export interface TagLabelSelectType {
|
|
42
|
-
isCreateApp?: boolean
|
|
43
|
-
labelTags: TagType[]
|
|
44
|
-
setLabelTags: (tagList: TagType[]) => void
|
|
45
|
-
tabIndex?: number
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface TagDetailType {
|
|
49
|
-
index: number
|
|
50
|
-
tagData: TagType
|
|
51
|
-
setTagData: (index: number, tagData: TagType) => void
|
|
52
|
-
removeTag: (index: number) => void
|
|
53
|
-
tabIndex?: number
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface TagLabelValueSelectorType {
|
|
57
|
-
selectedTagIndex: number
|
|
58
|
-
tagData: TagType
|
|
59
|
-
setTagData: (index: number, tagData: TagType) => void
|
|
60
|
-
tagOptions?: OptionType[]
|
|
61
|
-
isRequired?: boolean
|
|
62
|
-
tagInputType?: KEY_VALUE
|
|
63
|
-
placeholder?: string
|
|
64
|
-
tabIndex?: number
|
|
65
|
-
refVar?: React.MutableRefObject<HTMLTextAreaElement>
|
|
66
|
-
dependentRef?: React.MutableRefObject<HTMLTextAreaElement>
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface ResizableTagTextAreaProps {
|
|
70
|
-
className?: string
|
|
71
|
-
minHeight?: number
|
|
72
|
-
maxHeight?: number
|
|
73
|
-
value?: string
|
|
74
|
-
onChange?: (e) => void
|
|
75
|
-
onBlur?: (e) => void
|
|
76
|
-
onFocus?: (e) => void
|
|
77
|
-
placeholder?: string
|
|
78
|
-
tabIndex?: number
|
|
79
|
-
refVar?: React.MutableRefObject<HTMLTextAreaElement>
|
|
80
|
-
dependentRef?: React.MutableRefObject<HTMLTextAreaElement>
|
|
81
|
-
}
|
|
82
|
-
|
|
83
23
|
export interface TeamList extends ResponseType {
|
|
84
24
|
result: Teams[]
|
|
85
25
|
}
|