@gpa-gemstone/react-forms 1.1.100 → 1.1.101

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/lib/FileUpload.js CHANGED
@@ -28,10 +28,10 @@ var FileUpload = function (props) {
28
28
  var _a = React.useState(null), fileName = _a[0], setFileName = _a[1];
29
29
  var _b = React.useState(null), fileSize = _b[0], setFileSize = _b[1];
30
30
  var _c = React.useState(false), isFileUpload = _c[0], setIsFileUploaded = _c[1];
31
- var _d = React.useState('unintiated'), uploadStatus = _d[0], setUploadStatus = _d[1];
31
+ var _d = React.useState('uninitiated'), uploadStatus = _d[0], setUploadStatus = _d[1];
32
32
  var handleFileUpload = function (evt) {
33
33
  if (evt.target == null || evt.target.files == null || evt.target.files.length === 0) {
34
- setUploadStatus('unintiated');
34
+ setUploadStatus('uninitiated');
35
35
  return;
36
36
  }
37
37
  var file = evt.target.files[0];
@@ -52,7 +52,7 @@ var FileUpload = function (props) {
52
52
  e.stopPropagation();
53
53
  };
54
54
  var handleOnClear = function () {
55
- setUploadStatus('unintiated');
55
+ setUploadStatus('uninitiated');
56
56
  setIsFileUploaded(false);
57
57
  setFileName(null);
58
58
  setFileSize(null);
@@ -34,17 +34,18 @@ function SearchableSelect(props) {
34
34
  var _b = React.useState([]), searchOptions = _b[0], setSearchOptions = _b[1];
35
35
  var _c = React.useState(false), loading = _c[0], setLoading = _c[1];
36
36
  var setter = React.useCallback(function (record, selectedOption) {
37
- handleSetSearch(selectedOption);
38
- props.Setter(record, { Label: selectedOption.Element, Value: selectedOption.Value }); //we know Element is a string as we set this ourselves
37
+ var selectedOptionCasted = selectedOption; //we can safely cast here because we control the options going in..
38
+ handleSetSearch(selectedOptionCasted);
39
+ props.Setter(record, { Label: selectedOptionCasted.Label, Value: selectedOptionCasted.Value });
39
40
  }, [props.Setter, props.Field]);
40
41
  var handleSetSearch = React.useCallback(function (selectedOption) {
41
- var _a, _b, _c;
42
+ var _a, _b, _c, _d;
42
43
  if ((_a = props.ResetSearchOnSelect) !== null && _a !== void 0 ? _a : false) {
43
44
  setSearch('');
44
45
  return;
45
46
  }
46
47
  if (props.GetLabel === undefined) {
47
- var newSearch = (_c = selectedOption !== null && selectedOption !== void 0 ? selectedOption : (_b = props.Record[props.Field]) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : '';
48
+ var newSearch = (_d = (_b = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.Label) !== null && _b !== void 0 ? _b : (_c = props.Record[props.Field]) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : '';
48
49
  setSearch(newSearch);
49
50
  return;
50
51
  }
@@ -66,7 +67,7 @@ function SearchableSelect(props) {
66
67
  var timeoutHandle = setTimeout(function () {
67
68
  searchHandle = props.Search(search);
68
69
  searchHandle.then(function (d) {
69
- setSearchOptions(d.map(function (o) { return ({ Value: o.Value, Element: o.Label }); }));
70
+ setSearchOptions(d.map(function (o) { return ({ Value: o.Value, Element: o.Label, Label: o.Label }); }));
70
71
  setLoading(false);
71
72
  }, function () {
72
73
  setLoading(false);
@@ -84,6 +85,7 @@ function SearchableSelect(props) {
84
85
  var ops = [];
85
86
  ops.push({
86
87
  Value: props.Record[props.Field],
88
+ Label: "", //Label doesnt matter in this case because you cant select this option
87
89
  Element: React.createElement("div", { className: 'input-group' },
88
90
  React.createElement("input", { type: "text", className: "form-control ".concat(((_b = (_a = props.Valid) === null || _a === void 0 ? void 0 : _a.call(props, props.Field)) !== null && _b !== void 0 ? _b : true) ? '' : 'border-danger'), value: search, onChange: function (d) { return setSearch(d.target.value); }, onBlur: function () { return handleSetSearch(); }, onClick: function (evt) { evt.preventDefault(); evt.stopPropagation(); }, disabled: (_c = props.Disabled) !== null && _c !== void 0 ? _c : false }),
89
91
  loading ?
@@ -95,7 +97,7 @@ function SearchableSelect(props) {
95
97
  if ((_d = props.AllowCustom) !== null && _d !== void 0 ? _d : false)
96
98
  ops.push({ Value: search, Element: React.createElement(React.Fragment, null,
97
99
  search,
98
- " (Entered Value)") });
100
+ " (Entered Value)"), Label: search });
99
101
  ops.push.apply(ops, searchOptions.filter(function (f) { return f.Value !== search && f.Value !== props.Record[props.Field]; }));
100
102
  return ops;
101
103
  }, [search, props.Record[props.Field], props.Field, searchOptions, props.Disabled, loading, props.Valid, handleSetSearch]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpa-gemstone/react-forms",
3
- "version": "1.1.100",
3
+ "version": "1.1.101",
4
4
  "description": "React Form modules for gpa webapps",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -45,9 +45,9 @@
45
45
  "typescript": "5.5.3"
46
46
  },
47
47
  "dependencies": {
48
- "@gpa-gemstone/application-typings": "0.0.88",
48
+ "@gpa-gemstone/application-typings": "0.0.89",
49
49
  "@gpa-gemstone/gpa-symbols": "0.0.56",
50
- "@gpa-gemstone/helper-functions": "0.0.46",
50
+ "@gpa-gemstone/helper-functions": "0.0.47",
51
51
  "@types/react": "^17.0.14",
52
52
  "@types/styled-components": "^5.1.11",
53
53
  "lodash": "^4.17.21",