react-core-ts 1.0.23 → 1.0.25
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.d.ts +4 -0
- package/dist/AutoCompleteWithTreeStructure.js +415 -0
- package/dist/AutoCompleteWithTreeStructure.js.map +1 -0
- package/dist/ExpandableAutoComplete.d.ts +2 -2
- package/dist/ExpandableAutoComplete.js +54 -71
- package/dist/ExpandableAutoComplete.js.map +1 -1
- package/dist/commontypes.d.ts +4 -1
- package/dist/components/DropdownList.d.ts +14 -0
- package/dist/components/DropdownList.js +18 -0
- package/dist/components/DropdownList.js.map +1 -0
- package/dist/components/Icons.d.ts +3 -0
- package/dist/components/Icons.js +18 -0
- package/dist/components/Icons.js.map +1 -0
- package/dist/components/InputActions.d.ts +14 -0
- package/dist/components/InputActions.js +18 -0
- package/dist/components/InputActions.js.map +1 -0
- package/dist/components/TreeNode.d.ts +3 -0
- package/dist/components/TreeNode.js +34 -0
- package/dist/components/TreeNode.js.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/styles/global.css +4 -0
- package/dist/styles/styles/components/autocomplete.css +585 -0
- package/dist/styles/styles/global.css +5 -0
- package/dist/utilities/convertFlatArraytoTreeStructure.d.ts +1 -0
- package/dist/utilities/convertFlatArraytoTreeStructure.js +29 -0
- package/dist/utilities/convertFlatArraytoTreeStructure.js.map +1 -0
- package/dist/utilities/filterSuggestions.d.ts +1 -1
- package/dist/utilities/filterSuggestions.js +4 -3
- package/dist/utilities/filterSuggestions.js.map +1 -1
- package/docs/App.tsx +65 -36
- package/docs/store.ts +67 -0
- package/package.json +6 -5
- package/postcss.config.js +4 -5
- package/src/AutoCompleteWithTreeStructure.tsx +611 -0
- package/src/ExpandableAutoComplete.tsx +83 -144
- package/src/commontypes.ts +4 -1
- package/src/components/DropdownList.tsx +70 -0
- package/src/components/Icons.tsx +38 -0
- package/src/components/InputActions.tsx +63 -0
- package/src/components/TreeNode.tsx +80 -0
- package/src/index.tsx +11 -8
- package/src/styles/global.css +4 -0
- package/src/utilities/convertFlatArraytoTreeStructure.ts +27 -0
- package/src/utilities/filterSuggestions.ts +5 -3
- package/tailwind.config.js +15 -0
- package/webpack.config.js +17 -3
package/docs/App.tsx
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import React, { useState } from
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
AutoComplete,
|
|
5
|
+
AutoCompleteWithTreeStructure,
|
|
6
|
+
ExpandableAutoComplete,
|
|
7
|
+
} from "../src/index";
|
|
4
8
|
|
|
5
|
-
import
|
|
9
|
+
import "../src/styles/global.css";
|
|
10
|
+
import { treeDropData } from "./store";
|
|
6
11
|
|
|
7
12
|
export default function App() {
|
|
8
13
|
const [dropData, setDropData] = useState();
|
|
@@ -19,7 +24,7 @@ export default function App() {
|
|
|
19
24
|
.then((res) => {
|
|
20
25
|
setNexBlock(nexBlock + 1);
|
|
21
26
|
const result = res.map((item: any) => {
|
|
22
|
-
return { ...item, [
|
|
27
|
+
return { ...item, ["name"]: item?.title, id: item?.id.toString() };
|
|
23
28
|
});
|
|
24
29
|
return result;
|
|
25
30
|
});
|
|
@@ -34,7 +39,7 @@ export default function App() {
|
|
|
34
39
|
.then((res) => {
|
|
35
40
|
setPrev(prev + 1);
|
|
36
41
|
const result = res.map((item: any) => {
|
|
37
|
-
return { ...item, [
|
|
42
|
+
return { ...item, ["name"]: item?.title, id: item?.id.toString() };
|
|
38
43
|
});
|
|
39
44
|
return result;
|
|
40
45
|
});
|
|
@@ -43,12 +48,12 @@ export default function App() {
|
|
|
43
48
|
<React.Fragment>
|
|
44
49
|
<div
|
|
45
50
|
style={{
|
|
46
|
-
display:
|
|
47
|
-
flexDirection:
|
|
51
|
+
display: "flex",
|
|
52
|
+
flexDirection: "column",
|
|
48
53
|
gap: 20,
|
|
49
54
|
padding: 20,
|
|
50
55
|
|
|
51
|
-
overflowY:
|
|
56
|
+
overflowY: "scroll",
|
|
52
57
|
}}
|
|
53
58
|
>
|
|
54
59
|
<div className="autocomplete-section">
|
|
@@ -60,7 +65,7 @@ export default function App() {
|
|
|
60
65
|
input while still offering assistance.
|
|
61
66
|
</p>
|
|
62
67
|
</div>
|
|
63
|
-
<div style={{ width:
|
|
68
|
+
<div style={{ width: 800 }}>
|
|
64
69
|
<ExpandableAutoComplete
|
|
65
70
|
label="Auto Suggestion"
|
|
66
71
|
name="sample"
|
|
@@ -75,9 +80,33 @@ export default function App() {
|
|
|
75
80
|
itemCount={5}
|
|
76
81
|
// nextBlock={nexBlock}
|
|
77
82
|
placeholder="Auto Suggestion Suggestion Suggestion Suggestion"
|
|
78
|
-
selectedItems={[{ name:
|
|
83
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
79
84
|
getData={getData}
|
|
80
|
-
onChange={(e) => console.log(e,
|
|
85
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
<div style={{ width: 800 }}>
|
|
89
|
+
<AutoCompleteWithTreeStructure
|
|
90
|
+
label="Auto Suggestion"
|
|
91
|
+
name="sample"
|
|
92
|
+
type="custom_select"
|
|
93
|
+
// async
|
|
94
|
+
desc="name"
|
|
95
|
+
isMultiple={true}
|
|
96
|
+
flatArray={true}
|
|
97
|
+
singleSelect={false}
|
|
98
|
+
expandable={true}
|
|
99
|
+
isTreeDropdown={true}
|
|
100
|
+
descId="id"
|
|
101
|
+
data={treeDropData}
|
|
102
|
+
paginationEnabled={false}
|
|
103
|
+
initialLoad={false}
|
|
104
|
+
itemCount={5}
|
|
105
|
+
// nextBlock={nexBlock}
|
|
106
|
+
placeholder="Auto Suggestion Suggestion Suggestion Suggestion"
|
|
107
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
108
|
+
// getData={getData}
|
|
109
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
81
110
|
/>
|
|
82
111
|
</div>
|
|
83
112
|
<div className="autocomplete-section">
|
|
@@ -96,15 +125,15 @@ export default function App() {
|
|
|
96
125
|
descId="id"
|
|
97
126
|
type="custom_select"
|
|
98
127
|
data={[
|
|
99
|
-
{ name:
|
|
100
|
-
{ name:
|
|
128
|
+
{ name: "test", id: "1" },
|
|
129
|
+
{ name: "test1", id: "2" },
|
|
101
130
|
|
|
102
|
-
{ name:
|
|
131
|
+
{ name: "test2", id: "3" },
|
|
103
132
|
|
|
104
|
-
{ name:
|
|
133
|
+
{ name: "test3", id: "4" },
|
|
105
134
|
]}
|
|
106
135
|
// getData={getData}
|
|
107
|
-
onChange={() => console.log(
|
|
136
|
+
onChange={() => console.log("onchange")}
|
|
108
137
|
/>
|
|
109
138
|
</div>
|
|
110
139
|
<div className="autocomplete-section">
|
|
@@ -128,7 +157,7 @@ export default function App() {
|
|
|
128
157
|
placeholder="Auto Complete"
|
|
129
158
|
// data={[{ name: 'test', id: '1' }]}
|
|
130
159
|
getData={getData}
|
|
131
|
-
onChange={() => console.log(
|
|
160
|
+
onChange={() => console.log("onchange")}
|
|
132
161
|
/>
|
|
133
162
|
</div>
|
|
134
163
|
<div style={{ width: 300 }}>
|
|
@@ -142,7 +171,7 @@ export default function App() {
|
|
|
142
171
|
placeholder="Auto Complete"
|
|
143
172
|
// data={[{ name: 'test', id: '1' }]}
|
|
144
173
|
getData={getDatas}
|
|
145
|
-
onChange={() => console.log(
|
|
174
|
+
onChange={() => console.log("onchange")}
|
|
146
175
|
/>
|
|
147
176
|
</div>
|
|
148
177
|
<div className="autocomplete-section">
|
|
@@ -164,18 +193,18 @@ export default function App() {
|
|
|
164
193
|
descId="id"
|
|
165
194
|
type="custom_search_select"
|
|
166
195
|
data={[
|
|
167
|
-
{ name:
|
|
168
|
-
{ name:
|
|
169
|
-
{ name:
|
|
170
|
-
{ name:
|
|
171
|
-
{ name:
|
|
172
|
-
{ name:
|
|
173
|
-
{ name:
|
|
174
|
-
{ name:
|
|
175
|
-
{ name:
|
|
176
|
-
{ name:
|
|
196
|
+
{ name: "Apple", id: "1" },
|
|
197
|
+
{ name: "Banana", id: "2" },
|
|
198
|
+
{ name: "Cherry", id: "3" },
|
|
199
|
+
{ name: "Date", id: "4" },
|
|
200
|
+
{ name: "Fig", id: "5" },
|
|
201
|
+
{ name: "Grape", id: "6" },
|
|
202
|
+
{ name: "Honeydew", id: "7" },
|
|
203
|
+
{ name: "Kiwi", id: "8" },
|
|
204
|
+
{ name: "Lemon", id: "9" },
|
|
205
|
+
{ name: "Mango", id: "10" },
|
|
177
206
|
]}
|
|
178
|
-
onChange={() => console.log(
|
|
207
|
+
onChange={() => console.log("onchange")}
|
|
179
208
|
/>
|
|
180
209
|
</div>
|
|
181
210
|
<div className="autocomplete-section">
|
|
@@ -198,7 +227,7 @@ export default function App() {
|
|
|
198
227
|
placeholder="Auto Suggestion"
|
|
199
228
|
// data={[{ name: 'test', id: '1' }]}
|
|
200
229
|
getData={getData}
|
|
201
|
-
onChange={() => console.log(
|
|
230
|
+
onChange={() => console.log("onchange")}
|
|
202
231
|
/>
|
|
203
232
|
</div>
|
|
204
233
|
<div style={{ width: 300 }}>
|
|
@@ -212,10 +241,10 @@ export default function App() {
|
|
|
212
241
|
isMultiple
|
|
213
242
|
descId="id"
|
|
214
243
|
placeholder="Auto Suggestion"
|
|
215
|
-
selectedItems={[{ name:
|
|
244
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
216
245
|
// data={[{ name: 'test', id: '1' }]}
|
|
217
246
|
getData={getData}
|
|
218
|
-
onChange={(value) => console.log(value,
|
|
247
|
+
onChange={(value) => console.log(value, "onchange")}
|
|
219
248
|
/>
|
|
220
249
|
</div>
|
|
221
250
|
<div style={{ width: 300 }}>
|
|
@@ -231,9 +260,9 @@ export default function App() {
|
|
|
231
260
|
initialLoad={true}
|
|
232
261
|
// nextBlock={nexBlock}
|
|
233
262
|
placeholder="Auto Suggestion"
|
|
234
|
-
selectedItems={[{ name:
|
|
263
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
235
264
|
getData={getData}
|
|
236
|
-
onChange={(e) => console.log(e,
|
|
265
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
237
266
|
/>
|
|
238
267
|
</div>
|
|
239
268
|
|
|
@@ -261,9 +290,9 @@ export default function App() {
|
|
|
261
290
|
itemCount={5}
|
|
262
291
|
// nextBlock={nexBlock}
|
|
263
292
|
placeholder="Auto Suggestion Suggestion Suggestion Suggestion"
|
|
264
|
-
selectedItems={[{ name:
|
|
293
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
265
294
|
getData={getData}
|
|
266
|
-
onChange={(e) => console.log(e,
|
|
295
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
267
296
|
/>
|
|
268
297
|
</div>
|
|
269
298
|
</div>
|
package/docs/store.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export const treeDropData = [
|
|
2
|
+
{
|
|
3
|
+
name: 'Port A - This is the main port in the northern region with significant traffic and operations',
|
|
4
|
+
id: 22,
|
|
5
|
+
parentId: null,
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
name: 'Port C - A key sub-port with heavy container traffic in the southern bay area',
|
|
9
|
+
id: 1,
|
|
10
|
+
parentId: 22,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'Port G - A small port used for local shipments and fishing operations',
|
|
14
|
+
id: 2,
|
|
15
|
+
parentId: 1,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'Port H - A minor local port focusing on fisheries and small-scale cargo',
|
|
19
|
+
id: 3,
|
|
20
|
+
parentId: 2,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Port I - A coastal port for regional trade and tourism operations',
|
|
24
|
+
id: 4,
|
|
25
|
+
parentId: 1,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Port J - A harbor for tourist cruises and commercial boats',
|
|
29
|
+
id: 5,
|
|
30
|
+
parentId: 4,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Port D - An industrial port dealing with large-scale cargo and ship repair services',
|
|
34
|
+
id: 6,
|
|
35
|
+
parentId: 22,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Port K - A dock specializing in shipbuilding and marine repairs',
|
|
39
|
+
id: 7,
|
|
40
|
+
parentId: 6,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Port L - A repair facility for both military and commercial vessels',
|
|
44
|
+
id: 8,
|
|
45
|
+
parentId: 7,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Port B - This is the largest port in the central region, supporting international trade',
|
|
49
|
+
id: 9,
|
|
50
|
+
parentId: null,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Port E - A primary export port dealing with raw materials and heavy goods',
|
|
54
|
+
id: 10,
|
|
55
|
+
parentId: 9,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'Port M - A small export hub for agricultural and mining products',
|
|
59
|
+
id: 11,
|
|
60
|
+
parentId: 10,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'Port N - A warehouse and storage center for exported goods',
|
|
64
|
+
id: 12,
|
|
65
|
+
parentId: 11,
|
|
66
|
+
},
|
|
67
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-core-ts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "React Components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,13 +38,17 @@
|
|
|
38
38
|
"@svgr/webpack": "^8.1.0",
|
|
39
39
|
"@types/react": "^18.2.24",
|
|
40
40
|
"@types/react-dom": "^18.2.9",
|
|
41
|
+
"autoprefixer": "^10.4.20",
|
|
41
42
|
"babel-loader": "^8.3.0",
|
|
42
43
|
"copy-webpack-plugin": "^11.0.0",
|
|
43
44
|
"css-loader": "^6.8.1",
|
|
44
45
|
"file-loader": "^6.2.0",
|
|
45
46
|
"html-webpack-plugin": "^4.5.2",
|
|
46
47
|
"mini-css-extract-plugin": "^2.7.6",
|
|
48
|
+
"postcss": "^8.4.47",
|
|
49
|
+
"postcss-loader": "^8.1.1",
|
|
47
50
|
"style-loader": "^3.3.3",
|
|
51
|
+
"tailwindcss": "^3.4.13",
|
|
48
52
|
"ts-loader": "^9.4.4",
|
|
49
53
|
"typescript": "^4.0.0",
|
|
50
54
|
"webpack": "^5.88.2",
|
|
@@ -53,9 +57,6 @@
|
|
|
53
57
|
},
|
|
54
58
|
"dependencies": {
|
|
55
59
|
"@babel/plugin-transform-typescript": "^7.22.15",
|
|
56
|
-
"
|
|
57
|
-
"postcss": "^8.4.31",
|
|
58
|
-
"source-map-loader": "^4.0.1",
|
|
59
|
-
"tailwindcss": "^3.3.3"
|
|
60
|
+
"source-map-loader": "^4.0.1"
|
|
60
61
|
}
|
|
61
62
|
}
|
package/postcss.config.js
CHANGED