@adaptabletools/adaptable 15.3.1 → 15.3.3-canary.0
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 +57 -2
- package/base.css.map +1 -1
- package/bundle.cjs.js +157 -157
- package/index.css +83 -2
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +4 -0
- package/src/AdaptableOptions/ActionOptions.d.ts +6 -1
- package/src/AdaptableOptions/EditOptions.d.ts +35 -6
- package/src/AdaptableOptions/EntitlementOptions.d.ts +3 -2
- package/src/AdaptableOptions/ExportOptions.d.ts +1 -1
- package/src/AdaptableOptions/FilterOptions.d.ts +9 -3
- package/src/AdaptableOptions/LayoutOptions.d.ts +1 -1
- package/src/Api/GridApi.d.ts +11 -0
- package/src/Api/Implementation/CalculatedColumnApiImpl.js +12 -1
- package/src/Api/Implementation/GridApiImpl.d.ts +4 -0
- package/src/Api/Implementation/GridApiImpl.js +8 -0
- package/src/Api/Implementation/StyledColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/StyledColumnApiImpl.js +12 -0
- package/src/Api/Internal/StyledColumnInternalApi.d.ts +3 -1
- package/src/Api/Internal/StyledColumnInternalApi.js +24 -0
- package/src/Api/StyledColumnApi.d.ts +5 -0
- package/src/PredefinedConfig/Common/AdaptableFormat.d.ts +1 -2
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +5 -5
- package/src/PredefinedConfig/Common/AdaptableStyle.d.ts +8 -0
- package/src/PredefinedConfig/Common/Enums.js +1 -0
- package/src/PredefinedConfig/StyledColumnState.d.ts +37 -5
- package/src/Redux/Store/AdaptableReduxMerger.js +1 -1
- package/src/Strategy/BulkUpdateModule.js +1 -1
- package/src/Strategy/CalculatedColumnModule.js +1 -1
- package/src/Strategy/CellSummaryModule.js +1 -1
- package/src/Strategy/CustomSortModule.js +1 -1
- package/src/Strategy/DashboardModule.js +2 -2
- package/src/Strategy/DataChangeHistoryModule.js +1 -1
- package/src/Strategy/FilterModule.js +1 -1
- package/src/Strategy/FlashingCellModule.js +1 -1
- package/src/Strategy/FormatColumnModule.js +42 -3
- package/src/Strategy/FreeTextColumnModule.js +1 -1
- package/src/Strategy/GridInfoModule.js +2 -2
- package/src/Strategy/LayoutModule.js +7 -6
- package/src/Strategy/PlusMinusModule.js +1 -1
- package/src/Strategy/QueryModule.js +1 -1
- package/src/Strategy/QuickSearchModule.js +1 -1
- package/src/Strategy/ShortcutModule.js +1 -1
- package/src/Strategy/SmartEditModule.js +1 -1
- package/src/Strategy/StateManagementModule.js +1 -1
- package/src/Strategy/StyledColumnModule.d.ts +2 -0
- package/src/Strategy/StyledColumnModule.js +132 -59
- package/src/Strategy/SystemStatusModule.js +1 -1
- package/src/Strategy/TeamSharingModule.js +1 -1
- package/src/Strategy/ToolPanelModule.js +1 -1
- package/src/Utilities/Constants/GeneralConstants.d.ts +2 -0
- package/src/Utilities/Constants/GeneralConstants.js +4 -2
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -0
- package/src/Utilities/Helpers/StyleHelper.js +19 -0
- package/src/Utilities/ObjectFactory.d.ts +3 -1
- package/src/Utilities/ObjectFactory.js +14 -1
- package/src/Utilities/Services/EntitlementService.js +7 -4
- package/src/Utilities/Services/ValidationService.js +13 -2
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +1 -1
- package/src/View/Charting/ShowChartButton.js +1 -1
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
- package/src/View/Components/Buttons/ButtonClear.js +1 -1
- package/src/View/Components/Buttons/ButtonClose.js +1 -1
- package/src/View/Components/Buttons/ButtonConfigure.js +1 -1
- package/src/View/Components/Buttons/ButtonDelete.js +1 -1
- package/src/View/Components/Buttons/ButtonExpand.js +1 -1
- package/src/View/Components/Buttons/ButtonLogin.js +1 -1
- package/src/View/Components/Buttons/ButtonPreviewDelete.js +1 -1
- package/src/View/Components/FilterForm/QuickFilterForm.js +10 -2
- package/src/View/Components/Forms/AdaptableFormControlTextClear.js +1 -1
- package/src/View/Components/ListBox/ListBoxFilterSortComponent.js +1 -1
- package/src/View/Components/Panels/ToolPanelSettingsPanel.js +1 -1
- package/src/View/Components/PredicateEditor/PredicateEditor.d.ts +1 -0
- package/src/View/Components/PredicateEditor/PredicateEditor.js +24 -16
- package/src/View/Components/StyleComponent.d.ts +7 -0
- package/src/View/Components/StyleComponent.js +68 -16
- package/src/View/Components/ValueSelector/index.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +8 -6
- package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +18 -10
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +3 -3
- package/src/View/StateManagement/StateManagementViewPanel.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.d.ts +7 -0
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +108 -0
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +15 -14
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +44 -21
- package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +17 -9
- package/src/View/StyledColumn/Wizard/StyledColumnWizardSettingsSection.js +1 -1
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.d.ts +5 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.js +29 -0
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +25 -5
- package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +15 -4
- package/src/View/Theme/ThemeEditor.js +1 -1
- package/src/agGrid/Adaptable.d.ts +10 -1
- package/src/agGrid/Adaptable.js +69 -26
- package/src/agGrid/BadgeRenderer.d.ts +4 -0
- package/src/agGrid/BadgeRenderer.js +59 -0
- package/src/agGrid/PercentBarRenderer.js +37 -17
- package/src/agGrid/agGridHelper.d.ts +1 -0
- package/src/agGrid/agGridHelper.js +4 -0
- package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +1 -1
- package/src/components/Badge/index.d.ts +8 -0
- package/src/components/Badge/index.js +18 -0
- package/src/components/Dashboard/DashboardToolbar.js +2 -2
- package/src/components/Datepicker/index.js +1 -1
- package/src/components/DragAndDropContext/TabList.js +1 -1
- package/src/components/Dropdown/index.js +1 -1
- package/src/components/DropdownButton/index.js +1 -1
- package/src/components/FileDroppable/index.js +1 -1
- package/src/components/IconSelector/IconSelector.d.ts +7 -0
- package/src/components/IconSelector/IconSelector.js +42 -0
- package/src/components/IconSelector/index.d.ts +1 -0
- package/src/components/IconSelector/index.js +4 -0
- package/src/components/OverlayTrigger/index.js +1 -0
- package/src/components/Toggle/Toggle.d.ts +8 -0
- package/src/components/Toggle/Toggle.js +15 -0
- package/src/components/Toggle/ToggleGroup.d.ts +2 -0
- package/src/components/Toggle/ToggleGroup.js +10 -0
- package/src/components/Toggle/index.d.ts +2 -0
- package/src/components/Toggle/index.js +5 -0
- package/src/components/icons/DefaultIcon.js +1 -1
- package/src/components/icons/align-center.js +7 -0
- package/src/components/icons/align-left.d.ts +3 -0
- package/src/components/icons/align-left.js +7 -0
- package/src/components/icons/align-right.d.ts +3 -0
- package/src/components/icons/align-right.js +7 -0
- package/src/components/icons/badge.d.ts +3 -0
- package/src/components/icons/badge.js +7 -0
- package/src/components/icons/bold.d.ts +3 -0
- package/src/components/icons/bold.js +7 -0
- package/src/components/icons/case-lower.d.ts +3 -0
- package/src/components/icons/case-lower.js +7 -0
- package/src/components/icons/case-sentence.d.ts +3 -0
- package/src/components/icons/case-sentence.js +8 -0
- package/src/components/icons/case-upper.d.ts +3 -0
- package/src/components/icons/case-upper.js +7 -0
- package/src/components/icons/gradient.d.ts +3 -0
- package/src/components/icons/gradient.js +7 -0
- package/src/components/icons/index.js +76 -70
- package/src/components/icons/italic.d.ts +3 -0
- package/src/components/icons/{clear.js → italic.js} +2 -2
- package/src/components/icons/overline.d.ts +3 -0
- package/src/components/icons/overline.js +7 -0
- package/src/components/icons/strikethrough.d.ts +3 -0
- package/src/components/icons/strikethrough.js +7 -0
- package/src/components/icons/underline.d.ts +3 -0
- package/src/components/icons/underline.js +7 -0
- package/src/metamodel/adaptable.metamodel.d.ts +47 -6
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +4 -3
- package/version.d.ts +1 -1
- package/version.js +1 -1
- /package/src/components/icons/{clear.d.ts → align-center.d.ts} +0 -0
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -943,6 +943,27 @@ class Adaptable {
|
|
|
943
943
|
this.gridOptions.api.setColumnDefs(colDefs);
|
|
944
944
|
this.updateColumnsIntoStore(); // todo remove this from here!!!
|
|
945
945
|
}
|
|
946
|
+
/**
|
|
947
|
+
* The combination of styled column and format cells
|
|
948
|
+
* This functiond decides when the two can be merged.
|
|
949
|
+
*/
|
|
950
|
+
getFormatColumnAndStyledColumnCellStyle(abColumn, colId, params) {
|
|
951
|
+
let styledColumn = this.api.styledColumnApi.getStyledColumnForColumnId(colId);
|
|
952
|
+
let styledColumnStyle = {};
|
|
953
|
+
if (styledColumn && !(styledColumn === null || styledColumn === void 0 ? void 0 : styledColumn.IsSuspended)) {
|
|
954
|
+
const styledCellStyle = this.getStyledColumnStyle(styledColumn, abColumn, params);
|
|
955
|
+
// for percentbar we want to merge
|
|
956
|
+
if (styledColumn.PercentBarStyle || styledColumn.BadgeStyle) {
|
|
957
|
+
styledColumnStyle = styledCellStyle;
|
|
958
|
+
}
|
|
959
|
+
else {
|
|
960
|
+
// For other ones wo do not want to merge
|
|
961
|
+
return styledCellStyle;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
const activeFormatColumnsWithStyle = this.api.formatColumnApi.internalApi.getFormatColumnsWithStyleForColumn(abColumn);
|
|
965
|
+
return Object.assign(Object.assign({}, this.getFormatColumnCellStyle(abColumn, activeFormatColumnsWithStyle, params)), styledColumnStyle);
|
|
966
|
+
}
|
|
946
967
|
getStyledColumnStyle(styledColumn, abColumn, params) {
|
|
947
968
|
let style = {};
|
|
948
969
|
const gradientStyle = styledColumn === null || styledColumn === void 0 ? void 0 : styledColumn.GradientStyle;
|
|
@@ -2131,6 +2152,12 @@ class Adaptable {
|
|
|
2131
2152
|
this.forAllRowNodesDo((rowNode) => rowNodes.push(rowNode), config);
|
|
2132
2153
|
return rowNodes;
|
|
2133
2154
|
}
|
|
2155
|
+
getGroupRowNodes(config) {
|
|
2156
|
+
return this.getAllRowNodes({
|
|
2157
|
+
includeGroupRows: true,
|
|
2158
|
+
filterFn: (rowNode) => this.isGroupRowNode(rowNode),
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2134
2161
|
getRowsInViewport() {
|
|
2135
2162
|
return this.gridOptions.api.getRenderedNodes();
|
|
2136
2163
|
}
|
|
@@ -2303,7 +2330,7 @@ class Adaptable {
|
|
|
2303
2330
|
const defaultEditButtonConfiguration = {
|
|
2304
2331
|
create: {
|
|
2305
2332
|
icon: {
|
|
2306
|
-
name: 'add
|
|
2333
|
+
name: 'add',
|
|
2307
2334
|
},
|
|
2308
2335
|
tooltip: 'Create',
|
|
2309
2336
|
onClick: () => {
|
|
@@ -2579,6 +2606,7 @@ class Adaptable {
|
|
|
2579
2606
|
this.gridOptions.api.removeEventListener(core_1.Events.EVENT_FIRST_DATA_RENDERED, this.listenerFirstDataRendered);
|
|
2580
2607
|
this.gridOptions.api.removeEventListener(core_1.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, this.listenerPivotModeChanged);
|
|
2581
2608
|
this.gridOptions.api.removeEventListener(core_1.Events.EVENT_COLUMN_PIVOT_CHANGED, this.listenerPivotChanged);
|
|
2609
|
+
this.gridOptions.api.removeEventListener(core_1.Events.EVENT_CELL_EDITING_STARTED, this.listenerCellEditingStarted);
|
|
2582
2610
|
this.gridOptions.api.removeEventListener(core_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.listenerColumnRowGroupChanged);
|
|
2583
2611
|
this.gridOptions.api.removeEventListener(core_1.Events.EVENT_RANGE_SELECTION_CHANGED, this.listenerRangeSelectionChanged);
|
|
2584
2612
|
this.gridOptions.api.removeEventListener(core_1.Events.EVENT_COLUMN_RESIZED, this.listenerColumnResized);
|
|
@@ -2591,6 +2619,7 @@ class Adaptable {
|
|
|
2591
2619
|
this.listenerFirstDataRendered = null;
|
|
2592
2620
|
this.listenerPivotModeChanged = null;
|
|
2593
2621
|
this.listenerPivotChanged = null;
|
|
2622
|
+
this.listenerCellEditingStarted = null;
|
|
2594
2623
|
this.listenerColumnRowGroupChanged = null;
|
|
2595
2624
|
this.listenerRangeSelectionChanged = null;
|
|
2596
2625
|
this.listenerColumnResized = null;
|
|
@@ -2798,6 +2827,15 @@ class Adaptable {
|
|
|
2798
2827
|
this.debouncedSetColumnIntoStore();
|
|
2799
2828
|
}
|
|
2800
2829
|
}));
|
|
2830
|
+
/**
|
|
2831
|
+
* Use Case: User has started inline editing but its distabled in Action Row Options
|
|
2832
|
+
* Action: Stop editing
|
|
2833
|
+
*/
|
|
2834
|
+
this.gridOptions.api.addEventListener(core_1.Events.EVENT_CELL_EDITING_STARTED, (this.listenerCellEditingStarted = () => {
|
|
2835
|
+
var _a, _b;
|
|
2836
|
+
if ((_b = (_a = this.adaptableOptions.actionOptions) === null || _a === void 0 ? void 0 : _a.actionRowButtonOptions) === null || _b === void 0 ? void 0 : _b.disableInlineEditing)
|
|
2837
|
+
this.gridOptions.api.stopEditing();
|
|
2838
|
+
}));
|
|
2801
2839
|
/**
|
|
2802
2840
|
* Use Case: initial data has been displayed in grid
|
|
2803
2841
|
* Action1: Set the Layout
|
|
@@ -3231,18 +3269,11 @@ class Adaptable {
|
|
|
3231
3269
|
}
|
|
3232
3270
|
setupColumnCellStyle({ col, colId, abColumn }) {
|
|
3233
3271
|
this.setColDefProperty(col, 'cellStyle', (userCellStyle) => {
|
|
3234
|
-
const activeFormatColumnsWithStyle = this.api.formatColumnApi.internalApi.getFormatColumnsWithStyleForColumn(abColumn);
|
|
3235
|
-
let styledColumn = this.api.styledColumnApi.getStyledColumnForColumnId(colId);
|
|
3236
|
-
if (styledColumn === null || styledColumn === void 0 ? void 0 : styledColumn.IsSuspended) {
|
|
3237
|
-
styledColumn = null;
|
|
3238
|
-
}
|
|
3239
3272
|
const quickSearchStyle = this.getQuickSearchCellStyle();
|
|
3240
3273
|
const hasQuickSearchStyle = quickSearchStyle != undefined;
|
|
3241
3274
|
const cellStyle = (params) => {
|
|
3242
3275
|
const isQuickSearchActive = hasQuickSearchStyle && this.isQuickSearchActive(abColumn, params);
|
|
3243
|
-
const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
3244
|
-
? this.getFormatColumnCellStyle(abColumn, activeFormatColumnsWithStyle, params)
|
|
3245
|
-
: {})), (styledColumn ? this.getStyledColumnStyle(styledColumn, abColumn, params) : {})), (isQuickSearchActive ? quickSearchStyle : {})), this.getAlertCellStyle(abColumn, params)), this.getFlashingCellStyle(abColumn, params)), this.getCellHighlightStyle(abColumn, params));
|
|
3276
|
+
const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.getReadOnlyCellStyle(abColumn, params)), this.getEditableCellStyle(abColumn, params)), (typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle)), this.getFormatColumnAndStyledColumnCellStyle(abColumn, colId, params)), (isQuickSearchActive ? quickSearchStyle : {})), this.getAlertCellStyle(abColumn, params)), this.getFlashingCellStyle(abColumn, params)), this.getCellHighlightStyle(abColumn, params));
|
|
3246
3277
|
// see https://github.com/AdaptableTools/adaptable/issues/2119
|
|
3247
3278
|
StyleHelper_1.AgGridCellStyleProperties.forEach((cellStylePropKey) => {
|
|
3248
3279
|
if (result[cellStylePropKey] == null) {
|
|
@@ -3348,6 +3379,9 @@ class Adaptable {
|
|
|
3348
3379
|
if (styledColumn.CheckBoxStyle) {
|
|
3349
3380
|
return this.agGridHelper.createCheckboxRendererComp(abColumn.columnId, abColumn.readOnly);
|
|
3350
3381
|
}
|
|
3382
|
+
if (styledColumn.BadgeStyle) {
|
|
3383
|
+
return this.agGridHelper.createBadgeRendererComp(styledColumn, abColumn);
|
|
3384
|
+
}
|
|
3351
3385
|
if (styledColumn.SparkLineStyle) {
|
|
3352
3386
|
return 'agSparklineCellRenderer';
|
|
3353
3387
|
}
|
|
@@ -3546,7 +3580,11 @@ class Adaptable {
|
|
|
3546
3580
|
}
|
|
3547
3581
|
const editableCallback = (params) => {
|
|
3548
3582
|
const gridCell = this.getGridCellFromRowNode(params.node, params.column.getColId());
|
|
3549
|
-
|
|
3583
|
+
const cellEditableContext = {
|
|
3584
|
+
gridCell,
|
|
3585
|
+
adaptableApi: this.api,
|
|
3586
|
+
};
|
|
3587
|
+
return cellEditableFn(cellEditableContext);
|
|
3550
3588
|
};
|
|
3551
3589
|
return editableCallback;
|
|
3552
3590
|
});
|
|
@@ -4617,17 +4655,18 @@ class Adaptable {
|
|
|
4617
4655
|
excelStyles.push(this.convertCSSToExcelStyle(adaptableStyle));
|
|
4618
4656
|
}
|
|
4619
4657
|
const excelDataType = this.api.exportApi.internalApi.getExcelDataType(colDef === null || colDef === void 0 ? void 0 : colDef.type);
|
|
4658
|
+
const rawValue = this.getRawValueFromRowNode(node, column.getId());
|
|
4620
4659
|
// don't add the cell style if it has no adaptable custom styles or user defined styles
|
|
4621
|
-
if (
|
|
4622
|
-
|
|
4623
|
-
|
|
4660
|
+
if (rawValue == undefined ||
|
|
4661
|
+
(!excelStyles.length &&
|
|
4662
|
+
// if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
|
|
4663
|
+
!(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue))) {
|
|
4624
4664
|
return;
|
|
4625
4665
|
}
|
|
4626
4666
|
const cellClassId = this.getExcelClassNameForCell(column.getId(), this.getPrimaryKeyValueFromRowNode(node), userDefinedCellClass);
|
|
4627
4667
|
const finalCellExcelStyle = Object.assign({}, ...excelStyles);
|
|
4628
4668
|
if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
|
|
4629
4669
|
let dateFormatPattern = this.api.optionsApi.getExportOptions().exportDateFormat;
|
|
4630
|
-
const rawValue = this.getRawValueFromRowNode(node, column.getId());
|
|
4631
4670
|
const abColumn = getAdaptableColumnWithColumnId(column.getColId());
|
|
4632
4671
|
if (!dateFormatPattern) {
|
|
4633
4672
|
const mostRelevantFormatColumn = this.api.formatColumnApi.internalApi.getMostRelevantFormatColumnForColumn(getFormatColumnsWithDisplayFormatForColumn(column.getColId()), abColumn, { node, value: rawValue });
|
|
@@ -4637,18 +4676,22 @@ class Adaptable {
|
|
|
4637
4676
|
}
|
|
4638
4677
|
if (dateFormatPattern) {
|
|
4639
4678
|
const normalisedValue = this.getNormalisedValueFromRawValue(rawValue, abColumn);
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
.
|
|
4651
|
-
|
|
4679
|
+
if (normalisedValue) {
|
|
4680
|
+
// we have to pass the date in the ISO format to Excel
|
|
4681
|
+
// see https://www.ag-grid.com/javascript-data-grid/excel-export-data-types/#dates
|
|
4682
|
+
// we also need to remove the timezone info from the date
|
|
4683
|
+
const dateWithoutTimezoneCorrection = new Date(Date.UTC(normalisedValue.getFullYear(), normalisedValue.getMonth(), normalisedValue.getDate()));
|
|
4684
|
+
const isoFormattedValue = dateWithoutTimezoneCorrection.toISOString();
|
|
4685
|
+
if (isoFormattedValue) {
|
|
4686
|
+
finalCellExcelStyle.dataType = 'DateTime';
|
|
4687
|
+
finalCellExcelStyle.numberFormat = { format: dateFormatPattern };
|
|
4688
|
+
// create a new cell key to ensure any user provided className does not interfere
|
|
4689
|
+
const cellKey = this.getExcelClassNameForCell(column.getColId(), this.getPrimaryKeyValueFromRowNode(node));
|
|
4690
|
+
// we need to register so that later the cellProcessor will put the isoFormattedValue through (thus giving the formatting responsability to Excel)
|
|
4691
|
+
this.api.internalApi
|
|
4692
|
+
.getReportService()
|
|
4693
|
+
.registerExcelStyleWithFormattedDate(cellKey, isoFormattedValue);
|
|
4694
|
+
}
|
|
4652
4695
|
}
|
|
4653
4696
|
}
|
|
4654
4697
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { StyledColumn } from '../PredefinedConfig/StyledColumnState';
|
|
2
|
+
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
3
|
+
import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
4
|
+
export declare const getBadgeRendererForColumn: (styledColumn: StyledColumn, abColumn: AdaptableColumn, api: AdaptableApi) => any;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBadgeRendererForColumn = void 0;
|
|
4
|
+
const Badge_1 = require("../components/Badge");
|
|
5
|
+
const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
|
|
6
|
+
if (!styledColumn.BadgeStyle) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
return class BadgetRenderer {
|
|
10
|
+
init(params) {
|
|
11
|
+
var _a, _b, _c, _d;
|
|
12
|
+
this.eGui = document.createElement('div');
|
|
13
|
+
this.eGui.className = 'ab-Badge__wrapper';
|
|
14
|
+
const formattedValue = (_c = (_b = (_a = params.formatValue) === null || _a === void 0 ? void 0 : _a.call(params, params.value)) !== null && _b !== void 0 ? _b : params.value) !== null && _c !== void 0 ? _c : '';
|
|
15
|
+
const badge = api.styledColumnApi.internalApi.getApplicableBadge(styledColumn, {
|
|
16
|
+
value: params.value,
|
|
17
|
+
oldValue: null,
|
|
18
|
+
displayValue: params.formatValue,
|
|
19
|
+
node: params.node,
|
|
20
|
+
column: abColumn,
|
|
21
|
+
});
|
|
22
|
+
const isGrouped = params.node.group;
|
|
23
|
+
const includeGrouped = Boolean(styledColumn.IncludeGroupedRows);
|
|
24
|
+
const isNullValue = formattedValue === '' || formattedValue === null || formattedValue === undefined;
|
|
25
|
+
if (
|
|
26
|
+
// grouped but do not incluide
|
|
27
|
+
(includeGrouped === false && isGrouped) ||
|
|
28
|
+
// empty values
|
|
29
|
+
isNullValue ||
|
|
30
|
+
// no badge
|
|
31
|
+
!badge) {
|
|
32
|
+
this.eGui.innerHTML = formattedValue;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
let icon = badge.Icon;
|
|
36
|
+
if (icon && 'name' in icon && icon.size === undefined) {
|
|
37
|
+
icon.size = 14;
|
|
38
|
+
}
|
|
39
|
+
this.unmountReactRoot = api.internalApi.getAdaptableInstance().renderReactRoot((0, Badge_1.Badge)({
|
|
40
|
+
adaptableStyle: badge.Style,
|
|
41
|
+
children: formattedValue,
|
|
42
|
+
icon,
|
|
43
|
+
iconPosition: (_d = badge.IconPosition) !== null && _d !== void 0 ? _d : 'start',
|
|
44
|
+
}), this.eGui);
|
|
45
|
+
}
|
|
46
|
+
getGui() {
|
|
47
|
+
return this.eGui;
|
|
48
|
+
}
|
|
49
|
+
destroy() {
|
|
50
|
+
var _a;
|
|
51
|
+
(_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
52
|
+
}
|
|
53
|
+
refresh(params) {
|
|
54
|
+
// by returning FALSE we force a re-render every time the cell value changes
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.getBadgeRendererForColumn = getBadgeRendererForColumn;
|
|
@@ -4,22 +4,26 @@ exports.getPercentBarRendererForColumn = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const Helper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/Helper"));
|
|
6
6
|
const clamp_1 = tslib_1.__importDefault(require("lodash/clamp"));
|
|
7
|
-
const FormatHelper_1 = require("../Utilities/Helpers/FormatHelper");
|
|
8
7
|
const getPercentBarRendererForColumn = (styledColumn, abColumn, api) => {
|
|
9
8
|
if (!styledColumn.PercentBarStyle) {
|
|
10
9
|
return;
|
|
11
10
|
}
|
|
12
11
|
return class PercentBarRenderer {
|
|
13
12
|
init(params) {
|
|
14
|
-
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
13
|
+
var _a, _b;
|
|
17
14
|
const min = api.styledColumnApi.internalApi.getNumericStyleMinValue(styledColumn, abColumn, params.node, params.value);
|
|
18
15
|
const max = api.styledColumnApi.internalApi.getNumericStyleMaxValue(styledColumn, abColumn, params.node, params.value);
|
|
19
16
|
let value = params.value;
|
|
20
17
|
if (Helper_1.default.objectNotExists(value)) {
|
|
21
18
|
value = 0;
|
|
22
19
|
}
|
|
20
|
+
if (!styledColumn.IncludeGroupedRows && api.gridApi.isGroupRowNode(params.node)) {
|
|
21
|
+
if (params.value) {
|
|
22
|
+
this.eGui = document.createElement('div');
|
|
23
|
+
this.eGui.append(params.value);
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
23
27
|
const clampedValue = (0, clamp_1.default)(value, min, max);
|
|
24
28
|
const percentageValue = ((clampedValue - min) / (max - min)) * 100;
|
|
25
29
|
let cellBackColor;
|
|
@@ -33,15 +37,18 @@ const getPercentBarRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
33
37
|
cellBackColor = matchingRange.Color;
|
|
34
38
|
}
|
|
35
39
|
}
|
|
40
|
+
const hasCellText = percentBarStyle.CellText && percentBarStyle.CellText.length > 0;
|
|
41
|
+
const isTextPositionMerged = percentBarStyle.CellTextPosition === 'Merged';
|
|
36
42
|
if (cellBackColor) {
|
|
37
43
|
this.eGui = document.createElement('div');
|
|
38
44
|
this.eGui.className = 'ab-PercentBar__wrapper';
|
|
39
|
-
this.eGui.style.height =
|
|
45
|
+
this.eGui.style.height = hasCellText && !isTextPositionMerged ? '80%' : '100%';
|
|
40
46
|
this.eGui.style.display = 'flex';
|
|
41
47
|
this.eGui.style.flexDirection = 'column';
|
|
42
48
|
this.eGui.style.justifyContent = 'center';
|
|
43
49
|
const barEl = document.createElement('div');
|
|
44
50
|
barEl.className = 'ab-PercentBar__bar';
|
|
51
|
+
barEl.style.position = 'relative';
|
|
45
52
|
barEl.style.background = percentBarStyle.BackColor;
|
|
46
53
|
barEl.style.flex = '1';
|
|
47
54
|
const barInsideEl = document.createElement('div');
|
|
@@ -51,26 +58,39 @@ const getPercentBarRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
51
58
|
barInsideEl.style.width = `${percentageValue.toFixed(0)}%`;
|
|
52
59
|
barEl.append(barInsideEl);
|
|
53
60
|
this.eGui.append(barEl);
|
|
54
|
-
if (
|
|
61
|
+
if (hasCellText) {
|
|
55
62
|
const textEl = document.createElement('div');
|
|
56
63
|
textEl.className = 'ab-PercentBar__text';
|
|
57
64
|
textEl.style.lineHeight = '1.2';
|
|
58
65
|
if (percentBarStyle.CellText.includes('CellValue')) {
|
|
59
|
-
|
|
60
|
-
const formatColumn = api.formatColumnApi.internalApi.getMostRelevantFormatColumnForColumn(activeFormatColumnsWithDisplayFormat, abColumn, { node: params.node, value });
|
|
61
|
-
if (formatColumn && api.scopeApi.isColumnInNumericScope(abColumn, formatColumn.Scope)) {
|
|
62
|
-
const options = formatColumn.DisplayFormat.Options;
|
|
63
|
-
value = api.formatColumnApi.internalApi.getNumberFormattedValue(params.value, params.node, abColumn, options);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
value = (0, FormatHelper_1.NumberFormatter)(value, { FractionDigits: 2 });
|
|
67
|
-
}
|
|
68
|
-
textEl.innerText = value;
|
|
66
|
+
textEl.innerText = (_b = (_a = params.formatValue) === null || _a === void 0 ? void 0 : _a.call(params, params.value)) !== null && _b !== void 0 ? _b : params.value;
|
|
69
67
|
}
|
|
70
68
|
if (percentBarStyle.CellText.includes('PercentageValue')) {
|
|
71
69
|
textEl.innerText += ' ' + `(${percentageValue.toFixed(0)}%)`;
|
|
72
70
|
}
|
|
73
|
-
|
|
71
|
+
switch (percentBarStyle.CellTextPosition) {
|
|
72
|
+
case 'Above':
|
|
73
|
+
this.eGui.prepend(textEl);
|
|
74
|
+
break;
|
|
75
|
+
case 'Below':
|
|
76
|
+
this.eGui.append(textEl);
|
|
77
|
+
break;
|
|
78
|
+
case 'Merged':
|
|
79
|
+
textEl.style.position = 'absolute';
|
|
80
|
+
// This allows to center verticly without knowing the height of the row
|
|
81
|
+
textEl.style.top = '50%';
|
|
82
|
+
textEl.style.transform = 'translateY(-50%)';
|
|
83
|
+
// adds a bit of padding to the start/end of the bar
|
|
84
|
+
textEl.style.left = '0';
|
|
85
|
+
textEl.style.right = '0';
|
|
86
|
+
textEl.style.paddingLeft = '5px';
|
|
87
|
+
textEl.style.paddingRight = '5px';
|
|
88
|
+
barEl.append(textEl);
|
|
89
|
+
break;
|
|
90
|
+
default:
|
|
91
|
+
this.eGui.append(textEl);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
74
94
|
}
|
|
75
95
|
}
|
|
76
96
|
}
|
|
@@ -23,6 +23,7 @@ export declare class agGridHelper {
|
|
|
23
23
|
TrySetUpNodeIds(hasAutogeneratedPrimaryKey: boolean): boolean;
|
|
24
24
|
createCheckboxRendererComp(columnId: string, isColumnReadOnly: boolean): ICellRendererFunc | undefined;
|
|
25
25
|
createPercentBarRendererComp(styledColumn: StyledColumn, abColumn: AdaptableColumn): ICellRendererFunc;
|
|
26
|
+
createBadgeRendererComp(styledColumn: StyledColumn, abColumn: AdaptableColumn): any;
|
|
26
27
|
getCleanValue(value: string): string | undefined;
|
|
27
28
|
getRenderedValue(colDef: ColDef, valueToRender: any): any;
|
|
28
29
|
createAdaptableColumnFromAgGridColumn(agGridColumn: Column, colsToGroups: Record<string, AdaptableColumnGroup>): AdaptableColumn;
|
|
@@ -36,6 +36,7 @@ const FlashingCellModule_1 = require("../Strategy/FlashingCellModule");
|
|
|
36
36
|
const SettingsPanelModule_1 = require("../Strategy/SettingsPanelModule");
|
|
37
37
|
const ChartingModule_1 = require("../Strategy/ChartingModule");
|
|
38
38
|
const PercentBarRenderer_1 = require("./PercentBarRenderer");
|
|
39
|
+
const BadgeRenderer_1 = require("./BadgeRenderer");
|
|
39
40
|
const Helper_1 = require("../Utilities/Helpers/Helper");
|
|
40
41
|
const StatusBarModule_1 = require("../Strategy/StatusBarModule");
|
|
41
42
|
const GeneralConstants = tslib_1.__importStar(require("../Utilities/Constants/GeneralConstants"));
|
|
@@ -152,6 +153,9 @@ class agGridHelper {
|
|
|
152
153
|
createPercentBarRendererComp(styledColumn, abColumn) {
|
|
153
154
|
return (0, PercentBarRenderer_1.getPercentBarRendererForColumn)(styledColumn, abColumn, this.adaptable.api);
|
|
154
155
|
}
|
|
156
|
+
createBadgeRendererComp(styledColumn, abColumn) {
|
|
157
|
+
return (0, BadgeRenderer_1.getBadgeRendererForColumn)(styledColumn, abColumn, this.adaptable.api);
|
|
158
|
+
}
|
|
155
159
|
getCleanValue(value) {
|
|
156
160
|
if (typeof value === 'string') {
|
|
157
161
|
return value;
|
|
@@ -70,5 +70,5 @@ exports.InternalAdaptableNumberEditor = React.forwardRef(function InternalAdapta
|
|
|
70
70
|
focus();
|
|
71
71
|
}
|
|
72
72
|
} },
|
|
73
|
-
React.createElement(icons_1.Icon, { size: 18, name: "
|
|
73
|
+
React.createElement(icons_1.Icon, { size: 18, name: "close", tabIndex: 0 }))) : null));
|
|
74
74
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AdaptableIcon, AdaptableStyle } from '../../types';
|
|
3
|
+
export interface BadgeProps {
|
|
4
|
+
adaptableStyle: AdaptableStyle;
|
|
5
|
+
icon?: AdaptableIcon;
|
|
6
|
+
iconPosition?: 'start' | 'end' | 'Start' | 'End';
|
|
7
|
+
}
|
|
8
|
+
export declare const Badge: React.FunctionComponent<React.PropsWithChildren<BadgeProps>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Badge = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const StyleHelper_1 = require("../../Utilities/Helpers/StyleHelper");
|
|
7
|
+
const AdaptableIconComponent_1 = require("../AdaptableIconComponent");
|
|
8
|
+
const Badge = (props) => {
|
|
9
|
+
const { iconPosition = 'start', icon: iconProps } = props;
|
|
10
|
+
const preparedBadgePosition = iconPosition.toLowerCase();
|
|
11
|
+
const icon = iconProps && React.createElement(AdaptableIconComponent_1.AdaptableIconComponent, { icon: iconProps });
|
|
12
|
+
const style = (0, StyleHelper_1.toStyle)(props.adaptableStyle);
|
|
13
|
+
return (React.createElement("div", { className: "ab-Badge", style: style },
|
|
14
|
+
preparedBadgePosition === 'start' && icon,
|
|
15
|
+
props.children,
|
|
16
|
+
preparedBadgePosition === 'end' && icon));
|
|
17
|
+
};
|
|
18
|
+
exports.Badge = Badge;
|
|
@@ -11,8 +11,8 @@ function DashboardToolbar(props) {
|
|
|
11
11
|
React.createElement("div", { className: "ab-Dashboard__toolbar-content" }, props.children),
|
|
12
12
|
React.createElement(rebass_1.Flex, { className: "ab-Dashboard__toolbar-title", flexDirection: "row", alignItems: "center" },
|
|
13
13
|
React.createElement("span", null, props.title),
|
|
14
|
-
props.showConfigure && (React.createElement(SimpleButton_1.default, { icon: "
|
|
14
|
+
props.showConfigure && (React.createElement(SimpleButton_1.default, { icon: "spanner", variant: "text", tone: "none", "data-name": "configure", iconSize: 16, marginLeft: 1, tooltip: props.tooltip || `Configure ${props.title} Toolbar`, onClick: () => props.onConfigure() })),
|
|
15
15
|
' ',
|
|
16
|
-
props.showClose && (React.createElement(SimpleButton_1.default, { style: { alignSelf: 'flex-end' }, disabled: props.accessLevel == 'ReadOnly', "data-name": "close", icon: "
|
|
16
|
+
props.showClose && (React.createElement(SimpleButton_1.default, { style: { alignSelf: 'flex-end' }, disabled: props.accessLevel == 'ReadOnly', "data-name": "close", icon: "close", variant: "text", tone: "none", iconSize: 16, marginLeft: 1, tooltip: props.tooltip || `Close ${props.title} Toolbar`, onClick: () => props.onClose() })))));
|
|
17
17
|
}
|
|
18
18
|
exports.DashboardToolbar = DashboardToolbar;
|
|
@@ -81,7 +81,7 @@ exports.Datepicker = React.forwardRef((props, ref) => {
|
|
|
81
81
|
'|': React.createElement("hr", { style: { width: '100%', height: 0, margin: 0, border: 'none' } }),
|
|
82
82
|
};
|
|
83
83
|
const footerButtons = datepickerButtons.map((buttonKey, index) => React.cloneElement(footerButtonsMap[buttonKey], { key: index }));
|
|
84
|
-
const clearButton = showClearButton ? (React.createElement(SimpleButton_1.default, { "data-name": "clear", variant: "text", tooltip: "Clear", iconSize: 20, padding: 0, icon: "
|
|
84
|
+
const clearButton = showClearButton ? (React.createElement(SimpleButton_1.default, { "data-name": "clear", variant: "text", tooltip: "Clear", iconSize: 20, padding: 0, icon: "close", onMouseDown: (e) => {
|
|
85
85
|
e.preventDefault();
|
|
86
86
|
clearValue();
|
|
87
87
|
}, accessLevel: 'Full' })) : null;
|
|
@@ -46,6 +46,6 @@ function ToolbarItem({ toolbar, toolbarIndex, onRemove, disabled, }) {
|
|
|
46
46
|
? 'var(--ab-dashboard-toolbar-drag__background)'
|
|
47
47
|
: 'var(--ab-color-primarylight)', ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { style: provided.draggableProps.style }),
|
|
48
48
|
React.createElement("div", { style: { flex: 1 } }, title),
|
|
49
|
-
React.createElement(SimpleButton_1.default, { disabled: disabled, icon: "
|
|
49
|
+
React.createElement(SimpleButton_1.default, { disabled: disabled, icon: "close", variant: "text", padding: 1, onClick: onRemove })))));
|
|
50
50
|
}
|
|
51
51
|
exports.ToolbarItem = ToolbarItem;
|
|
@@ -79,7 +79,7 @@ const Dropdown = (props) => {
|
|
|
79
79
|
selectedText = placeholder;
|
|
80
80
|
}
|
|
81
81
|
//20 ... 20 16
|
|
82
|
-
const renderClearButton = () => (React.createElement(SimpleButton_1.default, Object.assign({ variant: "text", icon: "
|
|
82
|
+
const renderClearButton = () => (React.createElement(SimpleButton_1.default, Object.assign({ variant: "text", icon: "close", tone: "none", tooltip: "Clear", iconSize: 20, px: 0, py: 0, marginRight: 1 }, clearButtonProps, { style: Object.assign({ zIndex: 10, color: 'inherit' }, (clearButtonProps ? clearButtonProps.style : null)), onClick: (e) => {
|
|
83
83
|
e.preventDefault();
|
|
84
84
|
onChange(null, e);
|
|
85
85
|
} })));
|
|
@@ -96,7 +96,7 @@ const DropdownButton = React.forwardRef((props, theRef) => {
|
|
|
96
96
|
onClear();
|
|
97
97
|
}
|
|
98
98
|
(_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
99
|
-
}, ml: 2, padding: 0, variant: 'text', icon: "
|
|
99
|
+
}, ml: 2, padding: 0, variant: 'text', icon: "close" }, clearButtonProps, { style: Object.assign(Object.assign({}, clearButtonProps === null || clearButtonProps === void 0 ? void 0 : clearButtonProps.style), { visibility: showClearButton ? 'visible' : 'hidden' }) }))) : null;
|
|
100
100
|
icon = (React.createElement(React.Fragment, null,
|
|
101
101
|
spacer,
|
|
102
102
|
hasClearButton ? clearButton : null,
|
|
@@ -40,7 +40,7 @@ const readJSONFile = async (file, toJSON) => {
|
|
|
40
40
|
};
|
|
41
41
|
exports.readJSONFile = readJSONFile;
|
|
42
42
|
const FileDroppable = (props) => {
|
|
43
|
-
const { onDropSuccess, message, fileAccept = '.json', helpText = 'AdapTable No Code Version', defaultText = 'Click here to select a JSON file to load or drag it here', dragOverText = 'Drop file here to start Adaptable Wizard', icon = React.createElement(icons_1.Icon, { name: "
|
|
43
|
+
const { onDropSuccess, message, fileAccept = '.json', helpText = 'AdapTable No Code Version', defaultText = 'Click here to select a JSON file to load or drag it here', dragOverText = 'Drop file here to start Adaptable Wizard', icon = React.createElement(icons_1.Icon, { name: "paperclip", size: 48 }) } = props, domProps = tslib_1.__rest(props, ["onDropSuccess", "message", "fileAccept", "helpText", "defaultText", "dragOverText", "icon"]);
|
|
44
44
|
const [state, dispatch] = (0, react_1.useReducer)(reducer_1.default, initialState);
|
|
45
45
|
const onDragEnter = (e) => {
|
|
46
46
|
dispatch({
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IconSelector = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const AdaptableInput_1 = tslib_1.__importDefault(require("../../View/Components/AdaptableInput"));
|
|
8
|
+
const icons_1 = tslib_1.__importStar(require("../icons"));
|
|
9
|
+
const OverlayTrigger_1 = tslib_1.__importDefault(require("../OverlayTrigger"));
|
|
10
|
+
const SimpleButton_1 = tslib_1.__importDefault(require("../SimpleButton"));
|
|
11
|
+
const IconSelector = (props) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const [query, setQuery] = react_1.default.useState('');
|
|
14
|
+
const allIcons = Object.keys(icons_1.default);
|
|
15
|
+
const filteredIcons = query
|
|
16
|
+
? allIcons.filter((iconName) => {
|
|
17
|
+
return iconName.toLowerCase().includes(query.toLowerCase());
|
|
18
|
+
})
|
|
19
|
+
: allIcons;
|
|
20
|
+
let iconsElements = filteredIcons.map((iconName) => {
|
|
21
|
+
return (react_1.default.createElement(rebass_1.Flex, { key: iconName },
|
|
22
|
+
react_1.default.createElement(SimpleButton_1.default, { onClick: () => props.onChange(iconName), p: 2, variant: iconName === props.value ? 'raised' : 'text', tone: iconName === props.value ? 'accent' : 'none', icon: iconName })));
|
|
23
|
+
});
|
|
24
|
+
const popup = (react_1.default.createElement(rebass_1.Box, { className: "ab-IconSelector__Popup" },
|
|
25
|
+
react_1.default.createElement(rebass_1.Box, { mb: 2 },
|
|
26
|
+
react_1.default.createElement(rebass_1.Box, { mb: 2, fontSize: 4 }, "Select an Icon"),
|
|
27
|
+
react_1.default.createElement(AdaptableInput_1.default, { value: query, onChange: (event) => { var _a; return setQuery((_a = event.target.value) !== null && _a !== void 0 ? _a : ''); }, width: "100%" })),
|
|
28
|
+
react_1.default.createElement(rebass_1.Flex, { p: 2, style: { width: 300, maxHeight: 300, overflow: 'auto' }, flexWrap: "wrap" }, iconsElements)));
|
|
29
|
+
let value = 'No Icon Selected';
|
|
30
|
+
if (props.value in icons_1.default) {
|
|
31
|
+
value = (react_1.default.createElement(icons_1.Icon, { style: { display: 'inline-block' }, name: props.value }));
|
|
32
|
+
}
|
|
33
|
+
return (react_1.default.createElement(rebass_1.Flex, { className: "ab-IconSelector" },
|
|
34
|
+
react_1.default.createElement(OverlayTrigger_1.default, { preventPortalEventPropagation: false, render: () => popup, showEvent: "mouseenter", hideEvent: "mouseleave", hideDelay: 300 },
|
|
35
|
+
react_1.default.createElement(SimpleButton_1.default, { className: "ab-IconSelector__trigger", textAlign: "center", onClick: () => null, variant: "raised", width: 150, justifyContent: "center" }, value)),
|
|
36
|
+
((_a = props.clearable) !== null && _a !== void 0 ? _a : true) && (react_1.default.createElement(SimpleButton_1.default, { disabled: !props.value, className: "ab-IconSelector__clear-button", ml: 2, onClick: (event) => {
|
|
37
|
+
event.stopPropagation();
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
props.onChange('');
|
|
40
|
+
}, variant: "text", icon: "close" }))));
|
|
41
|
+
};
|
|
42
|
+
exports.IconSelector = IconSelector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './IconSelector';
|
|
@@ -73,6 +73,7 @@ const OverlayTrigger = React.forwardRef((props, ref) => {
|
|
|
73
73
|
const [visible, doSetVisible] = (0, useProperty_1.default)(props, 'visible', false);
|
|
74
74
|
const hideTimeoutRef = (0, react_1.useRef)(null);
|
|
75
75
|
const setVisible = React.useCallback((visible) => {
|
|
76
|
+
onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(visible);
|
|
76
77
|
if (!visible) {
|
|
77
78
|
hideTimeoutRef.current = setTimeout(() => {
|
|
78
79
|
hideTimeoutRef.current = null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AdaptableInternalIconName } from '../../types';
|
|
3
|
+
export declare type ToggleProps = {
|
|
4
|
+
onPressedChange: (pressed: boolean) => void;
|
|
5
|
+
pressed?: boolean;
|
|
6
|
+
icon?: AdaptableInternalIconName;
|
|
7
|
+
};
|
|
8
|
+
export declare const Toggle: React.FunctionComponent<React.PropsWithChildren<ToggleProps>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Toggle = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const AdaptableIconComponent_1 = require("../AdaptableIconComponent");
|
|
7
|
+
const join_1 = tslib_1.__importDefault(require("../utils/join"));
|
|
8
|
+
const Toggle = (_a) => {
|
|
9
|
+
var { onPressedChange, pressed, icon, children } = _a, rest = tslib_1.__rest(_a, ["onPressedChange", "pressed", "icon", "children"]);
|
|
10
|
+
const baseClassName = 'ab-Toggle';
|
|
11
|
+
return (React.createElement("button", Object.assign({}, rest, { className: (0, join_1.default)(baseClassName, pressed && `${baseClassName}--pressed`), onClick: () => onPressedChange(!pressed) }),
|
|
12
|
+
icon && React.createElement(AdaptableIconComponent_1.AdaptableIconComponent, { icon: { name: icon } }),
|
|
13
|
+
children));
|
|
14
|
+
};
|
|
15
|
+
exports.Toggle = Toggle;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToggleGroup = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const ToggleGroup = (props) => {
|
|
8
|
+
return React.createElement(rebass_1.Flex, { className: "ab-Toggle-Group" }, props.children);
|
|
9
|
+
};
|
|
10
|
+
exports.ToggleGroup = ToggleGroup;
|
|
@@ -11,5 +11,5 @@ exports.getSize = getSize;
|
|
|
11
11
|
exports.default = (_a) => {
|
|
12
12
|
var { children, size = DEFAULT_SIZE, name, tabIndex, color } = _a, props = tslib_1.__rest(_a, ["children", "size", "name", "tabIndex", "color"]);
|
|
13
13
|
size = (0, exports.getSize)(size);
|
|
14
|
-
return (React.createElement("svg", Object.assign({ width: size, height: size, viewBox: "0 0 24 24", tabIndex: tabIndex }, props, { className: (0, join_1.default)(props.className, `ab-Icon ab-Icon--${name}`), style: Object.assign({ verticalAlign: 'middle', fill: color !== null && color !== void 0 ? color : 'currentColor' }, props.style) }), children));
|
|
14
|
+
return (React.createElement("svg", Object.assign({ width: size, height: size, viewBox: "0 0 24 24", tabIndex: tabIndex, "data-id": name, "data-name": "AdaptableIcon" }, props, { className: (0, join_1.default)(props.className, `ab-Icon ab-Icon--${name}`), style: Object.assign({ verticalAlign: 'middle', fill: color !== null && color !== void 0 ? color : 'currentColor' }, props.style) }), children));
|
|
15
15
|
};
|