@demos-europe/demosplan-ui 0.0.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 (133) hide show
  1. package/LICENSE +21 -0
  2. package/buildTokens.js +59 -0
  3. package/components/DpButton/DpButton.stories.mdx +136 -0
  4. package/components/DpButton/DpButton.vue +118 -0
  5. package/components/DpDetails/DpDetails.stories.mdx +55 -0
  6. package/components/DpDetails/DpDetails.vue +58 -0
  7. package/components/DpIcon/DpIcon.stories.mdx +396 -0
  8. package/components/DpIcon/DpIcon.vue +51 -0
  9. package/components/DpIcon/util/iconVariables.js +148 -0
  10. package/components/DpInput/DpInput.stories.mdx +127 -0
  11. package/components/DpInput/DpInput.vue +284 -0
  12. package/components/DpLabel/DpLabel.stories.mdx +103 -0
  13. package/components/DpLabel/DpLabel.vue +112 -0
  14. package/components/DpLoading/DpLoading.stories.mdx +63 -0
  15. package/components/DpLoading/DpLoading.vue +63 -0
  16. package/components/core/DpAccordion.vue +108 -0
  17. package/components/core/DpAnonymizeText.vue +136 -0
  18. package/components/core/DpAutocomplete.vue +133 -0
  19. package/components/core/DpBulkEditHeader.vue +53 -0
  20. package/components/core/DpButtonIcon.vue +47 -0
  21. package/components/core/DpButtonRow.vue +155 -0
  22. package/components/core/DpCard.vue +54 -0
  23. package/components/core/DpChangeStateAtDate.vue +223 -0
  24. package/components/core/DpCheckboxGroup.vue +93 -0
  25. package/components/core/DpContextualHelp.vue +54 -0
  26. package/components/core/DpCopyPasteButton.vue +47 -0
  27. package/components/core/DpDashboardTaskCard.vue +123 -0
  28. package/components/core/DpDataTable/DataTableSearch.js +44 -0
  29. package/components/core/DpDataTable/DpColumnSelector.vue +133 -0
  30. package/components/core/DpDataTable/DpDataTable.vue +647 -0
  31. package/components/core/DpDataTable/DpDataTableExtended.vue +377 -0
  32. package/components/core/DpDataTable/DpResizeHandle.vue +37 -0
  33. package/components/core/DpDataTable/DpSelectPageItemCount.vue +70 -0
  34. package/components/core/DpDataTable/DpTableHeader.vue +197 -0
  35. package/components/core/DpDataTable/DpTableRow.vue +355 -0
  36. package/components/core/DpDataTable/DpWrapTrigger.vue +48 -0
  37. package/components/core/DpDataTable/lib/ResizableColumns.js +83 -0
  38. package/components/core/DpEditableList.vue +161 -0
  39. package/components/core/DpEditor/DpBoilerPlate.vue +140 -0
  40. package/components/core/DpEditor/DpBoilerPlateModal.vue +166 -0
  41. package/components/core/DpEditor/DpEditor.vue +1281 -0
  42. package/components/core/DpEditor/DpLinkModal.vue +117 -0
  43. package/components/core/DpEditor/DpRecommendationModal/DpInsertableRecommendation.vue +137 -0
  44. package/components/core/DpEditor/DpRecommendationModal.vue +283 -0
  45. package/components/core/DpEditor/DpResizableImage.vue +121 -0
  46. package/components/core/DpEditor/DpUploadModal.vue +121 -0
  47. package/components/core/DpEditor/libs/Decoration.js +66 -0
  48. package/components/core/DpEditor/libs/SegmentRangeChangePlugin.js +35 -0
  49. package/components/core/DpEditor/libs/editorAnonymize.js +66 -0
  50. package/components/core/DpEditor/libs/editorBuildSuggestion.js +269 -0
  51. package/components/core/DpEditor/libs/editorCustomDelete.js +32 -0
  52. package/components/core/DpEditor/libs/editorCustomImage.js +100 -0
  53. package/components/core/DpEditor/libs/editorCustomInsert.js +32 -0
  54. package/components/core/DpEditor/libs/editorCustomLink.js +46 -0
  55. package/components/core/DpEditor/libs/editorCustomMark.js +32 -0
  56. package/components/core/DpEditor/libs/editorInsertAtCursorPos.js +41 -0
  57. package/components/core/DpEditor/libs/editorObscure.js +60 -0
  58. package/components/core/DpEditor/libs/editorUnAnonymize.js +56 -0
  59. package/components/core/DpEditor/libs/handleWordPaste.js +360 -0
  60. package/components/core/DpEditor/libs/preventDrop.js +31 -0
  61. package/components/core/DpEditor/libs/preventKeyboardInput.js +27 -0
  62. package/components/core/DpEditor/libs/preventPaste.js +28 -0
  63. package/components/core/DpFlyout.vue +119 -0
  64. package/components/core/DpInlineNotification.vue +116 -0
  65. package/components/core/DpModal.vue +208 -0
  66. package/components/core/DpObscure.vue +29 -0
  67. package/components/core/DpPager.vue +139 -0
  68. package/components/core/DpProgressBar.vue +67 -0
  69. package/components/core/DpRegisterFlyout.vue +58 -0
  70. package/components/core/DpResettableInput.vue +140 -0
  71. package/components/core/DpSkeletonBox.vue +32 -0
  72. package/components/core/DpSlidebar.vue +86 -0
  73. package/components/core/DpSlidingPagination.vue +45 -0
  74. package/components/core/DpSplitButton.vue +77 -0
  75. package/components/core/DpSwitcher.vue +62 -0
  76. package/components/core/DpTableCardList/DpTableCard.vue +61 -0
  77. package/components/core/DpTableCardList/DpTableCardListHeader.vue +83 -0
  78. package/components/core/DpTabs/DpTab.vue +52 -0
  79. package/components/core/DpTabs/DpTabs.vue +165 -0
  80. package/components/core/DpTextWrapper.vue +65 -0
  81. package/components/core/DpToggleForm.vue +72 -0
  82. package/components/core/DpTooltipIcon.vue +52 -0
  83. package/components/core/DpTransitionExpand.vue +87 -0
  84. package/components/core/DpTreeList/DpTreeList.vue +334 -0
  85. package/components/core/DpTreeList/DpTreeListCheckbox.vue +79 -0
  86. package/components/core/DpTreeList/DpTreeListNode.vue +348 -0
  87. package/components/core/DpTreeList/DpTreeListToggle.vue +71 -0
  88. package/components/core/DpTreeList/utils/constants.js +14 -0
  89. package/components/core/DpUpload/DpUpload.vue +223 -0
  90. package/components/core/DpUpload/DpUploadFiles.vue +269 -0
  91. package/components/core/DpUpload/DpUploadedFile.vue +80 -0
  92. package/components/core/DpUpload/DpUploadedFileList.vue +56 -0
  93. package/components/core/DpUpload/utils/GetFileIdsByHash.js +42 -0
  94. package/components/core/DpUpload/utils/UppyTranslations.js +31 -0
  95. package/components/core/DpVideoPlayer.vue +115 -0
  96. package/components/core/HeightLimit.vue +121 -0
  97. package/components/core/MultistepNav.vue +89 -0
  98. package/components/core/form/DpCheckbox.vue +108 -0
  99. package/components/core/form/DpDateRangePicker.vue +186 -0
  100. package/components/core/form/DpDatepicker.vue +160 -0
  101. package/components/core/form/DpDatetimePicker.vue +194 -0
  102. package/components/core/form/DpFormRow.vue +79 -0
  103. package/components/core/form/DpMultiselect.vue +164 -0
  104. package/components/core/form/DpRadio.vue +128 -0
  105. package/components/core/form/DpSearchField.vue +110 -0
  106. package/components/core/form/DpSelect.vue +149 -0
  107. package/components/core/form/DpTextArea.vue +152 -0
  108. package/components/core/form/DpTimePicker.vue +374 -0
  109. package/components/core/form/DpToggle.vue +78 -0
  110. package/components/core/index.js +132 -0
  111. package/components/core/notify/DpNotifyContainer.vue +122 -0
  112. package/components/core/notify/DpNotifyMessage.vue +95 -0
  113. package/components/core/shared/DpStickyElement.vue +95 -0
  114. package/components/index.js +24 -0
  115. package/components/shared/translations.js +15 -0
  116. package/directives/CleanHtml/CleanHtml.js +50 -0
  117. package/directives/CleanHtml/CleanHtml.stories.mdx +64 -0
  118. package/directives/Tooltip/Tooltip.js +40 -0
  119. package/directives/Tooltip/Tooltip.stories.mdx +42 -0
  120. package/directives/index.js +17 -0
  121. package/lib/index.js +14 -0
  122. package/lib/prefixClass.js +47 -0
  123. package/mixins/index.js +14 -0
  124. package/mixins/prefixClassMixin.js +22 -0
  125. package/package.json +52 -0
  126. package/shared/props.js +86 -0
  127. package/style/index.css +7 -0
  128. package/tailwind.config.js +24 -0
  129. package/tokens/color.json +358 -0
  130. package/tokens/color.stories.mdx +45 -0
  131. package/tokens/fontSize.json +100 -0
  132. package/tokens/space.json +33 -0
  133. package/utils/lengthHint.js +69 -0
