@adaptabletools/adaptable 13.0.0-canary.10 → 13.0.0-canary.12
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 +157 -157
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -0
- package/src/AdaptableOptions/AdaptableQLOptions.d.ts +12 -5
- package/src/Api/ColumnApi.d.ts +7 -1
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +10 -6
- package/src/Api/Implementation/FormatColumnApiImpl.js +3 -5
- package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +2 -1
- package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -15
- package/src/Api/QueryLanguageApi.d.ts +3 -2
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +0 -1
- package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.js +3 -3
- package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +3 -3
- package/src/View/Components/NewScopeComponent.js +2 -2
- package/src/View/Components/RangesComponent.d.ts +6 -0
- package/src/View/Components/RangesComponent.js +54 -18
- package/src/View/Components/ScopeComponent.js +2 -2
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.js +3 -3
- package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +3 -3
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +3 -3
- package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +16 -2
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +3 -3
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -1
- package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +1 -1
- package/src/agGrid/Adaptable.d.ts +6 -1
- package/src/agGrid/Adaptable.js +50 -7
- package/src/agGrid/FilterWrapper.js +4 -0
- package/src/agGrid/FloatingFilterWrapper.d.ts +2 -2
- package/src/agGrid/FloatingFilterWrapper.js +73 -32
- package/src/agGrid/agGridHelper.js +12 -13
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -1
- package/src/agGrid/editors/AdaptableDateEditor/index.js +84 -17
- package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +1 -1
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -3
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +78 -27
- package/src/metamodel/adaptable.metamodel.d.ts +12 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/renderReactRoot.d.ts +2 -0
- package/src/renderReactRoot.js +11 -9
- package/src/types.d.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -1,11 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdaptableNumberEditor = void 0;
|
|
3
|
+
exports.AdaptableNumberEditor = exports.ReactAdaptableNumberEditor = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
|
|
7
7
|
const InternalAdaptableNumberEditor_1 = require("./InternalAdaptableNumberEditor");
|
|
8
8
|
const core_1 = require("@ag-grid-community/core");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
function shouldClearExistingValue(params) {
|
|
11
|
+
return params.eventKey === core_1.KeyCode.BACKSPACE || params.eventKey === core_1.KeyCode.DELETE;
|
|
12
|
+
}
|
|
13
|
+
function isValidChar(char) {
|
|
14
|
+
// allow only digits
|
|
15
|
+
return ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(char);
|
|
16
|
+
// we do NOT allow key shortcuts for starting non-digits (minus sign, decimal separators) as the input[number] handling is very buggy and we would open a can of worms
|
|
17
|
+
}
|
|
18
|
+
function getStartValue(params) {
|
|
19
|
+
if (shouldClearExistingValue(params)) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
if (params.charPress && isValidChar(params.charPress)) {
|
|
23
|
+
return params.charPress;
|
|
24
|
+
}
|
|
25
|
+
return params.value;
|
|
26
|
+
}
|
|
27
|
+
const defaultValueParser = ({ newValue, oldValue: _ }) => {
|
|
28
|
+
return newValue;
|
|
29
|
+
};
|
|
30
|
+
const style = {
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
top: '0px',
|
|
33
|
+
left: '0px',
|
|
34
|
+
right: '0px',
|
|
35
|
+
bottom: '0px',
|
|
36
|
+
};
|
|
37
|
+
exports.ReactAdaptableNumberEditor = (0, react_1.forwardRef)((props, ref) => {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
const [initialValue] = (0, react_1.useState)(() => getStartValue(props));
|
|
40
|
+
const valueRef = (0, react_1.useRef)(initialValue);
|
|
41
|
+
const columnId = props.column.getColId();
|
|
42
|
+
const adaptable = props.api.__adaptable;
|
|
43
|
+
const colValueParser = props.column.getColDef().valueParser;
|
|
44
|
+
const valueParser = typeof colValueParser === 'function' ? colValueParser : defaultValueParser;
|
|
45
|
+
function onValueChange(value) {
|
|
46
|
+
value = valueParser
|
|
47
|
+
? valueParser(Object.assign(Object.assign({}, props), { oldValue: props.value, newValue: value }))
|
|
48
|
+
: value;
|
|
49
|
+
valueRef.current = value;
|
|
50
|
+
}
|
|
51
|
+
const editorRef = (0, react_1.useRef)(null);
|
|
52
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
|
53
|
+
return {
|
|
54
|
+
focusIn() {
|
|
55
|
+
var _a;
|
|
56
|
+
(_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
57
|
+
},
|
|
58
|
+
// the final value to send to the grid, on completion of editing
|
|
59
|
+
getValue() {
|
|
60
|
+
return valueRef.current;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
const editorElement = (React.createElement(InternalAdaptableNumberEditor_1.InternalAdaptableNumberEditor, { defaultValue: initialValue, showClearButton: (_a = props.showClearButton) !== null && _a !== void 0 ? _a : true, emptyValue: (_b = props.emptyValue) !== null && _b !== void 0 ? _b : '', onValueChange: onValueChange, ref: (editor) => {
|
|
65
|
+
editorRef.current = editor;
|
|
66
|
+
editor === null || editor === void 0 ? void 0 : editor.focus();
|
|
67
|
+
} }));
|
|
68
|
+
function onKeyDown(keyDownEvent) {
|
|
69
|
+
adaptable._emit('CellEditorKeyDown', {
|
|
70
|
+
keyDownEvent,
|
|
71
|
+
cellValue: valueRef.current,
|
|
72
|
+
columnId,
|
|
73
|
+
updateValueCallback: (updatedValue) => {
|
|
74
|
+
editorRef.current.setValue(updatedValue);
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return (React.createElement("div", { style: style, onKeyDown: onKeyDown }, (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable)));
|
|
79
|
+
});
|
|
9
80
|
/**
|
|
10
81
|
* Used by default for all `abColDefNumber` columns.
|
|
11
82
|
*
|
|
@@ -29,9 +100,7 @@ const core_1 = require("@ag-grid-community/core");
|
|
|
29
100
|
*/
|
|
30
101
|
class AdaptableNumberEditor {
|
|
31
102
|
constructor() {
|
|
32
|
-
this.valueParser =
|
|
33
|
-
return newValue;
|
|
34
|
-
};
|
|
103
|
+
this.valueParser = defaultValueParser;
|
|
35
104
|
this.onValueChange = (value) => {
|
|
36
105
|
this.value = this.valueParser
|
|
37
106
|
? this.valueParser(Object.assign(Object.assign({}, this.params), { oldValue: this.params.value, newValue: value }))
|
|
@@ -39,7 +108,7 @@ class AdaptableNumberEditor {
|
|
|
39
108
|
};
|
|
40
109
|
}
|
|
41
110
|
init(params) {
|
|
42
|
-
this.value =
|
|
111
|
+
this.value = getStartValue(params);
|
|
43
112
|
this.params = params;
|
|
44
113
|
this.columnId = params.column.getColId();
|
|
45
114
|
const { valueParser } = params.column.getColDef();
|
|
@@ -47,11 +116,10 @@ class AdaptableNumberEditor {
|
|
|
47
116
|
this.valueParser = valueParser;
|
|
48
117
|
}
|
|
49
118
|
this.el = document.createElement('div');
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.el.style.bottom = '0px';
|
|
119
|
+
Object.keys(style).forEach((key) => {
|
|
120
|
+
//@ts-ignore
|
|
121
|
+
this.el.style[key] = style[key];
|
|
122
|
+
});
|
|
55
123
|
}
|
|
56
124
|
/* Component Editor Lifecycle methods */
|
|
57
125
|
// gets called once when grid ready to insert the element
|
|
@@ -92,22 +160,5 @@ class AdaptableNumberEditor {
|
|
|
92
160
|
var _a;
|
|
93
161
|
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
94
162
|
}
|
|
95
|
-
getStartValue(params) {
|
|
96
|
-
if (this.shouldClearExistingValue(params)) {
|
|
97
|
-
return '';
|
|
98
|
-
}
|
|
99
|
-
if (params.charPress && this.isValidChar(params.charPress)) {
|
|
100
|
-
return params.charPress;
|
|
101
|
-
}
|
|
102
|
-
return params.value;
|
|
103
|
-
}
|
|
104
|
-
shouldClearExistingValue(params) {
|
|
105
|
-
return params.eventKey === core_1.KeyCode.BACKSPACE || params.eventKey === core_1.KeyCode.DELETE;
|
|
106
|
-
}
|
|
107
|
-
isValidChar(char) {
|
|
108
|
-
// allow only digits
|
|
109
|
-
return ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(char);
|
|
110
|
-
// we do NOT allow key shortcuts for starting non-digits (minus sign, decimal separators) as the input[number] handling is very buggy and we would open a can of worms
|
|
111
|
-
}
|
|
112
163
|
}
|
|
113
164
|
exports.AdaptableNumberEditor = AdaptableNumberEditor;
|
|
@@ -4195,6 +4195,18 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
4195
4195
|
reference?: undefined;
|
|
4196
4196
|
})[];
|
|
4197
4197
|
};
|
|
4198
|
+
QueryableColumnContext: {
|
|
4199
|
+
name: string;
|
|
4200
|
+
kind: string;
|
|
4201
|
+
description: string;
|
|
4202
|
+
properties: {
|
|
4203
|
+
name: string;
|
|
4204
|
+
kind: string;
|
|
4205
|
+
description: string;
|
|
4206
|
+
uiLabel: string;
|
|
4207
|
+
reference: string;
|
|
4208
|
+
}[];
|
|
4209
|
+
};
|
|
4198
4210
|
QueryApi: {
|
|
4199
4211
|
name: string;
|
|
4200
4212
|
kind: string;
|