coer-elements 2.0.41 → 2.0.43

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.
@@ -6,7 +6,7 @@ export declare class CoerButton implements AfterViewInit {
6
6
  protected _innerButton: HTMLElement;
7
7
  protected _innerButtonIcon: HTMLElement;
8
8
  id: import("@angular/core").InputSignal<string>;
9
- color: import("@angular/core").InputSignal<"default" | "primary" | "secondary" | "success" | "warning" | "danger" | "navigation" | "dark" | "light" | "information">;
9
+ color: import("@angular/core").InputSignal<"default" | "primary" | "secondary" | "success" | "warning" | "danger" | "navigation" | "information" | "dark" | "light">;
10
10
  type: import("@angular/core").InputSignal<"filled" | "outline" | "icon" | "icon-outline" | "icon-no-border">;
11
11
  typeBreakpoint: import("@angular/core").InputSignal<IButtonType>;
12
12
  icon: import("@angular/core").InputSignal<string | null | undefined>;
@@ -43,7 +43,7 @@ export declare class CoerSecretBox extends ControlValue implements AfterViewInit
43
43
  protected get _passwordType(): boolean;
44
44
  protected _isEnable: import("@angular/core").Signal<boolean>;
45
45
  protected _floatLabel: import("@angular/core").Signal<"auto" | "always">;
46
- protected _paddingRight: import("@angular/core").Signal<"0px" | "45px" | "18px">;
46
+ protected _paddingRight: import("@angular/core").Signal<"0px" | "18px" | "45px">;
47
47
  /** */
48
48
  Focus(select?: boolean, delay?: number): void;
49
49
  /** */
@@ -271,15 +271,20 @@ class CoerButton {
271
271
  Focus(timeout = 0) {
272
272
  Tools.Sleep(timeout).then(() => {
273
273
  if (this._isEnable()) {
274
- this._innerButton.focus();
274
+ if (this._showButton()) {
275
+ this._innerButton?.focus();
276
+ }
277
+ else if (this._showButtonIcon()) {
278
+ this._innerButtonIcon?.focus();
279
+ }
275
280
  }
276
281
  });
277
282
  }
278
283
  /** */
279
284
  Blur(timeout = 0) {
280
285
  Tools.Sleep(timeout).then(() => {
281
- this._innerButton.blur();
282
- this._innerButtonIcon.focus();
286
+ this._innerButton?.blur();
287
+ this._innerButtonIcon?.blur();
283
288
  });
284
289
  }
285
290
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.1", ngImport: i0, type: CoerButton, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -640,7 +645,7 @@ class CoerModal {
640
645
  }
641
646
  /** */
642
647
  Open() {
643
- this._modal.show();
648
+ this._modal?.show();
644
649
  if (!this._isOpen) {
645
650
  this._isOpen = true;
646
651
  this._isModalOpen.set(true);
@@ -649,7 +654,7 @@ class CoerModal {
649
654
  }
650
655
  /** */
651
656
  Close() {
652
- this._modal.hide();
657
+ this._modal?.hide();
653
658
  if (this._isOpen) {
654
659
  HTMLElements.GetElement(`#${this._id}-button-close`)?.blur();
655
660
  this._isOpen = false;
@@ -1290,95 +1295,89 @@ class CoerSelectbox extends ControlValue {
1290
1295
  Tools.Sleep().then(_ => {
1291
1296
  //Container
1292
1297
  const container = document.getElementById(`${this._id}-container`);
1293
- if (container) {
1294
- container.addEventListener('mouseenter', () => {
1295
- this._isOverMenu.set(true);
1296
- });
1297
- container.addEventListener('mouseleave', () => {
1298
- this._isOverMenu.set(false);
1299
- });
1300
- }
1298
+ container?.addEventListener('mouseenter', () => {
1299
+ this._isOverMenu.set(true);
1300
+ });
1301
+ container?.addEventListener('mouseleave', () => {
1302
+ this._isOverMenu.set(false);
1303
+ });
1301
1304
  //DropDown
1302
1305
  this._dropDownMenu = document.getElementById(`${this._id}-dropdown-menu`);
1303
- if (this._dropDownMenu) {
1304
- this._dropDownMenu.addEventListener('mouseenter', () => {
1305
- this._isOverMenu.set(true);
1306
- });
1307
- this._dropDownMenu.addEventListener('mouseleave', () => {
1308
- this._isOverMenu.set(false);
1309
- });
1310
- }
1306
+ this._dropDownMenu?.addEventListener('mouseenter', () => {
1307
+ this._isOverMenu.set(true);
1308
+ });
1309
+ this._dropDownMenu?.addEventListener('mouseleave', () => {
1310
+ this._isOverMenu.set(false);
1311
+ });
1311
1312
  //TextBox
1312
1313
  this._textbox = document.getElementById(this._id);
1313
- if (this._textbox) {
1314
- this._textbox.addEventListener('focus', () => {
1315
- if (this._isEnable())
1316
- this.Focus();
1317
- else
1318
- this.Blur();
1319
- });
1320
- this._textbox.addEventListener('keyup', (event) => {
1321
- const { key } = event;
1322
- if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) {
1323
- if (key === 'ArrowUp') {
1324
- const firstIndex = (this._dataSource().length <= 0) ? -1 : 0;
1325
- if ((this._index() - 1) >= firstIndex) {
1326
- this._index.update(index => index - 1);
1327
- if (this._index() >= 3)
1328
- this._scroll.update(scroll => scroll -= this._scrollByRow);
1329
- else
1330
- this._scroll.set(0);
1331
- this._dropDownMenu.scrollTo(0, this._scroll());
1332
- }
1333
- else {
1314
+ this._textbox?.addEventListener('focus', () => {
1315
+ if (this._isEnable())
1316
+ this.Focus();
1317
+ else
1318
+ this.Blur();
1319
+ });
1320
+ this._textbox?.addEventListener('keyup', (event) => {
1321
+ const { key } = event;
1322
+ if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) {
1323
+ if (key === 'ArrowUp') {
1324
+ const firstIndex = (this._dataSource().length <= 0) ? -1 : 0;
1325
+ if ((this._index() - 1) >= firstIndex) {
1326
+ this._index.update(index => index - 1);
1327
+ if (this._index() >= 3)
1328
+ this._scroll.update(scroll => scroll -= this._scrollByRow);
1329
+ else
1334
1330
  this._scroll.set(0);
1335
- this._index.set(-1);
1336
- this._textbox.focus();
1337
- this._textbox.select();
1338
- }
1339
- this._dropDownMenu.scrollTo(0, this._scroll());
1331
+ this._dropDownMenu?.scrollTo(0, this._scroll());
1340
1332
  }
1341
- else if (key === 'ArrowDown') {
1342
- const lastIndex = (this._dataSource().length - 1);
1343
- if ((this._index() + 1) <= lastIndex) {
1344
- this._index.update(index => index + 1);
1345
- if (this._index() >= 3)
1346
- this._scroll.update(scroll => scroll += this._scrollByRow);
1347
- }
1348
- this._dropDownMenu.scrollTo(0, this._scroll());
1333
+ else {
1334
+ this._scroll.set(0);
1335
+ this._index.set(-1);
1336
+ this._textbox.focus();
1337
+ this._textbox.select();
1349
1338
  }
1350
- else if (['ArrowLeft', 'ArrowRight'].includes(key)) {
1351
- if (Tools.IsNotNull(this._value) && !this._isDirty()) {
1352
- this._scroll.set(0);
1353
- this._dropDownMenu.scrollTo(0, this._scroll());
1354
- this._Search(this._displayed);
1355
- }
1356
- this._isDirty.set(true);
1339
+ this._dropDownMenu?.scrollTo(0, this._scroll());
1340
+ }
1341
+ else if (key === 'ArrowDown') {
1342
+ const lastIndex = (this._dataSource().length - 1);
1343
+ if ((this._index() + 1) <= lastIndex) {
1344
+ this._index.update(index => index + 1);
1345
+ if (this._index() >= 3)
1346
+ this._scroll.update(scroll => scroll += this._scrollByRow);
1357
1347
  }
1348
+ this._dropDownMenu?.scrollTo(0, this._scroll());
1358
1349
  }
1359
- else {
1360
- if (key == 'Delete' && this._search() == '') {
1361
- this.Unselect();
1350
+ else if (['ArrowLeft', 'ArrowRight'].includes(key)) {
1351
+ if (Tools.IsNotNull(this._value) && !this._isDirty()) {
1352
+ this._scroll.set(0);
1353
+ this._dropDownMenu?.scrollTo(0, this._scroll());
1354
+ this._Search(this._displayed);
1362
1355
  }
1363
1356
  this._isDirty.set(true);
1364
1357
  }
1358
+ }
1359
+ else {
1360
+ if (key == 'Delete' && this._search() == '') {
1361
+ this.Unselect();
1362
+ }
1363
+ this._isDirty.set(true);
1364
+ }
1365
+ });
1366
+ this._textbox.addEventListener('keydown', () => {
1367
+ if (!this._isOpen())
1368
+ this._Open();
1369
+ });
1370
+ this._textbox.addEventListener('mouseenter', () => {
1371
+ this._isOverMenu.set(true);
1372
+ });
1373
+ this._textbox.addEventListener('mouseleave', () => {
1374
+ this._isOverMenu.set(false);
1375
+ });
1376
+ this._textbox.addEventListener('paste', () => {
1377
+ Tools.Sleep().then(_ => {
1378
+ this._search.update(search => search = search.toString().trim());
1365
1379
  });
1366
- this._textbox.addEventListener('keydown', () => {
1367
- if (!this._isOpen())
1368
- this._Open();
1369
- });
1370
- this._textbox.addEventListener('mouseenter', () => {
1371
- this._isOverMenu.set(true);
1372
- });
1373
- this._textbox.addEventListener('mouseleave', () => {
1374
- this._isOverMenu.set(false);
1375
- });
1376
- this._textbox.addEventListener('paste', () => {
1377
- Tools.Sleep().then(_ => {
1378
- this._search.update(search => search = search.toString().trim());
1379
- });
1380
- });
1381
- }
1380
+ });
1382
1381
  //Document
1383
1382
  document.addEventListener('click', () => {
1384
1383
  if (!this._isOverMenu())
@@ -1481,8 +1480,8 @@ class CoerSelectbox extends ControlValue {
1481
1480
  this._isLoadingEvent.set(true);
1482
1481
  Tools.Sleep(delay).then(_ => {
1483
1482
  if (this._isEnable()) {
1484
- this._textbox.focus();
1485
- this._textbox.select();
1483
+ this._textbox?.focus();
1484
+ this._textbox?.select();
1486
1485
  if (open)
1487
1486
  this._Open();
1488
1487
  }
@@ -1502,10 +1501,10 @@ class CoerSelectbox extends ControlValue {
1502
1501
  this._isDirty.set(false);
1503
1502
  this._index.set(-1);
1504
1503
  this._scroll.set(0);
1505
- this._dropDownMenu.scrollTo(0, this._scroll());
1504
+ this._dropDownMenu?.scrollTo(0, this._scroll());
1506
1505
  this._search.set(this._displayed);
1507
1506
  Tools.Sleep().then(_ => {
1508
- this._textbox.blur();
1507
+ this._textbox?.blur();
1509
1508
  this._Close();
1510
1509
  Tools.Sleep().then(_ => {
1511
1510
  const element = document.querySelector(`#${this._id}-container .mdc-line-ripple--active`);
@@ -1517,15 +1516,15 @@ class CoerSelectbox extends ControlValue {
1517
1516
  }
1518
1517
  /** */
1519
1518
  _Open() {
1520
- if (!this._dropDownMenu.classList.contains('show')) {
1521
- this._dropDownMenu.classList.add('show');
1519
+ if (!this._dropDownMenu?.classList.contains('show')) {
1520
+ this._dropDownMenu?.classList.add('show');
1522
1521
  }
1523
1522
  this._isOpen.set(true);
1524
1523
  }
1525
1524
  /** */
1526
1525
  _Close() {
1527
- if (this._dropDownMenu.classList.contains('show')) {
1528
- this._dropDownMenu.classList.remove('show');
1526
+ if (this._dropDownMenu?.classList.contains('show')) {
1527
+ this._dropDownMenu?.classList.remove('show');
1529
1528
  }
1530
1529
  this._isOpen.set(false);
1531
1530
  }
@@ -1542,7 +1541,7 @@ class CoerSelectbox extends ControlValue {
1542
1541
  else {
1543
1542
  this._scroll.set(0);
1544
1543
  }
1545
- this._dropDownMenu.scrollTo(0, this._scroll());
1544
+ this._dropDownMenu?.scrollTo(0, this._scroll());
1546
1545
  }
1547
1546
  });
1548
1547
  }