From b1eced2afdffd9d4924534d6b771dbafc0b0d26d Mon Sep 17 00:00:00 2001 From: Diego Antonelli Date: Tue, 22 Jun 2021 11:36:54 +0200 Subject: [PATCH] Removing warnings --- CHANGELOG.md | 8 +++++ package-lock.json | 2 +- package.json | 2 +- .../components/CheckBoxFilterContainer.ts | 2 +- .../components/DropDownFilterContainer.ts | 2 +- .../components/DropDownSortContainer.ts | 2 +- .../components/PaginationContainer.ts | 30 +++++++++---------- src/Pagination/utils/ContainerUtils.ts | 8 ++--- .../DataSourceHelper/DataSourceHelper.ts | 18 +++++------ src/Shared/FormViewState.ts | 2 +- src/Shared/ListViewPrototype.ts | 10 +++---- src/package.xml | 2 +- typings/mendix.d.ts | 5 ++++ 13 files changed, 53 insertions(+), 40 deletions(-) create mode 100644 typings/mendix.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 0496d324..a384acd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +## 1.3.14 - 2021-06-22 + +### Fixed + +- We fixed all `logger` deprecated warnings being thrown during the execution. + +## 1.3.13 - 2021-06-02 + ### Fixed - Fixed an issue introduced in v1.3.12 where if the list view's search is not enabled, then the widget would error on any list view control widget interaction. diff --git a/package-lock.json b/package-lock.json index ad4a0d76..d3f432d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "list-view-controls", - "version": "1.3.13", + "version": "1.3.14", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 26123709..46e929ed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "list-view-controls", "widgetName": "ListViewControls", - "version": "1.3.13", + "version": "1.3.14", "description": "Search and filter Mendix list views", "copyright": "Mendix BV", "scripts": { diff --git a/src/CheckBoxFilter/components/CheckBoxFilterContainer.ts b/src/CheckBoxFilter/components/CheckBoxFilterContainer.ts index eb942ec7..eeaed979 100644 --- a/src/CheckBoxFilter/components/CheckBoxFilterContainer.ts +++ b/src/CheckBoxFilter/components/CheckBoxFilterContainer.ts @@ -127,7 +127,7 @@ export default class CheckboxFilterContainer extends Component 0) { const { offset, pageSize } = this.state; - logger.debug(this.props.uniqueid, ".renderPageButton pagesize, offset, listsize", pageSize, offset, this.state.targetListView!._datasource.getSetSize()); + mx.logger.debug(this.props.uniqueid, ".renderPageButton pagesize, offset, listsize", pageSize, offset, this.state.targetListView!._datasource.getSetSize()); return createElement(Pagination, { getMessageStatus: this.translateMessageStatus, @@ -152,7 +152,7 @@ class PaginationContainer extends Component { - logger.debug(this.props.uniqueid, "_renderData.before"); + mx.logger.debug(this.props.uniqueid, "_renderData.before"); const datasource = targetListView._datasource; if (datasource.getSetSize() === 0) { @@ -229,7 +229,7 @@ class PaginationContainer extends Component { - logger.debug(this.props.uniqueid, "_renderData.after"); + mx.logger.debug(this.props.uniqueid, "_renderData.after"); resetListViewHeight(targetListView.domNode as HTMLElement); }); } diff --git a/src/Pagination/utils/ContainerUtils.ts b/src/Pagination/utils/ContainerUtils.ts index e8e65254..6ef27c3c 100644 --- a/src/Pagination/utils/ContainerUtils.ts +++ b/src/Pagination/utils/ContainerUtils.ts @@ -44,7 +44,7 @@ export const getListNode = (targetNode: HTMLElement): HTMLUListElement => { }; export const setListNodeToEmpty = (targetNode: HTMLElement) => { - logger.debug("setListNodeToEmpty"); + mx.logger.debug("setListNodeToEmpty"); // Explicitly remove children as IE does not like listNode.innerHTML = ""; const listNode = targetNode.querySelector("ul") as HTMLUListElement; while (listNode.firstChild) { @@ -53,12 +53,12 @@ export const setListNodeToEmpty = (targetNode: HTMLElement) => { }; export const showLoader = (targetListView: DataSourceHelperListView) => { - logger.debug("showLoader"); + mx.logger.debug("showLoader"); targetListView.domNode.classList.add("widget-pagination-loading"); }; export const hideLoader = (targetListView: DataSourceHelperListView) => { - logger.debug("hideLoader"); + mx.logger.debug("hideLoader"); targetListView.domNode.classList.remove("widget-pagination-loading"); }; @@ -84,6 +84,6 @@ export const getTranslations = async (): Promise => { const localeIndex = metadataJson.languages.indexOf(localeCode); window.__widgets_translations = Object.keys(systemTexts).reduce((translations, currentKey) => ({ ...translations, [currentKey]: systemTexts[currentKey][localeIndex] }), {}); } else { - logger.error("Error while loading translations"); + mx.logger.error("Error while loading translations"); } }; diff --git a/src/Shared/DataSourceHelper/DataSourceHelper.ts b/src/Shared/DataSourceHelper/DataSourceHelper.ts index 1ada4791..3811c041 100644 --- a/src/Shared/DataSourceHelper/DataSourceHelper.ts +++ b/src/Shared/DataSourceHelper/DataSourceHelper.ts @@ -47,7 +47,7 @@ export class DataSourceHelper { this.originalSort = window.mx.isOffline() ? this.widget._datasource._sort : this.widget._datasource._sorting; aspect.after(widget, "storeState", (store: (key: string, value: any) => void) => { - logger.debug("after storeState"); + mx.logger.debug("after storeState"); if (widget.__customWidgetDataSourceHelper) { const sorting = widget.__customWidgetDataSourceHelper.sorting && widget.__customWidgetDataSourceHelper.originalSort; store("lvcSorting", sorting); @@ -98,13 +98,13 @@ export class DataSourceHelper { } private registerUpdate(restoreState: boolean) { - logger.debug("DataSourceHelper .registerUpdate"); + mx.logger.debug("DataSourceHelper .registerUpdate"); if (this.timeoutHandle) { window.clearTimeout(this.timeoutHandle); } if (!this.updateInProgress) { this.timeoutHandle = window.setTimeout(() => { - logger.debug("DataSourceHelper .execute"); + mx.logger.debug("DataSourceHelper .execute"); this.updateInProgress = true; // TODO Check if there's currently no update happening on the listView coming from another // Feature/functionality/widget which does not use DataSourceHelper @@ -215,12 +215,12 @@ export class DataSourceHelper { } else { this.widget._datasource._sorting = sorting; } - logger.debug("DataSourceHelper .set sort and constraint"); + mx.logger.debug("DataSourceHelper .set sort and constraint"); const offset = this.widget._datasource.getOffset(); const pageSize = this.widget._datasource.getPageSize(); if (!this.widget.__lvcPagingEnabled && offset > 0) { // In case load more is used, the data source have to reload the full content - logger.debug("reset offset"); + mx.logger.debug("reset offset"); this.widget._datasource.setOffset(0); this.widget._datasource.setPageSize(pageSize + offset); } @@ -229,9 +229,9 @@ export class DataSourceHelper { } this.widget.update(null, () => { - logger.debug("DataSourceHelper .updated"); + mx.logger.debug("DataSourceHelper .updated"); if (!this.widget.__lvcPagingEnabled && offset > 0) { - logger.debug("restore offset"); + mx.logger.debug("restore offset"); // Restore the original paging and offset for load more. this.widget._datasource.setOffset(offset); this.widget._datasource.setPageSize(pageSize); @@ -291,13 +291,13 @@ export class DataSourceHelper { }; if (changed) { - logger.debug(".updateDatasource changed", offset, pageSize); + mx.logger.debug(".updateDatasource changed", offset, pageSize); this.widget.__customWidgetPagingLoading = true; this.showLoader(); this.widget.sequence([ "_sourceReload", "_renderData" ], () => { this.widget.__customWidgetPagingLoading = false; resetListViewHeight(this.widget.domNode); - logger.debug(".updateDatasource updated"); + mx.logger.debug(".updateDatasource updated"); this.hideLoader(); }); } diff --git a/src/Shared/FormViewState.ts b/src/Shared/FormViewState.ts index 5a41557f..ce73d297 100644 --- a/src/Shared/FormViewState.ts +++ b/src/Shared/FormViewState.ts @@ -14,7 +14,7 @@ export class FormViewState { const mxform = this.form; const widgetViewState = mxform && mxform.viewState ? mxform.viewState[this.widgetId] : void 0; const state = widgetViewState && widgetViewState[key] !== undefined ? widgetViewState[key] : defaultValue; - logger.debug("getPageState", this.widgetId, key, defaultValue, state); + mx.logger.debug("getPageState", this.widgetId, key, defaultValue, state); return state; } diff --git a/src/Shared/ListViewPrototype.ts b/src/Shared/ListViewPrototype.ts index afd29dbf..04a3e3a7 100644 --- a/src/Shared/ListViewPrototype.ts +++ b/src/Shared/ListViewPrototype.ts @@ -13,7 +13,7 @@ import { DataSourceHelperListView, Paging } from "./DataSourceHelper/DataSourceH ListView.prototype.__lvcPrototypeUpdated = true; ListView.prototype.__postCreateOriginal = ListView.prototype.postCreate; ListView.prototype.postCreate = function(this: DataSourceHelperListView) { - logger.debug("list view control, overwrites postCreate prototype"); + mx.logger.debug("list view control, overwrites postCreate prototype"); this.__postCreateOriginal(); if (!listviewInstanceCompatible(this)) return; @@ -40,7 +40,7 @@ import { DataSourceHelperListView, Paging } from "./DataSourceHelper/DataSourceH ListView.prototype.__loadDataOriginal = ListView.prototype._loadData; ListView.prototype._loadData = function(this: DataSourceHelperListView, callback: () => void) { - logger.debug("List view control, overwrites _loadData prototype"); + mx.logger.debug("List view control, overwrites _loadData prototype"); if (!listviewInstanceCompatible(this)) { this.__loadDataOriginal(callback); return; @@ -67,7 +67,7 @@ import { DataSourceHelperListView, Paging } from "./DataSourceHelper/DataSourceH }); }; } else { - logger.debug("Prototype update called unexpected again"); + mx.logger.debug("Prototype update called unexpected again"); } function listviewPrototypeCompatible(listview: DataSourceHelperListView) { @@ -79,7 +79,7 @@ import { DataSourceHelperListView, Paging } from "./DataSourceHelper/DataSourceH && listview._renderData ); if (!compatible) { - logger.error("This Mendix version is not compatible with list view controls. The List view prototype could not be updated."); + mx.logger.error("This Mendix version is not compatible with list view controls. The List view prototype could not be updated."); } return compatible; } @@ -102,7 +102,7 @@ import { DataSourceHelperListView, Paging } from "./DataSourceHelper/DataSourceH && listview._datasource.getOffset ); if (!compatible) { - logger.error("This Mendix version is not compatible with list view controls. The List view controls use is limited."); + mx.logger.error("This Mendix version is not compatible with list view controls. The List view controls use is limited."); } return compatible; } diff --git a/src/package.xml b/src/package.xml index 81e7ae9e..204d0b24 100644 --- a/src/package.xml +++ b/src/package.xml @@ -1,6 +1,6 @@ - + diff --git a/typings/mendix.d.ts b/typings/mendix.d.ts new file mode 100644 index 00000000..5eaed82e --- /dev/null +++ b/typings/mendix.d.ts @@ -0,0 +1,5 @@ +declare namespace mx { + export interface MxInterface extends mendix.MendixInterface { + logger: mendix.Logger; + } +}