2525 <NcAvatar :is-no-user =" true"
2626 :icon-class =" isEmailShareType ? 'avatar-link-share icon-mail-white' : 'avatar-link-share icon-public-white'"
2727 class =" sharing-entry__avatar" />
28- <div class =" sharing-entry__desc" @click.prevent = " toggleQuickShareSelect " >
28+ <div class =" sharing-entry__desc" >
2929 <span class =" sharing-entry__title" :title =" title" >
3030 {{ title }}
3131 </span >
3232 <p v-if =" subtitle" >
3333 {{ subtitle }}
3434 </p >
35- <QuickShareSelect v-if =" share && share.permissions !== undefined"
36- :share =" share"
37- :file-info =" fileInfo"
38- :toggle =" showDropdown"
39- @open-sharing-details =" openShareDetailsForCustomSettings(share)" />
4035 </div >
4136
4237 <!-- clipboard -->
128123 @close =" onMenuClose" >
129124 <template v-if =" share " >
130125 <template v-if =" share .canEdit && canReshare " >
131- <NcActionButton :disabled =" saving"
132- @click.prevent =" openSharingDetails" >
133- <template #icon >
134- <Tune />
135- </template >
136- {{ t('files_sharing', 'Customize link') }}
137- </NcActionButton >
126+ <!-- Custom Label -->
127+ <NcActionInput ref =" label"
128+ :class =" { error: errors.label }"
129+ :disabled =" saving"
130+ :label =" t('files_sharing', 'Share label')"
131+ :value =" share.newLabel !== undefined ? share.newLabel : share.label"
132+ icon =" icon-edit"
133+ maxlength =" 255"
134+ @update:value =" onLabelChange"
135+ @submit =" onLabelSubmit" />
136+
137+ <SharePermissionsEditor :can-reshare =" canReshare"
138+ :share.sync =" share"
139+ :file-info =" fileInfo" />
140+
141+ <NcActionSeparator />
142+
143+ <NcActionCheckbox :checked.sync =" share.hideDownload"
144+ :disabled =" saving || canChangeHideDownload"
145+ @change =" queueUpdate('hideDownload')" >
146+ {{ t('files_sharing', 'Hide download') }}
147+ </NcActionCheckbox >
148+
149+ <!-- password -->
150+ <NcActionCheckbox :checked.sync =" isPasswordProtected"
151+ :disabled =" config.enforcePasswordForPublicLink || saving"
152+ class =" share-link-password-checkbox"
153+ @uncheck =" onPasswordDisable" >
154+ {{ config.enforcePasswordForPublicLink
155+ ? t('files_sharing', 'Password protection (enforced)')
156+ : t('files_sharing', 'Password protect') }}
157+ </NcActionCheckbox >
158+
159+ <NcActionInput v-if =" isPasswordProtected"
160+ ref =" password"
161+ class =" share-link-password"
162+ :class =" { error: errors.password}"
163+ :disabled =" saving"
164+ :show-trailing-button =" hasUnsavedPassword"
165+ :required =" config.enforcePasswordForPublicLink"
166+ :value =" hasUnsavedPassword ? share.newPassword : '***************'"
167+ icon =" icon-password"
168+ autocomplete =" new-password"
169+ :type =" hasUnsavedPassword ? 'text': 'password'"
170+ @update:value =" onPasswordChange"
171+ @submit =" onPasswordSubmit" >
172+ {{ t('files_sharing', 'Enter a password') }}
173+ </NcActionInput >
174+ <NcActionText v-if =" isEmailShareType && passwordExpirationTime" icon =" icon-info" >
175+ {{ t('files_sharing', 'Password expires {passwordExpirationTime}', {passwordExpirationTime}) }}
176+ </NcActionText >
177+ <NcActionText v-else-if =" isEmailShareType && passwordExpirationTime !== null" icon =" icon-error" >
178+ {{ t('files_sharing', 'Password expired') }}
179+ </NcActionText >
180+
181+ <!-- password protected by Talk -->
182+ <NcActionCheckbox v-if =" isPasswordProtectedByTalkAvailable"
183+ :checked.sync =" isPasswordProtectedByTalk"
184+ :disabled =" !canTogglePasswordProtectedByTalkAvailable || saving"
185+ class =" share-link-password-talk-checkbox"
186+ @change =" onPasswordProtectedByTalkChange" >
187+ {{ t('files_sharing', 'Video verification') }}
188+ </NcActionCheckbox >
189+
190+ <!-- expiration date -->
191+ <NcActionCheckbox :checked.sync =" hasExpirationDate"
192+ :disabled =" config.isDefaultExpireDateEnforced || saving"
193+ class =" share-link-expire-date-checkbox"
194+ @uncheck =" onExpirationDisable" >
195+ {{ config.isDefaultExpireDateEnforced
196+ ? t('files_sharing', 'Expiration date (enforced)')
197+ : t('files_sharing', 'Set expiration date') }}
198+ </NcActionCheckbox >
199+ <NcActionInput v-if =" hasExpirationDate"
200+ ref =" expireDate"
201+ :is-native-picker =" true"
202+ :hide-label =" true"
203+ class =" share-link-expire-date"
204+ :class =" { error: errors.expireDate}"
205+ :disabled =" saving"
206+ :value =" new Date(share.expireDate)"
207+ type =" date"
208+ :min =" dateTomorrow"
209+ :max =" dateMaxEnforced"
210+ @input =" onExpirationChange" >
211+ {{ t('files_sharing', 'Enter a date') }}
212+ </NcActionInput >
213+
214+ <!-- note -->
215+ <NcActionCheckbox :checked.sync =" hasNote"
216+ :disabled =" saving"
217+ @uncheck =" queueUpdate('note')" >
218+ {{ t('files_sharing', 'Note to recipient') }}
219+ </NcActionCheckbox >
220+
221+ <NcActionTextEditable v-if =" hasNote"
222+ ref =" note"
223+ :class =" { error: errors.note}"
224+ :disabled =" saving"
225+ :placeholder =" t('files_sharing', 'Enter a note for the share recipient')"
226+ :value =" share.newNote || share.note"
227+ icon =" icon-edit"
228+ @update:value =" onNoteChange"
229+ @submit =" onNoteSubmit" />
138230 </template >
139231
140232 <NcActionSeparator />
156248 {{ name }}
157249 </NcActionLink >
158250
159- <NcActionButton v-if =" !isEmailShareType && canReshare"
160- class =" new-share-link"
161- icon =" icon-add"
162- @click.prevent.stop =" onNewLinkShare" >
163- {{ t('files_sharing', 'Add another link') }}
164- </NcActionButton >
165-
166251 <NcActionButton v-if =" share.canDelete"
167252 icon =" icon-close"
168253 :disabled =" saving"
169254 @click.prevent =" onDelete" >
170255 {{ t('files_sharing', 'Unshare') }}
171256 </NcActionButton >
257+ <NcActionButton v-if =" !isEmailShareType && canReshare"
258+ class =" new-share-link"
259+ icon =" icon-add"
260+ @click.prevent.stop =" onNewLinkShare" >
261+ {{ t('files_sharing', 'Add another link') }}
262+ </NcActionButton >
172263 </template >
173264
174265 <!-- Create new share -->
@@ -192,40 +283,39 @@ import { Type as ShareTypes } from '@nextcloud/sharing'
192283import Vue from ' vue'
193284
194285import NcActionButton from ' @nextcloud/vue/dist/Components/NcActionButton.js'
286+ import NcActionCheckbox from ' @nextcloud/vue/dist/Components/NcActionCheckbox.js'
195287import NcActionInput from ' @nextcloud/vue/dist/Components/NcActionInput.js'
196288import NcActionLink from ' @nextcloud/vue/dist/Components/NcActionLink.js'
197289import NcActionText from ' @nextcloud/vue/dist/Components/NcActionText.js'
198290import NcActionSeparator from ' @nextcloud/vue/dist/Components/NcActionSeparator.js'
291+ import NcActionTextEditable from ' @nextcloud/vue/dist/Components/NcActionTextEditable.js'
199292import NcActions from ' @nextcloud/vue/dist/Components/NcActions.js'
200293import NcAvatar from ' @nextcloud/vue/dist/Components/NcAvatar.js'
201294
202- import Tune from ' vue-material-design-icons/Tune.vue'
203-
204- import QuickShareSelect from ' ./SharingEntryQuickShareSelect.vue'
205-
206295import ExternalShareAction from ' ./ExternalShareAction.vue'
296+ import SharePermissionsEditor from ' ./SharePermissionsEditor.vue'
207297import GeneratePassword from ' ../utils/GeneratePassword.js'
208298import Share from ' ../models/Share.js'
209299import SharesMixin from ' ../mixins/SharesMixin.js'
210- import ShareDetails from ' ../mixins/ShareDetails.js'
211300
212301export default {
213302 name: ' SharingEntryLink' ,
214303
215304 components: {
216- ExternalShareAction,
217305 NcActions,
218306 NcActionButton,
307+ NcActionCheckbox,
219308 NcActionInput,
220309 NcActionLink,
221310 NcActionText,
311+ NcActionTextEditable,
222312 NcActionSeparator,
223313 NcAvatar,
224- Tune ,
225- QuickShareSelect ,
314+ ExternalShareAction ,
315+ SharePermissionsEditor ,
226316 },
227317
228- mixins: [SharesMixin, ShareDetails ],
318+ mixins: [SharesMixin],
229319
230320 props: {
231321 canReshare: {
@@ -240,7 +330,6 @@ export default {
240330
241331 data () {
242332 return {
243- showDropdown: false ,
244333 copySuccess: true ,
245334 copied: false ,
246335
@@ -504,6 +593,7 @@ export default {
504593
505594 canChangeHideDownload () {
506595 const hasDisabledDownload = (shareAttribute ) => shareAttribute .key === ' download' && shareAttribute .scope === ' permissions' && shareAttribute .enabled === false
596+
507597 return this .fileInfo .shareAttributes .some (hasDisabledDownload)
508598 },
509599 },
@@ -581,7 +671,7 @@ export default {
581671 * accordingly
582672 *
583673 * @param {Share} share the new share
584- * @param {boolean} [update] do we update the current share ?
674+ * @param {boolean} [update= false ] do we update the current share ?
585675 */
586676 async pushNewLinkShare (share , update ) {
587677 try {
@@ -658,6 +748,26 @@ export default {
658748 this .loading = false
659749 }
660750 },
751+
752+ /**
753+ * Label changed, let's save it to a different key
754+ *
755+ * @param {string} label the share label
756+ */
757+ onLabelChange (label ) {
758+ this .$set (this .share , ' newLabel' , label .trim ())
759+ },
760+
761+ /**
762+ * When the note change, we trim, save and dispatch
763+ */
764+ onLabelSubmit () {
765+ if (typeof this .share .newLabel === ' string' ) {
766+ this .share .label = this .share .newLabel
767+ this .$delete (this .share , ' newLabel' )
768+ this .queueUpdate (' label' )
769+ }
770+ },
661771 async copyLink () {
662772 try {
663773 await navigator .clipboard .writeText (this .shareLink )
@@ -760,10 +870,6 @@ export default {
760870 // YET. We can safely delete the share :)
761871 this .$emit (' remove:share' , this .share )
762872 },
763-
764- toggleQuickShareSelect () {
765- this .showDropdown = ! this .showDropdown
766- },
767873 },
768874}
769875< / script>
@@ -773,13 +879,13 @@ export default {
773879 display: flex;
774880 align- items: center;
775881 min- height: 44px ;
776-
777882 & __desc {
778883 display: flex;
779884 flex- direction: column;
780885 justify- content: space- between;
781886 padding: 8px ;
782887 line- height: 1 .2em ;
888+ overflow: hidden;
783889
784890 p {
785891 color: var (-- color- text- maxcontrast);
0 commit comments