@adaptabletools/adaptable 11.1.11 → 11.1.14
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/bundle.cjs.js +50 -49
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/AlertOptions.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptableForm.d.ts +8 -3
- package/src/PredefinedConfig/Common/AdaptableForm.js +1 -1
- package/src/agGrid/Adaptable.js +7 -2
- package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +24 -2
- package/src/metamodel/adaptable.metamodel.js +2 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.14",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1651466660990;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -29,7 +29,7 @@ export interface AlertOptions {
|
|
|
29
29
|
*/
|
|
30
30
|
rowHighlightDuration?: number;
|
|
31
31
|
/**
|
|
32
|
-
* onClick Handlers for
|
|
32
|
+
* Custom onClick Handlers for Buttons (displayed in Alert Forms)
|
|
33
33
|
*/
|
|
34
34
|
actionHandlers?: ActionHandler[];
|
|
35
35
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AdaptableButton, ButtonContext } from './AdaptableButton';
|
|
2
|
+
import { AdaptableFormConfig } from '../../components/FormLayout';
|
|
2
3
|
export declare type AdaptableFormData = Record<string, any>;
|
|
3
4
|
/**
|
|
4
5
|
* Defines a form which appears dynamically; used by Alerts & Export Custom Destinations
|
|
@@ -15,11 +16,15 @@ export interface AdaptableForm<T extends ButtonContext> {
|
|
|
15
16
|
/**
|
|
16
17
|
* Collection of Dynamic Fields to display
|
|
17
18
|
*/
|
|
18
|
-
fields?: AdaptableFormField[];
|
|
19
|
+
fields?: (AdaptableFormField | AdaptableFormField[])[];
|
|
19
20
|
/**
|
|
20
21
|
* Buttons to include in the Form
|
|
21
22
|
*/
|
|
22
23
|
buttons?: AdaptableButton<T>[];
|
|
24
|
+
/**
|
|
25
|
+
* @internal do NOT use this property as it's in an experimental phase
|
|
26
|
+
*/
|
|
27
|
+
config?: AdaptableFormConfig;
|
|
23
28
|
}
|
|
24
29
|
/**
|
|
25
30
|
* Defines a Field that appears in an Adaptable Form
|
|
@@ -34,9 +39,9 @@ export interface AdaptableFormField {
|
|
|
34
39
|
*/
|
|
35
40
|
label: string;
|
|
36
41
|
/**
|
|
37
|
-
* Field Type: text, date, number, checkbox, select
|
|
42
|
+
* Field Type: text, date, number, checkbox, select, textOutput
|
|
38
43
|
*/
|
|
39
|
-
fieldType: 'text' | 'select' | 'date' | 'number' | 'checkbox';
|
|
44
|
+
fieldType: 'text' | 'select' | 'date' | 'number' | 'checkbox' | 'textOutput';
|
|
40
45
|
/**
|
|
41
46
|
* Field Default Value - can be of type string, boolean, number
|
|
42
47
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDefaultAdaptableFormData = void 0;
|
|
4
4
|
function getDefaultAdaptableFormData(formDef) {
|
|
5
|
-
return (formDef.fields || []).reduce((data, field) => {
|
|
5
|
+
return (formDef.fields || []).flat().reduce((data, field) => {
|
|
6
6
|
var _a;
|
|
7
7
|
data[field.name] = (_a = field.defaultValue) !== null && _a !== void 0 ? _a : '';
|
|
8
8
|
return data;
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -619,9 +619,14 @@ class Adaptable {
|
|
|
619
619
|
? this.gridOptions.api.gridOptionsWrapper.layoutElements || []
|
|
620
620
|
: []
|
|
621
621
|
: [];
|
|
622
|
+
// aggrid 25.3.0 doesn't have layoutElements anymore, so we try to retrieve this element
|
|
622
623
|
if (!layoutElements.length) {
|
|
623
|
-
|
|
624
|
-
|
|
624
|
+
const getGridBodyElement = (gridApi) => {
|
|
625
|
+
// @ts-ignore ctrlsService is private
|
|
626
|
+
const gridBodyCtrl = gridApi.ctrlsService.getGridBodyCtrl();
|
|
627
|
+
return gridBodyCtrl.getGridBodyElement();
|
|
628
|
+
};
|
|
629
|
+
layoutElements.push(getGridBodyElement(this.gridOptions.api));
|
|
625
630
|
}
|
|
626
631
|
let agGridContainer;
|
|
627
632
|
for (let i = 0, len = layoutElements.length; i < len; i++) {
|
|
@@ -32,7 +32,7 @@ function AdaptableFormComponentButtons({ formDef, onClick, defaultTone, disabled
|
|
|
32
32
|
}
|
|
33
33
|
exports.AdaptableFormComponentButtons = AdaptableFormComponentButtons;
|
|
34
34
|
function AdaptableFormComponent({ formDef, data, onChange, onButtonClick, displayTitle, api, context, focusFirstButton, }) {
|
|
35
|
-
var _a;
|
|
35
|
+
var _a, _b, _c;
|
|
36
36
|
const getFieldValue = (key) => data[key];
|
|
37
37
|
const setFieldValue = (key, value) => {
|
|
38
38
|
const newData = Object.assign(Object.assign({}, data), { [key]: value });
|
|
@@ -43,6 +43,9 @@ function AdaptableFormComponent({ formDef, data, onChange, onButtonClick, displa
|
|
|
43
43
|
const isValid = !!button.disabled && !!context ? !button.disabled(button, context) : true;
|
|
44
44
|
return !isValid;
|
|
45
45
|
})) !== null && _b !== void 0 ? _b : []; }, [data]);
|
|
46
|
+
const renderLabel = (field) => {
|
|
47
|
+
return (React.createElement(rebass_1.Box, { className: 'ab-FormLayout_column--label', style: { textAlign: 'end' } }, field.label));
|
|
48
|
+
};
|
|
46
49
|
const renderField = (field) => {
|
|
47
50
|
var _a;
|
|
48
51
|
const value = (_a = getFieldValue(field.name)) !== null && _a !== void 0 ? _a : '';
|
|
@@ -81,16 +84,35 @@ function AdaptableFormComponent({ formDef, data, onChange, onButtonClick, displa
|
|
|
81
84
|
return (React.createElement(Input_1.default, { type: "checkbox", name: field.name, checked: value, onChange: (event) => {
|
|
82
85
|
setFieldValue(field.name, event.target.checked);
|
|
83
86
|
} }));
|
|
87
|
+
case 'textOutput':
|
|
88
|
+
return React.createElement(rebass_1.Box, { style: { textAlign: 'center' } }, value);
|
|
84
89
|
default:
|
|
85
90
|
return React.createElement("div", null,
|
|
86
91
|
"Unknown field type: ",
|
|
87
92
|
field.fieldType);
|
|
88
93
|
}
|
|
89
94
|
};
|
|
95
|
+
// by default we have 2 columns: label & input
|
|
96
|
+
const columns = (_b = (_a = formDef.config) === null || _a === void 0 ? void 0 : _a.columns) !== null && _b !== void 0 ? _b : [1, 2];
|
|
90
97
|
return (React.createElement(React.Fragment, null,
|
|
91
98
|
displayTitle && formDef.title && (React.createElement(rebass_1.Box, { fontSize: 5, mb: 2, style: { fontWeight: 'bold' } }, formDef.title)),
|
|
92
99
|
formDef.description && React.createElement(rebass_1.Box, { mb: 3 }, formDef.description),
|
|
93
|
-
React.createElement(FormLayout_1.default,
|
|
100
|
+
React.createElement(FormLayout_1.default, { columns: columns }, (_c = formDef.fields) === null || _c === void 0 ? void 0 : _c.map((field, index) => {
|
|
101
|
+
if (Array.isArray(field)) {
|
|
102
|
+
const rowFields = {};
|
|
103
|
+
field.map((fieldItem, index) => {
|
|
104
|
+
const rowFieldIndex = 2 * index + 1;
|
|
105
|
+
rowFields[rowFieldIndex] = renderLabel(fieldItem);
|
|
106
|
+
rowFields[rowFieldIndex + 1] = renderField(fieldItem);
|
|
107
|
+
});
|
|
108
|
+
return React.createElement(FormLayout_1.FormRow, Object.assign({ key: index }, rowFields));
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
return (React.createElement(FormLayout_1.FormRow, { key: field.name },
|
|
112
|
+
renderLabel(field),
|
|
113
|
+
renderField(field)));
|
|
114
|
+
}
|
|
115
|
+
})),
|
|
94
116
|
formDef.buttons ? (React.createElement(rebass_1.Flex, { marginTop: 3, flexDirection: "row", alignItems: "center", justifyContent: "center" },
|
|
95
117
|
React.createElement(AdaptableFormComponentButtons, { focusFirstButton: focusFirstButton, onClick: onButtonClick, disabledButtons: disabledButtons, defaultTone: "success", formDef: formDef, api: api, context: context }))) : null));
|
|
96
118
|
}
|
|
@@ -837,7 +837,7 @@ exports.ADAPTABLE_METAMODEL = {
|
|
|
837
837
|
{
|
|
838
838
|
"name": "fieldType",
|
|
839
839
|
"kind": "unknown",
|
|
840
|
-
"description": "Field Type: text, date, number, checkbox, select",
|
|
840
|
+
"description": "Field Type: text, date, number, checkbox, select, textOutput",
|
|
841
841
|
"uiLabel": "Field Type"
|
|
842
842
|
},
|
|
843
843
|
{
|
|
@@ -1972,7 +1972,7 @@ exports.ADAPTABLE_METAMODEL = {
|
|
|
1972
1972
|
{
|
|
1973
1973
|
"name": "actionHandlers",
|
|
1974
1974
|
"kind": "unknown",
|
|
1975
|
-
"description": "onClick Handlers for
|
|
1975
|
+
"description": "Custom onClick Handlers for Buttons (displayed in Alert Forms)",
|
|
1976
1976
|
"uiLabel": "Action Handlers",
|
|
1977
1977
|
"isOptional": true
|
|
1978
1978
|
},
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "11.1.
|
|
1
|
+
declare const _default: "11.1.14";
|
|
2
2
|
export default _default;
|
package/version.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = '11.1.
|
|
3
|
+
exports.default = '11.1.14'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version
|