@galadrim/galadmin 0.1.201 → 0.1.202

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.
@@ -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)
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
+ }
@@ -119,6 +119,12 @@ 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
+ };
127
+
122
128
  export type FileUploadProperties = {
123
129
  publicPath?: string;
124
130
  subdirectory?: string;
@@ -155,6 +161,7 @@ export type Column = BaseTypeColumn &
155
161
  | BetterRichTextColumn
156
162
  | TextareaColumn
157
163
  | FileColumn
164
+ | AutocompleteColumn
158
165
  );
159
166
 
160
167
  export type CreateType = {
@@ -1,12 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6
- esac
7
-
8
- if [ -x "$basedir/node" ]; then
9
- exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
10
- else
11
- exec node "$basedir/../semver/bin/semver.js" "$@"
12
- fi
@@ -1,17 +0,0 @@
1
- @ECHO off
2
- GOTO start
3
- :find_dp0
4
- SET dp0=%~dp0
5
- EXIT /b
6
- :start
7
- SETLOCAL
8
- CALL :find_dp0
9
-
10
- IF EXIST "%dp0%\node.exe" (
11
- SET "_prog=%dp0%\node.exe"
12
- ) ELSE (
13
- SET "_prog=node"
14
- SET PATHEXT=%PATHEXT:;.JS;=;%
15
- )
16
-
17
- endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %*
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env pwsh
2
- $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3
-
4
- $exe=""
5
- if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6
- # Fix case when both the Windows and Linux builds of Node
7
- # are installed in the same directory
8
- $exe=".exe"
9
- }
10
- $ret=0
11
- if (Test-Path "$basedir/node$exe") {
12
- # Support pipeline input
13
- if ($MyInvocation.ExpectingInput) {
14
- $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
15
- } else {
16
- & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
17
- }
18
- $ret=$LASTEXITCODE
19
- } else {
20
- # Support pipeline input
21
- if ($MyInvocation.ExpectingInput) {
22
- $input | & "node$exe" "$basedir/../semver/bin/semver.js" $args
23
- } else {
24
- & "node$exe" "$basedir/../semver/bin/semver.js" $args
25
- }
26
- $ret=$LASTEXITCODE
27
- }
28
- exit $ret