react-core-ts 2.0.2 → 2.0.4
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/AutoCompleteWithSelectedList.js +20 -2
- package/dist/AutoCompleteWithSelectedList.js.map +1 -1
- package/dist/AutoCompleteWithTabFilter.js +199 -41
- package/dist/AutoCompleteWithTabFilter.js.map +1 -1
- package/dist/ReactAutoComplete.d.ts +4 -4
- package/dist/ReactAutoComplete.js +98 -99
- package/dist/ReactAutoComplete.js.map +1 -1
- package/dist/commontypes.d.ts +1 -0
- package/dist/dropdownFilterTabs.d.ts +2 -0
- package/dist/dropdownFilterTabs.js +94 -22
- package/dist/dropdownFilterTabs.js.map +1 -1
- package/dist/dummyAutoCompleteWithSelectedList.js +0 -1
- package/dist/dummyAutoCompleteWithSelectedList.js.map +1 -1
- package/dist/styles/components/autocomplete.css +27 -0
- package/dist/styles/styles/components/autocomplete.css +27 -0
- package/dist/utilities/tooltip.js +0 -1
- package/dist/utilities/tooltip.js.map +1 -1
- package/docs/App.tsx +183 -123
- package/package.json +1 -1
- package/src/AutoCompleteWithSelectedList.tsx +42 -1
- package/src/AutoCompleteWithTabFilter.tsx +222 -24
- package/src/ReactAutoComplete.tsx +135 -135
- package/src/commontypes.ts +1 -0
- package/src/dropdownFilterTabs.tsx +106 -19
- package/src/dummyAutoCompleteWithSelectedList.tsx +0 -1
- package/src/styles/components/autocomplete.css +27 -0
- package/src/utilities/tooltip.tsx +0 -1
package/docs/App.tsx
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import React, { useState } from
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ExpandableAutoComplete,
|
|
9
|
-
ModernAutoComplete,
|
|
10
|
-
ModernAutoCompleteDropdown,
|
|
11
|
-
ModernTextField,
|
|
12
|
-
} from '../src/index';
|
|
13
|
-
import ModernTextArea from '../src/ReactTextArea';
|
|
14
|
-
import TextField from '../src/ReactTextField';
|
|
15
|
-
import { ValueProps } from '../src/commontypes';
|
|
16
|
-
import { treeDropData } from './store';
|
|
3
|
+
import { ValueProps } from "../src/commontypes";
|
|
4
|
+
import { AutoComplete, AutoCompleteWithSelectedList, AutoCompleteWithTabFilter, AutoCompleteWithTreeStructure, ExpandableAutoComplete, ModernAutoComplete, ModernAutoCompleteDropdown, ModernTextField } from "../src/index";
|
|
5
|
+
import ModernTextArea from "../src/ReactTextArea";
|
|
6
|
+
import TextField from "../src/ReactTextField";
|
|
7
|
+
import { treeDropData } from "./store";
|
|
17
8
|
|
|
18
|
-
import
|
|
9
|
+
import "../src/styles/global.css";
|
|
19
10
|
|
|
20
11
|
export default function App() {
|
|
21
12
|
const [dropData, setDropData] = useState();
|
|
@@ -24,9 +15,8 @@ export default function App() {
|
|
|
24
15
|
const [selectedTabItems, setSelectedTabItems] = useState<ValueProps[]>([]);
|
|
25
16
|
const [selectedItems, setSelectedItems] = useState<ValueProps[]>([]);
|
|
26
17
|
|
|
27
|
-
|
|
28
18
|
const getData = (keyName?: string, next?: number) => {
|
|
29
|
-
console.log(keyName,
|
|
19
|
+
console.log(keyName, "keyName");
|
|
30
20
|
return fetch(
|
|
31
21
|
keyName
|
|
32
22
|
? `https://jsonplaceholder.typicode.com/posts?_page=${next}&_limit=10&title_like=${keyName}`
|
|
@@ -36,7 +26,7 @@ export default function App() {
|
|
|
36
26
|
.then((res) => {
|
|
37
27
|
setNexBlock(nexBlock + 1);
|
|
38
28
|
const result = res.map((item: any) => {
|
|
39
|
-
return { ...item, [
|
|
29
|
+
return { ...item, ["name"]: item?.title, id: item?.id.toString() };
|
|
40
30
|
});
|
|
41
31
|
return result;
|
|
42
32
|
});
|
|
@@ -45,7 +35,7 @@ export default function App() {
|
|
|
45
35
|
return fetch(
|
|
46
36
|
keyName
|
|
47
37
|
? `https://jsonplaceholder.typicode.com/posts?title_like=${
|
|
48
|
-
keyName ===
|
|
38
|
+
keyName === "*" ? "" : keyName
|
|
49
39
|
}`
|
|
50
40
|
: `https://jsonplaceholder.typicode.com/posts`
|
|
51
41
|
)
|
|
@@ -53,7 +43,7 @@ export default function App() {
|
|
|
53
43
|
.then((res) => {
|
|
54
44
|
setPrev(prev + 1);
|
|
55
45
|
const result = res.map((item: any) => {
|
|
56
|
-
return { ...item, [
|
|
46
|
+
return { ...item, ["name"]: item?.title, id: item?.id.toString() };
|
|
57
47
|
});
|
|
58
48
|
return result;
|
|
59
49
|
});
|
|
@@ -74,7 +64,11 @@ export default function App() {
|
|
|
74
64
|
.then((res) => {
|
|
75
65
|
setNexBlock(nexBlock + 1);
|
|
76
66
|
const result = res.map((item: any) => {
|
|
77
|
-
return {
|
|
67
|
+
return {
|
|
68
|
+
...item,
|
|
69
|
+
["name"]: item?.title + " - " + tab?.toString(),
|
|
70
|
+
id: `${item?.id.toString()}-${tab?.toString()}`,
|
|
71
|
+
};
|
|
78
72
|
});
|
|
79
73
|
return result;
|
|
80
74
|
});
|
|
@@ -83,59 +77,107 @@ export default function App() {
|
|
|
83
77
|
<React.Fragment>
|
|
84
78
|
<div
|
|
85
79
|
style={{
|
|
86
|
-
display:
|
|
87
|
-
flexDirection:
|
|
88
|
-
alignItems:
|
|
89
|
-
justifyContent:
|
|
80
|
+
display: "flex",
|
|
81
|
+
flexDirection: "column",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
justifyContent: "center",
|
|
90
84
|
}}
|
|
91
85
|
>
|
|
92
86
|
<div
|
|
93
87
|
style={{
|
|
94
|
-
display:
|
|
95
|
-
flexDirection:
|
|
88
|
+
display: "flex",
|
|
89
|
+
flexDirection: "column",
|
|
96
90
|
gap: 20,
|
|
97
91
|
padding: 20,
|
|
98
|
-
maxWidth:
|
|
92
|
+
maxWidth: "75%",
|
|
99
93
|
|
|
100
|
-
overflowY:
|
|
94
|
+
overflowY: "scroll",
|
|
101
95
|
}}
|
|
102
96
|
>
|
|
103
|
-
|
|
104
97
|
<div style={{ width: 500 }}>
|
|
105
98
|
<AutoCompleteWithTabFilter
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
99
|
+
label="Auto Suggestion With Data"
|
|
100
|
+
name="sample"
|
|
101
|
+
type="auto_suggestion"
|
|
102
|
+
async={true}
|
|
103
|
+
typeOnlyFetch={true}
|
|
104
|
+
desc="name"
|
|
105
|
+
isMultiple={true}
|
|
106
|
+
singleSelect={false}
|
|
107
|
+
descId="id"
|
|
108
|
+
getData={getData}
|
|
109
|
+
paginationEnabled={false}
|
|
110
|
+
initialLoad={false}
|
|
111
|
+
itemCount={3}
|
|
112
|
+
placeholder="Auto Suggestion"
|
|
113
|
+
selectedItems={selectedItems}
|
|
114
|
+
onChange={(e) =>
|
|
115
|
+
setSelectedItems(Array.isArray(e) ? e : e ? [e] : [])
|
|
116
|
+
}
|
|
117
|
+
tabSelectedItems={selectedTabItems}
|
|
118
|
+
getTabData={getDataWithTab}
|
|
119
|
+
onToolTabChange={(value) =>
|
|
120
|
+
setSelectedTabItems(
|
|
121
|
+
Array.isArray(value) ? value : value ? [value] : []
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
countOnly={true}
|
|
125
|
+
toolTabClearSwitch={false}
|
|
126
|
+
enableToolsTab={true}
|
|
127
|
+
toolTabs={[
|
|
128
|
+
{ id: 1, label: "Tab 1" },
|
|
129
|
+
{ id: 2, label: "Tab 2" },
|
|
130
|
+
]}
|
|
131
|
+
tabName="sample"
|
|
132
|
+
tabDesc="name"
|
|
133
|
+
tabDescId="id"
|
|
134
|
+
enableSelectAll={true}
|
|
135
|
+
autoDropdown={true}
|
|
136
|
+
/>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div style={{ width: 500 }}>
|
|
140
|
+
<AutoCompleteWithTabFilter
|
|
141
|
+
label="Inline Auto Suggestion With Data"
|
|
142
|
+
name="sample"
|
|
143
|
+
type="auto_suggestion"
|
|
144
|
+
async={true}
|
|
145
|
+
typeOnlyFetch={true}
|
|
146
|
+
desc="name"
|
|
147
|
+
isMultiple={true}
|
|
148
|
+
singleSelect={false}
|
|
149
|
+
descId="id"
|
|
150
|
+
getData={getData}
|
|
151
|
+
paginationEnabled={false}
|
|
152
|
+
initialLoad={false}
|
|
153
|
+
itemCount={3}
|
|
154
|
+
placeholder="Auto Suggestion"
|
|
155
|
+
selectedItems={selectedItems}
|
|
156
|
+
onChange={(e) =>
|
|
157
|
+
setSelectedItems(Array.isArray(e) ? e : e ? [e] : [])
|
|
158
|
+
}
|
|
159
|
+
tabSelectedItems={selectedTabItems}
|
|
160
|
+
getTabData={getDataWithTab}
|
|
161
|
+
onToolTabChange={(value) =>
|
|
162
|
+
setSelectedTabItems(
|
|
163
|
+
Array.isArray(value) ? value : value ? [value] : []
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
countOnly={true}
|
|
167
|
+
toolTabClearSwitch={false}
|
|
168
|
+
enableToolsTab={true}
|
|
169
|
+
toolTabs={[
|
|
170
|
+
{ id: 1, label: "Tab 1" },
|
|
171
|
+
{ id: 2, label: "Tab 2" },
|
|
172
|
+
]}
|
|
173
|
+
tabName="sample"
|
|
174
|
+
tabDesc="name"
|
|
175
|
+
tabDescId="id"
|
|
176
|
+
enableSelectAll={true}
|
|
177
|
+
autoDropdown={true}
|
|
178
|
+
tabInlineSearch={false}
|
|
179
|
+
//autoTabSelectAll={false}
|
|
180
|
+
/>
|
|
139
181
|
</div>
|
|
140
182
|
|
|
141
183
|
<div style={{ width: 300 }}>
|
|
@@ -143,12 +185,12 @@ export default function App() {
|
|
|
143
185
|
name="sample"
|
|
144
186
|
label="TextField Enable Search"
|
|
145
187
|
id="id"
|
|
146
|
-
type="text"
|
|
188
|
+
type="text"
|
|
147
189
|
placeholder="TextField"
|
|
148
190
|
required
|
|
149
|
-
onChange={(e) => console.log(e,
|
|
191
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
150
192
|
enableSearch={true}
|
|
151
|
-
onSearchClick={(value) => console.log(value,
|
|
193
|
+
onSearchClick={(value) => console.log(value, "onSearchClick")}
|
|
152
194
|
/>
|
|
153
195
|
</div>
|
|
154
196
|
|
|
@@ -162,7 +204,7 @@ export default function App() {
|
|
|
162
204
|
placeholder="TextField"
|
|
163
205
|
required
|
|
164
206
|
getData={getDatas}
|
|
165
|
-
onChange={(e) => console.log(e,
|
|
207
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
166
208
|
shortCode="id"
|
|
167
209
|
labelCode="userId"
|
|
168
210
|
/>
|
|
@@ -177,7 +219,7 @@ export default function App() {
|
|
|
177
219
|
placeholder="TextField"
|
|
178
220
|
required
|
|
179
221
|
getData={getDatas}
|
|
180
|
-
onChange={(e) => console.log(e,
|
|
222
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
181
223
|
/>
|
|
182
224
|
</div>
|
|
183
225
|
|
|
@@ -210,7 +252,7 @@ export default function App() {
|
|
|
210
252
|
placeholder="Auto Suggestion"
|
|
211
253
|
selectedItems={[]}
|
|
212
254
|
getData={getData}
|
|
213
|
-
onChange={(e) => console.log(e,
|
|
255
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
214
256
|
/>
|
|
215
257
|
</div>
|
|
216
258
|
<div className="autocomplete-section">
|
|
@@ -232,7 +274,7 @@ export default function App() {
|
|
|
232
274
|
singleSelect={true}
|
|
233
275
|
expandable={true}
|
|
234
276
|
isTreeDropdown={true}
|
|
235
|
-
filterCondition={{ filterKey:
|
|
277
|
+
filterCondition={{ filterKey: "id", filterValue: 22 }}
|
|
236
278
|
descId="id"
|
|
237
279
|
data={treeDropData}
|
|
238
280
|
paginationEnabled={false}
|
|
@@ -271,11 +313,11 @@ export default function App() {
|
|
|
271
313
|
placeholder="Auto Suggestion"
|
|
272
314
|
selectedItems={[
|
|
273
315
|
{
|
|
274
|
-
name:
|
|
316
|
+
name: "Port G - A small",
|
|
275
317
|
id: 2,
|
|
276
318
|
},
|
|
277
319
|
]}
|
|
278
|
-
onChange={(e) => console.log(e,
|
|
320
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
279
321
|
countOnly={true}
|
|
280
322
|
/>
|
|
281
323
|
</div>
|
|
@@ -293,13 +335,34 @@ export default function App() {
|
|
|
293
335
|
itemCount={3}
|
|
294
336
|
placeholder="Auto Suggestion"
|
|
295
337
|
selectedItems={[]}
|
|
296
|
-
onChange={(e) => console.log(e,
|
|
338
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
297
339
|
countOnly={true}
|
|
298
340
|
enableSelectAll={true}
|
|
299
341
|
autoDropdown={true}
|
|
300
342
|
/>
|
|
301
343
|
</div>
|
|
302
|
-
|
|
344
|
+
|
|
345
|
+
<div style={{ width: 300 }}>
|
|
346
|
+
<AutoCompleteWithSelectedList
|
|
347
|
+
label="Inline Auto Suggestion API Data"
|
|
348
|
+
name="sample"
|
|
349
|
+
type="auto_suggestion"
|
|
350
|
+
async={true}
|
|
351
|
+
desc="name"
|
|
352
|
+
isMultiple={true}
|
|
353
|
+
typeOnlyFetch={true}
|
|
354
|
+
descId="id"
|
|
355
|
+
getData={getData}
|
|
356
|
+
itemCount={3}
|
|
357
|
+
placeholder="Auto Suggestion"
|
|
358
|
+
selectedItems={[]}
|
|
359
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
360
|
+
countOnly={true}
|
|
361
|
+
enableSelectAll={true}
|
|
362
|
+
autoDropdown={true}
|
|
363
|
+
tabInlineSearch={false}
|
|
364
|
+
/>
|
|
365
|
+
</div>
|
|
303
366
|
|
|
304
367
|
<div style={{ width: 300 }}>
|
|
305
368
|
<AutoCompleteWithSelectedList
|
|
@@ -315,16 +378,19 @@ export default function App() {
|
|
|
315
378
|
itemCount={3}
|
|
316
379
|
placeholder="Auto Suggestion"
|
|
317
380
|
selectedItems={[]}
|
|
318
|
-
onChange={(e) => console.log(e,
|
|
381
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
319
382
|
countOnly={true}
|
|
320
383
|
tab={[
|
|
321
|
-
{ id: 1, label:
|
|
322
|
-
{ id: 2, label:
|
|
384
|
+
{ id: 1, label: "Tab 1" },
|
|
385
|
+
{ id: 2, label: "Tab 2" },
|
|
323
386
|
]}
|
|
324
387
|
clearTabSwitch={true}
|
|
325
388
|
tabInlineSearch={false}
|
|
326
|
-
|
|
327
|
-
|
|
389
|
+
// autoDropdown={true}
|
|
390
|
+
searchValue="Hello"
|
|
391
|
+
onSearchValueChange={(value) =>
|
|
392
|
+
console.log(value, "onSearchValueChange")
|
|
393
|
+
}
|
|
328
394
|
/>
|
|
329
395
|
</div>
|
|
330
396
|
|
|
@@ -342,11 +408,11 @@ export default function App() {
|
|
|
342
408
|
itemCount={3}
|
|
343
409
|
placeholder="Auto Suggestion"
|
|
344
410
|
selectedItems={[]}
|
|
345
|
-
onChange={(e) => console.log(e,
|
|
411
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
346
412
|
countOnly={true}
|
|
347
413
|
tab={[
|
|
348
|
-
{ id: 1, label:
|
|
349
|
-
{ id: 2, label:
|
|
414
|
+
{ id: 1, label: "Tab 1" },
|
|
415
|
+
{ id: 2, label: "Tab 2" },
|
|
350
416
|
]}
|
|
351
417
|
clearTabSwitch={true}
|
|
352
418
|
tabInlineSearch={true}
|
|
@@ -368,18 +434,11 @@ export default function App() {
|
|
|
368
434
|
desc="name"
|
|
369
435
|
isMultiple={true}
|
|
370
436
|
selectedItems={[]}
|
|
437
|
+
initialLoad={true}
|
|
371
438
|
descId="id"
|
|
372
439
|
type="custom_select"
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
{ name: 'test1', id: '2' },
|
|
376
|
-
|
|
377
|
-
{ name: 'test2', id: '3' },
|
|
378
|
-
|
|
379
|
-
{ name: 'test3', id: '4' },
|
|
380
|
-
]}
|
|
381
|
-
// getData={getData}
|
|
382
|
-
onChange={() => console.log('onchange')}
|
|
440
|
+
getData={getData}
|
|
441
|
+
onChange={() => console.log("onchange")}
|
|
383
442
|
/>
|
|
384
443
|
</div>
|
|
385
444
|
<div className="autocomplete-section">
|
|
@@ -403,7 +462,7 @@ export default function App() {
|
|
|
403
462
|
placeholder="Auto Complete"
|
|
404
463
|
// data={[{ name: 'test', id: '1' }]}
|
|
405
464
|
getData={getData}
|
|
406
|
-
onChange={() => console.log(
|
|
465
|
+
onChange={() => console.log("onchange")}
|
|
407
466
|
/>
|
|
408
467
|
</div>
|
|
409
468
|
<div style={{ width: 300 }}>
|
|
@@ -417,7 +476,7 @@ export default function App() {
|
|
|
417
476
|
placeholder="Auto Complete"
|
|
418
477
|
// data={[{ name: 'test', id: '1' }]}
|
|
419
478
|
getData={getDatas}
|
|
420
|
-
onChange={() => console.log(
|
|
479
|
+
onChange={() => console.log("onchange")}
|
|
421
480
|
/>
|
|
422
481
|
</div>
|
|
423
482
|
<div className="autocomplete-section">
|
|
@@ -439,18 +498,18 @@ export default function App() {
|
|
|
439
498
|
descId="id"
|
|
440
499
|
type="custom_search_select"
|
|
441
500
|
data={[
|
|
442
|
-
{ name:
|
|
443
|
-
{ name:
|
|
444
|
-
{ name:
|
|
445
|
-
{ name:
|
|
446
|
-
{ name:
|
|
447
|
-
{ name:
|
|
448
|
-
{ name:
|
|
449
|
-
{ name:
|
|
450
|
-
{ name:
|
|
451
|
-
{ name:
|
|
501
|
+
{ name: "Apple", id: "1" },
|
|
502
|
+
{ name: "Banana", id: "2" },
|
|
503
|
+
{ name: "Cherry", id: "3" },
|
|
504
|
+
{ name: "Date", id: "4" },
|
|
505
|
+
{ name: "Fig", id: "5" },
|
|
506
|
+
{ name: "Grape", id: "6" },
|
|
507
|
+
{ name: "Honeydew", id: "7" },
|
|
508
|
+
{ name: "Kiwi", id: "8" },
|
|
509
|
+
{ name: "Lemon", id: "9" },
|
|
510
|
+
{ name: "Mango", id: "10" },
|
|
452
511
|
]}
|
|
453
|
-
onChange={() => console.log(
|
|
512
|
+
onChange={() => console.log("onchange")}
|
|
454
513
|
/>
|
|
455
514
|
</div>
|
|
456
515
|
<div className="autocomplete-section">
|
|
@@ -473,7 +532,7 @@ export default function App() {
|
|
|
473
532
|
placeholder="Auto Suggestion"
|
|
474
533
|
// data={[{ name: 'test', id: '1' }]}
|
|
475
534
|
getData={getData}
|
|
476
|
-
onChange={() => console.log(
|
|
535
|
+
onChange={() => console.log("onchange")}
|
|
477
536
|
/>
|
|
478
537
|
</div>
|
|
479
538
|
<div style={{ width: 300 }}>
|
|
@@ -483,14 +542,15 @@ export default function App() {
|
|
|
483
542
|
type="auto_suggestion"
|
|
484
543
|
required
|
|
485
544
|
desc="name"
|
|
545
|
+
|
|
486
546
|
async
|
|
487
547
|
isMultiple
|
|
488
548
|
descId="id"
|
|
489
549
|
placeholder="Auto Suggestion"
|
|
490
|
-
selectedItems={[{ name:
|
|
550
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
491
551
|
// data={[{ name: 'test', id: '1' }]}
|
|
492
552
|
getData={getData}
|
|
493
|
-
onChange={(value) => console.log(value,
|
|
553
|
+
onChange={(value) => console.log(value, "onchange")}
|
|
494
554
|
/>
|
|
495
555
|
</div>
|
|
496
556
|
<div style={{ width: 300 }}>
|
|
@@ -506,9 +566,9 @@ export default function App() {
|
|
|
506
566
|
initialLoad={true}
|
|
507
567
|
// nextBlock={nexBlock}
|
|
508
568
|
placeholder="Auto Suggestion"
|
|
509
|
-
selectedItems={[{ name:
|
|
569
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
510
570
|
getData={getData}
|
|
511
|
-
onChange={(e) => console.log(e,
|
|
571
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
512
572
|
/>
|
|
513
573
|
</div>
|
|
514
574
|
|
|
@@ -536,9 +596,9 @@ export default function App() {
|
|
|
536
596
|
itemCount={5}
|
|
537
597
|
// nextBlock={nexBlock}
|
|
538
598
|
placeholder="Auto Suggestion"
|
|
539
|
-
selectedItems={[{ name:
|
|
599
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
540
600
|
getData={getData}
|
|
541
|
-
onChange={(e) => console.log(e,
|
|
601
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
542
602
|
/>
|
|
543
603
|
</div>
|
|
544
604
|
<div className="autocomplete-section">
|
|
@@ -559,7 +619,7 @@ export default function App() {
|
|
|
559
619
|
adorementPosition="start"
|
|
560
620
|
placeholder="TextField"
|
|
561
621
|
required
|
|
562
|
-
onChange={(e) => console.log(e,
|
|
622
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
563
623
|
/>
|
|
564
624
|
</div>
|
|
565
625
|
<div style={{ width: 300 }}>
|
|
@@ -579,15 +639,15 @@ export default function App() {
|
|
|
579
639
|
itemCount={3}
|
|
580
640
|
placeholder="Auto Suggestion"
|
|
581
641
|
selectedItems={[
|
|
582
|
-
{ id: 1, name:
|
|
583
|
-
{ id: 2, name:
|
|
584
|
-
{ id: 3, name:
|
|
585
|
-
{ id: 4, name:
|
|
586
|
-
{ id: 5, name:
|
|
587
|
-
{ id: 6, name:
|
|
588
|
-
{ id: 7, name:
|
|
642
|
+
{ id: 1, name: "testssdfsdfsdfsd sdvsdf" },
|
|
643
|
+
{ id: 2, name: "test1 slkdflksmflksd" },
|
|
644
|
+
{ id: 3, name: "test2 lsdfkslkdfmlksdf" },
|
|
645
|
+
{ id: 4, name: "test3 lksdmflkmsflkms" },
|
|
646
|
+
{ id: 5, name: "test4lskdmflksldkf sdf" },
|
|
647
|
+
{ id: 6, name: "test5lksdlkf sdf" },
|
|
648
|
+
{ id: 7, name: "test6lksdlf sdf" },
|
|
589
649
|
]}
|
|
590
|
-
onChange={(e) => console.log(e,
|
|
650
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
591
651
|
countOnly={true}
|
|
592
652
|
/>
|
|
593
653
|
</div>
|
|
@@ -598,7 +658,7 @@ export default function App() {
|
|
|
598
658
|
placeholder="efsdf"
|
|
599
659
|
label="sdfsdfsd"
|
|
600
660
|
value=""
|
|
601
|
-
onChange={(e) => console.log(e,
|
|
661
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
602
662
|
/>
|
|
603
663
|
</div>
|
|
604
664
|
</div>
|
package/package.json
CHANGED
|
@@ -827,6 +827,24 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
827
827
|
};
|
|
828
828
|
|
|
829
829
|
const handleOpenDropdown = (e: any) => {
|
|
830
|
+
|
|
831
|
+
if (!tabInlineSearch) {
|
|
832
|
+
// Toggle the main dropdown when not using inline search
|
|
833
|
+
if (dropOpen && visible && allDataLoaded) {
|
|
834
|
+
// If dropdown is open and visible, close it
|
|
835
|
+
setDropOpen(false);
|
|
836
|
+
setVisible(false);
|
|
837
|
+
setAllDataLoaded(false);
|
|
838
|
+
return
|
|
839
|
+
} else if (!dropOpen) {
|
|
840
|
+
// If dropdown is closed, open it
|
|
841
|
+
setVisibleDrop();
|
|
842
|
+
} else if (dropOpen && !visible) {
|
|
843
|
+
// If dropdown is open but not visible, make it visible
|
|
844
|
+
setVisible(true);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
830
848
|
if (!suggestions || suggestions?.length === 0 || refetchData) {
|
|
831
849
|
if (autoDropdown && (inputValue === '' || inputValue.trim() === '')) {
|
|
832
850
|
if (tabInlineSearch && tab.length > 0) {
|
|
@@ -903,7 +921,7 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
903
921
|
{!countOnly ? (
|
|
904
922
|
getSelectedItems(false)
|
|
905
923
|
) : !tabInlineSearch ? (
|
|
906
|
-
<div className=
|
|
924
|
+
<div className={`selected-items-counter-container qbs-text-sm qbs-gap-1 ${!tabInlineSearch && autoDropdown ? 'selected-item-nontool-direct-counter' : ''}`}>
|
|
907
925
|
<Tooltip title={allSelectedTooltipContent} enabled={selectedItems?.length > 0 ? true : false}>
|
|
908
926
|
<span className="badge qbs-rounded-full qbs-text-xs qbs-inline-flex qbs-items-center qbs-justify-center qbs-px-2 qbs-py-1 qbs-leading-none qbs-min-w-6 qbs-min-h-6">
|
|
909
927
|
{selectedItems?.length}
|
|
@@ -934,6 +952,28 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
934
952
|
</>
|
|
935
953
|
)}
|
|
936
954
|
|
|
955
|
+
<>
|
|
956
|
+
{autoDropdown && !tabInlineSearch && !disabled && !readOnly && (
|
|
957
|
+
<div className={`qbs-inline-all-dropdown-btn ${!tabInlineSearch && autoDropdown ? 'qbs-inline-all-direct-dropdown-btn' : ''}`}>
|
|
958
|
+
<button
|
|
959
|
+
disabled={disabled ?? readOnly}
|
|
960
|
+
onClick={(e) => handleOpenDropdown(e)}
|
|
961
|
+
className="text-[#667085] focus-visible:outline-slate-100 absolute right-2 qbs-all-dropdown-btn"
|
|
962
|
+
data-testid="drop-arrow"
|
|
963
|
+
type="button"
|
|
964
|
+
id="autocomplete-drop-icon"
|
|
965
|
+
ref={dropBtnRef}
|
|
966
|
+
>
|
|
967
|
+
<AllDropArrow
|
|
968
|
+
type={!allDataLoaded ? 'down' : 'up'}
|
|
969
|
+
uniqueId="all-dropdow-arrow-icon"
|
|
970
|
+
className="all-dropdow-arrow-icon"
|
|
971
|
+
/>
|
|
972
|
+
</button>
|
|
973
|
+
</div>
|
|
974
|
+
)}
|
|
975
|
+
</>
|
|
976
|
+
|
|
937
977
|
<div
|
|
938
978
|
className={`qbs-textfield-expandable ${
|
|
939
979
|
!expandable ? 'qbs-normal' : ''
|
|
@@ -1002,6 +1042,7 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
1002
1042
|
countOnly={countOnly}
|
|
1003
1043
|
uniqueDropArrowId={uniqueDropArrowId}
|
|
1004
1044
|
viewMode={viewMode}
|
|
1045
|
+
autoDropdown={autoDropdown && !tabInlineSearch ? true : false}
|
|
1005
1046
|
/>
|
|
1006
1047
|
{/* Displaying Loading Spinner */}
|
|
1007
1048
|
|