comand-component-library 3.3.84 → 3.3.86

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/dist/comand-component-library.js +5623 -3929
  2. package/dist/comand-component-library.umd.cjs +4 -4
  3. package/dist/style.css +1 -1
  4. package/package.json +2 -2
  5. package/src/App.vue +215 -112
  6. package/src/assets/data/component-structure.json +228 -0
  7. package/src/assets/data/form-elements.json +156 -0
  8. package/src/assets/data/opening-hours.json +79 -37
  9. package/src/components/CmdAddressData.vue +187 -201
  10. package/src/components/CmdAddressDataItem.vue +306 -0
  11. package/src/components/CmdBox.vue +1 -0
  12. package/src/components/CmdBoxWrapper.vue +53 -5
  13. package/src/components/CmdFancyBox.vue +31 -4
  14. package/src/components/CmdForm.vue +98 -4
  15. package/src/components/CmdFormElement.vue +5 -1
  16. package/src/components/CmdHeadline.vue +179 -52
  17. package/src/components/CmdImage.vue +205 -76
  18. package/src/components/CmdImageGallery.vue +88 -85
  19. package/src/components/CmdListOfLinks.vue +63 -43
  20. package/src/components/CmdListOfLinksItem.vue +97 -0
  21. package/src/components/CmdLoginForm.vue +3 -6
  22. package/src/components/CmdMultistepFormProgressBar.vue +37 -8
  23. package/src/components/CmdOpeningHours.vue +280 -63
  24. package/src/components/CmdOpeningHoursItem.vue +264 -0
  25. package/src/components/{CmdPager.vue → CmdPagination.vue} +2 -2
  26. package/src/components/CmdSlideshow.vue +137 -10
  27. package/src/components/CmdSocialNetworks.vue +115 -28
  28. package/src/components/CmdSocialNetworksItem.vue +184 -0
  29. package/src/components/CmdTable.vue +0 -1
  30. package/src/components/CmdTextImageBlock.vue +158 -0
  31. package/src/components/CmdThumbnailScroller.vue +132 -12
  32. package/src/components/CmdToggleDarkMode.vue +58 -1
  33. package/src/components/EditComponentWrapper.vue +553 -0
  34. package/src/index.js +2 -2
  35. package/src/mixins/EditMode.vue +28 -9
  36. package/src/utils/editmode.js +30 -5
  37. package/src/components/CmdTextBlock.vue +0 -73
  38. package/src/editmode/editModeContext.js +0 -50
@@ -1,31 +1,85 @@
1
1
  <template>
2
- <div v-if="!editModeContext?.editing" :class="['cmd-headline', {'has-pre-headline-text': preHeadlineText, 'has-icon': headlineIcon?.iconClass}, getTextAlign]">
2
+ <div v-if="!editModeContext || settingsContext || mainSidebarContext"
3
+ :class="['cmd-headline', {'has-pre-headline-text': preHeadlineText, 'has-icon': headlineIcon?.iconClass}, getTextAlign]">
3
4
  <!-- begin CmdIcon -->
4
5
  <CmdIcon v-if="headlineIcon" :iconClass="headlineIcon?.iconClass" :type="headlineIcon?.iconType" />
5
6
  <!-- end CmdIcon -->
6
7
 
7
8
  <div v-if="preHeadlineText">
8
9
  <span class="pre-headline-text">{{ preHeadlineText }}</span>
9
- <component :is="getHeadlineTag">
10
+ <component v-if="headlineText" :is="headlineTag">
10
11
  <!-- being slot -->
11
12
  <slot>{{ headlineText }}</slot>
12
13
  <!-- end slot -->
13
14
  </component>
14
15
  </div>
15
- <component v-else :is="getHeadlineTag">
16
+ <component v-else-if="headlineText" :is="headlineTag">
16
17
  <!-- being slot -->
17
18
  <slot>{{ headlineText }}</slot>
18
19
  <!-- end slot -->
19
20
  </component>
20
21
  </div>
21
22
  <!-- begin edit-mode -->