@@ -0,0 +1,63 @@
1
+ <license>
2
+ (c) 2010-present DEMOS E-Partizipation GmbH.
3
+
4
+ This file is part of the package @demos-europe/demosplan-ui,
5
+ for more information see the license file.
6
+
7
+ All rights reserved
8
+ </license>
9
+
10
+ <template>
11
+ <div
12
+ class="c-loading"
13
+ :class="{
14
+ 'c-loading--overlay': overlay,
15
+ 'flex flex-items-center space-inline-xs': !overlay
16
+ }"
17
+ @click.prevent="">
18
+ <div
19
+ v-if="overlay"
20
+ class="c-loading__inner flex flex-items-center space-inline-xs">
21
+ <span class="c-loading__spinner" />
22
+ <span
23
+ v-if="!hideLabel"
24
+ class="c-loading__text"
25
+ v-text="label" />
26
+ </div>
27
+ <template v-else>
28
+ <span class="c-loading__spinner" />
29
+ <span
30
+ v-if="!hideLabel"
31
+ class="c-loading__text"
32
+ v-text="label" />
33
+ </template>
34
+ </div>
35
+ </template>
36
+
37
+ <script>
38
+ import { de } from '../shared/translations'
39
+
40
+ export default {
41
+ name: 'DpLoading',
42
+
43
+ props: {
44
+ hideLabel: {
45
+ required: false,
46
+ type: Boolean,
47
+ default: false
48
+ },
49
+
50
+ overlay: {
51
+ type: Boolean,
52
+ required: false,
53
+ default: false
54
+ }
55
+ },
56
+
57
+ data () {
58
+ return {
59
+ label: de.loadingData
60
+ }
61
+ }
62
+ }
63
+ </script>
@@ -0,0 +1,108 @@
1
+ <license>
2
+ (c) 2010-present DEMOS E-Partizipation GmbH.
3
+
4
+ This file is part of the package @demos-europe/demosplan-ui,
5
+ for more information see the license file.
6
+
7
+ All rights reserved
8
+ </license>
9
+
10
+ <documentation>
11
+
12
+ <!-- can toggle itself via the toggle method, but can also be toggled from outside (e.g. via a save or abort button)
13
+ by passing the parent's open state as prop (isOpen) and calling a toggle method on the parent @item:toggle which
14
+ toggles the parent's isOpen data property, see usage -->
15
+
16
+ <usage variant="with toggle from outside">
17
+ <dp-accordion
18
+ :is-open="isOpen"
19
+ :title="title"
20
+ @item:toggle="(open) => toggleItem(open)">
21
+ </dp-accordion>
22
+ </usage>
23
+ </documentation>
24
+
25
+ <template>
26
+ <div class="o-accordion">
27
+ <button
28
+ type="button"
29
+ v-if="title !== ''"
30
+ @click="() => toggle()"
31
+ :aria-expanded="isVisible.toString()"
32
+ data-cy="accordionToggle"
33
+ :class="fontWeight === 'bold' ? 'weight--bold' : 'weight--normal'"
34
+ class="btn--blank o-link--default">
35
+ <i
36
+ class="width-s fa"
37
+ :class="{'fa-caret-right': !isVisible, 'fa-caret-down': isVisible}"
38
+ aria-hidden="true" />
39
+ <span :class="compressed ? 'font-size-medium' : 'o-accordion--title'">{{ title }}</span>
40
+ </button>
41
+ <dp-transition-expand>
42
+ <div v-show="isVisible">
43
+ <!-- This is where the accordion content goes. -->
44
+ <slot />
45
+ </div>
46
+ </dp-transition-expand>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import DpTransitionExpand from './DpTransitionExpand'
52
+
53
+ export default {
54
+ name: 'DpAccordion',
55
+
56
+ components: {
57
+ DpTransitionExpand
58
+ },
59
+
60
+ props: {
61
+ fontWeight: {
62
+ type: String,
63
+ required: false,
64
+ default: 'bold',
65
+ validate: prop => ['normal', 'bold'].includes(prop)
66
+ },
67
+
68
+ // Reduce font-size of the title
69
+ compressed: {
70
+ type: Boolean,
71
+ default: false
72
+ },
73
+
74
+ // Needed if you want to toggle the accordion from outside
75
+ isOpen: {
76
+ type: Boolean,
77
+ required: false,
78
+ default: false
79
+ },
80
+
81
+ // Text displayed in toggle trigger
82
+ title: {
83
+ type: String,
84
+ required: false,
85
+ default: ''
86
+ }
87
+ },
88
+
89
+ data () {
90
+ return {
91
+ isVisible: this.isOpen
92
+ }
93
+ },
94
+
95
+ watch: {
96
+ isOpen () {
97
+ this.isVisible = this.isOpen
98
+ }
99
+ },
100
+
101
+ methods: {
102
+ toggle (state) {
103
+ this.isVisible = (typeof state === 'undefined') ? !this.isVisible : state
104
+ this.$emit('item:toggle', this.isVisible)
105
+ }
106
+ }
107
+ }
108
+ </script>
@@ -0,0 +1,136 @@
1
+ <license>
2
+ (c) 2010-present DEMOS E-Partizipation GmbH.
3
+
4
+ This file is part of the package @demos-europe/demosplan-ui,
5
+ for more information see the license file.
6
+
7
+ All rights reserved
8
+ </license>
9
+
10
+ <template>
11
+ <div class="border u-mb u-p-0_25">
12
+ <editor-menu-bubble
13
+ :editor="editor"
14
+ class="editor-menububble__wrapper"
15
+ :keep-in-bounds="true"
16
+ v-slot:default="{ commands, isActive, menu }">
17
+ <div
18
+ :class="{ 'is-active': menu.isActive }"
19
+ :style="`left: ${menu.left}px; bottom: ${menu.bottom}px;`">
20
+ <a
21
+ v-if="isActive.anonymize()"
22
+ class="editor-menububble__button is-active"
23
+ @click="commands.unanonymize">
24
+ {{ Translator.trans('statement.anonymize.unmark') }}
25
+ </a>
26
+ <a
27
+ v-else
28
+ class="editor-menububble__button"
29
+ @click="commands.anonymize">
30
+ {{ Translator.trans('statement.anonymize.mark') }}
31
+ </a>
32
+ </div>
33
+ </editor-menu-bubble>
34
+ <editor-content
35
+ autocomplete="off"
36
+ autocorrect="off"
37
+ autocapitalize="off"
38
+ spellcheck="false"
39
+ ref="editorContent"
40
+ class="editor-content"
41
+ :editor="editor" />
42
+ </div>
43
+ </template>
44
+
45
+ <script>
46
+ import {
47
+ Bold,
48
+ BulletList,
49
+ HardBreak,
50
+ History,
51
+ Italic,
52
+ ListItem,
53
+ OrderedList,
54
+ Underline
55
+ } from 'tiptap-extensions'
56
+ import { Editor, EditorContent, EditorMenuBubble } from 'tiptap'
57
+ import EditorAnonymize from './DpEditor/libs/editorAnonymize'
58
+ import EditorObscure from './DpEditor/libs/editorObscure'
59
+ import EditorUnAnonymize from './DpEditor/libs/editorUnAnonymize'
60
+ import PreventDrop from './DpEditor/libs/preventDrop'
61
+ import PreventKeyboardInput from './DpEditor/libs/preventKeyboardInput'
62
+
63
+ export default {
64
+ name: 'DpAnonymizeText',
65
+
66
+ components: {
67
+ EditorContent,
68
+ EditorMenuBubble
69
+ },
70
+
71
+ props: {
72
+ value: {
73
+ type: String,
74
+ required: true
75
+ }
76
+ },
77
+
78
+ data () {
79
+ return {
80
+ editor: null
81
+ }
82
+ },
83
+
84
+ methods: {
85
+ setValue () {
86
+ let currentValue = this.editor.getHTML()
87
+
88
+ // 1. look if there are anonymized segements, which are tagged to un-anonymize
89
+ const unanonymize = /<span[^>]*?title="(.*?)"([^>]*?)class="anonymize-me"([^>]*?)>([^<]*?)<span class="unanonymized">([^<]*?)<\/span>([^<]*?)<\/span>/gm
90
+ currentValue = currentValue.replace(unanonymize, (match, p1) => p1.replaceAll('&quot;', '"'))
91
+
92
+ // 2. remove unanonymize tags that are left over because the selection was wider than the anonymized element
93
+ const unanonymizeCleaner = /<span class="unanonymized">(.*?)<\/span>/gm
94
+ currentValue = currentValue.replace(unanonymizeCleaner, '$1')
95
+
96
+ // 3. anonymize text - leave the text in the title, that it can be restored again.
97
+ const anonymize = /<span class="anonymize-me">(.*?)<\/span>/gm
98
+ currentValue = currentValue.replace(anonymize, (match, p1) => ('<span title="' + p1.replaceAll('"', '&quot;') + '" class="anonymize-me">***</span>'))
99
+
100
+ // Update text
101
+ this.editor.setContent(currentValue)
102
+ this.$emit('change', currentValue)
103
+ }
104
+ },
105
+
106
+ mounted () {
107
+ this.editor = new Editor({
108
+ content: this.value,
109
+ editable: true,
110
+ disableInputRules: true,
111
+ disablePasteRules: true,
112
+ extensions: [
113
+ new EditorAnonymize(),
114
+ new EditorUnAnonymize(),
115
+ new EditorObscure(),
116
+ new PreventKeyboardInput(),
117
+ new PreventDrop(),
118
+ new Bold(),
119
+ new Italic(),
120
+ new BulletList(),
121
+ new OrderedList(),
122
+ new ListItem(),
123
+ new Underline(),
124
+ new History(),
125
+ new HardBreak()
126
+ ],
127
+ onUpdate: () => {
128
+ this.setValue()
129
+ },
130
+ editorProps: {
131
+ handleTextInput: () => true // Disable text input
132
+ }
133
+ })
134
+ }
135
+ }
136
+ </script>
@@ -0,0 +1,133 @@
1
+ <license>
2
+ (c) 2010-present DEMOS E-Partizipation GmbH.
3
+
4
+ This file is part of the package @demos-europe/demosplan-ui,
5
+ for more information see the license file.
6
+
7
+ All rights reserved
8
+ </license>
9
+
10
+ <template>
11
+ <vue-omnibox
12
+ :box-height="height"
13
+ :disable-search="true"
14
+ :label="label"
15
+ :options="options"
16
+ :placeholder="placeholder"
17
+ :value="currentQuery"
18
+ @input="emitAndFetch"
19
+ @searched="emit($event, 'searched')"
20
+ @selected="emit($event, 'selected')">
21
+ <template
22
+ v-for="(_, scopedSlotName) in $scopedSlots"
23
+ v-slot:[scopedSlotName]="slotData">
24
+ <slot
25
+ :name="scopedSlotName"
26
+ v-bind="slotData" />
27
+ </template>
28
+ </vue-omnibox>
29
+ </template>
30
+
31
+ <script>
32
+ import { dpApi } from 'demosplan-utils'
33
+ import { prefixClassMixin } from 'demosplan-ui/mixins'
34
+ import VueOmnibox from 'vue-omnibox'
35
+
36
+ export default {
37
+ name: 'DpAutocomplete',
38
+
39
+ components: {
40
+ VueOmnibox
41
+ },
42
+
43
+ mixins: [prefixClassMixin],
44
+
45
+ props: {
46
+ additionalRouteParams: {
47
+ type: Object,
48
+ required: false,
49
+ default: () => ({})
50
+ },
51
+
52
+ height: {
53
+ type: String,
54
+ required: false,
55
+ default: '28px'
56
+ },
57
+
58
+ label: {
59
+ type: String,
60
+ required: false,
61
+ default: () => 'label'
62
+ },
63
+
64
+ options: {
65
+ type: Array,
66
+ required: false,
67
+ default: () => ([])
68
+ },
69
+
70
+ placeholder: {
71
+ type: String,
72
+ required: false,
73
+ default: () => Translator.trans('search')
74
+ },
75
+
76
+ queryParam: {
77
+ type: String,
78
+ required: false,
79
+ default: 'query'
80
+ },
81
+
82
+ route: {
83
+ type: String,
84
+ required: true
85
+ },
86
+
87
+ value: {
88
+ type: String,
89
+ required: false,
90
+ default: ''
91
+ }
92
+ },
93
+
94
+ data () {
95
+ return {
96
+ currentQuery: this.value,
97
+ isLoading: false
98
+ }
99
+ },
100
+
101
+ watch: {
102
+ value () {
103
+ if (this.currentQuery !== this.value) {
104
+ this.currentQuery = this.value
105
+ }
106
+ }
107
+ },
108
+
109
+ methods: {
110
+ emit (e, type) {
111
+ this.$emit(type, e)
112
+ },
113
+
114
+ emitAndFetch (value) {
115
+ this.emit(value, 'input')
116
+ this.currentQuerry = value
117
+ if (value.length >= 3) this.fetchOptions(value)
118
+ },
119
+
120
+ async fetchOptions (searchString) {
121
+ this.isLoading = true
122
+ try {
123
+ const response = await dpApi.get(Routing.generate(this.route, { ...this.additionalRouteParams, [this.queryParam]: searchString }))
124
+ // Only emit results that match the current search -> prevents race conditions
125
+ if (this.currentQuerry === searchString) this.$emit('search-changed', response)
126
+ this.isLoading = false
127
+ } catch (e) {
128
+ console.log(e)
129
+ }
130
+ }
131
+ }
132
+ }
133
+ </script>
@@ -0,0 +1,53 @@
1
+ <license>
2
+ (c) 2010-present DEMOS E-Partizipation GmbH.
3
+
4
+ This file is part of the package @demos-europe/demosplan-ui,
5
+ for more information see the license file.
6
+
7
+ All rights reserved
8
+ </license>
9
+
10
+ <template>
11
+ <div
12
+ role="menu"
13
+ class="layout__item u-12-of-12 u-p-0_5 bg-color--system-info-light-1 line-height--1_6">
14
+ <span class="u-mr">
15
+ {{ selectedItemsText }}
16
+ </span>
17
+ <slot :selected-items-count="selectedItemsCount">
18
+ <!-- place edit actions here -->
19
+ </slot>
20
+ <button
21
+ type="button"
22
+ class="btn btn--secondary float--right"
23
+ @click="$emit('reset-selection')">
24
+ {{ Translator.trans('unselect') }}
25
+ </button>
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+ export default {
31
+ name: 'DpBulkEditHeader',
32
+
33
+ props: {
34
+ selectedItemsCount: {
35
+ type: Number,
36
+ required: false,
37
+ default: 0
38
+ },
39
+
40
+ selectionText: {
41
+ type: String,
42
+ required: false,
43
+ default: ''
44
+ }
45
+ },
46
+
47
+ computed: {
48
+ selectedItemsText () {
49
+ return this.selectedItemsCount + ' ' + this.selectionText
50
+ }
51
+ }
52
+ }
53
+ </script>
@@ -0,0 +1,47 @@
1
+ <license>
2
+ (c) 2010-present DEMOS E-Partizipation GmbH.
3
+
4
+ This file is part of the package @demos-europe/demosplan-ui,
5
+ for more information see the license file.
6
+
7
+ All rights reserved
8
+ </license>
9
+
10
+ <template>
11
+ <button
12
+ class="btn--icon"
13
+ v-tooltip="{
14
+ content: translatedText,
15
+ delay: { show: 1000, hide: 200 }
16
+ }"
17
+ @click="$emit('click')">
18
+ <i
19
+ :class="`fa ${icon}`"
20
+ aria-hidden="true" />
21
+ <span class="hide-visually">{{ translatedText }}</span>
22
+ </button>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ name: 'DpButtonIcon',
28
+
29
+ props: {
30
+ icon: {
31
+ type: String,
32
+ required: true
33
+ },
34
+
35
+ text: {
36
+ type: String,
37
+ required: true
38
+ }
39
+ },
40
+
41
+ computed: {
42
+ translatedText () {
43
+ return Translator.trans(this.text)
44
+ }
45
+ }
46
+ }
47
+ </script>
@@ -0,0 +1,155 @@
1
+ <license>
2
+ (c) 2010-present DEMOS E-Partizipation GmbH.
3
+
4
+ This file is part of the package @demos-europe/demosplan-ui,
5
+ for more information see the license file.
6
+
7
+ All rights reserved
8
+ </license>
9
+
10
+ <documentation>
11
+ <!-- This component contains a button row, currently with save and abort buttons. -->
12
+ <usage>
13
+ <dp-button-row
14
+ :busy="isLoading"
15
+ primary
16
+ secondary
17
+ @primary-action="save"
18
+ @secondary-action="reset" />
19
+ </usage>
20
+
21
+ <usage variant="with slot and third button">
22
+ <dp-button-row
23
+ :busy="isLoading"
24
+ primary
25
+ secondary
26
+ @primary-action="save"
27
+ @secondary-action="reset">
28
+ <dp-button
29
+ class="u-ml-0_5"
30
+ color="secondary"
31
+ :text="Translator.trans('close')"
32
+ @click="closeAndCancel" />
33
+ </dp-button-row>
34
+ </usage>
35
+ </documentation>
36
+
37
+ <template>
38
+ <div
39
+ :class="[`text--${align}`, $attrs.class]"
40
+ class="space-inline-s">
41
+ <dp-button
42
+ v-if="primary"
43
+ :busy="busy"
44
+ :disabled="disabled"
45
+ :text="primaryText"
46
+ :variant="variant"
47
+ @click.prevent="$emit('primary-action')"
48
+ data-cy="saveButton" />
49
+ <dp-button
50
+ v-if="secondary"
51
+ color="secondary"
52
+ :href="href"
53
+ :text="secondaryText"
54
+ :variant="variant"
55
+ @click.prevent="$emit('secondary-action')" />
56
+ <slot />
57
+ </div>
58
+ </template>
59
+
60
+ <script>
61
+ import { DpButton } from 'demosplan-ui/components'
62
+
63
+ export default {
64
+ name: 'DpButtonRow',
65
+
66
+ components: {
67
+ DpButton
68
+ },
69
+
70
+ props: {
71
+ /**
72
+ * Specifies if the buttons should align left or right inside their container.
73
+ */
74
+ align: {
75
+ type: String,
76
+ required: false,
77
+ default: 'right'
78
+ },
79
+
80
+ /**
81
+ * The primary button may have a "busy" state to indicate system progress.
82
+ */
83
+ busy: {
84
+ type: Boolean,
85
+ required: false,
86
+ default: false
87
+ },
88
+
89
+ /**
90
+ * The primary button may have a "disabled" state to prevent unwanted user interaction e.g if no data is changed yet.
91
+ */
92
+ disabled: {
93
+ type: Boolean,
94
+ required: false,
95
+ default: false
96
+ },
97
+
98
+ /**
99
+ * The secondary button may be a link under the hood, e.g. for jumping back to another view.
100
+ * The default value corresponds with the respective value in the `DpButton` component.
101
+ */
102
+ href: {
103
+ type: String,
104
+ required: false,
105
+ default: '#'
106
+ },
107
+
108
+ /**
109
+ * Display a primary button intended to save changes.
110
+ */
111
+ primary: {
112
+ type: Boolean,
113
+ required: false,
114
+ default: false
115
+ },
116
+
117
+ /**
118
+ * Custom text for the primary button.
119
+ */
120
+ primaryText: {
121
+ type: String,
122
+ required: false,
123
+ default: () => Translator.trans('save')
124
+ },
125
+
126
+ /**
127
+ * Display a secondary button intended to cancel a process or reset input.
128
+ */
129
+ secondary: {
130
+ type: Boolean,
131
+ required: false,
132
+ default: false
133
+ },
134
+
135
+ /**
136
+ * Custom text for the secondary button.
137
+ */
138
+ secondaryText: {
139
+ type: String,
140
+ required: false,
141
+ default: () => Translator.trans('abort')
142
+ },
143
+
144
+ /**
145
+ * Variants of the button include `outline` (`text` to be implemented).
146
+ * When not specified, the default style (white on colored background) is applied.
147
+ */
148
+ variant: {
149
+ required: false,
150
+ type: String,
151
+ default: ''
152
+ }
153
+ }
154
+ }
155
+ </script>