comand-component-library 3.3.74 → 3.3.76

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,27 +1,83 @@
1
1
  <template>
2
2
  <div class="grid-container-create-columns cmd-image-gallery">
3
- <a v-for="(image, index) in images"
4
- :key="index"
5
- @click.prevent="showFancyBox(index)"
6
- href="#"
7
- :title="getMessage('cmdimagegallery.tooltip.open_large_image')">
8
- <CmdImage :image="image.image" :figcaption="image.figcaption" />
9
- </a>
3
+ <!-- begin cmd-headline -->
4
+ <CmdHeadline
5
+ v-if="cmdHeadline"
6
+ :headlineText="cmdHeadline.headlineText"
7
+ :headlineLevel="cmdHeadline.headlineLevel"
8
+ />
9
+ <!-- end cmd-headline -->
10
+
11
+ <!-- begin default view -->
12
+ <template v-if="!editModeContext">
13
+ <!-- begin images linked to fancybox -->
14
+ <a v-if="useFancyboxForLargeImages" class="image-wrapper" v-for="(image, index) in images"
15
+ :key="index"
16
+ href="#"
17
+ @click.prevent="showFancyBox(index)"
18
+ :title="getMessage('cmdimagegallery.tooltip.open_large_image')">
19
+ <CmdImage :image="image.image" :figcaption="image.figcaption"/>
20
+ </a>
21
+ <!-- end images linked to fancybox -->
22
+
23
+ <!-- begin images not linked to fancybox -->
24
+ <CmdImage v-else :image="image.image" :figcaption="image.figcaption"/>
25
+ <!-- end images not linked to fancybox -->
26
+ </template>
27
+ <!-- end default view -->
28
+
29
+ <!-- begin edit-mode view -->
30
+ <EditComponentWrapper class="image-wrapper" v-else v-for="(image, index) in images" :key="'x' + index" :componentIdentifier="componentIdentifier(index)">
31
+ <CmdImage
32
+ :image="image.image"
33
+ :figcaption="image.figcaption"
34
+ :editModeContextData="{imageIndex: index}"
35
+ />
36
+ </EditComponentWrapper>
37
+ <!-- end edit-mode view -->
10
38
  </div>
11
39
  </template>
12
40
 
13
41
  <script>
14
42
  // import functions
15
43
  import {openFancyBox} from "./CmdFancyBox.vue"
44
+ import {useEditModeContext} from "../editmode/editModeContext.js"
16
45
 
17
46
  // import mixins
18
- import I18n from "../mixins/I18n"
19
- import DefaultMessageProperties from "../mixins/CmdImageGallery/DefaultMessageProperties"
47
+ //import I18n from "../mixins/I18n"
48
+ //import DefaultMessageProperties from "../mixins/CmdImageGallery/DefaultMessageProperties"
20
49
 