22
- <input v-else type="text" :class="['edit-mode', 'headline', 'h'+ headlineLevel]" v-model="editableHeadlineText" />
23
+ <EditComponentWrapper
24
+ v-else
25
+ ref="editComponentWrapper"
26
+ class="edit-items"
27
+ :showComponentName="false"
28
+ :allowedComponentTypes="[]"
29
+ componentName="CmdHeadline"
30
+ :componentProps="{headlineText, headlineLevel}"
31
+ :componentPath="headlineComponentPath"
32
+ :allowDeleteComponent="!!headlineText"
33
+ >
34
+ <template v-slot="slotProps">
35
+ <CmdFormElement
36
+ v-if="slotProps.editing"
37
+ element="input"
38
+ type="text"
39
+ :class="['edit-mode', 'headline', 'h'+ headlineLevel, getTextAlign]"
40
+ labelText="Headline"
41
+ :showLabel="false"
42
+ placeholder="Headline"
43
+ v-model="editableHeadlineText"
44
+ />
45
+ <div v-else-if="headlineText"
46
+ :class="['cmd-headline', {'has-pre-headline-text': preHeadlineText, 'has-icon': headlineIcon?.iconClass}, getTextAlign]">
47
+ <!-- begin CmdIcon -->
48
+ <CmdIcon v-if="headlineIcon" :iconClass="headlineIcon?.iconClass" :type="headlineIcon?.iconType"/>
49
+ <!-- end CmdIcon -->
50
+
51
+ <div v-if="preHeadlineText">
52
+ <span class="pre-headline-text">{{ preHeadlineText }}</span>
53
+ <component v-if="headlineText" :is="headlineTag">
54
+ <!-- being slot -->
55
+ <slot>{{ headlineText }}</slot>
56
+ <!-- end slot -->
57
+ </component>
58
+ </div>
59
+ <component v-else-if="headlineText" :is="headlineTag">
60
+ <!-- being slot -->
61
+ <slot>{{ headlineText }}</slot>
62
+ <!-- end slot -->
63
+ </component>
64
+ </div>
65
+ <!-- begin show placeholder if no image exists (and component is not edited) -->
66
+ <button v-else-if="componentActive" type="button" class="button confirm" @click="onAddItem">
67
+ <span class="icon-plus"></span>
68
+ <span>Add new headline</span>
69
+ </button>
70
+ <!-- end show placeholder if no image exists (and component is not edited) -->
71
+ </template>
72
+ </EditComponentWrapper>
23
73
  <!-- end edit-mode -->
24
74
  </template>
25
75
 
26
76
  <script>
