@capillarytech/blaze-ui 6.3.0 → 6.5.0
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/CapMobileDateRangePicker/index.d.ts.map +1 -1
- package/CapMobileDateRangePicker/index.js +6 -12
- package/CapMobileDateRangePicker/utils.d.ts +3 -0
- package/CapMobileDateRangePicker/utils.d.ts.map +1 -0
- package/CapMobileDateRangePicker/utils.js +5 -0
- package/CapPopoverTree/index.d.ts +3 -40
- package/CapPopoverTree/index.d.ts.map +1 -1
- package/CapPopoverTree/index.js +72 -82
- package/CapPopoverTree/style.d.ts +5 -1
- package/CapPopoverTree/style.d.ts.map +1 -1
- package/CapPopoverTree/styles.css +119 -18
- package/CapPopoverTree/styles.module.scss.js +26 -0
- package/CapPopoverTree/styles.scss +179 -31
- package/CapPopoverTree/tests/CapPopoverTree.mockData.d.ts +22 -0
- package/CapPopoverTree/tests/CapPopoverTree.mockData.d.ts.map +1 -0
- package/CapPopoverTree/types.d.ts +62 -0
- package/CapPopoverTree/types.d.ts.map +1 -0
- package/CapPopoverTree/types.js +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapMobileDateRangePicker/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAoD,MAAM,OAAO,CAAC;AAiBzE,OAAO,KAAK,EAAE,6BAA6B,EAAgC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapMobileDateRangePicker/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAoD,MAAM,OAAO,CAAC;AAiBzE,OAAO,KAAK,EAAE,6BAA6B,EAAgC,MAAM,SAAS,CAAC;AAG3F,eAAO,MAAM,SAAS,iCAAiC,CAAC;;AAgTxD,wBAAmF;AACnF,YAAY,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import moment from "moment";
|
|
4
|
-
import { useState,
|
|
4
|
+
import { useState, useEffect, useCallback, useMemo } from "react";
|
|
5
5
|
import { injectIntl } from "react-intl";
|
|
6
|
-
import { RANGE_PICKER,
|
|
6
|
+
import { RANGE_PICKER, TIME_UNITS, FORMAT_TOKENS, WEEKDAY_MAP, MONTH_MAP } from "../utils/dayjs.js";
|
|
7
7
|
import CapColumn from "../CapColumn/index.js";
|
|
8
8
|
import CapDateRangePicker from "../CapDateRangePicker/index.js";
|
|
9
9
|
import CapDivider from "../CapDivider/index.js";
|
|
@@ -14,6 +14,7 @@ import DateRangeInputSelectors_default from "./DateRangeInputSelectors.js";
|
|
|
14
14
|
import messages from "./messages.js";
|
|
15
15
|
import ReactMobileDatePicker from "./ReactMobileDatePickerModule.js";
|
|
16
16
|
import styles from "./styles.module.scss.js";
|
|
17
|
+
import { checkIfSameDate } from "./utils.js";
|
|
17
18
|
const clsPrefix = "cap-mobile-date-range-picker";
|
|
18
19
|
const dateConfig = {
|
|
19
20
|
date: {
|
|
@@ -54,12 +55,9 @@ const CapMobileDateRangePicker = ({
|
|
|
54
55
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
55
56
|
const [focusedInput, setFocusedInput] = useState(RANGE_PICKER.START_DATE);
|
|
56
57
|
const [isDatePickerVisible, setIsDatePickerVisible] = useState(false);
|
|
57
|
-
const isComparing =
|
|
58
|
-
const isStartDateFocused =
|
|
59
|
-
|
|
60
|
-
[focusedInput]
|
|
61
|
-
);
|
|
62
|
-
const isEndDateFocused = useMemo(() => focusedInput === RANGE_PICKER.END_DATE, [focusedInput]);
|
|
58
|
+
const isComparing = type === "compare";
|
|
59
|
+
const isStartDateFocused = focusedInput === RANGE_PICKER.START_DATE;
|
|
60
|
+
const isEndDateFocused = focusedInput === RANGE_PICKER.END_DATE;
|
|
63
61
|
useEffect(() => {
|
|
64
62
|
const isSameStart = checkIfSameDate(startDateProp, startDate);
|
|
65
63
|
const isSameEnd = checkIfSameDate(endDateProp, endDate);
|
|
@@ -68,10 +66,6 @@ const CapMobileDateRangePicker = ({
|
|
|
68
66
|
setEndDate(endDateProp);
|
|
69
67
|
}
|
|
70
68
|
}, [startDateProp, endDateProp]);
|
|
71
|
-
const checkIfSameDate = useCallback(
|
|
72
|
-
(d1, d2) => d1.format(FORMAT_TOKENS.ISO_8601_DATE) === d2.format(FORMAT_TOKENS.ISO_8601_DATE),
|
|
73
|
-
[]
|
|
74
|
-
);
|
|
75
69
|
const toggleFocusedInput = useCallback(
|
|
76
70
|
(inputType = "", onClickHandler) => {
|
|
77
71
|
if (inputType === "") {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../components/CapMobileDateRangePicker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,MAAM,CAAC,MAAM,YACe,CAAC"}
|
|
@@ -1,43 +1,6 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import './
|
|
4
|
-
export declare const CapPopoverTree:
|
|
5
|
-
|
|
6
|
-
defaultProps: {
|
|
7
|
-
trigger: string;
|
|
8
|
-
placement: string;
|
|
9
|
-
showIcon: boolean;
|
|
10
|
-
blockNode: boolean;
|
|
11
|
-
defaultExpandAll: boolean;
|
|
12
|
-
isLoadingData: boolean;
|
|
13
|
-
switcherIcon: import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
renderOnKeyChange: boolean;
|
|
15
|
-
};
|
|
16
|
-
propTypes: {
|
|
17
|
-
trigger: PropTypes.Requireable<string>;
|
|
18
|
-
placement: PropTypes.Requireable<string>;
|
|
19
|
-
className: PropTypes.Requireable<string>;
|
|
20
|
-
defaultExpandAll: PropTypes.Requireable<boolean>;
|
|
21
|
-
overlayClassName: PropTypes.Requireable<string>;
|
|
22
|
-
showIcon: PropTypes.Requireable<boolean>;
|
|
23
|
-
blockNode: PropTypes.Requireable<boolean>;
|
|
24
|
-
propsTreeData: PropTypes.Requireable<any[]>;
|
|
25
|
-
switcherIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
26
|
-
TriggerComponent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
27
|
-
componentText: PropTypes.Requireable<string>;
|
|
28
|
-
triggerProps: PropTypes.Requireable<object>;
|
|
29
|
-
isTriggerDisabled: PropTypes.Requireable<boolean>;
|
|
30
|
-
triggerDisabledText: PropTypes.Requireable<string>;
|
|
31
|
-
tooltipText: PropTypes.Requireable<string>;
|
|
32
|
-
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
|
-
propsSelectedKey: PropTypes.Requireable<any[]>;
|
|
34
|
-
isLoadingData: PropTypes.Requireable<boolean>;
|
|
35
|
-
loadingTip: PropTypes.Requireable<string>;
|
|
36
|
-
searchPlaceholder: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
37
|
-
emptyDataMessage: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
|
38
|
-
renderOnKeyChange: PropTypes.Requireable<boolean>;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
declare const _default: React.ComponentType<Omit<any, "intl">>;
|
|
2
|
+
import type { CapPopoverTreeProps } from './types';
|
|
3
|
+
export declare const CapPopoverTree: (props: CapPopoverTreeProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const _default: React.ComponentType<Omit<CapPopoverTreeProps & import("react-intl").WrappedComponentProps, "intl">>;
|
|
42
5
|
export default _default;
|
|
43
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapPopoverTree/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapPopoverTree/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,OAAO,KAAK,EAAE,mBAAmB,EAAgB,MAAM,SAAS,CAAC;AAKjE,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,4CA8OxD,CAAC;;AAEF,wBAEG"}
|
package/CapPopoverTree/index.js
CHANGED
|
@@ -1,54 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { InfoCircleOutlined } from "@ant-design-v5/icons";
|
|
3
|
+
import { Tree, Input, Tooltip } from "antd-v5";
|
|
3
4
|
import classNames from "classnames";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
5
|
import { useState, useEffect } from "react";
|
|
6
|
+
import CapColumn from "../CapColumn/index.js";
|
|
6
7
|
import CapHeadingWithStatic from "../CapHeading/index.js";
|
|
7
|
-
import
|
|
8
|
+
import CapIcon from "../CapIcon/index.js";
|
|
8
9
|
import CapPopover from "../CapPopover/index.js";
|
|
9
10
|
import CapRow from "../CapRow/index.js";
|
|
10
11
|
import CapSpin from "../CapSpin/index.js";
|
|
11
12
|
import CapTooltip from "../CapTooltip/index.js";
|
|
13
|
+
import CapTree from "../CapTree/index.js";
|
|
12
14
|
import LocaleHoc from "../LocaleHoc/index.js";
|
|
13
|
-
import
|
|
14
|
-
import './styles.css';/* empty css */
|
|
15
|
+
import styles from "./styles.module.scss.js";
|
|
15
16
|
const { TreeNode } = Tree;
|
|
16
|
-
const { Search } = InputFinal;
|
|
17
17
|
const clsPrefix = "cap-popover-tree-v2";
|
|
18
18
|
const CapPopoverTree = (props) => {
|
|
19
19
|
var _a;
|
|
20
20
|
const {
|
|
21
21
|
treeData: propsTreeData = [],
|
|
22
22
|
overlayClassName,
|
|
23
|
-
trigger,
|
|
23
|
+
trigger = "click",
|
|
24
24
|
TriggerComponent,
|
|
25
25
|
componentText,
|
|
26
26
|
triggerProps,
|
|
27
27
|
isTriggerDisabled,
|
|
28
28
|
triggerDisabledText,
|
|
29
29
|
tooltipText,
|
|
30
|
-
isLoadingData,
|
|
30
|
+
isLoadingData = false,
|
|
31
31
|
loadingTip,
|
|
32
|
-
placement,
|
|
33
|
-
switcherIcon,
|
|
32
|
+
placement = "rightBottom",
|
|
33
|
+
switcherIcon = /* @__PURE__ */ jsx(CapIcon, { className: styles.expandIcon, size: "m", type: "chevron-down" }),
|
|
34
34
|
className,
|
|
35
|
-
defaultExpandAll,
|
|
35
|
+
defaultExpandAll = false,
|
|
36
36
|
onSelect,
|
|
37
37
|
selectedKey: propsSelectedKey,
|
|
38
38
|
emptyDataMessage,
|
|
39
39
|
searchPlaceholder,
|
|
40
|
-
renderOnKeyChange,
|
|
40
|
+
renderOnKeyChange = false,
|
|
41
41
|
...rest
|
|
42
42
|
} = props || {};
|
|
43
|
-
const defaultExpandKey = (propsTreeData == null ? void 0 : propsTreeData.length) === 1 && ((_a = propsTreeData[0]) == null ? void 0 : _a.key);
|
|
43
|
+
const defaultExpandKey = (propsTreeData == null ? void 0 : propsTreeData.length) === 1 && ((_a = propsTreeData[0]) == null ? void 0 : _a.key) ? propsTreeData[0].key : null;
|
|
44
44
|
const [searchText, setSearchText] = useState(null);
|
|
45
45
|
const [showPopover, setShowPopover] = useState(null);
|
|
46
46
|
const [filteredTreeData, setFilteredTreeData] = useState(propsTreeData || []);
|
|
47
|
-
const [expandedKeys, setExpandedKeys] = useState(
|
|
47
|
+
const [expandedKeys, setExpandedKeys] = useState(
|
|
48
|
+
defaultExpandKey ? [defaultExpandKey] : []
|
|
49
|
+
);
|
|
48
50
|
useEffect(() => {
|
|
49
51
|
setFilteredTreeData(propsTreeData);
|
|
50
|
-
setExpandedKeys([defaultExpandKey]);
|
|
51
|
-
}, [propsTreeData]);
|
|
52
|
+
setExpandedKeys(defaultExpandKey ? [defaultExpandKey] : []);
|
|
53
|
+
}, [propsTreeData, defaultExpandKey]);
|
|
52
54
|
const handleSearch = (e) => {
|
|
53
55
|
const { value } = e.target;
|
|
54
56
|
setSearchText(value);
|
|
@@ -63,13 +65,15 @@ const CapPopoverTree = (props) => {
|
|
|
63
65
|
}
|
|
64
66
|
setExpandedKeys(keys);
|
|
65
67
|
};
|
|
66
|
-
const handleSelect = (selectedKey,
|
|
67
|
-
const {
|
|
68
|
+
const handleSelect = (selectedKey, info) => {
|
|
69
|
+
const { node } = info;
|
|
70
|
+
const nodeProps = node == null ? void 0 : node.props;
|
|
71
|
+
const { isLeafNode, eventKey, expanded } = nodeProps || {};
|
|
68
72
|
if (isLeafNode) {
|
|
69
73
|
setShowPopover(false);
|
|
70
|
-
onSelect(selectedKey);
|
|
74
|
+
onSelect == null ? void 0 : onSelect(selectedKey);
|
|
71
75
|
} else {
|
|
72
|
-
const key = expanded ? [] : [eventKey];
|
|
76
|
+
const key = expanded ? [] : eventKey !== void 0 ? [eventKey] : [];
|
|
73
77
|
handleOnExpand(key);
|
|
74
78
|
}
|
|
75
79
|
};
|
|
@@ -78,25 +82,38 @@ const CapPopoverTree = (props) => {
|
|
|
78
82
|
var _a2, _b;
|
|
79
83
|
const { title, key, icon, children = [], info } = data;
|
|
80
84
|
if (title) {
|
|
81
|
-
const
|
|
85
|
+
const titleString = typeof title === "string" ? title : String(title);
|
|
86
|
+
const itemName = (_a2 = titleString == null ? void 0 : titleString.toLowerCase()) == null ? void 0 : _a2.trim();
|
|
82
87
|
const searchValue = (_b = searchText == null ? void 0 : searchText.toLowerCase()) == null ? void 0 : _b.trim();
|
|
83
|
-
const searchIndex = searchValue &&
|
|
84
|
-
const beforeString =
|
|
85
|
-
const afterString =
|
|
86
|
-
|
|
88
|
+
const searchIndex = searchValue && itemName ? itemName.indexOf(searchValue) : -1;
|
|
89
|
+
const beforeString = titleString == null ? void 0 : titleString.substr(0, searchIndex >= 0 ? searchIndex : 0);
|
|
90
|
+
const afterString = titleString == null ? void 0 : titleString.substr(
|
|
91
|
+
(searchIndex >= 0 ? searchIndex : 0) + ((searchValue == null ? void 0 : searchValue.length) || 0)
|
|
92
|
+
);
|
|
93
|
+
const matchedSearch = titleString == null ? void 0 : titleString.substr(
|
|
94
|
+
searchIndex >= 0 ? searchIndex : 0,
|
|
95
|
+
(searchValue == null ? void 0 : searchValue.length) || 0
|
|
96
|
+
);
|
|
87
97
|
const searchResult = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
88
|
-
/* @__PURE__ */ jsx(
|
|
89
|
-
/* @__PURE__ */ jsx(
|
|
90
|
-
/* @__PURE__ */ jsx(
|
|
98
|
+
/* @__PURE__ */ jsx(CapColumn, { className: styles.styledCapColumn, children: beforeString }),
|
|
99
|
+
/* @__PURE__ */ jsx(CapColumn, { className: classNames(styles.styledCapColumn, styles.matchedSearch), children: matchedSearch }),
|
|
100
|
+
/* @__PURE__ */ jsx(CapColumn, { className: styles.styledCapColumn, children: afterString })
|
|
91
101
|
] });
|
|
92
102
|
const treeNodeProps = {
|
|
93
|
-
title: /* @__PURE__ */ jsxs(
|
|
103
|
+
title: /* @__PURE__ */ jsxs(CapHeadingWithStatic, { className: classNames(styles.styledCapHeading, "tree-node-title"), children: [
|
|
94
104
|
searchIndex > -1 ? searchResult : title,
|
|
95
|
-
info && /* @__PURE__ */ jsx("span", { className: "info-tooltip", children: /* @__PURE__ */ jsx(Tooltip, { placement: "right", title: info, children: /* @__PURE__ */ jsx(
|
|
105
|
+
info && /* @__PURE__ */ jsx("span", { className: "info-tooltip", children: /* @__PURE__ */ jsx(Tooltip, { placement: "right", title: info, children: /* @__PURE__ */ jsx(InfoCircleOutlined, { className: "info-icon" }) }) })
|
|
96
106
|
] }),
|
|
97
107
|
key,
|
|
98
108
|
isLeafNode: !(children == null ? void 0 : children.length),
|
|
99
|
-
icon: icon && /* @__PURE__ */ jsx(
|
|
109
|
+
icon: icon && /* @__PURE__ */ jsx(
|
|
110
|
+
CapIcon,
|
|
111
|
+
{
|
|
112
|
+
className: classNames(styles.styledIcon, "tree-node-icon"),
|
|
113
|
+
size: "s",
|
|
114
|
+
type: icon
|
|
115
|
+
}
|
|
116
|
+
)
|
|
100
117
|
};
|
|
101
118
|
result.push(
|
|
102
119
|
/* @__PURE__ */ jsx(TreeNode, { ...treeNodeProps, children: (children == null ? void 0 : children.length) && getTreeData(children) })
|
|
@@ -114,15 +131,15 @@ const CapPopoverTree = (props) => {
|
|
|
114
131
|
return;
|
|
115
132
|
}
|
|
116
133
|
const filteredData = propsTreeData.reduce((result, currentData) => {
|
|
117
|
-
var _a3
|
|
118
|
-
const
|
|
134
|
+
var _a3;
|
|
135
|
+
const titleString = typeof (currentData == null ? void 0 : currentData.title) === "string" ? currentData.title : String((currentData == null ? void 0 : currentData.title) || "");
|
|
136
|
+
const parentName = titleString == null ? void 0 : titleString.toLowerCase();
|
|
119
137
|
const isParent = (parentName == null ? void 0 : parentName.indexOf(searchString)) > -1;
|
|
120
|
-
const childItems = (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
);
|
|
138
|
+
const childItems = (_a3 = currentData == null ? void 0 : currentData.children) == null ? void 0 : _a3.filter((childItem) => {
|
|
139
|
+
var _a4;
|
|
140
|
+
const childTitleString = typeof (childItem == null ? void 0 : childItem.title) === "string" ? childItem.title : String((childItem == null ? void 0 : childItem.title) || "");
|
|
141
|
+
return ((_a4 = childTitleString == null ? void 0 : childTitleString.toLowerCase()) == null ? void 0 : _a4.indexOf(searchString)) > -1;
|
|
142
|
+
});
|
|
126
143
|
const hasChildren = !!(childItems == null ? void 0 : childItems.length);
|
|
127
144
|
const currentDataCopy = { ...currentData };
|
|
128
145
|
if (hasChildren) {
|
|
@@ -141,16 +158,18 @@ const CapPopoverTree = (props) => {
|
|
|
141
158
|
/* @__PURE__ */ jsx(
|
|
142
159
|
CapPopover,
|
|
143
160
|
{
|
|
144
|
-
visible: showPopover,
|
|
145
|
-
onVisibleChange: setShowPopover,
|
|
161
|
+
visible: showPopover ?? void 0,
|
|
162
|
+
onVisibleChange: (visible) => setShowPopover(visible),
|
|
146
163
|
trigger,
|
|
147
164
|
placement,
|
|
148
165
|
overlayClassName: classNames(`${clsPrefix}`, overlayClassName),
|
|
149
166
|
...rest,
|
|
150
167
|
content: /* @__PURE__ */ jsx(CapRow, { className: "search-and-tree-wrapper", children: /* @__PURE__ */ jsxs(CapSpin, { spinning: isLoadingData, tip: loadingTip, children: [
|
|
151
168
|
/* @__PURE__ */ jsx(
|
|
152
|
-
|
|
169
|
+
Input,
|
|
153
170
|
{
|
|
171
|
+
prefix: /* @__PURE__ */ jsx(CapIcon, { type: "search", size: "s" }),
|
|
172
|
+
variant: "borderless",
|
|
154
173
|
placeholder: searchPlaceholder,
|
|
155
174
|
onChange: handleSearch,
|
|
156
175
|
className: "search-tree-node"
|
|
@@ -158,7 +177,7 @@ const CapPopoverTree = (props) => {
|
|
|
158
177
|
),
|
|
159
178
|
/* @__PURE__ */ jsx("div", { className: "divider" }),
|
|
160
179
|
(filteredTreeData == null ? void 0 : filteredTreeData.length) ? /* @__PURE__ */ jsx(
|
|
161
|
-
|
|
180
|
+
CapTree,
|
|
162
181
|
{
|
|
163
182
|
showIcon: true,
|
|
164
183
|
blockNode: true,
|
|
@@ -168,8 +187,11 @@ const CapPopoverTree = (props) => {
|
|
|
168
187
|
onExpand: handleOnExpand,
|
|
169
188
|
onSelect: handleSelect,
|
|
170
189
|
switcherIcon,
|
|
171
|
-
|
|
172
|
-
|
|
190
|
+
className: classNames(
|
|
191
|
+
styles.styledCapTree,
|
|
192
|
+
(expandedKeys == null ? void 0 : expandedKeys.length) && !searchText && styles.isExpanded,
|
|
193
|
+
className
|
|
194
|
+
),
|
|
173
195
|
...renderOnKeyChange ? { key: JSON.stringify(filteredTreeData) } : {},
|
|
174
196
|
...rest,
|
|
175
197
|
children: getTreeData(searchText ? filteredTreeData : propsTreeData)
|
|
@@ -178,44 +200,12 @@ const CapPopoverTree = (props) => {
|
|
|
178
200
|
] }) })
|
|
179
201
|
}
|
|
180
202
|
),
|
|
181
|
-
/* @__PURE__ */ jsx(CapRow, { children: !isTriggerDisabled ? /* @__PURE__ */ jsx(CapTooltip, { title: tooltipText, overlayClassName: "add-condition-tooltip", children: /* @__PURE__ */ jsx(TriggerComponent, { ...triggerProps, onClick: () => setShowPopover(true), children: componentText }) }) : /* @__PURE__ */ jsx(CapTooltip, { title: triggerDisabledText, children: /* @__PURE__ */ jsx("span", { className: "button-disabled-tooltip-wrapper", children: /* @__PURE__ */ jsx(TriggerComponent, { ...triggerProps, children: componentText }) }) }) })
|
|
203
|
+
/* @__PURE__ */ jsx(CapRow, { children: !isTriggerDisabled ? /* @__PURE__ */ jsx(CapTooltip, { title: tooltipText, overlayClassName: "add-condition-tooltip", children: TriggerComponent && /* @__PURE__ */ jsx(TriggerComponent, { ...triggerProps, onClick: () => setShowPopover(true), children: componentText }) }) : /* @__PURE__ */ jsx(CapTooltip, { title: triggerDisabledText, children: /* @__PURE__ */ jsx("span", { className: "button-disabled-tooltip-wrapper", children: TriggerComponent && /* @__PURE__ */ jsx(TriggerComponent, { ...triggerProps, children: componentText }) }) }) })
|
|
182
204
|
] });
|
|
183
205
|
};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
showIcon: true,
|
|
188
|
-
blockNode: true,
|
|
189
|
-
defaultExpandAll: false,
|
|
190
|
-
isLoadingData: false,
|
|
191
|
-
switcherIcon: /* @__PURE__ */ jsx(ExpandIcon, { size: "m", type: "chevron-down" }),
|
|
192
|
-
renderOnKeyChange: false
|
|
193
|
-
};
|
|
194
|
-
CapPopoverTree.propTypes = {
|
|
195
|
-
trigger: PropTypes.string,
|
|
196
|
-
placement: PropTypes.string,
|
|
197
|
-
className: PropTypes.string,
|
|
198
|
-
defaultExpandAll: PropTypes.bool,
|
|
199
|
-
overlayClassName: PropTypes.string,
|
|
200
|
-
showIcon: PropTypes.bool,
|
|
201
|
-
blockNode: PropTypes.bool,
|
|
202
|
-
propsTreeData: PropTypes.array,
|
|
203
|
-
switcherIcon: PropTypes.node,
|
|
204
|
-
TriggerComponent: PropTypes.node,
|
|
205
|
-
componentText: PropTypes.string,
|
|
206
|
-
triggerProps: PropTypes.object,
|
|
207
|
-
isTriggerDisabled: PropTypes.bool,
|
|
208
|
-
triggerDisabledText: PropTypes.string,
|
|
209
|
-
tooltipText: PropTypes.string,
|
|
210
|
-
onSelect: PropTypes.func,
|
|
211
|
-
propsSelectedKey: PropTypes.array,
|
|
212
|
-
isLoadingData: PropTypes.bool,
|
|
213
|
-
loadingTip: PropTypes.string,
|
|
214
|
-
searchPlaceholder: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
215
|
-
emptyDataMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
216
|
-
renderOnKeyChange: PropTypes.bool
|
|
217
|
-
};
|
|
218
|
-
const index = LocaleHoc(CapPopoverTree, { key: "CapPopoverTree" });
|
|
206
|
+
const index = LocaleHoc(CapPopoverTree, {
|
|
207
|
+
key: "CapPopoverTree"
|
|
208
|
+
});
|
|
219
209
|
export {
|
|
220
210
|
CapPopoverTree,
|
|
221
211
|
index as default
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
interface StyledCapTreeProps {
|
|
2
|
+
isExpanded?: boolean;
|
|
3
|
+
}
|
|
1
4
|
export declare const ExpandIcon: import("styled-components").StyledComponent<import("../CapIcon").CapIconComponent, any, {}, never>;
|
|
2
5
|
export declare const StyledIcon: import("styled-components").StyledComponent<import("../CapIcon").CapIconComponent, any, {}, never>;
|
|
3
6
|
export declare const StyledCapHeading: import("styled-components").StyledComponent<import("../CapHeading/types").CapHeadingComponent, any, {}, never>;
|
|
4
7
|
export declare const StyledCapColumn: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../CapColumn").CapColumnProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
5
|
-
export declare const StyledCapTree: import("styled-components").StyledComponent<import("react").FC<import("../CapTree").CapTreeProps>, any,
|
|
8
|
+
export declare const StyledCapTree: import("styled-components").StyledComponent<import("react").FC<import("../CapTree").CapTreeProps>, any, StyledCapTreeProps, never>;
|
|
9
|
+
export {};
|
|
6
10
|
//# sourceMappingURL=style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../components/CapPopoverTree/style.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU,oGAMtB,CAAC;AAEF,eAAO,MAAM,UAAU,oGAItB,CAAC;AAEF,eAAO,MAAM,gBAAgB,gHAI5B,CAAC;AAEF,eAAO,MAAM,eAAe,+LAE3B,CAAC;AAEF,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../components/CapPopoverTree/style.ts"],"names":[],"mappings":"AAQA,UAAU,kBAAkB;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,oGAMtB,CAAC;AAEF,eAAO,MAAM,UAAU,oGAItB,CAAC;AAEF,eAAO,MAAM,gBAAgB,gHAI5B,CAAC;AAEF,eAAO,MAAM,eAAe,+LAE3B,CAAC;AAEF,eAAO,MAAM,aAAa,oIA6DzB,CAAC"}
|
|
@@ -6,31 +6,132 @@
|
|
|
6
6
|
/* Border Width */
|
|
7
7
|
/* Transition */
|
|
8
8
|
/* Timezones Footer */
|
|
9
|
-
.
|
|
10
|
-
|
|
9
|
+
.expandIcon {
|
|
10
|
+
margin-top: 0.714rem;
|
|
11
|
+
z-index: 1;
|
|
12
|
+
}
|
|
13
|
+
.expandIcon svg {
|
|
14
|
+
height: 1.714rem;
|
|
15
|
+
width: 1.714rem;
|
|
16
|
+
}
|
|
17
|
+
.styledIcon {
|
|
18
|
+
z-index: 1;
|
|
19
|
+
padding: 0.286rem;
|
|
20
|
+
border-radius: 0.571rem;
|
|
21
|
+
background: #ebecf0;
|
|
22
|
+
}
|
|
23
|
+
.styledCapHeading {
|
|
24
|
+
display: inline;
|
|
25
|
+
margin-left: 0.286rem;
|
|
26
|
+
}
|
|
27
|
+
.styledCapColumn {
|
|
28
|
+
display: inline;
|
|
29
|
+
}
|
|
30
|
+
.matchedSearch {
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
}
|
|
33
|
+
.styledCapTree.ant-tree.cap-tree-v2 {
|
|
34
|
+
min-height: 8.857rem;
|
|
35
|
+
}
|
|
36
|
+
.styledCapTree.ant-tree.cap-tree-v2 li {
|
|
11
37
|
padding: 0;
|
|
12
|
-
min-height: 176px;
|
|
13
38
|
}
|
|
14
|
-
.ant-
|
|
15
|
-
|
|
39
|
+
.styledCapTree.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper {
|
|
40
|
+
height: 2.857rem;
|
|
41
|
+
padding: 0.643rem 0 0.786rem 0.286rem;
|
|
16
42
|
}
|
|
17
|
-
.ant-
|
|
18
|
-
|
|
19
|
-
margin-
|
|
20
|
-
padding:
|
|
43
|
+
.styledCapTree.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper:hover {
|
|
44
|
+
background-color: #faf9f4;
|
|
45
|
+
margin-left: -2.857rem;
|
|
46
|
+
padding-left: 3.143rem;
|
|
47
|
+
}
|
|
48
|
+
.styledCapTree.ant-tree.cap-tree-v2 .ant-tree-node-selected .tree-node-title {
|
|
49
|
+
color: #1d61ee;
|
|
50
|
+
}
|
|
51
|
+
.styledCapTree.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper-open {
|
|
52
|
+
margin-left: -2.857rem;
|
|
53
|
+
padding-left: 3.143rem;
|
|
54
|
+
width: 23.143rem;
|
|
55
|
+
}
|
|
56
|
+
.styledCapTree.ant-tree.cap-tree-v2.isExpanded .ant-tree-node-content-wrapper-open {
|
|
57
|
+
background: #e9f0fe;
|
|
58
|
+
border-left: 0.143rem solid #2466ea;
|
|
59
|
+
}
|
|
60
|
+
.styledCapTree.ant-tree.cap-tree-v2.isExpanded .ant-tree-node-content-wrapper-open:hover {
|
|
61
|
+
background-color: #e9f0fe;
|
|
62
|
+
}
|
|
63
|
+
.styledCapTree.ant-tree.cap-tree-v2.isExpanded .ant-tree-node-content-wrapper-open .tree-node-title {
|
|
64
|
+
color: #1d61ee;
|
|
65
|
+
}
|
|
66
|
+
.styledCapTree.ant-tree.cap-tree-v2.isExpanded .ant-tree-node-content-wrapper-open .tree-node-icon {
|
|
67
|
+
z-index: 1;
|
|
68
|
+
background: #2466ea;
|
|
69
|
+
color: #ffffff;
|
|
70
|
+
}
|
|
71
|
+
.styledCapTree.ant-tree.cap-tree-v2 .ant-tree-child-tree .ant-tree-node-content-wrapper {
|
|
72
|
+
position: relative;
|
|
73
|
+
margin-left: 1.143rem;
|
|
74
|
+
padding-left: 0;
|
|
75
|
+
width: 17.857rem;
|
|
76
|
+
}
|
|
77
|
+
.styledCapTree.ant-tree.cap-tree-v2 .ant-tree-child-tree .ant-tree-node-selected {
|
|
78
|
+
background-color: #e9f0fe;
|
|
79
|
+
}
|
|
80
|
+
.styledCapTree.ant-tree.cap-tree-v2 .ant-tree-child-tree .ant-tree-title {
|
|
81
|
+
margin-left: -0.857rem;
|
|
82
|
+
}
|
|
83
|
+
.styledCapTree.ant-tree.cap-tree-v2 .ant-tree-child-tree .ant-tree-title .info-icon {
|
|
84
|
+
position: absolute;
|
|
85
|
+
right: 1.786rem;
|
|
86
|
+
top: 1rem;
|
|
87
|
+
}
|
|
88
|
+
.isExpanded.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper-open {
|
|
89
|
+
background: #e9f0fe;
|
|
90
|
+
border-left: 0.143rem solid #2466ea;
|
|
91
|
+
}
|
|
92
|
+
.isExpanded.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper-open:hover {
|
|
93
|
+
background-color: #e9f0fe;
|
|
94
|
+
}
|
|
95
|
+
.isExpanded.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper-open .tree-node-title {
|
|
96
|
+
color: #1d61ee;
|
|
97
|
+
}
|
|
98
|
+
.isExpanded.ant-tree.cap-tree-v2 .ant-tree-node-content-wrapper-open .tree-node-icon {
|
|
99
|
+
z-index: 1;
|
|
100
|
+
background: #2466ea;
|
|
101
|
+
color: #ffffff;
|
|
102
|
+
}
|
|
103
|
+
.ant-popover.cap-popover-tree-v2 {
|
|
104
|
+
width: 23.857rem;
|
|
105
|
+
}
|
|
106
|
+
.ant-popover.cap-popover-tree-v2 .ant-popover-content {
|
|
107
|
+
padding: 0;
|
|
108
|
+
min-height: 12.571rem;
|
|
21
109
|
}
|
|
22
110
|
.ant-popover.cap-popover-tree-v2 .ant-popover-inner-content {
|
|
23
|
-
padding: 0 0
|
|
111
|
+
padding: 0 0 0.857rem 0;
|
|
112
|
+
}
|
|
113
|
+
.ant-popover.cap-popover-tree-v2 .search-and-tree-wrapper {
|
|
114
|
+
display: block;
|
|
115
|
+
}
|
|
116
|
+
.ant-popover.cap-popover-tree-v2 .search-and-tree-wrapper .ant-spin-container {
|
|
117
|
+
width: 100%;
|
|
118
|
+
}
|
|
119
|
+
.ant-popover.cap-popover-tree-v2 .search-tree-node.ant-input-affix-wrapper {
|
|
120
|
+
width: 100%;
|
|
121
|
+
padding: 0.571rem 0.857rem;
|
|
122
|
+
border-bottom: 0.071rem solid #dfe2e7;
|
|
24
123
|
}
|
|
25
|
-
.ant-popover.cap-popover-tree-v2 .search-tree-node
|
|
26
|
-
|
|
27
|
-
margin-left: 12px;
|
|
124
|
+
.ant-popover.cap-popover-tree-v2 .search-tree-node.ant-input-affix-wrapper .ant-input {
|
|
125
|
+
margin-left: 0.286rem;
|
|
28
126
|
}
|
|
29
|
-
.ant-popover.cap-popover-tree-v2 .
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
127
|
+
.ant-popover.cap-popover-tree-v2 .divider {
|
|
128
|
+
display: none;
|
|
129
|
+
}
|
|
130
|
+
.ant-popover.cap-popover-tree-v2 .empty-data-text {
|
|
131
|
+
text-align: center;
|
|
132
|
+
margin-top: 0.857rem;
|
|
133
|
+
padding: 0.714rem 0.857rem;
|
|
33
134
|
}
|
|
34
135
|
.add-condition-tooltip .ant-tooltip-inner {
|
|
35
|
-
width:
|
|
136
|
+
width: 27.571rem;
|
|
36
137
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import './styles.css';const expandIcon = "expandIcon";
|
|
2
|
+
const styledIcon = "styledIcon";
|
|
3
|
+
const styledCapHeading = "styledCapHeading";
|
|
4
|
+
const styledCapColumn = "styledCapColumn";
|
|
5
|
+
const matchedSearch = "matchedSearch";
|
|
6
|
+
const styledCapTree = "styledCapTree";
|
|
7
|
+
const isExpanded = "isExpanded";
|
|
8
|
+
const styles = {
|
|
9
|
+
expandIcon,
|
|
10
|
+
styledIcon,
|
|
11
|
+
styledCapHeading,
|
|
12
|
+
styledCapColumn,
|
|
13
|
+
matchedSearch,
|
|
14
|
+
styledCapTree,
|
|
15
|
+
isExpanded
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
styles as default,
|
|
19
|
+
expandIcon,
|
|
20
|
+
isExpanded,
|
|
21
|
+
matchedSearch,
|
|
22
|
+
styledCapColumn,
|
|
23
|
+
styledCapHeading,
|
|
24
|
+
styledCapTree,
|
|
25
|
+
styledIcon
|
|
26
|
+
};
|
|
@@ -2,38 +2,186 @@
|
|
|
2
2
|
|
|
3
3
|
$popoverTree: cap-popover-tree-v2;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
5
|
+
// ExpandIcon styles
|
|
6
|
+
.expandIcon {
|
|
7
|
+
margin-top: 0.714rem; // 10px / 14
|
|
8
|
+
z-index: 1;
|
|
9
|
+
|
|
10
|
+
svg {
|
|
11
|
+
height: 1.714rem; // 24px / 14
|
|
12
|
+
width: 1.714rem; // 24px / 14
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// StyledIcon styles
|
|
17
|
+
.styledIcon {
|
|
18
|
+
z-index: 1;
|
|
19
|
+
padding: 0.286rem; // 4px / 14
|
|
20
|
+
border-radius: 0.571rem; // 8px / 14
|
|
21
|
+
background: $CAP_G08;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// StyledCapHeading styles
|
|
25
|
+
.styledCapHeading {
|
|
26
|
+
display: inline;
|
|
27
|
+
margin-left: 0.286rem; // 4px / 14
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// StyledCapColumn styles
|
|
31
|
+
.styledCapColumn {
|
|
32
|
+
display: inline;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.matchedSearch {
|
|
36
|
+
font-weight: 500;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// StyledCapTree styles
|
|
40
|
+
.styledCapTree {
|
|
41
|
+
&.ant-tree.cap-tree-v2 {
|
|
42
|
+
min-height: 8.857rem; // 124px / 14
|
|
43
|
+
|
|
44
|
+
li {
|
|
45
|
+
padding: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ant-tree-node-content-wrapper {
|
|
49
|
+
height: 2.857rem; // 40px / 14
|
|
50
|
+
padding: 0.643rem 0 0.786rem 0.286rem; // 9px 0 11px 4px / 14
|
|
51
|
+
|
|
52
|
+
&:hover {
|
|
53
|
+
background-color: $BG_01;
|
|
54
|
+
margin-left: -2.857rem; // -40px / 14
|
|
55
|
+
padding-left: 3.143rem; // 44px / 14
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ant-tree-node-selected {
|
|
60
|
+
.tree-node-title {
|
|
61
|
+
color: $CAP_COLOR_17; // #1d61ee
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ant-tree-node-content-wrapper-open {
|
|
66
|
+
margin-left: -2.857rem; // -40px / 14
|
|
67
|
+
padding-left: 3.143rem; // 44px / 14
|
|
68
|
+
width: 23.143rem; // 324px / 14
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&.isExpanded {
|
|
72
|
+
.ant-tree-node-content-wrapper-open {
|
|
73
|
+
background: $CAP_PALE_GREY;
|
|
74
|
+
border-left: 0.143rem solid $FONT_COLOR_05; // 2px / 14
|
|
75
|
+
|
|
76
|
+
&:hover {
|
|
77
|
+
background-color: $CAP_PALE_GREY;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.tree-node-title {
|
|
81
|
+
color: $CAP_COLOR_17; // #1d61ee
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.tree-node-icon {
|
|
85
|
+
z-index: 1;
|
|
86
|
+
background: $FONT_COLOR_05;
|
|
87
|
+
color: $CAP_WHITE;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.ant-tree-child-tree {
|
|
93
|
+
.ant-tree-node-content-wrapper {
|
|
94
|
+
position: relative;
|
|
95
|
+
margin-left: 1.143rem; // 16px / 14
|
|
96
|
+
padding-left: 0;
|
|
97
|
+
width: 17.857rem; // 250px / 14
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ant-tree-node-selected {
|
|
101
|
+
background-color: $CAP_PALE_GREY;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.ant-tree-title {
|
|
105
|
+
margin-left: -0.857rem; // -12px / 14
|
|
106
|
+
|
|
107
|
+
.info-icon {
|
|
108
|
+
position: absolute;
|
|
109
|
+
right: 1.786rem; // 25px / 14
|
|
110
|
+
top: 1rem; // 14px / 14
|
|
32
111
|
}
|
|
112
|
+
}
|
|
33
113
|
}
|
|
114
|
+
}
|
|
34
115
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
116
|
+
|
|
117
|
+
// IsExpanded styles - exported as separate class for CSS module
|
|
118
|
+
.isExpanded {
|
|
119
|
+
&.ant-tree.cap-tree-v2 {
|
|
120
|
+
.ant-tree-node-content-wrapper-open {
|
|
121
|
+
background: $CAP_PALE_GREY;
|
|
122
|
+
border-left: 0.143rem solid $FONT_COLOR_05; // 2px / 14
|
|
123
|
+
|
|
124
|
+
&:hover {
|
|
125
|
+
background-color: $CAP_PALE_GREY;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.tree-node-title {
|
|
129
|
+
color: $CAP_COLOR_17; // #1d61ee
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.tree-node-icon {
|
|
133
|
+
z-index: 1;
|
|
134
|
+
background: $FONT_COLOR_05;
|
|
135
|
+
color: $CAP_WHITE;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.ant-popover.#{$popoverTree} {
|
|
142
|
+
width: 23.857rem; // 334px / 14
|
|
143
|
+
.ant-popover-content {
|
|
144
|
+
padding: 0;
|
|
145
|
+
min-height: 12.571rem; // 176px / 14
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.ant-popover-inner-content {
|
|
149
|
+
padding: 0 0 $CAP_SPACE_12 0;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.search-and-tree-wrapper {
|
|
153
|
+
display: block;
|
|
154
|
+
|
|
155
|
+
.ant-spin-container {
|
|
156
|
+
width: 100%;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.search-tree-node {
|
|
161
|
+
&.ant-input-affix-wrapper {
|
|
162
|
+
width: 100%;
|
|
163
|
+
padding: 0.571rem $CAP_SPACE_12; // 8px 12px / 14
|
|
164
|
+
border-bottom: 0.071rem solid $CAP_G07; // 1px / 14
|
|
165
|
+
|
|
166
|
+
.ant-input {
|
|
167
|
+
margin-left: 0.286rem; // 4px / 14
|
|
38
168
|
}
|
|
39
|
-
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.divider {
|
|
173
|
+
display: none; // replaced by search input bottom border
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.empty-data-text {
|
|
177
|
+
text-align: center;
|
|
178
|
+
margin-top: 0.857rem; // 12px / 14
|
|
179
|
+
padding: 0.714rem $CAP_SPACE_12; // 10px 12px / 14
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.add-condition-tooltip {
|
|
184
|
+
.ant-tooltip-inner {
|
|
185
|
+
width: 27.571rem; // 386px / 14
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CapPopoverTreeProps, TreeNodeData } from '../types';
|
|
2
|
+
export declare const basicTreeData: TreeNodeData[];
|
|
3
|
+
export declare const treeDataWithIcons: TreeNodeData[];
|
|
4
|
+
export declare const singleNodeTreeData: TreeNodeData[];
|
|
5
|
+
export declare const emptyTreeData: TreeNodeData[];
|
|
6
|
+
export declare const nestedTreeData: TreeNodeData[];
|
|
7
|
+
export declare const mockOnSelect: jest.Mock<any, any, any>;
|
|
8
|
+
export declare const defaultProps: CapPopoverTreeProps;
|
|
9
|
+
export declare const propsWithSelectedKey: CapPopoverTreeProps;
|
|
10
|
+
export declare const propsWithDisabledTrigger: CapPopoverTreeProps;
|
|
11
|
+
export declare const propsWithTooltip: CapPopoverTreeProps;
|
|
12
|
+
export declare const propsWithLoading: CapPopoverTreeProps;
|
|
13
|
+
export declare const propsWithEmptyMessage: CapPopoverTreeProps;
|
|
14
|
+
export declare const propsWithSearchPlaceholder: CapPopoverTreeProps;
|
|
15
|
+
export declare const propsWithDefaultExpandAll: CapPopoverTreeProps;
|
|
16
|
+
export declare const propsWithCustomClassName: CapPopoverTreeProps;
|
|
17
|
+
export declare const propsWithRenderOnKeyChange: CapPopoverTreeProps;
|
|
18
|
+
export declare const propsWithTriggerProps: CapPopoverTreeProps;
|
|
19
|
+
export declare const propsWithPlacement: CapPopoverTreeProps;
|
|
20
|
+
export declare const propsWithTriggerHover: CapPopoverTreeProps;
|
|
21
|
+
export declare const propsWithTriggerFocus: CapPopoverTreeProps;
|
|
22
|
+
//# sourceMappingURL=CapPopoverTree.mockData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CapPopoverTree.mockData.d.ts","sourceRoot":"","sources":["../../../components/CapPopoverTree/tests/CapPopoverTree.mockData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAElE,eAAO,MAAM,aAAa,EAAE,YAAY,EAcvC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAAY,EAW3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,YAAY,EAM5C,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,YAAY,EAAO,CAAC;AAEhD,eAAO,MAAM,cAAc,EAAE,YAAY,EAYxC,CAAC;AAEF,eAAO,MAAM,YAAY,0BAAY,CAAC;AAEtC,eAAO,MAAM,YAAY,EAAE,mBAK1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,mBAGlC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,mBAItC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,mBAG9B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,mBAI9B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,mBAInC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,mBAGxC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,mBAGvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,mBAItC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,mBAGxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,mBAGnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,mBAGhC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,mBAGnC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,mBAGnC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { TreeProps } from 'antd-v5';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import type { CapPopoverProps } from '../CapPopover/types';
|
|
4
|
+
export interface TreeNodeData {
|
|
5
|
+
title: string | React.ReactNode;
|
|
6
|
+
key: string;
|
|
7
|
+
children?: TreeNodeData[];
|
|
8
|
+
icon?: string;
|
|
9
|
+
info?: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Props for CapPopoverTree component
|
|
14
|
+
*
|
|
15
|
+
* @deprecated Props inherited from CapPopoverProps (Ant Design Popover component):
|
|
16
|
+
* - `overlayClassName` - Use `classNames.root` on CapPopover instead
|
|
17
|
+
* - `visible` - Use `open` instead (not recommended for public API - component manages popover state internally)
|
|
18
|
+
* - `onVisibleChange` - Use `onOpenChange` instead (not recommended for public API - component manages popover state internally)
|
|
19
|
+
*
|
|
20
|
+
* These deprecated props are handled internally by CapPopover with backward compatibility.
|
|
21
|
+
* They will show deprecation warnings in development mode.
|
|
22
|
+
*
|
|
23
|
+
* Note: `visible` and `onVisibleChange` are inherited from CapPopoverProps but are not recommended
|
|
24
|
+
* for use as the component manages popover state internally. Use `overlayClassName` if needed for styling.
|
|
25
|
+
*/
|
|
26
|
+
export interface CapPopoverTreeProps extends Omit<TreeProps, 'treeData' | 'onSelect' | 'className' | 'classNames' | 'styles' | 'motion'>, Omit<CapPopoverProps, 'content' | 'classNames' | 'motion'> {
|
|
27
|
+
/** Tree data structure */
|
|
28
|
+
treeData?: TreeNodeData[];
|
|
29
|
+
/** Component to use as trigger */
|
|
30
|
+
TriggerComponent?: React.ComponentType<Record<string, unknown>>;
|
|
31
|
+
/** Text to display in trigger component */
|
|
32
|
+
componentText?: string;
|
|
33
|
+
/** Props to pass to trigger component */
|
|
34
|
+
triggerProps?: Record<string, unknown>;
|
|
35
|
+
/** Whether trigger is disabled */
|
|
36
|
+
isTriggerDisabled?: boolean;
|
|
37
|
+
/** Text to show when trigger is disabled */
|
|
38
|
+
triggerDisabledText?: string;
|
|
39
|
+
/** Tooltip text */
|
|
40
|
+
tooltipText?: string;
|
|
41
|
+
/** Whether data is loading */
|
|
42
|
+
isLoadingData?: boolean;
|
|
43
|
+
/** Loading tip text */
|
|
44
|
+
loadingTip?: string;
|
|
45
|
+
/** Custom switcher icon */
|
|
46
|
+
switcherIcon?: React.ReactNode;
|
|
47
|
+
/** Additional CSS class name */
|
|
48
|
+
className?: string;
|
|
49
|
+
/** Expand all nodes by default */
|
|
50
|
+
defaultExpandAll?: boolean;
|
|
51
|
+
/** Callback when node is selected */
|
|
52
|
+
onSelect?: (selectedKey: string[]) => void;
|
|
53
|
+
/** Currently selected key */
|
|
54
|
+
selectedKey?: string[];
|
|
55
|
+
/** Message to show when tree data is empty */
|
|
56
|
+
emptyDataMessage?: string | React.ReactNode;
|
|
57
|
+
/** Placeholder text for search input */
|
|
58
|
+
searchPlaceholder?: string | React.ReactNode;
|
|
59
|
+
/** Whether to re-render tree on key change */
|
|
60
|
+
renderOnKeyChange?: boolean;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapPopoverTree/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBACf,SAAQ,IAAI,CACR,SAAS,EACT,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAC3E,EACD,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;IAC5D,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAChE,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,kCAAkC;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uBAAuB;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC3C,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,8CAA8C;IAC9C,gBAAgB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAC5C,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAC7C,8CAA8C;IAC9C,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|