@gpa-gemstone/react-forms 1.1.114 → 1.1.115

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.
@@ -47,6 +47,7 @@ var AutoCompleteInput_1 = require("./AutoCompleteInput");
47
47
  var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
48
48
  var HelpIcon_1 = require("./HelpIcon");
49
49
  function AutoCompleteMultiInput(props) {
50
+ var _a, _b;
50
51
  var fieldArray = props.Record[props.Field];
51
52
  if ((fieldArray === null || fieldArray === void 0 ? void 0 : fieldArray.constructor) !== Array) {
52
53
  console.warn("AutoCompleteMultiInput: ".concat(props.Field.toString(), " is not of type array."));
@@ -60,11 +61,16 @@ function AutoCompleteMultiInput(props) {
60
61
  React.createElement(React.Fragment, null, showLabel ?
61
62
  React.createElement("label", { className: "d-flex align-items-center" },
62
63
  React.createElement("span", null, showLabel ? label : ''),
63
- React.createElement(HelpIcon_1.default, { Help: props.Help }))
64
+ React.createElement(HelpIcon_1.default, { Help: props.Help }),
65
+ React.createElement("button", { className: 'btn', style: ((_a = props.DisableAdd) !== null && _a !== void 0 ? _a : false) || ((_b = props.Disabled) !== null && _b !== void 0 ? _b : false) ? { display: 'none' } : undefined, onClick: function () {
66
+ var _a;
67
+ return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = [props.DefaultValue], _a)));
68
+ } },
69
+ React.createElement(gpa_symbols_1.ReactIcons.CirclePlus, null)))
64
70
  : null)
65
71
  : null,
