@progressive-development/pd-spa-helper 0.4.0 → 0.5.1

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 (198) hide show
  1. package/dist/PdSpaHelper.d.ts.map +1 -1
  2. package/dist/{src/PdSpaHelper.js → PdSpaHelper.js} +16 -17
  3. package/dist/defaultpage/default-confirm-popup.d.ts.map +1 -1
  4. package/dist/{src/defaultpage → defaultpage}/default-confirm-popup.js +4 -5
  5. package/dist/defaultpage/default-dialog-popup.d.ts.map +1 -1
  6. package/dist/{src/defaultpage → defaultpage}/default-dialog-popup.js +4 -5
  7. package/dist/{src/defaultpage → defaultpage}/default-login.js +2 -3
  8. package/dist/defaultpage/default-popup.d.ts.map +1 -1
  9. package/dist/{src/defaultpage → defaultpage}/default-popup.js +1 -1
  10. package/dist/{src/defaultpage → defaultpage}/default-step-address.js +5 -6
  11. package/dist/{src/defaultpage → defaultpage}/default-step-summary.js +6 -7
  12. package/dist/{src/defaultpage → defaultpage}/default-view-page.js +2 -3
  13. package/dist/{src/defaultpage → defaultpage}/default-wizard-step.js +4 -5
  14. package/dist/defaultpage/default-wizard.d.ts.map +1 -1
  15. package/dist/{src/defaultpage → defaultpage}/default-wizard.js +7 -8
  16. package/dist/generated/locale-wrapper/be-wrapper.d.ts +15 -1
  17. package/dist/generated/locale-wrapper/be-wrapper.d.ts.map +1 -1
  18. package/dist/generated/locale-wrapper/be-wrapper.js +17 -0
  19. package/dist/generated/locale-wrapper/de-wrapper.d.ts.map +1 -1
  20. package/dist/generated/locale-wrapper/de-wrapper.js +17 -0
  21. package/dist/generated/locale-wrapper/en-wrapper.d.ts +15 -1
  22. package/dist/generated/locale-wrapper/en-wrapper.d.ts.map +1 -1
  23. package/dist/generated/locale-wrapper/en-wrapper.js +17 -0
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +21 -21
  27. package/dist/pd-panel-viewer.js +10 -12
  28. package/dist/pd-panel.js +2 -3
  29. package/dist/{src/popup → popup}/wizard-close-popup.js +3 -5
  30. package/dist/{src/popup → popup}/wizard-reload-popup.js +3 -5
  31. package/dist/{src/router → router}/AppMain.js +4 -5
  32. package/dist/{src/service-provider → service-provider}/firebase/auth.js +1 -4
  33. package/dist/{src/service-provider → service-provider}/firebase/firestorage-client.js +1 -1
  34. package/dist/{src/service-provider → service-provider}/firebase/firestore-client.js +1 -1
  35. package/dist/{src/service-provider → service-provider}/firebase/functions-client.js +1 -1
  36. package/dist/{src/service-provider → service-provider}/firebase/messagingFirebaseClient.js +2 -2
  37. package/dist/{src/service-provider → service-provider}/service-provider-impl.js +1 -2
  38. package/dist/{src/store → store}/mini-rx.store.js +1 -1
  39. package/dist/{src/store → store}/spa-app-effects.js +2 -2
  40. package/dist/{src/store → store}/spa-app-selector.js +1 -1
  41. package/dist/stories/pd-loading-state.stories.d.ts +3 -3
  42. package/dist/stories/pd-toast.stories.d.ts +3 -3
  43. package/dist/tmpown/pd-loading-state.d.ts.map +1 -1
  44. package/dist/{src/tmpown → tmpown}/pd-loading-state.js +6 -8
  45. package/dist/tmpown/pd-login.d.ts.map +1 -1
  46. package/dist/{src/tmpown → tmpown}/pd-login.js +6 -7
  47. package/dist/tmpown/pd-panel-viewer.d.ts.map +1 -1
  48. package/dist/{src/tmpown → tmpown}/pd-toast.js +5 -7
  49. package/package.json +29 -23
  50. package/dist/node_modules/@firebase/app/dist/esm/index.esm2017.js +0 -749
  51. package/dist/node_modules/@firebase/auth/dist/esm2017/index-68602d24.js +0 -6265
  52. package/dist/node_modules/@firebase/component/dist/esm/index.esm2017.js +0 -341
  53. package/dist/node_modules/@firebase/firestore/dist/index.esm2017.js +0 -10250
  54. package/dist/node_modules/@firebase/functions/dist/index.esm2017.js +0 -513
  55. package/dist/node_modules/@firebase/installations/dist/esm/index.esm2017.js +0 -863
  56. package/dist/node_modules/@firebase/logger/dist/esm/index.esm2017.js +0 -122
  57. package/dist/node_modules/@firebase/messaging/dist/esm/index.esm2017.js +0 -1019
  58. package/dist/node_modules/@firebase/storage/dist/index.esm2017.js +0 -2042
  59. package/dist/node_modules/@firebase/util/dist/index.esm2017.js +0 -931
  60. package/dist/node_modules/@firebase/webchannel-wrapper/dist/bloom-blob/esm/bloom_blob_es2018.js +0 -417
  61. package/dist/node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js +0 -2155
  62. package/dist/node_modules/@lit/reactive-element/decorators/custom-element.js +0 -14
  63. package/dist/node_modules/@lit/reactive-element/decorators/property.js +0 -20
  64. package/dist/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js +0 -7
  65. package/dist/node_modules/@progressive-development/pd-dialog/pd-popup-dialog.js +0 -5
  66. package/dist/node_modules/@progressive-development/pd-dialog/pd-popup.js +0 -2
  67. package/dist/node_modules/@progressive-development/pd-dialog/src/PdPopup.js +0 -113
  68. package/dist/node_modules/@progressive-development/pd-dialog/src/PdPopupDialog.js +0 -189
  69. package/dist/node_modules/@progressive-development/pd-forms/pd-button.js +0 -2
  70. package/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +0 -2
  71. package/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +0 -2
  72. package/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +0 -2
  73. package/dist/node_modules/@progressive-development/pd-forms/pd-input.js +0 -2
  74. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +0 -86
  75. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +0 -34
  76. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +0 -227
  77. package/dist/node_modules/@progressive-development/pd-forms/src/PdButton.js +0 -194
  78. package/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +0 -167
  79. package/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +0 -92
  80. package/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +0 -108
  81. package/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +0 -79
  82. package/dist/node_modules/@progressive-development/pd-forms/src/generated/locale/be.js +0 -11
  83. package/dist/node_modules/@progressive-development/pd-forms/src/generated/locale/en.js +0 -11
  84. package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +0 -152
  85. package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +0 -64
  86. package/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +0 -4
  87. package/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +0 -596
  88. package/dist/node_modules/@progressive-development/pd-order/dist/locales/be.js +0 -15
  89. package/dist/node_modules/@progressive-development/pd-order/dist/locales/de.js +0 -15
  90. package/dist/node_modules/@progressive-development/pd-order/dist/locales/en.js +0 -15
  91. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-contact/pd-contact.js +0 -2
  92. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-contact/src/PdContact.js +0 -567
  93. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/pd-collapse.js +0 -2
  94. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/pd-edit-content.js +0 -2
  95. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/src/PdCollapse.js +0 -136
  96. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/src/PdEditContent.js +0 -224
  97. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-dialog/pd-popup.js +0 -2
  98. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-dialog/src/PdPopup.js +0 -113
  99. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-checkbox.js +0 -2
  100. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +0 -2
  101. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +0 -2
  102. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +0 -2
  103. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-input.js +0 -2
  104. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-radio-group.js +0 -2
  105. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +0 -86
  106. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +0 -34
  107. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +0 -229
  108. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdCheckbox.js +0 -230
  109. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +0 -167
  110. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +0 -92
  111. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +0 -108
  112. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +0 -79
  113. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdRadioGroup.js +0 -72
  114. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +0 -152
  115. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +0 -64
  116. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +0 -4
  117. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +0 -596
  118. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-price/pd-pricetable.js +0 -2
  119. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-price/src/PdPricetable.js +0 -149
  120. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/fecha/lib/fecha.js +0 -200
  121. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/directive.js +0 -27
  122. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/directives/class-map.js +0 -36
  123. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/lit-html.js +0 -242
  124. package/dist/node_modules/@progressive-development/pd-order/dist/pd-order-contacts.js +0 -2
  125. package/dist/node_modules/@progressive-development/pd-order/dist/pd-order-summary.js +0 -2
  126. package/dist/node_modules/@progressive-development/pd-order/dist/src/PdOrderContacts.js +0 -192
  127. package/dist/node_modules/@progressive-development/pd-order/dist/src/PdOrderSummary.js +0 -243
  128. package/dist/node_modules/@progressive-development/pd-page/pd-footer.js +0 -2
  129. package/dist/node_modules/@progressive-development/pd-page/pd-menu.js +0 -2
  130. package/dist/node_modules/@progressive-development/pd-page/src/PdFooter.js +0 -141
  131. package/dist/node_modules/@progressive-development/pd-page/src/PdMenu.js +0 -450
  132. package/dist/node_modules/@progressive-development/pd-shared-styles/src/shared-color-styles.js +0 -30
  133. package/dist/node_modules/@progressive-development/pd-shared-styles/src/shared-font-styles.js +0 -32
  134. package/dist/node_modules/@progressive-development/pd-wizard/pd-wizard.js +0 -2
  135. package/dist/node_modules/@progressive-development/pd-wizard/src/PdSteps.js +0 -191
  136. package/dist/node_modules/@progressive-development/pd-wizard/src/PdWizard.js +0 -280
  137. package/dist/node_modules/firebase/app/dist/esm/index.esm.js +0 -35
  138. package/dist/node_modules/idb/build/index.js +0 -81
  139. package/dist/node_modules/idb/build/wrap-idb-value.js +0 -148
  140. package/dist/node_modules/lit/node_modules/lit-html/directive.js +0 -27
  141. package/dist/node_modules/lit/node_modules/lit-html/directives/class-map.js +0 -36
  142. package/dist/node_modules/lit/node_modules/lit-html/lit-html.js +0 -242
  143. package/dist/node_modules/lit-element-router/lit-element-router.js +0 -131
  144. package/dist/node_modules/lit-element-router/utility/router-utility.js +0 -36
  145. package/dist/node_modules/mini-rx-store/index.esm.js +0 -458
  146. package/dist/node_modules/pwa-helpers/media-query.js +0 -17
  147. package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -100
  148. package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -147
  149. package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -139
  150. package/dist/node_modules/rxjs/dist/esm5/internal/config.js +0 -10
  151. package/dist/node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js +0 -159
  152. package/dist/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js +0 -52
  153. package/dist/node_modules/rxjs/dist/esm5/internal/operators/catchError.js +0 -28
  154. package/dist/node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js +0 -27
  155. package/dist/node_modules/rxjs/dist/esm5/internal/operators/filter.js +0 -13
  156. package/dist/node_modules/rxjs/dist/esm5/internal/operators/map.js +0 -13
  157. package/dist/node_modules/rxjs/dist/esm5/internal/operators/observeOn.js +0 -26
  158. package/dist/node_modules/rxjs/dist/esm5/internal/operators/tap.js +0 -36
  159. package/dist/node_modules/rxjs/dist/esm5/internal/operators/withLatestFrom.js +0 -43
  160. package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -18
  161. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/iterator.js +0 -11
  162. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -6
  163. package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -14
  164. package/dist/node_modules/rxjs/dist/esm5/internal/util/args.js +0 -10
  165. package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -9
  166. package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -13
  167. package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -8
  168. package/dist/node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js +0 -23
  169. package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -6
  170. package/dist/node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js +0 -6
  171. package/dist/node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js +0 -7
  172. package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -6
  173. package/dist/node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js +0 -8
  174. package/dist/node_modules/rxjs/dist/esm5/internal/util/isIterable.js +0 -8
  175. package/dist/node_modules/rxjs/dist/esm5/internal/util/isPromise.js +0 -7
  176. package/dist/node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js +0 -46
  177. package/dist/node_modules/rxjs/dist/esm5/internal/util/lift.js +0 -22
  178. package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -5
  179. package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -17
  180. package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -11
  181. package/dist/node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js +0 -6
  182. package/dist/pd-spa-helper.d.ts +0 -1
  183. package/dist/pd-spa-helper.d.ts.map +0 -1
  184. package/dist/src/generated/locale-wrapper/be-wrapper.js +0 -15
  185. package/dist/src/generated/locale-wrapper/de-wrapper.js +0 -13
  186. package/dist/src/generated/locale-wrapper/en-wrapper.js +0 -15
  187. /package/dist/{src/generated → generated}/locales/be.js +0 -0
  188. /package/dist/{src/generated → generated}/locales/de.js +0 -0
  189. /package/dist/{src/generated → generated}/locales/en.js +0 -0
  190. /package/dist/{src/helper → helper}/helper-utils.js +0 -0
  191. /package/dist/{src/model → model}/spa-model.js +0 -0
  192. /package/dist/{src/service-provider → service-provider}/mock/auth.js +0 -0
  193. /package/dist/{src/service-provider → service-provider}/mock/function-client.js +0 -0
  194. /package/dist/{src/service-provider → service-provider}/mock/storage-client.js +0 -0
  195. /package/dist/{src/service-provider → service-provider}/service-provider-model.js +0 -0
  196. /package/dist/{src/store → store}/indexDB.js +0 -0
  197. /package/dist/{src/store → store}/spa-app-actions.js +0 -0
  198. /package/dist/{src/store → store}/spa-app-reducer.js +0 -0
