@gpa-gemstone/react-forms 1.1.21 → 1.1.22
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/DatePicker.d.ts +2 -0
- package/lib/DatePicker.js +3 -2
- package/lib/TimePicker.d.ts +12 -0
- package/lib/TimePicker.js +73 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.js +5 -1
- package/package.json +1 -1
package/lib/DatePicker.d.ts
CHANGED
package/lib/DatePicker.js
CHANGED
|
@@ -58,14 +58,15 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
58
58
|
var _this = this;
|
|
59
59
|
return (React.createElement("div", { className: "form-group" },
|
|
60
60
|
React.createElement("label", null, this.props.Label == null ? this.props.Field : this.props.Label),
|
|
61
|
-
React.createElement("input", { className:
|
|
61
|
+
React.createElement("input", { className: this.props.Valid(this.props.Field) ? 'form-control' : 'form-control is-invalid', type: "date", onChange: function (evt) {
|
|
62
62
|
var record = __assign({}, _this.props.Record);
|
|
63
63
|
if (evt.target.value !== '')
|
|
64
64
|
record[_this.props.Field] = evt.target.value;
|
|
65
65
|
else
|
|
66
66
|
record[_this.props.Field] = null;
|
|
67
67
|
_this.props.Setter(record);
|
|
68
|
-
}, value: this.props.Record[this.props.Field] == null ? '' : this.props.Record[this.props.Field].toString(), disabled: this.props.Disabled == null ? false : this.props.Disabled })
|
|
68
|
+
}, value: this.props.Record[this.props.Field] == null ? '' : this.props.Record[this.props.Field].toString(), disabled: this.props.Disabled == null ? false : this.props.Disabled }),
|
|
69
|
+
React.createElement("div", { className: "invalid-feedback" }, this.props.Feedback == null ? this.props.Field + ' is a required field.' : this.props.Feedback)));
|
|
69
70
|
};
|
|
70
71
|
return DatePicker;
|
|
71
72
|
}(React.Component));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export default class TimePicker<T> extends React.Component<{
|
|
3
|
+
Record: T;
|
|
4
|
+
Field: keyof T;
|
|
5
|
+
Setter: (record: T) => void;
|
|
6
|
+
Label?: string;
|
|
7
|
+
Disabled?: boolean;
|
|
8
|
+
Feedback?: string;
|
|
9
|
+
Valid: (field: keyof T) => boolean;
|
|
10
|
+
}, {}, {}> {
|
|
11
|
+
render(): JSX.Element;
|
|
12
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ******************************************************************************************************
|
|
3
|
+
// TimePicker.tsx - Gbtc
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2022, Grid Protection Alliance. All Rights Reserved.
|
|
6
|
+
//
|
|
7
|
+
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
|
|
8
|
+
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
|
|
9
|
+
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
|
|
10
|
+
// file except in compliance with the License. You may obtain a copy of the License at:
|
|
11
|
+
//
|
|
12
|
+
// http://opensource.org/licenses/MIT
|
|
13
|
+
//
|
|
14
|
+
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
|
|
15
|
+
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
|
|
16
|
+
// License for the specific language governing permissions and limitations.
|
|
17
|
+
//
|
|
18
|
+
// Code Modification History:
|
|
19
|
+
// ----------------------------------------------------------------------------------------------------
|
|
20
|
+
// 03/21/2022 - C. Lackner
|
|
21
|
+
// Generated original version of source code.
|
|
22
|
+
//
|
|
23
|
+
// ******************************************************************************************************
|
|
24
|
+
var __extends = (this && this.__extends) || (function () {
|
|
25
|
+
var extendStatics = function (d, b) {
|
|
26
|
+
extendStatics = Object.setPrototypeOf ||
|
|
27
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
28
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
29
|
+
return extendStatics(d, b);
|
|
30
|
+
};
|
|
31
|
+
return function (d, b) {
|
|
32
|
+
if (typeof b !== "function" && b !== null)
|
|
33
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
34
|
+
extendStatics(d, b);
|
|
35
|
+
function __() { this.constructor = d; }
|
|
36
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
var __assign = (this && this.__assign) || function () {
|
|
40
|
+
__assign = Object.assign || function(t) {
|
|
41
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
42
|
+
s = arguments[i];
|
|
43
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
44
|
+
t[p] = s[p];
|
|
45
|
+
}
|
|
46
|
+
return t;
|
|
47
|
+
};
|
|
48
|
+
return __assign.apply(this, arguments);
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
var React = require("react");
|
|
52
|
+
var TimePicker = /** @class */ (function (_super) {
|
|
53
|
+
__extends(TimePicker, _super);
|
|
54
|
+
function TimePicker() {
|
|
55
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
56
|
+
}
|
|
57
|
+
TimePicker.prototype.render = function () {
|
|
58
|
+
var _this = this;
|
|
59
|
+
return (React.createElement("div", { className: "form-group" },
|
|
60
|
+
React.createElement("label", null, this.props.Label == null ? this.props.Field : this.props.Label),
|
|
61
|
+
React.createElement("input", { className: this.props.Valid(this.props.Field) ? 'form-control' : 'form-control is-invalid', type: "time", onChange: function (evt) {
|
|
62
|
+
var record = __assign({}, _this.props.Record);
|
|
63
|
+
if (evt.target.value !== '')
|
|
64
|
+
record[_this.props.Field] = evt.target.value;
|
|
65
|
+
else
|
|
66
|
+
record[_this.props.Field] = null;
|
|
67
|
+
_this.props.Setter(record);
|
|
68
|
+
}, value: this.props.Record[this.props.Field] == null ? '' : this.props.Record[this.props.Field].toString(), disabled: this.props.Disabled == null ? false : this.props.Disabled }),
|
|
69
|
+
React.createElement("div", { className: "invalid-feedback" }, this.props.Feedback == null ? this.props.Field + ' is a required field.' : this.props.Feedback)));
|
|
70
|
+
};
|
|
71
|
+
return TimePicker;
|
|
72
|
+
}(React.Component));
|
|
73
|
+
exports.default = TimePicker;
|
package/lib/index.d.ts
CHANGED
|
@@ -8,4 +8,6 @@ import EnumCheckBoxes from './EnumCheckBoxes';
|
|
|
8
8
|
import ArrayMultiSelect from './ArrayMultiSelect';
|
|
9
9
|
import ArrayCheckBoxes from './ArrayCheckBoxes';
|
|
10
10
|
import MultiCheckBoxSelect from './MutliCheckBoxSelect';
|
|
11
|
-
|
|
11
|
+
import DoubleInput from './DoubleInput';
|
|
12
|
+
import TimePicker from './TimePicker';
|
|
13
|
+
export { CheckBox, Input, DatePicker, Select, TextArea, DateRangePicker, EnumCheckBoxes, ArrayMultiSelect, ArrayCheckBoxes, MultiCheckBoxSelect, DoubleInput, TimePicker };
|
package/lib/index.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
//
|
|
23
23
|
// ******************************************************************************************************
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.MultiCheckBoxSelect = exports.ArrayCheckBoxes = exports.ArrayMultiSelect = exports.EnumCheckBoxes = exports.DateRangePicker = exports.TextArea = exports.Select = exports.DatePicker = exports.Input = exports.CheckBox = void 0;
|
|
25
|
+
exports.TimePicker = exports.DoubleInput = exports.MultiCheckBoxSelect = exports.ArrayCheckBoxes = exports.ArrayMultiSelect = exports.EnumCheckBoxes = exports.DateRangePicker = exports.TextArea = exports.Select = exports.DatePicker = exports.Input = exports.CheckBox = void 0;
|
|
26
26
|
var CheckBox_1 = require("./CheckBox");
|
|
27
27
|
exports.CheckBox = CheckBox_1.default;
|
|
28
28
|
var Input_1 = require("./Input");
|
|
@@ -43,3 +43,7 @@ var ArrayCheckBoxes_1 = require("./ArrayCheckBoxes");
|
|
|
43
43
|
exports.ArrayCheckBoxes = ArrayCheckBoxes_1.default;
|
|
44
44
|
var MutliCheckBoxSelect_1 = require("./MutliCheckBoxSelect");
|
|
45
45
|
exports.MultiCheckBoxSelect = MutliCheckBoxSelect_1.default;
|
|
46
|
+
var DoubleInput_1 = require("./DoubleInput");
|
|
47
|
+
exports.DoubleInput = DoubleInput_1.default;
|
|
48
|
+
var TimePicker_1 = require("./TimePicker");
|
|
49
|
+
exports.TimePicker = TimePicker_1.default;
|