@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,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
|
+
<documentation>
|
|
11
|
+
<!-- This component can be used as a building block for data tables. It allows for the selection of columns, emits the
|
|
12
|
+
currently selected columns and it is able to store previous user selections in local storage.-->
|
|
13
|
+
<usage>
|
|
14
|
+
<dp-column-selector
|
|
15
|
+
:selectable-columns="[[value, label]]"
|
|
16
|
+
:initial-selection="[String]"
|
|
17
|
+
:use-local-storage="Boolean"
|
|
18
|
+
:local-storage-key="String"
|
|
19
|
+
@selection-changed="changeSelection" />
|
|
20
|
+
</usage>
|
|
21
|
+
</documentation>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<dp-flyout
|
|
25
|
+
:has-menu="false"
|
|
26
|
+
@close="trackSelection">
|
|
27
|
+
<template v-slot:trigger>
|
|
28
|
+
<span>{{ Translator.trans('table.cols.select') }}</span>
|
|
29
|
+
<i
|
|
30
|
+
class="fa fa-caret-down u-ml-0_25"
|
|
31
|
+
aria-hidden="true" />
|
|
32
|
+
</template>
|
|
33
|
+
<div class="space-stack-xs u-pv-0_25">
|
|
34
|
+
<dp-checkbox
|
|
35
|
+
v-for="([value, label]) in selectableColumns"
|
|
36
|
+
:id="`columnSelector:${value}`"
|
|
37
|
+
:key="value"
|
|
38
|
+
:checked="selectedColumns.has(value)"
|
|
39
|
+
:label="{
|
|
40
|
+
text: label
|
|
41
|
+
}"
|
|
42
|
+
@change="broadcastSelection(value, !selectedColumns.has(value))" />
|
|
43
|
+
</div>
|
|
44
|
+
</dp-flyout>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import DpCheckbox from '../form/DpCheckbox'
|
|
49
|
+
import DpFlyout from '../DpFlyout'
|
|
50
|
+
import { hasOwnProp } from 'demosplan-utils'
|
|
51
|
+
|
|
52
|
+
export default {
|
|
53
|
+
name: 'DpColumnSelector',
|
|
54
|
+
components: {
|
|
55
|
+
DpCheckbox,
|
|
56
|
+
DpFlyout
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
props: {
|
|
60
|
+
selectableColumns: {
|
|
61
|
+
type: Array,
|
|
62
|
+
required: false,
|
|
63
|
+
default: () => ([])
|
|
64
|
+
},
|
|
65
|
+
initialSelection: {
|
|
66
|
+
type: Array,
|
|
67
|
+
required: false,
|
|
68
|
+
default: () => ([])
|
|
69
|
+
},
|
|
70
|
+
localStorageKey: {
|
|
71
|
+
type: String,
|
|
72
|
+
required: false,
|
|
73
|
+
default: ''
|
|
74
|
+
},
|
|
75
|
+
useLocalStorage: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
required: false,
|
|
78
|
+
default: false
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
data () {
|
|
82
|
+
return {
|
|
83
|
+
selectedColumns: new Set()
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
methods: {
|
|
87
|
+
broadcastSelection (column, shouldCheck = null) {
|
|
88
|
+
if (shouldCheck === true) {
|
|
89
|
+
this.selectedColumns.add(column)
|
|
90
|
+
} else if (shouldCheck === false) {
|
|
91
|
+
this.selectedColumns.delete(column)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const currentSelection = this.selectableColumns
|
|
95
|
+
.filter(([value, label]) => this.selectedColumns.has(value))
|
|
96
|
+
.map(([value, label]) => value)
|
|
97
|
+
|
|
98
|
+
this.$emit('selection-changed', currentSelection)
|
|
99
|
+
|
|
100
|
+
if (this.useLocalStorage) {
|
|
101
|
+
window.localStorage.setItem(this.localStorageKey, JSON.stringify(currentSelection))
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
initializeColumnSelection () {
|
|
106
|
+
if (this.useLocalStorage) {
|
|
107
|
+
if (this.localStorageKey === '') {
|
|
108
|
+
throw new Error(`${this.$options.name} should use localStorage but no localStorageKey was set.`)
|
|
109
|
+
}
|
|
110
|
+
const storedSelection = window.localStorage.getItem(this.localStorageKey)
|
|
111
|
+
this.selectedColumns = storedSelection ? new Set(JSON.parse(storedSelection)) : new Set(this.initialSelection)
|
|
112
|
+
this.broadcastSelection()
|
|
113
|
+
} else {
|
|
114
|
+
this.selectedColumns = new Set(this.initialSelection)
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* If Tracking is enabled we want to collect what columns the users select to determine
|
|
120
|
+
* a good default
|
|
121
|
+
*/
|
|
122
|
+
trackSelection () {
|
|
123
|
+
if (hasOwnProp(window, '_paq')) {
|
|
124
|
+
window._paq.push(['trackEvent', 'Column Selection', 'Segments List', this.selectedColumns])
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
mounted () {
|
|
130
|
+
this.initializeColumnSelection()
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</script>
|