@@ -1,567 +0,0 @@
1
- import { LitElement, css, html } from "lit";
2
- import "../../../../../../pd-shared-styles/src/shared-color-styles.js";
3
- import { PDFontStyles } from "../../../../../../pd-shared-styles/src/shared-font-styles.js";
4
- import "../../pd-icon/pd-icon.js";
5
- import "../../pd-forms/pd-checkbox.js";
6
- import "../../pd-forms/pd-form-container.js";
7
- import "../../pd-forms/pd-form-row.js";
8
- import "../../pd-forms/pd-input.js";
9
- import "../../pd-forms/pd-radio-group.js";
10
- /**
11
- * @license
12
- * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
13
- */
14
- const countryPrefixes = {
15
- de: "+49",
16
- // Deutschland
17
- be: "+32",
18
- // Belgien
19
- nl: "+31",
20
- // Niederland
21
- fr: "+33",
22
- // Frankreich
23
- es: "+34"
24
- // Spanien
25
- };
26
- function transformPhone(phone, country) {
27
- if (!phone || typeof phone !== "string") {
28
- return "";
29
- }
30
- const countryPrefix = countryPrefixes[country];
31
- if (!countryPrefix) {
32
- throw new Error(`Unbekanntes Land: ${country}`);
33
- }
34
- const cleanedPhone = phone.replace(/\s+/g, "").replace(/[^0-9+]/g, "");
35
- if (cleanedPhone.startsWith("+")) {
36
- return cleanedPhone;
37
- }
38
- if (cleanedPhone.startsWith("0")) {
39
- return countryPrefix + cleanedPhone.slice(1);
40
- }
41
- return "";
42
- }
43
- class PdContact extends LitElement {
44
- static get styles() {
45
- return [
46
- PDFontStyles,
47
- css`
48
- :host {
49
- display: block;
50
- }
51
-
52
- .contact {
53
- display: flex;
54
- flex-direction: column;
55
- }
56
-
57
- address {
58
- color: var(--pd-contact-address-col, var(--pd-default-font-content-col));
59
- line-height: 1.8;
60
- font-style: normal;
61
- }
62
-
63
- dl {
64
- margin: 0;
65
- padding: 0;
66
- }
67
-
68
- dt {
69
- font-weight: bold;
70
- padding-top: 10px;
71
- color: var(--pd-contact-address-title-col, var(--pd-default-font-title-col));
72
- }
73
-
74
- dd {
75
- font-weight: 400;
76
- font-size: 1em;
77
- margin: 0;
78
- padding: 0;
79
- }
80
-
81
- dd.larger {
82
- padding-top: 3px;
83
- padding-bottom: 5px;
84
- }
85
-
86
- .contact-form {
87
- --row-padding-top: 10px;
88
- }
89
-
90
- .link-icon {
91
- --pd-icon-bg-col-active: #859900;
92
- --pd-icon-bg-col-hover: #859900;
93
- --pd-icon-size: 14px;
94
- --pd-icon-stroke-col-active: white;
95
- --pd-icon-col-active: white;
96
- }
97
-
98
- .link-item {
99
- display: flex;
100
- align-items: center;
101
- text-decoration: none;
102
- color: var(--pd-default-font-link-col, inherit);
103
- }
104
-
105
- .link-item:hover {
106
- color: var(--pd-default-font-link-col-hover, #451A46) ;
107
- }
108
-
109
- `
110
- ];
111
- }
112
- static get properties() {
113
- return {
114
- addressTitle: { type: String },
115
- addressRef: { type: String },
116
- /**
117
- * show (true) or not (false) tel number as link
118
- */
119
- phoneMailLink: { type: Boolean },
120
- /**
121
- * summary (true) or view (false) contact data
122
- */
123
- summary: { type: Boolean },
124
- /**
125
- * List with required contact fields, if not set use default (previous existing values to be consitent during update)
126
- */
127
- requiredFields: { type: Array },
128
- contact: { type: Object },
129
- match: { type: Object },
130
- /**
131
- * address type, business (true) or private (false), refactor, ist state internal? => _business, state:true
132
- */
133
- _business: { type: Boolean, state: true },
134
- _errorMap: { type: Object }
135
- };
136
- }
137
- constructor() {
138
- super();
139
- this.addressTitle = "Adres";
140
- this.requiredFields = [];
141
- this.summary = false;
142
- this.match = {};
143
- this._business = false;
144
- this._errorMap = /* @__PURE__ */ new Map();
145
- }
146
- update(changedProperties) {
147
- if (changedProperties.has("contact") && this.contact) {
148
- this._business = this.contact.business;
149
- }
150
- super.update(changedProperties);
151
- }
152
- connectedCallback() {
153
- super.connectedCallback();
154
- this.addEventListener("validate-form", this._validateForm);
155
- }
156
- disconnectedCallback() {
157
- super.connectedCallback();
158
- this.removeEventListener("validate-form", this._validateForm);
159
- }
160
- firstUpdated() {
161
- var _a, _b;
162
- this.addEventListener("key-pressed", (e) => {
163
- this._errorMap.set(e.detail.name, "");
164
- super.requestUpdate();
165
- });
166
- if (this.contact) {
167
- const detail = {
168
- errorMap: /* @__PURE__ */ new Map()
169
- };
170
- (_b = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById("contactContainerId")) == null ? void 0 : _b.dispatchEvent(
171
- new CustomEvent("validate-form", { detail })
172
- );
173
- }
174
- }
175
- render() {
176
- return html`
177
- <div class="contact">
178
- ${this.summary ? this._renderViewContact() : this._renderEditContact()}
179
- </div>
180
- `;
181
- }
182
- _renderEditContact() {
183
- return html`
184
- <pd-form-container id="contactContainerId" requiredFieldInfo>
185
- <pd-form-row id="testFormId">
186
- <pd-radio-group
187
- class="quarter3"
188
- label="Type"
189
- required
190
- value="${this._getRadioValue()}"
191
- @field-change="${this._switchAddressType}"
192
- style="--group-gap: 20px;"
193
- >
194
- <pd-checkbox value="${this.contact ? !this.contact.business : true}" valueName="private"
195
- >Particulier</pd-checkbox
196
- >
197
- <pd-checkbox valueName="business" value="${this.contact ? this.contact.business : false}">Onderneming</pd-checkbox>
198
- </pd-radio-group>
199
- </pd-form-row>
200
-
201
- ${this._business ? html`
202
- <pd-form-row class="contact-form">
203
- <pd-input
204
- id="compNameId"
205
- class="quarter3"
206
- label="Naam onderneming"
207
- ?required="${this._isRequired("companyName")}"
208
- value="${this.contact ? this.contact.companyName : ""}"
209
- valueName="companyName"
210
- autoCompleteName="organization"
211
- ></pd-input>
212
- </pd-form-row>
213
- <pd-form-row class="contact-form">
214
- <pd-input
215
- id="vatId"
216
- class="quarter3"
217
- label="Ondernemingsnr"
218
- ?required="${this._isRequired("vatNr")}"
219
- field-type="vat"
220
- valueName="vatNr"
221
- value="${this.contact ? this.contact.vatNr : ""}"
222
- autoCompleteName="vat"
223
- ></pd-input>
224
- </pd-form-row>
225
- ` : html`
226
- <pd-form-row class="contact-form">
227
- <pd-input
228
- id="firstNameId"
229
- class="quarter3"
230
- label="Voornaam"
231
- valueName="firstName"
232
- value="${this.contact ? this.contact.firstName : ""}"
233
- autoCompleteName="given-name"
234
- ?required="${this._isRequired("firstName")}"
235
- ></pd-input>
236
- </pd-form-row>
237
- <pd-form-row class="contact-form">
238
- <pd-input
239
- id="lastNameId"
240
- class="quarter3"
241
- label="Naam"
242
- valueName="lastName"
243
- value="${this.contact ? this.contact.lastName : ""}"
244
- autoCompleteName="family-name"
245
- ?required="${this._isRequired("lastName")}"
246
- ></pd-input>
247
- </pd-form-row>
248
- `}
249
- <pd-form-row class="contact-form">
250
- <pd-input
251
- id="streetId"
252
- class="quarter2"
253
- label="Straat"
254
- valueName="street"
255
- value="${this.contact ? this.contact.street : ""}"
256
- autoCompleteName="street-address"
257
- ?required="${this._isRequired("street")}"
258
- ></pd-input>
259
- <pd-input
260
- id="streetNrId"
261
- class="quarter1"
262
- label="Nr"
263
- valueName="streetNr"
264
- value="${this.contact ? this.contact.streetNr : ""}"
265
- ?required="${this._isRequired("streetNr")}"
266
- ></pd-input>
267
- </pd-form-row>
268
- <pd-form-row class="contact-form">
269
- ${this.match && this.match.zip ? html`
270
- <pd-input
271
- readonly
272
- id="zipId"
273
- class="quarter1"
274
- label="Postcode"
275
- valueName="zip"
276
- value="${this.match ? this.match.zip || "" : ""}"
277
- ></pd-input>
278
- ` : html`
279
- <pd-input
280
- id="zipId"
281
- class="quarter1"
282
- label="Postcode"
283
- field-type="number"
284
- valueName="zip"
285
- value="${this.contact ? this.contact.zip : ""}"
286
- autoCompleteName="postal-code"
287
- ?required="${this._isRequired("zip")}"
288
- ></pd-input>
289
- `}
290
- <pd-input
291
- id="cityId"
292
- class="quarter2"
293
- label="Plaats"
294
- valueName="city"
295
- value="${this.contact ? this.contact.city : ""}"
296
- autoCompleteName="locality"
297
- ?required="${this._isRequired("city")}"
298
- ></pd-input>
299
- </pd-form-row>
300
- <pd-form-row class="contact-form">
301
- <pd-input
302
- class="quarter3"
303
- id="additionalHintId"
304
- label="Extra informatie"
305
- value="${this.contact ? this.contact.additionalHint : ""}"
306
- ></pd-input>
307
- </pd-form-row>
308
- <pd-form-row class="contact-form">
309
- <pd-input
310
- id="phoneId"
311
- class="quarter3"
312
- label="Telefoon"
313
- name="phone"
314
- valueName="phone1"
315
- value="${this.contact ? this.contact.phone1 : ""}"
316
- field-type="phone"
317
- autoCompleteName="tel"
318
- ?required="${this._isRequired("phone1")}"
319
- ></pd-input>
320
- </pd-form-row>
321
- <pd-form-row class="contact-form">
322
- <pd-input
323
- id="mailId"
324
- class="quarter3"
325
- label="E-mail"
326
- field-type="mail"
327
- valueName="email"
328
- value="${this.contact ? this.contact.email : ""}"
329
- autoCompleteName="email"
330
- ?required="${this._isRequired("email")}"
331
- ></pd-input>
332
- </pd-form-row>
333
- </pd-form-container>
334
- `;
335
- }
336
- _getRadioValue() {
337
- if (this.contact) {
338
- return this.contact.business ? "business" : "private";
339
- }
340
- return "private";
341
- }
342
- _renderViewContact() {
343
- if (!this.contact) {
344
- return html`<p>Contact undefined</p>`;
345
- }
346
- const trPhoneNr = transformPhone(this.contact.phone1, this.contact.country || "be");
347
- return html`
348
- <address>
349
- <dl>
350
- <dt>${this.addressTitle}</dt>
351
- ${this.contact ? html`
352
- <dd>${this.contact.companyName}</dd>
353
- <dd>${this.contact.vatNr}</dd>
354
- <dd>${this._getFullName()}</dd>
355
- <dd>${this._getFullStreet()}</dd>
356
- <dd>${this._getFullLocation()}</dd>
357
- ${this.contact.additionalHint ? html`<dd>${this.contact.additionalHint}</dd>` : ""}
358
- <dd>${this.contact.country}</dd>
359
-
360
- ${this.contact.phone1 ? html`
361
- <dd class="larger">${this.phoneMailLink && trPhoneNr ? html`
362
- <a href="${`tel:${trPhoneNr}`}"
363
- aria-label="${`Phone call: ${this.contact.phone1}`}"
364
- class="link-item">
365
- <span style="margin-right: 8px;">${this.contact.phone1}</span>
366
- <pd-icon activeIcon icon="phoneIcon" class="round link-icon"></pd-icon>
367
- </a>
368
- ` : this.contact.phone1}</dd>
369
- ` : ""}
370
-
371
- ${this.contact.email ? html`
372
- <dd class="larger">${this.phoneMailLink ? html`
373
- <a href="${`mailto:${this.contact.email}`}"
374
- aria-label="${`Send mail: ${this.contact.email}`}"
375
- class="link-item">
376
- <span style="margin-right: 8px;">${this.contact.email}</span>
377
- <pd-icon activeIcon icon="mailIcon" class="round link-icon"></pd-icon>
378
- </a>
379
- ` : this.contact.email}</dd>
380
- ` : ""}
381
-
382
- ${this.contact.btw ? html`<dt>BTW</dt>
383
- <dd>${this.contact.btw}</dd>` : ""}
384
- ${this.contact.kbc ? html`<dt>Bankgegevens</dt>
385
- <dd>${this.contact.kbc}</dd>
386
- <dd>${this.contact.bank}</dd>` : ""}
387
- ` : html`${this.addressRef || "--"}`}
388
- </dl>
389
- </address>
390
- `;
391
- }
392
- _switchAddressType(e) {
393
- this._business = e.detail.name === "business";
394
- }
395
- _isRequired(field) {
396
- return this.requiredFields && this.requiredFields.length > 0 ? this.requiredFields.includes(field) : false;
397
- }
398
- /*
399
- validateInput() {
400
- const matchForValidate = this.match || {};
401
-
402
- const companyName = this.business
403
- ? this.shadowRoot.getElementById('compNameId').value
404
- : undefined;
405
- const vatNr = this.business
406
- ? this.shadowRoot.getElementById('vatId').value
407
- : undefined;
408
- const firstName = this.business
409
- ? undefined
410
- : this.shadowRoot.getElementById('firstNameId').value;
411
- const lastName = this.business
412
- ? undefined
413
- : this.shadowRoot.getElementById('lastNameId').value;
414
- const street = this.shadowRoot.getElementById('streetId').value;
415
- const streetNr = this.shadowRoot.getElementById('streetNrId').value;
416
- const additionalHint =
417
- this.shadowRoot.getElementById('additionalHintId').value;
418
- const zip = this.shadowRoot.getElementById('zipId').value;
419
- const city = this.shadowRoot.getElementById('cityId').value;
420
- const phone1 = this.shadowRoot.getElementById('phoneId').value;
421
- const email = this.shadowRoot.getElementById('mailId').value;
422
-
423
- const newErrorMap = new Map();
424
-
425
- const reqFieldFunc = (field, key, type, mustMatch) => {
426
- if (!field || field === '') {
427
- newErrorMap.set(
428
- key,
429
- type !== 'phone'
430
- ? 'Vul dit veld in.'
431
- : 'Vul dit veld in. Gebruik +32 494 667085.'
432
- );
433
- } else if (mustMatch && field !== mustMatch) {
434
- newErrorMap.set(key, `Not match ${mustMatch}`);
435
- } else {
436
- switch (type) {
437
- case 'vat':
438
- // eslint-disable-next-line no-restricted-globals
439
- if (!newErrorMap.has(key) && !PdContact._vatIsValid(field)) {
440
- newErrorMap.set(key, 'Formaat BE0123456789 vereist');
441
- }
442
- break;
443
- case 'number':
444
- // eslint-disable-next-line no-restricted-globals
445
- if (!newErrorMap.has(key) && isNaN(field)) {
446
- newErrorMap.set(key, 'Alleen nummers toegestaan');
447
- }
448
- break;
449
- case 'mail':
450
- if (!newErrorMap.has(key) && !PdContact._mailIsValid(field)) {
451
- newErrorMap.set(key, 'Ongeldig e-mailadres');
452
- }
453
- break;
454
- case 'phone':
455
- if (!newErrorMap.has(key) && !PdContact._phoneIsValid(field)) {
456
- newErrorMap.set(
457
- key,
458
- 'Ongeldig telefoonnummer, gebruik +32 494 667085.'
459
- );
460
- }
461
- break;
462
- default:
463
- console.warn('Undefined field: ', type);
464
- }
465
- }
466
- };
467
-
468
- if (this.business) {
469
- reqFieldFunc(companyName, 'companyName');
470
- reqFieldFunc(vatNr, 'vatNr', 'vat');
471
- } else {
472
- reqFieldFunc(firstName, 'firstName');
473
- reqFieldFunc(lastName, 'lastName');
474
- }
475
- reqFieldFunc(street, 'street');
476
- reqFieldFunc(streetNr, 'streetNr');
477
- reqFieldFunc(zip, 'zip', 'number', matchForValidate.zip);
478
- reqFieldFunc(city, 'city');
479
- reqFieldFunc(phone1, 'phone1', 'phone');
480
- reqFieldFunc(email, 'email', 'mail');
481
- this._errorMap = newErrorMap;
482
-
483
- return new Promise((resolve, reject) => {
484
- if (newErrorMap.size > 0) {
485
- reject();
486
- } else {
487
- this.contact = {
488
- business: this.business,
489
- companyName,
490
- vatNr,
491
- firstName,
492
- lastName,
493
- street,
494
- streetNr,
495
- additionalHint,
496
- zip,
497
- city,
498
- phone1,
499
- email,
500
- };
501
- resolve(this.contact);
502
- }
503
- });
504
- }
505
- */
506
- _validateForm(e) {
507
- if (e.detail && !e.detail.singleElement) {
508
- this.shadowRoot.getElementById("contactContainerId").dispatchEvent(
509
- new CustomEvent("validate-form", {
510
- detail: e.detail
511
- })
512
- );
513
- if (e.detail.errorMap.size === 0 && e.detail.formData) {
514
- e.detail.formData[this.id] = this._setFormData();
515
- }
516
- }
517
- }
518
- _setFormData() {
519
- const companyName = this._business ? this.shadowRoot.getElementById("compNameId").value : void 0;
520
- const vatNr = this._business ? this.shadowRoot.getElementById("vatId").value : void 0;
521
- const firstName = this._business ? void 0 : this.shadowRoot.getElementById("firstNameId").value;
522
- const lastName = this._business ? void 0 : this.shadowRoot.getElementById("lastNameId").value;
523
- const street = this.shadowRoot.getElementById("streetId").value;
524
- const streetNr = this.shadowRoot.getElementById("streetNrId").value;
525
- const additionalHint = this.shadowRoot.getElementById("additionalHintId").value;
526
- const zip = this.shadowRoot.getElementById("zipId").value;
527
- const city = this.shadowRoot.getElementById("cityId").value;
528
- const phone1 = this.shadowRoot.getElementById("phoneId").value;
529
- const email = this.shadowRoot.getElementById("mailId").value;
530
- return {
531
- business: this._business,
532
- companyName,
533
- vatNr,
534
- firstName,
535
- lastName,
536
- street,
537
- streetNr,
538
- additionalHint,
539
- zip,
540
- city,
541
- phone1,
542
- email
543
- };
544
- }
545
- _getFullName() {
546
- return PdContact._getFullVal(this.contact.firstName, this.contact.lastName);
547
- }
548
- _getFullStreet() {
549
- return PdContact._getFullVal(this.contact.street, this.contact.streetNr);
550
- }
551
- _getFullLocation() {
552
- return PdContact._getFullVal(this.contact.zip, this.contact.city);
553
- }
554
- static _getFullVal(val1, val2, elseStr) {
555
- let fullVal = "";
556
- if (val1) {
557
- fullVal += val1;
558
- }
559
- if (val2) {
560
- fullVal += ` ${val2}`;
561
- }
562
- return fullVal.length === 0 ? elseStr : fullVal;
563
- }
564
- }
565
- export {
566
- PdContact
567
- };
@@ -1,2 +0,0 @@
1
- import { PdCollapse } from "./src/PdCollapse.js";
2
- window.customElements.define("pd-collapse", PdCollapse);
@@ -1,2 +0,0 @@
1
- import { PdEditContent } from "./src/PdEditContent.js";
2
- window.customElements.define("pd-edit-content", PdEditContent);