react-core-ts 1.3.68 → 1.3.69
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/AutoCompleteWithTreeStructure.js +3 -4
- package/dist/AutoCompleteWithTreeStructure.js.map +1 -1
- package/dist/components/TreeNode.js +1 -2
- package/dist/components/TreeNode.js.map +1 -1
- package/dist/styles/styles/components/autocomplete.css +631 -0
- package/dist/styles/styles/components/selectedautocomplete.css +130 -0
- package/dist/styles/styles/components/tooltip.css +497 -0
- package/dist/styles/styles/components/treedropdown.css +79 -0
- package/dist/styles/styles/global.css +8 -0
- package/docs/App.tsx +10 -5
- package/package.json +1 -1
- package/src/AutoCompleteWithTreeStructure.tsx +12 -6
- package/src/components/TreeNode.tsx +19 -6
- package/src/styles/components/autocomplete.css +1 -2
- package/src/styles/components/treedropdown.css +18 -2
package/docs/App.tsx
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
AutoComplete,
|
|
5
|
+
AutoCompleteWithSelectedList,
|
|
6
|
+
AutoCompleteWithTreeStructure,
|
|
7
|
+
ExpandableAutoComplete,
|
|
8
|
+
ModernAutoComplete,
|
|
9
|
+
} from '../src/index';
|
|
4
10
|
import ModernTextArea from '../src/ReactTextArea';
|
|
5
11
|
import TextField from '../src/ReactTextField';
|
|
6
12
|
import { treeDropData } from './store';
|
|
@@ -140,9 +146,9 @@ export default function App() {
|
|
|
140
146
|
type="custom_select"
|
|
141
147
|
// async
|
|
142
148
|
desc="name"
|
|
143
|
-
isMultiple={
|
|
149
|
+
isMultiple={true}
|
|
144
150
|
flatArray={true}
|
|
145
|
-
singleSelect={
|
|
151
|
+
singleSelect={false}
|
|
146
152
|
expandable={true}
|
|
147
153
|
isTreeDropdown={true}
|
|
148
154
|
descId="id"
|
|
@@ -152,9 +158,8 @@ export default function App() {
|
|
|
152
158
|
itemCount={5}
|
|
153
159
|
// nextBlock={nexBlock}
|
|
154
160
|
placeholder="Auto Suggestion"
|
|
155
|
-
selectedItems={[{ name: 'test', id: '1' }]}
|
|
156
161
|
// getData={getData}
|
|
157
|
-
onChange={(e) =>
|
|
162
|
+
onChange={(e) => {}}
|
|
158
163
|
/>
|
|
159
164
|
</div>
|
|
160
165
|
|
package/package.json
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
forwardRef,
|
|
3
|
+
useCallback,
|
|
4
|
+
useEffect,
|
|
5
|
+
useImperativeHandle,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
2
9
|
import ReactDOM from 'react-dom';
|
|
3
10
|
|
|
4
11
|
import { AutoSuggestionInputProps } from './commontypes';
|
|
@@ -338,7 +345,6 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
338
345
|
const updateNode = (id: string, checked: boolean, dataItem: any) => {
|
|
339
346
|
let newTreeData;
|
|
340
347
|
let checkedNodes: any[] = []; // Array to store the entire checked node objects
|
|
341
|
-
|
|
342
348
|
if (isMultiple) {
|
|
343
349
|
let selectedData = [...selectedItems];
|
|
344
350
|
if (checked) {
|
|
@@ -361,19 +367,19 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
361
367
|
);
|
|
362
368
|
}
|
|
363
369
|
};
|
|
364
|
-
const handleSelect = (
|
|
370
|
+
const handleSelect = (selctedNode: any) => {
|
|
365
371
|
let TreeData = [];
|
|
366
|
-
const checked = !
|
|
372
|
+
const checked = !selctedNode?.checked;
|
|
367
373
|
if (!checked) {
|
|
368
374
|
setInputValue('');
|
|
369
375
|
onChange({ id: '', name: '' });
|
|
370
376
|
}
|
|
371
|
-
// Single-select logic: uncheck all other nodes and check only the clicked one
|
|
372
377
|
TreeData = dropDownData.map((node) =>
|
|
373
|
-
updateAllNodes(node,
|
|
378
|
+
updateAllNodes(node, selctedNode[descId], checked)
|
|
374
379
|
);
|
|
375
380
|
setDropDownData(TreeData);
|
|
376
381
|
};
|
|
382
|
+
|
|
377
383
|
const getCheckedNodes = (node: any, checkedNodes: any[]) => {
|
|
378
384
|
if (node.checked) {
|
|
379
385
|
checkedNodes.push(node); // Push the entire node object
|
|
@@ -27,7 +27,7 @@ const TreeNode: React.FC<any> = ({
|
|
|
27
27
|
const { checked } = e.target;
|
|
28
28
|
updateNode(dataItem[descId], checked, dataItem);
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
return (
|
|
32
32
|
<div>
|
|
33
33
|
<li className="qbs-tree-list-container">
|
|
@@ -51,10 +51,15 @@ const TreeNode: React.FC<any> = ({
|
|
|
51
51
|
<div
|
|
52
52
|
className={`qbs-tree-list-container-sub-container ${
|
|
53
53
|
isSelected(node, selected) ? 'checked' : ''
|
|
54
|
-
} ${node
|
|
54
|
+
} ${node.expanded ? 'qbs-expanded-child' : ''} ${
|
|
55
|
+
node?.children?.length > 0 ? '' : ' marginLeft'
|
|
56
|
+
}`}
|
|
55
57
|
>
|
|
56
58
|
{(isMultiple || singleSelect) && (
|
|
57
|
-
<div
|
|
59
|
+
<div
|
|
60
|
+
style={{ alignItems: singleSelect ? 'flex-start' : 'center' }}
|
|
61
|
+
className={`${'qbs-autocomplete-checkbox'}`}
|
|
62
|
+
>
|
|
58
63
|
{!singleSelect ? (
|
|
59
64
|
<>
|
|
60
65
|
<input
|
|
@@ -79,19 +84,27 @@ const TreeNode: React.FC<any> = ({
|
|
|
79
84
|
</label>
|
|
80
85
|
</>
|
|
81
86
|
) : (
|
|
82
|
-
<span className=
|
|
87
|
+
<span className="qbs-tree-single-select-icon">
|
|
88
|
+
{singleSelectIcon ?? <QuestionIcon />}
|
|
89
|
+
</span>
|
|
83
90
|
)}
|
|
84
91
|
</div>
|
|
85
92
|
)}
|
|
86
93
|
{singleSelect ? (
|
|
87
94
|
<span
|
|
88
95
|
onClick={() => handleSelect(node)}
|
|
89
|
-
className=
|
|
96
|
+
className={`${
|
|
97
|
+
node.expanded ? 'qbs-expanded-child' : ''
|
|
98
|
+
} qbs-tree-list-container-sub-text cursor-pointer`}
|
|
90
99
|
>
|
|
91
100
|
{node[desc]}
|
|
92
101
|
</span>
|
|
93
102
|
) : (
|
|
94
|
-
<span
|
|
103
|
+
<span
|
|
104
|
+
className={`${
|
|
105
|
+
node.expanded ? 'qbs-expanded-child' : ''
|
|
106
|
+
} qbs-tree-list-container-sub-text`}
|
|
107
|
+
>
|
|
95
108
|
{node[desc]}
|
|
96
109
|
</span>
|
|
97
110
|
)}
|
|
@@ -229,8 +229,6 @@ body * {
|
|
|
229
229
|
margin-left: 10px;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
|
|
233
|
-
|
|
234
232
|
.qbs-textfield-default.expandable {
|
|
235
233
|
height: auto;
|
|
236
234
|
border: none;
|
|
@@ -630,3 +628,4 @@ span.dropdown-search-icon {
|
|
|
630
628
|
margin-left: -5px;
|
|
631
629
|
border-color: transparent transparent #000 transparent;
|
|
632
630
|
}
|
|
631
|
+
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
padding-top: 0.5rem; /* Corresponds to py-2 in Tailwind */
|
|
19
19
|
padding-bottom: 0.5rem;
|
|
20
20
|
transition: transform 0.3s ease; /* Smooth rotation transition */
|
|
21
|
+
color: #003c71;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
.qbs-tree-list-container-sub-icon.expanded {
|
|
@@ -29,9 +30,24 @@
|
|
|
29
30
|
padding: 0.5rem; /* Corresponds to p-2 in Tailwind */
|
|
30
31
|
flex-direction: row; /* Corresponds to flex-row in Tailwind */
|
|
31
32
|
width: 100%; /* Corresponds to w-full in Tailwind */
|
|
33
|
+
color: #3d414a;
|
|
34
|
+
}
|
|
35
|
+
.qbs-tree-list-container-sub-container:hover {
|
|
36
|
+
color: #003c71;
|
|
37
|
+
background-color: rgba(141, 194, 240, 0.15) !important;
|
|
38
|
+
}
|
|
39
|
+
.qbs-tree-list-container-sub-container.qbs-expanded-child {
|
|
40
|
+
color: #003c71;
|
|
41
|
+
}
|
|
42
|
+
.qbs-tree-list-container-sub-text.qbs-expanded-child {
|
|
43
|
+
color: #003c71;
|
|
44
|
+
}
|
|
45
|
+
.qbs-tree-list-container-sub-text:hover {
|
|
46
|
+
color: #003c71;
|
|
47
|
+
/* background-color: rgba(141, 194, 240, 0.15) !important; */
|
|
32
48
|
}
|
|
33
|
-
|
|
34
49
|
.qbs-tree-list-container-sub-container.checked {
|
|
50
|
+
color: #003c71;
|
|
35
51
|
background-color: rgba(
|
|
36
52
|
141,
|
|
37
53
|
194,
|
|
@@ -59,5 +75,5 @@
|
|
|
59
75
|
font-weight: 500;
|
|
60
76
|
letter-spacing: 0.28px;
|
|
61
77
|
font-family: 'Noto Sans';
|
|
62
|
-
color: #3d414a;
|
|
78
|
+
/* color: #3d414a; */
|
|
63
79
|
}
|