77
+ import EditMode from "../mixins/EditMode.vue"
78
+ import {buildComponentPath, findEditComponentWrapper, updateHandlerProvider} from "../utils/editmode.js"
79
+
27
80
  export default {
28
81
  name: "CmdHeadline",
82
+ mixins: [EditMode],
29
83
  inject: {
30
84
  editModeContext: {
31
85
  default: null
@@ -33,7 +87,8 @@ export default {
33
87
  },
34
88
  data() {
35
89
  return {
36
- editableHeadlineText: this.headlineText
90
+ editableHeadlineText: null,
91
+ editablePreHeadlineText: null
37
92
  }
38
93
  },
39
94
  props: {
@@ -49,7 +104,7 @@ export default {
49
104
  */
50
105
  headlineLevel: {
51
106
  type: [String, Number],
52
- required: true
107
+ default: "2"
53
108
  },
54
109
  /**
55
110
  * small pre-headline-text above main-headline
@@ -73,16 +128,16 @@ export default {
73
128
  textAlign: {
74
129
  type: String,
75
130
  default: null
76
- },
77
- editModeContextData: {
78
- type: Object
79
131
  }
80
132
  },
81
- mounted() {
82
- this.editModeContext?.addSaveHandler(this.onSave)
83
- },
84
133
  computed: {
85
- getHeadlineTag() {
134
+ componentActive() {
135
+ return this.editModeContext?.system.isActiveComponent(buildComponentPath(findEditComponentWrapper(this)))
136
+ },
137
+ headlineComponentPath() {
138
+ return this.componentPath || ["props", "cmdHeadline"]
139
+ },
140
+ headlineTag() {
86
141
  if(this.headlineLevel) {
87
142
  return "h" + this.headlineLevel
88
143
  }
@@ -96,17 +151,36 @@ export default {
96
151
  }
97
152
  },
98
153
  methods: {
99
- onSave() {
154
+ updateHandlerProvider() {
100
155
  const headlineText = this.editableHeadlineText
101
- return {
102
- editModeContextData: {
103
- ...(this.editModeContextData || {})
104
- },
105
- headlineText,
156
+ const preHeadlineText = this.editablePreHeadlineText
157
+ const headlineLevel = this.headlineLevel
158
+
159
+ return updateHandlerProvider(this, {
106
160
  update(props) {
107
161
  props.headlineText = headlineText
162
+ props.preHeadlineText = preHeadlineText
163
+ props.headlineLevel = headlineLevel
108
164
  }
165
+ })
166
+ },
167
+ onAddItem() {
168
+ // execute editComponent-function from editComponentWrapper to enter editMode directly on "add"
169
+ this.$refs.editComponentWrapper.editComponent()
109
170
  }
171
+ },
172
+ watch: {
173
+ headlineText: {
174
+ handler() {
175
+ this.editableHeadlineText = this.headlineText
176
+ },
177
+ immediate: true
178
+ },
179
+ preHeadlineText: {
180
+ handler() {
181
+ this.editablePreHeadlineText = this.preHeadlineText
182
+ },
183
+ immediate: true
110
184
  }
111
185
  }
112
186
  }
@@ -117,50 +191,103 @@ export default {
117
191
  //@import '../assets/styles/variables';
118
192
 
119
193
  .cmd-headline {
120
- margin-bottom: var(--default-margin);
121
- gap: calc(var(--default-gap) / 2);
194
+ margin-bottom: var(--default-margin);
195
+ gap: calc(var(--default-gap) / 2);
196
+
197
+ &.text-center > * {
198
+ text-align: center;
199
+ }
200
+
201
+ &.text-right > * {
202
+ text-align: right;
203
+ }
204
+
205
+ &.has-pre-headline-text {
206
+ text-align: inherit;
207
+ }
208
+
209
+ p {
210
+ margin-bottom: 0;
211
+ }
212
+
213
+ &:has(span[class*="icon"]) {
214
+ display: flex;
215
+ align-items: center;
216
+ }
217
+
218
+ &:has(h1) span[class*="icon"] {
219
+ font-size: calc(var(--headline-font-size-h1) * 1.6);
220
+ }
221
+
222
+ &:has(h2) span[class*="icon"] {
223
+ font-size: calc(var(--headline-font-size-h2) * 1.8);
224
+ }
122
225
 
123
- &.text-center > * {
124
- text-align: center;
125
- }
226
+ &:has(h3) span[class*="icon"] {
227
+ font-size: calc(var(--headline-font-size-h3) * 1.9);
228
+ }
229
+
230
+ &:has(h4) span[class*="icon"] {
231
+ font-size: calc(var(--headline-font-size-h4) * 2);
232
+ }
126
233
 
127
- &.text-right > * {
128
- text-align: right;
129
- }
234
+ &:has(h5) span[class*="icon"] {
235
+ font-size: calc(var(--headline-font-size-h5) * 2.1);
236
+ }
130
237
 
131
- &.has-icon {
132
- display: flex;
133
- align-items: center;
134
- }
238
+ &:has(h6) span[class*="icon"] {
239
+ font-size: calc(var(--headline-font-size-h6) * 2.2);
240
+ }
135
241
 
136
- &.has-pre-headline-text {
137
- text-align: inherit;
242
+ &:has(h4, h5, h6) .pre-headline-text {
243
+ font-size: var(--font-size-small);
244
+ }
138
245
 
139
- [class*="icon-"] {
140
- font-size: 5rem;
246
+ .pre-headline-text {
247
+ line-height: 1;
141
248
  }
142
- }
143
249
 
144
- p {
145
- margin-bottom: 0;
146
- }
250
+ h1, h2, h3, h4, h5, h6 {
251
+ margin: 0;
147
252
 
148
- h1, h2, h3, h4, h5, h6 {
149
- margin: 0;
253
+ &:only-child {
254
+ flex: none;
255
+ width: 100%;
256
+ }
257
+ }
258
+ }
150
259
 
151
- &:only-child {
152
- flex: none;
153
- width: 100%;
260
+ .edit-mode label.headline {
261
+ input {
262
+ padding: 0;
263
+ height: auto;
264
+ font-weight: var(--headline-font-weight);
154
265
  }
155
- }
156
266
 
157
- //@media only screen and (max-width: $small-max-width) {
158
- // flex-direction: column;
159
- //
160
- // h1 {
161
- // margin-bottom: calc(var(--default-margin) * 2);
162
- // }
163
- //}
267
+ &.h1 input {
268
+ font-size: var(--headline-font-size-h1);
269
+ text-transform: var(--headline-text-transform);
270
+ }
271
+
272
+ &.h2 input {
273
+ font-size: var(--headline-font-size-h2);
274
+ }
275
+
276
+ &.h3 input {
277
+ font-size: var(--headline-font-size-h3);
278
+ }
279
+
280
+ &.h4 input {
281
+ font-size: var(--headline-font-size-h4);
282
+ }
283
+
284
+ &.h5 input {
285
+ font-size: var(--headline-font-size-h5);
286
+ }
287
+
288
+ &.h6 input {
289
+ font-size: var(--headline-font-size-h6);
290
+ }
164
291
  }
165
292
  /* end cmd-headline ------------------------------------------------------------------------------------------ */
166
293
  </style>