@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.
- package/LICENSE +21 -0
- package/buildTokens.js +59 -0
- package/components/DpButton/DpButton.stories.mdx +136 -0
- package/components/DpButton/DpButton.vue +118 -0
- package/components/DpDetails/DpDetails.stories.mdx +55 -0
- package/components/DpDetails/DpDetails.vue +58 -0
- package/components/DpIcon/DpIcon.stories.mdx +396 -0
- package/components/DpIcon/DpIcon.vue +51 -0
- package/components/DpIcon/util/iconVariables.js +148 -0
- package/components/DpInput/DpInput.stories.mdx +127 -0
- package/components/DpInput/DpInput.vue +284 -0
- package/components/DpLabel/DpLabel.stories.mdx +103 -0
- package/components/DpLabel/DpLabel.vue +112 -0
- package/components/DpLoading/DpLoading.stories.mdx +63 -0
- package/components/DpLoading/DpLoading.vue +63 -0
- package/components/core/DpAccordion.vue +108 -0
- package/components/core/DpAnonymizeText.vue +136 -0
- package/components/core/DpAutocomplete.vue +133 -0
- package/components/core/DpBulkEditHeader.vue +53 -0
- package/components/core/DpButtonIcon.vue +47 -0
- package/components/core/DpButtonRow.vue +155 -0
- package/components/core/DpCard.vue +54 -0
- package/components/core/DpChangeStateAtDate.vue +223 -0
- package/components/core/DpCheckboxGroup.vue +93 -0
- package/components/core/DpContextualHelp.vue +54 -0
- package/components/core/DpCopyPasteButton.vue +47 -0
- package/components/core/DpDashboardTaskCard.vue +123 -0
- package/components/core/DpDataTable/DataTableSearch.js +44 -0
- package/components/core/DpDataTable/DpColumnSelector.vue +133 -0
- package/components/core/DpDataTable/DpDataTable.vue +647 -0
- package/components/core/DpDataTable/DpDataTableExtended.vue +377 -0
- package/components/core/DpDataTable/DpResizeHandle.vue +37 -0
- package/components/core/DpDataTable/DpSelectPageItemCount.vue +70 -0
- package/components/core/DpDataTable/DpTableHeader.vue +197 -0
- package/components/core/DpDataTable/DpTableRow.vue +355 -0
- package/components/core/DpDataTable/DpWrapTrigger.vue +48 -0
- package/components/core/DpDataTable/lib/ResizableColumns.js +83 -0
- package/components/core/DpEditableList.vue +161 -0
- package/components/core/DpEditor/DpBoilerPlate.vue +140 -0
- package/components/core/DpEditor/DpBoilerPlateModal.vue +166 -0
- package/components/core/DpEditor/DpEditor.vue +1281 -0
- package/components/core/DpEditor/DpLinkModal.vue +117 -0
- package/components/core/DpEditor/DpRecommendationModal/DpInsertableRecommendation.vue +137 -0
- package/components/core/DpEditor/DpRecommendationModal.vue +283 -0
- package/components/core/DpEditor/DpResizableImage.vue +121 -0
- package/components/core/DpEditor/DpUploadModal.vue +121 -0
- package/components/core/DpEditor/libs/Decoration.js +66 -0
- package/components/core/DpEditor/libs/SegmentRangeChangePlugin.js +35 -0
- package/components/core/DpEditor/libs/editorAnonymize.js +66 -0
- package/components/core/DpEditor/libs/editorBuildSuggestion.js +269 -0
- package/components/core/DpEditor/libs/editorCustomDelete.js +32 -0
- package/components/core/DpEditor/libs/editorCustomImage.js +100 -0
- package/components/core/DpEditor/libs/editorCustomInsert.js +32 -0
- package/components/core/DpEditor/libs/editorCustomLink.js +46 -0
- package/components/core/DpEditor/libs/editorCustomMark.js +32 -0
- package/components/core/DpEditor/libs/editorInsertAtCursorPos.js +41 -0
- package/components/core/DpEditor/libs/editorObscure.js +60 -0
- package/components/core/DpEditor/libs/editorUnAnonymize.js +56 -0
- package/components/core/DpEditor/libs/handleWordPaste.js +360 -0
- package/components/core/DpEditor/libs/preventDrop.js +31 -0
- package/components/core/DpEditor/libs/preventKeyboardInput.js +27 -0
- package/components/core/DpEditor/libs/preventPaste.js +28 -0
- package/components/core/DpFlyout.vue +119 -0
- package/components/core/DpInlineNotification.vue +116 -0
- package/components/core/DpModal.vue +208 -0
- package/components/core/DpObscure.vue +29 -0
- package/components/core/DpPager.vue +139 -0
- package/components/core/DpProgressBar.vue +67 -0
- package/components/core/DpRegisterFlyout.vue +58 -0
- package/components/core/DpResettableInput.vue +140 -0
- package/components/core/DpSkeletonBox.vue +32 -0
- package/components/core/DpSlidebar.vue +86 -0
- package/components/core/DpSlidingPagination.vue +45 -0
- package/components/core/DpSplitButton.vue +77 -0
- package/components/core/DpSwitcher.vue +62 -0
- package/components/core/DpTableCardList/DpTableCard.vue +61 -0
- package/components/core/DpTableCardList/DpTableCardListHeader.vue +83 -0
- package/components/core/DpTabs/DpTab.vue +52 -0
- package/components/core/DpTabs/DpTabs.vue +165 -0
- package/components/core/DpTextWrapper.vue +65 -0
- package/components/core/DpToggleForm.vue +72 -0
- package/components/core/DpTooltipIcon.vue +52 -0
- package/components/core/DpTransitionExpand.vue +87 -0
- package/components/core/DpTreeList/DpTreeList.vue +334 -0
- package/components/core/DpTreeList/DpTreeListCheckbox.vue +79 -0
- package/components/core/DpTreeList/DpTreeListNode.vue +348 -0
- package/components/core/DpTreeList/DpTreeListToggle.vue +71 -0
- package/components/core/DpTreeList/utils/constants.js +14 -0
- package/components/core/DpUpload/DpUpload.vue +223 -0
- package/components/core/DpUpload/DpUploadFiles.vue +269 -0
- package/components/core/DpUpload/DpUploadedFile.vue +80 -0
- package/components/core/DpUpload/DpUploadedFileList.vue +56 -0
- package/components/core/DpUpload/utils/GetFileIdsByHash.js +42 -0
- package/components/core/DpUpload/utils/UppyTranslations.js +31 -0
- package/components/core/DpVideoPlayer.vue +115 -0
- package/components/core/HeightLimit.vue +121 -0
- package/components/core/MultistepNav.vue +89 -0
- package/components/core/form/DpCheckbox.vue +108 -0
- package/components/core/form/DpDateRangePicker.vue +186 -0
- package/components/core/form/DpDatepicker.vue +160 -0
- package/components/core/form/DpDatetimePicker.vue +194 -0
- package/components/core/form/DpFormRow.vue +79 -0
- package/components/core/form/DpMultiselect.vue +164 -0
- package/components/core/form/DpRadio.vue +128 -0
- package/components/core/form/DpSearchField.vue +110 -0
- package/components/core/form/DpSelect.vue +149 -0
- package/components/core/form/DpTextArea.vue +152 -0
- package/components/core/form/DpTimePicker.vue +374 -0
- package/components/core/form/DpToggle.vue +78 -0
- package/components/core/index.js +132 -0
- package/components/core/notify/DpNotifyContainer.vue +122 -0
- package/components/core/notify/DpNotifyMessage.vue +95 -0
- package/components/core/shared/DpStickyElement.vue +95 -0
- package/components/index.js +24 -0
- package/components/shared/translations.js +15 -0
- package/directives/CleanHtml/CleanHtml.js +50 -0
- package/directives/CleanHtml/CleanHtml.stories.mdx +64 -0
- package/directives/Tooltip/Tooltip.js +40 -0
- package/directives/Tooltip/Tooltip.stories.mdx +42 -0
- package/directives/index.js +17 -0
- package/lib/index.js +14 -0
- package/lib/prefixClass.js +47 -0
- package/mixins/index.js +14 -0
- package/mixins/prefixClassMixin.js +22 -0
- package/package.json +52 -0
- package/shared/props.js +86 -0
- package/style/index.css +7 -0
- package/tailwind.config.js +24 -0
- package/tokens/color.json +358 -0
- package/tokens/color.stories.mdx +45 -0
- package/tokens/fontSize.json +100 -0
- package/tokens/space.json +33 -0
- package/utils/lengthHint.js +69 -0
|
@@ -0,0 +1,54 @@
|
|
|
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="box-shadow-1 space-inset-m">
|
|
12
|
+
<h4
|
|
13
|
+
v-if="heading !== ''"
|
|
14
|
+
class="u-mb-0 space-inline-xs">
|
|
15
|
+
<span>
|
|
16
|
+
{{ heading }}
|
|
17
|
+
</span>
|
|
18
|
+
<dp-contextual-help
|
|
19
|
+
v-if="headingTooltip !== ''"
|
|
20
|
+
:text="headingTooltip" />
|
|
21
|
+
</h4><!--
|
|
22
|
+
--><slot />
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
export default {
|
|
28
|
+
name: 'DpCard',
|
|
29
|
+
|
|
30
|
+
components: {
|
|
31
|
+
DpContextualHelp: () => import('./DpContextualHelp')
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
props: {
|
|
35
|
+
/**
|
|
36
|
+
* The card heading is displayed as a bold text with medium font size.
|
|
37
|
+
*/
|
|
38
|
+
heading: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: false,
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A contextual help tooltip right beside the card heading may reveal additional information.
|
|
46
|
+
*/
|
|
47
|
+
headingTooltip: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: false,
|
|
50
|
+
default: ''
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
</script>
|
|
@@ -0,0 +1,223 @@
|
|
|
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
|
+
This Component renders a dropdown/select with a checkbox.
|
|
13
|
+
If the checkbox is checked, the dropdown is read-only (and shows the current state)
|
|
14
|
+
and a datepicker gets active and another dropdown with the same options as the first one.
|
|
15
|
+
|
|
16
|
+
it is designed to be used for activating a time-controlled change of the options.
|
|
17
|
+
-->
|
|
18
|
+
<usage>
|
|
19
|
+
<dp-change-state-at-date
|
|
20
|
+
regular-dropdown-id="id_for_the_regular_dropdown_that_gets_send_if_the_checkbox_is_unchecked"
|
|
21
|
+
delayed-switch-dropdown-id="id_for_the_dropdown_that_gets_send_if_the_checkbox_is_checked"
|
|
22
|
+
label="trans.key"
|
|
23
|
+
date-id="id_for_the_date_input"
|
|
24
|
+
:status-options="[{ 'value': 'myValue', 'label': 'trans.key.one'}, {'value': 'anotherValue', 'label': 'trans.key.two'}]"
|
|
25
|
+
init-status="myValue"></dp-change-state-at-date>
|
|
26
|
+
</usage>
|
|
27
|
+
</documentation>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div>
|
|
31
|
+
<div class="layout u-mb-0_75">
|
|
32
|
+
<dp-select
|
|
33
|
+
v-model="actualStatus"
|
|
34
|
+
class="layout__item u-4-of-12"
|
|
35
|
+
:data-cy="label"
|
|
36
|
+
:label="{
|
|
37
|
+
text: Translator.trans(label)
|
|
38
|
+
}"
|
|
39
|
+
:name="regularDropdownId"
|
|
40
|
+
|
|
41
|
+
:options="statusOptions" />
|
|
42
|
+
</div>
|
|
43
|
+
<div class="layout">
|
|
44
|
+
<div class="layout__item u-5-of-12 u-12-of-12-lap-down u-mt-0_125">
|
|
45
|
+
<span>
|
|
46
|
+
<input
|
|
47
|
+
:id="checkSwitchId"
|
|
48
|
+
:name="checkSwitchId"
|
|
49
|
+
value="1"
|
|
50
|
+
type="checkbox"
|
|
51
|
+
:checked="active"
|
|
52
|
+
@click="toggleCheckbox">
|
|
53
|
+
<label
|
|
54
|
+
:for="checkSwitchId"
|
|
55
|
+
class="o-form__label display--inline-block">
|
|
56
|
+
{{ Translator.trans('change.state.at.date') }}
|
|
57
|
+
</label>
|
|
58
|
+
</span>
|
|
59
|
+
</div><!--
|
|
60
|
+
--><div
|
|
61
|
+
v-if="active"
|
|
62
|
+
class="u-mt-0_125">
|
|
63
|
+
<div
|
|
64
|
+
class="layout__item u-2-of-12 u-6-of-12-lap-down"
|
|
65
|
+
:class="{ 'color--grey': active === false }">
|
|
66
|
+
<dp-label
|
|
67
|
+
required
|
|
68
|
+
:text="Translator.trans('on')"
|
|
69
|
+
:for="dateId" />
|
|
70
|
+
<dp-datepicker
|
|
71
|
+
class="o-form__control-wrapper"
|
|
72
|
+
required
|
|
73
|
+
:id="dateId"
|
|
74
|
+
:name="dateId"
|
|
75
|
+
:min-date="disabledDates.to"
|
|
76
|
+
:disabled="active === false"
|
|
77
|
+
v-model="changeDate"
|
|
78
|
+
@change="dateChanged"
|
|
79
|
+
:calendars-after="2" />
|
|
80
|
+
</div><!--
|
|
81
|
+
--><dp-select
|
|
82
|
+
v-model="futureStatus"
|
|
83
|
+
class="layout__item u-5-of-12 u-6-of-12-lap-down"
|
|
84
|
+
:label="{
|
|
85
|
+
text: Translator.trans('change.state.to')
|
|
86
|
+
}"
|
|
87
|
+
:name="delayedSwitchDropdownId"
|
|
88
|
+
:options="statusOptions" />
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<script>
|
|
95
|
+
import { formatDate, toDate } from 'demosplan-utils'
|
|
96
|
+
import DpDatepicker from './form/DpDatepicker'
|
|
97
|
+
import { DpLabel } from 'demosplan-ui/components'
|
|
98
|
+
import DpSelect from './form/DpSelect'
|
|
99
|
+
|
|
100
|
+
export default {
|
|
101
|
+
name: 'DpChangeStateAtDate',
|
|
102
|
+
|
|
103
|
+
components: {
|
|
104
|
+
DpDatepicker,
|
|
105
|
+
DpLabel,
|
|
106
|
+
DpSelect
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
props: {
|
|
110
|
+
dateId: {
|
|
111
|
+
required: true,
|
|
112
|
+
type: String
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
delayedSwitchDropdownId: {
|
|
116
|
+
required: true,
|
|
117
|
+
type: String
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
checkSwitchId: {
|
|
121
|
+
required: false,
|
|
122
|
+
type: String,
|
|
123
|
+
default: 'change_state_delay_toggle'
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
activeDelay: {
|
|
127
|
+
required: false,
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
defaultNewState: {
|
|
133
|
+
required: false,
|
|
134
|
+
type: String,
|
|
135
|
+
default: ''
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
defaultCurrentState: {
|
|
139
|
+
required: false,
|
|
140
|
+
type: String,
|
|
141
|
+
default: ''
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
regularDropdownId: {
|
|
145
|
+
required: true,
|
|
146
|
+
type: String
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
label: {
|
|
150
|
+
required: false,
|
|
151
|
+
type: String,
|
|
152
|
+
default: ''
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
initDate: {
|
|
156
|
+
required: false,
|
|
157
|
+
type: String,
|
|
158
|
+
default: null
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
// Has to match a value from the statusOptions
|
|
162
|
+
initStatus: {
|
|
163
|
+
required: false,
|
|
164
|
+
type: String,
|
|
165
|
+
default: null
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
// Array of Objects with { value, label }
|
|
169
|
+
statusOptions: {
|
|
170
|
+
required: true,
|
|
171
|
+
type: Array
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
data () {
|
|
176
|
+
return {
|
|
177
|
+
active: this.activeDelay,
|
|
178
|
+
changeDate: '',
|
|
179
|
+
actualStatus: this.defaultCurrentState,
|
|
180
|
+
futureStatus: this.defaultNewState,
|
|
181
|
+
disabledDates: {
|
|
182
|
+
to: formatDate(this.getTomorrowDate()) // Disable all dates in the past
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
computed: {
|
|
188
|
+
initLabel () {
|
|
189
|
+
const initLabel = this.statusOptions.find(el => el.value === this.initStatus).label
|
|
190
|
+
return Translator.trans(initLabel)
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
methods: {
|
|
195
|
+
dateChanged () {
|
|
196
|
+
this.$emit('date:changed', toDate(this.changeDate))
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
getTomorrowDate () {
|
|
200
|
+
const tomorrow = new Date()
|
|
201
|
+
tomorrow.setDate(tomorrow.getDate() + 1)
|
|
202
|
+
|
|
203
|
+
return tomorrow
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
statusChanged () {
|
|
207
|
+
this.$emit('status:changed', this.newStatus)
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
toggleCheckbox () {
|
|
211
|
+
this.active = this.active === false
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
mounted () {
|
|
216
|
+
if (this.initDate !== '' && this.initDate !== null) {
|
|
217
|
+
this.changeDate = this.initDate
|
|
218
|
+
} else {
|
|
219
|
+
this.changeDate = formatDate()
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
</script>
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
<fieldset class="u-pb-0">
|
|
12
|
+
<legend
|
|
13
|
+
v-if="label !== ''"
|
|
14
|
+
v-cleanhtml="label"
|
|
15
|
+
class="font-size-medium is-label"
|
|
16
|
+
:class="inline ? 'float--left' : 'u-mb-0_25'" />
|
|
17
|
+
<dp-checkbox
|
|
18
|
+
v-for="(option, idx) in options"
|
|
19
|
+
:id="option.id"
|
|
20
|
+
:key="`option_${idx}`"
|
|
21
|
+
v-model="selected[option.id]"
|
|
22
|
+
:class="inline ? 'display--inline-block u-ml' : ''"
|
|
23
|
+
:label="{
|
|
24
|
+
text: option.label
|
|
25
|
+
}"
|
|
26
|
+
:name="option.name || ''"
|
|
27
|
+
@change="$emit('update', selected)" />
|
|
28
|
+
</fieldset>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
import { CleanHtml } from 'demosplan-ui/directives'
|
|
33
|
+
import DpCheckbox from './form/DpCheckbox'
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
name: 'DpCheckboxGroup',
|
|
37
|
+
|
|
38
|
+
components: {
|
|
39
|
+
DpCheckbox
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
directives: {
|
|
43
|
+
cleanhtml: CleanHtml
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
props: {
|
|
47
|
+
options: {
|
|
48
|
+
type: Array,
|
|
49
|
+
required: true
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
label: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: false,
|
|
55
|
+
default: ''
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
inline: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
selectedOptions: {
|
|
64
|
+
type: Object,
|
|
65
|
+
default: () => ({})
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
data () {
|
|
70
|
+
return {
|
|
71
|
+
selected: {}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
watch: {
|
|
76
|
+
selectedOptions () {
|
|
77
|
+
this.selected = this.selectedOptions
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
methods: {
|
|
82
|
+
setSelected () {
|
|
83
|
+
this.options.forEach(option => {
|
|
84
|
+
Vue.set(this.selected, option.id, false)
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
mounted () {
|
|
90
|
+
this.setSelected()
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
|
|
13
|
+
The DpContextualHelp component renders an icon indicating contextual help,
|
|
14
|
+
which shows a tooltip able to handle text or html content.
|
|
15
|
+
|
|
16
|
+
-->
|
|
17
|
+
<usage>
|
|
18
|
+
<dp-contextual-help :text="Translator.trans('statements.import.hint')" />
|
|
19
|
+
</usage>
|
|
20
|
+
</documentation>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
export default {
|
|
24
|
+
name: 'DpContextualHelp',
|
|
25
|
+
|
|
26
|
+
functional: true,
|
|
27
|
+
|
|
28
|
+
props: {
|
|
29
|
+
/**
|
|
30
|
+
* A translation key representing the actual tooltip content.
|
|
31
|
+
* May actually be any string including html.
|
|
32
|
+
*/
|
|
33
|
+
text: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
render: function (h, { props, data }) {
|
|
40
|
+
return h('i', {
|
|
41
|
+
attrs: {
|
|
42
|
+
class: `fa fa-question-circle ${typeof data.staticClass === 'undefined' ? '' : data.staticClass}`,
|
|
43
|
+
'aria-label': Translator.trans('contextual.help')
|
|
44
|
+
},
|
|
45
|
+
directives: [
|
|
46
|
+
{
|
|
47
|
+
name: 'tooltip',
|
|
48
|
+
value: props.text
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
</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
|
+
<documentation>
|
|
11
|
+
this is the button that copies text fro one textarea/editor and passes it to tiptap editor.
|
|
12
|
+
Props:
|
|
13
|
+
- copyContent - the content that we want to copy
|
|
14
|
+
- buttonlabel - the label on the button
|
|
15
|
+
|
|
16
|
+
This component takes care of the fact that we should pass to tiptap content without dp-obscure components (see: addToTarget function)
|
|
17
|
+
</documentation>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<a
|
|
21
|
+
@click.stop.prevent="$emit('set-text', copyContent)"
|
|
22
|
+
href="">
|
|
23
|
+
<i
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
class="fa fa-files-o" />
|
|
26
|
+
{{ Translator.trans(buttonLabel) }}
|
|
27
|
+
</a>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
export default {
|
|
32
|
+
name: 'DpCopyPasteButton',
|
|
33
|
+
|
|
34
|
+
props: {
|
|
35
|
+
copyContent: {
|
|
36
|
+
required: true,
|
|
37
|
+
type: String
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
buttonLabel: {
|
|
41
|
+
required: false,
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'copy'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
<dp-card
|
|
12
|
+
:heading="Translator.trans('tasks.my')">
|
|
13
|
+
<div class="u-mt">
|
|
14
|
+
<span v-cleanhtml="Translator.trans('segments.assigned.now', { count: assignedSegmentCount })" />
|
|
15
|
+
</div>
|
|
16
|
+
<div
|
|
17
|
+
class="text--right u-mt"
|
|
18
|
+
v-if="assignedSegmentCount !== 0">
|
|
19
|
+
<dp-button
|
|
20
|
+
:href="userFilteredSegmentUrl"
|
|
21
|
+
:text="Translator.trans('tasks.view')" />
|
|
22
|
+
</div>
|
|
23
|
+
</dp-card>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import { checkResponse, dpApi } from 'demosplan-utils'
|
|
28
|
+
import { CleanHtml } from 'demosplan-ui/directives'
|
|
29
|
+
import { DpButton } from 'demosplan-ui/components'
|
|
30
|
+
import DpCard from './DpCard'
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
name: 'DpDashboardTaskCard',
|
|
34
|
+
|
|
35
|
+
components: {
|
|
36
|
+
DpButton,
|
|
37
|
+
DpCard
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
directives: {
|
|
41
|
+
cleanhtml: CleanHtml
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
props: {
|
|
45
|
+
currentUserId: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: true
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
procedureId: {
|
|
51
|
+
type: String,
|
|
52
|
+
required: true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
data () {
|
|
57
|
+
return {
|
|
58
|
+
assignedSegmentCount: 0,
|
|
59
|
+
userHash: ''
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
computed: {
|
|
64
|
+
userFilteredSegmentUrl () {
|
|
65
|
+
return Routing.generate('dplan_segments_list', { procedureId: this.procedureId }) + '/' + this.userHash
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
mounted () {
|
|
70
|
+
// Filter by current user as assignee and current procedure
|
|
71
|
+
const filterQuery = {
|
|
72
|
+
[this.currentUserId]: {
|
|
73
|
+
condition: {
|
|
74
|
+
path: 'assignee',
|
|
75
|
+
value: this.currentUserId
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
sameProcedure: {
|
|
79
|
+
condition: {
|
|
80
|
+
path: 'parentStatement.procedure.id',
|
|
81
|
+
value: this.procedureId
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Get count of segments assigned to the current user
|
|
87
|
+
const segmentUrl = Routing.generate('api_resource_list', { resourceType: 'StatementSegment' })
|
|
88
|
+
dpApi.get(segmentUrl, { filter: filterQuery }, { serialize: true }).then(response => {
|
|
89
|
+
this.assignedSegmentCount = response.data.data.length
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
/*
|
|
93
|
+
* It is currently difficult to get the default filter hash but a filter hash is needed to retrieve an updated hash.
|
|
94
|
+
* Therefore, we place a get request to the default segment list route. The backend will respond with a 302 status
|
|
95
|
+
* code redirecting to the default filter hash. The 302 is handled by the browser and axios will receive the
|
|
96
|
+
* redirected response. The redirected response will contain the default filter hash, which can then be extracted
|
|
97
|
+
* and used to obtain an updated filter hash.
|
|
98
|
+
*/
|
|
99
|
+
dpApi.get(Routing.generate('dplan_segments_list', { procedureId: this.procedureId }))
|
|
100
|
+
.then(response => {
|
|
101
|
+
const redirectUrl = response.request.responseURL
|
|
102
|
+
const splitUrl = redirectUrl.split('/')
|
|
103
|
+
const queryHash = splitUrl[splitUrl.length - 1]
|
|
104
|
+
const filterData = {
|
|
105
|
+
filter: {
|
|
106
|
+
...filterQuery
|
|
107
|
+
},
|
|
108
|
+
searchPhrase: ''
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Get the actual filter hash
|
|
112
|
+
const url = Routing.generate('dplan_rpc_segment_list_query_update', { queryHash })
|
|
113
|
+
dpApi.patch(url, {}, filterData)
|
|
114
|
+
.then(response => checkResponse(response))
|
|
115
|
+
.then(response => {
|
|
116
|
+
if (response) {
|
|
117
|
+
this.userHash = response
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
</script>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
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
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param searchterm String | is the term that should be searched
|
|
13
|
+
* @param items Array | is an array of objects that should be searched
|
|
14
|
+
* @param fields Array | properties of the objects that should be included in the search.
|
|
15
|
+
* deep property access is possible (e.g. [ 'attributes.text' ])
|
|
16
|
+
* @returns Array
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
export default function dataTableSearch (searchterm, items, fields) {
|
|
20
|
+
let foundItems = items
|
|
21
|
+
if (searchterm.length > 0) {
|
|
22
|
+
// Run some replacements on the searchterm to avoid regex issues
|
|
23
|
+
const regexSpecialChars = /(\[|\]|\\|\^|\$|\.|\||\?|\*|\+|\(|\)|\.)/ig
|
|
24
|
+
let preparedSearchTerm = searchterm.replace(regexSpecialChars, '\\$1')
|
|
25
|
+
preparedSearchTerm = preparedSearchTerm.replace(/\s+/ig, '\\s+')
|
|
26
|
+
|
|
27
|
+
const searchRegex = new RegExp(preparedSearchTerm, 'ig')
|
|
28
|
+
foundItems = items.filter(item => {
|
|
29
|
+
return fields.filter(field => {
|
|
30
|
+
const path = field.split('.')
|
|
31
|
+
let nestedProp = item[path[0]]
|
|
32
|
+
let doesPropExist = !!nestedProp
|
|
33
|
+
let i = 1
|
|
34
|
+
while (doesPropExist && i < path.length) {
|
|
35
|
+
nestedProp = nestedProp[path[i]]
|
|
36
|
+
doesPropExist = !!nestedProp
|
|
37
|
+
i++
|
|
38
|
+
}
|
|
39
|
+
return typeof nestedProp === 'string' && nestedProp.match(searchRegex)
|
|
40
|
+
}).length > 0
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
return foundItems
|
|
44
|
+
}
|