@gpa-gemstone/react-forms 1.1.8 → 1.1.13
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/README.md +38 -38
- package/lib/ArrayCheckBoxes.d.ts +11 -11
- package/lib/ArrayCheckBoxes.js +73 -75
- package/lib/ArrayMultiSelect.d.ts +13 -13
- package/lib/ArrayMultiSelect.js +47 -47
- package/lib/CheckBox.d.ts +10 -10
- package/lib/CheckBox.js +69 -67
- package/lib/DatePicker.d.ts +10 -10
- package/lib/DatePicker.js +72 -70
- package/lib/DateRangePicker.d.ts +10 -10
- package/lib/DateRangePicker.js +171 -171
- package/lib/DoubleInput.d.ts +12 -12
- package/lib/DoubleInput.js +51 -51
- package/lib/EnumCheckBoxes.d.ts +8 -8
- package/lib/EnumCheckBoxes.js +58 -58
- package/lib/HelperMessage.d.ts +8 -0
- package/lib/HelperMessage.js +70 -0
- package/lib/Input.d.ts +14 -11
- package/lib/Input.js +60 -46
- package/lib/MutliCheckBoxSelect.d.ts +14 -14
- package/lib/MutliCheckBoxSelect.js +75 -75
- package/lib/Select.d.ts +17 -14
- package/lib/Select.js +65 -51
- package/lib/TextArea.d.ts +11 -11
- package/lib/TextArea.js +50 -50
- package/lib/index.d.ts +11 -11
- package/lib/index.js +45 -45
- package/package.json +57 -54
package/README.md
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
# react-forms
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
The Gemstone Web Library organizes all Gemstone functionality related to web.
|
|
6
|
-
|
|
7
|
-
[](https://github.com/gemstone/web/blob/master/LICENSE)
|
|
8
|
-
|
|
9
|
-
This library includes helpful npm package for creating strongly typed form components in react.
|
|
10
|
-
|
|
11
|
-
* Input
|
|
12
|
-
* CheckBox
|
|
13
|
-
* TextArea
|
|
14
|
-
* DatePicker
|
|
15
|
-
* Select
|
|
16
|
-
* EnumCheckBoxes
|
|
17
|
-
* DateRangePicker
|
|
18
|
-
* ArrayCheckBoxes
|
|
19
|
-
* ArrayMultiSelect
|
|
20
|
-
* MultiCheckBoxSelect
|
|
21
|
-
* DoubleInput
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
interface iType = { Field1: string, Field2: number, Field3: boolean, Field4: string, Field5: string, EnumField: number, FromField: string, ToField: string}
|
|
27
|
-
let record:iType = {Field1: 'Hello', Field2: 1, Field3: false, Field4: 'alot of text blah blah blah', Field5: '01/01/2021', FromField: '01/01/2020', ToField: '01/01/2021'}
|
|
28
|
-
let options = [{Value: 1, Label: 'first'}, {Value:2, Label: 'second'}]
|
|
29
|
-
|
|
30
|
-
<Input<iType> Record={record} Field="Field1" Setter={(event) => record.Field1 = event.target.value} Valid={(field) => /*some criteria*/}>
|
|
31
|
-
<CheckBox<iType> Record={record} Field="Field3" Setter={(event) => record.Field3 = event.target.value}}>
|
|
32
|
-
<Select<iType> Record={record} Field="Field2" Setter={(event) => record.Field3 = event.target.value}} Options={options}>
|
|
33
|
-
<TextArea<iType> Record={record} Field="Field4" Setter={(event) => record.Field1 = event.target.value} Valid={(field) => /*some criteria*/}>
|
|
34
|
-
<DatePicker<iType> Record={record} Field="Field5" Setter={(event) => record.Field1 = event.target.value}>
|
|
35
|
-
<DateRangePicker<iType> Record={record} FromField="FromField" ToField="ToField" Label="Date Range" Setter={(event) => record.Field1 = event.target.value}>
|
|
36
|
-
<EnumCheckBoxes<iType> Record={record} Field="EnumField" Setter={(event) => record.Field3 = event.target.value}} Enum={['Monday', 'Tuesday','Wednesday']}>
|
|
37
|
-
<DoubleInput<iType> Record={record} Field1="Field4" Field1="Field5" Setter={(r) => record = r} Valid={(field) => /*some criteria*/}>
|
|
38
|
-
```
|
|
1
|
+
# react-forms
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
The Gemstone Web Library organizes all Gemstone functionality related to web.
|
|
6
|
+
|
|
7
|
+
[](https://github.com/gemstone/web/blob/master/LICENSE)
|
|
8
|
+
|
|
9
|
+
This library includes helpful npm package for creating strongly typed form components in react.
|
|
10
|
+
|
|
11
|
+
* Input
|
|
12
|
+
* CheckBox
|
|
13
|
+
* TextArea
|
|
14
|
+
* DatePicker
|
|
15
|
+
* Select
|
|
16
|
+
* EnumCheckBoxes
|
|
17
|
+
* DateRangePicker
|
|
18
|
+
* ArrayCheckBoxes
|
|
19
|
+
* ArrayMultiSelect
|
|
20
|
+
* MultiCheckBoxSelect
|
|
21
|
+
* DoubleInput
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
interface iType = { Field1: string, Field2: number, Field3: boolean, Field4: string, Field5: string, EnumField: number, FromField: string, ToField: string}
|
|
27
|
+
let record:iType = {Field1: 'Hello', Field2: 1, Field3: false, Field4: 'alot of text blah blah blah', Field5: '01/01/2021', FromField: '01/01/2020', ToField: '01/01/2021'}
|
|
28
|
+
let options = [{Value: 1, Label: 'first'}, {Value:2, Label: 'second'}]
|
|
29
|
+
|
|
30
|
+
<Input<iType> Record={record} Field="Field1" Setter={(event) => record.Field1 = event.target.value} Valid={(field) => /*some criteria*/}>
|
|
31
|
+
<CheckBox<iType> Record={record} Field="Field3" Setter={(event) => record.Field3 = event.target.value}}>
|
|
32
|
+
<Select<iType> Record={record} Field="Field2" Setter={(event) => record.Field3 = event.target.value}} Options={options}>
|
|
33
|
+
<TextArea<iType> Record={record} Field="Field4" Setter={(event) => record.Field1 = event.target.value} Valid={(field) => /*some criteria*/}>
|
|
34
|
+
<DatePicker<iType> Record={record} Field="Field5" Setter={(event) => record.Field1 = event.target.value}>
|
|
35
|
+
<DateRangePicker<iType> Record={record} FromField="FromField" ToField="ToField" Label="Date Range" Setter={(event) => record.Field1 = event.target.value}>
|
|
36
|
+
<EnumCheckBoxes<iType> Record={record} Field="EnumField" Setter={(event) => record.Field3 = event.target.value}} Enum={['Monday', 'Tuesday','Wednesday']}>
|
|
37
|
+
<DoubleInput<iType> Record={record} Field1="Field4" Field1="Field5" Setter={(r) => record = r} Valid={(field) => /*some criteria*/}>
|
|
38
|
+
```
|
package/lib/ArrayCheckBoxes.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export default function ArrayCheckBoxes<T>(props: {
|
|
3
|
-
Record: T;
|
|
4
|
-
Field: keyof T;
|
|
5
|
-
Setter: (record: T) => void;
|
|
6
|
-
Checkboxes: {
|
|
7
|
-
ID: string;
|
|
8
|
-
Label: string;
|
|
9
|
-
}[];
|
|
10
|
-
Label?: string;
|
|
11
|
-
}): JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export default function ArrayCheckBoxes<T>(props: {
|
|
3
|
+
Record: T;
|
|
4
|
+
Field: keyof T;
|
|
5
|
+
Setter: (record: T) => void;
|
|
6
|
+
Checkboxes: {
|
|
7
|
+
ID: string;
|
|
8
|
+
Label: string;
|
|
9
|
+
}[];
|
|
10
|
+
Label?: string;
|
|
11
|
+
}): JSX.Element;
|
package/lib/ArrayCheckBoxes.js
CHANGED
|
@@ -1,75 +1,73 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// ******************************************************************************************************
|
|
3
|
-
// ArrayCheckBoxes.tsx - Gbtc
|
|
4
|
-
//
|
|
5
|
-
// Copyright © 2020, 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
|
-
// 01/22/2020 - Billy Ernest
|
|
21
|
-
// Generated original version of source code.
|
|
22
|
-
//
|
|
23
|
-
// ******************************************************************************************************
|
|
24
|
-
var __assign = (this && this.__assign) || function () {
|
|
25
|
-
__assign = Object.assign || function(t) {
|
|
26
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
27
|
-
s = arguments[i];
|
|
28
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
29
|
-
t[p] = s[p];
|
|
30
|
-
}
|
|
31
|
-
return t;
|
|
32
|
-
};
|
|
33
|
-
return __assign.apply(this, arguments);
|
|
34
|
-
};
|
|
35
|
-
var
|
|
36
|
-
for (var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
React.createElement("
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
React.createElement("
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
exports.default = ArrayCheckBoxes;
|
|
1
|
+
"use strict";
|
|
2
|
+
// ******************************************************************************************************
|
|
3
|
+
// ArrayCheckBoxes.tsx - Gbtc
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2020, 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
|
+
// 01/22/2020 - Billy Ernest
|
|
21
|
+
// Generated original version of source code.
|
|
22
|
+
//
|
|
23
|
+
// ******************************************************************************************************
|
|
24
|
+
var __assign = (this && this.__assign) || function () {
|
|
25
|
+
__assign = Object.assign || function(t) {
|
|
26
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
27
|
+
s = arguments[i];
|
|
28
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
29
|
+
t[p] = s[p];
|
|
30
|
+
}
|
|
31
|
+
return t;
|
|
32
|
+
};
|
|
33
|
+
return __assign.apply(this, arguments);
|
|
34
|
+
};
|
|
35
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
36
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
37
|
+
to[j] = from[i];
|
|
38
|
+
return to;
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
var React = require("react");
|
|
42
|
+
function ArrayCheckBoxes(props) {
|
|
43
|
+
var Remove = function (cb) {
|
|
44
|
+
var a = __spreadArray([], props.Record[props.Field]);
|
|
45
|
+
var i = a.indexOf(cb.ID);
|
|
46
|
+
a.splice(i, 1);
|
|
47
|
+
return a;
|
|
48
|
+
};
|
|
49
|
+
var Add = function (cb) {
|
|
50
|
+
var a = __spreadArray([], props.Record[props.Field]);
|
|
51
|
+
var i = a.indexOf(cb.ID);
|
|
52
|
+
if (i < 0)
|
|
53
|
+
a.push(cb.ID);
|
|
54
|
+
a.sort();
|
|
55
|
+
return a;
|
|
56
|
+
};
|
|
57
|
+
return (React.createElement("div", { className: "form-group" },
|
|
58
|
+
React.createElement("label", null, props.Label == null ? props.Field : props.Label),
|
|
59
|
+
React.createElement("br", null),
|
|
60
|
+
React.createElement("div", { className: "form-check form-check-inline" },
|
|
61
|
+
React.createElement("input", { className: "form-check-input", type: "checkbox", checked: JSON.stringify(props.Record[props.Field]) === JSON.stringify(props.Checkboxes.map(function (x) { return x.ID; })), onChange: function (evt) {
|
|
62
|
+
var _a;
|
|
63
|
+
return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.checked ? props.Checkboxes.map(function (x) { return x.ID; }) : [], _a)));
|
|
64
|
+
} }),
|
|
65
|
+
React.createElement("label", { className: "form-check-label" }, "All")),
|
|
66
|
+
props.Checkboxes.map(function (cb, i) { return (React.createElement("div", { key: i, className: "form-check form-check-inline" },
|
|
67
|
+
React.createElement("input", { className: "form-check-input", type: "checkbox", checked: props.Record[props.Field].find(function (x) { return cb.ID === x; }) !== undefined, onChange: function (evt) {
|
|
68
|
+
var _a;
|
|
69
|
+
return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.checked ? Add(cb) : Remove(cb), _a)));
|
|
70
|
+
} }),
|
|
71
|
+
React.createElement("label", { className: "form-check-label" }, cb.Label))); })));
|
|
72
|
+
}
|
|
73
|
+
exports.default = ArrayCheckBoxes;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export default function ArrayMultiSelect<T>(props: {
|
|
3
|
-
Record: T;
|
|
4
|
-
Field: keyof T;
|
|
5
|
-
Setter: (record: T) => void;
|
|
6
|
-
Options: {
|
|
7
|
-
Value: string;
|
|
8
|
-
Label: string;
|
|
9
|
-
}[];
|
|
10
|
-
Label?: string;
|
|
11
|
-
Disabled?: boolean;
|
|
12
|
-
Style?: React.CSSProperties;
|
|
13
|
-
}): JSX.Element;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export default function ArrayMultiSelect<T>(props: {
|
|
3
|
+
Record: T;
|
|
4
|
+
Field: keyof T;
|
|
5
|
+
Setter: (record: T) => void;
|
|
6
|
+
Options: {
|
|
7
|
+
Value: string;
|
|
8
|
+
Label: string;
|
|
9
|
+
}[];
|
|
10
|
+
Label?: string;
|
|
11
|
+
Disabled?: boolean;
|
|
12
|
+
Style?: React.CSSProperties;
|
|
13
|
+
}): JSX.Element;
|
package/lib/ArrayMultiSelect.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// ******************************************************************************************************
|
|
3
|
-
// ArrayMultiSelect.tsx - Gbtc
|
|
4
|
-
//
|
|
5
|
-
// Copyright © 2020, 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
|
-
// 01/22/2020 - Billy Ernest
|
|
21
|
-
// Generated original version of source code.
|
|
22
|
-
//
|
|
23
|
-
// ******************************************************************************************************
|
|
24
|
-
var __assign = (this && this.__assign) || function () {
|
|
25
|
-
__assign = Object.assign || function(t) {
|
|
26
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
27
|
-
s = arguments[i];
|
|
28
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
29
|
-
t[p] = s[p];
|
|
30
|
-
}
|
|
31
|
-
return t;
|
|
32
|
-
};
|
|
33
|
-
return __assign.apply(this, arguments);
|
|
34
|
-
};
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
var React = require("react");
|
|
37
|
-
function ArrayMultiSelect(props) {
|
|
38
|
-
var _a;
|
|
39
|
-
return (React.createElement("div", { className: "form-group" },
|
|
40
|
-
React.createElement("label", null, props.Label == null ? props.Field : props.Label),
|
|
41
|
-
React.createElement("select", { multiple: true, className: "form-control", onChange: function (evt) {
|
|
42
|
-
var _a;
|
|
43
|
-
var record = __assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = Array.from(evt.target.selectedOptions).map(function (a) { return a.value; }), _a));
|
|
44
|
-
props.Setter(record);
|
|
45
|
-
}, value: (_a = props.Record[props.Field]) !== null && _a !== void 0 ? _a : [], disabled: props.Disabled == null ? false : props.Disabled, style: props.Style }, props.Options.map(function (a, i) { return (React.createElement("option", { key: i, value: a.Value }, a.Label)); }))));
|
|
46
|
-
}
|
|
47
|
-
exports.default = ArrayMultiSelect;
|
|
1
|
+
"use strict";
|
|
2
|
+
// ******************************************************************************************************
|
|
3
|
+
// ArrayMultiSelect.tsx - Gbtc
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2020, 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
|
+
// 01/22/2020 - Billy Ernest
|
|
21
|
+
// Generated original version of source code.
|
|
22
|
+
//
|
|
23
|
+
// ******************************************************************************************************
|
|
24
|
+
var __assign = (this && this.__assign) || function () {
|
|
25
|
+
__assign = Object.assign || function(t) {
|
|
26
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
27
|
+
s = arguments[i];
|
|
28
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
29
|
+
t[p] = s[p];
|
|
30
|
+
}
|
|
31
|
+
return t;
|
|
32
|
+
};
|
|
33
|
+
return __assign.apply(this, arguments);
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
var React = require("react");
|
|
37
|
+
function ArrayMultiSelect(props) {
|
|
38
|
+
var _a;
|
|
39
|
+
return (React.createElement("div", { className: "form-group" },
|
|
40
|
+
React.createElement("label", null, props.Label == null ? props.Field : props.Label),
|
|
41
|
+
React.createElement("select", { multiple: true, className: "form-control", onChange: function (evt) {
|
|
42
|
+
var _a;
|
|
43
|
+
var record = __assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = Array.from(evt.target.selectedOptions).map(function (a) { return a.value; }), _a));
|
|
44
|
+
props.Setter(record);
|
|
45
|
+
}, value: (_a = props.Record[props.Field]) !== null && _a !== void 0 ? _a : [], disabled: props.Disabled == null ? false : props.Disabled, style: props.Style }, props.Options.map(function (a, i) { return (React.createElement("option", { key: i, value: a.Value }, a.Label)); }))));
|
|
46
|
+
}
|
|
47
|
+
exports.default = ArrayMultiSelect;
|
package/lib/CheckBox.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export default class CheckBox<T> extends React.Component<{
|
|
3
|
-
Record: T;
|
|
4
|
-
Field: keyof T;
|
|
5
|
-
Setter: (record: T) => void;
|
|
6
|
-
Label?: string;
|
|
7
|
-
Disabled?: boolean;
|
|
8
|
-
}, {}, {}> {
|
|
9
|
-
render(): JSX.Element;
|
|
10
|
-
}
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export default class CheckBox<T> extends React.Component<{
|
|
3
|
+
Record: T;
|
|
4
|
+
Field: keyof T;
|
|
5
|
+
Setter: (record: T) => void;
|
|
6
|
+
Label?: string;
|
|
7
|
+
Disabled?: boolean;
|
|
8
|
+
}, {}, {}> {
|
|
9
|
+
render(): JSX.Element;
|
|
10
|
+
}
|
package/lib/CheckBox.js
CHANGED
|
@@ -1,67 +1,69 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// ******************************************************************************************************
|
|
3
|
-
// CheckBox.tsx - Gbtc
|
|
4
|
-
//
|
|
5
|
-
// Copyright © 2020, 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
|
-
// 01/22/2020 - Billy Ernest
|
|
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 (
|
|
29
|
-
return extendStatics(d, b);
|
|
30
|
-
};
|
|
31
|
-
return function (d, b) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
d
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
_this.props.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// ******************************************************************************************************
|
|
3
|
+
// CheckBox.tsx - Gbtc
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2020, 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
|
+
// 01/22/2020 - Billy Ernest
|
|
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 CheckBox = /** @class */ (function (_super) {
|
|
53
|
+
__extends(CheckBox, _super);
|
|
54
|
+
function CheckBox() {
|
|
55
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
56
|
+
}
|
|
57
|
+
CheckBox.prototype.render = function () {
|
|
58
|
+
var _this = this;
|
|
59
|
+
return (React.createElement("div", { className: "form-check" },
|
|
60
|
+
React.createElement("input", { type: "checkbox", className: "form-check-input", style: { zIndex: 1 }, onChange: function (evt) {
|
|
61
|
+
var record = __assign({}, _this.props.Record);
|
|
62
|
+
record[_this.props.Field] = evt.target.checked;
|
|
63
|
+
_this.props.Setter(record);
|
|
64
|
+
}, value: this.props.Record[this.props.Field] ? 'on' : 'off', checked: this.props.Record[this.props.Field] ? true : false, disabled: this.props.Disabled == null ? false : this.props.Disabled }),
|
|
65
|
+
React.createElement("label", { className: "form-check-label" }, this.props.Label == null ? this.props.Field : this.props.Label)));
|
|
66
|
+
};
|
|
67
|
+
return CheckBox;
|
|
68
|
+
}(React.Component));
|
|
69
|
+
exports.default = CheckBox;
|
package/lib/DatePicker.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export default class DatePicker<T> extends React.Component<{
|
|
3
|
-
Record: T;
|
|
4
|
-
Field: keyof T;
|
|
5
|
-
Setter: (record: T) => void;
|
|
6
|
-
Label?: string;
|
|
7
|
-
Disabled?: boolean;
|
|
8
|
-
}, {}, {}> {
|
|
9
|
-
render(): JSX.Element;
|
|
10
|
-
}
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export default class DatePicker<T> extends React.Component<{
|
|
3
|
+
Record: T;
|
|
4
|
+
Field: keyof T;
|
|
5
|
+
Setter: (record: T) => void;
|
|
6
|
+
Label?: string;
|
|
7
|
+
Disabled?: boolean;
|
|
8
|
+
}, {}, {}> {
|
|
9
|
+
render(): JSX.Element;
|
|
10
|
+
}
|