blue-react 7.9.0 → 7.10.2

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.
@@ -41,17 +41,23 @@ window.toggleSidebarEvent = new CustomEvent("toggleSidebar");
41
41
 
42
42
  /**
43
43
  * The main component. As soon this component is mounted, it is globally available under `window.blueGridRef`.
44
- * Also you can append your own event listeners with `blueGridRef.addEventListener(eventName, (prevProps, prevState) => { })`
45
- * and remove it with `blueGridRef.removeEventListener(eventName, listener)`.
44
+ * You can also append your own event listeners.
46
45
  *
47
- * Allowed event listeners:
46
+ * Allowed events:
48
47
  *
49
48
  * * **componentDidUpdate** - Component was updated.
50
- * Example: `blueGridRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
49
+ * Example: `window.blueGridRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
51
50
  * * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
52
- * Example: `blueGridRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
51
+ * Example: `window.blueGridRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
53
52
  * * **pageDidHide** - This page disappeared and another page appears instead.
54
- * Example: `blueGridRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
53
+ * Example: `window.blueGridRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
54
+ *
55
+ * Method to add event listeners:
56
+ * * `window.blueGridRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
57
+ *
58
+ * Methods to remove event listeners:
59
+ * * `window.blueGridRef.`**removeEventListener**`(eventName: string, listenerId: string)`
60
+ * * `window.blueGridRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
55
61
  */
56
62
  var Grid = /*#__PURE__*/function (_Component) {
57
63
  _inherits(Grid, _Component);
@@ -202,14 +208,28 @@ var Grid = /*#__PURE__*/function (_Component) {
202
208
  }
203
209
  }, {
204
210
  key: "addEventListener",
205
- value: function addEventListener(param1, param2, param3) {
206
- this.eventListeners.push([param1, param2, param3]);
211
+ value: function addEventListener(param1, param2, param3, listenerId) {
212
+ this.eventListeners.push([param1, param2, param3, listenerId]);
213
+ this.removeDuplicatedEventListeners();
207
214
  }
208
215
  }, {
209
216
  key: "removeEventListener",
210
- value: function removeEventListener(type, listener) {
217
+ value: function removeEventListener(type, listenerId) {
211
218
  this.eventListeners = this.eventListeners.filter(function (param) {
212
- return param[0] !== type && param[2].toString() !== listener.toString();
219
+ if (param[0] !== type) {
220
+ return param;
221
+ } else if (param[0] === type && param[3] !== listenerId) {
222
+ return param;
223
+ }
224
+ });
225
+ }
226
+ }, {
227
+ key: "removeDuplicatedEventListeners",
228
+ value: function removeDuplicatedEventListeners() {
229
+ this.eventListeners = this.eventListeners.filter(function (value, index, self) {
230
+ return index === self.findIndex(function (t) {
231
+ return t[3] === value[3] && t[0] === value[0];
232
+ });
213
233
  });
214
234
  }
215
235
  }, {
@@ -117,7 +117,7 @@ function Search(props) {
117
117
  className: "input-group-btn"
118
118
  }, /*#__PURE__*/_react.default.createElement("button", {
119
119
  type: "button",
120
- className: "blue-app-search-reset-btn btn btn-link btn-lg",
120
+ className: "blue-search-reset-btn btn btn-link",
121
121
  onClick: function onClick() {
122
122
  var _document$getElementB2;
123
123