react-core-ts 1.0.23 → 1.0.24
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 +453 -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 +3 -2
- 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/filterSuggestions.d.ts +1 -1
- package/dist/utilities/filterSuggestions.js +4 -3
- package/dist/utilities/filterSuggestions.js.map +1 -1
- package/docs/App.tsx +64 -36
- package/docs/store.ts +76 -0
- package/package.json +6 -5
- package/postcss.config.js +4 -5
- package/src/AutoCompleteWithTreeStructure.tsx +638 -0
- package/src/ExpandableAutoComplete.tsx +83 -144
- package/src/commontypes.ts +6 -5
- 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 +79 -0
- package/src/index.tsx +11 -8
- package/src/styles/global.css +4 -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,32 @@ 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
|
+
singleSelect={false}
|
|
97
|
+
expandable={true}
|
|
98
|
+
isTreeDropdown={true}
|
|
99
|
+
descId="id"
|
|
100
|
+
data={treeDropData}
|
|
101
|
+
paginationEnabled={false}
|
|
102
|
+
initialLoad={false}
|
|
103
|
+
itemCount={5}
|
|
104
|
+
// nextBlock={nexBlock}
|
|
105
|
+
placeholder="Auto Suggestion Suggestion Suggestion Suggestion"
|
|
106
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
107
|
+
// getData={getData}
|
|
108
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
81
109
|
/>
|
|
82
110
|
</div>
|
|
83
111
|
<div className="autocomplete-section">
|
|
@@ -96,15 +124,15 @@ export default function App() {
|
|
|
96
124
|
descId="id"
|
|
97
125
|
type="custom_select"
|
|
98
126
|
data={[
|
|
99
|
-
{ name:
|
|
100
|
-
{ name:
|
|
127
|
+
{ name: "test", id: "1" },
|
|
128
|
+
{ name: "test1", id: "2" },
|
|
101
129
|
|
|
102
|
-
{ name:
|
|
130
|
+
{ name: "test2", id: "3" },
|
|
103
131
|
|
|
104
|
-
{ name:
|
|
132
|
+
{ name: "test3", id: "4" },
|
|
105
133
|
]}
|
|
106
134
|
// getData={getData}
|
|
107
|
-
onChange={() => console.log(
|
|
135
|
+
onChange={() => console.log("onchange")}
|
|
108
136
|
/>
|
|
109
137
|
</div>
|
|
110
138
|
<div className="autocomplete-section">
|
|
@@ -128,7 +156,7 @@ export default function App() {
|
|
|
128
156
|
placeholder="Auto Complete"
|
|
129
157
|
// data={[{ name: 'test', id: '1' }]}
|
|
130
158
|
getData={getData}
|
|
131
|
-
onChange={() => console.log(
|
|
159
|
+
onChange={() => console.log("onchange")}
|
|
132
160
|
/>
|
|
133
161
|
</div>
|
|
134
162
|
<div style={{ width: 300 }}>
|
|
@@ -142,7 +170,7 @@ export default function App() {
|
|
|
142
170
|
placeholder="Auto Complete"
|
|
143
171
|
// data={[{ name: 'test', id: '1' }]}
|
|
144
172
|
getData={getDatas}
|
|
145
|
-
onChange={() => console.log(
|
|
173
|
+
onChange={() => console.log("onchange")}
|
|
146
174
|
/>
|
|
147
175
|
</div>
|
|
148
176
|
<div className="autocomplete-section">
|
|
@@ -164,18 +192,18 @@ export default function App() {
|
|
|
164
192
|
descId="id"
|
|
165
193
|
type="custom_search_select"
|
|
166
194
|
data={[
|
|
167
|
-
{ name:
|
|
168
|
-
{ name:
|
|
169
|
-
{ name:
|
|
170
|
-
{ name:
|
|
171
|
-
{ name:
|
|
172
|
-
{ name:
|
|
173
|
-
{ name:
|
|
174
|
-
{ name:
|
|
175
|
-
{ name:
|
|
176
|
-
{ name:
|
|
195
|
+
{ name: "Apple", id: "1" },
|
|
196
|
+
{ name: "Banana", id: "2" },
|
|
197
|
+
{ name: "Cherry", id: "3" },
|
|
198
|
+
{ name: "Date", id: "4" },
|
|
199
|
+
{ name: "Fig", id: "5" },
|
|
200
|
+
{ name: "Grape", id: "6" },
|
|
201
|
+
{ name: "Honeydew", id: "7" },
|
|
202
|
+
{ name: "Kiwi", id: "8" },
|
|
203
|
+
{ name: "Lemon", id: "9" },
|
|
204
|
+
{ name: "Mango", id: "10" },
|
|
177
205
|
]}
|
|
178
|
-
onChange={() => console.log(
|
|
206
|
+
onChange={() => console.log("onchange")}
|
|
179
207
|
/>
|
|
180
208
|
</div>
|
|
181
209
|
<div className="autocomplete-section">
|
|
@@ -198,7 +226,7 @@ export default function App() {
|
|
|
198
226
|
placeholder="Auto Suggestion"
|
|
199
227
|
// data={[{ name: 'test', id: '1' }]}
|
|
200
228
|
getData={getData}
|
|
201
|
-
onChange={() => console.log(
|
|
229
|
+
onChange={() => console.log("onchange")}
|
|
202
230
|
/>
|
|
203
231
|
</div>
|
|
204
232
|
<div style={{ width: 300 }}>
|
|
@@ -212,10 +240,10 @@ export default function App() {
|
|
|
212
240
|
isMultiple
|
|
213
241
|
descId="id"
|
|
214
242
|
placeholder="Auto Suggestion"
|
|
215
|
-
selectedItems={[{ name:
|
|
243
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
216
244
|
// data={[{ name: 'test', id: '1' }]}
|
|
217
245
|
getData={getData}
|
|
218
|
-
onChange={(value) => console.log(value,
|
|
246
|
+
onChange={(value) => console.log(value, "onchange")}
|
|
219
247
|
/>
|
|
220
248
|
</div>
|
|
221
249
|
<div style={{ width: 300 }}>
|
|
@@ -231,9 +259,9 @@ export default function App() {
|
|
|
231
259
|
initialLoad={true}
|
|
232
260
|
// nextBlock={nexBlock}
|
|
233
261
|
placeholder="Auto Suggestion"
|
|
234
|
-
selectedItems={[{ name:
|
|
262
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
235
263
|
getData={getData}
|
|
236
|
-
onChange={(e) => console.log(e,
|
|
264
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
237
265
|
/>
|
|
238
266
|
</div>
|
|
239
267
|
|
|
@@ -261,9 +289,9 @@ export default function App() {
|
|
|
261
289
|
itemCount={5}
|
|
262
290
|
// nextBlock={nexBlock}
|
|
263
291
|
placeholder="Auto Suggestion Suggestion Suggestion Suggestion"
|
|
264
|
-
selectedItems={[{ name:
|
|
292
|
+
selectedItems={[{ name: "test", id: "1" }]}
|
|
265
293
|
getData={getData}
|
|
266
|
-
onChange={(e) => console.log(e,
|
|
294
|
+
onChange={(e) => console.log(e, "onchange")}
|
|
267
295
|
/>
|
|
268
296
|
</div>
|
|
269
297
|
</div>
|
package/docs/store.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
children: [
|
|
6
|
+
{
|
|
7
|
+
name: "Port C - A key sub-port with heavy container traffic in the southern bay area",
|
|
8
|
+
id: 1,
|
|
9
|
+
children: [
|
|
10
|
+
{
|
|
11
|
+
name: "Port G - A small port used for local shipments and fishing operations",
|
|
12
|
+
id: 2,
|
|
13
|
+
children: [
|
|
14
|
+
{
|
|
15
|
+
name: "Port H - A minor local port focusing on fisheries and small-scale cargo",
|
|
16
|
+
id: 3,
|
|
17
|
+
children: [],
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "Port I - A coastal port for regional trade and tourism operations",
|
|
23
|
+
id: 4,
|
|
24
|
+
children: [
|
|
25
|
+
{
|
|
26
|
+
name: "Port J - A harbor for tourist cruises and commercial boats",
|
|
27
|
+
id: 5,
|
|
28
|
+
children: [],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "Port D - An industrial port dealing with large-scale cargo and ship repair services",
|
|
36
|
+
id: 6,
|
|
37
|
+
children: [
|
|
38
|
+
{
|
|
39
|
+
name: "Port K - A dock specializing in shipbuilding and marine repairs",
|
|
40
|
+
id: 7,
|
|
41
|
+
children: [
|
|
42
|
+
{
|
|
43
|
+
name: "Port L - A repair facility for both military and commercial vessels",
|
|
44
|
+
id: 8,
|
|
45
|
+
children: [],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "Port B - This is the largest port in the central region, supporting international trade",
|
|
55
|
+
id: 9,
|
|
56
|
+
children: [
|
|
57
|
+
{
|
|
58
|
+
name: "Port E - A primary export port dealing with raw materials and heavy goods",
|
|
59
|
+
id: 10,
|
|
60
|
+
children: [
|
|
61
|
+
{
|
|
62
|
+
name: "Port M - A small export hub for agricultural and mining products",
|
|
63
|
+
id: 11,
|
|
64
|
+
children: [
|
|
65
|
+
{
|
|
66
|
+
name: "Port N - A warehouse and storage center for exported goods",
|
|
67
|
+
id: 12,
|
|
68
|
+
children: [],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-core-ts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
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