@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,78 @@
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
+ Simple Toggle component
13
+
14
+ @improve T14353 rename to DpToggle
15
+ -->
16
+ </documentation>
17
+
18
+ <template>
19
+ <span
20
+ class="toggle-wrapper"
21
+ @click="toggle"
22
+ role="checkbox"
23
+ :aria-checked="value.toString()"
24
+ :aria-disabled="disabled"
25
+ tabindex="0"
26
+ @keydown.space.prevent="toggle">
27
+ <div
28
+ v-show="disabled"
29
+ class="toggle-disabled" />
30
+ <span
31
+ class="toggle-background"
32
+ :style="backgroundStyles" />
33
+ <span
34
+ class="toggle-indicator"
35
+ :style="indicatorStyles" />
36
+ </span>
37
+ </template>
38
+
39
+ <script>
40
+ // Simple Toggle by Adam Wathan https://jsfiddle.net/adamwathan/hfs34ye4/
41
+ export default {
42
+ name: 'DpToggle',
43
+
44
+ props: {
45
+ value: {
46
+ type: Boolean,
47
+ required: false,
48
+ default: false
49
+ },
50
+
51
+ disabled: {
52
+ type: Boolean,
53
+ required: false,
54
+ default: false
55
+ }
56
+ },
57
+
58
+ computed: {
59
+ backgroundStyles () {
60
+ return {
61
+ backgroundColor: this.value ? '#3490dc' : '#dae1e7'
62
+ }
63
+ },
64
+
65
+ indicatorStyles () {
66
+ return { transform: this.value ? 'translateX(1rem)' : 'translateX(0)' }
67
+ }
68
+ },
69
+
70
+ methods: {
71
+ toggle () {
72
+ if (this.disabled === false) {
73
+ this.$emit('input', !this.value)
74
+ }
75
+ }
76
+ }
77
+ }
78
+ </script>
@@ -0,0 +1,132 @@
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
+ import dataTableSearch from './DpDataTable/DataTableSearch'
11
+ import DpAccordion from './DpAccordion'
12
+ import DpAnonymizeText from './DpAnonymizeText'
13
+ import DpAutocomplete from './DpAutocomplete'
14
+ import DpBulkEditHeader from './DpBulkEditHeader'
15
+ import DpButtonIcon from './DpButtonIcon'
16
+ import DpButtonRow from './DpButtonRow'
17
+ import DpCard from './DpCard'
18
+ import DpChangeStateAtDate from './DpChangeStateAtDate'
19
+ import DpCheckbox from './form/DpCheckbox'
20
+ import DpCheckboxGroup from './DpCheckboxGroup'
21
+ import DpColumnSelector from './DpDataTable/DpColumnSelector'
22
+ import DpContextualHelp from './DpContextualHelp'
23
+ import DpCopyPasteButton from './DpCopyPasteButton'
24
+ import DpDashboardTaskCard from './DpDashboardTaskCard'
25
+ import DpDataTable from './DpDataTable/DpDataTable'
26
+ import DpDataTableExtended from './DpDataTable/DpDataTableExtended'
27
+ import DpDatepicker from './form/DpDatepicker'
28
+ import DpDateRangePicker from './form/DpDateRangePicker'
29
+ import DpDatetimePicker from './form/DpDatetimePicker'
30
+ import DpEditableList from './DpEditableList'
31
+ import DpEditor from './DpEditor/DpEditor'
32
+ import DpFlyout from './DpFlyout'
33
+ import DpFormRow from './form/DpFormRow'
34
+ import DpHeightLimit from './HeightLimit'
35
+ import DpInlineNotification from './DpInlineNotification'
36
+ import DpModal from './DpModal'
37
+ import DpMultiselect from './form/DpMultiselect'
38
+ import DpNotifyContainer from './notify/DpNotifyContainer'
39
+ import DpObscure from './DpObscure'
40
+ import DpPager from './DpPager'
41
+ import DpProgressBar from './DpProgressBar'
42
+ import DpRadio from './form/DpRadio'
43
+ import DpRegisterFlyout from './DpRegisterFlyout'
44
+ import DpResettableInput from './DpResettableInput'
45
+ import DpSearchField from './form/DpSearchField'
46
+ import DpSelect from './form/DpSelect'
47
+ import DpSelectPageItemCount from './DpDataTable/DpSelectPageItemCount'
48
+ import DpSkeletonBox from './DpSkeletonBox'
49
+ import DpSlidebar from './DpSlidebar'
50
+ import DpSlidingPagination from './DpSlidingPagination'
51
+ import DpSplitButton from './DpSplitButton'
52
+ import DpStickyElement from './shared/DpStickyElement'
53
+ import DpSwitcher from './DpSwitcher'
54
+ import DpTab from './DpTabs/DpTab'
55
+ import DpTableCard from './DpTableCardList/DpTableCard'
56
+ import DpTableCardListHeader from './DpTableCardList/DpTableCardListHeader'
57
+ import DpTabs from './DpTabs/DpTabs'
58
+ import DpTextArea from './form/DpTextArea'
59
+ import DpTextWrapper from './DpTextWrapper'
60
+ import DpTimePicker from './form/DpTimePicker'
61
+ import DpToggle from './form/DpToggle'
62
+ import DpToggleForm from './DpToggleForm'
63
+ import DpTooltipIcon from './DpTooltipIcon'
64
+ import DpTransitionExpand from './DpTransitionExpand'
65
+ import DpTreeList from './DpTreeList/DpTreeList'
66
+ import DpUploadFiles from './DpUpload/DpUploadFiles'
67
+ import DpVideoPlayer from './DpVideoPlayer'
68
+ import { getFileIdsByHash } from './DpUpload/utils/GetFileIdsByHash'
69
+ import MultistepNav from './MultistepNav'
70
+
71
+ export {
72
+ dataTableSearch,
73
+ DpAccordion,
74
+ DpAnonymizeText,
75
+ DpAutocomplete,
76
+ DpBulkEditHeader,
77
+ DpButtonIcon,
78
+ DpButtonRow,
79
+ DpCard,
80
+ DpChangeStateAtDate,
81
+ DpCheckbox,
82
+ DpCheckboxGroup,
83
+ DpColumnSelector,
84
+ DpContextualHelp,
85
+ DpCopyPasteButton,
86
+ DpDashboardTaskCard,
87
+ DpDataTable,
88
+ DpDataTableExtended,
89
+ DpDatepicker,
90
+ DpDateRangePicker,
91
+ DpDatetimePicker,
92
+ DpEditableList,
93
+ DpEditor,
94
+ DpFlyout,
95
+ DpFormRow,
96
+ DpHeightLimit,
97
+ DpInlineNotification,
98
+ DpModal,
99
+ DpMultiselect,
100
+ DpNotifyContainer,
101
+ DpObscure,
102
+ DpPager,
103
+ DpProgressBar,
104
+ DpRadio,
105
+ DpRegisterFlyout,
106
+ DpResettableInput,
107
+ DpSearchField,
108
+ DpSelect,
109
+ DpSelectPageItemCount,
110
+ DpSkeletonBox,
111
+ DpSlidebar,
112
+ DpSlidingPagination,
113
+ DpSplitButton,
114
+ DpStickyElement,
115
+ DpSwitcher,
116
+ DpTab,
117
+ DpTableCard,
118
+ DpTableCardListHeader,
119
+ DpTabs,
120
+ DpTextArea,
121
+ DpTextWrapper,
122
+ DpTimePicker,
123
+ DpToggle,
124
+ DpToggleForm,
125
+ DpTooltipIcon,
126
+ DpTransitionExpand,
127
+ DpTreeList,
128
+ DpUploadFiles,
129
+ DpVideoPlayer,
130
+ getFileIdsByHash,
131
+ MultistepNav
132
+ }
@@ -0,0 +1,122 @@
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
+ <!-- @improve check for a11y issues, see https://inclusive-components.design/notifications/ -->
11
+ <template>
12
+ <div
13
+ :class="prefixClass('c-notify')"
14
+ :aria-live="liveState">
15
+ <transition-group name="transition-slide-up">
16
+ <dp-notify-message
17
+ v-for="message in messages"
18
+ :key="message.uid"
19
+ :message="message"
20
+ @dp-notify-remove="removeMessage"
21
+ :role="messageRole" />
22
+ </transition-group>
23
+ </div>
24
+ </template>
25
+
26
+ <script>
27
+ import { mapMutations, mapState } from 'vuex'
28
+ import DpNotifyMessage from './DpNotifyMessage'
29
+ import { hasOwnProp } from 'demosplan-utils'
30
+ import { prefixClassMixin } from 'demosplan-ui/mixins'
31
+
32
+ export default {
33
+ name: 'DpNotifyContainer',
34
+
35
+ components: {
36
+ DpNotifyMessage
37
+ },
38
+
39
+ mixins: [prefixClassMixin],
40
+
41
+ props: {
42
+ /**
43
+ * { confirm: [{
44
+ * message: String,
45
+ * linkUrl: String,
46
+ * linkText: String
47
+ * }, {
48
+ * message: String,
49
+ * linkUrl: String,
50
+ * linkText: String
51
+ * }]
52
+ * }
53
+ */
54
+ notifications: {
55
+ type: [Object, Array],
56
+ required: false,
57
+ default () {
58
+ return []
59
+ }
60
+ }
61
+ },
62
+
63
+ data () {
64
+ return {
65
+ isVisible: false
66
+ }
67
+ },
68
+
69
+ computed: {
70
+ ...mapState('notify', ['messages']),
71
+
72
+ liveState () {
73
+ return (this.isVisible) ? 'polite' : 'off'
74
+ },
75
+
76
+ messageRole () {
77
+ return (this.isVisible) ? 'message' : 'none'
78
+ }
79
+ },
80
+
81
+ methods: {
82
+ ...mapMutations('notify', ['add', 'remove']),
83
+
84
+ init () {
85
+ for (const type in this.notifications) {
86
+ if (hasOwnProp(this.notifications, type)) {
87
+ const messages = this.notifications[type]
88
+
89
+ let i = 0
90
+ const l = messages.length
91
+ let message
92
+
93
+ for (; i < l; i++) {
94
+ message = messages[i]
95
+ // Support legacy messages
96
+ if (typeof message === 'string') {
97
+ message = { message: message }
98
+ }
99
+
100
+ this.add({
101
+ type,
102
+ text: message.message || '',
103
+ linkUrl: message.linkUrl || '',
104
+ linkText: message.linkText || ''
105
+ })
106
+ }
107
+ }
108
+ }
109
+
110
+ document.addEventListener('visibilitychange', () => { this.isVisible = document.hidden })
111
+ },
112
+
113
+ removeMessage (message) {
114
+ this.remove(message)
115
+ }
116
+ },
117
+
118
+ created () {
119
+ this.init()
120
+ }
121
+ }
122
+ </script>
@@ -0,0 +1,95 @@
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="prefixClass('c-notify__message ' + messageClass)">
13
+ <i
14
+ :class="prefixClass('c-notify__closer fa fa-times-circle cursor--pointer')"
15
+ aria-hidden="true"
16
+ @click.stop.prevent="hide" />
17
+
18
+ <div :class="prefixClass('cf')">
19
+ <i
20
+ :class="prefixClass('fa u-mt-0_125 u-mr-0_25 float--left ' + messageIcon)" />
21
+ <div :class="prefixClass('u-ml')">
22
+ {{ message.text }}
23
+ <a
24
+ v-if="message.linkUrl"
25
+ :class="prefixClass('c-notify__link u-mt-0_25')"
26
+ :href="message.linkUrl"
27
+ data-cy="messageLink">
28
+ {{ message.linkText || message.linkUrl }}
29
+ </a>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </template>
34
+
35
+ <script>
36
+ import { prefixClassMixin } from 'demosplan-ui/mixins'
37
+
38
+ export default {
39
+ name: 'DpNotifyMessage',
40
+
41
+ mixins: [prefixClassMixin],
42
+
43
+ props: {
44
+ /**
45
+ * A single notification message object containing type, text(, linkUrl, linkText)
46
+ */
47
+ message: {
48
+ type: Object,
49
+ required: true
50
+ },
51
+ hideTimer: {
52
+ type: Number,
53
+ required: false,
54
+ default: 20000
55
+ }
56
+ },
57
+
58
+ data () {
59
+ return {
60
+ messageId: '',
61
+ icons: {
62
+ info: 'fa-info-circle',
63
+ warning: 'fa-exclamation-triangle',
64
+ error: 'fa-exclamation-circle',
65
+ confirm: 'fa-check-circle',
66
+ dev: 'fa-info-circle'
67
+ }
68
+ }
69
+ },
70
+
71
+ computed: {
72
+ messageClass () {
73
+ return 'c-notify__message--' + this.message.type
74
+ },
75
+
76
+ messageIcon () {
77
+ return this.icons[this.message.type]
78
+ }
79
+ },
80
+
81
+ methods: {
82
+ hide () {
83
+ this.$emit('dp-notify-remove', this.message)
84
+ }
85
+ },
86
+
87
+ mounted () {
88
+ if (this.message.type !== 'error') {
89
+ setTimeout(() => {
90
+ this.hide()
91
+ }, this.hideTimer)
92
+ }
93
+ }
94
+ }
95
+ </script>
@@ -0,0 +1,95 @@
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="{'o-sticky--border': border, 'u-z-fixed': applyZIndex}"
13
+ class="o-sticky bg-color--white">
14
+ <slot />
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ import { Stickier } from 'demosplan-utils'
20
+
21
+ export default {
22
+ name: 'DpStickyElement',
23
+
24
+ props: {
25
+ /**
26
+ * If set to false, no z-index is applied to the element.
27
+ */
28
+ applyZIndex: {
29
+ required: false,
30
+ type: Boolean,
31
+ default: true
32
+ },
33
+
34
+ /**
35
+ * Whether the element should show an 1px border when being sticky.
36
+ * When enabled, the border is always displayed on the side of the
37
+ * element opposite to the direction the element sticks to.
38
+ */
39
+ border: {
40
+ required: false,
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+
45
+ /**
46
+ * Reference to the HTMLElement that should serve as the context for the sticky element.
47
+ * If omitted, the Stickier lib will default to this.$el.offsetParent
48
+ */
49
+ context: {
50
+ type: HTMLElement,
51
+ required: false,
52
+ default: undefined
53
+ },
54
+
55
+ /**
56
+ * The direction the element should stick to.
57
+ */
58
+ direction: {
59
+ required: false,
60
+ type: String,
61
+ default: 'top'
62
+ },
63
+
64
+ /**
65
+ * Whether context changes should trigger a refresh of stickier positions.
66
+ */
67
+ observeContext: {
68
+ required: false,
69
+ type: Boolean,
70
+ default: true
71
+ },
72
+
73
+ /**
74
+ * The offset from context the element should go into/out of sticky mode.
75
+ */
76
+ offset: {
77
+ required: false,
78
+ type: Number,
79
+ default: 0
80
+ }
81
+ },
82
+
83
+ mounted () {
84
+ this.stickyElement = new Stickier(
85
+ this.$el,
86
+ this.context,
87
+ this.offset,
88
+ this.direction,
89
+ 'palm',
90
+ false,
91
+ this.observeContext
92
+ )
93
+ }
94
+ }
95
+ </script>
@@ -0,0 +1,24 @@
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
+ import DpButton from './DpButton/DpButton'
11
+ import DpDetails from './DpDetails/DpDetails'
12
+ import DpIcon from './DpIcon/DpIcon'
13
+ import DpInput from './DpInput/DpInput'
14
+ import DpLabel from './DpLabel/DpLabel'
15
+ import DpLoading from './DpLoading/DpLoading'
16
+
17
+ export {
18
+ DpButton,
19
+ DpDetails,
20
+ DpIcon,
21
+ DpInput,
22
+ DpLabel,
23
+ DpLoading
24
+ }
@@ -0,0 +1,15 @@
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
+ const de = {
11
+ contextualHelp: 'Kontexthilfe',
12
+ loadingData: 'Daten werden geladen...'
13
+ }
14
+
15
+ export { de }
@@ -0,0 +1,50 @@
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
+ import DOMPurify from 'dompurify'
11
+
12
+ /**
13
+ * Checks the type of value and always returns an object to be used with setInnerHTML.
14
+ * If a string is passed, its value is used as content.
15
+ * @param value {Object<content, options>|String}
16
+ * @return {{content}|*}
17
+ */
18
+ const getOptions = (value) => {
19
+ const type = typeof value
20
+ if (type === 'string') {
21
+ return {
22
+ content: value
23
+ }
24
+ } else if (type === 'object') {
25
+ return value
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Apply a sanitized string to the innerHtml of element.
31
+ * @param el
32
+ * @param binding
33
+ */
34
+ const setSanitizedInnerHTML = (el, binding) => {
35
+ const { content, options = {} } = getOptions(binding.value)
36
+ el.innerHTML = DOMPurify.sanitize(content, options)
37
+ }
38
+
39
+ const CleanHtml = {
40
+ bind: function (el, binding) {
41
+ setSanitizedInnerHTML(el, binding)
42
+ },
43
+ update: function (el, binding) {
44
+ if (binding.value !== binding.oldValue) {
45
+ setSanitizedInnerHTML(el, binding)
46
+ }
47
+ }
48
+ }
49
+
50
+ export { CleanHtml }
@@ -0,0 +1,64 @@
1
+ import { Meta } from '@storybook/addon-docs'
2
+
3
+ <Meta
4
+ title="Directives/CleanHtml"
5
+ parameters={{
6
+ viewMode: 'docs',
7
+ previewTabs: {
8
+ canvas: {
9
+ hidden: true
10
+ }
11
+ },
12
+ }} />
13
+
14
+ # CleanHtml
15
+
16
+ This directive sanitizes Html. It builds on the XSS sanitizer library [DOMPurify](https://github.com/cure53/DOMPurify).
17
+
18
+ The directive can be passed a (probably html-)string directly, or alongside any [DOMPurify option](https://github.com/cure53/DOMPurify#can-i-configure-dompurify).
19
+
20
+ ## Simple usage
21
+
22
+ Malicious code is filtered out, according to the DOMPurify [default behavior](https://github.com/cure53/DOMPurify#some-purification-samples-please).
23
+
24
+ ```html
25
+ <template>
26
+ <div>
27
+ <span v-cleanhtml="someValue">
28
+ </div>
29
+ </template>
30
+ import { CleanHtml } from 'demosplan-ui/directives'
31
+
32
+ export default {
33
+ name: 'MyComponent',
34
+
35
+ directives: {
36
+ cleanhtml: CleanHtml
37
+ },
38
+
39
+ //...
40
+ }
41
+ ```
42
+
43
+ ## Usage with options
44
+
45
+ Malicious code is filtered out, and only p and span tags are allowed.
46
+
47
+ ```html
48
+ <template>
49
+ <div>
50
+ <span v-cleanhtml="{ content: someValue, options: { ALLOWED_TAGS: ['p', 'span'] }">
51
+ </div>
52
+ </template>
53
+ import { CleanHtml } from 'demosplan-ui/directives'
54
+
55
+ export default {
56
+ name: 'MyComponent',
57
+
58
+ directives: {
59
+ cleanhtml: CleanHtml
60
+ },
61
+
62
+ //...
63
+ }
64
+ ```