@galadrim/galadmin 0.1.201 → 0.1.203
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/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +7 -1
- package/package.json +1 -1
- package/src/front/build/asset-manifest.json +3 -3
- package/src/front/build/index.html +1 -1
- package/src/front/build/static/js/{main.cb93ce29.js → main.f0a3f005.js} +3 -3
- package/src/front/build/static/js/{main.cb93ce29.js.map → main.f0a3f005.js.map} +1 -1
- package/src/front/src/components/Input.js +9 -0
- package/src/front/src/components/inputs/AutocompleteInput.js +33 -0
- package/src/types/config.ts +8 -0
- /package/src/front/build/static/js/{main.cb93ce29.js.LICENSE.txt → main.f0a3f005.js.LICENSE.txt} +0 -0
|
@@ -6,6 +6,7 @@ import AddressInput from "./inputs/AddressInput";
|
|
|
6
6
|
import FileInput from "./inputs/FileInput";
|
|
7
7
|
import ForeignSelectInput from "./inputs/ForeignSelectInput";
|
|
8
8
|
import ForeignDatalistInput from "./inputs/ForeignDatalistInput";
|
|
9
|
+
import AutocompleteInput from "./inputs/AutocompleteInput";
|
|
9
10
|
|
|
10
11
|
export default ({ column, onChange, initialData }) => {
|
|
11
12
|
const { dataType } = column;
|
|
@@ -168,6 +169,14 @@ export default ({ column, onChange, initialData }) => {
|
|
|
168
169
|
defaultValue={initialData?.[column.name]?.join(", ")}
|
|
169
170
|
/>
|
|
170
171
|
);
|
|
172
|
+
} else if (dataType === "autocompleteText") {
|
|
173
|
+
return (
|
|
174
|
+
<AutocompleteInput
|
|
175
|
+
column={column}
|
|
176
|
+
onChange={onChange}
|
|
177
|
+
initialData={initialData}
|
|
178
|
+
/>
|
|
179
|
+
);
|
|
171
180
|
} else {
|
|
172
181
|
return (
|
|
173
182
|
<input
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
export default ({ column, onChange, initialData }) => {
|
|
5
|
+
const [options, setOptions] = useState([])
|
|
6
|
+
const id = Math.random().toString(36).substring(2, 15);
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
axios.get("/customQuery", {
|
|
10
|
+
params: {
|
|
11
|
+
query: column.autocompleteListQuery
|
|
12
|
+
}
|
|
13
|
+
}).then((response) => {
|
|
14
|
+
setOptions(response.data.map(x => x[column.autocompleteListQueryResultKey]))
|
|
15
|
+
})
|
|
16
|
+
}, [])
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<input
|
|
21
|
+
type="text"
|
|
22
|
+
onChange={(e) => onChange({ [column.name]: e.target.value })}
|
|
23
|
+
defaultValue={initialData?.[column.name]}
|
|
24
|
+
list={id}
|
|
25
|
+
/>
|
|
26
|
+
<datalist id={id}>
|
|
27
|
+
{options.map((option) => (
|
|
28
|
+
<option value={option} key={option}></option>
|
|
29
|
+
))}
|
|
30
|
+
</datalist>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
}
|
package/src/types/config.ts
CHANGED
|
@@ -119,6 +119,13 @@ export type FileColumn = {
|
|
|
119
119
|
name: string;
|
|
120
120
|
} & FileUploadProperties;
|
|
121
121
|
|
|
122
|
+
export type AutocompleteColumn = {
|
|
123
|
+
dataType: "autocompleteText";
|
|
124
|
+
name: string;
|
|
125
|
+
autocompleteListQuery: string;
|
|
126
|
+
autocompleteListQueryResultKey: string;
|
|
127
|
+
};
|
|
128
|
+
|
|
122
129
|
export type FileUploadProperties = {
|
|
123
130
|
publicPath?: string;
|
|
124
131
|
subdirectory?: string;
|
|
@@ -155,6 +162,7 @@ export type Column = BaseTypeColumn &
|
|
|
155
162
|
| BetterRichTextColumn
|
|
156
163
|
| TextareaColumn
|
|
157
164
|
| FileColumn
|
|
165
|
+
| AutocompleteColumn
|
|
158
166
|
);
|
|
159
167
|
|
|
160
168
|
export type CreateType = {
|
/package/src/front/build/static/js/{main.cb93ce29.js.LICENSE.txt → main.f0a3f005.js.LICENSE.txt}
RENAMED
|
File without changes
|