comand-component-library 4.2.82 → 4.2.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comand-component-library",
3
- "version": "4.2.82",
3
+ "version": "4.2.84",
4
4
  "license": "GPL-3.0-only",
5
5
  "author": "CoManD-UI",
6
6
  "private": false,
@@ -1283,7 +1283,7 @@
1283
1283
  <h2 class="headline-demopage" id="section-multistep-form-wrapper">
1284
1284
  <span>Multistepform-Wrapper</span>
1285
1285
  <a href="#" class="button small icon-cog" title="Open Component Settings"
1286
- @click.prevent="openSettingsSidebar('CmdMultistepFormProgressBar')">
1286
+ @click.prevent="openSettingsSidebar('CmdMultistepFormWrapper')">
1287
1287
  </a>
1288
1288
  </h2>
1289
1289
  <h3>Data provided by property</h3>
@@ -1372,25 +1372,32 @@
1372
1372
  </div>
1373
1373
  </CmdForm>
1374
1374
  </template>
1375
- <template v-slot:page-4>
1375
+ <template v-slot:page-4="props">
1376
1376
  <h3>Page 4</h3>
1377
- Content Page 4
1377
+ <CmdForm
1378
+ :cmdHeadline=" { headlineText: 'Confirmation', headlineLevel: 3 }"
1379
+ :submitButton="{ disabled : props.atleastOneStepWithError }"
1380
+ :cancelButton="{ show: false }"
1381
+ >
1382
+ <p>Please confirm that all data ou provided is legit.</p>
1383
+ <CmdFormElement
1384
+ element="input"
1385
+ type="checkbox"
1386
+ labelText="Confirm data privacy:"
1387
+ name="confirm-data-privacy"
1388
+ id="confirm-data-privac"
1389
+ :required="true"
1390
+ :modelValue="props.formDataForPage['confirm-data-privacy']"
1391
+ @update:modelValue="setValue($event, 'confirm-data-privacy', props)"
1392
+ @validation-status-change="setValidationStatusCheckbox($event, 'confirm-data-privacy', props)"
1393
+ />
1394
+ </CmdForm>
1395
+ props.atleastOneStepWithError: {{ props.atleastOneStepWithError }}
1378
1396
  </template>
1379
- <template v-slot:page-5="props">
1380
- <h3>Page 5</h3>
1381
- <CmdForm
1382
- :formElements="multistepFormWrapperPage1Data"
1383
- :useSlot="false"
1384
- @validation-status-change="toggleSystemMessage($event, props)"
1385
- :submitButton="{disabled: props.atleastOnePageWithError}"
1386
- :cancelButton="{ show: false}"
1387
- />
1388
- props.atleastOnPageWithError: {{ props.atleastOnePageWithError }}
1397
+ <template>
1398
+ <h3>Page 5 - Confirmation</h3>
1399
+ <p>Thank you for sending your request!</p>
1389
1400
  </template>
1390
- <twmplate>
1391
- <h3>Page 6 - Confirmation</h3>
1392
- <p>Thank you for seding your request!</p>
1393
- </twmplate>
1394
1401
  </CmdMultistepFormWrapper>
1395
1402
  <h3>Data provided by slot</h3>
1396
1403
  <CmdMultistepFormWrapper>
@@ -2014,6 +2021,7 @@ export default {
2014
2021
  inputFieldPattern: "",
2015
2022
  inputSearch: "",
2016
2023
  textarea: "",
2024
+ formElementsWithErrorPageConfirm: ["confirm-data-privacy"],
2017
2025
  inputGroupRadio: "radiobuttonValue1",
2018
2026
  inputGroup: "website",
2019
2027
  inputGroupValueReplaceInputTypeRadio: "phone",
@@ -2207,6 +2215,16 @@ export default {
2207
2215
  const status = this.formElementsWithError.length > 0 ? "error" : "success"
2208
2216
  this.toggleSystemMessage(status, props)
2209
2217
  },
2218
+ setValidationStatusCheckbox(event, itemName, props) {
2219
+ console.log("event", event)
2220
+ if (event === "error" && !this.formElementsWithErrorPageConfirm.some(entry => entry.name === itemName)) {
2221
+ this.formElementsWithErrorPageConfirm.push(itemName)
2222
+ } else if (event === "success" && this.formElementsWithErrorPageConfirm.includes(itemName)) {
2223
+ this.formElementsWithErrorPageConfirm = this.formElementsWithErrorPageConfirm.filter((element) => element !== itemName)
2224
+ }
2225
+ const status = this.formElementsWithErrorPageConfirm.length > 0 ? "error" : "success"
2226
+ this.toggleSystemMessage(status, props)
2227
+ },
2210
2228
  outputFormData(event) {
2211
2229
  console.log("outputFormData", event)
2212
2230
  },
@@ -574,6 +574,11 @@ export default {
574
574
  }
575
575
  ]
