@postnord/pn-marketweb-components 3.0.1 → 3.0.3

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.
Files changed (47) hide show
  1. package/cjs/pn-dropdown-choice-adds-row.cjs.entry.js +1 -1
  2. package/cjs/pn-dropdown-choice-adds-row.cjs.entry.js.map +1 -1
  3. package/cjs/pn-dropdown-with-multi-input-rows.cjs.entry.js +2 -2
  4. package/cjs/pn-dropdown-with-multi-input-rows.cjs.entry.js.map +1 -1
  5. package/cjs/pn-multi-row-connected-dropdown-row.cjs.entry.js +4 -4
  6. package/cjs/pn-multi-row-connected-dropdown-row.cjs.entry.js.map +1 -1
  7. package/cjs/pn-multi-row-connected-dropdown.cjs.entry.js +2 -2
  8. package/cjs/pn-multi-row-connected-dropdown.cjs.entry.js.map +1 -1
  9. package/collection/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.js +1 -1
  10. package/collection/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.js.map +1 -1
  11. package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.js +2 -2
  12. package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.js.map +1 -1
  13. package/collection/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown-row.js +4 -4
  14. package/collection/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown-row.js.map +1 -1
  15. package/collection/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown.js +2 -2
  16. package/collection/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown.js.map +1 -1
  17. package/components/pn-dropdown-choice-adds-row.js +1 -1
  18. package/components/pn-dropdown-choice-adds-row.js.map +1 -1
  19. package/components/pn-dropdown-with-multi-input-rows.js +2 -2
  20. package/components/pn-dropdown-with-multi-input-rows.js.map +1 -1
  21. package/components/pn-multi-row-connected-dropdown-row2.js +4 -4
  22. package/components/pn-multi-row-connected-dropdown-row2.js.map +1 -1
  23. package/components/pn-multi-row-connected-dropdown.js +2 -2
  24. package/components/pn-multi-row-connected-dropdown.js.map +1 -1
  25. package/esm/pn-dropdown-choice-adds-row.entry.js +1 -1
  26. package/esm/pn-dropdown-choice-adds-row.entry.js.map +1 -1
  27. package/esm/pn-dropdown-with-multi-input-rows.entry.js +2 -2
  28. package/esm/pn-dropdown-with-multi-input-rows.entry.js.map +1 -1
  29. package/esm/pn-multi-row-connected-dropdown-row.entry.js +4 -4
  30. package/esm/pn-multi-row-connected-dropdown-row.entry.js.map +1 -1
  31. package/esm/pn-multi-row-connected-dropdown.entry.js +2 -2
  32. package/esm/pn-multi-row-connected-dropdown.entry.js.map +1 -1
  33. package/package.json +1 -1
  34. package/pn-market-web-components/p-07253be3.entry.js +2 -0
  35. package/pn-market-web-components/{p-3847f9af.entry.js.map → p-07253be3.entry.js.map} +1 -1
  36. package/pn-market-web-components/{p-23916c49.entry.js → p-3ae1657a.entry.js} +2 -2
  37. package/pn-market-web-components/{p-23916c49.entry.js.map → p-3ae1657a.entry.js.map} +1 -1
  38. package/pn-market-web-components/p-5ff663be.entry.js +2 -0
  39. package/pn-market-web-components/p-5ff663be.entry.js.map +1 -0
  40. package/pn-market-web-components/p-af16f7e3.entry.js +2 -0
  41. package/pn-market-web-components/p-af16f7e3.entry.js.map +1 -0
  42. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  43. package/pn-market-web-components/p-00ea6211.entry.js +0 -2
  44. package/pn-market-web-components/p-00ea6211.entry.js.map +0 -1
  45. package/pn-market-web-components/p-3847f9af.entry.js +0 -2
  46. package/pn-market-web-components/p-67089fc8.entry.js +0 -2
  47. package/pn-market-web-components/p-67089fc8.entry.js.map +0 -1
@@ -93,7 +93,7 @@ const PnMultiRowConnectedDropdown$1 = /*@__PURE__*/ proxyCustomElement(class PnM
93
93
  const inputValue = { name: this._inputValueName, value: input };
94
94
  rowValue.row.push(inputValue);
95
95
  }
