@schukai/monster 3.62.0 → 3.63.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,18 @@
1
1
 
2
+ ## [3.63.0] - 2024-03-25
3
+
4
+ ### Add Features
5
+
6
+ - add events to dataset methods [#178](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/178)
7
+
2
8
  ## [3.62.0] - 2024-03-25
3
9
 
4
10
  ### Add Features
5
11
 
6
12
  - add addRow, removeRow and copyRow [#175](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/175) [#176](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/176) [#177](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/177)
13
+ ### Changes
14
+
15
+ - release and publish to npm new version 3.62.0
7
16
 
8
17
  ## [3.61.0] - 2024-03-24
9
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schukai/monster",
3
- "version": "3.62.0",
3
+ "version": "3.63.0",
4
4
  "description": "Monster is a simple library for creating fast, robust and lightweight websites.",
5
5
  "keywords": [
6
6
  "framework",
@@ -10,7 +10,7 @@ import {
10
10
  registerCustomElement,
11
11
  getSlottedElements,
12
12
  } from "../../dom/customelement.mjs";
13
- import {findTargetElementFromEvent} from "../../dom/events.mjs";
13
+ import {findTargetElementFromEvent, fireCustomEvent} from "../../dom/events.mjs";
14
14
  import {clone} from "../../util/clone.mjs";
15
15
  import {
16
16
  isString,
@@ -119,6 +119,9 @@ const columnBarElementSymbol = Symbol("columnBarElement");
119
119
  * @copyright schukai GmbH
120
120
  * @memberOf Monster.Components.Datatable
121
121
  * @summary A data table
122
+ * @fire Monster.Components.Datatable.event:monster-datatable-row-copied
123
+ * @fire Monster.Components.Datatable.event:monster-datatable-row-removed
124
+ * @fire Monster.Components.Datatable.event:monster-datatable-row-added
122
125
  */
123
126
  class DataTable extends CustomElement {
124
127
  /**
@@ -330,6 +333,7 @@ class DataTable extends CustomElement {
330
333
  * @param {number} fromIndex
331
334
  * @param {number} toIndex
332
335
  * @returns {Monster.Components.Datatable.DataTable}
336
+ * @fire Monster.Components.Datatable.event:monster-datatable-row-copied
333
337
  */
334
338
  copyRow(fromIndex, toIndex) {
335
339
 
@@ -372,6 +376,11 @@ class DataTable extends CustomElement {
372
376
 
373
377
  rows.splice(toIndex, 0, clone(rows[fromIndex]));
374
378
  datasource.data=c;
379
+
380
+ fireCustomEvent(this, "monster-datatable-row-copied", {
381
+ index: toIndex,
382
+ });
383
+
375
384
  return this;
376
385
  }
377
386
 
@@ -379,6 +388,7 @@ class DataTable extends CustomElement {
379
388
  * Remove a row from the datatable
380
389
  * @param index
381
390
  * @returns {Monster.Components.Datatable.DataTable}
391
+ * @fire Monster.Components.Datatable.event:monster-datatable-row-removed
382
392
  */
383
393
  removeRow(index) {
384
394
  const datasource = this[datasourceLinkedElementSymbol];
@@ -412,6 +422,11 @@ class DataTable extends CustomElement {
412
422
 
413
423
  rows.splice(index, 1)
414
424
  datasource.data=c;
425
+
426
+ fireCustomEvent(this, "monster-datatable-row-removed", {
427
+ index: index,
428
+ });
429
+
415
430
  return this;
416
431
  }
417
432
 
@@ -419,7 +434,8 @@ class DataTable extends CustomElement {
419
434
  * Add a row to the datatable
420
435
  * @param {Object} data
421
436
  * @returns {Monster.Components.Datatable.DataTable}
422
- */
437
+ * @fire Monster.Components.Datatable.event:monster-datatable-row-added
438
+ **/
423
439
  addRow(data) {
424
440
  const datasource = this[datasourceLinkedElementSymbol];
425
441
  if (!datasource) {
@@ -444,6 +460,11 @@ class DataTable extends CustomElement {
444
460
 
445
461
  rows.push(data)
446
462
  datasource.data=c;
463
+
464
+ fireCustomEvent(this, "monster-datatable-row-added", {
465
+ index: rows.length - 1,
466
+ });
467
+
447
468
  return this;
448
469
  }
449
470
 
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright schukai GmbH and contributors 2023. All Rights Reserved.
3
+ * Node module: @schukai/monster
4
+ * This file is licensed under the AGPLv3 License.
5
+ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
6
+ */
7
+
8
+ /**
9
+ * @memberOf Monster.Components.Form
10
+ * @event event:monster-datatable-row-added
11
+ * @type {number} index
12
+ */
13
+
14
+ /**
15
+ * @memberOf Monster.Components.Form
16
+ * @event event:monster-datatable-row-copied
17
+ * @type {number} index
18
+ */
19
+
20
+ /**
21
+ * @memberOf Monster.Components.Form
22
+ * @event event:monster-datatable-row-removed
23
+ * @type {number} index
24
+ */
@@ -152,7 +152,7 @@ function getMonsterVersion() {
152
152
  }
153
153
 
154
154
  /** don't touch, replaced by make with package.json version */
155
- monsterVersion = new Version("3.62.0");
155
+ monsterVersion = new Version("3.63.0");
156
156
 
157
157
  return monsterVersion;
158
158
  }
@@ -7,7 +7,7 @@ describe('Monster', function () {
7
7
  let monsterVersion
8
8
 
9
9
  /** don´t touch, replaced by make with package.json version */
10
- monsterVersion = new Version("3.62.0")
10
+ monsterVersion = new Version("3.63.0")
11
11
 
12
12
  let m = getMonsterVersion();
13
13