576
576
  },
577
+ cmdMultistepFormWrapperSettingsData: {
578
+ cmdMultistepFormProgressBar: {
579
+ show: true
580
+ }
581
+ },
577
582
  cmdNewsletterSubscriptionSettingsData: {
578
583
  buttonType: "submit",
579
584
  legend: {
@@ -853,9 +853,9 @@ export default {
853
853
  const value = event.target.value
854
854
 
855
855
  // if input is filled, set status to success (expect for checkboxes and radiobuttons)
856
- if (!["checkbox", "radio"].includes(this.$attrs.type) && value) {
856
+ //if (!["checkbox", "radio"].includes(this.$attrs.type) && value) {
857
857
  this.validationStatus = "success"
858
- }
858
+ //}
859
859
 
860
860
  if (typeof event.target.checkValidity === "function" && !event.target.checkValidity()) {
861
861
  this.validationStatus = "error"
@@ -15,19 +15,22 @@
15
15
  </slot>
16
16
  <!-- begin slot for progress-bar -->
17
17
 
18
+ <!-- begin main cntent for page -->
18
19
  <div v-show="page === currentPage" :class="'multistep-page-' + page" v-for="(page, index) in numberOfPages" :key="index">
19
- <CmdSystemMessage v-if="statusForPages.some(item => item.page === page)" :systemMessage="getSystemMessage(page)" validationStatus="error" />
20
+ <CmdSystemMessage v-if="validationStatusForSteps.some(item => item.page === page)" :systemMessage="getSystemMessage(page)" validationStatus="error" />
21
+
20
22
  <!-- begin slot for page content -->
21
23
  <slot
22
24
  :name="'page-' + page"
23
25
  :setErrorOnPage="(message) => setErrorOnPage(page, message)"
24
26
  :removeErrorOnPage="() => removeErrorOnPage(page)"
25
- :atleastOnePageWithError="atleastOnePageWithError"
27
+ :atleastOneStepWithError="atleastOneStepWithError"
26
28
  :formDataForPage="formDataForPage(page)"
27
29
  :updateFormDataForPage="(event) => updateFormDataForPage(page, event)"
28
30
  />
29
31
  <!-- end slot for page content -->
30
32
  </div>
33
+ <!-- end main cntent for page -->
31
34
 
32
35
  <!-- begin slot for pagination -->
33
36
  <slot name="pagination"
@@ -56,7 +59,7 @@ export default {
56
59
  data () {
57
60
  return {
58
61
  currentPage: 1,
59
- statusForPages: [],
62
+ validationStatusForSteps: [],
60
63
  inputMade: [],
61
64
  formData: {}
62
65
  }
@@ -72,13 +75,6 @@ export default {
72
75
  show: true
73
76
  }
74
77
  }
75
- },
76
- /**
77
- * properties for CmdMultistepFormProgressBar-component
78
- */
79
- showButtonWrapper: {
80
- type: Boolean,
81
- default: true
82
78
  },
83
79
  /**
84
80
  * properties for CmdLink-component
@@ -117,29 +113,29 @@ export default {
117
113
  this.formData[page] = event
118
114
  },
119
115
  getSystemMessage(page) {
120
- const pageEntry = this.statusForPages.find(item => item.page === page);
116
+ const pageEntry = this.validationStatusForSteps.find(item => item.page === page);
121
117
  return pageEntry.message
122
118
  },
123
119
  setErrorOnPage(page, message) {
124
- const exists = this.statusForPages.some(item => item.page === page);
120
+ const exists = this.validationStatusForSteps.some(item => item.page === page);
125
121
 
126
122
  if(!this.inputMade.includes(page)) {
127
123
  this.inputMade.push(page)
128
124
  }
129
125
 
130
126
  if (!exists) {
131
- this.statusForPages.push({ page: page, message: message });
127
+ this.validationStatusForSteps.push({ page: page, message: message });
132
128
  }
133
129
  },
134
130
  removeErrorOnPage(page) {
135
- const index = this.statusForPages.findIndex(item => item.page === page);
131
+ const index = this.validationStatusForSteps.findIndex(item => item.page === page);
136
132
 
137
133
  if(!this.inputMade.includes(page)) {
138
134
  this.inputMade.push(page)
139
135
  }
140
136
 
141
137
  if (index !== -1) {
142
- this.statusForPages.splice(index, 1);
138
+ this.validationStatusForSteps.splice(index, 1);
143
139
  }
144
140
  },
145
141
  setCurrentPage(page) {
@@ -157,24 +153,27 @@ export default {
157
153
  }
158
154
  },
159
155
  computed: {
160
- atleastOnePageWithError() {
161
- return this.statusForPages.length > 0 || this.inputMade.length === 0
156
+ // check if at leat one step has status 'error'
157
+ atleastOneStepWithError() {
158
+ return this.validationStatusForSteps.length > 0 || this.inputMade.length === 0
162
159
  },
160
+ // check if a page ha
163
161
  pageHasError() {
164
- return this.statusForPages.some((item) => {
162
+ return this.validationStatusForSteps.some((item) => {
165
163
  return item.page === this.currentPage
166
164
  })
167
165
  },
166
+ // get steps filled correctly (status 'success')
168
167
  successSteps() {
169
168
  const steps = []
170
169
 
171
170
  if(this.inputMade.length) {
172
171
  for(let i = 0; i < this.numberOfPages; i++) {
173
- const success = !this.statusForPages.find((item) => {
172
+ const success = !this.validationStatusForSteps.find((item) => {
174
173
  return item.page === i + 1
175
174
  })
176
175
 
177
- // if no statusForPages is found (all pages are 'success' ant at least one input was made)
176
+ // if no validationStatusForSteps is found (all steps are 'success' ant at least one input was made)
178
177
  if(success && this.inputMade.includes(i + 1)) {
179
178
  steps.push(i + 1)
180
179
  }
@@ -183,9 +182,10 @@ export default {
183
182
 
184
183
  return steps
185
184
  },
185
+ // get steps filled incorrectly (status 'error')
186
186
  errorSteps() {
187
187
  const steps = []
188
- this.statusForPages.forEach((item) => {
188
+ this.validationStatusForSteps.forEach((item) => {
189
189
  steps.push(item.page)
190
190
  })
191
191
 
@@ -200,9 +200,11 @@ export default {
200
200
 
201
201
  return steps
202
202
  },
203
+ // get number of pages
203
204
  numberOfPages() {
204
205
  return Object.keys(this.$slots).filter(key => key.startsWith("page-")).length
205
206
  },
207
+ // set properties for inner CmdMultistepFormProgressBar
206
208
  cmdMultistepFormProgressBarProperties() {
207
209
  return {
208
210
  show: true,
@@ -210,6 +212,7 @@ export default {
210
212
  ...this.cmdMultistepFormProgressBar
211
213
  }
212
214
  },
215
+ // set properties for inner CmdPagination
213
216
  cmdPaginationProperties() {
214
217
  return {
215
218
  pages: null,
@@ -233,9 +236,11 @@ export default {
233
236
  </script>
234
237
 
235
238
  <style>
239
+ /* begin cmd-multistepform-wrapper ------------------------------------------------------------------------------------------ */
236
240
  .cmd-multistepform-wrapper {
237
241
  display: flex;
238
242
  flex-direction: column;
239
243
  gap: var(--default-gap);
240
244
  }
245
+ /* end cmd-multistepform-wrapper ------------------------------------------------------------------------------------------ */
241
246
  </style>