21
50
  export default {
22
51
  name: "CmdImageGallery",
23
- mixins: [I18n, DefaultMessageProperties],
52
+ mixins: [],
53
+ provide() {
54
+ return {
55
+ editModeContext: this.context
56
+ }
57
+ },
58
+ inject: {
59
+ editModeContext: {
60
+ default: null
61
+ }
62
+ },
24
63
  props: {
64
+ editModeContextData: {
65
+ type: Object
66
+ },
67
+ /**
68
+ * properties for CmdHeadline-component
69
+ */
70
+ cmdHeadline: {
71
+ type: Object,
72
+ required: false
73
+ },
74
+ /**
75
+ * set if large version of images can be opened in a fancybox
76
+ */
77
+ useFancyboxForLargeImages: {
78
+ type: Boolean,
79
+ default: true
80
+ },
25
81
  /**
26
82
  * list of images (incl. captions)
27
83
  *
@@ -41,9 +97,48 @@ export default {
41
97
  default: "bottom"
42
98
  }
43
99
  },
100
+ data() {
101
+ return {
102
+ context: useEditModeContext(this.editModeContext, {}, this.onSave)
103
+ }
104
+ },
44
105
  methods: {
106
+ componentIdentifier(index) {
107
+ const identifier = []
108
+ identifier.push(this.editModeContext.props.sectionId)
109
+ identifier.push(this.editModeContextData.componentIndex)
110
+
111
+ if(this.editModeContextData.childComponentIndex != null) {
112
+ identifier.push(this.editModeContextData.childComponentIndex)
113
+ }
114
+
115
+ identifier.push(index)
116
+
117
+ return identifier.join(".")
118
+ },
45
119
  showFancyBox(index) {
46
120
  openFancyBox({fancyBoxGallery: this.images, defaultGalleryIndex: index})
121
+ },
122
+ getMessage() {
123
+ return ""
124
+ },
125
+ onSave(data) {
126
+ const imageIndex = data[0].editModeContextData.imageIndex
127
+ return {
128
+ editModeContextData: {
129
+ ...(this.editModeContextData || {})
130
+ },
131
+ update(props) {
132
+ props.images[imageIndex].image = {
133
+ ...props.images[imageIndex].image,
134
+ ...data[0].image
135
+ }
136
+ props.images[imageIndex].figcaption = {
137
+ ...props.images[imageIndex].figcaption,
138
+ ...data[0].figcaption
139
+ }
140
+ }
141
+ }
47
142
  }
48
143
  }
49
144
  }
@@ -52,33 +147,38 @@ export default {
52
147
  <style lang="scss">
53
148
  /* begin cmd-image-gallery ---------------------------------------------------------------------------------------- */
54
149
  .cmd-image-gallery {
55
- > a {
56
- align-self: center;
57
- justify-self: center;
58
- grid-column: span var(--grid-small-span);
59
-
60
- img {
61
- border: var(--default-border);
62
- border-radius: var(--border-radius);
63
- max-height: 30rem;
64
- }
150
+ > .cmd-headline, > input.edit-mode {
151
+ grid-column: span var(--grid-columns);
152
+ margin-bottom: 0;
153
+ }
65
154
 
66
- figcaption {
67
- padding: calc(var(--default-padding) / 2);
68
- }
155
+ > .image-wrapper {
156
+ align-self: center;
157
+ justify-self: center;
158
+ grid-column: span var(--grid-small-span);
69
159
 
70
- &:hover, &:active, &:focus {
71
- text-decoration: none;
160
+ img {
161
+ border: var(--default-border);
162
+ border-radius: var(--border-radius);
163
+ max-height: 30rem;
164
+ }
72
165
 
73
- img {
74
- border: var(--primary-border);
75
- }
76
- }
166
+ figcaption {
167
+ padding: calc(var(--default-padding) / 2);
168
+ }
77
169
 
78
- & + .pager {
79
- margin-top: calc(var(--default-margin) * 2);
80
- }
170
+ &:hover, &:active, &:focus {
171
+ text-decoration: none;
172
+
173
+ img {
174
+ border: var(--primary-border);
175
+ }
176
+ }
177
+
178
+ & + .pager {
179
+ margin-top: calc(var(--default-margin) * 2);
81
180
  }
181
+ }
82
182
  }
83
183
 
84
184
  /* end cmd-image-gallery ------------------------------------------------------------------------------------------ */
@@ -409,7 +409,6 @@ export default {
409
409
  ul {
410
410
  z-index: 1000; /* keep ul above overlay */
411
411
  height: 100%;
412
- background: var(--color-scheme-background-color);
413
412
  }
414
413
  }
415
414
  }
@@ -444,7 +443,7 @@ export default {
444
443
  align-items: center;
445
444
 
446
445
  span {
447
- font-weight: bold;
446
+ font-weight: var(--font-weight-bold);
448
447
 
449
448
  &[class*="icon-"] {
450
449
  font-size: var(--font-size-small);
@@ -174,24 +174,8 @@ export default {
174
174
  </script>
175
175
 
176
176
  <style lang="scss">
177
- /* begin cmd-back-to-top-button ---------------------------------------------------------------------------------------- */
178
- .cmd-back-to-top-button {
179
- padding: var(--default-padding);
180
- display: inline-block;
181
- position: fixed;
182
- right: 1rem;
183
- bottom: 1rem;
184
- text-decoration: none;
185
- z-index: 1000;
186
- border: var(--default-border);
187
- background: var(--color-scheme-background-color);
188
- border-radius: var(--full-circle);
177
+ /* begin cmd-newsletter-subscription ---------------------------------------------------------------------------------------- */
189
178
 
190
- &:hover, &:active, &:focus {
191
- border-color: var(--primary-color);
192
- transition: var(--default-transition);
193
- }
194
- }
195
179
 
196
- /* cmd-back-to-top-button ------------------------------------------------------------------------------------------ */
180
+ /* cmd-newsletter-subscription------------------------------------------------------------------------------------------ */
197
181
  </style>
@@ -23,7 +23,7 @@
23
23
  v-for="(page, index) in pages"
24
24
  :key="index"
25
25
  @click.stop.prevent="showPage(page)" aria-live="polite">
26
- <span>{{ index + 1 }}</span>
26
+ <span :class="{hidden: !showPageNumbers}">{{ index + 1 }}</span>
27
27
  </a>
28
28
  </div>
29
29
  </div>
@@ -75,6 +75,13 @@ export default {
75
75
  type: Number,
76
76
  required: true
77
77
  },
78
+ /**
79
+ * toggle page-numbers on buttons
80
+ */
81
+ showPageNumbers: {
82
+ type: Boolean,
83
+ default: true
84
+ },
78
85
  /**
79
86
  * set type of links
80
87
  *
@@ -77,21 +77,15 @@ export default {
77
77
  display: flex;
78
78
  justify-content: center;
79
79
  text-decoration: none;
80
- background: var(--default-background-color-reduced-opacity);
81
80
  border: 0;
81
+ outline: 0;
82
82
 
83
83
  span {
84
84
  align-self: center;
85
- color: var(--primary-color-reduced-opacity);
86
85
  }
87
86
 
88
87
  &:hover, &:active, &:focus {
89
- background: var(--pure-white);
90
88
  transition: var(--default-transition);
91
-
92
- span {
93
- color: var(--hyperlink-color-highlighted);
94
- }
95
89
  }
96
90
 
97
91
  &.prev {
@@ -215,6 +215,46 @@ export default {
215
215
  flex-direction: row;
216
216
  margin: 0;
217
217
  gap: calc(var(--default-gap) / 2);
218
+
219
+ .button {
220
+ padding: calc(var(--default-padding) / 2) var(--default-padding);
221
+ gap: calc(var(--default-gap) / 2);
222
+ outline: 0;
223
+
224
+ span {
225
+ margin: 0;
226
+ }
227
+
228
+ &:first-of-type {
229
+ margin: 0;
230
+ }
231
+
232
+ &.text-align-right {
233
+ flex-direction: row-reverse;
234
+ }
235
+ }
236
+
237
+ &.no-gap {
238
+ li {
239
+ .button {
240
+ border-radius: 0;
241
+ }
242
+
243
+ &:first-of-type {
244
+ .button {
245
+ border-top-left-radius: var(--border-radius);
246
+ border-bottom-left-radius: var(--border-radius);
247
+ }
248
+ }
249
+
250
+ &:last-of-type {
251
+ .button {
252
+ border-top-right-radius: var(--border-radius);
253
+ border-bottom-right-radius: var(--border-radius);
254
+ }
255
+ }
256
+ }
257
+ }
218
258
  }
219
259
 
220
260
  li {
@@ -234,23 +274,6 @@ export default {
234
274
  }
235
275
  }
236
276
 
237
- .button {
238
- padding: calc(var(--default-padding) / 2) var(--default-padding);
239
- gap: calc(var(--default-gap) / 2);
240
-
241
- span {
242
- margin: 0;
243
- }
244
-
245
- &:first-of-type {
246
- margin: 0;
247
- }
248
-
249
- &.text-align-right {
250
- flex-direction: row-reverse;
251
- }
252
- }
253
-
254
277
  a:last-of-type {
255
278
  margin-right: 0;
256
279
  }
@@ -105,7 +105,7 @@ export default {
105
105
  default() {
106
106
  return {
107
107
  show: true,
108
- iconClass: "icon-cancel",
108
+ iconClass: "icon-cancel-circle",
109
109
  tooltip: "Close this message"
110
110
  }
111
111
  }
@@ -156,24 +156,15 @@ export default {
156
156
  top: .5rem;
157
157
  right: .5rem;
158
158
  text-decoration: none;
159
- border: var(--default-border);
160
- border-color: var(--pure-white);
161
- border-radius: var(--full-circle);
162
- padding: calc(var(--default-padding) / 2);
163
159
  z-index: 100;
164
160
  line-height: 1;
165
161
 
166
162
  [class*="icon-"] {
167
- font-size: 0.8rem;
168
163
  color: var(--pure-white);
169
164
  }
170
165
 
171
166
  &:hover, &:active, &:focus {
172
- border-color: var(--hyperlink-color);
173
- background: var(--pure-white);
174
-
175
167
  [class*="icon-"] {
176
- font-size: 0.8rem;
177
168
  color: var(--hyperlink-color);
178
169
  }
179
170
  }
@@ -32,8 +32,8 @@
32
32
  </thead>
33
33
  <transition name="fade">
34
34
  <tbody v-show="showTableData" aria-expanded="true">
35
- <tr :class="{'highlighted' : tableData.rowIndexHighlighted === indexRows}" v-for="(tablerows, indexRows) in tableData.tbody" :key="indexRows">
36
- <td :class="{'highlighted' : tableData.columnIndexHighlighted === indexData}" v-for="(tabledata, indexData) in tablerows" :key="indexData">
35
+ <tr :class="{'active' : tableData.rowIndexHighlighted === indexRows}" v-for="(tablerows, indexRows) in tableData.tbody" :key="indexRows">
36
+ <td :class="{'active' : tableData.columnIndexHighlighted === indexData}" v-for="(tabledata, indexData) in tablerows" :key="indexData">
37
37
  {{ tabledata }}
38
38
  </td>
39
39
  </tr>
@@ -42,7 +42,7 @@
42
42
  <transition name="fade">
43
43
  <tfoot v-if="tableData.tfoot && tableData.tfoot.length && showTableData" aria-expanded="true">
44
44
  <tr>
45
- <td :class="{'highlighted' : tableData.columnIndexHighlighted === indexFoot}" v-for="(tablefoot, indexFoot) in tableData.tfoot" :key="indexFoot">
45
+ <td :class="{'active' : tableData.columnIndexHighlighted === indexFoot}" v-for="(tablefoot, indexFoot) in tableData.tfoot" :key="indexFoot">
46
46
  {{ tablefoot }}
47
47
  </td>
48
48
  </tr>
@@ -1,39 +1,41 @@
1
1
  <template>
2
2
  <div class="cmd-text-block flex-container vertical">
3
3
  <!-- begin cmd-headline -->
4
- <input v-if="editContent" class="edit-mode headline" type="text" v-model="editableHtmlHeadline" />
5
- <CmdHeadline v-else-if="cmdHeadline" :headlineText="cmdHeadline.headlineText" :headlineLevel="cmdHeadline.headlineLevel"/>
4
+ <CmdHeadline v-if="cmdHeadline" :headlineText="cmdHeadline.headlineText" :headlineLevel="cmdHeadline.headlineLevel" />
6
5
  <!-- end cmd-headline -->
7
6
 
8
- <!-- begin text for single-paragraph -->
9
- <input v-if="editContent" class="edit-mode" type="text" v-model="editableText" />
10
- <p v-if="textContent">{{textContent}}</p>
11
- <!-- end text for single-paragraph -->
12
-
13
7
  <!-- begin continuous text -->
14
- <textarea v-if="editContent" class="edit-mode" v-model="editableHtmlContent"></textarea>
8
+ <textarea v-if="editModeContext?.editing" class="edit-mode" v-model="editableHtmlContent"></textarea>
15
9
  <div v-else-if="htmlContent" v-html="htmlContent"></div>
16
10
  <!-- end continuous text -->
17
11
  </div>
18
12
  </template>
19
13
 
20
14
  <script>
15
+ import {useEditModeContext} from "../editmode/editModeContext.js"
16
+
21
17
  export default {
22
18
  name: "CmdTextBlock",
19
+ provide() {
20
+ return {
21
+ editModeContext: this.context
22
+ }
23
+ },
24
+ inject: {
25
+ editModeContext: {
26
+ default: null
27
+ }
28
+ },
23
29
  data() {
24
30
  return {
25
- editableHtmlHeadline: "",
26
- editableText: "",
27
- editableHtmlContent: ""
31
+ context: useEditModeContext(this.editModeContext, {tb: true}, this.onPersist),
32
+ editableHtmlHeadline: this.cmdHeadline?.headlineText || "",
33
+ editableHtmlContent: this.htmlContent
28
34
  }
29
35
  },
30
36
  props: {
31
- /**
32
- * set to activate edit-mode
33
- */
34
- editContent: {
35
- type: Boolean,
36
- default: false
37
+ editModeContextData: {
38
+ type: Object
37
39
  },
38
40
  /**
39
41
  * properties for CmdHeadline-component
@@ -42,13 +44,6 @@ export default {
42
44
  type: Object,
43
45
  required: false
44
46
  },
45
- /**
46
- * text placed in a single paragraph
47
- */
48
- textContent: {
49
- type: String,
50
- required: false
51
- },
52
47
  /**
53
48
  * content for continuous text (can contain html-tags)
54
49
  */
@@ -56,6 +51,23 @@ export default {
56
51
  type: String,
57
52
  required: true
58
53
  }
54
+ },
55
+ methods: {
56
+ onPersist(data) {
57
+ const htmlContent = this.editableHtmlContent
58
+ return {
59
+ editModeContextData: {
60
+ ...(this.editModeContextData || {})
61
+ },
62
+ update(props) {
63
+ props.cmdHeadline = {
64
+ ...(props.cmdHeadline || {}),
65
+ }
66
+ props.cmdHeadline.headlineText = data[0].headlineText
67
+ props.htmlContent = htmlContent
68
+ }
69
+ }
70
+ }
59
71
  }
60
72
  }
61
73
  </script>
@@ -0,0 +1,50 @@
1
+ import {ref, watchEffect} from "vue"
2
+
3
+ export function useEditModeContext(parentContext, props, persistHandler) {
4
+ const editing = ref(!!parentContext?.editing)
5
+ const saveHandlers = []
6
+
7
+ function save() {
8
+ const data = []
9
+ saveHandlers.forEach(saveHandler => {
10
+ const result = saveHandler();
11
+ if (result) {
12
+ data.push(result)
13
+ }
14
+ })
15
+ callPersistHandler(data)
16
+ }
17
+
18
+ function callPersistHandler(data) {
19
+ let processedData = data
20
+ if (persistHandler) {
21
+ processedData = persistHandler(data)
22
+ }
23
+ if (parentContext && processedData != null) {
24
+ parentContext.callPersistHandler(processedData)
25
+ }
26
+ }
27
+
28
+ function addSaveHandler(saveHandler) {
29
+ if (!saveHandlers.includes(saveHandler)) {
30
+ saveHandlers.push(saveHandler)
31
+ }
32
+ }
33
+
34
+ if (parentContext) {
35
+ parentContext.addSaveHandler(save)
36
+ }
37
+
38
+ watchEffect(() => editing.value = !!parentContext?.editing);
39
+
40
+ return {
41
+ editing,
42
+ props: {
43
+ ...(parentContext?.props || {}),
44
+ ...(props || {})
45
+ },
46
+ addSaveHandler,
47
+ save,
48
+ callPersistHandler
49
+ }
50
+ }
package/src/main.js CHANGED
@@ -1,22 +1,12 @@
1
- /* begin imports css from comand-frontend-framework ---------------------------------------------------------------------------------------- */
2
- /* import normalize to set same default styles for all browsers */
3
- import 'comand-frontend-framework/src/assets/css/normalize.css'
4
-
5
- /* import framework-styles */
6
- import 'comand-frontend-framework/src/assets/css/framework.css'
7
-
8
- /* import breakpoints */
9
- import 'comand-frontend-framework/src/assets/css/breakpoints.css'
10
-
11
- /* import framework-iconfont */
12
- import 'comand-frontend-framework/src/assets/css/framework-iconfont.css'
1
+ /* import generated css from components */
2
+ import "comand-frontend-framework/styles"
13
3
  /* end imports css from comand-frontend-framework ---------------------------------------------------------------------------------------- */
14
4
 
15
- import { createApp } from 'vue'
5
+ import { createApp } from "vue"
16
6
 
17
- // import App from './App.vue'
18
- import App from './App.vue'
19
- //import { createRouter, createWebHistory } from 'vue-router'
7
+ // import App from "./App.vue"
8
+ import App from "./App.vue"
9
+ //import { createRouter, createWebHistory } from "vue-router"
20
10
  import "clickout-event"
21
11
 
22
12
  /* import directives */
@@ -36,14 +26,14 @@ import '@/assets/styles/global-styles.scss'
36
26
  /* import css for global transitions */
37
27
  import '@/assets/styles/transitions.scss'
38
28
 
39
- /* import css-example for your custom styles (contains overwritten primary-color only) */
29
+ /* import css-example for your custom styles */
40
30
  import '@/assets/styles/template.css'
41
31
 
42
32
  /* import css for prism-library (for styling syntax) */
43
33
  import "prismjs/themes/prism.css"
44
34
 
45
35
  /* import css for demopage only */
46
- import 'comand-frontend-framework/public/demopage-only.css'
36
+ //import 'comand-frontend-framework/public/demopage-only.css'
47
37
  /* end imports css from comand-component-library ---------------------------------------------------------------------------------------- */
48
38
 
49
39
  import router from "./router"