96
- const dates = item.dates;
96
+ const dates = item.dates["start"];
97
97
  if (dates === null || dates === void 0 ? void 0 : dates.length) {
98
98
  const datestValue = { name: this._dateValueName, value: dates };
99
99
  rowValue.row.push(datestValue);
@@ -193,7 +193,7 @@ const PnMultiRowConnectedDropdown$1 = /*@__PURE__*/ proxyCustomElement(class PnM
193
193
  }
194
194
  render() {
195
195
  var _a;
196
- return (h(Host, { key: '6837a0780ef6d2a8f538ed29724a444f3a3e8c01' }, (_a = this.rowData) === null || _a === void 0 ? void 0 :
196
+ return (h(Host, { key: '35f9a37f73fc0713405c0f403c8f8df7eff987ae' }, (_a = this.rowData) === null || _a === void 0 ? void 0 :
197
197
  _a.map((data, i) => {
198
198
  return (h("div", { class: 'generated-row-' + i, id: 'generated-row-connected-dropdown-' + i }, h("pn-multi-row-connected-dropdown-row", { "dropdown-data": this.dropdownData, "language-code": this.languageCode, label: this.label, "first-dropdown-label": this.firstDropdownLabel, "second-dropdown-label": this.secondDropdownLabel, "dropdown-placeholder": this.dropdownPlaceholder, "add-row-text": this.addRowText, "input-fild-label": this.inputFildLabel, "input-fild-placeholder": this.inputFildPlaceholder, "date-button-text": this.dateButtonText, "date-placeholder": this.datePlaceholder, "date-days-from-today": this.dateDaysFromToday, "allow-multiple-dates": this.allowMultipleDates, "start-date-label": this.startDateLabel, "end-date-label": this.endDateLabel, "multi-date-helper-text": this.multiDateHelperText, "generate-dates-button-text": this.generateDatesButtonText, "save-date-button-text": this.saveDateButtonText, "no-dates-text": this.noDatesText, index: i, "predefined-value": JSON.stringify(data), "years-to-add-to-end-date": this.yearsToAddToEndDate })));
199
199
  }), this.allowMultipleRows ? (h("div", { class: "connected-dropdown__row" }, h("pn-button", { tooltip: this.addRowText ? this.addRowText : null, "left-icon": "true", arialabel: "Add", icon: plus, appearance: "light", variant: "borderless", class: "connected-dropdown__button-right", onClick: () => {
@@ -1 +1 @@
1
- {"file":"pn-multi-row-connected-dropdown.js","mappings":";;;;;;;AAAA,MAAM,8BAA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,CAAC,IAC3E,4DACiB,IAAI,CAAC,YAAY,mBACjB,IAAI,CAAC,YAAY,EAChC,KAAK,EAAE,IAAI,CAAC,KAAK,0BACK,IAAI,CAAC,kBAAkB,2BACtB,IAAI,CAAC,mBAAmB,0BACzB,IAAI,CAAC,mBAAmB,kBAChC,IAAI,CAAC,UAAU,sBACX,IAAI,CAAC,cAAc,4BACb,IAAI,CAAC,oBAAoB,sBAC/B,IAAI,CAAC,cAAc,sBACnB,IAAI,CAAC,eAAe,0BAChB,IAAI,CAAC,iBAAiB,0BACtB,IAAI,CAAC,kBAAkB,sBAC3B,IAAI,CAAC,cAAc,oBACrB,IAAI,CAAC,YAAY,4BACT,IAAI,CAAC,mBAAmB,gCACpB,IAAI,CAAC,uBAAuB,2BACjC,IAAI,CAAC,kBAAkB,mBAC/B,IAAI,CAAC,WAAW,EAC/B,KAAK,EAAE,CAAC,sBACU,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,8BACZ,IAAI,CAAC,mBAAmB,GACb,CACnC,EACN;aACH,CAAC,EAED,IAAI,CAAC,iBAAiB,IACrB,WAAK,KAAK,EAAC,yBAAyB,IAClC,iBACE,OAAO,EAAE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,eACvC,MAAM,EAChB,SAAS,EAAC,KAAK,EACf,IAAI,EAAE,IAAI,EACV,UAAU,EAAC,OAAO,EAClB,OAAO,EAAC,YAAY,EACpB,KAAK,EAAC,kCAAkC,EACxC,OAAO,EAAE;gBACP,IAAI,CAAC,MAAM,EAAE,CAAC;aACf,IAEA,IAAI,CAAC,UAAU,CACN,CACR,IACJ,IAAI,CACH,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PnMultiRowConnectedDropdown","uuidv4"],"sources":["src/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown.scss?tag=pn-multi-row-connected-dropdown","src/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown.tsx"],"sourcesContent":["@import '../../../globals/main.scss';\n\npn-multi-row-connected-dropdown {\n gap: 1rem;\n\n .connected-dropdown {\n &__row {\n display: flex;\n align-items: flex-end;\n gap: 1rem;\n margin-bottom: 1rem;\n justify-content: space-between;\n\n &__no-margin {\n margin: 0;\n }\n }\n\n &__button-right {\n margin-left: auto;\n }\n }\n}\n","import { Component, Prop, h, Element, State, Host, Watch, Event, EventEmitter, Listen } from '@stencil/core';\nimport { FormValue, PredefinedValues, Root, RowValue, SelectItem } from './types';\nimport { v4 as uuidv4 } from 'uuid';\nimport { plus } from 'pn-design-assets/pn-assets/icons.js';\n\n@Component({\n tag: 'pn-multi-row-connected-dropdown',\n styleUrl: 'pn-multi-row-connected-dropdown.scss',\n})\nexport class PnMultiRowConnectedDropdown {\n @Element() hostElement: Element;\n\n @Prop() dropdownData: string | Root[] = null;\n @Prop() languageCode: string = null;\n @Prop() label: string = null;\n @Prop() firstDropdownLabel: string = null;\n @Prop() secondDropdownLabel: string = null;\n @Prop() dropdownPlaceholder: string = null;\n @Prop() addRowText: string = null;\n @Prop() inputFildLabel: string = null;\n @Prop() inputFildPlaceholder: string = null;\n @Prop() dateButtonText: string = null;\n @Prop() datePlaceholder: string = null;\n @Prop() dateDaysFromToday: number = null;\n @Prop() allowMultipleRows: boolean = false;\n @Prop() allowMultipleDates: boolean = false;\n @Prop() startDateLabel: string = null;\n @Prop() endDateLabel: string = null;\n @Prop() multiDateHelperText: string = null;\n @Prop() generateDatesButtonText: string = null;\n @Prop() saveDateButtonText: string = null;\n @Prop() noDatesText: string = null;\n @Prop() yearsToAddToEndDate: number = null;\n\n @State() rowCount: number = null;\n @State() rowData: PredefinedValues[] = null;\n @State() formValues: FormValue[] = null;\n\n private _buttonValueName: string = null;\n private _firstDropdownValueName: string = null;\n private _secondDropdownValueName: string = null;\n private _inputValueName: string = null;\n private _dateValueName: string = null;\n\n @Event() allFormValues: EventEmitter<string>;\n\n private _defaultRow: PredefinedValues = {\n id: this.generateUniqueId(),\n buttons: [],\n firstDropdown: [],\n secondDropdown: [],\n input: '',\n dates: '',\n dateRange: {\n days: [],\n startDate: '',\n endDate: '',\n },\n };\n\n componentWillLoad() {\n this.setDaysArr();\n this.formValues = [];\n this.rowData = [this._defaultRow];\n this.rowCount = this.rowData.length;\n\n this._buttonValueName = this.label?.length ? this.label : 'value0';\n this._firstDropdownValueName = this.firstDropdownLabel?.length ? this.firstDropdownLabel : 'value1';\n this._secondDropdownValueName = this.secondDropdownLabel?.length ? this.secondDropdownLabel : 'value2';\n this._inputValueName = this.inputFildLabel?.length ? this.inputFildLabel : 'value3';\n this._dateValueName = this.dateButtonText?.length ? this.dateButtonText : 'value4';\n }\n\n componentDidLoad() {}\n\n emittValuesIfValid() {\n this.formValues = [];\n this.rowData.forEach(item => {\n const rowValue: FormValue = { row: [] };\n\n const buttonSelection = item.buttons.find(x => x.selected === true);\n if (buttonSelection) {\n const buttonValue: RowValue = { name: this._buttonValueName, value: buttonSelection.label };\n rowValue.row.push(buttonValue);\n }\n\n const firstDropdownSelection = item.firstDropdown.find(x => x.selected === true);\n if (firstDropdownSelection) {\n const firstDropdownValue: RowValue = { name: this._firstDropdownValueName, value: firstDropdownSelection.label };\n rowValue.row.push(firstDropdownValue);\n }\n\n const secondDropdownSelection = item.secondDropdown.find(x => x.selected === true);\n if (secondDropdownSelection) {\n const secondDropdownValue: RowValue = { name: this._secondDropdownValueName, value: secondDropdownSelection.label };\n rowValue.row.push(secondDropdownValue);\n }\n\n const input = item.input;\n if (input?.length) {\n const inputValue: RowValue = { name: this._inputValueName, value: input };\n rowValue.row.push(inputValue);\n }\n\n const dates = item.dates;\n if (dates?.length) {\n const datestValue: RowValue = { name: this._dateValueName, value: dates };\n rowValue.row.push(datestValue);\n }\n\n if (rowValue.row.length === 5) {\n this.formValues.push(rowValue);\n }\n });\n\n if (this.formValues.length === this.rowData.length) {\n const valueJsonString = JSON.stringify(this.formValues);\n this.allFormValues.emit(valueJsonString);\n } else {\n this.allFormValues.emit('');\n }\n }\n\n @Listen('rowValueChange')\n predefinedValueChange(e) {\n const indexToUpdate = this.rowData.findIndex(data => data.id === e.detail.id);\n const val: PredefinedValues = e.detail;\n this.rowData[indexToUpdate] = {\n ...this.rowData[indexToUpdate],\n buttons: val.buttons,\n firstDropdown: val.firstDropdown,\n secondDropdown: val.secondDropdown,\n input: val.input,\n dates: val.dates,\n dateRange: val.dateRange,\n };\n this.emittValuesIfValid();\n }\n\n @Listen('deleteRowEvent')\n deleteRowEvent(e) {\n const indexToRemove = this.rowData.findIndex(data => data.id === e.detail);\n this.rowData.splice(indexToRemove, 1);\n this.rowData = [...this.rowData];\n this.rowCount = this.rowData.length;\n this.emittValuesIfValid();\n }\n\n generateUniqueId() {\n return uuidv4();\n }\n\n addRow() {\n const newRow = this._defaultRow;\n newRow.id = this.generateUniqueId();\n\n this.rowData = [...this.rowData, newRow];\n this.rowCount = this.rowData.length;\n }\n\n setDaysArr() {\n const language = this.languageCode.toLowerCase();\n\n switch (language) {\n case 'en':\n this._defaultRow.dateRange.days = [\n { label: 'Monday', value: '1', selected: false },\n { label: 'Tuesday', value: '2', selected: false },\n { label: 'Wednesday', value: '3', selected: false },\n { label: 'Thursday', value: '4', selected: false },\n { label: 'Friday', value: '5', selected: false },\n ];\n break;\n\n case 'sv':\n this._defaultRow.dateRange.days = [\n { label: 'Måndag', value: '1', selected: false },\n { label: 'Tisdag', value: '2', selected: false },\n { label: 'Onsdag', value: '3', selected: false },\n { label: 'Torsdag', value: '4', selected: false },\n { label: 'Fredag', value: '5', selected: false },\n ];\n break;\n\n case 'da':\n this._defaultRow.dateRange.days = [\n { label: 'Mandag', value: '1', selected: false },\n { label: 'Tirsdag', value: '2', selected: false },\n { label: 'Onsdag', value: '3', selected: false },\n { label: 'Torsdag', value: '4', selected: false },\n { label: 'Fredag', value: '5', selected: false },\n ];\n break;\n\n case 'fi':\n this._defaultRow.dateRange.days = [\n { label: 'Maanantai', value: '1', selected: false },\n { label: 'Tiistai', value: '2', selected: false },\n { label: 'Keskiviikko', value: '3', selected: false },\n { label: 'Torstai', value: '4', selected: false },\n { label: 'Perjantai', value: '5', selected: false },\n ];\n break;\n\n case 'no':\n this._defaultRow.dateRange.days = [\n { label: 'Mandag', value: '1', selected: false },\n { label: 'Tirsdag', value: '2', selected: false },\n { label: 'Onsdag', value: '3', selected: false },\n { label: 'Torsdag', value: '4', selected: false },\n { label: 'Fredag', value: '5', selected: false },\n ];\n break;\n\n default:\n this._defaultRow.dateRange.days = [\n { label: 'Monday', value: '1', selected: false },\n { label: 'Tuesday', value: '2', selected: false },\n { label: 'Wednesday', value: '3', selected: false },\n { label: 'Thursday', value: '4', selected: false },\n { label: 'Friday', value: '5', selected: false },\n ];\n break;\n }\n }\n\n render() {\n return (\n <Host>\n {this.rowData?.map((data, i) => {\n return (\n <div class={'generated-row-' + i} id={'generated-row-connected-dropdown-' + i}>\n <pn-multi-row-connected-dropdown-row\n dropdown-data={this.dropdownData}\n language-code={this.languageCode}\n label={this.label}\n first-dropdown-label={this.firstDropdownLabel}\n second-dropdown-label={this.secondDropdownLabel}\n dropdown-placeholder={this.dropdownPlaceholder}\n add-row-text={this.addRowText}\n input-fild-label={this.inputFildLabel}\n input-fild-placeholder={this.inputFildPlaceholder}\n date-button-text={this.dateButtonText}\n date-placeholder={this.datePlaceholder}\n date-days-from-today={this.dateDaysFromToday}\n allow-multiple-dates={this.allowMultipleDates}\n start-date-label={this.startDateLabel}\n end-date-label={this.endDateLabel}\n multi-date-helper-text={this.multiDateHelperText}\n generate-dates-button-text={this.generateDatesButtonText}\n save-date-button-text={this.saveDateButtonText}\n no-dates-text={this.noDatesText}\n index={i}\n predefined-value={JSON.stringify(data)}\n years-to-add-to-end-date={this.yearsToAddToEndDate}\n ></pn-multi-row-connected-dropdown-row>\n </div>\n );\n })}\n\n {this.allowMultipleRows ? (\n <div class=\"connected-dropdown__row\">\n <pn-button\n tooltip={this.addRowText ? this.addRowText : null}\n left-icon=\"true\"\n arialabel=\"Add\"\n icon={plus}\n appearance=\"light\"\n variant=\"borderless\"\n class=\"connected-dropdown__button-right\"\n onClick={() => {\n this.addRow();\n }}\n >\n {this.addRowText}\n </pn-button>\n </div>\n ) : null}\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"pn-multi-row-connected-dropdown.js","mappings":";;;;;;;AAAA,MAAM,8BAA8B,GAAG,+aAA+a,CAAC;AACvd,0CAAe,8BAA8B;;MCQhCA,6BAA2B;;;;;QA6B9B,qBAAgB,GAAW,IAAI,CAAC;QAChC,4BAAuB,GAAW,IAAI,CAAC;QACvC,6BAAwB,GAAW,IAAI,CAAC;QACxC,oBAAe,GAAW,IAAI,CAAC;QAC/B,mBAAc,GAAW,IAAI,CAAC;QAI9B,gBAAW,GAAqB;YACtC,EAAE,EAAE,IAAI,CAAC,gBAAgB,EAAE;YAC3B,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,EAAE;YACjB,cAAc,EAAE,EAAE;YAClB,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;YACT,SAAS,EAAE;gBACT,IAAI,EAAE,EAAE;gBACR,SAAS,EAAE,EAAE;gBACb,OAAO,EAAE,EAAE;aACZ;SACF,CAAC;4BA9CsC,IAAI;4BACb,IAAI;qBACX,IAAI;kCACS,IAAI;mCACH,IAAI;mCACJ,IAAI;0BACb,IAAI;8BACA,IAAI;oCACE,IAAI;8BACV,IAAI;+BACH,IAAI;iCACF,IAAI;iCACH,KAAK;kCACJ,KAAK;8BACV,IAAI;4BACN,IAAI;mCACG,IAAI;uCACA,IAAI;kCACT,IAAI;2BACX,IAAI;mCACI,IAAI;wBAEd,IAAI;uBACO,IAAI;0BACR,IAAI;;IAwBvC,iBAAiB;;QACf,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAA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E,CAAC;aACf,IAEA,IAAI,CAAC,UAAU,CACN,CACR,IACJ,IAAI,CACH,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PnMultiRowConnectedDropdown","uuidv4"],"sources":["src/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown.scss?tag=pn-multi-row-connected-dropdown","src/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown.tsx"],"sourcesContent":["@import '../../../globals/main.scss';\n\npn-multi-row-connected-dropdown {\n gap: 1rem;\n\n .connected-dropdown {\n &__row {\n display: flex;\n align-items: flex-end;\n gap: 1rem;\n margin-bottom: 1rem;\n justify-content: space-between;\n\n &__no-margin {\n margin: 0;\n }\n }\n\n &__button-right {\n margin-left: auto;\n }\n }\n}\n","import { Component, Prop, h, Element, State, Host, Watch, Event, EventEmitter, Listen } from '@stencil/core';\nimport { FormValue, PredefinedValues, Root, RowValue, SelectItem } from './types';\nimport { v4 as uuidv4 } from 'uuid';\nimport { plus } from 'pn-design-assets/pn-assets/icons.js';\n\n@Component({\n tag: 'pn-multi-row-connected-dropdown',\n styleUrl: 'pn-multi-row-connected-dropdown.scss',\n})\nexport class PnMultiRowConnectedDropdown {\n @Element() hostElement: Element;\n\n @Prop() dropdownData: string | Root[] = null;\n @Prop() languageCode: string = null;\n @Prop() label: string = null;\n @Prop() firstDropdownLabel: string = null;\n @Prop() secondDropdownLabel: string = null;\n @Prop() dropdownPlaceholder: string = null;\n @Prop() addRowText: string = null;\n @Prop() inputFildLabel: string = null;\n @Prop() inputFildPlaceholder: string = null;\n @Prop() dateButtonText: string = null;\n @Prop() datePlaceholder: string = null;\n @Prop() dateDaysFromToday: number = null;\n @Prop() allowMultipleRows: boolean = false;\n @Prop() allowMultipleDates: boolean = false;\n @Prop() startDateLabel: string = null;\n @Prop() endDateLabel: string = null;\n @Prop() multiDateHelperText: string = null;\n @Prop() generateDatesButtonText: string = null;\n @Prop() saveDateButtonText: string = null;\n @Prop() noDatesText: string = null;\n @Prop() yearsToAddToEndDate: number = null;\n\n @State() rowCount: number = null;\n @State() rowData: PredefinedValues[] = null;\n @State() formValues: FormValue[] = null;\n\n private _buttonValueName: string = null;\n private _firstDropdownValueName: string = null;\n private _secondDropdownValueName: string = null;\n private _inputValueName: string = null;\n private _dateValueName: string = null;\n\n @Event() allFormValues: EventEmitter<string>;\n\n private _defaultRow: PredefinedValues = {\n id: this.generateUniqueId(),\n buttons: [],\n firstDropdown: [],\n secondDropdown: [],\n input: '',\n dates: '',\n dateRange: {\n days: [],\n startDate: '',\n endDate: '',\n },\n };\n\n componentWillLoad() {\n this.setDaysArr();\n this.formValues = [];\n this.rowData = [this._defaultRow];\n this.rowCount = this.rowData.length;\n\n this._buttonValueName = this.label?.length ? this.label : 'value0';\n this._firstDropdownValueName = this.firstDropdownLabel?.length ? this.firstDropdownLabel : 'value1';\n this._secondDropdownValueName = this.secondDropdownLabel?.length ? this.secondDropdownLabel : 'value2';\n this._inputValueName = this.inputFildLabel?.length ? this.inputFildLabel : 'value3';\n this._dateValueName = this.dateButtonText?.length ? this.dateButtonText : 'value4';\n }\n\n componentDidLoad() {}\n\n emittValuesIfValid() {\n this.formValues = [];\n this.rowData.forEach(item => {\n const rowValue: FormValue = { row: [] };\n\n const buttonSelection = item.buttons.find(x => x.selected === true);\n if (buttonSelection) {\n const buttonValue: RowValue = { name: this._buttonValueName, value: buttonSelection.label };\n rowValue.row.push(buttonValue);\n }\n\n const firstDropdownSelection = item.firstDropdown.find(x => x.selected === true);\n if (firstDropdownSelection) {\n const firstDropdownValue: RowValue = { name: this._firstDropdownValueName, value: firstDropdownSelection.label };\n rowValue.row.push(firstDropdownValue);\n }\n\n const secondDropdownSelection = item.secondDropdown.find(x => x.selected === true);\n if (secondDropdownSelection) {\n const secondDropdownValue: RowValue = { name: this._secondDropdownValueName, value: secondDropdownSelection.label };\n rowValue.row.push(secondDropdownValue);\n }\n\n const input = item.input;\n if (input?.length) {\n const inputValue: RowValue = { name: this._inputValueName, value: input };\n rowValue.row.push(inputValue);\n }\n\n const dates = item.dates[\"start\"];\n if (dates?.length) {\n const datestValue: RowValue = { name: this._dateValueName, value: dates };\n rowValue.row.push(datestValue);\n }\n\n if (rowValue.row.length === 5) {\n this.formValues.push(rowValue);\n }\n });\n\n if (this.formValues.length === this.rowData.length) {\n const valueJsonString = JSON.stringify(this.formValues);\n this.allFormValues.emit(valueJsonString);\n } else {\n this.allFormValues.emit('');\n }\n }\n\n @Listen('rowValueChange')\n predefinedValueChange(e) {\n const indexToUpdate = this.rowData.findIndex(data => data.id === e.detail.id);\n const val: PredefinedValues = e.detail;\n this.rowData[indexToUpdate] = {\n ...this.rowData[indexToUpdate],\n buttons: val.buttons,\n firstDropdown: val.firstDropdown,\n secondDropdown: val.secondDropdown,\n input: val.input,\n dates: val.dates,\n dateRange: val.dateRange,\n };\n this.emittValuesIfValid();\n }\n\n @Listen('deleteRowEvent')\n deleteRowEvent(e) {\n const indexToRemove = this.rowData.findIndex(data => data.id === e.detail);\n this.rowData.splice(indexToRemove, 1);\n this.rowData = [...this.rowData];\n this.rowCount = this.rowData.length;\n this.emittValuesIfValid();\n }\n\n generateUniqueId() {\n return uuidv4();\n }\n\n addRow() {\n const newRow = this._defaultRow;\n newRow.id = this.generateUniqueId();\n\n this.rowData = [...this.rowData, newRow];\n this.rowCount = this.rowData.length;\n }\n\n setDaysArr() {\n const language = this.languageCode.toLowerCase();\n\n switch (language) {\n case 'en':\n this._defaultRow.dateRange.days = [\n { label: 'Monday', value: '1', selected: false },\n { label: 'Tuesday', value: '2', selected: false },\n { label: 'Wednesday', value: '3', selected: false },\n { label: 'Thursday', value: '4', selected: false },\n { label: 'Friday', value: '5', selected: false },\n ];\n break;\n\n case 'sv':\n this._defaultRow.dateRange.days = [\n { label: 'Måndag', value: '1', selected: false },\n { label: 'Tisdag', value: '2', selected: false },\n { label: 'Onsdag', value: '3', selected: false },\n { label: 'Torsdag', value: '4', selected: false },\n { label: 'Fredag', value: '5', selected: false },\n ];\n break;\n\n case 'da':\n this._defaultRow.dateRange.days = [\n { label: 'Mandag', value: '1', selected: false },\n { label: 'Tirsdag', value: '2', selected: false },\n { label: 'Onsdag', value: '3', selected: false },\n { label: 'Torsdag', value: '4', selected: false },\n { label: 'Fredag', value: '5', selected: false },\n ];\n break;\n\n case 'fi':\n this._defaultRow.dateRange.days = [\n { label: 'Maanantai', value: '1', selected: false },\n { label: 'Tiistai', value: '2', selected: false },\n { label: 'Keskiviikko', value: '3', selected: false },\n { label: 'Torstai', value: '4', selected: false },\n { label: 'Perjantai', value: '5', selected: false },\n ];\n break;\n\n case 'no':\n this._defaultRow.dateRange.days = [\n { label: 'Mandag', value: '1', selected: false },\n { label: 'Tirsdag', value: '2', selected: false },\n { label: 'Onsdag', value: '3', selected: false },\n { label: 'Torsdag', value: '4', selected: false },\n { label: 'Fredag', value: '5', selected: false },\n ];\n break;\n\n default:\n this._defaultRow.dateRange.days = [\n { label: 'Monday', value: '1', selected: false },\n { label: 'Tuesday', value: '2', selected: false },\n { label: 'Wednesday', value: '3', selected: false },\n { label: 'Thursday', value: '4', selected: false },\n { label: 'Friday', value: '5', selected: false },\n ];\n break;\n }\n }\n\n render() {\n return (\n <Host>\n {this.rowData?.map((data, i) => {\n return (\n <div class={'generated-row-' + i} id={'generated-row-connected-dropdown-' + i}>\n <pn-multi-row-connected-dropdown-row\n dropdown-data={this.dropdownData}\n language-code={this.languageCode}\n label={this.label}\n first-dropdown-label={this.firstDropdownLabel}\n second-dropdown-label={this.secondDropdownLabel}\n dropdown-placeholder={this.dropdownPlaceholder}\n add-row-text={this.addRowText}\n input-fild-label={this.inputFildLabel}\n input-fild-placeholder={this.inputFildPlaceholder}\n date-button-text={this.dateButtonText}\n date-placeholder={this.datePlaceholder}\n date-days-from-today={this.dateDaysFromToday}\n allow-multiple-dates={this.allowMultipleDates}\n start-date-label={this.startDateLabel}\n end-date-label={this.endDateLabel}\n multi-date-helper-text={this.multiDateHelperText}\n generate-dates-button-text={this.generateDatesButtonText}\n save-date-button-text={this.saveDateButtonText}\n no-dates-text={this.noDatesText}\n index={i}\n predefined-value={JSON.stringify(data)}\n years-to-add-to-end-date={this.yearsToAddToEndDate}\n ></pn-multi-row-connected-dropdown-row>\n </div>\n );\n })}\n\n {this.allowMultipleRows ? (\n <div class=\"connected-dropdown__row\">\n <pn-button\n tooltip={this.addRowText ? this.addRowText : null}\n left-icon=\"true\"\n arialabel=\"Add\"\n icon={plus}\n appearance=\"light\"\n variant=\"borderless\"\n class=\"connected-dropdown__button-right\"\n onClick={() => {\n this.addRow();\n }}\n >\n {this.addRowText}\n </pn-button>\n </div>\n ) : null}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -262,7 +262,7 @@ const pnDropdownChoiceAddsRow = class {
262
262
  }
263
263
  render() {
264
264
  var _a;
265
- return (h(Host, { key: 'e42637fdfbc059fe081da8fb8af2a2469f357d15' }, h("div", { key: 'da4240a50ed0be9b937bbcb998ca26569c1ffd8c', class: "dropdown-choice-form-row" }, h("pn-select", { key: '50b123ca0911ad5b2514f9a017291c4822c18d8f', ref: el => (this.pnRowSelectDropdown = el), name: this.addRowDropdownName, placeholder: this.addRowDropdownPlaceholder, label: this.addRowDropdownLabel, class: "pn-row-select-dropdown" }, (_a = this.rowSelectDropdownArr) === null || _a === void 0 ? void 0 : _a.map((value) => h("pn-option", { label: value, value: value })))), h("div", { key: 'b6e195a26c733ffe9583ad903e5eda128ffbd1e0', class: "dropdown-choice-form-row" }, h("table", { key: 'eb0c750c193fd5da4a54f94839eaeddb1f7b1694', class: "pn-dropdown-choice-table" }, h("thead", { key: 'a8ce41097f03c7ae58bd9cba6830b2d538820ce3', ref: el => (this.tableHead = el) }, this.nextRowIndex === 0 ? null : (h("tr", null, h("th", { class: "table-header--name" }, h("label", null, this.rowNameLabel)), this.rowHasDropdown ? (h("th", { class: "table-header--dropdown" }, h("label", null, this.rowDropdownLabel))) : null, h("th", { class: "table-header--input" }, h("label", null, this.rowInputLabel)), h("th", { class: "table-header--delete" })))), h("tbody", { key: '346f57507fb75362eeb7b09fb6862b615f027b66', ref: el => (this.tableBody = el), class: "pn-dropdown-choice-table-slot" }, h("slot", { key: '8fb5355f6352764d363ff0831363c1f1e43f576b' })), h("tfoot", { key: '70ade5bee44582042c5089eeea0fccb4ac8ac5c9' }, this.showWarning ? (h("tr", null, h("td", { colSpan: this.columnCount }, h("pn-icon", { icon: alert_exclamation_circle, small: true, color: "warning" }), h("small", { class: "dropdown-choice-error-message" }, this.inputLimitWarning)))) : null)))));
265
+ return (h(Host, { key: 'e42637fdfbc059fe081da8fb8af2a2469f357d15' }, h("div", { key: 'da4240a50ed0be9b937bbcb998ca26569c1ffd8c', class: "dropdown-choice-form-row" }, h("pn-select", { key: '7b57bbef46778d4ce63b937e80b2df10501e36c5', ref: el => (this.pnRowSelectDropdown = el), name: this.addRowDropdownName, placeholder: this.addRowDropdownPlaceholder, label: this.addRowDropdownLabel, class: "pn-row-select-dropdown", "empty-option": "true" }, (_a = this.rowSelectDropdownArr) === null || _a === void 0 ? void 0 : _a.map((value) => h("pn-option", { label: value, value: value })))), h("div", { key: 'ae290b0a39886fead6a6cf6cff9e7ff0329b0cf2', class: "dropdown-choice-form-row" }, h("table", { key: '1fac0a253d5ea42876bda4a32dd43db1223bd650', class: "pn-dropdown-choice-table" }, h("thead", { key: 'dc119ee9a215b433e480d3ace1a04fc4c093fe5a', ref: el => (this.tableHead = el) }, this.nextRowIndex === 0 ? null : (h("tr", null, h("th", { class: "table-header--name" }, h("label", null, this.rowNameLabel)), this.rowHasDropdown ? (h("th", { class: "table-header--dropdown" }, h("label", null, this.rowDropdownLabel))) : null, h("th", { class: "table-header--input" }, h("label", null, this.rowInputLabel)), h("th", { class: "table-header--delete" })))), h("tbody", { key: '334d8505ff7214e80cf26ae638134b8efedf1c6e', ref: el => (this.tableBody = el), class: "pn-dropdown-choice-table-slot" }, h("slot", { key: '40463ee8d5959bb3c2fbf10d7256883699eaf5ca' })), h("tfoot", { key: '8bc7637282d2e5656096233a7b431ae6d9961972' }, this.showWarning ? (h("tr", null, h("td", { colSpan: this.columnCount }, h("pn-icon", { icon: alert_exclamation_circle, small: true, color: "warning" }), h("small", { class: "dropdown-choice-error-message" }, this.inputLimitWarning)))) : null)))));
266
266
  }
267
267
  get hostElement() { return getElement(this); }
268
268
  static get watchers() { return {
@@ -1 +1 @@
1
- {"file":"pn-dropdown-choice-adds-row.entry.js","mappings":";;;;AAAA,MAAM,0BAA0B,GAAG,igDAAigD,CAAC;AACriD,sCAAe,0BAA0B;;MCQ5B,uBAAuB;;;;QAElC,wBAAmB,GAAgB,IAAI,CAAC;QACxC,cAAS,GAAgB,IAAI,CAAC;QAC9B,cAAS,GAAgB,IAAI,CAAC;QA2D9B,iBAAY,GAAG,CAAC;;YACd,MAAM,iBAAiB,GAAG,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;YAEhF,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC7B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,SAAS;oBACnC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;iBACzD,CAAC,CAAC;aACJ;iBAAM;gBACL,MAAM,WAAW,GAAG,MAAA,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,0CAAE,aAAa,CAAC,WAAW,CAAgB,CAAC;gBACxG,IAAI,WAAW,EAAE;oBACf,WAAW,CAAC,gBAAgB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;iBACjE;aACF;SACF,CAAC;4BArEsC,IAAI;kCACP,EAAE;yCACK,EAAE;mCACR,EAAE;4BACT,EAAE;8BACC,IAAI;gCACH,EAAE;sCACI,EAAE;6BACX,EAAE;mCACI,EAAE;+B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AAC,SAAS,GAAG,EAAiB,CAAC,EAAE,KAAK,EAAC,+BAA+B,IAC3F,8DAAa,CACP,EACR,gEACG,IAAI,CAAC,WAAW,IACf,cACE,UAAI,OAAO,EAAE,IAAI,CAAC,WAAW,IAC3B,eAAS,IAAI,EAAE,wBAAwB,EAAE,KAAK,QAAC,KAAK,EAAC,SAAS,GAAW,EACzE,aAAO,KAAK,EAAC,+BAA+B,IAAE,IAAI,CAAC,iBAAiB,CAAS,CAC1E,CACF,IACH,IAAI,CACF,CACF,CACJ,CACD,EACP;KACH;;;;;;;;;;","names":[],"sources":["src/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.scss?tag=pn-dropdown-choice-adds-row","src/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.tsx"],"sourcesContent":["@import '../../../globals/main.scss';\n\npn-dropdown-choice-adds-row {\n gap: 1rem;\n\n .dropdown-choice-form-row {\n display: flex;\n gap: 1rem;\n }\n\n .pn-row-select-dropdown {\n width: 50%;\n margin-bottom: 1rem;\n }\n\n @media only screen and (max-width: 640px) {\n .pn-row-select-dropdown {\n width: 100%;\n }\n }\n\n .pn-dropdown-choice-table {\n width: 100%;\n border-spacing: 0rem;\n\n thead {\n th {\n text-align: left;\n padding: 1rem 0.5rem;\n\n label {\n color: $gray700;\n font-size: 1.4rem;\n font-weight: 400;\n }\n }\n\n .table-header {\n &--name {\n width: 40%;\n }\n\n &--dropdown {\n width: 40%;\n }\n\n &--input {\n width: 10%;\n }\n\n &--delete {\n width: 10%;\n }\n }\n }\n\n tbody {\n td {\n padding: 0.5rem;\n }\n\n tr:nth-child(even) {\n background-color: #effbff;\n }\n\n .tr-delete {\n text-align: center;\n }\n }\n\n tfoot {\n td {\n small {\n color: $warning;\n vertical-align: middle;\n }\n\n pn-icon {\n margin-right: 0.25em;\n vertical-align: middle;\n }\n }\n }\n }\n}\n","import { Component, Prop, h, Element, State, Host, Watch, Event, EventEmitter } from '@stencil/core';\nimport { FormValue, RowValue, Root } from './types';\nimport debounce from 'debounce';\nimport { alert_exclamation_circle } from 'pn-design-assets/pn-assets/icons.js';\n\n@Component({\n tag: 'pn-dropdown-choice-adds-row',\n styleUrl: 'pn-dropdown-choice-adds-row.scss',\n})\nexport class pnDropdownChoiceAddsRow {\n @Element() hostElement: Element;\n pnRowSelectDropdown: HTMLElement = null;\n tableHead: HTMLElement = null;\n tableBody: HTMLElement = null;\n private _dropdownData: Root[];\n\n @Prop() dropdownData: string | Root[] = null;\n @Prop() addRowDropdownName: string = '';\n @Prop() addRowDropdownPlaceholder: string = '';\n @Prop() addRowDropdownLabel: string = '';\n @Prop() rowNameLabel: string = '';\n @Prop() rowHasDropdown: boolean = true;\n @Prop() rowDropdownLabel: string = '';\n @Prop() rowDropdownPlaceholder: string = '';\n @Prop() rowInputLabel: string = '';\n @Prop() rowDeleteButtonText: string = '';\n @Prop() totalInputLimit: number = 0;\n @Prop() inputLimitWarning: string = null;\n\n @State() nextRowIndex: number = null;\n @State() rowSelectDropdownArr: string[] = null;\n @State() columnCount: number = null;\n @State() showWarning: boolean = false;\n @State() formValue: string = null;\n\n @Event() rowvalues: EventEmitter<string>;\n\n @Watch('dropdownData')\n dropdownDataWatcher() {\n if (typeof this.dropdownData === 'string') {\n this._dropdownData = JSON.parse(this.dropdownData);\n } else {\n this._dropdownData = this.dropdownData;\n }\n }\n\n componentWillLoad() {\n this.dropdownDataWatcher();\n }\n\n componentDidLoad() {\n this.setInitialValues();\n this.addEventHandlers();\n }\n\n addEventHandlers() {\n this.pnRowSelectDropdown.addEventListener('selectOption', debounce(this.addRowElement.bind(this), 500));\n }\n\n setInitialValues() {\n this.nextRowIndex = 0;\n this.columnCount = this.rowHasDropdown ? 4 : 3;\n this.setRowSelectDropdownArr();\n }\n\n setRowSelectDropdownArr() {\n this.rowSelectDropdownArr = [];\n this._dropdownData.forEach(element => {\n this.rowSelectDropdownArr.push(element.label);\n });\n }\n\n formRowEvent = e => {\n const debouncedAddValue = debounce(this.updateHiddenFieldValue.bind(this), 500);\n\n if (e.target.matches('input')) {\n ['change', 'keyup'].forEach(eventName => {\n e.target.addEventListener(eventName, debouncedAddValue);\n });\n } else {\n const rowDropdown = e.target.closest('.generated-table-row')?.querySelector('pn-select') as HTMLElement;\n if (rowDropdown) {\n rowDropdown.addEventListener('selectOption', debouncedAddValue);\n }\n }\n };\n\n updateHiddenFieldValue() {\n const allRows = [...this.tableBody.querySelectorAll('tr')];\n const columnValueCount = this.rowHasDropdown ? 3 : 2;\n const formValues: FormValue[] = [];\n\n if (allRows.length) {\n allRows.forEach(elm => {\n const row: FormValue = { row: [] };\n const nameElm = elm.querySelector('.tr-name');\n const dropdownElm = elm.querySelector('.tr-dropdown');\n const inputElm = elm.querySelector('.tr-input');\n\n const nameValue: RowValue = { name: this.rowNameLabel, value: nameElm?.innerHTML };\n row.row.push(nameValue);\n\n const dropdown = dropdownElm.querySelector('.current-selection');\n if (dropdown) {\n const dropdownSelection = dropdown.textContent ?? '';\n\n if (dropdownSelection.length) {\n const dropdownValue: RowValue = {\n name: this.rowDropdownLabel,\n value: dropdownSelection,\n };\n row.row.push(dropdownValue);\n }\n }\n if (!dropdown && columnValueCount === 3) {\n const dropdownValue: RowValue = {\n name: this.rowDropdownLabel,\n value: '',\n };\n row.row.push(dropdownValue);\n }\n\n const inputValue = parseInt(inputElm.querySelector('input')?.value ?? '0');\n if (inputValue > 0) {\n const inputColumnValue: RowValue = { name: this.rowInputLabel, value: inputValue.toString() };\n row.row.push(inputColumnValue);\n }\n\n if (row.row.length === columnValueCount) {\n formValues.push(row);\n }\n });\n }\n\n if (formValues.length && formValues.length === allRows.length) {\n const valueJsonString = JSON.stringify(formValues);\n this.formValue = `PN-JSON|${valueJsonString}`;\n } else {\n this.formValue = '';\n }\n\n this.rowvalues.emit(this.formValue);\n this.checkInputTotal();\n }\n\n addRowElement() {\n const selected = this.pnRowSelectDropdown.querySelector('[aria-selected=true]');\n const selectedValue = selected?.textContent;\n const slotElm = this.tableBody;\n const newRow = document.createElement('tr');\n newRow.setAttribute('index', `${this.nextRowIndex}`);\n newRow.setAttribute('class', 'generated-table-row');\n newRow.onclick = e => this.formRowEvent(e);\n const rowNameColumn = document.createElement('td');\n rowNameColumn.setAttribute('class', 'tr-name');\n rowNameColumn.innerHTML = selectedValue;\n rowNameColumn.dataset.name = selectedValue;\n newRow.appendChild(rowNameColumn);\n\n if (this.rowHasDropdown) {\n const rowDropdownColumn = this.createDropdownColumn(selectedValue);\n newRow.appendChild(rowDropdownColumn);\n }\n\n const rowInputColumn = this.createInputColumn(selectedValue);\n newRow.appendChild(rowInputColumn);\n const deleteButton = this.createDeleteButtonColumn();\n newRow.appendChild(deleteButton);\n\n slotElm.appendChild(newRow);\n this.updateRowSelectDropdown();\n this.nextRowIndex++;\n }\n\n getCurrentRow(selectedValue: string) {\n return this.hostElement.querySelectorAll(`.tr-name[data-name='${selectedValue}'`);\n }\n\n createDropdownColumn(selectedValue: string) {\n const dropdownColumn = document.createElement('td');\n dropdownColumn.setAttribute('class', 'tr-dropdown');\n const selectedItem = this._dropdownData.find(arr => arr.label === selectedValue);\n const selectedOptionValues = [];\n const currentRow = this.getCurrentRow(selectedValue);\n\n currentRow.forEach(row => {\n selectedOptionValues.push(row.parentElement?.querySelector('.tr-dropdown [aria-selected=true]')?.textContent);\n });\n\n if (Array.isArray(selectedItem.values) && selectedItem.values.length) {\n const dropdown = document.createElement('pn-select');\n dropdown.setAttribute('name', `${selectedValue}-dropdown`);\n dropdown.setAttribute('placeholder', this.rowDropdownPlaceholder);\n\n const filtereredValues = selectedItem.values.filter(item => !selectedOptionValues?.includes(item.value));\n\n filtereredValues.forEach(childItem => {\n const childOption = document.createElement('pn-option');\n childOption.setAttribute(\"label\", childItem.label);\n childOption.setAttribute(\"value\", childItem.label)\n dropdown.appendChild(childOption);\n });\n\n dropdownColumn.appendChild(dropdown);\n }\n\n return dropdownColumn;\n }\n\n createInputColumn(selectedValue: string) {\n const inputColumn = document.createElement('td');\n inputColumn.setAttribute('class', 'tr-input');\n const inputElm = document.createElement('pn-marketweb-input');\n inputElm.setAttribute('type', 'number');\n inputElm.setAttribute('name', `${selectedValue}-input`);\n inputElm.setAttribute('placeholder', '0');\n inputColumn.appendChild(inputElm);\n return inputColumn;\n }\n\n createDeleteButtonColumn() {\n const buttonColumn = document.createElement('td');\n buttonColumn.setAttribute('class', 'tr-delete');\n const buttonElm = document.createElement('pn-button');\n buttonElm.onclick = e => this.deleteRow(e);\n buttonElm.setAttribute('appearance', 'warning');\n buttonElm.setAttribute('small', 'true');\n buttonElm.appendChild(document.createTextNode(this.rowDeleteButtonText));\n buttonColumn.appendChild(buttonElm);\n return buttonColumn;\n }\n\n updateRowSelectDropdown() {\n type Row = { rowName: string; selectedValue: string; placeholder: string };\n\n const rows: Row[] = [].map.call(this.tableBody.querySelectorAll('.tr-name'), el => {\n const dropdownColumn = el?.parentElement?.querySelector('.tr-dropdown');\n const dropdownPlaceholder = dropdownColumn?.querySelector('.pn-select-content span')?.textContent;\n const row: Row = {\n rowName: el?.innerHTML,\n selectedValue: dropdownColumn?.querySelector('[aria-selected=true]')?.textContent,\n placeholder: dropdownPlaceholder,\n };\n return row;\n });\n\n if (rows.length) {\n this.rowSelectDropdownArr = [];\n\n this._dropdownData.forEach(element => {\n const filteredRows = rows.filter(row => row.rowName === element.label);\n const mainOptionReachedMaxPossibleRows =\n (element.values.length > 0 && filteredRows.length >= element.values.length) || (element.values.length === 0 && filteredRows.length === 1);\n if (!mainOptionReachedMaxPossibleRows) {\n this.rowSelectDropdownArr.push(element.label);\n }\n });\n } else {\n this.setRowSelectDropdownArr();\n }\n\n const selectOptions = this.pnRowSelectDropdown.querySelectorAll('pn-option');\n selectOptions.forEach(elm => {\n elm.removeAttribute('selected');\n });\n\n const placeholder = this.pnRowSelectDropdown.querySelector('.pn-select-content span');\n placeholder.innerHTML = this.addRowDropdownPlaceholder;\n\n this.updateHiddenFieldValue();\n }\n\n deleteRow(e: Event) {\n e.preventDefault();\n this.nextRowIndex--;\n const targetElm = e.currentTarget as HTMLButtonElement;\n const targetRow = targetElm.closest('tr');\n targetRow.remove();\n const allRows = [...this.tableBody.querySelectorAll('tr')];\n\n allRows.map((elm, index) => {\n elm.setAttribute('index', `${index}`);\n });\n\n this.updateRowSelectDropdown();\n }\n\n checkInputTotal() {\n const allRows = this.tableBody.querySelectorAll('tr');\n\n if (this.totalInputLimit === 0 || allRows.length < 1) {\n this.showWarning = false;\n return;\n }\n\n let totalInput = 0;\n\n allRows.forEach(element => {\n const inputField = element.querySelector('pn-marketweb-input');\n if (inputField.value) {\n totalInput += parseInt(inputField.value) ?? 0;\n }\n });\n this.showWarning = totalInput > this.totalInputLimit ? true : false;\n }\n\n render() {\n return (\n <Host>\n <div class=\"dropdown-choice-form-row\">\n <pn-select\n ref={el => (this.pnRowSelectDropdown = el as HTMLElement)}\n name={this.addRowDropdownName}\n placeholder={this.addRowDropdownPlaceholder}\n label={this.addRowDropdownLabel}\n class=\"pn-row-select-dropdown\"\n >\n {this.rowSelectDropdownArr?.map((value: string) => <pn-option label={value} value={value}></pn-option>)}\n </pn-select>\n </div>\n <div class=\"dropdown-choice-form-row\">\n <table class=\"pn-dropdown-choice-table\">\n <thead ref={el => (this.tableHead = el as HTMLElement)}>\n {this.nextRowIndex === 0 ? null : (\n <tr>\n <th class=\"table-header--name\">\n <label>{this.rowNameLabel}</label>\n </th>\n {this.rowHasDropdown ? (\n <th class=\"table-header--dropdown\">\n <label>{this.rowDropdownLabel}</label>\n </th>\n ) : null}\n <th class=\"table-header--input\">\n <label>{this.rowInputLabel}</label>\n </th>\n <th class=\"table-header--delete\"></th>\n </tr>\n )}\n </thead>\n <tbody ref={el => (this.tableBody = el as HTMLElement)} class=\"pn-dropdown-choice-table-slot\">\n <slot></slot>\n </tbody>\n <tfoot>\n {this.showWarning ? (\n <tr>\n <td colSpan={this.columnCount}>\n <pn-icon icon={alert_exclamation_circle} small color=\"warning\"></pn-icon>\n <small class=\"dropdown-choice-error-message\">{this.inputLimitWarning}</small>\n </td>\n </tr>\n ) : null}\n </tfoot>\n </table>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"pn-dropdown-choice-adds-row.entry.js","mappings":";;;;AAAA,MAAM,0BAA0B,GAAG,igDAAigD,CAAC;AACriD,sCAAe,0BAA0B;;MCQ5B,uBAAuB;;;;QAElC,wBAAmB,GAAgB,IAAI,CAAC;QACxC,cAAS,GAAgB,IAAI,CAAC;QAC9B,cAAS,GAAgB,IAAI,CAAC;QA2D9B,iBAAY,GAAG,CAAC;;YACd,MAAM,iBAAiB,GAAG,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;YAEhF,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC7B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,SAAS;oBACnC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;iBACzD,CAAC,CAAC;aACJ;iBAAM;gBACL,MAAM,WAAW,GAAG,MAAA,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,0CAAE,aAAa,CAAC,WAAW,CAAgB,CAAC;gBACxG,IAAI,WAAW,EAAE;oBACf,WAAW,CAAC,gBAAgB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;iBACjE;aACF;SACF,CAAC;4BArEsC,IAAI;kCACP,EAAE;yCACK,EAAE;mCACR,EAAE;4BACT,EAAE;8BACC,IAAI;gCACH,EAAE;sCACI,EAAE;6BACX,EAAE;mCACI,EAAE;+BACN,CAAC;iCACC,IAAI;4BAER,IAAI;oCACM,IAAI;2BACf,IAAI;2BACH,KAAK;yBACR,IAAI;;IAKjC,mBAAmB;QACjB,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ,EAAE;YACzC,IAAI,CAAC,aAAa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AAI,EAAE,wBAAwB,EAAE,KAAK,QAAC,KAAK,EAAC,SAAS,GAAW,EACzE,aAAO,KAAK,EAAC,+BAA+B,IAAE,IAAI,CAAC,iBAAiB,CAAS,CAC1E,CACF,IACH,IAAI,CACF,CACF,CACJ,CACD,EACP;KACH;;;;;;;;;;","names":[],"sources":["src/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.scss?tag=pn-dropdown-choice-adds-row","src/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.tsx"],"sourcesContent":["@import '../../../globals/main.scss';\n\npn-dropdown-choice-adds-row {\n gap: 1rem;\n\n .dropdown-choice-form-row {\n display: flex;\n gap: 1rem;\n }\n\n .pn-row-select-dropdown {\n width: 50%;\n margin-bottom: 1rem;\n }\n\n @media only screen and (max-width: 640px) {\n .pn-row-select-dropdown {\n width: 100%;\n }\n }\n\n .pn-dropdown-choice-table {\n width: 100%;\n border-spacing: 0rem;\n\n thead {\n th {\n text-align: left;\n padding: 1rem 0.5rem;\n\n label {\n color: $gray700;\n font-size: 1.4rem;\n font-weight: 400;\n }\n }\n\n .table-header {\n &--name {\n width: 40%;\n }\n\n &--dropdown {\n width: 40%;\n }\n\n &--input {\n width: 10%;\n }\n\n &--delete {\n width: 10%;\n }\n }\n }\n\n tbody {\n td {\n padding: 0.5rem;\n }\n\n tr:nth-child(even) {\n background-color: #effbff;\n }\n\n .tr-delete {\n text-align: center;\n }\n }\n\n tfoot {\n td {\n small {\n color: $warning;\n vertical-align: middle;\n }\n\n pn-icon {\n margin-right: 0.25em;\n vertical-align: middle;\n }\n }\n }\n }\n}\n","import { Component, Prop, h, Element, State, Host, Watch, Event, EventEmitter } from '@stencil/core';\nimport { FormValue, RowValue, Root } from './types';\nimport debounce from 'debounce';\nimport { alert_exclamation_circle } from 'pn-design-assets/pn-assets/icons.js';\n\n@Component({\n tag: 'pn-dropdown-choice-adds-row',\n styleUrl: 'pn-dropdown-choice-adds-row.scss',\n})\nexport class pnDropdownChoiceAddsRow {\n @Element() hostElement: Element;\n pnRowSelectDropdown: HTMLElement = null;\n tableHead: HTMLElement = null;\n tableBody: HTMLElement = null;\n private _dropdownData: Root[];\n\n @Prop() dropdownData: string | Root[] = null;\n @Prop() addRowDropdownName: string = '';\n @Prop() addRowDropdownPlaceholder: string = '';\n @Prop() addRowDropdownLabel: string = '';\n @Prop() rowNameLabel: string = '';\n @Prop() rowHasDropdown: boolean = true;\n @Prop() rowDropdownLabel: string = '';\n @Prop() rowDropdownPlaceholder: string = '';\n @Prop() rowInputLabel: string = '';\n @Prop() rowDeleteButtonText: string = '';\n @Prop() totalInputLimit: number = 0;\n @Prop() inputLimitWarning: string = null;\n\n @State() nextRowIndex: number = null;\n @State() rowSelectDropdownArr: string[] = null;\n @State() columnCount: number = null;\n @State() showWarning: boolean = false;\n @State() formValue: string = null;\n\n @Event() rowvalues: EventEmitter<string>;\n\n @Watch('dropdownData')\n dropdownDataWatcher() {\n if (typeof this.dropdownData === 'string') {\n this._dropdownData = JSON.parse(this.dropdownData);\n } else {\n this._dropdownData = this.dropdownData;\n }\n }\n\n componentWillLoad() {\n this.dropdownDataWatcher();\n }\n\n componentDidLoad() {\n this.setInitialValues();\n this.addEventHandlers();\n }\n\n addEventHandlers() {\n this.pnRowSelectDropdown.addEventListener('selectOption', debounce(this.addRowElement.bind(this), 500));\n }\n\n setInitialValues() {\n this.nextRowIndex = 0;\n this.columnCount = this.rowHasDropdown ? 4 : 3;\n this.setRowSelectDropdownArr();\n }\n\n setRowSelectDropdownArr() {\n this.rowSelectDropdownArr = [];\n this._dropdownData.forEach(element => {\n this.rowSelectDropdownArr.push(element.label);\n });\n }\n\n formRowEvent = e => {\n const debouncedAddValue = debounce(this.updateHiddenFieldValue.bind(this), 500);\n\n if (e.target.matches('input')) {\n ['change', 'keyup'].forEach(eventName => {\n e.target.addEventListener(eventName, debouncedAddValue);\n });\n } else {\n const rowDropdown = e.target.closest('.generated-table-row')?.querySelector('pn-select') as HTMLElement;\n if (rowDropdown) {\n rowDropdown.addEventListener('selectOption', debouncedAddValue);\n }\n }\n };\n\n updateHiddenFieldValue() {\n const allRows = [...this.tableBody.querySelectorAll('tr')];\n const columnValueCount = this.rowHasDropdown ? 3 : 2;\n const formValues: FormValue[] = [];\n\n if (allRows.length) {\n allRows.forEach(elm => {\n const row: FormValue = { row: [] };\n const nameElm = elm.querySelector('.tr-name');\n const dropdownElm = elm.querySelector('.tr-dropdown');\n const inputElm = elm.querySelector('.tr-input');\n\n const nameValue: RowValue = { name: this.rowNameLabel, value: nameElm?.innerHTML };\n row.row.push(nameValue);\n\n const dropdown = dropdownElm.querySelector('.current-selection');\n if (dropdown) {\n const dropdownSelection = dropdown.textContent ?? '';\n\n if (dropdownSelection.length) {\n const dropdownValue: RowValue = {\n name: this.rowDropdownLabel,\n value: dropdownSelection,\n };\n row.row.push(dropdownValue);\n }\n }\n if (!dropdown && columnValueCount === 3) {\n const dropdownValue: RowValue = {\n name: this.rowDropdownLabel,\n value: '',\n };\n row.row.push(dropdownValue);\n }\n\n const inputValue = parseInt(inputElm.querySelector('input')?.value ?? '0');\n if (inputValue > 0) {\n const inputColumnValue: RowValue = { name: this.rowInputLabel, value: inputValue.toString() };\n row.row.push(inputColumnValue);\n }\n\n if (row.row.length === columnValueCount) {\n formValues.push(row);\n }\n });\n }\n\n if (formValues.length && formValues.length === allRows.length) {\n const valueJsonString = JSON.stringify(formValues);\n this.formValue = `PN-JSON|${valueJsonString}`;\n } else {\n this.formValue = '';\n }\n\n this.rowvalues.emit(this.formValue);\n this.checkInputTotal();\n }\n\n addRowElement() {\n const selected = this.pnRowSelectDropdown.querySelector('[aria-selected=true]');\n const selectedValue = selected?.textContent;\n const slotElm = this.tableBody;\n const newRow = document.createElement('tr');\n newRow.setAttribute('index', `${this.nextRowIndex}`);\n newRow.setAttribute('class', 'generated-table-row');\n newRow.onclick = e => this.formRowEvent(e);\n const rowNameColumn = document.createElement('td');\n rowNameColumn.setAttribute('class', 'tr-name');\n rowNameColumn.innerHTML = selectedValue;\n rowNameColumn.dataset.name = selectedValue;\n newRow.appendChild(rowNameColumn);\n\n if (this.rowHasDropdown) {\n const rowDropdownColumn = this.createDropdownColumn(selectedValue);\n newRow.appendChild(rowDropdownColumn);\n }\n\n const rowInputColumn = this.createInputColumn(selectedValue);\n newRow.appendChild(rowInputColumn);\n const deleteButton = this.createDeleteButtonColumn();\n newRow.appendChild(deleteButton);\n\n slotElm.appendChild(newRow);\n this.updateRowSelectDropdown();\n this.nextRowIndex++;\n }\n\n getCurrentRow(selectedValue: string) {\n return this.hostElement.querySelectorAll(`.tr-name[data-name='${selectedValue}'`);\n }\n\n createDropdownColumn(selectedValue: string) {\n const dropdownColumn = document.createElement('td');\n dropdownColumn.setAttribute('class', 'tr-dropdown');\n const selectedItem = this._dropdownData.find(arr => arr.label === selectedValue);\n const selectedOptionValues = [];\n const currentRow = this.getCurrentRow(selectedValue);\n\n currentRow.forEach(row => {\n selectedOptionValues.push(row.parentElement?.querySelector('.tr-dropdown [aria-selected=true]')?.textContent);\n });\n\n if (Array.isArray(selectedItem.values) && selectedItem.values.length) {\n const dropdown = document.createElement('pn-select');\n dropdown.setAttribute('name', `${selectedValue}-dropdown`);\n dropdown.setAttribute('placeholder', this.rowDropdownPlaceholder);\n\n const filtereredValues = selectedItem.values.filter(item => !selectedOptionValues?.includes(item.value));\n\n filtereredValues.forEach(childItem => {\n const childOption = document.createElement('pn-option');\n childOption.setAttribute(\"label\", childItem.label);\n childOption.setAttribute(\"value\", childItem.label)\n dropdown.appendChild(childOption);\n });\n\n dropdownColumn.appendChild(dropdown);\n }\n\n return dropdownColumn;\n }\n\n createInputColumn(selectedValue: string) {\n const inputColumn = document.createElement('td');\n inputColumn.setAttribute('class', 'tr-input');\n const inputElm = document.createElement('pn-marketweb-input');\n inputElm.setAttribute('type', 'number');\n inputElm.setAttribute('name', `${selectedValue}-input`);\n inputElm.setAttribute('placeholder', '0');\n inputColumn.appendChild(inputElm);\n return inputColumn;\n }\n\n createDeleteButtonColumn() {\n const buttonColumn = document.createElement('td');\n buttonColumn.setAttribute('class', 'tr-delete');\n const buttonElm = document.createElement('pn-button');\n buttonElm.onclick = e => this.deleteRow(e);\n buttonElm.setAttribute('appearance', 'warning');\n buttonElm.setAttribute('small', 'true');\n buttonElm.appendChild(document.createTextNode(this.rowDeleteButtonText));\n buttonColumn.appendChild(buttonElm);\n return buttonColumn;\n }\n\n updateRowSelectDropdown() {\n type Row = { rowName: string; selectedValue: string; placeholder: string };\n\n const rows: Row[] = [].map.call(this.tableBody.querySelectorAll('.tr-name'), el => {\n const dropdownColumn = el?.parentElement?.querySelector('.tr-dropdown');\n const dropdownPlaceholder = dropdownColumn?.querySelector('.pn-select-content span')?.textContent;\n const row: Row = {\n rowName: el?.innerHTML,\n selectedValue: dropdownColumn?.querySelector('[aria-selected=true]')?.textContent,\n placeholder: dropdownPlaceholder,\n };\n return row;\n });\n\n if (rows.length) {\n this.rowSelectDropdownArr = [];\n\n this._dropdownData.forEach(element => {\n const filteredRows = rows.filter(row => row.rowName === element.label);\n const mainOptionReachedMaxPossibleRows =\n (element.values.length > 0 && filteredRows.length >= element.values.length) || (element.values.length === 0 && filteredRows.length === 1);\n if (!mainOptionReachedMaxPossibleRows) {\n this.rowSelectDropdownArr.push(element.label);\n }\n });\n } else {\n this.setRowSelectDropdownArr();\n }\n\n const selectOptions = this.pnRowSelectDropdown.querySelectorAll('pn-option');\n selectOptions.forEach(elm => {\n elm.removeAttribute('selected');\n });\n\n const placeholder = this.pnRowSelectDropdown.querySelector('.pn-select-content span');\n placeholder.innerHTML = this.addRowDropdownPlaceholder;\n\n this.updateHiddenFieldValue();\n }\n\n deleteRow(e: Event) {\n e.preventDefault();\n this.nextRowIndex--;\n const targetElm = e.currentTarget as HTMLButtonElement;\n const targetRow = targetElm.closest('tr');\n targetRow.remove();\n const allRows = [...this.tableBody.querySelectorAll('tr')];\n\n allRows.map((elm, index) => {\n elm.setAttribute('index', `${index}`);\n });\n\n this.updateRowSelectDropdown();\n }\n\n checkInputTotal() {\n const allRows = this.tableBody.querySelectorAll('tr');\n\n if (this.totalInputLimit === 0 || allRows.length < 1) {\n this.showWarning = false;\n return;\n }\n\n let totalInput = 0;\n\n allRows.forEach(element => {\n const inputField = element.querySelector('pn-marketweb-input');\n if (inputField.value) {\n totalInput += parseInt(inputField.value) ?? 0;\n }\n });\n this.showWarning = totalInput > this.totalInputLimit ? true : false;\n }\n\n render() {\n return (\n <Host>\n <div class=\"dropdown-choice-form-row\">\n <pn-select\n ref={el => (this.pnRowSelectDropdown = el as HTMLElement)}\n name={this.addRowDropdownName}\n placeholder={this.addRowDropdownPlaceholder}\n label={this.addRowDropdownLabel}\n class=\"pn-row-select-dropdown\"\n empty-option=\"true\"\n >\n {this.rowSelectDropdownArr?.map((value: string) => <pn-option label={value} value={value}></pn-option>)}\n </pn-select>\n </div>\n <div class=\"dropdown-choice-form-row\">\n <table class=\"pn-dropdown-choice-table\">\n <thead ref={el => (this.tableHead = el as HTMLElement)}>\n {this.nextRowIndex === 0 ? null : (\n <tr>\n <th class=\"table-header--name\">\n <label>{this.rowNameLabel}</label>\n </th>\n {this.rowHasDropdown ? (\n <th class=\"table-header--dropdown\">\n <label>{this.rowDropdownLabel}</label>\n </th>\n ) : null}\n <th class=\"table-header--input\">\n <label>{this.rowInputLabel}</label>\n </th>\n <th class=\"table-header--delete\"></th>\n </tr>\n )}\n </thead>\n <tbody ref={el => (this.tableBody = el as HTMLElement)} class=\"pn-dropdown-choice-table-slot\">\n <slot></slot>\n </tbody>\n <tfoot>\n {this.showWarning ? (\n <tr>\n <td colSpan={this.columnCount}>\n <pn-icon icon={alert_exclamation_circle} small color=\"warning\"></pn-icon>\n <small class=\"dropdown-choice-error-message\">{this.inputLimitWarning}</small>\n </td>\n </tr>\n ) : null}\n </tfoot>\n </table>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -293,10 +293,10 @@ const PnDropdownWithMultiInputRows = class {
293
293
  }
294
294
  render() {
295
295
  var _a, _b, _c, _d, _e, _f;
296
- return (h(Host, { key: 'db917d14641b4a13e6ed4d3a56f4b9ea52a8e0c1', class: "dropdown-with-multi-input-elemet" }, h("div", { key: 'bdc73044cdb1e6a791b9965086971ecbb796719d', class: "dropdown-with-multi-input-elemet__row" }, h("div", { key: 'b605ca3179d5884577c78abddf1b9a572a78b927' }, h("pn-select", { key: '818b8536fd1a059ea6d44224bb31d4d21c79f2e2', ref: el => (this.pnFirstDropdown = el), class: "pn-row-select-dropdown dropDown1-dropdown", label: this.firstDropdownLabel }, (_a = this.dropdownDataRoot) === null || _a === void 0 ? void 0 : _a.map((item, i) => (h("pn-option", { index: i, label: item.value, value: item.value, selected: item.checked, onClick: debounce(this.handleFirstDropdown.bind(this), 500) })))), ((_b = this.firstDropdownHelperText) === null || _b === void 0 ? void 0 : _b.length) ? h("small", null, this.firstDropdownHelperText) : null)), h("div", { key: 'dfa4ebccb31ec721055b6dfdecfc57fa992d6f3d', class: "dropdown-with-multi-input-elemet__row" }, h("div", { key: '87942020905eec4fb90a6692403714a7ef1d45b5' }, h("pn-select", { key: '4b05026897de69f086500034584c37507a560a25', ref: el => (this.pnSecondDropdown = el), class: "pn-row-select-dropdown dropDown2-dropdown", label: this.secondDropdownLabel }, (_c = this.secondDropdownArr) === null || _c === void 0 ? void 0 : _c.map((item, i) => (h("pn-option", { index: i, label: item, value: item, selected: item === this._secondDropdownSelection, onClick: debounce(this.handleSecondDropdown.bind(this), 500) })))), ((_d = this.secondDropdownHelperText) === null || _d === void 0 ? void 0 : _d.length) ? h("small", null, this.secondDropdownHelperText) : null)), this.showDelteConfirm ? (h("div", { class: "dropdown-with-multi-input-elemet__delete" }, h("p", null, this.deleteMultipleRowsWarningText), h("pn-button", { ref: el => (this.pnConfirmDeleteButton = el), small: "true", appearance: "warning", onClick: this.deleteExcessRows.bind(this) }, this.confirmDeleteButtonText), h("pn-button", { ref: el => (this.pnAbortDeleteButton = el), small: "true", appearance: "light", onClick: this.abortDeleteRows.bind(this) }, this.abortDeleteButtonText))) : null, h("div", { key: '2d5ffd243be28f35df836a5ef325a65787bb4133', class: "dropdown-with-multi-input-elemet__label-row" }, h("div", { key: '6295be221f848b81ecfcb9c1dc0d892aa7224f16', class: "dropdown-with-multi-input-elemet__label" }, h("label", { key: '9e26cd6e52a2b12d3efde90f8872b8f7ca0a6cca' }, this.fristInputLabel)), h("div", { key: '4c54bebdb5d534e6746925acf78912fc8fa8a940', class: "dropdown-with-multi-input-elemet__label" }, h("label", { key: '186394e29d44e7e3b291538a48a6b4d1d5a2b791' }, this.secondInputLabel)), h("div", { key: '13505b00fba6657e96ad5e0f734a41d64a42883a', class: "dropdown-with-multi-input-elemet__label" }, h("label", { key: '052ad00b40d8d4e324d9a7deed9a59b4d6b5bd8d' }, this.dateLabel))), (_e = this.rowData) === null || _e === void 0 ? void 0 :
296
+ return (h(Host, { key: 'db917d14641b4a13e6ed4d3a56f4b9ea52a8e0c1', class: "dropdown-with-multi-input-elemet" }, h("div", { key: 'bdc73044cdb1e6a791b9965086971ecbb796719d', class: "dropdown-with-multi-input-elemet__row" }, h("div", { key: 'b605ca3179d5884577c78abddf1b9a572a78b927' }, h("pn-select", { key: 'fd3a84a88a5fb2eb1cae9288b2750f495d10f75d', ref: el => (this.pnFirstDropdown = el), class: "pn-row-select-dropdown dropDown1-dropdown", label: this.firstDropdownLabel, "empty-option": "true" }, (_a = this.dropdownDataRoot) === null || _a === void 0 ? void 0 : _a.map((item, i) => (h("pn-option", { index: i, label: item.value, value: item.value, selected: item.checked, onClick: debounce(this.handleFirstDropdown.bind(this), 500) })))), ((_b = this.firstDropdownHelperText) === null || _b === void 0 ? void 0 : _b.length) ? h("small", null, this.firstDropdownHelperText) : null)), h("div", { key: '8b44e50e1460925caec54bd4013ee38420d66761', class: "dropdown-with-multi-input-elemet__row" }, h("div", { key: '5a0c06493c7a1176f0a98df2742766d876b2c605' }, h("pn-select", { key: '7bcd69a360ef76ff93f610fe8f8d3a2346838538', ref: el => (this.pnSecondDropdown = el), class: "pn-row-select-dropdown dropDown2-dropdown", label: this.secondDropdownLabel, "empty-option": "true" }, (_c = this.secondDropdownArr) === null || _c === void 0 ? void 0 : _c.map((item, i) => (h("pn-option", { index: i, label: item, value: item, selected: item === this._secondDropdownSelection, onClick: debounce(this.handleSecondDropdown.bind(this), 500) })))), ((_d = this.secondDropdownHelperText) === null || _d === void 0 ? void 0 : _d.length) ? h("small", null, this.secondDropdownHelperText) : null)), this.showDelteConfirm ? (h("div", { class: "dropdown-with-multi-input-elemet__delete" }, h("p", null, this.deleteMultipleRowsWarningText), h("pn-button", { ref: el => (this.pnConfirmDeleteButton = el), small: "true", appearance: "warning", onClick: this.deleteExcessRows.bind(this) }, this.confirmDeleteButtonText), h("pn-button", { ref: el => (this.pnAbortDeleteButton = el), small: "true", appearance: "light", onClick: this.abortDeleteRows.bind(this) }, this.abortDeleteButtonText))) : null, h("div", { key: '442d4cb2e1929663d3c684ae2b8144354d6c1ca3', class: "dropdown-with-multi-input-elemet__label-row" }, h("div", { key: '67ea3ffdd6145f4f54196c2d4661f44172ca862b', class: "dropdown-with-multi-input-elemet__label" }, h("label", { key: '5f67d7f607818ef0734da82ec2319ff09a6e22aa' }, this.fristInputLabel)), h("div", { key: '191274165ed68bc8d15192e1bae9fe0b51cfabfa', class: "dropdown-with-multi-input-elemet__label" }, h("label", { key: '03b4feed9670e23d437c180be328638a6818d683' }, this.secondInputLabel)), h("div", { key: '0ada8f9bb65f5328243b284717dd237a624a15bd', class: "dropdown-with-multi-input-elemet__label" }, h("label", { key: 'bb453907c1d3ede20e707799b194826fbbeffa71' }, this.dateLabel))), (_e = this.rowData) === null || _e === void 0 ? void 0 :
297
297
  _e.map((data, i) => {
298
298
  return (h("div", { class: 'dropdown-with-multi-input-elemet__row generated-row-' + i, id: 'generated-row-' + i }, h("pn-dropdown-with-multi-input-rows-row", { "language-code": this.languageCode, "frist-input-placeholder": this.fristInputPlaceholder, "first-input-min": this.firstInputMin, "first-input-max": this.firstInputMax, "first-input-warning": this.firstInputWarning, "first-input-warning-text": this.firstInputWarningText, "first-input-low-error-text": this.firstInputLowErrorText, "first-input-high-error-text": this.firstInputHighErrorText, "second-input-placeholder": this.secondInputPlaceholder, "second-input-min": this.secondInputMin, "second-input-max": this.secondInputMax, "second-input-warning": this.secondInputWarning, "second-input-warning-text": this.secondInputWarningText, "second-input-low-error-text": this.secondInputLowErrorText, "second-input-high-error-text": this.secondInputHighErrorText, datePlaceholder: this.datePlaceholder, firstValidDate: this.firstValidDateString, lastValidDate: this.lastValidDateString, "predefined-value": JSON.stringify(data), "min-row-count": this.minRowCount, "row-index": i })));
299
- }), h("div", { key: '43f0c4f85f3196b317d8741569954147837773cf', class: "dropdown-with-multi-input-elemet__row sum-row" }, h("pn-marketweb-input", { key: '6323b30bdf7cab36db4a484f079b2abe06c0d349', disabled: true, ref: el => (this.pnSumField = el), type: "number", value: this.rowSum, label: this.sumFieldLabel }), h("pn-button", { key: '6a2338b2e3c553aa51a41bb456b440a70f9e59f0', tooltip: this.addRowText ? this.addRowText : null, "left-icon": "true", arialabel: "Add", icon: plus, appearance: "light", variant: "borderless", class: "connected-dropdown__button-right", onClick: () => {
299
+ }), h("div", { key: 'f82a77eb8e120440084210f5cdec604a5dd05172', class: "dropdown-with-multi-input-elemet__row sum-row" }, h("pn-marketweb-input", { key: '8197ba89d43c00fa04bd81c33a5e36dbca40b255', disabled: true, ref: el => (this.pnSumField = el), type: "number", value: this.rowSum, label: this.sumFieldLabel }), h("pn-button", { key: '6c11671b82b65dbf541d2b85c5dc79f437a62d67', tooltip: this.addRowText ? this.addRowText : null, "left-icon": "true", arialabel: "Add", icon: plus, appearance: "light", variant: "borderless", class: "connected-dropdown__button-right", onClick: () => {
300
300
  this.addRow(this.generateUniqueId());
301
301
  } }, this.addRowText)), ((_f = this.elementHelperText) === null || _f === void 0 ? void 0 : _f.length) ? h("div", { class: "dropdown-with-multi-input-elemet__row" }, this.elementHelperText) : null));
302
302
  }
@@ -1 +1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AAC;aACtC,IAEA,IAAI,CAAC,UAAU,CACN,CACR,EAEL,CAAA,MAAA,IAAI,CAAC,iBAAiB,0CAAE,MAAM,IAAG,WAAK,KAAK,EAAC,uCAAuC,IAAE,IAAI,CAAC,iBAAiB,CAAO,GAAG,IAAI,CACrH,EACP;KACH;;;;;;;","names":["uuidv4"],"sources":["src/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.scss?tag=pn-dropdown-with-multi-input-rows","src/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.tsx"],"sourcesContent":["@import '../../../globals/main.scss';\n\npn-dropdown-with-multi-input-rows {\n .dropdown-with-multi-input-elemet {\n &__row {\n margin-bottom: 1rem;\n }\n\n &__delete {\n display: flex;\n gap: 1rem;\n margin-bottom: 1rem;\n padding: 1rem;\n background-color: $gray25;\n\n pn-button {\n margin-top: 0.9rem;\n }\n }\n\n &__label-row {\n display: flex;\n gap: 1rem;\n }\n\n &__label {\n width: 30%;\n font-size: 0.875em;\n color: #5e554a;\n }\n }\n\n .sum-row {\n display: flex;\n justify-content: space-between;\n }\n}\n","import { Component, Prop, h, Element, State, Host, Watch, Event, EventEmitter, Listen } from '@stencil/core';\nimport { FormValue, RowValue, Root, PredefinedValues } from './types';\nimport { v4 as uuidv4 } from 'uuid';\nimport debounce from 'debounce';\nimport { plus } from 'pn-design-assets/pn-assets/icons.js';\n\n@Component({\n tag: 'pn-dropdown-with-multi-input-rows',\n styleUrl: 'pn-dropdown-with-multi-input-rows.scss',\n})\nexport class PnDropdownWithMultiInputRows {\n @Element() hostElement: Element;\n pnFirstDropdown: HTMLElement = null;\n pnSecondDropdown: HTMLElement = null;\n pnSumField: HTMLElement = null;\n pnConfirmDeleteButton: HTMLElement = null;\n pnAbortDeleteButton: HTMLElement = null;\n\n @Prop() dropdownData: string | Root[] = null;\n @Prop() languageCode: string = null;\n @Prop() firstDropdownLabel: string = null;\n @Prop() firstDropdownHelperText: string = null;\n @Prop() secondDropdownLabel: string = null;\n @Prop() secondDropdownHelperText: string = null;\n @Prop() secondDropdownMax: number = null;\n @Prop() deleteMultipleRowsWarningText: string = null;\n @Prop() confirmDeleteButtonText: string = null;\n @Prop() abortDeleteButtonText: string = null;\n @Prop() fristInputLabel: string = null;\n @Prop() fristInputPlaceholder: string = null;\n @Prop() firstInputMin: number = null;\n @Prop() firstInputMax: number = null;\n @Prop() firstInputWarning: number = null;\n @Prop() firstInputWarningText: string = null;\n @Prop() firstInputLowErrorText: string = null;\n @Prop() firstInputHighErrorText: string = null;\n @Prop() secondInputLabel: string = null;\n @Prop() secondInputPlaceholder: string = null;\n @Prop() secondInputMin: number = null;\n @Prop() secondInputMax: number = null;\n @Prop() secondInputWarning: number = null;\n @Prop() secondInputWarningText: string = null;\n @Prop() secondInputLowErrorText: string = null;\n @Prop() secondInputHighErrorText: string = null;\n @Prop() dateLabel: string = null;\n @Prop() datePlaceholder: string = null;\n @Prop() dateDaysFromToday: number = 1;\n @Prop() yearsToAddToEndDate: number = null;\n @Prop() sumFieldLabel: string = null;\n @Prop() addRowText: string = null;\n @Prop() elementHelperText: string = null;\n\n @State() dropdownDataRoot: Root[] = null;\n @State() secondDropdownArr: number[] = [];\n @State() rowCount: number = null;\n @State() rowData: PredefinedValues[] = null;\n @State() formValues: FormValue[] = null;\n @State() firstValidDateString: string = '';\n @State() lastValidDateString: string = '';\n @State() rowSum: string = null;\n @State() minRowCount: number = null;\n @State() showDelteConfirm: boolean = false;\n\n @Event() allFormValues: EventEmitter<string>;\n\n private _firstDropdownSelection: string = null;\n private _secondDropdownSelection: number = null;\n\n private _defaultRow: PredefinedValues = {\n id: this.generateUniqueId(),\n firstInput: '',\n secondInput: this.secondInputWarning.toString(),\n date: '',\n };\n\n componentWillLoad() {\n this.formValues = [];\n this.setDropDownData();\n this.updateSecondDropdown();\n this.setRowData();\n this.setFirstValidDate();\n }\n\n componentDidLoad() {\n this.updateSum();\n }\n\n setDropDownData() {\n if (typeof this.dropdownData === 'string') {\n this.dropdownDataRoot = JSON.parse(this.dropdownData);\n } else {\n this.dropdownDataRoot = this.dropdownData;\n }\n\n if (this.dropdownDataRoot?.length) {\n this.dropdownDataRoot.forEach(element => {\n if (!element.value) {\n element.value = 0;\n }\n });\n }\n\n if (this.dropdownDataRoot.length > 0) {\n this.dropdownDataRoot[0].checked = true;\n this._firstDropdownSelection = this.dropdownDataRoot[0].label;\n this._secondDropdownSelection = this.dropdownDataRoot[0].value;\n this.minRowCount = this.dropdownDataRoot[0].value;\n }\n }\n\n updateSecondDropdown() {\n const selectedItem = this.dropdownDataRoot.find(arr => arr.checked === true);\n this.secondDropdownArr = [];\n\n for (let index = selectedItem.value; index <= this.secondDropdownMax; index++) {\n this.secondDropdownArr.push(index);\n }\n }\n\n updateSelectItemArr(arr: Root[], caption: string) {\n arr.forEach(item => {\n if (item.label === caption) {\n item.checked = !item.checked;\n } else {\n item.checked = false;\n }\n });\n return arr;\n }\n\n setRowData() {\n this.rowData = [];\n for (let index = 0; index < this._secondDropdownSelection; index++) {\n const row = Object.assign({}, this._defaultRow);\n row.id = this.generateUniqueId();\n this.rowData = [...this.rowData, row];\n }\n\n this.rowCount = this.rowData.length;\n }\n\n generateUniqueId() {\n return uuidv4();\n }\n\n setFirstValidDate() {\n const yearsToadd = this.yearsToAddToEndDate ? this.yearsToAddToEndDate : 2;\n const date = new Date();\n date.setDate(date.getDate() + this.dateDaysFromToday ?? 0);\n\n const year = date.getFullYear();\n const month = (date.getMonth() + 1).toString().padStart(2, '0');\n const day = date.getDate().toString().padStart(2, '0');\n const endYear = year + yearsToadd;\n\n this.firstValidDateString = `${year.toString()}-${month}-${day}`;\n this.lastValidDateString = `${endYear.toString()}-${month}-${day}`;\n }\n\n addRow(newRowId: string) {\n const newRow = Object.assign({}, this.rowData[0]);\n newRow.id = newRowId ? newRowId : this.generateUniqueId();\n newRow.date = '';\n this.rowData = [...this.rowData, newRow];\n this.rowCount = this.rowData.length;\n\n this._secondDropdownSelection = this.rowCount;\n this.secondDropdownArr = [...this.secondDropdownArr];\n this.updateSum();\n this.emitValuesIfValid();\n }\n\n handleFirstDropdown() {\n const selected = this.pnFirstDropdown.querySelector('[aria-selected=true]');\n const selectedValue = selected?.textContent;\n if (!selectedValue?.length) {\n return;\n }\n\n this.dropdownDataRoot.forEach(element => {\n element.checked = false;\n });\n\n const selectionRoot = this.dropdownDataRoot.find(x => x.label === selectedValue);\n selectionRoot.checked = true;\n this._firstDropdownSelection = selectionRoot.label;\n this.minRowCount = selectionRoot.value;\n\n if (selectionRoot.value > this._secondDropdownSelection) {\n this.dropdownDataRoot = [...this.dropdownDataRoot];\n\n for (let index = this.rowCount; index < selectionRoot.value; index++) {\n this.addRow(this.generateUniqueId());\n }\n }\n\n this.updateSecondDropdown();\n this.updateSum();\n this.emitValuesIfValid();\n }\n\n handleSecondDropdown() {\n const selected = this.pnSecondDropdown.querySelector('[aria-selected=true]');\n const selectedValue = selected?.textContent;\n if (!selectedValue?.length) {\n return;\n }\n\n const value = parseInt(selectedValue);\n if (value < this._secondDropdownSelection) {\n this.showDelteConfirm = true;\n } else {\n for (let index = this.rowCount; index < value; index++) {\n this.addRow(this.generateUniqueId());\n }\n }\n this.updateSum();\n this.emitValuesIfValid();\n }\n\n @Listen('rowValueChange')\n @Listen('firstInputChange')\n @Listen('secondInputChange')\n predefinedValueChange(e) {\n const indexToUpdate = this.rowData.findIndex(data => data.id === e.detail.id);\n const val: PredefinedValues = e.detail;\n this.rowData[indexToUpdate] = {\n ...this.rowData[indexToUpdate],\n firstInput: val.firstInput,\n secondInput: val.secondInput,\n date: val.date,\n };\n\n if (e.type === 'firstInputChange' && indexToUpdate === 0) {\n this.updateFirstInputOfRows(val.firstInput);\n }\n\n if (e.type === 'secondInputChange' && indexToUpdate === 0) {\n this.updateSecondInputOfRows(val.secondInput);\n }\n\n this.rowData = [...this.rowData];\n this.emitValuesIfValid();\n this.updateSum();\n }\n\n updateFirstInputOfRows(value: string) {\n for (let index = 1; index < this.rowCount; index++) {\n this.rowData[index] = {\n ...this.rowData[index],\n firstInput: value,\n };\n }\n }\n\n updateSecondInputOfRows(value: string) {\n for (let index = 1; index < this.rowCount; index++) {\n this.rowData[index] = {\n ...this.rowData[index],\n secondInput: value,\n };\n }\n }\n\n @Listen('deleteRowEvent')\n deleteRowEvent(e) {\n const indexToRemove = this.rowData.findIndex(data => data.id === e.detail);\n if (indexToRemove < 0) {\n return;\n }\n\n this.rowData.splice(indexToRemove, 1);\n this.rowData = [...this.rowData];\n this.rowCount = this.rowData.length;\n\n this._secondDropdownSelection = this.rowCount;\n this.secondDropdownArr = [...this.secondDropdownArr];\n this.emitValuesIfValid();\n this.updateSum();\n }\n\n updateSum() {\n this.rowSum = '';\n let sum = 0;\n this.rowData.forEach(element => {\n if (element?.firstInput?.length) {\n sum += parseInt(element.firstInput);\n }\n });\n\n this.rowSum = sum.toString();\n }\n\n deleteExcessRows() {\n const selected = this.pnSecondDropdown.querySelector('[aria-selected=true]');\n const selectedValue = selected?.textContent;\n if (!selectedValue?.length) {\n return;\n }\n const rowsToDelete = this.rowCount - parseInt(selectedValue);\n for (let index = 0; index < rowsToDelete; index++) {\n this.rowData.pop();\n }\n this.rowData = [...this.rowData];\n this.showDelteConfirm = false;\n this.updateSum();\n }\n\n abortDeleteRows() {\n this.showDelteConfirm = false;\n }\n\n emitValuesIfValid() {\n this.formValues = [];\n this.rowData.forEach(item => {\n const rowValue: FormValue = { row: [] };\n\n if (this._firstDropdownSelection?.length) {\n const dropDownValue: RowValue = { name: this.firstDropdownLabel, value: this._firstDropdownSelection };\n rowValue.row.push(dropDownValue);\n }\n\n if (item.firstInput?.length) {\n const firstInputValue: RowValue = { name: this.fristInputLabel, value: item.firstInput };\n rowValue.row.push(firstInputValue);\n }\n\n if (item.secondInput?.length) {\n const secondInputValue: RowValue = { name: this.secondInputLabel, value: item.secondInput };\n rowValue.row.push(secondInputValue);\n }\n\n if (item.date?.length) {\n const dateValue: RowValue = { name: this.dateLabel, value: item.date };\n rowValue.row.push(dateValue);\n }\n\n if (rowValue.row.length === 4) {\n this.formValues.push(rowValue);\n }\n });\n\n if (this.formValues.length === this.rowData.length) {\n const valueJsonString = JSON.stringify(this.formValues);\n this.allFormValues.emit(valueJsonString);\n } else {\n this.allFormValues.emit('');\n }\n }\n\n render() {\n return (\n <Host class=\"dropdown-with-multi-input-elemet\">\n <div class=\"dropdown-with-multi-input-elemet__row\">\n <div>\n <pn-select ref={el => (this.pnFirstDropdown = el as HTMLElement)} class=\"pn-row-select-dropdown dropDown1-dropdown\" label={this.firstDropdownLabel}>\n {this.dropdownDataRoot?.map((item, i) => (\n <pn-option index={i} label={item.value} value={item.value} selected={item.checked} onClick={debounce(this.handleFirstDropdown.bind(this), 500)}></pn-option>\n ))}\n </pn-select>\n {this.firstDropdownHelperText?.length ? <small>{this.firstDropdownHelperText}</small> : null}\n </div>\n </div>\n\n <div class=\"dropdown-with-multi-input-elemet__row\">\n <div>\n <pn-select ref={el => (this.pnSecondDropdown = el as HTMLElement)} class=\"pn-row-select-dropdown dropDown2-dropdown\" label={this.secondDropdownLabel}>\n {this.secondDropdownArr?.map((item, i) => (\n <pn-option index={i} label={item} value={item} selected={item === this._secondDropdownSelection} onClick={debounce(this.handleSecondDropdown.bind(this), 500)}></pn-option>\n ))}\n </pn-select>\n {this.secondDropdownHelperText?.length ? <small>{this.secondDropdownHelperText}</small> : null}\n </div>\n </div>\n\n {this.showDelteConfirm ? (\n <div class=\"dropdown-with-multi-input-elemet__delete\">\n <p>{this.deleteMultipleRowsWarningText}</p>\n <pn-button ref={el => (this.pnConfirmDeleteButton = el as HTMLElement)} small=\"true\" appearance=\"warning\" onClick={this.deleteExcessRows.bind(this)}>\n {this.confirmDeleteButtonText}\n </pn-button>\n <pn-button ref={el => (this.pnAbortDeleteButton = el as HTMLElement)} small=\"true\" appearance=\"light\" onClick={this.abortDeleteRows.bind(this)}>\n {this.abortDeleteButtonText}\n </pn-button>\n </div>\n ) : null}\n\n <div class=\"dropdown-with-multi-input-elemet__label-row\">\n <div class=\"dropdown-with-multi-input-elemet__label\">\n <label>{this.fristInputLabel}</label>\n </div>\n <div class=\"dropdown-with-multi-input-elemet__label\">\n <label>{this.secondInputLabel}</label>\n </div>\n <div class=\"dropdown-with-multi-input-elemet__label\">\n <label>{this.dateLabel}</label>\n </div>\n </div>\n\n {this.rowData?.map((data, i) => {\n return (\n <div class={'dropdown-with-multi-input-elemet__row generated-row-' + i} id={'generated-row-' + i}>\n <pn-dropdown-with-multi-input-rows-row\n language-code={this.languageCode}\n frist-input-placeholder={this.fristInputPlaceholder}\n first-input-min={this.firstInputMin}\n first-input-max={this.firstInputMax}\n first-input-warning={this.firstInputWarning}\n first-input-warning-text={this.firstInputWarningText}\n first-input-low-error-text={this.firstInputLowErrorText}\n first-input-high-error-text={this.firstInputHighErrorText}\n second-input-placeholder={this.secondInputPlaceholder}\n second-input-min={this.secondInputMin}\n second-input-max={this.secondInputMax}\n second-input-warning={this.secondInputWarning}\n second-input-warning-text={this.secondInputWarningText}\n second-input-low-error-text={this.secondInputLowErrorText}\n second-input-high-error-text={this.secondInputHighErrorText}\n datePlaceholder={this.datePlaceholder}\n firstValidDate={this.firstValidDateString}\n lastValidDate={this.lastValidDateString}\n predefined-value={JSON.stringify(data)}\n min-row-count={this.minRowCount}\n row-index={i}\n ></pn-dropdown-with-multi-input-rows-row>\n </div>\n );\n })}\n\n <div class=\"dropdown-with-multi-input-elemet__row sum-row\">\n <pn-marketweb-input disabled={true} ref={el => (this.pnSumField = el as HTMLElement)} type=\"number\" value={this.rowSum} label={this.sumFieldLabel}></pn-marketweb-input>\n\n <pn-button\n tooltip={this.addRowText ? this.addRowText : null}\n left-icon=\"true\"\n arialabel=\"Add\"\n icon={plus}\n appearance=\"light\"\n variant=\"borderless\"\n class=\"connected-dropdown__button-right\"\n onClick={() => {\n this.addRow(this.generateUniqueId());\n }}\n >\n {this.addRowText}\n </pn-button>\n </div>\n\n {this.elementHelperText?.length ? <div class=\"dropdown-with-multi-input-elemet__row\">{this.elementHelperText}</div> : null}\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"pn-dropdown-with-multi-input-rows.entry.js","mappings":";;;;;AAAA,MAAM,+BAA+B,GAAG,guBAAguB,CAAC;AACzwB,2CAAe,+BAA+B;;MCSjC,4BAA4B;;;;QAEvC,oBAAe,GAAgB,IAAI,CAAC;QACpC,qBAAgB,GAAgB,IAAI,CAAC;QACrC,eAAU,GAAgB,IAAI,CAAC;QAC/B,0BAAqB,GAAgB,IAAI,CAAC;QAC1C,wBAAmB,GAAgB,IAAI,CAAC;QAiDhC,4BAAuB,GAAW,IAAI,CAAC;QACvC,6BAAwB,GAAW,IAAI,CAAC;QAExC,gBAAW,GAAqB;YACtC,EAAE,EAAE,IAAI,CAAC,gBAAgB,EAAE;YAC3B,UAAU,EAAE,EAAE;YACd,WAAW,EAAE,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE;YAC/C,IAAI,EAAE,EAAE;SACT,CAAC;4BAvDsC,IAAI;4BACb,IAAI;kCACE,IAAI;uCACC,IAAI;mCACR,IAAI;wCACC,IAAI;iCACX,IAAI;6CACQ,IAAI;uCACV,IAAI;qCACN,IAAI;+BACV,IAAI;qCACE,IAAI;6BACZ,IAAI;6BACJ,IAAI;iCACA,IAAI;qCACA,IAAI;sCACH,IAAI;uCACH,IAAI;gCACX,IAAI;sCACE,IAAI;8BACZ,IAAI;8BACJ,IAAI;kCACA,IAAI;sCACA,IAAI;uCACH,IAAI;wCACH,IAAI;yBACnB,IAAI;+BACE,IAAI;iCACF,CAAC;mCACC,IAAI;6BACV,IAAI;0BACP,IAAI;iCACG,IAAI;gCAEJ,IAAI;iCACD,EAAE;wBACb,IAAI;uBACO,IAAI;0BACR,IAAI;oCACC,EAAE;mCACH,EAAE;sBACf,IAAI;2BACC,IAAI;gCACE,KAAK;;IAc1C,iBAAiB;QACf,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,eAAe,EAAE,CAAC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,OAAO,EAAE;gBACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;aACtC,IAEA,IAAI,CAAC,UAAU,CACN,CACR,EAEL,CAAA,MAAA,IAAI,CAAC,iBAAiB,0CAAE,MAAM,IAAG,WAAK,KAAK,EAAC,uCAAuC,IAAE,IAAI,CAAC,iBAAiB,CAAO,GAAG,IAAI,CACrH,EACP;KACH;;;;;;;","names":["uuidv4"],"sources":["src/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.scss?tag=pn-dropdown-with-multi-input-rows","src/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.tsx"],"sourcesContent":["@import '../../../globals/main.scss';\n\npn-dropdown-with-multi-input-rows {\n .dropdown-with-multi-input-elemet {\n &__row {\n margin-bottom: 1rem;\n }\n\n &__delete {\n display: flex;\n gap: 1rem;\n margin-bottom: 1rem;\n padding: 1rem;\n background-color: $gray25;\n\n pn-button {\n margin-top: 0.9rem;\n }\n }\n\n &__label-row {\n display: flex;\n gap: 1rem;\n }\n\n &__label {\n width: 30%;\n font-size: 0.875em;\n color: #5e554a;\n }\n }\n\n .sum-row {\n display: flex;\n justify-content: space-between;\n }\n}\n","import { Component, Prop, h, Element, State, Host, Watch, Event, EventEmitter, Listen } from '@stencil/core';\nimport { FormValue, RowValue, Root, PredefinedValues } from './types';\nimport { v4 as uuidv4 } from 'uuid';\nimport debounce from 'debounce';\nimport { plus } from 'pn-design-assets/pn-assets/icons.js';\n\n@Component({\n tag: 'pn-dropdown-with-multi-input-rows',\n styleUrl: 'pn-dropdown-with-multi-input-rows.scss',\n})\nexport class PnDropdownWithMultiInputRows {\n @Element() hostElement: Element;\n pnFirstDropdown: HTMLElement = null;\n pnSecondDropdown: HTMLElement = null;\n pnSumField: HTMLElement = null;\n pnConfirmDeleteButton: HTMLElement = null;\n pnAbortDeleteButton: HTMLElement = null;\n\n @Prop() dropdownData: string | Root[] = null;\n @Prop() languageCode: string = null;\n @Prop() firstDropdownLabel: string = null;\n @Prop() firstDropdownHelperText: string = null;\n @Prop() secondDropdownLabel: string = null;\n @Prop() secondDropdownHelperText: string = null;\n @Prop() secondDropdownMax: number = null;\n @Prop() deleteMultipleRowsWarningText: string = null;\n @Prop() confirmDeleteButtonText: string = null;\n @Prop() abortDeleteButtonText: string = null;\n @Prop() fristInputLabel: string = null;\n @Prop() fristInputPlaceholder: string = null;\n @Prop() firstInputMin: number = null;\n @Prop() firstInputMax: number = null;\n @Prop() firstInputWarning: number = null;\n @Prop() firstInputWarningText: string = null;\n @Prop() firstInputLowErrorText: string = null;\n @Prop() firstInputHighErrorText: string = null;\n @Prop() secondInputLabel: string = null;\n @Prop() secondInputPlaceholder: string = null;\n @Prop() secondInputMin: number = null;\n @Prop() secondInputMax: number = null;\n @Prop() secondInputWarning: number = null;\n @Prop() secondInputWarningText: string = null;\n @Prop() secondInputLowErrorText: string = null;\n @Prop() secondInputHighErrorText: string = null;\n @Prop() dateLabel: string = null;\n @Prop() datePlaceholder: string = null;\n @Prop() dateDaysFromToday: number = 1;\n @Prop() yearsToAddToEndDate: number = null;\n @Prop() sumFieldLabel: string = null;\n @Prop() addRowText: string = null;\n @Prop() elementHelperText: string = null;\n\n @State() dropdownDataRoot: Root[] = null;\n @State() secondDropdownArr: number[] = [];\n @State() rowCount: number = null;\n @State() rowData: PredefinedValues[] = null;\n @State() formValues: FormValue[] = null;\n @State() firstValidDateString: string = '';\n @State() lastValidDateString: string = '';\n @State() rowSum: string = null;\n @State() minRowCount: number = null;\n @State() showDelteConfirm: boolean = false;\n\n @Event() allFormValues: EventEmitter<string>;\n\n private _firstDropdownSelection: string = null;\n private _secondDropdownSelection: number = null;\n\n private _defaultRow: PredefinedValues = {\n id: this.generateUniqueId(),\n firstInput: '',\n secondInput: this.secondInputWarning.toString(),\n date: '',\n };\n\n componentWillLoad() {\n this.formValues = [];\n this.setDropDownData();\n this.updateSecondDropdown();\n this.setRowData();\n this.setFirstValidDate();\n }\n\n componentDidLoad() {\n this.updateSum();\n }\n\n setDropDownData() {\n if (typeof this.dropdownData === 'string') {\n this.dropdownDataRoot = JSON.parse(this.dropdownData);\n } else {\n this.dropdownDataRoot = this.dropdownData;\n }\n\n if (this.dropdownDataRoot?.length) {\n this.dropdownDataRoot.forEach(element => {\n if (!element.value) {\n element.value = 0;\n }\n });\n }\n\n if (this.dropdownDataRoot.length > 0) {\n this.dropdownDataRoot[0].checked = true;\n this._firstDropdownSelection = this.dropdownDataRoot[0].label;\n this._secondDropdownSelection = this.dropdownDataRoot[0].value;\n this.minRowCount = this.dropdownDataRoot[0].value;\n }\n }\n\n updateSecondDropdown() {\n const selectedItem = this.dropdownDataRoot.find(arr => arr.checked === true);\n this.secondDropdownArr = [];\n\n for (let index = selectedItem.value; index <= this.secondDropdownMax; index++) {\n this.secondDropdownArr.push(index);\n }\n }\n\n updateSelectItemArr(arr: Root[], caption: string) {\n arr.forEach(item => {\n if (item.label === caption) {\n item.checked = !item.checked;\n } else {\n item.checked = false;\n }\n });\n return arr;\n }\n\n setRowData() {\n this.rowData = [];\n for (let index = 0; index < this._secondDropdownSelection; index++) {\n const row = Object.assign({}, this._defaultRow);\n row.id = this.generateUniqueId();\n this.rowData = [...this.rowData, row];\n }\n\n this.rowCount = this.rowData.length;\n }\n\n generateUniqueId() {\n return uuidv4();\n }\n\n setFirstValidDate() {\n const yearsToadd = this.yearsToAddToEndDate ? this.yearsToAddToEndDate : 2;\n const date = new Date();\n date.setDate(date.getDate() + this.dateDaysFromToday ?? 0);\n\n const year = date.getFullYear();\n const month = (date.getMonth() + 1).toString().padStart(2, '0');\n const day = date.getDate().toString().padStart(2, '0');\n const endYear = year + yearsToadd;\n\n this.firstValidDateString = `${year.toString()}-${month}-${day}`;\n this.lastValidDateString = `${endYear.toString()}-${month}-${day}`;\n }\n\n addRow(newRowId: string) {\n const newRow = Object.assign({}, this.rowData[0]);\n newRow.id = newRowId ? newRowId : this.generateUniqueId();\n newRow.date = '';\n this.rowData = [...this.rowData, newRow];\n this.rowCount = this.rowData.length;\n\n this._secondDropdownSelection = this.rowCount;\n this.secondDropdownArr = [...this.secondDropdownArr];\n this.updateSum();\n this.emitValuesIfValid();\n }\n\n handleFirstDropdown() {\n const selected = this.pnFirstDropdown.querySelector('[aria-selected=true]');\n const selectedValue = selected?.textContent;\n if (!selectedValue?.length) {\n return;\n }\n\n this.dropdownDataRoot.forEach(element => {\n element.checked = false;\n });\n\n const selectionRoot = this.dropdownDataRoot.find(x => x.label === selectedValue);\n selectionRoot.checked = true;\n this._firstDropdownSelection = selectionRoot.label;\n this.minRowCount = selectionRoot.value;\n\n if (selectionRoot.value > this._secondDropdownSelection) {\n this.dropdownDataRoot = [...this.dropdownDataRoot];\n\n for (let index = this.rowCount; index < selectionRoot.value; index++) {\n this.addRow(this.generateUniqueId());\n }\n }\n\n this.updateSecondDropdown();\n this.updateSum();\n this.emitValuesIfValid();\n }\n\n handleSecondDropdown() {\n const selected = this.pnSecondDropdown.querySelector('[aria-selected=true]');\n const selectedValue = selected?.textContent;\n if (!selectedValue?.length) {\n return;\n }\n\n const value = parseInt(selectedValue);\n if (value < this._secondDropdownSelection) {\n this.showDelteConfirm = true;\n } else {\n for (let index = this.rowCount; index < value; index++) {\n this.addRow(this.generateUniqueId());\n }\n }\n this.updateSum();\n this.emitValuesIfValid();\n }\n\n @Listen('rowValueChange')\n @Listen('firstInputChange')\n @Listen('secondInputChange')\n predefinedValueChange(e) {\n const indexToUpdate = this.rowData.findIndex(data => data.id === e.detail.id);\n const val: PredefinedValues = e.detail;\n this.rowData[indexToUpdate] = {\n ...this.rowData[indexToUpdate],\n firstInput: val.firstInput,\n secondInput: val.secondInput,\n date: val.date,\n };\n\n if (e.type === 'firstInputChange' && indexToUpdate === 0) {\n this.updateFirstInputOfRows(val.firstInput);\n }\n\n if (e.type === 'secondInputChange' && indexToUpdate === 0) {\n this.updateSecondInputOfRows(val.secondInput);\n }\n\n this.rowData = [...this.rowData];\n this.emitValuesIfValid();\n this.updateSum();\n }\n\n updateFirstInputOfRows(value: string) {\n for (let index = 1; index < this.rowCount; index++) {\n this.rowData[index] = {\n ...this.rowData[index],\n firstInput: value,\n };\n }\n }\n\n updateSecondInputOfRows(value: string) {\n for (let index = 1; index < this.rowCount; index++) {\n this.rowData[index] = {\n ...this.rowData[index],\n secondInput: value,\n };\n }\n }\n\n @Listen('deleteRowEvent')\n deleteRowEvent(e) {\n const indexToRemove = this.rowData.findIndex(data => data.id === e.detail);\n if (indexToRemove < 0) {\n return;\n }\n\n this.rowData.splice(indexToRemove, 1);\n this.rowData = [...this.rowData];\n this.rowCount = this.rowData.length;\n\n this._secondDropdownSelection = this.rowCount;\n this.secondDropdownArr = [...this.secondDropdownArr];\n this.emitValuesIfValid();\n this.updateSum();\n }\n\n updateSum() {\n this.rowSum = '';\n let sum = 0;\n this.rowData.forEach(element => {\n if (element?.firstInput?.length) {\n sum += parseInt(element.firstInput);\n }\n });\n\n this.rowSum = sum.toString();\n }\n\n deleteExcessRows() {\n const selected = this.pnSecondDropdown.querySelector('[aria-selected=true]');\n const selectedValue = selected?.textContent;\n if (!selectedValue?.length) {\n return;\n }\n const rowsToDelete = this.rowCount - parseInt(selectedValue);\n for (let index = 0; index < rowsToDelete; index++) {\n this.rowData.pop();\n }\n this.rowData = [...this.rowData];\n this.showDelteConfirm = false;\n this.updateSum();\n }\n\n abortDeleteRows() {\n this.showDelteConfirm = false;\n }\n\n emitValuesIfValid() {\n this.formValues = [];\n this.rowData.forEach(item => {\n const rowValue: FormValue = { row: [] };\n\n if (this._firstDropdownSelection?.length) {\n const dropDownValue: RowValue = { name: this.firstDropdownLabel, value: this._firstDropdownSelection };\n rowValue.row.push(dropDownValue);\n }\n\n if (item.firstInput?.length) {\n const firstInputValue: RowValue = { name: this.fristInputLabel, value: item.firstInput };\n rowValue.row.push(firstInputValue);\n }\n\n if (item.secondInput?.length) {\n const secondInputValue: RowValue = { name: this.secondInputLabel, value: item.secondInput };\n rowValue.row.push(secondInputValue);\n }\n\n if (item.date?.length) {\n const dateValue: RowValue = { name: this.dateLabel, value: item.date };\n rowValue.row.push(dateValue);\n }\n\n if (rowValue.row.length === 4) {\n this.formValues.push(rowValue);\n }\n });\n\n if (this.formValues.length === this.rowData.length) {\n const valueJsonString = JSON.stringify(this.formValues);\n this.allFormValues.emit(valueJsonString);\n } else {\n this.allFormValues.emit('');\n }\n }\n\n render() {\n return (\n <Host class=\"dropdown-with-multi-input-elemet\">\n <div class=\"dropdown-with-multi-input-elemet__row\">\n <div>\n <pn-select ref={el => (this.pnFirstDropdown = el as HTMLElement)} class=\"pn-row-select-dropdown dropDown1-dropdown\" label={this.firstDropdownLabel} empty-option=\"true\">\n {this.dropdownDataRoot?.map((item, i) => (\n <pn-option index={i} label={item.value} value={item.value} selected={item.checked} onClick={debounce(this.handleFirstDropdown.bind(this), 500)}></pn-option>\n ))}\n </pn-select>\n {this.firstDropdownHelperText?.length ? <small>{this.firstDropdownHelperText}</small> : null}\n </div>\n </div>\n\n <div class=\"dropdown-with-multi-input-elemet__row\">\n <div>\n <pn-select ref={el => (this.pnSecondDropdown = el as HTMLElement)} class=\"pn-row-select-dropdown dropDown2-dropdown\" label={this.secondDropdownLabel} empty-option=\"true\">\n {this.secondDropdownArr?.map((item, i) => (\n <pn-option index={i} label={item} value={item} selected={item === this._secondDropdownSelection} onClick={debounce(this.handleSecondDropdown.bind(this), 500)}></pn-option>\n ))}\n </pn-select>\n {this.secondDropdownHelperText?.length ? <small>{this.secondDropdownHelperText}</small> : null}\n </div>\n </div>\n\n {this.showDelteConfirm ? (\n <div class=\"dropdown-with-multi-input-elemet__delete\">\n <p>{this.deleteMultipleRowsWarningText}</p>\n <pn-button ref={el => (this.pnConfirmDeleteButton = el as HTMLElement)} small=\"true\" appearance=\"warning\" onClick={this.deleteExcessRows.bind(this)}>\n {this.confirmDeleteButtonText}\n </pn-button>\n <pn-button ref={el => (this.pnAbortDeleteButton = el as HTMLElement)} small=\"true\" appearance=\"light\" onClick={this.abortDeleteRows.bind(this)}>\n {this.abortDeleteButtonText}\n </pn-button>\n </div>\n ) : null}\n\n <div class=\"dropdown-with-multi-input-elemet__label-row\">\n <div class=\"dropdown-with-multi-input-elemet__label\">\n <label>{this.fristInputLabel}</label>\n </div>\n <div class=\"dropdown-with-multi-input-elemet__label\">\n <label>{this.secondInputLabel}</label>\n </div>\n <div class=\"dropdown-with-multi-input-elemet__label\">\n <label>{this.dateLabel}</label>\n </div>\n </div>\n\n {this.rowData?.map((data, i) => {\n return (\n <div class={'dropdown-with-multi-input-elemet__row generated-row-' + i} id={'generated-row-' + i}>\n <pn-dropdown-with-multi-input-rows-row\n language-code={this.languageCode}\n frist-input-placeholder={this.fristInputPlaceholder}\n first-input-min={this.firstInputMin}\n first-input-max={this.firstInputMax}\n first-input-warning={this.firstInputWarning}\n first-input-warning-text={this.firstInputWarningText}\n first-input-low-error-text={this.firstInputLowErrorText}\n first-input-high-error-text={this.firstInputHighErrorText}\n second-input-placeholder={this.secondInputPlaceholder}\n second-input-min={this.secondInputMin}\n second-input-max={this.secondInputMax}\n second-input-warning={this.secondInputWarning}\n second-input-warning-text={this.secondInputWarningText}\n second-input-low-error-text={this.secondInputLowErrorText}\n second-input-high-error-text={this.secondInputHighErrorText}\n datePlaceholder={this.datePlaceholder}\n firstValidDate={this.firstValidDateString}\n lastValidDate={this.lastValidDateString}\n predefined-value={JSON.stringify(data)}\n min-row-count={this.minRowCount}\n row-index={i}\n ></pn-dropdown-with-multi-input-rows-row>\n </div>\n );\n })}\n\n <div class=\"dropdown-with-multi-input-elemet__row sum-row\">\n <pn-marketweb-input disabled={true} ref={el => (this.pnSumField = el as HTMLElement)} type=\"number\" value={this.rowSum} label={this.sumFieldLabel}></pn-marketweb-input>\n\n <pn-button\n tooltip={this.addRowText ? this.addRowText : null}\n left-icon=\"true\"\n arialabel=\"Add\"\n icon={plus}\n appearance=\"light\"\n variant=\"borderless\"\n class=\"connected-dropdown__button-right\"\n onClick={() => {\n this.addRow(this.generateUniqueId());\n }}\n >\n {this.addRowText}\n </pn-button>\n </div>\n\n {this.elementHelperText?.length ? <div class=\"dropdown-with-multi-input-elemet__row\">{this.elementHelperText}</div> : null}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -140,12 +140,12 @@ const PnMultiRowConnectedDropdownRow = class {
140
140
  setDateValue() {
141
141
  var _a, _b, _c;
142
142
  if (this.allowMultipleDates) {
143
- this.pnDateRangeContainer.style.display = ((_a = this._predefinedValue.dates) === null || _a === void 0 ? void 0 : _a.length) ? '' : 'none';
144
- this.generatedDatesArr = ((_b = this._predefinedValue.dates) === null || _b === void 0 ? void 0 : _b.length) ? this._predefinedValue.dates.split(',') : [];
143
+ this.pnDateRangeContainer.style.display = ((_a = this._predefinedValue.dates["start"]) === null || _a === void 0 ? void 0 : _a.length) ? '' : 'none';
144
+ this.generatedDatesArr = ((_b = this._predefinedValue.dates["start"]) === null || _b === void 0 ? void 0 : _b.length) ? this._predefinedValue.dates["start"].split(',') : [];
145
145
  this.saveGeneratedDates();
146
146
  }
147
147
  else {
148
- this.dateValue = ((_c = this._predefinedValue.dates) === null || _c === void 0 ? void 0 : _c.length) ? this._predefinedValue.dates : '';
148
+ this.dateValue = ((_c = this._predefinedValue.dates["start"]) === null || _c === void 0 ? void 0 : _c.length) ? this._predefinedValue.dates["start"] : '';
149
149
  }
150
150
  }
151
151
  setDateRangeDefaults() {
@@ -363,7 +363,7 @@ const PnMultiRowConnectedDropdownRow = class {
363
363
  }
364
364
  render() {
365
365
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
366
- return (h(Host, { key: 'e61da8a6a63b23c96c75b2abd8f6f1769e9cb0fc' }, h("div", { key: 'c40b78871c668a07ba728a294c26473cf6da0cd4', ref: el => (this.pnConnectedDropdownSlotElement = el), class: "connected-dropdown-slot-element" }, h("div", { key: '333bd5546b3d5e3e8724891260c046ba1266d8f5', class: "connected-dropdown-parent-element connected-dropdown" }, h("div", { key: '96c9ce1e849ecce0478f96addaedb26c8c8883f9', class: "connected-dropdown__row__no-margin" }, h("label", { key: '67eb3a989e0bd666c78ee4fd2cc2453f612ac4e7' }, this.label)), h("div", { key: '1cc0519d8288b257e942c996c72b3208fa4f7959', class: "connected-dropdown__row button-row" }, h("div", { key: '99357ac670e533ca84e2bbb39ea5974f1bc25ba3', class: "connected-dropdown__button-container option-buttons" }, (_a = this.buttonsArray) === null || _a === void 0 ? void 0 : _a.map(item => (h("button", { class: `${this.setActive(item.selected)}`, id: this.generateUniqueId(), onClick: this.handleOptionButtonClick.bind(this) }, item.value)))), h("div", { key: '924eb2f5390ce0525d309fe581afde692b3a85e9', class: "connected-dropdown__button-container delete-button" }, this.index > 0 ? (h("pn-button", { ref: el => (this.pnDeleteRowButton = el), small: "true", icon: minus, appearance: "warning", index: this.index }, "Delete")) : null)), h("div", { key: '180bd6730284acd53a3303828e80ec5f23dff1a0', class: "connected-dropdown__row input-row" }, h("pn-select", { key: '020741b2cdb7bef4caff25c61573abf8ab4cef28', ref: el => (this.pnFirstDropdown = el), class: "pn-row-select-dropdown dropDown1-dropdown", placeholder: this.firstDropdownPlaceholder, label: this.firstDropdownLabel }, (_b = this.firstDropdownArr) === null || _b === void 0 ? void 0 : _b.map((item, i) => (h("pn-option", { index: i, label: item.label, value: item.value, selected: item.selected, onClick: debounce(this.handleFirstDropdownChange.bind(this), 500) })))), h("pn-select", { key: 'fcd1e80c7ca48d51cf04d7bad7e15d18c65fce4b', ref: el => (this.pnSecondDropdown = el), class: "pn-row-select-dropdown dropDown2-dropdown", placeholder: this.secondDropdownPlaceholder, label: this.secondDropdownLabel }, (_c = this.secondDropdownArr) === null || _c === void 0 ? void 0 : _c.map((item, i) => (h("pn-option", { index: i, label: item.label, value: item.value, selected: item.selected, onClick: debounce(this.handleSecondDropdownChange.bind(this), 500) })))), h("pn-marketweb-input", { key: '05dcfd953d8a91f4f7e300aaf8e46233bb4d5af6', ref: el => (this.pnInputField = el), type: "number", placeholder: "0", label: this.inputFildLabel, value: this.inputFieldValue, min: "1" }), this.allowMultipleDates ? (h("pn-button", { ref: el => (this.pnShowDateRangeFiledButton = el), class: "connected-dropdown__toggle-date-button", small: "true", appearance: "light" }, this.dateButtonText)) : (h("div", { class: "connected-dropdown__date-container" }, h("div", { class: "connected-dropdown__label-container" }, h("label", null, this.dateButtonText)), h("pn-date-picker", { ref: el => (this.pnSingleDatePicker = el), range: "false", "disable-weekends": true, "min-date": this.firstValidDateString, language: this.languageCode, placeholder: this.datePlaceholder, class: "connected-dropdown__date-picker", start: ((_d = this.dateValue) === null || _d === void 0 ? void 0 : _d.length) ? this.dateValue : null })))), this.allowMultipleDates ? (h("div", { ref: el => (this.pnDateRangeContainer = el), class: "connected-dropdown__date-container", style: { display: 'none' } }, this.multiDateHelperText ? (h("div", { class: "connected-dropdown__row" }, h("p", null, this.multiDateHelperText))) : null, h("div", { class: "connected-dropdown__multi-date-row" }, h("div", { class: "connected-dropdown__date-container" }, h("div", { class: "connected-dropdown__label-container" }, h("label", null, this.startDateLabel)), h("pn-date-picker", { ref: el => (this.pnStartDate = el), range: "false", "disable-weekends": true, class: "connected-dropdown__date-picker", "min-date": this.firstValidDateString, "max-date": this.lastValidDateString, language: this.languageCode, placeholder: this.datePlaceholder, start: ((_e = this.starDateValue) === null || _e === void 0 ? void 0 : _e.length) ? this.starDateValue : null })), h("div", { class: "connected-dropdown__date-container" }, h("div", { class: "connected-dropdown__label-container" }, h("label", null, this.endDateLabel)), h("pn-date-picker", { ref: el => (this.pnEndDate = el), range: "false", "disable-weekends": true, class: "connected-dropdown__date-picker", "min-date": this.firstValidDateString, "max-date": this.lastValidDateString, language: this.languageCode, placeholder: this.datePlaceholder, start: ((_f = this.endDateValue) === null || _f === void 0 ? void 0 : _f.length) ? this.endDateValue : null }))), h("div", { ref: el => (this.pnDaysRow = el), class: "connected-dropdown__multi-date-row" }, (_g = this.daysArr) === null || _g === void 0 ? void 0 : _g.map((day) => (h("div", { class: "connected-dropdown__checkbox" }, h("pn-filter-checkbox", { checkboxid: 'day-' + day.value, name: '__' + day.label, value: day.value, checked: day.selected }), h("label", { htmlFor: 'day-' + day.value }, day.label))))), h("div", { class: "connected-dropdown__row" }, h("pn-button", { ref: el => (this.pnGenerateDatesButton = el), small: "true" }, this.generateDatesButtonText)), h("div", { ref: el => (this.pnGeneratedDatesSlot = el), class: "connected-dropdown__date-slot" }, (_h = this.generatedDatesArr) === null || _h === void 0 ? void 0 :
366
+ return (h(Host, { key: 'ad539e2ba8ab36a8b052be6cd30a901847de6f00' }, h("div", { key: '36b00805294171c2bf910cda8fb80da2b449cd31', ref: el => (this.pnConnectedDropdownSlotElement = el), class: "connected-dropdown-slot-element" }, h("div", { key: '3d3e46feab301b4e9f3db92365fd0e3c4b69a518', class: "connected-dropdown-parent-element connected-dropdown" }, h("div", { key: '62bd8eb88f0ca11ad06c2a1053bd823500719c6a', class: "connected-dropdown__row__no-margin" }, h("label", { key: 'afe3977594b5a3e54865e6cd10a6cbdefb578c79' }, this.label)), h("div", { key: '96ffced084b72620088cb2357f8266fc12c9fc87', class: "connected-dropdown__row button-row" }, h("div", { key: '9539103ef44c6e314c792f46b8ef33e114ce8306', class: "connected-dropdown__button-container option-buttons" }, (_a = this.buttonsArray) === null || _a === void 0 ? void 0 : _a.map(item => (h("button", { class: `${this.setActive(item.selected)}`, id: this.generateUniqueId(), onClick: this.handleOptionButtonClick.bind(this) }, item.value)))), h("div", { key: '39fdaad5b12573c7e8d453deaf5b10ad558a8eb3', class: "connected-dropdown__button-container delete-button" }, this.index > 0 ? (h("pn-button", { ref: el => (this.pnDeleteRowButton = el), small: "true", icon: minus, appearance: "warning", index: this.index }, "Delete")) : null)), h("div", { key: 'c8c808aa6214dfd234b0d383c2f3dbe075c938af', class: "connected-dropdown__row input-row" }, h("pn-select", { key: '54a0e807950b4d70b6a253ffff772452767a9d1b', ref: el => (this.pnFirstDropdown = el), class: "pn-row-select-dropdown dropDown1-dropdown", placeholder: this.firstDropdownPlaceholder, label: this.firstDropdownLabel, "empty-option": "true" }, (_b = this.firstDropdownArr) === null || _b === void 0 ? void 0 : _b.map((item, i) => (h("pn-option", { index: i, label: item.label, value: item.value, selected: item.selected, onClick: debounce(this.handleFirstDropdownChange.bind(this), 500) })))), h("pn-select", { key: 'ac1a665b98da67b0cb7e74609c4e21f0d67a7244', ref: el => (this.pnSecondDropdown = el), class: "pn-row-select-dropdown dropDown2-dropdown", placeholder: this.secondDropdownPlaceholder, label: this.secondDropdownLabel, "empty-option": "true" }, (_c = this.secondDropdownArr) === null || _c === void 0 ? void 0 : _c.map((item, i) => (h("pn-option", { index: i, label: item.label, value: item.value, selected: item.selected, onClick: debounce(this.handleSecondDropdownChange.bind(this), 500) })))), h("pn-marketweb-input", { key: '7c8c8093092dae071cb25473062b0da157f7070f', ref: el => (this.pnInputField = el), type: "number", placeholder: "0", label: this.inputFildLabel, value: this.inputFieldValue, min: "1" }), this.allowMultipleDates ? (h("pn-button", { ref: el => (this.pnShowDateRangeFiledButton = el), class: "connected-dropdown__toggle-date-button", small: "true", appearance: "light" }, this.dateButtonText)) : (h("div", { class: "connected-dropdown__date-container" }, h("div", { class: "connected-dropdown__label-container" }, h("label", null, this.dateButtonText)), h("pn-date-picker", { ref: el => (this.pnSingleDatePicker = el), range: "false", "disable-weekends": true, "min-date": this.firstValidDateString, language: this.languageCode, placeholder: this.datePlaceholder, class: "connected-dropdown__date-picker", start: ((_d = this.dateValue) === null || _d === void 0 ? void 0 : _d.length) ? this.dateValue : null })))), this.allowMultipleDates ? (h("div", { ref: el => (this.pnDateRangeContainer = el), class: "connected-dropdown__date-container", style: { display: 'none' } }, this.multiDateHelperText ? (h("div", { class: "connected-dropdown__row" }, h("p", null, this.multiDateHelperText))) : null, h("div", { class: "connected-dropdown__multi-date-row" }, h("div", { class: "connected-dropdown__date-container" }, h("div", { class: "connected-dropdown__label-container" }, h("label", null, this.startDateLabel)), h("pn-date-picker", { ref: el => (this.pnStartDate = el), range: "false", "disable-weekends": true, class: "connected-dropdown__date-picker", "min-date": this.firstValidDateString, "max-date": this.lastValidDateString, language: this.languageCode, placeholder: this.datePlaceholder, start: ((_e = this.starDateValue) === null || _e === void 0 ? void 0 : _e.length) ? this.starDateValue : null })), h("div", { class: "connected-dropdown__date-container" }, h("div", { class: "connected-dropdown__label-container" }, h("label", null, this.endDateLabel)), h("pn-date-picker", { ref: el => (this.pnEndDate = el), range: "false", "disable-weekends": true, class: "connected-dropdown__date-picker", "min-date": this.firstValidDateString, "max-date": this.lastValidDateString, language: this.languageCode, placeholder: this.datePlaceholder, start: ((_f = this.endDateValue) === null || _f === void 0 ? void 0 : _f.length) ? this.endDateValue : null }))), h("div", { ref: el => (this.pnDaysRow = el), class: "connected-dropdown__multi-date-row" }, (_g = this.daysArr) === null || _g === void 0 ? void 0 : _g.map((day) => (h("div", { class: "connected-dropdown__checkbox" }, h("pn-filter-checkbox", { checkboxid: 'day-' + day.value, name: '__' + day.label, value: day.value, checked: day.selected }), h("label", { htmlFor: 'day-' + day.value }, day.label))))), h("div", { class: "connected-dropdown__row" }, h("pn-button", { ref: el => (this.pnGenerateDatesButton = el), small: "true" }, this.generateDatesButtonText)), h("div", { ref: el => (this.pnGeneratedDatesSlot = el), class: "connected-dropdown__date-slot" }, (_h = this.generatedDatesArr) === null || _h === void 0 ? void 0 :
367
367
  _h.map((date, i) => (h("div", { class: "connected-dropdown__row generated-date-row" }, h("p", null, date), h("pn-button", { index: i, small: "true", icon: minus, appearance: "warning", id: 'delete-date-' + i, onClick: this.deleteGeneratedDateRow.bind(this, i) }, date)))), !((_j = this.generatedDatesArr) === null || _j === void 0 ? void 0 : _j.length) ? h("p", null, this.noDatesText) : null), h("div", { class: "connected-dropdown__row" }, h("pn-button", { ref: el => (this.pnSaveGeneratedDatesButton = el), class: "connected-dropdown__button-right", small: "true" }, this.saveDateButtonText)))) : null))));
368
368
  }
369
369
  get hostElement() { return getElement(this); }