@nys-cui/cui-formpill 0.2.6 → 0.2.7

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/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "main": "./dist/js/cui-formpill.js",
8
8
  "type": "module",
9
- "version": "0.2.6",
9
+ "version": "0.2.7",
10
10
  "scripts": {
11
11
  "clean": "rm -rf ./dist",
12
12
  "build": "npm run clean && cui --dep",
@@ -828,6 +828,10 @@ class CUI_FORMPILL extends HTMLElement {
828
828
  this.dValueField = document.createElement('cui-date');
829
829
  }
830
830
 
831
+ if (controls.value.validation) {
832
+ this.dValueField.setAttribute('validation', controls.value.validation);
833
+ }
834
+
831
835
  this.dValueField.setState({ 'label': `${(controls.value.fieldLabel) ? controls.value.fieldLabel : 'Value'}` })
832
836
  this.dValueField.setAttribute('value', pill._state.sValue3)
833
837
  this.dValueField.setAttribute('required', '');
@@ -848,16 +852,23 @@ class CUI_FORMPILL extends HTMLElement {
848
852
  if (controls.value.search) {
849
853
  this.dValueField.setAttribute('search', true)
850
854
  }
855
+ if (pill?._state?.sValue2) {
856
+ if (pill._state.sValue2.indexOf(',') == -1) {
857
+ this.dValueField.setAttribute('value', pill._state.sValue2)
858
+ }
859
+ else {
851
860
 
852
- if (pill._state.sValue2.indexOf(',') == -1) {
853
- this.dValueField.setAttribute('value', pill._state.sValue2)
861
+ let aValues = pill._state.sValue2.split(',');
862
+ this.dValueField.setAttribute('value', aValues)
863
+ }
854
864
  }
855
- else {
856
865
 
857
- let aValues = pill._state.sValue2.split(',');
866
+ if (pill?._state?.asValues) {
867
+ let aValues = pill._state.asValues.split(',');
858
868
  this.dValueField.setAttribute('value', aValues)
859
869
  }
860
870
 
871
+
861
872
  this.dValueField.setAttribute('required', '');
862
873
  this.dValueField.setAttribute('componentKey', 'contextHeaderValue');
863
874
  dPopoverBody.insertBefore(this.dValueField, dPopoverFooter);
@@ -876,6 +887,11 @@ class CUI_FORMPILL extends HTMLElement {
876
887
  if (controls.value.control[i].required) {
877
888
  this.field.setAttribute('required', '');
878
889
  }
890
+
891
+ if (controls.value.control[i].validation) {
892
+ this.field.setAttribute('validation', controls.value.control[i].validation)
893
+ }
894
+
879
895
  this.field.setAttribute('componentKey', controls.value.control[i].componentKey);
880
896
  dPopoverBody.insertBefore(this.field, dPopoverFooter);
881
897
  this.adFields.push(this.field);
@@ -887,6 +903,9 @@ class CUI_FORMPILL extends HTMLElement {
887
903
 
888
904
  }
889
905
  }
906
+
907
+ const customEvent = new CustomEvent('filter-change', { detail: { value: selectedItem.value, label: selectedItem.label } });
908
+ this.dispatchEvent(customEvent);
890
909
  } else {
891
910
 
892
911
 
@@ -1298,7 +1317,7 @@ class CUI_FORMPILL extends HTMLElement {
1298
1317
 
1299
1318
  if (this._state.dMenuPopover) {
1300
1319
  this._state.dMenuPopover.state.bOpen = false;
1301
- if(this._state.dMenuPopover.isConnected) {
1320
+ if (this._state.dMenuPopover.isConnected) {
1302
1321
  document.body.removeChild(this._state.dMenuPopover);
1303
1322
  }
1304
1323
  this._state.dMenuPopover = null;