@creative-web-solution/front-library 7.1.12 → 7.1.14

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/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## 7.1.14
5
+
6
+ * EventManager: Fix bug on array
7
+ * SkinSelect: Update title on select when dispatch event is off
8
+
9
+
10
+ ## 7.1.13
11
+
12
+ * SkinSelect: Update fire event on select
13
+
14
+
4
15
  ## 7.1.12
5
16
 
6
17
  * Validator: Use dayjs library to validate date
@@ -202,6 +202,9 @@ export const off = function( $elements: any, options: FLib.Events.EventsManager.
202
202
  let registry: FLib.Events.EventsManager.DataRegistry[] = useNativeDOMEvents ? DOMRegistry : ObjectRegistry;
203
203
 
204
204
  registry.forEach( item => {
205
+ if ( item.$element !== $element ) {
206
+ return;
207
+ }
205
208
  const callback = item.delegate || item.options._internalCallback || item.options.callback;
206
209
 
207
210
  if ( !options.callback || options.callback === item.options.callback ) {
@@ -278,7 +278,7 @@ export default class SkinSelect implements FLib.SkinSelect.SkinSelect {
278
278
  }
279
279
 
280
280
 
281
- selectByValue( value: string | number ): this {
281
+ selectByValue( value: string | number, dispatchEvent = true ): this {
282
282
  if ( this.#$select.disabled || this.#loading ) {
283
283
  return this;
284
284
  }
@@ -289,11 +289,11 @@ export default class SkinSelect implements FLib.SkinSelect.SkinSelect {
289
289
  return this;
290
290
  }
291
291
 
292
- return this.selectByIndex( IDX );
292
+ return this.selectByIndex( IDX, dispatchEvent );
293
293
  }
294
294
 
295
295
 
296
- selectByOption( optionOrItem: HTMLElement ): this {
296
+ selectByOption( optionOrItem: HTMLElement, dispatchEvent = true ): this {
297
297
  if ( this.#$select.disabled || this.#loading ) {
298
298
  return this;
299
299
  }
@@ -304,14 +304,14 @@ export default class SkinSelect implements FLib.SkinSelect.SkinSelect {
304
304
  return this;
305
305
  }
306
306
 
307
- return this.selectByIndex( IDX );
307
+ return this.selectByIndex( IDX, dispatchEvent );
308
308
  }
309
309
 
310
310
 
311
311
  /**
312
312
  * Select an option
313
313
  */
314
- selectByIndex( index: number ): this {
314
+ selectByIndex( index: number, dispatchEvent = true ): this {
315
315
 
316
316
  if ( this.#$select.disabled || this.#loading ) {
317
317
  return this;
@@ -334,9 +334,14 @@ export default class SkinSelect implements FLib.SkinSelect.SkinSelect {
334
334
  } );
335
335
  }
336
336
 
337
- fire( this.#$select, {
338
- "eventsName": "change"
339
- } );
337
+ if ( dispatchEvent ) {
338
+ fire( this.#$select, {
339
+ "eventsName": "change"
340
+ } );
341
+ }
342
+ else {
343
+ this.updateTitle();
344
+ }
340
345
 
341
346
  return this;
342
347
  }
@@ -345,15 +350,15 @@ export default class SkinSelect implements FLib.SkinSelect.SkinSelect {
345
350
  /**
346
351
  * If arg is a number, it is considered as an option index, not a value.
347
352
  */
348
- select( arg: number | string | HTMLElement ): this {
353
+ select( arg: number | string | HTMLElement, dispatchEvent = true ): this {
349
354
  if ( typeof arg === 'number' ) {
350
- return this.selectByIndex( arg );
355
+ return this.selectByIndex( arg, dispatchEvent );
351
356
  }
352
357
  else if ( typeof arg === 'string' ) {
353
- return this.selectByValue( arg );
358
+ return this.selectByValue( arg, dispatchEvent );
354
359
  }
355
360
  else if ( typeof arg === 'object' ) {
356
- return this.selectByOption( arg );
361
+ return this.selectByOption( arg, dispatchEvent );
357
362
  }
358
363
 
359
364
  return this;
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Front Library
2
2
 
3
- @version: 7.1.12
3
+ @version: 7.1.14
4
4
 
5
5
 
6
6
  ## Use
@@ -1,18 +1,18 @@
1
1
  declare declare namespace FLib {
2
2
  namespace SkinSelect {
3
3
  interface SkinSelect {
4
- enable(): this;
5
- disable(): this;
6
- setInvalid(): this;
7
- setValid(): this;
8
- setLoading(): this;
9
- unsetLoading(): this;
10
- updateTitle(): this;
11
- select( param: number | string | HTMLElement ): this;
12
- selectByIndex( index: number ): this;
13
- selectByOption( optionOrItem: HTMLElement ): this;
14
- selectByValue( value: string | number ): this;
15
- updateOptions( optionsArray?: FLib.SkinSelect.OptionArray[] ): this;
4
+ enable(): this;
5
+ disable(): this;
6
+ setInvalid(): this;
7
+ setValid(): this;
8
+ setLoading(): this;
9
+ unsetLoading(): this;
10
+ updateTitle(): this;
11
+ select( param: number | string | HTMLElement, dispatchEvent?: bool ): this;
12
+ selectByIndex( index: number, dispatchEvent?: bool ): this;
13
+ selectByOption( optionOrItem: HTMLElement, dispatchEvent?: bool ): this;
14
+ selectByValue( value: string | number, dispatchEvent?: bool ): this;
15
+ updateOptions( optionsArray?: FLib.SkinSelect.OptionArray[] ): this;
16
16
  }
17
17
 
18
18
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@creative-web-solution/front-library",
3
3
  "title": "Frontend library",
4
4
  "description": "Frontend functions and modules",
5
- "version": "7.1.12",
5
+ "version": "7.1.14",
6
6
  "homepage": "https://github.com/creative-web-solution/front-library",
7
7
  "author": "Creative Web Solution <contact@cws-studio.com> (https://www.cws-studio.com)",
8
8
  "keywords": [],