bromcom-ui 2.3.49 → 2.3.50

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.
@@ -58,6 +58,10 @@
58
58
  :host {
59
59
  display: block;
60
60
  position: relative;
61
+ user-select: none;
62
+ width: 256px;
63
+ }
64
+ :host main {
61
65
  width: 256px;
62
66
  height: 256px;
63
67
  background-color: #ffffff;
@@ -67,13 +71,15 @@
67
71
  display: flex;
68
72
  flex-direction: column;
69
73
  position: relative;
70
- user-select: none;
71
- opacity: 0;
74
+ padding: 8px;
72
75
  }
73
76
 
74
77
  :host(.full-width) {
75
78
  width: 100%;
76
79
  }
80
+ :host(.full-width) main {
81
+ width: 100%;
82
+ }
77
83
 
78
84
  :host(.linked) {
79
85
  z-index: -999;
@@ -93,6 +99,9 @@
93
99
  width: 100%;
94
100
  height: 100%;
95
101
  }
102
+ :host(.flex) main {
103
+ width: 100%;
104
+ }
96
105
 
97
106
  :host(.type-autocomplete) .search-container {
98
107
  height: 0;
@@ -101,6 +110,43 @@
101
110
  overflow: hidden;
102
111
  }
103
112
 
113
+ .label {
114
+ display: block;
115
+ color: var(--bcm-color-grey-9);
116
+ margin-bottom: 4px;
117
+ }
118
+
119
+ .caption-area {
120
+ min-height: 20px;
121
+ }
122
+
123
+ .caption-default {
124
+ color: #8C8C8C;
125
+ }
126
+
127
+ .caption-primary {
128
+ color: #4293CF;
129
+ }
130
+
131
+ .caption-success {
132
+ color: #52C41A;
133
+ }
134
+
135
+ .caption-warning {
136
+ color: #FA8C16;
137
+ }
138
+
139
+ .caption-error {
140
+ color: #F5222D;
141
+ }
142
+
143
+ :host(.error) .label {
144
+ color: var(--bcm-color-red-6) !important;
145
+ }
146
+ :host(.error) main {
147
+ border: 1px solid var(--bcm-color-red-6) !important;
148
+ }
149
+
104
150
  .search-container {
105
151
  margin: 0 8px;
106
152
  padding-top: 8px;
@@ -67,6 +67,8 @@ export class BcmList {
67
67
  this.required = false;
68
68
  }
69
69
  connectedCallback() {
70
+ this.captionCache = this.caption;
71
+ this.captionTypeCache = this.captionType;
70
72
  this.bodyStyleOverflow = document.querySelector("body").style.overflow;
71
73
  const elementId = "bcm-list-select-" + this._id;
72
74
  if (this.type === 'select' || this.type === 'autocomplete') {
@@ -92,6 +94,11 @@ export class BcmList {
92
94
  componentDidLoad() { }
93
95
  componentWillRender() { }
94
96
  componentDidRender() {
97
+ const elementId = "bcm-list-select-" + this._id;
98
+ if (this.type === 'select' || this.type === 'autocomplete') {
99
+ this.selectIsInitialize();
100
+ this.linkedComponent = elementId;
101
+ }
95
102
  if (sessionStorage.getItem(this._internal_id + "-config")) {
96
103
  this.config(JSON.parse(sessionStorage.getItem(this._internal_id + "-config")));
97
104
  }
@@ -179,6 +186,12 @@ export class BcmList {
179
186
  }
180
187
  }
181
188
  }
189
+ /**
190
+ * @desc
191
+ */
192
+ handleChange(newValue) {
193
+ this.change.emit(newValue);
194
+ }
182
195
  /**
183
196
  * @desc
184
197
  */
@@ -283,6 +296,14 @@ export class BcmList {
283
296
  async getChecklist() {
284
297
  return this.checklist;
285
298
  }
299
+ /**
300
+ * @desc
301
+ */
302
+ async resetCaption() {
303
+ this.caption = this.captionCache;
304
+ this.captionType = this.captionTypeCache;
305
+ this.captionError = null;
306
+ }
286
307
  /**
287
308
  * @desc
288
309
  */
@@ -354,7 +375,6 @@ export class BcmList {
354
375
  // this.handleIndeterminateStatus()
355
376
  // this.sendSelectValue()
356
377
  }
357
- // console.log("selectedIDs: ", selectedIDs)
358
378
  this.checked(selectedIDs, false);
359
379
  }
360
380
  }
@@ -400,10 +420,7 @@ export class BcmList {
400
420
  this.setClear(false);
401
421
  }
402
422
  if (typeof checkedItems == 'string') {
403
- if (this.sendSelectId(String(checkedItems)) !== false) {
404
- this.sendSelectId(String(checkedItems));
405
- // selectedIDs.push( checkItem )
406
- }
423
+ this.sendSelectId(String(checkedItems));
407
424
  if (this.multiSelect === false) {
408
425
  this.selectedId = this.items.find(e => String(e[this.objectMapping['id']]) === String(checkedItems));
409
426
  }
@@ -411,10 +428,7 @@ export class BcmList {
411
428
  else {
412
429
  if (this.multiSelect === true) {
413
430
  checkedItems.forEach(item => {
414
- if (this.sendSelectId(String(item)) !== false) {
415
- this.sendSelectId(String(item));
416
- // selectedIDs.push( checkItem )
417
- }
431
+ this.sendSelectId(String(item));
418
432
  });
419
433
  }
420
434
  }
@@ -437,13 +451,7 @@ export class BcmList {
437
451
  */
438
452
  async setClear(eventEmit = true) {
439
453
  if (this.items != undefined && this.items.length > 0) {
440
- // this.el.shadowRoot.querySelectorAll("bcm-list-item").forEach( item => {
441
- // if ( item.shadowRoot.querySelector(".checkbox") ){
442
- // item.shadowRoot.querySelector(".checkbox").querySelector("input").checked = false
443
- // }
444
- // item.classList.remove("selected")
445
- // })
446
- this.unChecked(Object.keys(this.items));
454
+ this.unChecked(this.items.map(item => { return item[this.objectMapping["id"]]; }));
447
455
  }
448
456
  this.selectedId = null;
449
457
  this.checklist = [];
@@ -471,7 +479,6 @@ export class BcmList {
471
479
  this.searchData = _data;
472
480
  await delay(100);
473
481
  _data.map(item => {
474
- // console.log(item)
475
482
  const element = document.createElement("bcm-list-item");
476
483
  element.setAttribute("_internal_id", this._internal_id);
477
484
  element.setAttribute("text", item[this.objectMapping['text']]);
@@ -527,44 +534,33 @@ export class BcmList {
527
534
  * @desc
528
535
  */
529
536
  handleClick(event) {
530
- // console.log(this.el.contains(event.target as HTMLElement) )
531
- // console.log(
532
- // event["path"]
533
- // && event["path"].filter((input: HTMLElement) => input['_internal_id'] == this._internal_id)[0]
534
- // && event["path"].filter((input: HTMLElement) => input['nodeName'] == "BCM-LIST-ITEM")[0]
535
- // && this.multiSelect === false
536
- // )
537
+ var path = event.path || (event.composedPath && event.composedPath());
537
538
  if (!this.el.contains(event.target)
538
- || (event["path"]
539
- && event["path"].filter((input) => input['_internal_id'] == this._internal_id)[0]
540
- && event["path"].filter((input) => input['nodeName'] == "BCM-LIST-ITEM")[0]
539
+ || (path
540
+ && path.filter((input) => input['_internal_id'] == this._internal_id)[0]
541
+ && path.filter((input) => input['nodeName'] == "BCM-LIST-ITEM")[0]
541
542
  && this.multiSelect === false)) {
542
543
  if (this.isShow === true) {
543
544
  this.hide();
544
545
  }
545
546
  }
546
- // if ( event["path"]
547
- // && event["path"].filter((input: HTMLElement) => input['id'] == "other-tag")[0]
548
- // && event["path"].filter((input: HTMLElement) => input['_internal_id'] == this._internal_id)[0] ){
549
- // event.preventDefault();
550
- // event.stopPropagation();
551
- // console.log("clone aç")
552
- // // this.show("other")
553
- // const elementId = "bcm-clone-list-" + this._internal_id
554
- // var element:any = document.getElementById(elementId)
555
- // console.log(element)
556
- // // setTimeout(() => {
557
- // // this.hide()
558
- // element.show();
559
- // // }, 100);
560
- // }
547
+ }
548
+ /**
549
+ * @desc
550
+ */
551
+ wheelEvent(event) {
552
+ if (!this.el.contains(event.target)) {
553
+ if (this.isShow === true) {
554
+ this.hide();
555
+ }
556
+ }
561
557
  }
562
558
  /**
563
559
  * @desc
564
560
  */
565
561
  scrollEvent(event) {
566
562
  if (!this.el.contains(event.target)) {
567
- if (this.isShow) {
563
+ if (this.isShow === true) {
568
564
  this.hide();
569
565
  }
570
566
  }
@@ -594,27 +590,28 @@ export class BcmList {
594
590
  * @descc
595
591
 
596
592
  */
597
- listenSearchResult(e) {
598
- if (e.isEvent == undefined) {
599
- if (e["path"] && e["path"].filter((input) => input['_internal_id'] == this._internal_id)[0] != undefined) {
593
+ listenSearchResult(event) {
594
+ var path = event.path || (event.composedPath && event.composedPath());
595
+ if (event.isEvent == undefined) {
596
+ if (path && path.filter((input) => input['_internal_id'] == this._internal_id)[0] != undefined) {
600
597
  // var childs: any[] = getChilds(this.el, 'bcm-list-item')
601
598
  var childs = this.el.shadowRoot.querySelectorAll("bcm-list-item");
602
599
  childs.forEach(element => {
603
600
  element.classList.add("hidden");
604
601
  });
605
- if (e.detail.length > 0) {
606
- if (e.detail[0] == -1) {
602
+ if (event.detail.length > 0) {
603
+ if (event.detail[0] == -1) {
607
604
  this.totalSearch = 0;
608
605
  this.empty = true;
609
606
  }
610
607
  else {
611
- this.totalSearch = e.detail.length;
608
+ this.totalSearch = event.detail.length;
612
609
  this.empty = false;
613
610
  if (this.dataLength > 0) {
614
611
  childs.forEach(element => {
615
612
  if (this.highlight) {
616
- e.target.addEventListener('bcm-on-search-value', async (e) => {
617
- var searchValue = await e.detail;
613
+ event.target.addEventListener('bcm-on-search-value', async (event) => {
614
+ var searchValue = await event.detail;
618
615
  var inputText = element.shadowRoot.getElementById("text");
619
616
  inputText = inputText.textContent || inputText.innerText || "";
620
617
  if (searchValue) {
@@ -628,14 +625,14 @@ export class BcmList {
628
625
  element.shadowRoot.getElementById("text").innerHTML = inputText;
629
626
  });
630
627
  }
631
- if (e.detail.indexOf(element._id) >= 0) {
628
+ if (event.detail.indexOf(element._id) >= 0) {
632
629
  element.classList.remove("hidden");
633
630
  }
634
631
  });
635
632
  }
636
633
  }
637
634
  }
638
- else if (e.detail === true) {
635
+ else if (event.detail === true) {
639
636
  this.totalSearch = this.dataLength;
640
637
  this.empty = false;
641
638
  childs.forEach(element => {
@@ -651,7 +648,6 @@ export class BcmList {
651
648
 
652
649
  */
653
650
  sendSelectId(id, status = true) {
654
- // console.log(this.items.find( e => e[ this.objectMapping['id'] ] == id ))
655
651
  if (this.items && this.items.find(e => e[this.objectMapping['id']] == id)) {
656
652
  if (this.isRendered === false) {
657
653
  this.items.find(e => e[this.objectMapping['id']] == id)[this.objectMapping['selected']] = status;
@@ -695,7 +691,7 @@ export class BcmList {
695
691
  * @descc
696
692
  */
697
693
  handleListSelected(event) {
698
- // var path = event.path || (event.composedPath && event.composedPath());
694
+ var path = event.path || (event.composedPath && event.composedPath());
699
695
  // console.log(path);
700
696
  if (this.isInternal(event) || (!this.isInternal(event) && this.isInternalSlot(event))) {
701
697
  var status = false;
@@ -727,8 +723,8 @@ export class BcmList {
727
723
  }
728
724
  }
729
725
  if (this.isInternalSlot(event)) {
730
- if (selectedItem = event.path[0]) {
731
- this.selectedId = event.path[0].id;
726
+ if (selectedItem = path[0]) {
727
+ this.selectedId = path[0].id;
732
728
  this.value = event.detail;
733
729
  return true;
734
730
  }
@@ -847,32 +843,35 @@ export class BcmList {
847
843
  * @desc
848
844
  */
849
845
  getItemId(event) {
850
- const detect = event.path
851
- && event.path[0]
852
- && event.path[0].attributes
853
- && event.path[0].attributes['id']
854
- && event.path[0].attributes['id'].value;
846
+ var path = event.path || (event.composedPath && event.composedPath());
847
+ const detect = path
848
+ && path[0]
849
+ && path[0].attributes
850
+ && path[0].attributes['id']
851
+ && path[0].attributes['id'].value;
855
852
  return detect;
856
853
  }
857
854
  /**
858
855
  * @desc
859
856
  */
860
857
  isInternalSlot(event) {
861
- const detect = event.path
862
- && event.path[0]
863
- && lowercase(event.path[0].tagName) === 'bcm-list-item'
864
- && this.el.contains(event.path[0]);
858
+ var path = event.path || (event.composedPath && event.composedPath());
859
+ const detect = path
860
+ && path[0]
861
+ && lowercase(path[0].tagName) === 'bcm-list-item'
862
+ && this.el.contains(path[0]);
865
863
  return detect;
866
864
  }
867
865
  /**
868
866
  * @desc
869
867
  */
870
868
  isInternal(event) {
871
- const detect = event.path
872
- && event.path[0]
873
- && event.path[0].attributes
874
- && event.path[0].attributes['_internal_id']
875
- && event.path[0].attributes['_internal_id'].value;
869
+ var path = event.path || (event.composedPath && event.composedPath());
870
+ const detect = path
871
+ && path[0]
872
+ && path[0].attributes
873
+ && path[0].attributes['_internal_id']
874
+ && path[0].attributes['_internal_id'].value;
876
875
  return detect == this._internal_id;
877
876
  }
878
877
  /**
@@ -981,7 +980,7 @@ export class BcmList {
981
980
  // }
982
981
  });
983
982
  if (this.checkStatus === true) {
984
- this.checked(selectedIDs);
983
+ this.checked(selectedIDs, false);
985
984
  }
986
985
  else {
987
986
  this.unChecked(selectedIDs);
@@ -995,9 +994,9 @@ export class BcmList {
995
994
  // element.unChecked(this.selectedId)
996
995
  }
997
996
  }
998
- this.listChecked.emit(this.checklist);
999
- this.value = this.checklist;
1000
- this.sendSelectValue();
997
+ // this.listChecked.emit( this.checklist )
998
+ // this.value = this.checklist
999
+ // this.sendSelectValue()
1001
1000
  }
1002
1001
  this.handleIndeterminateStatus();
1003
1002
  }
@@ -1006,7 +1005,6 @@ export class BcmList {
1006
1005
  */
1007
1006
  sendSelectValue() {
1008
1007
  if (this.type === 'select' || this.type === 'autocomplete') {
1009
- // console.log(this.value)
1010
1008
  const select = document.getElementById("bcm-list-select-" + this._id);
1011
1009
  if (select) {
1012
1010
  if (this.multiSelect === true) {
@@ -1025,6 +1023,7 @@ export class BcmList {
1025
1023
  'size-3': this.size === 'large',
1026
1024
  });
1027
1025
  const hostClasses = cs(this.hidden ? 'hidden' : null, 'type-' + this.type, {
1026
+ 'error': this.captionType == 'error' ? true : false,
1028
1027
  'show': this.isShow,
1029
1028
  'flex': this.minHeight != null || this.maxHeight != null,
1030
1029
  'full-width': this.fullWidth
@@ -1033,6 +1032,7 @@ export class BcmList {
1033
1032
  'show': this.searchable,
1034
1033
  });
1035
1034
  const footer = cs('footer');
1035
+ const captionClasses = cs('size-1', 'input-caption', 'caption-' + this.captionType);
1036
1036
  var customStyle = {
1037
1037
  'height': this.minHeight != null || this.maxHeight != null ? 'auto' : this.height,
1038
1038
  'min-height': this.minHeight != null ? this.minHeight : null,
@@ -1043,27 +1043,43 @@ export class BcmList {
1043
1043
  'max-width': this.maxWidth != null ? this.maxWidth == "100%" || this.maxWidth == "auto" ? this.linkedElementWidth : this.maxWidth : null,
1044
1044
  };
1045
1045
  return (h(Host, { class: hostClasses, style: customStyle },
1046
- this.searchable === true && (h("div", { class: searchContainer },
1047
- h("bcm-search", { id: "search", _internal_id: this._internal_id, searchPlaceholder: this.searchPlaceholder, data: this.searchData, returnField: this.returnField, searchFields: this.searchFields, searchValue: this.searchText, clearable: true }),
1048
- h("bcm-divider", null))),
1049
- this.multiSelect === true && (h("div", { class: "check-container" },
1050
- h("div", { class: listItem, id: "text", onClick: (e) => this.handleIndeterminateClick(e) },
1051
- h("div", { class: "check-content" },
1052
- h("bcm-checkbox-lite", { id: 'check-lite-' + this._id, name: 'check-lite-' + this._id, checked: false, indeterminate: false, onClick: (e) => this.handleCheckboxClick(e) })),
1053
- "Select All"),
1054
- h("div", { class: "divider" },
1055
- h("bcm-divider", null)))),
1056
- h("div", { class: classes },
1057
- h("slot", null),
1058
- h("div", { class: "list" }),
1059
- h("div", { class: "spinner first-run" },
1060
- h("bcm-icon", { type: "animated", color: "prime-blue", class: "prefix", icon: "loading" }))),
1061
- this.infoFooter == true && (h("div", { class: footer },
1062
- h("bcm-text", { scale: "size-1", color: "grey-8" },
1063
- h("span", { id: "selected-item" }),
1064
- " Total ",
1065
- h("span", { id: "in-total" }, "0"),
1066
- " items found.")))));
1046
+ (this.type === 'default' && this.processType === 'default' && this.label) && (h("label", { class: "label size-1" },
1047
+ " ",
1048
+ this.label,
1049
+ " ",
1050
+ this.required && ('*'),
1051
+ " ")),
1052
+ h("main", { style: customStyle },
1053
+ this.searchable === true && (h("div", { class: searchContainer },
1054
+ h("bcm-search", { id: "search", _internal_id: this._internal_id, searchPlaceholder: this.searchPlaceholder, data: this.searchData, returnField: this.returnField, searchFields: this.searchFields, searchValue: this.searchText, clearable: true }),
1055
+ h("bcm-divider", null))),
1056
+ h("div", { class: classes },
1057
+ this.multiSelect === true && (h("div", { class: "check-container" },
1058
+ h("div", { class: listItem, id: "text", onClick: (e) => this.handleIndeterminateClick(e) },
1059
+ h("div", { class: "check-content" },
1060
+ h("bcm-checkbox-lite", { id: 'check-lite-' + this._id, name: 'check-lite-' + this._id, checked: false, indeterminate: false, onClick: (e) => this.handleCheckboxClick(e) })),
1061
+ "Select All"),
1062
+ h("div", { class: "divider" },
1063
+ h("bcm-divider", null)))),
1064
+ h("slot", null),
1065
+ h("div", { class: "list" }),
1066
+ h("div", { class: "spinner first-run" },
1067
+ h("bcm-icon", { type: "animated", color: "prime-blue", class: "prefix", icon: "loading" }))),
1068
+ this.infoFooter == true && (h("div", { class: footer },
1069
+ h("bcm-text", { scale: "size-1", color: "grey-8" },
1070
+ h("span", { id: "selected-item" }),
1071
+ " Total ",
1072
+ h("span", { id: "in-total" }, "0"),
1073
+ " items found.")))),
1074
+ (this.type === 'default' && this.processType === 'default' && !this.noCaption) && (h("div", { class: "caption-area" }, this.captionType == "error"
1075
+ ? h("span", { class: captionClasses },
1076
+ " ",
1077
+ this.captionError,
1078
+ " ")
1079
+ : this.caption && h("span", { class: captionClasses },
1080
+ " ",
1081
+ this.caption,
1082
+ " ")))));
1067
1083
  }
1068
1084
  static get is() { return "bcm-list"; }
1069
1085
  static get encapsulation() { return "shadow"; }
@@ -1712,7 +1728,9 @@ export class BcmList {
1712
1728
  }
1713
1729
  }; }
1714
1730
  static get states() { return {
1715
- "searchText": {}
1731
+ "searchText": {},
1732
+ "captionCache": {},
1733
+ "captionTypeCache": {}
1716
1734
  }; }
1717
1735
  static get events() { return [{
1718
1736
  "method": "listSelected",
@@ -1744,6 +1762,21 @@ export class BcmList {
1744
1762
  "resolved": "any",
1745
1763
  "references": {}
1746
1764
  }
1765
+ }, {
1766
+ "method": "change",
1767
+ "name": "bcm-change",
1768
+ "bubbles": true,
1769
+ "cancelable": true,
1770
+ "composed": true,
1771
+ "docs": {
1772
+ "tags": [],
1773
+ "text": ""
1774
+ },
1775
+ "complexType": {
1776
+ "original": "any",
1777
+ "resolved": "any",
1778
+ "references": {}
1779
+ }
1747
1780
  }]; }
1748
1781
  static get methods() { return {
1749
1782
  "hide": {
@@ -1973,6 +2006,25 @@ export class BcmList {
1973
2006
  }]
1974
2007
  }
1975
2008
  },
2009
+ "resetCaption": {
2010
+ "complexType": {
2011
+ "signature": "() => Promise<void>",
2012
+ "parameters": [],
2013
+ "references": {
2014
+ "Promise": {
2015
+ "location": "global"
2016
+ }
2017
+ },
2018
+ "return": "Promise<void>"
2019
+ },
2020
+ "docs": {
2021
+ "text": "",
2022
+ "tags": [{
2023
+ "name": "desc",
2024
+ "text": undefined
2025
+ }]
2026
+ }
2027
+ },
1976
2028
  "toggleChecked": {
1977
2029
  "complexType": {
1978
2030
  "signature": "(checkedItems?: Array<string> | string) => Promise<void>",
@@ -2078,6 +2130,9 @@ export class BcmList {
2078
2130
  static get watchers() { return [{
2079
2131
  "propName": "isShow",
2080
2132
  "methodName": "handleOpen"
2133
+ }, {
2134
+ "propName": "value",
2135
+ "methodName": "handleChange"
2081
2136
  }]; }
2082
2137
  static get listeners() { return [{
2083
2138
  "name": "click",
@@ -2085,6 +2140,12 @@ export class BcmList {
2085
2140
  "target": "window",
2086
2141
  "capture": true,
2087
2142
  "passive": false
2143
+ }, {
2144
+ "name": "wheel",
2145
+ "method": "wheelEvent",
2146
+ "target": "window",
2147
+ "capture": true,
2148
+ "passive": true
2088
2149
  }, {
2089
2150
  "name": "scroll",
2090
2151
  "method": "scrollEvent",