@adaptabletools/adaptable 13.1.0 → 13.1.1
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/base.css +561 -1971
- package/base.css.map +1 -1
- package/bundle.cjs.js +222 -222
- package/index.css +196 -847
- package/index.css.map +1 -1
- package/package.json +2 -2
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/ActionOptions.d.ts +4 -1
- package/src/AdaptableOptions/AlertOptions.d.ts +4 -0
- package/src/AdaptableOptions/FinancePluginOptions.d.ts +9 -0
- package/src/AdaptableOptions/GeneralOptions.d.ts +6 -0
- package/src/Api/AlertApi.d.ts +5 -0
- package/src/Api/ColumnApi.d.ts +14 -0
- package/src/Api/FinanceApi.d.ts +5 -0
- package/src/Api/GridApi.d.ts +1 -0
- package/src/Api/IPushPullApi.d.ts +1 -1
- package/src/Api/Implementation/AlertApiImpl.d.ts +1 -0
- package/src/Api/Implementation/AlertApiImpl.js +14 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +3 -0
- package/src/Api/Implementation/ColumnApiImpl.js +11 -0
- package/src/Api/Implementation/FormatColumnApiImpl.js +3 -3
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
- package/src/Api/Implementation/GridApiImpl.js +3 -0
- package/src/Api/Implementation/InternalApiImpl.d.ts +6 -0
- package/src/Api/Implementation/InternalApiImpl.js +66 -0
- package/src/Api/InternalApi.d.ts +6 -0
- package/src/PredefinedConfig/AlertState.d.ts +4 -0
- package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +1 -1
- package/src/PredefinedConfig/Common/FDC3Context.d.ts +2 -2
- package/src/PredefinedConfig/Common/Types.d.ts +1 -1
- package/src/PredefinedConfig/StyledColumnState.d.ts +5 -0
- package/src/PredefinedConfig/SystemState.d.ts +7 -0
- package/src/Redux/ActionsReducers/QuickSearchRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/QuickSearchRedux.js +1 -1
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +8 -0
- package/src/Redux/ActionsReducers/SystemRedux.js +32 -2
- package/src/Strategy/AlertModule.js +1 -1
- package/src/Strategy/FlashingCellModule.js +1 -1
- package/src/Strategy/StyledColumnModule.js +5 -2
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -0
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +0 -4
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +8 -10
- package/src/Utilities/Extensions/ObjectExtensions.d.ts +10 -0
- package/src/Utilities/Extensions/ObjectExtensions.js +20 -0
- package/src/Utilities/Helpers/FormatHelper.d.ts +1 -1
- package/src/Utilities/Helpers/FormatHelper.js +7 -1
- package/src/Utilities/Services/LicenseService/index.js +1 -1
- package/src/View/Alert/Wizard/AlertDisplayWizardSection.js +16 -8
- package/src/View/Components/Charting/ChartingViewPanel.js +9 -7
- package/src/View/Components/Charting/ShowChartButton.js +6 -6
- package/src/View/Components/FilterForm/ListBoxFilterForm.d.ts +2 -2
- package/src/View/Components/FilterForm/QuickFilterForm.js +2 -2
- package/src/View/Components/RangesComponent.js +1 -1
- package/src/View/Dashboard/Dashboard.js +3 -2
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.d.ts +6 -0
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +285 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +28 -17
- package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +7 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +16 -7
- package/src/agGrid/Adaptable.d.ts +10 -1
- package/src/agGrid/Adaptable.js +89 -7
- package/src/agGrid/agGridHelper.js +12 -0
- package/src/components/ColorPicker/ColorPicker.js +1 -1
- package/src/components/Datepicker/index.d.ts +1 -1
- package/src/components/Datepicker/index.js +1 -1
- package/src/components/DropdownButton/index.js +2 -2
- package/src/components/ExpressionEditor/index.js +3 -41
- package/src/components/OverlayTrigger/Overlay.d.ts +1 -4
- package/src/components/OverlayTrigger/Overlay.js +3 -40
- package/src/components/OverlayTrigger/index.d.ts +4 -4
- package/src/components/OverlayTrigger/index.js +71 -50
- package/src/components/SimpleButton/index.d.ts +0 -2
- package/src/components/SimpleButton/index.js +2 -2
- package/src/components/Tooltip/index.d.ts +1 -3
- package/src/components/Tooltip/index.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +7 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/components/OverlayTrigger/getOverlayStyle.d.ts +0 -13
- package/src/components/OverlayTrigger/getOverlayStyle.js +0 -56
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AdaptableNoCodeWizard = exports.Adaptable = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const core_1 = require("@ag-grid-community/core");
|
|
6
|
+
const merge_1 = tslib_1.__importDefault(require("lodash/merge"));
|
|
6
7
|
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
7
8
|
const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
|
|
8
9
|
const throttle_1 = tslib_1.__importDefault(require("lodash/throttle"));
|
|
@@ -350,7 +351,7 @@ class Adaptable {
|
|
|
350
351
|
// the 'old' constructor which takes an Adaptable adaptable object
|
|
351
352
|
// this is still used internally but should not be used externally as a preference
|
|
352
353
|
async init(adaptableOptions, runtimeConfig, _staticInit) {
|
|
353
|
-
var _a, _b, _c, _d, _e, _f;
|
|
354
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
354
355
|
if (runtimeConfig) {
|
|
355
356
|
this.supressReact18RenderWarning = !!runtimeConfig.supressReact18RenderWarning;
|
|
356
357
|
if (runtimeConfig.renderReactRoot) {
|
|
@@ -453,6 +454,7 @@ class Adaptable {
|
|
|
453
454
|
abColDefDate: (_d = this.gridOptions.columnTypes.abColDefDate) !== null && _d !== void 0 ? _d : {},
|
|
454
455
|
abColDefObject: (_e = this.gridOptions.columnTypes.abColDefObject) !== null && _e !== void 0 ? _e : {},
|
|
455
456
|
abColDefCustom: (_f = this.gridOptions.columnTypes.abColDefCustom) !== null && _f !== void 0 ? _f : {},
|
|
457
|
+
abColDefNumberArray: (_g = this.gridOptions.columnTypes.abColDefNumberArray) !== null && _g !== void 0 ? _g : {},
|
|
456
458
|
});
|
|
457
459
|
if (this.gridOptions.columnTypes.abColDefNumber.cellEditor === undefined) {
|
|
458
460
|
this.gridOptions.columnTypes.abColDefNumber.cellEditor =
|
|
@@ -1514,9 +1516,10 @@ class Adaptable {
|
|
|
1514
1516
|
* This is the opposite of setLayout
|
|
1515
1517
|
*/
|
|
1516
1518
|
updateLayoutFromGrid() {
|
|
1519
|
+
var _a, _b;
|
|
1517
1520
|
const currentLayout = this.api.layoutApi.getCurrentLayout();
|
|
1518
1521
|
const layout = Object.assign({}, currentLayout);
|
|
1519
|
-
|
|
1522
|
+
let columnOrder = [];
|
|
1520
1523
|
const columnFlexes = {};
|
|
1521
1524
|
const pinnedColumns = {};
|
|
1522
1525
|
const columnSorts = [];
|
|
@@ -1566,6 +1569,12 @@ class Adaptable {
|
|
|
1566
1569
|
});
|
|
1567
1570
|
groupedColumns = groupedColumns.filter((x) => !!x);
|
|
1568
1571
|
pivotedColumns = pivotedColumns.filter((x) => !!x);
|
|
1572
|
+
if ((_b = (_a = this.adaptableOptions) === null || _a === void 0 ? void 0 : _a.generalOptions) === null || _b === void 0 ? void 0 : _b.keepGroupedColumnIndex) {
|
|
1573
|
+
columnOrder = this.restoreUnGroupColumnOrder({
|
|
1574
|
+
columnOrder,
|
|
1575
|
+
newGroupColumns: groupedColumns,
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1569
1578
|
layout.ColumnWidthMap = columnWidths;
|
|
1570
1579
|
// layout.ColumnFlexMap = columnFlexes;
|
|
1571
1580
|
layout.PinnedColumnsMap = pinnedColumns;
|
|
@@ -2848,9 +2857,13 @@ class Adaptable {
|
|
|
2848
2857
|
* Action: Make the column invisible
|
|
2849
2858
|
*/
|
|
2850
2859
|
this.gridOptions.api.addEventListener(core_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, (this.listenerColumnRowGroupChanged = (params) => {
|
|
2860
|
+
var _a, _b;
|
|
2851
2861
|
if (this.api.internalApi.isGridInPivotMode()) {
|
|
2852
2862
|
return;
|
|
2853
2863
|
}
|
|
2864
|
+
if ((_b = (_a = this.adaptableOptions) === null || _a === void 0 ? void 0 : _a.generalOptions) === null || _b === void 0 ? void 0 : _b.keepGroupedColumnIndex) {
|
|
2865
|
+
this.persistColumnIndexBeforeGrouping(params);
|
|
2866
|
+
}
|
|
2854
2867
|
if (this.adaptableOptions.columnOptions.hideColumnWhenGrouped === true &&
|
|
2855
2868
|
params.source !== 'api') {
|
|
2856
2869
|
params.columns.forEach((col) => {
|
|
@@ -3312,6 +3325,18 @@ class Adaptable {
|
|
|
3312
3325
|
if (styledColumn.CheckBoxStyle) {
|
|
3313
3326
|
return this.agGridHelper.createCheckboxRendererComp(abColumn.columnId, abColumn.readOnly);
|
|
3314
3327
|
}
|
|
3328
|
+
if (styledColumn.SparkLineStyle) {
|
|
3329
|
+
return 'agSparklineCellRenderer';
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
});
|
|
3333
|
+
this.setColDefProperty(col, 'cellRendererParams', (userDefined) => {
|
|
3334
|
+
const styledColumn = this.api.styledColumnApi.getStyledColumnByColumnId(abColumn.columnId);
|
|
3335
|
+
if (styledColumn && !styledColumn.IsSuspended) {
|
|
3336
|
+
if (styledColumn.SparkLineStyle) {
|
|
3337
|
+
const sparklineOptions = (0, merge_1.default)({}, userDefined === null || userDefined === void 0 ? void 0 : userDefined.sparklineOptions, styledColumn.SparkLineStyle.options);
|
|
3338
|
+
return Object.assign(Object.assign({}, userDefined), { sparklineOptions });
|
|
3339
|
+
}
|
|
3315
3340
|
}
|
|
3316
3341
|
});
|
|
3317
3342
|
}
|
|
@@ -4651,17 +4676,19 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
|
|
|
4651
4676
|
return this.ReportService.getCellExportValueFromRowNode(rowNode, columnId);
|
|
4652
4677
|
}
|
|
4653
4678
|
processRowGroupForExcelExport(rowNode) {
|
|
4654
|
-
|
|
4679
|
+
var _a, _b, _c, _d, _e;
|
|
4680
|
+
const columnId = (_c = (_a = rowNode.field) !== null && _a !== void 0 ? _a : (_b = rowNode.rowGroupColumn) === null || _b === void 0 ? void 0 : _b.getColId()) !== null && _c !== void 0 ? _c : (_e = (_d = rowNode.rowGroupColumn) === null || _d === void 0 ? void 0 : _d.getColDef()) === null || _e === void 0 ? void 0 : _e.field;
|
|
4681
|
+
if (!columnId || !rowNode.key) {
|
|
4655
4682
|
return;
|
|
4656
4683
|
}
|
|
4657
|
-
const columnId = rowNode.field;
|
|
4658
4684
|
let rawValue = rowNode.key;
|
|
4659
4685
|
if (this.api.columnApi.getColumnDataTypeFromColumnId(columnId) === 'Date' &&
|
|
4660
4686
|
typeof rawValue === 'string') {
|
|
4661
4687
|
// AG-Grid converts the value to string, we have to reconvert it back
|
|
4662
|
-
const
|
|
4663
|
-
if (
|
|
4664
|
-
|
|
4688
|
+
const dateRawValue = (0, DateHelper_1.parseDateValue)(rawValue);
|
|
4689
|
+
if (dateRawValue != undefined) {
|
|
4690
|
+
// @ts-ignore
|
|
4691
|
+
rawValue = dateRawValue;
|
|
4665
4692
|
}
|
|
4666
4693
|
}
|
|
4667
4694
|
return this.ReportService.getCellExportValueFromRawValue(rowNode, rawValue, columnId);
|
|
@@ -4795,6 +4822,61 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
|
|
|
4795
4822
|
this.columnMinMaxValuesCache[columnId] = Object.assign(Object.assign({}, this.columnMinMaxValuesCache[columnId]), { [minMax]: value });
|
|
4796
4823
|
return value;
|
|
4797
4824
|
}
|
|
4825
|
+
persistColumnIndexBeforeGrouping(params) {
|
|
4826
|
+
const layout = this.api.layoutApi.getCurrentLayout();
|
|
4827
|
+
const columnGroupsInLayout = layout.RowGroupedColumns;
|
|
4828
|
+
const columnGroupsInGrid = params.columns.map((col) => col.getColId());
|
|
4829
|
+
// what is new
|
|
4830
|
+
const newGroups = columnGroupsInGrid.filter((colId) => !columnGroupsInLayout.includes(colId));
|
|
4831
|
+
newGroups.forEach((colId) => {
|
|
4832
|
+
const columnIndex = layout.Columns.findIndex((columnIdInLayout) => columnIdInLayout === colId);
|
|
4833
|
+
// user may group after a column not in layout
|
|
4834
|
+
if (columnIndex !== -1) {
|
|
4835
|
+
this.api.internalApi.persistPreviousGroupedColumnsIndex(layout.Uuid, colId, columnIndex);
|
|
4836
|
+
}
|
|
4837
|
+
});
|
|
4838
|
+
}
|
|
4839
|
+
/**
|
|
4840
|
+
* Restores the order previous grouping order.
|
|
4841
|
+
|
|
4842
|
+
*/
|
|
4843
|
+
restoreUnGroupColumnOrder({ newGroupColumns, columnOrder, }) {
|
|
4844
|
+
var _a;
|
|
4845
|
+
const newColumnOrder = [...columnOrder];
|
|
4846
|
+
const currentLayout = this.api.layoutApi.getCurrentLayout();
|
|
4847
|
+
const previousGroupedColumnsIndex = this.api.internalApi.getPreviousGroupedColumnsIndex(currentLayout.Uuid);
|
|
4848
|
+
const isUnGroup = newGroupColumns.length < ((_a = currentLayout === null || currentLayout === void 0 ? void 0 : currentLayout.RowGroupedColumns) === null || _a === void 0 ? void 0 : _a.length);
|
|
4849
|
+
if (!isUnGroup) {
|
|
4850
|
+
return columnOrder;
|
|
4851
|
+
}
|
|
4852
|
+
if (!previousGroupedColumnsIndex) {
|
|
4853
|
+
return columnOrder;
|
|
4854
|
+
}
|
|
4855
|
+
for (let [colId, previousIndex] of Object.entries(previousGroupedColumnsIndex)) {
|
|
4856
|
+
const isStillGrouped = newGroupColumns.includes(colId);
|
|
4857
|
+
const isAlreadyInGrid = currentLayout.Columns.includes(colId); // was not just added by ungrouping
|
|
4858
|
+
if (isStillGrouped) {
|
|
4859
|
+
break;
|
|
4860
|
+
}
|
|
4861
|
+
if (isAlreadyInGrid) {
|
|
4862
|
+
// no longer grouped, but already in grid, this means it was already in grid before ungrouping
|
|
4863
|
+
// in this case the state can be cleared
|
|
4864
|
+
this.api.internalApi.persistPreviousGroupedColumnsIndex(currentLayout.Uuid, colId, null);
|
|
4865
|
+
break;
|
|
4866
|
+
}
|
|
4867
|
+
const indexInGrid = newColumnOrder.indexOf(colId);
|
|
4868
|
+
const hasDifferentPositionAsPreviousLayout = previousIndex !== null && // if null, the reorder was already applied
|
|
4869
|
+
indexInGrid > 0 && // needs to be in grid
|
|
4870
|
+
previousIndex !== indexInGrid;
|
|
4871
|
+
const isPreviousPositionInRange = previousIndex < newColumnOrder.length;
|
|
4872
|
+
if (hasDifferentPositionAsPreviousLayout && isPreviousPositionInRange) {
|
|
4873
|
+
newColumnOrder.splice(indexInGrid, 1);
|
|
4874
|
+
newColumnOrder.splice(previousIndex, 0, colId);
|
|
4875
|
+
}
|
|
4876
|
+
this.api.internalApi.persistPreviousGroupedColumnsIndex(currentLayout.Uuid, colId, null);
|
|
4877
|
+
}
|
|
4878
|
+
return newColumnOrder;
|
|
4879
|
+
}
|
|
4798
4880
|
}
|
|
4799
4881
|
exports.Adaptable = Adaptable;
|
|
4800
4882
|
class AdaptableNoCodeWizard {
|
|
@@ -474,6 +474,12 @@ class agGridHelper {
|
|
|
474
474
|
return 'Date';
|
|
475
475
|
case 'abColDefObject':
|
|
476
476
|
return 'Object';
|
|
477
|
+
case 'abColDefNumberArray':
|
|
478
|
+
return 'NumberArray';
|
|
479
|
+
case 'abColDefTupleNumberArray':
|
|
480
|
+
return 'TupleNumberArray';
|
|
481
|
+
case 'abColDefObjectNumberArray':
|
|
482
|
+
return 'ObjectNumberArray';
|
|
477
483
|
default:
|
|
478
484
|
return 'Unknown';
|
|
479
485
|
}
|
|
@@ -495,6 +501,12 @@ class agGridHelper {
|
|
|
495
501
|
return 'abColDefObject';
|
|
496
502
|
case 'String':
|
|
497
503
|
return 'abColDefString';
|
|
504
|
+
case 'NumberArray':
|
|
505
|
+
return 'abColDefNumberArray';
|
|
506
|
+
case 'TupleNumberArray':
|
|
507
|
+
return 'abColDefTupleNumberArray';
|
|
508
|
+
case 'ObjectNumberArray':
|
|
509
|
+
return 'abColDefObjectNumberArray';
|
|
498
510
|
default:
|
|
499
511
|
return 'abColDefCustom';
|
|
500
512
|
}
|
|
@@ -43,5 +43,5 @@ exports.ColorPicker = React.forwardRef((props, ref) => {
|
|
|
43
43
|
React.createElement(Input_1.default, { className: "ab-ColorPicker-range", style: { background: rangeBackround }, value: alpha, onChange: (event) => {
|
|
44
44
|
const color = tinycolor(value).setAlpha(event.target.value).toRgbString();
|
|
45
45
|
props.onChange(color);
|
|
46
|
-
}, min: 0, max: 1, step: 0.
|
|
46
|
+
}, min: 0, max: 1, step: 0.01, type: "range" })))));
|
|
47
47
|
});
|
|
@@ -15,4 +15,4 @@ export declare type DatepickerProps = Omit<BoxProps, 'value' | 'onChange' | 'def
|
|
|
15
15
|
showWeekNumber?: boolean;
|
|
16
16
|
showOutsideDays?: boolean;
|
|
17
17
|
};
|
|
18
|
-
export declare const Datepicker: React.ForwardRefExoticComponent<Pick<DatepickerProps, "max" | "required" | "type" | "data" | "default" | "high" | "low" | "key" | "id" | "media" | "height" | "width" | "start" | "open" | "name" | "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "color" | "content" | "display" | "flex" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "margin" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "opacity" | "order" | "overflow" | "overflowX" | "overflowY" | "padding" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "textAlign" | "translate" | "verticalAlign" | "value" | "hidden" | "cite" | "dir" | "form" | "label" | "p" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "acceptCharset" | "action" | "method" | "noValidate" | "target" | "accessKey" | "draggable" | "lang" | "className" | "prefix" | "children" | "contentEditable" | "inputMode" | "nonce" | "tabIndex" | "async" | "disabled" | "multiple" | "size" | "manifest" | "m" | "wrap" | "accept" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "marginHeight" | "marginWidth" | "maxLength" | "mediaGroup" | "min" | "minLength" | "muted" | "optimum" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "useMap" | "wmode" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "bg" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "css" | "variant" | "tx" | "sx" | "
|
|
18
|
+
export declare const Datepicker: React.ForwardRefExoticComponent<Pick<DatepickerProps, "max" | "required" | "type" | "data" | "default" | "high" | "low" | "key" | "id" | "media" | "height" | "width" | "start" | "open" | "name" | "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "color" | "content" | "display" | "flex" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "margin" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "opacity" | "order" | "overflow" | "overflowX" | "overflowY" | "padding" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "textAlign" | "translate" | "verticalAlign" | "value" | "hidden" | "cite" | "dir" | "form" | "label" | "p" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "acceptCharset" | "action" | "method" | "noValidate" | "target" | "accessKey" | "draggable" | "lang" | "className" | "prefix" | "children" | "contentEditable" | "inputMode" | "nonce" | "tabIndex" | "async" | "disabled" | "multiple" | "size" | "manifest" | "m" | "wrap" | "accept" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "marginHeight" | "marginWidth" | "maxLength" | "mediaGroup" | "min" | "minLength" | "muted" | "optimum" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "useMap" | "wmode" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "bg" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "css" | "variant" | "tx" | "sx" | "onHide" | "showOutsideDays" | "showWeekNumber" | "showClearButton" | "datepickerButtons" | "dateProps"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -87,7 +87,7 @@ exports.Datepicker = React.forwardRef((props, ref) => {
|
|
|
87
87
|
}, accessLevel: 'Full' })) : null;
|
|
88
88
|
const calendarButton = (React.createElement(SimpleButton_1.default, { disabled: disabled, variant: "text", icon: "calendar", tooltip: "Date", iconSize: 20, px: 0, py: 0, onClick: () => setVisible(true) }));
|
|
89
89
|
return (React.createElement(rebass_1.Flex, null,
|
|
90
|
-
React.createElement(OverlayTrigger_1.default, { visible: visible,
|
|
90
|
+
React.createElement(OverlayTrigger_1.default, { visible: visible, render: () => (React.createElement(DatepickerOverlay, { onHide: () => setVisible(false), onKeyDown: (e) => {
|
|
91
91
|
if (e.key === 'Escape' || e.key === 'Enter') {
|
|
92
92
|
setVisible(false, e.key);
|
|
93
93
|
}
|
|
@@ -102,9 +102,9 @@ const DropdownButton = React.forwardRef((props, theRef) => {
|
|
|
102
102
|
hasClearButton ? clearButton : null,
|
|
103
103
|
icon));
|
|
104
104
|
const buttonRef = (0, react_1.useRef)(null);
|
|
105
|
-
return (React.createElement(OverlayTrigger_1.default, Object.assign({ visible: expanded,
|
|
105
|
+
return (React.createElement(OverlayTrigger_1.default, Object.assign({ visible: expanded, targetOffset: listOffset, render: () => {
|
|
106
106
|
return (React.createElement("div", { "data-name": `${dropdownButtonClassName}`, style: listStyle, className: `${baseClassName}__list` }, content));
|
|
107
|
-
} }, overlayProps
|
|
107
|
+
} }, overlayProps),
|
|
108
108
|
React.createElement(SimpleButton_1.default, Object.assign({ iconPosition: "end" }, (showToggleIcon && { icon, paddingRight: 0 }), domProps, { ref: (btn) => {
|
|
109
109
|
buttonRef.current = btn;
|
|
110
110
|
if (!theRef) {
|
|
@@ -50,50 +50,12 @@ function ExpressionEditor(props) {
|
|
|
50
50
|
const queryableColumns = type === 'scalar' || type === 'boolean' || type === 'aggregatedScalar'
|
|
51
51
|
? props.columns
|
|
52
52
|
: props.columns.filter((c) => !props.api.columnApi.isCalculatedColumn(c.columnId));
|
|
53
|
-
// borrowed from https://github.com/ag-grid/ag-grid/blob/v27.2.1/community-modules/core/src/ts/utils/object.ts#L205
|
|
54
53
|
const getColValue = (column) => {
|
|
55
|
-
|
|
56
|
-
const columnValueKey = (_a = column.field) !== null && _a !== void 0 ? _a : column.columnId;
|
|
57
|
-
const isColumnValueContainsDots = (_b = column.field) === null || _b === void 0 ? void 0 : _b.includes('.');
|
|
58
|
-
// if no '.', then it's not a deep value
|
|
59
|
-
if (!isColumnValueContainsDots) {
|
|
60
|
-
return data[columnValueKey];
|
|
61
|
-
}
|
|
62
|
-
// otherwise it is a deep value, so need to dig for it
|
|
63
|
-
const fields = columnValueKey.split('.');
|
|
64
|
-
let currentObject = data;
|
|
65
|
-
for (let i = 0; i < fields.length; i++) {
|
|
66
|
-
if (currentObject == null) {
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
currentObject = currentObject[fields[i]];
|
|
70
|
-
}
|
|
71
|
-
return currentObject;
|
|
54
|
+
return props.api.internalApi.getValueUsingField(data, column);
|
|
72
55
|
};
|
|
73
|
-
// borrowed from https://github.com/ag-grid/ag-grid/blob/v27.2.1/community-modules/core/src/ts/valueService/valueService.ts#L217
|
|
74
56
|
const updateColValue = (rowData, column, newValue) => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const isColumnValueContainsDots = (_b = column.field) === null || _b === void 0 ? void 0 : _b.includes('.');
|
|
78
|
-
// if no '.', then it's not a deep value
|
|
79
|
-
if (!isColumnValueContainsDots) {
|
|
80
|
-
rowData[columnValueKey] = newValue;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
// otherwise it is a deep value, so need to dig for it
|
|
84
|
-
const fieldPieces = columnValueKey.split('.');
|
|
85
|
-
let currentObject = rowData;
|
|
86
|
-
while (fieldPieces.length > 0 && currentObject) {
|
|
87
|
-
const fieldPiece = fieldPieces.shift();
|
|
88
|
-
if (fieldPieces.length === 0) {
|
|
89
|
-
currentObject[fieldPiece] = newValue;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
currentObject = currentObject[fieldPiece];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return Object.assign({}, rowData);
|
|
57
|
+
const updatedRowData = props.api.internalApi.setValueUsingField(rowData, column, newValue);
|
|
58
|
+
return Object.assign({}, updatedRowData);
|
|
97
59
|
};
|
|
98
60
|
const getColDateValue = (column) => {
|
|
99
61
|
const colValue = getColValue(column);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { HTMLAttributes } from 'react';
|
|
3
|
-
import { BoundingClientRect } from '../utils/getAvailableSizeInfo';
|
|
4
3
|
export interface OverlayProps extends HTMLAttributes<HTMLElement> {
|
|
5
4
|
visible: boolean;
|
|
6
|
-
|
|
7
|
-
position: 'top' | 'bottom' | 'left' | 'right';
|
|
8
|
-
getConstrainRect: () => BoundingClientRect;
|
|
5
|
+
onTransitionEnd?: () => void;
|
|
9
6
|
}
|
|
10
7
|
export declare const useRefresh: () => () => void;
|
|
11
8
|
declare const Overlay: React.ForwardRefExoticComponent<OverlayProps & React.RefAttributes<Element>>;
|
|
@@ -6,8 +6,6 @@ const React = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const batchUpdate_1 = tslib_1.__importDefault(require("../utils/batchUpdate"));
|
|
8
8
|
const usePrevious_1 = tslib_1.__importDefault(require("../utils/usePrevious"));
|
|
9
|
-
const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
|
|
10
|
-
const utils_1 = require("./utils");
|
|
11
9
|
const useRefresh = () => {
|
|
12
10
|
const [x, update] = (0, react_1.useState)(0);
|
|
13
11
|
return () => {
|
|
@@ -15,13 +13,8 @@ const useRefresh = () => {
|
|
|
15
13
|
};
|
|
16
14
|
};
|
|
17
15
|
exports.useRefresh = useRefresh;
|
|
18
|
-
const translateToValues = (x) => x
|
|
19
|
-
.split('(')[1]
|
|
20
|
-
.split(')')[0]
|
|
21
|
-
.split(',')
|
|
22
|
-
.map((s) => s.trim());
|
|
23
16
|
const Overlay = React.forwardRef((props, ref) => {
|
|
24
|
-
const { visible
|
|
17
|
+
const { visible } = props, domProps = tslib_1.__rest(props, ["visible"]);
|
|
25
18
|
const domRef = (0, react_1.useRef)(null);
|
|
26
19
|
const setRef = (node) => {
|
|
27
20
|
domRef.current = node;
|
|
@@ -40,44 +33,14 @@ const Overlay = React.forwardRef((props, ref) => {
|
|
|
40
33
|
setOpacity(props.visible ? 1 : 0);
|
|
41
34
|
}).commit();
|
|
42
35
|
}, [visible]);
|
|
43
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
44
|
-
if (!visible) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const constrainRect = getConstrainRect();
|
|
48
|
-
const domNode = domRef.current;
|
|
49
|
-
const thisRect = (0, utils_1.getRect)(domNode);
|
|
50
|
-
const intersection = (0, utils_1.getIntersection)(constrainRect, thisRect);
|
|
51
|
-
if (!(0, isEqual_1.default)(intersection, thisRect)) {
|
|
52
|
-
const transform = props.style
|
|
53
|
-
? props.style.transform || 'translate3d(0px, 0px, 0px)'
|
|
54
|
-
: 'translate3d(0px, 0px, 0px)';
|
|
55
|
-
const horizontalDiff = Math.round(thisRect.left < constrainRect.left
|
|
56
|
-
? constrainRect.left - thisRect.left
|
|
57
|
-
: thisRect.right > constrainRect.right
|
|
58
|
-
? constrainRect.right - thisRect.right
|
|
59
|
-
: 0);
|
|
60
|
-
const verticalDiff = Math.round(thisRect.top < constrainRect.top
|
|
61
|
-
? constrainRect.top - thisRect.top
|
|
62
|
-
: thisRect.bottom > constrainRect.bottom
|
|
63
|
-
? constrainRect.bottom - thisRect.bottom
|
|
64
|
-
: 0);
|
|
65
|
-
const values = translateToValues(transform);
|
|
66
|
-
if (horizontalDiff) {
|
|
67
|
-
values[0] = `calc(${values[0]} + ${horizontalDiff}px)`;
|
|
68
|
-
}
|
|
69
|
-
if (verticalDiff) {
|
|
70
|
-
values[1] = `calc(${values[1]} + ${verticalDiff}px)`;
|
|
71
|
-
}
|
|
72
|
-
domNode.style.transform = `translate3d(${values.join(', ')})`;
|
|
73
|
-
}
|
|
74
|
-
}, [visible]);
|
|
75
36
|
if (prevVisible && !visible) {
|
|
76
37
|
transitionInProgressRef.current = true;
|
|
77
38
|
}
|
|
78
39
|
const onTransitionEnd = () => {
|
|
40
|
+
var _a;
|
|
79
41
|
transitionInProgressRef.current = false;
|
|
80
42
|
refresh();
|
|
43
|
+
(_a = props === null || props === void 0 ? void 0 : props.onTransitionEnd) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
81
44
|
};
|
|
82
45
|
const renderTime = Date.now();
|
|
83
46
|
const renderTimeRef = (0, react_1.useRef)(renderTime);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { OverlayHorizontalAlign } from './getOverlayStyle';
|
|
3
|
+
import { OverlayShowParams } from '../InfiniteTable';
|
|
5
4
|
export declare type ConstrainToType = ((node: HTMLElement) => HTMLElement) | string;
|
|
6
|
-
export declare const
|
|
5
|
+
export declare const getConstrainElement: (target: HTMLElement, constrainTo?: ConstrainToType) => HTMLElement;
|
|
6
|
+
export declare const getConstrainRect: (target: HTMLElement, constrainTo?: ConstrainToType) => import("../utils/getAvailableSizeInfo").BoundingClientRect;
|
|
7
7
|
export interface OverlayTriggerProps extends React.HTMLAttributes<HTMLElement> {
|
|
8
8
|
opacityTransitionDuration?: string | number;
|
|
9
9
|
children: React.ReactNode;
|
|
@@ -20,7 +20,7 @@ export interface OverlayTriggerProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
20
20
|
targetOffset?: number;
|
|
21
21
|
defaultZIndex?: number;
|
|
22
22
|
anchor?: 'vertical' | 'horizontal';
|
|
23
|
-
|
|
23
|
+
alignPosition?: OverlayShowParams['alignPosition'];
|
|
24
24
|
constrainTo?: ConstrainToType;
|
|
25
25
|
}
|
|
26
26
|
declare const OverlayTrigger: React.ForwardRefExoticComponent<OverlayTriggerProps & React.RefAttributes<{
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getConstrainRect = void 0;
|
|
3
|
+
exports.getConstrainRect = exports.getConstrainElement = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const batchUpdate_1 = tslib_1.__importDefault(require("../utils/batchUpdate"));
|
|
8
|
-
const getAvailableSizeInfo_1 = tslib_1.__importDefault(require("../utils/getAvailableSizeInfo"));
|
|
9
|
-
const react_dom_1 = require("react-dom");
|
|
10
8
|
const selectParent_1 = tslib_1.__importDefault(require("../utils/selectParent"));
|
|
11
9
|
const useProperty_1 = tslib_1.__importDefault(require("../utils/useProperty"));
|
|
12
10
|
const Overlay_1 = tslib_1.__importDefault(require("./Overlay"));
|
|
13
|
-
const getOverlayStyle_1 = tslib_1.__importDefault(require("./getOverlayStyle"));
|
|
14
11
|
const join_1 = tslib_1.__importDefault(require("../utils/join"));
|
|
15
12
|
const usePrevious_1 = tslib_1.__importDefault(require("../utils/usePrevious"));
|
|
16
13
|
const utils_1 = require("./utils");
|
|
@@ -18,7 +15,9 @@ const LoggingHelper_1 = require("../../Utilities/Helpers/LoggingHelper");
|
|
|
18
15
|
const useAgGridClassName_1 = tslib_1.__importDefault(require("./useAgGridClassName"));
|
|
19
16
|
const contains_1 = tslib_1.__importDefault(require("../utils/contains"));
|
|
20
17
|
const UIHelper_1 = require("../../View/UIHelper");
|
|
21
|
-
const
|
|
18
|
+
const InfiniteTable_1 = require("../InfiniteTable");
|
|
19
|
+
const AdaptableContext_1 = require("../../View/AdaptableContext");
|
|
20
|
+
const getConstrainElement = (target, constrainTo) => {
|
|
22
21
|
let el = null;
|
|
23
22
|
if (typeof constrainTo === 'string') {
|
|
24
23
|
el = (0, selectParent_1.default)(constrainTo, target);
|
|
@@ -26,6 +25,11 @@ const getConstrainRect = (target, constrainTo) => {
|
|
|
26
25
|
if (typeof constrainTo === 'function') {
|
|
27
26
|
el = constrainTo(target);
|
|
28
27
|
}
|
|
28
|
+
return el;
|
|
29
|
+
};
|
|
30
|
+
exports.getConstrainElement = getConstrainElement;
|
|
31
|
+
const getConstrainRect = (target, constrainTo) => {
|
|
32
|
+
let el = (0, exports.getConstrainElement)(target, constrainTo);
|
|
29
33
|
if (el && el.tagName) {
|
|
30
34
|
return (0, utils_1.getRect)(el);
|
|
31
35
|
}
|
|
@@ -41,10 +45,25 @@ const ensurePortalElement = () => {
|
|
|
41
45
|
return;
|
|
42
46
|
}
|
|
43
47
|
portalElement = document.createElement('div');
|
|
48
|
+
portalElement.style.position = 'absolute';
|
|
49
|
+
portalElement.style.zIndex = '999999';
|
|
50
|
+
portalElement.style.top = '0px';
|
|
51
|
+
portalElement.style.left = '0px';
|
|
44
52
|
document.body.appendChild(portalElement);
|
|
45
53
|
};
|
|
46
54
|
const OverlayTrigger = React.forwardRef((props, ref) => {
|
|
47
|
-
|
|
55
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
56
|
+
let { visible: _, showTriangle, showEvent, hideEvent, render, targetOffset, preventPortalEventPropagation = false, defaultZIndex, anchor, hideDelay = 0, opacityTransitionDuration, onVisibleChange, alignPosition = [
|
|
57
|
+
// overlay - target
|
|
58
|
+
['TopLeft', 'BottomLeft'],
|
|
59
|
+
['TopRight', 'BottomRight'],
|
|
60
|
+
['TopRight', 'BottomCenter'],
|
|
61
|
+
['TopRight', 'BottomLeft'],
|
|
62
|
+
['TopRight', 'BottomLeft'],
|
|
63
|
+
], constrainTo, target: targetProp } = props, domProps = tslib_1.__rest(props, ["visible", "showTriangle", "showEvent", "hideEvent", "render", "targetOffset", "preventPortalEventPropagation", "defaultZIndex", "anchor", "hideDelay", "opacityTransitionDuration", "onVisibleChange", "alignPosition", "constrainTo", "target"]);
|
|
64
|
+
const { showOverlay, clearAll: clearAllOverlays, hideOverlay, portal, } = (0, InfiniteTable_1.useOverlay)({
|
|
65
|
+
portalContainer: portalElement,
|
|
66
|
+
});
|
|
48
67
|
const domRef = (0, react_1.useRef)(null);
|
|
49
68
|
const targetRef = (0, react_1.useRef)(null);
|
|
50
69
|
const overlayRef = (0, react_1.useRef)(null);
|
|
@@ -64,8 +83,6 @@ const OverlayTrigger = React.forwardRef((props, ref) => {
|
|
|
64
83
|
}
|
|
65
84
|
doSetVisible(true);
|
|
66
85
|
}, []);
|
|
67
|
-
const [targetRect, setTargetRect] = (0, react_1.useState)(null);
|
|
68
|
-
const [sizeInfo, setSizeInfo] = (0, react_1.useState)(null);
|
|
69
86
|
const prevVisible = (0, usePrevious_1.default)(visible, false);
|
|
70
87
|
ensurePortalElement();
|
|
71
88
|
const onShow = React.useCallback((event) => {
|
|
@@ -78,14 +95,6 @@ const OverlayTrigger = React.forwardRef((props, ref) => {
|
|
|
78
95
|
}
|
|
79
96
|
(0, batchUpdate_1.default)(() => {
|
|
80
97
|
setVisible(true);
|
|
81
|
-
const target = targetRef.current;
|
|
82
|
-
const targetRect = target.getBoundingClientRect();
|
|
83
|
-
const sizeInfo = (0, getAvailableSizeInfo_1.default)({
|
|
84
|
-
targetRect,
|
|
85
|
-
constrainRect: (0, exports.getConstrainRect)(target, constrainTo),
|
|
86
|
-
});
|
|
87
|
-
setTargetRect(targetRect);
|
|
88
|
-
setSizeInfo(sizeInfo);
|
|
89
98
|
}).commit();
|
|
90
99
|
}, [constrainTo, preventPortalEventPropagation]);
|
|
91
100
|
const onHide = React.useCallback((_event) => {
|
|
@@ -105,6 +114,7 @@ const OverlayTrigger = React.forwardRef((props, ref) => {
|
|
|
105
114
|
}
|
|
106
115
|
}
|
|
107
116
|
}, [ref]);
|
|
117
|
+
const previousVisible = (0, usePrevious_1.default)(visible, visible);
|
|
108
118
|
(0, react_1.useEffect)(() => {
|
|
109
119
|
let target = domRef.current.previousSibling;
|
|
110
120
|
if (targetProp) {
|
|
@@ -133,41 +143,52 @@ const OverlayTrigger = React.forwardRef((props, ref) => {
|
|
|
133
143
|
}
|
|
134
144
|
};
|
|
135
145
|
}, [props.visible, showEvent, hideEvent, onShow, onHide]);
|
|
136
|
-
|
|
146
|
+
React.useEffect(() => {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
const target = targetRef.current;
|
|
149
|
+
if (!target) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if ((prevVisible && !visible) || visible) {
|
|
153
|
+
const overlayContent = (React.createElement(Overlay_1.default, Object.assign({}, domProps, { ref: (node) => {
|
|
154
|
+
if (overlayRef.current && overlayRef.current != node) {
|
|
155
|
+
overlayRef.current.removeEventListener(showEvent, onShow);
|
|
156
|
+
overlayRef.current.removeEventListener(hideEvent, onHide);
|
|
157
|
+
}
|
|
158
|
+
overlayRef.current = node;
|
|
159
|
+
if (node) {
|
|
160
|
+
node.addEventListener(showEvent, onShow);
|
|
161
|
+
node.addEventListener(hideEvent, onHide);
|
|
162
|
+
}
|
|
163
|
+
}, className: (0, join_1.default)('ab-Overlay', showTriangle ? 'ab-Overlay--show-triangle' : '', agGridClassName, domProps.className), style: { transition: `opacity ${opacityTransitionDuration}` }, visible: visible, onTransitionEnd: () => {
|
|
164
|
+
if (!visible) {
|
|
165
|
+
clearAllOverlays();
|
|
166
|
+
hideOverlay('overlay-trigger');
|
|
167
|
+
}
|
|
168
|
+
} }), props.render()));
|
|
169
|
+
let preparedConstrinTo;
|
|
170
|
+
if (constrainTo) {
|
|
171
|
+
preparedConstrinTo = (0, exports.getConstrainElement)(targetRef.current, constrainTo);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
preparedConstrinTo = adaptable === null || adaptable === void 0 ? void 0 : adaptable.getAgGridContainerElement();
|
|
175
|
+
}
|
|
176
|
+
// show only if visible or if it was visible and now it is invisible
|
|
177
|
+
const showOverlayOptions = {
|
|
178
|
+
id: 'overlay-trigger',
|
|
179
|
+
alignPosition,
|
|
180
|
+
constrainTo: (_b = (_a = preparedConstrinTo === null || preparedConstrinTo === void 0 ? void 0 : preparedConstrinTo.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(preparedConstrinTo)) !== null && _b !== void 0 ? _b : true,
|
|
181
|
+
alignTo: target.getBoundingClientRect(),
|
|
182
|
+
};
|
|
183
|
+
showOverlay(() => overlayContent, showOverlayOptions);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
clearAllOverlays();
|
|
187
|
+
}
|
|
188
|
+
}, [visible, props.render]);
|
|
137
189
|
const agGridClassName = (0, useAgGridClassName_1.default)([visible]);
|
|
138
|
-
if (targetRect) {
|
|
139
|
-
const overlayTarget = targetRef.current;
|
|
140
|
-
alignHorizontal =
|
|
141
|
-
alignHorizontal ||
|
|
142
|
-
getComputedStyle(overlayTarget)
|
|
143
|
-
.getPropertyValue('--ab-overlay-horizontal-align')
|
|
144
|
-
.trim();
|
|
145
|
-
let overlayStyle = (0, getOverlayStyle_1.default)({
|
|
146
|
-
constrainRect: (0, exports.getConstrainRect)(overlayTarget, constrainTo),
|
|
147
|
-
targetRect,
|
|
148
|
-
targetOffset,
|
|
149
|
-
anchor,
|
|
150
|
-
alignHorizontal,
|
|
151
|
-
});
|
|
152
|
-
overlayStyle.transition = `opacity ${opacityTransitionDuration}`;
|
|
153
|
-
overlayStyle.overflow = `visible`;
|
|
154
|
-
overlayStyle.zIndex = defaultZIndex;
|
|
155
|
-
overlayStyle = Object.assign(Object.assign({}, overlayStyle), props.style);
|
|
156
|
-
const position = anchor === 'vertical' ? sizeInfo.verticalPosition : sizeInfo.horizontalPosition;
|
|
157
|
-
overlay = (0, react_dom_1.createPortal)(React.createElement(Overlay_1.default, Object.assign({}, domProps, { ref: (node) => {
|
|
158
|
-
if (overlayRef.current && overlayRef.current != node) {
|
|
159
|
-
overlayRef.current.removeEventListener(showEvent, onShow);
|
|
160
|
-
overlayRef.current.removeEventListener(hideEvent, onHide);
|
|
161
|
-
}
|
|
162
|
-
overlayRef.current = node;
|
|
163
|
-
if (node) {
|
|
164
|
-
node.addEventListener(showEvent, onShow);
|
|
165
|
-
node.addEventListener(hideEvent, onHide);
|
|
166
|
-
}
|
|
167
|
-
}, className: (0, join_1.default)('ab-Overlay', `ab-Overlay--position-${position}`, showTriangle ? 'ab-Overlay--show-triangle' : '', agGridClassName, domProps.className), visible: visible, style: overlayStyle, anchor: anchor, position: position, getConstrainRect: () => (0, exports.getConstrainRect)(targetRef.current) }), props.render()), portalElement);
|
|
168
|
-
}
|
|
169
190
|
return (React.createElement(React.Fragment, null,
|
|
170
|
-
props.children,
|
|
191
|
+
React.Children.only(props.children),
|
|
171
192
|
React.createElement("div", { "data-name": "OverlayTrigger", "data-visible": visible, ref: domRef, style: {
|
|
172
193
|
visibility: 'hidden',
|
|
173
194
|
flex: 'none',
|
|
@@ -176,7 +197,7 @@ const OverlayTrigger = React.forwardRef((props, ref) => {
|
|
|
176
197
|
pointerEvents: 'none',
|
|
177
198
|
display: 'inline-flex',
|
|
178
199
|
} }),
|
|
179
|
-
|
|
200
|
+
portal));
|
|
180
201
|
});
|
|
181
202
|
OverlayTrigger.defaultProps = {
|
|
182
203
|
showEvent: 'mouseenter',
|