66
72
  fieldArray.map(function (r, index) {
67
- var _a, _b, _c, _d, _e, _f;
73
+ var _a, _b, _c, _d, _e;
68
74
  return (React.createElement("div", { className: 'row no-gutters', key: index },
69
75
  React.createElement("div", { className: 'col-10' },
70
76
  React.createElement(AutoCompleteInput_1.default, { Record: fieldArray, Field: index, Label: index === 0 ? props.Label : '', AllowNull: props.AllowNull, Help: index === 0 ? props.Help : undefined, Feedback: (_b = (_a = props.ItemFeedback) === null || _a === void 0 ? void 0 : _a.call(props, r, index, fieldArray)) !== null && _b !== void 0 ? _b : undefined, Valid: function () { var _a, _b; return (_b = (_a = props.ItemValid) === null || _a === void 0 ? void 0 : _a.call(props, r, index, fieldArray)) !== null && _b !== void 0 ? _b : true; }, Style: props.Style, Disabled: props.Disabled, DefaultValue: typeof props.DefaultValue === 'number' ? props.DefaultValue : undefined, Options: props.Options, Setter: function (record) {
@@ -86,7 +92,7 @@ function AutoCompleteMultiInput(props) {
86
92
  React.createElement(gpa_symbols_1.ReactIcons.TrashCan, { Color: 'red' }))),
87
93
  index === __spreadArray([], fieldArray, true).length - 1 ?
88
94
  React.createElement("div", { className: "col-1 ".concat(index === 0 ? 'd-flex align-items-center justify-content-center' : '') },
89
- React.createElement("button", { className: 'btn', style: ((_f = (((_d = props.DisableAdd) !== null && _d !== void 0 ? _d : false) || ((_e = props.Disabled) !== null && _e !== void 0 ? _e : false))) !== null && _f !== void 0 ? _f : false) ? { display: 'none' } : undefined, onClick: function () {
95
+ React.createElement("button", { className: 'btn', style: ((_d = props.DisableAdd) !== null && _d !== void 0 ? _d : false) || ((_e = props.Disabled) !== null && _e !== void 0 ? _e : false) ? { display: 'none' } : undefined, onClick: function () {
90
96
  var _a;
91
97
  var newRecords = __spreadArray(__spreadArray([], __spreadArray([], fieldArray, true), true), [props.DefaultValue], false);
92
98
  props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = newRecords, _a)));
package/lib/MultiInput.js CHANGED
@@ -48,6 +48,7 @@ var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
48
48
  var HelpIcon_1 = require("./HelpIcon");
49
49
  //Only supporting string/number arrays for now
50
50
  function MultiInput(props) {
51
+ var _a, _b;
51
52
  var fieldArray = props.Record[props.Field];
52
53
  if ((fieldArray === null || fieldArray === void 0 ? void 0 : fieldArray.constructor) !== Array) {
53
54
  console.warn("MultiInput: ".concat(props.Field.toString(), " is not of type array."));
@@ -61,11 +62,16 @@ function MultiInput(props) {
61
62
  React.createElement(React.Fragment, null, showLabel ?
62
63
  React.createElement("label", { className: "d-flex align-items-center" },
63
64
  React.createElement("span", null, showLabel ? label : ''),
64
- React.createElement(HelpIcon_1.default, { Help: props.Help }))
65
+ React.createElement(HelpIcon_1.default, { Help: props.Help }),
66
+ React.createElement("button", { className: 'btn', style: ((_a = props.DisableAdd) !== null && _a !== void 0 ? _a : false) || ((_b = props.Disabled) !== null && _b !== void 0 ? _b : false) ? { display: 'none' } : undefined, onClick: function () {
67
+ var _a;
68
+ return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = [props.DefaultValue], _a)));
69
+ } },
70
+ React.createElement(gpa_symbols_1.ReactIcons.CirclePlus, null)))
65
71
  : null)
66
72
  : null,
67
73
  fieldArray.map(function (r, index) {
68
- var _a, _b, _c, _d, _e, _f;
74
+ var _a, _b, _c, _d, _e;
69
75
  return (React.createElement("div", { className: 'row no-gutters', key: index },
70
76
  React.createElement("div", { className: 'col-10' },
71
77
  React.createElement(Input_1.default, { Record: fieldArray, Field: index, Label: index === 0 ? props.Label : '', AllowNull: props.AllowNull, Type: props.Type, Help: index === 0 ? props.Help : undefined, Feedback: (_b = (_a = props.ItemFeedback) === null || _a === void 0 ? void 0 : _a.call(props, r, index, fieldArray)) !== null && _b !== void 0 ? _b : undefined, Valid: function () { var _a, _b; return (_b = (_a = props.ItemValid) === null || _a === void 0 ? void 0 : _a.call(props, r, index, fieldArray)) !== null && _b !== void 0 ? _b : true; }, Style: props.Style, Disabled: props.Disabled, Setter: function (record) {
@@ -87,7 +93,7 @@ function MultiInput(props) {
87
93
  React.createElement(gpa_symbols_1.ReactIcons.TrashCan, { Color: 'red' }))),
88
94
  index === __spreadArray([], fieldArray, true).length - 1 ?
89
95
  React.createElement("div", { className: "col-1 ".concat(index === 0 ? 'd-flex align-items-center justify-content-center' : '') },
90
- React.createElement("button", { className: 'btn', style: ((_f = (((_d = props.DisableAdd) !== null && _d !== void 0 ? _d : false) || ((_e = props.Disabled) !== null && _e !== void 0 ? _e : false))) !== null && _f !== void 0 ? _f : false) ? { display: 'none' } : undefined, onClick: function () {
96
+ React.createElement("button", { className: 'btn', style: ((_d = props.DisableAdd) !== null && _d !== void 0 ? _d : false) || ((_e = props.Disabled) !== null && _e !== void 0 ? _e : false) ? { display: 'none' } : undefined, onClick: function () {
91
97
  var _a;
92
98
  var newRecords = __spreadArray(__spreadArray([], __spreadArray([], fieldArray, true), true), [props.DefaultValue], false);
93
99
  props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = newRecords, _a)));
@@ -48,6 +48,7 @@ var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
48
48
  var HelpIcon_1 = require("./HelpIcon");
49
49
  //Only supporting string/number arrays for now
50
50
  function MultiSearchableSelect(props) {
51
+ var _a, _b;
51
52
  var fieldArray = props.Record[props.Field];
52
53
  if ((fieldArray === null || fieldArray === void 0 ? void 0 : fieldArray.constructor) !== Array) {
53
54
  console.warn("MultiInput: ".concat(props.Field.toString(), " is not of type array."));
@@ -61,11 +62,16 @@ function MultiSearchableSelect(props) {
61
62
  React.createElement(React.Fragment, null, showLabel ?
62
63
  React.createElement("label", { className: "d-flex align-items-center" },
63
64
  React.createElement("span", null, showLabel ? label : ''),
64
- React.createElement(HelpIcon_1.default, { Help: props.Help }))
65
+ React.createElement(HelpIcon_1.default, { Help: props.Help }),
66
+ React.createElement("button", { className: 'btn', style: ((_a = props.DisableAdd) !== null && _a !== void 0 ? _a : false) || ((_b = props.Disabled) !== null && _b !== void 0 ? _b : false) ? { display: 'none' } : undefined, onClick: function () {
67
+ var _a;
68
+ return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = [props.DefaultValue], _a)), 0, { Label: props.DefaultValue.toString(), Value: props.DefaultValue });
69
+ } },
70
+ React.createElement(gpa_symbols_1.ReactIcons.CirclePlus, null)))
65
71
  : null)
66
72
  : null,
67
73
  fieldArray.map(function (r, index) {
68
- var _a, _b, _c, _d, _e, _f;
74
+ var _a, _b, _c, _d, _e;
69
75
  return (React.createElement("div", { className: 'row align-items-center', key: index },
70
76
  React.createElement("div", { className: 'col-10' },
71
77
  React.createElement(SearchableSelect_1.default, { Record: fieldArray, Field: index, Label: index === 0 ? props.Label : '', Help: index === 0 ? props.Help : undefined, Feedback: (_b = (_a = props.ItemFeedback) === null || _a === void 0 ? void 0 : _a.call(props, r, index, fieldArray)) !== null && _b !== void 0 ? _b : undefined, Valid: function () { var _a, _b; return (_b = (_a = props.ItemValid) === null || _a === void 0 ? void 0 : _a.call(props, r, index, fieldArray)) !== null && _b !== void 0 ? _b : true; }, Style: props.Style, Disabled: props.Disabled, Setter: function (record, option) {
@@ -83,7 +89,7 @@ function MultiSearchableSelect(props) {
83
89
  React.createElement(gpa_symbols_1.ReactIcons.TrashCan, { Color: 'red' }))),
84
90
  index === __spreadArray([], fieldArray, true).length - 1 ?
85
91
  React.createElement("div", { className: "col-1 ".concat(index === 0 ? 'd-flex align-items-center' : '') },
86
- React.createElement("button", { className: 'btn', style: ((_f = (((_d = props.DisableAdd) !== null && _d !== void 0 ? _d : false) || ((_e = props.Disabled) !== null && _e !== void 0 ? _e : false))) !== null && _f !== void 0 ? _f : false) ? { display: 'none' } : undefined, onClick: function () {
92
+ React.createElement("button", { className: 'btn', style: ((_d = props.DisableAdd) !== null && _d !== void 0 ? _d : false) || ((_e = props.Disabled) !== null && _e !== void 0 ? _e : false) ? { display: 'none' } : undefined, onClick: function () {
87
93
  var _a;
88
94
  var newRecords = __spreadArray(__spreadArray([], __spreadArray([], fieldArray, true), true), [props.DefaultValue], false);
89
95
  props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = newRecords, _a)), newRecords.length - 1, { Label: props.DefaultValue.toString(), Value: props.DefaultValue });
@@ -108,7 +108,8 @@ function SearchableSelect(props) {
108
108
  if ((_d = props.AllowCustom) !== null && _d !== void 0 ? _d : false)
109
109
  ops.push({ Value: search, Element: React.createElement(React.Fragment, null,
110
110
  search,
111
- " (Entered Value)"), Label: search });
111
+ " ",
112
+ React.createElement("span", { className: "badge badge-info", style: { fontSize: '0.75em' } }, "Entered Value")), Label: search });
112
113
  //Ensure selectedOption is always at top of the list
113
114
  var selected = searchOptions.find(function (f) { return f.Value === props.Record[props.Field]; });
114
115
  if (selected != null)
package/lib/ToolTip.js CHANGED
@@ -219,8 +219,14 @@ var getPosition = function (toolTip, targetPosition, position) {
219
219
  return [top, left, arrowPositionPercent, effectivePosition];
220
220
  };
221
221
  var getTarget = function (target) {
222
- var targets = document.querySelectorAll("[data-tooltip".concat(target === undefined ? '' : "=\"".concat(target, "\""), "]"));
223
- return targets.length > 0 ? targets[0] : null;
222
+ try {
223
+ var targets = document.querySelectorAll("[data-tooltip".concat(target === undefined ? '' : "=\"".concat(target, "\""), "]"));
224
+ return targets.length > 0 ? targets[0] : null;
225
+ }
226
+ catch (_a) {
227
+ console.warn('Tooltip: Invalid target selector provided. Target elements must have a valid data-tooltip attribute that matches the Target prop of the tooltip.');
228
+ return null;
229
+ }
224
230
  };
225
231
  exports.default = exports.Tooltip;
226
232
  var templateObject_1, templateObject_2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpa-gemstone/react-forms",
3
- "version": "1.1.114",
3
+ "version": "1.1.115",
4
4
  "description": "React Form modules for gpa webapps",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",